@farm.js/react 0.1.0-beta.37 → 0.1.0-beta.38
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 +5 -0
- package/dist/client.d.mts +0 -1
- package/dist/client.d.ts +0 -1
- package/dist/compiler-runtime.cjs +139 -199
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +1 -13
- package/dist/compiler-runtime.d.ts +1 -13
- package/dist/compiler-runtime.mjs +140 -196
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/server.d.mts +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/vite.cjs +192 -353
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +192 -353
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1123,6 +1123,11 @@ 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
|
+
State-dependent `contentEditable` bindings and non-literal `contentEditable` values in host
|
|
1127
|
+
descriptors remain React-owned. This preserves the difference between explicit `false` (not editable)
|
|
1128
|
+
and an absent value (inherit from the parent). Literal strings on ordinary direct hosts remain
|
|
1129
|
+
eligible for compilation.
|
|
1130
|
+
|
|
1126
1131
|
`title` and `meta` elements inside conditional, keyed, or recursive host descriptors remain
|
|
1127
1132
|
React-owned. React decides their document placement and cleanup, including React 19 head placement
|
|
1128
1133
|
and the `itemProp` exception. The compiler does not implement a separate metadata manager.
|
package/dist/client.d.mts
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -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");
|
|
1586
1587
|
function getCompilerHmrRegistry() {
|
|
1587
|
-
const registryKey = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
|
|
1588
1588
|
const globalTarget = globalThis;
|
|
1589
|
-
const existing = globalTarget[
|
|
1589
|
+
const existing = globalTarget[COMPILER_HMR_REGISTRY];
|
|
1590
1590
|
if (existing instanceof Map) return existing;
|
|
1591
1591
|
const registry = /* @__PURE__ */ new Map();
|
|
1592
|
-
globalTarget[
|
|
1592
|
+
globalTarget[COMPILER_HMR_REGISTRY] = registry;
|
|
1593
1593
|
return registry;
|
|
1594
1594
|
}
|
|
1595
1595
|
function renderTextValue(value) {
|
|
@@ -1731,9 +1731,6 @@ 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
|
-
}
|
|
1737
1734
|
return;
|
|
1738
1735
|
}
|
|
1739
1736
|
if (name === "value" && isSelectElement(element)) {
|
|
@@ -1757,20 +1754,8 @@ function updateAttribute(element, name, value) {
|
|
|
1757
1754
|
} else if (value === true && !stringifiesBoolean) {
|
|
1758
1755
|
element.setAttribute(attributeName, "");
|
|
1759
1756
|
} else {
|
|
1760
|
-
element.setAttribute(attributeName,
|
|
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;
|
|
1757
|
+
element.setAttribute(attributeName, String(value));
|
|
1771
1758
|
}
|
|
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;
|
|
1774
1759
|
}
|
|
1775
1760
|
function createConditionalBlockComponent(owner) {
|
|
1776
1761
|
class FarmConditionalBlock extends React__default.default.Component {
|
|
@@ -2550,7 +2535,7 @@ function readKeyedRowBindingValues(props, item, index) {
|
|
|
2550
2535
|
var KEYED_ROW_TEMPLATES = /* @__PURE__ */ new WeakMap();
|
|
2551
2536
|
function createKeyedRowInstance(props, document, key, item, index) {
|
|
2552
2537
|
const template = props.cloneRows && KEYED_ROW_TEMPLATES.get(props);
|
|
2553
|
-
const element = template ? template.
|
|
2538
|
+
const element = template ? template.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
|
|
2554
2539
|
const instance = {
|
|
2555
2540
|
key,
|
|
2556
2541
|
element,
|
|
@@ -2560,21 +2545,16 @@ function createKeyedRowInstance(props, document, key, item, index) {
|
|
|
2560
2545
|
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2561
2546
|
};
|
|
2562
2547
|
if (props.cloneRows) {
|
|
2563
|
-
|
|
2548
|
+
const targets = [];
|
|
2564
2549
|
let found = true;
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
found && (found = target !== null);
|
|
2570
|
-
targets.push(target);
|
|
2571
|
-
}
|
|
2550
|
+
for (const binding of props.bindings) {
|
|
2551
|
+
const target = findCompilerHostTarget(element, binding.path);
|
|
2552
|
+
found && (found = target !== null);
|
|
2553
|
+
targets.push(target);
|
|
2572
2554
|
}
|
|
2573
2555
|
if (found) instance.targets = targets;
|
|
2574
2556
|
if (template) {
|
|
2575
2557
|
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;
|
|
2578
2558
|
commitKeyedRowBinding(
|
|
2579
2559
|
props.bindings[bindingIndex],
|
|
2580
2560
|
instance,
|
|
@@ -2600,20 +2580,10 @@ function keyedRowTemplate(props, element, targets) {
|
|
|
2600
2580
|
}
|
|
2601
2581
|
}
|
|
2602
2582
|
const template = element.cloneNode(true);
|
|
2603
|
-
const
|
|
2604
|
-
const classTargets = /* @__PURE__ */ new Set();
|
|
2605
|
-
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
2606
|
-
const binding = props.bindings[bindingIndex];
|
|
2583
|
+
for (const binding of props.bindings) {
|
|
2607
2584
|
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
|
-
}
|
|
2615
2585
|
}
|
|
2616
|
-
return
|
|
2586
|
+
return template;
|
|
2617
2587
|
}
|
|
2618
2588
|
function applyKeyedRowBindings(props, instance, item, index) {
|
|
2619
2589
|
if (props.bindings.length < 2) {
|
|
@@ -4603,7 +4573,13 @@ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, ins
|
|
|
4603
4573
|
}
|
|
4604
4574
|
}
|
|
4605
4575
|
applyKeyedRowBindings(props, instance, item, index);
|
|
4606
|
-
conditionals?.
|
|
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;
|
|
4607
4583
|
instance.item = item;
|
|
4608
4584
|
}
|
|
4609
4585
|
return {
|
|
@@ -6018,7 +5994,6 @@ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, i
|
|
|
6018
5994
|
for (const instance of instances.values()) instance.index = index++;
|
|
6019
5995
|
return instances;
|
|
6020
5996
|
}
|
|
6021
|
-
var renderKeyedRowConditional = (item, index, _id, render) => render(item, index);
|
|
6022
5997
|
function createKeyedRowConditionalRuntime() {
|
|
6023
5998
|
class FarmKeyedRowConditional extends React__default.default.Component {
|
|
6024
5999
|
constructor() {
|
|
@@ -6061,48 +6036,30 @@ function createKeyedRowConditionalRuntime() {
|
|
|
6061
6036
|
}
|
|
6062
6037
|
}
|
|
6063
6038
|
FarmKeyedRowConditional.displayName = "FarmCompiledKeyedRowConditional";
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
row
|
|
6076
|
-
|
|
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
|
-
};
|
|
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);
|
|
6082
6052
|
}
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
key
|
|
6089
|
-
|
|
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);
|
|
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
|
+
};
|
|
6103
6060
|
}
|
|
6104
|
-
}
|
|
6105
|
-
notify(changes, afterCommit) {
|
|
6061
|
+
}),
|
|
6062
|
+
notify(listeners, changes, afterCommit) {
|
|
6106
6063
|
let pending = changes.length;
|
|
6107
6064
|
const committed = () => {
|
|
6108
6065
|
pending -= 1;
|
|
@@ -6110,25 +6067,12 @@ function createKeyedRowConditionalRuntime() {
|
|
|
6110
6067
|
};
|
|
6111
6068
|
reactDom.flushSync(() => {
|
|
6112
6069
|
for (const change of changes) {
|
|
6113
|
-
const refresh =
|
|
6070
|
+
const refresh = listeners.get(change.key)?.get(change.id);
|
|
6114
6071
|
if (refresh) refresh(change.item, change.index, committed);
|
|
6115
6072
|
else committed();
|
|
6116
6073
|
}
|
|
6117
6074
|
});
|
|
6118
6075
|
}
|
|
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
|
-
}
|
|
6132
6076
|
};
|
|
6133
6077
|
}
|
|
6134
6078
|
function createKeyedRowHostRuntime() {
|
|
@@ -6158,10 +6102,11 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6158
6102
|
this.keyedTargets = options.keyedTargets?.(this.props);
|
|
6159
6103
|
this.renderVersion = 0;
|
|
6160
6104
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
6161
|
-
this.
|
|
6105
|
+
this.conditionalListeners = /* @__PURE__ */ new Map();
|
|
6162
6106
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
6163
6107
|
// False after a rebuild without delegated events left surviving rows unindexed.
|
|
6164
6108
|
this.elementIndexComplete = true;
|
|
6109
|
+
this.conditionalOwner = options.conditionals?.owner(this.conditionalListeners);
|
|
6165
6110
|
this.captureRoot = (root) => {
|
|
6166
6111
|
this.root = root;
|
|
6167
6112
|
};
|
|
@@ -6197,18 +6142,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6197
6142
|
const eventTarget = event.target;
|
|
6198
6143
|
if (!instance || !eventTarget) return;
|
|
6199
6144
|
const capture = name.endsWith("Capture");
|
|
6200
|
-
const
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
matches.push({ descriptor, target });
|
|
6209
|
-
}
|
|
6210
|
-
}
|
|
6211
|
-
matches.sort(
|
|
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(
|
|
6212
6153
|
(left, right) => capture ? (left.descriptor.path?.length || 0) - (right.descriptor.path?.length || 0) : (right.descriptor.path?.length || 0) - (left.descriptor.path?.length || 0)
|
|
6213
6154
|
);
|
|
6214
6155
|
for (const match of matches) {
|
|
@@ -6216,6 +6157,18 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6216
6157
|
if (event.isPropagationStopped()) break;
|
|
6217
6158
|
}
|
|
6218
6159
|
};
|
|
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
|
+
};
|
|
6219
6172
|
this.refresh = (afterCommit, dirtyState) => {
|
|
6220
6173
|
if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
|
|
6221
6174
|
const result = options.keyedUpdates.reconcile(
|
|
@@ -6269,7 +6222,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6269
6222
|
this.instances = positionedInstances;
|
|
6270
6223
|
this.rebuildElementIndex(this.instances);
|
|
6271
6224
|
this.pruneEventHandlers();
|
|
6272
|
-
this.
|
|
6225
|
+
this.pruneConditionalListeners();
|
|
6273
6226
|
}
|
|
6274
6227
|
this.commitCurrentCollection(dirtyState);
|
|
6275
6228
|
afterCommit?.();
|
|
@@ -6289,7 +6242,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6289
6242
|
if (removedRows) {
|
|
6290
6243
|
this.rebuildElementIndex(this.instances);
|
|
6291
6244
|
this.pruneEventHandlers();
|
|
6292
|
-
this.
|
|
6245
|
+
this.pruneConditionalListeners();
|
|
6293
6246
|
}
|
|
6294
6247
|
this.commitCurrentCollection(dirtyState);
|
|
6295
6248
|
afterCommit?.();
|
|
@@ -6315,12 +6268,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6315
6268
|
}
|
|
6316
6269
|
for (const key of delta.removedKeys) {
|
|
6317
6270
|
this.eventHandlers.delete(key);
|
|
6318
|
-
this.
|
|
6271
|
+
this.conditionalListeners.delete(key);
|
|
6319
6272
|
}
|
|
6320
6273
|
} else {
|
|
6321
6274
|
this.rebuildElementIndex(this.instances);
|
|
6322
6275
|
this.pruneEventHandlers();
|
|
6323
|
-
this.
|
|
6276
|
+
this.pruneConditionalListeners();
|
|
6324
6277
|
}
|
|
6325
6278
|
this.commitCurrentCollection(dirtyState);
|
|
6326
6279
|
afterCommit?.();
|
|
@@ -6337,7 +6290,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6337
6290
|
this.instances = filteredInstances;
|
|
6338
6291
|
if (!this.elementIndexComplete) this.rebuildElementIndex(this.instances);
|
|
6339
6292
|
this.pruneEventHandlers();
|
|
6340
|
-
this.
|
|
6293
|
+
this.pruneConditionalListeners();
|
|
6341
6294
|
this.commitCurrentCollection(dirtyState);
|
|
6342
6295
|
afterCommit?.();
|
|
6343
6296
|
return;
|
|
@@ -6486,6 +6439,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6486
6439
|
if (!this.instances.has(key)) this.eventHandlers.delete(key);
|
|
6487
6440
|
}
|
|
6488
6441
|
}
|
|
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
|
+
}
|
|
6489
6448
|
commitCurrentCollection(dirtyState) {
|
|
6490
6449
|
this.collectionToken = options.keyedUpdates?.commit(
|
|
6491
6450
|
this.currentProps.items(),
|
|
@@ -6540,7 +6499,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6540
6499
|
this.reactElements = elements;
|
|
6541
6500
|
this.rebuildElementIndex(instances);
|
|
6542
6501
|
this.pruneEventHandlers();
|
|
6543
|
-
this.
|
|
6502
|
+
this.pruneConditionalListeners();
|
|
6544
6503
|
this.commitCurrentCollection();
|
|
6545
6504
|
return true;
|
|
6546
6505
|
}
|
|
@@ -6577,7 +6536,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6577
6536
|
}
|
|
6578
6537
|
notifyConditionalChanges(changes, afterCommit) {
|
|
6579
6538
|
if (changes.length === 0) afterCommit?.();
|
|
6580
|
-
else
|
|
6539
|
+
else options.conditionals.notify(this.conditionalListeners, changes, afterCommit);
|
|
6581
6540
|
}
|
|
6582
6541
|
refreshDirtyBindings(dirtyState, afterCommit) {
|
|
6583
6542
|
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)) {
|
|
@@ -6694,14 +6653,22 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6694
6653
|
} else {
|
|
6695
6654
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6696
6655
|
}
|
|
6697
|
-
|
|
6656
|
+
const conditionalValues = this.readConditionalValues(
|
|
6698
6657
|
this.currentProps,
|
|
6699
|
-
existing,
|
|
6700
|
-
key,
|
|
6701
6658
|
rows.items[index],
|
|
6702
|
-
index
|
|
6703
|
-
conditionalChanges
|
|
6659
|
+
index
|
|
6704
6660
|
);
|
|
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;
|
|
6705
6672
|
existing.item = rows.items[index];
|
|
6706
6673
|
existing.index = index;
|
|
6707
6674
|
}
|
|
@@ -6808,14 +6775,22 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6808
6775
|
} else {
|
|
6809
6776
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6810
6777
|
}
|
|
6811
|
-
|
|
6778
|
+
const conditionalValues = this.readConditionalValues(
|
|
6812
6779
|
this.currentProps,
|
|
6813
|
-
existing,
|
|
6814
|
-
key,
|
|
6815
6780
|
rows.items[index],
|
|
6816
|
-
index
|
|
6817
|
-
conditionalChanges
|
|
6781
|
+
index
|
|
6818
6782
|
);
|
|
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;
|
|
6819
6794
|
existing.item = rows.items[index];
|
|
6820
6795
|
existing.index = index;
|
|
6821
6796
|
}
|
|
@@ -6824,7 +6799,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6824
6799
|
instance.element.remove();
|
|
6825
6800
|
this.instances.delete(instance.key);
|
|
6826
6801
|
this.eventHandlers.delete(instance.key);
|
|
6827
|
-
this.
|
|
6802
|
+
this.conditionalListeners.delete(instance.key);
|
|
6828
6803
|
}
|
|
6829
6804
|
this.commitCurrentCollection(dirtyState);
|
|
6830
6805
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
@@ -6865,7 +6840,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6865
6840
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
6866
6841
|
this.elementIndexComplete = true;
|
|
6867
6842
|
this.eventHandlers.clear();
|
|
6868
|
-
this.
|
|
6843
|
+
this.conditionalListeners.clear();
|
|
6869
6844
|
this.commitCurrentCollection(dirtyState);
|
|
6870
6845
|
afterCommit?.();
|
|
6871
6846
|
return;
|
|
@@ -6898,12 +6873,10 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6898
6873
|
let oldIndex = 0;
|
|
6899
6874
|
for (const key of this.instances.keys()) oldIndices.set(key, oldIndex++);
|
|
6900
6875
|
}
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
if (hasSurvivingRows) instance.element.remove();
|
|
6906
|
-
}
|
|
6876
|
+
for (const [key, instance] of this.instances) {
|
|
6877
|
+
if (!nextKeys.has(key)) {
|
|
6878
|
+
instance.scope?.cleanup();
|
|
6879
|
+
if (hasSurvivingRows) instance.element.remove();
|
|
6907
6880
|
}
|
|
6908
6881
|
}
|
|
6909
6882
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : [];
|
|
@@ -6929,14 +6902,22 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6929
6902
|
} else {
|
|
6930
6903
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6931
6904
|
}
|
|
6932
|
-
|
|
6905
|
+
const conditionalValues = this.readConditionalValues(
|
|
6933
6906
|
this.currentProps,
|
|
6934
|
-
existing,
|
|
6935
|
-
key,
|
|
6936
6907
|
rows.items[index],
|
|
6937
|
-
index
|
|
6938
|
-
conditionalChanges
|
|
6908
|
+
index
|
|
6939
6909
|
);
|
|
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;
|
|
6940
6921
|
existing.item = rows.items[index];
|
|
6941
6922
|
existing.index = index;
|
|
6942
6923
|
nextInstances.push(existing);
|
|
@@ -6999,7 +6980,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6999
6980
|
this.rebuildElementIndex(this.instances);
|
|
7000
6981
|
}
|
|
7001
6982
|
this.pruneEventHandlers();
|
|
7002
|
-
this.
|
|
6983
|
+
this.pruneConditionalListeners();
|
|
7003
6984
|
this.commitCurrentCollection(dirtyState);
|
|
7004
6985
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
7005
6986
|
}
|
|
@@ -7072,14 +7053,11 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
7072
7053
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
7073
7054
|
this.elementIndexComplete = true;
|
|
7074
7055
|
this.eventHandlers.clear();
|
|
7075
|
-
this.
|
|
7056
|
+
this.conditionalListeners.clear();
|
|
7076
7057
|
}
|
|
7077
7058
|
render() {
|
|
7078
7059
|
this.renderVersion += 1;
|
|
7079
|
-
const container = this.currentProps.render(
|
|
7080
|
-
this.rowEvent,
|
|
7081
|
-
this.conditionals?.render || renderKeyedRowConditional
|
|
7082
|
-
);
|
|
7060
|
+
const container = this.currentProps.render(this.rowEvent, this.rowConditional);
|
|
7083
7061
|
if (!React__default.default.isValidElement(container) || typeof container.type !== "string") {
|
|
7084
7062
|
throw new TypeError(
|
|
7085
7063
|
`Compiled keyed rows ${this.currentProps.id} must own one host container.`
|
|
@@ -7621,14 +7599,6 @@ var keyedRowsPositionHintedRuntimeFeature = {
|
|
|
7621
7599
|
})
|
|
7622
7600
|
})
|
|
7623
7601
|
};
|
|
7624
|
-
var keyedRowsPlainPositionHintedRuntimeFeature = {
|
|
7625
|
-
name: "keyed-rows:plain-position-hinted",
|
|
7626
|
-
create: (owner) => ({
|
|
7627
|
-
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7628
|
-
keyedUpdates: keyedPositionUpdateRuntime
|
|
7629
|
-
})
|
|
7630
|
-
})
|
|
7631
|
-
};
|
|
7632
7602
|
var keyedRowsBatchPositionHintedRuntimeFeature = {
|
|
7633
7603
|
name: "keyed-rows:batch-position-hinted",
|
|
7634
7604
|
create: (owner) => ({
|
|
@@ -7653,22 +7623,6 @@ var keyedRowsReorderHintedRuntimeFeature = {
|
|
|
7653
7623
|
})
|
|
7654
7624
|
})
|
|
7655
7625
|
};
|
|
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
|
-
};
|
|
7672
7626
|
var keyedRowsMapReorderHintedRuntimeFeature = {
|
|
7673
7627
|
name: "keyed-rows:map-reorder-hinted",
|
|
7674
7628
|
create: (owner) => ({
|
|
@@ -8353,26 +8307,6 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8353
8307
|
current: definition
|
|
8354
8308
|
};
|
|
8355
8309
|
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) {
|
|
8376
8310
|
class FarmCompiledComponent extends React__default.default.Component {
|
|
8377
8311
|
constructor(props) {
|
|
8378
8312
|
super(props);
|
|
@@ -8683,7 +8617,7 @@ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, re
|
|
|
8683
8617
|
}
|
|
8684
8618
|
componentDidMount() {
|
|
8685
8619
|
this.mounted = true;
|
|
8686
|
-
refreshListeners
|
|
8620
|
+
refreshListeners.add(this.refreshDefinition);
|
|
8687
8621
|
this.componentDidUpdate();
|
|
8688
8622
|
}
|
|
8689
8623
|
getSnapshotBeforeUpdate() {
|
|
@@ -8739,7 +8673,7 @@ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, re
|
|
|
8739
8673
|
this.bindingValues.clear();
|
|
8740
8674
|
this.activeBinding = null;
|
|
8741
8675
|
this.activeDependencies = null;
|
|
8742
|
-
refreshListeners
|
|
8676
|
+
refreshListeners.delete(this.refreshDefinition);
|
|
8743
8677
|
}
|
|
8744
8678
|
render() {
|
|
8745
8679
|
if (this.hasBindingError) throw this.bindingError;
|
|
@@ -8781,8 +8715,18 @@ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, re
|
|
|
8781
8715
|
return renderedElement;
|
|
8782
8716
|
}
|
|
8783
8717
|
}
|
|
8784
|
-
FarmCompiledComponent.displayName = `FarmCompiled(${
|
|
8785
|
-
|
|
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;
|
|
8786
8730
|
}
|
|
8787
8731
|
var COMPLETE_RUNTIME_FEATURES = [
|
|
8788
8732
|
conditionalRuntimeFeature,
|
|
@@ -8804,7 +8748,6 @@ exports.conditionalRangesRuntimeFeature = conditionalRangesRuntimeFeature;
|
|
|
8804
8748
|
exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
|
|
8805
8749
|
exports.createCompiledComponent = createCompiledComponent;
|
|
8806
8750
|
exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
|
|
8807
|
-
exports.createCompiledComponentWithoutRefresh = createCompiledComponentWithoutRefresh;
|
|
8808
8751
|
exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
|
|
8809
8752
|
exports.createCompilerKeyedArrayBatchInsert = createCompilerKeyedArrayBatchInsert;
|
|
8810
8753
|
exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
|
|
@@ -8904,9 +8847,6 @@ exports.keyedRowsMapLookupRuntimeFeature = keyedRowsMapLookupRuntimeFeature;
|
|
|
8904
8847
|
exports.keyedRowsMapReorderHintedRuntimeFeature = keyedRowsMapReorderHintedRuntimeFeature;
|
|
8905
8848
|
exports.keyedRowsMappedRollingWindowHintedRuntimeFeature = keyedRowsMappedRollingWindowHintedRuntimeFeature;
|
|
8906
8849
|
exports.keyedRowsMembershipRuntimeFeature = keyedRowsMembershipRuntimeFeature;
|
|
8907
|
-
exports.keyedRowsPlainMapReorderHintedRuntimeFeature = keyedRowsPlainMapReorderHintedRuntimeFeature;
|
|
8908
|
-
exports.keyedRowsPlainPositionHintedRuntimeFeature = keyedRowsPlainPositionHintedRuntimeFeature;
|
|
8909
|
-
exports.keyedRowsPlainReorderHintedRuntimeFeature = keyedRowsPlainReorderHintedRuntimeFeature;
|
|
8910
8850
|
exports.keyedRowsPlainRuntimeFeature = keyedRowsPlainRuntimeFeature;
|
|
8911
8851
|
exports.keyedRowsPositionHintedRuntimeFeature = keyedRowsPositionHintedRuntimeFeature;
|
|
8912
8852
|
exports.keyedRowsPrependHintedRuntimeFeature = keyedRowsPrependHintedRuntimeFeature;
|