marko 6.0.0-next.3.22 → 6.0.0-next.3.23
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/common/for.d.ts +3 -4
- package/dist/common/types.d.ts +18 -17
- package/dist/debug/dom.js +696 -740
- package/dist/debug/dom.mjs +696 -740
- package/dist/debug/html.js +256 -99
- package/dist/debug/html.mjs +247 -95
- package/dist/dom/abort-signal.d.ts +1 -1
- package/dist/dom/compat.d.ts +1 -0
- package/dist/dom/control-flow.d.ts +6 -8
- package/dist/dom/queue.d.ts +4 -2
- package/dist/dom/reconcile.d.ts +2 -2
- package/dist/dom/renderer.d.ts +7 -8
- package/dist/dom/resume.d.ts +3 -3
- package/dist/dom/scope.d.ts +4 -4
- package/dist/dom/signals.d.ts +13 -26
- package/dist/dom/template.d.ts +2 -2
- package/dist/dom.d.ts +2 -2
- package/dist/dom.js +441 -482
- package/dist/dom.mjs +441 -482
- package/dist/html/dynamic-tag.d.ts +3 -3
- package/dist/html/writer.d.ts +12 -12
- package/dist/html.d.ts +1 -1
- package/dist/html.js +202 -65
- package/dist/html.mjs +193 -61
- package/dist/translator/core/for.d.ts +0 -2
- package/dist/translator/index.js +189 -224
- package/dist/translator/util/runtime.d.ts +1 -2
- package/dist/translator/util/sections.d.ts +2 -1
- package/dist/translator/util/signals.d.ts +2 -2
- package/package.json +2 -2
- package/tags-html.d.ts +152 -152
package/dist/debug/html.mjs
CHANGED
@@ -104,6 +104,28 @@ function escapeStyle(val) {
|
|
104
104
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
105
105
|
}
|
106
106
|
|
107
|
+
// src/common/for.ts
|
108
|
+
function forIn(obj, cb) {
|
109
|
+
for (const key in obj) {
|
110
|
+
cb(key, obj[key]);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
function forOf(list, cb) {
|
114
|
+
if (list) {
|
115
|
+
let i = 0;
|
116
|
+
for (const item of list) {
|
117
|
+
cb(item, i++);
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
function forTo(to, from, step, cb) {
|
122
|
+
const start = from || 0;
|
123
|
+
const delta = step || 1;
|
124
|
+
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
125
|
+
cb(start + i * delta);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
107
129
|
// src/html/inlined-runtimes.ts
|
108
130
|
var WALKER_RUNTIME_CODE = true ? (
|
109
131
|
/* js */
|
@@ -1413,23 +1435,143 @@ function nodeRef(scopeId, id) {
|
|
1413
1435
|
};
|
1414
1436
|
return id ? register2(getter, id, scopeId) : getter;
|
1415
1437
|
}
|
1416
|
-
function
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1438
|
+
function resumeClosestBranch(scopeId) {
|
1439
|
+
const branchId = $chunk.context?.[branchIdKey];
|
1440
|
+
if (branchId !== void 0 && branchId !== scopeId) {
|
1441
|
+
$chunk.writeHTML(
|
1442
|
+
$chunk.boundary.state.mark("$" /* ClosestBranch */, "" + scopeId)
|
1443
|
+
);
|
1444
|
+
}
|
1445
|
+
}
|
1446
|
+
var branchIdKey = Symbol();
|
1447
|
+
function resumeForOf(list, cb, scopeId, accessor) {
|
1448
|
+
forOf(list, (item, i) => {
|
1449
|
+
const branchId = peekNextScopeId();
|
1450
|
+
$chunk.writeHTML(
|
1451
|
+
$chunk.boundary.state.mark(
|
1452
|
+
"[" /* BranchStart */,
|
1453
|
+
branchId + (i ? " " : "")
|
1454
|
+
)
|
1455
|
+
);
|
1456
|
+
withContext(branchIdKey, branchId, () => cb(item, i));
|
1457
|
+
});
|
1458
|
+
$chunk.writeHTML(
|
1459
|
+
$chunk.boundary.state.mark(
|
1460
|
+
"]" /* BranchEnd */,
|
1461
|
+
scopeId + " " + accessor
|
1462
|
+
)
|
1420
1463
|
);
|
1421
1464
|
}
|
1422
|
-
function
|
1423
|
-
|
1465
|
+
function resumeSingleNodeForOf(list, cb, scopeId, accessor) {
|
1466
|
+
let branchIds = "";
|
1467
|
+
forOf(list, (item, index) => {
|
1468
|
+
const branchId = peekNextScopeId();
|
1469
|
+
branchIds = " " + branchId + branchIds;
|
1470
|
+
withContext(branchIdKey, branchId, () => cb(item, index));
|
1471
|
+
});
|
1472
|
+
$chunk.writeHTML(
|
1473
|
+
$chunk.boundary.state.mark(
|
1474
|
+
"|" /* BranchSingleNode */,
|
1475
|
+
scopeId + " " + accessor + branchIds
|
1476
|
+
)
|
1477
|
+
);
|
1424
1478
|
}
|
1425
|
-
function
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1479
|
+
function resumeForIn(obj, cb, scopeId, accessor) {
|
1480
|
+
let sep = "";
|
1481
|
+
forIn(obj, (key, value) => {
|
1482
|
+
const branchId = peekNextScopeId();
|
1483
|
+
$chunk.writeHTML(
|
1484
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1485
|
+
);
|
1486
|
+
sep = " ";
|
1487
|
+
withContext(branchIdKey, branchId, () => cb(key, value));
|
1488
|
+
});
|
1489
|
+
$chunk.writeHTML(
|
1490
|
+
$chunk.boundary.state.mark(
|
1491
|
+
"]" /* BranchEnd */,
|
1492
|
+
scopeId + " " + accessor
|
1493
|
+
)
|
1429
1494
|
);
|
1430
1495
|
}
|
1431
|
-
function
|
1432
|
-
|
1496
|
+
function resumeSingleNodeForIn(obj, cb, scopeId, accessor) {
|
1497
|
+
let branchIds = "";
|
1498
|
+
forIn(obj, (key, value) => {
|
1499
|
+
const branchId = peekNextScopeId();
|
1500
|
+
branchIds = " " + branchId + branchIds;
|
1501
|
+
withContext(branchIdKey, branchId, () => cb(key, value));
|
1502
|
+
});
|
1503
|
+
$chunk.writeHTML(
|
1504
|
+
$chunk.boundary.state.mark(
|
1505
|
+
"|" /* BranchSingleNode */,
|
1506
|
+
scopeId + " " + accessor + branchIds
|
1507
|
+
)
|
1508
|
+
);
|
1509
|
+
}
|
1510
|
+
function resumeForTo(to, from, step, cb, scopeId, accessor) {
|
1511
|
+
let sep = "";
|
1512
|
+
forTo(to, from, step, (index) => {
|
1513
|
+
const branchId = peekNextScopeId();
|
1514
|
+
$chunk.writeHTML(
|
1515
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + sep)
|
1516
|
+
);
|
1517
|
+
sep = " ";
|
1518
|
+
withContext(branchIdKey, branchId, () => cb(index));
|
1519
|
+
});
|
1520
|
+
$chunk.writeHTML(
|
1521
|
+
$chunk.boundary.state.mark(
|
1522
|
+
"]" /* BranchEnd */,
|
1523
|
+
scopeId + " " + accessor
|
1524
|
+
)
|
1525
|
+
);
|
1526
|
+
}
|
1527
|
+
function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor) {
|
1528
|
+
let branchIds = "";
|
1529
|
+
forTo(to, from, step, (index) => {
|
1530
|
+
const branchId = peekNextScopeId();
|
1531
|
+
branchIds = " " + branchId + branchIds;
|
1532
|
+
withContext(branchIdKey, branchId, () => cb(index));
|
1533
|
+
});
|
1534
|
+
$chunk.writeHTML(
|
1535
|
+
$chunk.boundary.state.mark(
|
1536
|
+
"|" /* BranchSingleNode */,
|
1537
|
+
scopeId + " " + accessor + branchIds
|
1538
|
+
)
|
1539
|
+
);
|
1540
|
+
}
|
1541
|
+
function resumeConditional(cb, scopeId, accessor) {
|
1542
|
+
const branchId = peekNextScopeId();
|
1543
|
+
$chunk.writeHTML(
|
1544
|
+
$chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
|
1545
|
+
);
|
1546
|
+
withContext(branchIdKey, branchId, cb);
|
1547
|
+
const rendered = peekNextScopeId() !== branchId;
|
1548
|
+
if (rendered) {
|
1549
|
+
writeScope(branchId, {});
|
1550
|
+
} else {
|
1551
|
+
nextScopeId();
|
1552
|
+
}
|
1553
|
+
$chunk.writeHTML(
|
1554
|
+
$chunk.boundary.state.mark(
|
1555
|
+
"]" /* BranchEnd */,
|
1556
|
+
scopeId + " " + accessor
|
1557
|
+
)
|
1558
|
+
);
|
1559
|
+
}
|
1560
|
+
function resumeSingleNodeConditional(cb, scopeId, accessor) {
|
1561
|
+
const branchId = peekNextScopeId();
|
1562
|
+
withContext(branchIdKey, branchId, cb);
|
1563
|
+
const rendered = peekNextScopeId() !== branchId;
|
1564
|
+
if (rendered) {
|
1565
|
+
writeScope(branchId, {});
|
1566
|
+
} else {
|
1567
|
+
nextScopeId();
|
1568
|
+
}
|
1569
|
+
$chunk.writeHTML(
|
1570
|
+
$chunk.boundary.state.mark(
|
1571
|
+
"|" /* BranchSingleNode */,
|
1572
|
+
scopeId + " " + accessor + (rendered ? " " + branchId : "")
|
1573
|
+
)
|
1574
|
+
);
|
1433
1575
|
}
|
1434
1576
|
function writeScope(scopeId, partialScope) {
|
1435
1577
|
const { state } = $chunk.boundary;
|
@@ -1747,7 +1889,7 @@ var Chunk = class {
|
|
1747
1889
|
do {
|
1748
1890
|
cur.flushPlaceholder();
|
1749
1891
|
html += cur.html;
|
1750
|
-
effects
|
1892
|
+
effects = concatEffects(effects, cur.effects);
|
1751
1893
|
scripts = concatScripts(scripts, cur.scripts);
|
1752
1894
|
cur.consumed = true;
|
1753
1895
|
cur = cur.next;
|
@@ -2201,52 +2343,57 @@ var DEFAULT_RENDER_ID = "_";
|
|
2201
2343
|
|
2202
2344
|
// src/html/dynamic-tag.ts
|
2203
2345
|
var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
|
2204
|
-
function dynamicTagInput(
|
2205
|
-
if (!tag && !content)
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2346
|
+
function dynamicTagInput(scopeId, accessor, tag, input, content, tagVar) {
|
2347
|
+
if (!tag && !content) {
|
2348
|
+
nextScopeId();
|
2349
|
+
return;
|
2350
|
+
}
|
2209
2351
|
if (!tag) {
|
2210
|
-
|
2352
|
+
resumeConditional(content, scopeId, accessor);
|
2353
|
+
return;
|
2211
2354
|
}
|
2212
2355
|
if (typeof tag === "string") {
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2356
|
+
resumeSingleNodeConditional(
|
2357
|
+
() => {
|
2358
|
+
nextScopeId();
|
2359
|
+
write(`<${tag}${attrs(input, accessor, scopeId, tag)}>`);
|
2360
|
+
if (!voidElementsReg.test(tag)) {
|
2361
|
+
if (tag === "textarea") {
|
2362
|
+
if (content) {
|
2363
|
+
throw new Error(
|
2364
|
+
"A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
|
2365
|
+
);
|
2366
|
+
}
|
2367
|
+
write(
|
2368
|
+
controllable_textarea_value(
|
2369
|
+
scopeId,
|
2370
|
+
accessor,
|
2371
|
+
input.value,
|
2372
|
+
input.valueChange
|
2373
|
+
)
|
2374
|
+
);
|
2375
|
+
} else if (content) {
|
2376
|
+
if (tag === "select" && ("value" in input || "valueChange" in input)) {
|
2377
|
+
controllable_select_value(
|
2378
|
+
scopeId,
|
2379
|
+
accessor,
|
2380
|
+
input.value,
|
2381
|
+
input.valueChange,
|
2382
|
+
content
|
2383
|
+
);
|
2384
|
+
} else {
|
2385
|
+
content();
|
2386
|
+
}
|
2387
|
+
}
|
2388
|
+
write(`</${tag}>`);
|
2389
|
+
} else if (content) {
|
2390
|
+
throw new Error(`Body content is not supported for a "${tag}" tag.`);
|
2243
2391
|
}
|
2244
|
-
}
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
return null;
|
2392
|
+
},
|
2393
|
+
scopeId,
|
2394
|
+
accessor
|
2395
|
+
);
|
2396
|
+
return;
|
2250
2397
|
}
|
2251
2398
|
const renderer = getDynamicRenderer(tag);
|
2252
2399
|
if (true) {
|
@@ -2254,22 +2401,36 @@ function dynamicTagInput(scope, tag, input, content, tagVar) {
|
|
2254
2401
|
throw new Error(`Invalid renderer passed for dynamic tag: ${tag}`);
|
2255
2402
|
}
|
2256
2403
|
}
|
2257
|
-
|
2404
|
+
let result;
|
2405
|
+
resumeConditional(
|
2406
|
+
() => {
|
2407
|
+
result = renderer(content ? { ...input, content } : input, tagVar);
|
2408
|
+
},
|
2409
|
+
scopeId,
|
2410
|
+
accessor
|
2411
|
+
);
|
2412
|
+
return result;
|
2258
2413
|
}
|
2259
|
-
function dynamicTagArgs(
|
2260
|
-
if (!tag)
|
2261
|
-
const scopeId = getScopeId(scope);
|
2262
|
-
write(`${markResumeScopeStart(scopeId)}`);
|
2263
|
-
writeScope(scopeId, scope);
|
2264
|
-
if (typeof tag === "string") {
|
2414
|
+
function dynamicTagArgs(scopeId, accessor, tag, args) {
|
2415
|
+
if (!tag) {
|
2265
2416
|
nextScopeId();
|
2266
|
-
|
2267
|
-
|
2417
|
+
return;
|
2418
|
+
}
|
2419
|
+
if (typeof tag === "string") {
|
2420
|
+
resumeSingleNodeConditional(
|
2421
|
+
() => {
|
2422
|
+
nextScopeId();
|
2423
|
+
write(
|
2424
|
+
`<${tag}${attrs(args[0], accessor, scopeId, tag)}>`
|
2425
|
+
);
|
2426
|
+
if (!voidElementsReg.test(tag)) {
|
2427
|
+
write(`</${tag}>`);
|
2428
|
+
}
|
2429
|
+
},
|
2430
|
+
scopeId,
|
2431
|
+
accessor
|
2268
2432
|
);
|
2269
|
-
|
2270
|
-
write(`</${tag}>`);
|
2271
|
-
}
|
2272
|
-
return void 0;
|
2433
|
+
return;
|
2273
2434
|
}
|
2274
2435
|
const renderer = getDynamicRenderer(tag);
|
2275
2436
|
if (true) {
|
@@ -2277,7 +2438,15 @@ function dynamicTagArgs(scope, tag, args) {
|
|
2277
2438
|
throw new Error(`Invalid renderer passed for dynamic tag: ${tag}`);
|
2278
2439
|
}
|
2279
2440
|
}
|
2280
|
-
|
2441
|
+
let result;
|
2442
|
+
resumeConditional(
|
2443
|
+
() => {
|
2444
|
+
result = renderer(...args);
|
2445
|
+
},
|
2446
|
+
scopeId,
|
2447
|
+
accessor
|
2448
|
+
);
|
2449
|
+
return result;
|
2281
2450
|
}
|
2282
2451
|
var getDynamicRenderer = normalizeDynamicRenderer;
|
2283
2452
|
var createRenderer = (fn) => fn;
|
@@ -2373,28 +2542,6 @@ var compat = {
|
|
2373
2542
|
}
|
2374
2543
|
};
|
2375
2544
|
|
2376
|
-
// src/common/for.ts
|
2377
|
-
function forIn(obj, cb) {
|
2378
|
-
for (const key in obj) {
|
2379
|
-
cb(key, obj[key]);
|
2380
|
-
}
|
2381
|
-
}
|
2382
|
-
function forOf(list, cb) {
|
2383
|
-
if (list) {
|
2384
|
-
let i = 0;
|
2385
|
-
for (const item of list) {
|
2386
|
-
cb(item, i++);
|
2387
|
-
}
|
2388
|
-
}
|
2389
|
-
}
|
2390
|
-
function forTo(to, from, step, cb) {
|
2391
|
-
const start = from || 0;
|
2392
|
-
const delta = step || 1;
|
2393
|
-
for (let steps = (to - start) / delta, i = 0; i <= steps; i++) {
|
2394
|
-
cb(start + i * delta);
|
2395
|
-
}
|
2396
|
-
}
|
2397
|
-
|
2398
2545
|
// src/html/for.ts
|
2399
2546
|
function forOfBy(by, item, index) {
|
2400
2547
|
if (by) {
|
@@ -2660,11 +2807,7 @@ export {
|
|
2660
2807
|
forToBy,
|
2661
2808
|
fork,
|
2662
2809
|
getScopeById,
|
2663
|
-
markResumeCleanup,
|
2664
|
-
markResumeControlEnd,
|
2665
|
-
markResumeControlSingleNodeEnd,
|
2666
2810
|
markResumeNode,
|
2667
|
-
markResumeScopeStart,
|
2668
2811
|
nextScopeId,
|
2669
2812
|
nextTagId,
|
2670
2813
|
nodeRef,
|
@@ -2673,6 +2816,15 @@ export {
|
|
2673
2816
|
partialAttrs,
|
2674
2817
|
peekNextScope,
|
2675
2818
|
register2 as register,
|
2819
|
+
resumeClosestBranch,
|
2820
|
+
resumeConditional,
|
2821
|
+
resumeForIn,
|
2822
|
+
resumeForOf,
|
2823
|
+
resumeForTo,
|
2824
|
+
resumeSingleNodeConditional,
|
2825
|
+
resumeSingleNodeForIn,
|
2826
|
+
resumeSingleNodeForOf,
|
2827
|
+
resumeSingleNodeForTo,
|
2676
2828
|
styleAttr,
|
2677
2829
|
toString,
|
2678
2830
|
tryContent,
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import type { Scope } from "../common/types";
|
2
2
|
export declare function resetAbortSignal(scope: Scope, id: string | number): void;
|
3
|
-
export declare function getAbortSignal(scope: Scope, id: string | number):
|
3
|
+
export declare function getAbortSignal(scope: Scope, id: string | number): AbortSignal;
|
package/dist/dom/compat.d.ts
CHANGED
@@ -11,6 +11,7 @@ export declare const compat: {
|
|
11
11
|
getStartNode(scope: any): any;
|
12
12
|
setScopeNodes(scope: any, startNode: Node, endNode: Node): void;
|
13
13
|
runComponentEffects(this: any): void;
|
14
|
+
runComponentDestroy(this: any): void;
|
14
15
|
resolveRegistered(value: any, { runtimeId, componentIdPrefix, }: {
|
15
16
|
runtimeId: string;
|
16
17
|
componentIdPrefix: string;
|
@@ -1,14 +1,12 @@
|
|
1
|
-
import { type Accessor, type Scope } from "../common/types";
|
1
|
+
import { type Accessor, type BranchScope, type Scope } from "../common/types";
|
2
2
|
import { type Renderer } from "./renderer";
|
3
|
-
import { type
|
3
|
+
import { type Signal, type SignalOp } from "./signals";
|
4
4
|
export declare function patchConditionals(fn: <T extends typeof conditional | typeof conditionalOnlyChild>(cond: T) => T): void;
|
5
|
-
export declare let conditional: (nodeAccessor: Accessor, fn?: ((scope: Scope) => void) | 0, getIntersection?: () =>
|
6
|
-
export declare function
|
7
|
-
export declare
|
8
|
-
export declare let conditionalOnlyChild: (nodeAccessor: Accessor, fn?: ((scope: Scope) => void) | 0, getIntersection?: () => IntersectionSignal) => ValueSignal<Renderer | string | undefined>;
|
5
|
+
export declare let conditional: (nodeAccessor: Accessor, fn?: ((scope: Scope) => void) | 0, getIntersection?: () => Signal<never>) => Signal<Renderer | string | undefined>;
|
6
|
+
export declare function setConditionalRenderer(scope: Scope, nodeAccessor: Accessor, newRenderer: Renderer | string | undefined): void;
|
7
|
+
export declare let conditionalOnlyChild: (nodeAccessor: Accessor, fn?: ((scope: Scope) => void) | 0, getIntersection?: () => Signal<never>) => Signal<Renderer | string | undefined>;
|
9
8
|
export declare function setConditionalRendererOnlyChild(scope: Scope, nodeAccessor: Accessor, newRenderer: Renderer | string | undefined): void;
|
10
|
-
export declare const emptyMarkerArray:
|
9
|
+
export declare const emptyMarkerArray: BranchScope[];
|
11
10
|
export declare function loopOf(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: SignalOp | [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
|
12
11
|
export declare function loopIn(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: SignalOp | [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
|
13
12
|
export declare function loopTo(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, valueOrOp: SignalOp | [to: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
|
14
|
-
export declare function inLoopScope(signal: IntersectionSignal, loopNodeAccessor: Accessor): (scope: Scope, op: SignalOp) => void;
|
package/dist/dom/queue.d.ts
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
import type { Scope } from "../common/types";
|
2
|
-
import { type
|
2
|
+
import { type Signal } from "./signals";
|
3
3
|
type ExecFn<S extends Scope = Scope> = (scope: S, arg?: any) => void;
|
4
|
+
export declare let pendingEffects: unknown[];
|
4
5
|
export declare let rendering: boolean;
|
5
|
-
export declare function queueSource<T>(scope: Scope, signal:
|
6
|
+
export declare function queueSource<T>(scope: Scope, signal: Signal<T>, value: T): T;
|
7
|
+
export declare function queueRender(scope: Scope, signal: Signal<any>, value?: unknown): void;
|
6
8
|
export declare function queueEffect<S extends Scope, T extends ExecFn<S>>(scope: S, fn: T): void;
|
7
9
|
export declare function run(): void;
|
8
10
|
export declare function prepareEffects(fn: () => void): unknown[];
|
package/dist/dom/reconcile.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import type {
|
2
|
-
export declare function reconcile(parent: Node & ParentNode,
|
1
|
+
import type { BranchScope } from "../common/types";
|
2
|
+
export declare function reconcile(parent: Node & ParentNode, oldBranches: BranchScope[], newBranches: BranchScope[], afterReference: Node | null): void;
|
package/dist/dom/renderer.d.ts
CHANGED
@@ -1,21 +1,20 @@
|
|
1
|
-
import { type Accessor, type Scope } from "../common/types";
|
2
|
-
import { type
|
1
|
+
import { type Accessor, type BranchScope, type Scope } from "../common/types";
|
2
|
+
import { type Signal, type SignalOp } from "./signals";
|
3
3
|
export type Renderer = {
|
4
4
|
___id: symbol;
|
5
5
|
___template: string;
|
6
6
|
___walks: string;
|
7
7
|
___setup: SetupFn | undefined;
|
8
|
-
___closureSignals: Set<IntersectionSignal>;
|
9
8
|
___clone: () => Node;
|
10
9
|
___sourceNode: Node | undefined;
|
11
|
-
___args:
|
10
|
+
___args: Signal<unknown> | undefined;
|
12
11
|
___owner: Scope | undefined;
|
13
12
|
};
|
14
13
|
type SetupFn = (scope: Scope) => void;
|
15
|
-
export declare function
|
16
|
-
export declare function
|
14
|
+
export declare function createBranchScopeWithRenderer(renderer: Renderer, $global: Scope["$global"], parentScope: Scope): BranchScope;
|
15
|
+
export declare function createBranchScopeWithTagNameOrRenderer(tagNameOrRenderer: Renderer | string, $global: Scope["$global"], parentScope: Scope): BranchScope;
|
17
16
|
export declare function initRenderer(renderer: Renderer, scope: Scope): Node;
|
18
17
|
export declare function dynamicTagAttrs(nodeAccessor: Accessor, getContent?: (scope: Scope) => Renderer, inputIsArgs?: boolean): (scope: Scope, attrsOrOp: (() => Record<string, unknown>) | SignalOp) => void;
|
19
|
-
export declare function createRendererWithOwner(template: string, rawWalks?: string, setup?: SetupFn,
|
20
|
-
export declare function createRenderer(template: string, walks?: string, setup?: SetupFn,
|
18
|
+
export declare function createRendererWithOwner(template: string, rawWalks?: string, setup?: SetupFn, getArgs?: () => Signal<unknown>): (owner?: Scope) => Renderer;
|
19
|
+
export declare function createRenderer(template: string, walks?: string, setup?: SetupFn, getArgs?: () => Signal<unknown>): Renderer;
|
21
20
|
export {};
|
package/dist/dom/resume.d.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import { type Scope } from "../common/types";
|
2
|
-
import type {
|
2
|
+
import type { Signal } from "./signals";
|
3
3
|
export declare let isResuming: boolean;
|
4
4
|
export declare function register<T>(id: string, obj: T): T;
|
5
|
-
export declare function registerBoundSignal<T extends
|
5
|
+
export declare function registerBoundSignal<T extends Signal<unknown>>(id: string, signal: T): T;
|
6
6
|
export declare function getRegisteredWithScope(id: string, scope?: Scope): unknown;
|
7
7
|
export declare function init(runtimeId?: string): void;
|
8
|
-
export declare function registerSubscriber(id: string, signal:
|
8
|
+
export declare function registerSubscriber(id: string, signal: Signal<never>): Signal<never>;
|
9
9
|
export declare function nodeRef(id: string, key: string): (scope: Scope) => () => any;
|
package/dist/dom/scope.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { Scope } from "../common/types";
|
1
|
+
import type { BranchScope, Scope } from "../common/types";
|
2
2
|
export declare function createScope($global: Scope["$global"]): Scope;
|
3
|
+
export declare function finishPendingScopes(): void;
|
3
4
|
export declare function getEmptyScope(marker: Comment): Scope;
|
4
|
-
export declare function
|
5
|
-
export declare function
|
6
|
-
export declare function removeAndDestroyScope(scope: Scope): void;
|
5
|
+
export declare function destroyBranch(branch: BranchScope): void;
|
6
|
+
export declare function removeAndDestroyBranch(branch: BranchScope): void;
|
7
7
|
export declare function insertBefore(scope: Scope, parent: Node & ParentNode, nextSibling: Node | null): void;
|
package/dist/dom/signals.d.ts
CHANGED
@@ -1,39 +1,26 @@
|
|
1
1
|
import { type Accessor, type Scope } from "../common/types";
|
2
2
|
import type { Renderer } from "./renderer";
|
3
|
-
export type Signal = ValueSignal | IntersectionSignal;
|
4
3
|
export declare const MARK: unique symbol;
|
5
4
|
export declare const CLEAN: unique symbol;
|
6
5
|
export declare const DIRTY: unique symbol;
|
7
6
|
export type SignalOp = typeof MARK | typeof CLEAN | typeof DIRTY;
|
8
|
-
export type SignalFn<T
|
9
|
-
export type
|
10
|
-
export type BoundValueSignal<T = unknown> = (valueOrOp: T | SignalOp) => void;
|
11
|
-
export type IntersectionSignal = SignalFn<SignalOp> & {
|
7
|
+
export type SignalFn<T> = (scope: Scope, value: T) => void;
|
8
|
+
export type Signal<T> = ((scope: Scope, value: T | SignalOp) => void) & {
|
12
9
|
___subscribe?(scope: Scope): void;
|
13
|
-
___unsubscribe?(scope: Scope): void;
|
14
10
|
};
|
15
|
-
export
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
export declare function
|
20
|
-
export declare function
|
21
|
-
export declare function
|
22
|
-
export declare function
|
23
|
-
export declare function dynamicClosure<T>(ownerValueAccessor: Accessor | ((scope: Scope) => Accessor), fn: ValueSignal<T> | 0, getOwnerScope?: (scope: Scope) => Scope, getIntersection?: () => IntersectionSignal): IntersectionSignal;
|
24
|
-
export declare function childClosures(closureSignals: IntersectionSignal[], childAccessor: Accessor): {
|
25
|
-
(scope: Scope, op: SignalOp): void;
|
26
|
-
___subscribe(scope: Scope): void;
|
27
|
-
___unsubscribe(scope: Scope): void;
|
28
|
-
};
|
29
|
-
export declare function dynamicSubscribers(valueAccessor: Accessor): (scope: Scope, op: SignalOp) => void;
|
30
|
-
export declare function setTagVar(scope: Scope, childAccessor: Accessor, tagVarSignal: ValueSignal): void;
|
11
|
+
export declare function state<T>(valueAccessor: Accessor, fn: Signal<T>, getIntersection?: () => Signal<never>): (scope: Scope, valueOrOp: T | SignalOp, valueChange?: (v: T) => void) => SignalOp | T;
|
12
|
+
export declare function value<T>(valueAccessor: Accessor, fn: SignalFn<T> | 0, getIntersection?: () => Signal<never>): Signal<T>;
|
13
|
+
export declare function intersection(count: number, fn: SignalFn<never>, getIntersection?: () => Signal<never>): Signal<never>;
|
14
|
+
export declare function closure<T>(fn: SignalFn<T> | 0, getIntersection?: () => Signal<never>): Signal<T>;
|
15
|
+
export declare function loopClosure<T>(ownerLoopNodeAccessor: Accessor, fn: SignalFn<T> | 0, getIntersection?: () => Signal<never>): SignalFn<T>;
|
16
|
+
export declare function conditionalClosure<T>(ownerConditionalNodeAccessor: Accessor, getRenderer: () => Renderer, fn: SignalFn<T> | 0, getIntersection?: () => Signal<never>): SignalFn<T>;
|
17
|
+
export declare function dynamicClosure<T>(ownerValueAccessor: Accessor, fn: Signal<T> | 0, getOwnerScope?: (scope: Scope) => Scope, getIntersection?: () => Signal<never>): SignalFn<T>;
|
18
|
+
export declare function setTagVar(scope: Scope, childAccessor: Accessor, tagVarSignal: Signal<unknown>): void;
|
31
19
|
export declare const tagVarSignal: (scope: Scope, valueOrOp: unknown | SignalOp) => any;
|
32
20
|
export declare function setTagVarChange(scope: Scope, changeHandler: (value: unknown) => void): void;
|
33
21
|
export declare const tagVarSignalChange: (scope: Scope, value: unknown) => any;
|
34
|
-
export declare const
|
35
|
-
export declare const inMany: (scopes: Scope[], op: SignalOp, signal: IntersectionSignal) => void;
|
22
|
+
export declare const inMany: (scopes: Scope[], op: SignalOp, signal: Signal<never>) => void;
|
36
23
|
export declare function nextTagId({ $global }: Scope): string;
|
37
|
-
export declare function inChild(childAccessor: Accessor, signal:
|
38
|
-
export declare function intersections(signals:
|
24
|
+
export declare function inChild(childAccessor: Accessor, signal: Signal<unknown>): (scope: Scope, valueOrOp: unknown | SignalOp) => void;
|
25
|
+
export declare function intersections(signals: Signal<never>[]): Signal<never>;
|
39
26
|
export declare function effect(id: string, fn: (scope: Scope) => void): (scope: Scope) => void;
|
package/dist/dom/template.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Template } from "../common/types";
|
2
2
|
import { createRenderer } from "./renderer";
|
3
|
-
export declare const createTemplate: (templateId: string, template: string, walks?: string | undefined, setup?: ((scope: Scope) => void) | undefined,
|
3
|
+
export declare const createTemplate: (templateId: string, template: string, walks?: string | undefined, setup?: ((scope: import("../dom").Scope) => void) | undefined, getArgs?: (() => import("./signals").Signal<unknown>) | undefined) => Template;
|
package/dist/dom.d.ts
CHANGED
@@ -3,7 +3,7 @@ export { forIn, forOf, forTo } from "./common/for";
|
|
3
3
|
export type { Scope } from "./common/types";
|
4
4
|
export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
|
5
5
|
export { compat } from "./dom/compat";
|
6
|
-
export { conditional, conditionalOnlyChild,
|
6
|
+
export { conditional, conditionalOnlyChild, loopIn, loopOf, loopTo, } from "./dom/control-flow";
|
7
7
|
export { controllable_detailsOrDialog_open, controllable_detailsOrDialog_open_effect, controllable_input_checked, controllable_input_checked_effect, controllable_input_checkedValue, controllable_input_checkedValue_effect, controllable_input_value, controllable_input_value_effect, controllable_select_value, controllable_select_value_effect, controllable_textarea_value, controllable_textarea_value_effect, } from "./dom/controllable";
|
8
8
|
export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, textContent, } from "./dom/dom";
|
9
9
|
export { on } from "./dom/event";
|
@@ -11,5 +11,5 @@ export { run } from "./dom/queue";
|
|
11
11
|
export { createRenderer, createRendererWithOwner, dynamicTagAttrs, } from "./dom/renderer";
|
12
12
|
export { init, nodeRef, register, registerBoundSignal, registerSubscriber, } from "./dom/resume";
|
13
13
|
export { createScope } from "./dom/scope";
|
14
|
-
export {
|
14
|
+
export { conditionalClosure, dynamicClosure, effect, inChild, intersection, intersections, loopClosure, nextTagId, setTagVar, setTagVarChange, state, tagVarSignal, tagVarSignalChange, value, } from "./dom/signals";
|
15
15
|
export { createTemplate } from "./dom/template";
|