@memberjunction/ng-ui-components 6.2.0-edge.1 → 6.2.0-edge.3
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/README.md +9 -2
- package/dist/lib/datepicker/datepicker.component.d.ts +3 -0
- package/dist/lib/datepicker/datepicker.component.d.ts.map +1 -1
- package/dist/lib/datepicker/datepicker.component.js +20 -4
- package/dist/lib/datepicker/datepicker.component.js.map +1 -1
- package/dist/lib/dialog/dialog.component.d.ts +78 -2
- package/dist/lib/dialog/dialog.component.d.ts.map +1 -1
- package/dist/lib/dialog/dialog.component.js +292 -10
- package/dist/lib/dialog/dialog.component.js.map +1 -1
- package/dist/lib/dropdown/dropdown.component.d.ts.map +1 -1
- package/dist/lib/dropdown/dropdown.component.js +8 -0
- package/dist/lib/dropdown/dropdown.component.js.map +1 -1
- package/dist/lib/icon-picker/font-awesome-icons.d.ts +130 -0
- package/dist/lib/icon-picker/font-awesome-icons.d.ts.map +1 -0
- package/dist/lib/icon-picker/font-awesome-icons.js +256 -0
- package/dist/lib/icon-picker/font-awesome-icons.js.map +1 -0
- package/dist/lib/icon-picker/icon-catalogue.service.d.ts +71 -0
- package/dist/lib/icon-picker/icon-catalogue.service.d.ts.map +1 -0
- package/dist/lib/icon-picker/icon-catalogue.service.js +153 -0
- package/dist/lib/icon-picker/icon-catalogue.service.js.map +1 -0
- package/dist/lib/icon-picker/icon-picker.component.d.ts +117 -0
- package/dist/lib/icon-picker/icon-picker.component.d.ts.map +1 -0
- package/dist/lib/icon-picker/icon-picker.component.js +362 -0
- package/dist/lib/icon-picker/icon-picker.component.js.map +1 -0
- package/dist/public-api.d.ts +3 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +3 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.js","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGT,aAuBU,CAAC;wBACV,OAAO,EAAE,iBAAiB;wBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,oBAAoB,CAAC;wBAClD,KAAK,EAAE,IAAI;qBACZ,CAAC;;kBAGD,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAOL,KAAK;;kBAQL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAEN,YAAY;mBAAC,gBAAgB;;kBAW7B,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,aAAa;;kBAEvB,WAAW;mBAAC,wBAAwB;;kFAxC1B,mBAAmB","sourcesContent":["import {\n AfterViewInit,\n Component,\n Input,\n Output,\n EventEmitter,\n forwardRef,\n HostBinding,\n ElementRef,\n ViewChild,\n ContentChild,\n TemplateRef,\n OnDestroy,\n inject,\n ChangeDetectorRef\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-dropdown — Dropdown select component using CDK Overlay.\n *\n * Replaces `<kendo-dropdownlist>`.\n *\n * Every dropdown needs an ACCESSIBLE NAME, or it announces as \"combobox, collapsed\" with no hint of\n * what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —\n * `<label for>` cannot name a `div[role=combobox]` — and {@link AriaLabel} when none does.\n *\n * @example With a visible label (preferred)\n * ```html\n * <span id=\"persona-label\">Interview persona</span>\n * <mj-dropdown\n * AriaLabelledBy=\"persona-label\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\">\n * </mj-dropdown>\n * ```\n *\n * @example With no visible label\n * ```html\n * <mj-dropdown\n * AriaLabel=\"Interview persona\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\"\n * [Filterable]=\"true\"\n * (FilterChange)=\"onFilter($event)\">\n * </mj-dropdown>\n * ```\n */\n@Component({\n selector: 'mj-dropdown',\n standalone: true,\n imports: [NgTemplateOutlet, OverlayModule],\n template: `\n <div\n class=\"mj-dropdown\"\n #trigger\n cdkOverlayOrigin\n #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-dropdown--open]=\"IsOpen\"\n [class.mj-dropdown--disabled]=\"IsDisabled\"\n role=\"combobox\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [attr.aria-expanded]=\"IsOpen\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"IsOpen ? ListboxId : null\"\n [attr.aria-disabled]=\"IsDisabled ? 'true' : null\"\n [attr.tabindex]=\"IsDisabled ? -1 : 0\"\n (click)=\"Toggle()\"\n (keydown)=\"OnKeyDown($event)\"\n (blur)=\"OnBlur()\">\n <span class=\"mj-dropdown-value\" [class.mj-dropdown-placeholder]=\"!HasValue\">\n {{ DisplayText }}\n </span>\n <i class=\"fa-solid fa-chevron-down mj-dropdown-arrow\"></i>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\"\n [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayWidth]=\"TriggerWidth\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\"\n (detach)=\"Close()\">\n <div class=\"mj-dropdown-panel\" role=\"listbox\"\n [attr.id]=\"ListboxId\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\">\n @if (Filterable) {\n <div class=\"mj-dropdown-filter-wrap\">\n <!--\n The word \"Filter\" lives in a hidden span rather than in a concatenated string so the\n AriaLabelledBy path can NAME this box from the same visible label that names the\n dropdown: aria-labelledby takes an ID LIST, so \"Filter\" plus the label's own text is\n composed by the accessibility tree without this component ever seeing that text.\n Without it, every filterable dropdown on a form named this way announces as an\n identical \"Filter options\".\n\n A hidden node that is DIRECTLY referenced by aria-labelledby is still included in the\n name (accname §4.1), so aria-hidden keeps the word out of the reading order without\n costing the composed name.\n -->\n <span class=\"mj-dropdown-sr-only\" aria-hidden=\"true\" [attr.id]=\"FilterWordId\">Filter</span>\n <input\n #filterInput\n class=\"mj-input mj-dropdown-filter\"\n type=\"text\"\n placeholder=\"Filter...\"\n [attr.aria-labelledby]=\"FilterLabelledBy\"\n [attr.aria-label]=\"FilterLabelledBy ? null : FilterLabel\"\n [value]=\"filterText\"\n (input)=\"OnFilterInput($event)\"\n (keydown)=\"OnKeyDown($event)\" />\n </div>\n }\n @if (DefaultItem != null) {\n <div\n class=\"mj-dropdown-option mj-dropdown-option--default\"\n [class.mj-dropdown-option--selected]=\"SelectedValue == null\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === -1\"\n role=\"option\"\n [attr.aria-selected]=\"SelectedValue == null\"\n (click)=\"SelectItem(null, $event)\">\n {{ GetItemText(DefaultItem) }}\n </div>\n }\n @for (item of FilteredItems; track TrackByIndex($index)) {\n <div\n class=\"mj-dropdown-option\"\n [class.mj-dropdown-option--selected]=\"IsItemSelected(item)\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === $index\"\n role=\"option\"\n [attr.aria-selected]=\"IsItemSelected(item)\"\n (click)=\"SelectItem(item, $event)\">\n @if (itemTemplate) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n } @else {\n {{ GetItemText(item) }}\n }\n </div>\n }\n @if (FilteredItems.length === 0) {\n <div class=\"mj-dropdown-no-data\">No data found</div>\n }\n </div>\n </ng-template>\n `,\n styles: [`\n /*\n * Component-scoped ON PURPOSE, unlike the rest of this control's styling, which ships as a global\n * stylesheet the host application imports. A host that skips that import gets unstyled chrome —\n * survivable — but a hidden-word span that is not hidden renders its word as literal text in the\n * middle of the field. The rule that hides it therefore has to travel with the component.\n *\n * Not display:none or visibility:hidden — both remove the element from the accessibility tree,\n * which is the one thing this element exists to be in.\n */\n .mj-dropdown-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MJDropdownComponent),\n multi: true\n }]\n})\nexport class MJDropdownComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit, OnDestroy {\n @Input() Data: Record<string, unknown>[] | string[] | readonly unknown[] | null = [];\n @Input() TextField = '';\n @Input() ValueField = '';\n @Input() Filterable = false;\n @Input() ValuePrimitive = false;\n /**\n * Host-driven disable. Composed with Angular Forms' `setDisabledState()` into `IsDisabled`\n * (the actual gate) — see `syncDisabled`. A setter, not a bare field, because this input is\n * routinely bound to an expression that changes over the control's lifetime\n * (`[Disabled]=\"!draft.CompanyID\"`), and the gate has to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) {\n this.disabledInput = value;\n this.syncDisabled();\n }\n get Disabled(): boolean {\n return this.disabledInput;\n }\n @Input() Placeholder = 'Select...';\n @Input() DefaultItem: Record<string, unknown> | string | null = null;\n\n @Output() FilterChange = new EventEmitter<string>();\n @Output() ValueChange = new EventEmitter<unknown>();\n\n @ContentChild('mjDropdownItem') ItemTemplate: TemplateRef<{ $implicit: unknown }> | null = null;\n\n /** @deprecated Use {@link ItemTemplate}. */\n get itemTemplate(): TemplateRef<{ $implicit: unknown }> | null {\n return this.ItemTemplate;\n }\n /** @deprecated Use {@link ItemTemplate}. */\n set itemTemplate(value: TemplateRef<{ $implicit: unknown }> | null) {\n this.ItemTemplate = value;\n }\n\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('filterInput') private filterInputEl: ElementRef<HTMLInputElement> | undefined;\n\n @HostBinding('class.mj-dropdown-host') readonly hostClass = true;\n\n private cdr = inject(ChangeDetectorRef);\n\n /** This dropdown's id suffix — the shared named-control counter, kept under its own name. */\n readonly DropdownId = this.NamedControlId;\n\n /**\n * Id of the popup listbox, so the trigger can point `aria-controls` at it while open — the half of\n * the combobox pattern that makes \"collapsed/expanded\" refer to something a screen reader can\n * find. Generated per instance from the shared named-control counter.\n */\n get ListboxId(): string { return `mj-dropdown-listbox-${this.DropdownId}`; }\n\n /** Id of the hidden \"Filter\" word, composed into the filter box's name via an id list. */\n get FilterWordId(): string { return this.SecondaryWordId('filter-word'); }\n\n /** `aria-labelledby` for the filter box when a VISIBLE label names the dropdown. */\n get FilterLabelledBy(): string { return this.SecondaryLabelledBy('filter-word'); }\n\n /** `aria-label` for the filter box in the no-visible-label case. */\n get FilterLabel(): string { return this.SecondaryLabel('Filter', 'Filter options'); }\n\n IsOpen = false;\n /**\n * The single gate on `Toggle()` / `Open()` — true when EITHER the `Disabled` input or Angular\n * Forms says so. Never assign it directly; go through `syncDisabled()` so both sources are\n * always composed and a lock closes an open panel.\n */\n IsDisabled = false;\n HighlightedIndex = -1;\n SelectedValue: unknown = null;\n TriggerWidth = 0;\n\n filterText = '';\n\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n\n private onChange: (value: unknown) => void = () => {};\n private onTouched: () => void = () => {};\n\n /** Backing field for the `Disabled` input. */\n private disabledInput = false;\n /** The forms-driven disabled state, kept SEPARATE so neither source can stomp the other. */\n private formDisabled = false;\n\n /**\n * Recompute the gate from both of its sources. Called whenever either changes.\n *\n * `IsDisabled` is derived state, and the only thing that assigned it was `setDisabledState()`.\n * The forms-driven half was in fact fine — `setUpControl` also wires `registerOnDisabledChange`,\n * so that hook fires on every `control.disable()`/`enable()`, not just at registration. What had\n * no recompute path at all was the `Disabled` @Input: a plain field, so the gate froze at\n * whatever the first compose produced and every later change to the input was dropped.\n *\n * That is how a `[Disabled]=\"!draft.CompanyID\"` picker stayed dead for the life of the\n * component after the company was finally chosen.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n // Becoming disabled while the panel is open would otherwise leave an interactive list\n // hanging off a control the user can no longer operate.\n if (disabled) this.resetPanelState();\n this.cdr.markForCheck();\n }\n\n get FilteredItems(): unknown[] {\n const data = (this.Data ?? []) as unknown[];\n if (!this.Filterable || !this.filterText) return data;\n const search = this.filterText.toLowerCase();\n return data.filter(item => this.GetItemText(item).toLowerCase().includes(search));\n }\n\n get HasValue(): boolean { return this.SelectedValue != null; }\n\n get DisplayText(): string {\n if (this.SelectedValue == null) {\n if (this.DefaultItem != null) return this.GetItemText(this.DefaultItem);\n return this.Placeholder;\n }\n if (this.ValuePrimitive && this.ValueField) {\n const found = ((this.Data ?? []) as unknown[]).find(item => this.GetItemValue(item) === this.SelectedValue);\n return found ? this.GetItemText(found) : String(this.SelectedValue);\n }\n return this.GetItemText(this.SelectedValue as Record<string, unknown> | string);\n }\n\n Toggle(): void {\n if (this.IsDisabled) return;\n this.IsOpen ? this.Close() : this.Open();\n }\n\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.TriggerWidth = this.triggerEl?.nativeElement.offsetWidth ?? 200;\n this.IsOpen = true;\n this.HighlightedIndex = this.getSelectedIndex();\n this.cdr.detectChanges();\n if (this.Filterable) setTimeout(() => this.filterInputEl?.nativeElement.focus(), 0);\n }\n\n Close(): void {\n if (!this.IsOpen) return;\n this.resetPanelState();\n this.cdr.detectChanges();\n }\n\n /**\n * Panel state only — no change detection. Split out of `Close()` because `syncDisabled()` can\n * run from an @Input setter, i.e. DURING the parent's change-detection pass, where a nested\n * `detectChanges()` re-enters CD and trips NG0100 on the parent's own bindings.\n */\n private resetPanelState(): void {\n this.IsOpen = false;\n this.filterText = '';\n this.HighlightedIndex = -1;\n }\n\n SelectItem(item: unknown | null, event?: Event): void {\n event?.stopPropagation();\n if (item == null) {\n this.SelectedValue = null;\n this.onChange(null);\n this.ValueChange.emit(null);\n } else if (this.ValuePrimitive && this.ValueField) {\n const value = this.GetItemValue(item);\n this.SelectedValue = value;\n this.onChange(value);\n this.ValueChange.emit(value);\n } else {\n this.SelectedValue = item;\n this.onChange(item);\n this.ValueChange.emit(item);\n }\n this.Close();\n }\n\n IsItemSelected(item: unknown): boolean {\n if (this.SelectedValue == null) return false;\n if (this.ValuePrimitive && this.ValueField) return this.GetItemValue(item) === this.SelectedValue;\n if (this.ValueField && typeof item === 'object' && typeof this.SelectedValue === 'object')\n return this.GetItemValue(item) === this.GetItemValue(this.SelectedValue);\n return item === this.SelectedValue;\n }\n\n OnFilterInput(event: Event): void {\n this.filterText = (event.target as HTMLInputElement).value;\n this.HighlightedIndex = 0;\n this.FilterChange.emit(this.filterText);\n }\n\n OnKeyDown(event: KeyboardEvent): void {\n const items = this.FilteredItems;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.IsOpen) this.Open();\n else this.HighlightedIndex = Math.min(this.HighlightedIndex + 1, items.length - 1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (this.IsOpen) this.HighlightedIndex = Math.max(this.HighlightedIndex - 1, 0);\n break;\n case 'Enter':\n event.preventDefault();\n if (this.IsOpen && this.HighlightedIndex >= 0 && this.HighlightedIndex < items.length)\n this.SelectItem(items[this.HighlightedIndex]);\n else if (!this.IsOpen) this.Open();\n break;\n case 'Escape': event.preventDefault(); this.Close(); break;\n case 'Home': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = 0; } break;\n case 'End': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = items.length - 1; } break;\n }\n }\n\n OnBlur(): void { this.onTouched(); }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.triggerEl?.nativeElement, 'mj-dropdown'); }\n\n GetItemText(item: unknown): string {\n if (item == null) return '';\n if (typeof item === 'string') return item;\n if (this.TextField && typeof item === 'object') return String((item as Record<string, unknown>)[this.TextField] ?? '');\n return String(item);\n }\n\n GetItemValue(item: unknown): unknown {\n if (typeof item === 'string') return item;\n if (this.ValueField && typeof item === 'object' && item != null) return (item as Record<string, unknown>)[this.ValueField];\n return item;\n }\n\n TrackByIndex(index: number): number { return index; }\n\n writeValue(value: unknown): void { this.SelectedValue = value; }\n registerOnChange(fn: (value: unknown) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.formDisabled = isDisabled; this.syncDisabled(); }\n ngOnDestroy(): void { this.Close(); }\n\n private getSelectedIndex(): number {\n if (this.SelectedValue == null) return -1;\n return this.FilteredItems.findIndex(item => this.IsItemSelected(item));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown.component.js","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,WAAW,EAEX,SAAS,EACT,YAAY,EAGZ,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,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AoB,CAAC;wBAClD,KAAK,EAAE,IAAI;qBACZ,CAAC;;kBAGD,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAOL,KAAK;;kBAQL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAEN,YAAY;mBAAC,gBAAgB;;kBAW7B,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,aAAa;;kBAEvB,WAAW;mBAAC,wBAAwB;;kFAxC1B,mBAAmB","sourcesContent":["import {\n AfterViewInit,\n Component,\n Input,\n Output,\n EventEmitter,\n forwardRef,\n HostBinding,\n ElementRef,\n ViewChild,\n ContentChild,\n TemplateRef,\n OnDestroy,\n inject,\n ChangeDetectorRef\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-dropdown — Dropdown select component using CDK Overlay.\n *\n * Replaces `<kendo-dropdownlist>`.\n *\n * Every dropdown needs an ACCESSIBLE NAME, or it announces as \"combobox, collapsed\" with no hint of\n * what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —\n * `<label for>` cannot name a `div[role=combobox]` — and {@link AriaLabel} when none does.\n *\n * @example With a visible label (preferred)\n * ```html\n * <span id=\"persona-label\">Interview persona</span>\n * <mj-dropdown\n * AriaLabelledBy=\"persona-label\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\">\n * </mj-dropdown>\n * ```\n *\n * @example With no visible label\n * ```html\n * <mj-dropdown\n * AriaLabel=\"Interview persona\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\"\n * [Filterable]=\"true\"\n * (FilterChange)=\"onFilter($event)\">\n * </mj-dropdown>\n * ```\n */\n@Component({\n selector: 'mj-dropdown',\n standalone: true,\n imports: [NgTemplateOutlet, OverlayModule],\n template: `\n <div\n class=\"mj-dropdown\"\n #trigger\n cdkOverlayOrigin\n #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-dropdown--open]=\"IsOpen\"\n [class.mj-dropdown--disabled]=\"IsDisabled\"\n role=\"combobox\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [attr.aria-expanded]=\"IsOpen\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"IsOpen ? ListboxId : null\"\n [attr.aria-disabled]=\"IsDisabled ? 'true' : null\"\n [attr.tabindex]=\"IsDisabled ? -1 : 0\"\n (click)=\"Toggle()\"\n (keydown)=\"OnKeyDown($event)\"\n (blur)=\"OnBlur()\">\n <span class=\"mj-dropdown-value\" [class.mj-dropdown-placeholder]=\"!HasValue\">\n {{ DisplayText }}\n </span>\n <i class=\"fa-solid fa-chevron-down mj-dropdown-arrow\"></i>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\"\n [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayWidth]=\"TriggerWidth\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\"\n (detach)=\"Close()\">\n <div class=\"mj-dropdown-panel\" role=\"listbox\"\n [attr.id]=\"ListboxId\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\">\n @if (Filterable) {\n <div class=\"mj-dropdown-filter-wrap\">\n <!--\n The word \"Filter\" lives in a hidden span rather than in a concatenated string so the\n AriaLabelledBy path can NAME this box from the same visible label that names the\n dropdown: aria-labelledby takes an ID LIST, so \"Filter\" plus the label's own text is\n composed by the accessibility tree without this component ever seeing that text.\n Without it, every filterable dropdown on a form named this way announces as an\n identical \"Filter options\".\n\n A hidden node that is DIRECTLY referenced by aria-labelledby is still included in the\n name (accname §4.1), so aria-hidden keeps the word out of the reading order without\n costing the composed name.\n -->\n <span class=\"mj-dropdown-sr-only\" aria-hidden=\"true\" [attr.id]=\"FilterWordId\">Filter</span>\n <input\n #filterInput\n class=\"mj-input mj-dropdown-filter\"\n type=\"text\"\n placeholder=\"Filter...\"\n [attr.aria-labelledby]=\"FilterLabelledBy\"\n [attr.aria-label]=\"FilterLabelledBy ? null : FilterLabel\"\n [value]=\"filterText\"\n (input)=\"OnFilterInput($event)\"\n (keydown)=\"OnKeyDown($event)\" />\n </div>\n }\n @if (DefaultItem != null) {\n <div\n class=\"mj-dropdown-option mj-dropdown-option--default\"\n [class.mj-dropdown-option--selected]=\"SelectedValue == null\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === -1\"\n role=\"option\"\n [attr.aria-selected]=\"SelectedValue == null\"\n (click)=\"SelectItem(null, $event)\">\n {{ GetItemText(DefaultItem) }}\n </div>\n }\n @for (item of FilteredItems; track TrackByIndex($index)) {\n <div\n class=\"mj-dropdown-option\"\n [class.mj-dropdown-option--selected]=\"IsItemSelected(item)\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === $index\"\n role=\"option\"\n [attr.aria-selected]=\"IsItemSelected(item)\"\n (click)=\"SelectItem(item, $event)\">\n @if (itemTemplate) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n } @else {\n {{ GetItemText(item) }}\n }\n </div>\n }\n @if (FilteredItems.length === 0) {\n <div class=\"mj-dropdown-no-data\">No data found</div>\n }\n </div>\n </ng-template>\n `,\n styles: [`\n /*\n * Component-scoped ON PURPOSE, unlike the rest of this control's styling, which ships as a global\n * stylesheet the host application imports. A host that skips that import gets unstyled chrome —\n * survivable — but a hidden-word span that is not hidden renders its word as literal text in the\n * middle of the field. The rule that hides it therefore has to travel with the component.\n *\n * Not display:none or visibility:hidden — both remove the element from the accessibility tree,\n * which is the one thing this element exists to be in.\n */\n .mj-dropdown-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MJDropdownComponent),\n multi: true\n }]\n})\nexport class MJDropdownComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit, OnDestroy {\n @Input() Data: Record<string, unknown>[] | string[] | readonly unknown[] | null = [];\n @Input() TextField = '';\n @Input() ValueField = '';\n @Input() Filterable = false;\n @Input() ValuePrimitive = false;\n /**\n * Host-driven disable. Composed with Angular Forms' `setDisabledState()` into `IsDisabled`\n * (the actual gate) — see `syncDisabled`. A setter, not a bare field, because this input is\n * routinely bound to an expression that changes over the control's lifetime\n * (`[Disabled]=\"!draft.CompanyID\"`), and the gate has to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) {\n this.disabledInput = value;\n this.syncDisabled();\n }\n get Disabled(): boolean {\n return this.disabledInput;\n }\n @Input() Placeholder = 'Select...';\n @Input() DefaultItem: Record<string, unknown> | string | null = null;\n\n @Output() FilterChange = new EventEmitter<string>();\n @Output() ValueChange = new EventEmitter<unknown>();\n\n @ContentChild('mjDropdownItem') ItemTemplate: TemplateRef<{ $implicit: unknown }> | null = null;\n\n /** @deprecated Use {@link ItemTemplate}. */\n get itemTemplate(): TemplateRef<{ $implicit: unknown }> | null {\n return this.ItemTemplate;\n }\n /** @deprecated Use {@link ItemTemplate}. */\n set itemTemplate(value: TemplateRef<{ $implicit: unknown }> | null) {\n this.ItemTemplate = value;\n }\n\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('filterInput') private filterInputEl: ElementRef<HTMLInputElement> | undefined;\n\n @HostBinding('class.mj-dropdown-host') readonly hostClass = true;\n\n private cdr = inject(ChangeDetectorRef);\n\n /** This dropdown's id suffix — the shared named-control counter, kept under its own name. */\n readonly DropdownId = this.NamedControlId;\n\n /**\n * Id of the popup listbox, so the trigger can point `aria-controls` at it while open — the half of\n * the combobox pattern that makes \"collapsed/expanded\" refer to something a screen reader can\n * find. Generated per instance from the shared named-control counter.\n */\n get ListboxId(): string { return `mj-dropdown-listbox-${this.DropdownId}`; }\n\n /** Id of the hidden \"Filter\" word, composed into the filter box's name via an id list. */\n get FilterWordId(): string { return this.SecondaryWordId('filter-word'); }\n\n /** `aria-labelledby` for the filter box when a VISIBLE label names the dropdown. */\n get FilterLabelledBy(): string { return this.SecondaryLabelledBy('filter-word'); }\n\n /** `aria-label` for the filter box in the no-visible-label case. */\n get FilterLabel(): string { return this.SecondaryLabel('Filter', 'Filter options'); }\n\n IsOpen = false;\n /**\n * The single gate on `Toggle()` / `Open()` — true when EITHER the `Disabled` input or Angular\n * Forms says so. Never assign it directly; go through `syncDisabled()` so both sources are\n * always composed and a lock closes an open panel.\n */\n IsDisabled = false;\n HighlightedIndex = -1;\n SelectedValue: unknown = null;\n TriggerWidth = 0;\n\n filterText = '';\n\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n\n private onChange: (value: unknown) => void = () => {};\n private onTouched: () => void = () => {};\n\n /** Backing field for the `Disabled` input. */\n private disabledInput = false;\n /** The forms-driven disabled state, kept SEPARATE so neither source can stomp the other. */\n private formDisabled = false;\n\n /**\n * Recompute the gate from both of its sources. Called whenever either changes.\n *\n * `IsDisabled` is derived state, and the only thing that assigned it was `setDisabledState()`.\n * The forms-driven half was in fact fine — `setUpControl` also wires `registerOnDisabledChange`,\n * so that hook fires on every `control.disable()`/`enable()`, not just at registration. What had\n * no recompute path at all was the `Disabled` @Input: a plain field, so the gate froze at\n * whatever the first compose produced and every later change to the input was dropped.\n *\n * That is how a `[Disabled]=\"!draft.CompanyID\"` picker stayed dead for the life of the\n * component after the company was finally chosen.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n // Becoming disabled while the panel is open would otherwise leave an interactive list\n // hanging off a control the user can no longer operate.\n if (disabled) this.resetPanelState();\n this.cdr.markForCheck();\n }\n\n get FilteredItems(): unknown[] {\n const data = (this.Data ?? []) as unknown[];\n if (!this.Filterable || !this.filterText) return data;\n const search = this.filterText.toLowerCase();\n return data.filter(item => this.GetItemText(item).toLowerCase().includes(search));\n }\n\n get HasValue(): boolean { return this.SelectedValue != null; }\n\n get DisplayText(): string {\n if (this.SelectedValue == null) {\n if (this.DefaultItem != null) return this.GetItemText(this.DefaultItem);\n return this.Placeholder;\n }\n if (this.ValuePrimitive && this.ValueField) {\n const found = ((this.Data ?? []) as unknown[]).find(item => this.GetItemValue(item) === this.SelectedValue);\n return found ? this.GetItemText(found) : String(this.SelectedValue);\n }\n return this.GetItemText(this.SelectedValue as Record<string, unknown> | string);\n }\n\n Toggle(): void {\n if (this.IsDisabled) return;\n this.IsOpen ? this.Close() : this.Open();\n }\n\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.TriggerWidth = this.triggerEl?.nativeElement.offsetWidth ?? 200;\n this.IsOpen = true;\n this.HighlightedIndex = this.getSelectedIndex();\n this.cdr.detectChanges();\n if (this.Filterable) setTimeout(() => this.filterInputEl?.nativeElement.focus(), 0);\n }\n\n Close(): void {\n if (!this.IsOpen) return;\n this.resetPanelState();\n this.cdr.detectChanges();\n }\n\n /**\n * Panel state only — no change detection. Split out of `Close()` because `syncDisabled()` can\n * run from an @Input setter, i.e. DURING the parent's change-detection pass, where a nested\n * `detectChanges()` re-enters CD and trips NG0100 on the parent's own bindings.\n */\n private resetPanelState(): void {\n this.IsOpen = false;\n this.filterText = '';\n this.HighlightedIndex = -1;\n }\n\n SelectItem(item: unknown | null, event?: Event): void {\n event?.stopPropagation();\n if (item == null) {\n this.SelectedValue = null;\n this.onChange(null);\n this.ValueChange.emit(null);\n } else if (this.ValuePrimitive && this.ValueField) {\n const value = this.GetItemValue(item);\n this.SelectedValue = value;\n this.onChange(value);\n this.ValueChange.emit(value);\n } else {\n this.SelectedValue = item;\n this.onChange(item);\n this.ValueChange.emit(item);\n }\n this.Close();\n }\n\n IsItemSelected(item: unknown): boolean {\n if (this.SelectedValue == null) return false;\n if (this.ValuePrimitive && this.ValueField) return this.GetItemValue(item) === this.SelectedValue;\n if (this.ValueField && typeof item === 'object' && typeof this.SelectedValue === 'object')\n return this.GetItemValue(item) === this.GetItemValue(this.SelectedValue);\n return item === this.SelectedValue;\n }\n\n OnFilterInput(event: Event): void {\n this.filterText = (event.target as HTMLInputElement).value;\n this.HighlightedIndex = 0;\n this.FilterChange.emit(this.filterText);\n }\n\n OnKeyDown(event: KeyboardEvent): void {\n const items = this.FilteredItems;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.IsOpen) this.Open();\n else this.HighlightedIndex = Math.min(this.HighlightedIndex + 1, items.length - 1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (this.IsOpen) this.HighlightedIndex = Math.max(this.HighlightedIndex - 1, 0);\n break;\n case 'Enter':\n event.preventDefault();\n if (this.IsOpen && this.HighlightedIndex >= 0 && this.HighlightedIndex < items.length)\n this.SelectItem(items[this.HighlightedIndex]);\n else if (!this.IsOpen) this.Open();\n break;\n case 'Escape': event.preventDefault(); this.Close(); break;\n case 'Tab':\n // The panel lives in the overlay, outside a parent dialog. Hand focus back to this\n // field and do not prevent the key, so the browser moves on from the field.\n if (this.IsOpen) {\n this.triggerEl?.nativeElement.focus();\n this.Close();\n }\n break;\n case 'Home': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = 0; } break;\n case 'End': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = items.length - 1; } break;\n }\n }\n\n OnBlur(): void { this.onTouched(); }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.triggerEl?.nativeElement, 'mj-dropdown'); }\n\n GetItemText(item: unknown): string {\n if (item == null) return '';\n if (typeof item === 'string') return item;\n if (this.TextField && typeof item === 'object') return String((item as Record<string, unknown>)[this.TextField] ?? '');\n return String(item);\n }\n\n GetItemValue(item: unknown): unknown {\n if (typeof item === 'string') return item;\n if (this.ValueField && typeof item === 'object' && item != null) return (item as Record<string, unknown>)[this.ValueField];\n return item;\n }\n\n TrackByIndex(index: number): number { return index; }\n\n writeValue(value: unknown): void { this.SelectedValue = value; }\n registerOnChange(fn: (value: unknown) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.formDisabled = isDisabled; this.syncDisabled(); }\n ngOnDestroy(): void { this.Close(); }\n\n private getSelectedIndex(): number {\n if (this.SelectedValue == null) return -1;\n return this.FilteredItems.findIndex(item => this.IsItemSelected(item));\n }\n}\n"]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Font Awesome icons this page can actually draw, and in which style.
|
|
3
|
+
*
|
|
4
|
+
* Read from the loaded stylesheet rather than from a list shipped here, so the catalogue
|
|
5
|
+
* is whatever the host really loaded — Free, Pro, or a pinned older version. A list in
|
|
6
|
+
* source would drift from it silently and offer icons that render as blank squares.
|
|
7
|
+
*
|
|
8
|
+
* Knowing the NAME is not enough. Font Awesome splits its icons across several fonts, and
|
|
9
|
+
* the stylesheet gives every icon the same kind of rule whichever font holds it — so a
|
|
10
|
+
* name drawn in the wrong style renders as a missing-glyph box. Which font has a given
|
|
11
|
+
* glyph is not written down anywhere in the CSS, so it is measured: a glyph the font does
|
|
12
|
+
* not have falls back and measures exactly as it does with no Font Awesome at all.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The style prefix to assume for a bare icon name.
|
|
16
|
+
*
|
|
17
|
+
* Solid, because it is the one style Font Awesome Free carries in full — `fa-regular`
|
|
18
|
+
* exists there for only a few dozen icons, so defaulting to it would silently produce
|
|
19
|
+
* blanks for most names.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DEFAULT_ICON_STYLE = "fa-solid";
|
|
22
|
+
/**
|
|
23
|
+
* The styles the picker offers, widest set first so a solid icon is reported as solid.
|
|
24
|
+
*
|
|
25
|
+
* Brands is deliberately absent. Those icons are company logos — Angular, Apple, Amazon
|
|
26
|
+
* Pay — and a section header or a rail label is not a place for one; offering six hundred
|
|
27
|
+
* of them buries the icons that do belong behind names nobody is searching for.
|
|
28
|
+
*
|
|
29
|
+
* Excluded from what is OFFERED, not from what renders: `fa-brands` stays a style
|
|
30
|
+
* {@link NormalizeIconClass} leaves alone, so a brands class already stored, or typed by
|
|
31
|
+
* hand, still draws.
|
|
32
|
+
*/
|
|
33
|
+
export declare const ICON_STYLES: readonly string[];
|
|
34
|
+
/** One icon the page can draw, with the style that actually draws it. */
|
|
35
|
+
export interface FontAwesomeIcon {
|
|
36
|
+
/** The bare name, e.g. `chart-column`. */
|
|
37
|
+
Name: string;
|
|
38
|
+
/** The style class that has the glyph, e.g. `fa-solid`. */
|
|
39
|
+
Style: string;
|
|
40
|
+
/** Other names the stylesheet gives the same glyph in the same style, e.g. `home` for `house`. */
|
|
41
|
+
Aliases?: readonly string[];
|
|
42
|
+
}
|
|
43
|
+
/** An icon name and the character its stylesheet rule assigns it. */
|
|
44
|
+
export interface IconGlyphRule {
|
|
45
|
+
Name: string;
|
|
46
|
+
/** The character from the rule's `content`, which is what gets measured. */
|
|
47
|
+
Glyph: string;
|
|
48
|
+
}
|
|
49
|
+
/** How one style renders, as the browser resolves it. */
|
|
50
|
+
export interface IconStyleFont {
|
|
51
|
+
Style: string;
|
|
52
|
+
FontFamily: string;
|
|
53
|
+
FontWeight: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A small, dependable set for when the stylesheet cannot be read.
|
|
57
|
+
*
|
|
58
|
+
* Solid-only, and chosen to cover the things a form panel is usually about rather than to
|
|
59
|
+
* be exhaustive: a user who needs something else can still type its name.
|
|
60
|
+
*/
|
|
61
|
+
export declare const FALLBACK_ICONS: readonly FontAwesomeIcon[];
|
|
62
|
+
/**
|
|
63
|
+
* An icon value the browser can actually draw.
|
|
64
|
+
*
|
|
65
|
+
* Font Awesome needs a style class as well as a name: `fa-chart-column` alone matches the
|
|
66
|
+
* base `.fa-chart-column` rule, which sets a glyph but no font family, so nothing renders.
|
|
67
|
+
* A value that already names a style is returned untouched, including the older one-class
|
|
68
|
+
* `fa fa-folder` form that the generated forms still use.
|
|
69
|
+
*
|
|
70
|
+
* @param style the style to assume for a bare name. Defaults to {@link DEFAULT_ICON_STYLE}.
|
|
71
|
+
*/
|
|
72
|
+
export declare function NormalizeIconClass(value: string | null | undefined, style?: string): string;
|
|
73
|
+
/** The icon name inside a class string, without its style or `fa-` prefix. */
|
|
74
|
+
export declare function IconNameOf(value: string | null | undefined): string;
|
|
75
|
+
/**
|
|
76
|
+
* Icon names and glyphs the loaded stylesheets define.
|
|
77
|
+
*
|
|
78
|
+
* A rule qualifies when it styles `.fa-<name>` with `::before` content, which is how Font
|
|
79
|
+
* Awesome attaches a glyph — the sizing and animation helpers share the prefix but set no
|
|
80
|
+
* content, so this tells the two apart without a list to maintain.
|
|
81
|
+
*/
|
|
82
|
+
export declare function ScanLoadedIconRules(doc: Document): IconGlyphRule[];
|
|
83
|
+
/**
|
|
84
|
+
* The character a `content` value names.
|
|
85
|
+
*
|
|
86
|
+
* Font Awesome writes it as a CSS escape — `content: "\f007"` — which reaches script with
|
|
87
|
+
* the quotes and the escape intact. A value naming anything else (a keyword, a counter,
|
|
88
|
+
* a var it could not resolve) yields nothing, so it is skipped rather than measured.
|
|
89
|
+
*/
|
|
90
|
+
export declare function GlyphFromContent(content: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* How each style renders, as the browser resolves it on this page.
|
|
93
|
+
*
|
|
94
|
+
* Probed rather than assumed: the font family carries the major version in its name
|
|
95
|
+
* (`Font Awesome 6 Free`), and a host on another version, or on a kit, names it something
|
|
96
|
+
* else. A style whose family does not resolve is left out — it is not loaded.
|
|
97
|
+
*/
|
|
98
|
+
export declare function ProbeIconStyleFonts(doc: Document, styles?: readonly string[]): IconStyleFont[];
|
|
99
|
+
/**
|
|
100
|
+
* Whether a font has a glyph, decided by measuring it.
|
|
101
|
+
*
|
|
102
|
+
* Implemented by the caller so this module stays free of canvas and testable without one.
|
|
103
|
+
* Returns true when `glyph` renders from `font` rather than falling back.
|
|
104
|
+
*/
|
|
105
|
+
export type GlyphPresenceTest = (glyph: string, font: IconStyleFont) => boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Each icon paired with the style that actually draws it.
|
|
108
|
+
*
|
|
109
|
+
* The stylesheet says which icons exist but not which font holds each one, and drawing a
|
|
110
|
+
* brands icon as solid produces a missing-glyph box — which is what a user sees as "half
|
|
111
|
+
* the icons are broken". Styles are tried in order, so an icon present in several is
|
|
112
|
+
* reported under the first, and an icon no loaded font has is dropped rather than offered
|
|
113
|
+
* as a blank square.
|
|
114
|
+
*
|
|
115
|
+
* Names that draw the same glyph in the same style are one icon: the first name in `rules`
|
|
116
|
+
* order is kept and the rest become its {@link FontAwesomeIcon.Aliases}, so the grid shows
|
|
117
|
+
* each glyph once and a search for any of its names finds it.
|
|
118
|
+
*/
|
|
119
|
+
export declare function ResolveIconStyles(rules: readonly IconGlyphRule[], fonts: readonly IconStyleFont[], hasGlyph: GlyphPresenceTest): FontAwesomeIcon[];
|
|
120
|
+
/** How many icons the picker's grid draws at most; the rest are reached by searching. */
|
|
121
|
+
export declare const ICON_RESULT_LIMIT = 240;
|
|
122
|
+
/**
|
|
123
|
+
* Every icon matching a search, most relevant first: names that start with it, then names
|
|
124
|
+
* that contain it. An icon matches by its name or by any of its aliases. An empty search
|
|
125
|
+
* matches every icon.
|
|
126
|
+
*/
|
|
127
|
+
export declare function MatchIcons(icons: readonly FontAwesomeIcon[], search: string): FontAwesomeIcon[];
|
|
128
|
+
/** The first `limit` icons {@link MatchIcons} finds for a search. */
|
|
129
|
+
export declare function FilterIcons(icons: readonly FontAwesomeIcon[], search: string, limit?: number): FontAwesomeIcon[];
|
|
130
|
+
//# sourceMappingURL=font-awesome-icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-awesome-icons.d.ts","sourceRoot":"","sources":["../../../src/lib/icon-picker/font-awesome-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAA+B,CAAC;AAoBzE,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B;AAED,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,yDAAyD;AACzD,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,eAAe,EAcC,CAAC;AAQvD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,KAAK,GAAE,MAA2B,GAAG,MAAM,CAO/G;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAInE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,EAAE,CAgBlE;AAmBD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKxD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAE,SAAS,MAAM,EAAgB,GAAG,aAAa,EAAE,CAsB3G;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,QAAQ,EAAE,iBAAiB,GAC5B,eAAe,EAAE,CAkBnB;AAED,yFAAyF;AACzF,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe,EAAE,CAW/F;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,eAAe,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,SAAoB,GAAG,eAAe,EAAE,CAE3H"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What Font Awesome icons this page can actually draw, and in which style.
|
|
3
|
+
*
|
|
4
|
+
* Read from the loaded stylesheet rather than from a list shipped here, so the catalogue
|
|
5
|
+
* is whatever the host really loaded — Free, Pro, or a pinned older version. A list in
|
|
6
|
+
* source would drift from it silently and offer icons that render as blank squares.
|
|
7
|
+
*
|
|
8
|
+
* Knowing the NAME is not enough. Font Awesome splits its icons across several fonts, and
|
|
9
|
+
* the stylesheet gives every icon the same kind of rule whichever font holds it — so a
|
|
10
|
+
* name drawn in the wrong style renders as a missing-glyph box. Which font has a given
|
|
11
|
+
* glyph is not written down anywhere in the CSS, so it is measured: a glyph the font does
|
|
12
|
+
* not have falls back and measures exactly as it does with no Font Awesome at all.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The style prefix to assume for a bare icon name.
|
|
16
|
+
*
|
|
17
|
+
* Solid, because it is the one style Font Awesome Free carries in full — `fa-regular`
|
|
18
|
+
* exists there for only a few dozen icons, so defaulting to it would silently produce
|
|
19
|
+
* blanks for most names.
|
|
20
|
+
*/
|
|
21
|
+
export const DEFAULT_ICON_STYLE = 'fa-solid';
|
|
22
|
+
/**
|
|
23
|
+
* The styles the picker offers, widest set first so a solid icon is reported as solid.
|
|
24
|
+
*
|
|
25
|
+
* Brands is deliberately absent. Those icons are company logos — Angular, Apple, Amazon
|
|
26
|
+
* Pay — and a section header or a rail label is not a place for one; offering six hundred
|
|
27
|
+
* of them buries the icons that do belong behind names nobody is searching for.
|
|
28
|
+
*
|
|
29
|
+
* Excluded from what is OFFERED, not from what renders: `fa-brands` stays a style
|
|
30
|
+
* {@link NormalizeIconClass} leaves alone, so a brands class already stored, or typed by
|
|
31
|
+
* hand, still draws.
|
|
32
|
+
*/
|
|
33
|
+
export const ICON_STYLES = ['fa-solid', 'fa-regular'];
|
|
34
|
+
/** Style prefixes an icon value may already carry, so normalization leaves it alone. */
|
|
35
|
+
const STYLE_PREFIXES = ['fa-solid', 'fa-regular', 'fa-brands', 'fa-light', 'fa-thin', 'fa-duotone', 'fas', 'far', 'fab', 'fal', 'fat', 'fad', 'fa'];
|
|
36
|
+
/**
|
|
37
|
+
* Class names that start with `fa-` but are not icons: sizing, animation and layout
|
|
38
|
+
* helpers. They carry no glyph, so offering them gives the user an empty square.
|
|
39
|
+
*/
|
|
40
|
+
const NON_ICON_CLASSES = new Set([
|
|
41
|
+
'fa-spin', 'fa-pulse', 'fa-spin-pulse', 'fa-spin-reverse', 'fa-beat', 'fa-fade',
|
|
42
|
+
'fa-beat-fade', 'fa-bounce', 'fa-flip', 'fa-shake', 'fa-fw', 'fa-border', 'fa-inverse',
|
|
43
|
+
'fa-pull-left', 'fa-pull-right', 'fa-rotate-90', 'fa-rotate-180', 'fa-rotate-270',
|
|
44
|
+
'fa-rotate-by', 'fa-flip-horizontal', 'fa-flip-vertical', 'fa-flip-both', 'fa-stack',
|
|
45
|
+
'fa-stack-1x', 'fa-stack-2x', 'fa-layers', 'fa-layers-text', 'fa-layers-counter',
|
|
46
|
+
'fa-sr-only', 'fa-sr-only-focusable', 'fa-li', 'fa-ul', 'fa-xs', 'fa-sm', 'fa-lg',
|
|
47
|
+
'fa-xl', 'fa-2xl', 'fa-1x', 'fa-2x', 'fa-3x', 'fa-4x', 'fa-5x', 'fa-6x', 'fa-7x',
|
|
48
|
+
'fa-8x', 'fa-9x', 'fa-10x', 'fa-2xs', 'fa-swap-opacity', 'fa-width-auto',
|
|
49
|
+
]);
|
|
50
|
+
/**
|
|
51
|
+
* A small, dependable set for when the stylesheet cannot be read.
|
|
52
|
+
*
|
|
53
|
+
* Solid-only, and chosen to cover the things a form panel is usually about rather than to
|
|
54
|
+
* be exhaustive: a user who needs something else can still type its name.
|
|
55
|
+
*/
|
|
56
|
+
export const FALLBACK_ICONS = [
|
|
57
|
+
'address-card', 'bell', 'bolt', 'book', 'bookmark', 'box', 'briefcase', 'building',
|
|
58
|
+
'bullseye', 'calendar', 'calendar-check', 'certificate', 'chart-bar', 'chart-column',
|
|
59
|
+
'chart-line', 'chart-pie', 'check', 'circle-check', 'circle-info', 'clipboard',
|
|
60
|
+
'clipboard-list', 'clock', 'cloud', 'code', 'comment', 'comments', 'compass',
|
|
61
|
+
'credit-card', 'database', 'diagram-project', 'dollar-sign', 'envelope', 'eye',
|
|
62
|
+
'file', 'file-lines', 'filter', 'flag', 'folder', 'gauge', 'gear', 'globe',
|
|
63
|
+
'graduation-cap', 'grip-vertical', 'heart', 'house', 'id-badge', 'id-card', 'image',
|
|
64
|
+
'inbox', 'key', 'layer-group', 'lightbulb', 'link', 'list', 'list-check', 'location-dot',
|
|
65
|
+
'lock', 'magnifying-glass', 'map', 'medal', 'message', 'money-bill', 'note-sticky',
|
|
66
|
+
'paperclip', 'pen', 'people-group', 'percent', 'phone', 'puzzle-piece', 'receipt',
|
|
67
|
+
'rocket', 'ruler', 'screwdriver-wrench', 'shield', 'sitemap', 'sliders', 'star',
|
|
68
|
+
'table', 'table-cells', 'tag', 'tags', 'thumbtack', 'ticket', 'timeline', 'trophy',
|
|
69
|
+
'truck', 'user', 'user-group', 'users', 'wand-magic-sparkles', 'warehouse', 'wrench',
|
|
70
|
+
].map((Name) => ({ Name, Style: DEFAULT_ICON_STYLE }));
|
|
71
|
+
/** Whether this value already names a Font Awesome style. */
|
|
72
|
+
function hasStylePrefix(value) {
|
|
73
|
+
const classes = value.split(/\s+/).filter((c) => c.length > 0);
|
|
74
|
+
return classes.some((c) => STYLE_PREFIXES.includes(c));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* An icon value the browser can actually draw.
|
|
78
|
+
*
|
|
79
|
+
* Font Awesome needs a style class as well as a name: `fa-chart-column` alone matches the
|
|
80
|
+
* base `.fa-chart-column` rule, which sets a glyph but no font family, so nothing renders.
|
|
81
|
+
* A value that already names a style is returned untouched, including the older one-class
|
|
82
|
+
* `fa fa-folder` form that the generated forms still use.
|
|
83
|
+
*
|
|
84
|
+
* @param style the style to assume for a bare name. Defaults to {@link DEFAULT_ICON_STYLE}.
|
|
85
|
+
*/
|
|
86
|
+
export function NormalizeIconClass(value, style = DEFAULT_ICON_STYLE) {
|
|
87
|
+
const trimmed = (value ?? '').trim().replace(/\s+/g, ' ');
|
|
88
|
+
if (trimmed.length === 0)
|
|
89
|
+
return '';
|
|
90
|
+
if (hasStylePrefix(trimmed))
|
|
91
|
+
return trimmed;
|
|
92
|
+
// A bare name without the fa- prefix is still meant as an icon name.
|
|
93
|
+
const named = trimmed.startsWith('fa-') ? trimmed : `fa-${trimmed}`;
|
|
94
|
+
return `${style} ${named}`;
|
|
95
|
+
}
|
|
96
|
+
/** The icon name inside a class string, without its style or `fa-` prefix. */
|
|
97
|
+
export function IconNameOf(value) {
|
|
98
|
+
const classes = (value ?? '').trim().split(/\s+/).filter((c) => c.length > 0);
|
|
99
|
+
const name = classes.find((c) => c.startsWith('fa-') && !STYLE_PREFIXES.includes(c) && !NON_ICON_CLASSES.has(c));
|
|
100
|
+
return name ? name.slice(3) : '';
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Icon names and glyphs the loaded stylesheets define.
|
|
104
|
+
*
|
|
105
|
+
* A rule qualifies when it styles `.fa-<name>` with `::before` content, which is how Font
|
|
106
|
+
* Awesome attaches a glyph — the sizing and animation helpers share the prefix but set no
|
|
107
|
+
* content, so this tells the two apart without a list to maintain.
|
|
108
|
+
*/
|
|
109
|
+
export function ScanLoadedIconRules(doc) {
|
|
110
|
+
const found = new Map();
|
|
111
|
+
for (const sheet of Array.from(doc.styleSheets)) {
|
|
112
|
+
let rules = null;
|
|
113
|
+
try {
|
|
114
|
+
rules = sheet.cssRules;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Served without CORS headers, so its rules are not readable from script.
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (!rules)
|
|
121
|
+
continue;
|
|
122
|
+
for (const rule of Array.from(rules))
|
|
123
|
+
collectFromRule(rule, found);
|
|
124
|
+
}
|
|
125
|
+
return [...found.entries()]
|
|
126
|
+
.map(([Name, Glyph]) => ({ Name, Glyph }))
|
|
127
|
+
.sort((a, b) => a.Name.localeCompare(b.Name));
|
|
128
|
+
}
|
|
129
|
+
function collectFromRule(rule, found) {
|
|
130
|
+
const style = rule;
|
|
131
|
+
const selector = typeof style.selectorText === 'string' ? style.selectorText : '';
|
|
132
|
+
if (!selector || (!selector.includes('::before') && !selector.includes(':before')))
|
|
133
|
+
return;
|
|
134
|
+
const content = style.style?.getPropertyValue('content');
|
|
135
|
+
if (!content)
|
|
136
|
+
return;
|
|
137
|
+
const glyph = GlyphFromContent(content);
|
|
138
|
+
if (!glyph)
|
|
139
|
+
return;
|
|
140
|
+
for (const part of selector.split(',')) {
|
|
141
|
+
const match = part.trim().match(/^\.(fa-[a-z0-9-]+)::?before$/);
|
|
142
|
+
if (!match)
|
|
143
|
+
continue;
|
|
144
|
+
const cls = match[1];
|
|
145
|
+
if (NON_ICON_CLASSES.has(cls))
|
|
146
|
+
continue;
|
|
147
|
+
found.set(cls.slice(3), glyph);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The character a `content` value names.
|
|
152
|
+
*
|
|
153
|
+
* Font Awesome writes it as a CSS escape — `content: "\f007"` — which reaches script with
|
|
154
|
+
* the quotes and the escape intact. A value naming anything else (a keyword, a counter,
|
|
155
|
+
* a var it could not resolve) yields nothing, so it is skipped rather than measured.
|
|
156
|
+
*/
|
|
157
|
+
export function GlyphFromContent(content) {
|
|
158
|
+
const body = content.trim().replace(/^["']|["']$/g, '');
|
|
159
|
+
const escaped = body.match(/^\\([0-9a-fA-F]{1,6})$/);
|
|
160
|
+
if (escaped)
|
|
161
|
+
return String.fromCodePoint(parseInt(escaped[1], 16));
|
|
162
|
+
return body.length === 1 || [...body].length === 1 ? body : '';
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* How each style renders, as the browser resolves it on this page.
|
|
166
|
+
*
|
|
167
|
+
* Probed rather than assumed: the font family carries the major version in its name
|
|
168
|
+
* (`Font Awesome 6 Free`), and a host on another version, or on a kit, names it something
|
|
169
|
+
* else. A style whose family does not resolve is left out — it is not loaded.
|
|
170
|
+
*/
|
|
171
|
+
export function ProbeIconStyleFonts(doc, styles = ICON_STYLES) {
|
|
172
|
+
const out = [];
|
|
173
|
+
const host = doc.body ?? doc.documentElement;
|
|
174
|
+
if (!host)
|
|
175
|
+
return out;
|
|
176
|
+
for (const style of styles) {
|
|
177
|
+
const probe = doc.createElement('i');
|
|
178
|
+
probe.className = style;
|
|
179
|
+
probe.setAttribute('aria-hidden', 'true');
|
|
180
|
+
probe.style.position = 'absolute';
|
|
181
|
+
probe.style.left = '-99999px';
|
|
182
|
+
host.appendChild(probe);
|
|
183
|
+
try {
|
|
184
|
+
const computed = doc.defaultView?.getComputedStyle(probe);
|
|
185
|
+
const family = (computed?.fontFamily ?? '').trim();
|
|
186
|
+
if (family && /font\s*awesome/i.test(family)) {
|
|
187
|
+
out.push({ Style: style, FontFamily: family, FontWeight: (computed?.fontWeight ?? '400').trim() });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
host.removeChild(probe);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Each icon paired with the style that actually draws it.
|
|
198
|
+
*
|
|
199
|
+
* The stylesheet says which icons exist but not which font holds each one, and drawing a
|
|
200
|
+
* brands icon as solid produces a missing-glyph box — which is what a user sees as "half
|
|
201
|
+
* the icons are broken". Styles are tried in order, so an icon present in several is
|
|
202
|
+
* reported under the first, and an icon no loaded font has is dropped rather than offered
|
|
203
|
+
* as a blank square.
|
|
204
|
+
*
|
|
205
|
+
* Names that draw the same glyph in the same style are one icon: the first name in `rules`
|
|
206
|
+
* order is kept and the rest become its {@link FontAwesomeIcon.Aliases}, so the grid shows
|
|
207
|
+
* each glyph once and a search for any of its names finds it.
|
|
208
|
+
*/
|
|
209
|
+
export function ResolveIconStyles(rules, fonts, hasGlyph) {
|
|
210
|
+
if (fonts.length === 0)
|
|
211
|
+
return [];
|
|
212
|
+
const out = [];
|
|
213
|
+
const byGlyph = new Map();
|
|
214
|
+
for (const rule of rules) {
|
|
215
|
+
const font = fonts.find((f) => hasGlyph(rule.Glyph, f));
|
|
216
|
+
if (!font)
|
|
217
|
+
continue;
|
|
218
|
+
const key = `${font.Style}|${rule.Glyph}`;
|
|
219
|
+
const kept = byGlyph.get(key);
|
|
220
|
+
if (kept) {
|
|
221
|
+
kept.Aliases = [...(kept.Aliases ?? []), rule.Name];
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const icon = { Name: rule.Name, Style: font.Style };
|
|
225
|
+
byGlyph.set(key, icon);
|
|
226
|
+
out.push(icon);
|
|
227
|
+
}
|
|
228
|
+
return out;
|
|
229
|
+
}
|
|
230
|
+
/** How many icons the picker's grid draws at most; the rest are reached by searching. */
|
|
231
|
+
export const ICON_RESULT_LIMIT = 240;
|
|
232
|
+
/**
|
|
233
|
+
* Every icon matching a search, most relevant first: names that start with it, then names
|
|
234
|
+
* that contain it. An icon matches by its name or by any of its aliases. An empty search
|
|
235
|
+
* matches every icon.
|
|
236
|
+
*/
|
|
237
|
+
export function MatchIcons(icons, search) {
|
|
238
|
+
const needle = search.trim().toLowerCase().replace(/^fa-/, '');
|
|
239
|
+
if (needle.length === 0)
|
|
240
|
+
return [...icons];
|
|
241
|
+
const starts = [];
|
|
242
|
+
const contains = [];
|
|
243
|
+
for (const icon of icons) {
|
|
244
|
+
const names = [icon.Name, ...(icon.Aliases ?? [])];
|
|
245
|
+
if (names.some((name) => name.startsWith(needle)))
|
|
246
|
+
starts.push(icon);
|
|
247
|
+
else if (names.some((name) => name.includes(needle)))
|
|
248
|
+
contains.push(icon);
|
|
249
|
+
}
|
|
250
|
+
return [...starts, ...contains];
|
|
251
|
+
}
|
|
252
|
+
/** The first `limit` icons {@link MatchIcons} finds for a search. */
|
|
253
|
+
export function FilterIcons(icons, search, limit = ICON_RESULT_LIMIT) {
|
|
254
|
+
return MatchIcons(icons, search).slice(0, limit);
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=font-awesome-icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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,UAAU,UAAU,CAAC,KAAiC,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QACnD,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAChE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC;AACpC,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAC,KAAiC,EAAE,MAAc,EAAE,KAAK,GAAG,iBAAiB;IACpG,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AACrD,CAAC","sourcesContent":["/**\n * What Font Awesome icons this page can actually draw, and in which style.\n *\n * Read from the loaded stylesheet rather than from a list shipped here, so the catalogue\n * is whatever the host really loaded — Free, Pro, or a pinned older version. A list in\n * source would drift from it silently and offer icons that render as blank squares.\n *\n * Knowing the NAME is not enough. Font Awesome splits its icons across several fonts, and\n * the stylesheet gives every icon the same kind of rule whichever font holds it — so a\n * name drawn in the wrong style renders as a missing-glyph box. Which font has a given\n * glyph is not written down anywhere in the CSS, so it is measured: a glyph the font does\n * not have falls back and measures exactly as it does with no Font Awesome at all.\n */\n\n/**\n * The style prefix to assume for a bare icon name.\n *\n * Solid, because it is the one style Font Awesome Free carries in full — `fa-regular`\n * exists there for only a few dozen icons, so defaulting to it would silently produce\n * blanks for most names.\n */\nexport const DEFAULT_ICON_STYLE = 'fa-solid';\n\n/**\n * The styles the picker offers, widest set first so a solid icon is reported as solid.\n *\n * Brands is deliberately absent. Those icons are company logos — Angular, Apple, Amazon\n * Pay — and a section header or a rail label is not a place for one; offering six hundred\n * of them buries the icons that do belong behind names nobody is searching for.\n *\n * Excluded from what is OFFERED, not from what renders: `fa-brands` stays a style\n * {@link NormalizeIconClass} leaves alone, so a brands class already stored, or typed by\n * hand, still draws.\n */\nexport const ICON_STYLES: readonly string[] = ['fa-solid', 'fa-regular'];\n\n/** Style prefixes an icon value may already carry, so normalization leaves it alone. */\nconst STYLE_PREFIXES = ['fa-solid', 'fa-regular', 'fa-brands', 'fa-light', 'fa-thin', 'fa-duotone', 'fas', 'far', 'fab', 'fal', 'fat', 'fad', 'fa'];\n\n/**\n * Class names that start with `fa-` but are not icons: sizing, animation and layout\n * helpers. They carry no glyph, so offering them gives the user an empty square.\n */\nconst NON_ICON_CLASSES = new Set([\n 'fa-spin', 'fa-pulse', 'fa-spin-pulse', 'fa-spin-reverse', 'fa-beat', 'fa-fade',\n 'fa-beat-fade', 'fa-bounce', 'fa-flip', 'fa-shake', 'fa-fw', 'fa-border', 'fa-inverse',\n 'fa-pull-left', 'fa-pull-right', 'fa-rotate-90', 'fa-rotate-180', 'fa-rotate-270',\n 'fa-rotate-by', 'fa-flip-horizontal', 'fa-flip-vertical', 'fa-flip-both', 'fa-stack',\n 'fa-stack-1x', 'fa-stack-2x', 'fa-layers', 'fa-layers-text', 'fa-layers-counter',\n 'fa-sr-only', 'fa-sr-only-focusable', 'fa-li', 'fa-ul', 'fa-xs', 'fa-sm', 'fa-lg',\n 'fa-xl', 'fa-2xl', 'fa-1x', 'fa-2x', 'fa-3x', 'fa-4x', 'fa-5x', 'fa-6x', 'fa-7x',\n 'fa-8x', 'fa-9x', 'fa-10x', 'fa-2xs', 'fa-swap-opacity', 'fa-width-auto',\n]);\n\n/** One icon the page can draw, with the style that actually draws it. */\nexport interface FontAwesomeIcon {\n /** The bare name, e.g. `chart-column`. */\n Name: string;\n /** The style class that has the glyph, e.g. `fa-solid`. */\n Style: string;\n /** Other names the stylesheet gives the same glyph in the same style, e.g. `home` for `house`. */\n Aliases?: readonly string[];\n}\n\n/** An icon name and the character its stylesheet rule assigns it. */\nexport interface IconGlyphRule {\n Name: string;\n /** The character from the rule's `content`, which is what gets measured. */\n Glyph: string;\n}\n\n/** How one style renders, as the browser resolves it. */\nexport interface IconStyleFont {\n Style: string;\n FontFamily: string;\n FontWeight: string;\n}\n\n/**\n * A small, dependable set for when the stylesheet cannot be read.\n *\n * Solid-only, and chosen to cover the things a form panel is usually about rather than to\n * be exhaustive: a user who needs something else can still type its name.\n */\nexport const FALLBACK_ICONS: readonly FontAwesomeIcon[] = [\n 'address-card', 'bell', 'bolt', 'book', 'bookmark', 'box', 'briefcase', 'building',\n 'bullseye', 'calendar', 'calendar-check', 'certificate', 'chart-bar', 'chart-column',\n 'chart-line', 'chart-pie', 'check', 'circle-check', 'circle-info', 'clipboard',\n 'clipboard-list', 'clock', 'cloud', 'code', 'comment', 'comments', 'compass',\n 'credit-card', 'database', 'diagram-project', 'dollar-sign', 'envelope', 'eye',\n 'file', 'file-lines', 'filter', 'flag', 'folder', 'gauge', 'gear', 'globe',\n 'graduation-cap', 'grip-vertical', 'heart', 'house', 'id-badge', 'id-card', 'image',\n 'inbox', 'key', 'layer-group', 'lightbulb', 'link', 'list', 'list-check', 'location-dot',\n 'lock', 'magnifying-glass', 'map', 'medal', 'message', 'money-bill', 'note-sticky',\n 'paperclip', 'pen', 'people-group', 'percent', 'phone', 'puzzle-piece', 'receipt',\n 'rocket', 'ruler', 'screwdriver-wrench', 'shield', 'sitemap', 'sliders', 'star',\n 'table', 'table-cells', 'tag', 'tags', 'thumbtack', 'ticket', 'timeline', 'trophy',\n 'truck', 'user', 'user-group', 'users', 'wand-magic-sparkles', 'warehouse', 'wrench',\n].map((Name) => ({ Name, Style: DEFAULT_ICON_STYLE }));\n\n/** Whether this value already names a Font Awesome style. */\nfunction hasStylePrefix(value: string): boolean {\n const classes = value.split(/\\s+/).filter((c) => c.length > 0);\n return classes.some((c) => STYLE_PREFIXES.includes(c));\n}\n\n/**\n * An icon value the browser can actually draw.\n *\n * Font Awesome needs a style class as well as a name: `fa-chart-column` alone matches the\n * base `.fa-chart-column` rule, which sets a glyph but no font family, so nothing renders.\n * A value that already names a style is returned untouched, including the older one-class\n * `fa fa-folder` form that the generated forms still use.\n *\n * @param style the style to assume for a bare name. Defaults to {@link DEFAULT_ICON_STYLE}.\n */\nexport function NormalizeIconClass(value: string | null | undefined, style: string = DEFAULT_ICON_STYLE): string {\n const trimmed = (value ?? '').trim().replace(/\\s+/g, ' ');\n if (trimmed.length === 0) return '';\n if (hasStylePrefix(trimmed)) return trimmed;\n // A bare name without the fa- prefix is still meant as an icon name.\n const named = trimmed.startsWith('fa-') ? trimmed : `fa-${trimmed}`;\n return `${style} ${named}`;\n}\n\n/** The icon name inside a class string, without its style or `fa-` prefix. */\nexport function IconNameOf(value: string | null | undefined): string {\n const classes = (value ?? '').trim().split(/\\s+/).filter((c) => c.length > 0);\n const name = classes.find((c) => c.startsWith('fa-') && !STYLE_PREFIXES.includes(c) && !NON_ICON_CLASSES.has(c));\n return name ? name.slice(3) : '';\n}\n\n/**\n * Icon names and glyphs the loaded stylesheets define.\n *\n * A rule qualifies when it styles `.fa-<name>` with `::before` content, which is how Font\n * Awesome attaches a glyph — the sizing and animation helpers share the prefix but set no\n * content, so this tells the two apart without a list to maintain.\n */\nexport function ScanLoadedIconRules(doc: Document): IconGlyphRule[] {\n const found = new Map<string, string>();\n for (const sheet of Array.from(doc.styleSheets)) {\n let rules: CSSRuleList | null = null;\n try {\n rules = sheet.cssRules;\n } catch {\n // Served without CORS headers, so its rules are not readable from script.\n continue;\n }\n if (!rules) continue;\n for (const rule of Array.from(rules)) collectFromRule(rule, found);\n }\n return [...found.entries()]\n .map(([Name, Glyph]) => ({ Name, Glyph }))\n .sort((a, b) => a.Name.localeCompare(b.Name));\n}\n\nfunction collectFromRule(rule: CSSRule, found: Map<string, string>): void {\n const style = rule as CSSStyleRule;\n const selector = typeof style.selectorText === 'string' ? style.selectorText : '';\n if (!selector || (!selector.includes('::before') && !selector.includes(':before'))) return;\n const content = style.style?.getPropertyValue('content');\n if (!content) return;\n const glyph = GlyphFromContent(content);\n if (!glyph) return;\n for (const part of selector.split(',')) {\n const match = part.trim().match(/^\\.(fa-[a-z0-9-]+)::?before$/);\n if (!match) continue;\n const cls = match[1];\n if (NON_ICON_CLASSES.has(cls)) continue;\n found.set(cls.slice(3), glyph);\n }\n}\n\n/**\n * The character a `content` value names.\n *\n * Font Awesome writes it as a CSS escape — `content: \"\\f007\"` — which reaches script with\n * the quotes and the escape intact. A value naming anything else (a keyword, a counter,\n * a var it could not resolve) yields nothing, so it is skipped rather than measured.\n */\nexport function GlyphFromContent(content: string): string {\n const body = content.trim().replace(/^[\"']|[\"']$/g, '');\n const escaped = body.match(/^\\\\([0-9a-fA-F]{1,6})$/);\n if (escaped) return String.fromCodePoint(parseInt(escaped[1], 16));\n return body.length === 1 || [...body].length === 1 ? body : '';\n}\n\n/**\n * How each style renders, as the browser resolves it on this page.\n *\n * Probed rather than assumed: the font family carries the major version in its name\n * (`Font Awesome 6 Free`), and a host on another version, or on a kit, names it something\n * else. A style whose family does not resolve is left out — it is not loaded.\n */\nexport function ProbeIconStyleFonts(doc: Document, styles: readonly string[] = ICON_STYLES): IconStyleFont[] {\n const out: IconStyleFont[] = [];\n const host = doc.body ?? doc.documentElement;\n if (!host) return out;\n for (const style of styles) {\n const probe = doc.createElement('i');\n probe.className = style;\n probe.setAttribute('aria-hidden', 'true');\n probe.style.position = 'absolute';\n probe.style.left = '-99999px';\n host.appendChild(probe);\n try {\n const computed = doc.defaultView?.getComputedStyle(probe);\n const family = (computed?.fontFamily ?? '').trim();\n if (family && /font\\s*awesome/i.test(family)) {\n out.push({ Style: style, FontFamily: family, FontWeight: (computed?.fontWeight ?? '400').trim() });\n }\n } finally {\n host.removeChild(probe);\n }\n }\n return out;\n}\n\n/**\n * Whether a font has a glyph, decided by measuring it.\n *\n * Implemented by the caller so this module stays free of canvas and testable without one.\n * Returns true when `glyph` renders from `font` rather than falling back.\n */\nexport type GlyphPresenceTest = (glyph: string, font: IconStyleFont) => boolean;\n\n/**\n * Each icon paired with the style that actually draws it.\n *\n * The stylesheet says which icons exist but not which font holds each one, and drawing a\n * brands icon as solid produces a missing-glyph box — which is what a user sees as \"half\n * the icons are broken\". Styles are tried in order, so an icon present in several is\n * reported under the first, and an icon no loaded font has is dropped rather than offered\n * as a blank square.\n *\n * Names that draw the same glyph in the same style are one icon: the first name in `rules`\n * order is kept and the rest become its {@link FontAwesomeIcon.Aliases}, so the grid shows\n * each glyph once and a search for any of its names finds it.\n */\nexport function ResolveIconStyles(\n rules: readonly IconGlyphRule[],\n fonts: readonly IconStyleFont[],\n hasGlyph: GlyphPresenceTest,\n): FontAwesomeIcon[] {\n if (fonts.length === 0) return [];\n const out: FontAwesomeIcon[] = [];\n const byGlyph = new Map<string, FontAwesomeIcon>();\n for (const rule of rules) {\n const font = fonts.find((f) => hasGlyph(rule.Glyph, f));\n if (!font) continue;\n const key = `${font.Style}|${rule.Glyph}`;\n const kept = byGlyph.get(key);\n if (kept) {\n kept.Aliases = [...(kept.Aliases ?? []), rule.Name];\n continue;\n }\n const icon: FontAwesomeIcon = { Name: rule.Name, Style: font.Style };\n byGlyph.set(key, icon);\n out.push(icon);\n }\n return out;\n}\n\n/** How many icons the picker's grid draws at most; the rest are reached by searching. */\nexport const ICON_RESULT_LIMIT = 240;\n\n/**\n * Every icon matching a search, most relevant first: names that start with it, then names\n * that contain it. An icon matches by its name or by any of its aliases. An empty search\n * matches every icon.\n */\nexport function MatchIcons(icons: readonly FontAwesomeIcon[], search: string): FontAwesomeIcon[] {\n const needle = search.trim().toLowerCase().replace(/^fa-/, '');\n if (needle.length === 0) return [...icons];\n const starts: FontAwesomeIcon[] = [];\n const contains: FontAwesomeIcon[] = [];\n for (const icon of icons) {\n const names = [icon.Name, ...(icon.Aliases ?? [])];\n if (names.some((name) => name.startsWith(needle))) starts.push(icon);\n else if (names.some((name) => name.includes(needle))) contains.push(icon);\n }\n return [...starts, ...contains];\n}\n\n/** The first `limit` icons {@link MatchIcons} finds for a search. */\nexport function FilterIcons(icons: readonly FontAwesomeIcon[], search: string, limit = ICON_RESULT_LIMIT): FontAwesomeIcon[] {\n return MatchIcons(icons, search).slice(0, limit);\n}\n"]}
|