@vokril/ui-solid 0.25.0 → 0.26.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 (37) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +16 -6
  3. package/dist/_internal/platform/settings/settingsTypes.d.cts +7 -0
  4. package/dist/_internal/platform/settings/settingsTypes.d.ts +7 -0
  5. package/dist/appThemeDerivation-Be_oKljl.cjs +1 -0
  6. package/dist/{appThemeDerivation-B7-DjMIM.js → appThemeDerivation-CKoSe4KP.js} +334 -252
  7. package/dist/fonts/manrope.css +10 -0
  8. package/dist/fonts.css +2 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.js +476 -472
  11. package/dist/server/appThemeDerivation-Be_oKljl.cjs +1 -0
  12. package/dist/server/{appThemeDerivation-B7-DjMIM.js → appThemeDerivation-CKoSe4KP.js} +334 -252
  13. package/dist/server/index.cjs +1 -1
  14. package/dist/server/index.js +468 -464
  15. package/dist/server/tokens/index.cjs +1 -1
  16. package/dist/server/tokens/index.js +33 -29
  17. package/dist/solid/tokens/index.js +1 -1
  18. package/dist/solid/tokens/palette/palettes.js +62 -4
  19. package/dist/solid/tokens/palette/themeRegistry.js +30 -7
  20. package/dist/solid/tokens/theme.jsx +12 -5
  21. package/dist/style.css +288 -9
  22. package/dist/theme.css +287 -8
  23. package/dist/tokens/index.cjs +1 -1
  24. package/dist/tokens/index.d.cts +2 -2
  25. package/dist/tokens/index.d.ts +2 -2
  26. package/dist/tokens/index.js +33 -29
  27. package/dist/tokens/palette/palettes.d.cts +13 -13
  28. package/dist/tokens/palette/palettes.d.ts +13 -13
  29. package/dist/tokens/palette/themeRegistry.d.cts +27 -6
  30. package/dist/tokens/palette/themeRegistry.d.ts +27 -6
  31. package/dist/tokens/theme.d.cts +11 -8
  32. package/dist/tokens/theme.d.ts +11 -8
  33. package/dist/tokens/tokens.css +287 -8
  34. package/dist/ui.css +1 -1
  35. package/package.json +3 -2
  36. package/dist/appThemeDerivation-NS3Vws8q.cjs +0 -1
  37. package/dist/server/appThemeDerivation-NS3Vws8q.cjs +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to `@vokril/ui-solid` are listed here. Versions follow
5
5
  contain breaking changes. From 0.1.1 on, entries are written by Changesets
6
6
  (`npm run release:version`) above the previous release.
7
7
 
8
+ ## 0.26.0
9
+
10
+ ### Minor Changes
11
+
12
+ - **Breaking:** two designs, Viper and Vokril (decision 0021). A design is the colours, type and shape that belong together; a product picks one with `setThemeDesign('viper' | 'vokril')` before the first render (default `'viper'`, the look so far).
13
+
14
+ - The themes are `viper-dark` (the default, formerly `vokril-dark`), `viper-light` (formerly `light`), and the new `vokril-dark` and `vokril-light`: vokril.com's colours, a flat page with hairline borders, square corners and Manrope. The high-contrast themes fit both designs. `ThemeOption.design` names a theme's design.
15
+ - `'dark'`, `'light'` and `'system'` resolve within the active design; `getThemeOptions()` lists its themes; `getDefaultThemeId(type?)` and `getThemeDesign()` read it, `DESIGN_THEMES` maps each design to its two ids. A built-in theme of the other design resolves to the active design's theme of the same type, so a `vokril-dark` stored by an earlier release reads as `viper-dark` in a Viper product. `darcula` and `light` resolve to `viper-dark` and `viper-light`.
16
+ - `applyAppTheme` stamps `data-design` on `<html>` for a theme of a design; tokens.css keys the Vokril type and shape on `:root[data-design='vokril']`, and palette.css copies them into the Vokril theme selectors, so `<html data-app-theme="vokril-dark">` is enough for a static page.
17
+ - New stylesheet `fonts/manrope.css` (with `@fontsource/manrope`); `fonts.css` also loads Manrope's 800 weight.
18
+
8
19
  ## 0.25.0
