@zazz-ui/core 0.15.1 → 0.16.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/AUTHORING.md +29 -14
- package/CHANGELOG.md +156 -0
- package/README.md +6 -5
- package/dist/{csp-LRx1fynI.js → csp-C1f62vyT.js} +1 -1
- package/dist/sri.json +70 -65
- package/dist/zazz.css +1 -1
- package/dist/zazz.js +1 -1
- package/editor/zazz.css-data.json +74 -2
- package/editor/zazz.html-data.json +119 -79
- package/editor/zazz.language-data.json +401 -313
- package/editor/zazz.lint-data.json +1752 -1731
- package/package.json +2 -1
- package/src/base/_defaults.css +11 -11
- package/src/base/_reset.css +2 -10
- package/src/base/_typography.css +17 -568
- package/src/base/_utilities-box.css +17 -17
- package/src/base/_utilities-pseudo.css +2 -2
- package/src/base/_variables.css +142 -97
- package/src/base/carousel-scroll.d.ts +1 -1
- package/src/base/carousel-scroll.js +6 -6
- package/src/base/carousel-scroll.ts +6 -6
- package/src/base/carousel.d.ts.map +1 -1
- package/src/base/carousel.js +6 -2
- package/src/base/carousel.ts +6 -2
- package/src/base/csp.js +2 -2
- package/src/base/csp.ts +2 -2
- package/src/base/kit-styling.d.ts.map +1 -1
- package/src/base/kit-styling.js +186 -183
- package/src/base/kit-styling.ts +186 -183
- package/src/base/navigation.d.ts +2 -2
- package/src/base/navigation.d.ts.map +1 -1
- package/src/base/navigation.js +25 -21
- package/src/base/navigation.ts +27 -21
- package/src/base/utilities.d.ts +1 -1
- package/src/base/utilities.d.ts.map +1 -1
- package/src/base/utilities.js +20 -4
- package/src/base/utilities.ts +21 -5
- package/src/base/zazz-element.d.ts +1 -1
- package/src/base/zazz-element.js +1 -1
- package/src/base/zazz-element.ts +1 -1
- package/src/{base → behaviors}/gesture.d.ts +4 -3
- package/src/behaviors/gesture.d.ts.map +1 -0
- package/src/{base → behaviors}/gesture.js +1 -1
- package/src/{base → behaviors}/gesture.ts +5 -4
- package/src/{base → behaviors}/hotkeys.d.ts +2 -1
- package/src/behaviors/hotkeys.d.ts.map +1 -0
- package/src/{base → behaviors}/hotkeys.ts +2 -1
- package/src/behaviors/list-navigation.d.ts +64 -0
- package/src/behaviors/list-navigation.d.ts.map +1 -0
- package/src/behaviors/list-navigation.js +66 -0
- package/src/behaviors/list-navigation.ts +107 -0
- package/src/{base → behaviors}/typeahead.d.ts +3 -1
- package/src/behaviors/typeahead.d.ts.map +1 -0
- package/src/{base → behaviors}/typeahead.js +12 -17
- package/src/{base → behaviors}/typeahead.ts +12 -17
- package/src/css-properties.json +704 -0
- package/src/index.css +7 -0
- package/src/manifest.d.ts +20 -9
- package/src/manifest.d.ts.map +1 -1
- package/src/manifest.js +125 -37
- package/src/manifest.ts +132 -38
- package/src/primitives/accordion/accordion.json +49 -0
- package/src/primitives/alert-dialog/alert-dialog.json +35 -0
- package/src/primitives/autocomplete/autocomplete.d.ts +2 -2
- package/src/primitives/autocomplete/autocomplete.d.ts.map +1 -1
- package/src/primitives/autocomplete/autocomplete.js +2 -2
- package/src/primitives/autocomplete/autocomplete.json +65 -0
- package/src/primitives/autocomplete/autocomplete.ts +2 -2
- package/src/primitives/avatar/avatar.css +108 -0
- package/src/primitives/avatar/avatar.html +20 -74
- package/src/primitives/avatar/avatar.json +48 -0
- package/src/primitives/badge/badge.css +45 -10
- package/src/primitives/badge/badge.html +4 -0
- package/src/primitives/badge/badge.json +83 -0
- package/src/primitives/breadcrumbs/breadcrumbs.json +20 -0
- package/src/primitives/button/button.css +50 -66
- package/src/primitives/button/button.html +4 -0
- package/src/primitives/button/button.json +85 -0
- package/src/primitives/button-group/button-group.css +4 -15
- package/src/primitives/button-group/button-group.json +40 -0
- package/src/primitives/callout/callout.css +1 -1
- package/src/primitives/callout/callout.html +12 -12
- package/src/primitives/callout/callout.json +54 -0
- package/src/primitives/card/card-article.html +13 -37
- package/src/primitives/card/card-horizontal.html +11 -14
- package/src/primitives/card/card-login.html +4 -4
- package/src/primitives/card/card-product.html +3 -3
- package/src/primitives/card/card-subgrid.html +4 -4
- package/src/primitives/card/card.css +1 -1
- package/src/primitives/card/card.html +8 -8
- package/src/primitives/card/card.json +73 -0
- package/src/primitives/carousel/carousel.css +1 -1
- package/src/primitives/carousel/carousel.json +89 -0
- package/src/primitives/checkbox/checkbox.css +1 -2
- package/src/primitives/checkbox/checkbox.json +51 -0
- package/src/primitives/combobox/combobox.css +3 -2
- package/src/primitives/combobox/combobox.d.ts +2 -2
- package/src/primitives/combobox/combobox.d.ts.map +1 -1
- package/src/primitives/combobox/combobox.js +2 -2
- package/src/primitives/combobox/combobox.json +113 -0
- package/src/primitives/combobox/combobox.ts +2 -2
- package/src/primitives/command/command-actions.html +1 -1
- package/src/primitives/command/command.d.ts +4 -3
- package/src/primitives/command/command.d.ts.map +1 -1
- package/src/primitives/command/command.js +7 -6
- package/src/primitives/command/command.json +86 -0
- package/src/primitives/command/command.ts +7 -6
- package/src/primitives/debug/audit-core.d.ts +19 -12
- package/src/primitives/debug/audit-core.d.ts.map +1 -1
- package/src/primitives/debug/audit-core.js +78 -16
- package/src/primitives/debug/audit-core.ts +94 -22
- package/src/primitives/debug/debug.d.ts +6 -4
- package/src/primitives/debug/debug.d.ts.map +1 -1
- package/src/primitives/debug/debug.js +50 -21
- package/src/primitives/debug/debug.json +29 -0
- package/src/primitives/debug/debug.ts +57 -35
- package/src/primitives/dialog/dialog.css +1 -4
- package/src/primitives/dialog/dialog.json +78 -0
- package/src/primitives/drawer/drawer.css +4 -2
- package/src/primitives/drawer/drawer.d.ts.map +1 -1
- package/src/primitives/drawer/drawer.js +76 -4
- package/src/primitives/drawer/drawer.json +98 -0
- package/src/primitives/drawer/drawer.ts +78 -5
- package/src/primitives/fields/fields.css +11 -4
- package/src/primitives/fields/fields.json +92 -0
- package/src/primitives/font/font.css +188 -0
- package/src/primitives/font/font.html +14 -0
- package/src/primitives/font/font.json +39 -0
- package/src/primitives/group/group.json +25 -0
- package/src/primitives/input/input.css +1 -2
- package/src/primitives/input/input.json +56 -0
- package/src/primitives/input-group/input-group-password-group.html +1 -1
- package/src/primitives/input-group/input-group.css +32 -3
- package/src/primitives/input-group/input-group.html +5 -8
- package/src/primitives/input-group/input-group.json +69 -0
- package/src/primitives/kbd/kbd.css +1 -1
- package/src/primitives/kbd/kbd.json +52 -0
- package/src/primitives/layout/layout.json +45 -0
- package/src/primitives/lightbox/lightbox.css +4 -3
- package/src/primitives/lightbox/lightbox.html +2 -2
- package/src/primitives/lightbox/lightbox.js +1 -1
- package/src/primitives/lightbox/lightbox.json +87 -0
- package/src/primitives/lightbox/lightbox.ts +1 -1
- package/src/primitives/link/link.css +28 -0
- package/src/primitives/link/link.html +5 -0
- package/src/primitives/link/link.json +23 -0
- package/src/primitives/menu/menu.d.ts +3 -0
- package/src/primitives/menu/menu.d.ts.map +1 -1
- package/src/primitives/menu/menu.js +10 -25
- package/src/primitives/menu/menu.json +51 -0
- package/src/primitives/menu/menu.ts +10 -27
- package/src/primitives/menubar/menubar.json +23 -0
- package/src/primitives/meter/meter.css +24 -3
- package/src/primitives/meter/meter.json +41 -0
- package/src/primitives/mobile-menu/mobile-menu.html +1 -1
- package/src/primitives/mobile-menu/mobile-menu.json +64 -0
- package/src/primitives/navigation-menu/navigation-menu-featured.html +58 -58
- package/src/primitives/navigation-menu/navigation-menu-megamenu.html +6 -113
- package/src/primitives/navigation-menu/navigation-menu.css +11 -5
- package/src/primitives/navigation-menu/navigation-menu.html +1 -1
- package/src/primitives/navigation-menu/navigation-menu.json +82 -0
- package/src/primitives/otp/otp.css +1 -1
- package/src/primitives/otp/otp.d.ts +3 -3
- package/src/primitives/otp/otp.js +5 -5
- package/src/primitives/otp/otp.json +75 -0
- package/src/primitives/otp/otp.ts +5 -5
- package/src/primitives/password-group/password-group.css +32 -2
- package/src/primitives/password-group/password-group.html +1 -1
- package/src/primitives/password-group/password-group.json +74 -0
- package/src/primitives/popover/popover.css +1 -1
- package/src/primitives/popover/popover.json +64 -0
- package/src/primitives/progress/progress.css +25 -3
- package/src/primitives/progress/progress.json +41 -0
- package/src/primitives/prose/prose.css +341 -0
- package/src/primitives/prose/prose.html +11 -11
- package/src/primitives/prose/prose.json +47 -0
- package/src/primitives/radio/radio.css +1 -1
- package/src/primitives/radio/radio.json +48 -0
- package/src/primitives/reveal/reveal.json +72 -0
- package/src/primitives/scroll-fade/scroll-fade.css +0 -3
- package/src/primitives/scroll-fade/scroll-fade.json +34 -0
- package/src/primitives/select/select.css +2 -2
- package/src/primitives/select/select.json +119 -0
- package/src/primitives/separator/separator.json +34 -0
- package/src/primitives/slider/slider.css +87 -13
- package/src/primitives/slider/slider.json +49 -0
- package/src/primitives/style-guard/style-guard.js +1 -1
- package/src/primitives/style-guard/style-guard.json +22 -0
- package/src/primitives/style-guard/style-guard.ts +2 -2
- package/src/primitives/switch/switch.css +107 -18
- package/src/primitives/switch/switch.json +71 -0
- package/src/primitives/table/table.json +74 -0
- package/src/primitives/tabs/tabs.css +24 -12
- package/src/primitives/tabs/tabs.d.ts +4 -2
- package/src/primitives/tabs/tabs.d.ts.map +1 -1
- package/src/primitives/tabs/tabs.js +14 -24
- package/src/primitives/tabs/tabs.json +94 -0
- package/src/primitives/tabs/tabs.ts +14 -26
- package/src/primitives/textarea/textarea.css +1 -1
- package/src/primitives/textarea/textarea.json +48 -0
- package/src/primitives/toaster/toaster.d.ts.map +1 -1
- package/src/primitives/toaster/toaster.js +4 -4
- package/src/primitives/toaster/toaster.json +101 -0
- package/src/primitives/toaster/toaster.ts +5 -5
- package/src/primitives/toggle/toggle.css +2 -52
- package/src/primitives/toggle/toggle.json +84 -0
- package/src/primitives/toggle-group/toggle-group.css +1 -1
- package/src/primitives/toggle-group/toggle-group.json +41 -0
- package/src/primitives/toolbar/toolbar.json +26 -0
- package/src/primitives/tooltip/tooltip.css +1 -1
- package/src/primitives/tooltip/tooltip.json +85 -0
- package/src/primitives/utilities/aspect-ratio.html +3 -3
- package/src/primitives/utilities/basis.html +5 -5
- package/src/primitives/utilities/col-span.html +5 -5
- package/src/primitives/utilities/compose.html +3 -3
- package/src/primitives/utilities/flex-align.html +3 -3
- package/src/primitives/utilities/flex-direction.html +8 -8
- package/src/primitives/utilities/flex-grow.html +3 -3
- package/src/primitives/utilities/flex-reverse.html +8 -8
- package/src/primitives/utilities/gallery.html +19 -19
- package/src/primitives/utilities/gap.html +12 -12
- package/src/primitives/utilities/grid-cols.html +6 -6
- package/src/primitives/utilities/grid-responsive.html +9 -9
- package/src/primitives/utilities/inline-flex.html +2 -2
- package/src/primitives/utilities/margin-auto.html +1 -1
- package/src/primitives/utilities/object-fit.html +3 -3
- package/src/primitives/utilities/order.html +3 -3
- package/src/primitives/utilities/overflow.html +14 -14
- package/src/primitives/utilities/padding-compose.html +3 -3
- package/src/primitives/utilities/padding.html +4 -4
- package/src/primitives/utilities/position.html +1 -1
- package/src/primitives/utilities/responsive-flex.html +4 -4
- package/src/primitives/utilities/responsive-grid.html +9 -9
- package/src/primitives/utilities/size.html +5 -5
- package/src/primitives/utilities/subgrid-col.html +7 -7
- package/src/primitives/utilities/subgrid-row.html +9 -9
- package/src/primitives/utilities/subgrid.html +9 -9
- package/src/primitives/utilities/utilities.json +48 -0
- package/src/primitives/utilities/width.html +5 -5
- package/src/base/gesture.d.ts.map +0 -1
- package/src/base/hotkeys.d.ts.map +0 -1
- package/src/base/typeahead.d.ts.map +0 -1
- /package/src/{base → behaviors}/command-score.d.ts +0 -0
- /package/src/{base → behaviors}/command-score.d.ts.map +0 -0
- /package/src/{base → behaviors}/command-score.js +0 -0
- /package/src/{base → behaviors}/command-score.ts +0 -0
- /package/src/{base → behaviors}/hotkeys.js +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "select",
|
|
3
|
+
"summary": "select.css: Select (:where([data-ui~=\"select\"]) on customizable <select>)",
|
|
4
|
+
"identities": [
|
|
5
|
+
"multiselect",
|
|
6
|
+
"select"
|
|
7
|
+
],
|
|
8
|
+
"tags": [
|
|
9
|
+
"ui-multiselect"
|
|
10
|
+
],
|
|
11
|
+
"hooks": {
|
|
12
|
+
"Layout & Positioning": {
|
|
13
|
+
"--ui-option-gap": "var(--ui-button-gap)",
|
|
14
|
+
"--ui-select-option-gap": "var(--ui-field-option-gap)"
|
|
15
|
+
},
|
|
16
|
+
"Box Model & Sizing": {
|
|
17
|
+
"--ui-option-checkmark-size": "var(--ui-field-icon-size)",
|
|
18
|
+
"--ui-option-icon-size": "var(--ui-button-icon-size)",
|
|
19
|
+
"--ui-option-min-h": "var(--ui-button-min-h)",
|
|
20
|
+
"--ui-option-px": "var(--ui-button-px)",
|
|
21
|
+
"--ui-option-py": "var(--ui-button-py)",
|
|
22
|
+
"--ui-select-min-w": "16ch",
|
|
23
|
+
"--ui-select-picker-icon-size": "var(--ui-field-icon-size)",
|
|
24
|
+
"--ui-select-pl": "var(--ui-field-px)",
|
|
25
|
+
"--ui-select-pr": "calc(var(--spacing) * 2)",
|
|
26
|
+
"--ui-select-py": "var(--ui-field-py)",
|
|
27
|
+
"--ui-select-w": "100%"
|
|
28
|
+
},
|
|
29
|
+
"Typography": {
|
|
30
|
+
"--ui-option-font-family": "var(--ui-button-font-family)",
|
|
31
|
+
"--ui-option-font-size": "var(--ui-button-font-size)",
|
|
32
|
+
"--ui-option-font-weight": "var(--ui-button-font-weight)",
|
|
33
|
+
"--ui-option-leading": "var(--ui-button-leading)",
|
|
34
|
+
"--ui-select-font-size": "var(--ui-field-font-size)",
|
|
35
|
+
"--ui-select-leading": "var(--ui-field-leading)"
|
|
36
|
+
},
|
|
37
|
+
"Color & Backgrounds": {
|
|
38
|
+
"--ui-option-bg": "transparent",
|
|
39
|
+
"--ui-option-bg--active": "var(--ui-button-bg--active)",
|
|
40
|
+
"--ui-option-bg--hover": "var(--ui-button-bg--hover)",
|
|
41
|
+
"--ui-option-checkmark-color": "currentColor",
|
|
42
|
+
"--ui-option-text": "var(--ui-button-text)",
|
|
43
|
+
"--ui-option-text--active": "var(--ui-button-text--active)",
|
|
44
|
+
"--ui-option-text--hover": "var(--ui-button-text--hover)",
|
|
45
|
+
"--ui-select-picker-icon-color": "currentColor"
|
|
46
|
+
},
|
|
47
|
+
"Borders & Outlines": {
|
|
48
|
+
"--ui-option-border-color": "transparent",
|
|
49
|
+
"--ui-option-border-color--active": "transparent",
|
|
50
|
+
"--ui-option-border-color--hover": "transparent",
|
|
51
|
+
"--ui-option-border-style": "var(--ui-button-border-style)",
|
|
52
|
+
"--ui-option-border-width": "var(--ui-button-border-width)",
|
|
53
|
+
"--ui-option-corner-shape": "var(--ui-menu-button-corner-shape)",
|
|
54
|
+
"--ui-option-radius": "var(--ui-menu-button-radius)",
|
|
55
|
+
"--ui-select-border-color": "var(--ui-field-border-color)",
|
|
56
|
+
"--ui-select-border-style": "var(--ui-field-border-style)",
|
|
57
|
+
"--ui-select-border-width": "var(--ui-field-border-width)",
|
|
58
|
+
"--ui-select-corner-shape": "var(--ui-field-corner-shape)",
|
|
59
|
+
"--ui-select-radius": "var(--ui-field-radius)"
|
|
60
|
+
},
|
|
61
|
+
"Visual Effects": {
|
|
62
|
+
"--ui-option-checkmark-mask": "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Crect width='256' height='256' fill='none'/%3E%3Cpolyline points='40 144 96 200 224 72' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3C/svg%3E\")",
|
|
63
|
+
"--ui-option-shadow": "none",
|
|
64
|
+
"--ui-select-picker-icon-mask": "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Crect width='256' height='256' fill='none'/%3E%3Cpolyline points='80 176 128 224 176 176' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3Cpolyline points='80 80 128 32 176 80' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='16'/%3E%3C/svg%3E\")"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"attributes": {
|
|
68
|
+
"data-multiselect-align": [],
|
|
69
|
+
"data-multiselect-label-more": [],
|
|
70
|
+
"data-multiselect-placeholder": [],
|
|
71
|
+
"data-multiselect-side": [],
|
|
72
|
+
"data-select-align": [
|
|
73
|
+
"center",
|
|
74
|
+
"end",
|
|
75
|
+
"start"
|
|
76
|
+
],
|
|
77
|
+
"data-select-side": [
|
|
78
|
+
"bottom",
|
|
79
|
+
"left",
|
|
80
|
+
"right",
|
|
81
|
+
"top"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"slots": {
|
|
85
|
+
"data-multiselect-slot": [
|
|
86
|
+
"icon",
|
|
87
|
+
"label",
|
|
88
|
+
"option",
|
|
89
|
+
"panel",
|
|
90
|
+
"trigger"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"states": {
|
|
94
|
+
"data-multiselect-state": [
|
|
95
|
+
"enhanced"
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"requires": [
|
|
99
|
+
"fields",
|
|
100
|
+
"popover",
|
|
101
|
+
"button",
|
|
102
|
+
"menu"
|
|
103
|
+
],
|
|
104
|
+
"files": {
|
|
105
|
+
"css": [
|
|
106
|
+
"primitives/select/select.css"
|
|
107
|
+
],
|
|
108
|
+
"js": [
|
|
109
|
+
"primitives/select/multiselect.js"
|
|
110
|
+
],
|
|
111
|
+
"base": [],
|
|
112
|
+
"examples": [
|
|
113
|
+
"primitives/select/select.html",
|
|
114
|
+
"primitives/select/select-align.html",
|
|
115
|
+
"primitives/select/select-sides.html",
|
|
116
|
+
"primitives/select/select-multiple.html"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "separator",
|
|
3
|
+
"summary": "separator.css: Separator ([data-ui~=\"separator\"] on native <hr>)",
|
|
4
|
+
"identities": [
|
|
5
|
+
"separator"
|
|
6
|
+
],
|
|
7
|
+
"tags": [],
|
|
8
|
+
"hooks": {
|
|
9
|
+
"Box Model & Sizing": {
|
|
10
|
+
"--ui-separator-thickness": "1px"
|
|
11
|
+
},
|
|
12
|
+
"Color & Backgrounds": {
|
|
13
|
+
"--ui-separator-bg": "var(--color-border)"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"attributes": {
|
|
17
|
+
"data-separator-orientation": [
|
|
18
|
+
"vertical"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"slots": {},
|
|
22
|
+
"states": {},
|
|
23
|
+
"requires": [],
|
|
24
|
+
"files": {
|
|
25
|
+
"css": [
|
|
26
|
+
"primitives/separator/separator.css"
|
|
27
|
+
],
|
|
28
|
+
"js": [],
|
|
29
|
+
"base": [],
|
|
30
|
+
"examples": [
|
|
31
|
+
"primitives/separator/separator.html"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
* border and ring draw inset, it loses its drop shadow, and the visible thumb
|
|
11
11
|
* stops a border's width short of each track end.
|
|
12
12
|
* @uses sign(): switches the ring inset once the thumb has a hit border
|
|
13
|
-
* @uses corner-shape —
|
|
13
|
+
* @uses corner-shape — the track and thumb follow the field shape. A concave shape at a
|
|
14
|
+
* full radius empties a circle, and CSS can't read the number in superellipse(), so
|
|
15
|
+
* each part keeps a convex shape from this list (round, squircle, square,
|
|
16
|
+
* superellipse(1 | 1.3 | 2 | infinity)) and draws anything else round; the check is an
|
|
17
|
+
* if(). Only Chromium and Safari draw corner-shape, and both support if(); where if()
|
|
18
|
+
* is missing the private is invalid and its round fallback draws. The
|
|
19
|
+
* --corner-shape utility on the input still sets any shape on the track.
|
|
14
20
|
* @uses the track fill: ::-moz-range-progress in Firefox. Chromium and Safari have no
|
|
15
21
|
* progress part, so a view timeline on the thumb (view-timeline + timeline-scope)
|
|
16
22
|
* animates --_slider-progress on the track, which paints the fill as a gradient.
|
|
@@ -35,11 +41,11 @@
|
|
|
35
41
|
--ui-slider-ring-color: var(--color-ring);
|
|
36
42
|
|
|
37
43
|
--ui-slider-track-h: max(calc(var(--spacing) * 1.5), calc(var(--spacing-control-min) * 0.375));
|
|
38
|
-
--ui-slider-track-bg: var(--
|
|
44
|
+
--ui-slider-track-bg: var(--color-muted);
|
|
39
45
|
--ui-slider-track-border-width: var(--ui-field-border-width);
|
|
40
|
-
--ui-slider-track-border-color:
|
|
46
|
+
--ui-slider-track-border-color: transparent;
|
|
41
47
|
--ui-slider-track-radius: var(--radius-full);
|
|
42
|
-
--ui-slider-track-corner-shape:
|
|
48
|
+
--ui-slider-track-corner-shape: var(--ui-field-corner-shape);
|
|
43
49
|
/* the part of the track between its start and the thumb; `end` fills from the thumb
|
|
44
50
|
to the end of the track instead */
|
|
45
51
|
--ui-slider-fill-bg: var(--color-primary);
|
|
@@ -54,7 +60,7 @@
|
|
|
54
60
|
--ui-slider-thumb-border-width: 1px;
|
|
55
61
|
--ui-slider-thumb-border-color: var(--ui-field-border-color);
|
|
56
62
|
--ui-slider-thumb-radius: var(--radius-full);
|
|
57
|
-
--ui-slider-thumb-corner-shape:
|
|
63
|
+
--ui-slider-thumb-corner-shape: var(--ui-field-corner-shape);
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
|
@@ -63,30 +69,68 @@
|
|
|
63
69
|
syntax: "*";
|
|
64
70
|
inherits: true;
|
|
65
71
|
}
|
|
72
|
+
|
|
66
73
|
@property --_slider-thumb-in {
|
|
67
74
|
syntax: "*";
|
|
68
75
|
inherits: true;
|
|
69
76
|
}
|
|
77
|
+
|
|
70
78
|
@property --_slider-thumb-drop {
|
|
71
79
|
syntax: "*";
|
|
72
80
|
inherits: true;
|
|
73
81
|
}
|
|
82
|
+
|
|
74
83
|
@property --_slider-thumb-box {
|
|
75
84
|
syntax: "*";
|
|
76
85
|
inherits: true;
|
|
77
86
|
}
|
|
87
|
+
|
|
88
|
+
@property --_slider-thumb-corner-shape {
|
|
89
|
+
syntax: "*";
|
|
90
|
+
inherits: false;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@property --_slider-track-corner-shape {
|
|
94
|
+
syntax: "*";
|
|
95
|
+
inherits: false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* The shapes before and after the floor; the floored ones reach the parts by inheritance */
|
|
99
|
+
@property --_slider-thumb-shape-raw {
|
|
100
|
+
syntax: "*";
|
|
101
|
+
inherits: false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@property --_slider-track-shape-raw {
|
|
105
|
+
syntax: "*";
|
|
106
|
+
inherits: false;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@property --_slider-thumb-shape {
|
|
110
|
+
syntax: "*";
|
|
111
|
+
inherits: true;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@property --_slider-track-shape {
|
|
115
|
+
syntax: "*";
|
|
116
|
+
inherits: true;
|
|
117
|
+
}
|
|
118
|
+
|
|
78
119
|
@property --_slider-bleed {
|
|
79
120
|
syntax: "*";
|
|
80
121
|
inherits: true;
|
|
81
122
|
}
|
|
123
|
+
|
|
82
124
|
@property --_slider-fill-before {
|
|
83
125
|
syntax: "*";
|
|
84
126
|
inherits: true;
|
|
85
127
|
}
|
|
128
|
+
|
|
86
129
|
@property --_slider-fill-after {
|
|
87
130
|
syntax: "*";
|
|
88
131
|
inherits: true;
|
|
89
132
|
}
|
|
133
|
+
|
|
90
134
|
/* 0 with the thumb at the start, 1 at the end; registered so the timeline can animate it */
|
|
91
135
|
@property --_slider-progress {
|
|
92
136
|
syntax: "<number>";
|
|
@@ -118,6 +162,38 @@
|
|
|
118
162
|
--_slider-bleed: calc(
|
|
119
163
|
(var(--ring-offset-width) + var(--ring-width)) * (1 - var(--_slider-thumb-in))
|
|
120
164
|
);
|
|
165
|
+
/* the shapes, floored: a convex shape the list names, or round (see the header).
|
|
166
|
+
Read as var(…, round): WebKit drops a registered "*" property read with no fallback
|
|
167
|
+
in corner-shape */
|
|
168
|
+
--_slider-track-shape-raw: var(
|
|
169
|
+
--_slider-track-corner-shape,
|
|
170
|
+
var(--ui-slider-track-corner-shape)
|
|
171
|
+
);
|
|
172
|
+
--_slider-thumb-shape-raw: var(
|
|
173
|
+
--_slider-thumb-corner-shape,
|
|
174
|
+
var(--ui-slider-thumb-corner-shape)
|
|
175
|
+
);
|
|
176
|
+
--_slider-track-shape: var(
|
|
177
|
+
--_corner-shape-resolved,
|
|
178
|
+
if(
|
|
179
|
+
style(--_slider-track-shape-raw: round) or style(--_slider-track-shape-raw: squircle) or
|
|
180
|
+
style(--_slider-track-shape-raw: square) or
|
|
181
|
+
style(--_slider-track-shape-raw: superellipse(1)) or
|
|
182
|
+
style(--_slider-track-shape-raw: superellipse(1.3)) or
|
|
183
|
+
style(--_slider-track-shape-raw: superellipse(2)) or
|
|
184
|
+
style(--_slider-track-shape-raw: superellipse(infinity)): var(--_slider-track-shape-raw);
|
|
185
|
+
else: round
|
|
186
|
+
)
|
|
187
|
+
);
|
|
188
|
+
--_slider-thumb-shape: if(
|
|
189
|
+
style(--_slider-thumb-shape-raw: round) or style(--_slider-thumb-shape-raw: squircle) or
|
|
190
|
+
style(--_slider-thumb-shape-raw: square) or
|
|
191
|
+
style(--_slider-thumb-shape-raw: superellipse(1)) or
|
|
192
|
+
style(--_slider-thumb-shape-raw: superellipse(1.3)) or
|
|
193
|
+
style(--_slider-thumb-shape-raw: superellipse(2)) or
|
|
194
|
+
style(--_slider-thumb-shape-raw: superellipse(infinity)): var(--_slider-thumb-shape-raw);
|
|
195
|
+
else: round
|
|
196
|
+
);
|
|
121
197
|
/* the fill: from the start to the thumb, or from the thumb to the end */
|
|
122
198
|
--_slider-fill-before: var(--ui-slider-fill-bg);
|
|
123
199
|
--_slider-fill-after: transparent;
|
|
@@ -132,14 +208,13 @@
|
|
|
132
208
|
--_ring-width: 0px;
|
|
133
209
|
--_ring-fill: color-mix(in oklch, var(--ui-slider-ring-color) var(--ring-opacity), transparent);
|
|
134
210
|
|
|
135
|
-
-webkit-appearance: none;
|
|
136
211
|
appearance: none;
|
|
137
212
|
inline-size: 100%;
|
|
138
213
|
min-block-size: var(--_touch-min);
|
|
139
214
|
background: transparent;
|
|
140
215
|
cursor: grab;
|
|
141
216
|
border-radius: var(--ui-slider-track-radius);
|
|
142
|
-
corner-shape: var(--
|
|
217
|
+
corner-shape: var(--_slider-track-shape, round);
|
|
143
218
|
|
|
144
219
|
/* transparent outline keeps focus visible in forced-colors / high-contrast
|
|
145
220
|
modes; the visible focus ring lives on the thumb */
|
|
@@ -225,7 +300,7 @@
|
|
|
225
300
|
var(--ui-slider-track-bg);
|
|
226
301
|
border: var(--ui-slider-track-border-width) solid var(--ui-slider-track-border-color);
|
|
227
302
|
border-radius: var(--ui-slider-track-radius);
|
|
228
|
-
corner-shape: var(--
|
|
303
|
+
corner-shape: var(--_slider-track-shape, round);
|
|
229
304
|
}
|
|
230
305
|
|
|
231
306
|
/* Without a view timeline the progress never moves off 0, so the track stays plain */
|
|
@@ -241,11 +316,10 @@
|
|
|
241
316
|
background: var(--ui-slider-track-bg);
|
|
242
317
|
border: var(--ui-slider-track-border-width) solid var(--ui-slider-track-border-color);
|
|
243
318
|
border-radius: var(--ui-slider-track-radius);
|
|
244
|
-
corner-shape: var(--
|
|
319
|
+
corner-shape: var(--_slider-track-shape, round);
|
|
245
320
|
}
|
|
246
321
|
|
|
247
322
|
:where(input[type="range"])::-webkit-slider-thumb {
|
|
248
|
-
-webkit-appearance: none;
|
|
249
323
|
appearance: none;
|
|
250
324
|
margin-block-start: var(--ui-slider-thumb-offset);
|
|
251
325
|
box-sizing: content-box;
|
|
@@ -256,7 +330,7 @@
|
|
|
256
330
|
background-color: var(--ui-slider-thumb-bg);
|
|
257
331
|
background-clip: padding-box;
|
|
258
332
|
border-radius: calc(var(--ui-slider-thumb-radius) + var(--_slider-thumb-hit));
|
|
259
|
-
corner-shape: var(--
|
|
333
|
+
corner-shape: var(--_slider-thumb-shape, round);
|
|
260
334
|
/* the visible border, then the ring outside the thumb (or inside it once the box has
|
|
261
335
|
grown), then the drop shadow */
|
|
262
336
|
box-shadow:
|
|
@@ -279,7 +353,7 @@
|
|
|
279
353
|
block-size: var(--ui-slider-track-h);
|
|
280
354
|
background: var(--ui-slider-fill-bg);
|
|
281
355
|
border-radius: var(--ui-slider-track-radius);
|
|
282
|
-
corner-shape: var(--
|
|
356
|
+
corner-shape: var(--_slider-track-shape, round);
|
|
283
357
|
}
|
|
284
358
|
|
|
285
359
|
:where(input[type="range"])::-moz-range-thumb {
|
|
@@ -292,7 +366,7 @@
|
|
|
292
366
|
background-color: var(--ui-slider-thumb-bg);
|
|
293
367
|
background-clip: padding-box;
|
|
294
368
|
border-radius: calc(var(--ui-slider-thumb-radius) + var(--_slider-thumb-hit));
|
|
295
|
-
corner-shape: var(--
|
|
369
|
+
corner-shape: var(--_slider-thumb-shape, round);
|
|
296
370
|
/* the visible border, then the ring outside the thumb (or inside it once the box has
|
|
297
371
|
grown), then the drop shadow */
|
|
298
372
|
box-shadow:
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "slider",
|
|
3
|
+
"summary": "slider.css — Range input (input[type=\"range\"])",
|
|
4
|
+
"identities": [],
|
|
5
|
+
"tags": [],
|
|
6
|
+
"hooks": {
|
|
7
|
+
"Layout & Positioning": {
|
|
8
|
+
"--ui-slider-thumb-offset": "calc( (var(--ui-slider-track-h) - var(--ui-slider-thumb-size)) / 2 - var(--_slider-thumb-hit) - var(--ui-slider-track-border-width) )"
|
|
9
|
+
},
|
|
10
|
+
"Box Model & Sizing": {
|
|
11
|
+
"--ui-slider-thumb-size": "max(calc(var(--spacing) * 4), var(--spacing-control-min))",
|
|
12
|
+
"--ui-slider-track-h": "max(calc(var(--spacing) * 1.5), calc(var(--spacing-control-min) * 0.375))"
|
|
13
|
+
},
|
|
14
|
+
"Color & Backgrounds": {
|
|
15
|
+
"--ui-slider-fill-bg": "var(--color-primary)",
|
|
16
|
+
"--ui-slider-fill-side": "start",
|
|
17
|
+
"--ui-slider-thumb-bg": "var(--color-primary)",
|
|
18
|
+
"--ui-slider-track-bg": "var(--color-muted)"
|
|
19
|
+
},
|
|
20
|
+
"Borders & Outlines": {
|
|
21
|
+
"--ui-slider-thumb-border-color": "var(--ui-field-border-color)",
|
|
22
|
+
"--ui-slider-thumb-border-width": "1px",
|
|
23
|
+
"--ui-slider-thumb-corner-shape": "var(--ui-field-corner-shape)",
|
|
24
|
+
"--ui-slider-thumb-radius": "var(--radius-full)",
|
|
25
|
+
"--ui-slider-track-border-color": "transparent",
|
|
26
|
+
"--ui-slider-track-border-width": "var(--ui-field-border-width)",
|
|
27
|
+
"--ui-slider-track-corner-shape": "var(--ui-field-corner-shape)",
|
|
28
|
+
"--ui-slider-track-radius": "var(--radius-full)"
|
|
29
|
+
},
|
|
30
|
+
"Visual Effects": {
|
|
31
|
+
"--ui-slider-ring-color": "var(--color-ring)",
|
|
32
|
+
"--ui-slider-thumb-shadow": "var(--shadow-xs)"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"attributes": {},
|
|
36
|
+
"slots": {},
|
|
37
|
+
"states": {},
|
|
38
|
+
"requires": [],
|
|
39
|
+
"files": {
|
|
40
|
+
"css": [
|
|
41
|
+
"primitives/slider/slider.css"
|
|
42
|
+
],
|
|
43
|
+
"js": [],
|
|
44
|
+
"base": [],
|
|
45
|
+
"examples": [
|
|
46
|
+
"primitives/slider/slider.html"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -43,7 +43,7 @@ function rawOf(text) {
|
|
|
43
43
|
.join(";");
|
|
44
44
|
}
|
|
45
45
|
function isGuarded(el) {
|
|
46
|
-
return el instanceof Element && "style" in el && el.getAttribute("data-
|
|
46
|
+
return el instanceof Element && "style" in el && el.getAttribute("data-style-guard") !== "off";
|
|
47
47
|
}
|
|
48
48
|
let observer = null;
|
|
49
49
|
let guardedRoot = null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "style-guard",
|
|
3
|
+
"identities": [],
|
|
4
|
+
"tags": [],
|
|
5
|
+
"hooks": {},
|
|
6
|
+
"attributes": {
|
|
7
|
+
"data-style-guard": [
|
|
8
|
+
"off"
|
|
9
|
+
]
|
|
10
|
+
},
|
|
11
|
+
"slots": {},
|
|
12
|
+
"states": {},
|
|
13
|
+
"requires": [],
|
|
14
|
+
"files": {
|
|
15
|
+
"css": [],
|
|
16
|
+
"js": [
|
|
17
|
+
"primitives/style-guard/style-guard.js"
|
|
18
|
+
],
|
|
19
|
+
"base": [],
|
|
20
|
+
"examples": []
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* jQuery `.attr('style', …)` signature. A single `removeProperty('--p')` is a
|
|
9
9
|
* choice and stays removed (with a single utility, "all" and "one" coincide: the guard
|
|
10
10
|
* tells them apart by whether the other declarations survived the write).
|
|
11
|
-
* `data-
|
|
11
|
+
* `data-style-guard="off"` opts an element out. A template
|
|
12
12
|
* that emits two `style` attributes cannot be repaired (the parser keeps the
|
|
13
13
|
* first); that is an authoring error.
|
|
14
14
|
* @example
|
|
@@ -66,7 +66,7 @@ function rawOf(text: string | null): string {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function isGuarded(el: Node): el is Styled {
|
|
69
|
-
return el instanceof Element && "style" in el && el.getAttribute("data-
|
|
69
|
+
return el instanceof Element && "style" in el && el.getAttribute("data-style-guard") !== "off";
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
let observer: MutationObserver | null = null;
|
|
@@ -8,13 +8,26 @@
|
|
|
8
8
|
* on the input, centred on it, is at least the touch floor square
|
|
9
9
|
* @uses label:has(> input[role="switch"])::after — thumb drawn on label (no JS)
|
|
10
10
|
* @uses oklch(from …) — checked/hover track tints
|
|
11
|
-
* @uses corner-shape —
|
|
11
|
+
* @uses corner-shape — the track and thumb follow the field shape. A concave shape at a
|
|
12
|
+
* full radius empties a circle, and CSS can't read the number in superellipse(), so
|
|
13
|
+
* each part keeps a convex shape from this list (round, squircle, square,
|
|
14
|
+
* superellipse(1 | 1.3 | 2 | infinity)) and draws anything else round; the check is an
|
|
15
|
+
* if(). Only Chromium and Safari draw corner-shape, and both support if(); where if()
|
|
16
|
+
* is missing the private is invalid and its round fallback draws. The
|
|
17
|
+
* --corner-shape utility still sets any shape on the track.
|
|
12
18
|
* @tokens --ui-switch-* (@layer variables; consumed in @layer reset; border and
|
|
13
|
-
* ring default to the --ui-field-* family
|
|
19
|
+
* ring default to the --ui-field-* family; --ui-switch-w-coefficient and
|
|
20
|
+
* --ui-switch-h-coefficient stretch the track and thumb together)
|
|
14
21
|
*/
|
|
15
22
|
|
|
16
23
|
@layer variables {
|
|
17
24
|
:root {
|
|
25
|
+
/* stretch the switch along one axis: the track scales by it and the thumb grows
|
|
26
|
+
with it, so the gap around the thumb stays the same. Read in the rules below,
|
|
27
|
+
so they work on any element, not only :root */
|
|
28
|
+
--ui-switch-w-coefficient: 1;
|
|
29
|
+
--ui-switch-h-coefficient: 1;
|
|
30
|
+
|
|
18
31
|
/* floored so the track stays at least --spacing-control-min tall */
|
|
19
32
|
--ui-switch-track-w: max(calc(var(--spacing) * 7), calc(var(--spacing-control-min) * 1.75));
|
|
20
33
|
--ui-switch-track-p: max(calc(var(--spacing) * 0.5), calc(var(--spacing-control-min) * 0.125));
|
|
@@ -28,14 +41,19 @@
|
|
|
28
41
|
--ui-switch-thumb-border-style: var(--ui-field-border-style);
|
|
29
42
|
--ui-switch-thumb-border-color: var(--ui-field-border-color);
|
|
30
43
|
--ui-switch-thumb-border-color--hover: var(--ui-field-border-color--hover);
|
|
31
|
-
--ui-switch-thumb-border-color--checked:
|
|
32
|
-
--ui-switch-thumb-border-color--checked-hover:
|
|
44
|
+
--ui-switch-thumb-border-color--checked: transparent;
|
|
45
|
+
--ui-switch-thumb-border-color--checked-hover: transparent;
|
|
33
46
|
/* the thumb is content-box: its border sits outside this size, so take it back out
|
|
34
|
-
and the gap around the thumb is the same on every side
|
|
35
|
-
|
|
47
|
+
and the gap around the thumb is the same on every side. Half the track wide and
|
|
48
|
+
the track's height tall, so with the default track it's a circle */
|
|
49
|
+
--ui-switch-thumb-w: calc(
|
|
36
50
|
(var(--ui-switch-track-w) / 2) - var(--ui-switch-track-p) -
|
|
37
51
|
var(--ui-switch-thumb-border-width)
|
|
38
52
|
);
|
|
53
|
+
--ui-switch-thumb-h: calc(
|
|
54
|
+
var(--ui-switch-track-h) - 2 * var(--ui-switch-track-p) - 2 *
|
|
55
|
+
var(--ui-switch-thumb-border-width)
|
|
56
|
+
);
|
|
39
57
|
--ui-switch-thumb-shadow: var(--shadow-xs);
|
|
40
58
|
--ui-switch-thumb-translate: var(--ui-switch-track-p), -50%;
|
|
41
59
|
--ui-switch-thumb-scale: 1;
|
|
@@ -53,7 +71,7 @@
|
|
|
53
71
|
|
|
54
72
|
/* dual-mode hooks: a scale number or a length */
|
|
55
73
|
--ui-switch-radius: var(--radius-full);
|
|
56
|
-
--ui-switch-corner-shape:
|
|
74
|
+
--ui-switch-corner-shape: var(--ui-field-corner-shape);
|
|
57
75
|
--ui-switch-track-radius: var(--ui-switch-radius);
|
|
58
76
|
--ui-switch-track-corner-shape: var(--ui-switch-corner-shape);
|
|
59
77
|
--ui-switch-thumb-radius: var(--ui-switch-radius);
|
|
@@ -63,6 +81,40 @@
|
|
|
63
81
|
}
|
|
64
82
|
}
|
|
65
83
|
|
|
84
|
+
/* Each part's hook shape, floored (see the header). Read as var(…, round): WebKit drops a
|
|
85
|
+
registered "*" property read with no fallback in corner-shape. */
|
|
86
|
+
@property --_switch-track-shape {
|
|
87
|
+
syntax: "*";
|
|
88
|
+
inherits: false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@property --_switch-thumb-shape {
|
|
92
|
+
syntax: "*";
|
|
93
|
+
inherits: false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* The coefficient sizes: the track's (--_switch-w/-h) and how much they grow the
|
|
97
|
+
thumb (--_switch-grow-w/-h). Each is set and read on the same element. */
|
|
98
|
+
@property --_switch-w {
|
|
99
|
+
syntax: "*";
|
|
100
|
+
inherits: false;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@property --_switch-h {
|
|
104
|
+
syntax: "*";
|
|
105
|
+
inherits: false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@property --_switch-grow-w {
|
|
109
|
+
syntax: "*";
|
|
110
|
+
inherits: false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@property --_switch-grow-h {
|
|
114
|
+
syntax: "*";
|
|
115
|
+
inherits: false;
|
|
116
|
+
}
|
|
117
|
+
|
|
66
118
|
@layer reset {
|
|
67
119
|
/* ===========================================================================
|
|
68
120
|
SWITCH — native <input type="checkbox" role="switch"> internals
|
|
@@ -77,16 +129,32 @@
|
|
|
77
129
|
position: absolute;
|
|
78
130
|
inset-block-start: 50%;
|
|
79
131
|
inset-inline-start: 0;
|
|
80
|
-
|
|
81
|
-
|
|
132
|
+
/* how much the coefficients grow the track: the thumb takes half the width
|
|
133
|
+
(it stays half the track) and all of the height, so the gap holds */
|
|
134
|
+
--_switch-grow-w: calc(var(--ui-switch-track-w) * (var(--ui-switch-w-coefficient) - 1));
|
|
135
|
+
--_switch-grow-h: calc(var(--ui-switch-track-h) * (var(--ui-switch-h-coefficient) - 1));
|
|
136
|
+
inline-size: calc(var(--ui-switch-thumb-w) + var(--_switch-grow-w) / 2);
|
|
137
|
+
block-size: calc(var(--ui-switch-thumb-h) + var(--_switch-grow-h));
|
|
82
138
|
/* The thumb hangs off the label, out of reach of a --radius on the input,
|
|
83
139
|
so it reads the hook alone */
|
|
84
140
|
--_radius-len: var(--ui-switch-thumb-radius);
|
|
85
141
|
--_radius-num: var(--ui-switch-thumb-radius);
|
|
86
142
|
border-radius: calc(
|
|
87
|
-
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-
|
|
143
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-coefficient)
|
|
88
144
|
);
|
|
89
|
-
|
|
145
|
+
--_switch-thumb-shape: if(
|
|
146
|
+
style(--ui-switch-thumb-corner-shape: round) or
|
|
147
|
+
style(--ui-switch-thumb-corner-shape: squircle) or
|
|
148
|
+
style(--ui-switch-thumb-corner-shape: square) or
|
|
149
|
+
style(--ui-switch-thumb-corner-shape: superellipse(1)) or
|
|
150
|
+
style(--ui-switch-thumb-corner-shape: superellipse(1.3)) or
|
|
151
|
+
style(--ui-switch-thumb-corner-shape: superellipse(2)) or
|
|
152
|
+
style(--ui-switch-thumb-corner-shape: superellipse(infinity)): var(
|
|
153
|
+
--ui-switch-thumb-corner-shape
|
|
154
|
+
);
|
|
155
|
+
else: round
|
|
156
|
+
);
|
|
157
|
+
corner-shape: var(--_switch-thumb-shape, round);
|
|
90
158
|
border-width: var(--ui-switch-thumb-border-width);
|
|
91
159
|
border-style: var(--ui-switch-thumb-border-style);
|
|
92
160
|
border-color: var(--ui-switch-thumb-border-color);
|
|
@@ -101,8 +169,14 @@
|
|
|
101
169
|
&:has(> input[role="switch"]:checked)::after {
|
|
102
170
|
background-color: var(--ui-switch-thumb-bg--checked);
|
|
103
171
|
border-color: var(--ui-switch-thumb-border-color--checked);
|
|
172
|
+
/* the far end less the gap and the thumb, so a thumb-w hook still lands there:
|
|
173
|
+
(track-w + grow) − p − (thumb-w + grow / 2) − both thumb borders */
|
|
104
174
|
--ui-switch-thumb-translate:
|
|
105
|
-
calc(
|
|
175
|
+
calc(
|
|
176
|
+
var(--ui-switch-track-w) + var(--_switch-grow-w) / 2 - var(--ui-switch-track-p) -
|
|
177
|
+
var(--ui-switch-thumb-w) - 2 * var(--ui-switch-thumb-border-width)
|
|
178
|
+
),
|
|
179
|
+
-50%;
|
|
106
180
|
}
|
|
107
181
|
|
|
108
182
|
@media (hover: hover) {
|
|
@@ -144,11 +218,14 @@
|
|
|
144
218
|
position: absolute;
|
|
145
219
|
inset: min(0px, calc((100% - var(--_touch-min)) / 2));
|
|
146
220
|
}
|
|
147
|
-
--
|
|
148
|
-
--
|
|
221
|
+
/* a --w / --h utility sets the size outright; the coefficients scale only the hooks */
|
|
222
|
+
--_switch-w: calc(var(--ui-switch-track-w) * var(--ui-switch-w-coefficient));
|
|
223
|
+
--_switch-h: calc(var(--ui-switch-track-h) * var(--ui-switch-h-coefficient));
|
|
224
|
+
--_w-len: var(--_w-resolved, var(--_switch-w));
|
|
225
|
+
--_w-num: var(--_w-resolved, var(--_switch-w));
|
|
149
226
|
inline-size: calc(var(--_w-len) + var(--_w-num) * var(--spacing));
|
|
150
|
-
--_h-len: var(--_h-resolved, var(--
|
|
151
|
-
--_h-num: var(--_h-resolved, var(--
|
|
227
|
+
--_h-len: var(--_h-resolved, var(--_switch-h));
|
|
228
|
+
--_h-num: var(--_h-resolved, var(--_switch-h));
|
|
152
229
|
block-size: calc(var(--_h-len) + var(--_h-num) * var(--spacing));
|
|
153
230
|
|
|
154
231
|
background-color: var(--_bg-resolved, var(--ui-switch-track-bg));
|
|
@@ -158,9 +235,21 @@
|
|
|
158
235
|
--_radius-len: var(--_radius-resolved, var(--ui-switch-track-radius));
|
|
159
236
|
--_radius-num: var(--_radius-resolved, var(--ui-switch-track-radius));
|
|
160
237
|
border-radius: calc(
|
|
161
|
-
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-
|
|
238
|
+
var(--_radius-len) + var(--_radius-num) * var(--spacing) * var(--radius-coefficient)
|
|
239
|
+
);
|
|
240
|
+
--_switch-track-shape: if(
|
|
241
|
+
style(--ui-switch-track-corner-shape: round) or
|
|
242
|
+
style(--ui-switch-track-corner-shape: squircle) or
|
|
243
|
+
style(--ui-switch-track-corner-shape: square) or
|
|
244
|
+
style(--ui-switch-track-corner-shape: superellipse(1)) or
|
|
245
|
+
style(--ui-switch-track-corner-shape: superellipse(1.3)) or
|
|
246
|
+
style(--ui-switch-track-corner-shape: superellipse(2)) or
|
|
247
|
+
style(--ui-switch-track-corner-shape: superellipse(infinity)): var(
|
|
248
|
+
--ui-switch-track-corner-shape
|
|
249
|
+
);
|
|
250
|
+
else: round
|
|
162
251
|
);
|
|
163
|
-
corner-shape: var(--_corner-shape-resolved, var(--
|
|
252
|
+
corner-shape: var(--_corner-shape-resolved, var(--_switch-track-shape, round));
|
|
164
253
|
cursor: var(--_cursor-resolved, var(--ui-switch-cursor));
|
|
165
254
|
|
|
166
255
|
/* The ring is published to --_focus-shadow so a --shadow utility keeps
|