@albi_scando/as-design-system-threejs-lib 1.1.0 → 1.1.2

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.
@@ -2,7 +2,6 @@ import { APPLICATION_NAME } from './constants/application.constant.ts';
2
2
  export { APPLICATION_NAME };
3
3
  export { WebComponentsRegistry } from './web-components/registry.ts';
4
4
  export { CUSTOM_MESSAGES } from './constants/custom-messages.const.ts';
5
- export { switchTheme, clearThemes } from './utils/switch-theme.utils.ts';
6
5
  export { THEME_TEXTURES_MAPPER } from './mappers/themes.mapper.ts';
7
6
  export * as LanguagePicker from './web-components/language-picker/main.ts';
8
7
  export * as ThemePicker from './web-components/theme-picker/main.ts';
@@ -1,12 +1,13 @@
1
1
  import { Locales } from '@albi_scando/as-const-languages-lib';
2
2
  export interface LanguagePickerComponentOptions {
3
3
  languages: Locales[];
4
- selected?: Locales | undefined;
4
+ selected?: Locales;
5
5
  }
6
6
  export declare class LanguagePickerComponent extends HTMLElement {
7
7
  private static readonly textureLoader;
8
8
  private static readonly languagesAttribute;
9
9
  private static readonly selectedAttribute;
10
+ static get observedAttributes(): string[];
10
11
  private readonly _shadowRoot;
11
12
  private _renderer;
12
13
  private _scene;
@@ -20,12 +21,13 @@ export declare class LanguagePickerComponent extends HTMLElement {
20
21
  private _lights;
21
22
  private _spotlight;
22
23
  private _flagsGroup;
23
- private _languages;
24
- private _selectedLanguageIndex;
25
- private _animationFrameId;
24
+ private _wind;
25
+ private _circleRadius;
26
+ private _cameraLookAtY;
26
27
  private _targetGroupRotation;
27
28
  private _currentGroupRotation;
28
29
  private _unwrappedGroupRotation;
30
+ private _animationFrameId;
29
31
  private _introCameraStartPosition;
30
32
  private _introCameraEndPosition;
31
33
  private _introCameraElapsed;
@@ -33,44 +35,61 @@ export declare class LanguagePickerComponent extends HTMLElement {
33
35
  private _introCameraHoldDuration;
34
36
  private _isIntroCameraAnimating;
35
37
  private _isIntroCameraHolding;
36
- private _cameraLookAtY;
37
- private _circleRadius;
38
- private _wind;
38
+ private _languages;
39
+ /**
40
+ * Single source of truth for which language is currently selected.
41
+ * Everything else (rotation, BarMenu) is derived from this.
42
+ */
43
+ private _selectedId;
44
+ private _previewId;
39
45
  private _menuContainer;
40
46
  private _menuIntroStartScale;
41
47
  private _barMenu;
42
48
  private _languageButtons;
43
49
  private _confirmationDialog;
44
- private _currentVisibleButtonIndex;
45
50
  private _isInitialized;
46
51
  private _isInitializing;
47
- static get observedAttributes(): string[];
48
52
  constructor(options?: LanguagePickerComponentOptions);
49
- private _initializeComponent;
53
+ private _indexOfId;
54
+ private _idOfIndex;
50
55
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
56
+ connectedCallback(): void;
57
+ disconnectedCallback(): void;
58
+ /**
59
+ * Programmatically select a language by its locale key.
60
+ * Rotates the flags ring and syncs the BarMenu to show the correct autonym.
61
+ * Safe to call before init — queued and applied once the component is ready.
62
+ */
63
+ selectLanguage(language: Locales): void;
64
+ /**
65
+ * Rotate and sync BarMenu without touching _selectedId.
66
+ * Used by BarMenu arrows and button clicks (before confirmation).
67
+ */
68
+ private _applyPreview;
69
+ addLanguage(_language: string): void;
70
+ addLocales(_languages: string[]): void;
71
+ removeLanguage(_language: string): void;
72
+ removeLocales(_languages: string[]): void;
73
+ /**
74
+ * Rotate the flags group so that the flag at `index` faces the camera.
75
+ */
76
+ private _rotateToId;
77
+ /**
78
+ * Tell BarMenu to display the button at `index`.
79
+ * Uses navigateToIndex if available, otherwise falls back to firing
80
+ * synthetic next/prev clicks — no more DOM polling.
81
+ */
82
+ private _syncBarMenuToId;
83
+ private _initializeComponent;
84
+ private _listenToBarMenuNavigation;
51
85
  private _setupScene;
52
86
  private _setupUI;
53
87
  private _setupFlags;
54
88
  private _computeIntroCameraEndPosition;
55
89
  private _setupConfirmationDialog;
56
- /**
57
- * Handles the confirmation of a language change.
58
- *
59
- * @returns {void}
60
- */
61
90
  private _handleConfirmation;
62
- private _setupEventListeners;
63
- private _checkVisibleButtonChange;
64
- private _updateGroupRotationToLanguage;
91
+ private _animate;
65
92
  private _updateGroupRotation;
66
93
  private _updateIntroCamera;
67
94
  private _setMenuIntroScale;
68
- private _animate;
69
- connectedCallback(): void;
70
- disconnectedCallback(): void;
71
- addLanguage(_language: string): void;
72
- addLocales(_languages: string[]): void;
73
- removeLanguage(_language: string): void;
74
- removeLocales(_languages: string[]): void;
75
- selectLanguage(_language: string): void;
76
95
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albi_scando/as-design-system-threejs-lib",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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": [
@@ -48,7 +48,7 @@
48
48
  "devDependencies": {
49
49
  "@albi_scando/as-const-languages-lib": "^1.1.1",
50
50
  "@albi_scando/as-const-lib": "^1.11.0",
51
- "@albi_scando/as-design-system-lib": "^1.7.0",
51
+ "@albi_scando/as-design-system-lib": "^1.7.2",
52
52
  "@albi_scando/as-threejs-flags-lib": "^2.3.2",
53
53
  "@commitlint/cli": "^20.4.1",
54
54
  "@commitlint/config-conventional": "^20.4.1",
@@ -58,8 +58,8 @@
58
58
  "@semantic-release/git": "^10.0.1",
59
59
  "@semantic-release/github": "^12.0.3",
60
60
  "@semantic-release/npm": "^13.1.3",
61
- "@storybook/addon-docs": "10.3.0",
62
- "@storybook/html-vite": "10.3.0",
61
+ "@storybook/addon-docs": "10.3.1",
62
+ "@storybook/html-vite": "10.3.1",
63
63
  "@types/node": "^25.2.1",
64
64
  "@types/numeric": "^1.2.6",
65
65
  "@vitest/coverage-v8": "^4.0.18",
@@ -72,7 +72,7 @@
72
72
  "eslint-plugin-prettier": "^5.5.5",
73
73
  "eslint-plugin-regexp": "^3.0.0",
74
74
  "eslint-plugin-security": "^3.0.1",
75
- "eslint-plugin-storybook": "10.3.0",
75
+ "eslint-plugin-storybook": "10.3.1",
76
76
  "globals": "^17.3.0",
77
77
  "http-server": "^14.1.1",
78
78
  "husky": "^9.1.7",
@@ -80,7 +80,7 @@
80
80
  "prettier": "3.8.1",
81
81
  "sass": "^1.97.3",
82
82
  "semantic-release": "^25.0.3",
83
- "storybook": "10.3.0",
83
+ "storybook": "10.3.1",
84
84
  "typedoc": "^0.28.16",
85
85
  "typescript": "^5.9.3",
86
86
  "typescript-eslint": "^8.54.0",
@@ -1,4 +0,0 @@
1
- import { THEMES } from '@albi_scando/as-const-lib';
2
- export type ThemeValue = (typeof THEMES)[keyof typeof THEMES];
3
- export declare const clearThemes: () => void;
4
- export declare const switchTheme: (theme: ThemeValue) => void;