codexly-ui 0.1.11 → 0.1.13

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.
@@ -281,6 +281,46 @@ const CLX_FONT_CATALOG = [
281
281
  value: 'Dancing Script',
282
282
  googleUrl: 'https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;500;600;700&display=swap',
283
283
  },
284
+ {
285
+ label: 'Cinzel',
286
+ value: 'Cinzel',
287
+ googleUrl: 'https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700;800;900&display=swap',
288
+ },
289
+ {
290
+ label: 'Berkshire Swash',
291
+ value: 'Berkshire Swash',
292
+ googleUrl: 'https://fonts.googleapis.com/css2?family=Berkshire+Swash&display=swap',
293
+ },
294
+ {
295
+ label: 'JetBrains Mono',
296
+ value: 'JetBrains Mono',
297
+ googleUrl: 'https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap',
298
+ },
299
+ {
300
+ label: 'Orbitron',
301
+ value: 'Orbitron',
302
+ googleUrl: 'https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&display=swap',
303
+ },
304
+ {
305
+ label: 'UnifrakturMaguntia',
306
+ value: 'UnifrakturMaguntia',
307
+ googleUrl: 'https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&display=swap',
308
+ },
309
+ {
310
+ label: 'Pirata One',
311
+ value: 'Pirata One',
312
+ googleUrl: 'https://fonts.googleapis.com/css2?family=Pirata+One&display=swap',
313
+ },
314
+ {
315
+ label: 'Press Start 2P',
316
+ value: 'Press Start 2P',
317
+ googleUrl: 'https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap',
318
+ },
319
+ {
320
+ label: 'Bungee',
321
+ value: 'Bungee',
322
+ googleUrl: 'https://fonts.googleapis.com/css2?family=Bungee&display=swap',
323
+ },
284
324
  ];
285
325
  // ── Tailwind rounded classes per borderRadius token ───────────────────────────
