textmode.synth.js 1.0.0-beta.1 → 1.0.0-beta.3

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.
Files changed (85) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +104 -121
  3. package/dist/textmode.synth.esm.js +491 -410
  4. package/dist/textmode.synth.umd.js +31 -52
  5. package/dist/types/api/index.d.ts +7 -0
  6. package/dist/types/api/index.d.ts.map +1 -0
  7. package/dist/types/api/sources.d.ts +327 -0
  8. package/dist/types/api/sources.d.ts.map +1 -0
  9. package/dist/types/augmentations/index.d.ts +7 -0
  10. package/dist/types/augmentations/index.d.ts.map +1 -0
  11. package/dist/types/augmentations/textmode.d.ts +65 -0
  12. package/dist/types/augmentations/textmode.d.ts.map +1 -0
  13. package/dist/types/bootstrap.d.ts +11 -0
  14. package/dist/types/bootstrap.d.ts.map +1 -0
  15. package/dist/types/compiler/ExternalLayerManager.d.ts +60 -0
  16. package/dist/types/compiler/ExternalLayerManager.d.ts.map +1 -0
  17. package/dist/types/compiler/FeedbackTracker.d.ts +53 -0
  18. package/dist/types/compiler/FeedbackTracker.d.ts.map +1 -0
  19. package/dist/types/compiler/GLSLGenerator.d.ts +2 -2
  20. package/dist/types/compiler/GLSLGenerator.d.ts.map +1 -1
  21. package/dist/types/compiler/SynthCompiler.d.ts +7 -1
  22. package/dist/types/compiler/SynthCompiler.d.ts.map +1 -1
  23. package/dist/types/compiler/TransformCodeGenerator.d.ts +77 -0
  24. package/dist/types/compiler/TransformCodeGenerator.d.ts.map +1 -0
  25. package/dist/types/compiler/UniformManager.d.ts.map +1 -1
  26. package/dist/types/compiler/index.d.ts +14 -3
  27. package/dist/types/compiler/index.d.ts.map +1 -1
  28. package/dist/types/compiler/types.d.ts +7 -7
  29. package/dist/types/compiler/types.d.ts.map +1 -1
  30. package/dist/types/core/GlobalState.d.ts +30 -0
  31. package/dist/types/core/GlobalState.d.ts.map +1 -0
  32. package/dist/types/core/ISynthSource.d.ts +173 -202
  33. package/dist/types/core/ISynthSource.d.ts.map +1 -1
  34. package/dist/types/core/SynthChain.d.ts +0 -2
  35. package/dist/types/core/SynthChain.d.ts.map +1 -1
  36. package/dist/types/core/SynthSource.d.ts +4 -3
  37. package/dist/types/core/SynthSource.d.ts.map +1 -1
  38. package/dist/types/core/index.d.ts +9 -3
  39. package/dist/types/core/index.d.ts.map +1 -1
  40. package/dist/types/core/types.d.ts +57 -4
  41. package/dist/types/core/types.d.ts.map +1 -1
  42. package/dist/types/extensions/index.d.ts +10 -0
  43. package/dist/types/extensions/index.d.ts.map +1 -0
  44. package/dist/types/extensions/textmodelayer.d.ts +22 -0
  45. package/dist/types/extensions/textmodelayer.d.ts.map +1 -0
  46. package/dist/types/extensions/textmodifier.d.ts +11 -0
  47. package/dist/types/extensions/textmodifier.d.ts.map +1 -0
  48. package/dist/types/index.d.ts +11 -364
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/dist/types/lifecycle/index.d.ts +10 -0
  51. package/dist/types/lifecycle/index.d.ts.map +1 -0
  52. package/dist/types/lifecycle/synthDispose.d.ts +11 -0
  53. package/dist/types/lifecycle/synthDispose.d.ts.map +1 -0
  54. package/dist/types/lifecycle/synthRender.d.ts +11 -0
  55. package/dist/types/lifecycle/synthRender.d.ts.map +1 -0
  56. package/dist/types/{SynthPlugin.d.ts → plugin/SynthPlugin.d.ts} +1 -1
  57. package/dist/types/plugin/SynthPlugin.d.ts.map +1 -0
  58. package/dist/types/plugin/constants.d.ts +5 -0
  59. package/dist/types/plugin/constants.d.ts.map +1 -0
  60. package/dist/types/plugin/index.d.ts +10 -0
  61. package/dist/types/plugin/index.d.ts.map +1 -0
  62. package/dist/types/transforms/TransformDefinition.d.ts +0 -12
  63. package/dist/types/transforms/TransformDefinition.d.ts.map +1 -1
  64. package/dist/types/transforms/TransformFactory.d.ts +4 -7
  65. package/dist/types/transforms/TransformFactory.d.ts.map +1 -1
  66. package/dist/types/transforms/TransformRegistry.d.ts +3 -6
  67. package/dist/types/transforms/TransformRegistry.d.ts.map +1 -1
  68. package/dist/types/transforms/categories/colors.d.ts +1 -1
  69. package/dist/types/transforms/categories/colors.d.ts.map +1 -1
  70. package/dist/types/transforms/categories/combine.d.ts.map +1 -1
  71. package/dist/types/transforms/categories/index.d.ts +3 -4
  72. package/dist/types/transforms/categories/index.d.ts.map +1 -1
  73. package/dist/types/transforms/categories/sources.d.ts.map +1 -1
  74. package/dist/types/{lib → utils}/ArrayUtils.d.ts +20 -5
  75. package/dist/types/utils/ArrayUtils.d.ts.map +1 -0
  76. package/dist/types/utils/CharacterResolver.d.ts.map +1 -1
  77. package/dist/types/utils/collectExternalLayerRefs.d.ts +7 -0
  78. package/dist/types/utils/collectExternalLayerRefs.d.ts.map +1 -0
  79. package/dist/types/utils/index.d.ts +12 -0
  80. package/dist/types/utils/index.d.ts.map +1 -0
  81. package/package.json +16 -9
  82. package/dist/types/SynthPlugin.d.ts.map +0 -1
  83. package/dist/types/lib/ArrayUtils.d.ts.map +0 -1
  84. package/dist/types/transforms/categories/charModifiers.d.ts +0 -16
  85. package/dist/types/transforms/categories/charModifiers.d.ts.map +0 -1
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Type augmentations for textmode.js
3
+ *
4
+ * This module extends the TextmodeLayer and Textmodifier interfaces
5
+ * when the textmode.synth.js package is imported.
6
+ *
7
+ * @module
8
+ */
9
+ import type { SynthSource } from '../core/SynthSource';
10
+ declare module 'textmode.js' {
11
+ interface TextmodeLayer {
12
+ /**
13
+ * Set a synth source for this layer.
14
+ *
15
+ * The synth will render procedurally generated characters and colors
16
+ * directly to the layer's draw framebuffer before the draw callback runs.
17
+ *
18
+ * @param source A SynthSource chain defining the procedural generation
19
+ */
20
+ synth(source: SynthSource): void;
21
+ /**
22
+ * Clear the synth from this layer.
23
+ *
24
+ * This disposes all synth-related resources including the compiled shader
25
+ * and any ping-pong framebuffers used for feedback effects. After calling
26
+ * this method, the layer will no longer render synth content.
27
+ *
28
+ * Use this to reset a layer's synth state without removing the layer itself.
29
+ */
30
+ clearSynth(): void;
31
+ /**
32
+ * Set layer-specific BPM override for array modulation timing.
33
+ *
34
+ * This overrides the global BPM set by `t.bpm()` for this specific layer,
35
+ * allowing polyrhythmic compositions where different layers cycle at
36
+ * different speeds.
37
+ *
38
+ * @param value BPM value (beats per minute) for this layer
39
+ */
40
+ bpm(value: number): void;
41
+ /**
42
+ * Get the unique identifier for this layer.
43
+ *
44
+ * @returns The layer's unique identifier
45
+ */
46
+ get id(): string;
47
+ }
48
+ interface Textmodifier {
49
+ /**
50
+ * Set the global BPM (Beats Per Minute) for array modulation timing.
51
+ *
52
+ * This sets the master tempo for all layers. Individual layers can override
53
+ * this with `layer.bpm(value)` for polyrhythmic compositions.
54
+ *
55
+ * In live coding, BPM controls how fast arrays cycle through their values.
56
+ * By default, BPM is 60, meaning arrays advance 1 element per second.
57
+ * At BPM 120, they advance 2 elements per second.
58
+ *
59
+ * @param value - BPM value (beats per minute)
60
+ * @returns The BPM value that was set (for chaining)
61
+ */
62
+ bpm(value: number): number;
63
+ }
64
+ }
65
+ //# sourceMappingURL=textmode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textmode.d.ts","sourceRoot":"","sources":["../../../src/augmentations/textmode.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,QAAQ,aAAa,CAAC;IAC5B,UAAU,aAAa;QACtB;;;;;;;WAOG;QACH,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;QAEjC;;;;;;;;WAQG;QACH,UAAU,IAAI,IAAI,CAAC;QAEnB;;;;;;;;WAQG;QACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QAEzB;;;;WAIG;QACH,IAAI,EAAE,IAAI,MAAM,CAAC;KACjB;IAED,UAAU,YAAY;QACrB;;;;;;;;;;;;WAYG;QACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;KAC3B;CACD"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Bootstrap module - Initializes the synth system on import.
3
+ *
4
+ * This module handles all side-effect initialization required for
5
+ * the synth system to function. It runs once when the library is imported.
6
+ */
7
+ /**
8
+ * Generated standalone functions for source transforms (e.g., osc(), noise())
9
+ */
10
+ export declare const generatedFunctions: import("./transforms").GeneratedFunctions;
11
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA8BH;;GAEG;AACH,eAAO,MAAM,kBAAkB,2CAAiD,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { ExternalLayerInfo, CompilationTarget } from './types';
2
+ import type { ExternalLayerReference } from '../core/types';
3
+ /**
4
+ * Manages external layer references and uniform prefix generation.
5
+ *
6
+ * When a synth chain references another layer via `src(layer)`, this manager:
7
+ * 1. Generates unique uniform prefixes for the external layer's textures
8
+ * 2. Tracks which textures (char, primary, cellColor) are actually sampled
9
+ * 3. Provides mapping from layer IDs to uniform prefixes for code generation
10
+ */
11
+ export declare class ExternalLayerManager {
12
+ /** Map from layer ID to external layer info */
13
+ private readonly _externalLayers;
14
+ /** Counter for generating unique uniform prefixes */
15
+ private _counter;
16
+ /** Map from layer ID to uniform prefix for consistent naming */
17
+ private readonly _layerIdToPrefix;
18
+ /**
19
+ * Get or create a uniform prefix for an external layer.
20
+ *
21
+ * @param layerId - Unique identifier for the layer
22
+ * @returns The uniform prefix (e.g., 'extLayer0', 'extLayer1')
23
+ */
24
+ getPrefix(layerId: string): string;
25
+ /**
26
+ * Track usage of an external layer's textures.
27
+ *
28
+ * @param ref - The external layer reference
29
+ * @param target - The current compilation target (determines which texture is sampled)
30
+ */
31
+ trackUsage(ref: ExternalLayerReference, target: CompilationTarget): void;
32
+ /**
33
+ * Check if a layer ID has been registered.
34
+ */
35
+ hasLayer(layerId: string): boolean;
36
+ /**
37
+ * Get info for a specific external layer.
38
+ */
39
+ getLayerInfo(layerId: string): ExternalLayerInfo | undefined;
40
+ /**
41
+ * Get all external layer references.
42
+ *
43
+ * @returns A new Map containing all external layer info
44
+ */
45
+ getExternalLayers(): Map<string, ExternalLayerInfo>;
46
+ /**
47
+ * Check if any external layers are referenced.
48
+ */
49
+ get hasExternalLayers(): boolean;
50
+ /**
51
+ * Get the count of external layers.
52
+ */
53
+ get count(): number;
54
+ /**
55
+ * Reset all external layer tracking state.
56
+ * Should be called at the start of each compilation.
57
+ */
58
+ reset(): void;
59
+ }
60
+ //# sourceMappingURL=ExternalLayerManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExternalLayerManager.d.ts","sourceRoot":"","sources":["../../../src/compiler/ExternalLayerManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAChC,+CAA+C;IAC/C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IAExE,qDAAqD;IACrD,OAAO,CAAC,QAAQ,CAAK;IAErB,gEAAgE;IAChE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6B;IAE9D;;;;;OAKG;IACI,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IASzC;;;;;OAKG;IACI,UAAU,CAAC,GAAG,EAAE,sBAAsB,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI;IA+B/E;;OAEG;IACI,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIzC;;OAEG;IACI,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAInE;;;;OAIG;IACI,iBAAiB,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAI1D;;OAEG;IACH,IAAW,iBAAiB,IAAI,OAAO,CAEtC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED;;;OAGG;IACI,KAAK,IAAI,IAAI;CAKpB"}
@@ -0,0 +1,53 @@
1
+ import type { CompilationTarget } from './types';
2
+ /**
3
+ * Feedback usage state returned by the tracker.
4
+ */
5
+ export interface FeedbackUsage {
6
+ /** Whether character color feedback (prevCharColorBuffer) is used */
7
+ usesCharColorFeedback: boolean;
8
+ /** Whether character feedback (prevCharBuffer) is used */
9
+ usesCharFeedback: boolean;
10
+ /** Whether cell color feedback (prevCellColorBuffer) is used */
11
+ usesCellColorFeedback: boolean;
12
+ }
13
+ /**
14
+ * Tracks which feedback textures are used during compilation.
15
+ *
16
+ * The synth system supports three separate feedback buffers:
17
+ * - Character color (character foreground)
18
+ * - Character data (character indices)
19
+ * - Cell color (character background)
20
+ *
21
+ * Each `src()` call samples from a context-aware buffer based on
22
+ * where it appears in the synth chain.
23
+ */
24
+ export declare class FeedbackTracker {
25
+ private _usesFeedback;
26
+ private _usesCharFeedback;
27
+ private _usesCellColorFeedback;
28
+ /**
29
+ * Track feedback usage for a given compilation target.
30
+ * @param target - The current compilation target context
31
+ */
32
+ trackUsage(target: CompilationTarget): void;
33
+ /**
34
+ * Reset all feedback tracking state.
35
+ * Should be called at the start of each compilation.
36
+ */
37
+ reset(): void;
38
+ /**
39
+ * Get the current feedback usage state.
40
+ */
41
+ getUsage(): FeedbackUsage;
42
+ /**
43
+ * Check if any feedback is used.
44
+ */
45
+ get usesAnyFeedback(): boolean;
46
+ /** Whether character color feedback is used */
47
+ get usesCharColorFeedback(): boolean;
48
+ /** Whether character feedback is used */
49
+ get usesCharFeedback(): boolean;
50
+ /** Whether cell color feedback is used */
51
+ get usesCellColorFeedback(): boolean;
52
+ }
53
+ //# sourceMappingURL=FeedbackTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FeedbackTracker.d.ts","sourceRoot":"","sources":["../../../src/compiler/FeedbackTracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC7B,qEAAqE;IACrE,qBAAqB,EAAE,OAAO,CAAC;IAC/B,0DAA0D;IAC1D,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gEAAgE;IAChE,qBAAqB,EAAE,OAAO,CAAC;CAC/B;AAED;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,sBAAsB,CAAS;IAEvC;;;OAGG;IACI,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAgBlD;;;OAGG;IACI,KAAK,IAAI,IAAI;IAMpB;;OAEG;IACI,QAAQ,IAAI,aAAa;IAQhC;;OAEG;IACH,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,+CAA+C;IAC/C,IAAW,qBAAqB,IAAI,OAAO,CAE1C;IAED,yCAAyC;IACzC,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAED,0CAA0C;IAC1C,IAAW,qBAAqB,IAAI,OAAO,CAE1C;CACD"}
@@ -26,9 +26,9 @@ export interface ShaderGenerationOptions {
26
26
  charMapping?: CharacterMapping;
27
27
  /** Whether primary color feedback (src) is used */
28
28
  usesFeedback?: boolean;
29
- /** Whether character feedback (charSrc) is used */
29
+ /** Whether character feedback (src) is used */
30
30
  usesCharFeedback?: boolean;
31
- /** Whether cell color feedback (cellColorSrc) is used */
31
+ /** Whether cell color feedback (src) is used */
32
32
  usesCellColorFeedback?: boolean;
33
33
  /** External layer references used in this shader */
34
34
  externalLayers?: Map<string, ExternalLayerInfo>;
@@ -1 +1 @@
1
- {"version":3,"file":"GLSLGenerator.d.ts","sourceRoot":"","sources":["../../../src/compiler/GLSLGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,2BAA2B;IAC3B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,gCAAgC;IAChC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yDAAyD;IACzD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oDAAoD;IACpD,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAChD;AAuGD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAwG/E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACd,MAAM,CAaR"}
1
+ {"version":3,"file":"GLSLGenerator.d.ts","sourceRoot":"","sources":["../../../src/compiler/GLSLGenerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,2BAA2B;IAC3B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,gCAAgC;IAChC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,4BAA4B;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gDAAgD;IAChD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oDAAoD;IACpD,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAChD;AAuGD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAyG/E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAC1C,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACd,MAAM,CAaR"}
@@ -6,6 +6,13 @@
6
6
  * - Target 0: Character data (indexLow, indexHigh, packedFlags, rotation)
7
7
  * - Target 1: Primary/foreground color (RGBA)
8
8
  * - Target 2: Secondary/cell background color (RGBA)
9
+ *
10
+ * The compilation process is modular, delegating to:
11
+ * - FeedbackTracker: Manages feedback texture usage
12
+ * - ExternalLayerManager: Manages cross-layer sampling
13
+ * - TransformCodeGenerator: Generates GLSL for individual transforms
14
+ * - UniformManager: Manages shader uniforms
15
+ * - GLSLGenerator: Assembles the final shader
9
16
  */
10
17
  import type { SynthSource } from '../core/SynthSource';
11
18
  import type { CompiledSynthShader } from './types';
@@ -16,5 +23,4 @@ import type { CompiledSynthShader } from './types';
16
23
  * @returns A compiled shader with fragment source and uniform definitions
17
24
  */
18
25
  export declare function compileSynthSource(source: SynthSource): CompiledSynthShader;
19
- export type { CompiledSynthShader } from './types';
20
26
  //# sourceMappingURL=SynthCompiler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SynthCompiler.d.ts","sourceRoot":"","sources":["../../../src/compiler/SynthCompiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAgE,MAAM,SAAS,CAAC;AAOjH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,CAG3E;AAigBD,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"SynthCompiler.d.ts","sourceRoot":"","sources":["../../../src/compiler/SynthCompiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAA6C,MAAM,SAAS,CAAC;AAS9F;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,mBAAmB,CAG3E"}
@@ -0,0 +1,77 @@
1
+ import type { ProcessedTransform } from '../transforms/TransformDefinition';
2
+ import type { CompilationTarget } from './types';
3
+ import type { ExternalLayerReference } from '../core/types';
4
+ /**
5
+ * Result of generating code for a transform.
6
+ */
7
+ export interface TransformCodeResult {
8
+ /** The color variable name after this transform */
9
+ colorVar: string;
10
+ /** The character variable name (if modified) */
11
+ charVar?: string;
12
+ /** The flags variable name (if modified) */
13
+ flagsVar?: string;
14
+ /** The rotation variable name (if modified) */
15
+ rotationVar?: string;
16
+ }
17
+ /**
18
+ * Generates GLSL code for individual transforms.
19
+ *
20
+ * This module handles the code generation logic for each transform type,
21
+ * including context-aware function naming for src() operations.
22
+ */
23
+ export declare class TransformCodeGenerator {
24
+ /**
25
+ * Generate a context-aware GLSL function for src().
26
+ *
27
+ * When the transform is 'src', this generates a context-specific GLSL function
28
+ * that samples the appropriate texture based on the current compilation target:
29
+ * - char context → samples prevCharBuffer
30
+ * - charColor/main context → samples prevCharColorBuffer (primary color)
31
+ * - cellColor context → samples prevCellColorBuffer
32
+ *
33
+ * For external layer references, generates a function that samples from
34
+ * the external layer's texture uniforms.
35
+ *
36
+ * @param def - The processed transform definition
37
+ * @param name - The transform name
38
+ * @param currentTarget - The current compilation target
39
+ * @param externalRef - Optional external layer reference
40
+ * @param getExternalPrefix - Function to get external layer uniform prefix
41
+ * @returns The GLSL function code
42
+ */
43
+ getContextAwareGlslFunction(def: ProcessedTransform, name: string, currentTarget: CompilationTarget, externalRef?: ExternalLayerReference, getExternalPrefix?: (layerId: string) => string): string;
44
+ /**
45
+ * Get the function name to call for a transform.
46
+ * Handles context-aware naming for src() operations.
47
+ */
48
+ getFunctionName(def: ProcessedTransform, currentTarget: CompilationTarget, externalRef?: ExternalLayerReference, getExternalPrefix?: (layerId: string) => string): string;
49
+ /**
50
+ * Generate GLSL code for a transform and append to mainCode.
51
+ *
52
+ * @param mainCode - Array to append generated code lines
53
+ * @param def - The processed transform definition
54
+ * @param varId - Unique variable ID for this transform
55
+ * @param coordVar - Current coordinate variable name
56
+ * @param colorVar - Current color variable name
57
+ * @param charVar - Current character variable name (if any)
58
+ * @param flagsVar - Current flags variable name (if any)
59
+ * @param rotationVar - Current rotation variable name (if any)
60
+ * @param args - Processed argument strings
61
+ * @param currentTarget - Current compilation target
62
+ * @param nestedColorVar - Nested source color variable (for combine ops)
63
+ * @param externalRef - External layer reference (if any)
64
+ * @param getExternalPrefix - Function to get external layer prefix
65
+ * @returns The transform code result with updated variable names
66
+ */
67
+ generateTransformCode(mainCode: string[], def: ProcessedTransform, varId: number, coordVar: string, colorVar: string, charVar: string | undefined, flagsVar: string | undefined, rotationVar: string | undefined, args: string[], currentTarget: CompilationTarget, nestedColorVar?: string, externalRef?: ExternalLayerReference, getExternalPrefix?: (layerId: string) => string): TransformCodeResult;
68
+ /**
69
+ * Generate GLSL function for external layer src().
70
+ */
71
+ private _generateExternalSrcFunction;
72
+ /**
73
+ * Generate GLSL function for self-feedback src().
74
+ */
75
+ private _generateSelfFeedbackSrcFunction;
76
+ }
77
+ //# sourceMappingURL=TransformCodeGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransformCodeGenerator.d.ts","sourceRoot":"","sources":["../../../src/compiler/TransformCodeGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAYD;;;;;GAKG;AACH,qBAAa,sBAAsB;IAClC;;;;;;;;;;;;;;;;;;OAkBG;IACI,2BAA2B,CACjC,GAAG,EAAE,kBAAkB,EACvB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,iBAAiB,EAChC,WAAW,CAAC,EAAE,sBAAsB,EACpC,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAC7C,MAAM;IAcT;;;OAGG;IACI,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EAAE,cAAc,EACrB,MAAM,EAAE,MAAM,GACZ,iBAAiB;IAwEpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAUtB;;OAEG;IACI,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC;IAI/C;;OAEG;IACI,kBAAkB,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC;IAIlF;;OAEG;IACI,KAAK,IAAI,IAAI;CAIpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9C"}
@@ -1,9 +1,20 @@
1
1
  /**
2
2
  * Compiler module exports.
3
+ *
4
+ * The compiler system is modular, with responsibilities split across:
5
+ * - SynthCompiler: Main compilation orchestration
6
+ * - FeedbackTracker: Feedback texture usage tracking
7
+ * - ExternalLayerManager: Cross-layer sampling management
8
+ * - TransformCodeGenerator: Individual transform code generation
9
+ * - UniformManager: Shader uniform handling
10
+ * - GLSLGenerator: Final shader assembly
3
11
  */
4
12
  export * from './types';
5
- export * from './UniformManager';
6
- export * from './GLSLGenerator';
7
13
  export { compileSynthSource } from './SynthCompiler';
8
- export type { CompiledSynthShader } from './SynthCompiler';
14
+ export type { CompiledSynthShader } from './types';
15
+ export { FeedbackTracker, type FeedbackUsage } from './FeedbackTracker';
16
+ export { ExternalLayerManager } from './ExternalLayerManager';
17
+ export { TransformCodeGenerator, type TransformCodeResult } from './TransformCodeGenerator';
18
+ export { UniformManager } from './UniformManager';
19
+ export * from './GLSLGenerator';
9
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compiler/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compiler/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,cAAc,iBAAiB,CAAC"}
@@ -6,9 +6,9 @@ import type { SynthUniform, SynthContext, CharacterMapping } from '../core/types
6
6
  * Compilation target context determining which texture `src()` samples from.
7
7
  *
8
8
  * - `char`: Compiling a character source chain → src() samples prevCharBuffer
9
- * - `charColor`: Compiling a character color chain → src() samples prevBuffer (primary color)
9
+ * - `charColor`: Compiling a character color chain → src() samples prevCharColorBuffer
10
10
  * - `cellColor`: Compiling a cell color chain → src() samples prevCellColorBuffer
11
- * - `main`: Compiling the main chain → src() samples prevBuffer (primary color)
11
+ * - `main`: Compiling the main chain → src() samples prevCharColorBuffer
12
12
  */
13
13
  export type CompilationTarget = 'char' | 'charColor' | 'cellColor' | 'main';
14
14
  /**
@@ -23,7 +23,7 @@ export interface ExternalLayerInfo {
23
23
  /** Whether the character texture is sampled */
24
24
  usesChar: boolean;
25
25
  /** Whether the primary color texture is sampled */
26
- usesPrimary: boolean;
26
+ usesCharColor: boolean;
27
27
  /** Whether the cell color texture is sampled */
28
28
  usesCellColor: boolean;
29
29
  }
@@ -39,11 +39,11 @@ export interface CompiledSynthShader {
39
39
  dynamicUpdaters: Map<string, (ctx: SynthContext) => number | number[]>;
40
40
  /** Character mapping if charMap was used */
41
41
  charMapping?: CharacterMapping;
42
- /** Whether this shader uses feedback (src/prev) - reads from prevBuffer */
43
- usesFeedback: boolean;
44
- /** Whether this shader uses character feedback (charSrc) - reads from prevCharBuffer */
42
+ /** Whether this shader uses character color feedback (src) - reads from prevCharColorBuffer */
43
+ usesCharColorFeedback: boolean;
44
+ /** Whether this shader uses character feedback (src) - reads from prevCharBuffer */
45
45
  usesCharFeedback: boolean;
46
- /** Whether this shader uses cell color feedback (cellColorSrc) - reads from prevCellColorBuffer */
46
+ /** Whether this shader uses cell color feedback (src) - reads from prevCellColorBuffer */
47
47
  usesCellColorFeedback: boolean;
48
48
  /** External layer references used in this shader, keyed by layer ID */
49
49
  externalLayers: Map<string, ExternalLayerInfo>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/compiler/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,MAAM,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,QAAQ,EAAE,OAAO,CAAC;IAClB,mDAAmD;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,gDAAgD;IAChD,aAAa,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,sCAAsC;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,qDAAqD;IACrD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACp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ACtB,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,wCAAwC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,yBAAyB;IACzB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,+BAA+B;IAC/B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CACvE"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Global state for textmode.synth.js.
3
+ *
4
+ * This module maintains global configuration that affects all layers,
5
+ * such as the master BPM for array modulation timing.
6
+ */
7
+ /**
8
+ * Set the global BPM for all layers.
9
+ *
10
+ * This sets the master tempo for array cycling. Layers will use this value
11
+ * unless they have a layer-specific BPM set via layer.bpm().
12
+ *
13
+ * @param value - BPM value (beats per minute)
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Set global tempo to 120 BPM (2 beats per second)
18
+ * t.bpm(120);
19
+ *
20
+ * // All layers will now cycle through arrays at this speed
21
+ * t.layers.base.synth(osc([1, 2, 4, 8])); // Cycles twice as fast as default
22
+ * ```
23
+ */
24
+ export declare function setGlobalBpm(value: number): void;
25
+ /**
26
+ * Get the current global BPM.
27
+ * @returns Current global BPM value
28
+ */
29
+ export declare function getGlobalBpm(): number;
30
+ //# sourceMappingURL=GlobalState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalState.d.ts","sourceRoot":"","sources":["../../../src/core/GlobalState.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC"}