mn-angular-lib 1.0.27 → 1.0.28

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.
@@ -10,6 +10,7 @@ import { Validators, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule } from
10
10
  import * as i1$1 from '@angular/common/http';
11
11
  import { HttpClient, HttpErrorResponse, HttpStatusCode, HttpParams } from '@angular/common/http';
12
12
  import JSON5 from 'json5';
13
+ import { DomSanitizer } from '@angular/platform-browser';
13
14
 
14
15
  // projects/mn-angular-lib/src/lib/mn-mn-alert/mn-mn-alert.tokens.ts
15
16
  const MN_ALERT_CONFIG = new InjectionToken('MN_ALERT_CONFIG');
@@ -7601,6 +7602,114 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImpor
7601
7602
  type: Output
7602
7603
  }] } });
7603
7604
 
7605
+ const mnIconVariants = tv({
7606
+ base: 'inline-flex shrink-0',
7607
+ variants: {
7608
+ color: {
7609
+ current: 'text-current',
7610
+ primary: 'text-primary',
7611
+ secondary: 'text-neutral',
7612
+ danger: 'text-error',
7613
+ warning: 'text-warning',
7614
+ success: 'text-success',
7615
+ accent: 'text-accent',
7616
+ },
7617
+ },
7618
+ defaultVariants: {
7619
+ color: 'current',
7620
+ },
7621
+ });
7622
+
7623
+ class MnIconRegistry {
7624
+ icons = new Map();
7625
+ register(...icons) {
7626
+ for (const icon of icons) {
7627
+ this.icons.set(icon.name, icon.svg);
7628
+ }
7629
+ }
7630
+ get(name) {
7631
+ return this.icons.get(name);
7632
+ }
7633
+ has(name) {
7634
+ return this.icons.has(name);
7635
+ }
7636
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
7637
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconRegistry, providedIn: 'root' });
7638
+ }
7639
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIconRegistry, decorators: [{
7640
+ type: Injectable,
7641
+ args: [{ providedIn: 'root' }]
7642
+ }] });
7643
+ function mnIconDef(name, svg) {
7644
+ return { name, svg };
7645
+ }
7646
+
7647
+ const MN_ICON_MAP = {
7648
+ pistol: '<path d="M8.72 14.56 9 10h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4c2.5 0 1 4 1 4-4 6-1 6-1 6h3.38a1 1 0 0 0 .89-.55za1 1 0 0 1 .9-.56H13a2 2 0 0 0 2-2v-1a1 1 0 0 1 1-1" />',
7649
+ };
7650
+
7651
+ class MnIcon {
7652
+ data = {};
7653
+ mnIconPistol;
7654
+ sanitizer = inject(DomSanitizer);
7655
+ registry = inject(MnIconRegistry);
7656
+ el = inject(ElementRef);
7657
+ svgContent = '';
7658
+ get iconSize() {
7659
+ return this.data.size ?? 24;
7660
+ }
7661
+ get hostClasses() {
7662
+ return mnIconVariants({
7663
+ color: this.data.color,
7664
+ });
7665
+ }
7666
+ resolvedName = null;
7667
+ ngOnInit() {
7668
+ const attrs = this.el.nativeElement.attributes;
7669
+ for (let i = 0; i < attrs.length; i++) {
7670
+ const attr = attrs[i].name.toLowerCase();
7671
+ if (attr.startsWith('mnicon')) {
7672
+ const iconKey = attr.slice('mnicon'.length);
7673
+ for (const key of Object.keys(MN_ICON_MAP)) {
7674
+ if (key.toLowerCase() === iconKey) {
7675
+ this.resolvedName = key;
7676
+ break;
7677
+ }
7678
+ }
7679
+ if (this.resolvedName)
7680
+ break;
7681
+ }
7682
+ }
7683
+ this.updateContent();
7684
+ }
7685
+ ngOnChanges() {
7686
+ this.updateContent();
7687
+ }
7688
+ updateContent() {
7689
+ const name = this.data.name ?? this.resolvedName;
7690
+ if (name) {
7691
+ const raw = MN_ICON_MAP[name] ?? this.registry.get(name);
7692
+ this.svgContent = raw ? this.sanitizer.bypassSecurityTrustHtml(raw) : '';
7693
+ }
7694
+ else {
7695
+ this.svgContent = '';
7696
+ }
7697
+ }
7698
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
7699
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.3", type: MnIcon, isStandalone: true, selector: "mn-icon", inputs: { data: "data", mnIconPistol: "mnIconPistol" }, host: { properties: { "class": "this.hostClasses" } }, usesOnChanges: true, ngImport: i0, template: "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"iconSize\"\n [attr.height]=\"iconSize\"\n [attr.viewBox]=\"'0 0 24 24'\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n [innerHTML]=\"svgContent\"\n></svg>\n" });
7700
+ }
7701
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnIcon, decorators: [{
7702
+ type: Component,
7703
+ args: [{ selector: 'mn-icon', standalone: true, template: "<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n [attr.width]=\"iconSize\"\n [attr.height]=\"iconSize\"\n [attr.viewBox]=\"'0 0 24 24'\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n [innerHTML]=\"svgContent\"\n></svg>\n" }]
7704
+ }], propDecorators: { data: [{
7705
+ type: Input
7706
+ }], mnIconPistol: [{
7707
+ type: Input
7708
+ }], hostClasses: [{
7709
+ type: HostBinding,
7710
+ args: ['class']
7711
+ }] } });
7712
+
7604
7713
  /**
7605
7714
  * Injection token for the base URL used by all CRUD service requests.
7606
7715
  *
@@ -8003,5 +8112,5 @@ function enableMnPreviewMode(configService, langService, allowedOrigins) {
8003
8112
  * Generated bundle index. Do not edit.
8004
8113
  */
8005
8114
 
8006
- export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFormBodyComponent, MnHiddenBelowDirective, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
8115
+ export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFormBodyComponent, MnHiddenBelowDirective, MnIcon, MnIconRegistry, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnIconDef, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
8007
8116
  //# sourceMappingURL=mn-angular-lib.mjs.map