foldkit-mixins 0.7.0 → 0.9.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.
- package/README.md +18 -5
- package/dist/app.d.mts +1 -1
- package/dist/app.mjs +6 -6
- package/dist/{core-Bxj0UQDF.mjs → core-IMVYU8JN.mjs} +2 -2
- package/dist/{core-Bxj0UQDF.mjs.map → core-IMVYU8JN.mjs.map} +1 -1
- package/dist/defaults.d.mts.map +1 -1
- package/dist/defaults.mjs +5 -3
- package/dist/defaults.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/{layers-B31M0tDi.mjs → layers-keV38soP.mjs} +2 -2
- package/dist/{layers-B31M0tDi.mjs.map → layers-keV38soP.mjs.map} +1 -1
- package/dist/layers.mjs +1 -1
- package/dist/layout.mjs +1 -1
- package/dist/{oklch-FOemcYSv.d.mts → oklch-CLKxbFpD.d.mts} +16 -5
- package/dist/{oklch-FOemcYSv.d.mts.map → oklch-CLKxbFpD.d.mts.map} +1 -1
- package/dist/prose.mjs +1 -1
- package/dist/{root-C1u12YMD.mjs → root-BBi88KYx.mjs} +3 -3
- package/dist/{root-C1u12YMD.mjs.map → root-BBi88KYx.mjs.map} +1 -1
- package/dist/{slotMark-Rdsjb7XI.mjs → slotMark-DK75y0GJ.mjs} +2 -2
- package/dist/{slotMark-Rdsjb7XI.mjs.map → slotMark-DK75y0GJ.mjs.map} +1 -1
- package/dist/{style-CKjLee4e.mjs → style-CmHD4Ul3.mjs} +4 -4
- package/dist/{style-CKjLee4e.mjs.map → style-CmHD4Ul3.mjs.map} +1 -1
- package/dist/styleValue-BavTe9MZ.d.mts.map +1 -1
- package/dist/{styleValue-_G9jwb17.mjs → styleValue-Cj4YjgVB.mjs} +60 -2
- package/dist/styleValue-Cj4YjgVB.mjs.map +1 -0
- package/dist/testing.mjs +1 -1
- package/dist/theme.d.mts +20 -6
- package/dist/theme.d.mts.map +1 -1
- package/dist/theme.mjs +30 -29
- package/dist/theme.mjs.map +1 -1
- package/dist/{tokens-O8S8QH_R.mjs → tokens-B3i8bXZp.mjs} +23 -13
- package/dist/tokens-B3i8bXZp.mjs.map +1 -0
- package/dist/{tokens-XZSP0AvO.d.mts → tokens-BaLmrfbp.d.mts} +4 -1
- package/dist/tokens-BaLmrfbp.d.mts.map +1 -0
- package/dist/utilities.d.mts +4 -2
- package/dist/utilities.mjs +15 -3
- package/dist/utilities.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/styleValue-_G9jwb17.mjs.map +0 -1
- package/dist/tokens-O8S8QH_R.mjs.map +0 -1
- package/dist/tokens-XZSP0AvO.d.mts.map +0 -1
package/dist/utilities.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.mjs","names":[],"sources":["../src/utilities.ts"],"sourcesContent":["/**\n * `foldkit-mixins/utilities`: one-idea pieces over the shipped scales, so\n * `Utilities.p('md')` is `padding: var(--fk-space-md)`. A step is a token name\n * of `Theme.tokens` (and a color a token name of `Theme.oklch`), so a step the\n * scale lacks is a type error and the value still follows the `density` knob\n * and a theme's overrides: the theme stays the one source of truth for sizes.\n *\n * Each is a rule on the element (`Style.self`), unlayered like the other\n * subpaths' pieces, so it takes the layer of the style it is composed into and\n * a plain declaration beside it wins per property. Compose them like any piece:\n * `[U.flex, U.gap('sm'), { color: t.text.muted }]`.\n */\nimport { self, type StyleValue } from './styleValue.js'\nimport { ref, VAR_PREFIX } from './theme/core.js'\nimport type { OklchTheme } from './theme/oklch.js'\nimport { tokens, type Tokens } from './theme/tokens.js'\n\nconst t = ref(tokens)\n\n/** A space step, or none. */\nexport type Space = (keyof Tokens['space'] & string) | '0'\n/** A margin step: a space step, or `auto`. */\nexport type Margin = Space | 'auto'\n\ntype Palette = Omit<OklchTheme, 'knob' | 'hue'>\n/** A `Theme.oklch` color as `group.name`: `'surface.base'`, `'text.muted'`, `'accent.on-fill'`. */\nexport type ColorName = {\n readonly [G in keyof Palette & string]: `${G}.${keyof Palette[G] & string}`\n}[keyof Palette & string]\n\nconst space = (step: Margin): string => (step === '0' || step === 'auto' ? step : t.space[step])\n\nconst colorRef = (name: ColorName): string => `var(${VAR_PREFIX}-${name.replace('.', '-')})`\n\nconst alignments = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n baseline: 'baseline',\n} as const\n\nconst justifications = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n between: 'space-between',\n around: 'space-around',\n evenly: 'space-evenly',\n} as const\n\nexport const Utilities = {\n /** `padding` on every side. */\n p: (step: Space): StyleValue => self({ padding: space(step) }),\n /** `padding-inline`. */\n px: (step: Space): StyleValue => self({ paddingInline: space(step) }),\n /** `padding-block`. */\n py: (step: Space): StyleValue => self({ paddingBlock: space(step) }),\n /** `margin` on every side. */\n m: (step: Margin): StyleValue => self({ margin: space(step) }),\n /** `margin-inline`; `mx('auto')` centers a block. */\n mx: (step: Margin): StyleValue => self({ marginInline: space(step) }),\n /** `margin-block`. */\n my: (step: Margin): StyleValue => self({ marginBlock: space(step) }),\n /** `gap` between flex or grid children. */\n gap: (step: Space): StyleValue => self({ gap: space(step) }),\n /** `font-size` from the size scale. */\n text: (size: keyof Tokens['size'] & string): StyleValue => self({ fontSize: t.size[size] }),\n /** `font-weight` from the weight scale. */\n font: (weight: keyof Tokens['weight'] & string): StyleValue =>\n self({ fontWeight: t.weight[weight] }),\n /** `line-height` from the leading scale. */\n leading: (name: keyof Tokens['leading'] & string): StyleValue =>\n self({ lineHeight: t.leading[name] }),\n /** `border-radius` from the radius scale. */\n rounded: (radius: keyof Tokens['radius'] & string): StyleValue =>\n self({ borderRadius: t.radius[radius] }),\n /** Text `color` from the palette. */\n color: (name: ColorName): StyleValue => self({ color: colorRef(name) }),\n /** `background` from the palette. */\n bg: (name: ColorName): StyleValue => self({ background: colorRef(name) }),\n /** `align-items` of a flex or grid container. */\n items: (align: keyof typeof alignments): StyleValue => self({ alignItems: alignments[align] }),\n /** `justify-content` of a flex or grid container. */\n justify: (justify: keyof typeof justifications): StyleValue =>\n self({ justifyContent: justifications[justify] }),\n flex: self({ display: 'flex' }),\n /** A flex column. */\n column: self({ display: 'flex', flexDirection: 'column' }),\n grid: self({ display: 'grid' }),\n block: self({ display: 'block' }),\n hidden: self({ display: 'none' }),\n wFull: self({ width: '100%' }),\n textCenter: self({ textAlign: 'center' }),\n uppercase: self({ textTransform: 'uppercase' }),\n /** One line, cut with an ellipsis. */\n truncate: self({ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }),\n pointer: self({ cursor: 'pointer' }),\n selectNone: self({ userSelect: 'none' }),\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,IAAI,IAAI,MAAM;AAapB,MAAM,SAAS,SAA0B,SAAS,OAAO,SAAS,SAAS,OAAO,EAAE,MAAM;AAE1F,MAAM,YAAY,SAA4B,OAAO,WAAW,GAAG,KAAK,QAAQ,KAAK,GAAG,EAAE;AAE1F,MAAM,aAAa;CACjB,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,UAAU;AACZ;AAEA,MAAM,iBAAiB;CACrB,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,QAAQ;CACR,QAAQ;AACV;AAEA,MAAa,YAAY;;CAEvB,IAAI,SAA4B,KAAK,EAAE,SAAS,MAAM,IAAI,EAAE,CAAC;;CAE7D,KAAK,SAA4B,KAAK,EAAE,eAAe,MAAM,IAAI,EAAE,CAAC;;CAEpE,KAAK,SAA4B,KAAK,EAAE,cAAc,MAAM,IAAI,EAAE,CAAC;;CAEnE,IAAI,SAA6B,KAAK,EAAE,QAAQ,MAAM,IAAI,EAAE,CAAC;;CAE7D,KAAK,SAA6B,KAAK,EAAE,cAAc,MAAM,IAAI,EAAE,CAAC;;CAEpE,KAAK,SAA6B,KAAK,EAAE,aAAa,MAAM,IAAI,EAAE,CAAC;;CAEnE,MAAM,SAA4B,KAAK,EAAE,KAAK,MAAM,IAAI,EAAE,CAAC;;CAE3D,OAAO,SAAoD,KAAK,EAAE,UAAU,EAAE,KAAK,MAAM,CAAC;;CAE1F,OAAO,WACL,KAAK,EAAE,YAAY,EAAE,OAAO,QAAQ,CAAC;;CAEvC,UAAU,SACR,KAAK,EAAE,YAAY,EAAE,QAAQ,MAAM,CAAC;;CAEtC,UAAU,WACR,KAAK,EAAE,cAAc,EAAE,OAAO,QAAQ,CAAC;;CAEzC,QAAQ,SAAgC,KAAK,EAAE,OAAO,SAAS,IAAI,EAAE,CAAC;;CAEtE,KAAK,SAAgC,KAAK,EAAE,YAAY,SAAS,IAAI,EAAE,CAAC;;CAExE,QAAQ,UAA+C,KAAK,EAAE,YAAY,WAAW,OAAO,CAAC;;CAE7F,UAAU,YACR,KAAK,EAAE,gBAAgB,eAAe,SAAS,CAAC;CAClD,MAAM,KAAK,EAAE,SAAS,OAAO,CAAC;;CAE9B,QAAQ,KAAK;EAAE,SAAS;EAAQ,eAAe;CAAS,CAAC;CACzD,MAAM,KAAK,EAAE,SAAS,OAAO,CAAC;CAC9B,OAAO,KAAK,EAAE,SAAS,QAAQ,CAAC;CAChC,QAAQ,KAAK,EAAE,SAAS,OAAO,CAAC;CAChC,OAAO,KAAK,EAAE,OAAO,OAAO,CAAC;CAC7B,YAAY,KAAK,EAAE,WAAW,SAAS,CAAC;CACxC,WAAW,KAAK,EAAE,eAAe,YAAY,CAAC;;CAE9C,UAAU,KAAK;EAAE,UAAU;EAAU,cAAc;EAAY,YAAY;CAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utilities.mjs","names":[],"sources":["../src/utilities.ts"],"sourcesContent":["/**\n * `foldkit-mixins/utilities`: one-idea pieces over the shipped scales, so\n * `Utilities.p('md')` is `padding: var(--fk-space-md)`. A step is a token name\n * of `Theme.tokens` (and a color a token name of `Theme.oklch`), so a step the\n * scale lacks is a type error and the value still follows the `density` knob\n * and a theme's overrides: the theme stays the one source of truth for sizes.\n *\n * Each is a rule on the element (`Style.self`), unlayered like the other\n * subpaths' pieces, so it takes the layer of the style it is composed into and\n * a plain declaration beside it wins per property. Compose them like any piece:\n * `[U.flex, U.gap('sm'), { color: t.text.muted }]`.\n */\nimport { self, type StyleValue } from './styleValue.js'\nimport { ref, VAR_PREFIX } from './theme/core.js'\nimport type { OklchTheme } from './theme/oklch.js'\nimport { tokens, type Tokens } from './theme/tokens.js'\n\nconst t = ref(tokens)\n\n/** A space step, or none. */\nexport type Space = (keyof Tokens['space'] & string) | '0'\n/** A margin step: a space step, or `auto`. */\nexport type Margin = Space | 'auto'\n\ntype Palette = Omit<OklchTheme, 'knob' | 'hue'>\n/** A `Theme.oklch` color as `group.name`: `'surface.base'`, `'text.muted'`, `'accent.on-fill'`. */\nexport type ColorName = {\n readonly [G in keyof Palette & string]: `${G}.${keyof Palette[G] & string}`\n}[keyof Palette & string]\n\nconst space = (step: Margin): string => (step === '0' || step === 'auto' ? step : t.space[step])\n\nconst colorRef = (name: ColorName): string => `var(${VAR_PREFIX}-${name.replace('.', '-')})`\n\nconst alignments = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n baseline: 'baseline',\n} as const\n\nconst justifications = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n between: 'space-between',\n around: 'space-around',\n evenly: 'space-evenly',\n} as const\n\nexport const Utilities = {\n /** `padding` on every side. */\n p: (step: Space): StyleValue => self({ padding: space(step) }),\n /** `padding-inline`. */\n px: (step: Space): StyleValue => self({ paddingInline: space(step) }),\n /** `padding-block`. */\n py: (step: Space): StyleValue => self({ paddingBlock: space(step) }),\n /** `margin` on every side. */\n m: (step: Margin): StyleValue => self({ margin: space(step) }),\n /** `margin-inline`; `mx('auto')` centers a block. */\n mx: (step: Margin): StyleValue => self({ marginInline: space(step) }),\n /** `margin-block`. */\n my: (step: Margin): StyleValue => self({ marginBlock: space(step) }),\n /** `gap` between flex or grid children. */\n gap: (step: Space): StyleValue => self({ gap: space(step) }),\n /** `font-size` from the size scale. */\n text: (size: keyof Tokens['size'] & string): StyleValue => self({ fontSize: t.size[size] }),\n /** `font-weight` from the weight scale. */\n font: (weight: keyof Tokens['weight'] & string): StyleValue =>\n self({ fontWeight: t.weight[weight] }),\n /** `line-height` from the leading scale. */\n leading: (name: keyof Tokens['leading'] & string): StyleValue =>\n self({ lineHeight: t.leading[name] }),\n /** `border-radius` from the radius scale. */\n rounded: (radius: keyof Tokens['radius'] & string): StyleValue =>\n self({ borderRadius: t.radius[radius] }),\n /** Text `color` from the palette. */\n color: (name: ColorName): StyleValue => self({ color: colorRef(name) }),\n /** `background` from the palette. */\n bg: (name: ColorName): StyleValue => self({ background: colorRef(name) }),\n /** `align-items` of a flex or grid container. */\n items: (align: keyof typeof alignments): StyleValue => self({ alignItems: alignments[align] }),\n /** `justify-content` of a flex or grid container. */\n justify: (justify: keyof typeof justifications): StyleValue =>\n self({ justifyContent: justifications[justify] }),\n flex: self({ display: 'flex' }),\n /** A flex column. */\n column: self({ display: 'flex', flexDirection: 'column' }),\n grid: self({ display: 'grid' }),\n block: self({ display: 'block' }),\n hidden: self({ display: 'none' }),\n wFull: self({ width: '100%' }),\n textCenter: self({ textAlign: 'center' }),\n uppercase: self({ textTransform: 'uppercase' }),\n /** One line, cut with an ellipsis. */\n truncate: self({ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }),\n /** Visually hidden but announced: screen-reader-only content. */\n srOnly: self({\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n border: '0',\n }),\n pointer: self({ cursor: 'pointer' }),\n selectNone: self({ userSelect: 'none' }),\n} as const\n"],"mappings":";;;;;;;;;;;;;;;;AAiBA,MAAM,IAAI,IAAI,MAAM;AAapB,MAAM,SAAS,SAA0B,SAAS,OAAO,SAAS,SAAS,OAAO,EAAE,MAAM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,EAAE,SAAS,OAAO,CAAC;;CAE9B,QAAQ,KAAK;EAAE,SAAS;EAAQ,eAAe;CAAS,CAAC;CACzD,MAAM,KAAK,EAAE,SAAS,OAAO,CAAC;CAC9B,OAAO,KAAK,EAAE,SAAS,QAAQ,CAAC;CAChC,QAAQ,KAAK,EAAE,SAAS,OAAO,CAAC;CAChC,OAAO,KAAK,EAAE,OAAO,OAAO,CAAC;CAC7B,YAAY,KAAK,EAAE,WAAW,SAAS,CAAC;CACxC,WAAW,KAAK,EAAE,eAAe,YAAY,CAAC;;CAE9C,UAAU,KAAK;EAAE,UAAU;EAAU,cAAc;EAAY,YAAY;CAAS,CAAC;;CAErF,QAAQ,KAAK;EACX,UAAU;EACV,OAAO;EACP,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,UAAU;EACV,MAAM;EACN,YAAY;EACZ,QAAQ;CACV,CAAC;CACD,SAAS,KAAK,EAAE,QAAQ,UAAU,CAAC;CACnC,YAAY,KAAK,EAAE,YAAY,OAAO,CAAC;AACzC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styleValue-_G9jwb17.mjs","names":["pseudo","media","supports","container","nest","keyframes","Rules.pseudo","Rules.rule","Rules.media","Rules.supports","Rules.container","Rules.nest","Rules.keyframes"],"sources":["../src/diagnostics.ts","../src/styleRules.ts","../src/styleValue.ts"],"sourcesContent":["/**\n * Structured diagnostics for attachment conflicts. Codes are stable so tests,\n * DevTools, and editor tooling can share them. Resolution failures are\n * programming errors (a definition attaches something a slot does not allow),\n * so `resolve` throws a `DiagnosticError` carrying one.\n */\nexport type DiagnosticCode =\n | 'mixins:unknown-slot'\n | 'mixins:hidden-slot'\n | 'mixins:capability-mismatch'\n | 'mixins:unsupported-event'\n | 'mixins:unsupported-attribute'\n | 'mixins:protected-event'\n | 'mixins:protected-attribute'\n | 'mixins:protected-style-property'\n | 'mixins:style-property-conflict'\n | 'mixins:event-conflict'\n | 'mixins:attribute-conflict'\n | 'mixins:structural-override'\n | 'mixins:duplicate-mount-name'\n | 'mixins:duplicate-item-id'\n | 'mixins:ragged-grid-areas'\n | 'style:duplicate-layer'\n | 'style:conflicting-layer-order'\n | 'style:unlayered-rule'\n | 'style:relayered'\n | 'theme:unparseable-breakpoint'\n | 'a11y:missing-slot'\n | 'a11y:hidden-slot'\n | 'a11y:capability-mismatch'\n | 'a11y:missing-event'\n | 'a11y:missing-attribute'\n\nexport interface Diagnostic {\n readonly source: 'mixins' | 'a11y' | 'style' | 'theme'\n readonly code: DiagnosticCode\n readonly severity: 'error'\n readonly message: string\n readonly slot?: string\n readonly details?: Readonly<Record<string, unknown>>\n}\n\nexport class DiagnosticError extends Error {\n readonly diagnostic: Diagnostic\n\n constructor(diagnostic: Diagnostic) {\n super(diagnostic.message)\n this.name = 'DiagnosticError'\n this.diagnostic = diagnostic\n }\n}\n","/**\n * Deterministic compilation of rule-based Style. A rule selector is written\n * relative to the generated class with `&` (`&:hover`). The class name is an\n * FNV-1a hash of the canonical rule text, so equal rules share a class and the\n * server and the browser derive the same name. Pure data in, CSS text out: no\n * registry, no DOM, no `Date.now`.\n */\nexport interface StyleRule {\n readonly selector: string\n readonly at?: string\n /** The cascade layer the rule is emitted in; none means the unlayered cascade. */\n readonly layer?: string\n readonly declarations: Readonly<Record<string, string>>\n}\n\nexport const rule = (\n selector: string,\n declarations: Readonly<Record<string, string>>,\n at?: string,\n): StyleRule =>\n Object.freeze({\n selector,\n declarations: Object.freeze({ ...declarations }),\n ...(at === undefined ? {} : { at }),\n })\n\n/**\n * The top-level selectors of a list: split on commas outside `()`, `[]` and\n * strings, so `:is(a, b)` and `[title=\"a, b\"]` stay whole.\n */\nexport const selectorList = (selector: string): ReadonlyArray<string> => {\n const parts: Array<string> = []\n let depth = 0\n let quote: string | undefined\n let start = 0\n for (let index = 0; index < selector.length; index++) {\n const char = selector[index]\n if (quote !== undefined) {\n if (char === '\\\\') index++\n else if (char === quote) quote = undefined\n } else if (char === '\"' || char === \"'\") quote = char\n else if (char === '(' || char === '[') depth++\n else if (char === ')' || char === ']') depth--\n else if (char === ',' && depth === 0) {\n parts.push(selector.slice(start, index).trim())\n start = index + 1\n }\n }\n parts.push(selector.slice(start).trim())\n return parts\n}\n\n/** Each selector of a list relative to the class: `&` kept where written, else `prefix` added. */\nconst relative = (selector: string, prefix: (part: string) => string): string =>\n selectorList(selector)\n .map(part => (part.includes('&') ? part : prefix(part)))\n .join(', ')\n\n/** `:hover, :focus-visible` is `&:hover, &:focus-visible`. */\nexport const pseudo = (suffix: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule(\n relative(suffix, part => `&${part}`),\n declarations,\n )\n\nexport const media = (query: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule('&', declarations, `@media ${query}`)\n\nexport const supports = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleRule => rule('&', declarations, `@supports ${condition}`)\n\nexport const container = (\n condition: string,\n declarations: Readonly<Record<string, string>>,\n): StyleRule => rule('&', declarations, `@container ${condition}`)\n\n/**\n * A nested selector relative to the class, e.g. `> span`, or `[data-open] &`\n * where `&` places the class. Every selector of a list is scoped.\n */\nexport const nest = (selector: string, declarations: Readonly<Record<string, string>>): StyleRule =>\n rule(\n relative(selector, part => `& ${part}`),\n declarations,\n )\n\n/** `gridTemplateColumns` -> `grid-template-columns`; custom properties pass through. */\nconst kebab = (property: string): string =>\n property.startsWith('--')\n ? property\n : property.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n\nconst declarationsText = (declarations: Readonly<Record<string, string>>): string =>\n Object.keys(declarations)\n .sort()\n .map(property => `${kebab(property)}:${declarations[property]}`)\n .join(';')\n\n/** Canonical, declaration-sorted, authored-rule-order text for a rule list. */\nconst inLayerText = (layer: string | undefined, text: string): string =>\n layer === undefined ? text : `@layer ${layer}{${text}}`\n\nexport const canonical = (rules: ReadonlyArray<StyleRule>): string =>\n rules\n .map(entry => {\n const body = `{${declarationsText(entry.declarations)}}`\n return inLayerText(\n entry.layer,\n entry.at === undefined\n ? `${entry.selector}${body}`\n : `${entry.at}{${entry.selector}${body}}`,\n )\n })\n .join('')\n\nconst hash = (value: string): string => {\n let state = 2166136261\n for (let index = 0; index < value.length; index++) {\n state ^= value.charCodeAt(index)\n state = Math.imul(state, 16777619)\n }\n return (state >>> 0).toString(36)\n}\n\nexport interface Keyframes {\n readonly name: string\n readonly css: string\n}\n\n/** Deterministic `@keyframes`: step order is authored, declarations sorted. */\nexport const keyframes = (\n frames: Readonly<Record<string, Readonly<Record<string, string>>>>,\n): Keyframes => {\n const body = Object.entries(frames)\n .map(([step, declarations]) => `${step}{${declarationsText(declarations)}}`)\n .join('')\n const name = `kf-${hash(body)}`\n return Object.freeze({ name, css: `@keyframes ${name}{${body}}` })\n}\n\nexport const className = (rules: ReadonlyArray<StyleRule>): string =>\n `style-${hash(canonical(rules))}`\n\nconst selectorFor = (generated: string, selector: string): string =>\n selectorList(selector)\n .map(part =>\n part.includes('&') ? part.replace(/&/g, `.${generated}`) : `.${generated} ${part}`,\n )\n .join(', ')\n\nexport const css = (generated: string, rules: ReadonlyArray<StyleRule>): string =>\n rules\n .map(entry => {\n const body = `{${declarationsText(entry.declarations)}}`\n const selector = `${selectorFor(generated, entry.selector)}${body}`\n return inLayerText(\n entry.layer,\n entry.at === undefined ? selector : `${entry.at}{${selector}}`,\n )\n })\n .join('')\n","/**\n * The Style kernel: `StyleValue` and the pure builders that make one. A\n * value is class tokens, inline declarations, rule pieces that compile to a\n * deterministic class, and class-independent CSS. Nothing here knows what a\n * slot is; `style.ts` joins this to slots, and the `/theme`, `/layers`,\n * `/layout`, `/defaults`, and `/prose` subpaths build on it alone.\n */\nimport type { Properties } from 'csstype'\nimport { DiagnosticError } from './diagnostics.js'\nimport type { SlotItem } from './slotItem.js'\nimport * as Rules from './styleRules.js'\nimport type { StyleRule } from './styleRules.js'\n\n/**\n * The declarations a piece accepts: camelCase CSS properties, each a string,\n * plus custom properties. A misspelled or kebab-case property is a type error;\n * the compiler writes the kebab-case name. Values stay strings, so `var(...)`,\n * `calc(...)`, and `light-dark(...)` pass through.\n */\nexport type Declarations = { readonly [K in keyof Properties]?: string } & {\n readonly [K: `--${string}`]: string\n}\n\n/** Marks a `StyleValue`, so a piece is told from a declarations object without guessing. */\nexport const StyleValueTypeId: unique symbol = Symbol.for('foldkit-mixins/StyleValue')\n\nexport interface StyleValue {\n readonly [StyleValueTypeId]: true\n readonly classes: ReadonlyArray<string>\n readonly style: Readonly<Record<string, string>>\n /** Input-driven pieces resolved at render time; empty for a static style. */\n readonly conditions?: ReadonlyArray<StyleCondition>\n /** Pieces that depend on which repetition of a slot is rendered. */\n readonly items?: ReadonlyArray<(item: SlotItem | undefined) => StyleValue>\n /** Rule-based appearance compiled to a deterministic class plus CSS. */\n readonly rules?: ReadonlyArray<StyleRule>\n /** Class-independent CSS (keyframes, layers, global rules). */\n readonly globalCss?: ReadonlyArray<string>\n}\n\nexport interface StyleCondition {\n readonly predicate: (input: unknown) => boolean\n readonly piece: StyleValue\n}\n\nconst tokens = (value: string): ReadonlyArray<string> =>\n value.split(/\\s+/).filter(token => token.length > 0)\n\nconst noClasses: ReadonlyArray<string> = Object.freeze([])\nconst noStyle: Readonly<Record<string, string>> = Object.freeze({})\n\n/** A frozen `StyleValue` from its parts; absent classes and style are empty. */\nexport const make = (parts: Partial<Omit<StyleValue, typeof StyleValueTypeId>>): StyleValue => {\n const value: StyleValue = {\n [StyleValueTypeId]: true,\n ...parts,\n classes: parts.classes ?? noClasses,\n style: parts.style ?? noStyle,\n }\n return Object.freeze(value)\n}\n\nexport const isStyleValue = (value: unknown): value is StyleValue =>\n typeof value === 'object' && value !== null && Object.hasOwn(value, StyleValueTypeId)\n\nexport const empty: StyleValue = make({})\n\n/**\n * A piece as written: a `StyleValue`; a declarations object, which means\n * `Style.self(declarations)`; or pieces composed in order.\n */\nexport type Piece =\n | StyleValue\n // Without `classes`, so an object shaped like a StyleValue is not taken for declarations.\n | (Declarations & { readonly classes?: never })\n | ReadonlyArray<Piece>\n\nconst isPieceList = (value: Piece): value is ReadonlyArray<Piece> => Array.isArray(value)\n\n/** The `StyleValue` a written piece stands for. */\nexport const toStyleValue = (value: Piece): StyleValue => {\n if (isStyleValue(value)) return value\n if (isPieceList(value)) return compose(...value)\n return Object.keys(value).length === 0 ? empty : self(value)\n}\n\nexport const classPiece = (value: string): StyleValue =>\n make({ classes: Object.freeze(tokens(value)) })\n\nexport const inline = (value: Declarations): StyleValue =>\n make({ style: Object.freeze({ ...value }) })\n\n/** Concatenate classes; later inline declarations win per property. */\nexport const compose = (...written: ReadonlyArray<Piece>): StyleValue => {\n const pieces = written.map(toStyleValue)\n const conditions = pieces.flatMap(piece => piece.conditions ?? [])\n const items = pieces.flatMap(piece => piece.items ?? [])\n const rules = pieces.flatMap(piece => piece.rules ?? [])\n const globalCss = pieces.flatMap(piece => piece.globalCss ?? [])\n return make({\n classes: Object.freeze(pieces.flatMap(piece => piece.classes)),\n style: Object.freeze(Object.assign(Object.create(null), ...pieces.map(piece => piece.style))),\n ...(conditions.length === 0 ? {} : { conditions: Object.freeze(conditions) }),\n ...(items.length === 0 ? {} : { items: Object.freeze(items) }),\n ...(rules.length === 0 ? {} : { rules: Object.freeze(rules) }),\n ...(globalCss.length === 0 ? {} : { globalCss: Object.freeze(globalCss) }),\n })\n}\n\n/** A pseudo-class/element rule, e.g. `Style.pseudo(':hover', { color: 'red' })`. */\nexport const pseudo = (suffix: string, declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.pseudo(suffix, declarations)]),\n })\n\n/**\n * Declarations on the element itself, as a rule on its generated class\n * (`&{…}`) rather than inline, so `Layers.in` can place them in a layer and a\n * later layer can override them. Inline declarations sit outside every layer.\n */\nexport const self = (declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.rule('&', declarations)]),\n })\n\n/** An at-rule, e.g. `Style.media('(min-width: 40rem)', { color: 'red' })`. */\nexport const media = (query: string, declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.media(query, declarations)]),\n })\n\n/** An at-rule, e.g. `Style.supports('(display: grid)', { display: 'grid' })`. */\nexport const supports = (condition: string, declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.supports(condition, declarations)]),\n })\n\n/** A container query, e.g. `Style.container('(min-width: 30rem)', {...})`. */\nexport const container = (condition: string, declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.container(condition, declarations)]),\n })\n\n/**\n * A piece's rules inside an at-rule, where one constructor alone cannot put\n * them: `Style.at('@container builder (max-width: 40rem)',\n * Style.pseudo('[data-open=\"false\"]', { display: 'none' }))`. Its inline\n * declarations become a rule on the element. A class, a condition, a\n * per-item piece, global CSS or a rule already inside an at-rule cannot be\n * put inside one, and throws here.\n */\nexport const at = (prelude: string, piece: StyleValue): StyleValue => {\n const refuse = (what: string): never => {\n throw new Error(`Style.at: ${what} cannot go inside \"${prelude}\"`)\n }\n if (!prelude.startsWith('@')) refuse('anything but an at-rule prelude')\n if (piece.classes.length > 0) refuse('a class')\n if ((piece.conditions ?? []).length > 0 || (piece.items ?? []).length > 0)\n refuse('a piece chosen when drawn')\n if ((piece.globalCss ?? []).length > 0) refuse('global CSS')\n const own = Object.keys(piece.style).length === 0 ? [] : [Rules.rule('&', piece.style)]\n return make({\n rules: Object.freeze(\n [...own, ...(piece.rules ?? [])].map(rule =>\n rule.at === undefined\n ? Object.freeze({ ...rule, at: prelude })\n : refuse(`a rule inside \"${rule.at}\"`),\n ),\n ),\n })\n}\n\n/** A nested selector relative to the generated class, e.g. `Style.nest('> span', {...})`. */\nexport const nest = (selector: string, declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.nest(selector, declarations)]),\n })\n\n/**\n * A deterministic `@keyframes` block. Compose `style` where the animation is\n * declared and reference `name` in an `animation` declaration.\n */\nexport const keyframes = (\n frames: Readonly<Record<string, Declarations>>,\n): { readonly name: string; readonly style: StyleValue } => {\n const compiled = Rules.keyframes(frames)\n return Object.freeze({\n name: compiled.name,\n style: make({\n globalCss: Object.freeze([compiled.css]),\n }),\n })\n}\n\n/** Raw class-independent CSS (a layer, a global rule). Prefer typed helpers. */\nexport const global = (css: string): StyleValue =>\n make({\n globalCss: Object.freeze([css]),\n })\n\n/**\n * Appearance per `data-state` value, e.g. `Style.states({ open: { opacity: '1' } })`\n * compiles to `&[data-state=\"open\"]`. Pairs with Behaviors that write\n * `data-state`, so state is styled with no JavaScript and no `whenInput`:\n * `whenInput` when the view knows, `states` when the DOM does.\n */\nexport const states = (\n map: Readonly<Record<string, Declarations>>,\n attribute = 'data-state',\n): StyleValue =>\n make({\n rules: Object.freeze(\n Object.entries(map).map(([state, declarations]) =>\n Rules.pseudo(`[${attribute}=\"${state}\"]`, declarations),\n ),\n ),\n })\n\n/**\n * Declarations per named breakpoint, e.g.\n * `Style.responsive({ md: '(min-width: 48rem)' }, { md: { display: 'flex' } })`.\n * The breakpoint names come from the record you pass, typically a theme's, so\n * a misspelled one is a type error. A breakpoint is a media query, or a whole\n * at-rule: `'@container page (min-width: 48rem)'` measures the container named\n * `page` rather than the window (`Theme.inContainer` writes these).\n */\nexport const responsive = <Breakpoints extends Readonly<Record<string, string>>>(\n breakpoints: Breakpoints,\n map: Partial<Readonly<Record<keyof Breakpoints & string, Declarations>>>,\n): StyleValue =>\n make({\n rules: Object.freeze(\n Object.entries(map).flatMap(([name, declarations]) => {\n const query = breakpoints[name]\n if (query === undefined || declarations === undefined) return []\n return [\n query.startsWith('@')\n ? Rules.rule('&', declarations, query)\n : Rules.media(query, declarations),\n ]\n }),\n ),\n })\n\n/** Custom properties on the slot: `Style.vars({ '--gap': '1rem' })`. */\nexport const vars = (values: Readonly<Record<`--${string}`, string>>): StyleValue => inline(values)\n\nexport interface GridConfig<Area extends string> {\n /** Rows of area names; `'.'` is an empty cell. Every row has the same length. */\n readonly areas: ReadonlyArray<ReadonlyArray<Area>>\n readonly columns?: string\n readonly rows?: string\n readonly gap?: string\n}\n\nexport interface Grid<Area extends string> {\n /** The container's declarations: `display: grid` and the template. */\n readonly style: StyleValue\n /** A child's `grid-area`; only the names the template declares are accepted. */\n readonly area: (name: Area) => StyleValue\n /** The declared names, in first-appearance order. */\n readonly areas: ReadonlyArray<Area>\n}\n\n/**\n * A grid template with typed areas, so a child cannot name an area the\n * parent lacks: `const Page = Style.grid({ areas: [['header', 'header'],\n * ['nav', 'main']] })`, then `Page.area('main')` on the child and\n * `Page.area('footer')` is a type error. A ragged template raises\n * `mixins:ragged-grid-areas`.\n */\nexport const grid = <const Area extends string>(\n config: GridConfig<Area>,\n): Grid<Exclude<Area, '.'>> => {\n const width = config.areas[0]?.length ?? 0\n if (config.areas.some(row => row.length !== width)) {\n throw new DiagnosticError({\n source: 'mixins',\n code: 'mixins:ragged-grid-areas',\n severity: 'error',\n message: `Style.grid areas must be rectangular; rows have lengths ${config.areas.map(row => row.length).join(', ')}`,\n })\n }\n const names: Array<Exclude<Area, '.'>> = []\n for (const row of config.areas) {\n for (const cell of row) {\n if (cell !== '.' && !names.includes(cell as Exclude<Area, '.'>)) {\n names.push(cell as Exclude<Area, '.'>)\n }\n }\n }\n return Object.freeze({\n // Rules, not inline declarations, so a later layer can override the template.\n style: self({\n display: 'grid',\n gridTemplateAreas: config.areas.map(row => `\"${row.join(' ')}\"`).join(' '),\n ...(config.columns === undefined ? {} : { gridTemplateColumns: config.columns }),\n ...(config.rows === undefined ? {} : { gridTemplateRows: config.rows }),\n ...(config.gap === undefined ? {} : { gap: config.gap }),\n }),\n area: (name: Exclude<Area, '.'>) => self({ gridArea: name }),\n areas: Object.freeze(names),\n })\n}\n\n/**\n * The declarations an element starts from when it enters, as a\n * `@starting-style` rule. With a `transition` on the base, the browser\n * animates from these; pair with `allowDiscrete` when `display` takes part.\n */\nexport const enter = (declarations: Declarations): StyleValue =>\n make({\n rules: Object.freeze([Rules.rule('&', declarations, '@starting-style')]),\n })\n\n/** `transition-behavior: allow-discrete`, so `display` and `overlay` transition too. */\nexport const allowDiscrete: StyleValue = inline({ transitionBehavior: 'allow-discrete' })\n\n/** Opts the slot into Foldkit's view transitions under `name`. */\nexport const viewTransitionName = (name: string): StyleValue => inline({ viewTransitionName: name })\n"],"mappings":";;;AA0CA,IAAa,kBAAb,cAAqC,MAAM;CACzC;CAEA,YAAY,YAAwB;EAClC,MAAM,WAAW,OAAO;EACxB,KAAK,OAAO;EACZ,KAAK,aAAa;CACpB;AACF;;;ACnCA,MAAa,QACX,UACA,cACA,OAEA,OAAO,OAAO;CACZ;CACA,cAAc,OAAO,OAAO,EAAE,GAAG,aAAa,CAAC;CAC/C,GAAI,OAAO,KAAA,IAAY,CAAC,IAAI,EAAE,GAAG;AACnC,CAAC;;;;;AAMH,MAAa,gBAAgB,aAA4C;CACvE,MAAM,QAAuB,CAAC;CAC9B,IAAI,QAAQ;CACZ,IAAI;CACJ,IAAI,QAAQ;CACZ,KAAK,IAAI,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS;EACpD,MAAM,OAAO,SAAS;EACtB,IAAI,UAAU,KAAA,GAAW;GACvB,IAAI,SAAS,MAAM;QACd,IAAI,SAAS,OAAO,QAAQ,KAAA;EACnC,OAAO,IAAI,SAAS,QAAO,SAAS,KAAK,QAAQ;OAC5C,IAAI,SAAS,OAAO,SAAS,KAAK;OAClC,IAAI,SAAS,OAAO,SAAS,KAAK;OAClC,IAAI,SAAS,OAAO,UAAU,GAAG;GACpC,MAAM,KAAK,SAAS,MAAM,OAAO,KAAK,CAAC,CAAC,KAAK,CAAC;GAC9C,QAAQ,QAAQ;EAClB;CACF;CACA,MAAM,KAAK,SAAS,MAAM,KAAK,CAAC,CAAC,KAAK,CAAC;CACvC,OAAO;AACT;;AAGA,MAAM,YAAY,UAAkB,WAClC,aAAa,QAAQ,CAAC,CACnB,KAAI,SAAS,KAAK,SAAS,GAAG,IAAI,OAAO,OAAO,IAAI,CAAE,CAAC,CACvD,KAAK,IAAI;;AAGd,MAAaA,YAAU,QAAgB,iBACrC,KACE,SAAS,SA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AM,IAAI,gBAAgB;EACxB,QAAQ;EACR,MAAM;EACN,UAAU;EACV,SAAS,2DAA2D,OAAO,MAAM,KAAI,QAAO,IAAI,MAAM,CAAC,CAAC,KAAK,IAAI;CACnH,CAAC;CAEH,MAAM,QAAmC,CAAC;CAC1C,KAAK,MAAM,OAAO,OAAO,OACvB,KAAK,MAAM,QAAQ,KACjB,IAAI,SAAS,OAAO,CAAC,MAAM,SAAS,IAA0B,GAC5D,MAAM,KAAK,IAA0B;CAI3C,OAAO,OAAO,OAAO;EAEnB,OAAO,KAAK;GACV,SAAS;GACT,mBAAmB,OAAO,MAAM,KAAI,QAAO,IAAI,IAAI,KAAK,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG;GACzE,GAAI,OAAO,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,qBAAqB,OAAO,QAAQ;GAC9E,GAAI,OAAO,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAkB,OAAO,KAAK;GACrE,GAAI,OAAO,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK,OAAO,IAAI;EACxD,CAAC;EACD,OAAO,SAA6B,KAAK,EAAE,UAAU,KAAK,CAAC;EAC3D,OAAO,OAAO,OAAO,KAAK;CAC5B,CAAC;AACH;;;;;;AAOA,MAAa,SAAS,iBACpB,KAAK,EACH,OAAO,OAAO,OAAO,CAACD,KAAW,KAAK,cAAc,iBAAiB,CAAC,CAAC,EACzE,CAAC;;AAGH,MAAa,gBAA4B,OAAO,EAAE,oBAAoB,iBAAiB,CAAC;;AAGxF,MAAa,sBAAsB,SAA6B,OAAO,EAAE,oBAAoB,KAAK,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tokens-O8S8QH_R.mjs","names":[],"sources":["../src/theme/tokens.ts"],"sourcesContent":["/**\n * The non-color scales a design system shares across themes. Space and\n * radius multiply by the `density` and `radius-factor` knobs, so a compact\n * or a rounder theme is one override. `shadow` is drawn in `shadow.color`,\n * which a palette sets (`Theme.oklch` does, stronger in a dark scheme, where\n * a shadow mixed from the text would glow); alone it falls back to black. `breakpoint` is the record\n * `Style.responsive` takes; `breakpointWidths` gives the same names as pixel\n * thresholds for `foldkit-primitives/media` Breakpoints.\n */\nimport { DiagnosticError } from '../diagnostics.js'\nimport { define } from './core.js'\n\nconst space = (rem: number) => `calc(${rem}rem * var(--fk-knob-density))`\nconst radius = (px: number) => `calc(${px}px * var(--fk-knob-radius-factor))`\nconst shade = 'var(--fk-shadow-color, oklch(0% 0 0 / 0.12))'\nconst shadow = (...layers: ReadonlyArray<string>) =>\n layers.map(layer => `${layer} ${shade}`).join(', ')\n\nexport const tokens = define({\n knob: { density: '1', 'radius-factor': '1' },\n space: {\n '3xs': space(0.125),\n '2xs': space(0.25),\n xs: space(0.5),\n sm: space(0.75),\n md: space(1),\n lg: space(1.5),\n xl: space(2),\n '2xl': space(3),\n '3xl': space(4),\n },\n radius: {\n xs: radius(2),\n sm: radius(3),\n md: radius(6),\n lg: radius(8),\n xl: radius(12),\n full: '9999px',\n },\n font: { body: 'system-ui, sans-serif', heading: 'inherit', mono: 'ui-monospace, monospace' },\n size: {\n xs: '0.75rem',\n sm: '0.875rem',\n md: '1rem',\n lg: '1.125rem',\n xl: '1.25rem',\n '2xl': '1.5rem',\n '3xl': '1.875rem',\n '4xl': '2.25rem',\n },\n leading: { tight: '1.2', snug: '1.375', normal: '1.5', relaxed: '1.6' },\n weight: { normal: '400', medium: '500', semibold: '600', bold: '700' },\n motion: { fast: '150ms', normal: '250ms', ease: 'ease-out' },\n border: { thin: '1px', thick: '2px', heavy: '3px' },\n // Raised a little to a lot: a pressed control, a lifted cell, a menu, a dialog.\n shadow: {\n xs: shadow('0 1px 2px 0'),\n sm: shadow('0 1px 3px 0', '0 1px 2px -1px'),\n md: shadow('0 4px 6px -1px', '0 2px 4px -2px'),\n lg: shadow('0 10px 15px -3px', '0 4px 6px -4px'),\n xl: shadow('0 20px 25px -5px', '0 8px 10px -6px'),\n inset: shadow('inset 0 2px 4px 0'),\n },\n breakpoint: {\n sm: '(min-width: 40rem)',\n md: '(min-width: 48rem)',\n lg: '(min-width: 64rem)',\n xl: '(min-width: 80rem)',\n },\n})\n\nexport type Tokens = typeof tokens\n\n// A plain `min-width`, of the window or of a named container.\nconst MIN_WIDTH = /^(?:@container\\s+[\\w-]+\\s+)?\\(min-width:\\s*(\\d+(?:\\.\\d+)?)(rem|px)\\)$/\n\n/**\n * Each breakpoint query's `min-width` in pixels (rem at 16), so CSS and the\n * Model agree on what `md` means. A query that is not a plain `min-width`\n * is refused: it has no single threshold. A container's is its container's.\n */\nexport const breakpointWidths = (theme: {\n readonly breakpoint: { readonly [name: string]: string }\n}): Readonly<Record<string, number>> => {\n const widths: Record<string, number> = {}\n for (const [name, query] of Object.entries(theme.breakpoint)) {\n const match = MIN_WIDTH.exec(query)\n if (match === null) {\n throw new DiagnosticError({\n source: 'theme',\n code: 'theme:unparseable-breakpoint',\n severity: 'error',\n message: `Breakpoint \"${name}\" is \"${query}\", not a \"(min-width: <rem|px>)\" query`,\n details: { name, query },\n })\n }\n const amount = Number(match[1])\n widths[name] = match[2] === 'rem' ? amount * 16 : amount\n }\n return Object.freeze(widths)\n}\n\n/**\n * The same breakpoints measured on a named container rather than the window:\n * `Theme.inContainer('page', Theme.tokens.breakpoint)` gives `md` as\n * `'@container page (min-width: 48rem)'`, for `Style.responsive` and a\n * responsive look. An element must be that container (`container: page /\n * inline-size`) for them to match.\n */\nexport const inContainer = <Breakpoints extends Readonly<Record<string, string>>>(\n name: string,\n breakpoints: Breakpoints,\n): { readonly [K in keyof Breakpoints]: string } =>\n Object.freeze(\n Object.fromEntries(\n Object.entries(breakpoints).map(([at, query]) => [at, `@container ${name} ${query}`]),\n ),\n ) as { readonly [K in keyof Breakpoints]: string }\n"],"mappings":";;;;;;;;;;;;AAYA,MAAM,SAAS,QAAgB,QAAQ,IAAI;AAC3C,MAAM,UAAU,OAAe,QAAQ,GAAG;AAC1C,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