@floegence/floe-webapp-core 0.53.3 → 0.54.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.
Files changed (32) hide show
  1. package/dist/components/ui/InfiniteCanvas.js +111 -100
  2. package/dist/components/ui/SurfaceAnchoredLayer.d.ts +10 -0
  3. package/dist/components/ui/SurfaceAnchoredLayer.js +89 -0
  4. package/dist/components/ui/index.d.ts +1 -0
  5. package/dist/components/workbench/WorkbenchCanvas.d.ts +1 -1
  6. package/dist/components/workbench/WorkbenchCanvas.js +26 -24
  7. package/dist/components/workbench/WorkbenchCanvasField.d.ts +1 -1
  8. package/dist/components/workbench/WorkbenchCanvasField.js +46 -42
  9. package/dist/components/workbench/WorkbenchLayerObjects.d.ts +9 -1
  10. package/dist/components/workbench/WorkbenchLayerObjects.js +896 -707
  11. package/dist/components/workbench/WorkbenchSurface.d.ts +2 -0
  12. package/dist/components/workbench/WorkbenchSurface.js +442 -420
  13. package/dist/components/workbench/index.d.ts +1 -0
  14. package/dist/components/workbench/types.d.ts +6 -3
  15. package/dist/components/workbench/useWorkbenchModel.js +53 -53
  16. package/dist/components/workbench/workbenchCompositionMessages.d.ts +62 -0
  17. package/dist/components/workbench/workbenchCompositionMessages.js +67 -0
  18. package/dist/components/workbench/workbenchHelpers.js +19 -6
  19. package/dist/components/workbench/workbenchOptions.d.ts +4 -4
  20. package/dist/components/workbench/workbenchOptions.js +18 -16
  21. package/dist/full.js +182 -180
  22. package/dist/input-focus.css +39 -5
  23. package/dist/styles/themes/presets.js +5 -5
  24. package/dist/styles.css +1 -1
  25. package/dist/surface.css +16 -3
  26. package/dist/themes/shell-presets.generated.css +6 -6
  27. package/dist/ui.css +4 -23
  28. package/dist/ui.js +86 -84
  29. package/dist/workbench-themes.css +60 -0
  30. package/dist/workbench.css +332 -524
  31. package/dist/workbench.js +24 -22
  32. package/package.json +1 -1
