@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 { i as e } from "./useLocale-BpGxplLV.js";
1
+ import { i as e } from "./useLocale-CaWwi-b6.js";
2
2
  import { t } from "./MIcon-Bxh9j135.js";
3
3
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { computed as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, normalizeStyle as d, onBeforeUnmount as f, onMounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, watch as v, withCtx as y } from "vue";
@@ -1,4 +1,4 @@
1
- import { type DrawItem, type DrawLayer } from '../composables/drawGeometry';
1
+ import { type DrawBox, type DrawItem, type DrawLayer } from '../composables/drawGeometry';
2
2
  import { type DrawExportOptions, type DrawTool } from '../composables/useDrawing';
3
3
  type __VLS_Props = {
4
4
  /** An endless canvas, or pages of `pageSize` stacked one under another */
@@ -16,6 +16,8 @@ type __VLS_Props = {
16
16
  backgroundSize?: number;
17
17
  /** An image under the drawing, to trace or annotate: fills each page, or sits at (0, 0) on an infinite canvas */
18
18
  backgroundImage?: string;
19
+ /** Infinite canvas: where the background image goes and its size, in drawing units (fitView takes it in too) */
20
+ backgroundImageBox?: DrawBox;
19
21
  /** Fingers only pan and zoom: `true`, `false`, or `'auto'` (once a stylus has touched the canvas) */
20
22
  penOnly?: boolean | 'auto';
21
23
  /** Use the stylus' pressure (without one, speed thins the line) */
@@ -1,3 +1,4 @@
1
+ import { type FloorItemKind, type FloorPlanContext } from '../composables/useFloorPlan';
1
2
  /** A table on the plan, in plan units (not pixels) */
2
3
  export interface FloorTable {
3
4
  id: string | number;
@@ -43,7 +44,8 @@ export interface FloorWall {
43
44
  /** Something on the plan that isn't a table: a door, a window, a plant, a column, the register, a text label… */
44
45
  export interface FloorDecor {
45
46
  id: string | number;
46
- kind: 'door' | 'window' | 'plant' | 'column' | 'restroom' | 'kitchen' | 'register' | 'stairs' | 'label';
47
+ /** A built-in kind, or one of yours from `decorKinds` */
48
+ kind: FloorDecorBuiltin | (string & {});
47
49
  x: number;
48
50
  y: number;
49
51
  width?: number;
@@ -52,6 +54,25 @@ export interface FloorDecor {
52
54
  /** The text of a label (or a caption under the others) */
53
55
  label?: string;
54
56
  }
57
+ export type FloorDecorBuiltin = 'door' | 'window' | 'plant' | 'column' | 'restroom' | 'kitchen' | 'register' | 'stairs' | 'label';
58
+ /** How a decor kind looks: its default size, an icon, a shape and fill; yours or a built-in one restyled */
59
+ export interface FloorDecorKind {
60
+ /** Name, for the accessible label */
61
+ label?: string;
62
+ icon?: string;
63
+ width: number;
64
+ height: number;
65
+ /** `box` a rounded rectangle, `round` a circle, `bar` a thin slab (doors, windows), `text` the item's label only */
66
+ shape?: 'box' | 'round' | 'bar' | 'text';
67
+ /** Fill: an M3 color role (`surface`, `primary`…) or any CSS color */
68
+ color?: string;
69
+ }
70
+ /** What's picked on the plan besides tables: a zone, a wall (and one of its corners) or a decor item */
71
+ export type FloorPick = {
72
+ kind: 'area' | 'wall' | 'decor';
73
+ id: string | number;
74
+ vertex?: number;
75
+ } | null;
55
76
  /** How a status looks: an M3 color role ('primary', 'tertiary', 'error'…) or any CSS color, an icon, a name */
56
77
  export interface FloorStatus {
57
78
  label: string;
@@ -74,6 +95,16 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
74
95
  showGrid?: boolean;
75
96
  /** Draw chairs from `seats` */
76
97
  chairs?: boolean;
98
+ /** Decor kinds of yours, or the built-in ones restyled (merged over them by name) */
99
+ decorKinds?: Record<string, FloorDecorKind>;
100
+ /** The handle that turns the picked table or decor (off when your app doesn't keep angles) */
101
+ rotatable?: boolean;
102
+ /** Dragging (or nudging) a merged table moves its whole merge with it */
103
+ dragMerged?: boolean;
104
+ /** Outside editing, what a click on a table selects: nothing, one, or several (toggling; to merge them) */
105
+ selectable?: "none" | "single" | "multiple";
106
+ /** Whether these tables may be merged: `true`, or `false` / a reason to refuse (shown by `merge-refused`) */
107
+ canMerge?: (ids: (string | number)[]) => boolean | string;
77
108
  /** Accessible name */
78
109
  label?: string;
79
110
  } & {
@@ -85,7 +116,29 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
85
116
  decor?: FloorDecor[];
86
117
  /** While editing: `select` moves things, `wall` draws a wall (click each corner, double-click or Enter to end), `area` drags out a zone */
87
118
  tool?: "select" | "wall" | "area";
88
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
119
+ /** While editing: the zone, wall (and corner) or decor item picked, for an inspector of your own */
120
+ picked?: FloorPick;
121
+ }, {
122
+ /** Everything above and more, for MFloorPlanToolbar / MFloorPlanInspector outside the plan (`:plan="plan"`) */
123
+ context: FloorPlanContext;
124
+ addTable: (t?: Partial<FloorTable>) => FloorTable;
125
+ addDecor: (kind: string, d?: Partial<FloorDecor>) => FloorDecor;
126
+ update: (kind: FloorItemKind, id: string | number, patch: Record<string, unknown>) => void;
127
+ removeSelected: () => void;
128
+ /** Merge tables (default: the selection) / split a merge (by its id or a table's) */
129
+ merge: (ids?: (string | number)[], label?: string) => FloorMerge | null;
130
+ split: (idOrTable: string | number) => void;
131
+ /** Undo / redo the plan's own edits (also Ctrl+Z, Ctrl+Shift+Z or Ctrl+Y) */
132
+ undo: () => void;
133
+ redo: () => void;
134
+ canUndo: import("vue").ComputedRef<boolean>;
135
+ canRedo: import("vue").ComputedRef<boolean>;
136
+ /** Copy the selected tables, or the picked zone or decor (also Ctrl+D) */
137
+ duplicate: () => void;
138
+ /** Remove tables, taking them out of their merges (Delete does it for the selection) */
139
+ removeTables: (ids: (string | number)[]) => void;
140
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
141
+ split: (merge: FloorMerge) => any;
89
142
  move: (moved: {
90
143
  id: string | number;
91
144
  x: number;
@@ -98,6 +151,9 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
98
151
  "update:areas": (value: FloorArea[]) => any;
99
152
  "update:walls": (value: FloorWall[]) => any;
100
153
  "update:decor": (value: FloorDecor[]) => any;
154
+ "update:picked": (value: FloorPick) => any;
155
+ merge: (merge: FloorMerge) => any;
156
+ "merge-refused": (ids: (string | number)[], reason: string) => any;
101
157
  "table-click": (table: FloorTable, event: MouseEvent | KeyboardEvent) => any;
102
158
  }, string, import("vue").PublicProps, Readonly<{
103
159
  /** The plan's size in plan units */
@@ -113,6 +169,16 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
113
169
  showGrid?: boolean;
114
170
  /** Draw chairs from `seats` */
115
171
  chairs?: boolean;
172
+ /** Decor kinds of yours, or the built-in ones restyled (merged over them by name) */
173
+ decorKinds?: Record<string, FloorDecorKind>;
174
+ /** The handle that turns the picked table or decor (off when your app doesn't keep angles) */
175
+ rotatable?: boolean;
176
+ /** Dragging (or nudging) a merged table moves its whole merge with it */
177
+ dragMerged?: boolean;
178
+ /** Outside editing, what a click on a table selects: nothing, one, or several (toggling; to merge them) */
179
+ selectable?: "none" | "single" | "multiple";
180
+ /** Whether these tables may be merged: `true`, or `false` / a reason to refuse (shown by `merge-refused`) */
181
+ canMerge?: (ids: (string | number)[]) => boolean | string;
116
182
  /** Accessible name */
117
183
  label?: string;
118
184
  } & {
@@ -124,7 +190,10 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
124
190
  decor?: FloorDecor[];
125
191
  /** While editing: `select` moves things, `wall` draws a wall (click each corner, double-click or Enter to end), `area` drags out a zone */
126
192
  tool?: "select" | "wall" | "area";
193
+ /** While editing: the zone, wall (and corner) or decor item picked, for an inspector of your own */
194
+ picked?: FloorPick;
127
195
  }> & Readonly<{
196
+ onSplit?: ((merge: FloorMerge) => any) | undefined;
128
197
  onMove?: ((moved: {
129
198
  id: string | number;
130
199
  x: number;
@@ -137,21 +206,50 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
137
206
  "onUpdate:areas"?: ((value: FloorArea[]) => any) | undefined;
138
207
  "onUpdate:walls"?: ((value: FloorWall[]) => any) | undefined;
139
208
  "onUpdate:decor"?: ((value: FloorDecor[]) => any) | undefined;
209
+ "onUpdate:picked"?: ((value: FloorPick) => any) | undefined;
210
+ onMerge?: ((merge: FloorMerge) => any) | undefined;
211
+ "onMerge-refused"?: ((ids: (string | number)[], reason: string) => any) | undefined;
140
212
  "onTable-click"?: ((table: FloorTable, event: MouseEvent | KeyboardEvent) => any) | undefined;
141
213
  }>, {
142
214
  width: number;
143
215
  height: number;
144
216
  grid: number;
217
+ selectable: "none" | "single" | "multiple";
145
218
  showGrid: boolean;
146
219
  statuses: Record<string, FloorStatus>;
147
220
  editable: boolean;
148
221
  chairs: boolean;
222
+ rotatable: boolean;
223
+ dragMerged: boolean;
149
224
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
225
+ area?: (props: {
226
+ area: FloorArea;
227
+ picked: boolean;
228
+ scale: number;
229
+ }) => any;
230
+ } & {
231
+ decor?: (props: {
232
+ item: FloorDecor;
233
+ kind: FloorDecorKind;
234
+ picked: boolean;
235
+ scale: number;
236
+ }) => any;
237
+ } & {
238
+ merge?: (props: {
239
+ merge: FloorMerge;
240
+ tables: (string | number)[];
241
+ }) => any;
242
+ } & {
150
243
  table?: (props: {
151
244
  table: FloorTable;
152
245
  status: FloorStatus | undefined;
153
246
  selected: boolean;
154
247
  }) => any;
248
+ } & {
249
+ overlay?: (props: {
250
+ scale: number;
251
+ toPx: (v: number) => number;
252
+ }) => any;
155
253
  }>;
156
254
  type __VLS_WithSlots<T, S> = T & {
157
255
  new (): {
@@ -0,0 +1,56 @@
1
+ import { type FloorPlanContext } from '../composables/useFloorPlan';
2
+ import type { FloorArea, FloorDecor, FloorTable, FloorWall } from './MFloorPlan.vue';
3
+ type __VLS_Props = {
4
+ /** The plan: its template ref (or its `context`). Not needed inside the plan's slots */
5
+ plan?: {
6
+ context: FloorPlanContext;
7
+ } | FloorPlanContext | null;
8
+ /** Colors offered for zones: M3 color roles or CSS colors */
9
+ zoneColors?: string[];
10
+ /** Merge and split buttons */
11
+ merging?: boolean;
12
+ };
13
+ declare var __VLS_34: {
14
+ table: FloorTable;
15
+ update: (p: Partial<FloorTable>) => void;
16
+ }, __VLS_65: {
17
+ ids: (string | number)[];
18
+ }, __VLS_117: {
19
+ area: FloorArea;
20
+ update: (p: Partial<FloorArea>) => void;
21
+ }, __VLS_147: {
22
+ wall: FloorWall;
23
+ update: (p: Partial<FloorWall>) => void;
24
+ }, __VLS_198: {
25
+ item: FloorDecor;
26
+ kind: import("./MFloorPlan.vue").FloorDecorKind | undefined;
27
+ update: (p: Partial<FloorDecor>) => void;
28
+ }, __VLS_216: {};
29
+ type __VLS_Slots = {} & {
30
+ table?: (props: typeof __VLS_34) => any;
31
+ } & {
32
+ tables?: (props: typeof __VLS_65) => any;
33
+ } & {
34
+ area?: (props: typeof __VLS_117) => any;
35
+ } & {
36
+ wall?: (props: typeof __VLS_147) => any;
37
+ } & {
38
+ decor?: (props: typeof __VLS_198) => any;
39
+ } & {
40
+ empty?: (props: typeof __VLS_216) => any;
41
+ };
42
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
43
+ plan: {
44
+ context: FloorPlanContext;
45
+ } | FloorPlanContext | null;
46
+ zoneColors: string[];
47
+ merging: boolean;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;
52
+ type __VLS_WithSlots<T, S> = T & {
53
+ new (): {
54
+ $slots: S;
55
+ };
56
+ };
@@ -0,0 +1,51 @@
1
+ import { type FloorPlanContext } from '../composables/useFloorPlan';
2
+ import type { FloorTable } from './MFloorPlan.vue';
3
+ /** A table offered by the toolbar's Add a table menu */
4
+ export type FloorTablePreset = Partial<FloorTable> & {
5
+ name?: string;
6
+ };
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
10
+ /** The plan: its template ref (or its `context`). Not needed inside the plan's slots */
11
+ plan?: {
12
+ context: FloorPlanContext;
13
+ } | FloorPlanContext | null;
14
+ /** Tables offered by Add a table (name, shape, seats, size…); `[]` hides it, when your app creates tables elsewhere */
15
+ tables?: FloorTablePreset[];
16
+ /** Decor kinds offered (default: every kind the plan knows, yours included) */
17
+ decor?: string[];
18
+ /** Move / wall / zone */
19
+ tools?: boolean;
20
+ /** Undo and redo */
21
+ history?: boolean;
22
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
23
+ /** The plan: its template ref (or its `context`). Not needed inside the plan's slots */
24
+ plan?: {
25
+ context: FloorPlanContext;
26
+ } | FloorPlanContext | null;
27
+ /** Tables offered by Add a table (name, shape, seats, size…); `[]` hides it, when your app creates tables elsewhere */
28
+ tables?: FloorTablePreset[];
29
+ /** Decor kinds offered (default: every kind the plan knows, yours included) */
30
+ decor?: string[];
31
+ /** Move / wall / zone */
32
+ tools?: boolean;
33
+ /** Undo and redo */
34
+ history?: boolean;
35
+ }> & Readonly<{}>, {
36
+ history: boolean;
37
+ tools: boolean;
38
+ tables: FloorTablePreset[];
39
+ plan: {
40
+ context: FloorPlanContext;
41
+ } | FloorPlanContext | null;
42
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
43
+ default?: (props: {}) => any;
44
+ } & {
45
+ end?: (props: {}) => any;
46
+ }>;
47
+ type __VLS_WithSlots<T, S> = T & {
48
+ new (): {
49
+ $slots: S;
50
+ };
51
+ };
@@ -78,6 +78,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
78
78
  * branches, so a swipe across one still pans
79
79
  */
80
80
  edgeBranching?: boolean;
81
+ /**
82
+ * Let the browser's own context menu open on the canvas (right click, or a long press on a phone). Off by default:
83
+ * the `*-contextmenu` events still fire, for a menu of your own (MContextMenu's `showAt`). Text fields inside
84
+ * nodes always keep it, for copy and paste
85
+ */
86
+ nativeContextMenu?: boolean;
81
87
  /** The canvas's accessible name */
82
88
  label?: string;
83
89
  }, FlowContext, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -206,6 +212,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
206
212
  * branches, so a swipe across one still pans
207
213
  */
208
214
  edgeBranching?: boolean;
215
+ /**
216
+ * Let the browser's own context menu open on the canvas (right click, or a long press on a phone). Off by default:
217
+ * the `*-contextmenu` events still fire, for a menu of your own (MContextMenu's `showAt`). Text fields inside
218
+ * nodes always keep it, for copy and paste
219
+ */
220
+ nativeContextMenu?: boolean;
209
221
  /** The canvas's accessible name */
210
222
  label?: string;
211
223
  }> & Readonly<{
@@ -291,6 +303,7 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
291
303
  insertOnEdge: boolean;
292
304
  dropIntoGroups: boolean;
293
305
  edgeBranching: boolean;
306
+ nativeContextMenu: boolean;
294
307
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
295
308
  empty?: (props: {}) => any;
296
309
  } & {
@@ -0,0 +1,58 @@
1
+ import { type ComputedRef, type InjectionKey, type Ref } from 'vue';
2
+ import type { M3Locale } from './useLocale';
3
+ import type { FloorArea, FloorDecor, FloorDecorKind, FloorMerge, FloorPick, FloorStatus, FloorTable, FloorWall } from '../components/MFloorPlan.vue';
4
+ export type FloorTool = 'select' | 'wall' | 'area';
5
+ export type FloorItemKind = 'table' | 'area' | 'wall' | 'decor';
6
+ /**
7
+ * An MFloorPlan's state and actions. MFloorPlanToolbar and MFloorPlanInspector are built on it, and so can controls
8
+ * of your own: inside the plan's slots with `useFloorPlan()`, or anywhere from its template ref (`plan.context`).
9
+ * Every edit made through it is a step of the plan's undo history.
10
+ */
11
+ export interface FloorPlanContext {
12
+ tables: Ref<FloorTable[]>;
13
+ areas: Ref<FloorArea[]>;
14
+ walls: Ref<FloorWall[]>;
15
+ decor: Ref<FloorDecor[]>;
16
+ merges: Ref<FloorMerge[]>;
17
+ selection: Ref<(string | number)[]>;
18
+ picked: Ref<FloorPick>;
19
+ tool: Ref<FloorTool>;
20
+ editable: ComputedRef<boolean>;
21
+ /** A wall is being drawn (tool `wall`): finish it (also double-click / Enter) or cancel it (Escape) */
22
+ drawingWall: ComputedRef<boolean>;
23
+ finishWall(): void;
24
+ cancelWall(): void;
25
+ /** The decor kinds: built-in ones merged with `decorKinds` */
26
+ kinds: ComputedRef<Record<string, FloorDecorKind>>;
27
+ statuses: ComputedRef<Record<string, FloorStatus>>;
28
+ /** The plan's size in plan units */
29
+ size: ComputedRef<{
30
+ width: number;
31
+ height: number;
32
+ }>;
33
+ canUndo: ComputedRef<boolean>;
34
+ canRedo: ComputedRef<boolean>;
35
+ undo(): void;
36
+ redo(): void;
37
+ /** Adds a table (at the plan's middle unless placed; numbered after the highest numbered one) and selects it */
38
+ addTable(table?: Partial<FloorTable>): FloorTable;
39
+ /** Adds a decor item of a kind and picks it */
40
+ addDecor(kind: string, item?: Partial<FloorDecor>): FloorDecor;
41
+ /** Changes one item (consecutive changes to the same item within a moment are one undo step) */
42
+ update(kind: 'table', id: string | number, patch: Partial<FloorTable>): void;
43
+ update(kind: 'area', id: string | number, patch: Partial<FloorArea>): void;
44
+ update(kind: 'wall', id: string | number, patch: Partial<FloorWall>): void;
45
+ update(kind: 'decor', id: string | number, patch: Partial<FloorDecor>): void;
46
+ /** Removes what's picked (a wall's picked corner, or the whole item), or else the selected tables */
47
+ removeSelected(): void;
48
+ removeTables(ids: (string | number)[]): void;
49
+ /** Copies the selected tables, or the picked zone or decor */
50
+ duplicate(): void;
51
+ merge(ids?: (string | number)[], label?: string): FloorMerge | null;
52
+ split(idOrTable: string | number): void;
53
+ }
54
+ export declare const FLOOR_PLAN_KEY: InjectionKey<FloorPlanContext>;
55
+ /** The enclosing MFloorPlan's state and actions (inside its slots) */
56
+ export declare function useFloorPlan(): FloorPlanContext;
57
+ /** A decor kind's name: a built-in one in the app's language (unless renamed), else its label or key */
58
+ export declare function floorDecorName(kind: string, kinds: Record<string, FloorDecorKind>, locale: M3Locale): string;
@@ -343,6 +343,47 @@ export interface M3Locale {
343
343
  drawColor: string;
344
344
  floorPlan: string;
345
345
  floorSeats: string;
346
+ floorRotate: string;
347
+ floorTools: string;
348
+ floorMove: string;
349
+ floorDrawWall: string;
350
+ floorDrawZone: string;
351
+ floorAddTable: string;
352
+ floorAddDecor: string;
353
+ floorDuplicate: string;
354
+ floorDelete: string;
355
+ floorUndo: string;
356
+ floorRedo: string;
357
+ floorLabel: string;
358
+ floorSeatsField: string;
359
+ floorShape: string;
360
+ floorRound: string;
361
+ floorSquare: string;
362
+ floorLong: string;
363
+ floorAngle: string;
364
+ floorColor: string;
365
+ floorThickness: string;
366
+ floorWidth: string;
367
+ floorHeight: string;
368
+ floorMerge: string;
369
+ floorSplit: string;
370
+ floorNothingPicked: string;
371
+ floorTablesPicked: string;
372
+ floorTableN: string;
373
+ floorZone: string;
374
+ floorWall: string;
375
+ floorDeleteCorner: string;
376
+ floorFinishWall: string;
377
+ floorCancel: string;
378
+ floorDecorDoor: string;
379
+ floorDecorWindow: string;
380
+ floorDecorPlant: string;
381
+ floorDecorColumn: string;
382
+ floorDecorRestroom: string;
383
+ floorDecorKitchen: string;
384
+ floorDecorRegister: string;
385
+ floorDecorStairs: string;
386
+ floorDecorLabel: string;
346
387
  drawCustomColor: string;
347
388
  drawSize: string;
348
389
  drawUndo: string;
package/dist/draw.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as e } from "./useLocale-BpGxplLV.js";
1
+ import { i as e } from "./useLocale-CaWwi-b6.js";
2
2
  import { t } from "./MIconButton-DoNotQ9v.js";
3
- import { n, t as r } from "./MTooltip-B67ZDSGp.js";
3
+ import { n, t as r } from "./MTooltip-CodJGEO-.js";
4
4
  import { n as i, t as a } from "./MMenuItem-Bih0h4-n.js";
5
5
  import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, inject as h, mergeModels as g, mergeProps as _, nextTick as v, normalizeClass as y, normalizeStyle as b, onBeforeUnmount as x, onMounted as S, openBlock as C, provide as ee, ref as w, renderList as T, renderSlot as E, shallowRef as D, toDisplayString as te, unref as O, useId as ne, useModel as k, vModelText as re, watch as ie, withCtx as A, withDirectives as j, withKeys as ae, withModifiers as M } from "vue";
6
6
  //#region src/composables/drawGeometry.ts
@@ -392,6 +392,7 @@ var De = ["aria-label"], Oe = [
392
392
  background: { default: "none" },
393
393
  backgroundSize: { default: 24 },
394
394
  backgroundImage: {},
395
+ backgroundImageBox: {},
395
396
  penOnly: {
396
397
  type: [Boolean, String],
397
398
  default: "auto"
@@ -511,7 +512,7 @@ var De = ["aria-label"], Oe = [
511
512
  y: 0,
512
513
  width: i.pageSize.width,
513
514
  height: L(y.value - 1) + i.pageSize.height
514
- } : ge(lt.value.map((e) => he(e)));
515
+ } : ge([...lt.value.map((e) => he(e)), ...i.backgroundImage && i.backgroundImageBox ? [i.backgroundImageBox] : []]);
515
516
  if (!n) {
516
517
  N.value = {
517
518
  x: e / 2,
@@ -1045,7 +1046,7 @@ var De = ["aria-label"], Oe = [
1045
1046
  }), (e, n) => (C(), u("div", {
1046
1047
  ref_key: "root",
1047
1048
  ref: F,
1048
- class: "m3-draw-canvas relative overflow-hidden bg-surface-container outline-none select-none [touch-action:none]",
1049
+ class: "m3-draw-canvas outline-none select-none [touch-action:none]",
1049
1050
  style: b({ cursor: $t.value }),
1050
1051
  tabindex: "0",
1051
1052
  role: "application",
@@ -1111,12 +1112,13 @@ var De = ["aria-label"], Oe = [
1111
1112
  ]), d("g", { transform: `translate(${W.value.x} ${W.value.y}) scale(${W.value.zoom})` }, [
1112
1113
  R.value ? l("", !0) : (C(), u(o, { key: 0 }, [
1113
1114
  d("rect", _(Qt.value, { fill: t.paper }), null, 16, Le),
1114
- t.backgroundImage ? (C(), u("image", {
1115
+ t.backgroundImage ? (C(), u("image", _({
1115
1116
  key: 0,
1116
- href: t.backgroundImage,
1117
- x: "0",
1118
- y: "0"
1119
- }, null, 8, Re)) : l("", !0),
1117
+ href: t.backgroundImage
1118
+ }, t.backgroundImageBox ?? {
1119
+ x: 0,
1120
+ y: 0
1121
+ }, { preserveAspectRatio: "xMidYMid slice" }), null, 16, Re)) : l("", !0),
1120
1122
  t.background === "none" ? l("", !0) : (C(), u("rect", _({ key: 1 }, Qt.value, { fill: `url(#${Q}-${t.background})` }), null, 16, ze))
1121
1123
  ], 64)),
1122
1124
  (C(!0), u(o, null, T(Xt.value, (e) => (C(), u("g", {