@fictjs/runtime 0.0.14 → 0.1.0
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/advanced.cjs +8 -8
- package/dist/advanced.js +3 -3
- package/dist/{chunk-PMF6MWEV.cjs → chunk-7WAGAQLT.cjs} +45 -24
- package/dist/chunk-7WAGAQLT.cjs.map +1 -0
- package/dist/{chunk-RY4WDS6R.js → chunk-BWZFJXUI.js} +32 -11
- package/dist/chunk-BWZFJXUI.js.map +1 -0
- package/dist/{chunk-F3AIYQB7.js → chunk-CF3OHML2.js} +3 -3
- package/dist/chunk-CF3OHML2.js.map +1 -0
- package/dist/{chunk-GJTYOFMO.cjs → chunk-Q4EN6BXV.cjs} +16 -16
- package/dist/{chunk-GJTYOFMO.cjs.map → chunk-Q4EN6BXV.cjs.map} +1 -1
- package/dist/{chunk-IUZXKAAY.js → chunk-V62XZLDU.js} +2 -2
- package/dist/{chunk-624QY53A.cjs → chunk-YQ4IB7NC.cjs} +7 -7
- package/dist/chunk-YQ4IB7NC.cjs.map +1 -0
- package/dist/index.cjs +44 -44
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.dev.js +30 -9
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.cjs +44 -35
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +6 -1
- package/dist/internal.d.ts +6 -1
- package/dist/internal.js +12 -3
- package/dist/internal.js.map +1 -1
- package/dist/{props-ES0Ag_Wd.d.ts → props-BBi8Tkks.d.ts} +9 -2
- package/dist/{props-CrOMYbLv.d.cts → props-BfmSLuyp.d.cts} +9 -2
- package/package.json +1 -1
- package/src/binding.ts +4 -3
- package/src/constants.ts +2 -3
- package/src/dev-entry.ts +22 -0
- package/src/lifecycle.ts +11 -3
- package/src/list-helpers.ts +14 -3
- package/src/props.ts +29 -3
- package/src/scope.ts +1 -1
- package/dist/chunk-624QY53A.cjs.map +0 -1
- package/dist/chunk-F3AIYQB7.js.map +0 -1
- package/dist/chunk-PMF6MWEV.cjs.map +0 -1
- package/dist/chunk-RY4WDS6R.js.map +0 -1
- /package/dist/{chunk-IUZXKAAY.js.map → chunk-V62XZLDU.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createContext,
|
|
3
3
|
hasContext,
|
|
4
4
|
useContext
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-V62XZLDU.js";
|
|
6
6
|
import {
|
|
7
7
|
Fragment,
|
|
8
8
|
batch2 as batch,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
untrack2 as untrack,
|
|
35
35
|
useDeferredValue,
|
|
36
36
|
useTransition
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-BWZFJXUI.js";
|
|
38
38
|
|
|
39
39
|
// src/ref.ts
|
|
40
40
|
function createRef() {
|
package/dist/internal.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkYQ4IB7NCcjs = require('./chunk-YQ4IB7NC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -66,7 +66,7 @@ var _chunk624QY53Acjs = require('./chunk-624QY53A.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var _chunk7WAGAQLTcjs = require('./chunk-7WAGAQLT.cjs');
|
|
70
70
|
|
|
71
71
|
// src/store.ts
|
|
72
72
|
var PROXY = Symbol("fict:store-proxy");
|
|
@@ -76,7 +76,7 @@ function createStore(initialValue) {
|
|
|
76
76
|
const unwrapped = unwrap2(initialValue);
|
|
77
77
|
const wrapped = wrap(unwrapped);
|
|
78
78
|
function setStore(fn) {
|
|
79
|
-
|
|
79
|
+
_chunk7WAGAQLTcjs.batch.call(void 0, () => {
|
|
80
80
|
const result = fn(wrapped);
|
|
81
81
|
if (result !== void 0) {
|
|
82
82
|
reconcile(wrapped, result);
|
|
@@ -157,7 +157,7 @@ function track(target, prop2) {
|
|
|
157
157
|
let s = signals.get(prop2);
|
|
158
158
|
if (!s) {
|
|
159
159
|
const initial = prop2 === ITERATE_KEY ? Reflect.ownKeys(target).length : getLastValue(target, prop2);
|
|
160
|
-
s =
|
|
160
|
+
s = _chunk7WAGAQLTcjs.signal.call(void 0, initial);
|
|
161
161
|
signals.set(prop2, s);
|
|
162
162
|
}
|
|
163
163
|
s();
|
|
@@ -308,6 +308,13 @@ function moveNodesBefore(parent, nodes, anchor) {
|
|
|
308
308
|
try {
|
|
309
309
|
const clone = parent.ownerDocument.importNode(node, true);
|
|
310
310
|
parent.insertBefore(clone, anchor);
|
|
311
|
+
nodes[i] = clone;
|
|
312
|
+
if (isDev) {
|
|
313
|
+
console.warn(
|
|
314
|
+
`[fict] Node cloning fallback triggered during list reordering. This may indicate cross-document node insertion. The node reference has been updated to the clone.`
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
anchor = clone;
|
|
311
318
|
continue;
|
|
312
319
|
} catch (e2) {
|
|
313
320
|
}
|
|
@@ -322,7 +329,7 @@ var MAX_SAFE_VERSION = 9007199254740991;
|
|
|
322
329
|
function createVersionedSignalAccessor(initialValue) {
|
|
323
330
|
let current = initialValue;
|
|
324
331
|
let version = 0;
|
|
325
|
-
const track2 =
|
|
332
|
+
const track2 = _chunk7WAGAQLTcjs.signal.call(void 0, version);
|
|
326
333
|
function accessor(value) {
|
|
327
334
|
if (arguments.length === 0) {
|
|
328
335
|
track2();
|
|
@@ -339,7 +346,7 @@ function createKeyedListContainer() {
|
|
|
339
346
|
const endMarker = document.createComment("fict:list:end");
|
|
340
347
|
const dispose = () => {
|
|
341
348
|
for (const block of container.blocks.values()) {
|
|
342
|
-
|
|
349
|
+
_chunk7WAGAQLTcjs.destroyRoot.call(void 0, block.root);
|
|
343
350
|
}
|
|
344
351
|
container.blocks.clear();
|
|
345
352
|
container.nextBlocks.clear();
|
|
@@ -378,32 +385,32 @@ function createKeyedListContainer() {
|
|
|
378
385
|
}
|
|
379
386
|
function createKeyedBlock(key, item, index, render, needsIndex = true, hostRoot) {
|
|
380
387
|
const itemSig = createVersionedSignalAccessor(item);
|
|
381
|
-
const indexSig = needsIndex ?
|
|
388
|
+
const indexSig = needsIndex ? _chunk7WAGAQLTcjs.signal.call(void 0, index) : ((next) => {
|
|
382
389
|
if (arguments.length === 0) return index;
|
|
383
390
|
index = next;
|
|
384
391
|
return index;
|
|
385
392
|
});
|
|
386
|
-
const root =
|
|
387
|
-
const prevRoot =
|
|
393
|
+
const root = _chunk7WAGAQLTcjs.createRootContext.call(void 0, hostRoot);
|
|
394
|
+
const prevRoot = _chunk7WAGAQLTcjs.pushRoot.call(void 0, root);
|
|
388
395
|
let nodes = [];
|
|
389
396
|
let scopeDispose;
|
|
390
|
-
const prevSub =
|
|
397
|
+
const prevSub = _chunk7WAGAQLTcjs.setActiveSub.call(void 0, void 0);
|
|
391
398
|
try {
|
|
392
|
-
scopeDispose =
|
|
399
|
+
scopeDispose = _chunk7WAGAQLTcjs.effectScope.call(void 0, () => {
|
|
393
400
|
const rendered = render(itemSig, indexSig, key);
|
|
394
401
|
if (rendered instanceof Node || Array.isArray(rendered) && rendered.every((n) => n instanceof Node)) {
|
|
395
|
-
nodes =
|
|
402
|
+
nodes = _chunk7WAGAQLTcjs.toNodeArray.call(void 0, rendered);
|
|
396
403
|
} else {
|
|
397
|
-
const element =
|
|
398
|
-
nodes =
|
|
404
|
+
const element = _chunk7WAGAQLTcjs.createElement.call(void 0, rendered);
|
|
405
|
+
nodes = _chunk7WAGAQLTcjs.toNodeArray.call(void 0, element);
|
|
399
406
|
}
|
|
400
407
|
});
|
|
401
408
|
if (scopeDispose) {
|
|
402
409
|
root.cleanups.push(scopeDispose);
|
|
403
410
|
}
|
|
404
411
|
} finally {
|
|
405
|
-
|
|
406
|
-
|
|
412
|
+
_chunk7WAGAQLTcjs.setActiveSub.call(void 0, prevSub);
|
|
413
|
+
_chunk7WAGAQLTcjs.popRoot.call(void 0, prevRoot);
|
|
407
414
|
}
|
|
408
415
|
return {
|
|
409
416
|
key,
|
|
@@ -509,7 +516,7 @@ function createKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
509
516
|
}
|
|
510
517
|
function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
511
518
|
const container = createKeyedListContainer();
|
|
512
|
-
const hostRoot =
|
|
519
|
+
const hostRoot = _chunk7WAGAQLTcjs.getCurrentRoot.call(void 0, );
|
|
513
520
|
const fragment = document.createDocumentFragment();
|
|
514
521
|
fragment.append(container.startMarker, container.endMarker);
|
|
515
522
|
let disposed = false;
|
|
@@ -521,7 +528,9 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
521
528
|
const endParent = container.endMarker.parentNode;
|
|
522
529
|
const startParent = container.startMarker.parentNode;
|
|
523
530
|
if (endParent && startParent && endParent === startParent && endParent.nodeType !== 11) {
|
|
524
|
-
|
|
531
|
+
const parentNode = endParent;
|
|
532
|
+
if ("isConnected" in parentNode && !parentNode.isConnected) return null;
|
|
533
|
+
return parentNode;
|
|
525
534
|
}
|
|
526
535
|
return null;
|
|
527
536
|
};
|
|
@@ -529,7 +538,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
529
538
|
if (disposed) return;
|
|
530
539
|
const parent = getConnectedParent();
|
|
531
540
|
if (!parent) return;
|
|
532
|
-
|
|
541
|
+
_chunk7WAGAQLTcjs.batch2.call(void 0, () => {
|
|
533
542
|
const oldBlocks = container.blocks;
|
|
534
543
|
const newBlocks = container.nextBlocks;
|
|
535
544
|
const prevOrderedBlocks = container.orderedBlocks;
|
|
@@ -539,7 +548,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
539
548
|
if (newItems.length === 0) {
|
|
540
549
|
if (oldBlocks.size > 0) {
|
|
541
550
|
for (const block of oldBlocks.values()) {
|
|
542
|
-
|
|
551
|
+
_chunk7WAGAQLTcjs.destroyRoot.call(void 0, block.root);
|
|
543
552
|
}
|
|
544
553
|
const range = document.createRange();
|
|
545
554
|
range.setStartAfter(container.startMarker);
|
|
@@ -620,8 +629,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
620
629
|
`[fict] Duplicate key "${String(key)}" detected in list rendering. Each item should have a unique key. The previous item with this key will be replaced.`
|
|
621
630
|
);
|
|
622
631
|
}
|
|
623
|
-
|
|
624
|
-
|
|
632
|
+
_chunk7WAGAQLTcjs.destroyRoot.call(void 0, existingBlock.root);
|
|
633
|
+
_chunk7WAGAQLTcjs.removeNodes.call(void 0, existingBlock.nodes);
|
|
625
634
|
}
|
|
626
635
|
block = createKeyedBlock(key, item, index, renderItem, needsIndex, hostRoot);
|
|
627
636
|
createdBlocks.push(block);
|
|
@@ -634,8 +643,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
634
643
|
hasDuplicateKey = true;
|
|
635
644
|
const prior = nextOrderedBlocks[position];
|
|
636
645
|
if (prior && prior !== resolvedBlock) {
|
|
637
|
-
|
|
638
|
-
|
|
646
|
+
_chunk7WAGAQLTcjs.destroyRoot.call(void 0, prior.root);
|
|
647
|
+
_chunk7WAGAQLTcjs.removeNodes.call(void 0, prior.nodes);
|
|
639
648
|
}
|
|
640
649
|
nextOrderedBlocks[position] = resolvedBlock;
|
|
641
650
|
} else {
|
|
@@ -673,7 +682,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
673
682
|
}
|
|
674
683
|
}
|
|
675
684
|
if (appendedNodes.length > 0) {
|
|
676
|
-
|
|
685
|
+
_chunk7WAGAQLTcjs.insertNodesBefore.call(void 0, parent, appendedNodes, container.endMarker);
|
|
677
686
|
const currentNodes = container.currentNodes;
|
|
678
687
|
currentNodes.pop();
|
|
679
688
|
for (let i = 0; i < appendedNodes.length; i++) {
|
|
@@ -687,15 +696,15 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
687
696
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
688
697
|
for (const block of createdBlocks) {
|
|
689
698
|
if (newBlocks.get(block.key) === block) {
|
|
690
|
-
|
|
699
|
+
_chunk7WAGAQLTcjs.flushOnMount.call(void 0, block.root);
|
|
691
700
|
}
|
|
692
701
|
}
|
|
693
702
|
return;
|
|
694
703
|
}
|
|
695
704
|
if (oldBlocks.size > 0) {
|
|
696
705
|
for (const block of oldBlocks.values()) {
|
|
697
|
-
|
|
698
|
-
|
|
706
|
+
_chunk7WAGAQLTcjs.destroyRoot.call(void 0, block.root);
|
|
707
|
+
_chunk7WAGAQLTcjs.removeNodes.call(void 0, block.nodes);
|
|
699
708
|
}
|
|
700
709
|
oldBlocks.clear();
|
|
701
710
|
}
|
|
@@ -754,7 +763,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
754
763
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
755
764
|
for (const block of createdBlocks) {
|
|
756
765
|
if (newBlocks.get(block.key) === block) {
|
|
757
|
-
|
|
766
|
+
_chunk7WAGAQLTcjs.flushOnMount.call(void 0, block.root);
|
|
758
767
|
}
|
|
759
768
|
}
|
|
760
769
|
});
|
|
@@ -768,15 +777,15 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
768
777
|
const parent = getConnectedParent();
|
|
769
778
|
if (!parent) return false;
|
|
770
779
|
const start = () => {
|
|
771
|
-
effectDispose =
|
|
780
|
+
effectDispose = _chunk7WAGAQLTcjs.createRenderEffect.call(void 0, performDiff);
|
|
772
781
|
effectStarted = true;
|
|
773
782
|
};
|
|
774
783
|
if (hostRoot) {
|
|
775
|
-
const prev =
|
|
784
|
+
const prev = _chunk7WAGAQLTcjs.pushRoot.call(void 0, hostRoot);
|
|
776
785
|
try {
|
|
777
786
|
start();
|
|
778
787
|
} finally {
|
|
779
|
-
|
|
788
|
+
_chunk7WAGAQLTcjs.popRoot.call(void 0, prev);
|
|
780
789
|
}
|
|
781
790
|
} else {
|
|
782
791
|
start();
|
|
@@ -790,7 +799,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
790
799
|
if (getConnectedParent()) {
|
|
791
800
|
disconnectObserver();
|
|
792
801
|
if (ensureEffectStarted()) {
|
|
793
|
-
|
|
802
|
+
_chunk7WAGAQLTcjs.flush.call(void 0, );
|
|
794
803
|
}
|
|
795
804
|
}
|
|
796
805
|
});
|
|
@@ -824,7 +833,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
824
833
|
if (disposed) return;
|
|
825
834
|
scheduleStart();
|
|
826
835
|
if (ensureEffectStarted()) {
|
|
827
|
-
|
|
836
|
+
_chunk7WAGAQLTcjs.flush.call(void 0, );
|
|
828
837
|
} else {
|
|
829
838
|
waitForConnection();
|
|
830
839
|
}
|
|
@@ -897,5 +906,5 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
897
906
|
|
|
898
907
|
|
|
899
908
|
|
|
900
|
-
exports.Aliases =
|
|
909
|
+
exports.Aliases = _chunk7WAGAQLTcjs.Aliases; exports.BooleanAttributes = _chunk7WAGAQLTcjs.BooleanAttributes; exports.ChildProperties = _chunk7WAGAQLTcjs.ChildProperties; exports.DelegatedEvents = _chunk7WAGAQLTcjs.DelegatedEvents; exports.Fragment = _chunk7WAGAQLTcjs.Fragment; exports.Properties = _chunk7WAGAQLTcjs.Properties; exports.SVGElements = _chunk7WAGAQLTcjs.SVGElements; exports.SVGNamespace = _chunk7WAGAQLTcjs.SVGNamespace; exports.UnitlessStyles = _chunk7WAGAQLTcjs.UnitlessStyles; exports.__fictPopContext = _chunk7WAGAQLTcjs.__fictPopContext; exports.__fictProp = _chunk7WAGAQLTcjs.__fictProp; exports.__fictPropsRest = _chunk7WAGAQLTcjs.__fictPropsRest; exports.__fictPushContext = _chunk7WAGAQLTcjs.__fictPushContext; exports.__fictRender = _chunk7WAGAQLTcjs.__fictRender; exports.__fictResetContext = _chunk7WAGAQLTcjs.__fictResetContext; exports.__fictUseContext = _chunk7WAGAQLTcjs.__fictUseContext; exports.__fictUseEffect = _chunk7WAGAQLTcjs.__fictUseEffect; exports.__fictUseMemo = _chunk7WAGAQLTcjs.__fictUseMemo; exports.__fictUseSignal = _chunk7WAGAQLTcjs.__fictUseSignal; exports.addEventListener = _chunk7WAGAQLTcjs.addEventListener; exports.assign = _chunk7WAGAQLTcjs.assign; exports.bindAttribute = _chunk7WAGAQLTcjs.bindAttribute; exports.bindClass = _chunk7WAGAQLTcjs.bindClass; exports.bindEvent = _chunk7WAGAQLTcjs.bindEvent; exports.bindProperty = _chunk7WAGAQLTcjs.bindProperty; exports.bindRef = _chunk7WAGAQLTcjs.bindRef; exports.bindStyle = _chunk7WAGAQLTcjs.bindStyle; exports.bindText = _chunk7WAGAQLTcjs.bindText; exports.callEventHandler = _chunk7WAGAQLTcjs.callEventHandler; exports.classList = _chunk7WAGAQLTcjs.classList; exports.clearDelegatedEvents = _chunk7WAGAQLTcjs.clearDelegatedEvents; exports.createConditional = _chunk7WAGAQLTcjs.createConditional; exports.createEffect = _chunk7WAGAQLTcjs.createEffect; exports.createElement = _chunk7WAGAQLTcjs.createElement; exports.createKeyedList = createKeyedList; exports.createMemo = _chunk7WAGAQLTcjs.createMemo; exports.createPortal = _chunk7WAGAQLTcjs.createPortal; exports.createPropsProxy = _chunk7WAGAQLTcjs.createPropsProxy; exports.createRenderEffect = _chunk7WAGAQLTcjs.createRenderEffect; exports.createSelector = _chunk7WAGAQLTcjs.createSelector; exports.createSignal = _chunk7WAGAQLTcjs.signal; exports.createStore = createStore; exports.delegateEvents = _chunk7WAGAQLTcjs.delegateEvents; exports.getPropAlias = _chunk7WAGAQLTcjs.getPropAlias; exports.insert = _chunk7WAGAQLTcjs.insert; exports.insertNodesBefore = _chunk7WAGAQLTcjs.insertNodesBefore; exports.isNodeBetweenMarkers = isNodeBetweenMarkers; exports.isReactive = _chunk7WAGAQLTcjs.isReactive; exports.mergeProps = _chunk7WAGAQLTcjs.mergeProps; exports.moveNodesBefore = moveNodesBefore; exports.onDestroy = _chunk7WAGAQLTcjs.onDestroy; exports.prop = _chunk7WAGAQLTcjs.prop; exports.reconcileArrays = reconcileArrays; exports.removeNodes = _chunk7WAGAQLTcjs.removeNodes; exports.runInScope = _chunkYQ4IB7NCcjs.runInScope; exports.spread = _chunk7WAGAQLTcjs.spread; exports.template = _chunk7WAGAQLTcjs.template; exports.toNodeArray = _chunk7WAGAQLTcjs.toNodeArray; exports.unwrap = _chunk7WAGAQLTcjs.unwrap;
|
|
901
910
|
//# sourceMappingURL=internal.cjs.map
|