@m3ui-vue/m3ui-vue 0.7.0 → 0.8.0
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/README.md +5 -5
- package/dist/{MMenuItem-B_5um6tj.js → MMenuItem-vSLbJGqe.js} +314 -230
- package/dist/MMenuItem-vSLbJGqe.js.map +1 -0
- package/dist/code-editor.d.ts +1 -0
- package/dist/code-editor.js +22 -7
- package/dist/code-editor.js.map +1 -1
- package/dist/components/MCard.vue.d.ts +2 -0
- package/dist/components/MChatBubble.vue.d.ts +0 -1
- package/dist/components/MCheckbox.vue.d.ts +2 -0
- package/dist/components/MCircleProgressBar.vue.d.ts +0 -1
- package/dist/components/MCodeEditor.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +3 -0
- package/dist/components/MDialog.vue.d.ts +23 -7
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MListItem.vue.d.ts +11 -6
- package/dist/components/MNavigationRail.vue.d.ts +17 -1
- package/dist/components/MSelect.vue.d.ts +1 -0
- package/dist/components/MSwitch.vue.d.ts +10 -0
- package/dist/components/MTabs.vue.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +2393 -2005
- package/dist/m3ui.js.map +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/styles/palettes.css +659 -0
- package/dist/styles/theme.css +2 -0
- package/dist/styles.css +1 -1
- package/package.json +13 -1
- package/src/__tests__/useColorPalette.test.ts +2 -2
- package/src/code-editor.ts +1 -0
- package/src/components/MAutocomplete.vue +35 -26
- package/src/components/MBadge.vue +1 -1
- package/src/components/MBottomSheet.vue +4 -4
- package/src/components/MButton.vue +48 -15
- package/src/components/MButtonGroup.vue +2 -2
- package/src/components/MCard.vue +83 -9
- package/src/components/MChatBubble.vue +0 -1
- package/src/components/MCheckbox.vue +78 -18
- package/src/components/MChip.vue +33 -4
- package/src/components/MCircleProgressBar.vue +7 -4
- package/src/components/MCodeEditor.vue +54 -8
- package/src/components/MColorPicker.vue +9 -8
- package/src/components/MColorPickerModal.vue +2 -2
- package/src/components/MCommandPalette.vue +1 -1
- package/src/components/MConfirmDialog.vue +4 -0
- package/src/components/MContextMenu.vue +23 -2
- package/src/components/MDatePicker.vue +11 -11
- package/src/components/MDatePickerModal.vue +5 -5
- package/src/components/MDateRangePicker.vue +12 -12
- package/src/components/MDateRangePickerModal.vue +3 -3
- package/src/components/MDialog.vue +103 -12
- package/src/components/MFab.vue +13 -8
- package/src/components/MFabMenu.vue +1 -1
- package/src/components/MIconButton.vue +50 -14
- package/src/components/MListItem.vue +35 -17
- package/src/components/MLoadingIndicator.vue +14 -7
- package/src/components/MMaskField.vue +14 -6
- package/src/components/MMenu.vue +28 -3
- package/src/components/MMenuItem.vue +2 -2
- package/src/components/MMultiAutocomplete.vue +41 -26
- package/src/components/MMultiSelect.vue +40 -22
- package/src/components/MNavigationBar.vue +5 -10
- package/src/components/MNavigationDrawer.vue +10 -9
- package/src/components/MNavigationRail.vue +335 -22
- package/src/components/MNumberField.vue +14 -6
- package/src/components/MOverlay.vue +1 -1
- package/src/components/MPinInput.vue +7 -4
- package/src/components/MProgressBar.vue +16 -10
- package/src/components/MRadio.vue +74 -30
- package/src/components/MSearchBar.vue +3 -2
- package/src/components/MSegmentedButton.vue +14 -9
- package/src/components/MSelect.vue +44 -32
- package/src/components/MSideSheet.vue +1 -1
- package/src/components/MSlider.vue +42 -20
- package/src/components/MSnackbar.vue +4 -4
- package/src/components/MSplitButton.vue +32 -17
- package/src/components/MSpotlightSearch.vue +1 -1
- package/src/components/MSwitch.vue +138 -33
- package/src/components/MTabs.vue +16 -12
- package/src/components/MTagInput.vue +33 -22
- package/src/components/MTextField.vue +14 -6
- package/src/components/MTimePicker.vue +9 -9
- package/src/components/MTimePickerModal.vue +16 -16
- package/src/components/MToolbar.vue +5 -3
- package/src/components/MTooltip.vue +4 -4
- package/src/components/MTopAppBar.vue +14 -6
- package/src/components/MTour.vue +1 -1
- package/src/composables/useColorPalette.ts +10 -0
- package/src/index.ts +1 -0
- package/src/styles/palettes.css +659 -0
- package/src/styles/theme.css +2 -0
- package/dist/MMenuItem-B_5um6tj.js.map +0 -1
|
@@ -7,41 +7,101 @@ withDefaults(
|
|
|
7
7
|
indeterminate?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
label?: string;
|
|
10
|
+
color?: "primary" | "secondary" | "tertiary" | "error";
|
|
10
11
|
}>(),
|
|
11
|
-
{ indeterminate: false, disabled: false },
|
|
12
|
+
{ indeterminate: false, disabled: false, color: "primary" },
|
|
12
13
|
);
|
|
13
14
|
|
|
14
15
|
const emit = defineEmits<{ "update:modelValue": [boolean] }>();
|
|
16
|
+
|
|
17
|
+
// Same 4 named colors + fallback shape as MRadio's checkedColor map. M3's real
|
|
18
|
+
// CheckboxTokens only define Primary (SelectedContainerColor) and Error (as an error
|
|
19
|
+
// STATE, not a color variant) — secondary/tertiary are a deliberate library extension on
|
|
20
|
+
// top of the spec, same status as MSlider's `color`/`icon` props.
|
|
21
|
+
const checkedClasses: Record<string, string> = {
|
|
22
|
+
primary: "border-primary bg-primary text-on-primary",
|
|
23
|
+
secondary: "border-secondary bg-secondary text-on-secondary",
|
|
24
|
+
tertiary: "border-tertiary bg-tertiary text-on-tertiary",
|
|
25
|
+
error: "border-error bg-error text-on-error",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Just the fill color, reused for the hover/press state layer's tint below.
|
|
29
|
+
const checkedBgClasses: Record<string, string> = {
|
|
30
|
+
primary: "bg-primary",
|
|
31
|
+
secondary: "bg-secondary",
|
|
32
|
+
tertiary: "bg-tertiary",
|
|
33
|
+
error: "bg-error",
|
|
34
|
+
};
|
|
15
35
|
</script>
|
|
16
36
|
|
|
17
37
|
<template>
|
|
18
38
|
<label
|
|
19
|
-
class="inline-flex items-center gap-2 select-none"
|
|
20
|
-
:class="disabled ? 'cursor-not-allowed
|
|
39
|
+
class="group inline-flex items-center gap-2 select-none"
|
|
40
|
+
:class="disabled ? 'cursor-not-allowed' : 'cursor-pointer'"
|
|
21
41
|
>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
<!--
|
|
43
|
+
CheckboxTokens.StateLayerSize = 40dp (was 48px), StateLayerShape = CornerFull. The
|
|
44
|
+
negative margin cancels the touch target's own overhang past the visible 18px box
|
|
45
|
+
(40-18)/2 = 11px per side, so it doesn't push the label text over.
|
|
46
|
+
-->
|
|
47
|
+
<span class="relative -m-[11px] inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full">
|
|
48
|
+
<!--
|
|
49
|
+
Input must stay nested INSIDE this `relative` span (a true sibling of the state-layer
|
|
50
|
+
/focus-ring spans below, satisfying `peer-*`'s sibling-combinator requirement, but not
|
|
51
|
+
hoisted all the way up to be a direct child of <label>): a sr-only, `position: absolute`
|
|
52
|
+
input with no nearby positioned ancestor made the browser's native focus-scroll
|
|
53
|
+
algorithm treat a distant `overflow: hidden` ancestor as the thing to scroll into view
|
|
54
|
+
on click, which — since that ancestor wasn't meant to scroll at all — blew out to its
|
|
55
|
+
max scrollTop and pushed the entire page off-screen. Real bug, found by testing in the
|
|
56
|
+
docs site; MSwitch's input, nested the same way this one now is again, never had it.
|
|
57
|
+
-->
|
|
30
58
|
<input
|
|
31
59
|
type="checkbox"
|
|
32
|
-
class="sr-only"
|
|
60
|
+
class="peer sr-only"
|
|
33
61
|
:checked="modelValue"
|
|
34
62
|
:disabled="disabled"
|
|
35
63
|
@change="emit('update:modelValue', !modelValue)"
|
|
36
64
|
/>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
65
|
+
<!--
|
|
66
|
+
Hover/press state layer (8%/12%), tinted with the checkbox's own indicator color
|
|
67
|
+
(primary/color prop when checked, on-surface when not) — same `before:`-overlay
|
|
68
|
+
spirit as MButton/MCard/MIconButton, just a real sibling span here since the parent
|
|
69
|
+
span is already used for centering/sizing. `group-*` (not a plain `hover:`) so
|
|
70
|
+
hovering anywhere over the row (including the label text) triggers it, not just
|
|
71
|
+
the small 18px glyph itself.
|
|
72
|
+
-->
|
|
73
|
+
<span
|
|
74
|
+
v-if="!disabled"
|
|
75
|
+
class="pointer-events-none absolute inset-0 rounded-full opacity-0 transition-opacity duration-150 group-hover:opacity-[0.08] group-active:opacity-[0.12]"
|
|
76
|
+
:class="modelValue || indeterminate ? checkedBgClasses[color] : 'bg-on-surface'"
|
|
42
77
|
/>
|
|
78
|
+
<!-- Keyboard-focus ring (FocusIndicatorColor = secondary) -->
|
|
79
|
+
<span
|
|
80
|
+
v-if="!disabled"
|
|
81
|
+
class="pointer-events-none absolute inset-0 rounded-full ring-0 ring-secondary transition-[box-shadow] duration-150 peer-focus-visible:ring-2"
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<span
|
|
85
|
+
class="relative inline-flex h-4.5 w-4.5 items-center justify-center rounded-[2px] border-2 transition-colors"
|
|
86
|
+
:class="
|
|
87
|
+
disabled
|
|
88
|
+
? (modelValue || indeterminate ? 'border-on-surface/38 bg-on-surface/38 text-surface' : 'border-on-surface/38 text-transparent')
|
|
89
|
+
: (modelValue || indeterminate ? checkedClasses[color] : 'border-on-surface-variant text-transparent group-hover:border-on-surface group-active:border-on-surface')
|
|
90
|
+
"
|
|
91
|
+
>
|
|
92
|
+
<MIcon
|
|
93
|
+
:name="indeterminate ? 'remove' : 'check'"
|
|
94
|
+
:size="18"
|
|
95
|
+
class="transition-[opacity,transform] duration-150"
|
|
96
|
+
:class="modelValue || indeterminate ? 'scale-100 opacity-100' : 'scale-0 opacity-0'"
|
|
97
|
+
/>
|
|
98
|
+
</span>
|
|
43
99
|
</span>
|
|
44
|
-
<span
|
|
100
|
+
<span
|
|
101
|
+
v-if="label || $slots.default"
|
|
102
|
+
class="text-body-large"
|
|
103
|
+
:class="disabled ? 'text-on-surface/38' : 'text-on-surface'"
|
|
104
|
+
>
|
|
45
105
|
<slot>{{ label }}</slot>
|
|
46
106
|
</span>
|
|
47
107
|
</label>
|
package/src/components/MChip.vue
CHANGED
|
@@ -38,12 +38,23 @@ const customStyle = computed(() => {
|
|
|
38
38
|
}
|
|
39
39
|
})
|
|
40
40
|
|
|
41
|
+
// M3 disabled tokens: label/icon always at 38% on-surface. Container: neutral/unselected
|
|
42
|
+
// chips are outline-only (no fill), so the outline fades to 10% (UnselectedDisabledOutlineOpacity);
|
|
43
|
+
// every other tone/selected chip has a filled container, so the fill fades to 12%
|
|
44
|
+
// (SelectedDisabledContainerOpacity) instead, with any border dropped.
|
|
41
45
|
const toneClasses = computed(() => {
|
|
46
|
+
if (props.disabled) {
|
|
47
|
+
if (props.tone === 'neutral' && !props.selected && !isCustomColor.value) {
|
|
48
|
+
return 'border border-on-surface/10 bg-transparent text-on-surface/38'
|
|
49
|
+
}
|
|
50
|
+
return 'border border-transparent bg-on-surface/12 text-on-surface/38'
|
|
51
|
+
}
|
|
42
52
|
if (isCustomColor.value) {
|
|
43
53
|
return 'border border-transparent bg-[var(--chip-bg)] text-[var(--chip-color)]'
|
|
44
54
|
}
|
|
45
55
|
if (props.tone === 'neutral' && !props.selected) {
|
|
46
|
-
|
|
56
|
+
// ChipsTokens.UnselectedOutlineColor = OutlineVariant, not Outline
|
|
57
|
+
return 'border border-outline-variant bg-transparent text-on-surface-variant'
|
|
47
58
|
}
|
|
48
59
|
const map: Record<string, string> = {
|
|
49
60
|
neutral: 'border border-transparent bg-secondary-container text-on-secondary-container',
|
|
@@ -55,6 +66,23 @@ const toneClasses = computed(() => {
|
|
|
55
66
|
}
|
|
56
67
|
return map[props.tone ?? 'neutral'] ?? map.neutral
|
|
57
68
|
})
|
|
69
|
+
|
|
70
|
+
// ChipsTokens: UnselectedShape = CornerMedium (12dp), SelectedShape = CornerFull — a chip
|
|
71
|
+
// becomes a full pill once selected, it doesn't keep the same small corner radius.
|
|
72
|
+
const shapeClass = computed(() => props.selected ? 'rounded-full' : 'rounded-md')
|
|
73
|
+
|
|
74
|
+
// Hover/press state layer (8%/12%, ChipsTokens has no dedicated token but this matches the
|
|
75
|
+
// universal M3 state-layer convention used everywhere else in this library) via the same
|
|
76
|
+
// `before:`-overlay technique as MButton/MCard/MIconButton — a plain `hover:bg-*` would just
|
|
77
|
+
// replace a filled/selected chip's own background outright instead of overlaying on top of
|
|
78
|
+
// it. `ring-inset` on the focus ring (FocusedIndicatorColor = secondary) because `overflow-
|
|
79
|
+
// hidden` on this same element (needed to clip the state-layer to the chip's shape) would
|
|
80
|
+
// otherwise clip an outset ring's box-shadow too.
|
|
81
|
+
const interactiveClasses =
|
|
82
|
+
"relative cursor-pointer before:content-[''] before:pointer-events-none before:absolute before:inset-0 " +
|
|
83
|
+
'before:bg-current before:opacity-0 before:transition-opacity before:duration-150 ' +
|
|
84
|
+
'hover:before:opacity-[0.08] active:before:opacity-[0.12] ' +
|
|
85
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-secondary'
|
|
58
86
|
</script>
|
|
59
87
|
|
|
60
88
|
<template>
|
|
@@ -62,11 +90,12 @@ const toneClasses = computed(() => {
|
|
|
62
90
|
:is="clickable ? 'button' : 'span'"
|
|
63
91
|
:type="clickable ? 'button' : undefined"
|
|
64
92
|
:disabled="clickable && disabled ? true : undefined"
|
|
65
|
-
class="inline-flex h-8 items-center gap-1.5
|
|
93
|
+
class="inline-flex h-8 items-center gap-1.5 overflow-hidden px-3 text-label-large transition-colors"
|
|
66
94
|
:class="[
|
|
95
|
+
shapeClass,
|
|
67
96
|
toneClasses,
|
|
68
|
-
clickable && !disabled ?
|
|
69
|
-
disabled ? 'cursor-not-allowed
|
|
97
|
+
clickable && !disabled ? interactiveClasses : '',
|
|
98
|
+
disabled ? 'cursor-not-allowed' : '',
|
|
70
99
|
]"
|
|
71
100
|
:style="customStyle"
|
|
72
101
|
@click="clickable && !disabled && emit('click')"
|
|
@@ -14,13 +14,16 @@ const props = withDefaults(
|
|
|
14
14
|
{
|
|
15
15
|
color: "primary",
|
|
16
16
|
variant: "wavy",
|
|
17
|
-
|
|
18
|
-
thickness: 3,
|
|
17
|
+
thickness: 4,
|
|
19
18
|
},
|
|
20
19
|
);
|
|
21
20
|
|
|
22
21
|
const clampedValue = computed(() => Math.min(100, Math.max(0, props.value ?? 0)));
|
|
23
22
|
|
|
23
|
+
// CircularProgressIndicatorTokens: Size=40dp (circle) / WaveSize=48dp (wavy) — the wavy
|
|
24
|
+
// variant's default is intentionally larger to fit the wave amplitude without clipping.
|
|
25
|
+
const effectiveSize = computed(() => props.size ?? (props.variant === "wavy" ? 48 : 40));
|
|
26
|
+
|
|
24
27
|
const svgColorMap: Record<"primary" | "secondary" | "tertiary" | "error", { fill: string; track: string }> = {
|
|
25
28
|
primary: { fill: "var(--color-primary)", track: "var(--color-primary-container)" },
|
|
26
29
|
secondary: { fill: "var(--color-secondary)", track: "var(--color-secondary-container)" },
|
|
@@ -239,7 +242,7 @@ const maskId = useId();
|
|
|
239
242
|
|
|
240
243
|
<div class="relative">
|
|
241
244
|
<svg
|
|
242
|
-
:width="
|
|
245
|
+
:width="effectiveSize" :height="effectiveSize"
|
|
243
246
|
viewBox="0 0 100 100"
|
|
244
247
|
fill="none"
|
|
245
248
|
role="progressbar"
|
|
@@ -315,7 +318,7 @@ const maskId = useId();
|
|
|
315
318
|
text-anchor="middle" dominant-baseline="middle"
|
|
316
319
|
:style="{
|
|
317
320
|
fill: svgColor.fill,
|
|
318
|
-
fontSize: `${
|
|
321
|
+
fontSize: `${effectiveSize < 60 ? 11 : 14}px`,
|
|
319
322
|
fontWeight: '600',
|
|
320
323
|
fontFamily: 'Roboto, sans-serif',
|
|
321
324
|
}"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue'
|
|
3
3
|
import MIcon from './MIcon.vue'
|
|
4
4
|
|
|
5
|
-
type Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'plain'
|
|
5
|
+
type Language = 'javascript' | 'typescript' | 'json' | 'html' | 'css' | 'python' | 'vue' | 'c' | 'cpp' | 'rust' | 'asm' | 'plain'
|
|
6
6
|
|
|
7
7
|
const props = withDefaults(
|
|
8
8
|
defineProps<{
|
|
@@ -49,6 +49,10 @@ const langLabel = computed(() => {
|
|
|
49
49
|
css: 'CSS',
|
|
50
50
|
python: 'Python',
|
|
51
51
|
vue: 'Vue',
|
|
52
|
+
c: 'C',
|
|
53
|
+
cpp: 'C++',
|
|
54
|
+
rust: 'Rust',
|
|
55
|
+
asm: 'Assembly',
|
|
52
56
|
plain: 'Texto',
|
|
53
57
|
}
|
|
54
58
|
return labels[props.language]
|
|
@@ -57,7 +61,7 @@ const langLabel = computed(() => {
|
|
|
57
61
|
async function loadModules() {
|
|
58
62
|
if (cmModules) return cmModules
|
|
59
63
|
|
|
60
|
-
const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod] = await Promise.all([
|
|
64
|
+
const [viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod] = await Promise.all([
|
|
61
65
|
import('@codemirror/view'),
|
|
62
66
|
import('@codemirror/state'),
|
|
63
67
|
import('@codemirror/commands'),
|
|
@@ -70,9 +74,12 @@ async function loadModules() {
|
|
|
70
74
|
import('@codemirror/lang-css'),
|
|
71
75
|
import('@codemirror/lang-python'),
|
|
72
76
|
import('@codemirror/lang-vue'),
|
|
77
|
+
import('@codemirror/lang-cpp'),
|
|
78
|
+
import('@codemirror/lang-rust'),
|
|
79
|
+
import('@codemirror/legacy-modes/mode/gas'),
|
|
73
80
|
])
|
|
74
81
|
|
|
75
|
-
cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod }
|
|
82
|
+
cmModules = { viewMod, stateMod, commandsMod, languageMod, highlightMod, oneDarkMod, jsMod, jsonMod, htmlMod, cssMod, pyMod, vueMod, cppMod, rustMod, asmMod }
|
|
76
83
|
return cmModules
|
|
77
84
|
}
|
|
78
85
|
|
|
@@ -131,6 +138,9 @@ function getLangExtension(mods: any) {
|
|
|
131
138
|
case 'css': return mods.cssMod.css()
|
|
132
139
|
case 'python': return mods.pyMod.python()
|
|
133
140
|
case 'vue': return mods.vueMod.vue()
|
|
141
|
+
case 'c': case 'cpp': return mods.cppMod.cpp()
|
|
142
|
+
case 'rust': return mods.rustMod.rust()
|
|
143
|
+
case 'asm': return mods.languageMod.StreamLanguage.define(mods.asmMod.gas)
|
|
134
144
|
default: return []
|
|
135
145
|
}
|
|
136
146
|
}
|
|
@@ -161,6 +171,7 @@ function buildExtensions(mods: any) {
|
|
|
161
171
|
if (props.wrap) exts.push(viewMod.EditorView.lineWrapping)
|
|
162
172
|
if (props.lineNumbers) exts.push(viewMod.lineNumbers())
|
|
163
173
|
if (props.theme === 'dark') exts.push(oneDarkMod.oneDark)
|
|
174
|
+
if (props.placeholder) exts.push(viewMod.placeholder(props.placeholder))
|
|
164
175
|
|
|
165
176
|
return exts
|
|
166
177
|
}
|
|
@@ -189,13 +200,13 @@ watch(() => props.modelValue, (val) => {
|
|
|
189
200
|
}
|
|
190
201
|
})
|
|
191
202
|
|
|
192
|
-
watch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap], createEditor)
|
|
203
|
+
watch([() => props.language, () => props.theme, () => props.readonly, () => props.lineNumbers, () => props.wrap, () => props.placeholder], createEditor)
|
|
193
204
|
|
|
194
205
|
onBeforeUnmount(() => view?.destroy())
|
|
195
206
|
</script>
|
|
196
207
|
|
|
197
208
|
<template>
|
|
198
|
-
<div class="overflow-hidden rounded-lg border border-outline-variant">
|
|
209
|
+
<div class="flex flex-col overflow-hidden rounded-lg border border-outline-variant">
|
|
199
210
|
<!-- Header bar -->
|
|
200
211
|
<div class="flex items-center justify-between border-b border-outline-variant bg-surface-container px-4 py-2">
|
|
201
212
|
<span class="text-label-medium text-on-surface-variant">{{ langLabel }}</span>
|
|
@@ -223,9 +234,27 @@ onBeforeUnmount(() => view?.destroy())
|
|
|
223
234
|
</template>
|
|
224
235
|
|
|
225
236
|
<style scoped>
|
|
237
|
+
.code-editor-container {
|
|
238
|
+
/* .cm-editor/.cm-scroller/.cm-gutters all use height:100%, which only ever
|
|
239
|
+
resolves against a genuinely definite ancestor height — a min-height (what
|
|
240
|
+
this container has, so it can grow with content up to maxHeight) doesn't
|
|
241
|
+
count as definite for that percentage chain, so .cm-gutters silently fell
|
|
242
|
+
back to sizing off its own content instead of the real editor height.
|
|
243
|
+
Making this a flex column and letting .cm-editor grow via flex instead of
|
|
244
|
+
a % height gives the whole chain a real definite size to resolve against. */
|
|
245
|
+
display: flex;
|
|
246
|
+
flex-direction: column;
|
|
247
|
+
/* Also grow to fill the outer wrapper (see the root element's own flex-col
|
|
248
|
+
above) rather than just sitting at minHeight, whenever a consumer stretches
|
|
249
|
+
the whole component taller than that — e.g. `class="h-full"` in a grid
|
|
250
|
+
cell next to taller content. Still hard-capped by maxHeight either way. */
|
|
251
|
+
flex: 1 1 auto;
|
|
252
|
+
min-height: 0;
|
|
253
|
+
}
|
|
254
|
+
|
|
226
255
|
.code-editor-container :deep(.cm-editor) {
|
|
227
|
-
|
|
228
|
-
min-height:
|
|
256
|
+
flex: 1;
|
|
257
|
+
min-height: 0;
|
|
229
258
|
font-family: 'Roboto Mono', 'Fira Code', 'Consolas', monospace;
|
|
230
259
|
font-size: 0.8125rem;
|
|
231
260
|
line-height: 1.6;
|
|
@@ -236,7 +265,18 @@ onBeforeUnmount(() => view?.destroy())
|
|
|
236
265
|
}
|
|
237
266
|
|
|
238
267
|
.code-editor-container :deep(.cm-scroller) {
|
|
239
|
-
|
|
268
|
+
/* .cm-scroller normally sizes itself off a height:100% against .cm-editor,
|
|
269
|
+
but that's a percentage-height-in-nested-flex-column case that browsers
|
|
270
|
+
don't reliably resolve — grow it directly instead so it has a real,
|
|
271
|
+
laid-out height for .cm-gutters to stretch against below. */
|
|
272
|
+
flex: 1 !important;
|
|
273
|
+
min-height: 0;
|
|
274
|
+
/* .cm-scroller lays out .cm-gutters/.cm-content in a row (gutter | content),
|
|
275
|
+
so .cm-gutters' height comes from cross-axis stretch, not flex-grow —
|
|
276
|
+
CodeMirror's own base theme sets align-items: flex-start !important here,
|
|
277
|
+
which is exactly what stops the gutter from stretching to full height in
|
|
278
|
+
the first place. */
|
|
279
|
+
align-items: stretch !important;
|
|
240
280
|
}
|
|
241
281
|
|
|
242
282
|
.code-editor-container :deep(.cm-content) {
|
|
@@ -253,6 +293,12 @@ onBeforeUnmount(() => view?.destroy())
|
|
|
253
293
|
color: var(--color-outline);
|
|
254
294
|
font-size: 0.75rem;
|
|
255
295
|
padding: 0 4px;
|
|
296
|
+
/* .cm-gutters ships with an explicit height:100% rather than auto, so the
|
|
297
|
+
align-items:stretch above (on .cm-scroller) never actually kicks in —
|
|
298
|
+
stretch only applies to items whose cross-size computes to auto. Forcing
|
|
299
|
+
height back to auto here is what makes that stretch take effect. */
|
|
300
|
+
height: auto !important;
|
|
301
|
+
align-self: stretch !important;
|
|
256
302
|
}
|
|
257
303
|
|
|
258
304
|
.code-editor-container :deep(.cm-activeLineGutter) {
|
|
@@ -172,26 +172,27 @@ onUnmounted(() => {
|
|
|
172
172
|
<div ref="triggerEl" class="relative mt-2" :style="{ '--field-bg': resolvedFieldBg }">
|
|
173
173
|
<button
|
|
174
174
|
type="button"
|
|
175
|
-
class="flex h-14 w-full items-center gap-3 rounded-
|
|
175
|
+
class="flex h-14 w-full items-center gap-3 rounded-xs border bg-transparent px-4 text-left text-body-large transition-[border-color,border-width] duration-150"
|
|
176
176
|
:class="[
|
|
177
|
-
disabled ? 'pointer-events-none
|
|
178
|
-
open
|
|
177
|
+
disabled ? 'pointer-events-none cursor-not-allowed border-on-surface/12' : 'cursor-pointer',
|
|
178
|
+
!disabled && (open
|
|
179
179
|
? error ? 'border-2 border-error' : 'border-2 border-primary'
|
|
180
|
-
: error ? 'border-error' : 'border-outline hover:border-on-surface',
|
|
180
|
+
: error ? 'border-error' : 'border-outline hover:border-on-surface'),
|
|
181
181
|
]"
|
|
182
182
|
@click="!disabled && (open = !open)"
|
|
183
183
|
>
|
|
184
184
|
<span
|
|
185
185
|
class="h-6 w-6 shrink-0 rounded-full border border-outline-variant"
|
|
186
|
+
:class="disabled ? 'opacity-38' : ''"
|
|
186
187
|
:style="{ backgroundColor: modelValue }"
|
|
187
188
|
/>
|
|
188
|
-
<span class="flex-1 font-mono text-on-surface">{{ modelValue }}</span>
|
|
189
|
-
<MIcon name="palette" :size="
|
|
189
|
+
<span class="flex-1 font-mono" :class="disabled ? 'text-on-surface/38' : 'text-on-surface'">{{ modelValue }}</span>
|
|
190
|
+
<MIcon name="palette" :size="24" class="shrink-0" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'" />
|
|
190
191
|
</button>
|
|
191
192
|
<label
|
|
192
193
|
v-if="label"
|
|
193
194
|
class="pointer-events-none absolute -top-2.5 left-3 bg-(--field-bg) px-1 text-label-small transition-colors"
|
|
194
|
-
:class="open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
|
|
195
|
+
:class="disabled ? 'text-on-surface/38' : open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
|
|
195
196
|
>
|
|
196
197
|
{{ label }}
|
|
197
198
|
</label>
|
|
@@ -254,7 +255,7 @@ onUnmounted(() => {
|
|
|
254
255
|
type="text"
|
|
255
256
|
:value="modelValue"
|
|
256
257
|
maxlength="7"
|
|
257
|
-
class="flex-1 rounded-
|
|
258
|
+
class="flex-1 rounded-xs border border-outline bg-transparent px-3 py-2 font-mono text-body-medium text-on-surface outline-none caret-primary transition-colors focus:border-primary"
|
|
258
259
|
@input="onHexInput"
|
|
259
260
|
/>
|
|
260
261
|
</div>
|
|
@@ -150,7 +150,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
|
|
|
150
150
|
<Transition name="m3-cp-modal">
|
|
151
151
|
<div
|
|
152
152
|
v-if="show"
|
|
153
|
-
class="fixed inset-0 z-50 flex items-center justify-center bg-
|
|
153
|
+
class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
|
|
154
154
|
@click.self="cancel"
|
|
155
155
|
>
|
|
156
156
|
<div class="cp-box w-[328px] rounded-[28px] bg-surface-container-high px-6 pt-6 pb-4 shadow-elevation-3">
|
|
@@ -205,7 +205,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
|
|
|
205
205
|
type="text"
|
|
206
206
|
:value="hexInput"
|
|
207
207
|
maxlength="7"
|
|
208
|
-
class="w-full rounded-
|
|
208
|
+
class="w-full rounded-xs border border-outline bg-transparent px-3 py-2 font-mono text-body-medium text-on-surface caret-primary outline-none transition-colors focus:border-primary"
|
|
209
209
|
@input="onHexFieldInput"
|
|
210
210
|
/>
|
|
211
211
|
</div>
|
|
@@ -129,7 +129,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onGlobalKeydown))
|
|
|
129
129
|
<Transition name="m3-cmd">
|
|
130
130
|
<div
|
|
131
131
|
v-if="modelValue"
|
|
132
|
-
class="fixed inset-0 z-50 flex items-start justify-center bg-
|
|
132
|
+
class="fixed inset-0 z-50 flex items-start justify-center bg-scrim/32 pt-[15vh]"
|
|
133
133
|
@click.self="close"
|
|
134
134
|
>
|
|
135
135
|
<div class="cmd-box flex w-full max-w-lg flex-col overflow-hidden rounded-xl bg-surface-container-high shadow-elevation-3">
|
|
@@ -12,10 +12,13 @@ const props = withDefaults(
|
|
|
12
12
|
cancelLabel?: string
|
|
13
13
|
danger?: boolean
|
|
14
14
|
loading?: boolean
|
|
15
|
+
/** Passed straight through to MDialog's `closable` — show/hide the header close (X) button. */
|
|
16
|
+
closable?: boolean
|
|
15
17
|
}>(),
|
|
16
18
|
{
|
|
17
19
|
danger: false,
|
|
18
20
|
loading: false,
|
|
21
|
+
closable: true,
|
|
19
22
|
},
|
|
20
23
|
)
|
|
21
24
|
|
|
@@ -29,6 +32,7 @@ const emit = defineEmits<{ 'update:modelValue': [boolean]; confirm: [] }>()
|
|
|
29
32
|
:model-value="modelValue"
|
|
30
33
|
:title="title"
|
|
31
34
|
max-width="max-w-sm"
|
|
35
|
+
:closable="closable"
|
|
32
36
|
@update:model-value="emit('update:modelValue', $event)"
|
|
33
37
|
>
|
|
34
38
|
<p class="text-body-medium text-on-surface-variant">{{ message }}</p>
|
|
@@ -15,6 +15,24 @@ async function showAt(x: number, y: number) {
|
|
|
15
15
|
x: Math.min(x, window.innerWidth - el.offsetWidth - 8),
|
|
16
16
|
y: Math.min(y, window.innerHeight - el.offsetHeight - 8),
|
|
17
17
|
}
|
|
18
|
+
focusableItems()[0]?.focus()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function focusableItems() {
|
|
22
|
+
if (!panelEl.value) return []
|
|
23
|
+
return Array.from(
|
|
24
|
+
panelEl.value.querySelectorAll<HTMLElement>('button:not(:disabled), a[href]'),
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function moveFocus(dir: 1 | -1) {
|
|
29
|
+
const items = focusableItems()
|
|
30
|
+
if (!items.length) return
|
|
31
|
+
const idx = items.indexOf(document.activeElement as HTMLElement)
|
|
32
|
+
const next = idx === -1
|
|
33
|
+
? (dir === 1 ? items[0] : items[items.length - 1])
|
|
34
|
+
: items[(idx + dir + items.length) % items.length]
|
|
35
|
+
next?.focus()
|
|
18
36
|
}
|
|
19
37
|
|
|
20
38
|
function show(e: MouseEvent) {
|
|
@@ -38,7 +56,10 @@ function onDocMouseDown(e: MouseEvent) {
|
|
|
38
56
|
}
|
|
39
57
|
|
|
40
58
|
function onKeydown(e: KeyboardEvent) {
|
|
41
|
-
if (e.key === 'Escape') hide()
|
|
59
|
+
if (e.key === 'Escape') { hide(); return }
|
|
60
|
+
if (!visible.value) return
|
|
61
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); moveFocus(1) }
|
|
62
|
+
else if (e.key === 'ArrowUp') { e.preventDefault(); moveFocus(-1) }
|
|
42
63
|
}
|
|
43
64
|
|
|
44
65
|
function onScroll() {
|
|
@@ -75,7 +96,7 @@ onUnmounted(() => {
|
|
|
75
96
|
<div
|
|
76
97
|
v-if="visible"
|
|
77
98
|
ref="panelEl"
|
|
78
|
-
class="fixed z-[500] min-w-48 overflow-hidden rounded-
|
|
99
|
+
class="fixed z-[500] min-w-48 overflow-hidden rounded-xs bg-surface-container py-1 shadow-elevation-2"
|
|
79
100
|
:style="{ left: `${adjustedPos.x}px`, top: `${adjustedPos.y}px`, transformOrigin: 'top left' }"
|
|
80
101
|
@contextmenu.prevent
|
|
81
102
|
>
|
|
@@ -167,18 +167,18 @@ onUnmounted(() => {
|
|
|
167
167
|
<div ref="triggerEl" class="relative mt-2" :style="{ '--field-bg': resolvedFieldBg }">
|
|
168
168
|
<button
|
|
169
169
|
type="button"
|
|
170
|
-
class="flex h-14 w-full items-center gap-2 rounded-
|
|
170
|
+
class="flex h-14 w-full items-center gap-2 rounded-xs border bg-transparent px-4 text-left text-body-large transition-[border-color,border-width] duration-150"
|
|
171
171
|
:class="[
|
|
172
|
-
disabled ? 'pointer-events-none
|
|
173
|
-
open
|
|
172
|
+
disabled ? 'pointer-events-none cursor-not-allowed border-on-surface/12' : 'cursor-pointer',
|
|
173
|
+
!disabled && (open
|
|
174
174
|
? error ? 'border-2 border-error' : 'border-2 border-primary'
|
|
175
|
-
: error ? 'border-error' : 'border-outline hover:border-on-surface',
|
|
175
|
+
: error ? 'border-error' : 'border-outline hover:border-on-surface'),
|
|
176
176
|
]"
|
|
177
177
|
@click="!disabled && (open = !open)"
|
|
178
178
|
>
|
|
179
|
-
<MIcon name="calendar_today" :size="
|
|
180
|
-
<span v-if="displayValue" class="flex-1 text-on-surface">{{ displayValue }}</span>
|
|
181
|
-
<span v-else class="flex-1 text-on-surface-variant">{{ placeholder || label || localeStrings.selectDate }}</span>
|
|
179
|
+
<MIcon name="calendar_today" :size="24" class="shrink-0" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'" />
|
|
180
|
+
<span v-if="displayValue" class="flex-1" :class="disabled ? 'text-on-surface/38' : 'text-on-surface'">{{ displayValue }}</span>
|
|
181
|
+
<span v-else class="flex-1" :class="disabled ? 'text-on-surface/38' : 'text-on-surface-variant'">{{ placeholder || label || localeStrings.selectDate }}</span>
|
|
182
182
|
<MIcon
|
|
183
183
|
v-if="modelValue"
|
|
184
184
|
name="close"
|
|
@@ -190,7 +190,7 @@ onUnmounted(() => {
|
|
|
190
190
|
<label
|
|
191
191
|
v-if="label"
|
|
192
192
|
class="pointer-events-none absolute -top-2.5 left-3 bg-(--field-bg) px-1 text-label-small transition-colors"
|
|
193
|
-
:class="open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
|
|
193
|
+
:class="disabled ? 'text-on-surface/38' : open ? (error ? 'text-error' : 'text-primary') : error ? 'text-error' : 'text-on-surface-variant'"
|
|
194
194
|
>
|
|
195
195
|
{{ label }}
|
|
196
196
|
</label>
|
|
@@ -210,7 +210,7 @@ onUnmounted(() => {
|
|
|
210
210
|
<div
|
|
211
211
|
v-if="open"
|
|
212
212
|
ref="panelEl"
|
|
213
|
-
class="fixed z-500 w-[
|
|
213
|
+
class="fixed z-500 w-[360px] rounded-[28px] bg-surface-container-high p-4 shadow-elevation-3"
|
|
214
214
|
:style="dropPos"
|
|
215
215
|
>
|
|
216
216
|
<!-- Header -->
|
|
@@ -222,7 +222,7 @@ onUnmounted(() => {
|
|
|
222
222
|
|
|
223
223
|
<!-- Weekday headers -->
|
|
224
224
|
<div class="mb-1 grid grid-cols-7 gap-0.5 text-center">
|
|
225
|
-
<span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-
|
|
225
|
+
<span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-body-large font-medium text-on-surface">
|
|
226
226
|
{{ wd }}
|
|
227
227
|
</span>
|
|
228
228
|
</div>
|
|
@@ -233,7 +233,7 @@ onUnmounted(() => {
|
|
|
233
233
|
v-for="(day, i) in calendarDays"
|
|
234
234
|
:key="i"
|
|
235
235
|
type="button"
|
|
236
|
-
class="flex h-
|
|
236
|
+
class="flex h-10 w-full items-center justify-center rounded-full text-body-medium transition-colors duration-100"
|
|
237
237
|
:class="[
|
|
238
238
|
day.disabled
|
|
239
239
|
? 'cursor-not-allowed text-on-surface/25'
|
|
@@ -155,17 +155,17 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
|
|
|
155
155
|
<Transition name="m3-dp-modal">
|
|
156
156
|
<div
|
|
157
157
|
v-if="show"
|
|
158
|
-
class="fixed inset-0 z-50 flex items-center justify-center bg-
|
|
158
|
+
class="fixed inset-0 z-50 flex items-center justify-center bg-scrim/32 p-4"
|
|
159
159
|
@click.self="cancel"
|
|
160
160
|
>
|
|
161
161
|
<div class="dp-box w-[360px] rounded-[28px] bg-surface-container-high shadow-elevation-3">
|
|
162
162
|
<!-- Header -->
|
|
163
163
|
<div class="px-6 pt-6 pb-4">
|
|
164
|
-
<p class="mb-3 text-label-
|
|
164
|
+
<p class="mb-3 text-label-large text-on-surface-variant">
|
|
165
165
|
{{ title || locale.selectDate }}
|
|
166
166
|
</p>
|
|
167
167
|
<div class="flex items-center justify-between">
|
|
168
|
-
<span class="text-headline-
|
|
168
|
+
<span class="text-headline-large font-medium capitalize text-on-surface-variant">
|
|
169
169
|
{{ headerDate }}
|
|
170
170
|
</span>
|
|
171
171
|
<MIconButton
|
|
@@ -189,7 +189,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
|
|
|
189
189
|
|
|
190
190
|
<!-- Weekday headers -->
|
|
191
191
|
<div class="mb-1 grid grid-cols-7 gap-0.5 text-center">
|
|
192
|
-
<span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-
|
|
192
|
+
<span v-for="wd in WEEKDAYS" :key="wd" class="py-1 text-body-large font-medium text-on-surface">
|
|
193
193
|
{{ wd }}
|
|
194
194
|
</span>
|
|
195
195
|
</div>
|
|
@@ -228,7 +228,7 @@ function onKeydown(e: KeyboardEvent) { if (e.key === 'Escape') cancel() }
|
|
|
228
228
|
type="text"
|
|
229
229
|
placeholder="23/06/2026"
|
|
230
230
|
maxlength="10"
|
|
231
|
-
class="h-14 w-full rounded-
|
|
231
|
+
class="h-14 w-full rounded-xs border border-outline bg-transparent px-4 text-body-large text-on-surface caret-primary outline-none transition-colors focus:border-2 focus:border-primary"
|
|
232
232
|
@keydown.enter="applyInput"
|
|
233
233
|
@blur="applyInput"
|
|
234
234
|
/>
|