@lvl99dotcom/paintcanvas 0.3.1 → 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.
Files changed (212) hide show
  1. package/README.md +30 -15
  2. package/dist/lib/brushes/StrokeEngine/index.d.ts +2 -2
  3. package/dist/lib/brushes/StrokeEngine/index.js +26 -28
  4. package/dist/lib/brushes/presets/round/index.d.ts +1 -1
  5. package/dist/lib/brushes/presets/round/index.js +12 -7
  6. package/dist/lib/brushes/presets/square/index.d.ts +1 -1
  7. package/dist/lib/brushes/presets/square/index.js +7 -3
  8. package/dist/lib/brushes/shapeImage/index.d.ts +7 -3
  9. package/dist/lib/brushes/shapeImage/index.js +15 -9
  10. package/dist/lib/brushes/shapes/index.d.ts +18 -0
  11. package/dist/lib/brushes/shapes/index.js +86 -0
  12. package/dist/lib/classes/BrushSettings/index.d.ts +53 -2
  13. package/dist/lib/classes/BrushSettings/index.js +85 -14
  14. package/dist/lib/classes/KeyboardShortcuts/index.d.ts +47 -7
  15. package/dist/lib/classes/KeyboardShortcuts/index.js +145 -20
  16. package/dist/lib/classes/PaintCanvas/index.d.ts +123 -27
  17. package/dist/lib/classes/PaintCanvas/index.js +208 -41
  18. package/dist/lib/classes/PaintCanvas/tool.d.ts +15 -0
  19. package/dist/lib/classes/PaintCanvas/tool.js +18 -0
  20. package/dist/lib/classes/Palette/index.d.ts +58 -0
  21. package/dist/lib/classes/Palette/index.js +92 -0
  22. package/dist/lib/classes/SettingsAutosave/index.d.ts +53 -0
  23. package/dist/lib/classes/SettingsAutosave/index.js +98 -0
  24. package/dist/lib/classes/ShortcutSettings/index.d.ts +63 -0
  25. package/dist/lib/classes/ShortcutSettings/index.js +110 -0
  26. package/dist/lib/classes/UiSettings/index.d.ts +68 -0
  27. package/dist/lib/classes/UiSettings/index.js +82 -0
  28. package/dist/lib/palette/index.d.ts +49 -0
  29. package/dist/lib/palette/index.js +82 -0
  30. package/dist/lib/palette/schema.d.ts +45 -0
  31. package/dist/lib/palette/schema.js +41 -0
  32. package/dist/lib/rendering/cursors/index.d.ts +2 -0
  33. package/dist/lib/rendering/cursors/index.js +3 -1
  34. package/dist/lib/rendering/sample/index.js +3 -2
  35. package/dist/lib/settings/index.d.ts +63 -0
  36. package/dist/lib/settings/index.js +93 -0
  37. package/dist/lib/settings/schema.d.ts +168 -0
  38. package/dist/lib/settings/schema.js +116 -0
  39. package/dist/lib/storage/index.d.ts +36 -5
  40. package/dist/lib/storage/index.js +87 -29
  41. package/dist/lib/utils/colour/index.d.ts +72 -0
  42. package/dist/lib/utils/colour/index.js +154 -0
  43. package/dist/lib/utils/shortcuts/index.d.ts +174 -11
  44. package/dist/lib/utils/shortcuts/index.js +391 -145
  45. package/dist/lib/validation/validators.generated.d.ts +5 -0
  46. package/dist/lib/validation/validators.generated.js +1040 -1
  47. package/dist/locales/en-GB.js +96 -3
  48. package/dist/locales/en-US.js +96 -3
  49. package/dist/locales/fr.js +96 -3
  50. package/dist/locales/ja.js +96 -3
  51. package/dist/locales/ko.js +96 -3
  52. package/dist/locales/zh-Hans.js +96 -3
  53. package/dist/locales/zh-Hant.js +96 -3
  54. package/dist/package.js +1 -1
  55. package/dist/testing/recordingCanvas.js +2 -1
  56. package/dist/ui/base/index.d.ts +2 -2
  57. package/dist/ui/dismiss/index.d.ts +21 -0
  58. package/dist/ui/dismiss/index.js +27 -0
  59. package/dist/ui/drag/index.d.ts +51 -0
  60. package/dist/ui/drag/index.js +81 -0
  61. package/dist/ui/elements/PaintCanvas/index.d.ts +57 -50
  62. package/dist/ui/elements/PaintCanvas/index.js +141 -174
  63. package/dist/ui/elements/PaintCanvas/style.js +1 -1
  64. package/dist/ui/elements/PcAppSettings/index.d.ts +59 -0
  65. package/dist/ui/elements/PcAppSettings/index.js +222 -0
  66. package/dist/ui/elements/PcBrushConfig/index.d.ts +9 -2
  67. package/dist/ui/elements/PcBrushConfig/index.js +47 -7
  68. package/dist/ui/elements/PcBrushConfig/style.js +1 -1
  69. package/dist/ui/elements/PcBrushSize/index.d.ts +53 -0
  70. package/dist/ui/elements/PcBrushSize/index.js +66 -0
  71. package/dist/ui/elements/PcBrushTest/index.d.ts +26 -0
  72. package/dist/ui/elements/PcBrushTest/index.js +73 -5
  73. package/dist/ui/elements/PcBrushTest/style.js +1 -1
  74. package/dist/ui/elements/PcCanvas/index.d.ts +22 -2
  75. package/dist/ui/elements/PcCanvas/index.js +60 -15
  76. package/dist/ui/elements/PcCanvasMap/style.js +1 -1
  77. package/dist/ui/elements/PcClipboardTools/index.d.ts +48 -0
  78. package/dist/ui/elements/PcClipboardTools/index.js +118 -0
  79. package/dist/ui/elements/PcColourPair/index.d.ts +43 -0
  80. package/dist/ui/elements/PcColourPair/index.js +125 -0
  81. package/dist/ui/elements/PcContextMenu/index.d.ts +71 -34
  82. package/dist/ui/elements/PcContextMenu/index.js +128 -97
  83. package/dist/ui/elements/PcInputSettings/index.d.ts +13 -0
  84. package/dist/ui/elements/PcInputSettings/index.js +16 -1
  85. package/dist/ui/elements/PcLayerItem/index.d.ts +13 -34
  86. package/dist/ui/elements/PcLayerItem/index.js +39 -91
  87. package/dist/ui/elements/PcLayerItem/style.js +1 -1
  88. package/dist/ui/elements/PcMenu/index.d.ts +138 -0
  89. package/dist/ui/elements/PcMenu/index.js +296 -0
  90. package/dist/ui/elements/PcNumberSlider/index.d.ts +137 -0
  91. package/dist/ui/elements/PcNumberSlider/index.js +247 -0
  92. package/dist/ui/elements/PcPane/index.d.ts +120 -0
  93. package/dist/ui/elements/PcPane/index.js +394 -0
  94. package/dist/ui/elements/PcPanel/index.d.ts +26 -8
  95. package/dist/ui/elements/PcPanel/index.js +76 -8
  96. package/dist/ui/elements/{PcBrushMenu → PcPanelBrushes}/index.d.ts +22 -21
  97. package/dist/ui/elements/{PcBrushMenu → PcPanelBrushes}/index.js +24 -57
  98. package/dist/ui/elements/PcPanelBrushes/style.js +3 -0
  99. package/dist/ui/elements/PcPanelColours/index.d.ts +171 -0
  100. package/dist/ui/elements/PcPanelColours/index.js +650 -0
  101. package/dist/ui/elements/PcPanelColours/style.js +3 -0
  102. package/dist/ui/elements/{PcLayersMenu → PcPanelLayers}/index.d.ts +17 -4
  103. package/dist/ui/elements/{PcLayersMenu → PcPanelLayers}/index.js +17 -10
  104. package/dist/ui/elements/PcPanelLayers/style.js +3 -0
  105. package/dist/ui/elements/PcPopover/index.d.ts +39 -1
  106. package/dist/ui/elements/PcPopover/index.js +72 -4
  107. package/dist/ui/elements/PcShortcutSettings/index.d.ts +69 -0
  108. package/dist/ui/elements/PcShortcutSettings/index.js +273 -0
  109. package/dist/ui/elements/PcThemePicker/index.d.ts +17 -15
  110. package/dist/ui/elements/PcThemePicker/index.js +22 -21
  111. package/dist/ui/elements/PcToolSettings/index.d.ts +48 -9
  112. package/dist/ui/elements/PcToolSettings/index.js +384 -319
  113. package/dist/ui/elements/PcToolSettings/style.js +1 -1
  114. package/dist/ui/elements/PcToolbar/index.d.ts +62 -12
  115. package/dist/ui/elements/PcToolbar/index.js +119 -57
  116. package/dist/ui/elements/PcToolbar/style.js +1 -1
  117. package/dist/ui/icons/images/icon-brush@2x.js +3 -0
  118. package/dist/ui/icons/images/icon-circle-mask@2x.js +3 -0
  119. package/dist/ui/icons/images/icon-clipboard@2x.js +3 -0
  120. package/dist/ui/icons/images/icon-cog@2x.js +3 -0
  121. package/dist/ui/icons/images/icon-cursor@2x.js +3 -0
  122. package/dist/ui/icons/images/icon-diagonal-tlbr-size@2x.js +3 -0
  123. package/dist/ui/icons/images/icon-diagonal-trbl-size@2x.js +3 -0
  124. package/dist/ui/icons/images/icon-eraser@2x.js +3 -0
  125. package/dist/ui/icons/images/icon-eyedropper@2x.js +3 -0
  126. package/dist/ui/icons/images/icon-flip-horizontal@2x.js +3 -0
  127. package/dist/ui/icons/images/icon-flip-vertical@2x.js +3 -0
  128. package/dist/ui/icons/images/icon-focus-pen@2x.js +3 -0
  129. package/dist/ui/icons/images/icon-freehand-mask@2x.js +3 -0
  130. package/dist/ui/icons/images/icon-hidden@2x.js +3 -0
  131. package/dist/ui/icons/images/icon-horizontal-size@2x.js +3 -0
  132. package/dist/ui/icons/images/icon-layers@2x.js +3 -0
  133. package/dist/ui/icons/images/icon-linked@2x.js +3 -0
  134. package/dist/ui/icons/images/icon-locked@2x.js +3 -0
  135. package/dist/ui/icons/images/icon-moon@2x.js +3 -0
  136. package/dist/ui/icons/images/icon-pan@2x.js +3 -0
  137. package/dist/ui/icons/images/icon-polygon-mask@2x.js +3 -0
  138. package/dist/ui/icons/images/icon-pressure@2x.js +3 -0
  139. package/dist/ui/icons/images/icon-randomise@2x.js +3 -0
  140. package/dist/ui/icons/images/icon-rectangle-mask@2x.js +3 -0
  141. package/dist/ui/icons/images/icon-redo@2x.js +3 -0
  142. package/dist/ui/icons/images/icon-rotate-90-left@2x.js +3 -0
  143. package/dist/ui/icons/images/icon-rotate-90-right@2x.js +3 -0
  144. package/dist/ui/icons/images/icon-rotate@2x.js +3 -0
  145. package/dist/ui/icons/images/icon-smoothing-bezier-cubic@2x.js +3 -0
  146. package/dist/ui/icons/images/icon-smoothing-bezier-quad@2x.js +3 -0
  147. package/dist/ui/icons/images/icon-smoothing-linear@2x.js +3 -0
  148. package/dist/ui/icons/images/icon-star@2x.js +3 -0
  149. package/dist/ui/icons/images/icon-sun@2x.js +3 -0
  150. package/dist/ui/icons/images/icon-tilt@2x.js +3 -0
  151. package/dist/ui/icons/images/icon-undo@2x.js +3 -0
  152. package/dist/ui/icons/images/icon-unlinked@2x.js +3 -0
  153. package/dist/ui/icons/images/icon-unlocked@2x.js +3 -0
  154. package/dist/ui/icons/images/icon-vertical-size@2x.js +3 -0
  155. package/dist/ui/icons/images/icon-visible@2x.js +3 -0
  156. package/dist/ui/icons/images/icon-zoom-in@2x.js +3 -0
  157. package/dist/ui/icons/images/icon-zoom-out@2x.js +3 -0
  158. package/dist/ui/icons/images/icon-zoom@2x.js +3 -0
  159. package/dist/ui/icons/index.d.ts +1 -1
  160. package/dist/ui/icons/index.js +84 -72
  161. package/dist/ui/index.d.ts +13 -2
  162. package/dist/ui/index.js +16 -4
  163. package/dist/ui/layout/index.d.ts +9 -1
  164. package/dist/ui/layout/index.js +11 -2
  165. package/dist/ui/tokens/index.d.ts +5 -4
  166. package/dist/ui/tokens/index.js +15 -8
  167. package/locales/en-GB.json +96 -3
  168. package/locales/en-US.json +96 -3
  169. package/locales/fr.json +96 -3
  170. package/locales/ja.json +96 -3
  171. package/locales/ko.json +96 -3
  172. package/locales/zh-Hans.json +96 -3
  173. package/locales/zh-Hant.json +96 -3
  174. package/package.json +11 -4
  175. package/dist/ui/elements/PcBrushMenu/style.js +0 -3
  176. package/dist/ui/elements/PcLayersMenu/style.js +0 -3
  177. package/dist/ui/icons/images/brush.js +0 -3
  178. package/dist/ui/icons/images/circle-mask.js +0 -3
  179. package/dist/ui/icons/images/clipboard.js +0 -3
  180. package/dist/ui/icons/images/cursor.js +0 -3
  181. package/dist/ui/icons/images/eraser.js +0 -3
  182. package/dist/ui/icons/images/eyedropper.js +0 -3
  183. package/dist/ui/icons/images/flip-horizontal.js +0 -3
  184. package/dist/ui/icons/images/flip-vertical.js +0 -3
  185. package/dist/ui/icons/images/focus-pen.js +0 -3
  186. package/dist/ui/icons/images/freehand-mask.js +0 -3
  187. package/dist/ui/icons/images/hidden.js +0 -3
  188. package/dist/ui/icons/images/layers.js +0 -3
  189. package/dist/ui/icons/images/linked.js +0 -3
  190. package/dist/ui/icons/images/locked.js +0 -3
  191. package/dist/ui/icons/images/moon.js +0 -3
  192. package/dist/ui/icons/images/pan.js +0 -3
  193. package/dist/ui/icons/images/polygon-mask.js +0 -3
  194. package/dist/ui/icons/images/pressure.js +0 -3
  195. package/dist/ui/icons/images/randomise.js +0 -3
  196. package/dist/ui/icons/images/rectangle-mask.js +0 -3
  197. package/dist/ui/icons/images/redo.js +0 -3
  198. package/dist/ui/icons/images/rotate-90-left.js +0 -3
  199. package/dist/ui/icons/images/rotate-90-right.js +0 -3
  200. package/dist/ui/icons/images/smoothing-bezier-cubic.js +0 -3
  201. package/dist/ui/icons/images/smoothing-bezier-quad.js +0 -3
  202. package/dist/ui/icons/images/smoothing-linear.js +0 -3
  203. package/dist/ui/icons/images/star.js +0 -3
  204. package/dist/ui/icons/images/sun.js +0 -3
  205. package/dist/ui/icons/images/tilt.js +0 -3
  206. package/dist/ui/icons/images/undo.js +0 -3
  207. package/dist/ui/icons/images/unlinked.js +0 -3
  208. package/dist/ui/icons/images/unlocked.js +0 -3
  209. package/dist/ui/icons/images/visible.js +0 -3
  210. package/dist/ui/icons/images/zoom-in.js +0 -3
  211. package/dist/ui/icons/images/zoom-out.js +0 -3
  212. package/dist/ui/icons/images/zoom.js +0 -3
