mn-angular-lib 1.0.179 → 2.0.1

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.
Files changed (40) hide show
  1. package/fesm2022/mn-angular-lib-alert.mjs +11 -10
  2. package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
  3. package/fesm2022/mn-angular-lib-bottom-sheet.mjs +15 -14
  4. package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
  5. package/fesm2022/mn-angular-lib-button.mjs +9 -9
  6. package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
  7. package/fesm2022/mn-angular-lib-calendar-core.mjs +6 -6
  8. package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
  9. package/fesm2022/mn-angular-lib-calendar.mjs +118 -81
  10. package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
  11. package/fesm2022/mn-angular-lib-collection.mjs +36 -28
  12. package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
  13. package/fesm2022/mn-angular-lib-core.mjs +17 -16
  14. package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
  15. package/fesm2022/mn-angular-lib-display.mjs +88 -45
  16. package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
  17. package/fesm2022/mn-angular-lib-forms.mjs +243 -99
  18. package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
  19. package/fesm2022/mn-angular-lib-keyboard.mjs +3 -3
  20. package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
  21. package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
  22. package/fesm2022/mn-angular-lib-modal-ui.mjs +158 -100
  23. package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
  24. package/fesm2022/mn-angular-lib-modal.mjs +3 -3
  25. package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
  26. package/fesm2022/mn-angular-lib-rich-text-editor.mjs +21 -12
  27. package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
  28. package/fesm2022/mn-angular-lib-segmented.mjs +3 -3
  29. package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
  30. package/fesm2022/mn-angular-lib-tab.mjs +14 -6
  31. package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
  32. package/package.json +4 -4
  33. package/types/mn-angular-lib-alert.d.ts +2 -2
  34. package/types/mn-angular-lib-calendar-core.d.ts +2 -2
  35. package/types/mn-angular-lib-calendar.d.ts +2 -0
  36. package/types/mn-angular-lib-core.d.ts +2 -2
  37. package/types/mn-angular-lib-display.d.ts +80 -3
  38. package/types/mn-angular-lib-forms.d.ts +10 -0
  39. package/types/mn-angular-lib-modal.d.ts +1 -1
  40. package/types/mn-angular-lib-tab.d.ts +7 -0
@@ -100,10 +100,10 @@ class MnModalService {
100
100
  }
101
101
  });
102
102
  }
103
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
104
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnModalService, providedIn: 'root' });
103
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
104
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnModalService, providedIn: 'root' });
105
105
  }
