@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.
- package/dist/API.md +215 -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 +100 -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 +2938 -1945
- 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 +235 -3
- package/src/__tests__/MFlow.test.ts +15 -0
- package/src/components/MDrawCanvas.vue +9 -3
- package/src/components/MFloorPlan.vue +586 -74
- 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
package/dist/API.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @m3ui-vue/m3ui-vue 1.3.
|
|
1
|
+
# @m3ui-vue/m3ui-vue 1.3.2 — API reference
|
|
2
2
|
|
|
3
3
|
Material Design 3 components for Vue 3 + Tailwind CSS v4. Generated from the source by
|
|
4
4
|
`scripts/generate-api.mjs`; full docs with live demos at https://m3ui.dev.
|
|
@@ -1078,6 +1078,7 @@ Props:
|
|
|
1078
1078
|
- `background?: "none" | "grid" | "dots" | "lines" = "none"` — A ruling drawn on the paper
|
|
1079
1079
|
- `backgroundSize?: number = 24` — The ruling's spacing
|
|
1080
1080
|
- `backgroundImage?: string` — An image under the drawing, to trace or annotate: fills each page, or sits at (0, 0) on an infinite canvas
|
|
1081
|
+
- `backgroundImageBox?: DrawBox` — Infinite canvas: where the background image goes and its size, in drawing units (fitView takes it in too)
|
|
1081
1082
|
- `penOnly?: boolean | "auto" = "auto"` — Fingers only pan and zoom: `true`, `false`, or `'auto'` (once a stylus has touched the canvas)
|
|
1082
1083
|
- `pressure?: boolean = true` — Use the stylus' pressure (without one, speed thins the line)
|
|
1083
1084
|
- `smoothing?: number = 0.5` — How much strokes are smoothed, 0–1
|
|
@@ -1385,7 +1386,7 @@ Slots:
|
|
|
1385
1386
|
|
|
1386
1387
|
### MFloorPlan
|
|
1387
1388
|
|
|
1388
|
-
A floor plan of tables: to arrange them (`editable`: drag one or several, snapped to a grid, arrows nudge) and to run service (each table colored by its status, with a badge, a click to open it). Merged tables are drawn as one group. Positions are plan units scaled to the component's width, so the same plan fits a phone and a wall screen. Not an M3 spec component.
|
|
1389
|
+
A floor plan of tables: to arrange them (`editable`: drag one or several, snapped to a grid, arrows nudge) and to run service (each table colored by its status, with a badge, a click to open it). Merged tables are drawn as one group. Positions are plan units scaled to the component's width, so the same plan fits a phone and a wall screen. Not an M3 spec component. Editing: drag tables (Shift-click picks several), zones (resize by any corner), walls (drag a corner once picked; double-click a wall for a new corner) and decor (resize by its corner); rotate the picked table or decor by the handle above it (15° steps, Shift for free). Arrows nudge, Delete removes what's picked (a wall's picked corner, or the selected tables), Ctrl+D duplicates, Ctrl+Z / Ctrl+Shift+Z undo and redo. `v-model:picked` says which zone, wall or decor is picked, for an inspector of your own.
|
|
1389
1390
|
|
|
1390
1391
|
Props:
|
|
1391
1392
|
- `width?: number = 1000` — The plan's size in plan units
|
|
@@ -1400,6 +1401,11 @@ Props:
|
|
|
1400
1401
|
- `grid?: number = 10` — Grid step in plan units (0: no snapping)
|
|
1401
1402
|
- `showGrid?: boolean = true` — Draw the grid while editing
|
|
1402
1403
|
- `chairs?: boolean = true` — Draw chairs from `seats`
|
|
1404
|
+
- `decorKinds?: Record<string, FloorDecorKind>` — Decor kinds of yours, or the built-in ones restyled (merged over them by name)
|
|
1405
|
+
- `rotatable?: boolean = true` — The handle that turns the picked table or decor (off when your app doesn't keep angles)
|
|
1406
|
+
- `dragMerged?: boolean = false` — Dragging (or nudging) a merged table moves its whole merge with it
|
|
1407
|
+
- `selectable?: "none" | "multiple" | "single" = "none"` — Outside editing, what a click on a table selects: nothing, one, or several (toggling; to merge them)
|
|
1408
|
+
- `canMerge?: ((ids: (string | number)[]) => string | boolean)` — Whether these tables may be merged: `true`, or `false` / a reason to refuse (shown by `merge-refused`)
|
|
1403
1409
|
- `label?: string` — Accessible name
|
|
1404
1410
|
- `tables?: FloorTable[] = []` (v-model:tables)
|
|
1405
1411
|
- `merges?: FloorMerge[] = []` (v-model:merges)
|
|
@@ -1408,8 +1414,10 @@ Props:
|
|
|
1408
1414
|
- `walls?: FloorWall[] = []` (v-model:walls)
|
|
1409
1415
|
- `decor?: FloorDecor[] = []` (v-model:decor)
|
|
1410
1416
|
- `tool?: "select" | "area" | "wall" = "select"` (v-model:tool) — While editing: `select` moves things, `wall` draws a wall (click each corner, double-click or Enter to end), `area` drags out a zone
|
|
1417
|
+
- `picked?: FloorPick = null` (v-model:picked) — While editing: the zone, wall (and corner) or decor item picked, for an inspector of your own
|
|
1411
1418
|
|
|
1412
1419
|
Events:
|
|
1420
|
+
- `split(merge: FloorMerge)`
|
|
1413
1421
|
- `update:tool(value: "select" | "area" | "wall")`
|
|
1414
1422
|
- `update:selection(value: (string | number)[])`
|
|
1415
1423
|
- `update:tables(value: FloorTable[])`
|
|
@@ -1417,11 +1425,33 @@ Events:
|
|
|
1417
1425
|
- `update:areas(value: FloorArea[])`
|
|
1418
1426
|
- `update:walls(value: FloorWall[])`
|
|
1419
1427
|
- `update:decor(value: FloorDecor[])`
|
|
1428
|
+
- `update:picked(value: FloorPick)`
|
|
1429
|
+
- `merge(merge: FloorMerge)`
|
|
1430
|
+
- `merge-refused(ids: (string | number)[], reason: string)`
|
|
1420
1431
|
- `table-click(table: FloorTable, event: MouseEvent | KeyboardEvent)` — A table was clicked or opened with Enter (not after a drag)
|
|
1421
1432
|
- `move(moved: { id: string | number; x: number; y: number; }[])` — Tables moved by a drag or the arrows, with their new positions (`{ id, x, y }[]`), to save them
|
|
1422
1433
|
|
|
1423
1434
|
Slots:
|
|
1435
|
+
- `#area { area: FloorArea; picked: boolean; scale: number; }`
|
|
1436
|
+
- `#decor { item: FloorDecor; kind: FloorDecorKind; picked: boolean; scale: number; }`
|
|
1437
|
+
- `#merge { merge: FloorMerge; tables: (string | number)[]; }`
|
|
1424
1438
|
- `#table { table: FloorTable; status: FloorStatus | undefined; selected: boolean; }` — The inside of a table: `{ table, status, selected }`
|
|
1439
|
+
- `#overlay { scale: number; toPx: (v: number) => number; }`
|
|
1440
|
+
|
|
1441
|
+
Exposed (template ref):
|
|
1442
|
+
- `context: FloorPlanContext` — Everything above and more, for MFloorPlanToolbar / MFloorPlanInspector outside the plan (`:plan="plan"`)
|
|
1443
|
+
- `addTable: (t?: Partial<FloorTable>) => FloorTable`
|
|
1444
|
+
- `addDecor: (kind: string, d?: Partial<FloorDecor>) => FloorDecor`
|
|
1445
|
+
- `update: (kind: FloorItemKind, id: string | number, patch: Record<string, unknown>) => void`
|
|
1446
|
+
- `removeSelected: () => void`
|
|
1447
|
+
- `merge: (ids?: (string | number)[], label?: string | undefined) => FloorMerge | null` — Merge tables (default: the selection) / split a merge (by its id or a table's)
|
|
1448
|
+
- `split: (idOrTable: string | number) => void`
|
|
1449
|
+
- `undo: () => void` — Undo / redo the plan's own edits (also Ctrl+Z, Ctrl+Shift+Z or Ctrl+Y)
|
|
1450
|
+
- `redo: () => void`
|
|
1451
|
+
- `canUndo: boolean`
|
|
1452
|
+
- `canRedo: boolean`
|
|
1453
|
+
- `duplicate: () => void` — Copy the selected tables, or the picked zone or decor (also Ctrl+D)
|
|
1454
|
+
- `removeTables: (ids: (string | number)[]) => void` — Remove tables, taking them out of their merges (Delete does it for the selection)
|
|
1425
1455
|
|
|
1426
1456
|
```ts
|
|
1427
1457
|
/** A table on the plan, in plan units (not pixels) */
|
|
@@ -1490,7 +1520,8 @@ export interface FloorWall {
|
|
|
1490
1520
|
/** Something on the plan that isn't a table: a door, a window, a plant, a column, the register, a text label… */
|
|
1491
1521
|
export interface FloorDecor {
|
|
1492
1522
|
id: string | number
|
|
1493
|
-
|
|
1523
|
+
/** A built-in kind, or one of yours from `decorKinds` */
|
|
1524
|
+
kind: FloorDecorBuiltin | (string & {})
|
|
1494
1525
|
x: number
|
|
1495
1526
|
y: number
|
|
1496
1527
|
width?: number
|
|
@@ -1501,6 +1532,72 @@ export interface FloorDecor {
|
|
|
1501
1532
|
}
|
|
1502
1533
|
```
|
|
1503
1534
|
|
|
1535
|
+
```ts
|
|
1536
|
+
/** What's picked on the plan besides tables: a zone, a wall (and one of its corners) or a decor item */
|
|
1537
|
+
export type FloorPick = { kind: 'area' | 'wall' | 'decor'; id: string | number; vertex?: number } | null
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
```ts
|
|
1541
|
+
/** How a decor kind looks: its default size, an icon, a shape and fill; yours or a built-in one restyled */
|
|
1542
|
+
export interface FloorDecorKind {
|
|
1543
|
+
/** Name, for the accessible label */
|
|
1544
|
+
label?: string
|
|
1545
|
+
icon?: string
|
|
1546
|
+
width: number
|
|
1547
|
+
height: number
|
|
1548
|
+
/** `box` a rounded rectangle, `round` a circle, `bar` a thin slab (doors, windows), `text` the item's label only */
|
|
1549
|
+
shape?: 'box' | 'round' | 'bar' | 'text'
|
|
1550
|
+
/** Fill: an M3 color role (`surface`, `primary`…) or any CSS color */
|
|
1551
|
+
color?: string
|
|
1552
|
+
}
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
```ts
|
|
1556
|
+
export type FloorDecorBuiltin = 'door' | 'window' | 'plant' | 'column' | 'restroom' | 'kitchen' | 'register' | 'stairs' | 'label'
|
|
1557
|
+
```
|
|
1558
|
+
|
|
1559
|
+
### MFloorPlanInspector
|
|
1560
|
+
|
|
1561
|
+
Edits what's picked on an MFloorPlan: a table (name, seats, shape, angle; split it if merged), several tables (merge them), a zone (name, color), a wall (thickness, delete a corner) or decor (text, size, angle); duplicate and delete. A slot per kind adds fields of your own below the built-in ones, with an `update` to change the item (an undo step). Inside the plan's `#overlay` slot it finds the plan by itself; anywhere else, pass the plan's template ref as `plan`. Not an M3 spec component.
|
|
1562
|
+
|
|
1563
|
+
Props:
|
|
1564
|
+
- `plan?: FloorPlanContext | { context: FloorPlanContext; } | null = null` — The plan: its template ref (or its `context`). Not needed inside the plan's slots
|
|
1565
|
+
- `zoneColors?: string[] = ["secondary", "tertiary", "primary", "success", "error"]` — Colors offered for zones: M3 color roles or CSS colors
|
|
1566
|
+
- `merging?: boolean = true` — Merge and split buttons
|
|
1567
|
+
|
|
1568
|
+
Slots:
|
|
1569
|
+
- `#table { table: FloorTable; update: (p: Partial<FloorTable>) => void; }` — Below a table's fields: `{ table, update }`
|
|
1570
|
+
- `#tables { ids: (string | number)[]; }` — Below several picked tables: `{ ids }`
|
|
1571
|
+
- `#area { area: FloorArea; update: (p: Partial<FloorArea>) => void; }` — Below a zone's fields: `{ area, update }`
|
|
1572
|
+
- `#wall { wall: FloorWall; update: (p: Partial<FloorWall>) => void; }` — Below a wall's fields: `{ wall, update }`
|
|
1573
|
+
- `#decor { item: FloorDecor; kind: FloorDecorKind | undefined; update: (p: Partial<FloorDecor>) => void; }` — Below a decor item's fields: `{ item, kind, update }`
|
|
1574
|
+
- `#empty` — When nothing is picked
|
|
1575
|
+
|
|
1576
|
+
### MFloorPlanToolbar
|
|
1577
|
+
|
|
1578
|
+
A toolbar for editing an MFloorPlan: move / draw a wall / drag out a zone, add a table (your presets) or decor (any kind, yours too), duplicate, delete, undo and redo. Inside the plan's `#overlay` slot it finds the plan by itself; anywhere else, pass the plan's template ref as `plan`. Not an M3 spec component.
|
|
1579
|
+
|
|
1580
|
+
Props:
|
|
1581
|
+
- `plan?: FloorPlanContext | { context: FloorPlanContext; } | null = null` — The plan: its template ref (or its `context`). Not needed inside the plan's slots
|
|
1582
|
+
- `tables?: FloorTablePreset[] = [
|
|
1583
|
+
{ shape: "round", seats: 2 },
|
|
1584
|
+
{ shape: "round", seats: 4 },
|
|
1585
|
+
{ shape: "square", seats: 4 },
|
|
1586
|
+
{ shape: "rect", seats: 6 },
|
|
1587
|
+
]` — Tables offered by Add a table (name, shape, seats, size…); `[]` hides it, when your app creates tables elsewhere
|
|
1588
|
+
- `decor?: string[]` — Decor kinds offered (default: every kind the plan knows, yours included)
|
|
1589
|
+
- `tools?: boolean = true` — Move / wall / zone
|
|
1590
|
+
- `history?: boolean = true` — Undo and redo
|
|
1591
|
+
|
|
1592
|
+
Slots:
|
|
1593
|
+
- `#default` — More controls at the start
|
|
1594
|
+
- `#end` — More controls at the end
|
|
1595
|
+
|
|
1596
|
+
```ts
|
|
1597
|
+
/** A table offered by the toolbar's Add a table menu */
|
|
1598
|
+
export type FloorTablePreset = Partial<FloorTable> & { name?: string }
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1504
1601
|
### MFlow
|
|
1505
1602
|
|
|
1506
1603
|
Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
@@ -1544,6 +1641,7 @@ Props:
|
|
|
1544
1641
|
- `animate?: boolean = true` — Positions spring to their new place when they change from outside
|
|
1545
1642
|
- `getId?: ((kind: "edge" | "node") => string)` — Makes ids for pasted nodes and new edges
|
|
1546
1643
|
- `edgeBranching?: boolean = false` — A drag that starts on an edge draws a new edge from the same source, a branch, as in a circuit editor (the preview leaves from where you grabbed it). A click still selects the edge; with a finger, only a selected edge branches, so a swipe across one still pans
|
|
1644
|
+
- `nativeContextMenu?: boolean = false` — Let the browser's own context menu open on the canvas (right click, or a long press on a phone). Off by default: the `*-contextmenu` events still fire, for a menu of your own (MContextMenu's `showAt`). Text fields inside nodes always keep it, for copy and paste
|
|
1547
1645
|
- `label?: string` — The canvas's accessible name
|
|
1548
1646
|
|
|
1549
1647
|
Events:
|
|
@@ -5691,6 +5789,22 @@ Sparkles that twinkle over an element, to draw the eye to something new or speci
|
|
|
5691
5789
|
vSparkle: Directive<HTMLElement, SparkleValue>
|
|
5692
5790
|
```
|
|
5693
5791
|
|
|
5792
|
+
### useFloorPlan
|
|
5793
|
+
|
|
5794
|
+
The enclosing MFloorPlan's state and actions (inside its slots)
|
|
5795
|
+
|
|
5796
|
+
```ts
|
|
5797
|
+
useFloorPlan(): FloorPlanContext
|
|
5798
|
+
```
|
|
5799
|
+
|
|
5800
|
+
### floorDecorName
|
|
5801
|
+
|
|
5802
|
+
A decor kind's name: a built-in one in the app's language (unless renamed), else its label or key
|
|
5803
|
+
|
|
5804
|
+
```ts
|
|
5805
|
+
floorDecorName(kind: string, kinds: Record<string, FloorDecorKind>, locale: M3Locale): string
|
|
5806
|
+
```
|
|
5807
|
+
|
|
5694
5808
|
### emojiCategories
|
|
5695
5809
|
|
|
5696
5810
|
```ts
|
|
@@ -7540,6 +7654,47 @@ export interface M3Locale {
|
|
|
7540
7654
|
drawColor: string
|
|
7541
7655
|
floorPlan: string
|
|
7542
7656
|
floorSeats: string
|
|
7657
|
+
floorRotate: string
|
|
7658
|
+
floorTools: string
|
|
7659
|
+
floorMove: string
|
|
7660
|
+
floorDrawWall: string
|
|
7661
|
+
floorDrawZone: string
|
|
7662
|
+
floorAddTable: string
|
|
7663
|
+
floorAddDecor: string
|
|
7664
|
+
floorDuplicate: string
|
|
7665
|
+
floorDelete: string
|
|
7666
|
+
floorUndo: string
|
|
7667
|
+
floorRedo: string
|
|
7668
|
+
floorLabel: string
|
|
7669
|
+
floorSeatsField: string
|
|
7670
|
+
floorShape: string
|
|
7671
|
+
floorRound: string
|
|
7672
|
+
floorSquare: string
|
|
7673
|
+
floorLong: string
|
|
7674
|
+
floorAngle: string
|
|
7675
|
+
floorColor: string
|
|
7676
|
+
floorThickness: string
|
|
7677
|
+
floorWidth: string
|
|
7678
|
+
floorHeight: string
|
|
7679
|
+
floorMerge: string
|
|
7680
|
+
floorSplit: string
|
|
7681
|
+
floorNothingPicked: string
|
|
7682
|
+
floorTablesPicked: string
|
|
7683
|
+
floorTableN: string
|
|
7684
|
+
floorZone: string
|
|
7685
|
+
floorWall: string
|
|
7686
|
+
floorDeleteCorner: string
|
|
7687
|
+
floorFinishWall: string
|
|
7688
|
+
floorCancel: string
|
|
7689
|
+
floorDecorDoor: string
|
|
7690
|
+
floorDecorWindow: string
|
|
7691
|
+
floorDecorPlant: string
|
|
7692
|
+
floorDecorColumn: string
|
|
7693
|
+
floorDecorRestroom: string
|
|
7694
|
+
floorDecorKitchen: string
|
|
7695
|
+
floorDecorRegister: string
|
|
7696
|
+
floorDecorStairs: string
|
|
7697
|
+
floorDecorLabel: string
|
|
7543
7698
|
drawCustomColor: string
|
|
7544
7699
|
drawSize: string
|
|
7545
7700
|
drawUndo: string
|
|
@@ -7910,6 +8065,62 @@ export interface SparkleOptions {
|
|
|
7910
8065
|
export type SparkleValue = boolean | string | SparkleOptions | null | undefined
|
|
7911
8066
|
```
|
|
7912
8067
|
|
|
8068
|
+
```ts
|
|
8069
|
+
/**
|
|
8070
|
+
* An MFloorPlan's state and actions. MFloorPlanToolbar and MFloorPlanInspector are built on it, and so can controls
|
|
8071
|
+
* of your own: inside the plan's slots with `useFloorPlan()`, or anywhere from its template ref (`plan.context`).
|
|
8072
|
+
* Every edit made through it is a step of the plan's undo history.
|
|
8073
|
+
*/
|
|
8074
|
+
export interface FloorPlanContext {
|
|
8075
|
+
tables: Ref<FloorTable[]>
|
|
8076
|
+
areas: Ref<FloorArea[]>
|
|
8077
|
+
walls: Ref<FloorWall[]>
|
|
8078
|
+
decor: Ref<FloorDecor[]>
|
|
8079
|
+
merges: Ref<FloorMerge[]>
|
|
8080
|
+
selection: Ref<(string | number)[]>
|
|
8081
|
+
picked: Ref<FloorPick>
|
|
8082
|
+
tool: Ref<FloorTool>
|
|
8083
|
+
editable: ComputedRef<boolean>
|
|
8084
|
+
/** A wall is being drawn (tool `wall`): finish it (also double-click / Enter) or cancel it (Escape) */
|
|
8085
|
+
drawingWall: ComputedRef<boolean>
|
|
8086
|
+
finishWall(): void
|
|
8087
|
+
cancelWall(): void
|
|
8088
|
+
/** The decor kinds: built-in ones merged with `decorKinds` */
|
|
8089
|
+
kinds: ComputedRef<Record<string, FloorDecorKind>>
|
|
8090
|
+
statuses: ComputedRef<Record<string, FloorStatus>>
|
|
8091
|
+
/** The plan's size in plan units */
|
|
8092
|
+
size: ComputedRef<{ width: number; height: number }>
|
|
8093
|
+
canUndo: ComputedRef<boolean>
|
|
8094
|
+
canRedo: ComputedRef<boolean>
|
|
8095
|
+
undo(): void
|
|
8096
|
+
redo(): void
|
|
8097
|
+
/** Adds a table (at the plan's middle unless placed; numbered after the highest numbered one) and selects it */
|
|
8098
|
+
addTable(table?: Partial<FloorTable>): FloorTable
|
|
8099
|
+
/** Adds a decor item of a kind and picks it */
|
|
8100
|
+
addDecor(kind: string, item?: Partial<FloorDecor>): FloorDecor
|
|
8101
|
+
/** Changes one item (consecutive changes to the same item within a moment are one undo step) */
|
|
8102
|
+
update(kind: 'table', id: string | number, patch: Partial<FloorTable>): void
|
|
8103
|
+
update(kind: 'area', id: string | number, patch: Partial<FloorArea>): void
|
|
8104
|
+
update(kind: 'wall', id: string | number, patch: Partial<FloorWall>): void
|
|
8105
|
+
update(kind: 'decor', id: string | number, patch: Partial<FloorDecor>): void
|
|
8106
|
+
/** Removes what's picked (a wall's picked corner, or the whole item), or else the selected tables */
|
|
8107
|
+
removeSelected(): void
|
|
8108
|
+
removeTables(ids: (string | number)[]): void
|
|
8109
|
+
/** Copies the selected tables, or the picked zone or decor */
|
|
8110
|
+
duplicate(): void
|
|
8111
|
+
merge(ids?: (string | number)[], label?: string): FloorMerge | null
|
|
8112
|
+
split(idOrTable: string | number): void
|
|
8113
|
+
}
|
|
8114
|
+
```
|
|
8115
|
+
|
|
8116
|
+
```ts
|
|
8117
|
+
export type FloorTool = 'select' | 'wall' | 'area'
|
|
8118
|
+
```
|
|
8119
|
+
|
|
8120
|
+
```ts
|
|
8121
|
+
export type FloorItemKind = 'table' | 'area' | 'wall' | 'decor'
|
|
8122
|
+
```
|
|
8123
|
+
|
|
7913
8124
|
```ts
|
|
7914
8125
|
// Generated by scripts/generate-emoji-data.mjs from Unicode emoji-test.txt (Emoji 15). Don't edit by hand.
|
|
7915
8126
|
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
@@ -7928,7 +8139,7 @@ export interface EmojiCategory {
|
|
|
7928
8139
|
`M3Locale` keys (pass a partial object to `createM3UI({ locale })`; presets from `@m3ui-vue/m3ui-vue/locales`:
|
|
7929
8140
|
`esLocale`, `frLocale`, `ptLocale`, `deLocale`, `jaLocale`, `zhLocale`, `koLocale`):
|
|
7930
8141
|
|
|
7931
|
-
lang, search, noResults, close, cancel, confirm, loading, menu, previous, next, today, more, selectedCount, recordCount, expand, collapse, clear, columns, exportCsv, noGroup, finish, dropText, selectText, maxSizePrefix, remove, selectDate, ok, dateToggleInput, dateToggleCalendar, dateInputLabel, selectTime, timeHourSelection, timeMinuteSelection, timePeriodToggle, timeToggleKeyboard, timeToggleDial, timeToggleScroll, sheetExpand, sheetCollapse, sheetDismiss, seekBar, seekBarValue, seekBarShowRemaining, seekBarShowDuration, selectRange, pickStart, pickEnd, previousMonth, nextMonth, selectColor, colorHue, colorSaturation, colorBrightness, colorAlpha, colorEyedropper, colorOriginal, colorFormat, colorRecent, colorPresets, dayView, weekView, allDay, emojiSearch, emojiNoResults, emojiRecent, emojiSkinTone, emojiSkinTones, emojiCategorySmileys, emojiCategoryGestures, emojiCategoryPeople, emojiCategoryAnimals, emojiCategoryNature, emojiCategoryFood, emojiCategoryActivities, emojiCategoryTravel, emojiCategoryObjects, emojiCategorySymbols, emojiCategoryFlags, available, selected, noItems, moveAllRight, moveRight, moveLeft, moveAllLeft, searchCommand, navigateHint, selectHint, openHint, closeHint, loadingMore, noMoreItems, bold, italic, underline, strikethrough, highlight, bulletList, orderedList, blockquote, code, alignLeft, alignCenter, alignRight, undo, redo, link, image, paragraph, heading1, heading2, heading3, insertLink, insertImage, imageUrlLabel, insert, jsonValid, jsonInvalid, jsonFormat, jsonMinify, jsonElements, jsonFields, resultSuccessTitle, resultSuccessDesc, resultErrorTitle, resultErrorDesc, resultWarningTitle, resultWarningDesc, resultInfoTitle, resultInfoDesc, result404Title, result404Desc, result403Title, result403Desc, result500Title, result500Desc, chatTyping, chatRecordingAudio, reorderHandle, reorderGrabbed, reorderMoved, reorderDropped, reorderCancelled, selectAll, clearSearch, kanbanMoved, windowMinimize, windowMaximize, windowRestore, paginationRange, paginationPage, previousPage, nextPage, carousel, carouselItem, sparklineSummary, sliderRangeStart, sliderRangeEnd, mapTitle, mapMarker, mapZoomIn, mapZoomOut, mapResetBearing, mapFindMyLocation, mapLocationNotAvailable, mapEnterFullscreen, mapExitFullscreen, mapToggleAttribution, mapFeedback, mapCtrlScroll, mapCmdScroll, mapTwoFingers, mapLayers, mapSearchLayers, mapNoLayers, mapShowLayer, mapHideLayer, mapOpacity, mapDownload, mapNoBaseLayer, mapHoverInfo, mapNoValue, mapMeasureDistance, mapMeasureArea, mapClearMeasurements, mapDeleteMeasurement, mapTotal, mapSearchPlaces, timelineShowMore, timelineShowLess, mediaPlayer, mediaPlay, mediaPause, mediaReplay, mediaSeekBack, mediaSeekForward, mediaSeconds, mediaMute, mediaUnmute, mediaVolume, mediaFullscreen, mediaExitFullscreen, mediaPictureInPicture, mediaSettings, mediaSpeed, mediaSpeedNormal, mediaSubtitles, mediaSubtitlesOff, mediaQuality, mediaQualityAuto, mediaLive, mediaError, mediaRepeat, mediaRepeatOne, mediaShuffle, pdfViewer, pdfThumbnails, pdfOutline, pdfPage, pdfZoom, pdfZoomIn, pdfZoomOut, pdfFitWidth, pdfFitPage, pdfSearch, pdfSearchPrevious, pdfSearchNext, pdfMatchCount, pdfNoMatches, pdfMore, pdfRotate, pdfDownload, pdfPrint, pdfFullscreen, pdfExitFullscreen, pdfPassword, pdfPasswordLabel, pdfWrongPassword, pdfOpen, pdfError, pdfLoading, pdfAnnotate, pdfSelect, pdfHighlight, pdfNote, pdfDraw, pdfEraser, pdfInkWidth, pdfColor, pdfUndo, pdfCopy, pdfDelete, pdfNotePlaceholder, pdfAddComment, flowCanvas, flowNode, flowEdge, flowZoomIn, flowZoomOut, flowFitView, flowLock, flowUnlock, flowUndo, flowRedo, flowMinimap, flowMoved, flowConnected, flowDeleted, flowDeleteEdge, flowDelete, ganttChart, ganttTask, ganttStart, ganttEnd, ganttDuration, ganttProgress, ganttDays, ganttHours, ganttMilestone, ganttQuarter, ganttToday, ganttZoomIn, ganttZoomOut, ganttExpandAll, ganttCollapseAll, ganttExpand, ganttCollapse, ganttUndo, ganttRedo, ganttScaleHour, ganttScaleDay, ganttScaleWeek, ganttScaleMonth, ganttScaleQuarter, ganttScaleYear, ganttMoved, ganttProgressSet, ganttLinked, ganttUnlink, ganttDeleted, ganttDelete, ganttReordered, ganttSlack, ganttCritical, ganttBaseline, ganttEmpty, ganttResize, timelineResource, timelineConflict, timelineMoved, timelineEmpty, cropArea, cropRotateLeft, cropRotateRight, cropFlip, cropReset, cropFree, drawCanvas, drawTools, drawMore, drawSelect, drawPan, drawPen, drawBrush, drawMarker, drawHighlighter, drawEraser, drawStrokeEraser, drawLine, drawArrow, drawRect, drawEllipse, drawText, drawFill, drawColor, floorPlan, floorSeats, drawCustomColor, drawSize, drawUndo, drawRedo, drawDelete, drawLayers, drawLayer, drawLayerName, drawAddLayer, drawDeleteLayer, drawShowLayer, drawHideLayer, drawLockLayer, drawUnlockLayer, drawLayerUp, drawLayerDown
|
|
8142
|
+
lang, search, noResults, close, cancel, confirm, loading, menu, previous, next, today, more, selectedCount, recordCount, expand, collapse, clear, columns, exportCsv, noGroup, finish, dropText, selectText, maxSizePrefix, remove, selectDate, ok, dateToggleInput, dateToggleCalendar, dateInputLabel, selectTime, timeHourSelection, timeMinuteSelection, timePeriodToggle, timeToggleKeyboard, timeToggleDial, timeToggleScroll, sheetExpand, sheetCollapse, sheetDismiss, seekBar, seekBarValue, seekBarShowRemaining, seekBarShowDuration, selectRange, pickStart, pickEnd, previousMonth, nextMonth, selectColor, colorHue, colorSaturation, colorBrightness, colorAlpha, colorEyedropper, colorOriginal, colorFormat, colorRecent, colorPresets, dayView, weekView, allDay, emojiSearch, emojiNoResults, emojiRecent, emojiSkinTone, emojiSkinTones, emojiCategorySmileys, emojiCategoryGestures, emojiCategoryPeople, emojiCategoryAnimals, emojiCategoryNature, emojiCategoryFood, emojiCategoryActivities, emojiCategoryTravel, emojiCategoryObjects, emojiCategorySymbols, emojiCategoryFlags, available, selected, noItems, moveAllRight, moveRight, moveLeft, moveAllLeft, searchCommand, navigateHint, selectHint, openHint, closeHint, loadingMore, noMoreItems, bold, italic, underline, strikethrough, highlight, bulletList, orderedList, blockquote, code, alignLeft, alignCenter, alignRight, undo, redo, link, image, paragraph, heading1, heading2, heading3, insertLink, insertImage, imageUrlLabel, insert, jsonValid, jsonInvalid, jsonFormat, jsonMinify, jsonElements, jsonFields, resultSuccessTitle, resultSuccessDesc, resultErrorTitle, resultErrorDesc, resultWarningTitle, resultWarningDesc, resultInfoTitle, resultInfoDesc, result404Title, result404Desc, result403Title, result403Desc, result500Title, result500Desc, chatTyping, chatRecordingAudio, reorderHandle, reorderGrabbed, reorderMoved, reorderDropped, reorderCancelled, selectAll, clearSearch, kanbanMoved, windowMinimize, windowMaximize, windowRestore, paginationRange, paginationPage, previousPage, nextPage, carousel, carouselItem, sparklineSummary, sliderRangeStart, sliderRangeEnd, mapTitle, mapMarker, mapZoomIn, mapZoomOut, mapResetBearing, mapFindMyLocation, mapLocationNotAvailable, mapEnterFullscreen, mapExitFullscreen, mapToggleAttribution, mapFeedback, mapCtrlScroll, mapCmdScroll, mapTwoFingers, mapLayers, mapSearchLayers, mapNoLayers, mapShowLayer, mapHideLayer, mapOpacity, mapDownload, mapNoBaseLayer, mapHoverInfo, mapNoValue, mapMeasureDistance, mapMeasureArea, mapClearMeasurements, mapDeleteMeasurement, mapTotal, mapSearchPlaces, timelineShowMore, timelineShowLess, mediaPlayer, mediaPlay, mediaPause, mediaReplay, mediaSeekBack, mediaSeekForward, mediaSeconds, mediaMute, mediaUnmute, mediaVolume, mediaFullscreen, mediaExitFullscreen, mediaPictureInPicture, mediaSettings, mediaSpeed, mediaSpeedNormal, mediaSubtitles, mediaSubtitlesOff, mediaQuality, mediaQualityAuto, mediaLive, mediaError, mediaRepeat, mediaRepeatOne, mediaShuffle, pdfViewer, pdfThumbnails, pdfOutline, pdfPage, pdfZoom, pdfZoomIn, pdfZoomOut, pdfFitWidth, pdfFitPage, pdfSearch, pdfSearchPrevious, pdfSearchNext, pdfMatchCount, pdfNoMatches, pdfMore, pdfRotate, pdfDownload, pdfPrint, pdfFullscreen, pdfExitFullscreen, pdfPassword, pdfPasswordLabel, pdfWrongPassword, pdfOpen, pdfError, pdfLoading, pdfAnnotate, pdfSelect, pdfHighlight, pdfNote, pdfDraw, pdfEraser, pdfInkWidth, pdfColor, pdfUndo, pdfCopy, pdfDelete, pdfNotePlaceholder, pdfAddComment, flowCanvas, flowNode, flowEdge, flowZoomIn, flowZoomOut, flowFitView, flowLock, flowUnlock, flowUndo, flowRedo, flowMinimap, flowMoved, flowConnected, flowDeleted, flowDeleteEdge, flowDelete, ganttChart, ganttTask, ganttStart, ganttEnd, ganttDuration, ganttProgress, ganttDays, ganttHours, ganttMilestone, ganttQuarter, ganttToday, ganttZoomIn, ganttZoomOut, ganttExpandAll, ganttCollapseAll, ganttExpand, ganttCollapse, ganttUndo, ganttRedo, ganttScaleHour, ganttScaleDay, ganttScaleWeek, ganttScaleMonth, ganttScaleQuarter, ganttScaleYear, ganttMoved, ganttProgressSet, ganttLinked, ganttUnlink, ganttDeleted, ganttDelete, ganttReordered, ganttSlack, ganttCritical, ganttBaseline, ganttEmpty, ganttResize, timelineResource, timelineConflict, timelineMoved, timelineEmpty, cropArea, cropRotateLeft, cropRotateRight, cropFlip, cropReset, cropFree, drawCanvas, drawTools, drawMore, drawSelect, drawPan, drawPen, drawBrush, drawMarker, drawHighlighter, drawEraser, drawStrokeEraser, drawLine, drawArrow, drawRect, drawEllipse, drawText, drawFill, drawColor, floorPlan, floorSeats, floorRotate, floorTools, floorMove, floorDrawWall, floorDrawZone, floorAddTable, floorAddDecor, floorDuplicate, floorDelete, floorUndo, floorRedo, floorLabel, floorSeatsField, floorShape, floorRound, floorSquare, floorLong, floorAngle, floorColor, floorThickness, floorWidth, floorHeight, floorMerge, floorSplit, floorNothingPicked, floorTablesPicked, floorTableN, floorZone, floorWall, floorDeleteCorner, floorFinishWall, floorCancel, floorDecorDoor, floorDecorWindow, floorDecorPlant, floorDecorColumn, floorDecorRestroom, floorDecorKitchen, floorDecorRegister, floorDecorStairs, floorDecorLabel, drawCustomColor, drawSize, drawUndo, drawRedo, drawDelete, drawLayers, drawLayer, drawLayerName, drawAddLayer, drawDeleteLayer, drawShowLayer, drawHideLayer, drawLockLayer, drawUnlockLayer, drawLayerUp, drawLayerDown
|
|
7932
8143
|
|
|
7933
8144
|
## Theme tokens
|
|
7934
8145
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as e } from "./MIconButton-DoNotQ9v.js";
|
|
2
2
|
import { t } from "./MIcon-Bxh9j135.js";
|
|
3
|
-
import { t as n } from "./MSpinner-
|
|
3
|
+
import { t as n } from "./MSpinner-C2SUnWk4.js";
|
|
4
4
|
import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, renderSlot as f, resolveDynamicComponent as p, unref as m, withCtx as h, withDirectives as g } from "vue";
|
|
5
5
|
//#region src/components/MButton.vue?vue&type=script&setup=true&lang.ts
|
|
6
6
|
var _ = "relative inline-flex items-center justify-center font-medium whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 before:content-[''] before:pointer-events-none before:absolute before:inset-0 before:bg-current before:opacity-0 before:transition-opacity before:duration-150 enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]", v = /* @__PURE__ */ c({
|
|
@@ -169,4 +169,4 @@ var _ = "relative inline-flex items-center justify-center font-medium whitespace
|
|
|
169
169
|
//#endregion
|
|
170
170
|
export { v as t };
|
|
171
171
|
|
|
172
|
-
//# sourceMappingURL=MButton-
|
|
172
|
+
//# sourceMappingURL=MButton-Bl_BSUep.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MButton-CuNzpoxm.js","names":[],"sources":["../src/components/MButton.vue","../src/components/MButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":";;;;;AAkGA,IAAM,IACJ;;;;;;;;;;;;;;;;;;;;;;;;EAxFF,IAAM,IAAe,CAAC,WAAW,OAAO,GAGlC,IAAQ,GA0DR,IAAM,QAAe,EAAM,KAAK,eAAe,QAAQ,GAEvD,I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EAAA,QAAA,SAAA;IACQ,EAAA,YAAO,cAAvB,EAAA,GAAA,EAGW,GAAA,EAAA,KAAA,EAAA,GAAA,CAFO,EAAA,WAAhB,EAAA,GAAA,EAA+C,GAAA;;KAArB,MAAM,EAAA;IACd,GAAA,MAAA,GAAA,CAAA,MAAA,CAAA,KAAA,EAAA,QAAlB,EAAA,GAAA,EAA6E,GAAA;;KAApD,MAAM,EAAA;KAAO,MAAM,EAAA;KAAW,QAAQ,EAAA;;;;;;;;;;;;;;EAT3C,CAAA,IAAA,CAAA,CAAA,EAAA,CAAA,GAAA;GAAA,UAAA,EAAA,YAAY,EAAA;GAAO,OAAS,EAAA;EAAW,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"MButton-Bl_BSUep.js","names":[],"sources":["../src/components/MButton.vue","../src/components/MButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n","<script setup lang=\"ts\">\n/**\n * The standard M3 button — five variants, five expressive size tiers, and either color.\n *\n * @slot default The button's label.\n */\nimport { computed } from 'vue'\nimport MSpinner from './MSpinner.vue'\nimport MIcon from './MIcon.vue'\nimport { vRipple } from '../directives/vRipple'\n\nconst NAMED_COLORS = ['primary', 'error'] as const\ntype NamedColor = (typeof NAMED_COLORS)[number]\n\nconst props = withDefaults(\n defineProps<{\n /** Visual style of the button */\n variant?: 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated'\n /**\n * Named semantic color ('primary' | 'error') OR any CSS color string\n * ('red', '#e91e63', 'oklch(0.6 0.2 0)', …).\n * When a CSS color is passed, --color-primary is overridden for this button.\n */\n color?: string\n /** HTML button type */\n type?: 'button' | 'submit' | 'reset'\n /** Disables interaction */\n disabled?: boolean\n /** Shows a spinner and disables the button */\n loading?: boolean\n /** Material Symbol icon name shown next to the label */\n icon?: string\n /** Draw the icon filled (Material Symbols' FILL axis), e.g. a starred star or a play icon */\n iconFilled?: boolean\n /** Which side of the label the icon renders on */\n // Which side of the label `icon` renders on. Real M3 buttons support both via\n // `ButtonDefaults.contentPaddingFor(hasStartIcon/hasEndIcon)` — padding ends up identical\n // either way at every tier, so this only changes render order, not spacing.\n iconPos?: 'leading' | 'trailing'\n /**\n * M3's 5-tier expressive button sizing (xs: 32px, sm: 40px, md: 56px, lg: 96px, xl: 136px) — lg/xl are\n * meant for hero-style prominent buttons, not everyday UI\n */\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n /**\n * Button shape — rounded (pill, always) or squared (corner radius scales with size: 12px xs/sm, 16px md,\n * 28px lg/xl)\n */\n shape?: 'rounded' | 'squared'\n /** Vue Router destination — renders as RouterLink instead of button */\n to?: string | Record<string, any>\n /** Any CSS color for the press ripple; defaults to the button's content color */\n rippleColor?: string\n /**\n * Label and icon color, over what the variant and `color` give: an M3 role (`on-surface` for a neutral text\n * button, `on-primary-container`…) or any CSS color (`#000` on a white filled button). Disabled buttons keep\n * their own\n */\n contentColor?: string\n }>(),\n {\n variant: 'filled',\n color: 'primary',\n type: 'button',\n disabled: false,\n loading: false,\n iconPos: 'leading',\n size: 'sm',\n shape: 'rounded',\n },\n)\n\nconst tag = computed(() => props.to ? 'RouterLink' : 'button')\n\nconst isCustomColor = computed(\n () => !!props.color && !(NAMED_COLORS as readonly string[]).includes(props.color),\n)\n\nconst customStyle = computed(() => {\n if (!isCustomColor.value) return undefined\n return {\n '--color-primary': props.color,\n '--color-on-primary': '#ffffff',\n '--color-primary-container': props.color + '33',\n '--color-on-primary-container': props.color,\n }\n})\n\nconst isError = computed(() => props.color === 'error')\n\n// Color-role names (`on-surface`, `secondary-container`…) read the theme's token; anything else is a CSS color\nconst ROLE = /^(on-)?(primary|secondary|tertiary|error|surface|surface-variant|inverse-surface|inverse-primary)(-container|-variant)?$/\nconst style = computed(() => {\n const c = props.contentColor\n if (!c || props.disabled || props.loading) return customStyle.value\n return { ...customStyle.value, color: ROLE.test(c) ? `var(--color-${c})` : c }\n})\n\nconst base =\n 'relative inline-flex items-center justify-center font-medium ' +\n 'whitespace-nowrap overflow-hidden transition-[box-shadow,background-color,color] duration-150 select-none cursor-pointer ' +\n 'disabled:cursor-not-allowed disabled:shadow-none disabled:text-on-surface/38 ' +\n \"before:content-[''] before:pointer-events-none before:absolute before:inset-0 \" +\n 'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +\n 'enabled:hover:before:opacity-[0.08] enabled:active:before:opacity-[0.12]'\n\n// M3 disabled tokens: container at 10% on-surface opacity (DisabledContainerOpacity, same\n// across Filled/Tonal/Elevated), content/label always at 38% on-surface (handled in `base`\n// above, applies to every variant including text/elevated which have no container). The\n// outlined border uses the SAME color role as its enabled border (OutlineVariant, not\n// on-surface) just dimmed to that 10% too — see `variantClasses`' outlined case below for\n// why the enabled color is also outline-variant, not outline.\nconst disabledContainerClasses = computed(() => {\n switch (props.variant) {\n case 'filled':\n case 'tonal':\n case 'elevated':\n return 'disabled:bg-on-surface/10'\n case 'outlined':\n return isError.value ? 'disabled:border-error/10' : 'disabled:border-outline-variant/10'\n default:\n return ''\n }\n})\n\n/*\n * M3's newer 5-tier \"expressive\" button sizing (Button{XSmall,Small,Medium,Large,\n * XLarge}Tokens.kt + Button.kt's size-variant overloads — @ExperimentalMaterial3ExpressiveApi\n * in Compose, but this `size` prop is deliberately implementing exactly that system, same\n * as MFabMenu/MLoadingIndicator already do for other Expressive-only components). Content\n * padding is IDENTICAL whether or not an icon is present at every tier in the default\n * (non \"precision pointer\") mode — e.g. `IconMediumLeadingPadding = MediumLeadingPadding`\n * verbatim in the real source — so there's deliberately no separate icon-vs-no-icon padding\n * split here, unlike the old version of this file which had one (and got the values wrong\n * in both directions). `gap` between icon and label also varies by tier (IconLabelSpace),\n * not a flat value for every size.\n */\nconst sizeMap = {\n xs: { h: 'h-8', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-1', px: 'px-3', pxText: 'px-2', squareRadius: 'rounded-md' },\n sm: { h: 'h-10', text: 'text-label-large', icon: 20, spinner: 16, gap: 'gap-2', px: 'px-4', pxText: 'px-3', squareRadius: 'rounded-md' },\n md: { h: 'h-14', text: 'text-title-medium', icon: 24, spinner: 18, gap: 'gap-2', px: 'px-6', pxText: 'px-3', squareRadius: 'rounded-lg' },\n lg: { h: 'h-24', text: 'text-headline-small', icon: 32, spinner: 26, gap: 'gap-3', px: 'px-12', pxText: 'px-4', squareRadius: 'rounded-xl' },\n xl: { h: 'h-[136px]', text: 'text-headline-large', icon: 40, spinner: 34, gap: 'gap-4', px: 'px-16', pxText: 'px-4', squareRadius: 'rounded-xl' },\n}\n\nconst s = computed(() => sizeMap[props.size] ?? sizeMap.sm)\nconst sizeClasses = computed(() => `${s.value.h} ${s.value.text} ${s.value.gap}`)\nconst iconSize = computed(() => s.value.icon)\nconst spinnerSize = computed(() => s.value.spinner)\n\nconst px = computed(() => props.variant === 'text' ? s.value.pxText : s.value.px)\n\n// Squared shape radius scales with size, matching each tier's own ContainerShapeSquare\n// token (ButtonXSmallTokens/ButtonSmallTokens use CornerMedium=12px, ButtonMediumTokens\n// CornerLarge=16px, ButtonLargeTokens/ButtonXLargeTokens CornerExtraLarge=28px) — the\n// pill (ContainerShapeRound) is CornerFull at every tier, so that half doesn't vary.\nconst shapeClass = computed(() => props.shape === 'squared' ? s.value.squareRadius : 'rounded-full')\n\nconst variantClasses = computed(() => {\n const err = isError.value\n switch (props.variant) {\n case 'filled':\n return err\n ? 'bg-error text-on-error enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-primary text-on-primary enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'tonal':\n return err\n ? 'bg-error-container text-on-error-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n : 'bg-secondary-container text-on-secondary-container enabled:hover:shadow-elevation-1 enabled:active:shadow-none'\n case 'elevated':\n return err\n ? 'bg-surface-container-low text-error shadow-elevation-1 enabled:hover:shadow-elevation-2'\n : 'bg-surface-container-low text-primary shadow-elevation-1 enabled:hover:shadow-elevation-2'\n case 'outlined':\n // OutlinedButtonTokens.OutlineColor = ColorSchemeKeyTokens.OutlineVariant, not Outline\n return err\n ? 'border border-error text-error'\n : 'border border-outline-variant text-primary'\n case 'text':\n return err\n ? 'text-error'\n : 'text-primary'\n default:\n return ''\n }\n})\n</script>\n\n<template>\n <component\n :is=\"tag\"\n :to=\"to || undefined\"\n :type=\"to ? undefined : type\"\n :disabled=\"disabled || loading\"\n :class=\"[base, shapeClass, sizeClasses, px, variantClasses, disabledContainerClasses]\"\n :style=\"style\"\n v-ripple=\"{ disabled: disabled || loading, color: rippleColor }\"\n >\n <template v-if=\"iconPos === 'leading'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n <slot />\n <template v-if=\"iconPos === 'trailing'\">\n <MSpinner v-if=\"loading\" :size=\"spinnerSize\" />\n <MIcon v-else-if=\"icon\" :name=\"icon\" :size=\"iconSize\" :filled=\"iconFilled\" />\n </template>\n </component>\n</template>\n"],"mappings":";;;;;AAkGA,IAAM,IACJ;;;;;;;;;;;;;;;;;;;;;;;;EAxFF,IAAM,IAAe,CAAC,WAAW,OAAO,GAGlC,IAAQ,GA0DR,IAAM,QAAe,EAAM,KAAK,eAAe,QAAQ,GAEvD,IAAgB,QACd,CAAC,CAAC,EAAM,SAAS,CAAE,EAAmC,SAAS,EAAM,KAAK,CAClF,GAEM,IAAc,QAAe;GAC5B,MAAc,OACnB,OAAO;IACL,mBAAmB,EAAM;IACzB,sBAAsB;IACtB,6BAA6B,EAAM,QAAQ;IAC3C,gCAAgC,EAAM;GACxC;EACF,CAAC,GAEK,IAAU,QAAe,EAAM,UAAU,OAAO,GAGhD,IAAO,4HACP,IAAQ,QAAe;GAC3B,IAAM,IAAI,EAAM;GAEhB,OADI,CAAC,KAAK,EAAM,YAAY,EAAM,UAAgB,EAAY,QACvD;IAAE,GAAG,EAAY;IAAO,OAAO,E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S,EAAA;EAAW,CAAA,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e } from "./useLocale-
|
|
1
|
+
import { i as e } from "./useLocale-CaWwi-b6.js";
|
|
2
2
|
import { t } from "./MIconButton-DoNotQ9v.js";
|
|
3
3
|
import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
|
|
4
4
|
import { t as r } from "./_useEscapeStack-CjndQhqg.js";
|
|
@@ -170,4 +170,4 @@ var F = ["aria-labelledby", "aria-label"], I = {
|
|
|
170
170
|
//#endregion
|
|
171
171
|
export { P as n, q as t };
|
|
172
172
|
|
|
173
|
-
//# sourceMappingURL=MDialog-
|
|
173
|
+
//# sourceMappingURL=MDialog-D_Yik8ou.js.map
|