asciify-engine 3.0.0 → 4.1.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/dist/studio.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AmbientMotion } from './ambient-motion-CqF5-eZ2.cjs';
2
- export { M as STUDIO_MOTIONS } from './ambient-motion-CqF5-eZ2.cjs';
1
+ import { S as StudioSettings, a as StudioInput } from './model-aIWlIoDT.cjs';
2
+ export { B as BLEND_MODES, C as CHARACTER_SETS, D as DEFAULT_STUDIO_SETTINGS, b as DITHER_ALGORITHMS, c as DitherAlgorithm, d as STUDIO_CHARACTER_SETS, e as STUDIO_PALETTES, f as STUDIO_STYLES, g as StudioLight, h as StudioMask, i as StudioStyle, n as normalizeStudioSettings, p as parseStudioSettings, s as serializeStudioSettings, j as studioCrop, k as studioDimensions, l as studioGrid, u as updateStudioSettings } from './model-aIWlIoDT.cjs';
3
3
  import * as figlet_fonts_Wavy from 'figlet/fonts/Wavy';
4
4
  import * as figlet_fonts_Univers from 'figlet/fonts/Univers';
5
5
  import * as figlet_fonts_3_D from 'figlet/fonts/3-D';
@@ -21,135 +21,7 @@ import * as figlet_fonts_Big from 'figlet/fonts/Big';
21
21
  import * as figlet_fonts_Small from 'figlet/fonts/Small';
22
22
  import * as figlet_fonts_Slant from 'figlet/fonts/Slant';
23
23
  import * as figlet_fonts_Standard from 'figlet/fonts/Standard';
