@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.
- package/dist/API.md +213 -4
- package/dist/{MButton-CuNzpoxm.js → MButton-Bl_BSUep.js} +2 -2
- package/dist/{MButton-CuNzpoxm.js.map → MButton-Bl_BSUep.js.map} +1 -1
- package/dist/{MDialog-HxEL-m58.js → MDialog-D_Yik8ou.js} +2 -2
- package/dist/{MDialog-HxEL-m58.js.map → MDialog-D_Yik8ou.js.map} +1 -1
- package/dist/{MListItem-DnPtv-hY.js → MListItem-BxifHJdU.js} +2 -2
- package/dist/{MListItem-DnPtv-hY.js.map → MListItem-BxifHJdU.js.map} +1 -1
- package/dist/{MLoadingIndicator-BQMNX6Dx.js → MLoadingIndicator-BxbFhSX6.js} +2 -2
- package/dist/{MLoadingIndicator-BQMNX6Dx.js.map → MLoadingIndicator-BxbFhSX6.js.map} +1 -1
- package/dist/{MSeekBar-LURE1Ah7.js → MSeekBar-BeN9QcB3.js} +2 -2
- package/dist/{MSeekBar-LURE1Ah7.js.map → MSeekBar-BeN9QcB3.js.map} +1 -1
- package/dist/{MSlider-_J4IS2_z.js → MSlider-BVSbJlGS.js} +2 -2
- package/dist/{MSlider-_J4IS2_z.js.map → MSlider-BVSbJlGS.js.map} +1 -1
- package/dist/{MSpinner-BhkMYKOM.js → MSpinner-C2SUnWk4.js} +2 -2
- package/dist/{MSpinner-BhkMYKOM.js.map → MSpinner-C2SUnWk4.js.map} +1 -1
- package/dist/{MTextField-CkzwNBWS.js → MTextField-CEkWSZ2v.js} +2 -2
- package/dist/{MTextField-CkzwNBWS.js.map → MTextField-CEkWSZ2v.js.map} +1 -1
- package/dist/{MTooltip-B67ZDSGp.js → MTooltip-CodJGEO-.js} +4 -4
- package/dist/{MTooltip-B67ZDSGp.js.map → MTooltip-CodJGEO-.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +3 -1
- package/dist/components/MFloorPlan.vue.d.ts +90 -2
- package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
- package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
- package/dist/components/MFlow.vue.d.ts +13 -0
- package/dist/composables/useFloorPlan.d.ts +58 -0
- package/dist/composables/useLocale.d.ts +41 -0
- package/dist/draw.js +11 -9
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +6 -1
- package/dist/flow.js.map +1 -1
- package/dist/gantt.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/locales/index.js +287 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2934 -1955
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +5 -5
- package/dist/media.js +31 -31
- package/dist/pdf.js +5 -5
- package/dist/pdf.js.map +1 -1
- package/dist/rich-text-editor.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/{useLocale-BpGxplLV.js → useLocale-CaWwi-b6.js} +42 -1
- package/dist/useLocale-CaWwi-b6.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MDrawCanvas.test.ts +8 -0
- package/src/__tests__/MFloorPlan.test.ts +205 -3
- package/src/__tests__/MFlow.test.ts +15 -0
- package/src/components/MDrawCanvas.vue +9 -3
- package/src/components/MFloorPlan.vue +571 -72
- package/src/components/MFloorPlanInspector.vue +169 -0
- package/src/components/MFloorPlanToolbar.vue +128 -0
- package/src/components/MFlow.vue +11 -0
- package/src/components/MPdfViewer.vue +2 -1
- package/src/composables/useFloorPlan.ts +73 -0
- package/src/composables/useLocale.ts +82 -0
- package/src/index.ts +6 -1
- package/src/locales/de.ts +41 -0
- package/src/locales/es.ts +41 -0
- package/src/locales/fr.ts +41 -0
- package/src/locales/ja.ts +41 -0
- package/src/locales/ko.ts +41 -0
- package/src/locales/pt.ts +41 -0
- package/src/locales/zh.ts +41 -0
- 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
|
|
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"
|
|
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 {
|