codexly-ui 0.1.10 → 0.1.12
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/fesm2022/codexly-ui.mjs +101 -5
- package/fesm2022/codexly-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/codexly-ui.d.ts +12 -6
package/fesm2022/codexly-ui.mjs
CHANGED
|
@@ -174,7 +174,7 @@ const CLX_FONT_CATALOG = [
|
|
|
174
174
|
{
|
|
175
175
|
label: 'Inter',
|
|
176
176
|
value: 'Inter',
|
|
177
|
-
googleUrl: 'https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap',
|
|
177
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap',
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
label: 'Poppins',
|
|
@@ -216,6 +216,71 @@ const CLX_FONT_CATALOG = [
|
|
|
216
216
|
value: 'Open Sans',
|
|
217
217
|
googleUrl: 'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap',
|
|
218
218
|
},
|
|
219
|
+
{
|
|
220
|
+
label: 'Work Sans',
|
|
221
|
+
value: 'Work Sans',
|
|
222
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
label: 'Manrope',
|
|
226
|
+
value: 'Manrope',
|
|
227
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&display=swap',
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
label: 'Sora',
|
|
231
|
+
value: 'Sora',
|
|
232
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&display=swap',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: 'Outfit',
|
|
236
|
+
value: 'Outfit',
|
|
237
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
label: 'Rubik',
|
|
241
|
+
value: 'Rubik',
|
|
242
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap',
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
label: 'Source Sans 3',
|
|
246
|
+
value: 'Source Sans 3',
|
|
247
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap',
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
label: 'Space Grotesk',
|
|
251
|
+
value: 'Space Grotesk',
|
|
252
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: 'Merriweather',
|
|
256
|
+
value: 'Merriweather',
|
|
257
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&display=swap',
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
label: 'Playfair Display',
|
|
261
|
+
value: 'Playfair Display',
|
|
262
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&display=swap',
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
label: 'Lora',
|
|
266
|
+
value: 'Lora',
|
|
267
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap',
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
label: 'PT Serif',
|
|
271
|
+
value: 'PT Serif',
|
|
272
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap',
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: 'Caveat',
|
|
276
|
+
value: 'Caveat',
|
|
277
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&display=swap',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
label: 'Dancing Script',
|
|
281
|
+
value: 'Dancing Script',
|
|
282
|
+
googleUrl: 'https://fonts.googleapis.com/css2?family=Dancing+Script:wght@400;500;600;700&display=swap',
|
|
283
|
+
},
|
|
219
284
|
];
|
|
220
285
|
// ── Tailwind rounded classes per borderRadius token ───────────────────────────
|
|
221
286
|
const CLX_RADIUS_MAP = {
|
|
@@ -4452,11 +4517,18 @@ class ClxSelectComponent {
|
|
|
4452
4517
|
_activeColor = computed(() => this.activeColor() ?? this._themeSvc.config().primaryColor, ...(ngDevMode ? [{ debugName: "_activeColor" }] : /* istanbul ignore next */ []));
|
|
4453
4518
|
_el = inject((ElementRef));
|
|
4454
4519
|
_sso = inject(ScrollStrategyOptions);
|
|
4520
|
+
_isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
4521
|
+
_loadedFonts = new Set();
|
|
4455
4522
|
_scrollStrategy = this._sso.reposition();
|
|
4456
4523
|
constructor() {
|
|
4457
4524
|
this._searchQuery = toSignal(this._searchControl.valueChanges.pipe(startWith(''), map(v => v ?? '')), { initialValue: '' });
|
|
4458
4525
|
if (this._ngControl)
|
|
4459
4526
|
this._ngControl.valueAccessor = this;
|
|
4527
|
+
effect(() => {
|
|
4528
|
+
const family = this._displayFontFamily();
|
|
4529
|
+
if (family)
|
|
4530
|
+
this._loadPreviewFont(family);
|
|
4531
|
+
});
|
|
4460
4532
|
// Async autocomplete: debounce + switchMap sobre el search control
|
|
4461
4533
|
this._searchControl.valueChanges.pipe(debounceTime(this.debounceMs()), distinctUntilChanged(), switchMap(query => {
|
|
4462
4534
|
const q = query ?? '';
|
|
@@ -4504,6 +4576,10 @@ class ClxSelectComponent {
|
|
|
4504
4576
|
const sel = this._selectedOptions();
|
|
4505
4577
|
return sel.length ? sel[0].label : this.placeholder();
|
|
4506
4578
|
}, ...(ngDevMode ? [{ debugName: "_displayValue" }] : /* istanbul ignore next */ []));
|
|
4579
|
+
_displayFontFamily = computed(() => {
|
|
4580
|
+
const sel = this._selectedOptions();
|
|
4581
|
+
return sel.length ? sel[0].previewFontFamily ?? null : null;
|
|
4582
|
+
}, ...(ngDevMode ? [{ debugName: "_displayFontFamily" }] : /* istanbul ignore next */ []));
|
|
4507
4583
|
_overlayWidth = computed(() => this._overlayWidthPx(), ...(ngDevMode ? [{ debugName: "_overlayWidth" }] : /* istanbul ignore next */ []));
|
|
4508
4584
|
_labelClass = computed(() => `${this._sizeConfig().label} ${CLX_TEXT_LABEL} leading-none`, ...(ngDevMode ? [{ debugName: "_labelClass" }] : /* istanbul ignore next */ []));
|
|
4509
4585
|
_hintClass = computed(() => `${this._sizeConfig().hint} ${CLX_TEXT_HINT}`, ...(ngDevMode ? [{ debugName: "_hintClass" }] : /* istanbul ignore next */ []));
|
|
@@ -4554,6 +4630,26 @@ class ClxSelectComponent {
|
|
|
4554
4630
|
if (!this.async())
|
|
4555
4631
|
this._searchControl.setValue('', { emitEvent: false });
|
|
4556
4632
|
this._isOpen.set(true);
|
|
4633
|
+
for (const opt of this.options()) {
|
|
4634
|
+
if (opt.previewFontFamily)
|
|
4635
|
+
this._loadPreviewFont(opt.previewFontFamily);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
_loadPreviewFont(family) {
|
|
4639
|
+
if (!this._isBrowser || this._loadedFonts.has(family))
|
|
4640
|
+
return;
|
|
4641
|
+
const option = CLX_FONT_CATALOG.find(f => f.value === family);
|
|
4642
|
+
if (!option)
|
|
4643
|
+
return;
|
|
4644
|
+
this._loadedFonts.add(family);
|
|
4645
|
+
const id = `clx-preview-font-${family.replace(/\s+/g, '-').toLowerCase()}`;
|
|
4646
|
+
if (document.getElementById(id))
|
|
4647
|
+
return;
|
|
4648
|
+
const link = document.createElement('link');
|
|
4649
|
+
link.id = id;
|
|
4650
|
+
link.rel = 'stylesheet';
|
|
4651
|
+
link.href = option.googleUrl;
|
|
4652
|
+
document.head.appendChild(link);
|
|
4557
4653
|
}
|
|
4558
4654
|
_closePanel() {
|
|
4559
4655
|
this._isOpen.set(false);
|
|
@@ -4663,7 +4759,7 @@ class ClxSelectComponent {
|
|
|
4663
4759
|
|
|
4664
4760
|
<!-- Single mode: display value -->
|
|
4665
4761
|
} @else {
|
|
4666
|
-
<span [class]="_singleDisplayClass()">{{ _displayValue() }}</span>
|
|
4762
|
+
<span [class]="_singleDisplayClass()" [style.font-family]="_displayFontFamily()">{{ _displayValue() }}</span>
|
|
4667
4763
|
}
|
|
4668
4764
|
|
|
4669
4765
|
<!-- Right controls: clear + chevron -->
|
|
@@ -4743,7 +4839,7 @@ class ClxSelectComponent {
|
|
|
4743
4839
|
[disabled]="opt.disabled ?? false"
|
|
4744
4840
|
(mousedown)="$event.preventDefault()"
|
|
4745
4841
|
(click)="_selectOption(opt)">
|
|
4746
|
-
<span class="flex-1 text-left truncate">{{ opt.label }}</span>
|
|
4842
|
+
<span class="flex-1 text-left truncate" [style.font-family]="opt.previewFontFamily ?? null">{{ opt.label }}</span>
|
|
4747
4843
|
@if (_isSelected(opt.value)) {
|
|
4748
4844
|
<span clx-icon name="check" size="xs" class="shrink-0"></span>
|
|
4749
4845
|
}
|
|
@@ -4810,7 +4906,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
|
|
|
4810
4906
|
|
|
4811
4907
|
<!-- Single mode: display value -->
|
|
4812
4908
|
} @else {
|
|
4813
|
-
<span [class]="_singleDisplayClass()">{{ _displayValue() }}</span>
|
|
4909
|
+
<span [class]="_singleDisplayClass()" [style.font-family]="_displayFontFamily()">{{ _displayValue() }}</span>
|
|
4814
4910
|
}
|
|
4815
4911
|
|
|
4816
4912
|
<!-- Right controls: clear + chevron -->
|
|
@@ -4890,7 +4986,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.15", ngImpo
|
|
|
4890
4986
|
[disabled]="opt.disabled ?? false"
|
|
4891
4987
|
(mousedown)="$event.preventDefault()"
|
|
4892
4988
|
(click)="_selectOption(opt)">
|
|
4893
|
-
<span class="flex-1 text-left truncate">{{ opt.label }}</span>
|
|
4989
|
+
<span class="flex-1 text-left truncate" [style.font-family]="opt.previewFontFamily ?? null">{{ opt.label }}</span>
|
|
4894
4990
|
@if (_isSelected(opt.value)) {
|
|
4895
4991
|
<span clx-icon name="check" size="xs" class="shrink-0"></span>
|
|
4896
4992
|
}
|