@nx.js/runtime 0.0.64 → 0.0.66
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 +208 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -587,6 +587,24 @@ declare class Path2D {
|
|
|
587
587
|
rect(x: number, y: number, width: number, height: number): void;
|
|
588
588
|
roundRect(x: number, y: number, width: number, height: number, radii?: number | number[]): void;
|
|
589
589
|
}
|
|
590
|
+
declare class CanvasGradient {
|
|
591
|
+
/**
|
|
592
|
+
* @ignore
|
|
593
|
+
*/
|
|
594
|
+
constructor();
|
|
595
|
+
/**
|
|
596
|
+
* Adds a new color stop, defined by an offset and a color, to a given canvas gradient.
|
|
597
|
+
*
|
|
598
|
+
* @param offset A number between `0` and `1`, inclusive, representing the position of the color stop. `0` represents the start of the gradient and `1` represents the end.
|
|
599
|
+
* @param color A CSS color string representing the color of the stop.
|
|
600
|
+
* @see https://developer.mozilla.org/docs/Web/API/CanvasGradient/addColorStop
|
|
601
|
+
*/
|
|
602
|
+
addColorStop(offset: number, color: string): void;
|
|
603
|
+
/**
|
|
604
|
+
* @internal
|
|
605
|
+
*/
|
|
606
|
+
get _opaque(): any;
|
|
607
|
+
}
|
|
590
608
|
declare class CanvasRenderingContext2D {
|
|
591
609
|
/**
|
|
592
610
|
* @ignore
|
|
@@ -632,16 +650,16 @@ declare class CanvasRenderingContext2D {
|
|
|
632
650
|
* @default "#000" (black)
|
|
633
651
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle
|
|
634
652
|
*/
|
|
635
|
-
get fillStyle(): string;
|
|
636
|
-
set fillStyle(v: string);
|
|
653
|
+
get fillStyle(): string | CanvasGradient;
|
|
654
|
+
set fillStyle(v: string | CanvasGradient);
|
|
637
655
|
/**
|
|
638
656
|
* Specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes.
|
|
639
657
|
*
|
|
640
658
|
* @default "#000" (black)
|
|
641
659
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle
|
|
642
660
|
*/
|
|
643
|
-
get strokeStyle(): string;
|
|
644
|
-
set strokeStyle(v: string);
|
|
661
|
+
get strokeStyle(): string | CanvasGradient;
|
|
662
|
+
set strokeStyle(v: string | CanvasGradient);
|
|
645
663
|
/**
|
|
646
664
|
* Specifies the alpha (transparency) value that is applied to shapes and images
|
|
647
665
|
* before they are drawn onto the canvas.
|
|
@@ -1234,16 +1252,16 @@ declare class OffscreenCanvasRenderingContext2D {
|
|
|
1234
1252
|
* @default "#000" (black)
|
|
1235
1253
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle
|
|
1236
1254
|
*/
|
|
1237
|
-
get fillStyle(): string;
|
|
1238
|
-
set fillStyle(v: string);
|
|
1255
|
+
get fillStyle(): string | CanvasGradient;
|
|
1256
|
+
set fillStyle(v: string | CanvasGradient);
|
|
1239
1257
|
/**
|
|
1240
1258
|
* Specifies the color, gradient, or pattern to use for the strokes (outlines) around shapes.
|
|
1241
1259
|
*
|
|
1242
1260
|
* @default "#000" (black)
|
|
1243
1261
|
* @see https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle
|
|
1244
1262
|
*/
|
|
1245
|
-
get strokeStyle(): string;
|
|
1246
|
-
set strokeStyle(v: string);
|
|
1263
|
+
get strokeStyle(): string | CanvasGradient;
|
|
1264
|
+
set strokeStyle(v: string | CanvasGradient);
|
|
1247
1265
|
/**
|
|
1248
1266
|
* Specifies the alpha (transparency) value that is applied to shapes and images
|
|
1249
1267
|
* before they are drawn onto the canvas.
|
|
@@ -2797,7 +2815,7 @@ declare class SubtleCrypto {
|
|
|
2797
2815
|
exportKey(format: "pkcs8" | "raw" | "spki", key: CryptoKey<never>): Promise<ArrayBuffer>;
|
|
2798
2816
|
generateKey(algorithm: "Ed25519", extractable: boolean, keyUsages: readonly ("sign" | "verify")[]): Promise<CryptoKeyPair<never>>;
|
|
2799
2817
|
generateKey(algorithm: RsaHashedKeyGenParams | EcKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKeyPair<never>>;
|
|
2800
|
-
generateKey(algorithm: AesKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2818
|
+
generateKey(algorithm: AesKeyGenParams | HmacKeyGenParams, extractable: boolean, keyUsages: readonly KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2801
2819
|
/**
|
|
2802
2820
|
* Takes as input a key in an external, portable format and returns a
|
|
2803
2821
|
* {@link CryptoKey | `CryptoKey`} instance which can be used in the Web Crypto API.
|
|
@@ -2806,6 +2824,7 @@ declare class SubtleCrypto {
|
|
|
2806
2824
|
*/
|
|
2807
2825
|
importKey<Cipher extends KeyAlgorithmIdentifier>(format: "jwk", keyData: JsonWebKey, algorithm: Cipher | KeyImportParams<Cipher>, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<Cipher>>;
|
|
2808
2826
|
importKey<Cipher extends KeyAlgorithmIdentifier>(format: "pkcs8" | "raw" | "spki", keyData: BufferSource, algorithm: Cipher | KeyImportParams<Cipher>, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<Cipher>>;
|
|
2827
|
+
importKey(format: KeyFormat, keyData: BufferSource | JsonWebKey, algorithm: Algorithm, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2809
2828
|
sign(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey<never>, data: BufferSource): Promise<ArrayBuffer>;
|
|
2810
2829
|
unwrapKey(format: KeyFormat, wrappedKey: BufferSource, unwrappingKey: CryptoKey<never>, unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, unwrappedKeyAlgorithm: AlgorithmIdentifier | HmacImportParams | RsaHashedImportParams | EcKeyImportParams, extractable: boolean, keyUsages: KeyUsage[]): Promise<CryptoKey<never>>;
|
|
2811
2830
|
verify(algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams, key: CryptoKey<never>, signature: BufferSource, data: BufferSource): Promise<boolean>;
|
|
@@ -2819,14 +2838,14 @@ declare class Console {
|
|
|
2819
2838
|
constructor(opts?: ConsoleOptions);
|
|
2820
2839
|
/**
|
|
2821
2840
|
* Prints string `s` to the console on the screen, without any formatting applied.
|
|
2822
|
-
*
|
|
2841
|
+
* A newline is _not_ appended to the end of the string.
|
|
2823
2842
|
*
|
|
2824
2843
|
* @param s The text to print to the console.
|
|
2825
2844
|
*/
|
|
2826
2845
|
print: (s: string) => void;
|
|
2827
2846
|
/**
|
|
2828
2847
|
* Prints string `s` to the debug log file, without any formatting applied.
|
|
2829
|
-
*
|
|
2848
|
+
* A newline is _not_ appended to the end of the string.
|
|
2830
2849
|
*
|
|
2831
2850
|
* > TIP: This function **does not** invoke _text rendering mode_, so it can safely be used when rendering with the Canvas API.
|
|
2832
2851
|
*
|
|
@@ -3380,6 +3399,61 @@ declare class Storage {
|
|
|
3380
3399
|
* @see https://developer.mozilla.org/docs/Web/API/Window/localStorage
|
|
3381
3400
|
*/
|
|
3382
3401
|
declare var localStorage: Storage | undefined;
|
|
3402
|
+
/**
|
|
3403
|
+
* The `Audio` class provides audio playback functionality similar to the
|
|
3404
|
+
* [`HTMLAudioElement`](https://developer.mozilla.org/docs/Web/API/HTMLAudioElement)
|
|
3405
|
+
* in web browsers.
|
|
3406
|
+
*
|
|
3407
|
+
* ### Supported Audio Formats
|
|
3408
|
+
*
|
|
3409
|
+
* - `mp3` — MP3 audio using [dr_mp3](https://github.com/mackron/dr_libs)
|
|
3410
|
+
* - `wav` — WAV audio using [dr_wav](https://github.com/mackron/dr_libs)
|
|
3411
|
+
* - `ogg` — OGG Vorbis audio using [stb_vorbis](https://github.com/nothings/stb)
|
|
3412
|
+
*
|
|
3413
|
+
* @example
|
|
3414
|
+
*
|
|
3415
|
+
* ```typescript
|
|
3416
|
+
* const audio = new Audio('romfs:/music.mp3');
|
|
3417
|
+
* audio.addEventListener('canplaythrough', () => {
|
|
3418
|
+
* audio.play();
|
|
3419
|
+
* });
|
|
3420
|
+
* ```
|
|
3421
|
+
*/
|
|
3422
|
+
declare class Audio extends EventTarget {
|
|
3423
|
+
#private;
|
|
3424
|
+
onplay: ((this: Audio, ev: Event) => any) | null;
|
|
3425
|
+
onpause: ((this: Audio, ev: Event) => any) | null;
|
|
3426
|
+
onended: ((this: Audio, ev: Event) => any) | null;
|
|
3427
|
+
onerror: ((this: Audio, ev: ErrorEvent) => any) | null;
|
|
3428
|
+
oncanplaythrough: ((this: Audio, ev: Event) => any) | null;
|
|
3429
|
+
onloadedmetadata: ((this: Audio, ev: Event) => any) | null;
|
|
3430
|
+
ontimeupdate: ((this: Audio, ev: Event) => any) | null;
|
|
3431
|
+
constructor(src?: string);
|
|
3432
|
+
get src(): string;
|
|
3433
|
+
set src(val: string);
|
|
3434
|
+
get currentSrc(): string;
|
|
3435
|
+
get volume(): number;
|
|
3436
|
+
set volume(val: number);
|
|
3437
|
+
get loop(): boolean;
|
|
3438
|
+
set loop(val: boolean);
|
|
3439
|
+
get paused(): boolean;
|
|
3440
|
+
get ended(): boolean;
|
|
3441
|
+
get currentTime(): number;
|
|
3442
|
+
set currentTime(val: number);
|
|
3443
|
+
get duration(): number;
|
|
3444
|
+
get playbackRate(): number;
|
|
3445
|
+
set playbackRate(val: number);
|
|
3446
|
+
get readyState(): number;
|
|
3447
|
+
static get HAVE_NOTHING(): number;
|
|
3448
|
+
static get HAVE_METADATA(): number;
|
|
3449
|
+
static get HAVE_CURRENT_DATA(): number;
|
|
3450
|
+
static get HAVE_FUTURE_DATA(): number;
|
|
3451
|
+
static get HAVE_ENOUGH_DATA(): number;
|
|
3452
|
+
load(): void;
|
|
3453
|
+
play(): Promise<void>;
|
|
3454
|
+
pause(): void;
|
|
3455
|
+
dispatchEvent(event: Event): boolean;
|
|
3456
|
+
}
|
|
3383
3457
|
/**
|
|
3384
3458
|
* The `Window` class represents the global scope within the application.
|
|
3385
3459
|
*
|
|
@@ -4142,11 +4216,11 @@ declare namespace Switch {
|
|
|
4142
4216
|
*/
|
|
4143
4217
|
constructor(nro: ArrayBuffer);
|
|
4144
4218
|
/**
|
|
4145
|
-
* Launches the application.
|
|
4219
|
+
* Launches the installed title or homebrew application.
|
|
4146
4220
|
*
|
|
4147
|
-
* @
|
|
4221
|
+
* @param args The arguments to pass to the application (only for homebrew applications).
|
|
4148
4222
|
*/
|
|
4149
|
-
launch(): never;
|
|
4223
|
+
launch(...args: string[]): never;
|
|
4150
4224
|
createSaveDataSync(info: SaveDataCreationInfoWithNacp): SaveData;
|
|
4151
4225
|
/**
|
|
4152
4226
|
* Creates the Save Data for this {@link Application} for the provided user profile.
|
|
@@ -4423,6 +4497,115 @@ declare namespace Switch {
|
|
|
4423
4497
|
dispatchOut(rid: number, outData: BufferSource, params?: ServiceDispatchParams): void;
|
|
4424
4498
|
dispatchInOut(rid: number, inData?: BufferSource, outData?: BufferSource, params?: ServiceDispatchParams): void;
|
|
4425
4499
|
}
|
|
4500
|
+
/**
|
|
4501
|
+
* Configuration options for {@link WebApplet.start | `WebApplet.start()`}.
|
|
4502
|
+
* All values are optional and only take effect at launch time.
|
|
4503
|
+
*/
|
|
4504
|
+
interface WebAppletOptions {
|
|
4505
|
+
/** Enable the `window.nx` JavaScript API in the browser for bidirectional messaging. */
|
|
4506
|
+
jsExtension?: boolean;
|
|
4507
|
+
/** Start the browser hidden (can be shown later with {@link WebApplet.appear | `appear()`}). */
|
|
4508
|
+
bootHidden?: boolean;
|
|
4509
|
+
/** Whether to show the footer (address bar). */
|
|
4510
|
+
footer?: boolean;
|
|
4511
|
+
/** Whether to show a pointer cursor. */
|
|
4512
|
+
pointer?: boolean;
|
|
4513
|
+
/** Left stick behavior: `'pointer'` (move pointer) or `'cursor'` (scroll). */
|
|
4514
|
+
leftStickMode?: "pointer" | "cursor";
|
|
4515
|
+
/** Boot display screen color. */
|
|
4516
|
+
bootDisplayKind?: "default" | "white" | "black";
|
|
4517
|
+
/** Background kind. */
|
|
4518
|
+
backgroundKind?: "default";
|
|
4519
|
+
/** Footer fixed display kind. */
|
|
4520
|
+
footerFixedKind?: "default" | "always" | "hidden";
|
|
4521
|
+
/** Boot as a media player applet. */
|
|
4522
|
+
bootAsMediaPlayer?: boolean;
|
|
4523
|
+
/** Enable/disable screenshot capture (Web mode only). */
|
|
4524
|
+
screenShot?: boolean;
|
|
4525
|
+
/** Enable/disable the page cache. */
|
|
4526
|
+
pageCache?: boolean;
|
|
4527
|
+
/** Enable/disable Web Audio API. */
|
|
4528
|
+
webAudio?: boolean;
|
|
4529
|
+
/** Enable/disable page fade transition. */
|
|
4530
|
+
pageFade?: boolean;
|
|
4531
|
+
/** Show/hide the boot loading icon (Offline mode only). */
|
|
4532
|
+
bootLoadingIcon?: boolean;
|
|
4533
|
+
/** Show/hide the page scroll indicator. */
|
|
4534
|
+
pageScrollIndicator?: boolean;
|
|
4535
|
+
/** Enable/disable media player speed controls. */
|
|
4536
|
+
mediaPlayerSpeedControl?: boolean;
|
|
4537
|
+
/** Enable/disable media autoplay. */
|
|
4538
|
+
mediaAutoPlay?: boolean;
|
|
4539
|
+
/** Override web audio volume (0.0 to 1.0). */
|
|
4540
|
+
overrideWebAudioVolume?: number;
|
|
4541
|
+
/** Override media audio volume (0.0 to 1.0). */
|
|
4542
|
+
overrideMediaAudioVolume?: number;
|
|
4543
|
+
/** Enable/disable media player auto-close on end. */
|
|
4544
|
+
mediaPlayerAutoClose?: boolean;
|
|
4545
|
+
/** Show/hide media player UI (Offline mode only). */
|
|
4546
|
+
mediaPlayerUi?: boolean;
|
|
4547
|
+
/** Additional string appended to the user agent (Web mode only). */
|
|
4548
|
+
userAgentAdditionalString?: string;
|
|
4549
|
+
}
|
|
4550
|
+
/**
|
|
4551
|
+
* Opens the Switch's built-in web browser as a Library Applet.
|
|
4552
|
+
* Requires Application mode (NSP install or hbmenu via title override).
|
|
4553
|
+
*
|
|
4554
|
+
* @example Non-blocking with messaging
|
|
4555
|
+
* ```typescript
|
|
4556
|
+
* const applet = new Switch.WebApplet('https://myapp.example.com');
|
|
4557
|
+
*
|
|
4558
|
+
* applet.addEventListener('message', (e) => {
|
|
4559
|
+
* console.log('From browser:', e.data);
|
|
4560
|
+
* applet.sendMessage('response');
|
|
4561
|
+
* });
|
|
4562
|
+
*
|
|
4563
|
+
* applet.addEventListener('exit', () => {
|
|
4564
|
+
* console.log('Browser closed');
|
|
4565
|
+
* });
|
|
4566
|
+
*
|
|
4567
|
+
* await applet.start({ jsExtension: true });
|
|
4568
|
+
* ```
|
|
4569
|
+
*/
|
|
4570
|
+
declare class WebApplet extends EventTarget {
|
|
4571
|
+
#private;
|
|
4572
|
+
constructor(url: string);
|
|
4573
|
+
/**
|
|
4574
|
+
* Whether the browser applet is currently running.
|
|
4575
|
+
*/
|
|
4576
|
+
get running(): boolean;
|
|
4577
|
+
/**
|
|
4578
|
+
* The current operating mode:
|
|
4579
|
+
* - `'web-session'` — HTTP/HTTPS URL with WebSession (supports `window.nx` messaging)
|
|
4580
|
+
* - `'htmldoc'` — HtmlDocument applet loading HTML from app's html-document NCA (supports `window.nx` messaging)
|
|
4581
|
+
* - `'none'` — not started
|
|
4582
|
+
*/
|
|
4583
|
+
get mode(): string;
|
|
4584
|
+
/**
|
|
4585
|
+
* Opens the browser. The nx.js event loop continues running.
|
|
4586
|
+
* Pass an options object to configure the applet before launch.
|
|
4587
|
+
* Listen for `'message'` and `'exit'` events.
|
|
4588
|
+
*/
|
|
4589
|
+
start(options?: WebAppletOptions): Promise<void>;
|
|
4590
|
+
/**
|
|
4591
|
+
* Make the browser visible if it was started hidden.
|
|
4592
|
+
*/
|
|
4593
|
+
appear(): void;
|
|
4594
|
+
/**
|
|
4595
|
+
* Send a string message to the browser page.
|
|
4596
|
+
* The page receives it via `window.nx.onMessage`.
|
|
4597
|
+
* Requires `jsExtension: true` in the start options.
|
|
4598
|
+
*/
|
|
4599
|
+
sendMessage(msg: string): boolean;
|
|
4600
|
+
/**
|
|
4601
|
+
* Request the browser to close gracefully.
|
|
4602
|
+
*/
|
|
4603
|
+
requestExit(): void;
|
|
4604
|
+
/**
|
|
4605
|
+
* Force close the browser and clean up.
|
|
4606
|
+
*/
|
|
4607
|
+
close(): void;
|
|
4608
|
+
}
|
|
4426
4609
|
type PathLike = string | URL;
|
|
4427
4610
|
interface Versions {
|
|
4428
4611
|
/**
|
|
@@ -4542,6 +4725,17 @@ declare namespace Switch {
|
|
|
4542
4725
|
* This option is similar to that offered by the Node.js net module and allows interoperability with code which utilizes it.
|
|
4543
4726
|
*/
|
|
4544
4727
|
allowHalfOpen?: boolean;
|
|
4728
|
+
/**
|
|
4729
|
+
* When `true` (default), the TLS handshake will verify the server's
|
|
4730
|
+
* certificate against the system CA certificate store. Set to `false`
|
|
4731
|
+
* to disable certificate verification (e.g. for development/testing
|
|
4732
|
+
* with self-signed certificates).
|
|
4733
|
+
*
|
|
4734
|
+
* Only applicable when `secureTransport` is `'on'` or `'starttls'`.
|
|
4735
|
+
*
|
|
4736
|
+
* @default true
|
|
4737
|
+
*/
|
|
4738
|
+
rejectUnauthorized?: boolean;
|
|
4545
4739
|
}
|
|
4546
4740
|
interface SocketInfo {
|
|
4547
4741
|
remoteAddress: string;
|