9
20
 
10
21
  ### Minor Changes
package/README.md CHANGED
@@ -171,21 +171,31 @@ const surface = createTreeSurface({
171
171
  ## Theming
172
172
 
173
173
  `ThemeProvider` applies a palette to `<html>`. It writes the derived `--color-*` properties, the
174
- `light`/`dark` class, `color-scheme` and `data-app-theme`.
174
+ `light`/`dark` class, `color-scheme`, `data-app-theme` and, for a theme of a design, `data-design`.
175
175
 
176
176
  ```tsx
177
- <ThemeProvider defaultTheme="dark" storageKey="my-app-theme" colorVisionSafe={false}>
177
+ setThemeDesign('vokril'); // once, before the first render; the default design is 'viper'
178
+ <ThemeProvider defaultTheme="system" storageKey="my-app-theme" colorVisionSafe={false}>
178
179
  ```
179
180
 
181
+ - **Designs:** a design is the colours, type and shape that belong together. A product uses one.
182
+ - `viper` (the default): the dense desktop look — layered surfaces, rounded corners, Inter.
183
+ - `vokril`: the Vokril brand look — one flat page colour, hairline borders, square corners, Manrope
184
+ (`@vokril/ui-solid/fonts/manrope.css` with `@fontsource/manrope`).
180
185
  - **Themes:**
181
- - `'dark'` = Vokril Dark (the default), `'light'`, `'system'` (follows `prefers-color-scheme`).
182
- - Palette ids: `vokril-dark`, `light`, `high-contrast-dark`, `high-contrast-light`.
186
+ - `'dark'`, `'light'` = the active design's dark and light theme; `'dark'` is the default;
187
+ `'system'` follows `prefers-color-scheme`.
188
+ - Palette ids: `viper-dark`, `viper-light`, `vokril-dark`, `vokril-light`, `high-contrast-dark`,
189
+ `high-contrast-light`. The high-contrast themes fit both designs.
190
+ - `getThemeOptions()` lists the active design's themes. An id of the other design resolves to the
191
+ active design's theme of the same type, so a stored choice never switches a product's design.
192
+ - The ids `darcula` and `light` from earlier releases resolve to `viper-dark` and `viper-light`.
183
193
  - **Persistence:** the choice is saved in `localStorage` under `vokril-ui-theme`. `storageKey` changes the key; `storage` takes `sessionStorage` or any `{ getItem, setItem }`; `storage={null}` turns persistence off.
184
194
  - **Other windows:** `document={popup.document}` themes a detached window's document and follows that window's `prefers-color-scheme`.
185
195
  - **Hook:** `useTheme()` returns `theme`, `resolvedTheme`, `themeId`, `setTheme`, `toggleTheme` and the colour-vision-safe switch.
186
- - **Without the provider:** `applyAppTheme('light')` themes a document directly, and `theme.css` carries the same values as static CSS.
196
+ - **Without the provider:** `applyAppTheme('light')` themes a document directly, and `theme.css` carries the same values as static CSS (`<html data-app-theme="vokril-dark">` is enough for a static page).
187
197
 
188
- The Vokril palettes are original and generated in OKLCH.
198
+ The Viper palettes are original and generated in OKLCH; the Vokril palettes carry vokril.com's colours.
189
199
 
190
200
  ## Internationalisation
191
201
 
@@ -1500,6 +1500,11 @@ export type IconColorVariant = (typeof ICON_COLOR_VARIANTS)[number];
1500
1500
  export declare const STATUS_RAIL_STYLES: readonly ["colorful", "normal"];
1501
1501
  export type StatusRailStyle = (typeof STATUS_RAIL_STYLES)[number];
1502
1502
  export type ThemeMode = 'light' | 'dark';
1503
+ /**
1504
+ * A design: colours, type and shape that belong together. `viper` is the dense desktop look
1505
+ * (rounded, Inter); `vokril` is the Vokril brand look (square, hairline, Manrope).
1506
+ */
1507
+ export type ThemeDesign = 'viper' | 'vokril';
1503
1508
  export interface ThemePalette {
1504
1509
  surface: string;
1505
1510
  surfaceAlt: string;
@@ -1527,6 +1532,8 @@ export interface ThemeOption {
1527
1532
  label: string;
1528
1533
  type: ThemeMode;
1529
1534
  palette: ThemePalette;
1535
+ /** The design the theme belongs to; a theme without one (high contrast) fits every design. */
1536
+ design?: ThemeDesign;
1530
1537
  }
1531
1538
  export interface UIFontOption {
1532
1539
  id: UIFontId;
@@ -1500,6 +1500,11 @@ export type IconColorVariant = (typeof ICON_COLOR_VARIANTS)[number];
1500
1500
  export declare const STATUS_RAIL_STYLES: readonly ["colorful", "normal"];
1501
1501
  export type StatusRailStyle = (typeof STATUS_RAIL_STYLES)[number];
1502
1502
  export type ThemeMode = 'light' | 'dark';
1503
+ /**
1504
+ * A design: colours, type and shape that belong together. `viper` is the dense desktop look
1505
+ * (rounded, Inter); `vokril` is the Vokril brand look (square, hairline, Manrope).
1506
+ */
1507
+ export type ThemeDesign = 'viper' | 'vokril';
1503
1508
  export interface ThemePalette {
1504
1509
  surface: string;
1505
1510
  surfaceAlt: string;
@@ -1527,6 +1532,8 @@ export interface ThemeOption {
1527
1532
  label: string;
1528
1533
  type: ThemeMode;
1529
1534
  palette: ThemePalette;
1535
+ /** The design the theme belongs to; a theme without one (high contrast) fits every design. */
1536
+ design?: ThemeDesign;
1530
1537
  }
1531
1538
  export interface UIFontOption {
1532
1539
  id: UIFontId;
@@ -0,0 +1 @@
1
+ "use strict";const ee=require("solid-js/web"),y=require("solid-js"),ne=require("./bugIndicatingError-D2X5Hfgg.cjs"),S=[{id:"viper-dark",label:"Viper Dark",type:"dark",design:"viper",palette:{surface:"#212329",surfaceAlt:"#181A1F",surfaceElevated:"#2D2F35",brand:"#808AE5",brandHover:"#707AD0",content:"#EBEDF0",contentSecondary:"#C7C9CE",border:"#2D2F35",input:"#181A1F",inputBorder:"#2D2F35",success:"#4FB772",error:"#E05D5A",warning:"#F0A945",info:"#55A8DB",syntaxKeyword:"#BC97E8",syntaxString:"#92C487",syntaxFunction:"#F0C77C",syntaxNumber:"#6FBCE3",syntaxType:"#76CDC5",syntaxComment:"#8F939F"}},{id:"viper-light",label:"Viper Light",type:"light",design:"viper",palette:{surface:"#FFFFFF",surfaceAlt:"#F3F4F8",surfaceElevated:"#FFFFFF",brand:"#5355D0",brandHover:"#4545B6",content:"#1C1E24",contentSecondary:"#5F636F",border:"#DFE1E7",input:"#FFFFFF",inputBorder:"#D0D2D9",success:"#048A45",error:"#C72C34",warning:"#C27400",info:"#007AB0",syntaxKeyword:"#7D3AB7",syntaxString:"#357426",syntaxFunction:"#895709",syntaxNumber:"#006A9D",syntaxType:"#007973",syntaxComment:"#696D79"}},{id:"vokril-dark",label:"Vokril Dark",type:"dark",design:"vokril",palette:{surface:"#121018",surfaceAlt:"#1C1925",surfaceElevated:"#121018",brand:"#8C75F2",brandHover:"#A593F6",content:"#F0EDF7",contentSecondary:"#A8A1B8",border:"#2C2838",input:"#1C1925",inputBorder:"#2C2838",success:"#4FB772",error:"#FF8A80",warning:"#F0A945",info:"#55A8DB",syntaxKeyword:"#BC97E8",syntaxString:"#92C487",syntaxFunction:"#F0C77C",syntaxNumber:"#6FBCE3",syntaxType:"#76CDC5",syntaxComment:"#8F939F"}},{id:"vokril-light",label:"Vokril Light",type:"light",design:"vokril",palette:{surface:"#FFFFFF",surfaceAlt:"#F3F1F7",surfaceElevated:"#FFFFFF",brand:"#593BD8",brandHover:"#4227B4",content:"#24212D",contentSecondary:"#5E596B",border:"#DEDBE5",input:"#FFFFFF",inputBorder:"#DEDBE5",success:"#048A45",error:"#B42318",warning:"#C27400",info:"#007AB0",syntaxKeyword:"#7D3AB7",syntaxString:"#357426",syntaxFunction:"#895709",syntaxNumber:"#006A9D",syntaxType:"#007973",syntaxComment:"#696D79"}},{id:"high-contrast-dark",label:"High Contrast Dark",type:"dark",palette:{surface:"#000000",surfaceAlt:"#000000",surfaceElevated:"#121212",brand:"#66B2FF",brandHover:"#99CCFF",content:"#FFFFFF",contentSecondary:"#E6E6E6",border:"#FFFFFF",input:"#000000",inputBorder:"#FFFFFF",success:"#57E389",error:"#FF7B72",warning:"#F0B429",info:"#66B2FF",syntaxKeyword:"#FF9999",syntaxString:"#99E699",syntaxFunction:"#FFE066",syntaxNumber:"#99CCFF",syntaxType:"#FFCC80",syntaxComment:"#B0B0B0"}},{id:"high-contrast-light",label:"High Contrast Light",type:"light",palette:{surface:"#FFFFFF",surfaceAlt:"#FFFFFF",surfaceElevated:"#FFFFFF",brand:"#0047BA",brandHover:"#003080",content:"#000000",contentSecondary:"#262626",border:"#000000",input:"#FFFFFF",inputBorder:"#000000",success:"#006622",error:"#B30000",warning:"#8C4600",info:"#0047BA",syntaxKeyword:"#8C0000",syntaxString:"#005C1F",syntaxFunction:"#4D2600",syntaxNumber:"#0047BA",syntaxType:"#0047BA",syntaxComment:"#404040"}}],$={viper:{dark:"viper-dark",light:"viper-light"},vokril:{dark:"vokril-dark",light:"vokril-light"}},re="viper-dark",te={darcula:"viper-dark",light:"viper-light"},oe=e=>te[e]??e;let _="viper";function Te(e){if(!Object.prototype.hasOwnProperty.call($,e))throw new Error(`Unknown theme design: ${String(e)}`);_=e}function Ae(){return _}function b(e="dark"){return $[_][e]}const v=[];function ve(e){return v.push(e),{dispose:()=>{const n=v.indexOf(e);n!==-1&&v.splice(n,1)}}}function ce(e){for(const n of v){const r=n.byId(e);if(r!==null)return r}return null}const se=e=>e.design===void 0||e.design===_,w=e=>S.find(n=>n.id===e);function T(e){const n=oe(e),r=w(n);return r&&!se(r)?w(b(r.type)):r??ce(n)??w(b())}function ie(){return[...S.filter(se),...v.flatMap(e=>e.options())]}function Se(e){const n=oe(e);return w(n)!==void 0||ce(n)!==null}const D=4.5,Ce=3;function Be(e){const n=e.trim().replace(/^#/,""),r=n.length===3?n.split("").map(t=>t+t).join(""):n;return r.length!==6||/[^0-9a-fA-F]/.test(r)?null:{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16)}}function we({r:e,g:n,b:r}){const t=o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0");return`#${t(e)}${t(n)}${t(r)}`}function P(e){const n=Be(e);if(!n)throw new ne.BugIndicatingError(`contrast: expected #rgb/#rrggbb, got ${JSON.stringify(e)}. Resolve var()/transparent/color-mix to a literal hex before measuring.`);return n}function L(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function C(e){const{r:n,g:r,b:t}=P(e);return .2126*L(n)+.7152*L(r)+.0722*L(t)}function h(e,n){const r=C(e),t=C(n),[o,c]=r>t?[r,t]:[t,r];return(o+.05)/(c+.05)}function Ie(e,n,r){const t=P(e),o=P(n),c=Math.max(0,Math.min(1,r));return we({r:t.r+(o.r-t.r)*(1-c),g:t.g+(o.g-t.g)*(1-c),b:t.b+(o.b-t.b)*(1-c)})}function x(e,n){return e+1e-9>=n}function De(e){const n=C(e);return 116*(n>(6/29)**3?Math.cbrt(n):n/(3*(6/29)**2)+4/29)-16}const N=e=>{const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)},_e=e=>(e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055)*255;function Me(e){const n=e.trim().replace(/^#/,""),r=n.length===3?n.split("").map(t=>t+t).join(""):n;if(r.length!==6||/[^0-9a-fA-F]/.test(r))throw new ne.BugIndicatingError(`oklch: expected #rgb/#rrggbb, got ${JSON.stringify(e)}`);return{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16)}}function Le(e){const{r:n,g:r,b:t}=Me(e),o=N(n),c=N(r),s=N(t),u=Math.cbrt(.4122214708*o+.5363325363*c+.0514459929*s),i=Math.cbrt(.2119034982*o+.6806995451*c+.1073969566*s),d=Math.cbrt(.0883024619*o+.2817188376*c+.6299787005*s),f=.2104542553*u+.793617785*i-.0040720468*d,m=1.9779984951*u-2.428592205*i+.4505937099*d,l=.0259040371*u+.7827717662*i-.808675766*d,g=Math.atan2(l,m)*180/Math.PI;return{l:f,c:Math.hypot(m,l),h:g<0?g+360:g}}function H({l:e,c:n,h:r}){const t=r*Math.PI/180,o=n*Math.cos(t),c=n*Math.sin(t),s=(e+.3963377774*o+.2158037573*c)**3,u=(e-.1055613458*o-.0638541728*c)**3,i=(e-.0894841775*o-1.291485548*c)**3;return{r:4.0767416621*s-3.3077115913*u+.2309699292*i,g:-1.2684380046*s+2.6097574011*u-.3413193965*i,b:-.0041960863*s-.7034186147*u+1.707614701*i}}const k=1e-4,X=({r:e,g:n,b:r})=>e>=-k&&e<=1+k&&n>=-k&&n<=1+k&&r>=-k&&r<=1+k;function Ne({l:e,c:n,h:r}){if(X(H({l:e,c:n,h:r})))return n;let t=0,o=n;for(let c=0;c<24;c++){const s=(t+o)/2;X(H({l:e,c:s,h:r}))?t=s:o=s}return t}function O(e){const n=Ne(e),r=H({...e,c:n}),t=o=>Math.max(0,Math.min(255,Math.round(_e(o)))).toString(16).padStart(2,"0");return`#${t(r.r)}${t(r.g)}${t(r.b)}`}function Y(e,n,r,t){const o=Le(e),c=t==="lighter"?1:0,s=O({...o,l:c});if(!x(h(s,n),r))return s;let u=o.l,i=c;for(let d=0;d<24;d++){const f=(u+i)/2;x(h(O({...o,l:f}),n),r)?i=f:u=f}return O({...o,l:i})}function G(e,n,r){if(x(h(e,n),r))return e;const t=C(e)<C(n),o=Y(e,n,r,t?"darker":"lighter");if(x(h(o,n),r))return o;const c=Y(e,n,r,t?"lighter":"darker");return h(c,n)>h(o,n)?c:o}function Oe(e,n,r){let t=e;for(let o=0;o<8;o++){let c=!1;for(const s of n){const u=G(t,s,r);u!==t&&(t=u,c=!0)}if(!c)break}return t}function Pe(e,n,r){let t=n[0]??"#ffffff",o=-1;for(const c of n){const s=h(c,e);if(x(s,r))return c;s>o&&(o=s,t=c)}return t}const ae="#2A2C31",ue="#1C1E23",de=.25,He=de;function le(e){return G(e.inputBorder,e.input,Ce)}function fe(e,n,r){const t=[n.surface,n.surfaceAlt,n.surfaceElevated];return r==="dark"&&t.push(ae,ue),t.flatMap(o=>[o,Ie(e,o,de)])}function ge(e,n,r){return Oe(e,fe(e,n,r),D)}const Ke=["error","brand","success","warning","info"],Re=60;function A(e){return x(h("#ffffff",e),D)||De(e)>=Re?e:G(e,"#ffffff",D)}function me(e,n){return Pe(e,["#ffffff",n.surfaceAlt,"#000000"],D)}const Ve=["brand","error","success","warning"],ye="#D76CB7",$e="data-colorblind-safe",K={success:"#009e73",error:"#d55e00",warning:"#e69f00",info:"#56b4e9"},R={added:K.success,deleted:K.error};function he(e){return{...e,...K}}function Ge(){return typeof document>"u"?!1:document.documentElement.hasAttribute($e)}function Fe(e,n,r){const t=d=>ge(d,e,n),o=A(e.brand),c=A(e.error),s=A(e.success),u=A(e.warning),i=d=>me(d,e);return{"--color-surface":e.surface,"--color-surface-alt":e.surfaceAlt,"--color-surface-elevated":e.surfaceElevated,"--color-brand":e.brand,"--color-brand-hover":e.brandHover,"--color-content":e.content,"--color-content-secondary":e.contentSecondary,"--color-border":e.border,"--color-input":e.input,"--color-input-border":le(e),"--color-success":e.success,"--color-error":e.error,"--color-warning":e.warning,"--color-info":e.info,"--color-success-text":t(e.success),"--color-error-text":t(e.error),"--color-warning-text":t(e.warning),"--color-info-text":t(e.info),"--color-brand-text":t(e.brand),"--color-unique-text":t(ye),"--color-brand-surface":o,"--color-error-surface":c,"--color-success-surface":s,"--color-warning-surface":u,"--color-on-brand":i(o),"--color-on-error":i(c),"--color-on-success":i(s),"--color-on-warning":i(u),"--color-diff-added":r?R.added:"","--color-diff-deleted":r?R.deleted:"","--color-syntax-keyword":e.syntaxKeyword,"--color-syntax-string":e.syntaxString,"--color-syntax-function":e.syntaxFunction,"--color-syntax-comment":e.syntaxComment,"--color-syntax-number":e.syntaxNumber,"--color-syntax-type":e.syntaxType}}const j="data-colorblind-safe",J="data-design";function W(e,n=!1){return T(e==="system"?b(n?"light":"dark"):e==="dark"?b("dark"):e==="light"?b("light"):e)}function be(e,n={}){var u,i;const r=typeof e=="string"?W(e):e,t=n.document??(typeof document<"u"?document:void 0);if(!t)return r;const o=t.documentElement,c=n.colorVisionSafe??!1;c?o.setAttribute(j,""):o.removeAttribute(j);const s=c?he(r.palette):r.palette;for(const[d,f]of Object.entries(Fe(s,r.type,c)))o.style.setProperty(d,f);return(u=t.body)==null||u.classList.remove("light","dark"),(i=t.body)==null||i.classList.add(r.type),o.classList.remove("light","dark"),o.classList.add(r.type),o.style.colorScheme=r.type,o.setAttribute("data-app-theme",r.id),r.design?o.setAttribute(J,r.design):o.removeAttribute(J),r}function We(){return ie()}const qe="vokril-ui-theme",Ue="(prefers-color-scheme: light)";function Xe(){try{return typeof localStorage>"u"?null:localStorage}catch{return null}}const pe=y.createContext(),Ye=e=>{var q,U;const n=e.storageKey===void 0?qe:e.storageKey,r=e.storage===void 0?Xe():e.storage,t=()=>{if(!r||!n)return null;try{return r.getItem(n)}catch{return null}},o=((q=e.document)==null?void 0:q.defaultView)??(typeof window>"u"?void 0:window),c=(U=o==null?void 0:o.matchMedia)==null?void 0:U.call(o,Ue),[s,u]=y.createSignal(t()??e.defaultTheme??"dark"),[i,d]=y.createSignal((c==null?void 0:c.matches)??!1),[f,m]=y.createSignal(e.colorVisionSafe??!1);if(c){const E=Ee=>d(Ee.matches);c.addEventListener("change",E),y.onCleanup(()=>c.removeEventListener("change",E))}const l=y.createMemo(()=>W(s(),i())),g=y.createMemo(()=>l().type),F=E=>{if(u(E),!(!r||!n))try{r.setItem(n,E)}catch{}},M=()=>F(g()==="dark"?"light":"dark");y.createEffect(()=>{be(l(),{colorVisionSafe:f(),document:e.document})});const xe={theme:s,resolvedTheme:g,themeId:()=>l().id,setTheme:F,toggleTheme:M,colorVisionSafe:f,setColorVisionSafe:m};return ee.createComponent(pe.Provider,{value:xe,get children(){return e.children}})};let z=!1;function je(){const e=y.useContext(pe);return e||(ee.isDev&&!z&&(z=!0,console.warn("@vokril/ui-solid: useTheme() was called outside <ThemeProvider>; it reports the design's dark theme and ignores setTheme.")),{theme:()=>"dark",resolvedTheme:()=>"dark",themeId:()=>b(),setTheme:()=>{},toggleTheme:()=>{},colorVisionSafe:()=>!1,setColorVisionSafe:()=>{}})}var Z;const Q=((Z=S.find(e=>e.id===re))==null?void 0:Z.palette)??S[0].palette;function Je(e){return Math.max(0,Math.min(255,Math.round(e)))}function V(e){const n=e.trim().replace(/^#/,""),r=n.length===3?n.split("").map(t=>t+t).join(""):n;return r.length!==6||/[^0-9a-fA-F]/.test(r)?null:{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16)}}function I({r:e,g:n,b:r}){const t=o=>Je(o).toString(16).padStart(2,"0");return`#${t(e)}${t(n)}${t(r)}`}function a(e,n="#000000"){const r=V(e);return r?I(r):n}function p(e,n,r){const t=V(e),o=V(n);if(!t&&!o)return"#000000";if(!t)return I(o);if(!o)return I(t);const c=Math.max(0,Math.min(1,r));return I({r:t.r+(o.r-t.r)*c,g:t.g+(o.g-t.g)*c,b:t.b+(o.b-t.b)*c})}const ze="#ffffff",Qe="#000000";function ke(e,n){return p(e,ze,n)}function Ze(e,n){return p(e,Qe,n)}function en(e,n,r){return n==="dark"?ke(e,r):Ze(e,r)}function B(e,n){return`${a(e)}${n}`}function nn(){if(typeof document>"u")return Q;const e=getComputedStyle(document.documentElement),n=(t,o)=>e.getPropertyValue(t).trim()||o,r=Q;return{surface:n("--color-surface",r.surface),surfaceAlt:n("--color-surface-alt",r.surfaceAlt),surfaceElevated:n("--color-surface-elevated",r.surfaceElevated),brand:n("--color-brand",r.brand),brandHover:n("--color-brand-hover",r.brandHover),content:n("--color-content",r.content),contentSecondary:n("--color-content-secondary",r.contentSecondary),border:n("--color-border",r.border),input:n("--color-input",r.input),inputBorder:n("--color-input-border",r.inputBorder),success:n("--color-success",r.success),error:n("--color-error",r.error),warning:n("--color-warning",r.warning),info:n("--color-info",r.info),syntaxKeyword:n("--color-syntax-keyword",r.syntaxKeyword),syntaxString:n("--color-syntax-string",r.syntaxString),syntaxFunction:n("--color-syntax-function",r.syntaxFunction),syntaxComment:n("--color-syntax-comment",r.syntaxComment),syntaxNumber:n("--color-syntax-number",r.syntaxNumber),syntaxType:n("--color-syntax-type",r.syntaxType)}}function rn(){return typeof document>"u"?"dark":document.body.classList.contains("light")?"light":"dark"}function tn(){return typeof document>"u"?"":document.documentElement.getAttribute("data-app-theme")??""}function on(e,n){const r=a(e.syntaxKeyword),t=a(e.syntaxString),o=a(e.syntaxFunction),c=a(e.syntaxComment),s=a(e.syntaxNumber),u=a(e.syntaxType),i=a(e.content),d=a(e.brand),f=a(e.error),m=[{token:"",foreground:i.slice(1)},{token:"comment",foreground:c.slice(1),fontStyle:"italic"},{token:"comment.quote",foreground:c.slice(1),fontStyle:"italic"},{token:"keyword",foreground:r.slice(1)},{token:"keyword.sql",foreground:r.slice(1)},{token:"operator",foreground:r.slice(1)},{token:"operator.sql",foreground:r.slice(1)},{token:"string",foreground:t.slice(1)},{token:"string.sql",foreground:t.slice(1)},{token:"string.escape",foreground:r.slice(1)},{token:"number",foreground:s.slice(1)},{token:"number.float",foreground:s.slice(1)},{token:"number.hex",foreground:s.slice(1)},{token:"constant",foreground:s.slice(1)},{token:"type",foreground:u.slice(1)},{token:"type.identifier",foreground:u.slice(1)},{token:"predefined",foreground:o.slice(1)},{token:"predefined.sql",foreground:o.slice(1)},{token:"function",foreground:o.slice(1)},{token:"identifier",foreground:i.slice(1)},{token:"identifier.quote",foreground:t.slice(1)},{token:"variable",foreground:i.slice(1)},{token:"delimiter",foreground:i.slice(1)},{token:"tag",foreground:r.slice(1)},{token:"attribute.name",foreground:o.slice(1)},{token:"attribute.value",foreground:t.slice(1)},{token:"annotation",foreground:e.warning.replace(/^#/,"")},{token:"regexp",foreground:f.slice(1)}],l=a(e.surfaceAlt),g=a(e.surface),F=a(e.surfaceElevated),M={"editor.background":l,"editor.foreground":i,"editorLineNumber.foreground":a(e.contentSecondary),"editorLineNumber.activeForeground":i,"editorCursor.foreground":d,"editor.selectionBackground":p(g,d,.32),"editor.inactiveSelectionBackground":p(g,d,.18),"editor.lineHighlightBackground":p(l,g,.55),"editorWidget.background":F,"editorWidget.foreground":i,"editorWidget.border":a(e.border),"editorWidget.resizeBorder":d,"input.background":a(e.input),"input.foreground":i,"input.border":a(e.inputBorder),"input.placeholderForeground":a(e.contentSecondary),"inputOption.activeBackground":B(d,"40"),"inputOption.activeBorder":d,"inputOption.activeForeground":i,focusBorder:d,"editor.findMatchBackground":B(a(e.warning),"80"),"editor.findMatchHighlightBackground":B(a(e.warning),"40"),"editor.findRangeHighlightBackground":B(F,"60")};return{base:n==="dark"?"vs-dark":"vs",inherit:!0,rules:m,colors:M}}function cn(e,n){const r=a(e.surface),t=a(e.surfaceElevated),o=a(e.content),c=a(e.contentSecondary),s=a(e.brand),u=a(e.error),i=a(e.success),d=a(e.warning),f=a(e.info),m=a(e.syntaxKeyword),l=F=>en(F,n,.22),g={black:t,red:u,green:i,yellow:d,blue:s,magenta:m,cyan:f,white:c,brightBlack:p(t,o,.4),brightRed:l(u),brightGreen:l(i),brightYellow:l(d),brightBlue:l(s),brightMagenta:l(m),brightCyan:l(f),brightWhite:n==="dark"?ke(o,.25):o};return{background:r,foreground:o,cursor:s,selectionBackground:p(t,s,.2),...g}}exports.DEFAULT_THEME_ID=re;exports.DESIGN_THEMES=$;exports.INK_ROLE_KEYS=Ve;exports.LEGACY_THEME_IDS=te;exports.MAX_TEXT_TINT_ALPHA=He;exports.OKABE_ITO_DIFF=R;exports.TEXT_ROLE_KEYS=Ke;exports.ThemeProvider=Ye;exports.UNIQUE_ACCENT=ye;exports.WELD_BG=ue;exports.WELD_SURFACE=ae;exports.accessibleFillSurface=A;exports.accessibleInputBorder=le;exports.accessibleOnFillInk=me;exports.accessibleTextColor=ge;exports.applyAppTheme=be;exports.derivePaletteProperties=Fe;exports.generateMonacoThemeFromPalette=on;exports.generateTerminalPaletteFromPalette=cn;exports.getDefaultThemeId=b;exports.getThemeById=T;exports.getThemeDesign=Ae;exports.getThemeOptions=ie;exports.getThemes=We;exports.isColorVisionSafeActive=Ge;exports.isKnownThemeId=Se;exports.readActiveAppPalette=nn;exports.readActiveAppThemeId=tn;exports.readActiveAppThemeType=rn;exports.registerThemeSource=ve;exports.resolveThemeOption=W;exports.setThemeDesign=Te;exports.textGroundsFor=fe;exports.themeOptions=S;exports.toColorVisionSafePalette=he;exports.useTheme=je;