@printine/pod-editor 0.0.0-stage → 0.1.15

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 (215) hide show
  1. package/README.md +224 -2
  2. package/dist/DesignerRuntimeContext.d.ts +3 -0
  3. package/dist/PrintineDesigner.d.ts +9 -0
  4. package/dist/api/asset-client.d.ts +8 -0
  5. package/dist/api/asset-client.js +40 -0
  6. package/dist/api/asset-endpoints.d.ts +36 -0
  7. package/dist/assets/icons/aspect_ratio.d.ts +3 -0
  8. package/dist/assets/icons/delete.d.ts +3 -0
  9. package/dist/assets/icons/fit_screen.d.ts +3 -0
  10. package/dist/assets/icons/index.d.ts +11 -0
  11. package/dist/assets/icons/loading_1.d.ts +3 -0
  12. package/dist/assets/icons/loading_2.d.ts +3 -0
  13. package/dist/assets/icons/loading_3.d.ts +3 -0
  14. package/dist/assets/icons/pan.d.ts +3 -0
  15. package/dist/assets/icons/setting.d.ts +3 -0
  16. package/dist/assets/icons/text_color.d.ts +3 -0
  17. package/dist/assets/icons/text_h.d.ts +3 -0
  18. package/dist/assets/icons/text_v.d.ts +3 -0
  19. package/dist/bundled-assets.d.ts +4 -0
  20. package/dist/components/add-design.d.ts +8 -0
  21. package/dist/components/assets-dialog.d.ts +24 -0
  22. package/dist/components/canvas-context-menu.d.ts +6 -0
  23. package/dist/components/color-picker/index.d.ts +11 -0
  24. package/dist/components/context.d.ts +24 -0
  25. package/dist/components/design.d.ts +9 -0
  26. package/dist/components/fonts.d.ts +26 -0
  27. package/dist/components/image-crop.d.ts +5 -0
  28. package/dist/components/image-edit.d.ts +1 -0
  29. package/dist/components/layout/aside.d.ts +4 -0
  30. package/dist/components/layout/bottom-nav/element-menu-sheet.d.ts +11 -0
  31. package/dist/components/layout/bottom-nav/element-sheet.d.ts +11 -0
  32. package/dist/components/layout/bottom-nav/index.d.ts +1 -0
  33. package/dist/components/layout/header.d.ts +1 -0
  34. package/dist/components/loading.d.ts +3 -0
  35. package/dist/components/menus/background.d.ts +6 -0
  36. package/dist/components/menus/clipart.d.ts +6 -0
  37. package/dist/components/menus/files.d.ts +7 -0
  38. package/dist/components/menus/image.d.ts +8 -0
  39. package/dist/components/menus/index.d.ts +13 -0
  40. package/dist/components/menus/layer.d.ts +5 -0
  41. package/dist/components/menus/product.d.ts +3 -0
  42. package/dist/components/menus/sca.d.ts +5 -0
  43. package/dist/components/menus/shapes.d.ts +6 -0
  44. package/dist/components/menus/templates.d.ts +6 -0
  45. package/dist/components/menus/text-effects.d.ts +5 -0
  46. package/dist/components/menus/text.d.ts +6 -0
  47. package/dist/components/placement-tab.d.ts +7 -0
  48. package/dist/components/preview/3d.d.ts +8 -0
  49. package/dist/components/preview/graphic.d.ts +15 -0
  50. package/dist/components/preview/index.d.ts +20 -0
  51. package/dist/components/preview/open.d.ts +7 -0
  52. package/dist/components/preview/real-time/3d.d.ts +12 -0
  53. package/dist/components/preview/real-time/graphic.d.ts +31 -0
  54. package/dist/components/preview/real-time/index.d.ts +12 -0
  55. package/dist/components/scale-tools.d.ts +7 -0
  56. package/dist/components/semi-deisgn-config.d.ts +13 -0
  57. package/dist/components/semi-design-link.d.ts +9 -0
  58. package/dist/components/semi-interact-editor.d.ts +27 -0
  59. package/dist/components/semi-renderer.d.ts +74 -0
  60. package/dist/components/store.d.ts +1 -0
  61. package/dist/components/toolbar.d.ts +2 -0
  62. package/dist/components/upload-types.d.ts +20 -0
  63. package/dist/config-D2qm60gf.js +16 -0
  64. package/dist/contracts/api-design.d.ts +180 -0
  65. package/dist/contracts/design.d.ts +86 -0
  66. package/dist/design-CZvEVkwi.js +21443 -0
  67. package/dist/designer-store-Da9fICz8.js +153 -0
  68. package/dist/engine/canvas-designer.d.ts +101 -0
  69. package/dist/engine/canvas-designer.js +313 -0
  70. package/dist/engine/constants.d.ts +26 -0
  71. package/dist/engine/constants.js +147 -0
  72. package/dist/engine/editor.d.ts +199 -0
  73. package/dist/engine/editor.js +801 -0
  74. package/dist/engine/events.d.ts +35 -0
  75. package/dist/engine/events.js +7 -0
  76. package/dist/engine/extensions/curved-text.d.ts +59 -0
  77. package/dist/engine/fabric.d.ts +4 -0
  78. package/dist/engine/fabric.js +187 -0
  79. package/dist/engine/history.d.ts +27 -0
  80. package/dist/engine/history.js +56 -0
  81. package/dist/engine/managers/event.d.ts +101 -0
  82. package/dist/engine/managers/event.js +410 -0
  83. package/dist/engine/managers/resize.d.ts +26 -0
  84. package/dist/engine/managers/resize.js +64 -0
  85. package/dist/engine/managers/snapline.d.ts +70 -0
  86. package/dist/engine/managers/snapline.js +124 -0
  87. package/dist/engine/managers/workspace.d.ts +29 -0
  88. package/dist/engine/managers/workspace.js +75 -0
  89. package/dist/engine/processors/image.d.ts +88 -0
  90. package/dist/engine/processors/image.js +473 -0
  91. package/dist/engine/processors/template.d.ts +45 -0
  92. package/dist/engine/processors/template.js +314 -0
  93. package/dist/engine/processors/text.d.ts +74 -0
  94. package/dist/engine/processors/text.js +215 -0
  95. package/dist/engine/semi-export-editor.d.ts +215 -0
  96. package/dist/engine/types.d.ts +28 -0
  97. package/dist/engine/utils/common.d.ts +25 -0
  98. package/dist/engine/utils/common.js +68 -0
  99. package/dist/engine/utils/dialog.d.ts +25 -0
  100. package/dist/engine/utils/font.d.ts +5 -0
  101. package/dist/engine/utils/font.js +39 -0
  102. package/dist/engine/utils/image.d.ts +8 -0
  103. package/dist/engine/utils/image.js +50 -0
  104. package/dist/engine/utils/loading.d.ts +17 -0
  105. package/dist/engine/utils/loading.js +71 -0
  106. package/dist/engine/utils/measure.d.ts +6 -0
  107. package/dist/engine/utils/measure.js +6 -0
  108. package/dist/engine/utils/mockup.d.ts +59 -0
  109. package/dist/engine/utils/setting.d.ts +4 -0
  110. package/dist/engine/utils/setting.js +73 -0
  111. package/dist/fabric-types.d.ts +59 -0
  112. package/dist/full-designer.js +13 -0
  113. package/dist/hooks/pagination.d.ts +19 -0
  114. package/dist/hooks/use-adobe-express.d.ts +50 -0
  115. package/dist/hooks/use-before-unload.d.ts +1 -0
  116. package/dist/hooks/use-image-drop.d.ts +18 -0
  117. package/dist/hooks/use-preview-assets.d.ts +2 -0
  118. package/dist/hooks/use-screen.d.ts +1 -0
  119. package/dist/i18n/index.d.ts +12 -0
  120. package/dist/images/design/asset_empty.png +0 -0
  121. package/dist/images/design/design/background.svg +3 -0
  122. package/dist/images/design/design/color-picker.svg +15 -0
  123. package/dist/images/design/design/computer.svg +1 -0
  124. package/dist/images/design/design/copy.svg +1 -0
  125. package/dist/images/design/design/image.svg +10 -0
  126. package/dist/images/design/design/line.svg +1 -0
  127. package/dist/images/design/design/text.svg +1 -0
  128. package/dist/images/design/design/title.svg +1 -0
  129. package/dist/images/design/empty.png +0 -0
  130. package/dist/images/design/layer_empty.png +0 -0
  131. package/dist/images/design/menu/ai.svg +1 -0
  132. package/dist/images/design/menu/back.svg +4 -0
  133. package/dist/images/design/menu/background.svg +6 -0
  134. package/dist/images/design/menu/clipart.svg +6 -0
  135. package/dist/images/design/menu/file.svg +4 -0
  136. package/dist/images/design/menu/fill.svg +1 -0
  137. package/dist/images/design/menu/image.svg +7 -0
  138. package/dist/images/design/menu/layer.svg +6 -0
  139. package/dist/images/design/menu/product.svg +3 -0
  140. package/dist/images/design/menu/sca.svg +5 -0
  141. package/dist/images/design/menu/shapes.svg +5 -0
  142. package/dist/images/design/menu/templates.svg +6 -0
  143. package/dist/images/design/menu/text.svg +6 -0
  144. package/dist/images/design/menu/uploads.svg +7 -0
  145. package/dist/images/design/spinner.svg +3 -0
  146. package/dist/images/design/spinners.svg +17 -0
  147. package/dist/images/design/transparent_pattern.svg +5 -0
  148. package/dist/index.d.ts +49 -0
  149. package/dist/index.js +156 -0
  150. package/dist/lib/analytics.d.ts +17 -0
  151. package/dist/lib/base-plate.d.ts +3 -0
  152. package/dist/lib/cn.d.ts +3 -0
  153. package/dist/lib/common.d.ts +16 -0
  154. package/dist/lib/config.d.ts +14 -0
  155. package/dist/lib/navigation.d.ts +2 -0
  156. package/dist/pixel-map-dSys7UAx.js +137 -0
  157. package/dist/renderer/ThreeDPreview.d.ts +14 -0
  158. package/dist/renderer/latest-task-queue.d.ts +17 -0
  159. package/dist/renderer/pixel-map.d.ts +37 -0
  160. package/dist/renderer/preview-asset-cache.d.ts +4 -0
  161. package/dist/renderer/render-layer-output.d.ts +5 -0
  162. package/dist/renderer/semi-resource-cache.d.ts +28 -0
  163. package/dist/renderer/sticker.d.ts +34 -0
  164. package/dist/renderer/sticker.js +1837 -0
  165. package/dist/renderer/three-d-preview.js +32 -0
  166. package/dist/semi-interact-editor-DfzphWy3.js +1409 -0
  167. package/dist/semi-renderer.d.ts +7 -0
  168. package/dist/semi-renderer.js +5 -0
  169. package/dist/state/designer-store.d.ts +43 -0
  170. package/dist/state/designer-store.js +8 -0
  171. package/dist/style.css +1 -0
  172. package/dist/types.d.ts +279 -0
  173. package/dist/ui/accordion.d.ts +7 -0
  174. package/dist/ui/button-group.d.ts +11 -0
  175. package/dist/ui/button.d.ts +10 -0
  176. package/dist/ui/checkbox.d.ts +4 -0
  177. package/dist/ui/command.d.ts +18 -0
  178. package/dist/ui/confirm-dialog.d.ts +15 -0
  179. package/dist/ui/context-menu.d.ts +25 -0
  180. package/dist/ui/dialog.d.ts +15 -0
  181. package/dist/ui/drawer.d.ts +15 -0
  182. package/dist/ui/editable-combobox.d.ts +11 -0
  183. package/dist/ui/hint.d.ts +8 -0
  184. package/dist/ui/image.d.ts +24 -0
  185. package/dist/ui/input-group.d.ts +16 -0
  186. package/dist/ui/input-with-addon.d.ts +17 -0
  187. package/dist/ui/input.d.ts +3 -0
  188. package/dist/ui/label.d.ts +4 -0
  189. package/dist/ui/loading-button.d.ts +15 -0
  190. package/dist/ui/popover.d.ts +9 -0
  191. package/dist/ui/scroll-area.d.ts +5 -0
  192. package/dist/ui/select.d.ts +22 -0
  193. package/dist/ui/separator.d.ts +4 -0
  194. package/dist/ui/shared-loading-button.d.ts +20 -0
  195. package/dist/ui/simple-dialog.d.ts +19 -0
  196. package/dist/ui/simple-popover.d.ts +13 -0
  197. package/dist/ui/simple-select.d.ts +20 -0
  198. package/dist/ui/skeleton.d.ts +2 -0
  199. package/dist/ui/slider.d.ts +4 -0
  200. package/dist/ui/spinner-box.d.ts +12 -0
  201. package/dist/ui/spinner.d.ts +2 -0
  202. package/dist/ui/switch.d.ts +6 -0
  203. package/dist/ui/tab/index.d.ts +15 -0
  204. package/dist/ui/textarea.d.ts +3 -0
  205. package/dist/ui/tooltip.d.ts +7 -0
  206. package/dist/workers/image-resize.worker.d.ts +1 -0
  207. package/dist/workers/mockup.worker.d.ts +5 -0
  208. package/dist/workers/pixel-map.worker.d.ts +1 -0
  209. package/dist/workers/render-asset-cache.d.ts +18 -0
  210. package/dist/workers/render.worker.d.ts +1 -0
  211. package/docs/HOST_DATA_CONTRACT.md +434 -0
  212. package/docs/INTEGRATION_API.md +547 -0
  213. package/docs/SEMI_RENDERER.md +141 -0
  214. package/docs/auth-api.md +3 -0
  215. package/package.json +199 -4
