@udixio/theme 1.3.0 → 2.0.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 (139) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/API.d.ts +7 -4
  3. package/dist/API.d.ts.map +1 -1
  4. package/dist/app.container.d.ts +1 -2
  5. package/dist/app.container.d.ts.map +1 -1
  6. package/dist/bin.cjs +1 -1
  7. package/dist/bin.js +1 -1
  8. package/dist/browser.cjs +22 -18
  9. package/dist/browser.js +32 -28
  10. package/dist/color/color.api.d.ts +11 -30
  11. package/dist/color/color.api.d.ts.map +1 -1
  12. package/dist/color/color.d.ts +99 -0
  13. package/dist/color/color.d.ts.map +1 -0
  14. package/dist/color/color.manager.d.ts +9 -17
  15. package/dist/color/color.manager.d.ts.map +1 -1
  16. package/dist/color/color.utils.d.ts +14 -3
  17. package/dist/color/color.utils.d.ts.map +1 -1
  18. package/dist/color/default-color.d.ts.map +1 -1
  19. package/dist/color/index.d.ts +1 -1
  20. package/dist/color/index.d.ts.map +1 -1
  21. package/dist/config/config.interface.d.ts +4 -4
  22. package/dist/config/config.interface.d.ts.map +1 -1
  23. package/dist/context/context.d.ts +41 -0
  24. package/dist/context/context.d.ts.map +1 -0
  25. package/dist/context/context.module.d.ts +3 -0
  26. package/dist/context/context.module.d.ts.map +1 -0
  27. package/dist/context/index.d.ts +3 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/font.plugin-BZ-TTeTo.cjs +227 -0
  30. package/dist/font.plugin-DZtMajJV.js +228 -0
  31. package/dist/index.d.ts +6 -4
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/{load-from-path-BuN8RpOs.cjs → load-from-path-DZ35yiXK.cjs} +2 -2
  34. package/dist/{load-from-path-BSrT4DOj.js → load-from-path-Dobe0beV.js} +1 -1
  35. package/dist/loader/loader.d.ts +1 -1
  36. package/dist/loader/loader.d.ts.map +1 -1
  37. package/dist/{loader-Bc0bstAD.js → loader-BS_Esfwg.js} +1408 -905
  38. package/dist/{loader-YNN5hAF3.cjs → loader-C8LnOoqg.cjs} +1392 -889
  39. package/dist/material-color-utilities/dynamic_color.d.ts +0 -22
  40. package/dist/material-color-utilities/dynamic_color.d.ts.map +1 -1
  41. package/dist/material-color-utilities/toneDeltaPair.d.ts +8 -8
  42. package/dist/material-color-utilities/toneDeltaPair.d.ts.map +1 -1
  43. package/dist/node.cjs +23 -19
  44. package/dist/node.js +34 -30
  45. package/dist/palette/index.d.ts +4 -0
  46. package/dist/palette/index.d.ts.map +1 -0
  47. package/dist/palette/palette.api.d.ts +13 -0
  48. package/dist/palette/palette.api.d.ts.map +1 -0
  49. package/dist/palette/palette.d.ts +33 -0
  50. package/dist/palette/palette.d.ts.map +1 -0
  51. package/dist/palette/palette.manager.d.ts +20 -0
  52. package/dist/palette/palette.manager.d.ts.map +1 -0
  53. package/dist/palette/palette.module.d.ts +3 -0
  54. package/dist/palette/palette.module.d.ts.map +1 -0
  55. package/dist/plugins/font/font.plugin.d.ts +1 -1
  56. package/dist/plugins/font/font.plugin.d.ts.map +1 -1
  57. package/dist/variant/index.d.ts +3 -0
  58. package/dist/variant/index.d.ts.map +1 -0
  59. package/dist/variant/variant.d.ts +29 -0
  60. package/dist/variant/variant.d.ts.map +1 -0
  61. package/dist/variant/variants/expressive.variant.d.ts +2 -0
  62. package/dist/variant/variants/expressive.variant.d.ts.map +1 -0
  63. package/dist/variant/variants/fidelity.variant.d.ts.map +1 -0
  64. package/dist/variant/variants/index.d.ts.map +1 -0
  65. package/dist/variant/variants/neutral.variant.d.ts.map +1 -0
  66. package/dist/variant/variants/tonal-spot.variant.d.ts.map +1 -0
  67. package/dist/variant/variants/vibrant.variant.d.ts.map +1 -0
  68. package/package.json +1 -1
  69. package/src/API.ts +12 -5
  70. package/src/app.container.ts +22 -11
  71. package/src/bootstrap.ts +1 -1
  72. package/src/color/color.api.ts +168 -47
  73. package/src/color/color.manager.ts +38 -181
  74. package/src/color/color.ts +291 -0
  75. package/src/color/color.utils.ts +48 -3
  76. package/src/color/default-color.ts +395 -396
  77. package/src/color/index.ts +1 -1
  78. package/src/config/config.interface.ts +5 -4
  79. package/src/context/context.module.ts +7 -0
  80. package/src/context/context.ts +169 -0
  81. package/src/context/index.ts +2 -0
  82. package/src/index.ts +6 -4
  83. package/src/loader/loader.ts +14 -23
  84. package/src/material-color-utilities/dynamic_color.ts +25 -34
  85. package/src/material-color-utilities/toneDeltaPair.ts +44 -41
  86. package/src/palette/index.ts +3 -0
  87. package/src/palette/palette.api.ts +43 -0
  88. package/src/palette/palette.manager.ts +74 -0
  89. package/src/palette/palette.module.ts +9 -0
  90. package/src/palette/palette.ts +207 -0
  91. package/src/plugins/font/font.plugin.ts +1 -1
  92. package/src/variant/index.ts +2 -0
  93. package/src/variant/variant.ts +81 -0
  94. package/src/{theme → variant}/variants/expressive.variant.ts +31 -29
  95. package/src/variant/variants/fidelity.variant.ts +46 -0
  96. package/src/{theme → variant}/variants/neutral.variant.ts +18 -18
  97. package/src/variant/variants/tonal-spot.variant.ts +35 -0
  98. package/src/{theme → variant}/variants/vibrant.variant.ts +21 -22
  99. package/dist/color/configurable-color.d.ts +0 -31
  100. package/dist/color/configurable-color.d.ts.map +0 -1
  101. package/dist/define-config-B1QPKKY_.js +0 -430
  102. package/dist/define-config-BGgVazsr.cjs +0 -429
  103. package/dist/theme/index.d.ts +0 -8
  104. package/dist/theme/index.d.ts.map +0 -1
  105. package/dist/theme/scheme.d.ts +0 -20
  106. package/dist/theme/scheme.d.ts.map +0 -1
  107. package/dist/theme/scheme.manager.d.ts +0 -31
  108. package/dist/theme/scheme.manager.d.ts.map +0 -1
  109. package/dist/theme/theme.api.d.ts +0 -23
  110. package/dist/theme/theme.api.d.ts.map +0 -1
  111. package/dist/theme/theme.module.d.ts +0 -3
  112. package/dist/theme/theme.module.d.ts.map +0 -1
  113. package/dist/theme/variant.d.ts +0 -36
  114. package/dist/theme/variant.d.ts.map +0 -1
  115. package/dist/theme/variant.manager.d.ts +0 -14
  116. package/dist/theme/variant.manager.d.ts.map +0 -1
  117. package/dist/theme/variants/expressive.variant.d.ts +0 -3
  118. package/dist/theme/variants/expressive.variant.d.ts.map +0 -1
  119. package/dist/theme/variants/fidelity.variant.d.ts.map +0 -1
  120. package/dist/theme/variants/index.d.ts.map +0 -1
  121. package/dist/theme/variants/neutral.variant.d.ts.map +0 -1
  122. package/dist/theme/variants/tonal-spot.variant.d.ts.map +0 -1
  123. package/dist/theme/variants/vibrant.variant.d.ts.map +0 -1
  124. package/src/color/configurable-color.ts +0 -67
  125. package/src/theme/index.ts +0 -7
  126. package/src/theme/scheme.manager.ts +0 -100
  127. package/src/theme/scheme.ts +0 -66
  128. package/src/theme/theme.api.ts +0 -78
  129. package/src/theme/theme.module.ts +0 -11
  130. package/src/theme/variant.manager.ts +0 -58
  131. package/src/theme/variant.ts +0 -53
  132. package/src/theme/variants/fidelity.variant.ts +0 -38
  133. package/src/theme/variants/tonal-spot.variant.ts +0 -35
  134. /package/dist/{theme → variant}/variants/fidelity.variant.d.ts +0 -0
  135. /package/dist/{theme → variant}/variants/index.d.ts +0 -0
  136. /package/dist/{theme → variant}/variants/neutral.variant.d.ts +0 -0
  137. /package/dist/{theme → variant}/variants/tonal-spot.variant.d.ts +0 -0
  138. /package/dist/{theme → variant}/variants/vibrant.variant.d.ts +0 -0
  139. /package/src/{theme → variant}/variants/index.ts +0 -0
