@farm.js/react 0.1.0-beta.38 → 0.1.0-beta.39

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
@@ -1123,6 +1123,10 @@ Generated callback refs give directly patched host elements stable private targe
1123
1123
  React-owned component may therefore return `null`, a fragment, or multiple host nodes without
1124
1124
  shifting an unrelated compiler binding. These refs do not add attributes to SSR output.
1125
1125
 
1126
+ Custom element tags and customized built-ins using `is` remain React-owned rather than receiving
1127
+ compiler attribute writes or host descriptors. React controls property setters, attributes, events,
1128
+ and element creation according to the installed React version, including during hydration.
1129
+
1126
1130
  State-dependent `contentEditable` bindings and non-literal `contentEditable` values in host
1127
1131
  descriptors remain React-owned. This preserves the difference between explicit `false` (not editable)
1128
1132
  and an absent value (inherit from the parent). Literal strings on ordinary direct hosts remain
package/dist/client.d.mts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from '@farm.js/core/renderer/react/client';
2
2
  export { default } from '@farm.js/core/renderer/react/client';
3
+ import '@farm.js/core/renderer/react/server';
package/dist/client.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from '@farm.js/core/renderer/react/client';
2
2
  export { default } from '@farm.js/core/renderer/react/client';
3
+ import '@farm.js/core/renderer/react/server';
@@ -1583,13 +1583,13 @@ function createCompilerKeyedCollectionUpdate(previous, value, kind) {
1583
1583
  return value;
1584
1584
  }
1585
1585
  var delegatedRowChangePlaceholder = () => void 0;
1586
- var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
1587
1586
  function getCompilerHmrRegistry() {
1587
+ const registryKey = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
1588
1588
  const globalTarget = globalThis;
1589
- const existing = globalTarget[COMPILER_HMR_REGISTRY];
1589
+ const existing = globalTarget[registryKey];
1590
1590
  if (existing instanceof Map) return existing;
1591
1591
  const registry = /* @__PURE__ */ new Map();
1592
- globalTarget[COMPILER_HMR_REGISTRY] = registry;
1592
+ globalTarget[registryKey] = registry;
1593
1593
  return registry;
1594
1594
  }
