@pixldocs/canvas-renderer 0.5.85 → 0.5.86
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.cjs +36 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +36 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12345,7 +12345,8 @@ async function resolveTemplateData(options) {
|
|
|
12345
12345
|
nodeId: r.nodeId,
|
|
12346
12346
|
label: r.label,
|
|
12347
12347
|
minEntries: r.minEntries,
|
|
12348
|
-
maxEntries: r.maxEntries
|
|
12348
|
+
maxEntries: r.maxEntries,
|
|
12349
|
+
entryFilter: r.entryFilter
|
|
12349
12350
|
});
|
|
12350
12351
|
}
|
|
12351
12352
|
}
|
|
@@ -12468,13 +12469,42 @@ async function resolveFromForm(options) {
|
|
|
12468
12469
|
}
|
|
12469
12470
|
}
|
|
12470
12471
|
}
|
|
12472
|
+
const repeatableFromSchemaByBase = new Map(
|
|
12473
|
+
(repeatableFromSchema ?? []).map((r) => [baseId(r.nodeId), r])
|
|
12474
|
+
);
|
|
12471
12475
|
const topLevelRepeatables = inferredSections.filter((s) => s.type === "repeatable" && !s.parentId).map((s) => {
|
|
12472
12476
|
const entries = mergedSectionState[s.id] ?? [];
|
|
12473
12477
|
const nodeId = s.treeNodeId ?? s.id;
|
|
12474
|
-
|
|
12478
|
+
const schemaRepeatable = repeatableFromSchemaByBase.get(baseId(nodeId));
|
|
12479
|
+
return { nodeId, label: s.label, entryCount: Math.max(1, entries.length), entryFilter: schemaRepeatable == null ? void 0 : schemaRepeatable.entryFilter };
|
|
12480
|
+
});
|
|
12481
|
+
const nestedRepeatables = inferredSections.filter((s) => s.type === "repeatable" && s.parentId != null).map((s) => {
|
|
12482
|
+
const nodeId = s.treeNodeId ?? s.id;
|
|
12483
|
+
const schemaRepeatable = repeatableFromSchemaByBase.get(baseId(nodeId));
|
|
12484
|
+
return { nodeId, label: s.label, entryFilter: schemaRepeatable == null ? void 0 : schemaRepeatable.entryFilter };
|
|
12475
12485
|
});
|
|
12476
|
-
const
|
|
12477
|
-
const
|
|
12486
|
+
const inferredRepeatableList = [...topLevelRepeatables, ...nestedRepeatables];
|
|
12487
|
+
const entryCountForLabel = (label) => {
|
|
12488
|
+
const normalized = label.trim().toLowerCase();
|
|
12489
|
+
for (const item of inferredRepeatableList) {
|
|
12490
|
+
if (item.label.trim().toLowerCase() !== normalized) continue;
|
|
12491
|
+
const count = item.entryCount;
|
|
12492
|
+
if (typeof count === "number") return count;
|
|
12493
|
+
}
|
|
12494
|
+
return void 0;
|
|
12495
|
+
};
|
|
12496
|
+
const fallbackRepeatableList = (repeatableFromSchema ?? []).map((r) => ({
|
|
12497
|
+
nodeId: r.nodeId,
|
|
12498
|
+
label: r.label,
|
|
12499
|
+
entryFilter: r.entryFilter,
|
|
12500
|
+
entryCount: entryCountForLabel(r.label)
|
|
12501
|
+
}));
|
|
12502
|
+
const repeatableList = inferredRepeatableList.length > 0 ? [
|
|
12503
|
+
...inferredRepeatableList,
|
|
12504
|
+
...fallbackRepeatableList.filter(
|
|
12505
|
+
(fallback) => !inferredRepeatableList.some((r) => baseId(r.nodeId) === baseId(fallback.nodeId))
|
|
12506
|
+
)
|
|
12507
|
+
] : fallbackRepeatableList;
|
|
12478
12508
|
const repeatableNestedEntryCounts = {};
|
|
12479
12509
|
for (const s of inferredSections) {
|
|
12480
12510
|
if (s.type !== "repeatable") continue;
|
|
@@ -12692,6 +12722,7 @@ function paintRepeatableSections(config, repeatableSections) {
|
|
|
12692
12722
|
const payload = { label: section.label };
|
|
12693
12723
|
if (section.minEntries !== void 0) payload.minEntries = section.minEntries;
|
|
12694
12724
|
if (section.maxEntries !== void 0) payload.maxEntries = section.maxEntries;
|
|
12725
|
+
if (section.entryFilter !== void 0) payload.entryFilter = section.entryFilter;
|
|
12695
12726
|
for (const page of pages) {
|
|
12696
12727
|
if (setRepeatable(page.children ?? [], section.nodeId, payload)) break;
|
|
12697
12728
|
}
|
|
@@ -12887,7 +12918,7 @@ function PixldocsPreview(props) {
|
|
|
12887
12918
|
!canvasSettled && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12888
12919
|
] });
|
|
12889
12920
|
}
|
|
12890
|
-
const PACKAGE_VERSION = "0.5.
|
|
12921
|
+
const PACKAGE_VERSION = "0.5.86";
|
|
12891
12922
|
const roundParityValue = (value) => {
|
|
12892
12923
|
if (typeof value !== "number") return value;
|
|
12893
12924
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|