@albi_scando/as-design-system-threejs-lib 1.1.3 → 1.1.4

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.
@@ -1,18 +1,16 @@
1
1
  import { Locales } from '@albi_scando/as-const-languages-lib';
2
- export interface LanguagePickerComponentOptions {
3
- languages: Locales[];
4
- selected?: Locales;
5
- }
2
+ export declare const OBSERVED_ATTRIBUTES: {
3
+ LANGUAGES: string;
4
+ SELECTED: string;
5
+ };
6
6
  export declare class LanguagePickerComponent extends HTMLElement {
7
7
  private static readonly textureLoader;
8
- private static readonly languagesAttribute;
9
- private static readonly selectedAttribute;
8
+ readonly shadowRoot: ShadowRoot;
10
9
  static get observedAttributes(): string[];
11
- private readonly _shadowRoot;
12
10
  private _renderer;
13
11
  private _scene;
14
12
  private _camera;
15
- private _container;
13
+ private _root;
16
14
  private _canvas;
17
15
  private _controls;
18
16
  private _resizeObserver;
@@ -35,13 +33,14 @@ export declare class LanguagePickerComponent extends HTMLElement {
35
33
  private _introCameraHoldDuration;
36
34
  private _isIntroCameraAnimating;
37
35
  private _isIntroCameraHolding;
38
- private _languages;
36
+ private options;
37
+ private flags;
39
38
  /**
40
39
  * Single source of truth for which language is currently selected.
41
40
  * Everything else (rotation, BarMenu) is derived from this.
42
41
  */
43
- private _selectedId;
44
- private _previewId;
42
+ private selected;
43
+ private selectedTmp;
45
44
  private _menuContainer;
46
45
  private _menuIntroStartScale;
47
46
  private _barMenu;
@@ -49,29 +48,52 @@ export declare class LanguagePickerComponent extends HTMLElement {
49
48
  private _confirmationDialog;
50
49
  private _isInitialized;
51
50
  private _isInitializing;
52
- constructor(options?: LanguagePickerComponentOptions);
53
- private _indexOfId;
54
- private _idOfIndex;
51
+ private _barMenuVisibleIndex;
52
+ private _programmaticScrollTimer;
53
+ constructor();
55
54
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
56
55
  connectedCallback(): void;
57
56
  disconnectedCallback(): void;
57
+ /**
58
+ * Initialize the component with a set of languages.
59
+ * @param languages Set of locale keys representing the languages to display.
60
+ */
61
+ private _initializeComponent;
62
+ /**
63
+ * Cache references to important HTML elements.
64
+ */
65
+ private setupHtmlElements;
66
+ /**
67
+ * Set up Three.js elemnents.
68
+ */
69
+ private setupScene;
70
+ /**
71
+ * Create flag meshes, position them in a circle, and set up their wind parameters.
72
+ */
73
+ private setupFlags;
74
+ /**
75
+ * Set up a ResizeObserver to handle canvas resizing and update the camera aspect ratio.
76
+ */
77
+ private resizeHandler;
78
+ private listenToBarMenuNavigation;
79
+ /**
80
+ * Cache references to UI elements like the BarMenu and menu container, and set initial styles.
81
+ */
82
+ private setupUI;
83
+ private _computeIntroCameraEndPosition;
58
84
  /**
59
85
  * Programmatically select a language by its locale key.
60
86
  * Rotates the flags ring and syncs the BarMenu to show the correct autonym.
61
87
  * Safe to call before init — queued and applied once the component is ready.
62
88
  */
63
89
  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
90
  addLanguage(_language: string): void;
70
91
  addLocales(_languages: string[]): void;
71
92
  removeLanguage(_language: string): void;
72
93
  removeLocales(_languages: string[]): void;
73
94
  /**
74
95
  * Rotate the flags group so that the flag at `index` faces the camera.
96
+ * @param id Locale key of the language to rotate to.
75
97
  */
76
98
  private _rotateToId;
77
99
  /**
@@ -80,13 +102,8 @@ export declare class LanguagePickerComponent extends HTMLElement {
80
102
  * synthetic next/prev clicks — no more DOM polling.
81
103
  */
82
104
  private _syncBarMenuToId;
83
- private _initializeComponent;
84
- private _listenToBarMenuNavigation;
85
- private _setupScene;
86
- private _setupUI;
87
- private _setupFlags;
88
- private _computeIntroCameraEndPosition;
89
- private _setupConfirmationDialog;
105
+ private setupConfirmationDialog;
106
+ private barMenuButtonClickHandler;
90
107
  private _handleConfirmation;
91
108
  private _animate;
92
109
  private _updateGroupRotation;
@@ -0,0 +1,5 @@
1
+ import { Locales } from '@albi_scando/as-const-languages-lib';
2
+ export declare const DEFAULT_VALUES: {
3
+ readonly selected: "ENGLISH_UNITED_KINGDOM";
4
+ readonly options: Set<Locales>;
5
+ };
@@ -1,4 +1,4 @@
1
1
  export { LanguagePickerComponent } from './component';
2
- export type { LanguagePickerComponentOptions } from './component';
2
+ export { OBSERVED_ATTRIBUTES } from './component';
3
3
  export { selector } from './selector';
4
4
  export { COMPONENT_CUSTOM_MESSAGES } from './custom-messages.const';
@@ -6,9 +6,9 @@ export declare class ThemeCubeComponent extends HTMLElement {
6
6
  private static readonly FACE_VISUALS;
7
7
  private static readonly CUBE_SIDE_LENGTH;
8
8
  private static readonly textureLoader;
9
+ readonly shadowRoot: ShadowRoot;
9
10
  private static readonly themesAttribute;
10
11
  private static readonly selectedAttribute;
11
- readonly shadowRoot: ShadowRoot;
12
12
  private _root;
13
13
  private _canvas;
14
14
  private _hintTop;
@@ -50,6 +50,7 @@ export declare class ThemeCubeComponent extends HTMLElement {
50
50
  connectedCallback(): void;
51
51
  disconnectedCallback(): void;
52
52
  private initializeComponent;
53
+ private setupHtmlElements;
53
54
  private _sanitizeThemes;
54
55
  private _setupDOM;
55
56
  private _setupScene;
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",
3
+ "version": "1.1.4",
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": [