foldkit-mixins 0.19.1 → 0.20.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.
Files changed (73) hide show
  1. package/README.md +2 -2
  2. package/dist/app.d.mts +4 -6
  3. package/dist/app.d.mts.map +1 -1
  4. package/dist/app.mjs +6 -7
  5. package/dist/{core-BrR6UPbk.mjs → core-BKDVG8xT.mjs} +4 -6
  6. package/dist/{core-BrR6UPbk.mjs.map → core-BKDVG8xT.mjs.map} +1 -1
  7. package/dist/{core-Cq9PThXv.d.mts → core-DtE4hSjG.d.mts} +2 -4
  8. package/dist/core-DtE4hSjG.d.mts.map +1 -0
  9. package/dist/defaults.d.mts +1 -3
  10. package/dist/defaults.d.mts.map +1 -1
  11. package/dist/defaults.mjs +2 -3
  12. package/dist/foundations.d.mts +0 -2
  13. package/dist/foundations.d.mts.map +1 -1
  14. package/dist/foundations.mjs +1 -2
  15. package/dist/index.d.mts +6 -7
  16. package/dist/index.mjs +18 -31
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/{layers-DxWvuCJL.mjs → layers-b5nx42uz.mjs} +4 -6
  19. package/dist/{layers-DxWvuCJL.mjs.map → layers-b5nx42uz.mjs.map} +1 -1
  20. package/dist/layers.d.mts +1 -3
  21. package/dist/layers.d.mts.map +1 -1
  22. package/dist/layers.mjs +1 -1
  23. package/dist/layout.d.mts +2 -4
  24. package/dist/layout.d.mts.map +1 -1
  25. package/dist/layout.mjs +3 -4
  26. package/dist/layout.mjs.map +1 -1
  27. package/dist/{pipe-DrDyEhoj.d.mts → pipe-BLRPph_m.d.mts} +1 -3
  28. package/dist/pipe-BLRPph_m.d.mts.map +1 -0
  29. package/dist/prose.d.mts +1 -3
  30. package/dist/prose.d.mts.map +1 -1
  31. package/dist/prose.mjs +2 -3
  32. package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-D8jQpDG7.mjs} +1 -2
  33. package/dist/{root-DdIhpyqg.mjs → root-DNvW49Q8.mjs} +8 -12
  34. package/dist/{root-DdIhpyqg.mjs.map → root-DNvW49Q8.mjs.map} +1 -1
  35. package/dist/{slotItem-D6_m6IqP.d.mts → slotItem-Cpv59kaT.d.mts} +1 -3
  36. package/dist/slotItem-Cpv59kaT.d.mts.map +1 -0
  37. package/dist/{slotMark-y-RLAuTU.mjs → slotMark-e8KUUb85.mjs} +4 -6
  38. package/dist/{slotMark-y-RLAuTU.mjs.map → slotMark-e8KUUb85.mjs.map} +1 -1
  39. package/dist/{slotView-BfOwXpGw.d.mts → slotView-DOeaLB2f.d.mts} +3 -6
  40. package/dist/slotView-DOeaLB2f.d.mts.map +1 -0
  41. package/dist/{style-Cs-aMa_a.d.mts → style-AYR3dZQN.d.mts} +15 -12
  42. package/dist/style-AYR3dZQN.d.mts.map +1 -0
  43. package/dist/{style-COMT0F2e.mjs → style-DDID8a-S.mjs} +15 -24
  44. package/dist/{style-COMT0F2e.mjs.map → style-DDID8a-S.mjs.map} +1 -1
  45. package/dist/{styleValue-DEsUAC4v.d.mts → styleValue-DAnH8FFQ.d.mts} +2 -6
  46. package/dist/styleValue-DAnH8FFQ.d.mts.map +1 -0
  47. package/dist/{styleValue-6hpAYYfg.mjs → styleValue-agZrNfOL.mjs} +5 -8
  48. package/dist/{styleValue-6hpAYYfg.mjs.map → styleValue-agZrNfOL.mjs.map} +1 -1
  49. package/dist/testing.d.mts +1 -3
  50. package/dist/testing.d.mts.map +1 -1
  51. package/dist/testing.mjs +2 -3
  52. package/dist/theme.d.mts +5 -16
  53. package/dist/theme.d.mts.map +1 -1
  54. package/dist/theme.mjs +9 -14
  55. package/dist/theme.mjs.map +1 -1
  56. package/dist/{themes-Dum5GN0v.d.mts → themes-bB6oBgUD.d.mts} +5 -12
  57. package/dist/themes-bB6oBgUD.d.mts.map +1 -0
  58. package/dist/{tokens-eAYuf574.d.mts → tokens-CIBAmBRf.d.mts} +2 -5
  59. package/dist/tokens-CIBAmBRf.d.mts.map +1 -0
  60. package/dist/{tokens-BFpuo-sA.mjs → tokens-McwhqNmj.mjs} +12 -17
  61. package/dist/{tokens-BFpuo-sA.mjs.map → tokens-McwhqNmj.mjs.map} +1 -1
  62. package/dist/utilities.d.mts +2 -4
  63. package/dist/utilities.d.mts.map +1 -1
  64. package/dist/utilities.mjs +4 -5
  65. package/package.json +1 -1
  66. package/dist/core-Cq9PThXv.d.mts.map +0 -1
  67. package/dist/pipe-DrDyEhoj.d.mts.map +0 -1
  68. package/dist/slotItem-D6_m6IqP.d.mts.map +0 -1
  69. package/dist/slotView-BfOwXpGw.d.mts.map +0 -1
  70. package/dist/style-Cs-aMa_a.d.mts.map +0 -1
  71. package/dist/styleValue-DEsUAC4v.d.mts.map +0 -1
  72. package/dist/themes-Dum5GN0v.d.mts.map +0 -1
  73. package/dist/tokens-eAYuf574.d.mts.map +0 -1
package/README.md CHANGED
@@ -577,8 +577,8 @@ pieces: `unfilledHover`, `pressedHover`, `hover()`, `focusRing` and `disabled`.
577
577
 
578
578
  `foldkit-mixins/layout` ships the common arrangements as pieces: `Layout.stack`, `cluster`,
579
579
  `split`, `sidebar`, `switcher`, `reel`, `center`, `frame`, `pad`, and `autoGrid`, plus
580
- `Layout.intrinsic` (a stack child that keeps its own width) and `Layout.aside` (the sidebar
581
- child). Each compiles to rule text that is the same for every caller and reads `--fk-l-*`
580
+ `Layout.intrinsic` (a stack child as wide as its content; one that sets a width keeps it
581
+ anyway) and `Layout.aside` (the sidebar child). Each compiles to rule text that is the same for every caller and reads `--fk-l-*`
582
582
  variables with token fallbacks; the options only write those variables inline, so ten stacks
583
583
  with ten gaps are one rule and ten inline declarations. The pieces are unlayered; put them in
584
584
  `layouts`:
package/dist/app.d.mts CHANGED
@@ -1,9 +1,8 @@
1
- import { i as StyleValue } from "./styleValue-DEsUAC4v.mjs";
1
+ import { i as StyleValue } from "./styleValue-DAnH8FFQ.mjs";
2
2
  import { standard } from "./layers.mjs";
