@farm.js/react 0.1.0-beta.19 → 0.1.0-beta.20

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.
package/README.md CHANGED
@@ -40,6 +40,10 @@ automatic and does not add a configuration option or asynchronous runtime loadin
40
40
  `createCompiledComponent` export remains a complete compatibility entry for hand-authored
41
41
  definitions, while generated code uses the tree-shakable feature entry.
42
42
 
43
+ Plain keyed lists with filter hints and only identity-based selection also use the single-kind
44
+ target runtime. Filtering keeps its existing native-method checks and fallback; mixed Set/Map
45
+ targets, conditional rows, and nested host blocks keep their existing runtime capabilities.
46
+
43
47
  The persisted production-size fixtures and regression gate live in
44
48
  [`RUNTIME_SIZE_RESULTS.md`](./RUNTIME_SIZE_RESULTS.md). The recorded compiler-selected core runtime
45
49
  premium is 85.4% smaller than the complete compatibility runtime premium; the feature-heavy keyed
@@ -1575,6 +1575,7 @@ function createCompilerKeyedCollectionUpdate(previous, value, kind) {
1575
1575
  });
1576
1576
  return value;
1577
1577
  }
1578
+ var delegatedRowChangePlaceholder = () => void 0;
1578
1579
  var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
1579
1580
  function getCompilerHmrRegistry() {
1580
1581
  const globalTarget = globalThis;
@@ -4314,6 +4315,12 @@ var keyedFilterUpdateRuntime = {
4314
4315
  ...keyedUpdateRuntime,
4315
4316
  filter: reconcileCompilerKeyedArrayFilter
4316
4317
  };
4318
+ var keyedFilterOnlyUpdateRuntime = {
4319
+ append: () => void 0,
4320
+ commit: commitCompilerKeyedCollection,
4321
+ reconcile: () => void 0,
4322
+ filter: reconcileCompilerKeyedArrayFilter
4323
+ };
4317
4324
  var keyedPrependUpdateRuntime = {
4318
4325
  ...keyedUpdateRuntime,
4319
4326
  prepend: reconcileCompilerKeyedArrayPrepend
@@ -5640,14 +5647,14 @@ function reconcileCompilerKeyedArrayPrepend(props, dirtyState, collectionToken,
5640
5647
  return void 0;
5641
5648
  }
5642
5649
  }
5643
- const knownKeys = new Set(instances.keys());
5650
+ const incomingKeys = /* @__PURE__ */ new Set();
5644
5651
  const prepended = [];
5645
5652
  try {
5646
5653
  for (let index = 0; index < prefixLength; index += 1) {
5647
5654
  const item = finalValue[index];
5648
5655
  const key = keyedRowIdentity(props.rowKey(item, index));
5649
- if (knownKeys.has(key)) return void 0;
5650
- knownKeys.add(key);
5656
+ if (instances.has(key) || incomingKeys.has(key)) return void 0;
5657
+ incomingKeys.add(key);
5651
5658
  const descriptor = props.create(item, index);
5652
5659
  prepended.push({
5653
5660
  key,
@@ -6021,7 +6028,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6021
6028
  return (event) => this.currentProps.events?.[eventId]?.invoke(item, index, event);
6022
6029
  }
6023
6030
  if (this.usesDelegatedEvents()) {
6024
- return void 0;
6031
+ return this.currentProps.events?.[eventId]?.name === "onChange" ? delegatedRowChangePlaceholder : void 0;
6025
6032
  }
6026
6033
  const key = keyedRowIdentity(this.currentProps.rowKey(item, index));
6027
6034
  let handlers = this.eventHandlers.get(key);
@@ -6120,9 +6127,8 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6120
6127
  if (positionedInstances !== this.instances) {
6121
6128
  this.instances = new Map(positionedInstances);
6122
6129
  this.rebuildElementIndex(this.instances);
6123
- const keys = [...this.instances.keys()];
6124
- this.pruneEventHandlers(keys);
6125
- this.pruneConditionalListeners(keys);
6130
+ this.pruneEventHandlers();
6131
+ this.pruneConditionalListeners();
6126
6132
  }
6127
6133
  this.commitCurrentCollection(dirtyState);
6128
6134
  afterCommit?.();
@@ -6141,9 +6147,8 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6141
6147
  this.instances = reorderedInstances;
6142
6148
  if (removedRows) {
6143
6149
  this.rebuildElementIndex(this.instances);
6144
- const keys = [...this.instances.keys()];
6145
- this.pruneEventHandlers(keys);
6146
- this.pruneConditionalListeners(keys);
6150
+ this.pruneEventHandlers();
6151
+ this.pruneConditionalListeners();
6147
6152
  }
6148
6153
  this.commitCurrentCollection(dirtyState);
6149
6154
  afterCommit?.();
@@ -6171,9 +6176,8 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6171
6176
  }
6172
6177
  } else {
6173
6178
  this.rebuildElementIndex(this.instances);
6174
- const keys = [...this.instances.keys()];
6175
- this.pruneEventHandlers(keys);
6176
- this.pruneConditionalListeners(keys);
6179
+ this.pruneEventHandlers();
6180
+ this.pruneConditionalListeners();
6177
6181
  }
6178
6182
  this.commitCurrentCollection(dirtyState);
6179
6183
  afterCommit?.();
@@ -6187,11 +6191,10 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6187
6191
  this.hasReactOwnedRows()
6188
6192
  );
6189
6193
  if (filteredInstances) {
6190
- this.instances = new Map(filteredInstances);
6194
+ this.instances = filteredInstances;
6191
6195
  this.rebuildElementIndex(this.instances);
6192
- const keys = [...this.instances.keys()];
6193
- this.pruneEventHandlers(keys);
6194
- this.pruneConditionalListeners(keys);
6196
+ this.pruneEventHandlers();
6197
+ this.pruneConditionalListeners();
6195
6198
  this.commitCurrentCollection(dirtyState);
6196
6199
  afterCommit?.();
6197
6200
  return;
@@ -6299,16 +6302,17 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6299
6302
  readConditionalValues(props, item, index) {
6300
6303
  return options.conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
6301
6304
  }
6302
- pruneEventHandlers(keys) {
6303
- const active = new Set(keys);
6305
+ // Call only after committing this.instances: it is the authoritative live-key set.
6306
+ pruneEventHandlers() {
6307
+ if (this.eventHandlers.size === 0) return;
6304
6308
  for (const key of this.eventHandlers.keys()) {
6305
- if (!active.has(key)) this.eventHandlers.delete(key);
6309
+ if (!this.instances.has(key)) this.eventHandlers.delete(key);
6306
6310
  }
6307
6311
  }
6308
- pruneConditionalListeners(keys) {
6309
- const active = new Set(keys);
6312
+ pruneConditionalListeners() {
6313
+ if (this.conditionalListeners.size === 0) return;
6310
6314
  for (const key of this.conditionalListeners.keys()) {
6311
- if (!active.has(key)) this.conditionalListeners.delete(key);
6315
+ if (!this.instances.has(key)) this.conditionalListeners.delete(key);
6312
6316
  }
6313
6317
  }
6314
6318
  commitCurrentCollection(dirtyState) {
@@ -6363,8 +6367,8 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6363
6367
  this.cleanupHostScopes();
6364
6368
  this.instances = instances;
6365
6369
  this.rebuildElementIndex(instances);
6366
- this.pruneEventHandlers(rows.keys);
6367
- this.pruneConditionalListeners(rows.keys);
6370
+ this.pruneEventHandlers();
6371
+ this.pruneConditionalListeners();
6368
6372
  this.commitCurrentCollection();
6369
6373
  return true;
6370
6374
  }
@@ -6746,8 +6750,8 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6746
6750
  }
6747
6751
  this.instances = keyedRowInstancesByKey(nextInstances);
6748
6752
  this.rebuildElementIndex(this.instances);
6749
- this.pruneEventHandlers(rows.keys);
6750
- this.pruneConditionalListeners(rows.keys);
6753
+ this.pruneEventHandlers();
6754
+ this.pruneConditionalListeners();
6751
6755
  this.commitCurrentCollection(dirtyState);
6752
6756
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
6753
6757
  }
@@ -7441,6 +7445,24 @@ var keyedRowsFilterHintedRuntimeFeature = {
7441
7445
  })
7442
7446
  })
