@mcp-b/wc-support 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/base/sigvelo-element.d.ts +80 -0
- package/dist/base/sigvelo-element.d.ts.map +1 -0
- package/dist/base/sigvelo-element.js +147 -0
- package/dist/base/sigvelo-element.js.map +1 -0
- package/dist/cem-plugins/type-references.d.ts +64 -0
- package/dist/cem-plugins/type-references.d.ts.map +1 -0
- package/dist/cem-plugins/type-references.js +242 -0
- package/dist/cem-plugins/type-references.js.map +1 -0
- package/dist/events/activate.d.ts +25 -0
- package/dist/events/activate.d.ts.map +1 -0
- package/dist/events/activate.js +25 -0
- package/dist/events/activate.js.map +1 -0
- package/dist/events/animation.d.ts +10 -0
- package/dist/events/animation.d.ts.map +1 -0
- package/dist/events/animation.js +7 -0
- package/dist/events/animation.js.map +1 -0
- package/dist/events/content.d.ts +15 -0
- package/dist/events/content.d.ts.map +1 -0
- package/dist/events/content.js +8 -0
- package/dist/events/content.js.map +1 -0
- package/dist/events/copy.d.ts +25 -0
- package/dist/events/copy.d.ts.map +1 -0
- package/dist/events/copy.js +15 -0
- package/dist/events/copy.js.map +1 -0
- package/dist/events/expand-collapse.d.ts +38 -0
- package/dist/events/expand-collapse.d.ts.map +1 -0
- package/dist/events/expand-collapse.js +37 -0
- package/dist/events/expand-collapse.js.map +1 -0
- package/dist/events/filter.d.ts +13 -0
- package/dist/events/filter.d.ts.map +1 -0
- package/dist/events/filter.js +12 -0
- package/dist/events/filter.js.map +1 -0
- package/dist/events/flip.d.ts +15 -0
- package/dist/events/flip.d.ts.map +1 -0
- package/dist/events/flip.js +13 -0
- package/dist/events/flip.js.map +1 -0
- package/dist/events/form.d.ts +29 -0
- package/dist/events/form.d.ts.map +1 -0
- package/dist/events/form.js +31 -0
- package/dist/events/form.js.map +1 -0
- package/dist/events/include.d.ts +28 -0
- package/dist/events/include.d.ts.map +1 -0
- package/dist/events/include.js +15 -0
- package/dist/events/include.js.map +1 -0
- package/dist/events/index.d.ts +23 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +23 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/intersect.d.ts +15 -0
- package/dist/events/intersect.d.ts.map +1 -0
- package/dist/events/intersect.js +8 -0
- package/dist/events/intersect.js.map +1 -0
- package/dist/events/item.d.ts +18 -0
- package/dist/events/item.d.ts.map +1 -0
- package/dist/events/item.js +13 -0
- package/dist/events/item.js.map +1 -0
- package/dist/events/load.d.ts +25 -0
- package/dist/events/load.d.ts.map +1 -0
- package/dist/events/load.js +24 -0
- package/dist/events/load.js.map +1 -0
- package/dist/events/mutation.d.ts +15 -0
- package/dist/events/mutation.d.ts.map +1 -0
- package/dist/events/mutation.js +8 -0
- package/dist/events/mutation.js.map +1 -0
- package/dist/events/open-close.d.ts +38 -0
- package/dist/events/open-close.d.ts.map +1 -0
- package/dist/events/open-close.js +33 -0
- package/dist/events/open-close.js.map +1 -0
- package/dist/events/page.d.ts +24 -0
- package/dist/events/page.d.ts.map +1 -0
- package/dist/events/page.js +17 -0
- package/dist/events/page.js.map +1 -0
- package/dist/events/progress.d.ts +15 -0
- package/dist/events/progress.d.ts.map +1 -0
- package/dist/events/progress.js +8 -0
- package/dist/events/progress.js.map +1 -0
- package/dist/events/resize.d.ts +15 -0
- package/dist/events/resize.d.ts.map +1 -0
- package/dist/events/resize.js +8 -0
- package/dist/events/resize.js.map +1 -0
- package/dist/events/row.d.ts +19 -0
- package/dist/events/row.d.ts.map +1 -0
- package/dist/events/row.js +8 -0
- package/dist/events/row.js.map +1 -0
- package/dist/events/select.d.ts +16 -0
- package/dist/events/select.d.ts.map +1 -0
- package/dist/events/select.js +8 -0
- package/dist/events/select.js.map +1 -0
- package/dist/events/tabs.d.ts +32 -0
- package/dist/events/tabs.d.ts.map +1 -0
- package/dist/events/tabs.js +21 -0
- package/dist/events/tabs.js.map +1 -0
- package/dist/events/time.d.ts +15 -0
- package/dist/events/time.d.ts.map +1 -0
- package/dist/events/time.js +13 -0
- package/dist/events/time.js.map +1 -0
- package/dist/events/transition.d.ts +10 -0
- package/dist/events/transition.d.ts.map +1 -0
- package/dist/events/transition.js +7 -0
- package/dist/events/transition.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/prefix.d.ts +16 -0
- package/dist/prefix.d.ts.map +1 -0
- package/dist/prefix.js +22 -0
- package/dist/prefix.js.map +1 -0
- package/dist/styles/form-control.styles.d.ts +9 -0
- package/dist/styles/form-control.styles.d.ts.map +1 -0
- package/dist/styles/form-control.styles.js +337 -0
- package/dist/styles/form-control.styles.js.map +1 -0
- package/dist/styles/host.styles.d.ts +4 -0
- package/dist/styles/host.styles.d.ts.map +1 -0
- package/dist/styles/host.styles.js +33 -0
- package/dist/styles/host.styles.js.map +1 -0
- package/dist/utilities/active-element.d.ts +7 -0
- package/dist/utilities/active-element.d.ts.map +1 -0
- package/dist/utilities/active-element.js +16 -0
- package/dist/utilities/active-element.js.map +1 -0
- package/dist/utilities/animate.d.ts +25 -0
- package/dist/utilities/animate.d.ts.map +1 -0
- package/dist/utilities/animate.js +58 -0
- package/dist/utilities/animate.js.map +1 -0
- package/dist/utilities/defined.d.ts +37 -0
- package/dist/utilities/defined.d.ts.map +1 -0
- package/dist/utilities/defined.js +42 -0
- package/dist/utilities/defined.js.map +1 -0
- package/dist/utilities/drag.d.ts +45 -0
- package/dist/utilities/drag.d.ts.map +1 -0
- package/dist/utilities/drag.js +106 -0
- package/dist/utilities/drag.js.map +1 -0
- package/dist/utilities/html.d.ts +5 -0
- package/dist/utilities/html.d.ts.map +1 -0
- package/dist/utilities/html.js +41 -0
- package/dist/utilities/html.js.map +1 -0
- package/dist/utilities/icon-library.d.ts +28 -0
- package/dist/utilities/icon-library.d.ts.map +1 -0
- package/dist/utilities/icon-library.js +36 -0
- package/dist/utilities/icon-library.js.map +1 -0
- package/dist/utilities/index.d.ts +16 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +16 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/library.d.ts +19 -0
- package/dist/utilities/library.d.ts.map +1 -0
- package/dist/utilities/library.js +45 -0
- package/dist/utilities/library.js.map +1 -0
- package/dist/utilities/loader.d.ts +36 -0
- package/dist/utilities/loader.d.ts.map +1 -0
- package/dist/utilities/loader.js +139 -0
- package/dist/utilities/loader.js.map +1 -0
- package/dist/utilities/localize.d.ts +62 -0
- package/dist/utilities/localize.d.ts.map +1 -0
- package/dist/utilities/localize.js +128 -0
- package/dist/utilities/localize.js.map +1 -0
- package/dist/utilities/long-press.d.ts +67 -0
- package/dist/utilities/long-press.d.ts.map +1 -0
- package/dist/utilities/long-press.js +125 -0
- package/dist/utilities/long-press.js.map +1 -0
- package/dist/utilities/math.d.ts +9 -0
- package/dist/utilities/math.d.ts.map +1 -0
- package/dist/utilities/math.js +25 -0
- package/dist/utilities/math.js.map +1 -0
- package/dist/utilities/parse.d.ts +5 -0
- package/dist/utilities/parse.d.ts.map +1 -0
- package/dist/utilities/parse.js +10 -0
- package/dist/utilities/parse.js.map +1 -0
- package/dist/utilities/platform.d.ts +10 -0
- package/dist/utilities/platform.d.ts.map +1 -0
- package/dist/utilities/platform.js +30 -0
- package/dist/utilities/platform.js.map +1 -0
- package/dist/utilities/scroll.d.ts +8 -0
- package/dist/utilities/scroll.d.ts.map +1 -0
- package/dist/utilities/scroll.js +33 -0
- package/dist/utilities/scroll.js.map +1 -0
- package/dist/utilities/search.d.ts +20 -0
- package/dist/utilities/search.d.ts.map +1 -0
- package/dist/utilities/search.js +110 -0
- package/dist/utilities/search.js.map +1 -0
- package/package.json +77 -0
- package/src/themes/sigvelo.css +28 -0
- package/src/themes/utilities.css +115 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Shared label, description, and text box styles for use with form controls.
|
|
4
|
+
*
|
|
5
|
+
* Text box components must render the following elements in this order: `#label`, `#description`, `#visual-box`, and
|
|
6
|
+
* `#text-box` (which must be a child of `#visual-box`). See the template in `<sigvelo-text-area>` for an example.
|
|
7
|
+
*/
|
|
8
|
+
export default css `
|
|
9
|
+
:host {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
width: 100%;
|
|
13
|
+
gap: 0.25em;
|
|
14
|
+
line-height: 1.25;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* Sizes */
|
|
18
|
+
:host([size="xs"]) {
|
|
19
|
+
font-size: var(--sigvelo-control-text-xs);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([size="sm"]) {
|
|
23
|
+
font-size: var(--sigvelo-control-text-sm);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([size="md"]) {
|
|
27
|
+
font-size: var(--sigvelo-control-text-md);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([size="lg"]) {
|
|
31
|
+
font-size: var(--sigvelo-control-text-lg);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([size="xl"]) {
|
|
35
|
+
font-size: var(--sigvelo-control-text-xl);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#label {
|
|
39
|
+
display: inline-block;
|
|
40
|
+
max-width: fit-content;
|
|
41
|
+
font-weight: var(--sigvelo-font-weight-semibold);
|
|
42
|
+
|
|
43
|
+
&:has(~ .disabled) {
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
color: var(--sigvelo-color-text-muted);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host([required]) #label::after {
|
|
50
|
+
margin-inline-start: -0.2em;
|
|
51
|
+
content: "*";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#description {
|
|
55
|
+
margin-block-end: 0.25em;
|
|
56
|
+
color: var(--sigvelo-color-text-muted);
|
|
57
|
+
font-size: 0.875em;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#visual-box {
|
|
61
|
+
display: flex;
|
|
62
|
+
position: relative;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 0.5em;
|
|
65
|
+
font: inherit;
|
|
66
|
+
cursor: text;
|
|
67
|
+
|
|
68
|
+
&.disabled {
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
opacity: 0.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&:has(#text-box[type="color"]) {
|
|
74
|
+
padding: 0 0.25em;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* When an autofill value is present, set the background color of the entire visual box, not just the input */
|
|
78
|
+
&:has(:autofill),
|
|
79
|
+
&:has(:-webkit-autofill) {
|
|
80
|
+
background-color: var(--sigvelo-color-primary-bg-subtle);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
#text-box {
|
|
85
|
+
appearance: none;
|
|
86
|
+
width: 100%;
|
|
87
|
+
margin: auto 0;
|
|
88
|
+
padding: 0;
|
|
89
|
+
border: none;
|
|
90
|
+
background: none;
|
|
91
|
+
color: var(--sigvelo-color-text);
|
|
92
|
+
font: inherit;
|
|
93
|
+
cursor: inherit;
|
|
94
|
+
|
|
95
|
+
&:focus {
|
|
96
|
+
outline: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&::placeholder {
|
|
100
|
+
color: var(--sigvelo-control-placeholder-color);
|
|
101
|
+
user-select: none;
|
|
102
|
+
-webkit-user-select: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* Override Safari's autofill background color so the visual box styles show through when autofill values exist */
|
|
106
|
+
&:-webkit-autofill,
|
|
107
|
+
&:-webkit-autofill:hover,
|
|
108
|
+
&:-webkit-autofill:focus,
|
|
109
|
+
&:-webkit-autofill:active {
|
|
110
|
+
-webkit-background-clip: text;
|
|
111
|
+
background-color: transparent;
|
|
112
|
+
-webkit-text-fill-color: inherit;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&::-webkit-search-decoration,
|
|
116
|
+
&::-webkit-search-cancel-button,
|
|
117
|
+
&::-webkit-search-results-button,
|
|
118
|
+
&::-webkit-search-results-decoration {
|
|
119
|
+
-webkit-appearance: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* Hide the datalist arrow */
|
|
123
|
+
&::-webkit-calendar-picker-indicator {
|
|
124
|
+
display: none !important;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Color inputs */
|
|
128
|
+
&[type="color"] {
|
|
129
|
+
&::-webkit-color-swatch-wrapper {
|
|
130
|
+
padding: 0.25em 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&::-webkit-color-swatch {
|
|
134
|
+
border: none;
|
|
135
|
+
border-radius: var(--sigvelo-radius-sm);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&::-moz-color-swatch,
|
|
139
|
+
&::-moz-focus-inner {
|
|
140
|
+
height: calc(100% - 0.5em);
|
|
141
|
+
padding: 0;
|
|
142
|
+
border-radius: var(--sigvelo-radius-sm);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&:-moz-focus-inner {
|
|
146
|
+
padding: 0;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* Number inputs */
|
|
151
|
+
&[type="number"]::-webkit-inner-spin-button {
|
|
152
|
+
width: 1em;
|
|
153
|
+
height: 2em;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* Date / time */
|
|
157
|
+
&::-webkit-datetime-edit-year-field:focus,
|
|
158
|
+
&::-webkit-datetime-edit-month-field:focus,
|
|
159
|
+
&::-webkit-datetime-edit-week-field:focus,
|
|
160
|
+
&::-webkit-datetime-edit-day-field:focus,
|
|
161
|
+
&::-webkit-datetime-edit-ampm-field:focus, /* Chrome */
|
|
162
|
+
&::-webkit-datetime-edit-meridiem-field:focus, /* Safari */
|
|
163
|
+
&::-webkit-datetime-edit-hour-field:focus,
|
|
164
|
+
&::-webkit-datetime-edit-millisecond-field:focus,
|
|
165
|
+
&::-webkit-datetime-edit-minute-field:focus,
|
|
166
|
+
&::-webkit-datetime-edit-second-field:focus {
|
|
167
|
+
outline: none;
|
|
168
|
+
background-color: var(--sigvelo-color-selection-bg);
|
|
169
|
+
color: var(--sigvelo-color-selection-text);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&[type="date"],
|
|
173
|
+
&[type="datetime-local"],
|
|
174
|
+
&[type="month"],
|
|
175
|
+
&[type="time"],
|
|
176
|
+
&[type="week"] {
|
|
177
|
+
display: inline-flex;
|
|
178
|
+
appearance: none;
|
|
179
|
+
align-items: center;
|
|
180
|
+
width: 100%;
|
|
181
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' style='color: %2382848d;'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12z' /%3E%3Cpath d='M16 3v4' /%3E%3Cpath d='M8 3v4' /%3E%3Cpath d='M4 11h16' /%3E%3Cpath d='M11 15h1' /%3E%3Cpath d='M12 15v3' /%3E%3C/svg%3E");
|
|
182
|
+
background-position: 100% center;
|
|
183
|
+
background-size: 1.25em;
|
|
184
|
+
background-repeat: no-repeat;
|
|
185
|
+
|
|
186
|
+
&::-webkit-calendar-picker-indicator {
|
|
187
|
+
display: none;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&::-webkit-date-and-time-value {
|
|
191
|
+
text-align: start;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
&[type="time"] {
|
|
196
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' style='color: %2382848d;'%3E%3Cpath stroke='none' d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0' /%3E%3Cpath d='M12 12l3 2' /%3E%3Cpath d='M12 7v5' /%3E%3C/svg%3E");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* We can't hide Firefox's calendar icon, so we'll hide our own instead. */
|
|
201
|
+
@-moz-document url-prefix() {
|
|
202
|
+
input[type="date"],
|
|
203
|
+
input[type="datetime-local"],
|
|
204
|
+
input[type="month"],
|
|
205
|
+
input[type="week"] {
|
|
206
|
+
background-image: none !important;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Normal */
|
|
211
|
+
#visual-box.normal {
|
|
212
|
+
padding: 0 0.75em;
|
|
213
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
214
|
+
var(--sigvelo-color-neutral-border-muted);
|
|
215
|
+
border-radius: var(--sigvelo-radius-md);
|
|
216
|
+
background-color: var(--sigvelo-color-surface);
|
|
217
|
+
color: var(--sigvelo-color-text);
|
|
218
|
+
|
|
219
|
+
&:has(#text-box:focus-visible) {
|
|
220
|
+
outline: var(--sigvelo-border-style) calc(var(--sigvelo-border-width) + 1px)
|
|
221
|
+
var(--sigvelo-color-focus);
|
|
222
|
+
outline-offset: calc(-1 * var(--sigvelo-border-width));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Filled */
|
|
227
|
+
#visual-box.filled {
|
|
228
|
+
padding: 0 0.75em;
|
|
229
|
+
border: var(--sigvelo-border-style) var(--sigvelo-border-width)
|
|
230
|
+
var(--sigvelo-color-neutral-bg-subtle);
|
|
231
|
+
border-radius: var(--sigvelo-radius-md);
|
|
232
|
+
background-color: var(--sigvelo-color-neutral-bg-subtle);
|
|
233
|
+
|
|
234
|
+
&:has(#text-box:focus-visible) {
|
|
235
|
+
outline: var(--sigvelo-border-style) calc(var(--sigvelo-border-width) + 1px)
|
|
236
|
+
var(--sigvelo-color-focus);
|
|
237
|
+
outline-offset: calc(-1 * var(--sigvelo-border-width));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Sizes */
|
|
242
|
+
#visual-box.xs {
|
|
243
|
+
font-size: var(--sigvelo-control-text-xs);
|
|
244
|
+
|
|
245
|
+
#text-box {
|
|
246
|
+
min-height: calc(var(--sigvelo-control-height-xs) - var(--sigvelo-border-width) * 2);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
#visual-box.sm {
|
|
251
|
+
font-size: var(--sigvelo-control-text-sm);
|
|
252
|
+
|
|
253
|
+
#text-box {
|
|
254
|
+
min-height: calc(var(--sigvelo-control-height-sm) - var(--sigvelo-border-width) * 2);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
#visual-box.md {
|
|
259
|
+
font-size: var(--sigvelo-control-text-md);
|
|
260
|
+
|
|
261
|
+
#text-box {
|
|
262
|
+
min-height: calc(var(--sigvelo-control-height-md) - var(--sigvelo-border-width) * 2);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
#visual-box.lg {
|
|
267
|
+
font-size: var(--sigvelo-control-text-lg);
|
|
268
|
+
|
|
269
|
+
#text-box {
|
|
270
|
+
min-height: calc(var(--sigvelo-control-height-lg) - var(--sigvelo-border-width) * 2);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
#visual-box.xl {
|
|
275
|
+
font-size: var(--sigvelo-control-text-xl);
|
|
276
|
+
|
|
277
|
+
#text-box {
|
|
278
|
+
min-height: calc(var(--sigvelo-control-height-xl) - var(--sigvelo-border-width) * 2);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* Pills */
|
|
283
|
+
#visual-box.pill {
|
|
284
|
+
padding: 0 1.25em;
|
|
285
|
+
border-radius: var(--sigvelo-radius-full);
|
|
286
|
+
|
|
287
|
+
&::-webkit-color-swatch {
|
|
288
|
+
border-radius: var(--sigvelo-radius-full);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
&::-moz-color-swatch,
|
|
292
|
+
&::-moz-focus-inner {
|
|
293
|
+
border-radius: var(--sigvelo-radius-full);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.text-box-button {
|
|
298
|
+
display: flex;
|
|
299
|
+
align-items: center;
|
|
300
|
+
align-self: stretch;
|
|
301
|
+
justify-content: center;
|
|
302
|
+
margin: 0;
|
|
303
|
+
padding: 0;
|
|
304
|
+
padding-inline: 0.25em;
|
|
305
|
+
border: none;
|
|
306
|
+
background: none;
|
|
307
|
+
color: var(--sigvelo-color-text-muted);
|
|
308
|
+
font: inherit;
|
|
309
|
+
font-size: 1.25em;
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
transition: var(--sigvelo-motion-duration-interaction) translate ease;
|
|
312
|
+
|
|
313
|
+
&:active {
|
|
314
|
+
translate: 0 1px;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Icons */
|
|
319
|
+
slot[name="start"]::slotted(*),
|
|
320
|
+
slot[name="end"]::slotted(*) {
|
|
321
|
+
color: var(--sigvelo-color-text-muted) !important;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
slot[name="start"]::slotted(sigvelo-icon),
|
|
325
|
+
slot[name="end"]::slotted(sigvelo-icon) {
|
|
326
|
+
font-size: 1.25em !important;
|
|
327
|
+
pointer-events: none;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
slot[name="start"]::slotted(svg),
|
|
331
|
+
slot[name="end"]::slotted(svg) {
|
|
332
|
+
width: 1.25em;
|
|
333
|
+
height: 1.25em;
|
|
334
|
+
pointer-events: none;
|
|
335
|
+
}
|
|
336
|
+
`;
|
|
337
|
+
//# sourceMappingURL=form-control.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-control.styles.js","sourceRoot":"","sources":["../../src/styles/form-control.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;GAKG;AACH,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwUjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.styles.d.ts","sourceRoot":"","sources":["../../src/styles/host.styles.ts"],"names":[],"mappings":"AAEA,yDAAyD;;AACzD,wBA6BE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
/** Styles that should get applied to every component. */
|
|
3
|
+
export default css `
|
|
4
|
+
:host {
|
|
5
|
+
box-sizing: border-box !important;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:host *,
|
|
9
|
+
:host *::before,
|
|
10
|
+
:host *::after {
|
|
11
|
+
box-sizing: border-box !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
::selection {
|
|
15
|
+
background-color: var(--sigvelo-color-selection-bg);
|
|
16
|
+
color: var(--sigvelo-color-selection-text);
|
|
17
|
+
text-shadow: none !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[hidden] {
|
|
21
|
+
display: none !important;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.vh {
|
|
25
|
+
position: absolute;
|
|
26
|
+
width: 1px;
|
|
27
|
+
height: 1px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
clip-path: inset(50%);
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
33
|
+
//# sourceMappingURL=host.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.styles.js","sourceRoot":"","sources":["../../src/styles/host.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,yDAAyD;AACzD,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BjB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generator that yields all active elements in the DOM tree, traversing through open shadow DOM boundaries. The last
|
|
3
|
+
* element returned is the "deepest" active element. To fetch the deepest active element, use
|
|
4
|
+
* `[...activeElements()].pop()`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function activeElements(activeElement?: Element | null): Generator<Element>;
|
|
7
|
+
//# sourceMappingURL=active-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-element.d.ts","sourceRoot":"","sources":["../../src/utilities/active-element.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAiB,cAAc,CAC7B,aAAa,GAAE,OAAO,GAAG,IAA6B,GACrD,SAAS,CAAC,OAAO,CAAC,CAYpB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generator that yields all active elements in the DOM tree, traversing through open shadow DOM boundaries. The last
|
|
3
|
+
* element returned is the "deepest" active element. To fetch the deepest active element, use
|
|
4
|
+
* `[...activeElements()].pop()`.
|
|
5
|
+
*/
|
|
6
|
+
export function* activeElements(activeElement = document.activeElement) {
|
|
7
|
+
if (activeElement === null || activeElement === undefined)
|
|
8
|
+
return;
|
|
9
|
+
yield activeElement;
|
|
10
|
+
if ("shadowRoot" in activeElement &&
|
|
11
|
+
activeElement.shadowRoot &&
|
|
12
|
+
activeElement.shadowRoot.mode !== "closed") {
|
|
13
|
+
yield* activeElements(activeElement.shadowRoot.activeElement);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=active-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-element.js","sourceRoot":"","sources":["../../src/utilities/active-element.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,SAAS,CAAC,CAAC,cAAc,CAC7B,gBAAgC,QAAQ,CAAC,aAAa;IAEtD,IAAI,aAAa,KAAK,IAAI,IAAI,aAAa,KAAK,SAAS;QAAE,OAAO;IAElE,MAAM,aAAa,CAAC;IAEpB,IACE,YAAY,IAAI,aAAa;QAC7B,aAAa,CAAC,UAAU;QACxB,aAAa,CAAC,UAAU,CAAC,IAAI,KAAK,QAAQ,EAC1C,CAAC;QACD,KAAK,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** A single direction (enter or exit) of a transition animation. */
|
|
2
|
+
export interface TransitionKeyframes {
|
|
3
|
+
/** Web Animations API keyframes. */
|
|
4
|
+
keyframes: Keyframe[];
|
|
5
|
+
/** CSS easing function, e.g. `cubic-bezier(0.33, 1, 0.68, 1)`. */
|
|
6
|
+
easing: string;
|
|
7
|
+
}
|
|
8
|
+
/** Enter/exit animation pair for use with the Web Animations API. */
|
|
9
|
+
export interface TransitionAnimation {
|
|
10
|
+
/** Animation applied when an element enters. */
|
|
11
|
+
enter: TransitionKeyframes;
|
|
12
|
+
/** Animation applied when an element exits. */
|
|
13
|
+
exit: TransitionKeyframes;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Applies a class to the specified element to animate it. The class is removed after the animation finishes or is
|
|
17
|
+
* canceled, then the promise resolves. If applying the class doesn't trigger an animation, the promise resolves
|
|
18
|
+
* immediately.
|
|
19
|
+
*/
|
|
20
|
+
export declare function animateWithClass(el: Element, className: string): Promise<void>;
|
|
21
|
+
/** Determines if two DOMRect objects have different positions. */
|
|
22
|
+
export declare function hasDomRectMoved(oldPosition: DOMRect, newPosition: DOMRect): boolean;
|
|
23
|
+
/** Parses a CSS duration string and returns the corresponding number of milliseconds. */
|
|
24
|
+
export declare function parseCssDuration(duration: string): number;
|
|
25
|
+
//# sourceMappingURL=animate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../../src/utilities/animate.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qEAAqE;AACrE,MAAM,WAAW,mBAAmB;IAClC,gDAAgD;IAChD,KAAK,EAAE,mBAAmB,CAAC;IAC3B,+CAA+C;IAC/C,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB9E;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,WAQzE;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwBzD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies a class to the specified element to animate it. The class is removed after the animation finishes or is
|
|
3
|
+
* canceled, then the promise resolves. If applying the class doesn't trigger an animation, the promise resolves
|
|
4
|
+
* immediately.
|
|
5
|
+
*/
|
|
6
|
+
export function animateWithClass(el, className) {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const handleFinish = () => {
|
|
9
|
+
el.removeEventListener("animationend", handleFinish);
|
|
10
|
+
el.removeEventListener("animationcancel", handleFinish);
|
|
11
|
+
el.classList.remove(className);
|
|
12
|
+
resolve();
|
|
13
|
+
};
|
|
14
|
+
el.classList.add(className);
|
|
15
|
+
queueMicrotask(() => {
|
|
16
|
+
if (el.getAnimations().length === 0) {
|
|
17
|
+
el.classList.remove(className);
|
|
18
|
+
resolve();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
el.addEventListener("animationend", handleFinish);
|
|
22
|
+
el.addEventListener("animationcancel", handleFinish);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** Determines if two DOMRect objects have different positions. */
|
|
27
|
+
export function hasDomRectMoved(oldPosition, newPosition) {
|
|
28
|
+
if (!oldPosition)
|
|
29
|
+
return true;
|
|
30
|
+
return (oldPosition.top !== newPosition.top ||
|
|
31
|
+
oldPosition.left !== newPosition.left ||
|
|
32
|
+
oldPosition.width !== newPosition.width ||
|
|
33
|
+
oldPosition.height !== newPosition.height);
|
|
34
|
+
}
|
|
35
|
+
/** Parses a CSS duration string and returns the corresponding number of milliseconds. */
|
|
36
|
+
export function parseCssDuration(duration) {
|
|
37
|
+
// Handle empty or invalid input
|
|
38
|
+
if (!duration || typeof duration !== "string") {
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
// Match number and unit
|
|
42
|
+
const match = duration.match(/^([0-9]*\.?[0-9]+)(ms|s)$/);
|
|
43
|
+
if (!match) {
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
const value = parseFloat(match[1]);
|
|
47
|
+
const unit = match[2];
|
|
48
|
+
// Convert to milliseconds based on unit
|
|
49
|
+
switch (unit) {
|
|
50
|
+
case "ms":
|
|
51
|
+
return value;
|
|
52
|
+
case "s":
|
|
53
|
+
return value * 1000;
|
|
54
|
+
default:
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=animate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animate.js","sourceRoot":"","sources":["../../src/utilities/animate.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAW,EAAE,SAAiB;IAC7D,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,EAAE,CAAC,mBAAmB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YACrD,EAAE,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;YACxD,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YAC/B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QAEF,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAE5B,cAAc,CAAC,GAAG,EAAE;YAClB,IAAI,EAAE,CAAC,aAAa,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACpC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC/B,OAAO,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YAED,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;YAClD,EAAE,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,eAAe,CAAC,WAAoB,EAAE,WAAoB;IACxE,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,CACL,WAAW,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG;QACnC,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;QACrC,WAAW,CAAC,KAAK,KAAK,WAAW,CAAC,KAAK;QACvC,WAAW,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,CAC1C,CAAC;AACJ,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,gCAAgC;IAChC,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC9C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,wBAAwB;IACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtB,wCAAwC;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,IAAI;YACP,OAAO,KAAK,CAAC;QACf,KAAK,GAAG;YACN,OAAO,KAAK,GAAG,IAAI,CAAC;QACtB;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface AllDefinedOptions {
|
|
2
|
+
/**
|
|
3
|
+
* A callback that accepts a custom element tag name and returns `true` if the custom element should be defined before
|
|
4
|
+
* resolving or `false` to skip it. The tag name is always in lowercase.
|
|
5
|
+
*/
|
|
6
|
+
match: (tagName: string) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* To wait for additional custom elements that may not be on the page when the function is called, provide them here.
|
|
9
|
+
*/
|
|
10
|
+
additionalElements: string | string[];
|
|
11
|
+
/**
|
|
12
|
+
* The root in which to look for custom elements. Defaults to `document`. By design, shadow roots are not traversed,
|
|
13
|
+
* but you can call this function and set `root` to a custom element's shadow root if needed.
|
|
14
|
+
*/
|
|
15
|
+
root: Document | ShadowRoot;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Waits for custom elements that are currently on the page to be registered before resolving. This is sugar for
|
|
19
|
+
* awaiting `customElements.whenDefined()` multiple times. By default, the function waits for all undefined Sigvelo
|
|
20
|
+
* elements, but you can pass a custom match function to wait for other custom elements instead.
|
|
21
|
+
*
|
|
22
|
+
* The function returns with `Promise.all()`, so any loading errors will cause it to reject. Make sure you handle errors
|
|
23
|
+
* accordingly using a try/catch block or a `.catch()`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Wait for Sigvelo elements
|
|
27
|
+
* await allDefined();
|
|
28
|
+
*
|
|
29
|
+
* // Wait for all custom elements that start with `foo-` as well as the `<bar-button>` element
|
|
30
|
+
* await allDefined({
|
|
31
|
+
* match: tagName => tagName.startsWith('foo-'),
|
|
32
|
+
* additionalElements: ['bar-button', 'baz-dialog']
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
35
|
+
export declare function allDefined(options?: Partial<AllDefinedOptions>): Promise<void>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=defined.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defined.d.ts","sourceRoot":"","sources":["../../src/utilities/defined.ts"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB;;;OAGG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAEpC;;OAEG;IACH,kBAAkB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEtC;;;OAGG;IACH,IAAI,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,iBA0BpE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isDesignSystemTag } from "../prefix.js";
|
|
2
|
+
/**
|
|
3
|
+
* Waits for custom elements that are currently on the page to be registered before resolving. This is sugar for
|
|
4
|
+
* awaiting `customElements.whenDefined()` multiple times. By default, the function waits for all undefined Sigvelo
|
|
5
|
+
* elements, but you can pass a custom match function to wait for other custom elements instead.
|
|
6
|
+
*
|
|
7
|
+
* The function returns with `Promise.all()`, so any loading errors will cause it to reject. Make sure you handle errors
|
|
8
|
+
* accordingly using a try/catch block or a `.catch()`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Wait for Sigvelo elements
|
|
12
|
+
* await allDefined();
|
|
13
|
+
*
|
|
14
|
+
* // Wait for all custom elements that start with `foo-` as well as the `<bar-button>` element
|
|
15
|
+
* await allDefined({
|
|
16
|
+
* match: tagName => tagName.startsWith('foo-'),
|
|
17
|
+
* additionalElements: ['bar-button', 'baz-dialog']
|
|
18
|
+
* });
|
|
19
|
+
*/
|
|
20
|
+
export async function allDefined(options) {
|
|
21
|
+
const opts = {
|
|
22
|
+
match: (tagName) => isDesignSystemTag(tagName),
|
|
23
|
+
additionalElements: [],
|
|
24
|
+
root: document,
|
|
25
|
+
...options,
|
|
26
|
+
};
|
|
27
|
+
// Ensure additional elements is an array
|
|
28
|
+
const additionalElements = Array.isArray(opts.additionalElements)
|
|
29
|
+
? opts.additionalElements
|
|
30
|
+
: [opts.additionalElements];
|
|
31
|
+
// Discover undefined elements in the document
|
|
32
|
+
const undefinedElements = [...opts.root.querySelectorAll(":not(:defined)")]
|
|
33
|
+
.map((el) => el.localName)
|
|
34
|
+
.filter((tag, index, arr) => arr.indexOf(tag) === index) // make it unique
|
|
35
|
+
.filter((tag) => opts.match(tag)); // make sure it matches
|
|
36
|
+
const tagsToAwait = [...undefinedElements, ...additionalElements];
|
|
37
|
+
// Wait for all to be registered
|
|
38
|
+
await Promise.all(tagsToAwait.map((tag) => customElements.whenDefined(tag)));
|
|
39
|
+
// Wait a cycle for the first update
|
|
40
|
+
await new Promise(requestAnimationFrame);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=defined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defined.js","sourceRoot":"","sources":["../../src/utilities/defined.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAqBjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAoC;IACnE,MAAM,IAAI,GAAsB;QAC9B,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC;QAC9C,kBAAkB,EAAE,EAAE;QACtB,IAAI,EAAE,QAAQ;QACd,GAAG,OAAO;KACX,CAAC;IAEF,yCAAyC;IACzC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC;QAC/D,CAAC,CAAC,IAAI,CAAC,kBAAkB;QACzB,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAE9B,8CAA8C;IAC9C,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;SACxE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;SACzB,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,iBAAiB;SACzE,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,uBAAuB;IAE5D,MAAM,WAAW,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,kBAAkB,CAAC,CAAC;IAElE,gCAAgC;IAChC,MAAM,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAE7E,oCAAoC;IACpC,MAAM,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attaches the necessary events to make an element draggable.
|
|
3
|
+
*
|
|
4
|
+
* This by itself will not make the element draggable, but it provides the events and callbacks necessary to facilitate
|
|
5
|
+
* dragging. Use the `clientX` and `clientY` arguments of each callback to update the UI as desired when dragging.
|
|
6
|
+
*
|
|
7
|
+
* Drag functionality will be enabled as soon as the constructor is called. A `start()` and `stop()` method can be used
|
|
8
|
+
* to start and stop it, if needed.
|
|
9
|
+
*
|
|
10
|
+
* Note: to prevent undesired scrolling while dragging on touch devices, use `touch-action: none` in the component's
|
|
11
|
+
* styles instead of preventing the `pointerdown` event.
|
|
12
|
+
*
|
|
13
|
+
* @usage
|
|
14
|
+
*
|
|
15
|
+
* const draggable = new DraggableElement(element, {
|
|
16
|
+
* start: (clientX, clientY) => { ... },
|
|
17
|
+
* move: (clientX, clientY) => { ... },
|
|
18
|
+
* stop: (clientX, clientY) => { ... }
|
|
19
|
+
* });
|
|
20
|
+
*/
|
|
21
|
+
export declare class DraggableElement {
|
|
22
|
+
private element;
|
|
23
|
+
private isActive;
|
|
24
|
+
private isDragging;
|
|
25
|
+
private options;
|
|
26
|
+
constructor(el: Element, options: Partial<DraggableElementOptions>);
|
|
27
|
+
private handleDragStart;
|
|
28
|
+
private handleDragStop;
|
|
29
|
+
private handleDragMove;
|
|
30
|
+
/** Start listening to drags. */
|
|
31
|
+
start(): void;
|
|
32
|
+
/** Stop listening to drags. */
|
|
33
|
+
stop(): void;
|
|
34
|
+
/** Starts or stops the drag listeners. */
|
|
35
|
+
toggle(isActive?: boolean): void;
|
|
36
|
+
}
|
|
37
|
+
export interface DraggableElementOptions {
|
|
38
|
+
/** Runs when dragging starts. */
|
|
39
|
+
start: (clientX: number, clientY: number) => void;
|
|
40
|
+
/** Runs as the user is dragging. This may execute often, so avoid expensive operations. */
|
|
41
|
+
move: (clientX: number, clientY: number) => void;
|
|
42
|
+
/** Runs when dragging ends. */
|
|
43
|
+
stop: (clientX: number, clientY: number) => void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=drag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag.d.ts","sourceRoot":"","sources":["../../src/utilities/drag.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAA0B;gBAE7B,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC;IAYlE,OAAO,CAAC,eAAe,CAwBrB;IAEF,OAAO,CAAC,cAAc,CAapB;IAEF,OAAO,CAAC,cAAc,CAQpB;IAEF,gCAAgC;IACzB,KAAK;IAWZ,+BAA+B;IACxB,IAAI;IAaX,0CAA0C;IACnC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO;CASjC;AAED,MAAM,WAAW,uBAAuB;IACtC,iCAAiC;IACjC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,2FAA2F;IAC3F,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,+BAA+B;IAC/B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD"}
|