@widgetic/canvas 0.5.35 → 0.5.36

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 (210) hide show
  1. package/README.md +105 -36
  2. package/dist/canvas/DomCanvas.svelte +454 -0
  3. package/dist/canvas/DomCanvas.svelte.d.ts +222 -0
  4. package/dist/canvas/boardFrame.d.ts +13 -0
  5. package/dist/canvas/boardFrame.js +13 -0
  6. package/dist/canvas/boardSurface.d.ts +9 -0
  7. package/dist/canvas/boardSurface.js +9 -0
  8. package/dist/canvas/chromeLayout.d.ts +76 -0
  9. package/dist/canvas/chromeLayout.js +121 -0
  10. package/dist/canvas/emptyBoardHint.d.ts +17 -0
  11. package/dist/canvas/emptyBoardHint.js +12 -0
  12. package/dist/canvas/eventScope.d.ts +1 -1
  13. package/dist/canvas/eventScope.js +1 -1
  14. package/dist/canvas/host/CanvasHost.d.ts +351 -0
  15. package/dist/canvas/host/CanvasHost.js +1740 -0
  16. package/dist/canvas/host/CanvasHostApi.d.ts +30 -0
  17. package/dist/canvas/host/CanvasHostApi.js +95 -0
  18. package/dist/canvas/host/browserServices.d.ts +46 -0
  19. package/dist/canvas/host/browserServices.js +167 -0
  20. package/dist/canvas/host/conversion.d.ts +51 -0
  21. package/dist/canvas/host/conversion.js +123 -0
  22. package/dist/canvas/host/hostObject.d.ts +40 -0
  23. package/dist/canvas/host/hostObject.js +93 -0
  24. package/dist/canvas/host/pageEvents.d.ts +24 -0
  25. package/dist/canvas/host/pageEvents.js +35 -0
  26. package/dist/canvas/host/screenRects.d.ts +66 -0
  27. package/dist/canvas/host/screenRects.js +102 -0
  28. package/dist/canvas/host/strokeSnap.d.ts +67 -0
  29. package/dist/canvas/host/strokeSnap.js +165 -0
  30. package/dist/canvas/index.d.ts +7 -7
  31. package/dist/canvas/index.js +8 -8
  32. package/dist/canvas/openMarks.d.ts +17 -0
  33. package/dist/canvas/openMarks.js +26 -0
  34. package/dist/canvas/panZoomPosition.d.ts +15 -0
  35. package/dist/canvas/panZoomPosition.js +16 -0
  36. package/dist/canvas/preferredTextFont.d.ts +12 -0
  37. package/dist/canvas/preferredTextFont.js +38 -0
  38. package/dist/canvas/shapes/ShapeLibrary.d.ts +1 -1
  39. package/dist/canvas/shapes/ShapeLibrary.js +13 -1
  40. package/dist/canvas/shapes/strokeShapeSnap.d.ts +14 -12
  41. package/dist/canvas/shapes/strokeShapeSnap.js +10 -8
  42. package/dist/canvas/toolbarPosition.d.ts +11 -11
  43. package/dist/canvas/toolbarPosition.js +11 -24
  44. package/dist/canvas/types.d.ts +14 -0
  45. package/dist/canvas/ui/CanvasContextMenu.svelte +173 -0
  46. package/dist/canvas/ui/CanvasContextMenu.svelte.d.ts +12 -0
  47. package/dist/canvas/ui/CanvasHint.svelte +20 -0
  48. package/dist/canvas/ui/CanvasHint.svelte.d.ts +18 -0
  49. package/dist/canvas/ui/CanvasToolbar.svelte +95 -0
  50. package/dist/canvas/ui/CanvasToolbar.svelte.d.ts +14 -0
  51. package/dist/canvas/ui/ColorField.svelte +155 -0
  52. package/dist/canvas/ui/ColorField.svelte.d.ts +14 -0
  53. package/dist/canvas/ui/LoadNotice.svelte +39 -0
  54. package/dist/canvas/ui/LoadNotice.svelte.d.ts +8 -0
  55. package/dist/canvas/ui/SelectionPanel.svelte +300 -0
  56. package/dist/canvas/ui/SelectionPanel.svelte.d.ts +20 -0
  57. package/dist/canvas/ui/SelectorBar.svelte +82 -0
  58. package/dist/canvas/ui/SelectorBar.svelte.d.ts +12 -0
  59. package/dist/canvas/ui/ShapesMenu.svelte +185 -0
  60. package/dist/canvas/ui/ShapesMenu.svelte.d.ts +15 -0
  61. package/dist/canvas/ui/ShortcutsPanel.svelte +124 -0
  62. package/dist/canvas/ui/ShortcutsPanel.svelte.d.ts +7 -0
  63. package/dist/canvas/ui/ToolButton.svelte +78 -0
  64. package/dist/canvas/ui/ToolButton.svelte.d.ts +20 -0
  65. package/dist/canvas/ui/WidgetActions.svelte +152 -0
  66. package/dist/canvas/ui/WidgetActions.svelte.d.ts +19 -0
  67. package/dist/canvas/ui/ZoomControl.svelte +89 -0
  68. package/dist/canvas/ui/ZoomControl.svelte.d.ts +18 -0
  69. package/dist/canvas/ui/colorModel.d.ts +18 -0
  70. package/dist/canvas/ui/colorModel.js +85 -0
  71. package/dist/canvas/ui/colorPickerMessages.d.ts +5 -0
  72. package/dist/canvas/ui/colorPickerMessages.js +15 -0
  73. package/dist/canvas/ui/floatingCard.d.ts +107 -0
  74. package/dist/canvas/ui/floatingCard.js +107 -0
  75. package/dist/canvas/ui/floatingLayer.d.ts +21 -0
  76. package/dist/canvas/ui/floatingLayer.js +52 -0
  77. package/dist/canvas/ui/icons.d.ts +12 -0
  78. package/dist/canvas/ui/icons.js +7 -0
  79. package/dist/canvas/ui/keyHints.d.ts +27 -0
  80. package/dist/canvas/ui/keyHints.js +43 -0
  81. package/dist/canvas/ui/popoverSide.d.ts +5 -0
  82. package/dist/canvas/ui/popoverSide.js +20 -0
  83. package/dist/canvas/ui/selectionTraits.d.ts +61 -0
  84. package/dist/canvas/ui/selectionTraits.js +99 -0
  85. package/dist/canvas/view/CanvasStage.svelte +132 -0
  86. package/dist/canvas/view/CanvasStage.svelte.d.ts +21 -0
  87. package/dist/canvas/view/EraserTrail.svelte +50 -0
  88. package/dist/canvas/view/EraserTrail.svelte.d.ts +9 -0
  89. package/dist/canvas/view/ObjectView.svelte +245 -0
  90. package/dist/canvas/view/ObjectView.svelte.d.ts +21 -0
  91. package/dist/canvas/view/SelectionOverlay.svelte +487 -0
  92. package/dist/canvas/view/SelectionOverlay.svelte.d.ts +17 -0
  93. package/dist/canvas/view/TextEditor.svelte +76 -0
  94. package/dist/canvas/view/TextEditor.svelte.d.ts +9 -0
  95. package/dist/canvas/view/WidgetChromeLayer.svelte +83 -0
  96. package/dist/canvas/view/WidgetChromeLayer.svelte.d.ts +13 -0
  97. package/dist/canvas/view/erasingMarks.d.ts +13 -0
  98. package/dist/canvas/view/erasingMarks.js +34 -0
  99. package/dist/canvas/view/geometry.d.ts +169 -0
  100. package/dist/canvas/view/geometry.js +272 -0
  101. package/dist/components/CanvasBoardPlaceholder.svelte +5 -3
  102. package/dist/components/CanvasBoardPlaceholder.svelte.d.ts +3 -3
  103. package/dist/components/index.js +1 -1
  104. package/dist/components/input-controls/ColorIC.svelte +2 -2
  105. package/dist/engine/EngineCore.d.ts +273 -0
  106. package/dist/engine/EngineCore.js +1051 -0
  107. package/dist/engine/codec/canvasDocument.d.ts +57 -0
  108. package/dist/engine/codec/canvasDocument.js +471 -0
  109. package/dist/engine/codec/hostReadableKeys.d.ts +25 -0
  110. package/dist/engine/codec/hostReadableKeys.js +25 -0
  111. package/dist/engine/core/arrange.d.ts +20 -0
  112. package/dist/engine/core/arrange.js +81 -0
  113. package/dist/engine/core/arrow.d.ts +91 -0
  114. package/dist/engine/core/arrow.js +182 -0
  115. package/dist/engine/core/brush.d.ts +68 -0
  116. package/dist/engine/core/brush.js +173 -0
  117. package/dist/engine/core/defaults.d.ts +70 -0
  118. package/dist/engine/core/defaults.js +158 -0
  119. package/dist/engine/core/freehand.d.ts +130 -0
  120. package/dist/engine/core/freehand.js +430 -0
  121. package/dist/engine/core/geometry.d.ts +44 -0
  122. package/dist/engine/core/geometry.js +216 -0
  123. package/dist/engine/core/history.d.ts +39 -0
  124. package/dist/engine/core/history.js +69 -0
  125. package/dist/engine/core/hitTest.d.ts +54 -0
  126. package/dist/engine/core/hitTest.js +298 -0
  127. package/dist/engine/core/matrix.d.ts +47 -0
  128. package/dist/engine/core/matrix.js +101 -0
  129. package/dist/engine/core/pathData.d.ts +50 -0
  130. package/dist/engine/core/pathData.js +550 -0
  131. package/dist/engine/core/rotationReset.d.ts +10 -0
  132. package/dist/engine/core/rotationReset.js +17 -0
  133. package/dist/engine/core/scene.d.ts +99 -0
  134. package/dist/engine/core/scene.js +450 -0
  135. package/dist/engine/core/scribble.d.ts +64 -0
  136. package/dist/engine/core/scribble.js +121 -0
  137. package/dist/engine/core/shapePaths.d.ts +34 -0
  138. package/dist/engine/core/shapePaths.js +69 -0
  139. package/dist/engine/core/shapeTools.d.ts +80 -0
  140. package/dist/engine/core/shapeTools.js +161 -0
  141. package/dist/engine/core/snapping.d.ts +64 -0
  142. package/dist/engine/core/snapping.js +164 -0
  143. package/dist/engine/core/style.d.ts +40 -0
  144. package/dist/engine/core/style.js +151 -0
  145. package/dist/engine/core/transform.d.ts +79 -0
  146. package/dist/engine/core/transform.js +258 -0
  147. package/dist/engine/core/types.d.ts +238 -0
  148. package/dist/engine/core/types.js +31 -0
  149. package/dist/engine/core/viewport.d.ts +32 -0
  150. package/dist/engine/core/viewport.js +84 -0
  151. package/dist/engine/input/PointerController.d.ts +38 -0
  152. package/dist/engine/input/PointerController.js +545 -0
  153. package/dist/engine/input/arrowHandles.d.ts +38 -0
  154. package/dist/engine/input/arrowHandles.js +60 -0
  155. package/dist/engine/input/gestures.d.ts +79 -0
  156. package/dist/engine/input/gestures.js +769 -0
  157. package/dist/engine/input/hoverCursor.d.ts +29 -0
  158. package/dist/engine/input/hoverCursor.js +23 -0
  159. package/dist/engine/input/keyboard.d.ts +75 -0
  160. package/dist/engine/input/keyboard.js +264 -0
  161. package/dist/engine/input/selectionHandles.d.ts +89 -0
  162. package/dist/engine/input/selectionHandles.js +169 -0
  163. package/dist/engine/input/types.d.ts +82 -0
  164. package/dist/engine/input/types.js +5 -0
  165. package/dist/engine/render/rasterize.d.ts +74 -0
  166. package/dist/engine/render/rasterize.js +273 -0
  167. package/dist/engine/state.d.ts +124 -0
  168. package/dist/engine/state.js +47 -0
  169. package/dist/engine/text/layoutText.d.ts +53 -0
  170. package/dist/engine/text/layoutText.js +170 -0
  171. package/dist/engine/widgets.d.ts +124 -0
  172. package/dist/engine/widgets.js +345 -0
  173. package/dist/i18n/labels.d.ts +4 -15
  174. package/dist/i18n/labels.js +33 -53
  175. package/dist/i18n/language.d.ts +3 -3
  176. package/dist/i18n/messages.d.ts +51 -122
  177. package/dist/i18n/messages.js +58 -131
  178. package/dist/i18n/shortcuts.d.ts +0 -1
  179. package/dist/i18n/shortcuts.js +2 -11
  180. package/dist/index.d.ts +4 -2
  181. package/dist/index.js +5 -3
  182. package/package.json +30 -5
  183. package/dist/canvas/Canvas.svelte +0 -13363
  184. package/dist/canvas/Canvas.svelte.d.ts +0 -286
  185. package/dist/canvas/CanvasToolbar.svelte +0 -1498
  186. package/dist/canvas/CanvasToolbar.svelte.d.ts +0 -69
  187. package/dist/canvas/ContextMenu.svelte +0 -305
  188. package/dist/canvas/ContextMenu.svelte.d.ts +0 -42
  189. package/dist/canvas/PanZoomPanel.svelte +0 -478
  190. package/dist/canvas/PanZoomPanel.svelte.d.ts +0 -38
  191. package/dist/canvas/WidgetSelectionLayer.svelte +0 -156
  192. package/dist/canvas/WidgetSelectionLayer.svelte.d.ts +0 -11
  193. package/dist/canvas/props-panel/PropsPanel.svelte +0 -2075
  194. package/dist/canvas/props-panel/PropsPanel.svelte.d.ts +0 -84
  195. package/dist/canvas/props-panel/TextPropsICSection.svelte +0 -242
  196. package/dist/canvas/props-panel/TextPropsICSection.svelte.d.ts +0 -40
  197. package/dist/canvas/shadowRootText.d.ts +0 -5
  198. package/dist/canvas/shadowRootText.js +0 -43
  199. package/dist/canvas/shapes/FrameShape.d.ts +0 -97
  200. package/dist/canvas/shapes/FrameShape.js +0 -953
  201. package/dist/canvas/shapes/ImageShape.d.ts +0 -47
  202. package/dist/canvas/shapes/ImageShape.js +0 -339
  203. package/dist/canvas/shapes/WidgetShape.d.ts +0 -30
  204. package/dist/canvas/shapes/WidgetShape.js +0 -200
  205. package/dist/canvas/widgetPreviewGeometry.d.ts +0 -19
  206. package/dist/canvas/widgetPreviewGeometry.js +0 -66
  207. package/dist/i18n/shapeWords.d.ts +0 -30
  208. package/dist/i18n/shapeWords.js +0 -36
  209. package/dist/i18n/slots.d.ts +0 -20
  210. package/dist/i18n/slots.js +0 -40
