@widgetic/canvas 0.5.40 → 0.5.41

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 (120) hide show
  1. package/README.md +7 -3
  2. package/dist/canvas/DomCanvas.svelte +4 -0
  3. package/dist/canvas/DomCanvas.svelte.d.ts +8 -0
  4. package/dist/canvas/autosaveScheduler.js +89 -37
  5. package/dist/canvas/boardFrame.js +1 -1
  6. package/dist/canvas/boardSurface.js +1 -1
  7. package/dist/canvas/canvasLogger.js +19 -7
  8. package/dist/canvas/chromeLayout.js +18 -17
  9. package/dist/canvas/eventScope.js +14 -10
  10. package/dist/canvas/host/CanvasHost.d.ts +6 -0
  11. package/dist/canvas/host/CanvasHost.js +1556 -1267
  12. package/dist/canvas/host/CanvasHostApi.d.ts +2 -2
  13. package/dist/canvas/host/CanvasHostApi.js +25 -4
  14. package/dist/canvas/host/browserServices.js +116 -65
  15. package/dist/canvas/host/conversion.js +170 -82
  16. package/dist/canvas/host/hostObject.js +7 -7
  17. package/dist/canvas/host/pageEvents.js +4 -4
  18. package/dist/canvas/host/screenRects.js +31 -28
  19. package/dist/canvas/host/strokeSnap.js +143 -88
  20. package/dist/canvas/openMarks.js +2 -2
  21. package/dist/canvas/outsideClickDeselect.js +7 -6
  22. package/dist/canvas/panZoomPosition.js +2 -2
  23. package/dist/canvas/preferredTextFont.js +25 -13
  24. package/dist/canvas/shapes/ShapeLibrary.js +148 -138
  25. package/dist/canvas/shapes/shapeImageStore.js +3 -3
  26. package/dist/canvas/shapes/strokeShapeSnap.js +233 -188
  27. package/dist/canvas/toolbarPosition.js +2 -2
  28. package/dist/canvas/ui/CanvasHint.svelte +16 -3
  29. package/dist/canvas/ui/CanvasHint.svelte.d.ts +2 -17
  30. package/dist/canvas/ui/CanvasToolbar.svelte +7 -7
  31. package/dist/canvas/ui/ToolButton.svelte +11 -3
  32. package/dist/canvas/ui/ToolButton.svelte.d.ts +2 -0
  33. package/dist/canvas/ui/colorModel.js +32 -21
  34. package/dist/canvas/ui/colorPickerMessages.js +5 -5
  35. package/dist/canvas/ui/floatingCard.js +18 -18
  36. package/dist/canvas/ui/floatingLayer.js +6 -5
  37. package/dist/canvas/ui/keyHints.js +11 -9
  38. package/dist/canvas/ui/popoverSide.js +3 -2
  39. package/dist/canvas/ui/selectionTraits.js +40 -34
  40. package/dist/canvas/ui/sizeLabelVisibility.d.ts +1 -1
  41. package/dist/canvas/ui/sizeLabelVisibility.js +1 -1
  42. package/dist/canvas/view/SelectionOverlay.svelte +33 -14
  43. package/dist/canvas/view/erasingMarks.js +7 -7
  44. package/dist/canvas/view/geometry.d.ts +14 -4
  45. package/dist/canvas/view/geometry.js +103 -77
  46. package/dist/components/preferenceStorage.js +2 -2
  47. package/dist/engine/EngineCore.d.ts +4 -1
  48. package/dist/engine/EngineCore.js +801 -695
  49. package/dist/engine/codec/canvasDocument.js +173 -173
  50. package/dist/engine/codec/hostReadableKeys.js +1 -1
  51. package/dist/engine/core/arrange.js +38 -26
  52. package/dist/engine/core/arrow.d.ts +10 -3
  53. package/dist/engine/core/arrow.js +96 -75
  54. package/dist/engine/core/arrowBinding.d.ts +69 -0
  55. package/dist/engine/core/arrowBinding.js +344 -0
  56. package/dist/engine/core/arrowBindingRecords.d.ts +43 -0
  57. package/dist/engine/core/arrowBindingRecords.js +141 -0
  58. package/dist/engine/core/brush.js +94 -67
  59. package/dist/engine/core/defaults.js +51 -90
  60. package/dist/engine/core/freehand.js +163 -147
  61. package/dist/engine/core/geometry.js +54 -47
  62. package/dist/engine/core/history.js +50 -33
  63. package/dist/engine/core/hitTest.d.ts +3 -0
  64. package/dist/engine/core/hitTest.js +83 -69
  65. package/dist/engine/core/matrix.js +20 -18
  66. package/dist/engine/core/pathData.js +210 -183
  67. package/dist/engine/core/rotationReset.js +6 -5
  68. package/dist/engine/core/scene.d.ts +3 -0
  69. package/dist/engine/core/scene.js +192 -129
  70. package/dist/engine/core/scribble.js +84 -59
  71. package/dist/engine/core/shapePaths.js +15 -12
  72. package/dist/engine/core/shapeTools.js +63 -72
  73. package/dist/engine/core/snapping.js +117 -65
  74. package/dist/engine/core/style.js +64 -31
  75. package/dist/engine/core/transform.js +94 -83
  76. package/dist/engine/core/types.d.ts +29 -0
  77. package/dist/engine/core/types.js +4 -4
  78. package/dist/engine/core/viewport.js +36 -23
  79. package/dist/engine/input/PointerController.js +476 -447
  80. package/dist/engine/input/arrowHandles.js +12 -12
  81. package/dist/engine/input/gestures.d.ts +12 -1
  82. package/dist/engine/input/gestures.js +342 -251
  83. package/dist/engine/input/hoverCursor.js +1 -1
  84. package/dist/engine/input/keyboard.d.ts +9 -1
  85. package/dist/engine/input/keyboard.js +46 -27
  86. package/dist/engine/input/selectionHandles.js +50 -45
  87. package/dist/engine/input/types.js +1 -1
  88. package/dist/engine/render/rasterize.js +158 -86
  89. package/dist/engine/state.d.ts +6 -1
  90. package/dist/engine/state.js +17 -5
  91. package/dist/engine/text/layoutText.js +62 -43
  92. package/dist/engine/text/textMetrics.js +10 -8
  93. package/dist/engine/widgets.js +137 -101
  94. package/dist/fonts/interFont.js +68 -17
  95. package/dist/fonts/workspaceFonts.js +90 -32
  96. package/dist/i18n/labels.js +4 -4
  97. package/dist/i18n/language.js +4 -4
  98. package/dist/i18n/messages.js +1 -1
  99. package/dist/i18n/shortcuts.d.ts +12 -0
  100. package/dist/i18n/shortcuts.js +32 -18
  101. package/dist/settings/workspaceToolSettings.js +48 -32
  102. package/dist/tools/components/catalog.d.ts +11 -0
  103. package/dist/tools/components/catalog.js +270 -0
  104. package/dist/tools/components/grouping.d.ts +9 -0
  105. package/dist/tools/components/grouping.js +33 -0
  106. package/dist/tools/definitions.d.ts +19 -0
  107. package/dist/tools/definitions.js +147 -0
  108. package/dist/tools/executors.d.ts +7 -0
  109. package/dist/tools/executors.js +324 -0
  110. package/dist/tools/hostAdapter.d.ts +14 -0
  111. package/dist/tools/hostAdapter.js +40 -0
  112. package/dist/tools/index.d.ts +6 -0
  113. package/dist/tools/index.js +6 -0
  114. package/dist/tools/sceneSummary.d.ts +24 -0
  115. package/dist/tools/sceneSummary.js +170 -0
  116. package/dist/tools/sketchIntent.d.ts +17 -0
  117. package/dist/tools/sketchIntent.js +166 -0
  118. package/dist/tools/types.d.ts +54 -0
  119. package/dist/tools/types.js +11 -0
  120. package/package.json +7 -2
