@ctrliq/quantic-components 1.62.0 → 1.62.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.
@@ -5,13 +5,6 @@ export declare function clamp(value: number, min: number, max: number): number;
5
5
  * Pass a function that returns the CSS declarations for each color token.
6
6
  */
7
7
  export declare function generateColorStyles(declarations: (color: ComponentColor) => string): string;
8
- /**
9
- * Generates a unique ID with an optional prefix.
10
- * Uses crypto.randomUUID() when available, falls back to Math.random().
11
- *
12
- * @param prefix Optional prefix for the generated ID
13
- * @returns A unique ID string
14
- */
15
8
  export declare function generateId(prefix?: string): string;
16
9
  /**
17
10
  * Removes null, undefined and empty string values from an array.
@@ -13,15 +13,18 @@ export function generateColorStyles(declarations) {
13
13
  }
14
14
  /**
15
15
  * Generates a unique ID with an optional prefix.
16
- * Uses crypto.randomUUID() when available, falls back to Math.random().
17
16
  *
18
17
  * @param prefix Optional prefix for the generated ID
19
18
  * @returns A unique ID string
20
19
  */
20
+ function randomUUID() {
21
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
22
+ const r = (Math.random() * 16) | 0;
23
+ return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
24
+ });
25
+ }
21
26
  export function generateId(prefix) {
22
- const id = typeof crypto !== 'undefined'
23
- ? crypto.randomUUID()
24
- : Math.random().toString(36).substring(2);
27
+ const id = randomUUID();
25
28
  return prefix ? `${prefix}-${id}` : id;
26
29
  }
27
30
  /**
@@ -89,7 +89,7 @@ let SplitterGroup = class SplitterGroup extends QuanticElement {
89
89
  }
90
90
  updated(changed) {
91
91
  super.updated(changed);
92
- if (changed.has('split') && !changed.has('panes')) {
92
+ if (changed.has('split')) {
93
93
  this.sizes = parseSplit(this.split, this.panes.length);
94
94
  this.applySizes();
95
95
  }
@@ -11,6 +11,7 @@ import { computePosition, flip, shift, offset, arrow, autoUpdate, } from '@float
11
11
  import { TooltipPlacement, TooltipSize } from './index.constants';
12
12
  import { TooltipPopup } from './tooltip-popup';
13
13
  import { prop } from '../shared/component-meta.decorators';
14
+ import { generateId } from '../shared/shared.utils';
14
15
  TooltipPopup.ensureDefined();
15
16
  export { TooltipPlacement, TooltipSize } from './index.constants';
16
17
  let Tooltip = class Tooltip extends QuanticElement {
@@ -23,9 +24,7 @@ let Tooltip = class Tooltip extends QuanticElement {
23
24
  this.disabled = false;
24
25
  this.offset = 8;
25
26
  this.open = false;
26
- this.tooltipId = `tooltip-${typeof crypto !== 'undefined'
27
- ? crypto.randomUUID()
28
- : Math.random().toString(36)}`;
27
+ this.tooltipId = generateId('tooltip');
29
28
  this.contentElements = [];
30
29
  this.handleMouseEnter = () => {
31
30
  if (this.disabled || this.open)
@@ -5,13 +5,6 @@ export declare function clamp(value: number, min: number, max: number): number;
5
5
  * Pass a function that returns the CSS declarations for each color token.
6
6
  */
7
7
  export declare function generateColorStyles(declarations: (color: ComponentColor) => string): string;
8
- /**
9
- * Generates a unique ID with an optional prefix.
10
- * Uses crypto.randomUUID() when available, falls back to Math.random().
11
- *
12
- * @param prefix Optional prefix for the generated ID
13
- * @returns A unique ID string
14
- */
15
8
  export declare function generateId(prefix?: string): string;
16
9
  /**
17
10
  * Removes null, undefined and empty string values from an array.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrliq/quantic-components",
3
- "version": "1.62.0",
3
+ "version": "1.62.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
6
  "exports": {