@quick-threejs/reactive 0.1.40 → 0.1.42
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/{FontLoader-Cp39O036.mjs → FontLoader-Dz0z8aMc.mjs} +41 -8
- package/dist/common/blueprints/props.blueprint.d.ts +9 -1
- package/dist/common/interfaces/core.interface.d.ts +2 -1
- package/dist/core/app/app.module.d.ts +2 -2
- package/dist/core/app/app.service.d.ts +2 -2
- package/dist/core/app/sizes/sizes.module.d.ts +1 -1
- package/dist/core/app/sizes/sizes.service.d.ts +1 -1
- package/dist/core/register/register.module.d.ts +7 -5
- package/dist/core/register/register.service.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/main.mjs +823 -671
- package/dist/worker.js +1 -1
- package/dist/worker.mjs +351 -302
- package/package.json +4 -4
|
@@ -2940,9 +2940,23 @@ function We(e, t) {
|
|
|
2940
2940
|
}
|
|
2941
2941
|
}
|
|
2942
2942
|
class ei extends cr {
|
|
2943
|
+
/**
|
|
2944
|
+
* Constructs a new font loader.
|
|
2945
|
+
*
|
|
2946
|
+
* @param {LoadingManager} [manager] - The loading manager.
|
|
2947
|
+
*/
|
|
2943
2948
|
constructor(t) {
|
|
2944
2949
|
super(t);
|
|
2945
2950
|
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Starts loading from the given URL and passes the loaded font
|
|
2953
|
+
* to the `onLoad()` callback.
|
|
2954
|
+
*
|
|
2955
|
+
* @param {string} url - The path/URL of the file to be loaded. This can also be a data URI.
|
|
2956
|
+
* @param {function(Font)} onLoad - Executed when the loading process has been finished.
|
|
2957
|
+
* @param {onProgressCallback} onProgress - Executed while the loading is in progress.
|
|
2958
|
+
* @param {onErrorCallback} onError - Executed when errors occur.
|
|
2959
|
+
*/
|
|
2946
2960
|
load(t, r, n, i) {
|
|
2947
2961
|
const o = this, s = new fr(this.manager);
|
|
2948
2962
|
s.setPath(this.path), s.setRequestHeader(this.requestHeader), s.setWithCredentials(this.withCredentials), s.load(t, function(c) {
|
|
@@ -2950,14 +2964,33 @@ class ei extends cr {
|
|
|
2950
2964
|
r && r(d);
|
|
2951
2965
|
}, n, i);
|
|
2952
2966
|
}
|
|
2967
|
+
/**
|
|
2968
|
+
* Parses the given font data and returns the resulting font.
|
|
2969
|
+
*
|
|
2970
|
+
* @param {Object} json - The raw font data as a JSON object.
|
|
2971
|
+
* @return {Font} The font.
|
|
2972
|
+
*/
|
|
2953
2973
|
parse(t) {
|
|
2954
2974
|
return new Rn(t);
|
|
2955
2975
|
}
|
|
2956
2976
|
}
|
|
2957
2977
|
class Rn {
|
|
2978
|
+
/**
|
|
2979
|
+
* Constructs a new font.
|
|
2980
|
+
*
|
|
2981
|
+
* @param {Object} data - The font data as JSON.
|
|
2982
|
+
*/
|
|
2958
2983
|
constructor(t) {
|
|
2959
2984
|
this.isFont = !0, this.type = "Font", this.data = t;
|
|
2960
2985
|
}
|
|
2986
|
+
/**
|
|
2987
|
+
* Generates geometry shapes from the given text and size. The result of this method
|
|
2988
|
+
* should be used with {@link ShapeGeometry} to generate the actual geometry data.
|
|
2989
|
+
*
|
|
2990
|
+
* @param {string} text - The text.
|
|
2991
|
+
* @param {number} [size=100] - The text size.
|
|
2992
|
+
* @return {Array<Shape>} An array of shapes representing the text.
|
|
2993
|
+
*/
|
|
2961
2994
|
generateShapes(t, r = 100) {
|
|
2962
2995
|
const n = [], i = Pn(t, r, this.data);
|
|
2963
2996
|
for (let o = 0, s = i.length; o < s; o++)
|
|
@@ -3035,16 +3068,16 @@ export {
|
|
|
3035
3068
|
zr as e,
|
|
3036
3069
|
qn as f,
|
|
3037
3070
|
Ln as g,
|
|
3038
|
-
|
|
3071
|
+
Ar as h,
|
|
3039
3072
|
Zn as i,
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3073
|
+
jn as j,
|
|
3074
|
+
Pt as k,
|
|
3075
|
+
Xn as l,
|
|
3043
3076
|
Ht as m,
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3077
|
+
Kn as n,
|
|
3078
|
+
Bn as o,
|
|
3079
|
+
zn as p,
|
|
3080
|
+
Fn as q,
|
|
3048
3081
|
Dr as r,
|
|
3049
3082
|
Yn as s,
|
|
3050
3083
|
Gn as t,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefaultCameraType } from '../enums';
|
|
2
|
-
import { ContainerizedApp, Module, LoaderSource } from '../interfaces';
|
|
2
|
+
import { ContainerizedApp, Module, LoaderSource, OffscreenCanvasWithStyle } from '../interfaces';
|
|
3
3
|
import { RegisterModule } from '../../core/register/register.module';
|
|
4
4
|
/**
|
|
5
5
|
* @description {@link RegisterModule} initialization properties.
|
|
@@ -17,6 +17,12 @@ export declare class RegisterPropsBlueprint {
|
|
|
17
17
|
* @default true
|
|
18
18
|
*/
|
|
19
19
|
initOnConstruct?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description Initialize the app on main thread.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
mainThread?: boolean;
|
|
20
26
|
/**
|
|
21
27
|
* @description App `canvas` element reference.
|
|
22
28
|
*
|
|
@@ -118,6 +124,8 @@ export declare class RegisterPropsBlueprint {
|
|
|
118
124
|
* @description {@link AppModule} initialization properties.
|
|
119
125
|
*/
|
|
120
126
|
export declare class LaunchAppProps<M extends Module> {
|
|
127
|
+
/** @description App `canvas` element reference. */
|
|
128
|
+
canvas?: OffscreenCanvasWithStyle | HTMLCanvasElement;
|
|
121
129
|
/** @description Handler triggered when the app is ready. */
|
|
122
130
|
onReady?: (workerApp: ContainerizedApp<M>) => unknown;
|
|
123
131
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OffscreenCanvasWithStyle } from 'main';
|
|
1
2
|
import { RegisterPropsBlueprint } from '../blueprints/props.blueprint';
|
|
2
3
|
export interface AppModulePropsMessageEvent extends MessageEvent<Omit<RegisterPropsBlueprint, "canvas" | "location" | "loaderDataSources"> & {
|
|
3
4
|
/**
|
|
@@ -5,6 +6,6 @@ export interface AppModulePropsMessageEvent extends MessageEvent<Omit<RegisterPr
|
|
|
5
6
|
*
|
|
6
7
|
* @default `undefined`
|
|
7
8
|
*/
|
|
8
|
-
canvas?:
|
|
9
|
+
canvas?: OffscreenCanvasWithStyle | HTMLCanvasElement;
|
|
9
10
|
}> {
|
|
10
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkerThreadModule } from '@quick-threejs/worker';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { AppModulePropsMessageEvent, Module, AppProxyEventHandlersBlueprint } from '../../common';
|
|
3
|
+
import { AppModulePropsMessageEvent, Module, AppProxyEventHandlersBlueprint, OffscreenCanvasWithStyle } from '../../common';
|
|
4
4
|
import { AppController } from './app.controller';
|
|
5
5
|
import { AppService } from './app.service';
|
|
6
6
|
import { TimerModule } from './timer/timer.module';
|
|
@@ -23,7 +23,7 @@ export declare class AppModule extends AppProxyEventHandlersBlueprint implements
|
|
|
23
23
|
constructor(_controller: AppController, _service: AppService, timer: TimerModule, sizes: SizesModule, camera: CameraModule, world: WorldModule, renderer: RendererModule, loader: LoaderModule, debug: DebugModule);
|
|
24
24
|
private _initProxyEvents;
|
|
25
25
|
getProxyReceiver(): import('@quick-threejs/utils').ProxyReceiver<Record<string, unknown>>;
|
|
26
|
-
getCanvas():
|
|
26
|
+
getCanvas(): OffscreenCanvasWithStyle | HTMLCanvasElement | undefined;
|
|
27
27
|
getIsInitialized(): boolean;
|
|
28
28
|
getBeforeStep$(): Observable<import('@quick-threejs/utils').NonNever<{
|
|
29
29
|
readonly frame: number;
|
|
@@ -4,6 +4,6 @@ export declare class AppService {
|
|
|
4
4
|
private _canvas?;
|
|
5
5
|
readonly proxyReceiver: ProxyReceiver<Record<string, unknown>>;
|
|
6
6
|
isInitialized: boolean;
|
|
7
|
-
get canvas(): OffscreenCanvasWithStyle | undefined;
|
|
8
|
-
set canvas(canvas:
|
|
7
|
+
get canvas(): OffscreenCanvasWithStyle | HTMLCanvasElement | undefined;
|
|
8
|
+
set canvas(canvas: HTMLCanvasElement | OffscreenCanvasWithStyle);
|
|
9
9
|
}
|
|
@@ -6,7 +6,7 @@ export declare class SizesModule implements Module {
|
|
|
6
6
|
private readonly _controller;
|
|
7
7
|
private readonly _service;
|
|
8
8
|
constructor(_controller: SizesController, _service: SizesService);
|
|
9
|
-
init(canvas: OffscreenCanvasWithStyle): void;
|
|
9
|
+
init(canvas: OffscreenCanvasWithStyle | HTMLCanvasElement): void;
|
|
10
10
|
dispose(): void;
|
|
11
11
|
aspect(value?: number): number;
|
|
12
12
|
enabled(value?: boolean): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DependencyContainer } from 'tsyringe';
|
|
2
|
-
import { Module, RegisterPropsBlueprint, RegisterProxyEventHandlersBlueprint } from '../../common';
|
|
2
|
+
import { Module, RegisterPropsBlueprint, RegisterProxyEventHandlersBlueprint, OffscreenCanvasWithStyle } from '../../common';
|
|
3
3
|
import { ExposedAppModule } from '../app/app.worker';
|
|
4
4
|
import { RegisterService } from './register.service';
|
|
5
5
|
import { RegisterController } from './register.controller';
|
|
@@ -15,15 +15,17 @@ export declare class RegisterModule extends RegisterProxyEventHandlersBlueprint
|
|
|
15
15
|
private readonly _subscriptions;
|
|
16
16
|
private _initialized;
|
|
17
17
|
constructor(_service: RegisterService, _controller: RegisterController, _loaderController: LoaderController, container: DependencyContainer, props: RegisterPropsBlueprint, loader: LoaderModule);
|
|
18
|
+
private get currentWorker();
|
|
18
19
|
private _initCanvas;
|
|
19
|
-
private
|
|
20
|
+
private _initServiceWorker;
|
|
20
21
|
private _initEvents;
|
|
21
|
-
private
|
|
22
|
-
private
|
|
22
|
+
private _initOnMainThread;
|
|
23
|
+
private _initOnWorkerThread;
|
|
24
|
+
private _initObservables;
|
|
23
25
|
private _initLoader;
|
|
24
26
|
init(): Promise<void>;
|
|
25
27
|
getCanvas(): HTMLCanvasElement | undefined;
|
|
26
|
-
getOffscreenCanvas():
|
|
28
|
+
getOffscreenCanvas(): OffscreenCanvasWithStyle | undefined;
|
|
27
29
|
getThread(): import('threads').ModuleThread<ExposedAppModule> | undefined;
|
|
28
30
|
getWorker(): import('threads/dist/types/master').Worker | undefined;
|
|
29
31
|
getWorkerPool(): import('@quick-threejs/worker').WorkerPool;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { WorkerPool, WorkerThreadResolution } from '@quick-threejs/worker';
|
|
2
|
-
import { RegisterPropsBlueprint } from '../../common';
|
|
2
|
+
import { OffscreenCanvasWithStyle, RegisterPropsBlueprint } from '../../common';
|
|
3
3
|
import { ExposedAppModule } from '../app/app.worker';
|
|
4
4
|
export declare class RegisterService {
|
|
5
5
|
private readonly _props;
|
|
6
6
|
readonly workerPool: WorkerPool;
|
|
7
7
|
canvas?: HTMLCanvasElement;
|
|
8
|
-
offscreenCanvas?:
|
|
8
|
+
offscreenCanvas?: OffscreenCanvasWithStyle;
|
|
9
9
|
worker?: WorkerThreadResolution<ExposedAppModule>["worker"];
|
|
10
10
|
thread?: WorkerThreadResolution<ExposedAppModule>["thread"];
|
|
11
11
|
constructor(_props: RegisterPropsBlueprint);
|