@ui0/theme 0.0.0-stage → 0.1.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 (148) hide show
  1. package/README.md +113 -2
  2. package/dist/backdrop.module.css +1 -0
  3. package/dist/backdrop.scss +7 -0
  4. package/dist/color.inject.module.css +7 -0
  5. package/dist/color.module.css +3 -0
  6. package/dist/color.scss +84 -0
  7. package/dist/components/index.d.ts +4 -0
  8. package/dist/components/index.d.ts.map +1 -0
  9. package/dist/components/index.js +53 -0
  10. package/dist/components/style.css +1 -0
  11. package/dist/components/theme-provider.keys.d.ts +4 -0
  12. package/dist/components/theme-provider.keys.d.ts.map +1 -0
  13. package/dist/components/theme-provider.module.css +1 -0
  14. package/dist/components/theme-provider.types.d.ts +18 -0
  15. package/dist/components/theme-provider.types.d.ts.map +1 -0
  16. package/dist/components/theme-provider.vue.d.ts +19 -0
  17. package/dist/config.default.d.mts +4 -0
  18. package/dist/config.default.d.mts.map +1 -0
  19. package/dist/config.default.mjs +73 -0
  20. package/dist/config.default.mjs.map +1 -0
  21. package/dist/disabled.inject.module.css +5 -0
  22. package/dist/disabled.module.css +1 -0
  23. package/dist/disabled.scss +3 -0
  24. package/dist/display.module.css +2 -0
  25. package/dist/display.scss +63 -0
  26. package/dist/duration.scss +17 -0
  27. package/dist/elevation.module.css +33 -0
  28. package/dist/elevation.scss +46 -0
  29. package/dist/generate-BPYE5ALG.mjs +1037 -0
  30. package/dist/generate-BPYE5ALG.mjs.map +1 -0
  31. package/dist/generator/cli.d.mts +1 -0
  32. package/dist/generator/cli.mjs +103 -0
  33. package/dist/generator/cli.mjs.map +1 -0
  34. package/dist/generator/vite.d.mts +18 -0
  35. package/dist/generator/vite.d.mts.map +1 -0
  36. package/dist/generator/vite.mjs +117 -0
  37. package/dist/generator/vite.mjs.map +1 -0
  38. package/dist/index.d.mts +339 -0
  39. package/dist/index.d.mts.map +1 -0
  40. package/dist/index.mjs +909 -0
  41. package/dist/index.mjs.map +1 -0
  42. package/dist/is.scss +185 -0
  43. package/dist/load-config-64q6nzFy.mjs +48 -0
  44. package/dist/load-config-64q6nzFy.mjs.map +1 -0
  45. package/dist/ripple.scss +57 -0
  46. package/dist/round.inject.module.css +92 -0
  47. package/dist/round.module.css +14 -0
  48. package/dist/round.scss +90 -0
  49. package/dist/size.inject.module.css +50 -0
  50. package/dist/size.module.css +13 -0
  51. package/dist/size.scss +28 -0
  52. package/dist/theme.scss +16 -0
  53. package/dist/typography.inject.module.css +81 -0
  54. package/dist/typography.module.css +32 -0
  55. package/dist/typography.scss +21 -0
  56. package/dist/util.scss +78 -0
  57. package/dist/vars.scss +0 -0
  58. package/package.json +96 -4
  59. package/src/contracts/backdrop/backdrop.contract.ts +44 -0
  60. package/src/contracts/backdrop/backdrop.generator.ts +82 -0
  61. package/src/contracts/backdrop/backdrop.keys.ts +7 -0
  62. package/src/contracts/backdrop/backdrop.module.css +3 -0
  63. package/src/contracts/backdrop/backdrop.scss +7 -0
  64. package/src/contracts/backdrop/backdrop.types.ts +45 -0
  65. package/src/contracts/backdrop/index.ts +21 -0
  66. package/src/contracts/color/color.contract.spec.ts +75 -0
  67. package/src/contracts/color/color.contract.ts +97 -0
  68. package/src/contracts/color/color.generator.spec.ts +73 -0
  69. package/src/contracts/color/color.generator.ts +122 -0
  70. package/src/contracts/color/color.gradient.spec.ts +32 -0
  71. package/src/contracts/color/color.gradient.ts +52 -0
  72. package/src/contracts/color/color.inject.module.css +5 -0
  73. package/src/contracts/color/color.keys.ts +7 -0
  74. package/src/contracts/color/color.module.css +5 -0
  75. package/src/contracts/color/color.scss +84 -0
  76. package/src/contracts/color/color.serialize.spec.ts +57 -0
  77. package/src/contracts/color/color.serialize.ts +35 -0
  78. package/src/contracts/color/color.token.spec.ts +57 -0
  79. package/src/contracts/color/color.token.ts +89 -0
  80. package/src/contracts/color/color.types.ts +82 -0
  81. package/src/contracts/color/index.md +87 -0
  82. package/src/contracts/color/index.ts +25 -0
  83. package/src/contracts/contract.ts +115 -0
  84. package/src/contracts/disabled/disabled.contract.ts +32 -0
  85. package/src/contracts/disabled/disabled.generator.ts +32 -0
  86. package/src/contracts/disabled/disabled.inject.module.css +5 -0
  87. package/src/contracts/disabled/disabled.keys.ts +6 -0
  88. package/src/contracts/disabled/disabled.module.css +3 -0
  89. package/src/contracts/disabled/disabled.scss +3 -0
  90. package/src/contracts/disabled/disabled.types.ts +19 -0
  91. package/src/contracts/disabled/index.ts +21 -0
  92. package/src/contracts/display/display.contract.ts +41 -0
  93. package/src/contracts/display/display.generator.ts +57 -0
  94. package/src/contracts/display/display.instance.ts +173 -0
  95. package/src/contracts/display/display.keys.ts +9 -0
  96. package/src/contracts/display/display.module.css +4 -0
  97. package/src/contracts/display/display.scss +63 -0
  98. package/src/contracts/display/display.types.ts +75 -0
  99. package/src/contracts/display/index.ts +27 -0
  100. package/src/contracts/elevation/elevation.contract.ts +37 -0
  101. package/src/contracts/elevation/elevation.generator.ts +71 -0
  102. package/src/contracts/elevation/elevation.keys.ts +6 -0
  103. package/src/contracts/elevation/elevation.module.css +35 -0
  104. package/src/contracts/elevation/elevation.scss +46 -0
  105. package/src/contracts/elevation/elevation.types.ts +21 -0
  106. package/src/contracts/elevation/index.ts +20 -0
  107. package/src/contracts/generator.ts +38 -0
  108. package/src/contracts/index.md +48 -0
  109. package/src/contracts/index.ts +37 -0
  110. package/src/contracts/round/index.ts +21 -0
  111. package/src/contracts/round/round.contract.ts +75 -0
  112. package/src/contracts/round/round.generator.ts +33 -0
  113. package/src/contracts/round/round.inject.module.scss +36 -0
  114. package/src/contracts/round/round.keys.ts +7 -0
  115. package/src/contracts/round/round.module.css +16 -0
  116. package/src/contracts/round/round.scss +90 -0
  117. package/src/contracts/round/round.types.ts +44 -0
  118. package/src/contracts/size/index.ts +22 -0
  119. package/src/contracts/size/size.contract.ts +98 -0
  120. package/src/contracts/size/size.generator.spec.ts +101 -0
  121. package/src/contracts/size/size.generator.ts +51 -0
  122. package/src/contracts/size/size.inject.module.scss +12 -0
  123. package/src/contracts/size/size.keys.ts +8 -0
  124. package/src/contracts/size/size.module.css +15 -0
  125. package/src/contracts/size/size.scss +28 -0
  126. package/src/contracts/size/size.types.ts +63 -0
  127. package/src/contracts/size/units.scss +17 -0
  128. package/src/contracts/style/index.ts +11 -0
  129. package/src/contracts/style/style.generator.ts +36 -0
  130. package/src/contracts/style/style.key.ts +4 -0
  131. package/src/contracts/style/style.types.ts +16 -0
  132. package/src/contracts/typography/index.ts +26 -0
  133. package/src/contracts/typography/typography.contract.ts +52 -0
  134. package/src/contracts/typography/typography.generator.spec.ts +48 -0
  135. package/src/contracts/typography/typography.generator.ts +44 -0
  136. package/src/contracts/typography/typography.inject.module.css +54 -0
  137. package/src/contracts/typography/typography.keys.ts +12 -0
  138. package/src/contracts/typography/typography.module.css +36 -0
  139. package/src/contracts/typography/typography.scss +21 -0
  140. package/src/contracts/typography/typography.types.ts +90 -0
  141. package/src/generator/theme.default.css +657 -0
  142. package/src/styles/duration.scss +17 -0
  143. package/src/styles/index.md +18 -0
  144. package/src/styles/is.scss +185 -0
  145. package/src/styles/ripple.scss +57 -0
  146. package/src/styles/theme.scss +16 -0
  147. package/src/styles/util.scss +78 -0
  148. package/src/styles/vars.scss +0 -0
