@nayan-ui/engine 0.0.0-stage → 1.0.0-beta.4

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 (198) hide show
  1. package/LICENSE +21 -0
  2. package/NayanEngine.podspec +28 -0
  3. package/README.md +308 -2
  4. package/lib/module/assets/AssetBytesCache.js +76 -0
  5. package/lib/module/assets/AssetCache.js +19 -0
  6. package/lib/module/assets/AssetLoader.js +52 -0
  7. package/lib/module/assets/CacheGeneration.js +7 -0
  8. package/lib/module/assets/IndexedDbCache.web.js +149 -0
  9. package/lib/module/assets/ProceduralCache.js +249 -0
  10. package/lib/module/assets/font.js +139 -0
  11. package/lib/module/assets/loft.js +142 -0
  12. package/lib/module/assets/model.js +96 -0
  13. package/lib/module/assets/modelling.js +254 -0
  14. package/lib/module/assets/shape.js +926 -0
  15. package/lib/module/assets/source.js +58 -0
  16. package/lib/module/assets/source.web.js +22 -0
  17. package/lib/module/assets/storage.js +4 -0
  18. package/lib/module/assets/storage.shared.js +38 -0
  19. package/lib/module/assets/storage.web.js +38 -0
  20. package/lib/module/assets/surface.js +47 -0
  21. package/lib/module/assets/texture.js +69 -0
  22. package/lib/module/drawing/DrawingCanvas.js +38 -0
  23. package/lib/module/drawing/DrawingCanvas.web.js +206 -0
  24. package/lib/module/drawing/DrawingDocument.js +256 -0
  25. package/lib/module/drawing/types.js +4 -0
  26. package/lib/module/globals.d.ts +12 -0
  27. package/lib/module/index.js +39 -0
  28. package/lib/module/input/Joystick.js +84 -0
  29. package/lib/module/input/Joystick.web.js +93 -0
  30. package/lib/module/input/keyboard.js +250 -0
  31. package/lib/module/media/audio-worklet.js +34 -0
  32. package/lib/module/media/audio.js +97 -0
  33. package/lib/module/media/haptics.js +82 -0
  34. package/lib/module/media/output.web.js +66 -0
  35. package/lib/module/native/BrowserEngine.js +568 -0
  36. package/lib/module/native/EngineBridge.js +4 -0
  37. package/lib/module/native/NativeNayanEngine.js +7 -0
  38. package/lib/module/native/NativeNayanEngine.web.js +62 -0
  39. package/lib/module/native/prepare.js +7 -0
  40. package/lib/module/native/prepare.web.js +17 -0
  41. package/lib/module/native/spec/NativeNayanEngine.js +17 -0
  42. package/lib/module/package.json +1 -0
  43. package/lib/module/render/GameView.js +317 -0
  44. package/lib/module/render/camera.js +34 -0
  45. package/lib/module/render/host.js +39 -0
  46. package/lib/module/render/host.web.js +104 -0
  47. package/lib/module/render/light.js +24 -0
  48. package/lib/module/render/meshes.js +159 -0
  49. package/lib/module/render/quality.js +119 -0
  50. package/lib/module/render/responder.js +4 -0
  51. package/lib/module/render/responder.web.js +97 -0
  52. package/lib/module/render/touch.js +185 -0
  53. package/lib/module/render/useWorld.js +72 -0
  54. package/lib/module/types.js +30 -0
  55. package/lib/module/world/Scoreboard.js +161 -0
  56. package/lib/module/world/TransformBatch.js +128 -0
  57. package/lib/module/world/World.js +704 -0
  58. package/lib/module/world/color.js +80 -0
  59. package/lib/module/world/desc.js +187 -0
  60. package/lib/module/world/effects.js +463 -0
  61. package/lib/module/world/quat.js +86 -0
  62. package/lib/module/world/types.js +4 -0
  63. package/lib/typescript/package.json +1 -0
  64. package/lib/typescript/src/assets/AssetBytesCache.d.ts +7 -0
  65. package/lib/typescript/src/assets/AssetCache.d.ts +9 -0
  66. package/lib/typescript/src/assets/AssetLoader.d.ts +11 -0
  67. package/lib/typescript/src/assets/CacheGeneration.d.ts +3 -0
  68. package/lib/typescript/src/assets/IndexedDbCache.web.d.ts +20 -0
  69. package/lib/typescript/src/assets/ProceduralCache.d.ts +45 -0
  70. package/lib/typescript/src/assets/font.d.ts +53 -0
  71. package/lib/typescript/src/assets/loft.d.ts +31 -0
  72. package/lib/typescript/src/assets/model.d.ts +58 -0
  73. package/lib/typescript/src/assets/modelling.d.ts +157 -0
  74. package/lib/typescript/src/assets/shape.d.ts +203 -0
  75. package/lib/typescript/src/assets/source.d.ts +10 -0
  76. package/lib/typescript/src/assets/source.web.d.ts +8 -0
  77. package/lib/typescript/src/assets/storage.d.ts +2 -0
  78. package/lib/typescript/src/assets/storage.shared.d.ts +7 -0
  79. package/lib/typescript/src/assets/storage.web.d.ts +7 -0
  80. package/lib/typescript/src/assets/surface.d.ts +17 -0
  81. package/lib/typescript/src/assets/texture.d.ts +30 -0
  82. package/lib/typescript/src/drawing/DrawingCanvas.d.ts +5 -0
  83. package/lib/typescript/src/drawing/DrawingCanvas.web.d.ts +4 -0
  84. package/lib/typescript/src/drawing/DrawingDocument.d.ts +210 -0
  85. package/lib/typescript/src/drawing/types.d.ts +12 -0
  86. package/lib/typescript/src/index.d.ts +45 -0
  87. package/lib/typescript/src/input/Joystick.d.ts +20 -0
  88. package/lib/typescript/src/input/Joystick.web.d.ts +13 -0
  89. package/lib/typescript/src/input/keyboard.d.ts +17 -0
  90. package/lib/typescript/src/media/audio.d.ts +46 -0
  91. package/lib/typescript/src/media/haptics.d.ts +22 -0
  92. package/lib/typescript/src/media/output.web.d.ts +4 -0
  93. package/lib/typescript/src/native/BrowserEngine.d.ts +8 -0
  94. package/lib/typescript/src/native/EngineBridge.d.ts +26 -0
  95. package/lib/typescript/src/native/NativeNayanEngine.d.ts +5 -0
  96. package/lib/typescript/src/native/NativeNayanEngine.web.d.ts +10 -0
  97. package/lib/typescript/src/native/prepare.d.ts +3 -0
  98. package/lib/typescript/src/native/prepare.web.d.ts +2 -0
  99. package/lib/typescript/src/native/spec/NativeNayanEngine.d.ts +211 -0
  100. package/lib/typescript/src/render/GameView.d.ts +107 -0
  101. package/lib/typescript/src/render/camera.d.ts +6 -0
  102. package/lib/typescript/src/render/host.d.ts +29 -0
  103. package/lib/typescript/src/render/host.web.d.ts +16 -0
  104. package/lib/typescript/src/render/light.d.ts +12 -0
  105. package/lib/typescript/src/render/meshes.d.ts +45 -0
  106. package/lib/typescript/src/render/quality.d.ts +48 -0
  107. package/lib/typescript/src/render/responder.d.ts +2 -0
  108. package/lib/typescript/src/render/responder.web.d.ts +40 -0
  109. package/lib/typescript/src/render/touch.d.ts +26 -0
  110. package/lib/typescript/src/render/useWorld.d.ts +20 -0
  111. package/lib/typescript/src/types.d.ts +81 -0
  112. package/lib/typescript/src/world/Scoreboard.d.ts +75 -0
  113. package/lib/typescript/src/world/TransformBatch.d.ts +39 -0
  114. package/lib/typescript/src/world/World.d.ts +207 -0
  115. package/lib/typescript/src/world/color.d.ts +18 -0
  116. package/lib/typescript/src/world/desc.d.ts +17 -0
  117. package/lib/typescript/src/world/effects.d.ts +157 -0
  118. package/lib/typescript/src/world/quat.d.ts +31 -0
  119. package/lib/typescript/src/world/types.d.ts +238 -0
  120. package/lib/web/audio-worklet.js +29 -0
  121. package/lib/web/engine_core_bg.wasm +0 -0
  122. package/lib/web/index.js +8240 -0
  123. package/lib/web/types/src/assets/AssetBytesCache.d.ts +6 -0
  124. package/lib/web/types/src/assets/AssetCache.d.ts +8 -0
  125. package/lib/web/types/src/assets/AssetLoader.d.ts +10 -0
  126. package/lib/web/types/src/assets/CacheGeneration.d.ts +2 -0
  127. package/lib/web/types/src/assets/IndexedDbCache.d.ts +19 -0
  128. package/lib/web/types/src/assets/ProceduralCache.d.ts +44 -0
  129. package/lib/web/types/src/assets/font.d.ts +52 -0
  130. package/lib/web/types/src/assets/loft.d.ts +30 -0
  131. package/lib/web/types/src/assets/model.d.ts +57 -0
  132. package/lib/web/types/src/assets/modelling.d.ts +156 -0
  133. package/lib/web/types/src/assets/shape.d.ts +202 -0
  134. package/lib/web/types/src/assets/source.d.ts +7 -0
  135. package/lib/web/types/src/assets/storage.d.ts +6 -0
  136. package/lib/web/types/src/assets/storage.shared.d.ts +6 -0
  137. package/lib/web/types/src/assets/surface.d.ts +16 -0
  138. package/lib/web/types/src/assets/texture.d.ts +29 -0
  139. package/lib/web/types/src/drawing/DrawingCanvas.d.ts +3 -0
  140. package/lib/web/types/src/drawing/DrawingDocument.d.ts +209 -0
  141. package/lib/web/types/src/drawing/types.d.ts +11 -0
  142. package/lib/web/types/src/index.d.ts +44 -0
  143. package/lib/web/types/src/input/Joystick.d.ts +12 -0
  144. package/lib/web/types/src/input/keyboard.d.ts +16 -0
  145. package/lib/web/types/src/media/audio.d.ts +45 -0
  146. package/lib/web/types/src/media/haptics.d.ts +21 -0
  147. package/lib/web/types/src/media/output.d.ts +3 -0
  148. package/lib/web/types/src/native/BrowserEngine.d.ts +7 -0
  149. package/lib/web/types/src/native/EngineBridge.d.ts +25 -0
  150. package/lib/web/types/src/native/NativeNayanEngine.d.ts +9 -0
  151. package/lib/web/types/src/native/prepare.d.ts +1 -0
  152. package/lib/web/types/src/native/spec/NativeNayanEngine.d.ts +210 -0
  153. package/lib/web/types/src/render/GameView.d.ts +106 -0
  154. package/lib/web/types/src/render/camera.d.ts +5 -0
  155. package/lib/web/types/src/render/host.d.ts +15 -0
  156. package/lib/web/types/src/render/light.d.ts +11 -0
  157. package/lib/web/types/src/render/meshes.d.ts +44 -0
  158. package/lib/web/types/src/render/quality.d.ts +47 -0
  159. package/lib/web/types/src/render/responder.d.ts +39 -0
  160. package/lib/web/types/src/render/touch.d.ts +25 -0
  161. package/lib/web/types/src/render/useWorld.d.ts +19 -0
  162. package/lib/web/types/src/types.d.ts +80 -0
  163. package/lib/web/types/src/world/Scoreboard.d.ts +74 -0
  164. package/lib/web/types/src/world/TransformBatch.d.ts +38 -0
  165. package/lib/web/types/src/world/World.d.ts +206 -0
  166. package/lib/web/types/src/world/color.d.ts +17 -0
  167. package/lib/web/types/src/world/desc.d.ts +16 -0
  168. package/lib/web/types/src/world/effects.d.ts +156 -0
  169. package/lib/web/types/src/world/quat.d.ts +30 -0
  170. package/lib/web/types/src/world/types.d.ts +237 -0
  171. package/native/android/CMakeLists.txt +34 -0
  172. package/native/android/NayanEngineSpec.h +15 -0
  173. package/native/android/build.gradle +26 -0
  174. package/native/android/codegen/CMakeLists.txt +3 -0
  175. package/native/android/proguard-rules.pro +2 -0
  176. package/native/android/src/main/java/com/nayanui/engine/EngineSurfaceView.java +295 -0
  177. package/native/android/src/main/java/com/nayanui/engine/EngineSurfaceViewManager.java +45 -0
  178. package/native/android/src/main/java/com/nayanui/engine/NayanEnginePackage.java +24 -0
  179. package/native/core/build/EngineCore.xcframework/Info.plist +43 -0
  180. package/native/core/build/EngineCore.xcframework/ios-arm64/libengine_core.a +0 -0
  181. package/native/core/build/EngineCore.xcframework/ios-arm64-simulator/libengine_core.a +0 -0
  182. package/native/core/build/android/arm64-v8a/libengine_core.a +0 -0
  183. package/native/core/build/android/armeabi-v7a/libengine_core.a +0 -0
  184. package/native/core/build/android/x86/libengine_core.a +0 -0
  185. package/native/core/build/android/x86_64/libengine_core.a +0 -0
  186. package/native/core/include/drawing-licenses.txt +58 -0
  187. package/native/core/include/engine_core.h +331 -0
  188. package/native/cpp/NayanEngineModule.cpp +998 -0
  189. package/native/cpp/NayanEngineModule.h +174 -0
  190. package/native/cpp/generated/NayanEngineSpecJSI.cpp +2 -0
  191. package/native/cpp/generated/NayanEngineSpecJSI.h +1026 -0
  192. package/native/ios/NayanEngineProvider.h +5 -0
  193. package/native/ios/NayanEngineProvider.mm +21 -0
  194. package/native/ios/NayanEngineSurface.mm +252 -0
  195. package/native/scripts/check-package.mjs +39 -0
  196. package/package.json +162 -4
  197. package/react-native.config.js +18 -0
  198. package/src/native/spec/NativeNayanEngine.ts +265 -0
