@m3ui-vue/m3ui-vue 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +213 -4
- package/dist/{MButton-CuNzpoxm.js → MButton-Bl_BSUep.js} +2 -2
- package/dist/{MButton-CuNzpoxm.js.map → MButton-Bl_BSUep.js.map} +1 -1
- package/dist/{MDialog-HxEL-m58.js → MDialog-D_Yik8ou.js} +2 -2
- package/dist/{MDialog-HxEL-m58.js.map → MDialog-D_Yik8ou.js.map} +1 -1
- package/dist/{MListItem-DnPtv-hY.js → MListItem-BxifHJdU.js} +2 -2
- package/dist/{MListItem-DnPtv-hY.js.map → MListItem-BxifHJdU.js.map} +1 -1
- package/dist/{MLoadingIndicator-BQMNX6Dx.js → MLoadingIndicator-BxbFhSX6.js} +2 -2
- package/dist/{MLoadingIndicator-BQMNX6Dx.js.map → MLoadingIndicator-BxbFhSX6.js.map} +1 -1
- package/dist/{MSeekBar-LURE1Ah7.js → MSeekBar-BeN9QcB3.js} +2 -2
- package/dist/{MSeekBar-LURE1Ah7.js.map → MSeekBar-BeN9QcB3.js.map} +1 -1
- package/dist/{MSlider-_J4IS2_z.js → MSlider-BVSbJlGS.js} +2 -2
- package/dist/{MSlider-_J4IS2_z.js.map → MSlider-BVSbJlGS.js.map} +1 -1
- package/dist/{MSpinner-BhkMYKOM.js → MSpinner-C2SUnWk4.js} +2 -2
- package/dist/{MSpinner-BhkMYKOM.js.map → MSpinner-C2SUnWk4.js.map} +1 -1
- package/dist/{MTextField-CkzwNBWS.js → MTextField-CEkWSZ2v.js} +2 -2
- package/dist/{MTextField-CkzwNBWS.js.map → MTextField-CEkWSZ2v.js.map} +1 -1
- package/dist/{MTooltip-B67ZDSGp.js → MTooltip-CodJGEO-.js} +4 -4
- package/dist/{MTooltip-B67ZDSGp.js.map → MTooltip-CodJGEO-.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +3 -1
- package/dist/components/MFloorPlan.vue.d.ts +90 -2
- package/dist/components/MFloorPlanInspector.vue.d.ts +56 -0
- package/dist/components/MFloorPlanToolbar.vue.d.ts +51 -0
- package/dist/components/MFlow.vue.d.ts +13 -0
- package/dist/composables/useFloorPlan.d.ts +58 -0
- package/dist/composables/useLocale.d.ts +41 -0
- package/dist/draw.js +11 -9
- package/dist/draw.js.map +1 -1
- package/dist/flow.js +6 -1
- package/dist/flow.js.map +1 -1
- package/dist/gantt.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/locales/index.js +287 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2934 -1955
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +5 -5
- package/dist/media.js +31 -31
- package/dist/pdf.js +5 -5
- package/dist/pdf.js.map +1 -1
- package/dist/rich-text-editor.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/{useLocale-BpGxplLV.js → useLocale-CaWwi-b6.js} +42 -1
- package/dist/useLocale-CaWwi-b6.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/MDrawCanvas.test.ts +8 -0
- package/src/__tests__/MFloorPlan.test.ts +205 -3
- package/src/__tests__/MFlow.test.ts +15 -0
- package/src/components/MDrawCanvas.vue +9 -3
- package/src/components/MFloorPlan.vue +571 -72
- package/src/components/MFloorPlanInspector.vue +169 -0
- package/src/components/MFloorPlanToolbar.vue +128 -0
- package/src/components/MFlow.vue +11 -0
- package/src/components/MPdfViewer.vue +2 -1
- package/src/composables/useFloorPlan.ts +73 -0
- package/src/composables/useLocale.ts +82 -0
- package/src/index.ts +6 -1
- package/src/locales/de.ts +41 -0
- package/src/locales/es.ts +41 -0
- package/src/locales/fr.ts +41 -0
- package/src/locales/ja.ts +41 -0
- package/src/locales/ko.ts +41 -0
- package/src/locales/pt.ts +41 -0
- package/src/locales/zh.ts +41 -0
- package/dist/useLocale-BpGxplLV.js.map +0 -1
package/dist/API.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @m3ui-vue/m3ui-vue 1.3.
|
|
1
|
+
# @m3ui-vue/m3ui-vue 1.3.1 — 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,9 @@ 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
|
+
- `selectable?: "none" | "multiple" | "single" = "none"` — Outside editing, what a click on a table selects: nothing, one, or several (toggling; to merge them)
|
|
1406
|
+
- `canMerge?: ((ids: (string | number)[]) => string | boolean)` — Whether these tables may be merged: `true`, or `false` / a reason to refuse (shown by `merge-refused`)
|
|
1403
1407
|
- `label?: string` — Accessible name
|
|
1404
1408
|
- `tables?: FloorTable[] = []` (v-model:tables)
|
|
1405
1409
|
- `merges?: FloorMerge[] = []` (v-model:merges)
|
|
@@ -1408,8 +1412,10 @@ Props:
|
|
|
1408
1412
|
- `walls?: FloorWall[] = []` (v-model:walls)
|
|
1409
1413
|
- `decor?: FloorDecor[] = []` (v-model:decor)
|
|
1410
1414
|
- `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
|
|
1415
|
+
- `picked?: FloorPick = null` (v-model:picked) — While editing: the zone, wall (and corner) or decor item picked, for an inspector of your own
|
|
1411
1416
|
|
|
1412
1417
|
Events:
|
|
1418
|
+
- `split(merge: FloorMerge)`
|
|
1413
1419
|
- `update:tool(value: "select" | "area" | "wall")`
|
|
1414
1420
|
- `update:selection(value: (string | number)[])`
|
|
1415
1421
|
- `update:tables(value: FloorTable[])`
|
|
@@ -1417,11 +1423,33 @@ Events:
|
|
|
1417
1423
|
- `update:areas(value: FloorArea[])`
|
|
1418
1424
|
- `update:walls(value: FloorWall[])`
|
|
1419
1425
|
- `update:decor(value: FloorDecor[])`
|
|
1426
|
+
- `update:picked(value: FloorPick)`
|
|
1427
|
+
- `merge(merge: FloorMerge)`
|
|
1428
|
+
- `merge-refused(ids: (string | number)[], reason: string)`
|
|
1420
1429
|
- `table-click(table: FloorTable, event: MouseEvent | KeyboardEvent)` — A table was clicked or opened with Enter (not after a drag)
|
|
1421
1430
|
- `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
1431
|
|
|
1423
1432
|
Slots:
|
|
1433
|
+
- `#area { area: FloorArea; picked: boolean; scale: number; }`
|
|
1434
|
+
- `#decor { item: FloorDecor; kind: FloorDecorKind; picked: boolean; scale: number; }`
|
|
1435
|
+
- `#merge { merge: FloorMerge; tables: (string | number)[]; }`
|
|
1424
1436
|
- `#table { table: FloorTable; status: FloorStatus | undefined; selected: boolean; }` — The inside of a table: `{ table, status, selected }`
|
|
1437
|
+
- `#overlay { scale: number; toPx: (v: number) => number; }`
|
|
1438
|
+
|
|
1439
|
+
Exposed (template ref):
|
|
1440
|
+
- `context: FloorPlanContext` — Everything above and more, for MFloorPlanToolbar / MFloorPlanInspector outside the plan (`:plan="plan"`)
|
|
1441
|
+
- `addTable: (t?: Partial<FloorTable>) => FloorTable`
|
|
1442
|
+
- `addDecor: (kind: string, d?: Partial<FloorDecor>) => FloorDecor`
|
|
1443
|
+
- `update: (kind: FloorItemKind, id: string | number, patch: Record<string, unknown>) => void`
|
|
1444
|
+
- `removeSelected: () => void`
|
|
1445
|
+
- `merge: (ids?: (string | number)[], label?: string | undefined) => FloorMerge | null` — Merge tables (default: the selection) / split a merge (by its id or a table's)
|
|
1446
|
+
- `split: (idOrTable: string | number) => void`
|
|
1447
|
+
- `undo: () => void` — Undo / redo the plan's own edits (also Ctrl+Z, Ctrl+Shift+Z or Ctrl+Y)
|
|
1448
|
+
- `redo: () => void`
|
|
1449
|
+
- `canUndo: boolean`
|
|
1450
|
+
- `canRedo: boolean`
|
|
1451
|
+
- `duplicate: () => void` — Copy the selected tables, or the picked zone or decor (also Ctrl+D)
|
|
1452
|
+
- `removeTables: (ids: (string | number)[]) => void` — Remove tables, taking them out of their merges (Delete does it for the selection)
|
|
1425
1453
|
|
|
1426
1454
|
```ts
|
|
1427
1455
|
/** A table on the plan, in plan units (not pixels) */
|
|
@@ -1490,7 +1518,8 @@ export interface FloorWall {
|
|
|
1490
1518
|
/** Something on the plan that isn't a table: a door, a window, a plant, a column, the register, a text label… */
|
|
1491
1519
|
export interface FloorDecor {
|
|
1492
1520
|
id: string | number
|
|
1493
|
-
|
|
1521
|
+
/** A built-in kind, or one of yours from `decorKinds` */
|
|
1522
|
+
kind: FloorDecorBuiltin | (string & {})
|
|
1494
1523
|
x: number
|
|
1495
1524
|
y: number
|
|
1496
1525
|
width?: number
|
|
@@ -1501,6 +1530,72 @@ export interface FloorDecor {
|
|
|
1501
1530
|
}
|
|
1502
1531
|
```
|
|
1503
1532
|
|
|
1533
|
+
```ts
|
|
1534
|
+
/** What's picked on the plan besides tables: a zone, a wall (and one of its corners) or a decor item */
|
|
1535
|
+
export type FloorPick = { kind: 'area' | 'wall' | 'decor'; id: string | number; vertex?: number } | null
|
|
1536
|
+
```
|
|
1537
|
+
|
|
1538
|
+
```ts
|
|
1539
|
+
/** How a decor kind looks: its default size, an icon, a shape and fill; yours or a built-in one restyled */
|
|
1540
|
+
export interface FloorDecorKind {
|
|
1541
|
+
/** Name, for the accessible label */
|
|
1542
|
+
label?: string
|
|
1543
|
+
icon?: string
|
|
1544
|
+
width: number
|
|
1545
|
+
height: number
|
|
1546
|
+
/** `box` a rounded rectangle, `round` a circle, `bar` a thin slab (doors, windows), `text` the item's label only */
|
|
1547
|
+
shape?: 'box' | 'round' | 'bar' | 'text'
|
|
1548
|
+
/** Fill: an M3 color role (`surface`, `primary`…) or any CSS color */
|
|
1549
|
+
color?: string
|
|
1550
|
+
}
|
|
1551
|
+
```
|
|
1552
|
+
|
|
1553
|
+
```ts
|
|
1554
|
+
export type FloorDecorBuiltin = 'door' | 'window' | 'plant' | 'column' | 'restroom' | 'kitchen' | 'register' | 'stairs' | 'label'
|
|
1555
|
+
```
|
|
1556
|
+
|
|
1557
|
+
### MFloorPlanInspector
|
|
1558
|
+
|
|
1559
|
+
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.
|
|
1560
|
+
|
|
1561
|
+
Props:
|
|
1562
|
+
- `plan?: FloorPlanContext | { context: FloorPlanContext; } | null = null` — The plan: its template ref (or its `context`). Not needed inside the plan's slots
|
|
1563
|
+
- `zoneColors?: string[] = ["secondary", "tertiary", "primary", "success", "error"]` — Colors offered for zones: M3 color roles or CSS colors
|
|
1564
|
+
- `merging?: boolean = true` — Merge and split buttons
|
|
1565
|
+
|
|
1566
|
+
Slots:
|
|
1567
|
+
- `#table { table: FloorTable; update: (p: Partial<FloorTable>) => void; }` — Below a table's fields: `{ table, update }`
|
|
1568
|
+
- `#tables { ids: (string | number)[]; }` — Below several picked tables: `{ ids }`
|
|
1569
|
+
- `#area { area: FloorArea; update: (p: Partial<FloorArea>) => void; }` — Below a zone's fields: `{ area, update }`
|
|
1570
|
+
- `#wall { wall: FloorWall; update: (p: Partial<FloorWall>) => void; }` — Below a wall's fields: `{ wall, update }`
|
|
1571
|
+
- `#decor { item: FloorDecor; kind: FloorDecorKind | undefined; update: (p: Partial<FloorDecor>) => void; }` — Below a decor item's fields: `{ item, kind, update }`
|
|
1572
|
+
- `#empty` — When nothing is picked
|
|
1573
|
+
|
|
1574
|
+
### MFloorPlanToolbar
|
|
1575
|
+
|
|
1576
|
+
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.
|
|
1577
|
+
|
|
1578
|
+
Props:
|
|
1579
|
+
- `plan?: FloorPlanContext | { context: FloorPlanContext; } | null = null` — The plan: its template ref (or its `context`). Not needed inside the plan's slots
|
|
1580
|
+
- `tables?: FloorTablePreset[] = [
|
|
1581
|
+
{ shape: "round", seats: 2 },
|
|
1582
|
+
{ shape: "round", seats: 4 },
|
|
1583
|
+
{ shape: "square", seats: 4 },
|
|
1584
|
+
{ shape: "rect", seats: 6 },
|
|
1585
|
+
]` — Tables offered by Add a table (name, shape, seats, size…)
|
|
1586
|
+
- `decor?: string[]` — Decor kinds offered (default: every kind the plan knows, yours included)
|
|
1587
|
+
- `tools?: boolean = true` — Move / wall / zone
|
|
1588
|
+
- `history?: boolean = true` — Undo and redo
|
|
1589
|
+
|
|
1590
|
+
Slots:
|
|
1591
|
+
- `#default` — More controls at the start
|
|
1592
|
+
- `#end` — More controls at the end
|
|
1593
|
+
|
|
1594
|
+
```ts
|
|
1595
|
+
/** A table offered by the toolbar's Add a table menu */
|
|
1596
|
+
export type FloorTablePreset = Partial<FloorTable> & { name?: string }
|
|
1597
|
+
```
|
|
1598
|
+
|
|
1504
1599
|
### MFlow
|
|
1505
1600
|
|
|
1506
1601
|
Import from `@m3ui-vue/m3ui-vue/flow`.
|
|
@@ -1544,6 +1639,7 @@ Props:
|
|
|
1544
1639
|
- `animate?: boolean = true` — Positions spring to their new place when they change from outside
|
|
1545
1640
|
- `getId?: ((kind: "edge" | "node") => string)` — Makes ids for pasted nodes and new edges
|
|
1546
1641
|
- `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
|
|
1642
|
+
- `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
1643
|
- `label?: string` — The canvas's accessible name
|
|
1548
1644
|
|
|
1549
1645
|
Events:
|
|
@@ -5691,6 +5787,22 @@ Sparkles that twinkle over an element, to draw the eye to something new or speci
|
|
|
5691
5787
|
vSparkle: Directive<HTMLElement, SparkleValue>
|
|
5692
5788
|
```
|
|
5693
5789
|
|
|
5790
|
+
### useFloorPlan
|
|
5791
|
+
|
|
5792
|
+
The enclosing MFloorPlan's state and actions (inside its slots)
|
|
5793
|
+
|
|
5794
|
+
```ts
|
|
5795
|
+
useFloorPlan(): FloorPlanContext
|
|
5796
|
+
```
|
|
5797
|
+
|
|
5798
|
+
### floorDecorName
|
|
5799
|
+
|
|
5800
|
+
A decor kind's name: a built-in one in the app's language (unless renamed), else its label or key
|
|
5801
|
+
|
|
5802
|
+
```ts
|
|
5803
|
+
floorDecorName(kind: string, kinds: Record<string, FloorDecorKind>, locale: M3Locale): string
|
|
5804
|
+
```
|
|
5805
|
+
|
|
5694
5806
|
### emojiCategories
|
|
5695
5807
|
|
|
5696
5808
|
```ts
|
|
@@ -7540,6 +7652,47 @@ export interface M3Locale {
|
|
|
7540
7652
|
drawColor: string
|
|
7541
7653
|
floorPlan: string
|
|
7542
7654
|
floorSeats: string
|
|
7655
|
+
floorRotate: string
|
|
7656
|
+
floorTools: string
|
|
7657
|
+
floorMove: string
|
|
7658
|
+
floorDrawWall: string
|
|
7659
|
+
floorDrawZone: string
|
|
7660
|
+
floorAddTable: string
|
|
7661
|
+
floorAddDecor: string
|
|
7662
|
+
floorDuplicate: string
|
|
7663
|
+
floorDelete: string
|
|
7664
|
+
floorUndo: string
|
|
7665
|
+
floorRedo: string
|
|
7666
|
+
floorLabel: string
|
|
7667
|
+
floorSeatsField: string
|
|
7668
|
+
floorShape: string
|
|
7669
|
+
floorRound: string
|
|
7670
|
+
floorSquare: string
|
|
7671
|
+
floorLong: string
|
|
7672
|
+
floorAngle: string
|
|
7673
|
+
floorColor: string
|
|
7674
|
+
floorThickness: string
|
|
7675
|
+
floorWidth: string
|
|
7676
|
+
floorHeight: string
|
|
7677
|
+
floorMerge: string
|
|
7678
|
+
floorSplit: string
|
|
7679
|
+
floorNothingPicked: string
|
|
7680
|
+
floorTablesPicked: string
|
|
7681
|
+
floorTableN: string
|
|
7682
|
+
floorZone: string
|
|
7683
|
+
floorWall: string
|
|
7684
|
+
floorDeleteCorner: string
|
|
7685
|
+
floorFinishWall: string
|
|
7686
|
+
floorCancel: string
|
|
7687
|
+
floorDecorDoor: string
|
|
7688
|
+
floorDecorWindow: string
|
|
7689
|
+
floorDecorPlant: string
|
|
7690
|
+
floorDecorColumn: string
|
|
7691
|
+
floorDecorRestroom: string
|
|
7692
|
+
floorDecorKitchen: string
|
|
7693
|
+
floorDecorRegister: string
|
|
7694
|
+
floorDecorStairs: string
|
|
7695
|
+
floorDecorLabel: string
|
|
7543
7696
|
drawCustomColor: string
|
|
7544
7697
|
drawSize: string
|
|
7545
7698
|
drawUndo: string
|
|
@@ -7910,6 +8063,62 @@ export interface SparkleOptions {
|
|
|
7910
8063
|
export type SparkleValue = boolean | string | SparkleOptions | null | undefined
|
|
7911
8064
|
```
|
|
7912
8065
|
|
|
8066
|
+
```ts
|
|
8067
|
+
/**
|
|
8068
|
+
* An MFloorPlan's state and actions. MFloorPlanToolbar and MFloorPlanInspector are built on it, and so can controls
|
|
8069
|
+
* of your own: inside the plan's slots with `useFloorPlan()`, or anywhere from its template ref (`plan.context`).
|
|
8070
|
+
* Every edit made through it is a step of the plan's undo history.
|
|
8071
|
+
*/
|
|
8072
|
+
export interface FloorPlanContext {
|
|
8073
|
+
tables: Ref<FloorTable[]>
|
|
8074
|
+
areas: Ref<FloorArea[]>
|
|
8075
|
+
walls: Ref<FloorWall[]>
|
|
8076
|
+
decor: Ref<FloorDecor[]>
|
|
8077
|
+
merges: Ref<FloorMerge[]>
|
|
8078
|
+
selection: Ref<(string | number)[]>
|
|
8079
|
+
picked: Ref<FloorPick>
|
|
8080
|
+
tool: Ref<FloorTool>
|
|
8081
|
+
editable: ComputedRef<boolean>
|
|
8082
|
+
/** A wall is being drawn (tool `wall`): finish it (also double-click / Enter) or cancel it (Escape) */
|
|
8083
|
+
drawingWall: ComputedRef<boolean>
|
|
8084
|
+
finishWall(): void
|
|
8085
|
+
cancelWall(): void
|
|
8086
|
+
/** The decor kinds: built-in ones merged with `decorKinds` */
|
|
8087
|
+
kinds: ComputedRef<Record<string, FloorDecorKind>>
|
|
8088
|
+
statuses: ComputedRef<Record<string, FloorStatus>>
|
|
8089
|
+
/** The plan's size in plan units */
|
|
8090
|
+
size: ComputedRef<{ width: number; height: number }>
|
|
8091
|
+
canUndo: ComputedRef<boolean>
|
|
8092
|
+
canRedo: ComputedRef<boolean>
|
|
8093
|
+
undo(): void
|
|
8094
|
+
redo(): void
|
|
8095
|
+
/** Adds a table (at the plan's middle unless placed; numbered after the highest numbered one) and selects it */
|
|
8096
|
+
addTable(table?: Partial<FloorTable>): FloorTable
|
|
8097
|
+
/** Adds a decor item of a kind and picks it */
|
|
8098
|
+
addDecor(kind: string, item?: Partial<FloorDecor>): FloorDecor
|
|
8099
|
+
/** Changes one item (consecutive changes to the same item within a moment are one undo step) */
|
|
8100
|
+
update(kind: 'table', id: string | number, patch: Partial<FloorTable>): void
|
|
8101
|
+
update(kind: 'area', id: string | number, patch: Partial<FloorArea>): void
|
|
8102
|
+
update(kind: 'wall', id: string | number, patch: Partial<FloorWall>): void
|
|
8103
|
+
update(kind: 'decor', id: string | number, patch: Partial<FloorDecor>): void
|
|
8104
|
+
/** Removes what's picked (a wall's picked corner, or the whole item), or else the selected tables */
|
|
8105
|
+
removeSelected(): void
|
|
8106
|
+
removeTables(ids: (string | number)[]): void
|
|
8107
|
+
/** Copies the selected tables, or the picked zone or decor */
|
|
8108
|
+
duplicate(): void
|
|
8109
|
+
merge(ids?: (string | number)[], label?: string): FloorMerge | null
|
|
8110
|
+
split(idOrTable: string | number): void
|
|
8111
|
+
}
|
|
8112
|
+
```
|
|
8113
|
+
|
|
8114
|
+
```ts
|
|
8115
|
+
export type FloorTool = 'select' | 'wall' | 'area'
|
|
8116
|
+
```
|
|
8117
|
+
|
|
8118
|
+
```ts
|
|
8119
|
+
export type FloorItemKind = 'table' | 'area' | 'wall' | 'decor'
|
|
8120
|
+
```
|
|
8121
|
+
|
|
7913
8122
|
```ts
|
|
7914
8123
|
// Generated by scripts/generate-emoji-data.mjs from Unicode emoji-test.txt (Emoji 15). Don't edit by hand.
|
|
7915
8124
|
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
@@ -7928,7 +8137,7 @@ export interface EmojiCategory {
|
|
|
7928
8137
|
`M3Locale` keys (pass a partial object to `createM3UI({ locale })`; presets from `@m3ui-vue/m3ui-vue/locales`:
|
|
7929
8138
|
`esLocale`, `frLocale`, `ptLocale`, `deLocale`, `jaLocale`, `zhLocale`, `koLocale`):
|
|
7930
8139
|
|
|
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
|
|
8140
|
+
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
8141
|
|
|
7933
8142
|
## Theme tokens
|
|
7934
8143
|
|
|
@@ -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,IAAgB,QACd,CAAC,CAAC,EAAM,SAAS,CAAE,EAAmC,SAAS,EAAM,KAAK,CAClF,GAEM,IAAc,QAAe;GAC5B,MAAc,OACnB,OAAO;IACL,mBAAmB,EAAM;IACzB,sBAAsB;I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AAA;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,EAAK,KAAK,CAAC,IAAI,eAAe,EAAE,KAAK;GAAE;EAC/E,CAAC,GAgBK,IAA2B,QAAe;GAC9C,QAAQ,EAAM,SAAd;IACE,KAAK;IACL,KAAK;IACL,KAAK,YACH,OAAO;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} 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
|