@b9g/crank 0.6.0 → 0.6.1
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/crank.cjs +21 -22
- package/crank.cjs.map +1 -1
- package/crank.d.ts +2 -0
- package/crank.js +21 -22
- package/crank.js.map +1 -1
- package/dom.cjs +24 -0
- package/dom.cjs.map +1 -1
- package/dom.js +25 -1
- package/dom.js.map +1 -1
- package/html.cjs +43 -38
- package/html.cjs.map +1 -1
- package/html.js +44 -39
- package/html.js.map +1 -1
- package/jsx-runtime.cjs.map +1 -1
- package/jsx-runtime.js.map +1 -1
- package/jsx-tag.cjs +3 -0
- package/jsx-tag.cjs.map +1 -1
- package/jsx-tag.d.ts +2 -0
- package/jsx-tag.js +3 -1
- package/jsx-tag.js.map +1 -1
- package/package.json +30 -30
- package/standalone.cjs +1 -0
- package/standalone.cjs.map +1 -1
- package/standalone.d.ts +1 -1
- package/standalone.js +1 -1
- package/umd.js +89 -61
- package/umd.js.map +1 -1
package/umd.js
CHANGED
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
: typeof value === "string" ||
|
|
28
28
|
typeof value[Symbol.iterator] !== "function"
|
|
29
29
|
? [value]
|
|
30
|
-
:
|
|
31
|
-
[...value];
|
|
30
|
+
: [...value];
|
|
32
31
|
}
|
|
33
32
|
function isIteratorLike(value) {
|
|
34
33
|
return value != null && typeof value.next === "function";
|
|
@@ -904,7 +903,7 @@
|
|
|
904
903
|
}
|
|
905
904
|
}
|
|
906
905
|
finally {
|
|
907
|
-
ctx.f &=
|
|
906
|
+
ctx.f &= -5;
|
|
908
907
|
}
|
|
909
908
|
}
|
|
910
909
|
async *[Symbol.asyncIterator]() {
|
|
@@ -939,7 +938,7 @@
|
|
|
939
938
|
}
|
|
940
939
|
}
|
|
941
940
|
finally {
|
|
942
|
-
ctx.f &=
|
|
941
|
+
ctx.f &= -9;
|
|
943
942
|
if (ctx.onPropsRequested) {
|
|
944
943
|
ctx.onPropsRequested();
|
|
945
944
|
ctx.onPropsRequested = undefined;
|
|
@@ -1286,7 +1285,7 @@
|
|
|
1286
1285
|
childValues = diffChildren(ctx.renderer, ctx.root, ctx.host, ctx, ctx.scope, ctx.ret, narrow(children), hydrationData);
|
|
1287
1286
|
}
|
|
1288
1287
|
finally {
|
|
1289
|
-
ctx.f &=
|
|
1288
|
+
ctx.f &= -3;
|
|
1290
1289
|
}
|
|
1291
1290
|
if (isPromiseLike(childValues)) {
|
|
1292
1291
|
ctx.ret.inflightValue = childValues.then((childValues) => commitComponent(ctx, childValues));
|
|
@@ -1351,14 +1350,14 @@
|
|
|
1351
1350
|
for (const callback of callbacks) {
|
|
1352
1351
|
callback(value1);
|
|
1353
1352
|
}
|
|
1354
|
-
ctx.f &=
|
|
1353
|
+
ctx.f &= -1025;
|
|
1355
1354
|
// Handles an edge case where refresh() is called during a schedule().
|
|
1356
1355
|
if (ctx.f & IsSchedulingRefresh) {
|
|
1357
|
-
ctx.f &=
|
|
1356
|
+
ctx.f &= -2049;
|
|
1358
1357
|
value = getValue(ctx.ret);
|
|
1359
1358
|
}
|
|
1360
1359
|
}
|
|
1361
|
-
ctx.f &=
|
|
1360
|
+
ctx.f &= -2;
|
|
1362
1361
|
return value;
|
|
1363
1362
|
}
|
|
1364
1363
|
function invalidate(ctx, host) {
|
|
@@ -1525,7 +1524,7 @@
|
|
|
1525
1524
|
throw err;
|
|
1526
1525
|
}
|
|
1527
1526
|
finally {
|
|
1528
|
-
ctx.f &=
|
|
1527
|
+
ctx.f &= -3;
|
|
1529
1528
|
}
|
|
1530
1529
|
if (isIteratorLike(result)) {
|
|
1531
1530
|
ctx.iterator = result;
|
|
@@ -1562,7 +1561,7 @@
|
|
|
1562
1561
|
throw err;
|
|
1563
1562
|
}
|
|
1564
1563
|
finally {
|
|
1565
|
-
ctx.f &=
|
|
1564
|
+
ctx.f &= -3;
|
|
1566
1565
|
}
|
|
1567
1566
|
if (isPromiseLike(iteration)) {
|
|
1568
1567
|
ctx.f |= IsAsyncGen;
|
|
@@ -1583,7 +1582,7 @@
|
|
|
1583
1582
|
throw err;
|
|
1584
1583
|
}
|
|
1585
1584
|
finally {
|
|
1586
|
-
ctx.f &=
|
|
1585
|
+
ctx.f &= -3;
|
|
1587
1586
|
}
|
|
1588
1587
|
}
|
|
1589
1588
|
if (isPromiseLike(iteration)) {
|
|
@@ -1594,9 +1593,9 @@
|
|
|
1594
1593
|
!(ctx.f & IsUnmounted)) {
|
|
1595
1594
|
console.error("Component yielded more than once in for...of loop");
|
|
1596
1595
|
}
|
|
1597
|
-
ctx.f &=
|
|
1596
|
+
ctx.f &= -17;
|
|
1598
1597
|
if (iteration.done) {
|
|
1599
|
-
ctx.f &=
|
|
1598
|
+
ctx.f &= -257;
|
|
1600
1599
|
ctx.iterator = undefined;
|
|
1601
1600
|
}
|
|
1602
1601
|
let value;
|
|
@@ -1629,7 +1628,7 @@
|
|
|
1629
1628
|
throw err;
|
|
1630
1629
|
}
|
|
1631
1630
|
finally {
|
|
1632
|
-
ctx.f &=
|
|
1631
|
+
ctx.f &= -3;
|
|
1633
1632
|
}
|
|
1634
1633
|
}
|
|
1635
1634
|
if (!isPromiseLike(iteration)) {
|
|
@@ -1646,7 +1645,7 @@
|
|
|
1646
1645
|
console.error("Component yielded more than once in for...of loop");
|
|
1647
1646
|
}
|
|
1648
1647
|
}
|
|
1649
|
-
ctx.f &=
|
|
1648
|
+
ctx.f &= -17;
|
|
1650
1649
|
try {
|
|
1651
1650
|
value = updateComponentChildren(ctx,
|
|
1652
1651
|
// Children can be void so we eliminate that here
|
|
@@ -1778,7 +1777,7 @@
|
|
|
1778
1777
|
}
|
|
1779
1778
|
finally {
|
|
1780
1779
|
if (done) {
|
|
1781
|
-
ctx.f &=
|
|
1780
|
+
ctx.f &= -513;
|
|
1782
1781
|
ctx.iterator = undefined;
|
|
1783
1782
|
}
|
|
1784
1783
|
}
|
|
@@ -1790,7 +1789,7 @@
|
|
|
1790
1789
|
if (ctx.onProps) {
|
|
1791
1790
|
ctx.onProps(ctx.ret.el.props);
|
|
1792
1791
|
ctx.onProps = undefined;
|
|
1793
|
-
ctx.f &=
|
|
1792
|
+
ctx.f &= -33;
|
|
1794
1793
|
}
|
|
1795
1794
|
else {
|
|
1796
1795
|
ctx.f |= PropsAvailable;
|
|
@@ -1882,7 +1881,7 @@
|
|
|
1882
1881
|
}
|
|
1883
1882
|
}
|
|
1884
1883
|
finally {
|
|
1885
|
-
ctx.f &=
|
|
1884
|
+
ctx.f &= -3;
|
|
1886
1885
|
}
|
|
1887
1886
|
}
|
|
1888
1887
|
}
|
|
@@ -1969,12 +1968,12 @@
|
|
|
1969
1968
|
throw err;
|
|
1970
1969
|
}
|
|
1971
1970
|
finally {
|
|
1972
|
-
ctx.f &=
|
|
1971
|
+
ctx.f &= -3;
|
|
1973
1972
|
}
|
|
1974
1973
|
if (isPromiseLike(iteration)) {
|
|
1975
1974
|
return iteration.then((iteration) => {
|
|
1976
1975
|
if (iteration.done) {
|
|
1977
|
-
ctx.f &=
|
|
1976
|
+
ctx.f &= -513;
|
|
1978
1977
|
ctx.iterator = undefined;
|
|
1979
1978
|
}
|
|
1980
1979
|
return updateComponentChildren(ctx, iteration.value);
|
|
@@ -1984,8 +1983,8 @@
|
|
|
1984
1983
|
});
|
|
1985
1984
|
}
|
|
1986
1985
|
if (iteration.done) {
|
|
1987
|
-
ctx.f &=
|
|
1988
|
-
ctx.f &=
|
|
1986
|
+
ctx.f &= -257;
|
|
1987
|
+
ctx.f &= -513;
|
|
1989
1988
|
ctx.iterator = undefined;
|
|
1990
1989
|
}
|
|
1991
1990
|
return updateComponentChildren(ctx, iteration.value);
|
|
@@ -2065,6 +2064,30 @@
|
|
|
2065
2064
|
// TODO: Stricter typings?
|
|
2066
2065
|
value, oldValue, xmlns) {
|
|
2067
2066
|
const isSVG = xmlns === SVG_NAMESPACE;
|
|
2067
|
+
const colonIndex = name.indexOf(":");
|
|
2068
|
+
if (colonIndex !== -1) {
|
|
2069
|
+
const ns = name.slice(0, colonIndex);
|
|
2070
|
+
const name1 = name.slice(colonIndex + 1);
|
|
2071
|
+
switch (ns) {
|
|
2072
|
+
case "prop":
|
|
2073
|
+
node[name1] = value;
|
|
2074
|
+
return;
|
|
2075
|
+
case "attr":
|
|
2076
|
+
if (value == null || value === false) {
|
|
2077
|
+
node.removeAttribute(name1);
|
|
2078
|
+
}
|
|
2079
|
+
else if (value === true) {
|
|
2080
|
+
node.setAttribute(name1, "");
|
|
2081
|
+
}
|
|
2082
|
+
else if (typeof value === "string") {
|
|
2083
|
+
node.setAttribute(name1, value);
|
|
2084
|
+
}
|
|
2085
|
+
else {
|
|
2086
|
+
node.setAttribute(name, String(value));
|
|
2087
|
+
}
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2068
2091
|
switch (name) {
|
|
2069
2092
|
case "style": {
|
|
2070
2093
|
const style = node.style;
|
|
@@ -2364,49 +2387,54 @@
|
|
|
2364
2387
|
}
|
|
2365
2388
|
function printAttrs(props) {
|
|
2366
2389
|
const attrs = [];
|
|
2367
|
-
for (
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2390
|
+
for (let [name, value] of Object.entries(props)) {
|
|
2391
|
+
// TODO: Because printAttrs is called in arrange, special props are not filtered out.
|
|
2392
|
+
// This should be handled by the core library.
|
|
2393
|
+
if (name === "children" ||
|
|
2394
|
+
name === "innerHTML" ||
|
|
2395
|
+
name === "key" ||
|
|
2396
|
+
name === "ref" ||
|
|
2397
|
+
name === "copy" ||
|
|
2398
|
+
name.startsWith("prop:") ||
|
|
2399
|
+
// TODO: Remove deprecated special props
|
|
2400
|
+
name === "crank-key" ||
|
|
2401
|
+
name === "crank-ref" ||
|
|
2402
|
+
name === "crank-static" ||
|
|
2403
|
+
name === "c-key" ||
|
|
2404
|
+
name === "c-ref" ||
|
|
2405
|
+
name === "c-static" ||
|
|
2406
|
+
name === "$key" ||
|
|
2407
|
+
name === "$ref" ||
|
|
2408
|
+
name === "$static") {
|
|
2409
|
+
continue;
|
|
2410
|
+
}
|
|
2411
|
+
else if (name === "style") {
|
|
2412
|
+
if (typeof value === "string") {
|
|
2413
|
+
attrs.push(`style="${escape(value)}"`);
|
|
2414
|
+
}
|
|
2415
|
+
else if (typeof value === "object") {
|
|
2416
|
+
attrs.push(`style="${escape(printStyleObject(value))}"`);
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
else if (name === "className") {
|
|
2420
|
+
if ("class" in props || typeof value !== "string") {
|
|
2421
|
+
continue;
|
|
2422
|
+
}
|
|
2423
|
+
attrs.push(`class="${escape(value)}"`);
|
|
2424
|
+
}
|
|
2425
|
+
else {
|
|
2426
|
+
if (name.startsWith("attr:")) {
|
|
2427
|
+
name = name.slice("attr:".length);
|
|
2400
2428
|
}
|
|
2401
|
-
|
|
2429
|
+
if (typeof value === "string") {
|
|
2402
2430
|
attrs.push(`${escape(name)}="${escape(value)}"`);
|
|
2403
|
-
|
|
2404
|
-
|
|
2431
|
+
}
|
|
2432
|
+
else if (typeof value === "number") {
|
|
2405
2433
|
attrs.push(`${escape(name)}="${value}"`);
|
|
2406
|
-
|
|
2407
|
-
|
|
2434
|
+
}
|
|
2435
|
+
else if (value === true) {
|
|
2408
2436
|
attrs.push(`${escape(name)}`);
|
|
2409
|
-
|
|
2437
|
+
}
|
|
2410
2438
|
}
|
|
2411
2439
|
}
|
|
2412
2440
|
return attrs.join(" ");
|