smbls 3.6.3 → 3.6.4

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.
package/README.md CHANGED
@@ -197,4 +197,48 @@ See the [@symbo.ls/cli](../cli/) package for the full command reference.
197
197
 
198
198
  ## Documentation
199
199
 
200
+ ## Define System
201
+
202
+ The define system (`context.define` and `element.define`) maps special keys to handler functions. When a key with a matching define handler appears on an element, `throughInitialDefine` calls the handler instead of treating the key as a child or prop.
203
+
204
+ ### Built-in define handlers (in `defaultDefine`)
205
+
206
+ | Key | Purpose |
207
+ |-----|---------|
208
+ | `routes` | Route definitions — passed through as-is |
209
+ | `metadata` | SEO metadata — resolves and applies `<title>` and `<meta>` tags via helmet |
210
+ | `$router` | Router content — wraps params in a fragment and calls `el.set()` |
211
+
212
+ ### Collection define handlers (deprecated in v3)
213
+
214
+ The following collection define handlers existed in v2 but are **deprecated in v3**:
215
+
216
+ | Key (deprecated) | Data source | v3 replacement |
217
+ |-------------------|-------------|----------------|
218
+ | `$collection` | Direct data array/object | Use `children` + `childExtends` |
219
+ | `$propsCollection` | `element.props` as data source | Use `children: ({ props }) => props.items` |
220
+ | `$stateCollection` | `element.state` as data source | Use `children: ({ state }) => state.items` |
221
+ | `$setCollection` | Uses `set()` to update content | Use `content` or `children` |
222
+
223
+ Some older projects still use these handlers via project-level `context.define`. The framework's propertization layer (`@domql/utils/props.js`) is define-aware to avoid moving these keys into `props` when define handlers are present.
224
+
225
+ > **Lesson learned:** The `$` prefix overlaps between css-in-props selectors and define handlers. The propertization in `props.js` checks for define handlers before applying `CSS_SELECTOR_PREFIXES` to prevent define keys from being swallowed into props. This matters for backwards compatibility with v2 projects that still use `$propsCollection` etc.
226
+
227
+ ## Emotion Integration (`prepare.js`)
228
+
229
+ `prepareDesignSystem()` calls `initEmotion()` from `@symbo.ls/emotion/initEmotion.js` to initialize the CSS-in-JS engine. This import must be present for Emotion to work.
230
+
231
+ ```javascript
232
+ import { initEmotion } from '@symbo.ls/emotion/initEmotion.js'
233
+
234
+ export const prepareDesignSystem = (key, context) => {
235
+ const [scratchDesignSystem, emotion, registry] = initEmotion(key, context)
236
+ return [scratchDesignSystem, emotion, registry]
237
+ }
238
+ ```
239
+
240
+ > **Lesson learned:** If the `initEmotion` import is missing or broken, no CSS classes are generated and components render unstyled (Bazaar rendering issue).
241
+
242
+ ## Documentation
243
+
200
244
  For full documentation visit [symbols.app/developers](https://symbols.app/developers).
@@ -1 +1 @@
1
- {"name":"smbls","version":"3.6.1"}
1
+ {"name":"smbls","version":"3.6.3"}
@@ -22,16 +22,6 @@ __export(define_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(define_exports);
24
24
  var import_helmet = require("@symbo.ls/helmet");
25
- var import_utils = require("@domql/utils");
26
- const processCollectionParam = (param, state) => {
27
- if ((0, import_utils.isString)(param)) {
28
- if (param === "state") return state.parse();
29
- return (0, import_utils.getChildStateInKey)(param, state);
30
- }
31
- if ((0, import_utils.isState)(param)) return param.parse();
32
- if ((0, import_utils.isNot)(param)("array", "object")) return null;
33
- return (0, import_utils.deepClone)(param);
34
- };
35
25
  const defaultDefine = {
36
26
  routes: (param) => param,
37
27
  metadata: (param, el, state) => {
@@ -51,120 +41,5 @@ const defaultDefine = {
51
41
  window.requestAnimationFrame(set);
52
42
  } else await set();
53
43
  return obj;
54
- },
55
- $collection: async (param, el, state) => {
56
- const { __ref: ref } = el;
57
- const {
58
- children: childrenProps,
59
- childrenAs,
60
- childExtends
61
- } = el.props || {};
62
- const children = childrenProps && await (0, import_utils.exec)(childrenProps, el, state);
63
- const childrenAsDefault = childrenAs || "props";
64
- if (children) {
65
- if ((0, import_utils.isObject)(children)) {
66
- param = (0, import_utils.deepClone)(children);
67
- param = Object.keys(param).map((v) => {
68
- const val = param[v];
69
- return (0, import_utils.isObjectLike)(val) ? { ...val, extends: v } : { extends: v, value: val };
70
- });
71
- } else if ((0, import_utils.isArray)(children)) {
72
- param = (0, import_utils.deepClone)(children);
73
- if (childrenAsDefault && childrenAsDefault !== "element") {
74
- param = param.map((v) => ({
75
- ...childExtends && { extends: childExtends },
76
- [childrenAsDefault]: (0, import_utils.isObjectLike)(v) ? v : childrenAsDefault === "state" ? { value: v } : { text: v }
77
- }));
78
- }
79
- } else if ((0, import_utils.isString)(children) || (0, import_utils.isNumber)(children)) {
80
- el.removeContent();
81
- el.content = { text: param };
82
- return;
83
- }
84
- }
85
- if (!param) return;
86
- param = processCollectionParam(param, state);
87
- if (!param) return;
88
- if (ref.__collectionCache) {
89
- const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache);
90
- if (equals) {
91
- ref.__noCollectionDifference = true;
92
- return;
93
- }
94
- ref.__collectionCache = (0, import_utils.deepClone)(param);
95
- delete ref.__noCollectionDifference;
96
- } else {
97
- ref.__collectionCache = (0, import_utils.deepClone)(param);
98
- }
99
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
100
- for (const key in param) {
101
- const value = param[key];
102
- if (value) obj[key] = (0, import_utils.isObjectLike)(value) ? value : { value };
103
- }
104
- el.removeContent();
105
- el.content = obj;
106
- },
107
- $setCollection: async (param, el, state) => {
108
- if (!param) return;
109
- param = processCollectionParam(param, state);
110
- if (!param) return;
111
- const data = ((0, import_utils.isArray)(param) ? param : (0, import_utils.isObject)(param) ? Object.values(param) : []).map((item) => !(0, import_utils.isObjectLike)(item) ? { value: item } : item);
112
- if (data.length) {
113
- const t = setTimeout(() => {
114
- el.set({ tag: "fragment", ...data }, { preventDefineUpdate: "$setCollection" });
115
- clearTimeout(t);
116
- });
117
- }
118
- return data;
119
- },
120
- $stateCollection: async (param, el, state) => {
121
- const { children, childrenAs } = el.props || {};
122
- if (!param || children || childrenAs) return;
123
- param = processCollectionParam(param, state);
124
- if (!param) return;
125
- const { __ref: ref } = el;
126
- if (ref.__stateCollectionCache) {
127
- const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache);
128
- if (equals) {
129
- ref.__noCollectionDifference = true;
130
- return;
131
- }
132
- ref.__stateCollectionCache = (0, import_utils.deepClone)(param);
133
- delete ref.__noCollectionDifference;
134
- } else {
135
- ref.__stateCollectionCache = (0, import_utils.deepClone)(param);
136
- }
137
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
138
- for (const key in param) {
139
- const value = param[key];
140
- if (value) obj[key] = { state: (0, import_utils.isObjectLike)(value) ? value : { value } };
141
- }
142
- el.removeContent();
143
- el.content = obj;
144
- },
145
- $propsCollection: async (param, el, state) => {
146
- const { children, childrenAs } = el.props || {};
147
- if (!param || children || childrenAs) return;
148
- param = processCollectionParam(param, state);
149
- if (!param) return;
150
- const { __ref: ref } = el;
151
- if (ref.__propsCollectionCache) {
152
- const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache);
153
- if (equals) {
154
- ref.__noCollectionDifference = true;
155
- return;
156
- }
157
- ref.__propsCollectionCache = (0, import_utils.deepClone)(param);
158
- delete ref.__noCollectionDifference;
159
- } else {
160
- ref.__propsCollectionCache = (0, import_utils.deepClone)(param);
161
- }
162
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
163
- for (const key in param) {
164
- const value = param[key];
165
- if (value) obj[key] = { props: (0, import_utils.isObjectLike)(value) ? value : { value } };
166
- }
167
- el.removeContent();
168
- el.content = obj;
169
44
  }
