@farm.js/react 0.1.0-beta.25 → 0.1.0-beta.27
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/dist/compiler-runtime.cjs +113 -119
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.mjs +113 -119
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/list.cjs +1 -1
- package/dist/list.cjs.map +1 -1
- package/dist/list.mjs +1 -1
- package/dist/list.mjs.map +1 -1
- package/dist/vite.cjs +165 -45
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +2 -0
- package/dist/vite.d.ts +2 -0
- package/dist/vite.mjs +165 -45
- package/dist/vite.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -5,7 +5,7 @@ import { flushSync } from 'react-dom';
|
|
|
5
5
|
|
|
6
6
|
// src/iterable.ts
|
|
7
7
|
var oneShotSnapshots = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
var arrayIterator = Array.prototype[Symbol.iterator];
|
|
8
|
+
var arrayIterator = /* @__PURE__ */ (() => Array.prototype[Symbol.iterator])();
|
|
9
9
|
function materializeIterable(source) {
|
|
10
10
|
if (source == null) return [];
|
|
11
11
|
if (Array.isArray(source) && Object.getPrototypeOf(source) === Array.prototype && source[Symbol.iterator] === arrayIterator) {
|
|
@@ -42,16 +42,16 @@ var COMPILER_KEYED_COLLECTION_DRAFTS = /* @__PURE__ */ new WeakMap();
|
|
|
42
42
|
var COMPILER_KEYED_COLLECTION_UPDATES = /* @__PURE__ */ new WeakMap();
|
|
43
43
|
var COMPILER_KEYED_COMMITTED_COLLECTIONS = /* @__PURE__ */ new WeakSet();
|
|
44
44
|
var COMPILER_KEYED_COMMITTED_ITEM_SNAPSHOTS = /* @__PURE__ */ new WeakMap();
|
|
45
|
-
var NATIVE_ARRAY_PROTOTYPE = Array.prototype;
|
|
46
|
-
var NATIVE_ARRAY_ITERATOR = Array.prototype[Symbol.iterator];
|
|
47
|
-
var NATIVE_ARRAY_FILTER = Array.prototype.filter;
|
|
48
|
-
var NATIVE_ARRAY_MAP = Array.prototype.map;
|
|
49
|
-
var NATIVE_ARRAY_SLICE = Array.prototype.slice;
|
|
50
|
-
var NATIVE_ARRAY_TO_SPLICED = Array.prototype.toSpliced;
|
|
51
|
-
var NATIVE_ARRAY_WITH = Array.prototype.with;
|
|
52
|
-
var NATIVE_ARRAY_TO_REVERSED = Array.prototype.toReversed;
|
|
53
|
-
var NATIVE_ARRAY_TO_SORTED = Array.prototype.toSorted;
|
|
54
|
-
var NATIVE_REFLECT_APPLY = Reflect.apply;
|
|
45
|
+
var NATIVE_ARRAY_PROTOTYPE = /* @__PURE__ */ (() => Array.prototype)();
|
|
46
|
+
var NATIVE_ARRAY_ITERATOR = /* @__PURE__ */ (() => Array.prototype[Symbol.iterator])();
|
|
47
|
+
var NATIVE_ARRAY_FILTER = /* @__PURE__ */ (() => Array.prototype.filter)();
|
|
48
|
+
var NATIVE_ARRAY_MAP = /* @__PURE__ */ (() => Array.prototype.map)();
|
|
49
|
+
var NATIVE_ARRAY_SLICE = /* @__PURE__ */ (() => Array.prototype.slice)();
|
|
50
|
+
var NATIVE_ARRAY_TO_SPLICED = /* @__PURE__ */ (() => Array.prototype.toSpliced)();
|
|
51
|
+
var NATIVE_ARRAY_WITH = /* @__PURE__ */ (() => Array.prototype.with)();
|
|
52
|
+
var NATIVE_ARRAY_TO_REVERSED = /* @__PURE__ */ (() => Array.prototype.toReversed)();
|
|
53
|
+
var NATIVE_ARRAY_TO_SORTED = /* @__PURE__ */ (() => Array.prototype.toSorted)();
|
|
54
|
+
var NATIVE_REFLECT_APPLY = /* @__PURE__ */ (() => Reflect.apply)();
|
|
55
55
|
function compilerObject(value) {
|
|
56
56
|
return typeof value === "object" && value !== null || typeof value === "function" ? value : void 0;
|
|
57
57
|
}
|
|
@@ -2043,11 +2043,11 @@ function keyedIdentityTargetSnapshot(value) {
|
|
|
2043
2043
|
const kind = typeof value;
|
|
2044
2044
|
return value === null || value === void 0 || kind === "string" || kind === "number" || kind === "bigint" ? { eligible: true, key: keyedRowIdentity(value) } : { eligible: false };
|
|
2045
2045
|
}
|
|
2046
|
-
var NATIVE_SET_PROTOTYPE = Set.prototype;
|
|
2047
|
-
var NATIVE_SET_ADD = Set.prototype.add;
|
|
2048
|
-
var NATIVE_SET_DELETE = Set.prototype.delete;
|
|
2049
|
-
var NATIVE_SET_HAS = Set.prototype.has;
|
|
2050
|
-
var NATIVE_SET_VALUES = Set.prototype.values;
|
|
2046
|
+
var NATIVE_SET_PROTOTYPE = /* @__PURE__ */ (() => Set.prototype)();
|
|
2047
|
+
var NATIVE_SET_ADD = /* @__PURE__ */ (() => Set.prototype.add)();
|
|
2048
|
+
var NATIVE_SET_DELETE = /* @__PURE__ */ (() => Set.prototype.delete)();
|
|
2049
|
+
var NATIVE_SET_HAS = /* @__PURE__ */ (() => Set.prototype.has)();
|
|
2050
|
+
var NATIVE_SET_VALUES = /* @__PURE__ */ (() => Set.prototype.values)();
|
|
2051
2051
|
var KEYED_COLLECTION_SNAPSHOT_MAX_DEPTH = 64;
|
|
2052
2052
|
function materializeKeyedMembershipSnapshot(snapshot) {
|
|
2053
2053
|
if (!snapshot.eligible) return void 0;
|
|
@@ -2148,12 +2148,12 @@ function keyedMembershipChangedKeys(previousSnapshot, nextSnapshot) {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
return keys;
|
|
2150
2150
|
}
|
|
2151
|
-
var NATIVE_MAP_PROTOTYPE = Map.prototype;
|
|
2152
|
-
var NATIVE_MAP_GET = Map.prototype.get;
|
|
2153
|
-
var NATIVE_MAP_HAS = Map.prototype.has;
|
|
2154
|
-
var NATIVE_MAP_SET = Map.prototype.set;
|
|
2155
|
-
var NATIVE_MAP_DELETE = Map.prototype.delete;
|
|
2156
|
-
var NATIVE_MAP_ENTRIES = Map.prototype.entries;
|
|
2151
|
+
var NATIVE_MAP_PROTOTYPE = /* @__PURE__ */ (() => Map.prototype)();
|
|
2152
|
+
var NATIVE_MAP_GET = /* @__PURE__ */ (() => Map.prototype.get)();
|
|
2153
|
+
var NATIVE_MAP_HAS = /* @__PURE__ */ (() => Map.prototype.has)();
|
|
2154
|
+
var NATIVE_MAP_SET = /* @__PURE__ */ (() => Map.prototype.set)();
|
|
2155
|
+
var NATIVE_MAP_DELETE = /* @__PURE__ */ (() => Map.prototype.delete)();
|
|
2156
|
+
var NATIVE_MAP_ENTRIES = /* @__PURE__ */ (() => Map.prototype.entries)();
|
|
2157
2157
|
function isSafeKeyedMapLookupValue(value) {
|
|
2158
2158
|
return value === null || value === void 0 || typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean";
|
|
2159
2159
|
}
|
|
@@ -2618,18 +2618,21 @@ function commitKeyedRowBinding(binding, instance, bindingIndex, value, target) {
|
|
|
2618
2618
|
instance.values[bindingIndex] = value;
|
|
2619
2619
|
if (!target) return;
|
|
2620
2620
|
if (binding.kind === "text") {
|
|
2621
|
-
|
|
2622
|
-
if (value && text && text === target.lastChild && text.nodeType === 3) {
|
|
2623
|
-
text.data = value;
|
|
2624
|
-
} else {
|
|
2625
|
-
target.textContent = value;
|
|
2626
|
-
}
|
|
2621
|
+
updateTextContent(target, value);
|
|
2627
2622
|
} else if (binding.kind === "style" && binding.name) {
|
|
2628
2623
|
updateStyle(target, binding.name, value);
|
|
2629
2624
|
} else if (binding.kind === "attribute" && binding.name) {
|
|
2630
2625
|
updateAttribute(target, binding.name, value);
|
|
2631
2626
|
}
|
|
2632
2627
|
}
|
|
2628
|
+
function updateTextContent(target, value) {
|
|
2629
|
+
const text = target.firstChild;
|
|
2630
|
+
if (value && text && text === target.lastChild && text.nodeType === 3) {
|
|
2631
|
+
text.data = value;
|
|
2632
|
+
} else {
|
|
2633
|
+
target.textContent = value;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2633
2636
|
function prepareKeyedRowBindingUpdate(props, instance, item, index, bindingIndex) {
|
|
2634
2637
|
const binding = props.bindings[bindingIndex];
|
|
2635
2638
|
const rawValue = binding.read(item, index);
|
|
@@ -4444,92 +4447,92 @@ var keyedAppendOnlyUpdateRuntime = {
|
|
|
4444
4447
|
commit: commitCompilerKeyedCollection,
|
|
4445
4448
|
reconcile: () => void 0
|
|
4446
4449
|
};
|
|
4447
|
-
var keyedFilterUpdateRuntime = {
|
|
4450
|
+
var keyedFilterUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4448
4451
|
...keyedUpdateRuntime,
|
|
4449
4452
|
filter: reconcileCompilerKeyedArrayFilter
|
|
4450
|
-
};
|
|
4453
|
+
}))();
|
|
4451
4454
|
var keyedFilterOnlyUpdateRuntime = {
|
|
4452
4455
|
append: () => void 0,
|
|
4453
4456
|
commit: commitCompilerKeyedCollection,
|
|
4454
4457
|
reconcile: () => void 0,
|
|
4455
4458
|
filter: reconcileCompilerKeyedArrayFilter
|
|
4456
4459
|
};
|
|
4457
|
-
var keyedPrependUpdateRuntime = {
|
|
4460
|
+
var keyedPrependUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4458
4461
|
...keyedUpdateRuntime,
|
|
4459
4462
|
prepend: reconcileCompilerKeyedArrayPrepend
|
|
4460
|
-
};
|
|
4463
|
+
}))();
|
|
4461
4464
|
var keyedPrependOnlyUpdateRuntime = {
|
|
4462
4465
|
append: () => void 0,
|
|
4463
4466
|
commit: commitCompilerKeyedCollection,
|
|
4464
4467
|
reconcile: () => void 0,
|
|
4465
4468
|
prepend: reconcileCompilerKeyedArrayPrepend
|
|
4466
4469
|
};
|
|
4467
|
-
var keyedFilterPrependUpdateRuntime = {
|
|
4470
|
+
var keyedFilterPrependUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4468
4471
|
...keyedFilterUpdateRuntime,
|
|
4469
4472
|
prepend: reconcileCompilerKeyedArrayPrepend
|
|
4470
|
-
};
|
|
4471
|
-
var keyedStructuralPrependUpdateRuntime = {
|
|
4473
|
+
}))();
|
|
4474
|
+
var keyedStructuralPrependUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4472
4475
|
...keyedFilterPrependUpdateRuntime,
|
|
4473
4476
|
prepend: reconcileCompilerKeyedArrayPrependWithStructural
|
|
4474
|
-
};
|
|
4475
|
-
var keyedPositionUpdateRuntime = {
|
|
4477
|
+
}))();
|
|
4478
|
+
var keyedPositionUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4476
4479
|
...keyedUpdateRuntime,
|
|
4477
4480
|
position: reconcileCompilerKeyedArrayPosition
|
|
4478
|
-
};
|
|
4479
|
-
var keyedBatchPositionUpdateRuntime = {
|
|
4481
|
+
}))();
|
|
4482
|
+
var keyedBatchPositionUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4480
4483
|
...keyedUpdateRuntime,
|
|
4481
4484
|
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
4482
|
-
};
|
|
4483
|
-
var keyedWindowPositionUpdateRuntime = {
|
|
4485
|
+
}))();
|
|
4486
|
+
var keyedWindowPositionUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4484
4487
|
...keyedUpdateRuntime,
|
|
4485
4488
|
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
4486
|
-
};
|
|
4487
|
-
var keyedReorderUpdateRuntime = {
|
|
4489
|
+
}))();
|
|
4490
|
+
var keyedReorderUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4488
4491
|
...keyedUpdateRuntime,
|
|
4489
4492
|
reorder: reconcileCompilerKeyedArrayReorder
|
|
4490
|
-
};
|
|
4491
|
-
var keyedMapReorderUpdateRuntime = {
|
|
4493
|
+
}))();
|
|
4494
|
+
var keyedMapReorderUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4492
4495
|
...keyedUpdateRuntime,
|
|
4493
4496
|
reorder: reconcileCompilerKeyedArrayReorderWithMap
|
|
4494
|
-
};
|
|
4495
|
-
var keyedCompleteUpdateRuntime = {
|
|
4497
|
+
}))();
|
|
4498
|
+
var keyedCompleteUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4496
4499
|
...keyedFilterPrependUpdateRuntime,
|
|
4497
4500
|
rollingWindow: reconcileCompilerKeyedArrayRollingWindow
|
|
4498
|
-
};
|
|
4499
|
-
var keyedEveryUpdateRuntime = {
|
|
4501
|
+
}))();
|
|
4502
|
+
var keyedEveryUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4500
4503
|
...keyedCompleteUpdateRuntime,
|
|
4501
4504
|
position: reconcileCompilerKeyedArrayPosition,
|
|
4502
4505
|
reorder: reconcileCompilerKeyedArrayReorderWithMapAndStructural
|
|
4503
|
-
};
|
|
4504
|
-
var keyedBatchEveryUpdateRuntime = {
|
|
4506
|
+
}))();
|
|
4507
|
+
var keyedBatchEveryUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4505
4508
|
...keyedEveryUpdateRuntime,
|
|
4506
4509
|
position: reconcileCompilerKeyedArrayPositionWithBatch
|
|
4507
|
-
};
|
|
4508
|
-
var keyedWindowEveryUpdateRuntime = {
|
|
4510
|
+
}))();
|
|
4511
|
+
var keyedWindowEveryUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4509
4512
|
...keyedEveryUpdateRuntime,
|
|
4510
4513
|
position: reconcileCompilerKeyedArrayPositionWithWindow
|
|
4511
|
-
};
|
|
4512
|
-
var keyedWindowEveryStructuralAppendUpdateRuntime = {
|
|
4514
|
+
}))();
|
|
4515
|
+
var keyedWindowEveryStructuralAppendUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4513
4516
|
...keyedWindowEveryUpdateRuntime,
|
|
4514
4517
|
append: reconcileCompilerKeyedArrayAppendWithStructural
|
|
4515
|
-
};
|
|
4516
|
-
var keyedWindowEveryStructuralAppendMapUpdateRuntime = {
|
|
4518
|
+
}))();
|
|
4519
|
+
var keyedWindowEveryStructuralAppendMapUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4517
4520
|
...keyedWindowEveryStructuralAppendUpdateRuntime,
|
|
4518
4521
|
append: reconcileCompilerKeyedArrayAppendMapWithStructural,
|
|
4519
4522
|
commit: commitCompilerKeyedCollectionWithItemSnapshot
|
|
4520
|
-
};
|
|
4521
|
-
var keyedCompleteCompatibilityUpdateRuntime = {
|
|
4523
|
+
}))();
|
|
4524
|
+
var keyedCompleteCompatibilityUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4522
4525
|
...keyedWindowEveryStructuralAppendMapUpdateRuntime,
|
|
4523
4526
|
prepend: reconcileCompilerKeyedArrayPrependWithStructural
|
|
4524
|
-
};
|
|
4525
|
-
var keyedCompleteStructuralPrependMapUpdateRuntime = {
|
|
4527
|
+
}))();
|
|
4528
|
+
var keyedCompleteStructuralPrependMapUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4526
4529
|
...keyedCompleteCompatibilityUpdateRuntime,
|
|
4527
4530
|
prepend: reconcileCompilerKeyedArrayPrependMapWithStructural
|
|
4528
|
-
};
|
|
4529
|
-
var keyedMappedRollingWindowUpdateRuntime = {
|
|
4531
|
+
}))();
|
|
4532
|
+
var keyedMappedRollingWindowUpdateRuntime = /* @__PURE__ */ (() => ({
|
|
4530
4533
|
...keyedCompleteStructuralPrependMapUpdateRuntime,
|
|
4531
4534
|
rollingWindow: reconcileCompilerKeyedArrayMappedRollingWindow
|
|
4532
|
-
};
|
|
4535
|
+
}))();
|
|
4533
4536
|
function reconcileCompilerKeyedMapUpdate(props, dirtyState, collectionToken, instances, conditionals) {
|
|
4534
4537
|
const dependency = props.collectionDependency;
|
|
4535
4538
|
if (dependency === void 0) return void 0;
|
|
@@ -8314,6 +8317,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8314
8317
|
this.trackedBindingsByDependency = [];
|
|
8315
8318
|
this.trackedDependenciesByBinding = /* @__PURE__ */ new Map();
|
|
8316
8319
|
this.bindingValues = /* @__PURE__ */ new Map();
|
|
8320
|
+
this.textNodes = /* @__PURE__ */ new Map();
|
|
8317
8321
|
this.activeBinding = null;
|
|
8318
8322
|
this.activeDependencies = null;
|
|
8319
8323
|
this.renderedDefinition = null;
|
|
@@ -8323,9 +8327,6 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8323
8327
|
this.blockRootElements = /* @__PURE__ */ new Set();
|
|
8324
8328
|
this.bindingTargets = /* @__PURE__ */ new Map();
|
|
8325
8329
|
this.bindingTargetRefs = /* @__PURE__ */ new Map();
|
|
8326
|
-
this.captureRoot = (root) => {
|
|
8327
|
-
this.root = root;
|
|
8328
|
-
};
|
|
8329
8330
|
this.refreshDefinition = () => {
|
|
8330
8331
|
if (this.mounted) this.forceUpdate();
|
|
8331
8332
|
};
|
|
@@ -8376,13 +8377,8 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8376
8377
|
}
|
|
8377
8378
|
this.blockRuntime = blockRuntime;
|
|
8378
8379
|
}
|
|
8379
|
-
usesHybridReactivity() {
|
|
8380
|
-
return definitionReference.current.reactivity === "hybrid";
|
|
8381
|
-
}
|
|
8382
8380
|
canReuseRenderedElement(currentDefinition, propValues) {
|
|
8383
|
-
return
|
|
8384
|
-
this.mounted && propValues && propValues.every(isCompilerPrimitive) && this.renderedDefinition === currentDefinition && this.renderedElement
|
|
8385
|
-
);
|
|
8381
|
+
return this.mounted && propValues !== null && propValues.every(isCompilerPrimitive) && this.renderedDefinition === currentDefinition;
|
|
8386
8382
|
}
|
|
8387
8383
|
renderCellsForProps(propValues) {
|
|
8388
8384
|
if (!propValues) return { cells: this.cells, commit: () => void 0 };
|
|
@@ -8404,7 +8400,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8404
8400
|
};
|
|
8405
8401
|
}
|
|
8406
8402
|
tracksBinding(binding) {
|
|
8407
|
-
return
|
|
8403
|
+
return definitionReference.current.reactivity === "hybrid" && binding.tracking === "dynamic";
|
|
8408
8404
|
}
|
|
8409
8405
|
ensureBindingIndex() {
|
|
8410
8406
|
const currentDefinition = definitionReference.current;
|
|
@@ -8466,7 +8462,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8466
8462
|
return binding.kind === "text" ? renderTextValue(value) : value;
|
|
8467
8463
|
}
|
|
8468
8464
|
primeHybridBindings() {
|
|
8469
|
-
if (
|
|
8465
|
+
if (definitionReference.current.reactivity !== "hybrid") return;
|
|
8470
8466
|
for (const binding of definitionReference.current.bindings) {
|
|
8471
8467
|
if (binding.kind === "block") continue;
|
|
8472
8468
|
if (!this.tracksBinding(binding)) continue;
|
|
@@ -8555,29 +8551,26 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8555
8551
|
for (const binding of this.staticBindingsByDependency[dependency] || []) {
|
|
8556
8552
|
affectedBindings.add(binding);
|
|
8557
8553
|
}
|
|
8558
|
-
if (
|
|
8554
|
+
if (definitionReference.current.reactivity === "hybrid") {
|
|
8559
8555
|
for (const binding of this.trackedBindingsByDependency[dependency] || []) {
|
|
8560
8556
|
affectedBindings.add(binding);
|
|
8561
8557
|
}
|
|
8562
8558
|
}
|
|
8563
8559
|
}
|
|
8564
|
-
const
|
|
8560
|
+
const blockRefreshes = [];
|
|
8561
|
+
for (const id of affectedBlockIds) {
|
|
8562
|
+
const binding = this.blockBindings.get(id);
|
|
8563
|
+
const refresh = this.blockRefreshListeners.get(id);
|
|
8564
|
+
if (!binding || !refresh) continue;
|
|
8565
8565
|
let parent = binding.parent;
|
|
8566
8566
|
while (parent !== void 0) {
|
|
8567
|
-
if (affectedBlockIds.has(parent) && this.blockRefreshListeners.has(parent))
|
|
8568
|
-
return true;
|
|
8569
|
-
}
|
|
8567
|
+
if (affectedBlockIds.has(parent) && this.blockRefreshListeners.has(parent)) break;
|
|
8570
8568
|
parent = this.blockBindings.get(parent)?.parent;
|
|
8571
8569
|
}
|
|
8572
|
-
|
|
8573
|
-
}
|
|
8574
|
-
const blockRefreshes = [...affectedBlockIds].map((id) => {
|
|
8575
|
-
const binding = this.blockBindings.get(id);
|
|
8576
|
-
const refresh = this.blockRefreshListeners.get(id);
|
|
8577
|
-
return binding && refresh && !hasAffectedMountedAncestor(binding) ? refresh : void 0;
|
|
8578
|
-
}).filter((refresh) => refresh !== void 0);
|
|
8570
|
+
if (parent === void 0) blockRefreshes.push(refresh);
|
|
8571
|
+
}
|
|
8579
8572
|
for (const binding of affectedBindings) {
|
|
8580
|
-
|
|
8573
|
+
this.applyBinding(binding);
|
|
8581
8574
|
}
|
|
8582
8575
|
let pendingBlockCommits = blockRefreshes.length;
|
|
8583
8576
|
for (const refresh of blockRefreshes) {
|
|
@@ -8603,7 +8596,12 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8603
8596
|
if (Object.is(this.bindingValues.get(binding), comparableValue)) return;
|
|
8604
8597
|
}
|
|
8605
8598
|
if (binding.kind === "text") {
|
|
8606
|
-
target
|
|
8599
|
+
if (!this.textNodes.has(target)) {
|
|
8600
|
+
this.textNodes.set(target, [...target.childNodes]);
|
|
8601
|
+
target.textContent = comparableValue;
|
|
8602
|
+
} else {
|
|
8603
|
+
updateTextContent(target, comparableValue);
|
|
8604
|
+
}
|
|
8607
8605
|
} else if (binding.kind === "style") {
|
|
8608
8606
|
updateStyle(target, binding.name, value);
|
|
8609
8607
|
} else {
|
|
@@ -8614,15 +8612,21 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8614
8612
|
componentDidMount() {
|
|
8615
8613
|
this.mounted = true;
|
|
8616
8614
|
refreshListeners.add(this.refreshDefinition);
|
|
8617
|
-
this.
|
|
8618
|
-
this.primeHybridBindings();
|
|
8615
|
+
this.componentDidUpdate();
|
|
8619
8616
|
}
|
|
8620
8617
|
getSnapshotBeforeUpdate() {
|
|
8621
8618
|
const currentDefinition = definitionReference.current;
|
|
8622
8619
|
const propValues = currentDefinition.readProps?.(this.props) || null;
|
|
8623
|
-
|
|
8620
|
+
if (this.canReuseRenderedElement(currentDefinition, propValues)) return true;
|
|
8621
|
+
this.textNodes.forEach((children, target) => {
|
|
8622
|
+
target.textContent = "";
|
|
8623
|
+
for (const child of children) target.appendChild(child);
|
|
8624
|
+
});
|
|
8625
|
+
this.textNodes.clear();
|
|
8626
|
+
this.bindingValues.clear();
|
|
8627
|
+
return false;
|
|
8624
8628
|
}
|
|
8625
|
-
componentDidUpdate(
|
|
8629
|
+
componentDidUpdate(previousProps, _previousState, reusedRenderedElement) {
|
|
8626
8630
|
const propValues = definitionReference.current.readProps?.(this.props) || null;
|
|
8627
8631
|
if (propValues) {
|
|
8628
8632
|
if (reusedRenderedElement) this.captureInputSelection();
|
|
@@ -8637,17 +8641,20 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8637
8641
|
cell.flush();
|
|
8638
8642
|
}
|
|
8639
8643
|
}
|
|
8640
|
-
this.flushBindingUpdates();
|
|
8641
|
-
return;
|
|
8642
8644
|
}
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8645
|
+
if (!reusedRenderedElement) {
|
|
8646
|
+
this.ensureBindingIndex();
|
|
8647
|
+
this.primeHybridBindings();
|
|
8648
|
+
}
|
|
8649
|
+
if (!propValues && previousProps) {
|
|
8650
|
+
for (const binding of definitionReference.current.bindings) {
|
|
8651
|
+
this.applyBinding(binding, true);
|
|
8652
|
+
}
|
|
8646
8653
|
}
|
|
8654
|
+
if (this.dirtyState.size) this.flushBindingUpdates();
|
|
8647
8655
|
}
|
|
8648
8656
|
componentWillUnmount() {
|
|
8649
8657
|
this.mounted = false;
|
|
8650
|
-
this.dirtyState.clear();
|
|
8651
8658
|
this.inputSelection = null;
|
|
8652
8659
|
this.blockRefreshListeners.clear();
|
|
8653
8660
|
this.bindingTargetRefs.clear();
|
|
@@ -8678,31 +8685,18 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8678
8685
|
}
|
|
8679
8686
|
let renderedElement;
|
|
8680
8687
|
const captureCommittedRoot = (root) => {
|
|
8681
|
-
this.
|
|
8682
|
-
if (
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8688
|
+
this.root = root;
|
|
8689
|
+
if (root) {
|
|
8690
|
+
renderCells.commit();
|
|
8691
|
+
this.renderedDefinition = currentDefinition;
|
|
8692
|
+
this.renderedElement = renderedElement;
|
|
8693
|
+
}
|
|
8686
8694
|
};
|
|
8687
|
-
if (element.type === this.blockRuntime.KeyedRanges) {
|
|
8688
|
-
renderedElement = React.cloneElement(
|
|
8689
|
-
element,
|
|
8690
|
-
{
|
|
8691
|
-
rootRef: captureCommittedRoot
|
|
8692
|
-
}
|
|
8693
|
-
);
|
|
8694
|
-
} else if (element.type === this.blockRuntime.ConditionalRanges) {
|
|
8695
|
+
if (element.type === this.blockRuntime.KeyedRanges || element.type === this.blockRuntime.ConditionalRanges || element.type === this.blockRuntime.MixedRanges) {
|
|
8695
8696
|
renderedElement = React.cloneElement(
|
|
8696
8697
|
element,
|
|
8697
8698
|
{ rootRef: captureCommittedRoot }
|
|
8698
8699
|
);
|
|
8699
|
-
} else if (element.type === this.blockRuntime.MixedRanges) {
|
|
8700
|
-
renderedElement = React.cloneElement(
|
|
8701
|
-
element,
|
|
8702
|
-
{
|
|
8703
|
-
rootRef: captureCommittedRoot
|
|
8704
|
-
}
|
|
8705
|
-
);
|
|
8706
8700
|
} else if (typeof element.type !== "string") {
|
|
8707
8701
|
throw new TypeError(
|
|
8708
8702
|
`Compiled component ${currentDefinition.displayName} must return one host element.`
|