smbls 2.11.451 → 2.11.453

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.
Files changed (2) hide show
  1. package/dist/cjs/index.js +482 -200
  2. package/package.json +13 -12
package/dist/cjs/index.js CHANGED
@@ -306,6 +306,8 @@ var require_array = __commonJS({
306
306
  arraysEqual: () => arraysEqual,
307
307
  cutArrayAfterValue: () => cutArrayAfterValue,
308
308
  cutArrayBeforeValue: () => cutArrayBeforeValue,
309
+ filterArrays: () => filterArrays,
310
+ filterArraysFast: () => filterArraysFast,
309
311
  getFrequencyInArray: () => getFrequencyInArray,
310
312
  joinArrays: () => joinArrays,
311
313
  mergeAndCloneIfArray: () => mergeAndCloneIfArray,
@@ -414,6 +416,13 @@ var require_array = __commonJS({
414
416
  }
415
417
  return true;
416
418
  };
419
+ var filterArrays = (sourceArr, excludeArr) => {
420
+ return sourceArr.filter((item) => !excludeArr.includes(item));
421
+ };
422
+ var filterArraysFast = (sourceArr, excludeArr) => {
423
+ const excludeSet = new Set(excludeArr);
424
+ return sourceArr.filter((item) => !excludeSet.has(item));
425
+ };
417
426
  }
418
427
  });
419
428
 
