@edsis/angular 22.2.17 → 22.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SUPPORT.md CHANGED
@@ -1,14 +1,28 @@
1
1
  # Runtime Support
2
2
 
3
- The published `@ojiepermana/*` UI packages support Angular 22.2 or newer applications running in a
4
- modern browser with client-side rendering (CSR).
5
-
6
- | Runtime | Support |
7
- | -------------------------------------------------------------- | ------------------------------------------------------ |
8
- | Angular 22.2–22.x CSR in current Chromium, Firefox, and WebKit | Supported |
9
- | Angular 22.1 or earlier | Unsupported |
10
- | Angular 23 or later | Unsupported until a matching package major is released |
11
- | Server-side rendering, prerendering, and hydration | Unsupported |
3
+ The published `@ojiepermana/*` UI packages and the showcase support client-side rendering (CSR)
4
+ with Angular 22.2–22.x. Their browser target combines the [Angular 22 Baseline dated May 7, 2026](https://angular.dev/reference/versions#browser-support)
5
+ with the [Tailwind CSS v4 requirements](https://tailwindcss.com/docs/compatibility#browser-support).
6
+
7
+ | Runtime | Support |
8
+ | -------------------------------------------------- | ------------------------------------------------------ |
9
+ | Angular 22.2–22.x CSR in browsers listed below | Supported |
10
+ | Angular 22.1 or earlier | Unsupported |
11
+ | Angular 23 or later | Unsupported until a matching package major is released |
12
+ | Server-side rendering, prerendering, and hydration | Unsupported |
13
+
14
+ | Browser | Minimum version |
15
+ | ----------------------------- | ---------------- |
16
+ | Chrome and Edge (desktop) | 119 |
17
+ | Firefox (desktop) | 128 |
18
+ | Safari (macOS and iOS) | 17.0 |
19
+ | Chrome and Firefox on Android | Current releases |
20
+
21
+ The showcase uses the dated Baseline in `.browserslistrc` with the Firefox minimum from Tailwind.
22
+ Consumers targeting this same browser set can use that configuration in their own builds. For
23
+ features newer than the browser target, use feature detection and keep a working fallback for
24
+ required behavior. Release checks exercise Playwright's current Chromium, Firefox, and WebKit
25
+ engines. They do not run against every minimum version in the table.
12
26
 
13
27
  DOM observers, browser locale/timezone, generated client IDs, and chart style injection are browser
14
28
  runtime contracts only. The SDK package is a Node-based schematic/code-generation tool and follows
@@ -114,6 +114,8 @@ Set `variant="input"` when the composer should align more closely with the radiu
114
114
 
115
115
  `rows` sets the initial height of the native textarea surface.
116
116
  `maxRows` caps autosize growth before the textarea begins scrolling.
117
+ Autosizing uses `field-sizing: content` where supported. The fallback measures the text,
118
+ padding, and border so the same row limits apply on older browsers.
117
119
 
118
120
  ```html
119
121
  <Composer>
@@ -126,6 +128,7 @@ Set `variant="input"` when the composer should align more closely with the radiu
126
128
  By default, keyboard submission uses `cmd-enter`, which means `Cmd+Enter` on macOS and `Ctrl+Enter` on Windows/Linux.
127
129
 
128
130
  Use `submit="enter"` when pressing `Enter` should submit immediately. `Shift+Enter` still inserts a new line.
131
+ Both keyboard shortcuts wait for IME composition to finish before submitting.
129
132
 
130
133
  ```html
131
134
  <Composer submit="enter" (submitRequested)="send()">
@@ -44,6 +44,9 @@ import {
44
44
  `EditorContent` sanitizes both values written into the control and edited HTML
45
45
  before emitting it. Applications can provide a stricter allow-list by overriding
46
46
  `EDITOR_HTML_SANITIZER`; sanitize again at any unrelated rendering boundary.
47
+ Editor HTML uses Angular's built-in Trusted Types policy when enforcement is
48
+ enabled. Highlighted text is saved as `<mark>` and uses the theme highlight
49
+ color when the value is loaded again.
47
50
 
48
51
  ```ts
49
52
  import { EDITOR_HTML_SANITIZER } from '@edsis/angular/component/editor';
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, ElementRef, booleanAttribute, computed, forwardRef, inject, input, numberAttribute, output, signal } from "@angular/core";
2
+ import { Component, DestroyRef, ElementRef, afterRenderEffect, booleanAttribute, computed, forwardRef, inject, input, numberAttribute, output, signal } from "@angular/core";
3
3
  import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
4
  import { cn } from "@edsis/angular/component/utils/core";
5
5
  const COMPOSER_BASE = "block w-full min-w-0 text-sm text-foreground";
@@ -55,7 +55,8 @@ var ComposerComponent = class ComposerComponent {
55
55
  ].join(" ")), ...ngDevMode ? [{ debugName: "bodyClasses" }] : /* istanbul ignore next */ []);
56
56
  handleInputKeydown(event) {
57
57
  if (this.disabled() || event.key !== "Enter" || event.defaultPrevented) return;
58
- if (!(this.submit() === "enter" ? !event.shiftKey && !event.isComposing : event.metaKey || event.ctrlKey)) return;
58
+ if (event.isComposing || event.keyCode === 229) return;
59
+ if (!(this.submit() === "enter" ? !event.shiftKey : event.metaKey || event.ctrlKey)) return;
59
60
  event.preventDefault();
60
61
  this.submitRequested.emit(event);
61
62
  if (this.submitForm()) this.requestNearestFormSubmit(event.target);
@@ -615,6 +616,8 @@ i0.ɵɵngDeclareClassMetadata({
615
616
  var ComposerTextareaComponent = class ComposerTextareaComponent {
616
617
  el = inject(ElementRef);
617
618
  composer = inject(ComposerComponent, { optional: true });
619
+ destroyRef = inject(DestroyRef);
620
+ nativeAutosize = this.el.nativeElement.ownerDocument.defaultView?.CSS?.supports("field-sizing", "content") ?? false;
618
621
  rows = input(2, {
619
622
  ...ngDevMode ? { debugName: "rows" } : /* istanbul ignore next */ {},
620
623
  transform: numberAttribute
@@ -634,6 +637,10 @@ var ComposerTextareaComponent = class ComposerTextareaComponent {
634
637
  transform: booleanAttribute
635
638
  });
636
639
  class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
640
+ maxBlockSize = computed(() => {
641
+ const maxRows = this.maxRows();
642
+ return maxRows ? `calc(${Math.max(maxRows, this.rows())} * 1lh + var(--composer-block-inset, 0px))` : null;
643
+ }, ...ngDevMode ? [{ debugName: "maxBlockSize" }] : /* istanbul ignore next */ []);
637
644
  disabledState = signal(false, ...ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []);
638
645
  disabled = computed(() => this.disabledInput() || this.disabledState() || this.composer?.disabled() === true, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
639
646
  invalid = computed(() => this.invalidInput() || this.composer?.invalid() === true, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
@@ -644,12 +651,18 @@ var ComposerTextareaComponent = class ComposerTextareaComponent {
644
651
  ].join(" "), this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
645
652
  onChange = () => {};
646
653
  onTouched = () => {};
654
+ constructor() {
655
+ afterRenderEffect({ mixedReadWrite: () => {
656
+ this.class();
657
+ this.resizeToContent();
658
+ } });
659
+ }
647
660
  ngAfterViewInit() {
648
- queueMicrotask(() => this.resizeToContent());
661
+ this.observeSize();
649
662
  }
650
663
  writeValue(value) {
651
664
  this.el.nativeElement.value = value ?? "";
652
- queueMicrotask(() => this.resizeToContent());
665
+ if (!this.nativeAutosize) queueMicrotask(() => this.resizeToContent());
653
666
  }
654
667
  registerOnChange(fn) {
655
668
  this.onChange = fn;
@@ -662,23 +675,31 @@ var ComposerTextareaComponent = class ComposerTextareaComponent {
662
675
  }
663
676
  resizeToContent() {
664
677
  const textarea = this.el.nativeElement;
665
- textarea.style.height = "auto";
666
- const maxRows = this.maxRows();
667
- if (!maxRows) {
668
- textarea.style.height = `${textarea.scrollHeight}px`;
669
- textarea.style.overflowY = "hidden";
678
+ const style = textarea.ownerDocument.defaultView?.getComputedStyle(textarea);
679
+ const pixels = (value) => Number.parseFloat(value ?? "") || 0;
680
+ const padding = pixels(style?.paddingTop) + pixels(style?.paddingBottom);
681
+ const border = pixels(style?.borderTopWidth) + pixels(style?.borderBottomWidth);
682
+ const borderBox = style?.boxSizing === "border-box";
683
+ if (this.nativeAutosize) {
684
+ textarea.style.setProperty("--composer-block-inset", `${borderBox ? padding + border : 0}px`);
670
685
  return;
671
686
  }
672
- const maxHeight = this.getLineHeight(textarea) * Math.max(maxRows, this.rows());
673
- const nextHeight = Math.min(textarea.scrollHeight, maxHeight);
674
- textarea.style.height = `${nextHeight}px`;
675
- textarea.style.overflowY = textarea.scrollHeight > maxHeight ? "auto" : "hidden";
687
+ textarea.style.height = "auto";
688
+ textarea.style.overflowY = "hidden";
689
+ const contentHeight = textarea.scrollHeight;
690
+ const lineHeight = pixels(style?.lineHeight) || 24;
691
+ const rows = this.rows();
692
+ const maxRows = this.maxRows();
693
+ const limit = maxRows ? Math.ceil(lineHeight * Math.max(maxRows, rows) + padding) : Infinity;
694
+ const next = Math.min(contentHeight, limit) + (borderBox ? border : -padding);
695
+ textarea.style.height = `${Math.max(0, next)}px`;
696
+ textarea.style.overflowY = contentHeight > limit ? "auto" : "hidden";
676
697
  }
677
698
  focus() {
678
699
  this.el.nativeElement.focus();
679
700
  }
680
701
  handleInput() {
681
- this.resizeToContent();
702
+ if (!this.nativeAutosize) this.resizeToContent();
682
703
  this.onChange(this.el.nativeElement.value);
683
704
  }
684
705
  handleBlur() {
@@ -688,9 +709,28 @@ var ComposerTextareaComponent = class ComposerTextareaComponent {
688
709
  if (this.disabled()) return;
689
710
  this.composer?.handleInputKeydown(event);
690
711
  }
691
- getLineHeight(textarea) {
692
- const lineHeight = Number.parseFloat(getComputedStyle(textarea).lineHeight);
693
- return Number.isFinite(lineHeight) ? lineHeight : 24;
712
+ observeSize() {
713
+ const textarea = this.el.nativeElement;
714
+ const view = textarea.ownerDocument.defaultView;
715
+ if (!view?.ResizeObserver) return;
716
+ let lastWidth;
717
+ let lastInset;
718
+ const observer = new view.ResizeObserver(([entry]) => {
719
+ const border = entry.borderBoxSize[0];
720
+ if (this.nativeAutosize) {
721
+ const content = entry.contentBoxSize[0];
722
+ const inset = border.blockSize - content.blockSize;
723
+ if (inset !== lastInset) {
724
+ lastInset = inset;
725
+ this.resizeToContent();
726
+ }
727
+ } else if (border.inlineSize !== lastWidth) {
728
+ lastWidth = border.inlineSize;
729
+ this.resizeToContent();
730
+ }
731
+ });
732
+ observer.observe(textarea);
733
+ this.destroyRef.onDestroy(() => observer.disconnect());
694
734
  }
695
735
  static ɵfac = i0.ɵɵngDeclareFactory({
696
736
  minVersion: "12.0.0",
@@ -752,7 +792,10 @@ var ComposerTextareaComponent = class ComposerTextareaComponent {
752
792
  properties: {
753
793
  "class": "classes()",
754
794
  "attr.data-slot": "\"composer-input\"",
795
+ "attr.data-native-autosize": "nativeAutosize ? \"\" : null",
755
796
  "attr.rows": "rows()",
797
+ "style.--composer-min-rows": "rows()",
798
+ "style.--composer-max-block-size": "maxBlockSize()",
756
799
  "attr.disabled": "disabled() ? \"\" : null",
757
800
  "attr.aria-invalid": "invalid() ? \"true\" : null"
758
801
  }
@@ -764,7 +807,8 @@ var ComposerTextareaComponent = class ComposerTextareaComponent {
764
807
  }],
765
808
  ngImport: i0,
766
809
  template: "",
767
- isInline: true
810
+ isInline: true,
811
+ styles: [":host([data-native-autosize]){field-sizing:content;block-size:auto;min-block-size:max(var(--control-height-10, 0px),calc(var(--composer-min-rows) * 1lh + var(--composer-block-inset, 0px)));max-block-size:var(--composer-max-block-size, none);overflow-y:auto}\n"]
768
812
  });
769
813
  };
770
814
  i0.ɵɵngDeclareClassMetadata({
@@ -784,16 +828,21 @@ i0.ɵɵngDeclareClassMetadata({
784
828
  host: {
785
829
  "[class]": "classes()",
786
830
  "[attr.data-slot]": "\"composer-input\"",
831
+ "[attr.data-native-autosize]": "nativeAutosize ? \"\" : null",
787
832
  "[attr.rows]": "rows()",
833
+ "[style.--composer-min-rows]": "rows()",
834
+ "[style.--composer-max-block-size]": "maxBlockSize()",
788
835
  "[attr.disabled]": "disabled() ? \"\" : null",
789
836
  "[attr.aria-invalid]": "invalid() ? \"true\" : null",
790
837
  "(input)": "handleInput()",
791
838
  "(blur)": "handleBlur()",
792
839
  "(keydown)": "handleKeydown($event)"
793
840
  },
794
- template: ""
841
+ template: "",
842
+ styles: [":host([data-native-autosize]){field-sizing:content;block-size:auto;min-block-size:max(var(--control-height-10, 0px),calc(var(--composer-min-rows) * 1lh + var(--composer-block-inset, 0px)));max-block-size:var(--composer-max-block-size, none);overflow-y:auto}\n"]
795
843
  }]
796
844
  }],
845
+ ctorParameters: () => [],
797
846
  propDecorators: {
798
847
  rows: [{
799
848
  type: i0.Input,
@@ -1,6 +1,6 @@
1
1
  import { DOCUMENT } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
- import { Component, ElementRef, InjectionToken, SecurityContext, booleanAttribute, computed, forwardRef, inject, input, output, signal } from "@angular/core";
3
+ import { Component, ElementRef, InjectionToken, SecurityContext, booleanAttribute, computed, forwardRef, inject, input, output, signal, viewChild } from "@angular/core";
4
4
  import { NG_VALUE_ACCESSOR } from "@angular/forms";
5
5
  import { cn } from "@edsis/angular/component/utils/core";
6
6
  import { DomSanitizer } from "@angular/platform-browser";
@@ -36,6 +36,7 @@ const EDITOR_CONTENT_BASE = [
36
36
  "block min-h-50 max-h-125 w-full overflow-y-auto px-4 py-3 text-sm leading-6 outline-none",
37
37
  "[&_p]:my-2 [&_h1]:mb-2 [&_h1]:mt-4 [&_h1]:text-2xl [&_h1]:font-semibold [&_h2]:mb-2 [&_h2]:mt-4 [&_h2]:text-xl [&_h2]:font-semibold [&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:text-lg [&_h3]:font-semibold",
38
38
  "[&_blockquote]:my-3 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-6 [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-xs",
39
+ "[&_mark]:bg-[hsl(var(--editor-highlight,48_96%_80%))] [&_mark]:text-inherit",
39
40
  "data-[empty=true]:before:pointer-events-none data-[empty=true]:before:text-muted-foreground data-[empty=true]:before:content-[attr(data-placeholder)]",
40
41
  "data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50"
41
42
  ].join(" ");
@@ -707,6 +708,7 @@ var EditorContentComponent = class EditorContentComponent {
707
708
  editor = inject(EditorComponent, { optional: true });
708
709
  document = inject(DOCUMENT);
709
710
  sanitizeHtml = inject(EDITOR_HTML_SANITIZER);
711
+ htmlParser = viewChild("htmlParser", ...ngDevMode ? [{ debugName: "htmlParser" }] : /* istanbul ignore next */ []);
710
712
  placeholder = input("Write something...", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
711
713
  ariaLabel = input("Rich text editor", {
712
714
  ...ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {},
@@ -729,11 +731,15 @@ var EditorContentComponent = class EditorContentComponent {
729
731
  invalid = computed(() => this.invalidInput() || this.editor?.invalid() === true, ...ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []);
730
732
  classes = computed(() => cn(EDITOR_CONTENT_BASE, this.class()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
731
733
  lastKnownValue = "";
734
+ pendingValue;
732
735
  onChange = () => {};
733
736
  onTouched = () => {};
734
737
  ngAfterViewInit() {
735
738
  this.editor?.registerContent(this);
736
- this.setSanitizedValue(this.el.nativeElement.innerHTML);
739
+ (this.htmlParser()?.elementRef.nativeElement)?.remove();
740
+ const value = this.pendingValue ?? this.el.nativeElement.innerHTML;
741
+ this.pendingValue = void 0;
742
+ this.setSanitizedValue(value);
737
743
  queueMicrotask(() => this.syncEmptyState());
738
744
  }
739
745
  ngOnDestroy() {
@@ -763,19 +769,48 @@ var EditorContentComponent = class EditorContentComponent {
763
769
  this.el.nativeElement.focus();
764
770
  }
765
771
  handleInput() {
766
- const element = this.el.nativeElement;
767
- const unsafeHtml = element.innerHTML;
768
- const safeHtml = this.sanitizeHtml(unsafeHtml);
769
- if (safeHtml !== unsafeHtml) element.innerHTML = safeHtml;
770
- const html = element.innerHTML;
772
+ const parser = this.htmlParser();
773
+ if (!parser) return;
774
+ const current = this.serializeContent();
775
+ const sanitized = this.sanitizeHtml(current);
776
+ const html = sanitized === current ? current : this.renderHtml(parser, sanitized);
771
777
  this.syncEmptyState();
772
778
  if (html === this.lastKnownValue) return;
773
779
  this.lastKnownValue = html;
774
780
  this.onChange(html);
775
781
  }
776
782
  setSanitizedValue(value) {
777
- this.el.nativeElement.innerHTML = this.sanitizeHtml(value);
778
- this.lastKnownValue = this.el.nativeElement.innerHTML;
783
+ const parser = this.htmlParser();
784
+ if (!parser) {
785
+ this.pendingValue = value;
786
+ return;
787
+ }
788
+ const html = this.sanitizeHtml(value);
789
+ this.lastKnownValue = html === this.serializeContent() ? html : this.renderHtml(parser, html);
790
+ }
791
+ renderHtml(parser, html) {
792
+ const view = parser.createEmbeddedView({ $implicit: html });
793
+ try {
794
+ view.detectChanges();
795
+ const template = view.rootNodes[0];
796
+ const element = this.el.nativeElement;
797
+ element.replaceChildren(template.content);
798
+ return element.innerHTML;
799
+ } finally {
800
+ view.destroy();
801
+ }
802
+ }
803
+ serializeContent() {
804
+ const element = this.el.nativeElement;
805
+ if (!element.querySelector("span[style]")) return element.innerHTML;
806
+ const inertDocument = this.document.createElement("template").content.ownerDocument;
807
+ const snapshot = inertDocument.importNode(element, true);
808
+ for (const span of snapshot.querySelectorAll("span[style]")) if (span.attributes.length === 1 && span.style.length === 1 && span.style.backgroundColor) {
809
+ const mark = inertDocument.createElement("mark");
810
+ mark.append(...span.childNodes);
811
+ span.replaceWith(mark);
812
+ }
813
+ return snapshot.innerHTML;
779
814
  }
780
815
  handleBlur() {
781
816
  this.onTouched();
@@ -847,7 +882,7 @@ var EditorContentComponent = class EditorContentComponent {
847
882
  target: i0.ɵɵFactoryTarget.Component
848
883
  });
849
884
  static ɵcmp = i0.ɵɵngDeclareComponent({
850
- minVersion: "17.1.0",
885
+ minVersion: "17.2.0",
851
886
  version: "22.2.6",
852
887
  type: EditorContentComponent,
853
888
  isStandalone: true,
@@ -915,8 +950,20 @@ var EditorContentComponent = class EditorContentComponent {
915
950
  useExisting: forwardRef(() => EditorContentComponent),
916
951
  multi: true
917
952
  }],
953
+ viewQueries: [{
954
+ propertyName: "htmlParser",
955
+ first: true,
956
+ predicate: ["htmlParser"],
957
+ descendants: true,
958
+ isSignal: true
959
+ }],
918
960
  ngImport: i0,
919
- template: `<ng-content />`,
961
+ template: `
962
+ <ng-content />
963
+ <ng-template #htmlParser let-html>
964
+ <template [innerHTML]="html"></template>
965
+ </ng-template>
966
+ `,
920
967
  isInline: true
921
968
  });
922
969
  };
@@ -951,10 +998,19 @@ i0.ɵɵngDeclareClassMetadata({
951
998
  "(blur)": "handleBlur()",
952
999
  "(keydown)": "handleKeydown($event)"
953
1000
  },
954
- template: `<ng-content />`
1001
+ template: `
1002
+ <ng-content />
1003
+ <ng-template #htmlParser let-html>
1004
+ <template [innerHTML]="html"></template>
1005
+ </ng-template>
1006
+ `
955
1007
  }]
956
1008
  }],
957
1009
  propDecorators: {
1010
+ htmlParser: [{
1011
+ type: i0.ViewChild,
1012
+ args: ["htmlParser", { isSignal: true }]
1013
+ }],
958
1014
  placeholder: [{
959
1015
  type: i0.Input,
960
1016
  args: [{
@@ -338,13 +338,19 @@ var StorageCoordinator = class {
338
338
  this.fail();
339
339
  return;
340
340
  }
341
+ let actionFailed = false;
341
342
  await manager.request(LOCK_NAME, {
342
343
  mode: "exclusive",
343
344
  signal: controller.signal
344
345
  }, () => {
345
346
  clearTimeout(timeout);
346
- if (!this.destroyed && !controller.signal.aborted) action();
347
+ try {
348
+ if (!this.destroyed && !controller.signal.aborted) action();
349
+ } catch {
350
+ actionFailed = true;
351
+ }
347
352
  });
353
+ if (actionFailed) this.fail();
348
354
  } catch {
349
355
  this.fail();
350
356
  } finally {
@@ -1,5 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Service, computed, effect, signal } from "@angular/core";
2
+ import { ElementRef, Injectable, Service, afterRenderEffect, computed, inject, signal } from "@angular/core";
3
+ import { Overlay, OverlayContainer } from "@angular/cdk/overlay";
3
4
  const PAGE_VARIANTS = ["stacked", "side"];
4
5
  const PAGE_SIDE_POSITIONS = ["left", "right"];
5
6
  const PAGE_SIDE_MODES = [
@@ -203,113 +204,180 @@ i0.ɵɵngDeclareClassMetadata({
203
204
  args: [{ autoProvided: false }]
204
205
  }]
205
206
  });
206
- const FOCUSABLE_SELECTOR = [
207
- "a[href]",
208
- "button:not([disabled])",
209
- "input:not([disabled])",
210
- "select:not([disabled])",
211
- "textarea:not([disabled])",
212
- "[tabindex]:not([tabindex=\"-1\"])"
213
- ].join(",");
214
- const inertLocks = /* @__PURE__ */ new WeakMap();
215
- const scrollLocks = /* @__PURE__ */ new WeakMap();
207
+ const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, summary, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]";
208
+ const modalStacks = /* @__PURE__ */ new WeakMap();
209
+ function ɵisActivePageOverlay(document, id) {
210
+ return id !== null && modalStacks.get(document)?.active?.id === id;
211
+ }
216
212
  function ɵsetupOverlayFocusManagement(config) {
217
- effect((onCleanup) => {
213
+ afterRenderEffect({ mixedReadWrite: (onCleanup) => {
218
214
  if (!config.isInteractive() || !config.isOpen()) return;
219
- const document = config.document;
215
+ const { document, host } = config;
220
216
  const view = document?.defaultView;
221
- if (!document || !view) return;
217
+ if (!document || !view || !host.isConnected) return;
222
218
  const returnFocus = config.takeReturnFocus?.() ?? document.activeElement;
223
219
  const modal = config.isModal();
224
- const inertSnapshots = modal ? makeBackgroundInert(config.host) : [];
225
- if (modal) lockDocumentScroll(document);
226
- const handleKeydown = (event) => {
227
- if (!modal || event.key !== "Tab") return;
228
- const focusable = getFocusableElements(config.host);
229
- if (focusable.length === 0) {
230
- event.preventDefault();
231
- config.host.focus();
232
- return;
233
- }
234
- const active = document.activeElement;
235
- const first = focusable[0];
236
- const last = focusable.at(-1);
237
- const activeIndex = focusable.indexOf(active);
238
- if (event.shiftKey && activeIndex <= 0) {
239
- event.preventDefault();
240
- last.focus();
241
- } else if (!event.shiftKey && (activeIndex === -1 || active === last)) {
242
- event.preventDefault();
243
- first.focus();
244
- }
220
+ const stack = modal ? getModalStack(document) : void 0;
221
+ stack?.open(host);
222
+ let childEscape;
223
+ const onKeydownCapture = (event) => {
224
+ if (event.key === "Escape" && host.querySelector(".cdk-overlay-pane:not(:empty)")) childEscape = event;
245
225
  };
246
- config.host.addEventListener("keydown", handleKeydown);
226
+ const onKeydown = (event) => {
227
+ const activeModal = modalStacks.get(document)?.active;
228
+ if (event.defaultPrevented || activeModal && activeModal !== host) return;
229
+ if (event.key === "Escape" && config.closeOnEsc?.() && childEscape !== event) {
230
+ if (modal) event.preventDefault();
231
+ config.close?.();
232
+ } else if (modal && event.key === "Tab") trapTab(host, event);
233
+ };
234
+ view.addEventListener("keydown", onKeydownCapture, true);
235
+ view.addEventListener("keydown", onKeydown);
247
236
  const animationFrame = view.requestAnimationFrame(() => {
248
- (config.host.querySelector("[data-page-initial-focus], [autofocus]") ?? getFocusableElements(config.host)[0] ?? config.host).focus();
237
+ const activeModal = modalStacks.get(document)?.active;
238
+ if (!activeModal || activeModal === host) focusPanel(host);
249
239
  });
250
240
  onCleanup(() => {
251
241
  view.cancelAnimationFrame(animationFrame);
252
- config.host.removeEventListener("keydown", handleKeydown);
253
- restoreBackground(inertSnapshots);
254
- if (modal) unlockDocumentScroll(document);
255
- if (returnFocus?.isConnected && typeof returnFocus.focus === "function") view.requestAnimationFrame(() => returnFocus.focus());
242
+ view.removeEventListener("keydown", onKeydownCapture, true);
243
+ view.removeEventListener("keydown", onKeydown);
244
+ const wasTop = !stack || stack.active === host;
245
+ stack?.close(host);
246
+ if (wasTop) view.requestAnimationFrame(() => {
247
+ const active = modalStacks.get(document)?.active;
248
+ if (returnFocus instanceof HTMLElement && returnFocus.isConnected && !returnFocus.closest("[inert]") && (!active || active.contains(returnFocus))) returnFocus.focus({ preventScroll: true });
249
+ else if (active && !active.contains(document.activeElement)) focusPanel(active);
250
+ });
256
251
  });
257
- });
252
+ } });
253
+ }
254
+ function trapTab(host, event) {
255
+ const focusable = getFocusableElements(host);
256
+ const index = focusable.indexOf(host.ownerDocument.activeElement);
257
+ if (index < 0 || (event.shiftKey ? index === 0 : index === focusable.length - 1)) {
258
+ event.preventDefault();
259
+ ((event.shiftKey ? focusable.at(-1) : focusable[0]) ?? host).focus({ preventScroll: true });
260
+ }
261
+ }
262
+ function focusPanel(host) {
263
+ (host.querySelector("[data-page-initial-focus], [autofocus]") ?? getFocusableElements(host)[0] ?? host).focus({ preventScroll: true });
264
+ if (!host.contains(host.ownerDocument.activeElement)) (getFocusableElements(host)[0] ?? host).focus({ preventScroll: true });
258
265
  }
259
266
  function getFocusableElements(host) {
260
- return Array.from(host.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => !element.hidden && !element.inert && element.getAttribute("aria-hidden") !== "true");
267
+ return Array.from(host.querySelectorAll(FOCUSABLE_SELECTOR)).filter((element) => !element.matches(":disabled, [tabindex=\"-1\"], input[type=\"hidden\"]") && !element.closest("[hidden], [inert], [aria-hidden=\"true\"]") && (element.checkVisibility?.({ visibilityProperty: true }) ?? host.ownerDocument.defaultView?.getComputedStyle(element).visibility !== "hidden"));
261
268
  }
262
- function makeBackgroundInert(host) {
263
- const snapshots = [];
264
- const pageRoot = host.closest("Page");
265
- if (!pageRoot) return snapshots;
266
- let branch = host;
267
- let parent = branch.parentElement;
268
- while (parent) {
269
- for (const sibling of Array.from(parent.children)) {
270
- if (sibling === branch || !(sibling instanceof HTMLElement) || sibling.hasAttribute("data-page-overlay-backdrop")) continue;
271
- const lock = inertLocks.get(sibling);
272
- if (lock) lock.count += 1;
273
- else inertLocks.set(sibling, {
274
- count: 1,
275
- initial: sibling.inert === true
276
- });
277
- snapshots.push({ element: sibling });
278
- sibling.inert = true;
279
- }
280
- if (parent === pageRoot) break;
281
- branch = parent;
282
- parent = parent.parentElement;
269
+ function getModalStack(document) {
270
+ let stack = modalStacks.get(document);
271
+ if (!stack) {
272
+ stack = new PageModalStack(document);
273
+ modalStacks.set(document, stack);
283
274
  }
284
- return snapshots;
275
+ return stack;
285
276
  }
286
- function restoreBackground(snapshots) {
287
- for (const snapshot of snapshots) {
288
- const lock = inertLocks.get(snapshot.element);
289
- if (!lock) continue;
290
- lock.count -= 1;
291
- if (lock.count === 0) {
292
- snapshot.element.inert = lock.initial;
293
- inertLocks.delete(snapshot.element);
277
+ var PageModalStack = class {
278
+ document;
279
+ panels = [];
280
+ background = /* @__PURE__ */ new Set();
281
+ ancestorOverflow = /* @__PURE__ */ new Map();
282
+ observer = new MutationObserver(() => this.isolate());
283
+ constructor(document) {
284
+ this.document = document;
285
+ }
286
+ get active() {
287
+ return this.panels.at(-1);
288
+ }
289
+ open(panel) {
290
+ this.panels.push(panel);
291
+ this.isolate();
292
+ }
293
+ close(panel) {
294
+ this.panels.splice(this.panels.indexOf(panel), 1);
295
+ this.isolate();
296
+ if (!this.active) modalStacks.delete(this.document);
297
+ }
298
+ isolate() {
299
+ this.observer.disconnect();
300
+ const keep = /* @__PURE__ */ new Set();
301
+ const host = this.active;
302
+ if (host?.isConnected) {
303
+ const backdrop = host.closest("[data-page-root]")?.querySelector(":scope > [data-page-overlay-backdrop]");
304
+ for (const node of [host, backdrop]) for (let branch = node; branch && branch !== this.document.body; branch = branch.parentElement) keep.add(branch);
305
+ }
306
+ this.lockAncestorScroll(host);
307
+ const blocked = /* @__PURE__ */ new Set();
308
+ for (const branch of keep) {
309
+ const parent = branch.parentElement;
310
+ if (parent) {
311
+ this.observer.observe(parent, { childList: true });
312
+ for (const sibling of parent.children) if (!keep.has(sibling)) blocked.add(sibling);
313
+ }
314
+ }
315
+ for (const element of this.background) if (!blocked.has(element)) {
316
+ if (!element.matches("[data-page-slot]:is([data-page-side-mode], [data-page-filter-mode])[aria-hidden=\"true\"]")) element.removeAttribute("inert");
317
+ this.background.delete(element);
318
+ }
319
+ for (const element of blocked) if (!element.hasAttribute("inert")) {
320
+ element.setAttribute("inert", "");
321
+ this.background.add(element);
294
322
  }
295
323
  }
296
- }
297
- function lockDocumentScroll(document) {
298
- const lock = scrollLocks.get(document);
299
- if (lock) lock.count += 1;
300
- else scrollLocks.set(document, {
301
- count: 1,
302
- initialOverflow: document.body.style.overflow
303
- });
304
- document.body.style.overflow = "hidden";
305
- }
306
- function unlockDocumentScroll(document) {
307
- const lock = scrollLocks.get(document);
308
- if (!lock) return;
309
- lock.count -= 1;
310
- if (lock.count === 0) {
311
- document.body.style.overflow = lock.initialOverflow;
312
- scrollLocks.delete(document);
324
+ lockAncestorScroll(host) {
325
+ for (const [element, previous] of this.ancestorOverflow) if (!host?.isConnected || !element.contains(host) || element === host) {
326
+ element.style.overflow = previous.value;
327
+ element.style.overflowX = previous.x;
328
+ element.style.overflowY = previous.y;
329
+ this.ancestorOverflow.delete(element);
330
+ }
331
+ for (let element = host?.isConnected ? host.parentElement : null; element && element !== this.document.documentElement; element = element.parentElement) {
332
+ if (this.ancestorOverflow.has(element)) continue;
333
+ const style = this.document.defaultView?.getComputedStyle(element);
334
+ if (element === this.document.body || style && /auto|scroll/.test(`${style.overflowX} ${style.overflowY}`)) {
335
+ this.ancestorOverflow.set(element, {
336
+ value: element.style.overflow,
337
+ x: element.style.overflowX,
338
+ y: element.style.overflowY
339
+ });
340
+ element.style.overflow = "hidden";
341
+ }
342
+ }
313
343
  }
314
- }
315
- export { PAGE_APPEARANCES, PAGE_DEFAULT_APPEARANCE, PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_POSITION, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_HEIGHT, PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_MODE, PAGE_DEFAULT_SIDE_POSITION, PAGE_DEFAULT_SIDE_WIDTH, PAGE_DEFAULT_VARIANT, PAGE_FILTER_PLACEMENTS, PAGE_HEIGHT_VALUES, PAGE_SCROLL_VALUES, PAGE_SIDE_MODES, PAGE_SIDE_POSITIONS, PAGE_VARIANTS, PageStateService, isUiPageAppearance, isUiPageFilterPlacement, isUiPageHeight, isUiPageScroll, isUiPageSideMode, isUiPageSidePosition, isUiPageVariant, ɵsetupOverlayFocusManagement };
344
+ };
345
+ var PagePanelOverlayContainer = class PagePanelOverlayContainer extends OverlayContainer {
346
+ panel = inject(ElementRef).nativeElement;
347
+ parent = inject(OverlayContainer, { skipSelf: true });
348
+ getContainerElement() {
349
+ return this.panel.getAttribute("aria-modal") === "true" ? super.getContainerElement() : this.parent.getContainerElement();
350
+ }
351
+ _createContainer() {
352
+ const container = this.panel.ownerDocument.createElement("div");
353
+ container.classList.add("cdk-overlay-container");
354
+ this.panel.append(container);
355
+ this._containerElement = container;
356
+ }
357
+ static ɵfac = i0.ɵɵngDeclareFactory({
358
+ minVersion: "12.0.0",
359
+ version: "22.2.6",
360
+ ngImport: i0,
361
+ type: PagePanelOverlayContainer,
362
+ deps: null,
363
+ target: i0.ɵɵFactoryTarget.Injectable
364
+ });
365
+ static ɵprov = i0.ɵɵngDeclareInjectable({
366
+ minVersion: "12.0.0",
367
+ version: "22.2.6",
368
+ ngImport: i0,
369
+ type: PagePanelOverlayContainer
370
+ });
371
+ };
372
+ i0.ɵɵngDeclareClassMetadata({
373
+ minVersion: "12.0.0",
374
+ version: "22.2.6",
375
+ ngImport: i0,
376
+ type: PagePanelOverlayContainer,
377
+ decorators: [{ type: Injectable }]
378
+ });
379
+ const ɵPAGE_PANEL_OVERLAY_PROVIDERS = [Overlay, {
380
+ provide: OverlayContainer,
381
+ useClass: PagePanelOverlayContainer
382
+ }];
383
+ export { PAGE_APPEARANCES, PAGE_DEFAULT_APPEARANCE, PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_POSITION, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_HEIGHT, PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_MODE, PAGE_DEFAULT_SIDE_POSITION, PAGE_DEFAULT_SIDE_WIDTH, PAGE_DEFAULT_VARIANT, PAGE_FILTER_PLACEMENTS, PAGE_HEIGHT_VALUES, PAGE_SCROLL_VALUES, PAGE_SIDE_MODES, PAGE_SIDE_POSITIONS, PAGE_VARIANTS, PageStateService, isUiPageAppearance, isUiPageFilterPlacement, isUiPageHeight, isUiPageScroll, isUiPageSideMode, isUiPageSidePosition, isUiPageVariant, ɵPAGE_PANEL_OVERLAY_PROVIDERS, ɵisActivePageOverlay, ɵsetupOverlayFocusManagement };
@@ -1,8 +1,8 @@
1
1
  import { DOCUMENT } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
- import { Component, ElementRef, booleanAttribute, computed, effect, inject, input, output, untracked } from "@angular/core";
3
+ import { Component, ElementRef, booleanAttribute, computed, effect, inject, input, output } from "@angular/core";
4
4
  import { cn } from "@edsis/angular/component/utils/core";
5
- import { PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_SCROLL, PageStateService, ɵsetupOverlayFocusManagement } from "@edsis/angular/theme/page/core";
5
+ import { PAGE_DEFAULT_FILTER_MODE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_SCROLL, PageStateService, ɵPAGE_PANEL_OVERLAY_PROVIDERS, ɵsetupOverlayFocusManagement } from "@edsis/angular/theme/page/core";
6
6
  let nextPageFilterId = 0;
7
7
  const FILTER_BG = "bg-surface/50";
8
8
  const FILTER_BG_OPAQUE = "bg-[color-mix(in_srgb,var(--color-surface)_50%,var(--color-background))]";
@@ -44,7 +44,7 @@ var PageFilterComponent = class PageFilterComponent {
44
44
  const scroll = this.resolvedScroll();
45
45
  const open = this.page.filterOpen();
46
46
  if (this.isStacked()) return cn("block shrink-0 border-b border-border text-surface-foreground", scroll === "page" ? `sticky top-0 z-10 ${FILTER_BG_OPAQUE}` : FILTER_BG, this.class(), this.isCollapsedStacked() && "hidden");
47
- return cn("block min-h-0 border-border text-surface-foreground", this.isSticky() ? FILTER_BG : FILTER_BG_OPAQUE, scroll === "content" && "h-full overflow-auto", scroll === "page" && "overflow-visible", this.isSticky() && "shrink-0 w-[var(--page-filter-width)]", this.isSticky() && position === "left" && "border-r", this.isSticky() && position === "right" && "order-last border-l", this.isDrawer() && "absolute inset-y-0 z-20 w-[var(--page-filter-width)] border shadow-sm transition-transform duration-normal ease-out motion-reduce:transition-none", this.isDrawer() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isDrawer() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.isOverlay() && "absolute inset-y-0 z-30 w-[var(--page-filter-width)] border shadow-md transition-transform duration-normal ease-out motion-reduce:transition-none", this.isOverlay() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isOverlay() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.class());
47
+ return cn("block min-h-0 border-border text-surface-foreground", this.isSticky() ? FILTER_BG : FILTER_BG_OPAQUE, scroll === "content" && "h-full overflow-auto", scroll === "page" && "overflow-visible", this.isSticky() && "shrink-0 w-[var(--page-filter-width)]", this.isSticky() && position === "left" && "border-r", this.isSticky() && position === "right" && "order-last border-l", this.isDrawer() && "absolute inset-y-0 z-20 w-[var(--page-filter-width)] border shadow-sm transition-transform duration-normal ease-out motion-reduce:transition-none", this.isDrawer() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isDrawer() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.isOverlay() && "overflow-auto overscroll-contain [&:not([inert])]:z-40 [&[inert]>.cdk-overlay-container]:hidden", this.isOverlay() && "absolute inset-y-0 z-30 w-[var(--page-filter-width)] border shadow-md transition-transform duration-normal ease-out motion-reduce:transition-none", this.isOverlay() && position === "left" && (open ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isOverlay() && position === "right" && (open ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.class());
48
48
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
49
49
  constructor() {
50
50
  ɵsetupOverlayFocusManagement({
@@ -53,6 +53,8 @@ var PageFilterComponent = class PageFilterComponent {
53
53
  isOpen: this.page.filterOpen,
54
54
  isInteractive: this.isInteractive,
55
55
  isModal: this.isOverlay,
56
+ closeOnEsc: this.closeOnEsc,
57
+ close: () => this.page.closeFilter(),
56
58
  takeReturnFocus: () => this.page.takeFilterReturnFocus()
57
59
  });
58
60
  effect(() => {
@@ -64,20 +66,6 @@ var PageFilterComponent = class PageFilterComponent {
64
66
  id: this.resolvedId
65
67
  });
66
68
  });
67
- effect((onCleanup) => {
68
- if (!this.closeOnEsc() || this.isSticky()) return;
69
- const defaultView = this.document?.defaultView;
70
- if (!defaultView) return;
71
- const handler = (event) => {
72
- if (event.key !== "Escape") return;
73
- if (!untracked(() => this.page.filterOpen())) return;
74
- untracked(() => {
75
- this.page.closeFilter();
76
- });
77
- };
78
- defaultView.addEventListener("keydown", handler);
79
- onCleanup(() => defaultView.removeEventListener("keydown", handler));
80
- });
81
69
  }
82
70
  static ɵfac = i0.ɵɵngDeclareFactory({
83
71
  minVersion: "12.0.0",
@@ -165,8 +153,10 @@ var PageFilterComponent = class PageFilterComponent {
165
153
  "attr.aria-modal": "ariaModal()",
166
154
  "attr.aria-label": "dialogLabel()",
167
155
  "attr.tabindex": "dialogTabindex()",
156
+ "style.translate": "isOverlay() && page.filterOpen() ? \"none\" : null",
168
157
  "style.--page-filter-width": "resolvedWidth()"
169
158
  } },
159
+ providers: ɵPAGE_PANEL_OVERLAY_PROVIDERS,
170
160
  ngImport: i0,
171
161
  template: `<ng-content />`,
172
162
  isInline: true
@@ -181,6 +171,7 @@ i0.ɵɵngDeclareClassMetadata({
181
171
  type: Component,
182
172
  args: [{
183
173
  selector: "PageFilter",
174
+ providers: ɵPAGE_PANEL_OVERLAY_PROVIDERS,
184
175
  host: {
185
176
  "[class]": "classes()",
186
177
  "[attr.id]": "resolvedId",
@@ -195,6 +186,7 @@ i0.ɵɵngDeclareClassMetadata({
195
186
  "[attr.aria-modal]": "ariaModal()",
196
187
  "[attr.aria-label]": "dialogLabel()",
197
188
  "[attr.tabindex]": "dialogTabindex()",
189
+ "[style.translate]": "isOverlay() && page.filterOpen() ? \"none\" : null",
198
190
  "[style.--page-filter-width]": "resolvedWidth()"
199
191
  },
200
192
  template: `<ng-content />`
@@ -1,3 +1,4 @@
1
+ import { DOCUMENT } from "@angular/common";
1
2
  import * as i0 from "@angular/core";
2
3
  import { Component, booleanAttribute, computed, contentChild, effect, inject, input, output } from "@angular/core";
3
4
  import { Grip } from "lucide";
@@ -11,7 +12,7 @@ import { PageFilterComponent } from "@edsis/angular/theme/page/filter";
11
12
  import { PageOverviewComponent } from "@edsis/angular/theme/page/overview";
12
13
  import { PageHeaderComponent } from "@edsis/angular/theme/page/slots";
13
14
  import { PageSideComponent } from "@edsis/angular/theme/page/side";
14
- import { PAGE_DEFAULT_APPEARANCE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_HEIGHT, PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_MODE, PAGE_DEFAULT_SIDE_POSITION, PAGE_DEFAULT_SIDE_WIDTH, PAGE_DEFAULT_VARIANT, PageStateService } from "@edsis/angular/theme/page/core";
15
+ import { PAGE_DEFAULT_APPEARANCE, PAGE_DEFAULT_FILTER_PLACEMENT, PAGE_DEFAULT_FILTER_WIDTH, PAGE_DEFAULT_HEIGHT, PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_MODE, PAGE_DEFAULT_SIDE_POSITION, PAGE_DEFAULT_SIDE_WIDTH, PAGE_DEFAULT_VARIANT, PageStateService, ɵisActivePageOverlay } from "@edsis/angular/theme/page/core";
15
16
  const OVERVIEW_STACKED_ROWS = [
16
17
  "grid-rows-[auto_auto_minmax(0,1fr)]",
17
18
  "[&>[data-page-slot=filter]]:row-start-1",
@@ -28,6 +29,7 @@ const OVERVIEW_ROWS = [
28
29
  let pageAppsLauncherInstanceId = 0;
29
30
  var PageComponent = class PageComponent {
30
31
  page = inject(PageStateService);
32
+ document = inject(DOCUMENT);
31
33
  layout = inject(LayoutService, { optional: true });
32
34
  navigation = inject(NAVIGATION_ADAPTER, { optional: true });
33
35
  identity = inject(LayoutIdentityService, { optional: true });
@@ -77,7 +79,7 @@ var PageComponent = class PageComponent {
77
79
  appsBrand = computed(() => this.identity?.brand() ?? null, ...ngDevMode ? [{ debugName: "appsBrand" }] : /* istanbul ignore next */ []);
78
80
  appsUser = computed(() => this.identity?.user() ?? null, ...ngDevMode ? [{ debugName: "appsUser" }] : /* istanbul ignore next */ []);
79
81
  hostClasses = computed(() => cn("relative block h-full min-h-0 w-full min-w-0 overflow-hidden text-foreground", this.class()), ...ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []);
80
- shellClasses = computed(() => cn("relative z-10 h-full min-h-0 w-full min-w-0", this.scroll() === "content" && "grid grid-rows-[auto_minmax(0,1fr)_auto]", this.scroll() === "page" && "overflow-auto"), ...ngDevMode ? [{ debugName: "shellClasses" }] : /* istanbul ignore next */ []);
82
+ shellClasses = computed(() => cn("relative h-full min-h-0 w-full min-w-0", !this.showsOverlayBackdrop() && "z-10", this.scroll() === "content" && "grid grid-rows-[auto_minmax(0,1fr)_auto]", this.scroll() === "page" && "overflow-auto"), ...ngDevMode ? [{ debugName: "shellClasses" }] : /* istanbul ignore next */ []);
81
83
  bodyClasses = computed(() => {
82
84
  if (this.variant() !== "side") return cn("relative min-w-0", this.scroll() === "content" && "min-h-0");
83
85
  const sideMode = this.resolvedSideMode();
@@ -132,8 +134,8 @@ var PageComponent = class PageComponent {
132
134
  });
133
135
  }
134
136
  handleBackdropClick() {
135
- if (this.showsSideOverlayBackdrop()) this.page.closeSide();
136
- if (this.showsFilterOverlayBackdrop()) this.page.closeFilter();
137
+ if (ɵisActivePageOverlay(this.document, this.page.sideId())) this.page.closeSide();
138
+ else if (ɵisActivePageOverlay(this.document, this.page.filterId())) this.page.closeFilter();
137
139
  }
138
140
  static ɵfac = i0.ɵɵngDeclareFactory({
139
141
  minVersion: "12.0.0",
@@ -319,9 +321,12 @@ var PageComponent = class PageComponent {
319
321
  @if (showsOverlayBackdrop()) {
320
322
  <button
321
323
  type="button"
324
+ tabindex="-1"
325
+ aria-hidden="true"
322
326
  [attr.aria-label]="overlayCloseLabel()"
323
327
  data-page-overlay-backdrop
324
- class="absolute inset-0 z-20 bg-[hsl(var(--overlay-backdrop))]"
328
+ class="absolute inset-0 z-20 overflow-hidden overscroll-contain bg-[hsl(var(--overlay-backdrop))]"
329
+ (mousedown)="$event.preventDefault()"
325
330
  (click)="handleBackdropClick()"
326
331
  ></button>
327
332
  }
@@ -497,9 +502,12 @@ i0.ɵɵngDeclareClassMetadata({
497
502
  @if (showsOverlayBackdrop()) {
498
503
  <button
499
504
  type="button"
505
+ tabindex="-1"
506
+ aria-hidden="true"
500
507
  [attr.aria-label]="overlayCloseLabel()"
501
508
  data-page-overlay-backdrop
502
- class="absolute inset-0 z-20 bg-[hsl(var(--overlay-backdrop))]"
509
+ class="absolute inset-0 z-20 overflow-hidden overscroll-contain bg-[hsl(var(--overlay-backdrop))]"
510
+ (mousedown)="$event.preventDefault()"
503
511
  (click)="handleBackdropClick()"
504
512
  ></button>
505
513
  }
@@ -1,8 +1,8 @@
1
1
  import { DOCUMENT } from "@angular/common";
2
2
  import * as i0 from "@angular/core";
3
- import { Component, ElementRef, computed, effect, inject, input, output, untracked } from "@angular/core";
3
+ import { Component, ElementRef, computed, effect, inject, input, output } from "@angular/core";
4
4
  import { cn } from "@edsis/angular/component/utils/core";
5
- import { PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_WIDTH, PageStateService, ɵsetupOverlayFocusManagement } from "@edsis/angular/theme/page/core";
5
+ import { PAGE_DEFAULT_SCROLL, PAGE_DEFAULT_SIDE_WIDTH, PageStateService, ɵPAGE_PANEL_OVERLAY_PROVIDERS, ɵsetupOverlayFocusManagement } from "@edsis/angular/theme/page/core";
6
6
  let nextPageSideId = 0;
7
7
  var PageSideComponent = class PageSideComponent {
8
8
  document = inject(DOCUMENT, { optional: true });
@@ -32,15 +32,17 @@ var PageSideComponent = class PageSideComponent {
32
32
  classes = computed(() => {
33
33
  const position = this.resolvedPosition();
34
34
  const sideOpen = this.page.sideOpen();
35
- return cn("block min-h-0 border-border bg-background", this.resolvedScroll() === "content" && "h-full overflow-auto", this.resolvedScroll() === "page" && "overflow-visible", this.isSticky() && "shrink-0 w-[var(--page-side-width)]", this.isSticky() && position === "left" && "border-r", this.isSticky() && position === "right" && "order-last border-l", this.isDrawer() && "absolute inset-y-0 z-20 w-[var(--page-side-width)] border shadow-sm transition-transform duration-normal ease-out motion-reduce:transition-none", this.isDrawer() && position === "left" && (sideOpen ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isDrawer() && position === "right" && (sideOpen ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.isOverlay() && "absolute inset-y-0 z-30 w-[var(--page-side-width)] border shadow-md transition-transform duration-normal ease-out motion-reduce:transition-none", this.isOverlay() && position === "left" && (sideOpen ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isOverlay() && position === "right" && (sideOpen ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.class());
35
+ return cn("block min-h-0 border-border bg-background", this.resolvedScroll() === "content" && "h-full overflow-auto", this.resolvedScroll() === "page" && "overflow-visible", this.isSticky() && "shrink-0 w-[var(--page-side-width)]", this.isSticky() && position === "left" && "border-r", this.isSticky() && position === "right" && "order-last border-l", this.isDrawer() && "absolute inset-y-0 z-20 w-[var(--page-side-width)] border shadow-sm transition-transform duration-normal ease-out motion-reduce:transition-none", this.isDrawer() && position === "left" && (sideOpen ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isDrawer() && position === "right" && (sideOpen ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.isOverlay() && "overflow-auto overscroll-contain [&:not([inert])]:z-40 [&[inert]>.cdk-overlay-container]:hidden", this.isOverlay() && "absolute inset-y-0 z-30 w-[var(--page-side-width)] border shadow-md transition-transform duration-normal ease-out motion-reduce:transition-none", this.isOverlay() && position === "left" && (sideOpen ? "left-0 translate-x-0" : "left-0 -translate-x-full"), this.isOverlay() && position === "right" && (sideOpen ? "right-0 translate-x-0" : "right-0 translate-x-full"), this.class());
36
36
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
37
37
  constructor() {
38
38
  ɵsetupOverlayFocusManagement({
39
39
  document: this.document,
40
40
  host: this.host.nativeElement,
41
- isOpen: this.page.sideOpen,
41
+ isOpen: computed(() => this.page.variant() === "side" && this.page.sideOpen()),
42
42
  isInteractive: this.isInteractive,
43
43
  isModal: this.isOverlay,
44
+ closeOnEsc: this.closeOnEsc,
45
+ close: () => this.page.closeSide(),
44
46
  takeReturnFocus: () => this.page.takeSideReturnFocus()
45
47
  });
46
48
  effect(() => {
@@ -51,20 +53,6 @@ var PageSideComponent = class PageSideComponent {
51
53
  id: this.resolvedId
52
54
  });
53
55
  });
54
- effect((onCleanup) => {
55
- if (!this.closeOnEsc() || this.isSticky()) return;
56
- const defaultView = this.document?.defaultView;
57
- if (!defaultView) return;
58
- const handler = (event) => {
59
- if (event.key !== "Escape") return;
60
- if (!untracked(() => this.page.sideOpen())) return;
61
- untracked(() => {
62
- this.page.closeSide();
63
- });
64
- };
65
- defaultView.addEventListener("keydown", handler);
66
- onCleanup(() => defaultView.removeEventListener("keydown", handler));
67
- });
68
56
  }
69
57
  static ɵfac = i0.ɵɵngDeclareFactory({
70
58
  minVersion: "12.0.0",
@@ -137,8 +125,10 @@ var PageSideComponent = class PageSideComponent {
137
125
  "attr.aria-modal": "ariaModal()",
138
126
  "attr.aria-label": "dialogLabel()",
139
127
  "attr.tabindex": "dialogTabindex()",
128
+ "style.translate": "isOverlay() && page.sideOpen() ? \"none\" : null",
140
129
  "style.--page-side-width": "resolvedWidth()"
141
130
  } },
131
+ providers: ɵPAGE_PANEL_OVERLAY_PROVIDERS,
142
132
  ngImport: i0,
143
133
  template: `<ng-content />`,
144
134
  isInline: true
@@ -153,6 +143,7 @@ i0.ɵɵngDeclareClassMetadata({
153
143
  type: Component,
154
144
  args: [{
155
145
  selector: "PageSide",
146
+ providers: ɵPAGE_PANEL_OVERLAY_PROVIDERS,
156
147
  host: {
157
148
  "[class]": "classes()",
158
149
  "[attr.id]": "resolvedId",
@@ -166,6 +157,7 @@ i0.ɵɵngDeclareClassMetadata({
166
157
  "[attr.aria-modal]": "ariaModal()",
167
158
  "[attr.aria-label]": "dialogLabel()",
168
159
  "[attr.tabindex]": "dialogTabindex()",
160
+ "[style.translate]": "isOverlay() && page.sideOpen() ? \"none\" : null",
169
161
  "[style.--page-side-width]": "resolvedWidth()"
170
162
  },
171
163
  template: `<ng-content />`
@@ -467,7 +467,7 @@ i0.ɵɵngDeclareClassMetadata({
467
467
  type: ThemeSpaceService,
468
468
  decorators: [{ type: Service }]
469
469
  });
470
- const UI_THEME_RELEASE_VERSION = "22.2.17";
470
+ const UI_THEME_RELEASE_VERSION = "22.2.18";
471
471
  const THEME_STORAGE_VERSION_KEY = "theme-storage-version";
472
472
  function validateThemeStorageReset(options) {
473
473
  if ("storageVersion" in options) throw new Error("storageVersion was removed. Migrate to storageReset: { preserveKeys: [] }; the package supplies the version.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edsis/angular",
3
- "version": "22.2.17",
3
+ "version": "22.2.18",
4
4
  "description": "Accessible, tree-shakable Angular 22 design system from Edsis: UI components, charts, navigation shells, theme tokens, and an OpenAPI SDK generator.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -508,5 +508,5 @@
508
508
  "module": "fesm2022/edsis-angular.mjs",
509
509
  "typings": "types/edsis-angular.d.ts",
510
510
  "type": "module",
511
- "gitHead": "062a9b9565741eef6ebce6bb09a723cc134907ca"
511
+ "gitHead": "9e90f90668b8686d41bf3ab183712a9159c65cc6"
512
512
  }
@@ -144,9 +144,11 @@ Latar `PageFilter` memakai token neutral tema yang dilembutkan, `bg-surface/50 t
144
144
  Aksesibilitas: pada mode `drawer`/`overlay`, panel menjadi `role="dialog"` (dengan `aria-modal`
145
145
  khusus `overlay`), fokus dipindahkan ke panel saat terbuka dan dikembalikan ke pemicu saat
146
146
  tertutup, dan saat tertutup panel diberi `inert` sehingga isinya keluar dari tab order.
147
- `overlay` juga men-trap fokus, membuat background Page inert, dan mengunci scroll document;
148
- `drawer` sengaja tetap non-modal. `PageSide` memakai pola yang sama. Menekan `Esc` (atau
149
- mengklik backdrop overlay) menutup panel mengambang yang sedang terbuka.
147
+ `overlay` membatasi fokus ke modal teratas, membuat konten lain di dokumen inert, dan mengunci
148
+ scroll dokumen. Panel dan backdrop tetap mengikuti geometri `Page`. Saat beberapa overlay Page
149
+ terbuka, backdrop dan `Esc` hanya menutup overlay teratas. `PageSide` memakai pola yang sama.
150
+ Mode `drawer` tetap nonmodal. Jika `closeOnEsc` dimatikan, sertakan kontrol tutup yang dapat
151
+ diakses dengan keyboard di dalam panel, misalnya `PageFilterToggle` atau `PageSideToggle`.
150
152
 
151
153
  ### `PageFilterToggle`
152
154
 
@@ -137,17 +137,21 @@ export declare class ComposerInputComponent {
137
137
  export declare class ComposerTextareaComponent implements AfterViewInit, ControlValueAccessor {
138
138
  private readonly el;
139
139
  private readonly composer;
140
+ private readonly destroyRef;
141
+ protected readonly nativeAutosize: boolean;
140
142
  readonly rows: import("@angular/core").InputSignalWithTransform<number, unknown>;
141
143
  readonly maxRows: import("@angular/core").InputSignalWithTransform<number | null, unknown>;
142
144
  readonly disabledInput: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
143
145
  readonly invalidInput: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
144
146
  readonly class: import("@angular/core").InputSignal<string>;
147
+ protected readonly maxBlockSize: import("@angular/core").Signal<string | null>;
145
148
  private readonly disabledState;
146
149
  protected readonly disabled: import("@angular/core").Signal<boolean>;
147
150
  protected readonly invalid: import("@angular/core").Signal<boolean>;
148
151
  protected readonly classes: import("@angular/core").Signal<string>;
149
152
  private onChange;
150
153
  private onTouched;
154
+ constructor();
151
155
  ngAfterViewInit(): void;
152
156
  writeValue(value: string | null): void;
153
157
  registerOnChange(fn: (value: string) => void): void;
@@ -158,7 +162,7 @@ export declare class ComposerTextareaComponent implements AfterViewInit, Control
158
162
  protected handleInput(): void;
159
163
  protected handleBlur(): void;
160
164
  protected handleKeydown(event: KeyboardEvent): void;
161
- private getLineHeight;
165
+ private observeSize;
162
166
  static ɵfac: i0.ɵɵFactoryDeclaration<ComposerTextareaComponent, never>;
163
167
  static ɵcmp: i0.ɵɵComponentDeclaration<ComposerTextareaComponent, "textarea[ComposerInput]", never, {
164
168
  "rows": {
@@ -166,6 +166,7 @@ export declare class EditorContentComponent implements AfterViewInit, OnDestroy,
166
166
  private readonly editor;
167
167
  private readonly document;
168
168
  private readonly sanitizeHtml;
169
+ private readonly htmlParser;
169
170
  readonly placeholder: import("@angular/core").InputSignal<string>;
170
171
  readonly ariaLabel: import("@angular/core").InputSignal<string>;
171
172
  readonly disabledInput: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
@@ -177,6 +178,7 @@ export declare class EditorContentComponent implements AfterViewInit, OnDestroy,
177
178
  protected readonly invalid: import("@angular/core").Signal<boolean>;
178
179
  protected readonly classes: import("@angular/core").Signal<string>;
179
180
  private lastKnownValue;
181
+ private pendingValue;
180
182
  private onChange;
181
183
  private onTouched;
182
184
  ngAfterViewInit(): void;
@@ -189,6 +191,8 @@ export declare class EditorContentComponent implements AfterViewInit, OnDestroy,
189
191
  focus(): void;
190
192
  protected handleInput(): void;
191
193
  private setSanitizedValue;
194
+ private renderHtml;
195
+ private serializeContent;
192
196
  protected handleBlur(): void;
193
197
  protected handleKeydown(event: KeyboardEvent): void;
194
198
  private exec;
@@ -1,5 +1,5 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Signal } from "@angular/core";
2
+ import { Provider, Signal } from "@angular/core";
3
3
  export declare const PAGE_VARIANTS: readonly ["stacked", "side"];
4
4
  export declare const PAGE_SIDE_POSITIONS: readonly ["left", "right"];
5
5
  export declare const PAGE_SIDE_MODES: readonly ["sticky", "drawer", "overlay"];
@@ -132,20 +132,19 @@ export declare class PageStateService {
132
132
  static ɵfac: i0.ɵɵFactoryDeclaration<PageStateService, never>;
133
133
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
134
134
  }
135
- /**
136
- * Accessibility management for the Page panels.
137
- *
138
- * A drawer only gets initial focus and focus restoration. An overlay is a modal dialog:
139
- * focus is trapped, the background is made inert, and document scrolling is locked until
140
- * the panel closes. Must be called from an injection context, because it uses `effect`.
141
- */
142
135
  /** @internal */
136
+ export declare function ɵisActivePageOverlay(document: Document, id: string | null): boolean;
137
+ /** Manage initial focus and restoration for drawers, and document modality for overlays. @internal */
143
138
  export declare function ɵsetupOverlayFocusManagement(config: {
144
139
  document: Document | null;
145
140
  host: HTMLElement;
146
141
  isOpen: Signal<boolean>;
147
142
  isInteractive: Signal<boolean>;
148
143
  isModal: Signal<boolean>;
144
+ closeOnEsc?: Signal<boolean>;
145
+ close?: () => void;
149
146
  /** Optional trigger captured at the open gesture, before a modal makes it inert. */
150
147
  takeReturnFocus?: () => HTMLElement | null;
151
- }): void;
148
+ }): void;
149
+ /** @internal */
150
+ export declare const ɵPAGE_PANEL_OVERLAY_PROVIDERS: Provider[];
@@ -7,6 +7,7 @@ import { PageStateService } from "@edsis/angular/theme/page/core";
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class PageComponent {
9
9
  protected readonly page: PageStateService;
10
+ private readonly document;
10
11
  private readonly layout;
11
12
  private readonly navigation;
12
13
  private readonly identity;