24
-
25
- /** Serializable, media-independent editing state. No DOM work at import time. */
26
- declare const STUDIO_STYLES: readonly ["ascii", "blocks", "braille", "dots", "lines", "cross", "diagonal", "diamond", "mixed", "pixel", "mosaic", "lego", "voxel", "disco", "dither"];
27
- type StudioStyle = (typeof STUDIO_STYLES)[number];
28
- declare const DITHER_ALGORITHMS: readonly ["none", "bayer2", "bayer4", "bayer8", "bayer16", "floyd-steinberg", "atkinson", "stucki", "sierra", "sierra-lite", "burkes", "jarvis", "halftone", "lines", "noise"];
29
- type DitherAlgorithm = (typeof DITHER_ALGORITHMS)[number];
30
- declare const BLEND_MODES: readonly ["source-over", "multiply", "screen", "overlay", "soft-light", "hard-light", "color-dodge", "color-burn", "hue", "saturation", "color", "luminosity"];
31
- declare const STUDIO_PALETTES: Record<string, readonly string[]>;
32
- interface StudioMask {
33
- kind: "rectangle" | "ellipse" | "brush";
34
- x: number;
35
- y: number;
36
- width: number;
37
- height: number;
38
- points?: [number, number][];
39
- size?: number;
40
- }
41
- interface StudioLight {
42
- x: number;
43
- y: number;
44
- radius: number;
45
- intensity: number;
46
- color: string;
47
- }
48
- interface StudioSettings {
49
- version: 1;
50
- aspectRatio: "original" | "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9";
51
- style: StudioStyle;
52
- cellSize: number;
53
- charset: string;
54
- colorMode: "accent" | "source" | "gray";
55
- ink: string;
56
- crop: {
57
- x: number;
58
- y: number;
59
- zoom: number;
60
- rotation: number;
61
- };
62
- backdrop: {
63
- mode: "solid" | "transparent" | "source" | "blurred" | "gradient";
64
- color: string;
65
- color2: string;
66
- blur: number;
67
- opacity: number;
68
- };
69
- color: {
70
- brightness: number;
71
- contrast: number;
72
- saturation: number;
73
- grayscale: number;
74
- tint: string;
75
- amount: number;
76
- blend: (typeof BLEND_MODES)[number];
77
- };
78
- dither: {
79
- algorithm: DitherAlgorithm;
80
- palette: string;
81
- colors: string[];
82
- amount: number;
83
- scale: number;
84
- threshold: number;
85
- motion: "none" | "drift" | "shimmer";
86
- speed: number;
87
- };
88
- mask: {
89
- enabled: boolean;
90
- invert: boolean;
91
- shapes: StudioMask[];
92
- };
93
- lights: StudioLight[];
94
- effects: {
95
- bloom: number;
96
- characterBloom: number;
97
- grain: number;
98
- dust: number;
99
- scanlines: number;
100
- crt: number;
101
- prism: number;
102
- vignette: number;
103
- glitch: number;
104
- pixelate: number;
105
- blur: number;
106
- blurType: "gaussian" | "directional" | "radial" | "progressive";
107
- angle: number;
108
- focus: number;
109
- halftone: number;
110
- };
111
- motion: {
112
- type: AmbientMotion;
113
- speed: number;
114
- };
115
- hover: {
116
- effect: "none" | "trail" | "water" | "contour" | "dissolve" | "silk" | "vortex";
117
- strength: number;
118
- radius: number;
119
- edgeSafe: boolean;
120
- };
121
- }
122
- declare const DEFAULT_STUDIO_SETTINGS: StudioSettings;
123
- /** Whitelist external settings; reject future versions instead of misinterpreting them. */
124
- declare function normalizeStudioSettings(input?: unknown): StudioSettings;
125
- declare function serializeStudioSettings(settings: StudioSettings): string;
126
- declare function parseStudioSettings(json: string): StudioSettings;
127
- declare function studioCrop(sw: number, sh: number, w: number, h: number, c: StudioSettings["crop"]): {
128
- width: number;
129
- height: number;
130
- x: number;
131
- y: number;
132
- scale: number;
133
- rotated: boolean;
134
- };
135
- /** Dimensions for the saved canvas ratio, including source rotation. */
136
- declare function studioDimensions(width: number, height: number, settings: StudioSettings): [number, number];
137
- /** Partial configuration for mounting and incremental updates. Arrays replace previous arrays. */
138
- type StudioInput = {
139
- [K in keyof StudioSettings]?: StudioSettings[K] extends readonly unknown[] ? StudioSettings[K] : StudioSettings[K] extends object ? Partial<StudioSettings[K]> : StudioSettings[K];
140
- };
141
- declare function updateStudioSettings(current: StudioSettings, patch: StudioInput): StudioSettings;
142
- /** Effective grid and usable cell-size range at a bounded render resolution.
143
- * pixelRatio preserves preview density when exporting at a larger resolution.
144
- */
145
- declare function studioGrid(width: number, height: number, settings: Pick<StudioSettings, 'style' | 'cellSize' | 'dither'>, maxCells?: number, pixelRatio?: number): {
146
- cell: number;
147
- rowHeight: number;
148
- columns: number;
149
- rows: number;
150
- minimum: number;
151
- limited: boolean;
152
- };
24
+ export { M as STUDIO_MOTIONS } from './ambient-motion-CqF5-eZ2.cjs';
153
25
 
