@printwithsynergy/artwork-pdf-editor 0.2.0 → 0.4.0
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/LICENSE +62 -0
- package/dist/components/AccessibilityHintsPanel.d.ts +142 -0
- package/dist/components/AccessibilityHintsPanel.d.ts.map +1 -0
- package/dist/components/AccessibilityHintsPanel.js +158 -0
- package/dist/components/AccessibilityHintsPanel.js.map +1 -0
- package/dist/components/AnnotationOverlay.d.ts +142 -0
- package/dist/components/AnnotationOverlay.d.ts.map +1 -0
- package/dist/components/AnnotationOverlay.js +141 -0
- package/dist/components/AnnotationOverlay.js.map +1 -0
- package/dist/components/AnnotationsSidebar.d.ts +98 -0
- package/dist/components/AnnotationsSidebar.d.ts.map +1 -0
- package/dist/components/AnnotationsSidebar.js +100 -0
- package/dist/components/AnnotationsSidebar.js.map +1 -0
- package/dist/components/BarcodeGeneratorPanel.d.ts +58 -0
- package/dist/components/BarcodeGeneratorPanel.d.ts.map +1 -0
- package/dist/components/BarcodeGeneratorPanel.js +91 -0
- package/dist/components/BarcodeGeneratorPanel.js.map +1 -0
- package/dist/components/BraillePanel.d.ts +99 -0
- package/dist/components/BraillePanel.d.ts.map +1 -0
- package/dist/components/BraillePanel.js +221 -0
- package/dist/components/BraillePanel.js.map +1 -0
- package/dist/components/BrandAssetsPanel.d.ts +130 -0
- package/dist/components/BrandAssetsPanel.d.ts.map +1 -0
- package/dist/components/BrandAssetsPanel.js +125 -0
- package/dist/components/BrandAssetsPanel.js.map +1 -0
- package/dist/components/BrandConsistencyPanel.d.ts +140 -0
- package/dist/components/BrandConsistencyPanel.d.ts.map +1 -0
- package/dist/components/BrandConsistencyPanel.js +158 -0
- package/dist/components/BrandConsistencyPanel.js.map +1 -0
- package/dist/components/ComplianceFindingsPanel.d.ts +62 -0
- package/dist/components/ComplianceFindingsPanel.d.ts.map +1 -0
- package/dist/components/ComplianceFindingsPanel.js +118 -0
- package/dist/components/ComplianceFindingsPanel.js.map +1 -0
- package/dist/components/DesignSuggestionsPanel.d.ts +148 -0
- package/dist/components/DesignSuggestionsPanel.d.ts.map +1 -0
- package/dist/components/DesignSuggestionsPanel.js +154 -0
- package/dist/components/DesignSuggestionsPanel.js.map +1 -0
- package/dist/components/DielineParametersPanel.d.ts +62 -0
- package/dist/components/DielineParametersPanel.d.ts.map +1 -0
- package/dist/components/DielineParametersPanel.js +170 -0
- package/dist/components/DielineParametersPanel.js.map +1 -0
- package/dist/components/DielinePreview.d.ts +150 -0
- package/dist/components/DielinePreview.d.ts.map +1 -0
- package/dist/components/DielinePreview.js +146 -0
- package/dist/components/DielinePreview.js.map +1 -0
- package/dist/components/EditorApp.d.ts +18 -3
- package/dist/components/EditorApp.d.ts.map +1 -1
- package/dist/components/EditorApp.js +42 -7
- package/dist/components/EditorApp.js.map +1 -1
- package/dist/components/EditorCanvas.d.ts +31 -2
- package/dist/components/EditorCanvas.d.ts.map +1 -1
- package/dist/components/EditorCanvas.js +97 -16
- package/dist/components/EditorCanvas.js.map +1 -1
- package/dist/components/EmailNotifyPanel.d.ts +165 -0
- package/dist/components/EmailNotifyPanel.d.ts.map +1 -0
- package/dist/components/EmailNotifyPanel.js +211 -0
- package/dist/components/EmailNotifyPanel.js.map +1 -0
- package/dist/components/FileDropZone.d.ts +9 -1
- package/dist/components/FileDropZone.d.ts.map +1 -1
- package/dist/components/FileDropZone.js +53 -5
- package/dist/components/FileDropZone.js.map +1 -1
- package/dist/components/FoldEditorPanel.d.ts +68 -0
- package/dist/components/FoldEditorPanel.d.ts.map +1 -0
- package/dist/components/FoldEditorPanel.js +65 -0
- package/dist/components/FoldEditorPanel.js.map +1 -0
- package/dist/components/FoldPreviewOverlay.d.ts +48 -0
- package/dist/components/FoldPreviewOverlay.d.ts.map +1 -0
- package/dist/components/FoldPreviewOverlay.js +182 -0
- package/dist/components/FoldPreviewOverlay.js.map +1 -0
- package/dist/components/Gs1DigitalLinkPanel.d.ts +103 -0
- package/dist/components/Gs1DigitalLinkPanel.d.ts.map +1 -0
- package/dist/components/Gs1DigitalLinkPanel.js +199 -0
- package/dist/components/Gs1DigitalLinkPanel.js.map +1 -0
- package/dist/components/HistoryPanel.d.ts +39 -0
- package/dist/components/HistoryPanel.d.ts.map +1 -0
- package/dist/components/HistoryPanel.js +72 -0
- package/dist/components/HistoryPanel.js.map +1 -0
- package/dist/components/IccSoftProofOverlay.d.ts +67 -0
- package/dist/components/IccSoftProofOverlay.d.ts.map +1 -0
- package/dist/components/IccSoftProofOverlay.js +119 -0
- package/dist/components/IccSoftProofOverlay.js.map +1 -0
- package/dist/components/ImposePanel.d.ts +71 -0
- package/dist/components/ImposePanel.d.ts.map +1 -0
- package/dist/components/ImposePanel.js +127 -0
- package/dist/components/ImposePanel.js.map +1 -0
- package/dist/components/InksPanel.d.ts +61 -0
- package/dist/components/InksPanel.d.ts.map +1 -0
- package/dist/components/InksPanel.js +84 -0
- package/dist/components/InksPanel.js.map +1 -0
- package/dist/components/JobSetupPanel.d.ts +118 -0
- package/dist/components/JobSetupPanel.d.ts.map +1 -0
- package/dist/components/JobSetupPanel.js +169 -0
- package/dist/components/JobSetupPanel.js.map +1 -0
- package/dist/components/LayersPanel.d.ts.map +1 -1
- package/dist/components/LayersPanel.js +1 -0
- package/dist/components/LayersPanel.js.map +1 -1
- package/dist/components/MarkLibraryPanel.d.ts +131 -0
- package/dist/components/MarkLibraryPanel.d.ts.map +1 -0
- package/dist/components/MarkLibraryPanel.js +184 -0
- package/dist/components/MarkLibraryPanel.js.map +1 -0
- package/dist/components/MisEstimateButton.d.ts +73 -0
- package/dist/components/MisEstimateButton.d.ts.map +1 -0
- package/dist/components/MisEstimateButton.js +57 -0
- package/dist/components/MisEstimateButton.js.map +1 -0
- package/dist/components/NutritionPanel.d.ts +118 -0
- package/dist/components/NutritionPanel.d.ts.map +1 -0
- package/dist/components/NutritionPanel.js +169 -0
- package/dist/components/NutritionPanel.js.map +1 -0
- package/dist/components/PageNavigator.d.ts.map +1 -1
- package/dist/components/PageNavigator.js +6 -1
- package/dist/components/PageNavigator.js.map +1 -1
- package/dist/components/PaletteManager.d.ts +32 -0
- package/dist/components/PaletteManager.d.ts.map +1 -0
- package/dist/components/PaletteManager.js +89 -0
- package/dist/components/PaletteManager.js.map +1 -0
- package/dist/components/PaletteToSpotPanel.d.ts +122 -0
- package/dist/components/PaletteToSpotPanel.d.ts.map +1 -0
- package/dist/components/PaletteToSpotPanel.js +160 -0
- package/dist/components/PaletteToSpotPanel.js.map +1 -0
- package/dist/components/PreflightAutoFixPanel.d.ts +110 -0
- package/dist/components/PreflightAutoFixPanel.d.ts.map +1 -0
- package/dist/components/PreflightAutoFixPanel.js +119 -0
- package/dist/components/PreflightAutoFixPanel.js.map +1 -0
- package/dist/components/PreflightDiffPanel.d.ts +127 -0
- package/dist/components/PreflightDiffPanel.d.ts.map +1 -0
- package/dist/components/PreflightDiffPanel.js +0 -0
- package/dist/components/PreflightDiffPanel.js.map +1 -0
- package/dist/components/ProcessRulesPanel.d.ts +81 -0
- package/dist/components/ProcessRulesPanel.d.ts.map +1 -0
- package/dist/components/ProcessRulesPanel.js +143 -0
- package/dist/components/ProcessRulesPanel.js.map +1 -0
- package/dist/components/SlackNotifyPanel.d.ts +139 -0
- package/dist/components/SlackNotifyPanel.d.ts.map +1 -0
- package/dist/components/SlackNotifyPanel.js +133 -0
- package/dist/components/SlackNotifyPanel.js.map +1 -0
- package/dist/components/SmartSpotMatchPanel.d.ts +143 -0
- package/dist/components/SmartSpotMatchPanel.d.ts.map +1 -0
- package/dist/components/SmartSpotMatchPanel.js +159 -0
- package/dist/components/SmartSpotMatchPanel.js.map +1 -0
- package/dist/components/StreamingRenderProgress.d.ts +60 -0
- package/dist/components/StreamingRenderProgress.d.ts.map +1 -0
- package/dist/components/StreamingRenderProgress.js +99 -0
- package/dist/components/StreamingRenderProgress.js.map +1 -0
- package/dist/components/SwatchesPicker.d.ts +83 -0
- package/dist/components/SwatchesPicker.d.ts.map +1 -0
- package/dist/components/SwatchesPicker.js +151 -0
- package/dist/components/SwatchesPicker.js.map +1 -0
- package/dist/components/TacOverlay.d.ts +47 -0
- package/dist/components/TacOverlay.d.ts.map +1 -0
- package/dist/components/TacOverlay.js +116 -0
- package/dist/components/TacOverlay.js.map +1 -0
- package/dist/components/TrapEditorPanel.d.ts +52 -0
- package/dist/components/TrapEditorPanel.d.ts.map +1 -0
- package/dist/components/TrapEditorPanel.js +64 -0
- package/dist/components/TrapEditorPanel.js.map +1 -0
- package/dist/components/TrapPreviewOverlay.d.ts +64 -0
- package/dist/components/TrapPreviewOverlay.d.ts.map +1 -0
- package/dist/components/TrapPreviewOverlay.js +120 -0
- package/dist/components/TrapPreviewOverlay.js.map +1 -0
- package/dist/components/VariantMatrixPanel.d.ts +61 -0
- package/dist/components/VariantMatrixPanel.d.ts.map +1 -0
- package/dist/components/VariantMatrixPanel.js +97 -0
- package/dist/components/VariantMatrixPanel.js.map +1 -0
- package/dist/components/VariantMatrixVersionPanel.d.ts +122 -0
- package/dist/components/VariantMatrixVersionPanel.d.ts.map +1 -0
- package/dist/components/VariantMatrixVersionPanel.js +162 -0
- package/dist/components/VariantMatrixVersionPanel.js.map +1 -0
- package/dist/components/WebhookNotifyPanel.d.ts +160 -0
- package/dist/components/WebhookNotifyPanel.d.ts.map +1 -0
- package/dist/components/WebhookNotifyPanel.js +100 -0
- package/dist/components/WebhookNotifyPanel.js.map +1 -0
- package/dist/components/WhiteUnderbasePanel.d.ts +107 -0
- package/dist/components/WhiteUnderbasePanel.d.ts.map +1 -0
- package/dist/components/WhiteUnderbasePanel.js +104 -0
- package/dist/components/WhiteUnderbasePanel.js.map +1 -0
- package/dist/hooks/useEditorMode.d.ts +25 -5
- package/dist/hooks/useEditorMode.d.ts.map +1 -1
- package/dist/hooks/useEditorMode.js +18 -5
- package/dist/hooks/useEditorMode.js.map +1 -1
- package/dist/index.d.ts +51 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -2
- package/dist/index.js.map +1 -1
- package/dist/lens/preflight-findings.d.ts.map +1 -1
- package/dist/lens/preflight-findings.js.map +1 -1
- package/dist/lib/barcode-scan.d.ts +154 -0
- package/dist/lib/barcode-scan.d.ts.map +1 -0
- package/dist/lib/barcode-scan.js +152 -0
- package/dist/lib/barcode-scan.js.map +1 -0
- package/dist/lib/color-math.d.ts +76 -0
- package/dist/lib/color-math.d.ts.map +1 -0
- package/dist/lib/color-math.js +96 -0
- package/dist/lib/color-math.js.map +1 -0
- package/dist/lib/dieline-template.d.ts +87 -0
- package/dist/lib/dieline-template.d.ts.map +1 -1
- package/dist/lib/dieline-template.js +163 -0
- package/dist/lib/dieline-template.js.map +1 -1
- package/dist/lib/editor-config.d.ts +390 -0
- package/dist/lib/editor-config.d.ts.map +1 -1
- package/dist/lib/editor-config.js +90 -0
- package/dist/lib/editor-config.js.map +1 -1
- package/dist/lib/fold-geometry.d.ts +144 -0
- package/dist/lib/fold-geometry.d.ts.map +1 -0
- package/dist/lib/fold-geometry.js +138 -0
- package/dist/lib/fold-geometry.js.map +1 -0
- package/dist/lib/merge-tokens.d.ts +81 -0
- package/dist/lib/merge-tokens.d.ts.map +1 -0
- package/dist/lib/merge-tokens.js +88 -0
- package/dist/lib/merge-tokens.js.map +1 -0
- package/dist/lib/palette-registry.d.ts +40 -0
- package/dist/lib/palette-registry.d.ts.map +1 -0
- package/dist/lib/palette-registry.js +50 -0
- package/dist/lib/palette-registry.js.map +1 -0
- package/dist/lib/panel-anchor.d.ts +101 -0
- package/dist/lib/panel-anchor.d.ts.map +1 -0
- package/dist/lib/panel-anchor.js +68 -0
- package/dist/lib/panel-anchor.js.map +1 -0
- package/dist/lib/preflight/checks.d.ts.map +1 -1
- package/dist/lib/preflight/checks.js +71 -0
- package/dist/lib/preflight/checks.js.map +1 -1
- package/dist/lib/preflight/types.d.ts.map +1 -1
- package/dist/lib/preflight/types.js +11 -0
- package/dist/lib/preflight/types.js.map +1 -1
- package/dist/lib/rasterize.d.ts +93 -0
- package/dist/lib/rasterize.d.ts.map +1 -0
- package/dist/lib/rasterize.js +117 -0
- package/dist/lib/rasterize.js.map +1 -0
- package/dist/lib/separations-registry.d.ts +99 -0
- package/dist/lib/separations-registry.d.ts.map +1 -0
- package/dist/lib/separations-registry.js +59 -0
- package/dist/lib/separations-registry.js.map +1 -0
- package/dist/lib/streaming-render.d.ts +100 -0
- package/dist/lib/streaming-render.d.ts.map +1 -0
- package/dist/lib/streaming-render.js +132 -0
- package/dist/lib/streaming-render.js.map +1 -0
- package/dist/lib/unwired.d.ts +29 -0
- package/dist/lib/unwired.d.ts.map +1 -0
- package/dist/lib/unwired.js +58 -0
- package/dist/lib/unwired.js.map +1 -0
- package/package.json +20 -11
- package/dist/components/SeparationsPanel.d.ts +0 -9
- package/dist/components/SeparationsPanel.d.ts.map +0 -1
- package/dist/components/SeparationsPanel.js +0 -168
- package/dist/components/SeparationsPanel.js.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
import { isUnwired } from "./unwired";
|
|
2
3
|
/**
|
|
3
4
|
* Default flag set — every feature on. Hosts that want a minimal
|
|
4
5
|
* embed (e.g. an inline `<EditorApp>` on a landing page) layer their
|
|
@@ -30,9 +31,55 @@ export const DEFAULT_EDITOR_CONFIG = {
|
|
|
30
31
|
// Panels
|
|
31
32
|
enable_layers_panel: true,
|
|
32
33
|
enable_preflight_banner: true,
|
|
34
|
+
enable_palettes: true,
|
|
35
|
+
enable_separations: true,
|
|
36
|
+
enable_dieline_parameters: true,
|
|
37
|
+
enable_dieline_preview: true,
|
|
38
|
+
enable_inks_panel: true,
|
|
39
|
+
enable_swatches: true,
|
|
40
|
+
enable_white_underbase: true,
|
|
41
|
+
enable_streaming_render: true,
|
|
42
|
+
enable_panel_anchored_objects: true,
|
|
43
|
+
enable_compliance_panel: true,
|
|
44
|
+
enable_process_rules_panel: true,
|
|
45
|
+
enable_preflight_diff: true,
|
|
46
|
+
enable_brand_assets_panel: true,
|
|
47
|
+
enable_history: true,
|
|
48
|
+
enable_dieline_import: true,
|
|
49
|
+
enable_annotation_overlay: true,
|
|
50
|
+
enable_variant_matrix_versions: true,
|
|
51
|
+
enable_mark_library: true,
|
|
52
|
+
enable_slack_notify: true,
|
|
53
|
+
enable_preflight_autofix: true,
|
|
54
|
+
enable_smart_spot_match: true,
|
|
55
|
+
enable_design_suggestions: true,
|
|
56
|
+
enable_annotations_sidebar: true,
|
|
57
|
+
enable_brand_consistency: true,
|
|
58
|
+
enable_webhook_notify: true,
|
|
59
|
+
enable_email_notify: true,
|
|
60
|
+
enable_accessibility_hints: true,
|
|
61
|
+
enable_palette_to_spot: true,
|
|
62
|
+
// Job setup
|
|
63
|
+
enable_print_context: true,
|
|
33
64
|
// Canvas
|
|
34
65
|
enable_canvas_grid: true,
|
|
35
66
|
enable_bleed_visualization: true,
|
|
67
|
+
enable_total_ink_coverage_live: true,
|
|
68
|
+
enable_trap_preview: true,
|
|
69
|
+
enable_trap_editor: true,
|
|
70
|
+
enable_impose: true,
|
|
71
|
+
enable_3d_fold_preview: true,
|
|
72
|
+
enable_fold_editor: true,
|
|
73
|
+
enable_mis_estimate: true,
|
|
74
|
+
enable_process_preflight: true,
|
|
75
|
+
enable_soft_proof: true,
|
|
76
|
+
enable_variant_matrix: true,
|
|
77
|
+
enable_barcode_generate: true,
|
|
78
|
+
enable_barcode_validation: true,
|
|
79
|
+
enable_gs1_digital_link: true,
|
|
80
|
+
enable_nutrition_panel: true,
|
|
81
|
+
enable_braille_panel: true,
|
|
82
|
+
enable_variable_data_merge: true,
|
|
36
83
|
};
|
|
37
84
|
/**
|
|
38
85
|
* Basic-mode preset: hides the heavyweight pro panels and the source
|
|
@@ -61,4 +108,47 @@ export function resolveConfig(mode, instanceOverrides) {
|
|
|
61
108
|
const modeOverrides = mode === "basic" ? BASIC_MODE_OVERRIDES : PRO_MODE_OVERRIDES;
|
|
62
109
|
return { ...DEFAULT_EDITOR_CONFIG, ...modeOverrides, ...instanceOverrides };
|
|
63
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolve whether a feature should be visible right now.
|
|
113
|
+
*
|
|
114
|
+
* Evaluates four gates and returns true iff *all* are open:
|
|
115
|
+
* 1. `enable_<f>` is not explicitly `false`.
|
|
116
|
+
* 2. `plan_gates[f]` is not explicitly `false` (absent = open).
|
|
117
|
+
* 3. `capabilities[f]` is not explicitly `false` (absent = open).
|
|
118
|
+
* 4. `f` hasn't been marked unwired via
|
|
119
|
+
* {@link import("./unwired").markUnwired}.
|
|
120
|
+
*
|
|
121
|
+
* Use this at every render site that gates a feature; the four-layer
|
|
122
|
+
* separation lets hosts distinguish "we hid it" from "the plan
|
|
123
|
+
* doesn't include it" from "the backend can't do it right now" from
|
|
124
|
+
* "the editor build doesn't ship this UI yet" without losing the
|
|
125
|
+
* underlying boolean flag.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export function showFeature(cfg, f) {
|
|
130
|
+
const enabled = cfg[`enable_${f}`] !== false;
|
|
131
|
+
const plan = cfg.plan_gates?.[f] !== false;
|
|
132
|
+
const capable = cfg.capabilities?.[f] !== false;
|
|
133
|
+
const wired = !isUnwired(f);
|
|
134
|
+
return enabled && plan && capable && wired;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Resolve whether a palette should render.
|
|
138
|
+
*
|
|
139
|
+
* Two gates:
|
|
140
|
+
* 1. `enable_palettes` is not explicitly `false`. When the
|
|
141
|
+
* palettes feature is off, *all* palettes are forced visible —
|
|
142
|
+
* the visibility map is a UI toggle, not a kill switch, so
|
|
143
|
+
* hiding the toggle UI must not silently hide content.
|
|
144
|
+
* 2. `panelVisibility[id]` is not explicitly `false` (absent or
|
|
145
|
+
* `true` means visible).
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
export function isPanelVisible(cfg, id) {
|
|
150
|
+
if (cfg.enable_palettes === false)
|
|
151
|
+
return true;
|
|
152
|
+
return cfg.panelVisibility?.[id] !== false;
|
|
153
|
+
}
|
|
64
154
|
//# sourceMappingURL=editor-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-config.js","sourceRoot":"","sources":["../../src/lib/editor-config.ts"],"names":[],"mappings":"AAAA,6CAA6C;
|
|
1
|
+
{"version":3,"file":"editor-config.js","sourceRoot":"","sources":["../../src/lib/editor-config.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAwbtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IACjD,SAAS;IACT,iBAAiB,EAAE,IAAI;IACvB,oBAAoB,EAAE,IAAI;IAC1B,kBAAkB,EAAE,IAAI;IACxB,kBAAkB,EAAE,IAAI;IACxB,sBAAsB,EAAE,IAAI;IAC5B,iBAAiB,EAAE,IAAI;IACvB,UAAU;IACV,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,IAAI;IACzB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,gBAAgB,EAAE,IAAI;IACtB,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,IAAI;IAC3B,kBAAkB,EAAE,IAAI;IACxB,oBAAoB,EAAE,IAAI;IAC1B,sBAAsB,EAAE,IAAI;IAC5B,kBAAkB,EAAE,IAAI;IACxB,SAAS;IACT,mBAAmB,EAAE,IAAI;IACzB,uBAAuB,EAAE,IAAI;IAC7B,eAAe,EAAE,IAAI;IACrB,kBAAkB,EAAE,IAAI;IACxB,yBAAyB,EAAE,IAAI;IAC/B,sBAAsB,EAAE,IAAI;IAC5B,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,sBAAsB,EAAE,IAAI;IAC5B,uBAAuB,EAAE,IAAI;IAC7B,6BAA6B,EAAE,IAAI;IACnC,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EAAE,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAqB,EACrB,iBAAyC;IAEzC,MAAM,aAAa,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,kBAAkB,CAAC;IACnF,OAAO,EAAE,GAAG,qBAAqB,EAAE,GAAG,aAAa,EAAE,GAAG,iBAAiB,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW,CAAC,GAAiB,EAAE,CAAa;IAC1D,MAAM,OAAO,GAAG,GAAG,CAAC,UAAU,CAAC,EAAwB,CAAC,KAAK,KAAK,CAAC;IACnE,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC;IAC3C,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC;IAChD,MAAM,KAAK,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,OAAO,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,GAAiB,EAAE,EAAa;IAC7D,IAAI,GAAG,CAAC,eAAe,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,GAAG,CAAC,eAAe,EAAE,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor-side structural mirror of `@artworkpdf/document-model`'s
|
|
3
|
+
* `FoldGeometryPanel`. Kept inline so the editor-app package stays
|
|
4
|
+
* consumable by hosts that don't pull document-model in — the wire
|
|
5
|
+
* shape is structurally compatible.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type FoldGeometryPanel = {
|
|
10
|
+
id: string;
|
|
11
|
+
pathData: string;
|
|
12
|
+
bbox: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
role?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Editor-side structural mirror of `@artworkpdf/document-model`'s
|
|
23
|
+
* `FoldGeometryPanelMetadata`.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export type FoldGeometryPanelMetadata = {
|
|
28
|
+
panels: FoldGeometryPanel[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Editor-side structural mirror of `@artworkpdf/document-model`'s
|
|
32
|
+
* `FoldGeometryEdge`.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export type FoldGeometryEdge = {
|
|
37
|
+
id: string;
|
|
38
|
+
panelA: string;
|
|
39
|
+
panelB: string;
|
|
40
|
+
angleDeg: number;
|
|
41
|
+
direction?: "mountain" | "valley";
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Editor-side structural mirror of `@artworkpdf/document-model`'s
|
|
45
|
+
* `FoldGeometryConfig`.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export type FoldGeometryConfig = {
|
|
50
|
+
edges: FoldGeometryEdge[];
|
|
51
|
+
defaultAngleDeg?: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* S4 — fold-geometry math.
|
|
55
|
+
*
|
|
56
|
+
* Pure functions that convert a {@link FoldGeometryPanelMetadata} + {@link FoldGeometryConfig}
|
|
57
|
+
* pair into the data a 3D renderer needs to draw a folded carton:
|
|
58
|
+
* per-panel quads in 3D space, and per-edge hinge axes.
|
|
59
|
+
*
|
|
60
|
+
* No Three.js / React / DOM imports — this file is the unit-testable
|
|
61
|
+
* core that the {@link import("../components/FoldPreviewOverlay").FoldPreviewOverlay}
|
|
62
|
+
* component drives. Hosts wanting an alternative renderer (Babylon,
|
|
63
|
+
* raw WebGL) can consume these helpers directly.
|
|
64
|
+
*
|
|
65
|
+
* Coordinate system
|
|
66
|
+
* -----------------
|
|
67
|
+
* - 2D inputs (`bbox.x`, `bbox.y`, `bbox.width`, `bbox.height`) are
|
|
68
|
+
* in page-local units; the conventions match {@link PageV3.unit}.
|
|
69
|
+
* - 3D outputs are in the same units — no rescaling — with the page
|
|
70
|
+
* plane as the XY plane (Z = 0 when fully unfolded) and Z+ pointing
|
|
71
|
+
* up out of the page. Mountain folds bend Z+; valley folds bend Z-.
|
|
72
|
+
* - Angles are in degrees clockwise around the hinge axis (Z+ is the
|
|
73
|
+
* handedness for the right-hand rule on the hinge direction).
|
|
74
|
+
*
|
|
75
|
+
* Wave 2 PR-3 scope: a flat layout (every panel at Z=0, no folding
|
|
76
|
+
* applied) plus the hinge metadata. PR-4 adds interactive angle
|
|
77
|
+
* scrubbing that drives `applyFolds()` over this scaffold.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Output shape — one panel projected into 3D space as a four-corner
|
|
81
|
+
* quad. The quad is wound counter-clockwise viewed from +Z (the
|
|
82
|
+
* standard "front face" convention).
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export type FoldPanelQuad = {
|
|
87
|
+
/** Source {@link FoldGeometryPanel.id} this quad represents. */
|
|
88
|
+
panelId: string;
|
|
89
|
+
/** Four corners in world space. Order: top-left, top-right,
|
|
90
|
+
* bottom-right, bottom-left when viewed from +Z. Each corner is
|
|
91
|
+
* `[x, y, z]`. */
|
|
92
|
+
corners: readonly [
|
|
93
|
+
readonly [number, number, number],
|
|
94
|
+
readonly [number, number, number],
|
|
95
|
+
readonly [number, number, number],
|
|
96
|
+
readonly [number, number, number]
|
|
97
|
+
];
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Output shape — one hinge axis projected into 3D space.
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
export type FoldHingeAxis = {
|
|
105
|
+
/** Source {@link FoldGeometryEdge.id} this axis represents. */
|
|
106
|
+
edgeId: string;
|
|
107
|
+
/** Hinge start in world space. */
|
|
108
|
+
from: readonly [number, number, number];
|
|
109
|
+
/** Hinge end in world space. */
|
|
110
|
+
to: readonly [number, number, number];
|
|
111
|
+
/** Mountain (Z+) or valley (Z-) bend handedness. */
|
|
112
|
+
direction: "mountain" | "valley";
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Aggregate scene specification — everything a Three.js scene needs
|
|
116
|
+
* to draw the foldable artwork.
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
export type FoldSceneSpec = {
|
|
121
|
+
panels: FoldPanelQuad[];
|
|
122
|
+
hinges: FoldHingeAxis[];
|
|
123
|
+
/** AABB of every projected panel; useful for camera framing. */
|
|
124
|
+
bounds: {
|
|
125
|
+
min: readonly [number, number, number];
|
|
126
|
+
max: readonly [number, number, number];
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Build a {@link FoldSceneSpec} from a panel registry and (optional)
|
|
131
|
+
* fold config.
|
|
132
|
+
*
|
|
133
|
+
* PR-3 scope: emits a *flat* layout — every panel sits at Z=0 with
|
|
134
|
+
* its bbox-derived corners. The fold angles in `foldConfig` are
|
|
135
|
+
* carried through onto the hinge axes for downstream renderers but
|
|
136
|
+
* are not applied to panel positions here. PR-4 adds `applyFolds()`
|
|
137
|
+
* which mutates panel corners according to the angles.
|
|
138
|
+
*
|
|
139
|
+
* Returns an empty spec when `panels` is empty.
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
export declare function buildFoldScene(panelMetadata: FoldGeometryPanelMetadata, foldConfig?: FoldGeometryConfig): FoldSceneSpec;
|
|
144
|
+
//# sourceMappingURL=fold-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold-geometry.d.ts","sourceRoot":"","sources":["../../src/lib/fold-geometry.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,iBAAiB,EAAE,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;CACnC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB;;uBAEmB;IACnB,OAAO,EAAE,SAAS;QAChB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC;CACH,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,gCAAgC;IAChC,EAAE,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,oDAAoD;IACpD,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC;CAClC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,gEAAgE;IAChE,MAAM,EAAE;QACN,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;KACxC,CAAC;CACH,CAAC;AAOF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,yBAAyB,EACxC,UAAU,CAAC,EAAE,kBAAkB,GAC9B,aAAa,CASf"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
const EMPTY_BOUNDS = {
|
|
3
|
+
min: [0, 0, 0],
|
|
4
|
+
max: [0, 0, 0],
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Build a {@link FoldSceneSpec} from a panel registry and (optional)
|
|
8
|
+
* fold config.
|
|
9
|
+
*
|
|
10
|
+
* PR-3 scope: emits a *flat* layout — every panel sits at Z=0 with
|
|
11
|
+
* its bbox-derived corners. The fold angles in `foldConfig` are
|
|
12
|
+
* carried through onto the hinge axes for downstream renderers but
|
|
13
|
+
* are not applied to panel positions here. PR-4 adds `applyFolds()`
|
|
14
|
+
* which mutates panel corners according to the angles.
|
|
15
|
+
*
|
|
16
|
+
* Returns an empty spec when `panels` is empty.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export function buildFoldScene(panelMetadata, foldConfig) {
|
|
21
|
+
const panels = panelMetadata.panels.map(panelToQuad);
|
|
22
|
+
const hinges = foldConfig ? foldConfig.edges.map((e) => edgeToHinge(e, panelMetadata)) : [];
|
|
23
|
+
const validHinges = hinges.filter((h) => h !== null);
|
|
24
|
+
return {
|
|
25
|
+
panels,
|
|
26
|
+
hinges: validHinges,
|
|
27
|
+
bounds: panels.length === 0 ? EMPTY_BOUNDS : computeBounds(panels),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Flip a 2D page-coord Y into 3D world Y. Normalizes IEEE-754
|
|
31
|
+
* negative-zero (`-0`) to positive zero so test equality and JSON
|
|
32
|
+
* serialization don't surprise consumers. */
|
|
33
|
+
function flipY(y) {
|
|
34
|
+
const flipped = -y;
|
|
35
|
+
return flipped === 0 ? 0 : flipped;
|
|
36
|
+
}
|
|
37
|
+
function panelToQuad(panel) {
|
|
38
|
+
const { x, y, width, height } = panel.bbox;
|
|
39
|
+
// Wind counter-clockwise viewed from +Z; +Y points away from
|
|
40
|
+
// viewer in the page-coord convention, so we flip Y here so the
|
|
41
|
+
// 3D scene reads the same way as the canvas.
|
|
42
|
+
return {
|
|
43
|
+
panelId: panel.id,
|
|
44
|
+
corners: [
|
|
45
|
+
[x, flipY(y), 0],
|
|
46
|
+
[x + width, flipY(y), 0],
|
|
47
|
+
[x + width, flipY(y + height), 0],
|
|
48
|
+
[x, flipY(y + height), 0],
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function edgeToHinge(edge, panelMetadata) {
|
|
53
|
+
// The hinge is the shared edge between two panels. Find both, then
|
|
54
|
+
// use the closer pair of bbox edges as the hinge axis. Dangling
|
|
55
|
+
// edge refs (panelA/panelB ids not present) are skipped — the
|
|
56
|
+
// editor enforces referential integrity on save, but renderers
|
|
57
|
+
// should be defensive.
|
|
58
|
+
const a = panelMetadata.panels.find((p) => p.id === edge.panelA);
|
|
59
|
+
const b = panelMetadata.panels.find((p) => p.id === edge.panelB);
|
|
60
|
+
if (!a || !b)
|
|
61
|
+
return null;
|
|
62
|
+
const seam = sharedEdge(a, b);
|
|
63
|
+
if (!seam)
|
|
64
|
+
return null;
|
|
65
|
+
return {
|
|
66
|
+
edgeId: edge.id,
|
|
67
|
+
from: [seam.from[0], flipY(seam.from[1]), 0],
|
|
68
|
+
to: [seam.to[0], flipY(seam.to[1]), 0],
|
|
69
|
+
direction: edge.direction ?? "mountain",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Find the closest aligned pair of bbox edges between two panels.
|
|
73
|
+
* Returns the seam in page-local 2D coords, or `null` when the
|
|
74
|
+
* panels don't share an edge within a 0.5-unit tolerance. */
|
|
75
|
+
function sharedEdge(a, b) {
|
|
76
|
+
const TOL = 0.5;
|
|
77
|
+
const ar = bboxRect(a.bbox);
|
|
78
|
+
const br = bboxRect(b.bbox);
|
|
79
|
+
// Vertical seam: a's right edge meets b's left, or vice versa.
|
|
80
|
+
if (Math.abs(ar.x + ar.w - br.x) < TOL) {
|
|
81
|
+
const y0 = Math.max(ar.y, br.y);
|
|
82
|
+
const y1 = Math.min(ar.y + ar.h, br.y + br.h);
|
|
83
|
+
if (y1 > y0)
|
|
84
|
+
return { from: [br.x, y0], to: [br.x, y1] };
|
|
85
|
+
}
|
|
86
|
+
if (Math.abs(br.x + br.w - ar.x) < TOL) {
|
|
87
|
+
const y0 = Math.max(ar.y, br.y);
|
|
88
|
+
const y1 = Math.min(ar.y + ar.h, br.y + br.h);
|
|
89
|
+
if (y1 > y0)
|
|
90
|
+
return { from: [ar.x, y0], to: [ar.x, y1] };
|
|
91
|
+
}
|
|
92
|
+
// Horizontal seam: a's bottom edge meets b's top, or vice versa.
|
|
93
|
+
if (Math.abs(ar.y + ar.h - br.y) < TOL) {
|
|
94
|
+
const x0 = Math.max(ar.x, br.x);
|
|
95
|
+
const x1 = Math.min(ar.x + ar.w, br.x + br.w);
|
|
96
|
+
if (x1 > x0)
|
|
97
|
+
return { from: [x0, br.y], to: [x1, br.y] };
|
|
98
|
+
}
|
|
99
|
+
if (Math.abs(br.y + br.h - ar.y) < TOL) {
|
|
100
|
+
const x0 = Math.max(ar.x, br.x);
|
|
101
|
+
const x1 = Math.min(ar.x + ar.w, br.x + br.w);
|
|
102
|
+
if (x1 > x0)
|
|
103
|
+
return { from: [x0, ar.y], to: [x1, ar.y] };
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
function bboxRect(bbox) {
|
|
108
|
+
return { x: bbox.x, y: bbox.y, w: bbox.width, h: bbox.height };
|
|
109
|
+
}
|
|
110
|
+
function computeBounds(panels) {
|
|
111
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
112
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
113
|
+
let minZ = Number.POSITIVE_INFINITY;
|
|
114
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
115
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
116
|
+
let maxZ = Number.NEGATIVE_INFINITY;
|
|
117
|
+
for (const p of panels) {
|
|
118
|
+
for (const [x, y, z] of p.corners) {
|
|
119
|
+
if (x < minX)
|
|
120
|
+
minX = x;
|
|
121
|
+
if (y < minY)
|
|
122
|
+
minY = y;
|
|
123
|
+
if (z < minZ)
|
|
124
|
+
minZ = z;
|
|
125
|
+
if (x > maxX)
|
|
126
|
+
maxX = x;
|
|
127
|
+
if (y > maxY)
|
|
128
|
+
maxY = y;
|
|
129
|
+
if (z > maxZ)
|
|
130
|
+
maxZ = z;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
min: [minX, minY, minZ],
|
|
135
|
+
max: [maxX, maxY, maxZ],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=fold-geometry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold-geometry.js","sourceRoot":"","sources":["../../src/lib/fold-geometry.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAqI7C,MAAM,YAAY,GAAG;IACnB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU;IACvB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAU;CACxB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAC5B,aAAwC,EACxC,UAA+B;IAE/B,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5F,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAsB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IACzE,OAAO;QACL,MAAM;QACN,MAAM,EAAE,WAAW;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC;KACnE,CAAC;AACJ,CAAC;AAED;;8CAE8C;AAC9C,SAAS,KAAK,CAAC,CAAS;IACtB,MAAM,OAAO,GAAG,CAAC,CAAC,CAAC;IACnB,OAAO,OAAO,KAAK,CAAC,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,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC;YACvB,IAAI,CAAC,GAAG,IAAI;gBAAE,IAAI,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO;QACL,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU;QAChC,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU;KACjC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wave 3 V1 — Variable-data merge helpers.
|
|
3
|
+
*
|
|
4
|
+
* V1 ships the data-side hooks that turn a Wave 2 V2 variant matrix
|
|
5
|
+
* (rows of `{ tokenName: value }`) and a template string with
|
|
6
|
+
* `{{token}}` placeholders into an ordered list of per-variant
|
|
7
|
+
* rendered strings, ready for compose. The editor stays agnostic to
|
|
8
|
+
* the actual PDF render — these helpers run in the browser to power
|
|
9
|
+
* a preview, then the same logic runs server-side (or in compose)
|
|
10
|
+
* for the final merge.
|
|
11
|
+
*
|
|
12
|
+
* Tokens use double-curly delimiters (`{{firstName}}`). Whitespace
|
|
13
|
+
* inside the delimiters is tolerated (`{{ firstName }}`) — the
|
|
14
|
+
* extracted name is trimmed. Adjacent or nested delimiters are not
|
|
15
|
+
* supported (and would generate invalid PDF text anyway).
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* One row in a variant matrix. Keyed by token name, valued by the
|
|
21
|
+
* substitute string. Mirrors the shape produced by Wave 2 V2's
|
|
22
|
+
* {@link import("../components/VariantMatrixPanel").VariantMatrixPanelVariant}.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
export type MergeRow = Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Result of validating a merge manifest. Empty arrays mean the
|
|
29
|
+
* manifest is valid for this row; `missingTokens` is the list of
|
|
30
|
+
* placeholders in the template that have no entry in the row;
|
|
31
|
+
* `unusedColumns` is the inverse — keys in the row that the template
|
|
32
|
+
* doesn't reference (useful for warning hosts about typos in
|
|
33
|
+
* column names).
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
export type MergeValidationResult = {
|
|
38
|
+
missingTokens: string[];
|
|
39
|
+
unusedColumns: string[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Extract every `{{token}}` name (deduplicated, in first-occurrence
|
|
43
|
+
* order) from a template string. Whitespace inside the delimiters
|
|
44
|
+
* is tolerated and the returned names are trimmed.
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export declare function extractMergeTokens(template: string): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Replace every `{{token}}` in `template` with the matching value
|
|
51
|
+
* from `row`. Tokens with no entry in the row are replaced with the
|
|
52
|
+
* empty string and surfaced via the second return value so the host
|
|
53
|
+
* can warn the user.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export declare function mergeRow(template: string, row: MergeRow): {
|
|
58
|
+
merged: string;
|
|
59
|
+
missingTokens: string[];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Validate a row against a template — quick check before kicking
|
|
63
|
+
* off a compose-side merge. Returns the list of `missingTokens` the
|
|
64
|
+
* row lacks and the list of `unusedColumns` (row keys the template
|
|
65
|
+
* doesn't reference).
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export declare function validateMergeManifest(template: string, row: MergeRow): MergeValidationResult;
|
|
70
|
+
/**
|
|
71
|
+
* Merge every row in a variant matrix against a template. Returns
|
|
72
|
+
* one merged string per row, plus a per-row missing-token list so
|
|
73
|
+
* the host can surface a "row N missing tokens X/Y" warning.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
export declare function mergeAllRows(template: string, rows: readonly MergeRow[]): {
|
|
78
|
+
merged: string;
|
|
79
|
+
missingTokens: string[];
|
|
80
|
+
}[];
|
|
81
|
+
//# sourceMappingURL=merge-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-tokens.d.ts","sourceRoot":"","sources":["../../src/lib/merge-tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAIF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAc7D;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,QAAQ,GACZ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAqB7C;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,qBAAqB,CAY5F;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,QAAQ,EAAE,GACxB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,CAE/C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
const TOKEN_RE = /\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}/g;
|
|
3
|
+
/**
|
|
4
|
+
* Extract every `{{token}}` name (deduplicated, in first-occurrence
|
|
5
|
+
* order) from a template string. Whitespace inside the delimiters
|
|
6
|
+
* is tolerated and the returned names are trimmed.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export function extractMergeTokens(template) {
|
|
11
|
+
const seen = new Set();
|
|
12
|
+
const order = [];
|
|
13
|
+
TOKEN_RE.lastIndex = 0;
|
|
14
|
+
let m = TOKEN_RE.exec(template);
|
|
15
|
+
while (m !== null) {
|
|
16
|
+
const name = m[1];
|
|
17
|
+
if (name !== undefined && !seen.has(name)) {
|
|
18
|
+
seen.add(name);
|
|
19
|
+
order.push(name);
|
|
20
|
+
}
|
|
21
|
+
m = TOKEN_RE.exec(template);
|
|
22
|
+
}
|
|
23
|
+
return order;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Replace every `{{token}}` in `template` with the matching value
|
|
27
|
+
* from `row`. Tokens with no entry in the row are replaced with the
|
|
28
|
+
* empty string and surfaced via the second return value so the host
|
|
29
|
+
* can warn the user.
|
|
30
|
+
*
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
export function mergeRow(template, row) {
|
|
34
|
+
const missingSet = new Set();
|
|
35
|
+
// `String.prototype.replace` with a `/g` regex doesn't read
|
|
36
|
+
// `lastIndex`, but the same regex is reused by `extractMergeTokens`
|
|
37
|
+
// via `.exec`. Resetting up front decouples call ordering and avoids
|
|
38
|
+
// a class of stateful-regex bugs.
|
|
39
|
+
TOKEN_RE.lastIndex = 0;
|
|
40
|
+
const merged = template.replace(TOKEN_RE, (_match, rawName) => {
|
|
41
|
+
const name = rawName.trim();
|
|
42
|
+
// `Object.hasOwn` (not `name in row` / `row[name] !== undefined`)
|
|
43
|
+
// — otherwise tokens like `{{toString}}` resolve to the inherited
|
|
44
|
+
// `Object.prototype.toString` method and silently corrupt the
|
|
45
|
+
// merged output. `validateMergeManifest` already uses `Object.keys`
|
|
46
|
+
// (own enumerable keys), so this keeps the two helpers in sync.
|
|
47
|
+
if (!Object.hasOwn(row, name)) {
|
|
48
|
+
missingSet.add(name);
|
|
49
|
+
return "";
|
|
50
|
+
}
|
|
51
|
+
return row[name] ?? "";
|
|
52
|
+
});
|
|
53
|
+
return { merged, missingTokens: [...missingSet] };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Validate a row against a template — quick check before kicking
|
|
57
|
+
* off a compose-side merge. Returns the list of `missingTokens` the
|
|
58
|
+
* row lacks and the list of `unusedColumns` (row keys the template
|
|
59
|
+
* doesn't reference).
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export function validateMergeManifest(template, row) {
|
|
64
|
+
const tokens = new Set(extractMergeTokens(template));
|
|
65
|
+
const columns = new Set(Object.keys(row));
|
|
66
|
+
const missingTokens = [];
|
|
67
|
+
const unusedColumns = [];
|
|
68
|
+
for (const token of tokens) {
|
|
69
|
+
if (!columns.has(token))
|
|
70
|
+
missingTokens.push(token);
|
|
71
|
+
}
|
|
72
|
+
for (const column of columns) {
|
|
73
|
+
if (!tokens.has(column))
|
|
74
|
+
unusedColumns.push(column);
|
|
75
|
+
}
|
|
76
|
+
return { missingTokens, unusedColumns };
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Merge every row in a variant matrix against a template. Returns
|
|
80
|
+
* one merged string per row, plus a per-row missing-token list so
|
|
81
|
+
* the host can surface a "row N missing tokens X/Y" warning.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export function mergeAllRows(template, rows) {
|
|
86
|
+
return rows.map((row) => mergeRow(template, row));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=merge-tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-tokens.js","sourceRoot":"","sources":["../../src/lib/merge-tokens.ts"],"names":[],"mappings":"AAAA,6CAA6C;AA6C7C,MAAM,QAAQ,GAAG,yCAAyC,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC;IACvB,IAAI,CAAC,GAA2B,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;QACD,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,QAAgB,EAChB,GAAa;IAEb,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,4DAA4D;IAC5D,oEAAoE;IACpE,qEAAqE;IACrE,kCAAkC;IAClC,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC;IACvB,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,OAA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,IAAyB;IAEzB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PaletteId } from "./editor-config";
|
|
2
|
+
/**
|
|
3
|
+
* Static metadata for one entry in the palette registry.
|
|
4
|
+
*
|
|
5
|
+
* `slot` follows lens-pdf's `<vendor>.<area>.<feature>` convention —
|
|
6
|
+
* `panel.right` for right-rail panels, `panel.left` for left-rail,
|
|
7
|
+
* `panel.modal` for modal-style panels. The convention lets future
|
|
8
|
+
* host-side plugin systems route palettes to the right region
|
|
9
|
+
* without hard-coding ids.
|
|
10
|
+
*
|
|
11
|
+
* `label` is the human-readable name shown in the PaletteManager
|
|
12
|
+
* overflow and the mobile drawer "Panels" section.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export type PaletteRegistryEntry = {
|
|
17
|
+
slot: string;
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The canonical map of every {@link PaletteId} the editor knows about,
|
|
22
|
+
* keyed for fast lookup by `PaletteManager` / `MobileToolDrawer`.
|
|
23
|
+
*
|
|
24
|
+
* `layers` and `preflight` are wired in the current EditorApp; the
|
|
25
|
+
* other ids are registered for forward compatibility — Wave 1+
|
|
26
|
+
* components will mount them and (where the flag exists but the UI
|
|
27
|
+
* doesn't yet) call `markUnwired(...)`.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare const PALETTE_REGISTRY: Record<PaletteId, PaletteRegistryEntry>;
|
|
32
|
+
/**
|
|
33
|
+
* Ordered list of every {@link PaletteId} — same order as the
|
|
34
|
+
* registry's declaration. Use for stable iteration in UI (the
|
|
35
|
+
* overflow menu, the mobile drawer).
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export declare const PALETTE_IDS: PaletteId[];
|
|
40
|
+
//# sourceMappingURL=palette-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette-registry.d.ts","sourceRoot":"","sources":["../../src/lib/palette-registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,SAAS,EAAE,oBAAoB,CA4BpE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,EAAiD,CAAC"}
|