@silvery/examples 0.17.3 → 0.17.4
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/dist/UPNG-Cy7ViL8f.mjs +5074 -0
- package/dist/__vite-browser-external-2447137e-BML7CYau.mjs +4 -0
- package/dist/_banner-DLPxCqVy.mjs +44 -0
- package/dist/ansi-CCE2pVS0.mjs +16397 -0
- package/dist/apng-HhhBjRGt.mjs +68 -0
- package/dist/apng-mwUQbTTF.mjs +3 -0
- package/dist/apps/aichat/index.mjs +1299 -0
- package/dist/apps/app-todo.mjs +139 -0
- package/dist/apps/async-data.mjs +204 -0
- package/dist/apps/cli-wizard.mjs +339 -0
- package/dist/apps/clipboard.mjs +198 -0
- package/dist/apps/components.mjs +864 -0
- package/dist/apps/data-explorer.mjs +483 -0
- package/dist/apps/dev-tools.mjs +397 -0
- package/dist/apps/explorer.mjs +698 -0
- package/dist/apps/gallery.mjs +766 -0
- package/dist/apps/inline-bench.mjs +115 -0
- package/dist/apps/kanban.mjs +280 -0
- package/dist/apps/layout-ref.mjs +187 -0
- package/dist/apps/outline.mjs +203 -0
- package/dist/apps/paste-demo.mjs +189 -0
- package/dist/apps/scroll.mjs +86 -0
- package/dist/apps/search-filter.mjs +287 -0
- package/dist/apps/selection.mjs +355 -0
- package/dist/apps/spatial-focus-demo.mjs +388 -0
- package/dist/apps/task-list.mjs +258 -0
- package/dist/apps/terminal-caps-demo.mjs +315 -0
- package/dist/apps/terminal.mjs +872 -0
- package/dist/apps/text-selection-demo.mjs +254 -0
- package/dist/apps/textarea.mjs +178 -0
- package/dist/apps/theme.mjs +661 -0
- package/dist/apps/transform.mjs +215 -0
- package/dist/apps/virtual-10k.mjs +422 -0
- package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
- package/dist/backends-Bahh9mKN.mjs +1179 -0
- package/dist/backends-CCtCDQ94.mjs +3 -0
- package/dist/{cli.mjs → bin/cli.mjs} +15 -19
- package/dist/chunk-BSw8zbkd.mjs +37 -0
- package/dist/components/counter.mjs +48 -0
- package/dist/components/hello.mjs +31 -0
- package/dist/components/progress-bar.mjs +59 -0
- package/dist/components/select-list.mjs +85 -0
- package/dist/components/spinner.mjs +57 -0
- package/dist/components/text-input.mjs +62 -0
- package/dist/components/virtual-list.mjs +51 -0
- package/dist/flexily-zero-adapter-UB-ra8fR.mjs +3374 -0
- package/dist/gif-BZaqPPVX.mjs +3 -0
- package/dist/gif-BtnXuxLF.mjs +71 -0
- package/dist/gifenc-CLRW41dk.mjs +728 -0
- package/dist/jsx-runtime-dMs_8fNu.mjs +241 -0
- package/dist/key-mapping-5oYQdAQE.mjs +3 -0
- package/dist/key-mapping-D4LR1go6.mjs +130 -0
- package/dist/layout/dashboard.mjs +1204 -0
- package/dist/layout/live-resize.mjs +303 -0
- package/dist/layout/overflow.mjs +70 -0
- package/dist/layout/text-layout.mjs +335 -0
- package/dist/node-NuJ94BWl.mjs +1083 -0
- package/dist/plugins-D1KtkT4a.mjs +3057 -0
- package/dist/resvg-js-C_8Wps1F.mjs +201 -0
- package/dist/src-BTEVGpd9.mjs +23538 -0
- package/dist/src-CUUOuRH6.mjs +5322 -0
- package/dist/src-CzfRafCQ.mjs +814 -0
- package/dist/usingCtx-CsEf0xO3.mjs +57 -0
- package/dist/yoga-adapter-BVtQ5OJR.mjs +237 -0
- package/package.json +18 -13
- package/_banner.tsx +0 -60
- package/apps/aichat/components.tsx +0 -469
- package/apps/aichat/index.tsx +0 -220
- package/apps/aichat/script.ts +0 -460
- package/apps/aichat/state.ts +0 -325
- package/apps/aichat/types.ts +0 -19
- package/apps/app-todo.tsx +0 -201
- package/apps/async-data.tsx +0 -196
- package/apps/cli-wizard.tsx +0 -332
- package/apps/clipboard.tsx +0 -183
- package/apps/components.tsx +0 -658
- package/apps/data-explorer.tsx +0 -490
- package/apps/dev-tools.tsx +0 -395
- package/apps/explorer.tsx +0 -731
- package/apps/gallery.tsx +0 -653
- package/apps/inline-bench.tsx +0 -138
- package/apps/kanban.tsx +0 -265
- package/apps/layout-ref.tsx +0 -173
- package/apps/outline.tsx +0 -160
- package/apps/panes/index.tsx +0 -203
- package/apps/paste-demo.tsx +0 -185
- package/apps/scroll.tsx +0 -80
- package/apps/search-filter.tsx +0 -240
- package/apps/selection.tsx +0 -346
- package/apps/spatial-focus-demo.tsx +0 -372
- package/apps/task-list.tsx +0 -271
- package/apps/terminal-caps-demo.tsx +0 -317
- package/apps/terminal.tsx +0 -784
- package/apps/text-selection-demo.tsx +0 -193
- package/apps/textarea.tsx +0 -155
- package/apps/theme.tsx +0 -515
- package/apps/transform.tsx +0 -229
- package/apps/virtual-10k.tsx +0 -405
- package/apps/vterm-demo/index.tsx +0 -216
- package/components/counter.tsx +0 -49
- package/components/hello.tsx +0 -38
- package/components/progress-bar.tsx +0 -52
- package/components/select-list.tsx +0 -54
- package/components/spinner.tsx +0 -44
- package/components/text-input.tsx +0 -61
- package/components/virtual-list.tsx +0 -56
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs.map +0 -1
- package/layout/dashboard.tsx +0 -953
- package/layout/live-resize.tsx +0 -282
- package/layout/overflow.tsx +0 -51
- package/layout/text-layout.tsx +0 -283
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { n as __esmMin, o as __toESM } from "./chunk-BSw8zbkd.mjs";
|
|
2
|
+
//#region ../../termless/src/animation/gif.ts
|
|
3
|
+
async function loadGifenc() {
|
|
4
|
+
if (gifencModule) return gifencModule;
|
|
5
|
+
try {
|
|
6
|
+
gifencModule = await import("./gifenc-CLRW41dk.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
7
|
+
return gifencModule;
|
|
8
|
+
} catch {
|
|
9
|
+
throw new Error("createGif() requires gifenc. Install it:\n bun add gifenc");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
async function loadResvg() {
|
|
13
|
+
if (resvgModule) return resvgModule;
|
|
14
|
+
try {
|
|
15
|
+
resvgModule = await import("./resvg-js-C_8Wps1F.mjs").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
16
|
+
return resvgModule;
|
|
17
|
+
} catch {
|
|
18
|
+
throw new Error("createGif() requires @resvg/resvg-js. Install it:\n bun add @resvg/resvg-js");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Encode animation frames as an animated GIF.
|
|
23
|
+
*
|
|
24
|
+
* Each SVG frame is rasterized to RGBA pixels via @resvg/resvg-js,
|
|
25
|
+
* then quantized to 256 colors and written to a GIF stream via gifenc.
|
|
26
|
+
*
|
|
27
|
+
* @param frames - SVG frames with durations
|
|
28
|
+
* @param options - Animation options plus optional `scale` for rasterization
|
|
29
|
+
* @returns GIF file as Uint8Array
|
|
30
|
+
*/
|
|
31
|
+
async function createGif(frames, options) {
|
|
32
|
+
if (frames.length === 0) throw new Error("createGif requires at least one frame");
|
|
33
|
+
const [{ GIFEncoder, quantize, applyPalette }, { Resvg }] = await Promise.all([loadGifenc(), loadResvg()]);
|
|
34
|
+
const defaultDuration = options?.defaultDuration ?? 100;
|
|
35
|
+
const loop = options?.loop ?? 0;
|
|
36
|
+
const scale = options?.scale ?? 2;
|
|
37
|
+
const gif = GIFEncoder();
|
|
38
|
+
for (let i = 0; i < frames.length; i++) {
|
|
39
|
+
const frame = frames[i];
|
|
40
|
+
const duration = frame.duration || defaultDuration;
|
|
41
|
+
const rendered = new Resvg(frame.svg, {
|
|
42
|
+
fitTo: {
|
|
43
|
+
mode: "zoom",
|
|
44
|
+
value: scale
|
|
45
|
+
},
|
|
46
|
+
font: {
|
|
47
|
+
loadSystemFonts: true,
|
|
48
|
+
defaultFontFamily: "Menlo"
|
|
49
|
+
}
|
|
50
|
+
}).render();
|
|
51
|
+
const rgba = new Uint8Array(rendered.pixels);
|
|
52
|
+
const width = rendered.width;
|
|
53
|
+
const height = rendered.height;
|
|
54
|
+
const palette = quantize(rgba, 256);
|
|
55
|
+
const indexed = applyPalette(rgba, palette);
|
|
56
|
+
gif.writeFrame(indexed, width, height, {
|
|
57
|
+
palette,
|
|
58
|
+
delay: duration,
|
|
59
|
+
repeat: i === 0 ? loop === 0 ? 0 : loop : void 0
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
gif.finish();
|
|
63
|
+
return gif.bytesView();
|
|
64
|
+
}
|
|
65
|
+
var gifencModule, resvgModule;
|
|
66
|
+
var init_gif = __esmMin((() => {
|
|
67
|
+
gifencModule = null;
|
|
68
|
+
resvgModule = null;
|
|
69
|
+
}));
|
|
70
|
+
//#endregion
|
|
71
|
+
export { init_gif as n, createGif as t };
|