@glasshome/ui 1.40.0 → 1.41.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.
@@ -23,16 +23,13 @@ type ResponsiveDialogContentProps = ComponentProps<"div"> & {
23
23
  anchor?: HTMLElement;
24
24
  };
25
25
  declare const ResponsiveDialogContent: ParentComponent<ResponsiveDialogContentProps>;
26
- declare const ResponsiveDialogHeader: Component<JSX.HTMLAttributes<HTMLDivElement> & {
27
- media?: JSX.Element;
28
- action?: JSX.Element;
29
- wrap?: boolean;
30
- }>, ResponsiveDialogBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
26
+ declare const ResponsiveDialogHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, ResponsiveDialogBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
31
27
  as?: ValidComponent;
32
28
  }>, ResponsiveDialogFooter: Component<JSX.HTMLAttributes<HTMLDivElement>>;
33
29
  declare const ResponsiveDialogTitle: Component<ComponentProps<"h2">>;
34
30
  declare const ResponsiveDialogDescription: Component<ComponentProps<"p">>;
31
+ declare const ResponsiveDialogHead: Component<import("./dialog-parts.js").ModalHeadProps>;
35
32
  /** Defaults to the footer's outline button; an icon-only close passes `ghost`
36
33
  * so the glyph is not boxed. */
37
34
  declare const ResponsiveDialogClose: ParentComponent<ComponentProps<"button"> & VariantProps<typeof buttonVariants>>;
38
- export { ResponsiveDialog, ResponsiveDialogBody, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger, };
35
+ export { ResponsiveDialog, ResponsiveDialogBody, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHead, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger, };
@@ -24,11 +24,7 @@ type SheetContentProps = ComponentProps<typeof DialogPrimitive.Content> & {
24
24
  ariaLabel?: string;
25
25
  };
26
26
  declare const SheetContent: ParentComponent<SheetContentProps>;
27
- declare const SheetHeader: Component<JSX.HTMLAttributes<HTMLDivElement> & {
28
- media?: JSX.Element;
29
- action?: JSX.Element;
30
- wrap?: boolean;
31
- }>, SheetBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
27
+ declare const SheetHeader: Component<import("./dialog-parts.js").ModalHeaderProps>, SheetBody: Component<JSX.HTMLAttributes<HTMLDivElement> & {
32
28
  as?: import("solid-js").ValidComponent;
33
29
  }>, SheetFooter: Component<JSX.HTMLAttributes<HTMLDivElement>>;
34
30
  declare const SheetTitle: Component<ComponentProps<typeof DialogPrimitive.Title>>;
@@ -9,9 +9,11 @@ type TabsProps = ComponentProps<typeof TabsPrimitive> & {
9
9
  };
10
10
  declare const Tabs: Component<TabsProps>;
11
11
  declare const TabsList: Component<ComponentProps<typeof TabsPrimitive.List>>;
12
- /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it. */
12
+ /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it.
13
+ * `inline` sets the glyph beside the word instead, for a row that stands alone. */
13
14
  declare const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & {
14
15
  icon?: string;
16
+ inline?: boolean;
15
17
  }>;
16
18
  declare const TabsContent: Component<ComponentProps<typeof TabsPrimitive.Content>>;
17
19
  export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -341,7 +341,7 @@ function bt(e) {
341
341
  }
342
342
  //#endregion
343
343
  //#region src/lib/overlay-classes.ts
