@getvitops/core 8.0.1 → 8.1.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/CHANGELOG.md +57 -0
- package/css/layout-utilities.css +13 -0
- package/css/layout.css +31 -0
- package/css/patterns/banner.css +7 -0
- package/css/patterns/cluster.css +19 -0
- package/css/patterns/comment.css +18 -0
- package/css/patterns/gallery.css +16 -0
- package/css/patterns/list.css +17 -0
- package/css/patterns/marquee.css +6 -0
- package/css/patterns/masonry.css +18 -0
- package/dist/elements.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# @getvitops/core
|
|
2
2
|
|
|
3
|
+
## 8.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- **Added — `.no-rhythm` utility (all formats).**
|
|
8
|
+
|
|
9
|
+
A `<ul>`/`<ol>` inside a `.rhythm` container picks up a top margin on every item but the first
|
|
10
|
+
(`.rhythm :where(ul, ol) > li + li`), which is correct for prose but wrong for a list whose item
|
|
11
|
+
spacing is already a `gap`-based grid or flex wrap the framework has no pattern for. `.gallery`,
|
|
12
|
+
`.tag-list`, `.cluster`, `.masonry`, `.comment-thread`, `.subgrid` and `.grid-auto` already
|
|
13
|
+
neutralise this automatically; `.no-rhythm` is the same escape hatch for a consumer's own custom
|
|
14
|
+
list — add it alongside your own class (`<ul class="my-cards no-rhythm">`) to opt out. It wins by
|
|
15
|
+
cascade layer (`vitops.utilities`, later than every pattern's `vitops.components`), the same
|
|
16
|
+
guarantee a colour utility uses to beat a pattern's own background — no selector tricks needed on
|
|
17
|
+
your end.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- **Fixed — `.banner[hidden]` now actually hides (all formats).**
|
|
22
|
+
|
|
23
|
+
`.banner`'s own `display: flex` and the UA `[hidden] { display: none }` rule are both 0-1-0
|
|
24
|
+
specificity, and the author stylesheet wins that tie by source order — so `<p class="banner" hidden>`
|
|
25
|
+
rendered visibly instead of hiding. Added an explicit `.banner[hidden] { display: none }` override.
|
|
26
|
+
No markup change required.
|
|
27
|
+
|
|
28
|
+
- **Added — `vitops init --site` and `vitops setup`, the scripted client-onboarding path.**
|
|
29
|
+
|
|
30
|
+
`vitops init --site [--name] [--url]` scaffolds a starter `site.json` (the umbrella `Config`,
|
|
31
|
+
embedding a starter design system at `designSystem.themes.default`) instead of a bare
|
|
32
|
+
`design-system.json` — exported as `defaultSiteConfig()` from `@getvitops/generator`, alongside a
|
|
33
|
+
new `CONFIG_SCHEMA_LOCAL_PATH` and an optional `$schema` field on `ConfigSchema` so a scaffolded
|
|
34
|
+
config gets editor autocomplete the same way `design-system.json` already does.
|
|
35
|
+
|
|
36
|
+
`vitops setup <repo|hosting|domain|search|ads|all>` (new `@getvitops/utils/hosting` subpath: a
|
|
37
|
+
pure planner + `wrangler`/`gh`-shelling executors, following the same idempotent
|
|
38
|
+
plan/observe/apply split as `onboarding`/`ads`) automates GitHub repo + branch policy and
|
|
39
|
+
Cloudflare dev D1/R2 + repo secrets, and plans/checks the workers.dev-vs-custom-domain
|
|
40
|
+
consistency without ever applying the cutover itself — see AGENTS.md's new "Client onboarding"
|
|
41
|
+
section for the full design rationale. `search`/`ads` forward to the existing `search setup`/
|
|
42
|
+
`ads setup` subcommands rather than reimplementing them.
|
|
43
|
+
|
|
44
|
+
No consumer-facing change in `@getvitops/vite` or `@getvitops/astro` in this release — bumped
|
|
45
|
+
only because they are in the `fixed` release group with `generator`/`utils`/`cli`.
|
|
46
|
+
`@getvitops/core` does have a real fix in this release; see the separate `banner-hidden-fix`
|
|
47
|
+
changeset.
|
|
48
|
+
|
|
49
|
+
- **Fixed — five patterns rendered as `<ul>`/`<ol>` kept the UA list styles (all formats).**
|
|
50
|
+
|
|
51
|
+
`.gallery`, `.tag-list`, `.cluster`, `.masonry` and `.comment-thread` never neutralised the
|
|
52
|
+
browser's default list padding/margin/markers, so `<Gallery />`'s generated `<ul role="list">`
|
|
53
|
+
(and any hand-authored `<ul>` carrying one of the other four classes) rendered with a
|
|
54
|
+
40px-ish inline padding and a bullet on every item. Each now resets `margin`/`padding`/
|
|
55
|
+
`list-style` behind a `:is(ul, ol)` gate — conditional so the class stays usable on a `div` —
|
|
56
|
+
and neutralises `.rhythm :where(ul, ol) > li + li`'s sibling margin the same way `.subgrid` and
|
|
57
|
+
`.grid-auto` already do, so an item inside a prose container doesn't pick up a stray top
|
|
58
|
+
margin that offsets the first grid cell alone. No markup change required.
|
|
59
|
+
|
|
3
60
|
## 8.0.1
|
|
4
61
|
|
|
5
62
|
## 8.0.0
|
package/css/layout-utilities.css
CHANGED
|
@@ -270,6 +270,19 @@
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
/* Opt out of `.rhythm`'s ambient `li + li` sibling margin (layout.css) for a list
|
|
274
|
+
whose item spacing is already the layout's job — a custom `gap`-based grid or
|
|
275
|
+
flex wrap the framework has no pattern for. Wins by LAYER (this file is
|
|
276
|
+
`vitops.utilities`, later than `.rhythm`'s `vitops.components`), the same
|
|
277
|
+
guarantee `bg-danger-muted` uses to beat `.card` — no specificity trick
|
|
278
|
+
needed, unlike every pattern-local `:is(ul, ol) > li + li` neutraliser above
|
|
279
|
+
and in patterns/*.css. The five framework list patterns (gallery, tag-list,
|
|
280
|
+
cluster, masonry, comment-thread) already do this automatically and don't
|
|
281
|
+
need this class; reach for it on markup the framework doesn't own. */
|
|
282
|
+
.no-rhythm > li + li {
|
|
283
|
+
margin-top: 0;
|
|
284
|
+
}
|
|
285
|
+
|
|
273
286
|
/* ── Flex direction (display + direction; tiered classes set both) ── */
|
|
274
287
|
.flex {
|
|
275
288
|
display: flex;
|
package/css/layout.css
CHANGED
|
@@ -133,6 +133,37 @@
|
|
|
133
133
|
.rhythm > :where(ul, ol) + p {
|
|
134
134
|
margin-top: calc(var(--rhythm-base) * var(--rhythm-list-p));
|
|
135
135
|
}
|
|
136
|
+
/* The only DESCENDANT rule in this block (every other rule above is `>`-scoped to
|
|
137
|
+
direct children) — it reaches into a list at any depth, including one nested
|
|
138
|
+
inside a pattern several levels down. That is deliberate: it is the correct
|
|
139
|
+
default for prose, and prose lists can be arbitrarily nested.
|
|
140
|
+
|
|
141
|
+
It is also 0-1-2, not 0-1-0 like the rest of this file's `:where()`-guarded
|
|
142
|
+
rules — `li + li` sits OUTSIDE the `:where()`, so it carries real weight. A
|
|
143
|
+
pattern whose item spacing is already its own job (a `gap`-based grid or flex
|
|
144
|
+
wrap: `.gallery`, `.tag-list`, `.cluster`, `.masonry`, `.comment-thread`,
|
|
145
|
+
`.subgrid`, `.grid-auto`) neutralises this LOCALLY, in its own partial, with
|
|
146
|
+
`&:is(ul, ol) > li + li { margin-block-start: 0; }` — `:is(ul, ol)` pushes it
|
|
147
|
+
to 0-1-3, safely past this rule's 0-1-2 regardless of source order. Consumer
|
|
148
|
+
markup gets the same escape hatch as a public utility: `.no-rhythm`
|
|
149
|
+
(layout-utilities.css), which wins by LAYER instead, since it lives in
|
|
150
|
+
`vitops.utilities`.
|
|
151
|
+
|
|
152
|
+
Two alternatives were considered and rejected, worth recording so neither is
|
|
153
|
+
re-proposed:
|
|
154
|
+
- Centralising the exclusion HERE, as `:where(ul, ol):not(:where(.gallery,
|
|
155
|
+
.subgrid, …))`. Rejected: it re-opens exactly the registry the heading rules
|
|
156
|
+
above were rewritten to delete (see the comment there) — an enumeration that
|
|
157
|
+
is always one pattern short, unlike a closed set like "what a heading is".
|
|
158
|
+
It also fails SILENTLY (a missing name renders a stray margin, nothing
|
|
159
|
+
errors) where the local form fails a build (`bundle-layers.test.ts`'s
|
|
160
|
+
per-pattern drift guard), and this file's `.rhythm` block is hand-mirrored
|
|
161
|
+
into a tailwind template literal (`generate.ts`) that has already drifted
|
|
162
|
+
once — a second selector list to keep in step, not a cleanup.
|
|
163
|
+
- Zeroing `--rhythm-li-li` locally instead of overriding `margin-top`. It
|
|
164
|
+
inherits (declared on `:root`), so it would also zero the rhythm of any
|
|
165
|
+
PROSE list nested inside the opted-out pattern — losing the exact behaviour
|
|
166
|
+
the descendant combinator above exists to provide. */
|
|
136
167
|
.rhythm :where(ul, ol) > li + li {
|
|
137
168
|
margin-top: calc(var(--rhythm-base) * var(--rhythm-li-li));
|
|
138
169
|
}
|
package/css/patterns/banner.css
CHANGED
|
@@ -62,3 +62,10 @@
|
|
|
62
62
|
flex-shrink: 0;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
/* `.banner`'s own `display: flex` and the UA `[hidden] { display: none }` are
|
|
67
|
+
both 0-1-0 — a tie the author sheet wins on source order, so a hidden
|
|
68
|
+
banner would render anyway. Name `[hidden]` explicitly so it always wins. */
|
|
69
|
+
.banner[hidden] {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
package/css/patterns/cluster.css
CHANGED
|
@@ -13,6 +13,25 @@
|
|
|
13
13
|
gap: var(--cluster-gap, 0.5rem);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
17
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
18
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
19
|
+
so only the author can restore it. Conditional so `.cluster` on a `div` is
|
|
20
|
+
untouched; scoped to `.cluster` alone — the `cluster-*` attribute selectors above
|
|
21
|
+
are alignment modifiers, not the list itself. */
|
|
22
|
+
.cluster:is(ul, ol) {
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
list-style: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Item spacing is the wrap's job, not the flow's — neutralise `.rhythm`'s
|
|
29
|
+
`li + li` margin (see layout.css for why this is local rather than
|
|
30
|
+
centralised). */
|
|
31
|
+
.cluster:is(ul, ol) > li + li {
|
|
32
|
+
margin-block-start: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
.cluster-start-start {
|
|
17
36
|
place-content: start start;
|
|
18
37
|
}
|
package/css/patterns/comment.css
CHANGED
|
@@ -85,4 +85,22 @@
|
|
|
85
85
|
display: flex;
|
|
86
86
|
flex-direction: column;
|
|
87
87
|
gap: 1.5rem;
|
|
88
|
+
|
|
89
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
90
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
91
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
92
|
+
so only the author can restore it. Conditional so `.comment-thread` on a `div`
|
|
93
|
+
is untouched. */
|
|
94
|
+
&:is(ul, ol) {
|
|
95
|
+
margin: 0;
|
|
96
|
+
padding: 0;
|
|
97
|
+
list-style: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Item spacing is the flex `gap` above's job, not the flow's — neutralise
|
|
101
|
+
`.rhythm`'s `li + li` margin (see layout.css for why this is local rather
|
|
102
|
+
than centralised). */
|
|
103
|
+
&:is(ul, ol) > li + li {
|
|
104
|
+
margin-block-start: 0;
|
|
105
|
+
}
|
|
88
106
|
}
|
package/css/patterns/gallery.css
CHANGED
|
@@ -27,6 +27,22 @@ wc-gallery {
|
|
|
27
27
|
display: grid;
|
|
28
28
|
grid-template-columns: repeat(auto-fill, minmax(var(--gallery-thumb-size, 150px), 1fr));
|
|
29
29
|
gap: var(--gallery-gap, 0.5rem);
|
|
30
|
+
|
|
31
|
+
/* Gallery.astro emits this as `<ul role="list">`, so the UA's list padding, block
|
|
32
|
+
margin and markers all apply. The pattern owns no outer spacing — the context it
|
|
33
|
+
sits in does. Conditional so `.gallery` on a `div` is untouched. */
|
|
34
|
+
&:is(ul, ol) {
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
list-style: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Item spacing is the grid's job, not the flow's — neutralise `.rhythm`'s
|
|
41
|
+
`li + li` margin (see layout.css for why this is local rather than
|
|
42
|
+
centralised). */
|
|
43
|
+
&:is(ul, ol) > li + li {
|
|
44
|
+
margin-block-start: 0;
|
|
45
|
+
}
|
|
30
46
|
}
|
|
31
47
|
|
|
32
48
|
.gallery__item {
|
package/css/patterns/list.css
CHANGED
|
@@ -244,6 +244,23 @@
|
|
|
244
244
|
align-items: center;
|
|
245
245
|
font-size: var(--_fs);
|
|
246
246
|
|
|
247
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
248
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
249
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
250
|
+
so only the author can restore it. Conditional so `.tag-list` on a `div` is
|
|
251
|
+
untouched — `--_p` already overrides the UA padding either way. */
|
|
252
|
+
&:is(ul, ol) {
|
|
253
|
+
margin: 0;
|
|
254
|
+
list-style: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* Item spacing is the wrap's job, not the flow's — neutralise `.rhythm`'s
|
|
258
|
+
`li + li` margin (see layout.css for why this is local rather than
|
|
259
|
+
centralised). */
|
|
260
|
+
&:is(ul, ol) > li + li {
|
|
261
|
+
margin-block-start: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
247
264
|
.tag-list__input {
|
|
248
265
|
flex: 1;
|
|
249
266
|
min-inline-size: 6rem;
|
package/css/patterns/marquee.css
CHANGED
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
* `100% + gap`, because the seam between copies is one more gap that has to be
|
|
18
18
|
* consumed for the loop to be seamless — translate by a bare `-100%` and the
|
|
19
19
|
* items visibly bunch up once per revolution.
|
|
20
|
+
*
|
|
21
|
+
* `Marquee.astro` authors THREE `.marquee__content` copies (the slotted one
|
|
22
|
+
* plus two `aria-hidden`), not two — a very wide track under the 100% floor
|
|
23
|
+
* needs more than one duplicate to stay covered. `<wc-marquee>` treats the
|
|
24
|
+
* first as its source and discards the rest, replacing them with however many
|
|
25
|
+
* its own measurement calls for.
|
|
20
26
|
*/
|
|
21
27
|
|
|
22
28
|
.marquee {
|
package/css/patterns/masonry.css
CHANGED
|
@@ -7,6 +7,24 @@
|
|
|
7
7
|
.masonry {
|
|
8
8
|
columns: var(--masonry-columns, 3);
|
|
9
9
|
|
|
10
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
11
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
12
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
13
|
+
so only the author can restore it. Conditional so `.masonry` on a `div` is
|
|
14
|
+
untouched. */
|
|
15
|
+
&:is(ul, ol) {
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
list-style: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Item spacing is the columns/masonry layout's job, not the flow's —
|
|
22
|
+
neutralise `.rhythm`'s `li + li` margin (see layout.css for why this is
|
|
23
|
+
local rather than centralised). */
|
|
24
|
+
&:is(ul, ol) > li + li {
|
|
25
|
+
margin-block-start: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
10
28
|
> * {
|
|
11
29
|
break-inside: avoid;
|
|
12
30
|
}
|
package/dist/elements.js
CHANGED
|
@@ -47,4 +47,4 @@ const e=globalThis,t=e.ShadowRoot&&(e.ShadyCSS===void 0||e.ShadyCSS.nativeShadow
|
|
|
47
47
|
:host{--_offset:var(--offset, 0.5);--_handle-size:var(--handle-size, 40px);--_handle-color:var(--handle-color, #fff);--_line-color:var(--line-color, #fff);--_line-width:var(--line-width, 2px);display:block;position:relative;overflow:hidden;touch-action:pan-y;user-select:none}:host([vertical]){touch-action:pan-x}.container{position:relative;display:grid}.after,.before{grid-area:1/1}.after ::slotted(img),.before ::slotted(img){display:block;inline-size:100%;block-size:auto}.before{clip-path:inset(0 calc((1 - var(--_offset))*100%) 0 0)}:host([vertical]) .before{clip-path:inset(0 0 calc((1 - var(--_offset))*100%) 0)}.handle{position:absolute;inset-block:0;inset-inline-start:calc(var(--_offset)*100%);translate:-50% 0;inline-size:var(--_handle-size);display:flex;flex-direction:column;align-items:center;cursor:ew-resize;z-index:1}:host([vertical]) .handle{inset-block:auto;inset-block-start:calc(var(--_offset)*100%);inset-inline:0;translate:0 -50%;flex-direction:row;cursor:ns-resize;block-size:var(--_handle-size);inline-size:100%}.handle:before{content:"";position:absolute;inset-block:0;inset-inline-start:50%;translate:-50% 0;inline-size:var(--_line-width);background:var(--_line-color);box-shadow:0 0 4px oklch(0 0 0/.3);pointer-events:none}:host([vertical]) .handle:before{inset-inline:0;inset-block:auto;inset-block-start:50%;translate:0 -50%;inline-size:100%;block-size:var(--_line-width)}.grip{position:absolute;inset-block-start:50%;inset-inline-start:50%;translate:-50% -50%;inline-size:var(--_handle-size);block-size:var(--_handle-size);background:var(--_handle-color);border-radius:50%;box-shadow:0 2px 8px oklch(0 0 0/.2);display:flex;align-items:center;justify-content:center;transition:scale .15s ease,box-shadow .15s ease}.grip:after,.grip:before{content:"";position:absolute;border:5px solid transparent}.grip:before{border-inline-end-color:oklch(.3 0 0);inset-inline-start:6px}.grip:after{border-inline-start-color:oklch(.3 0 0);inset-inline-end:6px}:host([vertical]) .grip:before{border-inline-end-color:transparent;border-block-end-color:oklch(.3 0 0);inset-inline-start:auto;inset-block-start:6px}:host([vertical]) .grip:after{border-inline-start-color:transparent;border-block-start-color:oklch(.3 0 0);inset-inline-end:auto;inset-block-end:6px}.handle:focus-visible .grip,.handle:hover .grip{scale:1.1;box-shadow:0 4px 12px oklch(0 0 0/.3)}.handle:focus-visible{outline:none}.handle:focus-visible .grip{outline:2px solid oklch(.6 .2 250);outline-offset:2px}.handle.dragging .grip{scale:1.15;box-shadow:0 6px 16px oklch(0 0 0/.35)}@media (prefers-reduced-motion:reduce){.grip{transition:none}}@media (any-pointer:coarse){.handle{min-inline-size:44px}:host([vertical]) .handle{min-block-size:44px}}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}`]}static{this.properties={position:{type:Number},vertical:{type:Boolean,reflect:!0},discrete:{type:Boolean,reflect:!0},keyboardStep:{type:Number,attribute:`keyboard-step`},beforeLabel:{type:String,attribute:`before-label`},afterLabel:{type:String,attribute:`after-label`},_offset:{type:Number,state:!0}}}constructor(){super(),this.init(),this.initDragController()}init(){this.position=50,this.vertical=!1,this.discrete=!1,this.keyboardStep=1,this.beforeLabel=`Before`,this.afterLabel=`After`,this._offset=.5}initDragController(){this.dragController=new Mt(this,{handleSelector:`[part="handle"]`,orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,onDrag:e=>this.handleDrag(e),onDragEnd:e=>this.handleDragEnd(e),keyboardStep:this.keyboardStep/100,keyboardLargeStep:this.keyboardStep/10})}willUpdate(e){e.has(`position`)&&!e.has(`_offset`)&&(this._offset=this.position/100,this.dragController.setPosition(this._offset)),(e.has(`vertical`)||e.has(`discrete`)||e.has(`keyboardStep`))&&this.dragController.updateOptions({orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,keyboardStep:this.keyboardStep/100,keyboardLargeStep:this.keyboardStep/10})}handleDrag(e){this._offset=e,this.style.setProperty(`--_offset`,String(this._offset))}handleDragEnd(e){this._offset=e,this.style.setProperty(`--_offset`,String(this._offset)),this.dispatchEvent(new CustomEvent(`compare-change`,{detail:{position:this._offset*100},bubbles:!0,composed:!0}))}render(){return be` <div class="container" part="container" style="--_offset:${this._offset}"> <div class="after" part="after" aria-label="${this.afterLabel}"> <slot name="after"></slot> </div> <div class="before" part="before" aria-label="${this.beforeLabel}"> <slot name="before"></slot> </div> <div class="handle" part="handle" role="separator" aria-label="Image comparison handle" aria-orientation="${this.vertical?`vertical`:`horizontal`}"> <div class="grip" part="grip"> <span class="visually-hidden">Drag to compare</span> </div> </div> </div> `}};customElements.get(`wc-image-compare`)||customElements.define(`wc-image-compare`,Pt);var Ft=class extends X{static{this.properties={duration:{type:Number,reflect:!0},exit:{type:Number}}}createRenderRoot(){return this}render(){return T}#e;constructor(){super(),this.duration=0,this.exit=200}connectedCallback(){super.connectedCallback(),this.addEventListener(`click`,this.#t),this.duration>0&&(this.#e=setTimeout(()=>this.dismiss(),this.duration))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`click`,this.#t),this.#e&&clearTimeout(this.#e)}#t=e=>{e.target?.closest(`[data-dismiss]`)&&(e.preventDefault(),this.dismiss())};dismiss(){this.#e&&=(clearTimeout(this.#e),void 0);let e=new CustomEvent(`dismiss`,{bubbles:!0,cancelable:!0});if(!this.dispatchEvent(e))return;let t=matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(this.exit<=0||t){this.remove();return}this.style.transition=`opacity ${this.exit}ms ease, scale ${this.exit}ms ease`,this.style.opacity=`0`,this.style.scale=`0.97`;let n=!1,r=()=>{n||(n=!0,this.remove())};this.addEventListener(`transitionend`,r,{once:!0}),setTimeout(r,this.exit+50)}};customElements.get(`wc-dismissable`)||customElements.define(`wc-dismissable`,Ft);var It=class extends X{static{this.styles=[X.styles,o`
|
|
48
48
|
:host{display:inline-flex;align-items:center;gap:.5rem}.copy__button{display:none;align-items:center;justify-content:center;min-inline-size:var(--copy-size,2.5rem);min-block-size:var(--copy-size,2.5rem);padding:var(--copy-padding,.5rem);background:var(--copy-bg,transparent);border:var(--copy-border,none);border-radius:var(--copy-radius,.375rem);cursor:pointer;transition:background-color .15s ease,transform .1s ease}:host(wc-copy:defined) .copy__button{display:inline-flex}.copy__button:hover{background:var(--copy-hover-bg,oklch(.9 0 0))}.copy__button:active{transform:scale(.95)}.copy__button:focus-visible{outline:2px solid var(--copy-focus-color,oklch(.6 .2 250));outline-offset:2px}.copy__icon{inline-size:1.25em;block-size:1.25em;background-color:currentColor;mask-size:contain;mask-repeat:no-repeat;mask-position:center}.copy__icon--copy{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M208%200h124.1C344.8%200%20357%205.1%20366%2014.1L433.9%2082c9%209%2014.1%2021.2%2014.1%2033.9V336c0%2026.5-21.5%2048-48%2048H208c-26.5%200-48-21.5-48-48V48c0-26.5%2021.5-48%2048-48M48%20128h80v64H64v256h192v-32h64v48c0%2026.5-21.5%2048-48%2048H48c-26.5%200-48-21.5-48-48V176c0-26.5%2021.5-48%2048-48%22%2F%3E%3C%2Fsvg%3E")}.copy__icon--success{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M438.6%20105.4c12.5%2012.5%2012.5%2032.8%200%2045.3l-256%20256c-12.5%2012.5-32.8%2012.5-45.3%200l-128-128c-12.5-12.5-12.5-32.8%200-45.3s32.8-12.5%2045.3%200L160%20338.7l233.4-233.3c12.5-12.5%2032.8-12.5%2045.3%200z%22%2F%3E%3C%2Fsvg%3E");color:var(--copy-success-color,oklch(.6 .2 145))}`]}static{this.properties={value:{type:String},label:{type:String},_copied:{type:Boolean,state:!0}}}constructor(){super(),this._handleCopy=async()=>{let e=this.value??this.getSlottedNodes().map(e=>e.textContent).join(``).trim();if(!(e==null||e===``)){console.log(`copying value:`,e);try{await navigator.clipboard.writeText(e),this._copied=!0,this._timeoutId=setTimeout(()=>{this._copied=!1},2e3),this.dispatchEvent(new CustomEvent(`copy`,{detail:{value:this.value},bubbles:!0,composed:!0}))}catch(e){console.error(`Failed to copy:`,e),this.dispatchEvent(new CustomEvent(`copy-error`,{detail:{error:e},bubbles:!0,composed:!0}))}}},this.init()}init(){this.value=void 0,this.label=`Copy to clipboard`,this._copied=!1}disconnectedCallback(){super.disconnectedCallback(),this._timeoutId&&clearTimeout(this._timeoutId)}render(){let e=this._copied?`copy__icon copy__icon--success`:`copy__icon copy__icon--copy`;return Y` <slot></slot> <button class="copy__button" part="button" type="button" aria-label="${this._copied?`Copied!`:this.label}" @click="${this._handleCopy}"> <span class="${e}" part="icon" aria-hidden="true"></span> </button> `}};customElements.get(`wc-copy`)||customElements.define(`wc-copy`,It);function Lt(e){let t=t=>e(t).trim()===`1`;return{nativeNav:t(`--carousel-native-nav`),scrollTimeline:t(`--carousel-scroll-timeline`)}}function Rt(e,t){let n=e.slides>=2;return{clone:n&&!e.paged&&(e.loop||e.autoplay>0),play:e.autoplay>0&&!e.reducedMotion,buildButtons:n&&e.wantsButtons&&!t.nativeNav,buildMarkers:n&&e.wantsMarkers&&!t.nativeNav,trackScrolled:!t.scrollTimeline}}function zt(e){return Math.abs(e)>4}function Bt(e,t,n=`Slide`){return`${n} ${e+1} of ${t}`}const Vt=Object.freeze({loading:`lazy`,fetchpriority:`low`,decoding:`async`});function Z(e,t){t()||queueMicrotask(()=>{e.isConnected&&t()})}function Ht(e){let{index:t,total:n,delta:r,loop:i}=e;if(n<=0)return t;let a=t+r;return i?(a%n+n)%n:Math.min(Math.max(a,0),n-1)}function Ut(e,t){let{orientation:n,rtl:r=!1}=t,i=n===`horizontal`||n===`both`,a=n===`vertical`||n===`both`;if(i){if(e===`ArrowLeft`)return{type:`step`,delta:r?1:-1};if(e===`ArrowRight`)return{type:`step`,delta:r?-1:1}}if(a){if(e===`ArrowUp`)return{type:`step`,delta:-1};if(e===`ArrowDown`)return{type:`step`,delta:1}}return e===`Home`?{type:`first`}:e===`End`?{type:`last`}:null}function Wt(e,t,n,r=1e3){let i=!e||n-e.lastTime>r?t:e.buffer+t;return{buffer:i,query:i.length>1&&Array.from(i).every(e=>e===i[0])?i[0]:i,lastTime:n}}function Gt(e,t,n,r){let i=t.toLowerCase();if(!i)return null;let a=e.length;if(!a)return null;let o=Math.max(0,e.findIndex(e=>e.key===n));for(let t=1;t<=a;t++){let n=e[(o+t)%a];if(!r?.(n.key)&&n.text.toLowerCase().startsWith(i))return n.key}return null}const Kt=e=>!e.hidden&&!e.closest(`[hidden]`);var qt=class{#e;#t=null;#n=null;#r=null;constructor(e,t){this.#e=t,e.addController(this)}get active(){return this.#n}#i=e=>(this.#e.isFocusable??Kt)(e);attach(e){this.#t!==e&&(this.detach(),this.#t=e,e.addEventListener(`keydown`,this.#o),e.addEventListener(`focusin`,this.#a),this.sync())}detach(){this.#t&&=(this.#t.removeEventListener(`keydown`,this.#o),this.#t.removeEventListener(`focusin`,this.#a),null)}sync(){let e=this.#e.items(),t=e.filter(this.#i),n=this.#n,r=n!==null&&document.activeElement===n,i=n!==null&&t.includes(n),a=i?n:t[0]??null;for(let t of e)t.tabIndex=t===a?0:-1;this.#n=a,r&&!i&&a&&(a.focus({preventScroll:!0}),this.#e.onMove?.(a,n,`sync`))}setActive(e,t={}){let{focus:n=!0,cause:r=`api`,silent:i=!1}=t,a=this.#n;this.#n=e;for(let t of this.#e.items())t.tabIndex=t===e?0:-1;e&&(n&&e.focus({preventScroll:!0}),i||this.#e.onMove?.(e,a,r))}#a=e=>{let t=e.target;t instanceof HTMLElement&&t!==this.#n&&this.#e.items().includes(t)&&this.setActive(t,{focus:!1,cause:`pointer`})};#o=e=>{let{ignoreWithin:t,textFor:n}=this.#e,r=e.target;if(t&&r instanceof Element&&r.closest(t))return;if(n&&e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey){this.#s(e,n);return}let i=this.#t;if(!i)return;let a=this.#e.items(),o={items:a,active:this.#n,index:this.#n?a.indexOf(this.#n):-1,rtl:getComputedStyle(i).direction===`rtl`},s=this.#e.keyToMove?this.#e.keyToMove(e,o):this.#c(e,o);s&&(e.preventDefault(),this.#l(s,o))};#s=(e,t)=>{this.#r=Wt(this.#r,e.key,performance.now());let n=Gt(this.#e.items().filter(this.#i).map(e=>({key:e,text:t(e)})),this.#r.query,this.#n);n&&(e.preventDefault(),this.setActive(n,{focus:!0,cause:`key`}))};#c=(e,t)=>{let{orientation:n}=this.#e;return n?Ut(e.key,{orientation:n,rtl:t.rtl}):null};#l(e,t){if(e.type===`handled`)return;let n=t.items.filter(this.#i);if(!n.length)return;if(e.type===`to`){this.setActive(e.item,{focus:!0,cause:`key`});return}if(e.type===`first`){this.setActive(n[0],{focus:!0,cause:`key`});return}if(e.type===`last`){this.setActive(n[n.length-1],{focus:!0,cause:`key`});return}let r=t.active?n.indexOf(t.active):-1,i=Ht({index:r<0?0:r,total:n.length,delta:e.delta,loop:this.#e.loop??!1});this.setActive(n[i],{focus:!0,cause:`key`})}hostConnected(){}hostDisconnected(){this.detach()}},Jt=class extends X{static{this.properties={autoplay:{type:Number,reflect:!0},loop:{type:Boolean,reflect:!0}}}createRenderRoot(){return this}render(){return T}#e=!1;#t=null;#n=[];#r=[];#i=null;#a=[];#o=null;#s=[];#c=null;#l=!1;#u;#d=null;#f=null;#p=null;#m=!1;#h=!1;#g=!1;#_=null;constructor(){super(),this.autoplay=0,this.loop=!1,this.#u=new qt(this,{items:()=>this.#s,orientation:`both`,loop:!0,onMove:(e,t,n)=>{n===`key`&&e.click()}})}connectedCallback(){super.connectedCallback(),Z(this,()=>this.#v())}#v(){if(this.parentElement?.closest(`wc-carousel`)||this.#e)return!0;let e=this.#y();if(!e||(this.#t=e,this.#n=[...e.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(`slot`)),this.#n.length<2))return!1;!this.autoplay&&this.hasAttribute(`autoplay`)&&(this.autoplay=Number(this.getAttribute(`autoplay`))||0),!this.loop&&this.hasAttribute(`loop`)&&(this.loop=!0),this.#h=matchMedia(`(prefers-reduced-motion: reduce)`).matches;let t=Lt(e=>getComputedStyle(this).getPropertyValue(e)),n=Rt({loop:this.loop,autoplay:this.autoplay,paged:this.classList.contains(`carousel--auto-pages`),wantsButtons:this.classList.contains(`carousel--scroll-buttons`),wantsMarkers:this.classList.contains(`carousel--scroll-markers`),slides:this.#n.length,reducedMotion:this.#h},t);return this.#i=n,this.#b(e),n.clone&&this.#x(),n.buildButtons&&this.#A(),n.buildMarkers&&this.#j(),(n.trackScrolled||n.clone||this.#a.length||this.#s.length)&&(e.addEventListener(`scroll`,this.#D,{passive:!0}),e.addEventListener(`scrollsnapchange`,this.#O),e.addEventListener(`scrollend`,this.#O)),n.clone&&this.#E(),this.autoplay>0&&this.#N(n),this.#d=new ResizeObserver(this.#M),this.#d.observe(e),this.#M(),this.#e=!0,!0}#y(){let e=this.querySelector(`:scope > .carousel__track`);if(e)return e;if(!this.classList.contains(`carousel`)||!this.children.length)return null;let t=document.createElement(`div`);return t.className=`carousel__track`,t.append(...this.childNodes),this.append(t),t}#b(e){this.hasAttribute(`role`)||this.setAttribute(`role`,`group`),this.hasAttribute(`aria-roledescription`)||this.setAttribute(`aria-roledescription`,`carousel`),e.hasAttribute(`tabindex`)||(e.tabIndex=0)}disconnectedCallback(){super.disconnectedCallback();let e=this.#t;this.#d?.disconnect(),this.#d=null,e&&(e.removeEventListener(`scroll`,this.#D),e.removeEventListener(`scrollsnapchange`,this.#O),e.removeEventListener(`scrollend`,this.#O)),this.#p&&clearTimeout(this.#p),this.#p=null,this.#L(),this.removeEventListener(`pointerenter`,this.#R),this.removeEventListener(`pointerleave`,this.#z),this.removeEventListener(`focusin`,this.#R),this.removeEventListener(`focusout`,this.#z),this.#c&&(this.#c.removeEventListener(`click`,this.#B),this.#l&&this.#c.remove(),this.#c=null,this.#l=!1);for(let e of this.#a)e.remove();this.#a=[],this.#u.detach(),this.#o?.remove(),this.#o=null,this.#s=[];for(let e of this.#r)e.remove();this.#r=[],this.removeAttribute(`data-scrolled`),this.removeAttribute(`aria-live`),this.#n=[],this.#i=null,this.#e=!1,this.#_=null}#x(){let e=this.#n.map((e,t)=>this.#S(e,t)),t=this.#n.map((e,t)=>this.#S(e,t));for(let t=e.length-1;t>=0;t--)this.#t?.prepend(e[t]);for(let e of t)this.#t?.append(e);this.#r=[...e,...t]}#S(e,t){let n=e.cloneNode(!0);n.setAttribute(`data-carousel-clone`,String(t)),n.setAttribute(`aria-hidden`,`true`),n.setAttribute(`inert`,``),n.removeAttribute(`id`);for(let e of n.querySelectorAll(`[id]`))e.removeAttribute(`id`);for(let e of n.querySelectorAll(`img`))for(let[t,n]of Object.entries(Vt))e.setAttribute(t,n);return n}#C(){return this.#t?[...this.#t.children].filter(e=>e instanceof HTMLElement&&!e.hasAttribute(`slot`)):[]}#w(){let e=this.#t,t=this.#C();if(!e||!t.length)return 0;let n=e.getBoundingClientRect(),r=n.left+n.width/2,i=0,a=1/0;return t.forEach((e,t)=>{let n=e.getBoundingClientRect(),o=Math.abs(n.left+n.width/2-r);o<a&&(a=o,i=t)}),i}#T(e){let t=this.#C();if(!t.length)return;let n=this.#w()+e;t[Math.max(0,Math.min(t.length-1,n))]?.scrollIntoView({inline:`center`,block:`nearest`,behavior:`smooth`})}#E(){requestAnimationFrame(()=>{let e=this.#n[0];e&&(this.#g=!0,e.scrollIntoView({inline:`center`,block:`nearest`,behavior:`instant`}),requestAnimationFrame(()=>{this.#g=!1,this.#k()}))})}#D=()=>{this.#i?.trackScrolled&&!this.hasAttribute(`data-scrolled`)&&zt(this.#t?.scrollLeft??0)&&this.setAttribute(`data-scrolled`,``),this.#k(),this.#p&&clearTimeout(this.#p),this.#p=setTimeout(this.#O,150)};#O=()=>{this.#p&&clearTimeout(this.#p),this.#p=null,this.#k();let e=this.#t;if(!e||!this.#i?.clone||this.#g)return;let t=this.#C()[this.#w()],n=t?.getAttribute(`data-carousel-clone`);if(!t||n==null)return;let r=this.#n[Number(n)];if(!r)return;let i=r.getBoundingClientRect().left-t.getBoundingClientRect().left;if(!i)return;this.#g=!0;let a=e.style.scrollBehavior;e.style.scrollBehavior=`auto`,e.scrollLeft+=i,requestAnimationFrame(()=>{e.style.scrollBehavior=a,this.#g=!1,this.#k()})};#k(){let e=this.#C();if(!e.length)return;let t=this.#w(),n=this.#i?.clone?t%this.#n.length:t;this.#s.forEach((e,t)=>e.setAttribute(`aria-selected`,String(t===n)));let r=this.#s[n];if(r&&this.#u.setActive(r,{focus:!1,silent:!0}),this.#a.length&&!this.#i?.clone){let[n,r]=this.#a;n&&(n.disabled=t<=0),r&&(r.disabled=t>=e.length-1)}n!==this.#_&&(this.#_=n,this.dispatchEvent(new CustomEvent(`carousel-change`,{bubbles:!0,composed:!0,detail:{index:n,total:this.#n.length}})))}#A(){let e=(e,t,n,r)=>{let i=document.createElement(`button`);return i.type=`button`,i.className=`carousel__button carousel__button--${e}`,i.setAttribute(`aria-label`,t),i.textContent=n,i.addEventListener(`click`,()=>this.#T(r)),i},t=getComputedStyle(this).direction===`rtl`;this.#a=[e(`prev`,`Previous`,t?`›`:`‹`,-1),e(`next`,`Next`,t?`‹`:`›`,1)],this.append(...this.#a)}#j(){let e=document.createElement(`div`);e.className=`carousel__markers`,e.setAttribute(`role`,`tablist`),e.setAttribute(`aria-label`,this.getAttribute(`aria-label`)??`Slides`),this.#s=this.#n.map((e,t)=>{let n=document.createElement(`button`);return n.type=`button`,n.className=`carousel__marker`,n.setAttribute(`role`,`tab`),n.setAttribute(`aria-label`,Bt(t,this.#n.length)),n.setAttribute(`aria-selected`,String(t===0)),e.id&&n.setAttribute(`aria-controls`,e.id),n.addEventListener(`click`,()=>{e.scrollIntoView({inline:`center`,block:`nearest`,behavior:`smooth`})}),n}),e.append(...this.#s),this.append(e),this.#o=e,this.#u.attach(e)}#M=()=>{let e=this.#t;if(!e)return;let t=this.querySelector(`:scope > .carousel__hint`);t&&(t.hidden=e.scrollWidth<=e.clientWidth+1)};#N(e){this.#P(),e.play?this.#I():(this.#m=!0,this.setAttribute(`aria-live`,`polite`),this.#F()),this.addEventListener(`pointerenter`,this.#R),this.addEventListener(`pointerleave`,this.#z),this.addEventListener(`focusin`,this.#R),this.addEventListener(`focusout`,this.#z)}#P(){let e=this.querySelector(`[slot="autoplay"]`);if(e)this.#c=e,this.#l=!1;else{let e=document.createElement(`button`);e.type=`button`,e.className=`carousel__autoplay`,this.append(e),this.#c=e,this.#l=!0}this.#c.addEventListener(`click`,this.#B),this.#F()}#F(){let e=this.#c;e&&(e.setAttribute(`aria-label`,this.#m?`Play`:`Pause`),e.setAttribute(`aria-pressed`,String(!this.#m)),this.#l&&(e.textContent=this.#m?`▶`:`⏸`))}#I(){this.#f||this.autoplay<=0||(this.#m=!1,this.#f=setInterval(()=>this.#T(1),this.autoplay),this.setAttribute(`aria-live`,`off`),this.#F())}#L(){this.#f&&clearInterval(this.#f),this.#f=null}#R=()=>{!this.#f&&this.#m||(this.#L(),this.#m=!0,this.setAttribute(`aria-live`,`polite`),this.#F())};#z=()=>{this.#h||this.#I()};#B=()=>{this.#m?(this.#h=!1,this.#I()):this.#R()}};customElements.get(`wc-carousel`)||customElements.define(`wc-carousel`,Jt);var Yt=class extends X{static{this.properties={breakpoint:{type:String,reflect:!0},projection:{type:Boolean,reflect:!0},singular:{type:Boolean,reflect:!0}}}createRenderRoot(){return this}#e=[];#t=[];#n=[];#r=null;#i=null;#a=null;#o=[];#s=[];#c=0;#l=!1;#u=null;#d=0;init(){this.breakpoint=`40rem`,this.projection=!1,this.singular=!1}constructor(){super(),this.init()}connectedCallback(){super.connectedCallback(),Z(this,()=>this.#f())}#f(){return this.#r?!0:(this.#p(),this.#e.length===0?!1:(this.#h(),this.projection&&(this.#m(),this.#g(),this.#_(),this.singular&&(this.classList.add(`entries--singular`),this.#y(0))),this.#d=this.#x(),this.#S(),!0))}disconnectedCallback(){super.disconnectedCallback(),this.#u?.disconnect(),this.#u=null,this.#a?.remove(),this.#a=null,this.#o=[],this.#i?this.#i.remove():this.#r?.remove(),this.#r=null,this.#i=null,this.#s=[],this.classList.remove(`entries--wide`,`entries--projection`,`entries--singular`)}#p(){this.#e=[];let e=new Set,t=new Map,n=null;for(let r of this.children){let i=r.tagName.toLowerCase();if(/^h[1-6]$/.test(i))n=r;else if(i===`dl`&&n){let i=new Map,a=r.querySelectorAll(`dt`),o=r.querySelectorAll(`dd`);for(let n=0;n<a.length;n++){let r=a[n],s=r.textContent?.trim()??``,c=o[n]?.innerHTML??``;if(s){i.set(s,c),e.add(s);let n=r.getAttribute(`data-label`);n&&!t.has(s)&&t.set(s,n)}}this.#e.push({title:n.innerHTML,heading:n,dl:r,properties:i}),n=null}}this.#t=[...e],this.#n=this.#t.map(e=>t.get(e)??e)}#m(){this.classList.add(`entries--projection`)}#h(){let e=document.createElement(`table`);e.classList.add(`entries__table`),e.setAttribute(`aria-hidden`,`true`);let t=document.createElement(`thead`),n=document.createElement(`tr`),r=document.createElement(`th`);r.textContent=``,n.appendChild(r),this.#s=[];for(let e of this.#t){let t=document.createElement(`th`);t.textContent=e,n.appendChild(t),this.#s.push(t)}t.appendChild(n),e.appendChild(t);let i=document.createElement(`tbody`);for(let e of this.#e){let t=document.createElement(`tr`),n=document.createElement(`td`);n.innerHTML=e.title,n.style.fontWeight=`600`,t.appendChild(n);for(let n of this.#t){let r=document.createElement(`td`);r.innerHTML=e.properties.get(n)??``,t.appendChild(r)}i.appendChild(t)}e.appendChild(i),this.appendChild(e),this.#r=e}#g(){if(!this.#r)return;let e=document.createElement(`div`);e.classList.add(`entries__scroll`),this.#r.replaceWith(e),e.appendChild(this.#r),this.#i=e}#_(){let e=document.createElement(`nav`);e.classList.add(`entries__nav`),e.setAttribute(`aria-label`,`Column selector`),e.setAttribute(`aria-hidden`,`true`),this.#o=this.#t.map((t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.classList.add(`entries__nav-btn`),r.textContent=this.#n[n]??t,r.setAttribute(`aria-pressed`,String(n===0)),r.addEventListener(`click`,()=>this.#v(n)),e.appendChild(r),r}),this.#i.before(e),this.#a=e}#v(e){this.#c=e;for(let t=0;t<this.#o.length;t++)this.#o[t]?.setAttribute(`aria-pressed`,String(t===e));if(this.singular)this.#y(e);else{let t=this.#s[e];t&&this.#i&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`start`})}this.dispatchEvent(new CustomEvent(`entries-column-change`,{detail:{column:e,header:this.#t[e]},bubbles:!0,composed:!0}))}#y(e){if(!this.#r)return;let t=e+1;for(let e of this.#r.rows)for(let n=1;n<e.cells.length;n++){let r=e.cells[n];r&&(r.hidden=n!==t)}}#b(){if(this.#r)for(let e of this.#r.rows)for(let t=1;t<e.cells.length;t++){let n=e.cells[t];n&&(n.hidden=!1)}}#x(){let e=this.breakpoint||`40rem`,t=document.createElement(`div`);t.style.width=e,t.style.position=`absolute`,t.style.visibility=`hidden`,this.appendChild(t);let n=t.offsetWidth;return t.remove(),n}#S(){this.#u=new ResizeObserver(this.#C),this.#u.observe(this)}#C=e=>{let t=e[0];if(!t)return;let n=t.contentBoxSize?.[0]?.inlineSize??t.contentRect.width;this.#l=n>=this.#d,this.#l?(this.classList.add(`entries--wide`),this.singular&&this.projection&&this.#b()):(this.classList.remove(`entries--wide`),this.singular&&this.projection&&this.#y(this.#c))}};customElements.get(`wc-entries`)||customElements.define(`wc-entries`,Yt);const Xt=`vitops:consent`;var Zt=class e extends X{static{this.styles=[X.styles,o`
|
|
49
49
|
:host{display:none}:host(:defined){display:inline-flex}.toggle__group{display:inline-flex;border-radius:var(--color-scheme-toggle-radius,.5rem);overflow:hidden;border:var(--color-scheme-toggle-border,1px solid oklch(.5 0 0/.2))}.toggle__segment{display:inline-flex;align-items:center;justify-content:center;gap:.375rem;padding:var(--color-scheme-toggle-padding,.5rem .75rem);border:none;background:var(--color-scheme-toggle-bg,oklch(.95 0 0));color:var(--color-scheme-toggle-color,oklch(.3 0 0));font-size:var(--color-scheme-toggle-font-size,.875rem);font-family:inherit;cursor:pointer;transition:background-color .15s ease,color .15s ease}.toggle__segment:not(:last-child){border-inline-end:1px solid oklch(.5 0 0/.15)}.toggle__segment:hover{background:var(--color-scheme-toggle-hover-bg,oklch(.9 0 0))}.toggle__segment[aria-pressed=true]{background:var(--color-scheme-toggle-active-bg,oklch(.25 .02 260));color:var(--color-scheme-toggle-active-color,oklch(.95 0 0))}.toggle__segment:focus-visible{outline:2px solid var(--color-scheme-toggle-focus-color,oklch(.6 .2 250));outline-offset:2px;z-index:1;position:relative}.toggle__icon{inline-size:1em;block-size:1em;flex-shrink:0}.toggle__icon--light{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%225%22%2F%3E%3Cpath%20d%3D%22M12%201v2M12%2021v2M4.22%204.22l1.42%201.42M18.36%2018.36l1.42%201.42M1%2012h2M21%2012h2M4.22%2019.78l1.42-1.42M18.36%205.64l1.42-1.42%22%2F%3E%3C%2Fsvg%3E")}.toggle__icon--dark,.toggle__icon--light{background:currentColor;mask-size:contain;mask-repeat:no-repeat}.toggle__icon--dark{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M21%2012.79A9%209%200%201%201%2011.21%203%207%207%200%200%200%2021%2012.79%22%2F%3E%3C%2Fsvg%3E")}.toggle__icon--system{background:currentColor;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%222%22%20viewBox%3D%220%200%2024%2024%22%3E%3Crect%20width%3D%2220%22%20height%3D%2214%22%20x%3D%222%22%20y%3D%223%22%20rx%3D%222%22%20ry%3D%222%22%2F%3E%3Cpath%20d%3D%22M8%2021h8M12%2017v4%22%2F%3E%3C%2Fsvg%3E");mask-size:contain;mask-repeat:no-repeat}.toggle__label{display:none}@container (min-width: 400px){.toggle__label{display:inline}}@media (prefers-reduced-motion:reduce){.toggle__segment{transition:none}}`]}static{this.properties={scheme:{type:String,reflect:!0}}}constructor(){super(),this._mediaQuery=null,this._boundMediaHandler=null,this._onConsent=()=>{window.vitopsConsent?.granted(`preferences`)&&this._write()},this.init()}init(){this.scheme=e.readStored()??`system`}static{this.STORAGE_KEY=`vitops-color-scheme`}static readStored(){try{let t=localStorage.getItem(e.STORAGE_KEY);return t===`light`||t===`dark`||t===`system`?t:null}catch{return null}}_persist(){let e=window.vitopsConsent;(!e||e.require(`preferences`))&&this._write()}_write(){try{this.scheme===`system`?localStorage.removeItem(e.STORAGE_KEY):localStorage.setItem(e.STORAGE_KEY,this.scheme)}catch{}}connectedCallback(){super.connectedCallback(),this._mediaQuery=window.matchMedia(`(prefers-color-scheme: dark)`),this._boundMediaHandler=this._handleMediaChange.bind(this),this._mediaQuery.addEventListener(`change`,this._boundMediaHandler),document.addEventListener(Xt,this._onConsent),this._applyColorScheme()}disconnectedCallback(){super.disconnectedCallback(),this._mediaQuery&&this._boundMediaHandler&&this._mediaQuery.removeEventListener(`change`,this._boundMediaHandler),document.removeEventListener(Xt,this._onConsent)}_handleMediaChange(e){this.scheme===`system`&&this.requestUpdate()}_applyColorScheme(){let e=document.documentElement;this.scheme===`system`?(e.style.removeProperty(`color-scheme`),delete e.dataset.theme):(e.style.colorScheme=`${this.scheme} only`,e.dataset.theme=this.scheme)}_handleSegmentClick(e){this.scheme!==e&&(this.scheme=e,this._applyColorScheme(),this._persist(),this.dispatchEvent(new CustomEvent(`scheme-change`,{detail:{scheme:this.scheme},bubbles:!0,composed:!0})))}updated(e){e.has(`scheme`)&&this._applyColorScheme()}render(){return Y` <div class="toggle__group" role="group" aria-label="Color scheme" part="group"> <button class="toggle__segment" part="system" type="button" aria-pressed="${this.scheme===`system`}" @click="${()=>this._handleSegmentClick(`system`)}"> <span class="toggle__icon toggle__icon--system" aria-hidden="true"></span> <span class="toggle__label">System</span> </button> <button class="toggle__segment" part="light" type="button" aria-pressed="${this.scheme===`light`}" @click="${()=>this._handleSegmentClick(`light`)}"> <span class="toggle__icon toggle__icon--light" aria-hidden="true"></span> <span class="toggle__label">Light</span> </button> <button class="toggle__segment" part="dark" type="button" aria-pressed="${this.scheme===`dark`}" @click="${()=>this._handleSegmentClick(`dark`)}"> <span class="toggle__icon toggle__icon--dark" aria-hidden="true"></span> <span class="toggle__label">Dark</span> </button> </div> `}};customElements.get(`wc-color-scheme-toggle`)||customElements.define(`wc-color-scheme-toggle`,Zt);var Qt=class extends X{static{this.styles=[X.styles,o`
|
|
50
|
-
:host{--_gap:var(--multi-field-gap, 0.5rem);--_input-padding:var(--multi-field-input-padding, 0.5rem 0.75rem);--_radius:var(--multi-field-border-radius, 0.375rem);--_border-color:var(--multi-field-border-color, oklch(0.8 0 0));--_focus-color:var(--multi-field-focus-color, oklch(0.6 0.2 250));--_button-bg:var(--multi-field-button-bg, oklch(0.95 0 0));--_button-hover-bg:var(--multi-field-button-hover-bg, oklch(0.9 0 0));--_delete-color:var(--multi-field-delete-color, oklch(0.6 0.2 25));--_delete-hover-bg:var(--multi-field-delete-hover-bg, oklch(0.95 0.05 25));display:block}.container,.entries{flex-direction:column}.container,.entries,.entry{display:flex;gap:var(--_gap)}.entry{align-items:center}.entry__input{flex:1;padding:var(--_input-padding);border:1px solid var(--_border-color);border-radius:var(--_radius);font:inherit;background:transparent}.entry__input:focus-visible{outline:2px solid var(--_focus-color);outline-offset:2px}.entry__input:disabled{opacity:.6;cursor:not-allowed}.entry__delete{display:inline-flex;align-items:center;justify-content:center;min-inline-size:2rem;min-block-size:2rem;padding:.25rem;background:transparent;border:1px solid transparent;border-radius:var(--_radius);color:var(--_delete-color);cursor:pointer;transition:background-color .15s ease}.entry__delete:hover:not(:disabled){background:var(--_delete-hover-bg)}.entry__delete:focus-visible{outline:2px solid var(--_focus-color);outline-offset:2px}.entry__delete:disabled{opacity:.3;cursor:not-allowed}.entry__delete-icon{inline-size:1rem;block-size:1rem;background-color:currentColor;mask-size:contain;mask-repeat:no-repeat;mask-position:center;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M135.2%2017.7%20128%2032H32C14.3%2032%200%2046.3%200%2064s14.3%2032%2032%2032h384c17.7%200%2032-14.3%2032-32s-14.3-32-32-32h-96l-7.2-14.3C307.4%206.8%20296.3%200%20284.2%200H163.8c-12.1%200-23.2%206.8-28.6%2017.7M416%20128H32l21.2%20339c1.6%2025.3%2022.6%2045%2047.9%2045h245.8c25.3%200%2046.3-19.7%2047.9-45z%22%2F%3E%3C%2Fsvg%3E")}.actions{display:flex;gap:var(--_gap);flex-wrap:wrap}.action-button{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem .75rem;background:var(--_button-bg);border:1px solid var(--_border-color);border-radius:var(--_radius);font:inherit;font-size:.875em;cursor:pointer;transition:background-color .15s ease}.action-button:hover:not(:disabled){background:var(--_button-hover-bg)}.action-button:focus-visible{outline:2px solid var(--_focus-color);outline-offset:2px}.action-button:disabled{opacity:.5;cursor:not-allowed}.action-button__icon{inline-size:.875rem;block-size:.875rem;background-color:currentColor;mask-size:contain;mask-repeat:no-repeat;mask-position:center}.action-button__icon--add{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M256%2080c0-17.7-14.3-32-32-32s-32%2014.3-32%2032v144H48c-17.7%200-32%2014.3-32%2032s14.3%2032%2032%2032h144v144c0%2017.7%2014.3%2032%2032%2032s32-14.3%2032-32V288h144c17.7%200%2032-14.3%2032-32s-14.3-32-32-32H256z%22%2F%3E%3C%2Fsvg%3E")}.action-button__icon--clear{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20576%20512%22%3E%3Cpath%20d%3D%22M290.7%2057.4%2057.4%20290.7c-25%2025-25%2065.5%200%2090.5l80%2080c12%2012%2028.3%2018.7%2045.3%2018.7H512c17.7%200%2032-14.3%2032-32s-14.3-32-32-32H387.9l130.7-130.6c25-25%2025-65.5%200-90.5L381.3%2057.4c-25-25-65.5-25-90.5%200zm6.7%20358.6H182.6l-80-80%20124.7-124.7%20137.4%20137.4z%22%2F%3E%3C%2Fsvg%3E")}.initial-slot{display:none}@media (prefers-reduced-motion:reduce){.action-button,.entry__delete{transition:none}}`]}static{this.properties={name:{type:String},type:{type:String},placeholder:{type:String},protectDefaults:{type:Boolean,attribute:`protect-defaults`},min:{type:Number},max:{type:Number},addLabel:{type:String,attribute:`add-label`},clearLabel:{type:String,attribute:`clear-label`},deleteLabel:{type:String,attribute:`delete-label`},_entries:{type:Array,state:!0},_initialized:{type:Boolean,state:!0}}}constructor(){super(),this._handleAdd=()=>{if(this.max>0&&this._entries.length>=this.max)return;let e={id:this._generateId(),value:``,isDefault:!1};this._entries=[...this._entries,e],this.dispatchEvent(new CustomEvent(`multi-field-add`,{bubbles:!0,composed:!0})),this._dispatchChange(),this.updateComplete.then(()=>{let e=this.renderRoot.querySelectorAll(`.entry__input`);e[e.length-1]?.focus()})},this._handleClear=()=>{let e;for(e=this.protectDefaults?this._entries.filter(e=>e.isDefault):[];e.length<this.min;)e.push({id:this._generateId(),value:``,isDefault:!1});this._entries=e,this.dispatchEvent(new CustomEvent(`multi-field-clear`,{bubbles:!0,composed:!0})),this._dispatchChange()},this.init()}init(){this.name=void 0,this.type=`text`,this.placeholder=``,this.protectDefaults=!1,this.min=1,this.max=0,this.addLabel=`Add`,this.clearLabel=`Clear`,this.deleteLabel=`Delete`,this._entries=[],this._initialized=!1,this._idCounter=0}_generateId(){return`entry-${++this._idCounter}`}_initializeFromSlot(){if(this._initialized)return;let e=this.getSlottedNodes([`input`]),t=[];for(let n of e){let e=n,r=e.value||e.getAttribute(`value`)||``;t.push({id:this._generateId(),value:r,isDefault:!0})}for(;t.length<this.min;)t.push({id:this._generateId(),value:``,isDefault:!1});t.length===0&&t.push({id:this._generateId(),value:``,isDefault:!1}),this._entries=t,this._initialized=!0}firstUpdated(){this._initializeFromSlot()}willUpdate(e){if(e.has(`min`)&&this._initialized)for(;this._entries.length<this.min;)this._entries=[...this._entries,{id:this._generateId(),value:``,isDefault:!1}]}_getValues(){return this._entries.map(e=>e.value)}_dispatchChange(){this.dispatchEvent(new CustomEvent(`multi-field-change`,{detail:{values:this._getValues()},bubbles:!0,composed:!0}))}_handleInput(e,t){let n=t.target;this._entries=this._entries.map(t=>t.id===e?{...t,value:n.value}:t),this._dispatchChange()}_handleDelete(e){let t=this._entries.find(t=>t.id===e);if(!t||this.protectDefaults&&t.isDefault||this._entries.length<=this.min)return;let n=t.value;this._entries=this._entries.filter(t=>t.id!==e),this.dispatchEvent(new CustomEvent(`multi-field-delete`,{detail:{value:n},bubbles:!0,composed:!0})),this._dispatchChange()}_canDelete(e){return!(this._entries.length<=this.min||this.protectDefaults&&e.isDefault)}_canAdd(){return!(this.max>0&&this._entries.length>=this.max)}_canClear(){return this.protectDefaults?this._entries.some(e=>!e.isDefault):this._entries.length>this.min}render(){return Y` <div class="container" part="container"> <div class="initial-slot"> <slot @slotchange="${this._initializeFromSlot}"></slot> </div> <div class="entries" part="entries" role="list"> ${this._entries.map(e=>Y` <div class="entry" part="entry" role="listitem"> <input class="entry__input" part="input" type="${this.type}" name="${this.name?`${this.name}[]`:``}" placeholder="${this.placeholder}" .value="${e.value}" @input="${t=>this._handleInput(e.id,t)}" ?data-default="${e.isDefault}"> <button type="button" class="entry__delete" part="delete-button" aria-label="${this.deleteLabel}" ?disabled="${!this._canDelete(e)}" @click="${()=>this._handleDelete(e.id)}"> <span class="entry__delete-icon" aria-hidden="true"></span> </button> </div> `)} </div> <div class="actions" part="actions"> <button type="button" class="action-button" part="add-button" ?disabled="${!this._canAdd()}" @click="${this._handleAdd}"> <span class="action-button__icon action-button__icon--add" aria-hidden="true"></span> <slot name="add-label">${this.addLabel}</slot> </button> <button type="button" class="action-button" part="clear-button" ?disabled="${!this._canClear()}" @click="${this._handleClear}"> <span class="action-button__icon action-button__icon--clear" aria-hidden="true"></span> <slot name="clear-label">${this.clearLabel}</slot> </button> </div> </div> `}};customElements.get(`wc-multi-field`)||customElements.define(`wc-multi-field`,Qt);var $t=class extends X{createRenderRoot(){return this}#e=null;#t;connectedCallback(){super.connectedCallback(),Z(this,()=>this.#n())}#n(){if(this.#e)return!0;let e=this.querySelector(`.marquee__content`);return e?(this.#e=e,this.style.setProperty(`--_marquee-min`,`auto`),this.#r(),this.#t=new ResizeObserver(()=>this.#r()),this.#t.observe(this),!0):!1}disconnectedCallback(){this.#t?.disconnect(),super.disconnectedCallback()}#r(){let e=this.#e;if(!e)return;for(let e of this.querySelectorAll(`[data-marquee-clone]`))e.remove();let t=Number.parseFloat(getComputedStyle(this).columnGap)||0,n=e.getBoundingClientRect().width;if(n<=0)return;this.style.setProperty(`--_marquee-distance`,`${n+t}px`);let r=Math.ceil(this.getBoundingClientRect().width/(n+t))+1;for(let t=0;t<r;t++){let t=e.cloneNode(!0);t.dataset.marqueeClone=``,t.setAttribute(`aria-hidden`,`true`),this.append(t)}}};customElements.get(`wc-marquee`)||customElements.define(`wc-marquee`,$t);function en(e,t){let n=t.trim().toLowerCase();if(!n)return{keep:new Set,hits:0};let r=new Map,i=new Map;for(let t of e){r.set(t.key,t);let e=i.get(t.parent);e?e.push(t):i.set(t.parent,[t])}let a=new Set,o=0,s=e=>{for(let t of i.get(e)??[])a.has(t.key)||(a.add(t.key),s(t.key))};for(let t of e){if(!t.own.includes(n))continue;o++,a.add(t.key),s(t.key);let e=new Set([t.key]),i=r.get(t.parent);for(;i&&!e.has(i.key);)a.add(i.key),e.add(i.key),i=r.get(i.parent)}return{keep:a,hits:o}}function tn(e){let t=new Map;for(let n of e)t.set(n.key,n);return e.filter(e=>{if(e.hidden)return!1;let n=new Set([e.key]),r=e.parent===null||e.parent===void 0?void 0:t.get(e.parent);for(;r;){if(r.hidden||r.expanded===!1)return!1;if(n.has(r.key))break;n.add(r.key),r=r.parent===null||r.parent===void 0?void 0:t.get(r.parent)}return!0})}function nn(e,t,n){let r=tn(e);if(!r.length)return null;let i=r.findIndex(e=>e.key===t),a=i>=0?r[i]:void 0;switch(n){case`first`:return{type:`to`,key:r[0].key};case`last`:return{type:`to`,key:r[r.length-1].key};case`next`:return i<0?{type:`to`,key:r[0].key}:i<r.length-1?{type:`to`,key:r[i+1].key}:null;case`prev`:return i<0?{type:`to`,key:r[0].key}:i>0?{type:`to`,key:r[i-1].key}:null;case`in`:{if(!a||a.expanded===null)return null;if(a.expanded===!1)return{type:`expand`,key:a.key};let e=r[i+1];return e&&e.parent===a.key?{type:`to`,key:e.key}:null}case`out`:return a?a.expanded===!0?{type:`collapse`,key:a.key}:a.parent===null||a.parent===void 0?null:{type:`to`,key:a.parent}:null}}function rn(e,t){let n=e.find(e=>e.key===t);return n?e.filter(e=>e.parent===n.parent&&e.expanded!==null).map(e=>e.key):[]}function an(e,t,n){let r=e;typeof r.moveBefore==`function`?r.moveBefore(t,n):e.insertBefore(t,n)}function Q(e,t,n){for(;e.firstChild;)an(t,e.firstChild,n)}var on=class extends X{static{this.properties={label:{type:String,reflect:!0},nofilter:{type:Boolean,reflect:!0}}}createRenderRoot(){return this}render(){return T}#e=null;#t=[];#n=[];#r=null;#i=null;#a=null;#o=new WeakMap;#s=!1;#c;constructor(){super(),this.label=`Filter`,this.nofilter=!1,this.#c=new qt(this,{items:()=>this.#t.map(e=>e.key),keyToMove:this.#w,textFor:e=>this.#t.find(t=>t.key===e)?.label??``,ignoreWithin:`a, button, input, select, textarea, [contenteditable]`,onMove:(e,t,n)=>{n===`key`&&this.#e?.setAttribute(`data-tree-keyboard`,``),e.querySelector(`:scope > .tree__summary, :scope > .tree__content`)?.scrollIntoView({block:`nearest`})}})}connectedCallback(){super.connectedCallback(),Z(this,()=>this.#l())}#l(){if(this.#e)return!0;if(!this.isConnected)return!1;if(this.parentElement?.closest(`wc-tree`))return!0;let e=this.querySelector(`.tree`);return!e||!e.querySelector(`.tree__item`)?!1:(this.#u(e),this.#e=e,this.#p(),this.#b(),this.#c.attach(e),e.addEventListener(`click`,this.#S),e.addEventListener(`beforematch`,this.#k),e.addEventListener(`pointerdown`,this.#C),window.addEventListener(`hashchange`,this.#D),requestAnimationFrame(()=>this.#O()),!0)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(`hashchange`,this.#D),this.#e?.removeEventListener(`click`,this.#S),this.#e?.removeEventListener(`beforematch`,this.#k),this.#e?.removeEventListener(`pointerdown`,this.#C),this.#c.detach(),this.#r?.remove(),this.#r=null,this.#i=null,this.#a=null,this.#t=[],this.#n=[],this.#e=null}#u(e){for(let t of e.querySelectorAll(`details`))try{t.classList.contains(`tree__item`)?this.#f(t):t.parentElement&&this.#d(t.parentElement,t)}catch{}for(let t of e.querySelectorAll(`.tree__item`))t.setAttribute(`role`,`treeitem`);for(let t of e.querySelectorAll(`.tree`))t.setAttribute(`role`,`group`);e.setAttribute(`role`,`tree`),!e.hasAttribute(`aria-label`)&&!e.hasAttribute(`aria-labelledby`)&&e.setAttribute(`aria-label`,this.label)}#d(e,t){let n=t.open,r=t.querySelector(`:scope > summary`),i=document.createElement(`span`);i.className=`tree__summary`,e.insertBefore(i,t),r&&(Q(r,i,null),r.remove()),Q(t,e,t),t.remove(),this.#v(e,n)}#f(e){let t=e.open,n=e.parentElement;if(!n)return;let r=n.tagName===`UL`||n.tagName===`OL`?`li`:`div`,i=document.createElement(r);i.id=e.id,i.className=e.className,n.insertBefore(i,e);let a=e.querySelector(`:scope > summary`),o=document.createElement(`span`);o.className=`tree__summary`,i.appendChild(o),a&&(Q(a,o,null),a.remove()),Q(e,i,null),e.remove(),this.#v(i,t)}#p(){let e=this.#e?.querySelectorAll(`.tree__item`)??[];this.#t=[...e].map(e=>({key:e,parent:e.parentElement?.closest(`.tree__item`)??null,own:this.#h(e),label:this.#m(e)})),this.#n=this.#t.filter(e=>this.#g(e.key)!==null)}#m(e){return(e.querySelector(`:scope > .tree__summary, :scope > .tree__content`)?.textContent??``).trim().toLowerCase()}#h(e){let t=[],n=e.querySelector(`:scope > .tree__summary, :scope > .tree__content`);n?.textContent&&t.push(n.textContent);let r=e.querySelector(`:scope > .tree__desc, :scope > p`);return r?.textContent&&t.push(r.textContent),t.join(` `).toLowerCase()}#g(e){return e.querySelector(`:scope > .tree`)}#_(){return this.#t.map(e=>({...e,hidden:e.key.hidden===!0,expanded:this.#g(e.key)?e.key.getAttribute(`aria-expanded`)===`true`:null}))}#v(e,t){let n=this.#g(e);n&&(e.setAttribute(`aria-expanded`,String(t)),t?n.removeAttribute(`hidden`):n.setAttribute(`hidden`,`until-found`))}#y(e,t){e.hidden=t}#b(){let e=document.createElement(`div`);if(e.className=`tree__toolbar cluster`,!this.nofilter){let t=document.createElement(`input`);t.type=`search`,t.className=`tree__filter`,t.placeholder=this.label,t.setAttribute(`aria-label`,this.label),t.addEventListener(`input`,()=>this.filter(t.value));let n=document.createElement(`div`);n.className=`input-group tree__filter-group`,n.appendChild(t),e.appendChild(n),this.#i=t}for(let[t,n]of[[`Expand all`,!0],[`Collapse all`,!1]]){let r=document.createElement(`button`);r.type=`button`,r.className=`btn`,r.textContent=t,r.addEventListener(`click`,()=>this.toggleAll(n)),e.appendChild(r)}let t=document.createElement(`span`);t.className=`tree__count font-footnote`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),e.appendChild(t),this.#a=t,this.#e?.before(e),this.#r=e}toggleAll(e){for(let t of this.#n)this.#v(t.key,e);this.#c.sync()}filter(e){let t=e.trim().toLowerCase();if(!t){for(let{key:e}of this.#t)this.#y(e,!1);if(this.#s){for(let e of this.#n)this.#v(e.key,this.#o.get(e.key)??!1);this.#s=!1}this.#x(``),this.#c.sync();return}if(!this.#s){for(let e of this.#n)this.#o.set(e.key,e.key.getAttribute(`aria-expanded`)===`true`);this.#s=!0}let{keep:n,hits:r}=en(this.#t,t);for(let{key:e}of this.#t)this.#y(e,!n.has(e));for(let e of n){let t=e;this.#g(t)&&this.#v(t,!0)}this.#x(r===1?`1 match`:`${r} matches`),this.#c.sync(),this.dispatchEvent(new CustomEvent(`tree-filter`,{detail:{query:t,matches:r},bubbles:!0}))}#x(e){this.#a&&(this.#a.textContent=e)}#S=e=>{let t=e.target;if(!t||t.closest(`.tree__actions`))return;let n=t.closest(`.tree__summary`);if(!n)return;let r=n.parentElement;!(r instanceof HTMLElement)||!r.classList.contains(`tree__item`)||this.#g(r)&&(this.#v(r,r.getAttribute(`aria-expanded`)!==`true`),this.#c.sync())};#C=()=>{this.#e?.removeAttribute(`data-tree-keyboard`)};#w=(e,t)=>{let n=t.active;if(!n)return null;let r=this.#T(e.key,t.rtl);if(r)return this.#E(n,r);if(e.key===`Enter`||e.key===` `)return this.#g(n)?(this.#v(n,n.getAttribute(`aria-expanded`)!==`true`),this.#c.sync()):n.querySelector(`:scope > .tree__summary a, :scope > .tree__content a`)?.click(),{type:`handled`};if(e.key===`*`){for(let e of rn(this.#_(),n))this.#v(e,!0);return this.#c.sync(),{type:`handled`}}return null};#T(e,t){switch(e){case`ArrowDown`:return`next`;case`ArrowUp`:return`prev`;case`ArrowRight`:return t?`out`:`in`;case`ArrowLeft`:return t?`in`:`out`;case`Home`:return`first`;case`End`:return`last`;default:return null}}#E(e,t){let n=nn(this.#_(),e,t);return n?n.type===`to`?{type:`to`,item:n.key}:(this.#v(n.key,n.type===`expand`),this.#c.sync(),{type:`handled`}):null}#D=()=>this.#O();#O(){let e=decodeURIComponent(location.hash.slice(1));if(!e)return;let t=this.#e?.ownerDocument.getElementById(e);if(!(!t||!this.contains(t))){this.#g(t)&&this.#v(t,!0);for(let e=t.parentElement;e&&(e.classList.contains(`tree__item`)&&this.#v(e,!0),e!==this);e=e.parentElement);this.#i?.value&&this.filter(this.#i.value=``),this.#c.setActive(t,{focus:!1,cause:`api`}),(t.querySelector(`:scope > .tree__summary, :scope > .tree__content`)??t).scrollIntoView({block:`start`,behavior:`smooth`})}}#k=e=>{let t=e.target;if(!(t instanceof HTMLElement))return;let n=t.parentElement;n instanceof HTMLElement&&n.classList.contains(`tree__item`)&&n.setAttribute(`aria-expanded`,`true`)}};customElements.get(`wc-tree`)||customElements.define(`wc-tree`,on);function sn(e){return!e.hasLink||e.onInteractive||e.platformHandled?!1:e.moved<=6}const cn=[`a[href]`,`button`,`input`,`select`,`textarea`,`label`,`summary`,`details`,`audio[controls]`,`video[controls]`,`[contenteditable]`,`[role="button"]`,`[role="link"]`,`[onclick]`,`[data-no-card-link]`].join(`,`);function ln(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}var un=class extends X{static{this.properties={item:{type:String,reflect:!0}}}createRenderRoot(){return this}render(){return T}#e=[];#t;constructor(){super(),this.item=`.card`}connectedCallback(){super.connectedCallback(),Z(this,()=>this.#n())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerdown`,this.#i),this.removeEventListener(`click`,this.#a);for(let e of this.#e)e.removeAttribute(`data-card-link`);this.#e=[]}#n(){if(this.parentElement?.closest(`wc-cards`)||this.#e.length)return!0;let e=[...this.querySelectorAll(this.item)];if(!e.length)return!1;if(this.#e=e.filter(e=>this.#r(e)),!this.#e.length)return!0;for(let e of this.#e)e.setAttribute(`data-card-link`,``);return this.addEventListener(`pointerdown`,this.#i),this.addEventListener(`click`,this.#a),!0}#r(e){return e.querySelector(`a[href][data-card-link-target]`)??e.querySelector(`a[href]`)}#i=e=>{this.#t={x:e.clientX,y:e.clientY}};#a=e=>{let t=e.target,n=t?.closest(`[data-card-link]`);if(!n||!this.contains(n))return;let r=this.#r(n);if(r&&t?.closest(`a[href]`)===r)return;let i=sn({moved:this.#t?ln(this.#t,{x:e.clientX,y:e.clientY}):0,onInteractive:!!t?.closest(cn),platformHandled:e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0,hasLink:!!r});this.#t=void 0,!(!i||!r)&&r.click()}};customElements.get(`wc-cards`)||customElements.define(`wc-cards`,un);function dn(e,t,n){if(t<=1)return[];let r=[Ht({index:e,total:t,delta:-1,loop:n}),Ht({index:e,total:t,delta:1,loop:n})];return[...new Set(r)].filter(t=>t!==e)}var fn=class extends X{createRenderRoot(){return this}render(){return T}#e=!1;#t=null;#n=null;#r=null;#i=[];#a=!1;connectedCallback(){super.connectedCallback(),Z(this,()=>this.#o())}disconnectedCallback(){super.disconnectedCallback();for(let e of this.#i)e.trigger.removeEventListener(`click`,this.#s);this.#r?.removeEventListener(`click`,this.#u),this.#n?.removeEventListener(`carousel-change`,this.#d),this.#i=[],this.#t=null,this.#n=null,this.#r=null,this.#e=!1}#o(){if(this.parentElement?.closest(`wc-gallery`)||this.#e)return!0;let e=[...this.querySelectorAll(`.gallery__trigger[href^="#"]`)],t=this.querySelector(`dialog.lightbox-dialog`);if(!e.length||!t)return!1;let n=t.querySelector(`.lightbox-dialog__track`);if(!n)return!1;let r=[];for(let t of e){let e=t.getAttribute(`href`)?.slice(1),n=e?this.querySelector(`#${CSS.escape(e)}`):null;if(!n)return!1;r.push({trigger:t,slide:n})}this.#a=matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.#t=t,this.#n=n,this.#r=t.querySelector(`.lightbox-dialog__close`),this.#i=r;for(let e of r)e.trigger.addEventListener(`click`,this.#s);return this.#r?.addEventListener(`click`,this.#u),n.addEventListener(`carousel-change`,this.#d),this.#e=!0,!0}#s=e=>{let t=e.currentTarget,n=this.#i.find(e=>e.trigger===t);!n||!this.#t||(e.preventDefault(),this.#c(n))};#c(e){let t=this.#i.indexOf(e),n=this.#i.length,r=()=>{this.#t.showModal(),e.slide.scrollIntoView({inline:`center`,block:`nearest`,behavior:`instant`}),this.#l(t),this.dispatchEvent(new CustomEvent(`gallery-open`,{bubbles:!0,composed:!0,detail:{index:t,total:n}}))},i=e.trigger.querySelector(`.gallery__thumb`),a=e.slide.querySelector(`img`);if(this.#a||!(`startViewTransition`in document)||!i||!a){r();return}i.style.viewTransitionName=`lightbox-active`,document.startViewTransition(()=>{i.style.viewTransitionName=``,a.style.viewTransitionName=`lightbox-active`,r()}).finished.finally(()=>{a.style.viewTransitionName=``})}#l(e){let t=this.#n?.hasAttribute(`loop`)??!1;for(let n of dn(e,this.#i.length,t)){let e=this.#i[n]?.slide.querySelector(`img`),t=e?.currentSrc||e?.src;t&&(new Image().src=t)}}#u=e=>{e.preventDefault(),this.#t?.close()};#d=e=>{this.dispatchEvent(new CustomEvent(`gallery-change`,{bubbles:!0,composed:!0,detail:e.detail}))}};customElements.get(`wc-gallery`)||customElements.define(`wc-gallery`,fn);const pn=/^([^0-9-]*)(-?[0-9,]*\.?[0-9]*)([^0-9]*)$/;function mn(e,t){let n=pn.exec(e.trim()),r=n?.[2]||`0`,i=r.split(`.`)[1];return{prefix:(n?.[1]??``).trim(),suffix:(n?.[3]??``).trim(),value:Number.parseFloat(r.replace(/,/g,``))||0,decimals:t??i?.length??0,grouping:r.includes(`,`)}}function hn(e){return new Intl.NumberFormat(void 0,{minimumFractionDigits:e.decimals,maximumFractionDigits:e.decimals,useGrouping:e.grouping})}const gn={linear:`linear`,"ease-in":`var(--custom-ease-in)`,"ease-out":`var(--custom-ease-out)`,"float-sine":`var(--ease-float-sine)`,"float-bounce":`var(--ease-float-bounce)`};function _n(e){return e?gn[e]:void 0}const $=new WeakMap;let vn;function yn(){return vn??=new IntersectionObserver((e,t)=>{for(let n of e)n.isIntersecting&&(t.unobserve(n.target),$.get(n.target)?.())})}var bn=class extends X{createRenderRoot(){return this}render(){return T}#e=!1;#t=null;#n=null;#r=null;#i=``;#a=``;#o=0;#s=0;#c=0;#l=!1;connectedCallback(){super.connectedCallback(),Z(this,()=>this.#u())}disconnectedCallback(){super.disconnectedCallback(),yn().unobserve(this),$.delete(this),this.#h(),this.#n?.remove(),this.#n=null,this.#t?.classList.remove(`sr-only`),this.#t=null,this.#e=!1}#u(){if(this.parentElement?.closest(`wc-counter`)||this.#e)return!0;let e=this.querySelector(`.counter__value`);if(!e)return!1;this.#t=e;let t=this.getAttribute(`data-decimals`),n=mn(e.textContent??``,t?Number(t):void 0);if(this.#i=n.prefix,this.#a=n.suffix,this.#o=n.value,this.#r=hn(n),this.#e=!0,matchMedia(`(prefers-reduced-motion: reduce)`).matches)return!0;let r=document.createElement(`span`);r.className=`counter__presentation`,r.setAttribute(`aria-hidden`,`true`),r.textContent=e.textContent,e.insertAdjacentElement(`afterend`,r),this.#n=r,this.setAttribute(`aria-live`,`off`);let i=this.getAttribute(`data-from`)??`0`,a=Number(this.getAttribute(`data-duration`)??`1200`);this.style.setProperty(`--counter-from`,i),this.style.setProperty(`--counter-to`,String(this.#o)),this.style.setProperty(`--counter-duration`,`${a}ms`);let o=_n(this.getAttribute(`data-easing`));return o&&this.style.setProperty(`--counter-easing`,o),$.set(this,()=>this.#d(a)),yn().observe(this),!0}#d(e){this.#n&&(this.#l=!1,this.setAttribute(`running`,``),this.#t?.classList.add(`sr-only`),this.#n.addEventListener(`animationend`,this.#m,{once:!0}),this.#c=window.setTimeout(this.#m,e+100),this.#s=requestAnimationFrame(this.#f))}#f=()=>{if(!this.#n||!this.#r)return;let e=Number.parseFloat(getComputedStyle(this.#n).getPropertyValue(`--_n`));this.#p(Number.isFinite(e)?e:this.#o),this.#s=requestAnimationFrame(this.#f)};#p(e){!this.#n||!this.#r||(this.#n.textContent=`${this.#i}${this.#r.format(e)}${this.#a}`)}#m=()=>{this.#l||(this.#l=!0,this.#p(this.#o),this.#h(),this.#t?.classList.remove(`sr-only`),this.removeAttribute(`running`))};#h(){this.#s&&cancelAnimationFrame(this.#s),this.#s=0,this.#c&&clearTimeout(this.#c),this.#c=0,this.#n?.removeEventListener(`animationend`,this.#m)}};customElements.get(`wc-counter`)||customElements.define(`wc-counter`,bn);
|
|
50
|
+
:host{--_gap:var(--multi-field-gap, 0.5rem);--_input-padding:var(--multi-field-input-padding, 0.5rem 0.75rem);--_radius:var(--multi-field-border-radius, 0.375rem);--_border-color:var(--multi-field-border-color, oklch(0.8 0 0));--_focus-color:var(--multi-field-focus-color, oklch(0.6 0.2 250));--_button-bg:var(--multi-field-button-bg, oklch(0.95 0 0));--_button-hover-bg:var(--multi-field-button-hover-bg, oklch(0.9 0 0));--_delete-color:var(--multi-field-delete-color, oklch(0.6 0.2 25));--_delete-hover-bg:var(--multi-field-delete-hover-bg, oklch(0.95 0.05 25));display:block}.container,.entries{flex-direction:column}.container,.entries,.entry{display:flex;gap:var(--_gap)}.entry{align-items:center}.entry__input{flex:1;padding:var(--_input-padding);border:1px solid var(--_border-color);border-radius:var(--_radius);font:inherit;background:transparent}.entry__input:focus-visible{outline:2px solid var(--_focus-color);outline-offset:2px}.entry__input:disabled{opacity:.6;cursor:not-allowed}.entry__delete{display:inline-flex;align-items:center;justify-content:center;min-inline-size:2rem;min-block-size:2rem;padding:.25rem;background:transparent;border:1px solid transparent;border-radius:var(--_radius);color:var(--_delete-color);cursor:pointer;transition:background-color .15s ease}.entry__delete:hover:not(:disabled){background:var(--_delete-hover-bg)}.entry__delete:focus-visible{outline:2px solid var(--_focus-color);outline-offset:2px}.entry__delete:disabled{opacity:.3;cursor:not-allowed}.entry__delete-icon{inline-size:1rem;block-size:1rem;background-color:currentColor;mask-size:contain;mask-repeat:no-repeat;mask-position:center;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M135.2%2017.7%20128%2032H32C14.3%2032%200%2046.3%200%2064s14.3%2032%2032%2032h384c17.7%200%2032-14.3%2032-32s-14.3-32-32-32h-96l-7.2-14.3C307.4%206.8%20296.3%200%20284.2%200H163.8c-12.1%200-23.2%206.8-28.6%2017.7M416%20128H32l21.2%20339c1.6%2025.3%2022.6%2045%2047.9%2045h245.8c25.3%200%2046.3-19.7%2047.9-45z%22%2F%3E%3C%2Fsvg%3E")}.actions{display:flex;gap:var(--_gap);flex-wrap:wrap}.action-button{display:inline-flex;align-items:center;gap:.375rem;padding:.5rem .75rem;background:var(--_button-bg);border:1px solid var(--_border-color);border-radius:var(--_radius);font:inherit;font-size:.875em;cursor:pointer;transition:background-color .15s ease}.action-button:hover:not(:disabled){background:var(--_button-hover-bg)}.action-button:focus-visible{outline:2px solid var(--_focus-color);outline-offset:2px}.action-button:disabled{opacity:.5;cursor:not-allowed}.action-button__icon{inline-size:.875rem;block-size:.875rem;background-color:currentColor;mask-size:contain;mask-repeat:no-repeat;mask-position:center}.action-button__icon--add{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M256%2080c0-17.7-14.3-32-32-32s-32%2014.3-32%2032v144H48c-17.7%200-32%2014.3-32%2032s14.3%2032%2032%2032h144v144c0%2017.7%2014.3%2032%2032%2032s32-14.3%2032-32V288h144c17.7%200%2032-14.3%2032-32s-14.3-32-32-32H256z%22%2F%3E%3C%2Fsvg%3E")}.action-button__icon--clear{mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20576%20512%22%3E%3Cpath%20d%3D%22M290.7%2057.4%2057.4%20290.7c-25%2025-25%2065.5%200%2090.5l80%2080c12%2012%2028.3%2018.7%2045.3%2018.7H512c17.7%200%2032-14.3%2032-32s-14.3-32-32-32H387.9l130.7-130.6c25-25%2025-65.5%200-90.5L381.3%2057.4c-25-25-65.5-25-90.5%200zm6.7%20358.6H182.6l-80-80%20124.7-124.7%20137.4%20137.4z%22%2F%3E%3C%2Fsvg%3E")}.initial-slot{display:none}@media (prefers-reduced-motion:reduce){.action-button,.entry__delete{transition:none}}`]}static{this.properties={name:{type:String},type:{type:String},placeholder:{type:String},protectDefaults:{type:Boolean,attribute:`protect-defaults`},min:{type:Number},max:{type:Number},addLabel:{type:String,attribute:`add-label`},clearLabel:{type:String,attribute:`clear-label`},deleteLabel:{type:String,attribute:`delete-label`},_entries:{type:Array,state:!0},_initialized:{type:Boolean,state:!0}}}constructor(){super(),this._handleAdd=()=>{if(this.max>0&&this._entries.length>=this.max)return;let e={id:this._generateId(),value:``,isDefault:!1};this._entries=[...this._entries,e],this.dispatchEvent(new CustomEvent(`multi-field-add`,{bubbles:!0,composed:!0})),this._dispatchChange(),this.updateComplete.then(()=>{let e=this.renderRoot.querySelectorAll(`.entry__input`);e[e.length-1]?.focus()})},this._handleClear=()=>{let e;for(e=this.protectDefaults?this._entries.filter(e=>e.isDefault):[];e.length<this.min;)e.push({id:this._generateId(),value:``,isDefault:!1});this._entries=e,this.dispatchEvent(new CustomEvent(`multi-field-clear`,{bubbles:!0,composed:!0})),this._dispatchChange()},this.init()}init(){this.name=void 0,this.type=`text`,this.placeholder=``,this.protectDefaults=!1,this.min=1,this.max=0,this.addLabel=`Add`,this.clearLabel=`Clear`,this.deleteLabel=`Delete`,this._entries=[],this._initialized=!1,this._idCounter=0}_generateId(){return`entry-${++this._idCounter}`}_initializeFromSlot(){if(this._initialized)return;let e=this.getSlottedNodes([`input`]),t=[];for(let n of e){let e=n,r=e.value||e.getAttribute(`value`)||``;t.push({id:this._generateId(),value:r,isDefault:!0})}for(;t.length<this.min;)t.push({id:this._generateId(),value:``,isDefault:!1});t.length===0&&t.push({id:this._generateId(),value:``,isDefault:!1}),this._entries=t,this._initialized=!0}firstUpdated(){this._initializeFromSlot()}willUpdate(e){if(e.has(`min`)&&this._initialized)for(;this._entries.length<this.min;)this._entries=[...this._entries,{id:this._generateId(),value:``,isDefault:!1}]}_getValues(){return this._entries.map(e=>e.value)}_dispatchChange(){this.dispatchEvent(new CustomEvent(`multi-field-change`,{detail:{values:this._getValues()},bubbles:!0,composed:!0}))}_handleInput(e,t){let n=t.target;this._entries=this._entries.map(t=>t.id===e?{...t,value:n.value}:t),this._dispatchChange()}_handleDelete(e){let t=this._entries.find(t=>t.id===e);if(!t||this.protectDefaults&&t.isDefault||this._entries.length<=this.min)return;let n=t.value;this._entries=this._entries.filter(t=>t.id!==e),this.dispatchEvent(new CustomEvent(`multi-field-delete`,{detail:{value:n},bubbles:!0,composed:!0})),this._dispatchChange()}_canDelete(e){return!(this._entries.length<=this.min||this.protectDefaults&&e.isDefault)}_canAdd(){return!(this.max>0&&this._entries.length>=this.max)}_canClear(){return this.protectDefaults?this._entries.some(e=>!e.isDefault):this._entries.length>this.min}render(){return Y` <div class="container" part="container"> <div class="initial-slot"> <slot @slotchange="${this._initializeFromSlot}"></slot> </div> <div class="entries" part="entries" role="list"> ${this._entries.map(e=>Y` <div class="entry" part="entry" role="listitem"> <input class="entry__input" part="input" type="${this.type}" name="${this.name?`${this.name}[]`:``}" placeholder="${this.placeholder}" .value="${e.value}" @input="${t=>this._handleInput(e.id,t)}" ?data-default="${e.isDefault}"> <button type="button" class="entry__delete" part="delete-button" aria-label="${this.deleteLabel}" ?disabled="${!this._canDelete(e)}" @click="${()=>this._handleDelete(e.id)}"> <span class="entry__delete-icon" aria-hidden="true"></span> </button> </div> `)} </div> <div class="actions" part="actions"> <button type="button" class="action-button" part="add-button" ?disabled="${!this._canAdd()}" @click="${this._handleAdd}"> <span class="action-button__icon action-button__icon--add" aria-hidden="true"></span> <slot name="add-label">${this.addLabel}</slot> </button> <button type="button" class="action-button" part="clear-button" ?disabled="${!this._canClear()}" @click="${this._handleClear}"> <span class="action-button__icon action-button__icon--clear" aria-hidden="true"></span> <slot name="clear-label">${this.clearLabel}</slot> </button> </div> </div> `}};customElements.get(`wc-multi-field`)||customElements.define(`wc-multi-field`,Qt);var $t=class extends X{createRenderRoot(){return this}#e=null;#t;#n;connectedCallback(){super.connectedCallback(),Z(this,()=>this.#r())}#r(){if(this.#e)return!0;let e=this.querySelectorAll(`.marquee__content`),t=e[0];if(!t)return!1;this.#e=t;for(let t of Array.from(e).slice(1))t.dataset.marqueeClone=``;return this.style.setProperty(`--_marquee-min`,`auto`),this.#i(),this.#t=new ResizeObserver(()=>this.#i()),this.#t.observe(this),this.#t.observe(t),!0}disconnectedCallback(){this.#t?.disconnect(),super.disconnectedCallback()}#i(){let e=this.#e;if(!e)return;let t=getComputedStyle(this),n=t.flexDirection.startsWith(`column`),r=Number.parseFloat(n?t.rowGap:t.columnGap)||0,i=e.getBoundingClientRect(),a=n?i.height:i.width;if(a<=0)return;let o=this.getBoundingClientRect(),s=n?o.height:o.width;if(this.#n&&this.#n.one===a&&this.#n.gap===r&&this.#n.container===s&&this.#n.vertical===n)return;this.#n={one:a,gap:r,container:s,vertical:n};for(let e of this.querySelectorAll(`[data-marquee-clone]`))e.remove();this.style.setProperty(`--_marquee-distance`,`${a+r}px`);let c=Math.ceil((s+r)/(a+r))+1;for(let t=0;t<c;t++){let t=e.cloneNode(!0);t.dataset.marqueeClone=``,t.setAttribute(`aria-hidden`,`true`),this.append(t)}}};customElements.get(`wc-marquee`)||customElements.define(`wc-marquee`,$t);function en(e,t){let n=t.trim().toLowerCase();if(!n)return{keep:new Set,hits:0};let r=new Map,i=new Map;for(let t of e){r.set(t.key,t);let e=i.get(t.parent);e?e.push(t):i.set(t.parent,[t])}let a=new Set,o=0,s=e=>{for(let t of i.get(e)??[])a.has(t.key)||(a.add(t.key),s(t.key))};for(let t of e){if(!t.own.includes(n))continue;o++,a.add(t.key),s(t.key);let e=new Set([t.key]),i=r.get(t.parent);for(;i&&!e.has(i.key);)a.add(i.key),e.add(i.key),i=r.get(i.parent)}return{keep:a,hits:o}}function tn(e){let t=new Map;for(let n of e)t.set(n.key,n);return e.filter(e=>{if(e.hidden)return!1;let n=new Set([e.key]),r=e.parent===null||e.parent===void 0?void 0:t.get(e.parent);for(;r;){if(r.hidden||r.expanded===!1)return!1;if(n.has(r.key))break;n.add(r.key),r=r.parent===null||r.parent===void 0?void 0:t.get(r.parent)}return!0})}function nn(e,t,n){let r=tn(e);if(!r.length)return null;let i=r.findIndex(e=>e.key===t),a=i>=0?r[i]:void 0;switch(n){case`first`:return{type:`to`,key:r[0].key};case`last`:return{type:`to`,key:r[r.length-1].key};case`next`:return i<0?{type:`to`,key:r[0].key}:i<r.length-1?{type:`to`,key:r[i+1].key}:null;case`prev`:return i<0?{type:`to`,key:r[0].key}:i>0?{type:`to`,key:r[i-1].key}:null;case`in`:{if(!a||a.expanded===null)return null;if(a.expanded===!1)return{type:`expand`,key:a.key};let e=r[i+1];return e&&e.parent===a.key?{type:`to`,key:e.key}:null}case`out`:return a?a.expanded===!0?{type:`collapse`,key:a.key}:a.parent===null||a.parent===void 0?null:{type:`to`,key:a.parent}:null}}function rn(e,t){let n=e.find(e=>e.key===t);return n?e.filter(e=>e.parent===n.parent&&e.expanded!==null).map(e=>e.key):[]}function an(e,t,n){let r=e;typeof r.moveBefore==`function`?r.moveBefore(t,n):e.insertBefore(t,n)}function Q(e,t,n){for(;e.firstChild;)an(t,e.firstChild,n)}var on=class extends X{static{this.properties={label:{type:String,reflect:!0},nofilter:{type:Boolean,reflect:!0}}}createRenderRoot(){return this}render(){return T}#e=null;#t=[];#n=[];#r=null;#i=null;#a=null;#o=new WeakMap;#s=!1;#c;constructor(){super(),this.label=`Filter`,this.nofilter=!1,this.#c=new qt(this,{items:()=>this.#t.map(e=>e.key),keyToMove:this.#w,textFor:e=>this.#t.find(t=>t.key===e)?.label??``,ignoreWithin:`a, button, input, select, textarea, [contenteditable]`,onMove:(e,t,n)=>{n===`key`&&this.#e?.setAttribute(`data-tree-keyboard`,``),e.querySelector(`:scope > .tree__summary, :scope > .tree__content`)?.scrollIntoView({block:`nearest`})}})}connectedCallback(){super.connectedCallback(),Z(this,()=>this.#l())}#l(){if(this.#e)return!0;if(!this.isConnected)return!1;if(this.parentElement?.closest(`wc-tree`))return!0;let e=this.querySelector(`.tree`);return!e||!e.querySelector(`.tree__item`)?!1:(this.#u(e),this.#e=e,this.#p(),this.#b(),this.#c.attach(e),e.addEventListener(`click`,this.#S),e.addEventListener(`beforematch`,this.#k),e.addEventListener(`pointerdown`,this.#C),window.addEventListener(`hashchange`,this.#D),requestAnimationFrame(()=>this.#O()),!0)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(`hashchange`,this.#D),this.#e?.removeEventListener(`click`,this.#S),this.#e?.removeEventListener(`beforematch`,this.#k),this.#e?.removeEventListener(`pointerdown`,this.#C),this.#c.detach(),this.#r?.remove(),this.#r=null,this.#i=null,this.#a=null,this.#t=[],this.#n=[],this.#e=null}#u(e){for(let t of e.querySelectorAll(`details`))try{t.classList.contains(`tree__item`)?this.#f(t):t.parentElement&&this.#d(t.parentElement,t)}catch{}for(let t of e.querySelectorAll(`.tree__item`))t.setAttribute(`role`,`treeitem`);for(let t of e.querySelectorAll(`.tree`))t.setAttribute(`role`,`group`);e.setAttribute(`role`,`tree`),!e.hasAttribute(`aria-label`)&&!e.hasAttribute(`aria-labelledby`)&&e.setAttribute(`aria-label`,this.label)}#d(e,t){let n=t.open,r=t.querySelector(`:scope > summary`),i=document.createElement(`span`);i.className=`tree__summary`,e.insertBefore(i,t),r&&(Q(r,i,null),r.remove()),Q(t,e,t),t.remove(),this.#v(e,n)}#f(e){let t=e.open,n=e.parentElement;if(!n)return;let r=n.tagName===`UL`||n.tagName===`OL`?`li`:`div`,i=document.createElement(r);i.id=e.id,i.className=e.className,n.insertBefore(i,e);let a=e.querySelector(`:scope > summary`),o=document.createElement(`span`);o.className=`tree__summary`,i.appendChild(o),a&&(Q(a,o,null),a.remove()),Q(e,i,null),e.remove(),this.#v(i,t)}#p(){let e=this.#e?.querySelectorAll(`.tree__item`)??[];this.#t=[...e].map(e=>({key:e,parent:e.parentElement?.closest(`.tree__item`)??null,own:this.#h(e),label:this.#m(e)})),this.#n=this.#t.filter(e=>this.#g(e.key)!==null)}#m(e){return(e.querySelector(`:scope > .tree__summary, :scope > .tree__content`)?.textContent??``).trim().toLowerCase()}#h(e){let t=[],n=e.querySelector(`:scope > .tree__summary, :scope > .tree__content`);n?.textContent&&t.push(n.textContent);let r=e.querySelector(`:scope > .tree__desc, :scope > p`);return r?.textContent&&t.push(r.textContent),t.join(` `).toLowerCase()}#g(e){return e.querySelector(`:scope > .tree`)}#_(){return this.#t.map(e=>({...e,hidden:e.key.hidden===!0,expanded:this.#g(e.key)?e.key.getAttribute(`aria-expanded`)===`true`:null}))}#v(e,t){let n=this.#g(e);n&&(e.setAttribute(`aria-expanded`,String(t)),t?n.removeAttribute(`hidden`):n.setAttribute(`hidden`,`until-found`))}#y(e,t){e.hidden=t}#b(){let e=document.createElement(`div`);if(e.className=`tree__toolbar cluster`,!this.nofilter){let t=document.createElement(`input`);t.type=`search`,t.className=`tree__filter`,t.placeholder=this.label,t.setAttribute(`aria-label`,this.label),t.addEventListener(`input`,()=>this.filter(t.value));let n=document.createElement(`div`);n.className=`input-group tree__filter-group`,n.appendChild(t),e.appendChild(n),this.#i=t}for(let[t,n]of[[`Expand all`,!0],[`Collapse all`,!1]]){let r=document.createElement(`button`);r.type=`button`,r.className=`btn`,r.textContent=t,r.addEventListener(`click`,()=>this.toggleAll(n)),e.appendChild(r)}let t=document.createElement(`span`);t.className=`tree__count font-footnote`,t.setAttribute(`role`,`status`),t.setAttribute(`aria-live`,`polite`),e.appendChild(t),this.#a=t,this.#e?.before(e),this.#r=e}toggleAll(e){for(let t of this.#n)this.#v(t.key,e);this.#c.sync()}filter(e){let t=e.trim().toLowerCase();if(!t){for(let{key:e}of this.#t)this.#y(e,!1);if(this.#s){for(let e of this.#n)this.#v(e.key,this.#o.get(e.key)??!1);this.#s=!1}this.#x(``),this.#c.sync();return}if(!this.#s){for(let e of this.#n)this.#o.set(e.key,e.key.getAttribute(`aria-expanded`)===`true`);this.#s=!0}let{keep:n,hits:r}=en(this.#t,t);for(let{key:e}of this.#t)this.#y(e,!n.has(e));for(let e of n){let t=e;this.#g(t)&&this.#v(t,!0)}this.#x(r===1?`1 match`:`${r} matches`),this.#c.sync(),this.dispatchEvent(new CustomEvent(`tree-filter`,{detail:{query:t,matches:r},bubbles:!0}))}#x(e){this.#a&&(this.#a.textContent=e)}#S=e=>{let t=e.target;if(!t||t.closest(`.tree__actions`))return;let n=t.closest(`.tree__summary`);if(!n)return;let r=n.parentElement;!(r instanceof HTMLElement)||!r.classList.contains(`tree__item`)||this.#g(r)&&(this.#v(r,r.getAttribute(`aria-expanded`)!==`true`),this.#c.sync())};#C=()=>{this.#e?.removeAttribute(`data-tree-keyboard`)};#w=(e,t)=>{let n=t.active;if(!n)return null;let r=this.#T(e.key,t.rtl);if(r)return this.#E(n,r);if(e.key===`Enter`||e.key===` `)return this.#g(n)?(this.#v(n,n.getAttribute(`aria-expanded`)!==`true`),this.#c.sync()):n.querySelector(`:scope > .tree__summary a, :scope > .tree__content a`)?.click(),{type:`handled`};if(e.key===`*`){for(let e of rn(this.#_(),n))this.#v(e,!0);return this.#c.sync(),{type:`handled`}}return null};#T(e,t){switch(e){case`ArrowDown`:return`next`;case`ArrowUp`:return`prev`;case`ArrowRight`:return t?`out`:`in`;case`ArrowLeft`:return t?`in`:`out`;case`Home`:return`first`;case`End`:return`last`;default:return null}}#E(e,t){let n=nn(this.#_(),e,t);return n?n.type===`to`?{type:`to`,item:n.key}:(this.#v(n.key,n.type===`expand`),this.#c.sync(),{type:`handled`}):null}#D=()=>this.#O();#O(){let e=decodeURIComponent(location.hash.slice(1));if(!e)return;let t=this.#e?.ownerDocument.getElementById(e);if(!(!t||!this.contains(t))){this.#g(t)&&this.#v(t,!0);for(let e=t.parentElement;e&&(e.classList.contains(`tree__item`)&&this.#v(e,!0),e!==this);e=e.parentElement);this.#i?.value&&this.filter(this.#i.value=``),this.#c.setActive(t,{focus:!1,cause:`api`}),(t.querySelector(`:scope > .tree__summary, :scope > .tree__content`)??t).scrollIntoView({block:`start`,behavior:`smooth`})}}#k=e=>{let t=e.target;if(!(t instanceof HTMLElement))return;let n=t.parentElement;n instanceof HTMLElement&&n.classList.contains(`tree__item`)&&n.setAttribute(`aria-expanded`,`true`)}};customElements.get(`wc-tree`)||customElements.define(`wc-tree`,on);function sn(e){return!e.hasLink||e.onInteractive||e.platformHandled?!1:e.moved<=6}const cn=[`a[href]`,`button`,`input`,`select`,`textarea`,`label`,`summary`,`details`,`audio[controls]`,`video[controls]`,`[contenteditable]`,`[role="button"]`,`[role="link"]`,`[onclick]`,`[data-no-card-link]`].join(`,`);function ln(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}var un=class extends X{static{this.properties={item:{type:String,reflect:!0}}}createRenderRoot(){return this}render(){return T}#e=[];#t;constructor(){super(),this.item=`.card`}connectedCallback(){super.connectedCallback(),Z(this,()=>this.#n())}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`pointerdown`,this.#i),this.removeEventListener(`click`,this.#a);for(let e of this.#e)e.removeAttribute(`data-card-link`);this.#e=[]}#n(){if(this.parentElement?.closest(`wc-cards`)||this.#e.length)return!0;let e=[...this.querySelectorAll(this.item)];if(!e.length)return!1;if(this.#e=e.filter(e=>this.#r(e)),!this.#e.length)return!0;for(let e of this.#e)e.setAttribute(`data-card-link`,``);return this.addEventListener(`pointerdown`,this.#i),this.addEventListener(`click`,this.#a),!0}#r(e){return e.querySelector(`a[href][data-card-link-target]`)??e.querySelector(`a[href]`)}#i=e=>{this.#t={x:e.clientX,y:e.clientY}};#a=e=>{let t=e.target,n=t?.closest(`[data-card-link]`);if(!n||!this.contains(n))return;let r=this.#r(n);if(r&&t?.closest(`a[href]`)===r)return;let i=sn({moved:this.#t?ln(this.#t,{x:e.clientX,y:e.clientY}):0,onInteractive:!!t?.closest(cn),platformHandled:e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0,hasLink:!!r});this.#t=void 0,!(!i||!r)&&r.click()}};customElements.get(`wc-cards`)||customElements.define(`wc-cards`,un);function dn(e,t,n){if(t<=1)return[];let r=[Ht({index:e,total:t,delta:-1,loop:n}),Ht({index:e,total:t,delta:1,loop:n})];return[...new Set(r)].filter(t=>t!==e)}var fn=class extends X{createRenderRoot(){return this}render(){return T}#e=!1;#t=null;#n=null;#r=null;#i=[];#a=!1;connectedCallback(){super.connectedCallback(),Z(this,()=>this.#o())}disconnectedCallback(){super.disconnectedCallback();for(let e of this.#i)e.trigger.removeEventListener(`click`,this.#s);this.#r?.removeEventListener(`click`,this.#u),this.#n?.removeEventListener(`carousel-change`,this.#d),this.#i=[],this.#t=null,this.#n=null,this.#r=null,this.#e=!1}#o(){if(this.parentElement?.closest(`wc-gallery`)||this.#e)return!0;let e=[...this.querySelectorAll(`.gallery__trigger[href^="#"]`)],t=this.querySelector(`dialog.lightbox-dialog`);if(!e.length||!t)return!1;let n=t.querySelector(`.lightbox-dialog__track`);if(!n)return!1;let r=[];for(let t of e){let e=t.getAttribute(`href`)?.slice(1),n=e?this.querySelector(`#${CSS.escape(e)}`):null;if(!n)return!1;r.push({trigger:t,slide:n})}this.#a=matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.#t=t,this.#n=n,this.#r=t.querySelector(`.lightbox-dialog__close`),this.#i=r;for(let e of r)e.trigger.addEventListener(`click`,this.#s);return this.#r?.addEventListener(`click`,this.#u),n.addEventListener(`carousel-change`,this.#d),this.#e=!0,!0}#s=e=>{let t=e.currentTarget,n=this.#i.find(e=>e.trigger===t);!n||!this.#t||(e.preventDefault(),this.#c(n))};#c(e){let t=this.#i.indexOf(e),n=this.#i.length,r=()=>{this.#t.showModal(),e.slide.scrollIntoView({inline:`center`,block:`nearest`,behavior:`instant`}),this.#l(t),this.dispatchEvent(new CustomEvent(`gallery-open`,{bubbles:!0,composed:!0,detail:{index:t,total:n}}))},i=e.trigger.querySelector(`.gallery__thumb`),a=e.slide.querySelector(`img`);if(this.#a||!(`startViewTransition`in document)||!i||!a){r();return}i.style.viewTransitionName=`lightbox-active`,document.startViewTransition(()=>{i.style.viewTransitionName=``,a.style.viewTransitionName=`lightbox-active`,r()}).finished.finally(()=>{a.style.viewTransitionName=``})}#l(e){let t=this.#n?.hasAttribute(`loop`)??!1;for(let n of dn(e,this.#i.length,t)){let e=this.#i[n]?.slide.querySelector(`img`),t=e?.currentSrc||e?.src;t&&(new Image().src=t)}}#u=e=>{e.preventDefault(),this.#t?.close()};#d=e=>{this.dispatchEvent(new CustomEvent(`gallery-change`,{bubbles:!0,composed:!0,detail:e.detail}))}};customElements.get(`wc-gallery`)||customElements.define(`wc-gallery`,fn);const pn=/^([^0-9-]*)(-?[0-9,]*\.?[0-9]*)([^0-9]*)$/;function mn(e,t){let n=pn.exec(e.trim()),r=n?.[2]||`0`,i=r.split(`.`)[1];return{prefix:(n?.[1]??``).trim(),suffix:(n?.[3]??``).trim(),value:Number.parseFloat(r.replace(/,/g,``))||0,decimals:t??i?.length??0,grouping:r.includes(`,`)}}function hn(e){return new Intl.NumberFormat(void 0,{minimumFractionDigits:e.decimals,maximumFractionDigits:e.decimals,useGrouping:e.grouping})}const gn={linear:`linear`,"ease-in":`var(--custom-ease-in)`,"ease-out":`var(--custom-ease-out)`,"float-sine":`var(--ease-float-sine)`,"float-bounce":`var(--ease-float-bounce)`};function _n(e){return e?gn[e]:void 0}const $=new WeakMap;let vn;function yn(){return vn??=new IntersectionObserver((e,t)=>{for(let n of e)n.isIntersecting&&(t.unobserve(n.target),$.get(n.target)?.())})}var bn=class extends X{createRenderRoot(){return this}render(){return T}#e=!1;#t=null;#n=null;#r=null;#i=``;#a=``;#o=0;#s=0;#c=0;#l=!1;connectedCallback(){super.connectedCallback(),Z(this,()=>this.#u())}disconnectedCallback(){super.disconnectedCallback(),yn().unobserve(this),$.delete(this),this.#h(),this.#n?.remove(),this.#n=null,this.#t?.classList.remove(`sr-only`),this.#t=null,this.#e=!1}#u(){if(this.parentElement?.closest(`wc-counter`)||this.#e)return!0;let e=this.querySelector(`.counter__value`);if(!e)return!1;this.#t=e;let t=this.getAttribute(`data-decimals`),n=mn(e.textContent??``,t?Number(t):void 0);if(this.#i=n.prefix,this.#a=n.suffix,this.#o=n.value,this.#r=hn(n),this.#e=!0,matchMedia(`(prefers-reduced-motion: reduce)`).matches)return!0;let r=document.createElement(`span`);r.className=`counter__presentation`,r.setAttribute(`aria-hidden`,`true`),r.textContent=e.textContent,e.insertAdjacentElement(`afterend`,r),this.#n=r,this.setAttribute(`aria-live`,`off`);let i=this.getAttribute(`data-from`)??`0`,a=Number(this.getAttribute(`data-duration`)??`1200`);this.style.setProperty(`--counter-from`,i),this.style.setProperty(`--counter-to`,String(this.#o)),this.style.setProperty(`--counter-duration`,`${a}ms`);let o=_n(this.getAttribute(`data-easing`));return o&&this.style.setProperty(`--counter-easing`,o),$.set(this,()=>this.#d(a)),yn().observe(this),!0}#d(e){this.#n&&(this.#l=!1,this.setAttribute(`running`,``),this.#t?.classList.add(`sr-only`),this.#n.addEventListener(`animationend`,this.#m,{once:!0}),this.#c=window.setTimeout(this.#m,e+100),this.#s=requestAnimationFrame(this.#f))}#f=()=>{if(!this.#n||!this.#r)return;let e=Number.parseFloat(getComputedStyle(this.#n).getPropertyValue(`--_n`));this.#p(Number.isFinite(e)?e:this.#o),this.#s=requestAnimationFrame(this.#f)};#p(e){!this.#n||!this.#r||(this.#n.textContent=`${this.#i}${this.#r.format(e)}${this.#a}`)}#m=()=>{this.#l||(this.#l=!0,this.#p(this.#o),this.#h(),this.#t?.classList.remove(`sr-only`),this.removeAttribute(`running`))};#h(){this.#s&&cancelAnimationFrame(this.#s),this.#s=0,this.#c&&clearTimeout(this.#c),this.#c=0,this.#n?.removeEventListener(`animationend`,this.#m)}};customElements.get(`wc-counter`)||customElements.define(`wc-counter`,bn);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/core",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "The Vitops design-system framework — CSS partials, Lit web components, and browser polyfills.",
|
|
5
5
|
"homepage": "https://docs.vitops.ca",
|
|
6
6
|
"bugs": "https://github.com/getvitops/design-system/issues",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"scroll-timeline-polyfill": "^1.1.0",
|
|
47
47
|
"temporal-polyfill": "^1.0.1",
|
|
48
48
|
"vitest": "4.1.9",
|
|
49
|
-
"@getvitops/utils": "8.0
|
|
49
|
+
"@getvitops/utils": "8.1.0"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=24"
|