@rededor/cura 0.2.0 → 0.3.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 (96) hide show
  1. package/dist/cjs/app-globals-5f5b9fbf.js +398 -0
  2. package/dist/cjs/cura-display_3.cjs.entry.js +187 -0
  3. package/dist/cjs/cura-icon.cjs.entry.js +59 -0
  4. package/dist/cjs/{cura-icon_2.cjs.entry.js → cura-icons-view.cjs.entry.js} +2 -56
  5. package/dist/cjs/cura.cjs.js +3 -3
  6. package/dist/cjs/{index-9092c64d.js → index-8686299e.js} +29 -0
  7. package/dist/cjs/loader.cjs.js +3 -3
  8. package/dist/collection/api/cura-api.js +10 -1
  9. package/dist/collection/api/modules/cura-theme-colors-module.js +69 -0
  10. package/dist/collection/api/modules/cura-theme-fonts-module.js +35 -0
  11. package/dist/collection/api/modules/cura-theme-module.js +4 -0
  12. package/dist/collection/api/theme-presets/static.js +103 -0
  13. package/dist/collection/api/theme-presets/theme-default.js +28 -22
  14. package/dist/collection/api/theme-presets/theme-maternity.js +10 -12
  15. package/dist/collection/collection-manifest.json +3 -1
  16. package/dist/collection/components/cura-icon/cura-icon.css +1 -42
  17. package/dist/collection/components/cura-icon/cura-icon.js +15 -12
  18. package/dist/collection/components/cura-icons-view/cura-icons-view.js +1 -1
  19. package/dist/collection/components/text/cura-display/cura-display.css +61 -0
  20. package/dist/collection/components/text/cura-display/cura-display.js +110 -0
  21. package/dist/collection/components/text/cura-heading/cura-heading.css +69 -0
  22. package/dist/collection/components/text/cura-heading/cura-heading.js +136 -0
  23. package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +81 -0
  24. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +76 -0
  25. package/dist/components/{dummy-component.d.ts → cura-display.d.ts} +4 -4
  26. package/dist/components/cura-display.js +86 -0
  27. package/dist/components/cura-heading.d.ts +11 -0
  28. package/dist/components/cura-heading.js +95 -0
  29. package/dist/components/cura-icon2.js +12 -13
  30. package/dist/components/cura-icons-view.js +1 -1
  31. package/dist/components/cura-paragraph.d.ts +11 -0
  32. package/dist/components/cura-paragraph.js +69 -0
  33. package/dist/components/index.d.ts +3 -1
  34. package/dist/components/index.js +261 -36
  35. package/dist/cura/cura.esm.js +1 -1
  36. package/dist/cura/cura.js +1 -1
  37. package/dist/cura/p-22290742.entry.js +1 -0
  38. package/dist/cura/p-265c1706.js +1 -0
  39. package/dist/cura/p-3d8bbf37.system.js +1 -0
  40. package/dist/cura/p-5ae0d10c.system.entry.js +1 -0
  41. package/dist/cura/p-80dc1c9f.entry.js +1 -0
  42. package/dist/cura/p-9312a846.system.entry.js +1 -0
  43. package/dist/cura/p-a50716bc.js +2 -0
  44. package/dist/cura/p-a8dcaaed.system.js +1 -0
  45. package/dist/cura/p-d29b9e16.entry.js +1 -0
  46. package/dist/cura/p-e447016d.system.js +2 -0
  47. package/dist/cura/p-e8fadcfa.system.entry.js +1 -0
  48. package/dist/esm/app-globals-d7dd3a4d.js +396 -0
  49. package/dist/esm/cura-display_3.entry.js +181 -0
  50. package/dist/esm/cura-icon.entry.js +55 -0
  51. package/dist/esm/{cura-icon_2.entry.js → cura-icons-view.entry.js} +3 -56
  52. package/dist/esm/cura.js +3 -3
  53. package/dist/esm/{index-cec9b650.js → index-c3d31886.js} +29 -0
  54. package/dist/esm/loader.js +3 -3
  55. package/dist/esm-es5/app-globals-d7dd3a4d.js +1 -0
  56. package/dist/esm-es5/cura-display_3.entry.js +1 -0
  57. package/dist/esm-es5/cura-icon.entry.js +1 -0
  58. package/dist/esm-es5/cura-icons-view.entry.js +1 -0
  59. package/dist/esm-es5/cura.js +1 -1
  60. package/dist/esm-es5/index-c3d31886.js +2 -0
  61. package/dist/esm-es5/loader.js +1 -1
  62. package/dist/types/api/cura-api.type.d.ts +9 -0
  63. package/dist/types/api/modules/cura-theme-colors-module.d.ts +48 -0
  64. package/dist/types/api/modules/cura-theme-fonts-module.d.ts +24 -0
  65. package/dist/types/api/modules/cura-theme-module.d.ts +4 -0
  66. package/dist/types/api/theme-presets/static.d.ts +78 -0
  67. package/dist/types/api/theme-presets/theme-default.d.ts +28 -22
  68. package/dist/types/api/theme-presets/theme-maternity.d.ts +23 -19
  69. package/dist/types/api/theme-presets/theme-presets.d.ts +51 -41
  70. package/dist/types/components/cura-icon/cura-icon.d.ts +1 -1
  71. package/dist/types/components/text/cura-display/cura-display.d.ts +28 -0
  72. package/dist/types/components/text/cura-heading/cura-heading.d.ts +33 -0
  73. package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +22 -0
  74. package/dist/types/components.d.ts +83 -9
  75. package/package.json +2 -2
  76. package/dist/cjs/app-globals-af978331.js +0 -175
  77. package/dist/cjs/dummy-component.cjs.entry.js +0 -19
  78. package/dist/collection/components/dummy-component/dummy-component.css +0 -3
  79. package/dist/collection/components/dummy-component/dummy-component.js +0 -18
  80. package/dist/components/dummy-component.js +0 -33
  81. package/dist/cura/p-3132f4b7.system.js +0 -2
  82. package/dist/cura/p-70abb532.system.js +0 -1
  83. package/dist/cura/p-81ae13d7.entry.js +0 -1
  84. package/dist/cura/p-a0cd4b75.system.js +0 -1
  85. package/dist/cura/p-abcda1d1.js +0 -2
  86. package/dist/cura/p-ac79f9d1.entry.js +0 -1
  87. package/dist/cura/p-b4c69836.system.entry.js +0 -1
  88. package/dist/cura/p-d2dcd470.js +0 -1
  89. package/dist/cura/p-e1e4b2ea.system.entry.js +0 -1
  90. package/dist/esm/app-globals-962e5cc3.js +0 -173
  91. package/dist/esm/dummy-component.entry.js +0 -15
  92. package/dist/esm-es5/app-globals-962e5cc3.js +0 -1
  93. package/dist/esm-es5/cura-icon_2.entry.js +0 -1
  94. package/dist/esm-es5/dummy-component.entry.js +0 -1
  95. package/dist/esm-es5/index-cec9b650.js +0 -2
  96. package/dist/types/components/dummy-component/dummy-component.d.ts +0 -3
