@printwithsynergy/artwork-pdf-editor 0.1.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.
Files changed (83) hide show
  1. package/README.md +117 -0
  2. package/dist/components/DielineLibraryModal.d.ts +9 -0
  3. package/dist/components/DielineLibraryModal.d.ts.map +1 -0
  4. package/dist/components/DielineLibraryModal.js +107 -0
  5. package/dist/components/DielineLibraryModal.js.map +1 -0
  6. package/dist/components/EditorApp.d.ts +37 -0
  7. package/dist/components/EditorApp.d.ts.map +1 -0
  8. package/dist/components/EditorApp.js +89 -0
  9. package/dist/components/EditorApp.js.map +1 -0
  10. package/dist/components/EditorCanvas.d.ts +41 -0
  11. package/dist/components/EditorCanvas.d.ts.map +1 -0
  12. package/dist/components/EditorCanvas.js +852 -0
  13. package/dist/components/EditorCanvas.js.map +1 -0
  14. package/dist/components/FileDropZone.d.ts +6 -0
  15. package/dist/components/FileDropZone.d.ts.map +1 -0
  16. package/dist/components/FileDropZone.js +48 -0
  17. package/dist/components/FileDropZone.js.map +1 -0
  18. package/dist/components/LayersPanel.d.ts +12 -0
  19. package/dist/components/LayersPanel.d.ts.map +1 -0
  20. package/dist/components/LayersPanel.js +101 -0
  21. package/dist/components/LayersPanel.js.map +1 -0
  22. package/dist/components/MobileToolDrawer.d.ts +45 -0
  23. package/dist/components/MobileToolDrawer.d.ts.map +1 -0
  24. package/dist/components/MobileToolDrawer.js +164 -0
  25. package/dist/components/MobileToolDrawer.js.map +1 -0
  26. package/dist/components/ModeToggle.d.ts +8 -0
  27. package/dist/components/ModeToggle.d.ts.map +1 -0
  28. package/dist/components/ModeToggle.js +27 -0
  29. package/dist/components/ModeToggle.js.map +1 -0
  30. package/dist/components/PreflightPanel.d.ts +9 -0
  31. package/dist/components/PreflightPanel.d.ts.map +1 -0
  32. package/dist/components/PreflightPanel.js +59 -0
  33. package/dist/components/PreflightPanel.js.map +1 -0
  34. package/dist/components/SeparationsPanel.d.ts +9 -0
  35. package/dist/components/SeparationsPanel.d.ts.map +1 -0
  36. package/dist/components/SeparationsPanel.js +147 -0
  37. package/dist/components/SeparationsPanel.js.map +1 -0
  38. package/dist/components/TopBar.d.ts +57 -0
  39. package/dist/components/TopBar.d.ts.map +1 -0
  40. package/dist/components/TopBar.js +70 -0
  41. package/dist/components/TopBar.js.map +1 -0
  42. package/dist/data/dielines.json +186 -0
  43. package/dist/hooks/useEditorMode.d.ts +15 -0
  44. package/dist/hooks/useEditorMode.d.ts.map +1 -0
  45. package/dist/hooks/useEditorMode.js +51 -0
  46. package/dist/hooks/useEditorMode.js.map +1 -0
  47. package/dist/hooks/useIsMobile.d.ts +19 -0
  48. package/dist/hooks/useIsMobile.d.ts.map +1 -0
  49. package/dist/hooks/useIsMobile.js +34 -0
  50. package/dist/hooks/useIsMobile.js.map +1 -0
  51. package/dist/hooks/usePreflight.d.ts +23 -0
  52. package/dist/hooks/usePreflight.d.ts.map +1 -0
  53. package/dist/hooks/usePreflight.js +48 -0
  54. package/dist/hooks/usePreflight.js.map +1 -0
  55. package/dist/index.d.ts +23 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +23 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/lib/bleed.d.ts +27 -0
  60. package/dist/lib/bleed.d.ts.map +1 -0
  61. package/dist/lib/bleed.js +60 -0
  62. package/dist/lib/bleed.js.map +1 -0
  63. package/dist/lib/dieline-template.d.ts +33 -0
  64. package/dist/lib/dieline-template.d.ts.map +1 -0
  65. package/dist/lib/dieline-template.js +43 -0
  66. package/dist/lib/dieline-template.js.map +1 -0
  67. package/dist/lib/editor-config.d.ts +69 -0
  68. package/dist/lib/editor-config.d.ts.map +1 -0
  69. package/dist/lib/editor-config.js +66 -0
  70. package/dist/lib/editor-config.js.map +1 -0
  71. package/dist/lib/preflight/checks.d.ts +8 -0
  72. package/dist/lib/preflight/checks.d.ts.map +1 -0
  73. package/dist/lib/preflight/checks.js +276 -0
  74. package/dist/lib/preflight/checks.js.map +1 -0
  75. package/dist/lib/preflight/index.d.ts +2 -0
  76. package/dist/lib/preflight/index.d.ts.map +1 -0
  77. package/dist/lib/preflight/index.js +3 -0
  78. package/dist/lib/preflight/index.js.map +1 -0
  79. package/dist/lib/preflight/types.d.ts +24 -0
  80. package/dist/lib/preflight/types.d.ts.map +1 -0
  81. package/dist/lib/preflight/types.js +80 -0
  82. package/dist/lib/preflight/types.js.map +1 -0
  83. package/package.json +49 -0
