@printine/pod-editor 0.1.20 → 0.1.23

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/README.md CHANGED
@@ -170,6 +170,14 @@ record, then initialize the editor with the loaded data. These are initial
170
170
  values, not controlled canvas state; change the component `key` when switching
171
171
  records or base plates.
172
172
 
173
+ ### Buyer personalization
174
+
175
+ With `semiDesignPermission={true}`, merchants can manage buyer-editable layers
176
+ by print placement, configure rules from a selected canvas element, and open an
177
+ isolated desktop/phone buyer preview. Existing saved customization formats are
178
+ preserved. See [Buyer personalization](docs/BUYER_PERSONALIZATION.md) for the
179
+ supported rules, preview behavior and local validation page.
180
+
173
181
  ### Preview rendering
174
182
 
175
183
  Base-plate `renders` and `td_renders` configure live 2D and 3D previews. The
@@ -3,6 +3,7 @@ import EventManager from '../engine/managers/event';
3
3
  import { Product, BasePlate } from '../contracts/api-design';
4
4
  import React from 'react';
5
5
  import type { PersistImage } from './upload-types';
6
+ import type { ElementType } from '../contracts/design';
6
7
  type DesignContextType = {
7
8
  canvasEditor: React.RefObject<Editor | null>;
8
9
  eventManager: React.RefObject<EventManager | null>;
@@ -14,6 +15,12 @@ type DesignContextType = {
14
15
  onPersistImage: PersistImage;
15
16
  onChangeView: (placement: string) => Promise<void>;
16
17
  setCanvasLoading: React.Dispatch<React.SetStateAction<boolean>>;
18
+ semiDesignPermission: boolean;
19
+ activeMenu: ElementType;
20
+ personalizationTarget: 'element' | 'background';
21
+ setPersonalizationTarget: React.Dispatch<React.SetStateAction<'element' | 'background'>>;
22
+ getDesignData: () => Record<string, Record<string, any>>;
23
+ canvasLoading: boolean;
17
24
  };
18
25
  export declare const DesignContext: React.Context<DesignContextType | null>;
19
26
  export declare const useDesignContext: () => DesignContextType;
@@ -1,5 +1,3 @@
1
- interface SCAListProps {
1
+ export default function SCAList({ show }: {
2
2
  show: boolean;
3
- }
4
- export default function SCAList({ show }: SCAListProps): import("react").JSX.Element;
5
- export {};
3
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ /** Same settings surface as element rules: live inspector or narrow-screen draft. */
2
+ export default function PersonalizationBackground({ mode, open, onOpenChange }: {
3
+ mode: 'panel' | 'dialog';
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /** Dock settings beside the canvas in Personalization; keep dialogs elsewhere. */
2
+ export default function PersonalizationController(): import("react").JSX.Element | null;
@@ -0,0 +1,5 @@
1
+ import { type DesignDocuments } from '../lib/personalization';
2
+ export default function BuyerPersonalizationPreview({ initialData, onClose }: {
3
+ initialData: DesignDocuments;
4
+ onClose: () => void;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function usePersonalizationLayers(): import("../lib/personalization").PersonalizationLayer[];
2
+ /** Appears beside the normal editing tools as soon as one supported layer is selected. */
3
+ export declare function PersonalizationSelection(): import("react").JSX.Element | null;
@@ -0,0 +1,20 @@
1
+ export type PlacementTexture = string | ImageBitmap;
2
+ export declare function releasePlacementTexture(texture: PlacementTexture): void;
3
+ /** One renderer owns these textures; the compositor only borrows them. */
4
+ export declare class PlacementTextureCache {
5
+ private readonly maxEntries;
6
+ private readonly maxBytes;
7
+ private entries;
8
+ private pinned;
9
+ private bytes;
10
+ constructor(maxEntries?: number, maxBytes?: number);
11
+ get size(): number;
12
+ get estimatedBytes(): number;
13
+ /** Keep every texture used by the current composition alive until it settles. */
14
+ pin(key: string): void;
15
+ get(key: string): PlacementTexture | undefined;
16
+ set(key: string, texture: PlacementTexture): void;
17
+ releaseFrame(): void;
18
+ clear(): void;
19
+ private trim;
20
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Product, Render, TDRender } from '../../../contracts/api-design';
3
3
  interface RealTimePreviewProps {
4
+ concealed?: boolean;
4
5
  renderList: Render[];
5
6
  tdRenderList: TDRender[];
6
7
  designPreviewMap: Record<string, string | ImageBitmap | null>;
@@ -8,5 +9,5 @@ interface RealTimePreviewProps {
8
9
  product: Product;
9
10
  onPreview: (designLayers: string[], index?: number, models?: Render[]) => void;
10
11
  }
11
- export default function RealTimePreview({ renderList, tdRenderList, designPreviewMap, color, product, onPreview, }: RealTimePreviewProps): React.JSX.Element;
12
+ export default function RealTimePreview({ concealed, renderList, tdRenderList, designPreviewMap, color, product, onPreview, }: RealTimePreviewProps): React.JSX.Element;
12
13
  export {};
@@ -1,13 +1,19 @@
1
+ import { type PersonalizationKind } from '../lib/personalization';
1
2
  export interface ElementConfig {
2
- type: 'image' | 'text' | 'svg';
3
+ type: PersonalizationKind;
3
4
  id: string;
4
5
  config: Record<string, any> | undefined;
6
+ defaultConfig?: Record<string, any>;
7
+ placementLabel?: string;
8
+ name?: string;
5
9
  }
6
10
  interface CustomDesignElementProps {
7
11
  open: boolean;
8
12
  onOpenChange: (open: boolean) => void;
9
13
  elementConfig: ElementConfig | undefined;
10
14
  onUpdate: (id: string, config: Record<string, any>) => void;
15
+ onDisable?: (id: string) => void;
16
+ mode?: 'dialog' | 'panel';
11
17
  }
12
- export default function CustomDesignElement({ open, onOpenChange, elementConfig, onUpdate }: CustomDesignElementProps): import("react").JSX.Element;
18
+ export default function CustomDesignElement({ open, onOpenChange, elementConfig, onUpdate, onDisable, mode }: CustomDesignElementProps): import("react").JSX.Element;
13
19
  export {};
@@ -55,6 +55,10 @@ export interface PrintineSemiRendererProps {
55
55
  backgroundColor?: string;
56
56
  /** Resolution factor passed to the local Sticker renderer. */
57
57
  scale?: number;
58
+ /** Retain unchanged placement textures between compositions. Default: true. */
59
+ reusePlacementTextures?: boolean;
60
+ /** Change this host-owned account/draft/model revision key to invalidate placement textures. */
61
+ textureCacheScope?: string;
58
62
  /**
59
63
  * `pixel-map` is the default OffscreenCanvas/WebGL2 Worker renderer.
60
64
  * `pixi` remains available as an explicit fallback.