loopwind 0.25.8 → 0.25.10

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/cli.js CHANGED
@@ -6,12 +6,13 @@ import { renderCommand } from './commands/render.js';
6
6
  import { validateCommand } from './commands/validate.js';
7
7
  import { initCommand } from './commands/init.js';
8
8
  import { defaultCommand } from './commands/default.js';
9
- import { loginCommand } from './commands/login.js';
10
- import { logoutCommand } from './commands/logout.js';
11
- import { whoamiCommand } from './commands/whoami.js';
12
- import { publishCommand } from './commands/publish.js';
13
- import { templatesCommand } from './commands/templates.js';
14
- import { unpublishCommand } from './commands/unpublish.js';
9
+ // Platform commands (commented out for now)
10
+ // import { loginCommand } from './commands/login.js';
11
+ // import { logoutCommand } from './commands/logout.js';
12
+ // import { whoamiCommand } from './commands/whoami.js';
13
+ // import { publishCommand } from './commands/publish.js';
14
+ // import { templatesCommand } from './commands/templates.js';
15
+ // import { unpublishCommand } from './commands/unpublish.js';
15
16
  import { readFileSync } from 'fs';
16
17
  import { fileURLToPath } from 'url';
17
18
  import { dirname, join } from 'path';
@@ -72,29 +73,33 @@ program
72
73
  .command('init')
73
74
  .description('Initialize a loopwind.json config file')
74
75
  .action(initCommand);
75
- // Platform commands
76
+ // Platform commands (commented out for now)
77
+ /*
76
78
  // loopwind login
77
79
  program
78
- .command('login')
79
- .description('Authenticate with Loopwind Platform')
80
- .action(loginCommand);
80
+ .command('login')
81
+ .description('Authenticate with Loopwind Platform')
82
+ .action(loginCommand);
83
+
81
84
  // loopwind logout
82
85
  program
83
- .command('logout')
84
- .description('Log out from Loopwind Platform')
85
- .action(logoutCommand);
86
+ .command('logout')
87
+ .description('Log out from Loopwind Platform')
88
+ .action(logoutCommand);
89
+
86
90
  // loopwind whoami
87
91
  program
88
- .command('whoami')
89
- .description('Show current user and organization')
90
- .action(whoamiCommand);
92
+ .command('whoami')
93
+ .description('Show current user and organization')
94
+ .action(whoamiCommand);
95
+
91
96
  // loopwind publish [template]
92
97
  program
93
- .command('publish [template]')
94
- .description('Publish a template to Loopwind Platform')
95
- .option('-n, --name <name>', 'Override template name')
96
- .option('-o, --org <org>', 'Organization to publish to (slug or name)')
97
- .addHelpText('after', `
98
+ .command('publish [template]')
99
+ .description('Publish a template to Loopwind Platform')
100
+ .option('-n, --name <name>', 'Override template name')
101
+ .option('-o, --org <org>', 'Organization to publish to (slug or name)')
102
+ .addHelpText('after', `
98
103
  Examples:
99
104
  Publish current directory:
100
105
  $ loopwind publish
@@ -109,16 +114,19 @@ Examples:
109
114
  Publish to a specific organization:
110
115
  $ loopwind publish banner-hero --org my-company
111
116
  `)
112
- .action(publishCommand);
117
+ .action(publishCommand);
118
+
113
119
  // loopwind templates
114
120
  program
115
- .command('templates')
116
- .description('List published templates')
117
- .action(templatesCommand);
121
+ .command('templates')
122
+ .description('List published templates')
123
+ .action(templatesCommand);
124
+
118
125
  // loopwind unpublish <name>
119
126
  program
120
- .command('unpublish <name>')
121
- .description('Remove a template from Loopwind Platform')
122
- .action(unpublishCommand);
127
+ .command('unpublish <name>')
128
+ .description('Remove a template from Loopwind Platform')
129
+ .action(unpublishCommand);
130
+ */
123
131
  program.parse();
