@mkbabb/glass-ui 2.0.0 → 2.1.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.
@@ -0,0 +1,138 @@
1
+ /*
2
+ * drawer.css — Detented bottom-sheet grammar (AN.W3).
3
+ *
4
+ * vaul-vue owns the snap math (the spring transform between snap-points, the
5
+ * drag-resistance overshoot, the `data-vaul-*` state attributes). glass-ui owns
6
+ * the LOOK: the glass sheet surface, the rounded peek handle, the snap-stop
7
+ * indicator rules, and the drag-resistance feel-tuning. This file is the
8
+ * substrate so a consumer mounting `<Drawer mode="live-behind">` does not
9
+ * re-author the three detents from scratch.
10
+ *
11
+ * Token-first — every visual axis reads a custom property. Consumers retune
12
+ * the sheet by overriding the rungs below, never by editing this file.
13
+ */
14
+
15
+ :root {
16
+ /* Detent grammar knobs — overridable per-consumer */
17
+ --drawer-handle-w: 2.25rem;
18
+ --drawer-handle-h: 0.3125rem; /* 5px — vaul's hit-target rhythm */
19
+ --drawer-handle-color: var(--muted-foreground);
20
+ --drawer-handle-opacity: 0.45;
21
+ --drawer-handle-opacity-active: 0.85;
22
+ --drawer-snap-rule-color: color-mix(in srgb, var(--border) 60%, transparent);
23
+ }
24
+
25
+ /*
26
+ * The sheet surface. Replaces the prior inline-Tailwind triplet on
27
+ * DrawerContent.vue so the glass tier + the snap transform feel live in one
28
+ * token-driven place. The fixed/inset/z-index layout stays here too.
29
+ *
30
+ * NOTE: vaul-vue sets `transition: transform .5s cubic-bezier(.32,.72,0,1)` and
31
+ * `touch-action: none` on `[data-vaul-drawer]` from its injected stylesheet —
32
+ * that IS the drag-resistance spring curve. We do NOT override `transition` so
33
+ * the snap feel is preserved; we layer border-radius + glass surface on top.
34
+ */
35
+ .glass-drawer {
36
+ position: fixed;
37
+ inset-inline: 0;
38
+ bottom: 0;
39
+ z-index: var(--z-modal);
40
+ display: flex;
41
+ flex-direction: column;
42
+ height: auto;
43
+ max-height: 97vh;
44
+ margin-top: 6rem;
45
+ border: 1px solid var(--border);
46
+ border-bottom: 0;
47
+ border-start-start-radius: var(--radius-panel);
48
+ border-start-end-radius: var(--radius-panel);
49
+ background-color: hsl(var(--background));
50
+ box-shadow: var(--shadow-2xl);
51
+ }
52
+
53
+ /*
54
+ * Detented (snap-point) sheets fill the viewport height. vaul positions the
55
+ * sheet by translating it DOWN by `innerHeight - (fraction * innerHeight)` —
56
+ * so for a snap fraction to read as that fraction OF THE VIEWPORT, the sheet's
57
+ * top must sit at the viewport top when fully open (offset 0). A `height: auto`
58
+ * content sheet would instead translate off-screen. vaul tags the snap case via
59
+ * `[data-vaul-snap-points=true]`; we fill height there and let the content
60
+ * scroll inside.
61
+ */
62
+ .glass-drawer[data-vaul-snap-points="true"] {
63
+ height: 100%;
64
+ max-height: 100%;
65
+ margin-top: 0;
66
+ }
67
+
68
+ /* Live-behind direction variants — vaul tags the root with the drag axis.
69
+ Bottom is the default + the F-side pattern; the others ride the same surface
70
+ so a top/side live-behind sheet inherits the grammar. */
71
+ .glass-drawer[data-vaul-drawer-direction="top"] {
72
+ bottom: auto;
73
+ top: 0;
74
+ margin-top: 0;
75
+ margin-bottom: 6rem;
76
+ border-top: 0;
77
+ border-bottom: 1px solid var(--border);
78
+ border-radius: 0 0 var(--radius-panel) var(--radius-panel);
79
+ }
80
+
81
+ /*
82
+ * Peek handle — the rounded grip at the top of the sheet. It is the visual
83
+ * affordance the user drags to cycle peek → half → full. vaul-vue intensifies
84
+ * the grip on `:active` via its own `[data-vaul-handle]` rules when the consumer
85
+ * uses `<DrawerHandle>`; this is the glass-ui default grip for the common case.
86
+ */
87
+ .glass-drawer-handle {
88
+ flex-shrink: 0;
89
+ display: flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ padding-block: 0.75rem 0.5rem;
93
+ touch-action: none;
94
+ }
95
+
96
+ .glass-drawer-grip {
97
+ display: block;
98
+ width: var(--drawer-handle-w);
99
+ height: var(--drawer-handle-h);
100
+ border-radius: var(--radius-pill);
101
+ background-color: hsl(var(--drawer-handle-color));
102
+ opacity: var(--drawer-handle-opacity);
103
+ transition: opacity var(--duration-fast) var(--ease-out),
104
+ width var(--duration-fast) var(--ease-out);
105
+ }
106
+
107
+ /* While the sheet is being dragged vaul exposes the gesture; intensify the grip
108
+ so the affordance reads as "live". `:active` covers the pointer-held case for
109
+ the default grip; consumers using vaul's `<DrawerHandle>` get its own active
110
+ rule in addition. */
111
+ .glass-drawer-handle:active .glass-drawer-grip,
112
+ .glass-drawer:hover .glass-drawer-grip {
113
+ opacity: var(--drawer-handle-opacity-active);
114
+ width: calc(var(--drawer-handle-w) * 1.15);
115
+ }
116
+
117
+ /*
118
+ * Snap-stop indicators — subtle full-width hairline rules that mark where the
119
+ * sheet content sections break across detents. A consumer opts in by adding
120
+ * `.glass-drawer-snap-rule` to a separator element inside the sheet; it reads as
121
+ * the detent boundary line without competing with the content. This is the
122
+ * "snap-stop visual indicator" the spec asks for, expressed as an opt-in class
123
+ * (the detents themselves are positional, owned by vaul; the RULE is the look).
124
+ */
125
+ .glass-drawer-snap-rule {
126
+ height: 1px;
127
+ margin-inline: calc(var(--radius-panel) * -0.5);
128
+ border: 0;
129
+ background-color: var(--drawer-snap-rule-color);
130
+ }
131
+
132
+ /* Reduced-motion — vaul's transform transition is its own; we only suppress the
133
+ grip's affordance animation so the handle does not pulse for PRM users. */
134
+ @media (prefers-reduced-motion: reduce) {
135
+ .glass-drawer-grip {
136
+ transition: none;
137
+ }
138
+ }
@@ -4,9 +4,18 @@
4
4
  * Import this in your project's main CSS file:
