@bestagentkits/render 0.1.0 → 0.2.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 +119 -0
- package/README.md +189 -34
- package/assets/fonts/bricolage-grotesque/OFL.txt +93 -0
- package/assets/fonts/fraunces/OFL.txt +93 -0
- package/assets/fonts/geist/OFL.txt +93 -0
- package/assets/fonts/inter-tight/OFL.txt +93 -0
- package/assets/fonts/jetbrains-mono/OFL.txt +93 -0
- package/assets/fonts/plus-jakarta-sans/OFL.txt +93 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +51 -10
- package/dist/cli.js.map +1 -1
- package/dist/mcp-server.d.ts +37 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +274 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/registry/roster.d.ts +1 -1
- package/dist/registry/roster.d.ts.map +1 -1
- package/dist/registry/roster.js +222 -6
- package/dist/registry/roster.js.map +1 -1
- package/dist/render/block-helpers.d.ts +52 -0
- package/dist/render/block-helpers.d.ts.map +1 -0
- package/dist/render/block-helpers.js +113 -0
- package/dist/render/block-helpers.js.map +1 -0
- package/dist/render/blocks.d.ts +3 -4
- package/dist/render/blocks.d.ts.map +1 -1
- package/dist/render/blocks.js +126 -121
- package/dist/render/blocks.js.map +1 -1
- package/dist/render/charts.d.ts +5 -0
- package/dist/render/charts.d.ts.map +1 -1
- package/dist/render/charts.js +205 -90
- package/dist/render/charts.js.map +1 -1
- package/dist/render/derived-variables.d.ts +17 -0
- package/dist/render/derived-variables.d.ts.map +1 -0
- package/dist/render/derived-variables.js +17 -0
- package/dist/render/derived-variables.js.map +1 -0
- package/dist/render/diagram-fallback.d.ts +25 -0
- package/dist/render/diagram-fallback.d.ts.map +1 -0
- package/dist/render/diagram-fallback.js +86 -0
- package/dist/render/diagram-fallback.js.map +1 -0
- package/dist/render/document.d.ts +4 -0
- package/dist/render/document.d.ts.map +1 -1
- package/dist/render/document.js +34 -6
- package/dist/render/document.js.map +1 -1
- package/dist/render/effects-styles.d.ts +14 -0
- package/dist/render/effects-styles.d.ts.map +1 -0
- package/dist/render/effects-styles.js +39 -0
- package/dist/render/effects-styles.js.map +1 -0
- package/dist/render/embedded-fonts.generated.d.ts +22 -0
- package/dist/render/embedded-fonts.generated.d.ts.map +1 -0
- package/dist/render/embedded-fonts.generated.js +59 -0
- package/dist/render/embedded-fonts.generated.js.map +1 -0
- package/dist/render/feature-styles.d.ts +14 -0
- package/dist/render/feature-styles.d.ts.map +1 -0
- package/dist/render/feature-styles.js +161 -0
- package/dist/render/feature-styles.js.map +1 -0
- package/dist/render/font-faces.d.ts +22 -0
- package/dist/render/font-faces.d.ts.map +1 -0
- package/dist/render/font-faces.js +60 -0
- package/dist/render/font-faces.js.map +1 -0
- package/dist/render/outline.d.ts +21 -0
- package/dist/render/outline.d.ts.map +1 -0
- package/dist/render/outline.js +44 -0
- package/dist/render/outline.js.map +1 -0
- package/dist/render/render.d.ts.map +1 -1
- package/dist/render/render.js +53 -10
- package/dist/render/render.js.map +1 -1
- package/dist/render/runtime.d.ts.map +1 -1
- package/dist/render/runtime.js +184 -10
- package/dist/render/runtime.js.map +1 -1
- package/dist/render/showcase-blocks.d.ts +47 -0
- package/dist/render/showcase-blocks.d.ts.map +1 -0
- package/dist/render/showcase-blocks.js +349 -0
- package/dist/render/showcase-blocks.js.map +1 -0
- package/dist/render/showcase-styles.d.ts +15 -0
- package/dist/render/showcase-styles.d.ts.map +1 -0
- package/dist/render/showcase-styles.js +217 -0
- package/dist/render/showcase-styles.js.map +1 -0
- package/dist/render/signature-styles.d.ts +18 -0
- package/dist/render/signature-styles.d.ts.map +1 -0
- package/dist/render/signature-styles.js +41 -0
- package/dist/render/signature-styles.js.map +1 -0
- package/dist/render/styles.d.ts +18 -9
- package/dist/render/styles.d.ts.map +1 -1
- package/dist/render/styles.js +224 -128
- package/dist/render/styles.js.map +1 -1
- package/dist/render/surface-styles.d.ts +24 -0
- package/dist/render/surface-styles.d.ts.map +1 -0
- package/dist/render/surface-styles.js +41 -0
- package/dist/render/surface-styles.js.map +1 -0
- package/dist/render/verify.d.ts.map +1 -1
- package/dist/render/verify.js +30 -0
- package/dist/render/verify.js.map +1 -1
- package/dist/spec/normalize.d.ts.map +1 -1
- package/dist/spec/normalize.js +32 -0
- package/dist/spec/normalize.js.map +1 -1
- package/dist/theme/load-theme.d.ts +2 -2
- package/dist/theme/load-theme.d.ts.map +1 -1
- package/dist/theme/load-theme.js +46 -10
- package/dist/theme/load-theme.js.map +1 -1
- package/dist/theme/presets.d.ts +4 -3
- package/dist/theme/presets.d.ts.map +1 -1
- package/dist/theme/presets.js +35 -18
- package/dist/theme/presets.js.map +1 -1
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +4 -4
- package/dist/theme/tokens.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/llms.txt +25 -0
- package/package.json +9 -3
package/dist/render/runtime.js
CHANGED
|
@@ -17,6 +17,10 @@ const HELPERS = `
|
|
|
17
17
|
function q(sel, ctx) { return (ctx || doc).querySelector(sel); }
|
|
18
18
|
function qa(sel, ctx) { return Array.prototype.slice.call((ctx || doc).querySelectorAll(sel)); }
|
|
19
19
|
function byId(id) { return qa('[data-ak-id="' + id + '"]'); }
|
|
20
|
+
function motionAllowed() {
|
|
21
|
+
if (root.getAttribute('data-motion') === 'none') return false;
|
|
22
|
+
return !(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches);
|
|
23
|
+
}
|
|
20
24
|
function announce(message) {
|
|
21
25
|
var region = q('[data-ak-live]');
|
|
22
26
|
if (region) region.textContent = message;
|
|
@@ -81,7 +85,7 @@ function run(action, source, detail) {
|
|
|
81
85
|
nodes.forEach(function (node) {
|
|
82
86
|
if (node.tagName === 'DIALOG') openDialog(node);
|
|
83
87
|
else if (node.tagName === 'DETAILS') node.open = !node.open;
|
|
84
|
-
else if (node.hasAttribute('data-ak-theme-toggle')) toggleTheme();
|
|
88
|
+
else if (node.hasAttribute('data-ak-theme-toggle')) toggleTheme(node);
|
|
85
89
|
else {
|
|
86
90
|
var collapsed = node.getAttribute('aria-expanded') === 'false' || node.hasAttribute('hidden');
|
|
87
91
|
if (collapsed) { node.removeAttribute('hidden'); node.setAttribute('aria-expanded', 'true'); }
|
|
@@ -101,7 +105,7 @@ function run(action, source, detail) {
|
|
|
101
105
|
if (type === 'copy') {
|
|
102
106
|
var text = '';
|
|
103
107
|
byId(targetId).forEach(function (node) { text += node.textContent || ''; });
|
|
104
|
-
copyText(text,
|
|
108
|
+
copyText(text, source);
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
107
111
|
if (type === 'download') {
|
|
@@ -151,23 +155,59 @@ function applyTheme(mode) {
|
|
|
151
155
|
root.setAttribute('data-theme', next);
|
|
152
156
|
}
|
|
153
157
|
try { window.localStorage.setItem('ak-render-theme', mode === 'system' ? 'system' : next); } catch (error) {}
|
|
158
|
+
syncThemeToggles(next);
|
|
159
|
+
announce('Theme set to ' + next);
|
|
160
|
+
}
|
|
161
|
+
// The toggle names the scheme it switches to, so it must follow the scheme in
|
|
162
|
+
// effect, including one the system chose before anything was stored.
|
|
163
|
+
function syncThemeToggles(scheme) {
|
|
154
164
|
qa('[data-ak-theme-toggle]').forEach(function (button) {
|
|
155
|
-
button.setAttribute('aria-pressed', String(
|
|
156
|
-
button.textContent =
|
|
165
|
+
button.setAttribute('aria-pressed', String(scheme === 'dark'));
|
|
166
|
+
button.textContent = scheme === 'dark' ? 'Light' : 'Dark';
|
|
157
167
|
});
|
|
158
|
-
announce('Theme set to ' + next);
|
|
159
168
|
}
|
|
160
|
-
|
|
169
|
+
/*
|
|
170
|
+
* Where supported, the new scheme is revealed as a circle growing from the
|
|
171
|
+
* toggle. The origin is written to two custom properties; the stylesheet owns
|
|
172
|
+
* the animation, and reduced motion or an older engine switches instantly.
|
|
173
|
+
*/
|
|
174
|
+
function toggleTheme(source) {
|
|
175
|
+
if (!motionAllowed() || typeof doc.startViewTransition !== 'function') { applyTheme('toggle'); return; }
|
|
176
|
+
if (source && source.getBoundingClientRect) {
|
|
177
|
+
var box = source.getBoundingClientRect();
|
|
178
|
+
root.style.setProperty('--ak-vt-x', Math.round(box.left + box.width / 2) + 'px');
|
|
179
|
+
root.style.setProperty('--ak-vt-y', Math.round(box.top + box.height / 2) + 'px');
|
|
180
|
+
}
|
|
181
|
+
doc.startViewTransition(function () { applyTheme('toggle'); });
|
|
182
|
+
}
|
|
161
183
|
function restoreTheme() {
|
|
184
|
+
// While the system owns the scheme, a change in system settings must relabel
|
|
185
|
+
// the toggle too, not only the first paint.
|
|
186
|
+
var system = window.matchMedia('(prefers-color-scheme: dark)');
|
|
187
|
+
if (typeof system.addEventListener === 'function') {
|
|
188
|
+
system.addEventListener('change', function () {
|
|
189
|
+
if (!root.getAttribute('data-theme')) syncThemeToggles(system.matches ? 'dark' : 'light');
|
|
190
|
+
});
|
|
191
|
+
}
|
|
162
192
|
var stored = null;
|
|
163
193
|
try { stored = window.localStorage.getItem('ak-render-theme'); } catch (error) {}
|
|
164
|
-
if (!stored)
|
|
194
|
+
if (!stored) {
|
|
195
|
+
syncThemeToggles(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
165
198
|
if (stored === 'system') applyTheme('system');
|
|
166
199
|
else applyTheme(stored);
|
|
167
200
|
}`;
|
|
168
201
|
const COPY = `
|
|
169
|
-
function copyText(text,
|
|
170
|
-
var done = function () {
|
|
202
|
+
function copyText(text, source) {
|
|
203
|
+
var done = function () {
|
|
204
|
+
announce('Copied to clipboard');
|
|
205
|
+
// A visible confirmation on the control itself, cleared after a moment.
|
|
206
|
+
if (source && source.setAttribute) {
|
|
207
|
+
source.setAttribute('data-ak-copied', '');
|
|
208
|
+
window.setTimeout(function () { source.removeAttribute('data-ak-copied'); }, 1600);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
171
211
|
if (navigator.clipboard && navigator.clipboard.writeText) {
|
|
172
212
|
navigator.clipboard.writeText(text).then(done, function () { fallbackCopy(text, done); });
|
|
173
213
|
} else {
|
|
@@ -198,6 +238,130 @@ function downloadText(text, filename, source) {
|
|
|
198
238
|
window.setTimeout(function () { URL.revokeObjectURL(url); }, 0);
|
|
199
239
|
announce('Downloaded ' + safeName);
|
|
200
240
|
}`;
|
|
241
|
+
const OUTLINE = `
|
|
242
|
+
function wireOutline() {
|
|
243
|
+
var links = qa('[data-ak-outline-link]');
|
|
244
|
+
if (!links.length || typeof window.IntersectionObserver !== 'function') return;
|
|
245
|
+
var byAnchor = {};
|
|
246
|
+
links.forEach(function (link) { byAnchor[link.getAttribute('href').slice(1)] = link; });
|
|
247
|
+
var mark = function (id) {
|
|
248
|
+
links.forEach(function (link) {
|
|
249
|
+
if (link === byAnchor[id]) link.setAttribute('aria-current', 'location');
|
|
250
|
+
else link.removeAttribute('aria-current');
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
// The current section is the last one whose top has crossed the upper third
|
|
254
|
+
// of the viewport, which matches where a reader's eye rests.
|
|
255
|
+
var observer = new window.IntersectionObserver(function (entries) {
|
|
256
|
+
entries.forEach(function (entry) { if (entry.isIntersecting) mark(entry.target.id); });
|
|
257
|
+
}, { rootMargin: '0px 0px -66% 0px' });
|
|
258
|
+
Object.keys(byAnchor).forEach(function (id) {
|
|
259
|
+
var section = doc.getElementById(id);
|
|
260
|
+
if (section) observer.observe(section);
|
|
261
|
+
});
|
|
262
|
+
}`;
|
|
263
|
+
const BEFORE_AFTER = `
|
|
264
|
+
function wireBeforeAfter() {
|
|
265
|
+
qa('[data-ak-before-after]').forEach(function (figure) {
|
|
266
|
+
var stage = q('.ak-ba-stage', figure);
|
|
267
|
+
var input = q('.ak-ba-range', figure);
|
|
268
|
+
if (!stage || !input) return;
|
|
269
|
+
var apply = function () { stage.style.setProperty('--ak-split', input.value + '%'); };
|
|
270
|
+
// Dragging anywhere on the stage moves the divider, which a bare range input
|
|
271
|
+
// only does from its thumb on some touch browsers.
|
|
272
|
+
var dragging = false;
|
|
273
|
+
var follow = function (event) {
|
|
274
|
+
var box = stage.getBoundingClientRect();
|
|
275
|
+
if (!box.width) return;
|
|
276
|
+
var ratio = Math.min(Math.max((event.clientX - box.left) / box.width, 0), 1);
|
|
277
|
+
input.value = String(Math.round(ratio * 100));
|
|
278
|
+
apply();
|
|
279
|
+
};
|
|
280
|
+
input.addEventListener('input', apply, false);
|
|
281
|
+
input.addEventListener('pointerdown', function (event) {
|
|
282
|
+
dragging = true;
|
|
283
|
+
if (input.setPointerCapture) input.setPointerCapture(event.pointerId);
|
|
284
|
+
follow(event);
|
|
285
|
+
}, false);
|
|
286
|
+
input.addEventListener('pointermove', function (event) { if (dragging) follow(event); }, false);
|
|
287
|
+
input.addEventListener('pointerup', function () { dragging = false; }, false);
|
|
288
|
+
input.addEventListener('pointercancel', function () { dragging = false; }, false);
|
|
289
|
+
apply();
|
|
290
|
+
figure.setAttribute('data-ak-ready', '');
|
|
291
|
+
});
|
|
292
|
+
}`;
|
|
293
|
+
const EFFECTS = `
|
|
294
|
+
function countUp(el) {
|
|
295
|
+
if (el.children.length) return;
|
|
296
|
+
var text = el.textContent;
|
|
297
|
+
var match = /^([^\\dA-Za-z]*)(\\d{1,3}(?:,\\d{3})+|\\d+)(\\.\\d+)?([^\\d]*)$/.exec(text.trim());
|
|
298
|
+
if (!match) return;
|
|
299
|
+
var grouped = match[2].indexOf(',') !== -1;
|
|
300
|
+
var places = match[3] ? match[3].length - 1 : 0;
|
|
301
|
+
var target = parseFloat(match[2].replace(/,/g, '') + (match[3] || ''));
|
|
302
|
+
if (!isFinite(target) || target === 0) return;
|
|
303
|
+
var format = function (value) {
|
|
304
|
+
var fixed = value.toFixed(places);
|
|
305
|
+
if (grouped) {
|
|
306
|
+
var parts = fixed.split('.');
|
|
307
|
+
parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');
|
|
308
|
+
fixed = parts.join('.');
|
|
309
|
+
}
|
|
310
|
+
return match[1] + fixed + match[4];
|
|
311
|
+
};
|
|
312
|
+
// The authored value stays in the DOM for assistive technology, copy and
|
|
313
|
+
// print; the rolling figure is a hidden layer drawn over it while it runs.
|
|
314
|
+
var real = doc.createElement('span');
|
|
315
|
+
real.className = 'ak-sr';
|
|
316
|
+
real.textContent = text;
|
|
317
|
+
var shown = doc.createElement('span');
|
|
318
|
+
shown.setAttribute('aria-hidden', 'true');
|
|
319
|
+
shown.textContent = format(0);
|
|
320
|
+
el.textContent = '';
|
|
321
|
+
el.appendChild(real);
|
|
322
|
+
el.appendChild(shown);
|
|
323
|
+
var settled = false;
|
|
324
|
+
var settle = function () {
|
|
325
|
+
if (settled) return;
|
|
326
|
+
settled = true;
|
|
327
|
+
el.textContent = text;
|
|
328
|
+
window.removeEventListener('beforeprint', settle);
|
|
329
|
+
};
|
|
330
|
+
window.addEventListener('beforeprint', settle);
|
|
331
|
+
var began = null;
|
|
332
|
+
var step = function (now) {
|
|
333
|
+
if (settled) return;
|
|
334
|
+
if (began === null) began = now;
|
|
335
|
+
var progress = Math.min((now - began) / 1400, 1);
|
|
336
|
+
if (progress >= 1) { settle(); return; }
|
|
337
|
+
shown.textContent = format(target * (1 - Math.pow(1 - progress, 4)));
|
|
338
|
+
window.requestAnimationFrame(step);
|
|
339
|
+
};
|
|
340
|
+
window.requestAnimationFrame(step);
|
|
341
|
+
}
|
|
342
|
+
function wireEffects() {
|
|
343
|
+
if (!motionAllowed()) return;
|
|
344
|
+
// A soft light follows the pointer across cards and tiles.
|
|
345
|
+
doc.addEventListener('pointermove', function (event) {
|
|
346
|
+
var surface = event.target && event.target.closest ? event.target.closest('.ak-card, .ak-tile, .ak-kpi-card') : null;
|
|
347
|
+
if (!surface) return;
|
|
348
|
+
var box = surface.getBoundingClientRect();
|
|
349
|
+
surface.style.setProperty('--ak-mx', Math.round(event.clientX - box.left) + 'px');
|
|
350
|
+
surface.style.setProperty('--ak-my', Math.round(event.clientY - box.top) + 'px');
|
|
351
|
+
}, { passive: true });
|
|
352
|
+
if (typeof window.IntersectionObserver !== 'function') return;
|
|
353
|
+
// Blocks play their entrance as they arrive. Until then they show their final
|
|
354
|
+
// state, so a capture, a print or a disabled script never sees them blank.
|
|
355
|
+
var observer = new window.IntersectionObserver(function (entries) {
|
|
356
|
+
entries.forEach(function (entry) {
|
|
357
|
+
if (!entry.isIntersecting) return;
|
|
358
|
+
observer.unobserve(entry.target);
|
|
359
|
+
if (entry.target.hasAttribute('data-ak-animate')) entry.target.setAttribute('data-ak-inview', '');
|
|
360
|
+
else countUp(entry.target);
|
|
361
|
+
});
|
|
362
|
+
}, { rootMargin: '0px 0px 12% 0px' });
|
|
363
|
+
qa('[data-ak-animate], [data-ak-count], .ak-stat dd').forEach(function (el) { observer.observe(el); });
|
|
364
|
+
}`;
|
|
201
365
|
const DIALOG = `
|
|
202
366
|
var lastFocus = null;
|
|
203
367
|
function openDialog(dialog) {
|
|
@@ -383,7 +547,7 @@ doc.addEventListener('click', function (event) {
|
|
|
383
547
|
return;
|
|
384
548
|
}
|
|
385
549
|
if (target.hasAttribute && target.hasAttribute('data-ak-theme-toggle')) {
|
|
386
|
-
toggleTheme();
|
|
550
|
+
toggleTheme(target);
|
|
387
551
|
return;
|
|
388
552
|
}
|
|
389
553
|
target = target.parentElement;
|
|
@@ -416,6 +580,11 @@ export function buildRuntime(options) {
|
|
|
416
580
|
parts.push(SLIDER);
|
|
417
581
|
if (features.has('tabs'))
|
|
418
582
|
parts.push(TABS);
|
|
583
|
+
if (features.has('outline'))
|
|
584
|
+
parts.push(OUTLINE);
|
|
585
|
+
if (features.has('before-after'))
|
|
586
|
+
parts.push(BEFORE_AFTER);
|
|
587
|
+
parts.push(EFFECTS);
|
|
419
588
|
const wiring = [];
|
|
420
589
|
if (features.has('tabs'))
|
|
421
590
|
wiring.push('wireTabs();');
|
|
@@ -425,6 +594,11 @@ export function buildRuntime(options) {
|
|
|
425
594
|
wiring.push('wireSliders();');
|
|
426
595
|
if (features.has('filter'))
|
|
427
596
|
wiring.push('wireFilters();');
|
|
597
|
+
if (features.has('outline'))
|
|
598
|
+
wiring.push('wireOutline();');
|
|
599
|
+
if (features.has('before-after'))
|
|
600
|
+
wiring.push('wireBeforeAfter();');
|
|
601
|
+
wiring.push('wireEffects();');
|
|
428
602
|
return [
|
|
429
603
|
'(function () {',
|
|
430
604
|
'"use strict";',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/render/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,mFAAmF;AACnF,MAAM,mBAAmB,GAA8B,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AASnF,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/render/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,mFAAmF;AACnF,MAAM,mBAAmB,GAA8B,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AASnF,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDd,CAAC;AAEH,MAAM,IAAI,GAAG;;;;;;;;;;;EAWX,CAAC;AAEH,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DV,CAAC;AAEH,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyDZ,CAAC;AAEH,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCX,CAAC;AAEH,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;E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AC,GAAG,CAAC,cAAc,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IACpE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAE9B,OAAO;QACL,gBAAgB;QAChB,eAAe;QACf,qBAAqB;QACrB,iCAAiC;QACjC,eAAe,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG;QAC/C,OAAO;QACP,GAAG;QACH,IAAI;QACJ,GAAG,KAAK;QACR,UAAU;QACV,IAAI;QACJ,GAAG,MAAM;QACT,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QACzB,OAAO;KACR;SACE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;SAC7B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,QAAqC;IACnE,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showcase block renderers.
|
|
3
|
+
*
|
|
4
|
+
* Blocks that present work rather than structure it: a bento mosaic, a ticker,
|
|
5
|
+
* a terminal session, a file tree, a before/after slider, KPI cards with
|
|
6
|
+
* sparklines, a framed feature spotlight, and a checklist.
|
|
7
|
+
*
|
|
8
|
+
* The same rules as `blocks.ts` apply: pure functions of the node and the IR,
|
|
9
|
+
* exactly one `data-ak-id` per block, no style attributes or handlers. Every
|
|
10
|
+
* motion these blocks get comes from CSS or the runtime, and the markup is
|
|
11
|
+
* complete without either, so the content reads the same in a PDF, a
|
|
12
|
+
* screenshot, or with script disabled.
|
|
13
|
+
*/
|
|
14
|
+
import type { IrNode, NetworkPolicy } from '../ir.js';
|
|
15
|
+
import { type JsonValue } from '../json.js';
|
|
16
|
+
/** Minimal render context the showcase renderers need. */
|
|
17
|
+
export interface ShowcaseContext {
|
|
18
|
+
ir: {
|
|
19
|
+
policy: {
|
|
20
|
+
network: NetworkPolicy;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
type ShowcaseRenderer = (node: IrNode, context: ShowcaseContext) => string;
|
|
25
|
+
/** Browser chrome (decorative) around an image: the bar, then the viewport. */
|
|
26
|
+
export declare function browserShot(source: string, alt: string, address: string, policy: NetworkPolicy, loading?: 'lazy' | 'eager'): string;
|
|
27
|
+
interface TreeFile {
|
|
28
|
+
name: string;
|
|
29
|
+
status: string;
|
|
30
|
+
note: string;
|
|
31
|
+
}
|
|
32
|
+
interface TreeDir {
|
|
33
|
+
name: string;
|
|
34
|
+
dirs: Map<string, TreeDir>;
|
|
35
|
+
files: TreeFile[];
|
|
36
|
+
}
|
|
37
|
+
/** Build a folder tree from slash-separated paths; a trailing slash names an empty folder. */
|
|
38
|
+
export declare function buildFileTree(items: Record<string, JsonValue>[]): TreeDir;
|
|
39
|
+
/** Line and area paths for a sparkline, scaled into a fixed view box. */
|
|
40
|
+
export declare function sparkPaths(series: number[]): {
|
|
41
|
+
line: string;
|
|
42
|
+
area: string;
|
|
43
|
+
end: [number, number];
|
|
44
|
+
};
|
|
45
|
+
export declare const SHOWCASE_RENDERERS: Record<string, ShowcaseRenderer>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=showcase-blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showcase-blocks.d.ts","sourceRoot":"","sources":["../../src/render/showcase-blocks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAiB3D,0DAA0D;AAC1D,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