3
- import { a as NamedStyle, l as StyleOptions, n as Declared, r as DeclaredPieces, u as StylePieces } from "./style-Cs-aMa_a.mjs";
4
- import { a as compose, r as ThemeTokens, t as Refs } from "./core-Cq9PThXv.mjs";
5
- import { d as RootOptions, g as KnobTheme, r as Themes, t as StandardTokens, v as Standard } from "./themes-Dum5GN0v.mjs";
6
- //#region src/app.d.ts
3
+ import { a as NamedStyle, d as StylePieces, n as Declared, r as DeclaredPieces, u as StyleOptions } from "./style-AYR3dZQN.mjs";
4
+ import { a as compose, r as ThemeTokens, t as Refs } from "./core-DtE4hSjG.mjs";
5
+ import { d as RootOptions, g as KnobTheme, r as Themes, t as StandardTokens, v as Standard } from "./themes-bB6oBgUD.mjs";
7
6
  interface Common<Own extends ThemeTokens> {
8
7
  /**
9
8
  * Tokens of the application's own, laid over the shipped ones:
@@ -57,6 +56,5 @@ export declare function make<Own extends ThemeTokens = Record<never, never>>(opt
57
56
  export declare const AppStyle: {
58
57
  readonly make: typeof make;
59
58
  };
60
- //#endregion
61
59
  export {};
62
60
  //# sourceMappingURL=app.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.mts","names":["composeThemes"],"sources":["../src/app.ts"],"mappings":";;;;;;UAyBU,OAAO,YAAY;;;;;WAKlB,SAAS;;WAET,cAAc,YAAY;;;;;WAK1B,SAAS,cAAc;;iBAGjB,gBAAgB,YAAY,qBAAqB,OAAO;;WAE9D,OAAO,UAAU;;;;;;;iBAQX,sBACf,qBACA,YAAY,qBACJ,OAAO;WACN,QAAQ,OAAO;;;YAId,qBAAqB,KAAK;iBAErB,SAAS,YAAY;;WAE3B,OAAO,kBAAkBA,QAAc,gBAAgB;;WAEvD,GAAG,KAAK,kBAAkBA,QAAc,gBAAgB;;WAExD,UAAU;;WAEV,QAAQ,GAAG,QAAQ,eAAe,IAAI,UAAU,uBAAuB,SAAS;;WAEhF,WAAW,OAClB,UAAU,WACN,QAAQ,YAAY,QAAQ,UAAU,uBAAuB,WAAW;;WAErE;;;;;;;;wBAWK,KAAK,qBAAqB,YAAY,cAAc,sBAClE,SAAS,sBAAsB,MAAM,OACpC,SAAS;wBACI,KAAK,YAAY,cAAc,sBAC7C,SAAS,gBAAgB,OACxB,SAAS;qBA2BC;wBAAA"}
1
+ {"version":3,"file":"app.d.mts","names":["composeThemes"],"sources":["../src/app.ts"],"mappings":";;;;;UAyBU,OAAO,YAAY;;;;;WAKlB,SAAS;;WAET,cAAc,YAAY;;;;;WAK1B,SAAS,cAAc;;iBAGjB,gBAAgB,YAAY,qBAAqB,OAAO;;WAE9D,OAAO,UAAU;;;;;;;iBAQX,sBACf,qBACA,YAAY,qBACJ,OAAO;WACN,QAAQ,OAAO;;;YAId,qBAAqB,KAAK;iBAErB,SAAS,YAAY;;WAE3B,OAAO,kBAAkBA,QAAc,gBAAgB;;WAEvD,GAAG,KAAK,kBAAkBA,QAAc,gBAAgB;;WAExD,UAAU;;WAEV,QAAQ,GAAG,QAAQ,eAAe,IAAI,UAAU,uBAAuB,SAAS;;WAEhF,WAAW,OAClB,UAAU,WACN,QAAQ,YAAY,QAAQ,UAAU,uBAAuB,WAAW;;WAErE;;;;;;;;wBAWK,KAAK,qBAAqB,YAAY,cAAc,sBAClE,SAAS,sBAAsB,MAAM,OACpC,SAAS;wBACI,KAAK,YAAY,cAAc,sBAC7C,SAAS,gBAAgB,OACxB,SAAS;qBA2BC"}
package/dist/app.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { i as stylesheet, n as forSlots, r as slots } from "./style-COMT0F2e.mjs";
2
- import { i as compose } from "./styleValue-6hpAYYfg.mjs";
3
- import { r as standard } from "./layers-DxWvuCJL.mjs";
4
- import { o as ref, r as compose$1 } from "./core-BrR6UPbk.mjs";
5
- import { l as standardOf, t as root } from "./root-DdIhpyqg.mjs";
1
+ import { i as stylesheet, n as forSlots, r as slots } from "./style-DDID8a-S.mjs";
2
+ import { i as compose } from "./styleValue-agZrNfOL.mjs";
3
+ import { r as standard } from "./layers-b5nx42uz.mjs";
4
+ import { o as ref, r as compose$1 } from "./core-BKDVG8xT.mjs";
5
+ import { l as standardOf, t as root } from "./root-DNvW49Q8.mjs";
6
6
  import { body, reset } from "./defaults.mjs";
7
- //#region src/app.ts
7
+ // src/app.ts
8
8
  /**
9
9
  * `foldkit-mixins/app`: an application's style setup, fixed once. Every
10
10
  * application on the standard layers writes the same preamble: its theme's
@@ -33,7 +33,6 @@ function make(options) {
33
33
  });
34
34
  }
35
35
  const AppStyle = { make };
36
- //#endregion
37
36
  export { AppStyle, make };
38
37
 
39
38
  //# sourceMappingURL=app.mjs.map
@@ -1,9 +1,8 @@
1
- import { u as inline } from "./styleValue-6hpAYYfg.mjs";
2
- //#region src/pipe.ts
1
+ import { u as inline } from "./styleValue-agZrNfOL.mjs";
2
+ // src/pipe.ts
3
3
  /** Ported from `effect-atom-jsx/src/View.ts` `pipeSelf`. */
4
4
  const pipeSelf = (self, fns) => fns.reduce((acc, fn) => fn(acc), self);
5
- //#endregion
6
- //#region src/theme/core.ts
5
+ // src/theme/core.ts
7
6
  /**
8
7
  * `Theme` is typed token data, not a service. Dynamic theme state (light/dark)
9
8
  * belongs in the Foldkit Model; `variables` compiles the tokens to CSS custom
@@ -51,7 +50,6 @@ const Theme = {
51
50
  lightDark,
52
51
  compose
53
52
  };
54
- //#endregion
55
53
  export { lightDark as a, pipeSelf as c, define as i, VAR_PREFIX as n, ref as o, compose as r, variables as s, Theme as t };
56
54
 
57
- //# sourceMappingURL=core-BrR6UPbk.mjs.map
55
+ //# sourceMappingURL=core-BKDVG8xT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"core-BrR6UPbk.mjs","names":[],"sources":["../src/pipe.ts","../src/theme/core.ts"],"sourcesContent":["/** Ported from `effect-atom-jsx/src/View.ts` `pipeSelf`. */\nexport const pipeSelf = (self: unknown, fns: ReadonlyArray<(value: any) => any>): unknown =>\n fns.reduce((acc, fn) => fn(acc), self)\n\nexport type Pipeable<Self> = {\n pipe(): Self\n pipe(...fns: ReadonlyArray<(self: Self) => Self>): Self\n pipe<A>(ab: (self: Self) => A): A\n pipe<A, B>(ab: (self: Self) => A, bc: (a: A) => B): B\n pipe<A, B, C>(ab: (self: Self) => A, bc: (a: A) => B, cd: (b: B) => C): C\n}\n","/**\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":";;;AACA,MAAa,YAAY,MAAe,QACtC,IAAI,QAAQ,KAAK,OAAO,GAAG,GAAG,GAAG,IAAI;;;;;;;;ACWvC,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"}
1
+ {"version":3,"file":"core-BKDVG8xT.mjs","names":[],"sources":["../src/pipe.ts","../src/theme/core.ts"],"sourcesContent":["/** Ported from `effect-atom-jsx/src/View.ts` `pipeSelf`. */\nexport const pipeSelf = (self: unknown, fns: ReadonlyArray<(value: any) => any>): unknown =>\n fns.reduce((acc, fn) => fn(acc), self)\n\nexport type Pipeable<Self> = {\n pipe(): Self\n pipe(...fns: ReadonlyArray<(self: Self) => Self>): Self\n pipe<A>(ab: (self: Self) => A): A\n pipe<A, B>(ab: (self: Self) => A, bc: (a: A) => B): B\n pipe<A, B, C>(ab: (self: Self) => A, bc: (a: A) => B, cd: (b: B) => C): C\n}\n","/**\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":";;;AACA,MAAa,YAAY,MAAe,QACtC,IAAI,QAAQ,KAAK,OAAO,GAAG,GAAG,GAAG,IAAI;;;;;;;ACWvC,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"}
@@ -1,5 +1,4 @@
1
- import { i as StyleValue } from "./styleValue-DEsUAC4v.mjs";
2
- //#region src/theme/core.d.ts
1
+ import { i as StyleValue } from "./styleValue-DAnH8FFQ.mjs";
3
2
  type ThemeTokens = {
4
3
  readonly [group: string]: {
5
4
  readonly [name: string]: string;
@@ -33,6 +32,5 @@ declare const Theme: {
33
32
  readonly lightDark: typeof lightDark;
34
33
  readonly compose: typeof compose;
35
34
  };
36
- //#endregion
37
35
  export { compose as a, ref as c, VAR_PREFIX as i, variables as l, Theme as n, define as o, ThemeTokens as r, lightDark as s, Refs as t };
38
- //# sourceMappingURL=core-Cq9PThXv.d.mts.map
36
+ //# sourceMappingURL=core-DtE4hSjG.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core-DtE4hSjG.d.mts","names":[],"sources":["../src/theme/core.ts"],"mappings":";KAOY;YACA;cAA4B;;;KAG5B,MAAM,UAAU,cAAc,eAAe;cAE5C;cAEA,SAAU,UAAU,aAAW,QAAU,MAAI,SAAS;;KAQvD,KAAK,UAAU,2BACf,WAAW,yBAAyB,WAAW,EAAE;;;;;;cAUhD,MAAO,UAAU,aAAW,OAAS,MAAI,KAAK;cAmB9C,YAAa,UAAU,aAAW,OAAS,MAAI;;;;;;cAe/C,YAAS,eAAiB;KAElC,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,aAAW,MAC5D,GAAC,MACD,MACL,SAAS,MAAM,GAAG;cAUR"}
@@ -1,5 +1,4 @@
1
- import { i as StyleValue } from "./styleValue-DEsUAC4v.mjs";
2
- //#region src/defaults.d.ts
1
+ import { i as StyleValue } from "./styleValue-DAnH8FFQ.mjs";
3
2
  /** Box model, margins, media, form-control fonts: what every page assumes. */
4
3
  export declare const reset: StyleValue;
5
4
  /** The page's font, color, background, and color scheme. */
@@ -27,5 +26,4 @@ export declare const Defaults: {
27
26
  readonly controls: StyleValue;
28
27
  readonly all: StyleValue;
29
28
  };
30
- //#endregion
31
29
  //# sourceMappingURL=defaults.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.mts","names":[],"sources":["../src/defaults.ts"],"mappings":";;;qBAca,OAAO;;qBAkCP,MAAM;;;;;;qBAcN,UAAU;;qBAaV,OAAO;;qBAWP,MAAM;;qBAWN,UAAU;;qBAcV,KAAK;qBAEL"}
1
+ {"version":3,"file":"defaults.d.mts","names":[],"sources":["../src/defaults.ts"],"mappings":";;qBAca,OAAO;;qBAkCP,MAAM;;;;;;qBAcN,UAAU;;qBAaV,OAAO;;qBAWP,MAAM;;qBAWN,UAAU;;qBAcV,KAAK;qBAEL"}
package/dist/defaults.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { c as global, i as compose } from "./styleValue-6hpAYYfg.mjs";
2
- //#region src/defaults.ts
1
+ import { c as global, i as compose } from "./styleValue-agZrNfOL.mjs";
2
+ // src/defaults.ts
3
3
  /**
4
4
  * `foldkit-mixins/defaults`: the baseline plain HTML gets before any slot is
5
5
  * styled. Every member is element-selector CSS over `--fk-*` tokens with a
@@ -77,7 +77,6 @@ const Defaults = {
77
77
  controls,
78
78
  all
79
79
  };
80
- //#endregion
81
80
  export { Defaults, all, body, code, controls, headings, links, reset };
82
81
 
83
82
  //# sourceMappingURL=defaults.mjs.map
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "vite";
2
- //#region src/foundations.d.ts
3
2
  /**
4
3
  * Compiles the stylesheet a module exports: what the page's first paint is
5
4
  * styled with before any script runs. The module is evaluated, so it must be
@@ -26,5 +25,4 @@ export declare const foundations: (options: {
26
25
  /** What `vite build` runs from. Default the current directory. */
27
26
  readonly root?: string | undefined;
28
27
  }) => Plugin;
29
- //#endregion
30
28
  //# sourceMappingURL=foundations.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"foundations.d.mts","names":[],"sources":["../src/foundations.ts"],"mappings":";;;;;;;qBA4Ca,kBAAe;;WAEjB;;WAEA;;WAEA;MACP;;;;;;qBA4BS,cAAW;;WAEb;;WAEA;;WAEA;MACP"}
1
+ {"version":3,"file":"foundations.d.mts","names":[],"sources":["../src/foundations.ts"],"mappings":";;;;;;qBA4Ca,kBAAe;;WAEjB;;WAEA;;WAEA;MACP;;;;;;qBA4BS,cAAW;;WAEb;;WAEA;;WAEA;MACP"}
@@ -1,4 +1,4 @@
1
- //#region src/foundations.ts
1
+ // src/foundations.ts
2
2
  /** Workspace packages resolve to their source, so the foundations build as edited. */
3
3
  const conditions = ["foldkit-plus:source"];
4
4
  const loadVite = async () => {
@@ -65,7 +65,6 @@ const foundations = (options) => ({
65
65
  }
66
66
  }
67
67
  });
68
- //#endregion
69
68
  export { foundations, loadFoundations };
70
69
 
71
70
  //# sourceMappingURL=foundations.mjs.map
package/dist/index.d.mts CHANGED
@@ -1,9 +1,9 @@
1
- import { t as SlotItem } from "./slotItem-D6_m6IqP.mjs";
2
- import { C as StyleRule, i as StyleValue, n as Piece, r as StyleCondition, t as Declarations } from "./styleValue-DEsUAC4v.mjs";
1
+ import { t as SlotItem } from "./slotItem-Cpv59kaT.mjs";
2
+ import { C as StyleRule, i as StyleValue, n as Piece, r as StyleCondition, t as Declarations } from "./styleValue-DAnH8FFQ.mjs";
3
3
  import { Layers, Placement } from "./layers.mjs";
4
- import { $ as metadataToken_d_exports, A as requirement_d_exports, B as Contribution, C as RequirementName, D as UnnamedSlot, E as SlotProtection, F as AnyMixin, G as StaticContribution, H as DynamicContribution, I as Mixin, J as Capability, K as StaticContributionMap, L as MixinFor, M as event_d_exports, N as AttrToken, O as slot_d_exports, P as attr_d_exports, Q as capability_d_exports, R as StaticMixin, T as SlotCapability, U as InputContribution, V as ContributionContext, W as SlotContribution, Z as Satisfies, _ as Any$1, a as SlotViewRender, b as EventName, c as slotView_d_exports, d as resolver_d_exports, f as BehaviorSlotOptions, g as behavior_d_exports, h as SlotRequirements, i as SlotView, j as EventToken, k as RequirementToken, l as ResolveOptions, m as NamedBehavior, n as SlotBuilder, o as SlotViewTransform, p as BehaviorSpec, q as Any, r as SlotBuilders, s as SlotViewTransformFor, t as MessageSlotView, u as SlotAttributes, x as HiddenOf, y as AttributeName, z as mixin_d_exports } from "./slotView-BfOwXpGw.mjs";
5
- import { a as NamedStyle, c as Style, d as StyleValues, f as StylesheetSource, i as DeclaredSlots, l as StyleOptions, m as slots_d_exports, n as Declared, o as SlotPiece, p as Contract, r as DeclaredPieces, s as SlotRecipe, t as ContainerSlot, u as StylePieces } from "./style-Cs-aMa_a.mjs";
6
- import { n as Theme, r as ThemeTokens, t as Refs } from "./core-Cq9PThXv.mjs";
4
+ import { $ as metadataToken_d_exports, A as requirement_d_exports, B as Contribution, C as RequirementName, D as UnnamedSlot, E as SlotProtection, F as AnyMixin, G as StaticContribution, H as DynamicContribution, I as Mixin, J as Capability, K as StaticContributionMap, L as MixinFor, M as event_d_exports, N as AttrToken, O as slot_d_exports, P as attr_d_exports, Q as capability_d_exports, R as StaticMixin, T as SlotCapability, U as InputContribution, V as ContributionContext, W as SlotContribution, Z as Satisfies, _ as Any$1, a as SlotViewRender, b as EventName, c as slotView_d_exports, d as resolver_d_exports, f as BehaviorSlotOptions, g as behavior_d_exports, h as SlotRequirements, i as SlotView, j as EventToken, k as RequirementToken, l as ResolveOptions, m as NamedBehavior, n as SlotBuilder, o as SlotViewTransform, p as BehaviorSpec, q as Any, r as SlotBuilders, s as SlotViewTransformFor, t as MessageSlotView, u as SlotAttributes, x as HiddenOf, y as AttributeName, z as mixin_d_exports } from "./slotView-DOeaLB2f.mjs";
5
+ import { a as NamedStyle, c as SlotRecipeSelection, d as StylePieces, f as StyleValues, h as slots_d_exports, i as DeclaredSlots, l as Style, m as Contract, n as Declared, o as SlotPiece, p as StylesheetSource, r as DeclaredPieces, s as SlotRecipe, t as ContainerSlot, u as StyleOptions } from "./style-AYR3dZQN.mjs";
6
+ import { n as Theme, r as ThemeTokens, t as Refs } from "./core-DtE4hSjG.mjs";
7
7
  import { Attribute, KeyboardModifiers } from "foldkit/html";
