@m3ui-vue/m3ui-vue 0.9.2 → 1.0.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 +26 -29
- package/dist/API.md +242 -22
- package/dist/{MIcon-CaEooCmZ.js → MIcon-DLOkQduI.js} +10 -3
- package/dist/MIcon-DLOkQduI.js.map +1 -0
- package/dist/{MTextField-Ck0oWDMk.js → MTextField-TZ7lfr09.js} +551 -216
- package/dist/MTextField-TZ7lfr09.js.map +1 -0
- package/dist/THIRD_PARTY_LICENSES.md +547 -0
- package/dist/api.json +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/components/MAppBarWithSearch.vue.d.ts +70 -0
- package/dist/components/MBottomAppBar.vue.d.ts +37 -0
- package/dist/components/MBottomSheetScaffold.vue.d.ts +40 -0
- package/dist/components/MButton.vue.d.ts +4 -2
- package/dist/components/MButtonGroup.vue.d.ts +2 -0
- package/dist/components/MChatBubble.vue.d.ts +1 -1
- package/dist/components/MChip.vue.d.ts +19 -2
- package/dist/components/MContainer.vue.d.ts +1 -1
- package/dist/components/MDataTable.vue.d.ts +1 -1
- package/dist/components/MDialog.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +15 -4
- package/dist/components/MIcon.vue.d.ts +3 -0
- package/dist/components/MIconButton.vue.d.ts +15 -1
- package/dist/components/MListItem.vue.d.ts +2 -2
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMenuItem.vue.d.ts +17 -4
- package/dist/components/MNavigationRail.vue.d.ts +6 -0
- package/dist/components/MSearchBar.vue.d.ts +5 -3
- package/dist/components/MShortNavigationBar.vue.d.ts +1 -1
- package/dist/components/MSplitButton.vue.d.ts +2 -0
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTabs.vue.d.ts +6 -0
- package/dist/components/MTimePickerModal.vue.d.ts +3 -0
- package/dist/components/MTimeScroll.vue.d.ts +22 -0
- package/dist/components/MToggleButton.vue.d.ts +2 -0
- package/dist/components/MTopAppBar.vue.d.ts +33 -2
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/_MDrawerItemList.vue.d.ts +3 -0
- package/dist/composables/_searchAppBar.d.ts +6 -0
- package/dist/composables/_themeTransition.d.ts +2 -0
- package/dist/composables/_useSpring.d.ts +5 -5
- package/dist/composables/motion.d.ts +101 -0
- package/dist/composables/useColorPalette.d.ts +10 -0
- package/dist/composables/useLocale.d.ts +9 -0
- package/dist/directives/vRipple.d.ts +16 -0
- package/dist/emoji-names-de-BphO5XpV.js.map +1 -1
- package/dist/emoji-names-en-9ZvMRvzi.js.map +1 -1
- package/dist/emoji-names-es-DvfWU3Pj.js.map +1 -1
- package/dist/emoji-names-fr-B-jhUlsP.js.map +1 -1
- package/dist/emoji-names-ja-l8cMFJo1.js.map +1 -1
- package/dist/emoji-names-ko-YP-o9G0c.js.map +1 -1
- package/dist/emoji-names-pt-DGj_Js4M.js.map +1 -1
- package/dist/emoji-names-zh-Dzecwtw_.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/locales/index.js +63 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7716 -6768
- package/dist/m3ui.js.map +1 -1
- package/dist/plugin.d.ts +7 -0
- package/dist/rich-text-editor.js +22 -22
- package/dist/styles/palettes-contrast.css +7764 -0
- package/dist/styles/theme.css +59 -2
- package/dist/styles.css +1 -1
- package/dist/terminal.js +1 -1
- package/dist/{useLocale-CFW8cIzL.js → useLocale-CuvWRZ1h.js} +10 -1
- package/dist/useLocale-CuvWRZ1h.js.map +1 -0
- package/package.json +4 -2
- package/src/__tests__/MAppBarWithSearch.test.ts +96 -0
- package/src/__tests__/MBottomAppBar.test.ts +71 -0
- package/src/__tests__/MBottomSheetScaffold.test.ts +101 -0
- package/src/__tests__/MChip.test.ts +63 -0
- package/src/__tests__/MFab.test.ts +36 -0
- package/src/__tests__/MIconButton.test.ts +60 -0
- package/src/__tests__/MMenuItem.test.ts +84 -0
- package/src/__tests__/MNavigationRail.test.ts +77 -0
- package/src/__tests__/MScrollField.test.ts +28 -0
- package/src/__tests__/MTabs.test.ts +39 -0
- package/src/__tests__/MTimePickerModal.test.ts +52 -0
- package/src/__tests__/MTimeScroll.test.ts +44 -0
- package/src/__tests__/MTopAppBar.test.ts +99 -0
- package/src/__tests__/contrast.test.ts +64 -0
- package/src/__tests__/dynamicColor.test.ts +17 -0
- package/src/__tests__/motion.test.ts +37 -0
- package/src/__tests__/themeTransition.test.ts +119 -0
- package/src/__tests__/vRipple.test.ts +92 -0
- package/src/components/MAppBarWithSearch.vue +236 -0
- package/src/components/MBottomAppBar.vue +181 -0
- package/src/components/MBottomSheetScaffold.vue +296 -0
- package/src/components/MBreadcrumbs.vue +1 -1
- package/src/components/MButton.vue +4 -13
- package/src/components/MButtonGroup.vue +4 -11
- package/src/components/MChip.vue +137 -5
- package/src/components/MFab.vue +81 -27
- package/src/components/MIcon.vue +4 -2
- package/src/components/MIconButton.vue +96 -24
- package/src/components/MMenuItem.vue +115 -13
- package/src/components/MNavigationDrawer.vue +2 -2
- package/src/components/MNavigationRail.vue +135 -8
- package/src/components/MScrollField.vue +10 -2
- package/src/components/MSearchBar.vue +28 -12
- package/src/components/MSplitButton.vue +5 -12
- package/src/components/MTabs.vue +16 -5
- package/src/components/MTimePickerModal.vue +48 -8
- package/src/components/MTimeScroll.vue +161 -0
- package/src/components/MToggleButton.vue +5 -12
- package/src/components/MTopAppBar.vue +252 -28
- package/src/composables/_carouselStrategy.ts +3 -0
- package/src/composables/_searchAppBar.ts +9 -0
- package/src/composables/_themeColor.ts +11 -4
- package/src/composables/_themeTransition.ts +71 -0
- package/src/composables/_useSpring.ts +12 -20
- package/src/composables/motion.ts +73 -0
- package/src/composables/useColorPalette.ts +103 -20
- package/src/composables/useLocale.ts +18 -0
- package/src/composables/useTheme.ts +4 -12
- package/src/data/emoji-names/emoji-names-de.ts +1 -0
- package/src/data/emoji-names/emoji-names-en.ts +1 -0
- package/src/data/emoji-names/emoji-names-es.ts +1 -0
- package/src/data/emoji-names/emoji-names-fr.ts +1 -0
- package/src/data/emoji-names/emoji-names-ja.ts +1 -0
- package/src/data/emoji-names/emoji-names-ko.ts +1 -0
- package/src/data/emoji-names/emoji-names-pt.ts +1 -0
- package/src/data/emoji-names/emoji-names-zh.ts +1 -0
- package/src/data/emojis.ts +1 -0
- package/src/directives/vRipple.ts +73 -0
- package/src/index.ts +13 -1
- package/src/locales/de.ts +9 -0
- package/src/locales/es.ts +9 -0
- package/src/locales/fr.ts +9 -0
- package/src/locales/ja.ts +9 -0
- package/src/locales/ko.ts +9 -0
- package/src/locales/pt.ts +9 -0
- package/src/locales/zh.ts +9 -0
- package/src/plugin.ts +11 -1
- package/src/styles/palettes-contrast.css +7764 -0
- package/src/styles/theme.css +59 -2
- package/dist/MIcon-CaEooCmZ.js.map +0 -1
- package/dist/MTextField-Ck0oWDMk.js.map +0 -1
- package/dist/useLocale-CFW8cIzL.js.map +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Internal: animates a theme change (dark mode, palette, contrast).
|
|
2
|
+
//
|
|
3
|
+
// Firefox (and any browser without @property) transitions six color properties on every element
|
|
4
|
+
// (`.theme-transitioning` in theme.css): smooth there, but in Chromium it recalculates every element's transitions
|
|
5
|
+
// each frame and stutters. Chromium and WebKit instead transition the color tokens themselves, once, on <html>:
|
|
6
|
+
// registered as <color> with @property they interpolate, and every element follows them through var(). Components'
|
|
7
|
+
// own color transitions (transition-colors) are turned off meanwhile, or they would restart on every frame of the
|
|
8
|
+
// token's change and trail behind the rest (the navbar and buttons did). A view transition was tried first: it
|
|
9
|
+
// cross-fades two snapshots, which looks washed out midway compared to the colors moving.
|
|
10
|
+
|
|
11
|
+
// The tokens of theme.css, palettes.css and generated palettes
|
|
12
|
+
const COLOR_TOKENS = [
|
|
13
|
+
'background', 'on-background', 'surface', 'surface-dim', 'surface-bright', 'surface-variant', 'on-surface',
|
|
14
|
+
'on-surface-variant', 'surface-container-lowest', 'surface-container-low', 'surface-container',
|
|
15
|
+
'surface-container-high', 'surface-container-highest', 'inverse-surface', 'inverse-on-surface', 'inverse-primary',
|
|
16
|
+
'outline', 'outline-variant', 'shadow', 'scrim',
|
|
17
|
+
...['primary', 'secondary', 'tertiary', 'error', 'success'].flatMap((c) => [c, `on-${c}`, `${c}-container`, `on-${c}-container`]),
|
|
18
|
+
...['primary', 'secondary', 'tertiary'].flatMap((c) => [`${c}-fixed`, `${c}-fixed-dim`, `on-${c}-fixed`, `on-${c}-fixed-variant`]),
|
|
19
|
+
].map((t) => `--color-${t}`)
|
|
20
|
+
|
|
21
|
+
const DURATION = 250
|
|
22
|
+
const STYLE_ID = 'm3-theme-transition'
|
|
23
|
+
|
|
24
|
+
// Injected only while switching: a registered <color> computes to rgb(), and code reading a token with
|
|
25
|
+
// getPropertyValue() expects it as written
|
|
26
|
+
const css = COLOR_TOKENS.map((t) => `@property ${t} { syntax: '<color>'; inherits: true; initial-value: transparent; }`).join('\n')
|
|
27
|
+
+ `\nhtml.theme-switching { transition: ${COLOR_TOKENS.map((t) => `${t} ${DURATION}ms ease`).join(', ')}; }`
|
|
28
|
+
+ '\nhtml.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }'
|
|
29
|
+
|
|
30
|
+
// Gecko: a CSS feature only it has, or its user agent ("Gecko/<version>" or "Firefox/"; Chromium and WebKit only
|
|
31
|
+
// say "like Gecko", and Firefox on iOS is WebKit and says "FxiOS")
|
|
32
|
+
const isGecko = () =>
|
|
33
|
+
(typeof CSS !== 'undefined' && !!CSS.supports?.('-moz-appearance', 'none'))
|
|
34
|
+
|| (typeof navigator !== 'undefined' && /\bGecko\/\d|\bFirefox\//.test(navigator.userAgent))
|
|
35
|
+
const hasProperty = () => typeof CSS !== 'undefined' && typeof CSS.registerProperty === 'function'
|
|
36
|
+
|
|
37
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
38
|
+
|
|
39
|
+
/** Runs `apply` (the DOM writes of a theme change) with the theme transition. */
|
|
40
|
+
export function themeTransition(apply: () => void) {
|
|
41
|
+
if (typeof document === 'undefined') return apply()
|
|
42
|
+
const reduced = window.matchMedia?.('(prefers-reduced-motion: reduce)').matches
|
|
43
|
+
if (reduced) return apply()
|
|
44
|
+
const root = document.documentElement
|
|
45
|
+
|
|
46
|
+
if (!isGecko() && hasProperty()) {
|
|
47
|
+
if (!document.getElementById(STYLE_ID)) {
|
|
48
|
+
const style = document.createElement('style')
|
|
49
|
+
style.id = STYLE_ID
|
|
50
|
+
style.textContent = css
|
|
51
|
+
document.head.appendChild(style)
|
|
52
|
+
}
|
|
53
|
+
root.classList.add('theme-switching')
|
|
54
|
+
// Style flush: the tokens' current values are computed as registered colors and the transition is in place
|
|
55
|
+
// before they change
|
|
56
|
+
void root.offsetHeight
|
|
57
|
+
apply()
|
|
58
|
+
clearTimeout(timer)
|
|
59
|
+
timer = setTimeout(() => {
|
|
60
|
+
root.classList.remove('theme-switching')
|
|
61
|
+
document.getElementById(STYLE_ID)?.remove()
|
|
62
|
+
}, DURATION + 50)
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
root.classList.add('theme-transitioning')
|
|
67
|
+
// Force a style flush so the transition is in place before the colors change
|
|
68
|
+
void root.offsetHeight
|
|
69
|
+
apply()
|
|
70
|
+
setTimeout(() => root.classList.remove('theme-transitioning'), 300)
|
|
71
|
+
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// A set of numbers (corner radii, sizes...) that springs toward a target, written to the DOM once per
|
|
2
|
+
// frame through `apply`. Same integration as the rest of the library (semi-implicit Euler), in fixed 4ms
|
|
3
|
+
// substeps so a stiff spring stays stable on a dropped frame. `useSpring` is public (index.ts, with the
|
|
4
|
+
// motion tokens); the constants below are the library's internal shorthands for the Standard scheme.
|
|
4
5
|
import { onMounted, onUnmounted, watch } from 'vue'
|
|
6
|
+
import { cubicBezier, motionSprings, type SpringSpec } from './motion'
|
|
5
7
|
|
|
6
|
-
export
|
|
8
|
+
export type { SpringSpec }
|
|
7
9
|
|
|
8
10
|
/** MotionSchemeKeyTokens.FastSpatial in the Standard scheme (StandardMotionTokens.SpringFastSpatial*) */
|
|
9
|
-
export const FAST_SPATIAL: SpringSpec =
|
|
11
|
+
export const FAST_SPATIAL: SpringSpec = motionSprings.standard.fastSpatial
|
|
12
|
+
/** MotionSchemeKeyTokens.FastEffects in the Standard scheme */
|
|
13
|
+
export const FAST_EFFECTS: SpringSpec = motionSprings.standard.fastEffects
|
|
10
14
|
/** MotionSchemeKeyTokens.DefaultEffects in the Standard scheme */
|
|
11
|
-
export const DEFAULT_EFFECTS: SpringSpec =
|
|
15
|
+
export const DEFAULT_EFFECTS: SpringSpec = motionSprings.standard.defaultEffects
|
|
12
16
|
/** MotionSchemeKeyTokens.DefaultSpatial in the Standard scheme */
|
|
13
|
-
export const DEFAULT_SPATIAL: SpringSpec =
|
|
17
|
+
export const DEFAULT_SPATIAL: SpringSpec = motionSprings.standard.defaultSpatial
|
|
14
18
|
|
|
15
19
|
const SUBSTEP = 0.004
|
|
16
20
|
|
|
@@ -74,16 +78,4 @@ export function useSpring(
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
/** Compose's FastOutSlowInEasing, cubic-bezier(0.4, 0, 0.2, 1) — the easing of a default tween() */
|
|
77
|
-
export
|
|
78
|
-
if (t <= 0) return 0
|
|
79
|
-
if (t >= 1) return 1
|
|
80
|
-
// Solve x(u) = t for the curve parameter u (Newton), then return y(u)
|
|
81
|
-
let u = t
|
|
82
|
-
for (let i = 0; i < 8; i++) {
|
|
83
|
-
const x = 3 * u * (1 - u) ** 2 * 0.4 + 3 * u ** 2 * (1 - u) * 0.2 + u ** 3 - t
|
|
84
|
-
const dx = 3 * (1 - u) ** 2 * 0.4 + 6 * u * (1 - u) * (0.2 - 0.4) + 3 * u ** 2 * 0.8
|
|
85
|
-
if (Math.abs(dx) < 1e-6) break
|
|
86
|
-
u -= x / dx
|
|
87
|
-
}
|
|
88
|
-
return 3 * u ** 2 * (1 - u) + u ** 3
|
|
89
|
-
}
|
|
81
|
+
export const fastOutSlowIn = cubicBezier(0.4, 0, 0.2, 1)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Material 3's motion tokens for your own animations, from androidx's MotionTokens, StandardMotionTokens and
|
|
2
|
+
// ExpressiveMotionTokens. The same easings and durations are CSS variables in theme.css (`--ease-*`, which
|
|
3
|
+
// Tailwind turns into `ease-*` utilities, and `--duration-*`); the springs only make sense in JS, with
|
|
4
|
+
// `useSpring` (exported next to these) or your own loop. No imports here: _useSpring builds on this file.
|
|
5
|
+
|
|
6
|
+
/** A spring: dampingRatio 1 settles without overshoot, lower bounces; higher stiffness is faster */
|
|
7
|
+
export interface SpringSpec { dampingRatio: number; stiffness: number }
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Spring specs of the two motion schemes. Spatial springs move things (position, size, shape); effects springs
|
|
11
|
+
* change color and opacity and never overshoot. Standard is the default scheme; Expressive is bouncier, for
|
|
12
|
+
* Expressive components and moments that should feel lively.
|
|
13
|
+
*/
|
|
14
|
+
export const motionSprings = {
|
|
15
|
+
standard: {
|
|
16
|
+
fastSpatial: { dampingRatio: 0.9, stiffness: 1400 },
|
|
17
|
+
defaultSpatial: { dampingRatio: 0.9, stiffness: 700 },
|
|
18
|
+
slowSpatial: { dampingRatio: 0.9, stiffness: 300 },
|
|
19
|
+
fastEffects: { dampingRatio: 1, stiffness: 3800 },
|
|
20
|
+
defaultEffects: { dampingRatio: 1, stiffness: 1600 },
|
|
21
|
+
slowEffects: { dampingRatio: 1, stiffness: 800 },
|
|
22
|
+
},
|
|
23
|
+
expressive: {
|
|
24
|
+
fastSpatial: { dampingRatio: 0.6, stiffness: 800 },
|
|
25
|
+
defaultSpatial: { dampingRatio: 0.8, stiffness: 380 },
|
|
26
|
+
slowSpatial: { dampingRatio: 0.8, stiffness: 200 },
|
|
27
|
+
fastEffects: { dampingRatio: 1, stiffness: 3800 },
|
|
28
|
+
defaultEffects: { dampingRatio: 1, stiffness: 1600 },
|
|
29
|
+
slowEffects: { dampingRatio: 1, stiffness: 800 },
|
|
30
|
+
},
|
|
31
|
+
} as const satisfies Record<'standard' | 'expressive', Record<string, SpringSpec>>
|
|
32
|
+
|
|
33
|
+
/** Easing curves as cubic-bezier control points [x1, y1, x2, y2] (theme.css has them as `--ease-*`) */
|
|
34
|
+
export const motionEasings = {
|
|
35
|
+
emphasized: [0.2, 0, 0, 1],
|
|
36
|
+
emphasizedDecelerate: [0.05, 0.7, 0.1, 1],
|
|
37
|
+
emphasizedAccelerate: [0.3, 0, 0.8, 0.15],
|
|
38
|
+
standard: [0.2, 0, 0, 1],
|
|
39
|
+
standardDecelerate: [0, 0, 0, 1],
|
|
40
|
+
standardAccelerate: [0.3, 0, 1, 1],
|
|
41
|
+
legacy: [0.4, 0, 0.2, 1],
|
|
42
|
+
legacyDecelerate: [0, 0, 0.2, 1],
|
|
43
|
+
legacyAccelerate: [0.4, 0, 1, 1],
|
|
44
|
+
linear: [0, 0, 1, 1],
|
|
45
|
+
} as const satisfies Record<string, readonly [number, number, number, number]>
|
|
46
|
+
|
|
47
|
+
/** Durations in ms (theme.css has them as `--duration-short-1` … `--duration-extra-long-4`) */
|
|
48
|
+
export const motionDurations = {
|
|
49
|
+
short1: 50, short2: 100, short3: 150, short4: 200,
|
|
50
|
+
medium1: 250, medium2: 300, medium3: 350, medium4: 400,
|
|
51
|
+
long1: 450, long2: 500, long3: 550, long4: 600,
|
|
52
|
+
extraLong1: 700, extraLong2: 800, extraLong3: 900, extraLong4: 1000,
|
|
53
|
+
} as const
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A cubic-bezier easing as a function of progress (0–1), e.g. `cubicBezier(...motionEasings.emphasized)`, for
|
|
57
|
+
* JS-driven tweens and for mapping a fraction through a curve
|
|
58
|
+
*/
|
|
59
|
+
export function cubicBezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number {
|
|
60
|
+
return (t: number) => {
|
|
61
|
+
if (t <= 0) return 0
|
|
62
|
+
if (t >= 1) return 1
|
|
63
|
+
// Solve x(u) = t for the curve parameter u (Newton), then return y(u)
|
|
64
|
+
let u = t
|
|
65
|
+
for (let i = 0; i < 8; i++) {
|
|
66
|
+
const x = 3 * u * (1 - u) ** 2 * x1 + 3 * u ** 2 * (1 - u) * x2 + u ** 3 - t
|
|
67
|
+
const dx = 3 * (1 - u) ** 2 * x1 + 6 * u * (1 - u) * (x2 - x1) + 3 * u ** 2 * (1 - x2)
|
|
68
|
+
if (Math.abs(dx) < 1e-6) break
|
|
69
|
+
u -= x / dx
|
|
70
|
+
}
|
|
71
|
+
return 3 * u * (1 - u) ** 2 * y1 + 3 * u ** 2 * (1 - u) * y2 + u ** 3
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { readonly, ref, watchEffect } from 'vue'
|
|
1
|
+
import { computed, readonly, ref, watch, watchEffect } from 'vue'
|
|
2
2
|
import { generateScheme, schemeToCss, type SeedOptions } from './dynamicColor'
|
|
3
|
+
import { themeTransition } from './_themeTransition'
|
|
3
4
|
|
|
4
5
|
export interface Palette {
|
|
5
6
|
id: string
|
|
@@ -66,13 +67,14 @@ export interface ActiveSeed extends SeedOptions {
|
|
|
66
67
|
|
|
67
68
|
const PALETTE_KEY = 'm3-palette'
|
|
68
69
|
const SEED_KEY = 'm3-seed'
|
|
70
|
+
const CONTRAST_KEY = 'm3-contrast'
|
|
69
71
|
// The generated CSS of the active palette, so a reload applies it before the generator has loaded
|
|
70
72
|
const CSS_KEY = 'm3-palette-css'
|
|
71
73
|
|
|
72
74
|
function read<T>(key: string): T | null {
|
|
73
75
|
try {
|
|
74
76
|
const v = localStorage.getItem(key)
|
|
75
|
-
return v == null ? null : (key === PALETTE_KEY ? v : JSON.parse(v)) as T
|
|
77
|
+
return v == null ? null : (key === PALETTE_KEY || key === CONTRAST_KEY ? v : JSON.parse(v)) as T
|
|
76
78
|
} catch {
|
|
77
79
|
return null
|
|
78
80
|
}
|
|
@@ -87,6 +89,37 @@ function write(key: string, value: unknown) {
|
|
|
87
89
|
const current = ref(read<string>(PALETTE_KEY) ?? 'purple')
|
|
88
90
|
const activeSeed = ref<ActiveSeed | null>(read<ActiveSeed>(SEED_KEY))
|
|
89
91
|
|
|
92
|
+
// ── Contrast ─────────────────────────────────────────────────────────────────────────────────────
|
|
93
|
+
/**
|
|
94
|
+
* M3's contrast levels. `system` follows the OS (`prefers-contrast: more` → high). Built-in palettes need
|
|
95
|
+
* `@m3ui-vue/m3ui-vue/palettes-contrast` imported for medium and high; seed palettes are regenerated.
|
|
96
|
+
*/
|
|
97
|
+
export type ContrastLevel = 'standard' | 'medium' | 'high' | 'system'
|
|
98
|
+
const CONTRAST_LEVELS: readonly ContrastLevel[] = ['standard', 'medium', 'high', 'system']
|
|
99
|
+
const storedContrast = read<string>(CONTRAST_KEY)
|
|
100
|
+
const contrast = ref<ContrastLevel>(CONTRAST_LEVELS.includes(storedContrast as ContrastLevel) ? storedContrast as ContrastLevel : 'standard')
|
|
101
|
+
const systemMore = ref(false)
|
|
102
|
+
if (typeof window !== 'undefined' && window.matchMedia) {
|
|
103
|
+
const mq = window.matchMedia('(prefers-contrast: more)')
|
|
104
|
+
systemMore.value = mq.matches
|
|
105
|
+
mq.addEventListener?.('change', (e) => { systemMore.value = e.matches })
|
|
106
|
+
}
|
|
107
|
+
/** The level in effect: `system` resolved to standard or high. */
|
|
108
|
+
const activeContrast = computed<Exclude<ContrastLevel, 'system'>>(() =>
|
|
109
|
+
contrast.value === 'system' ? (systemMore.value ? 'high' : 'standard') : contrast.value)
|
|
110
|
+
const CONTRAST_AMOUNT = { standard: 0, medium: 0.5, high: 1 } as const
|
|
111
|
+
|
|
112
|
+
/** A seed's options with the active contrast level applied (standard keeps the seed's own `contrast`). */
|
|
113
|
+
function withContrast(seed: ActiveSeed): ActiveSeed {
|
|
114
|
+
return activeContrast.value === 'standard' ? seed : { ...seed, contrast: CONTRAST_AMOUNT[activeContrast.value] }
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function applyContrast(level: Exclude<ContrastLevel, 'system'>) {
|
|
118
|
+
if (typeof document === 'undefined') return
|
|
119
|
+
if (level === 'standard') document.documentElement.removeAttribute('data-contrast')
|
|
120
|
+
else document.documentElement.setAttribute('data-contrast', level)
|
|
121
|
+
}
|
|
122
|
+
|
|
90
123
|
// Whether palette changes are written to localStorage. Defaults to true (existing behavior).
|
|
91
124
|
// An app can disable it via `createM3UI({ persistPalette: false })` or `useColorPalette().setPersistPalette(false)`
|
|
92
125
|
// so its chosen palette can't be overridden by a stored value on the next boot.
|
|
@@ -136,25 +169,30 @@ function hasPaletteCss(id: string): boolean {
|
|
|
136
169
|
|
|
137
170
|
let generation = 0
|
|
138
171
|
|
|
139
|
-
/** Generates
|
|
140
|
-
async function
|
|
172
|
+
/** Generates the CSS for a palette id from a seed. Resolves null if a newer request won. */
|
|
173
|
+
async function generateCss(id: string, seed: ActiveSeed): Promise<string | null> {
|
|
141
174
|
const mine = ++generation
|
|
142
|
-
const
|
|
143
|
-
|
|
175
|
+
const options = withContrast(seed)
|
|
176
|
+
const css = schemeToCss(await generateScheme(options.seed, options), id)
|
|
177
|
+
return mine === generation ? css : null
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Puts a generated palette's CSS in the page and caches it for the next load. */
|
|
181
|
+
function applyCss(id: string, css: string) {
|
|
144
182
|
injectCss(css)
|
|
145
183
|
if (persistEnabled.value) write(CSS_KEY, { id, css })
|
|
146
|
-
return true
|
|
147
184
|
}
|
|
148
185
|
|
|
149
|
-
/** Switches to a palette id with the theme transition
|
|
150
|
-
* watcher, so it also works when no component uses the composable
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
void document.documentElement.offsetHeight
|
|
154
|
-
current.value = id
|
|
155
|
-
applyAttribute(id)
|
|
186
|
+
/** Switches to a palette id with the theme transition, injecting its generated CSS (if any) inside it. Applied
|
|
187
|
+
* directly, not only through useColorPalette()'s watcher, so it also works when no component uses the composable
|
|
188
|
+
* (createM3UI's defaults). */
|
|
189
|
+
function switchTo(id: string, css?: string) {
|
|
156
190
|
if (persistEnabled.value) write(PALETTE_KEY, id)
|
|
157
|
-
|
|
191
|
+
themeTransition(() => {
|
|
192
|
+
if (css) applyCss(id, css)
|
|
193
|
+
current.value = id
|
|
194
|
+
applyAttribute(id)
|
|
195
|
+
})
|
|
158
196
|
}
|
|
159
197
|
|
|
160
198
|
/** Picks a palette by id; a custom one with a seed and no CSS of its own is generated first. */
|
|
@@ -162,20 +200,46 @@ async function selectPalette(id: string) {
|
|
|
162
200
|
generation++
|
|
163
201
|
const custom = palettes.find((p) => p.id === id)
|
|
164
202
|
if (custom && !builtInIds.has(id) && custom.seed && !hasPaletteCss(id)) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
203
|
+
const css = await generateCss(id, { seed: custom.seed })
|
|
204
|
+
if (css === null) return
|
|
205
|
+
switchTo(id, css)
|
|
206
|
+
} else switchTo(id)
|
|
168
207
|
}
|
|
169
208
|
|
|
170
209
|
/** Activates a seed color: generates its scheme and switches to it. */
|
|
171
210
|
async function selectSeed(seed: string, options: SeedOptions = {}) {
|
|
172
211
|
const next: ActiveSeed = { seed, ...options }
|
|
173
|
-
|
|
212
|
+
const css = await generateCss(SEED_PALETTE, next)
|
|
213
|
+
if (css === null) return
|
|
174
214
|
activeSeed.value = next
|
|
175
215
|
if (persistEnabled.value) write(SEED_KEY, next)
|
|
176
|
-
switchTo(SEED_PALETTE)
|
|
216
|
+
switchTo(SEED_PALETTE, css)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Sets the contrast level, with the theme transition; a generated palette (seed, custom) is regenerated. */
|
|
220
|
+
async function selectContrast(level: ContrastLevel, persist = persistEnabled.value) {
|
|
221
|
+
contrast.value = level
|
|
222
|
+
if (persist) write(CONTRAST_KEY, level)
|
|
177
223
|
}
|
|
178
224
|
|
|
225
|
+
// Applied on every change of the effective level (a setting or the OS preference), for every palette kind. A
|
|
226
|
+
// generated palette is regenerated first, then swapped in with the attribute in one transition.
|
|
227
|
+
watch(activeContrast, async () => {
|
|
228
|
+
const id = current.value
|
|
229
|
+
let css: string | null | undefined
|
|
230
|
+
if (id === SEED_PALETTE && activeSeed.value) css = await generateCss(SEED_PALETTE, activeSeed.value)
|
|
231
|
+
else {
|
|
232
|
+
const custom = palettes.find((p) => p.id === id)
|
|
233
|
+
if (custom && !builtInIds.has(id) && custom.seed && !hasPaletteCss(id)) css = await generateCss(id, { seed: custom.seed })
|
|
234
|
+
}
|
|
235
|
+
// A newer request (a palette, a seed, another level) superseded the generation: it generates at the active
|
|
236
|
+
// level itself, but the attribute still has to follow
|
|
237
|
+
themeTransition(() => {
|
|
238
|
+
applyContrast(activeContrast.value)
|
|
239
|
+
if (css) applyCss(id, css)
|
|
240
|
+
})
|
|
241
|
+
})
|
|
242
|
+
|
|
179
243
|
export function useColorPalette() {
|
|
180
244
|
watchEffect(() => {
|
|
181
245
|
const id = current.value
|
|
@@ -202,12 +266,24 @@ export function useColorPalette() {
|
|
|
202
266
|
if (enabled) write(PALETTE_KEY, current.value)
|
|
203
267
|
}
|
|
204
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Sets M3's contrast level: `standard`, `medium`, `high`, or `system` (follows `prefers-contrast`). Built-in
|
|
271
|
+
* palettes need `@m3ui-vue/m3ui-vue/palettes-contrast` imported; a seed palette is regenerated at that level.
|
|
272
|
+
* Remembered like the palette.
|
|
273
|
+
*/
|
|
274
|
+
function setContrast(level: ContrastLevel) {
|
|
275
|
+
void selectContrast(level)
|
|
276
|
+
}
|
|
277
|
+
|
|
205
278
|
return {
|
|
206
279
|
palette: current,
|
|
207
280
|
palettes,
|
|
208
281
|
set,
|
|
209
282
|
seed: readonly(activeSeed),
|
|
210
283
|
setSeed,
|
|
284
|
+
contrast: readonly(contrast),
|
|
285
|
+
activeContrast,
|
|
286
|
+
setContrast,
|
|
211
287
|
persistPalette: persistEnabled,
|
|
212
288
|
setPersistPalette,
|
|
213
289
|
}
|
|
@@ -219,6 +295,7 @@ export function useColorPalette() {
|
|
|
219
295
|
const cached = read<{ id: string; css: string }>(CSS_KEY)
|
|
220
296
|
if (saved && cached && cached.id === saved) injectCss(cached.css)
|
|
221
297
|
if (saved && saved !== 'purple') document.documentElement.setAttribute('data-palette', saved)
|
|
298
|
+
applyContrast(activeContrast.value)
|
|
222
299
|
}
|
|
223
300
|
|
|
224
301
|
/**
|
|
@@ -251,3 +328,9 @@ export function __defaultSeed(seed: string, options: SeedOptions | undefined, pe
|
|
|
251
328
|
persistEnabled.value = persist
|
|
252
329
|
return selectSeed(seed, options)
|
|
253
330
|
}
|
|
331
|
+
|
|
332
|
+
/** Internal: `createM3UI({ contrast })`, the first-visit default (or forced with `persistPalette: false`). */
|
|
333
|
+
export function __defaultContrast(level: ContrastLevel, persist: boolean) {
|
|
334
|
+
if (persist && read<string>(CONTRAST_KEY)) return
|
|
335
|
+
void selectContrast(level, persist)
|
|
336
|
+
}
|
|
@@ -39,6 +39,15 @@ export interface M3Locale {
|
|
|
39
39
|
// Pickers
|
|
40
40
|
selectDate: string
|
|
41
41
|
selectTime: string
|
|
42
|
+
timeHourSelection: string
|
|
43
|
+
timeMinuteSelection: string
|
|
44
|
+
timePeriodToggle: string
|
|
45
|
+
timeToggleKeyboard: string
|
|
46
|
+
timeToggleDial: string
|
|
47
|
+
timeToggleScroll: string
|
|
48
|
+
sheetExpand: string
|
|
49
|
+
sheetCollapse: string
|
|
50
|
+
sheetDismiss: string
|
|
42
51
|
selectRange: string
|
|
43
52
|
pickStart: string
|
|
44
53
|
pickEnd: string
|
|
@@ -212,6 +221,15 @@ export const defaultLocale: M3Locale = {
|
|
|
212
221
|
|
|
213
222
|
selectDate: 'Select date',
|
|
214
223
|
selectTime: 'Select time',
|
|
224
|
+
timeHourSelection: 'Select hour',
|
|
225
|
+
timeMinuteSelection: 'Select minutes',
|
|
226
|
+
timePeriodToggle: 'Select AM or PM',
|
|
227
|
+
timeToggleKeyboard: 'Switch to text input mode',
|
|
228
|
+
timeToggleDial: 'Switch to clock mode',
|
|
229
|
+
timeToggleScroll: 'Switch to scroll mode',
|
|
230
|
+
sheetExpand: 'Expand bottom sheet',
|
|
231
|
+
sheetCollapse: 'Collapse bottom sheet',
|
|
232
|
+
sheetDismiss: 'Dismiss bottom sheet',
|
|
215
233
|
selectRange: 'Select range',
|
|
216
234
|
pickStart: 'Select start',
|
|
217
235
|
pickEnd: 'Select end',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ref, watchEffect, onMounted, onUnmounted } from 'vue'
|
|
2
|
+
import { themeTransition } from './_themeTransition'
|
|
2
3
|
|
|
3
4
|
export type Theme = 'light' | 'dark' | 'system'
|
|
4
5
|
|
|
@@ -11,18 +12,9 @@ function applyTheme(t: Theme) {
|
|
|
11
12
|
const isDark = t === 'dark' || (t === 'system' && prefersDark)
|
|
12
13
|
|
|
13
14
|
const isChange = _appliedDark !== null && _appliedDark !== isDark
|
|
14
|
-
|
|
15
|
-
if (isChange)
|
|
16
|
-
|
|
17
|
-
document.documentElement.classList.add('theme-transitioning')
|
|
18
|
-
void document.documentElement.offsetHeight
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
document.documentElement.classList.toggle('dark', isDark)
|
|
22
|
-
|
|
23
|
-
if (isChange) {
|
|
24
|
-
setTimeout(() => document.documentElement.classList.remove('theme-transitioning'), 300)
|
|
25
|
-
}
|
|
15
|
+
const apply = () => document.documentElement.classList.toggle('dark', isDark)
|
|
16
|
+
if (isChange) themeTransition(apply)
|
|
17
|
+
else apply()
|
|
26
18
|
|
|
27
19
|
_appliedDark = isDark
|
|
28
20
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (de). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': 'grinsendes Gesicht|froh|fröhlich|Gesicht|grinsen|haha|lachen|lol|lustig|Smiley',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (en). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': 'grinning face|cheerful|cheery|face|grin|grinning|happy|laugh|nice|smile|smiling|teeth',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (es). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': 'cara sonriendo|cara|divertido|feliz|sonrisa',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (fr). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': 'visage rieur|content|dents|émoticône|grand sourire|heureux|joyeux|rire|sourire|super|visage|visage très souriant',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (ja). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': 'にっこり笑う|スマイル|ナイス|にっこり|ハッピー|笑う|笑顔|顔',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (ko). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': '활짝 웃는 얼굴|미소|발랄함|스마일|얼굴|웃음|치아|행복|환호',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (pt). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': 'rosto risonho|engraçado|feliz|lol|rindo|risada|riso|rosto|sorridente',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from CLDR 48.2.0 annotations (zh). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
// "name|keyword|keyword…" per emoji.
|
|
3
4
|
const names: Record<string, string> = {
|
|
4
5
|
'😀': '嘿嘿|笑脸|脸|高兴',
|
package/src/data/emojis.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-emoji-data.mjs from Unicode emoji-test.txt (Emoji 15). Don't edit by hand.
|
|
2
|
+
// Emoji data © Unicode, Inc., under the Unicode License v3 (dist/THIRD_PARTY_LICENSES.md, scripts/licenses/unicode-license-v3.txt).
|
|
2
3
|
|
|
3
4
|
export interface EmojiCategory {
|
|
4
5
|
id: string
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Directive } from 'vue'
|
|
2
|
+
|
|
3
|
+
/** Options for `v-ripple`. */
|
|
4
|
+
export interface RippleOptions {
|
|
5
|
+
/** No ripple while true (e.g. bound to the element's disabled state). */
|
|
6
|
+
disabled?: boolean
|
|
7
|
+
/** Any CSS color for the ripple; defaults to the element's text color (`currentColor`). */
|
|
8
|
+
color?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** `v-ripple` value: nothing or `true` (on), `false` (off), a CSS color, or an options object. */
|
|
12
|
+
export type RippleValue = boolean | string | RippleOptions | null | undefined
|
|
13
|
+
|
|
14
|
+
function normalize(value: RippleValue): RippleOptions {
|
|
15
|
+
if (value === false) return { disabled: true }
|
|
16
|
+
if (typeof value === 'string') return { color: value }
|
|
17
|
+
if (value === true || value == null) return {}
|
|
18
|
+
return value
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// The ripple sits in its own clipping layer (`border-radius: inherit`), so the host only needs to be
|
|
22
|
+
// positioned, not `overflow: hidden`.
|
|
23
|
+
function spawnRipple(host: HTMLElement, event: { clientX: number; clientY: number }, color?: string) {
|
|
24
|
+
const rect = host.getBoundingClientRect()
|
|
25
|
+
const d = Math.max(rect.width, rect.height) * 2
|
|
26
|
+
const layer = document.createElement('span')
|
|
27
|
+
layer.className = 'm3-ripple-layer'
|
|
28
|
+
const el = document.createElement('span')
|
|
29
|
+
el.className = 'm3-ripple'
|
|
30
|
+
el.style.cssText = `width:${d}px;height:${d}px;top:${event.clientY - rect.top - d / 2}px;left:${event.clientX - rect.left - d / 2}px`
|
|
31
|
+
if (color) el.style.background = color
|
|
32
|
+
layer.appendChild(el)
|
|
33
|
+
host.appendChild(layer)
|
|
34
|
+
el.addEventListener('animationend', () => layer.remove(), { once: true })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface RippleState {
|
|
38
|
+
options: RippleOptions
|
|
39
|
+
onPointerDown: (e: PointerEvent) => void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const states = new WeakMap<HTMLElement, RippleState>()
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The M3 press ripple for any element: `<div v-ripple>`, `v-ripple="false"`, `v-ripple="'#e91e63'"`
|
|
46
|
+
* or `v-ripple="{ disabled, color }"`. A statically positioned element is made `position: relative`.
|
|
47
|
+
* Registered globally as `v-ripple` by `createM3UI()`; import `vRipple` to use it without the plugin.
|
|
48
|
+
*/
|
|
49
|
+
export const vRipple: Directive<HTMLElement, RippleValue> = {
|
|
50
|
+
mounted(el, binding) {
|
|
51
|
+
const state: RippleState = {
|
|
52
|
+
options: normalize(binding.value),
|
|
53
|
+
onPointerDown(e) {
|
|
54
|
+
if (state.options.disabled || e.button !== 0) return
|
|
55
|
+
// Checked on press, not on mount: the element may not be in the document yet when mounted.
|
|
56
|
+
const { position } = getComputedStyle(el)
|
|
57
|
+
if (!position || position === 'static') el.style.position = 'relative'
|
|
58
|
+
spawnRipple(el, e, state.options.color)
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
states.set(el, state)
|
|
62
|
+
el.addEventListener('pointerdown', state.onPointerDown)
|
|
63
|
+
},
|
|
64
|
+
updated(el, binding) {
|
|
65
|
+
const state = states.get(el)
|
|
66
|
+
if (state) state.options = normalize(binding.value)
|
|
67
|
+
},
|
|
68
|
+
beforeUnmount(el) {
|
|
69
|
+
const state = states.get(el)
|
|
70
|
+
if (state) el.removeEventListener('pointerdown', state.onPointerDown)
|
|
71
|
+
states.delete(el)
|
|
72
|
+
},
|
|
73
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type { M3UIOptions } from './plugin'
|
|
|
6
6
|
export { useTheme } from './composables/useTheme'
|
|
7
7
|
export type { Theme } from './composables/useTheme'
|
|
8
8
|
export { useColorPalette, palettes } from './composables/useColorPalette'
|
|
9
|
-
export type { Palette, ActiveSeed } from './composables/useColorPalette'
|
|
9
|
+
export type { Palette, ActiveSeed, ContrastLevel } from './composables/useColorPalette'
|
|
10
10
|
export { SEED_PALETTE } from './composables/useColorPalette'
|
|
11
11
|
export { generateScheme, schemeToCss, schemeRoles } from './composables/dynamicColor'
|
|
12
12
|
export type { SchemeVariant, SeedOptions, GeneratedScheme } from './composables/dynamicColor'
|
|
@@ -22,18 +22,29 @@ export { useNotification } from './composables/useNotification'
|
|
|
22
22
|
export type { Notification, NotificationVariant, NotificationPosition, NotificationOptions } from './composables/useNotification'
|
|
23
23
|
export { useDebounce } from './composables/useDebounce'
|
|
24
24
|
export { usePageProgress } from './composables/usePageProgress'
|
|
25
|
+
export { useSpring } from './composables/_useSpring'
|
|
26
|
+
export { motionSprings, motionEasings, motionDurations, cubicBezier } from './composables/motion'
|
|
27
|
+
export type { SpringSpec } from './composables/motion'
|
|
28
|
+
|
|
29
|
+
// Directives
|
|
30
|
+
export { vRipple } from './directives/vRipple'
|
|
31
|
+
export type { RippleOptions, RippleValue } from './directives/vRipple'
|
|
25
32
|
|
|
26
33
|
// Components
|
|
27
34
|
export { default as MAbsolute } from './components/MAbsolute.vue'
|
|
28
35
|
export { default as MAlert } from './components/MAlert.vue'
|
|
29
36
|
export { default as MAutocomplete } from './components/MAutocomplete.vue'
|
|
30
37
|
export { default as MAppBar } from './components/MAppBar.vue'
|
|
38
|
+
export { default as MAppBarWithSearch } from './components/MAppBarWithSearch.vue'
|
|
39
|
+
export { default as MBottomAppBar } from './components/MBottomAppBar.vue'
|
|
31
40
|
export { default as MAppLayout } from './components/MAppLayout.vue'
|
|
32
41
|
export { default as MAspectRatio } from './components/MAspectRatio.vue'
|
|
33
42
|
export { default as MAvatar } from './components/MAvatar.vue'
|
|
34
43
|
export { default as MBadge } from './components/MBadge.vue'
|
|
35
44
|
export { default as MBar } from './components/MBar.vue'
|
|
36
45
|
export { default as MBottomSheet } from './components/MBottomSheet.vue'
|
|
46
|
+
export { default as MBottomSheetScaffold } from './components/MBottomSheetScaffold.vue'
|
|
47
|
+
export type { BottomSheetValue } from './components/MBottomSheetScaffold.vue'
|
|
37
48
|
export { default as MBox } from './components/MBox.vue'
|
|
38
49
|
export { default as MBreadcrumbs } from './components/MBreadcrumbs.vue'
|
|
39
50
|
export { default as MButton } from './components/MButton.vue'
|
|
@@ -173,6 +184,7 @@ export { default as MTextField } from './components/MTextField.vue'
|
|
|
173
184
|
export { default as MTimeline } from './components/MTimeline.vue'
|
|
174
185
|
export { default as MTimePicker } from './components/MTimePicker.vue'
|
|
175
186
|
export { default as MTimePickerModal } from './components/MTimePickerModal.vue'
|
|
187
|
+
export { default as MTimeScroll } from './components/MTimeScroll.vue'
|
|
176
188
|
export { default as MTitle } from './components/MTitle.vue'
|
|
177
189
|
export { default as MToggleButton } from './components/MToggleButton.vue'
|
|
178
190
|
export { default as MTooltip } from './components/MTooltip.vue'
|