124
132
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAA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O,EAAE;;;;;;;;;;;;;;CAcvB,CAAC;KACC,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,kBAAkB;AAClB,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,eAAe,CAAC,CAAC;AAE3B,cAAc;AACd,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,wCAAwC,CAAC;KACrD,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,4CAA4C;AAC5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDE;AAEF,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Experimental GIF support for edge runtimes
3
+ *
4
+ * WARNING: This is experimental and may hit CPU/memory limits on free tier.
5
+ * Recommended for short animations (< 2 seconds, < 10 frames)
6
+ */
7
+ import { GIFEncoder, quantize, applyPalette } from 'gifenc';
8
+ export interface GifOptions {
9
+ /** Frame HTML strings to render */
10
+ frames: string[];
11
+ /** Width in pixels */
12
+ width?: number;
13
+ /** Height in pixels */
14
+ height?: number;
15
+ /** Delay between frames in ms */
16
+ delay?: number;
17
+ /** Number of loops (0 = infinite) */
18
+ repeat?: number;
19
+ }
20
+ /**
21
+ * Render frames to GIF
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const gif = await renderGif({
26
+ * frames: [
27
+ * '<div style="background: red;">Frame 1</div>',
28
+ * '<div style="background: blue;">Frame 2</div>',
29
+ * ],
30
+ * width: 400,
31
+ * height: 300,
32
+ * delay: 500, // 500ms between frames
33
+ * });
34
+ * ```
35
+ */
36
+ export declare function renderGif(options: GifOptions): Promise<Uint8Array>;
37
+ export { GIFEncoder, quantize, applyPalette };
38
+ //# sourceMappingURL=edge-gif.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-gif.d.ts","sourceRoot":"","sources":["../../src/sdk/edge-gif.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG5D,MAAM,WAAW,UAAU;IACzB,mCAAmC;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CA6CxE;AAgDD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Experimental GIF support for edge runtimes
3
+ *
4
+ * WARNING: This is experimental and may hit CPU/memory limits on free tier.
5
+ * Recommended for short animations (< 2 seconds, < 10 frames)
6
+ */
7
+ import { ImageResponse } from 'workers-og';
8
+ import { GIFEncoder, quantize, applyPalette } from 'gifenc';
9
+ import { decode as decodePng } from 'fast-png';
10
+ /**
11
+ * Render frames to GIF
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const gif = await renderGif({
16
+ * frames: [
17
+ * '<div style="background: red;">Frame 1</div>',
18
+ * '<div style="background: blue;">Frame 2</div>',
19
+ * ],
20
+ * width: 400,
21
+ * height: 300,
22
+ * delay: 500, // 500ms between frames
23
+ * });
24
+ * ```
25
+ */
26
+ export async function renderGif(options) {
27
+ const { frames, width = 400, height = 300, delay = 100, repeat = 0, } = options;
28
+ if (frames.length === 0) {
29
+ throw new Error('At least one frame is required');
30
+ }
31
+ if (frames.length > 30) {
32
+ console.warn('Warning: Many frames may exceed Workers CPU/memory limits');
33
+ }
34
+ const gif = GIFEncoder();
35
+ for (let i = 0; i < frames.length; i++) {
36
+ // Render frame to PNG using workers-og
37
+ const response = new ImageResponse(frames[i], { width, height });
38
+ const pngBuffer = await response.arrayBuffer();
39
+ // Convert PNG to RGBA using pure JS decoder
40
+ const rgba = pngToRgba(new Uint8Array(pngBuffer));
41
+ // Quantize to 256 colors
42
+ const palette = quantize(rgba, 256, { format: 'rgb565' });
43
+ const indexed = applyPalette(rgba, palette, 'rgb565');
44
+ // Write frame
45
+ const frameOptions = {
46
+ palette,
47
+ delay: delay,
48
+ };
49
+ if (i === 0) {
50
+ gif.writeFrame(indexed, width, height, { ...frameOptions, first: true });
51
+ }
52
+ else {
53
+ gif.writeFrame(indexed, width, height, frameOptions);
54
+ }
55
+ }
56
+ gif.finish();
57
+ return gif.bytes();
58
+ }
59
+ /**
60
+ * Decode PNG to RGBA using fast-png (pure JS, no Canvas needed)
61
+ */
62
+ function pngToRgba(png) {
63
+ const decoded = decodePng(png);
64
+ // fast-png returns data in the format matching the PNG
65
+ // We need RGBA, so handle different cases
66
+ if (decoded.channels === 4) {
67
+ // Already RGBA
68
+ return new Uint8Array(decoded.data);
69
+ }
70
+ else if (decoded.channels === 3) {
71
+ // RGB - add alpha channel
72
+ const rgba = new Uint8Array(decoded.width * decoded.height * 4);
73
+ for (let i = 0, j = 0; i < decoded.data.length; i += 3, j += 4) {
74
+ rgba[j] = decoded.data[i];
75
+ rgba[j + 1] = decoded.data[i + 1];
76
+ rgba[j + 2] = decoded.data[i + 2];
77
+ rgba[j + 3] = 255;
78
+ }
79
+ return rgba;
80
+ }
81
+ else if (decoded.channels === 2) {
82
+ // Grayscale + alpha
83
+ const rgba = new Uint8Array(decoded.width * decoded.height * 4);
84
+ for (let i = 0, j = 0; i < decoded.data.length; i += 2, j += 4) {
85
+ const gray = decoded.data[i];
86
+ rgba[j] = gray;
87
+ rgba[j + 1] = gray;
88
+ rgba[j + 2] = gray;
89
+ rgba[j + 3] = decoded.data[i + 1];
90
+ }
91
+ return rgba;
92
+ }
93
+ else {
94
+ // Grayscale
95
+ const rgba = new Uint8Array(decoded.width * decoded.height * 4);
96
+ for (let i = 0, j = 0; i < decoded.data.length; i++, j += 4) {
97
+ const gray = decoded.data[i];
98
+ rgba[j] = gray;
99
+ rgba[j + 1] = gray;
100
+ rgba[j + 2] = gray;
101
+ rgba[j + 3] = 255;
102
+ }
103
+ return rgba;
104
+ }
105
+ }
106
+ export { GIFEncoder, quantize, applyPalette };
107
+ //# sourceMappingURL=edge-gif.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-gif.js","sourceRoot":"","sources":["../../src/sdk/edge-gif.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,UAAU,CAAC;AAe/C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAmB;IACjD,MAAM,EACJ,MAAM,EACN,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,GAAG,EACZ,KAAK,GAAG,GAAG,EACX,MAAM,GAAG,CAAC,GACX,GAAG,OAAO,CAAC;IAEZ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,uCAAuC;Q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YACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,YAAY;QACZ,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAChE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YACf,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;QACpB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC"}
@@ -2,28 +2,36 @@
2
2
  * Loopwind SDK - Edge Runtime Build