8
8
  declare namespace diagnostics_d_exports {
9
9
  export { Diagnostic, DiagnosticCode, DiagnosticError };
@@ -199,6 +199,5 @@ declare const descendant: (selector: string) => string;
199
199
  declare const sibling: (selector: string) => string;
200
200
  /** Any later sibling, for `Style.nest`. */
201
201
  declare const siblings: (selector: string) => string;
202
- //#endregion
203
- export { a11y_d_exports as A11y, type A11yDiagnostic, type A11yDiagnosticCode, type Pattern as A11yPattern, type SlotRequirement as A11yRequirement, type Any as AnyCapability, type AnyMixin, attr_d_exports as Attr, type AttrToken, type AttributeName, attributes_d_exports as Attributes, behavior_d_exports as Behavior, type BehaviorSlotOptions, type BehaviorSpec, index_d_exports as Behaviors, capability_d_exports as Capability, type Capability as CapabilityShape, type ContainerSlot, type Contribution, type ContributionContext, type Declarations, type Declared, type DeclaredPieces, type DeclaredSlots, type Diagnostic, type DiagnosticCode, diagnostics_d_exports as Diagnostics, type DynamicContribution, event_d_exports as Event, type EventName, type EventToken, type HiddenOf, type InputContribution, Layers, type Layers as LayersValue, type MessageSlotView, metadataToken_d_exports as MetadataToken, mixin_d_exports as Mixin, type MixinFor, type Mixin as MixinValue, type NamedBehavior, type NamedStyle, type Piece, type Placement, type Refs, requirement_d_exports as Requirement, type RequirementName, type RequirementToken, type ResolveOptions, resolver_d_exports as Resolver, type Satisfies, selector_d_exports as Selector, slot_d_exports as Slot, type SlotAttributes, type SlotBuilder, type SlotBuilders, type SlotContribution, type SlotItem, type SlotPiece, type SlotProtection, type SlotRecipe, type SlotRequirements, slotView_d_exports as SlotView, type SlotViewRender, type SlotView as SlotViewShape, type SlotViewTransform, type SlotViewTransformFor, slots_d_exports as Slots, type Contract as SlotsContract, type StaticContribution, type StaticContributionMap, type StaticMixin, Style, type StyleCondition, type StyleOptions, type StylePieces, type StyleRule, type StyleValue, type StyleValues, type StylesheetSource, Theme, type Theme as ThemeValue, type ThemeTokens, type UnnamedSlot };
202
+ export { a11y_d_exports as A11y, type A11yDiagnostic, type A11yDiagnosticCode, type Pattern as A11yPattern, type SlotRequirement as A11yRequirement, type Any as AnyCapability, type AnyMixin, attr_d_exports as Attr, type AttrToken, type AttributeName, attributes_d_exports as Attributes, behavior_d_exports as Behavior, type BehaviorSlotOptions, type BehaviorSpec, index_d_exports as Behaviors, capability_d_exports as Capability, type Capability as CapabilityShape, type ContainerSlot, type Contribution, type ContributionContext, type Declarations, type Declared, type DeclaredPieces, type DeclaredSlots, type Diagnostic, type DiagnosticCode, diagnostics_d_exports as Diagnostics, type DynamicContribution, event_d_exports as Event, type EventName, type EventToken, type HiddenOf, type InputContribution, Layers, type Layers as LayersValue, type MessageSlotView, metadataToken_d_exports as MetadataToken, mixin_d_exports as Mixin, type MixinFor, type Mixin as MixinValue, type NamedBehavior, type NamedStyle, type Piece, type Placement, type Refs, requirement_d_exports as Requirement, type RequirementName, type RequirementToken, type ResolveOptions, resolver_d_exports as Resolver, type Satisfies, selector_d_exports as Selector, slot_d_exports as Slot, type SlotAttributes, type SlotBuilder, type SlotBuilders, type SlotContribution, type SlotItem, type SlotPiece, type SlotProtection, type SlotRecipe, type SlotRecipeSelection, type SlotRequirements, slotView_d_exports as SlotView, type SlotViewRender, type SlotView as SlotViewShape, type SlotViewTransform, type SlotViewTransformFor, slots_d_exports as Slots, type Contract as SlotsContract, type StaticContribution, type StaticContributionMap, type StaticMixin, Style, type StyleCondition, type StyleOptions, type StylePieces, type StyleRule, type StyleValue, type StyleValues, type StylesheetSource, Theme, type Theme as ThemeValue, type ThemeTokens, type UnnamedSlot };
204
203
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { _ as extendsCapability, a as slots_exports, b as metadataToken_exports, c as slotView_exports, d as mixin_exports, f as isTagged, g as capability_exports, h as Interactive, l as resolver_exports, m as Focusable, o as slot_exports, p as Container, s as attach$1, t as Style, u as dynamic, v as is$4, x as nameOf, y as make$3 } from "./style-COMT0F2e.mjs";
3
- import { E as diagnostics_exports, T as DiagnosticError } from "./styleValue-6hpAYYfg.mjs";
4
- import { t as Layers } from "./layers-DxWvuCJL.mjs";
5
- import { t as Theme } from "./core-BrR6UPbk.mjs";
1
+ import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
2
+ import { _ as extendsCapability, a as slots_exports, b as metadataToken_exports, c as slotView_exports, d as mixin_exports, f as isTagged, g as capability_exports, h as Interactive, l as resolver_exports, m as Focusable, o as slot_exports, p as Container, s as attach$1, t as Style, u as dynamic, v as is$4, x as nameOf, y as make$3 } from "./style-DDID8a-S.mjs";
3
+ import { E as diagnostics_exports, T as DiagnosticError } from "./styleValue-agZrNfOL.mjs";
4
+ import { t as Layers } from "./layers-b5nx42uz.mjs";
5
+ import { t as Theme } from "./core-BKDVG8xT.mjs";
6
6
  import { Option } from "effect";
7
- //#region src/a11y.ts
7
+ // src/a11y.ts
8
8
  /**
9
9
  * Structural accessibility validation. A `Pattern` names the Slots a widget
10
10
  * must publish, the capabilities those Slots must satisfy, and the events and
@@ -82,8 +82,7 @@ const validate = (pattern, slots) => {
82
82
  }
83
83
  return diagnostics;
84
84
  };
85
- //#endregion
86
- //#region src/attr.ts
85
+ // src/attr.ts
87
86
  /**
88
87
  * Slot attribute tokens. Ported from `effect-atom-jsx/src/View.ts` `Attribute`,
89
88
  * plus ARIA names the Foldkit plan lists.
@@ -118,8 +117,7 @@ const AriaPressed = make$2("aria-pressed");
118
117
  const AriaDisabled = make$2("aria-disabled");
119
118
  const Disabled = make$2("disabled");
120
119
  const Value = make$2("value");
121
- //#endregion
122
- //#region src/attributes.ts
120
+ // src/attributes.ts
123
121
  var attributes_exports = /* @__PURE__ */ __exportAll({
124
122
  filter: () => filter,
125
123
  find: () => find,
@@ -132,8 +130,7 @@ const hasTag = (tag) => (attribute) => tagOf(attribute) === tag;
132
130
  const find = (attributes, tag) => attributes.find(hasTag(tag));
133
131
  /** Every attribute with `tag`, in bundle order. */
134
132
  const filter = (attributes, tag) => attributes.filter(hasTag(tag));
135
- //#endregion
136
- //#region src/behavior.ts
133
+ // src/behavior.ts
137
134
  var behavior_exports = /* @__PURE__ */ __exportAll({
138
135
  Behavior: () => Behavior,
139
136
  attach: () => attach,
@@ -202,8 +199,7 @@ const Behavior = {
202
199
  forSlots,
203
200
  attach
204
201
  };
205
- //#endregion
206
- //#region src/behaviors/collection.ts
202
+ // src/behaviors/collection.ts
207
203
  var collection_exports = /* @__PURE__ */ __exportAll({
208
204
  behavior: () => behavior$4,
209
205
  of: () => of
@@ -265,8 +261,7 @@ const behavior$4 = (slots) => (options) => forSlots(slots)({ [options.item]: slo
265
261
  ...options.posInSet === true ? [h.AriaPosinset(item.index + 1), h.AriaSetsize(item.count ?? items.size)] : []
266
262
  ];
267
263
  } }) }, { name: "Collection" });
268
- //#endregion
269
- //#region src/behaviors/disclosure.ts
264
+ // src/behaviors/disclosure.ts
270
265
  var disclosure_exports = /* @__PURE__ */ __exportAll({ behavior: () => behavior$3 });
271
266
  const behavior$3 = (slots) => (options) => forSlots(slots)({
272
267
  [options.trigger]: slot({
@@ -278,8 +273,7 @@ const behavior$3 = (slots) => (options) => forSlots(slots)({
278
273
  attributes: ({ input, h }) => [h.Id(options.id(input)), h.Hidden(!options.open(input))]
279
274
  })
280
275
  }, { name: "Disclosure" });
281
- //#endregion
282
- //#region src/behaviors/field-association.ts
276
+ // src/behaviors/field-association.ts
283
277
  var field_association_exports = /* @__PURE__ */ __exportAll({
284
278
  behavior: () => behavior$2,
285
279
  ids: () => ids
@@ -314,8 +308,7 @@ const behavior$2 = (slots) => (options) => forSlots(slots)({
314
308
  ...options.description === void 0 ? {} : { [options.description]: slot({ attributes: ({ input, h }) => [h.Id(ids(options.id(input)).description)] }) },
315
309
  ...options.error === void 0 ? {} : { [options.error]: slot({ attributes: ({ input, h }) => [h.Id(ids(options.id(input)).error)] }) }
316
310
  }, { name: "FieldAssociation" });
317
- //#endregion
318
- //#region src/behaviors/spin-value.ts
311
+ // src/behaviors/spin-value.ts
319
312
  /**
320
313
  * A number stepped by keys: ArrowUp and ArrowDown by `step`, PageUp and
321
314
  * PageDown by `page`, Home and End to the bounds, each clamped, each
@@ -362,8 +355,7 @@ const behavior$1 = (slots) => (options) => forSlots(slots)({ [options.control]:
362
355
  ];
363
356
  }
364
357
  }) }, { name: "SpinValue" });
365
- //#endregion
366
- //#region src/behaviors/toggle-state.ts
358
+ // src/behaviors/toggle-state.ts
367
359
  var toggle_state_exports = /* @__PURE__ */ __exportAll({ behavior: () => behavior });
368
360
  const behavior = (slots) => (options) => forSlots(slots)({ [options.control]: slot({
369
361
  requires: { capability: Interactive },
@@ -372,8 +364,7 @@ const behavior = (slots) => (options) => forSlots(slots)({ [options.control]: sl
372
364
  return options.as === "checked" ? [h.AriaChecked(state)] : [h.AriaPressed(state === "mixed" ? "mixed" : state ? "true" : "false")];
373
365
  }
374
366
  }) }, { name: "ToggleState" });
375
- //#endregion
376
- //#region src/behaviors/index.ts
367
+ // src/behaviors/index.ts
377
368
  var behaviors_exports = /* @__PURE__ */ __exportAll({
378
369
  Collection: () => collection_exports,
379
370
  Disclosure: () => disclosure_exports,
@@ -381,8 +372,7 @@ var behaviors_exports = /* @__PURE__ */ __exportAll({
381
372
  SpinValue: () => spin_value_exports,
382
373
  ToggleState: () => toggle_state_exports
383
374
  });
384
- //#endregion
385
- //#region src/event.ts
375
+ // src/event.ts
386
376
  /**
387
377
  * Slot event tokens. Ported from `effect-atom-jsx/src/View.ts` `Event`, plus
388
378
  * the extra names the Foldkit plan lists.
@@ -421,8 +411,7 @@ const PointerDown = make$1("pointerdown");
421
411
  const PointerUp = make$1("pointerup");
422
412
  const Hover = make$1("hover");
423
413
  const Submit = make$1("submit");
424
- //#endregion
425
- //#region src/requirement.ts
414
+ // src/requirement.ts
426
415
  /**
427
416
  * Platform requirement tokens. Ported from `effect-atom-jsx/src/View.ts`
428
417
  * `Requirement`.
@@ -441,8 +430,7 @@ const describe = (requirement) => ({ name: requirement.name });
441
430
  const Keyboard = make("keyboard");
442
431
  const Pointer = make("pointer");
443
432
  const Clipboard = make("clipboard");
444
- //#endregion
445
- //#region src/selector.ts
433
+ // src/selector.ts
446
434
  var selector_exports = /* @__PURE__ */ __exportAll({
447
435
  attr: () => attr,
448
436
  child: () => child,
@@ -471,7 +459,6 @@ const descendant = (selector) => selector;
471
459
  const sibling = (selector) => `+ ${selector}`;
472
460
  /** Any later sibling, for `Style.nest`. */
473
461
  const siblings = (selector) => `~ ${selector}`;
474
- //#endregion
475
462
  export { a11y_exports as A11y, attr_exports as Attr, attributes_exports as Attributes, behavior_exports as Behavior, behaviors_exports as Behaviors, capability_exports as Capability, diagnostics_exports as Diagnostics, event_exports as Event, Layers, metadataToken_exports as MetadataToken, mixin_exports as Mixin, requirement_exports as Requirement, resolver_exports as Resolver, selector_exports as Selector, slot_exports as Slot, slotView_exports as SlotView, slots_exports as Slots, Style, Theme };
476
463
 
477
464
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["MetadataToken.nameOf","Capability.extendsCapability","is","MetadataToken.is","make","MetadataToken.make","equals","describe","Capability.extendsCapability","MetadataToken.nameOf","Mixin.dynamic","SlotView.attach","behavior","Behavior.forSlots","Behavior.slot","behavior","Behavior.forSlots","Behavior.slot","Capability.Interactive","Capability.Container","behavior","Behavior.forSlots","Behavior.slot","Capability.Interactive","behavior","Behavior.forSlots","Behavior.slot","Capability.Focusable","Behavior.forSlots","Behavior.slot","Capability.Interactive","is","MetadataToken.is","make","MetadataToken.make","describe","is","MetadataToken.is","MetadataToken.make"],"sources":["../src/a11y.ts","../src/attr.ts","../src/attributes.ts","../src/behavior.ts","../src/behaviors/collection.ts","../src/behaviors/disclosure.ts","../src/behaviors/field-association.ts","../src/behaviors/spin-value.ts","../src/behaviors/toggle-state.ts","../src/behaviors/index.ts","../src/event.ts","../src/requirement.ts","../src/selector.ts"],"sourcesContent":["/**\n * Structural accessibility validation. A `Pattern` names the Slots a widget\n * must publish, the capabilities those Slots must satisfy, and the events and\n * attributes they must expose. `validate` compares a `Slots` contract against a\n * pattern and reports every mismatch as a `Diagnostic`. It is pure and\n * DOM-independent: it checks the declared contract, not a rendered tree, so it\n * verifies only the contract it is given and does not certify WCAG conformance.\n */\nimport * as Capability from './capability.js'\nimport type { Diagnostic } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport type { Any as AnySlot, AttributeName, EventName, SlotCapability } from './slot.js'\n\nexport type A11yDiagnosticCode =\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface A11yDiagnostic extends Diagnostic {\n readonly source: 'a11y'\n readonly code: A11yDiagnosticCode\n}\n\nexport interface SlotRequirement {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n /** An absent slot is expected, not a diagnostic. A present slot is still checked. */\n readonly optional?: boolean\n}\n\nexport type Requirements = Readonly<Record<string, SlotRequirement>>\n\nexport const PatternTypeId: unique symbol = Symbol.for('foldkit-mixins/A11yPattern')\n\nexport interface Pattern<Spec extends Requirements = Requirements> {\n readonly [PatternTypeId]: { readonly Requirements: Spec }\n readonly requirements: Spec\n}\n\nexport const pattern = <const Spec extends Requirements>(spec: Spec): Pattern<Spec> => {\n const requirements = Object.create(null) as Record<string, SlotRequirement>\n for (const name of Object.getOwnPropertyNames(spec)) {\n const requirement = spec[name]\n if (requirement === undefined) continue\n Object.defineProperty(requirements, name, {\n value: Object.freeze({ ...requirement }),\n enumerable: true,\n configurable: false,\n writable: false,\n })\n }\n Object.freeze(requirements)\n return Object.freeze({\n [PatternTypeId]: { Requirements: undefined as unknown as Spec },\n requirements: requirements as Spec,\n }) as Pattern<Spec>\n}\n\nconst publishes = (\n names: ReadonlyArray<string | MetadataToken.Any>,\n required: string | MetadataToken.Any,\n): boolean => {\n const requiredName = MetadataToken.nameOf(required)\n return names.some(name => MetadataToken.nameOf(name) === requiredName)\n}\n\nconst diagnostic = (\n code: A11yDiagnosticCode,\n message: string,\n slot: string,\n details?: Readonly<Record<string, unknown>>,\n): A11yDiagnostic => ({\n source: 'a11y',\n code,\n severity: 'error',\n message,\n slot,\n ...(details === undefined ? {} : { details }),\n})\n\nexport const validate = (\n pattern: Pattern,\n slots: { readonly [name: string]: AnySlot },\n): ReadonlyArray<A11yDiagnostic> => {\n const diagnostics: Array<A11yDiagnostic> = []\n for (const name of Object.getOwnPropertyNames(pattern.requirements)) {\n const requirement = pattern.requirements[name]\n if (requirement === undefined) continue\n if (!Object.hasOwn(slots, name)) {\n if (requirement.optional === true) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-slot',\n `A11y pattern requires slot \"${name}\", which the contract does not publish`,\n name,\n ),\n )\n continue\n }\n const slot = slots[name]\n if (slot === undefined) continue\n if (slot.hidden) {\n diagnostics.push(\n diagnostic(\n 'a11y:hidden-slot',\n `A11y pattern requires slot \"${name}\", which is hidden`,\n name,\n ),\n )\n continue\n }\n if (\n requirement.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirement.capability)\n ) {\n diagnostics.push(\n diagnostic(\n 'a11y:capability-mismatch',\n `A11y pattern requires capability \"${MetadataToken.nameOf(requirement.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n {\n required: MetadataToken.nameOf(requirement.capability),\n actual: MetadataToken.nameOf(slot.capability),\n },\n ),\n )\n }\n for (const event of requirement.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (publishes(slot.events, event)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-event',\n `A11y pattern requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n ),\n )\n }\n for (const attribute of requirement.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (publishes(slot.attributes, attribute)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-attribute',\n `A11y pattern requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n ),\n )\n }\n }\n return diagnostics\n}\n","/**\n * Slot attribute tokens. Ported from `effect-atom-jsx/src/View.ts` `Attribute`,\n * plus ARIA names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type AttrToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.attribute',\n Name\n>\n\nexport const is = (value: unknown): value is AttrToken =>\n MetadataToken.is(value) && value.kind === 'view.attribute'\n\nexport const make = <const Name extends string>(name: Name): AttrToken<Name> =>\n MetadataToken.make('view.attribute', name)\n\nexport const equals = (left: AttrToken, right: AttrToken): boolean => left.name === right.name\n\nexport const describe = (attr: AttrToken): { readonly name: string } => ({\n name: attr.name,\n})\n\nexport const Role = make('role')\nexport const AriaLabel = make('aria-label')\nexport const AriaDescribedby = make('aria-describedby')\nexport const AriaExpanded = make('aria-expanded')\nexport const AriaSelected = make('aria-selected')\nexport const AriaInvalid = make('aria-invalid')\nexport const AriaPressed = make('aria-pressed')\nexport const AriaDisabled = make('aria-disabled')\nexport const Disabled = make('disabled')\nexport const Value = make('value')\n","/**\n * Typed reads over a resolved `SlotAttributes` bundle. Foldkit's tagged\n * attribute union narrows on `_tag`, so a lookup by tag returns that variant's\n * own fields (`value`, `message`, `key`, `action`) without a cast.\n */\nimport type { Attribute } from 'foldkit/html'\nimport { isTagged } from './attribute.js'\nimport type { SlotAttributes } from './resolver.js'\n\n/** Every Foldkit attribute tag: `'Class'`, `'OnClick'`, `'DataAttribute'`, … */\nexport type Tag = Attribute<never>['_tag']\n\n/** The attribute variant carrying `T`. */\nexport type Of<Message, T extends Tag> = Extract<Attribute<Message>, { readonly _tag: T }>\n\n/** The tag of one bundle entry; `undefined` for an opaque `ChildAttribute`. */\nexport const tagOf = <Message>(attribute: SlotAttributes<Message>[number]): Tag | undefined =>\n isTagged(attribute) ? attribute._tag : undefined\n\nconst hasTag =\n <Message, T extends Tag>(tag: T) =>\n (attribute: SlotAttributes<Message>[number]): attribute is Of<Message, T> =>\n tagOf(attribute) === tag\n\n/** The first attribute with `tag`, typed as that variant. */\nexport const find = <Message, T extends Tag>(\n attributes: SlotAttributes<Message>,\n tag: T,\n): Of<Message, T> | undefined => attributes.find(hasTag<Message, T>(tag))\n\n/** Every attribute with `tag`, in bundle order. */\nexport const filter = <Message, T extends Tag>(\n attributes: SlotAttributes<Message>,\n tag: T,\n): ReadonlyArray<Of<Message, T>> => attributes.filter(hasTag<Message, T>(tag))\n","/**\n * `Behavior` is a named set of interaction contributions attached to declared\n * Slots. It owns no state: attributes are built from the view's `input` and `h`\n * while resolving, so the Message universe is the view's. A stateful widget is\n * a Foldkit Submodel; a continuous element listener is a Mount; a network call\n * is Message -> update -> Command.\n */\nimport type { Attribute, ChildAttribute, HtmlBuilder } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport * as Capability from './capability.js'\nimport type { SlotContribution, SlotItem } from './contribution.js'\nimport { DiagnosticError, type DiagnosticCode } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue } from './mixin.js'\nimport type { Any as AnySlot, AttributeName, EventName, HiddenOf, SlotCapability } from './slot.js'\nimport * as SlotView from './slotView.js'\n\nexport interface SlotRequirements {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n}\n\nexport interface BehaviorSlotOptions<Input, Message> {\n readonly requires?: SlotRequirements\n /**\n * Attributes for one resolution of the slot. `item` is present when the view\n * passed one to `slots.x.attrs(base, item)`, that is, when the slot is\n * rendered once per item.\n */\n readonly attributes?: (context: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n readonly item?: SlotItem\n }) => ReadonlyArray<Attribute<Message> | ChildAttribute>\n readonly mount?: (input: Input, item?: SlotItem) => MountAction<Message, any>\n}\n\nexport type BehaviorSpec<Slots, Input, Message> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: BehaviorSlotOptions<\n Input,\n Message\n >\n}\n\nexport interface NamedBehavior<Slots, Input, Message> {\n readonly name?: string\n readonly spec: BehaviorSpec<Slots, Input, Message>\n readonly mixin: MixinValue<Message>\n}\n\n/** Identity helper; `forSlots` supplies the contextual `Input`/`Message`. */\nexport const slot = <Options extends BehaviorSlotOptions<any, any>>(options: Options): Options =>\n options\n\nfunction fail(\n code: DiagnosticCode,\n message: string,\n slotName: string,\n details?: Readonly<Record<string, unknown>>,\n): never {\n throw new DiagnosticError({\n source: 'mixins',\n code,\n severity: 'error',\n message,\n slot: slotName,\n ...(details === undefined ? {} : { details }),\n })\n}\n\nconst validateRequirements = (\n name: string,\n slot: AnySlot,\n requirements: SlotRequirements,\n): void => {\n if (\n requirements.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirements.capability)\n ) {\n fail(\n 'mixins:capability-mismatch',\n `Behavior requires capability \"${MetadataToken.nameOf(requirements.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n { required: MetadataToken.nameOf(requirements.capability) },\n )\n }\n for (const event of requirements.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (!slot.events.some(allowed => MetadataToken.nameOf(allowed) === eventName)) {\n fail(\n 'mixins:unsupported-event',\n `Behavior requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n )\n }\n }\n for (const attribute of requirements.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (!slot.attributes.some(allowed => MetadataToken.nameOf(allowed) === attributeName)) {\n fail(\n 'mixins:unsupported-attribute',\n `Behavior requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n )\n }\n }\n}\n\nexport const forSlots =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n spec: BehaviorSpec<Slots, Input, Message>,\n options?: { readonly name?: string },\n ): NamedBehavior<Slots, Input, Message> => {\n const source = slots as unknown as Record<string, AnySlot>\n const contributions: Record<string, SlotContribution<Message>> = Object.create(null)\n for (const [name, slotOptions] of Object.entries(\n spec as Record<string, BehaviorSlotOptions<Input, Message> | undefined>,\n )) {\n const target = source[name]\n if (target === undefined) {\n fail('mixins:unknown-slot', `Behavior targets unknown slot \"${name}\"`, name)\n }\n if (target.hidden) {\n fail('mixins:hidden-slot', `Behavior targets hidden slot \"${name}\"`, name)\n }\n if (slotOptions?.requires !== undefined) {\n validateRequirements(name, target, slotOptions.requires)\n }\n const attributes = slotOptions?.attributes\n const mount = slotOptions?.mount\n if (attributes === undefined && mount === undefined) continue\n contributions[name] = context => ({\n ...(attributes === undefined\n ? {}\n : {\n attributes: attributes({\n input: context.input as Input,\n h: context.h,\n ...(context.item === undefined ? {} : { item: context.item }),\n }),\n }),\n ...(mount === undefined ? {} : { mounts: [mount(context.input as Input, context.item)] }),\n })\n }\n return Object.freeze({\n ...(options?.name === undefined ? {} : { name: options.name }),\n spec,\n mixin: Mixin.dynamic<Message>(options?.name ?? 'Behavior', contributions),\n })\n }\n\n/**\n * Attaches a Behavior to a view. The behavior's `Input` becomes the attached\n * view's `Input`: a behavior declared over only the fields it reads is rejected\n * even though those fields are a subset, and one declared over extra fields\n * widens what the view must be called with. Declare `Input` as the view's own\n * input type.\n */\nexport const attach =\n <BehaviorSlots, Message, Input>(behavior: NamedBehavior<BehaviorSlots, Input, Message>) =>\n <ViewSlots>(\n view: SlotView.SlotView<ViewSlots, Input, Message>,\n ): SlotView.SlotView<ViewSlots, Input, Message> =>\n SlotView.attach(behavior.mixin)(view)\n\nexport const Behavior = { slot, forSlots, attach } as const\n","/**\n * A collection is the parent's array, described once so a view and the\n * Behaviors on it agree about identity, order, and which items are disabled.\n * Render order is DOM order, so nothing observes the DOM; `of` is pure and the\n * Behavior only writes what the item context says.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport type { SlotItem } from '../contribution.js'\nimport { DiagnosticError } from '../diagnostics.js'\n\nexport interface Items<T> {\n readonly size: number\n /** In render order; unique. */\n readonly ids: ReadonlyArray<string>\n readonly at: (index: number) => T | undefined\n /** `-1` when no item has the id. */\n readonly indexOf: (id: string) => number\n readonly isDisabled: (index: number) => boolean\n /** Indices of the enabled items, in order. */\n readonly enabled: ReadonlyArray<number>\n /** The item context for `slots.x.attrs(base, item)`. */\n readonly slotItem: (index: number) => SlotItem\n}\n\nexport interface Describe<T> {\n readonly id: (item: T, index: number) => string\n readonly disabled?: (item: T, index: number) => boolean\n}\n\n/** Describes `items` once. Two items with one id are refused, since an id is what\n * `aria-activedescendant`, `aria-controls`, and a keyed row rely on. */\nexport const of = <T>(items: ReadonlyArray<T>, describe: Describe<T>): Items<T> => {\n const ids: Array<string> = []\n const indexById = new Map<string, number>()\n const disabled: Array<boolean> = []\n const enabled: Array<number> = []\n items.forEach((item, index) => {\n const id = describe.id(item, index)\n const seen = indexById.get(id)\n if (seen !== undefined) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:duplicate-item-id',\n severity: 'error',\n message: `Collection items ${seen} and ${index} share the id \"${id}\"`,\n details: { id, indices: [seen, index] },\n })\n }\n indexById.set(id, index)\n ids.push(id)\n const isDisabled = describe.disabled?.(item, index) ?? false\n disabled.push(isDisabled)\n if (!isDisabled) enabled.push(index)\n })\n const size = items.length\n return Object.freeze({\n size,\n ids: Object.freeze(ids),\n at: (index: number) => items[index],\n indexOf: (id: string) => indexById.get(id) ?? -1,\n isDisabled: (index: number) => disabled[index] ?? false,\n enabled: Object.freeze(enabled),\n slotItem: (index: number): SlotItem => ({\n index,\n id: ids[index] ?? String(index),\n count: size,\n }),\n })\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot rendered once per item. */\n readonly item: keyof Slots & string\n /** Reads the described items from the view's input. */\n readonly items: (input: Input) => Items<unknown>\n /** Write `aria-posinset` and `aria-setsize` on each item. Default `false`. */\n readonly posInSet?: boolean\n /** Write `id` on each item, from its described id. Default `true`. */\n readonly ids?: boolean\n}\n\n/**\n * Writes each item's identity and position: `id` from the described id,\n * `aria-disabled` for a disabled item, and `aria-posinset` and `aria-setsize`\n * on request. Reads the item context the view passes to `attrs`; with none it\n * contributes nothing, so a slot rendered once is left alone.\n */\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.item]: Behavior.slot({\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n const items = options.items(input)\n const id = item.id ?? items.ids[item.index]\n return [\n ...(options.ids === false || id === undefined ? [] : [h.Id(id)]),\n ...(items.isDisabled(item.index) ? [h.AriaDisabled(true)] : []),\n ...(options.posInSet === true\n ? [h.AriaPosinset(item.index + 1), h.AriaSetsize(item.count ?? items.size)]\n : []),\n ]\n },\n }),\n // The spec is keyed by a value (`options.item`), which the mapped\n // BehaviorSpec type cannot express; `forSlots` still checks the key.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'Collection' },\n )\n","/**\n * A trigger that shows and hides content: `aria-expanded` and `aria-controls`\n * on the trigger, an `id` and `hidden` on the content. The open flag is the\n * parent's; this only says it in ARIA. The floor is `<details>`, which needs\n * none of this.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport interface Options<Input, Slots> {\n readonly trigger: keyof Slots & string\n readonly content: keyof Slots & string\n readonly open: (input: Input) => boolean\n /** The content's id, which `aria-controls` names. */\n readonly id: (input: Input) => string\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(options: Options<Input, Slots>): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.trigger]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.AriaExpanded(options.open(input)), h.AriaControls(options.id(input))],\n }),\n [options.content]: Behavior.slot({\n requires: { capability: Capability.Container },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.Id(options.id(input)), h.Hidden(!options.open(input))],\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'Disclosure' },\n )\n","/**\n * Ties a control to its label, description, and error with ids derived from\n * one base id: `<id>`, `<id>-label`, `<id>-description`, `<id>-error`. The\n * control gets `aria-labelledby`, `aria-describedby` (description first,\n * then the error while one shows), `aria-invalid`, and `aria-required`. The\n * ids are derived, not minted, so a resumed page and a test agree on them.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport interface Options<Input, Slots> {\n readonly control: keyof Slots & string\n readonly label: keyof Slots & string\n readonly description?: keyof Slots & string\n readonly error?: keyof Slots & string\n readonly id: (input: Input) => string\n /** The error slot is rendered and describes the control. */\n readonly invalid?: (input: Input) => boolean\n readonly required?: (input: Input) => boolean\n}\n\n/** The ids one base id yields, for a view that renders these elements itself. */\nexport const ids = (id: string) => ({\n control: id,\n label: `${id}-label`,\n description: `${id}-description`,\n error: `${id}-error`,\n})\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(options: Options<Input, Slots>): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.control]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const names = ids(options.id(input))\n const invalid = options.invalid?.(input) === true\n const describedBy = [\n ...(options.description === undefined ? [] : [names.description]),\n ...(options.error !== undefined && invalid ? [names.error] : []),\n ]\n return [\n h.Id(names.control),\n h.AriaLabelledBy(names.label),\n ...(describedBy.length === 0 ? [] : [h.AriaDescribedBy(describedBy.join(' '))]),\n ...(invalid ? [h.AriaInvalid(true)] : []),\n ...(options.required?.(input) === true ? [h.AriaRequired(true)] : []),\n ]\n },\n }),\n [options.label]: Behavior.slot({\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const names = ids(options.id(input))\n return [h.Id(names.label), h.For(names.control)]\n },\n }),\n ...(options.description === undefined\n ? {}\n : {\n [options.description]: Behavior.slot({\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.Id(ids(options.id(input)).description)],\n }),\n }),\n ...(options.error === undefined\n ? {}\n : {\n [options.error]: Behavior.slot({\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.Id(ids(options.id(input)).error)],\n }),\n }),\n // Keyed by values the caller chose; `forSlots` checks the keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'FieldAssociation' },\n )\n","/**\n * A number stepped by keys: ArrowUp and ArrowDown by `step`, PageUp and\n * PageDown by `page`, Home and End to the bounds, each clamped, each\n * default-prevented. The value is the parent's; a key yields the Message the\n * caller builds from the next value. Writes the spinbutton role and its\n * `aria-value*`. The floor is `<input type=\"number\">`; a press-and-hold\n * repeat and a wheel are not handled, since Foldkit's wheel attribute carries\n * no delta and a repeat is a timer the Model would have to own.\n */\nimport { Option } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport interface Bounds {\n readonly min?: number\n readonly max?: number\n /** Default `1`. */\n readonly step?: number\n /** PageUp and PageDown move by this; default ten steps. */\n readonly page?: number\n}\n\nconst clamp = (value: number, bounds: Bounds): number =>\n Math.min(\n bounds.max ?? Number.POSITIVE_INFINITY,\n Math.max(bounds.min ?? Number.NEGATIVE_INFINITY, value),\n )\n\n/** The value the key moves to, or `undefined` when the key is not a spin key or a chord. */\nexport const spin = (\n value: number,\n key: string,\n modifiers: KeyboardModifiers,\n bounds: Bounds,\n): number | undefined => {\n if (modifiers.ctrlKey || modifiers.altKey || modifiers.metaKey) return undefined\n const step = bounds.step ?? 1\n const page = bounds.page ?? step * 10\n switch (key) {\n case 'ArrowUp':\n return clamp(value + step, bounds)\n case 'ArrowDown':\n return clamp(value - step, bounds)\n case 'PageUp':\n return clamp(value + page, bounds)\n case 'PageDown':\n return clamp(value - page, bounds)\n case 'Home':\n return bounds.min\n case 'End':\n return bounds.max\n default:\n return undefined\n }\n}\n\nexport interface Options<Input, Message, Slots> extends Bounds {\n readonly control: keyof Slots & string\n readonly value: (input: Input) => number\n readonly onChange: (next: number) => Message\n /** For `aria-valuetext`, when the number alone would not read well. */\n readonly text?: (input: Input) => string\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n options: Options<Input, Message, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.control]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const value = options.value(input)\n return [\n h.Role('spinbutton'),\n h.AriaValuenow(value),\n ...(options.min === undefined ? [] : [h.AriaValuemin(options.min)]),\n ...(options.max === undefined ? [] : [h.AriaValuemax(options.max)]),\n ...(options.text === undefined ? [] : [h.AriaValuetext(options.text(input))]),\n h.OnKeyDownPreventDefault((key, modifiers) => {\n const next = spin(value, key, modifiers, options)\n return next === undefined || next === value\n ? Option.none()\n : Option.some(options.onChange(next))\n }),\n ]\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'SpinValue' },\n )\n","/**\n * A two-state control's state in ARIA: `aria-checked` for a checkbox, switch,\n * radio or option, `aria-pressed` for a toggle button. The state is the\n * parent's. A native checkbox, radio or switch needs none of this; a radio\n * group's exclusivity is a selection, not a toggle.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport type State = boolean | 'mixed'\n\nexport interface Options<Input, Slots> {\n readonly control: keyof Slots & string\n readonly state: (input: Input) => State\n /** `'checked'` writes `aria-checked` (checkbox, switch, radio, option);\n * `'pressed'` writes `aria-pressed` (a toggle button). */\n readonly as: 'checked' | 'pressed'\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(options: Options<Input, Slots>): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.control]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const state = options.state(input)\n return options.as === 'checked'\n ? [h.AriaChecked(state)]\n : [h.AriaPressed(state === 'mixed' ? 'mixed' : state ? 'true' : 'false')]\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'ToggleState' },\n )\n","/**\n * Ready-made Behaviors that own no state: each is a function of the view's\n * input and item context to attributes. Stateful ones (a roving tab stop, a\n * press, a dismiss layer) live in `foldkit-primitives` as a Bundle plus its\n * Behavior, because they need a Model slice.\n */\nexport * as Collection from './collection.js'\nexport * as Disclosure from './disclosure.js'\nexport * as FieldAssociation from './field-association.js'\nexport * as SpinValue from './spin-value.js'\nexport * as ToggleState from './toggle-state.js'\n","/**\n * Slot event tokens. Ported from `effect-atom-jsx/src/View.ts` `Event`, plus\n * the extra names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type EventToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.event',\n Name\n>\n\nexport const is = (value: unknown): value is EventToken =>\n MetadataToken.is(value) && value.kind === 'view.event'\n\nexport const make = <const Name extends string>(name: Name): EventToken<Name> =>\n MetadataToken.make('view.event', name)\n\nexport const equals = (left: EventToken, right: EventToken): boolean => left.name === right.name\n\nexport const describe = (event: EventToken): { readonly name: string } => ({\n name: event.name,\n})\n\nexport const Press = make('press')\nexport const Click = make('click')\nexport const Cancel = make('cancel')\nexport const Input = make('input')\nexport const Change = make('change')\nexport const Focus = make('focus')\nexport const Blur = make('blur')\nexport const KeyDown = make('keydown')\nexport const PointerDown = make('pointerdown')\nexport const PointerUp = make('pointerup')\nexport const Hover = make('hover')\nexport const Submit = make('submit')\n","/**\n * Platform requirement tokens. Ported from `effect-atom-jsx/src/View.ts`\n * `Requirement`.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type RequirementToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.requirement',\n Name\n>\n\nexport const is = (value: unknown): value is RequirementToken =>\n MetadataToken.is(value) && value.kind === 'view.requirement'\n\nexport const make = <const Name extends string>(name: Name): RequirementToken<Name> =>\n MetadataToken.make('view.requirement', name)\n\nexport const describe = (requirement: RequirementToken): { readonly name: string } => ({\n name: requirement.name,\n})\n\nexport const Keyboard = make('keyboard')\nexport const Pointer = make('pointer')\nexport const Clipboard = make('clipboard')\n","/**\n * Typed builders for the selector strings `Style.pseudo` and `Style.nest`\n * take, relative to the generated class (`&`). They exist so a recipe does\n * not hand-type `&:not([aria-disabled=\"true\"])` in every entry.\n */\n\n/** `&[name]` or `&[name=\"value\"]`. */\nexport const attr = (name: string, value?: string): string =>\n value === undefined ? `[${name}]` : `[${name}=\"${value.replace(/[\"\\\\]/g, '\\\\$&')}\"]`\n\n/** `&:not(selector)`, for `Style.pseudo`. */\nexport const not = (selector: string): string => `:not(${selector})`\n\n/** `&:is(a, b)`, for `Style.pseudo`. */\nexport const is = (...selectors: ReadonlyArray<string>): string => `:is(${selectors.join(', ')})`\n\n/** A direct child, for `Style.nest`. */\nexport const child = (selector: string): string => `> ${selector}`\n\n/** Any descendant, for `Style.nest`. */\nexport const descendant = (selector: string): string => selector\n\n/** The next sibling, for `Style.nest`. */\nexport const sibling = (selector: string): string => `+ ${selector}`\n\n/** Any later sibling, for `Style.nest`. */\nexport const siblings = (selector: string): string => `~ ${selector}`\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,gBAA+B,OAAO,IAAI,4BAA4B;AAOnF,MAAa,WAA4C,SAA8B;CACrF,MAAM,eAAe,OAAO,OAAO,IAAI;CACvC,KAAK,MAAM,QAAQ,OAAO,oBAAoB,IAAI,GAAG;EACnD,MAAM,cAAc,KAAK;EACzB,IAAI,gBAAgB,KAAA,GAAW;EAC/B,OAAO,eAAe,cAAc,MAAM;GACxC,OAAO,OAAO,OAAO,EAAE,GAAG,YAAY,CAAC;GACvC,YAAY;GACZ,cAAc;GACd,UAAU;EACZ,CAAC;CACH;CACA,OAAO,OAAO,YAAY;CAC1B,OAAO,OAAO,OAAO;GAClB,gBAAgB,EAA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,SAAS,MAAM;AAE5F,MAAaC,cAAY,WAAkD,EACzE,MAAM,MAAM,KACd;AAEA,MAAa,QAAQF,OAAK,OAAO;AACjC,MAAa,QAAQA,OAAK,OAAO;AACjC,MAAa,SAASA,OAAK,QAAQ;AACnC,MAAa,QAAQA,OAAK,OAAO;AACjC,MAAa,SAASA,OAAK,QAAQ;AACnC,MAAa,QAAQA,OAAK,OAAO;AACjC,MAAa,OAAOA,OAAK,MAAM;AAC/B,MAAa,UAAUA,OAAK,SAAS;AACrC,MAAa,cAAcA,OAAK,aAAa;AAC7C,MAAa,YAAYA,OAAK,WAAW;AACzC,MAAa,QAAQA,OAAK,OAAO;AACjC,MAAa,SAASA,OAAK,QAAQ;;;;;;;;;;;;;;;ACvBnC,MAAaG,QAAM,UACjBC,KAAiB,KAAK,KAAK,MAAM,SAAS;AAE5C,MAAa,QAAmC,SAC9CC,OAAmB,oBAAoB,IAAI;AAE7C,MAAa,YAAY,iBAA8D,EACrF,MAAM,YAAY,KACpB;AAEA,MAAa,WAAW,KAAK,UAAU;AACvC,MAAa,UAAU,KAAK,SAAS;AACrC,MAAa,YAAY,KAAK,WAAW;;;;;;;;;;;;;;;;;;AChBzC,MAAa,QAAQ,MAAc,UACjC,UAAU,KAAA,IAAY,IAAI,KAAK,KAAK,IAAI,KAAK,IAAI,MAAM,QAAQ,UAAU,MAAM,EAAE;;AAGnF,MAAa,OAAO,aAA6B,QAAQ,SAAS;;AAGlE,MAAa,MAAM,GAAG,cAA6C,OAAO,UAAU,KAAK,IAAI,EAAE;;AAG/F,MAAa,SAAS,aAA6B,KAAK;;AAGxD,MAAa,cAAc,aAA6B;;AAGxD,MAAa,WAAW,aAA6B,KAAK;;AAG1D,MAAa,YAAY,aAA6B,KAAK"}
1
+ {"version":3,"file":"index.mjs","names":["MetadataToken.nameOf","Capability.extendsCapability","is","MetadataToken.is","make","MetadataToken.make","equals","describe","Capability.extendsCapability","MetadataToken.nameOf","Mixin.dynamic","SlotView.attach","behavior","Behavior.forSlots","Behavior.slot","behavior","Behavior.forSlots","Behavior.slot","Capability.Interactive","Capability.Container","behavior","Behavior.forSlots","Behavior.slot","Capability.Interactive","behavior","Behavior.forSlots","Behavior.slot","Capability.Focusable","Behavior.forSlots","Behavior.slot","Capability.Interactive","is","MetadataToken.is","make","MetadataToken.make","describe","is","MetadataToken.is","MetadataToken.make"],"sources":["../src/a11y.ts","../src/attr.ts","../src/attributes.ts","../src/behavior.ts","../src/behaviors/collection.ts","../src/behaviors/disclosure.ts","../src/behaviors/field-association.ts","../src/behaviors/spin-value.ts","../src/behaviors/toggle-state.ts","../src/behaviors/index.ts","../src/event.ts","../src/requirement.ts","../src/selector.ts"],"sourcesContent":["/**\n * Structural accessibility validation. A `Pattern` names the Slots a widget\n * must publish, the capabilities those Slots must satisfy, and the events and\n * attributes they must expose. `validate` compares a `Slots` contract against a\n * pattern and reports every mismatch as a `Diagnostic`. It is pure and\n * DOM-independent: it checks the declared contract, not a rendered tree, so it\n * verifies only the contract it is given and does not certify WCAG conformance.\n */\nimport * as Capability from './capability.js'\nimport type { Diagnostic } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport type { Any as AnySlot, AttributeName, EventName, SlotCapability } from './slot.js'\n\nexport type A11yDiagnosticCode =\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface A11yDiagnostic extends Diagnostic {\n readonly source: 'a11y'\n readonly code: A11yDiagnosticCode\n}\n\nexport interface SlotRequirement {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n /** An absent slot is expected, not a diagnostic. A present slot is still checked. */\n readonly optional?: boolean\n}\n\nexport type Requirements = Readonly<Record<string, SlotRequirement>>\n\nexport const PatternTypeId: unique symbol = Symbol.for('foldkit-mixins/A11yPattern')\n\nexport interface Pattern<Spec extends Requirements = Requirements> {\n readonly [PatternTypeId]: { readonly Requirements: Spec }\n readonly requirements: Spec\n}\n\nexport const pattern = <const Spec extends Requirements>(spec: Spec): Pattern<Spec> => {\n const requirements = Object.create(null) as Record<string, SlotRequirement>\n for (const name of Object.getOwnPropertyNames(spec)) {\n const requirement = spec[name]\n if (requirement === undefined) continue\n Object.defineProperty(requirements, name, {\n value: Object.freeze({ ...requirement }),\n enumerable: true,\n configurable: false,\n writable: false,\n })\n }\n Object.freeze(requirements)\n return Object.freeze({\n [PatternTypeId]: { Requirements: undefined as unknown as Spec },\n requirements: requirements as Spec,\n }) as Pattern<Spec>\n}\n\nconst publishes = (\n names: ReadonlyArray<string | MetadataToken.Any>,\n required: string | MetadataToken.Any,\n): boolean => {\n const requiredName = MetadataToken.nameOf(required)\n return names.some(name => MetadataToken.nameOf(name) === requiredName)\n}\n\nconst diagnostic = (\n code: A11yDiagnosticCode,\n message: string,\n slot: string,\n details?: Readonly<Record<string, unknown>>,\n): A11yDiagnostic => ({\n source: 'a11y',\n code,\n severity: 'error',\n message,\n slot,\n ...(details === undefined ? {} : { details }),\n})\n\nexport const validate = (\n pattern: Pattern,\n slots: { readonly [name: string]: AnySlot },\n): ReadonlyArray<A11yDiagnostic> => {\n const diagnostics: Array<A11yDiagnostic> = []\n for (const name of Object.getOwnPropertyNames(pattern.requirements)) {\n const requirement = pattern.requirements[name]\n if (requirement === undefined) continue\n if (!Object.hasOwn(slots, name)) {\n if (requirement.optional === true) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-slot',\n `A11y pattern requires slot \"${name}\", which the contract does not publish`,\n name,\n ),\n )\n continue\n }\n const slot = slots[name]\n if (slot === undefined) continue\n if (slot.hidden) {\n diagnostics.push(\n diagnostic(\n 'a11y:hidden-slot',\n `A11y pattern requires slot \"${name}\", which is hidden`,\n name,\n ),\n )\n continue\n }\n if (\n requirement.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirement.capability)\n ) {\n diagnostics.push(\n diagnostic(\n 'a11y:capability-mismatch',\n `A11y pattern requires capability \"${MetadataToken.nameOf(requirement.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n {\n required: MetadataToken.nameOf(requirement.capability),\n actual: MetadataToken.nameOf(slot.capability),\n },\n ),\n )\n }\n for (const event of requirement.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (publishes(slot.events, event)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-event',\n `A11y pattern requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n ),\n )\n }\n for (const attribute of requirement.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (publishes(slot.attributes, attribute)) continue\n diagnostics.push(\n diagnostic(\n 'a11y:missing-attribute',\n `A11y pattern requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n ),\n )\n }\n }\n return diagnostics\n}\n","/**\n * Slot attribute tokens. Ported from `effect-atom-jsx/src/View.ts` `Attribute`,\n * plus ARIA names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type AttrToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.attribute',\n Name\n>\n\nexport const is = (value: unknown): value is AttrToken =>\n MetadataToken.is(value) && value.kind === 'view.attribute'\n\nexport const make = <const Name extends string>(name: Name): AttrToken<Name> =>\n MetadataToken.make('view.attribute', name)\n\nexport const equals = (left: AttrToken, right: AttrToken): boolean => left.name === right.name\n\nexport const describe = (attr: AttrToken): { readonly name: string } => ({\n name: attr.name,\n})\n\nexport const Role = make('role')\nexport const AriaLabel = make('aria-label')\nexport const AriaDescribedby = make('aria-describedby')\nexport const AriaExpanded = make('aria-expanded')\nexport const AriaSelected = make('aria-selected')\nexport const AriaInvalid = make('aria-invalid')\nexport const AriaPressed = make('aria-pressed')\nexport const AriaDisabled = make('aria-disabled')\nexport const Disabled = make('disabled')\nexport const Value = make('value')\n","/**\n * Typed reads over a resolved `SlotAttributes` bundle. Foldkit's tagged\n * attribute union narrows on `_tag`, so a lookup by tag returns that variant's\n * own fields (`value`, `message`, `key`, `action`) without a cast.\n */\nimport type { Attribute } from 'foldkit/html'\nimport { isTagged } from './attribute.js'\nimport type { SlotAttributes } from './resolver.js'\n\n/** Every Foldkit attribute tag: `'Class'`, `'OnClick'`, `'DataAttribute'`, … */\nexport type Tag = Attribute<never>['_tag']\n\n/** The attribute variant carrying `T`. */\nexport type Of<Message, T extends Tag> = Extract<Attribute<Message>, { readonly _tag: T }>\n\n/** The tag of one bundle entry; `undefined` for an opaque `ChildAttribute`. */\nexport const tagOf = <Message>(attribute: SlotAttributes<Message>[number]): Tag | undefined =>\n isTagged(attribute) ? attribute._tag : undefined\n\nconst hasTag =\n <Message, T extends Tag>(tag: T) =>\n (attribute: SlotAttributes<Message>[number]): attribute is Of<Message, T> =>\n tagOf(attribute) === tag\n\n/** The first attribute with `tag`, typed as that variant. */\nexport const find = <Message, T extends Tag>(\n attributes: SlotAttributes<Message>,\n tag: T,\n): Of<Message, T> | undefined => attributes.find(hasTag<Message, T>(tag))\n\n/** Every attribute with `tag`, in bundle order. */\nexport const filter = <Message, T extends Tag>(\n attributes: SlotAttributes<Message>,\n tag: T,\n): ReadonlyArray<Of<Message, T>> => attributes.filter(hasTag<Message, T>(tag))\n","/**\n * `Behavior` is a named set of interaction contributions attached to declared\n * Slots. It owns no state: attributes are built from the view's `input` and `h`\n * while resolving, so the Message universe is the view's. A stateful widget is\n * a Foldkit Submodel; a continuous element listener is a Mount; a network call\n * is Message -> update -> Command.\n */\nimport type { Attribute, ChildAttribute, HtmlBuilder } from 'foldkit/html'\nimport type { MountAction } from 'foldkit/mount'\nimport * as Capability from './capability.js'\nimport type { SlotContribution, SlotItem } from './contribution.js'\nimport { DiagnosticError, type DiagnosticCode } from './diagnostics.js'\nimport * as MetadataToken from './metadataToken.js'\nimport * as Mixin from './mixin.js'\nimport type { Mixin as MixinValue } from './mixin.js'\nimport type { Any as AnySlot, AttributeName, EventName, HiddenOf, SlotCapability } from './slot.js'\nimport * as SlotView from './slotView.js'\n\nexport interface SlotRequirements {\n readonly capability?: SlotCapability\n readonly events?: ReadonlyArray<EventName>\n readonly attributes?: ReadonlyArray<AttributeName>\n}\n\nexport interface BehaviorSlotOptions<Input, Message> {\n readonly requires?: SlotRequirements\n /**\n * Attributes for one resolution of the slot. `item` is present when the view\n * passed one to `slots.x.attrs(base, item)`, that is, when the slot is\n * rendered once per item.\n */\n readonly attributes?: (context: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n readonly item?: SlotItem\n }) => ReadonlyArray<Attribute<Message> | ChildAttribute>\n readonly mount?: (input: Input, item?: SlotItem) => MountAction<Message, any>\n}\n\nexport type BehaviorSpec<Slots, Input, Message> = {\n readonly [K in keyof Slots as HiddenOf<Slots[K]> extends true ? never : K]?: BehaviorSlotOptions<\n Input,\n Message\n >\n}\n\nexport interface NamedBehavior<Slots, Input, Message> {\n readonly name?: string\n readonly spec: BehaviorSpec<Slots, Input, Message>\n readonly mixin: MixinValue<Message>\n}\n\n/** Identity helper; `forSlots` supplies the contextual `Input`/`Message`. */\nexport const slot = <Options extends BehaviorSlotOptions<any, any>>(options: Options): Options =>\n options\n\nfunction fail(\n code: DiagnosticCode,\n message: string,\n slotName: string,\n details?: Readonly<Record<string, unknown>>,\n): never {\n throw new DiagnosticError({\n source: 'mixins',\n code,\n severity: 'error',\n message,\n slot: slotName,\n ...(details === undefined ? {} : { details }),\n })\n}\n\nconst validateRequirements = (\n name: string,\n slot: AnySlot,\n requirements: SlotRequirements,\n): void => {\n if (\n requirements.capability !== undefined &&\n !Capability.extendsCapability(slot.capability, requirements.capability)\n ) {\n fail(\n 'mixins:capability-mismatch',\n `Behavior requires capability \"${MetadataToken.nameOf(requirements.capability)}\" on slot \"${name}\", which has \"${MetadataToken.nameOf(slot.capability)}\"`,\n name,\n { required: MetadataToken.nameOf(requirements.capability) },\n )\n }\n for (const event of requirements.events ?? []) {\n const eventName = MetadataToken.nameOf(event)\n if (!slot.events.some(allowed => MetadataToken.nameOf(allowed) === eventName)) {\n fail(\n 'mixins:unsupported-event',\n `Behavior requires event \"${eventName}\" on slot \"${name}\", which does not publish it`,\n name,\n { event: eventName },\n )\n }\n }\n for (const attribute of requirements.attributes ?? []) {\n const attributeName = MetadataToken.nameOf(attribute)\n if (!slot.attributes.some(allowed => MetadataToken.nameOf(allowed) === attributeName)) {\n fail(\n 'mixins:unsupported-attribute',\n `Behavior requires attribute \"${attributeName}\" on slot \"${name}\", which does not publish it`,\n name,\n { attribute: attributeName },\n )\n }\n }\n}\n\nexport const forSlots =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n spec: BehaviorSpec<Slots, Input, Message>,\n options?: { readonly name?: string },\n ): NamedBehavior<Slots, Input, Message> => {\n const source = slots as unknown as Record<string, AnySlot>\n const contributions: Record<string, SlotContribution<Message>> = Object.create(null)\n for (const [name, slotOptions] of Object.entries(\n spec as Record<string, BehaviorSlotOptions<Input, Message> | undefined>,\n )) {\n const target = source[name]\n if (target === undefined) {\n fail('mixins:unknown-slot', `Behavior targets unknown slot \"${name}\"`, name)\n }\n if (target.hidden) {\n fail('mixins:hidden-slot', `Behavior targets hidden slot \"${name}\"`, name)\n }\n if (slotOptions?.requires !== undefined) {\n validateRequirements(name, target, slotOptions.requires)\n }\n const attributes = slotOptions?.attributes\n const mount = slotOptions?.mount\n if (attributes === undefined && mount === undefined) continue\n contributions[name] = context => ({\n ...(attributes === undefined\n ? {}\n : {\n attributes: attributes({\n input: context.input as Input,\n h: context.h,\n ...(context.item === undefined ? {} : { item: context.item }),\n }),\n }),\n ...(mount === undefined ? {} : { mounts: [mount(context.input as Input, context.item)] }),\n })\n }\n return Object.freeze({\n ...(options?.name === undefined ? {} : { name: options.name }),\n spec,\n mixin: Mixin.dynamic<Message>(options?.name ?? 'Behavior', contributions),\n })\n }\n\n/**\n * Attaches a Behavior to a view. The behavior's `Input` becomes the attached\n * view's `Input`: a behavior declared over only the fields it reads is rejected\n * even though those fields are a subset, and one declared over extra fields\n * widens what the view must be called with. Declare `Input` as the view's own\n * input type.\n */\nexport const attach =\n <BehaviorSlots, Message, Input>(behavior: NamedBehavior<BehaviorSlots, Input, Message>) =>\n <ViewSlots>(\n view: SlotView.SlotView<ViewSlots, Input, Message>,\n ): SlotView.SlotView<ViewSlots, Input, Message> =>\n SlotView.attach(behavior.mixin)(view)\n\nexport const Behavior = { slot, forSlots, attach } as const\n","/**\n * A collection is the parent's array, described once so a view and the\n * Behaviors on it agree about identity, order, and which items are disabled.\n * Render order is DOM order, so nothing observes the DOM; `of` is pure and the\n * Behavior only writes what the item context says.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport type { SlotItem } from '../contribution.js'\nimport { DiagnosticError } from '../diagnostics.js'\n\nexport interface Items<T> {\n readonly size: number\n /** In render order; unique. */\n readonly ids: ReadonlyArray<string>\n readonly at: (index: number) => T | undefined\n /** `-1` when no item has the id. */\n readonly indexOf: (id: string) => number\n readonly isDisabled: (index: number) => boolean\n /** Indices of the enabled items, in order. */\n readonly enabled: ReadonlyArray<number>\n /** The item context for `slots.x.attrs(base, item)`. */\n readonly slotItem: (index: number) => SlotItem\n}\n\nexport interface Describe<T> {\n readonly id: (item: T, index: number) => string\n readonly disabled?: (item: T, index: number) => boolean\n}\n\n/** Describes `items` once. Two items with one id are refused, since an id is what\n * `aria-activedescendant`, `aria-controls`, and a keyed row rely on. */\nexport const of = <T>(items: ReadonlyArray<T>, describe: Describe<T>): Items<T> => {\n const ids: Array<string> = []\n const indexById = new Map<string, number>()\n const disabled: Array<boolean> = []\n const enabled: Array<number> = []\n items.forEach((item, index) => {\n const id = describe.id(item, index)\n const seen = indexById.get(id)\n if (seen !== undefined) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:duplicate-item-id',\n severity: 'error',\n message: `Collection items ${seen} and ${index} share the id \"${id}\"`,\n details: { id, indices: [seen, index] },\n })\n }\n indexById.set(id, index)\n ids.push(id)\n const isDisabled = describe.disabled?.(item, index) ?? false\n disabled.push(isDisabled)\n if (!isDisabled) enabled.push(index)\n })\n const size = items.length\n return Object.freeze({\n size,\n ids: Object.freeze(ids),\n at: (index: number) => items[index],\n indexOf: (id: string) => indexById.get(id) ?? -1,\n isDisabled: (index: number) => disabled[index] ?? false,\n enabled: Object.freeze(enabled),\n slotItem: (index: number): SlotItem => ({\n index,\n id: ids[index] ?? String(index),\n count: size,\n }),\n })\n}\n\nexport interface BehaviorOptions<Input, Slots> {\n /** The slot rendered once per item. */\n readonly item: keyof Slots & string\n /** Reads the described items from the view's input. */\n readonly items: (input: Input) => Items<unknown>\n /** Write `aria-posinset` and `aria-setsize` on each item. Default `false`. */\n readonly posInSet?: boolean\n /** Write `id` on each item, from its described id. Default `true`. */\n readonly ids?: boolean\n}\n\n/**\n * Writes each item's identity and position: `id` from the described id,\n * `aria-disabled` for a disabled item, and `aria-posinset` and `aria-setsize`\n * on request. Reads the item context the view passes to `attrs`; with none it\n * contributes nothing, so a slot rendered once is left alone.\n */\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n options: BehaviorOptions<Input, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.item]: Behavior.slot({\n attributes: ({\n input,\n h,\n item,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n readonly item?: SlotItem\n }) => {\n if (item === undefined) return []\n const items = options.items(input)\n const id = item.id ?? items.ids[item.index]\n return [\n ...(options.ids === false || id === undefined ? [] : [h.Id(id)]),\n ...(items.isDisabled(item.index) ? [h.AriaDisabled(true)] : []),\n ...(options.posInSet === true\n ? [h.AriaPosinset(item.index + 1), h.AriaSetsize(item.count ?? items.size)]\n : []),\n ]\n },\n }),\n // The spec is keyed by a value (`options.item`), which the mapped\n // BehaviorSpec type cannot express; `forSlots` still checks the key.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'Collection' },\n )\n","/**\n * A trigger that shows and hides content: `aria-expanded` and `aria-controls`\n * on the trigger, an `id` and `hidden` on the content. The open flag is the\n * parent's; this only says it in ARIA. The floor is `<details>`, which needs\n * none of this.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport interface Options<Input, Slots> {\n readonly trigger: keyof Slots & string\n readonly content: keyof Slots & string\n readonly open: (input: Input) => boolean\n /** The content's id, which `aria-controls` names. */\n readonly id: (input: Input) => string\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(options: Options<Input, Slots>): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.trigger]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.AriaExpanded(options.open(input)), h.AriaControls(options.id(input))],\n }),\n [options.content]: Behavior.slot({\n requires: { capability: Capability.Container },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.Id(options.id(input)), h.Hidden(!options.open(input))],\n }),\n // Keyed by values the caller chose; `forSlots` checks both keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'Disclosure' },\n )\n","/**\n * Ties a control to its label, description, and error with ids derived from\n * one base id: `<id>`, `<id>-label`, `<id>-description`, `<id>-error`. The\n * control gets `aria-labelledby`, `aria-describedby` (description first,\n * then the error while one shows), `aria-invalid`, and `aria-required`. The\n * ids are derived, not minted, so a resumed page and a test agree on them.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport interface Options<Input, Slots> {\n readonly control: keyof Slots & string\n readonly label: keyof Slots & string\n readonly description?: keyof Slots & string\n readonly error?: keyof Slots & string\n readonly id: (input: Input) => string\n /** The error slot is rendered and describes the control. */\n readonly invalid?: (input: Input) => boolean\n readonly required?: (input: Input) => boolean\n}\n\n/** The ids one base id yields, for a view that renders these elements itself. */\nexport const ids = (id: string) => ({\n control: id,\n label: `${id}-label`,\n description: `${id}-description`,\n error: `${id}-error`,\n})\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(options: Options<Input, Slots>): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.control]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const names = ids(options.id(input))\n const invalid = options.invalid?.(input) === true\n const describedBy = [\n ...(options.description === undefined ? [] : [names.description]),\n ...(options.error !== undefined && invalid ? [names.error] : []),\n ]\n return [\n h.Id(names.control),\n h.AriaLabelledBy(names.label),\n ...(describedBy.length === 0 ? [] : [h.AriaDescribedBy(describedBy.join(' '))]),\n ...(invalid ? [h.AriaInvalid(true)] : []),\n ...(options.required?.(input) === true ? [h.AriaRequired(true)] : []),\n ]\n },\n }),\n [options.label]: Behavior.slot({\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const names = ids(options.id(input))\n return [h.Id(names.label), h.For(names.control)]\n },\n }),\n ...(options.description === undefined\n ? {}\n : {\n [options.description]: Behavior.slot({\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.Id(ids(options.id(input)).description)],\n }),\n }),\n ...(options.error === undefined\n ? {}\n : {\n [options.error]: Behavior.slot({\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => [h.Id(ids(options.id(input)).error)],\n }),\n }),\n // Keyed by values the caller chose; `forSlots` checks the keys exist.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'FieldAssociation' },\n )\n","/**\n * A number stepped by keys: ArrowUp and ArrowDown by `step`, PageUp and\n * PageDown by `page`, Home and End to the bounds, each clamped, each\n * default-prevented. The value is the parent's; a key yields the Message the\n * caller builds from the next value. Writes the spinbutton role and its\n * `aria-value*`. The floor is `<input type=\"number\">`; a press-and-hold\n * repeat and a wheel are not handled, since Foldkit's wheel attribute carries\n * no delta and a repeat is a timer the Model would have to own.\n */\nimport { Option } from 'effect'\nimport type { HtmlBuilder, KeyboardModifiers } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport interface Bounds {\n readonly min?: number\n readonly max?: number\n /** Default `1`. */\n readonly step?: number\n /** PageUp and PageDown move by this; default ten steps. */\n readonly page?: number\n}\n\nconst clamp = (value: number, bounds: Bounds): number =>\n Math.min(\n bounds.max ?? Number.POSITIVE_INFINITY,\n Math.max(bounds.min ?? Number.NEGATIVE_INFINITY, value),\n )\n\n/** The value the key moves to, or `undefined` when the key is not a spin key or a chord. */\nexport const spin = (\n value: number,\n key: string,\n modifiers: KeyboardModifiers,\n bounds: Bounds,\n): number | undefined => {\n if (modifiers.ctrlKey || modifiers.altKey || modifiers.metaKey) return undefined\n const step = bounds.step ?? 1\n const page = bounds.page ?? step * 10\n switch (key) {\n case 'ArrowUp':\n return clamp(value + step, bounds)\n case 'ArrowDown':\n return clamp(value - step, bounds)\n case 'PageUp':\n return clamp(value + page, bounds)\n case 'PageDown':\n return clamp(value - page, bounds)\n case 'Home':\n return bounds.min\n case 'End':\n return bounds.max\n default:\n return undefined\n }\n}\n\nexport interface Options<Input, Message, Slots> extends Bounds {\n readonly control: keyof Slots & string\n readonly value: (input: Input) => number\n readonly onChange: (next: number) => Message\n /** For `aria-valuetext`, when the number alone would not read well. */\n readonly text?: (input: Input) => string\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(\n options: Options<Input, Message, Slots>,\n ): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.control]: Behavior.slot({\n requires: { capability: Capability.Focusable },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const value = options.value(input)\n return [\n h.Role('spinbutton'),\n h.AriaValuenow(value),\n ...(options.min === undefined ? [] : [h.AriaValuemin(options.min)]),\n ...(options.max === undefined ? [] : [h.AriaValuemax(options.max)]),\n ...(options.text === undefined ? [] : [h.AriaValuetext(options.text(input))]),\n h.OnKeyDownPreventDefault((key, modifiers) => {\n const next = spin(value, key, modifiers, options)\n return next === undefined || next === value\n ? Option.none()\n : Option.some(options.onChange(next))\n }),\n ]\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'SpinValue' },\n )\n","/**\n * A two-state control's state in ARIA: `aria-checked` for a checkbox, switch,\n * radio or option, `aria-pressed` for a toggle button. The state is the\n * parent's. A native checkbox, radio or switch needs none of this; a radio\n * group's exclusivity is a selection, not a toggle.\n */\nimport type { HtmlBuilder } from 'foldkit/html'\nimport * as Behavior from '../behavior.js'\nimport * as Capability from '../capability.js'\n\nexport type State = boolean | 'mixed'\n\nexport interface Options<Input, Slots> {\n readonly control: keyof Slots & string\n readonly state: (input: Input) => State\n /** `'checked'` writes `aria-checked` (checkbox, switch, radio, option);\n * `'pressed'` writes `aria-pressed` (a toggle button). */\n readonly as: 'checked' | 'pressed'\n}\n\nexport const behavior =\n <Slots>(slots: Slots) =>\n <Input, Message>(options: Options<Input, Slots>): Behavior.NamedBehavior<Slots, Input, Message> =>\n Behavior.forSlots(slots)<Input, Message>(\n {\n [options.control]: Behavior.slot({\n requires: { capability: Capability.Interactive },\n attributes: ({\n input,\n h,\n }: {\n readonly input: Input\n readonly h: HtmlBuilder<Message>\n }) => {\n const state = options.state(input)\n return options.as === 'checked'\n ? [h.AriaChecked(state)]\n : [h.AriaPressed(state === 'mixed' ? 'mixed' : state ? 'true' : 'false')]\n },\n }),\n // Keyed by a value the caller chose; `forSlots` checks the key exists.\n } as unknown as Behavior.BehaviorSpec<Slots, Input, Message>,\n { name: 'ToggleState' },\n )\n","/**\n * Ready-made Behaviors that own no state: each is a function of the view's\n * input and item context to attributes. Stateful ones (a roving tab stop, a\n * press, a dismiss layer) live in `foldkit-primitives` as a Bundle plus its\n * Behavior, because they need a Model slice.\n */\nexport * as Collection from './collection.js'\nexport * as Disclosure from './disclosure.js'\nexport * as FieldAssociation from './field-association.js'\nexport * as SpinValue from './spin-value.js'\nexport * as ToggleState from './toggle-state.js'\n","/**\n * Slot event tokens. Ported from `effect-atom-jsx/src/View.ts` `Event`, plus\n * the extra names the Foldkit plan lists.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type EventToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.event',\n Name\n>\n\nexport const is = (value: unknown): value is EventToken =>\n MetadataToken.is(value) && value.kind === 'view.event'\n\nexport const make = <const Name extends string>(name: Name): EventToken<Name> =>\n MetadataToken.make('view.event', name)\n\nexport const equals = (left: EventToken, right: EventToken): boolean => left.name === right.name\n\nexport const describe = (event: EventToken): { readonly name: string } => ({\n name: event.name,\n})\n\nexport const Press = make('press')\nexport const Click = make('click')\nexport const Cancel = make('cancel')\nexport const Input = make('input')\nexport const Change = make('change')\nexport const Focus = make('focus')\nexport const Blur = make('blur')\nexport const KeyDown = make('keydown')\nexport const PointerDown = make('pointerdown')\nexport const PointerUp = make('pointerup')\nexport const Hover = make('hover')\nexport const Submit = make('submit')\n","/**\n * Platform requirement tokens. Ported from `effect-atom-jsx/src/View.ts`\n * `Requirement`.\n */\nimport * as MetadataToken from './metadataToken.js'\n\nexport type RequirementToken<Name extends string = string> = MetadataToken.MetadataToken<\n 'view.requirement',\n Name\n>\n\nexport const is = (value: unknown): value is RequirementToken =>\n MetadataToken.is(value) && value.kind === 'view.requirement'\n\nexport const make = <const Name extends string>(name: Name): RequirementToken<Name> =>\n MetadataToken.make('view.requirement', name)\n\nexport const describe = (requirement: RequirementToken): { readonly name: string } => ({\n name: requirement.name,\n})\n\nexport const Keyboard = make('keyboard')\nexport const Pointer = make('pointer')\nexport const Clipboard = make('clipboard')\n","/**\n * Typed builders for the selector strings `Style.pseudo` and `Style.nest`\n * take, relative to the generated class (`&`). They exist so a recipe does\n * not hand-type `&:not([aria-disabled=\"true\"])` in every entry.\n */\n\n/** `&[name]` or `&[name=\"value\"]`. */\nexport const attr = (name: string, value?: string): string =>\n value === undefined ? `[${name}]` : `[${name}=\"${value.replace(/[\"\\\\]/g, '\\\\$&')}\"]`\n\n/** `&:not(selector)`, for `Style.pseudo`. */\nexport const not = (selector: string): string => `:not(${selector})`\n\n/** `&:is(a, b)`, for `Style.pseudo`. */\nexport const is = (...selectors: ReadonlyArray<string>): string => `:is(${selectors.join(', ')})`\n\n/** A direct child, for `Style.nest`. */\nexport const child = (selector: string): string => `> ${selector}`\n\n/** Any descendant, for `Style.nest`. */\nexport const descendant = (selector: string): string => selector\n\n/** The next sibling, for `Style.nest`. */\nexport const sibling = (selector: string): string => `+ ${selector}`\n\n/** Any later sibling, for `Style.nest`. */\nexport const siblings = (selector: string): string => `~ ${selector}`\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,gBAA+B,OAAO,IAAI,4BAA4B;AAOnF,MAAa,WAA4C,SAA8B;CACrF,MAAM,eAAe,OAAO,OAAO,IAAI;CACvC,KAAK,MAAM,QAAQ,OAAO,oBAAoB,IAAI,GAAG;EACnD,MAAM,cAAc,KAAK;EACzB,IAAI,gBAAgB,KAAA,GAAW;EAC/B,OAAO,eAAe,cAAc,MAAM;GACxC,OAAO,OAAO,OAAO,EAAE,GAAG,YAAY,CAAC;GACvC,YAAY;GACZ,cAAc;GACd,UAAU;EACZ,CAAC;CACH;CACA,OAAO,OAAO,YAAY;CAC1B,OAAO,OAAO,OAAO;GAClB,gBAAgB,EAAE,cAAc,KAAA,EAA6B;EAChD;CAChB,CAAC;AACH;AAEA,MAAM,aACJ,OACA,aACY;CACZ,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