asciify-engine 1.0.25 → 1.0.26

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/index.d.cts CHANGED
@@ -121,20 +121,6 @@ declare function renderFrameToCanvas(ctx: CanvasRenderingContext2D, frame: Ascii
121
121
  intensity?: number;
122
122
  } | null): void;
123
123
 
124
- /**
125
- * Embed code generation — serializes ASCII frames into self-contained
126
- * HTML snippets that replay via the CDN embed runtime.
127
- */
128
-
129
- /**
130
- * Generate a static single-frame embed snippet.
131
- */
132
- declare function generateEmbedCode(frame: AsciiFrame, options: AsciiOptions, width: number, height: number): string;
133
- /**
134
- * Generate an animated multi-frame embed snippet (GIF / video).
135
- */
136
- declare function generateAnimatedEmbedCode(frames: AsciiFrame[], options: AsciiOptions, fps: number, width: number, height: number): string;
137
-
138
124
  /**
139
125
  * Simple one-call asciify API.
140
126
  * Wraps imageToAsciiFrame + renderFrameToCanvas behind easy-to-use helpers.
@@ -685,4 +671,4 @@ interface WebGLRenderer {
685
671
  */
686
672
  declare function tryCreateWebGLRenderer(canvas: HTMLCanvasElement): WebGLRenderer | null;
687
673
 
688
- export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, generateAnimatedEmbedCode, generateEmbedCode, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
674
+ export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
package/dist/index.d.ts CHANGED
@@ -121,20 +121,6 @@ declare function renderFrameToCanvas(ctx: CanvasRenderingContext2D, frame: Ascii
121
121
  intensity?: number;
122
122
  } | null): void;
123
123
 
124
- /**
125
- * Embed code generation — serializes ASCII frames into self-contained
126
- * HTML snippets that replay via the CDN embed runtime.
127
- */
128
-
129
- /**
130
- * Generate a static single-frame embed snippet.
131
- */
132
- declare function generateEmbedCode(frame: AsciiFrame, options: AsciiOptions, width: number, height: number): string;
133
- /**
134
- * Generate an animated multi-frame embed snippet (GIF / video).
135
- */
136
- declare function generateAnimatedEmbedCode(frames: AsciiFrame[], options: AsciiOptions, fps: number, width: number, height: number): string;
137
-
138
124
  /**
139
125
  * Simple one-call asciify API.
140
126
  * Wraps imageToAsciiFrame + renderFrameToCanvas behind easy-to-use helpers.
@@ -685,4 +671,4 @@ interface WebGLRenderer {
685
671
  */
686
672
  declare function tryCreateWebGLRenderer(canvas: HTMLCanvasElement): WebGLRenderer | null;
687
673
 
688
- export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, generateAnimatedEmbedCode, generateEmbedCode, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
674
+ export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
package/dist/index.js CHANGED
@@ -960,84 +960,6 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
960
960
  ctx.globalAlpha = 1;
961
961
  }
962
962
 
963
- // src/core/embed-gen.ts
964
- var EMBED_CDN_VERSION = "1.0.17";
965
- function serializeFrame(frame, fullColor) {
966
- const rows = frame.length;
967
- const cols = rows > 0 ? frame[0].length : 0;
968
- const stride = fullColor ? 3 : 1;
969
- const buf = new Uint8Array(1 + rows * cols * stride);
970
- buf[0] = stride;
971
- let i = 1;
972
- for (let y = 0; y < rows; y++) {
973
- for (let x = 0; x < cols; x++) {
974
- const cell = frame[y][x];
975
- if (fullColor) {
976
- buf[i++] = cell.r;
977
- buf[i++] = cell.g;
978
- buf[i++] = cell.b;
979
- } else {
980
- buf[i++] = Math.round(0.299 * cell.r + 0.587 * cell.g + 0.114 * cell.b);
981
- }
982
- }
983
- }
984
- let binary = "";
985
- for (let j = 0; j < buf.length; j++) binary += String.fromCharCode(buf[j]);
986
- return btoa(binary);
987
- }
988
- function buildEmbedOpts(options, rows, cols, width, height, fps, animated) {
989
- const o = {
990
- r: rows,
991
- c: cols,
992
- w: width,
993
- h: height,
994
- cs: options.charset,
995
- cm: options.colorMode,
996
- as: options.animationStyle,
997
- sp: options.animationSpeed,
998
- inv: options.invert,
999
- hs: options.hoverStrength,
1000
- hr: options.hoverRadius,
1001
- he: options.hoverEffect,
1002
- hc: options.hoverColor,
1003
- dr: options.dotSizeRatio,
1004
- dots: options.renderMode === "dots"
1005
- };
1006
- if (options.colorMode === "accent") o.ac = options.accentColor;
1007
- if (fps !== void 0) o.fps = fps;
1008
- if (animated) o.anim = true;
1009
- return JSON.stringify(o);
1010
- }
1011
- var CDN_SCRIPT = `<script src="https://cdn.jsdelivr.net/npm/asciify-engine@${EMBED_CDN_VERSION}/dist/embed.js" async></script>`;
1012
- function generateEmbedCode(frame, options, width, height) {
1013
- const rows = frame.length;
1014
- if (rows === 0) return "";
1015
- const cols = frame[0].length;
1016
- const isFullColor = options.colorMode === "fullcolor";
1017
- const data = serializeFrame(frame, isFullColor);
1018
- const id = `ar-${Math.random().toString(36).slice(2, 9)}`;
1019
- const opts = buildEmbedOpts(options, rows, cols, width, height);
1020
- return `<!-- Asciify Embed -->
1021
- <canvas id="${id}" data-asciify-opts='${opts}' width="${width}" height="${height}"></canvas>
1022
- <script type="application/json" id="${id}-d">"${data}"</script>
1023
- ${CDN_SCRIPT}
1024
- <!-- /Asciify Embed -->`;
1025
- }
1026
- function generateAnimatedEmbedCode(frames, options, fps, width, height) {
1027
- if (frames.length === 0) return "";
1028
- const rows = frames[0].length;
1029
- const cols = frames[0][0].length;
1030
- const isFullColor = options.colorMode === "fullcolor";
1031
- const allData = frames.map((f) => serializeFrame(f, isFullColor));
1032
- const id = `ar-${Math.random().toString(36).slice(2, 9)}`;
1033
- const opts = buildEmbedOpts(options, rows, cols, width, height, fps, true);
1034
- return `<!-- Asciify Animated Embed -->
1035
- <canvas id="${id}" data-asciify-opts='${opts}' width="${width}" height="${height}"></canvas>
1036
- <script type="application/json" id="${id}-d">${JSON.stringify(allData)}</script>
1037
- ${CDN_SCRIPT}
1038
- <!-- /Asciify Animated Embed -->`;
1039
- }
1040
-
1041
963
  // src/core/simple-api.ts
1042
964
  async function asciify(source, canvas, { fontSize = 10, style = "classic", options = {} } = {}) {
1043
965
  let el;
@@ -2901,6 +2823,6 @@ function tryCreateWebGLRenderer(canvas) {
2901
2823
  }
2902
2824
  }
2903
2825
 
2904
- export { ART_STYLE_PRESETS, CHARSETS, DEFAULT_OPTIONS, HOVER_PRESETS, PALETTE_THEMES, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, generateAnimatedEmbedCode, generateEmbedCode, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
2826
+ export { ART_STYLE_PRESETS, CHARSETS, DEFAULT_OPTIONS, HOVER_PRESETS, PALETTE_THEMES, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
2905
2827
  //# sourceMappingURL=index.js.map
2906
2828
  //# sourceMappingURL=index.js.map