5
5
  * @import "tailwindcss";
6
6
  * @import "tw-animate-css";
7
- * @import "@mkbabb/glass-ui/styles"; (critical no font payload)
7
+ * @import "@mkbabb/glass-ui/styles"; (token cascade + SFC scoped CSS)
8
8
  * @import "@mkbabb/glass-ui/styles/fonts"; (OFL woff2 corpus, loaded once)
9
9
  * (then add your project-specific token overrides locally)
10
+ *
11
+ * AN.W1 — the single `@mkbabb/glass-ui/styles` import resolves the COMPLETE
12
+ * stylesheet: this @import cascade PLUS the per-component `<style scoped>`
13
+ * payload (Aurora grid layering, Progress/Slider/Notification/… scoped rules).
14
+ * The build folds the SFC bundle (`dist/glass-ui.css`) into the dist copy of
15
+ * this file (vite.config.ts `publishStyleAssets`), so a consumer never needs
16
+ * a second `@import "@mkbabb/glass-ui/styles.css"` line. The `./styles.css`
17
+ * export stays reachable as a transparent SFC-only entry (NOT a back-compat
18
+ * alias) for a cascade-free consumer.
10
19
  */
11
20
 
12
21
  /*
@@ -69,8 +78,10 @@
69
78
  * 14. glyph-face.css — P-tranche component CSS (cap + backplate).
70
79
  * 15. disco-glyph.css — P-tranche component CSS (layered fills).
71
80
  * 16. hover-popover.css — V.W3 popover-animation grammar.
81
+ * 17. drawer.css — AN.W3 detented bottom-sheet grammar (glass
82
+ * sheet surface + peek handle + snap-stop rules).
72
83
  *
73
- * Per-package component CSS lives at (12)-(16) (loaded after utilities so
84
+ * Per-package component CSS lives at (12)-(17) (loaded after utilities so
74
85
  * component-local recipes can override). New per-package CSS files append
75
86
  * to that tail.
76
87
  */
@@ -90,7 +101,12 @@
90
101
  @import "./glyph-face.css";
91
102
  @import "./disco-glyph.css";
92
103
  @import "./hover-popover.css";
104
+ @import "./drawer.css";
93
105
 
94
106
  /* Ensure consumer's Tailwind scans glass-ui components for utility classes
95
107
  (e.g. CVA button variants like text-destructive-foreground) */