@@ -0,0 +1,398 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Cura Default Theme
5
+ */
6
+ const ThemeDefault = {
7
+ /* Colors */
8
+ color: {
9
+ primary: {
10
+ '100': '#71C5E8',
11
+ '300': '#449CD5',
12
+ '500': '#005EB8',
13
+ '700': '#004890',
14
+ '900': '#002855'
15
+ },
16
+ secondary: {
17
+ '100': '#F5ECE3',
18
+ '300': '#DDC0A2',
19
+ '500': '#CCA074',
20
+ '700': '#886B4D',
21
+ '900': '#292017'
22
+ },
23
+ accent: {
24
+ '100': '#F9E8D5',
25
+ '300': '#E4A04F',
26
+ '500': '#DF8D2C',
27
+ '700': '#955E1D',
28
+ '900': '#2D1C09'
29
+ }
30
+ },
31
+ /* Spacing */
32
+ spacing: {
33
+ base: 4,
34
+ },
35
+ /* Fonts */
36
+ font: {
37
+ size: '14px',
38
+ color: '#4A4A4A',
39
+ body: "'Roboto', Arial, Helvetica, sans-serif",
40
+ heading: "'Roboto', Arial, Helvetica, sans-serif",
41
+ display: "'Roboto', Arial, Helvetica, sans-serif",
42
+ weights: {
43
+ thin: 100,
44
+ light: 300,
45
+ regular: 400,
46
+ medium: 500,
47
+ bold: 700,
48
+ black: 900
49
+ },
50
+ }
51
+ };
52
+
53
+ /**
54
+ * Maternity Theme
55
+ */
56
+ const ThemeMaternity = Object.assign(Object.assign({}, ThemeDefault), {
57
+ /* Custom */
58
+ /* Colors */
59
+ color: {
60
+ primary: {
61
+ '100': '#FCEFF6',
62
+ '300': '#FFBFE5',
63
+ '500': '#CD4D9A',
64
+ '700': '#99126C',
65
+ '900': '#00133B'
66
+ },
67
+ secondary: {
68
+ '100': '#EDF3FF',
69
+ '300': '#BDD2FF',
70
+ '500': '#189AB4',
71
+ '700': '#001C58',
72
+ '900': '#430E31'
73
+ }
74
+ } });
75
+
76
+ const ThemePresets = {
77
+ 'default': ThemeDefault,
78
+ 'maternidade': ThemeMaternity
79
+ };
80
+
81
+ /**
82
+ * Static
83
+ */
84
+ const Static = {
85
+ /* Colors */
86
+ color: {
87
+ success: {
88
+ lighter: '#DFF6E9',
89
+ light: '#94E1B5',
90
+ base: '#5FD290',
91
+ dark: '#3F8C60',
92
+ darker: '#132A1D',
93
+ depth100: '#DFF6E9',
94
+ depth300: '#94E1B5',
95
+ depth500: '#5FD290',
96
+ depth700: '#3F8C60',
97
+ depth900: '#132A1D',
98
+ },
99
+ info: {
100
+ lighter: '#CFE2FF',
101
+ light: '#95BFFF',
102
+ base: '#6EA8FF',
103
+ dark: '#517BBB',
104
+ darker: '#253855',
105
+ depth100: '#CFE2FF',
106
+ depth300: '#95BFFF',
107
+ depth500: '#6EA8FF',
108
+ depth700: '#517BBB',
109
+ depth900: '#253855',
110
+ },
111
+ error: {
112
+ lighter: '#FBDDDD',
113
+ light: '#F28F8F',
114
+ base: '#EB5757',
115
+ dark: '#9D3A3A',
116
+ darker: '#2F1111',
117
+ depth100: '#FBDDDD',
118
+ depth300: '#F28F8F',
119
+ depth500: '#EB5757',
120
+ depth700: '#9D3A3A',
121
+ depth900: '#2F1111',
122
+ },
123
+ warning: {
124
+ lighter: '#FCFAC4',
125
+ light: '#F8F489',
126
+ base: '#F5EF4E',
127
+ dark: '#A39F34',
128
+ darker: '#313010',
129
+ depth100: '#FCFAC4',
130
+ depth300: '#F8F489',
131
+ depth500: '#F5EF4E',
132
+ depth700: '#A39F34',
133
+ depth900: '#313010',
134
+ },
135
+ /* neutral: {
136
+ 'pure-white': '#FFFFFF',
137
+ white: '#F6F6F6',
138
+ pale: '#E9E9E9',
139
+ lighter: '#E2E2E2',
140
+ light: '#D4D4D4',
141
+ base: '#B7B7B7',
142
+ medium: '#929292',
143
+ dark: '#6E6E6E',
144
+ darker: '#4A4A4A',
145
+ black: '#262626',
146
+ depth0: '#FFFFFF',
147
+ depth100: '#F6F6F6',
148
+ depth200: '#E9E9E9',
149
+ depth300: '#E2E2E2',
150
+ depth400: '#D4D4D4',
151
+ depth500: '#B7B7B7',
152
+ depth600: '#929292',
153
+ depth700: '#6E6E6E',
154
+ depth800: '#4A4A4A',
155
+ depth900: '#262626',
156
+ }, */
157
+ neutral: {
158
+ '0': '#FFFFFF',
159
+ '100': '#F6F6F6',
160
+ '200': '#E9E9E9',
161
+ '300': '#E2E2E2',
162
+ '400': '#D4D4D4',
163
+ '500': '#B7B7B7',
164
+ '600': '#929292',
165
+ '700': '#6E6E6E',
166
+ '800': '#4A4A4A',
167
+ '900': '#262626',
168
+ },
169
+ },
170
+ /* Icons */
171
+ icons: {
172
+ 'sizes': ['128', '72', '64', '48', '40', '32', '24', '20', '16'],
173
+ 'strokes': ['5.25', '3.5', '3.25', '2.75', '2.5', '2.25', '2', '1.75', '1.5'],
174
+ 'default-size': '24',
175
+ },
176
+ /* Breakpoints */
177
+ breakpoints: {
178
+ small: '576px',
179
+ medium: '768px',
180
+ large: '992px',
181
+ xlarge: '1200px',
182
+ },
183
+ };
184
+
185
+ class CuraThemeColorsModule {
186
+ constructor() {
187
+ this.NeutralDepthAlias = {
188
+ 'purewhite': '0',
189
+ 'white': '100',
190
+ 'pale': '200',
191
+ 'lighter': '300',
192
+ 'light': '400',
193
+ 'base': '500',
194
+ 'medium': '600',
195
+ 'dark': '700',
196
+ 'darker': '800',
197
+ 'black': '900',
198
+ };
199
+ this.ColorDepthAlias = {
200
+ 'lighter': '100',
201
+ 'light': '300',
202
+ 'base': '500',
203
+ 'dark': '700',
204
+ 'darker': '900'
205
+ };
206
+ }
207
+ /**
208
+ * Get theme color.
209
+ * @param colorWithDepth string Ex.: primary-light
210
+ * @returns css color property. Color definition or related css var from the theme.
211
+ */
212
+ getColor(colorWithDepth = "primary-base") {
213
+ const { color, depth } = this.splitColorDepth(colorWithDepth);
214
+ const staticColor = this.getStatic(color, depth);
215
+ if (staticColor)
216
+ return staticColor;
217
+ return this.getDynamic(color, depth);
218
+ }
219
+ /**
220
+ * Internal: Look for static color by name and depth.
221
+ * @param color Color name.
222
+ * @param depth Depth number or alias.
223
+ * @returns Static color definition.
224
+ */
225
+ getStatic(color, depth) {
226
+ var _a, _b;
227
+ return ((_a = Static.color[color]) === null || _a === void 0 ? void 0 : _a[depth]) || ((_b = Static.color[color]) === null || _b === void 0 ? void 0 : _b[this.NeutralDepthAlias[depth]]) || null;
228
+ }
229
+ /**
230
+ * Internal: Look for theme dynamic colors.
231
+ * @param color Color name.
232
+ * @param depth Depth number or alias.
233
+ * @returns Related CSS variable defined by the theme.
234
+ */
235
+ getDynamic(color, depth) {
236
+ const themeVar = this.ColorDepthAlias[depth]
237
+ ? `--cura-color-${color}-${this.ColorDepthAlias[depth]}`
238
+ : `--cura-color-${color}-${depth}`;
239
+ return getComputedStyle(document.body).getPropertyValue(themeVar)
240
+ ? `var(${themeVar})`
241
+ : `var(--cura-color-primary-500)`;
242
+ }
243
+ /**
244
+ * Internal: Split color strings
245
+ * @param colorWithDepth Color string [color]-[depth]. Ex.: primary-dark or primary-700.
246
+ * @returns Object { color: string, depth: string }.
247
+ */
248
+ splitColorDepth(colorWithDepth) {
249
+ const [color, depth] = colorWithDepth.toLowerCase().split(/-(.*)/);
250
+ return { color: color !== null && color !== void 0 ? color : "primary", depth: depth !== null && depth !== void 0 ? depth : "base" };
251
+ }
252
+ }
253
+
254
+ class CuraThemeFontsModule {
255
+ constructor() {
256
+ /**
257
+ * Get the CSS variable related to the font size base defined by the theme.
258
+ * @returns Related CSS variable as a string.
259
+ */
260
+ this.getSize = () => `var(--cura-font-size)`;
261
+ /**
262
+ * Get CSS variable related to the font color defined by the theme.
263
+ * @returns Related CSS variable as a string.
264
+ */
265
+ this.getColor = () => `var(--cura-font-color)`;
266
+ }
267
+ /**
268
+ * Get the CSS variable related to the font family defined by the theme.
269
+ * @param type 'body' | 'heading' | 'display'
270
+ * @returns Related css variable as a string.
271
+ */
272
+ getFamily(type = "body") {
273
+ const curaFontFamilyCSSVar = `--cura-font-${type.toLowerCase()}`;
274
+ return getComputedStyle(document.body).getPropertyValue(curaFontFamilyCSSVar)
275
+ ? `var(${curaFontFamilyCSSVar})`
276
+ : 'var(--cura-font-body)';
277
+ }
278
+ /**
279
+ * Get the CSS variables related to font weights defined by the theme.
280
+ * @returns Object with CSS vars weights definitions for thin, light, regular, medium, bold and black fonts.
281
+ */
282
+ getWeights() {
283
+ const weights = {};
284
+ Object.keys(ThemeDefault.font.weights).forEach((key) => weights[key] = `var(--cura-font-weights-${key})`);
285
+ return weights;
286
+ }
287
+ }
288
+
289
+ class CuraThemeModule {
290
+ constructor() {
291
+ this.prefix = '--cura';
292
+ this.colors = new CuraThemeColorsModule();
293
+ this.fonts = new CuraThemeFontsModule();
294
+ /* Private */
295
+ /** Set css var based on object structure */
296
+ this.setCssVar = (prop, path) => {
297
+ const varName = this.groupPath(path, prop[0]);
298
+ this.body.style.setProperty(varName, prop[1]);
299
+ };
300
+ this.groupPath = (a, b) => `${a}-${b}`;
301
+ this.isObject = (val) => {
302
+ return val && typeof val === 'object' && !Array.isArray(val);
303
+ };
304
+ /** Deep merge objects */
305
+ this.mergeObject = (from, to) => {
306
+ const entries = Object.entries(from);
307
+ for (let e of entries) {
308
+ if (this.isObject(e[1])) {
309
+ this.mergeObject(e[1], to[e[0]]);
310
+ }
311
+ else {
312
+ to[e[0]] = e[1];
313
+ }
314
+ }
315
+ };
316
+ /** Set css vars from preset object */
317
+ this.buildCssVars = (path, obj) => {
318
+ const entries = Object.entries(obj);
319
+ for (let e of entries) {
320
+ if (this.isObject(e[1])) {
321
+ this.buildCssVars(this.groupPath(path, e[0]), e[1]);
322
+ }
323
+ else {
324
+ this.setCssVar(e, path);
325
+ }
326
+ }
327
+ };
328
+ this.body = window.document.documentElement.querySelector('body');
329
+ }
330
+ /**
331
+ * Load a theme.
332
+ * @param theme Theme tag.
333
+ */
334
+ load(theme = 'default') {
335
+ const preset = ThemePresets[theme] ? ThemePresets[theme] : ThemePresets.default;
336
+ this.buildCssVars(this.prefix, preset);
337
+ }
338
+ /**
339
+ * Define a custom theme
340
+ * @param customTheme Custom theme object definition
341
+ */
342
+ setCustom(customTheme) {
343
+ const customTag = customTheme.name;
344
+ if (customTag in ThemePresets) {
345
+ console.log('Error building custom theme. Theme %s already exists. Loading default theme.', customTag);
346
+ this.load('default');
347
+ }
348
+ else {
349
+ const preset = customTheme.fromPreset && customTheme.fromPreset in ThemePresets
350
+ ? ThemePresets[customTheme.fromPreset]
351
+ : ThemePresets.default;
352
+ const newTheme = Object.assign({}, JSON.parse(JSON.stringify(preset)));
353
+ this.mergeObject(customTheme.definitions, newTheme);
354
+ ThemePresets[customTag] = newTheme;
355
+ this.load(customTag);
356
+ }
357
+ }
358
+ }
359
+
360
+ class CuraAPI {
361
+ constructor(config) {
362
+ this.localAssetsPath = config && config.localAssetsPath ? config.localAssetsPath : `/assets`;
363
+ const themeModule = new CuraThemeModule();
364
+ this.theme = {
365
+ load: function (themeTag) { themeModule.load(themeTag); },
366
+ setCustom: function (customThemeDefinitions) { themeModule.setCustom(customThemeDefinitions); },
367
+ colors: {
368
+ getColor: function (colorWithDepth) { return themeModule.colors.getColor(colorWithDepth); },
369
+ },
370
+ fonts: {
371
+ getFamily: function (type) { return themeModule.fonts.getFamily(type); },
372
+ getWeights: function () { return themeModule.fonts.getWeights(); },
373
+ getSize: function () { return themeModule.fonts.getSize(); },
374
+ getColor: function () { return themeModule.fonts.getColor(); }
375
+ }
376
+ };
377
+ if (config && config.customTheme) {
378
+ this.theme.setCustom(config.customTheme);
379
+ }
380
+ else {
381
+ const theme = config && config.theme ? config.theme : 'default';
382
+ this.theme.load(theme);
383
+ }
384
+ }
385
+ }
386
+
387
+ function appGlobalScript () {
388
+ const config = window.CuraInit;
389
+ window.CuraAPI = config ? new CuraAPI(config) : new CuraAPI();
390
+ const api = window.CuraAPI;
391
+ window.dispatchEvent(new CustomEvent("CuraAPIReady", { detail: { api } }));
392
+ if (config && typeof config.onReady === 'function')
393
+ config.onReady(api);
394
+ }
395
+
396
+ const globalScripts = appGlobalScript;
397
+
398
+ exports.globalScripts = globalScripts;
@@ -0,0 +1,187 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8686299e.js');
6
+
7
+ const curaDisplayCss = ":host{display:block;font-size:var(--font-size);text-transform:uppercase}:host h1,:host h2,:host h3,:host h4,:host h5,:host h6{font-family:var(--font-family);font-size:4.285em;font-weight:var(--font-weight-black);color:var(--color-body);line-height:120%;letter-spacing:-4%}:host h1.large,:host h2.large,:host h3.large,:host h4.large,:host h5.large,:host h6.large{font-size:6.21em}:host h1.small,:host h2.small,:host h3.small,:host h4.small,:host h5.small,:host h6.small{font-size:3em;font-weight:var(--font-weight-bold)}@media screen and (min-width: 768px) and (max-width: 1366px){:host h1,:host h2,:host h3,:host h4,:host h5,:host h6{font-size:4.92em}:host h1.large,:host h2.large,:host h3.large,:host h4.large,:host h5.large,:host h6.large{font-size:7.07em}:host h1.small,:host h2.small,:host h3.small,:host h4.small,:host h5.small,:host h6.small{font-size:3.428em}}@media screen and (min-width: 1367px){:host h1,:host h2,:host h3,:host h4,:host h5,:host h6{font-size:6.14em;line-height:125%}:host h1.large,:host h2.large,:host h3.large,:host h4.large,:host h5.large,:host h6.large{font-size:8.857em;letter-spacing:-6%}:host h1.small,:host h2.small,:host h3.small,:host h4.small,:host h5.small,:host h6.small{font-size:4.285em;letter-spacing:-2%}}:host ::slotted(b),:host ::slotted(strong){font-weight:var(--font-weight-bold)}:host ::slotted(a){font-weight:var(--font-weight-bold);color:var(--color-link);text-decoration:none;text-underline-offset:10%;cursor:pointer}:host ::slotted(abbr){color:var(--color-link);-webkit-text-decoration:underline dashed 1px var(--color-link);text-decoration:underline dashed 1px var(--color-link);text-underline-offset:10%;cursor:default}";
8
+
9
+ const CuraDisplay = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ /**
13
+ * Heading level for semantics.
14
+ * Values: 1(default)-6.
15
+ */
16
+ this.level = 1;
17
+ /**
18
+ * Heading style size.
19
+ * Values: small | regular(default) | large.
20
+ */
21
+ this.size = 'regular';
22
+ }
23
+ connectedCallback() {
24
+ this.weights = window.CuraAPI.theme.fonts.getWeights();
25
+ this.setFontProperties();
26
+ this.setColors();
27
+ }
28
+ getClasses() {
29
+ const classes = {};
30
+ classes[this.size.toLowerCase()] = true;
31
+ return classes;
32
+ }
33
+ setFontProperties() {
34
+ this.styles = {
35
+ '--font-family': window.CuraAPI.theme.fonts.getFamily('display'),
36
+ '--font-size': window.CuraAPI.theme.fonts.getSize(),
37
+ '--font-weight-bold': this.weights.bold,
38
+ '--font-weight-black': this.weights.black
39
+ };
40
+ this.setHostProperty('--font-size', window.CuraAPI.theme.fonts.getSize());
41
+ }
42
+ setColors() {
43
+ const fontColor = window.CuraAPI.theme.fonts.getColor();
44
+ this.styles['--color-body'] = fontColor || window.CuraAPI.theme.colors.getColor('neutral-darker');
45
+ this.styles['--color-link'] = window.CuraAPI.theme.colors.getColor('primary-700');
46
+ }
47
+ setHostProperty(prop, value) {
48
+ this.host.style.setProperty(prop, value);
49
+ }
50
+ getHeadingTag() {
51
+ const tags = {
52
+ '1': index.h("h1", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
53
+ '2': index.h("h2", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
54
+ '3': index.h("h3", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
55
+ '4': index.h("h4", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
56
+ '5': index.h("h5", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
57
+ '6': index.h("h6", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
58
+ 'default': index.h("h1", { style: this.styles, class: this.getClasses() }, index.h("slot", null))
59
+ };
60
+ return tags[`${this.level}`] || tags['default'];
61
+ }
62
+ render() {
63
+ return (index.h(index.Host, null, this.getHeadingTag()));
64
+ }
65
+ get host() { return index.getElement(this); }
66
+ };
67
+ CuraDisplay.style = curaDisplayCss;
68
+
69
+ const curaHeadingCss = ":host{display:block;font-size:var(--font-size)}:host h1,:host h2,:host h3,:host h4,:host h5,:host h6{font-family:var(--font-family);font-size:1.71em;font-weight:var(--font-weight-regular);color:var(--color-body);line-height:130%;letter-spacing:0%}:host h1.bold-weight,:host h2.bold-weight,:host h3.bold-weight,:host h4.bold-weight,:host h5.bold-weight,:host h6.bold-weight{font-weight:var(--font-weight-medium)}:host h1.large,:host h2.large,:host h3.large,:host h4.large,:host h5.large,:host h6.large{font-size:2.07em;letter-spacing:-2%}:host h1.small,:host h2.small,:host h3.small,:host h4.small,:host h5.small,:host h6.small{font-size:1.214em;line-height:150%;letter-spacing:0%}:host h1.small.bold-weight,:host h2.small.bold-weight,:host h3.small.bold-weight,:host h4.small.bold-weight,:host h5.small.bold-weight,:host h6.small.bold-weight{font-weight:var(--font-weight-bold)}@media screen and (min-width: 768px) and (max-width: 1366px){:host h1,:host h2,:host h3,:host h4,:host h5,:host h6{font-size:2em}:host h1.large,:host h2.large,:host h3.large,:host h4.large,:host h5.large,:host h6.large{font-size:2.357em}:host h1.small,:host h2.small,:host h3.small,:host h4.small,:host h5.small,:host h6.small{font-size:1.357em}}@media screen and (min-width: 1367px){:host h1,:host h2,:host h3,:host h4,:host h5,:host h6{font-size:2.5em;line-height:135%;letter-spacing:-2%}:host h1.large,:host h2.large,:host h3.large,:host h4.large,:host h5.large,:host h6.large{font-size:2.92em}:host h1.small,:host h2.small,:host h3.small,:host h4.small,:host h5.small,:host h6.small{font-size:1.71em;line-height:160%;letter-spacing:0%}}:host ::slotted(b),:host ::slotted(strong){font-weight:var(--font-weight-bold)}:host ::slotted(a){font-weight:var(--font-weight-bold);color:var(--color-link);text-decoration:none;text-underline-offset:10%;cursor:pointer}:host ::slotted(abbr){color:var(--color-link);-webkit-text-decoration:underline dashed 1px var(--color-link);text-decoration:underline dashed 1px var(--color-link);text-underline-offset:10%;cursor:default}";
70
+
71
+ const CuraHeading = class {
72
+ constructor(hostRef) {
73
+ index.registerInstance(this, hostRef);
74
+ /**
75
+ * Heading level for semantics.
76
+ * Values: 1(default)-6.
77
+ */
78
+ this.level = 1;
79
+ /**
80
+ * Heading style size.
81
+ * Values: small | regular(default) | large.
82
+ */
83
+ this.size = 'regular';
84
+ /**
85
+ * Heading font weight.
86
+ * Values: regular(default) | bold.
87
+ */
88
+ this.weight = 'regular';
89
+ }
90
+ connectedCallback() {
91
+ this.weights = window.CuraAPI.theme.fonts.getWeights();
92
+ this.setFontProperties();
93
+ this.setColors();
94
+ }
95
+ getClasses() {
96
+ const classes = {};
97
+ classes[this.size.toLowerCase()] = true;
98
+ classes[`${this.weight.toLowerCase()}-weight`] = true;
99
+ return classes;
100
+ }
101
+ setFontProperties() {
102
+ this.styles = {
103
+ '--font-family': window.CuraAPI.theme.fonts.getFamily('heading'),
104
+ '--font-size': window.CuraAPI.theme.fonts.getSize(),
105
+ '--font-weight-regular': this.weights.regular,
106
+ '--font-weight-medium': this.weights.medium,
107
+ '--font-weight-bold': this.weights.bold,
108
+ '--font-weight-black': this.weights.black
109
+ };
110
+ this.setHostProperty('--font-size', window.CuraAPI.theme.fonts.getSize());
111
+ }
112
+ setColors() {
113
+ const fontColor = window.CuraAPI.theme.fonts.getColor();
114
+ this.styles['--color-body'] = fontColor || window.CuraAPI.theme.colors.getColor('neutral-darker');
115
+ this.styles['--color-link'] = window.CuraAPI.theme.colors.getColor('primary-700');
116
+ }
117
+ setHostProperty(prop, value) {
118
+ this.host.style.setProperty(prop, value);
119
+ }
120
+ getHeadingTag() {
121
+ const tags = {
122
+ '1': index.h("h1", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
123
+ '2': index.h("h2", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
124
+ '3': index.h("h3", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
125
+ '4': index.h("h4", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
126
+ '5': index.h("h5", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
127
+ '6': index.h("h6", { style: this.styles, class: this.getClasses() }, index.h("slot", null)),
128
+ 'default': index.h("h1", { style: this.styles, class: this.getClasses() }, index.h("slot", null))
129
+ };
130
+ return tags[`${this.level}`] || tags['default'];
131
+ }
132
+ render() {
133
+ return (index.h(index.Host, null, this.getHeadingTag()));
134
+ }
135
+ get host() { return index.getElement(this); }
136
+ };
137
+ CuraHeading.style = curaHeadingCss;
138
+
139
+ const curaParagraphCss = ":host{display:block;font-size:var(--font-size)}:host p{font-family:var(--font-family);font-size:var(--font-size);font-weight:var(--font-weight-regular);color:var(--color-body);line-height:140%;letter-spacing:2%}:host p.large{font-size:1.21em;line-height:150%;letter-spacing:0%}:host p.small{font-size:0.85em;line-height:135%;letter-spacing:4%}:host p.caption{font-size:0.71em;line-height:135%;letter-spacing:6%}@media screen and (min-width: 768px) and (max-width: 1366px){:host p{font-size:1.14em;line-height:145%}:host p.large{font-size:1.35em;line-height:150%}:host p.small{font-size:1em;line-height:135%}:host p.caption{font-size:0.85em;line-height:135%;letter-spacing:6%}}@media screen and (min-width: 1367px){:host p{font-size:1.42em;line-height:150%;letter-spacing:0%}:host p.large{font-size:1.71em;line-height:160%}:host p.small{font-size:1.21em;line-height:145%;letter-spacing:0%}:host p.caption{font-size:1em;line-height:145%;letter-spacing:2%}}:host ::slotted(b),:host ::slotted(strong){font-weight:var(--font-weight-bold)}:host ::slotted(a){font-weight:var(--font-weight-medium);color:var(--color-link);text-underline-offset:10%}:host ::slotted(abbr){color:var(--color-link);-webkit-text-decoration:underline dashed 1px var(--color-link);text-decoration:underline dashed 1px var(--color-link);text-underline-offset:10%;cursor:default}";
140
+
141
+ const CuraParagraph = class {
142
+ constructor(hostRef) {
143
+ index.registerInstance(this, hostRef);
144
+ /**
145
+ * Set size of body text.
146
+ * Values: regular (default) | large | small | caption.
147
+ */
148
+ this.size = 'regular';
149
+ }
150
+ connectedCallback() {
151
+ this.weights = window.CuraAPI.theme.fonts.getWeights();
152
+ this.setFontProperties();
153
+ this.setColors();
154
+ }
155
+ setsizeClass() {
156
+ const sizeclass = {};
157
+ sizeclass[this.size.toLowerCase()] = true;
158
+ return sizeclass;
159
+ }
160
+ setFontProperties() {
161
+ this.styles = {
162
+ '--font-family': window.CuraAPI.theme.fonts.getFamily('body'),
163
+ '--font-size': window.CuraAPI.theme.fonts.getSize(),
164
+ '--font-weight-regular': this.weights.regular,
165
+ '--font-weight-medium': this.weights.medium,
166
+ '--font-weight-bold': this.weights.bold
167
+ };
168
+ this.setHostProperty('--font-size', window.CuraAPI.theme.fonts.getSize());
169
+ }
170
+ setColors() {
171
+ const fontColor = window.CuraAPI.theme.fonts.getColor();
172
+ this.styles['--color-body'] = fontColor || window.CuraAPI.theme.colors.getColor(`neutral-darker`);
173
+ this.styles['--color-link'] = window.CuraAPI.theme.colors.getColor('primary-700');
174
+ }
175
+ setHostProperty(prop, value) {
176
+ this.host.style.setProperty(prop, value);
177
+ }
178
+ render() {
179
+ return (index.h(index.Host, null, index.h("p", { style: this.styles, class: this.setsizeClass() }, index.h("slot", null))));
180
+ }
181
+ get host() { return index.getElement(this); }
182
+ };
183
+ CuraParagraph.style = curaParagraphCss;
184
+
185
+ exports.cura_display = CuraDisplay;
186
+ exports.cura_heading = CuraHeading;
187
+ exports.cura_paragraph = CuraParagraph;
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8686299e.js');
6
+
7
+ const curaIconCss = ":host{width:var(--size);height:var(--size)}:host svg{display:inline-block;stroke:var(--color);width:var(--size);height:var(--size);stroke-width:var(--stroke);fill:none}";
8
+
9
+ const CuraIcon = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.name = '';
13
+ this.color = 'neutral-base';
14
+ this.iconset = 'default';
15
+ this.disabled = false;
16
+ this.sizes = {
17
+ "128": { size: 128, stroke: 5.25 },
18
+ "72": { size: 72, stroke: 3.5 },
19
+ "64": { size: 64, stroke: 3.25 },
20
+ "48": { size: 48, stroke: 2.75 },
21
+ "40": { size: 40, stroke: 2.5 },
22
+ "32": { size: 32, stroke: 2.25 },
23
+ "24": { size: 24, stroke: 2 },
24
+ "20": { size: 20, stroke: 1.75 },
25
+ "16": { size: 16, stroke: 1.5 },
26
+ "default": { size: 24, stroke: 2 }
27
+ };
28
+ }
29
+ sizeHandler(size) {
30
+ const scaledStroke = (iconSize) => {
31
+ return `${this.sizes[iconSize].stroke * (this.sizes.default.size / this.sizes[iconSize].size)}px`;
32
+ };
33
+ this.setHostProperty('--size', this.sizes[`${size}`] ? `${this.sizes[size].size}px` : `${this.sizes.default.size}px`);
34
+ this.setHostProperty('--stroke', this.sizes[`${size}`] ? scaledStroke(size) : scaledStroke("default"));
35
+ }
36
+ colorHandler() {
37
+ this.setHostProperty('--color', window.CuraAPI.theme.colors.getColor(this.disabled ? 'neutral-light' : this.color));
38
+ }
39
+ connectedCallback() {
40
+ this.assetsPath = window.CuraAPI.localAssetsPath;
41
+ this.sizeHandler(this.size);
42
+ this.colorHandler();
43
+ }
44
+ setHostProperty(prop, value) {
45
+ this.host.style.setProperty(prop, value);
46
+ }
47
+ render() {
48
+ return (index.h(index.Host, null, index.h("svg", { version: "1.1", viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg" }, index.h("use", { xlinkHref: `${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}` }))));
49
+ }
50
+ get host() { return index.getElement(this); }
51
+ static get watchers() { return {
52
+ "size": ["sizeHandler"],
53
+ "color": ["colorHandler"],
54
+ "disabled": ["colorHandler"]
55
+ }; }
56
+ };
57
+ CuraIcon.style = curaIconCss;
58
+
59
+ exports.cura_icon = CuraIcon;