package/README.md CHANGED
@@ -1,3 +1,225 @@
1
- # Temporary Holding Version
1
+ # @printine/pod-editor
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ React online product designer for Printine-powered products. It provides the
4
+ editor UI, Fabric canvas, 2D/3D preview and design-data integration;
5
+ the host application owns its own routing, authentication, uploads, user
6
+ assets, saved templates and final design persistence.
7
+
8
+ For a complete React integration, including host upload/save implementations,
9
+ start with the [第三方接入文档(React)](https://printine.dev/docs).
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install @printine/pod-editor
15
+ ```
16
+
17
+ `react` and `react-dom` 18 or 19 are peer dependencies.
18
+
19
+ ## Quick start
20
+
21
+ Render the component in the browser on a dedicated page. Replace the example
22
+ product ID with a valid variant ID and supply the complete host-loaded
23
+ `basePlate`. The base plate must contain at least one design area and accessible
24
+ SVG assets. Wait until the base plate is loaded before mounting the editor.
25
+
26
+ ```tsx
27
+ import { PrintineDesigner, type BasePlate } from '@printine/pod-editor';
28
+ import '@printine/pod-editor/styles.css';
29
+
30
+ export function ProductDesigner({ basePlate }: { basePlate: BasePlate }) {
31
+ return (
32
+ <PrintineDesigner
33
+ productId="variant-id"
34
+ basePlate={basePlate}
35
+ productInfo={{ title: 'Classic T-shirt', price: 19.9, currency: 'USD' }}
36
+ locale="en-US"
37
+ onClose={() => window.history.back()}
38
+ />
39
+ );
40
+ }
41
+ ```
42
+
43
+ This mounts the editor using the supplied base plate and the host's same-origin
44
+ asset proxy. Upload and Done controls appear only when the host
45
+ provides `adapters.uploadImage` and `onSave`, respectively.
46
+
47
+ For Next.js App Router, dynamically import the component with
48
+ `next/dynamic({ ssr: false })` inside a Client Component. A `'use client'`
49
+ directive alone does not disable server prerendering.
50
+
51
+ The full editor uses viewport-sized layouts and fixed toolbars. Mount one full
52
+ designer at a time: the current implementation uses shared state and
53
+ module-level API clients.
54
+
55
+ ## Integration model
56
+
57
+ The host must supply `productId` and a complete `basePlate`. The editor never
58
+ fetches base-plate or product data. Product display information comes through
59
+ `productInfo`, and saved designs through `initialDesignData`. Keep the
60
+ `basePlate` object reference stable during editing; replace it when switching
61
+ to a different base plate.
62
+
63
+ Product details, uploads, saved designs and templates are host-owned.
64
+
65
+ Public editor assets default to the embedding page's own origin, through a merchant backend
66
+ proxy at `/api/v1/editor/*`. The merchant server holds its `assets:read` App Key;
67
+ the browser never receives it. To use a separate authorized resource origin,
68
+ pass domain-only overrides. The package adds the API paths itself:
69
+
70
+ | Prop | Default | SDK-owned path prefix |
71
+ | --- | --- | --- |
72
+ | `assetBaseUrl` | Current page origin (`/`) | `/api/v1/editor/` |
73
+
74
+ `assetBaseUrl` is the merchant resource-service origin, not a CDN/static-image
75
+ prefix. The default `/` resolves to the current browser origin; SSR callers of
76
+ the low-level client must provide an absolute origin. Fonts, shapes and clipart
77
+ categories use `/api/v1/editor/*` without legacy aliases or redirects. Requests
78
+ use `credentials: 'same-origin'` and never send an App Key. The proxy must also
79
+ return browser-accessible merchant file URLs, preserving filename suffixes and
80
+ resource `v` references. Cross-origin overrides do not automatically send cookies
81
+ to the other origin. Use a same-origin proxy or supply custom `adapters.library`
82
+ loaders when your resource service needs different authentication. The package
83
+ has no top-level `token` or `appKey` prop.
84
+
85
+ Hosts may supply `adapters.library` for normalized fonts, shapes and clipart.
86
+ Preset colours are host-owned: provide `adapters.library.colors.list` to return
87
+ a `Promise<string[]>`. Without it, the preset palette is empty and no settings
88
+ API request occurs. This does not disable the normal custom colour picker.
89
+
90
+ The following user-specific capabilities are always supplied by the host:
91
+
92
+ | Capability | Host integration | Behaviour when omitted |
93
+ | --- | --- | --- |
94
+ | Image upload | `adapters.uploadImage` | Upload controls are hidden. |
95
+ | My images | `adapters.assets.list` | The image library is hidden. |
96
+ | Delete an image | `adapters.assets.remove` | The image delete button is hidden. |
97
+ | My designs | `adapters.templates` | “My designs” is hidden. Saving templates also requires `adapters.uploadImage`. |
98
+ | Save the final design | `onSave` | Done is hidden in the preview. |
99
+
100
+ The public template catalog is currently disabled. User templates are provided
101
+ by `adapters.templates`.
102
+
103
+ ### Uploads and assets
104
+
105
+ `uploadImage` receives a `purpose` of `'asset'`, `'design-data'` or
106
+ `'template-preview'` and returns a `DesignerImageUploadResult`:
107
+
108
+ ```ts
109
+ import type { DesignerImageUploadResult } from '@printine/pod-editor';
110
+
111
+ const result: DesignerImageUploadResult = {
112
+ id: 'host-asset-id',
113
+ url: 'https://cdn.example.com/original/logo.png',
114
+ thumbnailUrl: 'https://cdn.example.com/thumb/logo.png',
115
+ canvasThumbnailUrl: 'https://cdn.example.com/canvas/logo.png',
116
+ thumbnailScale: 0.5,
117
+ };
118
+ ```
119
+
120
+ Only `url` is required. All URL fields must be complete browser-accessible
121
+ URLs. `thumbnailUrl` is used in lists; `canvasThumbnailUrl` is used on the
122
+ canvas, falling back to `thumbnailUrl`. `thumbnailScale` must match the actual
123
+ canvas thumbnail dimensions divided by the original dimensions.
124
+
125
+ For `purpose: 'asset'`, the host is responsible for its complete workflow:
126
+ uploading the original image, optionally creating a thumbnail, and creating the
127
+ host's asset record before resolving the promise. The package never calls a
128
+ `user-assets` endpoint. Optional `metadata` is supplied for `asset` uploads;
129
+ do not require it for the other purposes. Returning an asset `id` lets the editor
130
+ add the uploaded item to the current library without another list request.
131
+
132
+ ### Saved templates
133
+
134
+ `adapters.templates` contains `create`, `list` and `get`; `remove` is optional.
135
+ The package uploads a template preview through `uploadImage` with
136
+ `purpose: 'template-preview'`, then passes the preview URL and template content
137
+ to `templates.create`.
138
+
139
+ ### Saving
140
+
141
+ `onSave` receives the prepared design payload:
142
+
143
+ ```ts
144
+ type DesignerSaveInput = {
145
+ variant_id: string;
146
+ design_data: Record<string, unknown>;
147
+ previewBlob?: Blob;
148
+ background_customized?: unknown;
149
+ is_partially_customized?: 1;
150
+ };
151
+ ```
152
+
153
+ `previewBlob` is optional, is not guaranteed for every preview mode, and must be
154
+ uploaded separately from JSON when used. Keep the design JSON intact when
155
+ persisting it. If your endpoint needs `base_plate_id`, add it from the host page;
156
+ it is not included in `DesignerSaveInput`.
157
+
158
+ The callback owns its request, business-error handling, analytics and any route
159
+ change. Resolve only after a successful save; reject on HTTP or business
160
+ failure after displaying the host's error. The package clears its loading state
161
+ without repeating the error. A resolved callback emits `save-complete`; it does
162
+ not automatically navigate or add the design to a cart.
163
+
164
+ ### Restoring a saved design
165
+
166
+ Pass the persisted `design_data` through `initialDesignData`, keyed by the base
167
+ plate's `areas[].name`. Restore semi-custom background settings separately
168
+ through `initialBackgroundCustomized`. Use `loading={true}` while fetching a
169
+ record, then initialize the editor with the loaded data. These are initial
170
+ values, not controlled canvas state; change the component `key` when switching
171
+ records or base plates.
172
+
173
+ ### Preview rendering
174
+
175
+ Base-plate `renders` and `td_renders` configure live 2D and 3D previews. The
176
+ optional `onRenderPreview` callback handles the full-screen 2D path when no
177
+ usable live preview image exists. It receives the prepared render input and
178
+ must return `Promise<string[]>` containing full image URLs, without a backend
179
+ response wrapper. The package does not call a fixed server-rendering endpoint.
180
+
181
+ ### Errors and events
182
+
183
+ `onError` reports editor initialization, preview and internal processing errors.
184
+ Host upload, asset, template and save request failures are handled by the host;
185
+ server-preview callback failures are reported through `onError`.
186
+
187
+ `onEvent` reports `ready`, `load-start`, `load-complete`, `save-start` and
188
+ `save-complete`. Mount/load events do not guarantee that every image or font
189
+ has finished loading. Keep callbacks and library loaders stable to avoid
190
+ restarting initialization effects. `onAnalytics` exposes the `preview_design`
191
+ event; the host owns save analytics.
192
+
193
+ ## Styling
194
+
195
+ Import `@printine/pod-editor/styles.css` once. The package ships its icons, empty
196
+ states and editor styles, so no host static files or Tailwind content scanning
197
+ are required.
198
+
199
+ Theme variables use the `--printine-` prefix. Override them globally after the
200
+ package stylesheet so portal-based dialogs and menus inherit the same theme:
201
+
202
+ ```css
203
+ :root {
204
+ --printine-primary: #3540a5;
205
+ --printine-background: #f3f5f6;
206
+ --printine-foreground: #1c1c1e;
207
+ --printine-border: #e0e0e5;
208
+ }
209
+ ```
210
+
211
+ Built-in UI languages are English (`en`, `en-US`) and Spanish (`es`, `es-ES`).
212
+ Other locales fall back to English; use `messages` for host-supplied translations.
213
+ Images, fonts, SVGs, models and textures must remain accessible and allow the
214
+ browser to read them across origins when needed for rendering and export.
215
+
216
+ ## Public exports
217
+
218
+ The main entry exports `PrintineDesigner` and the TypeScript contracts needed
219
+ for integration, including `PrintineDesignerProps`, `DesignerAdapters`,
220
+ `DesignerAsset`, `DesignerUserTemplate` and `DesignerSaveInput`.
221
+
222
+ `@printine/pod-editor/full-designer` is available for advanced integrations that
223
+ already provide a designer runtime and the required `basePlate` prop. The main entry also exports
224
+ `PrintineSemiRenderer` for standalone local preview rendering and
225
+ `PrintineSemiInteractEditor` for semi-custom editing.
@@ -0,0 +1,3 @@
1
+ import type { DesignerRuntime } from './types';
2
+ export declare const DesignerRuntimeProvider: import("react").Provider<DesignerRuntime | null>;
3
+ export declare function useDesignerRuntime(): DesignerRuntime;
@@ -0,0 +1,9 @@
1
+ import type { PrintineDesignerProps } from './types';
2
+ import './styles.css';
3
+ /**
4
+ * Public full-screen mount point for the Printine online designer.
5
+ *
6
+ * It mounts the complete editor UI (Fabric canvas, tool panels, real-time
7
+ * 2D/3D previews and save flow) without coupling the host to Next.js.
8
+ */
9
+ export declare function PrintineDesigner(props: PrintineDesignerProps): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { AssetCenterApiClient, AssetCenterApiClientOptions } from '../types';
2
+ /** Browser default: the embedding application's authenticated asset proxy. */
3
+ export declare const DEFAULT_PRINTINE_ASSET_BASE_URL = "/";
4
+ /**
5
+ * Read-only merchant editor-asset proxy client. No App Key or internal token
6
+ * reaches the browser.
7
+ */
8
+ export declare function createAssetCenterApiClient(options: AssetCenterApiClientOptions): AssetCenterApiClient;
@@ -0,0 +1,40 @@
1
+ const c = "api/v1/editor/", a = /* @__PURE__ */ new Set(["fonts", "shapes", "clipart-categories", "cliparts"]), l = "/";
2
+ function u(e, t) {
3
+ if (!a.has(t))
4
+ throw new Error("Unsupported editor asset endpoint. Use the documented /api/v1/editor lists.");
5
+ const r = /^https?:\/\//i.test(e) ? new URL(e) : typeof window < "u" ? new URL(e, window.location.origin) : null;
6
+ if (!r)
7
+ throw new Error("An absolute assetBaseUrl domain is required for SSR.");
8
+ const n = new URL(c, r.origin);
9
+ return new URL(t, n);
10
+ }
11
+ function o(e, t) {
12
+ if (typeof e == "object" && e !== null && "error" in e) {
13
+ const r = e.error;
14
+ if (typeof r == "object" && r !== null && "message" in r) {
15
+ const n = r.message;
16
+ if (typeof n == "string" && n) return n;
17
+ }
18
+ }
19
+ return `Editor asset request failed (${t})`;
20
+ }
21
+ async function f(e) {
22
+ const t = await e.json().catch(() => null);
23
+ if (!e.ok) throw new Error(o(t, e.status));
24
+ if (!t || t.success !== !0) throw new Error(o(t, e.status));
25
+ return t;
26
+ }
27
+ function w(e) {
28
+ return {
29
+ async get(t, r) {
30
+ const n = u(e.assetBaseUrl, t);
31
+ for (const [i, s] of Object.entries(r ?? {}))
32
+ s !== void 0 && n.searchParams.set(i, String(s));
33
+ return f(await fetch(n, { credentials: "same-origin" }));
34
+ }
35
+ };
36
+ }
37
+ export {
38
+ l as DEFAULT_PRINTINE_ASSET_BASE_URL,
39
+ w as createAssetCenterApiClient
40
+ };
@@ -0,0 +1,36 @@
1
+ import type { Font } from '../contracts/design';
2
+ import type { AssetCenterApiClient } from '../types';
3
+ export interface AssetCenterShape {
4
+ id: string;
5
+ name: string;
6
+ url: string;
7
+ thumbnailUrl?: string;
8
+ }
9
+ export interface AssetCenterClipArt {
10
+ id: string;
11
+ name: string;
12
+ url: string;
13
+ thumbnailUrl?: string;
14
+ }
15
+ export interface AssetCenterClipArtCategory {
16
+ id: string;
17
+ name: string;
18
+ clip_arts: AssetCenterClipArt[];
19
+ showAll?: boolean;
20
+ }
21
+ interface AssetCenterPage<T> {
22
+ data: T[];
23
+ meta: {
24
+ current_page: number;
25
+ last_page: number;
26
+ total: number;
27
+ };
28
+ }
29
+ export declare function setAssetCenterApiClient(next: AssetCenterApiClient | null): void;
30
+ /** Unified editor asset endpoints mapped to the editor's view models. */
31
+ export declare const AssetCenterApi: {
32
+ getFontList(): Promise<Font[]>;
33
+ getShapeList(params: Record<string, string | number | boolean | undefined>): Promise<AssetCenterPage<AssetCenterShape>>;
34
+ getClipArtCategories(): Promise<AssetCenterPage<AssetCenterClipArtCategory>>;
35
+ };
36
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function AspectRatioIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default AspectRatioIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function DeleteIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default DeleteIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function FitScreenIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default FitScreenIcon;
@@ -0,0 +1,11 @@
1
+ export { AspectRatioIcon } from './aspect_ratio';
2
+ export { FitScreenIcon } from './fit_screen';
3
+ export { PanIcon } from './pan';
4
+ export { SettingIcon } from './setting';
5
+ export { TextColorIcon } from './text_color';
6
+ export { TextHIcon } from './text_h';
7
+ export { TextVIcon } from './text_v';
8
+ export { Loading1Icon } from './loading_1';
9
+ export { Loading2Icon } from './loading_2';
10
+ export { Loading3Icon } from './loading_3';
11
+ export { DeleteIcon } from './delete';
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function Loading1Icon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default Loading1Icon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function Loading2Icon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default Loading2Icon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function Loading3Icon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default Loading3Icon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function PanIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default PanIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function SettingIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default SettingIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function TextColorIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default TextColorIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function TextHIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default TextHIcon;
@@ -0,0 +1,3 @@
1
+ import type { SVGProps } from 'react';
2
+ export declare function TextVIcon(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
3
+ export default TextVIcon;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * The editor's UI icons and placeholders are embedded in the package output.
3
+ */
4
+ export declare const bundledDesignerAssets: Record<string, string>;
@@ -0,0 +1,8 @@
1
+ import { TemplateData } from '../contracts/api-design';
2
+ type AddDesignProps = {
3
+ template: TemplateData | null;
4
+ show: boolean;
5
+ onChange: (value: boolean) => void;
6
+ };
7
+ export default function AddDesign({ template, ...props }: AddDesignProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,24 @@
1
+ export interface SelectImageParams {
2
+ /** Original image URL retained for high-resolution rendering. */
3
+ url: string;
4
+ /** Host-provided small rendition, used only for option-list thumbnails. */
5
+ thumbnailUrl?: string;
6
+ /** Host-provided rendition intended for the editable canvas. */
7
+ canvasThumbnailUrl?: string;
8
+ blobUrl?: string;
9
+ scale?: number;
10
+ }
11
+ export interface AssetsDialogProps {
12
+ open: boolean;
13
+ onOpenChange: (open: boolean) => void;
14
+ onSelectImage: (image: SelectImageParams) => void;
15
+ className?: string;
16
+ }
17
+ /**
18
+ * Package-owned replacement for the host's asset-library dialog.
19
+ *
20
+ * It deliberately exposes only the package-safe upload flow. A host can add a
21
+ * DAM outside the package when needed, without coupling this reusable dialog to
22
+ * a page-owned asset-library implementation.
23
+ */
24
+ export default function AssetsDialog({ open, onOpenChange, onSelectImage, className }: AssetsDialogProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ type CanvasContextMenuProps = {
2
+ children: React.ReactNode;
3
+ canvasIsEmpty: boolean;
4
+ };
5
+ export default function CanvasContextMenu({ children, canvasIsEmpty }: CanvasContextMenuProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface ColorPickerProps {
3
+ className?: string;
4
+ value?: string;
5
+ onChange?: (value: string, type: string) => void;
6
+ custom?: boolean;
7
+ unset?: boolean;
8
+ colors?: string[];
9
+ }
10
+ export default function ColorPicker({ value, onChange, custom, unset, colors, className, }: ColorPickerProps): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,24 @@
1
+ import Editor from '../engine/editor';
2
+ import EventManager from '../engine/managers/event';
3
+ import { Product, BasePlate } from '../contracts/api-design';
4
+ import React from 'react';
5
+ import type { PersistImage } from './upload-types';
6
+ type DesignContextType = {
7
+ canvasEditor: React.RefObject<Editor | null>;
8
+ eventManager: React.RefObject<EventManager | null>;
9
+ productData: Product;
10
+ plateData: BasePlate;
11
+ currentViewName: string;
12
+ viewColors: Record<string, string>;
13
+ setViewColors: React.Dispatch<React.SetStateAction<Record<string, string>>>;
14
+ onPersistImage: PersistImage;
15
+ onChangeView: (placement: string) => Promise<void>;
16
+ setCanvasLoading: React.Dispatch<React.SetStateAction<boolean>>;
17
+ };
18
+ export declare const DesignContext: React.Context<DesignContextType | null>;
19
+ export declare const useDesignContext: () => DesignContextType;
20
+ export declare function DesignProvider({ value, children }: {
21
+ value: DesignContextType;
22
+ children: React.ReactNode;
23
+ }): React.JSX.Element;
24
+ export {};
@@ -0,0 +1,9 @@
1
+ import { BasePlate } from '../contracts/api-design';
2
+ export interface FullDesignerProps {
3
+ /** Enables the optional semi-customization menu supplied by the existing API. */
4
+ semiDesignPermission?: boolean;
5
+ /** Complete base plate supplied by the host. */
6
+ basePlate: BasePlate;
7
+ }
8
+ declare const Design: ({ semiDesignPermission, basePlate }: FullDesignerProps) => import("react").JSX.Element;
9
+ export default Design;
@@ -0,0 +1,26 @@
1
+ import type { Font, FontFile } from '../contracts/design';
2
+ interface FontsProps {
3
+ type: 'ADD' | 'UPDATE' | 'CHECK';
4
+ onUpdate?: (data: {
5
+ fontFamily: string;
6
+ fontWeight: number;
7
+ fontStyle: string;
8
+ fontPath: string;
9
+ }) => void;
10
+ onDone?: () => void;
11
+ checkedList?: Font[];
12
+ }
13
+ export type FontsRef = {
14
+ getCheckedFonts: () => Font[];
15
+ };
16
+ declare const Fonts: import("react").ForwardRefExoticComponent<FontsProps & import("react").RefAttributes<FontsRef>>;
17
+ export interface FontListProps {
18
+ type: 'ADD' | 'UPDATE' | 'CHECK';
19
+ onAddText?: (item: Font, font: FontFile) => void;
20
+ fontList: Font[];
21
+ onCheck?: (item: Font, file: FontFile) => void;
22
+ checkedFonts?: Font[];
23
+ showSearchBar?: boolean;
24
+ }
25
+ export declare function FontList({ fontList, type, onCheck, onAddText, checkedFonts, showSearchBar, }: FontListProps): import("react").JSX.Element;
26
+ export default Fonts;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ /**
3
+ * 图片裁剪确认、取消按钮
4
+ */
5
+ export default function ImageCrop(): React.JSX.Element | null;
@@ -0,0 +1 @@
1
+ export default function ImageEdit(): import("react").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export default function DesignAside({ semiDesignPermission }: {
3
+ semiDesignPermission: boolean;
4
+ }): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { ElementType } from '../../../contracts/design';
2
+ /**
3
+ * 手机端元素菜单弹窗
4
+ */
5
+ interface MenuPhoneProps {
6
+ show: boolean;
7
+ setShow: (show: boolean) => void;
8
+ onAddVariant: (type: ElementType) => void;
9
+ }
10
+ export default function ElementMenuSheet({ show, setShow, onAddVariant }: MenuPhoneProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import { ElementType } from '../../../contracts/design';
2
+ import { ExtraData } from '../../menus';
3
+ type ElementSheetProps = {
4
+ show: boolean;
5
+ contentType?: ElementType;
6
+ setShow: (show: boolean) => void;
7
+ onBack?: () => void;
8
+ extraData?: ExtraData;
9
+ };
10
+ export default function ElementSheet({ show, contentType, setShow, extraData, ...props }: ElementSheetProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1 @@
1
+ export default function BottomNav(): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Header(): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export default function DesignLoading({ className }: {
2
+ className?: string;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ type BackgroundProps = {
2
+ position?: 'sidebar' | 'sheet';
3
+ show: boolean;
4
+ };
5
+ export default function Background({ position, show }: BackgroundProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ interface ClipartProps {
2
+ show: boolean;
3
+ type?: 'sidebar' | 'sheet';
4
+ }
5
+ export default function Clipart({ show, type }: ClipartProps): import("react").JSX.Element;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ interface FilesProps {
2
+ show?: boolean;
3
+ type?: 'sidebar' | 'sheet';
4
+ isShapeUpload?: boolean;
5
+ }
6
+ export default function Files({ show, type, isShapeUpload }: FilesProps): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ interface ImageUploadProps {
2
+ show: boolean;
3
+ isShapeUpload?: boolean;
4
+ type?: 'sidebar' | 'sheet';
5
+ file?: File;
6
+ }
7
+ export default function ImageUpload({ show, isShapeUpload, type, file }: ImageUploadProps): import("react").JSX.Element;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ElementType } from '../../contracts/design';
2
+ export interface ExtraData {
3
+ shape?: boolean;
4
+ image?: File;
5
+ hideBack?: boolean;
6
+ }
7
+ type MenuProps = {
8
+ type?: ElementType;
9
+ position?: 'sidebar' | 'sheet';
10
+ extraData?: ExtraData;
11
+ };
12
+ export default function Menu({ type, position }: MenuProps): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ interface LayerProps {
2
+ show: boolean;
3
+ }
4
+ export default function Layer({ show }: LayerProps): import("react").JSX.Element;
5
+ export {};
@@ -0,0 +1,3 @@
1
+ export default function Product({ show }: {
2
+ show: boolean;
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ interface SCAListProps {
2
+ show: boolean;
3
+ }
4
+ export default function SCAList({ show }: SCAListProps): import("react").JSX.Element;
5
+ export {};