@@ -11,9 +11,9 @@
11
11
  */
12
12
  import { CHROME_ANCHORS, normalizeAnchor } from './chromeLayout.js';
13
13
  /** The places the toolbar can stand: `TL TC TR` (top), `CL CR` (the sides) and `BL BC BR` (bottom). */
14
- export const TOOLBAR_POSITIONS = CHROME_ANCHORS;
14
+ export var TOOLBAR_POSITIONS = CHROME_ANCHORS;
15
15
  /** Where the toolbar stands when the host says nothing: the bottom centre, as it always did. */
16
- export const DEFAULT_TOOLBAR_POSITION = 'BC';
16
+ export var DEFAULT_TOOLBAR_POSITION = 'BC';
17
17
  /**
18
18
  * The position to use for what a host passed. Anything that is not one of the eight (the middle of the board, a word in
19
19
  * lower case, nothing at all) is the default, so that a mistake in the host's option never takes the toolbar off the
@@ -1,21 +1,34 @@
1
1
  <!--
2
2
  Figma "Canvas Hint": what an empty board says. A 40 px tile with a pencil, a title and one line under it, centred on the
3
3
  board and never in the way of the pointer. It is shown while the board holds nothing, and goes the moment something is
4
- drawn.
4
+ drawn. A page that words the line under the title as an empty message (`messages`) gets the tile and the title only.
5
+
6
+ Where it stands: in the middle of the board above the toolbar (the toolbar is 44 px high and stands 16 px from the bottom,
7
+ so the room above it ends 60 px from the bottom), so a short board such as the 320 px card of the Home page shows the whole
8
+ hint. Figma puts it 312 px from the top of a tall board and it stays there: the space over the hint is capped at 312 px,
9
+ the rest goes under it. A phone (max-md) centres it on the whole board, as before.
5
10
  -->
6
11
  <script lang="ts">
7
12
  import { useCanvasLanguage } from '../../i18n/language.js';
8
13
  import { IconPencil } from './icons.js';
9
14
 
10
15
  const { t } = useCanvasLanguage();
16
+
17
+ // The line under the title. Empty when the page left it out: the line is then not drawn at all, so it leaves no gap either.
18
+ const hintDescription = $derived($t('canvas.hint.description'));
11
19
  </script>
12
20
 
13
- <div class="pointer-events-none absolute inset-x-0 top-0 flex justify-center pt-[312px] max-md:inset-0 max-md:items-center max-md:pt-0 max-md:p-6" data-canvas-hint>
21
+ <div class="pointer-events-none absolute inset-x-0 top-0 bottom-[60px] flex flex-col items-center max-md:inset-0 max-md:justify-center max-md:p-6" data-canvas-hint>
22
+ <!-- The space over the hint and the space under it share what the board has left; the one over it never grows past 312 px. -->
23
+ <div class="max-h-[312px] min-h-0 flex-1 max-md:hidden"></div>
14
24
  <div class="flex w-80 max-w-full flex-col items-center gap-2.5 text-center">
15
25
  <div class="flex size-9 items-center justify-center rounded-lg border border-border bg-background text-foreground">
16
26
  <IconPencil class="size-4 stroke-[1.333]" aria-hidden="true" />
17
27
  </div>
18
28
  <p class="text-body-medium text-foreground">{$t('canvas.hint.title')}</p>
19
- <p class="text-body text-muted-foreground">{$t('canvas.hint.description')}</p>
29
+ {#if hintDescription}
30
+ <p class="text-body text-muted-foreground" data-canvas-hint-description>{hintDescription}</p>
31
+ {/if}
20
32
  </div>
33
+ <div class="min-h-0 flex-1 max-md:hidden"></div>
21
34
  </div>
@@ -1,18 +1,3 @@
1
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
- $$bindings?: Bindings;
4
- } & Exports;
5
- (internal: unknown, props: {
6
- $$events?: Events;
7
- $$slots?: Slots;
8
- }): Exports & {
9
- $set?: any;
10
- $on?: any;
11
- };
12
- z_$$bindings?: Bindings;
13
- }
14
- declare const CanvasHint: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
- [evt: string]: CustomEvent<any>;
16
- }, {}, {}, string>;
17
- type CanvasHint = InstanceType<typeof CanvasHint>;
1
+ declare const CanvasHint: import("svelte").Component<Record<string, never>, {}, "">;
2
+ type CanvasHint = ReturnType<typeof CanvasHint>;
18
3
  export default CanvasHint;
@@ -4,7 +4,7 @@
4
4
 
5
5
  Left to right: the drawing group (select, draw, erase, arrow, text), a divider, the Shapes menu, a divider and the history
6
6
  group (undo, redo). Every button is the design system's Icon Button with a tooltip, 36 px square, and the tool in use has
7
- the brand tint. The page's `showDrawingTools` hides the drawing group (and with it the letters that choose those tools).
7
+ the brand tint. The page's `showDrawingTools` hides the drawing group (and with it the letters and numbers that choose those tools).
8
8
  The Shapes menu and the history group are always on the bar: a page that wants a leaner canvas hides the bar itself. On a
9
9
  board narrower than the whole bar and its edges (381 px, so Figma's 358 px phone) the history group leaves the bar.
10
10
 
@@ -18,7 +18,7 @@
18
18
  import { Separator } from '@widgetic/design-system/components';
19
19
  import type { EngineState } from '../../engine/state.js';
20
20
  import { useCanvasLanguage } from '../../i18n/language.js';
21
- import { TOOL_KEYS } from '../../i18n/shortcuts.js';
21
+ import { TOOL_DIGIT_KEYS, TOOL_KEYS } from '../../i18n/shortcuts.js';
22
22
  import { isSideAnchor, popoverSideFor } from '../chromeLayout.js';
23
23
  import type { ChromeAnchor } from '../chromeLayout.js';
24
24
  import type { CanvasHost, HostUiState } from '../host/CanvasHost.js';
@@ -56,19 +56,19 @@
56
56
  data-canvas-ui
57
57
  >
58
58
  {#if showDrawingTools}
59
- <ToolButton toggle label={$t('canvas.tool.select')} shortcut={TOOL_KEYS.select} active={state.tool === 'select'} onclick={() => host.onSelectSelectTool()}>
59
+ <ToolButton toggle label={$t('canvas.tool.select')} shortcut={TOOL_KEYS.select} alternateShortcut={TOOL_DIGIT_KEYS.select} active={state.tool === 'select'} onclick={() => host.onSelectSelectTool()}>
60
60
  <IconPointer />
61
61
  </ToolButton>
62
- <ToolButton toggle label={$t('canvas.tool.draw')} shortcut={TOOL_KEYS.draw} active={state.tool === 'draw'} onclick={() => host.onSelectDrawTool()}>
62
+ <ToolButton toggle label={$t('canvas.tool.draw')} shortcut={TOOL_KEYS.draw} alternateShortcut={TOOL_DIGIT_KEYS.draw} active={state.tool === 'draw'} onclick={() => host.onSelectDrawTool()}>
63
63
  <IconPencil />
64
64
  </ToolButton>
65
- <ToolButton toggle label={$t('canvas.tool.erase')} shortcut={TOOL_KEYS.erase} active={state.tool === 'erase'} onclick={() => host.onSelectEraseTool()}>
65
+ <ToolButton toggle label={$t('canvas.tool.erase')} shortcut={TOOL_KEYS.erase} alternateShortcut={TOOL_DIGIT_KEYS.erase} active={state.tool === 'erase'} onclick={() => host.onSelectEraseTool()}>
66
66
  <IconEraser />
67
67
  </ToolButton>
68
- <ToolButton toggle label={$t('canvas.tool.arrow')} shortcut={TOOL_KEYS.arrow} active={state.tool === 'arrow'} onclick={() => host.onSelectArrowTool()}>
68
+ <ToolButton toggle label={$t('canvas.tool.arrow')} shortcut={TOOL_KEYS.arrow} alternateShortcut={TOOL_DIGIT_KEYS.arrow} active={state.tool === 'arrow'} onclick={() => host.onSelectArrowTool()}>
69
69
  <IconArrowUpRight />
70
70
  </ToolButton>
71
- <ToolButton toggle label={$t('canvas.tool.text')} shortcut={TOOL_KEYS.text} active={state.tool === 'text'} onclick={() => host.onSelectTextTool()}>
71
+ <ToolButton toggle label={$t('canvas.tool.text')} shortcut={TOOL_KEYS.text} alternateShortcut={TOOL_DIGIT_KEYS.text} active={state.tool === 'text'} onclick={() => host.onSelectTextTool()}>
72
72
  <IconTypography />
73
73
  </ToolButton>
74
74
 
@@ -17,6 +17,8 @@
17
17
  label: string;
18
18
  /** The key that does the same, as it is printed on a key cap ("V"), or nothing. It is also the button's `aria-keyshortcuts`. */
