@printine/pod-editor 0.1.14 → 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.
@@ -1,7 +1,6 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import "./api/endpoints.js";
4
- import { b as s } from "./design-C_TmcalT.js";
3
+ import { c as l } from "./design-CZvEVkwi.js";
5
4
  import "./engine/events.js";
6
5
  import "zustand/react/shallow";
7
6
  import "./engine/history.js";
@@ -10,5 +9,5 @@ import "./engine/constants.js";
10
9
  import "./engine/utils/common.js";
11
10
  import "./designer-store-Da9fICz8.js";
12
11
  export {
13
- s as default
12
+ l as default
14
13
  };
package/dist/index.d.ts CHANGED
@@ -16,10 +16,8 @@ export type { FontListProps } from './components/fonts';
16
16
  export { SimpleSelect } from './ui/simple-select';
17
17
  export { CanvasDesigner, renderPlacementPreviews } from './engine/canvas-designer';
18
18
  export { Editor } from './engine/editor';
19
- export { createDesignerApiClient } from './api/client';
20
19
  export { createAssetCenterApiClient, DEFAULT_PRINTINE_ASSET_BASE_URL } from './api/asset-client';
21
20
  export { AssetCenterApi, setAssetCenterApiClient } from './api/asset-endpoints';
22
- export { CommonApi, DesignApi, setDesignerApiClient } from './api/endpoints';
23
21
  export { HistoryManager } from './engine/history';
24
22
  export { ALIGN_TYPES, DEFAULT_FILL_COLOR_LIST, DEFAULT_FONT_SIZE, ELEMENT_TITLE_MAP, FONT_WEIGHT, LAYER_BLACK_LIST, } from './engine/constants';
25
23
  export { createEventBus, designerEventBus } from './engine/events';
@@ -37,7 +35,7 @@ export * from './engine/utils/font';
37
35
  export { DEFAULT_DPI, inchToPixel, isSvg } from './engine/utils/measure';
38
36
  export { Loading } from './engine/utils/loading';
39
37
  export { getImageControls, setDefaultControls } from './engine/utils/setting';
40
- export type { ApiResponse, AssetCenterApiClient, AssetCenterApiClientOptions, AssetCenterApiResponse, AssetCenterPagination, DesignerApiClient, DesignerApiClientOptions, DesignerAdapters, DesignerAsset, DesignerAssetsAdapter, DesignerError, DesignerEvent, DesignerImageUploadInput, DesignerImageUploadPurpose, DesignerImageUploadResult, DesignerImageMetadata, DesignerLibraryAdapters, DesignerShape, DesignerClipart, DesignerClipartCategory, DesignerPage, DesignerProductInfo, DesignerRenderPreviewInput, DesignerSaveInput, DesignerTemplatesAdapter, DesignerUserTemplate, DesignerRuntime, DesignDocument, PrintineDesignerProps, } from './types';
38
+ export type { AssetCenterApiClient, AssetCenterApiClientOptions, AssetCenterApiResponse, AssetCenterPagination, DesignerAdapters, DesignerAsset, DesignerAssetsAdapter, DesignerError, DesignerEvent, DesignerImageUploadInput, DesignerImageUploadPurpose, DesignerImageUploadResult, DesignerImageMetadata, DesignerLibraryAdapters, DesignerShape, DesignerClipart, DesignerClipartCategory, DesignerPage, DesignerProductInfo, DesignerRenderPreviewInput, DesignerSaveInput, DesignerTemplatesAdapter, DesignerUserTemplate, DesignerRuntime, DesignDocument, PrintineDesignerProps, } from './types';
41
39
  export type { AppEvents, DesignerEventBus } from './engine/events';
42
40
  export type { EditorOptions } from './engine/editor';
43
41
  export type { DesignerState } from './state/designer-store';
