@farm.js/react 0.1.0-beta.4 → 0.1.0-beta.5
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 +13 -0
- package/dist/compiler-runtime.cjs +144 -49
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +31 -4
- package/dist/compiler-runtime.d.ts +31 -4
- package/dist/compiler-runtime.mjs +133 -50
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +57 -3
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +57 -3
- package/dist/vite.mjs.map +1 -1
- package/package.json +5 -3
|
@@ -244,13 +244,40 @@ interface CompiledComponentDefinition<Props> {
|
|
|
244
244
|
render(props: Props, state: readonly CompilerCell[], blocks: CompilerBlockRuntime): React.ReactElement;
|
|
245
245
|
bindings: readonly CompilerBinding<Props>[];
|
|
246
246
|
}
|
|
247
|
+
type CompilerBlockRefresh = (afterCommit?: () => void, dirtyState?: ReadonlySet<number>) => void;
|
|
248
|
+
interface CompilerRuntimeFeatureOwner {
|
|
249
|
+
setRoot(id: number, root: Element | null): void;
|
|
250
|
+
subscribe(id: number, refresh: CompilerBlockRefresh): () => void;
|
|
251
|
+
}
|
|
252
|
+
interface CompilerRuntimeFeature {
|
|
253
|
+
/** Stable identity used by Fast Refresh compatibility checks. */
|
|
254
|
+
name: string;
|
|
255
|
+
create(owner: CompilerRuntimeFeatureOwner): Partial<CompilerBlockRuntime>;
|
|
256
|
+
}
|
|
257
|
+
declare const conditionalRuntimeFeature: CompilerRuntimeFeature;
|
|
258
|
+
declare const hostConditionalRuntimeFeature: CompilerRuntimeFeature;
|
|
259
|
+
declare const conditionalRangesRuntimeFeature: CompilerRuntimeFeature;
|
|
260
|
+
declare const keyedListRuntimeFeature: CompilerRuntimeFeature;
|
|
261
|
+
declare const keyedRowsRuntimeFeature: CompilerRuntimeFeature;
|
|
262
|
+
declare const keyedRowsConditionalRuntimeFeature: CompilerRuntimeFeature;
|
|
263
|
+
declare const keyedRowsHostRuntimeFeature: CompilerRuntimeFeature;
|
|
264
|
+
declare const keyedRowsCompleteRuntimeFeature: CompilerRuntimeFeature;
|
|
265
|
+
declare const keyedRangesRuntimeFeature: CompilerRuntimeFeature;
|
|
266
|
+
declare const mixedRangesRuntimeFeature: CompilerRuntimeFeature;
|
|
267
|
+
declare const componentRuntimeFeature: CompilerRuntimeFeature;
|
|
247
268
|
/**
|
|
248
|
-
*
|
|
269
|
+
* Tree-shakable runtime target emitted by the AOT transform.
|
|
249
270
|
*
|
|
250
271
|
* React owns initial placement, SSR, hydration, props, and event semantics.
|
|
251
|
-
* Compiler cells own local updates and precomputed DOM paths.
|
|
252
|
-
*
|
|
272
|
+
* Compiler cells own local updates and precomputed DOM paths. Structural
|
|
273
|
+
* helpers are installed only when the compiler emitted that boundary kind.
|
|
274
|
+
*/
|
|
275
|
+
declare function createCompiledComponentWithFeatures<Props>(definition: CompiledComponentDefinition<Props>, runtimeFeatures: readonly CompilerRuntimeFeature[]): React.ComponentType<Props>;
|
|
276
|
+
/**
|
|
277
|
+
* Compatibility entry for hand-authored runtime definitions.
|
|
278
|
+
* Compiler output uses createCompiledComponentWithFeatures so unused structural
|
|
279
|
+
* runtimes can be removed from production bundles.
|
|
253
280
|
*/
|
|
254
281
|
declare function createCompiledComponent<Props>(definition: CompiledComponentDefinition<Props>): React.ComponentType<Props>;
|
|
255
282
|
|
|
256
|
-
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, createCompiledComponent };
|
|
283
|
+
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeFeature, type CompilerRuntimeFeatureOwner, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
@@ -244,13 +244,40 @@ interface CompiledComponentDefinition<Props> {
|
|
|
244
244
|
render(props: Props, state: readonly CompilerCell[], blocks: CompilerBlockRuntime): React.ReactElement;
|
|
245
245
|
bindings: readonly CompilerBinding<Props>[];
|
|
246
246
|
}
|
|
247
|
+
type CompilerBlockRefresh = (afterCommit?: () => void, dirtyState?: ReadonlySet<number>) => void;
|
|
248
|
+
interface CompilerRuntimeFeatureOwner {
|
|
249
|
+
setRoot(id: number, root: Element | null): void;
|
|
250
|
+
subscribe(id: number, refresh: CompilerBlockRefresh): () => void;
|
|
251
|
+
}
|
|
252
|
+
interface CompilerRuntimeFeature {
|
|
253
|
+
/** Stable identity used by Fast Refresh compatibility checks. */
|
|
254
|
+
name: string;
|
|
255
|
+
create(owner: CompilerRuntimeFeatureOwner): Partial<CompilerBlockRuntime>;
|
|
256
|
+
}
|
|
257
|
+
declare const conditionalRuntimeFeature: CompilerRuntimeFeature;
|
|
258
|
+
declare const hostConditionalRuntimeFeature: CompilerRuntimeFeature;
|
|
259
|
+
declare const conditionalRangesRuntimeFeature: CompilerRuntimeFeature;
|
|
260
|
+
declare const keyedListRuntimeFeature: CompilerRuntimeFeature;
|
|
261
|
+
declare const keyedRowsRuntimeFeature: CompilerRuntimeFeature;
|
|
262
|
+
declare const keyedRowsConditionalRuntimeFeature: CompilerRuntimeFeature;
|
|
263
|
+
declare const keyedRowsHostRuntimeFeature: CompilerRuntimeFeature;
|
|
264
|
+
declare const keyedRowsCompleteRuntimeFeature: CompilerRuntimeFeature;
|
|
265
|
+
declare const keyedRangesRuntimeFeature: CompilerRuntimeFeature;
|
|
266
|
+
declare const mixedRangesRuntimeFeature: CompilerRuntimeFeature;
|
|
267
|
+
declare const componentRuntimeFeature: CompilerRuntimeFeature;
|
|
247
268
|
/**
|
|
248
|
-
*
|
|
269
|
+
* Tree-shakable runtime target emitted by the AOT transform.
|
|
249
270
|
*
|
|
250
271
|
* React owns initial placement, SSR, hydration, props, and event semantics.
|
|
251
|
-
* Compiler cells own local updates and precomputed DOM paths.
|
|
252
|
-
*
|
|
272
|
+
* Compiler cells own local updates and precomputed DOM paths. Structural
|
|
273
|
+
* helpers are installed only when the compiler emitted that boundary kind.
|
|
274
|
+
*/
|
|
275
|
+
declare function createCompiledComponentWithFeatures<Props>(definition: CompiledComponentDefinition<Props>, runtimeFeatures: readonly CompilerRuntimeFeature[]): React.ComponentType<Props>;
|
|
276
|
+
/**
|
|
277
|
+
* Compatibility entry for hand-authored runtime definitions.
|
|
278
|
+
* Compiler output uses createCompiledComponentWithFeatures so unused structural
|
|
279
|
+
* runtimes can be removed from production bundles.
|
|
253
280
|
*/
|
|
254
281
|
declare function createCompiledComponent<Props>(definition: CompiledComponentDefinition<Props>): React.ComponentType<Props>;
|
|
255
282
|
|
|
256
|
-
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, createCompiledComponent };
|
|
283
|
+
export { type CompiledComponentDefinition, type CompilerAttributeBinding, type CompilerBinding, type CompilerBlockRuntime, type CompilerCell, type CompilerComponentBlockProps, type CompilerConditionalBlockBinding, type CompilerConditionalBlockProps, type CompilerConditionalRange, type CompilerConditionalRangesBlockProps, type CompilerHostBlock, type CompilerHostConditionalBinding, type CompilerHostConditionalBlockProps, type CompilerHostConditionalBranch, type CompilerHostConditionalRanges, type CompilerHostElement, type CompilerHostKeyedRanges, type CompilerHostMixedRanges, type CompilerKeyedListBlockProps, type CompilerKeyedRange, type CompilerKeyedRangesBlockProps, type CompilerKeyedRowBinding, type CompilerKeyedRowConditional, type CompilerKeyedRowConditionalBranch, type CompilerKeyedRowElement, type CompilerKeyedRowEvent, type CompilerKeyedRowsBlockProps, type CompilerMixedRange, type CompilerMixedRangesBlockProps, type CompilerRuntimeFeature, type CompilerRuntimeFeatureOwner, type CompilerRuntimeReactivity, type CompilerStateUpdater, type CompilerStaticRangeBinding, type CompilerStyleBinding, type CompilerTextBinding, componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
@@ -1877,11 +1877,7 @@ function longestIncreasingSubsequencePositions(sequence) {
|
|
|
1877
1877
|
}
|
|
1878
1878
|
return positions;
|
|
1879
1879
|
}
|
|
1880
|
-
function
|
|
1881
|
-
const rowHostScopeOwner = {
|
|
1882
|
-
subscribe: () => () => {
|
|
1883
|
-
}
|
|
1884
|
-
};
|
|
1880
|
+
function createKeyedRowConditionalRuntime() {
|
|
1885
1881
|
class FarmKeyedRowConditional extends React.Component {
|
|
1886
1882
|
constructor() {
|
|
1887
1883
|
super(...arguments);
|
|
@@ -1923,6 +1919,22 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
1923
1919
|
}
|
|
1924
1920
|
}
|
|
1925
1921
|
FarmKeyedRowConditional.displayName = "FarmCompiledKeyedRowConditional";
|
|
1922
|
+
return {
|
|
1923
|
+
Component: FarmKeyedRowConditional,
|
|
1924
|
+
readValues: readKeyedRowConditionalValues,
|
|
1925
|
+
changed: keyedRowConditionalChanged
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
function createKeyedRowHostRuntime() {
|
|
1929
|
+
const owner = {
|
|
1930
|
+
subscribe: () => () => {
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
return {
|
|
1934
|
+
mount: (element, descriptor, requestFallback) => mountCompilerHostTree(owner, element, descriptor, requestFallback)
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
function createKeyedRowsBlockComponent(owner, options = {}) {
|
|
1926
1938
|
class FarmKeyedRowsBlock extends React.Component {
|
|
1927
1939
|
constructor() {
|
|
1928
1940
|
super(...arguments);
|
|
@@ -1995,7 +2007,9 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
1995
2007
|
this.rowConditional = (item, index, conditionalId, render) => {
|
|
1996
2008
|
if (this.state.fallback) return render(item, index);
|
|
1997
2009
|
const key = keyedRowIdentity(this.currentProps.rowKey(item, index));
|
|
1998
|
-
|
|
2010
|
+
const Conditional = options.conditionals?.Component;
|
|
2011
|
+
if (!Conditional) return render(item, index);
|
|
2012
|
+
return React.createElement(Conditional, {
|
|
1999
2013
|
key: `${key}:${conditionalId}`,
|
|
2000
2014
|
owner: this.conditionalOwner,
|
|
2001
2015
|
rowKey: key,
|
|
@@ -2089,12 +2103,10 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2089
2103
|
}
|
|
2090
2104
|
mountRowHostScope(element, descriptor, props = this.currentProps) {
|
|
2091
2105
|
if (!props.hostBlocks) return void 0;
|
|
2092
|
-
return
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
this.requestHostScopeFallback
|
|
2097
|
-
);
|
|
2106
|
+
return options.hostBlocks?.mount(element, descriptor, this.requestHostScopeFallback) || null;
|
|
2107
|
+
}
|
|
2108
|
+
readConditionalValues(props, item, index) {
|
|
2109
|
+
return options.conditionals?.readValues(props, item, index) || EMPTY_KEYED_ROW_CONDITIONAL_VALUES;
|
|
2098
2110
|
}
|
|
2099
2111
|
pruneEventHandlers(keys) {
|
|
2100
2112
|
const active = new Set(keys);
|
|
@@ -2135,7 +2147,7 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2135
2147
|
values: this.hasReactOwnedRows() ? this.currentProps.bindings.map(() => UNSET_KEYED_ROW_BINDING) : readKeyedRowBindingValues(this.currentProps, rows.items[index], index),
|
|
2136
2148
|
item: rows.items[index],
|
|
2137
2149
|
index,
|
|
2138
|
-
conditionalValues:
|
|
2150
|
+
conditionalValues: this.readConditionalValues(
|
|
2139
2151
|
this.currentProps,
|
|
2140
2152
|
rows.items[index],
|
|
2141
2153
|
index
|
|
@@ -2247,13 +2259,13 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2247
2259
|
}
|
|
2248
2260
|
}
|
|
2249
2261
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
2250
|
-
const conditionalValues =
|
|
2262
|
+
const conditionalValues = this.readConditionalValues(
|
|
2251
2263
|
this.currentProps,
|
|
2252
2264
|
rows.items[index],
|
|
2253
2265
|
index
|
|
2254
2266
|
);
|
|
2255
2267
|
for (const [id, values] of conditionalValues) {
|
|
2256
|
-
if (
|
|
2268
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
2257
2269
|
conditionalChanges.push({ key, id, item: rows.items[index], index });
|
|
2258
2270
|
}
|
|
2259
2271
|
}
|
|
@@ -2290,13 +2302,13 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2290
2302
|
}
|
|
2291
2303
|
}
|
|
2292
2304
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
2293
|
-
const conditionalValues =
|
|
2305
|
+
const conditionalValues = this.readConditionalValues(
|
|
2294
2306
|
this.currentProps,
|
|
2295
2307
|
rows.items[index],
|
|
2296
2308
|
index
|
|
2297
2309
|
);
|
|
2298
2310
|
for (const [id, values] of conditionalValues) {
|
|
2299
|
-
if (
|
|
2311
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
2300
2312
|
conditionalChanges.push({ key, id, item: rows.items[index], index });
|
|
2301
2313
|
}
|
|
2302
2314
|
}
|
|
@@ -2380,13 +2392,13 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2380
2392
|
}
|
|
2381
2393
|
}
|
|
2382
2394
|
applyKeyedRowBindings(this.currentProps, existing, rows.items[index], index);
|
|
2383
|
-
const conditionalValues =
|
|
2395
|
+
const conditionalValues = this.readConditionalValues(
|
|
2384
2396
|
this.currentProps,
|
|
2385
2397
|
rows.items[index],
|
|
2386
2398
|
index
|
|
2387
2399
|
);
|
|
2388
2400
|
for (const [id, values] of conditionalValues) {
|
|
2389
|
-
if (
|
|
2401
|
+
if (options.conditionals?.changed(existing.conditionalValues.get(id), values)) {
|
|
2390
2402
|
conditionalChanges.push({ key, id, item: rows.items[index], index });
|
|
2391
2403
|
}
|
|
2392
2404
|
}
|
|
@@ -2413,7 +2425,7 @@ function createKeyedRowsBlockComponent(owner) {
|
|
|
2413
2425
|
values: readKeyedRowBindingValues(this.currentProps, rows.items[index], index),
|
|
2414
2426
|
item: rows.items[index],
|
|
2415
2427
|
index,
|
|
2416
|
-
conditionalValues:
|
|
2428
|
+
conditionalValues: this.readConditionalValues(
|
|
2417
2429
|
this.currentProps,
|
|
2418
2430
|
rows.items[index],
|
|
2419
2431
|
index
|
|
@@ -2892,12 +2904,86 @@ function createComponentBlockComponent(owner) {
|
|
|
2892
2904
|
FarmComponentBlock.displayName = "FarmCompiledComponentIsland";
|
|
2893
2905
|
return FarmComponentBlock;
|
|
2894
2906
|
}
|
|
2895
|
-
|
|
2907
|
+
var conditionalRuntimeFeature = {
|
|
2908
|
+
name: "conditional",
|
|
2909
|
+
create: (owner) => ({
|
|
2910
|
+
Conditional: createConditionalBlockComponent(owner)
|
|
2911
|
+
})
|
|
2912
|
+
};
|
|
2913
|
+
var hostConditionalRuntimeFeature = {
|
|
2914
|
+
name: "host-conditional",
|
|
2915
|
+
create: (owner) => ({
|
|
2916
|
+
HostConditional: createHostConditionalBlockComponent(owner)
|
|
2917
|
+
})
|
|
2918
|
+
};
|
|
2919
|
+
var conditionalRangesRuntimeFeature = {
|
|
2920
|
+
name: "conditional-ranges",
|
|
2921
|
+
create: (owner) => ({
|
|
2922
|
+
ConditionalRanges: createConditionalRangesBlockComponent(owner)
|
|
2923
|
+
})
|
|
2924
|
+
};
|
|
2925
|
+
var keyedListRuntimeFeature = {
|
|
2926
|
+
name: "keyed-list",
|
|
2927
|
+
create: (owner) => ({
|
|
2928
|
+
KeyedList: createKeyedListBlockComponent(owner)
|
|
2929
|
+
})
|
|
2930
|
+
};
|
|
2931
|
+
var keyedRowsRuntimeFeature = {
|
|
2932
|
+
name: "keyed-rows",
|
|
2933
|
+
create: (owner) => ({
|
|
2934
|
+
KeyedRows: createKeyedRowsBlockComponent(owner)
|
|
2935
|
+
})
|
|
2936
|
+
};
|
|
2937
|
+
var keyedRowsConditionalRuntimeFeature = {
|
|
2938
|
+
name: "keyed-rows:conditional",
|
|
2939
|
+
create: (owner) => ({
|
|
2940
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
2941
|
+
conditionals: createKeyedRowConditionalRuntime()
|
|
2942
|
+
})
|
|
2943
|
+
})
|
|
2944
|
+
};
|
|
2945
|
+
var keyedRowsHostRuntimeFeature = {
|
|
2946
|
+
name: "keyed-rows:host",
|
|
2947
|
+
create: (owner) => ({
|
|
2948
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
2949
|
+
hostBlocks: createKeyedRowHostRuntime()
|
|
2950
|
+
})
|
|
2951
|
+
})
|
|
2952
|
+
};
|
|
2953
|
+
var keyedRowsCompleteRuntimeFeature = {
|
|
2954
|
+
name: "keyed-rows:complete",
|
|
2955
|
+
create: (owner) => ({
|
|
2956
|
+
KeyedRows: createKeyedRowsBlockComponent(owner, {
|
|
2957
|
+
conditionals: createKeyedRowConditionalRuntime(),
|
|
2958
|
+
hostBlocks: createKeyedRowHostRuntime()
|
|
2959
|
+
})
|
|
2960
|
+
})
|
|
2961
|
+
};
|
|
2962
|
+
var keyedRangesRuntimeFeature = {
|
|
2963
|
+
name: "keyed-ranges",
|
|
2964
|
+
create: (owner) => ({
|
|
2965
|
+
KeyedRanges: createKeyedRangesBlockComponent(owner)
|
|
2966
|
+
})
|
|
2967
|
+
};
|
|
2968
|
+
var mixedRangesRuntimeFeature = {
|
|
2969
|
+
name: "mixed-ranges",
|
|
2970
|
+
create: (owner) => ({
|
|
2971
|
+
MixedRanges: createMixedRangesBlockComponent(owner)
|
|
2972
|
+
})
|
|
2973
|
+
};
|
|
2974
|
+
var componentRuntimeFeature = {
|
|
2975
|
+
name: "component",
|
|
2976
|
+
create: (owner) => ({
|
|
2977
|
+
Component: createComponentBlockComponent(owner)
|
|
2978
|
+
})
|
|
2979
|
+
};
|
|
2980
|
+
function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
2896
2981
|
const stateSignature = definition.stateSignature || String(definition.initialize.length);
|
|
2982
|
+
const runtimeSignature = [...new Set(runtimeFeatures.map((feature) => feature.name))].sort().join(",");
|
|
2897
2983
|
if (definition.hmrId) {
|
|
2898
2984
|
const registry = getCompilerHmrRegistry();
|
|
2899
2985
|
const existing = registry.get(definition.hmrId);
|
|
2900
|
-
if (existing?.stateSignature === stateSignature) {
|
|
2986
|
+
if (existing?.stateSignature === stateSignature && existing.runtimeSignature === runtimeSignature) {
|
|
2901
2987
|
existing.definition.current = definition;
|
|
2902
2988
|
existing.component.displayName = `FarmCompiled(${definition.displayName})`;
|
|
2903
2989
|
for (const refresh of existing.refreshListeners) refresh();
|
|
@@ -2971,34 +3057,17 @@ function createCompiledComponent(definition) {
|
|
|
2971
3057
|
}
|
|
2972
3058
|
};
|
|
2973
3059
|
});
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
HostConditional: createHostConditionalBlockComponent({
|
|
2980
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2981
|
-
}),
|
|
2982
|
-
ConditionalRanges: createConditionalRangesBlockComponent({
|
|
2983
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2984
|
-
}),
|
|
2985
|
-
KeyedList: createKeyedListBlockComponent({
|
|
2986
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2987
|
-
}),
|
|
2988
|
-
KeyedRows: createKeyedRowsBlockComponent({
|
|
2989
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2990
|
-
}),
|
|
2991
|
-
KeyedRanges: createKeyedRangesBlockComponent({
|
|
2992
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2993
|
-
}),
|
|
2994
|
-
MixedRanges: createMixedRangesBlockComponent({
|
|
2995
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2996
|
-
}),
|
|
2997
|
-
Component: createComponentBlockComponent({
|
|
2998
|
-
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
2999
|
-
}),
|
|
3060
|
+
const featureOwner = {
|
|
3061
|
+
setRoot: (id, root) => this.setBlockRoot(id, root),
|
|
3062
|
+
subscribe: (id, refresh) => this.subscribeToBlock(id, refresh)
|
|
3063
|
+
};
|
|
3064
|
+
const blockRuntime = {
|
|
3000
3065
|
target: (id) => this.bindingTarget(id)
|
|
3001
3066
|
};
|
|
3067
|
+
for (const feature of runtimeFeatures) {
|
|
3068
|
+
Object.assign(blockRuntime, feature.create(featureOwner));
|
|
3069
|
+
}
|
|
3070
|
+
this.blockRuntime = blockRuntime;
|
|
3002
3071
|
}
|
|
3003
3072
|
usesHybridReactivity() {
|
|
3004
3073
|
return definitionReference.current.reactivity === "hybrid";
|
|
@@ -3349,12 +3418,26 @@ function createCompiledComponent(definition) {
|
|
|
3349
3418
|
component,
|
|
3350
3419
|
definition: definitionReference,
|
|
3351
3420
|
refreshListeners,
|
|
3352
|
-
stateSignature
|
|
3421
|
+
stateSignature,
|
|
3422
|
+
runtimeSignature
|
|
3353
3423
|
});
|
|
3354
3424
|
}
|
|
3355
3425
|
return component;
|
|
3356
3426
|
}
|
|
3427
|
+
var COMPLETE_RUNTIME_FEATURES = [
|
|
3428
|
+
conditionalRuntimeFeature,
|
|
3429
|
+
hostConditionalRuntimeFeature,
|
|
3430
|
+
conditionalRangesRuntimeFeature,
|
|
3431
|
+
keyedListRuntimeFeature,
|
|
3432
|
+
keyedRowsCompleteRuntimeFeature,
|
|
3433
|
+
keyedRangesRuntimeFeature,
|
|
3434
|
+
mixedRangesRuntimeFeature,
|
|
3435
|
+
componentRuntimeFeature
|
|
3436
|
+
];
|
|
3437
|
+
function createCompiledComponent(definition) {
|
|
3438
|
+
return createCompiledComponentWithFeatures(definition, COMPLETE_RUNTIME_FEATURES);
|
|
3439
|
+
}
|
|
3357
3440
|
|
|
3358
|
-
export { createCompiledComponent };
|
|
3441
|
+
export { componentRuntimeFeature, conditionalRangesRuntimeFeature, conditionalRuntimeFeature, createCompiledComponent, createCompiledComponentWithFeatures, hostConditionalRuntimeFeature, keyedListRuntimeFeature, keyedRangesRuntimeFeature, keyedRowsCompleteRuntimeFeature, keyedRowsConditionalRuntimeFeature, keyedRowsHostRuntimeFeature, keyedRowsRuntimeFeature, mixedRangesRuntimeFeature };
|
|
3359
3442
|
//# sourceMappingURL=compiler-runtime.mjs.map
|
|
3360
3443
|
//# sourceMappingURL=compiler-runtime.mjs.map
|