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