textmode.js 0.4.1-beta.1 → 0.6.0-beta.2

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 (106) hide show
  1. package/dist/textmode.esm.js +2578 -1861
  2. package/dist/textmode.esm.min.js +2578 -1861
  3. package/dist/textmode.umd.js +11 -8
  4. package/dist/textmode.umd.min.js +11 -8
  5. package/dist/types/Textmode.d.ts +13 -22
  6. package/dist/types/errors/ErrorHandler.d.ts +6 -1
  7. package/dist/types/index.d.ts +8 -6
  8. package/dist/types/rendering/index.d.ts +3 -3
  9. package/dist/types/rendering/webgl/batching/DrawQueue.d.ts +89 -0
  10. package/dist/types/rendering/webgl/{VAOManager.d.ts → batching/GeometryAttributeCache.d.ts} +4 -4
  11. package/dist/types/rendering/webgl/batching/InstanceAttributeBinder.d.ts +87 -0
  12. package/dist/types/rendering/webgl/{InstanceBatch.d.ts → batching/InstanceBatch.d.ts} +28 -37
  13. package/dist/types/rendering/webgl/batching/InstanceBuffer.d.ts +78 -0
  14. package/dist/types/rendering/webgl/{InstanceData.d.ts → batching/InstanceData.d.ts} +11 -18
  15. package/dist/types/rendering/webgl/batching/InstanceWriter.d.ts +70 -0
  16. package/dist/types/rendering/webgl/{Framebuffer.d.ts → core/Framebuffer.d.ts} +37 -39
  17. package/dist/types/rendering/webgl/core/Renderer.d.ts +64 -0
  18. package/dist/types/rendering/webgl/{Shader.d.ts → core/Shader.d.ts} +2 -23
  19. package/dist/types/rendering/webgl/core/interfaces/IFramebuffer.d.ts +103 -0
  20. package/dist/types/rendering/webgl/core/interfaces/IRenderer.d.ts +210 -0
  21. package/dist/types/rendering/webgl/geometries/{Arc.d.ts → 2d/Arc.d.ts} +5 -4
  22. package/dist/types/rendering/webgl/geometries/{BezierCurve.d.ts → 2d/BezierCurve.d.ts} +5 -4
  23. package/dist/types/rendering/webgl/geometries/{Ellipse.d.ts → 2d/Ellipse.d.ts} +6 -5
  24. package/dist/types/rendering/webgl/geometries/{Line.d.ts → 2d/Line.d.ts} +5 -4
  25. package/dist/types/rendering/webgl/geometries/{Rectangle.d.ts → 2d/Rectangle.d.ts} +5 -4
  26. package/dist/types/rendering/webgl/geometries/{Triangle.d.ts → 2d/Triangle.d.ts} +5 -4
  27. package/dist/types/rendering/webgl/geometries/BaseGeometry.d.ts +30 -26
  28. package/dist/types/rendering/webgl/geometries/immediate/ImmediateQuad.d.ts +33 -0
  29. package/dist/types/rendering/webgl/geometries/index.d.ts +6 -6
  30. package/dist/types/rendering/webgl/geometries/utils/GeometryDescriptors.d.ts +31 -0
  31. package/dist/types/rendering/webgl/geometries/utils/GeometryGenerator.d.ts +16 -0
  32. package/dist/types/rendering/webgl/index.d.ts +15 -14
  33. package/dist/types/rendering/webgl/materials/Material.d.ts +26 -0
  34. package/dist/types/rendering/webgl/materials/MaterialManager.d.ts +63 -0
  35. package/dist/types/rendering/webgl/materials/index.d.ts +2 -0
  36. package/dist/types/rendering/webgl/pipeline/MaterialBatchPipeline.d.ts +63 -0
  37. package/dist/types/rendering/webgl/pipeline/index.d.ts +7 -0
  38. package/dist/types/rendering/webgl/state/RenderState.d.ts +143 -0
  39. package/dist/types/rendering/webgl/types/DrawCommand.d.ts +5 -3
  40. package/dist/types/rendering/webgl/types/GeometryTypes.d.ts +10 -10
  41. package/dist/types/rendering/webgl/types/RenderTypes.d.ts +1 -1
  42. package/dist/types/rendering/webgl/utils/GLUtils.d.ts +45 -0
  43. package/dist/types/rendering/webgl/utils/hash.d.ts +118 -0
  44. package/dist/types/textmode/AnimationController.d.ts +11 -21
  45. package/dist/types/textmode/Canvas.d.ts +10 -2
  46. package/dist/types/textmode/Grid.d.ts +2 -0
  47. package/dist/types/textmode/TextmodeColor.d.ts +57 -0
  48. package/dist/types/textmode/Textmodifier.d.ts +32 -213
  49. package/dist/types/textmode/interfaces/ITextmodifier.d.ts +275 -0
  50. package/dist/types/textmode/interfaces/index.d.ts +1 -0
  51. package/dist/types/textmode/loadables/TextmodeImage.d.ts +47 -0
  52. package/dist/types/textmode/loadables/TextmodeSource.d.ts +130 -0
  53. package/dist/types/textmode/loadables/TextmodeVideo.d.ts +265 -0
  54. package/dist/types/textmode/{font → loadables/font}/CharacterColorMapper.d.ts +1 -1
  55. package/dist/types/textmode/{font → loadables/font}/CharacterExtractor.d.ts +0 -10
  56. package/dist/types/textmode/{font → loadables/font}/TextmodeFont.d.ts +9 -3
  57. package/dist/types/textmode/{font → loadables/font}/TextureAtlas.d.ts +4 -11
  58. package/dist/types/textmode/{font → loadables/font}/typr/types.d.ts +0 -6
  59. package/dist/types/textmode/loadables/index.d.ts +5 -0
  60. package/dist/types/textmode/loading/LoadingPhaseTracker.d.ts +20 -0
  61. package/dist/types/textmode/loading/LoadingScreenManager.d.ts +211 -0
  62. package/dist/types/textmode/loading/LoadingScreenState.d.ts +22 -0
  63. package/dist/types/textmode/loading/LoadingScreenTheme.d.ts +26 -0
  64. package/dist/types/textmode/loading/LoadingScreenTransition.d.ts +17 -0
  65. package/dist/types/textmode/loading/index.d.ts +6 -0
  66. package/dist/types/textmode/loading/templates/SpinnerTemplate.d.ts +2 -0
  67. package/dist/types/textmode/loading/templates/index.d.ts +1 -0
  68. package/dist/types/textmode/loading/types.d.ts +251 -0
  69. package/dist/types/textmode/managers/KeyboardManager.d.ts +2 -3
  70. package/dist/types/textmode/managers/MouseManager.d.ts +1 -1
  71. package/dist/types/textmode/{plugins → managers}/PluginManager.d.ts +18 -16
  72. package/dist/types/textmode/managers/TouchManager.d.ts +0 -2
  73. package/dist/types/textmode/mixins/AnimationMixin.d.ts +2 -122
  74. package/dist/types/textmode/mixins/FontMixin.d.ts +2 -77
  75. package/dist/types/textmode/mixins/KeyboardMixin.d.ts +3 -85
  76. package/dist/types/textmode/mixins/MouseMixin.d.ts +3 -130
  77. package/dist/types/textmode/mixins/RenderingMixin.d.ts +2 -749
  78. package/dist/types/textmode/mixins/TextmodifierMixin.d.ts +2 -44
  79. package/dist/types/textmode/mixins/TouchMixin.d.ts +2 -187
  80. package/dist/types/textmode/mixins/index.d.ts +8 -8
  81. package/dist/types/textmode/mixins/interfaces/IAnimationMixin.d.ts +167 -0
  82. package/dist/types/textmode/mixins/interfaces/IFontMixin.d.ts +46 -0
  83. package/dist/types/textmode/mixins/interfaces/IKeyboardMixin.d.ts +235 -0
  84. package/dist/types/textmode/mixins/interfaces/IMouseMixin.d.ts +457 -0
  85. package/dist/types/textmode/mixins/interfaces/IRenderingMixin.d.ts +1124 -0
  86. package/dist/types/textmode/mixins/interfaces/ITouchMixin.d.ts +186 -0
  87. package/dist/types/textmode/types.d.ts +49 -0
  88. package/dist/types/textmode/utils/cssColor.d.ts +8 -0
  89. package/dist/types/utils/array.d.ts +34 -0
  90. package/dist/types/utils/math.d.ts +69 -0
  91. package/package.json +1 -1
  92. package/dist/types/rendering/webgl/DrawQueue.d.ts +0 -30
  93. package/dist/types/rendering/webgl/RenderPipeline.d.ts +0 -30
  94. package/dist/types/rendering/webgl/RenderState.d.ts +0 -73
  95. package/dist/types/rendering/webgl/Renderer.d.ts +0 -158
  96. package/dist/types/rendering/webgl/ShaderManager.d.ts +0 -66
  97. package/dist/types/rendering/webgl/geometries/NoiseGrid.d.ts +0 -1
  98. package/dist/types/textmode/TextmodeImage.d.ts +0 -161
  99. package/dist/types/textmode/mixins/ShaderMixin.d.ts +0 -1
  100. /package/dist/types/rendering/webgl/{StateCache.d.ts → utils/ViewportCache.d.ts} +0 -0
  101. /package/dist/types/textmode/{font → loadables/font}/MetricsCalculator.d.ts +0 -0
  102. /package/dist/types/textmode/{font → loadables/font}/index.d.ts +0 -0
  103. /package/dist/types/textmode/{font → loadables/font}/types.d.ts +0 -0
  104. /package/dist/types/textmode/{font → loadables/font}/typr/Typr.d.ts +0 -0
  105. /package/dist/types/textmode/{font → loadables/font}/utils/FontTableReader.d.ts +0 -0
  106. /package/dist/types/textmode/{font → loadables/font}/utils/index.d.ts +0 -0
