@yodaos-pkg/ink-env 0.14.0-daily.202606291604

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/README.md ADDED
@@ -0,0 +1,185 @@
1
+ # @yodaos-pkg/ink-env
2
+
3
+ `@yodaos-pkg/ink-env` provides TypeScript ambient type definitions for the Ink JavaScript runtime environment.
4
+
5
+ It is intended for JavaScript and TypeScript application code that runs inside Ink. The package focuses on the API surface available to app code and intentionally does not document runtime implementation details.
6
+
7
+ ## What This Package Provides
8
+
9
+ - global environment types such as `console`, timers, `fetch`, `WebSocket`, `EventSource`, `navigator`, and `performance`
10
+ - DOM-style event and event target types used by the Ink runtime
11
+ - app-facing framework globals such as `getApp()`, `App`, `Page`, and `Component`
12
+ - the `wx` namespace for mini-program style APIs
13
+ - media, speech, sensor, networking, and AI-related API typings exposed to business logic
14
+ - asset module declarations for common image and audio file types
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install -D @yodaos-pkg/ink-env
20
+ ```
21
+
22
+ This package exposes global declarations. In most cases you do not need to import anything from it.
23
+
24
+ ## TypeScript Setup
25
+
26
+ Add the package to your `tsconfig.json` so TypeScript can load the ambient declarations explicitly:
27
+
28
+ ```json
29
+ {
30
+ "compilerOptions": {
31
+ "types": ["@yodaos-pkg/ink-env"]
32
+ }
33
+ }
34
+ ```
35
+
36
+ If your project already loads all installed type packages automatically, this step may not be necessary.
37
+
38
+ ## API Overview
39
+
40
+ ### Core Globals
41
+
42
+ The environment includes commonly used global APIs such as:
43
+
44
+ - `console`
45
+ - `setTimeout`, `setInterval`, `clearTimeout`, `clearInterval`
46
+ - `requestAnimationFrame`, `cancelAnimationFrame`
47
+ - `atob`, `btoa`
48
+ - `fetch`, `RequestInit`, `Response`
49
+ - `Blob`, `ImageBitmap`, `ImageData`, `createImageBitmap`
50
+ - `window`, `self`, `global`, `performance`
51
+
52
+ Example:
53
+
54
+ ```ts
55
+ setTimeout(() => {
56
+ console.log('hello from Ink');
57
+ }, 16);
58
+ ```
59
+
60
+ ### App And Page APIs
61
+
62
+ The package includes framework-facing globals and instance types used by application code:
63
+
64
+ - `getApp()`
65
+ - `App`
66
+ - `Page`
67
+ - `Component`
68
+
69
+ These types are useful for page logic, component logic, and app-level state access.
70
+
71
+ ### DOM-Style Events
72
+
73
+ Ink application code can use DOM-like event primitives and typed event objects, including:
74
+
75
+ - `EventTarget`
76
+ - `Event`
77
+ - `MessageEvent`
78
+ - `KeyboardEvent`
79
+ - `PointerEvent`
80
+ - `WheelEvent`
81
+ - `FocusEvent`
82
+ - `InputEvent`
83
+
84
+ These declarations are designed for app code that listens to runtime-dispatched events or interacts with event-driven APIs.
85
+
86
+ ### Networking APIs
87
+
88
+ The environment includes typed networking surfaces for both promise-based and streaming use cases:
89
+
90
+ - `fetch()`
91
+ - `WebSocket`
92
+ - `EventSource`
93
+ - `AbortController` and `AbortSignal`
94
+
95
+ Example:
96
+
97
+ ```ts
98
+ const response = await fetch('https://example.com/data');
99
+ const data = await response.json();
100
+ console.log(data);
101
+ ```
102
+
103
+ ### Navigator And Runtime Information
104
+
105
+ The `navigator` typing includes runtime and device-facing information such as:
106
+
107
+ - `navigator.userAgent`
108
+ - `navigator.language`
109
+ - `navigator.languages`
110
+ - `navigator.region`
111
+ - `navigator.versions`
112
+ - `navigator.bluetooth`
113
+
114
+ ### Media And Audio APIs
115
+
116
+ The package includes types for media-related capabilities exposed to app code, such as:
117
+
118
+ - `AudioPlayer`
119
+ - `Sound`
120
+ - `createImageBitmap`
121
+ - recorder and camera APIs under `wx.media`
122
+
123
+ ### Sensors And Speech APIs
124
+
125
+ The environment also includes typed interfaces for selected device capabilities:
126
+
127
+ - `Accelerometer`
128
+ - `Gyroscope`
129
+ - `Magnetometer`
130
+ - `AbsoluteOrientationSensor`
131
+ - `SpeechRecognition`
132
+ - `wx.speech`
133
+
134
+ Availability may depend on the current host environment. The type package describes the supported JavaScript API surface, not host-by-host runtime guarantees.
135
+
136
+ ### AI APIs
137
+
138
+ The package includes AI-related types exposed to application code:
139
+
140
+ - `LanguageModel`
141
+ - `LanguageModelSession`
142
+ - `LanguageModelMessage`
143
+ - `LanguageModelTool`
144
+
145
+ These types are intended for application code that interacts with the host-provided language model capability.
146
+
147
+ ### `wx` Namespace
148
+
149
+ Mini-program style APIs are exposed under the global `wx` namespace. Current type coverage includes areas such as:
150
+
151
+ - base utilities like `wx.canIUse()`
152
+ - window and system information such as `wx.getWindowInfo()`
153
+ - app control such as `wx.exitMiniProgram()`
154
+ - UI helpers such as `wx.setBackgroundColor()`
155
+ - networking APIs such as `wx.request()`, `wx.connectSocket()`, and `wx.createEventSource()`
156
+ - media APIs such as recorder and camera helpers under `wx.media`
157
+ - speech helpers under `wx.speech`
158
+
159
+ Example:
160
+
161
+ ```ts
162
+ const info = wx.getWindowInfo();
163
+ console.log(info.windowWidth, info.windowHeight);
164
+ ```
165
+
166
+ ## What This Package Does Not Cover
167
+
168
+ This README is intentionally focused on the JavaScript and TypeScript API surface available to application code.
169
+
170
+ It does not document:
171
+
172
+ - runtime internals
173
+ - renderer or engine architecture
174
+ - native bridge details
175
+ - package implementation structure
176
+ - host-specific implementation notes that are not part of the exposed API contract
177
+
178
+ ## Files
179
+
180
+ The published package contains:
181
+
182
+ - `index.d.ts`
183
+ - `globals.d.ts`
184
+ - `wx.d.ts`
185
+ - `README.md`