19
19
  shortcut?: string | undefined;
20
+ /** A second key that does the same ("1", the number of the tool): a second key cap in the tooltip, and a second entry of `aria-keyshortcuts`. */
21
+ alternateShortcut?: string | undefined;
20
22
  /** The tool this button chooses is the one in use. */
21
23
  active?: boolean;
22
24
  /** Whether the button acts like a switch (it then says whether it is on to a screen reader). */
@@ -29,7 +31,10 @@
29
31
  children: Snippet;
30
32
  }
31
33
 
32
- let { label, shortcut = undefined, active = false, toggle = false, disabled = false, size = 'toolbar', class: className = '', onclick, children }: Props = $props();
34
+ let { label, shortcut = undefined, alternateShortcut = undefined, active = false, toggle = false, disabled = false, size = 'toolbar', class: className = '', onclick, children }: Props = $props();
35
+
36
+ // `aria-keyshortcuts` lists the keys that do the same, separated by a space ("V 1").
37
+ const keyShortcuts = $derived([shortcut, alternateShortcut].filter(Boolean).join(' ') || undefined);
33
38
 
34
39
  // The tooltip is drawn into the canvas's floating layer, not in place: see floatingLayer.ts.
35
40
  const floatingLayer = useFloatingLayer();
@@ -46,7 +51,7 @@
46
51
  <Tooltip.Trigger>
