@bedrock-layout/solid 0.7.1 → 0.9.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/lib/center.d.ts +11 -0
- package/lib/column-drop.d.ts +11 -0
- package/lib/cover.d.ts +15 -0
- package/lib/create-container-query.d.ts +2 -0
- package/lib/frame.d.ts +10 -0
- package/lib/grid.d.ts +10 -0
- package/lib/index.cjs.js +75 -24
- package/lib/index.d.ts +13 -131
- package/lib/index.m.js +218 -906
- package/lib/index.umd.js +75 -24
- package/lib/inline-cluster.d.ts +21 -0
- package/lib/inline.d.ts +11 -0
- package/lib/padbox.d.ts +26 -0
- package/lib/reel.d.ts +8 -0
- package/lib/spacing-constants.d.ts +31 -0
- package/lib/split.d.ts +15 -0
- package/lib/stack.d.ts +7 -0
- package/package.json +5 -2
package/lib/index.m.js
CHANGED
|
@@ -5,915 +5,33 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
9
|
for (var prop in b || (b = {}))
|
|
10
10
|
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
12
|
if (__getOwnPropSymbols)
|
|
13
13
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
14
|
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return a;
|
|
18
18
|
};
|
|
19
|
-
var __spreadProps = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
for (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
let t2 = "";
|
|
30
|
-
for (let r in e2)
|
|
31
|
-
t2 += r + s(e2[r]);
|
|
32
|
-
return t2;
|
|
33
|
-
}
|
|
34
|
-
return e2;
|
|
35
|
-
}, c = (e2, t2, r, c2, i2) => {
|
|
36
|
-
let u2 = s(e2), p = o[u2] || (o[u2] = ((e3) => {
|
|
37
|
-
let t3 = 0, r2 = 11;
|
|
38
|
-
for (; t3 < e3.length; )
|
|
39
|
-
r2 = 101 * r2 + e3.charCodeAt(t3++) >>> 0;
|
|
40
|
-
return "go" + r2;
|
|
41
|
-
})(u2));
|
|
42
|
-
if (!o[p]) {
|
|
43
|
-
let t3 = u2 !== e2 ? e2 : ((e3) => {
|
|
44
|
-
let t4, r2 = [{}];
|
|
45
|
-
for (; t4 = l.exec(e3.replace(a, "")); )
|
|
46
|
-
t4[4] ? r2.shift() : t4[3] ? r2.unshift(r2[0][t4[3]] = r2[0][t4[3]] || {}) : r2[0][t4[1]] = t4[2];
|
|
47
|
-
return r2[0];
|
|
48
|
-
})(e2);
|
|
49
|
-
o[p] = n(i2 ? { ["@keyframes " + p]: t3 } : t3, r ? "" : "." + p);
|
|
50
|
-
}
|
|
51
|
-
return ((e3, t3, r2) => {
|
|
52
|
-
t3.data.indexOf(e3) == -1 && (t3.data = r2 ? e3 + t3.data : t3.data + e3);
|
|
53
|
-
})(o[p], t2, c2), p;
|
|
54
|
-
}, i = (e2, t2, r) => e2.reduce((e3, l2, a2) => {
|
|
55
|
-
let o2 = t2[a2];
|
|
56
|
-
if (o2 && o2.call) {
|
|
57
|
-
let e4 = o2(r), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
|
|
58
|
-
o2 = t3 ? "." + t3 : e4 && typeof e4 == "object" ? e4.props ? "" : n(e4, "") : e4 === false ? "" : e4;
|
|
59
|
-
}
|
|
60
|
-
return e3 + l2 + (o2 == null ? "" : o2);
|
|
61
|
-
}, "");
|
|
62
|
-
function u(e2) {
|
|
63
|
-
let r = this || {}, l2 = e2.call ? e2(r.p) : e2;
|
|
64
|
-
return c(l2.unshift ? l2.raw ? i(l2, [].slice.call(arguments, 1), r.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r.p) : t2), {}) : l2, t(r.target), r.g, r.o, r.k);
|
|
65
|
-
}
|
|
66
|
-
u.bind({ g: 1 });
|
|
67
|
-
u.bind({ k: 1 });
|
|
68
|
-
const equalFn = (a2, b) => a2 === b;
|
|
69
|
-
const $PROXY = Symbol("solid-proxy");
|
|
70
|
-
const signalOptions = {
|
|
71
|
-
equals: equalFn
|
|
72
|
-
};
|
|
73
|
-
let runEffects = runQueue;
|
|
74
|
-
const NOTPENDING = {};
|
|
75
|
-
const STALE = 1;
|
|
76
|
-
const PENDING = 2;
|
|
77
|
-
const UNOWNED = {
|
|
78
|
-
owned: null,
|
|
79
|
-
cleanups: null,
|
|
80
|
-
context: null,
|
|
81
|
-
owner: null
|
|
82
|
-
};
|
|
83
|
-
var Owner = null;
|
|
84
|
-
let Transition = null;
|
|
85
|
-
let Listener = null;
|
|
86
|
-
let Pending = null;
|
|
87
|
-
let Updates = null;
|
|
88
|
-
let Effects = null;
|
|
89
|
-
let ExecCount = 0;
|
|
90
|
-
function createComputed(fn, value, options) {
|
|
91
|
-
const c2 = createComputation(fn, value, true, STALE);
|
|
92
|
-
updateComputation(c2);
|
|
93
|
-
}
|
|
94
|
-
function createRenderEffect(fn, value, options) {
|
|
95
|
-
const c2 = createComputation(fn, value, false, STALE);
|
|
96
|
-
updateComputation(c2);
|
|
97
|
-
}
|
|
98
|
-
function createMemo(fn, value, options) {
|
|
99
|
-
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
100
|
-
const c2 = createComputation(fn, value, true, 0);
|
|
101
|
-
c2.pending = NOTPENDING;
|
|
102
|
-
c2.observers = null;
|
|
103
|
-
c2.observerSlots = null;
|
|
104
|
-
c2.comparator = options.equals || void 0;
|
|
105
|
-
updateComputation(c2);
|
|
106
|
-
return readSignal.bind(c2);
|
|
107
|
-
}
|
|
108
|
-
function batch(fn) {
|
|
109
|
-
if (Pending)
|
|
110
|
-
return fn();
|
|
111
|
-
let result;
|
|
112
|
-
const q = Pending = [];
|
|
113
|
-
try {
|
|
114
|
-
result = fn();
|
|
115
|
-
} finally {
|
|
116
|
-
Pending = null;
|
|
117
|
-
}
|
|
118
|
-
runUpdates(() => {
|
|
119
|
-
for (let i2 = 0; i2 < q.length; i2 += 1) {
|
|
120
|
-
const data = q[i2];
|
|
121
|
-
if (data.pending !== NOTPENDING) {
|
|
122
|
-
const pending = data.pending;
|
|
123
|
-
data.pending = NOTPENDING;
|
|
124
|
-
writeSignal(data, pending);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}, false);
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
function untrack(fn) {
|
|
131
|
-
let result, listener = Listener;
|
|
132
|
-
Listener = null;
|
|
133
|
-
result = fn();
|
|
134
|
-
Listener = listener;
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
function createContext(defaultValue) {
|
|
138
|
-
const id = Symbol("context");
|
|
139
|
-
return {
|
|
140
|
-
id,
|
|
141
|
-
Provider: createProvider(id),
|
|
142
|
-
defaultValue
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
function useContext(context) {
|
|
146
|
-
return lookup(Owner, context.id) || context.defaultValue;
|
|
147
|
-
}
|
|
148
|
-
function children(fn) {
|
|
149
|
-
const children2 = createMemo(fn);
|
|
150
|
-
return createMemo(() => resolveChildren(children2()));
|
|
151
|
-
}
|
|
152
|
-
function readSignal() {
|
|
153
|
-
const runningTransition = Transition;
|
|
154
|
-
if (this.sources && (this.state || runningTransition)) {
|
|
155
|
-
const updates = Updates;
|
|
156
|
-
Updates = null;
|
|
157
|
-
this.state === STALE || runningTransition ? updateComputation(this) : lookDownstream(this);
|
|
158
|
-
Updates = updates;
|
|
159
|
-
}
|
|
160
|
-
if (Listener) {
|
|
161
|
-
const sSlot = this.observers ? this.observers.length : 0;
|
|
162
|
-
if (!Listener.sources) {
|
|
163
|
-
Listener.sources = [this];
|
|
164
|
-
Listener.sourceSlots = [sSlot];
|
|
165
|
-
} else {
|
|
166
|
-
Listener.sources.push(this);
|
|
167
|
-
Listener.sourceSlots.push(sSlot);
|
|
168
|
-
}
|
|
169
|
-
if (!this.observers) {
|
|
170
|
-
this.observers = [Listener];
|
|
171
|
-
this.observerSlots = [Listener.sources.length - 1];
|
|
172
|
-
} else {
|
|
173
|
-
this.observers.push(Listener);
|
|
174
|
-
this.observerSlots.push(Listener.sources.length - 1);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return this.value;
|
|
178
|
-
}
|
|
179
|
-
function writeSignal(node, value, isComp) {
|
|
180
|
-
if (node.comparator) {
|
|
181
|
-
if (node.comparator(node.value, value))
|
|
182
|
-
return value;
|
|
183
|
-
}
|
|
184
|
-
if (Pending) {
|
|
185
|
-
if (node.pending === NOTPENDING)
|
|
186
|
-
Pending.push(node);
|
|
187
|
-
node.pending = value;
|
|
188
|
-
return value;
|
|
189
|
-
}
|
|
190
|
-
let TransitionRunning = false;
|
|
191
|
-
node.value = value;
|
|
192
|
-
if (node.observers && node.observers.length) {
|
|
193
|
-
runUpdates(() => {
|
|
194
|
-
for (let i2 = 0; i2 < node.observers.length; i2 += 1) {
|
|
195
|
-
const o2 = node.observers[i2];
|
|
196
|
-
if (TransitionRunning && Transition.disposed.has(o2))
|
|
197
|
-
;
|
|
198
|
-
if (o2.pure)
|
|
199
|
-
Updates.push(o2);
|
|
200
|
-
else
|
|
201
|
-
Effects.push(o2);
|
|
202
|
-
if (o2.observers && (TransitionRunning && !o2.tState || !TransitionRunning && !o2.state))
|
|
203
|
-
markUpstream(o2);
|
|
204
|
-
if (TransitionRunning)
|
|
205
|
-
;
|
|
206
|
-
else
|
|
207
|
-
o2.state = STALE;
|
|
208
|
-
}
|
|
209
|
-
if (Updates.length > 1e6) {
|
|
210
|
-
Updates = [];
|
|
211
|
-
if (false)
|
|
212
|
-
;
|
|
213
|
-
throw new Error();
|
|
214
|
-
}
|
|
215
|
-
}, false);
|
|
216
|
-
}
|
|
217
|
-
return value;
|
|
218
|
-
}
|
|
219
|
-
function updateComputation(node) {
|
|
220
|
-
if (!node.fn)
|
|
221
|
-
return;
|
|
222
|
-
cleanNode(node);
|
|
223
|
-
const owner = Owner, listener = Listener, time = ExecCount;
|
|
224
|
-
Listener = Owner = node;
|
|
225
|
-
runComputation(node, node.value, time);
|
|
226
|
-
Listener = listener;
|
|
227
|
-
Owner = owner;
|
|
228
|
-
}
|
|
229
|
-
function runComputation(node, value, time) {
|
|
230
|
-
let nextValue;
|
|
231
|
-
try {
|
|
232
|
-
nextValue = node.fn(value);
|
|
233
|
-
} catch (err) {
|
|
234
|
-
handleError(err);
|
|
235
|
-
}
|
|
236
|
-
if (!node.updatedAt || node.updatedAt <= time) {
|
|
237
|
-
if (node.observers && node.observers.length) {
|
|
238
|
-
writeSignal(node, nextValue);
|
|
239
|
-
} else
|
|
240
|
-
node.value = nextValue;
|
|
241
|
-
node.updatedAt = time;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function createComputation(fn, init, pure, state = STALE, options) {
|
|
245
|
-
const c2 = {
|
|
246
|
-
fn,
|
|
247
|
-
state,
|
|
248
|
-
updatedAt: null,
|
|
249
|
-
owned: null,
|
|
250
|
-
sources: null,
|
|
251
|
-
sourceSlots: null,
|
|
252
|
-
cleanups: null,
|
|
253
|
-
value: init,
|
|
254
|
-
owner: Owner,
|
|
255
|
-
context: null,
|
|
256
|
-
pure
|
|
257
|
-
};
|
|
258
|
-
if (Owner === null)
|
|
259
|
-
;
|
|
260
|
-
else if (Owner !== UNOWNED) {
|
|
261
|
-
{
|
|
262
|
-
if (!Owner.owned)
|
|
263
|
-
Owner.owned = [c2];
|
|
264
|
-
else
|
|
265
|
-
Owner.owned.push(c2);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
return c2;
|
|
269
|
-
}
|
|
270
|
-
function runTop(node) {
|
|
271
|
-
const runningTransition = Transition;
|
|
272
|
-
if (node.state !== STALE)
|
|
273
|
-
return node.state = 0;
|
|
274
|
-
if (node.suspense && untrack(node.suspense.inFallback))
|
|
275
|
-
return node.suspense.effects.push(node);
|
|
276
|
-
const ancestors = [node];
|
|
277
|
-
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
278
|
-
if (node.state || runningTransition)
|
|
279
|
-
ancestors.push(node);
|
|
280
|
-
}
|
|
281
|
-
for (let i2 = ancestors.length - 1; i2 >= 0; i2--) {
|
|
282
|
-
node = ancestors[i2];
|
|
283
|
-
if (node.state === STALE || runningTransition) {
|
|
284
|
-
updateComputation(node);
|
|
285
|
-
} else if (node.state === PENDING || runningTransition) {
|
|
286
|
-
const updates = Updates;
|
|
287
|
-
Updates = null;
|
|
288
|
-
lookDownstream(node, ancestors[0]);
|
|
289
|
-
Updates = updates;
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
290
29
|
}
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
function runUpdates(fn, init) {
|
|
294
|
-
if (Updates)
|
|
295
|
-
return fn();
|
|
296
|
-
let wait = false;
|
|
297
|
-
if (!init)
|
|
298
|
-
Updates = [];
|
|
299
|
-
if (Effects)
|
|
300
|
-
wait = true;
|
|
301
|
-
else
|
|
302
|
-
Effects = [];
|
|
303
|
-
ExecCount++;
|
|
304
|
-
try {
|
|
305
|
-
return fn();
|
|
306
|
-
} catch (err) {
|
|
307
|
-
handleError(err);
|
|
308
|
-
} finally {
|
|
309
|
-
completeUpdates(wait);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function completeUpdates(wait) {
|
|
313
|
-
if (Updates) {
|
|
314
|
-
runQueue(Updates);
|
|
315
|
-
Updates = null;
|
|
316
|
-
}
|
|
317
|
-
if (wait)
|
|
318
|
-
return;
|
|
319
|
-
if (Effects.length)
|
|
320
|
-
batch(() => {
|
|
321
|
-
runEffects(Effects);
|
|
322
|
-
Effects = null;
|
|
323
|
-
});
|
|
324
|
-
else {
|
|
325
|
-
Effects = null;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
function runQueue(queue) {
|
|
329
|
-
for (let i2 = 0; i2 < queue.length; i2++)
|
|
330
|
-
runTop(queue[i2]);
|
|
331
|
-
}
|
|
332
|
-
function lookDownstream(node, ignore) {
|
|
333
|
-
node.state = 0;
|
|
334
|
-
const runningTransition = Transition;
|
|
335
|
-
for (let i2 = 0; i2 < node.sources.length; i2 += 1) {
|
|
336
|
-
const source = node.sources[i2];
|
|
337
|
-
if (source.sources) {
|
|
338
|
-
if (source.state === STALE || runningTransition) {
|
|
339
|
-
if (source !== ignore)
|
|
340
|
-
runTop(source);
|
|
341
|
-
} else if (source.state === PENDING || runningTransition)
|
|
342
|
-
lookDownstream(source, ignore);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
function markUpstream(node) {
|
|
347
|
-
const runningTransition = Transition;
|
|
348
|
-
for (let i2 = 0; i2 < node.observers.length; i2 += 1) {
|
|
349
|
-
const o2 = node.observers[i2];
|
|
350
|
-
if (!o2.state || runningTransition) {
|
|
351
|
-
o2.state = PENDING;
|
|
352
|
-
if (o2.pure)
|
|
353
|
-
Updates.push(o2);
|
|
354
|
-
else
|
|
355
|
-
Effects.push(o2);
|
|
356
|
-
o2.observers && markUpstream(o2);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function cleanNode(node) {
|
|
361
|
-
let i2;
|
|
362
|
-
if (node.sources) {
|
|
363
|
-
while (node.sources.length) {
|
|
364
|
-
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
365
|
-
if (obs && obs.length) {
|
|
366
|
-
const n2 = obs.pop(), s2 = source.observerSlots.pop();
|
|
367
|
-
if (index < obs.length) {
|
|
368
|
-
n2.sourceSlots[s2] = index;
|
|
369
|
-
obs[index] = n2;
|
|
370
|
-
source.observerSlots[index] = s2;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
if (node.owned) {
|
|
376
|
-
for (i2 = 0; i2 < node.owned.length; i2++)
|
|
377
|
-
cleanNode(node.owned[i2]);
|
|
378
|
-
node.owned = null;
|
|
379
|
-
}
|
|
380
|
-
if (node.cleanups) {
|
|
381
|
-
for (i2 = 0; i2 < node.cleanups.length; i2++)
|
|
382
|
-
node.cleanups[i2]();
|
|
383
|
-
node.cleanups = null;
|
|
384
|
-
}
|
|
385
|
-
node.state = 0;
|
|
386
|
-
node.context = null;
|
|
387
|
-
}
|
|
388
|
-
function handleError(err) {
|
|
389
|
-
throw err;
|
|
390
|
-
}
|
|
391
|
-
function lookup(owner, key) {
|
|
392
|
-
return owner && (owner.context && owner.context[key] !== void 0 ? owner.context[key] : owner.owner && lookup(owner.owner, key));
|
|
393
|
-
}
|
|
394
|
-
function resolveChildren(children2) {
|
|
395
|
-
if (typeof children2 === "function" && !children2.length)
|
|
396
|
-
return resolveChildren(children2());
|
|
397
|
-
if (Array.isArray(children2)) {
|
|
398
|
-
const results = [];
|
|
399
|
-
for (let i2 = 0; i2 < children2.length; i2++) {
|
|
400
|
-
const result = resolveChildren(children2[i2]);
|
|
401
|
-
Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
|
|
402
|
-
}
|
|
403
|
-
return results;
|
|
404
|
-
}
|
|
405
|
-
return children2;
|
|
406
|
-
}
|
|
407
|
-
function createProvider(id) {
|
|
408
|
-
return function provider(props) {
|
|
409
|
-
let res;
|
|
410
|
-
createComputed(() => res = untrack(() => {
|
|
411
|
-
Owner.context = {
|
|
412
|
-
[id]: props.value
|
|
413
|
-
};
|
|
414
|
-
return children(() => props.children);
|
|
415
|
-
}));
|
|
416
|
-
return res;
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
function trueFn() {
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
const propTraps = {
|
|
423
|
-
get(_, property, receiver) {
|
|
424
|
-
if (property === $PROXY)
|
|
425
|
-
return receiver;
|
|
426
|
-
return _.get(property);
|
|
427
|
-
},
|
|
428
|
-
has(_, property) {
|
|
429
|
-
return _.has(property);
|
|
430
|
-
},
|
|
431
|
-
set: trueFn,
|
|
432
|
-
deleteProperty: trueFn,
|
|
433
|
-
getOwnPropertyDescriptor(_, property) {
|
|
434
|
-
return {
|
|
435
|
-
configurable: true,
|
|
436
|
-
enumerable: true,
|
|
437
|
-
get() {
|
|
438
|
-
return _.get(property);
|
|
439
|
-
},
|
|
440
|
-
set: trueFn,
|
|
441
|
-
deleteProperty: trueFn
|
|
442
|
-
};
|
|
443
|
-
},
|
|
444
|
-
ownKeys(_) {
|
|
445
|
-
return _.keys();
|
|
446
|
-
}
|
|
30
|
+
return target;
|
|
447
31
|
};
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
function mergeProps(...sources) {
|
|
452
|
-
return new Proxy({
|
|
453
|
-
get(property) {
|
|
454
|
-
for (let i2 = sources.length - 1; i2 >= 0; i2--) {
|
|
455
|
-
const v = resolveSource(sources[i2])[property];
|
|
456
|
-
if (v !== void 0)
|
|
457
|
-
return v;
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
has(property) {
|
|
461
|
-
for (let i2 = sources.length - 1; i2 >= 0; i2--) {
|
|
462
|
-
if (property in resolveSource(sources[i2]))
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
return false;
|
|
466
|
-
},
|
|
467
|
-
keys() {
|
|
468
|
-
const keys = [];
|
|
469
|
-
for (let i2 = 0; i2 < sources.length; i2++)
|
|
470
|
-
keys.push(...Object.keys(resolveSource(sources[i2])));
|
|
471
|
-
return [...new Set(keys)];
|
|
472
|
-
}
|
|
473
|
-
}, propTraps);
|
|
474
|
-
}
|
|
475
|
-
function splitProps(props, ...keys) {
|
|
476
|
-
const blocked = new Set(keys.flat());
|
|
477
|
-
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
478
|
-
const res = keys.map((k) => {
|
|
479
|
-
const clone = {};
|
|
480
|
-
for (let i2 = 0; i2 < k.length; i2++) {
|
|
481
|
-
const key = k[i2];
|
|
482
|
-
Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
|
|
483
|
-
get() {
|
|
484
|
-
return props[key];
|
|
485
|
-
},
|
|
486
|
-
set() {
|
|
487
|
-
return true;
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
return clone;
|
|
492
|
-
});
|
|
493
|
-
res.push(new Proxy({
|
|
494
|
-
get(property) {
|
|
495
|
-
return blocked.has(property) ? void 0 : props[property];
|
|
496
|
-
},
|
|
497
|
-
has(property) {
|
|
498
|
-
return blocked.has(property) ? false : property in props;
|
|
499
|
-
},
|
|
500
|
-
keys() {
|
|
501
|
-
return Object.keys(props).filter((k) => !blocked.has(k));
|
|
502
|
-
}
|
|
503
|
-
}, propTraps));
|
|
504
|
-
return res;
|
|
505
|
-
}
|
|
506
|
-
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
507
|
-
const Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
508
|
-
const ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
509
|
-
const Aliases = {
|
|
510
|
-
className: "class",
|
|
511
|
-
htmlFor: "for"
|
|
512
|
-
};
|
|
513
|
-
const PropAliases = {
|
|
514
|
-
class: "className",
|
|
515
|
-
formnovalidate: "formNoValidate",
|
|
516
|
-
ismap: "isMap",
|
|
517
|
-
nomodule: "noModule",
|
|
518
|
-
playsinline: "playsInline",
|
|
519
|
-
readonly: "readOnly"
|
|
520
|
-
};
|
|
521
|
-
const DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
522
|
-
const SVGNamespace = {
|
|
523
|
-
xlink: "http://www.w3.org/1999/xlink",
|
|
524
|
-
xml: "http://www.w3.org/XML/1998/namespace"
|
|
525
|
-
};
|
|
526
|
-
function reconcileArrays(parentNode, a2, b) {
|
|
527
|
-
let bLength = b.length, aEnd = a2.length, bEnd = bLength, aStart = 0, bStart = 0, after = a2[aEnd - 1].nextSibling, map = null;
|
|
528
|
-
while (aStart < aEnd || bStart < bEnd) {
|
|
529
|
-
if (a2[aStart] === b[bStart]) {
|
|
530
|
-
aStart++;
|
|
531
|
-
bStart++;
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
while (a2[aEnd - 1] === b[bEnd - 1]) {
|
|
535
|
-
aEnd--;
|
|
536
|
-
bEnd--;
|
|
537
|
-
}
|
|
538
|
-
if (aEnd === aStart) {
|
|
539
|
-
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
540
|
-
while (bStart < bEnd)
|
|
541
|
-
parentNode.insertBefore(b[bStart++], node);
|
|
542
|
-
} else if (bEnd === bStart) {
|
|
543
|
-
while (aStart < aEnd) {
|
|
544
|
-
if (!map || !map.has(a2[aStart]))
|
|
545
|
-
a2[aStart].remove();
|
|
546
|
-
aStart++;
|
|
547
|
-
}
|
|
548
|
-
} else if (a2[aStart] === b[bEnd - 1] && b[bStart] === a2[aEnd - 1]) {
|
|
549
|
-
const node = a2[--aEnd].nextSibling;
|
|
550
|
-
parentNode.insertBefore(b[bStart++], a2[aStart++].nextSibling);
|
|
551
|
-
parentNode.insertBefore(b[--bEnd], node);
|
|
552
|
-
a2[aEnd] = b[bEnd];
|
|
553
|
-
} else {
|
|
554
|
-
if (!map) {
|
|
555
|
-
map = /* @__PURE__ */ new Map();
|
|
556
|
-
let i2 = bStart;
|
|
557
|
-
while (i2 < bEnd)
|
|
558
|
-
map.set(b[i2], i2++);
|
|
559
|
-
}
|
|
560
|
-
const index = map.get(a2[aStart]);
|
|
561
|
-
if (index != null) {
|
|
562
|
-
if (bStart < index && index < bEnd) {
|
|
563
|
-
let i2 = aStart, sequence = 1, t2;
|
|
564
|
-
while (++i2 < aEnd && i2 < bEnd) {
|
|
565
|
-
if ((t2 = map.get(a2[i2])) == null || t2 !== index + sequence)
|
|
566
|
-
break;
|
|
567
|
-
sequence++;
|
|
568
|
-
}
|
|
569
|
-
if (sequence > index - bStart) {
|
|
570
|
-
const node = a2[aStart];
|
|
571
|
-
while (bStart < index)
|
|
572
|
-
parentNode.insertBefore(b[bStart++], node);
|
|
573
|
-
} else
|
|
574
|
-
parentNode.replaceChild(b[bStart++], a2[aStart++]);
|
|
575
|
-
} else
|
|
576
|
-
aStart++;
|
|
577
|
-
} else
|
|
578
|
-
a2[aStart++].remove();
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
const $$EVENTS = "_$DX_DELEGATE";
|
|
583
|
-
function delegateEvents(eventNames, document2 = window.document) {
|
|
584
|
-
const e2 = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
585
|
-
for (let i2 = 0, l2 = eventNames.length; i2 < l2; i2++) {
|
|
586
|
-
const name = eventNames[i2];
|
|
587
|
-
if (!e2.has(name)) {
|
|
588
|
-
e2.add(name);
|
|
589
|
-
document2.addEventListener(name, eventHandler);
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
function setAttribute(node, name, value) {
|
|
594
|
-
if (value == null)
|
|
595
|
-
node.removeAttribute(name);
|
|
596
|
-
else
|
|
597
|
-
node.setAttribute(name, value);
|
|
598
|
-
}
|
|
599
|
-
function setAttributeNS(node, namespace, name, value) {
|
|
600
|
-
if (value == null)
|
|
601
|
-
node.removeAttributeNS(namespace, name);
|
|
602
|
-
else
|
|
603
|
-
node.setAttributeNS(namespace, name, value);
|
|
604
|
-
}
|
|
605
|
-
function addEventListener(node, name, handler, delegate) {
|
|
606
|
-
if (delegate) {
|
|
607
|
-
if (Array.isArray(handler)) {
|
|
608
|
-
node[`$$${name}`] = handler[0];
|
|
609
|
-
node[`$$${name}Data`] = handler[1];
|
|
610
|
-
} else
|
|
611
|
-
node[`$$${name}`] = handler;
|
|
612
|
-
} else if (Array.isArray(handler)) {
|
|
613
|
-
node.addEventListener(name, (e2) => handler[0](handler[1], e2));
|
|
614
|
-
} else
|
|
615
|
-
node.addEventListener(name, handler);
|
|
616
|
-
}
|
|
617
|
-
function classList(node, value, prev = {}) {
|
|
618
|
-
const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
|
|
619
|
-
let i2, len;
|
|
620
|
-
for (i2 = 0, len = prevKeys.length; i2 < len; i2++) {
|
|
621
|
-
const key = prevKeys[i2];
|
|
622
|
-
if (!key || key === "undefined" || value[key])
|
|
623
|
-
continue;
|
|
624
|
-
toggleClassKey(node, key, false);
|
|
625
|
-
delete prev[key];
|
|
626
|
-
}
|
|
627
|
-
for (i2 = 0, len = classKeys.length; i2 < len; i2++) {
|
|
628
|
-
const key = classKeys[i2], classValue = !!value[key];
|
|
629
|
-
if (!key || key === "undefined" || prev[key] === classValue || !classValue)
|
|
630
|
-
continue;
|
|
631
|
-
toggleClassKey(node, key, true);
|
|
632
|
-
prev[key] = classValue;
|
|
633
|
-
}
|
|
634
|
-
return prev;
|
|
635
|
-
}
|
|
636
|
-
function style(node, value, prev = {}) {
|
|
637
|
-
const nodeStyle = node.style;
|
|
638
|
-
if (value == null || typeof value === "string")
|
|
639
|
-
return nodeStyle.cssText = value;
|
|
640
|
-
typeof prev === "string" && (prev = {});
|
|
641
|
-
let v, s2;
|
|
642
|
-
for (s2 in prev) {
|
|
643
|
-
value[s2] == null && nodeStyle.removeProperty(s2);
|
|
644
|
-
delete prev[s2];
|
|
645
|
-
}
|
|
646
|
-
for (s2 in value) {
|
|
647
|
-
v = value[s2];
|
|
648
|
-
if (v !== prev[s2]) {
|
|
649
|
-
nodeStyle.setProperty(s2, v);
|
|
650
|
-
prev[s2] = v;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
return prev;
|
|
654
|
-
}
|
|
655
|
-
function spread(node, accessor, isSVG, skipChildren) {
|
|
656
|
-
if (typeof accessor === "function") {
|
|
657
|
-
createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
|
|
658
|
-
} else
|
|
659
|
-
spreadExpression(node, accessor, void 0, isSVG, skipChildren);
|
|
660
|
-
}
|
|
661
|
-
function assign(node, props, isSVG, skipChildren, prevProps = {}) {
|
|
662
|
-
for (const prop in prevProps) {
|
|
663
|
-
if (!(prop in props)) {
|
|
664
|
-
if (prop === "children")
|
|
665
|
-
continue;
|
|
666
|
-
assignProp(node, prop, null, prevProps[prop], isSVG);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
for (const prop in props) {
|
|
670
|
-
if (prop === "children") {
|
|
671
|
-
if (!skipChildren)
|
|
672
|
-
insertExpression(node, props.children);
|
|
673
|
-
continue;
|
|
674
|
-
}
|
|
675
|
-
const value = props[prop];
|
|
676
|
-
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG);
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
function toPropertyName(name) {
|
|
680
|
-
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
681
|
-
}
|
|
682
|
-
function toggleClassKey(node, key, value) {
|
|
683
|
-
const classNames = key.trim().split(/\s+/);
|
|
684
|
-
for (let i2 = 0, nameLen = classNames.length; i2 < nameLen; i2++)
|
|
685
|
-
node.classList.toggle(classNames[i2], value);
|
|
686
|
-
}
|
|
687
|
-
function assignProp(node, prop, value, prev, isSVG) {
|
|
688
|
-
let isCE, isProp, isChildProp;
|
|
689
|
-
if (prop === "style")
|
|
690
|
-
return style(node, value, prev);
|
|
691
|
-
if (prop === "classList")
|
|
692
|
-
return classList(node, value, prev);
|
|
693
|
-
if (value === prev)
|
|
694
|
-
return prev;
|
|
695
|
-
if (prop === "ref") {
|
|
696
|
-
value(node);
|
|
697
|
-
} else if (prop.slice(0, 3) === "on:") {
|
|
698
|
-
node.addEventListener(prop.slice(3), value);
|
|
699
|
-
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
700
|
-
node.addEventListener(prop.slice(10), value, true);
|
|
701
|
-
} else if (prop.slice(0, 2) === "on") {
|
|
702
|
-
const name = prop.slice(2).toLowerCase();
|
|
703
|
-
const delegate = DelegatedEvents.has(name);
|
|
704
|
-
addEventListener(node, name, value, delegate);
|
|
705
|
-
delegate && delegateEvents([name]);
|
|
706
|
-
} else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) {
|
|
707
|
-
if (isCE && !isProp && !isChildProp)
|
|
708
|
-
node[toPropertyName(prop)] = value;
|
|
709
|
-
else
|
|
710
|
-
node[PropAliases[prop] || prop] = value;
|
|
711
|
-
} else {
|
|
712
|
-
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
713
|
-
if (ns)
|
|
714
|
-
setAttributeNS(node, ns, prop, value);
|
|
715
|
-
else
|
|
716
|
-
setAttribute(node, Aliases[prop] || prop, value);
|
|
717
|
-
}
|
|
718
|
-
return value;
|
|
719
|
-
}
|
|
720
|
-
function eventHandler(e2) {
|
|
721
|
-
const key = `$$${e2.type}`;
|
|
722
|
-
let node = e2.composedPath && e2.composedPath()[0] || e2.target;
|
|
723
|
-
if (e2.target !== node) {
|
|
724
|
-
Object.defineProperty(e2, "target", {
|
|
725
|
-
configurable: true,
|
|
726
|
-
value: node
|
|
727
|
-
});
|
|
728
|
-
}
|
|
729
|
-
Object.defineProperty(e2, "currentTarget", {
|
|
730
|
-
configurable: true,
|
|
731
|
-
get() {
|
|
732
|
-
return node || document;
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
while (node !== null) {
|
|
736
|
-
const handler = node[key];
|
|
737
|
-
if (handler && !node.disabled) {
|
|
738
|
-
const data = node[`${key}Data`];
|
|
739
|
-
data !== void 0 ? handler(data, e2) : handler(e2);
|
|
740
|
-
if (e2.cancelBubble)
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
|
|
747
|
-
if (!skipChildren && "children" in props) {
|
|
748
|
-
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
749
|
-
}
|
|
750
|
-
createRenderEffect(() => assign(node, props, isSVG, true, prevProps));
|
|
751
|
-
return prevProps;
|
|
752
|
-
}
|
|
753
|
-
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
754
|
-
while (typeof current === "function")
|
|
755
|
-
current = current();
|
|
756
|
-
if (value === current)
|
|
757
|
-
return current;
|
|
758
|
-
const t2 = typeof value, multi = marker !== void 0;
|
|
759
|
-
parent = multi && current[0] && current[0].parentNode || parent;
|
|
760
|
-
if (t2 === "string" || t2 === "number") {
|
|
761
|
-
if (t2 === "number")
|
|
762
|
-
value = value.toString();
|
|
763
|
-
if (multi) {
|
|
764
|
-
let node = current[0];
|
|
765
|
-
if (node && node.nodeType === 3) {
|
|
766
|
-
node.data = value;
|
|
767
|
-
} else
|
|
768
|
-
node = document.createTextNode(value);
|
|
769
|
-
current = cleanChildren(parent, current, marker, node);
|
|
770
|
-
} else {
|
|
771
|
-
if (current !== "" && typeof current === "string") {
|
|
772
|
-
current = parent.firstChild.data = value;
|
|
773
|
-
} else
|
|
774
|
-
current = parent.textContent = value;
|
|
775
|
-
}
|
|
776
|
-
} else if (value == null || t2 === "boolean") {
|
|
777
|
-
current = cleanChildren(parent, current, marker);
|
|
778
|
-
} else if (t2 === "function") {
|
|
779
|
-
createRenderEffect(() => {
|
|
780
|
-
let v = value();
|
|
781
|
-
while (typeof v === "function")
|
|
782
|
-
v = v();
|
|
783
|
-
current = insertExpression(parent, v, current, marker);
|
|
784
|
-
});
|
|
785
|
-
return () => current;
|
|
786
|
-
} else if (Array.isArray(value)) {
|
|
787
|
-
const array = [];
|
|
788
|
-
if (normalizeIncomingArray(array, value, unwrapArray)) {
|
|
789
|
-
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
790
|
-
return () => current;
|
|
791
|
-
}
|
|
792
|
-
if (array.length === 0) {
|
|
793
|
-
current = cleanChildren(parent, current, marker);
|
|
794
|
-
if (multi)
|
|
795
|
-
return current;
|
|
796
|
-
} else if (Array.isArray(current)) {
|
|
797
|
-
if (current.length === 0) {
|
|
798
|
-
appendNodes(parent, array, marker);
|
|
799
|
-
} else
|
|
800
|
-
reconcileArrays(parent, current, array);
|
|
801
|
-
} else {
|
|
802
|
-
current && cleanChildren(parent);
|
|
803
|
-
appendNodes(parent, array);
|
|
804
|
-
}
|
|
805
|
-
current = array;
|
|
806
|
-
} else if (value instanceof Node) {
|
|
807
|
-
if (Array.isArray(current)) {
|
|
808
|
-
if (multi)
|
|
809
|
-
return current = cleanChildren(parent, current, marker, value);
|
|
810
|
-
cleanChildren(parent, current, null, value);
|
|
811
|
-
} else if (current == null || current === "" || !parent.firstChild) {
|
|
812
|
-
parent.appendChild(value);
|
|
813
|
-
} else
|
|
814
|
-
parent.replaceChild(value, parent.firstChild);
|
|
815
|
-
current = value;
|
|
816
|
-
} else
|
|
817
|
-
;
|
|
818
|
-
return current;
|
|
819
|
-
}
|
|
820
|
-
function normalizeIncomingArray(normalized, array, unwrap) {
|
|
821
|
-
let dynamic = false;
|
|
822
|
-
for (let i2 = 0, len = array.length; i2 < len; i2++) {
|
|
823
|
-
let item = array[i2], t2;
|
|
824
|
-
if (item instanceof Node) {
|
|
825
|
-
normalized.push(item);
|
|
826
|
-
} else if (item == null || item === true || item === false)
|
|
827
|
-
;
|
|
828
|
-
else if (Array.isArray(item)) {
|
|
829
|
-
dynamic = normalizeIncomingArray(normalized, item) || dynamic;
|
|
830
|
-
} else if ((t2 = typeof item) === "string") {
|
|
831
|
-
normalized.push(document.createTextNode(item));
|
|
832
|
-
} else if (t2 === "function") {
|
|
833
|
-
if (unwrap) {
|
|
834
|
-
while (typeof item === "function")
|
|
835
|
-
item = item();
|
|
836
|
-
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
837
|
-
} else {
|
|
838
|
-
normalized.push(item);
|
|
839
|
-
dynamic = true;
|
|
840
|
-
}
|
|
841
|
-
} else
|
|
842
|
-
normalized.push(document.createTextNode(item.toString()));
|
|
843
|
-
}
|
|
844
|
-
return dynamic;
|
|
845
|
-
}
|
|
846
|
-
function appendNodes(parent, array, marker) {
|
|
847
|
-
for (let i2 = 0, len = array.length; i2 < len; i2++)
|
|
848
|
-
parent.insertBefore(array[i2], marker);
|
|
849
|
-
}
|
|
850
|
-
function cleanChildren(parent, current, marker, replacement) {
|
|
851
|
-
if (marker === void 0)
|
|
852
|
-
return parent.textContent = "";
|
|
853
|
-
const node = replacement || document.createTextNode("");
|
|
854
|
-
if (current.length) {
|
|
855
|
-
let inserted = false;
|
|
856
|
-
for (let i2 = current.length - 1; i2 >= 0; i2--) {
|
|
857
|
-
const el = current[i2];
|
|
858
|
-
if (node !== el) {
|
|
859
|
-
const isParent = el.parentNode === parent;
|
|
860
|
-
if (!inserted && !i2)
|
|
861
|
-
isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
862
|
-
else
|
|
863
|
-
isParent && el.remove();
|
|
864
|
-
} else
|
|
865
|
-
inserted = true;
|
|
866
|
-
}
|
|
867
|
-
} else
|
|
868
|
-
parent.insertBefore(node, marker);
|
|
869
|
-
return [node];
|
|
870
|
-
}
|
|
871
|
-
function ssr(template, ...nodes) {
|
|
872
|
-
}
|
|
873
|
-
function ssrSpread(accessor) {
|
|
874
|
-
}
|
|
875
|
-
const isServer = false;
|
|
876
|
-
const ThemeContext = createContext();
|
|
877
|
-
function makeStyled(tag) {
|
|
878
|
-
let _ctx = this || {};
|
|
879
|
-
return (...args) => {
|
|
880
|
-
const Styled = (props) => {
|
|
881
|
-
const theme = useContext(ThemeContext);
|
|
882
|
-
const withTheme = mergeProps(props, { theme });
|
|
883
|
-
const clone = mergeProps(withTheme, {
|
|
884
|
-
get className() {
|
|
885
|
-
const pClassName = withTheme.className, append = "className" in withTheme && /^go[0-9]+/.test(pClassName);
|
|
886
|
-
let className = u.apply({ target: _ctx.target, o: append, p: withTheme, g: _ctx.g }, args);
|
|
887
|
-
return [pClassName, className].filter(Boolean).join(" ");
|
|
888
|
-
}
|
|
889
|
-
});
|
|
890
|
-
const [local, newProps] = splitProps(clone, ["as"]);
|
|
891
|
-
const createTag = local.as || tag;
|
|
892
|
-
let el;
|
|
893
|
-
if (typeof createTag === "function") {
|
|
894
|
-
el = createTag(newProps);
|
|
895
|
-
} else if (isServer) {
|
|
896
|
-
const [local2, others] = splitProps(newProps, ["children"]);
|
|
897
|
-
el = ssr([`<${createTag} `, ">", `</${createTag}>`], ssrSpread(), local2.children || "");
|
|
898
|
-
} else {
|
|
899
|
-
el = document.createElement(createTag);
|
|
900
|
-
spread(el, newProps);
|
|
901
|
-
}
|
|
902
|
-
return el;
|
|
903
|
-
};
|
|
904
|
-
Styled.className = (props) => {
|
|
905
|
-
return untrack(() => {
|
|
906
|
-
return u.apply({ target: _ctx.target, p: props, g: _ctx.g }, args);
|
|
907
|
-
});
|
|
908
|
-
};
|
|
909
|
-
return Styled;
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
const styled = new Proxy(makeStyled, {
|
|
913
|
-
get(target, tag) {
|
|
914
|
-
return target(tag);
|
|
915
|
-
}
|
|
916
|
-
});
|
|
32
|
+
import { styled, css } from "solid-styled-components";
|
|
33
|
+
import { init, registerCallback } from "@bedrock-layout/register-resize-callback";
|
|
34
|
+
import { createSignal, onMount, createEffect, onCleanup, Switch, Match } from "solid-js";
|
|
917
35
|
function checkIsCSSLength(str) {
|
|
918
36
|
if (typeof str !== "string")
|
|
919
37
|
return false;
|
|
@@ -958,7 +76,7 @@ function getSafeMaxWidth(maxWidth) {
|
|
|
958
76
|
return `${maxWidth}px`;
|
|
959
77
|
return maxWidth;
|
|
960
78
|
}
|
|
961
|
-
const Center = styled
|
|
79
|
+
const Center = styled.div`
|
|
962
80
|
@property --maxWidth {
|
|
963
81
|
syntax: "<length-percentage>";
|
|
964
82
|
inherits: false;
|
|
@@ -977,13 +95,13 @@ const Center = styled("div")`
|
|
|
977
95
|
|
|
978
96
|
max-inline-size: var(--maxWidth, 100%);
|
|
979
97
|
|
|
980
|
-
${(props) => props.centerChildren ?
|
|
98
|
+
${(props) => props.centerChildren ? css`
|
|
981
99
|
display: flex;
|
|
982
100
|
flex-direction: column;
|
|
983
101
|
align-items: center;
|
|
984
102
|
` : ""}
|
|
985
103
|
|
|
986
|
-
${(props) => props.centerText ?
|
|
104
|
+
${(props) => props.centerText ? css`
|
|
987
105
|
text-align: center;
|
|
988
106
|
` : ""}
|
|
989
107
|
`;
|
|
@@ -1025,6 +143,31 @@ const ColumnDrop = styled("div")`
|
|
|
1025
143
|
flex-wrap: wrap;
|
|
1026
144
|
gap: var(--gutter, 0px);
|
|
1027
145
|
`;
|
|
146
|
+
function createContainerQuery(width = 1, maxWidth) {
|
|
147
|
+
if (maxWidth !== void 0 && maxWidth <= width) {
|
|
148
|
+
throw new Error(`The second width value, ${maxWidth}, is not larger than ${width}. Please provide a value greater than first width value`);
|
|
149
|
+
}
|
|
150
|
+
const [matches, setMatch] = createSignal(false);
|
|
151
|
+
const [node, nodeRef] = createSignal();
|
|
152
|
+
onMount(() => {
|
|
153
|
+
init();
|
|
154
|
+
});
|
|
155
|
+
createEffect(() => {
|
|
156
|
+
const ref = node();
|
|
157
|
+
if (ref === void 0 || ref === null)
|
|
158
|
+
return;
|
|
159
|
+
const cleanup = registerCallback(ref, (entry) => {
|
|
160
|
+
var _a, _b;
|
|
161
|
+
const nodeWidth = (_b = (_a = entry.borderBoxSize) == null ? void 0 : _a.inlineSize) != null ? _b : entry.contentRect.width;
|
|
162
|
+
if (nodeWidth > 0) {
|
|
163
|
+
const newMatch = maxWidth === void 0 ? nodeWidth <= width : nodeWidth >= width && nodeWidth <= maxWidth;
|
|
164
|
+
setMatch(newMatch);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
onCleanup(cleanup);
|
|
168
|
+
});
|
|
169
|
+
return [matches, nodeRef];
|
|
170
|
+
}
|
|
1028
171
|
function checkIsRatio(ratio) {
|
|
1029
172
|
const isCorrectArray = Array.isArray(ratio) && ratio.length === 2 && ratio.every(Number.isFinite);
|
|
1030
173
|
return isCorrectArray || typeof ratio === "string" && /^\d{1,1000} {0,1}\/ {0,1}\d{1,1000}$/.test(ratio);
|
|
@@ -1046,7 +189,7 @@ const Frame = styled.div`
|
|
|
1046
189
|
${(props) => {
|
|
1047
190
|
const maybeRatio = getSafeRatio(props.ratio);
|
|
1048
191
|
if (maybeRatio) {
|
|
1049
|
-
return
|
|
192
|
+
return css`
|
|
1050
193
|
aspect-ratio: ${maybeRatio};
|
|
1051
194
|
`;
|
|
1052
195
|
}
|
|
@@ -1216,7 +359,7 @@ function paddingToString(theme, padding) {
|
|
|
1216
359
|
console.error("Invalid padding Type");
|
|
1217
360
|
}
|
|
1218
361
|
const getPadding = paddingOrDefault(theme);
|
|
1219
|
-
return typeof padding === "object" && !Array.isArray(padding) ? Object.entries(padding).reduce((acc, [key, val]) => validKeys.has(key) ? acc + keyToProperty(key, getPadding(val)) : acc, "") : padding ? `padding: ${Array.from(Array.isArray(padding) ? padding : [padding]).map((pad) => getPadding(pad)).join(" ")}
|
|
362
|
+
return typeof padding === "object" && !Array.isArray(padding) ? Object.entries(padding).reduce((acc, [key, val]) => validKeys.has(key) ? acc + keyToProperty(key, getPadding(val)) : acc, "") : padding !== void 0 ? `padding: ${Array.from(Array.isArray(padding) ? padding : [padding]).map((pad) => getPadding(pad)).join(" ")};` : "";
|
|
1220
363
|
}
|
|
1221
364
|
const PadBox = styled.div`
|
|
1222
365
|
box-sizing: border-box;
|
|
@@ -1281,4 +424,173 @@ const Stack = styled("div")`
|
|
|
1281
424
|
grid-column: span 1 / auto;
|
|
1282
425
|
}
|
|
1283
426
|
`;
|
|
1284
|
-
|
|
427
|
+
const fractions = {
|
|
428
|
+
"1/4": "1fr 3fr",
|
|
429
|
+
"1/3": "1fr 2fr",
|
|
430
|
+
"1/2": "1fr 1fr",
|
|
431
|
+
"2/3": "2fr 1fr",
|
|
432
|
+
"3/4": "3fr 1fr",
|
|
433
|
+
"auto-start": `auto 1fr`,
|
|
434
|
+
"auto-end": `1fr auto`
|
|
435
|
+
};
|
|
436
|
+
const SplitBase = styled.div`
|
|
437
|
+
box-sizing: border-box;
|
|
438
|
+
> * {
|
|
439
|
+
margin: 0;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
--gutter: ${(props) => {
|
|
443
|
+
var _a;
|
|
444
|
+
return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
|
|
445
|
+
}};
|
|
446
|
+
|
|
447
|
+
display: grid;
|
|
448
|
+
gap: var(--gutter, 0px);
|
|
449
|
+
grid-template-columns: ${({ fraction = "1/2" }) => {
|
|
450
|
+
var _a;
|
|
451
|
+
return (_a = fractions[fraction]) != null ? _a : fractions["1/2"];
|
|
452
|
+
}}};
|
|
453
|
+
`;
|
|
454
|
+
const Split = (props) => {
|
|
455
|
+
const maybePx = typeof props.switchAt === "string" ? toPX(props.switchAt) : props.switchAt;
|
|
456
|
+
const widthToSwitchAt = maybePx && maybePx > -1 ? maybePx : 0;
|
|
457
|
+
console.log(widthToSwitchAt);
|
|
458
|
+
const [shouldSwitch, nodeRef] = createContainerQuery(widthToSwitchAt);
|
|
459
|
+
const combineRef = (ref) => {
|
|
460
|
+
var _a;
|
|
461
|
+
nodeRef(ref);
|
|
462
|
+
(_a = props.ref) == null ? void 0 : _a.call(props, ref);
|
|
463
|
+
};
|
|
464
|
+
return /* @__PURE__ */ React.createElement(Switch, null, /* @__PURE__ */ React.createElement(Match, {
|
|
465
|
+
when: shouldSwitch() === false
|
|
466
|
+
}, /* @__PURE__ */ React.createElement(SplitBase, __spreadValues({
|
|
467
|
+
as: props.as,
|
|
468
|
+
ref: combineRef,
|
|
469
|
+
fraction: props.fraction
|
|
470
|
+
}, props))), /* @__PURE__ */ React.createElement(Match, {
|
|
471
|
+
when: shouldSwitch() === true
|
|
472
|
+
}, /* @__PURE__ */ React.createElement(Stack, __spreadValues({
|
|
473
|
+
as: props.as,
|
|
474
|
+
ref: combineRef
|
|
475
|
+
}, props))));
|
|
476
|
+
};
|
|
477
|
+
function parseUnit(str) {
|
|
478
|
+
var _a;
|
|
479
|
+
str = String(str);
|
|
480
|
+
const num = parseFloat(str);
|
|
481
|
+
const [, unit] = (_a = str.match(/[\d.\-+]*\s*(.*)/)) != null ? _a : ["", ""];
|
|
482
|
+
return [num, unit];
|
|
483
|
+
}
|
|
484
|
+
function getPropertyInPX(element, prop) {
|
|
485
|
+
var _a;
|
|
486
|
+
const [value, units] = parseUnit(getComputedStyle(element).getPropertyValue(prop));
|
|
487
|
+
return value * ((_a = toPX(units, element)) != null ? _a : 1);
|
|
488
|
+
}
|
|
489
|
+
function getSizeBrutal(unit, element) {
|
|
490
|
+
const testDIV = document.createElement("div");
|
|
491
|
+
testDIV.style["height"] = "128" + unit;
|
|
492
|
+
element.appendChild(testDIV);
|
|
493
|
+
const size = getPropertyInPX(testDIV, "height") / 128;
|
|
494
|
+
element.removeChild(testDIV);
|
|
495
|
+
return size;
|
|
496
|
+
}
|
|
497
|
+
function toPX(str, element) {
|
|
498
|
+
if (!str)
|
|
499
|
+
return null;
|
|
500
|
+
const isBrowser = typeof window === "object" && typeof document === "object" && document.nodeType === 9;
|
|
501
|
+
const PIXELS_PER_INCH = isBrowser ? getSizeBrutal("in", document.body) : 96;
|
|
502
|
+
const elementOrBody = element != null ? element : document.body;
|
|
503
|
+
const safeStr = (str != null ? str : "px").trim().toLowerCase();
|
|
504
|
+
switch (safeStr) {
|
|
505
|
+
case "vmin":
|
|
506
|
+
case "vmax":
|
|
507
|
+
case "vh":
|
|
508
|
+
case "vw":
|
|
509
|
+
case "%":
|
|
510
|
+
return null;
|
|
511
|
+
case "ch":
|
|
512
|
+
case "ex":
|
|
513
|
+
return getSizeBrutal(safeStr, elementOrBody);
|
|
514
|
+
case "em":
|
|
515
|
+
return getPropertyInPX(elementOrBody, "font-size");
|
|
516
|
+
case "rem":
|
|
517
|
+
return getPropertyInPX(document.body, "font-size");
|
|
518
|
+
case "in":
|
|
519
|
+
return PIXELS_PER_INCH;
|
|
520
|
+
case "cm":
|
|
521
|
+
return PIXELS_PER_INCH / 2.54;
|
|
522
|
+
case "mm":
|
|
523
|
+
return PIXELS_PER_INCH / 25.4;
|
|
524
|
+
case "pt":
|
|
525
|
+
return PIXELS_PER_INCH / 72;
|
|
526
|
+
case "pc":
|
|
527
|
+
return PIXELS_PER_INCH / 6;
|
|
528
|
+
case "px":
|
|
529
|
+
return 1;
|
|
530
|
+
default: {
|
|
531
|
+
const [value, units] = parseUnit(safeStr);
|
|
532
|
+
if (isNaN(value))
|
|
533
|
+
return null;
|
|
534
|
+
if (!units)
|
|
535
|
+
return value;
|
|
536
|
+
const px = toPX(units, element);
|
|
537
|
+
return typeof px === "number" ? value * px : null;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function getSafeMinHeight(minHeight) {
|
|
542
|
+
if (typeof minHeight === "number")
|
|
543
|
+
return `${minHeight}px`;
|
|
544
|
+
return minHeight && checkIsCSSLength(minHeight) ? minHeight : "100vh";
|
|
545
|
+
}
|
|
546
|
+
const CoverWrapper = styled.div`
|
|
547
|
+
@property --gutter {
|
|
548
|
+
syntax: "<length-percentage>";
|
|
549
|
+
inherits: false;
|
|
550
|
+
initial-value: 0;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
@property --minHeight {
|
|
554
|
+
syntax: "<length-percentage>";
|
|
555
|
+
inherits: false;
|
|
556
|
+
initial-value: 100vh;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
--gutter: ${(props) => {
|
|
560
|
+
var _a;
|
|
561
|
+
return props.gutter ? (_a = getSpacingValue(props.gutter, props.theme)) != null ? _a : "0px" : "0px";
|
|
562
|
+
}};
|
|
563
|
+
|
|
564
|
+
--minHeight: ${(props) => getSafeMinHeight(props.minHeight)};
|
|
565
|
+
|
|
566
|
+
> * {
|
|
567
|
+
margin: 0;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
display: flex;
|
|
571
|
+
flex-direction: column;
|
|
572
|
+
gap: var(--gutter, 0px);
|
|
573
|
+
|
|
574
|
+
min-block-size: var(--minHeight, 100vh);
|
|
575
|
+
|
|
576
|
+
> [data-bedrock-cover-centered] {
|
|
577
|
+
margin-block-start: auto;
|
|
578
|
+
margin-block-end: auto;
|
|
579
|
+
|
|
580
|
+
${({ stretchContent }) => stretchContent === true ? `
|
|
581
|
+
flex: 1;
|
|
582
|
+
display: flex;
|
|
583
|
+
flex-direction: column;
|
|
584
|
+
> * {
|
|
585
|
+
flex: 1;
|
|
586
|
+
}
|
|
587
|
+
` : ""};
|
|
588
|
+
}
|
|
589
|
+
`;
|
|
590
|
+
const Cover = (props) => {
|
|
591
|
+
const _a = props, { top, bottom, children } = _a, rest = __objRest(_a, ["top", "bottom", "children"]);
|
|
592
|
+
return /* @__PURE__ */ React.createElement(CoverWrapper, __spreadValues({}, rest), props.top, /* @__PURE__ */ React.createElement("div", {
|
|
593
|
+
"data-bedrock-cover-centered": true
|
|
594
|
+
}, props.children), props.bottom);
|
|
595
|
+
};
|
|
596
|
+
export { Center, ColumnDrop, Cover, Frame, Grid, Inline, InlineCluster, PadBox, Reel, Split, Stack, checkIsCSSLength, createContainerQuery, getSpacingValue, spacing };
|