7443
7447
  };
7448
+ var keyedRowsIdentityFilterHintedRuntimeFeature = {
7449
+ name: "keyed-rows:identity-filter-hinted",
7450
+ create: (owner) => ({
7451
+ KeyedRows: createKeyedRowsBlockComponentCore(owner, {
7452
+ keyedTargets: createKeyedIdentityTargetRuntime,
7453
+ keyedUpdates: keyedFilterUpdateRuntime
7454
+ })
7455
+ })
7456
+ };
7457
+ var keyedRowsIdentityFilterOnlyRuntimeFeature = {
7458
+ name: "keyed-rows:identity-filter-only",
7459
+ create: (owner) => ({
7460
+ KeyedRows: createKeyedRowsBlockComponentCore(owner, {
7461
+ keyedTargets: createKeyedIdentityTargetRuntime,
7462
+ keyedUpdates: keyedFilterOnlyUpdateRuntime
7463
+ })
7464
+ })
7465
+ };
7444
7466
  var keyedRowsStructuralAppendHintedRuntimeFeature = {
7445
7467
  name: "keyed-rows:structural-append-hinted",
7446
7468
  create: (owner) => ({
@@ -8575,6 +8597,8 @@ exports.keyedRowsHostStructuralPrependHintedRuntimeFeature = keyedRowsHostStruct
8575
8597
  exports.keyedRowsHostStructuralPrependMapHintedRuntimeFeature = keyedRowsHostStructuralPrependMapHintedRuntimeFeature;
8576
8598
  exports.keyedRowsHostWindowEveryHintedRuntimeFeature = keyedRowsHostWindowEveryHintedRuntimeFeature;
8577
8599
  exports.keyedRowsHostWindowPositionHintedRuntimeFeature = keyedRowsHostWindowPositionHintedRuntimeFeature;
8600
+ exports.keyedRowsIdentityFilterHintedRuntimeFeature = keyedRowsIdentityFilterHintedRuntimeFeature;
8601
+ exports.keyedRowsIdentityFilterOnlyRuntimeFeature = keyedRowsIdentityFilterOnlyRuntimeFeature;
8578
8602
  exports.keyedRowsIdentityRuntimeFeature = keyedRowsIdentityRuntimeFeature;
8579
8603
  exports.keyedRowsMapLookupRuntimeFeature = keyedRowsMapLookupRuntimeFeature;
8580
8604
  exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;