170
45
  };
@@ -1 +1 @@
1
- {"name":"smbls","version":"3.6.1"}
1
+ {"name":"smbls","version":"3.6.3"}
@@ -1,25 +1,4 @@
1
1
  import { resolveMetadata, applyMetadata } from "@symbo.ls/helmet";
2
- import {
3
- isString,
4
- isNumber,
5
- isNot,
6
- isArray,
7
- isObject,
8
- isObjectLike,
9
- isState,
10
- exec,
11
- deepClone,
12
- getChildStateInKey
13
- } from "@domql/utils";
14
- const processCollectionParam = (param, state) => {
15
- if (isString(param)) {
16
- if (param === "state") return state.parse();
17
- return getChildStateInKey(param, state);
18
- }
19
- if (isState(param)) return param.parse();
20
- if (isNot(param)("array", "object")) return null;
21
- return deepClone(param);
22
- };
23
2
  const defaultDefine = {
24
3
  routes: (param) => param,
25
4
  metadata: (param, el, state) => {
@@ -39,121 +18,6 @@ const defaultDefine = {
39
18
  window.requestAnimationFrame(set);
40
19
  } else await set();
41
20
  return obj;
42
- },
43
- $collection: async (param, el, state) => {
44
- const { __ref: ref } = el;
45
- const {
46
- children: childrenProps,
47
- childrenAs,
48
- childExtends
49
- } = el.props || {};
50
- const children = childrenProps && await exec(childrenProps, el, state);
51
- const childrenAsDefault = childrenAs || "props";
52
- if (children) {
53
- if (isObject(children)) {
54
- param = deepClone(children);
55
- param = Object.keys(param).map((v) => {
56
- const val = param[v];
57
- return isObjectLike(val) ? { ...val, extends: v } : { extends: v, value: val };
58
- });
59
- } else if (isArray(children)) {
60
- param = deepClone(children);
61
- if (childrenAsDefault && childrenAsDefault !== "element") {
62
- param = param.map((v) => ({
63
- ...childExtends && { extends: childExtends },
64
- [childrenAsDefault]: isObjectLike(v) ? v : childrenAsDefault === "state" ? { value: v } : { text: v }
65
- }));
66
- }
67
- } else if (isString(children) || isNumber(children)) {
68
- el.removeContent();
69
- el.content = { text: param };
70
- return;
71
- }
72
- }
73
- if (!param) return;
74
- param = processCollectionParam(param, state);
75
- if (!param) return;
76
- if (ref.__collectionCache) {
77
- const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache);
78
- if (equals) {
79
- ref.__noCollectionDifference = true;
80
- return;
81
- }
82
- ref.__collectionCache = deepClone(param);
83
- delete ref.__noCollectionDifference;
84
- } else {
85
- ref.__collectionCache = deepClone(param);
86
- }
87
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
88
- for (const key in param) {
89
- const value = param[key];
90
- if (value) obj[key] = isObjectLike(value) ? value : { value };
91
- }
92
- el.removeContent();
93
- el.content = obj;
94
- },
95
- $setCollection: async (param, el, state) => {
96
- if (!param) return;
97
- param = processCollectionParam(param, state);
98
- if (!param) return;
99
- const data = (isArray(param) ? param : isObject(param) ? Object.values(param) : []).map((item) => !isObjectLike(item) ? { value: item } : item);
100
- if (data.length) {
101
- const t = setTimeout(() => {
102
- el.set({ tag: "fragment", ...data }, { preventDefineUpdate: "$setCollection" });
103
- clearTimeout(t);
104
- });
105
- }
106
- return data;
107
- },
108
- $stateCollection: async (param, el, state) => {
109
- const { children, childrenAs } = el.props || {};
110
- if (!param || children || childrenAs) return;
111
- param = processCollectionParam(param, state);
112
- if (!param) return;
113
- const { __ref: ref } = el;
114
- if (ref.__stateCollectionCache) {
115
- const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache);
116
- if (equals) {
117
- ref.__noCollectionDifference = true;
118
- return;
119
- }
120
- ref.__stateCollectionCache = deepClone(param);
121
- delete ref.__noCollectionDifference;
122
- } else {
123
- ref.__stateCollectionCache = deepClone(param);
124
- }
125
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
126
- for (const key in param) {
127
- const value = param[key];
128
- if (value) obj[key] = { state: isObjectLike(value) ? value : { value } };
129
- }
130
- el.removeContent();
131
- el.content = obj;
132
- },
133
- $propsCollection: async (param, el, state) => {
134
- const { children, childrenAs } = el.props || {};
135
- if (!param || children || childrenAs) return;
136
- param = processCollectionParam(param, state);
137
- if (!param) return;
138
- const { __ref: ref } = el;
139
- if (ref.__propsCollectionCache) {
140
- const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache);
141
- if (equals) {
142
- ref.__noCollectionDifference = true;
143
- return;
144
- }
145
- ref.__propsCollectionCache = deepClone(param);
146
- delete ref.__noCollectionDifference;
147
- } else {
148
- ref.__propsCollectionCache = deepClone(param);
149
- }
150
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
151
- for (const key in param) {
152
- const value = param[key];
153
- if (value) obj[key] = { props: isObjectLike(value) ? value : { value } };
154
- }
155
- el.removeContent();
156
- el.content = obj;
157
21
  }
158
22
  };