package/README.md CHANGED
@@ -1,3 +1,114 @@
1
- # Temporary Holding Version
1
+ # @ui0/theme — генерация темы
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Генератор CSS-тем из конфига. Три способа запуска: CLI, Vite-плагин и
4
+ библиотечный API (`generateThemeCss(config)`). Ниже — первые два.
5
+
6
+ ## Конфиг
7
+
8
+ По умолчанию ищется в корне проекта (`--cwd` / Vite root) под именем
9
+ `ui0.config.ts` или `ui0-theme.config.ts`, default-экспорт — `ThemeConfig`:
10
+
11
+ ```ts
12
+ import type { ThemeConfig } from '@ui0/theme'
13
+
14
+ export default {
15
+ default: {
16
+ // твоя базовая линия (не обязательно)
17
+ controls: { controlSize: '40px' }
18
+ },
19
+ playground: {
20
+ // каждая тема -> класс .theme-playground
21
+ colors: {
22
+ brand: ['#6a5cff', 4], // база + 4 lighten/darken-ступени
23
+ accent: ['#02a694', 4, ['c', 's']], // + contrast/shade рампы
24
+ sea: [['#0d654e', '#000', 50], 3] // бленд 50% + рампа
25
+ },
26
+ dark: { background: '#0b0b0b' }, // перекрытия схемы
27
+ light: { background: '#fff' }
28
+ // typography / roundings / density / durations / settings / extends ...
29
+ }
30
+ } satisfies ThemeConfig
31
+ ```
32
+
33
+ Слияние с дефолтами (`withDefaults`, вызывается CLI и плагином самостоятельно):
34
+ каждая тема получает недостающие токены из твоего `default` (если объявлен),
35
+ а тот, в свою очередь, — из встроенного `config.default.ts`. Приоритет:
36
+ **тема > твой `default` > встроенный default**. Без конфига генерируется
37
+ только встроенный default.
38
+
39
+ ## Способ 1: терминал (CLI)
40
+
41
+ ```bash
42
+ # в проекте-потребителе (пакет установлен):
43
+ pnpm ui0-theme # ui0.config.ts -> src/assets/theme.css
44
+ pnpm ui0-theme -w # то же + пересборка при правке конфига
45
+
46
+ # в этом монорепо (из корня):
47
+ node packages/theme/dist/generator/cli.mjs --cwd playground
48
+ ```
49
+
50
+ Флаги:
51
+
52
+ | флаг | значение |
53
+ | --------------------- | ------------------------------------------------- |
54
+ | `-c, --config <path>` | явный путь к конфигу (иначе авто-поиск) |
55
+ | `-o, --out <path>` | куда писать CSS (default: `src/assets/theme.css`) |
56
+ | `-w, --watch` | пересборка при изменении конфига |
57
+ | `--cwd <dir>` | корень проекта (default: текущая директория) |
58
+ | `-h, --help` | справка |
59
+
60
+ ## Способ 2: Vite-плагин
61
+
62
+ ```ts
63
+ // vite.config.ts
64
+ import ui0Theme from '@ui0/theme/vite'
65
+
66
+ export default defineConfig({
67
+ plugins: [ui0Theme({ out: 'src/assets/theme.css' })]
68
+ })
69
+ ```
70
+
71
+ Три режима потребления:
72
+
73
+ 1. **Файл (`out`)** — плагин пишет CSS в `out` и рядом `.d.ts`
74
+ (типизирует `name`/`appearance` у ThemeProvider через глобальные
75
+ `Ui0ThemeNames` / `Ui0ThemeSchemeNames`). Импортируй как обычный css.
76
+ 2. **Виртуальный CSS** (без `out`): `import 'virtual:ui0-theme.css'` —
77
+ CSS идёт через пайплайн Vite (HMR, ассет на билде).
78
+ 3. **Виртуальный JS**: `import { applyUi0Theme } from 'virtual:ui0-theme'` —
79
+ модуль со строкой CSS; `applyUi0Theme()` сам вставляет `<style>`, когда
80
+ приложение решает применить тему (например, после чтения сохранённой
81
+ схемы, до первой отрисовки).
82
+
83
+ Опции: `config` (явный путь к конфигу) и `out`. Правка конфига пересобирает
84
+ тему на лету: в режиме `out` — перезапись файла, в виртуальных — full-reload.
85
+
86
+ ## Контракты пропов (dist-артефакты)
87
+
88
+ Каждый контракт (`size`, `color`, `round`, `backdrop`, `elevation`, `disabled`)
89
+ собирается в два dist-файла (`scripts/build-contracts.ts`, часть `theme:build`):
90
+
91
+ - `@use '@ui0/theme/size'` → `dist/size.scss` — scss-миксины контракта;
92
+ - `@value sized, sizeM from '@ui0/theme/size.module.css'` →
93
+ `dist/size.module.css` — `@value className: classHash;` на класс:
94
+ имена вида `si_81de` (детерминированный хеш от имени класса), совпадают с
95
+ теми, что получают TS-импорты контрактных `*.module.css`.
96
+
97
+ Работу делает плагин `@ui0/vite/css-modules`
98
+ (`ui0CssModulesHash`, в tsdown/vitest-конфигах theme; standalone-обёртка —
99
+ `scripts/build-contracts.ts`). Тот же плагин подключается к пакетам
100
+ компонентов: `ui0CssModulesHash({ entries: ['src/components'] })` —
101
+ каждая папка с `<component>.module.css` соберётся в такие же dist-артефакты.
102
+ Общие scss-утилиты (`src/styles`) дистиллируются туда же (`extraScss`) и
103
+ импортируются так же: `@use '@ui0/theme/is' as is; @use '@ui0/theme/theme';`.
104
+
105
+ ## Разработка пакета
106
+
107
+ ```bash
108
+ pnpm gen:theme-default # зеркало встроенной темы (src/generator/theme.default.css)
109
+ pnpm gen:theme-contracts # dist-артефакты контрактов (dist/<name>.scss + .module.css)
110
+ ```
111
+
112
+ Скрипты применяются автоматически: `prepare` (после install), `theme:build`
113
+ (gen-theme-default → tsdown → build-contracts). Проверки: `theme:test`,
114
+ `theme:typecheck`. См. `src/index.md` — карта файлов.
@@ -0,0 +1 @@
1
+ @value backdrop: ba_d486;
@@ -0,0 +1,7 @@
1
+ // the backdrop contract's scss endpoint: apply any backdrop-filter function
2
+ // with the configured default (mirrors the generated setter classes).
3
+ @mixin use($function: blur, $value: var(--0-backdrop-blur, 4px)) {
4
+ backdrop-filter: #{$function}(#{$value});
5
+ -webkit-backdrop-filter: #{$function}(#{$value});
6
+ will-change: backdrop-filter;
7
+ }
@@ -0,0 +1,7 @@
1
+ @value colored: co_ca8c;
2
+ @value filled: fi_8a2f;
3
+ @value gradiented: gr_9658;
4
+
5
+ .co_ca8c { /* slot marker */ }
6
+ .fi_8a2f { /* slot marker */ }
7
+ .gr_9658 { /* slot marker */ }
@@ -0,0 +1,3 @@
1
+ @value colored: co_ca8c;
2
+ @value filled: fi_8a2f;
3
+ @value gradiented: gr_9658;
@@ -0,0 +1,84 @@
1
+ // Composed component slots + the opacity selection bridges.
2
+ //
3
+ // The deal delivers every opacity context as an ELEMENT INLINE var:
4
+ // --0-{c|f}-src ungated (both schemes, no pseudo)
5
+ // --0-{c|f}-src-l|-d scheme only
6
+ // --0-{c|f}-src-{hover|active|focus} pseudo only
7
+ // --0-{c|f}-src-{l|d}-{hover|active|focus} scheme + pseudo
8
+ // Inline styles are unconditional - only a stylesheet can select by scheme
9
+ // or pseudo state, so use() emits the picker: per context a rule re-declares
10
+ // the selected --0-{c|f}-o, and the composed cur reads it. src vars are
11
+ // reset to `initial` per element so a translucent parent does not paint its
12
+ // children (custom property `initial` is guaranteed-invalid, so var()
13
+ // fallbacks keep working). The generated theme css carries NO opacity rules.
14
+ @mixin use {
15
+ @include _slot('c');
16
+ @include _slot('f');
17
+ // gradients arrive as an element inline style - redeclare to stop them
18
+ // inheriting into children (initial = no background-image)
19
+ --0-g-cur: initial;
20
+ }
21
+ @mixin use-state {
22
+ }
23
+
24
+ @mixin _slot($x) {
25
+ // context sources (set inline by the contract; initial = unset)
26
+ --0-#{$x}-src: initial;
27
+ --0-#{$x}-src-l: initial;
28
+ --0-#{$x}-src-d: initial;
29
+ --0-#{$x}-src-hover: initial;
30
+ --0-#{$x}-src-active: initial;
31
+ --0-#{$x}-src-focus: initial;
32
+ --0-#{$x}-src-l-hover: initial;
33
+ --0-#{$x}-src-l-active: initial;
34
+ --0-#{$x}-src-l-focus: initial;
35
+ --0-#{$x}-src-d-hover: initial;
36
+ --0-#{$x}-src-d-active: initial;
37
+ --0-#{$x}-src-d-focus: initial;
38
+
39
+ // selection bridges - the fallback chain never crosses schemes: a
40
+ // scheme-tagged source applies to that scheme only, the default is 1.
41
+ // :global(...) keeps the theme's scheme classes unscoped - component
42
+ // module styles hash every bare class literal.
43
+ --0-#{$x}-o: var(--0-#{$x}-src, var(--0-#{$x}-src-l, 1));
44
+ --0-#{$x}-cur: rgb(var(--0-#{$x}-cur-v) / var(--0-#{$x}-o));
45
+ :global(.theme_dark) & {
46
+ --0-#{$x}-o: var(--0-#{$x}-src-d, var(--0-#{$x}-src, 1));
47
+ }
48
+ &:hover {
49
+ --0-#{$x}-o: var(--0-#{$x}-src-hover, var(--0-#{$x}-src, var(--0-#{$x}-src-l, 1)));
50
+ }
51
+ &:active {
52
+ --0-#{$x}-o: var(--0-#{$x}-src-active, var(--0-#{$x}-src, var(--0-#{$x}-src-l, 1)));
53
+ }
54
+ &:focus {
55
+ --0-#{$x}-o: var(--0-#{$x}-src-focus, var(--0-#{$x}-src, var(--0-#{$x}-src-l, 1)));
56
+ }
57
+ :global(.theme_dark) &:hover {
58
+ --0-#{$x}-o: var(--0-#{$x}-src-d-hover, var(--0-#{$x}-src-hover, var(--0-#{$x}-src-d, var(--0-#{$x}-src, 1))));
59
+ }
60
+ :global(.theme_dark) &:active {
61
+ --0-#{$x}-o: var(--0-#{$x}-src-d-active, var(--0-#{$x}-src-active, var(--0-#{$x}-src-d, var(--0-#{$x}-src, 1))));
62
+ }
63
+ :global(.theme_dark) &:focus {
64
+ --0-#{$x}-o: var(--0-#{$x}-src-d-focus, var(--0-#{$x}-src-focus, var(--0-#{$x}-src-d, var(--0-#{$x}-src, 1))));
65
+ }
66
+ }
67
+
68
+ @mixin color {
69
+ color: var(--0-c-cur);
70
+ }
71
+
72
+ @mixin fill {
73
+ background-color: var(--0-f-cur);
74
+ }
75
+
76
+ @mixin gradient {
77
+ background-image: var(--0-g-cur);
78
+ }
79
+
80
+ @mixin apply {
81
+ @include color();
82
+ @include fill();
83
+ @include gradient();
84
+ }
@@ -0,0 +1,4 @@
1
+ export { default as ThemeProvider } from './theme-provider.vue';
2
+ export * from './theme-provider.keys';
3
+ export type * from './theme-provider.types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC/D,cAAc,uBAAuB,CAAA;AACrC,mBAAmB,wBAAwB,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { defineComponent as i, useAttrs as m, useCssModule as d, reactive as u, computed as h, openBlock as f, createBlock as _, unref as n, normalizeClass as v, withCtx as y, renderSlot as g, normalizeProps as P, guardReactiveProps as k } from "vue";
2
+ import { provideHost as x } from "@ui0/composable";
3
+ import { Slot as C } from "@ui0/core";
4
+ const M = Symbol("ThemeProviderKey"), S = /* @__PURE__ */ i({
5
+ inheritAttrs: !1,
6
+ __name: "theme-provider",
7
+ props: {
8
+ appearance: {},
9
+ preset: {}
10
+ },
11
+ setup(s, { expose: a }) {
12
+ const t = s, o = m(), p = d(), e = u({
13
+ provided: !0,
14
+ appearance: "light",
15
+ preset: "default"
16
+ });
17
+ t.preset && (e.preset = t.preset), t.appearance && (e.appearance = t.appearance);
18
+ const l = h(
19
+ () => e.provided ? [p.theme, "theme-" + e.preset, "theme_" + e.appearance] : []
20
+ ), c = {
21
+ appearance(r) {
22
+ e.appearance = r;
23
+ },
24
+ preset(r) {
25
+ e.preset = r;
26
+ },
27
+ toggle() {
28
+ e.appearance = e.appearance === "dark" ? "light" : "dark";
29
+ }
30
+ };
31
+ return x(M, c), a(c), (r, A) => (f(), _(n(C), {
32
+ class: v([...l.value, n(o).class])
33
+ }, {
34
+ default: y(() => [
35
+ g(r.$slots, "default", P(k(c)))
36
+ ]),
37
+ _: 3
38
+ }, 8, ["class"]));
39
+ }
40
+ }), T = "th_3cb8", $ = {
41
+ theme: T
42
+ }, b = (s, a) => {
43
+ const t = s.__vccOpts || s;
44
+ for (const [o, p] of a)
45
+ t[o] = p;
46
+ return t;
47
+ }, z = {
48
+ $style: $
49
+ }, H = /* @__PURE__ */ b(S, [["__cssModules", z]]);
50
+ export {
51
+ H as ThemeProvider,
52
+ M as ThemeProviderKey
53
+ };
@@ -0,0 +1 @@
1
+ @layer theme,ui0,ui0.theme-provider;@layer ui0.theme-provider{.th_3cb8{--0-c-src: initial;--0-c-src-l: initial;--0-c-src-d: initial;--0-c-src-hover: initial;--0-c-src-active: initial;--0-c-src-focus: initial;--0-c-src-l-hover: initial;--0-c-src-l-active: initial;--0-c-src-l-focus: initial;--0-c-src-d-hover: initial;--0-c-src-d-active: initial;--0-c-src-d-focus: initial;--0-c-o: var(--0-c-src, var(--0-c-src-l, 1));--0-c-cur: rgb(var(--0-c-cur-v) / var(--0-c-o))}.theme_dark .th_3cb8{--0-c-o: var(--0-c-src-d, var(--0-c-src, 1))}.th_3cb8:hover{--0-c-o: var(--0-c-src-hover, var(--0-c-src, var(--0-c-src-l, 1)))}.th_3cb8:active{--0-c-o: var(--0-c-src-active, var(--0-c-src, var(--0-c-src-l, 1)))}.th_3cb8:focus{--0-c-o: var(--0-c-src-focus, var(--0-c-src, var(--0-c-src-l, 1)))}.theme_dark .th_3cb8:hover{--0-c-o: var(--0-c-src-d-hover, var(--0-c-src-hover, var(--0-c-src-d, var(--0-c-src, 1))))}.theme_dark .th_3cb8:active{--0-c-o: var(--0-c-src-d-active, var(--0-c-src-active, var(--0-c-src-d, var(--0-c-src, 1))))}.theme_dark .th_3cb8:focus{--0-c-o: var(--0-c-src-d-focus, var(--0-c-src-focus, var(--0-c-src-d, var(--0-c-src, 1))))}.th_3cb8{--0-f-src: initial;--0-f-src-l: initial;--0-f-src-d: initial;--0-f-src-hover: initial;--0-f-src-active: initial;--0-f-src-focus: initial;--0-f-src-l-hover: initial;--0-f-src-l-active: initial;--0-f-src-l-focus: initial;--0-f-src-d-hover: initial;--0-f-src-d-active: initial;--0-f-src-d-focus: initial;--0-f-o: var(--0-f-src, var(--0-f-src-l, 1));--0-f-cur: rgb(var(--0-f-cur-v) / var(--0-f-o))}.theme_dark .th_3cb8{--0-f-o: var(--0-f-src-d, var(--0-f-src, 1))}.th_3cb8:hover{--0-f-o: var(--0-f-src-hover, var(--0-f-src, var(--0-f-src-l, 1)))}.th_3cb8:active{--0-f-o: var(--0-f-src-active, var(--0-f-src, var(--0-f-src-l, 1)))}.th_3cb8:focus{--0-f-o: var(--0-f-src-focus, var(--0-f-src, var(--0-f-src-l, 1)))}.theme_dark .th_3cb8:hover{--0-f-o: var(--0-f-src-d-hover, var(--0-f-src-hover, var(--0-f-src-d, var(--0-f-src, 1))))}.theme_dark .th_3cb8:active{--0-f-o: var(--0-f-src-d-active, var(--0-f-src-active, var(--0-f-src-d, var(--0-f-src, 1))))}.theme_dark .th_3cb8:focus{--0-f-o: var(--0-f-src-d-focus, var(--0-f-src-focus, var(--0-f-src-d, var(--0-f-src, 1))))}.th_3cb8{--0-g-cur: initial;color:var(--0-c-cur);background-color:var(--0-f-cur);background-image:var(--0-g-cur);font-size:var(--0-fs-m)}}
@@ -0,0 +1,4 @@
1
+ import { InjectionKey } from 'vue';
2
+ import { ThemeProviderActions } from './theme-provider.types';
3
+ export declare const ThemeProviderKey: InjectionKey<ThemeProviderActions>;
4
+ //# sourceMappingURL=theme-provider.keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-provider.keys.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider/theme-provider.keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAEvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE,eAAO,MAAM,gBAAgB,EAAiC,YAAY,CAAC,oBAAoB,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ @value theme: th_3cb8;
@@ -0,0 +1,18 @@
1
+ import { Ui0ThemeName, Ui0ThemeSchemeName, ThemeAppearance, ThemePresetName } from '@ui0/types';
2
+ export interface ThemeProviderProps extends ThemeProviderDefaults {
3
+ /** theme appearance — typed to generated Ui0ThemeSchemeNames */
4
+ appearance?: Ui0ThemeSchemeName;
5
+ /** preset name — typed to generated Ui0ThemeNames */
6
+ preset?: Ui0ThemeName;
7
+ }
8
+ export interface ThemeProviderDefaults {
9
+ }
10
+ export interface ThemeProviderActions {
11
+ toggle: () => void;
12
+ appearance: (d: ThemeAppearance) => void;
13
+ preset: (d: ThemePresetName) => void;
14
+ }
15
+ export interface ThemeProviderSlots {
16
+ default: (actions: ThemeProviderActions) => void;
17
+ }
18
+ //# sourceMappingURL=theme-provider.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-provider.types.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider/theme-provider.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAElE,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,gEAAgE;IAChE,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,qDAAqD;IACrD,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB;AAED,MAAM,WAAW,qBAAqB;CAAG;AAEzC,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,UAAU,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;IACxC,MAAM,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,CAAA;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAA;CACjD"}
@@ -0,0 +1,19 @@
1
+ import { ComponentOptionsMixin, DefineComponent, PublicProps, SlotsType } from 'vue';
2
+ import { ThemeProviderActions, ThemeProviderProps, ThemeProviderSlots } from './theme-provider.types';
3
+ declare const ThemeProvider: DefineComponent<
4
+ ThemeProviderProps,
5
+ {},
6
+ {},
7
+ {},
8
+ {},
9
+ ComponentOptionsMixin,
10
+ ComponentOptionsMixin,
11
+ {},
12
+ string,
13
+ PublicProps,
14
+ Readonly<ThemeProviderProps> & Readonly<{}>,
15
+ {},
16
+ SlotsType<ThemeProviderSlots>
17
+ >
18
+ export default ThemeProvider
19
+ export type { ThemeProviderActions }
@@ -0,0 +1,4 @@
1
+ import { ThemePluginConfig } from "@ui0/types";
2
+ declare const config: ThemePluginConfig;
3
+ export { config as default };
4
+ //# sourceMappingURL=config.default.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.default.d.mts","names":[],"sources":["../src/config.default.ts"],"mappings":";cAKM,QAAQ"}
@@ -0,0 +1,73 @@
1
+ // src/config.default.ts
2
+ const config = {
3
+ default: "default",
4
+ contracts: {
5
+ backdrop: {},
6
+ color: {},
7
+ round: { baseline: "height" },
8
+ typography: {
9
+ fontSize: 20,
10
+ fontSizeHeading: 22,
11
+ headingRatio: 1.2
12
+ },
13
+ display: { breakpoints: {
14
+ xxs: 320,
15
+ xs: 480,
16
+ sm: 640,
17
+ md: 832,
18
+ lg: 1024,
19
+ hd: 1280,
20
+ xl: 1440,
21
+ xxl: 1680,
22
+ fhd: 1920,
23
+ qhd: 2560,
24
+ uhd: 3840
25
+ } }
26
+ },
27
+ presets: { default: {
28
+ default: {
29
+ style: {
30
+ raw: { framework: "ui0" },
31
+ vars: { version: "1.0.0" }
32
+ },
33
+ size: {
34
+ control: "32px",
35
+ child: "26px"
36
+ },
37
+ backdrop: {
38
+ blur: "4px",
39
+ brightness: .5,
40
+ contrast: .5,
41
+ "drop-shadow": "0 4px 8px rgba(0, 0, 0, 0.5)",
42
+ grayscale: 1,
43
+ "hue-rotate": "90deg",
44
+ invert: 1,
45
+ opacity: "0.5",
46
+ saturate: "0.5",
47
+ sepia: "1"
48
+ },
49
+ elevation: { steps: 16 },
50
+ color: {
51
+ foreground: "#000",
52
+ background: "#FFF",
53
+ success: "#388822",
54
+ error: "#884622",
55
+ warning: "#ffb921",
56
+ highlight: "#16e3c5",
57
+ white: "#FFF",
58
+ black: "#000"
59
+ }
60
+ },
61
+ light: { color: {
62
+ foreground: "#000",
63
+ background: "#FFF"
64
+ } },
65
+ dark: { color: {
66
+ foreground: "#FFF",
67
+ background: "#000"
68
+ } }
69
+ } }
70
+ };
71
+ export { config as default };
72
+
73
+ //# sourceMappingURL=config.default.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.default.mjs","names":[],"sources":["../src/config.default.ts"],"sourcesContent":["import type { ThemePluginConfig } from '@ui0/types'\n\n// The built-in default theme. Every setting a consumer preset can omit has a\n// baseline here (merged UNDER each preset by withDefaults), so the generated\n// mirror (theme.default.css) always provides a coherent --0-* set.\nconst config: ThemePluginConfig = {\n default: 'default',\n contracts: {\n backdrop: {\n // 'drop-shadow': false,\n // 'hue-rotate': false\n },\n color: {},\n round: {\n baseline: 'height'\n },\n typography: {\n fontSize: 20,\n fontSizeHeading: 22,\n headingRatio: 1.2\n },\n display: {\n breakpoints: {\n xxs: 320,\n xs: 480,\n sm: 640,\n md: 832,\n lg: 1024,\n hd: 1280,\n xl: 1440,\n xxl: 1680,\n fhd: 1920,\n qhd: 2560,\n uhd: 3840\n }\n }\n },\n presets: {\n default: {\n default: {\n style: {\n raw: {\n framework: 'ui0'\n },\n vars: {\n version: '1.0.0'\n }\n },\n size: {\n control: '32px',\n child: '26px'\n },\n backdrop: {\n blur: '4px',\n brightness: 0.5,\n contrast: 0.5,\n 'drop-shadow': '0 4px 8px rgba(0, 0, 0, 0.5)',\n grayscale: 1,\n 'hue-rotate': '90deg',\n invert: 1,\n opacity: '0.5',\n saturate: '0.5',\n sepia: '1'\n },\n elevation: {\n steps: 16\n },\n color: {\n foreground: '#000',\n background: '#FFF',\n success: '#388822',\n error: '#884622',\n warning: '#ffb921',\n highlight: '#16e3c5',\n white: '#FFF',\n black: '#000'\n }\n },\n light: {\n color: {\n foreground: '#000',\n background: '#FFF'\n }\n },\n dark: {\n color: {\n foreground: '#FFF',\n background: '#000'\n }\n }\n }\n }\n}\nexport default config\n"],"mappings":";AAKA,MAAM,SAA4B;CAChC,SAAS;CACT,WAAW;EACT,UAAU,CAGV;EACA,OAAO,CAAC;EACR,OAAO,EACL,UAAU,SACZ;EACA,YAAY;GACV,UAAU;GACV,iBAAiB;GACjB,cAAc;EAChB;EACA,SAAS,EACP,aAAa;GACX,KAAK;GACL,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,KAAK;GACL,KAAK;GACL,KAAK;GACL,KAAK;EACP,EACF;CACF;CACA,SAAS,EACP,SAAS;EACP,SAAS;GACP,OAAO;IACL,KAAK,EACH,WAAW,MACb;IACA,MAAM,EACJ,SAAS,QACX;GACF;GACA,MAAM;IACJ,SAAS;IACT,OAAO;GACT;GACA,UAAU;IACR,MAAM;IACN,YAAY;IACZ,UAAU;IACV,eAAe;IACf,WAAW;IACX,cAAc;IACd,QAAQ;IACR,SAAS;IACT,UAAU;IACV,OAAO;GACT;GACA,WAAW,EACT,OAAO,GACT;GACA,OAAO;IACL,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,OAAO;IACP,SAAS;IACT,WAAW;IACX,OAAO;IACP,OAAO;GACT;EACF;EACA,OAAO,EACL,OAAO;GACL,YAAY;GACZ,YAAY;EACd,EACF;EACA,MAAM,EACJ,OAAO;GACL,YAAY;GACZ,YAAY;EACd,EACF;CACF,EACF;AACF"}
@@ -0,0 +1,5 @@
1
+ @value disabled: di_17eb;
2
+
3
+ .di_17eb {
4
+ opacity: var(--0-dis-o, 0.5);
5
+ }
@@ -0,0 +1 @@
1
+ @value disabled: di_17eb;
@@ -0,0 +1,3 @@
1
+ @mixin filter {
2
+ filter: grayscale(80%) opacity(70%);
3
+ }
@@ -0,0 +1,2 @@
1
+ @value displayed: di_e228;
2
+ @value displayNormal: di_bf77;
@@ -0,0 +1,63 @@
1
+
2
+ // Component-namespace wiring for the display contract: the generator emits
3
+ // `--0-display-base` on the theme blocks; this mixin mirrors it into the
4
+ // component namespace so a component can consume (and locally override) it.
5
+ @mixin use() {
6
+ --0c-display: var(--0-display-base, initial);
7
+ }
8
+
9
+ @mixin wh($width, $height) {
10
+ $max-w: ' and (max-width: #{$width})';
11
+ $max-h: ' and (max-height: #{$height})';
12
+ @media only screen#{$max-h}#{$max-w} {
13
+ @content;
14
+ }
15
+ }
16
+ @mixin w-between($max, $min) {
17
+ $min-w: ' and (min-width: #{$min})';
18
+ $max-w: ' and (max-width: #{$max})';
19
+ @if $max == 0 and $min == 0 {
20
+ } @else {
21
+ @if $max == 0 {
22
+ $max-w: ' ';
23
+ }
24
+ @media only screen#{$min-w}#{$max-w} {
25
+ @content;
26
+ }
27
+ }
28
+ }
29
+
30
+ @mixin w-greater($val) {
31
+ @include w-between(0, $val) {
32
+ @content;
33
+ }
34
+ }
35
+
36
+ @mixin w-less($val) {
37
+ @include w-between($val, 0) {
38
+ @content;
39
+ }
40
+ }
41
+ @mixin h-between($max, $min) {
42
+ $minh: ' and (min-height: #{$min})';
43
+ $maxh: ' and (max-height: #{$max})';
44
+ @if $max == 0 and $min == 0 {
45
+ } @else {
46
+ @if $max == 0 {
47
+ $maxh: ' ';
48
+ }
49
+ @media only screen#{$minh}#{$maxh} {
50
+ @content;
51
+ }
52
+ }
53
+ }
54
+ @mixin h-greater($val) {
55
+ @include h-between(0, $val) {
56
+ @content;
57
+ }
58
+ }
59
+ @mixin h-less($val) {
60
+ @include h-between($val, 0) {
61
+ @content;
62
+ }
63
+ }
@@ -0,0 +1,17 @@
1
+ @mixin use {
2
+ --0-d-superfast: 40ms;
3
+ --0-d-faster: 75ms;
4
+ --0-d-fast: 90ms;
5
+ --0-d-gently: 144ms;
6
+ --0-d-basic: 200ms;
7
+ --0-d-slow: 400ms;
8
+ --0-d-superslow: 1000ms;
9
+ }
10
+
11
+ $duration-superfast: var(--0-d-superfast);
12
+ $duration-faster: var(--0-d-faster);
13
+ $duration-fast: var(--0-d-fast);
14
+ $duration-gently: var(--0-d-gently);
15
+ $duration-basic: var(--0-d-basic);
16
+ $duration-slow: var(--0-d-slow);
17
+ $duration-superslow: var(--0-d-superslow);
@@ -0,0 +1,33 @@
1
+ @value elv: el_b4e0;
2
+ @value elv1: el_5e0f;
3
+ @value elv1n: el_5995;
4
+ @value elv2: el_fb8f;
5
+ @value elv2n: el_af23;
6
+ @value elv3: el_8867;
7
+ @value elv3n: el_6c3d;
8
+ @value elv4: el_4d5e;
9
+ @value elv4n: el_a211;
10
+ @value elv5: el_1ab1;
11
+ @value elv5n: el_2df9;
12
+ @value elv6: el_56bd;
13
+ @value elv6n: el_b036;
14
+ @value elv7: el_61ea;
15
+ @value elv7n: el_8003;
16
+ @value elv8: el_8924;
17
+ @value elv8n: el_7bc0;
18
+ @value elv9: el_1bb1;
19
+ @value elv9n: el_734f;
20
+ @value elv10: el_40d4;
21
+ @value elv10n: el_ef94;
22
+ @value elv11: el_a016;
23
+ @value elv11n: el_fcd8;
24
+ @value elv12: el_1c39;
25
+ @value elv12n: el_ba0c;
26
+ @value elv13: el_5602;
27
+ @value elv13n: el_d306;
28
+ @value elv14: el_3f15;
29
+ @value elv14n: el_ece8;
30
+ @value elv15: el_3130;
31
+ @value elv15n: el_5599;
32
+ @value elv16: el_c651;
33
+ @value elv16n: el_f2d2;
@@ -0,0 +1,46 @@
1
+ // Elevation: ONE base class carries the box-shadow assembled from the
2
+ // --0-elv-* css vars; the per-step classes (.elv1..$steps, .elv1n..stepsn for
3
+ // inset) only fill in the var values for their step - no shadow math is
4
+ // repeated per class. This file mirrors what elevation.generator.ts emits
5
+ // (the generator compiles this pattern with $steps from the theme config).
6
+
7
+ // the shared shadow: a fixed highlight ring + three layers assembled from the
8
+ // --0-elv-* vars (zero/fallback values until a step class is applied)
9
+ @mixin use() {
10
+ box-shadow:
11
+ 0 0 0 1px rgba(255 255 255 / 0.1),
12
+ var(--0-elv-i,) 0px 1px 1px rgba(var(--0-elv-c, 0 0 0) / 0.1),
13
+ var(--0-elv-i,) var(--0-elv-x1, 0px) var(--0-elv-y1, 0px) rgba(var(--0-elv-c, 0 0 0) / 0.095),
14
+ var(--0-elv-i,) var(--0-elv-x2, 0px) var(--0-elv-y2, 0px) rgba(var(--0-elv-c, 0 0 0) / 0.13);
15
+ }
16
+
17
+ @mixin elv($i, $inset: false) {
18
+ --0-elv-x1: #{$i}px;
19
+ --0-elv-y1: #{3 * $i}px;
20
+ --0-elv-x2: #{1.5 * $i}px;
21
+ --0-elv-y2: #{1.5 * $i}px;
22
+ @if $inset {
23
+ --0-elv-i: inset;
24
+ }
25
+ }
26
+
27
+ @mixin elevator($elevation, $color-value: #000) {
28
+ // legacy helper - kept for hand-written component styles; the generated
29
+ // classes use the var pattern above (@include use + @include elv)
30
+ $inset: 0;
31
+ @if $elevation < 0 {
32
+ $elevation: $elevation * -1;
33
+ $inset: inset 0;
34
+ } @else {
35
+ $inset: 0;
36
+ }
37
+ box-shadow:
38
+ 0 0 0 1px rgba(255, 255, 255, 0.1),
39
+ $inset 0px 1px 1px rgba($color-value, 0.1),
40
+ $inset #{1 * $elevation}px #{3 * $elevation}px rgba($color-value, 0.095),
41
+ $inset #{1.5 * $elevation}px #{1.5 * $elevation}px rgba($color-value, 0.13);
42
+ }
43
+
44
+ @function stroke() {
45
+ @return 0 0 0 1px rgba(255, 255, 255, 0.1);
46
+ }