@overtone-art/canvas-editor-core 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as EditorState } from './types-BNzE_X5M.mjs';
1
+ import { c as EditorState } from './types-JP8MZsIs.mjs';
2
2
  import 'fabric';
3
3
 
4
4
  interface PrintPdfOptions {
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { c as EditorState } from './types-BNzE_X5M.js';
1
+ import { c as EditorState } from './types-JP8MZsIs.js';
2
2
  import 'fabric';
3
3
 
4
4
  interface PrintPdfOptions {
@@ -21,6 +21,10 @@ interface LayerMeta {
21
21
  };
22
22
  /** Preset silhouette or texture the layer is clipped to. */
23
23
  maskPreset?: MaskPresetId;
24
+ /** Ordered mask stack clipping this layer (see `LayerMaskManager`). */
25
+ maskStack?: LayerMaskEntry[];
26
+ /** Marks the overlay layer that carries the whole-design mask stack. */
27
+ canvasMask?: boolean;
24
28
  /** Baseline curve applied to a text layer. */
25
29
  curve?: TextCurveConfig;
26
30
  /** Text box width authored before a curve widened it, in px. */
@@ -41,6 +45,36 @@ interface TextCurveConfig {
41
45
  type ShapeMaskPresetId = 'circle' | 'square' | 'triangle' | 'star' | 'heart' | 'octagram' | 'arch' | 'zigzag';
42
46
  type TextureMaskPresetId = 'vignette' | 'halftone' | 'spray' | 'grunge' | 'torn' | 'band';
43
47
  type MaskPresetId = ShapeMaskPresetId | TextureMaskPresetId;
48
+ /**
49
+ * How one mask combines with the masks under it in the stack:
50
+ * - `add` — keeps what it covers, on top of what earlier masks kept (union)
51
+ * - `subtract` — punches its shape out of what earlier masks kept
52
+ * - `intersect` — keeps only what it and the earlier masks both cover
53
+ */
54
+ type LayerMaskMode = 'add' | 'subtract' | 'intersect';
55
+ interface LayerMaskEntry {
56
+ id: string;
57
+ name: string;
58
+ mode: LayerMaskMode;
59
+ /**
60
+ * A linked mask follows the host layer's transform; an unlinked one is pinned
61
+ * to the canvas, so moving the layer slides the artwork under a static mask.
62
+ * Always false on the whole-design stack, which has no host to follow.
63
+ */
64
+ linked: boolean;
65
+ /** A hidden mask keeps its slot and its geometry, contributing nothing. */
66
+ visible: boolean;
67
+ /** 0…1 — a partly transparent mask reveals its area partly. */
68
+ opacity: number;
69
+ /**
70
+ * The mask's transform relative to its host, recorded only while the stack is
71
+ * composed in canvas space (an unlinked sibling forces that), so a linked mask
72
+ * can be re-derived after the host moves.
73
+ */
74
+ rel?: number[];
75
+ /** Host data describing where the geometry came from (preset id, generator…). */
76
+ meta?: Record<string, unknown>;
77
+ }
44
78
  interface LayerShadowConfig {
45
79
  enabled: boolean;
46
80
  color: string;
@@ -433,6 +467,13 @@ interface EditorEvents {
433
467
  'layers:changed': {
434
468
  layers: LayerData[];
435
469
  };
470
+ 'masks:changed': {
471
+ target: string;
472
+ };
473
+ 'mask:selected': {
474
+ target: string | null;
475
+ maskId: string | null;
476
+ };
436
477
  'selection:changed': {
437
478
  selected: string[];
438
479
  };
@@ -479,4 +520,4 @@ interface EditorEvents {
479
520
  };
480
521
  }
481
522
 
482
- export { type TextCurveConfig as $, type MockupOverlay as A, type BackgroundImageOptions as B, type CanvasSizePreset as C, DEFAULT_PATTERN_CONFIG as D, type EditorConfig as E, type FileAdapter as F, type MockupPrintArea as G, type PatternLocks as H, type ImageAdjustments as I, type PatternState as J, type PositioningAdapter as K, type LayerData as L, type MaskBrushOptions as M, type NormalizedLayerPosition as N, type PrintifyPositioning as O, type PatternConfig as P, type ProjectPage as Q, type ProjectState as R, type ResizeOptions as S, type SemanticExportOptions as T, type SerializedBackgroundImageOptions as U, type SerializedLayer as V, type ShapeMaskPresetId as W, type ShapePlugin as X, type SvgExportOptions as Y, type TemplateDefinition as Z, type TemplateParameter as _, type DpiIssue as a, type TextureMaskPresetId as a0, type TileMode as a1, type Unit as a2, type EditorEvents as b, type EditorState as c, type ExportFormat as d, type FontDefinition as e, type ImageAttribution as f, type ImageProvider as g, type ImageProviderResult as h, type ImageSearchOptions as i, type ImageSearchResult as j, type LayerMeta as k, type LayerShadowConfig as l, type LayerType as m, type LicenseConfig as n, type LicensePayload as o, type LicenseStatus as p, type MaskPoint as q, type MaskPresetId as r, type MaskRefinementPrompt as s, type MaskRefinementProvider as t, type MaskRefinementRequest as u, type MaskRefinementResult as v, type MockupBlendMode as w, type MockupConfig as x, type MockupDisplacement as y, type MockupDisplacementChannel as z };
523
+ export { type TemplateDefinition as $, type MockupDisplacement as A, type BackgroundImageOptions as B, type CanvasSizePreset as C, DEFAULT_PATTERN_CONFIG as D, type EditorConfig as E, type FileAdapter as F, type MockupDisplacementChannel as G, type MockupOverlay as H, type ImageAdjustments as I, type MockupPrintArea as J, type PatternLocks as K, type LayerData as L, type MaskBrushOptions as M, type NormalizedLayerPosition as N, type PatternState as O, type PatternConfig as P, type PositioningAdapter as Q, type PrintifyPositioning as R, type ProjectPage as S, type ProjectState as T, type ResizeOptions as U, type SemanticExportOptions as V, type SerializedBackgroundImageOptions as W, type SerializedLayer as X, type ShapeMaskPresetId as Y, type ShapePlugin as Z, type SvgExportOptions as _, type DpiIssue as a, type TemplateParameter as a0, type TextCurveConfig as a1, type TextureMaskPresetId as a2, type TileMode as a3, type Unit as a4, type EditorEvents as b, type EditorState as c, type ExportFormat as d, type FontDefinition as e, type ImageAttribution as f, type ImageProvider as g, type ImageProviderResult as h, type ImageSearchOptions as i, type ImageSearchResult as j, type LayerMaskEntry as k, type LayerMaskMode as l, type LayerMeta as m, type LayerShadowConfig as n, type LayerType as o, type LicenseConfig as p, type LicensePayload as q, type LicenseStatus as r, type MaskPoint as s, type MaskPresetId as t, type MaskRefinementPrompt as u, type MaskRefinementProvider as v, type MaskRefinementRequest as w, type MaskRefinementResult as x, type MockupBlendMode as y, type MockupConfig as z };
@@ -21,6 +21,10 @@ interface LayerMeta {
21
21
  };
22
22
  /** Preset silhouette or texture the layer is clipped to. */
23
23
  maskPreset?: MaskPresetId;
24
+ /** Ordered mask stack clipping this layer (see `LayerMaskManager`). */
25
+ maskStack?: LayerMaskEntry[];
26
+ /** Marks the overlay layer that carries the whole-design mask stack. */
27
+ canvasMask?: boolean;
24
28
  /** Baseline curve applied to a text layer. */
25
29
  curve?: TextCurveConfig;
26
30
  /** Text box width authored before a curve widened it, in px. */
@@ -41,6 +45,36 @@ interface TextCurveConfig {
41
45
  type ShapeMaskPresetId = 'circle' | 'square' | 'triangle' | 'star' | 'heart' | 'octagram' | 'arch' | 'zigzag';
42
46
  type TextureMaskPresetId = 'vignette' | 'halftone' | 'spray' | 'grunge' | 'torn' | 'band';
43
47
  type MaskPresetId = ShapeMaskPresetId | TextureMaskPresetId;
48
+ /**
49
+ * How one mask combines with the masks under it in the stack:
50
+ * - `add` — keeps what it covers, on top of what earlier masks kept (union)
51
+ * - `subtract` — punches its shape out of what earlier masks kept
52
+ * - `intersect` — keeps only what it and the earlier masks both cover
53
+ */
54
+ type LayerMaskMode = 'add' | 'subtract' | 'intersect';
55
+ interface LayerMaskEntry {
56
+ id: string;
57
+ name: string;
58
+ mode: LayerMaskMode;
59
+ /**
60
+ * A linked mask follows the host layer's transform; an unlinked one is pinned
61
+ * to the canvas, so moving the layer slides the artwork under a static mask.
62
+ * Always false on the whole-design stack, which has no host to follow.
63
+ */
64
+ linked: boolean;
65
+ /** A hidden mask keeps its slot and its geometry, contributing nothing. */
66
+ visible: boolean;
67
+ /** 0…1 — a partly transparent mask reveals its area partly. */
68
+ opacity: number;
69
+ /**
70
+ * The mask's transform relative to its host, recorded only while the stack is
71
+ * composed in canvas space (an unlinked sibling forces that), so a linked mask
72
+ * can be re-derived after the host moves.
73
+ */
74
+ rel?: number[];
75
+ /** Host data describing where the geometry came from (preset id, generator…). */
76
+ meta?: Record<string, unknown>;
77
+ }
44
78
  interface LayerShadowConfig {
45
79
  enabled: boolean;
46
80
  color: string;
@@ -433,6 +467,13 @@ interface EditorEvents {
433
467
  'layers:changed': {
434
468
  layers: LayerData[];
435
469
  };
470
+ 'masks:changed': {
471
+ target: string;
472
+ };
473
+ 'mask:selected': {
474
+ target: string | null;
475
+ maskId: string | null;
476
+ };
436
477
  'selection:changed': {
437
478
  selected: string[];
438
479
  };
@@ -479,4 +520,4 @@ interface EditorEvents {
479
520
  };
480
521
  }
481
522
 
482
- export { type TextCurveConfig as $, type MockupOverlay as A, type BackgroundImageOptions as B, type CanvasSizePreset as C, DEFAULT_PATTERN_CONFIG as D, type EditorConfig as E, type FileAdapter as F, type MockupPrintArea as G, type PatternLocks as H, type ImageAdjustments as I, type PatternState as J, type PositioningAdapter as K, type LayerData as L, type MaskBrushOptions as M, type NormalizedLayerPosition as N, type PrintifyPositioning as O, type PatternConfig as P, type ProjectPage as Q, type ProjectState as R, type ResizeOptions as S, type SemanticExportOptions as T, type SerializedBackgroundImageOptions as U, type SerializedLayer as V, type ShapeMaskPresetId as W, type ShapePlugin as X, type SvgExportOptions as Y, type TemplateDefinition as Z, type TemplateParameter as _, type DpiIssue as a, type TextureMaskPresetId as a0, type TileMode as a1, type Unit as a2, type EditorEvents as b, type EditorState as c, type ExportFormat as d, type FontDefinition as e, type ImageAttribution as f, type ImageProvider as g, type ImageProviderResult as h, type ImageSearchOptions as i, type ImageSearchResult as j, type LayerMeta as k, type LayerShadowConfig as l, type LayerType as m, type LicenseConfig as n, type LicensePayload as o, type LicenseStatus as p, type MaskPoint as q, type MaskPresetId as r, type MaskRefinementPrompt as s, type MaskRefinementProvider as t, type MaskRefinementRequest as u, type MaskRefinementResult as v, type MockupBlendMode as w, type MockupConfig as x, type MockupDisplacement as y, type MockupDisplacementChannel as z };
523
+ export { type TemplateDefinition as $, type MockupDisplacement as A, type BackgroundImageOptions as B, type CanvasSizePreset as C, DEFAULT_PATTERN_CONFIG as D, type EditorConfig as E, type FileAdapter as F, type MockupDisplacementChannel as G, type MockupOverlay as H, type ImageAdjustments as I, type MockupPrintArea as J, type PatternLocks as K, type LayerData as L, type MaskBrushOptions as M, type NormalizedLayerPosition as N, type PatternState as O, type PatternConfig as P, type PositioningAdapter as Q, type PrintifyPositioning as R, type ProjectPage as S, type ProjectState as T, type ResizeOptions as U, type SemanticExportOptions as V, type SerializedBackgroundImageOptions as W, type SerializedLayer as X, type ShapeMaskPresetId as Y, type ShapePlugin as Z, type SvgExportOptions as _, type DpiIssue as a, type TemplateParameter as a0, type TextCurveConfig as a1, type TextureMaskPresetId as a2, type TileMode as a3, type Unit as a4, type EditorEvents as b, type EditorState as c, type ExportFormat as d, type FontDefinition as e, type ImageAttribution as f, type ImageProvider as g, type ImageProviderResult as h, type ImageSearchOptions as i, type ImageSearchResult as j, type LayerMaskEntry as k, type LayerMaskMode as l, type LayerMeta as m, type LayerShadowConfig as n, type LayerType as o, type LicenseConfig as p, type LicensePayload as q, type LicenseStatus as r, type MaskPoint as s, type MaskPresetId as t, type MaskRefinementPrompt as u, type MaskRefinementProvider as v, type MaskRefinementRequest as w, type MaskRefinementResult as x, type MockupBlendMode as y, type MockupConfig as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overtone-art/canvas-editor-core",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Abstract pluggable canvas editor built on Fabric.js",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",