@@ -0,0 +1,81 @@
1
+ // src/ui/drag/index.ts
2
+ /** How far (in pixels) a press must move before it counts as a drag, where a press can also be a tap */
3
+ var DRAG_THRESHOLD = 4;
4
+ /**
5
+ * How much a pointer moved between two points as one value: right and up are positive, left and down negative.
6
+ *
7
+ * @example
8
+ * dragDelta({ x: 0, y: 0 }, { x: 5, y: -5 }); // 10
9
+ */
10
+ var dragDelta = (from, to) => to.x - from.x + (from.y - to.y);
11
+ /**
12
+ * Turns pressing and dragging on an element into changes of a value: dragging right or up gives positive deltas, left
13
+ * or down negative ones (see `dragDelta`), in whole pixels (keeping any fraction for the next move). With a `threshold`, the press only becomes a drag once the pointer has moved
14
+ * that far from where it was pressed, so a press that barely moves can still be a tap (e.g. to focus a field).
15
+ *
16
+ * The element is given the pointer while dragging, so the drag carries on outside it.
17
+ *
18
+ * @example
19
+ * const drag = new PointerDrag((delta) => brush.resize(delta));
20
+ * html`<div @pointerdown=${drag.start} @pointermove=${drag.move} @pointerup=${drag.end} @pointercancel=${drag.end}></div>`
21
+ */
22
+ var PointerDrag = class {
23
+ onDelta;
24
+ threshold;
25
+ /** Where the press started */
26
+ origin = null;
27
+ /** The last position a delta was given from, once dragging */
28
+ last = null;
29
+ /** Movement not yet given, under a whole pixel (pens can move by fractions of a pixel) */
30
+ remainder = 0;
31
+ constructor(onDelta, threshold = 0) {
32
+ this.onDelta = onDelta;
33
+ this.threshold = threshold;
34
+ }
35
+ /** Whether the press has become a drag */
36
+ get dragging() {
37
+ return this.last !== null;
38
+ }
39
+ /**
40
+ * Start a press (on `pointerdown`).
41
+ */
42
+ start = (event) => {
43
+ this.origin = {
44
+ x: event.clientX,
45
+ y: event.clientY
46
+ };
47
+ this.last = this.threshold > 0 ? null : this.origin;
48
+ this.remainder = 0;
49
+ event.currentTarget.setPointerCapture?.(event.pointerId);
50
+ };
51
+ /**
52
+ * Give the change since the last move, once the press has become a drag (on `pointermove`).
53
+ */
54
+ move = (event) => {
55
+ if (!this.origin) return;
56
+ const point = {
57
+ x: event.clientX,
58
+ y: event.clientY
59
+ };
60
+ if (!this.last) {
61
+ if (Math.hypot(point.x - this.origin.x, point.y - this.origin.y) < this.threshold) return;
62
+ this.last = this.origin;
63
+ event.preventDefault();
64
+ }
65
+ const total = this.remainder + dragDelta(this.last, point);
66
+ const delta = Math.trunc(total);
67
+ this.remainder = total - delta;
68
+ this.last = point;
69
+ if (delta !== 0) this.onDelta(delta);
70
+ };
71
+ /**
72
+ * End the press (on `pointerup` or `pointercancel`). Returns whether it was a drag.
73
+ */
74
+ end = () => {
75
+ const dragged = this.dragging;
76
+ this.origin = null;
77
+ this.last = null;
78
+ return dragged;
79
+ };
80
+ };
81
+ export { DRAG_THRESHOLD, PointerDrag, dragDelta };
@@ -1,42 +1,45 @@
1
1
  import { PcElement } from "../../base";