344
- var xt = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]", St = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(var(--_material-vibrancy,1)*1.2)] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]", Ct = `${xt} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`, wt = `${Ct} ${St}`, Tt = `${xt} [--glass-base:var(--popover)]`, Et = "bg-scrim backdrop-blur-md", Dt = `${Ye.overlay} rounded-md text-popover-foreground outline-hidden`;
344
+ var xt = "glass glass-frost [--glass-rim:0.5] [--glass-lift:0.6] [--glass-light:0] [--glass-edge:color-mix(in_srgb,var(--border)_90%,transparent)]", St = "backdrop-blur-[var(--glass-blur,var(--material-blur,24px))] backdrop-saturate-[calc(var(--_material-vibrancy,1)*1.2)] backdrop-brightness-[calc(1+(var(--_material-vibrancy,1)-1)*0.2)]", Ct = `${xt} [--glass-base:color-mix(in_srgb,var(--popover)_92%,transparent)]`, wt = `${Ct} ${St}`, Tt = `${xt} [--glass-base:var(--popover)]`, Et = "bg-scrim backdrop-blur-md pointer-coarse:backdrop-blur-none", Dt = `${Ye.overlay} rounded-md text-popover-foreground outline-hidden`;
345
345
  `${wt}${Dt}`;
346
346
  var Ot = `${wt} relative ${Dt}`, kt = (e) => {
347
347
  let t = e?.getBoundingClientRect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/ui",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "SolidJS component library for GlassHome, built on Kobalte",
5
5
  "keywords": [
6
6
  "components",
@@ -22,10 +22,8 @@ export const OVERLAY_SURFACE = `${OVERLAY_SURFACE_BASE} ${OVERLAY_BLUR}`;
22
22
  * behind it would just be see-through. */
23
23
  export const OVERLAY_SURFACE_OPAQUE = `${OVERLAY_KNOBS} [--glass-base:var(--popover)]`;
24
24
 
25
- /* Modal scrim behind dialogs/sheets, from the theme's own --scrim so light can
26
- * darken while dark keeps its background wash. BottomSheet keeps its own
27
- * unblurred scrim (backdrop-blur is too slow on mobile). */
28
- export const SCRIM_CLASS = "bg-scrim backdrop-blur-md";
25
+ /* Touch screens only dim: a full-screen blur over moving widgets re-blurs every frame on a tablet GPU. */
26
+ export const SCRIM_CLASS = "bg-scrim backdrop-blur-md pointer-coarse:backdrop-blur-none";
29
27
 
30
28
  export const PANEL_TAIL = `${Z_CLASS.overlay} rounded-md text-popover-foreground outline-hidden`;
31
29
 
@@ -6,6 +6,7 @@ import {
6
6
  type Component,
7
7
  type ComponentProps,
8
8
  createSignal,
9
+ type JSX,
9
10
  type ParentComponent,
10
11
  splitProps,
11
12
  } from "solid-js";
@@ -14,7 +15,9 @@ import { buttonVariants } from "../lib/button-variants.js";
14
15
  import { cn } from "../lib/utils.js";
15
16
  import {
16
17
  createModalDismiss,
18
+ createModalHead,
17
19
  createModalParts,
20
+ type ModalHeadProps,
18
21
  MODAL_ANCHOR,
19
22
  MODAL_DESCRIPTION,
20
23
  MODAL_PANEL,
@@ -133,6 +136,15 @@ const AlertDialogDescription: Component<ComponentProps<typeof AlertDialogPrimiti
133
136
  );
134
137
  };
135
138
 
139
+ /** An alert dialog is read aloud as a description, and the line carries the consequence. */
140
+ type AlertDialogHeadProps = ModalHeadProps & { line: JSX.Element };
141
+
142
+ const AlertDialogHead = createModalHead<AlertDialogHeadProps>(
143
+ AlertDialogHeader,
144
+ AlertDialogTitle,
145
+ AlertDialogDescription,
146
+ );
147
+
136
148
  type AlertDialogButtonProps = ModalDismissProps &
137
149
  Partial<Pick<VariantProps<typeof buttonVariants>, "variant" | "size">>;
138
150
 
@@ -175,6 +187,7 @@ export {
175
187
  AlertDialogContent,
176
188
  AlertDialogDescription,
177
189
  AlertDialogFooter,
190
+ AlertDialogHead,
178
191
  AlertDialogHeader,
179
192
  AlertDialogTitle,
180
193
  AlertDialogTrigger,
@@ -88,7 +88,7 @@ const Alert: Component<AlertProps> = (props) => {
88
88
  data-size={local.size ?? "default"}
89
89
  class={cn(
90
90
  ALERT_CLASS,
91
- "glass glass-tint",
91
+ "glass glass-tint shrink-0",
92
92
  local.size === "sm" && ALERT_SM_CLASS,
93
93
  local.class,
94
94
  )}
@@ -0,0 +1,62 @@
1
+ import type { JSX } from "solid-js";
2
+ import { children, Show } from "solid-js";
3
+ import {
4
+ AlertDialog,
5
+ AlertDialogAction,
6
+ AlertDialogBody,
7
+ AlertDialogCancel,
8
+ AlertDialogContent,
9
+ AlertDialogFooter,
10
+ AlertDialogHead,
11
+ } from "./alert-dialog.js";
12
+
13
+ export interface ConfirmDialogProps {
14
+ open: boolean;
15
+ onOpenChange: (open: boolean) => void;
16
+ /** The glyph that tells this confirm from the next. */
17
+ icon: string;
18
+ /** Defaults to destructive red when `destructive`, else the material accent. */
19
+ tone?: string;
20
+ /** The question or the outcome, naming its object: "Remove Anna?". */
21
+ title: string;
22
+ /** The consequence, one line. */
23
+ line: JSX.Element;
24
+ actionLabel: string;
25
+ /** Defaults to true: nearly every confirm is a delete or a removal. */
26
+ destructive?: boolean;
27
+ busy?: boolean;
28
+ onConfirm: () => void;
29
+ /** The thing the confirm is about (avatars, a preview), shown instead of described. */
30
+ children?: JSX.Element;
31
+ }
32
+
33
+ /** A yes/no on one object: media, a short question, the consequence, Cancel and the action. */
34
+ export function ConfirmDialog(props: ConfirmDialogProps): JSX.Element {
35
+ const destructive = () => props.destructive ?? true;
36
+ const thing = children(() => props.children);
37
+ return (
38
+ <AlertDialog open={props.open} onOpenChange={props.onOpenChange}>
39
+ <AlertDialogContent>
40
+ <AlertDialogHead
41
+ icon={props.icon}
42
+ tone={props.tone ?? (destructive() ? "var(--destructive)" : "var(--material-accent)")}
43
+ title={props.title}
44
+ line={props.line}
45
+ />
46
+ <Show when={thing()}>
47
+ <AlertDialogBody>{thing()}</AlertDialogBody>
48
+ </Show>
49
+ <AlertDialogFooter>
50
+ <AlertDialogCancel>Cancel</AlertDialogCancel>
51
+ <AlertDialogAction
52
+ variant={destructive() ? "destructive" : "default"}
53
+ busy={props.busy}
54
+ onClick={() => props.onConfirm()}
55
+ >
56
+ {props.actionLabel}
57
+ </AlertDialogAction>
58
+ </AlertDialogFooter>
59
+ </AlertDialogContent>
60
+ </AlertDialog>
61
+ );
62
+ }
@@ -24,6 +24,7 @@ import { ANCHORED_MOTION, MODAL_MOTION, SCRIM_MOTION } from "../lib/motion-class
24
24
  import { OVERLAY_SURFACE, SCRIM_CLASS } from "../lib/overlay-classes.js";
25
25
  import { cn } from "../lib/utils.js";
26
26
  import { acquireScrollLock, releaseScrollLock } from "./bottom-sheet/scroll-lock.js";
27
+ import { SectionIcon } from "./section-card.js";
27
28
 
28
29
  /* kobalte 0.13.13 builds AlertDialog with Object.assign(DialogRoot, ...), the
29
30
  * same object Dialog is built from, so whichever of the two modules a bundle
@@ -96,7 +97,7 @@ const MODAL_FOOTER =
96
97
  export const MODAL_TITLE = "font-semibold text-foreground text-lg leading-none tracking-tight";
97
98
  export const MODAL_DESCRIPTION = "text-muted-foreground text-sm";
98
99
 
99
- type ModalHeaderProps = ComponentProps<"div"> & {
100
+ export type ModalHeaderProps = ComponentProps<"div"> & {
100
101
  /** Avatar or icon, rendered ahead of the title column. */
101
102
  media?: JSX.Element;
102
103
  action?: JSX.Element;
@@ -176,6 +177,55 @@ export function createModalParts(slot: string): ModalParts {
176
177
  return { Header, Body, Footer };
177
178
  }
178
179
 
180
+ export type ModalMedia =
181
+ | { icon: string; tone?: string; avatar?: never }
182
+ | { avatar: JSX.Element; icon?: never; tone?: never };
183
+
184
+ export type ModalHeadProps = ModalMedia & {
185
+ /** A few words: the outcome or the question. */
186
+ title: string;
187
+ /** One line under the title; a `Term` goes here. */
188
+ line?: JSX.Element;
189
+ /** Badges after the title. */
190
+ status?: JSX.Element;
191
+ /** The title is a key or an id: mono, breaks anywhere. */
192
+ mono?: boolean;
193
+ /** A step indicator, tabs, a close or a link; the work's buttons live in the Footer. */
194
+ action?: JSX.Element;
195
+ wrap?: boolean;
196
+ };
197
+
198
+ /** The header door: media, a title and one line, no free children. A family
199
+ * hands in its own Header, Title and Description so ResponsiveDialog still
200
+ * switches between dialog and sheet parts at render time. */
201
+ export function createModalHead<P extends ModalHeadProps = ModalHeadProps>(
202
+ Header: Component<ModalHeaderProps>,
203
+ Title: Component<ComponentProps<"h2">>,
204
+ Description: Component<ComponentProps<"p">>,
205
+ ): Component<P> {
206
+ return (props) => {
207
+ const line = children(() => props.line);
208
+ const status = children(() => props.status);
209
+ return (
210
+ <Header
211
+ wrap={props.wrap}
212
+ action={props.action}
213
+ media={props.avatar ?? <SectionIcon icon={props.icon} tone={props.tone} size="md" />}
214
+ >
215
+ <Title
216
+ class={cn(status() && "flex items-center gap-2", props.mono && "font-mono break-all")}
217
+ >
218
+ {props.title}
219
+ {status()}
220
+ </Title>
221
+ <Show when={line()}>
222
+ <Description>{line()}</Description>
223
+ </Show>
224
+ </Header>
225
+ );
226
+ };
227
+ }
228
+
179
229
  /** Solid's handler prop is a union: a plain function, or the bound
180
230
  * `[handler, data]` form that calls `handler(data, event)`. A wrapper that
181
231
  * only checks for a function silently drops the bound one. */
@@ -17,6 +17,7 @@ import { cn } from "../lib/utils.js";
17
17
  import {
18
18
  ANCHORED_PANEL,
19
19
  createModalDismiss,
20
+ createModalHead,
20
21
  createModalParts,
21
22
  MODAL_ANCHOR,
22
23
  MODAL_DESCRIPTION,
@@ -181,6 +182,8 @@ const DialogDescription: Component<ComponentProps<typeof DialogPrimitive.Descrip
181
182
  );
182
183
  };
183
184
 
185
+ const DialogHead = createModalHead(DialogHeader, DialogTitle, DialogDescription);
186
+
184
187
  export {
185
188
  Dialog,
186
189
  DialogBody,
@@ -188,6 +191,7 @@ export {
188
191
  DialogContent,
189
192
  DialogDescription,
190
193
  DialogFooter,
194
+ DialogHead,
191
195
  DialogHeader,
192
196
  DialogTitle,
193
197
  DialogTrigger,
@@ -0,0 +1,71 @@
1
+ interface TrustedPolicy {
2
+ createHTML(input: string): string;
3
+ }
4
+ let policy: TrustedPolicy | null | undefined;
5
+
6
+ // Icon bodies come from the build or the host's own icon route; under a
7
+ // require-trusted-types-for CSP the assignment still needs a policy.
8
+ export function trusted(html: string): string {
9
+ if (policy === undefined) {
10
+ const tt = (
11
+ globalThis as {
12
+ trustedTypes?: { createPolicy(name: string, rules: TrustedPolicy): TrustedPolicy };
13
+ }
14
+ ).trustedTypes;
15
+ try {
16
+ policy = tt ? tt.createPolicy("glasshome-ui", { createHTML: (s) => s }) : null;
17
+ } catch {
18
+ policy = null;
19
+ }
20
+ }
21
+ return policy ? policy.createHTML(html) : html;
22
+ }
23
+
24
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
25
+
26
+ function parseBody(body: string): Element {
27
+ const holder = document.createElementNS(SVG_NAMESPACE, "svg");
28
+ holder.innerHTML = trusted(body);
29
+ return holder;
30
+ }
31
+
32
+ export interface BodyParseCache {
33
+ /** Fresh copies of the nodes `parse` makes for `body`; the caller owns them. */
34
+ nodes(body: string): Node[];
35
+ }
36
+
37
+ /**
38
+ * Parses each distinct body once and hands every caller its own deep copy, so no two icons
39
+ * share a node. Holds at most `limit` bodies; past that the oldest is dropped and parsed again
40
+ * if asked for later. A `parse` that throws leaves nothing cached.
41
+ */
42
+ export function createBodyParseCache(
43
+ limit: number,
44
+ parse: (body: string) => Element,
45
+ ): BodyParseCache {
46
+ // A Map iterates in insertion order, so its first key is the oldest body.
47
+ const parsed = new Map<string, Element>();
48
+ return {
49
+ nodes(body) {
50
+ if (!body) return [];
51
+ let holder = parsed.get(body);
52
+ if (!holder) {
53
+ holder = parse(body);
54
+ if (parsed.size >= limit) {
55
+ const oldest = parsed.keys().next();
56
+ if (!oldest.done) parsed.delete(oldest.value);
57
+ }
58
+ parsed.set(body, holder);
59
+ }
60
+ return Array.from(holder.childNodes, (node) => node.cloneNode(true));
61
+ },
62
+ };
63
+ }
64
+
65
+ const MAX_PARSED_BODIES = 512;
66
+ const bodies = createBodyParseCache(MAX_PARSED_BODIES, parseBody);
67
+
68
+ /** The nodes of one icon body, parsed once per distinct body. Needs a DOM. */
69
+ export function iconNodes(body: string): Node[] {
70
+ return bodies.nodes(body);
71
+ }
@@ -1,6 +1,16 @@
1
1
  import type { IconifyIcon } from "@iconify/types";
2
2
  import { iconToSVG } from "@iconify/utils";
3
- import { batch, createMemo, createSignal, type JSX, type Signal, splitProps } from "solid-js";
3
+ import {
4
+ batch,
5
+ createMemo,
6
+ createSignal,
7
+ type JSX,
8
+ mergeProps,
9
+ type Signal,
10
+ splitProps,
11
+ } from "solid-js";
12
+ import { isServer } from "solid-js/web";
13
+ import { iconNodes, trusted } from "./icon-nodes.js";
4
14
 
5
15
  export type IconData = IconifyIcon;
6
16
 
@@ -85,29 +95,6 @@ function lookup(name: string): IconData | undefined {
85
95
  return undefined;
86
96
  }
87
97
 
88
- interface TrustedPolicy {
89
- createHTML(input: string): string;
90
- }
91
- let policy: TrustedPolicy | null | undefined;
92
-
93
- // Icon bodies come from the build or the host's own icon route; under a
94
- // require-trusted-types-for CSP the assignment still needs a policy.
95
- function trusted(html: string): string {
96
- if (policy === undefined) {
97
- const tt = (
98
- globalThis as {
99
- trustedTypes?: { createPolicy(name: string, rules: TrustedPolicy): TrustedPolicy };
100
- }
101
- ).trustedTypes;
102
- try {
103
- policy = tt ? tt.createPolicy("glasshome-ui", { createHTML: (s) => s }) : null;
104
- } catch {
105
- policy = null;
106
- }
107
- }
108
- return policy ? policy.createHTML(html) : html;
109
- }
110
-
111
98
  export interface IconProps extends Omit<
112
99
  JSX.SvgSVGAttributes<SVGSVGElement>,
113
100
  "width" | "height" | "children"
@@ -134,24 +121,40 @@ export function Icon(props: IconProps) {
134
121
  return iconToSVG(data, size);
135
122
  });
136
123
  const body = createMemo(() => built().body);
137
- // A TrustedHTML is a fresh object per call, which the spread would write as a new innerHTML.
138
- const html = createMemo(() => trusted(body()));
139
124
  const named = () =>
140
125
  rest["aria-label"] != null || rest["aria-labelledby"] != null || rest.role != null;
141
- return (
142
- <svg
143
- xmlns="http://www.w3.org/2000/svg"
144
- data-slot="icon"
145
- data-icon={local.icon}
146
- aria-hidden={named() ? undefined : "true"}
147
- fill="currentColor"
148
- {...rest}
149
- viewBox={built().attributes.viewBox}
150
- width={built().attributes.width}
151
- height={built().attributes.height}
152
- innerHTML={html()}
153
- />
126
+ const shell = mergeProps(
127
+ {
128
+ xmlns: "http://www.w3.org/2000/svg",
129
+ "data-slot": "icon",
130
+ get "data-icon"() {
131
+ return local.icon;
132
+ },
133
+ get "aria-hidden"() {
134
+ return named() ? undefined : ("true" as const);
135
+ },
136
+ fill: "currentColor",
137
+ },
138
+ rest,
139
+ {
140
+ get viewBox() {
141
+ return built().attributes.viewBox;
142
+ },
143
+ get width() {
144
+ return built().attributes.width;
145
+ },
146
+ get height() {
147
+ return built().attributes.height;
148
+ },
149
+ },
154
150
  );
151
+ if (isServer) {
152
+ // A TrustedHTML is a fresh object per call, which the spread would write as a new innerHTML.
153
+ const html = createMemo(() => trusted(body()));
154
+ return <svg {...shell} innerHTML={html()} />;
155
+ }
156
+ const nodes = createMemo(() => iconNodes(body()));
157
+ return <svg {...shell}>{nodes()}</svg>;
155
158
  }
156
159
 
157
160
  function sizeOrDefault(size: { width: string | null; height: string | null }) {
@@ -18,10 +18,8 @@ import {
18
18
  AlertDialogAction,
19
19
  AlertDialogCancel,
20
20
  AlertDialogContent,
21
- AlertDialogDescription,
22
21
  AlertDialogFooter,
23
- AlertDialogHeader,
24
- AlertDialogTitle,
22
+ AlertDialogHead,
25
23
  } from "./alert-dialog.js";
26
24
  import { Badge } from "./badge.js";
27
25
  import { Button } from "./button.js";
@@ -180,8 +178,8 @@ function ImageGallery(
180
178
  const deleteDescription = createMemo(() => {
181
179
  const used = pendingDelete()?.usedBy ?? 0;
182
180
  return used === 0
183
- ? "This image isn't used by any widget."
184
- : `This image is used in ${used} widget${used === 1 ? "" : "s"}. Deleting it will leave those widgets without an image.`;
181
+ ? "No widget uses it."
182
+ : `${used} widget${used === 1 ? "" : "s"} will lose the image.`;
185
183
  });
186
184
 
187
185
  const chosenPreset = () => {
@@ -516,10 +514,12 @@ function ImageGallery(
516
514
  } else holdFocus();
517
515
  }}
518
516
  >
519
- <AlertDialogHeader>
520
- <AlertDialogTitle>Delete image?</AlertDialogTitle>
521
- <AlertDialogDescription>{deleteDescription()}</AlertDialogDescription>
522
- </AlertDialogHeader>
517
+ <AlertDialogHead
518
+ icon="lucide:image-off"
519
+ tone="var(--destructive)"
520
+ title="Delete image?"
521
+ line={deleteDescription()}
522
+ />
523
523
  <AlertDialogFooter>
524
524
  <AlertDialogCancel aria-label="Cancel">Cancel</AlertDialogCancel>
525
525
  <AlertDialogAction
@@ -29,6 +29,7 @@ export {
29
29
  AlertDialogContent,
30
30
  AlertDialogDescription,
31
31
  AlertDialogFooter,
32
+ AlertDialogHead,
32
33
  AlertDialogHeader,
33
34
  AlertDialogTitle,
34
35
  AlertDialogTrigger,
@@ -148,11 +149,13 @@ export {
148
149
  DialogContent,
149
150
  DialogDescription,
150
151
  DialogFooter,
152
+ DialogHead,
151
153
  DialogHeader,
152
154
  DialogTitle,
153
155
  DialogTrigger,
154
156
  } from "./dialog.js";
155
- export type { ModalSize } from "./dialog-parts.js";
157
+ export { ConfirmDialog, type ConfirmDialogProps } from "./confirm-dialog.js";
158
+ export type { ModalHeadProps, ModalMedia, ModalSize } from "./dialog-parts.js";
156
159
  export type { DockIconButtonProps, DockItem, DockPlacement, DockProps } from "./dock.js";
157
160
  export { Dock } from "./dock.js";
158
161
  export {
@@ -315,6 +318,7 @@ export {
315
318
  ResponsiveDialogContent,
316
319
  ResponsiveDialogDescription,
317
320
  ResponsiveDialogFooter,
321
+ ResponsiveDialogHead,
318
322
  ResponsiveDialogHeader,
319
323
  ResponsiveDialogTitle,
320
324
  ResponsiveDialogTrigger,
@@ -25,7 +25,7 @@ import {
25
25
  } from "./bottom-sheet/index.js";
26
26
  import { Button } from "./button.js";
27
27
  import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from "./dialog.js";
28
- import { createModalParts, type ModalSize } from "./dialog-parts.js";
28
+ import { createModalHead, createModalParts, type ModalSize } from "./dialog-parts.js";
29
29
 
30
30
  interface ResponsiveDialogContextValue {
31
31
  open: () => boolean;
@@ -153,6 +153,12 @@ const ResponsiveDialogDescription: Component<ComponentProps<"p">> = (props) => {
153
153
  );
154
154
  };
155
155
 
156
+ const ResponsiveDialogHead = createModalHead(
157
+ ResponsiveDialogHeader,
158
+ ResponsiveDialogTitle,
159
+ ResponsiveDialogDescription,
160
+ );
161
+
156
162
  /** Defaults to the footer's outline button; an icon-only close passes `ghost`
157
163
  * so the glyph is not boxed. */
158
164
  const ResponsiveDialogClose: ParentComponent<
@@ -182,6 +188,7 @@ export {
182
188
  ResponsiveDialogContent,
183
189
  ResponsiveDialogDescription,
184
190
  ResponsiveDialogFooter,
191
+ ResponsiveDialogHead,
185
192
  ResponsiveDialogHeader,
186
193
  ResponsiveDialogTitle,
187
194
  ResponsiveDialogTrigger,
@@ -57,11 +57,12 @@ const TabsList: Component<ComponentProps<typeof TabsPrimitive.List>> = (props) =
57
57
  );
58
58
  };
59
59
 
60
- /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it. */
61
- const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { icon?: string }> = (
62
- props,
63
- ) => {
64
- const [local, others] = splitProps(props, ["class", "icon", "children"]);
60
+ /** `icon` stacks a glyph over the word, so a tab row reads apart from the toggle groups under it.
61
+ * `inline` sets the glyph beside the word instead, for a row that stands alone. */
62
+ const TabsTrigger: Component<
63
+ ComponentProps<typeof TabsPrimitive.Trigger> & { icon?: string; inline?: boolean }
64
+ > = (props) => {
65
+ const [local, others] = splitProps(props, ["class", "icon", "inline", "children"]);
65
66
  return (
66
67
  <TabsPrimitive.Trigger
67
68
  data-slot="tabs-trigger"
@@ -69,7 +70,7 @@ const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { ic
69
70
  SEGMENT_ITEM,
70
71
  PRESS_DIP,
71
72
  "not-data-[selected]:hover:text-foreground relative isolate data-[selected]:text-(--material-accent)",
72
- local.icon && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
73
+ local.icon && !local.inline && "h-auto flex-1 flex-col gap-1 py-2 text-xs",
73
74
  local.class,
74
75
  )}
75
76
  {...others}
@@ -77,10 +78,10 @@ const TabsTrigger: Component<ComponentProps<typeof TabsPrimitive.Trigger> & { ic
77
78
  <SelectionHighlight />
78
79
  {local.icon && (
79
80
  <Icon
80
- data-slot="tabs-trigger-icon"
81
+ data-slot={local.inline ? "tabs-trigger-inline-icon" : "tabs-trigger-icon"}
81
82
  icon={local.icon}
82
- width={18}
83
- height={18}
83
+ width={local.inline ? 16 : 18}
84
+ height={local.inline ? 16 : 18}
84
85
  aria-hidden="true"
85
86
  />
86
87
  )}
@@ -664,14 +664,18 @@
664
664
  transparent 360deg
665
665
  );
666
666
  animation: spin-slow 8s linear infinite;
667
+ animation-play-state: var(--_orbit-play, running);
667
668
  }
668
669
  @media (prefers-reduced-motion: reduce) {
669
670
  :where(.glass-edge-orbit) > * {
670
671
  animation: none;
671
672
  }
672
673
  }
673
- /* Ambient loops under a modal's blurred scrim would make the browser re-blur the whole page every frame. */
674
- :root[data-page-covered] :is(:where(.glass-edge-orbit) > *, .animate-spin-slow, .animate-float) {
674
+ /* Ambient loops under a modal's scrim re-blur the page every frame; each selector ends in a class, as a trailing * restyles the whole document. */
675
+ :root[data-page-covered] .glass-edge-orbit {
676
+ --_orbit-play: paused;
677
+ }
678
+ :root[data-page-covered] :is(.animate-spin-slow, .animate-float) {
675
679
  animation-play-state: paused;
676
680
  }
677
681
 
@@ -321,15 +321,15 @@
321
321
  --duration-arrive: 2400ms;
322
322
  /* One sway of the dock's edit mode (DOCK_EDIT_MOTION). */
323
323
  --duration-jiggle: 140ms;
324
- /* Ambient motion is an event (SPEC motion rule 5): 1 while the host holds
325
- * html[data-motion="live"], else 0. Inherits into widget shadow roots, so a
326
- * loop multiplies its duration by it: calc(var(--motion-ambient, 0) * 1s).
327
- * --motion-play is its keyword twin for a loop that can only pause. */
324
+ /* Ambient motion is an event (SPEC motion rule 5): 1 on a [data-motion-reader]
325
+ * while the host holds html[data-motion="live"], else 0. A loop multiplies its
326
+ * duration by it: calc(var(--motion-ambient, 0) * 1s). --motion-play is its
327
+ * keyword twin for a loop that can only pause. */
328
328
  --motion-ambient: 0;
329
329
  --motion-play: paused;
330
330
  }
331
331
 
332
- html[data-motion="live"] {
332
+ html[data-motion="live"] [data-motion-reader] {
333
333
  --motion-ambient: 1;
334
334
  --motion-play: running;
335
335
  }