1595
1595
  function renderTextValue(value) {
@@ -1731,6 +1731,9 @@ function updateAttribute(element, name, value) {
1731
1731
  if (name === "value" && (isInputElement(element) || isTextAreaElement(element))) {
1732
1732
  const nextValue = value === null || value === void 0 ? "" : String(value);
1733
1733
  if (element.value !== nextValue) element.value = nextValue;
1734
+ if (value != null && isInputElement(element) && (element.type !== "number" || element.ownerDocument.activeElement !== element) && element.defaultValue !== nextValue) {
1735
+ element.defaultValue = nextValue;
1736
+ }
1734
1737
  return;
1735
1738
  }
1736
1739
  if (name === "value" && isSelectElement(element)) {
@@ -1754,8 +1757,20 @@ function updateAttribute(element, name, value) {
1754
1757
  } else if (value === true && !stringifiesBoolean) {
1755
1758
  element.setAttribute(attributeName, "");
1756
1759
  } else {
1757
- element.setAttribute(attributeName, String(value));
1760
+ element.setAttribute(attributeName, compilerAttributeValue(element, name, String(value)));
1761
+ }
1762
+ }
1763
+ var JAVASCRIPT_URL = (
1764
+ // oxlint-disable-next-line no-control-regex
1765
+ /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i
1766
+ );
1767
+ var BLOCKS_JAVASCRIPT_URLS = Number.parseInt(React__default.default.version, 10) > 18;
1768
+ function compilerAttributeValue(element, name, value) {
1769
+ if (!BLOCKS_JAVASCRIPT_URLS || name !== "href" && name !== "src" && name !== "action" && name !== "formAction" && name !== "data") {
1770
+ return value;
1758
1771
  }
1772
+ const tag = element.localName;
1773
+ return (name !== "data" || tag === "object") && !tag.includes("-") && JAVASCRIPT_URL.test(value) ? "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')" : value;
1759
1774
  }
1760
1775
  function createConditionalBlockComponent(owner) {
1761
1776
  class FarmConditionalBlock extends React__default.default.Component {
@@ -2535,7 +2550,7 @@ function readKeyedRowBindingValues(props, item, index) {
2535
2550
  var KEYED_ROW_TEMPLATES = /* @__PURE__ */ new WeakMap();
2536
2551
  function createKeyedRowInstance(props, document, key, item, index) {
2537
2552
  const template = props.cloneRows && KEYED_ROW_TEMPLATES.get(props);
2538
- const element = template ? template.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
2553
+ const element = template ? template.element.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
2539
2554
  const instance = {
2540
2555
  key,
2541
2556
  element,
@@ -2545,16 +2560,21 @@ function createKeyedRowInstance(props, document, key, item, index) {
2545
2560
  conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
2546
2561
  };
2547
2562
  if (props.cloneRows) {
2548
- const targets = [];
2563
+ let targets = props.targets?.(element);
2549
2564
  let found = true;
2550
- for (const binding of props.bindings) {
2551
- const target = findCompilerHostTarget(element, binding.path);
2552
- found && (found = target !== null);
2553
- targets.push(target);
2565
+ if (!targets || targets.length !== props.bindings.length || !props.bindings.every((_, index2) => targets[index2] != null)) {
2566
+ targets = [];
2567
+ for (const binding of props.bindings) {
2568
+ const target = findCompilerHostTarget(element, binding.path);
2569
+ found && (found = target !== null);
2570
+ targets.push(target);
2571
+ }
2554
2572
  }
2555
2573
  if (found) instance.targets = targets;
2556
2574
  if (template) {
2557
2575
  for (let bindingIndex = 0; bindingIndex < targets.length; bindingIndex += 1) {
2576
+ const value = instance.values[bindingIndex];
2577
+ if (typeof value === "string" && value === template.classNames[bindingIndex]) continue;
2558
2578
  commitKeyedRowBinding(
2559
2579
  props.bindings[bindingIndex],
2560
2580
  instance,
@@ -2580,10 +2600,20 @@ function keyedRowTemplate(props, element, targets) {
2580
2600
  }
2581
2601
  }
2582
2602
  const template = element.cloneNode(true);
2583
- for (const binding of props.bindings) {
2603
+ const classNames = [];
2604
+ const classTargets = /* @__PURE__ */ new Set();
2605
+ for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
2606
+ const binding = props.bindings[bindingIndex];
2584
2607
  if (binding.kind === "text") findCompilerHostTarget(template, binding.path).textContent = "";
2608
+ if (binding.kind === "attribute" && (binding.name === "className" || binding.name === "class")) {
2609
+ const target = targets[bindingIndex];
2610
+ if (!classTargets.has(target)) {
2611
+ classNames[bindingIndex] = target.getAttribute("class") ?? void 0;
2612
+ classTargets.add(target);
2613
+ }
2614
+ }
2585
2615
  }
2586
- return template;
2616
+ return { element: template, classNames };
2587
2617
  }
2588
2618
  function applyKeyedRowBindings(props, instance, item, index) {
2589
2619
  if (props.bindings.length < 2) {
@@ -4573,13 +4603,7 @@ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, ins
4573
4603
  }
4574
4604
  }
4575
4605
  applyKeyedRowBindings(props, instance, item, index);
4576
- const conditionalValues = conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
4577
- for (const [id, values] of conditionalValues) {
4578
- if (conditionals?.changed(instance.conditionalValues.get(id), values)) {
4579
- conditionalChanges.push({ key, id, item, index });
4580
- }
4581
- }
4582
- instance.conditionalValues = conditionalValues;
4606
+ conditionals?.refresh(props, instance, key, item, index, conditionalChanges);
4583
4607
  instance.item = item;
4584
4608
  }
4585
4609
  return {
@@ -5994,6 +6018,7 @@ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, i
5994
6018
  for (const instance of instances.values()) instance.index = index++;
5995
6019
  return instances;
5996
6020
  }
6021
+ var renderKeyedRowConditional = (item, index, _id, render) => render(item, index);
5997
6022
  function createKeyedRowConditionalRuntime() {
5998
6023
  class FarmKeyedRowConditional extends React__default.default.Component {
5999
6024
  constructor() {
@@ -6036,30 +6061,48 @@ function createKeyedRowConditionalRuntime() {
6036
6061
  }
6037
6062
  }
6038
6063
  FarmKeyedRowConditional.displayName = "FarmCompiledKeyedRowConditional";
6039
- return {
6040
- element: (props) => React__default.default.createElement(FarmKeyedRowConditional, {
6041
- key: `${props.rowKey}:${props.id}`,
6042
- ...props
6043
- }),
6044
- readValues: readKeyedRowConditionalValues,
6045
- changed: keyedRowConditionalChanged,
6046
- owner: (listeners) => ({
6047
- subscribe(key, id, refresh) {
6048
- let row = listeners.get(key);
6049
- if (!row) {
6050
- row = /* @__PURE__ */ new Map();
6051
- listeners.set(key, row);
6064
+ class ConditionalBlock {
6065
+ constructor(context) {
6066
+ this.context = context;
6067
+ this.listeners = /* @__PURE__ */ new Map();
6068
+ this.owner = {
6069
+ subscribe: (key, id, refresh) => {
6070
+ let row = this.listeners.get(key);
6071
+ if (!row) {
6072
+ row = /* @__PURE__ */ new Map();
6073
+ this.listeners.set(key, row);
6074
+ }
6075
+ row.set(id, refresh);
6076
+ return () => {
6077
+ const current = this.listeners.get(key);
6078
+ if (current?.get(id) !== refresh) return;
6079
+ current.delete(id);
6080
+ if (current.size === 0) this.listeners.delete(key);
6081
+ };
6052
6082
  }
6053
- row.set(id, refresh);
6054
- return () => {
6055
- const current = listeners.get(key);
6056
- if (current?.get(id) !== refresh) return;
6057
- current.delete(id);
6058
- if (current.size === 0) listeners.delete(key);
6059
- };
6083
+ };
6084
+ this.render = (item, index, id, render) => {
6085
+ if (this.context.state.fallback) return render(item, index);
6086
+ const rowKey = keyedRowIdentity(this.context.currentProps.rowKey(item, index));
6087
+ return React__default.default.createElement(FarmKeyedRowConditional, {
6088
+ key: `${rowKey}:${id}`,
6089
+ owner: this.owner,
6090
+ rowKey,
6091
+ id,
6092
+ renderVersion: this.context.renderVersion,
6093
+ item,
6094
+ index,
6095
+ render
6096
+ });
6097
+ };
6098
+ }
6099
+ prune(instances) {
6100
+ if (this.listeners.size === 0) return;
6101
+ for (const key of this.listeners.keys()) {
6102
+ if (!instances.has(key)) this.listeners.delete(key);
6060
6103
  }
6061
- }),
6062
- notify(listeners, changes, afterCommit) {
6104
+ }
6105
+ notify(changes, afterCommit) {
6063
6106
  let pending = changes.length;
6064
6107
  const committed = () => {
6065
6108
  pending -= 1;
@@ -6067,12 +6110,25 @@ function createKeyedRowConditionalRuntime() {
6067
6110
  };
6068
6111
  reactDom.flushSync(() => {
6069
6112
  for (const change of changes) {
6070
- const refresh = listeners.get(change.key)?.get(change.id);
6113
+ const refresh = this.listeners.get(change.key)?.get(change.id);
6071
6114
  if (refresh) refresh(change.item, change.index, committed);
6072
6115
  else committed();
6073
6116
  }
6074
6117
  });
6075
6118
  }
6119
+ }
6120
+ return {
6121
+ create: (context) => new ConditionalBlock(context),
6122
+ readValues: readKeyedRowConditionalValues,
6123
+ refresh(props, instance, key, item, index, changes) {
6124
+ const values = readKeyedRowConditionalValues(props, item, index);
6125
+ for (const [id, next] of values) {
6126
+ if (keyedRowConditionalChanged(instance.conditionalValues.get(id), next)) {
6127
+ changes.push({ key, id, item, index });
6128
+ }
6129
+ }
6130
+ instance.conditionalValues = values;
6131
+ }
6076
6132
  };
6077
6133
  }
6078
6134
  function createKeyedRowHostRuntime() {
@@ -6102,11 +6158,10 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6102
6158
  this.keyedTargets = options.keyedTargets?.(this.props);
6103
6159
  this.renderVersion = 0;
6104
6160
  this.eventHandlers = /* @__PURE__ */ new Map();
6105
- this.conditionalListeners = /* @__PURE__ */ new Map();
6161
+ this.conditionals = options.conditionals?.create(this);
6106
6162
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
6107
6163
  // False after a rebuild without delegated events left surviving rows unindexed.
6108
6164
  this.elementIndexComplete = true;
6109
- this.conditionalOwner = options.conditionals?.owner(this.conditionalListeners);
6110
6165
  this.captureRoot = (root) => {
6111
6166
  this.root = root;
6112
6167
  };
@@ -6142,14 +6197,18 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6142
6197
  const eventTarget = event.target;
6143
6198
  if (!instance || !eventTarget) return;
6144
6199
  const capture = name.endsWith("Capture");
6145
- const matches = (this.currentProps.events || []).filter((descriptor) => descriptor.name === name && descriptor.path !== void 0).map((descriptor) => ({
6146
- descriptor,
6147
- target: findCompilerHostTarget(instance.element, descriptor.path || [])
6148
- })).filter(
6149
- (match) => Boolean(
6150
- match.target && (match.target === eventTarget || match.target.contains(eventTarget))
6151
- )
6152
- ).sort(
6200
+ const descriptors = this.currentProps.events || [];
6201
+ const matches = [];
6202
+ for (let index = 0, length = descriptors.length; index < length; index += 1) {
6203
+ if (!(index in descriptors)) continue;
6204
+ const descriptor = descriptors[index];
6205
+ if (descriptor.name !== name || descriptor.path === void 0) continue;
6206
+ const target = findCompilerHostTarget(instance.element, descriptor.path || []);
6207
+ if (target && (target === eventTarget || target.contains(eventTarget))) {
6208
+ matches.push({ descriptor, target });
6209
+ }
6210
+ }
6211
+ matches.sort(
6153
6212
  (left, right) => capture ? (left.descriptor.path?.length || 0) - (right.descriptor.path?.length || 0) : (right.descriptor.path?.length || 0) - (left.descriptor.path?.length || 0)
6154
6213
  );
6155
6214
  for (const match of matches) {
@@ -6157,18 +6216,6 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6157
6216
  if (event.isPropagationStopped()) break;
6158
6217
  }
6159
6218
  };
6160
- this.rowConditional = (item, index, conditionalId, render) => {
6161
- if (this.state.fallback || !options.conditionals) return render(item, index);
6162
- return options.conditionals.element({
6163
- owner: this.conditionalOwner,
6164
- rowKey: keyedRowIdentity(this.currentProps.rowKey(item, index)),
6165
- id: conditionalId,
6166
- renderVersion: this.renderVersion,
6167
- item,
6168
- index,
6169
- render
6170
- });
6171
- };
6172
6219
  this.refresh = (afterCommit, dirtyState) => {
6173
6220
  if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
6174
6221
  const result = options.keyedUpdates.reconcile(
@@ -6222,7 +6269,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6222
6269
  this.instances = positionedInstances;
6223
6270
  this.rebuildElementIndex(this.instances);
6224
6271
  this.pruneEventHandlers();
6225
- this.pruneConditionalListeners();
6272
+ this.conditionals?.prune(this.instances);
6226
6273
  }
6227
6274
  this.commitCurrentCollection(dirtyState);
6228
6275
  afterCommit?.();
@@ -6242,7 +6289,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6242
6289
  if (removedRows) {
6243
6290
  this.rebuildElementIndex(this.instances);
6244
6291
  this.pruneEventHandlers();
6245
- this.pruneConditionalListeners();
6292
+ this.conditionals?.prune(this.instances);
6246
6293
  }
6247
6294
  this.commitCurrentCollection(dirtyState);
6248
6295
  afterCommit?.();
@@ -6268,12 +6315,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6268
6315
  }
6269
6316
  for (const key of delta.removedKeys) {
6270
6317
  this.eventHandlers.delete(key);
6271
- this.conditionalListeners.delete(key);
6318
+ this.conditionals?.listeners.delete(key);
6272
6319
  }
6273
6320
  } else {
6274
6321
  this.rebuildElementIndex(this.instances);
6275
6322
  this.pruneEventHandlers();
6276
- this.pruneConditionalListeners();
6323
+ this.conditionals?.prune(this.instances);
6277
6324
  }
6278
6325
  this.commitCurrentCollection(dirtyState);
6279
6326
  afterCommit?.();
@@ -6290,7 +6337,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6290
6337
  this.instances = filteredInstances;
6291
6338
  if (!this.elementIndexComplete) this.rebuildElementIndex(this.instances);
6292
6339
  this.pruneEventHandlers();
6293
- this.pruneConditionalListeners();
6340
+ this.conditionals?.prune(this.instances);
6294
6341
  this.commitCurrentCollection(dirtyState);
6295
6342
  afterCommit?.();
6296
6343
  return;
@@ -6439,12 +6486,6 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6439
6486
  if (!this.instances.has(key)) this.eventHandlers.delete(key);
6440
6487
  }
6441
6488
  }
6442
- pruneConditionalListeners() {
6443
- if (this.conditionalListeners.size === 0) return;
6444
- for (const key of this.conditionalListeners.keys()) {
6445
- if (!this.instances.has(key)) this.conditionalListeners.delete(key);
6446
- }
6447
- }
6448
6489
  commitCurrentCollection(dirtyState) {
6449
6490
  this.collectionToken = options.keyedUpdates?.commit(
6450
6491
  this.currentProps.items(),
@@ -6499,7 +6540,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6499
6540
  this.reactElements = elements;
6500
6541
  this.rebuildElementIndex(instances);
6501
6542
  this.pruneEventHandlers();
6502
- this.pruneConditionalListeners();
6543
+ this.conditionals?.prune(this.instances);
6503
6544
  this.commitCurrentCollection();
6504
6545
  return true;
6505
6546
  }
@@ -6536,7 +6577,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6536
6577
  }
6537
6578
  notifyConditionalChanges(changes, afterCommit) {
6538
6579
  if (changes.length === 0) afterCommit?.();
6539
- else options.conditionals.notify(this.conditionalListeners, changes, afterCommit);
6580
+ else this.conditionals.notify(changes, afterCommit);
6540
6581
  }
6541
6582
  refreshDirtyBindings(dirtyState, afterCommit) {
6542
6583
  if (!this.mounted || !this.root || this.state.fallback || this.hasReactOwnedRows() || this.currentProps.hostBlocks || !this.currentProps.structureDependencies || this.currentProps.structureDependencies.some((dependency) => dirtyState.has(dependency)) || this.currentProps.bindings.some((binding) => binding.dependencies === void 0)) {
@@ -6653,22 +6694,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6653
6694
  } else {
6654
6695
  applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
6655
6696
  }
6656
- const conditionalValues = this.readConditionalValues(
6697
+ options.conditionals?.refresh(
6657
6698
  this.currentProps,
6699
+ existing,
6700
+ key,
6658
6701
  rows.items[index],
6659
- index
6702
+ index,
6703
+ conditionalChanges
6660
6704
  );
6661
- for (const [id, values] of conditionalValues) {
6662
- if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
6663
- conditionalChanges.push({
6664
- key,
6665
- id,
6666
- item: rows.items[index],
6667
- index
6668
- });
6669
- }
6670
- }
6671
- existing.conditionalValues = conditionalValues;
6672
6705
  existing.item = rows.items[index];
6673
6706
  existing.index = index;
6674
6707
  }
@@ -6775,22 +6808,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6775
6808
  } else {
6776
6809
  applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
6777
6810
  }
6778
- const conditionalValues = this.readConditionalValues(
6811
+ options.conditionals?.refresh(
6779
6812
  this.currentProps,
6813
+ existing,
6814
+ key,
6780
6815
  rows.items[index],
6781
- index
6816
+ index,
6817
+ conditionalChanges
6782
6818
  );
6783
- for (const [id, values] of conditionalValues) {
6784
- if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
6785
- conditionalChanges.push({
6786
- key,
6787
- id,
6788
- item: rows.items[index],
6789
- index
6790
- });
6791
- }
6792
- }
6793
- existing.conditionalValues = conditionalValues;
6794
6819
  existing.item = rows.items[index];
6795
6820
  existing.index = index;
6796
6821
  }
@@ -6799,7 +6824,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6799
6824
  instance.element.remove();
6800
6825
  this.instances.delete(instance.key);
6801
6826
  this.eventHandlers.delete(instance.key);
6802
- this.conditionalListeners.delete(instance.key);
6827
+ this.conditionals?.listeners.delete(instance.key);
6803
6828
  }
6804
6829
  this.commitCurrentCollection(dirtyState);
6805
6830
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
@@ -6840,7 +6865,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6840
6865
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
6841
6866
  this.elementIndexComplete = true;
6842
6867
  this.eventHandlers.clear();
6843
- this.conditionalListeners.clear();
6868
+ this.conditionals?.listeners.clear();
6844
6869
  this.commitCurrentCollection(dirtyState);
6845
6870
  afterCommit?.();
6846
6871
  return;
@@ -6873,10 +6898,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6873
6898
  let oldIndex = 0;
6874
6899
  for (const key of this.instances.keys()) oldIndices.set(key, oldIndex++);
6875
6900
  }
6876
- for (const [key, instance] of this.instances) {
6877
- if (!nextKeys.has(key)) {
6878
- instance.scope?.cleanup();
6879
- if (hasSurvivingRows) instance.element.remove();
6901
+ if (hasSurvivingRows || options.hostBlocks) {
6902
+ for (const [key, instance] of this.instances) {
6903
+ if (!nextKeys.has(key)) {
6904
+ instance.scope?.cleanup();
6905
+ if (hasSurvivingRows) instance.element.remove();
6906
+ }
6880
6907
  }
6881
6908
  }
6882
6909
  const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : [];
@@ -6902,22 +6929,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6902
6929
  } else {
6903
6930
  applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
6904
6931
  }
6905
- const conditionalValues = this.readConditionalValues(
6932
+ options.conditionals?.refresh(
6906
6933
  this.currentProps,
6934
+ existing,
6935
+ key,
6907
6936
  rows.items[index],
6908
- index
6937
+ index,
6938
+ conditionalChanges
6909
6939
  );
6910
- for (const [id, values] of conditionalValues) {
6911
- if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
6912
- conditionalChanges.push({
6913
- key,
6914
- id,
6915
- item: rows.items[index],
6916
- index
6917
- });
6918
- }
6919
- }
6920
- existing.conditionalValues = conditionalValues;
6921
6940
  existing.item = rows.items[index];
6922
6941
  existing.index = index;
6923
6942
  nextInstances.push(existing);
@@ -6980,7 +6999,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
6980
6999
  this.rebuildElementIndex(this.instances);
6981
7000
  }
6982
7001
  this.pruneEventHandlers();
6983
- this.pruneConditionalListeners();
7002
+ this.conditionals?.prune(this.instances);
6984
7003
  this.commitCurrentCollection(dirtyState);
6985
7004
  this.notifyConditionalChanges(conditionalChanges, afterCommit);
6986
7005
  }
@@ -7053,11 +7072,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
7053
7072
  this.instancesByElement = /* @__PURE__ */ new WeakMap();
7054
7073
  this.elementIndexComplete = true;
7055
7074
  this.eventHandlers.clear();
7056
- this.conditionalListeners.clear();
7075
+ this.conditionals?.listeners.clear();
7057
7076
  }
7058
7077
  render() {
7059
7078
  this.renderVersion += 1;
7060
- const container = this.currentProps.render(this.rowEvent, this.rowConditional);
7079
+ const container = this.currentProps.render(
7080
+ this.rowEvent,
7081
+ this.conditionals?.render || renderKeyedRowConditional
7082
+ );
7061
7083
  if (!React__default.default.isValidElement(container) || typeof container.type !== "string") {
7062
7084
  throw new TypeError(
7063
7085
  `Compiled keyed rows ${this.currentProps.id} must own one host container.`
@@ -7599,6 +7621,14 @@ var keyedRowsPositionHintedRuntimeFeature = {
7599
7621
  })
7600
7622
  })
7601
7623
  };
7624
+ var keyedRowsPlainPositionHintedRuntimeFeature = {
7625
+ name: "keyed-rows:plain-position-hinted",
7626
+ create: (owner) => ({
7627
+ KeyedRows: createKeyedRowsBlockComponentCore(owner, {
7628
+ keyedUpdates: keyedPositionUpdateRuntime
7629
+ })
7630
+ })
7631
+ };
7602
7632
  var keyedRowsBatchPositionHintedRuntimeFeature = {
7603
7633
  name: "keyed-rows:batch-position-hinted",
7604
7634
  create: (owner) => ({
@@ -7623,6 +7653,22 @@ var keyedRowsReorderHintedRuntimeFeature = {
7623
7653
  })
7624
7654
  })
7625
7655
  };
7656
+ var keyedRowsPlainReorderHintedRuntimeFeature = {
7657
+ name: "keyed-rows:plain-reorder-hinted",
7658
+ create: (owner) => ({
7659
+ KeyedRows: createKeyedRowsBlockComponentCore(owner, {
7660
+ keyedUpdates: keyedReorderUpdateRuntime
7661
+ })
7662
+ })
7663
+ };
7664
+ var keyedRowsPlainMapReorderHintedRuntimeFeature = {
7665
+ name: "keyed-rows:plain-map-reorder-hinted",
7666
+ create: (owner) => ({
7667
+ KeyedRows: createKeyedRowsBlockComponentCore(owner, {
7668
+ keyedUpdates: keyedMapReorderUpdateRuntime
7669
+ })
7670
+ })
7671
+ };
7626
7672
  var keyedRowsMapReorderHintedRuntimeFeature = {
7627
7673
  name: "keyed-rows:map-reorder-hinted",
7628
7674
  create: (owner) => ({
@@ -8307,6 +8353,26 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8307
8353
  current: definition
8308
8354
  };
8309
8355
  const refreshListeners = /* @__PURE__ */ new Set();
8356
+ const component = createCompiledComponentRuntime(
8357
+ definitionReference,
8358
+ runtimeFeatures,
8359
+ refreshListeners
8360
+ );
8361
+ if (definition.hmrId) {
8362
+ getCompilerHmrRegistry().set(definition.hmrId, {
8363
+ component,
8364
+ definition: definitionReference,
8365
+ refreshListeners,
8366
+ stateSignature,
8367
+ runtimeSignature
8368
+ });
8369
+ }
8370
+ return component;
8371
+ }
8372
+ function createCompiledComponentWithoutRefresh(definition, runtimeFeatures) {
8373
+ return createCompiledComponentRuntime({ current: definition }, runtimeFeatures);
8374
+ }
8375
+ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, refreshListeners) {
8310
8376
  class FarmCompiledComponent extends React__default.default.Component {
8311
8377
  constructor(props) {
8312
8378
  super(props);
@@ -8617,7 +8683,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8617
8683
  }
8618
8684
  componentDidMount() {
8619
8685
  this.mounted = true;
8620
- refreshListeners.add(this.refreshDefinition);
8686
+ refreshListeners?.add(this.refreshDefinition);
8621
8687
  this.componentDidUpdate();
8622
8688
  }
8623
8689
  getSnapshotBeforeUpdate() {
@@ -8673,7 +8739,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8673
8739
  this.bindingValues.clear();
8674
8740
  this.activeBinding = null;
8675
8741
  this.activeDependencies = null;
8676
- refreshListeners.delete(this.refreshDefinition);
8742
+ refreshListeners?.delete(this.refreshDefinition);
8677
8743
  }
8678
8744
  render() {
8679
8745
  if (this.hasBindingError) throw this.bindingError;
@@ -8715,18 +8781,8 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
8715
8781
  return renderedElement;
8716
8782
  }
8717
8783
  }
8718
- FarmCompiledComponent.displayName = `FarmCompiled(${definition.displayName})`;
8719
- const component = FarmCompiledComponent;
8720
- if (definition.hmrId) {
8721
- getCompilerHmrRegistry().set(definition.hmrId, {
8722
- component,
8723
- definition: definitionReference,
8724
- refreshListeners,
8725
- stateSignature,
8726
- runtimeSignature
8727
- });
8728
- }
8729
- return component;
8784
+ FarmCompiledComponent.displayName = `FarmCompiled(${definitionReference.current.displayName})`;
8785
+ return FarmCompiledComponent;
8730
8786
  }
8731
8787
  var COMPLETE_RUNTIME_FEATURES = [
8732
8788
  conditionalRuntimeFeature,
@@ -8748,6 +8804,7 @@ exports.conditionalRangesRuntimeFeature = conditionalRangesRuntimeFeature;
8748
8804
  exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
8749
8805
  exports.createCompiledComponent = createCompiledComponent;
8750
8806
  exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
8807
+ exports.createCompiledComponentWithoutRefresh = createCompiledComponentWithoutRefresh;
8751
8808
  exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
8752
8809
  exports.createCompilerKeyedArrayBatchInsert = createCompilerKeyedArrayBatchInsert;
8753
8810
  exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
@@ -8847,6 +8904,9 @@ exports.keyedRowsMapLookupRuntimeFeature = keyedRowsMapLookupRuntimeFeature;
8847
8904
  exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;
8848
8905
  exports.keyedRowsMappedRollingWindowHintedRuntimeFeature = keyedRowsMappedRollingWindowHintedRuntimeFeature;
8849
8906
  exports.keyedRowsMembershipRuntimeFeature = keyedRowsMembershipRuntimeFeature;
8907
+ exports.keyedRowsPlainMapReorderHintedRuntimeFeature = keyedRowsPlainMapReorderHintedRuntimeFeature;
8908
+ exports.keyedRowsPlainPositionHintedRuntimeFeature = keyedRowsPlainPositionHintedRuntimeFeature;
8909
+ exports.keyedRowsPlainReorderHintedRuntimeFeature = keyedRowsPlainReorderHintedRuntimeFeature;
8850
8910
  exports.keyedRowsPlainRuntimeFeature = keyedRowsPlainRuntimeFeature;
8851
8911
  exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
8852
8912
  exports.keyedRowsPrependHintedRuntimeFeature = keyedRowsPrependHintedRuntimeFeature;