@symbo.ls/create 2.11.272 → 2.11.276

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.
@@ -407,6 +407,7 @@ var require_string = __commonJS({
407
407
  var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
408
408
  var string_exports = {};
409
409
  __export2(string_exports, {
410
+ lowercaseFirstLetter: () => lowercaseFirstLetter,
410
411
  replaceLiteralsWithObjectFields: () => replaceLiteralsWithObjectFields2,
411
412
  stringIncludesAny: () => stringIncludesAny,
412
413
  trimStringFromSymbols: () => trimStringFromSymbols
@@ -446,6 +447,9 @@ var require_string = __commonJS({
446
447
  }
447
448
  });
448
449
  };
450
+ var lowercaseFirstLetter = (inputString) => {
451
+ return `${inputString.charAt(0).toLowerCase()}${inputString.slice(1)}`;
452
+ };
449
453
  }
450
454
  });
451
455
 
@@ -4973,7 +4977,7 @@ var require_on = __commonJS({
4973
4977
  var applyEventsOnNode = (element, options) => {
4974
4978
  const { node: node2, on: on2 } = element;
4975
4979
  for (const param in on2) {
4976
- if (param === "init" || param === "beforeClassAssign" || param === "render" || param === "renderRouter" || param === "attachNode" || param === "stateInit" || param === "stateCreated" || param === "initStateUpdated" || param === "stateUpdated" || param === "initUpdate" || param === "update")
4980
+ if (param === "init" || param === "beforeClassAssign" || param === "render" || param === "renderRouter" || param === "attachNode" || param === "stateInit" || param === "stateCreated" || param === "initStateUpdate" || param === "stateUpdate" || param === "initUpdate" || param === "update")
4977
4981
  continue;
4978
4982
  const appliedFunction = element.on[param];
4979
4983
  if ((0, import_utils30.isFunction)(appliedFunction)) {
@@ -5471,7 +5475,7 @@ var require_updateState = __commonJS({
5471
5475
  } else if (options.preventInheritAtCurrentState)
5472
5476
  return;
5473
5477
  if (!options.preventInitStateUpdateListener) {
5474
- const initStateUpdateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdated", obj, element, options);
5478
+ const initStateUpdateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdate", obj, element, options);
5475
5479
  if (initStateUpdateReturns === false)
5476
5480
  return element;
5477
5481
  }
@@ -5482,7 +5486,7 @@ var require_updateState = __commonJS({
5482
5486
  updateDependentState(state, obj, options);
5483
5487
  applyElementUpdate(state, obj, options);
5484
5488
  if (!options.preventStateUpdateListener) {
5485
- (0, import_event.triggerEventOnUpdate)("stateUpdated", obj, element, options);
5489
+ (0, import_event.triggerEventOnUpdate)("stateUpdate", obj, element, options);
5486
5490
  }
5487
5491
  return state;
5488
5492
  };
@@ -5490,13 +5494,15 @@ var require_updateState = __commonJS({
5490
5494
  const { overwrite } = options;
5491
5495
  if (!overwrite)
5492
5496
  return;
5493
- const shallow = overwrite === "shallow";
5497
+ const shallow = overwrite === "shallow" || overwrite === "shallow-once";
5494
5498
  const merge22 = overwrite === "merge";
5495
5499
  if (merge22) {
5496
5500
  (0, import_utils30.deepMerge)(state, obj, import_ignore.IGNORE_STATE_PARAMS);
5497
5501
  return;
5498
5502
  }
5499
5503
  const overwriteFunc = shallow ? import_utils30.overwriteShallow : import_utils30.overwriteDeep;
5504
+ if (options.overwrite === "shallow-once")
5505
+ options.overwrite = true;
5500
5506
  overwriteFunc(state, obj, import_ignore.IGNORE_STATE_PARAMS);
5501
5507
  };
5502
5508
  var hoistStateUpdate = (state, obj, options) => {
@@ -5522,13 +5528,13 @@ var require_updateState = __commonJS({
5522
5528
  targetParent.update(changesValue, {
5523
5529
  execStateFunction: false,
5524
5530
  isHoisted: true,
5525
- ...options,
5526
5531
  preventUpdate: options.preventHoistElementUpdate,
5527
- overwrite: !options.replace
5532
+ overwrite: !options.replace,
5533
+ ...options
5528
5534
  });
5529
5535
  const hasNotUpdated = options.preventUpdate !== true || !options.preventHoistElementUpdate;
5530
5536
  if (!options.preventStateUpdateListener && hasNotUpdated) {
5531
- (0, import_event.triggerEventOnUpdate)("stateUpdated", obj, element, options);
5537
+ (0, import_event.triggerEventOnUpdate)("stateUpdate", obj, element, options);
5532
5538
  }
5533
5539
  return true;
5534
5540
  };
@@ -6043,14 +6049,14 @@ var require_append = __commonJS({
6043
6049
  var insertNodeAfter = (node2, siblingNode, parentNode) => {
6044
6050
  const parent = parentNode || siblingNode.parentNode;
6045
6051
  if (siblingNode.nextSibling) {
6046
- parent == null ? void 0 : parent.insertBefore(node2, siblingNode.nextSibling);
6052
+ parent && parent.insertBefore(node2, siblingNode.nextSibling);
6047
6053
  } else {
6048
- siblingNode == null ? void 0 : siblingNode.insertAdjacentElement("afterend", node2);
6054
+ siblingNode && siblingNode.insertAdjacentElement("afterend", node2);
6049
6055
  }
6050
6056
  };
6051
6057
  var insertNodeBefore = (node2, siblingNode, parentNode) => {
6052
- var _a;
6053
- (_a = parentNode || siblingNode.parentNode) == null ? void 0 : _a.insertBefore(node2, siblingNode);
6058
+ const parent = parentNode || siblingNode.parentNode;
6059
+ parent && parent.insertBefore(node2, siblingNode);
6054
6060
  };
6055
6061
  var assignNode = (element, parent, key, attachOptions) => {
6056
6062
  parent[key || element.key] = element;
@@ -7705,7 +7711,19 @@ var require_component = __commonJS({
7705
7711
  var import_utils30 = require_cjs();
7706
7712
  var import_extend = require_extend();
7707
7713
  var ENV2 = "development";
7708
- var DOMQL_BUILTINS = ["extend", "childExtend", "childExtendRecursive", "define", "props", "state", "on", "if", "attr", "key", "tag"];
7714
+ var DOMQL_BUILTINS = [
7715
+ "extend",
7716
+ "childExtend",
7717
+ "childExtendRecursive",
7718
+ "define",
7719
+ "props",
7720
+ "state",
7721
+ "on",
7722
+ "if",
7723
+ "attr",
7724
+ "key",
7725
+ "tag"
7726
+ ];
7709
7727
  var checkIfKeyIsComponent2 = (key) => {
7710
7728
  const isFirstKeyString = (0, import_utils30.isString)(key);
7711
7729
  if (!isFirstKeyString)
@@ -7728,7 +7746,7 @@ var require_component = __commonJS({
7728
7746
  return { ...element, extend };
7729
7747
  };
7730
7748
  var replaceOnKeys = (key) => key.replace(/on\w+/g, (match2) => match2.substring(2));
7731
- var createValidDomqlObjectFromSugar = (el) => {
7749
+ var createValidDomqlObjectFromSugar = (el, parent, key, options) => {
7732
7750
  const newElem = {
7733
7751
  props: {},
7734
7752
  on: {}
@@ -7743,6 +7761,10 @@ var require_component = __commonJS({
7743
7761
  } else if (!isMethod && checkIfKeyIsProperty(k)) {
7744
7762
  if (!DOMQL_BUILTINS.includes(k))
7745
7763
  newElem.props[k] = prop;
7764
+ } else if (checkIfKeyIsComponent2(k)) {
7765
+ newElem[k] = prop;
7766
+ } else {
7767
+ newElem[k] = prop;
7746
7768
  }
7747
7769
  }
7748
7770
  return newElem;
@@ -7751,7 +7773,7 @@ var require_component = __commonJS({
7751
7773
  const { context, tag, extend, props: props4, attr, state, childExtend, childProps, on: on2, if: condition } = element;
7752
7774
  const hasComponentAttrs = extend || childExtend || props4 || state || on2 || condition || attr;
7753
7775
  const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : [key];
7754
- const isExtendKeyComponent = context == null ? void 0 : context.components[extendFromKey];
7776
+ const isExtendKeyComponent = context && context.components[extendFromKey];
7755
7777
  if (element === isExtendKeyComponent)
7756
7778
  return element;
7757
7779
  else if (!hasComponentAttrs || childProps) {
@@ -8031,6 +8053,50 @@ var require_applyParam = __commonJS({
8031
8053
  }
8032
8054
  });
8033
8055
 
8056
+ // ../../../domql/packages/element/dist/cjs/utils/propEvents.js
8057
+ var require_propEvents = __commonJS({
8058
+ "../../../domql/packages/element/dist/cjs/utils/propEvents.js"(exports, module2) {
8059
+ "use strict";
8060
+ var __defProp2 = Object.defineProperty;
8061
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
8062
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
8063
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
8064
+ var __export2 = (target, all) => {
8065
+ for (var name in all)
8066
+ __defProp2(target, name, { get: all[name], enumerable: true });
8067
+ };
8068
+ var __copyProps2 = (to, from2, except, desc) => {
8069
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
8070
+ for (let key of __getOwnPropNames2(from2))
8071
+ if (!__hasOwnProp2.call(to, key) && key !== except)
8072
+ __defProp2(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc2(from2, key)) || desc.enumerable });
8073
+ }
8074
+ return to;
8075
+ };
8076
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
8077
+ var propEvents_exports = {};
8078
+ __export2(propEvents_exports, {
8079
+ propagateEventsFromProps: () => propagateEventsFromProps
8080
+ });
8081
+ module2.exports = __toCommonJS2(propEvents_exports);
8082
+ var import_utils30 = require_cjs();
8083
+ var propagateEventsFromProps = (element) => {
8084
+ const { props: props4, on: on2 } = element;
8085
+ const eventKeysFromProps = Object.keys(props4).filter((key) => key.startsWith("on"));
8086
+ eventKeysFromProps.forEach((v) => {
8087
+ const eventName = (0, import_utils30.lowercaseFirstLetter)(v.split("on")[1]);
8088
+ if (on2[eventName]) {
8089
+ on2[eventName] = (...args) => {
8090
+ on2[eventName](...args);
8091
+ props4[v](...args);
8092
+ };
8093
+ } else
8094
+ on2[eventName] = props4[v];
8095
+ });
8096
+ };
8097
+ }
8098
+ });
8099
+
8034
8100
  // ../../../domql/packages/element/dist/cjs/node.js
8035
8101
  var require_node2 = __commonJS({
8036
8102
  "../../../domql/packages/element/dist/cjs/node.js"(exports, module2) {
@@ -8077,6 +8143,7 @@ var require_node2 = __commonJS({
8077
8143
  var import_mixins = require_mixins();
8078
8144
  var import_applyParam = require_applyParam();
8079
8145
  var import_utils210 = require_utils();
8146
+ var import_propEvents = require_propEvents();
8080
8147
  var ENV2 = "development";
8081
8148
  var createNode = (element, options) => {
8082
8149
  let { node: node2, tag, __ref: ref } = element;
@@ -8099,6 +8166,7 @@ var require_node2 = __commonJS({
8099
8166
  (0, import_iterate.throughInitialDefine)(element);
8100
8167
  (0, import_iterate.throughInitialExec)(element);
8101
8168
  if (element.tag !== "string" && element.tag !== "fragment") {
8169
+ (0, import_propEvents.propagateEventsFromProps)(element);
8102
8170
  if (isNewNode && (0, import_utils30.isObject)(element.on))
8103
8171
  (0, import_event.applyEventsOnNode)(element, options);
8104
8172
  }
@@ -9689,7 +9757,6 @@ var require_update2 = __commonJS({
9689
9757
  return [snapshotOnCallee, calleeElement];
9690
9758
  };
9691
9759
  var checkIfOnUpdate = (element, parent, options) => {
9692
- var _a;
9693
9760
  if (!(0, import_utils30.isFunction)(element.if) || !parent)
9694
9761
  return;
9695
9762
  const ref = element.__ref;
@@ -9705,13 +9772,15 @@ var require_update2 = __commonJS({
9705
9772
  }
9706
9773
  if (ref.__state) {
9707
9774
  element.state = ref.__state;
9775
+ } else if (!ref.__hasRootState) {
9776
+ delete element.state;
9708
9777
  }
9709
- (_a = element.node) == null ? void 0 : _a.remove();
9778
+ element.node && element.node.remove();
9710
9779
  const previousElement = element.previousElement();
9711
9780
  const nextElement = element.nextElement();
9712
9781
  const hasPrevious = previousElement && previousElement.node;
9713
9782
  const hasNext = nextElement && nextElement.node;
9714
- const attachOptions = ((hasPrevious == null ? void 0 : hasPrevious.parentNode) || (hasNext == null ? void 0 : hasNext.parentNode)) && {
9783
+ const attachOptions = (hasPrevious && hasPrevious.parentNode || hasNext && hasNext.parentNode) && {
9715
9784
  position: hasPrevious ? "after" : hasNext ? "before" : null,
9716
9785
  node: hasPrevious || hasNext
9717
9786
  };
@@ -9747,13 +9816,13 @@ var require_update2 = __commonJS({
9747
9816
  if (!keyInParentState || options.preventInheritedStateUpdate)
9748
9817
  return;
9749
9818
  if (!options.preventInitStateUpdateListener) {
9750
- const initStateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdated", keyInParentState, element, options);
9819
+ const initStateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdate", keyInParentState, element, options);
9751
9820
  if (initStateReturns === false)
9752
9821
  return element;
9753
9822
  }
9754
9823
  const newState = createStateUpdate(element, parent, options);
9755
9824
  if (!options.preventStateUpdateListener) {
9756
- (0, import_event.triggerEventOnUpdate)("stateUpdated", newState.parse(), element, options);
9825
+ (0, import_event.triggerEventOnUpdate)("stateUpdate", newState.parse(), element, options);
9757
9826
  }
9758
9827
  };
9759
9828
  var createStateUpdate = (element, parent, options) => {
@@ -9955,8 +10024,11 @@ var require_create4 = __commonJS({
9955
10024
  return element;
9956
10025
  };
9957
10026
  var redefineElement = (element, parent, key, options) => {
10027
+ var _a;
9958
10028
  const elementWrapper = createBasedOnType(element, parent, key, options);
9959
- if ((0, import_component.checkIfKeyIsComponent)(key)) {
10029
+ if (options.syntaxv3 || ((_a = element.props) == null ? void 0 : _a.syntaxv3)) {
10030
+ return (0, import_component.createValidDomqlObjectFromSugar)(element, parent, key, options);
10031
+ } else if ((0, import_component.checkIfKeyIsComponent)(key)) {
9960
10032
  return (0, import_component.applyKeyComponentAsExtend)(elementWrapper, parent, key);
9961
10033
  }
9962
10034
  if (checkIfMedia(key)) {
@@ -10574,7 +10646,7 @@ var toCamelCase = (str) => {
10574
10646
  return index === 0 ? word.toLowerCase() : word.toUpperCase();
10575
10647
  }).replaceAll(/\s+/g, "");
10576
10648
  };
10577
- var toTitleCase = (str) => str == null ? void 0 : str.replace(
10649
+ var toTitleCase = (str) => str && str.replace(
10578
10650
  /\w\S*/g,
10579
10651
  (txt) => {
10580
10652
  return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
@@ -13297,7 +13369,7 @@ var Collection = {
13297
13369
  }
13298
13370
  return data;
13299
13371
  },
13300
- $setStateCollection: (param, el, state) => {
13372
+ $stateCollection: (param, el, state) => {
13301
13373
  if (!param)
13302
13374
  return;
13303
13375
  if ((0, import_utils8.isString)(param)) {
@@ -13337,7 +13409,7 @@ var Collection = {
13337
13409
  el.content = obj;
13338
13410
  return obj;
13339
13411
  },
13340
- $setPropsCollection: (param, el, state) => {
13412
+ $propsCollection: (param, el, state) => {
13341
13413
  if (!param)
13342
13414
  return;
13343
13415
  if ((0, import_utils8.isString)(param)) {
@@ -15681,7 +15753,7 @@ var AvatarBundle = {
15681
15753
  }
15682
15754
  },
15683
15755
  childExtend: Avatar,
15684
- $setPropsCollection: ({ props: props4 }) => props4.options
15756
+ $propsCollection: ({ props: props4 }) => props4.options
15685
15757
  };
15686
15758
 
15687
15759
  // ../uikit/Avatar/AvatarChooser.js
@@ -15722,7 +15794,7 @@ var AvatarChooser = {
15722
15794
  }
15723
15795
  },
15724
15796
  childExtend: { tag: "option" },
15725
- $setPropsCollection: ({ parent, state }) => {
15797
+ $propsCollection: ({ parent, state }) => {
15726
15798
  if (!parent.props.options)
15727
15799
  return [];
15728
15800
  return parent.props.options.map((v) => {
@@ -15933,7 +16005,7 @@ var Pills = {
15933
16005
  }
15934
16006
  }
15935
16007
  },
15936
- $setPropsCollection: ({ props: props4, state }) => new Array(props4.qty).fill({})
16008
+ $propsCollection: ({ props: props4, state }) => new Array(props4.qty).fill({})
15937
16009
  };
15938
16010
 
15939
16011
  // ../uikit/Tab/index.js
@@ -16570,7 +16642,7 @@ var DropdownList = {
16570
16642
  }
16571
16643
  })
16572
16644
  },
16573
- $setPropsCollection: ({ props: props4 }) => props4.options
16645
+ $propsCollection: ({ props: props4 }) => props4.options
16574
16646
  };
16575
16647
  var DropdownParent = {
16576
16648
  props: {
@@ -21430,6 +21502,7 @@ var DevFocus = {
21430
21502
  on: {
21431
21503
  init: ({ context }) => {
21432
21504
  const { components } = context;
21505
+ console.log(components);
21433
21506
  if ((0, import_utils21.isObject)(components)) {
21434
21507
  const { Content, ...rest } = components;
21435
21508
  for (const key in rest) {
@@ -21620,7 +21693,7 @@ var Notifications = {
21620
21693
  }),
21621
21694
  on: { click: (e, el) => el.setProps({ animation: "fadeOutDown" }) }
21622
21695
  },
21623
- $setStateCollection: ({ state }) => state.notifications
21696
+ $stateCollection: ({ state }) => state.notifications
21624
21697
  };
21625
21698
  var Sync = {
21626
21699
  notifications: Notifications,
@@ -21683,8 +21756,8 @@ var defaultDefine = {
21683
21756
  },
21684
21757
  $collection: Collection.define.$collection,
21685
21758
  $setCollection: Collection.define.$setCollection,
21686
- $setStateCollection: Collection.define.$setStateCollection,
21687
- $setPropsCollection: Collection.define.$setPropsCollection
21759
+ $stateCollection: Collection.define.$stateCollection,
21760
+ $propsCollection: Collection.define.$propsCollection
21688
21761
  };
21689
21762
 
21690
21763
  // src/options.js
@@ -22316,6 +22389,7 @@ var createDomqlElement = (App, options) => {
22316
22389
  designSystem,
22317
22390
  snippets,
22318
22391
  functions: options.functions,
22392
+ files: options.files,
22319
22393
  utils: snippets,
22320
22394
  define,
22321
22395
  registry,
@@ -65,6 +65,7 @@ const createDomqlElement = (App, options) => {
65
65
  designSystem,
66
66
  snippets,
67
67
  functions: options.functions,
68
+ files: options.files,
68
69
  utils: snippets,
69
70
  define,
70
71
  registry,
@@ -40,6 +40,6 @@ const defaultDefine = {
40
40
  },
41
41
  $collection: import_uikit.Collection.define.$collection,
42
42
  $setCollection: import_uikit.Collection.define.$setCollection,
43
- $setStateCollection: import_uikit.Collection.define.$setStateCollection,
44
- $setPropsCollection: import_uikit.Collection.define.$setPropsCollection
43
+ $stateCollection: import_uikit.Collection.define.$stateCollection,
44
+ $propsCollection: import_uikit.Collection.define.$propsCollection
45
45
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.11.272",
3
+ "version": "2.11.276",
4
4
  "license": "MIT",
5
- "gitHead": "d9b2868d7416869c993f7847bcac544d879336cc",
5
+ "gitHead": "ce33b49ad632d606b7304fbda48bade4aa368667",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
@@ -41,6 +41,7 @@ export const createDomqlElement = (App, options) => {
41
41
  designSystem,
42
42
  snippets,
43
43
  functions: options.functions,
44
+ files: options.files,
44
45
  utils: snippets,
45
46
  define,
46
47
  registry,
package/src/define.js CHANGED
@@ -24,6 +24,6 @@ export const defaultDefine = {
24
24
 
25
25
  $collection: Collection.define.$collection,
26
26
  $setCollection: Collection.define.$setCollection,
27
- $setStateCollection: Collection.define.$setStateCollection,
28
- $setPropsCollection: Collection.define.$setPropsCollection
27
+ $stateCollection: Collection.define.$stateCollection,
28
+ $propsCollection: Collection.define.$propsCollection
29
29
  }