@rededor/cura 0.2.1 → 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.
- package/dist/cjs/app-globals-5f5b9fbf.js +398 -0
- package/dist/cjs/cura-display_3.cjs.entry.js +187 -0
- package/dist/cjs/cura-icon.cjs.entry.js +59 -0
- package/dist/cjs/{cura-icon_2.cjs.entry.js → cura-icons-view.cjs.entry.js} +2 -56
- package/dist/cjs/cura.cjs.js +3 -3
- package/dist/cjs/{index-9092c64d.js → index-8686299e.js} +29 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/api/cura-api.js +10 -1
- package/dist/collection/api/modules/cura-theme-colors-module.js +69 -0
- package/dist/collection/api/modules/cura-theme-fonts-module.js +35 -0
- package/dist/collection/api/modules/cura-theme-module.js +4 -0
- package/dist/collection/api/theme-presets/static.js +103 -0
- package/dist/collection/api/theme-presets/theme-default.js +28 -22
- package/dist/collection/api/theme-presets/theme-maternity.js +10 -12
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/cura-icon/cura-icon.css +1 -43
- package/dist/collection/components/cura-icon/cura-icon.js +15 -12
- package/dist/collection/components/cura-icons-view/cura-icons-view.js +1 -1
- package/dist/collection/components/text/cura-display/cura-display.css +61 -0
- package/dist/collection/components/text/cura-display/cura-display.js +110 -0
- package/dist/collection/components/text/cura-heading/cura-heading.css +69 -0
- package/dist/collection/components/text/cura-heading/cura-heading.js +136 -0
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.css +81 -0
- package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +76 -0
- package/dist/components/{dummy-component.d.ts → cura-display.d.ts} +4 -4
- package/dist/components/cura-display.js +86 -0
- package/dist/components/cura-heading.d.ts +11 -0
- package/dist/components/cura-heading.js +95 -0
- package/dist/components/cura-icon2.js +12 -13
- package/dist/components/cura-icons-view.js +1 -1
- package/dist/components/cura-paragraph.d.ts +11 -0
- package/dist/components/cura-paragraph.js +69 -0
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +261 -36
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.js +1 -1
- package/dist/cura/p-22290742.entry.js +1 -0
- package/dist/cura/p-265c1706.js +1 -0
- package/dist/cura/p-3d8bbf37.system.js +1 -0
- package/dist/cura/p-5ae0d10c.system.entry.js +1 -0
- package/dist/cura/p-80dc1c9f.entry.js +1 -0
- package/dist/cura/p-9312a846.system.entry.js +1 -0
- package/dist/cura/p-a50716bc.js +2 -0
- package/dist/cura/p-a8dcaaed.system.js +1 -0
- package/dist/cura/p-d29b9e16.entry.js +1 -0
- package/dist/cura/p-e447016d.system.js +2 -0
- package/dist/cura/p-e8fadcfa.system.entry.js +1 -0
- package/dist/esm/app-globals-d7dd3a4d.js +396 -0
- package/dist/esm/cura-display_3.entry.js +181 -0
- package/dist/esm/cura-icon.entry.js +55 -0
- package/dist/esm/{cura-icon_2.entry.js → cura-icons-view.entry.js} +3 -56
- package/dist/esm/cura.js +3 -3
- package/dist/esm/{index-cec9b650.js → index-c3d31886.js} +29 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm-es5/app-globals-d7dd3a4d.js +1 -0
- package/dist/esm-es5/cura-display_3.entry.js +1 -0
- package/dist/esm-es5/cura-icon.entry.js +1 -0
- package/dist/esm-es5/cura-icons-view.entry.js +1 -0
- package/dist/esm-es5/cura.js +1 -1
- package/dist/esm-es5/index-c3d31886.js +2 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/types/api/cura-api.type.d.ts +9 -0
- package/dist/types/api/modules/cura-theme-colors-module.d.ts +48 -0
- package/dist/types/api/modules/cura-theme-fonts-module.d.ts +24 -0
- package/dist/types/api/modules/cura-theme-module.d.ts +4 -0
- package/dist/types/api/theme-presets/static.d.ts +78 -0
- package/dist/types/api/theme-presets/theme-default.d.ts +28 -22
- package/dist/types/api/theme-presets/theme-maternity.d.ts +23 -19
- package/dist/types/api/theme-presets/theme-presets.d.ts +51 -41
- package/dist/types/components/cura-icon/cura-icon.d.ts +1 -1
- package/dist/types/components/text/cura-display/cura-display.d.ts +28 -0
- package/dist/types/components/text/cura-heading/cura-heading.d.ts +33 -0
- package/dist/types/components/text/cura-paragraph/cura-paragraph.d.ts +22 -0
- package/dist/types/components.d.ts +83 -9
- package/package.json +2 -2
- package/dist/cjs/app-globals-af978331.js +0 -175
- package/dist/cjs/dummy-component.cjs.entry.js +0 -19
- package/dist/collection/components/dummy-component/dummy-component.css +0 -3
- package/dist/collection/components/dummy-component/dummy-component.js +0 -18
- package/dist/components/dummy-component.js +0 -33
- package/dist/cura/p-18f978f3.system.entry.js +0 -1
- package/dist/cura/p-3132f4b7.system.js +0 -2
- package/dist/cura/p-5f113376.entry.js +0 -1
- package/dist/cura/p-70abb532.system.js +0 -1
- package/dist/cura/p-a0cd4b75.system.js +0 -1
- package/dist/cura/p-abcda1d1.js +0 -2
- package/dist/cura/p-ac79f9d1.entry.js +0 -1
- package/dist/cura/p-b4c69836.system.entry.js +0 -1
- package/dist/cura/p-d2dcd470.js +0 -1
- package/dist/esm/app-globals-962e5cc3.js +0 -173
- package/dist/esm/dummy-component.entry.js +0 -15
- package/dist/esm-es5/app-globals-962e5cc3.js +0 -1
- package/dist/esm-es5/cura-icon_2.entry.js +0 -1
- package/dist/esm-es5/dummy-component.entry.js +0 -1
- package/dist/esm-es5/index-cec9b650.js +0 -2
- package/dist/types/components/dummy-component/dummy-component.d.ts +0 -3
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
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}";
|
|
4
|
+
|
|
5
|
+
const CuraHeading$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
/**
|
|
11
|
+
* Heading level for semantics.
|
|
12
|
+
* Values: 1(default)-6.
|
|
13
|
+
*/
|
|
14
|
+
this.level = 1;
|
|
15
|
+
/**
|
|
16
|
+
* Heading style size.
|
|
17
|
+
* Values: small | regular(default) | large.
|
|
18
|
+
*/
|
|
19
|
+
this.size = 'regular';
|
|
20
|
+
/**
|
|
21
|
+
* Heading font weight.
|
|
22
|
+
* Values: regular(default) | bold.
|
|
23
|
+
*/
|
|
24
|
+
this.weight = 'regular';
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
this.weights = window.CuraAPI.theme.fonts.getWeights();
|
|
28
|
+
this.setFontProperties();
|
|
29
|
+
this.setColors();
|
|
30
|
+
}
|
|
31
|
+
getClasses() {
|
|
32
|
+
const classes = {};
|
|
33
|
+
classes[this.size.toLowerCase()] = true;
|
|
34
|
+
classes[`${this.weight.toLowerCase()}-weight`] = true;
|
|
35
|
+
return classes;
|
|
36
|
+
}
|
|
37
|
+
setFontProperties() {
|
|
38
|
+
this.styles = {
|
|
39
|
+
'--font-family': window.CuraAPI.theme.fonts.getFamily('heading'),
|
|
40
|
+
'--font-size': window.CuraAPI.theme.fonts.getSize(),
|
|
41
|
+
'--font-weight-regular': this.weights.regular,
|
|
42
|
+
'--font-weight-medium': this.weights.medium,
|
|
43
|
+
'--font-weight-bold': this.weights.bold,
|
|
44
|
+
'--font-weight-black': this.weights.black
|
|
45
|
+
};
|
|
46
|
+
this.setHostProperty('--font-size', window.CuraAPI.theme.fonts.getSize());
|
|
47
|
+
}
|
|
48
|
+
setColors() {
|
|
49
|
+
const fontColor = window.CuraAPI.theme.fonts.getColor();
|
|
50
|
+
this.styles['--color-body'] = fontColor || window.CuraAPI.theme.colors.getColor('neutral-darker');
|
|
51
|
+
this.styles['--color-link'] = window.CuraAPI.theme.colors.getColor('primary-700');
|
|
52
|
+
}
|
|
53
|
+
setHostProperty(prop, value) {
|
|
54
|
+
this.host.style.setProperty(prop, value);
|
|
55
|
+
}
|
|
56
|
+
getHeadingTag() {
|
|
57
|
+
const tags = {
|
|
58
|
+
'1': h("h1", { style: this.styles, class: this.getClasses() }, h("slot", null)),
|
|
59
|
+
'2': h("h2", { style: this.styles, class: this.getClasses() }, h("slot", null)),
|
|
60
|
+
'3': h("h3", { style: this.styles, class: this.getClasses() }, h("slot", null)),
|
|
61
|
+
'4': h("h4", { style: this.styles, class: this.getClasses() }, h("slot", null)),
|
|
62
|
+
'5': h("h5", { style: this.styles, class: this.getClasses() }, h("slot", null)),
|
|
63
|
+
'6': h("h6", { style: this.styles, class: this.getClasses() }, h("slot", null)),
|
|
64
|
+
'default': h("h1", { style: this.styles, class: this.getClasses() }, h("slot", null))
|
|
65
|
+
};
|
|
66
|
+
return tags[`${this.level}`] || tags['default'];
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return (h(Host, null, this.getHeadingTag()));
|
|
70
|
+
}
|
|
71
|
+
get host() { return this; }
|
|
72
|
+
static get style() { return curaHeadingCss; }
|
|
73
|
+
}, [1, "cura-heading", {
|
|
74
|
+
"level": [514],
|
|
75
|
+
"size": [513],
|
|
76
|
+
"weight": [513]
|
|
77
|
+
}]);
|
|
78
|
+
function defineCustomElement$1() {
|
|
79
|
+
if (typeof customElements === "undefined") {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const components = ["cura-heading"];
|
|
83
|
+
components.forEach(tagName => { switch (tagName) {
|
|
84
|
+
case "cura-heading":
|
|
85
|
+
if (!customElements.get(tagName)) {
|
|
86
|
+
customElements.define(tagName, CuraHeading$1);
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
} });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const CuraHeading = CuraHeading$1;
|
|
93
|
+
const defineCustomElement = defineCustomElement$1;
|
|
94
|
+
|
|
95
|
+
export { CuraHeading, defineCustomElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const curaIconCss = ":host{
|
|
3
|
+
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}";
|
|
4
4
|
|
|
5
5
|
const CuraIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -8,7 +8,7 @@ const CuraIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
8
8
|
this.__registerHost();
|
|
9
9
|
this.__attachShadow();
|
|
10
10
|
this.name = '';
|
|
11
|
-
this.color = 'neutral';
|
|
11
|
+
this.color = 'neutral-base';
|
|
12
12
|
this.iconset = 'default';
|
|
13
13
|
this.disabled = false;
|
|
14
14
|
this.sizes = {
|
|
@@ -31,34 +31,33 @@ const CuraIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
31
31
|
this.setHostProperty('--size', this.sizes[`${size}`] ? `${this.sizes[size].size}px` : `${this.sizes.default.size}px`);
|
|
32
32
|
this.setHostProperty('--stroke', this.sizes[`${size}`] ? scaledStroke(size) : scaledStroke("default"));
|
|
33
33
|
}
|
|
34
|
+
colorHandler() {
|
|
35
|
+
this.setHostProperty('--color', window.CuraAPI.theme.colors.getColor(this.disabled ? 'neutral-light' : this.color));
|
|
36
|
+
}
|
|
34
37
|
connectedCallback() {
|
|
35
38
|
this.assetsPath = window.CuraAPI.localAssetsPath;
|
|
36
39
|
this.sizeHandler(this.size);
|
|
37
|
-
|
|
38
|
-
getClasses() {
|
|
39
|
-
const classes = {};
|
|
40
|
-
classes[`icon-${this.color}`] = true;
|
|
41
|
-
if (this.disabled)
|
|
42
|
-
classes[`icon-disabled`] = true;
|
|
43
|
-
return classes;
|
|
40
|
+
this.colorHandler();
|
|
44
41
|
}
|
|
45
42
|
setHostProperty(prop, value) {
|
|
46
43
|
this.host.style.setProperty(prop, value);
|
|
47
44
|
}
|
|
48
45
|
render() {
|
|
49
|
-
return (h(Host, null, h("svg", { version: "1.1", viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg"
|
|
46
|
+
return (h(Host, null, h("svg", { version: "1.1", viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid meet", xmlns: "http://www.w3.org/2000/svg" }, h("use", { xlinkHref: `${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}` }))));
|
|
50
47
|
}
|
|
51
48
|
get host() { return this; }
|
|
52
49
|
static get watchers() { return {
|
|
53
|
-
"size": ["sizeHandler"]
|
|
50
|
+
"size": ["sizeHandler"],
|
|
51
|
+
"color": ["colorHandler"],
|
|
52
|
+
"disabled": ["colorHandler"]
|
|
54
53
|
}; }
|
|
55
54
|
static get style() { return curaIconCss; }
|
|
56
55
|
}, [1, "cura-icon", {
|
|
57
56
|
"name": [513],
|
|
58
|
-
"color": [
|
|
57
|
+
"color": [1],
|
|
59
58
|
"size": [8],
|
|
60
59
|
"iconset": [513],
|
|
61
|
-
"disabled": [
|
|
60
|
+
"disabled": [4]
|
|
62
61
|
}]);
|
|
63
62
|
function defineCustomElement() {
|
|
64
63
|
if (typeof customElements === "undefined") {
|
|
@@ -18,7 +18,7 @@ const CuraIconsView$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (h(Host, null, h("div", { class: "iconDetail" }, h("h4", null, this.selected), h("div", { class: "iconSizes" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size }), h("span", null, size)))), h("div", { class: "iconSizes invert" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size, color: "white" }), h("span", null, size)))), h("div", { class: "iconSizes" }, this.colors.map(color => h("div", { class: "size" }, h("cura-icon", { name: this.selected, color: color }), h("span", null, color))), h("div", { class: "size" }, h("cura-icon", { name: this.selected, disabled: true }), h("span", null, "Disabled")))), h("div", { class: "icons" }, iconsetdefaulticons.map(icon => h("div", { class: "icon", onClick: () => this.setSelected(icon) }, h("cura-icon", { name: icon }), h("span", null, icon))))));
|
|
21
|
+
return (h(Host, null, h("div", { class: "iconDetail" }, h("h4", null, this.selected), h("div", { class: "iconSizes" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size }), h("span", null, size)))), h("div", { class: "iconSizes invert" }, this.sizes.map(size => h("div", { class: "size" }, h("cura-icon", { name: this.selected, size: size, color: "neutral-white" }), h("span", null, size)))), h("div", { class: "iconSizes" }, this.colors.map(color => h("div", { class: "size" }, h("cura-icon", { name: this.selected, color: color }), h("span", null, color))), h("div", { class: "size" }, h("cura-icon", { name: this.selected, disabled: true }), h("span", null, "Disabled")))), h("div", { class: "icons" }, iconsetdefaulticons.map(icon => h("div", { class: "icon", onClick: () => this.setSelected(icon) }, h("cura-icon", { name: icon }), h("span", null, icon))))));
|
|
22
22
|
}
|
|
23
23
|
static get style() { return curaIconsViewCss; }
|
|
24
24
|
}, [1, "cura-icons-view", {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface CuraParagraph extends Components.CuraParagraph, HTMLElement {}
|
|
4
|
+
export const CuraParagraph: {
|
|
5
|
+
prototype: CuraParagraph;
|
|
6
|
+
new (): CuraParagraph;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
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}";
|
|
4
|
+
|
|
5
|
+
const CuraParagraph$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
/**
|
|
11
|
+
* Set size of body text.
|
|
12
|
+
* Values: regular (default) | large | small | caption.
|
|
13
|
+
*/
|
|
14
|
+
this.size = 'regular';
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
this.weights = window.CuraAPI.theme.fonts.getWeights();
|
|
18
|
+
this.setFontProperties();
|
|
19
|
+
this.setColors();
|
|
20
|
+
}
|
|
21
|
+
setsizeClass() {
|
|
22
|
+
const sizeclass = {};
|
|
23
|
+
sizeclass[this.size.toLowerCase()] = true;
|
|
24
|
+
return sizeclass;
|
|
25
|
+
}
|
|
26
|
+
setFontProperties() {
|
|
27
|
+
this.styles = {
|
|
28
|
+
'--font-family': window.CuraAPI.theme.fonts.getFamily('body'),
|
|
29
|
+
'--font-size': window.CuraAPI.theme.fonts.getSize(),
|
|
30
|
+
'--font-weight-regular': this.weights.regular,
|
|
31
|
+
'--font-weight-medium': this.weights.medium,
|
|
32
|
+
'--font-weight-bold': this.weights.bold
|
|
33
|
+
};
|
|
34
|
+
this.setHostProperty('--font-size', window.CuraAPI.theme.fonts.getSize());
|
|
35
|
+
}
|
|
36
|
+
setColors() {
|
|
37
|
+
const fontColor = window.CuraAPI.theme.fonts.getColor();
|
|
38
|
+
this.styles['--color-body'] = fontColor || window.CuraAPI.theme.colors.getColor(`neutral-darker`);
|
|
39
|
+
this.styles['--color-link'] = window.CuraAPI.theme.colors.getColor('primary-700');
|
|
40
|
+
}
|
|
41
|
+
setHostProperty(prop, value) {
|
|
42
|
+
this.host.style.setProperty(prop, value);
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
return (h(Host, null, h("p", { style: this.styles, class: this.setsizeClass() }, h("slot", null))));
|
|
46
|
+
}
|
|
47
|
+
get host() { return this; }
|
|
48
|
+
static get style() { return curaParagraphCss; }
|
|
49
|
+
}, [1, "cura-paragraph", {
|
|
50
|
+
"size": [513]
|
|
51
|
+
}]);
|
|
52
|
+
function defineCustomElement$1() {
|
|
53
|
+
if (typeof customElements === "undefined") {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const components = ["cura-paragraph"];
|
|
57
|
+
components.forEach(tagName => { switch (tagName) {
|
|
58
|
+
case "cura-paragraph":
|
|
59
|
+
if (!customElements.get(tagName)) {
|
|
60
|
+
customElements.define(tagName, CuraParagraph$1);
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
63
|
+
} });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const CuraParagraph = CuraParagraph$1;
|
|
67
|
+
const defineCustomElement = defineCustomElement$1;
|
|
68
|
+
|
|
69
|
+
export { CuraParagraph, defineCustomElement };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* cura custom elements */
|
|
2
|
+
export { CuraDisplay as CuraDisplay } from '../types/components/text/cura-display/cura-display';
|
|
3
|
+
export { CuraHeading as CuraHeading } from '../types/components/text/cura-heading/cura-heading';
|
|
2
4
|
export { CuraIcon as CuraIcon } from '../types/components/cura-icon/cura-icon';
|
|
3
5
|
export { CuraIconsView as CuraIconsView } from '../types/components/cura-icons-view/cura-icons-view';
|
|
4
|
-
export {
|
|
6
|
+
export { CuraParagraph as CuraParagraph } from '../types/components/text/cura-paragraph/cura-paragraph';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Used to manually set the base path where assets can be found.
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
export { CuraDisplay, defineCustomElement as defineCustomElementCuraDisplay } from './cura-display.js';
|
|
3
|
+
export { CuraHeading, defineCustomElement as defineCustomElementCuraHeading } from './cura-heading.js';
|
|
2
4
|
export { CuraIcon, defineCustomElement as defineCustomElementCuraIcon } from './cura-icon.js';
|
|
3
5
|
export { CuraIconsView, defineCustomElement as defineCustomElementCuraIconsView } from './cura-icons-view.js';
|
|
4
|
-
export {
|
|
6
|
+
export { CuraParagraph, defineCustomElement as defineCustomElementCuraParagraph } from './cura-paragraph.js';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Cura Default Theme
|
|
@@ -10,40 +12,46 @@ const ThemeDefault = {
|
|
|
10
12
|
/* Colors */
|
|
11
13
|
color: {
|
|
12
14
|
primary: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
'100': '#71C5E8',
|
|
16
|
+
'300': '#449CD5',
|
|
17
|
+
'500': '#005EB8',
|
|
18
|
+
'700': '#004890',
|
|
19
|
+
'900': '#002855'
|
|
18
20
|
},
|
|
19
21
|
secondary: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
'100': '#F5ECE3',
|
|
23
|
+
'300': '#DDC0A2',
|
|
24
|
+
'500': '#CCA074',
|
|
25
|
+
'700': '#886B4D',
|
|
26
|
+
'900': '#292017'
|
|
25
27
|
},
|
|
26
28
|
accent: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
'100': '#F9E8D5',
|
|
30
|
+
'300': '#E4A04F',
|
|
31
|
+
'500': '#DF8D2C',
|
|
32
|
+
'700': '#955E1D',
|
|
33
|
+
'900': '#2D1C09'
|
|
32
34
|
}
|
|
33
35
|
},
|
|
34
36
|
/* Spacing */
|
|
35
37
|
spacing: {
|
|
36
|
-
base:
|
|
38
|
+
base: 4,
|
|
37
39
|
},
|
|
38
40
|
/* Fonts */
|
|
39
41
|
font: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
size: '14px',
|
|
43
|
+
color: '#4A4A4A',
|
|
44
|
+
body: "'Roboto', Arial, Helvetica, sans-serif",
|
|
45
|
+
heading: "'Roboto', Arial, Helvetica, sans-serif",
|
|
46
|
+
display: "'Roboto', Arial, Helvetica, sans-serif",
|
|
47
|
+
weights: {
|
|
48
|
+
thin: 100,
|
|
49
|
+
light: 300,
|
|
50
|
+
regular: 400,
|
|
51
|
+
medium: 500,
|
|
52
|
+
bold: 700,
|
|
53
|
+
black: 900
|
|
43
54
|
},
|
|
44
|
-
size: {
|
|
45
|
-
base: '16px',
|
|
46
|
-
}
|
|
47
55
|
}
|
|
48
56
|
};
|
|
49
57
|
|
|
@@ -55,20 +63,18 @@ const ThemeMaternity = Object.assign(Object.assign({}, ThemeDefault), {
|
|
|
55
63
|
/* Colors */
|
|
56
64
|
color: {
|
|
57
65
|
primary: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
depth900: '#00133B'
|
|
66
|
+
'100': '#FCEFF6',
|
|
67
|
+
'300': '#FFBFE5',
|
|
68
|
+
'500': '#CD4D9A',
|
|
69
|
+
'700': '#99126C',
|
|
70
|
+
'900': '#00133B'
|
|
64
71
|
},
|
|
65
72
|
secondary: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
depth900: '#430E31'
|
|
73
|
+
'100': '#EDF3FF',
|
|
74
|
+
'300': '#BDD2FF',
|
|
75
|
+
'500': '#189AB4',
|
|
76
|
+
'700': '#001C58',
|
|
77
|
+
'900': '#430E31'
|
|
72
78
|
}
|
|
73
79
|
} });
|
|
74
80
|
|
|
@@ -77,9 +83,219 @@ const ThemePresets = {
|
|
|
77
83
|
'maternidade': ThemeMaternity
|
|
78
84
|
};
|
|
79
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Static
|
|
88
|
+
*/
|
|
89
|
+
const Static = {
|
|
90
|
+
/* Colors */
|
|
91
|
+
color: {
|
|
92
|
+
success: {
|
|
93
|
+
lighter: '#DFF6E9',
|
|
94
|
+
light: '#94E1B5',
|
|
95
|
+
base: '#5FD290',
|
|
96
|
+
dark: '#3F8C60',
|
|
97
|
+
darker: '#132A1D',
|
|
98
|
+
depth100: '#DFF6E9',
|
|
99
|
+
depth300: '#94E1B5',
|
|
100
|
+
depth500: '#5FD290',
|
|
101
|
+
depth700: '#3F8C60',
|
|
102
|
+
depth900: '#132A1D',
|
|
103
|
+
},
|
|
104
|
+
info: {
|
|
105
|
+
lighter: '#CFE2FF',
|
|
106
|
+
light: '#95BFFF',
|
|
107
|
+
base: '#6EA8FF',
|
|
108
|
+
dark: '#517BBB',
|
|
109
|
+
darker: '#253855',
|
|
110
|
+
depth100: '#CFE2FF',
|
|
111
|
+
depth300: '#95BFFF',
|
|
112
|
+
depth500: '#6EA8FF',
|
|
113
|
+
depth700: '#517BBB',
|
|
114
|
+
depth900: '#253855',
|
|
115
|
+
},
|
|
116
|
+
error: {
|
|
117
|
+
lighter: '#FBDDDD',
|
|
118
|
+
light: '#F28F8F',
|
|
119
|
+
base: '#EB5757',
|
|
120
|
+
dark: '#9D3A3A',
|
|
121
|
+
darker: '#2F1111',
|
|
122
|
+
depth100: '#FBDDDD',
|
|
123
|
+
depth300: '#F28F8F',
|
|
124
|
+
depth500: '#EB5757',
|
|
125
|
+
depth700: '#9D3A3A',
|
|
126
|
+
depth900: '#2F1111',
|
|
127
|
+
},
|
|
128
|
+
warning: {
|
|
129
|
+
lighter: '#FCFAC4',
|
|
130
|
+
light: '#F8F489',
|
|
131
|
+
base: '#F5EF4E',
|
|
132
|
+
dark: '#A39F34',
|
|
133
|
+
darker: '#313010',
|
|
134
|
+
depth100: '#FCFAC4',
|
|
135
|
+
depth300: '#F8F489',
|
|
136
|
+
depth500: '#F5EF4E',
|
|
137
|
+
depth700: '#A39F34',
|
|
138
|
+
depth900: '#313010',
|
|
139
|
+
},
|
|
140
|
+
/* neutral: {
|
|
141
|
+
'pure-white': '#FFFFFF',
|
|
142
|
+
white: '#F6F6F6',
|
|
143
|
+
pale: '#E9E9E9',
|
|
144
|
+
lighter: '#E2E2E2',
|
|
145
|
+
light: '#D4D4D4',
|
|
146
|
+
base: '#B7B7B7',
|
|
147
|
+
medium: '#929292',
|
|
148
|
+
dark: '#6E6E6E',
|
|
149
|
+
darker: '#4A4A4A',
|
|
150
|
+
black: '#262626',
|
|
151
|
+
depth0: '#FFFFFF',
|
|
152
|
+
depth100: '#F6F6F6',
|
|
153
|
+
depth200: '#E9E9E9',
|
|
154
|
+
depth300: '#E2E2E2',
|
|
155
|
+
depth400: '#D4D4D4',
|
|
156
|
+
depth500: '#B7B7B7',
|
|
157
|
+
depth600: '#929292',
|
|
158
|
+
depth700: '#6E6E6E',
|
|
159
|
+
depth800: '#4A4A4A',
|
|
160
|
+
depth900: '#262626',
|
|
161
|
+
}, */
|
|
162
|
+
neutral: {
|
|
163
|
+
'0': '#FFFFFF',
|
|
164
|
+
'100': '#F6F6F6',
|
|
165
|
+
'200': '#E9E9E9',
|
|
166
|
+
'300': '#E2E2E2',
|
|
167
|
+
'400': '#D4D4D4',
|
|
168
|
+
'500': '#B7B7B7',
|
|
169
|
+
'600': '#929292',
|
|
170
|
+
'700': '#6E6E6E',
|
|
171
|
+
'800': '#4A4A4A',
|
|
172
|
+
'900': '#262626',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
/* Icons */
|
|
176
|
+
icons: {
|
|
177
|
+
'sizes': ['128', '72', '64', '48', '40', '32', '24', '20', '16'],
|
|
178
|
+
'strokes': ['5.25', '3.5', '3.25', '2.75', '2.5', '2.25', '2', '1.75', '1.5'],
|
|
179
|
+
'default-size': '24',
|
|
180
|
+
},
|
|
181
|
+
/* Breakpoints */
|
|
182
|
+
breakpoints: {
|
|
183
|
+
small: '576px',
|
|
184
|
+
medium: '768px',
|
|
185
|
+
large: '992px',
|
|
186
|
+
xlarge: '1200px',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
class CuraThemeColorsModule {
|
|
191
|
+
constructor() {
|
|
192
|
+
this.NeutralDepthAlias = {
|
|
193
|
+
'purewhite': '0',
|
|
194
|
+
'white': '100',
|
|
195
|
+
'pale': '200',
|
|
196
|
+
'lighter': '300',
|
|
197
|
+
'light': '400',
|
|
198
|
+
'base': '500',
|
|
199
|
+
'medium': '600',
|
|
200
|
+
'dark': '700',
|
|
201
|
+
'darker': '800',
|
|
202
|
+
'black': '900',
|
|
203
|
+
};
|
|
204
|
+
this.ColorDepthAlias = {
|
|
205
|
+
'lighter': '100',
|
|
206
|
+
'light': '300',
|
|
207
|
+
'base': '500',
|
|
208
|
+
'dark': '700',
|
|
209
|
+
'darker': '900'
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Get theme color.
|
|
214
|
+
* @param colorWithDepth string Ex.: primary-light
|
|
215
|
+
* @returns css color property. Color definition or related css var from the theme.
|
|
216
|
+
*/
|
|
217
|
+
getColor(colorWithDepth = "primary-base") {
|
|
218
|
+
const { color, depth } = this.splitColorDepth(colorWithDepth);
|
|
219
|
+
const staticColor = this.getStatic(color, depth);
|
|
220
|
+
if (staticColor)
|
|
221
|
+
return staticColor;
|
|
222
|
+
return this.getDynamic(color, depth);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Internal: Look for static color by name and depth.
|
|
226
|
+
* @param color Color name.
|
|
227
|
+
* @param depth Depth number or alias.
|
|
228
|
+
* @returns Static color definition.
|
|
229
|
+
*/
|
|
230
|
+
getStatic(color, depth) {
|
|
231
|
+
var _a, _b;
|
|
232
|
+
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;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Internal: Look for theme dynamic colors.
|
|
236
|
+
* @param color Color name.
|
|
237
|
+
* @param depth Depth number or alias.
|
|
238
|
+
* @returns Related CSS variable defined by the theme.
|
|
239
|
+
*/
|
|
240
|
+
getDynamic(color, depth) {
|
|
241
|
+
const themeVar = this.ColorDepthAlias[depth]
|
|
242
|
+
? `--cura-color-${color}-${this.ColorDepthAlias[depth]}`
|
|
243
|
+
: `--cura-color-${color}-${depth}`;
|
|
244
|
+
return getComputedStyle(document.body).getPropertyValue(themeVar)
|
|
245
|
+
? `var(${themeVar})`
|
|
246
|
+
: `var(--cura-color-primary-500)`;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Internal: Split color strings
|
|
250
|
+
* @param colorWithDepth Color string [color]-[depth]. Ex.: primary-dark or primary-700.
|
|
251
|
+
* @returns Object { color: string, depth: string }.
|
|
252
|
+
*/
|
|
253
|
+
splitColorDepth(colorWithDepth) {
|
|
254
|
+
const [color, depth] = colorWithDepth.toLowerCase().split(/-(.*)/);
|
|
255
|
+
return { color: color !== null && color !== void 0 ? color : "primary", depth: depth !== null && depth !== void 0 ? depth : "base" };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
class CuraThemeFontsModule {
|
|
260
|
+
constructor() {
|
|
261
|
+
/**
|
|
262
|
+
* Get the CSS variable related to the font size base defined by the theme.
|
|
263
|
+
* @returns Related CSS variable as a string.
|
|
264
|
+
*/
|
|
265
|
+
this.getSize = () => `var(--cura-font-size)`;
|
|
266
|
+
/**
|
|
267
|
+
* Get CSS variable related to the font color defined by the theme.
|
|
268
|
+
* @returns Related CSS variable as a string.
|
|
269
|
+
*/
|
|
270
|
+
this.getColor = () => `var(--cura-font-color)`;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Get the CSS variable related to the font family defined by the theme.
|
|
274
|
+
* @param type 'body' | 'heading' | 'display'
|
|
275
|
+
* @returns Related css variable as a string.
|
|
276
|
+
*/
|
|
277
|
+
getFamily(type = "body") {
|
|
278
|
+
const curaFontFamilyCSSVar = `--cura-font-${type.toLowerCase()}`;
|
|
279
|
+
return getComputedStyle(document.body).getPropertyValue(curaFontFamilyCSSVar)
|
|
280
|
+
? `var(${curaFontFamilyCSSVar})`
|
|
281
|
+
: 'var(--cura-font-body)';
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Get the CSS variables related to font weights defined by the theme.
|
|
285
|
+
* @returns Object with CSS vars weights definitions for thin, light, regular, medium, bold and black fonts.
|
|
286
|
+
*/
|
|
287
|
+
getWeights() {
|
|
288
|
+
const weights = {};
|
|
289
|
+
Object.keys(ThemeDefault.font.weights).forEach((key) => weights[key] = `var(--cura-font-weights-${key})`);
|
|
290
|
+
return weights;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
80
294
|
class CuraThemeModule {
|
|
81
295
|
constructor() {
|
|
82
296
|
this.prefix = '--cura';
|
|
297
|
+
this.colors = new CuraThemeColorsModule();
|
|
298
|
+
this.fonts = new CuraThemeFontsModule();
|
|
83
299
|
/* Private */
|
|
84
300
|
/** Set css var based on object structure */
|
|
85
301
|
this.setCssVar = (prop, path) => {
|
|
@@ -152,7 +368,16 @@ class CuraAPI {
|
|
|
152
368
|
const themeModule = new CuraThemeModule();
|
|
153
369
|
this.theme = {
|
|
154
370
|
load: function (themeTag) { themeModule.load(themeTag); },
|
|
155
|
-
setCustom: function (customThemeDefinitions) { themeModule.setCustom(customThemeDefinitions); }
|
|
371
|
+
setCustom: function (customThemeDefinitions) { themeModule.setCustom(customThemeDefinitions); },
|
|
372
|
+
colors: {
|
|
373
|
+
getColor: function (colorWithDepth) { return themeModule.colors.getColor(colorWithDepth); },
|
|
374
|
+
},
|
|
375
|
+
fonts: {
|
|
376
|
+
getFamily: function (type) { return themeModule.fonts.getFamily(type); },
|
|
377
|
+
getWeights: function () { return themeModule.fonts.getWeights(); },
|
|
378
|
+
getSize: function () { return themeModule.fonts.getSize(); },
|
|
379
|
+
getColor: function () { return themeModule.fonts.getColor(); }
|
|
380
|
+
}
|
|
156
381
|
};
|
|
157
382
|
if (config && config.customTheme) {
|
|
158
383
|
this.theme.setCustom(config.customTheme);
|
package/dist/cura/cura.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as
|
|
1
|
+
import{p as e,b as a}from"./p-a50716bc.js";import{g as c}from"./p-265c1706.js";(()=>{const a=import.meta.url,c={};return""!==a&&(c.resourcesUrl=new URL(".",a).href),e(c)})().then((e=>(c(),a([["p-22290742",[[1,"cura-icon",{name:[513],color:[1],size:[8],iconset:[513],disabled:[4]}]]],["p-80dc1c9f",[[1,"cura-icons-view",{selected:[32]}]]],["p-d29b9e16",[[1,"cura-display",{level:[514],size:[513]}],[1,"cura-heading",{level:[514],size:[513],weight:[513]}],[1,"cura-paragraph",{size:[513]}]]]],e))));
|
package/dist/cura/cura.js
CHANGED
|
@@ -115,7 +115,7 @@ DOMTokenList
|
|
|
115
115
|
var resourcesUrl = scriptElm ? scriptElm.getAttribute('data-resources-url') || scriptElm.src : '';
|
|
116
116
|
var start = function() {
|
|
117
117
|
// if src is not present then origin is "null", and new URL() throws TypeError: Failed to construct 'URL': Invalid base URL
|
|
118
|
-
var url = new URL('./p-
|
|
118
|
+
var url = new URL('./p-a8dcaaed.system.js', new URL(resourcesUrl, window.location.origin !== 'null' ? window.location.origin : undefined));
|
|
119
119
|
System.import(url.href);
|
|
120
120
|
};
|
|
121
121
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,h as t,H as e,g as i}from"./p-a50716bc.js";const r=class{constructor(t){s(this,t),this.name="",this.color="neutral-base",this.iconset="default",this.disabled=!1,this.sizes={128:{size:128,stroke:5.25},72:{size:72,stroke:3.5},64:{size:64,stroke:3.25},48:{size:48,stroke:2.75},40:{size:40,stroke:2.5},32:{size:32,stroke:2.25},24:{size:24,stroke:2},20:{size:20,stroke:1.75},16:{size:16,stroke:1.5},default:{size:24,stroke:2}}}sizeHandler(s){this.setHostProperty("--size",this.sizes[`${s}`]?`${this.sizes[s].size}px`:`${this.sizes.default.size}px`),this.setHostProperty("--stroke",(s=>this.sizes[s].stroke*(this.sizes.default.size/this.sizes[s].size)+"px")(this.sizes[`${s}`]?s:"default"))}colorHandler(){this.setHostProperty("--color",window.CuraAPI.theme.colors.getColor(this.disabled?"neutral-light":this.color))}connectedCallback(){this.assetsPath=window.CuraAPI.localAssetsPath,this.sizeHandler(this.size),this.colorHandler()}setHostProperty(s,t){this.host.style.setProperty(s,t)}render(){return t(e,null,t("svg",{version:"1.1",viewBox:"0 0 24 24",preserveAspectRatio:"xMidYMid meet",xmlns:"http://www.w3.org/2000/svg"},t("use",{xlinkHref:`${this.assetsPath}/icons/iconset-${this.iconset}.svg#${this.name}`})))}get host(){return i(this)}static get watchers(){return{size:["sizeHandler"],color:["colorHandler"],disabled:["colorHandler"]}}};r.style=":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}";export{r as cura_icon}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t={color:{primary:{100:"#71C5E8",300:"#449CD5",500:"#005EB8",700:"#004890",900:"#002855"},secondary:{100:"#F5ECE3",300:"#DDC0A2",500:"#CCA074",700:"#886B4D",900:"#292017"},accent:{100:"#F9E8D5",300:"#E4A04F",500:"#DF8D2C",700:"#955E1D",900:"#2D1C09"}},spacing:{base:4},font:{size:"14px",color:"#4A4A4A",body:"'Roboto', Arial, Helvetica, sans-serif",heading:"'Roboto', Arial, Helvetica, sans-serif",display:"'Roboto', Arial, Helvetica, sans-serif",weights:{thin:100,light:300,regular:400,medium:500,bold:700,black:900}}},e=Object.assign(Object.assign({},t),{color:{primary:{100:"#FCEFF6",300:"#FFBFE5",500:"#CD4D9A",700:"#99126C",900:"#00133B"},secondary:{100:"#EDF3FF",300:"#BDD2FF",500:"#189AB4",700:"#001C58",900:"#430E31"}}}),r={default:t,maternidade:e},o={color:{success:{lighter:"#DFF6E9",light:"#94E1B5",base:"#5FD290",dark:"#3F8C60",darker:"#132A1D",depth100:"#DFF6E9",depth300:"#94E1B5",depth500:"#5FD290",depth700:"#3F8C60",depth900:"#132A1D"},info:{lighter:"#CFE2FF",light:"#95BFFF",base:"#6EA8FF",dark:"#517BBB",darker:"#253855",depth100:"#CFE2FF",depth300:"#95BFFF",depth500:"#6EA8FF",depth700:"#517BBB",depth900:"#253855"},error:{lighter:"#FBDDDD",light:"#F28F8F",base:"#EB5757",dark:"#9D3A3A",darker:"#2F1111",depth100:"#FBDDDD",depth300:"#F28F8F",depth500:"#EB5757",depth700:"#9D3A3A",depth900:"#2F1111"},warning:{lighter:"#FCFAC4",light:"#F8F489",base:"#F5EF4E",dark:"#A39F34",darker:"#313010",depth100:"#FCFAC4",depth300:"#F8F489",depth500:"#F5EF4E",depth700:"#A39F34",depth900:"#313010"},neutral:{0:"#FFFFFF",100:"#F6F6F6",200:"#E9E9E9",300:"#E2E2E2",400:"#D4D4D4",500:"#B7B7B7",600:"#929292",700:"#6E6E6E",800:"#4A4A4A",900:"#262626"}},icons:{sizes:["128","72","64","48","40","32","24","20","16"],strokes:["5.25","3.5","3.25","2.75","2.5","2.25","2","1.75","1.5"],"default-size":"24"},breakpoints:{small:"576px",medium:"768px",large:"992px",xlarge:"1200px"}};class s{constructor(){this.NeutralDepthAlias={purewhite:"0",white:"100",pale:"200",lighter:"300",light:"400",base:"500",medium:"600",dark:"700",darker:"800",black:"900"},this.ColorDepthAlias={lighter:"100",light:"300",base:"500",dark:"700",darker:"900"}}getColor(t="primary-base"){const{color:e,depth:r}=this.splitColorDepth(t);return this.getStatic(e,r)||this.getDynamic(e,r)}getStatic(t,e){var r,s;return(null===(r=o.color[t])||void 0===r?void 0:r[e])||(null===(s=o.color[t])||void 0===s?void 0:s[this.NeutralDepthAlias[e]])||null}getDynamic(t,e){const r=this.ColorDepthAlias[e]?`--cura-color-${t}-${this.ColorDepthAlias[e]}`:`--cura-color-${t}-${e}`;return getComputedStyle(document.body).getPropertyValue(r)?`var(${r})`:"var(--cura-color-primary-500)"}splitColorDepth(t){const[e,r]=t.toLowerCase().split(/-(.*)/);return{color:null!=e?e:"primary",depth:null!=r?r:"base"}}}class i{constructor(){this.getSize=()=>"var(--cura-font-size)",this.getColor=()=>"var(--cura-font-color)"}getFamily(t="body"){const e="--cura-font-"+t.toLowerCase();return getComputedStyle(document.body).getPropertyValue(e)?`var(${e})`:"var(--cura-font-body)"}getWeights(){const e={};return Object.keys(t.font.weights).forEach((t=>e[t]=`var(--cura-font-weights-${t})`)),e}}class a{constructor(){this.prefix="--cura",this.colors=new s,this.fonts=new i,this.setCssVar=(t,e)=>{const r=this.groupPath(e,t[0]);this.body.style.setProperty(r,t[1])},this.groupPath=(t,e)=>`${t}-${e}`,this.isObject=t=>t&&"object"==typeof t&&!Array.isArray(t),this.mergeObject=(t,e)=>{const r=Object.entries(t);for(let t of r)this.isObject(t[1])?this.mergeObject(t[1],e[t[0]]):e[t[0]]=t[1]},this.buildCssVars=(t,e)=>{const r=Object.entries(e);for(let e of r)this.isObject(e[1])?this.buildCssVars(this.groupPath(t,e[0]),e[1]):this.setCssVar(e,t)},this.body=window.document.documentElement.querySelector("body")}load(t="default"){this.buildCssVars(this.prefix,r[t]?r[t]:r.default)}setCustom(t){const e=t.name;if(e in r)console.log("Error building custom theme. Theme %s already exists. Loading default theme.",e),this.load("default");else{const o=Object.assign({},JSON.parse(JSON.stringify(t.fromPreset&&t.fromPreset in r?r[t.fromPreset]:r.default)));this.mergeObject(t.definitions,o),r[e]=o,this.load(e)}}}class n{constructor(t){this.localAssetsPath=t&&t.localAssetsPath?t.localAssetsPath:"/assets";const e=new a;this.theme={load:function(t){e.load(t)},setCustom:function(t){e.setCustom(t)},colors:{getColor:function(t){return e.colors.getColor(t)}},fonts:{getFamily:function(t){return e.fonts.getFamily(t)},getWeights:function(){return e.fonts.getWeights()},getSize:function(){return e.fonts.getSize()},getColor:function(){return e.fonts.getColor()}}},t&&t.customTheme?this.theme.setCustom(t.customTheme):this.theme.load(t&&t.theme?t.theme:"default")}}const h=function(){const t=window.CuraInit;window.CuraAPI=t?new n(t):new n;const e=window.CuraAPI;window.dispatchEvent(new CustomEvent("CuraAPIReady",{detail:{api:e}})),t&&"function"==typeof t.onReady&&t.onReady(e)};export{h as g}
|