@farm.js/react 0.1.0-beta.26 → 0.1.0-beta.28

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.
@@ -11,7 +11,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
11
11
 
12
12
  // src/iterable.ts
13
13
  var oneShotSnapshots = /* @__PURE__ */ new WeakMap();
14
- var arrayIterator = Array.prototype[Symbol.iterator];
14
+ var arrayIterator = /* @__PURE__ */ (() => Array.prototype[Symbol.iterator])();
15
15
  function materializeIterable(source) {
16
16
  if (source == null) return [];
17
17
  if (Array.isArray(source) && Object.getPrototypeOf(source) === Array.prototype && source[Symbol.iterator] === arrayIterator) {
@@ -48,16 +48,16 @@ var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
48
48
  var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
49
49
  var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
50
50
  var COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS = /* @__PURE__ */ new WeakMap();
51
- var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
52
- var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
53
- var NATIVE_ARRAY_FILTER = Array.prototype.filter;
54
- var NATIVE_ARRAY_MAP = Array.prototype.map;
55
- var NATIVE_ARRAY_SLICE = Array.prototype.slice;
56
- var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
57
- var NATIVE_ARRAY_WITH = Array.prototype.with;
58
- var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
59
- var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
60
- var NATIVE_REFLECT_APPLY = Reflect.apply;
51
+ var NATIVE_ARRAY_PROTOTYPE = /* @__PURE__ */ (() => Array.prototype)();
52
+ var NATIVE_ARRAY_ITERATOR = /* @__PURE__ */ (() => Array.prototype[Symbol.iterator])();
53
+ var NATIVE_ARRAY_FILTER = /* @__PURE__ */ (() => Array.prototype.filter)();
54
+ var NATIVE_ARRAY_MAP = /* @__PURE__ */ (() => Array.prototype.map)();
55
+ var NATIVE_ARRAY_SLICE = /* @__PURE__ */ (() => Array.prototype.slice)();
56
+ var NATIVE_ARRAY_TO_SPLICED = /* @__PURE__ */ (() => Array.prototype.toSpliced)();
57
+ var NATIVE_ARRAY_WITH = /* @__PURE__ */ (() => Array.prototype.with)();
58
+ var NATIVE_ARRAY_TO_REVERSED = /* @__PURE__ */ (() => Array.prototype.toReversed)();
59
+ var NATIVE_ARRAY_TO_SORTED = /* @__PURE__ */ (() => Array.prototype.toSorted)();
60
+ var NATIVE_REFLECT_APPLY = /* @__PURE__ */ (() => Reflect.apply)();
61
61
  function compilerObject(value) {
62
62
  return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
63
63
  }
@@ -2049,11 +2049,11 @@ function keyedIdentityTargetSnapshot(value) {
2049
2049
  const kind = typeof value;
2050
2050
  return value === null || value === void 0 || kind === "string" || kind === "number" || kind === "bigint" ? { eligible: true, key: keyedRowIdentity(value) } : { eligible: false };
2051
2051
  }
2052
- var NATIVE_SET_PROTOTYPE = Set.prototype;
2053
- var NATIVE_SET_ADD = Set.prototype.add;
2054
- var NATIVE_SET_DELETE = Set.prototype.delete;
2055
- var NATIVE_SET_HAS = Set.prototype.has;
2056
- var NATIVE_SET_VALUES = Set.prototype.values;
2052
+ var NATIVE_SET_PROTOTYPE = /* @__PURE__ */ (() => Set.prototype)();
2053
+ var NATIVE_SET_ADD = /* @__PURE__ */ (() => Set.prototype.add)();
2054
+ var NATIVE_SET_DELETE = /* @__PURE__ */ (() => Set.prototype.delete)();
2055
+ var NATIVE_SET_HAS = /* @__PURE__ */ (() => Set.prototype.has)();
2056
+ var NATIVE_SET_VALUES = /* @__PURE__ */ (() => Set.prototype.values)();
2057
2057
  var KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH = 64;
2058
2058
  function materializeKeyedMembershipSnapshot(snapshot) {
2059
2059
  if (!snapshot.eligible) return void 0;
@@ -2154,12 +2154,12 @@ function keyedMembershipChangedKeys(previousSnapshot, nextSnapshot) {
2154
2154
  }
2155
2155
  return keys;
2156
2156
  }
2157
- var NATIVE_MAP_PROTOTYPE = Map.prototype;
2158
- var NATIVE_MAP_GET = Map.prototype.get;
2159
- var NATIVE_MAP_HAS = Map.prototype.has;
2160
- var NATIVE_MAP_SET = Map.prototype.set;
2161
- var NATIVE_MAP_DELETE = Map.prototype.delete;
2162
- var NATIVE_MAP_ENTRIES = Map.prototype.entries;
2157
+ var NATIVE_MAP_PROTOTYPE = /* @__PURE__ */ (() => Map.prototype)();
2158
+ var NATIVE_MAP_GET = /* @__PURE__ */ (() => Map.prototype.get)();
2159
+ var NATIVE_MAP_HAS = /* @__PURE__ */ (() => Map.prototype.has)();
2160
+ var NATIVE_MAP_SET = /* @__PURE__ */ (() => Map.prototype.set)();
2161
+ var NATIVE_MAP_DELETE = /* @__PURE__ */ (() => Map.prototype.delete)();
2162
+ var NATIVE_MAP_ENTRIES = /* @__PURE__ */ (() => Map.prototype.entries)();
2163
2163
  function isSafeKeyedMapLookupValue(value) {
2164
2164
  return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean";
2165
2165
  }
@@ -4453,92 +4453,92 @@ var keyedAppendOnlyUpdateRuntime = {
4453
4453
  commit: commitCompilerKeyedCollection,
4454
4454
  reconcile: () => void 0
4455
4455
  };
4456
- var keyedFilterUpdateRuntime = {
4456
+ var keyedFilterUpdateRuntime = /* @__PURE__ */ (() => ({
4457
4457
  ...keyedUpdateRuntime,
4458
4458
  filter: reconcileCompilerKeyedArrayFilter
4459
- };
4459
+ }))();
4460
4460
  var keyedFilterOnlyUpdateRuntime = {
4461
4461
  append: () => void 0,
4462
4462
  commit: commitCompilerKeyedCollection,
4463
4463
  reconcile: () => void 0,
4464
4464
  filter: reconcileCompilerKeyedArrayFilter
4465
4465
  };
4466
- var keyedPrependUpdateRuntime = {
4466
+ var keyedPrependUpdateRuntime = /* @__PURE__ */ (() => ({
4467
4467
  ...keyedUpdateRuntime,
4468
4468
  prepend: reconcileCompilerKeyedArrayPrepend
4469
- };
4469
+ }))();
4470
4470
  var keyedPrependOnlyUpdateRuntime = {
4471
4471
  append: () => void 0,
4472
4472
  commit: commitCompilerKeyedCollection,
4473
4473
  reconcile: () => void 0,
4474
4474
  prepend: reconcileCompilerKeyedArrayPrepend
4475
4475
  };
4476
- var keyedFilterPrependUpdateRuntime = {
4476
+ var keyedFilterPrependUpdateRuntime = /* @__PURE__ */ (() => ({
4477
4477
  ...keyedFilterUpdateRuntime,
4478
4478
  prepend: reconcileCompilerKeyedArrayPrepend
4479
- };
4480
- var keyedStructuralPrependUpdateRuntime = {
4479
+ }))();
4480
+ var keyedStructuralPrependUpdateRuntime = /* @__PURE__ */ (() => ({
4481
4481
  ...keyedFilterPrependUpdateRuntime,
4482
4482
  prepend: reconcileCompilerKeyedArrayPrependWithStructural
4483
- };
4484
- var keyedPositionUpdateRuntime = {
4483
+ }))();
4484
+ var keyedPositionUpdateRuntime = /* @__PURE__ */ (() => ({
4485
4485
  ...keyedUpdateRuntime,
4486
4486
  position: reconcileCompilerKeyedArrayPosition
4487
- };
4488
- var keyedBatchPositionUpdateRuntime = {
4487
+ }))();
4488
+ var keyedBatchPositionUpdateRuntime = /* @__PURE__ */ (() => ({
4489
4489
  ...keyedUpdateRuntime,
4490
4490
  position: reconcileCompilerKeyedArrayPositionWithBatch
4491
- };
4492
- var keyedWindowPositionUpdateRuntime = {
4491
+ }))();
4492
+ var keyedWindowPositionUpdateRuntime = /* @__PURE__ */ (() => ({
4493
4493
  ...keyedUpdateRuntime,
4494
4494
  position: reconcileCompilerKeyedArrayPositionWithWindow
4495
- };
4496
- var keyedReorderUpdateRuntime = {
4495
+ }))();
4496
+ var keyedReorderUpdateRuntime = /* @__PURE__ */ (() => ({
4497
4497
  ...keyedUpdateRuntime,
4498
4498
  reorder: reconcileCompilerKeyedArrayReorder
4499
- };
4500
- var keyedMapReorderUpdateRuntime = {
4499
+ }))();
4500
+ var keyedMapReorderUpdateRuntime = /* @__PURE__ */ (() => ({
4501
4501
  ...keyedUpdateRuntime,
4502
4502
  reorder: reconcileCompilerKeyedArrayReorderWithMap
4503
- };
4504
- var keyedCompleteUpdateRuntime = {
4503
+ }))();
4504
+ var keyedCompleteUpdateRuntime = /* @__PURE__ */ (() => ({
4505
4505
  ...keyedFilterPrependUpdateRuntime,
4506
4506
  rollingWindow: reconcileCompilerKeyedArrayRollingWindow
4507
- };
4508
- var keyedEveryUpdateRuntime = {
4507
+ }))();
4508
+ var keyedEveryUpdateRuntime = /* @__PURE__ */ (() => ({
4509
4509
  ...keyedCompleteUpdateRuntime,
4510
4510
  position: reconcileCompilerKeyedArrayPosition,
4511
4511
  reorder: reconcileCompilerKeyedArrayReorderWithMapAndStructural
4512
- };
4513
- var keyedBatchEveryUpdateRuntime = {
4512
+ }))();
4513
+ var keyedBatchEveryUpdateRuntime = /* @__PURE__ */ (() => ({
4514
4514
  ...keyedEveryUpdateRuntime,
4515
4515
  position: reconcileCompilerKeyedArrayPositionWithBatch
4516
- };
4517
- var keyedWindowEveryUpdateRuntime = {
4516
+ }))();
4517
+ var keyedWindowEveryUpdateRuntime = /* @__PURE__ */ (() => ({
4518
4518
  ...keyedEveryUpdateRuntime,
4519
4519
  position: reconcileCompilerKeyedArrayPositionWithWindow
4520
- };
4521
- var keyedWindowEveryStructuralAppendUpdateRuntime = {
4520
+ }))();
4521
+ var keyedWindowEveryStructuralAppendUpdateRuntime = /* @__PURE__ */ (() => ({
4522
4522
  ...keyedWindowEveryUpdateRuntime,
4523
4523
  append: reconcileCompilerKeyedArrayAppendWithStructural
4524
- };
4525
- var keyedWindowEveryStructuralAppendMapUpdateRuntime = {
4524
+ }))();
4525
+ var keyedWindowEveryStructuralAppendMapUpdateRuntime = /* @__PURE__ */ (() => ({
4526
4526
  ...keyedWindowEveryStructuralAppendUpdateRuntime,
4527
4527
  append: reconcileCompilerKeyedArrayAppendMapWithStructural,
4528
4528
  commit: commitCompilerKeyedCollectionWithItemSnapshot
4529
- };
4530
- var keyedCompleteCompatibilityUpdateRuntime = {
4529
+ }))();
4530
+ var keyedCompleteCompatibilityUpdateRuntime = /* @__PURE__ */ (() => ({
4531
4531
  ...keyedWindowEveryStructuralAppendMapUpdateRuntime,
4532
4532
  prepend: reconcileCompilerKeyedArrayPrependWithStructural
4533
- };
4534
- var keyedCompleteStructuralPrependMapUpdateRuntime = {
4533
+ }))();
4534
+ var keyedCompleteStructuralPrependMapUpdateRuntime = /* @__PURE__ */ (() => ({
4535
4535
  ...keyedCompleteCompatibilityUpdateRuntime,
4536
4536
  prepend: reconcileCompilerKeyedArrayPrependMapWithStructural
4537
- };
4538
- var keyedMappedRollingWindowUpdateRuntime = {
4537
+ }))();
4538
+ var keyedMappedRollingWindowUpdateRuntime = /* @__PURE__ */ (() => ({
4539
4539
  ...keyedCompleteStructuralPrependMapUpdateRuntime,
4540
4540
  rollingWindow: reconcileCompilerKeyedArrayMappedRollingWindow
4541
- };
4541
+ }))();
4542
4542
  function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
4543
4543
  const dependency = props.collectionDependency;
4544
4544
  if (dependency === void 0) return void 0;
@@ -8333,9 +8333,6 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8333
8333
  this.blockRootElements = /* @__PURE__ */ new Set();
8334
8334
  this.bindingTargets = /* @__PURE__ */ new Map();
8335
8335
  this.bindingTargetRefs = /* @__PURE__ */ new Map();
8336
- this.captureRoot = (root) => {
8337
- this.root = root;
8338
- };
8339
8336
  this.refreshDefinition = () => {
8340
8337
  if (this.mounted) this.forceUpdate();
8341
8338
  };
@@ -8621,8 +8618,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8621
8618
  componentDidMount() {
8622
8619
  this.mounted = true;
8623
8620
  refreshListeners.add(this.refreshDefinition);
8624
- this.ensureBindingIndex();
8625
- this.primeHybridBindings();
8621
+ this.componentDidUpdate();
8626
8622
  }
8627
8623
  getSnapshotBeforeUpdate() {
8628
8624
  const currentDefinition = definitionReference.current;
@@ -8636,7 +8632,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8636
8632
  this.bindingValues.clear();
8637
8633
  return false;
8638
8634
  }
8639
- componentDidUpdate(_previousProps, _previousState, reusedRenderedElement) {
8635
+ componentDidUpdate(previousProps, _previousState, reusedRenderedElement) {
8640
8636
  const propValues = definitionReference.current.readProps?.(this.props) || null;
8641
8637
  if (propValues) {
8642
8638
  if (reusedRenderedElement) this.captureInputSelection();
@@ -8651,21 +8647,20 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8651
8647
  cell.flush();
8652
8648
  }
8653
8649
  }
8654
- if (!reusedRenderedElement) {
8655
- this.ensureBindingIndex();
8656
- this.primeHybridBindings();
8657
- }
8658
- this.flushBindingUpdates();
8659
- return;
8660
8650
  }
8661
- this.ensureBindingIndex();
8662
- for (const binding of definitionReference.current.bindings) {
8663
- this.applyBinding(binding, true);
8651
+ if (!reusedRenderedElement) {
8652
+ this.ensureBindingIndex();
8653
+ this.primeHybridBindings();
8654
+ }
8655
+ if (!propValues && previousProps) {
8656
+ for (const binding of definitionReference.current.bindings) {
8657
+ this.applyBinding(binding, true);
8658
+ }
8664
8659
  }
8660
+ if (this.dirtyState.size) this.flushBindingUpdates();
8665
8661
  }
8666
8662
  componentWillUnmount() {
8667
8663
  this.mounted = false;
8668
- this.dirtyState.clear();
8669
8664
  this.inputSelection = null;
8670
8665
  this.blockRefreshListeners.clear();
8671
8666
  this.bindingTargetRefs.clear();
@@ -8676,7 +8671,6 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8676
8671
  this.trackedBindingsByDependency = [];
8677
8672
  this.trackedDependenciesByBinding.clear();
8678
8673
  this.bindingValues.clear();
8679
- this.textNodes.clear();
8680
8674
  this.activeBinding = null;
8681
8675
  this.activeDependencies = null;
8682
8676
  refreshListeners.delete(this.refreshDefinition);
@@ -8697,31 +8691,18 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8697
8691
  }
8698
8692
  let renderedElement;
8699
8693
  const captureCommittedRoot = (root) => {
8700
- this.captureRoot(root);
8701
- if (!root) return;
8702
- renderCells.commit();
8703
- this.renderedDefinition = currentDefinition;
8704
- this.renderedElement = renderedElement;
8694
+ this.root = root;
8695
+ if (root) {
8696
+ renderCells.commit();
8697
+ this.renderedDefinition = currentDefinition;
8698
+ this.renderedElement = renderedElement;
8699
+ }
8705
8700
  };
8706
- if (element.type === this.blockRuntime.KeyedRanges) {
8707
- renderedElement = React__default.default.cloneElement(
8708
- element,
8709
- {
8710
- rootRef: captureCommittedRoot
8711
- }
8712
- );
8713
- } else if (element.type === this.blockRuntime.ConditionalRanges) {
8701
+ if (element.type === this.blockRuntime.KeyedRanges || element.type === this.blockRuntime.ConditionalRanges || element.type === this.blockRuntime.MixedRanges) {
8714
8702
  renderedElement = React__default.default.cloneElement(
8715
8703
  element,
8716
8704
  { rootRef: captureCommittedRoot }
8717
8705
  );
8718
- } else if (element.type === this.blockRuntime.MixedRanges) {
8719
- renderedElement = React__default.default.cloneElement(
8720
- element,
8721
- {
8722
- rootRef: captureCommittedRoot
8723
- }
8724
- );
8725
8706
  } else if (typeof element.type !== "string") {
8726
8707
  throw new TypeError(
8727
8708
  `Compiled component ${currentDefinition.displayName} must return one host element.`