106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnModalService, decorators: [{
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnModalService, decorators: [{
107
107
  type: Injectable,
108
108
  args: [{
109
109
  providedIn: 'root',
@@ -1 +1 @@
1
- {"version":3,"file":"mn-angular-lib-modal.mjs","sources":["../../../projects/mn-angular-lib/modal/src/mn-modal/mn-modal.service.ts","../../../projects/mn-angular-lib/modal/public-api.ts","../../../projects/mn-angular-lib/modal/mn-angular-lib-modal.ts"],"sourcesContent":["import {ApplicationRef, ComponentRef, createComponent, EnvironmentInjector, inject, Injectable, Type,} from '@angular/core';\nimport {MnModalRef, ModalCloseReason, ModalConfig} from 'mn-angular-lib/modal-core';\nimport type {MnModalShellComponent} from 'mn-angular-lib/modal-ui';\n\n/** The modal components entry point, once loaded. */\ntype ModalUi = { MnModalShellComponent: Type<MnModalShellComponent<unknown>> };\n\n/** The loaded modal components, shared by every service instance. */\nlet modalUi: ModalUi | null = null;\n\n/** The in-flight or settled load of the modal components. */\nlet modalUiLoad: Promise<ModalUi> | null = null;\n\n/**\n * Loads `mn-angular-lib/modal-ui` once. The shell and its bodies render every form field and\n * the table, so importing them statically put most of the library into each consumer's\n * startup bundle just because a service injects `MnModalService`.\n * @returns The loaded entry point.\n */\nfunction loadModalUi(): Promise<ModalUi> {\n modalUiLoad ??= import('mn-angular-lib/modal-ui').then((ui) => (modalUi = ui));\n return modalUiLoad;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MnModalService {\n private readonly appRef = inject(ApplicationRef);\n private readonly injector = inject(EnvironmentInjector);\n private readonly modalStack: MnModalRef<unknown>[] = [];\n\n constructor() {\n // Fetch the modal components once the app is idle, so the first modal opens without a\n // network round trip while startup never waits for them.\n if (typeof window !== 'undefined') {\n const whenIdle = window.requestIdleCallback ?? ((callback: () => void) => setTimeout(callback, 2000));\n whenIdle(() => void this.preload().catch(() => undefined));\n }\n }\n\n /**\n * Loads the modal components ahead of the first `open()`. After it resolves, `open()` renders\n * synchronously; tests await it before asserting on the DOM.\n * @returns Resolves once the components are loaded.\n */\n preload(): Promise<void> {\n return loadModalUi().then(() => undefined);\n }\n\n open<TResult = unknown, TModel = unknown>(config: ModalConfig<TResult, TModel>): MnModalRef<TResult> {\n // Work off a mutable shallow copy of the (frozen) builder config, shared by\n // both the shell and the ref. `ModalBuilder.build()` returns a frozen object;\n // `MnModalRef.update()` mutates the config in place (so the shell, which holds\n // the same reference, sees the change), which would throw on a frozen object.\n // Cloning here keeps the caller's built config immutable while giving the\n // runtime an extensible object to update (e.g. footer actions set at runtime).\n const workingConfig = {...(config as ModalConfig<TResult>)};\n\n // The ref exists straight away so callers can subscribe and close as before; the shell\n // attaches to it as soon as the modal components are available (immediately once loaded).\n const modalRef = new MnModalRef<TResult>(null, workingConfig);\n\n if (modalUi) {\n this.render(modalUi, modalRef, workingConfig);\n } else {\n loadModalUi().then(\n (ui) => {\n if (!modalRef.isCloseRequested) this.render(ui, modalRef, workingConfig);\n },\n (error: unknown) => {\n console.error('[MnModal] Failed to load the modal components', error);\n modalRef.dismiss(ModalCloseReason.PROGRAMMATIC);\n },\n );\n }\n\n return modalRef;\n }\n\n /**\n * Creates the shell for a modal, stacks it on top of any open modal and attaches it to the app.\n * @param ui The loaded modal components.\n * @param modalRef The ref returned from `open()`.\n * @param workingConfig The mutable config shared by the ref and the shell.\n */\n private render<TResult>(ui: ModalUi, modalRef: MnModalRef<TResult>, workingConfig: ModalConfig<TResult>): void {\n const componentRef = createComponent(ui.MnModalShellComponent, {\n environmentInjector: this.injector,\n }) as unknown as ComponentRef<MnModalShellComponent<TResult>>;\n\n // TModel is erased at the shell boundary — the shell only needs TResult\n componentRef.instance.config = workingConfig;\n componentRef.instance.modalRef = modalRef;\n modalRef.attach(componentRef);\n\n // Update stack and dim previous modal\n if (this.modalStack.length > 0) {\n const prevModal = this.modalStack[this.modalStack.length - 1];\n (prevModal.component as MnModalShellComponent<unknown>).isStacked.set(true);\n }\n this.modalStack.push(modalRef as unknown as MnModalRef<unknown>);\n\n // Attach to application\n this.appRef.attachView(componentRef.hostView);\n const domElem = componentRef.location.nativeElement;\n document.body.appendChild(domElem);\n\n // Clean up on close\n modalRef.afterClosed$.subscribe(() => {\n this.appRef.detachView(componentRef.hostView);\n domElem.remove();\n\n // Update stack\n const index = this.modalStack.indexOf(modalRef as unknown as MnModalRef<unknown>);\n if (index > -1) {\n this.modalStack.splice(index, 1);\n if (this.modalStack.length > 0) {\n const topModal = this.modalStack[this.modalStack.length - 1];\n (topModal.component as MnModalShellComponent<unknown>).isStacked.set(false);\n }\n }\n });\n }\n}\n","/**\n * Public API of the `mn-angular-lib/modal` entry point: the modal service.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport { MnModalService } from './src/mn-modal/mn-modal.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAOA;AACA,IAAI,OAAO,GAAmB,IAAI;AAElC;AACA,IAAI,WAAW,GAA4B,IAAI;AAE/C;;;;;AAKG;AACH,SAAS,WAAW,GAAA;AAClB,IAAA,WAAW,KAAK,OAAO,yBAAyB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC;AAC9E,IAAA,OAAO,WAAW;AACpB;MAKa,cAAc,CAAA;AACR,IAAA,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC;AAC/B,IAAA,QAAQ,GAAG,MAAM,CAAC,mBAAmB,CAAC;IACtC,UAAU,GAA0B,EAAE;AAEvD,IAAA,WAAA,GAAA;;;AAGE,QAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,YAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,mBAAmB,KAAK,CAAC,QAAoB,KAAK,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACrG,YAAA,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,SAAS,CAAC,CAAC;QAC5D;IACF;AAEA;;;;AAIG;IACH,OAAO,GAAA;QACL,OAAO,WAAW,EAAE,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC;IAC5C;AAEA,IAAA,IAAI,CAAsC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1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC1BD;;;;;;AAMG;;ACNH;;AAEG;;;;"}
1
+ {"version":3,"file":"mn-angular-lib-modal.mjs","sources":["../../../projects/mn-angular-lib/modal/src/mn-modal/mn-modal.service.ts","../../../projects/mn-angular-lib/modal/public-api.ts","../../../projects/mn-angular-lib/modal/mn-angular-lib-modal.ts"],"sourcesContent":["import {ApplicationRef, ComponentRef, createComponent, EnvironmentInjector, inject, Injectable, Type,} from '@angular/core';\nimport {MnModalRef, ModalCloseReason, ModalConfig} from 'mn-angular-lib/modal-core';\nimport type {MnModalShellComponent} from 'mn-angular-lib/modal-ui';\n\n/** The modal components entry point, once loaded. */\ntype ModalUi = { MnModalShellComponent: Type<MnModalShellComponent<unknown>> };\n\n/** The loaded modal components, shared by every service instance. */\nlet modalUi: ModalUi | null = null;\n\n/** The in-flight or settled load of the modal components. */\nlet modalUiLoad: Promise<ModalUi> | null = null;\n\n/**\n * Loads `mn-angular-lib/modal-ui` once. The shell and its bodies render every form field and\n * the table, so importing them statically put most of the library into each consumer's\n * startup bundle just because a service injects `MnModalService`.\n * @returns The loaded entry point.\n */\nfunction loadModalUi(): Promise<ModalUi> {\n modalUiLoad ??= import('mn-angular-lib/modal-ui').then((ui) => (modalUi = ui));\n return modalUiLoad;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class MnModalService {\n private readonly appRef = inject(ApplicationRef);\n private readonly injector = inject(EnvironmentInjector);\n private readonly modalStack: MnModalRef<unknown>[] = [];\n\n constructor() {\n // Fetch the modal components once the app is idle, so the first modal opens without a\n // network round trip while startup never waits for them.\n if (typeof window !== 'undefined') {\n const whenIdle = window.requestIdleCallback ?? ((callback: () => void) => setTimeout(callback, 2000));\n whenIdle(() => void this.preload().catch(() => undefined));\n }\n }\n\n /**\n * Loads the modal components ahead of the first `open()`. After it resolves, `open()` renders\n * synchronously; tests await it before asserting on the DOM.\n * @returns Resolves once the components are loaded.\n */\n preload(): Promise<void> {\n return loadModalUi().then(() => undefined);\n }\n\n open<TResult = unknown, TModel = unknown>(config: ModalConfig<TResult, TModel>): MnModalRef<TResult> {\n // Work off a mutable shallow copy of the (frozen) builder config, shared by\n // both the shell and the ref. `ModalBuilder.build()` returns a frozen object;\n // `MnModalRef.update()` mutates the config in place (so the shell, which holds\n // the same reference, sees the change), which would throw on a frozen object.\n // Cloning here keeps the caller's built config immutable while giving the\n // runtime an extensible object to update (e.g. footer actions set at runtime).\n const workingConfig = {...(config as ModalConfig<TResult>)};\n\n // The ref exists straight away so callers can subscribe and close as before; the shell\n // attaches to it as soon as the modal components are available (immediately once loaded).\n const modalRef = new MnModalRef<TResult>(null, workingConfig);\n\n if (modalUi) {\n this.render(modalUi, modalRef, workingConfig);\n } else {\n loadModalUi().then(\n (ui) => {\n if (!modalRef.isCloseRequested) this.render(ui, modalRef, workingConfig);\n },\n (error: unknown) => {\n console.error('[MnModal] Failed to load the modal components', error);\n modalRef.dismiss(ModalCloseReason.PROGRAMMATIC);\n },\n );\n }\n\n return modalRef;\n }\n\n /**\n * Creates the shell for a modal, stacks it on top of any open modal and attaches it to the app.\n * @param ui The loaded modal components.\n * @param modalRef The ref returned from `open()`.\n * @param workingConfig The mutable config shared by the ref and the shell.\n */\n private render<TResult>(ui: ModalUi, modalRef: MnModalRef<TResult>, workingConfig: ModalConfig<TResult>): void {\n const componentRef = createComponent(ui.MnModalShellComponent, {\n environmentInjector: this.injector,\n }) as unknown as ComponentRef<MnModalShellComponent<TResult>>;\n\n // TModel is erased at the shell boundary — the shell only needs TResult\n componentRef.instance.config = workingConfig;\n componentRef.instance.modalRef = modalRef;\n modalRef.attach(componentRef);\n\n // Update stack and dim previous modal\n if (this.modalStack.length > 0) {\n const prevModal = this.modalStack[this.modalStack.length - 1];\n (prevModal.component as MnModalShellComponent<unknown>).isStacked.set(true);\n }\n this.modalStack.push(modalRef as unknown as MnModalRef<unknown>);\n\n // Attach to application\n this.appRef.attachView(componentRef.hostView);\n const domElem = componentRef.location.nativeElement;\n document.body.appendChild(domElem);\n\n // Clean up on close\n modalRef.afterClosed$.subscribe(() => {\n this.appRef.detachView(componentRef.hostView);\n domElem.remove();\n\n // Update stack\n const index = this.modalStack.indexOf(modalRef as unknown as MnModalRef<unknown>);\n if (index > -1) {\n this.modalStack.splice(index, 1);\n if (this.modalStack.length > 0) {\n const topModal = this.modalStack[this.modalStack.length - 1];\n (topModal.component as MnModalShellComponent<unknown>).isStacked.set(false);\n }\n }\n });\n }\n}\n","/**\n * Public API of the `mn-angular-lib/modal` entry point: the modal service.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport { MnModalService } from './src/mn-modal/mn-modal.service';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAOA;AACA,IAAI,OAAO,GAAmB,IAAI;AAElC;AACA,IAAI,WAAW,GAA4B,IAAI;AAE/C;;;;;AAKG;AACH,SAAS,WAAW,GAAA;AAClB,IAAA,WAAW,KAAK,OAAO,yBAAyB,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC;AAC9E,IAAA,OAAO,WAAW;AACpB;MAKa,cAAc,CAAA;AACR,IAAA,MAAM,GAAG,MAAM,CAAC,cAAc,CAAC;AAC/B,IAAA,QAAQ,GAAG,MAAM,CAAC,mBAAmB,CAAC;IACtC,UAAU,GAA0B,EAAE;AAEvD,IAAA,WAAA,GAAA;;;AAGE,QAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACjC,YAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,mBAAmB,KAAK,CAAC,QAAoB,KAAK,UAAU,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACrG,YAAA,QAAQ,CAAC,MAAM,KAAK,IAAI,CA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AA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cAFb,MAAM,EAAA,CAAA;;2FAEP,cAAc,EAAA,UAAA,EAAA,CAAA;kBAH1B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;AC1BD;;;;;;AAMG;;ACNH;;AAEG;;"}
@@ -90,22 +90,29 @@ class MnRichTextEditor {
90
90
  * from what the editor currently holds, so a parent echoing the emitted value
91
91
  * back never moves the caret.
92
92
  */
93
- content = input('', ...(ngDevMode ? [{ debugName: "content" }] : []));
93
+ content = input('', /* @ts-ignore */
94
+ ...(ngDevMode ? [{ debugName: "content" }] : /* istanbul ignore next */ []));
94
95
  /** Placeholder shown while the editor is empty. */
95
- placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
96
+ placeholder = input('', /* @ts-ignore */
97
+ ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
96
98
  /** Accessible label for the editing surface. */
97
- ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
99
+ ariaLabel = input('', /* @ts-ignore */
100
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
98
101
  /** Toolbar layout, in Quill's own format. Defaults to a prose-oriented set. */
99
- toolbar = input(DEFAULT_TOOLBAR, ...(ngDevMode ? [{ debugName: "toolbar" }] : []));
102
+ toolbar = input(DEFAULT_TOOLBAR, /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "toolbar" }] : /* istanbul ignore next */ []));
100
104
  /** Literal hover labels per toolbar control. */
101
- labels = input({}, ...(ngDevMode ? [{ debugName: "labels" }] : []));
105
+ labels = input({}, /* @ts-ignore */
106
+ ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
102
107
  /** Translation keys per toolbar control; takes precedence over `labels`. */
103
- labelKeys = input({}, ...(ngDevMode ? [{ debugName: "labelKeys" }] : []));
108
+ labelKeys = input({}, /* @ts-ignore */
109
+ ...(ngDevMode ? [{ debugName: "labelKeys" }] : /* istanbul ignore next */ []));
104
110
  /**
105
111
  * Utilities applied to the wrapper, for sizing the writing surface. Overriding
106
112
  * this replaces the default height limits, so pass both bounds when you do.
107
113
  */
108
- editorClass = input('[&_.ql-editor]:max-h-104 [&_.ql-editor]:min-h-72 [&_.ql-editor]:overflow-y-auto', ...(ngDevMode ? [{ debugName: "editorClass" }] : []));
114
+ editorClass = input('[&_.ql-editor]:max-h-104 [&_.ql-editor]:min-h-72 [&_.ql-editor]:overflow-y-auto', /* @ts-ignore */
115
+ ...(ngDevMode ? [{ debugName: "editorClass" }] : /* istanbul ignore next */ []));
109
116
  /** Emits the editor's HTML on every user edit. */
110
117
  contentChange = output();
111
118
  /**
@@ -124,13 +131,15 @@ class MnRichTextEditor {
124
131
  /** Language service, used to resolve the toolbar labels from keys. */
125
132
  lang = inject(MnLanguageService);
126
133
  /** The container Quill mounts into. */
127
- editorHost = viewChild.required('editorHost');
134
+ editorHost = viewChild.required('editorHost', /* @ts-ignore */
135
+ ...(ngDevMode ? [{ debugName: "editorHost" }] : /* istanbul ignore next */ []));
128
136
  /** The live editor instance, or null before Quill has loaded. */
129
137
  quill = null;
130
138
  /** Whether the component is gone, so a late Quill load knows to stop. */
131
139
  destroyed = false;
132
140
  /** The last HTML this component emitted, used to skip redundant writes. */
133
- lastEmitted = signal('', ...(ngDevMode ? [{ debugName: "lastEmitted" }] : []));
141
+ lastEmitted = signal('', /* @ts-ignore */
142
+ ...(ngDevMode ? [{ debugName: "lastEmitted" }] : /* istanbul ignore next */ []));
134
143
  constructor() {
135
144
  afterNextRender(() => void this.createEditor());
136
145
  // Push a changed `content` input into a live editor. `lastEmitted` is read
@@ -251,10 +260,10 @@ class MnRichTextEditor {
251
260
  const html = this.quill.root.innerHTML;
252
261
  return html === EMPTY_DOCUMENT ? '' : html;
253
262
  }
254
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnRichTextEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
255
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.1.3", type: MnRichTextEditor, isStandalone: true, selector: "mn-rich-text-editor", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, labelKeys: { classPropertyName: "labelKeys", publicName: "labelKeys", isSignal: true, isRequired: false, transformFunction: null }, editorClass: { classPropertyName: "editorClass", publicName: "editorClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentChange: "contentChange" }, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"mn-rich-text-editor {{ chromeClass }} {{ editorClass() }}\">\n <div #editorHost></div>\n</div>\n", styles: [".mn-rich-text-editor .mn-rte-tooltip{position:relative}.mn-rich-text-editor .mn-rte-tooltip[data-tip]:after{content:attr(data-tip);position:absolute;bottom:100%;left:50%;translate:-50% -.375rem;padding:.25rem .5rem;border-radius:.375rem;background-color:var(--color-secondary);color:var(--color-secondary-content);font-size:.75rem;line-height:1rem;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s;z-index:50}.mn-rich-text-editor .mn-rte-tooltip[data-tip]:hover:after,.mn-rich-text-editor .mn-rte-tooltip[data-tip]:focus-visible:after{opacity:1}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
263
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnRichTextEditor, deps: [], target: i0.ɵɵFactoryTarget.Component });
264
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.7", type: MnRichTextEditor, isStandalone: true, selector: "mn-rich-text-editor", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, toolbar: { classPropertyName: "toolbar", publicName: "toolbar", isSignal: true, isRequired: false, transformFunction: null }, labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, labelKeys: { classPropertyName: "labelKeys", publicName: "labelKeys", isSignal: true, isRequired: false, transformFunction: null }, editorClass: { classPropertyName: "editorClass", publicName: "editorClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { contentChange: "contentChange" }, viewQueries: [{ propertyName: "editorHost", first: true, predicate: ["editorHost"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"mn-rich-text-editor {{ chromeClass }} {{ editorClass() }}\">\n <div #editorHost></div>\n</div>\n", styles: [".mn-rich-text-editor .mn-rte-tooltip{position:relative}.mn-rich-text-editor .mn-rte-tooltip[data-tip]:after{content:attr(data-tip);position:absolute;bottom:100%;left:50%;translate:-50% -.375rem;padding:.25rem .5rem;border-radius:.375rem;background-color:var(--color-secondary);color:var(--color-secondary-content);font-size:.75rem;line-height:1rem;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s;z-index:50}.mn-rich-text-editor .mn-rte-tooltip[data-tip]:hover:after,.mn-rich-text-editor .mn-rte-tooltip[data-tip]:focus-visible:after{opacity:1}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
256
265
  }
257
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnRichTextEditor, decorators: [{
266
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnRichTextEditor, decorators: [{
258
267
  type: Component,
259
268
  args: [{ selector: 'mn-rich-text-editor', standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mn-rich-text-editor {{ chromeClass }} {{ editorClass() }}\">\n <div #editorHost></div>\n</div>\n", styles: [".mn-rich-text-editor .mn-rte-tooltip{position:relative}.mn-rich-text-editor .mn-rte-tooltip[data-tip]:after{content:attr(data-tip);position:absolute;bottom:100%;left:50%;translate:-50% -.375rem;padding:.25rem .5rem;border-radius:.375rem;background-color:var(--color-secondary);color:var(--color-secondary-content);font-size:.75rem;line-height:1rem;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s;z-index:50}.mn-rich-text-editor .mn-rte-tooltip[data-tip]:hover:after,.mn-rich-text-editor .mn-rte-tooltip[data-tip]:focus-visible:after{opacity:1}\n"] }]
260
269
  }], ctorParameters: () => [], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], toolbar: [{ type: i0.Input, args: [{ isSignal: true, alias: "toolbar", required: false }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], labelKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelKeys", required: false }] }], editorClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "editorClass", required: false }] }], contentChange: [{ type: i0.Output, args: ["contentChange"] }], editorHost: [{ type: i0.ViewChild, args: ['editorHost', { isSignal: true }] }] } });
@@ -1 +1 @@
1
- {"version":3,"file":"mn-angular-lib-rich-text-editor.mjs","sources":["../../../projects/mn-angular-lib/rich-text-editor/src/mn-rich-text-editor/mn-rich-text-editor.component.ts","../../../projects/mn-angular-lib/rich-text-editor/src/mn-rich-text-editor/mn-rich-text-editor.component.html","../../../projects/mn-angular-lib/rich-text-editor/public-api.ts","../../../projects/mn-angular-lib/rich-text-editor/mn-angular-lib-rich-text-editor.ts"],"sourcesContent":["import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n inject,\n input,\n OnDestroy,\n output,\n signal,\n untracked,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type Quill from 'quill';\nimport {MnLanguageService} from 'mn-angular-lib/core';\nimport {MnRichTextEditorControl, MnRichTextEditorLabels, MnRichTextEditorToolbar,} from './mn-rich-text-editor.types';\n\n/**\n * Toolbar the editor renders when the consumer does not supply one. Deliberately\n * small: it covers written prose, so there is no colour picker, no font picker\n * and no image embedding (an image needs an upload and storage path the editor\n * knows nothing about).\n */\nconst DEFAULT_TOOLBAR: MnRichTextEditorToolbar = [\n [{header: [2, 3, false]}],\n ['bold', 'italic', 'underline', 'strike'],\n [{list: 'ordered'}, {list: 'bullet'}],\n ['blockquote', 'code-block'],\n ['link'],\n ['clean'],\n];\n\n/** Where each control sits in the toolbar Quill builds. */\nconst CONTROL_SELECTORS: Record<MnRichTextEditorControl, string> = {\n textStyle: '.ql-header .ql-picker-label',\n bold: 'button.ql-bold',\n italic: 'button.ql-italic',\n underline: 'button.ql-underline',\n strike: 'button.ql-strike',\n orderedList: 'button.ql-list[value=\"ordered\"]',\n bulletList: 'button.ql-list[value=\"bullet\"]',\n blockquote: 'button.ql-blockquote',\n codeBlock: 'button.ql-code-block',\n link: 'button.ql-link',\n clean: 'button.ql-clean',\n};\n\n/** Hover labels used when the consumer supplies neither a label nor a key. */\nconst DEFAULT_LABELS: Record<MnRichTextEditorControl, string> = {\n textStyle: 'Text style',\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strike: 'Strikethrough',\n orderedList: 'Numbered list',\n bulletList: 'Bulleted list',\n blockquote: 'Quote',\n codeBlock: 'Code block',\n link: 'Link',\n clean: 'Clear formatting',\n};\n\n/** Quill's document when it holds no text; treated as an empty value. */\nconst EMPTY_DOCUMENT = '<p><br></p>';\n\n/**\n * Thin wrapper around the {@link Quill} rich-text editor.\n *\n * Quill is used **directly** rather than through an Angular wrapper package: the\n * wrapper libraries carry peer-dependency ranges that lag behind Angular's\n * release train, and none of them add anything this component needs.\n *\n * Consumers must install `quill` themselves (it is an optional peer dependency)\n * and load its snow theme, e.g. `node_modules/quill/dist/quill.snow.css` in the\n * `styles` array of `angular.json`. Only the chrome around that theme — radius,\n * borders, height limits and the toolbar tooltips — belongs to this component;\n * recolouring Quill's own palette to an app theme stays with the app, because\n * the same `.ql-snow` markup is normally reused to render stored HTML in places\n * where no editor is mounted.\n *\n * Quill itself is pulled in with a dynamic `import()` when the editor mounts.\n * This component sits in the library's single entry point, which apps import\n * eagerly, so a static import would put the whole editor engine in every app's\n * initial bundle — including the pages that never open one.\n *\n * Zoneless notes: nothing here relies on an implicit change-detection tick. The\n * editor is created inside {@link afterNextRender} (the host element only exists\n * after the first render pass) and every value that flows back out is written to\n * a signal or emitted through an `output`, both of which schedule change\n * detection themselves. No `setTimeout`, no manual `detectChanges`.\n *\n * The produced HTML is **not** trusted: sanitise it before rendering it anywhere.\n *\n * @example\n * ```html\n * <mn-rich-text-editor\n * [content]=\"draft()\"\n * [placeholder]=\"'minutes.placeholder' | mnTranslate\"\n * [labelKeys]=\"{ bold: 'editor.bold', italic: 'editor.italic' }\"\n * (contentChange)=\"draft.set($event)\">\n * </mn-rich-text-editor>\n * ```\n */\n@Component({\n selector: 'mn-rich-text-editor',\n standalone: true,\n templateUrl: './mn-rich-text-editor.component.html',\n styleUrl: './mn-rich-text-editor.component.css',\n // Quill builds its DOM at runtime, so those elements never carry Angular's\n // scoping attribute and an encapsulated stylesheet could never reach them.\n // Every rule in the stylesheet is scoped by `.mn-rich-text-editor` instead.\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MnRichTextEditor implements OnDestroy {\n /**\n * The initial HTML content. Later changes are applied only when they differ\n * from what the editor currently holds, so a parent echoing the emitted value\n * back never moves the caret.\n */\n public readonly content = input<string>('');\n /** Placeholder shown while the editor is empty. */\n public readonly placeholder = input<string>('');\n /** Accessible label for the editing surface. */\n public readonly ariaLabel = input<string>('');\n /** Toolbar layout, in Quill's own format. Defaults to a prose-oriented set. */\n public readonly toolbar = input<MnRichTextEditorToolbar>(DEFAULT_TOOLBAR);\n /** Literal hover labels per toolbar control. */\n public readonly labels = input<MnRichTextEditorLabels>({});\n /** Translation keys per toolbar control; takes precedence over `labels`. */\n public readonly labelKeys = input<MnRichTextEditorLabels>({});\n /**\n * Utilities applied to the wrapper, for sizing the writing surface. Overriding\n * this replaces the default height limits, so pass both bounds when you do.\n */\n public readonly editorClass = input<string>(\n '[&_.ql-editor]:max-h-104 [&_.ql-editor]:min-h-72 [&_.ql-editor]:overflow-y-auto',\n );\n /** Emits the editor's HTML on every user edit. */\n public readonly contentChange = output<string>();\n /**\n * Chrome around Quill's snow theme: the field's radius, border and surface.\n *\n * Descendant variants rather than a stylesheet — the utilities come from the\n * consuming app's Tailwind build (which scans this bundle), so they follow the\n * app's theme tokens the same way the rest of the library does.\n */\n protected readonly chromeClass =\n '[&_.ql-container.ql-snow]:rounded-b-xl [&_.ql-container.ql-snow]:border-base-300 ' +\n '[&_.ql-container.ql-snow]:bg-base-100 [&_.ql-container.ql-snow]:text-base ' +\n '[&_.ql-toolbar.ql-snow]:rounded-t-xl [&_.ql-toolbar.ql-snow]:border-base-300 ' +\n '[&_.ql-toolbar.ql-snow]:bg-base-100';\n /** Host element, used to keep DOM queries inside this component. */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** Language service, used to resolve the toolbar labels from keys. */\n private readonly lang = inject(MnLanguageService);\n /** The container Quill mounts into. */\n private readonly editorHost = viewChild.required<ElementRef<HTMLElement>>('editorHost');\n /** The live editor instance, or null before Quill has loaded. */\n private quill: Quill | null = null;\n\n /** Whether the component is gone, so a late Quill load knows to stop. */\n private destroyed = false;\n\n /** The last HTML this component emitted, used to skip redundant writes. */\n private readonly lastEmitted = signal<string>('');\n\n constructor() {\n afterNextRender(() => void this.createEditor());\n // Push a changed `content` input into a live editor. `lastEmitted` is read\n // `untracked` on purpose: it must gate the write (skip when the incoming HTML\n // already matches what we hold) WITHOUT making the effect depend on it. If it\n // were tracked, every keystroke (which updates `lastEmitted`) would re-run the\n // effect and re-paste the now-stale `content` seed — wiping the user's typing\n // and resetting the caret after any wholesale reseed.\n effect(() => {\n const incoming = this.content();\n if (!this.quill || incoming === untracked(this.lastEmitted)) return;\n this.setEditorHtml(incoming);\n });\n }\n\n /** Drops the editor reference so the instance can be garbage collected. */\n ngOnDestroy(): void {\n this.destroyed = true;\n this.quill = null;\n }\n\n /** Moves focus into the editing surface. */\n public focusEditor(): void {\n this.quill?.focus();\n if (!this.quill) {\n this.host.nativeElement.querySelector<HTMLElement>('.ql-editor')?.focus();\n }\n }\n\n /**\n * Loads Quill, builds the instance and wires its change handler.\n *\n * Nothing awaits this beyond the component itself: the surface appears once\n * the engine has loaded, and until then the `content` effect is a no-op that\n * the seeding below makes good.\n */\n private async createEditor(): Promise<void> {\n const {default: QuillEditor} = await import('quill');\n if (this.destroyed) return;\n const container = this.editorHost().nativeElement;\n this.quill = new QuillEditor(container, {\n theme: 'snow',\n placeholder: this.placeholder(),\n modules: {toolbar: this.toolbar() as unknown[]},\n });\n const label = this.ariaLabel();\n if (label) {\n this.quill.root.setAttribute('aria-label', label);\n }\n this.applyToolbarLabels();\n this.setEditorHtml(this.content());\n this.quill.on('text-change', () => this.emitCurrentHtml());\n }\n\n /**\n * Gives each toolbar control a hover label, so hovering explains what the\n * style does. Set on the Quill-generated DOM after init; a control the current\n * toolbar does not render is simply skipped.\n */\n private applyToolbarLabels(): void {\n const toolbar = this.host.nativeElement.querySelector('.ql-toolbar');\n if (!toolbar) return;\n const labels = this.labels();\n const keys = this.labelKeys();\n for (const [control, selector] of Object.entries(CONTROL_SELECTORS)) {\n const element = toolbar.querySelector(selector);\n if (!element) continue;\n element.classList.add('mn-rte-tooltip');\n element.setAttribute(\n 'data-tip',\n this.resolveLabel(control as MnRichTextEditorControl, labels, keys),\n );\n }\n }\n\n /**\n * Picks the hover label for one control.\n * @param control The control being labelled.\n * @param labels Literal labels supplied by the consumer.\n * @param keys Translation keys supplied by the consumer.\n * @returns The translated key, the literal label, or the built-in default.\n */\n private resolveLabel(\n control: MnRichTextEditorControl,\n labels: MnRichTextEditorLabels,\n keys: MnRichTextEditorLabels,\n ): string {\n const key = keys[control];\n if (key) {\n // `t()` echoes the key back when the consumer has no translation for it;\n // that is a miss, not a label, so fall through to the remaining sources.\n const translated = this.lang.t(key);\n if (translated !== key) return translated;\n }\n return labels[control] ?? DEFAULT_LABELS[control];\n }\n\n /**\n * Replaces the editor content with stored HTML. Quill parses it into its own\n * document model, which silently drops anything it has no format for — a\n * useful extra filter on top of the consumer's sanitiser.\n * @param html The HTML to load into the editor.\n */\n private setEditorHtml(html: string): void {\n if (!this.quill) return;\n // `dangerouslyPasteHTML` is Quill's documented name for \"parse this HTML\".\n this.quill.clipboard.dangerouslyPasteHTML(html ?? '', 'silent');\n this.lastEmitted.set(this.readHtml());\n }\n\n /** Emits the editor's current HTML, normalising Quill's \"empty\" document. */\n private emitCurrentHtml(): void {\n const html = this.readHtml();\n this.lastEmitted.set(html);\n this.contentChange.emit(html);\n }\n\n /**\n * Reads the editor's HTML.\n * @returns The current HTML, or an empty string when the editor is blank.\n */\n private readHtml(): string {\n if (!this.quill) return '';\n // Quill leaves an empty paragraph behind after a clear; treat that as empty\n // so an untouched editor does not count as authored content.\n const html = this.quill.root.innerHTML;\n return html === EMPTY_DOCUMENT ? '' : html;\n }\n}\n","<div class=\"mn-rich-text-editor {{ chromeClass }} {{ editorClass() }}\">\n <div #editorHost></div>\n</div>\n","/**\n * Public API of the `mn-angular-lib/rich-text-editor` entry point: the rich-text editor.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/mn-rich-text-editor';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAmBA;;;;;AAKG;AACH,MAAM,eAAe,GAA4B;IAC/C,CAAC,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAC,CAAC;AACzB,IAAA,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC;IACzC,CAAC,EAAC,IAAI,EAAE,SAAS,EAAC,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;IACrC,CAAC,YAAY,EAAE,YAAY,CAAC;AAC5B,IAAA,CAAC,MAAM,CAAC;AACR,IAAA,CAAC,OAAO,CAAC;CACV;AAED;AACA,MAAM,iBAAiB,GAA4C;AACjE,IAAA,SAAS,EAAE,6BAA6B;AACxC,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,MAAM,EAAE,kBAAkB;AAC1B,IAAA,SAAS,EAAE,qBAAqB;AAChC,IAAA,MAAM,EAAE,kBAAkB;AAC1B,IAAA,WAAW,EAAE,iCAAiC;AAC9C,IAAA,UAAU,EAAE,gCAAgC;AAC5C,IAAA,UAAU,EAAE,sBAAsB;AAClC,IAAA,SAAS,EAAE,sBAAsB;AACjC,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,KAAK,EAAE,iBAAiB;CACzB;AAED;AACA,MAAM,cAAc,GAA4C;AAC9D,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,SAAS,EAAE,WAAW;AAC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,QAAA,EAAA,gHAAA,EAAA,MAAA,EAAA,CAAA,4jBAAA,CAAA,EAAA;y0BA6C2B,YAAY,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE/JxF;;;;;;AAMG;;ACNH;;AAEG;;;;"}
1
+ {"version":3,"file":"mn-angular-lib-rich-text-editor.mjs","sources":["../../../projects/mn-angular-lib/rich-text-editor/src/mn-rich-text-editor/mn-rich-text-editor.component.ts","../../../projects/mn-angular-lib/rich-text-editor/src/mn-rich-text-editor/mn-rich-text-editor.component.html","../../../projects/mn-angular-lib/rich-text-editor/public-api.ts","../../../projects/mn-angular-lib/rich-text-editor/mn-angular-lib-rich-text-editor.ts"],"sourcesContent":["import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n effect,\n ElementRef,\n inject,\n input,\n OnDestroy,\n output,\n signal,\n untracked,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type Quill from 'quill';\nimport {MnLanguageService} from 'mn-angular-lib/core';\nimport {MnRichTextEditorControl, MnRichTextEditorLabels, MnRichTextEditorToolbar,} from './mn-rich-text-editor.types';\n\n/**\n * Toolbar the editor renders when the consumer does not supply one. Deliberately\n * small: it covers written prose, so there is no colour picker, no font picker\n * and no image embedding (an image needs an upload and storage path the editor\n * knows nothing about).\n */\nconst DEFAULT_TOOLBAR: MnRichTextEditorToolbar = [\n [{header: [2, 3, false]}],\n ['bold', 'italic', 'underline', 'strike'],\n [{list: 'ordered'}, {list: 'bullet'}],\n ['blockquote', 'code-block'],\n ['link'],\n ['clean'],\n];\n\n/** Where each control sits in the toolbar Quill builds. */\nconst CONTROL_SELECTORS: Record<MnRichTextEditorControl, string> = {\n textStyle: '.ql-header .ql-picker-label',\n bold: 'button.ql-bold',\n italic: 'button.ql-italic',\n underline: 'button.ql-underline',\n strike: 'button.ql-strike',\n orderedList: 'button.ql-list[value=\"ordered\"]',\n bulletList: 'button.ql-list[value=\"bullet\"]',\n blockquote: 'button.ql-blockquote',\n codeBlock: 'button.ql-code-block',\n link: 'button.ql-link',\n clean: 'button.ql-clean',\n};\n\n/** Hover labels used when the consumer supplies neither a label nor a key. */\nconst DEFAULT_LABELS: Record<MnRichTextEditorControl, string> = {\n textStyle: 'Text style',\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strike: 'Strikethrough',\n orderedList: 'Numbered list',\n bulletList: 'Bulleted list',\n blockquote: 'Quote',\n codeBlock: 'Code block',\n link: 'Link',\n clean: 'Clear formatting',\n};\n\n/** Quill's document when it holds no text; treated as an empty value. */\nconst EMPTY_DOCUMENT = '<p><br></p>';\n\n/**\n * Thin wrapper around the {@link Quill} rich-text editor.\n *\n * Quill is used **directly** rather than through an Angular wrapper package: the\n * wrapper libraries carry peer-dependency ranges that lag behind Angular's\n * release train, and none of them add anything this component needs.\n *\n * Consumers must install `quill` themselves (it is an optional peer dependency)\n * and load its snow theme, e.g. `node_modules/quill/dist/quill.snow.css` in the\n * `styles` array of `angular.json`. Only the chrome around that theme — radius,\n * borders, height limits and the toolbar tooltips — belongs to this component;\n * recolouring Quill's own palette to an app theme stays with the app, because\n * the same `.ql-snow` markup is normally reused to render stored HTML in places\n * where no editor is mounted.\n *\n * Quill itself is pulled in with a dynamic `import()` when the editor mounts.\n * This component sits in the library's single entry point, which apps import\n * eagerly, so a static import would put the whole editor engine in every app's\n * initial bundle — including the pages that never open one.\n *\n * Zoneless notes: nothing here relies on an implicit change-detection tick. The\n * editor is created inside {@link afterNextRender} (the host element only exists\n * after the first render pass) and every value that flows back out is written to\n * a signal or emitted through an `output`, both of which schedule change\n * detection themselves. No `setTimeout`, no manual `detectChanges`.\n *\n * The produced HTML is **not** trusted: sanitise it before rendering it anywhere.\n *\n * @example\n * ```html\n * <mn-rich-text-editor\n * [content]=\"draft()\"\n * [placeholder]=\"'minutes.placeholder' | mnTranslate\"\n * [labelKeys]=\"{ bold: 'editor.bold', italic: 'editor.italic' }\"\n * (contentChange)=\"draft.set($event)\">\n * </mn-rich-text-editor>\n * ```\n */\n@Component({\n selector: 'mn-rich-text-editor',\n standalone: true,\n templateUrl: './mn-rich-text-editor.component.html',\n styleUrl: './mn-rich-text-editor.component.css',\n // Quill builds its DOM at runtime, so those elements never carry Angular's\n // scoping attribute and an encapsulated stylesheet could never reach them.\n // Every rule in the stylesheet is scoped by `.mn-rich-text-editor` instead.\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MnRichTextEditor implements OnDestroy {\n /**\n * The initial HTML content. Later changes are applied only when they differ\n * from what the editor currently holds, so a parent echoing the emitted value\n * back never moves the caret.\n */\n public readonly content = input<string>('');\n /** Placeholder shown while the editor is empty. */\n public readonly placeholder = input<string>('');\n /** Accessible label for the editing surface. */\n public readonly ariaLabel = input<string>('');\n /** Toolbar layout, in Quill's own format. Defaults to a prose-oriented set. */\n public readonly toolbar = input<MnRichTextEditorToolbar>(DEFAULT_TOOLBAR);\n /** Literal hover labels per toolbar control. */\n public readonly labels = input<MnRichTextEditorLabels>({});\n /** Translation keys per toolbar control; takes precedence over `labels`. */\n public readonly labelKeys = input<MnRichTextEditorLabels>({});\n /**\n * Utilities applied to the wrapper, for sizing the writing surface. Overriding\n * this replaces the default height limits, so pass both bounds when you do.\n */\n public readonly editorClass = input<string>(\n '[&_.ql-editor]:max-h-104 [&_.ql-editor]:min-h-72 [&_.ql-editor]:overflow-y-auto',\n );\n /** Emits the editor's HTML on every user edit. */\n public readonly contentChange = output<string>();\n /**\n * Chrome around Quill's snow theme: the field's radius, border and surface.\n *\n * Descendant variants rather than a stylesheet — the utilities come from the\n * consuming app's Tailwind build (which scans this bundle), so they follow the\n * app's theme tokens the same way the rest of the library does.\n */\n protected readonly chromeClass =\n '[&_.ql-container.ql-snow]:rounded-b-xl [&_.ql-container.ql-snow]:border-base-300 ' +\n '[&_.ql-container.ql-snow]:bg-base-100 [&_.ql-container.ql-snow]:text-base ' +\n '[&_.ql-toolbar.ql-snow]:rounded-t-xl [&_.ql-toolbar.ql-snow]:border-base-300 ' +\n '[&_.ql-toolbar.ql-snow]:bg-base-100';\n /** Host element, used to keep DOM queries inside this component. */\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n /** Language service, used to resolve the toolbar labels from keys. */\n private readonly lang = inject(MnLanguageService);\n /** The container Quill mounts into. */\n private readonly editorHost = viewChild.required<ElementRef<HTMLElement>>('editorHost');\n /** The live editor instance, or null before Quill has loaded. */\n private quill: Quill | null = null;\n\n /** Whether the component is gone, so a late Quill load knows to stop. */\n private destroyed = false;\n\n /** The last HTML this component emitted, used to skip redundant writes. */\n private readonly lastEmitted = signal<string>('');\n\n constructor() {\n afterNextRender(() => void this.createEditor());\n // Push a changed `content` input into a live editor. `lastEmitted` is read\n // `untracked` on purpose: it must gate the write (skip when the incoming HTML\n // already matches what we hold) WITHOUT making the effect depend on it. If it\n // were tracked, every keystroke (which updates `lastEmitted`) would re-run the\n // effect and re-paste the now-stale `content` seed — wiping the user's typing\n // and resetting the caret after any wholesale reseed.\n effect(() => {\n const incoming = this.content();\n if (!this.quill || incoming === untracked(this.lastEmitted)) return;\n this.setEditorHtml(incoming);\n });\n }\n\n /** Drops the editor reference so the instance can be garbage collected. */\n ngOnDestroy(): void {\n this.destroyed = true;\n this.quill = null;\n }\n\n /** Moves focus into the editing surface. */\n public focusEditor(): void {\n this.quill?.focus();\n if (!this.quill) {\n this.host.nativeElement.querySelector<HTMLElement>('.ql-editor')?.focus();\n }\n }\n\n /**\n * Loads Quill, builds the instance and wires its change handler.\n *\n * Nothing awaits this beyond the component itself: the surface appears once\n * the engine has loaded, and until then the `content` effect is a no-op that\n * the seeding below makes good.\n */\n private async createEditor(): Promise<void> {\n const {default: QuillEditor} = await import('quill');\n if (this.destroyed) return;\n const container = this.editorHost().nativeElement;\n this.quill = new QuillEditor(container, {\n theme: 'snow',\n placeholder: this.placeholder(),\n modules: {toolbar: this.toolbar() as unknown[]},\n });\n const label = this.ariaLabel();\n if (label) {\n this.quill.root.setAttribute('aria-label', label);\n }\n this.applyToolbarLabels();\n this.setEditorHtml(this.content());\n this.quill.on('text-change', () => this.emitCurrentHtml());\n }\n\n /**\n * Gives each toolbar control a hover label, so hovering explains what the\n * style does. Set on the Quill-generated DOM after init; a control the current\n * toolbar does not render is simply skipped.\n */\n private applyToolbarLabels(): void {\n const toolbar = this.host.nativeElement.querySelector('.ql-toolbar');\n if (!toolbar) return;\n const labels = this.labels();\n const keys = this.labelKeys();\n for (const [control, selector] of Object.entries(CONTROL_SELECTORS)) {\n const element = toolbar.querySelector(selector);\n if (!element) continue;\n element.classList.add('mn-rte-tooltip');\n element.setAttribute(\n 'data-tip',\n this.resolveLabel(control as MnRichTextEditorControl, labels, keys),\n );\n }\n }\n\n /**\n * Picks the hover label for one control.\n * @param control The control being labelled.\n * @param labels Literal labels supplied by the consumer.\n * @param keys Translation keys supplied by the consumer.\n * @returns The translated key, the literal label, or the built-in default.\n */\n private resolveLabel(\n control: MnRichTextEditorControl,\n labels: MnRichTextEditorLabels,\n keys: MnRichTextEditorLabels,\n ): string {\n const key = keys[control];\n if (key) {\n // `t()` echoes the key back when the consumer has no translation for it;\n // that is a miss, not a label, so fall through to the remaining sources.\n const translated = this.lang.t(key);\n if (translated !== key) return translated;\n }\n return labels[control] ?? DEFAULT_LABELS[control];\n }\n\n /**\n * Replaces the editor content with stored HTML. Quill parses it into its own\n * document model, which silently drops anything it has no format for — a\n * useful extra filter on top of the consumer's sanitiser.\n * @param html The HTML to load into the editor.\n */\n private setEditorHtml(html: string): void {\n if (!this.quill) return;\n // `dangerouslyPasteHTML` is Quill's documented name for \"parse this HTML\".\n this.quill.clipboard.dangerouslyPasteHTML(html ?? '', 'silent');\n this.lastEmitted.set(this.readHtml());\n }\n\n /** Emits the editor's current HTML, normalising Quill's \"empty\" document. */\n private emitCurrentHtml(): void {\n const html = this.readHtml();\n this.lastEmitted.set(html);\n this.contentChange.emit(html);\n }\n\n /**\n * Reads the editor's HTML.\n * @returns The current HTML, or an empty string when the editor is blank.\n */\n private readHtml(): string {\n if (!this.quill) return '';\n // Quill leaves an empty paragraph behind after a clear; treat that as empty\n // so an untouched editor does not count as authored content.\n const html = this.quill.root.innerHTML;\n return html === EMPTY_DOCUMENT ? '' : html;\n }\n}\n","<div class=\"mn-rich-text-editor {{ chromeClass }} {{ editorClass() }}\">\n <div #editorHost></div>\n</div>\n","/**\n * Public API of the `mn-angular-lib/rich-text-editor` entry point: the rich-text editor.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/mn-rich-text-editor';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAmBA;;;;;AAKG;AACH,MAAM,eAAe,GAA4B;IAC/C,CAAC,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAC,CAAC;AACzB,IAAA,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC;IACzC,CAAC,EAAC,IAAI,EAAE,SAAS,EAAC,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,CAAC;IACrC,CAAC,YAAY,EAAE,YAAY,CAAC;AAC5B,IAAA,CAAC,MAAM,CAAC;AACR,IAAA,CAAC,OAAO,CAAC;CACV;AAED;AACA,MAAM,iBAAiB,GAA4C;AACjE,IAAA,SAAS,EAAE,6BAA6B;AACxC,IAAA,IAAI,EAAE,gBAAgB;AACtB,IAAA,MAAM,EAAE,kBAAkB;AAC1B,IAAA,SAAS,EAAE,qBAAqB;AAChC,IAAA,MAAM,EAAE,kBAAkB;AAC1B,IAAA,WAAW,EAAE,iCAAiC;AAC9C,IAAA,UAAU,EAAE,gCAAgC;AAC5C,IAAA,UAAU,EAAE,sBAAsB;AAClC,IAAA,SAAS,EAAE,sBAAsB;AACjC,IAAA,IAAI,EAAE,gBAAg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,EAAA,CAAA;kBAX5B,SAAS;+BACE,qBAAqB,EAAA,UAAA,EACnB,IAAI,EAAA,aAAA,EAMD,iBAAiB,CAAC,IAAI,EAAA,eAAA,EACpB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,gHAAA,EAAA,MAAA,EAAA,CAAA,4jBAAA,CAAA,EAAA;y0BA6C2B,YAAY,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE/JxF;;;;;;AAMG;;ACNH;;AAEG;;"}
@@ -213,10 +213,10 @@ class MnSegmented {
213
213
  return;
214
214
  this.valueChange.emit(item.value);
215
215
  }
216
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSegmented, deps: [], target: i0.ɵɵFactoryTarget.Component });
217
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnSegmented, isStandalone: true, selector: "mn-segmented", inputs: { dataSource: "dataSource", value: "value", justified: "justified" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<!-- One control, one answer: `role=\"group\"` with `aria-pressed` per segment, so\n the picked choice is announced as pressed rather than as a plain button\n nobody can tell the state of. Not a radiogroup \u2014 these are buttons that act\n immediately, not a value being edited inside a form. -->\n<div [attr.aria-label]=\"groupLabel\" [class]=\"styles.root()\" role=\"group\">\n @for (item of dataSource.items; track item.value) {\n <!-- Each segment is an mn-button: the active one a filled primary button, the\n rest ghost buttons, so the control shares the button's sizes, colours and\n disabled look instead of re-deriving them. -->\n <button\n mnButton\n (click)=\"select(item)\"\n [attr.aria-label]=\"segmentLabel(item)\"\n [attr.aria-pressed]=\"isActive(item)\"\n [class]=\"segmentClass(item)\"\n [data]=\"segmentButton(item)\"\n type=\"button\"\n >\n @if (item.icon; as icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n <!-- A caller's template, else lucide data rendered at the size that\n matches this control's text \u2014 the same icon convention the\n dropdown's actions use. -->\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"iconSize\"></svg>\n }\n </span>\n }\n @if (item.label; as label) {\n <span class=\"truncate\">{{ label | mnTranslate }}</span>\n }\n </button>\n }\n</div>\n", dependencies: [{ kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
216
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnSegmented, deps: [], target: i0.ɵɵFactoryTarget.Component });
217
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnSegmented, isStandalone: true, selector: "mn-segmented", inputs: { dataSource: "dataSource", value: "value", justified: "justified" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<!-- One control, one answer: `role=\"group\"` with `aria-pressed` per segment, so\n the picked choice is announced as pressed rather than as a plain button\n nobody can tell the state of. Not a radiogroup \u2014 these are buttons that act\n immediately, not a value being edited inside a form. -->\n<div [attr.aria-label]=\"groupLabel\" [class]=\"styles.root()\" role=\"group\">\n @for (item of dataSource.items; track item.value) {\n <!-- Each segment is an mn-button: the active one a filled primary button, the\n rest ghost buttons, so the control shares the button's sizes, colours and\n disabled look instead of re-deriving them. -->\n <button\n mnButton\n (click)=\"select(item)\"\n [attr.aria-label]=\"segmentLabel(item)\"\n [attr.aria-pressed]=\"isActive(item)\"\n [class]=\"segmentClass(item)\"\n [data]=\"segmentButton(item)\"\n type=\"button\"\n >\n @if (item.icon; as icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n <!-- A caller's template, else lucide data rendered at the size that\n matches this control's text \u2014 the same icon convention the\n dropdown's actions use. -->\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"iconSize\"></svg>\n }\n </span>\n }\n @if (item.label; as label) {\n <span class=\"truncate\">{{ label | mnTranslate }}</span>\n }\n </button>\n }\n</div>\n", dependencies: [{ kind: "component", type: MnButton, selector: "button[mnButton], a[mnButton]", inputs: ["data"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
218
218
  }
219
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnSegmented, decorators: [{
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnSegmented, decorators: [{
220
220
  type: Component,
221
221
  args: [{ selector: 'mn-segmented', standalone: true, imports: [MnButton, MnTranslatePipe, NgTemplateOutlet, LucideDynamicIcon], template: "<!-- One control, one answer: `role=\"group\"` with `aria-pressed` per segment, so\n the picked choice is announced as pressed rather than as a plain button\n nobody can tell the state of. Not a radiogroup \u2014 these are buttons that act\n immediately, not a value being edited inside a form. -->\n<div [attr.aria-label]=\"groupLabel\" [class]=\"styles.root()\" role=\"group\">\n @for (item of dataSource.items; track item.value) {\n <!-- Each segment is an mn-button: the active one a filled primary button, the\n rest ghost buttons, so the control shares the button's sizes, colours and\n disabled look instead of re-deriving them. -->\n <button\n mnButton\n (click)=\"select(item)\"\n [attr.aria-label]=\"segmentLabel(item)\"\n [attr.aria-pressed]=\"isActive(item)\"\n [class]=\"segmentClass(item)\"\n [data]=\"segmentButton(item)\"\n type=\"button\"\n >\n @if (item.icon; as icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n <!-- A caller's template, else lucide data rendered at the size that\n matches this control's text \u2014 the same icon convention the\n dropdown's actions use. -->\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"iconSize\"></svg>\n }\n </span>\n }\n @if (item.label; as label) {\n <span class=\"truncate\">{{ label | mnTranslate }}</span>\n }\n </button>\n }\n</div>\n" }]
222
222
  }], propDecorators: { dataSource: [{
@@ -1 +1 @@
1
- {"version":3,"file":"mn-angular-lib-segmented.mjs","sources":["../../../projects/mn-angular-lib/segmented/src/mn-segmented/mn-segmentedVariants.ts","../../../projects/mn-angular-lib/segmented/src/mn-segmented/mn-segmented.ts","../../../projects/mn-angular-lib/segmented/src/mn-segmented/mn-segmented.html","../../../projects/mn-angular-lib/segmented/public-api.ts","../../../projects/mn-angular-lib/segmented/mn-angular-lib-segmented.ts"],"sourcesContent":["import { tv, type VariantProps } from 'tailwind-variants';\n\n/**\n * Styling for {@link MnSegmented}, expressed as tailwind-variants slots so the\n * template pulls one class string per role.\n *\n * The control is a track with the active choice raised out of it, rather than a\n * row of loose buttons: the segments share one bordered surface, so they read as\n * one control with one answer instead of several independent actions. Theme\n * tokens only, so it holds up in both light and dark.\n *\n * Each segment is an `mnButton`, which owns its own size, colour, radius and\n * disabled look; the `segment` slot adds only what the button does not know\n * about — how it sits inside the track.\n */\nexport const mnSegmentedVariants = tv({\n slots: {\n root: 'inline-flex items-center gap-0.5 border border-base-300 bg-base-200 p-0.5',\n segment:\n 'gap-1.5 select-none ' +\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',\n },\n variants: {\n /**\n * Corner rounding of the track. The segments are rounded one step tighter\n * (see `SEGMENT_RADIUS` on the component) so a filled segment nests inside\n * the track's own corner instead of poking out of it. Token names match\n * mn-button's; `full` makes a pill, where track and segment share the same\n * fully-rounded ends.\n */\n borderRadius: {\n none: { root: 'rounded-none' },\n xs: { root: 'rounded-xs' },\n sm: { root: 'rounded-sm' },\n md: { root: 'rounded-md' },\n lg: { root: 'rounded-lg' },\n xl: { root: 'rounded-xl' },\n two_xl: { root: 'rounded-2xl' },\n three_xl: { root: 'rounded-3xl' },\n four_xl: { root: 'rounded-4xl' },\n full: { root: 'rounded-full' },\n },\n /**\n * Stretch the track and share its width evenly between the segments.\n *\n * The segments grow from a zero basis but keep their automatic minimum, so a\n * justified control inside an auto-width parent still asks for the room its\n * labels need. Letting them shrink below their content (`min-w-0`) made the\n * parent resolve to a narrower box and truncated the labels instead.\n */\n justified: {\n true: { root: 'flex w-full', segment: 'flex-1' },\n false: {},\n },\n /**\n * Whether the segment is the picked one. The colours come from the button\n * itself (a filled primary button when active, a ghost one otherwise); this\n * only keeps an inactive segment's box the same size as an active one, whose\n * fill variant carries a real border.\n */\n active: {\n true: {},\n false: { segment: 'border border-transparent' },\n },\n },\n defaultVariants: {\n borderRadius: 'lg',\n justified: false,\n active: false,\n },\n});\n\nexport type MnSegmentedVariants = VariantProps<typeof mnSegmentedVariants>;\n","import { Component, EventEmitter, inject, Input, Output, TemplateRef } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { LucideDynamicIcon } from '@lucide/angular';\nimport { MnLanguageService, MnTranslatePipe } from 'mn-angular-lib/core';\nimport { MnButton, MnButtonTypes } from 'mn-angular-lib/button';\nimport { MnSegmentedDataSource, MnSegmentedItem } from './mn-segmentedTypes';\nimport { MnSegmentedVariants, mnSegmentedVariants } from './mn-segmentedVariants';\n\n/** Icon edge length per size, so a segment's glyph matches its own text. */\nconst ICON_SIZE: Record<'sm' | 'md', number> = { sm: 16, md: 18 };\n\n/**\n * Segment radius per track radius: one step tighter, so a filled segment nests\n * inside the track's corner instead of poking out of it. A pill has no tighter\n * step, so its segments are pills too.\n */\nconst SEGMENT_RADIUS: Record<\n NonNullable<MnSegmentedVariants['borderRadius']>,\n NonNullable<MnButtonTypes['borderRadius']>\n> = {\n none: 'none',\n xs: 'none',\n sm: 'xs',\n md: 'sm',\n lg: 'md',\n xl: 'lg',\n two_xl: 'xl',\n three_xl: 'two_xl',\n four_xl: 'three_xl',\n full: 'full',\n};\n\n/**\n * A segmented control: two or three mutually exclusive choices sharing one\n * track, of which exactly one is active — a view switch (list ⇄ calendar), a\n * scope switch (mine ⇄ everyone), a range switch (week ⇄ month).\n *\n * The selection is **controlled**: the component renders whatever\n * {@link value} says and emits {@link valueChange} on a click, so the consumer's\n * own state stays the single source of truth for what is on screen. It keeps no\n * copy of the selection, and — unlike `mn-tab` — it does not mirror one into the\n * URL, so it can sit on a page that already has a tab bar without the two\n * fighting over the query string.\n *\n * Each segment is an `mnButton` — a filled primary one when active, a ghost one\n * otherwise — so the control inherits the button's sizes, colours and disabled\n * look rather than maintaining a parallel set.\n *\n * For switching between panes of a page, reach for `mn-tab`; this is for\n * switching how one pane is rendered.\n */\n@Component({\n selector: 'mn-segmented',\n standalone: true,\n imports: [MnButton, MnTranslatePipe, NgTemplateOutlet, LucideDynamicIcon],\n templateUrl: './mn-segmented.html',\n})\nexport class MnSegmented {\n /** The choices and how the group is labelled and scaled. */\n @Input({ required: true }) dataSource!: MnSegmentedDataSource;\n\n /**\n * Value of the active segment. No value (or one naming no segment) leaves the\n * control with nothing active, which is what an unresolved selection should\n * look like — the component never picks one on the consumer's behalf.\n */\n @Input() value?: string;\n\n /**\n * Whether the segments stretch to fill the available width. Defaults to false,\n * so the control hugs its content and can be parked at the end of a row; turn\n * it on where it should span its container, typically on a narrow screen.\n */\n @Input() justified = false;\n\n /** Emits the picked segment's value. The consumer decides what to do with it. */\n @Output() valueChange = new EventEmitter<string>();\n\n /** Resolves this control's own accessible names against the app's bundle. */\n private readonly lang = inject(MnLanguageService);\n\n /** Resolved slot classes for the current rounding and layout. */\n get styles() {\n return mnSegmentedVariants({\n borderRadius: this.dataSource.borderRadius,\n justified: this.justified,\n });\n }\n\n /** Icon edge length matching the control's text size. */\n get iconSize(): number {\n return ICON_SIZE[this.dataSource.size ?? 'md'];\n }\n\n /** Accessible name of the group, or null when the consumer named nothing. */\n get groupLabel(): string | null {\n const key = this.dataSource.ariaLabel;\n return key ? this.lang.translate(key) : null;\n }\n\n /**\n * Whether `item` is the active choice.\n * @param item - The segment to test.\n */\n isActive(item: MnSegmentedItem): boolean {\n return item.value === this.value;\n }\n\n /**\n * Layout classes for one segment — how it sits in the track. Its size, colour,\n * radius and disabled look come from the button itself; see\n * {@link segmentButton}.\n * @param item - The segment to style.\n */\n segmentClass(item: MnSegmentedItem): string {\n return mnSegmentedVariants({\n justified: this.justified,\n active: this.isActive(item),\n }).segment();\n }\n\n /**\n * The `mnButton` configuration of one segment: a filled primary button when it\n * is the active choice, a ghost button otherwise, at the control's size and one\n * radius step inside the track. The active segment has no hover — re-picking it\n * does nothing, so nothing should invite the click.\n * @param item - The segment to configure.\n */\n segmentButton(item: MnSegmentedItem): Partial<MnButtonTypes> {\n const active = this.isActive(item);\n return {\n size: this.dataSource.size ?? 'md',\n variant: active ? 'fill' : 'ghost',\n color: active ? 'primary' : 'gray',\n hover: !active,\n borderRadius: SEGMENT_RADIUS[this.dataSource.borderRadius ?? 'lg'],\n disabled: item.disabled ?? false,\n };\n }\n\n /**\n * Accessible name for an icon-only segment, or null when the segment shows a\n * label — that label already names it, and a second name would only compete.\n * @param item - The segment to name.\n */\n segmentLabel(item: MnSegmentedItem): string | null {\n if (item.label || !item.ariaLabel) return null;\n return this.lang.translate(item.ariaLabel);\n }\n\n /**\n * Whether an icon was supplied as a `TemplateRef` rather than lucide icon data.\n * @param value - The icon to test.\n */\n isTemplateRef(value: unknown): value is TemplateRef<unknown> {\n return value instanceof TemplateRef;\n }\n\n /**\n * Announces a click. Re-picking the active segment is silent: it is not a\n * change, and a consumer that reloads on every emission would refetch for\n * nothing.\n * @param item - The segment that was clicked.\n */\n select(item: MnSegmentedItem): void {\n if (item.disabled || this.isActive(item)) return;\n this.valueChange.emit(item.value);\n }\n}\n","<!-- One control, one answer: `role=\"group\"` with `aria-pressed` per segment, so\n the picked choice is announced as pressed rather than as a plain button\n nobody can tell the state of. Not a radiogroup — these are buttons that act\n immediately, not a value being edited inside a form. -->\n<div [attr.aria-label]=\"groupLabel\" [class]=\"styles.root()\" role=\"group\">\n @for (item of dataSource.items; track item.value) {\n <!-- Each segment is an mn-button: the active one a filled primary button, the\n rest ghost buttons, so the control shares the button's sizes, colours and\n disabled look instead of re-deriving them. -->\n <button\n mnButton\n (click)=\"select(item)\"\n [attr.aria-label]=\"segmentLabel(item)\"\n [attr.aria-pressed]=\"isActive(item)\"\n [class]=\"segmentClass(item)\"\n [data]=\"segmentButton(item)\"\n type=\"button\"\n >\n @if (item.icon; as icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n <!-- A caller's template, else lucide data rendered at the size that\n matches this control's text — the same icon convention the\n dropdown's actions use. -->\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"iconSize\"></svg>\n }\n </span>\n }\n @if (item.label; as label) {\n <span class=\"truncate\">{{ label | mnTranslate }}</span>\n }\n </button>\n }\n</div>\n","/**\n * Public API of the `mn-angular-lib/segmented` entry point: the segmented control.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/mn-segmented';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAEA;;;;;;;;;;;;AAYG;AACI,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACpC,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,2EAA2E;AACjF,QAAA,OAAO,EACL,sBAAsB;YACtB,sFAAsF;AACzF,KAAA;AACD,IAAA,QAAQ,EAAE;AACR;;;;;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AA,KAAA,EAAA,OAAA,EAAA,SAAA,EAAA,WAAA,EAAA,EAAA,OAAA,EAAA,EAAA,WAAA,EAAA,aAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECzDxB,ilDAoCA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDkBY,QAAQ,4FAAmB,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAE,iBAAiB,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,CAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAApD,eAAe,EAAA,IAAA,EAAA,aAAA,EAAA,CAAA,EAAA,CAAA;;2FAGxB,WAAW,EAAA,UAAA,EAAA,CAAA;kBANvB,SAAS;+BACE,cAAc,EAAA,UAAA,EACZ,IAAI,EAAA,OAAA,EACP,CAAC,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,iBAAiB,CAAC,EAAA,QAAA,EAAA,ilDAAA,EAAA;;sBAKxE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAOxB;;sBAOA;;sBAGA;;;AE5EH;;;;;;AAMG;;ACNH;;AAEG;;;;"}
1
+ {"version":3,"file":"mn-angular-lib-segmented.mjs","sources":["../../../projects/mn-angular-lib/segmented/src/mn-segmented/mn-segmentedVariants.ts","../../../projects/mn-angular-lib/segmented/src/mn-segmented/mn-segmented.ts","../../../projects/mn-angular-lib/segmented/src/mn-segmented/mn-segmented.html","../../../projects/mn-angular-lib/segmented/public-api.ts","../../../projects/mn-angular-lib/segmented/mn-angular-lib-segmented.ts"],"sourcesContent":["import { tv, type VariantProps } from 'tailwind-variants';\n\n/**\n * Styling for {@link MnSegmented}, expressed as tailwind-variants slots so the\n * template pulls one class string per role.\n *\n * The control is a track with the active choice raised out of it, rather than a\n * row of loose buttons: the segments share one bordered surface, so they read as\n * one control with one answer instead of several independent actions. Theme\n * tokens only, so it holds up in both light and dark.\n *\n * Each segment is an `mnButton`, which owns its own size, colour, radius and\n * disabled look; the `segment` slot adds only what the button does not know\n * about — how it sits inside the track.\n */\nexport const mnSegmentedVariants = tv({\n slots: {\n root: 'inline-flex items-center gap-0.5 border border-base-300 bg-base-200 p-0.5',\n segment:\n 'gap-1.5 select-none ' +\n 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary',\n },\n variants: {\n /**\n * Corner rounding of the track. The segments are rounded one step tighter\n * (see `SEGMENT_RADIUS` on the component) so a filled segment nests inside\n * the track's own corner instead of poking out of it. Token names match\n * mn-button's; `full` makes a pill, where track and segment share the same\n * fully-rounded ends.\n */\n borderRadius: {\n none: { root: 'rounded-none' },\n xs: { root: 'rounded-xs' },\n sm: { root: 'rounded-sm' },\n md: { root: 'rounded-md' },\n lg: { root: 'rounded-lg' },\n xl: { root: 'rounded-xl' },\n two_xl: { root: 'rounded-2xl' },\n three_xl: { root: 'rounded-3xl' },\n four_xl: { root: 'rounded-4xl' },\n full: { root: 'rounded-full' },\n },\n /**\n * Stretch the track and share its width evenly between the segments.\n *\n * The segments grow from a zero basis but keep their automatic minimum, so a\n * justified control inside an auto-width parent still asks for the room its\n * labels need. Letting them shrink below their content (`min-w-0`) made the\n * parent resolve to a narrower box and truncated the labels instead.\n */\n justified: {\n true: { root: 'flex w-full', segment: 'flex-1' },\n false: {},\n },\n /**\n * Whether the segment is the picked one. The colours come from the button\n * itself (a filled primary button when active, a ghost one otherwise); this\n * only keeps an inactive segment's box the same size as an active one, whose\n * fill variant carries a real border.\n */\n active: {\n true: {},\n false: { segment: 'border border-transparent' },\n },\n },\n defaultVariants: {\n borderRadius: 'lg',\n justified: false,\n active: false,\n },\n});\n\nexport type MnSegmentedVariants = VariantProps<typeof mnSegmentedVariants>;\n","import {\n Component,\n EventEmitter,\n inject,\n Input,\n Output,\n TemplateRef,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { LucideDynamicIcon } from '@lucide/angular';\nimport { MnLanguageService, MnTranslatePipe } from 'mn-angular-lib/core';\nimport { MnButton, MnButtonTypes } from 'mn-angular-lib/button';\nimport { MnSegmentedDataSource, MnSegmentedItem } from './mn-segmentedTypes';\nimport { MnSegmentedVariants, mnSegmentedVariants } from './mn-segmentedVariants';\n\n/** Icon edge length per size, so a segment's glyph matches its own text. */\nconst ICON_SIZE: Record<'sm' | 'md', number> = { sm: 16, md: 18 };\n\n/**\n * Segment radius per track radius: one step tighter, so a filled segment nests\n * inside the track's corner instead of poking out of it. A pill has no tighter\n * step, so its segments are pills too.\n */\nconst SEGMENT_RADIUS: Record<\n NonNullable<MnSegmentedVariants['borderRadius']>,\n NonNullable<MnButtonTypes['borderRadius']>\n> = {\n none: 'none',\n xs: 'none',\n sm: 'xs',\n md: 'sm',\n lg: 'md',\n xl: 'lg',\n two_xl: 'xl',\n three_xl: 'two_xl',\n four_xl: 'three_xl',\n full: 'full',\n};\n\n/**\n * A segmented control: two or three mutually exclusive choices sharing one\n * track, of which exactly one is active — a view switch (list ⇄ calendar), a\n * scope switch (mine ⇄ everyone), a range switch (week ⇄ month).\n *\n * The selection is **controlled**: the component renders whatever\n * {@link value} says and emits {@link valueChange} on a click, so the consumer's\n * own state stays the single source of truth for what is on screen. It keeps no\n * copy of the selection, and — unlike `mn-tab` — it does not mirror one into the\n * URL, so it can sit on a page that already has a tab bar without the two\n * fighting over the query string.\n *\n * Each segment is an `mnButton` — a filled primary one when active, a ghost one\n * otherwise — so the control inherits the button's sizes, colours and disabled\n * look rather than maintaining a parallel set.\n *\n * For switching between panes of a page, reach for `mn-tab`; this is for\n * switching how one pane is rendered.\n */\n@Component({\n selector: 'mn-segmented',\n standalone: true,\n imports: [MnButton, MnTranslatePipe, NgTemplateOutlet, LucideDynamicIcon],\n templateUrl: './mn-segmented.html',\n})\nexport class MnSegmented {\n /** The choices and how the group is labelled and scaled. */\n @Input({ required: true }) dataSource!: MnSegmentedDataSource;\n\n /**\n * Value of the active segment. No value (or one naming no segment) leaves the\n * control with nothing active, which is what an unresolved selection should\n * look like — the component never picks one on the consumer's behalf.\n */\n @Input() value?: string;\n\n /**\n * Whether the segments stretch to fill the available width. Defaults to false,\n * so the control hugs its content and can be parked at the end of a row; turn\n * it on where it should span its container, typically on a narrow screen.\n */\n @Input() justified = false;\n\n /** Emits the picked segment's value. The consumer decides what to do with it. */\n @Output() valueChange = new EventEmitter<string>();\n\n /** Resolves this control's own accessible names against the app's bundle. */\n private readonly lang = inject(MnLanguageService);\n\n /** Resolved slot classes for the current rounding and layout. */\n get styles() {\n return mnSegmentedVariants({\n borderRadius: this.dataSource.borderRadius,\n justified: this.justified,\n });\n }\n\n /** Icon edge length matching the control's text size. */\n get iconSize(): number {\n return ICON_SIZE[this.dataSource.size ?? 'md'];\n }\n\n /** Accessible name of the group, or null when the consumer named nothing. */\n get groupLabel(): string | null {\n const key = this.dataSource.ariaLabel;\n return key ? this.lang.translate(key) : null;\n }\n\n /**\n * Whether `item` is the active choice.\n * @param item - The segment to test.\n */\n isActive(item: MnSegmentedItem): boolean {\n return item.value === this.value;\n }\n\n /**\n * Layout classes for one segment — how it sits in the track. Its size, colour,\n * radius and disabled look come from the button itself; see\n * {@link segmentButton}.\n * @param item - The segment to style.\n */\n segmentClass(item: MnSegmentedItem): string {\n return mnSegmentedVariants({\n justified: this.justified,\n active: this.isActive(item),\n }).segment();\n }\n\n /**\n * The `mnButton` configuration of one segment: a filled primary button when it\n * is the active choice, a ghost button otherwise, at the control's size and one\n * radius step inside the track. The active segment has no hover — re-picking it\n * does nothing, so nothing should invite the click.\n * @param item - The segment to configure.\n */\n segmentButton(item: MnSegmentedItem): Partial<MnButtonTypes> {\n const active = this.isActive(item);\n return {\n size: this.dataSource.size ?? 'md',\n variant: active ? 'fill' : 'ghost',\n color: active ? 'primary' : 'gray',\n hover: !active,\n borderRadius: SEGMENT_RADIUS[this.dataSource.borderRadius ?? 'lg'],\n disabled: item.disabled ?? false,\n };\n }\n\n /**\n * Accessible name for an icon-only segment, or null when the segment shows a\n * label — that label already names it, and a second name would only compete.\n * @param item - The segment to name.\n */\n segmentLabel(item: MnSegmentedItem): string | null {\n if (item.label || !item.ariaLabel) return null;\n return this.lang.translate(item.ariaLabel);\n }\n\n /**\n * Whether an icon was supplied as a `TemplateRef` rather than lucide icon data.\n * @param value - The icon to test.\n */\n isTemplateRef(value: unknown): value is TemplateRef<unknown> {\n return value instanceof TemplateRef;\n }\n\n /**\n * Announces a click. Re-picking the active segment is silent: it is not a\n * change, and a consumer that reloads on every emission would refetch for\n * nothing.\n * @param item - The segment that was clicked.\n */\n select(item: MnSegmentedItem): void {\n if (item.disabled || this.isActive(item)) return;\n this.valueChange.emit(item.value);\n }\n}\n","<!-- One control, one answer: `role=\"group\"` with `aria-pressed` per segment, so\n the picked choice is announced as pressed rather than as a plain button\n nobody can tell the state of. Not a radiogroup — these are buttons that act\n immediately, not a value being edited inside a form. -->\n<div [attr.aria-label]=\"groupLabel\" [class]=\"styles.root()\" role=\"group\">\n @for (item of dataSource.items; track item.value) {\n <!-- Each segment is an mn-button: the active one a filled primary button, the\n rest ghost buttons, so the control shares the button's sizes, colours and\n disabled look instead of re-deriving them. -->\n <button\n mnButton\n (click)=\"select(item)\"\n [attr.aria-label]=\"segmentLabel(item)\"\n [attr.aria-pressed]=\"isActive(item)\"\n [class]=\"segmentClass(item)\"\n [data]=\"segmentButton(item)\"\n type=\"button\"\n >\n @if (item.icon; as icon) {\n <span class=\"inline-flex shrink-0 items-center\">\n <!-- A caller's template, else lucide data rendered at the size that\n matches this control's text — the same icon convention the\n dropdown's actions use. -->\n @if (isTemplateRef(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\"></ng-container>\n } @else {\n <svg [lucideIcon]=\"$any(icon)\" [size]=\"iconSize\"></svg>\n }\n </span>\n }\n @if (item.label; as label) {\n <span class=\"truncate\">{{ label | mnTranslate }}</span>\n }\n </button>\n }\n</div>\n","/**\n * Public API of the `mn-angular-lib/segmented` entry point: the segmented control.\n *\n * Each entry point is its own module in the published package, so a consumer's bundler\n * splits it into the chunk that uses it instead of loading the whole library at startup.\n * The root `mn-angular-lib` entry re-exports every entry point.\n */\nexport * from './src/mn-segmented';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAEA;;;;;;;;;;;;AAYG;AACI,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACpC,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,2EAA2E;AACjF,QAAA,OAAO,EACL,sBAAsB;YACtB,sFAAsF;AACzF,KAAA;AACD,IAAA,QAAQ,EAAE;AACR;;;;;;AAMG;AACH,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;AAC9B,YAAA,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC1B,YAAA,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC1B,YAAA,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC1B,YAAA,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC1B,YAAA,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;AAC1B,YAAA,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;AAC/B,YAAA,QAAQ,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;AACjC,YAAA,OAAO,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;AAChC,YAAA,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;AAC/B,SAAA;AACD;;;;;;;AAOG;AACH,QAAA,SAAS,EAAE;YACT,IAAI,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE;AAChD,YA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iBAAiB,CAAC,EAAA,QAAA,EAAA,ilDAAA,EAAA;;sBAKxE,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;;sBAOxB;;sBAOA;;sBAGA;;;AEnFH;;;;;;AAMG;;ACNH;;AAEG;;"}
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, EventEmitter, isSignal, Output, Input, ViewChild, Component } from '@angular/core';
2
+ import { inject, ChangeDetectorRef, EventEmitter, isSignal, Output, Input, ViewChild, Component } from '@angular/core';
3
3
  import { Router, ActivatedRoute } from '@angular/router';
4
4
  import { MnTranslatePipe } from 'mn-angular-lib/core';
5
5
  import { MnCollectionState } from 'mn-angular-lib/collection';
@@ -43,6 +43,13 @@ class MnTabComponent {
43
43
  router = inject(Router, { optional: true });
44
44
  /** Route the tab value is read back from; absent for the same reason as {@link router}. */
45
45
  route = inject(ActivatedRoute, { optional: true });
46
+ /**
47
+ * Marks the view whenever {@link currentActive} moves. The selection changes from three
48
+ * places Angular does not notice under OnPush: the query-parameter subscription, the
49
+ * {@link ngDoCheck} re-resolve, and a stale item being dropped — only a click arrives
50
+ * through a listener that dirties the view by itself.
51
+ */
52
+ cdr = inject(ChangeDetectorRef);
46
53
  /** Watches the URL so a deep link, a back button or an in-app link moves the tab bar. */
47
54
  queryParamsSub;
48
55
  /**
@@ -120,8 +127,7 @@ class MnTabComponent {
120
127
  * otherwise the number of known items, falling back to a default when none.
121
128
  */
122
129
  get skeletonTabs() {
123
- const count = this.dataSource.skeletonCount ??
124
- (this.dataSource.items.length || DEFAULT_SKELETON_TAB_COUNT);
130
+ const count = this.dataSource.skeletonCount ?? (this.dataSource.items.length || DEFAULT_SKELETON_TAB_COUNT);
125
131
  return Array.from({ length: count }, (_, index) => index);
126
132
  }
127
133
  constructor() {
@@ -397,6 +403,7 @@ class MnTabComponent {
397
403
  if (this.currentActive !== undefined) {
398
404
  this.currentActive = undefined;
399
405
  this.currentKey = undefined;
406
+ this.cdr.markForCheck();
400
407
  this.scheduleIndicator(false);
401
408
  }
402
409
  return;
@@ -431,6 +438,7 @@ class MnTabComponent {
431
438
  const items = this.dataSource.items;
432
439
  this.currentActive = item;
433
440
  this.currentKey = this.urlKeys(items)[items.indexOf(item)];
441
+ this.cdr.markForCheck();
434
442
  }
435
443
  /**
436
444
  * Runs the restored tab's callbacks a change-detection pass later, unless the
@@ -532,10 +540,10 @@ class MnTabComponent {
532
540
  this.urlKeyCache = { items, keys };
533
541
  return keys;
534
542
  }
535
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
536
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: MnTabComponent, isStandalone: true, selector: "mn-tab", inputs: { dataSource: "dataSource", scrollable: "scrollable", justified: "justified" }, outputs: { activeChange: "activeChange" }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }, { propertyName: "tabList", first: true, predicate: ["tabList"], descendants: true }, { propertyName: "indicator", first: true, predicate: ["indicator"], descendants: true }], ngImport: i0, template: "<div class=\"mb-10\">\n <div\n #scrollContainer\n (scroll)=\"updateEdgeFades()\"\n class=\"flex justify-start scrollbar-hide\"\n [class.overflow-x-auto]=\"scrollable\"\n [class.overflow-y-hidden]=\"scrollable\"\n >\n <div\n #tabList\n role=\"tablist\"\n class=\"tabs relative flex flex-nowrap -mb-[1px] border-b border-base-300\"\n [class.w-full]=\"justified\"\n >\n <!--\n Shared sliding indicator: a single underline that travels to the active\n tab, rather than each tab flipping its own border on/off (which snaps).\n Pinned to left-0/top-auto so offsetLeft maps 1:1 regardless of the\n flex justify-content or the justified full-width layout; position and\n width are measured and set from TS. Sits on the same baseline as the\n hover ::after so hover \u2192 select reads as one continuous underline.\n -->\n <div\n #indicator\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute left-0 top-auto bottom-0 h-[2px] w-0 bg-primary opacity-0 transition-[transform,width] duration-300 ease-out motion-reduce:transition-none\"\n ></div>\n @if (isLoadingState) {\n @for (i of skeletonTabs; track i) {\n <div\n [class.flex-1]=\"justified\"\n class=\"tab px-4 py-2 border-b-2 border-transparent flex items-center justify-center\"\n >\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '4.5rem', height: '1rem' }\"></mn-skeleton>\n </div>\n }\n } @else {\n @for (item of dataSource.items; track item.label) {\n <!-- One Tab stop per bar (the active tab); the arrow keys, Home and End move between\n tabs and activate them, the WAI-ARIA tabs pattern. Every tab used to be its own\n Tab stop with no arrow keys, so crossing an eight-tab bar took eight presses. -->\n <div\n (click)=\"setActive(item)\"\n (keydown)=\"onTabKeydown($event, item)\"\n [attr.aria-selected]=\"currentActive === item\"\n [attr.tabindex]=\"isTabStop(item) ? 0 : -1\"\n [class.hover:after:scale-x-100]=\"currentActive !== item\"\n [class.flex-1]=\"justified\"\n [class.font-bold]=\"currentActive === item\"\n [class.text-base-content]=\"currentActive !== item\"\n [class.text-primary]=\"currentActive === item\"\n class=\"tab relative px-4 py-2 border-b-2 border-transparent cursor-pointer select-none transition-colors whitespace-nowrap text-center flex items-center gap-2 after:content-[''] after:absolute after:inset-x-0 after:-bottom-[2px] after:h-[2px] after:bg-primary/60 after:origin-center after:scale-x-0 after:transition-transform after:duration-300 after:ease-out\"\n role=\"tab\"\n >\n {{ item.label | mnTranslate }}\n @let badge = getBadge(item);\n @if (badge && badge > 0) {\n <span [data]=\"{ size: 'sm', color: 'accent', variant: 'fill' }\" mnBadge>{{ badge }}</span>\n }\n </div>\n }\n }\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MnBadge, selector: "span[mnBadge]", inputs: ["data"] }, { kind: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
543
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
544
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: MnTabComponent, isStandalone: true, selector: "mn-tab", inputs: { dataSource: "dataSource", scrollable: "scrollable", justified: "justified" }, outputs: { activeChange: "activeChange" }, viewQueries: [{ propertyName: "scrollContainer", first: true, predicate: ["scrollContainer"], descendants: true }, { propertyName: "tabList", first: true, predicate: ["tabList"], descendants: true }, { propertyName: "indicator", first: true, predicate: ["indicator"], descendants: true }], ngImport: i0, template: "<div class=\"mb-10\">\n <div\n #scrollContainer\n (scroll)=\"updateEdgeFades()\"\n class=\"flex justify-start scrollbar-hide\"\n [class.overflow-x-auto]=\"scrollable\"\n [class.overflow-y-hidden]=\"scrollable\"\n >\n <div\n #tabList\n role=\"tablist\"\n class=\"tabs relative flex flex-nowrap -mb-[1px] border-b border-base-300\"\n [class.w-full]=\"justified\"\n >\n <!--\n Shared sliding indicator: a single underline that travels to the active\n tab, rather than each tab flipping its own border on/off (which snaps).\n Pinned to left-0/top-auto so offsetLeft maps 1:1 regardless of the\n flex justify-content or the justified full-width layout; position and\n width are measured and set from TS. Sits on the same baseline as the\n hover ::after so hover \u2192 select reads as one continuous underline.\n -->\n <div\n #indicator\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute left-0 top-auto bottom-0 h-[2px] w-0 bg-primary opacity-0 transition-[transform,width] duration-300 ease-out motion-reduce:transition-none\"\n ></div>\n @if (isLoadingState) {\n @for (i of skeletonTabs; track i) {\n <div\n [class.flex-1]=\"justified\"\n class=\"tab px-4 py-2 border-b-2 border-transparent flex items-center justify-center\"\n >\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '4.5rem', height: '1rem' }\"></mn-skeleton>\n </div>\n }\n } @else {\n @for (item of dataSource.items; track item.label) {\n <!-- One Tab stop per bar (the active tab); the arrow keys, Home and End move between\n tabs and activate them, the WAI-ARIA tabs pattern. Every tab used to be its own\n Tab stop with no arrow keys, so crossing an eight-tab bar took eight presses. -->\n <div\n (click)=\"setActive(item)\"\n (keydown)=\"onTabKeydown($event, item)\"\n [attr.aria-selected]=\"currentActive === item\"\n [attr.tabindex]=\"isTabStop(item) ? 0 : -1\"\n [class.hover:after:scale-x-100]=\"currentActive !== item\"\n [class.flex-1]=\"justified\"\n [class.font-bold]=\"currentActive === item\"\n [class.text-base-content]=\"currentActive !== item\"\n [class.text-primary]=\"currentActive === item\"\n class=\"tab relative px-4 py-2 border-b-2 border-transparent cursor-pointer select-none transition-colors whitespace-nowrap text-center flex items-center gap-2 after:content-[''] after:absolute after:inset-x-0 after:-bottom-[2px] after:h-[2px] after:bg-primary/60 after:origin-center after:scale-x-0 after:transition-transform after:duration-300 after:ease-out\"\n role=\"tab\"\n >\n {{ item.label | mnTranslate }}\n @let badge = getBadge(item);\n @if (badge && badge > 0) {\n <span [data]=\"{ size: 'sm', color: 'accent', variant: 'fill' }\" mnBadge>{{ badge }}</span>\n }\n </div>\n }\n }\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: MnBadge, selector: "span[mnBadge]", inputs: ["data"] }, { kind: "component", type: MnSkeleton, selector: "mn-skeleton", inputs: ["data"] }, { kind: "pipe", type: MnTranslatePipe, name: "mnTranslate" }] });
537
545
  }
538
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: MnTabComponent, decorators: [{
546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: MnTabComponent, decorators: [{
539
547
  type: Component,
540
548
  args: [{ selector: 'mn-tab', standalone: true, imports: [MnTranslatePipe, CommonModule, MnBadge, MnSkeleton], template: "<div class=\"mb-10\">\n <div\n #scrollContainer\n (scroll)=\"updateEdgeFades()\"\n class=\"flex justify-start scrollbar-hide\"\n [class.overflow-x-auto]=\"scrollable\"\n [class.overflow-y-hidden]=\"scrollable\"\n >\n <div\n #tabList\n role=\"tablist\"\n class=\"tabs relative flex flex-nowrap -mb-[1px] border-b border-base-300\"\n [class.w-full]=\"justified\"\n >\n <!--\n Shared sliding indicator: a single underline that travels to the active\n tab, rather than each tab flipping its own border on/off (which snaps).\n Pinned to left-0/top-auto so offsetLeft maps 1:1 regardless of the\n flex justify-content or the justified full-width layout; position and\n width are measured and set from TS. Sits on the same baseline as the\n hover ::after so hover \u2192 select reads as one continuous underline.\n -->\n <div\n #indicator\n aria-hidden=\"true\"\n class=\"pointer-events-none absolute left-0 top-auto bottom-0 h-[2px] w-0 bg-primary opacity-0 transition-[transform,width] duration-300 ease-out motion-reduce:transition-none\"\n ></div>\n @if (isLoadingState) {\n @for (i of skeletonTabs; track i) {\n <div\n [class.flex-1]=\"justified\"\n class=\"tab px-4 py-2 border-b-2 border-transparent flex items-center justify-center\"\n >\n <mn-skeleton [data]=\"{ shape: 'rectangle', width: '4.5rem', height: '1rem' }\"></mn-skeleton>\n </div>\n }\n } @else {\n @for (item of dataSource.items; track item.label) {\n <!-- One Tab stop per bar (the active tab); the arrow keys, Home and End move between\n tabs and activate them, the WAI-ARIA tabs pattern. Every tab used to be its own\n Tab stop with no arrow keys, so crossing an eight-tab bar took eight presses. -->\n <div\n (click)=\"setActive(item)\"\n (keydown)=\"onTabKeydown($event, item)\"\n [attr.aria-selected]=\"currentActive === item\"\n [attr.tabindex]=\"isTabStop(item) ? 0 : -1\"\n [class.hover:after:scale-x-100]=\"currentActive !== item\"\n [class.flex-1]=\"justified\"\n [class.font-bold]=\"currentActive === item\"\n [class.text-base-content]=\"currentActive !== item\"\n [class.text-primary]=\"currentActive === item\"\n class=\"tab relative px-4 py-2 border-b-2 border-transparent cursor-pointer select-none transition-colors whitespace-nowrap text-center flex items-center gap-2 after:content-[''] after:absolute after:inset-x-0 after:-bottom-[2px] after:h-[2px] after:bg-primary/60 after:origin-center after:scale-x-0 after:transition-transform after:duration-300 after:ease-out\"\n role=\"tab\"\n >\n {{ item.label | mnTranslate }}\n @let badge = getBadge(item);\n @if (badge && badge > 0) {\n <span [data]=\"{ size: 'sm', color: 'accent', variant: 'fill' }\" mnBadge>{{ badge }}</span>\n }\n </div>\n }\n }\n </div>\n </div>\n</div>\n" }]
541
549
  }], ctorParameters: () => [], propDecorators: { scrollContainer: [{