@@ -1,137 +1,10 @@
1
1
  import type { Mixin } from './TextmodifierMixin';
2
- import type { MouseEventHandler, MousePosition } from '../managers/MouseManager';
3
- /**
4
- * Capabilities provided by the MouseMixin
5
- */
6
- export interface MouseCapabilities {
7
- /**
8
- * Set a callback function that will be called when the mouse is clicked.
9
- *
10
- * @param callback The function to call when the mouse is clicked
11
- *
12
- * @example
13
- * ```javascript
14
- * const t = textmode.create({ width: 800, height: 600 });
15
- *
16
- * t.mouseClicked((data) => {
17
- * console.log(`Clicked at grid position: ${data.position.x}, ${data.position.y}`);
18
- * console.log(`Button: ${data.button}`); // 0=left, 1=middle, 2=right
19
- * });
20
- * ```
21
- */
22
- mouseClicked(callback: MouseEventHandler): void;
23
- /**
24
- * Set a callback function that will be called when the mouse is pressed down.
25
- *
26
- * @param callback The function to call when the mouse is pressed
27
- *
28
- * @example
29
- * ```javascript
30
- * const t = textmode.create({ width: 800, height: 600 });
31
- *
32
- * t.mousePressed((data) => {
33
- * console.log(`Mouse pressed at: ${data.position.x}, ${data.position.y}`);
34
- * });
35
- * ```
36
- */
37
- mousePressed(callback: MouseEventHandler): void;
38
- /**
39
- * Set a callback function that will be called when the mouse is released.
40
- *
41
- * @param callback The function to call when the mouse is released
42
- *
43
- * @example
44
- * ```javascript
45
- * const t = textmode.create({ width: 800, height: 600 });
46
- *
47
- * t.mouseReleased((data) => {
48
- * console.log(`Mouse released at: ${data.position.x}, ${data.position.y}`);
49
- * });
50
- * ```
51
- */
52
- mouseReleased(callback: MouseEventHandler): void;
53
- /**
54
- * Set a callback function that will be called when the mouse moves.
55
- *
56
- * @param callback The function to call when the mouse moves
57
- *
58
- * @example
59
- * ```javascript
60
- * const t = textmode.create({ width: 800, height: 600 });
61
- *
62
- * t.mouseMoved((data) => {
63
- * if (data.position.x !== -1 && data.position.y !== -1) {
64
- * console.log(`Mouse moved to: ${data.position.x}, ${data.position.y}`);
65
- * console.log(`Previous position: ${data.previousPosition.x}, ${data.previousPosition.y}`);
66
- * }
67
- * });
68
- * ```
69
- */
70
- mouseMoved(callback: MouseEventHandler): void;
71
- /**
72
- * Set a callback function that will be called when the mouse wheel is scrolled.
73
- *
74
- * @param callback The function to call when the mouse wheel is scrolled
75
- *
76
- * @example
77
- * ```javascript
78
- * const t = textmode.create({ width: 800, height: 600 });
79
- *
80
- * t.mouseScrolled((data) => {
81
- * console.log(`Mouse scrolled at: ${data.position.x}, ${data.position.y}`);
82
- * console.log(`Scroll delta: ${data.delta?.x}, ${data.delta?.y}`);
83
- * });
84
- * ```
85
- */
86
- mouseScrolled(callback: MouseEventHandler): void;
87
- /**
88
- * Get the current mouse position in grid coordinates.
89
- *
90
- * Returns the mouse position as grid cell coordinates *(column, row)*.
91
- *
92
- * If the mouse is outside the grid or the instance is not ready,
93
- * it returns `{ x: -1, y: -1 }`.
94
- *
95
- * @example
96
- * ```javascript
97
- * const t = textmode.create({ width: 800, height: 600 });
98
- *
99
- * t.draw(() => {
100
- * const mousePos = t.mouse;
101
- *
102
- * if (mousePos.x !== -1 && mousePos.y !== -1) {
103
- * // Mouse is over the grid
104
- * t.char('*');
105
- * t.charColor(255, 0, 0);
106
- * t.point(mousePos.x, mousePos.y);
107
- * }
108
- * });
109
- * ```
110
- */
111
- get mouse(): MousePosition;
112
- /**
113
- * Set the mouse cursor for the textmode canvas.
114
- *
115
- * Provide any valid CSS cursor value (e.g. 'default', 'pointer', 'crosshair', 'move', 'text', 'grab', 'grabbing',
116
- * 'none', 'zoom-in', 'zoom-out', 'ns-resize', 'ew-resize', 'nwse-resize', 'nesw-resize', etc.),
117
- * or a CSS `url(...)` cursor. Call with no argument or an empty string to reset to default.
118
- *
119
- * See MDN for all options: https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
120
- *
121
- * @example
122
- * ```javascript
123
- * t.cursor('crosshair');
124
- * // ... later, reset:
125
- * t.cursor();
126
- * ```
127
- */
128
- cursor(cursor?: string): void;
129
- }
2
+ import type { IMouseMixin } from './interfaces/IMouseMixin';
130
3
  /**
131
4
  * Mixin that adds mouse tracking capabilities to Textmodifier.
132
5
  *
133
6
  * This is a thin wrapper around MouseManager that provides the public API
134
7
  * for mouse interaction. All the actual implementation is handled by the
135
- * MouseManager instance in the TextmodifierContext.
8
+ * MouseManager instance in the ITextmodifier.
136
9
  */
137
- export declare const MouseMixin: Mixin<MouseCapabilities>;
10
+ export declare const MouseMixin: Mixin<IMouseMixin>;