@albi_scando/as-design-system-threejs-lib 1.1.6 → 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.
@@ -84,9 +84,13 @@ export declare class LanguagePickerComponent extends HTMLElement {
84
84
  */
85
85
  private setupHtmlElements;
86
86
  /**
87
- * Set up Three.js elemnents.
87
+ * Set up Three.js elements.
88
88
  */
89
89
  private setupScene;
90
+ /**
91
+ * Cache references to UI elements like the BarMenu and menu container, and set initial styles.
92
+ */
93
+ private setupUI;
90
94
  /**
91
95
  * Create flag meshes, position them in a circle, and set up their wind parameters.
92
96
  */
@@ -96,15 +100,11 @@ export declare class LanguagePickerComponent extends HTMLElement {
96
100
  */
97
101
  private resizeHandler;
98
102
  private listenToBarMenuNavigation;
99
- /**
100
- * Cache references to UI elements like the BarMenu and menu container, and set initial styles.
101
- */
102
- private setupUI;
103
103
  private _computeIntroCameraEndPosition;
104
104
  /**
105
- * Programmatically select a language by its locale key.
106
- * Rotates the flags ring and syncs the BarMenu to show the correct autonym.
107
- * Safe to call before init — queued and applied once the component is ready.
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}
108
108
  */
109
109
  select(language: Locales): void;
110
110
  /**
@@ -120,6 +120,11 @@ export declare class LanguagePickerComponent extends HTMLElement {
120
120
  private _syncBarMenuToId;
121
121
  private setupConfirmationDialog;
122
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
+ */
123
128
  private _handleConfirmation;
124
129
  private _animate;
125
130
  private _updateGroupRotation;
@@ -1,9 +1,8 @@
1
- import { Themes } from '@albi_scando/as-const-lib';
2
- export declare class ThemeCubeComponent extends HTMLElement {
1
+ import { Themes } from '@albi_scando/as-const-themes-lib';
2
+ export declare class ThemePickerComponent extends HTMLElement {
3
3
  private static readonly textureLoader;
4
4
  readonly shadowRoot: ShadowRoot;
5
5
  static get observedAttributes(): string[];
6
- private static readonly FACE_VISUALS;
7
6
  private static readonly CUBE_SIDE_LENGTH;
8
7
  private options;
9
8
  /**
@@ -11,19 +10,20 @@ export declare class ThemeCubeComponent extends HTMLElement {
11
10
  * UI preview and confirmation derive from this value.
12
11
  */
13
12
  private selected;
13
+ private selectedTmp;
14
14
  private _renderer;
15
15
  private _scene;
16
16
  private _camera;
17
17
  private _root;
18
18
  private _canvas;
19
- private _cube;
20
- private _cubeGeometry;
21
- private _cubeMaterials;
22
19
  private _resizeObserver;
23
20
  private _clock;
24
21
  private _lastTime;
22
+ private _cube;
23
+ private _cubeGeometry;
24
+ private _cubeMaterials;
25
25
  private _animationFrameId;
26
- private _hintTop;
26
+ private previewDialog;
27
27
  private _previewTitle;
28
28
  private _previewSub;
29
29
  private _applyBtn;
@@ -37,6 +37,7 @@ export declare class ThemeCubeComponent extends HTMLElement {
37
37
  private _dragPointerId;
38
38
  private _rotX;
39
39
  private _rotY;
40
+ private _rotZ;
40
41
  private _idleSeconds;
41
42
  private _autoSpinEnabled;
42
43
  private _autoVelX;
@@ -47,16 +48,46 @@ export declare class ThemeCubeComponent extends HTMLElement {
47
48
  private readonly _tmpWorldNormal;
48
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;
59
+ /**
60
+ * Initialize the component with a set of options.
61
+ * @param options Set of keys representing the options to display.
62
+ */
52
63
  private init;
64
+ /**
65
+ * Cache references to important HTML elements.
66
+ */
53
67
  private setupHtmlElements;
68
+ /**
69
+ * Set up Three.js elements.
70
+ */
54
71
  private setupScene;
72
+ /**
73
+ * Cache references to important UI elements and set up initial states.
74
+ */
55
75
  private setupUI;
76
+ /**
77
+ * Set up the cube mesh with one face per theme option, applying textures or fallback visuals as needed.
78
+ */
56
79
  private setupCube;
80
+ /**
81
+ * Set up a ResizeObserver to handle canvas resizing and update the camera aspect ratio.
82
+ */
57
83
  private resizeHandler;
58
84
  private setupApplyButton;
59
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
+ */
60
91
  select(theme: Themes): void;
61
92
  private _syncRotationToSelected;
62
93
  private _handleApplyClick;
@@ -70,17 +101,25 @@ export declare class ThemeCubeComponent extends HTMLElement {
70
101
  private _setMaterialTexture;
71
102
  private _createFallbackFaceTexture;
72
103
  private _getThemeIdForFace;
73
- private _formatThemeName;
74
- private _restoreThemePreview;
75
104
  private _stopAutoSpinFromInteraction;
76
105
  private _onPointerDown;
77
106
  private _onPointerMove;
78
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
+ */
79
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
+ */
80
117
  private _unbindEvents;
81
- private _parseThemesAttribute;
82
- private _sanitizeThemes;
83
- private _normalizeOptions;
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
+ */
84
123
  private _handleConfirmation;
85
124
  private _handleConfirmationCancel;
86
125
  private _resolveThemeFaceVisual;
@@ -1,4 +1,4 @@
1
- import { Themes } from '@albi_scando/as-const-lib';
1
+ import { Themes } from '@albi_scando/as-const-themes-lib';
2
2
  export declare const DEFAULT_VALUES: {
3
3
  readonly selected: "dark-purple";
4
4
  readonly options: Set<Themes>;
@@ -1,4 +1,4 @@
1
- export { ThemeCubeComponent } from './component';
1
+ export { ThemePickerComponent } from './component';
2
2
  export { selector } from './selector';
3
3
  export { COMPONENT_CUSTOM_MESSAGES } from './custom-messages.const';
4
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.6",
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-design-system-lib": "^1.6.0",
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",