@uniformdev/canvas 20.63.0 → 20.63.1-alpha.18
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/index.d.mts +118 -79
- package/dist/index.d.ts +118 -79
- package/dist/index.esm.js +40 -37
- package/dist/index.js +40 -37
- package/dist/index.mjs +40 -37
- package/package.json +5 -6
package/dist/index.esm.js
CHANGED
|
@@ -1264,7 +1264,7 @@ function hasReferencedVariables(value) {
|
|
|
1264
1264
|
|
|
1265
1265
|
// src/enhancement/walkNodeTree.ts
|
|
1266
1266
|
function walkNodeTree(node, visitor, options) {
|
|
1267
|
-
var _a, _b;
|
|
1267
|
+
var _a, _b, _c;
|
|
1268
1268
|
const componentQueue = [
|
|
1269
1269
|
{
|
|
1270
1270
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1272,12 +1272,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1272
1272
|
}
|
|
1273
1273
|
];
|
|
1274
1274
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1275
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1276
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1275
1277
|
do {
|
|
1276
|
-
const currentQueueEntry =
|
|
1278
|
+
const currentQueueEntry = takeNext();
|
|
1277
1279
|
if (!currentQueueEntry) continue;
|
|
1278
1280
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1279
1281
|
let visitDescendants = true;
|
|
1280
|
-
let descendantContext = (
|
|
1282
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1281
1283
|
let visitorInfo;
|
|
1282
1284
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1283
1285
|
visitorInfo = {
|
|
@@ -1464,39 +1466,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1464
1466
|
continue;
|
|
1465
1467
|
}
|
|
1466
1468
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1467
|
-
|
|
1468
|
-
const slotKeys = Object.keys(slots);
|
|
1469
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1470
|
-
const slotKey = slotKeys[slotIndex];
|
|
1471
|
-
const components = slots[slotKey];
|
|
1472
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1473
|
-
const enqueueingComponent = components[componentIndex];
|
|
1474
|
-
const parentSlotIndexFn = () => {
|
|
1475
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1476
|
-
(x) => x === enqueueingComponent
|
|
1477
|
-
);
|
|
1478
|
-
return result;
|
|
1479
|
-
};
|
|
1480
|
-
componentQueue.push({
|
|
1481
|
-
ancestorsAndSelf: [
|
|
1482
|
-
{
|
|
1483
|
-
type: "slot",
|
|
1484
|
-
node: enqueueingComponent,
|
|
1485
|
-
parentSlot: slotKey,
|
|
1486
|
-
parentSlotIndexFn
|
|
1487
|
-
},
|
|
1488
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1489
|
-
],
|
|
1490
|
-
context: descendantContext
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1469
|
+
const childEntries = [];
|
|
1495
1470
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1496
1471
|
if (properties) {
|
|
1497
1472
|
const propertyEntries = Object.entries(properties);
|
|
1498
|
-
for (
|
|
1499
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1473
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1500
1474
|
if (!isNestedNodeType(propObject.type)) {
|
|
1501
1475
|
continue;
|
|
1502
1476
|
}
|
|
@@ -1516,13 +1490,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1516
1490
|
continue;
|
|
1517
1491
|
}
|
|
1518
1492
|
}
|
|
1519
|
-
const blocks = (
|
|
1520
|
-
for (
|
|
1521
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1493
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1494
|
+
for (const enqueueingBlock of blocks) {
|
|
1522
1495
|
const blockIndexFn = () => {
|
|
1523
1496
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1524
1497
|
};
|
|
1525
|
-
|
|
1498
|
+
childEntries.push({
|
|
1526
1499
|
ancestorsAndSelf: [
|
|
1527
1500
|
{
|
|
1528
1501
|
type: "block",
|
|
@@ -1537,6 +1510,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1537
1510
|
}
|
|
1538
1511
|
}
|
|
1539
1512
|
}
|
|
1513
|
+
if (slots) {
|
|
1514
|
+
const slotKeys = Object.keys(slots);
|
|
1515
|
+
for (const slotKey of slotKeys) {
|
|
1516
|
+
const components = slots[slotKey];
|
|
1517
|
+
for (const enqueueingComponent of components) {
|
|
1518
|
+
const parentSlotIndexFn = () => {
|
|
1519
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1520
|
+
(x) => x === enqueueingComponent
|
|
1521
|
+
);
|
|
1522
|
+
return result;
|
|
1523
|
+
};
|
|
1524
|
+
childEntries.push({
|
|
1525
|
+
ancestorsAndSelf: [
|
|
1526
|
+
{
|
|
1527
|
+
type: "slot",
|
|
1528
|
+
node: enqueueingComponent,
|
|
1529
|
+
parentSlot: slotKey,
|
|
1530
|
+
parentSlotIndexFn
|
|
1531
|
+
},
|
|
1532
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1533
|
+
],
|
|
1534
|
+
context: descendantContext
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
if (order === "dfs") {
|
|
1540
|
+
childEntries.reverse();
|
|
1541
|
+
}
|
|
1542
|
+
componentQueue.push(...childEntries);
|
|
1540
1543
|
} while (componentQueue.length > 0);
|
|
1541
1544
|
}
|
|
1542
1545
|
function isNestedNodeType(type) {
|
package/dist/index.js
CHANGED
|
@@ -1446,7 +1446,7 @@ function hasReferencedVariables(value) {
|
|
|
1446
1446
|
|
|
1447
1447
|
// src/enhancement/walkNodeTree.ts
|
|
1448
1448
|
function walkNodeTree(node, visitor, options) {
|
|
1449
|
-
var _a, _b;
|
|
1449
|
+
var _a, _b, _c;
|
|
1450
1450
|
const componentQueue = [
|
|
1451
1451
|
{
|
|
1452
1452
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1454,12 +1454,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
];
|
|
1456
1456
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1457
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1458
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1457
1459
|
do {
|
|
1458
|
-
const currentQueueEntry =
|
|
1460
|
+
const currentQueueEntry = takeNext();
|
|
1459
1461
|
if (!currentQueueEntry) continue;
|
|
1460
1462
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1461
1463
|
let visitDescendants = true;
|
|
1462
|
-
let descendantContext = (
|
|
1464
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1463
1465
|
let visitorInfo;
|
|
1464
1466
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1465
1467
|
visitorInfo = {
|
|
@@ -1646,39 +1648,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1646
1648
|
continue;
|
|
1647
1649
|
}
|
|
1648
1650
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1649
|
-
|
|
1650
|
-
const slotKeys = Object.keys(slots);
|
|
1651
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1652
|
-
const slotKey = slotKeys[slotIndex];
|
|
1653
|
-
const components = slots[slotKey];
|
|
1654
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1655
|
-
const enqueueingComponent = components[componentIndex];
|
|
1656
|
-
const parentSlotIndexFn = () => {
|
|
1657
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1658
|
-
(x) => x === enqueueingComponent
|
|
1659
|
-
);
|
|
1660
|
-
return result;
|
|
1661
|
-
};
|
|
1662
|
-
componentQueue.push({
|
|
1663
|
-
ancestorsAndSelf: [
|
|
1664
|
-
{
|
|
1665
|
-
type: "slot",
|
|
1666
|
-
node: enqueueingComponent,
|
|
1667
|
-
parentSlot: slotKey,
|
|
1668
|
-
parentSlotIndexFn
|
|
1669
|
-
},
|
|
1670
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1671
|
-
],
|
|
1672
|
-
context: descendantContext
|
|
1673
|
-
});
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1651
|
+
const childEntries = [];
|
|
1677
1652
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1678
1653
|
if (properties) {
|
|
1679
1654
|
const propertyEntries = Object.entries(properties);
|
|
1680
|
-
for (
|
|
1681
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1655
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1682
1656
|
if (!isNestedNodeType(propObject.type)) {
|
|
1683
1657
|
continue;
|
|
1684
1658
|
}
|
|
@@ -1698,13 +1672,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1698
1672
|
continue;
|
|
1699
1673
|
}
|
|
1700
1674
|
}
|
|
1701
|
-
const blocks = (
|
|
1702
|
-
for (
|
|
1703
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1675
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1676
|
+
for (const enqueueingBlock of blocks) {
|
|
1704
1677
|
const blockIndexFn = () => {
|
|
1705
1678
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1706
1679
|
};
|
|
1707
|
-
|
|
1680
|
+
childEntries.push({
|
|
1708
1681
|
ancestorsAndSelf: [
|
|
1709
1682
|
{
|
|
1710
1683
|
type: "block",
|
|
@@ -1719,6 +1692,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1719
1692
|
}
|
|
1720
1693
|
}
|
|
1721
1694
|
}
|
|
1695
|
+
if (slots) {
|
|
1696
|
+
const slotKeys = Object.keys(slots);
|
|
1697
|
+
for (const slotKey of slotKeys) {
|
|
1698
|
+
const components = slots[slotKey];
|
|
1699
|
+
for (const enqueueingComponent of components) {
|
|
1700
|
+
const parentSlotIndexFn = () => {
|
|
1701
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1702
|
+
(x) => x === enqueueingComponent
|
|
1703
|
+
);
|
|
1704
|
+
return result;
|
|
1705
|
+
};
|
|
1706
|
+
childEntries.push({
|
|
1707
|
+
ancestorsAndSelf: [
|
|
1708
|
+
{
|
|
1709
|
+
type: "slot",
|
|
1710
|
+
node: enqueueingComponent,
|
|
1711
|
+
parentSlot: slotKey,
|
|
1712
|
+
parentSlotIndexFn
|
|
1713
|
+
},
|
|
1714
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1715
|
+
],
|
|
1716
|
+
context: descendantContext
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
if (order === "dfs") {
|
|
1722
|
+
childEntries.reverse();
|
|
1723
|
+
}
|
|
1724
|
+
componentQueue.push(...childEntries);
|
|
1722
1725
|
} while (componentQueue.length > 0);
|
|
1723
1726
|
}
|
|
1724
1727
|
function isNestedNodeType(type) {
|
package/dist/index.mjs
CHANGED
|
@@ -1264,7 +1264,7 @@ function hasReferencedVariables(value) {
|
|
|
1264
1264
|
|
|
1265
1265
|
// src/enhancement/walkNodeTree.ts
|
|
1266
1266
|
function walkNodeTree(node, visitor, options) {
|
|
1267
|
-
var _a, _b;
|
|
1267
|
+
var _a, _b, _c;
|
|
1268
1268
|
const componentQueue = [
|
|
1269
1269
|
{
|
|
1270
1270
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1272,12 +1272,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1272
1272
|
}
|
|
1273
1273
|
];
|
|
1274
1274
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1275
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1276
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1275
1277
|
do {
|
|
1276
|
-
const currentQueueEntry =
|
|
1278
|
+
const currentQueueEntry = takeNext();
|
|
1277
1279
|
if (!currentQueueEntry) continue;
|
|
1278
1280
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1279
1281
|
let visitDescendants = true;
|
|
1280
|
-
let descendantContext = (
|
|
1282
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1281
1283
|
let visitorInfo;
|
|
1282
1284
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1283
1285
|
visitorInfo = {
|
|
@@ -1464,39 +1466,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1464
1466
|
continue;
|
|
1465
1467
|
}
|
|
1466
1468
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1467
|
-
|
|
1468
|
-
const slotKeys = Object.keys(slots);
|
|
1469
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1470
|
-
const slotKey = slotKeys[slotIndex];
|
|
1471
|
-
const components = slots[slotKey];
|
|
1472
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1473
|
-
const enqueueingComponent = components[componentIndex];
|
|
1474
|
-
const parentSlotIndexFn = () => {
|
|
1475
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1476
|
-
(x) => x === enqueueingComponent
|
|
1477
|
-
);
|
|
1478
|
-
return result;
|
|
1479
|
-
};
|
|
1480
|
-
componentQueue.push({
|
|
1481
|
-
ancestorsAndSelf: [
|
|
1482
|
-
{
|
|
1483
|
-
type: "slot",
|
|
1484
|
-
node: enqueueingComponent,
|
|
1485
|
-
parentSlot: slotKey,
|
|
1486
|
-
parentSlotIndexFn
|
|
1487
|
-
},
|
|
1488
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1489
|
-
],
|
|
1490
|
-
context: descendantContext
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1469
|
+
const childEntries = [];
|
|
1495
1470
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1496
1471
|
if (properties) {
|
|
1497
1472
|
const propertyEntries = Object.entries(properties);
|
|
1498
|
-
for (
|
|
1499
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1473
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1500
1474
|
if (!isNestedNodeType(propObject.type)) {
|
|
1501
1475
|
continue;
|
|
1502
1476
|
}
|
|
@@ -1516,13 +1490,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1516
1490
|
continue;
|
|
1517
1491
|
}
|
|
1518
1492
|
}
|
|
1519
|
-
const blocks = (
|
|
1520
|
-
for (
|
|
1521
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1493
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1494
|
+
for (const enqueueingBlock of blocks) {
|
|
1522
1495
|
const blockIndexFn = () => {
|
|
1523
1496
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1524
1497
|
};
|
|
1525
|
-
|
|
1498
|
+
childEntries.push({
|
|
1526
1499
|
ancestorsAndSelf: [
|
|
1527
1500
|
{
|
|
1528
1501
|
type: "block",
|
|
@@ -1537,6 +1510,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1537
1510
|
}
|
|
1538
1511
|
}
|
|
1539
1512
|
}
|
|
1513
|
+
if (slots) {
|
|
1514
|
+
const slotKeys = Object.keys(slots);
|
|
1515
|
+
for (const slotKey of slotKeys) {
|
|
1516
|
+
const components = slots[slotKey];
|
|
1517
|
+
for (const enqueueingComponent of components) {
|
|
1518
|
+
const parentSlotIndexFn = () => {
|
|
1519
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1520
|
+
(x) => x === enqueueingComponent
|
|
1521
|
+
);
|
|
1522
|
+
return result;
|
|
1523
|
+
};
|
|
1524
|
+
childEntries.push({
|
|
1525
|
+
ancestorsAndSelf: [
|
|
1526
|
+
{
|
|
1527
|
+
type: "slot",
|
|
1528
|
+
node: enqueueingComponent,
|
|
1529
|
+
parentSlot: slotKey,
|
|
1530
|
+
parentSlotIndexFn
|
|
1531
|
+
},
|
|
1532
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1533
|
+
],
|
|
1534
|
+
context: descendantContext
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
if (order === "dfs") {
|
|
1540
|
+
childEntries.reverse();
|
|
1541
|
+
}
|
|
1542
|
+
componentQueue.push(...childEntries);
|
|
1540
1543
|
} while (componentQueue.length > 0);
|
|
1541
1544
|
}
|
|
1542
1545
|
function isNestedNodeType(type) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/canvas",
|
|
3
|
-
"version": "20.63.
|
|
3
|
+
"version": "20.63.1-alpha.18+1b83158795",
|
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,16 +33,15 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/retry": "0.12.5",
|
|
36
|
-
"lexical": "0.39.0",
|
|
37
36
|
"p-limit": "3.1.0",
|
|
38
37
|
"p-retry": "5.1.2",
|
|
39
38
|
"p-throttle": "5.0.0",
|
|
40
39
|
"svix": "1.71.0"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@uniformdev/assets": "20.63.
|
|
44
|
-
"@uniformdev/context": "20.63.
|
|
45
|
-
"@uniformdev/richtext": "20.63.
|
|
42
|
+
"@uniformdev/assets": "20.63.1-alpha.18+1b83158795",
|
|
43
|
+
"@uniformdev/context": "20.63.1-alpha.18+1b83158795",
|
|
44
|
+
"@uniformdev/richtext": "20.63.1-alpha.18+1b83158795",
|
|
46
45
|
"immer": "10.1.3"
|
|
47
46
|
},
|
|
48
47
|
"files": [
|
|
@@ -51,5 +50,5 @@
|
|
|
51
50
|
"publishConfig": {
|
|
52
51
|
"access": "public"
|
|
53
52
|
},
|
|
54
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "1b83158795e07165d1500b0c859c49c1e613eeda"
|
|
55
54
|
}
|