@yodaos-pkg/ink 0.3.0 → 0.6.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/index.d.ts DELETED
@@ -1,166 +0,0 @@
1
- export type BundleFileInput = string | Uint8Array | ArrayBuffer | ArrayBufferView;
2
-
3
- export type BundleFiles =
4
- | Map<string, BundleFileInput>
5
- | Array<[string, BundleFileInput]>
6
- | Record<string, BundleFileInput>;
7
-
8
- export interface InitInkOptions {
9
- wasmUrl?: string | URL | Request;
10
- moduleOrPath?: RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
11
- proxyUrl?: string;
12
- targetSearchParam?: string;
13
- requestInterceptor?: InkRequestInterceptor;
14
- }
15
-
16
- export interface CreateInkViewOptions {
17
- width: number;
18
- height: number;
19
- scaleFactor?: number;
20
- canvas?: HTMLCanvasElement;
21
- wasm?: InitInkOptions;
22
- }
23
-
24
- export interface OpenBundleOptions {
25
- appId: string;
26
- files: BundleFiles;
27
- initialPage?: string | null;
28
- query?: string | Record<string, unknown> | null;
29
- }
30
-
31
- export interface LoadBundleFromVfsOptions {
32
- appId: string;
33
- baseUrl: string;
34
- fetch?: typeof globalThis.fetch;
35
- signal?: AbortSignal;
36
- headers?: HeadersInit;
37
- requestInterceptor?: InkRequestInterceptor;
38
- }
39
-
40
- export interface OpenFromVfsOptions extends LoadBundleFromVfsOptions {
41
- initialPage?: string | null;
42
- query?: string | Record<string, unknown> | null;
43
- }
44
-
45
- export interface InkInterceptedRequest {
46
- url: string;
47
- method: string;
48
- headers: Record<string, string>;
49
- body: BodyInit | ArrayBuffer | ArrayBufferView | Uint8Array | null;
50
- metadata: Record<string, unknown>;
51
- }
52
-
53
- export type InkInterceptedRequestAction =
54
- | { action?: 'continue' }
55
- | {
56
- action: 'rewrite';
57
- url?: string;
58
- method?: string;
59
- headers?: HeadersInit | Record<string, string>;
60
- body?: BodyInit | ArrayBuffer | ArrayBufferView | Uint8Array | null;
61
- }
62
- | {
63
- action: 'block';
64
- reason?: string;
65
- };
66
-
67
- export type InkRequestInterceptor = (
68
- request: InkInterceptedRequest,
69
- ) => InkInterceptedRequestAction | Promise<InkInterceptedRequestAction>;
70
-
71
- export interface ConfigureNetworkOptions {
72
- proxyUrl?: string;
73
- targetSearchParam?: string;
74
- interceptor?: InkRequestInterceptor;
75
- clear?: boolean;
76
- }
77
-
78
- export interface VfsManifestEntry {
79
- path: string;
80
- size?: number;
81
- contentType?: string;
82
- etag?: string;
83
- }
84
-
85
- export interface VfsManifest {
86
- appId: string;
87
- files: VfsManifestEntry[];
88
- }
89
-
90
- export interface LoadedVfsBundle {
91
- appId: string;
92
- manifest: VfsManifest;
93
- files: Map<string, Uint8Array>;
94
- }
95
-
96
- export interface BindDomEventsOptions {
97
- canvas?: HTMLCanvasElement;
98
- keyboardTarget?: EventTarget | null;
99
- focusTarget?: HTMLElement | HTMLCanvasElement | null;
100
- preventWheelDefault?: boolean;
101
- }
102
-
103
- export declare function initInk(options?: InitInkOptions): Promise<{
104
- InkWebView: unknown;
105
- getInkVersion: () => string;
106
- }>;
107
-
108
- export declare function getInkVersion(): string;
109
-
110
- export declare function normalizeBundleFiles(files: BundleFiles): Map<string, Uint8Array>;
111
-
112
- export declare function serializeQuery(
113
- query: string | Record<string, unknown> | null | undefined,
114
- ): string | null;
115
-
116
- export declare function createProxyUrlResolver(options: {
117
- proxyUrl: string;
118
- targetSearchParam?: string;
119
- }): InkRequestInterceptor;
120
-
121
- export declare function setInkRequestInterceptor(
122
- interceptor: InkRequestInterceptor | null | undefined,
123
- ): void;
124
-
125
- export declare function clearInkRequestInterceptor(): void;
126
-
127
- export declare function configureNetwork(options?: ConfigureNetworkOptions): void;
128
-
129
- export declare function createVfsUrls(input: { baseUrl: string; appId: string }): {
130
- manifestUrl: string;
131
- fileUrl(filePath: string): string;
132
- };
133
-
134
- export declare function loadBundleFromVfs(
135
- options: LoadBundleFromVfsOptions,
136
- ): Promise<LoadedVfsBundle>;
137
-
138
- export declare class InkView {
139
- static create(options: CreateInkViewOptions): Promise<InkView>;
140
- bindCanvas(canvas: HTMLCanvasElement): this;
141
- bindDomEvents(options?: BindDomEventsOptions): () => void;
142
- openBundle(options: OpenBundleOptions): this;
143
- openFromVfs(options: OpenFromVfsOptions): Promise<LoadedVfsBundle>;
144
- resize(width: number, height: number, scaleFactor?: number): this;
145
- focus(): this;
146
- blur(): this;
147
- notifyUserInteraction(): this;
148
- render(): boolean;
149
- requestRender(): this;
150
- startRendering(): this;
151
- stopRendering(): this;
152
- isRunning(): boolean;
153
- destroy(): void;
154
- }
155
-
156
- export declare function createInkView(options: CreateInkViewOptions): Promise<InkView>;
157
-
158
- export declare function createFrameworkBindings(): {
159
- ensureLeadingSlash(path: string): string;
160
- initInk: typeof initInk;
161
- createInkView: typeof createInkView;
162
- configureNetwork: typeof configureNetwork;
163
- setInkRequestInterceptor: typeof setInkRequestInterceptor;
164
- clearInkRequestInterceptor: typeof clearInkRequestInterceptor;
165
- createProxyUrlResolver: typeof createProxyUrlResolver;
166
- };
package/dist/package.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "name": "@yodaos-pkg/ink",
3
- "version": "0.1.0",
4
- "description": "Ink Web SDK for browser rendering and VFS-backed app loading",
5
- "type": "module",
6
- "main": "index.js",
7
- "types": "index.d.ts",
8
- "files": [
9
- "*"
10
- ],
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/jsar-project/ink"
14
- },
15
- "license": "ISC",
16
- "publishConfig": {
17
- "access": "public",
18
- "registry": "https://registry.npmjs.com/"
19
- }
20
- }
@@ -1,34 +0,0 @@
1
- # ink-web
2
-
3
- `ink-web` provides WebAssembly (Wasm) bindings.
4
-
5
- ## Features
6
-
7
- This package compiles the Ink engine into Wasm, enabling it to run in modern web browsers:
8
-
9
- - **Wasm Bindings**: Utilizes `wasm-bindgen` to implement interoperability between Rust code and Web APIs.
10
- - **Web Rendering**: Bridges Ink's drawing instructions to Web Canvas or WebGL.
11
-
12
- ## Running Locally
13
-
14
- 1. Build the demo:
15
-
16
- ```bash
17
- ./build.sh
18
- ```
19
-
20
- 2. Start the bundled Node static server:
21
-
22
- ```bash
23
- npm run dev --prefix playground
24
- ```
25
-
26
- 3. Open:
27
-
28
- ```text
29
- http://localhost:8080
30
- ```
31
-
32
- The playground host configures a same-origin `/__proxy` interceptor example for
33
- external HTTP resources. This proxy behavior is no longer hard-coded inside
34
- `ink-web`; hosts now opt into request interception explicitly from the SDK side.
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }