@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.d.ts
CHANGED
|
@@ -256,7 +256,7 @@ export declare function normalizeFontFamily(fontStack: string): string;
|
|
|
256
256
|
* Package version banner. Bump alongside package.json so we can confirm
|
|
257
257
|
* (via browser:log) that the deployed bundle matches the expected build.
|
|
258
258
|
*/
|
|
259
|
-
export declare const PACKAGE_VERSION = "0.5.
|
|
259
|
+
export declare const PACKAGE_VERSION = "0.5.86";
|
|
260
260
|
|
|
261
261
|
export declare interface PageSettings {
|
|
262
262
|
backgroundColor?: string;
|
|
@@ -584,6 +584,10 @@ export declare interface ResolveFromFormOptions {
|
|
|
584
584
|
label: string;
|
|
585
585
|
minEntries?: number;
|
|
586
586
|
maxEntries?: number;
|
|
587
|
+
entryFilter?: {
|
|
588
|
+
mode: 'all' | 'range';
|
|
589
|
+
range?: string;
|
|
590
|
+
};
|
|
587
591
|
}[];
|
|
588
592
|
repeatablePages?: unknown[];
|
|
589
593
|
dynamicFields?: DynamicField[];
|
package/dist/index.js
CHANGED
|
@@ -12326,7 +12326,8 @@ async function resolveTemplateData(options) {
|
|
|
12326
12326
|
nodeId: r.nodeId,
|
|
12327
12327
|
label: r.label,
|
|
12328
12328
|
minEntries: r.minEntries,
|
|
12329
|
-
maxEntries: r.maxEntries
|
|
12329
|
+
maxEntries: r.maxEntries,
|
|
12330
|
+
entryFilter: r.entryFilter
|
|
12330
12331
|
});
|
|
12331
12332
|
}
|
|
12332
12333
|
}
|
|
@@ -12449,13 +12450,42 @@ async function resolveFromForm(options) {
|
|
|
12449
12450
|
}
|
|
12450
12451
|
}
|
|
12451
12452
|
}
|
|
12453
|
+
const repeatableFromSchemaByBase = new Map(
|
|
12454
|
+
(repeatableFromSchema ?? []).map((r) => [baseId(r.nodeId), r])
|
|
12455
|
+
);
|
|
12452
12456
|
const topLevelRepeatables = inferredSections.filter((s) => s.type === "repeatable" && !s.parentId).map((s) => {
|
|
12453
12457
|
const entries = mergedSectionState[s.id] ?? [];
|
|
12454
12458
|
const nodeId = s.treeNodeId ?? s.id;
|
|
12455
|
-
|
|
12459
|
+
const schemaRepeatable = repeatableFromSchemaByBase.get(baseId(nodeId));
|
|
12460
|
+
return { nodeId, label: s.label, entryCount: Math.max(1, entries.length), entryFilter: schemaRepeatable == null ? void 0 : schemaRepeatable.entryFilter };
|
|
12461
|
+
});
|
|
12462
|
+
const nestedRepeatables = inferredSections.filter((s) => s.type === "repeatable" && s.parentId != null).map((s) => {
|
|
12463
|
+
const nodeId = s.treeNodeId ?? s.id;
|
|
12464
|
+
const schemaRepeatable = repeatableFromSchemaByBase.get(baseId(nodeId));
|
|
12465
|
+
return { nodeId, label: s.label, entryFilter: schemaRepeatable == null ? void 0 : schemaRepeatable.entryFilter };
|
|
12456
12466
|
});
|
|
12457
|
-
const
|
|
12458
|
-
const
|
|
12467
|
+
const inferredRepeatableList = [...topLevelRepeatables, ...nestedRepeatables];
|
|
12468
|
+
const entryCountForLabel = (label) => {
|
|
12469
|
+
const normalized = label.trim().toLowerCase();
|
|
12470
|
+
for (const item of inferredRepeatableList) {
|
|
12471
|
+
if (item.label.trim().toLowerCase() !== normalized) continue;
|
|
12472
|
+
const count = item.entryCount;
|
|
12473
|
+
if (typeof count === "number") return count;
|
|
12474
|
+
}
|
|
12475
|
+
return void 0;
|
|
12476
|
+
};
|
|
12477
|
+
const fallbackRepeatableList = (repeatableFromSchema ?? []).map((r) => ({
|
|
12478
|
+
nodeId: r.nodeId,
|
|
12479
|
+
label: r.label,
|
|
12480
|
+
entryFilter: r.entryFilter,
|
|
12481
|
+
entryCount: entryCountForLabel(r.label)
|
|
12482
|
+
}));
|
|
12483
|
+
const repeatableList = inferredRepeatableList.length > 0 ? [
|
|
12484
|
+
...inferredRepeatableList,
|
|
12485
|
+
...fallbackRepeatableList.filter(
|
|
12486
|
+
(fallback) => !inferredRepeatableList.some((r) => baseId(r.nodeId) === baseId(fallback.nodeId))
|
|
12487
|
+
)
|
|
12488
|
+
] : fallbackRepeatableList;
|
|
12459
12489
|
const repeatableNestedEntryCounts = {};
|
|
12460
12490
|
for (const s of inferredSections) {
|
|
12461
12491
|
if (s.type !== "repeatable") continue;
|
|
@@ -12673,6 +12703,7 @@ function paintRepeatableSections(config, repeatableSections) {
|
|
|
12673
12703
|
const payload = { label: section.label };
|
|
12674
12704
|
if (section.minEntries !== void 0) payload.minEntries = section.minEntries;
|
|
12675
12705
|
if (section.maxEntries !== void 0) payload.maxEntries = section.maxEntries;
|
|
12706
|
+
if (section.entryFilter !== void 0) payload.entryFilter = section.entryFilter;
|
|
12676
12707
|
for (const page of pages) {
|
|
12677
12708
|
if (setRepeatable(page.children ?? [], section.nodeId, payload)) break;
|
|
12678
12709
|
}
|
|
@@ -12868,7 +12899,7 @@ function PixldocsPreview(props) {
|
|
|
12868
12899
|
!canvasSettled && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", minHeight: 200 }, children: /* @__PURE__ */ jsx("div", { style: { color: "#888", fontSize: 14 }, children: "Loading preview..." }) })
|
|
12869
12900
|
] });
|
|
12870
12901
|
}
|
|
12871
|
-
const PACKAGE_VERSION = "0.5.
|
|
12902
|
+
const PACKAGE_VERSION = "0.5.86";
|
|
12872
12903
|
const roundParityValue = (value) => {
|
|
12873
12904
|
if (typeof value !== "number") return value;
|
|
12874
12905
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|