159
23
  export {
@@ -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_utils16 = __require("@domql/utils");
65
+ var import_utils14 = __require("@domql/utils");
66
66
 
67
67
  // src/utilImports.js
68
68
  var utilImports_exports = {};
@@ -217,7 +217,7 @@ var Smbls = (() => {
217
217
  __reExport(utilImports_exports, __require("@domql/router"));
218
218
 
219
219
  // src/router.js
220
- var import_utils10 = __require("@domql/utils");
220
+ var import_utils9 = __require("@domql/utils");
221
221
  var import_router4 = __require("@domql/router");
222
222
 
223
223
  // dist/esm/index.js
@@ -247,7 +247,7 @@ var Smbls = (() => {
247
247
  __reExport(esm_exports, __require("@symbo.ls/smbls-utils"));
248
248
 
249
249
  // dist/esm/src/index.js
250
- var import_utils9 = __require("@domql/utils");
250
+ var import_utils8 = __require("@domql/utils");
251
251
 
252
252
  // dist/esm/src/utilImports.js
253
253
  var utilImports_exports2 = {};
@@ -496,16 +496,6 @@ var Smbls = (() => {
496
496
 
497
497
  // dist/esm/src/define.js
498
498
  var import_helmet = __require("@symbo.ls/helmet");
499
- var import_utils5 = __require("@domql/utils");
500
- var processCollectionParam = (param, state) => {
501
- if ((0, import_utils5.isString)(param)) {
502
- if (param === "state") return state.parse();
503
- return (0, import_utils5.getChildStateInKey)(param, state);
504
- }
505
- if ((0, import_utils5.isState)(param)) return param.parse();
506
- if ((0, import_utils5.isNot)(param)("array", "object")) return null;
507
- return (0, import_utils5.deepClone)(param);
508
- };
509
499
  var defaultDefine = {
510
500
  routes: (param) => param,
511
501
  metadata: (param, el, state) => {
@@ -525,121 +515,6 @@ var Smbls = (() => {
525
515
  window.requestAnimationFrame(set5);
526
516
  } else await set5();
527
517
  return obj;
528
- },
529
- $collection: async (param, el, state) => {
530
- const { __ref: ref } = el;
531
- const {
532
- children: childrenProps,
533
- childrenAs,
534
- childExtends
535
- } = el.props || {};
536
- const children = childrenProps && await (0, import_utils5.exec)(childrenProps, el, state);
537
- const childrenAsDefault = childrenAs || "props";
538
- if (children) {
539
- if ((0, import_utils5.isObject)(children)) {
540
- param = (0, import_utils5.deepClone)(children);
541
- param = Object.keys(param).map((v) => {
542
- const val = param[v];
543
- return (0, import_utils5.isObjectLike)(val) ? { ...val, extends: v } : { extends: v, value: val };
544
- });
545
- } else if ((0, import_utils5.isArray)(children)) {
546
- param = (0, import_utils5.deepClone)(children);
547
- if (childrenAsDefault && childrenAsDefault !== "element") {
548
- param = param.map((v) => ({
549
- ...childExtends && { extends: childExtends },
550
- [childrenAsDefault]: (0, import_utils5.isObjectLike)(v) ? v : childrenAsDefault === "state" ? { value: v } : { text: v }
551
- }));
552
- }
553
- } else if ((0, import_utils5.isString)(children) || (0, import_utils5.isNumber)(children)) {
554
- el.removeContent();
555
- el.content = { text: param };
556
- return;
557
- }
558
- }
559
- if (!param) return;
560
- param = processCollectionParam(param, state);
561
- if (!param) return;
562
- if (ref.__collectionCache) {
563
- const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache);
564
- if (equals) {
565
- ref.__noCollectionDifference = true;
566
- return;
567
- }
568
- ref.__collectionCache = (0, import_utils5.deepClone)(param);
569
- delete ref.__noCollectionDifference;
570
- } else {
571
- ref.__collectionCache = (0, import_utils5.deepClone)(param);
572
- }
573
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
574
- for (const key in param) {
575
- const value = param[key];
576
- if (value) obj[key] = (0, import_utils5.isObjectLike)(value) ? value : { value };
577
- }
578
- el.removeContent();
579
- el.content = obj;
580
- },
581
- $setCollection: async (param, el, state) => {
582
- if (!param) return;
583
- param = processCollectionParam(param, state);
584
- if (!param) return;
585
- const data = ((0, import_utils5.isArray)(param) ? param : (0, import_utils5.isObject)(param) ? Object.values(param) : []).map((item) => !(0, import_utils5.isObjectLike)(item) ? { value: item } : item);
586
- if (data.length) {
587
- const t = setTimeout(() => {
588
- el.set({ tag: "fragment", ...data }, { preventDefineUpdate: "$setCollection" });
589
- clearTimeout(t);
590
- });
591
- }
592
- return data;
593
- },
594
- $stateCollection: async (param, el, state) => {
595
- const { children, childrenAs } = el.props || {};
596
- if (!param || children || childrenAs) return;
597
- param = processCollectionParam(param, state);
598
- if (!param) return;
599
- const { __ref: ref } = el;
600
- if (ref.__stateCollectionCache) {
601
- const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache);
602
- if (equals) {
603
- ref.__noCollectionDifference = true;
604
- return;
605
- }
606
- ref.__stateCollectionCache = (0, import_utils5.deepClone)(param);
607
- delete ref.__noCollectionDifference;
608
- } else {
609
- ref.__stateCollectionCache = (0, import_utils5.deepClone)(param);
610
- }
611
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
612
- for (const key in param) {
613
- const value = param[key];
614
- if (value) obj[key] = { state: (0, import_utils5.isObjectLike)(value) ? value : { value } };
615
- }
616
- el.removeContent();
617
- el.content = obj;
618
- },
619
- $propsCollection: async (param, el, state) => {
620
- const { children, childrenAs } = el.props || {};
621
- if (!param || children || childrenAs) return;
622
- param = processCollectionParam(param, state);
623
- if (!param) return;
624
- const { __ref: ref } = el;
625
- if (ref.__propsCollectionCache) {
626
- const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache);
627
- if (equals) {
628
- ref.__noCollectionDifference = true;
629
- return;
630
- }
631
- ref.__propsCollectionCache = (0, import_utils5.deepClone)(param);
632
- delete ref.__noCollectionDifference;
633
- } else {
634
- ref.__propsCollectionCache = (0, import_utils5.deepClone)(param);
635
- }
636
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
637
- for (const key in param) {
638
- const value = param[key];
639
- if (value) obj[key] = { props: (0, import_utils5.isObjectLike)(value) ? value : { value } };
640
- }
641
- el.removeContent();
642
- el.content = obj;
643
518
  }
644
519
  };
645
520
 
@@ -687,21 +562,21 @@ var Smbls = (() => {
687
562
  var import_domql = __toESM(__require("domql"));
688
563
  var uikit2 = __toESM(__require("@symbo.ls/uikit"));
689
564
  var import_css_in_props = __require("css-in-props");
690
- var import_utils8 = __require("@domql/utils");
565
+ var import_utils7 = __require("@domql/utils");
691
566
  var import_element = __require("@domql/element");
692
567
 
693
568
  // dist/esm/src/syncExtend.js
694
- var import_utils6 = __require("@domql/utils");
569
+ var import_utils5 = __require("@domql/utils");
695
570
  var import_sync = __require("@symbo.ls/sync");
696
571
  var initializeExtend = (app, ctx) => {
697
- return (0, import_utils6.isObjectLike)(app.extends) ? app.extends : [];
572
+ return (0, import_utils5.isObjectLike)(app.extends) ? app.extends : [];
698
573
  };
699
574
  var initializeSync = (app, ctx) => {
700
575
  const { editor } = ctx;
701
576
  if (!editor) return;
702
- const liveSync = (0, import_utils6.isUndefined)(editor.liveSync) ? (0, import_utils6.isDevelopment)() : editor.liveSync;
577
+ const liveSync = (0, import_utils5.isUndefined)(editor.liveSync) ? (0, import_utils5.isDevelopment)() : editor.liveSync;
703
578
  if (liveSync) {
704
- if ((0, import_utils6.isArray)(app.extends)) app.extends.push(import_sync.SyncComponent);
579
+ if ((0, import_utils5.isArray)(app.extends)) app.extends.push(import_sync.SyncComponent);
705
580
  else if (app.extends) {
706
581
  app.extends = [app.extends, import_sync.SyncComponent];
707
582
  } else {
@@ -712,9 +587,9 @@ var Smbls = (() => {
712
587
  var initializeNotifications = (app, ctx) => {
713
588
  const { editor } = ctx;
714
589
  if (!editor) return;
715
- const verbose = (0, import_utils6.isUndefined)(editor.verbose) ? (0, import_utils6.isDevelopment)() || ctx.verbose : editor.verbose;
590
+ const verbose = (0, import_utils5.isUndefined)(editor.verbose) ? (0, import_utils5.isDevelopment)() || ctx.verbose : editor.verbose;
716
591
  if (verbose) {
717
- if ((0, import_utils6.isArray)(app.extends)) app.extends.push(import_sync.Notifications);
592
+ if ((0, import_utils5.isArray)(app.extends)) app.extends.push(import_sync.Notifications);
718
593
  else if (app.extends) {
719
594
  app.extends = [app.extends, import_sync.Notifications];
720
595
  } else {
@@ -724,7 +599,7 @@ var Smbls = (() => {
724
599
  };
725
600
 
726
601
  // dist/esm/src/prepare.js
727
- var import_utils7 = __require("@domql/utils");
602
+ var import_utils6 = __require("@domql/utils");
728
603
  var import_initEmotion = __require("@symbo.ls/emotion/initEmotion.js");
729
604
  var uikit = __toESM(__require("@symbo.ls/uikit"));
730
605
  var routerUtils = __toESM(__require("@domql/router"));
@@ -741,7 +616,7 @@ var Smbls = (() => {
741
616
  const newObj = {};
742
617
  for (const key in uikit) {
743
618
  if (Object.prototype.hasOwnProperty.call(uikit, key)) {
744
- if ((0, import_utils7.matchesComponentNaming)(key)) {
619
+ if ((0, import_utils6.matchesComponentNaming)(key)) {
745
620
  newObj[`smbls.${key}`] = uikit[key];
746
621
  } else {
747
622
  newObj[key] = uikit[key];
@@ -796,7 +671,7 @@ var Smbls = (() => {
796
671
  if (dependenciesOnDemand && dependenciesOnDemand[dependency]) {
797
672
  continue;
798
673
  }
799
- const random = (0, import_utils7.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
674
+ const random = (0, import_utils6.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
800
675
  const url = (0, import_smbls_utils.getCDNUrl)(dependency, version3, cdnProvider) + random;
801
676
  try {
802
677
  if (cachedDeps[dependency]) return;
@@ -836,7 +711,7 @@ var Smbls = (() => {
836
711
  const documentOpts = ctx2.document || document;
837
712
  const windowOpts2 = ctx2.window || window;
838
713
  if (!windowOpts2.packages[key]) {
839
- const random = (0, import_utils7.isDevelopment)() ? `?${Math.random()}` : "";
714
+ const random = (0, import_utils6.isDevelopment)() ? `?${Math.random()}` : "";
840
715
  if (dependenciesOnDemand && dependenciesOnDemand[key]) {
841
716
  const version3 = dependenciesOnDemand[key];
842
717
  const url = (0, import_smbls_utils.getCDNUrl)(key, version3, provider) + random;
@@ -878,7 +753,7 @@ var Smbls = (() => {
878
753
  return await windowOpts2.require(key, provider);
879
754
  };
880
755
  if (windowOpts.packages) {
881
- windowOpts.packages = (0, import_utils7.merge)(windowOpts.packages, packages);
756
+ windowOpts.packages = (0, import_utils6.merge)(windowOpts.packages, packages);
882
757
  } else {
883
758
  windowOpts.packages = packages;
884
759
  }
@@ -898,13 +773,13 @@ var Smbls = (() => {
898
773
  var prepareState = (app, context) => {
899
774
  const state = {};
900
775
  if (context.state) utilImports_exports2.deepMerge(state, context.state);
901
- if (app && app.state) (0, import_utils7.deepMerge)(state, app.state);
776
+ if (app && app.state) (0, import_utils6.deepMerge)(state, app.state);
902
777
  state.isRootState = true;
903
- return (0, import_utils7.deepClone)(state);
778
+ return (0, import_utils6.deepClone)(state);
904
779
  };
905
780
  var preparePages = (app, context) => {
906
- if ((0, import_utils7.isObject)(app.routes) && (0, import_utils7.isObject)(context.pages)) {
907
- (0, import_utils7.merge)(app.routes, context.pages);
781
+ if ((0, import_utils6.isObject)(app.routes) && (0, import_utils6.isObject)(context.pages)) {
782
+ (0, import_utils6.merge)(app.routes, context.pages);
908
783
  }
909
784
  const pages = app.routes || context.pages || {};
910
785
  for (const v in pages) {
@@ -921,16 +796,16 @@ var Smbls = (() => {
921
796
  const sharedLib = sharedLibraries[i];
922
797
  if (context.type === "template") {
923
798
  overwriteShallow(context.designSystem, sharedLib.designSystem);
924
- (0, import_utils7.deepMerge)(context, sharedLib, ["designSystem"], 1);
799
+ (0, import_utils6.deepMerge)(context, sharedLib, ["designSystem"], 1);
925
800
  } else {
926
- (0, import_utils7.deepMerge)(context, sharedLib, [], 1);
801
+ (0, import_utils6.deepMerge)(context, sharedLib, [], 1);
927
802
  }
928
803
  }
929
804
  };
930
805
 
931
806
  // dist/esm/src/createDomql.js
932
807
  var prepareContext = async (app, context = {}) => {
933
- const key = context.key = context.key || ((0, import_utils8.isString)(app) ? app : "smblsapp");
808
+ const key = context.key = context.key || ((0, import_utils7.isString)(app) ? app : "smblsapp");
934
809
  context.define = context.define || defaultDefine;
935
810
  context.cssPropsRegistry = import_css_in_props.CSS_PROPS_REGISTRY;
936
811
  context.window = prepareWindow(context);
@@ -960,14 +835,14 @@ var Smbls = (() => {
960
835
  return context;
961
836
  };
962
837
  var createDomqlElement = async (app, ctx) => {
963
- if (!(0, import_utils8.isObject)(ctx)) ctx = {};
964
- if ((0, import_utils8.isNode)(app)) {
838
+ if (!(0, import_utils7.isObject)(ctx)) ctx = {};
839
+ if ((0, import_utils7.isNode)(app)) {
965
840
  app = {};
966
841
  ctx.parent = app;
967
- } else if ((0, import_utils8.isString)(app)) {
842
+ } else if ((0, import_utils7.isString)(app)) {
968
843
  app = {};
969
844
  ctx.key = app;
970
- } else if (!(0, import_utils8.isObject)(app)) {
845
+ } else if (!(0, import_utils7.isObject)(app)) {
971
846
  app = {};
972
847
  }
973
848
  await prepareContext(app, ctx);
@@ -1000,9 +875,9 @@ var Smbls = (() => {
1000
875
  };
1001
876
 
1002
877
  // dist/esm/src/index.js
1003
- var mergeWithLocalFile3 = (options, optionsExternalFile) => (0, import_utils9.deepMerge)(
878
+ var mergeWithLocalFile3 = (options, optionsExternalFile) => (0, import_utils8.deepMerge)(
1004
879
  options,
1005
- (0, import_utils9.isObject)(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON2 || {}
880
+ (0, import_utils8.isObject)(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON2 || {}
1006
881
  );
1007
882
  var create = (App, options = options_default, optionsExternalFile) => {
1008
883
  const redefinedOptions = {
@@ -1051,10 +926,10 @@ var Smbls = (() => {
1051
926
  var createSkeleton = (App = {}, options = options_default, optionsExternalFile) => {
1052
927
  return create(
1053
928
  {
1054
- deps: { isUndefined: import_utils9.isUndefined },
929
+ deps: { isUndefined: import_utils8.isUndefined },
1055
930
  ...App
1056
931
  },
1057
- (0, import_utils9.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
932
+ (0, import_utils8.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
1058
933
  optionsExternalFile
1059
934
  );
1060
935
  };
@@ -1068,15 +943,15 @@ var Smbls = (() => {
1068
943
  var initRouter2 = (element, context) => {
1069
944
  if (context.router === false) return;
1070
945
  else if (context.router === true) context.router = DEFAULT_ROUTING_OPTIONS2;
1071
- else context.router = (0, import_utils10.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS2);
946
+ else context.router = (0, import_utils9.merge)(context.router || {}, DEFAULT_ROUTING_OPTIONS2);
1072
947
  const routerOptions = context.router;
1073
948
  const onRouterRenderDefault = async (el, s) => {
1074
- if (!import_utils10.window.location) return;
1075
- const { pathname, search, hash } = import_utils10.window.location;
949
+ if (!import_utils9.window.location) return;
950
+ const { pathname, search, hash } = import_utils9.window.location;
1076
951
  const url = pathname + search + hash;
1077
952
  if (el.routes) await (0, import_router4.router)(url, el, {}, { initialRender: true });
1078
953
  };
1079
- const hasRenderRouter = element.on && !(0, import_utils10.isUndefined)(element.on.renderRouter) || !(0, import_utils10.isUndefined)(element.onRenderRouter);
954
+ const hasRenderRouter = element.on && !(0, import_utils9.isUndefined)(element.on.renderRouter) || !(0, import_utils9.isUndefined)(element.onRenderRouter);
1080
955
  if (routerOptions && routerOptions.initRouter && !hasRenderRouter) {
1081
956
  if (element.on) {
1082
957
  element.on.renderRouter = onRouterRenderDefault;
@@ -1096,8 +971,8 @@ var Smbls = (() => {
1096
971
  const routerOptions = context.router || DEFAULT_ROUTING_OPTIONS2;
1097
972
  if (!routerOptions.popState) return;
1098
973
  const router = context.utils && context.utils.router ? context.utils.router : import_router4.router;
1099
- import_utils10.window.onpopstate = async (e) => {
1100
- const { pathname, search, hash } = import_utils10.window.location;
974
+ import_utils9.window.onpopstate = async (e) => {
975
+ const { pathname, search, hash } = import_utils9.window.location;
1101
976
  const url = pathname + search + hash;
1102
977
  await element.call(
1103
978
  "router",
@@ -1111,7 +986,7 @@ var Smbls = (() => {
1111
986
  var injectRouterInLinkComponent2 = (context, routerOptions) => {
1112
987
  const { components } = context;
1113
988
  if (routerOptions && routerOptions.injectRouterInLinkComponent) {
1114
- return (0, import_utils10.deepMerge)(
989
+ return (0, import_utils9.deepMerge)(
1115
990
  components["Link"] || components["smbls.Link"],
1116
991
  components["RouterLink"] || components["smbls.RouterLink"]
1117
992
  );
@@ -1119,7 +994,7 @@ var Smbls = (() => {
1119
994
  };
1120
995
 
1121
996
  // src/fetchOnCreate.js
1122
- var import_utils11 = __require("@domql/utils");
997
+ var import_utils10 = __require("@domql/utils");
1123
998
  var import_fetch2 = __require("@symbo.ls/fetch");
1124
999
  var fetchSync2 = async (key, options) => {
1125
1000
  if (key && options.editor) {
@@ -1136,10 +1011,10 @@ var Smbls = (() => {
1136
1011
  if (options.editor.async) {
1137
1012
  (0, import_fetch2.fetchProjectAsync)(key, options, callback || ((data) => {
1138
1013
  const designSystem = data.designSystem;
1139
- if ((0, import_utils11.isObject)(designSystem)) {
1014
+ if ((0, import_utils10.isObject)(designSystem)) {
1140
1015
  options.utils.init(designSystem);
1141
1016
  }
1142
- if ((0, import_utils11.isObject)(data.state)) {
1017
+ if ((0, import_utils10.isObject)(data.state)) {
1143
1018
  app.state.set(data.state);
1144
1019
  }
1145
1020
  }));
@@ -1152,16 +1027,6 @@ var Smbls = (() => {
1152
1027
 
1153
1028
  // src/define.js
1154
1029
  var import_helmet2 = __require("@symbo.ls/helmet");
1155
- var import_utils12 = __require("@domql/utils");
1156
- var processCollectionParam2 = (param, state) => {
1157
- if ((0, import_utils12.isString)(param)) {
1158
- if (param === "state") return state.parse();
1159
- return (0, import_utils12.getChildStateInKey)(param, state);
1160
- }
1161
- if ((0, import_utils12.isState)(param)) return param.parse();
1162
- if ((0, import_utils12.isNot)(param)("array", "object")) return null;
1163
- return (0, import_utils12.deepClone)(param);
1164
- };
1165
1030
  var defaultDefine2 = {
1166
1031
  routes: (param) => param,
1167
1032
  metadata: (param, el, state) => {
@@ -1181,121 +1046,6 @@ var Smbls = (() => {
1181
1046
  window.requestAnimationFrame(set5);
1182
1047
  } else await set5();
1183
1048
  return obj;
1184
- },
1185
- $collection: async (param, el, state) => {
1186
- const { __ref: ref } = el;
1187
- const {
1188
- children: childrenProps,
1189
- childrenAs,
1190
- childExtends
1191
- } = el.props || {};
1192
- const children = childrenProps && await (0, import_utils12.exec)(childrenProps, el, state);
1193
- const childrenAsDefault = childrenAs || "props";
1194
- if (children) {
1195
- if ((0, import_utils12.isObject)(children)) {
1196
- param = (0, import_utils12.deepClone)(children);
1197
- param = Object.keys(param).map((v) => {
1198
- const val = param[v];
1199
- return (0, import_utils12.isObjectLike)(val) ? { ...val, extends: v } : { extends: v, value: val };
1200
- });
1201
- } else if ((0, import_utils12.isArray)(children)) {
1202
- param = (0, import_utils12.deepClone)(children);
1203
- if (childrenAsDefault && childrenAsDefault !== "element") {
1204
- param = param.map((v) => ({
1205
- ...childExtends && { extends: childExtends },
1206
- [childrenAsDefault]: (0, import_utils12.isObjectLike)(v) ? v : childrenAsDefault === "state" ? { value: v } : { text: v }
1207
- }));
1208
- }
1209
- } else if ((0, import_utils12.isString)(children) || (0, import_utils12.isNumber)(children)) {
1210
- el.removeContent();
1211
- el.content = { text: param };
1212
- return;
1213
- }
1214
- }
1215
- if (!param) return;
1216
- param = processCollectionParam2(param, state);
1217
- if (!param) return;
1218
- if (ref.__collectionCache) {
1219
- const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache);
1220
- if (equals) {
1221
- ref.__noCollectionDifference = true;
1222
- return;
1223
- }
1224
- ref.__collectionCache = (0, import_utils12.deepClone)(param);
1225
- delete ref.__noCollectionDifference;
1226
- } else {
1227
- ref.__collectionCache = (0, import_utils12.deepClone)(param);
1228
- }
1229
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
1230
- for (const key in param) {
1231
- const value = param[key];
1232
- if (value) obj[key] = (0, import_utils12.isObjectLike)(value) ? value : { value };
1233
- }
1234
- el.removeContent();
1235
- el.content = obj;
1236
- },
1237
- $setCollection: async (param, el, state) => {
1238
- if (!param) return;
1239
- param = processCollectionParam2(param, state);
1240
- if (!param) return;
1241
- const data = ((0, import_utils12.isArray)(param) ? param : (0, import_utils12.isObject)(param) ? Object.values(param) : []).map((item) => !(0, import_utils12.isObjectLike)(item) ? { value: item } : item);
1242
- if (data.length) {
1243
- const t = setTimeout(() => {
1244
- el.set({ tag: "fragment", ...data }, { preventDefineUpdate: "$setCollection" });
1245
- clearTimeout(t);
1246
- });
1247
- }
1248
- return data;
1249
- },
1250
- $stateCollection: async (param, el, state) => {
1251
- const { children, childrenAs } = el.props || {};
1252
- if (!param || children || childrenAs) return;
1253
- param = processCollectionParam2(param, state);
1254
- if (!param) return;
1255
- const { __ref: ref } = el;
1256
- if (ref.__stateCollectionCache) {
1257
- const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache);
1258
- if (equals) {
1259
- ref.__noCollectionDifference = true;
1260
- return;
1261
- }
1262
- ref.__stateCollectionCache = (0, import_utils12.deepClone)(param);
1263
- delete ref.__noCollectionDifference;
1264
- } else {
1265
- ref.__stateCollectionCache = (0, import_utils12.deepClone)(param);
1266
- }
1267
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
1268
- for (const key in param) {
1269
- const value = param[key];
1270
- if (value) obj[key] = { state: (0, import_utils12.isObjectLike)(value) ? value : { value } };
1271
- }
1272
- el.removeContent();
1273
- el.content = obj;
1274
- },
1275
- $propsCollection: async (param, el, state) => {
1276
- const { children, childrenAs } = el.props || {};
1277
- if (!param || children || childrenAs) return;
1278
- param = processCollectionParam2(param, state);
1279
- if (!param) return;
1280
- const { __ref: ref } = el;
1281
- if (ref.__propsCollectionCache) {
1282
- const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache);
1283
- if (equals) {
1284
- ref.__noCollectionDifference = true;
1285
- return;
1286
- }
1287
- ref.__propsCollectionCache = (0, import_utils12.deepClone)(param);
1288
- delete ref.__noCollectionDifference;
1289
- } else {
1290
- ref.__propsCollectionCache = (0, import_utils12.deepClone)(param);
1291
- }
1292
- const obj = { tag: "fragment", ignoreChildProps: true, childProps: el.props && el.props.childProps };
1293
- for (const key in param) {
1294
- const value = param[key];
1295
- if (value) obj[key] = { props: (0, import_utils12.isObjectLike)(value) ? value : { value } };
1296
- }
1297
- el.removeContent();
1298
- el.content = obj;
1299
1049
  }
1300
1050
  };
1301
1051
 
@@ -1343,21 +1093,21 @@ var Smbls = (() => {
1343
1093
  var import_domql2 = __toESM(__require("domql"), 1);
1344
1094
  var uikit4 = __toESM(__require("@symbo.ls/uikit"), 1);
1345
1095
  var import_css_in_props2 = __require("css-in-props");
1346
- var import_utils15 = __require("@domql/utils");
1096
+ var import_utils13 = __require("@domql/utils");
1347
1097
  var import_element2 = __require("@domql/element");
1348
1098
 
1349
1099
  // src/syncExtend.js
1350
- var import_utils13 = __require("@domql/utils");
1100
+ var import_utils11 = __require("@domql/utils");
1351
1101
  var import_sync2 = __require("@symbo.ls/sync");
1352
1102
  var initializeExtend2 = (app, ctx) => {
1353
- return (0, import_utils13.isObjectLike)(app.extends) ? app.extends : [];
1103
+ return (0, import_utils11.isObjectLike)(app.extends) ? app.extends : [];
1354
1104
  };
1355
1105
  var initializeSync2 = (app, ctx) => {
1356
1106
  const { editor } = ctx;
1357
1107
  if (!editor) return;
1358
- const liveSync = (0, import_utils13.isUndefined)(editor.liveSync) ? (0, import_utils13.isDevelopment)() : editor.liveSync;
1108
+ const liveSync = (0, import_utils11.isUndefined)(editor.liveSync) ? (0, import_utils11.isDevelopment)() : editor.liveSync;
1359
1109
  if (liveSync) {
1360
- if ((0, import_utils13.isArray)(app.extends)) app.extends.push(import_sync2.SyncComponent);
1110
+ if ((0, import_utils11.isArray)(app.extends)) app.extends.push(import_sync2.SyncComponent);
1361
1111
  else if (app.extends) {
1362
1112
  app.extends = [app.extends, import_sync2.SyncComponent];
1363
1113
  } else {
@@ -1368,9 +1118,9 @@ var Smbls = (() => {
1368
1118
  var initializeNotifications2 = (app, ctx) => {
1369
1119
  const { editor } = ctx;
1370
1120
  if (!editor) return;
1371
- const verbose = (0, import_utils13.isUndefined)(editor.verbose) ? (0, import_utils13.isDevelopment)() || ctx.verbose : editor.verbose;
1121
+ const verbose = (0, import_utils11.isUndefined)(editor.verbose) ? (0, import_utils11.isDevelopment)() || ctx.verbose : editor.verbose;
1372
1122
  if (verbose) {
1373
- if ((0, import_utils13.isArray)(app.extends)) app.extends.push(import_sync2.Notifications);
1123
+ if ((0, import_utils11.isArray)(app.extends)) app.extends.push(import_sync2.Notifications);
1374
1124
  else if (app.extends) {
1375
1125
  app.extends = [app.extends, import_sync2.Notifications];
1376
1126
  } else {
@@ -1380,7 +1130,7 @@ var Smbls = (() => {
1380
1130
  };
1381
1131
 
1382
1132
  // src/prepare.js
1383
- var import_utils14 = __require("@domql/utils");
1133
+ var import_utils12 = __require("@domql/utils");
1384
1134
  var import_initEmotion2 = __require("@symbo.ls/emotion/initEmotion.js");
1385
1135
  var uikit3 = __toESM(__require("@symbo.ls/uikit"), 1);
1386
1136
  var routerUtils2 = __toESM(__require("@domql/router"), 1);
@@ -1397,7 +1147,7 @@ var Smbls = (() => {
1397
1147
  const newObj = {};
1398
1148
  for (const key in uikit3) {
1399
1149
  if (Object.prototype.hasOwnProperty.call(uikit3, key)) {
1400
- if ((0, import_utils14.matchesComponentNaming)(key)) {
1150
+ if ((0, import_utils12.matchesComponentNaming)(key)) {
1401
1151
  newObj[`smbls.${key}`] = uikit3[key];
1402
1152
  } else {
1403
1153
  newObj[key] = uikit3[key];
@@ -1452,7 +1202,7 @@ var Smbls = (() => {
1452
1202
  if (dependenciesOnDemand && dependenciesOnDemand[dependency]) {
1453
1203
  continue;
1454
1204
  }
1455
- const random = (0, import_utils14.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
1205
+ const random = (0, import_utils12.isDevelopment)() && preventCaching ? `?${Math.random()}` : "";
1456
1206
  const url = (0, import_smbls_utils2.getCDNUrl)(dependency, version3, cdnProvider) + random;
1457
1207
  try {
1458
1208
  if (cachedDeps2[dependency]) return;
@@ -1492,7 +1242,7 @@ var Smbls = (() => {
1492
1242
  const documentOpts = ctx2.document || document;
1493
1243
  const windowOpts2 = ctx2.window || window;
1494
1244
  if (!windowOpts2.packages[key]) {
1495
- const random = (0, import_utils14.isDevelopment)() ? `?${Math.random()}` : "";
1245
+ const random = (0, import_utils12.isDevelopment)() ? `?${Math.random()}` : "";
1496
1246
  if (dependenciesOnDemand && dependenciesOnDemand[key]) {
1497
1247
  const version3 = dependenciesOnDemand[key];
1498
1248
  const url = (0, import_smbls_utils2.getCDNUrl)(key, version3, provider) + random;
@@ -1534,7 +1284,7 @@ var Smbls = (() => {
1534
1284
  return await windowOpts2.require(key, provider);
1535
1285
  };
1536
1286
  if (windowOpts.packages) {
1537
- windowOpts.packages = (0, import_utils14.merge)(windowOpts.packages, packages);
1287
+ windowOpts.packages = (0, import_utils12.merge)(windowOpts.packages, packages);
1538
1288
  } else {
1539
1289
  windowOpts.packages = packages;
1540
1290
  }
@@ -1554,13 +1304,13 @@ var Smbls = (() => {
1554
1304
  var prepareState2 = (app, context) => {
1555
1305
  const state = {};
1556
1306
  if (context.state) utilImports_exports.deepMerge(state, context.state);
1557
- if (app && app.state) (0, import_utils14.deepMerge)(state, app.state);
1307
+ if (app && app.state) (0, import_utils12.deepMerge)(state, app.state);
1558
1308
  state.isRootState = true;
1559
- return (0, import_utils14.deepClone)(state);
1309
+ return (0, import_utils12.deepClone)(state);
1560
1310
  };
1561
1311
  var preparePages2 = (app, context) => {
1562
- if ((0, import_utils14.isObject)(app.routes) && (0, import_utils14.isObject)(context.pages)) {
1563
- (0, import_utils14.merge)(app.routes, context.pages);
1312
+ if ((0, import_utils12.isObject)(app.routes) && (0, import_utils12.isObject)(context.pages)) {
1313
+ (0, import_utils12.merge)(app.routes, context.pages);
1564
1314
  }
1565
1315
  const pages = app.routes || context.pages || {};
1566
1316
  for (const v in pages) {
@@ -1577,16 +1327,16 @@ var Smbls = (() => {
1577
1327
  const sharedLib = sharedLibraries[i];
1578
1328
  if (context.type === "template") {
1579
1329
  overwriteShallow(context.designSystem, sharedLib.designSystem);
1580
- (0, import_utils14.deepMerge)(context, sharedLib, ["designSystem"], 1);
1330
+ (0, import_utils12.deepMerge)(context, sharedLib, ["designSystem"], 1);
1581
1331
  } else {
1582
- (0, import_utils14.deepMerge)(context, sharedLib, [], 1);
1332
+ (0, import_utils12.deepMerge)(context, sharedLib, [], 1);
1583
1333
  }
1584
1334
  }
1585
1335
  };
1586
1336
 
1587
1337
  // src/createDomql.js
1588
1338
  var prepareContext2 = async (app, context = {}) => {
1589
- const key = context.key = context.key || ((0, import_utils15.isString)(app) ? app : "smblsapp");
1339
+ const key = context.key = context.key || ((0, import_utils13.isString)(app) ? app : "smblsapp");
1590
1340
  context.define = context.define || defaultDefine2;
1591
1341
  context.cssPropsRegistry = import_css_in_props2.CSS_PROPS_REGISTRY;
1592
1342
  context.window = prepareWindow2(context);
@@ -1616,14 +1366,14 @@ var Smbls = (() => {
1616
1366
  return context;
1617
1367
  };
1618
1368
  var createDomqlElement2 = async (app, ctx) => {
1619
- if (!(0, import_utils15.isObject)(ctx)) ctx = {};
1620
- if ((0, import_utils15.isNode)(app)) {
1369
+ if (!(0, import_utils13.isObject)(ctx)) ctx = {};
1370
+ if ((0, import_utils13.isNode)(app)) {
1621
1371
  app = {};
1622
1372
  ctx.parent = app;
1623
- } else if ((0, import_utils15.isString)(app)) {
1373
+ } else if ((0, import_utils13.isString)(app)) {
1624
1374
  app = {};
1625
1375
  ctx.key = app;
1626
- } else if (!(0, import_utils15.isObject)(app)) {
1376
+ } else if (!(0, import_utils13.isObject)(app)) {
1627
1377
  app = {};
1628
1378
  }
1629
1379
  await prepareContext2(app, ctx);
@@ -1656,9 +1406,9 @@ var Smbls = (() => {
1656
1406
  };
1657
1407
 
1658
1408
  // src/index.js
1659
- var mergeWithLocalFile4 = (options, optionsExternalFile) => (0, import_utils16.deepMerge)(
1409
+ var mergeWithLocalFile4 = (options, optionsExternalFile) => (0, import_utils14.deepMerge)(
1660
1410
  options,
1661
- (0, import_utils16.isObject)(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
1411
+ (0, import_utils14.isObject)(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
1662
1412
  );
1663
1413
  var create2 = (App, options = options_default2, optionsExternalFile) => {
1664
1414
  const redefinedOptions = {
@@ -1707,10 +1457,10 @@ var Smbls = (() => {
1707
1457
  var createSkeleton2 = (App = {}, options = options_default2, optionsExternalFile) => {
1708
1458
  return create2(
1709
1459
  {
1710
- deps: { isUndefined: import_utils16.isUndefined },
1460
+ deps: { isUndefined: import_utils14.isUndefined },
1711
1461
  ...App
1712
1462
  },
1713
- (0, import_utils16.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
1463
+ (0, import_utils14.deepMerge)({ domqlOptions: { onlyResolveExtends: true } }, options),
1714
1464
  optionsExternalFile
1715
1465
  );
1716
1466
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smbls",
3
- "version": "3.6.3",
3
+ "version": "3.6.4",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/symbo-ls/smbls",
6
6
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
@@ -28,21 +28,21 @@
28
28
  "src"
29
29
  ],
30
30
  "dependencies": {
31
- "@symbo.ls/emotion": "^3.6.3",
32
- "@symbo.ls/helmet": "^3.6.3",
33
- "@domql/report": "^3.6.3",
34
- "@domql/router": "^3.6.3",
35
- "@domql/utils": "^3.6.3",
36
- "@symbo.ls/cli": "^3.6.3",
37
- "@symbo.ls/default-config": "^3.6.3",
38
- "@symbo.ls/fetch": "^3.6.3",
39
- "@symbo.ls/scratch": "^3.6.3",
40
- "@symbo.ls/sync": "^3.6.3",
41
- "@symbo.ls/uikit": "^3.6.3",
42
- "@symbo.ls/smbls-utils": "^3.6.3",
43
- "attrs-in-props": "^3.6.3",
44
- "css-in-props": "^3.6.3",
45
- "domql": "^3.6.3"
31
+ "@symbo.ls/emotion": "^3.6.4",
32
+ "@symbo.ls/helmet": "^3.6.4",
33
+ "@domql/report": "^3.6.4",
34
+ "@domql/router": "^3.6.4",
35
+ "@domql/utils": "^3.6.4",
36
+ "@symbo.ls/cli": "^3.6.4",
37
+ "@symbo.ls/default-config": "^3.6.4",
38
+ "@symbo.ls/fetch": "^3.6.4",
39
+ "@symbo.ls/scratch": "^3.6.4",
40
+ "@symbo.ls/sync": "^3.6.4",
41
+ "@symbo.ls/uikit": "^3.6.4",
42
+ "@symbo.ls/smbls-utils": "^3.6.4",
43
+ "attrs-in-props": "^3.6.4",
44
+ "css-in-props": "^3.6.4",
45
+ "domql": "^3.6.4"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
package/src/define.js CHANGED
@@ -1,28 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  import { resolveMetadata, applyMetadata } from '@symbo.ls/helmet'
4
- import {
5
- isString,
6
- isNumber,
7
- isNot,
8
- isArray,
9
- isObject,
10
- isObjectLike,
11
- isState,
12
- exec,
13
- deepClone,
14
- getChildStateInKey
15
- } from '@domql/utils'
16
-
17
- const processCollectionParam = (param, state) => {
18
- if (isString(param)) {
19
- if (param === 'state') return state.parse()
20
- return getChildStateInKey(param, state)
21
- }
22
- if (isState(param)) return param.parse()
23
- if (isNot(param)('array', 'object')) return null
24
- return deepClone(param)
25
- }
26
4
 
27
5
  export const defaultDefine = {
28
6
  routes: param => param,
@@ -49,130 +27,5 @@ export const defaultDefine = {
49
27
  } else await set()
50
28
 
51
29
  return obj
52
- },
53
-
54
- $collection: async (param, el, state) => {
55
- const { __ref: ref } = el
56
- const {
57
- children: childrenProps,
58
- childrenAs,
59
- childExtends
60
- } = el.props || {}
61
- const children = childrenProps && (await exec(childrenProps, el, state))
62
- const childrenAsDefault = childrenAs || 'props'
63
-
64
- if (children) {
65
- if (isObject(children)) {
66
- param = deepClone(children)
67
- param = Object.keys(param).map(v => {
68
- const val = param[v]
69
- return isObjectLike(val) ? { ...val, extends: v } : { extends: v, value: val }
70
- })
71
- } else if (isArray(children)) {
72
- param = deepClone(children)
73
- if (childrenAsDefault && childrenAsDefault !== 'element') {
74
- param = param.map(v => ({
75
- ...(childExtends && { extends: childExtends }),
76
- [childrenAsDefault]: isObjectLike(v)
77
- ? v
78
- : childrenAsDefault === 'state'
79
- ? { value: v }
80
- : { text: v }
81
- }))
82
- }
83
- } else if (isString(children) || isNumber(children)) {
84
- el.removeContent()
85
- el.content = { text: param }
86
- return
87
- }
88
- }
89
-
90
- if (!param) return
91
- param = processCollectionParam(param, state)
92
- if (!param) return
93
-
94
- if (ref.__collectionCache) {
95
- const equals = JSON.stringify(param) === JSON.stringify(ref.__collectionCache)
96
- if (equals) { ref.__noCollectionDifference = true; return }
97
- ref.__collectionCache = deepClone(param)
98
- delete ref.__noCollectionDifference
99
- } else {
100
- ref.__collectionCache = deepClone(param)
101
- }
102
-
103
- const obj = { tag: 'fragment', ignoreChildProps: true, childProps: el.props && el.props.childProps }
104
- for (const key in param) {
105
- const value = param[key]
106
- if (value) obj[key] = isObjectLike(value) ? value : { value }
107
- }
108
- el.removeContent()
109
- el.content = obj
110
- },
111
-
112
- $setCollection: async (param, el, state) => {
113
- if (!param) return
114
- param = processCollectionParam(param, state)
115
- if (!param) return
116
-
117
- const data = (isArray(param) ? param : isObject(param) ? Object.values(param) : [])
118
- .map(item => (!isObjectLike(item) ? { value: item } : item))
119
-
120
- if (data.length) {
121
- const t = setTimeout(() => {
122
- el.set({ tag: 'fragment', ...data }, { preventDefineUpdate: '$setCollection' })
123
- clearTimeout(t)
124
- })
125
- }
126
- return data
127
- },
128
-
129
- $stateCollection: async (param, el, state) => {
130
- const { children, childrenAs } = el.props || {}
131
- if (!param || children || childrenAs) return
132
- param = processCollectionParam(param, state)
133
- if (!param) return
134
-
135
- const { __ref: ref } = el
136
- if (ref.__stateCollectionCache) {
137
- const equals = JSON.stringify(param) === JSON.stringify(ref.__stateCollectionCache)
138
- if (equals) { ref.__noCollectionDifference = true; return }
139
- ref.__stateCollectionCache = deepClone(param)
140
- delete ref.__noCollectionDifference
141
- } else {
142
- ref.__stateCollectionCache = deepClone(param)
143
- }
144
-
145
- const obj = { tag: 'fragment', ignoreChildProps: true, childProps: el.props && el.props.childProps }
146
- for (const key in param) {
147
- const value = param[key]
148
- if (value) obj[key] = { state: isObjectLike(value) ? value : { value } }
149
- }
150
- el.removeContent()
151
- el.content = obj
152
- },
153
-
154
- $propsCollection: async (param, el, state) => {
155
- const { children, childrenAs } = el.props || {}
156
- if (!param || children || childrenAs) return
157
- param = processCollectionParam(param, state)
158
- if (!param) return
159
-
160
- const { __ref: ref } = el
161
- if (ref.__propsCollectionCache) {
162
- const equals = JSON.stringify(param) === JSON.stringify(ref.__propsCollectionCache)
163
- if (equals) { ref.__noCollectionDifference = true; return }
164
- ref.__propsCollectionCache = deepClone(param)
165
- delete ref.__noCollectionDifference
166
- } else {
167
- ref.__propsCollectionCache = deepClone(param)
168
- }
169
-
170
- const obj = { tag: 'fragment', ignoreChildProps: true, childProps: el.props && el.props.childProps }
171
- for (const key in param) {
172
- const value = param[key]
173
- if (value) obj[key] = { props: isObjectLike(value) ? value : { value } }
174
- }
175
- el.removeContent()
176
- el.content = obj
177
30
  }
178
31
  }