3
3
  *
4
4
  * Compatible with Cloudflare Workers, Vercel Edge Functions, and other edge runtimes.
5
+ * Uses workers-og under the hood for WASM-compatible rendering.
5
6
  *
6
7
  * Limitations:
7
- * - PNG/WebP/JPG work (via WASM)
8
+ * - PNG works (via workers-og)
8
9
  * - Video (mp4/gif) NOT supported (requires Node.js)
9
- * - Uses Web APIs instead of Node.js APIs
10
+ * - Template system simplified for edge (HTML-based)
10
11
  *
11
12
  * @example
12
13
  * ```typescript
13
- * import { render } from 'loopwind/edge';
14
+ * import { render, ImageResponse } from 'loopwind/edge';
14
15
  *
15
16
  * export default {
16
17
  * async fetch(request: Request) {
17
18
  * const url = new URL(request.url);
18
19
  * const title = url.searchParams.get('title') || 'Hello';
19
20
  *
20
- * const png = await render(OGImage, {
21
- * props: { title },
21
+ * // Option 1: Use ImageResponse directly (recommended)
22
+ * return new ImageResponse(
23
+ * `<div style="display: flex; width: 100%; height: 100%; background: blue; color: white; align-items: center; justify-content: center;">
24
+ * <h1 style="font-size: 60px;">${title}</h1>
25
+ * </div>`,
26
+ * { width: 1200, height: 630 }
27
+ * );
28
+ *
29
+ * // Option 2: Use render for buffer output
30
+ * const png = await render({
31
+ * html: `<div>...</div>`,
22
32
  * width: 1200,
23
33
  * height: 630,
24
- * format: 'png',
25
34
  * });
26
- *
27
35
  * return new Response(png, {
28
36
  * headers: { 'Content-Type': 'image/png' },
29
37
  * });
@@ -33,33 +41,47 @@
33
41
  *
34
42
  * @packageDocumentation
35
43
  */
36
- import type { Template, TemplateProps, RenderOptions, RenderResult, RendererConfig, RenderFunction } from './types.js';
44
+ export { ImageResponse } from 'workers-og';
45
+ export interface EdgeRenderOptions {
46
+ /** HTML string to render */
47
+ html: string;
48
+ /** Output width in pixels */
49
+ width?: number;
50
+ /** Output height in pixels */
51
+ height?: number;
52
+ }
37
53
  /**
38
- * Render a template to image (edge runtime)
54
+ * Render HTML to PNG buffer
39
55
  *
40
56
  * @example
41
57
  * ```typescript
