foldkit-mixins 0.2.0 → 0.4.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,40 @@
1
+ import { a as StyleValue } from "./styleValue-C9vAKt7A.mjs";
2
+ declare namespace core_d_exports {
3
+ export { Refs, Theme, ThemeTokens, VAR_PREFIX, compose, define, lightDark, ref, variables };
4
+ }
5
+ type ThemeTokens = {
6
+ readonly [group: string]: {
7
+ readonly [name: string]: string;
8
+ };
9
+ };
10
+ type Theme<T extends ThemeTokens = ThemeTokens> = T;
11
+ declare const VAR_PREFIX = "--fk";
12
+ declare const define: <T extends ThemeTokens>(tokens: T) => Readonly<T>;
13
+ /** `var(--fk-group-name)` for every token, by the theme's own group and token names. */
14
+ type Refs<T extends ThemeTokens> = { readonly [G in keyof T & string]: { readonly [N in keyof T[G] & string]: string; }; };
15
+ /**
16
+ * The theme's tokens as references: `Theme.ref(theme).surface.overt` is
17
+ * `var(--fk-surface-overt)`, and a group or name the theme lacks is a type
18
+ * error. Only the names are read, never the values. Built once per theme.
19
+ */
20
+ declare const ref: <T extends ThemeTokens>(theme: T) => Refs<T>;
21
+ declare const variables: <T extends ThemeTokens>(theme: T) => StyleValue;
22
+ /**
23
+ * A token that follows the user's color scheme with CSS `light-dark()`: no
24
+ * JavaScript and no Model field. A theme the user chooses is the other case,
25
+ * and belongs in the Model as a class on the root; `variables` compiles both.
26
+ */
27
+ declare const lightDark: (light: string, dark: string) => string;
28
+ type Merge<A, B> = { readonly [G in keyof A | keyof B]: G extends keyof B ? G extends keyof A ? A[G] & B[G] : B[G] : G extends keyof A ? A[G] : never; };
29
+ /** Themes merged at definition time, later tokens winning within a group. */
30
+ declare const compose: <A extends ThemeTokens, B extends ThemeTokens>(base: A, over: B) => Readonly<Merge<A, B>>;
31
+ declare const Theme: {
32
+ readonly define: <T extends ThemeTokens>(tokens: T) => Readonly<T>;
33
+ readonly ref: <T extends ThemeTokens>(theme: T) => Refs<T>;
34
+ readonly variables: <T extends ThemeTokens>(theme: T) => StyleValue;
35
+ readonly lightDark: (light: string, dark: string) => string;
36
+ readonly compose: <A extends ThemeTokens, B extends ThemeTokens>(base: A, over: B) => Readonly<Merge<A, B>>;
37
+ };
38
+ //#endregion
39
+ export { compose as a, lightDark as c, VAR_PREFIX as i, ref as l, Theme as n, core_d_exports as o, ThemeTokens as r, define as s, Refs as t, variables as u };
40
+ //# sourceMappingURL=core-B86QnDhB.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-B86QnDhB.d.mts","names":[],"sources":["../src/theme/core.ts"],"mappings":";;;;KAOY;YACA;cAA4B;;;KAG5B,MAAM,UAAU,cAAc,eAAe;cAE5C;cAEA,SAAU,UAAU,aAAa,QAAQ,MAAI,SAAS;;KAQvD,KAAK,UAAU,2BACf,WAAW,yBAAyB,WAAW,EAAE;;;;;;cAUhD,MAAO,UAAU,aAAa,OAAO,MAAI,KAAK;cAmB9C,YAAa,UAAU,aAAa,OAAO,MAAI;;;;;;cAe/C,YAAa,eAAe;KAEpC,MAAM,GAAG,iBACF,WAAW,UAAU,IAAI,gBAAgB,IAC/C,gBAAgB,IACd,EAAE,KAAK,EAAE,KACT,EAAE,KACJ,gBAAgB,IACd,EAAE;;cAKG,UAAW,UAAU,aAAa,UAAU,aACvD,MAAM,GACN,MAAM,MACL,SAAS,MAAM,GAAG;cAUR;WA/EU,SAAA,UAAU,aAAW,QAAU,MAAI,SAAS;WAmB/C,MAAA,UAAU,aAAW,OAAS,MAAI,KAAK;WAmBjC,YAAA,UAAU,aAAW,OAAS,MAAI;WAe3B,YAAA,eAAM;WAaf,UAAA,UAAU,aAAa,UAAU,aAAW,MAC5D,GAAC,MACD,MACL,SAAS,MAAM,GAAG"}
@@ -0,0 +1,53 @@
1
+ import { l as inline } from "./styleValue--iQMTcPn.mjs";
2
+ //#region src/theme/core.ts
3
+ /**
4
+ * `Theme` is typed token data, not a service. Dynamic theme state (light/dark)
5
+ * belongs in the Foldkit Model; `variables` compiles the tokens to CSS custom
6
+ * properties so switching a class or a root style is cheap and SSR-safe.
7
+ */
8
+ const VAR_PREFIX = "--fk";
9
+ const define = (tokens) => Object.freeze(Object.fromEntries(Object.entries(tokens).map(([group, names]) => [group, Object.freeze({ ...names })])));
10
+ const refsByTheme = /* @__PURE__ */ new WeakMap();
11
+ /**
12
+ * The theme's tokens as references: `Theme.ref(theme).surface.overt` is
13
+ * `var(--fk-surface-overt)`, and a group or name the theme lacks is a type
14
+ * error. Only the names are read, never the values. Built once per theme.
15
+ */
16
+ const ref = (theme) => {
17
+ const cached = refsByTheme.get(theme);
18
+ if (cached !== void 0) return cached;
19
+ const built = Object.freeze(Object.fromEntries(Object.entries(theme).map(([group, names]) => [group, Object.freeze(Object.fromEntries(Object.keys(names).map((name) => [name, `var(${VAR_PREFIX}-${group}-${name})`])))])));
20
+ refsByTheme.set(theme, built);
21
+ return built;
22
+ };
23
+ const variables = (theme) => {
24
+ const style = {};
25
+ for (const [group, names] of Object.entries(theme)) for (const [name, value] of Object.entries(names)) style[`${VAR_PREFIX}-${group}-${name}`] = value;
26
+ return inline(style);
27
+ };
28
+ /**
29
+ * A token that follows the user's color scheme with CSS `light-dark()`: no
30
+ * JavaScript and no Model field. A theme the user chooses is the other case,
31
+ * and belongs in the Model as a class on the root; `variables` compiles both.
32
+ */
33
+ const lightDark = (light, dark) => `light-dark(${light}, ${dark})`;
34
+ /** Themes merged at definition time, later tokens winning within a group. */
35
+ const compose = (base, over) => {
36
+ const merged = {};
37
+ for (const source of [base, over]) for (const [group, names] of Object.entries(source)) merged[group] = {
38
+ ...merged[group],
39
+ ...names
40
+ };
41
+ return define(merged);
42
+ };
43
+ const Theme = {
44
+ define,
45
+ ref,
46
+ variables,
47
+ lightDark,
48
+ compose
49
+ };
50
+ //#endregion
51
+ export { lightDark as a, define as i, VAR_PREFIX as n, ref as o, compose as r, variables as s, Theme as t };
52
+
53
+ //# sourceMappingURL=core-izIY2GSX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-izIY2GSX.mjs","names":[],"sources":["../src/theme/core.ts"],"sourcesContent":["/**\n * `Theme` is typed token data, not a service. Dynamic theme state (light/dark)\n * belongs in the Foldkit Model; `variables` compiles the tokens to CSS custom\n * properties so switching a class or a root style is cheap and SSR-safe.\n */\nimport { inline, type StyleValue } from '../styleValue.js'\n\nexport type ThemeTokens = {\n readonly [group: string]: { readonly [name: string]: string }\n}\n\nexport type Theme<T extends ThemeTokens = ThemeTokens> = T\n\nexport const VAR_PREFIX = '--fk'\n\nexport const define = <T extends ThemeTokens>(tokens: T): Readonly<T> =>\n Object.freeze(\n Object.fromEntries(\n Object.entries(tokens).map(([group, names]) => [group, Object.freeze({ ...names })]),\n ),\n ) as Readonly<T>\n\n/** `var(--fk-group-name)` for every token, by the theme's own group and token names. */\nexport type Refs<T extends ThemeTokens> = {\n readonly [G in keyof T & string]: { readonly [N in keyof T[G] & string]: string }\n}\n\nconst refsByTheme = new WeakMap<ThemeTokens, Refs<ThemeTokens>>()\n\n/**\n * The theme's tokens as references: `Theme.ref(theme).surface.overt` is\n * `var(--fk-surface-overt)`, and a group or name the theme lacks is a type\n * error. Only the names are read, never the values. Built once per theme.\n */\nexport const ref = <T extends ThemeTokens>(theme: T): Refs<T> => {\n const cached = refsByTheme.get(theme)\n if (cached !== undefined) return cached as Refs<T>\n const built = Object.freeze(\n Object.fromEntries(\n Object.entries(theme).map(([group, names]) => [\n group,\n Object.freeze(\n Object.fromEntries(\n Object.keys(names).map(name => [name, `var(${VAR_PREFIX}-${group}-${name})`]),\n ),\n ),\n ]),\n ),\n )\n refsByTheme.set(theme, built)\n return built as Refs<T>\n}\n\nexport const variables = <T extends ThemeTokens>(theme: T): StyleValue => {\n const style: Record<`--${string}`, string> = {}\n for (const [group, names] of Object.entries(theme)) {\n for (const [name, value] of Object.entries(names as Record<string, string>)) {\n style[`${VAR_PREFIX}-${group}-${name}`] = value\n }\n }\n return inline(style)\n}\n\n/**\n * A token that follows the user's color scheme with CSS `light-dark()`: no\n * JavaScript and no Model field. A theme the user chooses is the other case,\n * and belongs in the Model as a class on the root; `variables` compiles both.\n */\nexport const lightDark = (light: string, dark: string): string => `light-dark(${light}, ${dark})`\n\ntype Merge<A, B> = {\n readonly [G in keyof A | keyof B]: G extends keyof B\n ? G extends keyof A\n ? A[G] & B[G]\n : B[G]\n : G extends keyof A\n ? A[G]\n : never\n}\n\n/** Themes merged at definition time, later tokens winning within a group. */\nexport const compose = <A extends ThemeTokens, B extends ThemeTokens>(\n base: A,\n over: B,\n): Readonly<Merge<A, B>> => {\n const merged: Record<string, Record<string, string>> = {}\n for (const source of [base, over]) {\n for (const [group, names] of Object.entries(source)) {\n merged[group] = { ...merged[group], ...(names as Record<string, string>) }\n }\n }\n return define(merged) as unknown as Readonly<Merge<A, B>>\n}\n\nexport const Theme = { define, ref, variables, lightDark, compose } as const\n"],"mappings":";;;;;;;AAaA,MAAa,aAAa;AAE1B,MAAa,UAAiC,WAC5C,OAAO,OACL,OAAO,YACL,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,OAAO,OAAO,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CACrF,CACF;AAOF,MAAM,8BAAc,IAAI,QAAwC;;;;;;AAOhE,MAAa,OAA8B,UAAsB;CAC/D,MAAM,SAAS,YAAY,IAAI,KAAK;CACpC,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,QAAQ,OAAO,OACnB,OAAO,YACL,OAAO,QAAQ,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAC5C,OACA,OAAO,OACL,OAAO,YACL,OAAO,KAAK,KAAK,CAAC,CAAC,KAAI,SAAQ,CAAC,MAAM,OAAO,WAAW,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,CAC9E,CACF,CACF,CAAC,CACH,CACF;CACA,YAAY,IAAI,OAAO,KAAK;CAC5B,OAAO;AACT;AAEA,MAAa,aAAoC,UAAyB;CACxE,MAAM,QAAuC,CAAC;CAC9C,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,KAAK,GAC/C,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,QAAQ,KAA+B,GACxE,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU;CAG9C,OAAO,OAAO,KAAK;AACrB;;;;;;AAOA,MAAa,aAAa,OAAe,SAAyB,cAAc,MAAM,IAAI,KAAK;;AAa/F,MAAa,WACX,MACA,SAC0B;CAC1B,MAAM,SAAiD,CAAC;CACxD,KAAK,MAAM,UAAU,CAAC,MAAM,IAAI,GAC9B,KAAK,MAAM,CAAC,OAAO,UAAU,OAAO,QAAQ,MAAM,GAChD,OAAO,SAAS;EAAE,GAAG,OAAO;EAAQ,GAAI;CAAiC;CAG7E,OAAO,OAAO,MAAM;AACtB;AAEA,MAAa,QAAQ;CAAE;CAAQ;CAAK;CAAW;CAAW;AAAQ"}
@@ -0,0 +1,27 @@
1
+ import { a as StyleValue } from "./styleValue-C9vAKt7A.mjs";
2
+ //#region src/defaults.d.ts
3
+ /** Box model, margins, media, form-control fonts: what every page assumes. */
4
+ export declare const reset: StyleValue;
5
+ /** The page's font, color, background, and color scheme. */
6
+ export declare const body: StyleValue;
7
+ /** A type hierarchy for h1 to h6 from the size scale. */
8
+ export declare const headings: StyleValue;
9
+ /** Link color, hover, and a visible focus ring. */
10
+ export declare const links: StyleValue;
11
+ /** Inline code and code blocks on the subtle surface. */
12
+ export declare const code: StyleValue;
13
+ /** Text inputs, selects, textareas, and buttons: one radius, one border, one focus. */
14
+ export declare const controls: StyleValue;
15
+ /** Every default except `reset`, which belongs in its own layer. */
16
+ export declare const all: StyleValue;
17
+ export declare const Defaults: {
18
+ readonly reset: StyleValue;
19
+ readonly body: StyleValue;
20
+ readonly headings: StyleValue;
21
+ readonly links: StyleValue;
22
+ readonly code: StyleValue;
23
+ readonly controls: StyleValue;
24
+ readonly all: StyleValue;
25
+ };
26
+ //#endregion
27
+ //# sourceMappingURL=defaults.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.mts","names":[],"sources":["../src/defaults.ts"],"mappings":";;;qBAca,OAAO;;qBAcP,MAAM;;qBAKN,UAAU;;qBAaV,OAAO;;qBASP,MAAM;;qBASN,UAAU;;qBAaV,KAAK;qBAEL"}
@@ -0,0 +1,71 @@
1
+ import { r as compose, s as global } from "./styleValue--iQMTcPn.mjs";
2
+ //#region src/defaults.ts
3
+ /**
4
+ * `foldkit-mixins/defaults`: the baseline plain HTML gets before any slot is
5
+ * styled. Every member is element-selector CSS over `--fk-*` tokens with a
6
+ * fallback, so it re-themes with the tokens and still reads without them.
7
+ * The pieces are unlayered; a page puts `reset` in `reset` and the rest in
8
+ * `defaults` with `Layers.standard.in`. Selectors use `:where()` so any
9
+ * class rule beats them.
10
+ */
11
+ const v = (name, fallback) => `var(--fk-${name}, ${fallback})`;
12
+ /** Box model, margins, media, form-control fonts: what every page assumes. */
13
+ const reset = global([
14
+ "*,*::before,*::after{box-sizing:border-box;margin:0;min-width:0}",
15
+ ":where(html){text-size-adjust:none;-webkit-text-size-adjust:none;tab-size:4;font-synthesis:none;text-rendering:optimizeLegibility}",
16
+ ":where(:is(img,picture,video,canvas,svg)){display:block;max-inline-size:100%;block-size:auto}",
17
+ ":where(:is(input,button,textarea,select)){font:inherit;color:inherit}",
18
+ ":where(textarea){field-sizing:content;min-block-size:2lh}",
19
+ ":where(:is(h1,h2,h3,h4,h5,h6)){text-wrap:balance}",
20
+ ":where(p){text-wrap:pretty;overflow-wrap:break-word}",
21
+ `@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:0.01ms!important;transition-duration:0.01ms!important;scroll-behavior:auto!important}}`
22
+ ].join(""));
23
+ /** The page's font, color, background, and color scheme. */
24
+ const body = global(`:where(body){font-family:${v("font-body", "system-ui, sans-serif")};font-size:${v("size-md", "1rem")};line-height:${v("leading-normal", "1.5")};font-weight:${v("weight-normal", "400")};color:${v("text-default", "CanvasText")};background:${v("surface-base", "Canvas")};-webkit-font-smoothing:antialiased}`);
25
+ /** A type hierarchy for h1 to h6 from the size scale. */
26
+ const headings = global([
27
+ `:where(:is(h1,h2,h3,h4,h5,h6)){font-family:${v("font-heading", "inherit")};font-weight:${v("weight-bold", "700")};line-height:${v("leading-tight", "1.2")};color:${v("text-overt", "inherit")};letter-spacing:-0.01em}`,
28
+ `:where(h1){font-size:${v("size-4xl", "2.25rem")}}`,
29
+ `:where(h2){font-size:${v("size-3xl", "1.875rem")}}`,
30
+ `:where(h3){font-size:${v("size-2xl", "1.5rem")}}`,
31
+ `:where(h4){font-size:${v("size-xl", "1.25rem")}}`,
32
+ `:where(h5){font-size:${v("size-lg", "1.125rem")}}`,
33
+ `:where(h6){font-size:${v("size-md", "1rem")}}`
34
+ ].join(""));
35
+ /** Link color, hover, and a visible focus ring. */
36
+ const links = global([
37
+ `:where(a){color:${v("text-link", "LinkText")};text-decoration-thickness:from-font;text-underline-offset:0.15em}`,
38
+ `:where(a:hover){color:${v("text-link-hover", "LinkText")}}`,
39
+ `:where(:is(a,button,input,select,textarea,summary,[tabindex]):focus-visible){outline:${v("border-thick", "2px")} solid ${v("outline-focus", "Highlight")};outline-offset:2px}`
40
+ ].join(""));
41
+ /** Inline code and code blocks on the subtle surface. */
42
+ const code = global([
43
+ `:where(:is(code,kbd,samp,pre)){font-family:${v("font-mono", "ui-monospace, monospace")};font-size:${v("size-sm", "0.875rem")}}`,
44
+ `:where(:not(pre)>code){padding:0.1em 0.35em;border-radius:${v("radius-sm", "3px")};background:${v("surface-subtle", "transparent")};overflow-wrap:anywhere}`,
45
+ `:where(pre){padding:${v("space-md", "1rem")};border:${v("border-thin", "1px")} solid ${v("outline-subtle", "transparent")};border-radius:${v("radius-md", "6px")};background:${v("surface-subtle", "transparent")};overflow-x:auto;line-height:${v("leading-snug", "1.375")}}`
46
+ ].join(""));
47
+ /** Text inputs, selects, textareas, and buttons: one radius, one border, one focus. */
48
+ const controls = global([
49
+ `:where(:is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file]),select,textarea)){padding:${v("space-xs", "0.5rem")} ${v("space-sm", "0.75rem")};border:${v("border-thin", "1px")} solid ${v("outline-default", "ButtonBorder")};border-radius:${v("radius-md", "6px")};background:${v("surface-base", "Field")};color:${v("text-default", "FieldText")};transition:border-color ${v("motion-fast", "150ms")} ${v("motion-ease", "ease-out")}}`,
50
+ `:where(:is(input,select,textarea):focus-visible){border-color:${v("accent-default", "Highlight")}}`,
51
+ `:where(:is(input,select,textarea)[aria-invalid=true]){border-color:${v("error-default", "red")}}`,
52
+ `:where(button,[type=button],[type=submit],[type=reset]){padding:${v("space-xs", "0.5rem")} ${v("space-md", "1rem")};border:${v("border-thin", "1px")} solid ${v("outline-default", "ButtonBorder")};border-radius:${v("radius-md", "6px")};background:${v("surface-subtle", "ButtonFace")};color:${v("text-default", "ButtonText")};cursor:pointer;transition:background ${v("motion-fast", "150ms")} ${v("motion-ease", "ease-out")}}`,
53
+ `:where(button,[type=button],[type=submit],[type=reset]):hover{background:${v("surface-muted", "ButtonFace")}}`,
54
+ `:where(:is(button,input,select,textarea):disabled){opacity:0.5;cursor:not-allowed}`,
55
+ `:where(:is(input,select,textarea,button)::placeholder){color:${v("text-muted", "GrayText")}}`
56
+ ].join(""));
57
+ /** Every default except `reset`, which belongs in its own layer. */
58
+ const all = compose(body, headings, links, code, controls);
59
+ const Defaults = {
60
+ reset,
61
+ body,
62
+ headings,
63
+ links,
64
+ code,
65
+ controls,
66
+ all
67
+ };
68
+ //#endregion
69
+ export { Defaults, all, body, code, controls, headings, links, reset };
70
+
71
+ //# sourceMappingURL=defaults.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.mjs","names":[],"sources":["../src/defaults.ts"],"sourcesContent":["/**\n * `foldkit-mixins/defaults`: the baseline plain HTML gets before any slot is\n * styled. Every member is element-selector CSS over `--fk-*` tokens with a\n * fallback, so it re-themes with the tokens and still reads without them.\n * The pieces are unlayered; a page puts `reset` in `reset` and the rest in\n * `defaults` with `Layers.standard.in`. Selectors use `:where()` so any\n * class rule beats them.\n */\nimport { compose, global } from './styleValue.js'\nimport type { StyleValue } from './styleValue.js'\n\nconst v = (name: string, fallback: string): string => `var(--fk-${name}, ${fallback})`\n\n/** Box model, margins, media, form-control fonts: what every page assumes. */\nexport const reset: StyleValue = global(\n [\n '*,*::before,*::after{box-sizing:border-box;margin:0;min-width:0}',\n ':where(html){text-size-adjust:none;-webkit-text-size-adjust:none;tab-size:4;font-synthesis:none;text-rendering:optimizeLegibility}',\n ':where(:is(img,picture,video,canvas,svg)){display:block;max-inline-size:100%;block-size:auto}',\n ':where(:is(input,button,textarea,select)){font:inherit;color:inherit}',\n ':where(textarea){field-sizing:content;min-block-size:2lh}',\n ':where(:is(h1,h2,h3,h4,h5,h6)){text-wrap:balance}',\n ':where(p){text-wrap:pretty;overflow-wrap:break-word}',\n `@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:0.01ms!important;transition-duration:0.01ms!important;scroll-behavior:auto!important}}`,\n ].join(''),\n)\n\n/** The page's font, color, background, and color scheme. */\nexport const body: StyleValue = global(\n `:where(body){font-family:${v('font-body', 'system-ui, sans-serif')};font-size:${v('size-md', '1rem')};line-height:${v('leading-normal', '1.5')};font-weight:${v('weight-normal', '400')};color:${v('text-default', 'CanvasText')};background:${v('surface-base', 'Canvas')};-webkit-font-smoothing:antialiased}`,\n)\n\n/** A type hierarchy for h1 to h6 from the size scale. */\nexport const headings: StyleValue = global(\n [\n `:where(:is(h1,h2,h3,h4,h5,h6)){font-family:${v('font-heading', 'inherit')};font-weight:${v('weight-bold', '700')};line-height:${v('leading-tight', '1.2')};color:${v('text-overt', 'inherit')};letter-spacing:-0.01em}`,\n `:where(h1){font-size:${v('size-4xl', '2.25rem')}}`,\n `:where(h2){font-size:${v('size-3xl', '1.875rem')}}`,\n `:where(h3){font-size:${v('size-2xl', '1.5rem')}}`,\n `:where(h4){font-size:${v('size-xl', '1.25rem')}}`,\n `:where(h5){font-size:${v('size-lg', '1.125rem')}}`,\n `:where(h6){font-size:${v('size-md', '1rem')}}`,\n ].join(''),\n)\n\n/** Link color, hover, and a visible focus ring. */\nexport const links: StyleValue = global(\n [\n `:where(a){color:${v('text-link', 'LinkText')};text-decoration-thickness:from-font;text-underline-offset:0.15em}`,\n `:where(a:hover){color:${v('text-link-hover', 'LinkText')}}`,\n `:where(:is(a,button,input,select,textarea,summary,[tabindex]):focus-visible){outline:${v('border-thick', '2px')} solid ${v('outline-focus', 'Highlight')};outline-offset:2px}`,\n ].join(''),\n)\n\n/** Inline code and code blocks on the subtle surface. */\nexport const code: StyleValue = global(\n [\n `:where(:is(code,kbd,samp,pre)){font-family:${v('font-mono', 'ui-monospace, monospace')};font-size:${v('size-sm', '0.875rem')}}`,\n `:where(:not(pre)>code){padding:0.1em 0.35em;border-radius:${v('radius-sm', '3px')};background:${v('surface-subtle', 'transparent')};overflow-wrap:anywhere}`,\n `:where(pre){padding:${v('space-md', '1rem')};border:${v('border-thin', '1px')} solid ${v('outline-subtle', 'transparent')};border-radius:${v('radius-md', '6px')};background:${v('surface-subtle', 'transparent')};overflow-x:auto;line-height:${v('leading-snug', '1.375')}}`,\n ].join(''),\n)\n\n/** Text inputs, selects, textareas, and buttons: one radius, one border, one focus. */\nexport const controls: StyleValue = global(\n [\n `:where(:is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file]),select,textarea)){padding:${v('space-xs', '0.5rem')} ${v('space-sm', '0.75rem')};border:${v('border-thin', '1px')} solid ${v('outline-default', 'ButtonBorder')};border-radius:${v('radius-md', '6px')};background:${v('surface-base', 'Field')};color:${v('text-default', 'FieldText')};transition:border-color ${v('motion-fast', '150ms')} ${v('motion-ease', 'ease-out')}}`,\n `:where(:is(input,select,textarea):focus-visible){border-color:${v('accent-default', 'Highlight')}}`,\n `:where(:is(input,select,textarea)[aria-invalid=true]){border-color:${v('error-default', 'red')}}`,\n `:where(button,[type=button],[type=submit],[type=reset]){padding:${v('space-xs', '0.5rem')} ${v('space-md', '1rem')};border:${v('border-thin', '1px')} solid ${v('outline-default', 'ButtonBorder')};border-radius:${v('radius-md', '6px')};background:${v('surface-subtle', 'ButtonFace')};color:${v('text-default', 'ButtonText')};cursor:pointer;transition:background ${v('motion-fast', '150ms')} ${v('motion-ease', 'ease-out')}}`,\n `:where(button,[type=button],[type=submit],[type=reset]):hover{background:${v('surface-muted', 'ButtonFace')}}`,\n `:where(:is(button,input,select,textarea):disabled){opacity:0.5;cursor:not-allowed}`,\n `:where(:is(input,select,textarea,button)::placeholder){color:${v('text-muted', 'GrayText')}}`,\n ].join(''),\n)\n\n/** Every default except `reset`, which belongs in its own layer. */\nexport const all: StyleValue = compose(body, headings, links, code, controls)\n\nexport const Defaults = { reset, body, headings, links, code, controls, all } as const\n"],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ //#region src/diagnostics.ts
3
+ var diagnostics_exports = /* @__PURE__ */ __exportAll({ DiagnosticError: () => DiagnosticError });
4
+ var DiagnosticError = class extends Error {
5
+ diagnostic;
6
+ constructor(diagnostic) {
7
+ super(diagnostic.message);
8
+ this.name = "DiagnosticError";
9
+ this.diagnostic = diagnostic;
10
+ }
11
+ };
12
+ //#endregion
13
+ export { diagnostics_exports as n, DiagnosticError as t };
14
+
15
+ //# sourceMappingURL=diagnostics-YJ7991-A.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics-YJ7991-A.mjs","names":[],"sources":["../src/diagnostics.ts"],"sourcesContent":["/**\n * Structured diagnostics for attachment conflicts. Codes are stable so tests,\n * DevTools, and editor tooling can share them. Resolution failures are\n * programming errors (a definition attaches something a slot does not allow),\n * so `resolve` throws a `DiagnosticError` carrying one.\n */\nexport type DiagnosticCode =\n | 'mixins:unknown-slot'\n | 'mixins:hidden-slot'\n | 'mixins:capability-mismatch'\n | 'mixins:unsupported-event'\n | 'mixins:unsupported-attribute'\n | 'mixins:protected-event'\n | 'mixins:protected-attribute'\n | 'mixins:protected-style-property'\n | 'mixins:style-property-conflict'\n | 'mixins:event-conflict'\n | 'mixins:attribute-conflict'\n | 'mixins:structural-override'\n | 'mixins:duplicate-mount-name'\n | 'mixins:duplicate-item-id'\n | 'mixins:ragged-grid-areas'\n | 'style:duplicate-layer'\n | 'style:conflicting-layer-order'\n | 'style:unlayered-rule'\n | 'style:relayered'\n | 'theme:unparseable-breakpoint'\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface Diagnostic {\n readonly source: 'mixins' | 'a11y' | 'style' | 'theme'\n readonly code: DiagnosticCode\n readonly severity: 'error'\n readonly message: string\n readonly slot?: string\n readonly details?: Readonly<Record<string, unknown>>\n}\n\nexport class DiagnosticError extends Error {\n readonly diagnostic: Diagnostic\n\n constructor(diagnostic: Diagnostic) {\n super(diagnostic.message)\n this.name = 'DiagnosticError'\n this.diagnostic = diagnostic\n }\n}\n"],"mappings":";;;AA0CA,IAAa,kBAAb,cAAqC,MAAM;CACzC;CAEA,YAAY,YAAwB;EAClC,MAAM,WAAW,OAAO;EACxB,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF"}