108
+ /* AN.W1 — SFC scoped component CSS (folded so a single
109
+ @import "@mkbabb/glass-ui/styles" carries cascade + components) */
110
+ @import "../glass-ui.css";
111
+
96
112
  @source "../components";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkbabb/glass-ui",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Glassmorphic design system — Vue 3.5 components, reka-ui primitives, Tailwind CSS v4 tokens",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,138 @@
1
+ /*
2
+ * drawer.css — Detented bottom-sheet grammar (AN.W3).
3
+ *
4
+ * vaul-vue owns the snap math (the spring transform between snap-points, the
5
+ * drag-resistance overshoot, the `data-vaul-*` state attributes). glass-ui owns
6
+ * the LOOK: the glass sheet surface, the rounded peek handle, the snap-stop
7
+ * indicator rules, and the drag-resistance feel-tuning. This file is the
8
+ * substrate so a consumer mounting `<Drawer mode="live-behind">` does not
9
+ * re-author the three detents from scratch.
10
+ *
11
+ * Token-first — every visual axis reads a custom property. Consumers retune
12
+ * the sheet by overriding the rungs below, never by editing this file.
13
+ */
14
+
15
+ :root {
16
+ /* Detent grammar knobs — overridable per-consumer */
17
+ --drawer-handle-w: 2.25rem;
18
+ --drawer-handle-h: 0.3125rem; /* 5px — vaul's hit-target rhythm */
19
+ --drawer-handle-color: var(--muted-foreground);
20
+ --drawer-handle-opacity: 0.45;
21
+ --drawer-handle-opacity-active: 0.85;
22
+ --drawer-snap-rule-color: color-mix(in srgb, var(--border) 60%, transparent);
23
+ }
24
+
25
+ /*
26
+ * The sheet surface. Replaces the prior inline-Tailwind triplet on
27
+ * DrawerContent.vue so the glass tier + the snap transform feel live in one
28
+ * token-driven place. The fixed/inset/z-index layout stays here too.
29
+ *
30
+ * NOTE: vaul-vue sets `transition: transform .5s cubic-bezier(.32,.72,0,1)` and
31
+ * `touch-action: none` on `[data-vaul-drawer]` from its injected stylesheet —
32
+ * that IS the drag-resistance spring curve. We do NOT override `transition` so
33
+ * the snap feel is preserved; we layer border-radius + glass surface on top.
34
+ */
35
+ .glass-drawer {
36
+ position: fixed;
37
+ inset-inline: 0;
38
+ bottom: 0;
39
+ z-index: var(--z-modal);
40
+ display: flex;
41
+ flex-direction: column;
42
+ height: auto;
43
+ max-height: 97vh;
44
+ margin-top: 6rem;
45
+ border: 1px solid var(--border);
46
+ border-bottom: 0;
47
+ border-start-start-radius: var(--radius-panel);
48
+ border-start-end-radius: var(--radius-panel);
49
+ background-color: hsl(var(--background));
50
+ box-shadow: var(--shadow-2xl);
51
+ }
52
+
53
+ /*
54
+ * Detented (snap-point) sheets fill the viewport height. vaul positions the
55
+ * sheet by translating it DOWN by `innerHeight - (fraction * innerHeight)` —
56
+ * so for a snap fraction to read as that fraction OF THE VIEWPORT, the sheet's
57
+ * top must sit at the viewport top when fully open (offset 0). A `height: auto`
58
+ * content sheet would instead translate off-screen. vaul tags the snap case via
59
+ * `[data-vaul-snap-points=true]`; we fill height there and let the content
60
+ * scroll inside.
61
+ */
62
+ .glass-drawer[data-vaul-snap-points="true"] {
63
+ height: 100%;
64
+ max-height: 100%;
65
+ margin-top: 0;
66
+ }
67
+
68
+ /* Live-behind direction variants — vaul tags the root with the drag axis.
69
+ Bottom is the default + the F-side pattern; the others ride the same surface
70
+ so a top/side live-behind sheet inherits the grammar. */
71
+ .glass-drawer[data-vaul-drawer-direction="top"] {
72
+ bottom: auto;
73
+ top: 0;
74
+ margin-top: 0;
75
+ margin-bottom: 6rem;
76
+ border-top: 0;
77
+ border-bottom: 1px solid var(--border);
78
+ border-radius: 0 0 var(--radius-panel) var(--radius-panel);
79
+ }
80
+
81
+ /*
82
+ * Peek handle — the rounded grip at the top of the sheet. It is the visual
83
+ * affordance the user drags to cycle peek → half → full. vaul-vue intensifies
84
+ * the grip on `:active` via its own `[data-vaul-handle]` rules when the consumer
85
+ * uses `<DrawerHandle>`; this is the glass-ui default grip for the common case.
86
+ */
87
+ .glass-drawer-handle {
88
+ flex-shrink: 0;
89
+ display: flex;
90
+ align-items: center;
91
+ justify-content: center;
92
+ padding-block: 0.75rem 0.5rem;
93
+ touch-action: none;
94
+ }
95
+
96
+ .glass-drawer-grip {
97
+ display: block;
98
+ width: var(--drawer-handle-w);
99
+ height: var(--drawer-handle-h);
100
+ border-radius: var(--radius-pill);
101
+ background-color: hsl(var(--drawer-handle-color));
102
+ opacity: var(--drawer-handle-opacity);
103
+ transition: opacity var(--duration-fast) var(--ease-out),
104
+ width var(--duration-fast) var(--ease-out);
105
+ }
106
+
107
+ /* While the sheet is being dragged vaul exposes the gesture; intensify the grip
108
+ so the affordance reads as "live". `:active` covers the pointer-held case for
109
+ the default grip; consumers using vaul's `<DrawerHandle>` get its own active
110
+ rule in addition. */
111
+ .glass-drawer-handle:active .glass-drawer-grip,
112
+ .glass-drawer:hover .glass-drawer-grip {
113
+ opacity: var(--drawer-handle-opacity-active);
114
+ width: calc(var(--drawer-handle-w) * 1.15);
115
+ }
116
+
117
+ /*
118
+ * Snap-stop indicators — subtle full-width hairline rules that mark where the
119
+ * sheet content sections break across detents. A consumer opts in by adding
120
+ * `.glass-drawer-snap-rule` to a separator element inside the sheet; it reads as
121
+ * the detent boundary line without competing with the content. This is the
122
+ * "snap-stop visual indicator" the spec asks for, expressed as an opt-in class
123
+ * (the detents themselves are positional, owned by vaul; the RULE is the look).
124
+ */
125
+ .glass-drawer-snap-rule {
126
+ height: 1px;
127
+ margin-inline: calc(var(--radius-panel) * -0.5);
128
+ border: 0;
129
+ background-color: var(--drawer-snap-rule-color);
130
+ }
131
+
132
+ /* Reduced-motion — vaul's transform transition is its own; we only suppress the
133
+ grip's affordance animation so the handle does not pulse for PRM users. */
134
+ @media (prefers-reduced-motion: reduce) {
135
+ .glass-drawer-grip {
136
+ transition: none;
137
+ }
138
+ }
@@ -4,9 +4,18 @@
4
4
  * Import this in your project's main CSS file:
