@albi_scando/as-design-system-threejs-lib 1.1.5 → 1.1.7
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/as-design-system-threejs-lib.es.js +5759 -6243
- package/dist/as-design-system-threejs-lib.umd.js +192 -190
- package/dist/types/web-components/language-picker/component.d.ts +56 -31
- package/dist/types/web-components/language-picker/main.d.ts +1 -1
- package/dist/types/web-components/language-picker/observed-attributes.const.d.ts +7 -0
- package/dist/types/web-components/theme-picker/component.d.ts +76 -33
- package/dist/types/web-components/theme-picker/default-values.const.d.ts +5 -0
- package/dist/types/web-components/theme-picker/main.d.ts +2 -2
- package/dist/types/web-components/theme-picker/observed-attributes.const.d.ts +7 -0
- package/package.json +3 -6
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import { Locales } from '@albi_scando/as-const-languages-lib';
|
|
2
|
-
export declare const OBSERVED_ATTRIBUTES: {
|
|
3
|
-
LANGUAGES: string;
|
|
4
|
-
SELECTED: string;
|
|
5
|
-
};
|
|
6
2
|
export declare class LanguagePickerComponent extends HTMLElement {
|
|
3
|
+
/**
|
|
4
|
+
* @see TextureLoader
|
|
5
|
+
*/
|
|
7
6
|
private static readonly textureLoader;
|
|
7
|
+
/**
|
|
8
|
+
* @see ShadowRoot
|
|
9
|
+
*/
|
|
8
10
|
readonly shadowRoot: ShadowRoot;
|
|
11
|
+
/**
|
|
12
|
+
* Observed attributes for the component.
|
|
13
|
+
*/
|
|
9
14
|
static get observedAttributes(): string[];
|
|
15
|
+
private options;
|
|
16
|
+
private flags;
|
|
17
|
+
/**
|
|
18
|
+
* Single source of truth for which language is currently selected.
|
|
19
|
+
* Everything else (rotation, BarMenu) is derived from this.
|
|
20
|
+
*/
|
|
21
|
+
private selected;
|
|
22
|
+
private selectedTmp;
|
|
10
23
|
private _renderer;
|
|
11
24
|
private _scene;
|
|
12
25
|
private _camera;
|
|
13
26
|
private _root;
|
|
14
27
|
private _canvas;
|
|
15
|
-
private _controls;
|
|
16
28
|
private _resizeObserver;
|
|
17
29
|
private _clock;
|
|
18
30
|
private _lastTime;
|
|
19
|
-
private _lights;
|
|
20
31
|
private _spotlight;
|
|
21
32
|
private _flagsGroup;
|
|
22
33
|
private _wind;
|
|
@@ -33,40 +44,53 @@ export declare class LanguagePickerComponent extends HTMLElement {
|
|
|
33
44
|
private _introCameraHoldDuration;
|
|
34
45
|
private _isIntroCameraAnimating;
|
|
35
46
|
private _isIntroCameraHolding;
|
|
36
|
-
private options;
|
|
37
|
-
private flags;
|
|
38
|
-
/**
|
|
39
|
-
* Single source of truth for which language is currently selected.
|
|
40
|
-
* Everything else (rotation, BarMenu) is derived from this.
|
|
41
|
-
*/
|
|
42
|
-
private selected;
|
|
43
|
-
private selectedTmp;
|
|
44
47
|
private _menuContainer;
|
|
45
48
|
private _menuIntroStartScale;
|
|
46
49
|
private _barMenu;
|
|
47
|
-
private _languageButtons;
|
|
48
50
|
private _confirmationDialog;
|
|
49
51
|
private _isInitialized;
|
|
50
52
|
private _isInitializing;
|
|
51
53
|
private _barMenuVisibleIndex;
|
|
54
|
+
private _floorGeometry;
|
|
55
|
+
private _floorMaterial;
|
|
52
56
|
private _programmaticScrollTimer;
|
|
57
|
+
/**
|
|
58
|
+
* @constructor
|
|
59
|
+
*/
|
|
53
60
|
constructor();
|
|
61
|
+
/**
|
|
62
|
+
* Called when observed attributes change.
|
|
63
|
+
* @param name Name of the changed attribute.
|
|
64
|
+
* @param oldValue Previous value of the attribute, or null if it was not set.
|
|
65
|
+
* @param newValue New value of the attribute, or null if it was removed.
|
|
66
|
+
* @returns {void}
|
|
67
|
+
*/
|
|
54
68
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
69
|
+
/**
|
|
70
|
+
* Called when the component is added to the DOM.
|
|
71
|
+
*/
|
|
55
72
|
connectedCallback(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Called when the component is removed from the DOM.
|
|
75
|
+
*/
|
|
56
76
|
disconnectedCallback(): void;
|
|
57
77
|
/**
|
|
58
|
-
* Initialize the component with a set of
|
|
59
|
-
* @param
|
|
78
|
+
* Initialize the component with a set of options.
|
|
79
|
+
* @param options Set of keys representing the options to display.
|
|
60
80
|
*/
|
|
61
|
-
private
|
|
81
|
+
private init;
|
|
62
82
|
/**
|
|
63
83
|
* Cache references to important HTML elements.
|
|
64
84
|
*/
|
|
65
85
|
private setupHtmlElements;
|
|
66
86
|
/**
|
|
67
|
-
* Set up Three.js
|
|
87
|
+
* Set up Three.js elements.
|
|
68
88
|
*/
|
|
69
89
|
private setupScene;
|
|
90
|
+
/**
|
|
91
|
+
* Cache references to UI elements like the BarMenu and menu container, and set initial styles.
|
|
92
|
+
*/
|
|
93
|
+
private setupUI;
|
|
70
94
|
/**
|
|
71
95
|
* Create flag meshes, position them in a circle, and set up their wind parameters.
|
|
72
96
|
*/
|
|
@@ -76,21 +100,13 @@ export declare class LanguagePickerComponent extends HTMLElement {
|
|
|
76
100
|
*/
|
|
77
101
|
private resizeHandler;
|
|
78
102
|
private listenToBarMenuNavigation;
|
|
79
|
-
/**
|
|
80
|
-
* Cache references to UI elements like the BarMenu and menu container, and set initial styles.
|
|
81
|
-
*/
|
|
82
|
-
private setupUI;
|
|
83
103
|
private _computeIntroCameraEndPosition;
|
|
84
104
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
105
|
+
* Public method to select a language. Updates the selected language and rotates the flags and BarMenu accordingly.
|
|
106
|
+
* @param language Locale key of the language to select.
|
|
107
|
+
* @returns {void}
|
|
88
108
|
*/
|
|
89
|
-
|
|
90
|
-
addLanguage(_language: string): void;
|
|
91
|
-
addLocales(_languages: string[]): void;
|
|
92
|
-
removeLanguage(_language: string): void;
|
|
93
|
-
removeLocales(_languages: string[]): void;
|
|
109
|
+
select(language: Locales): void;
|
|
94
110
|
/**
|
|
95
111
|
* Rotate the flags group so that the flag at `index` faces the camera.
|
|
96
112
|
* @param id Locale key of the language to rotate to.
|
|
@@ -104,9 +120,18 @@ export declare class LanguagePickerComponent extends HTMLElement {
|
|
|
104
120
|
private _syncBarMenuToId;
|
|
105
121
|
private setupConfirmationDialog;
|
|
106
122
|
private barMenuButtonClickHandler;
|
|
123
|
+
/**
|
|
124
|
+
* Handler for when the user confirms their language selection in the confirmation dialog.
|
|
125
|
+
* Dispatches a custom event with the new selected language.
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
107
128
|
private _handleConfirmation;
|
|
108
129
|
private _animate;
|
|
109
130
|
private _updateGroupRotation;
|
|
110
131
|
private _updateIntroCamera;
|
|
111
132
|
private _setMenuIntroScale;
|
|
133
|
+
addLanguage(_language: string): void;
|
|
134
|
+
addLocales(_languages: string[]): void;
|
|
135
|
+
removeLanguage(_language: string): void;
|
|
136
|
+
removeLocales(_languages: string[]): void;
|
|
112
137
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { LanguagePickerComponent } from './component';
|
|
2
|
-
export { OBSERVED_ATTRIBUTES } from './component';
|
|
3
2
|
export { selector } from './selector';
|
|
4
3
|
export { COMPONENT_CUSTOM_MESSAGES } from './custom-messages.const';
|
|
4
|
+
export { OBSERVED_ATTRIBUTES } from './observed-attributes.const';
|
|
@@ -1,34 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
selected?: string | undefined;
|
|
4
|
-
}
|
|
5
|
-
export declare class ThemeCubeComponent extends HTMLElement {
|
|
6
|
-
private static readonly FACE_VISUALS;
|
|
7
|
-
private static readonly CUBE_SIDE_LENGTH;
|
|
1
|
+
import { Themes } from '@albi_scando/as-const-themes-lib';
|
|
2
|
+
export declare class ThemePickerComponent extends HTMLElement {
|
|
8
3
|
private static readonly textureLoader;
|
|
9
4
|
readonly shadowRoot: ShadowRoot;
|
|
10
|
-
|
|
11
|
-
private static readonly
|
|
5
|
+
static get observedAttributes(): string[];
|
|
6
|
+
private static readonly CUBE_SIDE_LENGTH;
|
|
7
|
+
private options;
|
|
8
|
+
/**
|
|
9
|
+
* Single source of truth for the selected theme.
|
|
10
|
+
* UI preview and confirmation derive from this value.
|
|
11
|
+
*/
|
|
12
|
+
private selected;
|
|
13
|
+
private selectedTmp;
|
|
14
|
+
private _renderer;
|
|
15
|
+
private _scene;
|
|
16
|
+
private _camera;
|
|
12
17
|
private _root;
|
|
13
18
|
private _canvas;
|
|
14
|
-
private
|
|
19
|
+
private _resizeObserver;
|
|
20
|
+
private _clock;
|
|
21
|
+
private _lastTime;
|
|
22
|
+
private _cube;
|
|
23
|
+
private _cubeGeometry;
|
|
24
|
+
private _cubeMaterials;
|
|
25
|
+
private _animationFrameId;
|
|
26
|
+
private previewDialog;
|
|
15
27
|
private _previewTitle;
|
|
16
28
|
private _previewSub;
|
|
17
29
|
private _applyBtn;
|
|
18
30
|
private _confirmationDialog;
|
|
19
31
|
private _isConfirmationDialogOpen;
|
|
20
|
-
private _renderer;
|
|
21
|
-
private _scene;
|
|
22
|
-
private _camera;
|
|
23
|
-
private _cube;
|
|
24
|
-
private _cubeGeometry;
|
|
25
|
-
private _cubeMaterials;
|
|
26
|
-
private readonly _clock;
|
|
27
|
-
private _animFrameId;
|
|
28
|
-
private _resizeObserver;
|
|
29
|
-
private _themes;
|
|
30
32
|
private _themeTextures;
|
|
31
|
-
private _selected;
|
|
32
33
|
private _currentFaceThemeId;
|
|
33
34
|
private _isDragging;
|
|
34
35
|
private _lastPointerX;
|
|
@@ -36,6 +37,7 @@ export declare class ThemeCubeComponent extends HTMLElement {
|
|
|
36
37
|
private _dragPointerId;
|
|
37
38
|
private _rotX;
|
|
38
39
|
private _rotY;
|
|
40
|
+
private _rotZ;
|
|
39
41
|
private _idleSeconds;
|
|
40
42
|
private _autoSpinEnabled;
|
|
41
43
|
private _autoVelX;
|
|
@@ -44,18 +46,50 @@ export declare class ThemeCubeComponent extends HTMLElement {
|
|
|
44
46
|
private _isInitializing;
|
|
45
47
|
private readonly _tmpCamDir;
|
|
46
48
|
private readonly _tmpWorldNormal;
|
|
47
|
-
|
|
48
|
-
constructor(input?: ThemeCubeComponentOptions);
|
|
49
|
+
constructor();
|
|
49
50
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
51
|
+
/**
|
|
52
|
+
* Called when the component is added to the DOM.
|
|
53
|
+
*/
|
|
50
54
|
connectedCallback(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Called when the component is removed from the DOM.
|
|
57
|
+
*/
|
|
51
58
|
disconnectedCallback(): void;
|
|
52
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Initialize the component with a set of options.
|
|
61
|
+
* @param options Set of keys representing the options to display.
|
|
62
|
+
*/
|
|
63
|
+
private init;
|
|
64
|
+
/**
|
|
65
|
+
* Cache references to important HTML elements.
|
|
66
|
+
*/
|
|
53
67
|
private setupHtmlElements;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
private
|
|
58
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Set up Three.js elements.
|
|
70
|
+
*/
|
|
71
|
+
private setupScene;
|
|
72
|
+
/**
|
|
73
|
+
* Cache references to important UI elements and set up initial states.
|
|
74
|
+
*/
|
|
75
|
+
private setupUI;
|
|
76
|
+
/**
|
|
77
|
+
* Set up the cube mesh with one face per theme option, applying textures or fallback visuals as needed.
|
|
78
|
+
*/
|
|
79
|
+
private setupCube;
|
|
80
|
+
/**
|
|
81
|
+
* Set up a ResizeObserver to handle canvas resizing and update the camera aspect ratio.
|
|
82
|
+
*/
|
|
83
|
+
private resizeHandler;
|
|
84
|
+
private setupApplyButton;
|
|
85
|
+
private setupConfirmationDialog;
|
|
86
|
+
/**
|
|
87
|
+
* Public method to select a theme. Updates the selected theme and rotates the cube accordingly.
|
|
88
|
+
* @param theme Theme key of the theme to select.
|
|
89
|
+
* @returns {void}
|
|
90
|
+
*/
|
|
91
|
+
select(theme: Themes): void;
|
|
92
|
+
private _syncRotationToSelected;
|
|
59
93
|
private _handleApplyClick;
|
|
60
94
|
private _applyTheme;
|
|
61
95
|
private _updatePreviewDialog;
|
|
@@ -67,16 +101,25 @@ export declare class ThemeCubeComponent extends HTMLElement {
|
|
|
67
101
|
private _setMaterialTexture;
|
|
68
102
|
private _createFallbackFaceTexture;
|
|
69
103
|
private _getThemeIdForFace;
|
|
70
|
-
private _formatThemeName;
|
|
71
|
-
private _restoreThemePreview;
|
|
72
104
|
private _stopAutoSpinFromInteraction;
|
|
73
105
|
private _onPointerDown;
|
|
74
106
|
private _onPointerMove;
|
|
75
107
|
private _onPointerUp;
|
|
108
|
+
/**
|
|
109
|
+
* Bind event listeners. Separated from setupUI for clarity and
|
|
110
|
+
* to ensure all HTML elements are available before binding.
|
|
111
|
+
*/
|
|
76
112
|
private _bindEvents;
|
|
113
|
+
/**
|
|
114
|
+
* Unbind all event listeners to prevent memory leaks and
|
|
115
|
+
* unintended behavior when the component is removed from the DOM.
|
|
116
|
+
*/
|
|
77
117
|
private _unbindEvents;
|
|
78
|
-
|
|
79
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Handler for when the user confirms their theme selection in the confirmation dialog.
|
|
120
|
+
* Dispatches a custom event with the new selection.
|
|
121
|
+
* @returns {void}
|
|
122
|
+
*/
|
|
80
123
|
private _handleConfirmation;
|
|
81
124
|
private _handleConfirmationCancel;
|
|
82
125
|
private _resolveThemeFaceVisual;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { ThemeCubeComponentOptions } from './component';
|
|
1
|
+
export { ThemePickerComponent } from './component';
|
|
3
2
|
export { selector } from './selector';
|
|
4
3
|
export { COMPONENT_CUSTOM_MESSAGES } from './custom-messages.const';
|
|
4
|
+
export { OBSERVED_ATTRIBUTES } from './observed-attributes.const';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@albi_scando/as-design-system-threejs-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "A library of reusable, strongly typed threejs Web Components built with TypeScript, designed for creating consistent and maintainable user interfaces.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -46,10 +46,6 @@
|
|
|
46
46
|
"storybook-build": "storybook build"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@albi_scando/as-const-languages-lib": "^1.1.1",
|
|
50
|
-
"@albi_scando/as-const-lib": "^1.11.0",
|
|
51
|
-
"@albi_scando/as-design-system-lib": "^1.7.2",
|
|
52
|
-
"@albi_scando/as-threejs-flags-lib": "^2.3.2",
|
|
53
49
|
"@commitlint/cli": "^20.4.1",
|
|
54
50
|
"@commitlint/config-conventional": "^20.4.1",
|
|
55
51
|
"@eslint/js": "^9.39.2",
|
|
@@ -93,7 +89,8 @@
|
|
|
93
89
|
"peerDependencies": {
|
|
94
90
|
"@albi_scando/as-const-languages-lib": "^1.1.0",
|
|
95
91
|
"@albi_scando/as-const-lib": "^1.9.0",
|
|
96
|
-
"@albi_scando/as-
|
|
92
|
+
"@albi_scando/as-const-themes-lib": "^1.0.0",
|
|
93
|
+
"@albi_scando/as-design-system-lib": "^1.7.2",
|
|
97
94
|
"@albi_scando/as-threejs-flags-lib": "^2.3.2",
|
|
98
95
|
"@fontsource/material-symbols-outlined": "^5.0.0",
|
|
99
96
|
"@types/three": "^0.179.0",
|