2
2
  import PaintCanvas from "../../../lib/classes/PaintCanvas";
3
+ import SettingsAutosave from "../../../lib/classes/SettingsAutosave";
3
4
  import type { BrushConfig } from "../../../lib/brushes/types";
4
5
  import { type SaveMethod } from "../../../lib/rendering/screenshot";
5
6
  import { type InputKind, type LayoutState } from "../../layout";
6
- import type { PcPanel } from "../PcPanel";
7
7
  import "../PcPanel";
8
- import "../PcToolbar";
9
8
  import "../PcToolSettings";
9
+ import "../PcClipboardTools";
10
10
  import "../PcCanvas";
11
11
  import "../PcCanvasMap";
12
- import "../PcBrushMenu";
13
- import "../PcLayersMenu";
12
+ import "../PcPanelBrushes";
13
+ import "../PcPanelLayers";
14
14
  import "../PcBrushConfig";
15
15
  import "../PcStats";
16
+ import "../PcPanelColours";
16
17
  import "../PcDialog";
17
- /** A side of the layout */
18
- type Side = "left" | "right";
19
18
  /**
20
19
  * A ready-made painting app: the drawing elements arranged around the canvas, sized to its container (not the
21
20
  * window), with slots to add or replace content:
22
21
  *
23
22
  * - `header`: across the top (empty by default)
24
- * - `left`: `<pc-toolbar>` by default
25
- * - `top`: `<pc-tool-settings>` (for tools that have settings) by default
26
- * - `right`: empty by default (e.g. a `<pc-panel>` with a layers menu or chat)
23
+ * - `left`: `<pc-toolbar>` (a pane) by default; toolbars in the sides are minimised (their tools one button that opens a
24
+ * menu of them) while the layout is narrow
25
+ * - `top`: a horizontal `<pc-pane>` with `<pc-tool-settings>` (for tools that have settings) and, at its end,
26
+ * `<pc-clipboard-tools>` (cut, copy and paste; a ⋮ menu while the layout is narrow) by default
27
+ * - `right`: a `<pc-pane>` with `<pc-panel-layers>` by default
27
28
  * - `center`: `<pc-canvas>` by default
28
29
  * - `overlay`: drawn over the canvas; `<pc-canvas-map>` by default
29
30
  * - `bottom`: under the canvas (empty by default)
30
31
  * - `footer`: across the bottom; `<pc-stats>` by default
31
- * - `menu`: the app menu the toolbar's menu button opens (the button shows only with a menu)
32
+ * - `menu`: the app menu the toolbar's menu button opens, shown in a `<pc-panel>` (the button shows only with a menu)
32
33
  *
33
34
  * Content given for a slot replaces its default; an empty element clears it. Empty slots take no space. Hiding the
34
- * interface (Tab key) leaves only the canvas and overlay. A `<pc-layers-menu>` given in a side (e.g. in a `<pc-panel>`)
35
- * replaces the toolbar's layers menu button.
35
+ * interface (Tab key) leaves only the canvas and overlay. While a side has a `<pc-panel-layers>` (as the right side
36
+ * does by default), the toolbar has no layers menu button.
36
37
  *
37
38
  * Each side has a mode, chosen by the layout's width from `left-modes` and `right-modes` (default `"docked,
38
- * rail@600"`): `docked` beside the canvas; `rail`, a column of buttons (one per `<pc-panel>`) that open each panel over
39
- * the canvas; or `floating`, the side over the canvas as a palette that collapses to a button.
39
+ * rail@600"`), which the layout gives the side's `<pc-pane>`s (see `PcPane`): `docked` beside the canvas; `rail`, a
40
+ * column of buttons (one per panel) that open each panel over the canvas; `floating`, the pane over the canvas as a
41
+ * box that collapses to a button; or `overlay`, a rail over the canvas without a background (the canvas fills the
42
+ * width behind it). Give side content in a `<pc-pane>` to have it follow the side's mode.
40
43
  *
41
44
  * Reports its state for styling as attributes (`narrow`, `input="pen|touch|mouse"`, `ui-hidden`, `left-mode`,
42
45
  * `right-mode`) and as `pc-state-change` events (see `LayoutState`). Creates its own canvas unless given one, and
@@ -46,10 +49,16 @@ type Side = "left" | "right";
46
49
  * reloading the page (see `LayerAutosave`). While another window is drawing on it, the layout is blocked by a message
47
50
  * that offers to draw here instead. Fires `pc-toast` when the drawing can't be loaded or saved.
48
51
  *
52
+ * With a `settings-store` name, the user's app settings (input settings, keyboard shortcuts, colour palette, colours,
53
+ * theme and language) are kept in the browser under that name (see `SettingsAutosave`). Fires `pc-toast` when they can't be.
54
+ *
49
55
  * @example
50
56
  * html`<paint-canvas style="height: 600px"></paint-canvas>`
51
57
  * html`<paint-canvas .app=${canvas} right-modes="docked, rail@800">
52
- * <pc-panel slot="right" icon="layers" label="Layers"><pc-layers-menu .app=${canvas}></pc-layers-menu></pc-panel>
58
+ * <pc-pane slot="right">
59
+ * <pc-panel-layers .app=${canvas}></pc-panel-layers>
60
+ * <pc-panel icon="chat" label="Chat"><my-chat></my-chat></pc-panel>
61
+ * </pc-pane>
53
62
  * </paint-canvas>`
54
63
  */
