@m3ui-vue/m3ui-vue 1.3.0 → 1.3.1

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 +213 -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 +90 -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 +2934 -1955
  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 +205 -3
  51. package/src/__tests__/MFlow.test.ts +15 -0
  52. package/src/components/MDrawCanvas.vue +9 -3
  53. package/src/components/MFloorPlan.vue +571 -72
  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
@@ -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 {