@@ -1,66 +0,0 @@
1
- /**
2
- * Local widget pixels -> CSS viewport pixels (no selection padding/stroke).
3
- * Fabric matrices include rotation, skew, flips and owning groups. CSS starts
4
- * at the top-left, while Fabric transforms around the object's center.
5
- */
6
- /**
7
- * @param {import('fabric').FabricObject} object
8
- * @param {import('fabric').Canvas} canvas
9
- * @param {HTMLCanvasElement} canvasElement
10
- */
11
- export function getWidgetPreviewGeometry(object, canvas, canvasElement) {
12
- if (!canvas || !canvasElement || !object) return null;
13
- const bounds = canvasElement.getBoundingClientRect();
14
- const canvasWidth = canvas.getWidth() || bounds.width || 1;
15
- const canvasHeight = canvas.getHeight() || bounds.height || 1;
16
- const cssScaleX = bounds.width / canvasWidth;
17
- const cssScaleY = bounds.height / canvasHeight;
18
- const viewport = canvas.viewportTransform || [1, 0, 0, 1, 0, 0];
19
- // calcACoords() is relative to the parent. Inside a multi-selection that
20
- // parent is the selection, so those corners are not where the shape is
21
- // painted. calcTransformMatrix() includes the selection.
22
- const sceneMatrix = typeof object.calcTransformMatrix === 'function'
23
- ? object.calcTransformMatrix()
24
- : null;
25
- if (!sceneMatrix) return null;
26
- // Local half-size only. calcTransformMatrix already applies scaleX/scaleY,
27
- // so feeding it the scaled size makes the iframe lag the selection stroke
28
- // and finish smaller or larger than the shape.
29
- const halfWidth = (object.width || 1) / 2;
30
- const halfHeight = (object.height || 1) / 2;
31
- /** @param {number} x @param {number} y */
32
- const scenePoint = (x, y) => ({
33
- x: sceneMatrix[0] * x + sceneMatrix[2] * y + sceneMatrix[4],
34
- y: sceneMatrix[1] * x + sceneMatrix[3] * y + sceneMatrix[5],
35
- });
36
- /** @param {{x: number, y: number}} point */
37
- const project = (point) => ({
38
- x: bounds.left + (viewport[0] * point.x + viewport[2] * point.y + viewport[4]) * cssScaleX,
39
- y: bounds.top + (viewport[1] * point.x + viewport[3] * point.y + viewport[5]) * cssScaleY,
40
- });
41
- const tl = project(scenePoint(-halfWidth, -halfHeight));
42
- const tr = project(scenePoint(halfWidth, -halfHeight));
43
- const bl = project(scenePoint(-halfWidth, halfHeight));
44
- const br = project(scenePoint(halfWidth, halfHeight));
45
- const xs = [tl.x, tr.x, bl.x, br.x];
46
- const ys = [tl.y, tr.y, bl.y, br.y];
47
- const left = Math.min(...xs);
48
- const top = Math.min(...ys);
49
- const localWidth = object.width || 1;
50
- const localHeight = object.height || 1;
51
- const matrix = [
52
- (tr.x - tl.x) / localWidth,
53
- (tr.y - tl.y) / localWidth,
54
- (bl.x - tl.x) / localHeight,
55
- (bl.y - tl.y) / localHeight,
56
- tl.x,
57
- tl.y,
58
- ];
59
- if (!matrix.every(Number.isFinite)) return null;
60
- return {
61
- left, top,
62
- width: Math.max(...xs) - left,
63
- height: Math.max(...ys) - top,
64
- localWidth, localHeight, matrix,
65
- };
66
- }
@@ -1,30 +0,0 @@
1
- import type { Translate } from '@widgetic/design-system/i18n';
2
- import type { CanvasMessageKey } from './messages.js';
3
- /**
4
- * The words that are drawn onto the canvas itself: on an empty image or video, on a widget that has no picture yet, and
5
- * above a frame that has no name. They are not part of any component, they are painted by the shapes (`ImageShape`,
6
- * `WidgetShape`, `FrameShape`) every time the canvas redraws, so a shape reads them from the canvas it is on.
7
- */
8
- export interface ShapeWords {
9
- dropImage: string;
10
- dropVideo: string;
11
- or: string;
12
- doubleClick: string;
13
- /** What a widget on the canvas is called until it has a name. */
14
- widgetName: string;
15
- /** What a widget with no link says in place of its name. */
16
- unlinkedWidget: string;
17
- widgetPreview: string;
18
- removeFromCanvas: string;
19
- /** What is written above a frame that has no name. */
20
- frameLabel: string;
21
- }
22
- /** The words, in the language `t` speaks. */
23
- export declare function makeShapeWords(t: Translate<CanvasMessageKey>): ShapeWords;
24
- /** Called by the canvas when it is made, and again when the page sets the language. */
25
- export declare function setShapeWords(owner: object, words: ShapeWords): void;
26
- /**
27
- * The words for the shapes of one canvas. A shape that is not on a canvas (it is being made, or drawn to an image of its
28
- * own) speaks English.
29
- */
30
- export declare function shapeWordsOf(owner: object | null | undefined): ShapeWords;
@@ -1,36 +0,0 @@
1
- import { translateEnglish } from './language.js';
2
- /** The words, in the language `t` speaks. */
3
- export function makeShapeWords(t) {
4
- return {
5
- dropImage: t('canvas.draw.dropImage'),
6
- dropVideo: t('canvas.draw.dropVideo'),
7
- or: t('canvas.draw.or'),
8
- doubleClick: t('canvas.draw.doubleClick'),
9
- widgetName: t('canvas.draw.widgetName'),
10
- unlinkedWidget: t('canvas.widget.unlinkedName'),
11
- widgetPreview: t('canvas.draw.widgetPreview'),
12
- removeFromCanvas: t('canvas.widget.removeFromCanvas'),
13
- frameLabel: t('canvas.defaults.frameLabel')
14
- };
15
- }
16
- // One set of words for each canvas: two canvases on a page can speak two languages. The key is the Fabric canvas the
17
- // shapes are on, so the words go away with it.
18
- const wordsOfCanvas = new WeakMap();
19
- let englishWords = null;
20
- /** Called by the canvas when it is made, and again when the page sets the language. */
21
- export function setShapeWords(owner, words) {
22
- wordsOfCanvas.set(owner, words);
23
- }
24
- /**
25
- * The words for the shapes of one canvas. A shape that is not on a canvas (it is being made, or drawn to an image of its
26
- * own) speaks English.
27
- */
28
- export function shapeWordsOf(owner) {
29
- if (owner) {
30
- const words = wordsOfCanvas.get(owner);
31
- if (words)
32
- return words;
33
- }
34
- englishWords ??= makeShapeWords(translateEnglish);
35
- return englishWords;
36
- }
@@ -1,20 +0,0 @@
1
- import type { Translate } from '@widgetic/design-system/i18n';
2
- import type { CanvasMessageKey } from './messages.js';
3
- /** A piece of a sentence that has markup inside it: plain text, or the place of one of its named parts. */
4
- export type SentencePart = {
5
- text: string;
6
- } | {
7
- slot: string;
8
- };
9
- /**
10
- * Cuts a translated sentence into plain text and the places of its named parts. For a sentence that has markup inside
11
- * it, such as a key shown as a key cap: the page's translation says where each part goes (`{key}`), so a language can
12
- * put the parts in the order it needs, and the screen draws each part itself.
13
- *
14
- * sentenceParts('canvas.shortcuts.footer', ['key', 'hint', 'icon'], t)
15
- * // → [{ text: 'Press ' }, { slot: 'key' }, { text: ' ' }, { slot: 'hint' }, { text: ' or click ' }, …]
16
- *
17
- * A part the translation leaves out is simply not in the list; a `{name}` that is not one of `slotNames` is shown as it
18
- * is written, like any other message.
19
- */
20
- export declare function sentenceParts(key: CanvasMessageKey, slotNames: readonly string[], t: Translate<CanvasMessageKey>): SentencePart[];
@@ -1,40 +0,0 @@
1
- // Two characters a translator never types (private use): they mark where a slot starts and ends, so the finished sentence
2
- // can be cut there again. Two different marks, so a stray one in a translation cannot swallow the slot next to it.
3
- const SLOT_OPEN = '\uE000';
4
- const SLOT_CLOSE = '\uE001';
5
- /**
6
- * Cuts a translated sentence into plain text and the places of its named parts. For a sentence that has markup inside
7
- * it, such as a key shown as a key cap: the page's translation says where each part goes (`{key}`), so a language can
8
- * put the parts in the order it needs, and the screen draws each part itself.
9
- *
10
- * sentenceParts('canvas.shortcuts.footer', ['key', 'hint', 'icon'], t)
11
- * // → [{ text: 'Press ' }, { slot: 'key' }, { text: ' ' }, { slot: 'hint' }, { text: ' or click ' }, …]
12
- *
13
- * A part the translation leaves out is simply not in the list; a `{name}` that is not one of `slotNames` is shown as it
14
- * is written, like any other message.
15
- */
16
- export function sentenceParts(key, slotNames, t) {
17
- const values = {};
18
- for (const name of slotNames)
19
- values[name] = `${SLOT_OPEN}${name}${SLOT_CLOSE}`;
20
- const sentence = t(key, values);
21
- const parts = [];
22
- const slotPattern = new RegExp(`${SLOT_OPEN}([^${SLOT_OPEN}${SLOT_CLOSE}]*)${SLOT_CLOSE}`, 'g');
23
- let textFrom = 0;
24
- for (const found of sentence.matchAll(slotPattern)) {
25
- // Something between the two marks that is not one of our parts was typed by the translator: it stays text
26
- if (!slotNames.includes(found[1]))
27
- continue;
28
- const at = found.index ?? 0;
29
- if (at > textFrom)
30
- parts.push({ text: sentence.slice(textFrom, at) });
31
- parts.push({ slot: found[1] });
32
- textFrom = at + found[0].length;
33
- }
34
- if (textFrom < sentence.length)
35
- parts.push({ text: sentence.slice(textFrom) });
36
- // A mark that was somehow in the translation itself is not part of any text (and a text that was only that is no text)
37
- return parts
38
- .map((part) => ('text' in part ? { text: part.text.split(SLOT_OPEN).join('').split(SLOT_CLOSE).join('') } : part))
39
- .filter((part) => !('text' in part) || part.text !== '');
40
- }