286
326
  const CLX_RADIUS_MAP = {
@@ -4517,11 +4557,18 @@ class ClxSelectComponent {
4517
4557
  _activeColor = computed(() => this.activeColor() ?? this._themeSvc.config().primaryColor, ...(ngDevMode ? [{ debugName: "_activeColor" }] : /* istanbul ignore next */ []));
4518
4558
  _el = inject((ElementRef));
4519
4559
  _sso = inject(ScrollStrategyOptions);
4560
+ _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
4561
+ _loadedFonts = new Set();
4520
4562
  _scrollStrategy = this._sso.reposition();
4521
4563
  constructor() {
4522
4564
  this._searchQuery = toSignal(this._searchControl.valueChanges.pipe(startWith(''), map(v => v ?? '')), { initialValue: '' });
4523
4565
  if (this._ngControl)
4524
4566
  this._ngControl.valueAccessor = this;
4567
+ effect(() => {
4568
+ const family = this._displayFontFamily();
4569
+ if (family)
4570
+ this._loadPreviewFont(family);
4571
+ });
4525
4572
  // Async autocomplete: debounce + switchMap sobre el search control
4526
4573
  this._searchControl.valueChanges.pipe(debounceTime(this.debounceMs()), distinctUntilChanged(), switchMap(query => {
4527
4574
  const q = query ?? '';
@@ -4569,6 +4616,10 @@ class ClxSelectComponent {
4569
4616
  const sel = this._selectedOptions();
4570
4617
  return sel.length ? sel[0].label : this.placeholder();
4571
4618
  }, ...(ngDevMode ? [{ debugName: "_displayValue" }] : /* istanbul ignore next */ []));
4619
+ _displayFontFamily = computed(() => {
4620
+ const sel = this._selectedOptions();
4621
+ return sel.length ? sel[0].previewFontFamily ?? null : null;
4622
+ }, ...(ngDevMode ? [{ debugName: "_displayFontFamily" }] : /* istanbul ignore next */ []));
4572
4623
  _overlayWidth = computed(() => this._overlayWidthPx(), ...(ngDevMode ? [{ debugName: "_overlayWidth" }] : /* istanbul ignore next */ []));
4573
4624
  _labelClass = computed(() => `${this._sizeConfig().label} ${CLX_TEXT_LABEL} leading-none`, ...(ngDevMode ? [{ debugName: "_labelClass" }] : /* istanbul ignore next */ []));
4574
4625
  _hintClass = computed(() => `${this._sizeConfig().hint} ${CLX_TEXT_HINT}`, ...(ngDevMode ? [{ debugName: "_hintClass" }] : /* istanbul ignore next */ []));
@@ -4619,6 +4670,26 @@ class ClxSelectComponent {
4619
4670
  if (!this.async())
4620
4671
  this._searchControl.setValue('', { emitEvent: false });
4621
4672
  this._isOpen.set(true);
4673
+ for (const opt of this.options()) {
4674
+ if (opt.previewFontFamily)
4675
+ this._loadPreviewFont(opt.previewFontFamily);
4676
+ }
4677
+ }
4678
+ _loadPreviewFont(family) {
4679
+ if (!this._isBrowser || this._loadedFonts.has(family))
4680
+ return;
4681
+ const option = CLX_FONT_CATALOG.find(f => f.value === family);
4682
+ if (!option)
4683
+ return;
4684
+ this._loadedFonts.add(family);
4685
+ const id = `clx-preview-font-${family.replace(/\s+/g, '-').toLowerCase()}`;
4686
+ if (document.getElementById(id))
4687
+ return;
4688
+ const link = document.createElement('link');
4689
+ link.id = id;
4690
+ link.rel = 'stylesheet';
4691
+ link.href = option.googleUrl;
4692
+ document.head.appendChild(link);
4622
4693
  }
4623
4694
  _closePanel() {
4624
4695
  this._isOpen.set(false);
@@ -4728,7 +4799,7 @@ class ClxSelectComponent {
4728
4799
 
4729
4800
  <!-- Single mode: display value -->
4730
4801
  } @else {
4731
- <span [class]="_singleDisplayClass()">{{ _displayValue() }}</span>
4802
+ <span [class]="_singleDisplayClass()" [style.font-family]="_displayFontFamily()">{{ _displayValue() }}</span>
4732
4803
  }
4733
4804
 
4734
4805
  <!-- Right controls: clear + chevron -->
@@ -4808,7 +4879,7 @@ class ClxSelectComponent {
4808
4879
  [disabled]="opt.disabled ?? false"
4809
4880
  (mousedown)="$event.preventDefault()"
4810
4881
  (click)="_selectOption(opt)">
4811
- <span class="flex-1 text-left truncate">{{ opt.label }}</span>
4882
+ <span class="flex-1 text-left truncate" [style.font-family]="opt.previewFontFamily ?? null">{{ opt.label }}</span>
4812
4883
  @if (_isSelected(opt.value)) {
4813
4884
  <span clx-icon name="check" size="xs" class="shrink-0"></span>
4814
4885
  }
@@ -4875,7 +4946,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
4875
4946
 
4876
4947
  <!-- Single mode: display value -->
4877
4948
  } @else {
4878
- <span [class]="_singleDisplayClass()">{{ _displayValue() }}</span>
4949
+ <span [class]="_singleDisplayClass()" [style.font-family]="_displayFontFamily()">{{ _displayValue() }}</span>
4879
4950
  }
4880
4951
 
4881
4952
  <!-- Right controls: clear + chevron -->
@@ -4955,7 +5026,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
4955
5026
  [disabled]="opt.disabled ?? false"
4956
5027
  (mousedown)="$event.preventDefault()"
4957
5028
  (click)="_selectOption(opt)">
4958
- <span class="flex-1 text-left truncate">{{ opt.label }}</span>
5029
+ <span class="flex-1 text-left truncate" [style.font-family]="opt.previewFontFamily ?? null">{{ opt.label }}</span>
4959
5030
  @if (_isSelected(opt.value)) {
4960
5031
  <span clx-icon name="check" size="xs" class="shrink-0"></span>
4961
5032
  }