42
- * import { render } from 'loopwind/edge';
43
- *
44
- * const OGImage = ({ title, tw }) => (
45
- * <div style={tw("w-full h-full bg-blue-500 flex items-center justify-center")}>
46
- * <h1 style={tw("text-white text-6xl")}>{title}</h1>
47
- * </div>
48
- * );
49
- *
50
- * const png = await render(OGImage, {
51
- * props: { title: 'Hello World' },
58
+ * const png = await render({
59
+ * html: '<div style="display: flex; background: blue; color: white;">Hello</div>',
52
60
  * width: 1200,
53
61
  * height: 630,
54
- * format: 'png',
55
62
  * });
56
63
  * ```
57
64
  */
58
- export declare function render<P extends TemplateProps>(template: Template<P>, options: RenderOptions<P>): Promise<RenderResult>;
65
+ export declare function render(options: EdgeRenderOptions): Promise<Uint8Array>;
59
66
  /**
60
- * Create a reusable renderer with preset configuration (edge runtime)
67
+ * Create an HTML string from props using a simple template
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const html = createHtml({
72
+ * title: 'Hello World',
73
+ * subtitle: 'Welcome to Loopwind',
74
+ * background: 'linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%)',
75
+ * });
76
+ * ```
61
77
  */
62
- export declare function createRenderer(config: RendererConfig): RenderFunction;
63
- export type { Template, TemplateProps, BaseTemplateProps, RenderOptions, RenderResult, RendererConfig, RenderFunction, TwFunction, FrameInfo, FontConfig, FontsConfig, OutputFormat, ImageTransformOptions, QRCodeOptions, } from './types.js';
78
+ export declare function createHtml(props: {
79
+ title?: string;
80
+ subtitle?: string;
81
+ background?: string;
82
+ textColor?: string;
83
+ fontSize?: number;
84
+ }): string;
85
+ export type { TemplateProps, RenderResult, FontConfig, OutputFormat, } from './types.js';
64
86
  export { LoopwindError, ValidationError, FontError, RenderError, TimeoutError, ImageFetchError, } from './errors.js';
65
87
  //# sourceMappingURL=edge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/sdk/edge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAWH,OAAO,KAAK,EACV,QAAQ,EACR,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACd,cAAc,EAKf,MAAM,YAAY,CAAC;AA8SpB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,aAAa,EAClD,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB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