@atomic-ui/blocks 0.14.0 → 0.15.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/README.md +15 -15
- package/custom-elements.json +2978 -9654
- package/dist/chunk-GQ2I44OU.js +226 -0
- package/dist/chunk-GQ2I44OU.js.map +1 -0
- package/dist/chunk-HISF6RYK.js +199 -0
- package/dist/chunk-HISF6RYK.js.map +1 -0
- package/dist/{chunk-Q366ZM2X.js → chunk-LJGOTYDJ.js} +17 -41
- package/dist/chunk-LJGOTYDJ.js.map +1 -0
- package/dist/{chunk-BW5ZMKES.js → chunk-OBBPBN4S.js} +17 -144
- package/dist/chunk-OBBPBN4S.js.map +1 -0
- package/dist/chunk-OHXEZPBB.js +109 -0
- package/dist/chunk-OHXEZPBB.js.map +1 -0
- package/dist/{chunk-NZQZRBKV.js → chunk-VOONXP5H.js} +15 -57
- package/dist/chunk-VOONXP5H.js.map +1 -0
- package/dist/chunk-XSKGWT2D.js +84 -0
- package/dist/chunk-XSKGWT2D.js.map +1 -0
- package/dist/components/changelog.d.ts +0 -288
- package/dist/components/changelog.js +3 -12
- package/dist/components/g2-site.d.ts +27 -40
- package/dist/components/g2-site.js +1 -3
- package/dist/components/marketing.d.ts +0 -283
- package/dist/components/marketing.js +3 -13
- package/dist/components/organisms.d.ts +0 -489
- package/dist/components/organisms.js +3 -19
- package/dist/components/selling.d.ts +0 -255
- package/dist/components/selling.js +3 -15
- package/dist/components/site.d.ts +6 -52
- package/dist/components/site.js +3 -5
- package/dist/components/studio.d.ts +10 -95
- package/dist/components/studio.js +1 -3
- package/dist/index.d.ts +9 -13
- package/dist/index.js +23 -101
- package/dist/index.js.map +1 -1
- package/dist/standalone/atomic-ui-blocks.js +751 -1642
- package/dist/standalone/atomic-ui-blocks.js.map +4 -4
- package/dist/standalone/index.html +18 -26
- package/package.json +3 -3
- package/specimen/index.html +18 -26
- package/dist/chunk-BW5ZMKES.js.map +0 -1
- package/dist/chunk-GZTBAT6P.js +0 -574
- package/dist/chunk-GZTBAT6P.js.map +0 -1
- package/dist/chunk-NHWD2LUR.js +0 -255
- package/dist/chunk-NHWD2LUR.js.map +0 -1
- package/dist/chunk-NZQZRBKV.js.map +0 -1
- package/dist/chunk-Q366ZM2X.js.map +0 -1
- package/dist/chunk-R7SSIE2E.js +0 -362
- package/dist/chunk-R7SSIE2E.js.map +0 -1
- package/dist/chunk-XB6FD4SF.js +0 -438
- package/dist/chunk-XB6FD4SF.js.map +0 -1
- package/dist/chunk-YXMXLVK7.js +0 -230
- package/dist/chunk-YXMXLVK7.js.map +0 -1
- package/dist/chunk-ZD75GU6J.js +0 -75
- package/dist/chunk-ZD75GU6J.js.map +0 -1
- package/dist/chunk-ZM2HLQOG.js +0 -783
- package/dist/chunk-ZM2HLQOG.js.map +0 -1
- package/dist/chunk-ZODL5HD4.js +0 -535
- package/dist/chunk-ZODL5HD4.js.map +0 -1
- package/dist/components/card-grid.d.ts +0 -72
- package/dist/components/card-grid.js +0 -7
- package/dist/components/card-grid.js.map +0 -1
- package/dist/components/property.d.ts +0 -389
- package/dist/components/property.js +0 -17
- package/dist/components/property.js.map +0 -1
- package/dist/components/scene.d.ts +0 -138
- package/dist/components/scene.js +0 -7
- package/dist/components/scene.js.map +0 -1
- package/dist/components/scrubber.d.ts +0 -86
- package/dist/components/scrubber.js +0 -7
- package/dist/components/scrubber.js.map +0 -1
package/dist/chunk-YXMXLVK7.js
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
// packages/blocks/src/components/scrubber.ts
|
|
2
|
-
import { html, css } from "lit";
|
|
3
|
-
import { say, ImpaktElement, visuallyHidden, fontSize, fontWeight, space, t, token } from "@atomic-ui/ui";
|
|
4
|
-
var TONES = {
|
|
5
|
-
brand: "var(--impakt-color-brand-default, #1f4ed8)",
|
|
6
|
-
accent: "var(--impakt-color-accent-default, #c8a15a)",
|
|
7
|
-
info: "var(--impakt-color-status-info-default, #1f4ed8)",
|
|
8
|
-
success: "var(--impakt-color-status-success-default, #047857)",
|
|
9
|
-
warning: "var(--impakt-color-status-warning-default, #b45309)",
|
|
10
|
-
danger: "var(--impakt-color-status-danger-default, #c8102e)"
|
|
11
|
-
};
|
|
12
|
-
var ImpaktScrubber = class extends ImpaktElement {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this.scene = null;
|
|
16
|
-
this.onProgress = (e) => {
|
|
17
|
-
this.value = e.detail.progress;
|
|
18
|
-
};
|
|
19
|
-
this.onInput = (e) => {
|
|
20
|
-
const v = Number(e.target.value) / 1e3;
|
|
21
|
-
this.value = v;
|
|
22
|
-
this.scene?.seek(v);
|
|
23
|
-
};
|
|
24
|
-
this.label = "Scene progress";
|
|
25
|
-
this.stops = [];
|
|
26
|
-
this.look = "buttons";
|
|
27
|
-
this.hint = "";
|
|
28
|
-
this.value = 0;
|
|
29
|
-
}
|
|
30
|
-
static {
|
|
31
|
-
this.properties = {
|
|
32
|
-
label: { type: String },
|
|
33
|
-
stops: { type: Array },
|
|
34
|
-
look: { type: String, reflect: true },
|
|
35
|
-
hint: { type: String },
|
|
36
|
-
value: { type: Number, state: true }
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
static {
|
|
40
|
-
this.styles = [
|
|
41
|
-
...ImpaktElement.styles,
|
|
42
|
-
css`
|
|
43
|
-
:host {
|
|
44
|
-
display: block;
|
|
45
|
-
width: 100%;
|
|
46
|
-
max-width: 48rem;
|
|
47
|
-
margin-inline: auto;
|
|
48
|
-
}
|
|
49
|
-
.wrap {
|
|
50
|
-
display: grid;
|
|
51
|
-
gap: ${space(2)};
|
|
52
|
-
padding: ${space(3)} ${space(4)};
|
|
53
|
-
border-radius: ${token("radius.xl", "16px")};
|
|
54
|
-
background: ${t.surfaceCard};
|
|
55
|
-
box-shadow: ${token("shadow.lg", "0 10px 15px -3px rgba(0,0,0,.1)")};
|
|
56
|
-
border: 1px solid ${t.border};
|
|
57
|
-
}
|
|
58
|
-
input {
|
|
59
|
-
width: 100%;
|
|
60
|
-
min-height: ${token("target.min", "24px")};
|
|
61
|
-
accent-color: ${t.brand};
|
|
62
|
-
margin: 0;
|
|
63
|
-
}
|
|
64
|
-
.stops {
|
|
65
|
-
position: relative;
|
|
66
|
-
display: flex;
|
|
67
|
-
flex-wrap: wrap;
|
|
68
|
-
gap: ${space(2)};
|
|
69
|
-
list-style: none;
|
|
70
|
-
margin: 0;
|
|
71
|
-
padding: 0;
|
|
72
|
-
}
|
|
73
|
-
button {
|
|
74
|
-
min-height: ${token("target.min", "24px")};
|
|
75
|
-
padding: ${space(1)} ${space(3)};
|
|
76
|
-
border-radius: var(--impakt-radius-pill, calc(var(--impakt-radius-md, 0.5rem) * 9999));
|
|
77
|
-
border: 1px solid ${t.border};
|
|
78
|
-
background: transparent;
|
|
79
|
-
color: ${t.textMuted};
|
|
80
|
-
font-size: ${fontSize("xs")};
|
|
81
|
-
font-weight: ${fontWeight("medium")};
|
|
82
|
-
cursor: pointer;
|
|
83
|
-
}
|
|
84
|
-
button[aria-current='true'] {
|
|
85
|
-
color: ${t.text};
|
|
86
|
-
border-color: ${t.text};
|
|
87
|
-
}
|
|
88
|
-
.sr-only {
|
|
89
|
-
${visuallyHidden}
|
|
90
|
-
}
|
|
91
|
-
/* The graph look: the code of where you are, the line of stops, where you are. */
|
|
92
|
-
:host([look='graph']) { max-width: none; }
|
|
93
|
-
.graph { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr) auto; gap: ${space(6)}; align-items: center; padding: ${space(4)} ${space(6)}; border-radius: ${token("radius.xl", "16px")}; background: ${t.surfaceCard}; box-shadow: ${token("shadow.lg", "0 10px 15px -3px rgba(0,0,0,.1)")}; border: 1px solid ${t.border}; }
|
|
94
|
-
.mono { font-family: ${t.fontMono}; font-size: ${fontSize("xs")}; letter-spacing: 0.04em; }
|
|
95
|
-
.head { display: grid; gap: 2px; }
|
|
96
|
-
.head .k { color: ${t.textMuted}; text-transform: uppercase; }
|
|
97
|
-
.head .code { font-size: ${fontSize("md")}; color: ${t.text}; }
|
|
98
|
-
.head .note { color: ${t.textMuted}; }
|
|
99
|
-
.line { position: relative; block-size: 48px; }
|
|
100
|
-
.track, .fill { position: absolute; inset-inline: 0; inset-block-start: 14px; block-size: 3px; border-radius: 3px; background: ${t.border}; opacity: 0.5; }
|
|
101
|
-
.fill { opacity: 1; background: none; display: flex; overflow: hidden; }
|
|
102
|
-
.fill span { block-size: 100%; }
|
|
103
|
-
.dot { position: absolute; inset-block-start: 15px; inline-size: 14px; block-size: 14px; translate: -50% -50%; border-radius: 50%; border: 2px solid var(--c); background: ${t.surfaceCard}; padding: 0; min-height: 0; cursor: pointer; }
|
|
104
|
-
.dot[data-passed] { background: var(--c); }
|
|
105
|
-
.dot[aria-current='true'] { inline-size: 24px; block-size: 24px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
|
|
106
|
-
.dot-label { position: absolute; inset-block-start: 30px; translate: -50% 0; white-space: nowrap; color: ${t.textMuted}; text-transform: uppercase; pointer-events: none; }
|
|
107
|
-
.dot-label[data-current] { color: ${t.text}; font-weight: ${fontWeight("bold")}; }
|
|
108
|
-
.line input { position: absolute; inset: 0 0 auto; block-size: 30px; opacity: 0; cursor: grab; }
|
|
109
|
-
.line input:focus-visible { opacity: 1; }
|
|
110
|
-
.where { display: grid; gap: ${space(2)}; justify-items: end; }
|
|
111
|
-
.chip { display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(1)} ${space(3)}; border-radius: var(--impakt-radius-pill, calc(var(--impakt-radius-md, 0.5rem) * 9999)); border: 1px solid ${t.border}; color: ${t.text}; text-transform: uppercase; }
|
|
112
|
-
.chip::before { content: ''; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--c); }
|
|
113
|
-
.hint { color: ${t.textMuted}; text-transform: uppercase; }
|
|
114
|
-
/* Muted by colour, not opacity, so the code keeps its contrast (1.4.3). */
|
|
115
|
-
.chip .meta { color: ${t.textMuted}; }
|
|
116
|
-
@media (max-width: 48rem) {
|
|
117
|
-
.graph { grid-template-columns: minmax(0, 1fr); }
|
|
118
|
-
.where { justify-items: start; }
|
|
119
|
-
.dot-label:not([data-current]) { display: none; }
|
|
120
|
-
}
|
|
121
|
-
button:focus-visible,
|
|
122
|
-
input:focus-visible {
|
|
123
|
-
outline: none;
|
|
124
|
-
box-shadow: ${token("focus.ring.shadow", "0 0 0 2px #fff, 0 0 0 4px #1a1a1a")};
|
|
125
|
-
}
|
|
126
|
-
`
|
|
127
|
-
];
|
|
128
|
-
}
|
|
129
|
-
/** @ignore */
|
|
130
|
-
connectedCallback() {
|
|
131
|
-
super.connectedCallback();
|
|
132
|
-
this.scene = this.closest("impakt-scene");
|
|
133
|
-
this.scene?.addEventListener("impakt-scene-progress", this.onProgress);
|
|
134
|
-
if (this.scene) this.value = this.scene.progress;
|
|
135
|
-
}
|
|
136
|
-
/** @ignore */
|
|
137
|
-
disconnectedCallback() {
|
|
138
|
-
super.disconnectedCallback();
|
|
139
|
-
this.scene?.removeEventListener("impakt-scene-progress", this.onProgress);
|
|
140
|
-
this.scene = null;
|
|
141
|
-
}
|
|
142
|
-
goTo(stop) {
|
|
143
|
-
this.scene?.seek(stop.at, 600);
|
|
144
|
-
}
|
|
145
|
-
/** The stop nearest the current position, which the stop list marks as current. */
|
|
146
|
-
nearest() {
|
|
147
|
-
let best = -1;
|
|
148
|
-
let gap = Infinity;
|
|
149
|
-
this.stops.forEach((s, i) => {
|
|
150
|
-
const d = Math.abs(s.at - this.value);
|
|
151
|
-
if (d < gap) {
|
|
152
|
-
gap = d;
|
|
153
|
-
best = i;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
return best;
|
|
157
|
-
}
|
|
158
|
-
renderGraph(nearestIndex, valueText) {
|
|
159
|
-
let current = nearestIndex;
|
|
160
|
-
const stops = [...this.stops ?? []].sort((a, b) => a.at - b.at);
|
|
161
|
-
current = stops.indexOf(this.stops[current]);
|
|
162
|
-
const colour = (s) => {
|
|
163
|
-
const tone = s?.tone ?? "brand";
|
|
164
|
-
return typeof tone === "number" ? `var(--impakt-color-chart-${tone}, ${TONES.brand})` : TONES[tone] ?? TONES.brand;
|
|
165
|
-
};
|
|
166
|
-
const now = stops[current] ?? stops[0];
|
|
167
|
-
const segments = stops.map((s, i) => {
|
|
168
|
-
const from = i === 0 ? 0 : stops[i - 1].at;
|
|
169
|
-
const to = Math.min(s.at, this.value);
|
|
170
|
-
return { width: Math.round(Math.max(0, to - from) * 1e4) / 100, c: colour(s) };
|
|
171
|
-
});
|
|
172
|
-
return html`<div class="graph" part="wrap">
|
|
173
|
-
<div class="head mono" aria-hidden="true">
|
|
174
|
-
<span class="k">HEAD</span>
|
|
175
|
-
<span class="code">${now?.meta ?? now?.label ?? ""}</span>
|
|
176
|
-
${now?.note ? html`<span class="note">${now.note}</span>` : null}
|
|
177
|
-
</div>
|
|
178
|
-
<div class="line">
|
|
179
|
-
<div class="track"></div>
|
|
180
|
-
<div class="fill" aria-hidden="true">${segments.map((g) => html`<span style=${`width:${g.width}%;background:${g.c}`}></span>`)}</div>
|
|
181
|
-
${stops.map(
|
|
182
|
-
(s, i) => html`
|
|
183
|
-
<button type="button" class="dot" style=${`left:${s.at * 100}%;--c:${colour(s)}`} ?data-passed=${s.at <= this.value + 1e-4} aria-current=${i === current ? "true" : "false"} @click=${() => this.goTo(s)}>
|
|
184
|
-
<span class="sr-only">${say("Go to {name}", { name: s.label })}</span>
|
|
185
|
-
</button>
|
|
186
|
-
<span class="dot-label mono" style=${`left:${s.at * 100}%`} ?data-current=${i === current} aria-hidden="true">${s.label}</span>`
|
|
187
|
-
)}
|
|
188
|
-
<input type="range" min="0" max="1000" step="1" .value=${String(Math.round(this.value * 1e3))} aria-label=${this.label} aria-valuetext=${valueText} @input=${this.onInput} />
|
|
189
|
-
</div>
|
|
190
|
-
<div class="where" aria-hidden="true">
|
|
191
|
-
${now ? html`<span class="chip mono" style=${`--c:${colour(now)}`}>${now.label}${now.meta ? html` <span class="meta">${now.meta}</span>` : null}</span>` : null}
|
|
192
|
-
${this.hint ? html`<span class="hint mono">${this.hint}</span>` : null}
|
|
193
|
-
</div>
|
|
194
|
-
</div>`;
|
|
195
|
-
}
|
|
196
|
-
render() {
|
|
197
|
-
const current = this.nearest();
|
|
198
|
-
const valueText = current >= 0 ? this.stops[current].label : `${Math.round(this.value * 100)}%`;
|
|
199
|
-
if (this.look === "graph") return this.renderGraph(current, valueText);
|
|
200
|
-
return html`
|
|
201
|
-
<div class="wrap" part="wrap">
|
|
202
|
-
<input
|
|
203
|
-
type="range"
|
|
204
|
-
min="0"
|
|
205
|
-
max="1000"
|
|
206
|
-
step="1"
|
|
207
|
-
.value=${String(Math.round(this.value * 1e3))}
|
|
208
|
-
aria-label=${this.label}
|
|
209
|
-
aria-valuetext=${valueText}
|
|
210
|
-
@input=${this.onInput}
|
|
211
|
-
/>
|
|
212
|
-
${this.stops.length ? html`<ul class="stops" part="stops">
|
|
213
|
-
${this.stops.map(
|
|
214
|
-
(s, i) => html`<li>
|
|
215
|
-
<button type="button" aria-current=${i === current ? "true" : "false"} @click=${() => this.goTo(s)}>
|
|
216
|
-
<span aria-hidden="true">${s.label}</span><span class="sr-only">${say("Go to {name}", { name: s.label })}</span>
|
|
217
|
-
</button>
|
|
218
|
-
</li>`
|
|
219
|
-
)}
|
|
220
|
-
</ul>` : null}
|
|
221
|
-
</div>
|
|
222
|
-
`;
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
customElements.define("impakt-scrubber", ImpaktScrubber);
|
|
226
|
-
|
|
227
|
-
export {
|
|
228
|
-
ImpaktScrubber
|
|
229
|
-
};
|
|
230
|
-
//# sourceMappingURL=chunk-YXMXLVK7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/scrubber.ts"],"sourcesContent":["import { html, css, type TemplateResult } from 'lit';\nimport { say, ImpaktElement, visuallyHidden, fontSize, fontWeight, space, t, token } from '@atomic-ui/ui';\nimport type { ImpaktScene } from './scene';\n\nexport interface ScrubberStop {\n /** Where the stop sits on the scene's progress, from 0 to 1. */\n at: number;\n label: string;\n /** A short code beside it in the graph look, such as a commit hash. */\n meta?: string;\n /** A line under the code in the graph look, such as a commit message. */\n note?: string;\n /**\n * The colour of the line up to this stop, in the graph look: a named tone,\n * or 1 to 5 for the brand's chart colours, as a project's phases are drawn.\n */\n tone?: 'brand' | 'accent' | 'info' | 'success' | 'warning' | 'danger' | 1 | 2 | 3 | 4 | 5;\n}\n\nconst TONES = {\n brand: 'var(--impakt-color-brand-default, #1f4ed8)',\n accent: 'var(--impakt-color-accent-default, #c8a15a)',\n info: 'var(--impakt-color-status-info-default, #1f4ed8)',\n success: 'var(--impakt-color-status-success-default, #047857)',\n warning: 'var(--impakt-color-status-warning-default, #b45309)',\n danger: 'var(--impakt-color-status-danger-default, #c8102e)',\n} as const;\n\n/**\n * Drives the scene it sits in, by hand.\n *\n * Place it in an `impakt-scene`'s `controls` slot and set that scene's `drive`\n * to `scrubber`. Dragging moves through the scene; a named stop seeks to it\n * with an eased move rather than a cut, which is what makes the Commit-style\n * \"time travel\" read as travel.\n *\n * **It is a native range input.** A slider built from divs has to recreate\n * arrow keys, Page Up and Down, Home and End, the value announcement and touch\n * handling, and every one of those is a place to get it wrong. The input\n * already does all of it. The stops are buttons beside it, so a keyboard or\n * switch user reaches each named moment in one action instead of nudging a\n * thumb to find it (2.5.7, dragging movements).\n *\n * @category action\n * @icon adjustments-horizontal\n */\nexport class ImpaktScrubber extends ImpaktElement {\n static properties = {\n label: { type: String },\n stops: { type: Array },\n look: { type: String, reflect: true },\n hint: { type: String },\n value: { type: Number, state: true },\n };\n\n /** The slider's accessible name. */\n declare label: string;\n declare stops: ScrubberStop[];\n /**\n * `buttons` lists the stops as buttons under the slider. `graph` draws them\n * as commits on a line that fills in each stop's colour as it is dragged,\n * with the current one's code and note beside it.\n */\n declare look: 'buttons' | 'graph';\n /** A word of help in the graph look, such as \"drag to time-travel\". */\n declare hint: string;\n declare value: number;\n\n private scene: ImpaktScene | null = null;\n\n constructor() {\n super();\n this.label = 'Scene progress';\n this.stops = [];\n this.look = 'buttons';\n this.hint = '';\n this.value = 0;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host {\n display: block;\n width: 100%;\n max-width: 48rem;\n margin-inline: auto;\n }\n .wrap {\n display: grid;\n gap: ${space(2)};\n padding: ${space(3)} ${space(4)};\n border-radius: ${token('radius.xl', '16px')};\n background: ${t.surfaceCard};\n box-shadow: ${token('shadow.lg', '0 10px 15px -3px rgba(0,0,0,.1)')};\n border: 1px solid ${t.border};\n }\n input {\n width: 100%;\n min-height: ${token('target.min', '24px')};\n accent-color: ${t.brand};\n margin: 0;\n }\n .stops {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n gap: ${space(2)};\n list-style: none;\n margin: 0;\n padding: 0;\n }\n button {\n min-height: ${token('target.min', '24px')};\n padding: ${space(1)} ${space(3)};\n border-radius: var(--impakt-radius-pill, calc(var(--impakt-radius-md, 0.5rem) * 9999));\n border: 1px solid ${t.border};\n background: transparent;\n color: ${t.textMuted};\n font-size: ${fontSize('xs')};\n font-weight: ${fontWeight('medium')};\n cursor: pointer;\n }\n button[aria-current='true'] {\n color: ${t.text};\n border-color: ${t.text};\n }\n .sr-only {\n ${visuallyHidden}\n }\n /* The graph look: the code of where you are, the line of stops, where you are. */\n :host([look='graph']) { max-width: none; }\n .graph { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr) auto; gap: ${space(6)}; align-items: center; padding: ${space(4)} ${space(6)}; border-radius: ${token('radius.xl', '16px')}; background: ${t.surfaceCard}; box-shadow: ${token('shadow.lg', '0 10px 15px -3px rgba(0,0,0,.1)')}; border: 1px solid ${t.border}; }\n .mono { font-family: ${t.fontMono}; font-size: ${fontSize('xs')}; letter-spacing: 0.04em; }\n .head { display: grid; gap: 2px; }\n .head .k { color: ${t.textMuted}; text-transform: uppercase; }\n .head .code { font-size: ${fontSize('md')}; color: ${t.text}; }\n .head .note { color: ${t.textMuted}; }\n .line { position: relative; block-size: 48px; }\n .track, .fill { position: absolute; inset-inline: 0; inset-block-start: 14px; block-size: 3px; border-radius: 3px; background: ${t.border}; opacity: 0.5; }\n .fill { opacity: 1; background: none; display: flex; overflow: hidden; }\n .fill span { block-size: 100%; }\n .dot { position: absolute; inset-block-start: 15px; inline-size: 14px; block-size: 14px; translate: -50% -50%; border-radius: 50%; border: 2px solid var(--c); background: ${t.surfaceCard}; padding: 0; min-height: 0; cursor: pointer; }\n .dot[data-passed] { background: var(--c); }\n .dot[aria-current='true'] { inline-size: 24px; block-size: 24px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }\n .dot-label { position: absolute; inset-block-start: 30px; translate: -50% 0; white-space: nowrap; color: ${t.textMuted}; text-transform: uppercase; pointer-events: none; }\n .dot-label[data-current] { color: ${t.text}; font-weight: ${fontWeight('bold')}; }\n .line input { position: absolute; inset: 0 0 auto; block-size: 30px; opacity: 0; cursor: grab; }\n .line input:focus-visible { opacity: 1; }\n .where { display: grid; gap: ${space(2)}; justify-items: end; }\n .chip { display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(1)} ${space(3)}; border-radius: var(--impakt-radius-pill, calc(var(--impakt-radius-md, 0.5rem) * 9999)); border: 1px solid ${t.border}; color: ${t.text}; text-transform: uppercase; }\n .chip::before { content: ''; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--c); }\n .hint { color: ${t.textMuted}; text-transform: uppercase; }\n /* Muted by colour, not opacity, so the code keeps its contrast (1.4.3). */\n .chip .meta { color: ${t.textMuted}; }\n @media (max-width: 48rem) {\n .graph { grid-template-columns: minmax(0, 1fr); }\n .where { justify-items: start; }\n .dot-label:not([data-current]) { display: none; }\n }\n button:focus-visible,\n input:focus-visible {\n outline: none;\n box-shadow: ${token('focus.ring.shadow', '0 0 0 2px #fff, 0 0 0 4px #1a1a1a')};\n }\n `,\n ];\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n this.scene = this.closest('impakt-scene');\n this.scene?.addEventListener('impakt-scene-progress', this.onProgress);\n if (this.scene) this.value = this.scene.progress;\n }\n\n /** @ignore */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.scene?.removeEventListener('impakt-scene-progress', this.onProgress);\n this.scene = null;\n }\n\n private onProgress = (e: Event) => {\n this.value = (e as CustomEvent<{ progress: number }>).detail.progress;\n };\n\n private onInput = (e: Event) => {\n const v = Number((e.target as HTMLInputElement).value) / 1000;\n this.value = v;\n this.scene?.seek(v);\n };\n\n private goTo(stop: ScrubberStop) {\n this.scene?.seek(stop.at, 600);\n }\n\n /** The stop nearest the current position, which the stop list marks as current. */\n private nearest(): number {\n let best = -1;\n let gap = Infinity;\n this.stops.forEach((s, i) => {\n const d = Math.abs(s.at - this.value);\n if (d < gap) {\n gap = d;\n best = i;\n }\n });\n return best;\n }\n\n private renderGraph(nearestIndex: number, valueText: string): TemplateResult {\n let current = nearestIndex;\n const stops = [...(this.stops ?? [])].sort((a, b) => a.at - b.at);\n // Where you are, among the stops in the order they are drawn.\n current = stops.indexOf(this.stops[current]!);\n const colour = (s: ScrubberStop | undefined) => {\n const tone = s?.tone ?? 'brand';\n return typeof tone === 'number' ? `var(--impakt-color-chart-${tone}, ${TONES.brand})` : (TONES[tone] ?? TONES.brand);\n };\n const now = stops[current] ?? stops[0];\n // The line fills in each stop's colour, from the stop before it to it, as far as the playhead.\n const segments = stops.map((s, i) => {\n const from = i === 0 ? 0 : stops[i - 1]!.at;\n const to = Math.min(s.at, this.value);\n return { width: Math.round(Math.max(0, to - from) * 10000) / 100, c: colour(s) };\n });\n return html`<div class=\"graph\" part=\"wrap\">\n <div class=\"head mono\" aria-hidden=\"true\">\n <span class=\"k\">HEAD</span>\n <span class=\"code\">${now?.meta ?? now?.label ?? ''}</span>\n ${now?.note ? html`<span class=\"note\">${now.note}</span>` : null}\n </div>\n <div class=\"line\">\n <div class=\"track\"></div>\n <div class=\"fill\" aria-hidden=\"true\">${segments.map((g) => html`<span style=${`width:${g.width}%;background:${g.c}`}></span>`)}</div>\n ${stops.map(\n (s, i) => html`\n <button type=\"button\" class=\"dot\" style=${`left:${s.at * 100}%;--c:${colour(s)}`} ?data-passed=${s.at <= this.value + 0.0001} aria-current=${i === current ? 'true' : 'false'} @click=${() => this.goTo(s)}>\n <span class=\"sr-only\">${say('Go to {name}', { name: s.label })}</span>\n </button>\n <span class=\"dot-label mono\" style=${`left:${s.at * 100}%`} ?data-current=${i === current} aria-hidden=\"true\">${s.label}</span>`,\n )}\n <input type=\"range\" min=\"0\" max=\"1000\" step=\"1\" .value=${String(Math.round(this.value * 1000))} aria-label=${this.label} aria-valuetext=${valueText} @input=${this.onInput} />\n </div>\n <div class=\"where\" aria-hidden=\"true\">\n ${now ? html`<span class=\"chip mono\" style=${`--c:${colour(now)}`}>${now.label}${now.meta ? html` <span class=\"meta\">${now.meta}</span>` : null}</span>` : null}\n ${this.hint ? html`<span class=\"hint mono\">${this.hint}</span>` : null}\n </div>\n </div>`;\n }\n\n render(): TemplateResult {\n const current = this.nearest();\n const valueText = current >= 0 ? this.stops[current].label : `${Math.round(this.value * 100)}%`;\n if (this.look === 'graph') return this.renderGraph(current, valueText);\n return html`\n <div class=\"wrap\" part=\"wrap\">\n <input\n type=\"range\"\n min=\"0\"\n max=\"1000\"\n step=\"1\"\n .value=${String(Math.round(this.value * 1000))}\n aria-label=${this.label}\n aria-valuetext=${valueText}\n @input=${this.onInput}\n />\n ${\n this.stops.length\n ? html`<ul class=\"stops\" part=\"stops\">\n ${this.stops.map(\n (s, i) => html`<li>\n <button type=\"button\" aria-current=${i === current ? 'true' : 'false'} @click=${() => this.goTo(s)}>\n <span aria-hidden=\"true\">${s.label}</span><span class=\"sr-only\">${say('Go to {name}', { name: s.label })}</span>\n </button>\n </li>`,\n )}\n </ul>`\n : null\n }\n </div>\n `;\n }\n}\n\ncustomElements.define('impakt-scrubber', ImpaktScrubber);\n\ndeclare global {\n interface HTMLEl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I,YAAY,IAAI;AAAA,UAClK,KAAK,OAAO,+BAA+B,KAAK,IAAI,YAAY,IAAI;AAAA;AAAA;AAAA,EAG5E;AAAA,EAEA,SAAyB;AACvB,UAAM,UAAU,KAAK,QAAQ;AAC7B,UAAM,YAAY,WAAW,IAAI,KAAK,MAAM,OAAO,EAAE,QAAQ,GAAG,KAAK,MAAM,KAAK,QAAQ,GAAG,CAAC;AAC5F,QAAI,KAAK,SAAS,QAAS,QAAO,KAAK,YAAY,SAAS,SAAS;AACrE,WAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAOQ,OAAO,KAAK,MAAM,KAAK,QAAQ,GAAI,CAAC,CAAC;AAAA,uBACjC,KAAK,KAAK;AAAA,2BACN,SAAS;AAAA,mBACjB,KAAK,OAAO;AAAA;AAAA,UAGrB,KAAK,MAAM,SACP;AAAA,gBACE,KAAK,MAAM;AAAA,MACX,CAAC,GAAG,MAAM;AAAA,uDAC6B,MAAM,UAAU,SAAS,OAAO,WAAW,MAAM,KAAK,KAAK,CAAC,CAAC;AAAA,+CACrE,EAAE,KAAK,gCAAgC,IAAI,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,IAG9G,CAAC;AAAA,qBAED,IACN;AAAA;AAAA;AAAA,EAGN;AACF;AAEA,eAAe,OAAO,mBAAmB,cAAc;","names":[]}
|
package/dist/chunk-ZD75GU6J.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// packages/blocks/src/components/card-grid.ts
|
|
2
|
-
import { css, html, nothing } from "lit";
|
|
3
|
-
import { ImpaktElement, focusRing, fontSize, fontWeight, lineHeight, space, spaceAround, t, iconSvg } from "@atomic-ui/ui";
|
|
4
|
-
var ImpaktCardGrid = class extends ImpaktElement {
|
|
5
|
-
static {
|
|
6
|
-
this.properties = {
|
|
7
|
-
items: { type: Array },
|
|
8
|
-
columns: { type: String, reflect: true },
|
|
9
|
-
headingLevel: { type: Number, attribute: "heading-level" },
|
|
10
|
-
ratio: { type: String, reflect: true },
|
|
11
|
-
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
12
|
-
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
17
|
-
this.items = [];
|
|
18
|
-
this.columns = "three";
|
|
19
|
-
this.headingLevel = 3;
|
|
20
|
-
this.ratio = "4:3";
|
|
21
|
-
this.spaceAbove = "none";
|
|
22
|
-
this.spaceBelow = "none";
|
|
23
|
-
}
|
|
24
|
-
static {
|
|
25
|
-
this.styles = [
|
|
26
|
-
...ImpaktElement.styles,
|
|
27
|
-
focusRing,
|
|
28
|
-
spaceAround,
|
|
29
|
-
css`
|
|
30
|
-
:host { display: block; container-type: inline-size; --ratio: 4 / 3; }
|
|
31
|
-
:host([ratio='16:9']) { --ratio: 16 / 9; }
|
|
32
|
-
:host([ratio='3:2']) { --ratio: 3 / 2; }
|
|
33
|
-
:host([ratio='1:1']) { --ratio: 1 / 1; }
|
|
34
|
-
ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(6)}; grid-template-columns: repeat(3, minmax(0, 1fr)); }
|
|
35
|
-
:host([columns='two']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
36
|
-
:host([columns='four']) ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
|
|
37
|
-
/* A card is drawn as impakt-card is: a 1px border in the text colour and no shadow. */
|
|
38
|
-
li { position: relative; display: flex; flex-direction: column; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radiusXl}; box-shadow: none; overflow: hidden; }
|
|
39
|
-
img { border-block-end: ${t.borderThin} solid ${t.text}; }
|
|
40
|
-
img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }
|
|
41
|
-
.words { display: flex; flex-direction: column; gap: ${space(2)}; padding: ${space(5)}; flex: 1; }
|
|
42
|
-
.h { margin: 0; color: ${t.textHeading}; font-family: ${t.fontHeading}; font-size: ${fontSize("lg")}; font-weight: ${fontWeight("bold")}; line-height: ${lineHeight("tight")}; }
|
|
43
|
-
.h a { color: inherit; text-decoration: none; border-radius: ${t.radiusSm}; }
|
|
44
|
-
.h a::after { content: ''; position: absolute; inset: 0; }
|
|
45
|
-
li.linked:hover .h a { text-decoration: underline; text-underline-offset: 0.2em; }
|
|
46
|
-
.body { margin: 0; line-height: ${lineHeight("normal")}; }
|
|
47
|
-
/* A marketing badge: monospace capitals at 11px in a 1px outline. */
|
|
48
|
-
.badge { align-self: flex-start; padding: 2px ${space(2)}; border-radius: ${t.radiusSm}; font-family: ${t.fontMono}; font-size: 0.6875rem; font-weight: ${fontWeight("medium")}; line-height: 1.4; letter-spacing: ${t.trackingWide}; text-transform: uppercase; color: ${t.text}; background: transparent; border: ${t.borderThin} solid ${t.text}; }
|
|
49
|
-
@media (forced-colors: active) { li, img, .badge { border-color: CanvasText; } }
|
|
50
|
-
.more { margin-block-start: auto; display: inline-flex; align-items: center; gap: ${space(1)}; color: ${t.link}; font-weight: ${fontWeight("semibold")}; }
|
|
51
|
-
@container (max-width: 48rem) { ul, :host([columns='four']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
52
|
-
@container (max-width: 32rem) { ul, :host([columns='two']) ul, :host([columns='four']) ul { grid-template-columns: minmax(0, 1fr); } }
|
|
53
|
-
`
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
render() {
|
|
57
|
-
return html`<ul part="list">${(this.items ?? []).map(
|
|
58
|
-
(card) => html`<li class=${card.href ? "linked" : ""} part="card">
|
|
59
|
-
${card.imageSrc ? html`<img src=${card.imageSrc} alt=${card.imageAlt ?? ""} loading="lazy" />` : nothing}
|
|
60
|
-
<div class="words">
|
|
61
|
-
${card.badge ? html`<span class="badge">${card.badge}</span>` : nothing}
|
|
62
|
-
<div class="h" role="heading" aria-level=${this.headingLevel}>${card.href ? html`<a href=${card.href}>${card.heading}</a>` : card.heading}</div>
|
|
63
|
-
${card.text ? html`<p class="body">${card.text}</p>` : nothing}
|
|
64
|
-
${card.href ? html`<span class="more" aria-hidden="true">${iconSvg("arrow-right", "1em")}</span>` : nothing}
|
|
65
|
-
</div>
|
|
66
|
-
</li>`
|
|
67
|
-
)}</ul>`;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
customElements.define("impakt-card-grid", ImpaktCardGrid);
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
ImpaktCardGrid
|
|
74
|
-
};
|
|
75
|
-
//# sourceMappingURL=chunk-ZD75GU6J.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/card-grid.ts"],"sourcesContent":["/**\n * A row of linked cards.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement, focusRing, fontSize, fontWeight, lineHeight, space, spaceAround, t, iconSvg } from '@atomic-ui/ui';\n\n/** One card in a row of them. */\nexport interface CardItem {\n id?: string;\n heading: string;\n text?: string;\n imageSrc?: string;\n imageAlt?: string;\n href?: string;\n badge?: string;\n}\n\n/**\n * A row of cards, each a picture, a heading, a line of text and a link: the\n * developments on a developments page, or the house types at one of them.\n *\n * **The whole card is the link's target, and the heading is its name.** The\n * link is on the heading, so a screen reader hears \"Larkfield Meadows, link\"\n * once rather than the whole card read out as one long link, and a pointer\n * can still press anywhere on the card.\n *\n * @category content\n * @icon cards\n */\nexport class ImpaktCardGrid extends ImpaktElement {\n static properties = {\n items: { type: Array },\n columns: { type: String, reflect: true },\n headingLevel: { type: Number, attribute: 'heading-level' },\n ratio: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare items: CardItem[];\n declare columns: 'two' | 'three' | 'four';\n /** The level of each card's heading. One below the heading above the cards. */\n declare headingLevel: 2 | 3 | 4;\n /** The shape of each card's picture. */\n declare ratio: '16:9' | '4:3' | '3:2' | '1:1';\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.items = [];\n this.columns = 'three';\n this.headingLevel = 3;\n this.ratio = '4:3';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n spaceAround,\n css`\n :host { display: block; container-type: inline-size; --ratio: 4 / 3; }\n :host([ratio='16:9']) { --ratio: 16 / 9; }\n :host([ratio='3:2']) { --ratio: 3 / 2; }\n :host([ratio='1:1']) { --ratio: 1 / 1; }\n ul { list-style: none; margin: 0; padding: 0; display: grid; gap: ${space(6)}; grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='two']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }\n :host([columns='four']) ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n /* A card is drawn as impakt-card is: a 1px border in the text colour and no shadow. */\n li { position: relative; display: flex; flex-direction: column; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radiusXl}; box-shadow: none; overflow: hidden; }\n img { border-block-end: ${t.borderThin} solid ${t.text}; }\n img { display: block; inline-size: 100%; aspect-ratio: var(--ratio); object-fit: cover; }\n .words { display: flex; flex-direction: column; gap: ${space(2)}; padding: ${space(5)}; flex: 1; }\n .h { margin: 0; color: ${t.textHeading}; font-family: ${t.fontHeading}; font-size: ${fontSize('lg')}; font-weight: ${fontWeight('bold')}; line-height: ${lineHeight('tight')}; }\n .h a { color: inherit; text-decoration: none; border-radius: ${t.radiusSm}; }\n .h a::after { content: ''; position: absolute; inset: 0; }\n li.linked:hover .h a { text-decoration: underline; text-underline-offset: 0.2em; }\n .body { margin: 0; line-height: ${lineHeight('normal')}; }\n /* A marketing badge: monospace capitals at 11px in a 1px outline. */\n .badge { align-self: flex-start; padding: 2px ${space(2)}; border-radius: ${t.radiusSm}; font-family: ${t.fontMono}; font-size: 0.6875rem; font-weight: ${fontWeight('medium')}; line-height: 1.4; letter-spacing: ${t.trackingWide}; text-transform: uppercase; color: ${t.text}; background: transparent; border: ${t.borderThin} solid ${t.text}; }\n @media (forced-colors: active) { li, img, .badge { border-color: CanvasText; } }\n .more { margin-block-start: auto; display: inline-flex; align-items: center; gap: ${space(1)}; color: ${t.link}; font-weight: ${fontWeight('semibold')}; }\n @container (max-width: 48rem) { ul, :host([columns='four']) ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }\n @container (max-width: 32rem) { ul, :host([columns='two']) ul, :host([columns='four']) ul { grid-template-columns: minmax(0, 1fr); } }\n `,\n ];\n\n render(): TemplateResult {\n return html`<ul part=\"list\">${(this.items ?? []).map(\n (card) => html`<li class=${card.href ? 'linked' : ''} part=\"card\">\n ${card.imageSrc ? html`<img src=${card.imageSrc} alt=${card.imageAlt ?? ''} loading=\"lazy\" />` : nothing}\n <div class=\"words\">\n ${card.badge ? html`<span class=\"badge\">${card.badge}</span>` : nothing}\n <div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${card.href ? html`<a href=${card.href}>${card.heading}</a>` : card.heading}</div>\n ${card.text ? html`<p class=\"body\">${card.text}</p>` : nothing}\n ${card.href ? html`<span class=\"more\" aria-hidden=\"true\">${iconSvg('arrow-right', '1em')}</span>` : nothing}\n </div>\n </li>`,\n )}</ul>`;\n }\n}\n\ncustomElements.define('impakt-card-grid', ImpaktCardGrid);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-card-grid': ImpaktCardGrid;\n }\n}\n"],"mappings":";AAGA,SAAS,KAAK,MAAM,eAAoC;AACxD,SAAS,eAAe,WAAW,UAAU,YAAY,YAAY,OAAO,aAAa,GAAG,eAAe;AAyBpG,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAChD;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,MAAM;AAAA,MACrB,SAAS,EAAE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