asciify-engine 1.0.8 → 1.0.9
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/embed.js +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -7
- package/dist/index.d.ts +11 -7
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -160,15 +160,19 @@ declare function asciifyGif(source: string | ArrayBuffer, canvas: HTMLCanvasElem
|
|
|
160
160
|
*/
|
|
161
161
|
declare function asciifyVideo(source: HTMLVideoElement | string, canvas: HTMLCanvasElement, { fontSize, style, options }?: AsciifySimpleOptions): Promise<() => void>;
|
|
162
162
|
/**
|
|
163
|
-
* Generate a clean
|
|
163
|
+
* Generate a clean embed snippet.
|
|
164
164
|
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
165
|
+
* Structure:
|
|
166
|
+
* <canvas id> — the render target, short and clean
|
|
167
|
+
* <script type=json id> — frame data lives here, clearly separated
|
|
168
|
+
* <script src=cdn> — always the same line, cached by browsers
|
|
168
169
|
*
|
|
169
|
-
* Output:
|
|
170
|
-
*
|
|
171
|
-
* <
|
|
170
|
+
* Output (static):
|
|
171
|
+
* <!-- Asciify Embed -->
|
|
172
|
+
* <canvas id="ar-xxx" data-asciify-opts="{…}" width="…" height="…"></canvas>
|
|
173
|
+
* <script type="application/json" id="ar-xxx-d">"BASE64"</script>
|
|
174
|
+
* <script src="cdn/embed.js" async></script>
|
|
175
|
+
* <!-- /Asciify Embed -->
|
|
172
176
|
*/
|
|
173
177
|
declare function generateEmbedCode(frame: AsciiFrame, options: AsciiOptions, width: number, height: number): string;
|
|
174
178
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -160,15 +160,19 @@ declare function asciifyGif(source: string | ArrayBuffer, canvas: HTMLCanvasElem
|
|
|
160
160
|
*/
|
|
161
161
|
declare function asciifyVideo(source: HTMLVideoElement | string, canvas: HTMLCanvasElement, { fontSize, style, options }?: AsciifySimpleOptions): Promise<() => void>;
|
|
162
162
|
/**
|
|
163
|
-
* Generate a clean
|
|
163
|
+
* Generate a clean embed snippet.
|
|
164
164
|
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
165
|
+
* Structure:
|
|
166
|
+
* <canvas id> — the render target, short and clean
|
|
167
|
+
* <script type=json id> — frame data lives here, clearly separated
|
|
168
|
+
* <script src=cdn> — always the same line, cached by browsers
|
|
168
169
|
*
|
|
169
|
-
* Output:
|
|
170
|
-
*
|
|
171
|
-
* <
|
|
170
|
+
* Output (static):
|
|
171
|
+
* <!-- Asciify Embed -->
|
|
172
|
+
* <canvas id="ar-xxx" data-asciify-opts="{…}" width="…" height="…"></canvas>
|
|
173
|
+
* <script type="application/json" id="ar-xxx-d">"BASE64"</script>
|
|
174
|
+
* <script src="cdn/embed.js" async></script>
|
|
175
|
+
* <!-- /Asciify Embed -->
|
|
172
176
|
*/
|
|
173
177
|
declare function generateEmbedCode(frame: AsciiFrame, options: AsciiOptions, width: number, height: number): string;
|
|
174
178
|
/**
|
package/dist/index.js
CHANGED
|
@@ -832,7 +832,7 @@ async function asciifyVideo(source, canvas, { fontSize = 10, style = "classic",
|
|
|
832
832
|
cancelAnimationFrame(animId);
|
|
833
833
|
};
|
|
834
834
|
}
|
|
835
|
-
var EMBED_CDN_VERSION = "1.0.
|
|
835
|
+
var EMBED_CDN_VERSION = "1.0.9";
|
|
836
836
|
function buildEmbedOpts(options, rows, cols, width, height, fps, animated) {
|
|
837
837
|
const o = {
|
|
838
838
|
r: rows,
|
|
@@ -866,7 +866,8 @@ function generateEmbedCode(frame, options, width, height) {
|
|
|
866
866
|
const id = `ar-${Math.random().toString(36).slice(2, 9)}`;
|
|
867
867
|
const opts = buildEmbedOpts(options, rows, cols, width, height);
|
|
868
868
|
return `<!-- Asciify Embed -->
|
|
869
|
-
<canvas
|
|
869
|
+
<canvas id="${id}" data-asciify-opts='${opts}' width="${width}" height="${height}"></canvas>
|
|
870
|
+
<script type="application/json" id="${id}-d">"${data}"</script>
|
|
870
871
|
${CDN_SCRIPT}
|
|
871
872
|
<!-- /Asciify Embed -->`;
|
|
872
873
|
}
|
|
@@ -879,7 +880,8 @@ function generateAnimatedEmbedCode(frames, options, fps, width, height) {
|
|
|
879
880
|
const id = `ar-${Math.random().toString(36).slice(2, 9)}`;
|
|
880
881
|
const opts = buildEmbedOpts(options, rows, cols, width, height, fps, true);
|
|
881
882
|
return `<!-- Asciify Animated Embed -->
|
|
882
|
-
<canvas
|
|
883
|
+
<canvas id="${id}" data-asciify-opts='${opts}' width="${width}" height="${height}"></canvas>
|
|
884
|
+
<script type="application/json" id="${id}-d">${JSON.stringify(allData)}</script>
|
|
883
885
|
${CDN_SCRIPT}
|
|
884
886
|
<!-- /Asciify Animated Embed -->`;
|
|
885
887
|
}
|