tutuca 0.9.9 → 0.9.11

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.
@@ -2639,13 +2639,13 @@ function hasIterator(maybeIterable) {
2639
2639
  }
2640
2640
  return !!getIteratorFn(maybeIterable);
2641
2641
  }
2642
- var isIterator = (maybeIterator) => !!(maybeIterator && typeof maybeIterator.next === "function");
2642
+ var isIterator = (maybeIterator) => typeof maybeIterator?.next === "function";
2643
2643
  function getIterator(iterable) {
2644
2644
  const iteratorFn = getIteratorFn(iterable);
2645
2645
  return iteratorFn?.call(iterable);
2646
2646
  }
2647
2647
  function getIteratorFn(iterable) {
2648
- const iteratorFn = iterable && iterable[Symbol.iterator];
2648
+ const iteratorFn = iterable?.[Symbol.iterator];
2649
2649
  if (typeof iteratorFn === "function") {
2650
2650
  return iteratorFn;
2651
2651
  }
@@ -2740,12 +2740,10 @@ function flipFactory(collection) {
2740
2740
  flipSequence.__iterate = function(fn, reverse) {
2741
2741
  return collection.__iterate((v, k) => fn(k, v, this), reverse);
2742
2742
  };
2743
- flipSequence.__iteratorUncached = function(reverse) {
2744
- return mapEntries(collection.__iterator(reverse), (k, v, entry) => {
2745
- entry[0] = v;
2746
- entry[1] = k;
2747
- });
2748
- };
2743
+ flipSequence.__iteratorUncached = (reverse) => mapEntries(collection.__iterator(reverse), (k, v, entry) => {
2744
+ entry[0] = v;
2745
+ entry[1] = k;
2746
+ });
2749
2747
  return flipSequence;
2750
2748
  }
2751
2749
  function mapFactory(collection, mapper, context) {
@@ -2759,12 +2757,10 @@ function mapFactory(collection, mapper, context) {
2759
2757
  mappedSequence.__iterate = function(fn, reverse) {
2760
2758
  return collection.__iterate((v, k) => fn(mapper.call(context, v, k, collection), k, this), reverse);
2761
2759
  };
2762
- mappedSequence.__iteratorUncached = function(reverse) {
2763
- return mapEntries(collection.__iterator(reverse), (k, v, entry) => {
2764
- entry[0] = k;
2765
- entry[1] = mapper.call(context, v, k, collection);
2766
- });
2767
- };
2760
+ mappedSequence.__iteratorUncached = (reverse) => mapEntries(collection.__iterator(reverse), (k, v, entry) => {
2761
+ entry[0] = k;
2762
+ entry[1] = mapper.call(context, v, k, collection);
2763
+ });
2768
2764
  return mappedSequence;
2769
2765
  }
2770
2766
  function reverseFactory(collection, useKeys) {
@@ -2917,7 +2913,7 @@ function maxFactory(collection, comparator, mapper) {
2917
2913
  }
2918
2914
  if (mapper) {
2919
2915
  const entry = collection.toSeq().map((v, k) => [v, mapper(v, k, collection)]).reduce((a, b) => maxCompare(comparator, a[1], b[1]) ? b : a);
2920
- return entry && entry[0];
2916
+ return entry?.[0];
2921
2917
  }
2922
2918
  return collection.reduce((a, b) => maxCompare(comparator, a, b) ? b : a);
2923
2919
  }
@@ -3522,7 +3518,7 @@ class CollectionImpl {
3522
3518
  }
3523
3519
  findKey(predicate, context) {
3524
3520
  const entry = this.findEntry(predicate, context);
3525
- return entry && entry[0];
3521
+ return entry?.[0];
3526
3522
  }
3527
3523
  findLast(predicate, context, notSetValue) {
3528
3524
  return this.toKeyedSeq().reverse().find(predicate, context, notSetValue);
@@ -5114,7 +5110,11 @@ function shallowCopy(from) {
5114
5110
  ...from
5115
5111
  };
5116
5112
  }
5113
+ var merge$1 = (collection, ...sources) => mergeWithSources(collection, sources);
5114
+ var mergeWith$1 = (merger, collection, ...sources) => mergeWithSources(collection, sources, merger);
5117
5115
  var mergeDeepWithSources = (collection, sources, merger) => mergeWithSources(collection, sources, deepMergerWith(merger));
5116
+ var mergeDeep$1 = (collection, ...sources) => mergeDeepWithSources(collection, sources);
5117
+ var mergeDeepWith$1 = (merger, collection, ...sources) => mergeDeepWithSources(collection, sources, merger);
5118
5118
  function mergeWithSources(collection, sources, merger) {
5119
5119
  if (!isDataStructure(collection)) {
5120
5120
  throw new TypeError(`Cannot merge into non-data-structure value: ${collection}`);
@@ -5386,7 +5386,7 @@ class ListImpl extends IndexedCollectionImpl {
5386
5386
  if (index >= 0 && index < this.size) {
5387
5387
  index += this._origin;
5388
5388
  const node = listNodeFor(this, index);
5389
- return node && node.array[index & MASK];
5389
+ return node?.array[index & MASK];
5390
5390
  }
5391
5391
  return notSetValue;
5392
5392
  }
@@ -5617,7 +5617,7 @@ function iterateList(list, reverse) {
5617
5617
  function pushFrame(node, level, offset) {
5618
5618
  if (level === 0) {
5619
5619
  const array = offset === tailPos ? tail?.array : node?.array;
5620
- let from = offset > left ? 0 : left - offset;
5620
+ const from = offset > left ? 0 : left - offset;
5621
5621
  let to = right - offset;
5622
5622
  if (to > SIZE) {
5623
5623
  to = SIZE;
@@ -5632,7 +5632,7 @@ function iterateList(list, reverse) {
5632
5632
  }
5633
5633
  } else {
5634
5634
  const array = node?.array;
5635
- let from = offset > left ? 0 : left - offset >> level;
5635
+ const from = offset > left ? 0 : left - offset >> level;
5636
5636
  let to = (right - offset >> level) + 1;
5637
5637
  if (to > SIZE) {
5638
5638
  to = SIZE;
@@ -5734,7 +5734,7 @@ function updateVNode(node, ownerID, level, index, value, didAlter) {
5734
5734
  }
5735
5735
  let newNode;
5736
5736
  if (level > 0) {
5737
- const lowerNode = node && node.array[idx];
5737
+ const lowerNode = node?.array[idx];
5738
5738
  const newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter);
5739
5739
  if (newLowerNode === lowerNode) {
5740
5740
  return node;
@@ -5827,14 +5827,14 @@ function setListBounds(list, begin, end) {
5827
5827
  node.array[oldTailOffset >>> SHIFT & MASK] = oldTail;
5828
5828
  }
5829
5829
  if (newCapacity < oldCapacity) {
5830
- newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
5830
+ newTail = newTail?.removeAfter(owner, 0, newCapacity);
5831
5831
  }
5832
5832
  if (newOrigin >= newTailOffset) {
5833
5833
  newOrigin -= newTailOffset;
5834
5834
  newCapacity -= newTailOffset;
5835
5835
  newLevel = SHIFT;
5836
5836
  newRoot = null;
5837
- newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
5837
+ newTail = newTail?.removeBefore(owner, 0, newOrigin);
5838
5838
  } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
5839
5839
  offsetShift = 0;
5840
5840
  while (newRoot) {
@@ -6402,6 +6402,10 @@ class OrderedSetImpl extends SetImpl {
6402
6402
  OrderedSet.isOrderedSet = isOrderedSet;
6403
6403
  var makeOrderedSet = (map, ownerID) => new OrderedSetImpl(map, ownerID);
6404
6404
  var emptyOrderedSet = () => makeOrderedSet(emptyOrderedMap());
6405
+ var PairSorting = {
6406
+ LeftThenRight: -1,
6407
+ RightThenLeft: 1
6408
+ };
6405
6409
  function throwOnInvalidDefaultValues(defaultValues) {
6406
6410
  if (isRecord(defaultValues)) {
6407
6411
  throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");
@@ -6735,6 +6739,11 @@ class RangeImpl extends IndexedSeqImpl {
6735
6739
  this.prototype[Symbol.iterator] = this.prototype.values;
6736
6740
  }
6737
6741
  }
6742
+ var Repeat = (value, times) => {
6743
+ const size = times === undefined ? Infinity : Math.max(0, times);
6744
+ return new RepeatImpl(value, size);
6745
+ };
6746
+
6738
6747
  class RepeatImpl extends IndexedSeqImpl {
6739
6748
  constructor(value, size) {
6740
6749
  super();
@@ -6821,6 +6830,28 @@ class RepeatImpl extends IndexedSeqImpl {
6821
6830
  this.prototype[Symbol.iterator] = this.prototype.values;
6822
6831
  }
6823
6832
  }
6833
+ var fromJS = (value, converter) => fromJSWith([], converter ?? defaultConverter, value, "", converter?.length > 2 ? [] : undefined, {
6834
+ "": value
6835
+ });
6836
+ function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
6837
+ if (typeof value !== "string" && !isImmutable(value) && (isArrayLike(value) || hasIterator(value) || isPlainObject(value))) {
6838
+ if (stack.includes(value)) {
6839
+ throw new TypeError("Cannot convert circular structure to Immutable");
6840
+ }
6841
+ stack.push(value);
6842
+ if (keyPath && key !== "") {
6843
+ keyPath.push(key);
6844
+ }
6845
+ const converted = converter.call(parentValue, key, Seq(value).map((v, k) => fromJSWith(stack, converter, v, k, keyPath, value)), keyPath?.slice());
6846
+ stack.pop();
6847
+ if (keyPath) {
6848
+ keyPath.pop();
6849
+ }
6850
+ return converted;
6851
+ }
6852
+ return value;
6853
+ }
6854
+ var defaultConverter = (k, v) => isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
6824
6855
  var asValues = (collection) => isKeyed(collection) ? collection.valueSeq() : collection;
6825
6856
  function initCollectionConversions() {
6826
6857
  CollectionImpl.prototype.toMap = function toMap() {
@@ -6876,7 +6907,12 @@ function initCollectionConversions() {
6876
6907
  return OrderedSet(sortFactory(this, comparator, mapper));
6877
6908
  };
6878
6909
  }
6910
+ var version$1 = "7.0.0";
6911
+ var pkg = {
6912
+ version: version$1
6913
+ };
6879
6914
  initCollectionConversions();
6915
+ var { version } = pkg;
6880
6916
 
6881
6917
  // src/oo.js
6882
6918
  var BAD_VALUE = Symbol("BadValue");
@@ -7916,8 +7952,8 @@ async function compileClassesToStyle(app, compileClasses, styleId = "margaui-css
7916
7952
  injectCss(styleId, css2);
7917
7953
  return t2 - t1;
7918
7954
  }
7919
- async function compileClassesToStyleText(app, compileClasses, extraCSSClasses) {
7920
- app.ParseContext = ParseCtxClassSetCollector;
7955
+ async function compileClassesToStyleText(app, compileClasses, extraCSSClasses, Ctx = ParseCtxClassSetCollector) {
7956
+ app.ParseContext = Ctx;
7921
7957
  app.compile();
7922
7958
  const classes = new Set(extraCSSClasses ?? []);
7923
7959
  for (const Comp of app.comps.byId.values()) {
@@ -8153,19 +8189,67 @@ class LintParseContext extends ParseContext {
8153
8189
  this.attrs.push({ attrs, wrapperAttrs, textChild });
8154
8190
  }
8155
8191
  }
8192
+ // dev.js
8193
+ class LintClassCollectorCtx extends ParseCtxClassSetCollector {
8194
+ constructor(...args) {
8195
+ super(...args);
8196
+ this.attrs = [];
8197
+ }
8198
+ enterMacro(macroName, macroVars, macroSlots) {
8199
+ const { DOMParser: DP, Text, Comment, nodes, events, macroNodes } = this;
8200
+ const frame = { macroName, macroVars, macroSlots };
8201
+ const v = new LintClassCollectorCtx(DP, Text, Comment, nodes, events, macroNodes, frame, this);
8202
+ v.classes = this.classes;
8203
+ v.attrs = this.attrs;
8204
+ return v;
8205
+ }
8206
+ onAttributes(attrs, wrapperAttrs, textChild) {
8207
+ super.onAttributes(attrs, wrapperAttrs, textChild);
8208
+ this.attrs.push({ attrs, wrapperAttrs, textChild });
8209
+ }
8210
+ }
8156
8211
  export {
8212
+ version,
8213
+ updateIn$1 as updateIn,
8214
+ update$1 as update,
8157
8215
  tutuca,
8216
+ setIn$1 as setIn,
8217
+ set,
8158
8218
  seqInfoByClass,
8219
+ removeIn,
8220
+ remove,
8221
+ mergeWith$1 as mergeWith,
8222
+ mergeDeepWith$1 as mergeDeepWith,
8223
+ mergeDeep$1 as mergeDeep,
8224
+ merge$1 as merge,
8159
8225
  macro,
8226
+ isValueObject,
8227
+ isStack,
8228
+ isSet,
8229
+ isSeq,
8230
+ isRecord,
8231
+ isPlainObject,
8232
+ isOrderedSet,
8160
8233
  isOrderedMap,
8234
+ isOrdered,
8161
8235
  isOrderedMap as isOMap,
8162
8236
  isMap,
8163
8237
  isList,
8164
8238
  isKeyed,
8165
8239
  isIndexed,
8240
+ isImmutable,
8166
8241
  isMap as isIMap,
8242
+ isCollection,
8243
+ isAssociative,
8244
+ is,
8167
8245
  injectCss,
8168
8246
  html,
8247
+ hash,
8248
+ hasIn$1 as hasIn,
8249
+ has,
8250
+ getIn$1 as getIn,
8251
+ get,
8252
+ fromJS,
8169
8253
  fieldsByClass,
8170
8254
  css,
8171
8255
  component,
@@ -8177,13 +8261,23 @@ export {
8177
8261
  UNKNOWN_HANDLER_ARG_NAME,
8178
8262
  UNKNOWN_EVENT_MODIFIER,
8179
8263
  UNKNOWN_COMPONENT_NAME,
8264
+ Stack2 as Stack,
8265
+ Set2 as Set,
8266
+ Seq,
8267
+ Repeat,
8180
8268
  Record,
8269
+ Range,
8181
8270
  RENDER_IT_OUTSIDE_OF_LOOP,
8182
8271
  ParseContext,
8272
+ PairSorting,
8273
+ OrderedSet,
8274
+ OrderedMap,
8183
8275
  OrderedMap as OMap,
8276
+ Map2 as Map,
8184
8277
  List,
8185
8278
  LintParseContext,
8186
8279
  LintContext,
8280
+ LintClassCollectorCtx,
8187
8281
  LEVEL_WARN,
8188
8282
  LEVEL_HINT,
8189
8283
  LEVEL_ERROR,
@@ -8195,5 +8289,6 @@ export {
8195
8289
  INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD,
8196
8290
  Map2 as IMap,
8197
8291
  FIELD_VAL_NOT_DEFINED,
8292
+ Collection,
8198
8293
  COMPUTED_VAL_NOT_DEFINED
8199
8294
  };