Browse Source

shaping main.imba content into default template

master
Marek Piasecki 2 years ago
parent
commit
f0578ea042
  1. 87
      package-lock.json
  2. 9
      package.json
  3. 32
      src/main.imba
  4. 3
      src/router_tag.imba
  5. 3
      vite.config.js

87
package-lock.json

@ -6,9 +6,17 @@
"": {
"name": "pro-router-imba2",
"dependencies": {
"pro-router": "^4.3.2"
"pro-router": "^4.3.2",
"lodash.chunk": "^4.2.0",
"lodash.compact": "^3.0.1",
"lodash.flatten": "^4.4.0",
"lodash.frompairs": "^4.0.1",
"lodash.includes": "^4.3.0",
"lodash.reject": "^4.6.0",
"lodash.topairs": "^4.3.0"
},
"devDependencies": {
"commander": "^6.2.1",
"imba": "^2.0.0-alpha.226",
"vite": "^3.2.5",
"vite-plugin-imba": "^0.10.1"
@ -316,6 +324,13 @@
"node": ">=8"
}
},
"node_modules/@testing-library/jest-dom/node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true,
"peer": true
},
"node_modules/@types/aria-query": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz",
@ -709,6 +724,15 @@
"node": ">=0.1.90"
}
},
"node_modules/commander": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true,
"engines": {
"node": ">= 6"
}
},
"node_modules/cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
@ -2111,12 +2135,40 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true,
"peer": true
"node_modules/lodash.chunk": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.chunk/-/lodash.chunk-4.2.0.tgz",
"integrity": "sha512-ZzydJKfUHJwHa+hF5X66zLFCBrWn5GeF28OHEr4WVWtNDXlQ/IjWKPBiikqKo2ne0+v6JgCgJ0GzJp8k8bHC7w=="
},
"node_modules/lodash.compact": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/lodash.compact/-/lodash.compact-3.0.1.tgz",
"integrity": "sha512-2ozeiPi+5eBXW1CLtzjk8XQFhQOEMwwfxblqeq6EGyTxZJ1bPATqilY0e6g2SLQpP4KuMeuioBhEnWz5Pr7ICQ=="
},
"node_modules/lodash.flatten": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz",
"integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g=="
},
"node_modules/lodash.frompairs": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/lodash.frompairs/-/lodash.frompairs-4.0.1.tgz",
"integrity": "sha512-dvqe2I+cO5MzXCMhUnfYFa9MD+/760yx2aTAN1lqEcEkf896TxgrX373igVdqSJj6tQd0jnSLE1UMuKufqqxFw=="
},
"node_modules/lodash.includes": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
"integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w=="
},
"node_modules/lodash.reject": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz",
"integrity": "sha512-qkTuvgEzYdyhiJBx42YPzPo71R1aEr0z79kAv7Ixg8wPFEjgRgJdUsGMG3Hf3OYSF/kHI79XhNlt+5Ar6OzwxQ=="
},
"node_modules/lodash.topairs": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.topairs/-/lodash.topairs-4.3.0.tgz",
"integrity": "sha512-qrRMbykBSEGdOgQLJJqVSdPWMD7Q+GJJ5jMRfQYb+LTLsw3tYVIabnCzRqTJb2WTo17PG5gNzXuFaZgYH/9SAQ=="
},
"node_modules/loupe": {
"version": "2.3.6",
@ -3293,6 +3345,13 @@
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true,
"peer": true
}
}
},
@ -3605,6 +3664,12 @@
"integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
"dev": true
},
"commander": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true
},
"cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
@ -4533,11 +4598,9 @@
}
},
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true,
"peer": true
"version": "4.11.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.11.1.tgz",
"integrity": "sha512-zQXZjpw5m367A/MrkEIx1xEJISQmZykAJ5EzCPznYZiVLK211R1hDiye+TU4eyWKDfsaBsLW6/7gH5juuZ4J6Q=="
},
"loupe": {
"version": "2.3.6",

9
package.json

@ -21,9 +21,16 @@
},
"dependencies": {
"pro-router": "^4.3.2",
"lodash": "4.11.1"
"lodash.chunk": "^4.2.0",
"lodash.compact": "^3.0.1",
"lodash.flatten": "^4.4.0",
"lodash.frompairs": "^4.0.1",
"lodash.includes": "^4.3.0",
"lodash.reject": "^4.6.0",
"lodash.topairs": "^4.3.0"
},
"devDependencies": {
"commander": "^6.2.1",
"imba": "^2.0.0-alpha.226",
"vite": "^3.2.5",
"vite-plugin-imba": "^0.10.1"

32
src/main.imba

@ -1,5 +1,12 @@
import "./router_tag.imba"
import { compact, fromPairs, chunk, includes, reject, toPairs, flatten } from 'lodash'
import compact from 'lodash.compact'
import fromPairs from 'lodash.frompairs'
import chunk from 'lodash.chunk'
import includes from 'lodash.includes'
import reject from 'lodash.reject'
import toPairs from 'lodash.topairs'
import flatten from 'lodash.flatten'
let helpers =
compact: compact
@ -10,23 +17,17 @@ let helpers =
toPairs: toPairs
flatten: flatten
R.init(helpers: helpers, root: 'a', render: imba.commit)
tag view-a
<self><h1> 'a'
# EDIT BELOW
tag view-b
<self><h1> 'b'
R.init(helpers: helpers, root: 'home', render: imba.commit)
tag view-c
<self><h1> 'c'
tag view-home
<self><h1> 'Imba2 on Pro Router is working...'
R.setters.e = do |v| "--{v}" if v
R.getters.e = do |v| v.slice(2)
tag view-e
<self><h1> 'e'
tag view-not_found
<self><h1> "Page not found :("
tag app
tag App
<self[d:bbox]>
<pro-ref view=v> v for v in R.views
<pro-ref view="d"> 'd'
@ -38,5 +39,4 @@ tag app
<pro-router>
<input$v type='text' value=R.param('e') @keyup=R.write('e', $v.value)>
if import.meta.env.MODE is 'development'
imba.mount <app>
imba.mount <App> if import.meta.env.MODE is 'development'

3
src/router_tag.imba

@ -28,6 +28,3 @@ tag pro-ref < pro-ref-f
#params = JSON.parse JSON.stringify(params) # duplicate object
#params[k] ||= v for own k, v of R.safe_params
R.to_path view, #params
tag view-not_found
<self><h1> "Page not found :("

3
vite.config.js

@ -19,7 +19,8 @@ function proRouterViews() {
let result = null
let views = ""
while(result = viewRegExp.exec(src)) {
views += "Views.push(\""+ result[1] +"\");"
if(result[1] != 'not_found')
views += "Views.push(\""+ result[1] +"\");"
}
return { code: views+src, map: null }
}

Loading…
Cancel
Save