@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
|
@@ -1577,13 +1577,13 @@ function createCompilerKeyedCollectionUpdate(previous, value, kind) {
|
|
|
1577
1577
|
return value;
|
|
1578
1578
|
}
|
|
1579
1579
|
var delegatedRowChangePlaceholder = () => void 0;
|
|
1580
|
+
var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
|
|
1580
1581
|
function getCompilerHmrRegistry() {
|
|
1581
|
-
const registryKey = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
|
|
1582
1582
|
const globalTarget = globalThis;
|
|
1583
|
-
const existing = globalTarget[
|
|
1583
|
+
const existing = globalTarget[COMPILER_HMR_REGISTRY];
|
|
1584
1584
|
if (existing instanceof Map) return existing;
|
|
1585
1585
|
const registry = /* @__PURE__ */ new Map();
|
|
1586
|
-
globalTarget[
|
|
1586
|
+
globalTarget[COMPILER_HMR_REGISTRY] = registry;
|
|
1587
1587
|
return registry;
|
|
1588
1588
|
}
|
|
1589
1589
|
function renderTextValue(value) {
|
|
@@ -1725,9 +1725,6 @@ function updateAttribute(element, name, value) {
|
|
|
1725
1725
|
if (name === "value" && (isInputElement(element) || isTextAreaElement(element))) {
|
|
1726
1726
|
const nextValue = value === null || value === void 0 ? "" : String(value);
|
|
1727
1727
|
if (element.value !== nextValue) element.value = nextValue;
|
|
1728
|
-
if (value != null && isInputElement(element) && (element.type !== "number" || element.ownerDocument.activeElement !== element) && element.defaultValue !== nextValue) {
|
|
1729
|
-
element.defaultValue = nextValue;
|
|
1730
|
-
}
|
|
1731
1728
|
return;
|
|
1732
1729
|
}
|
|
1733
1730
|
if (name === "value" && isSelectElement(element)) {
|
|
@@ -1751,20 +1748,8 @@ function updateAttribute(element, name, value) {
|
|
|
1751
1748
|
} else if (value === true && !stringifiesBoolean) {
|
|
1752
1749
|
element.setAttribute(attributeName, "");
|
|
1753
1750
|
} else {
|
|
1754
|
-
element.setAttribute(attributeName,
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
var JAVASCRIPT_URL = (
|
|
1758
|
-
// oxlint-disable-next-line no-control-regex
|
|
1759
|
-
/^[\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
|
|
1760
|
-
);
|
|
1761
|
-
var BLOCKS_JAVASCRIPT_URLS = Number.parseInt(React.version, 10) > 18;
|
|
1762
|
-
function compilerAttributeValue(element, name, value) {
|
|
1763
|
-
if (!BLOCKS_JAVASCRIPT_URLS || name !== "href" && name !== "src" && name !== "action" && name !== "formAction" && name !== "data") {
|
|
1764
|
-
return value;
|
|
1751
|
+
element.setAttribute(attributeName, String(value));
|
|
1765
1752
|
}
|
|
1766
|
-
const tag = element.localName;
|
|
1767
|
-
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;
|
|
1768
1753
|
}
|
|
1769
1754
|
function createConditionalBlockComponent(owner) {
|
|
1770
1755
|
class FarmConditionalBlock extends React.Component {
|
|
@@ -2544,7 +2529,7 @@ function readKeyedRowBindingValues(props, item, index) {
|
|
|
2544
2529
|
var KEYED_ROW_TEMPLATES = /* @__PURE__ */ new WeakMap();
|
|
2545
2530
|
function createKeyedRowInstance(props, document, key, item, index) {
|
|
2546
2531
|
const template = props.cloneRows && KEYED_ROW_TEMPLATES.get(props);
|
|
2547
|
-
const element = template ? template.
|
|
2532
|
+
const element = template ? template.cloneNode(true) : createCompilerHostElement(document, props.create(item, index));
|
|
2548
2533
|
const instance = {
|
|
2549
2534
|
key,
|
|
2550
2535
|
element,
|
|
@@ -2554,21 +2539,16 @@ function createKeyedRowInstance(props, document, key, item, index) {
|
|
|
2554
2539
|
conditionalValues: EMPTY_KEYED_ROW_CONDITIONAL_VALUES
|
|
2555
2540
|
};
|
|
2556
2541
|
if (props.cloneRows) {
|
|
2557
|
-
|
|
2542
|
+
const targets = [];
|
|
2558
2543
|
let found = true;
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
found && (found = target !== null);
|
|
2564
|
-
targets.push(target);
|
|
2565
|
-
}
|
|
2544
|
+
for (const binding of props.bindings) {
|
|
2545
|
+
const target = findCompilerHostTarget(element, binding.path);
|
|
2546
|
+
found && (found = target !== null);
|
|
2547
|
+
targets.push(target);
|
|
2566
2548
|
}
|
|
2567
2549
|
if (found) instance.targets = targets;
|
|
2568
2550
|
if (template) {
|
|
2569
2551
|
for (let bindingIndex = 0; bindingIndex < targets.length; bindingIndex += 1) {
|
|
2570
|
-
const value = instance.values[bindingIndex];
|
|
2571
|
-
if (typeof value === "string" && value === template.classNames[bindingIndex]) continue;
|
|
2572
2552
|
commitKeyedRowBinding(
|
|
2573
2553
|
props.bindings[bindingIndex],
|
|
2574
2554
|
instance,
|
|
@@ -2594,20 +2574,10 @@ function keyedRowTemplate(props, element, targets) {
|
|
|
2594
2574
|
}
|
|
2595
2575
|
}
|
|
2596
2576
|
const template = element.cloneNode(true);
|
|
2597
|
-
const
|
|
2598
|
-
const classTargets = /* @__PURE__ */ new Set();
|
|
2599
|
-
for (let bindingIndex = 0; bindingIndex < props.bindings.length; bindingIndex += 1) {
|
|
2600
|
-
const binding = props.bindings[bindingIndex];
|
|
2577
|
+
for (const binding of props.bindings) {
|
|
2601
2578
|
if (binding.kind === "text") findCompilerHostTarget(template, binding.path).textContent = "";
|
|
2602
|
-
if (binding.kind === "attribute" && (binding.name === "className" || binding.name === "class")) {
|
|
2603
|
-
const target = targets[bindingIndex];
|
|
2604
|
-
if (!classTargets.has(target)) {
|
|
2605
|
-
classNames[bindingIndex] = target.getAttribute("class") ?? void 0;
|
|
2606
|
-
classTargets.add(target);
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
2579
|
}
|
|
2610
|
-
return
|
|
2580
|
+
return template;
|
|
2611
2581
|
}
|
|
2612
2582
|
function applyKeyedRowBindings(props, instance, item, index) {
|
|
2613
2583
|
if (props.bindings.length < 2) {
|
|
@@ -4597,7 +4567,13 @@ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, ins
|
|
|
4597
4567
|
}
|
|
4598
4568
|
}
|
|
4599
4569
|
applyKeyedRowBindings(props, instance, item, index);
|
|
4600
|
-
conditionals?.
|
|
4570
|
+
const conditionalValues = conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
|
|
4571
|
+
for (const [id, values] of conditionalValues) {
|
|
4572
|
+
if (conditionals?.changed(instance.conditionalValues.get(id), values)) {
|
|
4573
|
+
conditionalChanges.push({ key, id, item, index });
|
|
4574
|
+
}
|
|
4575
|
+
}
|
|
4576
|
+
instance.conditionalValues = conditionalValues;
|
|
4601
4577
|
instance.item = item;
|
|
4602
4578
|
}
|
|
4603
4579
|
return {
|
|
@@ -6012,7 +5988,6 @@ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, i
|
|
|
6012
5988
|
for (const instance of instances.values()) instance.index = index++;
|
|
6013
5989
|
return instances;
|
|
6014
5990
|
}
|
|
6015
|
-
var renderKeyedRowConditional = (item, index, _id, render) => render(item, index);
|
|
6016
5991
|
function createKeyedRowConditionalRuntime() {
|
|
6017
5992
|
class FarmKeyedRowConditional extends React.Component {
|
|
6018
5993
|
constructor() {
|
|
@@ -6055,48 +6030,30 @@ function createKeyedRowConditionalRuntime() {
|
|
|
6055
6030
|
}
|
|
6056
6031
|
}
|
|
6057
6032
|
FarmKeyedRowConditional.displayName = "FarmCompiledKeyedRowConditional";
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
row
|
|
6070
|
-
|
|
6071
|
-
const current = this.listeners.get(key);
|
|
6072
|
-
if (current?.get(id) !== refresh) return;
|
|
6073
|
-
current.delete(id);
|
|
6074
|
-
if (current.size === 0) this.listeners.delete(key);
|
|
6075
|
-
};
|
|
6033
|
+
return {
|
|
6034
|
+
element: (props) => React.createElement(FarmKeyedRowConditional, {
|
|
6035
|
+
key: `${props.rowKey}:${props.id}`,
|
|
6036
|
+
...props
|
|
6037
|
+
}),
|
|
6038
|
+
readValues: readKeyedRowConditionalValues,
|
|
6039
|
+
changed: keyedRowConditionalChanged,
|
|
6040
|
+
owner: (listeners) => ({
|
|
6041
|
+
subscribe(key, id, refresh) {
|
|
6042
|
+
let row = listeners.get(key);
|
|
6043
|
+
if (!row) {
|
|
6044
|
+
row = /* @__PURE__ */ new Map();
|
|
6045
|
+
listeners.set(key, row);
|
|
6076
6046
|
}
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
key
|
|
6083
|
-
|
|
6084
|
-
rowKey,
|
|
6085
|
-
id,
|
|
6086
|
-
renderVersion: this.context.renderVersion,
|
|
6087
|
-
item,
|
|
6088
|
-
index,
|
|
6089
|
-
render
|
|
6090
|
-
});
|
|
6091
|
-
};
|
|
6092
|
-
}
|
|
6093
|
-
prune(instances) {
|
|
6094
|
-
if (this.listeners.size === 0) return;
|
|
6095
|
-
for (const key of this.listeners.keys()) {
|
|
6096
|
-
if (!instances.has(key)) this.listeners.delete(key);
|
|
6047
|
+
row.set(id, refresh);
|
|
6048
|
+
return () => {
|
|
6049
|
+
const current = listeners.get(key);
|
|
6050
|
+
if (current?.get(id) !== refresh) return;
|
|
6051
|
+
current.delete(id);
|
|
6052
|
+
if (current.size === 0) listeners.delete(key);
|
|
6053
|
+
};
|
|
6097
6054
|
}
|
|
6098
|
-
}
|
|
6099
|
-
notify(changes, afterCommit) {
|
|
6055
|
+
}),
|
|
6056
|
+
notify(listeners, changes, afterCommit) {
|
|
6100
6057
|
let pending = changes.length;
|
|
6101
6058
|
const committed = () => {
|
|
6102
6059
|
pending -= 1;
|
|
@@ -6104,25 +6061,12 @@ function createKeyedRowConditionalRuntime() {
|
|
|
6104
6061
|
};
|
|
6105
6062
|
flushSync(() => {
|
|
6106
6063
|
for (const change of changes) {
|
|
6107
|
-
const refresh =
|
|
6064
|
+
const refresh = listeners.get(change.key)?.get(change.id);
|
|
6108
6065
|
if (refresh) refresh(change.item, change.index, committed);
|
|
6109
6066
|
else committed();
|
|
6110
6067
|
}
|
|
6111
6068
|
});
|
|
6112
6069
|
}
|
|
6113
|
-
}
|
|
6114
|
-
return {
|
|
6115
|
-
create: (context) => new ConditionalBlock(context),
|
|
6116
|
-
readValues: readKeyedRowConditionalValues,
|
|
6117
|
-
refresh(props, instance, key, item, index, changes) {
|
|
6118
|
-
const values = readKeyedRowConditionalValues(props, item, index);
|
|
6119
|
-
for (const [id, next] of values) {
|
|
6120
|
-
if (keyedRowConditionalChanged(instance.conditionalValues.get(id), next)) {
|
|
6121
|
-
changes.push({ key, id, item, index });
|
|
6122
|
-
}
|
|
6123
|
-
}
|
|
6124
|
-
instance.conditionalValues = values;
|
|
6125
|
-
}
|
|
6126
6070
|
};
|
|
6127
6071
|
}
|
|
6128
6072
|
function createKeyedRowHostRuntime() {
|
|
@@ -6152,10 +6096,11 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6152
6096
|
this.keyedTargets = options.keyedTargets?.(this.props);
|
|
6153
6097
|
this.renderVersion = 0;
|
|
6154
6098
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
6155
|
-
this.
|
|
6099
|
+
this.conditionalListeners = /* @__PURE__ */ new Map();
|
|
6156
6100
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
6157
6101
|
// False after a rebuild without delegated events left surviving rows unindexed.
|
|
6158
6102
|
this.elementIndexComplete = true;
|
|
6103
|
+
this.conditionalOwner = options.conditionals?.owner(this.conditionalListeners);
|
|
6159
6104
|
this.captureRoot = (root) => {
|
|
6160
6105
|
this.root = root;
|
|
6161
6106
|
};
|
|
@@ -6191,18 +6136,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6191
6136
|
const eventTarget = event.target;
|
|
6192
6137
|
if (!instance || !eventTarget) return;
|
|
6193
6138
|
const capture = name.endsWith("Capture");
|
|
6194
|
-
const
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
matches.push({ descriptor, target });
|
|
6203
|
-
}
|
|
6204
|
-
}
|
|
6205
|
-
matches.sort(
|
|
6139
|
+
const matches = (this.currentProps.events || []).filter((descriptor) => descriptor.name === name && descriptor.path !== void 0).map((descriptor) => ({
|
|
6140
|
+
descriptor,
|
|
6141
|
+
target: findCompilerHostTarget(instance.element, descriptor.path || [])
|
|
6142
|
+
})).filter(
|
|
6143
|
+
(match) => Boolean(
|
|
6144
|
+
match.target && (match.target === eventTarget || match.target.contains(eventTarget))
|
|
6145
|
+
)
|
|
6146
|
+
).sort(
|
|
6206
6147
|
(left, right) => capture ? (left.descriptor.path?.length || 0) - (right.descriptor.path?.length || 0) : (right.descriptor.path?.length || 0) - (left.descriptor.path?.length || 0)
|
|
6207
6148
|
);
|
|
6208
6149
|
for (const match of matches) {
|
|
@@ -6210,6 +6151,18 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6210
6151
|
if (event.isPropagationStopped()) break;
|
|
6211
6152
|
}
|
|
6212
6153
|
};
|
|
6154
|
+
this.rowConditional = (item, index, conditionalId, render) => {
|
|
6155
|
+
if (this.state.fallback || !options.conditionals) return render(item, index);
|
|
6156
|
+
return options.conditionals.element({
|
|
6157
|
+
owner: this.conditionalOwner,
|
|
6158
|
+
rowKey: keyedRowIdentity(this.currentProps.rowKey(item, index)),
|
|
6159
|
+
id: conditionalId,
|
|
6160
|
+
renderVersion: this.renderVersion,
|
|
6161
|
+
item,
|
|
6162
|
+
index,
|
|
6163
|
+
render
|
|
6164
|
+
});
|
|
6165
|
+
};
|
|
6213
6166
|
this.refresh = (afterCommit, dirtyState) => {
|
|
6214
6167
|
if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
|
|
6215
6168
|
const result = options.keyedUpdates.reconcile(
|
|
@@ -6263,7 +6216,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6263
6216
|
this.instances = positionedInstances;
|
|
6264
6217
|
this.rebuildElementIndex(this.instances);
|
|
6265
6218
|
this.pruneEventHandlers();
|
|
6266
|
-
this.
|
|
6219
|
+
this.pruneConditionalListeners();
|
|
6267
6220
|
}
|
|
6268
6221
|
this.commitCurrentCollection(dirtyState);
|
|
6269
6222
|
afterCommit?.();
|
|
@@ -6283,7 +6236,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6283
6236
|
if (removedRows) {
|
|
6284
6237
|
this.rebuildElementIndex(this.instances);
|
|
6285
6238
|
this.pruneEventHandlers();
|
|
6286
|
-
this.
|
|
6239
|
+
this.pruneConditionalListeners();
|
|
6287
6240
|
}
|
|
6288
6241
|
this.commitCurrentCollection(dirtyState);
|
|
6289
6242
|
afterCommit?.();
|
|
@@ -6309,12 +6262,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6309
6262
|
}
|
|
6310
6263
|
for (const key of delta.removedKeys) {
|
|
6311
6264
|
this.eventHandlers.delete(key);
|
|
6312
|
-
this.
|
|
6265
|
+
this.conditionalListeners.delete(key);
|
|
6313
6266
|
}
|
|
6314
6267
|
} else {
|
|
6315
6268
|
this.rebuildElementIndex(this.instances);
|
|
6316
6269
|
this.pruneEventHandlers();
|
|
6317
|
-
this.
|
|
6270
|
+
this.pruneConditionalListeners();
|
|
6318
6271
|
}
|
|
6319
6272
|
this.commitCurrentCollection(dirtyState);
|
|
6320
6273
|
afterCommit?.();
|
|
@@ -6331,7 +6284,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6331
6284
|
this.instances = filteredInstances;
|
|
6332
6285
|
if (!this.elementIndexComplete) this.rebuildElementIndex(this.instances);
|
|
6333
6286
|
this.pruneEventHandlers();
|
|
6334
|
-
this.
|
|
6287
|
+
this.pruneConditionalListeners();
|
|
6335
6288
|
this.commitCurrentCollection(dirtyState);
|
|
6336
6289
|
afterCommit?.();
|
|
6337
6290
|
return;
|
|
@@ -6480,6 +6433,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6480
6433
|
if (!this.instances.has(key)) this.eventHandlers.delete(key);
|
|
6481
6434
|
}
|
|
6482
6435
|
}
|
|
6436
|
+
pruneConditionalListeners() {
|
|
6437
|
+
if (this.conditionalListeners.size === 0) return;
|
|
6438
|
+
for (const key of this.conditionalListeners.keys()) {
|
|
6439
|
+
if (!this.instances.has(key)) this.conditionalListeners.delete(key);
|
|
6440
|
+
}
|
|
6441
|
+
}
|
|
6483
6442
|
commitCurrentCollection(dirtyState) {
|
|
6484
6443
|
this.collectionToken = options.keyedUpdates?.commit(
|
|
6485
6444
|
this.currentProps.items(),
|
|
@@ -6534,7 +6493,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6534
6493
|
this.reactElements = elements;
|
|
6535
6494
|
this.rebuildElementIndex(instances);
|
|
6536
6495
|
this.pruneEventHandlers();
|
|
6537
|
-
this.
|
|
6496
|
+
this.pruneConditionalListeners();
|
|
6538
6497
|
this.commitCurrentCollection();
|
|
6539
6498
|
return true;
|
|
6540
6499
|
}
|
|
@@ -6571,7 +6530,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6571
6530
|
}
|
|
6572
6531
|
notifyConditionalChanges(changes, afterCommit) {
|
|
6573
6532
|
if (changes.length === 0) afterCommit?.();
|
|
6574
|
-
else
|
|
6533
|
+
else options.conditionals.notify(this.conditionalListeners, changes, afterCommit);
|
|
6575
6534
|
}
|
|
6576
6535
|
refreshDirtyBindings(dirtyState, afterCommit) {
|
|
6577
6536
|
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)) {
|
|
@@ -6688,14 +6647,22 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6688
6647
|
} else {
|
|
6689
6648
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6690
6649
|
}
|
|
6691
|
-
|
|
6650
|
+
const conditionalValues = this.readConditionalValues(
|
|
6692
6651
|
this.currentProps,
|
|
6693
|
-
existing,
|
|
6694
|
-
key,
|
|
6695
6652
|
rows.items[index],
|
|
6696
|
-
index
|
|
6697
|
-
conditionalChanges
|
|
6653
|
+
index
|
|
6698
6654
|
);
|
|
6655
|
+
for (const [id, values] of conditionalValues) {
|
|
6656
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
6657
|
+
conditionalChanges.push({
|
|
6658
|
+
key,
|
|
6659
|
+
id,
|
|
6660
|
+
item: rows.items[index],
|
|
6661
|
+
index
|
|
6662
|
+
});
|
|
6663
|
+
}
|
|
6664
|
+
}
|
|
6665
|
+
existing.conditionalValues = conditionalValues;
|
|
6699
6666
|
existing.item = rows.items[index];
|
|
6700
6667
|
existing.index = index;
|
|
6701
6668
|
}
|
|
@@ -6802,14 +6769,22 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6802
6769
|
} else {
|
|
6803
6770
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6804
6771
|
}
|
|
6805
|
-
|
|
6772
|
+
const conditionalValues = this.readConditionalValues(
|
|
6806
6773
|
this.currentProps,
|
|
6807
|
-
existing,
|
|
6808
|
-
key,
|
|
6809
6774
|
rows.items[index],
|
|
6810
|
-
index
|
|
6811
|
-
conditionalChanges
|
|
6775
|
+
index
|
|
6812
6776
|
);
|
|
6777
|
+
for (const [id, values] of conditionalValues) {
|
|
6778
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
6779
|
+
conditionalChanges.push({
|
|
6780
|
+
key,
|
|
6781
|
+
id,
|
|
6782
|
+
item: rows.items[index],
|
|
6783
|
+
index
|
|
6784
|
+
});
|
|
6785
|
+
}
|
|
6786
|
+
}
|
|
6787
|
+
existing.conditionalValues = conditionalValues;
|
|
6813
6788
|
existing.item = rows.items[index];
|
|
6814
6789
|
existing.index = index;
|
|
6815
6790
|
}
|
|
@@ -6818,7 +6793,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6818
6793
|
instance.element.remove();
|
|
6819
6794
|
this.instances.delete(instance.key);
|
|
6820
6795
|
this.eventHandlers.delete(instance.key);
|
|
6821
|
-
this.
|
|
6796
|
+
this.conditionalListeners.delete(instance.key);
|
|
6822
6797
|
}
|
|
6823
6798
|
this.commitCurrentCollection(dirtyState);
|
|
6824
6799
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
@@ -6859,7 +6834,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6859
6834
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
6860
6835
|
this.elementIndexComplete = true;
|
|
6861
6836
|
this.eventHandlers.clear();
|
|
6862
|
-
this.
|
|
6837
|
+
this.conditionalListeners.clear();
|
|
6863
6838
|
this.commitCurrentCollection(dirtyState);
|
|
6864
6839
|
afterCommit?.();
|
|
6865
6840
|
return;
|
|
@@ -6892,12 +6867,10 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6892
6867
|
let oldIndex = 0;
|
|
6893
6868
|
for (const key of this.instances.keys()) oldIndices.set(key, oldIndex++);
|
|
6894
6869
|
}
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
if (hasSurvivingRows) instance.element.remove();
|
|
6900
|
-
}
|
|
6870
|
+
for (const [key, instance] of this.instances) {
|
|
6871
|
+
if (!nextKeys.has(key)) {
|
|
6872
|
+
instance.scope?.cleanup();
|
|
6873
|
+
if (hasSurvivingRows) instance.element.remove();
|
|
6901
6874
|
}
|
|
6902
6875
|
}
|
|
6903
6876
|
const sequence = hasSurvivingRows ? rows.keys.map((key) => oldIndices.get(key) ?? -1) : [];
|
|
@@ -6923,14 +6896,22 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6923
6896
|
} else {
|
|
6924
6897
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6925
6898
|
}
|
|
6926
|
-
|
|
6899
|
+
const conditionalValues = this.readConditionalValues(
|
|
6927
6900
|
this.currentProps,
|
|
6928
|
-
existing,
|
|
6929
|
-
key,
|
|
6930
6901
|
rows.items[index],
|
|
6931
|
-
index
|
|
6932
|
-
conditionalChanges
|
|
6902
|
+
index
|
|
6933
6903
|
);
|
|
6904
|
+
for (const [id, values] of conditionalValues) {
|
|
6905
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
6906
|
+
conditionalChanges.push({
|
|
6907
|
+
key,
|
|
6908
|
+
id,
|
|
6909
|
+
item: rows.items[index],
|
|
6910
|
+
index
|
|
6911
|
+
});
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
existing.conditionalValues = conditionalValues;
|
|
6934
6915
|
existing.item = rows.items[index];
|
|
6935
6916
|
existing.index = index;
|
|
6936
6917
|
nextInstances.push(existing);
|
|
@@ -6993,7 +6974,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6993
6974
|
this.rebuildElementIndex(this.instances);
|
|
6994
6975
|
}
|
|
6995
6976
|
this.pruneEventHandlers();
|
|
6996
|
-
this.
|
|
6977
|
+
this.pruneConditionalListeners();
|
|
6997
6978
|
this.commitCurrentCollection(dirtyState);
|
|
6998
6979
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
6999
6980
|
}
|
|
@@ -7066,14 +7047,11 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
7066
7047
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
7067
7048
|
this.elementIndexComplete = true;
|
|
7068
7049
|
this.eventHandlers.clear();
|
|
7069
|
-
this.
|
|
7050
|
+
this.conditionalListeners.clear();
|
|
7070
7051
|
}
|
|
7071
7052
|
render() {
|
|
7072
7053
|
this.renderVersion += 1;
|
|
7073
|
-
const container = this.currentProps.render(
|
|
7074
|
-
this.rowEvent,
|
|
7075
|
-
this.conditionals?.render || renderKeyedRowConditional
|
|
7076
|
-
);
|
|
7054
|
+
const container = this.currentProps.render(this.rowEvent, this.rowConditional);
|
|
7077
7055
|
if (!React.isValidElement(container) || typeof container.type !== "string") {
|
|
7078
7056
|
throw new TypeError(
|
|
7079
7057
|
`Compiled keyed rows ${this.currentProps.id} must own one host container.`
|
|
@@ -7615,14 +7593,6 @@ var keyedRowsPositionHintedRuntimeFeature = {
|
|
|
7615
7593
|
})
|
|
7616
7594
|
})
|
|
7617
7595
|
};
|
|
7618
|
-
var keyedRowsPlainPositionHintedRuntimeFeature = {
|
|
7619
|
-
name: "keyed-rows:plain-position-hinted",
|
|
7620
|
-
create: (owner) => ({
|
|
7621
|
-
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7622
|
-
keyedUpdates: keyedPositionUpdateRuntime
|
|
7623
|
-
})
|
|
7624
|
-
})
|
|
7625
|
-
};
|
|
7626
7596
|
var keyedRowsBatchPositionHintedRuntimeFeature = {
|
|
7627
7597
|
name: "keyed-rows:batch-position-hinted",
|
|
7628
7598
|
create: (owner) => ({
|
|
@@ -7647,22 +7617,6 @@ var keyedRowsReorderHintedRuntimeFeature = {
|
|
|
7647
7617
|
})
|
|
7648
7618
|
})
|
|
7649
7619
|
};
|
|
7650
|
-
var keyedRowsPlainReorderHintedRuntimeFeature = {
|
|
7651
|
-
name: "keyed-rows:plain-reorder-hinted",
|
|
7652
|
-
create: (owner) => ({
|
|
7653
|
-
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7654
|
-
keyedUpdates: keyedReorderUpdateRuntime
|
|
7655
|
-
})
|
|
7656
|
-
})
|
|
7657
|
-
};
|
|
7658
|
-
var keyedRowsPlainMapReorderHintedRuntimeFeature = {
|
|
7659
|
-
name: "keyed-rows:plain-map-reorder-hinted",
|
|
7660
|
-
create: (owner) => ({
|
|
7661
|
-
KeyedRows: createKeyedRowsBlockComponentCore(owner, {
|
|
7662
|
-
keyedUpdates: keyedMapReorderUpdateRuntime
|
|
7663
|
-
})
|
|
7664
|
-
})
|
|
7665
|
-
};
|
|
7666
7620
|
var keyedRowsMapReorderHintedRuntimeFeature = {
|
|
7667
7621
|
name: "keyed-rows:map-reorder-hinted",
|
|
7668
7622
|
create: (owner) => ({
|
|
@@ -8347,26 +8301,6 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8347
8301
|
current: definition
|
|
8348
8302
|
};
|
|
8349
8303
|
const refreshListeners = /* @__PURE__ */ new Set();
|
|
8350
|
-
const component = createCompiledComponentRuntime(
|
|
8351
|
-
definitionReference,
|
|
8352
|
-
runtimeFeatures,
|
|
8353
|
-
refreshListeners
|
|
8354
|
-
);
|
|
8355
|
-
if (definition.hmrId) {
|
|
8356
|
-
getCompilerHmrRegistry().set(definition.hmrId, {
|
|
8357
|
-
component,
|
|
8358
|
-
definition: definitionReference,
|
|
8359
|
-
refreshListeners,
|
|
8360
|
-
stateSignature,
|
|
8361
|
-
runtimeSignature
|
|
8362
|
-
});
|
|
8363
|
-
}
|
|
8364
|
-
return component;
|
|
8365
|
-
}
|
|
8366
|
-
function createCompiledComponentWithoutRefresh(definition, runtimeFeatures) {
|
|
8367
|
-
return createCompiledComponentRuntime({ current: definition }, runtimeFeatures);
|
|
8368
|
-
}
|
|
8369
|
-
function createCompiledComponentRuntime(definitionReference, runtimeFeatures, refreshListeners) {
|
|
8370
8304
|
class FarmCompiledComponent extends React.Component {
|
|
8371
8305
|
constructor(props) {
|
|
8372
8306
|
super(props);
|
|
@@ -8677,7 +8611,7 @@ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, re
|
|
|
8677
8611
|
}
|
|
8678
8612
|
componentDidMount() {
|
|
8679
8613
|
this.mounted = true;
|
|
8680
|
-
refreshListeners
|
|
8614
|
+
refreshListeners.add(this.refreshDefinition);
|
|
8681
8615
|
this.componentDidUpdate();
|
|
8682
8616
|
}
|
|
8683
8617
|
getSnapshotBeforeUpdate() {
|
|
@@ -8733,7 +8667,7 @@ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, re
|
|
|
8733
8667
|
this.bindingValues.clear();
|
|
8734
8668
|
this.activeBinding = null;
|
|
8735
8669
|
this.activeDependencies = null;
|
|
8736
|
-
refreshListeners
|
|
8670
|
+
refreshListeners.delete(this.refreshDefinition);
|
|
8737
8671
|
}
|
|
8738
8672
|
render() {
|
|
8739
8673
|
if (this.hasBindingError) throw this.bindingError;
|
|
@@ -8775,8 +8709,18 @@ function createCompiledComponentRuntime(definitionReference, runtimeFeatures, re
|
|
|
8775
8709
|
return renderedElement;
|
|
8776
8710
|
}
|
|
8777
8711
|
}
|
|
8778
|
-
FarmCompiledComponent.displayName = `FarmCompiled(${
|
|
8779
|
-
|
|
8712
|
+
FarmCompiledComponent.displayName = `FarmCompiled(${definition.displayName})`;
|
|
8713
|
+
const component = FarmCompiledComponent;
|
|
8714
|
+
if (definition.hmrId) {
|
|
8715
|
+
getCompilerHmrRegistry().set(definition.hmrId, {
|
|
8716
|
+
component,
|
|
8717
|
+
definition: definitionReference,
|
|
8718
|
+
refreshListeners,
|
|
8719
|
+
stateSignature,
|
|
8720
|
+
runtimeSignature
|
|
8721
|
+
});
|
|
8722
|
+
}
|
|
8723
|
+
return component;
|
|
8780
8724
|
}
|
|
8781
8725
|
var COMPLETE_RUNTIME_FEATURES = [
|
|
8782
8726
|
conditionalRuntimeFeature,
|
|
@@ -8792,6 +8736,6 @@ function createCompiledComponent(definition) {
|
|
|
8792
8736
|
return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
|
|
8793
8737
|
}
|
|
8794
8738
|
|
|
8795
|
-
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures,
|
|
8739
|
+
export { applyCompilerKeyedCollectionMutation, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, createCompilerKeyedArrayAppend, createCompilerKeyedArrayBatchInsert, createCompilerKeyedArrayFilter, createCompilerKeyedArrayMapPipeline, createCompilerKeyedArrayMapReorder, createCompilerKeyedArrayMappedRollingWindow, createCompilerKeyedArrayMappedStructuralAppend, createCompilerKeyedArrayMappedStructuralPrepend, createCompilerKeyedArrayPositionUpdate, createCompilerKeyedArrayPrepend, createCompilerKeyedArrayQueuedMapPipeline, createCompilerKeyedArrayReorder, createCompilerKeyedArrayRollingWindow, createCompilerKeyedArrayRollingWindowMapPipeline, createCompilerKeyedArraySlice, createCompilerKeyedArraySort, createCompilerKeyedArrayStructuralAppend, createCompilerKeyedArrayStructuralAppendMapPipeline, createCompilerKeyedArrayStructuralPrepend, createCompilerKeyedArrayStructuralPrependMapPipeline, createCompilerKeyedArrayStructuralReorder, createCompilerKeyedArrayStructuralSort, createCompilerKeyedArrayWindowReplace, createCompilerKeyedCollectionUpdate, createCompilerKeyedMapUpdate, finalizeCompilerKeyedArrayMappedStructuralUpdate, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsAllHintedRuntimeFeature, keyedRowsAppendOnlyRuntimeFeature, keyedRowsBatchEveryHintedRuntimeFeature, keyedRowsBatchPositionHintedRuntimeFeature, keyedRowsCompleteAllHintedRuntimeFeature, keyedRowsCompleteBatchEveryHintedRuntimeFeature, keyedRowsCompleteBatchPositionHintedRuntimeFeature, keyedRowsCompleteEveryHintedRuntimeFeature, keyedRowsCompleteFilterHintedRuntimeFeature, keyedRowsCompleteFilterPrependHintedRuntimeFeature, keyedRowsCompleteHintedRuntimeFeature, keyedRowsCompleteMappedRollingWindowHintedRuntimeFeature, keyedRowsCompletePositionHintedRuntimeFeature, keyedRowsCompletePrependHintedRuntimeFeature, keyedRowsCompleteReorderHintedRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsCompleteStructuralAppendHintedRuntimeFeature, keyedRowsCompleteStructuralAppendMapHintedRuntimeFeature, keyedRowsCompleteStructuralPrependHintedRuntimeFeature, keyedRowsCompleteStructuralPrependMapHintedRuntimeFeature, keyedRowsCompleteWindowEveryHintedRuntimeFeature, keyedRowsCompleteWindowPositionHintedRuntimeFeature, keyedRowsConditionalAllHintedRuntimeFeature, keyedRowsConditionalBatchEveryHintedRuntimeFeature, keyedRowsConditionalBatchPositionHintedRuntimeFeature, keyedRowsConditionalEveryHintedRuntimeFeature, keyedRowsConditionalFilterHintedRuntimeFeature, keyedRowsConditionalFilterPrependHintedRuntimeFeature, keyedRowsConditionalHintedRuntimeFeature, keyedRowsConditionalMappedRollingWindowHintedRuntimeFeature, keyedRowsConditionalPositionHintedRuntimeFeature, keyedRowsConditionalPrependHintedRuntimeFeature, keyedRowsConditionalReorderHintedRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsConditionalStructuralAppendHintedRuntimeFeature, keyedRowsConditionalStructuralAppendMapHintedRuntimeFeature, keyedRowsConditionalStructuralPrependHintedRuntimeFeature, keyedRowsConditionalStructuralPrependMapHintedRuntimeFeature, keyedRowsConditionalWindowEveryHintedRuntimeFeature, keyedRowsConditionalWindowPositionHintedRuntimeFeature, keyedRowsEveryHintedRuntimeFeature, keyedRowsFilterHintedRuntimeFeature, keyedRowsFilterOnlyRuntimeFeature, keyedRowsFilterPrependHintedRuntimeFeature, keyedRowsHintedRuntimeFeature, keyedRowsHostAllHintedRuntimeFeature, keyedRowsHostBatchEveryHintedRuntimeFeature, keyedRowsHostBatchPositionHintedRuntimeFeature, keyedRowsHostEveryHintedRuntimeFeature, keyedRowsHostFilterHintedRuntimeFeature, keyedRowsHostFilterPrependHintedRuntimeFeature, keyedRowsHostHintedRuntimeFeature, keyedRowsHostMappedRollingWindowHintedRuntimeFeature, keyedRowsHostPositionHintedRuntimeFeature, keyedRowsHostPrependHintedRuntimeFeature, keyedRowsHostReorderHintedRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsHostStructuralAppendHintedRuntimeFeature, keyedRowsHostStructuralAppendMapHintedRuntimeFeature, keyedRowsHostStructuralPrependHintedRuntimeFeature, keyedRowsHostStructuralPrependMapHintedRuntimeFeature, keyedRowsHostWindowEveryHintedRuntimeFeature, keyedRowsHostWindowPositionHintedRuntimeFeature, keyedRowsIdentityFilterHintedRuntimeFeature, keyedRowsIdentityFilterOnlyRuntimeFeature, keyedRowsIdentityRuntimeFeature, keyedRowsMapLookupRuntimeFeature, keyedRowsMapReorderHintedRuntimeFeature, keyedRowsMappedRollingWindowHintedRuntimeFeature, keyedRowsMembershipRuntimeFeature, keyedRowsPlainRuntimeFeature, keyedRowsPositionHintedRuntimeFeature, keyedRowsPrependHintedRuntimeFeature, keyedRowsPrependOnlyRuntimeFeature, keyedRowsReorderHintedRuntimeFeature, keyedRowsRuntimeFeature, keyedRowsStructuralAppendHintedRuntimeFeature, keyedRowsStructuralAppendMapHintedRuntimeFeature, keyedRowsStructuralPrependHintedRuntimeFeature, keyedRowsStructuralPrependMapHintedRuntimeFeature, keyedRowsWindowEveryHintedRuntimeFeature, keyedRowsWindowPositionHintedRuntimeFeature, mixedRangesRuntimeFeature };
|
|
8796
8740
|
//# sourceMappingURL=compiler-runtime.mjs.map
|
|
8797
8741
|
//# sourceMappingURL=compiler-runtime.mjs.map
|