@swell/swell-ui 0.1.0 → 0.1.1
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 +6 -0
- package/README.md +1 -1
- package/custom-elements.json +8274 -0
- package/dist/chunks/badge-Dt6q8Cqa.js +11 -0
- package/dist/chunks/button-C7nCiu-t.js +123 -0
- package/dist/chunks/card-CvSQEug8.js +10 -0
- package/dist/chunks/checkbox-BRI_A1TP.js +99 -0
- package/dist/chunks/chip-BtnufSMG.js +48 -0
- package/dist/chunks/config-C-FYxOaJ.js +588 -0
- package/dist/chunks/define-BlQTa1g4.js +19 -0
- package/dist/chunks/description-BHfQ8meK.js +19 -0
- package/dist/chunks/disclosure-CET8-H6f.js +56 -0
- package/dist/chunks/divider-BfkO0c1j.js +27 -0
- package/dist/chunks/element-B4-_7TLZ.js +138 -0
- package/dist/chunks/input-Uun-ls2_.js +53 -0
- package/dist/chunks/link-8qHFEKQE.js +53 -0
- package/dist/chunks/link-D4NC86oc.js +24 -0
- package/dist/chunks/lookup-5icr_T6o.js +205 -0
- package/dist/chunks/lookup-list-Bw6OJoDS.js +19 -0
- package/dist/chunks/lookup-option-Mn3k8W2M.js +26 -0
- package/dist/chunks/popover-D3Ob6slA.js +92 -0
- package/dist/chunks/popup-Dbh2fchP.js +21 -0
- package/dist/chunks/quantity-h3wqn8tC.js +140 -0
- package/dist/chunks/radio-BhFDL3pO.js +192 -0
- package/dist/chunks/radio-option-hT29S8Zl.js +88 -0
- package/dist/chunks/select-DS1n_htj.js +331 -0
- package/dist/chunks/select-option-DoM9GAe0.js +66 -0
- package/dist/chunks/skeleton-DfPjhls9.js +13 -0
- package/dist/chunks/status-B23JZ5RQ.js +71 -0
- package/dist/chunks/tab-BpjFUbFO.js +107 -0
- package/dist/chunks/tabs-aWKq1Iaz.js +122 -0
- package/dist/chunks/text-ZWPy-iB3.js +26 -0
- package/dist/chunks/text-field-BB_MRt5h.js +158 -0
- package/dist/chunks/textarea-L6_OJ2IN.js +18 -0
- package/dist/chunks/thumbnail-CLe9AsFg.js +21 -0
- package/dist/chunks/toggle-C7-oPgWR.js +22 -0
- package/dist/chunks/ui-HcyMKwzs.js +11 -0
- package/dist/editors/vscode.css-custom-data.json +824 -0
- package/dist/editors/vscode.html-custom-data.json +1156 -0
- package/dist/editors/web-types.json +1706 -0
- package/dist/elements/badge.d.ts +1 -0
- package/dist/elements/badge.js +1 -0
- package/dist/elements/button.d.ts +1 -0
- package/dist/elements/button.js +1 -0
- package/dist/elements/card.d.ts +1 -0
- package/dist/elements/card.js +1 -0
- package/dist/elements/checkbox.d.ts +1 -0
- package/dist/elements/checkbox.js +1 -0
- package/dist/elements/chip.d.ts +1 -0
- package/dist/elements/chip.js +1 -0
- package/dist/elements/disclosure.d.ts +1 -0
- package/dist/elements/disclosure.js +1 -0
- package/dist/elements/divider.d.ts +1 -0
- package/dist/elements/divider.js +1 -0
- package/dist/elements/input.d.ts +1 -0
- package/dist/elements/input.js +1 -0
- package/dist/elements/link.d.ts +1 -0
- package/dist/elements/link.js +1 -0
- package/dist/elements/lookup-list.d.ts +1 -0
- package/dist/elements/lookup-list.js +1 -0
- package/dist/elements/lookup-option.d.ts +1 -0
- package/dist/elements/lookup-option.js +1 -0
- package/dist/elements/lookup.d.ts +1 -0
- package/dist/elements/lookup.js +1 -0
- package/dist/elements/popover.d.ts +1 -0
- package/dist/elements/popover.js +1 -0
- package/dist/elements/quantity.d.ts +1 -0
- package/dist/elements/quantity.js +1 -0
- package/dist/elements/radio-option.d.ts +1 -0
- package/dist/elements/radio-option.js +1 -0
- package/dist/elements/radio.d.ts +1 -0
- package/dist/elements/radio.js +1 -0
- package/dist/elements/select-option.d.ts +1 -0
- package/dist/elements/select-option.js +1 -0
- package/dist/elements/select.d.ts +1 -0
- package/dist/elements/select.js +1 -0
- package/dist/elements/skeleton.d.ts +1 -0
- package/dist/elements/skeleton.js +1 -0
- package/dist/elements/status.d.ts +1 -0
- package/dist/elements/status.js +1 -0
- package/dist/elements/tab.d.ts +1 -0
- package/dist/elements/tab.js +1 -0
- package/dist/elements/tabs.d.ts +1 -0
- package/dist/elements/tabs.js +1 -0
- package/dist/elements/text.d.ts +1 -0
- package/dist/elements/text.js +1 -0
- package/dist/elements/textarea.d.ts +1 -0
- package/dist/elements/textarea.js +1 -0
- package/dist/elements/thumbnail.d.ts +1 -0
- package/dist/elements/thumbnail.js +1 -0
- package/dist/elements/ui.d.ts +1 -0
- package/dist/elements/ui.js +1 -0
- package/dist/frameworks/jsx.d.ts +3589 -0
- package/dist/frameworks/preact.d.ts +9 -0
- package/dist/frameworks/solid.d.ts +7 -0
- package/dist/frameworks/svelte.d.ts +1676 -0
- package/dist/frameworks/vue.d.ts +827 -0
- package/dist/index.js +80 -0
- package/dist/react/badge.d.ts +12 -0
- package/dist/react/badge.js +4 -0
- package/dist/react/button.d.ts +16 -0
- package/dist/react/button.js +4 -0
- package/dist/react/card.d.ts +11 -0
- package/dist/react/card.js +4 -0
- package/dist/react/checkbox.d.ts +14 -0
- package/dist/react/checkbox.js +4 -0
- package/dist/react/chip.d.ts +12 -0
- package/dist/react/chip.js +4 -0
- package/dist/react/create.js +49 -0
- package/dist/react/disclosure.d.ts +11 -0
- package/dist/react/disclosure.js +4 -0
- package/dist/react/divider.d.ts +9 -0
- package/dist/react/divider.js +4 -0
- package/dist/react/index.d.ts +26 -0
- package/dist/react/index.js +26 -0
- package/dist/react/input.d.ts +28 -0
- package/dist/react/input.js +4 -0
- package/dist/react/link.d.ts +15 -0
- package/dist/react/link.js +4 -0
- package/dist/react/lookup-list.d.ts +9 -0
- package/dist/react/lookup-list.js +4 -0
- package/dist/react/lookup-option.d.ts +11 -0
- package/dist/react/lookup-option.js +4 -0
- package/dist/react/lookup.d.ts +28 -0
- package/dist/react/lookup.js +4 -0
- package/dist/react/popover.d.ts +11 -0
- package/dist/react/popover.js +4 -0
- package/dist/react/quantity.d.ts +15 -0
- package/dist/react/quantity.js +4 -0
- package/dist/react/radio-option.d.ts +11 -0
- package/dist/react/radio-option.js +4 -0
- package/dist/react/radio.d.ts +18 -0
- package/dist/react/radio.js +4 -0
- package/dist/react/select-option.d.ts +11 -0
- package/dist/react/select-option.js +4 -0
- package/dist/react/select.d.ts +20 -0
- package/dist/react/select.js +4 -0
- package/dist/react/skeleton.d.ts +11 -0
- package/dist/react/skeleton.js +4 -0
- package/dist/react/status.d.ts +12 -0
- package/dist/react/status.js +4 -0
- package/dist/react/tab.d.ts +10 -0
- package/dist/react/tab.js +4 -0
- package/dist/react/tabs.d.ts +17 -0
- package/dist/react/tabs.js +4 -0
- package/dist/react/text.d.ts +12 -0
- package/dist/react/text.js +4 -0
- package/dist/react/textarea.d.ts +23 -0
- package/dist/react/textarea.js +4 -0
- package/dist/react/thumbnail.d.ts +13 -0
- package/dist/react/thumbnail.js +4 -0
- package/dist/react/ui.d.ts +10 -0
- package/dist/react/ui.js +4 -0
- package/dist/types/components/core/badge/badge.d.ts +25 -0
- package/dist/types/components/core/button/button.d.ts +60 -0
- package/dist/types/components/core/card/card.d.ts +21 -0
- package/dist/types/components/core/checkbox/checkbox.d.ts +46 -0
- package/dist/types/components/core/chip/chip.d.ts +36 -0
- package/dist/types/components/core/disclosure/disclosure.d.ts +37 -0
- package/dist/types/components/core/divider/divider.d.ts +21 -0
- package/dist/types/components/core/index.d.ts +21 -0
- package/dist/types/components/core/input/input.d.ts +57 -0
- package/dist/types/components/core/link/link.d.ts +42 -0
- package/dist/types/components/core/lookup/lookup-list.d.ts +21 -0
- package/dist/types/components/core/lookup/lookup-option.d.ts +27 -0
- package/dist/types/components/core/lookup/lookup.d.ts +32 -0
- package/dist/types/components/core/popover/popover.d.ts +33 -0
- package/dist/types/components/core/quantity/quantity.d.ts +47 -0
- package/dist/types/components/core/radio/radio-option.d.ts +82 -0
- package/dist/types/components/core/radio/radio.d.ts +65 -0
- package/dist/types/components/core/select/select-option.d.ts +69 -0
- package/dist/types/components/core/select/select.d.ts +70 -0
- package/dist/types/components/core/skeleton/skeleton.d.ts +23 -0
- package/dist/types/components/core/status/status.d.ts +38 -0
- package/dist/types/components/core/tabs/tab.d.ts +76 -0
- package/dist/types/components/core/tabs/tabs.d.ts +46 -0
- package/dist/types/components/core/text/text.d.ts +23 -0
- package/dist/types/components/core/textarea/textarea.d.ts +45 -0
- package/dist/types/components/core/thumbnail/thumbnail.d.ts +27 -0
- package/dist/types/components/core/ui/ui.d.ts +16 -0
- package/dist/types/components/elements.d.ts +1 -0
- package/dist/types/react/create.d.ts +8 -0
- package/dist/types/runtime/config.d.ts +25 -0
- package/dist/types/runtime/css.d.ts +12 -0
- package/dist/types/runtime/define.d.ts +4 -0
- package/dist/types/runtime/description.d.ts +12 -0
- package/dist/types/runtime/element.d.ts +61 -0
- package/dist/types/runtime/focus.d.ts +5 -0
- package/dist/types/runtime/form.d.ts +5 -0
- package/dist/types/runtime/index.d.ts +2 -0
- package/dist/types/runtime/link.d.ts +17 -0
- package/dist/types/runtime/loader.d.ts +21 -0
- package/dist/types/runtime/popup.d.ts +8 -0
- package/dist/types/runtime/sheet.d.ts +31 -0
- package/dist/types/runtime/text-field.d.ts +47 -0
- package/dist/types/runtime/toggle.d.ts +8 -0
- package/dist/types/runtime/tokens.generated.d.ts +492 -0
- package/dist/types/runtime/values.d.ts +6 -0
- package/dist/types/runtime/variants.d.ts +4 -0
- package/package.json +2 -1
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
// src/runtime/css.ts
|
|
2
|
+
var e = (e) => `--swell-${e.replaceAll(".", "-")}`, t = [
|
|
3
|
+
"background",
|
|
4
|
+
"foreground",
|
|
5
|
+
"border",
|
|
6
|
+
"accent",
|
|
7
|
+
"shadow"
|
|
8
|
+
], n = t.slice(0, 4), r = (t) => e(t).replace("--swell-", "--_swell-"), i = (e) => parseFloat(e) * (e.trim().endsWith("ms") ? 1 : 1e3) || 0, a = /* @__PURE__ */ new Set([
|
|
9
|
+
"serif",
|
|
10
|
+
"sans-serif",
|
|
11
|
+
"monospace",
|
|
12
|
+
"cursive",
|
|
13
|
+
"fantasy",
|
|
14
|
+
"system-ui"
|
|
15
|
+
]);
|
|
16
|
+
function o(e) {
|
|
17
|
+
return a.has(e) || /^-?[A-Za-z][A-Za-z0-9-]*$/.test(e) ? e : JSON.stringify(e);
|
|
18
|
+
}
|
|
19
|
+
// src/runtime/tokens.generated.ts
|
|
20
|
+
var s = ":root {\n --swell-color-background: light-dark(#ffffff, #14171d);\n --swell-color-foreground: light-dark(#0e1117, #e8eaef);\n --swell-color-border: light-dark(#e4e5e5, #2b2e34);\n --swell-color-accent: light-dark(#3a66f5, #5b8cff);\n --swell-color-danger: light-dark(#d7373d, #f2555a);\n --swell-color-success: light-dark(#12945e, #3ecf8e);\n --swell-color-warning: light-dark(#b9700a, #f0aa3c);\n --swell-color-secondary-background: light-dark(#f5f5f6, #1c1f25);\n --swell-color-secondary-foreground: light-dark(#6a6b6f, #979a9f);\n --swell-color-secondary-border: var(--swell-color-border);\n --swell-color-secondary-accent: var(--swell-color-secondary-foreground);\n --swell-color-secondary-shadow: light-dark(#f5f5f699, #1c1f2599);\n --swell-font-family: -apple-system, BlinkMacSystemFont, Inter, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n --swell-font-size: 14px;\n --swell-font-weight: 400;\n --swell-font-tracking: 0em;\n --swell-font-leading: 1.5;\n --swell-font-caption-size: 13px;\n --swell-font-footnote-size: 12px;\n --swell-font-heading-family: var(--swell-font-family);\n --swell-font-heading-weight: 650;\n --swell-font-heading-tracking: -0.015em;\n --swell-font-medium-weight: 500;\n --swell-font-strong-weight: 600;\n --swell-font-bold-weight: 700;\n --swell-border-radius: 8px;\n --swell-border-width: 1px;\n --swell-border-strong-width: 1.5px;\n --swell-focus-color: var(--swell-color-accent);\n --swell-focus-width: 2px;\n --swell-focus-offset: 2px;\n --swell-motion-duration-fast: 200ms;\n --swell-motion-duration-base: 250ms;\n --swell-motion-duration-slow: 450ms;\n --swell-motion-duration-loop: 1350ms;\n --swell-motion-easing: cubic-bezier(0.2, 0.8, 0.2, 1);\n --swell-motion-spring: cubic-bezier(0.34, 1.56, 0.64, 1);\n --swell-control-height: 48px;\n --swell-control-font-size: var(--swell-font-size);\n --swell-control-xsmall-height: 32px;\n --swell-control-xsmall-font-size: 12px;\n --swell-control-small-height: 40px;\n --swell-control-small-font-size: 13px;\n --swell-control-large-height: 56px;\n --swell-control-large-font-size: 16px;\n --swell-control-xlarge-height: 64px;\n --swell-control-xlarge-font-size: 18px;\n --swell-control-disabled-opacity: 0.5;\n --swell-field-color-background: var(--swell-color-secondary-background);\n --swell-field-color-foreground: var(--swell-color-foreground);\n --swell-field-color-border: light-dark(#8b8d90, #7a7c82);\n --swell-field-hover-color-border: light-dark(#595b5f, #a6a8ad);\n --swell-field-focus-color-ring: light-dark(#3a66f529, #5b8cff29);\n --swell-field-invalid-color-ring: light-dark(#d7373d17, #f2555a17);\n --swell-field-label-font-family: var(--swell-font-family);\n --swell-field-label-font-weight: var(--swell-font-strong-weight);\n --swell-field-label-font-tracking: var(--swell-font-tracking);\n --swell-field-label-color-foreground: light-dark(#484a4f, #b5b7bd);\n --swell-field-ring-width: 3px;\n --swell-field-gap: 6px;\n --swell-field-outline-color-background: #00000000;\n --swell-overlay-border-radius: var(--swell-border-radius);\n --swell-overlay-color-background: var(--swell-color-background);\n --swell-overlay-color-border: var(--swell-color-border);\n --swell-overlay-color-shadow: #00000059;\n --swell-overlay-shadow: 0px 20px 40px -18px;\n --swell-overlay-padding: 16px;\n --swell-overlay-offset: 12px;\n --swell-overlay-height: 320px;\n}\n", c = {
|
|
21
|
+
color: "global",
|
|
22
|
+
font: "global",
|
|
23
|
+
border: "global",
|
|
24
|
+
focus: "global",
|
|
25
|
+
motion: "global",
|
|
26
|
+
control: "global",
|
|
27
|
+
field: "global",
|
|
28
|
+
overlay: "global",
|
|
29
|
+
text: "components",
|
|
30
|
+
link: "components",
|
|
31
|
+
button: "components",
|
|
32
|
+
checkbox: "components",
|
|
33
|
+
radio: "components",
|
|
34
|
+
status: "components",
|
|
35
|
+
badge: "components",
|
|
36
|
+
chip: "components",
|
|
37
|
+
thumbnail: "components",
|
|
38
|
+
card: "components",
|
|
39
|
+
tabs: "components"
|
|
40
|
+
}, l = {
|
|
41
|
+
"color.background": { type: "color" },
|
|
42
|
+
"color.foreground": { type: "color" },
|
|
43
|
+
"color.border": { type: "color" },
|
|
44
|
+
"color.accent": { type: "color" },
|
|
45
|
+
"color.danger": { type: "color" },
|
|
46
|
+
"color.success": { type: "color" },
|
|
47
|
+
"color.warning": { type: "color" },
|
|
48
|
+
"color.secondary.background": { type: "color" },
|
|
49
|
+
"color.secondary.foreground": { type: "color" },
|
|
50
|
+
"color.secondary.border": { type: "color" },
|
|
51
|
+
"color.secondary.accent": { type: "color" },
|
|
52
|
+
"color.secondary.shadow": { type: "color" },
|
|
53
|
+
"font.family": { type: "fontFamily" },
|
|
54
|
+
"font.size": { type: "dimension" },
|
|
55
|
+
"font.weight": { type: "fontWeight" },
|
|
56
|
+
"font.tracking": {
|
|
57
|
+
type: "number",
|
|
58
|
+
unit: "em"
|
|
59
|
+
},
|
|
60
|
+
"font.leading": { type: "number" },
|
|
61
|
+
"font.caption.size": { type: "dimension" },
|
|
62
|
+
"font.footnote.size": { type: "dimension" },
|
|
63
|
+
"font.heading.family": { type: "fontFamily" },
|
|
64
|
+
"font.heading.weight": { type: "fontWeight" },
|
|
65
|
+
"font.heading.tracking": {
|
|
66
|
+
type: "number",
|
|
67
|
+
unit: "em"
|
|
68
|
+
},
|
|
69
|
+
"font.medium.weight": { type: "fontWeight" },
|
|
70
|
+
"font.strong.weight": { type: "fontWeight" },
|
|
71
|
+
"font.bold.weight": { type: "fontWeight" },
|
|
72
|
+
"border.radius": { type: "dimension" },
|
|
73
|
+
"border.width": { type: "dimension" },
|
|
74
|
+
"border.strong.width": { type: "dimension" },
|
|
75
|
+
"focus.color": { type: "color" },
|
|
76
|
+
"focus.width": { type: "dimension" },
|
|
77
|
+
"focus.offset": { type: "dimension" },
|
|
78
|
+
"motion.duration.fast": { type: "duration" },
|
|
79
|
+
"motion.duration.base": { type: "duration" },
|
|
80
|
+
"motion.duration.slow": { type: "duration" },
|
|
81
|
+
"motion.duration.loop": { type: "duration" },
|
|
82
|
+
"motion.easing": { type: "cubicBezier" },
|
|
83
|
+
"motion.spring": { type: "cubicBezier" },
|
|
84
|
+
"control.height": { type: "dimension" },
|
|
85
|
+
"control.font.size": { type: "dimension" },
|
|
86
|
+
"control.xsmall.height": { type: "dimension" },
|
|
87
|
+
"control.xsmall.font.size": { type: "dimension" },
|
|
88
|
+
"control.small.height": { type: "dimension" },
|
|
89
|
+
"control.small.font.size": { type: "dimension" },
|
|
90
|
+
"control.large.height": { type: "dimension" },
|
|
91
|
+
"control.large.font.size": { type: "dimension" },
|
|
92
|
+
"control.xlarge.height": { type: "dimension" },
|
|
93
|
+
"control.xlarge.font.size": { type: "dimension" },
|
|
94
|
+
"control.disabled.opacity": { type: "number" },
|
|
95
|
+
"field.color.background": { type: "color" },
|
|
96
|
+
"field.color.foreground": { type: "color" },
|
|
97
|
+
"field.color.border": { type: "color" },
|
|
98
|
+
"field.hover.color.border": { type: "color" },
|
|
99
|
+
"field.focus.color.ring": { type: "color" },
|
|
100
|
+
"field.invalid.color.ring": { type: "color" },
|
|
101
|
+
"field.label.font.family": { type: "fontFamily" },
|
|
102
|
+
"field.label.font.weight": { type: "fontWeight" },
|
|
103
|
+
"field.label.font.tracking": {
|
|
104
|
+
type: "number",
|
|
105
|
+
unit: "em"
|
|
106
|
+
},
|
|
107
|
+
"field.label.color.foreground": { type: "color" },
|
|
108
|
+
"field.ring.width": { type: "dimension" },
|
|
109
|
+
"field.gap": { type: "dimension" },
|
|
110
|
+
"field.outline.color.background": { type: "color" },
|
|
111
|
+
"overlay.border.radius": { type: "dimension" },
|
|
112
|
+
"overlay.color.background": { type: "color" },
|
|
113
|
+
"overlay.color.border": { type: "color" },
|
|
114
|
+
"overlay.color.shadow": { type: "color" },
|
|
115
|
+
"overlay.shadow": { type: "shadow" },
|
|
116
|
+
"overlay.padding": { type: "dimension" },
|
|
117
|
+
"overlay.offset": { type: "dimension" },
|
|
118
|
+
"overlay.height": { type: "dimension" },
|
|
119
|
+
"text.font.family": { type: "fontFamily" },
|
|
120
|
+
"text.font.size": { type: "dimension" },
|
|
121
|
+
"text.font.weight": { type: "fontWeight" },
|
|
122
|
+
"text.font.tracking": {
|
|
123
|
+
type: "number",
|
|
124
|
+
unit: "em"
|
|
125
|
+
},
|
|
126
|
+
"text.font.leading": { type: "number" },
|
|
127
|
+
"text.color.accent": { type: "color" },
|
|
128
|
+
"text.title.font.family": { type: "fontFamily" },
|
|
129
|
+
"text.title.font.size": { type: "dimension" },
|
|
130
|
+
"text.title.font.weight": { type: "fontWeight" },
|
|
131
|
+
"text.title.font.tracking": {
|
|
132
|
+
type: "number",
|
|
133
|
+
unit: "em"
|
|
134
|
+
},
|
|
135
|
+
"text.title.font.leading": { type: "number" },
|
|
136
|
+
"text.heading.font.family": { type: "fontFamily" },
|
|
137
|
+
"text.heading.font.size": { type: "dimension" },
|
|
138
|
+
"text.heading.font.weight": { type: "fontWeight" },
|
|
139
|
+
"text.heading.font.tracking": {
|
|
140
|
+
type: "number",
|
|
141
|
+
unit: "em"
|
|
142
|
+
},
|
|
143
|
+
"text.heading.font.leading": { type: "number" },
|
|
144
|
+
"text.subheading.font.family": { type: "fontFamily" },
|
|
145
|
+
"text.subheading.font.size": { type: "dimension" },
|
|
146
|
+
"text.subheading.font.weight": { type: "fontWeight" },
|
|
147
|
+
"text.subheading.font.tracking": {
|
|
148
|
+
type: "number",
|
|
149
|
+
unit: "em"
|
|
150
|
+
},
|
|
151
|
+
"text.subheading.font.leading": { type: "number" },
|
|
152
|
+
"text.strong.font.weight": { type: "fontWeight" },
|
|
153
|
+
"text.caption.font.size": { type: "dimension" },
|
|
154
|
+
"text.footnote.font.size": { type: "dimension" },
|
|
155
|
+
"text.eyebrow.font.size": { type: "dimension" },
|
|
156
|
+
"text.eyebrow.font.weight": { type: "fontWeight" },
|
|
157
|
+
"text.eyebrow.font.tracking": {
|
|
158
|
+
type: "number",
|
|
159
|
+
unit: "em"
|
|
160
|
+
},
|
|
161
|
+
"link.font.weight": { type: "fontWeight" },
|
|
162
|
+
"link.color.accent": { type: "color" },
|
|
163
|
+
"button.height": { type: "dimension" },
|
|
164
|
+
"button.font.size": { type: "dimension" },
|
|
165
|
+
"button.font.tracking": {
|
|
166
|
+
type: "number",
|
|
167
|
+
unit: "em"
|
|
168
|
+
},
|
|
169
|
+
"button.font.weight": { type: "fontWeight" },
|
|
170
|
+
"button.xsmall.height": { type: "dimension" },
|
|
171
|
+
"button.xsmall.font.size": { type: "dimension" },
|
|
172
|
+
"button.small.height": { type: "dimension" },
|
|
173
|
+
"button.small.font.size": { type: "dimension" },
|
|
174
|
+
"button.large.height": { type: "dimension" },
|
|
175
|
+
"button.large.font.size": { type: "dimension" },
|
|
176
|
+
"button.large.font.tracking": {
|
|
177
|
+
type: "number",
|
|
178
|
+
unit: "em"
|
|
179
|
+
},
|
|
180
|
+
"button.xlarge.height": { type: "dimension" },
|
|
181
|
+
"button.xlarge.font.size": { type: "dimension" },
|
|
182
|
+
"button.xlarge.font.tracking": {
|
|
183
|
+
type: "number",
|
|
184
|
+
unit: "em"
|
|
185
|
+
},
|
|
186
|
+
"button.border.radius": { type: "dimension" },
|
|
187
|
+
"button.color.accent": { type: "color" },
|
|
188
|
+
"button.color.background": { type: "color" },
|
|
189
|
+
"button.color.foreground": { type: "color" },
|
|
190
|
+
"button.color.border": { type: "color" },
|
|
191
|
+
"button.color.shadow": { type: "color" },
|
|
192
|
+
"button.shadow": { type: "shadow" },
|
|
193
|
+
"button.hover.shadow": { type: "shadow" },
|
|
194
|
+
"button.hover.offset": { type: "dimension" },
|
|
195
|
+
"checkbox.border.radius": { type: "dimension" },
|
|
196
|
+
"radio.border.radius": { type: "dimension" },
|
|
197
|
+
"radio.color.background": { type: "color" },
|
|
198
|
+
"radio.color.border": { type: "color" },
|
|
199
|
+
"radio.color.shadow": { type: "color" },
|
|
200
|
+
"radio.checked.color.background": { type: "color" },
|
|
201
|
+
"radio.shadow": { type: "shadow" },
|
|
202
|
+
"radio.gap": { type: "dimension" },
|
|
203
|
+
"radio.button.gap": { type: "dimension" },
|
|
204
|
+
"status.border.radius": { type: "dimension" },
|
|
205
|
+
"status.color.background": { type: "color" },
|
|
206
|
+
"status.color.foreground": { type: "color" },
|
|
207
|
+
"status.color.accent": { type: "color" },
|
|
208
|
+
"status.color.border": { type: "color" },
|
|
209
|
+
"status.danger.color.accent": { type: "color" },
|
|
210
|
+
"status.danger.color.background": { type: "color" },
|
|
211
|
+
"status.danger.color.border": { type: "color" },
|
|
212
|
+
"status.success.color.accent": { type: "color" },
|
|
213
|
+
"status.success.color.background": { type: "color" },
|
|
214
|
+
"status.success.color.border": { type: "color" },
|
|
215
|
+
"status.warning.color.accent": { type: "color" },
|
|
216
|
+
"status.warning.color.background": { type: "color" },
|
|
217
|
+
"status.warning.color.border": { type: "color" },
|
|
218
|
+
"badge.height": { type: "dimension" },
|
|
219
|
+
"badge.font.size": { type: "dimension" },
|
|
220
|
+
"badge.font.weight": { type: "fontWeight" },
|
|
221
|
+
"badge.xsmall.height": { type: "dimension" },
|
|
222
|
+
"badge.xsmall.font.size": { type: "dimension" },
|
|
223
|
+
"badge.xsmall.font.weight": { type: "fontWeight" },
|
|
224
|
+
"badge.small.height": { type: "dimension" },
|
|
225
|
+
"badge.small.font.size": { type: "dimension" },
|
|
226
|
+
"badge.small.font.weight": { type: "fontWeight" },
|
|
227
|
+
"badge.large.height": { type: "dimension" },
|
|
228
|
+
"badge.large.font.size": { type: "dimension" },
|
|
229
|
+
"badge.xlarge.height": { type: "dimension" },
|
|
230
|
+
"badge.xlarge.font.size": { type: "dimension" },
|
|
231
|
+
"badge.color.background": { type: "color" },
|
|
232
|
+
"badge.color.foreground": { type: "color" },
|
|
233
|
+
"badge.color.border": { type: "color" },
|
|
234
|
+
"badge.color.accent": { type: "color" },
|
|
235
|
+
"chip.height": { type: "dimension" },
|
|
236
|
+
"chip.font.size": { type: "dimension" },
|
|
237
|
+
"chip.font.weight": { type: "fontWeight" },
|
|
238
|
+
"chip.font.tracking": {
|
|
239
|
+
type: "number",
|
|
240
|
+
unit: "em"
|
|
241
|
+
},
|
|
242
|
+
"chip.xsmall.height": { type: "dimension" },
|
|
243
|
+
"chip.xsmall.font.size": { type: "dimension" },
|
|
244
|
+
"chip.small.height": { type: "dimension" },
|
|
245
|
+
"chip.small.font.size": { type: "dimension" },
|
|
246
|
+
"chip.large.height": { type: "dimension" },
|
|
247
|
+
"chip.large.font.size": { type: "dimension" },
|
|
248
|
+
"chip.xlarge.height": { type: "dimension" },
|
|
249
|
+
"chip.xlarge.font.size": { type: "dimension" },
|
|
250
|
+
"chip.color.background": { type: "color" },
|
|
251
|
+
"chip.color.foreground": { type: "color" },
|
|
252
|
+
"chip.color.border": { type: "color" },
|
|
253
|
+
"chip.color.accent": { type: "color" },
|
|
254
|
+
"thumbnail.border.radius": { type: "dimension" },
|
|
255
|
+
"thumbnail.color.background": { type: "color" },
|
|
256
|
+
"thumbnail.color.foreground": { type: "color" },
|
|
257
|
+
"thumbnail.color.border": { type: "color" },
|
|
258
|
+
"thumbnail.font.weight": { type: "fontWeight" },
|
|
259
|
+
"card.border.radius": { type: "dimension" },
|
|
260
|
+
"card.color.background": { type: "color" },
|
|
261
|
+
"card.color.border": { type: "color" },
|
|
262
|
+
"tabs.border.radius": { type: "dimension" },
|
|
263
|
+
"tabs.indicator.width": { type: "dimension" },
|
|
264
|
+
"tabs.color.background": { type: "color" },
|
|
265
|
+
"tabs.color.shadow": { type: "color" },
|
|
266
|
+
"tabs.font.weight": { type: "fontWeight" },
|
|
267
|
+
"tabs.shadow": { type: "shadow" }
|
|
268
|
+
}, u = {
|
|
269
|
+
"field.appearance": {
|
|
270
|
+
values: [
|
|
271
|
+
"outline",
|
|
272
|
+
"filled",
|
|
273
|
+
"underline"
|
|
274
|
+
],
|
|
275
|
+
default: "outline"
|
|
276
|
+
},
|
|
277
|
+
"field.label.position": {
|
|
278
|
+
values: ["above", "floating"],
|
|
279
|
+
default: "floating"
|
|
280
|
+
},
|
|
281
|
+
"button.appearance": {
|
|
282
|
+
values: [
|
|
283
|
+
"filled",
|
|
284
|
+
"outline",
|
|
285
|
+
"plain"
|
|
286
|
+
],
|
|
287
|
+
default: "filled"
|
|
288
|
+
},
|
|
289
|
+
"button.secondary.appearance": {
|
|
290
|
+
values: [
|
|
291
|
+
"filled",
|
|
292
|
+
"outline",
|
|
293
|
+
"plain"
|
|
294
|
+
],
|
|
295
|
+
default: "outline"
|
|
296
|
+
},
|
|
297
|
+
"radio.appearance": {
|
|
298
|
+
values: ["plain", "outline"],
|
|
299
|
+
default: "plain"
|
|
300
|
+
},
|
|
301
|
+
"radio.indicator.position": {
|
|
302
|
+
values: ["start", "end"],
|
|
303
|
+
default: "start"
|
|
304
|
+
},
|
|
305
|
+
"status.appearance": {
|
|
306
|
+
values: [
|
|
307
|
+
"filled",
|
|
308
|
+
"outline",
|
|
309
|
+
"plain"
|
|
310
|
+
],
|
|
311
|
+
default: "filled"
|
|
312
|
+
},
|
|
313
|
+
"badge.appearance": {
|
|
314
|
+
values: ["filled", "outline"],
|
|
315
|
+
default: "outline"
|
|
316
|
+
},
|
|
317
|
+
"card.appearance": {
|
|
318
|
+
values: ["outline", "filled"],
|
|
319
|
+
default: "outline"
|
|
320
|
+
},
|
|
321
|
+
"tabs.appearance": {
|
|
322
|
+
values: ["underline", "segmented"],
|
|
323
|
+
default: "underline"
|
|
324
|
+
}
|
|
325
|
+
}, d = {
|
|
326
|
+
color: { variant: ["secondary"] },
|
|
327
|
+
font: { type: [
|
|
328
|
+
"caption",
|
|
329
|
+
"footnote",
|
|
330
|
+
"heading",
|
|
331
|
+
"medium",
|
|
332
|
+
"strong",
|
|
333
|
+
"bold"
|
|
334
|
+
] },
|
|
335
|
+
border: { type: ["strong"] },
|
|
336
|
+
focus: {},
|
|
337
|
+
motion: {},
|
|
338
|
+
control: { size: [
|
|
339
|
+
"xsmall",
|
|
340
|
+
"small",
|
|
341
|
+
"large",
|
|
342
|
+
"xlarge"
|
|
343
|
+
] },
|
|
344
|
+
field: {},
|
|
345
|
+
overlay: {},
|
|
346
|
+
text: { type: [
|
|
347
|
+
"title",
|
|
348
|
+
"heading",
|
|
349
|
+
"subheading",
|
|
350
|
+
"strong",
|
|
351
|
+
"caption",
|
|
352
|
+
"footnote",
|
|
353
|
+
"eyebrow"
|
|
354
|
+
] },
|
|
355
|
+
link: {},
|
|
356
|
+
button: { size: [
|
|
357
|
+
"xsmall",
|
|
358
|
+
"small",
|
|
359
|
+
"large",
|
|
360
|
+
"xlarge"
|
|
361
|
+
] },
|
|
362
|
+
checkbox: {},
|
|
363
|
+
radio: {},
|
|
364
|
+
status: { type: [
|
|
365
|
+
"danger",
|
|
366
|
+
"success",
|
|
367
|
+
"warning"
|
|
368
|
+
] },
|
|
369
|
+
badge: { size: [
|
|
370
|
+
"xsmall",
|
|
371
|
+
"small",
|
|
372
|
+
"large",
|
|
373
|
+
"xlarge"
|
|
374
|
+
] },
|
|
375
|
+
chip: { size: [
|
|
376
|
+
"xsmall",
|
|
377
|
+
"small",
|
|
378
|
+
"large",
|
|
379
|
+
"xlarge"
|
|
380
|
+
] },
|
|
381
|
+
thumbnail: {},
|
|
382
|
+
card: {},
|
|
383
|
+
tabs: {}
|
|
384
|
+
}, f = {
|
|
385
|
+
text: { accent: "var(--swell-text-color-accent, var(--swell-color-foreground))" },
|
|
386
|
+
link: { accent: "var(--swell-link-color-accent, var(--swell-color-accent))" },
|
|
387
|
+
button: {
|
|
388
|
+
accent: "var(--swell-button-color-accent, var(--swell-color-accent))",
|
|
389
|
+
background: "var(--swell-button-color-background, var(--swell-button-color-accent, var(--swell-color-accent)))",
|
|
390
|
+
foreground: "var(--swell-button-color-foreground, var(--swell-color-background))",
|
|
391
|
+
border: "var(--swell-button-color-border, var(--swell-button-color-accent, var(--swell-color-accent)))",
|
|
392
|
+
shadow: "var(--swell-button-color-shadow, light-dark(#3a66f599, #5b8cff99))"
|
|
393
|
+
},
|
|
394
|
+
badge: {
|
|
395
|
+
background: "var(--swell-badge-color-background, var(--swell-color-foreground))",
|
|
396
|
+
foreground: "var(--swell-badge-color-foreground, var(--swell-color-background))",
|
|
397
|
+
border: "var(--swell-badge-color-border, var(--swell-color-border))",
|
|
398
|
+
accent: "var(--swell-badge-color-accent, var(--swell-color-foreground))"
|
|
399
|
+
},
|
|
400
|
+
thumbnail: {
|
|
401
|
+
background: "var(--swell-thumbnail-color-background, var(--swell-color-accent))",
|
|
402
|
+
foreground: "var(--swell-thumbnail-color-foreground, var(--swell-color-background))",
|
|
403
|
+
border: "var(--swell-thumbnail-color-border, #00000000)"
|
|
404
|
+
}
|
|
405
|
+
}, p = (e) => typeof e == "object" && !!e && typeof e.light == "string" && typeof e.dark == "string", m = /[;{}!]|\/\*|\*\//, h = (e) => !m.test(e), g = RegExp(`^color\\.[a-z][a-z0-9-]*\\.(${t.join("|")})$`), _ = (e) => l[e] ?? (g.test(e) ? { type: "color" } : void 0);
|
|
406
|
+
function v(e, t) {
|
|
407
|
+
let n = _(e);
|
|
408
|
+
if (!n) return !1;
|
|
409
|
+
switch (n.type) {
|
|
410
|
+
case "color": return typeof t == "string" ? h(t) : p(t) && h(t.light) && h(t.dark);
|
|
411
|
+
case "fontFamily": return typeof t == "string" ? h(t) : Array.isArray(t) && t.every((e) => typeof e == "string" && h(e));
|
|
412
|
+
case "number": return typeof t == "number";
|
|
413
|
+
case "fontWeight": return typeof t == "number" || typeof t == "string" && h(t);
|
|
414
|
+
case "shadow": return typeof t == "string" && h(t) && !t.includes(",") && !/\binset\b/.test(t) && CSS.supports("box-shadow", `${t} red`);
|
|
415
|
+
default: return typeof t == "string" && h(t);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function y(e) {
|
|
419
|
+
return p(e) ? {
|
|
420
|
+
light: e.light,
|
|
421
|
+
dark: e.dark
|
|
422
|
+
} : Array.isArray(e) ? e.slice() : e;
|
|
423
|
+
}
|
|
424
|
+
function b(e, t) {
|
|
425
|
+
let n = _(e);
|
|
426
|
+
return n?.type === "color" && p(t) ? `light-dark(${t.light}, ${t.dark})` : n?.type === "fontFamily" && Array.isArray(t) ? t.map((e) => o(String(e))).join(", ") : n?.type === "number" && n.unit ? `${String(t)}${n.unit}` : (n?.type === "dimension" || n?.type === "duration") && /^\s*[+-]?0*\.?0+\s*$/.test(String(t)) ? n.type === "dimension" ? "0px" : "0ms" : String(t);
|
|
427
|
+
}
|
|
428
|
+
// src/runtime/sheet.ts
|
|
429
|
+
var x = t, S = /* @__PURE__ */ new Set([
|
|
430
|
+
"primary",
|
|
431
|
+
...x,
|
|
432
|
+
"ring",
|
|
433
|
+
"variant",
|
|
434
|
+
"size",
|
|
435
|
+
"type",
|
|
436
|
+
"state"
|
|
437
|
+
]), C = [
|
|
438
|
+
"light",
|
|
439
|
+
"dark",
|
|
440
|
+
"system"
|
|
441
|
+
], w = new Set([...Object.keys(l), ...Object.keys(u)].flatMap((e) => e.split(".").slice(1, -1).map((t, n, r) => [e.split(".")[0], ...r.slice(0, n + 1)].join(".")))), T = (e) => typeof e == "object" && !!e && !Array.isArray(e);
|
|
442
|
+
function E(e, t, n) {
|
|
443
|
+
let r = t.split("."), i = e.config;
|
|
444
|
+
for (let e of r.slice(0, -1)) i = i[e] ??= {};
|
|
445
|
+
i[r.at(-1)] = y(n);
|
|
446
|
+
}
|
|
447
|
+
function D(e, t) {
|
|
448
|
+
let n = {
|
|
449
|
+
tokens: /* @__PURE__ */ new Map(),
|
|
450
|
+
settings: /* @__PURE__ */ new Map(),
|
|
451
|
+
config: {},
|
|
452
|
+
warnings: [],
|
|
453
|
+
area: t,
|
|
454
|
+
variants: []
|
|
455
|
+
};
|
|
456
|
+
if (e == null) return n;
|
|
457
|
+
if (!T(e)) return n.warnings.push("Swell UI: the configuration is not an object"), n;
|
|
458
|
+
for (let [t, r] of Object.entries(e)) if (t === "theme") C.includes(r) ? (n.theme = r, E(n, t, r)) : n.warnings.push(`Swell UI: theme is ${JSON.stringify(r)}; it takes ${C.join(", ")}`);
|
|
459
|
+
else if (t === "components") for (let [e, t] of Object.entries(T(r) ? r : {})) c[e] === "components" ? O(n, e, t, `components.${e}`) : n.warnings.push(`Swell UI: unknown component components.${e} in the configuration`);
|
|
460
|
+
else c[t] === "global" ? O(n, t, r, t) : n.warnings.push(`Swell UI: unknown group ${t} in the configuration`);
|
|
461
|
+
return n;
|
|
462
|
+
}
|
|
463
|
+
function O(e, t, n, r) {
|
|
464
|
+
if (!T(n)) e.warnings.push(`Swell UI: ${r} is not an object`);
|
|
465
|
+
else for (let [i, a] of Object.entries(n)) k(e, `${t}.${i}`, a, `${r}.${i}`);
|
|
466
|
+
}
|
|
467
|
+
function k(e, t, n, r) {
|
|
468
|
+
let i = u[t];
|
|
469
|
+
if (i && e.area !== void 0) {
|
|
470
|
+
e.warnings.push(`Swell UI: ${r} is a setting, which applies to the whole page; the configuration of area ${JSON.stringify(e.area)} skips it`);
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
if (i) {
|
|
474
|
+
typeof n == "string" && i.values.includes(n) ? (e.settings.set(t, n), E(e, r, n)) : e.warnings.push(`Swell UI: ${r} is ${JSON.stringify(n)}; it takes ${i.values.join(", ")}`);
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
if (l[t]) {
|
|
478
|
+
let i = y(n);
|
|
479
|
+
v(t, i) ? (e.tokens.set(t, i), E(e, r, i)) : e.warnings.push(`Swell UI: ${r} takes a CSS value of its type without ; { } ! or comments, not ${JSON.stringify(n)}`);
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
if (T(n) && w.has(t)) {
|
|
483
|
+
for (let [i, a] of Object.entries(n)) k(e, `${t}.${i}`, a, `${r}.${i}`);
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
let [a, o, ...s] = t.split(".");
|
|
487
|
+
a === "color" && o && s.length === 0 && T(n) ? A(e, o, n, r) : e.warnings.push(`Swell UI: unknown key ${r} in the configuration`);
|
|
488
|
+
}
|
|
489
|
+
function A(e, t, r, i) {
|
|
490
|
+
if (!/^[a-z][a-z0-9-]*$/.test(t) || S.has(t)) {
|
|
491
|
+
e.warnings.push(`Swell UI: ${i} isn't a variant's name: a variant is a lowercase word other than ${[...S].join(", ")}; the configuration is keyed by token names`);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
let a = /* @__PURE__ */ new Map(), o = !0;
|
|
495
|
+
for (let [n, s] of Object.entries(r)) {
|
|
496
|
+
if (s === void 0) continue;
|
|
497
|
+
let r = `color.${t}.${n}`, c = y(s);
|
|
498
|
+
x.includes(n) ? v(r, c) ? a.set(r, c) : (e.warnings.push(`Swell UI: ${i}.${n} takes a color without ; { } ! or comments, not ${JSON.stringify(s)}`), o = !1) : (e.warnings.push(`Swell UI: ${i}.${n} is not a palette role; a variant holds ${x.join(", ")}`), o = !1);
|
|
499
|
+
}
|
|
500
|
+
let s = n.filter((e) => !a.has(`color.${t}.${e}`));
|
|
501
|
+
if (s.length > 0 && o && e.warnings.push(`Swell UI: ${i} is a variant without ${s.join(", ")}; a variant holds ${n.join(", ")}`), !(s.length > 0 || !o)) {
|
|
502
|
+
for (let [t, n] of a) e.tokens.set(t, n), E(e, `${i}.${t.split(".").at(-1)}`, n);
|
|
503
|
+
e.variants.push(t);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
var j = {
|
|
507
|
+
light: "light",
|
|
508
|
+
dark: "dark",
|
|
509
|
+
system: "light dark"
|
|
510
|
+
}, M = `@media (prefers-reduced-motion: reduce) { :root, swell-ui[config] { ${Object.entries(l).filter(([, e]) => e.type === "duration").map(([t]) => `${e(t)}: 0ms;`).join(" ")} } }`, N = [...s.matchAll(/(--swell-[\w-]+): (var\(.*\));/g)].map(([, e, t]) => [e, t]);
|
|
511
|
+
function P({ tokens: t, theme: n }) {
|
|
512
|
+
let r = n ? [`color-scheme: ${j[n]};`] : [];
|
|
513
|
+
for (let [n, i] of t) r.push(`${e(n)}: ${b(n, i)};`);
|
|
514
|
+
return r;
|
|
515
|
+
}
|
|
516
|
+
var F = (e, t) => `${e} {${t.length ? ` ${t.join(" ")} ` : ""}}`;
|
|
517
|
+
function I(t, n = /* @__PURE__ */ new Map()) {
|
|
518
|
+
let r = [F(":root", P(t)), "swell-ui:not([hidden]) { display: contents; }"];
|
|
519
|
+
for (let [i, a] of n) {
|
|
520
|
+
let n = new Set([...t.tokens.keys(), ...a.tokens.keys()].map(e)), o = N.filter(([e]) => !n.has(e)).map(([e, t]) => `${e}: ${t};`);
|
|
521
|
+
r.push(F(`swell-ui[config=${CSS.escape(i)}]`, [...P(a), ...o]));
|
|
522
|
+
}
|
|
523
|
+
return [...r, M].join("\n");
|
|
524
|
+
}
|
|
525
|
+
// src/runtime/config.ts
|
|
526
|
+
var L = Symbol.for("swell-ui.runtime"), R = "0.1.1";
|
|
527
|
+
function z() {
|
|
528
|
+
let e = getComputedStyle(document.documentElement).colorScheme, t = e.includes("dark");
|
|
529
|
+
return t && e.includes("light") ? "system" : t ? "dark" : "light";
|
|
530
|
+
}
|
|
531
|
+
function B() {
|
|
532
|
+
let e = D(void 0), t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = new CSSStyleSheet();
|
|
533
|
+
r.replaceSync(I(e));
|
|
534
|
+
function i() {
|
|
535
|
+
r.replaceSync(I(e, t));
|
|
536
|
+
for (let e of n) e();
|
|
537
|
+
}
|
|
538
|
+
return {
|
|
539
|
+
version: R,
|
|
540
|
+
configSheet: r,
|
|
541
|
+
configure(n, r) {
|
|
542
|
+
if (r !== void 0 && (typeof r != "string" || !r)) {
|
|
543
|
+
console.warn(`Swell UI: an area's id is a non-empty string, not ${JSON.stringify(r)}`);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
let a = D(n, r);
|
|
547
|
+
for (let e of a.warnings) console.warn(e);
|
|
548
|
+
r === void 0 ? e = a : n == null ? t.delete(r) : t.set(r, a), i();
|
|
549
|
+
},
|
|
550
|
+
setTheme(t) {
|
|
551
|
+
C.includes(t) ? (e = {
|
|
552
|
+
...e,
|
|
553
|
+
theme: t,
|
|
554
|
+
config: {
|
|
555
|
+
...e.config,
|
|
556
|
+
theme: t
|
|
557
|
+
}
|
|
558
|
+
}, i()) : console.warn(`Swell UI: unknown theme ${JSON.stringify(t)}; it takes ${C.join(", ")}`);
|
|
559
|
+
},
|
|
560
|
+
getConfig(n) {
|
|
561
|
+
if (n !== void 0) return structuredClone(t.get(n)?.config ?? {});
|
|
562
|
+
let r = structuredClone(e.config);
|
|
563
|
+
return {
|
|
564
|
+
...r,
|
|
565
|
+
theme: r.theme ?? z()
|
|
566
|
+
};
|
|
567
|
+
},
|
|
568
|
+
resolveSetting(t, n) {
|
|
569
|
+
let r = `${t}.${n}`;
|
|
570
|
+
return e.settings.get(r) ?? u[r]?.default;
|
|
571
|
+
},
|
|
572
|
+
onChange(e) {
|
|
573
|
+
return n.add(e), () => n.delete(e);
|
|
574
|
+
},
|
|
575
|
+
variants() {
|
|
576
|
+
return [...new Set([e, ...t.values()].flatMap((e) => e.variants))];
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
var V = new CSSStyleSheet();
|
|
581
|
+
V.replaceSync(`${s}\n${M}`);
|
|
582
|
+
var H = globalThis, U = H[L], W = U ?? B();
|
|
583
|
+
U ? (console.warn(`Swell UI ${R} loaded on a page that already has Swell UI ${U.version}: it takes that copy's configuration. Load the kit once per page.`), document.adoptedStyleSheets = [V, ...document.adoptedStyleSheets]) : (document.adoptedStyleSheets.push(V, W.configSheet), H[L] = W);
|
|
584
|
+
var G = W.version, K = W.configSheet, q = W.configure, J = W.setTheme, Y = W.getConfig, X = () => W.variants?.() ?? [], Z = W.onChange;
|
|
585
|
+
function Q(e, t) {
|
|
586
|
+
return W.resolveSetting(e, t) ?? u[`${e}.${t}`]?.default;
|
|
587
|
+
}
|
|
588
|
+
export { Z as a, G as c, f as d, r as f, X as i, d as l, i as m, q as n, Q as o, e as p, Y as r, J as s, K as t, u };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
|
+
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
+
let r = {};
|
|
4
|
+
for (var i in t) e(r, i, {
|
|
5
|
+
get: t[i],
|
|
6
|
+
enumerable: !0
|
|
7
|
+
});
|
|
8
|
+
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
+
};
|
|
10
|
+
// src/runtime/define.ts
|
|
11
|
+
function n(e, t) {
|
|
12
|
+
customElements.get(e) || customElements.define(e, t);
|
|
13
|
+
}
|
|
14
|
+
function r(e, t) {
|
|
15
|
+
if (!Object.hasOwn(e, t)) return;
|
|
16
|
+
let n = e, r = n[t];
|
|
17
|
+
delete n[t], n[t] = r;
|
|
18
|
+
}
|
|
19
|
+
export { r as n, t as r, n as t };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/runtime/description.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = document.createElement("div");
|
|
4
|
+
n.className = `${e}-hint`, n.id = `${t}-hint`;
|
|
5
|
+
let r = document.createElement("div");
|
|
6
|
+
return r.className = `${e}-error`, r.id = `${t}-error`, r.append(document.createElement("span")), {
|
|
7
|
+
hint: n,
|
|
8
|
+
error: r
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function t(e, t, { hint: n, error: r }, i) {
|
|
12
|
+
let a = e.hasAttribute("invalid");
|
|
13
|
+
n.textContent = i ? "" : e.getAttribute("hint") ?? "", n.hidden = !n.textContent;
|
|
14
|
+
let o = e.getAttribute("error") ?? "";
|
|
15
|
+
r.lastElementChild.textContent = o, r.hidden = !a || !o, a ? t.setAttribute("aria-invalid", "true") : t.removeAttribute("aria-invalid");
|
|
16
|
+
let s = [i?.id ?? (n.hidden ? "" : n.id), r.hidden ? "" : r.id].filter(Boolean).join(" ");
|
|
17
|
+
s ? t.setAttribute("aria-describedby", s) : t.removeAttribute("aria-describedby");
|
|
18
|
+
}
|
|
19
|
+
export { t as n, e as t };
|