@@ -1,429 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- const loader = require("./loader-YNN5hAF3.cjs");
6
- const materialColorUtilities = require("@material/material-color-utilities");
7
- const getExpressiveNeutralHue = (sourceColorHct) => {
8
- const hue = loader.getRotatedHue(
9
- sourceColorHct,
10
- [0, 71, 124, 253, 278, 300, 360],
11
- [10, 0, 10, 0, 10, 0]
12
- );
13
- return hue;
14
- };
15
- const getExpressiveNeutralChroma = (sourceColorHct, isDark) => {
16
- const neutralHue = getExpressiveNeutralHue(sourceColorHct);
17
- return isDark ? loader.Hct.isYellow(neutralHue) ? 6 : 14 : 18;
18
- };
19
- const expressiveVariant = {
20
- name: "expressive",
21
- palettes: {
22
- primary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, isDark ? 36 : 48),
23
- secondary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
24
- loader.getRotatedHue(
25
- sourceColorHct,
26
- [0, 105, 140, 204, 253, 278, 300, 333, 360],
27
- [-160, 155, -100, 96, -96, -156, -165, -160]
28
- ),
29
- isDark ? 16 : 24
30
- ),
31
- tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
32
- loader.getRotatedHue(
33
- sourceColorHct,
34
- [0, 105, 140, 204, 253, 278, 300, 333, 360],
35
- [-165, 160, -105, 101, -101, -160, -170, -165]
36
- ),
37
- 48
38
- ),
39
- neutral: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
40
- getExpressiveNeutralHue(sourceColorHct),
41
- getExpressiveNeutralChroma(sourceColorHct, isDark)
42
- ),
43
- neutralVariant: ({ sourceColorHct, isDark }) => {
44
- const expressiveNeutralHue = getExpressiveNeutralHue(sourceColorHct);
45
- const expressiveNeutralChroma = getExpressiveNeutralChroma(
46
- sourceColorHct,
47
- isDark
48
- );
49
- return materialColorUtilities.TonalPalette.fromHueAndChroma(
50
- expressiveNeutralHue,
51
- expressiveNeutralChroma * (expressiveNeutralHue >= 105 && expressiveNeutralHue < 125 ? 1.6 : 2.3)
52
- );
53
- },
54
- error: ({ sourceColorHct }) => {
55
- const errorHue = loader.getPiecewiseHue(
56
- sourceColorHct,
57
- [0, 3, 13, 23, 33, 43, 153, 273, 360],
58
- [12, 22, 32, 12, 22, 32, 22, 12]
59
- );
60
- return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 64);
61
- }
62
- },
63
- customPalettes: ({ colorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
64
- loader.getRotatedHue(
65
- colorHct,
66
- [0, 105, 140, 204, 253, 278, 300, 333, 360],
67
- [-160, 155, -100, 96, -96, -156, -165, -160]
68
- ),
69
- isDark ? 16 : 24
70
- )
71
- };
72
- const neutralVariant = {
73
- name: "neutral",
74
- palettes: {
75
- primary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
76
- sourceColorHct.hue,
77
- loader.Hct.isBlue(sourceColorHct.hue) ? 12 : 8
78
- ),
79
- secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
80
- sourceColorHct.hue,
81
- loader.Hct.isBlue(sourceColorHct.hue) ? 6 : 4
82
- ),
83
- tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
84
- loader.getRotatedHue(
85
- sourceColorHct,
86
- [0, 38, 105, 161, 204, 278, 333, 360],
87
- [-32, 26, 10, -39, 24, -15, -32]
88
- ),
89
- 20
90
- ),
91
- neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.4),
92
- neutralVariant: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.4 * 2.2),
93
- error: ({ sourceColorHct }) => {
94
- const errorHue = loader.getPiecewiseHue(
95
- sourceColorHct,
96
- [0, 3, 13, 23, 33, 43, 153, 273, 360],
97
- [12, 22, 32, 12, 22, 32, 22, 12]
98
- );
99
- return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 50);
100
- }
101
- },
102
- customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
103
- colorHct.hue,
104
- loader.Hct.isBlue(colorHct.hue) ? 6 : 4
105
- )
106
- };
107
- const getVibrantNeutralHue = (sourceColorHct) => {
108
- return loader.getRotatedHue(
109
- sourceColorHct,
110
- [0, 38, 105, 140, 333, 360],
111
- [-14, 10, -14, 10, -14]
112
- );
113
- };
114
- const getVibrantNeutralChroma = (sourceColorHct) => {
115
- getVibrantNeutralHue(sourceColorHct);
116
- return 28;
117
- };
118
- const vibrantVariant = {
119
- name: "vibrant",
120
- palettes: {
121
- primary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 74),
122
- secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
123
- loader.getRotatedHue(
124
- sourceColorHct,
125
- [0, 38, 105, 140, 333, 360],
126
- [-14, 10, -14, 10, -14]
127
- ),
128
- 56
129
- ),
130
- tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
131
- loader.getRotatedHue(
132
- sourceColorHct,
133
- [0, 38, 71, 105, 140, 161, 253, 333, 360],
134
- [-72, 35, 24, -24, 62, 50, 62, -72]
135
- ),
136
- 56
137
- ),
138
- neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
139
- getVibrantNeutralHue(sourceColorHct),
140
- getVibrantNeutralChroma(sourceColorHct)
141
- ),
142
- neutralVariant: ({ sourceColorHct }) => {
143
- const vibrantNeutralHue = getVibrantNeutralHue(sourceColorHct);
144
- const vibrantNeutralChroma = getVibrantNeutralChroma(sourceColorHct);
145
- return materialColorUtilities.TonalPalette.fromHueAndChroma(
146
- vibrantNeutralHue,
147
- vibrantNeutralChroma * 1.29
148
- );
149
- },
150
- error: ({ sourceColorHct }) => {
151
- const errorHue = loader.getPiecewiseHue(
152
- sourceColorHct,
153
- [0, 3, 13, 23, 33, 43, 153, 273, 360],
154
- [12, 22, 32, 12, 22, 32, 22, 12]
155
- );
156
- return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 80);
157
- }
158
- },
159
- customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
160
- loader.getRotatedHue(
161
- colorHct,
162
- [0, 38, 105, 140, 333, 360],
163
- [-14, 10, -14, 10, -14]
164
- ),
165
- 56
166
- )
167
- };
168
- const fidelityVariant = {
169
- name: "fidelity",
170
- palettes: {
171
- primary: ({ sourceColorHct, isDark }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma),
172
- secondary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
173
- sourceColorHct.hue,
174
- sourceColorHct.chroma * 0.5
175
- ),
176
- tertiary: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(
177
- loader.getRotatedHue(
178
- sourceColorHct,
179
- [0, 20, 71, 161, 333, 360],
180
- [-40, 48, -32, 40, -32]
181
- ),
182
- sourceColorHct.chroma
183
- ),
184
- neutral: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5),
185
- neutralVariant: ({ sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(sourceColorHct.hue, 5 * 1.7),
186
- error: ({ sourceColorHct }) => {
187
- const errorHue = loader.getPiecewiseHue(
188
- sourceColorHct,
189
- [0, 3, 13, 23, 33, 43, 153, 273, 360],
190
- [12, 22, 32, 12, 22, 32, 22, 12]
191
- );
192
- return materialColorUtilities.TonalPalette.fromHueAndChroma(errorHue, 60);
193
- }
194
- },
195
- customPalettes: ({ colorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(colorHct.hue, colorHct.chroma)
196
- };
197
- const Variants = {
198
- Expressive: expressiveVariant,
199
- Neutral: neutralVariant,
200
- TonalSpot: loader.tonalSpotVariant,
201
- Vibrant: vibrantVariant,
202
- Fidelity: fidelityVariant
203
- };
204
- class PluginAbstract {
205
- constructor(options) {
206
- __publicField(this, "options");
207
- __publicField(this, "pluginInstance");
208
- this.options = options;
209
- }
210
- init(api) {
211
- var _a, _b;
212
- this.pluginInstance = new this.pluginClass(api, this.options);
213
- (_b = (_a = this.pluginInstance).onInit) == null ? void 0 : _b.call(_a);
214
- return this;
215
- }
216
- getInstance() {
217
- if (!this.pluginInstance) {
218
- throw new Error(`Plugin ${this.name} is not initialized`);
219
- }
220
- return this.pluginInstance;
221
- }
222
- }
223
- class PluginImplAbstract {
224
- constructor(api, options) {
225
- var _a;
226
- this.api = api;
227
- this.options = options;
228
- (_a = this.onInit) == null ? void 0 : _a.call(this);
229
- }
230
- }
231
- var FontFamily = /* @__PURE__ */ ((FontFamily2) => {
232
- FontFamily2["Expressive"] = "expressive";
233
- FontFamily2["Neutral"] = "neutral";
234
- return FontFamily2;
235
- })(FontFamily || {});
236
- class FontPlugin extends PluginAbstract {
237
- constructor() {
238
- super(...arguments);
239
- __publicField(this, "dependencies", []);
240
- __publicField(this, "name", "font");
241
- __publicField(this, "pluginClass", FontPluginImpl);
242
- }
243
- }
244
- class FontPluginImpl extends PluginImplAbstract {
245
- constructor() {
246
- super(...arguments);
247
- __publicField(this, "_fontFamily");
248
- __publicField(this, "_fontStyles");
249
- }
250
- get fontFamily() {
251
- if (!this._fontFamily) throw new Error("Font family not initialized");
252
- return this._fontFamily;
253
- }
254
- set fontFamily(value) {
255
- this._fontFamily = value;
256
- }
257
- get fontStyles() {
258
- if (!this._fontStyles) throw new Error("Font styles not initialized");
259
- return this._fontStyles;
260
- }
261
- set fontStyles(value) {
262
- this._fontStyles = value;
263
- }
264
- getFonts() {
265
- return {
266
- fontStyles: this.fontStyles,
267
- fontFamily: this.fontFamily
268
- };
269
- }
270
- onInit() {
271
- var _a, _b, _c, _d;
272
- this.fontFamily = {
273
- expressive: ((_b = (_a = this.options) == null ? void 0 : _a.fontFamily) == null ? void 0 : _b.expressive) ?? [
274
- "Roboto",
275
- "sans-serif"
276
- ],
277
- neutral: ((_d = (_c = this.options) == null ? void 0 : _c.fontFamily) == null ? void 0 : _d.neutral) ?? ["Roboto", "sans-serif"]
278
- };
279
- this.fontStyles = {
280
- display: {
281
- large: {
282
- fontWeight: 400,
283
- fontSize: 3.5625,
284
- lineHeight: 4,
285
- letterSpacing: -0.015625,
286
- fontFamily: "expressive"
287
- /* Expressive */
288
- },
289
- medium: {
290
- fontWeight: 400,
291
- fontSize: 2.8125,
292
- lineHeight: 3.25,
293
- fontFamily: "expressive"
294
- /* Expressive */
295
- },
296
- small: {
297
- fontWeight: 400,
298
- fontSize: 2.25,
299
- lineHeight: 2.75,
300
- fontFamily: "expressive"
301
- /* Expressive */
302
- }
303
- },
304
- headline: {
305
- large: {
306
- fontWeight: 400,
307
- fontSize: 2,
308
- lineHeight: 2.5,
309
- fontFamily: "expressive"
310
- /* Expressive */
311
- },
312
- medium: {
313
- fontWeight: 400,
314
- fontSize: 1.75,
315
- lineHeight: 2.25,
316
- fontFamily: "expressive"
317
- /* Expressive */
318
- },
319
- small: {
320
- fontWeight: 400,
321
- fontSize: 1.5,
322
- lineHeight: 2,
323
- fontFamily: "expressive"
324
- /* Expressive */
325
- }
326
- },
327
- title: {
328
- large: {
329
- fontWeight: 400,
330
- fontSize: 1.375,
331
- lineHeight: 1.75,
332
- fontFamily: "neutral"
333
- /* Neutral */
334
- },
335
- medium: {
336
- fontWeight: 500,
337
- fontSize: 1,
338
- lineHeight: 1.5,
339
- fontFamily: "neutral",
340
- letterSpacing: 9375e-6
341
- },
342
- small: {
343
- fontWeight: 500,
344
- fontSize: 0.875,
345
- lineHeight: 1.25,
346
- fontFamily: "neutral",
347
- letterSpacing: 625e-5
348
- }
349
- },
350
- label: {
351
- large: {
352
- fontWeight: 500,
353
- fontSize: 0.875,
354
- lineHeight: 1.25,
355
- fontFamily: "neutral",
356
- letterSpacing: 625e-5
357
- },
358
- medium: {
359
- fontWeight: 500,
360
- fontSize: 0.75,
361
- lineHeight: 1,
362
- fontFamily: "neutral",
363
- letterSpacing: 0.03125
364
- },
365
- small: {
366
- fontWeight: 500,
367
- fontSize: 0.6875,
368
- lineHeight: 1,
369
- fontFamily: "neutral",
370
- letterSpacing: 0.03125
371
- }
372
- },
373
- body: {
374
- large: {
375
- fontWeight: 400,
376
- fontSize: 1,
377
- lineHeight: 1.5625,
378
- fontFamily: "neutral",
379
- letterSpacing: 0.03125
380
- },
381
- medium: {
382
- fontWeight: 400,
383
- fontSize: 0.875,
384
- lineHeight: 1.25,
385
- fontFamily: "neutral",
386
- letterSpacing: 0.015625
387
- },
388
- small: {
389
- fontWeight: 400,
390
- fontSize: 0.75,
391
- lineHeight: 1,
392
- fontFamily: "neutral",
393
- letterSpacing: 0.025
394
- }
395
- }
396
- };
397
- if (this.options && this.options.fontStyles)
398
- Object.entries(this.options.fontStyles).forEach(([key, fontParam]) => {
399
- const fontRole = key;
400
- Object.entries(fontParam).forEach(([size, fontStyle]) => {
401
- const fontSize = size;
402
- if (fontStyle) {
403
- this.fontStyles[fontRole][fontSize] = {
404
- ...this.fontStyles[fontRole][fontSize],
405
- ...fontStyle
406
- };
407
- }
408
- });
409
- });
410
- }
411
- }
412
- function defineConfig(configObject) {
413
- if (!configObject || typeof configObject !== "object") {
414
- throw new Error("The configuration is missing or not an object");
415
- }
416
- if (!("sourceColor" in configObject)) {
417
- throw new Error("Invalid configuration");
418
- }
419
- return configObject;
420
- }
421
- exports.FontFamily = FontFamily;
422
- exports.FontPlugin = FontPlugin;
423
- exports.PluginAbstract = PluginAbstract;
424
- exports.PluginImplAbstract = PluginImplAbstract;
425
- exports.Variants = Variants;
426
- exports.defineConfig = defineConfig;
427
- exports.expressiveVariant = expressiveVariant;
428
- exports.neutralVariant = neutralVariant;
429
- exports.vibrantVariant = vibrantVariant;
@@ -1,8 +0,0 @@
1
- export * from './theme.module';
2
- export * from './variants';
3
- export * from './scheme.manager';
4
- export * from './scheme';
5
- export * from './theme.api';
6
- export * from './variant';
7
- export * from './variant.manager';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC"}
@@ -1,20 +0,0 @@
1
- import { TonalPalette } from '@material/material-color-utilities';
2
- import { Hct } from '../material-color-utilities/htc';
3
- import { Variant } from './variant';
4
- export interface SchemeOptions {
5
- sourceColorArgb: number;
6
- contrastLevel: number;
7
- isDark: boolean;
8
- palettes: Map<string, TonalPalette>;
9
- variant: Variant;
10
- }
11
- export declare class Scheme {
12
- readonly options: SchemeOptions;
13
- constructor(options: SchemeOptions);
14
- get variant(): 'expressive' | 'neutral' | 'tonalSpot' | 'vibrant' | 'fidelity' | string;
15
- get contrastLevel(): number;
16
- get isDark(): boolean;
17
- get sourceColorHct(): Hct;
18
- getPalette(key: 'primary' | 'secondary' | 'tertiary' | 'neutral' | 'neutralVariant' | 'error' | string): TonalPalette;
19
- }
20
- //# sourceMappingURL=scheme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scheme.d.ts","sourceRoot":"","sources":["../../src/theme/scheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,MAAM;IACL,QAAQ,CAAC,OAAO,EAAE,aAAa;gBAAtB,OAAO,EAAE,aAAa;IAE3C,IAAI,OAAO,IACP,YAAY,GACZ,SAAS,GACT,WAAW,GACX,SAAS,GACT,UAAU,GACV,MAAM,CAET;IAED,IAAI,aAAa,WAKhB;IAED,IAAI,MAAM,YAKT;IAED,IAAI,cAAc,QAKjB;IAED,UAAU,CACR,GAAG,EACC,SAAS,GACT,WAAW,GACX,UAAU,GACV,SAAS,GACT,gBAAgB,GAChB,OAAO,GACP,MAAM,GACT,YAAY;CAUhB"}
@@ -1,31 +0,0 @@
1
- import { Scheme, SchemeOptions } from './scheme';
2
- import { TonalPalette } from '@material/material-color-utilities';
3
- import { Hct } from '../material-color-utilities/htc';
4
- export type SchemeServiceOptions = Omit<SchemeOptions, 'palettes' | 'sourceColorArgb'> & {
5
- sourcesColorHex: Record<string, string> & {
6
- primary?: string;
7
- };
8
- palettes: Record<string, {
9
- sourceColorkey: string;
10
- tonalPalette: CustomPaletteFunction;
11
- } | {
12
- sourceColorkey?: never;
13
- tonalPalette: PaletteFunction;
14
- }>;
15
- };
16
- type PaletteFunctionArgs = {
17
- isDark: boolean;
18
- sourceColorHct: Hct;
19
- };
20
- export type PaletteFunction = (args: PaletteFunctionArgs) => TonalPalette;
21
- export type CustomPaletteFunction = (args: PaletteFunctionArgs & {
22
- colorHct: Hct;
23
- }) => TonalPalette;
24
- export declare class SchemeManager {
25
- private schemeEntity?;
26
- private options?;
27
- createOrUpdate(options: Partial<SchemeServiceOptions>): void;
28
- get(): Scheme;
29
- }
30
- export {};
31
- //# sourceMappingURL=scheme.manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scheme.manager.d.ts","sourceRoot":"","sources":["../../src/theme/scheme.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAe,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAEtD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,aAAa,EACb,UAAU,GAAG,iBAAiB,CAC/B,GAAG;IACF,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,QAAQ,EAAE,MAAM,CACd,MAAM,EACJ;QACE,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,qBAAqB,CAAC;KACrC,GACD;QACE,cAAc,CAAC,EAAE,KAAK,CAAC;QACvB,YAAY,EAAE,eAAe,CAAC;KAC/B,CACJ,CAAC;CACH,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,mBAAmB,KAAK,YAAY,CAAC;AAC1E,MAAM,MAAM,qBAAqB,GAAG,CAClC,IAAI,EAAE,mBAAmB,GAAG;IAC1B,QAAQ,EAAE,GAAG,CAAC;CACf,KACE,YAAY,CAAC;AAElB,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,OAAO,CAAC,CAAuB;IAEvC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,oBAAoB,CAAC;IAuDrD,GAAG,IAAI,MAAM;CAMd"}
@@ -1,23 +0,0 @@
1
- import { SchemeManager, SchemeServiceOptions } from './scheme.manager';
2
- import { VariantManager } from './variant.manager';
3
- import { Variant } from './variant';
4
- type ThemeOptions = Omit<SchemeServiceOptions, 'palettes' | 'sourcesColorHex'> & {
5
- sourceColorHex: string;
6
- };
7
- export declare class ThemeApi {
8
- private readonly schemeManager;
9
- private readonly variantManager;
10
- constructor({ schemeManager, variantManager, }: {
11
- schemeManager: SchemeManager;
12
- variantManager: VariantManager;
13
- });
14
- create(options: ThemeOptions & {
15
- variant: Variant;
16
- }): void;
17
- update(options: Partial<ThemeOptions> & {
18
- variant?: Variant;
19
- }): void;
20
- addCustomPalette(key: string, colorHex: string): void;
21
- }
22
- export {};
23
- //# sourceMappingURL=theme.api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.api.d.ts","sourceRoot":"","sources":["../../src/theme/theme.api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,KAAK,YAAY,GAAG,IAAI,CACtB,oBAAoB,EACpB,UAAU,GAAG,iBAAiB,CAC/B,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ/B,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAEpC,EACV,aAAa,EACb,cAAc,GACf,EAAE;QACD,aAAa,EAAE,aAAa,CAAC;QAC7B,cAAc,EAAE,cAAc,CAAC;KAChC;IA4BD,MAAM,CAAC,OAAO,EAAE,YAAY,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IAQnD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;IAQ7D,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAO/C"}
@@ -1,3 +0,0 @@
1
- import { Module } from '../app.container';
2
- export declare const ThemeModule: Module;
3
- //# sourceMappingURL=theme.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"theme.module.d.ts","sourceRoot":"","sources":["../../src/theme/theme.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAK1C,eAAO,MAAM,WAAW,EAAE,MAIzB,CAAC"}
@@ -1,36 +0,0 @@
1
- import { TonalPalette } from '@material/material-color-utilities';
2
- import { Hct } from '../material-color-utilities/htc';
3
- import { AddColors } from '../color';
4
- export declare const getPiecewiseHue: (sourceColorHct: Hct, hueBreakpoints: number[], hues: number[]) => number;
5
- export declare const getRotatedHue: (sourceColorHct: Hct, hueBreakpoints: number[], rotations: number[]) => number;
6
- export declare class Variant {
7
- palettes: Record<string, (args: {
8
- sourceColorHct: Hct;
9
- isDark: boolean;
10
- }) => TonalPalette>;
11
- name: string;
12
- customPalettes?: ((args: {
13
- isDark: boolean;
14
- sourceColorHct: Hct;
15
- colorHct: Hct;
16
- }) => TonalPalette) | undefined;
17
- /** TODO
18
- * Defines color modifications through variation.
19
- * Allows customization of specific colors in the theme.
20
- */
21
- colors?: AddColors['colors'];
22
- constructor(palettes: Record<string, (args: {
23
- sourceColorHct: Hct;
24
- isDark: boolean;
25
- }) => TonalPalette> | undefined, name: string, customPalettes?: ((args: {
26
- isDark: boolean;
27
- sourceColorHct: Hct;
28
- colorHct: Hct;
29
- }) => TonalPalette) | undefined,
30
- /** TODO
31
- * Defines color modifications through variation.
32
- * Allows customization of specific colors in the theme.
33
- */
34
- colors?: AddColors['colors']);
35
- }
36
- //# sourceMappingURL=variant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"variant.d.ts","sourceRoot":"","sources":["../../src/theme/variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACb,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,eAAO,MAAM,eAAe,GAC1B,gBAAgB,GAAG,EACnB,gBAAgB,MAAM,EAAE,EACxB,MAAM,MAAM,EAAE,KACb,MASF,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,gBAAgB,GAAG,EACnB,gBAAgB,MAAM,EAAE,EACxB,WAAW,MAAM,EAAE,KAClB,MAMF,CAAC;AAEF,qBAAa,OAAO;IAET,QAAQ,EAAE,MAAM,CACrB,MAAM,EACN,CAAC,IAAI,EAAE;QAAE,cAAc,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,KAAK,YAAY,CACjE;IACM,IAAI,EAAE,MAAM;IACZ,cAAc,CAAC,GAAE,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,OAAO,CAAC;QAChB,cAAc,EAAE,GAAG,CAAC;QACpB,QAAQ,EAAE,GAAG,CAAC;KACf,KAAK,YAAY;IAClB;;;OAGG;IACI,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC;gBAd5B,QAAQ,EAAE,MAAM,CACrB,MAAM,EACN,CAAC,IAAI,EAAE;QAAE,cAAc,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,KAAK,YAAY,CACjE,YAAK,EACC,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,GAAE,CAAC,IAAI,EAAE;QAC7B,MAAM,EAAE,OAAO,CAAC;QAChB,cAAc,EAAE,GAAG,CAAC;QACpB,QAAQ,EAAE,GAAG,CAAC;KACf,KAAK,YAAY,aAAA;IAClB;;;OAGG;IACI,MAAM,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC;CAEtC"}
@@ -1,14 +0,0 @@
1
- import { SchemeManager } from './scheme.manager';
2
- import { Variant } from './variant';
3
- export declare class VariantManager {
4
- customPalettes: Record<string, string>;
5
- private variantEntity?;
6
- private readonly schemeManager;
7
- constructor({ schemeManager }: {
8
- schemeManager: SchemeManager;
9
- });
10
- addCustomPalette(key: string, colorHex: string): void;
11
- set(variantEntity: Variant): void;
12
- private update;
13
- }
14
- //# sourceMappingURL=variant.manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"variant.manager.d.ts","sourceRoot":"","sources":["../../src/theme/variant.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,cAAc;IAClB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM;IACnD,OAAO,CAAC,aAAa,CAAC,CAAU;IAEhC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;gBAElC,EAAE,aAAa,EAAE,EAAE;QAAE,aAAa,EAAE,aAAa,CAAA;KAAE;IAI/D,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK9C,GAAG,CAAC,aAAa,EAAE,OAAO;IAK1B,OAAO,CAAC,MAAM;CA8Bf"}
@@ -1,3 +0,0 @@
1
- import { Variant } from '../variant';
2
- export declare const expressiveVariant: Variant;
3
- //# sourceMappingURL=expressive.variant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expressive.variant.d.ts","sourceRoot":"","sources":["../../../src/theme/variants/expressive.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,OAAO,EAAE,MAAM,YAAY,CAAC;AAoBrE,eAAO,MAAM,iBAAiB,EAAE,OA4D/B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fidelity.variant.d.ts","sourceRoot":"","sources":["../../../src/theme/variants/fidelity.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrE,eAAO,MAAM,eAAe,EAAE,OAkC7B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theme/variants/index.ts"],"names":[],"mappings":"AAMA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAElC,eAAO,MAAM,QAAQ;;;;;;CAMpB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"neutral.variant.d.ts","sourceRoot":"","sources":["../../../src/theme/variants/neutral.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrE,eAAO,MAAM,cAAc,EAAE,OAwC5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tonal-spot.variant.d.ts","sourceRoot":"","sources":["../../../src/theme/variants/tonal-spot.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrE,eAAO,MAAM,gBAAgB,EAAE,OA+B9B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vibrant.variant.d.ts","sourceRoot":"","sources":["../../../src/theme/variants/vibrant.variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,OAAO,EAAE,MAAM,YAAY,CAAC;AAiBrE,eAAO,MAAM,cAAc,EAAE,OAsD5B,CAAC"}