@fictjs/runtime 0.2.1 → 0.2.2
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-7EAEROZ5.cjs → chunk-3A4VW6AK.cjs} +7 -7
- package/dist/{chunk-7EAEROZ5.cjs.map → chunk-3A4VW6AK.cjs.map} +1 -1
- package/dist/{chunk-MWI3USXB.cjs → chunk-3U7EBKEU.cjs} +5 -3
- package/dist/chunk-3U7EBKEU.cjs.map +1 -0
- package/dist/{chunk-7TPCESQS.js → chunk-LU2LD2WJ.js} +2 -2
- package/dist/{chunk-VVNMIER7.js → chunk-TEYUDPTA.js} +2 -2
- package/dist/{chunk-Z5WRKD7Y.cjs → chunk-URDFDRHR.cjs} +16 -16
- package/dist/{chunk-Z5WRKD7Y.cjs.map → chunk-URDFDRHR.cjs.map} +1 -1
- package/dist/{chunk-FOLRR3NZ.js → chunk-YVS4WJ2W.js} +5 -3
- package/dist/{chunk-FOLRR3NZ.js.map → chunk-YVS4WJ2W.js.map} +1 -1
- package/dist/index.cjs +38 -38
- package/dist/index.dev.js +4 -2
- package/dist/index.dev.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/internal.cjs +34 -34
- package/dist/internal.js +2 -2
- package/package.json +1 -1
- package/src/dom.ts +4 -1
- package/dist/chunk-MWI3USXB.cjs.map +0 -1
- /package/dist/{chunk-7TPCESQS.js.map → chunk-LU2LD2WJ.js.map} +0 -0
- /package/dist/{chunk-VVNMIER7.js.map → chunk-TEYUDPTA.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-TEYUDPTA.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-YVS4WJ2W.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 _chunk3A4VW6AKcjs = require('./chunk-3A4VW6AK.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -66,7 +66,7 @@ var _chunk7EAEROZ5cjs = require('./chunk-7EAEROZ5.cjs');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var _chunk3U7EBKEUcjs = require('./chunk-3U7EBKEU.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
|
+
_chunk3U7EBKEUcjs.batch.call(void 0, () => {
|
|
80
80
|
const result = fn(wrapped);
|
|
81
81
|
if (result !== void 0) {
|
|
82
82
|
reconcile(wrapped, result);
|
|
@@ -176,7 +176,7 @@ function track(target, prop2) {
|
|
|
176
176
|
let s = signals.get(prop2);
|
|
177
177
|
if (!s) {
|
|
178
178
|
const initial = prop2 === ITERATE_KEY ? Reflect.ownKeys(target).length : getLastValue(target, prop2);
|
|
179
|
-
s =
|
|
179
|
+
s = _chunk3U7EBKEUcjs.signal.call(void 0, initial);
|
|
180
180
|
signals.set(prop2, s);
|
|
181
181
|
}
|
|
182
182
|
s();
|
|
@@ -351,7 +351,7 @@ var MAX_SAFE_VERSION = 9007199254740991;
|
|
|
351
351
|
function createVersionedSignalAccessor(initialValue) {
|
|
352
352
|
let current = initialValue;
|
|
353
353
|
let version = 0;
|
|
354
|
-
const track2 =
|
|
354
|
+
const track2 = _chunk3U7EBKEUcjs.signal.call(void 0, version);
|
|
355
355
|
function accessor(value) {
|
|
356
356
|
if (arguments.length === 0) {
|
|
357
357
|
track2();
|
|
@@ -368,7 +368,7 @@ function createKeyedListContainer() {
|
|
|
368
368
|
const endMarker = document.createComment("fict:list:end");
|
|
369
369
|
const dispose = () => {
|
|
370
370
|
for (const block of container.blocks.values()) {
|
|
371
|
-
|
|
371
|
+
_chunk3U7EBKEUcjs.destroyRoot.call(void 0, block.root);
|
|
372
372
|
}
|
|
373
373
|
container.blocks.clear();
|
|
374
374
|
container.nextBlocks.clear();
|
|
@@ -407,32 +407,32 @@ function createKeyedListContainer() {
|
|
|
407
407
|
}
|
|
408
408
|
function createKeyedBlock(key, item, index, render, needsIndex = true, hostRoot) {
|
|
409
409
|
const itemSig = createVersionedSignalAccessor(item);
|
|
410
|
-
const indexSig = needsIndex ?
|
|
410
|
+
const indexSig = needsIndex ? _chunk3U7EBKEUcjs.signal.call(void 0, index) : ((next) => {
|
|
411
411
|
if (arguments.length === 0) return index;
|
|
412
412
|
index = next;
|
|
413
413
|
return index;
|
|
414
414
|
});
|
|
415
|
-
const root =
|
|
416
|
-
const prevRoot =
|
|
415
|
+
const root = _chunk3U7EBKEUcjs.createRootContext.call(void 0, hostRoot);
|
|
416
|
+
const prevRoot = _chunk3U7EBKEUcjs.pushRoot.call(void 0, root);
|
|
417
417
|
let nodes = [];
|
|
418
418
|
let scopeDispose;
|
|
419
|
-
const prevSub =
|
|
419
|
+
const prevSub = _chunk3U7EBKEUcjs.setActiveSub.call(void 0, void 0);
|
|
420
420
|
try {
|
|
421
|
-
scopeDispose =
|
|
421
|
+
scopeDispose = _chunk3U7EBKEUcjs.effectScope.call(void 0, () => {
|
|
422
422
|
const rendered = render(itemSig, indexSig, key);
|
|
423
423
|
if (rendered instanceof Node || Array.isArray(rendered) && rendered.every((n) => n instanceof Node)) {
|
|
424
|
-
nodes =
|
|
424
|
+
nodes = _chunk3U7EBKEUcjs.toNodeArray.call(void 0, rendered);
|
|
425
425
|
} else {
|
|
426
|
-
const element =
|
|
427
|
-
nodes =
|
|
426
|
+
const element = _chunk3U7EBKEUcjs.createElement.call(void 0, rendered);
|
|
427
|
+
nodes = _chunk3U7EBKEUcjs.toNodeArray.call(void 0, element);
|
|
428
428
|
}
|
|
429
429
|
});
|
|
430
430
|
if (scopeDispose) {
|
|
431
431
|
root.cleanups.push(scopeDispose);
|
|
432
432
|
}
|
|
433
433
|
} finally {
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
_chunk3U7EBKEUcjs.setActiveSub.call(void 0, prevSub);
|
|
435
|
+
_chunk3U7EBKEUcjs.popRoot.call(void 0, prevRoot);
|
|
436
436
|
}
|
|
437
437
|
return {
|
|
438
438
|
key,
|
|
@@ -538,7 +538,7 @@ function createKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
538
538
|
}
|
|
539
539
|
function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
540
540
|
const container = createKeyedListContainer();
|
|
541
|
-
const hostRoot =
|
|
541
|
+
const hostRoot = _chunk3U7EBKEUcjs.getCurrentRoot.call(void 0, );
|
|
542
542
|
const fragment = document.createDocumentFragment();
|
|
543
543
|
fragment.append(container.startMarker, container.endMarker);
|
|
544
544
|
let disposed = false;
|
|
@@ -560,7 +560,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
560
560
|
if (disposed) return;
|
|
561
561
|
const parent = getConnectedParent();
|
|
562
562
|
if (!parent) return;
|
|
563
|
-
|
|
563
|
+
_chunk3U7EBKEUcjs.batch2.call(void 0, () => {
|
|
564
564
|
const oldBlocks = container.blocks;
|
|
565
565
|
const newBlocks = container.nextBlocks;
|
|
566
566
|
const prevOrderedBlocks = container.orderedBlocks;
|
|
@@ -570,7 +570,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
570
570
|
if (newItems.length === 0) {
|
|
571
571
|
if (oldBlocks.size > 0) {
|
|
572
572
|
for (const block of oldBlocks.values()) {
|
|
573
|
-
|
|
573
|
+
_chunk3U7EBKEUcjs.destroyRoot.call(void 0, block.root);
|
|
574
574
|
}
|
|
575
575
|
const range = document.createRange();
|
|
576
576
|
range.setStartAfter(container.startMarker);
|
|
@@ -651,8 +651,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
651
651
|
`[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.`
|
|
652
652
|
);
|
|
653
653
|
}
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
_chunk3U7EBKEUcjs.destroyRoot.call(void 0, existingBlock.root);
|
|
655
|
+
_chunk3U7EBKEUcjs.removeNodes.call(void 0, existingBlock.nodes);
|
|
656
656
|
}
|
|
657
657
|
block = createKeyedBlock(key, item, index, renderItem, needsIndex, hostRoot);
|
|
658
658
|
createdBlocks.push(block);
|
|
@@ -665,8 +665,8 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
665
665
|
hasDuplicateKey = true;
|
|
666
666
|
const prior = nextOrderedBlocks[position];
|
|
667
667
|
if (prior && prior !== resolvedBlock) {
|
|
668
|
-
|
|
669
|
-
|
|
668
|
+
_chunk3U7EBKEUcjs.destroyRoot.call(void 0, prior.root);
|
|
669
|
+
_chunk3U7EBKEUcjs.removeNodes.call(void 0, prior.nodes);
|
|
670
670
|
}
|
|
671
671
|
nextOrderedBlocks[position] = resolvedBlock;
|
|
672
672
|
} else {
|
|
@@ -704,7 +704,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
if (appendedNodes.length > 0) {
|
|
707
|
-
|
|
707
|
+
_chunk3U7EBKEUcjs.insertNodesBefore.call(void 0, parent, appendedNodes, container.endMarker);
|
|
708
708
|
const currentNodes = container.currentNodes;
|
|
709
709
|
currentNodes.pop();
|
|
710
710
|
for (let i = 0; i < appendedNodes.length; i++) {
|
|
@@ -718,15 +718,15 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
718
718
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
719
719
|
for (const block of createdBlocks) {
|
|
720
720
|
if (newBlocks.get(block.key) === block) {
|
|
721
|
-
|
|
721
|
+
_chunk3U7EBKEUcjs.flushOnMount.call(void 0, block.root);
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
return;
|
|
725
725
|
}
|
|
726
726
|
if (oldBlocks.size > 0) {
|
|
727
727
|
for (const block of oldBlocks.values()) {
|
|
728
|
-
|
|
729
|
-
|
|
728
|
+
_chunk3U7EBKEUcjs.destroyRoot.call(void 0, block.root);
|
|
729
|
+
_chunk3U7EBKEUcjs.removeNodes.call(void 0, block.nodes);
|
|
730
730
|
}
|
|
731
731
|
oldBlocks.clear();
|
|
732
732
|
}
|
|
@@ -785,7 +785,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
785
785
|
container.nextOrderedBlocks = prevOrderedBlocks;
|
|
786
786
|
for (const block of createdBlocks) {
|
|
787
787
|
if (newBlocks.get(block.key) === block) {
|
|
788
|
-
|
|
788
|
+
_chunk3U7EBKEUcjs.flushOnMount.call(void 0, block.root);
|
|
789
789
|
}
|
|
790
790
|
}
|
|
791
791
|
});
|
|
@@ -799,15 +799,15 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
799
799
|
const parent = getConnectedParent();
|
|
800
800
|
if (!parent) return false;
|
|
801
801
|
const start = () => {
|
|
802
|
-
effectDispose =
|
|
802
|
+
effectDispose = _chunk3U7EBKEUcjs.createRenderEffect.call(void 0, performDiff);
|
|
803
803
|
effectStarted = true;
|
|
804
804
|
};
|
|
805
805
|
if (hostRoot) {
|
|
806
|
-
const prev =
|
|
806
|
+
const prev = _chunk3U7EBKEUcjs.pushRoot.call(void 0, hostRoot);
|
|
807
807
|
try {
|
|
808
808
|
start();
|
|
809
809
|
} finally {
|
|
810
|
-
|
|
810
|
+
_chunk3U7EBKEUcjs.popRoot.call(void 0, prev);
|
|
811
811
|
}
|
|
812
812
|
} else {
|
|
813
813
|
start();
|
|
@@ -821,7 +821,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
821
821
|
if (getConnectedParent()) {
|
|
822
822
|
disconnectObserver();
|
|
823
823
|
if (ensureEffectStarted()) {
|
|
824
|
-
|
|
824
|
+
_chunk3U7EBKEUcjs.flush.call(void 0, );
|
|
825
825
|
}
|
|
826
826
|
}
|
|
827
827
|
});
|
|
@@ -855,7 +855,7 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
855
855
|
if (disposed) return;
|
|
856
856
|
scheduleStart();
|
|
857
857
|
if (ensureEffectStarted()) {
|
|
858
|
-
|
|
858
|
+
_chunk3U7EBKEUcjs.flush.call(void 0, );
|
|
859
859
|
} else {
|
|
860
860
|
waitForConnection();
|
|
861
861
|
}
|
|
@@ -928,5 +928,5 @@ function createFineGrainedKeyedList(getItems, keyFn, renderItem, needsIndex) {
|
|
|
928
928
|
|
|
929
929
|
|
|
930
930
|
|
|
931
|
-
exports.Aliases =
|
|
931
|
+
exports.Aliases = _chunk3U7EBKEUcjs.Aliases; exports.BooleanAttributes = _chunk3U7EBKEUcjs.BooleanAttributes; exports.ChildProperties = _chunk3U7EBKEUcjs.ChildProperties; exports.DelegatedEvents = _chunk3U7EBKEUcjs.DelegatedEvents; exports.Fragment = _chunk3U7EBKEUcjs.Fragment; exports.Properties = _chunk3U7EBKEUcjs.Properties; exports.SVGElements = _chunk3U7EBKEUcjs.SVGElements; exports.SVGNamespace = _chunk3U7EBKEUcjs.SVGNamespace; exports.UnitlessStyles = _chunk3U7EBKEUcjs.UnitlessStyles; exports.__fictPopContext = _chunk3U7EBKEUcjs.__fictPopContext; exports.__fictProp = _chunk3U7EBKEUcjs.__fictProp; exports.__fictPropsRest = _chunk3U7EBKEUcjs.__fictPropsRest; exports.__fictPushContext = _chunk3U7EBKEUcjs.__fictPushContext; exports.__fictRender = _chunk3U7EBKEUcjs.__fictRender; exports.__fictResetContext = _chunk3U7EBKEUcjs.__fictResetContext; exports.__fictUseContext = _chunk3U7EBKEUcjs.__fictUseContext; exports.__fictUseEffect = _chunk3U7EBKEUcjs.__fictUseEffect; exports.__fictUseMemo = _chunk3U7EBKEUcjs.__fictUseMemo; exports.__fictUseSignal = _chunk3U7EBKEUcjs.__fictUseSignal; exports.addEventListener = _chunk3U7EBKEUcjs.addEventListener; exports.assign = _chunk3U7EBKEUcjs.assign; exports.bindAttribute = _chunk3U7EBKEUcjs.bindAttribute; exports.bindClass = _chunk3U7EBKEUcjs.bindClass; exports.bindEvent = _chunk3U7EBKEUcjs.bindEvent; exports.bindProperty = _chunk3U7EBKEUcjs.bindProperty; exports.bindRef = _chunk3U7EBKEUcjs.bindRef; exports.bindStyle = _chunk3U7EBKEUcjs.bindStyle; exports.bindText = _chunk3U7EBKEUcjs.bindText; exports.callEventHandler = _chunk3U7EBKEUcjs.callEventHandler; exports.classList = _chunk3U7EBKEUcjs.classList; exports.clearDelegatedEvents = _chunk3U7EBKEUcjs.clearDelegatedEvents; exports.createConditional = _chunk3U7EBKEUcjs.createConditional; exports.createEffect = _chunk3U7EBKEUcjs.createEffect; exports.createElement = _chunk3U7EBKEUcjs.createElement; exports.createKeyedList = createKeyedList; exports.createMemo = _chunk3U7EBKEUcjs.createMemo; exports.createPortal = _chunk3U7EBKEUcjs.createPortal; exports.createPropsProxy = _chunk3U7EBKEUcjs.createPropsProxy; exports.createRenderEffect = _chunk3U7EBKEUcjs.createRenderEffect; exports.createSelector = _chunk3U7EBKEUcjs.createSelector; exports.createSignal = _chunk3U7EBKEUcjs.signal; exports.createStore = createStore; exports.delegateEvents = _chunk3U7EBKEUcjs.delegateEvents; exports.getPropAlias = _chunk3U7EBKEUcjs.getPropAlias; exports.insert = _chunk3U7EBKEUcjs.insert; exports.insertNodesBefore = _chunk3U7EBKEUcjs.insertNodesBefore; exports.isNodeBetweenMarkers = isNodeBetweenMarkers; exports.isReactive = _chunk3U7EBKEUcjs.isReactive; exports.mergeProps = _chunk3U7EBKEUcjs.mergeProps; exports.moveNodesBefore = moveNodesBefore; exports.onDestroy = _chunk3U7EBKEUcjs.onDestroy; exports.prop = _chunk3U7EBKEUcjs.prop; exports.reconcileArrays = reconcileArrays; exports.removeNodes = _chunk3U7EBKEUcjs.removeNodes; exports.runInScope = _chunk3A4VW6AKcjs.runInScope; exports.spread = _chunk3U7EBKEUcjs.spread; exports.template = _chunk3U7EBKEUcjs.template; exports.toNodeArray = _chunk3U7EBKEUcjs.toNodeArray; exports.unwrap = _chunk3U7EBKEUcjs.unwrap;
|
|
932
932
|
//# sourceMappingURL=internal.cjs.map
|
package/dist/internal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runInScope
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LU2LD2WJ.js";
|
|
4
4
|
import {
|
|
5
5
|
Aliases,
|
|
6
6
|
BooleanAttributes,
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
template,
|
|
67
67
|
toNodeArray,
|
|
68
68
|
unwrap
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-YVS4WJ2W.js";
|
|
70
70
|
|
|
71
71
|
// src/store.ts
|
|
72
72
|
var PROXY = Symbol("fict:store-proxy");
|
package/package.json
CHANGED
package/src/dom.ts
CHANGED
|
@@ -687,7 +687,10 @@ const setProperty: AttributeSetter = (el: Element, key: string, value: unknown):
|
|
|
687
687
|
* Set innerHTML on an element (used for dangerouslySetInnerHTML)
|
|
688
688
|
*/
|
|
689
689
|
const setInnerHTML: AttributeSetter = (el: Element, _key: string, value: unknown): void => {
|
|
690
|
-
|
|
690
|
+
const next = value == null ? '' : String(value)
|
|
691
|
+
const node = el as HTMLElement
|
|
692
|
+
if (node.innerHTML === next) return
|
|
693
|
+
node.innerHTML = next
|
|
691
694
|
}
|
|
692
695
|
|
|
693
696
|
/**
|