55
64
  export declare class PaintCanvasElement extends PcElement {
@@ -83,6 +92,10 @@ export declare class PaintCanvasElement extends PcElement {
83
92
  store: {
84
93
  type: StringConstructor;
85
94
  };
95
+ settingsStore: {
96
+ type: StringConstructor;
97
+ attribute: string;
98
+ };
86
99
  width: {
87
100
  state: boolean;
88
101
  };
@@ -92,12 +105,6 @@ export declare class PaintCanvasElement extends PcElement {
92
105
  configuring: {
93
106
  state: boolean;
94
107
  };
95
- collapsed: {
96
- state: boolean;
97
- };
98
- openPanel: {
99
- state: boolean;
100
- };
101
108
  translations: {
102
109
  attribute: boolean;
103
110
  };
@@ -126,6 +133,8 @@ export declare class PaintCanvasElement extends PcElement {
126
133
  shortcuts: boolean;
127
134
  /** Name to keep the user's layers under in the browser, so the drawing survives reloading the page (none by default) */
128
135
  store?: string;
136
+ /** Name to keep the user's app settings under in the browser (none by default) */
137
+ settingsStore?: string;
129
138
  /** The layout's width in CSS pixels */
130
139
  width: number;
131
140
  /** The input being used now */
@@ -136,10 +145,6 @@ export declare class PaintCanvasElement extends PcElement {
136
145
  config: BrushConfig;
137
146
  editingId?: string;
138
147
  };
139
- /** Which floating sides are collapsed to a button */
140
- collapsed: Record<Side, boolean>;
141
- /** The panel open from a rail, if any */
142
- openPanel?: PcPanel;
143
148
  /** Saves files (replaceable for tests) */
144
149
  saveFile: (blob: Blob, name: string) => Promise<SaveMethod | undefined>;
145
150
  private changes;
@@ -147,10 +152,10 @@ export declare class PaintCanvasElement extends PcElement {
147
152
  private ownAutosave?;
148
153
  /** The autosave whose errors are shown */
149
154
  private watchedAutosave?;
155
+ /** Keeps the app settings under the `settings-store` name, if any */
156
+ private ownSettingsAutosave?;
150
157
  /** Whether drawing was blocked when shortcuts were last watched */
151
158
  private blockedShortcuts;
152
- /** The panels in each side's slot */
153
- private panels;
154
159
  /** Whether each side's slot has a layers menu (the toolbar's isn't needed then) */
155
160
  private sideLayers;
156
161
  /** Whether the implementer gave a menu */
@@ -161,17 +166,15 @@ export declare class PaintCanvasElement extends PcElement {
161
166
  private keys?;
162
167
  /** The state last reported, to report only changes */
163
168
  private reported?;
164
- /** Space the floating sides cover over the canvas */
169
+ /** Space the floating and overlay sides cover over the canvas */
165
170
  private floatingInsets;
166
- /** The rail button that opened the open panel, to return focus to */
167
- private opener?;
168
171
  private readonly resizeObserver?;
169
- private readonly panelObserver;
170
172
  private readonly onPointerDown;
171
173
  private readonly onAutosaveError;
174
+ private readonly onSettingsAutosaveError;
172
175
  private readonly onShortcut;
173
176
  private readonly onDocumentPointerDown;
174
- private readonly onKeyDown;
177
+ private readonly onPaneCollapse;
175
178
  constructor();
176
179
  /** Whether another window is drawing on the stored drawing, so this one is blocked */
177
180
  get blocked(): boolean;
@@ -183,13 +186,24 @@ export declare class PaintCanvasElement extends PcElement {
183
186
  disconnectedCallback(): void;
184
187
  protected willUpdate(changed: Map<PropertyKey, unknown>): void;
185
188
  protected updated(): void;
186
- /** Keep the canvas clear of floating sides when fitting it */
189
+ /** The panes in a side: the default one, or those given for it */
190
+ private panesIn;
191
+ /** Show each side's panes in the side's mode, facing the canvas, with toolbars minimised while the layout is narrow */
192
+ private setPaneModes;
193
+ /** Keep the canvas clear of floating and overlay sides when fitting it */
187
194
  private measureFloatingSides;
188
195
  /**
189
196
  * Keep the canvas's layers under the `store` name, replacing an autosave the layout started earlier (also on the
190
197
  * previous canvas). An autosave the implementer started is left alone when there's no name.
191
198
  */
192
199
  private useStore;
200
+ /** Keeps the app settings under the `settings-store` name, if any (e.g. to wait until they are restored with `ready`) */
201
+ get settingsAutosave(): SettingsAutosave | undefined;
202
+ /**
203
+ * Keep the canvas's app settings under the `settings-store` name, stopping the previous settings autosave (which
204
+ * saves any change waiting to be saved).
205
+ */
206
+ private useSettingsStore;
193
207
  /** Show errors from the canvas's current autosave */
194
208
  private watchAutosaveErrors;
195
209
  /** Handle keyboard shortcuts for the current canvas, if asked to (not while blocked) */
@@ -212,32 +226,26 @@ export declare class PaintCanvasElement extends PcElement {
212
226
  * Open the configuration window to make a new preset, starting from the current brush or eraser settings.
213
227
  */
214
228
  newPreset(kind: "brush" | "eraser"): void;
215
- /** Which side a panel is in */
216
- private sideOf;
217
- /**
218
- * Open a panel from its rail button (closing any other), or close it if it's open. Focus moves into the panel.
219
- */
220
- togglePanel(panel: PcPanel, opener?: HTMLElement): void;
221
- /**
222
- * Close the panel open from a rail, moving focus back to its rail button if asked.
223
- */
224
- closePanel(returnFocus: boolean): void;
225
229
  /** Follow which slots have content given (their defaults aren't needed) */
226
230
  private onSlotChange;
227
231
  /** A slot, with its default content unless content was given for it */
228
232
  private slotWithDefault;
229
- /** Follow the panels given for a side, and whether it has a layers menu */
233
+ /** Follow whether a side given content has a layers menu */
230
234
  private onSideSlotChange;
231
235
  /** Follow whether a menu was given */
232
236
  private onMenuSlotChange;
233
237
  /** Whether a side has a layers menu, replacing the toolbar's */
234
238
  private get layersInSide();
235
- /** The toolbar shown on the left unless the implementer gives other content */
236
- private renderToolbar;
237
- /** A side's rail buttons, one per panel */
238
- private renderRail;
239
- /** A side, in its mode */
239
+ /** A side's default content: the toolbar on the left, and the layers on the right */
240
+ private renderSideDefault;
241
+ /** A side: its panes, in its mode (set on them after rendering) */
240
242
  private renderSide;
243
+ /**
244
+ * Close the open panel (brush, eraser, layers, app menu or colour palette) on a press outside it and the button that
245
+ * opens it, marking the press (see `markDismissingPress`) so the canvas doesn't draw unless it's dragged. Presses in
246
+ * dialogs (e.g. one the panel opened) don't count as outside.
247
+ */
248
+ private closePanelOutside;
241
249
  /** The menus the toolbar opens, floating over the canvas beside it */
242
250
  private renderPanels;
243
251
  /** The brush configuration window, while open */
@@ -246,4 +254,3 @@ export declare class PaintCanvasElement extends PcElement {
246
254
  private renderBlocked;
247
255
  render(): import("lit").TemplateResult<1>;
248
256
  }
249
- export {};