@symbo.ls/create 2.27.0 → 2.27.11

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.
@@ -60,8 +60,7 @@ const prepareContext = (app, context = {}) => {
60
60
  return context;
61
61
  };
62
62
  const createDomqlElement = async (app, ctx) => {
63
- if (!(0, import_utils.isObject)(ctx))
64
- ctx = {};
63
+ if (!(0, import_utils.isObject)(ctx)) ctx = {};
65
64
  if ((0, import_utils.isNode)(app)) {
66
65
  app = {};
67
66
  ctx.parent = app;
@@ -26,16 +26,14 @@ const defaultDefine = {
26
26
  routes: (param) => param,
27
27
  // deps: (param, el) => param || el.parent.deps,
28
28
  $router: (param, el) => {
29
- if (!param)
30
- return;
29
+ if (!param) return;
31
30
  const obj = { tag: "fragment", ...param };
32
31
  const set = () => {
33
32
  el.set(obj, { preventDefineUpdate: "$router" });
34
33
  };
35
34
  if (el.props && el.props.lazyLoad) {
36
35
  window.requestAnimationFrame(set);
37
- } else
38
- set();
36
+ } else set();
39
37
  return obj;
40
38
  },
41
39
  $collection: import_atoms.Collection.define.$collection,
@@ -27,8 +27,7 @@ var import_fetch = require("@symbo.ls/fetch");
27
27
  const fetchSync = async (key, options) => {
28
28
  if (key && options.editor) {
29
29
  try {
30
- if (!options.editor.async)
31
- await (0, import_fetch.fetchProject)(key, options);
30
+ if (!options.editor.async) await (0, import_fetch.fetchProject)(key, options);
32
31
  } catch (e) {
33
32
  console.error(e);
34
33
  }
package/dist/cjs/index.js CHANGED
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var src_exports = {};
30
- __export(src_exports, {
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
31
  create: () => create,
32
32
  createAsync: () => createAsync,
33
33
  createSkeleton: () => createSkeleton,
34
34
  createSync: () => createSync,
35
- default: () => src_default
35
+ default: () => index_default
36
36
  });
37
- module.exports = __toCommonJS(src_exports);
37
+ module.exports = __toCommonJS(index_exports);
38
38
  var import_utils = require("@domql/utils");
39
39
  var utils = __toESM(require("./utilImports"), 1);
40
40
  var import_router = require("./router");
@@ -50,8 +50,7 @@ const create = (App, options = import_options.default, optionsExternalFile) => {
50
50
  const redefinedOptions = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
51
51
  const domqlApp = (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
52
52
  (0, import_router.popStateRouter)(domqlApp, redefinedOptions);
53
- if (redefinedOptions.on && redefinedOptions.on.create)
54
- redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
53
+ if (redefinedOptions.on && redefinedOptions.on.create) redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
55
54
  return domqlApp;
56
55
  };
57
56
  const createAsync = (App, options = import_options.default, optionsExternalFile) => {
@@ -66,8 +65,7 @@ const createSync = async (App, options = import_options.default, optionsExternal
66
65
  const key = options.key;
67
66
  await (0, import_ferchOnCreate.fetchSync)(key, redefinedOptions);
68
67
  const domqlApp = await (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
69
- if (redefinedOptions.on && redefinedOptions.on.create)
70
- await redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
68
+ if (redefinedOptions.on && redefinedOptions.on.create) await redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
71
69
  return domqlApp;
72
70
  };
73
71
  const createSkeleton = (App = {}, options = import_options.default, optionsExternalFile) => {
@@ -80,4 +78,4 @@ const createSkeleton = (App = {}, options = import_options.default, optionsExter
80
78
  optionsExternalFile
81
79
  );
82
80
  };
83
- var src_default = create;
81
+ var index_default = create;
@@ -32,8 +32,7 @@ const initEmotion = (key, options = {}) => {
32
32
  const doc = options.parent || options.document || document;
33
33
  const initOptions = options.initOptions || {};
34
34
  const emotion = initOptions.emotion;
35
- if (!initOptions.emotion)
36
- initOptions.emotion = import_emotion2.emotion;
35
+ if (!initOptions.emotion) initOptions.emotion = import_emotion2.emotion;
37
36
  const registry = options.registry || (0, import_emotion.transformDOMQLEmotion)(initOptions.emotion, options);
38
37
  const designSystem = initOptions.useDefaultConfig || ((_a = options.designSystem) == null ? void 0 : _a.useDefaultConfig) ? (0, import_utils.deepMerge)(options.designSystem, (0, import_utils.deepClone)(import_default_config.DEFAULT_CONFIG)) : options.designSystem || (0, import_utils.deepClone)(import_default_config.DEFAULT_CONFIG);
39
38
  const scratchSystem = (0, import_init.init)(designSystem, {
@@ -47,11 +47,9 @@ var utils = __toESM(require("./utilImports"), 1);
47
47
  var routerUtils = __toESM(require("@domql/router"), 1);
48
48
  const ENV = "development";
49
49
  const prepareWindow = (context) => {
50
- if (typeof window === "undefined")
51
- window = globalThis || {};
50
+ if (typeof window === "undefined") window = globalThis || {};
52
51
  if (typeof document === "undefined") {
53
- if (!window.document)
54
- window.document = globalThis.document || { body: {} };
52
+ if (!window.document) window.document = globalThis.document || { body: {} };
55
53
  document = window.document;
56
54
  }
57
55
  context.document = context.document || document;
@@ -77,7 +75,14 @@ const prepareComponents = (context) => {
77
75
  return context.components ? { ...UIkitWithPrefix(), ...context.components } : UIkitWithPrefix();
78
76
  };
79
77
  const prepareUtils = (context) => {
80
- return { ...utils, ...routerUtils, ...utils.scratchUtils, ...context.utils, ...context.snippets, ...context.functions };
78
+ return {
79
+ ...utils,
80
+ ...routerUtils,
81
+ ...utils.scratchUtils,
82
+ ...context.utils,
83
+ ...context.snippets,
84
+ ...context.functions
85
+ };
81
86
  };
82
87
  const prepareMethods = (context) => {
83
88
  return {
@@ -103,16 +108,14 @@ const prepareDependencies = ({
103
108
  if (version === "loading" || version === "error") {
104
109
  continue;
105
110
  }
106
- const random = ENV === "development" ? `?${Math.random()}` : "";
111
+ const random = utils.isDevelopment(ENV) ? `?${Math.random()}` : "";
107
112
  let url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
108
113
  if (dependency.split("/").length > 2 || !onlyDotsAndNumbers(version)) {
109
114
  url = `https://pkg.symbo.ls/${dependency}${random}`;
110
115
  }
111
- if (dependenciesOnDemand && dependenciesOnDemand[dependency])
112
- continue;
116
+ if (dependenciesOnDemand && dependenciesOnDemand[dependency]) continue;
113
117
  try {
114
- if (cachedDeps[dependency])
115
- return;
118
+ if (cachedDeps[dependency]) return;
116
119
  cachedDeps[dependency] = true;
117
120
  utils.loadJavascriptFileEmbedSync(url, document2);
118
121
  } catch (e) {
@@ -126,8 +129,7 @@ const prepareRequire = (packages, ctx) => {
126
129
  const initRequire = (ctx2) => (key) => {
127
130
  const windowOpts2 = ctx2.window || window;
128
131
  const pkg = windowOpts2.packages[key];
129
- if (typeof pkg === "function")
130
- return pkg();
132
+ if (typeof pkg === "function") return pkg();
131
133
  return pkg;
132
134
  };
133
135
  const initRequireOnDemand = (ctx2) => (key) => {
@@ -135,7 +137,7 @@ const prepareRequire = (packages, ctx) => {
135
137
  const documentOpts = ctx2.document || document;
136
138
  const windowOpts2 = ctx2.window || window;
137
139
  if (!windowOpts2.packages[key]) {
138
- const random = ENV === "development" ? `?${Math.random()}` : "";
140
+ const random = utils.isDevelopment(ENV) ? `?${Math.random()}` : "";
139
141
  if (dependenciesOnDemand && dependenciesOnDemand[key]) {
140
142
  const version = dependenciesOnDemand[key];
141
143
  const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
@@ -169,10 +171,8 @@ const prepareDesignSystem = (key, context) => {
169
171
  };
170
172
  const prepareState = (app, context) => {
171
173
  const state = {};
172
- if (context.state)
173
- utils.deepMerge(state, context.state);
174
- if (app && app.state)
175
- (0, import_utils.deepMerge)(state, app.state);
174
+ if (context.state) utils.deepMerge(state, context.state);
175
+ if (app && app.state) (0, import_utils.deepMerge)(state, app.state);
176
176
  return (0, import_utils.deepClone)(state);
177
177
  };
178
178
  const preparePages = (app, context) => {
@@ -32,19 +32,15 @@ const DEFAULT_ROUTING_OPTIONS = {
32
32
  popState: true
33
33
  };
34
34
  const initRouter = (element, context) => {
35
- if (context.router === false)
36
- return;
37
- else if (context.router === true)
38
- context.router = DEFAULT_ROUTING_OPTIONS;
39
- else
40
- (0, import_utils.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS);
35
+ if (context.router === false) return;
36
+ else if (context.router === true) context.router = DEFAULT_ROUTING_OPTIONS;
37
+ else (0, import_utils.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS);
41
38
  const routerOptions = context.router;
42
39
  const router = context.utils && context.utils.router ? context.utils.router : import_router.router;
43
40
  const onRouterRenderDefault = (el, s) => {
44
41
  const { pathname, search, hash } = import_utils.window.location;
45
42
  const url = pathname + search + hash;
46
- if (el.routes)
47
- router(url, el, {}, { initialRender: true });
43
+ if (el.routes) router(url, el, {}, { initialRender: true });
48
44
  };
49
45
  const hasRenderRouter = element.on && !(0, import_utils.isUndefined)(element.on.renderRouter);
50
46
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
@@ -61,12 +57,10 @@ const initRouter = (element, context) => {
61
57
  };
62
58
  let popStateFired;
63
59
  const popStateRouter = (element, context) => {
64
- if (popStateFired)
65
- return;
60
+ if (popStateFired) return;
66
61
  popStateFired = true;
67
62
  const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS;
68
- if (!routerOptions.popState)
69
- return;
63
+ if (!routerOptions.popState) return;
70
64
  const router = context.utils && context.utils.router ? context.utils.router : import_router.router;
71
65
  import_utils.window.onpopstate = (e) => {
72
66
  const { pathname, search, hash } = import_utils.window.location;
@@ -31,12 +31,10 @@ const initializeExtend = (app, ctx) => {
31
31
  };
32
32
  const initializeSync = (app, ctx) => {
33
33
  const { editor } = ctx;
34
- if (!editor)
35
- return;
34
+ if (!editor) return;
36
35
  const liveSync = (0, import_utils.isUndefined)(editor.liveSync) ? (0, import_utils.isDevelopment)() : editor.liveSync;
37
36
  if (liveSync) {
38
- if ((0, import_utils.isArray)(app.extend))
39
- app.extend.push(import_sync.SyncComponent);
37
+ if ((0, import_utils.isArray)(app.extend)) app.extend.push(import_sync.SyncComponent);
40
38
  else if (app.extend) {
41
39
  app.extend = [app.extend, import_sync.SyncComponent];
42
40
  } else {
@@ -46,12 +44,10 @@ const initializeSync = (app, ctx) => {
46
44
  };
47
45
  const initializeInspect = (app, ctx) => {
48
46
  const { editor } = ctx;
49
- if (!editor)
50
- return;
47
+ if (!editor) return;
51
48
  const inspect = (0, import_utils.isUndefined)(editor.inspect) ? (0, import_utils.isDevelopment)() : editor.inspect;
52
49
  if (inspect) {
53
- if ((0, import_utils.isArray)(app.extend))
54
- app.extend.push(import_sync.Inspect);
50
+ if ((0, import_utils.isArray)(app.extend)) app.extend.push(import_sync.Inspect);
55
51
  else if (app.extend) {
56
52
  app.extend = [app.extend, import_sync.Inspect];
57
53
  } else {
@@ -61,12 +57,10 @@ const initializeInspect = (app, ctx) => {
61
57
  };
62
58
  const initializeNotifications = (app, ctx) => {
63
59
  const { editor } = ctx;
64
- if (!editor)
65
- return;
60
+ if (!editor) return;
66
61
  const verbose = (0, import_utils.isUndefined)(editor.verbose) ? (0, import_utils.isDevelopment)() || ctx.verbose : editor.verbose;
67
62
  if (verbose) {
68
- if ((0, import_utils.isArray)(app.extend))
69
- app.extend.push(import_sync.Notifications);
63
+ if ((0, import_utils.isArray)(app.extend)) app.extend.push(import_sync.Notifications);
70
64
  else if (app.extend) {
71
65
  app.extend = [app.extend, import_sync.Notifications];
72
66
  } else {
@@ -52,8 +52,7 @@ const prepareContext = (app, context = {}) => {
52
52
  return context;
53
53
  };
54
54
  const createDomqlElement = async (app, ctx) => {
55
- if (!isObject(ctx))
56
- ctx = {};
55
+ if (!isObject(ctx)) ctx = {};
57
56
  if (isNode(app)) {
58
57
  app = {};
59
58
  ctx.parent = app;
@@ -19,16 +19,14 @@ const defaultDefine = {
19
19
  routes: (param) => param,
20
20
  // deps: (param, el) => param || el.parent.deps,
21
21
  $router: (param, el) => {
22
- if (!param)
23
- return;
22
+ if (!param) return;
24
23
  const obj = __spreadValues({ tag: "fragment" }, param);
25
24
  const set = () => {
26
25
  el.set(obj, { preventDefineUpdate: "$router" });
27
26
  };
28
27
  if (el.props && el.props.lazyLoad) {
29
28
  window.requestAnimationFrame(set);
30
- } else
31
- set();
29
+ } else set();
32
30
  return obj;
33
31
  },
34
32
  $collection: Collection.define.$collection,
@@ -3,8 +3,7 @@ import { fetchProject, fetchProjectAsync } from "@symbo.ls/fetch";
3
3
  const fetchSync = async (key, options) => {
4
4
  if (key && options.editor) {
5
5
  try {
6
- if (!options.editor.async)
7
- await fetchProject(key, options);
6
+ if (!options.editor.async) await fetchProject(key, options);
8
7
  } catch (e) {
9
8
  console.error(e);
10
9
  }
package/dist/esm/index.js CHANGED
@@ -29,8 +29,7 @@ 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)
33
- redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
32
+ if (redefinedOptions.on && redefinedOptions.on.create) redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
34
33
  return domqlApp;
35
34
  };
36
35
  const createAsync = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
@@ -45,8 +44,7 @@ const createSync = async (App, options = DEFAULT_CREATE_OPTIONS, optionsExternal
45
44
  const key = options.key;
46
45
  await fetchSync(key, redefinedOptions);
47
46
  const domqlApp = await createDomqlElement(App, redefinedOptions);
48
- if (redefinedOptions.on && redefinedOptions.on.create)
49
- await redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
47
+ if (redefinedOptions.on && redefinedOptions.on.create) await redefinedOptions.on.create(domqlApp, domqlApp.state, domqlApp.context, redefinedOptions);
50
48
  return domqlApp;
51
49
  };
52
50
  const createSkeleton = (App = {}, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
@@ -58,11 +56,11 @@ const createSkeleton = (App = {}, options = DEFAULT_CREATE_OPTIONS, optionsExter
58
56
  optionsExternalFile
59
57
  );
60
58
  };
61
- var src_default = create;
59
+ var index_default = create;
62
60
  export {
63
61
  create,
64
62
  createAsync,
65
63
  createSkeleton,
66
64
  createSync,
67
- src_default as default
65
+ index_default as default
68
66
  };
@@ -25,8 +25,7 @@ const initEmotion = (key, options = {}) => {
25
25
  const doc = options.parent || options.document || document;
26
26
  const initOptions = options.initOptions || {};
27
27
  const emotion = initOptions.emotion;
28
- if (!initOptions.emotion)
29
- initOptions.emotion = defaultEmotion;
28
+ if (!initOptions.emotion) initOptions.emotion = defaultEmotion;
30
29
  const registry = options.registry || transformDOMQLEmotion(initOptions.emotion, options);
31
30
  const designSystem = initOptions.useDefaultConfig || ((_a = options.designSystem) == null ? void 0 : _a.useDefaultConfig) ? deepMerge(options.designSystem, deepClone(DEFAULT_CONFIG)) : options.designSystem || deepClone(DEFAULT_CONFIG);
32
31
  const scratchSystem = init(designSystem, __spreadValues(__spreadValues({
@@ -30,11 +30,9 @@ import * as utils from "./utilImports";
30
30
  import * as routerUtils from "@domql/router";
31
31
  const ENV = "development";
32
32
  const prepareWindow = (context) => {
33
- if (typeof window === "undefined")
34
- window = globalThis || {};
33
+ if (typeof window === "undefined") window = globalThis || {};
35
34
  if (typeof document === "undefined") {
36
- if (!window.document)
37
- window.document = globalThis.document || { body: {} };
35
+ if (!window.document) window.document = globalThis.document || { body: {} };
38
36
  document = window.document;
39
37
  }
40
38
  context.document = context.document || document;
@@ -85,16 +83,14 @@ const prepareDependencies = ({
85
83
  if (version === "loading" || version === "error") {
86
84
  continue;
87
85
  }
88
- const random = ENV === "development" ? `?${Math.random()}` : "";
86
+ const random = utils.isDevelopment(ENV) ? `?${Math.random()}` : "";
89
87
  let url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`;
90
88
  if (dependency.split("/").length > 2 || !onlyDotsAndNumbers(version)) {
91
89
  url = `https://pkg.symbo.ls/${dependency}${random}`;
92
90
  }
93
- if (dependenciesOnDemand && dependenciesOnDemand[dependency])
94
- continue;
91
+ if (dependenciesOnDemand && dependenciesOnDemand[dependency]) continue;
95
92
  try {
96
- if (cachedDeps[dependency])
97
- return;
93
+ if (cachedDeps[dependency]) return;
98
94
  cachedDeps[dependency] = true;
99
95
  utils.loadJavascriptFileEmbedSync(url, document2);
100
96
  } catch (e) {
@@ -108,8 +104,7 @@ const prepareRequire = (packages, ctx) => {
108
104
  const initRequire = (ctx2) => (key) => {
109
105
  const windowOpts2 = ctx2.window || window;
110
106
  const pkg = windowOpts2.packages[key];
111
- if (typeof pkg === "function")
112
- return pkg();
107
+ if (typeof pkg === "function") return pkg();
113
108
  return pkg;
114
109
  };
115
110
  const initRequireOnDemand = (ctx2) => (key) => {
@@ -117,7 +112,7 @@ const prepareRequire = (packages, ctx) => {
117
112
  const documentOpts = ctx2.document || document;
118
113
  const windowOpts2 = ctx2.window || window;
119
114
  if (!windowOpts2.packages[key]) {
120
- const random = ENV === "development" ? `?${Math.random()}` : "";
115
+ const random = utils.isDevelopment(ENV) ? `?${Math.random()}` : "";
121
116
  if (dependenciesOnDemand && dependenciesOnDemand[key]) {
122
117
  const version = dependenciesOnDemand[key];
123
118
  const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`;
@@ -151,10 +146,8 @@ const prepareDesignSystem = (key, context) => {
151
146
  };
152
147
  const prepareState = (app, context) => {
153
148
  const state = {};
154
- if (context.state)
155
- utils.deepMerge(state, context.state);
156
- if (app && app.state)
157
- deepMerge(state, app.state);
149
+ if (context.state) utils.deepMerge(state, context.state);
150
+ if (app && app.state) deepMerge(state, app.state);
158
151
  return deepClone(state);
159
152
  };
160
153
  const preparePages = (app, context) => {
@@ -7,19 +7,15 @@ const DEFAULT_ROUTING_OPTIONS = {
7
7
  popState: true
8
8
  };
9
9
  const initRouter = (element, context) => {
10
- if (context.router === false)
11
- return;
12
- else if (context.router === true)
13
- context.router = DEFAULT_ROUTING_OPTIONS;
14
- else
15
- merge(context.router || {}, DEFAULT_ROUTING_OPTIONS);
10
+ if (context.router === false) return;
11
+ else if (context.router === true) context.router = DEFAULT_ROUTING_OPTIONS;
12
+ else merge(context.router || {}, DEFAULT_ROUTING_OPTIONS);
16
13
  const routerOptions = context.router;
17
14
  const router = context.utils && context.utils.router ? context.utils.router : defaultRouter;
18
15
  const onRouterRenderDefault = (el, s) => {
19
16
  const { pathname, search, hash } = window.location;
20
17
  const url = pathname + search + hash;
21
- if (el.routes)
22
- router(url, el, {}, { initialRender: true });
18
+ if (el.routes) router(url, el, {}, { initialRender: true });
23
19
  };
24
20
  const hasRenderRouter = element.on && !isUndefined(element.on.renderRouter);
25
21
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
@@ -36,12 +32,10 @@ const initRouter = (element, context) => {
36
32
  };
37
33
  let popStateFired;
38
34
  const popStateRouter = (element, context) => {
39
- if (popStateFired)
40
- return;
35
+ if (popStateFired) return;
41
36
  popStateFired = true;
42
37
  const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS;
43
- if (!routerOptions.popState)
44
- return;
38
+ if (!routerOptions.popState) return;
45
39
  const router = context.utils && context.utils.router ? context.utils.router : defaultRouter;
46
40
  window.onpopstate = (e) => {
47
41
  const { pathname, search, hash } = window.location;
@@ -5,12 +5,10 @@ const initializeExtend = (app, ctx) => {
5
5
  };
6
6
  const initializeSync = (app, ctx) => {
7
7
  const { editor } = ctx;
8
- if (!editor)
9
- return;
8
+ if (!editor) return;
10
9
  const liveSync = isUndefined(editor.liveSync) ? isDevelopment() : editor.liveSync;
11
10
  if (liveSync) {
12
- if (isArray(app.extend))
13
- app.extend.push(SyncComponent);
11
+ if (isArray(app.extend)) app.extend.push(SyncComponent);
14
12
  else if (app.extend) {
15
13
  app.extend = [app.extend, SyncComponent];
16
14
  } else {
@@ -20,12 +18,10 @@ const initializeSync = (app, ctx) => {
20
18
  };
21
19
  const initializeInspect = (app, ctx) => {
22
20
  const { editor } = ctx;
23
- if (!editor)
24
- return;
21
+ if (!editor) return;
25
22
  const inspect = isUndefined(editor.inspect) ? isDevelopment() : editor.inspect;
26
23
  if (inspect) {
27
- if (isArray(app.extend))
28
- app.extend.push(Inspect);
24
+ if (isArray(app.extend)) app.extend.push(Inspect);
29
25
  else if (app.extend) {
30
26
  app.extend = [app.extend, Inspect];
31
27
  } else {
@@ -35,12 +31,10 @@ const initializeInspect = (app, ctx) => {
35
31
  };
36
32
  const initializeNotifications = (app, ctx) => {
37
33
  const { editor } = ctx;
38
- if (!editor)
39
- return;
34
+ if (!editor) return;
40
35
  const verbose = isUndefined(editor.verbose) ? isDevelopment() || ctx.verbose : editor.verbose;
41
36
  if (verbose) {
42
- if (isArray(app.extend))
43
- app.extend.push(Notifications);
37
+ if (isArray(app.extend)) app.extend.push(Notifications);
44
38
  else if (app.extend) {
45
39
  app.extend = [app.extend, Notifications];
46
40
  } else {
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.27.0",
3
+ "version": "2.27.11",
4
4
  "license": "MIT",
5
- "gitHead": "40a924693178a7d7b9e94aac0282b9d31602eca7",
5
+ "gitHead": "0189e4620f901c763754d06de65bcf6075c05618",
6
6
  "type": "module",
7
7
  "module": "src/index.js",
8
8
  "main": "src/index.js",
@@ -10,9 +10,9 @@
10
10
  "jsdelivr": "dist/iife/index.js",
11
11
  "exports": {
12
12
  ".": {
13
- "default": "./dist/esm/index.js",
14
13
  "import": "./dist/esm/index.js",
15
- "require": "./dist/cjs/index.js"
14
+ "require": "./dist/cjs/index.js",
15
+ "default": "./dist/esm/index.js"
16
16
  }
17
17
  },
18
18
  "source": "src/index.js",
@@ -22,24 +22,24 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
25
- "build:esm": "npx esbuild src/*.js --target=es2017 --format=esm --outdir=dist/esm",
26
- "build:cjs": "npx esbuild src/*.js --target=node16 --format=cjs --outdir=dist/cjs",
27
- "build:iife": "npx esbuild src/*.js --target=node16 --format=iife --outdir=dist/iife",
25
+ "build:esm": "cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=es2017 --format=esm --outdir=dist/esm",
26
+ "build:cjs": "cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=node16 --format=cjs --outdir=dist/cjs",
27
+ "build:iife": "cross-env NODE_ENV=$NODE_ENV npx esbuild src/*.js --target=node16 --format=iife --outdir=dist/iife",
28
28
  "build": "rimraf -I dist; npm run build:cjs; npm run build:esm",
29
29
  "prepublish": "npm run build; npm run copy:package:cjs"
30
30
  },
31
31
  "dependencies": {
32
- "@domql/emotion": "^2.27.0",
33
- "@domql/event": "^2.27.0",
34
- "@domql/report": "^2.27.0",
35
- "@domql/router": "^2.27.0",
36
- "@symbo.ls/fetch": "^2.27.0",
37
- "@symbo.ls/init": "^2.27.0",
38
- "@symbo.ls/scratch": "^2.27.0",
39
- "@symbo.ls/sync": "^2.27.0",
40
- "@symbo.ls/uikit": "^2.27.0",
41
- "@symbo.ls/utils": "^2.27.0",
42
- "domql": "^2.27.0"
32
+ "@domql/emotion": "^2.27.11",
33
+ "@domql/event": "^2.27.11",
34
+ "@domql/report": "^2.27.11",
35
+ "@domql/router": "^2.27.11",
36
+ "@symbo.ls/fetch": "^2.27.11",
37
+ "@symbo.ls/init": "^2.27.11",
38
+ "@symbo.ls/scratch": "^2.27.11",
39
+ "@symbo.ls/sync": "^2.27.11",
40
+ "@symbo.ls/uikit": "^2.27.11",
41
+ "@symbo.ls/utils": "^2.27.11",
42
+ "domql": "^2.27.11"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@babel/core": "^7.26.0"
package/src/prepare.js CHANGED
@@ -15,9 +15,9 @@ import * as routerUtils from '@domql/router'
15
15
 
16
16
  const ENV = process.env.NODE_ENV
17
17
 
18
- export const prepareWindow = (context) => {
19
- if (typeof (window) === 'undefined') window = globalThis || {} // eslint-disable-line
20
- if (typeof (document) === 'undefined') {
18
+ export const prepareWindow = context => {
19
+ if (typeof window === 'undefined') window = globalThis || {} // eslint-disable-line
20
+ if (typeof document === 'undefined') {
21
21
  if (!window.document) window.document = globalThis.document || { body: {} }
22
22
  document = window.document // eslint-disable-line
23
23
  }
@@ -44,20 +44,34 @@ export const UIkitWithPrefix = () => {
44
44
  }
45
45
 
46
46
  export const prepareComponents = context => {
47
- return context.components ? { ...UIkitWithPrefix(), ...context.components } : UIkitWithPrefix()
47
+ return context.components
48
+ ? { ...UIkitWithPrefix(), ...context.components }
49
+ : UIkitWithPrefix()
48
50
  }
49
51
 
50
52
  export const prepareUtils = context => {
51
- return { ...utils, ...routerUtils, ...utils.scratchUtils, ...context.utils, ...context.snippets, ...context.functions }
53
+ return {
54
+ ...utils,
55
+ ...routerUtils,
56
+ ...utils.scratchUtils,
57
+ ...context.utils,
58
+ ...context.snippets,
59
+ ...context.functions
60
+ }
52
61
  }
53
62
 
54
- export const prepareMethods = (context) => {
63
+ export const prepareMethods = context => {
55
64
  return {
56
65
  ...(context.methods || {}),
57
66
  require: context.utils.require,
58
67
  requireOnDemand: context.utils.requireOnDemand,
59
68
  call: function (fnKey, ...args) {
60
- return (context.utils[fnKey] || context.functions[fnKey] || context.methods[fnKey] || context.snippets[fnKey])?.call(this, ...args)
69
+ return (
70
+ context.utils[fnKey] ||
71
+ context.functions[fnKey] ||
72
+ context.methods[fnKey] ||
73
+ context.snippets[fnKey]
74
+ )?.call(this, ...args)
61
75
  }
62
76
  }
63
77
  }
@@ -77,7 +91,7 @@ export const prepareDependencies = ({
77
91
  continue
78
92
  }
79
93
 
80
- const random = ENV === 'development' ? `?${Math.random()}` : ''
94
+ const random = utils.isDevelopment(ENV) ? `?${Math.random()}` : ''
81
95
  let url = `https://pkg.symbo.ls/${dependency}/${version}.js${random}`
82
96
 
83
97
  if (dependency.split('/').length > 2 || !onlyDotsAndNumbers(version)) {
@@ -113,7 +127,7 @@ export const prepareRequire = (packages, ctx) => {
113
127
  const documentOpts = ctx.document || document
114
128
  const windowOpts = ctx.window || window
115
129
  if (!windowOpts.packages[key]) {
116
- const random = ENV === 'development' ? `?${Math.random()}` : ''
130
+ const random = utils.isDevelopment(ENV) ? `?${Math.random()}` : ''
117
131
  if (dependenciesOnDemand && dependenciesOnDemand[key]) {
118
132
  const version = dependenciesOnDemand[key]
119
133
  const url = `https://pkg.symbo.ls/${key}/${version}.js${random}`