47
52
  {#snippet child({ props }: { props: Record<string, unknown> })}
48
53
  {#if size === 'level'}
49
- <button {...props} type="button" aria-label={label} aria-keyshortcuts={shortcut} {disabled} {onclick} class="{LEVEL_CLASSES} {className}">
54
+ <button {...props} type="button" aria-label={label} aria-keyshortcuts={keyShortcuts} {disabled} {onclick} class="{LEVEL_CLASSES} {className}">
50
55
  {@render children()}
51
56
  </button>
52
57
  {:else}
@@ -56,7 +61,7 @@
56
61
  {disabled}
57
62
  {onclick}
58
63
  aria-pressed={toggle ? active : undefined}
59
- aria-keyshortcuts={shortcut}
64
+ aria-keyshortcuts={keyShortcuts}
60
65
  data-active={active ? '' : undefined}
61
66
  class="{SQUARE_CLASSES[size]} data-[active]:bg-brand-subtle data-[active]:text-foreground {className}"
62
67
  >
@@ -72,6 +77,9 @@
72
77
  {#if shortcut}
73
78
  <kbd class="rounded-sm bg-muted px-1.5 py-0.5 font-sans text-xs text-muted-foreground">{shortcut}</kbd>
74
79
  {/if}
80
+ {#if alternateShortcut}
81
+ <kbd class="rounded-sm bg-muted px-1.5 py-0.5 font-sans text-xs text-muted-foreground">{alternateShortcut}</kbd>
82
+ {/if}
75
83
  </span>
76
84
  </Tooltip.Content>
77
85
  </Tooltip.Portal>
@@ -4,6 +4,8 @@ interface Props {
4
4
  label: string;
5
5
  /** The key that does the same, as it is printed on a key cap ("V"), or nothing. It is also the button's `aria-keyshortcuts`. */
6
6
  shortcut?: string | undefined;
7
+ /** A second key that does the same ("1", the number of the tool): a second key cap in the tooltip, and a second entry of `aria-keyshortcuts`. */
8
+ alternateShortcut?: string | undefined;
7
9
  /** The tool this button chooses is the one in use. */
8
10
  active?: boolean;
9
11
  /** Whether the button acts like a switch (it then says whether it is on to a screen reader). */
@@ -5,8 +5,17 @@
5
5
  * and the panel has to show it and to take what a person types. Plain functions, free of Svelte and of the DOM, so Node
6
6
  * can test them.
7
7
  */
8
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
10
+ if (ar || !(i in from)) {
11
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
12
+ ar[i] = from[i];
13
+ }
14
+ }
15
+ return to.concat(ar || Array.prototype.slice.call(from));
16
+ };
8
17
  /** The colours the panel offers first, one click each. The first two are the board's own ink and paper. */
9
- export const COLOR_PRESETS = [
18
+ export var COLOR_PRESETS = [
10
19
  '#0F172A',
11
20
  '#FFFFFF',
12
21
  '#EF4444',
@@ -18,59 +27,61 @@ export const COLOR_PRESETS = [
18
27
  '#EC4899',
19
28
  '#6B7280'
20
29
  ];
21
- const HEX_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
30
+ var HEX_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
22
31
  /** True for a colour that paints nothing: `transparent`, or a colour that is fully see-through. */
23
32
  export function isNoColor(color) {
24
33
  if (!color)
25
34
  return true;
26
- const text = color.trim().toLowerCase();
35
+ var text = color.trim().toLowerCase();
27
36
  if (text === 'transparent' || text === 'none')
28
37
  return true;
29
- const rgba = text.match(/^rgba\(\s*[^,]+,\s*[^,]+,\s*[^,]+,\s*([\d.]+)\s*\)$/);
38
+ var rgba = text.match(/^rgba\(\s*[^,]+,\s*[^,]+,\s*[^,]+,\s*([\d.]+)\s*\)$/);
30
39
  return rgba ? Number.parseFloat(rgba[1]) === 0 : false;
31
40
  }
32
41
  /** What a person typed (`f80`, `#FF8800`, `ff8800`) as `#RRGGBB`, or null when it is not a colour. */
33
42
  export function parseHexInput(text) {
34
- const match = text.trim().match(HEX_PATTERN);
43
+ var match = text.trim().match(HEX_PATTERN);
35
44
  if (!match)
36
45
  return null;
37
- const digits = match[1].length === 3 ? [...match[1]].map((digit) => digit + digit).join('') : match[1];
38
- return `#${digits.toUpperCase()}`;
46
+ var digits = match[1].length === 3 ? __spreadArray([], match[1], true).map(function (digit) { return digit + digit; }).join('') : match[1];
47
+ return "#".concat(digits.toUpperCase());
39
48
  }
40
49
  function toHexByte(value) {
41
50
  return Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, '0');
42
51
  }
43
52
  function hslToHex(hue, saturation, lightness) {
44
- const s = saturation / 100;
45
- const l = lightness / 100;
46
- const a = s * Math.min(l, 1 - l);
47
- const channel = (n) => {
48
- const k = (n + hue / 30) % 12;
53
+ var s = saturation / 100;
54
+ var l = lightness / 100;
55
+ var a = s * Math.min(l, 1 - l);
56
+ var channel = function (n) {
57
+ var k = (n + hue / 30) % 12;
49
58
  return toHexByte(255 * (l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1)));
50
59
  };
51
- return `#${channel(0)}${channel(8)}${channel(4)}`.toUpperCase();
60
+ return "#".concat(channel(0)).concat(channel(8)).concat(channel(4)).toUpperCase();
52
61
  }
53
62
  /**
54
63
  * A stored colour as `#RRGGBB`: a hex, an `rgb()` or `hsl()` an older canvas may hold, or the nearest the browser can
55
64
  * say for a colour name. `fallback` is what is answered for a colour that cannot be read.
56
65
  */
57
- export function colorToHex(color, fallback = '#000000') {
66
+ export function colorToHex(color, fallback) {
67
+ var _a;
68
+ if (fallback === void 0) { fallback = '#000000'; }
58
69
  if (!color)
59
70
  return fallback;
60
- const hex = parseHexInput(color);
71
+ var hex = parseHexInput(color);
61
72
  if (hex)
62
73
  return hex;
63
- const text = color.trim();
64
- const rgb = text.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
74
+ var text = color.trim();
75
+ var rgb = text.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
65
76
  if (rgb)
66
- return `#${toHexByte(Number(rgb[1]))}${toHexByte(Number(rgb[2]))}${toHexByte(Number(rgb[3]))}`.toUpperCase();
67
- const hsl = text.match(/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%/i);
77
+ return "#".concat(toHexByte(Number(rgb[1]))).concat(toHexByte(Number(rgb[2]))).concat(toHexByte(Number(rgb[3]))).toUpperCase();
78
+ var hsl = text.match(/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%/i);
68
79
  if (hsl)
69
80
  return hslToHex(Number(hsl[1]), Number(hsl[2]), Number(hsl[3]));
70
- return NAMED_COLORS[text.toLowerCase()] ?? fallback;
81
+ return (_a = NAMED_COLORS[text.toLowerCase()]) !== null && _a !== void 0 ? _a : fallback;
71
82
  }
72
83
  /** The few colour names an older canvas may hold. A name that is not here reads as the fallback. */
73
- const NAMED_COLORS = Object.freeze({
84
+ var NAMED_COLORS = Object.freeze({
74
85
  black: '#000000',
75
86
  white: '#FFFFFF',
76
87
  red: '#FF0000',
@@ -1,15 +1,15 @@
1
1
  /** Names the colour picker fills in at runtime (`{s}`, `{v}`, `{hex}`), built without literals the word scan would read. */
2
- const s = `{${'s'}}`;
3
- const v = `{${'v'}}`;
4
- const hex = `{${'hex'}}`;
2
+ var s = "{".concat('s', "}");
3
+ var v = "{".concat('v', "}");
4
+ var hex = "{".concat('hex', "}");
5
5
  /** Words the design-system colour picker speaks; templates keep their placeholders for the picker to replace. */
6
6
  export function colorPickerMessages(t) {
7
7
  return {
8
8
  area: t('canvas.colorPicker.area'),
9
- areaValue: t('canvas.colorPicker.areaValue', { s, v }),
9
+ areaValue: t('canvas.colorPicker.areaValue', { s: s, v: v }),
10
10
  hue: t('canvas.colorPicker.hue'),
11
11
  hex: t('canvas.panel.hex'),
12
12
  add: t('canvas.colorPicker.add'),
13
- swatch: t('canvas.colorPicker.swatch', { hex })
13
+ swatch: t('canvas.colorPicker.swatch', { hex: hex })
14
14
  };
15
15
  }
@@ -12,16 +12,16 @@
12
12
  * when it reads this file. Kept free of Svelte and of the DOM so that Node can test it.
13
13
  */
14
14
  /** The card itself: its corners, border, fill, padding and shadow. */
15
- export const FLOATING_CARD_CLASSES = 'rounded-xl border border-border bg-background p-[3px] shadow-floating';
15
+ export var FLOATING_CARD_CLASSES = 'rounded-xl border border-border bg-background p-[3px] shadow-floating';
16
16
  /**
17
17
  * The padding of the canvas's menus (the Shapes menu, the right-click menu and their submenus). They are the design system's
18
18
  * Dropdown Menu, drawn in Figma the same way as the cards above: the first row stands 4 px from the outer edge, the 1 px
19
19
  * border inside that. The component's own padding (4 px, beside the border) makes a menu 2 px larger each way than Figma's:
20
20
  * the Shape Menu is 196 x 246 there, and measures 246 only with 3 px.
21
21
  */
22
- export const MENU_PADDING_CLASS = 'p-[3px]';
22
+ export var MENU_PADDING_CLASS = 'p-[3px]';
23
23
  /** Figma "Layer Menu" (519:*): 4 px inset, 220 × 136 with 32 px rows. */
24
- export const LAYER_MENU_PADDING_CLASS = 'p-1';
24
+ export var LAYER_MENU_PADDING_CLASS = 'p-1';
25
25
  /**
26
26
  * A menu, a popover or a tooltip of the design system slides and fades in, and its classes do not ask whether the system wants
27
27
  * less motion. The canvas adds this to each one it draws: with `prefers-reduced-motion: reduce` the card appears and goes
@@ -30,9 +30,9 @@ export const LAYER_MENU_PADDING_CLASS = 'p-1';
30
30
  * The states are those of the three components: a menu and a popover are `open` and `closed`, a tooltip `delayed-open`,
31
31
  * `instant-open` and `closed`.
32
32
  */
33
- export const OVERLAY_REDUCED_MOTION_CLASSES = 'motion-reduce:animate-none motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none motion-reduce:data-[state=delayed-open]:animate-none motion-reduce:data-[state=instant-open]:animate-none';
33
+ export var OVERLAY_REDUCED_MOTION_CLASSES = 'motion-reduce:animate-none motion-reduce:data-[state=open]:animate-none motion-reduce:data-[state=closed]:animate-none motion-reduce:data-[state=delayed-open]:animate-none motion-reduce:data-[state=instant-open]:animate-none';
34
34
  /** Canvas-floated surfaces stay below site dialogs and toasts (design-system overlays use z-50). */
35
- export const CANVAS_OVERLAY_Z_CLASS = 'z-40';
35
+ export var CANVAS_OVERLAY_Z_CLASS = 'z-40';
36
36
  /**
37
37
  * The ring of a menu's button while its menu is open, and while the keyboard is on it: 2 px of ring standing 2 px off the
38
38
  * button, with the board's colour in the gap, as the design system draws its focus ring. Figma draws the open "Shapes" button
@@ -42,23 +42,23 @@ export const CANVAS_OVERLAY_Z_CLASS = 'z-40';
42
42
  * `--tw-ring-offset-width` with `!important` on every element that has `aria-expanded` (a menu's button always has), so the
43
43
  * offset of a ring on such a button is lost, whatever class asks for it.
44
44
  */
45
- export const MENU_TRIGGER_RING_CLASSES = 'focus-visible:shadow-[0_0_0_2px_var(--color-background),0_0_0_4px_var(--color-ring)] data-[state=open]:shadow-[0_0_0_2px_var(--color-background),0_0_0_4px_var(--color-ring)]';
45
+ export var MENU_TRIGGER_RING_CLASSES = 'focus-visible:shadow-[0_0_0_2px_var(--color-background),0_0_0_4px_var(--color-ring)] data-[state=open]:shadow-[0_0_0_2px_var(--color-background),0_0_0_4px_var(--color-ring)]';
46
46
  /**
47
47
  * Tabler toolbar icons are 16 px (`size-4`) with stroke 2 in a 24 px viewBox: 2 × 16 / 24 = 1.333 px on screen.
48
48
  * A library shape glyph is drawn in a 100 px viewBox, so it needs a stroke of 1.333 × 100 / 16 = 8.33 in its own units to
49
49
  * look as thick. The design system's menu item forces `size-4` and `stroke-2` on every svg inside it through CSS, which beats
50
50
  * the `stroke-width` attribute (the glyphs were 0.32 px thick), so the width is set inline on the glyph.
51
51
  */
52
- export const TOOLBAR_ICON_STROKE_CLASSES = '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:stroke-2';
53
- export const TOOLBAR_ICON_SIZE_PX = 16;
54
- export const TOOLBAR_ICON_VIEWBOX = 24;
55
- export const TOOLBAR_ICON_STROKE_UNITS = 2;
56
- export const TOOLBAR_ICON_STROKE_PX = (TOOLBAR_ICON_STROKE_UNITS * TOOLBAR_ICON_SIZE_PX) / TOOLBAR_ICON_VIEWBOX;
57
- export const SHAPE_LIBRARY_ICON_SIZE_PX = TOOLBAR_ICON_SIZE_PX;
58
- export const SHAPE_LIBRARY_VIEWBOX = 100;
59
- export const SHAPE_LIBRARY_STROKE_WIDTH = (TOOLBAR_ICON_STROKE_PX * SHAPE_LIBRARY_VIEWBOX) / SHAPE_LIBRARY_ICON_SIZE_PX;
52
+ export var TOOLBAR_ICON_STROKE_CLASSES = '[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:stroke-2';
53
+ export var TOOLBAR_ICON_SIZE_PX = 16;
54
+ export var TOOLBAR_ICON_VIEWBOX = 24;
55
+ export var TOOLBAR_ICON_STROKE_UNITS = 2;
56
+ export var TOOLBAR_ICON_STROKE_PX = (TOOLBAR_ICON_STROKE_UNITS * TOOLBAR_ICON_SIZE_PX) / TOOLBAR_ICON_VIEWBOX;
57
+ export var SHAPE_LIBRARY_ICON_SIZE_PX = TOOLBAR_ICON_SIZE_PX;
58
+ export var SHAPE_LIBRARY_VIEWBOX = 100;
59
+ export var SHAPE_LIBRARY_STROKE_WIDTH = (TOOLBAR_ICON_STROKE_PX * SHAPE_LIBRARY_VIEWBOX) / SHAPE_LIBRARY_ICON_SIZE_PX;
60
60
  /** Figma's measures of the cards, in px (a Figma frame counts an inside stroke as part of the card). */
61
- export const FLOATING_CARD_METRICS = {
61
+ export var FLOATING_CARD_METRICS = {
62
62
  /** The whole toolbar: five tools, the Shapes menu and the history group, with their dividers. */
63
63
  toolbarWidth: 349,
64
64
  toolbarHeight: 44,
@@ -76,7 +76,7 @@ export const FLOATING_CARD_METRICS = {
76
76
  * with. (An upright bar is as long as the board is tall, so it always has them.) Written out in full, so a page's stylesheet
77
77
  * picks it up.
78
78
  */
79
- export const TOOLBAR_HISTORY_VISIBLE_FROM = 'hidden @[384px]:flex';
79
+ export var TOOLBAR_HISTORY_VISIBLE_FROM = 'hidden @[384px]:flex';
80
80
  /**
81
81
  * The width of board from which the zoom card is drawn, by the way it stands beside the toolbar (see `chromeLayout.ts`, which
82
82
  * picks the case from the two anchors a page named). Narrower than that the zoom card is not drawn, as in Figma's phone: a
@@ -92,7 +92,7 @@ export const TOOLBAR_HISTORY_VISIBLE_FROM = 'hidden @[384px]:flex';
92
92
  * - `centredBesideCornerToolbar`: the toolbar at a corner and the zoom card centred: the card's left edge has to clear the
93
93
  * toolbar's right edge, which is 365 px from the board's left edge.
94
94
  */
95
- export const ZOOM_CONTROL_MIN_WIDTHS = {
95
+ export var ZOOM_CONTROL_MIN_WIDTHS = {
96
96
  alone: 512,
97
97
  sameSlot: 560,
98
98
  oppositeCorners: 560,
@@ -100,7 +100,7 @@ export const ZOOM_CONTROL_MIN_WIDTHS = {
100
100
  centredBesideCornerToolbar: 912
101
101
  };
102
102
  /** The classes that show the zoom card from each of those widths. Written out in full, so a page's stylesheet picks every one up. */
103
- export const ZOOM_CONTROL_VISIBLE_FROM = {
103
+ export var ZOOM_CONTROL_VISIBLE_FROM = {
104
104
  alone: 'hidden @lg:flex',
105
105
  sameSlot: 'hidden @[560px]:flex',
106
106
  oppositeCorners: 'hidden @[560px]:flex',
@@ -12,22 +12,23 @@
12
12
  */
13
13
  import { getContext, setContext } from 'svelte';
14
14
  import { readable } from 'svelte/store';
15
- const FLOATING_LAYER_CONTEXT_KEY = Symbol('widgetic-canvas-floating-layer');
15
+ var FLOATING_LAYER_CONTEXT_KEY = Symbol('widgetic-canvas-floating-layer');
16
16
  /**
17
17
  * The classes of the layer's element: no size (so it catches no press, and no `pointer-events: none` is needed, which the
18
18
  * menus inside would inherit), above the chrome, and a containing block for what is fixed inside it.
19
19
  */
20
- export const FLOATING_LAYER_CLASSES = 'absolute inset-0 z-50 h-0 w-0 [contain:layout]';
20
+ export var FLOATING_LAYER_CLASSES = 'absolute inset-0 z-50 h-0 w-0 [contain:layout]';
21
21
  /** Called by the canvas that owns the layer, before its children are made. */
22
22
  export function provideFloatingLayer(layer) {
23
23
  setContext(FLOATING_LAYER_CONTEXT_KEY, layer);
24
24
  }
25
25
  /** The element to draw a floating thing into. A piece used outside a canvas has none, and the library's own default applies. */
26
26
  export function useFloatingLayer() {
27
- return getContext(FLOATING_LAYER_CONTEXT_KEY) ?? readable(null);
27
+ var _a;
28
+ return (_a = getContext(FLOATING_LAYER_CONTEXT_KEY)) !== null && _a !== void 0 ? _a : readable(null);
28
29
  }
29
30
  /** Below design-system dialogs, dropdowns and toasts (`z-50`); still above normal page content so a compact card does not cover menus. */
30
- export const CANVAS_OVERLAY_PORTAL_Z_CLASS = 'z-40';
31
+ export var CANVAS_OVERLAY_PORTAL_Z_CLASS = 'z-40';
31
32
  /**
32
33
  * Portal target for a menu, popover or tooltip: `document.body` in the light DOM, else the in-canvas floating layer.
33
34
  * Floating UI still measures from the trigger; only the mount node changes.
@@ -38,7 +39,7 @@ export function canvasOverlayPortalProps(floatingLayer) {
38
39
  ? { to: document.body, class: CANVAS_OVERLAY_PORTAL_Z_CLASS }
39
40
  : { class: CANVAS_OVERLAY_PORTAL_Z_CLASS };
40
41
  }
41
- const root = floatingLayer.getRootNode();
42
+ var root = floatingLayer.getRootNode();
42
43
  if (typeof Document !== 'undefined' && root instanceof Document) {
43
44
  return { to: document.body, class: CANVAS_OVERLAY_PORTAL_Z_CLASS };
44
45
  }
@@ -1,10 +1,12 @@
1
1
  /** The platform name of a browser, from the newer API when there is one. */
2
2
  function platformName(nav) {
3
- const withData = nav;
4
- return withData.userAgentData?.platform ?? nav.platform ?? '';
3
+ var _a, _b, _c;
4
+ var withData = nav;
5
+ return (_c = (_b = (_a = withData.userAgentData) === null || _a === void 0 ? void 0 : _a.platform) !== null && _b !== void 0 ? _b : nav.platform) !== null && _c !== void 0 ? _c : '';
5
6
  }
6
7
  /** True on a Mac, an iPhone or an iPad, where the shortcut key is Command and the menus print it as a symbol. */
7
- export function isApplePlatform(nav = typeof navigator === 'undefined' ? undefined : navigator) {
8
+ export function isApplePlatform(nav) {
9
+ if (nav === void 0) { nav = typeof navigator === 'undefined' ? undefined : navigator; }
8
10
  if (!nav)
9
11
  return false;
10
12
  return /mac|iphone|ipad|ipod/i.test(platformName(nav));
@@ -17,7 +19,7 @@ export function isApplePlatform(nav = typeof navigator === 'undefined' ? undefin
17
19
  export function ariaKeyShortcut(chord, apple) {
18
20
  if (typeof chord.key !== 'string')
19
21
  return undefined;
20
- const parts = [];
22
+ var parts = [];
21
23
  if (chord.mod)
22
24
  parts.push(apple ? 'Meta' : 'Control');
23
25
  if (chord.shift)
@@ -30,10 +32,10 @@ export function ariaKeyShortcut(chord, apple) {
30
32
  * the same in every language; the words of the others come from the page's language.
31
33
  */
32
34
  export function chordText(chord, apple, t) {
33
- const key = typeof chord.key === 'string' ? chord.key : t(chord.key.name);
35
+ var key = typeof chord.key === 'string' ? chord.key : t(chord.key.name);
34
36
  if (apple)
35
- return `${chord.shift ? '⇧' : ''}${chord.mod ? '⌘' : ''}${key}`;
36
- const parts = [];
37
+ return "".concat(chord.shift ? '⇧' : '').concat(chord.mod ? '⌘' : '').concat(key);
38
+ var parts = [];
37
39
  if (chord.mod)
38
40
  parts.push(t('canvas.key.ctrl'));
39
41
  if (chord.shift)
@@ -46,8 +48,8 @@ export function chordText(chord, apple, t) {
46
48
  * elsewhere. The toolbar and zoom control keep `chordText` (symbols on Apple).
47
49
  */
48
50
  export function menuChordText(chord, apple, t) {
49
- const key = typeof chord.key === 'string' ? chord.key : t(chord.key.name);
50
- const parts = [];
51
+ var key = typeof chord.key === 'string' ? chord.key : t(chord.key.name);
52
+ var parts = [];
51
53
  if (chord.shift)
52
54
  parts.push(t('canvas.key.shift'));
53
55
  if (chord.mod)
@@ -9,12 +9,13 @@
9
9
  * The side is given as a function, so a card that the page moves while the canvas is open takes its tooltips with it.
10
10
  */
11
11
  import { getContext, setContext } from 'svelte';
12
- const POPOVER_SIDE_CONTEXT_KEY = Symbol('widgetic-canvas-popover-side');
12
+ var POPOVER_SIDE_CONTEXT_KEY = Symbol('widgetic-canvas-popover-side');
13
13
  /** Called by a card of the chrome, before its children are made. */
14
14
  export function providePopoverSide(getSide) {
15
15
  setContext(POPOVER_SIDE_CONTEXT_KEY, getSide);
16
16
  }
17
17
  /** The side to open a tooltip or a menu to. A button used outside a card of the chrome opens upward, as the bottom toolbar always did. */
18
18
  export function usePopoverSide() {
19
- return getContext(POPOVER_SIDE_CONTEXT_KEY) ?? (() => 'top');
19
+ var _a;
20
+ return (_a = getContext(POPOVER_SIDE_CONTEXT_KEY)) !== null && _a !== void 0 ? _a : (function () { return 'top'; });
20
21
  }
@@ -5,17 +5,26 @@
5
5
  * of shape has is the engine's own rule (`style.ts` says which keys of a style patch a shape takes), so the panel never
6
6
  * offers a control that would change nothing.
7
7
  */
8
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
10
+ if (ar || !(i in from)) {
11
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
12
+ ar[i] = from[i];
13
+ }
14
+ }
15
+ return to.concat(ar || Array.prototype.slice.call(from));
16
+ };
8
17
  import { isArrow } from '../../engine/core/arrow.js';
9
18
  import { isBrushStroke } from '../../engine/core/brush.js';
10
19
  import { leafShapesOf, normalizeSelection } from '../../engine/core/scene.js';
11
20
  import { lineColorOf, paintsFillOnStroke, pathSupportsRoundness } from '../../engine/core/style.js';
12
- const NONE = { kind: 'none' };
21
+ var NONE = { kind: 'none' };
13
22
  /** One value out of many: the value they all have, `mixed` when they differ, `none` when there is nothing to compare. */
14
23
  export function unify(values) {
15
24
  if (values.length === 0)
16
25
  return NONE;
17
- const first = values[0];
18
- return values.every((value) => Object.is(value, first)) ? { kind: 'same', value: first } : { kind: 'mixed' };
26
+ var first = values[0];
27
+ return values.every(function (value) { return Object.is(value, first); }) ? { kind: 'same', value: first } : { kind: 'mixed' };
19
28
  }
20
29
  /** Whether a shape has a fill and a stroke of its own: the three kinds of vector shape. */
21
30
  function isVector(shape) {
@@ -23,46 +32,43 @@ function isVector(shape) {
23
32
  }
24
33
  /** Describes the selection for the panel. */
25
34
  export function describeSelection(scene, selectedIds) {
26
- const unitIds = normalizeSelection(scene, selectedIds);
27
- const unitIdSet = new Set(unitIds);
28
- const units = scene.filter((object) => unitIdSet.has(object.id));
29
- const shapes = leafShapesOf(scene, unitIds);
30
- const only = units.length === 1 ? units[0] : undefined;
31
- const widgetCard = only && only.type === 'widget' ? only : null;
35
+ var unitIds = normalizeSelection(scene, selectedIds);
36
+ var unitIdSet = new Set(unitIds);
37
+ var units = scene.filter(function (object) { return unitIdSet.has(object.id); });
38
+ var shapes = leafShapesOf(scene, unitIds);
39
+ var only = units.length === 1 ? units[0] : undefined;
40
+ var widgetCard = only && only.type === 'widget' ? only : null;
32
41
  // The card of a widget is the page's to style (it shows the widget): the panel does not paint it.
33
- const targets = shapes.filter((shape) => shape.type !== 'widget');
34
- const vectors = targets.filter(isVector);
35
- const texts = targets.filter((shape) => shape.type === 'text');
42
+ var targets = shapes.filter(function (shape) { return shape.type !== 'widget'; });
43
+ var vectors = targets.filter(isVector);
44
+ var texts = targets.filter(function (shape) { return shape.type === 'text'; });
36
45
  // A brush stroke is a filled outline, but to a person it is a line: its colour is the Stroke, and it has no Fill. An arrow is a line too.
37
- const fillValues = [
38
- ...vectors
39
- .filter((shape) => !isBrushStroke(shape) && !isArrow(shape))
40
- .map((shape) => (paintsFillOnStroke(shape) ? shape.stroke : shape.fill)),
41
- ...texts.map((shape) => shape.color)
42
- ];
43
- const strokeValues = vectors.filter((shape) => !paintsFillOnStroke(shape)).map(lineColorOf);
44
- const roundnessValues = vectors
45
- .filter((shape) => shape.type === 'rect' || (shape.type === 'path' && pathSupportsRoundness(shape.shape)))
46
- .map((shape) => (shape.type === 'rect' || shape.type === 'path' ? shape.roundness : 0));
46
+ var fillValues = __spreadArray(__spreadArray([], vectors
47
+ .filter(function (shape) { return !isBrushStroke(shape) && !isArrow(shape); })
48
+ .map(function (shape) { return (paintsFillOnStroke(shape) ? shape.stroke : shape.fill); }), true), texts.map(function (shape) { return shape.color; }), true);
49
+ var strokeValues = vectors.filter(function (shape) { return !paintsFillOnStroke(shape); }).map(lineColorOf);
50
+ var roundnessValues = vectors
51
+ .filter(function (shape) { return shape.type === 'rect' || (shape.type === 'path' && pathSupportsRoundness(shape.shape)); })
52
+ .map(function (shape) { return (shape.type === 'rect' || shape.type === 'path' ? shape.roundness : 0); });
47
53
  return {
48
- targets,
49
- units,
54
+ targets: targets,
55
+ units: units,
50
56
  fill: unify(fillValues),
51
57
  stroke: unify(strokeValues),
52
- strokeWidth: unify(vectors.map((shape) => shape.strokeWidth)),
58
+ strokeWidth: unify(vectors.map(function (shape) { return shape.strokeWidth; })),
53
59
  roundness: unify(roundnessValues),
54
- opacity: unify(targets.map((shape) => shape.opacity)),
60
+ opacity: unify(targets.map(function (shape) { return shape.opacity; })),
55
61
  text: texts.length === 0
56
62
  ? null
57
63
  : {
58
- fontSize: unify(texts.map((shape) => shape.fontSize)),
59
- fontFamily: unify(texts.map((shape) => shape.fontFamily)),
60
- bold: unify(texts.map((shape) => shape.fontWeight === 'bold')),
61
- italic: unify(texts.map((shape) => shape.fontStyle === 'italic')),
62
- underline: unify(texts.map((shape) => shape.underline)),
63
- align: unify(texts.map((shape) => shape.align))
64
+ fontSize: unify(texts.map(function (shape) { return shape.fontSize; })),
65
+ fontFamily: unify(texts.map(function (shape) { return shape.fontFamily; })),
66
+ bold: unify(texts.map(function (shape) { return shape.fontWeight === 'bold'; })),
67
+ italic: unify(texts.map(function (shape) { return shape.fontStyle === 'italic'; })),
68
+ underline: unify(texts.map(function (shape) { return shape.underline; })),
69
+ align: unify(texts.map(function (shape) { return shape.align; }))
64
70
  },
65
- widgetCard
71
+ widgetCard: widgetCard
66
72
  };
67
73
  }
68
74
  /** The number of a trait for a control, or a fallback when the shapes differ or the control does not apply. */
@@ -89,7 +95,7 @@ export function showStrokeColorRow(traits, wireframeMode) {
89
95
  return false;
90
96
  if (!wireframeMode)
91
97
  return true;
92
- return traits.targets.some((shape) => {
98
+ return traits.targets.some(function (shape) {
93
99
  if (shape.type === 'rect' || shape.type === 'ellipse')
94
100
  return false;
95
101
  if (shape.type !== 'path')
@@ -1,5 +1,5 @@
1
1
  /**
2
- * When the size label under a selection is visible (item B21).
2
+ * When the size label in the middle of a selection is visible (item B21).
3
3
  */
4
4
  import type { SelectionDrag } from '../../engine/state.js';
5
5
  export interface SizeLabelVisibilityInput {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * When the size label under a selection is visible (item B21).
2
+ * When the size label in the middle of a selection is visible (item B21).
3
3
  */
4
4
  /**
5
5
  * True only while the selection is being resized (Figma "Selection Box" keeps the size chip hidden at rest;