@breadstone/mosaik-elements-angular 0.0.115 → 0.0.116

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.0.116 (2025-08-18)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **dialog:** enhance DialogBreakpointObserverBehavior with improved breakpoint handling and configuration ([8e7410215e](https://github.com/RueDeRennes/mosaik/commit/8e7410215e))
6
+
1
7
  ## 0.0.115 (2025-08-18)
2
8
 
3
9
  ### 🚀 Features
@@ -55677,7 +55677,7 @@ class DialogBehavior {
55677
55677
  * @public
55678
55678
  * @virtual
55679
55679
  */
55680
- attach(element, portal) {
55680
+ attach(element, _portal) {
55681
55681
  this._ref = element;
55682
55682
  this._attached = true;
55683
55683
  }
@@ -55691,6 +55691,135 @@ class DialogBehavior {
55691
55691
  }
55692
55692
 
55693
55693
  // #region Imports
55694
+ // #endregion
55695
+ /**
55696
+ * Registry of 1..n MediaQuery breakpoint ranges
55697
+ * This is published as a provider and may be overridden from custom, application-specific ranges
55698
+ *
55699
+ * @public
55700
+ */
55701
+ class BreakpointRegistry {
55702
+ // #region Fields
55703
+ _items;
55704
+ _findByMap = new Map();
55705
+ // #endregion
55706
+ // #region Ctor
55707
+ /**
55708
+ * Constructs a new instance of the `BreakPointRegistry` class.
55709
+ *
55710
+ * @public
55711
+ */
55712
+ constructor() {
55713
+ this._items = new Array();
55714
+ }
55715
+ // #endregion
55716
+ // #region Properties
55717
+ /**
55718
+ * Get all the breakpoints whose ranges could overlapping `normal` ranges;
55719
+ * e.g. gt-sm overlaps md, lg, and xl
55720
+ *
55721
+ * @public
55722
+ * @readonly
55723
+ */
55724
+ get overlapping() {
55725
+ return this._items.filter((it) => it.overlapping);
55726
+ }
55727
+ /**
55728
+ * Get list of all registered (non-empty) breakpoint aliases
55729
+ *
55730
+ * @public
55731
+ * @readonly
55732
+ */
55733
+ get aliases() {
55734
+ return this._items.map((it) => it.alias);
55735
+ }
55736
+ /**
55737
+ * Aliases are mapped to properties using suffixes
55738
+ * e.g. 'gt-sm' for property 'layout' uses suffix 'GtSm'
55739
+ * for property layoutGtSM.
55740
+ *
55741
+ * @public
55742
+ * @readonly
55743
+ */
55744
+ get suffixes() {
55745
+ return this._items.map((it) => it.suffix ?? '');
55746
+ }
55747
+ // #endregion
55748
+ // #region Methods
55749
+ /**
55750
+ * Register a new breakpoint or array of breakpoints
55751
+ *
55752
+ * @public
55753
+ */
55754
+ register(breakpoint) {
55755
+ const breakpoints = Array.isArray(breakpoint) ? breakpoint : [breakpoint];
55756
+ breakpoints.forEach((x) => {
55757
+ this._items.push(x);
55758
+ });
55759
+ reset(this._items, [...this._items].sort(sortAscendingPriority));
55760
+ }
55761
+ /**
55762
+ * Search breakpoints by alias (e.g. gt-xs)
55763
+ *
55764
+ * @public
55765
+ */
55766
+ findByAlias(alias) {
55767
+ return !alias ? null : this.findWithPredicate(alias, (bp) => bp.alias === alias);
55768
+ }
55769
+ /**
55770
+ * Search breakpoints by media query (e.g. (min-width: 600px))
55771
+ *
55772
+ * @public
55773
+ */
55774
+ findByQuery(query) {
55775
+ return this.findWithPredicate(query, (bp) => bp.mediaQuery === query);
55776
+ }
55777
+ /**
55778
+ * Memoized lookup using custom predicate function
55779
+ *
55780
+ * @private
55781
+ */
55782
+ findWithPredicate(key, searchFn) {
55783
+ let response = this._findByMap.get(key);
55784
+ if (!response) {
55785
+ response = this._items.find(searchFn) ?? null;
55786
+ this._findByMap.set(key, response);
55787
+ }
55788
+ return response ?? null;
55789
+ }
55790
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: BreakpointRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
55791
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: BreakpointRegistry });
55792
+ }
55793
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: BreakpointRegistry, decorators: [{
55794
+ type: Injectable
55795
+ }], ctorParameters: () => [] });
55796
+ function sortAscendingPriority(a, b) {
55797
+ const pA = a.priority ?? 0;
55798
+ const pB = b.priority ?? 0;
55799
+ return pA - pB;
55800
+ }
55801
+ function clear(self, fn) {
55802
+ const splicedItems = self.splice(0, self.length);
55803
+ if (fn) {
55804
+ each(splicedItems, fn);
55805
+ }
55806
+ return self;
55807
+ }
55808
+ function reset(self, values) {
55809
+ clear(self).push(...values);
55810
+ return self;
55811
+ }
55812
+ function each(self, fn) {
55813
+ self.forEach((x, i) => {
55814
+ fn(x, i);
55815
+ });
55816
+ return self;
55817
+ }
55818
+
55819
+ // #region Imports
55820
+ /**
55821
+ * @public
55822
+ */
55694
55823
  const DIALOG_BREAKPOINT_OBSERVER_BEHAVIOR_CONFIG = new InjectionToken('DIALOG_BREAKPOINT_OBSERVER_BEHAVIOR_CONFIG');
