@getvitops/core 4.0.0 → 5.0.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 +227 -0
- package/css/index.css +3 -0
- package/css/patterns/anchor-link.css +67 -0
- package/css/patterns/card.css +35 -0
- package/css/patterns/list.css +8 -0
- package/css/patterns/nav.css +8 -0
- package/css/patterns/subgrid.css +16 -1
- package/css/utilities.css +12 -0
- package/dist/consent.js +1 -1
- package/dist/elements.js +19 -19
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,232 @@
|
|
|
1
1
|
# @getvitops/core
|
|
2
2
|
|
|
3
|
+
## 5.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- **Dangling token references are now a build failure.** `validate()` resolves every `var(--…)` a
|
|
8
|
+
config authors — in `patterns.defaults` / `radii` / `groups` / `items.*.{base,overrides,states}`,
|
|
9
|
+
`typography.roles` and `shadows` — against the tokens that config actually emits. A reference to a
|
|
10
|
+
token that does not exist used to validate, generate, minify and ship, then resolve to nothing in
|
|
11
|
+
the browser: one downstream config shipped a `.cta` whose `color` fell back to `inherit` on a brand
|
|
12
|
+
fill (unreadable text on every filled button), and two of its four dead references had been dead for
|
|
13
|
+
several releases with nothing ever reporting them.
|
|
14
|
+
|
|
15
|
+
The check is deliberately anchored to the namespaces the generator owns — `--color-*`, `--shadow-*`,
|
|
16
|
+
`--z-tier-*`, `--surface-glass`, `--overlay` — the same discipline `vitops lint` follows. A pattern
|
|
17
|
+
may legitimately reference a framework token from `@getvitops/core` or a hook of your own, and
|
|
18
|
+
enumerating "every valid token" would make those false positives. A reference carrying a fallback
|
|
19
|
+
(`var(--x, 0.25rem)`) is never flagged: that is you saying what happens when the token is absent.
|
|
20
|
+
Errors name the config path and suggest the nearest token that does exist.
|
|
21
|
+
|
|
22
|
+
Two related diagnostics ship with it:
|
|
23
|
+
- **Pre-1.0 colour-grammar references are reported as one rename table**, not as a dozen separate
|
|
24
|
+
"no such token" errors — the shape the 3.0 flat-config detector uses, applied to the 1.0 colour
|
|
25
|
+
change. It is built from your own role names, and it says to apply the renames _simultaneously_,
|
|
26
|
+
because several of them rotate (`--surface-bg` → `--color-bg-surface-muted`,
|
|
27
|
+
`--surface-bg-bold` → `--color-bg-surface`) and sequential replacement compounds them.
|
|
28
|
+
- **A surface-shaped role declared chromatic now warns.** A bare hue string is shorthand for
|
|
29
|
+
`kind: "chromatic"`, which emits no bare `--color-bg-<role>` and no `.bg-<role>` — so writing
|
|
30
|
+
`"surface": "ink"` silently removed `--color-bg-surface` and the 36 references the framework's own
|
|
31
|
+
CSS makes to it. Relatedly, `--surface-glass`, `--overlay` and `.glass` are no longer emitted when
|
|
32
|
+
`surface` is chromatic: they read `--color-bg-surface`, so emitting them pointed at nothing.
|
|
33
|
+
|
|
34
|
+
**`vitops lint --fix` is now the migration tool.** It reads `var(--…)` out of CSS and `<style>`
|
|
35
|
+
blocks (not just `class` attributes) and rewrites pre-1.0 token references in a **single pass**, so
|
|
36
|
+
the rotating renames cannot compound. Nothing else is rewritten — every other finding it reports is
|
|
37
|
+
a judgement call. Run it after a major bump.
|
|
38
|
+
|
|
39
|
+
**`--help` works on every subcommand.** `vitops lint --help` used to exit non-zero with
|
|
40
|
+
`Unknown option '--help'`; every leaf subcommand parsed its own argv strictly and none declared the
|
|
41
|
+
option. It is now answered before dispatch, so no command can forget it, and a drift guard fails the
|
|
42
|
+
build if a command has no documented options. (`validate`'s options were genuinely undocumented and
|
|
43
|
+
now are.)
|
|
44
|
+
|
|
45
|
+
**The Astro integration reads `site.tracking` and `site.legal.cookieConsent`.** These drive the
|
|
46
|
+
generated cookie notice, while `vitops({ consent, tracking })` drove the runtime — two hand-synced
|
|
47
|
+
declarations of the same fact with nothing comparing them, so a site could ship a notice naming
|
|
48
|
+
categories its banner never offered, or disclosing an `_ac` cookie no capture script ever wrote, and
|
|
49
|
+
the build was clean. The config blocks are now defaults (as `css` / `fonts` / `favicon` / `ads`
|
|
50
|
+
already were) and a genuine contradiction — `true` against `false` on the same fact — **fails the
|
|
51
|
+
build**, naming both sides. An absent option is not a contradiction; it just takes the config's
|
|
52
|
+
value.
|
|
53
|
+
|
|
54
|
+
Also fixed, each from a downstream report:
|
|
55
|
+
- **`@getvitops/astro/tracking`** re-exports `@getvitops/utils/tracking` (plus `TRACKING_ENDPOINT`),
|
|
56
|
+
so the documented conversion flow works with one install. Under strict pnpm app code cannot
|
|
57
|
+
resolve a transitive dependency, and the obvious workaround — importing the same symbols from the
|
|
58
|
+
package index — is the one that drags the integration's Node builtins toward a Worker bundle. This
|
|
59
|
+
entry and `./routes` are both clean.
|
|
60
|
+
- **`createConversionRoute`'s example was broken on every supported Astro.** It read the binding off
|
|
61
|
+
`locals.runtime.env`, removed in Astro v6, while the package peers on `>= 7` — and because the
|
|
62
|
+
throw precedes the response, Astro re-reads the request and reports a misleading "Body has already
|
|
63
|
+
been used". It also called a `toNotifyContext()` helper that does not exist. The example now uses
|
|
64
|
+
`import { env } from 'cloudflare:workers'` and a plain `NotifyContext`.
|
|
65
|
+
- **`/api/track` is exported as `TRACKING_ENDPOINT`**, and the integration warns at build when
|
|
66
|
+
tracking is on and no route answers it. It was a bare literal inside the inlined capture script:
|
|
67
|
+
name the route file anything else and every `tel:` beacon 404s, conversions vanish, and nothing
|
|
68
|
+
errors anywhere.
|
|
69
|
+
- **`describeEvent` no longer reports "from Unknown"** for forms that don't have a field literally
|
|
70
|
+
named `name`. It now falls back through `first_name`/`last_name`, `full_name`, and finally the
|
|
71
|
+
email address.
|
|
72
|
+
- **`sendEmail` takes `timeoutMs` (default 10s).** `binding.send()` had no deadline, so one hung
|
|
73
|
+
attempt hung the request that produced it — indefinitely, in the one module otherwise built on
|
|
74
|
+
always saying why. A timeout is retried, like any other transient failure.
|
|
75
|
+
- **`vitops search notify` warns when the sitemap's URLs aren't on the configured origin.** A 404
|
|
76
|
+
fails loudly; a well-formed sitemap belonging to someone else did not — a route collision served a
|
|
77
|
+
valid document listing another site's pages and the run reported a healthy submission. Surfaces at
|
|
78
|
+
`--dry`.
|
|
79
|
+
- **`require()` warns when the page has no `<wc-consent>`.** The demand can never be granted, so
|
|
80
|
+
whatever waited on it never runs — silently. Hit by rendering `<Tracking />` on pages where
|
|
81
|
+
`<CookieConsent />` wasn't.
|
|
82
|
+
- **`vitops agents` no longer writes a path it guessed.** It used to warn and then write "tokens
|
|
83
|
+
live in `design-system.json`" into a project whose tokens are in `company.json`, with the four
|
|
84
|
+
emitted `vitops generate` commands hard-coded to match — copy-paste-broken in exactly the projects
|
|
85
|
+
that most need the block to be right. It now finds the config by shape, interpolates the resolved
|
|
86
|
+
path into every emitted command, and fails rather than guessing when there is nothing to name.
|
|
87
|
+
- **`vitops search setup --dry` and `vitops ads setup --dry` run without credentials.** A dry run
|
|
88
|
+
that mutates nothing should not demand the token to mutate; with none set it plans from scratch
|
|
89
|
+
and says so. (`--check` still needs them — drift is a comparison against live state.) Both now
|
|
90
|
+
also mention that the Cloudflare token needs `Zone:Read` alongside `Zone:DNS:Edit` — the
|
|
91
|
+
zone-by-name lookup uses it, and its absence read as "the zone isn't in this account".
|
|
92
|
+
- **`vitops legal` names the files it wrote and flags new ones.** Enabling `cookieConsent` silently
|
|
93
|
+
produced a `cookie-notice` document that then needs a page, a route, a link and a `policyUrl`; the
|
|
94
|
+
command said only "3 files". The review reminder is also printed on the stdout path, where it was
|
|
95
|
+
missing entirely.
|
|
96
|
+
- **`vitops init` writes a versioned `$schema`** — `./node_modules/@getvitops/generator/schema.json`,
|
|
97
|
+
following wrangler — instead of an unpinned unpkg URL that resolved to whatever was newest, so an
|
|
98
|
+
editor validated a pinned project against a schema it wasn't built with.
|
|
99
|
+
- **`favicon.backgroundColor` and `favicon.name` are described accurately.** `backgroundColor` is
|
|
100
|
+
not manifest-only: it fills the opaque `apple-touch-icon.png` and `icon-mask.png`, which are
|
|
101
|
+
written whether or not a manifest is. `name` documents that it and `themeColor` **together** are
|
|
102
|
+
what make a site installable. The missing-background warning now also fires for a dark opaque mark,
|
|
103
|
+
not only a transparent source — `apple-touch-icon` insets the logo and fills the surround either
|
|
104
|
+
way.
|
|
105
|
+
|
|
106
|
+
- **The framework now says out loud which patterns are foundational, and reports it when you
|
|
107
|
+
reach past them.** From repeated downstream reports: sites were inventing a `.wrap` class and
|
|
108
|
+
using it everywhere instead of `.centered`, and `.subgrid` — the class for any set of cards —
|
|
109
|
+
was going essentially unused. Neither failure is visible in a build: every class involved is
|
|
110
|
+
real, nothing errors, and the page renders.
|
|
111
|
+
|
|
112
|
+
**`.subgrid` was missing from the generated class reference entirely.** So was `.cluster`, and
|
|
113
|
+
so was `.region`. `vitops docs classes` is the doc an agent is told to fetch for "which class
|
|
114
|
+
do I apply", and the framework's answer for a set of cards was not in it — which is most of why
|
|
115
|
+
it never got used. All three are now documented, along with `grid-auto`, and the reference opens
|
|
116
|
+
with a **Foundations** section that states the six substitutions as
|
|
117
|
+
_temptation → what to write instead_ rather than as a vocabulary list. The same table is now in
|
|
118
|
+
the shipped agent skill and in the `@getvitops/create` template's `AGENTS.md`, because a pointer
|
|
119
|
+
to a doc only helps someone who already suspects there is something to look up. (`css`/`bricks`
|
|
120
|
+
and `tailwind` alike — this is documentation and the `TIERS` manifest, not emitted CSS.)
|
|
121
|
+
|
|
122
|
+
**`vitops lint` gained three reuse rules and a markup pass.** The existing `.centered` rule only
|
|
123
|
+
fired when the hand-written CSS already referenced `--width-measure`, which is precisely the
|
|
124
|
+
author who was never going to hand-roll a container. It now also catches a page-scale
|
|
125
|
+
`max-width` (≥ 48rem, or a `ch` reading measure) with auto margins, and a
|
|
126
|
+
container-shaped class name — `wrap`, `wrapper`, `container`, `inner`, `shell`, … — carrying any
|
|
127
|
+
width cap at all. Reading the cap out of `min()` / `clamp()` too. New rules report a
|
|
128
|
+
hand-written `repeat()` grid as `.subgrid` (or `.grid-auto`), and a new **markup** pass reports a
|
|
129
|
+
repeated card set laid out without either — a loop that renders a card, or three or more cards
|
|
130
|
+
written out. That last one is the only check that can see this drift at all, since a card list
|
|
131
|
+
built from utility classes contains no bad class and no hand-written CSS.
|
|
132
|
+
|
|
133
|
+
All of these are `suggestion` severity, so they do not fail your build unless you pass
|
|
134
|
+
`--strict`. They found five real instances in this repo's own docs site.
|
|
135
|
+
|
|
136
|
+
**`vitops lint [files...]`** now takes explicit paths instead of scanning `--src`, so it can be
|
|
137
|
+
wired into a pre-commit hook — `vp`'s `staged` key appends the staged files to whatever it runs,
|
|
138
|
+
and a command that refused positionals could not be put in the one place the feedback lands at
|
|
139
|
+
the moment the code is written. Unreadable and non-source paths are skipped rather than fatal. The
|
|
140
|
+
`@getvitops/create` emdash template wires it up with `--strict` and adds a `lint:design` script.
|
|
141
|
+
|
|
142
|
+
**Two answers for "the whole card is a link", because one cannot exist.** Reported downstream:
|
|
143
|
+
agents dislike the `<li>` wrapper when a card is a link and write `<li><a class="card">` instead.
|
|
144
|
+
That shape is **wrong in a way that renders fine**, which is why it survives review — the `<li>`
|
|
145
|
+
is the grid item, so the anchor is an ordinary block inside it and the tranches within the anchor
|
|
146
|
+
never reach the parent's shared row lines. The alignment `.subgrid` exists for silently does not
|
|
147
|
+
happen, and the anchor does not fill the cell either. Putting the anchor in the grid's place
|
|
148
|
+
(`<ul><a></ul>`) is invalid HTML, so there was genuinely no correct shape to reach for.
|
|
149
|
+
|
|
150
|
+
There are now two, and they trade against each other because **no CSS-only technique can make a
|
|
151
|
+
whole card clickable and leave its text selectable** — a transparent overlay necessarily receives
|
|
152
|
+
the pointer-drag:
|
|
153
|
+
|
|
154
|
+
| Want | Use |
|
|
155
|
+
| ---------------------------------------- | ------------------------------------------- |
|
|
156
|
+
| zero JS, whole card clickable | `.stretched-link` — **text not selectable** |
|
|
157
|
+
| selectable text **and** a clickable card | `<Cards>` / `<wc-cards>` — needs JS |
|
|
158
|
+
|
|
159
|
+
`.stretched-link` goes on a link inside the card; its `::after` covers the card.
|
|
160
|
+
**`<wc-cards>` is a new tier-2 element** that adds no overlay and instead tells a click apart from
|
|
161
|
+
the end of a drag, so text selection survives. Its fallback is the card's own link, fully usable
|
|
162
|
+
with no JS, and the pointer cursor is applied by the element — so the affordance never appears
|
|
163
|
+
without the behaviour. `<Cards>` emits it for you. They are alternatives, never layered: with an
|
|
164
|
+
overlay present the JS has nothing to do, and `vitops lint` reports the combination. (All formats
|
|
165
|
+
— pattern partials, deliberately not `utilities.css`, which the tailwind format skips on the
|
|
166
|
+
invariant that everything left in it is a name Tailwind ships itself.)
|
|
167
|
+
|
|
168
|
+
### Breaking
|
|
169
|
+
- **`<Subgrid />` renders its slot verbatim — author the `<li>` items yourself.**
|
|
170
|
+
|
|
171
|
+
```diff
|
|
172
|
+
<Subgrid>
|
|
173
|
+
- <article class="card">…</article>
|
|
174
|
+
+ <li class="card subgrid-card">…</li>
|
|
175
|
+
</Subgrid>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
It used to parse the slotted HTML and rebuild each child as an `<li>`, carrying over only
|
|
179
|
+
`class` and `style`. That existed solely because a `<ul>` may contain nothing else, and it cost
|
|
180
|
+
more than it bought: the child's tag was discarded, `id`/`data-*`/`aria-*` were silently
|
|
181
|
+
dropped, and `href` could not survive at all. Nothing is copied now, so nothing is lost. `as`
|
|
182
|
+
picks the container (`ul` by default, `ol`, `div`), and all other props are forwarded — they
|
|
183
|
+
were previously discarded, including `role`.
|
|
184
|
+
|
|
185
|
+
- **`<Subgrid />` and `<Tree />` now emit `role="list"`,** as does the Bricks `sitenav` element.
|
|
186
|
+
`list-style: none` stops Safari + VoiceOver announcing a `<ul>` as a list, so every marker-less
|
|
187
|
+
framework list was silently losing the semantics its `<ul>` was chosen for. If you hand-write
|
|
188
|
+
`.subgrid`, `.list`, `.facet-list`, `.nav-items`, `.collapse-menu` or `.tree` markup, add
|
|
189
|
+
`role="list"` yourself — the framework cannot add it to markup it does not render, and each
|
|
190
|
+
partial now says so at the `list-style` reset.
|
|
191
|
+
- **`<Cards />` no longer adds `class="card"` to slotted children,** because it no longer parses
|
|
192
|
+
them. Write the class on the item. It now emits `<wc-cards>` around a `<Subgrid>`, which is what
|
|
193
|
+
makes the whole card clickable — and like `<Tree />`, **it emits its own element, so do not wrap
|
|
194
|
+
it in `<wc-cards>` yourself.** It also previously passed a `role="list"` that `<Subgrid>` silently
|
|
195
|
+
discarded, so that never took effect.
|
|
196
|
+
- **`.subgrid-card` now sets `position: relative`**, so `stretched-link` inside it needs no extra
|
|
197
|
+
class. If you were absolutely positioning a descendant of a `.subgrid-card` against an ancestor
|
|
198
|
+
_outside_ that card, it will now resolve against the card. Move the positioning context
|
|
199
|
+
explicitly. (`css`/`bricks`/`tailwind` — the pattern partial is inlined into all three.) Not
|
|
200
|
+
reachable by `vitops lint --fix`: the fix depends on which ancestor you meant, which the
|
|
201
|
+
linter cannot know.
|
|
202
|
+
|
|
203
|
+
### Fixed
|
|
204
|
+
- **`packages/generator/src/docs.ts` contained a literal NUL byte** (`CODE_SLOT`, written as the
|
|
205
|
+
raw character rather than an escape). libmagic classified the file as `data` rather than text, so
|
|
206
|
+
grep and ripgrep treated the largest doc emitter in the repo as **binary and silently skipped
|
|
207
|
+
it** — every search for a string in it returned nothing, with no error. It is now written as the `\u0000` escape.
|
|
208
|
+
Behaviour is identical; the file is searchable.
|
|
209
|
+
- **`.grid-auto` is documented.** It was a real framework class for auto-fit card grids with no
|
|
210
|
+
entry in the class reference, so the honest alternative to `subgrid` was as invisible as
|
|
211
|
+
`subgrid` itself.
|
|
212
|
+
- **`.raised` replaces the advice to use `.relative` above a `stretched-link` overlay**, which
|
|
213
|
+
could not work: a positioned element at `z-index: auto` does not rise above an explicit
|
|
214
|
+
`z-index` regardless of DOM order, so a second link or button in the card stayed underneath and
|
|
215
|
+
unclickable. `.raised` sets both, against the same `--z-tier-raised` token the overlay now uses
|
|
216
|
+
instead of a hard-coded `1`.
|
|
217
|
+
|
|
218
|
+
### Patch Changes
|
|
219
|
+
|
|
220
|
+
- Updated dependencies
|
|
221
|
+
- @getvitops/utils@5.0.0
|
|
222
|
+
|
|
223
|
+
## 4.1.0
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- Updated dependencies [2c890c0]
|
|
228
|
+
- @getvitops/utils@4.1.0
|
|
229
|
+
|
|
3
230
|
## 4.0.0
|
|
4
231
|
|
|
5
232
|
### Major Changes
|
package/css/index.css
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
@import './patterns/cluster.css';
|
|
17
17
|
@import './patterns/grouped.css';
|
|
18
18
|
@import './patterns/subgrid.css';
|
|
19
|
+
/* After subgrid: `.subgrid-card` is the usual card and this sets the `<wc-cards>`
|
|
20
|
+
host plus the upgraded-card affordance. */
|
|
21
|
+
@import './patterns/card.css';
|
|
19
22
|
@import './patterns/masonry.css';
|
|
20
23
|
@import './patterns/media.css';
|
|
21
24
|
@import './patterns/separator.css';
|
|
@@ -100,3 +100,70 @@ a[target='_blank'].link--external::after {
|
|
|
100
100
|
color: var(--color-text-surface);
|
|
101
101
|
border-radius: var(--br-control, 0.375rem);
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
/* ── stretched-link — the whole card is a link ──
|
|
105
|
+
One link inside a container covers it, so the entire card is clickable while the
|
|
106
|
+
accessible name stays on real text. `.subgrid-card` already carries the
|
|
107
|
+
`position: relative` this resolves against; on a bare `.card`, add `relative`.
|
|
108
|
+
|
|
109
|
+
<li class="card subgrid-card">
|
|
110
|
+
<p class="font-eyebrow">Service</p>
|
|
111
|
+
<p class="font-heading"><a class="link stretched-link" href="/x">Title</a></p>
|
|
112
|
+
<p>Blurb…</p>
|
|
113
|
+
</li>
|
|
114
|
+
|
|
115
|
+
WHY THIS RATHER THAN MAKING THE ANCHOR THE CARD. `<li><a class="card">` is the
|
|
116
|
+
shape that gets reached for, and it is wrong in a way that renders fine: the LI is
|
|
117
|
+
the grid item, so the anchor is an ordinary block inside it — its tranches never
|
|
118
|
+
land on the parent's shared row lines, and the alignment `.subgrid` exists for
|
|
119
|
+
silently does not happen. (Nor does an inline anchor fill the cell.) Putting the
|
|
120
|
+
anchor in the grid's place instead means `<ul><a></ul>`, which is invalid.
|
|
121
|
+
|
|
122
|
+
THE COST, AND THE ALTERNATIVE. The overlay receives the pointer-drag over
|
|
123
|
+
everything it covers, so **the card's text can no longer be selected**. That is
|
|
124
|
+
inherent to the technique, not a bug to fix here — any transparent layer over text
|
|
125
|
+
takes the drag. Where selectable text matters, use `<wc-cards>`
|
|
126
|
+
(src/web-components/WCCards.ts) instead: no overlay, and JS tells a click apart
|
|
127
|
+
from the end of a drag. The two are alternatives, never layered — with this
|
|
128
|
+
overlay present, that element has nothing left to do.
|
|
129
|
+
|
|
130
|
+
It lives HERE, in a pattern partial, and not in `utilities.css`: that file is in
|
|
131
|
+
the generator's TAILWIND_SKIP on the stated invariant that everything left in it
|
|
132
|
+
is a TW_CLASH name Tailwind ships itself. `stretched-link` is ours, so putting it
|
|
133
|
+
there would emit it in css/bricks and silently not in tailwind — the exact
|
|
134
|
+
cross-format hole `format-parity.test.ts` exists to catch.
|
|
135
|
+
|
|
136
|
+
Another interactive element inside the same card must sit above the overlay: give
|
|
137
|
+
it `.raised`, NOT `.relative`. A positioned element at `z-index: auto` does not
|
|
138
|
+
rise above an explicit z-index no matter its DOM order, so `.relative` alone left
|
|
139
|
+
the control underneath and unclickable. ── */
|
|
140
|
+
.stretched-link::after {
|
|
141
|
+
content: '';
|
|
142
|
+
position: absolute;
|
|
143
|
+
/* Covers the nearest positioned ancestor, which is the card. */
|
|
144
|
+
inset: 0;
|
|
145
|
+
/* The shared z-scale rather than a bare 1, so `.raised` can be defined in terms of
|
|
146
|
+
the same token instead of guessing a number that beats it. */
|
|
147
|
+
z-index: var(--z-tier-raised);
|
|
148
|
+
border-radius: inherit;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* ── raised — lift content above a `.stretched-link` overlay ──
|
|
152
|
+
For the second link, the button, or the text you want selectable inside a card
|
|
153
|
+
whose whole area is otherwise clickable.
|
|
154
|
+
|
|
155
|
+
It carries `position: relative` AND a z-index, and both are required: z-index has
|
|
156
|
+
no effect on a static element, and a positioned element at `z-index: auto` does not
|
|
157
|
+
rise above an explicit z-index regardless of DOM order. That second half is why
|
|
158
|
+
telling people to use `.relative` here did not work.
|
|
159
|
+
|
|
160
|
+
Defined against the same token as the overlay, so the two cannot drift apart the
|
|
161
|
+
way two hand-picked numbers would.
|
|
162
|
+
|
|
163
|
+
Here rather than in `utilities.css` for the reason given above `.stretched-link`:
|
|
164
|
+
that file is in TAILWIND_SKIP on the invariant that everything left in it is a name
|
|
165
|
+
Tailwind ships itself, and Tailwind has no `raised`. ── */
|
|
166
|
+
.raised {
|
|
167
|
+
position: relative;
|
|
168
|
+
z-index: calc(var(--z-tier-raised) + 1);
|
|
169
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Card — the `<wc-cards>` host and the marker its enhancement applies.
|
|
3
|
+
*
|
|
4
|
+
* The `.card` pattern itself is CONFIG-GENERATED (`patterns.items.card` in
|
|
5
|
+
* design-system.json), so its border, padding, background and shadow are not here.
|
|
6
|
+
* This partial holds only what the framework owns: the custom element's box, and the
|
|
7
|
+
* affordance for a card the element has taken over.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/* ── wc-cards — the whole-card click enhancement (src/web-components/WCCards.ts) ──
|
|
11
|
+
A custom element defaults to `display: inline`, and this one wraps a block
|
|
12
|
+
container — a `<ul class="subgrid">` in the documented shape — so an inline box
|
|
13
|
+
around a block child is exactly the KNOWN GAP recorded in `js/elements.ts`.
|
|
14
|
+
|
|
15
|
+
`block`, matched to the content it wraps, following the one precedent:
|
|
16
|
+
`patterns/tree.css` declares `wc-tree { display: block }` around a
|
|
17
|
+
`<ul class="tree">`. Deliberately NOT `display: contents`, whose support has been
|
|
18
|
+
uneven — the accessibility tree in particular — and this is not a place to depend
|
|
19
|
+
on it.
|
|
20
|
+
|
|
21
|
+
The cost of a real box: where the grid is nested in a parent flex/grid, `wc-cards`
|
|
22
|
+
rather than the `<ul>` becomes the item. Restyle the element in that case; it
|
|
23
|
+
carries no other styling to lose. ── */
|
|
24
|
+
wc-cards {
|
|
25
|
+
display: block;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* ── The card the element has taken over ──
|
|
29
|
+
Written by `WCCards` at upgrade, and only onto cards it found a link in — so the
|
|
30
|
+
pointer cursor cannot appear on a card with nothing to click, and cannot appear at
|
|
31
|
+
all when `elements.js` never loads. That is the point of stamping it from JS
|
|
32
|
+
rather than authoring it: the affordance and the behaviour arrive together. ── */
|
|
33
|
+
[data-card-link] {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
package/css/patterns/list.css
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
--_ds: var(--ds-list, var(--ds-list-group, var(--ds-default)));
|
|
12
12
|
--_fs: var(--fs-list, var(--fs-list-group, var(--fs-default)));
|
|
13
13
|
|
|
14
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
15
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
16
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
17
|
+
so only the author can restore it. */
|
|
14
18
|
list-style: none;
|
|
15
19
|
margin: 0;
|
|
16
20
|
padding: var(--_p);
|
|
@@ -75,6 +79,10 @@
|
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
.facet-list {
|
|
82
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
83
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
84
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
85
|
+
so only the author can restore it. */
|
|
78
86
|
list-style: none;
|
|
79
87
|
margin: 0;
|
|
80
88
|
padding: 0;
|
package/css/patterns/nav.css
CHANGED
|
@@ -30,6 +30,10 @@ nav:has(> .nav-items) {
|
|
|
30
30
|
display: flex;
|
|
31
31
|
flex-direction: column;
|
|
32
32
|
gap: 1.5rem;
|
|
33
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
34
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
35
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
36
|
+
so only the author can restore it. */
|
|
33
37
|
list-style: none;
|
|
34
38
|
padding: 0;
|
|
35
39
|
margin: 0;
|
|
@@ -99,6 +103,10 @@ nav:has(> .nav-items) {
|
|
|
99
103
|
}
|
|
100
104
|
|
|
101
105
|
.collapse-menu {
|
|
106
|
+
/* Markerless — so ADD `role="list"` to the element. Safari + VoiceOver stop
|
|
107
|
+
announcing a marker-less <ul> as a list, so this reset silently costs the
|
|
108
|
+
semantics the <ul> was chosen for. Nothing in the framework emits this markup,
|
|
109
|
+
so only the author can restore it. */
|
|
102
110
|
list-style: none;
|
|
103
111
|
padding-inline-start: 1.5rem;
|
|
104
112
|
margin-block-start: 0.5rem;
|
package/css/patterns/subgrid.css
CHANGED
|
@@ -63,7 +63,12 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
/* Markerless when it's a list — a subgrid of cards is a list of things, and
|
|
66
|
-
the markers would sit in the gutter.
|
|
66
|
+
the markers would sit in the gutter.
|
|
67
|
+
|
|
68
|
+
ADD `role="list"` to the element. Safari + VoiceOver stop announcing a
|
|
69
|
+
marker-less <ul> as a list, so this reset silently costs the semantics the <ul>
|
|
70
|
+
was chosen for — "3 items" becomes nothing at all. `<Subgrid>` does it for you;
|
|
71
|
+
hand-written markup must say it. */
|
|
67
72
|
&:is(ul, ol) {
|
|
68
73
|
list-style: none;
|
|
69
74
|
margin: 0;
|
|
@@ -111,6 +116,16 @@
|
|
|
111
116
|
display: grid;
|
|
112
117
|
grid-template-rows: subgrid;
|
|
113
118
|
grid-row: span var(--_card-rows);
|
|
119
|
+
/* The containing block for a `.stretched-link` inside it (utilities.css), so a
|
|
120
|
+
whole-card link needs no extra class here. Costs nothing otherwise.
|
|
121
|
+
|
|
122
|
+
This is the framework's answer to "the card IS a link", and the shape it
|
|
123
|
+
replaces is wrong in a way that looks fine: `<li><a class="card">` makes the
|
|
124
|
+
LI the grid item, so the anchor is an ordinary block and the tranches inside
|
|
125
|
+
it never land on the shared row lines — the alignment subgrid exists for
|
|
126
|
+
silently does not happen, and the anchor doesn't fill the cell either. Keep
|
|
127
|
+
the card as the grid item and stretch a link inside it. */
|
|
128
|
+
position: relative;
|
|
114
129
|
padding: var(--_card-padding);
|
|
115
130
|
border: var(--b-card, var(--b-card-group, var(--b-default)));
|
|
116
131
|
border-radius: var(--br-card, var(--br-card-group, var(--br-default)));
|
package/css/utilities.css
CHANGED
|
@@ -272,3 +272,15 @@
|
|
|
272
272
|
.text-pretty {
|
|
273
273
|
text-wrap: pretty;
|
|
274
274
|
}
|
|
275
|
+
|
|
276
|
+
/* ── position — a containing block for anything absolutely positioned inside, e.g.
|
|
277
|
+
a `.stretched-link` overlay on a bare `.card` (`.subgrid-card` already has one).
|
|
278
|
+
`relative` is in TW_CLASH: Tailwind ships it natively, so the tailwind format
|
|
279
|
+
drops this copy.
|
|
280
|
+
|
|
281
|
+
To lift content ABOVE a stretched-link overlay this is not enough — see `.raised`
|
|
282
|
+
in patterns/anchor-link.css, which has to live there because Tailwind has no
|
|
283
|
+
equivalent name and this file is in TAILWIND_SKIP. ── */
|
|
284
|
+
.relative {
|
|
285
|
+
position: relative;
|
|
286
|
+
}
|
package/dist/consent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[`necessary`,`analytics`,`marketing`,`preferences`],t=`vitops:consent`,n=`vitops:consent-open`,r=`vitops_consent`,i=[`analytics`,`marketing`,`preferences`];function a(e){return{analytics:e,marketing:e,preferences:e}}function o(){return{ts:null,choices:a(null)}}function s(e,t){for(let n of e.split(`;`)){let e=n.trim();if(e.slice(0,t.length+1)===`${t}=`)return e.slice(t.length+1)}return null}function c(e){if(!e)return o();let t;try{t=JSON.parse(decodeURIComponent(e))}catch{return o()}if(typeof t!=`object`||!t)return o();let n=t;if(n.v!==2||typeof n.c!=`object`||n.c===null)return o();let r=n.c,s=a(null);for(let e of i){let t=r[e];typeof t==`boolean`&&(s[e]=t)}return{ts:typeof n.ts==`number`?n.ts:null,choices:s}}function l(e){let t={};for(let n of i){let r=e.choices[n];typeof r==`boolean`&&(t[n]=r)}return encodeURIComponent(JSON.stringify({v:2,ts:e.ts??0,c:t}))}function u(e,t){return t===`necessary`?!0:e.choices[t]===!0}function d(e,t){return t===`necessary`?!0:e.choices[t]!==null}function f(e,t){for(let n of t)if(!d(e,n))return!0;return!1}function p(e,t){return{ts:t,choices:a(e)}}function m(e,t,n){let r={...e.choices};for(let e of i){let n=t[e];typeof n==`boolean`&&(r[e]=n)}return{ts:n,choices:r}}function h(e,t){return i.filter(n=>u(e,n)&&!u(t,n))}function g(e){return`; path=/; max-age=15552000; SameSite=Lax${e?`; Secure`:``}`}const _=location.protocol===`https:`;let v=c(s(document.cookie,r));const y=new Set,b=new WeakSet,x=new Set,S=new Set,C=new Map;function w(e){S.has(e)||(S.add(e),
|
|
1
|
+
const e=[`necessary`,`analytics`,`marketing`,`preferences`],t=`vitops:consent`,n=`vitops:consent-open`,r=`vitops_consent`,i=[`analytics`,`marketing`,`preferences`];function a(e){return{analytics:e,marketing:e,preferences:e}}function o(){return{ts:null,choices:a(null)}}function s(e,t){for(let n of e.split(`;`)){let e=n.trim();if(e.slice(0,t.length+1)===`${t}=`)return e.slice(t.length+1)}return null}function c(e){if(!e)return o();let t;try{t=JSON.parse(decodeURIComponent(e))}catch{return o()}if(typeof t!=`object`||!t)return o();let n=t;if(n.v!==2||typeof n.c!=`object`||n.c===null)return o();let r=n.c,s=a(null);for(let e of i){let t=r[e];typeof t==`boolean`&&(s[e]=t)}return{ts:typeof n.ts==`number`?n.ts:null,choices:s}}function l(e){let t={};for(let n of i){let r=e.choices[n];typeof r==`boolean`&&(t[n]=r)}return encodeURIComponent(JSON.stringify({v:2,ts:e.ts??0,c:t}))}function u(e,t){return t===`necessary`?!0:e.choices[t]===!0}function d(e,t){return t===`necessary`?!0:e.choices[t]!==null}function f(e,t){for(let n of t)if(!d(e,n))return!0;return!1}function p(e,t){return{ts:t,choices:a(e)}}function m(e,t,n){let r={...e.choices};for(let e of i){let n=t[e];typeof n==`boolean`&&(r[e]=n)}return{ts:n,choices:r}}function h(e,t){return i.filter(n=>u(e,n)&&!u(t,n))}function g(e){return`; path=/; max-age=15552000; SameSite=Lax${e?`; Secure`:``}`}const _=location.protocol===`https:`;let v=c(s(document.cookie,r));const y=new Set,b=new WeakSet,x=new Set,S=new Set,C=new Map,w=new Set;function T(e){w.has(e)||(w.add(e),queueMicrotask(()=>{document.querySelector(`wc-consent`)||console.warn(`[vitops] something requested the "${e}" consent category, but this page has no <wc-consent> element to ask with — so the request can never be granted and whatever waited on it will not run. Render <CookieConsent /> on every page that gates anything.`)}))}function E(e){S.has(e)||(S.add(e),T(e),B())}function D(){for(let[e,t]of C)if(d(v,e)){C.delete(e);for(let n of t)n(u(v,e))}}const O={idle:[],async:[],interaction:[]},k={idle:!1,async:!0,interaction:!1};function A(e){if(k[e])return;k[e]=!0;let t=O[e];O[e]=[];for(let e of t)e()}function j(e,t){k[e]?t():O[e].push(t)}function M(e){document.readyState===`complete`?e():addEventListener(`load`,e,{once:!0})}M(()=>{let e=globalThis.requestIdleCallback;e?e(()=>A(`idle`),{timeout:3e3}):setTimeout(()=>A(`idle`),1)});{let e=[`pointerdown`,`keydown`,`scroll`,`touchstart`],t=()=>{for(let n of e)removeEventListener(n,t);A(`interaction`)};for(let n of e)addEventListener(n,t,{once:!0,passive:!0});M(()=>setTimeout(()=>A(`interaction`),8e3))}const N=new Set([`type`,`src`,`data-vitops-tag`,`data-src`,`data-strategy`,`data-consent`,`data-consent-src`,`data-consent-cookies`]);function P(t){let n=t.getAttribute(`data-consent`);return e.includes(n??``)?n:`analytics`}function F(e){let t=e.textContent??``,n=e.getAttribute(`data-src`),r=t=>{let n=document.createElement(`script`);for(let{name:t,value:r}of Array.from(e.attributes))N.has(t)||n.setAttribute(t,r);t(n),e.parentNode?.insertBefore(n,e.nextSibling)};t.trim()&&r(e=>e.text=t),n&&r(e=>{e.async=!0,e.src=n})}function I(e){if(!b.has(e)){if(b.add(e),x.add(P(e)),e instanceof HTMLScriptElement)F(e);else{let t=e.getAttribute(`data-consent-src`);t&&e.setAttribute(`src`,t)}e.setAttribute(`data-vitops-activated`,``)}}function L(){let e=document.querySelectorAll(`script[data-vitops-tag]:not([data-vitops-activated]),[data-consent-src]:not([data-vitops-activated])`);for(let t of e){let e=t.getAttribute(`data-strategy`);j(e===`async`||e===`interaction`?e:`idle`,()=>{let e=P(t);u(v,e)?I(t):E(e)})}}function R(e){let t=new Set;for(let n of e)for(let e of document.querySelectorAll(`[data-consent="${n}"]`))for(let n of(e.getAttribute(`data-consent-cookies`)??``).split(`,`))n.trim()&&t.add(n.trim());if(!t.size)return;let n=document.cookie.split(`;`).map(e=>e.trim().split(`=`)[0]??``),r=location.hostname.split(`.`).slice(-2).join(`.`),i=[``,`; domain=${location.hostname}`,`; domain=.${r}`];for(let e of n)if([...t].some(t=>t.endsWith(`*`)?e.startsWith(t.slice(0,-1)):e===t))for(let t of i)document.cookie=`${e}=; path=/; max-age=0${t}`}function z(e,t){let n=h(v,e),i=v;v=e,t?document.cookie=`${r}=${l(e)}${g(_)}`:document.cookie=`${r}=; path=/; max-age=0`,B(),L(),n.length&&(R(n),n.some(e=>x.has(e)&&u(i,e))&&V.reloadOnRevoke&&location.reload())}function B(){D();for(let e of y)e(v);document.dispatchEvent(new CustomEvent(t,{detail:v}))}const V={categories:e,reloadOnRevoke:!0,get:()=>v,granted:e=>u(v,e),needed:()=>f(v,S),demanded:()=>e.filter(e=>S.has(e)),require(e){return E(e),u(v,e)},request(e){return E(e),d(v,e)?Promise.resolve(u(v,e)):new Promise(t=>{let n=C.get(e);n?n.push(t):C.set(e,[t])})},set:e=>z(m(v,e,Date.now()),!0),acceptAll:()=>z(p(!0,Date.now()),!0),rejectAll:()=>z(p(!1,Date.now()),!0),reset:()=>z(o(),!1),open:()=>document.dispatchEvent(new CustomEvent(n)),subscribe(e){return y.add(e),e(v),()=>void y.delete(e)}},H=window.vitopsConsent?.q;if(window.vitopsConsent=V,H)for(let[e,t]of H)t?V.request(e).then(t):V.require(e);document.addEventListener(`click`,e=>{e.target?.closest?.(`[data-consent-open]`)&&(e.preventDefault(),V.open())}),document.addEventListener(`astro:page-load`,L),L(),B();var U=class extends HTMLElement{#e;#t=`prompt`;#n=!1;get#r(){return window.vitopsConsent}get#i(){return this.querySelector(`[popover]`)}connectedCallback(){let e=this.#r;if(!e)return;let t=this.#i;t&&typeof t.showPopover!=`function`&&t.removeAttribute(`popover`),this.getAttribute(`reload-on-revoke`)===`false`&&(e.reloadOnRevoke=!1),this.addEventListener(`click`,this.#p),this.addEventListener(`submit`,this.#o),document.addEventListener(n,this.#a),this.#e=e.subscribe(()=>{this.#n&&this.#t===`settings`?this.#f():e.needed()?this.#u(`prompt`):this.#d()})}disconnectedCallback(){this.removeEventListener(`click`,this.#p),this.removeEventListener(`submit`,this.#o),document.removeEventListener(n,this.#a),this.#e?.()}#a=()=>this.#u(`settings`);#o=e=>e.preventDefault();#s(e){return this.querySelector(`[data-consent-row="${e}"]`)??this.#c(e)?.closest(`label`)??null}#c(e){return this.querySelector(`input[name="${e}"]`)}#l(e){let t=this.#r;if(!t)return[];if(e===`settings`){let e=i.filter(e=>this.#s(e));return e.length?e:[...i]}let n=t.get();return i.filter(e=>t.demanded().includes(e)&&!d(n,e))}#u(e){if(!this.#l(e).length)return;this.#t=e,this.#f(),this.hidden=!1,this.#n=!0;let t=this.#i;t?.isConnected&&!t.matches(`:popover-open`)&&t.showPopover()}#d(){this.#n=!1,this.#i?.hidePopover?.(),this.hidden=!0}#f(){let e=this.#r;if(!e)return;let t=this.#l(this.#t);for(let n of i){let r=this.#s(n);r&&(r.hidden=!t.includes(n));let i=this.#c(n);i&&(i.checked=e.granted(n))}this.#i?.classList.toggle(`consent--single`,t.length<2)}#p=e=>{let t=this.#r,n=e.target?.closest?.(`[data-consent-accept],[data-consent-reject],[data-consent-save]`);if(!t||!n)return;e.preventDefault();let r=this.#l(this.#t);n.hasAttribute(`data-consent-accept`)?t.set(this.#m(r,()=>!0)):n.hasAttribute(`data-consent-reject`)?t.set(this.#m(r,()=>!1)):t.set(this.#m(r,e=>this.#c(e)?.checked===!0)),this.#d()};#m(e,t){let n={};for(let r of e)n[r]=t(r);return n}};customElements.get(`wc-consent`)||customElements.define(`wc-consent`,U);export{e as CATEGORIES,t as CONSENT_EVENT,n as CONSENT_OPEN_EVENT,r as COOKIE_NAME,V as consent};
|
package/dist/elements.js
CHANGED
|
@@ -15,14 +15,14 @@ switch(t){case Boolean:e=e?ie:null;break;case Object:case Array:e=e==null?e:JSON
|
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const g=globalThis,ce=e=>e,_=g.trustedTypes,le=_?_.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ue=`$lit$`,v=`lit$${Math.random().toFixed(9).slice(2)}$`,y=`?`+v,de=`<${y}>`,b=document,x=()=>b.createComment(``),S=e=>e===null||typeof e!=`object`&&typeof e!=`function`,
|
|
19
|
-
\f\r]`,
|
|
18
|
+
const g=globalThis,ce=e=>e,_=g.trustedTypes,le=_?_.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ue=`$lit$`,v=`lit$${Math.random().toFixed(9).slice(2)}$`,y=`?`+v,de=`<${y}>`,b=document,x=()=>b.createComment(``),S=e=>e===null||typeof e!=`object`&&typeof e!=`function`,C=Array.isArray,fe=e=>C(e)||typeof e?.[Symbol.iterator]==`function`,w=`[
|
|
19
|
+
\f\r]`,T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,pe=/-->/g,me=/>/g,E=RegExp(`>|${w}(?:([^\\s"'>=/]+)(${w}*=${w}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),he=/'/g,ge=/"/g,_e=/^(?:script|style|textarea|title)$/i,ve=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),D=Symbol.for(`lit-noChange`),O=Symbol.for(`lit-nothing`),ye=new WeakMap,k=b.createTreeWalker(b,129);function be(e,t){if(!C(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return le===void 0?t:le.createHTML(t)}const xe=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=T;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===T?c[1]===`!--`?o=pe:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=E):(_e.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=E):o=me:o===E?c[0]===`>`?(o=i??T,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?E:c[3]===`"`?ge:he):o===ge||o===he?o=E:o===pe||o===me?o=T:(o=E,i=void 0);let d=o===E&&e[t+1].startsWith(`/>`)?` `:``;a+=o===T?n+de:l>=0?(r.push(s),n.slice(0,l)+ue+n.slice(l)+v+d):n+v+(l===-2?t:d)}return[be(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]};var Se=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=xe(t,n);if(this.el=e.createElement(l,r),k.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=k.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ue)){let t=u[o++],n=i.getAttribute(e).split(v),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?we:r[1]===`?`?Te:r[1]===`@`?Ee:M}),i.removeAttribute(e)}else e.startsWith(v)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(_e.test(i.tagName)){let e=i.textContent.split(v),t=e.length-1;if(t>0){i.textContent=_?_.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],x()),k.nextNode(),c.push({type:2,index:++a});i.append(e[t],x())}}}else if(i.nodeType===8)if(i.data===y)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(v,e+1))!==-1;)c.push({type:7,index:a}),e+=v.length-1}a++}}static createElement(e,t){let n=b.createElement(`template`);return n.innerHTML=e,n}};function A(e,t,n=e,r){if(t===D)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=S(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=A(e,i._$AS(e,t.values),i,r)),t}var Ce=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??b).importNode(t,!0);k.currentNode=r;let i=k.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new j(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new De(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=k.nextNode(),a++)}return k.currentNode=b,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},j=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=O,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=A(this,e,t),S(e)?e===O||e==null||e===``?(this._$AH!==O&&this._$AR(),this._$AH=O):e!==this._$AH&&e!==D&&this._(e):e._$litType$===void 0?e.nodeType===void 0?fe(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==O&&S(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Se.createElement(be(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Ce(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=ye.get(e.strings);return t===void 0&&ye.set(e.strings,t=new Se(e)),t}k(t){C(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(x()),this.O(x()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=ce(e).nextSibling;ce(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},M=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=O,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=O}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=A(this,e,t,0),a=!S(e)||e!==this._$AH&&e!==D,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=A(this,r[n+o],t,o),s===D&&(s=this._$AH[o]),a||=!S(s)||s!==this._$AH[o],s===O?e=O:e!==O&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===O?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},we=class extends M{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===O?void 0:e}},Te=class extends M{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==O)}},Ee=class extends M{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=A(this,e,t,0)??O)===D)return;let n=this._$AH,r=e===O&&n!==O||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==O&&(n===O||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},De=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){A(this,e)}};const Oe={M:ue,P:v,A:y,C:1,L:xe,R:Ce,D:fe,V:A,I:j,H:M,N:Te,U:Ee,B:we,F:De},ke=g.litHtmlPolyfillSupport;ke?.(Se,j),(g.litHtmlVersions??=[]).push(`3.3.3`);const Ae=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new j(t.insertBefore(x(),e),e,void 0,n??{})}return i._$AI(e),i},N=globalThis
|
|
20
20
|
/**
|
|
21
21
|
* @license
|
|
22
22
|
* Copyright 2017 Google LLC
|
|
23
23
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
24
|
*/
|
|
25
|
-
;var
|
|
25
|
+
;var P=class extends h{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Ae(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return D}};P._$litElement$=!0,P.finalized=!0,N.litElementHydrateSupport?.({LitElement:P});const je=N.litElementPolyfillSupport;je?.({LitElement:P}),(N.litElementVersions??=[]).push(`4.2.2`);var Me=Object.defineProperty,Ne=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t,n)=>(Ne(e,typeof t==`symbol`?t:t+``,n),n),Pe=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},I=(e,t)=>{if(Object(t)!==t)throw TypeError(`Cannot use the "in" operator on this value`);return e.has(t)},L=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},Fe=(e,t,n)=>(Pe(e,t,`access private method`),n);
|
|
26
26
|
/**
|
|
27
27
|
* @license
|
|
28
28
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -30,7 +30,7 @@ const g=globalThis,ce=e=>e,_=g.trustedTypes,le=_?_.createPolicy(`lit-html`,{crea
|
|
|
30
30
|
* Use of this source code is governed by an MIT-style license that can be
|
|
31
31
|
* found in the LICENSE file at https://angular.io/license
|
|
32
32
|
*/
|
|
33
|
-
function
|
|
33
|
+
function Ie(e,t){return Object.is(e,t)}
|
|
34
34
|
/**
|
|
35
35
|
* @license
|
|
36
36
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -38,7 +38,7 @@ function Le(e,t){return Object.is(e,t)}
|
|
|
38
38
|
* Use of this source code is governed by an MIT-style license that can be
|
|
39
39
|
* found in the LICENSE file at https://angular.io/license
|
|
40
40
|
*/
|
|
41
|
-
let
|
|
41
|
+
let R=null,z=!1,B=1;const V=Symbol(`SIGNAL`);function H(e){let t=R;return R=e,t}function Le(){return R}function Re(){return z}const ze={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function U(e){if(z)throw Error(typeof ngDevMode<`u`&&ngDevMode?`Assertion error: signal read during notification phase`:``);if(R===null)return;R.consumerOnSignalRead(e);let t=R.nextProducerIndex++;if(G(R),t<R.producerNode.length&&R.producerNode[t]!==e&&Ye(R)){let e=R.producerNode[t];W(e,R.producerIndexOfThis[t])}R.producerNode[t]!==e&&(R.producerNode[t]=e,R.producerIndexOfThis[t]=Ye(R)?Je(e,R,t):0),R.producerLastReadVersion[t]=e.version}function Be(){B++}function Ve(e){if(!(!e.dirty&&e.lastCleanEpoch===B)){if(!e.producerMustRecompute(e)&&!qe(e)){e.dirty=!1,e.lastCleanEpoch=B;return}e.producerRecomputeValue(e),e.dirty=!1,e.lastCleanEpoch=B}}function He(e){if(e.liveConsumerNode===void 0)return;let t=z;z=!0;try{for(let t of e.liveConsumerNode)t.dirty||We(t)}finally{z=t}}function Ue(){return R?.consumerAllowSignalWrites!==!1}function We(e){var t;e.dirty=!0,He(e),(t=e.consumerMarkedDirty)==null||t.call(e.wrapper??e)}function Ge(e){return e&&(e.nextProducerIndex=0),H(e)}function Ke(e,t){if(H(t),!(!e||e.producerNode===void 0||e.producerIndexOfThis===void 0||e.producerLastReadVersion===void 0)){if(Ye(e))for(let t=e.nextProducerIndex;t<e.producerNode.length;t++)W(e.producerNode[t],e.producerIndexOfThis[t]);for(;e.producerNode.length>e.nextProducerIndex;)e.producerNode.pop(),e.producerLastReadVersion.pop(),e.producerIndexOfThis.pop()}}function qe(e){G(e);for(let t=0;t<e.producerNode.length;t++){let n=e.producerNode[t],r=e.producerLastReadVersion[t];if(r!==n.version||(Ve(n),r!==n.version))return!0}return!1}function Je(e,t,n){var r;if(Xe(e),G(e),e.liveConsumerNode.length===0){(r=e.watched)==null||r.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)e.producerIndexOfThis[t]=Je(e.producerNode[t],e,t)}return e.liveConsumerIndexOfThis.push(n),e.liveConsumerNode.push(t)-1}function W(e,t){var n;if(Xe(e),G(e),typeof ngDevMode<`u`&&ngDevMode&&t>=e.liveConsumerNode.length)throw Error(`Assertion error: active consumer index ${t} is out of bounds of ${e.liveConsumerNode.length} consumers)`);if(e.liveConsumerNode.length===1){(n=e.unwatched)==null||n.call(e.wrapper);for(let t=0;t<e.producerNode.length;t++)W(e.producerNode[t],e.producerIndexOfThis[t])}let r=e.liveConsumerNode.length-1;if(e.liveConsumerNode[t]=e.liveConsumerNode[r],e.liveConsumerIndexOfThis[t]=e.liveConsumerIndexOfThis[r],e.liveConsumerNode.length--,e.liveConsumerIndexOfThis.length--,t<e.liveConsumerNode.length){let n=e.liveConsumerIndexOfThis[t],r=e.liveConsumerNode[t];G(r),r.producerIndexOfThis[n]=t}}function Ye(e){return e.consumerIsAlwaysLive||(e?.liveConsumerNode?.length??0)>0}function G(e){e.producerNode??=[],e.producerIndexOfThis??=[],e.producerLastReadVersion??=[]}function Xe(e){e.liveConsumerNode??=[],e.liveConsumerIndexOfThis??=[]}
|
|
42
42
|
/**
|
|
43
43
|
* @license
|
|
44
44
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -46,7 +46,7 @@ let L=null,R=!1,z=1;const B=Symbol(`SIGNAL`);function V(e){let t=L;return L=e,t}
|
|
|
46
46
|
* Use of this source code is governed by an MIT-style license that can be
|
|
47
47
|
* found in the LICENSE file at https://angular.io/license
|
|
48
48
|
*/
|
|
49
|
-
function
|
|
49
|
+
function Ze(e){if(Ve(e),U(e),e.value===tt)throw e.error;return e.value}function Qe(e){let t=Object.create(nt);t.computation=e;let n=()=>Ze(t);return n[V]=t,n}const $e=Symbol(`UNSET`),et=Symbol(`COMPUTING`),tt=Symbol(`ERRORED`),nt={...ze,value:$e,dirty:!0,error:null,equal:Ie,producerMustRecompute(e){return e.value===$e||e.value===et},producerRecomputeValue(e){if(e.value===et)throw Error(`Detected cycle in computations.`);let t=e.value;e.value=et;let n=Ge(e),r,i=!1;try{r=e.computation.call(e.wrapper),i=t!==$e&&t!==tt&&e.equal.call(e.wrapper,t,r)}catch(t){r=tt,e.error=t}finally{Ke(e,n)}if(i){e.value=t;return}e.value=r,e.version++}};
|
|
50
50
|
/**
|
|
51
51
|
* @license
|
|
52
52
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -54,7 +54,7 @@ function Xe(e){if(Ve(e),U(e),e.value===et)throw e.error;return e.value}function
|
|
|
54
54
|
* Use of this source code is governed by an MIT-style license that can be
|
|
55
55
|
* found in the LICENSE file at https://angular.io/license
|
|
56
56
|
*/
|
|
57
|
-
function
|
|
57
|
+
function rt(){throw Error()}let it=rt;function at(){it()}
|
|
58
58
|
/**
|
|
59
59
|
* @license
|
|
60
60
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -62,7 +62,7 @@ function nt(){throw Error()}let rt=nt;function it(){rt()}
|
|
|
62
62
|
* Use of this source code is governed by an MIT-style license that can be
|
|
63
63
|
* found in the LICENSE file at https://angular.io/license
|
|
64
64
|
*/
|
|
65
|
-
function
|
|
65
|
+
function ot(e){let t=Object.create(lt);t.value=e;let n=()=>(U(t),t.value);return n[V]=t,n}function st(){return U(this),this.value}function ct(e,t){Ue()||at(),e.equal.call(e.wrapper,e.value,t)||(e.value=t,ut(e))}const lt={...ze,equal:Ie,value:void 0};function ut(e){e.version++,Be(),He(e)}
|
|
66
66
|
/**
|
|
67
67
|
* @license
|
|
68
68
|
* Copyright 2024 Bloomberg Finance L.P.
|
|
@@ -79,35 +79,35 @@ function at(e){let t=Object.create(ct);t.value=e;let n=()=>(U(t),t.value);return
|
|
|
79
79
|
* See the License for the specific language governing permissions and
|
|
80
80
|
* limitations under the License.
|
|
81
81
|
*/
|
|
82
|
-
const
|
|
82
|
+
const K=Symbol(`node`);var q;(e=>{var t,n,r,i;class a{constructor(r,i={}){L(this,n),F(this,t);let a=ot(r)[V];if(this[K]=a,a.wrapper=this,i){let t=i.equals;t&&(a.equal=t),a.watched=i[e.subtle.watched],a.unwatched=i[e.subtle.unwatched]}}get(){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.get`);return st.call(this[K])}set(t){if(!(0,e.isState)(this))throw TypeError(`Wrong receiver type for Signal.State.prototype.set`);if(Re())throw Error(`Writes to signals not permitted during Watcher callback`);let n=this[K];ct(n,t)}}t=K,n=new WeakSet,e.isState=e=>typeof e==`object`&&I(n,e),e.State=a;class o{constructor(t,n){L(this,i),F(this,r);let a=Qe(t)[V];if(a.consumerAllowSignalWrites=!0,this[K]=a,a.wrapper=this,n){let t=n.equals;t&&(a.equal=t),a.watched=n[e.subtle.watched],a.unwatched=n[e.subtle.unwatched]}}get(){if(!(0,e.isComputed)(this))throw TypeError(`Wrong receiver type for Signal.Computed.prototype.get`);return Ze(this[K])}}r=K,i=new WeakSet,e.isComputed=e=>typeof e==`object`&&I(i,e),e.Computed=o,(t=>{var n,r,i,a;function o(e){let t,n=null;try{n=H(null),t=e()}finally{H(n)}return t}t.untrack=o;function s(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called introspectSources without a Computed or Watcher argument`);return t[K].producerNode?.map(e=>e.wrapper)??[]}t.introspectSources=s;function c(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called introspectSinks without a Signal argument`);return t[K].liveConsumerNode?.map(e=>e.wrapper)??[]}t.introspectSinks=c;function l(t){if(!(0,e.isComputed)(t)&&!(0,e.isState)(t))throw TypeError(`Called hasSinks without a Signal argument`);let n=t[K].liveConsumerNode;return n?n.length>0:!1}t.hasSinks=l;function u(t){if(!(0,e.isComputed)(t)&&!(0,e.isWatcher)(t))throw TypeError(`Called hasSources without a Computed or Watcher argument`);let n=t[K].producerNode;return n?n.length>0:!1}t.hasSources=u;class d{constructor(e){L(this,r),L(this,i),F(this,n);let t=Object.create(ze);t.wrapper=this,t.consumerMarkedDirty=e,t.consumerIsAlwaysLive=!0,t.consumerAllowSignalWrites=!1,t.producerNode=[],this[K]=t}watch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);Fe(this,i,a).call(this,t);let n=this[K];n.dirty=!1;let r=H(n);for(let e of t)U(e[K]);H(r)}unwatch(...t){if(!(0,e.isWatcher)(this))throw TypeError(`Called unwatch without Watcher receiver`);Fe(this,i,a).call(this,t);let n=this[K];G(n);for(let e=n.producerNode.length-1;e>=0;e--)if(t.includes(n.producerNode[e].wrapper)){W(n.producerNode[e],n.producerIndexOfThis[e]);let t=n.producerNode.length-1;if(n.producerNode[e]=n.producerNode[t],n.producerIndexOfThis[e]=n.producerIndexOfThis[t],n.producerNode.length--,n.producerIndexOfThis.length--,n.nextProducerIndex--,e<n.producerNode.length){let t=n.producerIndexOfThis[e],r=n.producerNode[e];Xe(r),r.liveConsumerIndexOfThis[t]=e}}}getPending(){if(!(0,e.isWatcher)(this))throw TypeError(`Called getPending without Watcher receiver`);return this[K].producerNode.filter(e=>e.dirty).map(e=>e.wrapper)}}n=K,r=new WeakSet,i=new WeakSet,a=function(t){for(let n of t)if(!(0,e.isComputed)(n)&&!(0,e.isState)(n))throw TypeError(`Called watch/unwatch without a Computed or State argument`)},e.isWatcher=e=>I(r,e),t.Watcher=d;function ee(){return Le()?.wrapper}t.currentComputed=ee,t.watched=Symbol(`watched`),t.unwatched=Symbol(`unwatched`)})(e.subtle||={})})(q||={});
|
|
83
83
|
/**
|
|
84
84
|
* @license
|
|
85
85
|
* Copyright 2023 Google LLC
|
|
86
86
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
87
|
-
*/let
|
|
87
|
+
*/let dt=!1;const ft=new q.subtle.Watcher(()=>{dt||(dt=!0,queueMicrotask(()=>{dt=!1;for(let e of ft.getPending())e.get();ft.watch()}))}),pt=Symbol(`SignalWatcherBrand`),mt=new FinalizationRegistry(e=>{e.unwatch(...q.subtle.introspectSources(e))}),ht=new WeakMap;function gt(e){return!0===e[pt]?(console.warn(`SignalWatcher should not be applied to the same class more than once.`),e):class extends e{constructor(){super(...arguments),this._$St=new Map,this._$So=new q.State(0),this._$Si=!1}_$Sl(){var e;let t=[],n=[];this._$St.forEach((e,r)=>{(e?.beforeUpdate?t:n).push(r)});let r=this.h?.getPending().filter(e=>e!==this._$Su&&!this._$St.has(e));t.forEach(e=>e.get()),(e=this._$Su)==null||e.get(),r.forEach(e=>e.get()),n.forEach(e=>e.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(this.h!==void 0)return;this._$Su=new q.Computed(()=>{this._$So.get(),super.performUpdate()});let e=this.h=new q.subtle.Watcher(function(){let e=ht.get(this);e!==void 0&&(!1===e._$Si&&(new Set(this.getPending()).has(e._$Su)?e.requestUpdate():e._$Sv()),this.watch())});ht.set(e,this),mt.register(this,e),e.watch(this._$Su),e.watch(...Array.from(this._$St).map(([e])=>e))}_$Sp(){if(this.h===void 0)return;let e=!1;this.h.unwatch(...q.subtle.introspectSources(this.h).filter(t=>{let n=!0!==this._$St.get(t)?.manualDispose;return n&&this._$St.delete(t),e||=!n,n})),e||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(e,t){var n;this._$S_();let r=new q.Computed(()=>{e()});return this.h.watch(r),this._$St.set(r,t),(n=t?.beforeUpdate)!=null&&n?q.subtle.untrack(()=>r.get()):this.updateComplete.then(()=>q.subtle.untrack(()=>r.get())),()=>{this._$St.delete(r),this.h.unwatch(r),!1===this.isConnected&&this._$Sp()}}performUpdate(){this.isUpdatePending&&(this._$S_(),this._$Si=!0,this._$So.set(this._$So.get()+1),this._$Si=!1,this._$Sl())}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{!1===this.isConnected&&this._$Sp()})}}}
|
|
88
88
|
/**
|
|
89
89
|
* @license
|
|
90
90
|
* Copyright 2017 Google LLC
|
|
91
91
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
92
92
|
*/
|
|
93
|
-
const
|
|
93
|
+
const _t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},vt=e=>(...t)=>({_$litDirective$:e,values:t});var yt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};
|
|
94
94
|
/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2020 Google LLC
|
|
97
97
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
|
-
*/const{I:
|
|
98
|
+
*/const{I:bt}=Oe,xt=e=>e.strings===void 0,J=(e,t)=>{
|
|
99
99
|
/**
|
|
100
100
|
* @license
|
|
101
101
|
* Copyright 2017 Google LLC
|
|
102
102
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
103
103
|
*/
|
|
104
|
-
let n=e._$AN;if(n===void 0)return!1;for(let e of n)e._$AO?.(t,!1),
|
|
104
|
+
let n=e._$AN;if(n===void 0)return!1;for(let e of n)e._$AO?.(t,!1),J(e,t);return!0},Y=e=>{let t,n;do{if((t=e._$AM)===void 0)break;n=t._$AN,n.delete(e),e=t}while(n?.size===0)},St=e=>{for(let t;t=e._$AM;e=t){let n=t._$AN;if(n===void 0)t._$AN=n=new Set;else if(n.has(e))break;n.add(e),Tt(t)}};function Ct(e){this._$AN===void 0?this._$AM=e:(Y(this),this._$AM=e,St(this))}function wt(e,t=!1,n=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let e=n;e<r.length;e++)J(r[e],!1),Y(r[e]);else r!=null&&(J(r,!1),Y(r));else J(this,e)}const Tt=e=>{e.type==_t.CHILD&&(e._$AP??=wt,e._$AQ??=Ct)};var Et=class extends yt{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),St(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(J(this,e),Y(this))}setValue(e){if(xt(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};
|
|
105
105
|
/**
|
|
106
106
|
* @license
|
|
107
107
|
* Copyright 2023 Google LLC
|
|
108
108
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
109
109
|
*/
|
|
110
|
-
let
|
|
110
|
+
let X=!1;const Dt=new q.subtle.Watcher(async()=>{X||(X=!0,queueMicrotask(()=>{X=!1;for(let e of Dt.getPending())e.get();Dt.watch()}))}),Ot=vt(class extends Et{_$S_(){this._$Sm===void 0&&(this._$Sj=new q.Computed(()=>{let e=this._$SW?.get();return this.setValue(e),e}),this._$Sm=this._$Sk?.h??Dt,this._$Sm.watch(this._$Sj),q.subtle.untrack(()=>this._$Sj?.get()))}_$Sp(){this._$Sm!==void 0&&(this._$Sm.unwatch(this._$SW),this._$Sm=void 0)}render(e){return q.subtle.untrack(()=>e.get())}update(e,[t]){return this._$Sk??=e.options?.host,t!==this._$SW&&this._$SW!==void 0&&this._$Sp(),this._$SW=t,this._$S_(),q.subtle.untrack(()=>this._$SW.get())}disconnected(){this._$Sp()}reconnected(){this._$S_()}}),Z=(e=>(t,...n)=>e(t,...n.map(e=>e instanceof q.State||e instanceof q.Computed?Ot(e):e)))(ve)
|
|
111
111
|
/**
|
|
112
112
|
* @license
|
|
113
113
|
* Copyright 2023 Google LLC
|
|
@@ -118,7 +118,7 @@ let Et=!1;const Dt=new J.subtle.Watcher(async()=>{Et||(Et=!0,queueMicrotask(()=>
|
|
|
118
118
|
* Copyright 2023 Google LLC
|
|
119
119
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
120
120
|
*/
|
|
121
|
-
;
|
|
121
|
+
;q.State,q.Computed;const kt=gt(P);var Q=class extends kt{static{this.styles=[]}getSlottedNodes(e=[]){let t=this.shadowRoot?.querySelector(`slot`);if(!t)return[];let n=t.assignedNodes({flatten:!0});return e.length===0?n:n.filter(t=>e.includes(t.tagName.toLowerCase()))}},At=class{constructor(e,t){this.handleEl=null,this.isDragging=!1,this.rafId=null,this.pendingPosition=null,this.containerRect=null,this.currentPosition=.5,this.prefersReducedMotion=!1,this.onPointerDown=e=>{if(e.button!==0)return;e.preventDefault(),this.isDragging=!0,this.handleEl?.setPointerCapture(e.pointerId);let t=this.handleEl?.parentElement;this.containerRect=t?.getBoundingClientRect()??null,document.addEventListener(`pointermove`,this.onPointerMove),document.addEventListener(`pointerup`,this.onPointerUp),document.addEventListener(`pointercancel`,this.onPointerUp),this.handleEl?.classList.add(`dragging`),this.options.onDragStart(),this.processPointerEvent(e)},this.onPointerMove=e=>{this.isDragging&&this.processPointerEvent(e)},this.flushPosition=()=>{this.rafId=null,this.pendingPosition!==null&&this.isDragging&&(this.currentPosition=this.pendingPosition,this.updateAriaValue(this.currentPosition),this.options.onDrag(this.currentPosition))},this.onPointerUp=e=>{if(!this.isDragging)return;this.isDragging=!1,this.handleEl?.releasePointerCapture(e.pointerId),this.containerRect=null,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null);let t=this.pendingPosition??this.currentPosition;this.currentPosition=t,this.pendingPosition=null,this.updateAriaValue(t),this.options.onDragEnd(t),document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),document.removeEventListener(`pointercancel`,this.onPointerUp),this.handleEl?.classList.remove(`dragging`)},this.onKeyDown=e=>{let{orientation:t,keyboardStep:n,keyboardLargeStep:r}=this.options,i=e.shiftKey?r:n,a=0;if(t===`horizontal`?e.key===`ArrowLeft`?a=-i:e.key===`ArrowRight`&&(a=i):e.key===`ArrowUp`?a=-i:e.key===`ArrowDown`&&(a=i),e.key===`Home`){e.preventDefault(),this.currentPosition=0,this.updateAriaValue(0),this.options.onDrag(0),this.options.onDragEnd(0);return}if(e.key===`End`){e.preventDefault(),this.currentPosition=1,this.updateAriaValue(1),this.options.onDrag(1),this.options.onDragEnd(1);return}if(a!==0){e.preventDefault();let t=Math.max(0,Math.min(1,this.currentPosition+a));this.currentPosition=t,this.updateAriaValue(t),this.options.onDrag(t),this.options.onDragEnd(t)}},this.host=e,this.options={handleSelector:t.handleSelector,orientation:t.orientation??`horizontal`,smooth:t.smooth??!0,onDrag:t.onDrag??(()=>{}),onDragStart:t.onDragStart??(()=>{}),onDragEnd:t.onDragEnd??(()=>{}),keyboardStep:t.keyboardStep??.01,keyboardLargeStep:t.keyboardLargeStep??.1},e.addController(this)}hostConnected(){this.prefersReducedMotion=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}hostUpdated(){this.setupHandle()}hostDisconnected(){this.cleanup()}get shouldSmooth(){return this.options.smooth&&!this.prefersReducedMotion}setupHandle(){let e=this.host.renderRoot.querySelector(this.options.handleSelector);e!==this.handleEl&&(this.handleEl&&(this.handleEl.removeEventListener(`pointerdown`,this.onPointerDown),this.handleEl.removeEventListener(`keydown`,this.onKeyDown)),this.handleEl=e,this.handleEl&&(this.handleEl.addEventListener(`pointerdown`,this.onPointerDown),this.handleEl.addEventListener(`keydown`,this.onKeyDown),this.handleEl.hasAttribute(`tabindex`)||this.handleEl.setAttribute(`tabindex`,`0`),this.handleEl.hasAttribute(`role`)||this.handleEl.setAttribute(`role`,`separator`),this.handleEl.setAttribute(`aria-valuemin`,`0`),this.handleEl.setAttribute(`aria-valuemax`,`100`),this.updateAriaValue(this.currentPosition)))}processPointerEvent(e){if(!this.containerRect)return;let{orientation:t}=this.options,n=this.containerRect,r;if(t===`horizontal`){let t=e.clientX-n.left;r=Math.max(0,Math.min(1,t/n.width))}else{let t=e.clientY-n.top;r=Math.max(0,Math.min(1,t/n.height))}this.pendingPosition=r,this.shouldSmooth&&this.rafId===null&&(this.rafId=requestAnimationFrame(this.flushPosition))}updateAriaValue(e){let t=Math.round(e*100);this.handleEl?.setAttribute(`aria-valuenow`,String(t))}cleanup(){this.handleEl&&(this.handleEl.removeEventListener(`pointerdown`,this.onPointerDown),this.handleEl.removeEventListener(`keydown`,this.onKeyDown)),document.removeEventListener(`pointermove`,this.onPointerMove),document.removeEventListener(`pointerup`,this.onPointerUp),document.removeEventListener(`pointercancel`,this.onPointerUp),this.rafId!==null&&cancelAnimationFrame(this.rafId)}setPosition(e){this.currentPosition=Math.max(0,Math.min(1,e)),this.updateAriaValue(this.currentPosition)}getPosition(){return this.currentPosition}updateOptions(e){Object.assign(this.options,e)}},jt=class extends Q{static{this.styles=[Q.styles,o`
|
|
122
122
|
:host {
|
|
123
123
|
--_offset: var(--offset, 0.5);
|
|
124
124
|
--_handle-size: var(--handle-size, 8px);
|
|
@@ -245,7 +245,7 @@ let Et=!1;const Dt=new J.subtle.Watcher(async()=>{Et||(Et=!0,queueMicrotask(()=>
|
|
|
245
245
|
transition: none;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
`]}static{this.properties={position:{type:Number},vertical:{type:Boolean,reflect:!0},discrete:{type:Boolean,reflect:!0},minSize:{type:Number,attribute:`min-size`},maxSize:{type:Number,attribute:`max-size`},keyboardStep:{type:Number,attribute:`keyboard-step`},collapseThreshold:{type:Number,attribute:`collapse-threshold`},snapPoints:{type:String,attribute:`snap-points`},snapDistance:{type:Number,attribute:`snap-distance`},_offset:{state:!0}}}constructor(){super(),this.containerSize=0,this.position=50,this.vertical=!1,this.discrete=!1,this.minSize=100,this.maxSize=0,this.keyboardStep=1,this.collapseThreshold=0,this.snapPoints=``,this.snapDistance=10,this._offset=.5,this.initDragController()}initDragController(){this.dragController=new At(this,{handleSelector:`[part="handle"]`,orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,onDragStart:()=>this.handleDragStart(),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})}handleDragStart(){let e=this.renderRoot.querySelector(`.splitter`);if(e){let t=e.getBoundingClientRect();this.containerSize=this.vertical?t.height:t.width}}applyConstraints(e){let t=e;if(this.containerSize>0){let e=this.minSize/this.containerSize,n=this.maxSize>0?this.maxSize/this.containerSize:1-e;t=Math.max(e,Math.min(1-e,t)),t=Math.min(n,t)}if(this.snapPoints&&this.containerSize>0){let e=this.snapPoints.split(`,`).map(e=>parseFloat(e.trim())/100),n=this.snapDistance/this.containerSize;for(let r of e)if(Math.abs(t-r)<n){t=r;break}}if(this.collapseThreshold>0){let e=this.collapseThreshold/100;t<e?t=0:t>1-e&&(t=1)}return t}handleDrag(e){let t=this.applyConstraints(e);this._offset=t,this.style.setProperty(`--_offset`,String(this._offset))}handleDragEnd(e){let t=this.applyConstraints(e);this._offset=t,this.style.setProperty(`--_offset`,String(this._offset)),this.dispatchEvent(new CustomEvent(`split-change`,{detail:{position:this._offset*100},bubbles:!0,composed:!0}))}render(){return
|
|
248
|
+
`]}static{this.properties={position:{type:Number},vertical:{type:Boolean,reflect:!0},discrete:{type:Boolean,reflect:!0},minSize:{type:Number,attribute:`min-size`},maxSize:{type:Number,attribute:`max-size`},keyboardStep:{type:Number,attribute:`keyboard-step`},collapseThreshold:{type:Number,attribute:`collapse-threshold`},snapPoints:{type:String,attribute:`snap-points`},snapDistance:{type:Number,attribute:`snap-distance`},_offset:{state:!0}}}constructor(){super(),this.containerSize=0,this.position=50,this.vertical=!1,this.discrete=!1,this.minSize=100,this.maxSize=0,this.keyboardStep=1,this.collapseThreshold=0,this.snapPoints=``,this.snapDistance=10,this._offset=.5,this.initDragController()}initDragController(){this.dragController=new At(this,{handleSelector:`[part="handle"]`,orientation:this.vertical?`vertical`:`horizontal`,smooth:!this.discrete,onDragStart:()=>this.handleDragStart(),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})}handleDragStart(){let e=this.renderRoot.querySelector(`.splitter`);if(e){let t=e.getBoundingClientRect();this.containerSize=this.vertical?t.height:t.width}}applyConstraints(e){let t=e;if(this.containerSize>0){let e=this.minSize/this.containerSize,n=this.maxSize>0?this.maxSize/this.containerSize:1-e;t=Math.max(e,Math.min(1-e,t)),t=Math.min(n,t)}if(this.snapPoints&&this.containerSize>0){let e=this.snapPoints.split(`,`).map(e=>parseFloat(e.trim())/100),n=this.snapDistance/this.containerSize;for(let r of e)if(Math.abs(t-r)<n){t=r;break}}if(this.collapseThreshold>0){let e=this.collapseThreshold/100;t<e?t=0:t>1-e&&(t=1)}return t}handleDrag(e){let t=this.applyConstraints(e);this._offset=t,this.style.setProperty(`--_offset`,String(this._offset))}handleDragEnd(e){let t=this.applyConstraints(e);this._offset=t,this.style.setProperty(`--_offset`,String(this._offset)),this.dispatchEvent(new CustomEvent(`split-change`,{detail:{position:this._offset*100},bubbles:!0,composed:!0}))}render(){return ve`
|
|
249
249
|
<div class="splitter" part="container" style="--_offset: ${this._offset}">
|
|
250
250
|
<div class="panel panel--start" part="panel-start">
|
|
251
251
|
<slot name="start"></slot>
|
|
@@ -455,7 +455,7 @@ let Et=!1;const Dt=new J.subtle.Watcher(async()=>{Et||(Et=!0,queueMicrotask(()=>
|
|
|
455
455
|
white-space: nowrap;
|
|
456
456
|
border: 0;
|
|
457
457
|
}
|
|
458
|
-
`]}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 At(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
|
|
458
|
+
`]}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 At(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 ve`
|
|
459
459
|
<div class="container" part="container" style="--_offset: ${this._offset}">
|
|
460
460
|
<div class="after" part="after" aria-label="${this.afterLabel}">
|
|
461
461
|
<slot name="after"></slot>
|
|
@@ -475,7 +475,7 @@ let Et=!1;const Dt=new J.subtle.Watcher(async()=>{Et||(Et=!0,queueMicrotask(()=>
|
|
|
475
475
|
</div>
|
|
476
476
|
</div>
|
|
477
477
|
</div>
|
|
478
|
-
`}};customElements.get(`wc-image-compare`)||customElements.define(`wc-image-compare`,Mt);var Nt=class extends Q{static{this.properties={duration:{type:Number,reflect:!0},exit:{type:Number}}}createRenderRoot(){return this}render(){return
|
|
478
|
+
`}};customElements.get(`wc-image-compare`)||customElements.define(`wc-image-compare`,Mt);var Nt=class extends Q{static{this.properties={duration:{type:Number,reflect:!0},exit:{type:Number}}}createRenderRoot(){return this}render(){return D}#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`,Nt);var Pt=class extends Q{static{this.styles=[Q.styles,o`
|
|
479
479
|
:host {
|
|
480
480
|
display: inline-flex;
|
|
481
481
|
align-items: center;
|
|
@@ -884,4 +884,4 @@ let Et=!1;const Dt=new J.subtle.Watcher(async()=>{Et||(Et=!0,queueMicrotask(()=>
|
|
|
884
884
|
</button>
|
|
885
885
|
</div>
|
|
886
886
|
</div>
|
|
887
|
-
`}};customElements.get(`wc-multi-field`)||customElements.define(`wc-multi-field`,zt);var Bt=class extends Q{createRenderRoot(){return this}#e=null;#t;connectedCallback(){super.connectedCallback(),$(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`,Bt);function Vt(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}}var Ht=class extends Q{static{this.properties={label:{type:String,reflect:!0},nofilter:{type:Boolean,reflect:!0}}}createRenderRoot(){return this}render(){return
|
|
887
|
+
`}};customElements.get(`wc-multi-field`)||customElements.define(`wc-multi-field`,zt);var Bt=class extends Q{createRenderRoot(){return this}#e=null;#t;connectedCallback(){super.connectedCallback(),$(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`,Bt);function Vt(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}}var Ht=class extends Q{static{this.properties={label:{type:String,reflect:!0},nofilter:{type:Boolean,reflect:!0}}}createRenderRoot(){return this}render(){return D}#e=null;#t=[];#n=null;#r=null;#i=null;#a=new WeakMap;#o=!1;constructor(){super(),this.label=`Filter`,this.nofilter=!1}connectedCallback(){super.connectedCallback(),$(this,()=>this.#s())}#s(){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?(this.#e=e,this.#c(),this.#t.length?(this.#f(),window.addEventListener(`hashchange`,this.#m),requestAnimationFrame(()=>this.#h()),!0):(this.#e=null,!1)):!1}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener(`hashchange`,this.#m),this.#n?.remove(),this.#n=null,this.#r=null,this.#i=null,this.#t=[],this.#e=null}#c(){let e=this.#e?.querySelectorAll(`.tree__item`)??[];this.#t=[...e].map(e=>({key:e,own:this.#l(e),parent:e.parentElement?.closest(`.tree__item`)??null}))}#l(e){let t=[];for(let n of[`:scope > summary`,`:scope > .tree__content`,`:scope > details > summary`]){let r=e.querySelector(n);r?.textContent&&t.push(r.textContent)}for(let n of e.querySelectorAll(`:scope > .tree__desc, :scope > p, :scope > details > .tree__desc, :scope > details > p`))n.textContent&&t.push(n.textContent);return t.join(` `).toLowerCase()}#u(e){return e instanceof HTMLDetailsElement?e:e.querySelector(`:scope > details`)}#d(){return[...this.#e?.querySelectorAll(`details`)??[]]}#f(){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.#r=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.#i=t,this.#e?.before(e),this.#n=e}toggleAll(e){for(let t of this.#d())t.open=e}filter(e){let t=e.trim().toLowerCase();if(!t){for(let{key:e}of this.#t)e.hidden=!1;if(this.#o){for(let e of this.#d())e.open=this.#a.get(e)??!1;this.#o=!1}this.#p(``);return}if(!this.#o){for(let e of this.#d())this.#a.set(e,e.open);this.#o=!0}let{keep:n,hits:r}=Vt(this.#t,t);for(let{key:e}of this.#t)e.hidden=!n.has(e);for(let e of n){let t=this.#u(e);t&&(t.open=!0)}this.#p(r===1?`1 match`:`${r} matches`),this.dispatchEvent(new CustomEvent(`tree-filter`,{detail:{query:t,matches:r},bubbles:!0}))}#p(e){this.#i&&(this.#i.textContent=e)}#m=()=>this.#h();#h(){let e=decodeURIComponent(location.hash.slice(1));if(!e)return;let t=this.#e?.ownerDocument.getElementById(e);if(!t||!this.contains(t))return;let n=this.#u(t);n&&(n.open=!0);for(let e=t;e&&(e instanceof HTMLDetailsElement&&(e.open=!0),e!==this);e=e.parentElement);this.#r?.value&&this.filter(this.#r.value=``),t.scrollIntoView({block:`start`,behavior:`smooth`})}};customElements.get(`wc-tree`)||customElements.define(`wc-tree`,Ht);function Ut(e){return!e.hasLink||e.onInteractive||e.platformHandled?!1:e.moved<=6}const Wt=[`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 Gt(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}var Kt=class extends Q{static{this.properties={item:{type:String,reflect:!0}}}createRenderRoot(){return this}render(){return D}#e=[];#t;constructor(){super(),this.item=`.card`}connectedCallback(){super.connectedCallback(),$(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=Ut({moved:this.#t?Gt(this.#t,{x:e.clientX,y:e.clientY}):0,onInteractive:!!t?.closest(Wt),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`,Kt);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getvitops/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "The Vitops design-system framework — CSS partials, Lit web components, and browser polyfills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"lit": "^3.3.3",
|
|
33
33
|
"scroll-timeline-polyfill": "^1.1.0",
|
|
34
34
|
"temporal-polyfill": "^1.0.1",
|
|
35
|
-
"@getvitops/utils": "
|
|
35
|
+
"@getvitops/utils": "5.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"happy-dom": "^20.0.0",
|