@udixio/theme 1.1.0 → 1.2.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.
- package/CHANGELOG.md +25 -0
- package/bin/main.ts +85 -0
- package/dist/API.d.ts +1 -0
- package/dist/API.d.ts.map +1 -1
- package/dist/bin.cjs +64 -0
- package/dist/bin.js +63 -0
- package/dist/browser.cjs +40 -0
- package/dist/browser.js +40 -0
- package/dist/config/config.interface.d.ts.map +1 -0
- package/dist/config/define-config.d.ts.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.node.d.ts +2 -0
- package/dist/config/index.node.d.ts.map +1 -0
- package/dist/config/resolver-config.d.ts +11 -0
- package/dist/config/resolver-config.d.ts.map +1 -0
- package/dist/define-config-BFo7Sy7c.cjs +399 -0
- package/dist/define-config-CGG8l3fb.js +400 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.node.d.ts +4 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/load-from-path-BvdfXUD0.cjs +78 -0
- package/dist/load-from-path-CFpw2P_Y.js +39 -0
- package/dist/loader/index.d.ts +2 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.node.d.ts +3 -0
- package/dist/loader/index.node.d.ts.map +1 -0
- package/dist/loader/load-from-path.d.ts +5 -0
- package/dist/loader/load-from-path.d.ts.map +1 -0
- package/dist/loader/loader.d.ts +3 -0
- package/dist/loader/loader.d.ts.map +1 -0
- package/dist/loader/unplugin.d.ts +16 -0
- package/dist/loader/unplugin.d.ts.map +1 -0
- package/dist/{index.js → loader-C_BIrsO2.js} +58 -557
- package/dist/{index.cjs → loader-TksB6_mM.cjs} +32 -572
- package/dist/node.cjs +192 -0
- package/dist/node.js +171 -0
- package/dist/plugin/plugin.api.d.ts +1 -1
- package/dist/plugin/plugin.api.d.ts.map +1 -1
- package/package.json +27 -10
- package/src/API.ts +4 -0
- package/src/config/index.node.ts +1 -0
- package/src/{adapter → config}/index.ts +0 -1
- package/src/config/resolver-config.ts +49 -0
- package/src/index.browser.ts +1 -0
- package/src/index.node.ts +3 -0
- package/src/index.ts +2 -2
- package/src/loader/index.node.ts +2 -0
- package/src/loader/index.ts +1 -0
- package/src/loader/load-from-path.ts +9 -0
- package/src/{adapter/adapter.abstract.ts → loader/loader.ts} +27 -28
- package/src/loader/unplugin.ts +158 -0
- package/src/plugin/plugin.api.ts +4 -4
- package/vite.config.ts +18 -4
- package/dist/adapter/adapter.abstract.d.ts +0 -10
- package/dist/adapter/adapter.abstract.d.ts.map +0 -1
- package/dist/adapter/config.interface.d.ts.map +0 -1
- package/dist/adapter/define-config.d.ts.map +0 -1
- package/dist/adapter/file-adapter.mixin.d.ts +0 -18
- package/dist/adapter/file-adapter.mixin.d.ts.map +0 -1
- package/dist/adapter/index.d.ts +0 -4
- package/dist/adapter/index.d.ts.map +0 -1
- package/dist/adapters/index.d.ts +0 -3
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/node.adapter.d.ts +0 -7
- package/dist/adapters/node.adapter.d.ts.map +0 -1
- package/dist/adapters/vite.adapter.d.ts +0 -3
- package/dist/adapters/vite.adapter.d.ts.map +0 -1
- package/src/adapter/file-adapter.mixin.ts +0 -72
- package/src/adapters/index.ts +0 -2
- package/src/adapters/node.adapter.ts +0 -57
- package/src/adapters/vite.adapter.ts +0 -79
- /package/dist/{adapter → config}/config.interface.d.ts +0 -0
- /package/dist/{adapter → config}/define-config.d.ts +0 -0
- /package/src/{adapter → config}/config.interface.ts +0 -0
- /package/src/{adapter → config}/define-config.ts +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
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-TksB6_mM.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 Variants = {
|
|
169
|
+
Expressive: expressiveVariant,
|
|
170
|
+
Neutral: neutralVariant,
|
|
171
|
+
TonalSpot: loader.tonalSpotVariant,
|
|
172
|
+
Vibrant: vibrantVariant
|
|
173
|
+
};
|
|
174
|
+
class PluginAbstract {
|
|
175
|
+
constructor(options) {
|
|
176
|
+
__publicField(this, "options");
|
|
177
|
+
__publicField(this, "pluginInstance");
|
|
178
|
+
this.options = options;
|
|
179
|
+
}
|
|
180
|
+
init(api) {
|
|
181
|
+
var _a, _b;
|
|
182
|
+
this.pluginInstance = new this.pluginClass(api, this.options);
|
|
183
|
+
(_b = (_a = this.pluginInstance).onInit) == null ? void 0 : _b.call(_a);
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
getInstance() {
|
|
187
|
+
if (!this.pluginInstance) {
|
|
188
|
+
throw new Error(`Plugin ${this.name} is not initialized`);
|
|
189
|
+
}
|
|
190
|
+
return this.pluginInstance;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
class PluginImplAbstract {
|
|
194
|
+
constructor(api, options) {
|
|
195
|
+
var _a;
|
|
196
|
+
this.api = api;
|
|
197
|
+
this.options = options;
|
|
198
|
+
(_a = this.onInit) == null ? void 0 : _a.call(this);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
var FontFamily = /* @__PURE__ */ ((FontFamily2) => {
|
|
202
|
+
FontFamily2["Expressive"] = "expressive";
|
|
203
|
+
FontFamily2["Neutral"] = "neutral";
|
|
204
|
+
return FontFamily2;
|
|
205
|
+
})(FontFamily || {});
|
|
206
|
+
class FontPlugin extends PluginAbstract {
|
|
207
|
+
constructor() {
|
|
208
|
+
super(...arguments);
|
|
209
|
+
__publicField(this, "dependencies", []);
|
|
210
|
+
__publicField(this, "name", "font");
|
|
211
|
+
__publicField(this, "pluginClass", FontPluginImpl);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
class FontPluginImpl extends PluginImplAbstract {
|
|
215
|
+
constructor() {
|
|
216
|
+
super(...arguments);
|
|
217
|
+
__publicField(this, "_fontFamily");
|
|
218
|
+
__publicField(this, "_fontStyles");
|
|
219
|
+
}
|
|
220
|
+
get fontFamily() {
|
|
221
|
+
if (!this._fontFamily) throw new Error("Font family not initialized");
|
|
222
|
+
return this._fontFamily;
|
|
223
|
+
}
|
|
224
|
+
set fontFamily(value) {
|
|
225
|
+
this._fontFamily = value;
|
|
226
|
+
}
|
|
227
|
+
get fontStyles() {
|
|
228
|
+
if (!this._fontStyles) throw new Error("Font styles not initialized");
|
|
229
|
+
return this._fontStyles;
|
|
230
|
+
}
|
|
231
|
+
set fontStyles(value) {
|
|
232
|
+
this._fontStyles = value;
|
|
233
|
+
}
|
|
234
|
+
getFonts() {
|
|
235
|
+
return {
|
|
236
|
+
fontStyles: this.fontStyles,
|
|
237
|
+
fontFamily: this.fontFamily
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
onInit() {
|
|
241
|
+
var _a, _b, _c, _d;
|
|
242
|
+
this.fontFamily = {
|
|
243
|
+
expressive: ((_b = (_a = this.options) == null ? void 0 : _a.fontFamily) == null ? void 0 : _b.expressive) ?? [
|
|
244
|
+
"Roboto",
|
|
245
|
+
"sans-serif"
|
|
246
|
+
],
|
|
247
|
+
neutral: ((_d = (_c = this.options) == null ? void 0 : _c.fontFamily) == null ? void 0 : _d.neutral) ?? ["Roboto", "sans-serif"]
|
|
248
|
+
};
|
|
249
|
+
this.fontStyles = {
|
|
250
|
+
display: {
|
|
251
|
+
large: {
|
|
252
|
+
fontWeight: 400,
|
|
253
|
+
fontSize: 3.5625,
|
|
254
|
+
lineHeight: 4,
|
|
255
|
+
letterSpacing: -0.015625,
|
|
256
|
+
fontFamily: "expressive"
|
|
257
|
+
/* Expressive */
|
|
258
|
+
},
|
|
259
|
+
medium: {
|
|
260
|
+
fontWeight: 400,
|
|
261
|
+
fontSize: 2.8125,
|
|
262
|
+
lineHeight: 3.25,
|
|
263
|
+
fontFamily: "expressive"
|
|
264
|
+
/* Expressive */
|
|
265
|
+
},
|
|
266
|
+
small: {
|
|
267
|
+
fontWeight: 400,
|
|
268
|
+
fontSize: 2.25,
|
|
269
|
+
lineHeight: 2.75,
|
|
270
|
+
fontFamily: "expressive"
|
|
271
|
+
/* Expressive */
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
headline: {
|
|
275
|
+
large: {
|
|
276
|
+
fontWeight: 400,
|
|
277
|
+
fontSize: 2,
|
|
278
|
+
lineHeight: 2.5,
|
|
279
|
+
fontFamily: "expressive"
|
|
280
|
+
/* Expressive */
|
|
281
|
+
},
|
|
282
|
+
medium: {
|
|
283
|
+
fontWeight: 400,
|
|
284
|
+
fontSize: 1.75,
|
|
285
|
+
lineHeight: 2.25,
|
|
286
|
+
fontFamily: "expressive"
|
|
287
|
+
/* Expressive */
|
|
288
|
+
},
|
|
289
|
+
small: {
|
|
290
|
+
fontWeight: 400,
|
|
291
|
+
fontSize: 1.5,
|
|
292
|
+
lineHeight: 2,
|
|
293
|
+
fontFamily: "expressive"
|
|
294
|
+
/* Expressive */
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
title: {
|
|
298
|
+
large: {
|
|
299
|
+
fontWeight: 400,
|
|
300
|
+
fontSize: 1.375,
|
|
301
|
+
lineHeight: 1.75,
|
|
302
|
+
fontFamily: "neutral"
|
|
303
|
+
/* Neutral */
|
|
304
|
+
},
|
|
305
|
+
medium: {
|
|
306
|
+
fontWeight: 500,
|
|
307
|
+
fontSize: 1,
|
|
308
|
+
lineHeight: 1.5,
|
|
309
|
+
fontFamily: "neutral",
|
|
310
|
+
letterSpacing: 9375e-6
|
|
311
|
+
},
|
|
312
|
+
small: {
|
|
313
|
+
fontWeight: 500,
|
|
314
|
+
fontSize: 0.875,
|
|
315
|
+
lineHeight: 1.25,
|
|
316
|
+
fontFamily: "neutral",
|
|
317
|
+
letterSpacing: 625e-5
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
label: {
|
|
321
|
+
large: {
|
|
322
|
+
fontWeight: 500,
|
|
323
|
+
fontSize: 0.875,
|
|
324
|
+
lineHeight: 1.25,
|
|
325
|
+
fontFamily: "neutral",
|
|
326
|
+
letterSpacing: 625e-5
|
|
327
|
+
},
|
|
328
|
+
medium: {
|
|
329
|
+
fontWeight: 500,
|
|
330
|
+
fontSize: 0.75,
|
|
331
|
+
lineHeight: 1,
|
|
332
|
+
fontFamily: "neutral",
|
|
333
|
+
letterSpacing: 0.03125
|
|
334
|
+
},
|
|
335
|
+
small: {
|
|
336
|
+
fontWeight: 500,
|
|
337
|
+
fontSize: 0.6875,
|
|
338
|
+
lineHeight: 1,
|
|
339
|
+
fontFamily: "neutral",
|
|
340
|
+
letterSpacing: 0.03125
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
body: {
|
|
344
|
+
large: {
|
|
345
|
+
fontWeight: 400,
|
|
346
|
+
fontSize: 1,
|
|
347
|
+
lineHeight: 1.5625,
|
|
348
|
+
fontFamily: "neutral",
|
|
349
|
+
letterSpacing: 0.03125
|
|
350
|
+
},
|
|
351
|
+
medium: {
|
|
352
|
+
fontWeight: 400,
|
|
353
|
+
fontSize: 0.875,
|
|
354
|
+
lineHeight: 1.25,
|
|
355
|
+
fontFamily: "neutral",
|
|
356
|
+
letterSpacing: 0.015625
|
|
357
|
+
},
|
|
358
|
+
small: {
|
|
359
|
+
fontWeight: 400,
|
|
360
|
+
fontSize: 0.75,
|
|
361
|
+
lineHeight: 1,
|
|
362
|
+
fontFamily: "neutral",
|
|
363
|
+
letterSpacing: 0.025
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
if (this.options && this.options.fontStyles)
|
|
368
|
+
Object.entries(this.options.fontStyles).forEach(([key, fontParam]) => {
|
|
369
|
+
const fontRole = key;
|
|
370
|
+
Object.entries(fontParam).forEach(([size, fontStyle]) => {
|
|
371
|
+
const fontSize = size;
|
|
372
|
+
if (fontStyle) {
|
|
373
|
+
this.fontStyles[fontRole][fontSize] = {
|
|
374
|
+
...this.fontStyles[fontRole][fontSize],
|
|
375
|
+
...fontStyle
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
function defineConfig(configObject) {
|
|
383
|
+
if (!configObject || typeof configObject !== "object") {
|
|
384
|
+
throw new Error("The configuration is missing or not an object");
|
|
385
|
+
}
|
|
386
|
+
if (!("sourceColor" in configObject)) {
|
|
387
|
+
throw new Error("Invalid configuration");
|
|
388
|
+
}
|
|
389
|
+
return configObject;
|
|
390
|
+
}
|
|
391
|
+
exports.FontFamily = FontFamily;
|
|
392
|
+
exports.FontPlugin = FontPlugin;
|
|
393
|
+
exports.PluginAbstract = PluginAbstract;
|
|
394
|
+
exports.PluginImplAbstract = PluginImplAbstract;
|
|
395
|
+
exports.Variants = Variants;
|
|
396
|
+
exports.defineConfig = defineConfig;
|
|
397
|
+
exports.expressiveVariant = expressiveVariant;
|
|
398
|
+
exports.neutralVariant = neutralVariant;
|
|
399
|
+
exports.vibrantVariant = vibrantVariant;
|