elements-kit 0.21.0 → 0.22.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/README.md +23 -21
- package/dist/attributes.d.mts +1 -1
- package/dist/await.d.mts +6 -5
- package/dist/await.mjs +1 -37
- package/dist/{types-CUvFIgPa.d.mts → children-s3nFjpLA.d.mts} +124 -226
- package/dist/custom-elements-CdpilMDu.d.mts +87 -0
- package/dist/custom-elements.d.mts +2 -2
- package/dist/{element-D3om9yA6.mjs → element-Di0PYFX1.mjs} +15 -38
- package/dist/environment-CTAGxqz_.d.mts +19 -0
- package/dist/for.d.mts +9 -4
- package/dist/for.mjs +1 -1
- package/dist/{fragment-ROPRBJQd.mjs → fragment-Bvs1sGu1.mjs} +3 -3
- package/dist/hydrate/index.mjs +1 -1
- package/dist/{hydrate-6Qx4n4Su.mjs → hydrate-DvWdnV-e.mjs} +5 -5
- package/dist/integrations/astro-client.mjs +2 -2
- package/dist/integrations/astro-server.mjs +2 -2
- package/dist/integrations/astro-slots.d.mts +6 -5
- package/dist/integrations/astro-slots.mjs +9 -8
- package/dist/integrations/react.d.mts +1 -1
- package/dist/integrations/react.mjs +1 -1
- package/dist/jsx-runtime/index.d.mts +2 -2
- package/dist/jsx-runtime/index.mjs +2 -2
- package/dist/polyfill-BVNd6ogU.d.mts +9 -0
- package/dist/render.mjs +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/{server-iFSng50i.mjs → server-CTkyXTV6.mjs} +2 -2
- package/dist/signals/index.d.mts +1 -1
- package/dist/slot.d.mts +83 -2
- package/dist/slot.mjs +179 -2
- package/dist/ui/marketing/marketing.css +5 -3
- package/dist/ui/otp-input/index.d.mts +6 -5
- package/dist/ui/otp-input/index.mjs +5 -5
- package/dist/ui/styles/index.css +174 -172
- package/dist/ui/styles/unset.css +212 -210
- package/dist/utilities/active-element.d.mts +1 -1
- package/dist/utilities/async.d.mts +2 -2
- package/dist/utilities/async.mjs +13 -5
- package/dist/utilities/debounced.d.mts +1 -1
- package/dist/utilities/dom-lifecycle.bench.mjs +2 -2
- package/dist/utilities/element-rect.d.mts +1 -1
- package/dist/utilities/element-scroll.d.mts +1 -1
- package/dist/utilities/environment.d.mts +2 -7
- package/dist/utilities/environment.mjs +13 -1
- package/dist/utilities/event-driven.d.mts +1 -1
- package/dist/utilities/event-listener.d.mts +1 -1
- package/dist/utilities/focus-within.d.mts +1 -1
- package/dist/utilities/hover.d.mts +1 -1
- package/dist/utilities/interval.d.mts +1 -1
- package/dist/utilities/location.d.mts +1 -1
- package/dist/utilities/media-devices.d.mts +1 -1
- package/dist/utilities/media-player.d.mts +1 -1
- package/dist/utilities/media-query.d.mts +1 -1
- package/dist/utilities/network.d.mts +1 -1
- package/dist/utilities/orientation.d.mts +1 -1
- package/dist/utilities/previous.d.mts +1 -1
- package/dist/utilities/promise.d.mts +1 -1
- package/dist/utilities/routing.d.mts +1 -1
- package/dist/utilities/search-params.d.mts +1 -1
- package/dist/utilities/storage.d.mts +1 -1
- package/dist/utilities/throttled.d.mts +1 -1
- package/dist/utilities/timeout.d.mts +1 -1
- package/dist/utilities/window-focus.d.mts +1 -1
- package/dist/utilities/window-size.d.mts +1 -1
- package/package.json +3 -1
- package/dist/custom-elements-BGcU6ldL.d.mts +0 -57
- package/dist/slot-BFWXeFRl.d.mts +0 -77
- package/dist/slot-Dvf30O0B.mjs +0 -138
- /package/dist/{attributes-3r7Diua4.d.mts → attributes-DILeh3-s.d.mts} +0 -0
- /package/dist/{scope-zbEG299F.mjs → scope-C1vELXqP.mjs} +0 -0
package/dist/ui/styles/unset.css
CHANGED
|
@@ -1,211 +1,213 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
1
|
+
@layer unset {
|
|
2
|
+
.unset:where(body, blockquote, dl, dd, figure, p) {
|
|
3
|
+
margin: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.unset:where(address, b, cite, code, dfn, em, i, kbd, q, samp, small, strong, var) {
|
|
7
|
+
font: unset;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.unset:where(h1, h2, h3, h4, h5, h6) {
|
|
11
|
+
font: unset;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.unset:where(a) {
|
|
16
|
+
all: unset;
|
|
17
|
+
-webkit-tap-highlight-color: transparent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.unset:where(button, select, [type="button"], [type="image"], [type="reset"], [type="submit"], [type="checkbox"], [type="color"], [type="radio"], [type="range"]) {
|
|
21
|
+
all: unset;
|
|
22
|
+
text-indent: initial;
|
|
23
|
+
-webkit-tap-highlight-color: transparent;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: normal;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.unset:where(label) {
|
|
30
|
+
-webkit-tap-highlight-color: transparent;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.unset:where(dialog, [popover]) {
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
background: none;
|
|
36
|
+
border: 0;
|
|
37
|
+
outline: none;
|
|
38
|
+
max-width: none;
|
|
39
|
+
max-height: none;
|
|
40
|
+
margin: 0;
|
|
41
|
+
padding: 0;
|
|
42
|
+
position: fixed;
|
|
43
|
+
inset: auto;
|
|
44
|
+
overflow: visible;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.unset:where(select) {
|
|
48
|
+
text-align: start;
|
|
49
|
+
font-style: normal;
|
|
50
|
+
font-weight: normal;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.unset:where(textarea, input:not([type="button"], [type="image"], [type="reset"], [type="submit"], [type="checkbox"], [type="color"], [type="radio"], [type="range"])) {
|
|
54
|
+
all: unset;
|
|
55
|
+
text-align: start;
|
|
56
|
+
width: -webkit-fill-available;
|
|
57
|
+
width: -moz-available;
|
|
58
|
+
width: stretch;
|
|
59
|
+
text-indent: initial;
|
|
60
|
+
-webkit-tap-highlight-color: transparent;
|
|
61
|
+
cursor: text;
|
|
62
|
+
white-space: pre-wrap;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
font-weight: normal;
|
|
65
|
+
display: block;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.unset:where(:focus) {
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.unset::placeholder {
|
|
73
|
+
color: unset;
|
|
74
|
+
opacity: unset;
|
|
75
|
+
-webkit-user-select: none;
|
|
76
|
+
user-select: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.unset:where(table) {
|
|
80
|
+
all: unset;
|
|
81
|
+
text-indent: initial;
|
|
82
|
+
display: table;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.unset:where(caption) {
|
|
86
|
+
text-align: inherit;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.unset:where(td) {
|
|
90
|
+
padding: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.unset:where(th) {
|
|
94
|
+
font-weight: unset;
|
|
95
|
+
text-align: inherit;
|
|
96
|
+
padding: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.unset:where(abbr, acronym) {
|
|
100
|
+
text-decoration: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.unset:where(canvas, object, picture, summary) {
|
|
104
|
+
display: block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.unset:where(del, s) {
|
|
108
|
+
-webkit-text-decoration: unset;
|
|
109
|
+
text-decoration: unset;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.unset:where(fieldset, hr) {
|
|
113
|
+
all: unset;
|
|
114
|
+
display: block;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.unset:where(legend) {
|
|
118
|
+
cursor: default;
|
|
119
|
+
border: none;
|
|
120
|
+
padding: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.unset:where(li) {
|
|
124
|
+
text-align: unset;
|
|
125
|
+
display: block;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.unset:where(ol, ul) {
|
|
129
|
+
margin: 0;
|
|
130
|
+
padding: 0;
|
|
131
|
+
list-style: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.unset:where(iframe) {
|
|
135
|
+
width: -webkit-fill-available;
|
|
136
|
+
width: -moz-available;
|
|
137
|
+
border: none;
|
|
138
|
+
width: stretch;
|
|
139
|
+
display: block;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.unset:where(ins, u) {
|
|
143
|
+
text-decoration: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.unset:where(img) {
|
|
147
|
+
max-width: 100%;
|
|
148
|
+
display: block;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.unset:where(svg) {
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
max-width: 100%;
|
|
154
|
+
display: block;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.unset:where(mark) {
|
|
158
|
+
all: unset;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.unset:where(pre) {
|
|
162
|
+
font: unset;
|
|
163
|
+
margin: unset;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.unset:where(q):before, .unset:where(q):after {
|
|
167
|
+
content: "";
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.unset:where(sub, sup) {
|
|
171
|
+
font: unset;
|
|
172
|
+
vertical-align: unset;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.unset:where(details) ::marker {
|
|
176
|
+
content: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.unset:where(summary)::marker {
|
|
180
|
+
content: none;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.unset:where(video) {
|
|
184
|
+
width: -webkit-fill-available;
|
|
185
|
+
width: -moz-available;
|
|
186
|
+
width: stretch;
|
|
187
|
+
display: block;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.unset:where(:any-link) {
|
|
191
|
+
cursor: var(--cursor-link);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.unset:where(button) {
|
|
195
|
+
cursor: var(--cursor-button);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.unset:where(:disabled, [data-disabled]) {
|
|
199
|
+
cursor: var(--cursor-disabled);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.unset:where(input[type="checkbox"]) {
|
|
203
|
+
cursor: var(--cursor-checkbox);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.unset:where(input[type="radio"]) {
|
|
207
|
+
cursor: var(--cursor-radio);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.unset, .unset:before, .unset:after {
|
|
211
|
+
box-sizing: border-box;
|
|
212
|
+
}
|
|
211
213
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as CLAIM, p as MaybeReactive, w as SEED } from "../children-s3nFjpLA.mjs";
|
|
2
2
|
import { ComputedPromise } from "./promise.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/utilities/async.d.ts
|
|
@@ -38,7 +38,7 @@ declare class Async<TInput = undefined, TOutput = unknown> {
|
|
|
38
38
|
set fn(fn: MaybeReactive<Fn<TInput, TOutput>>);
|
|
39
39
|
get raw(): ComputedPromise<TOutput | undefined>;
|
|
40
40
|
get pending(): boolean;
|
|
41
|
-
get state(): "pending" | "fulfilled" | "rejected";
|
|
41
|
+
get state(): "idle" | "pending" | "fulfilled" | "rejected";
|
|
42
42
|
get value(): TOutput | undefined;
|
|
43
43
|
get reason(): unknown;
|
|
44
44
|
get result(): unknown;
|
package/dist/utilities/async.mjs
CHANGED
|
@@ -9,6 +9,7 @@ function flushDeferredAsyncRuns() {
|
|
|
9
9
|
deferredRuns.clear();
|
|
10
10
|
for (const run of runs) run();
|
|
11
11
|
}
|
|
12
|
+
const IDLE = promise(() => {});
|
|
12
13
|
/**
|
|
13
14
|
* Reactive wrapper around an async function. Exposes the current run as
|
|
14
15
|
* reactive signals (`state`, `value`, `reason`, `result`, `pending`) and
|
|
@@ -44,15 +45,16 @@ var Async = class {
|
|
|
44
45
|
set fn(fn) {
|
|
45
46
|
this.#fn(resolve(fn));
|
|
46
47
|
}
|
|
47
|
-
#current = signal(
|
|
48
|
+
#current = signal(IDLE);
|
|
48
49
|
get raw() {
|
|
49
50
|
return this.#current();
|
|
50
51
|
}
|
|
51
52
|
get pending() {
|
|
52
|
-
return this.
|
|
53
|
+
return this.state === "pending";
|
|
53
54
|
}
|
|
54
55
|
get state() {
|
|
55
|
-
|
|
56
|
+
const current = this.#current();
|
|
57
|
+
return current === IDLE ? "idle" : current.state;
|
|
56
58
|
}
|
|
57
59
|
get value() {
|
|
58
60
|
return this.raw.value;
|
|
@@ -77,7 +79,12 @@ var Async = class {
|
|
|
77
79
|
* `ReactivePromise`. See `ReactivePromise[SEED]`.
|
|
78
80
|
*/
|
|
79
81
|
[SEED](value) {
|
|
80
|
-
|
|
82
|
+
let current = this.#current();
|
|
83
|
+
if (current === IDLE) {
|
|
84
|
+
current = promise(() => {});
|
|
85
|
+
this.#current(current);
|
|
86
|
+
}
|
|
87
|
+
const seed = current[SEED];
|
|
81
88
|
seed?.(value);
|
|
82
89
|
}
|
|
83
90
|
/**
|
|
@@ -89,7 +96,8 @@ var Async = class {
|
|
|
89
96
|
const pendingRun = deferredRuns.get(this);
|
|
90
97
|
deferredRuns.delete(this);
|
|
91
98
|
if (record) {
|
|
92
|
-
|
|
99
|
+
const state = untracked(() => this.state);
|
|
100
|
+
if (state !== "fulfilled" && state !== "rejected") this[SEED](record.value);
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
95
103
|
pendingRun?.();
|
|
@@ -3218,7 +3218,7 @@ function manageArtifactAttachment(attachment) {
|
|
|
3218
3218
|
if (attachment.body != null) attachment.bodyEncoding ??= "base64";
|
|
3219
3219
|
}
|
|
3220
3220
|
//#endregion
|
|
3221
|
-
//#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_vite@8.0.8_@types+node@25.5.2_esbuild@0.
|
|
3221
|
+
//#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_vite@8.0.8_@types+node@25.5.2_esbuild@0.28.1_yaml@2.9.0_/node_modules/vitest/dist/chunks/utils.BX5Fg8C4.js
|
|
3222
3222
|
const NAME_WORKER_STATE = "__vitest_worker__";
|
|
3223
3223
|
function getWorkerState() {
|
|
3224
3224
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
@@ -3226,7 +3226,7 @@ function getWorkerState() {
|
|
|
3226
3226
|
return workerState;
|
|
3227
3227
|
}
|
|
3228
3228
|
//#endregion
|
|
3229
|
-
//#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_vite@8.0.8_@types+node@25.5.2_esbuild@0.
|
|
3229
|
+
//#region node_modules/.pnpm/vitest@4.1.3_@types+node@25.5.2_happy-dom@20.8.9_vite@8.0.8_@types+node@25.5.2_esbuild@0.28.1_yaml@2.9.0_/node_modules/vitest/dist/chunks/benchmark.CX_oY03V.js
|
|
3230
3230
|
const benchFns = /* @__PURE__ */ new WeakMap();
|
|
3231
3231
|
const benchOptsMap = /* @__PURE__ */ new WeakMap();
|
|
3232
3232
|
const bench = createBenchmark(function(name, fn = noop, options = {}) {
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const isBrowser: boolean;
|
|
4
|
-
/** A shared `Disposable` whose `Symbol.dispose` is a no-op — useful as a safe default. */
|
|
5
|
-
declare const noopDisposable: Disposable;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { isBrowser, noopDisposable };
|
|
1
|
+
import { n as isBrowser, r as noopDisposable, t as HTMLElementBase } from "../environment-CTAGxqz_.mjs";
|
|
2
|
+
export { HTMLElementBase, isBrowser, noopDisposable };
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
//#region src/utilities/environment.ts
|
|
2
2
|
/** `true` when running in a browser (both `window` and `document` exist). */
|
|
3
3
|
const isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
|
|
4
|
+
/**
|
|
5
|
+
* `HTMLElement` in the browser; an empty stand-in on the server.
|
|
6
|
+
*
|
|
7
|
+
* A custom-element class evaluates its `extends` clause at module load, but
|
|
8
|
+
* `HTMLElement` is undefined in Node — so importing an element module during
|
|
9
|
+
* SSR (e.g. an Astro `client:load` island) throws `HTMLElement is not defined`
|
|
10
|
+
* before any `isBrowser` guard can run. Elements are never *constructed* on the
|
|
11
|
+
* server (the streaming renderer emits plain tags), so a stub base is enough to
|
|
12
|
+
* let the class definition load; the guarded `customElements.define` still only
|
|
13
|
+
* registers in a real browser.
|
|
14
|
+
*/
|
|
15
|
+
const HTMLElementBase = isBrowser ? HTMLElement : class {};
|
|
4
16
|
/** A shared `Disposable` whose `Symbol.dispose` is a no-op — useful as a safe default. */
|
|
5
17
|
const noopDisposable = { [Symbol.dispose]() {} };
|
|
6
18
|
//#endregion
|
|
7
|
-
export { isBrowser, noopDisposable };
|
|
19
|
+
export { HTMLElementBase, isBrowser, noopDisposable };
|