@symbo.ls/create 3.0.100 → 3.1.2

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.
@@ -38,8 +38,8 @@ const fetchAsync = (app, key, options, callback) => {
38
38
  try {
39
39
  if (options.editor.async) {
40
40
  (0, import_fetch.fetchProjectAsync)(key, options, callback || ((data) => {
41
- if ((0, import_utils.isObject)(data.designsystem)) {
42
- options.utils.init(data.designsystem);
41
+ if ((0, import_utils.isObject)(data.designSystem)) {
42
+ options.utils.init(data.designSystem);
43
43
  }
44
44
  if ((0, import_utils.isObject)(data.state)) {
45
45
  app.state.set(data.state);
package/dist/cjs/index.js CHANGED
@@ -47,25 +47,46 @@ const mergeWithLocalFile = (options, optionsExternalFile) => (0, import_utils.de
47
47
  (0, import_utils.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic.default || {}
48
48
  );
49
49
  const create = (App, options = import_options.default, optionsExternalFile) => {
50
- const redefinedOptions = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
50
+ const redefinedOptions = {
51
+ ...import_options.default,
52
+ ...mergeWithLocalFile(options, optionsExternalFile)
53
+ };
51
54
  const domqlApp = (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
52
55
  (0, import_router.popStateRouter)(domqlApp, redefinedOptions);
53
- if (redefinedOptions.on && redefinedOptions.on.create) redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
56
+ if (redefinedOptions.on && redefinedOptions.on.create)
57
+ redefinedOptions.on.create(
58
+ domqlApp,
59
+ domqlApp.state,
60
+ domqlApp.context,
61
+ redefinedOptions
62
+ );
54
63
  return domqlApp;
55
64
  };
56
65
  const createAsync = (App, options = import_options.default, optionsExternalFile) => {
57
66
  const domqlApp = create(App, options, optionsExternalFile);
58
- const redefinedOptions = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
67
+ const redefinedOptions = {
68
+ ...import_options.default,
69
+ ...mergeWithLocalFile(options, optionsExternalFile)
70
+ };
59
71
  const key = redefinedOptions.key;
60
72
  (0, import_ferchOnCreate.fetchAsync)(domqlApp, key, { utils, ...redefinedOptions });
61
73
  return domqlApp;
62
74
  };
63
75
  const createSync = async (App, options = import_options.default, optionsExternalFile) => {
64
- const redefinedOptions = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
76
+ const redefinedOptions = {
77
+ ...import_options.default,
78
+ ...mergeWithLocalFile(options, optionsExternalFile)
79
+ };
65
80
  const key = options.key;
66
81
  await (0, import_ferchOnCreate.fetchSync)(key, redefinedOptions);
67
82
  const domqlApp = await (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
68
- if (redefinedOptions.on && redefinedOptions.on.create) await redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
83
+ if (redefinedOptions.on && redefinedOptions.on.create)
84
+ await redefinedOptions.on.create(
85
+ domqlApp,
86
+ domqlApp.state,
87
+ domqlApp.context,
88
+ redefinedOptions
89
+ );
69
90
  return domqlApp;
70
91
  };
71
92
  const createSkeleton = (App = {}, options = import_options.default, optionsExternalFile) => {
@@ -25,7 +25,6 @@ __export(router_exports, {
25
25
  module.exports = __toCommonJS(router_exports);
26
26
  var import_router = require("@domql/router");
27
27
  var import_utils = require("@domql/utils");
28
- var import_uikit = require("@symbo.ls/uikit");
29
28
  const DEFAULT_ROUTING_OPTIONS = {
30
29
  initRouter: true,
31
30
  injectRouterInLinkComponent: true,
@@ -37,10 +36,10 @@ const initRouter = (element, context) => {
37
36
  else (0, import_utils.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS);
38
37
  const routerOptions = context.router;
39
38
  const router = context.utils && context.utils.router ? context.utils.router : import_router.router;
40
- const onRouterRenderDefault = (el, s) => {
39
+ const onRouterRenderDefault = async (el, s) => {
41
40
  const { pathname, search, hash } = import_utils.window.location;
42
41
  const url = pathname + search + hash;
43
- if (el.routes) router(url, el, {}, { initialRender: true });
42
+ if (el.routes) await router(url, el, {}, { initialRender: true });
44
43
  };
45
44
  const hasRenderRouter = element.on && !(0, import_utils.isUndefined)(element.on.renderRouter) || !(0, import_utils.isUndefined)(element.onRenderRouter);
46
45
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
@@ -52,7 +51,7 @@ const initRouter = (element, context) => {
52
51
  };
53
52
  }
54
53
  }
55
- injectRouterInLinkComponent(routerOptions);
54
+ injectRouterInLinkComponent(context, routerOptions);
56
55
  return routerOptions;
57
56
  };
58
57
  let popStateFired;
@@ -68,8 +67,9 @@ const popStateRouter = (element, context) => {
68
67
  router(url, element, {}, { pushState: false, scrollToTop: false, level: 0 });
69
68
  };
70
69
  };
71
- const injectRouterInLinkComponent = (routerOptions) => {
70
+ const injectRouterInLinkComponent = (context, routerOptions) => {
71
+ const { Link, RouterLink } = context.components;
72
72
  if (routerOptions && routerOptions.injectRouterInLinkComponent) {
73
- return (0, import_utils.deepMerge)(import_uikit.Link, import_uikit.RouterLink);
73
+ return (0, import_utils.deepMerge)(Link, RouterLink);
74
74
  }
75
75
  };
@@ -14,8 +14,8 @@ const fetchAsync = (app, key, options, callback) => {
14
14
  try {
15
15
  if (options.editor.async) {
16
16
  fetchProjectAsync(key, options, callback || ((data) => {
17
- if (isObject(data.designsystem)) {
18
- options.utils.init(data.designsystem);
17
+ if (isObject(data.designSystem)) {
18
+ options.utils.init(data.designSystem);
19
19
  }
20
20
  if (isObject(data.state)) {
21
21
  app.state.set(data.state);
package/dist/esm/index.js CHANGED
@@ -29,7 +29,13 @@ const create = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
29
29
  const redefinedOptions = __spreadValues(__spreadValues({}, DEFAULT_CREATE_OPTIONS), mergeWithLocalFile(options, optionsExternalFile));
30
30
  const domqlApp = createDomqlElement(App, redefinedOptions);
31
31
  popStateRouter(domqlApp, redefinedOptions);
32
- if (redefinedOptions.on && redefinedOptions.on.create) redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
32
+ if (redefinedOptions.on && redefinedOptions.on.create)
33
+ redefinedOptions.on.create(
34
+ domqlApp,
35
+ domqlApp.state,
36
+ domqlApp.context,
37
+ redefinedOptions
38
+ );
33
39
  return domqlApp;
34
40
  };
35
41
  const createAsync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
@@ -44,7 +50,13 @@ const createSync = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExternal
44
50
  const key = options.key;
45
51
  await fetchSync(key, redefinedOptions);
46
52
  const domqlApp = await createDomqlElement(App, redefinedOptions);
47
- if (redefinedOptions.on && redefinedOptions.on.create) await redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
53
+ if (redefinedOptions.on && redefinedOptions.on.create)
54
+ await redefinedOptions.on.create(
55
+ domqlApp,
56
+ domqlApp.state,
57
+ domqlApp.context,
58
+ redefinedOptions
59
+ );
48
60
  return domqlApp;
49
61
  };
50
62
  const createSkeleton = (App = {}, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
@@ -1,6 +1,5 @@
1
1
  import { router as defaultRouter } from "@domql/router";
2
2
  import { window, deepMerge, merge, isUndefined } from "@domql/utils";
3
- import { Link, RouterLink } from "@symbo.ls/uikit";
4
3
  const DEFAULT_ROUTING_OPTIONS = {
5
4
  initRouter: true,
6
5
  injectRouterInLinkComponent: true,
@@ -12,10 +11,10 @@ const initRouter = (element, context) => {
12
11
  else merge(context.router || {}, DEFAULT_ROUTING_OPTIONS);
13
12
  const routerOptions = context.router;
14
13
  const router = context.utils && context.utils.router ? context.utils.router : defaultRouter;
15
- const onRouterRenderDefault = (el, s) => {
14
+ const onRouterRenderDefault = async (el, s) => {
16
15
  const { pathname, search, hash } = window.location;
17
16
  const url = pathname + search + hash;
18
- if (el.routes) router(url, el, {}, { initialRender: true });
17
+ if (el.routes) await router(url, el, {}, { initialRender: true });
19
18
  };
20
19
  const hasRenderRouter = element.on && !isUndefined(element.on.renderRouter) || !isUndefined(element.onRenderRouter);
21
20
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
@@ -27,7 +26,7 @@ const initRouter = (element, context) => {
27
26
  };
28
27
  }
29
28
  }
30
- injectRouterInLinkComponent(routerOptions);
29
+ injectRouterInLinkComponent(context, routerOptions);
31
30
  return routerOptions;
32
31
  };
33
32
  let popStateFired;
@@ -43,7 +42,8 @@ const popStateRouter = (element, context) => {
43
42
  router(url, element, {}, { pushState: false, scrollToTop: false, level: 0 });
44
43
  };
45
44
  };
46
- const injectRouterInLinkComponent = (routerOptions) => {
45
+ const injectRouterInLinkComponent = (context, routerOptions) => {
46
+ const { Link, RouterLink } = context.components;
47
47
  if (routerOptions && routerOptions.injectRouterInLinkComponent) {
48
48
  return deepMerge(Link, RouterLink);
49
49
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "3.0.100",
3
+ "version": "3.1.2",
4
4
  "license": "MIT",
5
- "gitHead": "1302a0674cc4d420f304737973a7f7bece86f359",
5
+ "gitHead": "429b36616aa04c8587a26ce3c129815115e35897",
6
6
  "type": "module",
7
7
  "module": "src/index.js",
8
8
  "main": "src/index.js",
@@ -29,19 +29,19 @@
29
29
  "prepublish": "npm run build; npm run copy:package:cjs"
30
30
  },
31
31
  "dependencies": {
32
- "@domql/emotion": "^3.0.0",
33
- "@domql/event": "^3.0.0",
34
- "@domql/report": "^3.0.0",
35
- "@domql/router": "^3.0.0",
36
- "@symbo.ls/fetch": "^3.0.2",
37
- "@symbo.ls/init": "^3.0.2",
38
- "@symbo.ls/scratch": "^3.0.2",
39
- "@symbo.ls/sync": "^3.0.100",
40
- "@symbo.ls/uikit": "^3.0.100",
41
- "@symbo.ls/utils": "^3.0.2",
42
- "domql": "^3.0.0"
32
+ "@domql/emotion": "^3.1.2",
33
+ "@domql/event": "^3.1.2",
34
+ "@domql/report": "^3.1.2",
35
+ "@domql/router": "^3.1.2",
36
+ "@symbo.ls/fetch": "^3.1.2",
37
+ "@symbo.ls/init": "^3.1.2",
38
+ "@symbo.ls/scratch": "^3.1.2",
39
+ "@symbo.ls/sync": "^3.1.2",
40
+ "@symbo.ls/uikit": "^3.1.2",
41
+ "@symbo.ls/utils": "^3.1.2",
42
+ "domql": "^3.1.2"
43
43
  },
44
44
  "devDependencies": {
45
- "@babel/core": "^7.12.0"
45
+ "@babel/core": "^7.26.0"
46
46
  }
47
47
  }
@@ -18,8 +18,8 @@ export const fetchAsync = (app, key, options, callback) => {
18
18
  try {
19
19
  if (options.editor.async) {
20
20
  fetchProjectAsync(key, options, callback || ((data) => {
21
- if (isObject(data.designsystem)) {
22
- options.utils.init(data.designsystem)
21
+ if (isObject(data.designSystem)) {
22
+ options.utils.init(data.designSystem)
23
23
  }
24
24
  if (isObject(data.state)) {
25
25
  app.state.set(data.state)
package/src/index.js CHANGED
@@ -11,27 +11,48 @@ import DEFAULT_CREATE_OPTIONS from './options'
11
11
  import DYNAMIC_JSON from '@symbo.ls/init/dynamic.json'
12
12
  import { createDomqlElement } from './createDomql'
13
13
 
14
- const mergeWithLocalFile = (options, optionsExternalFile) => deepMerge(
15
- options,
16
- isObject(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
17
- )
14
+ const mergeWithLocalFile = (options, optionsExternalFile) =>
15
+ deepMerge(
16
+ options,
17
+ isObject(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
18
+ )
18
19
 
19
- export const create = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
20
- const redefinedOptions = { ...DEFAULT_CREATE_OPTIONS, ...mergeWithLocalFile(options, optionsExternalFile) }
20
+ export const create = (
21
+ App,
22
+ options = DEFAULT_CREATE_OPTIONS,
23
+ optionsExternalFile
24
+ ) => {
25
+ const redefinedOptions = {
26
+ ...DEFAULT_CREATE_OPTIONS,
27
+ ...mergeWithLocalFile(options, optionsExternalFile)
28
+ }
21
29
 
22
30
  const domqlApp = createDomqlElement(App, redefinedOptions)
23
31
 
24
32
  popStateRouter(domqlApp, redefinedOptions)
25
33
 
26
- if (redefinedOptions.on && redefinedOptions.on.create) redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions)
34
+ if (redefinedOptions.on && redefinedOptions.on.create)
35
+ redefinedOptions.on.create(
36
+ domqlApp,
37
+ domqlApp.state,
38
+ domqlApp.context,
39
+ redefinedOptions
40
+ )
27
41
 
28
42
  return domqlApp
29
43
  }
30
44
 
31
- export const createAsync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
45
+ export const createAsync = (
46
+ App,
47
+ options = DEFAULT_CREATE_OPTIONS,
48
+ optionsExternalFile
49
+ ) => {
32
50
  const domqlApp = create(App, options, optionsExternalFile)
33
51
 
34
- const redefinedOptions = { ...DEFAULT_CREATE_OPTIONS, ...mergeWithLocalFile(options, optionsExternalFile) }
52
+ const redefinedOptions = {
53
+ ...DEFAULT_CREATE_OPTIONS,
54
+ ...mergeWithLocalFile(options, optionsExternalFile)
55
+ }
35
56
  // const SYMBOLS_KEY = process.env.SYMBOLS_KEY
36
57
  const key = redefinedOptions.key
37
58
  fetchAsync(domqlApp, key, { utils, ...redefinedOptions })
@@ -39,20 +60,37 @@ export const createAsync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExtern
39
60
  return domqlApp
40
61
  }
41
62
 
42
- export const createSync = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
43
- const redefinedOptions = { ...DEFAULT_CREATE_OPTIONS, ...mergeWithLocalFile(options, optionsExternalFile) }
63
+ export const createSync = async (
64
+ App,
65
+ options = DEFAULT_CREATE_OPTIONS,
66
+ optionsExternalFile
67
+ ) => {
68
+ const redefinedOptions = {
69
+ ...DEFAULT_CREATE_OPTIONS,
70
+ ...mergeWithLocalFile(options, optionsExternalFile)
71
+ }
44
72
 
45
73
  // const SYMBOLS_KEY = process.env.SYMBOLS_KEY
46
74
  const key = options.key
47
75
  await fetchSync(key, redefinedOptions)
48
76
 
49
77
  const domqlApp = await createDomqlElement(App, redefinedOptions)
50
- if (redefinedOptions.on && redefinedOptions.on.create) await (redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions))
78
+ if (redefinedOptions.on && redefinedOptions.on.create)
79
+ await redefinedOptions.on.create(
80
+ domqlApp,
81
+ domqlApp.state,
82
+ domqlApp.context,
83
+ redefinedOptions
84
+ )
51
85
 
52
86
  return domqlApp
53
87
  }
54
88
 
55
- export const createSkeleton = (App = {}, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
89
+ export const createSkeleton = (
90
+ App = {},
91
+ options = DEFAULT_CREATE_OPTIONS,
92
+ optionsExternalFile
93
+ ) => {
56
94
  return create(
57
95
  {
58
96
  deps: { isUndefined },
package/src/router.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { router as defaultRouter } from '@domql/router'
4
4
  import { window, deepMerge, merge, isUndefined } from '@domql/utils'
5
- import { Link, RouterLink } from '@symbo.ls/uikit'
6
5
 
7
6
  const DEFAULT_ROUTING_OPTIONS = {
8
7
  initRouter: true,
@@ -16,17 +15,18 @@ export const initRouter = (element, context) => {
16
15
  else merge(context.router || {}, DEFAULT_ROUTING_OPTIONS)
17
16
 
18
17
  const routerOptions = context.router
19
- const router = (context.utils && context.utils.router) ? context.utils.router : defaultRouter
18
+ const router =
19
+ context.utils && context.utils.router ? context.utils.router : defaultRouter
20
20
 
21
- const onRouterRenderDefault = (el, s) => {
21
+ const onRouterRenderDefault = async (el, s) => {
22
22
  const { pathname, search, hash } = window.location
23
23
  const url = pathname + search + hash
24
- if (el.routes) router(url, el, {}, { initialRender: true })
24
+ if (el.routes) await router(url, el, {}, { initialRender: true })
25
25
  }
26
26
 
27
- // console.log(element)
28
- // debugger
29
- const hasRenderRouter = (element.on && !isUndefined(element.on.renderRouter)) || !isUndefined(element.onRenderRouter) // || element.on.renderRouter
27
+ const hasRenderRouter =
28
+ (element.on && !isUndefined(element.on.renderRouter)) ||
29
+ !isUndefined(element.onRenderRouter) // || element.on.renderRouter
30
30
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
31
31
  if (element.on) {
32
32
  element.on.renderRouter = onRouterRenderDefault
@@ -37,7 +37,7 @@ export const initRouter = (element, context) => {
37
37
  }
38
38
  }
39
39
 
40
- injectRouterInLinkComponent(routerOptions)
40
+ injectRouterInLinkComponent(context, routerOptions)
41
41
 
42
42
  return routerOptions
43
43
  }
@@ -48,9 +48,8 @@ export const popStateRouter = (element, context) => {
48
48
  popStateFired = true
49
49
  const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS
50
50
  if (!routerOptions.popState) return
51
- const router = (context.utils && context.utils.router)
52
- ? context.utils.router
53
- : defaultRouter
51
+ const router =
52
+ context.utils && context.utils.router ? context.utils.router : defaultRouter
54
53
  window.onpopstate = e => {
55
54
  const { pathname, search, hash } = window.location
56
55
  const url = pathname + search + hash
@@ -58,7 +57,8 @@ export const popStateRouter = (element, context) => {
58
57
  }
59
58
  }
60
59
 
61
- export const injectRouterInLinkComponent = (routerOptions) => {
60
+ export const injectRouterInLinkComponent = (context, routerOptions) => {
61
+ const { Link, RouterLink } = context.components
62
62
  if (routerOptions && routerOptions.injectRouterInLinkComponent) {
63
63
  return deepMerge(Link, RouterLink)
64
64
  }