@ouidesigner/ouider 0.3.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.
@@ -0,0 +1,1245 @@
1
+ import RouteParser from 'route-parser';
2
+
3
+ type ProvideFunction<T> = () => T;
4
+ type Provider<T = any> = {
5
+ value?: T;
6
+ provide?: ProvideFunction<T>;
7
+ };
8
+ interface Plugin<T> {
9
+ install(app: App, options?: T): void;
10
+ }
11
+ /** Injection token key */
12
+ type InjectionKey = string;
13
+ /** Providers type */
14
+ type Providers = Map<InjectionKey, Provider>;
15
+ /**
16
+ * OUIDesigner App
17
+ */
18
+ declare class App {
19
+ private root;
20
+ private options?;
21
+ static currentApp: App | null;
22
+ private providers;
23
+ /**
24
+ * Provide a value through a key to all the app globally
25
+ * @param token the registration key
26
+ * @param value the provider value
27
+ */
28
+ provide<T>(token: InjectionKey, value: T | (() => T)): void;
29
+ /**
30
+ * Get globally a provider through a given key
31
+ * @param token the key to look up globally
32
+ * @returns a provider value
33
+ */
34
+ inject<T>(token: InjectionKey): T | undefined;
35
+ /**
36
+ * Register a plugin to be used by this app
37
+ * @param plugin the plugin to register
38
+ * @returns `this` App instance
39
+ */
40
+ use<T>(plugin: Plugin<T>, options?: T): this;
41
+ constructor(root: ComponentConstructor<any, any>, options?: {
42
+ css?: string;
43
+ } | undefined);
44
+ /**
45
+ * Mount the App in a host element
46
+ * @param selector the host element where the app's root component should be mounted
47
+ */
48
+ mount(selector: string): Promise<void>;
49
+ }
50
+ /**
51
+ * Provide a value through a key to all the app globally
52
+ * @param token the registration key
53
+ * @param value the provider value
54
+ */
55
+ declare function provide<T>(token: InjectionKey, value: T | (() => T)): void;
56
+ /**
57
+ * Get globally a provider through a given key
58
+ * @param token the key to look up globally
59
+ * @returns a provider value
60
+ */
61
+ declare function inject<T>(token: InjectionKey): T | undefined;
62
+
63
+ type QueryFilter = "children" | "classes" | "style" | "attributes";
64
+ declare namespace ODOM {
65
+ export class BatchActions {
66
+ private actions;
67
+ constructor();
68
+ exec(): Promise<any>;
69
+ add(action: () => void): this;
70
+ commit(): Promise<void>;
71
+ }
72
+ export class BatchUpdates {
73
+ private node;
74
+ private operations;
75
+ constructor(node: OObject);
76
+ accept(other: BatchUpdates): void;
77
+ exec(immediate?: boolean): Promise<any>;
78
+ private append;
79
+ add(fn: keyof OElement, node?: OObject, ...args: any[]): BatchUpdates;
80
+ add(fn: () => any): BatchUpdates;
81
+ addEventListener(event: string, callback: (...args: any[]) => void, options?: EventListenerOptions, policy?: EventControlPolicy): BatchUpdates;
82
+ setProperty(key: string, value: any): BatchUpdates;
83
+ dettachEventListener(cbId: string): BatchUpdates;
84
+ invoke(fn: string, ...args: any[]): BatchUpdates;
85
+ dispatchEvent(eventName: string, eventClass?: string, initDict?: any): BatchUpdates;
86
+ addClass(...tokens: string[]): BatchUpdates;
87
+ removeClass(...tokens: string[]): BatchUpdates;
88
+ setAttribute(name: string, value: string): BatchUpdates;
89
+ removeAttribute(name: string): BatchUpdates;
90
+ appendChild(child: ONode): BatchUpdates;
91
+ removeChild(child: ONode): BatchUpdates;
92
+ remove(): BatchUpdates;
93
+ removeAndRelease(): BatchUpdates;
94
+ release(): BatchUpdates;
95
+ innerHTML(html: string): BatchUpdates;
96
+ replaceChildNode(node: ONode, child: ONode): BatchUpdates;
97
+ replaceWith(node: ONode): BatchUpdates;
98
+ after(toInsert: ONode): BatchUpdates;
99
+ setInnerText(text: string): BatchUpdates;
100
+ setContentText(text: string): BatchUpdates;
101
+ insertBefore(node: ONode, element: ONode): BatchUpdates;
102
+ setInputValue(value: string): BatchUpdates;
103
+ setStyle(key: string, value: any): BatchUpdates;
104
+ }
105
+ export type NodeType = 'Element' | 'Text' | 'Comment' | 'Attribute' | 'Unknown';
106
+ type Attributes = {
107
+ name: string;
108
+ value: string;
109
+ }[];
110
+ export class OObject {
111
+ uid: string;
112
+ tag: string;
113
+ constructor(uid: string, tag: string);
114
+ static toInstance(obj: OObject): OObject;
115
+ release(): Promise<void>;
116
+ addEventListener(event: string, callback: (...args: any[]) => void, extra?: {
117
+ options?: EventListenerOptions;
118
+ policy?: EventControlPolicy;
119
+ }): Promise<string>;
120
+ dettachEventListener(cbId: string): Promise<void>;
121
+ invoke<T>(fn: string, ...args: any[]): Promise<T | null>;
122
+ invokeAndHold(fn: string, ...args: any[]): Promise<OObject | null>;
123
+ getProperty<T>(name: string): Promise<T | null>;
124
+ getPropertyAndHold<T>(name: string): Promise<OObject | null>;
125
+ setProperty<T>(name: string, value: T): Promise<void>;
126
+ indexAccessAndHold(index: number): Promise<OObject | null>;
127
+ indexAccess(index: number): Promise<unknown>;
128
+ dispatchEvent(eventName: string, eventClass?: string, initDict?: any): Promise<void>;
129
+ updates(): BatchUpdates;
130
+ batches(): BatchUpdates;
131
+ get ref(): {
132
+ __ref__: string;
133
+ };
134
+ }
135
+ export abstract class ONode extends OObject {
136
+ textContent?: string | null;
137
+ type: NodeType;
138
+ attributes: Attributes;
139
+ children?: ONode[];
140
+ classes?: string[];
141
+ style?: string;
142
+ constructor(node: OObject);
143
+ }
144
+ export class OElement extends ONode {
145
+ private _hydrated;
146
+ constructor(node: OObject);
147
+ addClass(...tokens: string[]): Promise<void>;
148
+ removeClass(...tokens: string[]): Promise<void>;
149
+ setAttribute(name: string, value: string): Promise<void>;
150
+ removeAttribute(name: string): Promise<void>;
151
+ appendChild(child: ONode): Promise<void>;
152
+ set innerHTML(value: string);
153
+ cloneNode(state: boolean): Promise<OElement | null>;
154
+ remove(): Promise<void>;
155
+ removeAndRelease(): Promise<void>;
156
+ removeChild(child: ONode): Promise<void>;
157
+ replaceChildNode(node: ONode, child: ONode): Promise<void>;
158
+ replaceWith(node: ONode): Promise<void>;
159
+ after(toInsert: ONode): Promise<void>;
160
+ setHTML(html: string): Promise<void>;
161
+ HTML(): Promise<string>;
162
+ setInnerText(text: string): Promise<void>;
163
+ setContentText(text: string): Promise<void>;
164
+ getContentText(): Promise<string>;
165
+ content(): Promise<string>;
166
+ childNodes(): Promise<OElement[]>;
167
+ hasAttribute(name: string): boolean;
168
+ getAttribute(name: string): Promise<string>;
169
+ attribute(name: string): string | null;
170
+ nextSibling(): Promise<OElement | null>;
171
+ getAttributeNames(): Promise<string[]>;
172
+ parentNode(): Promise<OElement | null>;
173
+ insertBefore(node: ONode, element: ONode): Promise<void>;
174
+ setInputValue(value: string): Promise<void>;
175
+ inputValue(): Promise<string>;
176
+ get hydrated(): boolean;
177
+ hydrate(): void;
178
+ query(selector: string, filter?: QueryFilter[]): Promise<OElement | null>;
179
+ queryAll(selector: string, filter?: QueryFilter[]): Promise<OElement[] | null>;
180
+ setStyle(key: string, value: any): Promise<void>;
181
+ animate(keyframes: OUIDKeyframes, options?: OUIDAnimationOptions): Promise<OAnimation | null>;
182
+ }
183
+ export class OAnimation extends OObject {
184
+ private pendingEffectFragments;
185
+ private pendingEffectTiming?;
186
+ private pendingRawKeyframes?;
187
+ private effectFlushScheduled;
188
+ constructor(obj: OObject);
189
+ set(keyframes: OUIDKeyframes, options?: OUIDAnimationOptions): this;
190
+ timing(options: OUIDAnimationOptions): this;
191
+ timingFunction(value: string): this;
192
+ commitEffects(): Promise<this>;
193
+ property(property: string, from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions, unit?: string): this;
194
+ transformList(from: string[], to: string[], options?: OUIDAnimationOptions): this;
195
+ scale(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
196
+ scaleX(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
197
+ scaleY(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
198
+ scaleZ(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
199
+ scale3d(from: OUIDVector3Value, to: OUIDVector3Value, options?: OUIDAnimationOptions): this;
200
+ perspective(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
201
+ matrix(from: number[], to: number[], options?: OUIDAnimationOptions): this;
202
+ matrix3d(from: number[], to: number[], options?: OUIDAnimationOptions): this;
203
+ rotate(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
204
+ rotateX(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
205
+ rotateY(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
206
+ rotateZ(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
207
+ rotate3d(x: number, y: number, z: number, from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
208
+ skew(from: OUIDVector2Value, to: OUIDVector2Value, options?: OUIDAnimationOptions): this;
209
+ skewX(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
210
+ skewY(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
211
+ translate(from: OUIDVector2Value, to: OUIDVector2Value, options?: OUIDAnimationOptions): this;
212
+ translateX(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
213
+ translateY(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
214
+ translateZ(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
215
+ translate3d(from: OUIDVector3Value, to: OUIDVector3Value, options?: OUIDAnimationOptions): this;
216
+ top(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
217
+ right(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
218
+ left(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
219
+ bottom(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
220
+ opacity(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
221
+ width(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
222
+ height(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
223
+ minWidth(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
224
+ minHeight(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
225
+ maxWidth(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
226
+ maxHeight(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
227
+ margin(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
228
+ marginTop(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
229
+ marginRight(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
230
+ marginBottom(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
231
+ marginLeft(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
232
+ padding(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
233
+ paddingTop(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
234
+ paddingRight(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
235
+ paddingBottom(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
236
+ paddingLeft(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
237
+ borderRadius(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
238
+ borderWidth(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
239
+ outlineWidth(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
240
+ gap(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
241
+ rowGap(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
242
+ columnGap(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
243
+ fontSize(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
244
+ lineHeight(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
245
+ letterSpacing(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
246
+ zIndex(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
247
+ flexGrow(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
248
+ flexShrink(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
249
+ color(from: string, to: string, options?: OUIDAnimationOptions): this;
250
+ backgroundColor(from: string, to: string, options?: OUIDAnimationOptions): this;
251
+ borderColor(from: string, to: string, options?: OUIDAnimationOptions): this;
252
+ outlineColor(from: string, to: string, options?: OUIDAnimationOptions): this;
253
+ boxShadow(from: string, to: string, options?: OUIDAnimationOptions): this;
254
+ textShadow(from: string, to: string, options?: OUIDAnimationOptions): this;
255
+ clipPath(from: string, to: string, options?: OUIDAnimationOptions): this;
256
+ backgroundPosition(from: string, to: string, options?: OUIDAnimationOptions): this;
257
+ backgroundSize(from: string, to: string, options?: OUIDAnimationOptions): this;
258
+ objectPosition(from: string, to: string, options?: OUIDAnimationOptions): this;
259
+ filter(from: string, to: string, options?: OUIDAnimationOptions): this;
260
+ backdropFilter(from: string, to: string, options?: OUIDAnimationOptions): this;
261
+ blur(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
262
+ brightness(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
263
+ contrast(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
264
+ grayscale(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
265
+ hueRotate(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
266
+ invert(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
267
+ saturate(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
268
+ sepia(from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
269
+ dropShadow(from: string, to: string, options?: OUIDAnimationOptions): this;
270
+ transform(from: string, to: string, options?: OUIDAnimationOptions): this;
271
+ css(property: string, from: OUIDAnimationValue, to: OUIDAnimationValue, options?: OUIDAnimationOptions): this;
272
+ play(): Promise<void>;
273
+ pause(): Promise<void>;
274
+ cancel(): Promise<void>;
275
+ finish(): Promise<void>;
276
+ reverse(): Promise<void>;
277
+ commitStyles(): Promise<void>;
278
+ persist(): Promise<void>;
279
+ updatePlaybackRate(playbackRate: number): Promise<void>;
280
+ playState(): Promise<string | null>;
281
+ currentTime(): Promise<number | null>;
282
+ setCurrentTime(value: number | null): Promise<void>;
283
+ playbackRate(): Promise<number | null>;
284
+ setPlaybackRate(value: number): Promise<void>;
285
+ private queueEffect;
286
+ private mergeTiming;
287
+ private scheduleEffectFlush;
288
+ }
289
+ export class CanvasGradient extends OObject {
290
+ constructor(obj: OObject);
291
+ addColorStop(offset: number, color: string): this;
292
+ }
293
+ export class DOMMatrix extends OObject {
294
+ batch: BatchUpdates;
295
+ constructor(obj: OObject);
296
+ static new(): Promise<DOMMatrix>;
297
+ static new(initString: string): Promise<DOMMatrix>;
298
+ static new(initArray: number[]): Promise<DOMMatrix>;
299
+ invertSelf(): this;
300
+ multiplySelf(): DOMMatrix;
301
+ premultiplySelf(): DOMMatrix;
302
+ rotateAxisAngleSelf(rotX?: number, rotY?: number, rotZ?: number, angle?: number): this;
303
+ rotateFromVectorSelf(rotX?: number, rotY?: number): this;
304
+ rotateSelf(rotX?: number, rotY?: number, rotZ?: number): this;
305
+ scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): this;
306
+ scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): this;
307
+ setMatrixValue(transformList: string): this;
308
+ skewXSelf(sX: number): this;
309
+ skewYSelf(sX: number): this;
310
+ translateSelf(translateX: number, translateY: number, translateZ?: number): this;
311
+ commit(): Promise<void>;
312
+ is2D(): Promise<boolean>;
313
+ isIdentity(): Promise<boolean>;
314
+ flipX(): Promise<DOMMatrix | null>;
315
+ flipY(): Promise<DOMMatrix | null>;
316
+ inverse(): Promise<DOMMatrix | null>;
317
+ multiply(other?: DOMMatrix): Promise<DOMMatrix | null>;
318
+ rotate(rotX?: number, rotY?: number, rotZ?: number): Promise<DOMMatrix | null>;
319
+ rotateAxisAngle(rotX?: number, rotY?: number, rotZ?: number, angle?: number): Promise<DOMMatrix | null>;
320
+ rotateFromVector(rotX?: number, rotY?: number): Promise<DOMMatrix | null>;
321
+ scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): Promise<DOMMatrix | null>;
322
+ scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): Promise<DOMMatrix | null>;
323
+ skewX(sX?: number): Promise<DOMMatrix | null>;
324
+ skewY(sY?: number): Promise<DOMMatrix | null>;
325
+ toJSON(): Promise<any>;
326
+ toString(): Promise<string | null>;
327
+ translate(translateX?: number, translateY?: number, translateZ?: number): Promise<DOMMatrix | null>;
328
+ }
329
+ export class CanvasPattern extends OObject {
330
+ constructor(obj: OObject);
331
+ setTransform(matrix: DOMMatrix): Promise<void>;
332
+ }
333
+ export class Canvas2DContext extends OObject {
334
+ private batch;
335
+ constructor(uid: string);
336
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): this;
337
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this;
338
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): this;
339
+ clearRect(x: number, y: number, width: number, height: number): this;
340
+ clip(path?: CanvasPath2D): Canvas2DContext;
341
+ clip(fillRule?: 'nonzero' | 'evenodd'): Canvas2DContext;
342
+ clip(path: CanvasPath2D, fillRule?: 'nonzero' | 'evenodd'): Canvas2DContext;
343
+ beginPath(): this;
344
+ closePath(): this;
345
+ createConicGradient(startAngle: number, x: number, y: number): Promise<CanvasGradient | null>;
346
+ createLinearGradient(x0: number, y0: number, x1: number, y1: number): Promise<CanvasGradient | null>;
347
+ createPattern(image: OObject, repetition?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | ''): Promise<CanvasPattern | null>;
348
+ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): Promise<CanvasGradient | null>;
349
+ drawImage(image: Image | OObject, dx: number, dy: number): Canvas2DContext;
350
+ drawImage(image: Image | OObject, dx: number, dy: number, dWidth: number, dHeight: number): Canvas2DContext;
351
+ drawImage(image: Image | OObject, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number): Canvas2DContext;
352
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): this;
353
+ fill(path?: CanvasPath2D | 'nonzero' | 'evenodd', fillRule?: 'nonzero' | 'evenodd'): this;
354
+ fillRect(x: number, y: number, width: number, height: number): this;
355
+ fillText(text: string, x: number, y: number, maxWidth?: number): this;
356
+ getImageData(sx: number, sy: number, sw: number, sh: number, settings?: {
357
+ colorSpace: 'srgb' | 'display-p3';
358
+ pixelFormat: 'rgba-unorm8' | 'rgba-float16';
359
+ }): Promise<OObject | null>;
360
+ getLineDash(): Promise<number[] | null>;
361
+ getTransform(): Promise<DOMMatrix | null>;
362
+ isContextLost(): Promise<boolean | null>;
363
+ isPointInPath(x: number, y: number, fillRule?: 'nonzero' | 'evenodd'): Promise<boolean | null>;
364
+ isPointInPath(path: CanvasPath2D, x: number, y: number, fillRule?: 'nonzero' | 'evenodd'): Promise<boolean | null>;
365
+ isPointInStroke(x: number, y: number): Promise<boolean>;
366
+ isPointInStroke(path: CanvasPath2D, x: number, y: number): Promise<boolean>;
367
+ lineTo(x: number, y: number): Canvas2DContext;
368
+ measureText(text: number): Promise<number>;
369
+ moveTo(x: number, y: number): Canvas2DContext;
370
+ putImageData(imageData: OObject, dx: number, dy: number): Canvas2DContext;
371
+ putImageData(imageData: OObject, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): Canvas2DContext;
372
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): this;
373
+ rect(x: number, y: number, width: number, height: number): this;
374
+ reset(): void;
375
+ resetTransform(): void;
376
+ restore(): BatchUpdates;
377
+ rotate(angle: number): Canvas2DContext;
378
+ roundRect(x: number, y: number, width: number, height: number, radii: number | number[]): this;
379
+ save(): BatchUpdates;
380
+ scale(x: number, y: number): Canvas2DContext;
381
+ setLineDash(segments: number[]): Promise<void | null>;
382
+ setTransform(matrix: DOMMatrix): void;
383
+ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
384
+ stroke(path?: CanvasPath2D): Canvas2DContext;
385
+ strokeRect(x: number, y: number, width: number, height: number): Canvas2DContext;
386
+ strokeText(text: string, x: number, y: number, maxWidth?: number): Canvas2DContext;
387
+ transform(a: number, b: number, c: number, d: number, e: number, f: number): Canvas2DContext;
388
+ translate(x: number, y: number): Canvas2DContext;
389
+ set fillStyle(value: string | CanvasGradient | CanvasPattern);
390
+ setFillStyle(style: string | CanvasGradient | CanvasPattern): Canvas2DContext;
391
+ set filter(value: string);
392
+ setFilter(filter: string): this;
393
+ set font(value: string);
394
+ setFont(font: string): this;
395
+ set fontKerning(value: string);
396
+ setFontKerning(kerning: string): this;
397
+ set fontStretch(value: string);
398
+ setFontStretch(value: string): this;
399
+ set fontVariantCaps(value: string);
400
+ setFontVariantCaps(value: string): this;
401
+ set globalAlpha(value: number);
402
+ setGlobalAlpha(value: number): this;
403
+ set globalCompositeOperation(value: string);
404
+ setGlobalCompositeOperation(value: string): this;
405
+ set imageSmoothingEnabled(value: boolean);
406
+ setImageSmoothingEnabled(value: boolean): this;
407
+ set imageSmoothingQuality(value: string);
408
+ setImageSmoothingQuality(value: string): this;
409
+ set letterSpacing(value: string);
410
+ setLetterSpacing(value: string): this;
411
+ set lineCap(value: string);
412
+ setLineCap(value: string): this;
413
+ set lineDashOffset(value: number);
414
+ setLineDashOffset(value: number): this;
415
+ set lineJoin(value: string);
416
+ setLineJoin(value: string): this;
417
+ set lineWidth(value: number);
418
+ setLineWidth(value: number): this;
419
+ set miterLimit(value: number);
420
+ setMiterLimit(value: number): this;
421
+ set shadowBlur(value: number);
422
+ setShadowBlur(value: number): this;
423
+ set shadowColor(value: string);
424
+ setShadowColor(value: string): this;
425
+ set shadowOffsetX(value: number);
426
+ setShadowOffsetX(value: number): this;
427
+ set shadowOffsetY(value: number);
428
+ setShadowOffsetY(value: number): this;
429
+ set strokeStyle(value: any);
430
+ setStrokeStyle(value: any): this;
431
+ set textAlign(value: string);
432
+ setTextAlign(value: string): this;
433
+ set textBaseline(value: string);
434
+ setTextBaseline(value: string): this;
435
+ set wordSpacing(value: string);
436
+ setWordSpacing(value: string): this;
437
+ set textRendering(value: string);
438
+ setTextRendering(value: string): this;
439
+ commit(): Promise<void>;
440
+ }
441
+ export class Image extends OObject {
442
+ constructor(obj: OObject);
443
+ static new(width?: number, height?: number): Promise<Image | null>;
444
+ width(): Promise<number>;
445
+ height(): Promise<number>;
446
+ naturalWidth(): Promise<number>;
447
+ naturalHeight(): Promise<number>;
448
+ src(): Promise<string | null>;
449
+ currentSrc(): Promise<string | null>;
450
+ setSrc(src: string): Promise<void>;
451
+ }
452
+ export class CanvasPath2D extends OObject {
453
+ private batch;
454
+ constructor(obj: OObject);
455
+ static create(): Promise<CanvasPath2D | null>;
456
+ addPath(path: CanvasPath2D): this;
457
+ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): this;
458
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this;
459
+ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): this;
460
+ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): this;
461
+ closePath(): this;
462
+ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): this;
463
+ moveTo(x: number, y: number): this;
464
+ lineTo(x: number, y: number): this;
465
+ rect(x: number, y: number, width: number, height: number): this;
466
+ roundRect(x: number, y: number, width: number, height: number, radii: number | number[]): this;
467
+ commit(parent?: BatchUpdates): Promise<void>;
468
+ }
469
+ export class CanvasElement extends OElement {
470
+ constructor(node: OElement);
471
+ width(): Promise<number | null>;
472
+ height(): Promise<number | null>;
473
+ setWidth(width: number): Promise<void>;
474
+ setHeight(height: number): Promise<void>;
475
+ getContext(context: string): Promise<Canvas2DContext | null>;
476
+ static of(selector: string, filter?: QueryFilter[], nodeId?: string): Promise<CanvasElement | null>;
477
+ }
478
+ export { };
479
+ }
480
+ interface EventListenerOptions {
481
+ once?: boolean;
482
+ passive?: boolean;
483
+ capture?: boolean;
484
+ }
485
+ interface EventControlPolicy {
486
+ alwaysPreventDefault?: boolean;
487
+ alwaysStopPropagation?: boolean;
488
+ alwaysStopImmediatePropagation?: boolean;
489
+ payload?: "none" | "value" | "target" | "full";
490
+ }
491
+ type OUIFontDescriptorOptions = Partial<FontFaceDescriptors> & {
492
+ style?: string;
493
+ weight?: string;
494
+ stretch?: string;
495
+ unicodeRange?: string;
496
+ variant?: string;
497
+ featureSettings?: string;
498
+ variationSettings?: string;
499
+ display?: string;
500
+ ascentOverride?: string;
501
+ descentOverride?: string;
502
+ lineGapOverride?: string;
503
+ };
504
+ type OUIFontLoadOptions = OUIFontDescriptorOptions & {
505
+ family: string;
506
+ source: string;
507
+ };
508
+ type OUIFontLoadResult = {
509
+ family: string;
510
+ source: string;
511
+ uid?: string;
512
+ status: string;
513
+ mode: "font-face" | "style";
514
+ };
515
+ type OUIDAnimationValue = number | string;
516
+ type OUIDVector2Value = OUIDAnimationValue | [OUIDAnimationValue, OUIDAnimationValue] | {
517
+ x: OUIDAnimationValue;
518
+ y?: OUIDAnimationValue;
519
+ };
520
+ type OUIDVector3Value = OUIDAnimationValue | [OUIDAnimationValue, OUIDAnimationValue, OUIDAnimationValue] | {
521
+ x: OUIDAnimationValue;
522
+ y?: OUIDAnimationValue;
523
+ z?: OUIDAnimationValue;
524
+ };
525
+ type OUIDKeyframes = Keyframe[] | PropertyIndexedKeyframes | null;
526
+ type OUIDAnimationTiming = KeyframeAnimationOptions & {
527
+ timingFunction?: string;
528
+ };
529
+ type OUIDAnimationOptions = number | OUIDAnimationTiming;
530
+ type HostEventCallback<T = any> = (data: T, event: HostEvent<T>) => void;
531
+ interface HostEvent<T = any> {
532
+ type: string;
533
+ data: T;
534
+ timestamp?: number;
535
+ source?: string;
536
+ }
537
+ type OUIDBackButtonHandler = () => boolean | void;
538
+ type OUIDBackButtonUnsubscribe = () => void;
539
+ interface OUIDBridgeInterface {
540
+ invoke(name: string, ...args: any[]): Promise<any>;
541
+ emit(event: string, data: any): void;
542
+ subscribe(event: string, callback: (id: string, data: string) => void): void;
543
+ launch(): OUIDLaunchOptions;
544
+ readonly app: OUIDAppController;
545
+ readonly system: OUIDSystemController;
546
+ readonly permissions: OUIDPermissionController;
547
+ openAbout(): Promise<OUIDPermissionSettingsResult | null>;
548
+ openSettings(): Promise<OUIDPermissionSettingsResult | null>;
549
+ addHostEventListener<T = any>(event: string, callback: HostEventCallback<T>): Promise<string>;
550
+ removeHostEventListener(listenerId: string): Promise<void>;
551
+ onHostEvent<T = any>(event: string, callback: HostEventCallback<T>): Promise<() => Promise<void>>;
552
+ }
553
+ type OUIDLaunchOptions = {
554
+ initialRoute?: string | null;
555
+ params: Record<string, any>;
556
+ };
557
+ type OUIDMiniAppNavigationMode = "push" | "replace" | "modal";
558
+ type OUIDMiniAppExitOptions = {
559
+ reason?: string;
560
+ result?: Record<string, any>;
561
+ };
562
+ type OUIDOpenMiniAppOptions = {
563
+ appId: string;
564
+ route?: string | null;
565
+ initialRoute?: string | null;
566
+ params?: Record<string, any>;
567
+ mode?: OUIDMiniAppNavigationMode;
568
+ };
569
+ type OUIDMiniAppNavigationResult = {
570
+ status: "success" | "error" | string;
571
+ handled?: boolean;
572
+ appId?: string;
573
+ mode?: OUIDMiniAppNavigationMode | string;
574
+ message?: string;
575
+ code?: string;
576
+ };
577
+ type OUIDThemeMode = "system" | "light" | "dark";
578
+ type OUIDResolvedThemeMode = "light" | "dark";
579
+ type OUIDThemeState = {
580
+ mode: OUIDThemeMode;
581
+ resolvedMode: OUIDResolvedThemeMode;
582
+ systemMode: OUIDResolvedThemeMode;
583
+ };
584
+ type OUIDThemeChangeHandler = (theme: OUIDThemeState) => void;
585
+ type OUIDPlatform = "android" | "ios" | "web" | "unknown";
586
+ type OUIDSystemTheme = "light" | "dark" | "system" | "unknown";
587
+ type OUIDAppStateName = "active" | "inactive" | "background";
588
+ type OUIDSafeArea = {
589
+ left: number;
590
+ right: number;
591
+ top: number;
592
+ bottom: number;
593
+ width: number;
594
+ height: number;
595
+ };
596
+ type OUIDSystemInfo = {
597
+ brand: string;
598
+ model: string;
599
+ pixelRatio: number;
600
+ screenWidth: number;
601
+ screenHeight: number;
602
+ windowWidth: number;
603
+ windowHeight: number;
604
+ statusBarHeight: number;
605
+ language: string;
606
+ version: string;
607
+ system: string;
608
+ platform: OUIDPlatform | string;
609
+ fontSize: number;
610
+ safeArea: OUIDSafeArea;
611
+ theme: OUIDSystemTheme | string;
612
+ abi: string;
613
+ deviceAbi: string[];
614
+ cpuType: string;
615
+ memorySize: number;
616
+ benchmarkLevel: number;
617
+ };
618
+ type OUIDAppStateInfo = {
619
+ state: OUIDAppStateName;
620
+ previousState?: OUIDAppStateName;
621
+ timestamp: number;
622
+ focused?: boolean;
623
+ visibility?: "visible" | "hidden";
624
+ };
625
+ type OUIDAppStateChangeHandler = (state: OUIDAppStateInfo, event: HostEvent<OUIDAppStateInfo>) => void;
626
+ type OUIDPermissionState = "prompt" | "granted" | "denied" | "notDeclared" | string;
627
+ type OUIDPermissionStatus = {
628
+ permission: string;
629
+ access: string[];
630
+ reason: string | null;
631
+ targets: string[];
632
+ state: OUIDPermissionState;
633
+ declared: boolean;
634
+ granted: boolean;
635
+ };
636
+ type OUIDPermissionSettingsResult = {
637
+ permissions: OUIDPermissionStatus[];
638
+ };
639
+ interface BatchOperation {
640
+ fn: string;
641
+ args: any[];
642
+ }
643
+ interface BridgeCallOperation {
644
+ id: string;
645
+ fn: string;
646
+ args: any[];
647
+ }
648
+ type BridgeCallMode = "serial" | "parallel";
649
+ interface BridgeCallOptions {
650
+ mode?: BridgeCallMode;
651
+ }
652
+ interface NativeCallOperation {
653
+ id: string;
654
+ fn: string;
655
+ args: any[];
656
+ }
657
+ declare var WebOUID: {
658
+ invoke: (id: string, name: string, argsJson: string) => void;
659
+ } | undefined;
660
+ type RequestData = {
661
+ method: string;
662
+ headers: Record<string, string>;
663
+ body: any;
664
+ credentials: "include" | "omit" | "same-origin";
665
+ };
666
+ declare class OUIDThemeController {
667
+ private state;
668
+ private handlers;
669
+ private initialized;
670
+ private cssInstalled;
671
+ private hostUnsubscribe?;
672
+ get mode(): OUIDThemeMode;
673
+ get resolvedMode(): OUIDResolvedThemeMode;
674
+ get systemMode(): OUIDResolvedThemeMode;
675
+ get isDark(): boolean;
676
+ install(preferredMode?: OUIDThemeMode): Promise<OUIDThemeState>;
677
+ read(): OUIDThemeState;
678
+ refresh(fallbackMode?: OUIDThemeMode): Promise<OUIDThemeState>;
679
+ setMode(mode: OUIDThemeMode): Promise<OUIDThemeState>;
680
+ onChange(handler: OUIDThemeChangeHandler): () => void;
681
+ private installCss;
682
+ private subscribeHostChanges;
683
+ private update;
684
+ private apply;
685
+ }
686
+ declare class OUIDAppController {
687
+ private backButtonHandlers;
688
+ constructor();
689
+ exit(options?: OUIDMiniAppExitOptions): Promise<OUIDMiniAppNavigationResult | null>;
690
+ openMiniApp(options: OUIDOpenMiniAppOptions): Promise<OUIDMiniAppNavigationResult | null>;
691
+ canOpenMiniApp(appId: string): Promise<boolean>;
692
+ onBackButton(handler: OUIDBackButtonHandler): OUIDBackButtonUnsubscribe;
693
+ private handleBackButton;
694
+ }
695
+ declare class OUIDSystemController {
696
+ getInfo(): Promise<OUIDSystemInfo | null>;
697
+ getAppState(): Promise<OUIDAppStateInfo | null>;
698
+ onAppStateChange(handler: OUIDAppStateChangeHandler): Promise<() => Promise<void>>;
699
+ onForeground(handler: OUIDAppStateChangeHandler): Promise<() => Promise<void>>;
700
+ onBackground(handler: OUIDAppStateChangeHandler): Promise<() => Promise<void>>;
701
+ onInactive(handler: OUIDAppStateChangeHandler): Promise<() => Promise<void>>;
702
+ }
703
+ declare class OUIDPermissionController {
704
+ private readonly bridge;
705
+ constructor(bridge: {
706
+ invoke(name: string, ...args: any[]): Promise<any>;
707
+ });
708
+ private native;
709
+ query(): Promise<OUIDPermissionSettingsResult>;
710
+ query(permission: string): Promise<OUIDPermissionStatus>;
711
+ request(permission: string): Promise<OUIDPermissionStatus>;
712
+ requestMany(permissions?: string[]): Promise<OUIDPermissionSettingsResult>;
713
+ openSettings(): Promise<OUIDPermissionSettingsResult>;
714
+ openAbout(): Promise<OUIDPermissionSettingsResult>;
715
+ }
716
+ declare class OUIDBridge implements OUIDBridgeInterface {
717
+ private callbacks;
718
+ private DOM_EVENT_LISTENERS;
719
+ private HOST_EVENT_LISTENERS;
720
+ private timers;
721
+ private listeners;
722
+ readonly app: OUIDAppController;
723
+ readonly system: OUIDSystemController;
724
+ readonly theme: OUIDThemeController;
725
+ readonly permissions: OUIDPermissionController;
726
+ constructor();
727
+ config(): OUIDBridge;
728
+ launch(): OUIDLaunchOptions;
729
+ invoke(name: string, ...args: any[]): Promise<any>;
730
+ registerComponent(tag: string, compClass: OComponentType<any, any>): void;
731
+ unregisterComponent(tag: string, compClass: OComponentType<any, any>): void;
732
+ /**
733
+ * Make a synchronous class
734
+ * @param name the name without '_oui' prefix
735
+ * @param args the arguments list
736
+ * @returns a promise of T
737
+ */
738
+ call<T>(name: string, ...args: any[]): Promise<T | null>;
739
+ callMany<T extends Record<string, any> = Record<string, any>>(operations: BridgeCallOperation[], options?: BridgeCallOptions): Promise<T>;
740
+ readMany<T extends Record<string, any> = Record<string, any>>(operations: BridgeCallOperation[]): Promise<T>;
741
+ callNativeMany<T extends Record<string, any> = Record<string, any>>(operations: NativeCallOperation[]): Promise<T>;
742
+ emit(event: string, data: any): void;
743
+ /**
744
+ *
745
+ * @param event Create a subscription for a given event name, should be possible to register only once ??
746
+ * @param callback
747
+ */
748
+ subscribe(event: string, callback: (id: string, ...args: any[]) => void): void;
749
+ private parseHostEvent;
750
+ addHostEventListener<T = any>(event: string, callback: HostEventCallback<T>): Promise<string>;
751
+ removeHostEventListener(listenerId: string): Promise<void>;
752
+ onHostEvent<T = any>(event: string, callback: HostEventCallback<T>): Promise<() => Promise<void>>;
753
+ query(selector: string, filter?: QueryFilter[], nodeId?: string): Promise<ODOM.OElement | null>;
754
+ queryAll(selector: string, filter?: QueryFilter[], nodeId?: string): Promise<ODOM.OElement[] | null>;
755
+ createElement(tag: string, props?: Record<string, string>): Promise<ODOM.OElement | null>;
756
+ createComment(data: string): Promise<ODOM.OElement | null>;
757
+ addEventListener(node: ODOM.OObject | 'window' | 'document', event: string, callback: (...args: any[]) => void, extra?: {
758
+ options?: EventListenerOptions;
759
+ policy?: EventControlPolicy;
760
+ }): Promise<string>;
761
+ dettachEventListener(cbId: string): Promise<void>;
762
+ createComponentStyles(css: string, inject?: boolean): Promise<ODOM.OElement | null>;
763
+ appendComponentStyles(cssNode: string): Promise<void>;
764
+ rejectComponentStyles(cssNode: ODOM.ONode): Promise<void>;
765
+ loadFont(options: OUIFontLoadOptions): Promise<OUIFontLoadResult | null>;
766
+ loadFont(family: string, source: string, descriptors?: OUIFontDescriptorOptions): Promise<OUIFontLoadResult | null>;
767
+ unloadFont(font: string | OUIFontLoadResult | ODOM.OObject, source?: string): Promise<{
768
+ removed: number;
769
+ } | null>;
770
+ createAnimation(target: ODOM.OObject | string, keyframes: OUIDKeyframes, options?: OUIDAnimationOptions): Promise<ODOM.OAnimation | null>;
771
+ getOObject(id: string): Promise<ODOM.OObject | null>;
772
+ acquireObject(name: string): Promise<ODOM.OObject | null>;
773
+ setTimeout(callback: () => void, delay: number): Promise<number>;
774
+ clearTimeout(id: number): Promise<void>;
775
+ setInterval(callback: () => void, delay: number): Promise<number>;
776
+ clearInterval(id: number): Promise<void>;
777
+ fetch(url: string, input: RequestData, encodeAs: "json"): Promise<any>;
778
+ fetch(url: string, input: RequestData, encodeAs: "text"): Promise<string>;
779
+ fetch(url: string, input: RequestData, encodeAs: "base64"): Promise<string>;
780
+ fetch(url: string, input: RequestData, encodeAs: "buffer"): Promise<ODOM.OObject>;
781
+ alert(message: string): Promise<void>;
782
+ prompt(message: string): Promise<void>;
783
+ openAbout(): Promise<OUIDPermissionSettingsResult | null>;
784
+ openSettings(): Promise<OUIDPermissionSettingsResult | null>;
785
+ newObject(ctr: string, ...args: any[]): Promise<ODOM.OObject | null>;
786
+ requestAnimationFrame(callback: (fps: number) => void): Promise<number>;
787
+ cancelAnimationFrame(id: number): Promise<void>;
788
+ batchActions(operations: BatchOperation[]): Promise<void>;
789
+ nextTick(cb: () => void): void;
790
+ readFile(file: ODOM.OObject): Promise<unknown>;
791
+ }
792
+ declare const OUID: OUIDBridge & Record<string, (...args: any[]) => Promise<any>>;
793
+ declare global {
794
+ var OUID: OUIDBridge & Record<string, (...args: any[]) => Promise<any>>;
795
+ var __ouid_handle_back_button__: (() => boolean) | undefined;
796
+ }
797
+
798
+ type TemplateFn = (scope: any) => string;
799
+ declare class RenderContext {
800
+ private app;
801
+ component: OComponent<Record<string, any>, Record<string, any>>;
802
+ private parentContext;
803
+ static PROVIDE_TOKEN: string;
804
+ static MOUNTED_COMPONENTS_TOKEN: string;
805
+ static STYLE_REF: WeakMap<any, number>;
806
+ private bindings;
807
+ private directives;
808
+ private mountedComponents;
809
+ private componentsRegistry;
810
+ private updatingDirectives;
811
+ private updatingBindings;
812
+ private _stack;
813
+ private flatStack;
814
+ private viewUpdates;
815
+ private mountedQueue;
816
+ constructor(app: App, component: OComponent<Record<string, any>, Record<string, any>>, parentContext: RenderContext | null, ...frames: Record<string, any>[]);
817
+ get hostElement(): ODOM.OElement;
818
+ get stack(): Record<string, any>[];
819
+ set stack(value: Record<string, any>[]);
820
+ private getRoot;
821
+ enqueueMounted(fn: () => void): void;
822
+ flushMounted(): Promise<void>;
823
+ getMountedComponent(node: ODOM.OElement): OComponent | undefined;
824
+ bind(binding: Binding): void;
825
+ directive(directive: Directive): void;
826
+ evaluateExpression(expr: string | null | undefined): boolean;
827
+ private resolveScope;
828
+ resolve(key: string | null | undefined, ...additionFrames: Record<string, any>[]): any;
829
+ /**
830
+ * Handing (o-model) like (ngModel) update, we should support mutliple syntaxe like o-mode="value" where value is defined directly on the component
831
+ * o-model="data['key']" where data is either defined on the component, of in the enclosing scope in case of for-loop for instance
832
+ * */
833
+ updateValue(key: string, value: any): void;
834
+ push(frame: Record<string, any>): void;
835
+ pop(): void;
836
+ resolveTag(tag: string): OComponentType<any, any> | undefined;
837
+ updateBindings(): Promise<void>;
838
+ updateBinding(binding: Binding): Promise<void>;
839
+ updateDirectives(): Promise<void>;
840
+ private render;
841
+ private expandClass;
842
+ private expandStyle;
843
+ private expandStandardAttributes;
844
+ private setRefValue;
845
+ handleElementNode(node: ODOM.OElement, options?: {
846
+ skipSlotted?: boolean;
847
+ deferUpdates?: boolean;
848
+ }): Promise<void>;
849
+ handleTextNode(node: ODOM.OElement): void;
850
+ collectDepsForBindingsAndDirectives(): void;
851
+ private scheduleReactiveFlush;
852
+ private flushReactiveUpdate;
853
+ private componentAttributes;
854
+ mountComponent<T extends Record<string, any>, O extends Record<string, string>>(hostNode: ODOM.OElement, component: OComponentType<T, O>, parentContext: RenderContext | null, props?: Record<string, {
855
+ name: string;
856
+ value: any;
857
+ expr?: string;
858
+ }>, emits?: O): Promise<OComponent>;
859
+ unmountComponent(node: ODOM.OElement): Promise<void>;
860
+ }
861
+ type Binding = {
862
+ type: 'model';
863
+ node: ODOM.OElement;
864
+ key: string;
865
+ context: RenderContext;
866
+ modelValue?: any;
867
+ } | {
868
+ type: 'interpolation';
869
+ node: ODOM.OElement;
870
+ key: string;
871
+ templateFn: TemplateFn;
872
+ context: RenderContext;
873
+ } | {
874
+ type: 'attribute';
875
+ node: ODOM.OElement;
876
+ key: string;
877
+ template: string | null;
878
+ context: RenderContext;
879
+ } | {
880
+ type: 'prop';
881
+ node: ODOM.OElement;
882
+ key: string;
883
+ template: string;
884
+ context: RenderContext;
885
+ };
886
+ type ForChild = {
887
+ node: ODOM.OElement;
888
+ ctx: RenderContext;
889
+ stop?: () => void;
890
+ };
891
+ type Directive = {
892
+ type: 'if' | 'for';
893
+ node: ODOM.OElement;
894
+ expr?: string;
895
+ placeholder: ODOM.OElement;
896
+ context: RenderContext;
897
+ active?: boolean;
898
+ renderedNode?: ODOM.OElement;
899
+ list?: string;
900
+ item?: string;
901
+ children?: Map<any, ForChild>;
902
+ key?: string;
903
+ destroy?: boolean;
904
+ };
905
+ declare function node<P extends Record<string, any>, O extends Record<string, any>>(component: string, p?: P, children?: RenderNode[], emits?: O): Promise<RenderNode>;
906
+ declare function o<P extends Record<string, any>, O extends Record<string, any>>(component: ComponentConstructor<P, O>, props: P, emits?: O): OComponent<P>;
907
+ declare function o<P extends Record<string, any>, O extends Record<string, any>>(component: OComponentType<P, O>, props: P, emits?: O): Promise<OComponent<P>>;
908
+
909
+ declare class Emits<O extends Record<string, any>> {
910
+ private events;
911
+ constructor(events: O);
912
+ emit(event: keyof O, ...args: any): void;
913
+ }
914
+
915
+ interface Ref<T> {
916
+ value: T;
917
+ __isRef: true;
918
+ }
919
+
920
+ type Stated<T> = Ref<T>;
921
+ declare function isStated<T>(ob: any): ob is Stated<T>;
922
+ declare function stated<T>(obj: T): Stated<T>;
923
+ declare class State<S extends Record<string, any> = any> {
924
+ private readonly _ctx;
925
+ constructor(componentInstance: any);
926
+ wrap<T>(value: T): Stated<T>;
927
+ computed<T>(getter: () => T): Stated<T>;
928
+ watchEffect(fn: (onCleanup: (cb: () => void) => void) => void): () => void;
929
+ get value(): S;
930
+ }
931
+
932
+ type ComponentProps<K extends Record<string, any>> = K;
933
+ declare class RenderNode {
934
+ private node;
935
+ private children;
936
+ constructor(node: ODOM.OElement | string, children?: RenderNode[]);
937
+ attachTo(host: ODOM.OElement): void;
938
+ static of(node: ODOM.OElement | string, children?: RenderNode[]): RenderNode;
939
+ addChild(node: RenderNode): RenderNode;
940
+ }
941
+ declare class StyleData {
942
+ private data;
943
+ private css;
944
+ constructor(data: Record<string, StyleData | string>, css: string);
945
+ toString(): string;
946
+ static of(data: Record<string, StyleData | string>, ...css: string[]): StyleData;
947
+ }
948
+ /**
949
+ * Component decorator, it allow an auto registration of components
950
+ * @param options
951
+ * @returns
952
+ */
953
+ declare function Component(options: {
954
+ template: string;
955
+ tag: string;
956
+ use?: Record<string, OComponentType>;
957
+ css?: string;
958
+ hostClasses?: string | string[];
959
+ }): <T extends {
960
+ new (...args: any[]): {};
961
+ }>(constructor: T) => {
962
+ new (...args: any[]): {
963
+ template: string;
964
+ css: string | undefined;
965
+ tag: string;
966
+ use: Record<string, OComponentType<{}, {}>> | undefined;
967
+ hostClasses: string | string[] | undefined;
968
+ hash: string;
969
+ };
970
+ } & T;
971
+ interface Component<P extends Record<string, any>, O extends Record<string, any>> {
972
+ state: State<any>;
973
+ readonly emits: Emits<O>;
974
+ readonly props: ComponentProps<P>;
975
+ onActivated(): void;
976
+ onDeactivated(): void;
977
+ onMounted(): void;
978
+ willMount(): void;
979
+ willUnmount(): void;
980
+ provide<T>(key: string, value: T): void;
981
+ inject<T>(key: string): T | undefined;
982
+ render?(ctx: RenderContext): RenderNode | null | Promise<RenderNode | null>;
983
+ style?(): StyleData | null;
984
+ decorateHostElement(hostElement: ODOM.OElement): Promise<void>;
985
+ }
986
+ interface ComponentConstructor<P extends Record<string, any>, O extends Record<string, any>> {
987
+ new (props?: P, emits?: O): Component<P, O>;
988
+ }
989
+ declare function createComponent<P extends Record<string, any>, O extends Record<string, any>>(ctr: ComponentConstructor<P, O>, props?: P, emits?: O): Component<P, O>;
990
+ declare class OComponent<P extends Record<string, any> = {}, O extends Record<string, any> = {}> implements Component<P, O> {
991
+ state: State<any>;
992
+ private parent?;
993
+ readonly emits: Emits<O>;
994
+ readonly props: ComponentProps<P>;
995
+ private provides;
996
+ constructor(props?: P, emits?: O);
997
+ onActivated(): void;
998
+ onDeactivated(): void;
999
+ onMounted(): void;
1000
+ willMount(): void;
1001
+ willUnmount(): void;
1002
+ /** Provide a value for descendants */
1003
+ provide<T>(key: string, value: T): void;
1004
+ /** Inject a value from nearest ancestor */
1005
+ inject<T>(key: string): T | undefined;
1006
+ render?(ctx: RenderContext): RenderNode | null | Promise<RenderNode | null>;
1007
+ style?(): StyleData | null;
1008
+ decorateHostElement(hostElement: ODOM.OElement): Promise<void>;
1009
+ }
1010
+ type LazyLoader<P extends Record<string, any>, O extends Record<string, any>> = () => Promise<{
1011
+ default: ComponentConstructor<P, O>;
1012
+ }>;
1013
+ type OComponentType<P extends Record<string, any> = {}, O extends Record<string, any> = {}> = ComponentConstructor<P, O> | LazyLoader<P, O>;
1014
+
1015
+ /**
1016
+ * Component responsible for display routes
1017
+ * Usage: `<o-router></o-router>`
1018
+ */
1019
+ declare class ORouter extends OComponent {
1020
+ private router;
1021
+ willMount(): void;
1022
+ onMounted(): void;
1023
+ willUnmount(): void;
1024
+ }
1025
+ declare const ROUTER_INJECTION_TOKEN = "OROUTER_TOKEN";
1026
+ declare const ACTIVE_ROUTE_TOKEN = "ACTIVE_ROUTE";
1027
+ declare const CURRENT_ROUTE_TOKEN = "CURRENT_ROUTE";
1028
+ type RouteTransition = 'none' | 'slide' | 'fade';
1029
+ type RouteNavigationMode = 'stack' | 'tab';
1030
+ type RouteCacheStrategy = 'stack' | 'route' | 'none';
1031
+ interface RouteMeta {
1032
+ navigation?: RouteNavigationMode;
1033
+ transition?: RouteTransition;
1034
+ keepAlive?: boolean;
1035
+ preload?: boolean;
1036
+ }
1037
+ interface Route {
1038
+ path: string;
1039
+ name: string;
1040
+ component?: OComponentType<any, any>;
1041
+ redirectTo?: string | {
1042
+ name: string;
1043
+ };
1044
+ transition?: RouteTransition;
1045
+ beforeEnter?: RouteGaurdFunction | RouteGaurdFunction[];
1046
+ meta?: RouteMeta;
1047
+ }
1048
+ declare function useRouter(): Router | undefined;
1049
+ declare class OLink extends OComponent<{
1050
+ to?: string | RouteLocation;
1051
+ replace?: boolean;
1052
+ activeClass?: string;
1053
+ }> {
1054
+ active: Stated<boolean>;
1055
+ activeClass: string;
1056
+ private removeAfterEach?;
1057
+ onMounted(): void;
1058
+ willUnmount(): void;
1059
+ navigate(): void;
1060
+ onKeydown(event: any): void;
1061
+ private syncActive;
1062
+ private resolveTo;
1063
+ }
1064
+ declare function createRouter(routes: Routes, options?: RouterOptions): Router;
1065
+ type Routes = Array<Route>;
1066
+ type MatchedRoute = {
1067
+ route: Route;
1068
+ params: Record<string, any>;
1069
+ query: Record<string, string>;
1070
+ hash: string;
1071
+ parser: RouteParser;
1072
+ };
1073
+ type Promised<T> = T | Promise<T>;
1074
+ type RouteLocationNamed = {
1075
+ name: string;
1076
+ params?: Record<string, any>;
1077
+ query?: Record<string, string>;
1078
+ };
1079
+ type RouteLocation = {
1080
+ name?: string;
1081
+ path?: string;
1082
+ params?: Record<string, any>;
1083
+ query?: Record<string, string>;
1084
+ hash?: string;
1085
+ absolute?: boolean;
1086
+ mode?: RouteNavigationMode;
1087
+ transition?: RouteTransition;
1088
+ };
1089
+ type RouteLocationNormalized = {
1090
+ url: string;
1091
+ fullPath: string;
1092
+ path: string;
1093
+ name: string;
1094
+ params: Record<string, any>;
1095
+ query: Record<string, string>;
1096
+ hash: string;
1097
+ route: Route;
1098
+ };
1099
+ type RouteGuardReturn = void | boolean | RouteLocation;
1100
+ type RouteGaurdFunction = (to: RouteLocationNormalized, from?: RouteLocationNormalized | null) => Promised<RouteGuardReturn>;
1101
+ interface RouteGuard {
1102
+ type: 'before' | 'after';
1103
+ fn: RouteGaurdFunction;
1104
+ }
1105
+ type NavigationResultType = 'success' | 'cancelled' | 'redirected' | 'duplicated' | 'not-found' | 'failed';
1106
+ interface NavigationResult {
1107
+ type: NavigationResultType;
1108
+ to?: RouteLocationNormalized;
1109
+ from?: RouteLocationNormalized | null;
1110
+ redirectedTo?: RouteLocationNormalized;
1111
+ error?: unknown;
1112
+ }
1113
+ type RouteScrollPosition = {
1114
+ top?: number;
1115
+ left?: number;
1116
+ };
1117
+ type RouteScrollBehavior = (to: RouteLocationNormalized, from?: RouteLocationNormalized | null) => Promised<RouteScrollPosition | false | void>;
1118
+ interface RouterOptions {
1119
+ defaultTransition?: RouteTransition;
1120
+ transitionDuration?: number;
1121
+ notFound?: string | RouteLocation;
1122
+ backFallback?: RouteLocation;
1123
+ scrollRestoration?: boolean;
1124
+ scrollBehavior?: RouteScrollBehavior;
1125
+ cache?: {
1126
+ strategy?: RouteCacheStrategy;
1127
+ max?: number;
1128
+ };
1129
+ preload?: {
1130
+ tabs?: boolean;
1131
+ routes?: string[];
1132
+ delay?: number;
1133
+ };
1134
+ }
1135
+ declare class Router implements Plugin<any> {
1136
+ routes: Routes;
1137
+ private windowObject;
1138
+ private guards;
1139
+ private eventRegistration;
1140
+ private compiled;
1141
+ private outletEl;
1142
+ private boundComponent;
1143
+ private outletConfigured;
1144
+ private stack;
1145
+ private tabStacks;
1146
+ private activeTabKey;
1147
+ private routeCache;
1148
+ private currentEntry;
1149
+ private currentPath;
1150
+ private pendingNav;
1151
+ private queuedNav;
1152
+ private historyIndex;
1153
+ private bindToken;
1154
+ private preloadTimer;
1155
+ private preloadStarted;
1156
+ private preloadingRoutes;
1157
+ private readonly activeRoute;
1158
+ readonly currentRoute: Stated<RouteLocationNormalized | null>;
1159
+ private readonly options;
1160
+ constructor(routes: Routes, options?: RouterOptions);
1161
+ install(app: App): void;
1162
+ resolveByName(name: string): MatchedRoute | null;
1163
+ mapPath(parser: RouteParser, params?: Record<string, any>, query?: Record<string, any>, hash?: string): string | null;
1164
+ resolve(url: string, seen?: Set<string>): MatchedRoute | null;
1165
+ private parseUrl;
1166
+ private stringifyPath;
1167
+ private resolveRedirect;
1168
+ private resolveNotFound;
1169
+ replace(options: RouteLocation): Promise<NavigationResult>;
1170
+ push(options: RouteLocation, replace?: boolean): Promise<NavigationResult>;
1171
+ resolveLocation(options: RouteLocation): RouteLocationNormalized | null;
1172
+ href(options: RouteLocation): string;
1173
+ isActive(options: RouteLocation, exact?: boolean): boolean;
1174
+ canGoBack(): boolean;
1175
+ private resolveNavigationTarget;
1176
+ private resolveWithoutNotFound;
1177
+ private navigate;
1178
+ pop(options?: {
1179
+ fallback?: RouteLocation;
1180
+ }): Promise<NavigationResult>;
1181
+ back(options?: {
1182
+ fallback?: RouteLocation;
1183
+ }): Promise<NavigationResult>;
1184
+ backOrExit(): Promise<NavigationResult>;
1185
+ private beforeRouteGoing;
1186
+ private afterRouteGoing;
1187
+ bind(component: ORouter): Promise<() => void>;
1188
+ private resolveLaunchInitialRoute;
1189
+ private renderInitialPath;
1190
+ private setupHistoryTracking;
1191
+ private handlePopState;
1192
+ private readHistoryState;
1193
+ private safelyResolvePath;
1194
+ private commitHistory;
1195
+ private withTimeout;
1196
+ private isCurrentBinding;
1197
+ private enqueueNavigation;
1198
+ private renderPath;
1199
+ private renderMatched;
1200
+ private createNavigationPlan;
1201
+ private toRouteLocation;
1202
+ private updateActiveRoute;
1203
+ private isRouteRedirect;
1204
+ private resolveRouteNavigationMode;
1205
+ private resolveRouteTransition;
1206
+ private routeCacheKey;
1207
+ private shouldKeepAlive;
1208
+ private getActiveStack;
1209
+ private setActiveStack;
1210
+ private isEntryInAnyStack;
1211
+ private resolveRouteEntry;
1212
+ private scheduleRoutePreload;
1213
+ private preloadCandidates;
1214
+ private preloadRoutes;
1215
+ private bringEntryToFront;
1216
+ private prepareCachedEntry;
1217
+ private trimRouteCache;
1218
+ private applyStackChange;
1219
+ private releaseEntryIfUnused;
1220
+ private captureScroll;
1221
+ private applyScroll;
1222
+ private unmountEntry;
1223
+ private runTransition;
1224
+ private waitForTransition;
1225
+ /**
1226
+ * Get href from location and then remove the host part return the path only plus the query and hash
1227
+ */
1228
+ private resolvePath;
1229
+ unbind(): void;
1230
+ private runTransitionNone;
1231
+ private runTransitionFade;
1232
+ private runTransitionPush;
1233
+ private runTransitionPop;
1234
+ beforeEach(fn: RouteGaurdFunction): (() => void);
1235
+ afterEach(fn: RouteGaurdFunction): (() => void);
1236
+ }
1237
+
1238
+ declare class OIcon extends OComponent {
1239
+ render(_: RenderContext): RenderNode;
1240
+ style(): StyleData | null;
1241
+ }
1242
+
1243
+ declare function components(): Record<string, OComponent<any, any>>;
1244
+
1245
+ export { ACTIVE_ROUTE_TOKEN, App, type BatchOperation, type Binding, type BridgeCallMode, type BridgeCallOperation, type BridgeCallOptions, CURRENT_ROUTE_TOKEN, Component, type ComponentConstructor, type ComponentProps, type Directive, Emits, type EventControlPolicy, type EventListenerOptions, type HostEvent, type HostEventCallback, type InjectionKey, type LazyLoader, type NativeCallOperation, type NavigationResult, type NavigationResultType, OComponent, type OComponentType, ODOM, OIcon, OLink, ORouter, OUID, type OUIDAnimationOptions, type OUIDAnimationTiming, type OUIDAnimationValue, OUIDAppController, type OUIDAppStateChangeHandler, type OUIDAppStateInfo, type OUIDAppStateName, type OUIDBackButtonHandler, type OUIDBackButtonUnsubscribe, OUIDBridge, type OUIDBridgeInterface, type OUIDKeyframes, type OUIDLaunchOptions, type OUIDMiniAppExitOptions, type OUIDMiniAppNavigationMode, type OUIDMiniAppNavigationResult, type OUIDOpenMiniAppOptions, OUIDPermissionController, type OUIDPermissionSettingsResult, type OUIDPermissionState, type OUIDPermissionStatus, type OUIDPlatform, type OUIDResolvedThemeMode, type OUIDSafeArea, OUIDSystemController, type OUIDSystemInfo, type OUIDSystemTheme, type OUIDThemeChangeHandler, OUIDThemeController, type OUIDThemeMode, type OUIDThemeState, type OUIDVector2Value, type OUIDVector3Value, type OUIFontDescriptorOptions, type OUIFontLoadOptions, type OUIFontLoadResult, type Plugin, type Promised, type Provider, type Providers, ROUTER_INJECTION_TOKEN, RenderContext, RenderNode, type Route, type RouteCacheStrategy, type RouteGaurdFunction, type RouteGuard, type RouteGuardReturn, type RouteLocation, type RouteLocationNamed, type RouteLocationNormalized, type RouteMeta, type RouteNavigationMode, type RouteScrollBehavior, type RouteScrollPosition, type RouteTransition, Router, type RouterOptions, type Routes, State, type Stated, StyleData, WebOUID, components, createComponent, createRouter, inject, isStated, node, o, provide, stated, useRouter };