5
5
  * @import "tailwindcss";
6
6
  * @import "tw-animate-css";
7
- * @import "@mkbabb/glass-ui/styles"; (critical no font payload)
7
+ * @import "@mkbabb/glass-ui/styles"; (token cascade + SFC scoped CSS)
8
8
  * @import "@mkbabb/glass-ui/styles/fonts"; (OFL woff2 corpus, loaded once)
9
9
  * (then add your project-specific token overrides locally)
10
+ *
11
+ * AN.W1 — the single `@mkbabb/glass-ui/styles` import resolves the COMPLETE
12
+ * stylesheet: this @import cascade PLUS the per-component `<style scoped>`
13
+ * payload (Aurora grid layering, Progress/Slider/Notification/… scoped rules).
14
+ * The build folds the SFC bundle (`dist/glass-ui.css`) into the dist copy of
15
+ * this file (vite.config.ts `publishStyleAssets`), so a consumer never needs
16
+ * a second `@import "@mkbabb/glass-ui/styles.css"` line. The `./styles.css`
17
+ * export stays reachable as a transparent SFC-only entry (NOT a back-compat
18
+ * alias) for a cascade-free consumer.
10
19
  */
11
20
 
12
21
  /*
@@ -69,8 +78,10 @@
69
78
  * 14. glyph-face.css — P-tranche component CSS (cap + backplate).
70
79
  * 15. disco-glyph.css — P-tranche component CSS (layered fills).
71
80
  * 16. hover-popover.css — V.W3 popover-animation grammar.
81
+ * 17. drawer.css — AN.W3 detented bottom-sheet grammar (glass
82
+ * sheet surface + peek handle + snap-stop rules).
72
83
  *
73
- * Per-package component CSS lives at (12)-(16) (loaded after utilities so
84
+ * Per-package component CSS lives at (12)-(17) (loaded after utilities so
74
85
  * component-local recipes can override). New per-package CSS files append
75
86
  * to that tail.
76
87
  */
@@ -90,6 +101,7 @@
90
101
  @import "./glyph-face.css";
91
102
  @import "./disco-glyph.css";
92
103
  @import "./hover-popover.css";
104
+ @import "./drawer.css";
93
105
 
94
106
  /* Ensure consumer's Tailwind scans glass-ui components for utility classes
95
107
  (e.g. CVA button variants like text-destructive-foreground) */