smbls 3.4.4 → 3.4.5

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.
@@ -0,0 +1 @@
1
+ {"name":"smbls","version":"3.4.4"}
@@ -38,15 +38,15 @@ var Smbls = (() => {
38
38
  // index.js
39
39
  var index_exports = {};
40
40
  __export(index_exports, {
41
- DEFAULT_CONTEXT: () => DEFAULT_CONTEXT,
42
- DESIGN_SYSTEM_OPTIONS: () => DESIGN_SYSTEM_OPTIONS,
41
+ DEFAULT_CONTEXT: () => DEFAULT_CONTEXT2,
42
+ DESIGN_SYSTEM_OPTIONS: () => DESIGN_SYSTEM_OPTIONS2,
43
43
  DYNAMIC_JSON: () => import_dynamic.default,
44
- ROUTER_OPTIONS: () => ROUTER_OPTIONS,
44
+ ROUTER_OPTIONS: () => ROUTER_OPTIONS2,
45
45
  applyCSS: () => applyCSS,
46
- create: () => create,
47
- createAsync: () => createAsync,
48
- createSkeleton: () => createSkeleton,
49
- createSync: () => createSync,
46
+ create: () => create2,
47
+ createAsync: () => createAsync2,
48
+ createSkeleton: () => createSkeleton2,
49
+ createSync: () => createSync2,
50
50
  init: () => init,
51
51
  reinit: () => reinit,
52
52
  setClass: () => setClass,
@@ -62,7 +62,7 @@ var Smbls = (() => {
62
62
  __reExport(index_exports, __require("@symbo.ls/smbls-utils"));
63
63
 
64
64
  // src/index.js
65
- var import_utils7 = __require("@domql/utils");
65
+ var import_utils14 = __require("@domql/utils");
66
66
 
67
67
  // src/utilImports.js
68
68
  var utilImports_exports = {};
@@ -173,7 +173,148 @@ var Smbls = (() => {
173
173
  __reExport(utilImports_exports, __require("@domql/router"));
174
174
 
175
175
  // src/router.js
176
+ var import_utils9 = __require("@domql/utils");
177
+ var import_router4 = __require("@domql/router");
178
+
179
+ // dist/esm/index.js
180
+ var esm_exports = {};
181
+ __export(esm_exports, {
182
+ DEFAULT_CONTEXT: () => DEFAULT_CONTEXT,
183
+ DESIGN_SYSTEM_OPTIONS: () => DESIGN_SYSTEM_OPTIONS,
184
+ DYNAMIC_JSON: () => import_dynamic2.default,
185
+ ROUTER_OPTIONS: () => ROUTER_OPTIONS,
186
+ applyCSS: () => applyCSS2,
187
+ create: () => create,
188
+ createAsync: () => createAsync,
189
+ createSkeleton: () => createSkeleton,
190
+ createSync: () => createSync,
191
+ init: () => init2,
192
+ reinit: () => reinit2,
193
+ setClass: () => setClass2,
194
+ updateVars: () => updateVars2
195
+ });
196
+ __reExport(esm_exports, __require("@domql/utils"));
197
+ __reExport(esm_exports, __require("attrs-in-props"));
198
+ __reExport(esm_exports, __require("css-in-props"));
199
+ __reExport(esm_exports, __require("@symbo.ls/default-config"));
200
+ __reExport(esm_exports, __require("@symbo.ls/emotion"));
201
+ __reExport(esm_exports, __require("@symbo.ls/scratch"));
202
+ __reExport(esm_exports, __require("@symbo.ls/uikit"));
203
+ __reExport(esm_exports, __require("@symbo.ls/smbls-utils"));
204
+
205
+ // dist/esm/src/index.js
206
+ var import_utils8 = __require("@domql/utils");
207
+
208
+ // dist/esm/src/utilImports.js
209
+ var utilImports_exports2 = {};
210
+ __export(utilImports_exports2, {
211
+ applyCSS: () => applyCSS2,
212
+ init: () => init2,
213
+ reinit: () => reinit2,
214
+ scratchSystem: () => import_scratch4.scratchSystem,
215
+ scratchUtils: () => import_scratch4.scratchUtils,
216
+ set: () => import_scratch4.set
217
+ });
218
+ var import_scratch4 = __require("@symbo.ls/scratch");
219
+ __reExport(utilImports_exports2, __require("@domql/utils"));
220
+ __reExport(utilImports_exports2, __require("@symbo.ls/smbls-utils"));
221
+
222
+ // dist/esm/src/init.js
223
+ var import_scratch3 = __require("@symbo.ls/scratch");
176
224
  var import_utils2 = __require("@domql/utils");
225
+ var import_emotion2 = __require("@symbo.ls/emotion");
226
+ var import_dynamic2 = __toESM(__require("../dynamic.json"));
227
+ var CONFIG2 = (0, import_scratch3.getActiveConfig)();
228
+ var mergeWithLocalFile2 = (config = CONFIG2, options) => {
229
+ const rcfile = (0, import_utils2.isObject)(options.localFile) ? options.localFile : import_dynamic2.default || {};
230
+ const clonedFile = (0, import_utils2.deepClone)(rcfile.designSystem || {});
231
+ return (0, import_utils2.deepMerge)(config, clonedFile);
232
+ };
233
+ var SET_OPTIONS2 = {
234
+ emotion: import_emotion2.emotion,
235
+ useVariable: true,
236
+ useReset: true,
237
+ useFontImport: true,
238
+ useIconSprite: true,
239
+ useDocumentTheme: true,
240
+ useSvgSprite: true
241
+ };
242
+ var init2 = (config, options = SET_OPTIONS2) => {
243
+ const emotion = options.emotion || import_emotion2.emotion;
244
+ const resultConfig = mergeWithLocalFile2(config || {}, options);
245
+ const conf = (0, import_scratch3.set)(
246
+ {
247
+ verbose: options.verbose,
248
+ useReset: options.useReset,
249
+ useFontImport: options.useFontImport,
250
+ useVariable: options.useVariable,
251
+ useSvgSprite: options.useSvgSprite,
252
+ useDocumentTheme: options.useDocumentTheme,
253
+ useIconSprite: options.useIconSprite,
254
+ useDefaultConfig: options.useDefaultConfig,
255
+ globalTheme: options.globalTheme,
256
+ ...resultConfig
257
+ },
258
+ { newConfig: options.newConfig }
259
+ );
260
+ const FontFace = (0, import_scratch3.getFontFaceString)(conf.font || conf.FONT);
261
+ const useReset = conf.useReset;
262
+ const useVariable = conf.useVariable;
263
+ const useFontImport = conf.useFontImport;
264
+ const useSvgSprite = conf.useSvgSprite;
265
+ const hasSvgs = config.svg || config.SVG;
266
+ const useIconSprite = conf.useIconSprite;
267
+ const hasIcons = config.icons || config.ICONS;
268
+ if (useFontImport) emotion.injectGlobal(FontFace);
269
+ if (useVariable) emotion.injectGlobal({ ":root": conf.CSS_VARS });
270
+ if (useReset) emotion.injectGlobal(conf.reset || conf.RESET);
271
+ const animations = conf.animation || conf.ANIMATION;
272
+ if (animations) {
273
+ const keyframesCSS = {};
274
+ for (const name in animations) {
275
+ keyframesCSS[`@keyframes ${name}`] = animations[name];
276
+ }
277
+ emotion.injectGlobal(keyframesCSS);
278
+ }
279
+ if (hasSvgs || useSvgSprite)
280
+ (0, import_scratch3.appendSVGSprite)(conf.svg || conf.SVG, { document: options.document });
281
+ if (hasIcons || useIconSprite)
282
+ (0, import_scratch3.appendSvgIconsSprite)(conf.icons || conf.ICONS, { document: options.document });
283
+ return conf;
284
+ };
285
+ var UPDATE_OPTIONS2 = {
286
+ emotion: import_emotion2.emotion
287
+ };
288
+ var reinit2 = (config, options = UPDATE_OPTIONS2) => {
289
+ const emotion = options.emotion || import_emotion2.emotion;
290
+ const resultConfig = mergeWithLocalFile2(config || {}, options);
291
+ const conf = (0, import_scratch3.set)({
292
+ verbose: false,
293
+ ...resultConfig
294
+ });
295
+ if (!options.preventInject) {
296
+ emotion.injectGlobal({ ":root": conf.CSS_VARS });
297
+ emotion.injectGlobal(conf.RESET);
298
+ }
299
+ return conf;
300
+ };
301
+ var applyCSS2 = (styles, options = UPDATE_OPTIONS2) => {
302
+ const emotion = options.emotion || import_emotion2.emotion;
303
+ emotion.injectGlobal(styles);
304
+ };
305
+ var updateVars2 = (config, options = UPDATE_OPTIONS2) => {
306
+ const emotion = options.emotion || import_emotion2.emotion;
307
+ emotion.injectGlobal({ ":root": config.CSS_VARS });
308
+ };
309
+ var setClass2 = (props, options = UPDATE_OPTIONS2) => {
310
+ };
311
+
312
+ // dist/esm/src/utilImports.js
313
+ __reExport(utilImports_exports2, __require("@domql/report"));
314
+ __reExport(utilImports_exports2, __require("@domql/router"));
315
+
316
+ // dist/esm/src/router.js
317
+ var import_utils3 = __require("@domql/utils");
177
318
  var import_router = __require("@domql/router");
178
319
  var DEFAULT_ROUTING_OPTIONS = {
179
320
  initRouter: true,
@@ -183,14 +324,14 @@ var Smbls = (() => {
183
324
  var initRouter = (element, context) => {
184
325
  if (context.router === false) return;
185
326
  else if (context.router === true) context.router = DEFAULT_ROUTING_OPTIONS;
186
- else context.router = (0, import_utils2.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS);
327
+ else context.router = (0, import_utils3.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS);
187
328
  const routerOptions = context.router;
188
329
  const onRouterRenderDefault = async (el, s) => {
189
- const { pathname, search, hash } = import_utils2.window.location;
330
+ const { pathname, search, hash } = import_utils3.window.location;
190
331
  const url = pathname + search + hash;
191
332
  if (el.routes) await (0, import_router.router)(url, el, {}, { initialRender: true });
192
333
  };
193
- const hasRenderRouter = element.on && !(0, import_utils2.isUndefined)(element.on.renderRouter) || !(0, import_utils2.isUndefined)(element.onRenderRouter);
334
+ const hasRenderRouter = element.on && !(0, import_utils3.isUndefined)(element.on.renderRouter) || !(0, import_utils3.isUndefined)(element.onRenderRouter);
194
335
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
195
336
  if (element.on) {
196
337
  element.on.renderRouter = onRouterRenderDefault;
@@ -210,8 +351,8 @@ var Smbls = (() => {
210
351
  const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS;
211
352
  if (!routerOptions.popState) return;
212
353
  const router = context.utils && context.utils.router ? context.utils.router : import_router.router;
213
- import_utils2.window.onpopstate = async (e) => {
214
- const { pathname, search, hash } = import_utils2.window.location;
354
+ import_utils3.window.onpopstate = async (e) => {
355
+ const { pathname, search, hash } = import_utils3.window.location;
215
356
  const url = pathname + search + hash;
216
357
  await element.call(
217
358
  "router",
@@ -225,15 +366,15 @@ var Smbls = (() => {
225
366
  var injectRouterInLinkComponent = (context, routerOptions) => {
226
367
  const { components } = context;
227
368
  if (routerOptions && routerOptions.injectRouterInLinkComponent) {
228
- return (0, import_utils2.deepMerge)(
369
+ return (0, import_utils3.deepMerge)(
229
370
  components["Link"] || components["smbls.Link"],
230
371
  components["RouterLink"] || components["smbls.RouterLink"]
231
372
  );
232
373
  }
233
374
  };
234
375
 
235
- // src/fetchOnCreate.js
236
- var import_utils3 = __require("@domql/utils");
376
+ // dist/esm/src/fetchOnCreate.js
377
+ var import_utils4 = __require("@domql/utils");
237
378
  var import_fetch = __require("@symbo.ls/fetch");
238
379
  var fetchSync = async (key, options) => {
239
380
  if (key && options.editor) {
@@ -250,10 +391,10 @@ var Smbls = (() => {
250
391
  if (options.editor.async) {
251
392
  (0, import_fetch.fetchProjectAsync)(key, options, callback || ((data) => {
252
393
  const designSystem = data.designSystem;
253
- if ((0, import_utils3.isObject)(designSystem)) {
394
+ if ((0, import_utils4.isObject)(designSystem)) {
254
395
  options.utils.init(designSystem);
255
396
  }
256
- if ((0, import_utils3.isObject)(data.state)) {
397
+ if ((0, import_utils4.isObject)(data.state)) {
257
398
  app.state.set(data.state);
258
399
  }
259
400
  }));
@@ -264,24 +405,24 @@ var Smbls = (() => {
264
405
  }
265
406
  };
266
407
 
267
- // src/define.js
408
+ // dist/esm/src/define.js
268
409
  var defaultDefine = {
269
410
  routes: (param) => param,
270
411
  // deps: (param, el) => param || el.parent.deps,
271
412
  $router: async (param, el) => {
272
413
  if (!param) return;
273
414
  const obj = { tag: "fragment", ...param };
274
- const set3 = async () => {
415
+ const set5 = async () => {
275
416
  await el.set(obj, { preventDefineUpdate: "$router" });
276
417
  };
277
418
  if (el.props && el.props.lazyLoad) {
278
- window.requestAnimationFrame(set3);
279
- } else await set3();
419
+ window.requestAnimationFrame(set5);
420
+ } else await set5();
280
421
  return obj;
281
422
  }
282
423
  };
283
424
 
284
- // src/options.js
425
+ // dist/esm/src/options.js
285
426
  var import_package = __require("../package.json");
286
427
  var DESIGN_SYSTEM_OPTIONS = {
287
428
  useReset: true,
@@ -312,28 +453,28 @@ var Smbls = (() => {
312
453
  };
313
454
  var options_default = CREATE_OPTIONS;
314
455
 
315
- // src/index.js
316
- var import_dynamic2 = __toESM(__require("../dynamic.json"), 1);
456
+ // dist/esm/src/index.js
457
+ var import_dynamic3 = __toESM(__require("../dynamic.json"));
317
458
 
318
- // src/createDomql.js
319
- var import_domql = __toESM(__require("domql"), 1);
320
- var uikit2 = __toESM(__require("@symbo.ls/uikit"), 1);
459
+ // dist/esm/src/createDomql.js
460
+ var import_domql = __toESM(__require("domql"));
461
+ var uikit2 = __toESM(__require("@symbo.ls/uikit"));
321
462
  var import_css_in_props = __require("css-in-props");
322
- var import_utils6 = __require("@domql/utils");
463
+ var import_utils7 = __require("@domql/utils");
323
464
  var import_element = __require("@domql/element");
324
465
 
325
- // src/syncExtend.js
326
- var import_utils4 = __require("@domql/utils");
466
+ // dist/esm/src/syncExtend.js
467
+ var import_utils5 = __require("@domql/utils");
327
468
  var import_sync = __require("@symbo.ls/sync");
328
469
  var initializeExtend = (app, ctx) => {
329
- return (0, import_utils4.isObjectLike)(app.extends) ? app.extends : [];
470
+ return (0, import_utils5.isObjectLike)(app.extends) ? app.extends : [];
330
471
  };
331
472
  var initializeSync = (app, ctx) => {
332
473
  const { editor } = ctx;
333
474
  if (!editor) return;
334
- const liveSync = (0, import_utils4.isUndefined)(editor.liveSync) ? (0, import_utils4.isDevelopment)() : editor.liveSync;
475
+ const liveSync = (0, import_utils5.isUndefined)(editor.liveSync) ? (0, import_utils5.isDevelopment)() : editor.liveSync;
335
476
  if (liveSync) {
336
- if ((0, import_utils4.isArray)(app.extends)) app.extends.push(import_sync.SyncComponent);
477
+ if ((0, import_utils5.isArray)(app.extends)) app.extends.push(import_sync.SyncComponent);
337
478
  else if (app.extends) {
338
479
  app.extends = [app.extends, import_sync.SyncComponent];
339
480
  } else {
@@ -344,9 +485,9 @@ var Smbls = (() => {
344
485
  var initializeNotifications = (app, ctx) => {
345
486
  const { editor } = ctx;
346
487
  if (!editor) return;
347
- const verbose = (0, import_utils4.isUndefined)(editor.verbose) ? (0, import_utils4.isDevelopment)() || ctx.verbose : editor.verbose;
488
+ const verbose = (0, import_utils5.isUndefined)(editor.verbose) ? (0, import_utils5.isDevelopment)() || ctx.verbose : editor.verbose;
348
489
  if (verbose) {
349
- if ((0, import_utils4.isArray)(app.extends)) app.extends.push(import_sync.Notifications);
490
+ if ((0, import_utils5.isArray)(app.extends)) app.extends.push(import_sync.Notifications);
350
491
  else if (app.extends) {
351
492
  app.extends = [app.extends, import_sync.Notifications];
352
493
  } else {
@@ -355,11 +496,11 @@ var Smbls = (() => {
355
496
  }
356
497
  };
357
498
 
358
- // src/prepare.js
359
- var import_utils5 = __require("@domql/utils");
360
- var import_emotion2 = __require("@symbo.ls/emotion");
361
- var uikit = __toESM(__require("@symbo.ls/uikit"), 1);
362
- var routerUtils = __toESM(__require("@domql/router"), 1);
499
+ // dist/esm/src/prepare.js
500
+ var import_utils6 = __require("@domql/utils");
501
+ var import_emotion3 = __require("@symbo.ls/emotion");
502
+ var uikit = __toESM(__require("@symbo.ls/uikit"));
503
+ var routerUtils = __toESM(__require("@domql/router"));
363
504
  var prepareWindow = (context) => {
364
505
  if (typeof window === "undefined") window = globalThis || {};
365
506
  if (typeof document === "undefined") {
@@ -376,27 +517,27 @@ var Smbls = (() => {
376
517
  var CDN_PROVIDERS = {
377
518
  skypack: {
378
519
  url: "https://cdn.skypack.dev",
379
- formatUrl: (pkg, version2) => `${CDN_PROVIDERS.skypack.url}/${pkg}${version2 !== "latest" ? `@${version2}` : ""}`
520
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS.skypack.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}`
380
521
  },
381
522
  esmsh: {
382
523
  url: "https://esm.sh",
383
- formatUrl: (pkg, version2) => `${CDN_PROVIDERS.esmsh.url}/${pkg}${version2 !== "latest" ? `@${version2}` : ""}`
524
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS.esmsh.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}`
384
525
  },
385
526
  unpkg: {
386
527
  url: "https://unpkg.com",
387
- formatUrl: (pkg, version2) => `${CDN_PROVIDERS.unpkg.url}/${pkg}${version2 !== "latest" ? `@${version2}` : ""}?module`
528
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS.unpkg.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}?module`
388
529
  },
389
530
  jsdelivr: {
390
531
  url: "https://cdn.jsdelivr.net/npm",
391
- formatUrl: (pkg, version2) => `${CDN_PROVIDERS.jsdelivr.url}/${pkg}${version2 !== "latest" ? `@${version2}` : ""}/+esm`
532
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS.jsdelivr.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}/+esm`
392
533
  },
393
534
  symbols: {
394
535
  url: "https://pkg.symbo.ls",
395
- formatUrl: (pkg, version2) => {
396
- if (pkg.split("/").length > 2 || !onlyDotsAndNumbers(version2)) {
536
+ formatUrl: (pkg, version3) => {
537
+ if (pkg.split("/").length > 2 || !onlyDotsAndNumbers(version3)) {
397
538
  return `${CDN_PROVIDERS.symbols.url}/${pkg}`;
398
539
  }
399
- return `${CDN_PROVIDERS.symbols.url}/${pkg}/${version2}.js`;
540
+ return `${CDN_PROVIDERS.symbols.url}/${pkg}/${version3}.js`;
400
541
  }
401
542
  }
402
543
  };
@@ -411,15 +552,15 @@ var Smbls = (() => {
411
552
  const { packageManager } = symbolsConfig;
412
553
  return PACKAGE_MANAGER_TO_CDN[packageManager] || null;
413
554
  };
414
- var getCDNUrl = (packageName, version2 = "latest", provider = "esmsh") => {
555
+ var getCDNUrl = (packageName, version3 = "latest", provider = "esmsh") => {
415
556
  const cdnConfig = CDN_PROVIDERS[provider] || CDN_PROVIDERS.esmsh;
416
- return cdnConfig.formatUrl(packageName, version2);
557
+ return cdnConfig.formatUrl(packageName, version3);
417
558
  };
418
559
  var UIkitWithPrefix = (prefix = "smbls") => {
419
560
  const newObj = {};
420
561
  for (const key in uikit) {
421
562
  if (Object.prototype.hasOwnProperty.call(uikit, key)) {
422
- if ((0, import_utils5.matchesComponentNaming)(key)) {
563
+ if ((0, import_utils6.matchesComponentNaming)(key)) {
423
564
  newObj[`smbls.${key}`] = uikit[key];
424
565
  } else {
425
566
  newObj[key] = uikit[key];
@@ -433,9 +574,9 @@ var Smbls = (() => {
433
574
  };
434
575
  var prepareUtils = (context) => {
435
576
  return {
436
- ...utilImports_exports,
577
+ ...utilImports_exports2,
437
578
  ...routerUtils,
438
- ...import_scratch2.scratchUtils,
579
+ ...import_scratch4.scratchUtils,
439
580
  ...context.utils,
440
581
  ...context.snippets,
441
582
  ...context.functions
@@ -470,22 +611,22 @@ var Smbls = (() => {
470
611
  }
471
612
  if (!hasAny) return null;
472
613
  for (const dependency in dependencies) {
473
- const version2 = dependencies[dependency];
614
+ const version3 = dependencies[dependency];
474
615
  if (dependenciesOnDemand && dependenciesOnDemand[dependency]) {
475
616
  continue;
476
617
  }
477
- const random = (0, import_utils5.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
478
- const url = getCDNUrl(dependency, version2, cdnProvider) + random;
618
+ const random = (0, import_utils6.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
619
+ const url = getCDNUrl(dependency, version3, cdnProvider) + random;
479
620
  try {
480
621
  if (cachedDeps[dependency]) return;
481
622
  cachedDeps[dependency] = true;
482
- await utilImports_exports.loadRemoteScript(url, { document: document2, type: "module" });
623
+ await utilImports_exports2.loadRemoteScript(url, { document: document2, type: "module" });
483
624
  } catch (e) {
484
625
  console.error(`Failed to load ${dependency} from ${cdnProvider}:`, e);
485
626
  if (cdnProvider !== "symbols") {
486
627
  try {
487
- const fallbackUrl = getCDNUrl(dependency, version2, "symbols") + random;
488
- await utilImports_exports.loadRemoteScript(fallbackUrl, { document: document2 });
628
+ const fallbackUrl = getCDNUrl(dependency, version3, "symbols") + random;
629
+ await utilImports_exports2.loadRemoteScript(fallbackUrl, { document: document2 });
489
630
  console.log(
490
631
  `Successfully loaded ${dependency} from fallback (symbols.ls)`
491
632
  );
@@ -514,10 +655,10 @@ var Smbls = (() => {
514
655
  const documentOpts = ctx2.document || document;
515
656
  const windowOpts2 = ctx2.window || window;
516
657
  if (!windowOpts2.packages[key]) {
517
- const random = (0, import_utils5.isDevelopment)() ? `?${Math.random()}` : "";
658
+ const random = (0, import_utils6.isDevelopment)() ? `?${Math.random()}` : "";
518
659
  if (dependenciesOnDemand && dependenciesOnDemand[key]) {
519
- const version2 = dependenciesOnDemand[key];
520
- const url = getCDNUrl(key, version2, provider) + random;
660
+ const version3 = dependenciesOnDemand[key];
661
+ const url = getCDNUrl(key, version3, provider) + random;
521
662
  try {
522
663
  await ctx2.utils.loadRemoteScript(url, {
523
664
  window: windowOpts2,
@@ -526,7 +667,7 @@ var Smbls = (() => {
526
667
  } catch (e) {
527
668
  console.error(`Failed to load ${key} from ${provider}:`, e);
528
669
  if (provider !== "symbols") {
529
- const fallbackUrl = getCDNUrl(key, version2, "symbols") + random;
670
+ const fallbackUrl = getCDNUrl(key, version3, "symbols") + random;
530
671
  await ctx2.utils.loadRemoteScript(fallbackUrl, {
531
672
  window: windowOpts2,
532
673
  document: documentOpts
@@ -556,7 +697,7 @@ var Smbls = (() => {
556
697
  return await windowOpts2.require(key, provider);
557
698
  };
558
699
  if (windowOpts.packages) {
559
- windowOpts.packages = (0, import_utils5.merge)(windowOpts.packages, packages);
700
+ windowOpts.packages = (0, import_utils6.merge)(windowOpts.packages, packages);
560
701
  } else {
561
702
  windowOpts.packages = packages;
562
703
  }
@@ -570,19 +711,19 @@ var Smbls = (() => {
570
711
  }
571
712
  };
572
713
  var prepareDesignSystem = (key, context) => {
573
- const [scratcDesignhSystem, emotion, registry] = (0, import_emotion2.initEmotion)(key, context);
714
+ const [scratcDesignhSystem, emotion, registry] = (0, import_emotion3.initEmotion)(key, context);
574
715
  return [scratcDesignhSystem, emotion, registry];
575
716
  };
576
717
  var prepareState = (app, context) => {
577
718
  const state = {};
578
- if (context.state) utilImports_exports.deepMerge(state, context.state);
579
- if (app && app.state) (0, import_utils5.deepMerge)(state, app.state);
719
+ if (context.state) utilImports_exports2.deepMerge(state, context.state);
720
+ if (app && app.state) (0, import_utils6.deepMerge)(state, app.state);
580
721
  state.isRootState = true;
581
- return (0, import_utils5.deepClone)(state);
722
+ return (0, import_utils6.deepClone)(state);
582
723
  };
583
724
  var preparePages = (app, context) => {
584
- if ((0, import_utils5.isObject)(app.routes) && (0, import_utils5.isObject)(context.pages)) {
585
- (0, import_utils5.merge)(app.routes, context.pages);
725
+ if ((0, import_utils6.isObject)(app.routes) && (0, import_utils6.isObject)(context.pages)) {
726
+ (0, import_utils6.merge)(app.routes, context.pages);
586
727
  }
587
728
  const pages = app.routes || context.pages || {};
588
729
  for (const v in pages) {
@@ -599,16 +740,16 @@ var Smbls = (() => {
599
740
  const sharedLib = sharedLibraries[i];
600
741
  if (context.type === "template") {
601
742
  overwriteShallow(context.designSystem, sharedLib.designSystem);
602
- (0, import_utils5.deepMerge)(context, sharedLib, ["designSystem"], 1);
743
+ (0, import_utils6.deepMerge)(context, sharedLib, ["designSystem"], 1);
603
744
  } else {
604
- (0, import_utils5.deepMerge)(context, sharedLib, [], 1);
745
+ (0, import_utils6.deepMerge)(context, sharedLib, [], 1);
605
746
  }
606
747
  }
607
748
  };
608
749
 
609
- // src/createDomql.js
750
+ // dist/esm/src/createDomql.js
610
751
  var prepareContext = async (app, context = {}) => {
611
- const key = context.key = context.key || ((0, import_utils6.isString)(app) ? app : "smblsapp");
752
+ const key = context.key = context.key || ((0, import_utils7.isString)(app) ? app : "smblsapp");
612
753
  context.define = context.define || defaultDefine;
613
754
  context.cssPropsRegistry = import_css_in_props.CSS_PROPS_REGISTRY;
614
755
  context.window = prepareWindow(context);
@@ -638,14 +779,14 @@ var Smbls = (() => {
638
779
  return context;
639
780
  };
640
781
  var createDomqlElement = async (app, ctx) => {
641
- if (!(0, import_utils6.isObject)(ctx)) ctx = {};
642
- if ((0, import_utils6.isNode)(app)) {
782
+ if (!(0, import_utils7.isObject)(ctx)) ctx = {};
783
+ if ((0, import_utils7.isNode)(app)) {
643
784
  app = {};
644
785
  ctx.parent = app;
645
- } else if ((0, import_utils6.isString)(app)) {
786
+ } else if ((0, import_utils7.isString)(app)) {
646
787
  app = {};
647
788
  ctx.key = app;
648
- } else if (!(0, import_utils6.isObject)(app)) {
789
+ } else if (!(0, import_utils7.isObject)(app)) {
649
790
  app = {};
650
791
  }
651
792
  await prepareContext(app, ctx);
@@ -675,15 +816,15 @@ var Smbls = (() => {
675
816
  return smblsApp;
676
817
  };
677
818
 
678
- // src/index.js
679
- var mergeWithLocalFile2 = (options, optionsExternalFile) => (0, import_utils7.deepMerge)(
819
+ // dist/esm/src/index.js
820
+ var mergeWithLocalFile3 = (options, optionsExternalFile) => (0, import_utils8.deepMerge)(
680
821
  options,
681
- (0, import_utils7.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic2.default || {}
822
+ (0, import_utils8.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic3.default || {}
682
823
  );
683
824
  var create = (App, options = options_default, optionsExternalFile) => {
684
825
  const redefinedOptions = {
685
826
  ...options_default,
686
- ...mergeWithLocalFile2(options, optionsExternalFile)
827
+ ...mergeWithLocalFile3(options, optionsExternalFile)
687
828
  };
688
829
  const domqlApp = createDomqlElement(App, redefinedOptions).then((App2) => {
689
830
  onpopstateRouter(App2, redefinedOptions);
@@ -701,16 +842,16 @@ var Smbls = (() => {
701
842
  const domqlApp = create(App, options, optionsExternalFile);
702
843
  const redefinedOptions = {
703
844
  ...options_default,
704
- ...mergeWithLocalFile2(options, optionsExternalFile)
845
+ ...mergeWithLocalFile3(options, optionsExternalFile)
705
846
  };
706
847
  const key = redefinedOptions.key;
707
- fetchAsync(domqlApp, key, { utils: utilImports_exports, ...redefinedOptions });
848
+ fetchAsync(domqlApp, key, { utils: utilImports_exports2, ...redefinedOptions });
708
849
  return domqlApp;
709
850
  };
710
851
  var createSync = async (App, options = options_default, optionsExternalFile) => {
711
852
  const redefinedOptions = {
712
853
  ...options_default,
713
- ...mergeWithLocalFile2(options, optionsExternalFile)
854
+ ...mergeWithLocalFile3(options, optionsExternalFile)
714
855
  };
715
856
  const key = options.key;
716
857
  await fetchSync(key, redefinedOptions);
@@ -727,10 +868,571 @@ var Smbls = (() => {
727
868
  var createSkeleton = (App = {}, options = options_default, optionsExternalFile) => {
728
869
  return create(
729
870
  {
730
- deps: { isUndefined: import_utils7.isUndefined },
871
+ deps: { isUndefined: import_utils8.isUndefined },
872
+ ...App
873
+ },
874
+ (0, import_utils8.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
875
+ optionsExternalFile
876
+ );
877
+ };
878
+
879
+ // src/router.js
880
+ var DEFAULT_ROUTING_OPTIONS2 = {
881
+ initRouter: true,
882
+ injectRouterInLinkComponent: true,
883
+ popState: true
884
+ };
885
+ var initRouter2 = (element, context) => {
886
+ if (context.router === false) return;
887
+ else if (context.router === true) context.router = DEFAULT_ROUTING_OPTIONS2;
888
+ else context.router = (0, import_utils9.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS2);
889
+ const routerOptions = context.router;
890
+ const onRouterRenderDefault = async (el, s) => {
891
+ const { pathname, search, hash } = import_utils9.window.location;
892
+ const url = pathname + search + hash;
893
+ if (el.routes) await (0, import_router4.router)(url, el, {}, { initialRender: true });
894
+ };
895
+ const hasRenderRouter = element.on && !(0, import_utils9.isUndefined)(element.on.renderRouter) || !(0, import_utils9.isUndefined)(element.onRenderRouter);
896
+ if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
897
+ if (element.on) {
898
+ element.on.renderRouter = onRouterRenderDefault;
899
+ } else {
900
+ element.on = {
901
+ renderRouter: onRouterRenderDefault
902
+ };
903
+ }
904
+ }
905
+ injectRouterInLinkComponent2(context, routerOptions);
906
+ return routerOptions;
907
+ };
908
+ var popStateFired2;
909
+ var onpopstateRouter2 = (element, context) => {
910
+ if (popStateFired2) return;
911
+ popStateFired2 = true;
912
+ const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS2;
913
+ if (!routerOptions.popState) return;
914
+ const router = context.utils && context.utils.router ? context.utils.router : import_router4.router;
915
+ import_utils9.window.onpopstate = async (e) => {
916
+ const { pathname, search, hash } = import_utils9.window.location;
917
+ const url = pathname + search + hash;
918
+ await element.call(
919
+ "router",
920
+ url,
921
+ element,
922
+ {},
923
+ { pushState: false, scrollToTop: false, level: 0, event: e }
924
+ );
925
+ };
926
+ };
927
+ var injectRouterInLinkComponent2 = (context, routerOptions) => {
928
+ const { components } = context;
929
+ if (routerOptions && routerOptions.injectRouterInLinkComponent) {
930
+ return (0, import_utils9.deepMerge)(
931
+ components["Link"] || components["smbls.Link"],
932
+ components["RouterLink"] || components["smbls.RouterLink"]
933
+ );
934
+ }
935
+ };
936
+
937
+ // src/fetchOnCreate.js
938
+ var import_utils10 = __require("@domql/utils");
939
+ var import_fetch2 = __require("@symbo.ls/fetch");
940
+ var fetchSync2 = async (key, options) => {
941
+ if (key && options.editor) {
942
+ try {
943
+ if (!options.editor.async) await (0, import_fetch2.fetchProject)(key, options);
944
+ } catch (e) {
945
+ console.error(e);
946
+ }
947
+ }
948
+ };
949
+ var fetchAsync2 = (app, key, options, callback) => {
950
+ if (key && options.editor) {
951
+ try {
952
+ if (options.editor.async) {
953
+ (0, import_fetch2.fetchProjectAsync)(key, options, callback || ((data) => {
954
+ const designSystem = data.designSystem;
955
+ if ((0, import_utils10.isObject)(designSystem)) {
956
+ options.utils.init(designSystem);
957
+ }
958
+ if ((0, import_utils10.isObject)(data.state)) {
959
+ app.state.set(data.state);
960
+ }
961
+ }));
962
+ }
963
+ } catch (e) {
964
+ console.error(e);
965
+ }
966
+ }
967
+ };
968
+
969
+ // src/define.js
970
+ var defaultDefine2 = {
971
+ routes: (param) => param,
972
+ // deps: (param, el) => param || el.parent.deps,
973
+ $router: async (param, el) => {
974
+ if (!param) return;
975
+ const obj = { tag: "fragment", ...param };
976
+ const set5 = async () => {
977
+ await el.set(obj, { preventDefineUpdate: "$router" });
978
+ };
979
+ if (el.props && el.props.lazyLoad) {
980
+ window.requestAnimationFrame(set5);
981
+ } else await set5();
982
+ return obj;
983
+ }
984
+ };
985
+
986
+ // src/options.js
987
+ var import_package2 = __require("../package.json");
988
+ var DESIGN_SYSTEM_OPTIONS2 = {
989
+ useReset: true,
990
+ useVariable: true,
991
+ useIconSprite: true,
992
+ useSvgSprite: true,
993
+ useDocumentTheme: true,
994
+ useDefaultIcons: true,
995
+ useFontImport: true,
996
+ useDefaultConfig: true
997
+ };
998
+ var ROUTER_OPTIONS2 = {
999
+ initRouter: true,
1000
+ popState: true,
1001
+ injectRouterInLinkComponent: true
1002
+ };
1003
+ var DEFAULT_CONTEXT2 = {
1004
+ ...DESIGN_SYSTEM_OPTIONS2,
1005
+ router: ROUTER_OPTIONS2,
1006
+ version: import_package2.version
1007
+ };
1008
+ var CREATE_OPTIONS2 = {
1009
+ state: {},
1010
+ pages: {},
1011
+ components: {},
1012
+ router: ROUTER_OPTIONS2,
1013
+ define: defaultDefine2
1014
+ };
1015
+ var options_default2 = CREATE_OPTIONS2;
1016
+
1017
+ // src/index.js
1018
+ var import_dynamic4 = __toESM(__require("../dynamic.json"), 1);
1019
+
1020
+ // src/createDomql.js
1021
+ var import_domql2 = __toESM(__require("domql"), 1);
1022
+ var uikit4 = __toESM(__require("@symbo.ls/uikit"), 1);
1023
+ var import_css_in_props2 = __require("css-in-props");
1024
+ var import_utils13 = __require("@domql/utils");
1025
+ var import_element2 = __require("@domql/element");
1026
+
1027
+ // src/syncExtend.js
1028
+ var import_utils11 = __require("@domql/utils");
1029
+ var import_sync2 = __require("@symbo.ls/sync");
1030
+ var initializeExtend2 = (app, ctx) => {
1031
+ return (0, import_utils11.isObjectLike)(app.extends) ? app.extends : [];
1032
+ };
1033
+ var initializeSync2 = (app, ctx) => {
1034
+ const { editor } = ctx;
1035
+ if (!editor) return;
1036
+ const liveSync = (0, import_utils11.isUndefined)(editor.liveSync) ? (0, import_utils11.isDevelopment)() : editor.liveSync;
1037
+ if (liveSync) {
1038
+ if ((0, import_utils11.isArray)(app.extends)) app.extends.push(import_sync2.SyncComponent);
1039
+ else if (app.extends) {
1040
+ app.extends = [app.extends, import_sync2.SyncComponent];
1041
+ } else {
1042
+ app.extends = [import_sync2.SyncComponent];
1043
+ }
1044
+ }
1045
+ };
1046
+ var initializeNotifications2 = (app, ctx) => {
1047
+ const { editor } = ctx;
1048
+ if (!editor) return;
1049
+ const verbose = (0, import_utils11.isUndefined)(editor.verbose) ? (0, import_utils11.isDevelopment)() || ctx.verbose : editor.verbose;
1050
+ if (verbose) {
1051
+ if ((0, import_utils11.isArray)(app.extends)) app.extends.push(import_sync2.Notifications);
1052
+ else if (app.extends) {
1053
+ app.extends = [app.extends, import_sync2.Notifications];
1054
+ } else {
1055
+ app.extends = [import_sync2.Notifications];
1056
+ }
1057
+ }
1058
+ };
1059
+
1060
+ // src/prepare.js
1061
+ var import_utils12 = __require("@domql/utils");
1062
+ var import_emotion4 = __require("@symbo.ls/emotion");
1063
+ var uikit3 = __toESM(__require("@symbo.ls/uikit"), 1);
1064
+ var routerUtils2 = __toESM(__require("@domql/router"), 1);
1065
+ var prepareWindow2 = (context) => {
1066
+ if (typeof window === "undefined") window = globalThis || {};
1067
+ if (typeof document === "undefined") {
1068
+ if (!window.document) window.document = globalThis.document || { body: {} };
1069
+ document = window.document;
1070
+ }
1071
+ context.document = context.document || document;
1072
+ context.window = context.window || window;
1073
+ return context.window;
1074
+ };
1075
+ function onlyDotsAndNumbers2(str) {
1076
+ return /^[0-9.]+$/.test(str) && str !== "";
1077
+ }
1078
+ var CDN_PROVIDERS2 = {
1079
+ skypack: {
1080
+ url: "https://cdn.skypack.dev",
1081
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS2.skypack.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}`
1082
+ },
1083
+ esmsh: {
1084
+ url: "https://esm.sh",
1085
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS2.esmsh.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}`
1086
+ },
1087
+ unpkg: {
1088
+ url: "https://unpkg.com",
1089
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS2.unpkg.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}?module`
1090
+ },
1091
+ jsdelivr: {
1092
+ url: "https://cdn.jsdelivr.net/npm",
1093
+ formatUrl: (pkg, version3) => `${CDN_PROVIDERS2.jsdelivr.url}/${pkg}${version3 !== "latest" ? `@${version3}` : ""}/+esm`
1094
+ },
1095
+ symbols: {
1096
+ url: "https://pkg.symbo.ls",
1097
+ formatUrl: (pkg, version3) => {
1098
+ if (pkg.split("/").length > 2 || !onlyDotsAndNumbers2(version3)) {
1099
+ return `${CDN_PROVIDERS2.symbols.url}/${pkg}`;
1100
+ }
1101
+ return `${CDN_PROVIDERS2.symbols.url}/${pkg}/${version3}.js`;
1102
+ }
1103
+ }
1104
+ };
1105
+ var PACKAGE_MANAGER_TO_CDN2 = {
1106
+ "esm.sh": "esmsh",
1107
+ "unpkg": "unpkg",
1108
+ "skypack": "skypack",
1109
+ "jsdelivr": "jsdelivr",
1110
+ "pkg.symbo.ls": "symbols"
1111
+ };
1112
+ var getCdnProviderFromConfig2 = (symbolsConfig = {}) => {
1113
+ const { packageManager } = symbolsConfig;
1114
+ return PACKAGE_MANAGER_TO_CDN2[packageManager] || null;
1115
+ };
1116
+ var getCDNUrl2 = (packageName, version3 = "latest", provider = "esmsh") => {
1117
+ const cdnConfig = CDN_PROVIDERS2[provider] || CDN_PROVIDERS2.esmsh;
1118
+ return cdnConfig.formatUrl(packageName, version3);
1119
+ };
1120
+ var UIkitWithPrefix2 = (prefix = "smbls") => {
1121
+ const newObj = {};
1122
+ for (const key in uikit3) {
1123
+ if (Object.prototype.hasOwnProperty.call(uikit3, key)) {
1124
+ if ((0, import_utils12.matchesComponentNaming)(key)) {
1125
+ newObj[`smbls.${key}`] = uikit3[key];
1126
+ } else {
1127
+ newObj[key] = uikit3[key];
1128
+ }
1129
+ }
1130
+ }
1131
+ return newObj;
1132
+ };
1133
+ var prepareComponents2 = (context) => {
1134
+ return context.components ? { ...UIkitWithPrefix2(), ...context.components } : UIkitWithPrefix2();
1135
+ };
1136
+ var prepareUtils2 = (context) => {
1137
+ return {
1138
+ ...utilImports_exports,
1139
+ ...routerUtils2,
1140
+ ...import_scratch2.scratchUtils,
1141
+ ...context.utils,
1142
+ ...context.snippets,
1143
+ ...context.functions
1144
+ };
1145
+ };
1146
+ var prepareMethods2 = (context) => {
1147
+ return {
1148
+ ...context.methods || {},
1149
+ require: context.utils.require,
1150
+ requireOnDemand: context.utils.requireOnDemand,
1151
+ router: context.utils.router
1152
+ };
1153
+ };
1154
+ var cachedDeps2 = {};
1155
+ var prepareDependencies2 = async ({
1156
+ dependencies,
1157
+ dependenciesOnDemand,
1158
+ document: document2,
1159
+ preventCaching = false,
1160
+ cdnProvider,
1161
+ packageManager,
1162
+ symbolsConfig
1163
+ }) => {
1164
+ if (!cdnProvider) {
1165
+ cdnProvider = PACKAGE_MANAGER_TO_CDN2[packageManager] || getCdnProviderFromConfig2(symbolsConfig) || "esmsh";
1166
+ }
1167
+ if (!dependencies) return null;
1168
+ let hasAny = false;
1169
+ for (const _k in dependencies) {
1170
+ hasAny = true;
1171
+ break;
1172
+ }
1173
+ if (!hasAny) return null;
1174
+ for (const dependency in dependencies) {
1175
+ const version3 = dependencies[dependency];
1176
+ if (dependenciesOnDemand && dependenciesOnDemand[dependency]) {
1177
+ continue;
1178
+ }
1179
+ const random = (0, import_utils12.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
1180
+ const url = getCDNUrl2(dependency, version3, cdnProvider) + random;
1181
+ try {
1182
+ if (cachedDeps2[dependency]) return;
1183
+ cachedDeps2[dependency] = true;
1184
+ await utilImports_exports.loadRemoteScript(url, { document: document2, type: "module" });
1185
+ } catch (e) {
1186
+ console.error(`Failed to load ${dependency} from ${cdnProvider}:`, e);
1187
+ if (cdnProvider !== "symbols") {
1188
+ try {
1189
+ const fallbackUrl = getCDNUrl2(dependency, version3, "symbols") + random;
1190
+ await utilImports_exports.loadRemoteScript(fallbackUrl, { document: document2 });
1191
+ console.log(
1192
+ `Successfully loaded ${dependency} from fallback (symbols.ls)`
1193
+ );
1194
+ } catch (fallbackError) {
1195
+ console.error(
1196
+ `Failed to load ${dependency} from fallback:`,
1197
+ fallbackError
1198
+ );
1199
+ }
1200
+ }
1201
+ }
1202
+ }
1203
+ return dependencies;
1204
+ };
1205
+ var prepareRequire2 = async (packages, ctx) => {
1206
+ const windowOpts = ctx.window || window;
1207
+ const defaultProvider = ctx.cdnProvider || getCdnProviderFromConfig2(ctx.symbolsConfig) || "esmsh";
1208
+ const initRequire = async (ctx2) => async (key, provider) => {
1209
+ const windowOpts2 = ctx2.window || window;
1210
+ const pkg = windowOpts2.packages[key];
1211
+ if (typeof pkg === "function") return pkg();
1212
+ return pkg;
1213
+ };
1214
+ const initRequireOnDemand = async (ctx2) => async (key, provider = defaultProvider) => {
1215
+ const { dependenciesOnDemand } = ctx2;
1216
+ const documentOpts = ctx2.document || document;
1217
+ const windowOpts2 = ctx2.window || window;
1218
+ if (!windowOpts2.packages[key]) {
1219
+ const random = (0, import_utils12.isDevelopment)() ? `?${Math.random()}` : "";
1220
+ if (dependenciesOnDemand && dependenciesOnDemand[key]) {
1221
+ const version3 = dependenciesOnDemand[key];
1222
+ const url = getCDNUrl2(key, version3, provider) + random;
1223
+ try {
1224
+ await ctx2.utils.loadRemoteScript(url, {
1225
+ window: windowOpts2,
1226
+ document: documentOpts
1227
+ });
1228
+ } catch (e) {
1229
+ console.error(`Failed to load ${key} from ${provider}:`, e);
1230
+ if (provider !== "symbols") {
1231
+ const fallbackUrl = getCDNUrl2(key, version3, "symbols") + random;
1232
+ await ctx2.utils.loadRemoteScript(fallbackUrl, {
1233
+ window: windowOpts2,
1234
+ document: documentOpts
1235
+ });
1236
+ }
1237
+ }
1238
+ } else {
1239
+ const url = getCDNUrl2(key, "latest", provider) + random;
1240
+ try {
1241
+ await ctx2.utils.loadRemoteScript(url, {
1242
+ window: windowOpts2,
1243
+ document: documentOpts
1244
+ });
1245
+ } catch (e) {
1246
+ console.error(`Failed to load ${key} from ${provider}:`, e);
1247
+ if (provider !== "symbols") {
1248
+ const fallbackUrl = getCDNUrl2(key, "latest", "symbols") + random;
1249
+ await ctx2.utils.loadRemoteScript(fallbackUrl, {
1250
+ window: windowOpts2,
1251
+ document: documentOpts
1252
+ });
1253
+ }
1254
+ }
1255
+ windowOpts2.packages[key] = "loadedOnDeman";
1256
+ }
1257
+ }
1258
+ return await windowOpts2.require(key, provider);
1259
+ };
1260
+ if (windowOpts.packages) {
1261
+ windowOpts.packages = (0, import_utils12.merge)(windowOpts.packages, packages);
1262
+ } else {
1263
+ windowOpts.packages = packages;
1264
+ }
1265
+ if (!windowOpts.require) {
1266
+ ctx.utils.require = await initRequire(ctx);
1267
+ windowOpts.require = ctx.utils.require;
1268
+ }
1269
+ if (!windowOpts.requireOnDemand) {
1270
+ ctx.utils.requireOnDemand = await initRequireOnDemand(ctx);
1271
+ windowOpts.requireOnDemand = ctx.utils.requireOnDemand;
1272
+ }
1273
+ };
1274
+ var prepareDesignSystem2 = (key, context) => {
1275
+ const [scratcDesignhSystem, emotion, registry] = (0, import_emotion4.initEmotion)(key, context);
1276
+ return [scratcDesignhSystem, emotion, registry];
1277
+ };
1278
+ var prepareState2 = (app, context) => {
1279
+ const state = {};
1280
+ if (context.state) utilImports_exports.deepMerge(state, context.state);
1281
+ if (app && app.state) (0, import_utils12.deepMerge)(state, app.state);
1282
+ state.isRootState = true;
1283
+ return (0, import_utils12.deepClone)(state);
1284
+ };
1285
+ var preparePages2 = (app, context) => {
1286
+ if ((0, import_utils12.isObject)(app.routes) && (0, import_utils12.isObject)(context.pages)) {
1287
+ (0, import_utils12.merge)(app.routes, context.pages);
1288
+ }
1289
+ const pages = app.routes || context.pages || {};
1290
+ for (const v in pages) {
1291
+ if (v.charCodeAt(0) === 47) continue;
1292
+ const index = v === "index" ? "" : v;
1293
+ pages["/" + index] = pages[v];
1294
+ delete pages[v];
1295
+ }
1296
+ return pages;
1297
+ };
1298
+ var prepareSharedLibs2 = (context) => {
1299
+ const sharedLibraries = context.sharedLibraries;
1300
+ for (let i = 0; i < sharedLibraries.length; i++) {
1301
+ const sharedLib = sharedLibraries[i];
1302
+ if (context.type === "template") {
1303
+ overwriteShallow(context.designSystem, sharedLib.designSystem);
1304
+ (0, import_utils12.deepMerge)(context, sharedLib, ["designSystem"], 1);
1305
+ } else {
1306
+ (0, import_utils12.deepMerge)(context, sharedLib, [], 1);
1307
+ }
1308
+ }
1309
+ };
1310
+
1311
+ // src/createDomql.js
1312
+ var prepareContext2 = async (app, context = {}) => {
1313
+ const key = context.key = context.key || ((0, import_utils13.isString)(app) ? app : "smblsapp");
1314
+ context.define = context.define || defaultDefine2;
1315
+ context.cssPropsRegistry = import_css_in_props2.CSS_PROPS_REGISTRY;
1316
+ context.window = prepareWindow2(context);
1317
+ if (context.sharedLibraries && context.sharedLibraries.length) {
1318
+ prepareSharedLibs2(context);
1319
+ }
1320
+ const [scratcDesignSystem, emotion, registry] = prepareDesignSystem2(
1321
+ key,
1322
+ context
1323
+ );
1324
+ context.designSystem = scratcDesignSystem;
1325
+ context.registry = registry;
1326
+ context.emotion = emotion;
1327
+ const state = prepareState2(app, context);
1328
+ context.state = state;
1329
+ context.pages = preparePages2(app, context);
1330
+ context.components = prepareComponents2(context);
1331
+ context.utils = prepareUtils2(context);
1332
+ if (PACKAGE_MANAGER_TO_CDN2[context.packageManager]) {
1333
+ context.dependencies = await prepareDependencies2(context);
1334
+ }
1335
+ context.methods = prepareMethods2(context);
1336
+ context.routerOptions = initRouter2(app, context);
1337
+ context.defaultExtends = [uikit4.Box];
1338
+ context.snippets = context.snippets || {};
1339
+ context.functions = context.functions || {};
1340
+ return context;
1341
+ };
1342
+ var createDomqlElement2 = async (app, ctx) => {
1343
+ if (!(0, import_utils13.isObject)(ctx)) ctx = {};
1344
+ if ((0, import_utils13.isNode)(app)) {
1345
+ app = {};
1346
+ ctx.parent = app;
1347
+ } else if ((0, import_utils13.isString)(app)) {
1348
+ app = {};
1349
+ ctx.key = app;
1350
+ } else if (!(0, import_utils13.isObject)(app)) {
1351
+ app = {};
1352
+ }
1353
+ await prepareContext2(app, ctx);
1354
+ app.extends = initializeExtend2(app, ctx);
1355
+ app.routes = ctx.pages;
1356
+ app.state = ctx.state;
1357
+ app.context = ctx;
1358
+ app.data = app.data || {};
1359
+ app.data.frameListeners = (0, import_element2.initAnimationFrame)(ctx);
1360
+ await prepareRequire2(
1361
+ {
1362
+ functions: ctx.functions,
1363
+ utils: ctx.utils,
1364
+ snippets: ctx.snippets,
1365
+ ...ctx.files
1366
+ },
1367
+ ctx
1368
+ );
1369
+ initializeSync2(app, ctx);
1370
+ initializeNotifications2(app, ctx);
1371
+ const parentNode = ctx.parent || ctx.document.body;
1372
+ const domqlCreate = import_domql2.default.default && import_domql2.default.default.create || import_domql2.default.create;
1373
+ const smblsApp = await domqlCreate(app, parentNode, ctx.key, {
1374
+ verbose: ctx.verbose,
1375
+ ...ctx.domqlOptions
1376
+ });
1377
+ return smblsApp;
1378
+ };
1379
+
1380
+ // src/index.js
1381
+ var mergeWithLocalFile4 = (options, optionsExternalFile) => (0, import_utils14.deepMerge)(
1382
+ options,
1383
+ (0, import_utils14.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic4.default || {}
1384
+ );
1385
+ var create2 = (App, options = options_default2, optionsExternalFile) => {
1386
+ const redefinedOptions = {
1387
+ ...options_default2,
1388
+ ...mergeWithLocalFile4(options, optionsExternalFile)
1389
+ };
1390
+ const domqlApp = createDomqlElement2(App, redefinedOptions).then((App2) => {
1391
+ onpopstateRouter2(App2, redefinedOptions);
1392
+ if (redefinedOptions.on && redefinedOptions.on.create)
1393
+ redefinedOptions.on.create(
1394
+ domqlApp,
1395
+ domqlApp.state,
1396
+ domqlApp.context,
1397
+ redefinedOptions
1398
+ );
1399
+ });
1400
+ return domqlApp;
1401
+ };
1402
+ var createAsync2 = (App, options = options_default2, optionsExternalFile) => {
1403
+ const domqlApp = create2(App, options, optionsExternalFile);
1404
+ const redefinedOptions = {
1405
+ ...options_default2,
1406
+ ...mergeWithLocalFile4(options, optionsExternalFile)
1407
+ };
1408
+ const key = redefinedOptions.key;
1409
+ fetchAsync2(domqlApp, key, { utils: utilImports_exports, ...redefinedOptions });
1410
+ return domqlApp;
1411
+ };
1412
+ var createSync2 = async (App, options = options_default2, optionsExternalFile) => {
1413
+ const redefinedOptions = {
1414
+ ...options_default2,
1415
+ ...mergeWithLocalFile4(options, optionsExternalFile)
1416
+ };
1417
+ const key = options.key;
1418
+ await fetchSync2(key, redefinedOptions);
1419
+ const domqlApp = await createDomqlElement2(App, redefinedOptions);
1420
+ if (redefinedOptions.on && redefinedOptions.on.create)
1421
+ await redefinedOptions.on.create(
1422
+ domqlApp,
1423
+ domqlApp.state,
1424
+ domqlApp.context,
1425
+ redefinedOptions
1426
+ );
1427
+ return domqlApp;
1428
+ };
1429
+ var createSkeleton2 = (App = {}, options = options_default2, optionsExternalFile) => {
1430
+ return create2(
1431
+ {
1432
+ deps: { isUndefined: import_utils14.isUndefined },
731
1433
  ...App
732
1434
  },
733
- (0, import_utils7.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
1435
+ (0, import_utils14.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
734
1436
  optionsExternalFile
735
1437
  );
736
1438
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smbls",
3
- "version": "3.4.4",
3
+ "version": "3.4.5",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/symbo-ls/smbls",
6
6
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
@@ -28,25 +28,25 @@
28
28
  "src"
29
29
  ],
30
30
  "dependencies": {
31
- "@symbo.ls/emotion": "^3.4.4",
32
- "@domql/report": "^3.4.4",
33
- "@domql/router": "^3.4.4",
34
- "@domql/utils": "^3.4.4",
35
- "@symbo.ls/cli": "^3.4.4",
36
- "@symbo.ls/default-config": "^3.4.4",
37
- "@symbo.ls/fetch": "^3.4.4",
38
- "@symbo.ls/scratch": "^3.4.4",
39
- "@symbo.ls/sync": "^3.4.4",
40
- "@symbo.ls/uikit": "^3.4.4",
41
- "@symbo.ls/smbls-utils": "^3.4.4",
42
- "attrs-in-props": "^3.4.4",
43
- "css-in-props": "^3.4.4",
44
- "domql": "^3.4.4"
31
+ "@symbo.ls/emotion": "^3.4.5",
32
+ "@domql/report": "^3.4.5",
33
+ "@domql/router": "^3.4.5",
34
+ "@domql/utils": "^3.4.5",
35
+ "@symbo.ls/cli": "^3.4.5",
36
+ "@symbo.ls/default-config": "^3.4.5",
37
+ "@symbo.ls/fetch": "^3.4.5",
38
+ "@symbo.ls/scratch": "^3.4.5",
39
+ "@symbo.ls/sync": "^3.4.5",
40
+ "@symbo.ls/uikit": "^3.4.5",
41
+ "@symbo.ls/smbls-utils": "^3.4.5",
42
+ "attrs-in-props": "^3.4.5",
43
+ "css-in-props": "^3.4.5",
44
+ "domql": "^3.4.5"
45
45
  },
46
46
  "publishConfig": {},
47
47
  "scripts": {
48
48
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
49
- "build:esm": "cross-env NODE_ENV=$NODE_ENV esbuild *.js src/*.js --target=es2020 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV && cp dynamic.json dist/esm/dynamic.json",
49
+ "build:esm": "cross-env NODE_ENV=$NODE_ENV esbuild *.js src/*.js --target=es2020 --format=esm --outdir=dist/esm --define:process.env.NODE_ENV=process.env.NODE_ENV && cp dynamic.json dist/esm/dynamic.json && node -e \"const p=require('./package.json');require('fs').writeFileSync('dist/esm/package.json',JSON.stringify({name:p.name,version:p.version}));\"",
50
50
  "build:cjs": "cross-env NODE_ENV=$NODE_ENV esbuild *.js src/*.js --target=node18 --format=cjs --outdir=dist/cjs --define:process.env.NODE_ENV=process.env.NODE_ENV",
51
51
  "build": "node ../../build/build.js",
52
52
  "prepublish": "npm run build && npm run copy:package:cjs",