@udixio/theme 1.3.1 → 2.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 (144) hide show
  1. package/CHANGELOG.md +23 -2
  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 +23 -18
  9. package/dist/browser.js +34 -29
  10. package/dist/color/color.api.d.ts +16 -31
  11. package/dist/color/color.api.d.ts.map +1 -1
  12. package/dist/color/color.d.ts +100 -0
  13. package/dist/color/color.d.ts.map +1 -0
  14. package/dist/color/color.manager.d.ts +9 -18
  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 +5 -1
  19. package/dist/color/default-color.d.ts.map +1 -1
  20. package/dist/color/index.d.ts +1 -1
  21. package/dist/color/index.d.ts.map +1 -1
  22. package/dist/config/config.interface.d.ts +4 -4
  23. package/dist/config/config.interface.d.ts.map +1 -1
  24. package/dist/context/context.d.ts +41 -0
  25. package/dist/context/context.d.ts.map +1 -0
  26. package/dist/context/context.module.d.ts +3 -0
  27. package/dist/context/context.module.d.ts.map +1 -0
  28. package/dist/context/index.d.ts +3 -0
  29. package/dist/context/index.d.ts.map +1 -0
  30. package/dist/font.plugin-5Xpo-ntw.js +228 -0
  31. package/dist/font.plugin-FPU_gL1Y.cjs +227 -0
  32. package/dist/index.d.ts +6 -4
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/{load-from-path-Bo1kCfh9.js → load-from-path-CBnO8ESw.js} +1 -1
  35. package/dist/{load-from-path-DoZnR1-p.cjs → load-from-path-kuofMGN3.cjs} +2 -2
  36. package/dist/loader/loader.d.ts +1 -1
  37. package/dist/loader/loader.d.ts.map +1 -1
  38. package/dist/loader-BzsrGBu-.cjs +3905 -0
  39. package/dist/loader-CoayTlSl.js +3906 -0
  40. package/dist/material-color-utilities/dynamic_color.d.ts +0 -22
  41. package/dist/material-color-utilities/dynamic_color.d.ts.map +1 -1
  42. package/dist/material-color-utilities/toneDeltaPair.d.ts +8 -8
  43. package/dist/material-color-utilities/toneDeltaPair.d.ts.map +1 -1
  44. package/dist/node.cjs +24 -19
  45. package/dist/node.js +36 -31
  46. package/dist/palette/index.d.ts +4 -0
  47. package/dist/palette/index.d.ts.map +1 -0
  48. package/dist/palette/palette.api.d.ts +13 -0
  49. package/dist/palette/palette.api.d.ts.map +1 -0
  50. package/dist/palette/palette.d.ts +33 -0
  51. package/dist/palette/palette.d.ts.map +1 -0
  52. package/dist/palette/palette.manager.d.ts +20 -0
  53. package/dist/palette/palette.manager.d.ts.map +1 -0
  54. package/dist/palette/palette.module.d.ts +3 -0
  55. package/dist/palette/palette.module.d.ts.map +1 -0
  56. package/dist/plugins/font/font.plugin.d.ts +1 -1
  57. package/dist/plugins/font/font.plugin.d.ts.map +1 -1
  58. package/dist/variant/index.d.ts +3 -0
  59. package/dist/variant/index.d.ts.map +1 -0
  60. package/dist/variant/variant.d.ts +31 -0
  61. package/dist/variant/variant.d.ts.map +1 -0
  62. package/dist/variant/variants/expressive.variant.d.ts +2 -0
  63. package/dist/variant/variants/expressive.variant.d.ts.map +1 -0
  64. package/dist/{theme → variant}/variants/index.d.ts +1 -1
  65. package/dist/variant/variants/index.d.ts.map +1 -0
  66. package/dist/variant/variants/neutral.variant.d.ts.map +1 -0
  67. package/dist/variant/variants/tonal-spot.variant.d.ts.map +1 -0
  68. package/dist/variant/variants/udixio.variant.d.ts +3 -0
  69. package/dist/variant/variants/udixio.variant.d.ts.map +1 -0
  70. package/dist/variant/variants/vibrant.variant.d.ts.map +1 -0
  71. package/package.json +1 -1
  72. package/src/API.ts +12 -5
  73. package/src/app.container.ts +22 -11
  74. package/src/bootstrap.ts +1 -1
  75. package/src/color/color.api.ts +189 -47
  76. package/src/color/color.manager.ts +34 -189
  77. package/src/color/color.ts +295 -0
  78. package/src/color/color.utils.ts +48 -3
  79. package/src/color/default-color.ts +390 -425
  80. package/src/color/index.ts +1 -1
  81. package/src/config/config.interface.ts +5 -4
  82. package/src/context/context.module.ts +7 -0
  83. package/src/context/context.ts +169 -0
  84. package/src/context/index.ts +2 -0
  85. package/src/index.ts +6 -4
  86. package/src/loader/loader.ts +11 -24
  87. package/src/material-color-utilities/dynamic_color.ts +25 -34
  88. package/src/material-color-utilities/toneDeltaPair.ts +44 -41
  89. package/src/palette/index.ts +3 -0
  90. package/src/palette/palette.api.ts +43 -0
  91. package/src/palette/palette.manager.ts +74 -0
  92. package/src/palette/palette.module.ts +9 -0
  93. package/src/palette/palette.ts +206 -0
  94. package/src/plugins/font/font.plugin.ts +1 -1
  95. package/src/variant/index.ts +2 -0
  96. package/src/variant/variant.ts +84 -0
  97. package/src/{theme → variant}/variants/expressive.variant.ts +33 -29
  98. package/src/{theme → variant}/variants/index.ts +2 -2
  99. package/src/variant/variants/neutral.variant.ts +47 -0
  100. package/src/variant/variants/tonal-spot.variant.ts +37 -0
  101. package/src/variant/variants/udixio.variant.ts +846 -0
  102. package/src/{theme → variant}/variants/vibrant.variant.ts +23 -22
  103. package/dist/color/configurable-color.d.ts +0 -31
  104. package/dist/color/configurable-color.d.ts.map +0 -1
  105. package/dist/define-config-BasMdCqD.js +0 -430
  106. package/dist/define-config-CKSsLMnc.cjs +0 -429
  107. package/dist/loader-C8_TyOuS.js +0 -2698
  108. package/dist/loader-R7hccp8_.cjs +0 -2697
  109. package/dist/theme/index.d.ts +0 -8
  110. package/dist/theme/index.d.ts.map +0 -1
  111. package/dist/theme/scheme.d.ts +0 -20
  112. package/dist/theme/scheme.d.ts.map +0 -1
  113. package/dist/theme/scheme.manager.d.ts +0 -31
  114. package/dist/theme/scheme.manager.d.ts.map +0 -1
  115. package/dist/theme/theme.api.d.ts +0 -24
  116. package/dist/theme/theme.api.d.ts.map +0 -1
  117. package/dist/theme/theme.module.d.ts +0 -3
  118. package/dist/theme/theme.module.d.ts.map +0 -1
  119. package/dist/theme/variant.d.ts +0 -36
  120. package/dist/theme/variant.d.ts.map +0 -1
  121. package/dist/theme/variant.manager.d.ts +0 -14
  122. package/dist/theme/variant.manager.d.ts.map +0 -1
  123. package/dist/theme/variants/expressive.variant.d.ts +0 -3
  124. package/dist/theme/variants/expressive.variant.d.ts.map +0 -1
  125. package/dist/theme/variants/fidelity.variant.d.ts +0 -3
  126. package/dist/theme/variants/fidelity.variant.d.ts.map +0 -1
  127. package/dist/theme/variants/index.d.ts.map +0 -1
  128. package/dist/theme/variants/neutral.variant.d.ts.map +0 -1
  129. package/dist/theme/variants/tonal-spot.variant.d.ts.map +0 -1
  130. package/dist/theme/variants/vibrant.variant.d.ts.map +0 -1
  131. package/src/color/configurable-color.ts +0 -67
  132. package/src/theme/index.ts +0 -7
  133. package/src/theme/scheme.manager.ts +0 -100
  134. package/src/theme/scheme.ts +0 -66
  135. package/src/theme/theme.api.ts +0 -82
  136. package/src/theme/theme.module.ts +0 -11
  137. package/src/theme/variant.manager.ts +0 -58
  138. package/src/theme/variant.ts +0 -53
  139. package/src/theme/variants/fidelity.variant.ts +0 -38
  140. package/src/theme/variants/neutral.variant.ts +0 -45
  141. package/src/theme/variants/tonal-spot.variant.ts +0 -35
  142. /package/dist/{theme → variant}/variants/neutral.variant.d.ts +0 -0
  143. /package/dist/{theme → variant}/variants/tonal-spot.variant.d.ts +0 -0
  144. /package/dist/{theme → variant}/variants/vibrant.variant.d.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-R7hccp8_.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, sourceColorHct }) => materialColorUtilities.TonalPalette.fromHueAndChroma(colorHct.hue, sourceColorHct.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;