package/dist/index.js CHANGED
@@ -1,99 +1,91 @@
1
- import { AdvancedIText as q } from "./engine/fabric.js";
2
- import { s as d, D as R, a as U, b, C as B } from "./design-C_TmcalT.js";
3
- import { F as Q, S as ee, u as re } from "./design-C_TmcalT.js";
4
- import { jsx as r, jsxs as N } from "react/jsx-runtime";
5
- import { useMemo as c, useEffect as a } from "react";
6
- import { DEFAULT_PRINTINE_API_BASE_URL as y, createDesignerApiClient as M } from "./api/client.js";
7
- import { setDesignerApiClient as u } from "./api/endpoints.js";
8
- import { CommonApi as te, DesignApi as ae } from "./api/endpoints.js";
9
- import { DEFAULT_PRINTINE_ASSET_BASE_URL as h, createAssetCenterApiClient as O } from "./api/asset-client.js";
10
- import { s as x } from "./designer-store-Da9fICz8.js";
11
- import { A as se, u as ie } from "./designer-store-Da9fICz8.js";
12
- import { d as z, s as H } from "./config-D2qm60gf.js";
13
- import { P as me, a as pe } from "./semi-interact-editor-DfzphWy3.js";
14
- import { P as ge } from "./pixel-map-dSys7UAx.js";
15
- import { CanvasDesigner as ce, renderPlacementPreviews as ue } from "./engine/canvas-designer.js";
16
- import { Editor as Ee } from "./engine/editor.js";
17
- import { HistoryManager as Te } from "./engine/history.js";
18
- import { ALIGN_TYPES as Ie, DEFAULT_FILL_COLOR_LIST as Pe, DEFAULT_FONT_SIZE as ve, ELEMENT_TITLE_MAP as _e, FONT_WEIGHT as Le, LAYER_BLACK_LIST as Se } from "./engine/constants.js";
19
- import { createEventBus as Fe, default as Re } from "./engine/events.js";
20
- import { SnaplineManager as be } from "./engine/managers/snapline.js";
21
- import { ResizeManager as Ne } from "./engine/managers/resize.js";
22
- import { WorkspaceManager as Me } from "./engine/managers/workspace.js";
23
- import { EventManager as Oe } from "./engine/managers/event.js";
24
- import { ImageProcessor as He } from "./engine/processors/image.js";
25
- import { TextProcessor as we } from "./engine/processors/text.js";
26
- import { TemplateProcessor as Ye } from "./engine/processors/template.js";
27
- import { blobToDataURL as We, blobUrlToFile as Ke, cloneObject as Ve, dataUrlToFile as Xe, directionOffsetToXY as Ze, generateThumbImage as $e, getCanvasSize as qe, resizeBase64Image as Je, toHorizontalRaw as Qe, toVerticalStack as er, urlToBlob as rr, urlToDataURL as or, xyToDirectionOffset as tr } from "./engine/utils/common.js";
28
- import { loadImage as nr, loadOverlaySvgImage as sr, loadSvgImage as ir } from "./engine/utils/image.js";
29
- import { fontCache as mr, loadFontFile as pr, loadFontface as fr } from "./engine/utils/font.js";
30
- import { DEFAULT_DPI as dr, inchToPixel as cr, isSvg as ur } from "./engine/utils/measure.js";
31
- import { Loading as Er } from "./engine/utils/loading.js";
32
- import { getImageControls as Tr, setDefaultControls as Dr } from "./engine/utils/setting.js";
33
- import { fabric as Pr } from "fabric";
34
- function X(e) {
1
+ import { AdvancedIText as G } from "./engine/fabric.js";
2
+ import { a as S, s as f, D as L, b as _, c as C, C as F } from "./design-CZvEVkwi.js";
3
+ import { F as K, S as V, u as X } from "./design-CZvEVkwi.js";
4
+ import { jsx as r, jsxs as R } from "react/jsx-runtime";
5
+ import { useMemo as b, useEffect as a } from "react";
6
+ import { DEFAULT_PRINTINE_ASSET_BASE_URL as U, createAssetCenterApiClient as B } from "./api/asset-client.js";
7
+ import { s as d } from "./designer-store-Da9fICz8.js";
8
+ import { A as $, u as q } from "./designer-store-Da9fICz8.js";
9
+ import { d as y, s as M } from "./config-D2qm60gf.js";
10
+ import { P as Q, a as ee } from "./semi-interact-editor-DfzphWy3.js";
11
+ import { P as te } from "./pixel-map-dSys7UAx.js";
12
+ import { CanvasDesigner as ae, renderPlacementPreviews as ne } from "./engine/canvas-designer.js";
13
+ import { Editor as ie } from "./engine/editor.js";
14
+ import { HistoryManager as me } from "./engine/history.js";
15
+ import { ALIGN_TYPES as de, DEFAULT_FILL_COLOR_LIST as ge, DEFAULT_FONT_SIZE as pe, ELEMENT_TITLE_MAP as ce, FONT_WEIGHT as ue, LAYER_BLACK_LIST as xe } from "./engine/constants.js";
16
+ import { createEventBus as Te, default as ve } from "./engine/events.js";
17
+ import { SnaplineManager as Ie } from "./engine/managers/snapline.js";
18
+ import { ResizeManager as Ae } from "./engine/managers/resize.js";
19
+ import { WorkspaceManager as Le } from "./engine/managers/workspace.js";
20
+ import { EventManager as Ce } from "./engine/managers/event.js";
21
+ import { ImageProcessor as Re } from "./engine/processors/image.js";
22
+ import { TextProcessor as Ue } from "./engine/processors/text.js";
23
+ import { TemplateProcessor as ye } from "./engine/processors/template.js";
24
+ import { blobToDataURL as Ne, blobUrlToFile as he, cloneObject as Oe, dataUrlToFile as ze, directionOffsetToXY as He, generateThumbImage as je, getCanvasSize as we, resizeBase64Image as ke, toHorizontalRaw as Ye, toVerticalStack as Ge, urlToBlob as We, urlToDataURL as Ke, xyToDirectionOffset as Ve } from "./engine/utils/common.js";
25
+ import { loadImage as Ze, loadOverlaySvgImage as $e, loadSvgImage as qe } from "./engine/utils/image.js";
26
+ import { fontCache as Qe, loadFontFile as er, loadFontface as rr } from "./engine/utils/font.js";
27
+ import { DEFAULT_DPI as or, inchToPixel as ar, isSvg as nr } from "./engine/utils/measure.js";
28
+ import { Loading as ir } from "./engine/utils/loading.js";
29
+ import { getImageControls as mr, setDefaultControls as fr } from "./engine/utils/setting.js";
30
+ import { fabric as gr } from "fabric";
31
+ function w(e) {
32
+ S(e.basePlate);
35
33
  const {
36
- productId: o,
37
- apiBaseUrl: i = y,
38
- assetBaseUrl: l = h,
39
- locale: n,
40
- imageBaseUrl: m,
41
- threeDEnvironmentUrl: E,
42
- basePlateId: A,
43
- basePlate: T,
44
- loading: D = !1,
45
- initialDesignData: I,
46
- initialBackgroundCustomized: P,
47
- productInfo: v,
48
- adapters: t,
49
- // Legacy top-level prop (kept for reference; uploads now come from adapters):
50
- // uploadImage,
51
- semiDesignPermission: _,
52
- messages: L,
53
- className: S,
54
- children: C,
55
- onClose: F,
56
- onEvent: p,
57
- onAnalytics: f
58
- } = e, s = c(() => M({ apiBaseUrl: i, locale: n }), [i, n]), g = c(() => O({ assetBaseUrl: l }), [l]);
34
+ productId: t,
35
+ assetBaseUrl: n = U,
36
+ locale: g,
37
+ imageBaseUrl: s,
38
+ threeDEnvironmentUrl: p,
39
+ basePlate: c,
40
+ loading: u = !1,
41
+ initialDesignData: x,
42
+ initialBackgroundCustomized: E,
43
+ productInfo: T,
44
+ adapters: o,
45
+ semiDesignPermission: v,
46
+ messages: D,
47
+ className: I,
48
+ children: P,
49
+ onClose: A,
50
+ onEvent: i,
51
+ onAnalytics: l
52
+ } = e, m = b(() => B({ assetBaseUrl: n }), [n]);
59
53
  return a(() => {
60
- p?.({ name: "ready", productId: o });
61
- }, [p, o]), a(() => (u(s), () => u(null)), [s]), a(() => (x(g), () => x(null)), [g]), a(() => (d(f ?? null), () => d(null)), [f]), H({
62
- ...m !== void 0 ? { imageBaseUrl: m } : {}
54
+ i?.({ name: "ready", productId: t });
55
+ }, [i, t]), a(() => (d(m), () => d(null)), [m]), a(() => (f(l ?? null), () => f(null)), [l]), M({
56
+ ...s !== void 0 ? { imageBaseUrl: s } : {}
63
57
  }), /* @__PURE__ */ r(
64
- R,
58
+ L,
65
59
  {
66
60
  value: {
67
- productId: o,
68
- basePlateId: A,
69
- initialDesignData: I,
70
- initialBackgroundCustomized: P,
71
- productInfo: v,
72
- uploadImage: t?.uploadImage,
73
- assets: t?.assets,
74
- templates: t?.templates,
75
- library: t?.library,
76
- locale: n,
77
- threeDEnvironmentUrl: E,
78
- messages: L,
79
- onClose: F,
61
+ productId: t,
62
+ initialDesignData: x,
63
+ initialBackgroundCustomized: E,
64
+ productInfo: T,
65
+ uploadImage: o?.uploadImage,
66
+ assets: o?.assets,
67
+ templates: o?.templates,
68
+ library: o?.library,
69
+ locale: g,
70
+ threeDEnvironmentUrl: p,
71
+ messages: D,
72
+ onClose: A,
80
73
  onSave: e.onSave,
81
74
  onRenderPreview: e.onRenderPreview,
82
75
  onError: e.onError,
83
- onEvent: e.onEvent,
84
- api: s
76
+ onEvent: e.onEvent
85
77
  },
86
- children: /* @__PURE__ */ N(
78
+ children: /* @__PURE__ */ R(
87
79
  "section",
88
80
  {
89
- className: ["printine-designer", S].filter(Boolean).join(" "),
90
- "data-product-id": o,
81
+ className: ["printine-designer", I].filter(Boolean).join(" "),
82
+ "data-product-id": t,
91
83
  style: {
92
- "--printine-designer-transparent-pattern": `url("${z("/images/design/transparent_pattern.svg")}")`
84
+ "--printine-designer-transparent-pattern": `url("${y("/images/design/transparent_pattern.svg")}")`
93
85
  },
94
86
  children: [
95
- /* @__PURE__ */ r("main", { className: "printine-designer__content", children: C ?? (D ? /* @__PURE__ */ r(U, {}) : /* @__PURE__ */ r(b, { basePlate: T, semiDesignPermission: _ })) }),
96
- /* @__PURE__ */ r(B, {})
87
+ /* @__PURE__ */ r("main", { className: "printine-designer__content", children: P ?? (u ? /* @__PURE__ */ r(_, {}) : /* @__PURE__ */ r(C, { basePlate: c, semiDesignPermission: v })) }),
88
+ /* @__PURE__ */ r(F, {})
97
89
  ]
98
90
  }
99
91
  )
@@ -101,68 +93,64 @@ function X(e) {
101
93
  );
102
94
  }
103
95
  export {
104
- Ie as ALIGN_TYPES,
105
- q as AdvancedIText,
106
- se as AssetCenterApi,
107
- ce as CanvasDesigner,
108
- te as CommonApi,
109
- dr as DEFAULT_DPI,
110
- Pe as DEFAULT_FILL_COLOR_LIST,
111
- ve as DEFAULT_FONT_SIZE,
112
- h as DEFAULT_PRINTINE_ASSET_BASE_URL,
113
- ae as DesignApi,
114
- R as DesignerRuntimeProvider,
115
- _e as ELEMENT_TITLE_MAP,
116
- Ee as Editor,
117
- Oe as EventManager,
118
- Le as FONT_WEIGHT,
119
- Q as FontList,
120
- b as FullDesigner,
121
- Te as HistoryManager,
122
- He as ImageProcessor,
123
- Se as LAYER_BLACK_LIST,
124
- Er as Loading,
125
- ge as PixelMapRenderer,
126
- X as PrintineDesigner,
127
- me as PrintineSemiInteractEditor,
128
- pe as PrintineSemiRenderer,
129
- Ne as ResizeManager,
130
- ee as SimpleSelect,
131
- be as SnaplineManager,
132
- Ye as TemplateProcessor,
133
- we as TextProcessor,
134
- Me as WorkspaceManager,
135
- We as blobToDataURL,
136
- Ke as blobUrlToFile,
137
- Ve as cloneObject,
138
- O as createAssetCenterApiClient,
139
- M as createDesignerApiClient,
140
- Fe as createEventBus,
141
- Xe as dataUrlToFile,
142
- Re as designerEventBus,
143
- Ze as directionOffsetToXY,
144
- Pr as fabric,
145
- mr as fontCache,
146
- $e as generateThumbImage,
147
- qe as getCanvasSize,
148
- Tr as getImageControls,
149
- cr as inchToPixel,
150
- ur as isSvg,
151
- pr as loadFontFile,
152
- fr as loadFontface,
153
- nr as loadImage,
154
- sr as loadOverlaySvgImage,
155
- ir as loadSvgImage,
156
- ue as renderPlacementPreviews,
157
- Je as resizeBase64Image,
158
- x as setAssetCenterApiClient,
159
- Dr as setDefaultControls,
160
- u as setDesignerApiClient,
161
- Qe as toHorizontalRaw,
162
- er as toVerticalStack,
163
- rr as urlToBlob,
164
- or as urlToDataURL,
165
- re as useDesignerRuntime,
166
- ie as useDesignerStore,
167
- tr as xyToDirectionOffset
96
+ de as ALIGN_TYPES,
97
+ G as AdvancedIText,
98
+ $ as AssetCenterApi,
99
+ ae as CanvasDesigner,
100
+ or as DEFAULT_DPI,
101
+ ge as DEFAULT_FILL_COLOR_LIST,
102
+ pe as DEFAULT_FONT_SIZE,
103
+ U as DEFAULT_PRINTINE_ASSET_BASE_URL,
104
+ L as DesignerRuntimeProvider,
105
+ ce as ELEMENT_TITLE_MAP,
106
+ ie as Editor,
107
+ Ce as EventManager,
108
+ ue as FONT_WEIGHT,
109
+ K as FontList,
110
+ C as FullDesigner,
111
+ me as HistoryManager,
112
+ Re as ImageProcessor,
113
+ xe as LAYER_BLACK_LIST,
114
+ ir as Loading,
115
+ te as PixelMapRenderer,
116
+ w as PrintineDesigner,
117
+ Q as PrintineSemiInteractEditor,
118
+ ee as PrintineSemiRenderer,
119
+ Ae as ResizeManager,
120
+ V as SimpleSelect,
121
+ Ie as SnaplineManager,
122
+ ye as TemplateProcessor,
123
+ Ue as TextProcessor,
124
+ Le as WorkspaceManager,
125
+ Ne as blobToDataURL,
126
+ he as blobUrlToFile,
127
+ Oe as cloneObject,
128
+ B as createAssetCenterApiClient,
129
+ Te as createEventBus,
130
+ ze as dataUrlToFile,
131
+ ve as designerEventBus,
132
+ He as directionOffsetToXY,
133
+ gr as fabric,
134
+ Qe as fontCache,
135
+ je as generateThumbImage,
136
+ we as getCanvasSize,
137
+ mr as getImageControls,
138
+ ar as inchToPixel,
139
+ nr as isSvg,
140
+ er as loadFontFile,
141
+ rr as loadFontface,
142
+ Ze as loadImage,
143
+ $e as loadOverlaySvgImage,
144
+ qe as loadSvgImage,
145
+ ne as renderPlacementPreviews,
146
+ ke as resizeBase64Image,
147
+ d as setAssetCenterApiClient,
148
+ fr as setDefaultControls,
149
+ Ye as toHorizontalRaw,
150
+ Ge as toVerticalStack,
151
+ We as urlToBlob,
152
+ Ke as urlToDataURL,
153
+ X as useDesignerRuntime,
154
+ q as useDesignerStore,
155
+ Ve as xyToDirectionOffset
168
156
  };
@@ -0,0 +1,3 @@
1
+ import type { BasePlate } from '../contracts/api-design';
2
+ /** Reject missing host data instead of falling back to a package-owned request. */
3
+ export declare function assertBasePlate(basePlate: BasePlate | null | undefined): asserts basePlate is BasePlate;