ngwr 7.1.0 → 7.3.0
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/LICENSE +1 -1
- package/README.md +5 -3
- package/alert/styles/_index.scss +2 -0
- package/back-top/styles/_index.scss +4 -2
- package/carousel/styles/_index.scss +2 -0
- package/cascader/styles/_index.scss +16 -0
- package/color-picker/styles/_index.scss +7 -0
- package/command-palette/styles/_index.scss +28 -0
- package/density/styles/_index.scss +10 -0
- package/descriptions/styles/_index.scss +59 -0
- package/dialog/styles/_index.scss +2 -0
- package/drawer/styles/_index.scss +2 -0
- package/dropdown/styles/_index.scss +1 -0
- package/fesm2022/ngwr-carousel.mjs +45 -4
- package/fesm2022/ngwr-carousel.mjs.map +1 -1
- package/fesm2022/ngwr-cascader.mjs +2 -2
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +17 -3
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +77 -5
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +3 -3
- package/fesm2022/ngwr-density.mjs.map +1 -1
- package/fesm2022/ngwr-descriptions.mjs +11 -2
- package/fesm2022/ngwr-descriptions.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +11 -4
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-drag-drop.mjs +13 -3
- package/fesm2022/ngwr-drag-drop.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +66 -5
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +35 -11
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +45 -2
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +70 -1
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +11 -3
- package/fesm2022/ngwr-page-header.mjs.map +1 -1
- package/fesm2022/ngwr-pagination.mjs +11 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +36 -10
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-rotating-text.mjs +15 -4
- package/fesm2022/ngwr-rotating-text.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +35 -14
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-stepper.mjs +11 -2
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +10 -4
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +38 -6
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-toast.mjs +54 -2
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +11 -4
- package/fesm2022/ngwr-toolbar.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/lightbox/styles/_index.scss +4 -0
- package/llms-full.txt +673 -0
- package/llms.txt +106 -0
- package/overlay/styles/_index.scss +31 -0
- package/package.json +6 -5
- package/page-header/styles/_index.scss +16 -0
- package/pagination/styles/_index.scss +34 -0
- package/popover/styles/_index.scss +1 -0
- package/select/styles/_index.scss +27 -0
- package/slider/styles/_index.scss +3 -0
- package/splitter/styles/_index.scss +3 -0
- package/stepper/styles/_index.scss +30 -0
- package/styles.scss +1 -0
- package/table/styles/_index.scss +61 -0
- package/tabs/styles/_index.scss +24 -0
- package/theme/styles/_mixins.scss +47 -0
- package/toast/styles/_index.scss +32 -1
- package/toolbar/styles/_index.scss +29 -0
- package/tree/styles/_index.scss +15 -0
- package/types/ngwr-carousel.d.ts +8 -1
- package/types/ngwr-command-palette.d.ts +13 -1
- package/types/ngwr-context-menu.d.ts +25 -3
- package/types/ngwr-density.d.ts +2 -2
- package/types/ngwr-descriptions.d.ts +8 -1
- package/types/ngwr-dialog.d.ts +7 -0
- package/types/ngwr-drag-drop.d.ts +13 -1
- package/types/ngwr-drawer.d.ts +11 -3
- package/types/ngwr-dropdown.d.ts +10 -1
- package/types/ngwr-lightbox.d.ts +5 -0
- package/types/ngwr-overlay.d.ts +69 -1
- package/types/ngwr-page-header.d.ts +8 -1
- package/types/ngwr-pagination.d.ts +7 -1
- package/types/ngwr-popover.d.ts +10 -1
- package/types/ngwr-rotating-text.d.ts +1 -0
- package/types/ngwr-select.d.ts +10 -1
- package/types/ngwr-stepper.d.ts +8 -1
- package/types/ngwr-table.d.ts +7 -1
- package/types/ngwr-tabs.d.ts +6 -0
- package/types/ngwr-toolbar.d.ts +7 -1
- package/types/ngwr-version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-density.mjs","sources":["../../../projects/lib/density/density-config.ts","../../../projects/lib/density/density.ts","../../../projects/lib/density/density.directive.ts","../../../projects/lib/density/provide-wr-density.ts","../../../projects/lib/density/ngwr-density.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrDensityConfig } from './interfaces';\n\nexport const DEFAULT_WR_DENSITY_CONFIG: WrDensityConfig = {\n defaultDensity: 'default',\n storageKey: 'wr-density',\n attribute: 'data-wr-density',\n};\n\nexport const WR_DENSITY_CONFIG = new InjectionToken<WrDensityConfig>('WR_DENSITY_CONFIG', {\n factory: (): WrDensityConfig => DEFAULT_WR_DENSITY_CONFIG,\n});\n\nexport type { WrDensityValue, WrDensityConfig } from './interfaces';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Service, type Signal, effect, inject, signal } from '@angular/core';\n\nimport { WrStorage } from 'ngwr/storage';\n\nimport { WR_DENSITY_CONFIG, type WrDensityValue } from './density-config';\n\nconst VALID: readonly WrDensityValue[] = ['compact', 'default', 'comfortable'];\n\nfunction isDensity(v: unknown): v is WrDensityValue {\n return typeof v === 'string' && (VALID as readonly string[]).includes(v);\n}\n\n/**\n * Global density scale. Writes `[data-wr-density]` on `<html>` so the\n * stylesheet's density-scoped CSS-variable rules apply, then components\n * pick up the new multipliers without re-rendering.\n *\n * - **Per-subtree override** — drop `[wrDensity]` on any element; its\n * descendants read the override instead of the global value.\n * - **Persisted** via {@link WrStorage} (swap the engine globally if you\n * need a different store).\n *\n * @example\n * ```ts\n * const density = inject(WrDensity);\n * density.set('compact');\n * density.current(); // 'compact'\n * ```\n *\n * @see https://ngwr.dev/services/density\n */\n@Service()\nexport class WrDensity {\n private readonly doc = inject(DOCUMENT);\n private readonly storage = inject(WrStorage);\n private readonly config = inject(WR_DENSITY_CONFIG);\n\n /** Active density. */\n readonly current: Signal<WrDensityValue>;\n\n private readonly _current = signal<WrDensityValue>(this.readPersisted() ?? this.config.defaultDensity);\n\n constructor() {\n this.current = this._current.asReadonly();\n effect(() => {\n const value = this._current();\n const html = this.doc.documentElement;\n if (html) html.setAttribute(this.config.attribute, value);\n this.persist(value);\n });\n }\n\n /** Switch the active density. Ignores unknown values. */\n set(density: WrDensityValue): void {\n if (!isDensity(density)) return;\n this._current.set(density);\n }\n\n /** Cycle compact → default → comfortable → compact … */\n cycle(): void {\n const order: readonly WrDensityValue[] = ['compact', 'default', 'comfortable'];\n const i = order.indexOf(this._current());\n this._current.set(order[(i + 1) % order.length]);\n }\n\n // Persistence\n\n private readPersisted(): WrDensityValue | null {\n if (!this.config.storageKey) return null;\n const raw = this.storage.get<WrDensityValue>(this.config.storageKey);\n return isDensity(raw) ? raw : null;\n }\n\n private persist(density: WrDensityValue): void {\n if (!this.config.storageKey) return;\n this.storage.set(this.config.storageKey, density);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, ElementRef, effect, inject, input } from '@angular/core';\n\nimport { WR_DENSITY_CONFIG, type WrDensityValue } from './density-config';\n\n/**\n * Scope a density override to a subtree. Writes the same `data-*`\n * attribute the global service writes — but on the host instead of\n * `<html>` — so the CSS-variable scope rules cascade only to descendants.\n *\n * @example\n * ```html\n * <!-- The whole sidebar is compact, the rest of the app keeps its global density. -->\n * <aside wrDensity=\"compact\">\n * <wr-list ...></wr-list>\n * </aside>\n * ```\n */\n@Directive({\n selector: '[wrDensity]',\n})\nexport class WrDensityDirective {\n /** Density to apply to this subtree. */\n readonly wrDensity = input.required<WrDensityValue>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly config = inject(WR_DENSITY_CONFIG);\n\n constructor() {\n effect(() => {\n this.host.nativeElement.setAttribute(this.config.attribute, this.wrDensity());\n });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { DEFAULT_WR_DENSITY_CONFIG, WR_DENSITY_CONFIG, type WrDensityConfig } from './density-config';\n\n/** Configure {@link WrDensity}. All fields optional — merged with defaults. */\nexport function provideWrDensity(config: Partial<WrDensityConfig> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: WR_DENSITY_CONFIG, useValue: { ...DEFAULT_WR_DENSITY_CONFIG, ...config } },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAMI,MAAM,yBAAyB,GAAoB;AACxD,IAAA,cAAc,EAAE,SAAS;AACzB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,SAAS,EAAE,iBAAiB;;MAGjB,iBAAiB,GAAG,IAAI,cAAc,CAAkB,mBAAmB,EAAE;AACxF,IAAA,OAAO,EAAE,MAAuB,yBAAyB;AAC1D,CAAA;;ACnBD;;;;;AAKG;AASH,MAAM,KAAK,GAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ngwr-density.mjs","sources":["../../../projects/lib/density/density-config.ts","../../../projects/lib/density/density.ts","../../../projects/lib/density/density.directive.ts","../../../projects/lib/density/provide-wr-density.ts","../../../projects/lib/density/ngwr-density.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrDensityConfig } from './interfaces';\n\nexport const DEFAULT_WR_DENSITY_CONFIG: WrDensityConfig = {\n defaultDensity: 'default',\n storageKey: 'wr-density',\n attribute: 'data-wr-density',\n};\n\nexport const WR_DENSITY_CONFIG = new InjectionToken<WrDensityConfig>('WR_DENSITY_CONFIG', {\n factory: (): WrDensityConfig => DEFAULT_WR_DENSITY_CONFIG,\n});\n\nexport type { WrDensityValue, WrDensityConfig } from './interfaces';\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { DOCUMENT } from '@angular/common';\nimport { Service, type Signal, effect, inject, signal } from '@angular/core';\n\nimport { WrStorage } from 'ngwr/storage';\n\nimport { WR_DENSITY_CONFIG, type WrDensityValue } from './density-config';\n\nconst VALID: readonly WrDensityValue[] = ['compact', 'default', 'comfortable', 'touch'];\n\nfunction isDensity(v: unknown): v is WrDensityValue {\n return typeof v === 'string' && (VALID as readonly string[]).includes(v);\n}\n\n/**\n * Global density scale. Writes `[data-wr-density]` on `<html>` so the\n * stylesheet's density-scoped CSS-variable rules apply, then components\n * pick up the new multipliers without re-rendering.\n *\n * - **Per-subtree override** — drop `[wrDensity]` on any element; its\n * descendants read the override instead of the global value.\n * - **Persisted** via {@link WrStorage} (swap the engine globally if you\n * need a different store).\n *\n * @example\n * ```ts\n * const density = inject(WrDensity);\n * density.set('compact');\n * density.current(); // 'compact'\n * ```\n *\n * @see https://ngwr.dev/services/density\n */\n@Service()\nexport class WrDensity {\n private readonly doc = inject(DOCUMENT);\n private readonly storage = inject(WrStorage);\n private readonly config = inject(WR_DENSITY_CONFIG);\n\n /** Active density. */\n readonly current: Signal<WrDensityValue>;\n\n private readonly _current = signal<WrDensityValue>(this.readPersisted() ?? this.config.defaultDensity);\n\n constructor() {\n this.current = this._current.asReadonly();\n effect(() => {\n const value = this._current();\n const html = this.doc.documentElement;\n if (html) html.setAttribute(this.config.attribute, value);\n this.persist(value);\n });\n }\n\n /** Switch the active density. Ignores unknown values. */\n set(density: WrDensityValue): void {\n if (!isDensity(density)) return;\n this._current.set(density);\n }\n\n /** Cycle compact → default → comfortable → touch → compact … */\n cycle(): void {\n const order: readonly WrDensityValue[] = ['compact', 'default', 'comfortable', 'touch'];\n const i = order.indexOf(this._current());\n this._current.set(order[(i + 1) % order.length]);\n }\n\n // Persistence\n\n private readPersisted(): WrDensityValue | null {\n if (!this.config.storageKey) return null;\n const raw = this.storage.get<WrDensityValue>(this.config.storageKey);\n return isDensity(raw) ? raw : null;\n }\n\n private persist(density: WrDensityValue): void {\n if (!this.config.storageKey) return;\n this.storage.set(this.config.storageKey, density);\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, ElementRef, effect, inject, input } from '@angular/core';\n\nimport { WR_DENSITY_CONFIG, type WrDensityValue } from './density-config';\n\n/**\n * Scope a density override to a subtree. Writes the same `data-*`\n * attribute the global service writes — but on the host instead of\n * `<html>` — so the CSS-variable scope rules cascade only to descendants.\n *\n * @example\n * ```html\n * <!-- The whole sidebar is compact, the rest of the app keeps its global density. -->\n * <aside wrDensity=\"compact\">\n * <wr-list ...></wr-list>\n * </aside>\n * ```\n */\n@Directive({\n selector: '[wrDensity]',\n})\nexport class WrDensityDirective {\n /** Density to apply to this subtree. */\n readonly wrDensity = input.required<WrDensityValue>();\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly config = inject(WR_DENSITY_CONFIG);\n\n constructor() {\n effect(() => {\n this.host.nativeElement.setAttribute(this.config.attribute, this.wrDensity());\n });\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';\n\nimport { DEFAULT_WR_DENSITY_CONFIG, WR_DENSITY_CONFIG, type WrDensityConfig } from './density-config';\n\n/** Configure {@link WrDensity}. All fields optional — merged with defaults. */\nexport function provideWrDensity(config: Partial<WrDensityConfig> = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: WR_DENSITY_CONFIG, useValue: { ...DEFAULT_WR_DENSITY_CONFIG, ...config } },\n ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAAA;;;;;AAKG;AAMI,MAAM,yBAAyB,GAAoB;AACxD,IAAA,cAAc,EAAE,SAAS;AACzB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,SAAS,EAAE,iBAAiB;;MAGjB,iBAAiB,GAAG,IAAI,cAAc,CAAkB,mBAAmB,EAAE;AACxF,IAAA,OAAO,EAAE,MAAuB,yBAAyB;AAC1D,CAAA;;ACnBD;;;;;AAKG;AASH,MAAM,KAAK,GAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC;AAEvF,SAAS,SAAS,CAAC,CAAU,EAAA;IAC3B,OAAO,OAAO,CA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AA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACxB,iBAAA;;;AC1BD;;;;;AAKG;AAMH;AACM,SAAU,gBAAgB,CAAC,MAAA,GAAmC,EAAE,EAAA;AACpE,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,GAAG,yBAAyB,EAAE,GAAG,MAAM,EAAE,EAAE;AACtF,KAAA,CAAC;AACJ;;AChBA;;AAEG;;;;"}
|
|
@@ -32,22 +32,31 @@ class WrDescriptions {
|
|
|
32
32
|
inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
33
33
|
/** Add visible borders around each row. @default false */
|
|
34
34
|
bordered = input(false, { ...(ngDevMode ? { debugName: "bordered" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
35
|
+
/**
|
|
36
|
+
* Reflow `inline` rows back to a stacked layout when the box itself is
|
|
37
|
+
* narrow (a container query on its own width, not the viewport — so it
|
|
38
|
+
* adapts inside a narrow card or side panel). Makes the box fill its
|
|
39
|
+
* container's width. @default false
|
|
40
|
+
*/
|
|
41
|
+
responsive = input(false, { ...(ngDevMode ? { debugName: "responsive" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
35
42
|
classes = computed(() => {
|
|
36
43
|
const parts = ['wr-descriptions'];
|
|
37
44
|
if (this.inline())
|
|
38
45
|
parts.push('wr-descriptions--inline');
|
|
39
46
|
if (this.bordered())
|
|
40
47
|
parts.push('wr-descriptions--bordered');
|
|
48
|
+
if (this.responsive())
|
|
49
|
+
parts.push('wr-descriptions--responsive');
|
|
41
50
|
return parts.join(' ');
|
|
42
51
|
}, /* @ts-ignore */
|
|
43
52
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
44
53
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrDescriptions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
45
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrDescriptions, isStandalone: true, selector: "wr-descriptions", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "@if (title()) {\n <div class=\"wr-descriptions__title\">{{ title() }}</div>\n}\n<dl class=\"wr-descriptions__list\">\n <ng-content />\n</dl>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
54
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrDescriptions, isStandalone: true, selector: "wr-descriptions", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "@if (title()) {\n <div class=\"wr-descriptions__title\">{{ title() }}</div>\n}\n<dl class=\"wr-descriptions__list\">\n <ng-content />\n</dl>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
46
55
|
}
|
|
47
56
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrDescriptions, decorators: [{
|
|
48
57
|
type: Component,
|
|
49
58
|
args: [{ selector: 'wr-descriptions', encapsulation: ViewEncapsulation.None, host: { '[class]': 'classes()' }, template: "@if (title()) {\n <div class=\"wr-descriptions__title\">{{ title() }}</div>\n}\n<dl class=\"wr-descriptions__list\">\n <ng-content />\n</dl>\n" }]
|
|
50
|
-
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }] } });
|
|
59
|
+
}], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }] } });
|
|
51
60
|
|
|
52
61
|
/**
|
|
53
62
|
* @license
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-descriptions.mjs","sources":["../../../projects/lib/descriptions/descriptions.ts","../../../projects/lib/descriptions/descriptions.html","../../../projects/lib/descriptions/description-item.ts","../../../projects/lib/descriptions/ngwr-descriptions.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\n/**\n * Read-only labeled key / value list. Project `<wr-description-item>`\n * children. `title` is optional. Default layout stacks vertically; set\n * `[inline]=\"true\"` for label-left / value-right rows.\n *\n * @example\n * ```html\n * <wr-descriptions title=\"Account\" inline>\n * <wr-description-item label=\"Name\">Ada Lovelace</wr-description-item>\n * <wr-description-item label=\"Email\">ada@example.com</wr-description-item>\n * <wr-description-item label=\"Joined\">2024-03-12</wr-description-item>\n * </wr-descriptions>\n * ```\n *\n * @see https://ngwr.dev/components/descriptions\n */\n@Component({\n selector: 'wr-descriptions',\n templateUrl: './descriptions.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n})\nexport class WrDescriptions {\n /** Optional title shown above the list. */\n readonly title = input<string>('');\n\n /** Two-column rows (label left, value right) instead of stacked. @default false */\n readonly inline = input(false, { transform: coerceBooleanProperty });\n\n /** Add visible borders around each row. @default false */\n readonly bordered = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-descriptions'];\n if (this.inline()) parts.push('wr-descriptions--inline');\n if (this.bordered()) parts.push('wr-descriptions--bordered');\n return parts.join(' ');\n });\n}\n","@if (title()) {\n <div class=\"wr-descriptions__title\">{{ title() }}</div>\n}\n<dl class=\"wr-descriptions__list\">\n <ng-content />\n</dl>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, input } from '@angular/core';\n\n/**\n * One row in a {@link WrDescriptions}. The label comes from the\n * `label` input; the value is the projected content.\n */\n@Component({\n selector: 'wr-description-item',\n template:\n '<dt class=\"wr-descriptions__label\">{{ label() }}</dt><dd class=\"wr-descriptions__value\"><ng-content /></dd>',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-descriptions__row' },\n})\nexport class WrDescriptionItem {\n readonly label = input<string>('');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAKH;;;;;;;;;;;;;;;AAeG;MAOU,cAAc,CAAA;;IAEhB,KAAK,GAAG,KAAK,CAAS,EAAE;8EAAC;;IAGzB,MAAM,GAAG,KAAK,CAAC,KAAK,8EAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;;IAG3D,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;
|
|
1
|
+
{"version":3,"file":"ngwr-descriptions.mjs","sources":["../../../projects/lib/descriptions/descriptions.ts","../../../projects/lib/descriptions/descriptions.html","../../../projects/lib/descriptions/description-item.ts","../../../projects/lib/descriptions/ngwr-descriptions.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, computed, input } from '@angular/core';\n\n/**\n * Read-only labeled key / value list. Project `<wr-description-item>`\n * children. `title` is optional. Default layout stacks vertically; set\n * `[inline]=\"true\"` for label-left / value-right rows.\n *\n * @example\n * ```html\n * <wr-descriptions title=\"Account\" inline>\n * <wr-description-item label=\"Name\">Ada Lovelace</wr-description-item>\n * <wr-description-item label=\"Email\">ada@example.com</wr-description-item>\n * <wr-description-item label=\"Joined\">2024-03-12</wr-description-item>\n * </wr-descriptions>\n * ```\n *\n * @see https://ngwr.dev/components/descriptions\n */\n@Component({\n selector: 'wr-descriptions',\n templateUrl: './descriptions.html',\n encapsulation: ViewEncapsulation.None,\n host: { '[class]': 'classes()' },\n})\nexport class WrDescriptions {\n /** Optional title shown above the list. */\n readonly title = input<string>('');\n\n /** Two-column rows (label left, value right) instead of stacked. @default false */\n readonly inline = input(false, { transform: coerceBooleanProperty });\n\n /** Add visible borders around each row. @default false */\n readonly bordered = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Reflow `inline` rows back to a stacked layout when the box itself is\n * narrow (a container query on its own width, not the viewport — so it\n * adapts inside a narrow card or side panel). Makes the box fill its\n * container's width. @default false\n */\n readonly responsive = input(false, { transform: coerceBooleanProperty });\n\n protected readonly classes = computed(() => {\n const parts = ['wr-descriptions'];\n if (this.inline()) parts.push('wr-descriptions--inline');\n if (this.bordered()) parts.push('wr-descriptions--bordered');\n if (this.responsive()) parts.push('wr-descriptions--responsive');\n return parts.join(' ');\n });\n}\n","@if (title()) {\n <div class=\"wr-descriptions__title\">{{ title() }}</div>\n}\n<dl class=\"wr-descriptions__list\">\n <ng-content />\n</dl>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, input } from '@angular/core';\n\n/**\n * One row in a {@link WrDescriptions}. The label comes from the\n * `label` input; the value is the projected content.\n */\n@Component({\n selector: 'wr-description-item',\n template:\n '<dt class=\"wr-descriptions__label\">{{ label() }}</dt><dd class=\"wr-descriptions__value\"><ng-content /></dd>',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-descriptions__row' },\n})\nexport class WrDescriptionItem {\n readonly label = input<string>('');\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAAA;;;;;AAKG;AAKH;;;;;;;;;;;;;;;AAeG;MAOU,cAAc,CAAA;;IAEhB,KAAK,GAAG,KAAK,CAAS,EAAE;8EAAC;;IAGzB,MAAM,GAAG,KAAK,CAAC,KAAK,8EAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;;IAG3D,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;AAEtE;;;;;AAKG;IACM,UAAU,GAAG,KAAK,CAAC,KAAK,kFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;AAErD,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAK;AACzC,QAAA,MAAM,KAAK,GAAG,CAAC,iBAAiB,CAAC;QACjC,IAAI,IAAI,CAAC,MAAM,EAAE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B,EAAA,UAAA,EAAA,CAAA;kBAP7B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EACN,6GAA6G;oBAC/G,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE;AACxC,iBAAA;;;ACnBD;;AAEG;;;;"}
|
package/fesm2022/ngwr-dialog.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { ComponentPortal } from '@angular/cdk/portal';
|
|
|
4
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
6
|
import { InjectionToken, inject, EnvironmentInjector, PLATFORM_ID, Injector, Service, ElementRef, Directive, input, computed } from '@angular/core';
|
|
7
|
-
import { WR_OVERLAY } from 'ngwr/overlay';
|
|
7
|
+
import { WR_OVERLAY, WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet } from 'ngwr/overlay';
|
|
8
8
|
import { Subject } from 'rxjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -142,6 +142,7 @@ class WrDialog {
|
|
|
142
142
|
parentInjector = inject(EnvironmentInjector);
|
|
143
143
|
focusTrapFactory = inject(ConfigurableFocusTrapFactory);
|
|
144
144
|
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
145
|
+
responsiveConfig = inject(WR_RESPONSIVE_OVERLAYS);
|
|
145
146
|
open(component, options = {}) {
|
|
146
147
|
const panelClasses = [DEFAULT_PANEL_CLASS];
|
|
147
148
|
const extra = options.panelClass;
|
|
@@ -152,14 +153,20 @@ class WrDialog {
|
|
|
152
153
|
for (const cls of extra)
|
|
153
154
|
panelClasses.push(cls);
|
|
154
155
|
}
|
|
156
|
+
// On small viewports (when opted in) present as a slide-up sheet pinned
|
|
157
|
+
// to the bottom edge, full-width, instead of a centred modal.
|
|
158
|
+
const asSheet = wrPresentAsSheet(options.responsive, this.responsiveConfig);
|
|
159
|
+
if (asSheet)
|
|
160
|
+
panelClasses.push('wr-overlay-sheet');
|
|
161
|
+
const position = this.overlay.position().global().centerHorizontally();
|
|
155
162
|
const overlayRef = this.overlay.create({
|
|
156
|
-
positionStrategy:
|
|
163
|
+
positionStrategy: asSheet ? position.bottom('0') : position.centerVertically(),
|
|
157
164
|
scrollStrategy: this.scrollStrategies.block(),
|
|
158
165
|
hasBackdrop: true,
|
|
159
166
|
backdropClass: DEFAULT_BACKDROP_CLASS,
|
|
160
167
|
panelClass: panelClasses,
|
|
161
|
-
width: options.width,
|
|
162
|
-
maxWidth: options.maxWidth,
|
|
168
|
+
width: asSheet ? '100%' : options.width,
|
|
169
|
+
maxWidth: asSheet ? '100%' : options.maxWidth,
|
|
163
170
|
});
|
|
164
171
|
const dialogRef = new WrDialogRef(overlayRef);
|
|
165
172
|
if (this.isBrowser) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-dialog.mjs","sources":["../../../projects/lib/dialog/dialog-ref.ts","../../../projects/lib/dialog/tokens/dialog-data.token.ts","../../../projects/lib/dialog/tokens/dialog-ref.token.ts","../../../projects/lib/dialog/dialog.ts","../../../projects/lib/dialog/directives/dialog-title.ts","../../../projects/lib/dialog/directives/dialog-content.ts","../../../projects/lib/dialog/directives/dialog-footer.ts","../../../projects/lib/dialog/directives/dialog-close.ts","../../../projects/lib/dialog/ngwr-dialog.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { ConfigurableFocusTrap } from '@angular/cdk/a11y';\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport type { ComponentRef } from '@angular/core';\n\nimport { Subject } from 'rxjs';\n\n/**\n * Handle returned by `WrDialog.open()`.\n *\n * Wraps the underlying `OverlayRef` and tracks the close result.\n *\n * @example\n * ```ts\n * const ref = dialog.open<ConfirmComponent, boolean>(ConfirmComponent);\n * const result = await ref.awaitClose(); // boolean | undefined\n * ```\n */\nexport class WrDialogRef<C, R = unknown> {\n /** Emits the close result once and completes. */\n readonly closed = new Subject<R | undefined>();\n\n /** @internal */\n componentRef: ComponentRef<C> | null = null;\n\n /** @internal */\n focusTrap: ConfigurableFocusTrap | null = null;\n\n /** @internal */\n previouslyFocused: HTMLElement | null = null;\n\n constructor(private readonly _overlayRef: OverlayRef) {}\n\n /** The instantiated dialog component. */\n get componentInstance(): C {\n if (!this.componentRef) {\n throw new Error('WrDialogRef: component not yet attached');\n }\n return this.componentRef.instance;\n }\n\n /** Close the dialog, optionally returning a result. */\n close(result?: R): void {\n this.closed.next(result);\n this.closed.complete();\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this._overlayRef.dispose();\n // Restore focus after disposal so the trigger is reachable again.\n if (restore && typeof restore.focus === 'function') {\n restore.focus();\n }\n }\n\n /** Resolves with the close result when the dialog is dismissed. */\n awaitClose(): Promise<R | undefined> {\n return new Promise(resolve => {\n this.closed.subscribe({\n next: value => resolve(value),\n complete: () => resolve(undefined),\n });\n });\n }\n\n /** Underlying overlay ref — escape hatch for advanced cases. */\n get overlayRef(): OverlayRef {\n return this._overlayRef;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/**\n * Token that exposes the `data` payload passed to `WrDialog.open()`.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class ConfirmComponent {\n * readonly data = inject<ConfirmData>(WR_DIALOG_DATA);\n * }\n * ```\n */\nexport const WR_DIALOG_DATA = new InjectionToken<unknown>('WR_DIALOG_DATA');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrDialogRef } from '../dialog-ref';\n\n/**\n * Token exposing the open dialog's `WrDialogRef` to components and\n * directives rendered inside it (e.g. `[wrDialogClose]`).\n *\n * @internal\n */\nexport const WR_DIALOG_REF = new InjectionToken<WrDialogRef<unknown, unknown>>('WR_DIALOG_REF');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal, type ComponentType } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport { EnvironmentInjector, Service, Injector, PLATFORM_ID, inject } from '@angular/core';\n\nimport { WR_OVERLAY } from 'ngwr/overlay';\n\nimport { WrDialogRef } from './dialog-ref';\nimport type { WrDialogOptions } from './interfaces';\nimport { WR_DIALOG_DATA, WR_DIALOG_REF } from './tokens';\n\nconst DEFAULT_PANEL_CLASS = 'wr-dialog-panel';\nconst DEFAULT_BACKDROP_CLASS = 'wr-dialog-backdrop';\n\n/**\n * Opens dialog components in an isolated NGWR overlay.\n *\n * Uses `WR_OVERLAY` so it composes cleanly with `provideWrOverlay()`\n * — dialogs render into NGWR's own overlay container and never collide\n * with other CDK consumers (Material, NG-ZORRO, etc.).\n *\n * @example\n * ```ts\n * const dialog = inject(WrDialog);\n *\n * const ref = dialog.open(ConfirmComponent, {\n * data: { message: 'Delete this item?' },\n * width: '24rem',\n * });\n *\n * const ok = await ref.awaitClose();\n * if (ok) remove();\n * ```\n *\n * @see https://ngwr.dev/components/dialog\n */\n@Service()\nexport class WrDialog {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly parentInjector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n open<C, R = unknown, D = unknown>(component: ComponentType<C>, options: WrDialogOptions<D> = {}): WrDialogRef<C, R> {\n const panelClasses: string[] = [DEFAULT_PANEL_CLASS];\n const extra = options.panelClass;\n if (typeof extra === 'string') {\n panelClasses.push(extra);\n } else if (extra) {\n for (const cls of extra) panelClasses.push(cls);\n }\n\n const overlayRef: OverlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.scrollStrategies.block(),\n hasBackdrop: true,\n backdropClass: DEFAULT_BACKDROP_CLASS,\n panelClass: panelClasses,\n width: options.width,\n maxWidth: options.maxWidth,\n });\n\n const dialogRef = new WrDialogRef<C, R>(overlayRef);\n\n if (this.isBrowser) {\n const active = document.activeElement;\n dialogRef.previouslyFocused = active instanceof HTMLElement ? active : null;\n }\n\n const injector = Injector.create({\n parent: this.parentInjector,\n providers: [\n { provide: WR_DIALOG_DATA, useValue: options.data },\n { provide: WR_DIALOG_REF, useValue: dialogRef },\n ],\n });\n\n const portal = new ComponentPortal(component, null, injector);\n dialogRef.componentRef = overlayRef.attach(portal);\n\n if (this.isBrowser) {\n const host = overlayRef.overlayElement;\n host.setAttribute('role', 'dialog');\n host.setAttribute('aria-modal', 'true');\n // Wire aria-labelledby to wrDialogTitle's auto-id once content is in DOM.\n queueMicrotask(() => {\n const titleEl = host.querySelector<HTMLElement>('[wrDialogTitle], [wr-dialog-title]');\n if (titleEl?.id) host.setAttribute('aria-labelledby', titleEl.id);\n });\n // Trap focus inside the dialog and move initial focus in.\n const trap = this.focusTrapFactory.create(host);\n dialogRef.focusTrap = trap;\n void trap.focusInitialElementWhenReady();\n }\n\n // Overlay subscriptions complete when the overlay is disposed, so no\n // explicit teardown is required.\n if (options.closeOnBackdropClick !== false) {\n overlayRef.backdropClick().subscribe(() => dialogRef.close());\n }\n if (options.closeOnEscape !== false) {\n overlayRef.keydownEvents().subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n dialogRef.close();\n }\n });\n }\n\n return dialogRef;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, ElementRef, inject } from '@angular/core';\n\nlet uid = 0;\n\n/**\n * Styles a dialog title row. Use on a heading inside an opened dialog.\n * Auto-assigns an `id` so the dialog panel can reference it via\n * `aria-labelledby`.\n *\n * @example\n * ```html\n * <h2 wrDialogTitle>Confirm delete</h2>\n * ```\n */\n@Directive({\n selector: '[wrDialogTitle]',\n host: { class: 'wr-dialog__title', '[attr.id]': 'id' },\n})\nexport class WrDialogTitle {\n /** Generated id used for `aria-labelledby` wiring. */\n readonly id = `wr-dialog-title-${++uid}`;\n\n /** @internal */\n readonly elementRef = inject(ElementRef<HTMLElement>);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\n/**\n * Styles the scrollable body section of a dialog.\n *\n * @example\n * ```html\n * <div wrDialogContent>…body…</div>\n * ```\n */\n@Directive({\n selector: '[wrDialogContent]',\n host: { class: 'wr-dialog__content' },\n})\nexport class WrDialogContent {}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, computed, input } from '@angular/core';\n\n/**\n * Footer row, typically holding action buttons.\n *\n * @example\n * ```html\n * <div wrDialogFooter align=\"end\">\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"danger\" (click)=\"confirm()\">Delete</wr-btn>\n * </div>\n * ```\n */\n@Directive({\n selector: '[wrDialogFooter]',\n host: { '[class]': 'classes()' },\n})\nexport class WrDialogFooter {\n /**\n * Horizontal alignment of the children.\n *\n * @default 'end'\n */\n readonly align = input<'start' | 'center' | 'end'>('end');\n\n protected readonly classes = computed(() => `wr-dialog__footer wr-dialog__footer--${this.align()}`);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, inject, input } from '@angular/core';\n\nimport type { WrDialogRef } from '../dialog-ref';\nimport { WR_DIALOG_REF } from '../tokens';\n\n/**\n * Closes the dialog when the host element is clicked.\n *\n * Optionally passes a `[wrDialogClose]` value as the close result.\n *\n * @example\n * ```html\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"primary\" [wrDialogClose]=\"true\">Confirm</wr-btn>\n * ```\n */\n@Directive({\n selector: '[wrDialogClose]',\n host: { '(click)': 'onClick()' },\n})\nexport class WrDialogClose<R = unknown> {\n /**\n * Value to pass to `close()`. When unset, the dialog closes with\n * `undefined`.\n */\n readonly result = input<R | undefined>(undefined, { alias: 'wrDialogClose' });\n\n private readonly ref = inject<WrDialogRef<unknown, R>>(WR_DIALOG_REF, { optional: true });\n\n protected onClick(): void {\n this.ref?.close(this.result());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AAQH;;;;;;;;;;AAUG;MACU,WAAW,CAAA;AAaO,IAAA,WAAA;;AAXpB,IAAA,MAAM,GAAG,IAAI,OAAO,EAAiB;;IAG9C,YAAY,GAA2B,IAAI;;IAG3C,SAAS,GAAiC,IAAI;;IAG9C,iBAAiB,GAAuB,IAAI;AAE5C,IAAA,WAAA,CAA6B,WAAuB,EAAA;QAAvB,IAAA,CAAA,WAAW,GAAX,WAAW;IAAe;;AAGvD,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC;QAC5D;AACA,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ;IACnC;;A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AAI,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE;AACjC,iBAAA;;;ACvBD;;;;;AAKG;AAOH;;;;;;;;;;AAUG;MAKU,aAAa,CAAA;AACxB;;;AAGG;IACM,MAAM,GAAG,KAAK,CAAgB,SAAS,8EAAI,KAAK,EAAE,eAAe,EAAA,CAAG;IAE5D,GAAG,GAAG,MAAM,CAA0B,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAE/E,OAAO,GAAA;QACf,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChC;uGAXW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,eAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE;AACjC,iBAAA;;;AC1BD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-dialog.mjs","sources":["../../../projects/lib/dialog/dialog-ref.ts","../../../projects/lib/dialog/tokens/dialog-data.token.ts","../../../projects/lib/dialog/tokens/dialog-ref.token.ts","../../../projects/lib/dialog/dialog.ts","../../../projects/lib/dialog/directives/dialog-title.ts","../../../projects/lib/dialog/directives/dialog-content.ts","../../../projects/lib/dialog/directives/dialog-footer.ts","../../../projects/lib/dialog/directives/dialog-close.ts","../../../projects/lib/dialog/ngwr-dialog.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport type { ConfigurableFocusTrap } from '@angular/cdk/a11y';\nimport type { OverlayRef } from '@angular/cdk/overlay';\nimport type { ComponentRef } from '@angular/core';\n\nimport { Subject } from 'rxjs';\n\n/**\n * Handle returned by `WrDialog.open()`.\n *\n * Wraps the underlying `OverlayRef` and tracks the close result.\n *\n * @example\n * ```ts\n * const ref = dialog.open<ConfirmComponent, boolean>(ConfirmComponent);\n * const result = await ref.awaitClose(); // boolean | undefined\n * ```\n */\nexport class WrDialogRef<C, R = unknown> {\n /** Emits the close result once and completes. */\n readonly closed = new Subject<R | undefined>();\n\n /** @internal */\n componentRef: ComponentRef<C> | null = null;\n\n /** @internal */\n focusTrap: ConfigurableFocusTrap | null = null;\n\n /** @internal */\n previouslyFocused: HTMLElement | null = null;\n\n constructor(private readonly _overlayRef: OverlayRef) {}\n\n /** The instantiated dialog component. */\n get componentInstance(): C {\n if (!this.componentRef) {\n throw new Error('WrDialogRef: component not yet attached');\n }\n return this.componentRef.instance;\n }\n\n /** Close the dialog, optionally returning a result. */\n close(result?: R): void {\n this.closed.next(result);\n this.closed.complete();\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this._overlayRef.dispose();\n // Restore focus after disposal so the trigger is reachable again.\n if (restore && typeof restore.focus === 'function') {\n restore.focus();\n }\n }\n\n /** Resolves with the close result when the dialog is dismissed. */\n awaitClose(): Promise<R | undefined> {\n return new Promise(resolve => {\n this.closed.subscribe({\n next: value => resolve(value),\n complete: () => resolve(undefined),\n });\n });\n }\n\n /** Underlying overlay ref — escape hatch for advanced cases. */\n get overlayRef(): OverlayRef {\n return this._overlayRef;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\n/**\n * Token that exposes the `data` payload passed to `WrDialog.open()`.\n *\n * @example\n * ```ts\n * @Component({...})\n * export class ConfirmComponent {\n * readonly data = inject<ConfirmData>(WR_DIALOG_DATA);\n * }\n * ```\n */\nexport const WR_DIALOG_DATA = new InjectionToken<unknown>('WR_DIALOG_DATA');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrDialogRef } from '../dialog-ref';\n\n/**\n * Token exposing the open dialog's `WrDialogRef` to components and\n * directives rendered inside it (e.g. `[wrDialogClose]`).\n *\n * @internal\n */\nexport const WR_DIALOG_REF = new InjectionToken<WrDialogRef<unknown, unknown>>('WR_DIALOG_REF');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { type OverlayRef, ScrollStrategyOptions } from '@angular/cdk/overlay';\nimport { ComponentPortal, type ComponentType } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport { EnvironmentInjector, Service, Injector, PLATFORM_ID, inject } from '@angular/core';\n\nimport { WR_OVERLAY, WR_RESPONSIVE_OVERLAYS, wrPresentAsSheet } from 'ngwr/overlay';\n\nimport { WrDialogRef } from './dialog-ref';\nimport type { WrDialogOptions } from './interfaces';\nimport { WR_DIALOG_DATA, WR_DIALOG_REF } from './tokens';\n\nconst DEFAULT_PANEL_CLASS = 'wr-dialog-panel';\nconst DEFAULT_BACKDROP_CLASS = 'wr-dialog-backdrop';\n\n/**\n * Opens dialog components in an isolated NGWR overlay.\n *\n * Uses `WR_OVERLAY` so it composes cleanly with `provideWrOverlay()`\n * — dialogs render into NGWR's own overlay container and never collide\n * with other CDK consumers (Material, NG-ZORRO, etc.).\n *\n * @example\n * ```ts\n * const dialog = inject(WrDialog);\n *\n * const ref = dialog.open(ConfirmComponent, {\n * data: { message: 'Delete this item?' },\n * width: '24rem',\n * });\n *\n * const ok = await ref.awaitClose();\n * if (ok) remove();\n * ```\n *\n * @see https://ngwr.dev/components/dialog\n */\n@Service()\nexport class WrDialog {\n private readonly overlay = inject(WR_OVERLAY);\n private readonly scrollStrategies = inject(ScrollStrategyOptions);\n private readonly parentInjector = inject(EnvironmentInjector);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private readonly responsiveConfig = inject(WR_RESPONSIVE_OVERLAYS);\n\n open<C, R = unknown, D = unknown>(component: ComponentType<C>, options: WrDialogOptions<D> = {}): WrDialogRef<C, R> {\n const panelClasses: string[] = [DEFAULT_PANEL_CLASS];\n const extra = options.panelClass;\n if (typeof extra === 'string') {\n panelClasses.push(extra);\n } else if (extra) {\n for (const cls of extra) panelClasses.push(cls);\n }\n\n // On small viewports (when opted in) present as a slide-up sheet pinned\n // to the bottom edge, full-width, instead of a centred modal.\n const asSheet = wrPresentAsSheet(options.responsive, this.responsiveConfig);\n if (asSheet) panelClasses.push('wr-overlay-sheet');\n\n const position = this.overlay.position().global().centerHorizontally();\n const overlayRef: OverlayRef = this.overlay.create({\n positionStrategy: asSheet ? position.bottom('0') : position.centerVertically(),\n scrollStrategy: this.scrollStrategies.block(),\n hasBackdrop: true,\n backdropClass: DEFAULT_BACKDROP_CLASS,\n panelClass: panelClasses,\n width: asSheet ? '100%' : options.width,\n maxWidth: asSheet ? '100%' : options.maxWidth,\n });\n\n const dialogRef = new WrDialogRef<C, R>(overlayRef);\n\n if (this.isBrowser) {\n const active = document.activeElement;\n dialogRef.previouslyFocused = active instanceof HTMLElement ? active : null;\n }\n\n const injector = Injector.create({\n parent: this.parentInjector,\n providers: [\n { provide: WR_DIALOG_DATA, useValue: options.data },\n { provide: WR_DIALOG_REF, useValue: dialogRef },\n ],\n });\n\n const portal = new ComponentPortal(component, null, injector);\n dialogRef.componentRef = overlayRef.attach(portal);\n\n if (this.isBrowser) {\n const host = overlayRef.overlayElement;\n host.setAttribute('role', 'dialog');\n host.setAttribute('aria-modal', 'true');\n // Wire aria-labelledby to wrDialogTitle's auto-id once content is in DOM.\n queueMicrotask(() => {\n const titleEl = host.querySelector<HTMLElement>('[wrDialogTitle], [wr-dialog-title]');\n if (titleEl?.id) host.setAttribute('aria-labelledby', titleEl.id);\n });\n // Trap focus inside the dialog and move initial focus in.\n const trap = this.focusTrapFactory.create(host);\n dialogRef.focusTrap = trap;\n void trap.focusInitialElementWhenReady();\n }\n\n // Overlay subscriptions complete when the overlay is disposed, so no\n // explicit teardown is required.\n if (options.closeOnBackdropClick !== false) {\n overlayRef.backdropClick().subscribe(() => dialogRef.close());\n }\n if (options.closeOnEscape !== false) {\n overlayRef.keydownEvents().subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n dialogRef.close();\n }\n });\n }\n\n return dialogRef;\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, ElementRef, inject } from '@angular/core';\n\nlet uid = 0;\n\n/**\n * Styles a dialog title row. Use on a heading inside an opened dialog.\n * Auto-assigns an `id` so the dialog panel can reference it via\n * `aria-labelledby`.\n *\n * @example\n * ```html\n * <h2 wrDialogTitle>Confirm delete</h2>\n * ```\n */\n@Directive({\n selector: '[wrDialogTitle]',\n host: { class: 'wr-dialog__title', '[attr.id]': 'id' },\n})\nexport class WrDialogTitle {\n /** Generated id used for `aria-labelledby` wiring. */\n readonly id = `wr-dialog-title-${++uid}`;\n\n /** @internal */\n readonly elementRef = inject(ElementRef<HTMLElement>);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\n/**\n * Styles the scrollable body section of a dialog.\n *\n * @example\n * ```html\n * <div wrDialogContent>…body…</div>\n * ```\n */\n@Directive({\n selector: '[wrDialogContent]',\n host: { class: 'wr-dialog__content' },\n})\nexport class WrDialogContent {}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, computed, input } from '@angular/core';\n\n/**\n * Footer row, typically holding action buttons.\n *\n * @example\n * ```html\n * <div wrDialogFooter align=\"end\">\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"danger\" (click)=\"confirm()\">Delete</wr-btn>\n * </div>\n * ```\n */\n@Directive({\n selector: '[wrDialogFooter]',\n host: { '[class]': 'classes()' },\n})\nexport class WrDialogFooter {\n /**\n * Horizontal alignment of the children.\n *\n * @default 'end'\n */\n readonly align = input<'start' | 'center' | 'end'>('end');\n\n protected readonly classes = computed(() => `wr-dialog__footer wr-dialog__footer--${this.align()}`);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, inject, input } from '@angular/core';\n\nimport type { WrDialogRef } from '../dialog-ref';\nimport { WR_DIALOG_REF } from '../tokens';\n\n/**\n * Closes the dialog when the host element is clicked.\n *\n * Optionally passes a `[wrDialogClose]` value as the close result.\n *\n * @example\n * ```html\n * <wr-btn wrDialogClose>Cancel</wr-btn>\n * <wr-btn color=\"primary\" [wrDialogClose]=\"true\">Confirm</wr-btn>\n * ```\n */\n@Directive({\n selector: '[wrDialogClose]',\n host: { '(click)': 'onClick()' },\n})\nexport class WrDialogClose<R = unknown> {\n /**\n * Value to pass to `close()`. When unset, the dialog closes with\n * `undefined`.\n */\n readonly result = input<R | undefined>(undefined, { alias: 'wrDialogClose' });\n\n private readonly ref = inject<WrDialogRef<unknown, R>>(WR_DIALOG_REF, { optional: true });\n\n protected onClick(): void {\n this.ref?.close(this.result());\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AAQH;;;;;;;;;;AAUG;MACU,WAAW,CAAA;AAaO,IAAA,WAAA;;AAXpB,IAAA,MAAM,GAAG,IAAI,OAAO,EAAiB;;IAG9C,YAAY,GAA2B,IAAI;;IAG3C,SAAS,GAAiC,IAAI;;IAG9C,iBAAiB,GAAuB,IAAI;AAE5C,IAAA,WAAA,CAA6B,WAAuB,EAAA;QAAvB,IAAA,CAAA,WAAW,GAAX,WAAW;IAAe;;AAGvD,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC;QAC5D;AACA,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ;IACnC;;AAGA,IAAA,KAAK,CAAC,MAAU,EAAA;AACd,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;AACxB,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;AACtB,QAAA,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE;AACzB,QAAA,IAAI,CAAC,SAAS,GAAG,IAAI;AACrB,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB;AACtC,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI;AAC7B,QAAA,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;;QAE1B,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,EAAE;YAClD,OAAO,CAAC,KAAK,EAAE;QACjB;IACF;;IAGA,UAAU,GAAA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M,GAAG,KAAK,CAAgB,SAAS,8EAAI,KAAK,EAAE,eAAe,EAAA,CAAG;IAE5D,GAAG,GAAG,MAAM,CAA0B,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAE/E,OAAO,GAAA;QACf,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAChC;uGAXW,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,eAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE;AACjC,iBAAA;;;AC1BD;;AAEG;;;;"}
|
|
@@ -46,6 +46,16 @@ class WrSortableList {
|
|
|
46
46
|
/** Locked axis — restrict drag movement to one axis even diagonally. */
|
|
47
47
|
lockAxis = input(undefined, /* @ts-ignore */
|
|
48
48
|
...(ngDevMode ? [{ debugName: "lockAxis" }] : /* istanbul ignore next */ []));
|
|
49
|
+
/**
|
|
50
|
+
* Delay (ms) before a drag begins after the pointer goes down. The touch
|
|
51
|
+
* delay is the fix for the classic CDK touch snag: without it, the
|
|
52
|
+
* `touch-action: none` CDK puts on each item blocks scrolling the list on a
|
|
53
|
+
* phone. With a small touch delay, a quick swipe scrolls and a brief hold
|
|
54
|
+
* starts the drag; mouse stays instant. Pass a single number to apply one
|
|
55
|
+
* delay to both pointers. @default { touch: 150, mouse: 0 }
|
|
56
|
+
*/
|
|
57
|
+
dragStartDelay = input({ touch: 150, mouse: 0 }, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "dragStartDelay" }] : /* istanbul ignore next */ []));
|
|
49
59
|
/** `trackBy` for the inner `@for`. Defaults to identity. */
|
|
50
60
|
trackBy = input((_, item) => item, /* @ts-ignore */
|
|
51
61
|
...(ngDevMode ? [{ debugName: "trackBy" }] : /* istanbul ignore next */ []));
|
|
@@ -66,12 +76,12 @@ class WrSortableList {
|
|
|
66
76
|
});
|
|
67
77
|
}
|
|
68
78
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrSortableList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
69
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrSortableList, isStandalone: true, selector: "wr-sortable-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, lockAxis: { classPropertyName: "lockAxis", publicName: "lockAxis", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { items: "itemsChange", reorder: "reorder" }, host: { classAttribute: "wr-sortable-list" }, queries: [{ propertyName: "rowTemplate", first: true, predicate: (TemplateRef), descendants: true, isSignal: true }], ngImport: i0, template: "<div\n cdkDropList\n class=\"wr-sortable-list__list\"\n [cdkDropListOrientation]=\"orientation()\"\n [cdkDropListDisabled]=\"disabled()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n>\n @for (item of items(); track trackBy()($index, item)) {\n <div
|
|
79
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrSortableList, isStandalone: true, selector: "wr-sortable-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, lockAxis: { classPropertyName: "lockAxis", publicName: "lockAxis", isSignal: true, isRequired: false, transformFunction: null }, dragStartDelay: { classPropertyName: "dragStartDelay", publicName: "dragStartDelay", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { items: "itemsChange", reorder: "reorder" }, host: { classAttribute: "wr-sortable-list" }, queries: [{ propertyName: "rowTemplate", first: true, predicate: (TemplateRef), descendants: true, isSignal: true }], ngImport: i0, template: "<div\n cdkDropList\n class=\"wr-sortable-list__list\"\n [cdkDropListOrientation]=\"orientation()\"\n [cdkDropListDisabled]=\"disabled()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n>\n @for (item of items(); track trackBy()($index, item)) {\n <div\n cdkDrag\n class=\"wr-sortable-list__item\"\n [cdkDragDisabled]=\"disabled()\"\n [cdkDragLockAxis]=\"lockAxis() ?? null\"\n [cdkDragStartDelay]=\"dragStartDelay()\"\n >\n <ng-container *ngTemplateOutlet=\"rowTemplate(); context: { $implicit: item, index: $index }\" />\n </div>\n }\n</div>\n", styles: [".wr-sortable-list{display:block}.wr-sortable-list__list{display:flex;flex-direction:column;gap:var(--wr-sortable-list-gap, .5rem)}.wr-sortable-list__item{cursor:grab;-webkit-user-select:none;user-select:none;transition:box-shadow .18s ease}.wr-sortable-list__item.cdk-drag-disabled{cursor:default}.wr-sortable-list__item:active{cursor:grabbing}.wr-sortable-list[orientation=horizontal] .wr-sortable-list__list,.wr-sortable-list[data-orientation=horizontal] .wr-sortable-list__list{flex-direction:row}.wr-drag-handle{cursor:grab;display:inline-flex;align-items:center;justify-content:center;color:rgba(var(--wr-color-dark-rgb),.45);transition:color .15s ease}.wr-drag-handle:hover{color:var(--wr-color-dark)}.wr-drag-handle:active{cursor:grabbing}.cdk-drag-preview{box-sizing:border-box;color:var(--wr-color-dark);font-family:var(--wr-font-family-base);transition:none;filter:drop-shadow(0 8px 12px rgba(var(--wr-color-backdrop-rgb),.24)) drop-shadow(0 2px 3px rgba(var(--wr-color-backdrop-rgb),.16))}.cdk-drag-placeholder{opacity:.35;background:rgba(var(--wr-color-light-rgb),.6);border-radius:var(--wr-border-radius-base);outline:1px dashed rgba(var(--wr-color-dark-rgb),.25);outline-offset:-1px}.cdk-drag-animating{transition:transform .18s cubic-bezier(.2,.9,.3,1.1)}.wr-sortable-list__list.cdk-drop-list-dragging .wr-sortable-list__item:not(.cdk-drag-placeholder){transition:transform .18s cubic-bezier(.2,.9,.3,1.1)}\n"], dependencies: [{ kind: "directive", type: CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer", "cdkDropListHasAnchor"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None });
|
|
70
80
|
}
|
|
71
81
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrSortableList, decorators: [{
|
|
72
82
|
type: Component,
|
|
73
|
-
args: [{ selector: 'wr-sortable-list', encapsulation: ViewEncapsulation.None, imports: [CdkDropList, CdkDrag, NgTemplateOutlet], host: { class: 'wr-sortable-list' }, template: "<div\n cdkDropList\n class=\"wr-sortable-list__list\"\n [cdkDropListOrientation]=\"orientation()\"\n [cdkDropListDisabled]=\"disabled()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n>\n @for (item of items(); track trackBy()($index, item)) {\n <div
|
|
74
|
-
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }, { type: i0.Output, args: ["itemsChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], lockAxis: [{ type: i0.Input, args: [{ isSignal: true, alias: "lockAxis", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], reorder: [{ type: i0.Output, args: ["reorder"] }], rowTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
83
|
+
args: [{ selector: 'wr-sortable-list', encapsulation: ViewEncapsulation.None, imports: [CdkDropList, CdkDrag, NgTemplateOutlet], host: { class: 'wr-sortable-list' }, template: "<div\n cdkDropList\n class=\"wr-sortable-list__list\"\n [cdkDropListOrientation]=\"orientation()\"\n [cdkDropListDisabled]=\"disabled()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n>\n @for (item of items(); track trackBy()($index, item)) {\n <div\n cdkDrag\n class=\"wr-sortable-list__item\"\n [cdkDragDisabled]=\"disabled()\"\n [cdkDragLockAxis]=\"lockAxis() ?? null\"\n [cdkDragStartDelay]=\"dragStartDelay()\"\n >\n <ng-container *ngTemplateOutlet=\"rowTemplate(); context: { $implicit: item, index: $index }\" />\n </div>\n }\n</div>\n", styles: [".wr-sortable-list{display:block}.wr-sortable-list__list{display:flex;flex-direction:column;gap:var(--wr-sortable-list-gap, .5rem)}.wr-sortable-list__item{cursor:grab;-webkit-user-select:none;user-select:none;transition:box-shadow .18s ease}.wr-sortable-list__item.cdk-drag-disabled{cursor:default}.wr-sortable-list__item:active{cursor:grabbing}.wr-sortable-list[orientation=horizontal] .wr-sortable-list__list,.wr-sortable-list[data-orientation=horizontal] .wr-sortable-list__list{flex-direction:row}.wr-drag-handle{cursor:grab;display:inline-flex;align-items:center;justify-content:center;color:rgba(var(--wr-color-dark-rgb),.45);transition:color .15s ease}.wr-drag-handle:hover{color:var(--wr-color-dark)}.wr-drag-handle:active{cursor:grabbing}.cdk-drag-preview{box-sizing:border-box;color:var(--wr-color-dark);font-family:var(--wr-font-family-base);transition:none;filter:drop-shadow(0 8px 12px rgba(var(--wr-color-backdrop-rgb),.24)) drop-shadow(0 2px 3px rgba(var(--wr-color-backdrop-rgb),.16))}.cdk-drag-placeholder{opacity:.35;background:rgba(var(--wr-color-light-rgb),.6);border-radius:var(--wr-border-radius-base);outline:1px dashed rgba(var(--wr-color-dark-rgb),.25);outline-offset:-1px}.cdk-drag-animating{transition:transform .18s cubic-bezier(.2,.9,.3,1.1)}.wr-sortable-list__list.cdk-drop-list-dragging .wr-sortable-list__item:not(.cdk-drag-placeholder){transition:transform .18s cubic-bezier(.2,.9,.3,1.1)}\n"] }]
|
|
84
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }, { type: i0.Output, args: ["itemsChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], lockAxis: [{ type: i0.Input, args: [{ isSignal: true, alias: "lockAxis", required: false }] }], dragStartDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "dragStartDelay", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], reorder: [{ type: i0.Output, args: ["reorder"] }], rowTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
75
85
|
|
|
76
86
|
/**
|
|
77
87
|
* @license
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-drag-drop.mjs","sources":["../../../projects/lib/drag-drop/sortable-list.ts","../../../projects/lib/drag-drop/sortable-list.html","../../../projects/lib/drag-drop/drag-handle.ts","../../../projects/lib/drag-drop/ngwr-drag-drop.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { CdkDrag, type CdkDragDrop, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, TemplateRef, ViewEncapsulation, contentChild, input, model, output } from '@angular/core';\n\nimport type { WrSortableReorderEvent } from './interfaces';\n\n/**\n * Drag-to-reorder list. Wraps CDK's `cdkDropList` + `cdkDrag` with a\n * signal-based items binding — the source array is updated in place and\n * emitted via 2-way `[(items)]`.\n *\n * Drop a single template — it's rendered per item with `let-item\n * let-index=\"index\"`. Add `[handle]=\"true\"` (or `[wrDragHandle]` inside\n * your template) to restrict drag start to a handle element.\n *\n * @example\n * ```html\n * <wr-sortable-list [(items)]=\"rows\" (reorder)=\"onReorder($event)\">\n * <ng-template let-row let-i=\"index\">\n * <div class=\"row\">\n * <span wrDragHandle>≡</span>\n * {{ i + 1 }}. {{ row.label }}\n * </div>\n * </ng-template>\n * </wr-sortable-list>\n * ```\n *\n * @see https://ngwr.dev/components/drag-drop\n */\n@Component({\n selector: 'wr-sortable-list',\n templateUrl: './sortable-list.html',\n styleUrl: './sortable-list.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [CdkDropList, CdkDrag, NgTemplateOutlet],\n host: { class: 'wr-sortable-list' },\n})\nexport class WrSortableList<T = unknown> {\n /** Items to render. Two-way — emits the reordered array on drop. */\n readonly items = model.required<T[]>();\n\n /** Layout direction. Drives CDK's `cdkDropListOrientation`. @default 'vertical' */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Disable all dragging. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Locked axis — restrict drag movement to one axis even diagonally. */\n readonly lockAxis = input<'x' | 'y' | undefined>(undefined);\n\n /** `trackBy` for the inner `@for`. Defaults to identity. */\n readonly trackBy = input<(index: number, item: T) => unknown>((_, item) => item);\n\n /** Fired after a successful reorder with the new array + indices. */\n readonly reorder = output<WrSortableReorderEvent<T>>();\n\n protected readonly rowTemplate = contentChild.required(TemplateRef<{ $implicit: T; index: number }>);\n\n protected onDrop(event: CdkDragDrop<T[]>): void {\n if (event.previousIndex === event.currentIndex) return;\n const next = this.items().slice();\n moveItemInArray(next, event.previousIndex, event.currentIndex);\n this.items.set(next);\n this.reorder.emit({\n items: next,\n previousIndex: event.previousIndex,\n currentIndex: event.currentIndex,\n item: next[event.currentIndex],\n });\n }\n}\n\nexport type { WrSortableReorderEvent } from './interfaces';\n","<div\n cdkDropList\n class=\"wr-sortable-list__list\"\n [cdkDropListOrientation]=\"orientation()\"\n [cdkDropListDisabled]=\"disabled()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n>\n @for (item of items(); track trackBy()($index, item)) {\n <div
|
|
1
|
+
{"version":3,"file":"ngwr-drag-drop.mjs","sources":["../../../projects/lib/drag-drop/sortable-list.ts","../../../projects/lib/drag-drop/sortable-list.html","../../../projects/lib/drag-drop/drag-handle.ts","../../../projects/lib/drag-drop/ngwr-drag-drop.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { CdkDrag, type CdkDragDrop, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, TemplateRef, ViewEncapsulation, contentChild, input, model, output } from '@angular/core';\n\nimport type { WrSortableReorderEvent } from './interfaces';\n\n/**\n * Drag-to-reorder list. Wraps CDK's `cdkDropList` + `cdkDrag` with a\n * signal-based items binding — the source array is updated in place and\n * emitted via 2-way `[(items)]`.\n *\n * Drop a single template — it's rendered per item with `let-item\n * let-index=\"index\"`. Add `[handle]=\"true\"` (or `[wrDragHandle]` inside\n * your template) to restrict drag start to a handle element.\n *\n * @example\n * ```html\n * <wr-sortable-list [(items)]=\"rows\" (reorder)=\"onReorder($event)\">\n * <ng-template let-row let-i=\"index\">\n * <div class=\"row\">\n * <span wrDragHandle>≡</span>\n * {{ i + 1 }}. {{ row.label }}\n * </div>\n * </ng-template>\n * </wr-sortable-list>\n * ```\n *\n * @see https://ngwr.dev/components/drag-drop\n */\n@Component({\n selector: 'wr-sortable-list',\n templateUrl: './sortable-list.html',\n styleUrl: './sortable-list.scss',\n encapsulation: ViewEncapsulation.None,\n imports: [CdkDropList, CdkDrag, NgTemplateOutlet],\n host: { class: 'wr-sortable-list' },\n})\nexport class WrSortableList<T = unknown> {\n /** Items to render. Two-way — emits the reordered array on drop. */\n readonly items = model.required<T[]>();\n\n /** Layout direction. Drives CDK's `cdkDropListOrientation`. @default 'vertical' */\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Disable all dragging. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /** Locked axis — restrict drag movement to one axis even diagonally. */\n readonly lockAxis = input<'x' | 'y' | undefined>(undefined);\n\n /**\n * Delay (ms) before a drag begins after the pointer goes down. The touch\n * delay is the fix for the classic CDK touch snag: without it, the\n * `touch-action: none` CDK puts on each item blocks scrolling the list on a\n * phone. With a small touch delay, a quick swipe scrolls and a brief hold\n * starts the drag; mouse stays instant. Pass a single number to apply one\n * delay to both pointers. @default { touch: 150, mouse: 0 }\n */\n readonly dragStartDelay = input<number | { touch: number; mouse: number }>({ touch: 150, mouse: 0 });\n\n /** `trackBy` for the inner `@for`. Defaults to identity. */\n readonly trackBy = input<(index: number, item: T) => unknown>((_, item) => item);\n\n /** Fired after a successful reorder with the new array + indices. */\n readonly reorder = output<WrSortableReorderEvent<T>>();\n\n protected readonly rowTemplate = contentChild.required(TemplateRef<{ $implicit: T; index: number }>);\n\n protected onDrop(event: CdkDragDrop<T[]>): void {\n if (event.previousIndex === event.currentIndex) return;\n const next = this.items().slice();\n moveItemInArray(next, event.previousIndex, event.currentIndex);\n this.items.set(next);\n this.reorder.emit({\n items: next,\n previousIndex: event.previousIndex,\n currentIndex: event.currentIndex,\n item: next[event.currentIndex],\n });\n }\n}\n\nexport type { WrSortableReorderEvent } from './interfaces';\n","<div\n cdkDropList\n class=\"wr-sortable-list__list\"\n [cdkDropListOrientation]=\"orientation()\"\n [cdkDropListDisabled]=\"disabled()\"\n (cdkDropListDropped)=\"onDrop($event)\"\n>\n @for (item of items(); track trackBy()($index, item)) {\n <div\n cdkDrag\n class=\"wr-sortable-list__item\"\n [cdkDragDisabled]=\"disabled()\"\n [cdkDragLockAxis]=\"lockAxis() ?? null\"\n [cdkDragStartDelay]=\"dragStartDelay()\"\n >\n <ng-container *ngTemplateOutlet=\"rowTemplate(); context: { $implicit: item, index: $index }\" />\n </div>\n }\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { CdkDragHandle } from '@angular/cdk/drag-drop';\nimport { Directive } from '@angular/core';\n\n/**\n * Drag handle for {@link WrSortableList} (and any nested `cdkDrag`).\n * Composes CDK's `cdkDragHandle` via `hostDirectives` so consumers don't\n * need to import the CDK selector directly.\n *\n * @example\n * ```html\n * <wr-sortable-list [(items)]=\"rows\">\n * <ng-template let-row>\n * <div class=\"row\">\n * <span wrDragHandle class=\"grip\">≡</span>\n * <span>{{ row.label }}</span>\n * </div>\n * </ng-template>\n * </wr-sortable-list>\n * ```\n */\n@Directive({\n selector: '[wrDragHandle]',\n hostDirectives: [CdkDragHandle],\n host: { class: 'wr-drag-handle' },\n})\nexport class WrDragHandle {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;AAKG;AASH;;;;;;;;;;;;;;;;;;;;;;AAsBG;MASU,cAAc,CAAA;;IAEhB,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAO;;IAG7B,WAAW,GAAG,KAAK,CAA4B,UAAU;oFAAC;;IAG1D,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,qBAAqB,EAAA,CAAG;;IAG7D,QAAQ,GAAG,KAAK,CAAwB,SAAS;iFAAC;AAE3D;;;;;;;AAOG;IACM,cAAc,GAAG,KAAK,CAA4C,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE;uFAAC;;IAG3F,OAAO,GAAG,KAAK,CAAsC,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI;gFAAC;;IAGvE,OAAO,GAAG,MAAM,EAA6B;IAEnC,WAAW,GAAG,YAAY,CAAC,QAAQ,EAAC,WAA4C,EAAC;AAE1F,IAAA,MAAM,CAAC,KAAuB,EAAA;AACtC,QAAA,IAAI,KAAK,CAAC,aAAa,KAAK,KAAK,CAAC,YAAY;YAAE;QAChD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,E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,EAAA,CAAA;kBALxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,gBAAgB;oBAC1B,cAAc,EAAE,CAAC,aAAa,CAAC;AAC/B,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE;AAClC,iBAAA;;;AC/BD;;AAEG;;;;"}
|
package/fesm2022/ngwr-drawer.mjs
CHANGED
|
@@ -59,9 +59,9 @@ class WrDrawer {
|
|
|
59
59
|
*/
|
|
60
60
|
rounded = input(false, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
61
61
|
/**
|
|
62
|
-
* Render a grab handle at the leading edge
|
|
63
|
-
*
|
|
64
|
-
* @default false
|
|
62
|
+
* Render a grab handle at the leading edge and enable swipe-to-dismiss:
|
|
63
|
+
* drag the handle toward the drawer's edge (down for `bottom`, left for
|
|
64
|
+
* `left`, …) and release past ~30% of the panel to close. @default false
|
|
65
65
|
*/
|
|
66
66
|
showHandle = input(false, { ...(ngDevMode ? { debugName: "showHandle" } : /* istanbul ignore next */ {}), transform: coerceBooleanProperty });
|
|
67
67
|
/**
|
|
@@ -84,6 +84,67 @@ class WrDrawer {
|
|
|
84
84
|
parts.push('wr-drawer__panel--safe-area');
|
|
85
85
|
return parts.join(' ');
|
|
86
86
|
}
|
|
87
|
+
// Swipe-to-dismiss — gated to the grab handle, so it never fights the
|
|
88
|
+
// panel's own scrolling. The panel follows the finger toward the closing
|
|
89
|
+
// edge and closes past ~30% of its size, otherwise snaps back.
|
|
90
|
+
swipeStartX = 0;
|
|
91
|
+
swipeStartY = 0;
|
|
92
|
+
swiping = false;
|
|
93
|
+
onSwipeStart(event) {
|
|
94
|
+
const touch = event.touches[0];
|
|
95
|
+
if (!touch)
|
|
96
|
+
return;
|
|
97
|
+
this.swipeStartX = touch.clientX;
|
|
98
|
+
this.swipeStartY = touch.clientY;
|
|
99
|
+
this.swiping = true;
|
|
100
|
+
}
|
|
101
|
+
onSwipeMove(event, panel) {
|
|
102
|
+
if (!this.swiping)
|
|
103
|
+
return;
|
|
104
|
+
const touch = event.touches[0];
|
|
105
|
+
if (!touch)
|
|
106
|
+
return;
|
|
107
|
+
const { axis, sign } = this.closeAxis();
|
|
108
|
+
const delta = axis === 'y' ? touch.clientY - this.swipeStartY : touch.clientX - this.swipeStartX;
|
|
109
|
+
// Only follow the finger when dragging toward the closing edge.
|
|
110
|
+
if (delta * sign <= 0) {
|
|
111
|
+
panel.style.transform = '';
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
panel.style.transition = 'none';
|
|
116
|
+
panel.style.transform = axis === 'y' ? `translateY(${delta}px)` : `translateX(${delta}px)`;
|
|
117
|
+
}
|
|
118
|
+
onSwipeEnd(event, panel) {
|
|
119
|
+
if (!this.swiping)
|
|
120
|
+
return;
|
|
121
|
+
this.swiping = false;
|
|
122
|
+
const touch = event.changedTouches[0];
|
|
123
|
+
const { axis, sign } = this.closeAxis();
|
|
124
|
+
const delta = touch ? (axis === 'y' ? touch.clientY - this.swipeStartY : touch.clientX - this.swipeStartX) : 0;
|
|
125
|
+
const panelSize = axis === 'y' ? panel.offsetHeight : panel.offsetWidth;
|
|
126
|
+
if (delta * sign > panelSize * 0.3) {
|
|
127
|
+
this.open.set(false); // keep the dragged offset as the overlay disposes
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
panel.style.transition = '';
|
|
131
|
+
panel.style.transform = '';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Axis + sign of the closing direction for the current position. */
|
|
135
|
+
closeAxis() {
|
|
136
|
+
switch (this.position()) {
|
|
137
|
+
case 'bottom':
|
|
138
|
+
return { axis: 'y', sign: 1 };
|
|
139
|
+
case 'top':
|
|
140
|
+
return { axis: 'y', sign: -1 };
|
|
141
|
+
case 'left':
|
|
142
|
+
return { axis: 'x', sign: -1 };
|
|
143
|
+
case 'right':
|
|
144
|
+
default:
|
|
145
|
+
return { axis: 'x', sign: 1 };
|
|
146
|
+
}
|
|
147
|
+
}
|
|
87
148
|
overlay = inject(WR_OVERLAY);
|
|
88
149
|
vcr = inject(ViewContainerRef);
|
|
89
150
|
destroyRef = inject(DestroyRef);
|
|
@@ -176,11 +237,11 @@ class WrDrawer {
|
|
|
176
237
|
}
|
|
177
238
|
}
|
|
178
239
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrDrawer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
179
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrDrawer, isStandalone: true, selector: "wr-drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showHandle: { classPropertyName: "showHandle", publicName: "showHandle", isSignal: true, isRequired: false, transformFunction: null }, safeArea: { classPropertyName: "safeArea", publicName: "safeArea", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { styleAttribute: "display:none" }, viewQueries: [{ propertyName: "panelTpl", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template>\n <div [class]=\"panelClass()\">\n @if (showHandle()) {\n <div
|
|
240
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.2", type: WrDrawer, isStandalone: true, selector: "wr-drawer", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, showHandle: { classPropertyName: "showHandle", publicName: "showHandle", isSignal: true, isRequired: false, transformFunction: null }, safeArea: { classPropertyName: "safeArea", publicName: "safeArea", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange" }, host: { styleAttribute: "display:none" }, viewQueries: [{ propertyName: "panelTpl", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template>\n <div #panel [class]=\"panelClass()\">\n @if (showHandle()) {\n <div\n class=\"wr-drawer__handle\"\n aria-hidden=\"true\"\n (touchstart)=\"onSwipeStart($event)\"\n (touchmove)=\"onSwipeMove($event, panel)\"\n (touchend)=\"onSwipeEnd($event, panel)\"\n (touchcancel)=\"onSwipeEnd($event, panel)\"\n >\n <span class=\"wr-drawer__grabber\"></span>\n </div>\n }\n <ng-content />\n </div>\n</ng-template>\n", encapsulation: i0.ViewEncapsulation.None });
|
|
180
241
|
}
|
|
181
242
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.2", ngImport: i0, type: WrDrawer, decorators: [{
|
|
182
243
|
type: Component,
|
|
183
|
-
args: [{ selector: 'wr-drawer', encapsulation: ViewEncapsulation.None, host: { style: 'display:none' }, template: "<ng-template>\n <div [class]=\"panelClass()\">\n @if (showHandle()) {\n <div
|
|
244
|
+
args: [{ selector: 'wr-drawer', encapsulation: ViewEncapsulation.None, host: { style: 'display:none' }, template: "<ng-template>\n <div #panel [class]=\"panelClass()\">\n @if (showHandle()) {\n <div\n class=\"wr-drawer__handle\"\n aria-hidden=\"true\"\n (touchstart)=\"onSwipeStart($event)\"\n (touchmove)=\"onSwipeMove($event, panel)\"\n (touchend)=\"onSwipeEnd($event, panel)\"\n (touchcancel)=\"onSwipeEnd($event, panel)\"\n >\n <span class=\"wr-drawer__grabber\"></span>\n </div>\n }\n <ng-content />\n </div>\n</ng-template>\n" }]
|
|
184
245
|
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], maxHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxHeight", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], showHandle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHandle", required: false }] }], safeArea: [{ type: i0.Input, args: [{ isSignal: true, alias: "safeArea", required: false }] }], hasBackdrop: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasBackdrop", required: false }] }], closeOnBackdropClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnBackdropClick", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], panelTpl: [{ type: i0.ViewChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
|
|
185
246
|
|
|
186
247
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-drawer.mjs","sources":["../../../projects/lib/drawer/drawer.ts","../../../projects/lib/drawer/drawer.html","../../../projects/lib/drawer/directives/drawer-title.ts","../../../projects/lib/drawer/directives/drawer-content.ts","../../../projects/lib/drawer/directives/drawer-footer.ts","../../../projects/lib/drawer/directives/drawer-close.ts","../../../projects/lib/drawer/ngwr-drawer.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n PLATFORM_ID,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n effect,\n inject,\n input,\n model,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { WR_OVERLAY } from 'ngwr/overlay';\n\nimport type { WrDrawerPosition } from './interfaces';\n\n/**\n * Side panel that slides in from an edge of the viewport. Two-way binds\n * `open` and renders into a CDK overlay so it sits above page content.\n *\n * Compose the body with `<wrDrawerTitle>`, `<wrDrawerContent>`, and\n * `<wrDrawerFooter>` directives.\n *\n * @example\n * ```html\n * <wr-drawer [(open)]=\"settingsOpen\" position=\"right\" width=\"24rem\">\n * <h2 wrDrawerTitle>Settings</h2>\n * <div wrDrawerContent>...</div>\n * <div wrDrawerFooter>\n * <wr-btn wrDrawerClose>Close</wr-btn>\n * </div>\n * </wr-drawer>\n * ```\n *\n * @see https://ngwr.dev/components/drawer\n */\n@Component({\n selector: 'wr-drawer',\n templateUrl: './drawer.html',\n encapsulation: ViewEncapsulation.None,\n host: { style: 'display:none' },\n})\nexport class WrDrawer {\n /** Two-way bindable open state. */\n readonly open = model<boolean>(false);\n\n /** Side the drawer slides in from. @default 'right' */\n readonly position = input<WrDrawerPosition>('right');\n\n /** Width when position is left/right. Any CSS length. @default '20rem' */\n readonly width = input<string>('20rem');\n\n /** Height when position is top/bottom. Any CSS length. @default '16rem' */\n readonly height = input<string>('16rem');\n\n /**\n * Upper cap on height (top/bottom positions). Useful for bottom sheets\n * that should grow with content up to a viewport-relative max.\n * Any CSS length. @default null (no cap)\n */\n readonly maxHeight = input<string | null>(null);\n\n /**\n * Round the leading corners — the edge facing the viewport interior.\n * Common bottom-sheet styling. @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Render a grab handle at the leading edge. Visual affordance for\n * \"swipe to dismiss\" patterns. Cosmetic — no swipe logic attached.\n * @default false\n */\n readonly showHandle = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pad the trailing edge with `env(safe-area-inset-*)` so content\n * doesn't sit under the iOS home indicator. @default false\n */\n readonly safeArea = input(false, { transform: coerceBooleanProperty });\n\n /** Show the dimming backdrop. @default true */\n readonly hasBackdrop = input(true, { transform: coerceBooleanProperty });\n\n /** Close when the backdrop is clicked. @default true */\n readonly closeOnBackdropClick = input(true, { transform: coerceBooleanProperty });\n\n /** Close on Escape. @default true */\n readonly closeOnEscape = input(true, { transform: coerceBooleanProperty });\n\n protected readonly panelTpl = viewChild.required(TemplateRef);\n\n protected panelClass(): string {\n const parts = ['wr-drawer__panel', `wr-drawer__panel--${this.position()}`];\n if (this.rounded()) parts.push('wr-drawer__panel--rounded');\n if (this.safeArea()) parts.push('wr-drawer__panel--safe-area');\n return parts.join(' ');\n }\n\n private readonly overlay = inject(WR_OVERLAY);\n private readonly vcr = inject(ViewContainerRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private previouslyFocused: HTMLElement | null = null;\n\n constructor() {\n effect(() => {\n if (this.open()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n this.destroyRef.onDestroy(() => this.closeOverlay());\n }\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n\n const pos = this.position();\n const isHorizontal = pos === 'left' || pos === 'right';\n\n const positionStrategy = this.overlay\n .position()\n .global()\n [pos === 'left' ? 'left' : pos === 'right' ? 'right' : 'centerHorizontally']();\n\n if (pos === 'top') positionStrategy.top();\n else if (pos === 'bottom') positionStrategy.bottom();\n else positionStrategy.centerVertically();\n\n const cap = this.maxHeight();\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n hasBackdrop: this.hasBackdrop(),\n backdropClass: 'wr-drawer-backdrop',\n panelClass: ['wr-drawer-overlay', `wr-drawer-overlay--${pos}`],\n scrollStrategy: this.overlay.scrollStrategies.block(),\n width: isHorizontal ? this.width() : '100vw',\n height: isHorizontal ? '100vh' : this.height(),\n maxHeight: isHorizontal ? undefined : (cap ?? undefined),\n });\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n if (this.isBrowser) {\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n const host = this.overlayRef.overlayElement;\n host.setAttribute('role', 'dialog');\n host.setAttribute('aria-modal', 'true');\n queueMicrotask(() => {\n const titleEl = host.querySelector<HTMLElement>('[wrDrawerTitle], [wr-drawer-title]');\n if (titleEl?.id) host.setAttribute('aria-labelledby', titleEl.id);\n });\n this.focusTrap = this.focusTrapFactory.create(host);\n void this.focusTrap.focusInitialElementWhenReady();\n }\n\n if (this.closeOnBackdropClick()) {\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.open.set(false));\n }\n\n if (this.closeOnEscape()) {\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.open.set(false);\n }\n });\n }\n }\n\n private closeOverlay(): void {\n if (!this.overlayRef) return;\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this.overlayRef.dispose();\n this.overlayRef = null;\n if (restore && typeof restore.focus === 'function') {\n restore.focus();\n }\n }\n}\n","<ng-template>\n <div [class]=\"panelClass()\">\n @if (showHandle()) {\n <div class=\"wr-drawer__handle\" aria-hidden=\"true\">\n <span class=\"wr-drawer__grabber\"></span>\n </div>\n }\n <ng-content />\n </div>\n</ng-template>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\nlet uid = 0;\n\n/**\n * Marks an element as the drawer's title row. Applies the `wr-drawer__title`\n * class so the drawer's stylesheet can lay it out alongside content and\n * footer slots. Auto-assigns an `id` so the drawer panel references it via\n * `aria-labelledby`.\n *\n * @example\n * ```html\n * <wr-drawer [(open)]=\"open\">\n * <h2 wrDrawerTitle>Settings</h2>\n * <div wrDrawerContent>…</div>\n * </wr-drawer>\n * ```\n */\n@Directive({\n selector: '[wrDrawerTitle]',\n host: { class: 'wr-drawer__title', '[attr.id]': 'id' },\n})\nexport class WrDrawerTitle {\n /** Generated id used by the drawer panel for `aria-labelledby`. */\n readonly id = `wr-drawer-title-${++uid}`;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\n/**\n * Marks the scrollable body of the drawer. Applies the `wr-drawer__content`\n * class so the panel's flex layout can stretch it between the title and the\n * footer.\n */\n@Directive({\n selector: '[wrDrawerContent]',\n host: { class: 'wr-drawer__content' },\n})\nexport class WrDrawerContent {}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, computed, input } from '@angular/core';\n\n/**\n * Marks the action row pinned to the bottom of the drawer. Adds the\n * `wr-drawer__footer` class plus an alignment modifier so action buttons\n * can sit at the start, center, or end of the row.\n *\n * @example\n * ```html\n * <div wrDrawerFooter align=\"end\">\n * <wr-btn wrDrawerClose>Cancel</wr-btn>\n * <wr-btn color=\"primary\" (click)=\"save()\">Save</wr-btn>\n * </div>\n * ```\n */\n@Directive({\n selector: '[wrDrawerFooter]',\n host: { '[class]': 'classes()' },\n})\nexport class WrDrawerFooter {\n /** Horizontal alignment of footer content. @default 'end' */\n readonly align = input<'start' | 'center' | 'end'>('end');\n\n protected readonly classes = computed(() => `wr-drawer__footer wr-drawer__footer--${this.align()}`);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, inject } from '@angular/core';\n\nimport { WrDrawer } from '../drawer';\n\n/**\n * Closes the parent drawer on click. Attach to any clickable element.\n *\n * @example\n * ```html\n * <wr-btn wrDrawerClose>Close</wr-btn>\n * ```\n */\n@Directive({\n selector: '[wrDrawerClose]',\n host: { '(click)': 'close()' },\n})\nexport class WrDrawerClose {\n private readonly drawer = inject(WrDrawer, { optional: true });\n\n protected close(): void {\n this.drawer?.open.set(false);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AA0BH;;;;;;;;;;;;;;;;;;;AAmBG;MAOU,QAAQ,CAAA;;IAEV,IAAI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zB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iBAAiB;AAC3B,oBAAA,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE;AAC/B,iBAAA;;;ACtBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngwr-drawer.mjs","sources":["../../../projects/lib/drawer/drawer.ts","../../../projects/lib/drawer/drawer.html","../../../projects/lib/drawer/directives/drawer-title.ts","../../../projects/lib/drawer/directives/drawer-content.ts","../../../projects/lib/drawer/directives/drawer-footer.ts","../../../projects/lib/drawer/directives/drawer-close.ts","../../../projects/lib/drawer/ngwr-drawer.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { type ConfigurableFocusTrap, ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { type OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n PLATFORM_ID,\n TemplateRef,\n ViewContainerRef,\n ViewEncapsulation,\n effect,\n inject,\n input,\n model,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nimport { WR_OVERLAY } from 'ngwr/overlay';\n\nimport type { WrDrawerPosition } from './interfaces';\n\n/**\n * Side panel that slides in from an edge of the viewport. Two-way binds\n * `open` and renders into a CDK overlay so it sits above page content.\n *\n * Compose the body with `<wrDrawerTitle>`, `<wrDrawerContent>`, and\n * `<wrDrawerFooter>` directives.\n *\n * @example\n * ```html\n * <wr-drawer [(open)]=\"settingsOpen\" position=\"right\" width=\"24rem\">\n * <h2 wrDrawerTitle>Settings</h2>\n * <div wrDrawerContent>...</div>\n * <div wrDrawerFooter>\n * <wr-btn wrDrawerClose>Close</wr-btn>\n * </div>\n * </wr-drawer>\n * ```\n *\n * @see https://ngwr.dev/components/drawer\n */\n@Component({\n selector: 'wr-drawer',\n templateUrl: './drawer.html',\n encapsulation: ViewEncapsulation.None,\n host: { style: 'display:none' },\n})\nexport class WrDrawer {\n /** Two-way bindable open state. */\n readonly open = model<boolean>(false);\n\n /** Side the drawer slides in from. @default 'right' */\n readonly position = input<WrDrawerPosition>('right');\n\n /** Width when position is left/right. Any CSS length. @default '20rem' */\n readonly width = input<string>('20rem');\n\n /** Height when position is top/bottom. Any CSS length. @default '16rem' */\n readonly height = input<string>('16rem');\n\n /**\n * Upper cap on height (top/bottom positions). Useful for bottom sheets\n * that should grow with content up to a viewport-relative max.\n * Any CSS length. @default null (no cap)\n */\n readonly maxHeight = input<string | null>(null);\n\n /**\n * Round the leading corners — the edge facing the viewport interior.\n * Common bottom-sheet styling. @default false\n */\n readonly rounded = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Render a grab handle at the leading edge and enable swipe-to-dismiss:\n * drag the handle toward the drawer's edge (down for `bottom`, left for\n * `left`, …) and release past ~30% of the panel to close. @default false\n */\n readonly showHandle = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Pad the trailing edge with `env(safe-area-inset-*)` so content\n * doesn't sit under the iOS home indicator. @default false\n */\n readonly safeArea = input(false, { transform: coerceBooleanProperty });\n\n /** Show the dimming backdrop. @default true */\n readonly hasBackdrop = input(true, { transform: coerceBooleanProperty });\n\n /** Close when the backdrop is clicked. @default true */\n readonly closeOnBackdropClick = input(true, { transform: coerceBooleanProperty });\n\n /** Close on Escape. @default true */\n readonly closeOnEscape = input(true, { transform: coerceBooleanProperty });\n\n protected readonly panelTpl = viewChild.required(TemplateRef);\n\n protected panelClass(): string {\n const parts = ['wr-drawer__panel', `wr-drawer__panel--${this.position()}`];\n if (this.rounded()) parts.push('wr-drawer__panel--rounded');\n if (this.safeArea()) parts.push('wr-drawer__panel--safe-area');\n return parts.join(' ');\n }\n\n // Swipe-to-dismiss — gated to the grab handle, so it never fights the\n // panel's own scrolling. The panel follows the finger toward the closing\n // edge and closes past ~30% of its size, otherwise snaps back.\n\n private swipeStartX = 0;\n private swipeStartY = 0;\n private swiping = false;\n\n protected onSwipeStart(event: TouchEvent): void {\n const touch = event.touches[0];\n if (!touch) return;\n this.swipeStartX = touch.clientX;\n this.swipeStartY = touch.clientY;\n this.swiping = true;\n }\n\n protected onSwipeMove(event: TouchEvent, panel: HTMLElement): void {\n if (!this.swiping) return;\n const touch = event.touches[0];\n if (!touch) return;\n const { axis, sign } = this.closeAxis();\n const delta = axis === 'y' ? touch.clientY - this.swipeStartY : touch.clientX - this.swipeStartX;\n // Only follow the finger when dragging toward the closing edge.\n if (delta * sign <= 0) {\n panel.style.transform = '';\n return;\n }\n event.preventDefault();\n panel.style.transition = 'none';\n panel.style.transform = axis === 'y' ? `translateY(${delta}px)` : `translateX(${delta}px)`;\n }\n\n protected onSwipeEnd(event: TouchEvent, panel: HTMLElement): void {\n if (!this.swiping) return;\n this.swiping = false;\n const touch = event.changedTouches[0];\n const { axis, sign } = this.closeAxis();\n const delta = touch ? (axis === 'y' ? touch.clientY - this.swipeStartY : touch.clientX - this.swipeStartX) : 0;\n const panelSize = axis === 'y' ? panel.offsetHeight : panel.offsetWidth;\n if (delta * sign > panelSize * 0.3) {\n this.open.set(false); // keep the dragged offset as the overlay disposes\n } else {\n panel.style.transition = '';\n panel.style.transform = '';\n }\n }\n\n /** Axis + sign of the closing direction for the current position. */\n private closeAxis(): { axis: 'x' | 'y'; sign: number } {\n switch (this.position()) {\n case 'bottom':\n return { axis: 'y', sign: 1 };\n case 'top':\n return { axis: 'y', sign: -1 };\n case 'left':\n return { axis: 'x', sign: -1 };\n case 'right':\n default:\n return { axis: 'x', sign: 1 };\n }\n }\n\n private readonly overlay = inject(WR_OVERLAY);\n private readonly vcr = inject(ViewContainerRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly focusTrapFactory = inject(ConfigurableFocusTrapFactory);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n private overlayRef: OverlayRef | null = null;\n private focusTrap: ConfigurableFocusTrap | null = null;\n private previouslyFocused: HTMLElement | null = null;\n\n constructor() {\n effect(() => {\n if (this.open()) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n });\n this.destroyRef.onDestroy(() => this.closeOverlay());\n }\n\n private openOverlay(): void {\n if (this.overlayRef) return;\n\n const pos = this.position();\n const isHorizontal = pos === 'left' || pos === 'right';\n\n const positionStrategy = this.overlay\n .position()\n .global()\n [pos === 'left' ? 'left' : pos === 'right' ? 'right' : 'centerHorizontally']();\n\n if (pos === 'top') positionStrategy.top();\n else if (pos === 'bottom') positionStrategy.bottom();\n else positionStrategy.centerVertically();\n\n const cap = this.maxHeight();\n\n this.overlayRef = this.overlay.create({\n positionStrategy,\n hasBackdrop: this.hasBackdrop(),\n backdropClass: 'wr-drawer-backdrop',\n panelClass: ['wr-drawer-overlay', `wr-drawer-overlay--${pos}`],\n scrollStrategy: this.overlay.scrollStrategies.block(),\n width: isHorizontal ? this.width() : '100vw',\n height: isHorizontal ? '100vh' : this.height(),\n maxHeight: isHorizontal ? undefined : (cap ?? undefined),\n });\n\n const portal = new TemplatePortal(this.panelTpl(), this.vcr);\n this.overlayRef.attach(portal);\n\n if (this.isBrowser) {\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n const host = this.overlayRef.overlayElement;\n host.setAttribute('role', 'dialog');\n host.setAttribute('aria-modal', 'true');\n queueMicrotask(() => {\n const titleEl = host.querySelector<HTMLElement>('[wrDrawerTitle], [wr-drawer-title]');\n if (titleEl?.id) host.setAttribute('aria-labelledby', titleEl.id);\n });\n this.focusTrap = this.focusTrapFactory.create(host);\n void this.focusTrap.focusInitialElementWhenReady();\n }\n\n if (this.closeOnBackdropClick()) {\n this.overlayRef\n .backdropClick()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(() => this.open.set(false));\n }\n\n if (this.closeOnEscape()) {\n this.overlayRef\n .keydownEvents()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event.key === 'Escape') {\n event.preventDefault();\n this.open.set(false);\n }\n });\n }\n }\n\n private closeOverlay(): void {\n if (!this.overlayRef) return;\n this.focusTrap?.destroy();\n this.focusTrap = null;\n const restore = this.previouslyFocused;\n this.previouslyFocused = null;\n this.overlayRef.dispose();\n this.overlayRef = null;\n if (restore && typeof restore.focus === 'function') {\n restore.focus();\n }\n }\n}\n","<ng-template>\n <div #panel [class]=\"panelClass()\">\n @if (showHandle()) {\n <div\n class=\"wr-drawer__handle\"\n aria-hidden=\"true\"\n (touchstart)=\"onSwipeStart($event)\"\n (touchmove)=\"onSwipeMove($event, panel)\"\n (touchend)=\"onSwipeEnd($event, panel)\"\n (touchcancel)=\"onSwipeEnd($event, panel)\"\n >\n <span class=\"wr-drawer__grabber\"></span>\n </div>\n }\n <ng-content />\n </div>\n</ng-template>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\nlet uid = 0;\n\n/**\n * Marks an element as the drawer's title row. Applies the `wr-drawer__title`\n * class so the drawer's stylesheet can lay it out alongside content and\n * footer slots. Auto-assigns an `id` so the drawer panel references it via\n * `aria-labelledby`.\n *\n * @example\n * ```html\n * <wr-drawer [(open)]=\"open\">\n * <h2 wrDrawerTitle>Settings</h2>\n * <div wrDrawerContent>…</div>\n * </wr-drawer>\n * ```\n */\n@Directive({\n selector: '[wrDrawerTitle]',\n host: { class: 'wr-drawer__title', '[attr.id]': 'id' },\n})\nexport class WrDrawerTitle {\n /** Generated id used by the drawer panel for `aria-labelledby`. */\n readonly id = `wr-drawer-title-${++uid}`;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive } from '@angular/core';\n\n/**\n * Marks the scrollable body of the drawer. Applies the `wr-drawer__content`\n * class so the panel's flex layout can stretch it between the title and the\n * footer.\n */\n@Directive({\n selector: '[wrDrawerContent]',\n host: { class: 'wr-drawer__content' },\n})\nexport class WrDrawerContent {}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, computed, input } from '@angular/core';\n\n/**\n * Marks the action row pinned to the bottom of the drawer. Adds the\n * `wr-drawer__footer` class plus an alignment modifier so action buttons\n * can sit at the start, center, or end of the row.\n *\n * @example\n * ```html\n * <div wrDrawerFooter align=\"end\">\n * <wr-btn wrDrawerClose>Cancel</wr-btn>\n * <wr-btn color=\"primary\" (click)=\"save()\">Save</wr-btn>\n * </div>\n * ```\n */\n@Directive({\n selector: '[wrDrawerFooter]',\n host: { '[class]': 'classes()' },\n})\nexport class WrDrawerFooter {\n /** Horizontal alignment of footer content. @default 'end' */\n readonly align = input<'start' | 'center' | 'end'>('end');\n\n protected readonly classes = computed(() => `wr-drawer__footer wr-drawer__footer--${this.align()}`);\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Directive, inject } from '@angular/core';\n\nimport { WrDrawer } from '../drawer';\n\n/**\n * Closes the parent drawer on click. Attach to any clickable element.\n *\n * @example\n * ```html\n * <wr-btn wrDrawerClose>Close</wr-btn>\n * ```\n */\n@Directive({\n selector: '[wrDrawerClose]',\n host: { '(click)': 'close()' },\n})\nexport class WrDrawerClose {\n private readonly drawer = inject(WrDrawer, { optional: true });\n\n protected close(): void {\n this.drawer?.open.set(false);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;AAKG;AA0BH;;;;;;;;;;;;;;;;;;;AAmBG;MAOU,QAAQ,CA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