@ui0/theme 0.0.0-stage → 0.1.1

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
@@ -0,0 +1,90 @@
1
+ // Corner radius application for a component.
2
+ //
3
+ // Rounding names (--0-r-none/hard/basic/smooth/full) are a THEME concern: the
4
+ // generator emits whatever the config's `roundings` section declares, on the
5
+ // .theme-* rule. This mixin provides a COMPUTED default for each name (a
6
+ // proportion of the control's current height) and resolves it into the
7
+ // --0c-r-* component namespace with the theme value winning via the var()
8
+ // fallback. The resolved defaults MUST live under --0c-r-* (not --0-r-*):
9
+ // a self-referential `--0-r-x: var(--0-r-x, …)` on the element is a CSS cycle
10
+ // (guaranteed-invalid at computed-value time) and kills every consumer - the
11
+ // setter classes read the --0c-r-* names.
12
+
13
+ @mixin init {
14
+ @property --0-r-tl {
15
+ syntax: '<length-percentage [0,∞]>{1,4} [ / <length-percentage [0,∞]>{1,4} ]?';
16
+ inherits: false;
17
+ initial-value: 0;
18
+ }
19
+ @property --0-r-tr {
20
+ syntax: '<length-percentage [0,∞]>{1,4} [ / <length-percentage [0,∞]>{1,4} ]?';
21
+ inherits: false;
22
+ initial-value: 0;
23
+ }
24
+ @property --0-r-bl {
25
+ syntax: '<length-percentage [0,∞]>{1,4} [ / <length-percentage [0,∞]>{1,4} ]?';
26
+ inherits: false;
27
+ initial-value: 0;
28
+ }
29
+ @property --0-r-br {
30
+ syntax: '<length-percentage [0,∞]>{1,4} [ / <length-percentage [0,∞]>{1,4} ]?';
31
+ inherits: false;
32
+ initial-value: 0;
33
+ }
34
+ }
35
+
36
+ @mixin use() {
37
+ border-start-start-radius: var(--0-r-tl, 0px);
38
+ border-start-end-radius: var(--0-r-tr, 0px);
39
+ border-end-start-radius: var(--0-r-bl, 0px);
40
+ border-end-end-radius: var(--0-r-br, 0px);
41
+ }
42
+
43
+ // $basic - the size the proportions are taken from; defaults to the control's
44
+ // current (density-aware) height.
45
+ @mixin apply($basic: null) {
46
+ @if $basic == null {
47
+ $basic: calc(var(--0-s-cur, 42px) * var(--0-s-density, 1));
48
+ }
49
+
50
+ // computed defaults in the component namespace; a theme-declared --0-r-*
51
+ // wins over each via the var() fallback (element-level --0-r-* would be a
52
+ // self-referential cycle, so the names must differ)
53
+ --0c-r-full: var(--0-r-full, calc(#{$basic} / 2));
54
+ --0c-r-smooth: var(--0-r-smooth, calc(#{$basic} / 4));
55
+ --0c-r-basic: var(--0-r-basic, calc(#{$basic} / 8));
56
+ --0c-r-hard: var(--0-r-hard, calc(#{$basic} / 14));
57
+ --0c-r-none: var(--0-r-none, 0px);
58
+ // @include reset();
59
+ }
60
+
61
+ @mixin full() {
62
+ --0-r-tl: var(--0c-r-full, var(--0-r-full));
63
+ --0-r-tr: var(--0c-r-full, var(--0-r-full));
64
+ --0-r-bl: var(--0c-r-full, var(--0-r-full));
65
+ --0-r-br: var(--0c-r-full, var(--0-r-full));
66
+ }
67
+ @mixin smooth() {
68
+ --0-r-tl: var(--0c-r-smooth, var(--0-r-smooth));
69
+ --0-r-tr: var(--0c-r-smooth, var(--0-r-smooth));
70
+ --0-r-bl: var(--0c-r-smooth, var(--0-r-smooth));
71
+ --0-r-br: var(--0c-r-smooth, var(--0-r-smooth));
72
+ }
73
+ @mixin basic() {
74
+ --0-r-tl: var(--0c-r-basic, var(--0-r-basic));
75
+ --0-r-tr: var(--0c-r-basic, var(--0-r-basic));
76
+ --0-r-bl: var(--0c-r-basic, var(--0-r-basic));
77
+ --0-r-br: var(--0c-r-basic, var(--0-r-basic));
78
+ }
79
+ @mixin hard() {
80
+ --0-r-tl: var(--0c-r-hard, var(--0-r-hard));
81
+ --0-r-tr: var(--0c-r-hard, var(--0-r-hard));
82
+ --0-r-bl: var(--0c-r-hard, var(--0-r-hard));
83
+ --0-r-br: var(--0c-r-hard, var(--0-r-hard));
84
+ }
85
+ @mixin reset() {
86
+ --0-r-tl: 0px;
87
+ --0-r-tr: 0px;
88
+ --0-r-bl: 0px;
89
+ --0-r-br: 0px;
90
+ }
@@ -0,0 +1,50 @@
1
+ @value sizeXxxs: si_bce5;
2
+ @value sizeXxs: si_87d4;
3
+ @value sizeXs: si_0820;
4
+ @value sizeS: si_9329;
5
+ @value sizeM: si_96e7;
6
+ @value sizeL: si_05f9;
7
+ @value sizeXl: si_81de;
8
+ @value sizeXxl: si_d16b;
9
+ @value sizeXxxl: si_5136;
10
+ @value sizeCustom: si_e681;
11
+
12
+ .si_bce5 {
13
+ --0-s: var(--0-s-xxxs);
14
+ }
15
+
16
+ .si_87d4 {
17
+ --0-s: var(--0-s-xxs);
18
+ }
19
+
20
+ .si_0820 {
21
+ --0-s: var(--0-s-xs);
22
+ }
23
+
24
+ .si_9329 {
25
+ --0-s: var(--0-s-s);
26
+ }
27
+
28
+ .si_96e7 {
29
+ --0-s: var(--0-s-m);
30
+ }
31
+
32
+ .si_05f9 {
33
+ --0-s: var(--0-s-l);
34
+ }
35
+
36
+ .si_81de {
37
+ --0-s: var(--0-s-xl);
38
+ }
39
+
40
+ .si_d16b {
41
+ --0-s: var(--0-s-xxl);
42
+ }
43
+
44
+ .si_5136 {
45
+ --0-s: var(--0-s-xxxl);
46
+ }
47
+
48
+ .si_e681 {
49
+ --0-s: var(--0-s-custom);
50
+ }
@@ -0,0 +1,13 @@
1
+ @value sizeXl: si_81de;
2
+ @value sizeM: si_96e7;
3
+ @value sizeXs: si_0820;
4
+ @value sizeS: si_9329;
5
+ @value sizeL: si_05f9;
6
+ @value sizeXxs: si_87d4;
7
+ @value sizeXxxs: si_bce5;
8
+ @value sizeXxxl: si_5136;
9
+ @value sizeXxl: si_d16b;
10
+ @value sizeCustom: si_e681;
11
+ @value sized: si_3f5b;
12
+ @value child: ch_ddc9;
13
+ @value fontSizing: fo_5e6f;
package/dist/size.scss ADDED
@@ -0,0 +1,28 @@
1
+ /*
2
+ --0-s - own size(height)
3
+ --0-sc - size of a child component in complex component
4
+ */
5
+ @mixin use() {
6
+ --0-s: calc(var(--0-s, var(--0-s-m)) * var(--0-s-density, 1));
7
+ --0-sc: calc(var(--0-sc, var(--0-sc-m)) * var(--0-s-density, 1));
8
+ }
9
+
10
+ $size-current: calc(var(--0-s, var(--0-s-m)) * var(--0-s-density, 1));
11
+
12
+ @mixin apply {
13
+ height: var(--0-s);
14
+ }
15
+
16
+ @mixin follow {
17
+ height: var(--0-s);
18
+ }
19
+ @mixin size {
20
+ height: var(--0-s);
21
+ }
22
+ @mixin child-size {
23
+ height: var(--0-sc);
24
+ }
25
+ @mixin sizeable($h: var(--0-s, var(--0-s-m)), $hc: var(--0-sc, var(--0-sc-m))) {
26
+ --0-s: calc(#{$h} * var(--0-s-density, 1));
27
+ --0-sc: calc(#{$hc} * var(--0-s-density, 1));
28
+ }
@@ -0,0 +1,16 @@
1
+ @use '@ui0/theme/color';
2
+ @mixin isDark {
3
+ :global(.theme_dark) & {
4
+ @content;
5
+ }
6
+ }
7
+ @mixin isLight {
8
+ :global(.theme_light) & {
9
+ @content;
10
+ }
11
+ }
12
+
13
+ @mixin apply {
14
+ @include color.use();
15
+ @include color.apply();
16
+ }
@@ -0,0 +1,81 @@
1
+ @value fw100: fw_f5d2;
2
+ @value fw200: fw_25c0;
3
+ @value fw300: fw_de2b;
4
+ @value fw400: fw_a02f;
5
+ @value fw500: fw_c057;
6
+ @value fw600: fw_aee5;
7
+ @value fw700: fw_3207;
8
+ @value fw800: fw_d808;
9
+ @value fw900: fw_bb66;
10
+ @value tt-uppercase: tt_c60d;
11
+ @value tt-lowercase: tt_56d5;
12
+ @value tt-capitalize: tt_ce2a;
13
+ @value tt-none: tt_1ff4;
14
+ @value tt-full: tt_59a5;
15
+ @value tt-full-size-kana: tt_50f0;
16
+ @value ta-start: ta_c49e;
17
+ @value ta-end: ta_e1d2;
18
+ @value ta-center: ta_d725;
19
+ @value ta-left: ta_3342;
20
+ @value ta-right: ta_e5b8;
21
+ @value ta-justify: ta_010c;
22
+ @value ta-match-parent: ta_0241;
23
+ @value to-mixed: to_a88e;
24
+ @value to-sideways: to_4919;
25
+ @value to-sideways-right: to_2640;
26
+ @value to-use-glyph-orientation: to_de51;
27
+ @value to-upright: to_35e5;
28
+ @value tw-nowrap: tw_83bf;
29
+ @value tw-wrap: tw_d03a;
30
+ @value tw-balance: tw_4fdb;
31
+ @value tw-pretty: tw_f5a3;
32
+ @value tw-stable: tw_698e;
33
+
34
+ .fw_f5d2 { font-weight: 100 }
35
+ .fw_25c0 { font-weight: 200 }
36
+ .fw_de2b { font-weight: 300 }
37
+ .fw_a02f { font-weight: 400 }
38
+ .fw_c057 { font-weight: 500 }
39
+ .fw_aee5 { font-weight: 600 }
40
+ .fw_3207 { font-weight: 700 }
41
+ .fw_d808 { font-weight: 800 }
42
+ .fw_bb66 { font-weight: 900 }
43
+
44
+ .tt_c60d { text-transform: uppercase }
45
+ .tt_56d5 { text-transform: lowercase }
46
+ .tt_ce2a { text-transform: capitalize }
47
+ .tt_1ff4 { text-transform: none }
48
+ .tt_59a5 { text-transform: full-width }
49
+ .tt_50f0 { text-transform: full-size-kana }
50
+
51
+ .ta_c49e { text-align: start }
52
+ .ta_e1d2 { text-align: end }
53
+ .ta_d725 { text-align: center }
54
+ .ta_3342 { text-align: left }
55
+ .ta_e5b8 { text-align: right }
56
+ .ta_010c { text-align: justify }
57
+ .ta_0241 { text-align: match-parent }
58
+
59
+ .to_a88e { text-orientation: mixed }
60
+ .to_4919 { text-orientation: sideways }
61
+ .to_2640 { text-orientation: sideways-right }
62
+ .to_de51 { text-orientation: use-glyph-orientation }
63
+ .to_35e5 { text-orientation: upright }
64
+
65
+ .tw_83bf { text-wrap: nowrap }
66
+ .tw_d03a { text-wrap: wrap }
67
+ .tw_4fdb { text-wrap: balance }
68
+ .tw_f5a3 { text-wrap: pretty }
69
+ .tw_698e { text-wrap: stable }
70
+ h1, h2, h3, h4, h5, h6 {
71
+ --0-typo-step: 0.25rem; /* шаг (длина) */
72
+ font-size: calc(var(--0-typo-h-fs, var(--0-typo-fs, 1rem)) + var(--0-typo-step) * var(--0-typo-x));
73
+ line-height: calc(1 + 1 / var(--0-typo-x));
74
+
75
+ }
76
+ h1 { --0-typo-x: 6; }
77
+ h2 { --0-typo-x: 5; }
78
+ h3 { --0-typo-x: 4; }
79
+ h4 { --0-typo-x: 3; }
80
+ h5 { --0-typo-x: 2; }
81
+ h6 { --0-typo-x: 1; }
@@ -0,0 +1,32 @@
1
+ @value fw100: fw_f5d2;
2
+ @value fw200: fw_25c0;
3
+ @value fw300: fw_de2b;
4
+ @value fw400: fw_a02f;
5
+ @value fw500: fw_c057;
6
+ @value fw600: fw_aee5;
7
+ @value fw700: fw_3207;
8
+ @value fw800: fw_d808;
9
+ @value fw900: fw_bb66;
10
+ @value tt-uppercase: tt_c60d;
11
+ @value tt-lowercase: tt_56d5;
12
+ @value tt-capitalize: tt_ce2a;
13
+ @value tt-none: tt_1ff4;
14
+ @value tt-full: tt_59a5;
15
+ @value tt-full-size-kana: tt_50f0;
16
+ @value ta-center: ta_d725;
17
+ @value ta-end: ta_e1d2;
18
+ @value ta-justify: ta_010c;
19
+ @value ta-left: ta_3342;
20
+ @value ta-match-parent: ta_0241;
21
+ @value ta-right: ta_e5b8;
22
+ @value ta-start: ta_c49e;
23
+ @value to-mixed: to_a88e;
24
+ @value to-sideways: to_4919;
25
+ @value to-sideways-right: to_2640;
26
+ @value to-use-glyph-orientation: to_de51;
27
+ @value to-upright: to_35e5;
28
+ @value tw-nowrap: tw_83bf;
29
+ @value tw-wrap: tw_d03a;
30
+ @value tw-balance: tw_4fdb;
31
+ @value tw-pretty: tw_f5a3;
32
+ @value tw-stable: tw_698e;
@@ -0,0 +1,21 @@
1
+ // Component-namespace wiring for the typography contract: the generator emits
2
+ // `--0-typography-base` on the theme blocks; this mixin mirrors it into the
3
+ // component namespace so a component can consume (and locally override) it.
4
+ @mixin init() {
5
+ --0-typo-base: 1.2;
6
+
7
+ code {
8
+ //background-color: rgba(var(--r-c-foreground-v), 0.2);
9
+ border-radius: 0;
10
+ }
11
+ h1, h2, h3, h4, h5, h6 {
12
+ font-size: calc(var(--0-typo-h-fs, var(--0-typo-fs)) * var(--0-typo-h-ratio, 1) * var(--0-typo-x, 1));
13
+ }
14
+ h1 { --0-typo-x: 6; }
15
+ h2 { --0-typo-x: 5; }
16
+ h3 { --0-typo-x: 4; }
17
+ h4 { --0-typo-x: 3; }
18
+ h5 { --0-typo-x: 2; }
19
+ h6 { --0-typo-x: 1; }
20
+ body { font-size: var(--0-typo-font-size); }
21
+ }
package/dist/util.scss ADDED
@@ -0,0 +1,78 @@
1
+ @mixin repeat-layer {
2
+ align-items: inherit;
3
+ border-radius: inherit;
4
+ display: inherit;
5
+ height: 100%;
6
+ justify-content: inherit;
7
+ position: inherit;
8
+ width: 100%;
9
+ @content;
10
+ }
11
+ @mixin startingStyle {
12
+ @starting-style {
13
+ @content
14
+ }
15
+ }
16
+ @mixin elevator($elevation, $color-value: #000) {
17
+ $inset: 0;
18
+ @if $elevation < 0 {
19
+ $elevation: $elevation * -1;
20
+ $inset: inset 0;
21
+ } @else {
22
+ $inset: 0;
23
+ }
24
+ box-shadow: $inset 0px 1px 1px rgba($color-value, 0.1),
25
+ $inset #{1 * $elevation}px #{3 * $elevation}px rgba($color-value, 0.095),
26
+ $inset #{1.5 * $elevation}px #{1.5 * $elevation}px rgba($color-value, 0.13);
27
+ }
28
+ @mixin pseudobox-props {
29
+ //background-clip: text;
30
+ bottom: 0;
31
+ box-sizing: border-box;
32
+ border-radius: inherit;
33
+ content: ' ';
34
+ height: 100%;
35
+ left: 0;
36
+ position: absolute;
37
+ right: 0;
38
+ top: 0;
39
+ width: 100%;
40
+ z-index: -1;
41
+ }
42
+
43
+ @mixin pseudobox-b {
44
+ &::before {
45
+ @include pseudobox-props;
46
+ @content;
47
+ }
48
+ }
49
+
50
+ @mixin pseudobox-a {
51
+ &::after {
52
+ @include pseudobox-props;
53
+ @content;
54
+ }
55
+ }
56
+
57
+ @function gradientBackground(
58
+ $color: --r-c-v,
59
+ $color2: --r-c2-v,
60
+ $opacity: 1,
61
+ $opacity2: 1,
62
+ $deg: var(--r-gradient-angle)
63
+ ) {
64
+ @return linear-gradient(
65
+ $deg,
66
+ rgba(var($color), $opacity) 0%,
67
+ rgba(var($color), $opacity) 30%,
68
+ rgba(var($color2), $opacity2) 65%,
69
+ rgba(var($color2), $opacity2) 100%
70
+ );
71
+ }
72
+ @function gradientBackgroundRipple($opacity: 1, $opacity2: 1) {
73
+ @return linear-gradient(
74
+ 135deg,
75
+ rgba(var(--r-c-v), $opacity) 40%,
76
+ rgba(var(--r-c2-v), $opacity2) 60%
77
+ );
78
+ }
package/dist/vars.scss ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,98 @@
1
1
  {
2
2
  "name": "@ui0/theme",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "Generates themeable CSS custom properties from a theme config (library + Vite plugin + CLI)",
5
+ "keywords": [
6
+ "css-variables",
7
+ "design-tokens",
8
+ "theme",
9
+ "ui0",
10
+ "vite",
11
+ "vite-plugin"
12
+ ],
13
+ "bin": {
14
+ "ui0-theme": "./dist/generator/cli.mjs"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "src/contracts",
20
+ "src/styles",
21
+ "src/generator/theme.default.css"
22
+ ],
23
+ "type": "module",
24
+ "sideEffects": false,
25
+ "module": "./dist/index.mjs",
26
+ "types": "./dist/index.d.mts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.mts",
30
+ "import": "./dist/index.mjs"
31
+ },
32
+ "./vite": {
33
+ "types": "./dist/generator/vite.d.mts",
34
+ "import": "./dist/generator/vite.mjs"
35
+ },
36
+ "./backdrop": "./dist/backdrop.scss",
37
+ "./backdrop/classes": "./dist/backdrop.module.css",
38
+ "./color": "./dist/color.scss",
39
+ "./vars": "./dist/vars.scss",
40
+ "./vars.scss": "./dist/vars.scss",
41
+ "./color/classes": "./dist/color.module.css",
42
+ "./round": "./dist/round.scss",
43
+ "./util": "./dist/util.scss",
44
+ "./round/classes": "./dist/round.module.css",
45
+ "./size": "./dist/size.scss",
46
+ "./size/classes": "./dist/size.module.css",
47
+ "./styles": "./dist/size.module.css",
48
+ "./elevation": "./dist/elevation.scss",
49
+ "./elevation/classes": "./dist/elevation.module.css",
50
+ "./elevation/elevation.module.css": "./dist/elevation.module.css",
51
+ "./ripple": "./dist/ripple.scss",
52
+ "./disabled": "./dist/disabled.scss",
53
+ "./disabled/classes": "./dist/disabled.module.css",
54
+ "./theme.default.css": "./src/generator/theme.default.css",
55
+ "./config.default": {
56
+ "types": "./dist/config.default.d.mts",
57
+ "import": "./dist/config.default.mjs"
58
+ },
59
+ "./is": "./dist/is.scss",
60
+ "./duration": "./dist/duration.scss",
61
+ "./theme": "./dist/theme.scss",
62
+ "./package.json": "./package.json",
63
+ "./theme-provider": {
64
+ "types": "./dist/components/index.d.ts",
65
+ "import": "./dist/components/index.js",
66
+ "default": "./dist/components/index.js"
67
+ },
68
+ "./theme-provider/style.css": "./dist/components/style.css",
69
+ "./theme-provider.module.css": "./dist/components/theme-provider.module.css"
70
+ },
71
+ "scripts": {
72
+ "theme:build": "node ../../scripts/gen-theme-default.ts && tsdown && node ../../scripts/build-contracts.ts && vite build",
73
+ "theme:dev": "node ../../scripts/build-contracts.ts --watch & node ../../scripts/gen-theme-default.ts --watch & tsdown --watch & vite build --watch",
74
+ "theme:typecheck": "tsc -p tsconfig.json --noEmit",
75
+ "theme:gen-default": "node ../../scripts/gen-theme-default.ts",
76
+ "theme:test": "vitest run"
77
+ },
78
+ "dependencies": {
79
+ "@ui0/composable": "0.1.1",
80
+ "@ui0/types": "0.1.1",
81
+ "@ui0/util": "0.0.2",
82
+ "esbuild": "^0.27.0"
83
+ },
84
+ "devDependencies": {
85
+ "@types/node": "^22.0.0",
86
+ "@ui0/vite": "0.1.1",
87
+ "@vitejs/plugin-vue": "^6.0.0",
88
+ "sass-embedded": "^1.80.0",
89
+ "vite-plugin-dts": "^5.1.2",
90
+ "vue": "^3.5.45"
91
+ },
92
+ "peerDependencies": {
93
+ "@ui0/core": "0.1.1",
94
+ "@ui0/shared": "0.0.601",
95
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
96
+ "vue": "^3.5.45"
97
+ }
98
+ }
@@ -0,0 +1,44 @@
1
+ import { AT_SIGN } from '@ui0/shared'
2
+ // The backdrop contract's processing endpoint: the backdrop prop selects a
3
+ // backdrop-filter function; the deal resolves the prop value to the hashed
4
+ // setter class from the module map (merged with the component's own $style).
5
+ import type { ClassList, CSSModuleClassList, StyleList } from '@ui0/types'
6
+ import type { ContractProvider, ThemeContractDeal } from '@ui0/types'
7
+ import { isArray, isString, mergeCssModulesStyles } from '@ui0/util'
8
+
9
+ import type { BackdropProps } from './backdrop.types'
10
+
11
+ import $backdrop from './backdrop.module.css'
12
+
13
+ function backdropClasses(p: BackdropProps, s?: CSSModuleClassList): ClassList {
14
+ const $ = mergeCssModulesStyles($backdrop, s)
15
+ console.log('$', $)
16
+
17
+ if (p.backdrop) return [$['backdrop']]
18
+ return []
19
+ }
20
+
21
+ export function backdropDeal(instance: ContractProvider): ThemeContractDeal {
22
+ const props = instance.props
23
+
24
+ return {
25
+ classes: () => instance.inject(backdropClasses(props, instance.$styles)),
26
+ styles() {
27
+ const out: StyleList = {}
28
+ const val = props.backdrop
29
+ if (val) {
30
+ if (isArray(val)) {
31
+ } else if (isString(val)) {
32
+ const split = val.split(AT_SIGN)
33
+ if (split[1]) {
34
+ out['--0-backdrop-' + split[0]] = split[1]
35
+ out['--0-backdrop'] = `${split[0]}(var(--0-backdrop-${split[0]}))`
36
+ } else {
37
+ out['--0-backdrop'] = `${props.backdrop}(var(--0-backdrop-${props.backdrop}))`
38
+ }
39
+ }
40
+ }
41
+ return instance.inject(out)
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,82 @@
1
+ // The backdrop contract's generator endpoint: one setter class per
2
+ // backdrop-filter function the config enables. The backdrop prop selects
3
+ // which function a component gets; the configured default lands on the theme
4
+ // block as `--0-backdrop-*` and doubles as the setter's var fallback.
5
+ import type { CSSModuleClassList, VarList } from '@ui0/types'
6
+ import type { ThemeContractGenerator } from '@ui0/types'
7
+
8
+ import type { ContractFactory } from '../generator'
9
+ import type { BackdropFunction } from './backdrop.types'
10
+
11
+ import $backdrop from './backdrop.module.css'
12
+
13
+ /** every backdrop-filter function the prop can select */
14
+ export const BACKDROP_FUNCTIONS: ReadonlyArray<BackdropFunction> = [
15
+ 'blur',
16
+ 'brightness',
17
+ 'contrast',
18
+ 'drop-shadow',
19
+ 'grayscale',
20
+ 'hue-rotate',
21
+ 'invert',
22
+ 'opacity',
23
+ 'saturate',
24
+ 'sepia'
25
+ ]
26
+
27
+ /** fallback value per function when the config omits the value */
28
+ const DEFAULTS: Record<BackdropFunction, string> = {
29
+ blur: '4px',
30
+ brightness: '0.5',
31
+ contrast: '0.5',
32
+ 'drop-shadow': '0 4px 8px rgba(0, 0, 0, 0.5)',
33
+ grayscale: '1',
34
+ 'hue-rotate': '90deg',
35
+ invert: '1',
36
+ opacity: '0.5',
37
+ saturate: '0.5',
38
+ sepia: '1'
39
+ }
40
+
41
+ const backdropGenerator: ContractFactory = (ctx): ThemeContractGenerator => {
42
+ const { hash } = ctx
43
+ const config = ctx.config.backdrop
44
+ // which functions ship: the appearance config's keys by default, plus any
45
+ // function the settings turn on; a `false` in the settings always wins.
46
+ // (a whole-contract `false` never reaches here - the orchestrator skips
47
+ // disabled contracts; narrowed defensively anyway)
48
+ const backdropSettings = ctx.settings.backdrop
49
+ const fnSettings: Partial<Record<BackdropFunction, boolean>> =
50
+ backdropSettings === false ? {} : (backdropSettings ?? {})
51
+ const fromConfig: BackdropFunction[] = config ? (Object.keys(config) as BackdropFunction[]) : ['blur']
52
+ const enabled = [
53
+ ...new Set([...fromConfig, ...(Object.keys(fnSettings) as BackdropFunction[]).filter((fn) => fnSettings[fn])])
54
+ ].filter((fn) => fnSettings[fn] !== false)
55
+
56
+ function vars(): Record<string, VarList> {
57
+ const backdrop: VarList = {}
58
+ for (const fn of enabled) {
59
+ backdrop[fn] = `${config?.[fn] ?? DEFAULTS[fn]}`
60
+ }
61
+ return { backdrop }
62
+ }
63
+ console.log('hash', $backdrop.backdrop)
64
+
65
+ return {
66
+ namespace: 'bd',
67
+ vars: (scheme) => (scheme ? {} : vars()),
68
+ css: () => {
69
+ return (
70
+ `.${$backdrop.backdrop} {\n` +
71
+ ` backdrop-filter: var(--0-backdrop);\n` +
72
+ ` -webkit-backdrop-filter: var(--0-backdrop);\n` +
73
+ ` will-change: backdrop-filter;\n` +
74
+ `}`
75
+ )
76
+ },
77
+ class: (): CSSModuleClassList => ({ ...$backdrop }),
78
+ styles: () => ({})
79
+ }
80
+ }
81
+
82
+ export default backdropGenerator
@@ -0,0 +1,7 @@
1
+ import type { ThemeContractDeal } from '@ui0/types'
2
+ import type { InjectionKey, Ref } from 'vue'
3
+
4
+ import type { BackdropProps } from './backdrop.types'
5
+
6
+ export const BackdropRefKey = Symbol('BackdropRefKey') as InjectionKey<Ref<BackdropProps['backdrop']>>
7
+ export const BackdropContractKey = Symbol('BackdropContractKey') as InjectionKey<ThemeContractDeal>
@@ -0,0 +1,3 @@
1
+ .backdrop {
2
+ /*@*/
3
+ }
@@ -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
+ }