@getvitops/generator 2.1.0 → 4.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 +411 -0
- package/assets/bricks/elements/color-scheme-toggle.php +3 -3
- package/assets/bricks/elements/copy-button.php +3 -3
- package/assets/bricks/elements/multi-field.php +3 -3
- package/assets/css/animation.css +90 -0
- package/assets/css/global.css +10 -0
- package/assets/css/index.css +5 -0
- package/assets/css/layout-utilities.css +46 -0
- package/assets/css/layout.css +87 -2
- package/assets/css/patterns/anchor-link.css +36 -0
- package/assets/css/patterns/code.css +24 -0
- package/assets/css/patterns/consent.css +14 -3
- package/assets/css/patterns/details.css +28 -16
- package/assets/css/patterns/dialog.css +13 -31
- package/assets/css/patterns/drawer.css +27 -66
- package/assets/css/patterns/dropdown.css +15 -1
- package/assets/css/patterns/lightbox.css +3 -3
- package/assets/css/patterns/marquee.css +33 -5
- package/assets/css/patterns/nav.css +27 -79
- package/assets/css/patterns/navbar.css +86 -0
- package/assets/css/patterns/navshell.css +383 -0
- package/assets/css/patterns/popover.css +56 -8
- package/assets/css/patterns/scroll-target.css +18 -4
- package/assets/css/patterns/sitenav.css +253 -408
- package/assets/css/patterns/split-link.css +3 -3
- package/assets/css/patterns/tree.css +118 -8
- package/assets/js/consent.js +1 -1
- package/assets/js/elements.js +26 -26
- package/{site.schema.json → config.schema.json} +2364 -2264
- package/dist/index.d.mts +1269 -541
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4542 -3010
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -101,9 +101,9 @@
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
/* No scrim. Stated through popover.css's token rather than overriding its
|
|
105
|
+
::backdrop rule, so it keeps the shared fade timing. */
|
|
106
|
+
--scrim: transparent;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/* Builder-only: rendered without the `popover` attribute so nested content is
|
|
@@ -3,9 +3,38 @@
|
|
|
3
3
|
* Consumes the generated token cascade (src/css/generated/tokens.css).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/* An unregistered custom element is `display: inline`, and `<wc-tree>` wraps a
|
|
7
|
+
`<ul>` — a block child in an inline box, which forces an anonymous block and
|
|
8
|
+
leaves the element unable to take sizing or spacing. It must be block whether
|
|
9
|
+
or not `elements.js` ever loads, because the tag is in the SSR'd markup either
|
|
10
|
+
way. (Same gap exists on most other `wc-*` tags; see the note in
|
|
11
|
+
`src/js/elements.ts`.) */
|
|
12
|
+
wc-tree {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
/* ── Tree — hierarchical view over nested lists / <details> ───────────────── */
|
|
7
17
|
.tree {
|
|
8
18
|
--_p: var(--p-tree, var(--p-tree-group, var(--p-default)));
|
|
19
|
+
/* Resolved once here so the indent and the `--lines` elbow that must align to
|
|
20
|
+
it cannot disagree. Read through `--tree-indent` rather than assigning it, so
|
|
21
|
+
a consumer setting `--tree-indent` on an ancestor still wins — assigning the
|
|
22
|
+
default directly to `--tree-indent` on `.tree` would out-specify the hook and
|
|
23
|
+
silently ignore it. */
|
|
24
|
+
--_indent: var(--tree-indent, clamp(0.75rem, 2.5vw, 1.5rem));
|
|
25
|
+
|
|
26
|
+
/* The toggle column. A branch spends this on its chevron before its label; a
|
|
27
|
+
leaf has no chevron, so without compensation a leaf label sits one whole
|
|
28
|
+
column to the INLINE-START of its branch siblings and nothing at a given
|
|
29
|
+
depth lines up. Measured: 24px of misalignment at every level.
|
|
30
|
+
|
|
31
|
+
Two vars rather than one because they answer different questions —
|
|
32
|
+
`--_node-indent` is how wide the toggle column is, `--_leaf-indent` is what a
|
|
33
|
+
row without a toggle owes to sit in the same label column. Anything that
|
|
34
|
+
needs to align to the label (the description, a future `.tree__actions`
|
|
35
|
+
offset) reads `--_leaf-indent` rather than re-deriving the sum. */
|
|
36
|
+
--_node-indent: var(--tree-icon-size, 1.25rem);
|
|
37
|
+
--_leaf-indent: calc(var(--_node-indent) + var(--tree-gap, 0.25rem));
|
|
9
38
|
|
|
10
39
|
list-style: none;
|
|
11
40
|
margin: 0;
|
|
@@ -15,14 +44,49 @@
|
|
|
15
44
|
position: relative;
|
|
16
45
|
}
|
|
17
46
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
47
|
+
/* Nested list indent. Two shapes are supported: the item may BE the
|
|
48
|
+
`<details>`, or be an `<li>` wrapping one — the latter is what `<Tree />`
|
|
49
|
+
emits, because `<ul>`/`<li>` is what gives assistive tech list position and
|
|
50
|
+
depth. Keep both; the flat shape is the pattern's original contract.
|
|
51
|
+
|
|
52
|
+
Indent is ONE `--tree-indent` per level, not two. This used to set both
|
|
53
|
+
`margin-inline-start` and `padding-inline-start` to it, putting the guide
|
|
54
|
+
border between them and costing 2× per level — 3rem × 10 levels = 480px on
|
|
55
|
+
the config schema, which is wider than a 390px viewport, so the deepest
|
|
56
|
+
fields sat entirely off-screen. The border now hugs the parent's edge and
|
|
57
|
+
the padding alone carries the offset, which looks the same at one level and
|
|
58
|
+
stays on screen at ten.
|
|
59
|
+
|
|
60
|
+
Fluid, because a tree's depth is a property of the DATA and can't be known
|
|
61
|
+
when the pattern is written: `2ch`-ish on a narrow screen, the full step on
|
|
62
|
+
a wide one. Deep trees stay usable on a phone without flattening the
|
|
63
|
+
hierarchy visually on a desktop. */
|
|
64
|
+
.tree__item > .tree,
|
|
65
|
+
.tree__item > details > .tree {
|
|
66
|
+
/* Reset BOTH box axes before re-applying the one indent this level owes.
|
|
67
|
+
Two separate leaks compounded here, each adding ~16px per level and each
|
|
68
|
+
invisible in the CSS:
|
|
69
|
+
|
|
70
|
+
1. `.tree { padding: var(--_p) }` applies to every nested `.tree`, not just
|
|
71
|
+
the outermost, so the container padding was charged once per level — on
|
|
72
|
+
all four sides, narrowing from the end as well.
|
|
73
|
+
2. `patterns/details.css` gives every non-summary child of a `<details>`
|
|
74
|
+
`margin-inline: var(--_content-margin)`. Its selector is
|
|
75
|
+
`details, .details`, which under CSS nesting takes `:is()` specificity
|
|
76
|
+
(0-1-1), so `.tree { margin: 0 }` at 0-1-0 LOSES to it. A nested tree is
|
|
77
|
+
exactly such a child.
|
|
78
|
+
|
|
79
|
+
Measured before this: 41px per level against a 24px design, so a 9-deep
|
|
80
|
+
tree spent 382px on indent and left its deepest label 162px wide. */
|
|
81
|
+
margin-inline: 0;
|
|
82
|
+
padding: 0;
|
|
83
|
+
padding-inline-start: var(--_indent);
|
|
21
84
|
border-inline-start: 1px solid var(--color-bg-surface-muted);
|
|
22
85
|
}
|
|
23
86
|
|
|
24
87
|
.tree__content,
|
|
25
|
-
details.tree__item > summary
|
|
88
|
+
details.tree__item > summary,
|
|
89
|
+
.tree__item > details > summary {
|
|
26
90
|
display: flex;
|
|
27
91
|
align-items: center;
|
|
28
92
|
gap: var(--tree-gap, 0.25rem);
|
|
@@ -31,9 +95,13 @@
|
|
|
31
95
|
|
|
32
96
|
.tree__content {
|
|
33
97
|
cursor: default;
|
|
98
|
+
/* Sit in the same label column as a branch sibling, which spends this much on
|
|
99
|
+
its chevron. Without it a leaf reads as out-dented by one toggle width. */
|
|
100
|
+
padding-inline-start: var(--_leaf-indent);
|
|
34
101
|
}
|
|
35
102
|
|
|
36
|
-
details.tree__item > summary
|
|
103
|
+
details.tree__item > summary,
|
|
104
|
+
.tree__item > details > summary {
|
|
37
105
|
cursor: pointer;
|
|
38
106
|
list-style: none;
|
|
39
107
|
|
|
@@ -59,7 +127,8 @@
|
|
|
59
127
|
transition: transform 0.2s ease;
|
|
60
128
|
}
|
|
61
129
|
|
|
62
|
-
details.tree__item[open] > summary .tree__toggle
|
|
130
|
+
details.tree__item[open] > summary .tree__toggle,
|
|
131
|
+
.tree__item > details[open] > summary .tree__toggle {
|
|
63
132
|
transform: rotate(90deg);
|
|
64
133
|
}
|
|
65
134
|
|
|
@@ -111,10 +180,10 @@
|
|
|
111
180
|
&::before {
|
|
112
181
|
content: '';
|
|
113
182
|
position: absolute;
|
|
114
|
-
inset-inline-start: calc(-1 * var(--
|
|
183
|
+
inset-inline-start: calc(-1 * var(--_indent) + 0.5rem);
|
|
115
184
|
inset-block-start: 0;
|
|
116
185
|
block-size: 1rem;
|
|
117
|
-
inline-size: calc(var(--
|
|
186
|
+
inline-size: calc(var(--_indent) - 0.5rem);
|
|
118
187
|
border-inline-start: 1px solid var(--color-bg-surface-muted);
|
|
119
188
|
border-block-end: 1px solid var(--color-bg-surface-muted);
|
|
120
189
|
}
|
|
@@ -123,4 +192,45 @@
|
|
|
123
192
|
&.tree--lines > .tree__item::before {
|
|
124
193
|
display: none;
|
|
125
194
|
}
|
|
195
|
+
|
|
196
|
+
/* A node's own prose. `.tree__label` is `nowrap` + ellipsis for file-tree-style
|
|
197
|
+
single-line names, so a description can't live in it — it sits below the
|
|
198
|
+
summary row and wraps. Indented to the label, past the toggle. */
|
|
199
|
+
.tree__desc {
|
|
200
|
+
margin-block: 0.125rem 0.25rem;
|
|
201
|
+
margin-inline-start: var(--_leaf-indent);
|
|
202
|
+
color: var(--color-text-surface-muted);
|
|
203
|
+
text-wrap: pretty;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* ── Tree toolbar — generated by <wc-tree>, never authored ─────────────────── */
|
|
208
|
+
/*
|
|
209
|
+
* These controls only exist once the element upgrades, so they are styled but
|
|
210
|
+
* never present in a no-JS render. Kept out of the `.tree` block because the
|
|
211
|
+
* toolbar is a SIBLING of the tree, not a node in it — nesting it there would
|
|
212
|
+
* inherit `.tree`'s padding and the `.tree__item` positioning context.
|
|
213
|
+
*/
|
|
214
|
+
.tree__toolbar {
|
|
215
|
+
align-items: center;
|
|
216
|
+
margin-block-end: var(--p-tree, var(--p-tree-group, var(--p-default)));
|
|
217
|
+
|
|
218
|
+
/* The filter is wrapped in `.input-group` so forms.css styles it; the group is
|
|
219
|
+
what flexes, and the input fills it. */
|
|
220
|
+
.tree__filter-group {
|
|
221
|
+
flex: 1 1 12rem;
|
|
222
|
+
min-inline-size: 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.tree__filter {
|
|
226
|
+
inline-size: 100%;
|
|
227
|
+
min-inline-size: 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.tree__count {
|
|
231
|
+
color: var(--color-text-surface-muted);
|
|
232
|
+
/* Hold the row height whether or not a count is showing, so typing into the
|
|
233
|
+
filter doesn't reflow the tree by a line. */
|
|
234
|
+
min-inline-size: 6ch;
|
|
235
|
+
}
|
|
126
236
|
}
|
package/assets/js/consent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[`necessary`,`analytics`,`marketing`,`preferences`],t=`vitops_consent`,
|
|
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),R())}function T(){for(let[e,t]of C)if(d(v,e)){C.delete(e);for(let n of t)n(u(v,e))}}const E={idle:[],async:[],interaction:[]},D={idle:!1,async:!0,interaction:!1};function O(e){if(D[e])return;D[e]=!0;let t=E[e];E[e]=[];for(let e of t)e()}function k(e,t){D[e]?t():E[e].push(t)}function A(e){document.readyState===`complete`?e():addEventListener(`load`,e,{once:!0})}A(()=>{let e=globalThis.requestIdleCallback;e?e(()=>O(`idle`),{timeout:3e3}):setTimeout(()=>O(`idle`),1)});{let e=[`pointerdown`,`keydown`,`scroll`,`touchstart`],t=()=>{for(let n of e)removeEventListener(n,t);O(`interaction`)};for(let n of e)addEventListener(n,t,{once:!0,passive:!0});A(()=>setTimeout(()=>O(`interaction`),8e3))}const j=new Set([`type`,`src`,`data-vitops-tag`,`data-src`,`data-strategy`,`data-consent`,`data-consent-src`,`data-consent-cookies`]);function M(t){let n=t.getAttribute(`data-consent`);return e.includes(n??``)?n:`analytics`}function N(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))j.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 P(e){if(!b.has(e)){if(b.add(e),x.add(M(e)),e instanceof HTMLScriptElement)N(e);else{let t=e.getAttribute(`data-consent-src`);t&&e.setAttribute(`src`,t)}e.setAttribute(`data-vitops-activated`,``)}}function F(){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`);k(e===`async`||e===`interaction`?e:`idle`,()=>{let e=M(t);u(v,e)?P(t):w(e)})}}function I(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 L(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`,R(),F(),n.length&&(I(n),n.some(e=>x.has(e)&&u(i,e))&&z.reloadOnRevoke&&location.reload())}function R(){T();for(let e of y)e(v);document.dispatchEvent(new CustomEvent(t,{detail:v}))}const z={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 w(e),u(v,e)},request(e){return w(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=>L(m(v,e,Date.now()),!0),acceptAll:()=>L(p(!0,Date.now()),!0),rejectAll:()=>L(p(!1,Date.now()),!0),reset:()=>L(o(),!1),open:()=>document.dispatchEvent(new CustomEvent(n)),subscribe(e){return y.add(e),e(v),()=>void y.delete(e)}},B=window.vitopsConsent?.q;if(window.vitopsConsent=z,B)for(let[e,t]of B)t?z.request(e).then(t):z.require(e);document.addEventListener(`click`,e=>{e.target?.closest?.(`[data-consent-open]`)&&(e.preventDefault(),z.open())}),document.addEventListener(`astro:page-load`,F),F(),R();var V=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`,V);export{e as CATEGORIES,t as CONSENT_EVENT,n as CONSENT_OPEN_EVENT,r as COOKIE_NAME,z as consent};
|