@@ -0,0 +1,51 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ "use client";
3
+ import { useCallback, useEffect, useState } from "react";
4
+ const STORAGE_KEY = "artworkpdf:editor-mode";
5
+ /**
6
+ * Resolves the editor mode with this precedence:
7
+ * 1. Explicit user choice persisted in localStorage
8
+ * 2. `prefer` prop (set by the page — e.g. demo passes "auto")
9
+ * 3. Viewport heuristic: pro on >= 900 CSS px, basic otherwise
10
+ *
11
+ * `setMode(null)` clears the saved preference and returns to auto.
12
+ */
13
+ export function useEditorMode(prefer = "auto") {
14
+ const [stored, setStored] = useState(null);
15
+ const [viewportPro, setViewportPro] = useState(false);
16
+ const [hydrated, setHydrated] = useState(false);
17
+ useEffect(() => {
18
+ try {
19
+ const raw = window.localStorage.getItem(STORAGE_KEY);
20
+ if (raw === "basic" || raw === "pro")
21
+ setStored(raw);
22
+ }
23
+ catch {
24
+ // localStorage may be unavailable (Safari private mode, etc.)
25
+ }
26
+ const mq = window.matchMedia("(min-width: 900px)");
27
+ const sync = () => setViewportPro(mq.matches);
28
+ sync();
29
+ mq.addEventListener("change", sync);
30
+ setHydrated(true);
31
+ return () => mq.removeEventListener("change", sync);
32
+ }, []);
33
+ const setMode = useCallback((next) => {
34
+ setStored(next);
35
+ try {
36
+ if (next === null)
37
+ window.localStorage.removeItem(STORAGE_KEY);
38
+ else
39
+ window.localStorage.setItem(STORAGE_KEY, next);
40
+ }
41
+ catch {
42
+ // ignore
43
+ }
44
+ }, []);
45
+ // Until hydration completes, render in `prefer` to avoid SSR flash.
46
+ const auto = viewportPro ? "pro" : "basic";
47
+ const fallback = prefer === "auto" ? auto : prefer;
48
+ const mode = stored ?? (hydrated ? auto : fallback);
49
+ return { mode, setMode, isAuto: stored === null };
50
+ }
51
+ //# sourceMappingURL=useEditorMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEditorMode.js","sourceRoot":"","sources":["../../src/hooks/useEditorMode.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;AACb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIzD,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,SAA8B,MAAM;IAKhE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC/D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACrD,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK;gBAAE,SAAS,CAAC,GAAG,CAAC,CAAC;QACvD,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;QAChE,CAAC;QAED,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,EAAE,CAAC;QACP,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACpC,WAAW,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,IAAuB,EAAE,EAAE;QACtD,SAAS,CAAC,IAAI,CAAC,CAAC;QAChB,IAAI,CAAC;YACH,IAAI,IAAI,KAAK,IAAI;gBAAE,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;;gBAC1D,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,oEAAoE;IACpE,MAAM,IAAI,GAAe,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IACvD,MAAM,QAAQ,GAAe,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;IAC/D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAEpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Single-source mobile breakpoint matcher used by the editor to
3
+ * decide whether to render touch-first chrome (slide-in tools drawer)
4
+ * instead of the desktop horizontal toolbar.
5
+ *
6
+ * The default breakpoint matches Tailwind's `md` (768 px). Pass a
7
+ * custom value to override per-component.
8
+ *
9
+ * SSR-safe: returns `false` on the server (assumes desktop) so the
10
+ * first paint matches the static HTML, then re-evaluates on mount.
11
+ *
12
+ * Ported verbatim from `printwithsynergy/lens-pdf`'s
13
+ * `components/useIsMobile.ts` so the breakpoint contract is identical
14
+ * across PWS products.
15
+ *
16
+ * @public
17
+ */
18
+ export declare function useIsMobile(maxWidthPx?: number): boolean;
19
+ //# sourceMappingURL=useIsMobile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsMobile.d.ts","sourceRoot":"","sources":["../../src/hooks/useIsMobile.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,UAAU,SAAM,GAAG,OAAO,CAWrD"}
@@ -0,0 +1,34 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ "use client";
3
+ import { useEffect, useState } from "react";
4
+ /**
5
+ * Single-source mobile breakpoint matcher used by the editor to
6
+ * decide whether to render touch-first chrome (slide-in tools drawer)
7
+ * instead of the desktop horizontal toolbar.
8
+ *
9
+ * The default breakpoint matches Tailwind's `md` (768 px). Pass a
10
+ * custom value to override per-component.
11
+ *
12
+ * SSR-safe: returns `false` on the server (assumes desktop) so the
13
+ * first paint matches the static HTML, then re-evaluates on mount.
14
+ *
15
+ * Ported verbatim from `printwithsynergy/lens-pdf`'s
16
+ * `components/useIsMobile.ts` so the breakpoint contract is identical
17
+ * across PWS products.
18
+ *
19
+ * @public
20
+ */
21
+ export function useIsMobile(maxWidthPx = 767) {
22
+ const [isMobile, setIsMobile] = useState(false);
23
+ useEffect(() => {
24
+ if (typeof window === "undefined")
25
+ return;
26
+ const mql = window.matchMedia(`(max-width: ${maxWidthPx}px)`);
27
+ const update = () => setIsMobile(mql.matches);
28
+ update();
29
+ mql.addEventListener("change", update);
30
+ return () => mql.removeEventListener("change", update);
31
+ }, [maxWidthPx]);
32
+ return isMobile;
33
+ }
34
+ //# sourceMappingURL=useIsMobile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsMobile.js","sourceRoot":"","sources":["../../src/hooks/useIsMobile.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,UAAU,GAAG,GAAG;IAC1C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE,OAAO;QAC1C,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,eAAe,UAAU,KAAK,CAAC,CAAC;QAC9D,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,EAAE,CAAC;QACT,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACjB,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type PreflightReport } from "../lib/preflight/types";
2
+ type PreflightState = {
3
+ phase: "idle";
4
+ } | {
5
+ phase: "loading";
6
+ } | {
7
+ phase: "done";
8
+ report: PreflightReport;
9
+ } | {
10
+ phase: "error";
11
+ message: string;
12
+ };
13
+ export declare function usePreflight(): {
14
+ state: PreflightState;
15
+ run: (file: File, opts?: {
16
+ labelClass?: string;
17
+ labelType?: string;
18
+ tenantId?: string;
19
+ demoMode?: boolean;
20
+ }) => Promise<PreflightReport | null>;
21
+ };
22
+ export {};
23
+ //# sourceMappingURL=usePreflight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePreflight.d.ts","sourceRoot":"","sources":["../../src/hooks/usePreflight.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAEhC,KAAK,cAAc,GACf;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GACpB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAC1C;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAOxC,wBAAgB,YAAY;;gBAKhB,IAAI,SACH;QACL,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB;EAyCN"}
@@ -0,0 +1,48 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ "use client";
3
+ import { useCallback, useState } from "react";
4
+ import { runClientChecks } from "../lib/preflight/index";
5
+ import { DEFAULT_PREFLIGHT_RULES, } from "../lib/preflight/types";
6
+ const SERVICE_URL = (process.env.NEXT_PUBLIC_SERVICE_URL ?? "http://localhost:3001").replace(/\/$/, "");
7
+ export function usePreflight() {
8
+ const [state, setState] = useState({ phase: "idle" });
9
+ const run = useCallback(async (file, opts) => {
10
+ setState({ phase: "loading" });
11
+ try {
12
+ let rules;
13
+ if (opts?.demoMode) {
14
+ rules = DEFAULT_PREFLIGHT_RULES;
15
+ }
16
+ else {
17
+ const params = new URLSearchParams();
18
+ if (opts?.labelClass)
19
+ params.set("label_class", opts.labelClass);
20
+ if (opts?.labelType)
21
+ params.set("label_type", opts.labelType);
22
+ if (opts?.tenantId)
23
+ params.set("tenant_id", opts.tenantId);
24
+ const res = await fetch(`${SERVICE_URL}/preflight-rules?${params}`);
25
+ const body = await res.json();
26
+ rules = body.rules;
27
+ }
28
+ const { issues, skippedChecks } = await runClientChecks(file, rules);
29
+ const hasBlockingIssues = issues.some((i) => i.severity === "block");
30
+ const report = {
31
+ passed: !hasBlockingIssues,
32
+ hasBlockingIssues,
33
+ issues,
34
+ skippedChecks,
35
+ checkedAt: new Date().toISOString(),
36
+ };
37
+ setState({ phase: "done", report });
38
+ return report;
39
+ }
40
+ catch (err) {
41
+ const message = err instanceof Error ? err.message : "Preflight check failed";
42
+ setState({ phase: "error", message });
43
+ return null;
44
+ }
45
+ }, []);
46
+ return { state, run };
47
+ }
48
+ //# sourceMappingURL=usePreflight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePreflight.js","sourceRoot":"","sources":["../../src/hooks/usePreflight.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,YAAY,CAAC;AACb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,uBAAuB,GAGxB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,uBAAuB,CAAC,CAAC,OAAO,CAC1F,KAAK,EACL,EAAE,CACH,CAAC;AAEF,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtE,MAAM,GAAG,GAAG,WAAW,CACrB,KAAK,EACH,IAAU,EACV,IAKC,EACD,EAAE;QACF,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC;YACH,IAAI,KAAsB,CAAC;YAE3B,IAAI,IAAI,EAAE,QAAQ,EAAE,CAAC;gBACnB,KAAK,GAAG,uBAAuB,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;gBACrC,IAAI,IAAI,EAAE,UAAU;oBAAE,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;gBACjE,IAAI,IAAI,EAAE,SAAS;oBAAE,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC9D,IAAI,IAAI,EAAE,QAAQ;oBAAE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC3D,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,WAAW,oBAAoB,MAAM,EAAE,CAAC,CAAC;gBACpE,MAAM,IAAI,GAA+B,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC1D,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YACrB,CAAC;YAED,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACrE,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;YAErE,MAAM,MAAM,GAAoB;gBAC9B,MAAM,EAAE,CAAC,iBAAiB;gBAC1B,iBAAiB;gBACjB,MAAM;gBACN,aAAa;gBACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC,CAAC;YAEF,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACpC,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;YAC9E,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Public API surface of `@printwithsynergy/artwork-pdf-editor`. Hosts mount the
3
+ * editor by importing {@link EditorApp} and optionally customize it
4
+ * via {@link EditorAppProps.config}, {@link EditorAppProps.topBar},
5
+ * and {@link EditorAppProps.bleedMm}.
6
+ *
7
+ * The dieline-template helpers and bleed parser are re-exported so
8
+ * server components (Next.js Server Components, Astro frontmatter)
9
+ * can seed the canvas with the right initial state without bundling
10
+ * the whole client.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ export { EditorApp, type EditorAppProps } from "./components/EditorApp";
15
+ export type { CanvasObj } from "./components/EditorCanvas";
16
+ export { TopBar, ArtworkPdfLogo, type TopBarProps, type TopBarButton } from "./components/TopBar";
17
+ export { MobileToolDrawer, type MobileToolDrawerProps } from "./components/MobileToolDrawer";
18
+ export { useIsMobile } from "./hooks/useIsMobile";
19
+ export { type EditorMode, useEditorMode } from "./hooks/useEditorMode";
20
+ export { type EditorConfig, DEFAULT_EDITOR_CONFIG, BASIC_MODE_OVERRIDES, PRO_MODE_OVERRIDES, resolveConfig, } from "./lib/editor-config";
21
+ export { type DielineTemplate, TEMPLATES, getDefaultTemplate, getTemplateById, templateToInitialState, } from "./lib/dieline-template";
22
+ export { DEFAULT_BLEED_MM, parseBleed, formatBleed } from "./lib/bleed";
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACL,KAAK,YAAY,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,KAAK,eAAe,EACpB,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ /**
3
+ * Public API surface of `@printwithsynergy/artwork-pdf-editor`. Hosts mount the
4
+ * editor by importing {@link EditorApp} and optionally customize it
5
+ * via {@link EditorAppProps.config}, {@link EditorAppProps.topBar},
6
+ * and {@link EditorAppProps.bleedMm}.
7
+ *
8
+ * The dieline-template helpers and bleed parser are re-exported so
9
+ * server components (Next.js Server Components, Astro frontmatter)
10
+ * can seed the canvas with the right initial state without bundling
11
+ * the whole client.
12
+ *
13
+ * @packageDocumentation
14
+ */
15
+ export { EditorApp } from "./components/EditorApp";
16
+ export { TopBar, ArtworkPdfLogo } from "./components/TopBar";
17
+ export { MobileToolDrawer } from "./components/MobileToolDrawer";
18
+ export { useIsMobile } from "./hooks/useIsMobile";
19
+ export { useEditorMode } from "./hooks/useEditorMode";
20
+ export { DEFAULT_EDITOR_CONFIG, BASIC_MODE_OVERRIDES, PRO_MODE_OVERRIDES, resolveConfig, } from "./lib/editor-config";
21
+ export { TEMPLATES, getDefaultTemplate, getTemplateById, templateToInitialState, } from "./lib/dieline-template";
22
+ export { DEFAULT_BLEED_MM, parseBleed, formatBleed } from "./lib/bleed";
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAuB,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAuC,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAA8B,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAEL,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Industry-standard digital-print bleed: 0.125 in ≈ 3.175 mm. Used as
3
+ * the fallback when neither a URL param, prop, nor template value is
4
+ * supplied.
5
+ *
6
+ * @public
7
+ */
8
+ export declare const DEFAULT_BLEED_MM = 3.175;
9
+ /**
10
+ * Parse a user-supplied bleed string into mm.
11
+ *
12
+ * Accepts `"0.125in"`, `"3mm"`, or a bare number (assumed mm). Returns
13
+ * `undefined` for missing or unparseable input so the caller can fall
14
+ * back to its own default.
15
+ *
16
+ * @public
17
+ */
18
+ export declare function parseBleed(raw: string | null | undefined): number | undefined;
19
+ /**
20
+ * Format a bleed value (in mm) as a human-readable string in the given
21
+ * unit. Used for the on-canvas "BLEED 0.125 in" label and the drawer
22
+ * input placeholder.
23
+ *
24
+ * @public
25
+ */
26
+ export declare function formatBleed(mm: number, unit?: "in" | "mm"): string;
27
+ //# sourceMappingURL=bleed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bleed.d.ts","sourceRoot":"","sources":["../../src/lib/bleed.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,QAAQ,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAU7E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE,IAAI,GAAG,IAAW,GAAG,MAAM,CAMxE"}
@@ -0,0 +1,60 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ /**
3
+ * Bleed value helpers. The editor accepts a single `bleedMm` number
4
+ * everywhere internally; this module owns the parsing of user-facing
5
+ * strings (URL query params, UI inputs) and the formatting of
6
+ * human-readable labels.
7
+ *
8
+ * @public
9
+ */
10
+ const MM_PER_INCH = 25.4;
11
+ /**
12
+ * Industry-standard digital-print bleed: 0.125 in ≈ 3.175 mm. Used as
13
+ * the fallback when neither a URL param, prop, nor template value is
14
+ * supplied.
15
+ *
16
+ * @public
17
+ */
18
+ export const DEFAULT_BLEED_MM = 3.175;
19
+ /**
20
+ * Parse a user-supplied bleed string into mm.
21
+ *
22
+ * Accepts `"0.125in"`, `"3mm"`, or a bare number (assumed mm). Returns
23
+ * `undefined` for missing or unparseable input so the caller can fall
24
+ * back to its own default.
25
+ *
26
+ * @public
27
+ */
28
+ export function parseBleed(raw) {
29
+ if (raw === null || raw === undefined)
30
+ return undefined;
31
+ const trimmed = raw.trim();
32
+ if (trimmed === "")
33
+ return undefined;
34
+ const match = trimmed.match(/^(-?\d+(?:\.\d+)?)\s*(in|mm)?$/i);
35
+ if (!match)
36
+ return undefined;
37
+ const value = Number.parseFloat(match[1] ?? "");
38
+ if (!Number.isFinite(value) || value < 0)
39
+ return undefined;
40
+ const unit = (match[2] ?? "mm").toLowerCase();
41
+ return unit === "in" ? value * MM_PER_INCH : value;
42
+ }
43
+ /**
44
+ * Format a bleed value (in mm) as a human-readable string in the given
45
+ * unit. Used for the on-canvas "BLEED 0.125 in" label and the drawer
46
+ * input placeholder.
47
+ *
48
+ * @public
49
+ */
50
+ export function formatBleed(mm, unit = "in") {
51
+ if (unit === "in") {
52
+ const inches = mm / MM_PER_INCH;
53
+ return `${trimNum(inches)} in`;
54
+ }
55
+ return `${trimNum(mm)} mm`;
56
+ }
57
+ function trimNum(n) {
58
+ return Number.parseFloat(n.toFixed(4)).toString();
59
+ }
60
+ //# sourceMappingURL=bleed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bleed.js","sourceRoot":"","sources":["../../src/lib/bleed.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C;;;;;;;GAOG;AAEH,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,GAA8B;IACvD,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC/D,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3D,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9C,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU,EAAE,OAAoB,IAAI;IAC9D,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,MAAM,GAAG,EAAE,GAAG,WAAW,CAAC;QAChC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC;AAC7B,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { CanvasObj } from "../components/EditorCanvas";
2
+ export type DielineTemplate = {
3
+ id: string;
4
+ name: string;
5
+ description: string;
6
+ category: string;
7
+ dimensions: {
8
+ widthMm: number;
9
+ heightMm: number;
10
+ depthMm: number;
11
+ };
12
+ bleedMm: number;
13
+ trimBox: {
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ };
19
+ previewSvg: string;
20
+ tags: string[];
21
+ isDefault?: boolean;
22
+ };
23
+ export declare const TEMPLATES: DielineTemplate[];
24
+ export declare function getDefaultTemplate(): DielineTemplate;
25
+ export declare function getTemplateById(id: string | undefined): DielineTemplate | undefined;
26
+ export declare function templateToInitialState(template: DielineTemplate, bleedMmOverride?: number): {
27
+ objects: CanvasObj[];
28
+ pageSize: {
29
+ width: number;
30
+ height: number;
31
+ };
32
+ };
33
+ //# sourceMappingURL=dieline-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dieline-template.d.ts","sourceRoot":"","sources":["../../src/lib/dieline-template.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAG5D,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAKF,eAAO,MAAM,SAAS,EAAE,eAAe,EAA4D,CAAC;AAEpG,wBAAgB,kBAAkB,IAAI,eAAe,CAMpD;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAGnF;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,eAAe,CAAC,EAAE,MAAM,GACvB;IACD,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C,CAuBA"}
@@ -0,0 +1,43 @@
1
+ import library from "../data/dielines.json";
2
+ const MM_TO_PT = 2.83465;
3
+ const DIELINE_STROKE = "#fc5102";
4
+ export const TEMPLATES = library.templates;
5
+ export function getDefaultTemplate() {
6
+ const flagged = TEMPLATES.find((t) => t.isDefault);
7
+ if (flagged)
8
+ return flagged;
9
+ const first = TEMPLATES[0];
10
+ if (!first)
11
+ throw new Error("dielines.json contains no templates");
12
+ return first;
13
+ }
14
+ export function getTemplateById(id) {
15
+ if (!id)
16
+ return undefined;
17
+ return TEMPLATES.find((t) => t.id === id);
18
+ }
19
+ export function templateToInitialState(template, bleedMmOverride) {
20
+ const bleedMm = bleedMmOverride ?? template.bleedMm;
21
+ const pageSize = {
22
+ width: (template.dimensions.widthMm + bleedMm * 2) * MM_TO_PT,
23
+ height: (template.dimensions.heightMm + bleedMm * 2) * MM_TO_PT,
24
+ };
25
+ // The trim sits inside the bleed margin by `bleedMm` on each side.
26
+ // Templates carry their own trimBox.x/y assuming their bundled
27
+ // bleedMm; we override here so the trim stays the right size and
28
+ // shifts to match the effective bleed.
29
+ const dielineObj = {
30
+ id: `dieline-${template.id}`,
31
+ type: "rect",
32
+ x: bleedMm * MM_TO_PT,
33
+ y: bleedMm * MM_TO_PT,
34
+ width: template.trimBox.width * MM_TO_PT,
35
+ height: template.trimBox.height * MM_TO_PT,
36
+ fill: "transparent",
37
+ stroke: DIELINE_STROKE,
38
+ strokeWidth: 1,
39
+ opacity: 1,
40
+ };
41
+ return { objects: [dielineObj], pageSize };
42
+ }
43
+ //# sourceMappingURL=dieline-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dieline-template.js","sourceRoot":"","sources":["../../src/lib/dieline-template.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAe5C,MAAM,QAAQ,GAAG,OAAO,CAAC;AACzB,MAAM,cAAc,GAAG,SAAS,CAAC;AAEjC,MAAM,CAAC,MAAM,SAAS,GAAuB,OAA4C,CAAC,SAAS,CAAC;AAEpG,MAAM,UAAU,kBAAkB;IAChC,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnD,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAAsB;IACpD,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAC1B,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAAyB,EACzB,eAAwB;IAKxB,MAAM,OAAO,GAAG,eAAe,IAAI,QAAQ,CAAC,OAAO,CAAC;IACpD,MAAM,QAAQ,GAAG;QACf,KAAK,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,QAAQ;QAC7D,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,QAAQ,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,QAAQ;KAChE,CAAC;IACF,mEAAmE;IACnE,+DAA+D;IAC/D,iEAAiE;IACjE,uCAAuC;IACvC,MAAM,UAAU,GAAc;QAC5B,EAAE,EAAE,WAAW,QAAQ,CAAC,EAAE,EAAE;QAC5B,IAAI,EAAE,MAAM;QACZ,CAAC,EAAE,OAAO,GAAG,QAAQ;QACrB,CAAC,EAAE,OAAO,GAAG,QAAQ;QACrB,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,QAAQ;QACxC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,GAAG,QAAQ;QAC1C,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,cAAc;QACtB,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;KACX,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Programmer-facing feature-flag layer for the editor. Modeled on
3
+ * `lens-pdf`'s `ViewerConfig`: every host-visible feature is a typed
4
+ * boolean, defaults are explicit, and overrides resolve in a fixed
5
+ * precedence so behaviour is predictable.
6
+ *
7
+ * Resolution order (later wins):
8
+ * 1. {@link DEFAULT_EDITOR_CONFIG}
9
+ * 2. {@link BASIC_MODE_OVERRIDES} or {@link PRO_MODE_OVERRIDES} (per
10
+ * the `mode` argument)
11
+ * 3. Per-instance overrides passed by the host
12
+ *
13
+ * @public
14
+ */
15
+ export interface EditorConfig {
16
+ enable_brand_logo: boolean;
17
+ enable_export_button: boolean;
18
+ enable_source_link: boolean;
19
+ enable_mode_toggle: boolean;
20
+ enable_new_file_button: boolean;
21
+ enable_demo_badge: boolean;
22
+ enable_tool_select: boolean;
23
+ enable_tool_rect: boolean;
24
+ enable_tool_ellipse: boolean;
25
+ enable_tool_text: boolean;
26
+ enable_tool_image: boolean;
27
+ enable_undo_redo: boolean;
28
+ enable_fit_button: boolean;
29
+ enable_zoom_indicator: boolean;
30
+ enable_fill_picker: boolean;
31
+ enable_stroke_picker: boolean;
32
+ enable_dieline_chooser: boolean;
33
+ enable_bleed_input: boolean;
34
+ enable_layers_panel: boolean;
35
+ enable_separations_panel: boolean;
36
+ enable_preflight_banner: boolean;
37
+ enable_canvas_grid: boolean;
38
+ enable_bleed_visualization: boolean;
39
+ }
40
+ /**
41
+ * Default flag set — every feature on. Hosts that want a minimal
42
+ * embed (e.g. an inline `<EditorApp>` on a landing page) layer their
43
+ * own overrides on top.
44
+ *
45
+ * @public
46
+ */
47
+ export declare const DEFAULT_EDITOR_CONFIG: EditorConfig;
48
+ /**
49
+ * Basic-mode preset: hides the heavyweight pro panels and the source
50
+ * link. Matches the historical "basic" mode behaviour from before the
51
+ * flag system existed.
52
+ *
53
+ * @public
54
+ */
55
+ export declare const BASIC_MODE_OVERRIDES: Partial<EditorConfig>;
56
+ /**
57
+ * Pro-mode preset: identity. Defaults are already pro-friendly.
58
+ *
59
+ * @public
60
+ */
61
+ export declare const PRO_MODE_OVERRIDES: Partial<EditorConfig>;
62
+ /**
63
+ * Merge defaults, the mode preset, and per-instance overrides into a
64
+ * concrete `EditorConfig`. Per-instance always wins.
65
+ *
66
+ * @public
67
+ */
68
+ export declare function resolveConfig(mode: "basic" | "pro", instanceOverrides?: Partial<EditorConfig>): EditorConfig;
69
+ //# sourceMappingURL=editor-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-config.d.ts","sourceRoot":"","sources":["../../src/lib/editor-config.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAY;IAE3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,EAAE,OAAO,CAAC;IAG3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,kBAAkB,EAAE,OAAO,CAAC;IAG5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,wBAAwB,EAAE,OAAO,CAAC;IAClC,uBAAuB,EAAE,OAAO,CAAC;IAGjC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,0BAA0B,EAAE,OAAO,CAAC;CACrC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,YA4BnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,YAAY,CAItD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,YAAY,CAAM,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,OAAO,GAAG,KAAK,EACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GACxC,YAAY,CAGd"}
@@ -0,0 +1,66 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+ /**
3
+ * Default flag set — every feature on. Hosts that want a minimal
4
+ * embed (e.g. an inline `<EditorApp>` on a landing page) layer their
5
+ * own overrides on top.
6
+ *
7
+ * @public
8
+ */
9
+ export const DEFAULT_EDITOR_CONFIG = {
10
+ // Chrome
11
+ enable_brand_logo: true,
12
+ enable_export_button: true,
13
+ enable_source_link: true,
14
+ enable_mode_toggle: true,
15
+ enable_new_file_button: true,
16
+ enable_demo_badge: true,
17
+ // Toolbar
18
+ enable_tool_select: true,
19
+ enable_tool_rect: true,
20
+ enable_tool_ellipse: true,
21
+ enable_tool_text: true,
22
+ enable_tool_image: true,
23
+ enable_undo_redo: true,
24
+ enable_fit_button: true,
25
+ enable_zoom_indicator: true,
26
+ enable_fill_picker: true,
27
+ enable_stroke_picker: true,
28
+ enable_dieline_chooser: true,
29
+ enable_bleed_input: true,
30
+ // Panels
31
+ enable_layers_panel: true,
32
+ enable_separations_panel: true,
33
+ enable_preflight_banner: true,
34
+ // Canvas
35
+ enable_canvas_grid: true,
36
+ enable_bleed_visualization: true,
37
+ };
38
+ /**
39
+ * Basic-mode preset: hides the heavyweight pro panels and the source
40
+ * link. Matches the historical "basic" mode behaviour from before the
41
+ * flag system existed.
42
+ *
43
+ * @public
44
+ */
45
+ export const BASIC_MODE_OVERRIDES = {
46
+ enable_layers_panel: false,
47
+ enable_separations_panel: false,
48
+ enable_source_link: false,
49
+ };
50
+ /**
51
+ * Pro-mode preset: identity. Defaults are already pro-friendly.
52
+ *
53
+ * @public
54
+ */
55
+ export const PRO_MODE_OVERRIDES = {};
56
+ /**
57
+ * Merge defaults, the mode preset, and per-instance overrides into a
58
+ * concrete `EditorConfig`. Per-instance always wins.
59
+ *
60
+ * @public
61
+ */
62
+ export function resolveConfig(mode, instanceOverrides) {
63
+ const modeOverrides = mode === "basic" ? BASIC_MODE_OVERRIDES : PRO_MODE_OVERRIDES;
64
+ return { ...DEFAULT_EDITOR_CONFIG, ...modeOverrides, ...instanceOverrides };
65
+ }
66
+ //# sourceMappingURL=editor-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-config.js","sourceRoot":"","sources":["../../src/lib/editor-config.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAiD7C;;;;;;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,wBAAwB,EAAE,IAAI;IAC9B,uBAAuB,EAAE,IAAI;IAC7B,SAAS;IACT,kBAAkB,EAAE,IAAI;IACxB,0BAA0B,EAAE,IAAI;CACjC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA0B;IACzD,mBAAmB,EAAE,KAAK;IAC1B,wBAAwB,EAAE,KAAK;IAC/B,kBAAkB,EAAE,KAAK;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA0B,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"}
@@ -0,0 +1,8 @@
1
+ import type { PreflightIssue, PreflightRule } from "./types";
2
+ type CheckResult = {
3
+ issues: PreflightIssue[];
4
+ skippedChecks: string[];
5
+ };
6
+ export declare function runClientChecks(file: File, rules: PreflightRule[]): Promise<CheckResult>;
7
+ export {};
8
+ //# sourceMappingURL=checks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/lib/preflight/checks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7D,KAAK,WAAW,GAAG;IAAE,MAAM,EAAE,cAAc,EAAE,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEzE,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAiD9F"}