55695
55824
  /**
55696
55825
  * The `DialogBreakpointObserverBehavior` class.
@@ -55701,6 +55830,7 @@ const DIALOG_BREAKPOINT_OBSERVER_BEHAVIOR_CONFIG = new InjectionToken('DIALOG_BR
55701
55830
  class DialogBreakpointObserverBehavior extends DialogBehavior {
55702
55831
  // #region Fields
55703
55832
  _breakpointObserver;
55833
+ _breakpointRegistry;
55704
55834
  _behaviorConfigConfig;
55705
55835
  _subscription;
55706
55836
  // #endregion
@@ -55710,9 +55840,10 @@ class DialogBreakpointObserverBehavior extends DialogBehavior {
55710
55840
  *
55711
55841
  * @public
55712
55842
  */
55713
- constructor(breakpointObserver = inject(BreakpointObserver), config = inject(DIALOG_BREAKPOINT_OBSERVER_BEHAVIOR_CONFIG, { optional: true })) {
55843
+ constructor(breakpointObserver = inject(BreakpointObserver), breakpointRegistry = inject(BreakpointRegistry), config = inject(DIALOG_BREAKPOINT_OBSERVER_BEHAVIOR_CONFIG, { optional: true })) {
55714
55844
  super();
55715
55845
  this._breakpointObserver = breakpointObserver;
55846
+ this._breakpointRegistry = breakpointRegistry;
55716
55847
  this._behaviorConfigConfig = config;
55717
55848
  this._subscription = Subscription.EMPTY;
55718
55849
  }
@@ -55723,7 +55854,10 @@ class DialogBreakpointObserverBehavior extends DialogBehavior {
55723
55854
  */
55724
55855
  attach(dialogRef, _portal) {
55725
55856
  if (this._behaviorConfigConfig?.breakpoints.length) {
55726
- const breakpoints = this._behaviorConfigConfig.breakpoints.map((x) => x.breakpoint);
55857
+ const breakpoints = this._behaviorConfigConfig.breakpoints
55858
+ .map((x) => this._breakpointRegistry.findByAlias(x.breakpoint))
55859
+ .map((x) => x?.mediaQuery)
55860
+ .filter((x) => x !== undefined);
55727
55861
  this._subscription = this._breakpointObserver.observe(breakpoints)
55728
55862
  .subscribe((x) => this.onBreakpoint(x, dialogRef, this.config ?? undefined));
55729
55863
  }
@@ -58192,132 +58326,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
58192
58326
  }]
58193
58327
  }], ctorParameters: () => [] });
58194
58328
 
