@symbo.ls/create 2.11.274 → 2.11.279

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
  };
@@ -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;
@@ -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
  }
@@ -9748,13 +9816,13 @@ var require_update2 = __commonJS({
9748
9816
  if (!keyInParentState || options.preventInheritedStateUpdate)
9749
9817
  return;
9750
9818
  if (!options.preventInitStateUpdateListener) {
9751
- const initStateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdated", keyInParentState, element, options);
9819
+ const initStateReturns = (0, import_event.triggerEventOnUpdate)("initStateUpdate", keyInParentState, element, options);
9752
9820
  if (initStateReturns === false)
9753
9821
  return element;
9754
9822
  }
9755
9823
  const newState = createStateUpdate(element, parent, options);
9756
9824
  if (!options.preventStateUpdateListener) {
9757
- (0, import_event.triggerEventOnUpdate)("stateUpdated", newState.parse(), element, options);
9825
+ (0, import_event.triggerEventOnUpdate)("stateUpdate", newState.parse(), element, options);
9758
9826
  }
9759
9827
  };
9760
9828
  var createStateUpdate = (element, parent, options) => {
@@ -9956,8 +10024,11 @@ var require_create4 = __commonJS({
9956
10024
  return element;
9957
10025
  };
9958
10026
  var redefineElement = (element, parent, key, options) => {
10027
+ var _a;
9959
10028
  const elementWrapper = createBasedOnType(element, parent, key, options);
9960
- 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)) {
9961
10032
  return (0, import_component.applyKeyComponentAsExtend)(elementWrapper, parent, key);
9962
10033
  }
9963
10034
  if (checkIfMedia(key)) {
@@ -12324,8 +12395,8 @@ var Block = {
12324
12395
  return;
12325
12396
  const [marginInlineStart, marginInlineEnd] = props4.marginInline.split(" ");
12326
12397
  return {
12327
- ...deps.getSpacingByKey("marginInlineStart", marginInlineStart),
12328
- ...deps.getSpacingByKey("marginInlineEnd", marginInlineEnd || marginInlineStart)
12398
+ ...deps.transformSize("marginInlineStart", marginInlineStart),
12399
+ ...deps.transformSize("marginInlineEnd", marginInlineEnd || marginInlineStart)
12329
12400
  };
12330
12401
  },
12331
12402
  marginBlock: ({ props: props4, deps }) => {
@@ -12333,8 +12404,8 @@ var Block = {
12333
12404
  return;
12334
12405
  const [marginBlockStart, marginBlockEnd] = props4.marginBlock.split(" ");
12335
12406
  return {
12336
- ...deps.getSpacingByKey("marginBlockStart", marginBlockStart),
12337
- ...deps.getSpacingByKey("marginBlockEnd", marginBlockEnd || marginBlockStart)
12407
+ ...deps.transformSize("marginBlockStart", marginBlockStart),
12408
+ ...deps.transformSize("marginBlockEnd", marginBlockEnd || marginBlockStart)
12338
12409
  };
12339
12410
  },
12340
12411
  marginInlineStart: ({ props: props4, deps }) => deps.transformSizeRatio("marginInlineStart", props4),
@@ -13298,7 +13369,7 @@ var Collection = {
13298
13369
  }
13299
13370
  return data;
13300
13371
  },
13301
- $setStateCollection: (param, el, state) => {
13372
+ $stateCollection: (param, el, state) => {
13302
13373
  if (!param)
13303
13374
  return;
13304
13375
  if ((0, import_utils8.isString)(param)) {
@@ -13338,7 +13409,7 @@ var Collection = {
13338
13409
  el.content = obj;
13339
13410
  return obj;
13340
13411
  },
13341
- $setPropsCollection: (param, el, state) => {
13412
+ $propsCollection: (param, el, state) => {
13342
13413
  if (!param)
13343
13414
  return;
13344
13415
  if ((0, import_utils8.isString)(param)) {
@@ -15682,7 +15753,7 @@ var AvatarBundle = {
15682
15753
  }
15683
15754
  },
15684
15755
  childExtend: Avatar,
15685
- $setPropsCollection: ({ props: props4 }) => props4.options
15756
+ $propsCollection: ({ props: props4 }) => props4.options
15686
15757
  };
15687
15758
 
15688
15759
  // ../uikit/Avatar/AvatarChooser.js
@@ -15723,7 +15794,7 @@ var AvatarChooser = {
15723
15794
  }
15724
15795
  },
15725
15796
  childExtend: { tag: "option" },
15726
- $setPropsCollection: ({ parent, state }) => {
15797
+ $propsCollection: ({ parent, state }) => {
15727
15798
  if (!parent.props.options)
15728
15799
  return [];
15729
15800
  return parent.props.options.map((v) => {
@@ -15934,7 +16005,7 @@ var Pills = {
15934
16005
  }
15935
16006
  }
15936
16007
  },
15937
- $setPropsCollection: ({ props: props4, state }) => new Array(props4.qty).fill({})
16008
+ $propsCollection: ({ props: props4, state }) => new Array(props4.qty).fill({})
15938
16009
  };
15939
16010
 
15940
16011
  // ../uikit/Tab/index.js
@@ -16571,7 +16642,7 @@ var DropdownList = {
16571
16642
  }
16572
16643
  })
16573
16644
  },
16574
- $setPropsCollection: ({ props: props4 }) => props4.options
16645
+ $propsCollection: ({ props: props4 }) => props4.options
16575
16646
  };
16576
16647
  var DropdownParent = {
16577
16648
  props: {
@@ -17020,13 +17091,11 @@ var UploadIcon = {
17020
17091
  padding: "B B2"
17021
17092
  },
17022
17093
  Input: {
17023
- props: {
17024
- type: "file",
17025
- position: "absolute",
17026
- inset: "0 0 0 0",
17027
- opacity: "0",
17028
- visibility: "hidden"
17029
- }
17094
+ type: "file",
17095
+ position: "absolute",
17096
+ inset: "0 0 0 0",
17097
+ opacity: "0",
17098
+ visibility: "hidden"
17030
17099
  },
17031
17100
  Icon: {
17032
17101
  props: {
@@ -21431,7 +21500,6 @@ var DevFocus = {
21431
21500
  on: {
21432
21501
  init: ({ context }) => {
21433
21502
  const { components } = context;
21434
- console.log(components);
21435
21503
  if ((0, import_utils21.isObject)(components)) {
21436
21504
  const { Content, ...rest } = components;
21437
21505
  for (const key in rest) {
@@ -21622,7 +21690,7 @@ var Notifications = {
21622
21690
  }),
21623
21691
  on: { click: (e, el) => el.setProps({ animation: "fadeOutDown" }) }
21624
21692
  },
21625
- $setStateCollection: ({ state }) => state.notifications
21693
+ $stateCollection: ({ state }) => state.notifications
21626
21694
  };
21627
21695
  var Sync = {
21628
21696
  notifications: Notifications,
@@ -21685,8 +21753,8 @@ var defaultDefine = {
21685
21753
  },
21686
21754
  $collection: Collection.define.$collection,
21687
21755
  $setCollection: Collection.define.$setCollection,
21688
- $setStateCollection: Collection.define.$setStateCollection,
21689
- $setPropsCollection: Collection.define.$setPropsCollection
21756
+ $stateCollection: Collection.define.$stateCollection,
21757
+ $propsCollection: Collection.define.$propsCollection
21690
21758
  };
21691
21759
 
21692
21760
  // src/options.js
@@ -22335,10 +22403,10 @@ var createDomqlElement = (App, options) => {
22335
22403
 
22336
22404
  // src/index.js
22337
22405
  var SYMBOLS_KEY2 = process.env.SYMBOLS_KEY;
22338
- var mergeWithLocalFile2 = (options, optionsExternalFile) => {
22339
- const rcfile = (0, import_utils29.isObject)(optionsExternalFile) ? optionsExternalFile : dynamic_default || {};
22340
- return (0, import_utils29.deepMerge)(options, rcfile);
22341
- };
22406
+ var mergeWithLocalFile2 = (options, optionsExternalFile) => (0, import_utils29.deepMerge)(
22407
+ options,
22408
+ (0, import_utils29.isObject)(optionsExternalFile) ? optionsExternalFile : dynamic_default || {}
22409
+ );
22342
22410
  var create = (App, options = options_default, optionsExternalFile) => {
22343
22411
  const redefinedOptions = { ...options_default, ...mergeWithLocalFile2(options, optionsExternalFile) };
22344
22412
  const domqlApp = createDomqlElement(App, redefinedOptions);
@@ -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/dist/cjs/index.js CHANGED
@@ -43,10 +43,10 @@ var import_options = __toESM(require("./options"), 1);
43
43
  var import_dynamic = __toESM(require("@symbo.ls/init/dynamic.json"), 1);
44
44
  var import_createDomql = require("./createDomql");
45
45
  const SYMBOLS_KEY = process.env.SYMBOLS_KEY;
46
- const mergeWithLocalFile = (options, optionsExternalFile) => {
47
- const rcfile = (0, import_utils.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic.default || {};
48
- return (0, import_utils.deepMerge)(options, rcfile);
49
- };
46
+ const mergeWithLocalFile = (options, optionsExternalFile) => (0, import_utils.deepMerge)(
47
+ options,
48
+ (0, import_utils.isObject)(optionsExternalFile) ? optionsExternalFile : import_dynamic.default || {}
49
+ );
50
50
  const create = (App, options = import_options.default, optionsExternalFile) => {
51
51
  const redefinedOptions = { ...import_options.default, ...mergeWithLocalFile(options, optionsExternalFile) };
52
52
  const domqlApp = (0, import_createDomql.createDomqlElement)(App, redefinedOptions);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/create",
3
- "version": "2.11.274",
3
+ "version": "2.11.279",
4
4
  "license": "MIT",
5
- "gitHead": "6da9add38e678ea82648ee7d5046c83e2007795e",
5
+ "gitHead": "930c65852b7a939a2c3f1e4a6401ddf90919b33d",
6
6
  "files": [
7
7
  "src",
8
8
  "dist"
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
  }
package/src/index.js CHANGED
@@ -14,10 +14,10 @@ import { createDomqlElement } from './createDomql'
14
14
 
15
15
  const SYMBOLS_KEY = process.env.SYMBOLS_KEY
16
16
 
17
- const mergeWithLocalFile = (options, optionsExternalFile) => {
18
- const rcfile = isObject(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
19
- return deepMerge(options, rcfile)
20
- }
17
+ const mergeWithLocalFile = (options, optionsExternalFile) => deepMerge(
18
+ options,
19
+ isObject(optionsExternalFile) ? optionsExternalFile : DYNAMIC_JSON || {}
20
+ )
21
21
 
22
22
  export const create = (App, options = DEFAULT_CREATE_OPTIONS, optionsExternalFile) => {
23
23
  const redefinedOptions = { ...DEFAULT_CREATE_OPTIONS, ...mergeWithLocalFile(options, optionsExternalFile) }