@variantic/player 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/libs/packages/player/src/index.d.ts +8 -0
- package/libs/schemas/library-api/src/index.d.ts +1 -0
- package/libs/schemas/library-api/src/lib/library-api.d.ts +7 -0
- package/libs/schemas/web-component/api/player/ar/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/ar/src/lib/ar.d.ts +16 -0
- package/libs/schemas/web-component/api/player/configuration/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/configuration/src/lib/configuration.d.ts +20 -0
- package/libs/schemas/web-component/api/player/documentation/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/documentation/src/lib/documentation.d.ts +17 -0
- package/libs/schemas/web-component/api/player/events/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/events/src/lib/events.d.ts +19 -0
- package/libs/schemas/web-component/api/player/integration-connector/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/integration-connector/src/lib/integration-connector.d.ts +24 -0
- package/libs/schemas/web-component/api/player/layout/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/layout/src/lib/layout.d.ts +10 -0
- package/libs/schemas/web-component/api/player/player/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/player/src/lib/player.d.ts +28 -0
- package/libs/schemas/web-component/api/player/snapshot/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/snapshot/src/lib/snapshot.d.ts +20 -0
- package/libs/schemas/web-component/api/player/viewer/src/index.d.ts +1 -0
- package/libs/schemas/web-component/api/player/viewer/src/lib/viewer.d.ts +284 -0
- package/package.json +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Player Type Definitions
|
|
2
|
+
|
|
3
|
+
This package provides **TypeScript type definitions** for the **Variantic Player**.
|
|
4
|
+
⚠️ **Currently, this package ONLY includes type definitions.**
|
|
5
|
+
Future versions will introduce functionalities for controlling the embedded player.
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
You can install this package via npm:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @variantic/player
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 🚀 Usage
|
|
16
|
+
|
|
17
|
+
Import the necessary types into your TypeScript project:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { TSnapshotUrl } from '@variantic/player';
|
|
21
|
+
|
|
22
|
+
const snapshotUrl: TSnapshotUrl = {
|
|
23
|
+
url: 'testUrl',
|
|
24
|
+
snapshotBlob: new Blob(),
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 📜 License
|
|
29
|
+
|
|
30
|
+
This package is licensed under the MIT License. See [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "../../../schemas/web-component/api/player/viewer/src";
|
|
2
|
+
export * from "../../../schemas/web-component/api/player/ar/src";
|
|
3
|
+
export * from "../../../schemas/web-component/api/player/configuration/src";
|
|
4
|
+
export * from "../../../schemas/web-component/api/player/documentation/src";
|
|
5
|
+
export * from "../../../schemas/web-component/api/player/integration-connector/src";
|
|
6
|
+
export * from "../../../schemas/web-component/api/player/layout/src";
|
|
7
|
+
export * from "../../../schemas/web-component/api/player/snapshot/src";
|
|
8
|
+
export * from "../../../schemas/web-component/api/player/player/src";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/library-api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/ar';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
3
|
+
/**
|
|
4
|
+
* @category Addons API
|
|
5
|
+
*/
|
|
6
|
+
export type TARApi = {
|
|
7
|
+
events: Emittery<TARApiEvents>;
|
|
8
|
+
generateAndUpload(): Promise<{
|
|
9
|
+
qrImage: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}>;
|
|
12
|
+
generate(): Promise<Blob>;
|
|
13
|
+
};
|
|
14
|
+
export type TARApiEvents = TWebComponentEvents<{
|
|
15
|
+
generated: Blob;
|
|
16
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/configuration';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
3
|
+
/**
|
|
4
|
+
* @category Addons API
|
|
5
|
+
*/
|
|
6
|
+
export type TConfigurationApi = {
|
|
7
|
+
events: Emittery<TConfigurationApiEvents>;
|
|
8
|
+
generate(): TConfigurationContent;
|
|
9
|
+
generateAndUpload(): Promise<TConfigurationUrl>;
|
|
10
|
+
};
|
|
11
|
+
export type TConfigurationApiEvents = TWebComponentEvents<{
|
|
12
|
+
generated: TConfigurationContent;
|
|
13
|
+
uploaded: TConfigurationUrl;
|
|
14
|
+
}>;
|
|
15
|
+
export type TConfigurationUrl = {
|
|
16
|
+
id: string;
|
|
17
|
+
url: string;
|
|
18
|
+
configuration: TConfigurationContent;
|
|
19
|
+
};
|
|
20
|
+
export type TConfigurationContent = Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/documentation';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
3
|
+
export type TPrimitive = bigint | boolean | null | number | string | symbol | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* @category Addons API
|
|
6
|
+
*/
|
|
7
|
+
export type TDocumentationApi = {
|
|
8
|
+
events: Emittery<TDocumentationApiEvents>;
|
|
9
|
+
getDocumentationAvailability(): boolean;
|
|
10
|
+
generate(sourceData?: Record<string, TPrimitive>): Promise<Blob>;
|
|
11
|
+
generateAndDownload(sourceData?: Record<string, TPrimitive>): Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export type TDocumentationApiEvents = TWebComponentEvents<{
|
|
14
|
+
availabilityChanged: boolean;
|
|
15
|
+
generated: Blob;
|
|
16
|
+
downloaded: Blob;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/events';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type TCommonWebComponentEvents = {
|
|
2
|
+
ready: TTimestampEventPayload;
|
|
3
|
+
scriptsLoaded: TTimestampEventPayload;
|
|
4
|
+
};
|
|
5
|
+
export type TWebComponentEvents<T extends Record<string, unknown> = TCommonWebComponentEvents> = TCommonWebComponentEvents & T;
|
|
6
|
+
export type TTimestampEventPayload = {
|
|
7
|
+
timestamp: number;
|
|
8
|
+
};
|
|
9
|
+
export type TMouseClickedPayload = {
|
|
10
|
+
position: T2DPosition;
|
|
11
|
+
mouseButton: number;
|
|
12
|
+
};
|
|
13
|
+
export type TMouseMovedPayload = {
|
|
14
|
+
position: T2DPosition;
|
|
15
|
+
};
|
|
16
|
+
export type T2DPosition = {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/integration-connector';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
3
|
+
/**
|
|
4
|
+
* @category Addons API
|
|
5
|
+
*/
|
|
6
|
+
export type TIntegrationConnectorApi = {
|
|
7
|
+
events: Emittery<TIntegrationConnectorApiEvents>;
|
|
8
|
+
execute: (params: TExecuteParams) => Promise<TExecutionResponse>;
|
|
9
|
+
hookFlowsByIds: (ids: string[]) => Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export type TIntegrationConnectorApiEvents = TWebComponentEvents<{
|
|
12
|
+
executed: TExecutionResponse & {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
export type TExecuteParams = {
|
|
18
|
+
id: string;
|
|
19
|
+
inputData?: unknown;
|
|
20
|
+
};
|
|
21
|
+
export type TExecutionResponse = {
|
|
22
|
+
isSuccess: boolean;
|
|
23
|
+
data: unknown;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/layout';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
3
|
+
/**
|
|
4
|
+
* @category Addons API
|
|
5
|
+
*/
|
|
6
|
+
export type TLayoutApi = {
|
|
7
|
+
events: Emittery<TLayoutApiEvents>;
|
|
8
|
+
toggleFullscreen: (state: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
export type TLayoutApiEvents = TWebComponentEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/player';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TViewerApi } from "../../../viewer/src";
|
|
3
|
+
import type { TARApi } from "../../../ar/src";
|
|
4
|
+
import type { TConfigurationApi } from "../../../configuration/src";
|
|
5
|
+
import type { TDocumentationApi } from "../../../documentation/src";
|
|
6
|
+
import type { TIntegrationConnectorApi } from "../../../integration-connector/src";
|
|
7
|
+
import type { TLayoutApi } from "../../../layout/src";
|
|
8
|
+
import type { TSnapshotApi } from "../../../snapshot/src";
|
|
9
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
10
|
+
import type { ILibraryApi } from "../../../../../../library-api/src";
|
|
11
|
+
/**
|
|
12
|
+
* @category Addons API
|
|
13
|
+
*/
|
|
14
|
+
export type TPlayerApi = {
|
|
15
|
+
events: Emittery<TPlayerApiEvents>;
|
|
16
|
+
viewer: TViewerApi;
|
|
17
|
+
getSiteId: () => string;
|
|
18
|
+
getLibraryVersion: () => string;
|
|
19
|
+
libraryApi: ILibraryApi;
|
|
20
|
+
} & Partial<{
|
|
21
|
+
ar: TARApi;
|
|
22
|
+
configuration: TConfigurationApi;
|
|
23
|
+
documentation: TDocumentationApi;
|
|
24
|
+
ic: TIntegrationConnectorApi;
|
|
25
|
+
layout: TLayoutApi;
|
|
26
|
+
snapshot: TSnapshotApi;
|
|
27
|
+
}>;
|
|
28
|
+
export type TPlayerApiEvents = TWebComponentEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/snapshot';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TWebComponentEvents } from "../../../events/src";
|
|
3
|
+
/**
|
|
4
|
+
* @category Addons API
|
|
5
|
+
*/
|
|
6
|
+
export type TSnapshotApi = {
|
|
7
|
+
events: Emittery<TSnapshotApiEvents>;
|
|
8
|
+
generate(): Promise<Blob>;
|
|
9
|
+
generateAndDownload(): Promise<void>;
|
|
10
|
+
generateAndUpload(): Promise<TSnapshotUrl>;
|
|
11
|
+
};
|
|
12
|
+
export type TSnapshotApiEvents = TWebComponentEvents<{
|
|
13
|
+
generated: Blob;
|
|
14
|
+
downloaded: Blob;
|
|
15
|
+
uploaded: TSnapshotUrl;
|
|
16
|
+
}>;
|
|
17
|
+
export type TSnapshotUrl = {
|
|
18
|
+
url: string;
|
|
19
|
+
snapshotBlob: Blob;
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/viewer';
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { TTimestampEventPayload, TWebComponentEvents, TMouseClickedPayload, TMouseMovedPayload } from "../../../events/src";
|
|
3
|
+
/**
|
|
4
|
+
* @category Addons API
|
|
5
|
+
*/
|
|
6
|
+
export type TViewerApi = {
|
|
7
|
+
events: Emittery<TViewerApiEvents>;
|
|
8
|
+
getPlayerInstance(): any;
|
|
9
|
+
get isLoaded(): boolean;
|
|
10
|
+
getConfiguration(options?: TGetConfigurationParams): TConfiguration | null;
|
|
11
|
+
getPrice(): number;
|
|
12
|
+
getPriceWithCurrency(): string | undefined;
|
|
13
|
+
setPrice(value: number | string): void;
|
|
14
|
+
getScene(): any;
|
|
15
|
+
getModel3D(): any;
|
|
16
|
+
getModelContainer3D(): any;
|
|
17
|
+
getCanvas(): HTMLCanvasElement;
|
|
18
|
+
getMaterialGroups(): Promise<TMaterialGroup[]>;
|
|
19
|
+
getSelectedMaterialByGroup(): {
|
|
20
|
+
[key: number]: number;
|
|
21
|
+
};
|
|
22
|
+
getMaterialDataById(materialId: number): TMaterial;
|
|
23
|
+
getMaterialsList(filterId: number, groupingQueryId?: number): Promise<TMaterialsList>;
|
|
24
|
+
getLayoutSettings(): TLayoutSettings;
|
|
25
|
+
assignMaterial(groupId: number, materialId: number): Promise<void>;
|
|
26
|
+
changeCameraType(type: 'orthographic' | 'perspective'): void;
|
|
27
|
+
setCameraSettings(settings: TCameraSettings): void;
|
|
28
|
+
moveCamera(params: TMoveCameraParams): Promise<void>;
|
|
29
|
+
autoFitCamera(): Promise<void>;
|
|
30
|
+
generateBom({ templateId, filterId, }: {
|
|
31
|
+
templateId: number;
|
|
32
|
+
filterId: number;
|
|
33
|
+
}): Promise<TBom>;
|
|
34
|
+
getSetFloorSettings(): TFloorSettings;
|
|
35
|
+
getTargetUnit(): string;
|
|
36
|
+
getUnits(): TUnit[];
|
|
37
|
+
getDimensions(filter?: 'default' | 'defaultNotControlledByEvent'): any[];
|
|
38
|
+
changeUnit(unit: string): void;
|
|
39
|
+
convertFromMillimeters(value: number | string, baseUnit: string): number | string;
|
|
40
|
+
translate(key: string): string;
|
|
41
|
+
changeView(view: 'preview' | 'edit'): void;
|
|
42
|
+
changeParameter(code: string, value: string | number): void;
|
|
43
|
+
normalizeParameterValue(parameter: TParameter, value: string | number): {
|
|
44
|
+
value: string | number;
|
|
45
|
+
label: string;
|
|
46
|
+
};
|
|
47
|
+
enableAllLayers(): void;
|
|
48
|
+
disableAllLayers(): void;
|
|
49
|
+
enableLayer(id: number): void;
|
|
50
|
+
disableLayer(id: number): void;
|
|
51
|
+
toggleDimensions(state: boolean, dimensions?: number[] | 'default' | 'defaultNotControlledByEvent'): void;
|
|
52
|
+
};
|
|
53
|
+
export type TViewerApiEvents = TWebComponentEvents<{
|
|
54
|
+
loaded: TTimestampEventPayload;
|
|
55
|
+
reloaded: TTimestampEventPayload;
|
|
56
|
+
reloadedAfterLoad: TTimestampEventPayload;
|
|
57
|
+
configurationUpdating: TTimestampEventPayload;
|
|
58
|
+
sceneReloaded: TTimestampEventPayload;
|
|
59
|
+
configurationUpdated: TConfiguration;
|
|
60
|
+
priceChanged: {
|
|
61
|
+
price: number;
|
|
62
|
+
priceWithCurrency: string;
|
|
63
|
+
};
|
|
64
|
+
bomGenerated: {
|
|
65
|
+
templateId: number;
|
|
66
|
+
filterId: number;
|
|
67
|
+
bom: TBom;
|
|
68
|
+
};
|
|
69
|
+
materialAssigned: {
|
|
70
|
+
groupId: number;
|
|
71
|
+
materialId: number;
|
|
72
|
+
};
|
|
73
|
+
materialAssignedAfterLoad: {
|
|
74
|
+
groupId: number;
|
|
75
|
+
materialId: number;
|
|
76
|
+
};
|
|
77
|
+
mouseClicked: TMouseClickedPayload;
|
|
78
|
+
mouseMoved: TMouseMovedPayload;
|
|
79
|
+
dimensionToggled: {
|
|
80
|
+
state: boolean;
|
|
81
|
+
};
|
|
82
|
+
}>;
|
|
83
|
+
export type TGetConfigurationParams = {
|
|
84
|
+
includeHidden?: boolean;
|
|
85
|
+
};
|
|
86
|
+
export type TMoveCameraParams = {
|
|
87
|
+
angle?: TCameraAngle;
|
|
88
|
+
animation?: boolean;
|
|
89
|
+
};
|
|
90
|
+
export type TCameraAngle = 'default' | '-x+z' | '+x+z' | '-x-z' | '+x-z' | '+z' | '-z' | '+y' | '-y' | '+x' | '-x';
|
|
91
|
+
export type TMaterial = {
|
|
92
|
+
id: number;
|
|
93
|
+
name: string;
|
|
94
|
+
code: string;
|
|
95
|
+
price: number;
|
|
96
|
+
group: string;
|
|
97
|
+
type: string;
|
|
98
|
+
mass: number;
|
|
99
|
+
mass_unit: string;
|
|
100
|
+
dim_x: number;
|
|
101
|
+
dim_y: number;
|
|
102
|
+
dim_z: number;
|
|
103
|
+
dim_unit: string;
|
|
104
|
+
data_1: string;
|
|
105
|
+
data_2: string;
|
|
106
|
+
data_3: string;
|
|
107
|
+
data_4: string;
|
|
108
|
+
url: string;
|
|
109
|
+
photo: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
grain: boolean;
|
|
112
|
+
};
|
|
113
|
+
export type TMeta = {
|
|
114
|
+
totalItems: number;
|
|
115
|
+
itemCount: number;
|
|
116
|
+
itemsPerPage: number;
|
|
117
|
+
totalPages: number;
|
|
118
|
+
currentPage: number;
|
|
119
|
+
};
|
|
120
|
+
export type TMaterialsList = {
|
|
121
|
+
items: TMaterial[];
|
|
122
|
+
meta: TMeta;
|
|
123
|
+
};
|
|
124
|
+
export type TLayoutSettings = {
|
|
125
|
+
colors: {
|
|
126
|
+
primaryColor: string;
|
|
127
|
+
secondaryColor: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export type TFilterGroupingQuery = {
|
|
131
|
+
name: string;
|
|
132
|
+
default: boolean;
|
|
133
|
+
};
|
|
134
|
+
export type TFilter = {
|
|
135
|
+
name: string;
|
|
136
|
+
id: number;
|
|
137
|
+
groupingQueries: TFilterGroupingQuery[];
|
|
138
|
+
};
|
|
139
|
+
export type TMaterialGroup = {
|
|
140
|
+
id: number;
|
|
141
|
+
name: string;
|
|
142
|
+
filterData: TFilter;
|
|
143
|
+
filters: TFilter[];
|
|
144
|
+
showType: string;
|
|
145
|
+
};
|
|
146
|
+
export type TBom = {
|
|
147
|
+
name: string;
|
|
148
|
+
head: string[];
|
|
149
|
+
body: string[][];
|
|
150
|
+
};
|
|
151
|
+
export type TCameraSettings = {
|
|
152
|
+
autoCameraFit?: boolean;
|
|
153
|
+
fitAngle?: TCameraAngle;
|
|
154
|
+
cameraFitToSelected?: boolean;
|
|
155
|
+
cameraSnapToAngle?: boolean;
|
|
156
|
+
cameraType?: 'orthographic' | 'perspective';
|
|
157
|
+
enablePan?: boolean;
|
|
158
|
+
enableRotate?: boolean;
|
|
159
|
+
blockRotationAxes?: {
|
|
160
|
+
x?: boolean;
|
|
161
|
+
y?: boolean;
|
|
162
|
+
z?: boolean;
|
|
163
|
+
};
|
|
164
|
+
blockMoveUnderFloor?: boolean;
|
|
165
|
+
zoomBoundaries?: {
|
|
166
|
+
max?: number;
|
|
167
|
+
min?: number;
|
|
168
|
+
};
|
|
169
|
+
rotateBoundaries?: {
|
|
170
|
+
x?: {
|
|
171
|
+
min?: number;
|
|
172
|
+
max?: number;
|
|
173
|
+
};
|
|
174
|
+
y?: {
|
|
175
|
+
min?: number;
|
|
176
|
+
max?: number;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
enableCameraOptimization?: boolean;
|
|
180
|
+
enableAutoRotate?: boolean;
|
|
181
|
+
autoRotateActivationTime?: number;
|
|
182
|
+
autoRotateSpeed?: number;
|
|
183
|
+
infinityRotationAxes?: {
|
|
184
|
+
x?: boolean;
|
|
185
|
+
y?: boolean;
|
|
186
|
+
};
|
|
187
|
+
isCameraSet?: boolean;
|
|
188
|
+
defaultFar?: boolean;
|
|
189
|
+
};
|
|
190
|
+
export type TFloorSettings = {
|
|
191
|
+
activeFloor: boolean;
|
|
192
|
+
activeFloorShadow: boolean;
|
|
193
|
+
useFloorInAR: boolean;
|
|
194
|
+
floorSize: {
|
|
195
|
+
x: number;
|
|
196
|
+
y: number;
|
|
197
|
+
};
|
|
198
|
+
floorSizeType: 'infinity' | 'likeObject' | 'custom';
|
|
199
|
+
selectedMaterialGroup: number | null;
|
|
200
|
+
selectedDefaultMaterial: number | null;
|
|
201
|
+
};
|
|
202
|
+
export type TUnit = {
|
|
203
|
+
unit: string;
|
|
204
|
+
label: string;
|
|
205
|
+
};
|
|
206
|
+
export type TParameterTypes = 'number-range' | 'number-predefined' | 'number-constant' | 'text-constant' | 'list-options' | 'list-buttons' | 'list-image-options' | 'list-image-buttons' | 'list-images' | 'button';
|
|
207
|
+
export type TParameterEvents = {
|
|
208
|
+
[K in keyof GlobalEventHandlersEventMap]?: (event: GlobalEventHandlersEventMap[K]) => void;
|
|
209
|
+
};
|
|
210
|
+
export type TParameterBase<TType extends TParameterTypes = TParameterTypes, TSettings = undefined> = {
|
|
211
|
+
code: string;
|
|
212
|
+
name: string;
|
|
213
|
+
type: TType;
|
|
214
|
+
unit: string;
|
|
215
|
+
unitLabel: string;
|
|
216
|
+
value: string;
|
|
217
|
+
valueLabel: string;
|
|
218
|
+
settings: TSettings;
|
|
219
|
+
events?: TParameterEvents;
|
|
220
|
+
isHidden?: boolean;
|
|
221
|
+
};
|
|
222
|
+
export type TParameterNumberRange = TParameterBase<'number-range', {
|
|
223
|
+
min: number;
|
|
224
|
+
minLabel: string;
|
|
225
|
+
max: number;
|
|
226
|
+
maxLabel: string;
|
|
227
|
+
preferred?: number[];
|
|
228
|
+
}>;
|
|
229
|
+
type TNumberPredefinedStyleSettings = {
|
|
230
|
+
align?: 'content' | 'responsive';
|
|
231
|
+
};
|
|
232
|
+
export type TParameterNumberPredefined = TParameterBase<'number-predefined', {
|
|
233
|
+
options: string[];
|
|
234
|
+
optionLabels: string[];
|
|
235
|
+
styleSettings?: TNumberPredefinedStyleSettings;
|
|
236
|
+
}>;
|
|
237
|
+
export type TParameterNumberConstant = TParameterBase<'number-constant'>;
|
|
238
|
+
type TListStyleSettings = {
|
|
239
|
+
size?: 'sm' | 'md' | 'lg';
|
|
240
|
+
shape?: 'square' | 'portrait' | 'landscape';
|
|
241
|
+
align?: 'content' | 'responsive';
|
|
242
|
+
};
|
|
243
|
+
export type TParameterListOptions = TParameterBase<'list-options', {
|
|
244
|
+
defaultValue: string;
|
|
245
|
+
options: Record<string, string>;
|
|
246
|
+
styleSettings?: TListStyleSettings;
|
|
247
|
+
}>;
|
|
248
|
+
export type TParameterListButtons = TParameterBase<'list-buttons', {
|
|
249
|
+
defaultValue: string;
|
|
250
|
+
options: Record<string, string>;
|
|
251
|
+
styleSettings?: TListStyleSettings;
|
|
252
|
+
}>;
|
|
253
|
+
export type TParameterListImageOptions = TParameterBase<'list-image-options', {
|
|
254
|
+
defaultValue: string;
|
|
255
|
+
options: Record<string, string>;
|
|
256
|
+
optionsImages: Record<string, string>;
|
|
257
|
+
styleSettings?: TListStyleSettings;
|
|
258
|
+
}>;
|
|
259
|
+
export type TParameterListImageButtons = TParameterBase<'list-image-buttons', {
|
|
260
|
+
defaultValue: string;
|
|
261
|
+
options: Record<string, string>;
|
|
262
|
+
optionsImages: Record<string, string>;
|
|
263
|
+
styleSettings?: TListStyleSettings;
|
|
264
|
+
}>;
|
|
265
|
+
export type TParameterListImages = TParameterBase<'list-images', {
|
|
266
|
+
defaultValue: string | null;
|
|
267
|
+
options: Record<string, {
|
|
268
|
+
image: string | null;
|
|
269
|
+
label: string;
|
|
270
|
+
}>;
|
|
271
|
+
}>;
|
|
272
|
+
export type TParameterText = TParameterBase<'text-constant'>;
|
|
273
|
+
export type TParameterButton = TParameterBase<'button'>;
|
|
274
|
+
export type TParameter = TParameterNumberRange | TParameterNumberPredefined | TParameterNumberConstant | TParameterListOptions | TParameterListButtons | TParameterListImageOptions | TParameterListImageButtons | TParameterListImages | TParameterText | TParameterButton;
|
|
275
|
+
export type TCategory = {
|
|
276
|
+
id: number;
|
|
277
|
+
name: string;
|
|
278
|
+
parameters: TParameter[];
|
|
279
|
+
isHidden?: boolean;
|
|
280
|
+
};
|
|
281
|
+
export type TConfiguration = {
|
|
282
|
+
categories: TCategory[];
|
|
283
|
+
};
|
|
284
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@variantic/player",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"emittery": "^1.0.2"
|
|
13
|
+
},
|
|
14
|
+
"type": "commonjs",
|
|
15
|
+
"typings": "./libs/packages/player/src/index.d.ts",
|
|
16
|
+
"types": "./libs/packages/player/src/index.d.ts",
|
|
17
|
+
"main": "./libs/packages/player/src/index.js"
|
|
18
|
+
}
|