58195
- // #region Imports
58196
- // #endregion
58197
- /**
58198
- * Registry of 1..n MediaQuery breakpoint ranges
58199
- * This is published as a provider and may be overridden from custom, application-specific ranges
58200
- *
58201
- * @public
58202
- */
58203
- class BreakpointRegistry {
58204
- // #region Fields
58205
- _items;
58206
- _findByMap = new Map();
58207
- // #endregion
58208
- // #region Ctor
58209
- /**
58210
- * Constructs a new instance of the `BreakPointRegistry` class.
58211
- *
58212
- * @public
58213
- */
58214
- constructor() {
58215
- this._items = new Array();
58216
- }
58217
- // #endregion
58218
- // #region Properties
58219
- /**
58220
- * Get all the breakpoints whose ranges could overlapping `normal` ranges;
58221
- * e.g. gt-sm overlaps md, lg, and xl
58222
- *
58223
- * @public
58224
- * @readonly
58225
- */
58226
- get overlapping() {
58227
- return this._items.filter((it) => it.overlapping);
58228
- }
58229
- /**
58230
- * Get list of all registered (non-empty) breakpoint aliases
58231
- *
58232
- * @public
58233
- * @readonly
58234
- */
58235
- get aliases() {
58236
- return this._items.map((it) => it.alias);
58237
- }
58238
- /**
58239
- * Aliases are mapped to properties using suffixes
58240
- * e.g. 'gt-sm' for property 'layout' uses suffix 'GtSm'
58241
- * for property layoutGtSM.
58242
- *
58243
- * @public
58244
- * @readonly
58245
- */
58246
- get suffixes() {
58247
- return this._items.map((it) => it.suffix ?? '');
58248
- }
58249
- // #endregion
58250
- // #region Methods
58251
- /**
58252
- * Register a new breakpoint or array of breakpoints
58253
- *
58254
- * @public
58255
- */
58256
- register(breakpoint) {
58257
- const breakpoints = Array.isArray(breakpoint) ? breakpoint : [breakpoint];
58258
- breakpoints.forEach((x) => {
58259
- this._items.push(x);
58260
- });
58261
- reset(this._items, [...this._items].sort(sortAscendingPriority));
58262
- }
58263
- /**
58264
- * Search breakpoints by alias (e.g. gt-xs)
58265
- *
58266
- * @public
58267
- */
58268
- findByAlias(alias) {
58269
- return !alias ? null : this.findWithPredicate(alias, (bp) => bp.alias === alias);
58270
- }
58271
- /**
58272
- * Search breakpoints by media query (e.g. (min-width: 600px))
58273
- *
58274
- * @public
58275
- */
58276
- findByQuery(query) {
58277
- return this.findWithPredicate(query, (bp) => bp.mediaQuery === query);
58278
- }
58279
- /**
58280
- * Memoized lookup using custom predicate function
58281
- *
58282
- * @private
58283
- */
58284
- findWithPredicate(key, searchFn) {
58285
- let response = this._findByMap.get(key);
58286
- if (!response) {
58287
- response = this._items.find(searchFn) ?? null;
58288
- this._findByMap.set(key, response);
58289
- }
58290
- return response ?? null;
58291
- }
58292
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: BreakpointRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
58293
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: BreakpointRegistry });
58294
- }
58295
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: BreakpointRegistry, decorators: [{
58296
- type: Injectable
58297
- }], ctorParameters: () => [] });
58298
- function sortAscendingPriority(a, b) {
58299
- const pA = a.priority ?? 0;
58300
- const pB = b.priority ?? 0;
58301
- return pA - pB;
58302
- }
58303
- function clear(self, fn) {
58304
- const splicedItems = self.splice(0, self.length);
58305
- if (fn) {
58306
- each(splicedItems, fn);
58307
- }
58308
- return self;
58309
- }
58310
- function reset(self, values) {
58311
- clear(self).push(...values);
58312
- return self;
58313
- }
58314
- function each(self, fn) {
58315
- self.forEach((x, i) => {
58316
- fn(x, i);
58317
- });
58318
- return self;
58319
- }
58320
-
58321
58329
  // #region Imports
58322
58330
  /**
58323
58331
  * Structural directive for detecting breakpoints.