@@ -607,6 +616,7 @@ var require_object = __commonJS({
607
616
  diff: () => diff,
608
617
  diffArrays: () => diffArrays,
609
618
  diffObjects: () => diffObjects,
619
+ excludeKeysFromObject: () => excludeKeysFromObject,
610
620
  exec: () => exec7,
611
621
  flattenRecursive: () => flattenRecursive,
612
622
  hasOwnProperty: () => hasOwnProperty,
@@ -934,7 +944,7 @@ var require_object = __commonJS({
934
944
  };
935
945
  var stringToObject = (str, opts = { verbose: true }) => {
936
946
  try {
937
- return import_globals2.window.eval("(" + str + ")");
947
+ return str ? import_globals2.window.eval("(" + str + ")") : {};
938
948
  } catch (e) {
939
949
  if (opts.verbose)
940
950
  console.warn(e);
@@ -1014,20 +1024,27 @@ var require_object = __commonJS({
1014
1024
  return acc;
1015
1025
  }, deletedValues);
1016
1026
  };
1017
- var overwrite = (element, params, excludeFrom = []) => {
1018
- const { ref } = element;
1019
- const changes = {};
1027
+ var overwrite = (element, params, opts = {}) => {
1028
+ const { __ref: ref } = element;
1029
+ const excl = opts.exclude || [];
1030
+ const allowUnderscore = opts.preventUnderscore;
1031
+ const preventCaching = opts.preventCaching;
1020
1032
  for (const e in params) {
1021
- if (excludeFrom.includes(e) || e.startsWith("__"))
1033
+ if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
1022
1034
  continue;
1023
1035
  const elementProp = element[e];
1024
1036
  const paramsProp = params[e];
1025
- if (paramsProp) {
1026
- ref.__cache[e] = changes[e] = elementProp;
1027
- ref[e] = paramsProp;
1037
+ if (paramsProp !== void 0) {
1038
+ element[e] = paramsProp;
1039
+ if (ref && !preventCaching) {
1040
+ ref.__cache[e] = elementProp;
1041
+ }
1042
+ if ((0, import_types.isObject)(opts.diff)) {
1043
+ diff[e] = elementProp;
1044
+ }
1028
1045
  }
1029
1046
  }
1030
- return changes;
1047
+ return element;
1031
1048
  };
1032
1049
  var overwriteShallow3 = (obj, params, excludeFrom = []) => {
1033
1050
  for (const e in params) {
@@ -1037,23 +1054,26 @@ var require_object = __commonJS({
1037
1054
  }
1038
1055
  return obj;
1039
1056
  };
1040
- var overwriteDeep2 = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
1057
+ var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
1058
+ const excl = opts.exclude || [];
1059
+ const forcedExclude = opts.preventForce ? [] : ["node", "window"];
1041
1060
  if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
1042
1061
  return params;
1043
1062
  }
1044
- if (visited.has(obj)) {
1063
+ if (visited.has(obj))
1045
1064
  return visited.get(obj);
1046
- }
1047
1065
  visited.set(obj, obj);
1048
1066
  for (const e in params) {
1049
- if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
1067
+ if (!Object.hasOwnProperty.call(params, e))
1068
+ continue;
1069
+ if (excl.includes(e) || forcedExclude && e.startsWith("__"))
1050
1070
  continue;
1051
1071
  const objProp = obj[e];
1052
1072
  const paramsProp = params[e];
1053
1073
  if ((0, import_node.isDOMNode)(paramsProp)) {
1054
1074
  obj[e] = paramsProp;
1055
1075
  } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
1056
- obj[e] = overwriteDeep2(objProp, paramsProp, excludeFrom, visited);
1076
+ obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
1057
1077
  } else if (paramsProp !== void 0) {
1058
1078
  obj[e] = paramsProp;
1059
1079
  }
@@ -1235,6 +1255,11 @@ var require_object = __commonJS({
1235
1255
  }
1236
1256
  return detect(obj);
1237
1257
  };
1258
+ var excludeKeysFromObject = (obj, excludedKeys) => {
1259
+ const result = { ...obj };
1260
+ excludedKeys.forEach((key) => delete result[key]);
1261
+ return result;
1262
+ };
1238
1263
  }
1239
1264
  });
1240
1265
 
@@ -1654,6 +1679,8 @@ var require_component = __commonJS({
1654
1679
  return /^[a-z]*$/.test(firstCharKey);
1655
1680
  };
1656
1681
  var addAdditionalExtend2 = (newExtend, element) => {
1682
+ if (!newExtend)
1683
+ return element;
1657
1684
  const { extend: elementExtend } = element;
1658
1685
  const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
1659
1686
  const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
@@ -1661,8 +1688,23 @@ var require_component = __commonJS({
1661
1688
  return { ...element, extend };
1662
1689
  };
1663
1690
  var checkIfSugar = (element, parent, key) => {
1664
- const { extend, props: props2, childExtend, extends: extendProps, childrenExtends, childProps, children, on: on2, $collection, $stateCollection, $propsCollection } = element;
1691
+ const {
1692
+ extend,
1693
+ props: props2,
1694
+ childExtend,
1695
+ extends: extendProps,
1696
+ childrenExtends,
1697
+ childProps,
1698
+ children,
1699
+ on: on2,
1700
+ $collection,
1701
+ $stateCollection,
1702
+ $propsCollection
1703
+ } = element;
1665
1704
  const hasComponentAttrs = extend || childExtend || props2 || on2 || $collection || $stateCollection || $propsCollection;
1705
+ if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
1706
+ element.error("Sugar component includes params for builtin components");
1707
+ }
1666
1708
  return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
1667
1709
  };
1668
1710
  var extendizeByKey = (element, parent, key) => {
@@ -1674,11 +1716,11 @@ var require_component = __commonJS({
1674
1716
  if (element === isExtendKeyComponent)
1675
1717
  return element;
1676
1718
  else if (isSugar) {
1677
- const newElem = {
1719
+ const newElem = addAdditionalExtend2(element.extends, {
1678
1720
  extend: extendFromKey,
1679
1721
  tag,
1680
1722
  props: { ...element }
1681
- };
1723
+ });
1682
1724
  if (childrenExtends)
1683
1725
  newElem.childExtend = childrenExtends;
1684
1726
  return newElem;
@@ -2932,6 +2974,8 @@ var require_cjs2 = __commonJS({
2932
2974
  arraysEqual: () => arraysEqual,
2933
2975
  cutArrayAfterValue: () => cutArrayAfterValue,
2934
2976
  cutArrayBeforeValue: () => cutArrayBeforeValue,
2977
+ filterArrays: () => filterArrays,
2978
+ filterArraysFast: () => filterArraysFast,
2935
2979
  getFrequencyInArray: () => getFrequencyInArray,
2936
2980
  joinArrays: () => joinArrays,
2937
2981
  mergeAndCloneIfArray: () => mergeAndCloneIfArray,
@@ -3040,6 +3084,13 @@ var require_cjs2 = __commonJS({
3040
3084
  }
3041
3085
  return true;
3042
3086
  };
3087
+ var filterArrays = (sourceArr, excludeArr) => {
3088
+ return sourceArr.filter((item) => !excludeArr.includes(item));
3089
+ };
3090
+ var filterArraysFast = (sourceArr, excludeArr) => {
3091
+ const excludeSet = new Set(excludeArr);
3092
+ return sourceArr.filter((item) => !excludeSet.has(item));
3093
+ };
3043
3094
  }
3044
3095
  });
3045
3096
  var require_string3 = __commonJS2({
@@ -3229,6 +3280,7 @@ var require_cjs2 = __commonJS({
3229
3280
  diff: () => diff,
3230
3281
  diffArrays: () => diffArrays,
3231
3282
  diffObjects: () => diffObjects,
3283
+ excludeKeysFromObject: () => excludeKeysFromObject,
3232
3284
  exec: () => exec7,
3233
3285
  flattenRecursive: () => flattenRecursive,
3234
3286
  hasOwnProperty: () => hasOwnProperty,
@@ -3556,7 +3608,7 @@ var require_cjs2 = __commonJS({
3556
3608
  };
3557
3609
  var stringToObject = (str, opts = { verbose: true }) => {
3558
3610
  try {
3559
- return import_globals3.window.eval("(" + str + ")");
3611
+ return str ? import_globals3.window.eval("(" + str + ")") : {};
3560
3612
  } catch (e) {
3561
3613
  if (opts.verbose)
3562
3614
  console.warn(e);
@@ -3636,20 +3688,27 @@ var require_cjs2 = __commonJS({
3636
3688
  return acc;
3637
3689
  }, deletedValues);
3638
3690
  };
3639
- var overwrite = (element, params, excludeFrom = []) => {
3640
- const { ref } = element;
3641
- const changes = {};
3691
+ var overwrite = (element, params, opts = {}) => {
3692
+ const { __ref: ref } = element;
3693
+ const excl = opts.exclude || [];
3694
+ const allowUnderscore = opts.preventUnderscore;
3695
+ const preventCaching = opts.preventCaching;
3642
3696
  for (const e in params) {
3643
- if (excludeFrom.includes(e) || e.startsWith("__"))
3697
+ if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
3644
3698
  continue;
3645
3699
  const elementProp = element[e];
3646
3700
  const paramsProp = params[e];
3647
- if (paramsProp) {
3648
- ref.__cache[e] = changes[e] = elementProp;
3649
- ref[e] = paramsProp;
3701
+ if (paramsProp !== void 0) {
3702
+ element[e] = paramsProp;
3703
+ if (ref && !preventCaching) {
3704
+ ref.__cache[e] = elementProp;
3705
+ }
3706
+ if ((0, import_types.isObject)(opts.diff)) {
3707
+ diff[e] = elementProp;
3708
+ }
3650
3709
  }
3651
3710
  }
3652
- return changes;
3711
+ return element;
3653
3712
  };
3654
3713
  var overwriteShallow3 = (obj, params, excludeFrom = []) => {
3655
3714
  for (const e in params) {
@@ -3659,23 +3718,26 @@ var require_cjs2 = __commonJS({
3659
3718
  }
3660
3719
  return obj;
3661
3720
  };
3662
- var overwriteDeep2 = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
3721
+ var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
3722
+ const excl = opts.exclude || [];
3723
+ const forcedExclude = opts.preventForce ? [] : ["node", "window"];
3663
3724
  if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
3664
3725
  return params;
3665
3726
  }
3666
- if (visited.has(obj)) {
3727
+ if (visited.has(obj))
3667
3728
  return visited.get(obj);
3668
- }
3669
3729
  visited.set(obj, obj);
3670
3730
  for (const e in params) {
3671
- if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
3731
+ if (!Object.hasOwnProperty.call(params, e))
3732
+ continue;
3733
+ if (excl.includes(e) || forcedExclude && e.startsWith("__"))
3672
3734
  continue;
3673
3735
  const objProp = obj[e];
3674
3736
  const paramsProp = params[e];
3675
3737
  if ((0, import_node.isDOMNode)(paramsProp)) {
3676
3738
  obj[e] = paramsProp;
3677
3739
  } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
3678
- obj[e] = overwriteDeep2(objProp, paramsProp, excludeFrom, visited);
3740
+ obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
3679
3741
  } else if (paramsProp !== void 0) {
3680
3742
  obj[e] = paramsProp;
3681
3743
  }
@@ -3857,6 +3919,11 @@ var require_cjs2 = __commonJS({
3857
3919
  }
3858
3920
  return detect(obj);
3859
3921
  };
3922
+ var excludeKeysFromObject = (obj, excludedKeys) => {
3923
+ const result = { ...obj };
3924
+ excludedKeys.forEach((key) => delete result[key]);
3925
+ return result;
3926
+ };
3860
3927
  }
3861
3928
  });
3862
3929
  var require_function3 = __commonJS2({
@@ -4266,6 +4333,8 @@ var require_cjs2 = __commonJS({
4266
4333
  return /^[a-z]*$/.test(firstCharKey);
4267
4334
  };
4268
4335
  var addAdditionalExtend2 = (newExtend, element) => {
4336
+ if (!newExtend)
4337
+ return element;
4269
4338
  const { extend: elementExtend } = element;
4270
4339
  const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
4271
4340
  const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
@@ -4273,8 +4342,23 @@ var require_cjs2 = __commonJS({
4273
4342
  return { ...element, extend };
4274
4343
  };
4275
4344
  var checkIfSugar = (element, parent, key) => {
4276
- const { extend, props: props2, childExtend, extends: extendProps, childrenExtends, childProps, children, on: on2, $collection, $stateCollection, $propsCollection } = element;
4345
+ const {
4346
+ extend,
4347
+ props: props2,
4348
+ childExtend,
4349
+ extends: extendProps,
4350
+ childrenExtends,
4351
+ childProps,
4352
+ children,
4353
+ on: on2,
4354
+ $collection,
4355
+ $stateCollection,
4356
+ $propsCollection
4357
+ } = element;
4277
4358
  const hasComponentAttrs = extend || childExtend || props2 || on2 || $collection || $stateCollection || $propsCollection;
4359
+ if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
4360
+ element.error("Sugar component includes params for builtin components");
4361
+ }
4278
4362
  return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
4279
4363
  };
4280
4364
  var extendizeByKey = (element, parent, key) => {
@@ -4286,11 +4370,11 @@ var require_cjs2 = __commonJS({
4286
4370
  if (element === isExtendKeyComponent)
4287
4371
  return element;
4288
4372
  else if (isSugar) {
4289
- const newElem = {
4373
+ const newElem = addAdditionalExtend2(element.extends, {
4290
4374
  extend: extendFromKey,
4291
4375
  tag,
4292
4376
  props: { ...element }
4293
- };
4377
+ });
4294
4378
  if (childrenExtends)
4295
4379
  newElem.childExtend = childrenExtends;
4296
4380
  return newElem;
@@ -4757,6 +4841,8 @@ var require_cjs2 = __commonJS({
4757
4841
  arraysEqual: () => arraysEqual,
4758
4842
  cutArrayAfterValue: () => cutArrayAfterValue,
4759
4843
  cutArrayBeforeValue: () => cutArrayBeforeValue,
4844
+ filterArrays: () => filterArrays,
4845
+ filterArraysFast: () => filterArraysFast,
4760
4846
  getFrequencyInArray: () => getFrequencyInArray,
4761
4847
  joinArrays: () => joinArrays,
4762
4848
  mergeAndCloneIfArray: () => mergeAndCloneIfArray,
@@ -4865,6 +4951,13 @@ var require_cjs2 = __commonJS({
4865
4951
  }
4866
4952
  return true;
4867
4953
  };
4954
+ var filterArrays = (sourceArr, excludeArr) => {
4955
+ return sourceArr.filter((item) => !excludeArr.includes(item));
4956
+ };
4957
+ var filterArraysFast = (sourceArr, excludeArr) => {
4958
+ const excludeSet = new Set(excludeArr);
4959
+ return sourceArr.filter((item) => !excludeSet.has(item));
4960
+ };
4868
4961
  }
4869
4962
  });
4870
4963
  var require_string22 = __commonJS22({
@@ -5054,9 +5147,11 @@ var require_cjs2 = __commonJS({
5054
5147
  diff: () => diff,
5055
5148
  diffArrays: () => diffArrays,
5056
5149
  diffObjects: () => diffObjects,
5150
+ excludeKeysFromObject: () => excludeKeysFromObject,
5057
5151
  exec: () => exec7,
5058
5152
  flattenRecursive: () => flattenRecursive,
5059
5153
  hasOwnProperty: () => hasOwnProperty,
5154
+ isCyclic: () => isCyclic,
5060
5155
  isEmpty: () => isEmpty,
5061
5156
  isEmptyObject: () => isEmptyObject,
5062
5157
  isEqualDeep: () => isEqualDeep2,
@@ -5182,20 +5277,28 @@ var require_cjs2 = __commonJS({
5182
5277
  }
5183
5278
  return clone2;
5184
5279
  };
5185
- var deepCloneWithExtend2 = (obj, excludeFrom = ["node"], options = {}) => {
5280
+ var deepCloneWithExtend2 = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
5281
+ if ((0, import_types.isObjectLike)(obj)) {
5282
+ if (visited.has(obj)) {
5283
+ return obj;
5284
+ }
5285
+ visited.add(obj);
5286
+ }
5186
5287
  const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
5187
5288
  for (const prop in obj) {
5188
5289
  if (!Object.prototype.hasOwnProperty.call(obj, prop))
5189
5290
  continue;
5190
5291
  const objProp = obj[prop];
5191
- if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
5292
+ if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
5192
5293
  continue;
5294
+ }
5193
5295
  if ((0, import_types.isObjectLike)(objProp)) {
5194
- o[prop] = deepCloneWithExtend2(objProp, excludeFrom, options);
5296
+ o[prop] = deepCloneWithExtend2(objProp, excludeFrom, options, visited);
5195
5297
  } else if ((0, import_types.isFunction)(objProp) && options.window) {
5196
5298
  o[prop] = (options.window || import_globals3.window).eval("(" + objProp.toString() + ")");
5197
- } else
5299
+ } else {
5198
5300
  o[prop] = objProp;
5301
+ }
5199
5302
  }
5200
5303
  return o;
5201
5304
  };
@@ -5372,7 +5475,7 @@ var require_cjs2 = __commonJS({
5372
5475
  };
5373
5476
  var stringToObject = (str, opts = { verbose: true }) => {
5374
5477
  try {
5375
- return import_globals3.window.eval("(" + str + ")");
5478
+ return str ? import_globals3.window.eval("(" + str + ")") : {};
5376
5479
  } catch (e) {
5377
5480
  if (opts.verbose)
5378
5481
  console.warn(e);
@@ -5452,20 +5555,27 @@ var require_cjs2 = __commonJS({
5452
5555
  return acc;
5453
5556
  }, deletedValues);
5454
5557
  };
5455
- var overwrite = (element, params, excludeFrom = []) => {
5456
- const { ref } = element;
5457
- const changes = {};
5558
+ var overwrite = (element, params, opts = {}) => {
5559
+ const { __ref: ref } = element;
5560
+ const excl = opts.exclude || [];
5561
+ const allowUnderscore = opts.preventUnderscore;
5562
+ const preventCaching = opts.preventCaching;
5458
5563
  for (const e in params) {
5459
- if (excludeFrom.includes(e) || e.startsWith("__"))
5564
+ if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
5460
5565
  continue;
5461
5566
  const elementProp = element[e];
5462
5567
  const paramsProp = params[e];
5463
- if (paramsProp) {
5464
- ref.__cache[e] = changes[e] = elementProp;
5465
- ref[e] = paramsProp;
5568
+ if (paramsProp !== void 0) {
5569
+ element[e] = paramsProp;
5570
+ if (ref && !preventCaching) {
5571
+ ref.__cache[e] = elementProp;
5572
+ }
5573
+ if ((0, import_types.isObject)(opts.diff)) {
5574
+ diff[e] = elementProp;
5575
+ }
5466
5576
  }
5467
5577
  }
5468
- return changes;
5578
+ return element;
5469
5579
  };
5470
5580
  var overwriteShallow3 = (obj, params, excludeFrom = []) => {
5471
5581
  for (const e in params) {
@@ -5475,23 +5585,26 @@ var require_cjs2 = __commonJS({
5475
5585
  }
5476
5586
  return obj;
5477
5587
  };
5478
- var overwriteDeep2 = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
5588
+ var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
5589
+ const excl = opts.exclude || [];
5590
+ const forcedExclude = opts.preventForce ? [] : ["node", "window"];
5479
5591
  if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
5480
5592
  return params;
5481
5593
  }
5482
- if (visited.has(obj)) {
5594
+ if (visited.has(obj))
5483
5595
  return visited.get(obj);
5484
- }
5485
5596
  visited.set(obj, obj);
5486
5597
  for (const e in params) {
5487
- if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
5598
+ if (!Object.hasOwnProperty.call(params, e))
5599
+ continue;
5600
+ if (excl.includes(e) || forcedExclude && e.startsWith("__"))
5488
5601
  continue;
5489
5602
  const objProp = obj[e];
5490
5603
  const paramsProp = params[e];
5491
5604
  if ((0, import_node.isDOMNode)(paramsProp)) {
5492
5605
  obj[e] = paramsProp;
5493
5606
  } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
5494
- obj[e] = overwriteDeep2(objProp, paramsProp, excludeFrom, visited);
5607
+ obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
5495
5608
  } else if (paramsProp !== void 0) {
5496
5609
  obj[e] = paramsProp;
5497
5610
  }
@@ -5654,6 +5767,30 @@ var require_cjs2 = __commonJS({
5654
5767
  }
5655
5768
  }
5656
5769
  };
5770
+ var isCyclic = (obj) => {
5771
+ const seenObjects = [];
5772
+ function detect(obj2) {
5773
+ if (obj2 && typeof obj2 === "object") {
5774
+ if (seenObjects.indexOf(obj2) !== -1) {
5775
+ return true;
5776
+ }
5777
+ seenObjects.push(obj2);
5778
+ for (const key in obj2) {
5779
+ if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
5780
+ console.log(obj2, "cycle at " + key);
5781
+ return true;
5782
+ }
5783
+ }
5784
+ }
5785
+ return false;
5786
+ }
5787
+ return detect(obj);
5788
+ };
5789
+ var excludeKeysFromObject = (obj, excludedKeys) => {
5790
+ const result = { ...obj };
5791
+ excludedKeys.forEach((key) => delete result[key]);
5792
+ return result;
5793
+ };
5657
5794
  }
5658
5795
  });
5659
5796
  var require_function22 = __commonJS22({
@@ -6063,6 +6200,8 @@ var require_cjs2 = __commonJS({
6063
6200
  return /^[a-z]*$/.test(firstCharKey);
6064
6201
  };
6065
6202
  var addAdditionalExtend2 = (newExtend, element) => {
6203
+ if (!newExtend)
6204
+ return element;
6066
6205
  const { extend: elementExtend } = element;
6067
6206
  const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
6068
6207
  const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
@@ -6070,8 +6209,23 @@ var require_cjs2 = __commonJS({
6070
6209
  return { ...element, extend };
6071
6210
  };
6072
6211
  var checkIfSugar = (element, parent, key) => {
6073
- const { extend, props: props2, childExtend, extends: extendProps, childrenExtends, childProps, children, on: on2, $collection, $stateCollection, $propsCollection } = element;
6212
+ const {
6213
+ extend,
6214
+ props: props2,
6215
+ childExtend,
6216
+ extends: extendProps,
6217
+ childrenExtends,
6218
+ childProps,
6219
+ children,
6220
+ on: on2,
6221
+ $collection,
6222
+ $stateCollection,
6223
+ $propsCollection
6224
+ } = element;
6074
6225
  const hasComponentAttrs = extend || childExtend || props2 || on2 || $collection || $stateCollection || $propsCollection;
6226
+ if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
6227
+ element.error("Sugar component includes params for builtin components");
6228
+ }
6075
6229
  return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
6076
6230
  };
6077
6231
  var extendizeByKey = (element, parent, key) => {
@@ -6083,11 +6237,11 @@ var require_cjs2 = __commonJS({
6083
6237
  if (element === isExtendKeyComponent)
6084
6238
  return element;
6085
6239
  else if (isSugar) {
6086
- const newElem = {
6240
+ const newElem = addAdditionalExtend2(element.extends, {
6087
6241
  extend: extendFromKey,
6088
6242
  tag,
6089
6243
  props: { ...element }
6090
- };
6244
+ });
6091
6245
  if (childrenExtends)
6092
6246
  newElem.childExtend = childrenExtends;
6093
6247
  return newElem;
@@ -9777,11 +9931,11 @@ __export(init_exports, {
9777
9931
  DYNAMIC_JSON: () => import_dynamic.default,
9778
9932
  applyCSS: () => applyCSS,
9779
9933
  init: () => init,
9780
- reInit: () => reInit,
9934
+ reinit: () => reinit,
9781
9935
  setClass: () => setClass,
9782
9936
  updateVars: () => updateVars
9783
9937
  });
9784
- var import_scratch, import_utils2, import_dynamic, CONFIG, mergeWithLocalFile, SET_OPTIONS, init, UPDATE_OPTIONS, reInit, applyCSS, updateVars, setClass;
9938
+ var import_scratch, import_utils2, import_dynamic, CONFIG, mergeWithLocalFile, SET_OPTIONS, init, UPDATE_OPTIONS, reinit, applyCSS, updateVars, setClass;
9785
9939
  var init_init = __esm({
9786
9940
  "../init/index.js"() {
9787
9941
  "use strict";
@@ -9790,8 +9944,8 @@ var init_init = __esm({
9790
9944
  init_emotion();
9791
9945
  import_dynamic = __toESM(require_dynamic());
9792
9946
  CONFIG = (0, import_scratch.getActiveConfig)();
9793
- mergeWithLocalFile = (config = CONFIG, RC_FILE) => {
9794
- const rcfile = (0, import_utils2.isObject)(RC_FILE) ? RC_FILE : import_dynamic.default || {};
9947
+ mergeWithLocalFile = (config = CONFIG, options) => {
9948
+ const rcfile = (0, import_utils2.isObject)(options.localFile) ? options.localFile : import_dynamic.default || {};
9795
9949
  const clonedFile = (0, import_utils2.deepClone)(rcfile.designSystem || {});
9796
9950
  return (0, import_utils2.deepMerge)(config, clonedFile);
9797
9951
  };
@@ -9806,7 +9960,7 @@ var init_init = __esm({
9806
9960
  };
9807
9961
  init = (config, options = SET_OPTIONS) => {
9808
9962
  const emotion2 = options.emotion || emotion;
9809
- const resultConfig = mergeWithLocalFile(config || {});
9963
+ const resultConfig = mergeWithLocalFile(config || {}, options);
9810
9964
  const conf = (0, import_scratch.set)({
9811
9965
  verbose: options.verbose,
9812
9966
  useReset: options.useReset,
@@ -9845,15 +9999,20 @@ var init_init = __esm({
9845
9999
  UPDATE_OPTIONS = {
9846
10000
  emotion
9847
10001
  };
9848
- reInit = (config, RC_FILE, options = UPDATE_OPTIONS) => {
10002
+ reinit = (config, options = UPDATE_OPTIONS) => {
9849
10003
  const emotion2 = options.emotion || emotion;
9850
- const resultConfig = mergeWithLocalFile(config || {}, RC_FILE);
10004
+ const resultConfig = mergeWithLocalFile(config || {}, options);
10005
+ const prevStyles = document.querySelector('[data-emotion="smbls"]');
10006
+ console.log(prevStyles);
9851
10007
  const conf = (0, import_scratch.set)({
9852
10008
  verbose: false,
9853
10009
  ...resultConfig
9854
10010
  });
9855
- emotion2.injectGlobal({ ":root": conf.CSS_VARS });
9856
- emotion2.injectGlobal(conf.RESET);
10011
+ if (!options.preventInject) {
10012
+ emotion2.injectGlobal({ ":root": conf.CSS_VARS });
10013
+ emotion2.injectGlobal(conf.RESET);
10014
+ }
10015
+ return conf;
9857
10016
  };
9858
10017
  applyCSS = (styles, options = UPDATE_OPTIONS) => {
9859
10018
  const emotion2 = options.emotion || emotion;
@@ -12679,14 +12838,19 @@ var init_Box = __esm({
12679
12838
  });
12680
12839
 
12681
12840
  // ../uikit/Icon/index.js
12682
- var import_utils15, getIconName, Icon, IconText, FileIcon;
12841
+ var import_utils15, inheritFromIsActive, getIconName, Icon, IconText, FileIcon, getSemanticIcon;
12683
12842
  var init_Icon = __esm({
12684
12843
  "../uikit/Icon/index.js"() {
12685
12844
  "use strict";
12686
12845
  import_utils15 = __toESM(require_cjs());
12846
+ inheritFromIsActive = (el) => {
12847
+ const { props: props2 } = el;
12848
+ const propsActive = props2[".isActive"];
12849
+ return el.call("exec", propsActive.name || propsActive.icon);
12850
+ };
12687
12851
  getIconName = (el, s) => {
12688
12852
  const { key, props: props2, deps } = el;
12689
- let iconName = (0, import_utils15.exec)(props2.name || props2.icon || key, el);
12853
+ let iconName = el.call("exec", props2.name || props2.icon || key, el);
12690
12854
  if ((0, import_utils15.isString)(iconName) && iconName.includes("{{")) {
12691
12855
  iconName = deps.replaceLiteralsWithObjectFields(iconName, s);
12692
12856
  }
@@ -12695,70 +12859,50 @@ var init_Icon = __esm({
12695
12859
  Icon = {
12696
12860
  extend: "Svg",
12697
12861
  deps: { isString: import_utils15.isString, replaceLiteralsWithObjectFields: import_utils15.replaceLiteralsWithObjectFields },
12698
- props: (el, s) => {
12699
- const { props: props2, parent, context, deps, state } = el;
12700
- const { ICONS, SEMANTIC_ICONS, useIconSprite, verbose } = context && context.designSystem;
12701
- const { toCamelCase } = context && context.utils;
12702
- let iconName = getIconName(el, s);
12862
+ props: (el, s, ctx) => {
12863
+ const { props: props2, parent, deps } = el;
12864
+ const { ICONS, useIconSprite, verbose } = ctx && ctx.designSystem;
12865
+ const { toCamelCase } = ctx && ctx.utils;
12866
+ const iconName = getIconName(el, s);
12703
12867
  const camelCase = toCamelCase(iconName);
12704
12868
  const isArray5 = camelCase.split(/([a-z])([A-Z])/g);
12705
- const semanticIconRootName = isArray5[1] ? isArray5[0] : iconName.split(".")[0].split(" ")[0];
12706
- const semanticIcon = SEMANTIC_ICONS && SEMANTIC_ICONS[semanticIconRootName];
12707
- if (semanticIcon) {
12708
- const iconKey = iconName.includes(".") ? "sfsymbols." + iconName.split(".").slice(1).join(".") : "sfsymbols";
12709
- iconName = semanticIcon[iconKey] || semanticIcon[iconName.split(".")[0].split(" ")[0]];
12710
- return {
12711
- tag: "span",
12712
- semantic_symbols: true,
12713
- width: "A",
12714
- height: "A",
12715
- lineHeight: "1em",
12716
- ":after": {
12717
- fontSize: "Z",
12718
- fontWeight: "300",
12719
- content: `"${iconName}"`,
12720
- textAlign: "center",
12721
- display: "inline-block",
12722
- style: {
12723
- color: "currentColor",
12724
- fontFamily: "'SF Pro Icons', 'SF Pro', 'SF Symbols', 'Segoe UI'"
12725
- }
12726
- }
12727
- };
12728
- }
12869
+ const semanticIcon = getSemanticIcon(el, s, ctx);
12870
+ if (semanticIcon)
12871
+ return semanticIcon;
12729
12872
  let activeIconName;
12730
- if (props2.isActive) {
12731
- activeIconName = props2[".isActive"].name || props2[".isActive"].icon;
12732
- }
12733
- if (parent && parent.props && parent.props.isActive && parent.props[".isActive"] && parent.props[".isActive"].icon) {
12873
+ if (props2.isActive)
12874
+ activeIconName = inheritFromIsActive(el);
12875
+ const parentProps = parent.props;
12876
+ const parentPropsActive = parentProps[".isActive"];
12877
+ if (parent && parentProps && parentProps.isActive && parentPropsActive && parentPropsActive.icon) {
12734
12878
  activeIconName = (0, import_utils15.exec)(
12735
- parent.props[".isActive"].icon.name || parent.props[".isActive"].icon.icon || parent.props[".isActive"].icon,
12879
+ parentPropsActive.icon || parentPropsActive.Icon.name || parentPropsActive.Icon.icon,
12736
12880
  el
12737
12881
  );
12738
12882
  }
12739
12883
  if ((0, import_utils15.isString)(activeIconName) && activeIconName.includes("{{")) {
12740
- activeIconName = deps.replaceLiteralsWithObjectFields(activeIconName, state);
12884
+ activeIconName = deps.replaceLiteralsWithObjectFields(activeIconName, s);
12741
12885
  }
12742
- let validIconName;
12886
+ let iconInContext;
12743
12887
  if (ICONS[activeIconName])
12744
- validIconName = activeIconName;
12888
+ iconInContext = activeIconName;
12745
12889
  if (ICONS[camelCase])
12746
- validIconName = camelCase;
12890
+ iconInContext = camelCase;
12747
12891
  else if (ICONS[isArray5[0] + isArray5[1]])
12748
- validIconName = isArray5[0] + isArray5[1];
12892
+ iconInContext = isArray5[0] + isArray5[1];
12749
12893
  else if (ICONS[isArray5[0]])
12750
- validIconName = isArray5[0];
12894
+ iconInContext = isArray5[0];
12751
12895
  else {
12752
12896
  if (verbose)
12753
- console.warn("Can't find icon:", iconName, validIconName);
12897
+ el.warn("Can't find icon:", iconName, iconInContext);
12754
12898
  }
12755
- const iconFromLibrary = ICONS[validIconName];
12899
+ const iconFromLibrary = ICONS[iconInContext];
12756
12900
  const directSrc = parent && parent.props && parent.props.src || props2.src;
12757
12901
  return {
12758
12902
  width: "A",
12759
12903
  height: "A",
12760
12904
  display: "inline-block",
12761
- spriteId: useIconSprite && validIconName,
12905
+ spriteId: useIconSprite && iconInContext,
12762
12906
  src: iconFromLibrary || directSrc || ICONS.noIcon,
12763
12907
  style: { fill: "currentColor", "*": { fill: "currentColor" } }
12764
12908
  };
@@ -12772,7 +12916,7 @@ var init_Icon = __esm({
12772
12916
  lineHeight: 1
12773
12917
  },
12774
12918
  Icon: {
12775
- props: ({ parent }) => ({ icon: parent.props.icon }),
12919
+ props: (el) => ({ icon: el.call("exec", el.parent.props.icon, el.parent) }),
12776
12920
  if: ({ parent, props: props2 }) => {
12777
12921
  return parent.props.icon || parent.props.Icon || props2.name || props2.icon || props2.sfSymbols || parent.props.sfSymbols;
12778
12922
  }
@@ -12799,6 +12943,37 @@ var init_Icon = __esm({
12799
12943
  icon: "file"
12800
12944
  }
12801
12945
  };
12946
+ getSemanticIcon = (el, s, ctx) => {
12947
+ const { SEMANTIC_ICONS } = ctx && ctx.designSystem;
12948
+ const { toCamelCase } = ctx && ctx.utils;
12949
+ let iconName = getIconName(el, s);
12950
+ const camelCase = toCamelCase(iconName);
12951
+ const isArray5 = camelCase.split(/([a-z])([A-Z])/g);
12952
+ const semanticIconRootName = isArray5[1] ? isArray5[0] : iconName.split(".")[0].split(" ")[0];
12953
+ const semanticIcon = SEMANTIC_ICONS && SEMANTIC_ICONS[semanticIconRootName];
12954
+ if (semanticIcon) {
12955
+ const iconKey = iconName.includes(".") ? "sfsymbols." + iconName.split(".").slice(1).join(".") : "sfsymbols";
12956
+ iconName = semanticIcon[iconKey] || semanticIcon[iconName.split(".")[0].split(" ")[0]];
12957
+ return {
12958
+ tag: "span",
12959
+ semantic_symbols: true,
12960
+ width: "A",
12961
+ height: "A",
12962
+ lineHeight: "1em",
12963
+ ":after": {
12964
+ fontSize: "Z",
12965
+ fontWeight: "300",
12966
+ content: `"${iconName}"`,
12967
+ textAlign: "center",
12968
+ display: "inline-block",
12969
+ style: {
12970
+ color: "currentColor",
12971
+ fontFamily: "'SF Pro Icons', 'SF Pro', 'SF Symbols', 'Segoe UI'"
12972
+ }
12973
+ }
12974
+ };
12975
+ }
12976
+ };
12802
12977
  }
12803
12978
  });
12804
12979
 
@@ -16857,6 +17032,8 @@ var require_cjs7 = __commonJS({
16857
17032
  arraysEqual: () => arraysEqual,
16858
17033
  cutArrayAfterValue: () => cutArrayAfterValue,
16859
17034
  cutArrayBeforeValue: () => cutArrayBeforeValue,
17035
+ filterArrays: () => filterArrays,
17036
+ filterArraysFast: () => filterArraysFast,
16860
17037
  getFrequencyInArray: () => getFrequencyInArray,
16861
17038
  joinArrays: () => joinArrays,
16862
17039
  mergeAndCloneIfArray: () => mergeAndCloneIfArray,
@@ -16965,6 +17142,13 @@ var require_cjs7 = __commonJS({
16965
17142
  }
16966
17143
  return true;
16967
17144
  };
17145
+ var filterArrays = (sourceArr, excludeArr) => {
17146
+ return sourceArr.filter((item) => !excludeArr.includes(item));
17147
+ };
17148
+ var filterArraysFast = (sourceArr, excludeArr) => {
17149
+ const excludeSet = new Set(excludeArr);
17150
+ return sourceArr.filter((item) => !excludeSet.has(item));
17151
+ };
16968
17152
  }
16969
17153
  });
16970
17154
  var require_string3 = __commonJS2({
@@ -17154,9 +17338,11 @@ var require_cjs7 = __commonJS({
17154
17338
  diff: () => diff,
17155
17339
  diffArrays: () => diffArrays,
17156
17340
  diffObjects: () => diffObjects,
17341
+ excludeKeysFromObject: () => excludeKeysFromObject,
17157
17342
  exec: () => exec7,
17158
17343
  flattenRecursive: () => flattenRecursive,
17159
17344
  hasOwnProperty: () => hasOwnProperty,
17345
+ isCyclic: () => isCyclic,
17160
17346
  isEmpty: () => isEmpty,
17161
17347
  isEmptyObject: () => isEmptyObject,
17162
17348
  isEqualDeep: () => isEqualDeep2,
@@ -17282,20 +17468,28 @@ var require_cjs7 = __commonJS({
17282
17468
  }
17283
17469
  return clone2;
17284
17470
  };
17285
- var deepCloneWithExtend2 = (obj, excludeFrom = ["node"], options = {}) => {
17471
+ var deepCloneWithExtend2 = (obj, excludeFrom = ["node"], options = {}, visited = /* @__PURE__ */ new WeakSet()) => {
17472
+ if ((0, import_types.isObjectLike)(obj)) {
17473
+ if (visited.has(obj)) {
17474
+ return obj;
17475
+ }
17476
+ visited.add(obj);
17477
+ }
17286
17478
  const o = options.window ? (0, import_types.isArray)(obj) ? new options.window.Array([]) : new options.window.Object({}) : (0, import_types.isArray)(obj) ? [] : {};
17287
17479
  for (const prop in obj) {
17288
17480
  if (!Object.prototype.hasOwnProperty.call(obj, prop))
17289
17481
  continue;
17290
17482
  const objProp = obj[prop];
17291
- if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp))
17483
+ if (excludeFrom.includes(prop) || prop.startsWith("__") || options.cleanUndefined && (0, import_types.isUndefined)(objProp) || options.cleanNull && (0, import_types.isNull)(objProp)) {
17292
17484
  continue;
17485
+ }
17293
17486
  if ((0, import_types.isObjectLike)(objProp)) {
17294
- o[prop] = deepCloneWithExtend2(objProp, excludeFrom, options);
17487
+ o[prop] = deepCloneWithExtend2(objProp, excludeFrom, options, visited);
17295
17488
  } else if ((0, import_types.isFunction)(objProp) && options.window) {
17296
17489
  o[prop] = (options.window || import_globals2.window).eval("(" + objProp.toString() + ")");
17297
- } else
17490
+ } else {
17298
17491
  o[prop] = objProp;
17492
+ }
17299
17493
  }
17300
17494
  return o;
17301
17495
  };
@@ -17472,7 +17666,7 @@ var require_cjs7 = __commonJS({
17472
17666
  };
17473
17667
  var stringToObject = (str, opts = { verbose: true }) => {
17474
17668
  try {
17475
- return import_globals2.window.eval("(" + str + ")");
17669
+ return str ? import_globals2.window.eval("(" + str + ")") : {};
17476
17670
  } catch (e) {
17477
17671
  if (opts.verbose)
17478
17672
  console.warn(e);
@@ -17552,20 +17746,27 @@ var require_cjs7 = __commonJS({
17552
17746
  return acc;
17553
17747
  }, deletedValues);
17554
17748
  };
17555
- var overwrite = (element, params, excludeFrom = []) => {
17556
- const { ref } = element;
17557
- const changes = {};
17749
+ var overwrite = (element, params, opts = {}) => {
17750
+ const { __ref: ref } = element;
17751
+ const excl = opts.exclude || [];
17752
+ const allowUnderscore = opts.preventUnderscore;
17753
+ const preventCaching = opts.preventCaching;
17558
17754
  for (const e in params) {
17559
- if (excludeFrom.includes(e) || e.startsWith("__"))
17755
+ if (excl.includes(e) || !allowUnderscore && e.startsWith("__"))
17560
17756
  continue;
17561
17757
  const elementProp = element[e];
17562
17758
  const paramsProp = params[e];
17563
- if (paramsProp) {
17564
- ref.__cache[e] = changes[e] = elementProp;
17565
- ref[e] = paramsProp;
17759
+ if (paramsProp !== void 0) {
17760
+ element[e] = paramsProp;
17761
+ if (ref && !preventCaching) {
17762
+ ref.__cache[e] = elementProp;
17763
+ }
17764
+ if ((0, import_types.isObject)(opts.diff)) {
17765
+ diff[e] = elementProp;
17766
+ }
17566
17767
  }
17567
17768
  }
17568
- return changes;
17769
+ return element;
17569
17770
  };
17570
17771
  var overwriteShallow3 = (obj, params, excludeFrom = []) => {
17571
17772
  for (const e in params) {
@@ -17575,23 +17776,26 @@ var require_cjs7 = __commonJS({
17575
17776
  }
17576
17777
  return obj;
17577
17778
  };
17578
- var overwriteDeep2 = (obj, params, excludeFrom = [], visited = /* @__PURE__ */ new WeakMap()) => {
17779
+ var overwriteDeep2 = (obj, params, opts = {}, visited = /* @__PURE__ */ new WeakMap()) => {
17780
+ const excl = opts.exclude || [];
17781
+ const forcedExclude = opts.preventForce ? [] : ["node", "window"];
17579
17782
  if (!(0, import_types.isObjectLike)(obj) || !(0, import_types.isObjectLike)(params) || (0, import_node.isDOMNode)(obj) || (0, import_node.isDOMNode)(params)) {
17580
17783
  return params;
17581
17784
  }
17582
- if (visited.has(obj)) {
17785
+ if (visited.has(obj))
17583
17786
  return visited.get(obj);
17584
- }
17585
17787
  visited.set(obj, obj);
17586
17788
  for (const e in params) {
17587
- if (e === "__ref" || excludeFrom.includes(e) || e.startsWith("__"))
17789
+ if (!Object.hasOwnProperty.call(params, e))
17790
+ continue;
17791
+ if (excl.includes(e) || forcedExclude && e.startsWith("__"))
17588
17792
  continue;
17589
17793
  const objProp = obj[e];
17590
17794
  const paramsProp = params[e];
17591
17795
  if ((0, import_node.isDOMNode)(paramsProp)) {
17592
17796
  obj[e] = paramsProp;
17593
17797
  } else if ((0, import_types.isObjectLike)(objProp) && (0, import_types.isObjectLike)(paramsProp)) {
17594
- obj[e] = overwriteDeep2(objProp, paramsProp, excludeFrom, visited);
17798
+ obj[e] = overwriteDeep2(objProp, paramsProp, opts, visited);
17595
17799
  } else if (paramsProp !== void 0) {
17596
17800
  obj[e] = paramsProp;
17597
17801
  }
@@ -17754,6 +17958,30 @@ var require_cjs7 = __commonJS({
17754
17958
  }
17755
17959
  }
17756
17960
  };
17961
+ var isCyclic = (obj) => {
17962
+ const seenObjects = [];
17963
+ function detect(obj2) {
17964
+ if (obj2 && typeof obj2 === "object") {
17965
+ if (seenObjects.indexOf(obj2) !== -1) {
17966
+ return true;
17967
+ }
17968
+ seenObjects.push(obj2);
17969
+ for (const key in obj2) {
17970
+ if (Object.hasOwnProperty.call(obj2, key) && detect(obj2[key])) {
17971
+ console.log(obj2, "cycle at " + key);
17972
+ return true;
17973
+ }
17974
+ }
17975
+ }
17976
+ return false;
17977
+ }
17978
+ return detect(obj);
17979
+ };
17980
+ var excludeKeysFromObject = (obj, excludedKeys) => {
17981
+ const result = { ...obj };
17982
+ excludedKeys.forEach((key) => delete result[key]);
17983
+ return result;
17984
+ };
17757
17985
  }
17758
17986
  });
17759
17987
  var require_function3 = __commonJS2({
@@ -18163,6 +18391,8 @@ var require_cjs7 = __commonJS({
18163
18391
  return /^[a-z]*$/.test(firstCharKey);
18164
18392
  };
18165
18393
  var addAdditionalExtend2 = (newExtend, element) => {
18394
+ if (!newExtend)
18395
+ return element;
18166
18396
  const { extend: elementExtend } = element;
18167
18397
  const originalArray = (0, import__.isArray)(elementExtend) ? elementExtend : [elementExtend];
18168
18398
  const receivedArray = (0, import__.isArray)(newExtend) ? newExtend : [newExtend];
@@ -18170,8 +18400,23 @@ var require_cjs7 = __commonJS({
18170
18400
  return { ...element, extend };
18171
18401
  };
18172
18402
  var checkIfSugar = (element, parent, key) => {
18173
- const { extend, props: props2, childExtend, extends: extendProps, childrenExtends, childProps, children, on: on2, $collection, $stateCollection, $propsCollection } = element;
18403
+ const {
18404
+ extend,
18405
+ props: props2,
18406
+ childExtend,
18407
+ extends: extendProps,
18408
+ childrenExtends,
18409
+ childProps,
18410
+ children,
18411
+ on: on2,
18412
+ $collection,
18413
+ $stateCollection,
18414
+ $propsCollection
18415
+ } = element;
18174
18416
  const hasComponentAttrs = extend || childExtend || props2 || on2 || $collection || $stateCollection || $propsCollection;
18417
+ if (hasComponentAttrs && (childProps || extendProps || children || childrenExtends)) {
18418
+ element.error("Sugar component includes params for builtin components");
18419
+ }
18175
18420
  return !hasComponentAttrs || childProps || extendProps || children || childrenExtends;
18176
18421
  };
18177
18422
  var extendizeByKey = (element, parent, key) => {
@@ -18183,11 +18428,11 @@ var require_cjs7 = __commonJS({
18183
18428
  if (element === isExtendKeyComponent)
18184
18429
  return element;
18185
18430
  else if (isSugar) {
18186
- const newElem = {
18431
+ const newElem = addAdditionalExtend2(element.extends, {
18187
18432
  extend: extendFromKey,
18188
18433
  tag,
18189
18434
  props: { ...element }
18190
- };
18435
+ });
18191
18436
  if (childrenExtends)
18192
18437
  newElem.childExtend = childrenExtends;
18193
18438
  return newElem;
@@ -18694,7 +18939,7 @@ var require_utilImports = __commonJS({
18694
18939
  __export2(utilImports_exports, {
18695
18940
  applyCSS: () => import_init2.applyCSS,
18696
18941
  init: () => import_init2.init,
18697
- reInit: () => import_init2.reInit,
18942
+ reinit: () => import_init2.reinit,
18698
18943
  scratchSystem: () => import_scratch12.scratchSystem,
18699
18944
  scratchUtils: () => import_scratch12.scratchUtils,
18700
18945
  set: () => import_scratch12.set
@@ -19470,30 +19715,35 @@ var require_create3 = __commonJS({
19470
19715
  var import_ignore = require_ignore2();
19471
19716
  var import_inherit = require_inherit2();
19472
19717
  var createPropsStack = (element, parent) => {
19473
- const { props: props2, __ref } = element;
19474
- const propsStack = __ref.__props = (0, import_inherit.inheritParentProps)(element, parent);
19718
+ const { props: props2, __ref: ref } = element;
19719
+ const propsStack = ref.__props = (0, import_inherit.inheritParentProps)(element, parent);
19475
19720
  if ((0, import_utils25.isObject)(props2))
19476
19721
  propsStack.push(props2);
19477
19722
  else if (props2 === "inherit" && parent.props)
19478
19723
  propsStack.push(parent.props);
19479
19724
  else if (props2)
19480
19725
  propsStack.push(props2);
19481
- if ((0, import_utils25.isArray)(__ref.__extend)) {
19482
- __ref.__extend.forEach((extend) => {
19726
+ if ((0, import_utils25.isArray)(ref.__extend)) {
19727
+ ref.__extend.forEach((extend) => {
19483
19728
  if (extend.props && extend.props !== props2)
19484
19729
  propsStack.push(extend.props);
19485
19730
  });
19486
19731
  }
19487
- __ref.__props = propsStack;
19732
+ ref.__props = propsStack;
19488
19733
  return propsStack;
19489
19734
  };
19490
- var syncProps = (props2, element) => {
19735
+ var syncProps = (props2, element, opts) => {
19491
19736
  element.props = {};
19492
19737
  const mergedProps = {};
19493
19738
  props2.forEach((v) => {
19494
19739
  if (import_ignore.IGNORE_PROPS_PARAMS.includes(v))
19495
19740
  return;
19496
- const execProps = (0, import_utils25.exec)(v, element);
19741
+ let execProps;
19742
+ try {
19743
+ execProps = (0, import_utils25.exec)(v, element);
19744
+ } catch (e) {
19745
+ element.error(e, opts);
19746
+ }
19497
19747
  element.props = (0, import_utils25.deepMerge)(
19498
19748
  mergedProps,
19499
19749
  (0, import_utils25.deepCloneWithExtend)(execProps, import_ignore.IGNORE_PROPS_PARAMS),
@@ -19505,15 +19755,15 @@ var require_create3 = __commonJS({
19505
19755
  Object.setPrototypeOf(element.props, methods);
19506
19756
  return element.props;
19507
19757
  };
19508
- var createProps = function(element, parent, cached) {
19758
+ var createProps = function(element, parent, options) {
19509
19759
  const { __ref: ref } = element;
19510
19760
  const applyProps = () => {
19511
- const propsStack = cached || createPropsStack(element, parent);
19761
+ const propsStack = options.cachedProps || createPropsStack(element, parent);
19512
19762
  if (propsStack.length) {
19513
19763
  ref.__props = propsStack;
19514
19764
  syncProps(propsStack, element);
19515
19765
  } else {
19516
- ref.__props = cached || [];
19766
+ ref.__props = options.cachedProps || [];
19517
19767
  element.props = {};
19518
19768
  }
19519
19769
  };
@@ -19524,7 +19774,7 @@ var require_create3 = __commonJS({
19524
19774
  applyProps();
19525
19775
  } catch {
19526
19776
  element.props = {};
19527
- ref.__props = cached || [];
19777
+ ref.__props = options.cachedProps || [];
19528
19778
  }
19529
19779
  }
19530
19780
  const methods = { update: update.bind(element.props), __element: element };
@@ -20554,8 +20804,8 @@ var require_data = __commonJS({
20554
20804
  var import_report = require_cjs3();
20555
20805
  var data_default = (params, element, node3) => {
20556
20806
  if (params) {
20557
- if (element.props.attr)
20558
- (0, import_utils25.deepMerge)(params, element.props.attr);
20807
+ if (element.props.data)
20808
+ (0, import_utils25.deepMerge)(params, element.props.data);
20559
20809
  if (params.showOnNode) {
20560
20810
  if (!(0, import_utils25.isObject)(params))
20561
20811
  (0, import_report.report)("HTMLInvalidData", params);
@@ -20988,6 +21238,7 @@ var require_methods2 = __commonJS({
20988
21238
  __export2(methods_exports, {
20989
21239
  METHODS: () => METHODS,
20990
21240
  defineSetter: () => defineSetter,
21241
+ error: () => error,
20991
21242
  get: () => get,
20992
21243
  isMethod: () => isMethod,
20993
21244
  keys: () => keys,
@@ -21003,13 +21254,16 @@ var require_methods2 = __commonJS({
21003
21254
  setNodeStyles: () => setNodeStyles,
21004
21255
  setProps: () => setProps,
21005
21256
  spotByPath: () => spotByPath,
21006
- variables: () => variables
21257
+ variables: () => variables,
21258
+ verbose: () => verbose,
21259
+ warn: () => warn
21007
21260
  });
21008
21261
  module2.exports = __toCommonJS2(methods_exports);
21009
21262
  var import_utils25 = require_cjs();
21010
21263
  var import_tree = require_tree();
21011
21264
  var import_mixins = require_mixins();
21012
- var spotByPath = function(path) {
21265
+ var ENV2 = "development";
21266
+ function spotByPath(path) {
21013
21267
  const element = this;
21014
21268
  const arr = [].concat(path);
21015
21269
  let active = import_tree.TREE[arr[0]];
@@ -21024,8 +21278,8 @@ var require_methods2 = __commonJS({
21024
21278
  return;
21025
21279
  }
21026
21280
  return active;
21027
- };
21028
- var lookup3 = function(param) {
21281
+ }
21282
+ function lookup3(param) {
21029
21283
  const el = this;
21030
21284
  let { parent } = el;
21031
21285
  if ((0, import_utils25.isFunction)(param)) {
@@ -21046,8 +21300,8 @@ var require_methods2 = __commonJS({
21046
21300
  return;
21047
21301
  }
21048
21302
  return parent;
21049
- };
21050
- var lookdown = function(param) {
21303
+ }
21304
+ function lookdown(param) {
21051
21305
  var _a;
21052
21306
  const el = this;
21053
21307
  const { __ref: ref } = el;
@@ -21067,9 +21321,8 @@ var require_methods2 = __commonJS({
21067
21321
  if (lookdown2)
21068
21322
  return lookdown2;
21069
21323
  }
21070
- return null;
21071
- };
21072
- var lookdownAll = function(param, results = []) {
21324
+ }
21325
+ function lookdownAll(param, results = []) {
21073
21326
  var _a;
21074
21327
  const el = this;
21075
21328
  const { __ref: ref } = el;
@@ -21086,9 +21339,9 @@ var require_methods2 = __commonJS({
21086
21339
  }
21087
21340
  (_a = childElem == null ? void 0 : childElem.lookdownAll) == null ? void 0 : _a.call(childElem, param, results);
21088
21341
  }
21089
- return results.length ? results : null;
21090
- };
21091
- var setNodeStyles = function(params = {}) {
21342
+ return results.length ? results : void 0;
21343
+ }
21344
+ function setNodeStyles(params = {}) {
21092
21345
  var _a;
21093
21346
  const el = this;
21094
21347
  if (!((_a = el.node) == null ? void 0 : _a.style))
@@ -21102,8 +21355,8 @@ var require_methods2 = __commonJS({
21102
21355
  el.node.style[param] = value2;
21103
21356
  }
21104
21357
  return el;
21105
- };
21106
- var remove = function() {
21358
+ }
21359
+ function remove() {
21107
21360
  const element = this;
21108
21361
  if ((0, import_utils25.isFunction)(element.node.remove))
21109
21362
  element.node.remove();
@@ -21114,31 +21367,31 @@ var require_methods2 = __commonJS({
21114
21367
  delete element.parent[element.key];
21115
21368
  if (element.parent.__ref)
21116
21369
  element.parent.__ref.__children = (0, import_utils25.removeValueFromArray)(element.parent.__ref.__children, element.key);
21117
- };
21118
- var get = function(param) {
21370
+ }
21371
+ function get(param) {
21119
21372
  const element = this;
21120
21373
  return element[param];
21121
- };
21122
- var setProps = function(param, options) {
21374
+ }
21375
+ function setProps(param, options) {
21123
21376
  const element = this;
21124
21377
  if (!param || !element.props)
21125
21378
  return;
21126
21379
  element.update({ props: param }, options);
21127
21380
  return element;
21128
- };
21381
+ }
21129
21382
  var defineSetter = (element, key, get2, set2) => Object.defineProperty(element, key, { get: get2, set: set2 });
21130
- var keys = function() {
21383
+ function keys() {
21131
21384
  const element = this;
21132
21385
  const keys2 = [];
21133
21386
  for (const param in element) {
21134
- if (import_mixins.registry[param] && !import_mixins.parseFilters.elementKeys.includes(param)) {
21387
+ if (import_mixins.registry[param] && !import_mixins.parseFilters.elementKeys.includes(param) || Object.hasOwnProperty.call(element, param)) {
21135
21388
  continue;
21136
21389
  }
21137
21390
  keys2.push(param);
21138
21391
  }
21139
21392
  return keys2;
21140
- };
21141
- var parse4 = function(excl = []) {
21393
+ }
21394
+ function parse4(excl = []) {
21142
21395
  const element = this;
21143
21396
  const obj = {};
21144
21397
  const keyList = keys.call(element);
@@ -21158,12 +21411,12 @@ var require_methods2 = __commonJS({
21158
21411
  } else if (v === "props") {
21159
21412
  const { __element, update, ...props2 } = element[v];
21160
21413
  obj[v] = props2;
21161
- } else if ((0, import_utils25.isDefined)(val))
21414
+ } else if ((0, import_utils25.isDefined)(val) && Object.hasOwnProperty.call(element, v))
21162
21415
  obj[v] = val;
21163
21416
  });
21164
21417
  return obj;
21165
- };
21166
- var parseDeep = function(excl = []) {
21418
+ }
21419
+ function parseDeep(excl = []) {
21167
21420
  const element = this;
21168
21421
  const obj = parse4.call(element, excl);
21169
21422
  for (const v in obj) {
@@ -21174,32 +21427,52 @@ var require_methods2 = __commonJS({
21174
21427
  }
21175
21428
  }
21176
21429
  return obj;
21177
- };
21178
- var log = function(...args) {
21430
+ }
21431
+ function verbose(...args) {
21432
+ if (ENV2 !== "test" && ENV2 !== "development")
21433
+ return;
21179
21434
  const element = this;
21180
- const { __ref } = element;
21181
- console.group(element.key);
21435
+ const { __ref: ref } = element;
21436
+ console.groupCollapsed(element.key);
21182
21437
  if (args.length) {
21183
21438
  args.forEach((v) => console.log(`%c${v}:
21184
21439
  `, "font-weight: bold", element[v]));
21185
21440
  } else {
21186
- console.log(__ref.path);
21441
+ console.log(ref.path);
21187
21442
  const keys2 = element.keys();
21188
21443
  keys2.forEach((v) => console.log(`%c${v}:
21189
21444
  `, "font-weight: bold", element[v]));
21190
21445
  }
21191
21446
  console.groupEnd(element.key);
21192
21447
  return element;
21193
- };
21194
- var nextElement = function() {
21448
+ }
21449
+ function log(...params) {
21450
+ if (ENV2 === "test" || ENV2 === "development") {
21451
+ console.log(...params);
21452
+ }
21453
+ }
21454
+ function warn(...params) {
21455
+ if (ENV2 === "test" || ENV2 === "development") {
21456
+ console.warn(...params);
21457
+ }
21458
+ }
21459
+ function error(...params) {
21460
+ var _a;
21461
+ if (ENV2 === "test" || ENV2 === "development") {
21462
+ if ((_a = params[params.length - 1]) == null ? void 0 : _a.debugger)
21463
+ debugger;
21464
+ console.error(...params);
21465
+ }
21466
+ }
21467
+ function nextElement() {
21195
21468
  const element = this;
21196
21469
  const { key, parent } = element;
21197
21470
  const { __children } = parent.__ref;
21198
21471
  const currentIndex = __children.indexOf(key);
21199
21472
  const nextChild = __children[currentIndex + 1];
21200
21473
  return parent[nextChild];
21201
- };
21202
- var previousElement = function(el) {
21474
+ }
21475
+ function previousElement(el) {
21203
21476
  const element = el || this;
21204
21477
  const { key, parent } = element;
21205
21478
  const { __children } = parent.__ref;
@@ -21207,8 +21480,8 @@ var require_methods2 = __commonJS({
21207
21480
  return;
21208
21481
  const currentIndex = __children.indexOf(key);
21209
21482
  return parent[__children[currentIndex - 1]];
21210
- };
21211
- var variables = function(obj = {}) {
21483
+ }
21484
+ function variables(obj = {}) {
21212
21485
  const element = this;
21213
21486
  if (!element.data)
21214
21487
  element.data = {};
@@ -21242,7 +21515,7 @@ var require_methods2 = __commonJS({
21242
21515
  }, timeout);
21243
21516
  }
21244
21517
  };
21245
- };
21518
+ }
21246
21519
  var METHODS = [
21247
21520
  "set",
21248
21521
  "reset",
@@ -21262,13 +21535,16 @@ var require_methods2 = __commonJS({
21262
21535
  "variables",
21263
21536
  "if",
21264
21537
  "log",
21538
+ "verbose",
21539
+ "warn",
21540
+ "error",
21265
21541
  "nextElement",
21266
21542
  "previousElement"
21267
21543
  ];
21268
- var isMethod = function(param, element) {
21544
+ function isMethod(param, element) {
21269
21545
  var _a, _b;
21270
21546
  return METHODS.includes(param) || ((_b = (_a = element == null ? void 0 : element.context) == null ? void 0 : _a.methods) == null ? void 0 : _b[param]);
21271
- };
21547
+ }
21272
21548
  }
21273
21549
  });
21274
21550
 
@@ -21698,7 +21974,7 @@ var require_update2 = __commonJS({
21698
21974
  if (beforeUpdateReturns === false)
21699
21975
  return element;
21700
21976
  }
21701
- (0, import_utils25.overwriteDeep)(element, params, import_utils26.METHODS_EXL);
21977
+ (0, import_utils25.overwriteDeep)(element, params, { exclude: import_utils26.METHODS_EXL });
21702
21978
  (0, import_iterate.throughExecProps)(element);
21703
21979
  (0, import_iterate.throughUpdatedExec)(element, { ignore: UPDATE_DEFAULT_OPTIONS });
21704
21980
  (0, import_iterate.throughUpdatedDefine)(element);
@@ -21917,7 +22193,7 @@ var require_set2 = __commonJS({
21917
22193
  var import_update = __toESM2(require_update2(), 1);
21918
22194
  var import__ = require_methods2();
21919
22195
  var import_content = require_content();
21920
- var addMethods = (element, parent, options) => {
22196
+ var addMethods = (element, parent, options = {}) => {
21921
22197
  const proto = {
21922
22198
  set: import_set.default,
21923
22199
  reset: import_set.reset,
@@ -21936,12 +22212,14 @@ var require_set2 = __commonJS({
21936
22212
  parseDeep: import__.parseDeep,
21937
22213
  keys: import__.keys,
21938
22214
  nextElement: import__.nextElement,
21939
- previousElement: import__.previousElement
22215
+ previousElement: import__.previousElement,
22216
+ log: import__.log,
22217
+ verbose: import__.verbose,
22218
+ warn: import__.warn,
22219
+ error: import__.error
21940
22220
  };
21941
22221
  if (element.context.methods)
21942
- (0, import_utils25.merge)(proto, element.context.methods);
21943
- if ((0, import_utils25.isDevelopment)())
21944
- proto.log = import__.log;
22222
+ (options.strict ? import_utils25.merge : import_utils25.overwrite)(proto, element.context.methods);
21945
22223
  Object.setPrototypeOf(element, proto);
21946
22224
  };
21947
22225
  }
@@ -22020,13 +22298,13 @@ var require_create4 = __commonJS({
22020
22298
  }
22021
22299
  switchDefaultOptions(element, parent, options);
22022
22300
  addCaching(element, parent);
22023
- (0, import_set.addMethods)(element, parent);
22301
+ (0, import_set.addMethods)(element, parent, options);
22024
22302
  createScope(element, parent);
22025
22303
  (0, import_state2.createState)(element, parent);
22026
22304
  if (element.scope === "state")
22027
22305
  element.scope = element.state;
22028
22306
  createIfConditionFlag(element, parent);
22029
- (0, import_props.createProps)(element, parent);
22307
+ (0, import_props.createProps)(element, parent, options);
22030
22308
  if (element.scope === "props" || element.scope === true)
22031
22309
  element.scope = element.props;
22032
22310
  createIfConditionFlag(element, parent);
@@ -22121,7 +22399,7 @@ var require_create4 = __commonJS({
22121
22399
  };
22122
22400
  var visitedElements = /* @__PURE__ */ new WeakMap();
22123
22401
  var renderElement = (element, parent, options, attachOptions) => {
22124
- var _a, _b;
22402
+ var _a, _b, _c, _d;
22125
22403
  if (visitedElements.has(element)) {
22126
22404
  if (ENV2 === "test" || ENV2 === "development")
22127
22405
  console.warn("Cyclic rendering detected:", element.__ref.path);
@@ -22142,9 +22420,13 @@ var require_create4 = __commonJS({
22142
22420
  if (path.includes("demoComponent"))
22143
22421
  path.splice(0, path.indexOf("demoComponent") + 1);
22144
22422
  const isDemoComponent = (_b = (_a = element.lookup((el) => el.state.key)) == null ? void 0 : _a.state) == null ? void 0 : _b.key;
22145
- console.warn("Error happened in:", isDemoComponent ? isDemoComponent + " " : "" + path.join("."));
22146
- console.warn(element);
22147
- console.error(e);
22423
+ element.warn("Error happened in:", isDemoComponent ? isDemoComponent + " " : "" + path.join("."));
22424
+ element.verbose();
22425
+ element.error(e, options);
22426
+ if ((_c = element.on) == null ? void 0 : _c.error)
22427
+ element.on.error(e, element, element.state, element.context, options);
22428
+ if ((_d = element.props) == null ? void 0 : _d.onError)
22429
+ element.props.onError(e, element, element.state, element.context, options);
22148
22430
  }
22149
22431
  }
22150
22432
  if (!ref.__if) {
@@ -22225,13 +22507,13 @@ var require_create4 = __commonJS({
22225
22507
  const { __ref: ref } = element;
22226
22508
  if (!ref.__skipCreate) {
22227
22509
  addCaching(element, parent);
22228
- (0, import_set.addMethods)(element, parent);
22510
+ (0, import_set.addMethods)(element, parent, options);
22229
22511
  createScope(element, parent);
22230
22512
  (0, import_state2.createState)(element, parent);
22231
22513
  if (element.scope === "state")
22232
22514
  element.scope = element.state;
22233
22515
  createIfConditionFlag(element, parent);
22234
- (0, import_props.createProps)(element, parent);
22516
+ (0, import_props.createProps)(element, parent, options);
22235
22517
  if (element.scope === "props" || element.scope === true)
22236
22518
  element.scope = element.props;
22237
22519
  if (element.node && ref.__if) {
@@ -30060,7 +30342,7 @@ __export(smbls_exports, {
30060
30342
  getSystemGlobalTheme: () => getSystemGlobalTheme,
30061
30343
  init: () => init,
30062
30344
  keySetters: () => keySetters,
30063
- reInit: () => reInit,
30345
+ reinit: () => reinit,
30064
30346
  setClass: () => setClass,
30065
30347
  updateVars: () => updateVars
30066
30348
  });