@farm.js/react 0.1.0-beta.35 → 0.1.0-beta.37
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 +44 -0
- package/dist/compiler-runtime.cjs +118 -123
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +8 -1
- package/dist/compiler-runtime.d.ts +8 -1
- package/dist/compiler-runtime.mjs +118 -124
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +204 -165
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +204 -165
- package/dist/vite.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -57,6 +57,11 @@ automatic and does not add a configuration option or asynchronous runtime loadin
|
|
|
57
57
|
`createCompiledComponent` export remains a complete compatibility entry for hand-authored
|
|
58
58
|
definitions, while generated code uses the tree-shakable feature entry.
|
|
59
59
|
|
|
60
|
+
Generated code also selects refresh support through `import.meta.hot`. Production bundles can
|
|
61
|
+
remove the development refresh registry and compatibility checks; development retains
|
|
62
|
+
state-preserving refresh. Both entries share the same component runtime, including SSR, hydration,
|
|
63
|
+
DOM ownership, and fallback behavior. Existing hand-authored runtime entries retain refresh support.
|
|
64
|
+
|
|
60
65
|
Plain keyed lists with filter hints and only identity-based selection also use the single-kind
|
|
61
66
|
target runtime. Filtering keeps its existing native-method checks and fallback; mixed Set/Map
|
|
62
67
|
targets, conditional rows, and nested host blocks keep their existing runtime capabilities.
|
|
@@ -114,6 +119,11 @@ The current compiler handles components that it can prove have:
|
|
|
114
119
|
- React-managed event handlers; and
|
|
115
120
|
- no refs, effects, or unsupported dynamic child structures.
|
|
116
121
|
|
|
122
|
+
State-dependent event handler selection, such as `onClick={active ? save : cancel}`, keeps the
|
|
123
|
+
component on React's normal rendering path so replacing, adding, or removing a callback updates
|
|
124
|
+
React's event props. Direct inline handlers that read state when invoked, such as
|
|
125
|
+
`onClick={() => save(active)}`, retain the existing compiled path when otherwise eligible.
|
|
126
|
+
|
|
117
127
|
The generated component preserves React ownership of initial placement, parent update commits,
|
|
118
128
|
identity-bearing props, events, SSR, and hydration. Local state cells batch updates into a
|
|
119
129
|
microtask; eligible flat destructured primitive props join the same dependency index after React
|
|
@@ -128,6 +138,10 @@ refreshes only changed React-owned row-local branches. React still creates or hy
|
|
|
128
138
|
DOM. Anything outside those narrow contracts uses a small React-owned boundary or the complete
|
|
129
139
|
original component.
|
|
130
140
|
|
|
141
|
+
Compiler-owned structural updates stay disabled inside SVG and MathML, including shared
|
|
142
|
+
HTML/SVG tag names such as `a` and `title`. React retains namespace-sensitive element creation
|
|
143
|
+
when rows are appended or conditional branches change; ordinary HTML rows remain eligible.
|
|
144
|
+
|
|
131
145
|
For a common dedicated conditional, no new component or annotation is required:
|
|
132
146
|
|
|
133
147
|
```tsx
|
|
@@ -1109,8 +1123,18 @@ Generated callback refs give directly patched host elements stable private targe
|
|
|
1109
1123
|
React-owned component may therefore return `null`, a fragment, or multiple host nodes without
|
|
1110
1124
|
shifting an unrelated compiler binding. These refs do not add attributes to SSR output.
|
|
1111
1125
|
|
|
1126
|
+
`title` and `meta` elements inside conditional, keyed, or recursive host descriptors remain
|
|
1127
|
+
React-owned. React decides their document placement and cleanup, including React 19 head placement
|
|
1128
|
+
and the `itemProp` exception. The compiler does not implement a separate metadata manager.
|
|
1129
|
+
|
|
1112
1130
|
Conditional blocks have three safe ownership levels. One or more proven host-only direct branches
|
|
1113
1131
|
may become compiler-owned ranges among static host siblings, including at the exact component root.
|
|
1132
|
+
Script elements in conditional branches or keyed rows remain React-owned, including nested and
|
|
1133
|
+
non-executable scripts. React retains responsibility for inert script creation on insertion and
|
|
1134
|
+
reinsertion; the compiler does not create these elements through its host descriptors.
|
|
1135
|
+
The production browser control is
|
|
1136
|
+
`NODE_ENV=production node packages/farm-react/scripts/test-script-ownership-browser.mjs` from the
|
|
1137
|
+
workspace root. Set `CHROME_PATH` to use an installed Chrome instead of Playwright's browser.
|
|
1114
1138
|
A dedicated container with exactly one conditional child uses the smaller compiler-owned branch
|
|
1115
1139
|
boundary. The more general React-owned conditional path accepts supported events, nested host
|
|
1116
1140
|
conditionals, keyed lists, and component islands. A compiler-owned host branch may now recursively
|
|
@@ -1189,6 +1213,26 @@ second component render and commit, while the compiled component remains at one
|
|
|
1189
1213
|
commit and updates its two bindings directly. This is a deterministic structural performance
|
|
1190
1214
|
assertion; it is not presented as a cross-machine timing benchmark.
|
|
1191
1215
|
|
|
1216
|
+
`pnpm --filter @farm.js/react test:runtime-size` checks both gzip and Brotli compiler premiums
|
|
1217
|
+
against `RUNTIME_SIZE_RESULTS.json`, including plain keyed lists and the isolated core runtime.
|
|
1218
|
+
Missing or non-finite budget inputs and fixtures without an explicit budget policy fail the check.
|
|
1219
|
+
When intentionally adding or changing a baseline, generate it with
|
|
1220
|
+
`pnpm --filter @farm.js/react benchmark:runtime-size` and review the byte changes before committing;
|
|
1221
|
+
do not regenerate baselines just to hide a regression. These checks do not change application output.
|
|
1222
|
+
|
|
1223
|
+
Both runtime-size and keyed-target measurements compress each emitted JavaScript file independently,
|
|
1224
|
+
then sum the bytes. Multi-chunk builds also report per-file bytes and the union of entry chunks plus
|
|
1225
|
+
their static imports (`initial`), reachable dynamic imports and their dependencies (`deferred`), and
|
|
1226
|
+
any remaining emitted chunks (`unreferenced`). Shared chunks count once; deferred totals include all
|
|
1227
|
+
reachable lazy chunks, not a claim that every navigation downloads them. CSS, other assets, external
|
|
1228
|
+
dependencies and HTTP overhead are outside these JavaScript-only measurements. Existing single-chunk
|
|
1229
|
+
measurements are unchanged; concatenated code is used only for structural-marker checks.
|
|
1230
|
+
|
|
1231
|
+
Plain keyed-row features also omit conditional-boundary subscriptions, render adapters, and
|
|
1232
|
+
snapshot-update loops. Conditional features retain their per-block ownership and React fallback.
|
|
1233
|
+
The size suite checks a combined create/append/update/select/swap/remove/clear table as well as
|
|
1234
|
+
isolated operations, so an isolated fixture cannot hide retained conditional machinery.
|
|
1235
|
+
|
|
1192
1236
|
Application and prototype calls, dynamic style objects, handlers outside JSX events, nested,
|
|
1193
1237
|
computed, and rest props patterns, async handlers, unkeyed or index-keyed lists, unsupported map
|
|
1194
1238
|
chains, unsupported conditional roots, effects, and more advanced hook support intentionally stay
|
|
@@ -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[
|
|
1589
|
+
const existing = globalTarget[registryKey];
|
|
1590
1590
|
if (existing instanceof Map) return existing;
|
|
1591
1591
|
const registry = /* @__PURE__ */ new Map();
|
|
1592
|
-
globalTarget[
|
|
1592
|
+
globalTarget[registryKey] = registry;
|
|
1593
1593
|
return registry;
|
|
1594
1594
|
}
|
|
1595
1595
|
function renderTextValue(value) {
|
|
@@ -4603,13 +4603,7 @@ function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, ins
|
|
|
4603
4603
|
}
|
|
4604
4604
|
}
|
|
4605
4605
|
applyKeyedRowBindings(props, instance, item, index);
|
|
4606
|
-
|
|
4607
|
-
for (const [id, values] of conditionalValues) {
|
|
4608
|
-
if (conditionals?.changed(instance.conditionalValues.get(id), values)) {
|
|
4609
|
-
conditionalChanges.push({ key, id, item, index });
|
|
4610
|
-
}
|
|
4611
|
-
}
|
|
4612
|
-
instance.conditionalValues = conditionalValues;
|
|
4606
|
+
conditionals?.refresh(props, instance, key, item, index, conditionalChanges);
|
|
4613
4607
|
instance.item = item;
|
|
4614
4608
|
}
|
|
4615
4609
|
return {
|
|
@@ -6024,6 +6018,7 @@ function reconcileCompilerKeyedArrayFilter(props, dirtyState, collectionToken, i
|
|
|
6024
6018
|
for (const instance of instances.values()) instance.index = index++;
|
|
6025
6019
|
return instances;
|
|
6026
6020
|
}
|
|
6021
|
+
var renderKeyedRowConditional = (item, index, _id, render) => render(item, index);
|
|
6027
6022
|
function createKeyedRowConditionalRuntime() {
|
|
6028
6023
|
class FarmKeyedRowConditional extends React__default.default.Component {
|
|
6029
6024
|
constructor() {
|
|
@@ -6066,30 +6061,48 @@ function createKeyedRowConditionalRuntime() {
|
|
|
6066
6061
|
}
|
|
6067
6062
|
}
|
|
6068
6063
|
FarmKeyedRowConditional.displayName = "FarmCompiledKeyedRowConditional";
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
row
|
|
6081
|
-
|
|
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
|
+
};
|
|
6082
6082
|
}
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
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);
|
|
6090
6103
|
}
|
|
6091
|
-
}
|
|
6092
|
-
notify(
|
|
6104
|
+
}
|
|
6105
|
+
notify(changes, afterCommit) {
|
|
6093
6106
|
let pending = changes.length;
|
|
6094
6107
|
const committed = () => {
|
|
6095
6108
|
pending -= 1;
|
|
@@ -6097,12 +6110,25 @@ function createKeyedRowConditionalRuntime() {
|
|
|
6097
6110
|
};
|
|
6098
6111
|
reactDom.flushSync(() => {
|
|
6099
6112
|
for (const change of changes) {
|
|
6100
|
-
const refresh = listeners.get(change.key)?.get(change.id);
|
|
6113
|
+
const refresh = this.listeners.get(change.key)?.get(change.id);
|
|
6101
6114
|
if (refresh) refresh(change.item, change.index, committed);
|
|
6102
6115
|
else committed();
|
|
6103
6116
|
}
|
|
6104
6117
|
});
|
|
6105
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
|
+
}
|
|
6106
6132
|
};
|
|
6107
6133
|
}
|
|
6108
6134
|
function createKeyedRowHostRuntime() {
|
|
@@ -6132,11 +6158,10 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6132
6158
|
this.keyedTargets = options.keyedTargets?.(this.props);
|
|
6133
6159
|
this.renderVersion = 0;
|
|
6134
6160
|
this.eventHandlers = /* @__PURE__ */ new Map();
|
|
6135
|
-
this.
|
|
6161
|
+
this.conditionals = options.conditionals?.create(this);
|
|
6136
6162
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
6137
6163
|
// False after a rebuild without delegated events left surviving rows unindexed.
|
|
6138
6164
|
this.elementIndexComplete = true;
|
|
6139
|
-
this.conditionalOwner = options.conditionals?.owner(this.conditionalListeners);
|
|
6140
6165
|
this.captureRoot = (root) => {
|
|
6141
6166
|
this.root = root;
|
|
6142
6167
|
};
|
|
@@ -6191,18 +6216,6 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6191
6216
|
if (event.isPropagationStopped()) break;
|
|
6192
6217
|
}
|
|
6193
6218
|
};
|
|
6194
|
-
this.rowConditional = (item, index, conditionalId, render) => {
|
|
6195
|
-
if (this.state.fallback || !options.conditionals) return render(item, index);
|
|
6196
|
-
return options.conditionals.element({
|
|
6197
|
-
owner: this.conditionalOwner,
|
|
6198
|
-
rowKey: keyedRowIdentity(this.currentProps.rowKey(item, index)),
|
|
6199
|
-
id: conditionalId,
|
|
6200
|
-
renderVersion: this.renderVersion,
|
|
6201
|
-
item,
|
|
6202
|
-
index,
|
|
6203
|
-
render
|
|
6204
|
-
});
|
|
6205
|
-
};
|
|
6206
6219
|
this.refresh = (afterCommit, dirtyState) => {
|
|
6207
6220
|
if (dirtyState && options.keyedUpdates && this.mounted && this.root && !this.state.fallback) {
|
|
6208
6221
|
const result = options.keyedUpdates.reconcile(
|
|
@@ -6256,7 +6269,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6256
6269
|
this.instances = positionedInstances;
|
|
6257
6270
|
this.rebuildElementIndex(this.instances);
|
|
6258
6271
|
this.pruneEventHandlers();
|
|
6259
|
-
this.
|
|
6272
|
+
this.conditionals?.prune(this.instances);
|
|
6260
6273
|
}
|
|
6261
6274
|
this.commitCurrentCollection(dirtyState);
|
|
6262
6275
|
afterCommit?.();
|
|
@@ -6276,7 +6289,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6276
6289
|
if (removedRows) {
|
|
6277
6290
|
this.rebuildElementIndex(this.instances);
|
|
6278
6291
|
this.pruneEventHandlers();
|
|
6279
|
-
this.
|
|
6292
|
+
this.conditionals?.prune(this.instances);
|
|
6280
6293
|
}
|
|
6281
6294
|
this.commitCurrentCollection(dirtyState);
|
|
6282
6295
|
afterCommit?.();
|
|
@@ -6302,12 +6315,12 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6302
6315
|
}
|
|
6303
6316
|
for (const key of delta.removedKeys) {
|
|
6304
6317
|
this.eventHandlers.delete(key);
|
|
6305
|
-
this.
|
|
6318
|
+
this.conditionals?.listeners.delete(key);
|
|
6306
6319
|
}
|
|
6307
6320
|
} else {
|
|
6308
6321
|
this.rebuildElementIndex(this.instances);
|
|
6309
6322
|
this.pruneEventHandlers();
|
|
6310
|
-
this.
|
|
6323
|
+
this.conditionals?.prune(this.instances);
|
|
6311
6324
|
}
|
|
6312
6325
|
this.commitCurrentCollection(dirtyState);
|
|
6313
6326
|
afterCommit?.();
|
|
@@ -6324,7 +6337,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6324
6337
|
this.instances = filteredInstances;
|
|
6325
6338
|
if (!this.elementIndexComplete) this.rebuildElementIndex(this.instances);
|
|
6326
6339
|
this.pruneEventHandlers();
|
|
6327
|
-
this.
|
|
6340
|
+
this.conditionals?.prune(this.instances);
|
|
6328
6341
|
this.commitCurrentCollection(dirtyState);
|
|
6329
6342
|
afterCommit?.();
|
|
6330
6343
|
return;
|
|
@@ -6473,12 +6486,6 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6473
6486
|
if (!this.instances.has(key)) this.eventHandlers.delete(key);
|
|
6474
6487
|
}
|
|
6475
6488
|
}
|
|
6476
|
-
pruneConditionalListeners() {
|
|
6477
|
-
if (this.conditionalListeners.size === 0) return;
|
|
6478
|
-
for (const key of this.conditionalListeners.keys()) {
|
|
6479
|
-
if (!this.instances.has(key)) this.conditionalListeners.delete(key);
|
|
6480
|
-
}
|
|
6481
|
-
}
|
|
6482
6489
|
commitCurrentCollection(dirtyState) {
|
|
6483
6490
|
this.collectionToken = options.keyedUpdates?.commit(
|
|
6484
6491
|
this.currentProps.items(),
|
|
@@ -6533,7 +6540,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6533
6540
|
this.reactElements = elements;
|
|
6534
6541
|
this.rebuildElementIndex(instances);
|
|
6535
6542
|
this.pruneEventHandlers();
|
|
6536
|
-
this.
|
|
6543
|
+
this.conditionals?.prune(this.instances);
|
|
6537
6544
|
this.commitCurrentCollection();
|
|
6538
6545
|
return true;
|
|
6539
6546
|
}
|
|
@@ -6570,7 +6577,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6570
6577
|
}
|
|
6571
6578
|
notifyConditionalChanges(changes, afterCommit) {
|
|
6572
6579
|
if (changes.length === 0) afterCommit?.();
|
|
6573
|
-
else
|
|
6580
|
+
else this.conditionals.notify(changes, afterCommit);
|
|
6574
6581
|
}
|
|
6575
6582
|
refreshDirtyBindings(dirtyState, afterCommit) {
|
|
6576
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)) {
|
|
@@ -6687,24 +6694,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6687
6694
|
} else {
|
|
6688
6695
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6689
6696
|
}
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
conditionalChanges.push({
|
|
6699
|
-
key,
|
|
6700
|
-
id,
|
|
6701
|
-
item: rows.items[index],
|
|
6702
|
-
index
|
|
6703
|
-
});
|
|
6704
|
-
}
|
|
6705
|
-
}
|
|
6706
|
-
existing.conditionalValues = conditionalValues;
|
|
6707
|
-
}
|
|
6697
|
+
options.conditionals?.refresh(
|
|
6698
|
+
this.currentProps,
|
|
6699
|
+
existing,
|
|
6700
|
+
key,
|
|
6701
|
+
rows.items[index],
|
|
6702
|
+
index,
|
|
6703
|
+
conditionalChanges
|
|
6704
|
+
);
|
|
6708
6705
|
existing.item = rows.items[index];
|
|
6709
6706
|
existing.index = index;
|
|
6710
6707
|
}
|
|
@@ -6811,22 +6808,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6811
6808
|
} else {
|
|
6812
6809
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6813
6810
|
}
|
|
6814
|
-
|
|
6811
|
+
options.conditionals?.refresh(
|
|
6815
6812
|
this.currentProps,
|
|
6813
|
+
existing,
|
|
6814
|
+
key,
|
|
6816
6815
|
rows.items[index],
|
|
6817
|
-
index
|
|
6816
|
+
index,
|
|
6817
|
+
conditionalChanges
|
|
6818
6818
|
);
|
|
6819
|
-
for (const [id, values] of conditionalValues) {
|
|
6820
|
-
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
6821
|
-
conditionalChanges.push({
|
|
6822
|
-
key,
|
|
6823
|
-
id,
|
|
6824
|
-
item: rows.items[index],
|
|
6825
|
-
index
|
|
6826
|
-
});
|
|
6827
|
-
}
|
|
6828
|
-
}
|
|
6829
|
-
existing.conditionalValues = conditionalValues;
|
|
6830
6819
|
existing.item = rows.items[index];
|
|
6831
6820
|
existing.index = index;
|
|
6832
6821
|
}
|
|
@@ -6835,7 +6824,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6835
6824
|
instance.element.remove();
|
|
6836
6825
|
this.instances.delete(instance.key);
|
|
6837
6826
|
this.eventHandlers.delete(instance.key);
|
|
6838
|
-
this.
|
|
6827
|
+
this.conditionals?.listeners.delete(instance.key);
|
|
6839
6828
|
}
|
|
6840
6829
|
this.commitCurrentCollection(dirtyState);
|
|
6841
6830
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
@@ -6876,7 +6865,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6876
6865
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
6877
6866
|
this.elementIndexComplete = true;
|
|
6878
6867
|
this.eventHandlers.clear();
|
|
6879
|
-
this.
|
|
6868
|
+
this.conditionals?.listeners.clear();
|
|
6880
6869
|
this.commitCurrentCollection(dirtyState);
|
|
6881
6870
|
afterCommit?.();
|
|
6882
6871
|
return;
|
|
@@ -6940,22 +6929,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
6940
6929
|
} else {
|
|
6941
6930
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
6942
6931
|
}
|
|
6943
|
-
|
|
6932
|
+
options.conditionals?.refresh(
|
|
6944
6933
|
this.currentProps,
|
|
6934
|
+
existing,
|
|
6935
|
+
key,
|
|
6945
6936
|
rows.items[index],
|
|
6946
|
-
index
|
|
6937
|
+
index,
|
|
6938
|
+
conditionalChanges
|
|
6947
6939
|
);
|
|
6948
|
-
for (const [id, values] of conditionalValues) {
|
|
6949
|
-
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
6950
|
-
conditionalChanges.push({
|
|
6951
|
-
key,
|
|
6952
|
-
id,
|
|
6953
|
-
item: rows.items[index],
|
|
6954
|
-
index
|
|
6955
|
-
});
|
|
6956
|
-
}
|
|
6957
|
-
}
|
|
6958
|
-
existing.conditionalValues = conditionalValues;
|
|
6959
6940
|
existing.item = rows.items[index];
|
|
6960
6941
|
existing.index = index;
|
|
6961
6942
|
nextInstances.push(existing);
|
|
@@ -7018,7 +6999,7 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
7018
6999
|
this.rebuildElementIndex(this.instances);
|
|
7019
7000
|
}
|
|
7020
7001
|
this.pruneEventHandlers();
|
|
7021
|
-
this.
|
|
7002
|
+
this.conditionals?.prune(this.instances);
|
|
7022
7003
|
this.commitCurrentCollection(dirtyState);
|
|
7023
7004
|
this.notifyConditionalChanges(conditionalChanges, afterCommit);
|
|
7024
7005
|
}
|
|
@@ -7091,11 +7072,14 @@ function createKeyedRowsBlockComponentCore(owner, options = {}) {
|
|
|
7091
7072
|
this.instancesByElement = /* @__PURE__ */ new WeakMap();
|
|
7092
7073
|
this.elementIndexComplete = true;
|
|
7093
7074
|
this.eventHandlers.clear();
|
|
7094
|
-
this.
|
|
7075
|
+
this.conditionals?.listeners.clear();
|
|
7095
7076
|
}
|
|
7096
7077
|
render() {
|
|
7097
7078
|
this.renderVersion += 1;
|
|
7098
|
-
const container = this.currentProps.render(
|
|
7079
|
+
const container = this.currentProps.render(
|
|
7080
|
+
this.rowEvent,
|
|
7081
|
+
this.conditionals?.render || renderKeyedRowConditional
|
|
7082
|
+
);
|
|
7099
7083
|
if (!React__default.default.isValidElement(container) || typeof container.type !== "string") {
|
|
7100
7084
|
throw new TypeError(
|
|
7101
7085
|
`Compiled keyed rows ${this.currentProps.id} must own one host container.`
|
|
@@ -8369,6 +8353,26 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8369
8353
|
current: definition
|
|
8370
8354
|
};
|
|
8371
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) {
|
|
8372
8376
|
class FarmCompiledComponent extends React__default.default.Component {
|
|
8373
8377
|
constructor(props) {
|
|
8374
8378
|
super(props);
|
|
@@ -8679,7 +8683,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8679
8683
|
}
|
|
8680
8684
|
componentDidMount() {
|
|
8681
8685
|
this.mounted = true;
|
|
8682
|
-
refreshListeners
|
|
8686
|
+
refreshListeners?.add(this.refreshDefinition);
|
|
8683
8687
|
this.componentDidUpdate();
|
|
8684
8688
|
}
|
|
8685
8689
|
getSnapshotBeforeUpdate() {
|
|
@@ -8735,7 +8739,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8735
8739
|
this.bindingValues.clear();
|
|
8736
8740
|
this.activeBinding = null;
|
|
8737
8741
|
this.activeDependencies = null;
|
|
8738
|
-
refreshListeners
|
|
8742
|
+
refreshListeners?.delete(this.refreshDefinition);
|
|
8739
8743
|
}
|
|
8740
8744
|
render() {
|
|
8741
8745
|
if (this.hasBindingError) throw this.bindingError;
|
|
@@ -8777,18 +8781,8 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8777
8781
|
return renderedElement;
|
|
8778
8782
|
}
|
|
8779
8783
|
}
|
|
8780
|
-
FarmCompiledComponent.displayName = `FarmCompiled(${
|
|
8781
|
-
|
|
8782
|
-
if (definition.hmrId) {
|
|
8783
|
-
getCompilerHmrRegistry().set(definition.hmrId, {
|
|
8784
|
-
component,
|
|
8785
|
-
definition: definitionReference,
|
|
8786
|
-
refreshListeners,
|
|
8787
|
-
stateSignature,
|
|
8788
|
-
runtimeSignature
|
|
8789
|
-
});
|
|
8790
|
-
}
|
|
8791
|
-
return component;
|
|
8784
|
+
FarmCompiledComponent.displayName = `FarmCompiled(${definitionReference.current.displayName})`;
|
|
8785
|
+
return FarmCompiledComponent;
|
|
8792
8786
|
}
|
|
8793
8787
|
var COMPLETE_RUNTIME_FEATURES = [
|
|
8794
8788
|
conditionalRuntimeFeature,
|
|
@@ -8810,6 +8804,7 @@ exports.conditionalRangesRuntimeFeature = conditionalRangesRuntimeFeature;
|
|
|
8810
8804
|
exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
|
|
8811
8805
|
exports.createCompiledComponent = createCompiledComponent;
|
|
8812
8806
|
exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
|
|
8807
|
+
exports.createCompiledComponentWithoutRefresh = createCompiledComponentWithoutRefresh;
|
|
8813
8808
|
exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
|
|
8814
8809
|
exports.createCompilerKeyedArrayBatchInsert = createCompilerKeyedArrayBatchInsert;
|
|
8815
8810
|
exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
|