@askrjs/themes 0.0.16 → 0.0.17
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 +25 -0
- package/THEMING.md +6 -5
- package/dist/components/_internal/block-layout.d.ts +1 -0
- package/dist/components/_internal/block-layout.js +14 -11
- package/dist/components/_internal/block-layout.js.map +1 -1
- package/dist/components/_internal/classes.js +8 -1
- package/dist/components/_internal/classes.js.map +1 -1
- package/dist/components/_internal/jsx.js.map +1 -1
- package/dist/components/_internal/style.js +182 -28
- package/dist/components/_internal/style.js.map +1 -1
- package/dist/components/alert/alert.d.ts +1 -0
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/alert.types.d.ts +1 -0
- package/dist/components/aside/aside.d.ts +1 -0
- package/dist/components/aside/aside.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +1 -0
- package/dist/components/badge/badge.d.ts +1 -0
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/badge/badge.types.d.ts +1 -0
- package/dist/components/block/block.d.ts +1 -0
- package/dist/components/block/block.js +2 -2
- package/dist/components/block/block.js.map +1 -1
- package/dist/components/block/block.types.d.ts +1 -0
- package/dist/components/brand/brand.d.ts +1 -0
- package/dist/components/brand/brand.js +2 -2
- package/dist/components/brand/brand.js.map +1 -1
- package/dist/components/brand/brand.types.d.ts +1 -0
- package/dist/components/button-group/button-group.d.ts +1 -0
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/button-group/button-group.types.d.ts +1 -0
- package/dist/components/card/card.d.ts +1 -0
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/card.types.d.ts +1 -0
- package/dist/components/catalog.d.ts +1 -0
- package/dist/components/catalog.js +22 -13
- package/dist/components/catalog.js.map +1 -1
- package/dist/components/close/close.d.ts +1 -0
- package/dist/components/close/close.js.map +1 -1
- package/dist/components/container/container.d.ts +1 -0
- package/dist/components/container/container.js.map +1 -1
- package/dist/components/empty-state/empty-state.d.ts +1 -0
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/field/field.d.ts +1 -0
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/field.types.d.ts +1 -0
- package/dist/components/footer/footer.d.ts +1 -0
- package/dist/components/footer/footer.js.map +1 -1
- package/dist/components/footer/footer.types.d.ts +1 -0
- package/dist/components/grid/grid.d.ts +1 -0
- package/dist/components/grid/grid.js.map +1 -1
- package/dist/components/grid/grid.types.d.ts +1 -0
- package/dist/components/header/header.d.ts +1 -0
- package/dist/components/header/header.js.map +1 -1
- package/dist/components/input-group/input-group.d.ts +1 -0
- package/dist/components/input-group/input-group.js.map +1 -1
- package/dist/components/input-group/input-group.types.d.ts +1 -0
- package/dist/components/jsx-types.d.ts +12 -0
- package/dist/components/main/main.d.ts +1 -0
- package/dist/components/main/main.js.map +1 -1
- package/dist/components/nav/nav.d.ts +1 -0
- package/dist/components/nav/nav.js +6 -2
- package/dist/components/nav/nav.js.map +1 -1
- package/dist/components/nav/nav.types.d.ts +2 -0
- package/dist/components/navbar/navbar.d.ts +1 -0
- package/dist/components/navbar/navbar.js +15 -10
- package/dist/components/navbar/navbar.js.map +1 -1
- package/dist/components/overlays/dropdown-content.d.ts +1 -0
- package/dist/components/overlays/dropdown-content.js.map +1 -1
- package/dist/components/page/page.d.ts +1 -0
- package/dist/components/page/page.js.map +1 -1
- package/dist/components/page-header/page-header.d.ts +1 -0
- package/dist/components/page-header/page-header.js.map +1 -1
- package/dist/components/section/section.d.ts +1 -0
- package/dist/components/section/section.js.map +1 -1
- package/dist/components/separator/separator.d.ts +1 -0
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/separator/separator.types.d.ts +1 -0
- package/dist/components/sidebar/index.d.ts +2 -2
- package/dist/components/sidebar/sidebar.d.ts +2 -1
- package/dist/components/sidebar/sidebar.js +39 -13
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/sidebar/sidebar.types.d.ts +3 -1
- package/dist/components/skeleton/skeleton.d.ts +1 -0
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/skeleton/skeleton.types.d.ts +1 -0
- package/dist/components/spinner/spinner.d.ts +1 -0
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/stat/stat.d.ts +1 -0
- package/dist/components/stat/stat.js.map +1 -1
- package/dist/components/stat/stat.types.d.ts +1 -0
- package/dist/components/text/text.d.ts +1 -0
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/text/text.types.d.ts +1 -0
- package/dist/components/theme/theme.d.ts +2 -0
- package/dist/components/theme/theme.js +32 -16
- package/dist/components/theme/theme.js.map +1 -1
- package/dist/components/toolbar/toolbar.d.ts +1 -0
- package/dist/components/toolbar/toolbar.js.map +1 -1
- package/dist/components.d.ts +6 -3
- package/dist/core.d.ts +2 -2
- package/dist/ssr.d.ts +18 -0
- package/dist/ssr.js +63 -0
- package/dist/ssr.js.map +1 -0
- package/dist/themes/default/index.css +36 -6
- package/package.json +7 -3
- package/src/components/_internal/block-layout.ts +27 -16
- package/src/components/_internal/classes.ts +15 -2
- package/src/components/_internal/jsx.ts +1 -1
- package/src/components/_internal/style.ts +241 -27
- package/src/components/alert/alert.tsx +1 -0
- package/src/components/alert/alert.types.ts +1 -0
- package/src/components/aside/aside.tsx +1 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +1 -0
- package/src/components/aspect-ratio/aspect-ratio.types.ts +1 -0
- package/src/components/badge/badge.tsx +1 -0
- package/src/components/badge/badge.types.ts +1 -0
- package/src/components/block/block.tsx +4 -1
- package/src/components/block/block.types.ts +1 -0
- package/src/components/brand/brand.tsx +6 -2
- package/src/components/brand/brand.types.ts +1 -0
- package/src/components/button-group/button-group.tsx +1 -0
- package/src/components/button-group/button-group.types.ts +1 -0
- package/src/components/card/card.tsx +1 -0
- package/src/components/card/card.types.ts +1 -0
- package/src/components/catalog.tsx +15 -4
- package/src/components/close/close.tsx +1 -0
- package/src/components/container/container.tsx +1 -0
- package/src/components/empty-state/empty-state.tsx +1 -0
- package/src/components/field/field.tsx +1 -0
- package/src/components/field/field.types.ts +1 -0
- package/src/components/footer/footer.tsx +1 -0
- package/src/components/footer/footer.types.ts +1 -0
- package/src/components/grid/grid.tsx +1 -0
- package/src/components/grid/grid.types.ts +1 -0
- package/src/components/header/header.tsx +1 -0
- package/src/components/input-group/input-group.tsx +1 -0
- package/src/components/input-group/input-group.types.ts +1 -0
- package/src/components/jsx-types.ts +16 -0
- package/src/components/main/main.tsx +1 -0
- package/src/components/nav/nav.tsx +16 -2
- package/src/components/nav/nav.types.ts +2 -0
- package/src/components/navbar/navbar.tsx +19 -8
- package/src/components/overlays/dropdown-content.tsx +1 -0
- package/src/components/page/page.tsx +1 -0
- package/src/components/page-header/page-header.tsx +1 -0
- package/src/components/section/section.tsx +1 -0
- package/src/components/separator/separator.tsx +1 -0
- package/src/components/separator/separator.types.ts +1 -0
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/sidebar/sidebar.tsx +45 -20
- package/src/components/sidebar/sidebar.types.ts +3 -0
- package/src/components/skeleton/skeleton.tsx +1 -0
- package/src/components/skeleton/skeleton.types.ts +1 -0
- package/src/components/spinner/spinner.tsx +1 -0
- package/src/components/stat/stat.tsx +1 -0
- package/src/components/stat/stat.types.ts +1 -0
- package/src/components/text/text.tsx +1 -0
- package/src/components/text/text.types.ts +1 -0
- package/src/components/theme/theme.tsx +43 -12
- package/src/components/toolbar/toolbar.tsx +1 -0
- package/src/components.ts +9 -0
- package/src/ssr.ts +102 -0
- package/src/themes/default/styles/base/text.css +4 -4
- package/src/themes/default/styles/layout/layout.css +108 -0
- package/src/themes/default/styles/shell/navbar.css +4 -1
- package/src/themes/default/tokens.css +1 -1
- package/src/themes/presets/ginger.css +3 -3
- package/templates/theme/styles/base/text.css +4 -4
- package/templates/theme/styles/display/progress-circle.css +2 -0
- package/templates/theme/styles/forms/input-group.css +2 -1
- package/templates/theme/styles/layout/layout.css +108 -0
- package/templates/theme/styles/overlays/toast.css +11 -0
- package/templates/theme/styles/shell/navbar.css +4 -1
- package/templates/theme/styles/shell/sidebar.css +18 -1
- package/templates/theme/tokens.css +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
1
2
|
import { defineScope, getSignal, readScope, state } from "@askrjs/askr";
|
|
2
3
|
import type { JSXElement } from "@askrjs/askr/foundations/structures";
|
|
3
4
|
import { Button } from "@askrjs/ui";
|
|
@@ -15,6 +16,7 @@ export type ThemeOption = {
|
|
|
15
16
|
|
|
16
17
|
export type ThemeScopeValue = {
|
|
17
18
|
theme: () => ThemeName;
|
|
19
|
+
resolvedSystemTheme: () => "light" | "dark";
|
|
18
20
|
setTheme: (theme: ThemeName) => void;
|
|
19
21
|
themes: readonly ThemeOption[];
|
|
20
22
|
storageKey: string;
|
|
@@ -66,6 +68,7 @@ export const CAT_THEME_OPTIONS: readonly ThemeOption[] = [
|
|
|
66
68
|
const DEFAULT_STORAGE_KEY = "askr-theme";
|
|
67
69
|
const STATIC_CHILDREN = Symbol.for("askr.static-children");
|
|
68
70
|
const STATIC_CHILD_SLOTS_CACHE = Symbol.for("__askrStaticChildSlots");
|
|
71
|
+
const documentThemeCoordinators = new WeakMap<Document, ThemeCoordinator>();
|
|
69
72
|
type ThemeCoordinator = ReturnType<typeof createThemeCoordinator>;
|
|
70
73
|
type InternalThemeScopeValue = ThemeScopeValue & {
|
|
71
74
|
readonly coordinator: ThemeCoordinator | null;
|
|
@@ -74,6 +77,7 @@ type InternalThemeScopeValue = ThemeScopeValue & {
|
|
|
74
77
|
|
|
75
78
|
const ThemeScopeContext = defineScope<InternalThemeScopeValue>({
|
|
76
79
|
theme: () => "system",
|
|
80
|
+
resolvedSystemTheme: () => "light",
|
|
77
81
|
setTheme: () => undefined,
|
|
78
82
|
themes: DEFAULT_THEME_OPTIONS,
|
|
79
83
|
storageKey: DEFAULT_STORAGE_KEY,
|
|
@@ -99,10 +103,11 @@ export function ThemeScope(props: ThemeScopeProps): JSX.Element {
|
|
|
99
103
|
// Browser persistence is adopted from the committed root ref, after Askr's
|
|
100
104
|
// hydration verifier has accepted the server markup.
|
|
101
105
|
const themeState = state<ThemeName>(defaultTheme);
|
|
106
|
+
const localResolvedSystemTheme = state<"light" | "dark">("light");
|
|
102
107
|
const persistenceAdoption = state({ complete: false })();
|
|
103
108
|
const currentTheme = themeState();
|
|
104
109
|
const parentScope = readScope(ThemeScopeContext);
|
|
105
|
-
const ownedCoordinator = state<ThemeCoordinator>(
|
|
110
|
+
const ownedCoordinator = state<ThemeCoordinator>(getDefaultThemeCoordinator())();
|
|
106
111
|
const coordinator = parentScope.coordinator ?? ownedCoordinator;
|
|
107
112
|
const scopeDepth = parentScope.depth + 1;
|
|
108
113
|
coordinator.register(scopeId, scopeDepth, currentTheme, scopeSignal);
|
|
@@ -113,8 +118,12 @@ export function ThemeScope(props: ThemeScopeProps): JSX.Element {
|
|
|
113
118
|
coordinator.activate(scopeId, nextTheme);
|
|
114
119
|
};
|
|
115
120
|
|
|
121
|
+
const resolvedSystemTheme = parentScope.coordinator
|
|
122
|
+
? parentScope.resolvedSystemTheme
|
|
123
|
+
: localResolvedSystemTheme;
|
|
116
124
|
const value: InternalThemeScopeValue = {
|
|
117
125
|
theme: themeState,
|
|
126
|
+
resolvedSystemTheme,
|
|
118
127
|
setTheme,
|
|
119
128
|
themes,
|
|
120
129
|
storageKey,
|
|
@@ -129,7 +138,11 @@ export function ThemeScope(props: ThemeScopeProps): JSX.Element {
|
|
|
129
138
|
ref={
|
|
130
139
|
parentScope.coordinator === null
|
|
131
140
|
? (element: HTMLElement | null) => {
|
|
132
|
-
coordinator.attach(
|
|
141
|
+
coordinator.attach(
|
|
142
|
+
element,
|
|
143
|
+
(nextTheme) => localResolvedSystemTheme.set(nextTheme),
|
|
144
|
+
scopeSignal,
|
|
145
|
+
);
|
|
133
146
|
if (!element || persistenceAdoption.complete) return;
|
|
134
147
|
persistenceAdoption.complete = true;
|
|
135
148
|
const storedTheme = readStoredTheme(storageKey);
|
|
@@ -147,6 +160,19 @@ export function ThemeScope(props: ThemeScopeProps): JSX.Element {
|
|
|
147
160
|
);
|
|
148
161
|
}
|
|
149
162
|
|
|
163
|
+
function getDefaultThemeCoordinator(): ThemeCoordinator {
|
|
164
|
+
if (typeof document === "undefined") {
|
|
165
|
+
return createThemeCoordinator();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const existing = documentThemeCoordinators.get(document);
|
|
169
|
+
if (existing) return existing;
|
|
170
|
+
|
|
171
|
+
const coordinator = createThemeCoordinator();
|
|
172
|
+
documentThemeCoordinators.set(document, coordinator);
|
|
173
|
+
return coordinator;
|
|
174
|
+
}
|
|
175
|
+
|
|
150
176
|
function createThemeCoordinator() {
|
|
151
177
|
const scopes = new Map<
|
|
152
178
|
symbol,
|
|
@@ -191,8 +217,21 @@ function createThemeCoordinator() {
|
|
|
191
217
|
};
|
|
192
218
|
|
|
193
219
|
return Object.freeze({
|
|
194
|
-
attach(
|
|
220
|
+
attach(
|
|
221
|
+
element: HTMLElement | null,
|
|
222
|
+
onResolvedSystemTheme: (themeName: "light" | "dark") => void,
|
|
223
|
+
signal: AbortSignal,
|
|
224
|
+
) {
|
|
195
225
|
if (element) root = element.getRootNode();
|
|
226
|
+
if (element && typeof window !== "undefined" && typeof window.matchMedia === "function") {
|
|
227
|
+
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
228
|
+
const update = () => onResolvedSystemTheme(media.matches ? "dark" : "light");
|
|
229
|
+
update();
|
|
230
|
+
media.addEventListener?.("change", update);
|
|
231
|
+
signal.addEventListener("abort", () => media.removeEventListener?.("change", update), {
|
|
232
|
+
once: true,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
196
235
|
schedule();
|
|
197
236
|
},
|
|
198
237
|
register(id: symbol, depth: number, themeName: ThemeName, signal: AbortSignal) {
|
|
@@ -282,7 +321,7 @@ export function ThemeToggle(props: ThemeToggleProps): JSX.Element {
|
|
|
282
321
|
} = props;
|
|
283
322
|
|
|
284
323
|
const currentTheme = activeTheme.theme();
|
|
285
|
-
const nextTheme = getNextTheme(currentTheme, themes,
|
|
324
|
+
const nextTheme = getNextTheme(currentTheme, themes, activeTheme.resolvedSystemTheme());
|
|
286
325
|
const renderContext = { theme: currentTheme, nextTheme };
|
|
287
326
|
const ariaLabel = (rest as Record<string, unknown>)["aria-label"];
|
|
288
327
|
const themedIcon = resolveThemeToggleIcon(currentTheme, nextTheme, {
|
|
@@ -334,14 +373,6 @@ function getNextTheme(
|
|
|
334
373
|
return themes[index >= 0 && index < themes.length - 1 ? index + 1 : 0]!;
|
|
335
374
|
}
|
|
336
375
|
|
|
337
|
-
function getResolvedSystemTheme(): "light" | "dark" {
|
|
338
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
339
|
-
return "light";
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
343
|
-
}
|
|
344
|
-
|
|
345
376
|
function getThemeIcon(
|
|
346
377
|
theme: ThemeName,
|
|
347
378
|
icons: Pick<ThemeToggleProps, "lightIcon" | "darkIcon" | "systemIcon">,
|
package/src/components.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import "./themes/default/index.css";
|
|
2
|
+
import "./components/jsx-types";
|
|
3
|
+
|
|
4
|
+
// Keep the UI type surface explicit. A wildcard type re-export makes the
|
|
5
|
+
// generated declaration bundle claim ownership of UI-only catalog values
|
|
6
|
+
// (for example DataTable), which are intentionally sourced from our catalog
|
|
7
|
+
// wrappers instead.
|
|
8
|
+
export type { DialogProps } from "@askrjs/ui";
|
|
2
9
|
|
|
3
10
|
export {
|
|
4
11
|
Accordion,
|
|
@@ -271,6 +278,7 @@ export type * from "./components/container";
|
|
|
271
278
|
export type * from "./components/empty-state";
|
|
272
279
|
export type * from "./components/field";
|
|
273
280
|
export type * from "./components/footer";
|
|
281
|
+
export type * from "./components/grid";
|
|
274
282
|
export type * from "./components/header";
|
|
275
283
|
export type * from "./components/input-group";
|
|
276
284
|
export type * from "./components/main";
|
|
@@ -286,4 +294,5 @@ export type * from "./components/skeleton";
|
|
|
286
294
|
export type * from "./components/spinner";
|
|
287
295
|
export type * from "./components/toolbar";
|
|
288
296
|
export type * from "./components/theme";
|
|
297
|
+
export type * from "./components/text";
|
|
289
298
|
export type * from "./components/catalog";
|
package/src/ssr.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { styleRulesForHtml } from "./components/_internal/style";
|
|
2
|
+
|
|
3
|
+
const STYLE_REGISTRY_ATTR = "data-askr-style-registry";
|
|
4
|
+
|
|
5
|
+
type DocumentRenderArgsLike = {
|
|
6
|
+
appHtml: string;
|
|
7
|
+
context: {
|
|
8
|
+
cspNonce?: string;
|
|
9
|
+
styles?: readonly { id: string; cssText: string }[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function escapeHtmlAttribute(value: string): string {
|
|
14
|
+
return value
|
|
15
|
+
.replace(/&/g, "&")
|
|
16
|
+
.replace(/"/g, """)
|
|
17
|
+
.replace(/</g, "<")
|
|
18
|
+
.replace(/>/g, ">");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function escapeStyleRawText(value: string): string {
|
|
22
|
+
return value.replace(/<\/style/gi, "<\\/style");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function findHeadEnd(html: string): number {
|
|
26
|
+
let index = 0;
|
|
27
|
+
while (index < html.length) {
|
|
28
|
+
if (html.startsWith("<!--", index)) {
|
|
29
|
+
const commentEnd = html.indexOf("-->", index + 4);
|
|
30
|
+
index = commentEnd < 0 ? html.length : commentEnd + 3;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const rawTextStart = html.slice(index).match(/^<\s*(script|style|title|textarea)(?:\s|>)/i);
|
|
35
|
+
if (rawTextStart) {
|
|
36
|
+
const rawTextEndPattern = new RegExp(`</\\s*${rawTextStart[1]}\\s*>`, "ig");
|
|
37
|
+
rawTextEndPattern.lastIndex = index + rawTextStart[0].length;
|
|
38
|
+
const rawTextEnd = rawTextEndPattern.exec(html);
|
|
39
|
+
if (!rawTextEnd) return -1;
|
|
40
|
+
index = rawTextEnd.index + rawTextEnd[0].length;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const headEnd = html.slice(index).match(/^<\/\s*head\s*>/i);
|
|
45
|
+
if (headEnd) return index;
|
|
46
|
+
index += 1;
|
|
47
|
+
}
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function injectIntoHead(html: string, content: string): string {
|
|
52
|
+
const headEnd = findHeadEnd(html);
|
|
53
|
+
if (headEnd >= 0) {
|
|
54
|
+
return `${html.slice(0, headEnd)}${content}${html.slice(headEnd)}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const bodyStart = html.search(/<body(?:\s[^>]*)?>/i);
|
|
58
|
+
if (bodyStart >= 0) {
|
|
59
|
+
return `${html.slice(0, bodyStart)}<head>${content}</head>${html.slice(bodyStart)}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return `${content}${html}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Wrap an Askr SSR/SSG document renderer so generated theme rules used by the
|
|
67
|
+
* rendered app are available before hydration.
|
|
68
|
+
*/
|
|
69
|
+
export function withThemeStyles<TArgs extends DocumentRenderArgsLike>(
|
|
70
|
+
documentRenderer: (args: TArgs) => string,
|
|
71
|
+
): (args: TArgs) => string {
|
|
72
|
+
return (args) => {
|
|
73
|
+
const documentHtml = documentRenderer(args);
|
|
74
|
+
const registeredStyles = args.context.styles;
|
|
75
|
+
const rules = registeredStyles
|
|
76
|
+
? (() => {
|
|
77
|
+
const styles = new Map<string, string>();
|
|
78
|
+
for (const style of registeredStyles) {
|
|
79
|
+
if (!style.id || !style.cssText) {
|
|
80
|
+
throw new TypeError("Invalid SSR theme style registration.");
|
|
81
|
+
}
|
|
82
|
+
const existing = styles.get(style.id);
|
|
83
|
+
if (existing !== undefined && existing !== style.cssText) {
|
|
84
|
+
throw new RangeError(
|
|
85
|
+
`SSR style registration collision for ${JSON.stringify(style.id)}.`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
styles.set(style.id, style.cssText);
|
|
89
|
+
}
|
|
90
|
+
return Array.from(styles.values());
|
|
91
|
+
})()
|
|
92
|
+
: styleRulesForHtml(args.appHtml);
|
|
93
|
+
if (rules.length === 0) return documentHtml;
|
|
94
|
+
|
|
95
|
+
const nonce =
|
|
96
|
+
args.context.cspNonce === undefined
|
|
97
|
+
? ""
|
|
98
|
+
: ` nonce="${escapeHtmlAttribute(args.context.cspNonce)}"`;
|
|
99
|
+
const registry = `<style ${STYLE_REGISTRY_ATTR}="true"${nonce}>${escapeStyleRawText(rules.join("\n"))}\n</style>`;
|
|
100
|
+
return injectIntoHead(documentHtml, registry);
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
:where([data-slot="text"][data-tone="success"]) {
|
|
29
|
-
color: var(--ak-color-success);
|
|
29
|
+
color: var(--ak-color-success-ink);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
:where([data-slot="text"][data-tone="warning"]) {
|
|
33
|
-
color: var(--ak-color-warning);
|
|
33
|
+
color: var(--ak-color-warning-ink);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
:where([data-slot="text"][data-tone="danger"]) {
|
|
37
|
-
color: var(--ak-color-danger);
|
|
37
|
+
color: var(--ak-color-danger-ink);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
:where([data-slot="text"][data-tone="info"]) {
|
|
41
|
-
color: var(--ak-color-info);
|
|
41
|
+
color: var(--ak-color-info-ink);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
:where([data-slot="text"][data-weight="normal"]) {
|
|
@@ -30,10 +30,12 @@
|
|
|
30
30
|
--ak-flex-grow-sm: var(--ak-flex-grow-base);
|
|
31
31
|
--ak-flex-grow-md: var(--ak-flex-grow-sm);
|
|
32
32
|
--ak-flex-grow-lg: var(--ak-flex-grow-md);
|
|
33
|
+
--ak-flex-grow-xl: var(--ak-flex-grow-lg);
|
|
33
34
|
--ak-flex-shrink-base: 1;
|
|
34
35
|
--ak-flex-shrink-sm: var(--ak-flex-shrink-base);
|
|
35
36
|
--ak-flex-shrink-md: var(--ak-flex-shrink-sm);
|
|
36
37
|
--ak-flex-shrink-lg: var(--ak-flex-shrink-md);
|
|
38
|
+
--ak-flex-shrink-xl: var(--ak-flex-shrink-lg);
|
|
37
39
|
--ak-flex-basis-base: auto;
|
|
38
40
|
--ak-flex-basis-sm: var(--ak-flex-basis-base);
|
|
39
41
|
--ak-flex-basis-md: var(--ak-flex-basis-sm);
|
|
@@ -42,24 +44,32 @@
|
|
|
42
44
|
--ak-min-width-sm: var(--ak-min-width-base);
|
|
43
45
|
--ak-min-width-md: var(--ak-min-width-sm);
|
|
44
46
|
--ak-min-width-lg: var(--ak-min-width-md);
|
|
47
|
+
--ak-min-width-xl: var(--ak-min-width-lg);
|
|
45
48
|
--ak-max-width-base: none;
|
|
46
49
|
--ak-max-width-sm: var(--ak-max-width-base);
|
|
47
50
|
--ak-max-width-md: var(--ak-max-width-sm);
|
|
48
51
|
--ak-max-width-lg: var(--ak-max-width-md);
|
|
52
|
+
--ak-max-width-xl: var(--ak-max-width-lg);
|
|
49
53
|
--ak-width-base: auto;
|
|
50
54
|
--ak-width-sm: var(--ak-width-base);
|
|
51
55
|
--ak-width-md: var(--ak-width-sm);
|
|
52
56
|
--ak-width-lg: var(--ak-width-md);
|
|
57
|
+
--ak-width-xl: var(--ak-width-lg);
|
|
53
58
|
--ak-min-height-base: auto;
|
|
54
59
|
--ak-min-height-sm: var(--ak-min-height-base);
|
|
55
60
|
--ak-min-height-md: var(--ak-min-height-sm);
|
|
56
61
|
--ak-min-height-lg: var(--ak-min-height-md);
|
|
62
|
+
--ak-min-height-xl: var(--ak-min-height-lg);
|
|
57
63
|
--ak-max-height-base: none;
|
|
58
64
|
--ak-max-height-sm: var(--ak-max-height-base);
|
|
65
|
+
--ak-max-height-md: var(--ak-max-height-sm);
|
|
66
|
+
--ak-max-height-lg: var(--ak-max-height-md);
|
|
67
|
+
--ak-max-height-xl: var(--ak-max-height-lg);
|
|
59
68
|
--ak-height-base: auto;
|
|
60
69
|
--ak-height-sm: var(--ak-height-base);
|
|
61
70
|
--ak-height-md: var(--ak-height-sm);
|
|
62
71
|
--ak-height-lg: var(--ak-height-md);
|
|
72
|
+
--ak-height-xl: var(--ak-height-lg);
|
|
63
73
|
--ak-m-base: 0;
|
|
64
74
|
--ak-m-sm: var(--ak-m-base);
|
|
65
75
|
--ak-m-md: var(--ak-m-sm);
|
|
@@ -114,6 +124,12 @@
|
|
|
114
124
|
--ak-border-sm: var(--ak-border-base);
|
|
115
125
|
--ak-border-md: var(--ak-border-sm);
|
|
116
126
|
--ak-border-lg: var(--ak-border-md);
|
|
127
|
+
--ak-border-xl: var(--ak-border-lg);
|
|
128
|
+
--ak-border-top-base: var(--ak-border-base);
|
|
129
|
+
--ak-border-top-sm: var(--ak-border-top-base);
|
|
130
|
+
--ak-border-top-md: var(--ak-border-top-sm);
|
|
131
|
+
--ak-border-top-lg: var(--ak-border-top-md);
|
|
132
|
+
--ak-border-top-xl: var(--ak-border-top-lg);
|
|
117
133
|
--ak-border-bottom-base: var(--ak-border-base);
|
|
118
134
|
--ak-border-bottom-sm: var(--ak-border-bottom-base);
|
|
119
135
|
--ak-border-bottom-md: var(--ak-border-bottom-sm);
|
|
@@ -122,6 +138,7 @@
|
|
|
122
138
|
--ak-border-right-sm: var(--ak-border-right-base);
|
|
123
139
|
--ak-border-right-md: var(--ak-border-right-sm);
|
|
124
140
|
--ak-border-right-lg: var(--ak-border-right-md);
|
|
141
|
+
--ak-border-right-xl: var(--ak-border-right-lg);
|
|
125
142
|
--ak-border-radius-base: 0;
|
|
126
143
|
--ak-border-radius-sm: var(--ak-border-radius-base);
|
|
127
144
|
--ak-border-radius-md: var(--ak-border-radius-sm);
|
|
@@ -130,10 +147,12 @@
|
|
|
130
147
|
--ak-background-sm: var(--ak-background-base);
|
|
131
148
|
--ak-background-md: var(--ak-background-sm);
|
|
132
149
|
--ak-background-lg: var(--ak-background-md);
|
|
150
|
+
--ak-background-xl: var(--ak-background-lg);
|
|
133
151
|
--ak-box-shadow-base: none;
|
|
134
152
|
--ak-box-shadow-sm: var(--ak-box-shadow-base);
|
|
135
153
|
--ak-box-shadow-md: var(--ak-box-shadow-sm);
|
|
136
154
|
--ak-box-shadow-lg: var(--ak-box-shadow-md);
|
|
155
|
+
--ak-box-shadow-xl: var(--ak-box-shadow-lg);
|
|
137
156
|
|
|
138
157
|
box-sizing: border-box;
|
|
139
158
|
display: var(--ak-display-base, flex);
|
|
@@ -168,6 +187,7 @@
|
|
|
168
187
|
overflow-x: var(--ak-overflow-x-base, var(--ak-overflow-base, visible));
|
|
169
188
|
overflow-y: var(--ak-overflow-y-base, var(--ak-overflow-base, visible));
|
|
170
189
|
border: var(--ak-border-base, 0 solid transparent);
|
|
190
|
+
border-top: var(--ak-border-top-base, var(--ak-border-base, 0 solid transparent));
|
|
171
191
|
border-bottom: var(--ak-border-bottom-base, var(--ak-border-base, 0 solid transparent));
|
|
172
192
|
border-right: var(--ak-border-right-base, var(--ak-border-base, 0 solid transparent));
|
|
173
193
|
border-radius: var(--ak-border-radius-base, 0);
|
|
@@ -215,6 +235,10 @@
|
|
|
215
235
|
var(--ak-overflow-y-base, var(--ak-overflow-sm, var(--ak-overflow-base, visible)))
|
|
216
236
|
);
|
|
217
237
|
border: var(--ak-border-sm, var(--ak-border-base, 0 solid transparent));
|
|
238
|
+
border-top: var(
|
|
239
|
+
--ak-border-top-sm,
|
|
240
|
+
var(--ak-border-top-base, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)))
|
|
241
|
+
);
|
|
218
242
|
border-bottom: var(
|
|
219
243
|
--ak-border-bottom-sm,
|
|
220
244
|
var(--ak-border-bottom-base, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)))
|
|
@@ -251,6 +275,7 @@
|
|
|
251
275
|
max-width: var(--ak-max-width-md, var(--ak-max-width-sm, var(--ak-max-width-base, none)));
|
|
252
276
|
width: var(--ak-width-md, var(--ak-width-sm, var(--ak-width-base, auto)));
|
|
253
277
|
min-height: var(--ak-min-height-md, var(--ak-min-height-sm, var(--ak-min-height-base, auto)));
|
|
278
|
+
max-height: var(--ak-max-height-md, var(--ak-max-height-sm, var(--ak-max-height-base, none)));
|
|
254
279
|
height: var(--ak-height-md, var(--ak-height-sm, var(--ak-height-base, auto)));
|
|
255
280
|
margin: var(--ak-m-md, var(--ak-m-sm, var(--ak-m-base, 0)));
|
|
256
281
|
margin-inline: var(
|
|
@@ -274,6 +299,16 @@
|
|
|
274
299
|
top: var(--ak-top-md, var(--ak-top-sm, var(--ak-top-base, auto)));
|
|
275
300
|
z-index: var(--ak-z-index-md, var(--ak-z-index-sm, var(--ak-z-index-base, auto)));
|
|
276
301
|
border: var(--ak-border-md, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)));
|
|
302
|
+
border-top: var(
|
|
303
|
+
--ak-border-top-md,
|
|
304
|
+
var(
|
|
305
|
+
--ak-border-top-sm,
|
|
306
|
+
var(
|
|
307
|
+
--ak-border-top-base,
|
|
308
|
+
var(--ak-border-md, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)))
|
|
309
|
+
)
|
|
310
|
+
)
|
|
311
|
+
);
|
|
277
312
|
border-bottom: var(
|
|
278
313
|
--ak-border-bottom-md,
|
|
279
314
|
var(
|
|
@@ -411,6 +446,22 @@
|
|
|
411
446
|
--ak-border-lg,
|
|
412
447
|
var(--ak-border-md, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)))
|
|
413
448
|
);
|
|
449
|
+
border-top: var(
|
|
450
|
+
--ak-border-top-lg,
|
|
451
|
+
var(
|
|
452
|
+
--ak-border-top-md,
|
|
453
|
+
var(
|
|
454
|
+
--ak-border-top-sm,
|
|
455
|
+
var(
|
|
456
|
+
--ak-border-top-base,
|
|
457
|
+
var(
|
|
458
|
+
--ak-border-lg,
|
|
459
|
+
var(--ak-border-md, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)))
|
|
460
|
+
)
|
|
461
|
+
)
|
|
462
|
+
)
|
|
463
|
+
)
|
|
464
|
+
);
|
|
414
465
|
border-bottom: var(
|
|
415
466
|
--ak-border-bottom-lg,
|
|
416
467
|
var(
|
|
@@ -495,6 +546,27 @@
|
|
|
495
546
|
--ak-gap-xl,
|
|
496
547
|
var(--ak-gap-lg, var(--ak-gap-md, var(--ak-gap-sm, var(--ak-gap-base, 0))))
|
|
497
548
|
);
|
|
549
|
+
flex-grow: var(
|
|
550
|
+
--ak-flex-grow-xl,
|
|
551
|
+
var(
|
|
552
|
+
--ak-flex-grow-lg,
|
|
553
|
+
var(--ak-flex-grow-md, var(--ak-flex-grow-sm, var(--ak-flex-grow-base, 0)))
|
|
554
|
+
)
|
|
555
|
+
);
|
|
556
|
+
flex-shrink: var(
|
|
557
|
+
--ak-flex-shrink-xl,
|
|
558
|
+
var(
|
|
559
|
+
--ak-flex-shrink-lg,
|
|
560
|
+
var(--ak-flex-shrink-md, var(--ak-flex-shrink-sm, var(--ak-flex-shrink-base, 1)))
|
|
561
|
+
)
|
|
562
|
+
);
|
|
563
|
+
min-width: var(
|
|
564
|
+
--ak-min-width-xl,
|
|
565
|
+
var(
|
|
566
|
+
--ak-min-width-lg,
|
|
567
|
+
var(--ak-min-width-md, var(--ak-min-width-sm, var(--ak-min-width-base, 0)))
|
|
568
|
+
)
|
|
569
|
+
);
|
|
498
570
|
width: var(
|
|
499
571
|
--ak-width-xl,
|
|
500
572
|
var(--ak-width-lg, var(--ak-width-md, var(--ak-width-sm, var(--ak-width-base, auto))))
|
|
@@ -513,6 +585,17 @@
|
|
|
513
585
|
var(--ak-min-height-md, var(--ak-min-height-sm, var(--ak-min-height-base, auto)))
|
|
514
586
|
)
|
|
515
587
|
);
|
|
588
|
+
max-height: var(
|
|
589
|
+
--ak-max-height-xl,
|
|
590
|
+
var(
|
|
591
|
+
--ak-max-height-lg,
|
|
592
|
+
var(--ak-max-height-md, var(--ak-max-height-sm, var(--ak-max-height-base, none)))
|
|
593
|
+
)
|
|
594
|
+
);
|
|
595
|
+
height: var(
|
|
596
|
+
--ak-height-xl,
|
|
597
|
+
var(--ak-height-lg, var(--ak-height-md, var(--ak-height-sm, var(--ak-height-base, auto))))
|
|
598
|
+
);
|
|
516
599
|
margin: var(--ak-m-xl, var(--ak-m-lg, var(--ak-m-md, var(--ak-m-sm, var(--ak-m-base, 0)))));
|
|
517
600
|
margin-inline: var(
|
|
518
601
|
--ak-mx-xl,
|
|
@@ -601,6 +684,31 @@
|
|
|
601
684
|
var(--ak-border-md, var(--ak-border-sm, var(--ak-border-base, 0 solid transparent)))
|
|
602
685
|
)
|
|
603
686
|
);
|
|
687
|
+
border-top: var(
|
|
688
|
+
--ak-border-top-xl,
|
|
689
|
+
var(
|
|
690
|
+
--ak-border-top-lg,
|
|
691
|
+
var(
|
|
692
|
+
--ak-border-top-md,
|
|
693
|
+
var(
|
|
694
|
+
--ak-border-top-sm,
|
|
695
|
+
var(
|
|
696
|
+
--ak-border-top-base,
|
|
697
|
+
var(
|
|
698
|
+
--ak-border-xl,
|
|
699
|
+
var(
|
|
700
|
+
--ak-border-lg,
|
|
701
|
+
var(
|
|
702
|
+
--ak-border-md,
|
|
703
|
+
var(--ak-border-sm, var(--ak-border-base, 0 solid transparent))
|
|
704
|
+
)
|
|
705
|
+
)
|
|
706
|
+
)
|
|
707
|
+
)
|
|
708
|
+
)
|
|
709
|
+
)
|
|
710
|
+
)
|
|
711
|
+
);
|
|
604
712
|
border-bottom: var(
|
|
605
713
|
--ak-border-bottom-xl,
|
|
606
714
|
var(
|
|
@@ -145,7 +145,10 @@
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
:where([data-slot="navbar"][data-collapse-at])
|
|
148
|
-
:where(
|
|
148
|
+
:where(
|
|
149
|
+
[data-slot="navbar-collapse"] [data-slot="navbar-content"][data-state="open"],
|
|
150
|
+
[data-slot="navbar-collapse"][open] [data-slot="navbar-content"]
|
|
151
|
+
) {
|
|
149
152
|
display: flex;
|
|
150
153
|
}
|
|
151
154
|
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
--ak-dark-color-primary-hover: color-mix(in oklch, var(--ak-dark-color-primary) 90%, transparent);
|
|
175
175
|
--ak-dark-color-primary-active: color-mix(in oklch, var(--ak-dark-color-primary) 84%, black);
|
|
176
176
|
--ak-dark-color-primary-soft: oklch(0.269 0 0);
|
|
177
|
-
--ak-dark-color-primary-ink: oklch(0.
|
|
177
|
+
--ak-dark-color-primary-ink: oklch(0.985 0 0);
|
|
178
178
|
|
|
179
179
|
--ak-dark-color-text: oklch(0.985 0 0);
|
|
180
180
|
--ak-dark-color-text-muted: oklch(0.708 0 0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[data-theme="ginger"] {
|
|
2
|
-
--ak-color-primary: #
|
|
3
|
-
--ak-color-primary-hover: #
|
|
4
|
-
--ak-color-primary-active: #
|
|
2
|
+
--ak-color-primary: #a8440e;
|
|
3
|
+
--ak-color-primary-hover: #8f3708;
|
|
4
|
+
--ak-color-primary-active: #763006;
|
|
5
5
|
--ak-color-primary-soft: #ffe2c5;
|
|
6
6
|
--ak-color-primary-ink: #74300c;
|
|
7
7
|
--ak-color-text: #2e251f;
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
:where([data-slot="text"][data-tone="success"]) {
|
|
29
|
-
color: var(--ak-color-success);
|
|
29
|
+
color: var(--ak-color-success-ink);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
:where([data-slot="text"][data-tone="warning"]) {
|
|
33
|
-
color: var(--ak-color-warning);
|
|
33
|
+
color: var(--ak-color-warning-ink);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
:where([data-slot="text"][data-tone="danger"]) {
|
|
37
|
-
color: var(--ak-color-danger);
|
|
37
|
+
color: var(--ak-color-danger-ink);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
:where([data-slot="text"][data-tone="info"]) {
|
|
41
|
-
color: var(--ak-color-info);
|
|
41
|
+
color: var(--ak-color-info-ink);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
:where([data-slot="text"][data-weight="normal"]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
:where(.input-group, [data-slot="input-group"]) {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: stretch;
|
|
4
|
-
flex-wrap:
|
|
4
|
+
flex-wrap: nowrap;
|
|
5
5
|
width: 100%;
|
|
6
6
|
gap: 0;
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
:where(.input-group[data-attached="false"], [data-slot="input-group"][data-attached="false"]) {
|
|
14
|
+
flex-wrap: wrap;
|
|
14
15
|
gap: var(--ak-space-xs);
|
|
15
16
|
}
|
|
16
17
|
|