@m3ui-vue/m3ui-vue 1.3.0 → 1.3.2

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 (68) hide show
  1. package/dist/API.md +215 -4
  2. package/dist/{MButton-CuNzpoxm.js → MButton-Bl_BSUep.js} +2 -2
  3. package/dist/{MButton-CuNzpoxm.js.map → MButton-Bl_BSUep.js.map} +1 -1
  4. package/dist/{MDialog-HxEL-m58.js → MDialog-D_Yik8ou.js} +2 -2
  5. package/dist/{MDialog-HxEL-m58.js.map → MDialog-D_Yik8ou.js.map} +1 -1
  6. package/dist/{MListItem-DnPtv-hY.js → MListItem-BxifHJdU.js} +2 -2
  7. package/dist/{MListItem-DnPtv-hY.js.map → MListItem-BxifHJdU.js.map} +1 -1
  8. package/dist/{MLoadingIndicator-BQMNX6Dx.js → MLoadingIndicator-BxbFhSX6.js} +2 -2
  9. package/dist/{MLoadingIndicator-BQMNX6Dx.js.map → MLoadingIndicator-BxbFhSX6.js.map} +1 -1
  10. package/dist/{MSeekBar-LURE1Ah7.js → MSeekBar-BeN9QcB3.js} +2 -2
  11. package/dist/{MSeekBar-LURE1Ah7.js.map → MSeekBar-BeN9QcB3.js.map} +1 -1
  12. package/dist/{MSlider-_J4IS2_z.js → MSlider-BVSbJlGS.js} +2 -2
  13. package/dist/{MSlider-_J4IS2_z.js.map → MSlider-BVSbJlGS.js.map} +1 -1
  14. package/dist/{MSpinner-BhkMYKOM.js → MSpinner-C2SUnWk4.js} +2 -2
  15. package/dist/{MSpinner-BhkMYKOM.js.map → MSpinner-C2SUnWk4.js.map} +1 -1
  16. package/dist/{MTextField-CkzwNBWS.js → MTextField-CEkWSZ2v.js} +2 -2
  17. package/dist/{MTextField-CkzwNBWS.js.map → MTextField-CEkWSZ2v.js.map} +1 -1
  18. package/dist/{MTooltip-B67ZDSGp.js → MTooltip-CodJGEO-.js} +4 -4
  19. package/dist/{MTooltip-B67ZDSGp.js.map → MTooltip-CodJGEO-.js.map} +1 -1
  20. package/dist/api.json +1 -1
  21. package/dist/code-editor.js +1 -1
  22. package/dist/components/MDrawCanvas.vue.d.ts +3 -1
  23. package/dist/components/MFloorPlan.vue.d.ts +100 -2
  24. package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
  25. package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
  26. package/dist/components/MFlow.vue.d.ts +13 -0
  27. package/dist/composables/useFloorPlan.d.ts +58 -0
  28. package/dist/composables/useLocale.d.ts +41 -0
  29. package/dist/draw.js +11 -9
  30. package/dist/draw.js.map +1 -1
  31. package/dist/flow.js +6 -1
  32. package/dist/flow.js.map +1 -1
  33. package/dist/gantt.js +1 -1
  34. package/dist/index.d.ts +6 -1
  35. package/dist/locales/index.js +287 -0
  36. package/dist/locales/index.js.map +1 -1
  37. package/dist/m3ui-vue.css +1 -1
  38. package/dist/m3ui.js +2938 -1945
  39. package/dist/m3ui.js.map +1 -1
  40. package/dist/map.js +5 -5
  41. package/dist/media.js +31 -31
  42. package/dist/pdf.js +5 -5
  43. package/dist/pdf.js.map +1 -1
  44. package/dist/rich-text-editor.js +4 -4
  45. package/dist/styles.css +1 -1
  46. package/dist/{useLocale-BpGxplLV.js → useLocale-CaWwi-b6.js} +42 -1
  47. package/dist/useLocale-CaWwi-b6.js.map +1 -0
  48. package/package.json +1 -1
  49. package/src/__tests__/MDrawCanvas.test.ts +8 -0
  50. package/src/__tests__/MFloorPlan.test.ts +235 -3
  51. package/src/__tests__/MFlow.test.ts +15 -0
  52. package/src/components/MDrawCanvas.vue +9 -3
  53. package/src/components/MFloorPlan.vue +586 -74
  54. package/src/components/MFloorPlanInspector.vue +169 -0
  55. package/src/components/MFloorPlanToolbar.vue +128 -0
  56. package/src/components/MFlow.vue +11 -0
  57. package/src/components/MPdfViewer.vue +2 -1
  58. package/src/composables/useFloorPlan.ts +73 -0
  59. package/src/composables/useLocale.ts +82 -0
  60. package/src/index.ts +6 -1
  61. package/src/locales/de.ts +41 -0
  62. package/src/locales/es.ts +41 -0
  63. package/src/locales/fr.ts +41 -0
  64. package/src/locales/ja.ts +41 -0
  65. package/src/locales/ko.ts +41 -0
  66. package/src/locales/pt.ts +41 -0
  67. package/src/locales/zh.ts +41 -0
  68. package/dist/useLocale-BpGxplLV.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { describe, expect, it } from 'vitest'