154
26
  declare const STUDIO_LOOKS: {
155
27
  id: string;
@@ -171,6 +43,9 @@ declare function createStudioRenderer(canvas: HTMLCanvasElement, settings?: unkn
171
43
  }): {
172
44
  canvas: HTMLCanvasElement;
173
45
  render: (source: StudioSource, time?: number, requestedWidth?: number, requestedHeight?: number, motionTime?: number) => void;
46
+ /** Change raster scale without adding logical cells or remounting media. */
47
+ setPixelRatio(ratio: number): void;
48
+ readonly pixelRatio: number;
174
49
  setBudget(cells: number): void;
175
50
  readonly maxCells: number;
176
51
  configure(input: unknown): void;
@@ -238,12 +113,14 @@ declare function mountStudio(canvas: HTMLCanvasElement, source: File | string, o
238
113
  canvas: HTMLCanvasElement;
239
114
  media: StudioMedia;
240
115
  update(next: StudioInput): void;
241
- resize(w: number, h: number): void;
116
+ resize(w: number, h: number, pixelRatio?: number): void;
242
117
  pause(value?: boolean): void;
243
118
  seek(seconds: number): Promise<void>;
244
119
  redraw(): void;
245
120
  readonly time: number;
246
121
  readonly paused: boolean;
122
+ setBudget(cells: number): void;
123
+ readonly pixelRatio: number;
247
124
  readonly maxCells: number;
248
125
  readonly capabilities: {
249
126
  gpuFinish: boolean;
@@ -255,12 +132,14 @@ declare function mountStudioMedia(canvas: HTMLCanvasElement, media: StudioMedia,
255
132
  canvas: HTMLCanvasElement;
256
133
  media: StudioMedia;
257
134
  update(next: StudioInput): void;
258
- resize(w: number, h: number): void;
135
+ resize(w: number, h: number, pixelRatio?: number): void;
259
136
  pause(value?: boolean): void;
260
137
  seek(seconds: number): Promise<void>;
261
138
  redraw(): void;
262
139
  readonly time: number;
263
140
  readonly paused: boolean;
141
+ setBudget(cells: number): void;
142
+ readonly pixelRatio: number;
264
143
  readonly maxCells: number;
265
144
  readonly capabilities: {
266
145
  gpuFinish: boolean;
@@ -298,40 +177,4 @@ declare function createStudioText(text: string, font?: keyof typeof loaders, ink
298
177
  ascii: string;
299
178
  }>;
300
179
 
301
- /** Curated ASCII ramps. Use custom text to supply a different alphabet. */
302
- declare const STUDIO_CHARACTER_SETS: {
303
- readonly standard: {
304
- readonly label: "Classic ASCII";
305
- readonly chars: " .:-=+*#%@";
306
- };
307
- readonly asciify: {
308
- readonly label: "Asciify";
309
- readonly chars: " .:-=+ASCIIFY#@";
310
- };
311
- readonly minimal: {
312
- readonly label: "Minimal";
313
- readonly chars: " .:+";
314
- };
315
- readonly detailed: {
316
- readonly label: "Detailed";
317
- readonly chars: " .,:;i1tfLCG08@";
318
- };
319
- readonly letters: {
320
- readonly label: "Letters";
321
- readonly chars: " .ilLCFTYASMW";
322
- };
323
- readonly technical: {
324
- readonly label: "Technical";
325
- readonly chars: " .:;>_/[{}]=+*#@$";
326
- };
327
- readonly blocks: {
328
- readonly label: "Tonal blocks";
329
- readonly chars: " ░▒▓█";
330
- };
331
- readonly braille: {
332
- readonly label: "Braille";
333
- readonly chars: " ⠁⠃⠇⡇⣇⣧⣷⣿";
334
- };
335
- };
336
-
337
- export { BLEND_MODES, DEFAULT_STUDIO_SETTINGS, DITHER_ALGORITHMS, type DitherAlgorithm, type MountStudioOptions, STUDIO_CHARACTER_SETS, STUDIO_LOOKS, STUDIO_PALETTES, STUDIO_STYLES, STUDIO_TEXT_FONTS, type StudioExportFormat, type StudioExportOptions, type StudioExportSource, type StudioInput, type StudioLight, type StudioMask, type StudioMedia, type StudioSettings, type StudioSource, type StudioStyle, createStudioRenderer, createStudioText, exportStudio, loadStudioMedia, mountStudio, mountStudioMedia, normalizeStudioSettings, parseStudioSettings, restyleStudio, serializeStudioSettings, studioCrop, studioDimensions, studioGrid, studioLook, studioSourceSize, updateStudioSettings };
180
+ export { type MountStudioOptions, STUDIO_LOOKS, STUDIO_TEXT_FONTS, type StudioExportFormat, type StudioExportOptions, type StudioExportSource, StudioInput, type StudioMedia, StudioSettings, type StudioSource, createStudioRenderer, createStudioText, exportStudio, loadStudioMedia, mountStudio, mountStudioMedia, restyleStudio, studioLook, studioSourceSize };
package/dist/studio.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AmbientMotion } from './ambient-motion-CqF5-eZ2.js';
2
- export { M as STUDIO_MOTIONS } from './ambient-motion-CqF5-eZ2.js';
1
+ import { S as StudioSettings, a as StudioInput } from './model-BJXd0Jl-.js';
2
+ export { B as BLEND_MODES, C as CHARACTER_SETS, D as DEFAULT_STUDIO_SETTINGS, b as DITHER_ALGORITHMS, c as DitherAlgorithm, d as STUDIO_CHARACTER_SETS, e as STUDIO_PALETTES, f as STUDIO_STYLES, g as StudioLight, h as StudioMask, i as StudioStyle, n as normalizeStudioSettings, p as parseStudioSettings, s as serializeStudioSettings, j as studioCrop, k as studioDimensions, l as studioGrid, u as updateStudioSettings } from './model-BJXd0Jl-.js';
3
3
  import * as figlet_fonts_Wavy from 'figlet/fonts/Wavy';
4
4
  import * as figlet_fonts_Univers from 'figlet/fonts/Univers';
5
5
  import * as figlet_fonts_3_D from 'figlet/fonts/3-D';
@@ -21,135 +21,7 @@ import * as figlet_fonts_Big from 'figlet/fonts/Big';
21
21
  import * as figlet_fonts_Small from 'figlet/fonts/Small';
22
22
  import * as figlet_fonts_Slant from 'figlet/fonts/Slant';
23
23
  import * as figlet_fonts_Standard from 'figlet/fonts/Standard';
24
-
25
- /** Serializable, media-independent editing state. No DOM work at import time. */
26
- declare const STUDIO_STYLES: readonly ["ascii", "blocks", "braille", "dots", "lines", "cross", "diagonal", "diamond", "mixed", "pixel", "mosaic", "lego", "voxel", "disco", "dither"];
27
- type StudioStyle = (typeof STUDIO_STYLES)[number];
28
- declare const DITHER_ALGORITHMS: readonly ["none", "bayer2", "bayer4", "bayer8", "bayer16", "floyd-steinberg", "atkinson", "stucki", "sierra", "sierra-lite", "burkes", "jarvis", "halftone", "lines", "noise"];
29
- type DitherAlgorithm = (typeof DITHER_ALGORITHMS)[number];
30
- declare const BLEND_MODES: readonly ["source-over", "multiply", "screen", "overlay", "soft-light", "hard-light", "color-dodge", "color-burn", "hue", "saturation", "color", "luminosity"];
31
- declare const STUDIO_PALETTES: Record<string, readonly string[]>;
32
- interface StudioMask {
33
- kind: "rectangle" | "ellipse" | "brush";
34
- x: number;
35
- y: number;
36
- width: number;
37
- height: number;
38
- points?: [number, number][];
39
- size?: number;
40
- }
41
- interface StudioLight {
42
- x: number;
43
- y: number;
44
- radius: number;
45
- intensity: number;
46
- color: string;
47
- }
48
- interface StudioSettings {
49
- version: 1;
50
- aspectRatio: "original" | "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9";
51
- style: StudioStyle;
52
- cellSize: number;
53
- charset: string;
54
- colorMode: "accent" | "source" | "gray";
55
- ink: string;
56
- crop: {
57
- x: number;
58
- y: number;
59
- zoom: number;
60
- rotation: number;
61
- };
62
- backdrop: {
63
- mode: "solid" | "transparent" | "source" | "blurred" | "gradient";
64
- color: string;
65
- color2: string;
66
- blur: number;
67
- opacity: number;
68
- };
69
- color: {
70
- brightness: number;
71
- contrast: number;
72
- saturation: number;
73
- grayscale: number;
74
- tint: string;
75
- amount: number;
76
- blend: (typeof BLEND_MODES)[number];
77
- };
78
- dither: {
79
- algorithm: DitherAlgorithm;
80
- palette: string;
81
- colors: string[];
82
- amount: number;
83
- scale: number;
84
- threshold: number;
85
- motion: "none" | "drift" | "shimmer";
86
- speed: number;
87
- };
88
- mask: {
89
- enabled: boolean;
90
- invert: boolean;
91
- shapes: StudioMask[];
92
- };
93
- lights: StudioLight[];
94
- effects: {
95
- bloom: number;
96
- characterBloom: number;
97
- grain: number;
98
- dust: number;
99
- scanlines: number;
100
- crt: number;
101
- prism: number;
102
- vignette: number;
103
- glitch: number;
104
- pixelate: number;
105
- blur: number;
106
- blurType: "gaussian" | "directional" | "radial" | "progressive";
107
- angle: number;
108
- focus: number;
109
- halftone: number;
110
- };
111
- motion: {
112
- type: AmbientMotion;
113
- speed: number;
114
- };
115
- hover: {
116
- effect: "none" | "trail" | "water" | "contour" | "dissolve" | "silk" | "vortex";
117
- strength: number;
118
- radius: number;
119
- edgeSafe: boolean;
120
- };
121
- }
122
- declare const DEFAULT_STUDIO_SETTINGS: StudioSettings;
123
- /** Whitelist external settings; reject future versions instead of misinterpreting them. */
124
- declare function normalizeStudioSettings(input?: unknown): StudioSettings;
125
- declare function serializeStudioSettings(settings: StudioSettings): string;
126
- declare function parseStudioSettings(json: string): StudioSettings;
127
- declare function studioCrop(sw: number, sh: number, w: number, h: number, c: StudioSettings["crop"]): {
128
- width: number;
129
- height: number;
130
- x: number;
131
- y: number;
132
- scale: number;
133
- rotated: boolean;
134
- };
135
- /** Dimensions for the saved canvas ratio, including source rotation. */
136
- declare function studioDimensions(width: number, height: number, settings: StudioSettings): [number, number];
137
- /** Partial configuration for mounting and incremental updates. Arrays replace previous arrays. */
138
- type StudioInput = {
139
- [K in keyof StudioSettings]?: StudioSettings[K] extends readonly unknown[] ? StudioSettings[K] : StudioSettings[K] extends object ? Partial<StudioSettings[K]> : StudioSettings[K];
140
- };
141
- declare function updateStudioSettings(current: StudioSettings, patch: StudioInput): StudioSettings;
142
- /** Effective grid and usable cell-size range at a bounded render resolution.
143
- * pixelRatio preserves preview density when exporting at a larger resolution.
144
- */
145
- declare function studioGrid(width: number, height: number, settings: Pick<StudioSettings, 'style' | 'cellSize' | 'dither'>, maxCells?: number, pixelRatio?: number): {
146
- cell: number;
147
- rowHeight: number;
148
- columns: number;
149
- rows: number;
150
- minimum: number;
151
- limited: boolean;
152
- };
24
+ export { M as STUDIO_MOTIONS } from './ambient-motion-CqF5-eZ2.js';
153
25
 
154
26
  declare const STUDIO_LOOKS: {
155
27
  id: string;
@@ -171,6 +43,9 @@ declare function createStudioRenderer(canvas: HTMLCanvasElement, settings?: unkn
171
43
  }): {
172
44
  canvas: HTMLCanvasElement;
173
45
  render: (source: StudioSource, time?: number, requestedWidth?: number, requestedHeight?: number, motionTime?: number) => void;
46
+ /** Change raster scale without adding logical cells or remounting media. */
47
+ setPixelRatio(ratio: number): void;
48
+ readonly pixelRatio: number;
174
49
  setBudget(cells: number): void;
175
50
  readonly maxCells: number;
176
51
  configure(input: unknown): void;
@@ -238,12 +113,14 @@ declare function mountStudio(canvas: HTMLCanvasElement, source: File | string, o
238
113
  canvas: HTMLCanvasElement;
239
114
  media: StudioMedia;
240
115
  update(next: StudioInput): void;
241
- resize(w: number, h: number): void;
116
+ resize(w: number, h: number, pixelRatio?: number): void;
242
117
  pause(value?: boolean): void;
243
118
  seek(seconds: number): Promise<void>;
244
119
  redraw(): void;
245
120
  readonly time: number;
246
121
  readonly paused: boolean;
122
+ setBudget(cells: number): void;
123
+ readonly pixelRatio: number;
247
124
  readonly maxCells: number;
248
125
  readonly capabilities: {
249
126
  gpuFinish: boolean;
@@ -255,12 +132,14 @@ declare function mountStudioMedia(canvas: HTMLCanvasElement, media: StudioMedia,
255
132
  canvas: HTMLCanvasElement;
256
133
  media: StudioMedia;
257
134
  update(next: StudioInput): void;
258
- resize(w: number, h: number): void;
135
+ resize(w: number, h: number, pixelRatio?: number): void;
259
136
  pause(value?: boolean): void;
260
137
  seek(seconds: number): Promise<void>;
261
138
  redraw(): void;
262
139
  readonly time: number;
263
140
  readonly paused: boolean;
141
+ setBudget(cells: number): void;
142
+ readonly pixelRatio: number;
264
143
  readonly maxCells: number;
265
144
  readonly capabilities: {
266
145
  gpuFinish: boolean;
@@ -298,40 +177,4 @@ declare function createStudioText(text: string, font?: keyof typeof loaders, ink
298
177
  ascii: string;
299
178
  }>;
300
179
 
301
- /** Curated ASCII ramps. Use custom text to supply a different alphabet. */
302
- declare const STUDIO_CHARACTER_SETS: {
303
- readonly standard: {
304
- readonly label: "Classic ASCII";
305
- readonly chars: " .:-=+*#%@";
306
- };
307
- readonly asciify: {
308
- readonly label: "Asciify";
309
- readonly chars: " .:-=+ASCIIFY#@";
310
- };
311
- readonly minimal: {
312
- readonly label: "Minimal";
313
- readonly chars: " .:+";
314
- };
315
- readonly detailed: {
316
- readonly label: "Detailed";
317
- readonly chars: " .,:;i1tfLCG08@";
318
- };
319
- readonly letters: {
320
- readonly label: "Letters";
321
- readonly chars: " .ilLCFTYASMW";
322
- };
323
- readonly technical: {
324
- readonly label: "Technical";
325
- readonly chars: " .:;>_/[{}]=+*#@$";
326
- };
327
- readonly blocks: {
328
- readonly label: "Tonal blocks";
329
- readonly chars: " ░▒▓█";
330
- };
331
- readonly braille: {
332
- readonly label: "Braille";
333
- readonly chars: " ⠁⠃⠇⡇⣇⣧⣷⣿";
334
- };
335
- };
336
-
337
- export { BLEND_MODES, DEFAULT_STUDIO_SETTINGS, DITHER_ALGORITHMS, type DitherAlgorithm, type MountStudioOptions, STUDIO_CHARACTER_SETS, STUDIO_LOOKS, STUDIO_PALETTES, STUDIO_STYLES, STUDIO_TEXT_FONTS, type StudioExportFormat, type StudioExportOptions, type StudioExportSource, type StudioInput, type StudioLight, type StudioMask, type StudioMedia, type StudioSettings, type StudioSource, type StudioStyle, createStudioRenderer, createStudioText, exportStudio, loadStudioMedia, mountStudio, mountStudioMedia, normalizeStudioSettings, parseStudioSettings, restyleStudio, serializeStudioSettings, studioCrop, studioDimensions, studioGrid, studioLook, studioSourceSize, updateStudioSettings };
180
+ export { type MountStudioOptions, STUDIO_LOOKS, STUDIO_TEXT_FONTS, type StudioExportFormat, type StudioExportOptions, type StudioExportSource, StudioInput, type StudioMedia, StudioSettings, type StudioSource, createStudioRenderer, createStudioText, exportStudio, loadStudioMedia, mountStudio, mountStudioMedia, restyleStudio, studioLook, studioSourceSize };