tutuca 0.9.8 → 0.9.10

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.
@@ -5114,7 +5114,11 @@ function shallowCopy(from) {
5114
5114
  ...from
5115
5115
  };
5116
5116
  }
5117
+ var merge$1 = (collection, ...sources) => mergeWithSources(collection, sources);
5118
+ var mergeWith$1 = (merger, collection, ...sources) => mergeWithSources(collection, sources, merger);
5117
5119
  var mergeDeepWithSources = (collection, sources, merger) => mergeWithSources(collection, sources, deepMergerWith(merger));
5120
+ var mergeDeep$1 = (collection, ...sources) => mergeDeepWithSources(collection, sources);
5121
+ var mergeDeepWith$1 = (merger, collection, ...sources) => mergeDeepWithSources(collection, sources, merger);
5118
5122
  function mergeWithSources(collection, sources, merger) {
5119
5123
  if (!isDataStructure(collection)) {
5120
5124
  throw new TypeError(`Cannot merge into non-data-structure value: ${collection}`);
@@ -6402,6 +6406,10 @@ class OrderedSetImpl extends SetImpl {
6402
6406
  OrderedSet.isOrderedSet = isOrderedSet;
6403
6407
  var makeOrderedSet = (map, ownerID) => new OrderedSetImpl(map, ownerID);
6404
6408
  var emptyOrderedSet = () => makeOrderedSet(emptyOrderedMap());
6409
+ var PairSorting = {
6410
+ LeftThenRight: -1,
6411
+ RightThenLeft: 1
6412
+ };
6405
6413
  function throwOnInvalidDefaultValues(defaultValues) {
6406
6414
  if (isRecord(defaultValues)) {
6407
6415
  throw new Error("Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.");
@@ -6427,6 +6435,7 @@ var Record = (defaultValues, name) => {
6427
6435
  hasInitialized = true;
6428
6436
  const keys = Object.keys(defaultValues);
6429
6437
  const indices = RecordTypePrototype._indices = {};
6438
+ RecordTypePrototype._name = name;
6430
6439
  RecordTypePrototype._keys = keys;
6431
6440
  RecordTypePrototype._defaultValues = defaultValues;
6432
6441
  for (let i = 0;i < keys.length; i++) {
@@ -6734,6 +6743,11 @@ class RangeImpl extends IndexedSeqImpl {
6734
6743
  this.prototype[Symbol.iterator] = this.prototype.values;
6735
6744
  }
6736
6745
  }
6746
+ var Repeat = (value, times) => {
6747
+ const size = times === undefined ? Infinity : Math.max(0, times);
6748
+ return new RepeatImpl(value, size);
6749
+ };
6750
+
6737
6751
  class RepeatImpl extends IndexedSeqImpl {
6738
6752
  constructor(value, size) {
6739
6753
  super();
@@ -6820,6 +6834,89 @@ class RepeatImpl extends IndexedSeqImpl {
6820
6834
  this.prototype[Symbol.iterator] = this.prototype.values;
6821
6835
  }
6822
6836
  }
6837
+ var fromJS = (value, converter) => fromJSWith([], converter ?? defaultConverter, value, "", converter?.length > 2 ? [] : undefined, {
6838
+ "": value
6839
+ });
6840
+ function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
6841
+ if (typeof value !== "string" && !isImmutable(value) && (isArrayLike(value) || hasIterator(value) || isPlainObject(value))) {
6842
+ if (stack.includes(value)) {
6843
+ throw new TypeError("Cannot convert circular structure to Immutable");
6844
+ }
6845
+ stack.push(value);
6846
+ if (keyPath && key !== "") {
6847
+ keyPath.push(key);
6848
+ }
6849
+ const converted = converter.call(parentValue, key, Seq(value).map((v, k) => fromJSWith(stack, converter, v, k, keyPath, value)), keyPath && keyPath.slice());
6850
+ stack.pop();
6851
+ if (keyPath) {
6852
+ keyPath.pop();
6853
+ }
6854
+ return converted;
6855
+ }
6856
+ return value;
6857
+ }
6858
+ var defaultConverter = (k, v) => isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet();
6859
+ var asValues = (collection) => isKeyed(collection) ? collection.valueSeq() : collection;
6860
+ function initCollectionConversions() {
6861
+ CollectionImpl.prototype.toMap = function toMap() {
6862
+ return Map2(this.toKeyedSeq());
6863
+ };
6864
+ CollectionImpl.prototype.toOrderedMap = function toOrderedMap() {
6865
+ return OrderedMap(this.toKeyedSeq());
6866
+ };
6867
+ CollectionImpl.prototype.toOrderedSet = function toOrderedSet() {
6868
+ return OrderedSet(asValues(this));
6869
+ };
6870
+ CollectionImpl.prototype.toSet = function toSet() {
6871
+ return Set2(asValues(this));
6872
+ };
6873
+ CollectionImpl.prototype.toStack = function toStack() {
6874
+ return Stack2(asValues(this));
6875
+ };
6876
+ CollectionImpl.prototype.toList = function toList() {
6877
+ return List(asValues(this));
6878
+ };
6879
+ CollectionImpl.prototype.countBy = function countBy(grouper, context) {
6880
+ const groups = Map2().asMutable();
6881
+ this.__iterate((v, k) => {
6882
+ groups.update(grouper.call(context, v, k, this), 0, (a) => a + 1);
6883
+ });
6884
+ return groups.asImmutable();
6885
+ };
6886
+ CollectionImpl.prototype.groupBy = function groupBy(grouper, context) {
6887
+ const isKeyedIter = isKeyed(this);
6888
+ const groups = (isOrdered(this) ? OrderedMap() : Map2()).asMutable();
6889
+ this.__iterate((v, k) => {
6890
+ groups.update(grouper.call(context, v, k, this), (a) => {
6891
+ a ??= [];
6892
+ a.push(isKeyedIter ? [k, v] : v);
6893
+ return a;
6894
+ });
6895
+ });
6896
+ return groups.map((arr) => reifyValues(this, arr)).asImmutable();
6897
+ };
6898
+ IndexedCollectionImpl.prototype.keySeq = function keySeq() {
6899
+ return Range(0, this.size);
6900
+ };
6901
+ MapImpl.prototype.sort = function sort(comparator) {
6902
+ return OrderedMap(sortFactory(this, comparator));
6903
+ };
6904
+ MapImpl.prototype.sortBy = function sortBy(mapper, comparator) {
6905
+ return OrderedMap(sortFactory(this, comparator, mapper));
6906
+ };
6907
+ SetImpl.prototype.sort = function sort(comparator) {
6908
+ return OrderedSet(sortFactory(this, comparator));
6909
+ };
6910
+ SetImpl.prototype.sortBy = function sortBy(mapper, comparator) {
6911
+ return OrderedSet(sortFactory(this, comparator, mapper));
6912
+ };
6913
+ }
6914
+ var version$1 = "7.0.0";
6915
+ var pkg = {
6916
+ version: version$1
6917
+ };
6918
+ initCollectionConversions();
6919
+ var { version } = pkg;
6823
6920
 
6824
6921
  // src/oo.js
6825
6922
  var BAD_VALUE = Symbol("BadValue");
@@ -8097,18 +8194,47 @@ class LintParseContext extends ParseContext {
8097
8194
  }
8098
8195
  }
8099
8196
  export {
8197
+ version,
8198
+ updateIn$1 as updateIn,
8199
+ update$1 as update,
8100
8200
  tutuca,
8201
+ setIn$1 as setIn,
8202
+ set,
8101
8203
  seqInfoByClass,
8204
+ removeIn,
8205
+ remove,
8206
+ mergeWith$1 as mergeWith,
8207
+ mergeDeepWith$1 as mergeDeepWith,
8208
+ mergeDeep$1 as mergeDeep,
8209
+ merge$1 as merge,
8102
8210
  macro,
8211
+ isValueObject,
8212
+ isStack,
8213
+ isSet,
8214
+ isSeq,
8215
+ isRecord,
8216
+ isPlainObject,
8217
+ isOrderedSet,
8103
8218
  isOrderedMap,
8219
+ isOrdered,
8104
8220
  isOrderedMap as isOMap,
8105
8221
  isMap,
8106
8222
  isList,
8107
8223
  isKeyed,
8108
8224
  isIndexed,
8225
+ isImmutable,
8109
8226
  isMap as isIMap,
8227
+ isCollection,
8228
+ isAssociative,
8229
+ is,
8110
8230
  injectCss,
8111
8231
  html,
8232
+ hash,
8233
+ hasIn$1 as hasIn,
8234
+ has,
8235
+ getIn$1 as getIn,
8236
+ get,
8237
+ fromJS,
8112
8238
  fieldsByClass,
8113
8239
  css,
8114
8240
  component,
@@ -8120,10 +8246,19 @@ export {
8120
8246
  UNKNOWN_HANDLER_ARG_NAME,
8121
8247
  UNKNOWN_EVENT_MODIFIER,
8122
8248
  UNKNOWN_COMPONENT_NAME,
8249
+ Stack2 as Stack,
8250
+ Set2 as Set,
8251
+ Seq,
8252
+ Repeat,
8123
8253
  Record,
8254
+ Range,
8124
8255
  RENDER_IT_OUTSIDE_OF_LOOP,
8125
8256
  ParseContext,
8257
+ PairSorting,
8258
+ OrderedSet,
8259
+ OrderedMap,
8126
8260
  OrderedMap as OMap,
8261
+ Map2 as Map,
8127
8262
  List,
8128
8263
  LintParseContext,
8129
8264
  LintContext,
@@ -8138,5 +8273,6 @@ export {
8138
8273
  INPUT_HANDLER_FOR_INPUT_HANDLER_METHOD,
8139
8274
  Map2 as IMap,
8140
8275
  FIELD_VAL_NOT_DEFINED,
8276
+ Collection,
8141
8277
  COMPUTED_VAL_NOT_DEFINED
8142
8278
  };