@@ -11,3 +11,4 @@ export { sanitizeWorkbenchState, createDefaultWorkbenchState, createWorkbenchId,
11
11
  export { WORKBENCH_BACKGROUND_MATERIALS, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL, WORKBENCH_DEFAULT_REGION_FILL, WORKBENCH_DEFAULT_STICKY_NOTE_COLOR, WORKBENCH_DEFAULT_TEXT_COLOR, WORKBENCH_DEFAULT_TEXT_FONT, WORKBENCH_REGION_FILL_OPTIONS, WORKBENCH_STICKY_NOTE_COLORS, WORKBENCH_TEXT_COLOR_OPTIONS, WORKBENCH_TEXT_EMOJI_OPTIONS, WORKBENCH_TEXT_FONT_OPTIONS, } from './workbenchOptions';
12
12
  export { DEFAULT_WORKBENCH_THEME, WORKBENCH_THEME_IDS, WORKBENCH_THEMES, isWorkbenchThemeId, workbenchThemeMeta, type WorkbenchThemeId, type WorkbenchThemeMeta, type WorkbenchThemePreview, } from './workbenchThemes';
13
13
  export { WorkbenchThemeSelector, type WorkbenchThemeSelectorProps } from './WorkbenchThemeSelector';
14
+ export { workbenchCompositionMessages, type WorkbenchCompositionMessageKey, type WorkbenchCompositionMessages, } from './workbenchCompositionMessages';
@@ -141,7 +141,7 @@ export declare const WORKBENCH_STICKY_FILTER_ID = "sticky-note";
141
141
  export declare const WORKBENCH_TEXT_FILTER_ID = "text";
142
142
  export declare const WORKBENCH_BACKGROUND_REGION_FILTER_ID = "background-region";
143
143
  export declare const WORKBENCH_LAYER_COMPONENT_FILTER_IDS: readonly ["sticky-note", "text", "background-region"];
144
- export type WorkbenchLayerComponentFilterId = typeof WORKBENCH_LAYER_COMPONENT_FILTER_IDS[number];
144
+ export type WorkbenchLayerComponentFilterId = (typeof WORKBENCH_LAYER_COMPONENT_FILTER_IDS)[number];
145
145
  export type WorkbenchDockToolId = 'select' | 'text' | 'sticky-note' | 'background-region' | (string & {});
146
146
  export type WorkbenchSelection = {
147
147
  kind: 'widget';
@@ -157,11 +157,14 @@ export type WorkbenchSelection = {
157
157
  id: string;
158
158
  };
159
159
  export type WorkbenchStickyNoteColor = 'graphite' | 'sage' | 'amber' | 'azure' | 'coral' | 'rose';
160
+ export type WorkbenchStickyNoteMaterial = 'tint' | 'tab' | 'ruled';
160
161
  export interface WorkbenchStickyNoteItem {
161
162
  id: string;
162
163
  kind: 'sticky_note';
163
164
  body: string;
164
165
  color: WorkbenchStickyNoteColor;
166
+ /** Missing material in existing layouts renders as tint. */
167
+ material?: WorkbenchStickyNoteMaterial;
165
168
  x: number;
166
169
  y: number;
167
170
  width: number;
@@ -170,7 +173,7 @@ export interface WorkbenchStickyNoteItem {
170
173
  created_at_unix_ms: number;
171
174
  updated_at_unix_ms: number;
172
175
  }
173
- export type WorkbenchStickyNotePatch = Partial<Pick<WorkbenchStickyNoteItem, 'body' | 'color'>>;
176
+ export type WorkbenchStickyNotePatch = Partial<Pick<WorkbenchStickyNoteItem, 'body' | 'color' | 'material'>>;
174
177
  export type WorkbenchTextAnnotationAlign = 'left' | 'center' | 'right';
175
178
  export interface WorkbenchTextAnnotationItem {
176
179
  id: string;
@@ -192,7 +195,7 @@ export interface WorkbenchTextAnnotationItem {
192
195
  export type WorkbenchTextAnnotationPatch = Partial<Pick<WorkbenchTextAnnotationItem, 'text' | 'font_family' | 'font_size' | 'font_weight' | 'color' | 'align'>>;
193
196
  export type WorkbenchTextAnnotationDefaults = Partial<Pick<WorkbenchTextAnnotationItem, 'font_family' | 'font_size' | 'font_weight' | 'color' | 'align' | 'width' | 'height'>>;
194
197
  export type WorkbenchAnnotationItem = WorkbenchTextAnnotationItem;
195
- export type WorkbenchBackgroundMaterial = 'solid' | 'dotted' | 'grid' | 'hatched' | 'glass';
198
+ export type WorkbenchBackgroundMaterial = 'solid' | 'dotted' | 'grid' | 'hatched' | 'glass' | 'frame';
196
199
  export interface WorkbenchBackgroundLayer {
197
200
  id: string;
198
201
  name: string;
@@ -1,25 +1,25 @@
1
1
  import { createSignal as nt, createMemo as u, createEffect as Ne, onCleanup as Ae, batch as p } from "solid-js";
2
2
  import { clientToCanvasWorld as Ie } from "../ui/canvasGeometry.js";
3
- import { ArrowUp as xt, Copy as F, Trash as R, MessageSquare as St, Region as Wt, TextTool as Le } from "../icons/index.js";
3
+ import { ArrowUp as xt, Copy as R, Trash as F, MessageSquare as St, Region as Wt, TextTool as Le } from "../icons/index.js";
4
4
  import { WORKBENCH_STICKY_FILTER_ID as De } from "./types.js";
5
- import { WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as Me, WORKBENCH_DEFAULT_TEXT_COLOR as je, WORKBENCH_DEFAULT_TEXT_FONT as Ot, WORKBENCH_BACKGROUND_MATERIALS as Mt, WORKBENCH_REGION_FILL_OPTIONS as pe, WORKBENCH_STICKY_NOTE_COLORS as Fe, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as Re, WORKBENCH_DEFAULT_REGION_FILL as Be } from "./workbenchOptions.js";
5
+ import { WORKBENCH_DEFAULT_STICKY_NOTE_COLOR as Me, WORKBENCH_DEFAULT_TEXT_COLOR as je, WORKBENCH_DEFAULT_TEXT_FONT as Ot, WORKBENCH_BACKGROUND_MATERIALS as Mt, WORKBENCH_REGION_FILL_OPTIONS as pe, WORKBENCH_STICKY_NOTE_COLORS as Re, WORKBENCH_DEFAULT_BACKGROUND_MATERIAL as Fe, WORKBENCH_DEFAULT_REGION_FILL as Be } from "./workbenchOptions.js";
6
6
  import { resolveWorkbenchModeStrategy as Tt, compareWorkbenchLayerRenderOrder as Ct, createContextMenuPosition as Xe, resolveWorkbenchLayerFront as Nt, createWorkbenchWidgetFrame as Ee, createWorkbenchId as W, createWorkbenchViewportCenteredOnWidget as At, findNearestWidget as ze, sanitizeFilters as Ye, WORKBENCH_CONTEXT_MENU_WIDTH_PX as He, estimateContextMenuHeight as Ve, clampScale as Ke, WORKBENCH_MAX_SCALE as ve, WORKBENCH_CANVAS_ZOOM_STEP as It, normalizeWorkbenchInteractionMode as Ue, createWorkbenchViewportAtScale as Pe, WORKBENCH_WORK_MIN_SCALE as qe, createWorkbenchViewportFitForWidget as Ze } from "./workbenchHelpers.js";
7
7
  import { resolveWorkbenchWidgetDefinitions as Ge, getWidgetEntry as $e } from "./widgets/widgetRegistry.js";
8
8
  import { resolveTextAnnotationDefaultSize as Je, resolveBackgroundLayerDefaultSize as Qe, resolveStickyNoteDefaultSize as tn } from "./workbenchPlacement.js";
9
9
  function jt(o, d) {
10
- const s = o.findIndex((a) => a === d);
11
- return o[(s + 1) % o.length] ?? o[0];
10
+ const r = o.findIndex((a) => a === d);
11
+ return o[(r + 1) % o.length] ?? o[0];
12
12
  }
13
- function Lt(o, d, s) {
13
+ function Lt(o, d, r) {
14
14
  const a = String(d ?? "").trim();
15
- return o.includes(a) ? a : s;
15
+ return o.includes(a) ? a : r;
16
16
  }
17
17
  function en(o, d) {
18
- const s = Number(o);
19
- return Number.isFinite(s) ? Math.max(0.08, Math.min(1, s)) : d;
18
+ const r = Number(o);
19
+ return Number.isFinite(r) ? Math.max(0.08, Math.min(1, r)) : d;
20
20
  }
21
21
  function nn(o) {
22
- return jt(Fe, o);
22
+ return jt(Re, o);
23
23
  }
24
24
  function on(o) {
25
25
  return jt(Mt, o);
@@ -28,7 +28,7 @@ function Dt(o) {
28
28
  return !("kind" in o);
29
29
  }
30
30
  function it(o) {
31
- return o.reduce((d, s) => Math.max(d, s.z_index), 1);
31
+ return o.reduce((d, r) => Math.max(d, r.z_index), 1);
32
32
  }
33
33
  function cn(o, d) {
34
34
  return it([...o, ...d]);
@@ -46,7 +46,7 @@ function dn(o) {
46
46
  created_at_unix_ms: o.created_at_unix_ms
47
47
  };
48
48
  }
49
- function an(o, d, s) {
49
+ function an(o, d, r) {
50
50
  const a = Date.now(), { width: y, height: _ } = tn();
51
51
  return {
52
52
  id: W(),
@@ -57,12 +57,12 @@ function an(o, d, s) {
57
57
  y: d - _ / 2,
58
58
  width: y,
59
59
  height: _,
60
- z_index: s,
60
+ z_index: r,
61
61
  created_at_unix_ms: a,
62
62
  updated_at_unix_ms: a
63
63
  };
64
64
  }
65
- function sn(o, d, s, a) {
65
+ function rn(o, d, r, a) {
66
66
  const y = Date.now(), { width: _, height: b } = Je(a);
67
67
  return {
68
68
  id: W(),
@@ -77,12 +77,12 @@ function sn(o, d, s, a) {
77
77
  y: d - b / 2,
78
78
  width: _,
79
79
  height: b,
80
- z_index: s,
80
+ z_index: r,
81
81
  created_at_unix_ms: y,
82
82
  updated_at_unix_ms: y
83
83
  };
84
84
  }
85
- function rn(o) {
85
+ function sn(o) {
86
86
  const d = Date.now();
87
87
  return {
88
88
  ...o,
@@ -94,8 +94,8 @@ function rn(o) {
94
94
  updated_at_unix_ms: d
95
95
  };
96
96
  }
97
- function ln(o, d, s, a) {
98
- const y = Date.now(), { width: _, height: b } = Qe(a), f = String(a?.name ?? "").trim() || "Focus area";
97
+ function ln(o, d, r, a) {
98
+ const y = Date.now(), { width: _, height: b } = Qe(a), f = String(a?.name ?? "").trim();
99
99
  return {
100
100
  id: W(),
101
101
  name: f,
@@ -108,13 +108,13 @@ function ln(o, d, s, a) {
108
108
  material: Lt(
109
109
  Mt,
110
110
  a?.material,
111
- Re
111
+ Fe
112
112
  ),
113
113
  x: o - _ / 2,
114
114
  y: d - b / 2,
115
115
  width: _,
116
116
  height: b,
117
- z_index: s,
117
+ z_index: r,
118
118
  created_at_unix_ms: y,
119
119
  updated_at_unix_ms: y
120
120
  };
@@ -133,11 +133,11 @@ function un(o) {
133
133
  };
134
134
  }
135
135
  function Nn(o) {
136
- const [d, s] = nt(null), [a, y] = nt(null), [_, b] = nt({ width: 0, height: 0 });
136
+ const [d, r] = nt(null), [a, y] = nt(null), [_, b] = nt({ width: 0, height: 0 });
137
137
  let f = null, C = null;
138
- const r = o.state, m = u(() => r().widgets), x = u(() => r().stickyNotes ?? []), ot = u(() => r().annotations ?? []), ct = u(() => r().backgroundLayers ?? []), w = u(() => r().viewport), pt = u(() => r().locked), B = u(() => r().filters), Ft = u(() => r().selectedWidgetId), X = u(
139
- () => r().selectedObject ?? (r().selectedWidgetId ? { kind: "widget", id: r().selectedWidgetId } : null)
140
- ), N = u(() => r().mode ?? "work"), Rt = u(() => Tt(N())), dt = u(() => r().activeTool ?? "select"), Bt = u(() => r().theme), E = u(() => cn(m(), x())), Xt = u(() => [...m(), ...x()].sort(Ct).at(-1)?.id ?? null), Et = u(() => `${Math.round(w().scale * 100)}%`);
138
+ const s = o.state, m = u(() => s().widgets), x = u(() => s().stickyNotes ?? []), ot = u(() => s().annotations ?? []), ct = u(() => s().backgroundLayers ?? []), w = u(() => s().viewport), pt = u(() => s().locked), B = u(() => s().filters), Rt = u(() => s().selectedWidgetId), X = u(
139
+ () => s().selectedObject ?? (s().selectedWidgetId ? { kind: "widget", id: s().selectedWidgetId } : null)
140
+ ), N = u(() => s().mode ?? "work"), Ft = u(() => Tt(N())), dt = u(() => s().activeTool ?? "select"), Bt = u(() => s().theme), E = u(() => cn(m(), x())), Xt = u(() => [...m(), ...x()].sort(Ct).at(-1)?.id ?? null), Et = u(() => `${Math.round(w().scale * 100)}%`);
141
141
  Ne(() => {
142
142
  const e = a();
143
143
  e && e !== Xt() && y(null);
@@ -168,7 +168,7 @@ function Nn(o) {
168
168
  at(), f = null;
169
169
  });
170
170
  const Kt = (e) => {
171
- s({
171
+ r({
172
172
  clientX: e.clientX,
173
173
  clientY: e.clientY,
174
174
  worldX: e.worldX,
@@ -176,7 +176,7 @@ function Nn(o) {
176
176
  target: { kind: "canvas", mode: N() }
177
177
  });
178
178
  }, vt = (e, t) => {
179
- S(t.id), s({
179
+ S(t.id), r({
180
180
  clientX: e.clientX,
181
181
  clientY: e.clientY,
182
182
  worldX: t.x,
@@ -185,7 +185,7 @@ function Nn(o) {
185
185
  widgetId: t.id
186
186
  });
187
187
  }, Ut = (e, t) => {
188
- D(t.id), s({
188
+ D(t.id), r({
189
189
  clientX: e.clientX,
190
190
  clientY: e.clientY,
191
191
  worldX: t.x,
@@ -194,7 +194,7 @@ function Nn(o) {
194
194
  widgetId: t.id
195
195
  });
196
196
  }, Pt = (e, t) => {
197
- s({
197
+ r({
198
198
  clientX: e.clientX,
199
199
  clientY: e.clientY,
200
200
  worldX: t.x,
@@ -202,14 +202,14 @@ function Nn(o) {
202
202
  target: { kind: "annotation", id: t.id }
203
203
  });
204
204
  }, qt = (e, t) => {
205
- s({
205
+ r({
206
206
  clientX: e.clientX,
207
207
  clientY: e.clientY,
208
208
  worldX: t.x,
209
209
  worldY: t.y,
210
210
  target: { kind: "background_layer", id: t.id }
211
211
  });
212
- }, l = () => s(null), Zt = (e) => r().widgets.find((t) => t.id === e) ?? null, I = (e) => r().widgets.find((t) => t.type === e) ?? null, Y = (e) => r().stickyNotes?.find((t) => t.id === e) ?? null, st = (e) => r().annotations?.find((t) => t.id === e) ?? null, rt = (e) => r().backgroundLayers?.find((t) => t.id === e) ?? null, Gt = (e) => e.target ? e.target : e.widgetId ? Y(e.widgetId) ? { kind: "sticky_note", id: e.widgetId } : { kind: "widget", id: e.widgetId } : { kind: "canvas", mode: N() }, L = (e, t) => {
212
+ }, l = () => r(null), Zt = (e) => s().widgets.find((t) => t.id === e) ?? null, I = (e) => s().widgets.find((t) => t.type === e) ?? null, Y = (e) => s().stickyNotes?.find((t) => t.id === e) ?? null, rt = (e) => s().annotations?.find((t) => t.id === e) ?? null, st = (e) => s().backgroundLayers?.find((t) => t.id === e) ?? null, Gt = (e) => e.target ? e.target : e.widgetId ? Y(e.widgetId) ? { kind: "sticky_note", id: e.widgetId } : { kind: "widget", id: e.widgetId } : { kind: "canvas", mode: N() }, L = (e, t) => {
213
213
  if (t?.source === "pointer") {
214
214
  const n = f?.getBoundingClientRect(), i = n ? Ie(n, w(), {
215
215
  clientX: t.clientX,
@@ -265,7 +265,7 @@ function Nn(o) {
265
265
  id: "duplicate",
266
266
  kind: "action",
267
267
  label: "Duplicate",
268
- icon: F,
268
+ icon: R,
269
269
  onSelect: () => {
270
270
  ut(n.type, n.x + 32, n.y + 32), l();
271
271
  }
@@ -273,7 +273,7 @@ function Nn(o) {
273
273
  id: "delete",
274
274
  kind: "action",
275
275
  label: "Delete",
276
- icon: R,
276
+ icon: F,
277
277
  destructive: !0,
278
278
  onSelect: () => {
279
279
  K(t.id), l();
@@ -294,7 +294,7 @@ function Nn(o) {
294
294
  id: "copy-content",
295
295
  kind: "action",
296
296
  label: "Copy Content",
297
- icon: F,
297
+ icon: R,
298
298
  onSelect: () => {
299
299
  typeof navigator < "u" && navigator.clipboard?.writeText(n.body), l();
300
300
  }
@@ -310,7 +310,7 @@ function Nn(o) {
310
310
  id: "delete",
311
311
  kind: "action",
312
312
  label: "Delete",
313
- icon: R,
313
+ icon: F,
314
314
  destructive: !0,
315
315
  onSelect: () => {
316
316
  q(t.id), l();
@@ -318,12 +318,12 @@ function Nn(o) {
318
318
  }), i;
319
319
  }
320
320
  if (t.kind === "annotation") {
321
- const n = st(t.id), i = [];
321
+ const n = rt(t.id), i = [];
322
322
  return n?.kind === "text" && i.push({
323
323
  id: "duplicate",
324
324
  kind: "action",
325
325
  label: "Duplicate Text",
326
- icon: F,
326
+ icon: R,
327
327
  onSelect: () => {
328
328
  gt(n), l();
329
329
  }
@@ -331,7 +331,7 @@ function Nn(o) {
331
331
  id: "delete",
332
332
  kind: "action",
333
333
  label: "Delete Text",
334
- icon: R,
334
+ icon: F,
335
335
  destructive: !0,
336
336
  onSelect: () => {
337
337
  Z(t.id), l();
@@ -339,12 +339,12 @@ function Nn(o) {
339
339
  }), i;
340
340
  }
341
341
  if (t.kind === "background_layer") {
342
- const n = rt(t.id), i = [];
342
+ const n = st(t.id), i = [];
343
343
  return n && (i.push({
344
344
  id: "duplicate",
345
345
  kind: "action",
346
346
  label: "Duplicate Region",
347
- icon: F,
347
+ icon: R,
348
348
  onSelect: () => {
349
349
  kt(n), l();
350
350
  }
@@ -360,7 +360,7 @@ function Nn(o) {
360
360
  id: "delete",
361
361
  kind: "action",
362
362
  label: "Delete Region",
363
- icon: R,
363
+ icon: F,
364
364
  destructive: !0,
365
365
  onSelect: () => {
366
366
  G(t.id), l();
@@ -468,7 +468,7 @@ function Nn(o) {
468
468
  })), O(n.id);
469
469
  }), n;
470
470
  }, U = (e, t) => {
471
- const n = sn(
471
+ const n = rn(
472
472
  e,
473
473
  t,
474
474
  it(ot()) + 1,
@@ -483,7 +483,7 @@ function Nn(o) {
483
483
  activeTool: "select"
484
484
  })), n;
485
485
  }, gt = (e) => {
486
- const t = rn(e);
486
+ const t = sn(e);
487
487
  return o.setState((n) => ({
488
488
  ...n,
489
489
  annotations: [...n.annotations ?? [], t],
@@ -573,6 +573,7 @@ function Nn(o) {
573
573
  ...i,
574
574
  ...typeof t.body == "string" ? { body: t.body } : {},
575
575
  ...t.color ? { color: t.color } : {},
576
+ ...t.material ? { material: t.material } : {},
576
577
  updated_at_unix_ms: Date.now()
577
578
  } : i
578
579
  )
@@ -626,7 +627,7 @@ function Nn(o) {
626
627
  (i) => i.id === e ? { ...i, x: t.x, y: t.y, updated_at_unix_ms: Date.now() } : i
627
628
  )
628
629
  }));
629
- }, se = (e, t) => {
630
+ }, re = (e, t) => {
630
631
  o.setState((n) => ({
631
632
  ...n,
632
633
  backgroundLayers: (n.backgroundLayers ?? []).map(
@@ -642,7 +643,7 @@ function Nn(o) {
642
643
  ...typeof t.fill == "string" ? { fill: t.fill } : {},
643
644
  ...typeof t.opacity == "number" ? { opacity: t.opacity } : {},
644
645
  ...typeof t.material == "string" ? { material: t.material } : {},
645
- ...typeof t.name == "string" ? { name: t.name } : {},
646
+ ...typeof t.name == "string" ? { name: t.name.trim() } : {},
646
647
  updated_at_unix_ms: Date.now()
647
648
  } : i
648
649
  )
@@ -657,7 +658,7 @@ function Nn(o) {
657
658
  let $ = 0;
658
659
  const J = (e) => {
659
660
  o.setState((t) => ({ ...t, viewport: e }));
660
- }, re = () => {
661
+ }, se = () => {
661
662
  $ += 1;
662
663
  }, M = (e) => {
663
664
  const t = w(), n = t.x, i = t.y, c = t.scale, g = performance.now(), k = 360, Oe = ++$, Te = (tt) => 1 - Math.pow(1 - tt, 3), ht = (tt) => {
@@ -686,7 +687,7 @@ function Nn(o) {
686
687
  }, _t = (e) => {
687
688
  const t = w(), n = h(), i = (n.width / 2 - t.x) / t.scale, c = (n.height / 2 - t.y) / t.scale, g = Ke(
688
689
  e === "in" ? t.scale * It : t.scale / It,
689
- Rt().minScale,
690
+ Ft().minScale,
690
691
  ve
691
692
  ), k = {
692
693
  x: n.width / 2 - i * g,
@@ -738,7 +739,6 @@ function Nn(o) {
738
739
  ...t,
739
740
  selectedWidgetId: null,
740
741
  selectedObject: { kind: "sticky_note", id: e },
741
- mode: "work",
742
742
  activeTool: "select"
743
743
  })), D(e);
744
744
  }, _e = (e) => {
@@ -820,7 +820,7 @@ function Nn(o) {
820
820
  canvasFrameSize: _,
821
821
  locked: pt,
822
822
  filters: B,
823
- selectedWidgetId: Ft,
823
+ selectedWidgetId: Rt,
824
824
  selectedObject: X,
825
825
  mode: N,
826
826
  activeTool: dt,
@@ -836,7 +836,7 @@ function Nn(o) {
836
836
  position: Jt,
837
837
  close: l,
838
838
  retarget: (e) => {
839
- e.preventDefault(), e.stopPropagation(), s({
839
+ e.preventDefault(), e.stopPropagation(), r({
840
840
  clientX: e.clientX,
841
841
  clientY: e.clientY,
842
842
  worldX: 0,
@@ -866,9 +866,9 @@ function Nn(o) {
866
866
  commitAnnotationMove: oe,
867
867
  commitAnnotationResize: ce,
868
868
  commitBackgroundMove: ae,
869
- commitBackgroundResize: se,
869
+ commitBackgroundResize: re,
870
870
  commitViewport: J,
871
- cancelViewportNavigation: re
871
+ cancelViewportNavigation: se
872
872
  },
873
873
  hud: {
874
874
  zoomIn: () => _t("in"),
@@ -945,12 +945,12 @@ function Nn(o) {
945
945
  findWidgetByType: I,
946
946
  findWidgetById: Zt,
947
947
  findStickyNoteById: Y,
948
- findAnnotationById: st,
949
- findBackgroundLayerById: rt
948
+ findAnnotationById: rt,
949
+ findBackgroundLayerById: st
950
950
  },
951
951
  appearance: {
952
952
  setTheme: (e) => {
953
- r().theme !== e && o.setState((t) => ({ ...t, theme: e }));
953
+ s().theme !== e && o.setState((t) => ({ ...t, theme: e }));
954
954
  }
955
955
  },
956
956
  modes: {
@@ -0,0 +1,62 @@
1
+ import { type Accessor } from 'solid-js';
2
+ export declare const workbenchCompositionMessages: {
3
+ readonly dragSticky: "Drag sticky note";
4
+ readonly stickyBody: "Sticky note body";
5
+ readonly copySticky: "Copy sticky note content";
6
+ readonly copiedSticky: "Sticky note content copied";
7
+ readonly stickyColor: "Use sticky color {value}";
8
+ readonly stickyMaterial: "Sticky material";
9
+ readonly useStickyMaterial: "Use sticky material {value}";
10
+ readonly done: "Done";
11
+ readonly deleteSticky: "Delete sticky note";
12
+ readonly resizeSticky: "Resize sticky note";
13
+ readonly regionName: "Region name";
14
+ readonly editName: "Edit name";
15
+ readonly addName: "Add name";
16
+ readonly clearName: "Clear name";
17
+ readonly moveText: "Move text";
18
+ readonly chooseFont: "Choose bold font";
19
+ readonly boldFont: "Bold font";
20
+ readonly useFont: "Use {value} bold font";
21
+ readonly fontPreview: "{value} bold";
22
+ readonly textContent: "Canvas text";
23
+ readonly textSize: "Text size";
24
+ readonly decreaseSize: "Decrease text size";
25
+ readonly sizeValue: "Text size value";
26
+ readonly increaseSize: "Increase text size";
27
+ readonly textColor: "Use text color {value}";
28
+ readonly insertEmoji: "Insert emoji";
29
+ readonly emoji: "Emoji";
30
+ readonly useEmoji: "Insert emoji {value}";
31
+ readonly deleteText: "Delete text";
32
+ readonly resizeText: "Resize text";
33
+ readonly regionColor: "Use region color {value}";
34
+ readonly regionMaterial: "Region material";
35
+ readonly useRegionMaterial: "Use region material {value}";
36
+ readonly deleteRegion: "Delete background region";
37
+ readonly resizeRegion: "Resize background region";
38
+ readonly tint: "Tint";
39
+ readonly tab: "Tab";
40
+ readonly ruled: "Ruled";
41
+ readonly solid: "Color field";
42
+ readonly frame: "Outline";
43
+ readonly hatched: "Hatch";
44
+ readonly dotted: "Dotted";
45
+ readonly grid: "Grid";
46
+ readonly glass: "Wash";
47
+ readonly amber: "Amber";
48
+ readonly sage: "Sage";
49
+ readonly azure: "Azure";
50
+ readonly coral: "Coral";
51
+ readonly rose: "Rose";
52
+ readonly graphite: "Graphite";
53
+ readonly serif: "Serif";
54
+ readonly sans: "Sans";
55
+ readonly round: "Round";
56
+ readonly mono: "Mono";
57
+ readonly condensed: "Condensed";
58
+ };
59
+ export type WorkbenchCompositionMessageKey = keyof typeof workbenchCompositionMessages;
60
+ export type WorkbenchCompositionMessages = Record<WorkbenchCompositionMessageKey, string>;
61
+ export declare const WorkbenchCompositionMessagesContext: import("solid-js").Context<Accessor<Partial<WorkbenchCompositionMessages> | undefined> | undefined>;
62
+ export declare function useWorkbenchCompositionText(): (key: WorkbenchCompositionMessageKey, value?: string) => string;
@@ -0,0 +1,67 @@
1
+ import { createContext as i, useContext as n } from "solid-js";
2
+ const a = {
3
+ dragSticky: "Drag sticky note",
4
+ stickyBody: "Sticky note body",
5
+ copySticky: "Copy sticky note content",
6
+ copiedSticky: "Sticky note content copied",
7
+ stickyColor: "Use sticky color {value}",
8
+ stickyMaterial: "Sticky material",
9
+ useStickyMaterial: "Use sticky material {value}",
10
+ done: "Done",
11
+ deleteSticky: "Delete sticky note",
12
+ resizeSticky: "Resize sticky note",
13
+ regionName: "Region name",
14
+ editName: "Edit name",
15
+ addName: "Add name",
16
+ clearName: "Clear name",
17
+ moveText: "Move text",
18
+ chooseFont: "Choose bold font",
19
+ boldFont: "Bold font",
20
+ useFont: "Use {value} bold font",
21
+ fontPreview: "{value} bold",
22
+ textContent: "Canvas text",
23
+ textSize: "Text size",
24
+ decreaseSize: "Decrease text size",
25
+ sizeValue: "Text size value",
26
+ increaseSize: "Increase text size",
27
+ textColor: "Use text color {value}",
28
+ insertEmoji: "Insert emoji",
29
+ emoji: "Emoji",
30
+ useEmoji: "Insert emoji {value}",
31
+ deleteText: "Delete text",
32
+ resizeText: "Resize text",
33
+ regionColor: "Use region color {value}",
34
+ regionMaterial: "Region material",
35
+ useRegionMaterial: "Use region material {value}",
36
+ deleteRegion: "Delete background region",
37
+ resizeRegion: "Resize background region",
38
+ tint: "Tint",
39
+ tab: "Tab",
40
+ ruled: "Ruled",
41
+ solid: "Color field",
42
+ frame: "Outline",
43
+ hatched: "Hatch",
44
+ dotted: "Dotted",
45
+ grid: "Grid",
46
+ glass: "Wash",
47
+ amber: "Amber",
48
+ sage: "Sage",
49
+ azure: "Azure",
50
+ coral: "Coral",
51
+ rose: "Rose",
52
+ graphite: "Graphite",
53
+ serif: "Serif",
54
+ sans: "Sans",
55
+ round: "Round",
56
+ mono: "Mono",
57
+ condensed: "Condensed"
58
+ }, s = i();
59
+ function l() {
60
+ const t = n(s);
61
+ return (e, o = "") => (t?.()?.[e] ?? a[e]).replace("{value}", o);
62
+ }
63
+ export {
64
+ s as WorkbenchCompositionMessagesContext,
65
+ l as useWorkbenchCompositionText,
66
+ a as workbenchCompositionMessages
67
+ };
@@ -102,7 +102,11 @@ function w(e, t, n) {
102
102
  return t.includes(r) ? r : n;
103
103
  }
104
104
  function ie(e) {
105
- return w(e, j, z);
105
+ return w(
106
+ e,
107
+ j,
108
+ z
109
+ );
106
110
  }
107
111
  function re(e) {
108
112
  if (!y(e)) return null;
@@ -110,7 +114,8 @@ function re(e) {
110
114
  return {
111
115
  id: W(e.id, "sticky"),
112
116
  kind: "sticky_note",
113
- body: f(e.body) || "Untitled note",
117
+ body: typeof e.body == "string" ? e.body : "",
118
+ material: e.material === "tab" || e.material === "ruled" ? e.material : "tint",
114
119
  color: ie(e.color),
115
120
  x: d(e.x, 0),
116
121
  y: d(e.y, 0),
@@ -136,11 +141,15 @@ function de(e) {
136
141
  return {
137
142
  id: W(e.id, "text"),
138
143
  kind: "text",
139
- text: f(e.text) || "Text",
144
+ text: typeof e.text == "string" ? e.text : "",
140
145
  font_family: n.fontFamily,
141
146
  font_size: Math.max(8, Math.min(160, Math.round(d(e.font_size, 28)))),
142
147
  font_weight: n.fontWeight,
143
- color: w(e.color, V, R),
148
+ color: w(
149
+ e.color,
150
+ V,
151
+ R
152
+ ),
144
153
  align: ce(e.align),
145
154
  x: d(e.x, 0),
146
155
  y: d(e.y, 0),
@@ -168,8 +177,12 @@ function ue(e) {
168
177
  const t = Date.now();
169
178
  return {
170
179
  id: W(e.id, "region"),
171
- name: f(e.name) || "Canvas region",
172
- fill: w(e.fill, G, S),
180
+ name: f(e.name),
181
+ fill: w(
182
+ e.fill,
183
+ G,
184
+ S
185
+ ),
173
186
  opacity: Math.max(0.08, Math.min(1, d(e.opacity, 0.72))),
174
187
  material: he(e.material),
175
188
  x: d(e.x, 0),
@@ -26,7 +26,7 @@ export declare const WORKBENCH_TEXT_FONT_OPTIONS: readonly [{
26
26
  readonly fontFamily: "Impact, Haettenschweiler, \"Arial Narrow Bold\", sans-serif";
27
27
  readonly fontWeight: 700;
28
28
  }];
29
- export type WorkbenchTextFontOption = typeof WORKBENCH_TEXT_FONT_OPTIONS[number];
29
+ export type WorkbenchTextFontOption = (typeof WORKBENCH_TEXT_FONT_OPTIONS)[number];
30
30
  export declare const WORKBENCH_DEFAULT_TEXT_FONT: {
31
31
  readonly id: "serif";
32
32
  readonly label: "Serif";
@@ -37,7 +37,7 @@ export declare const WORKBENCH_TEXT_EMOJI_OPTIONS: readonly ["✨", "✅", "⚠
37
37
  export declare function resolveWorkbenchTextFontOption(fontFamily: unknown): WorkbenchTextFontOption;
38
38
  export declare const WORKBENCH_REGION_FILL_OPTIONS: readonly ["#9da8a1", "#a79d8e", "#8fa1aa", "#a78f86", "#9ca184", "#9993a7"];
39
39
  export declare const WORKBENCH_DEFAULT_REGION_FILL: "#9da8a1";
40
- export declare const WORKBENCH_BACKGROUND_MATERIALS: readonly ["solid", "dotted", "grid", "hatched", "glass"];
41
- export declare const WORKBENCH_DEFAULT_BACKGROUND_MATERIAL = "dotted";
42
- export declare const WORKBENCH_STICKY_NOTE_COLORS: readonly ["amber", "sage", "azure", "coral", "rose"];
40
+ export declare const WORKBENCH_BACKGROUND_MATERIALS: readonly ["solid", "frame", "hatched", "dotted", "grid", "glass"];
41
+ export declare const WORKBENCH_DEFAULT_BACKGROUND_MATERIAL = "solid";
42
+ export declare const WORKBENCH_STICKY_NOTE_COLORS: readonly ["amber", "sage", "azure", "coral", "rose", "graphite"];
43
43
  export declare const WORKBENCH_DEFAULT_STICKY_NOTE_COLOR = "amber";