1
+ import { describe, expect, it, vi } from 'vitest'
2
2
  import { mount } from '@vue/test-utils'
3
3
  import { nextTick } from 'vue'
4
4
  import MFloorPlan, { type FloorTable } from '../components/MFloorPlan.vue'
@@ -22,7 +22,7 @@ describe('MFloorPlan', () => {
22
22
  expect(table(w, 'T1').attributes('aria-label')).toBe('T1, Occupied, 4 seats, 12')
23
23
  expect(table(w, 'T1').attributes('style')).toContain('--color-primary-container')
24
24
  // chairs: 4 + 6
25
- expect(w.findAll('.bg-outline-variant').length).toBe(10)
25
+ expect(w.findAll('.m3-floor-chair').length).toBe(10)
26
26
  })
27
27
  it('a click opens a table in service mode, without moving it', async () => {
28
28
  const w = setup()
@@ -85,7 +85,7 @@ describe('MFloorPlan zones, walls and decor', () => {
85
85
  })
86
86
  it('moves decor and deletes what is picked', async () => {
87
87
  const w = plan({ decor: [{ id: 'p', kind: 'plant', x: 100, y: 100 }], 'onUpdate:decor': (v: unknown) => w.setProps({ decor: v as any }) })
88
- const plant = w.find('[aria-label="plant"]').element
88
+ const plant = w.find('[aria-label="Plant"]').element
89
89
  down(plant, 0, 0)
90
90
  moveUp(41, 19)
91
91
  await nextTick()
@@ -95,3 +95,235 @@ describe('MFloorPlan zones, walls and decor', () => {
95
95
  expect(w.props('decor')).toEqual([])
96
96
  })
97
97
  })
98
+
99
+ describe('MFloorPlan editing comforts', () => {
100
+ const down = (el: Element, x: number, y: number, o: Record<string, unknown> = {}) => el.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0, clientX: x, clientY: y, pointerId: 5, ...o }))
101
+ const moveUp = (x: number, y: number) => {
102
+ window.dispatchEvent(new PointerEvent('pointermove', { clientX: x, clientY: y, pointerId: 5 }))
103
+ window.dispatchEvent(new PointerEvent('pointerup', { clientX: x, clientY: y, pointerId: 5 }))
104
+ }
105
+ const key = (w: { element: Element }, k: string, o: Record<string, unknown> = {}) => w.element.dispatchEvent(new KeyboardEvent('keydown', { key: k, bubbles: true, ...o }))
106
+ function plan(props: Record<string, unknown> = {}) {
107
+ const w: any = mount(MFloorPlan, {
108
+ props: {
109
+ editable: true,
110
+ grid: 10,
111
+ tables: base(),
112
+ merges: [{ id: 'm', tables: [1, 2] }],
113
+ ...props,
114
+ ...Object.fromEntries(['tables', 'areas', 'walls', 'decor', 'merges', 'selection', 'picked'].map((k) => [`onUpdate:${k}`, (v: unknown) => w.setProps({ [k]: v })])),
115
+ },
116
+ attachTo: document.body,
117
+ })
118
+ return w
119
+ }
120
+ it('undoes and redoes a drag', async () => {
121
+ const w = plan()
122
+ down(table(w, 'T1').element, 0, 0)
123
+ moveUp(40, 0)
124
+ await nextTick()
125
+ expect(w.props('tables')[0].x).toBe(140)
126
+ key(w, 'z', { ctrlKey: true })
127
+ await nextTick()
128
+ expect(w.props('tables')[0].x).toBe(100)
129
+ key(w, 'z', { ctrlKey: true, shiftKey: true })
130
+ await nextTick()
131
+ expect(w.props('tables')[0].x).toBe(140)
132
+ })
133
+ it('Delete removes the selected tables and their merge; Ctrl+D duplicates', async () => {
134
+ const w = plan({ selection: [2] })
135
+ key(w, 'd', { ctrlKey: true })
136
+ await nextTick()
137
+ expect(w.props('tables')).toHaveLength(3)
138
+ expect(w.props('tables')[2]).toMatchObject({ label: 'T2', x: 320, y: 120 })
139
+ await w.setProps({ selection: [2] })
140
+ key(w, 'Delete')
141
+ await nextTick()
142
+ expect(w.props('tables').map((t: FloorTable) => t.id)).not.toContain(2)
143
+ expect(w.props('merges')).toEqual([])
144
+ })
145
+ it('resizes a zone by its top-left corner, keeping the opposite one', async () => {
146
+ const w = plan({ areas: [{ id: 'z', x: 100, y: 100, width: 200, height: 100 }], picked: { kind: 'area', id: 'z' } })
147
+ down(w.find('[data-corner="nw"]').element, 0, 0)
148
+ moveUp(-40, -20)
149
+ await nextTick()
150
+ expect(w.props('areas')[0]).toMatchObject({ x: 60, y: 80, width: 240, height: 120 })
151
+ })
152
+ it('a double-click adds a corner to a wall; Delete removes a picked corner', async () => {
153
+ const w = plan({ walls: [{ id: 'w', points: [[0, 0], [200, 0]] }] })
154
+ const path = w.find('svg path').element
155
+ path.dispatchEvent(new MouseEvent('dblclick', { bubbles: true, clientX: 100, clientY: 0 }))
156
+ await nextTick()
157
+ expect(w.props('walls')[0].points).toEqual([[0, 0], [100, 0], [200, 0]])
158
+ expect(w.props('picked')).toEqual({ kind: 'wall', id: 'w', vertex: 1 })
159
+ key(w, 'Delete')
160
+ await nextTick()
161
+ expect(w.props('walls')[0].points).toEqual([[0, 0], [200, 0]])
162
+ })
163
+ it('rotates the picked table by its handle in 15° steps', async () => {
164
+ const w = plan({ selection: [1] })
165
+ const h = w.find('[data-rotate]').element
166
+ // The table's center is (100, 100) at scale 1; pointing right of it is 90°
167
+ h.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0, clientX: 100, clientY: 40, pointerId: 6 }))
168
+ window.dispatchEvent(new PointerEvent('pointermove', { clientX: 160, clientY: 98, pointerId: 6 }))
169
+ window.dispatchEvent(new PointerEvent('pointerup', { clientX: 160, clientY: 98, pointerId: 6 }))
170
+ await nextTick()
171
+ expect(w.props('tables')[0].rotation).toBe(90)
172
+ })
173
+ })
174
+
175
+ import MFloorPlanToolbar from '../components/MFloorPlanToolbar.vue'
176
+ import MFloorPlanInspector from '../components/MFloorPlanInspector.vue'
177
+ import { defineComponent, h, ref as vref } from 'vue'
178
+
179
+ describe('MFloorPlan family', () => {
180
+ it('draws decor kinds of yours, and the #decor slot replaces their inside', () => {
181
+ const w = mount(MFloorPlan, {
182
+ props: { decor: [{ id: 'tv', kind: 'tv', x: 100, y: 100 }], decorKinds: { tv: { label: 'TV', icon: 'tv', width: 80, height: 20, shape: 'bar', color: '#000' } } },
183
+ slots: { decor: '<template #decor="{ item, kind }"><b class="mine">{{ kind.label }}:{{ item.id }}</b></template>' },
184
+ })
185
+ const el = w.find('[aria-label="TV"]')
186
+ expect(el.attributes('style')).toContain('width: 80px')
187
+ expect(w.find('.mine').text()).toBe('TV:tv')
188
+ })
189
+ it('in service, selectable multiple + merge() joins tables; canMerge can refuse', async () => {
190
+ const w: any = mount(MFloorPlan, {
191
+ props: {
192
+ tables: base(),
193
+ selectable: 'multiple',
194
+ canMerge: (ids: (string | number)[]) => (ids.includes(3) ? 'Table 3 has an open bill' : true),
195
+ 'onUpdate:selection': (v: unknown) => w.setProps({ selection: v }),
196
+ 'onUpdate:merges': (v: unknown) => w.setProps({ merges: v }),
197
+ },
198
+ })
199
+ await table(w, 'T1').trigger('click')
200
+ await table(w, 'T2').trigger('click')
201
+ expect(w.props('selection')).toEqual([1, 2])
202
+ const m = w.vm.merge()
203
+ expect(m).toMatchObject({ tables: [1, 2], label: 'T1 + T2' })
204
+ expect(w.emitted('merge')).toHaveLength(1)
205
+ expect(w.vm.merge([1, 3])).toBeNull()
206
+ expect(w.emitted('merge-refused')![0]).toEqual([[1, 2, 3], 'Table 3 has an open bill'])
207
+ w.vm.split(1)
208
+ expect(w.emitted('split')).toHaveLength(1)
209
+ })
210
+ it('the toolbar adds tables and undoes, and the inspector edits from outside the plan', async () => {
211
+ const App = defineComponent({
212
+ setup() {
213
+ const plan = vref()
214
+ const tables = vref<FloorTable[]>(base())
215
+ return () => [
216
+ h(MFloorPlan, { ref: plan, editable: true, tables: tables.value, 'onUpdate:tables': (v: FloorTable[]) => (tables.value = v) }),
217
+ h(MFloorPlanToolbar, { plan: plan.value }),
218
+ h(MFloorPlanInspector, { plan: plan.value }),
219
+ ]
220
+ },
221
+ })
222
+ const w = mount(App, { attachTo: document.body })
223
+ await nextTick()
224
+ await w.find('[aria-label="Add a table"]').trigger('click')
225
+ await nextTick()
226
+ const item = [...document.querySelectorAll('button')].find((b) => b.textContent?.includes('Round · 2'))!
227
+ item.click()
228
+ await nextTick()
229
+ expect(w.findAll('.m3-floor-plan [role="button"]')).toHaveLength(3)
230
+ // The new table is selected: the inspector shows it, and renaming it goes into the tables
231
+ const field = w.find('.m3-floor-plan-inspector input')
232
+ await field.setValue('Window seat')
233
+ expect(w.find('.m3-floor-plan').text()).toContain('Window seat')
234
+ await w.find('[aria-label="Undo"]').trigger('click')
235
+ await w.find('[aria-label="Undo"]').trigger('click')
236
+ expect(w.findAll('.m3-floor-plan [role="button"]')).toHaveLength(2)
237
+ w.unmount()
238
+ })
239
+ })
240
+
241
+ describe('MFloorPlan by touch', () => {
242
+ const touch = (type: string, el: EventTarget, x: number, y: number) =>
243
+ el.dispatchEvent(new PointerEvent(type, { bubbles: true, button: 0, clientX: x, clientY: y, pointerId: 9, pointerType: 'touch' }))
244
+ function plan(props: Record<string, unknown> = {}) {
245
+ const w: any = mount(MFloorPlan, {
246
+ props: { editable: true, grid: 10, tables: base(), ...props, ...Object.fromEntries(['tables', 'selection', 'walls'].map((k) => [`onUpdate:${k}`, (v: unknown) => w.setProps({ [k]: v })])) },
247
+ attachTo: document.body,
248
+ })
249
+ return w
250
+ }
251
+ it('holding a table down adds it to the selection; a tap still picks only it', async () => {
252
+ vi.useFakeTimers()
253
+ const w = plan({ selection: [1] })
254
+ touch('pointerdown', table(w, 'T2').element, 0, 0)
255
+ vi.advanceTimersByTime(500)
256
+ touch('pointerup', window, 0, 0)
257
+ await nextTick()
258
+ expect(w.props('selection')).toEqual([1, 2])
259
+ await table(w, 'T2').trigger('click')
260
+ expect(w.props('selection')).toEqual([1, 2])
261
+ vi.useRealTimers()
262
+ })
263
+ it('dragging an unpicked table with a finger picks it and moves it', async () => {
264
+ const w = plan({ selection: [1] })
265
+ touch('pointerdown', table(w, 'T2').element, 0, 0)
266
+ touch('pointermove', window, 40, 0)
267
+ touch('pointerup', window, 40, 0)
268
+ await nextTick()
269
+ expect(w.props('selection')).toEqual([2])
270
+ expect(w.props('tables')[1].x).toBe(340)
271
+ })
272
+ it('a wall being drawn can be finished from the context (the toolbar\'s Done)', async () => {
273
+ const w = plan({ tool: 'wall' })
274
+ const down = (x: number, y: number) => w.element.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0, clientX: x, clientY: y, pointerId: 3 }))
275
+ down(0, 0)
276
+ down(100, 0)
277
+ await nextTick()
278
+ expect(w.vm.context.drawingWall.value).toBe(true)
279
+ w.vm.context.finishWall()
280
+ await nextTick()
281
+ expect(w.props('walls')[0].points).toEqual([[0, 0], [100, 0]])
282
+ })
283
+ })
284
+
285
+ describe('MFloorPlan merges across the room', () => {
286
+ it('draws touching tables in one outline and tables apart in their own, joined by a line', () => {
287
+ const tables: FloorTable[] = [
288
+ { id: 1, label: '1', x: 100, y: 100, seats: 4 },
289
+ { id: 2, label: '2', x: 172, y: 100, seats: 4 },
290
+ { id: 3, label: '3', x: 700, y: 400, seats: 4 },
291
+ { id: 4, label: '4', x: 400, y: 250, seats: 4 },
292
+ ]
293
+ const w = mount(MFloorPlan, { props: { tables, merges: [{ id: 'm', tables: [1, 2, 3], label: '1 + 2 + 3' }] } })
294
+ // 1 and 2 touch: one outline; 3 is apart: its own; 4 (between them) isn't covered
295
+ expect(w.findAll('.m3-floor-merge')).toHaveLength(2)
296
+ expect(w.findAll('.m3-floor-merge-link')).toHaveLength(1)
297
+ expect(w.findAll('.m3-floor-merge-label')).toHaveLength(1)
298
+ })
299
+ })
300
+
301
+ describe('MFloorPlan dragMerged', () => {
302
+ it('a merged table drags its merge along', async () => {
303
+ const w: any = mount(MFloorPlan, {
304
+ props: { editable: true, grid: 10, dragMerged: true, tables: base(), merges: [{ id: 'm', tables: [1, 2] }], 'onUpdate:tables': (v: FloorTable[]) => w.setProps({ tables: v }) },
305
+ attachTo: document.body,
306
+ })
307
+ table(w, 'T1').element.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, button: 0, clientX: 0, clientY: 0, pointerId: 4 }))
308
+ window.dispatchEvent(new PointerEvent('pointermove', { clientX: 20, clientY: 30, pointerId: 4 }))
309
+ window.dispatchEvent(new PointerEvent('pointerup', { clientX: 20, clientY: 30, pointerId: 4 }))
310
+ await nextTick()
311
+ expect(w.props('tables').map((t: FloorTable) => [t.x, t.y])).toEqual([[120, 130], [320, 130]])
312
+ })
313
+ })
314
+
315
+ describe('MFloorPlan rotatable', () => {
316
+ it('has no rotate handle when rotatable is off', () => {
317
+ const on = mount(MFloorPlan, { props: { editable: true, tables: base(), selection: [1] } })
318
+ const off = mount(MFloorPlan, { props: { editable: true, tables: base(), selection: [1], rotatable: false } })
319
+ expect(on.findAll('[data-rotate]')).toHaveLength(1)
320
+ expect(off.findAll('[data-rotate]')).toHaveLength(0)
321
+ })
322
+ })
323
+
324
+ describe('MFloorPlanToolbar without table presets', () => {
325
+ it('hides Add a table when tables is empty', () => {
326
+ const w = mount(MFloorPlanToolbar, { props: { plan: { context: { kinds: { value: {} }, picked: { value: null }, selection: { value: [] }, tool: { value: 'select' }, drawingWall: { value: false }, canUndo: { value: false }, canRedo: { value: false } } } as any, tables: [] } })
327
+ expect(w.find('[aria-label="Add a table"]').exists()).toBe(false)
328
+ })
329
+ })
@@ -573,3 +573,18 @@ describe('MFlow', () => {
573
573
  expect(w.find('[data-flow-edge="e1"] path').attributes('d')).toBe(d)
574
574
  })