@@ -0,0 +1,210 @@
1
+ import type { Texture } from '../assets/texture.js';
2
+ export type DrawingBrush = 'NORMAL' | 'MARKER' | 'PENCIL' | 'CALLIGRAPHY' | 'WATERCOLOR' | 'NEON' | 'CRAYON' | 'SPRINKLING';
3
+ export type DrawingShape = 'line' | 'arrow' | 'rectangle' | 'square' | 'rounded-rectangle' | 'circle' | 'ellipse' | 'triangle' | 'right-triangle' | 'diamond' | 'pentagon' | 'hexagon' | 'octagon' | 'star' | 'heart' | 'trapezoid' | 'parallelogram' | 'cross' | 'speech-bubble' | 'cloud';
4
+ export interface DrawingShapePreview {
5
+ kind: DrawingShape;
6
+ name: string;
7
+ path: string;
8
+ filledPath: string;
9
+ canFill: boolean;
10
+ }
11
+ export type DrawingTool = 'brush' | 'fill' | 'picker' | DrawingShape;
12
+ export type DrawingSymmetry = 'none' | 'vertical' | 'horizontal' | 'both';
13
+ export interface DrawingLayer {
14
+ id: number;
15
+ name: string;
16
+ visible: boolean;
17
+ locked: boolean;
18
+ opacity: number;
19
+ }
20
+ export interface DrawingProject {
21
+ version: 2;
22
+ width: number;
23
+ height: number;
24
+ activeLayer: number;
25
+ layers: DrawingLayer[];
26
+ paths: SavedDrawingPath[];
27
+ }
28
+ export interface DrawingBrushOptions {
29
+ brushType: DrawingBrush;
30
+ color: string;
31
+ width: number;
32
+ opacity: number;
33
+ isEraser?: boolean;
34
+ pressure?: boolean;
35
+ smoothing?: number;
36
+ tool?: DrawingTool;
37
+ symmetry?: DrawingSymmetry;
38
+ filled?: boolean;
39
+ tolerance?: number;
40
+ }
41
+ export interface DrawingState {
42
+ controls: DrawingControls;
43
+ count: number;
44
+ canUndo: boolean;
45
+ canRedo: boolean;
46
+ revision: number;
47
+ width: number;
48
+ height: number;
49
+ pixelWidth: number;
50
+ pixelHeight: number;
51
+ zoom: number;
52
+ layers: DrawingLayer[];
53
+ activeLayer: number;
54
+ editable: boolean;
55
+ isDrawing: boolean;
56
+ tool: DrawingTool | null;
57
+ pickedColor: string | null;
58
+ error: string | null;
59
+ }
60
+ /** Native document settings; React may display this snapshot but never owns the tool state. */
61
+ export interface DrawingControls {
62
+ tool: 'brush' | 'eraser' | 'move' | 'shape';
63
+ brushType: DrawingBrush;
64
+ color: string;
65
+ width: number;
66
+ opacity: number;
67
+ shape: DrawingShape;
68
+ filled: boolean;
69
+ pressure: boolean;
70
+ smoothing: number;
71
+ }
72
+ export interface DrawingSnapshot {
73
+ base64: string;
74
+ width: number;
75
+ height: number;
76
+ }
77
+ /** A committed stroke's geometry in document coordinates, for colliders, tracing and scoring. */
78
+ export interface DrawingStroke {
79
+ /** Position in the document's stroke list; pass `index + 1` as `from` to read only newer strokes. */
80
+ index: number;
81
+ layerId: number;
82
+ color: string;
83
+ /** Painted width in document units, including the brush's width factor. */
84
+ width: number;
85
+ opacity: number;
86
+ isEraser: boolean;
87
+ brushType: string;
88
+ /** `fill`: `outline` is the painted shape. `stroke`: `outline` is the centreline. */
89
+ style: 'fill' | 'stroke';
90
+ /** [x, y, width, height] of the painted outline. */
91
+ bounds: [number, number, number, number];
92
+ /**
93
+ * Smoothed gesture centrelines as flat [x0, y0, x1, y1, ...] arrays: one per symmetry copy, for
94
+ * brush strokes drawn this session. Empty for loaded strokes, fills and shapes; use `outline`.
95
+ */
96
+ lines: number[][];
97
+ /** Flattened contours of the painted path as flat [x0, y0, ...] arrays. */
98
+ outline: {
99
+ points: number[];
100
+ closed: boolean;
101
+ }[];
102
+ }
103
+ /** The composited ink under a document point (straight alpha; transparent paper is alpha 0). */
104
+ export interface DrawingSample {
105
+ color: string;
106
+ alpha: number;
107
+ }
108
+ export interface DrawingCoverageOptions {
109
+ /** Document rectangle to measure; defaults to the whole paper. */
110
+ x?: number;
111
+ y?: number;
112
+ width?: number;
113
+ height?: number;
114
+ /** Minimum ink alpha (0..1) that counts as painted. Default 0.5. */
115
+ minAlpha?: number;
116
+ }
117
+ export interface SavedDrawingPath {
118
+ path: string;
119
+ color: string;
120
+ width: number | string;
121
+ opacity?: number;
122
+ style?: 'fill' | 'stroke';
123
+ isEraser?: boolean;
124
+ brushType?: string;
125
+ touchPoints?: unknown[] | null;
126
+ [key: string]: unknown;
127
+ }
128
+ /**
129
+ * A native art document. Touches and live rendering never subscribe to React state.
130
+ *
131
+ * Games use the same document without `DrawingCanvas`: bind `texture()` to any entity, feed
132
+ * `input(..., 'document')` from the game's own touches or world hits, and read `strokes()`,
133
+ * `sample()` and `coverage()` for colliders and scoring. Create one document per game screen and
134
+ * `clear()` it on replay; `dispose()` it on unmount (this also frees its texture).
135
+ */
136
+ export declare class DrawingDocument {
137
+ readonly id: number;
138
+ readonly width: number;
139
+ readonly height: number;
140
+ private disposed;
141
+ private boundTexture;
142
+ constructor(width: number, height: number, pixelRatio?: number);
143
+ get isDisposed(): boolean;
144
+ private call;
145
+ setBrush(options: DrawingBrushOptions): null;
146
+ updateControls(options: Partial<DrawingControls> & {
147
+ reset?: boolean;
148
+ }): DrawingState;
149
+ /** Atomic import: errors leave the current artwork intact, including unknown legacy metadata. */
150
+ load(paths: string | readonly SavedDrawingPath[] | DrawingProject): DrawingState;
151
+ get state(): DrawingState;
152
+ exportPaths(): string;
153
+ /** Rust checks idleness and revision atomically; autosave never finishes a live stroke. */
154
+ setEditingEnabled(enabled: boolean): DrawingState;
155
+ captureDraft(afterRevision?: number): {
156
+ project: string;
157
+ revision: number;
158
+ width: number;
159
+ height: number;
160
+ } | null;
161
+ /** Browser change stream. Native canvases deliver changes directly from their display clock. */
162
+ readChange(): DrawingState | null;
163
+ exportSVG(): string;
164
+ /** Full editable project: preserves layer order, visibility, locks and original SVG metadata. */
165
+ exportProject(): string;
166
+ layer(action: 'add' | 'duplicate' | 'select' | 'update' | 'move' | 'delete' | 'clear', options?: Partial<DrawingLayer> & {
167
+ index?: number;
168
+ }): DrawingState;
169
+ fill(x: number, y: number, tolerance?: number): DrawingState;
170
+ shapeCatalog(): DrawingShapePreview[];
171
+ addShape(kind: DrawingShape, x: number, y: number, endX: number, endY: number, filled?: boolean): DrawingState;
172
+ snapshot(): DrawingSnapshot;
173
+ undo(): DrawingState;
174
+ redo(): DrawingState;
175
+ clear(): DrawingState;
176
+ invalidateView(): DrawingState;
177
+ resetView(): DrawingState;
178
+ /** Fit the full artwork or fill the viewport width without changing saved dimensions. */
179
+ setViewFit(fit: 'contain' | 'width'): DrawingState;
180
+ finish(): DrawingState;
181
+ cancel(): DrawingState;
182
+ /**
183
+ * Feeds one pointer sample: 0 begin, 1 move, 2 end, 3 cancel. `view` coordinates are relative to
184
+ * a `DrawingCanvas` and follow its zoom/pan (browser pointer sampling; native canvases feed
185
+ * touches straight into the Rust core). `document` coordinates skip the view mapping, for games
186
+ * that convert their own touches or world hits (e.g. a raycast's texture UV × document size).
187
+ */
188
+ input(phase: 0 | 1 | 2 | 3, x: number, y: number, pressure?: number, space?: 'view' | 'document'): void;
189
+ /**
190
+ * A live texture of the artwork (transparent paper, straight alpha), usable as any entity's
191
+ * `texture`. In-progress strokes appear immediately; only changed rows are uploaded each frame.
192
+ * Created once per document and freed by `dispose()`. Its pixels are not readable through
193
+ * texture APIs; use `sample()`, `coverage()` or `snapshot()`.
194
+ */
195
+ texture(): Texture;
196
+ /** Committed strokes from index `from`, flattened to `tolerance` document units (default 0.5). */
197
+ strokes(options?: {
198
+ from?: number;
199
+ tolerance?: number;
200
+ }): DrawingStroke[];
201
+ /** The ink under a document point, or null off the paper. Includes an in-progress stroke. */
202
+ sample(x: number, y: number): DrawingSample | null;
203
+ /** Fraction (0..1) of a document rectangle covered by ink, for colouring and scratch-off scoring. */
204
+ coverage(options?: DrawingCoverageOptions): number;
205
+ transform(dx: number, dy: number, scale?: number): DrawingState;
206
+ /** Browser presentation; iOS and Android use native display clocks with automatic suspension. */
207
+ present(width: number, height: number, background?: string, pixelRatio?: number): boolean;
208
+ dispose(): void;
209
+ }
210
+ //# sourceMappingURL=DrawingDocument.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { ViewStyle } from '../render/host';
2
+ import type { DrawingDocument, DrawingState } from './DrawingDocument.js';
3
+ export interface DrawingCanvasProps {
4
+ document: DrawingDocument;
5
+ mode?: 'draw' | 'move' | 'view';
6
+ background?: string;
7
+ active?: boolean;
8
+ onChange?: (state: DrawingState) => void;
9
+ onError?: (error: Error) => void;
10
+ style?: ViewStyle;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,45 @@
1
+ export { World, isEngineAvailable } from './world/World.js';
2
+ export { quat, type MutableQuat } from './world/quat.js';
3
+ export { toColor, type ColorInput } from './world/color.js';
4
+ export { effects, type DustOptions, type EffectOptions, type FlashOptions, type PopOptions } from './world/effects.js';
5
+ export { Scoreboard, type ScoreboardHandlers } from './world/Scoreboard.js';
6
+ export type { AnimateOptions, AnimateTarget, BodyType, Bounds, BurstOptions, CollisionInfo, ClipOptions, ScreenPlane, Color, Easing, Entity, EntityOptions, ImpactFeedback, Keyframe, PhysicsOptions, PickHit, Quat, RaycastHit, SpringOptions } from './world/types.js';
7
+ export { afterNextFrame, GameView } from './render/GameView.js';
8
+ export { useWorld, type WorldSetup } from './render/useWorld.js';
9
+ export { frontLight } from './render/light.js';
10
+ export { warmUpEngine, getMeshIdLimit } from './render/meshes.js';
11
+ export type { TransformBatch, TransformOptions } from './world/TransformBatch.js';
12
+ export type { DragEvent, GameViewProps, GameViewStats, OverlayTouchPhase, PinchEvent, SwipeDirection } from './render/GameView.js';
13
+ export type { RenderQuality, RenderQualitySetting } from './render/quality.js';
14
+ export type { AssetSource } from './assets/source';
15
+ export { loadModel } from './assets/model.js';
16
+ export { clearAssetCache } from './assets/AssetCache.js';
17
+ export { ProceduralCache, type ProceduralStorage } from './assets/ProceduralCache.js';
18
+ export type { Model, ModelOptions, ModelClip, LoadedModel } from './assets/model.js';
19
+ export { loadTexture } from './assets/texture.js';
20
+ export { Solid, solidGeometry, createSolid, optimizeGeometry, createGeometryLods, getGeometryStats, deformGeometry } from './assets/modelling.js';
21
+ export type { DisplacementOptions, SolidOptions, OptimizeOptions, GeometryStats } from './assets/modelling.js';
22
+ export { loft, block, ellipsoid, smoothCurve } from './assets/loft.js';
23
+ export type { LoftSection, LoftOptions } from './assets/loft.js';
24
+ export { parametricSurface } from './assets/surface.js';
25
+ export type { ParametricSurfaceOptions } from './assets/surface.js';
26
+ export type { Texture } from './assets/texture.js';
27
+ export { createShape, extrude, lathe, merge, Path, recolor, shapeGeometry, smoothNormals, tube } from './assets/shape.js';
28
+ export type { ExtrudeOptions, FaceColor, Geometry, LatheOptions, GeometryPart, ShapeOptions, SurfaceColor, SurfacePoint, TubeOptions } from './assets/shape.js';
29
+ export { loadFont, measureText } from './assets/font.js';
30
+ export type { Font, FontOptions, TextAlign, TextLayout } from './assets/font.js';
31
+ export { audio } from './media/audio.js';
32
+ export type { AudioPlayOptions, Sound, SoundBank, SoundSource, Voice } from './media/audio.js';
33
+ export { haptics } from './media/haptics.js';
34
+ export type { HapticTap } from './media/haptics.js';
35
+ export { Joystick, useJoystick } from './input/Joystick';
36
+ export type { JoystickState, JoystickProps } from './input/Joystick';
37
+ export { createKeyboardInput } from './input/keyboard.js';
38
+ export type { KeyboardInputMode, KeyboardInputOptions } from './input/keyboard.js';
39
+ export { MAX_MESHES } from './types.js';
40
+ export type { Camera, Light, RenderSource, Shape, Vec3 } from './types.js';
41
+ export { DrawingDocument } from './drawing/DrawingDocument.js';
42
+ export type { DrawingBrush, DrawingBrushOptions, DrawingControls, DrawingState, DrawingSnapshot, SavedDrawingPath, DrawingTool, DrawingShape, DrawingShapePreview, DrawingSymmetry, DrawingLayer, DrawingProject, DrawingStroke, DrawingSample, DrawingCoverageOptions } from './drawing/DrawingDocument.js';
43
+ export { DrawingCanvas } from './drawing/DrawingCanvas';
44
+ export type { DrawingCanvasProps } from './drawing/DrawingCanvas';
45
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { type ViewStyle } from 'react-native';
2
+ /** Written by `<Joystick>` on touch; read it from your game loop. Each axis is in -1..1, y is up. */
3
+ export type JoystickState = {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ /** A joystick state that lives as long as the component: `const stick = useJoystick()`. */
8
+ export declare function useJoystick(): JoystickState;
9
+ export type JoystickProps = {
10
+ state: JoystickState;
11
+ /** Diameter of the pad in points. */
12
+ size?: number;
13
+ style?: ViewStyle;
14
+ };
15
+ /**
16
+ * A relative touch stick: wherever the finger lands inside the pad is the center.
17
+ * Updates `state` synchronously on the JS thread, so there is no React re-render per touch.
18
+ */
19
+ export declare function Joystick({ state, size, style }: JoystickProps): import("react").JSX.Element;
20
+ //# sourceMappingURL=Joystick.d.ts.map
@@ -0,0 +1,13 @@
1
+ import { type CSSProperties } from 'react';
2
+ export type JoystickState = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export declare function useJoystick(): JoystickState;
7
+ export interface JoystickProps {
8
+ state: JoystickState;
9
+ size?: number;
10
+ style?: CSSProperties;
11
+ }
12
+ export declare function Joystick({ state, size, style }: JoystickProps): import("react").JSX.Element;
13
+ //# sourceMappingURL=Joystick.web.d.ts.map
@@ -0,0 +1,17 @@
1
+ export type KeyboardInputMode = 'pointer' | 'drag' | 'swipe';
2
+ export declare const PRIMARY_INPUT_EVENT = "nayan-engine-primary-action";
3
+ export interface KeyboardInputOptions {
4
+ mode?: KeyboardInputMode;
5
+ enabled?: () => boolean;
6
+ /** Optional primary control, in CSS pixels relative to the input surface. */
7
+ primary?: () => {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ }
12
+ /** Browser keyboard adapter. Reuses pointer input, including engine gestures and raw contact surfaces. */
13
+ export declare function createKeyboardInput(surface: HTMLElement, options?: KeyboardInputOptions): {
14
+ cancel: () => void;
15
+ dispose(): void;
16
+ };
17
+ //# sourceMappingURL=keyboard.d.ts.map
@@ -0,0 +1,46 @@
1
+ import type { AssetSource } from '../assets/source';
2
+ /** A decoded sound in the core's mixer. */
3
+ export type Sound = number & {
4
+ readonly __sound: unique symbol;
5
+ };
6
+ /** A playing instance of a sound (for `audio.stop`). */
7
+ export type Voice = number & {
8
+ readonly __voice: unique symbol;
9
+ };
10
+ export type AudioPlayOptions = {
11
+ /** 0..2. Default 1. */
12
+ volume?: number;
13
+ /** -1 left .. 1 right. Default 0. */
14
+ pan?: number;
15
+ /** Playback speed (also shifts pitch). Default 1. */
16
+ pitch?: number;
17
+ /** Repeat until stopped (music, engines, ambience). */
18
+ loop?: boolean;
19
+ };
20
+ /** A `require("./file.wav")` asset, or a URI. WAV, PCM or float, mono or stereo. */
21
+ export type SoundSource = AssetSource;
22
+ /** Named sounds. Plays are ignored until `ready` resolves (usually a few milliseconds). */
23
+ export declare class SoundBank<K extends string> {
24
+ /** Resolves when every sound has loaded (failures are logged and skipped). */
25
+ readonly ready: Promise<void>;
26
+ private readonly ids;
27
+ constructor(sources: Record<K, SoundSource>);
28
+ /** The sound, once loaded (e.g. for an entity's `impact.sound`). */
29
+ get(name: K): Sound | undefined;
30
+ play(name: K, options?: AudioPlayOptions): Voice | null;
31
+ }
32
+ export declare const audio: {
33
+ /** Initializes the engine and loads named sounds into its mixer. Each asset decodes once per session. */
34
+ load<K extends string>(sources: Record<K, SoundSource>): SoundBank<K>;
35
+ /** Plays a sound (low latency: mixed in Rust on the audio thread). Returns null if it couldn't play. */
36
+ play(sound: Sound, { volume: v, pan, pitch, loop }?: AudioPlayOptions): Voice | null;
37
+ stop(voice: Voice | null | undefined): void;
38
+ muted: boolean;
39
+ /** The inverse of `muted`, matching `haptics.enabled` (e.g. `audio.enabled = settings.enableSounds`). */
40
+ enabled: boolean;
41
+ /** Master volume, 0..2. */
42
+ volume: number;
43
+ /** True once the device's audio output is running. */
44
+ readonly running: boolean;
45
+ };
46
+ //# sourceMappingURL=audio.d.ts.map
@@ -0,0 +1,22 @@
1
+ export type HapticTap = {
2
+ /** Seconds from now. */
3
+ time: number;
4
+ /** 0..1 */
5
+ intensity: number;
6
+ /** 0 (dull thud) .. 1 (crisp click). */
7
+ sharpness: number;
8
+ };
9
+ export declare const haptics: {
10
+ /** Set false to silence all haptics (e.g. a settings toggle). */
11
+ enabled: boolean;
12
+ /** True if the device has a haptic actuator (false on simulators). */
13
+ readonly supported: boolean;
14
+ /** A single tap. Rapid repeats (< 35 ms apart) are dropped so collisions don't buzz. */
15
+ impact(intensity?: number, sharpness?: number): void;
16
+ /** A light, crisp tick for UI selection. */
17
+ selection(): void;
18
+ notify(type: "success" | "warning" | "error"): void;
19
+ /** Any sequence of taps. */
20
+ play(taps: readonly HapticTap[]): void;
21
+ };
22
+ //# sourceMappingURL=haptics.d.ts.map
@@ -0,0 +1,4 @@
1
+ import type { WasmCore } from '../native/BrowserEngine.js';
2
+ /** The Rust mixer remains the source of all audio, including native collision feedback. */
3
+ export declare function installAudioOutput(core: WasmCore): () => boolean;
4
+ //# sourceMappingURL=output.web.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { EngineBridge } from './EngineBridge.js';
2
+ /** Raw C exports are shared with the mobile JSI bridge. All pointers stay private here. */
3
+ export interface WasmCore {
4
+ memory: WebAssembly.Memory;
5
+ [name: string]: unknown;
6
+ }
7
+ export declare function createBrowserEngine(core: WasmCore): EngineBridge;
8
+ //# sourceMappingURL=BrowserEngine.d.ts.map
@@ -0,0 +1,26 @@
1
+ import type { Spec } from './spec/NativeNayanEngine.js';
2
+ /** Geometry returned by the core without registering a renderable mesh. */
3
+ export interface NativeGeometry {
4
+ vertices: ArrayBuffer;
5
+ indices: ArrayBuffer;
6
+ }
7
+ type BufferValue<T, Buffer> = T extends readonly number[] ? T : T extends Promise<unknown> ? T : T extends (...args: never[]) => unknown ? T : T extends object ? Buffer : T;
8
+ type BufferMethod<T> = T extends (...args: infer A) => infer R ? (...args: {
9
+ [K in keyof A]: BufferValue<A[K], ArrayBufferLike>;
10
+ }) => BufferValue<R, ArrayBuffer> : T;
11
+ /** Native-only (a display clock and a render thread): absent on the web core and on older app builds. */
12
+ type NativeFrames = 'publishFrame' | 'renderStats' | 'hasFrameClock' | 'startFrames' | 'stopFrames';
13
+ type BinarySpec = Omit<Spec, 'geometrySolid' | 'geometryOptimize' | 'modelSize' | 'textureSize' | NativeFrames>;
14
+ /** The same runtime ABI on JSI and WASM, with precise TypeScript buffer and tuple contracts. */
15
+ export type EngineBridge = {
16
+ [K in keyof BinarySpec]: BufferMethod<BinarySpec[K]>;
17
+ } & {
18
+ geometrySolid(recipe: string): NativeGeometry;
19
+ geometryOptimize(vertices: ArrayBufferLike, indices: ArrayBufferLike, ratio: number, error: number, lockBorders: boolean): NativeGeometry;
20
+ modelSize(mesh: number): [x: number, y: number, z: number];
21
+ textureSize(texture: number): [width: number, height: number];
22
+ } & {
23
+ [K in NativeFrames]?: BufferMethod<Spec[K]>;
24
+ };
25
+ export {};
26
+ //# sourceMappingURL=EngineBridge.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { EngineBridge } from './EngineBridge.js';
2
+ declare const _default: EngineBridge | null;
3
+ export default _default;
4
+ export type { Spec } from './spec/NativeNayanEngine.js';
5
+ //# sourceMappingURL=NativeNayanEngine.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { EngineBridge } from './EngineBridge.js';
2
+ export declare function prepareEngine(): Promise<void>;
3
+ export declare function readSavedAsset(key: string): Promise<ArrayBuffer | null>;
4
+ export declare function flushAssetStorage(): Promise<void>;
5
+ export declare function clearedAssetStorage(): Promise<void>;
6
+ export declare function attachCanvas(id: number, canvas: HTMLCanvasElement): Promise<void>;
7
+ export declare function detachCanvas(id: number): void;
8
+ declare const browser: EngineBridge;
9
+ export default browser;
10
+ //# sourceMappingURL=NativeNayanEngine.web.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Mobile is initialized by native module registration. */
2
+ export declare function prepareEngine(): Promise<void> | undefined;
3
+ //# sourceMappingURL=prepare.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare function prepareEngine(): Promise<void>;
2
+ //# sourceMappingURL=prepare.web.d.ts.map