@smilodon/core 1.1.0 → 1.1.1

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/index.cjs CHANGED
@@ -2574,10 +2574,15 @@ class AngularEnhancedSelect extends HTMLElement {
2574
2574
  }
2575
2575
  }
2576
2576
  _initializeStyles() {
2577
- // Create scoped styles for this component instance
2577
+ // Check if styles already exist for this component type
2578
+ const existingStyle = document.head.querySelector('style[data-component="angular-enhanced-select-shared"]');
2579
+ if (existingStyle) {
2580
+ // Styles already injected, skip
2581
+ return;
2582
+ }
2583
+ // Create scoped styles for this component type (shared across all instances)
2578
2584
  this._styleElement = document.createElement('style');
2579
- this._styleElement.setAttribute('data-component', 'angular-enhanced-select');
2580
- this._styleElement.setAttribute('data-id', this._uniqueId);
2585
+ this._styleElement.setAttribute('data-component', 'angular-enhanced-select-shared');
2581
2586
  const p = this.PREFIX; // shorthand
2582
2587
  this._styleElement.textContent = `
2583
2588
  /* Host styles - applied to <angular-enhanced-select> */
@@ -2893,8 +2898,26 @@ class AngularEnhancedSelect extends HTMLElement {
2893
2898
  min-height: 44px;
2894
2899
  }
2895
2900
  `;
2896
- // Append to document head
2897
- document.head.appendChild(this._styleElement);
2901
+ // Safely append to document head (check if document is ready)
2902
+ if (document.head) {
2903
+ try {
2904
+ document.head.appendChild(this._styleElement);
2905
+ }
2906
+ catch (e) {
2907
+ console.warn('[AngularEnhancedSelect] Could not inject styles:', e);
2908
+ // Fallback: inject after a delay
2909
+ setTimeout(() => {
2910
+ try {
2911
+ if (this._styleElement && !this._styleElement.parentNode) {
2912
+ document.head.appendChild(this._styleElement);
2913
+ }
2914
+ }
2915
+ catch (err) {
2916
+ console.error('[AngularEnhancedSelect] Style injection failed:', err);
2917
+ }
2918
+ }, 0);
2919
+ }
2920
+ }
2898
2921
  }
2899
2922
  _createContainer() {
2900
2923
  const container = document.createElement('div');