@symbo.ls/create 2.9.6 → 2.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +22 -13
  2. package/package.json +3 -2
package/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  'use strict'
2
2
 
3
3
  import DOM from 'domql'
4
- import { isSting } from '@domql/utils'
4
+ import { isString, overwriteDeep } from '@domql/utils'
5
5
 
6
6
  import * as smbls from '@symbo.ls/uikit'
7
- import { init } from '@symbo.ls/init'
7
+ import { init, DYNAMIC_JSON } from '@symbo.ls/init'
8
+ import { fetch } from '@symbo.ls/fetch'
8
9
 
9
10
  import { define } from './define'
10
11
 
@@ -21,24 +22,32 @@ const defaultOptions = {
21
22
  define
22
23
  }
23
24
 
24
- export const create = (app, options = defaultOptions) => {
25
- const { state, pages, system, components, define } = options
26
- const designSystem = init(system)
25
+ export const create = (App, options = defaultOptions) => {
26
+ const { components, define } = options
27
+ const designSystem = init(options.system)
27
28
 
28
- if (isSting)
29
-
30
- if (define) DOM.define(define)
29
+ const appIsKey = isString(App)
30
+ const key = options.key || SYMBOLS_KEY || (appIsKey && App)
31
+
32
+ if (appIsKey) App = {}
33
+ if (key) {
34
+ if (options.remote) {
35
+ const data = fetch(key)
36
+ overwriteDeep(data, options)
37
+ }
38
+ else options = DYNAMIC_JSON
39
+ }
40
+
41
+ if (define) DOM.define(options.define)
31
42
 
32
43
  return DOM.create({
33
- extend: app,
34
- routes: pages,
35
-
44
+ extend: App,
45
+ routes: options.pages,
46
+ state: options.state,
36
47
  }, null, 'app', {
37
48
  extend: [smbls.Box],
38
49
  context: {
39
50
  components: { ...smbls, ...components },
40
- state,
41
- pages,
42
51
  system: designSystem
43
52
  },
44
53
  // TODO: move define here,
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.9.6",
3
+ "version": "2.9.10",
4
4
  "license": "MIT",
5
- "gitHead": "6378f05ba88065ef932810a1582f45e0384feafc",
5
+ "gitHead": "e7e2ad37403518d13a611379ab6278934c260bb5",
6
6
  "source": "index.js",
7
7
  "main": "index.js",
8
8
  "dependencies": {
9
9
  "@domql/utils": "latest",
10
+ "@symbo.ls/fetch": "latest",
10
11
  "@symbo.ls/init": "latest",
11
12
  "@symbo.ls/uikit": "latest",
12
13
  "domql": "latest"