575
575
  })
576
+
577
+ describe('MFlow context menu', () => {
578
+ it("keeps the browser's menu closed on the canvas but still emits pane-contextmenu; nativeContextMenu lets it open", async () => {
579
+ const { default: MFlow } = await import('../components/MFlow.vue')
580
+ const { mount } = await import('@vue/test-utils')
581
+ for (const native of [false, true]) {
582
+ const w = mount(MFlow, { props: { nodes: [], edges: [], nativeContextMenu: native } })
583
+ const e = new MouseEvent('contextmenu', { bubbles: true, cancelable: true, clientX: 10, clientY: 10 })
584
+ w.element.dispatchEvent(e)
585
+ expect(e.defaultPrevented).toBe(!native)
586
+ expect(w.emitted('pane-contextmenu')).toHaveLength(1)
587
+ w.unmount()
588
+ }
589
+ })
590
+ })
@@ -56,6 +56,8 @@ const props = withDefaults(defineProps<{
56
56
  backgroundSize?: number
57
57
  /** An image under the drawing, to trace or annotate: fills each page, or sits at (0, 0) on an infinite canvas */
58
58
  backgroundImage?: string
59
+ /** Infinite canvas: where the background image goes and its size, in drawing units (fitView takes it in too) */
60
+ backgroundImageBox?: DrawBox
59
61
  /** Fingers only pan and zoom: `true`, `false`, or `'auto'` (once a stylus has touched the canvas) */
60
62
  penOnly?: boolean | 'auto'
61
63
  /** Use the stylus' pressure (without one, speed thins the line) */
@@ -192,7 +194,7 @@ function fitView() {
192
194
  if (!width || !height) return
193
195
  const b: DrawBox | null = isPages.value
194
196
  ? { x: 0, y: 0, width: props.pageSize.width, height: pageTop(pages.value - 1) + props.pageSize.height }
195
- : unionBox(ordered.value.map((i) => itemBox(i)))
197
+ : unionBox([...ordered.value.map((i) => itemBox(i)), ...(props.backgroundImage && props.backgroundImageBox ? [props.backgroundImageBox] : [])])
196
198
  if (!b) {
197
199
  viewport.value = { x: width / 2, y: height / 2, zoom: 1 }
198
200
  return
@@ -682,7 +684,7 @@ defineExpose({ undo, redo, clear, deleteSelection, fitView, zoomIn: () => zoomBy
682
684
  <template>
683
685
  <div
684
686
  ref="root"
685
- class="m3-draw-canvas relative overflow-hidden bg-surface-container outline-none select-none [touch-action:none]"
687
+ class="m3-draw-canvas outline-none select-none [touch-action:none]"
686
688
  :style="{ cursor }"
687
689
  tabindex="0"
688
690
  role="application"
@@ -715,7 +717,7 @@ defineExpose({ undo, redo, clear, deleteSelection, fitView, zoomIn: () => zoomBy
715
717
  <g :transform="`translate(${vp.x} ${vp.y}) scale(${vp.zoom})`">
716
718
  <template v-if="!isPages">
717
719
  <rect v-bind="visibleArea" :fill="paper" />
718
- <image v-if="backgroundImage" :href="backgroundImage" x="0" y="0" />
720
+ <image v-if="backgroundImage" :href="backgroundImage" v-bind="backgroundImageBox ?? { x: 0, y: 0 }" preserveAspectRatio="xMidYMid slice" />
719
721
  <rect v-if="background !== 'none'" v-bind="visibleArea" :fill="`url(#${uid}-${background})`" />
720
722
  </template>
721
723
  <g v-for="p in pageList" :key="p ?? 'all'" :transform="p === undefined ? undefined : `translate(0 ${pageTop(p)})`">
@@ -799,9 +801,13 @@ defineExpose({ undo, redo, clear, deleteSelection, fitView, zoomIn: () => zoomBy
799
801
  </template>
800
802
 
801
803
  <style>
804
+ /* Defaults a consumer's own utilities override (absolute inset-0, another background…): none on the root itself */
802
805
  @layer base {
803
806
  .m3-draw-canvas {
807
+ position: relative;
808
+ overflow: hidden;
804
809
  min-height: 240px;
810
+ background-color: var(--color-surface-container);
805
811
  }
806
812
  }
807
813
  .m3-draw-page {