@maggioli-design-system/mds-push-notification 2.1.2 → 2.2.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.
Files changed (55) hide show
  1. package/dist/cjs/{index-bdd83d01.js → index-c4051bde.js} +160 -65
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mds-push-notification.cjs.entry.js +20 -12
  4. package/dist/cjs/mds-push-notification.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/common/floating-controller.js +180 -0
  7. package/dist/collection/common/slot.js +10 -4
  8. package/dist/collection/components/mds-push-notification/mds-push-notification.js +41 -11
  9. package/dist/collection/dictionary/tree.js +13 -0
  10. package/dist/collection/type/tree.js +1 -0
  11. package/dist/components/mds-push-notification.js +19 -11
  12. package/dist/documentation.d.ts +8 -0
  13. package/dist/documentation.json +35 -13
  14. package/dist/esm/{index-a5ecda80.js → index-40893e6d.js} +160 -65
  15. package/dist/esm/loader.js +2 -2
  16. package/dist/esm/mds-push-notification.entry.js +20 -12
  17. package/dist/esm/mds-push-notification.js +3 -3
  18. package/dist/esm-es5/index-40893e6d.js +1 -0
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/mds-push-notification.entry.js +2 -2
  21. package/dist/esm-es5/mds-push-notification.js +1 -1
  22. package/dist/mds-push-notification/mds-push-notification.esm.js +1 -1
  23. package/dist/mds-push-notification/mds-push-notification.js +1 -1
  24. package/dist/mds-push-notification/p-1c60e347.entry.js +6 -0
  25. package/dist/mds-push-notification/p-3b18d74e.js +2 -0
  26. package/{www/build/p-313df2a2.system.entry.js → dist/mds-push-notification/p-4ff55f8a.system.entry.js} +2 -2
  27. package/dist/mds-push-notification/p-91b16fd4.system.js +2 -0
  28. package/dist/mds-push-notification/{p-9d064301.system.js → p-be470da4.system.js} +1 -1
  29. package/dist/stats.json +107 -53
  30. package/dist/types/common/floating-controller.d.ts +46 -0
  31. package/dist/types/common/slot.d.ts +2 -1
  32. package/dist/types/dictionary/tree.d.ts +4 -0
  33. package/dist/types/type/tree.d.ts +3 -0
  34. package/documentation.json +60 -18
  35. package/package.json +6 -6
  36. package/src/common/floating-controller.ts +263 -0
  37. package/src/common/slot.ts +12 -3
  38. package/src/dictionary/tree.ts +21 -0
  39. package/src/fixtures/icons.json +20 -0
  40. package/src/fixtures/iconsauce.json +6 -0
  41. package/src/type/tree.ts +12 -0
  42. package/www/build/mds-push-notification.esm.js +1 -1
  43. package/www/build/mds-push-notification.js +1 -1
  44. package/www/build/p-1c60e347.entry.js +6 -0
  45. package/www/build/p-3b18d74e.js +2 -0
  46. package/{dist/mds-push-notification/p-313df2a2.system.entry.js → www/build/p-4ff55f8a.system.entry.js} +2 -2
  47. package/www/build/p-91b16fd4.system.js +2 -0
  48. package/www/build/{p-9d064301.system.js → p-be470da4.system.js} +1 -1
  49. package/dist/esm-es5/index-a5ecda80.js +0 -1
  50. package/dist/mds-push-notification/p-36238f45.system.js +0 -2
  51. package/dist/mds-push-notification/p-4e329022.entry.js +0 -6
  52. package/dist/mds-push-notification/p-7857bd4f.js +0 -2
  53. package/www/build/p-36238f45.system.js +0 -2
  54. package/www/build/p-4e329022.entry.js +0 -6
  55. package/www/build/p-7857bd4f.js +0 -2
@@ -0,0 +1,180 @@
1
+ import { arrow, autoPlacement, autoUpdate, computePosition, flip, offset, shift, } from "@floating-ui/dom";
2
+ import { cssDurationToMilliseconds } from "./unit";
3
+ import { setAttributeIfEmpty } from "./aria";
4
+ export class FloatingController {
5
+ constructor(host, arrowEl) {
6
+ this.arrowInset = (middleware, arrowPosition) => {
7
+ const { arrow } = middleware;
8
+ const inset = { bottom: '', left: '', right: '', top: '' };
9
+ if (arrow === undefined) {
10
+ return {};
11
+ }
12
+ switch (arrowPosition) {
13
+ case 'bottom':
14
+ inset.left = arrow.x !== null ? `${arrow.x}px` : '';
15
+ inset.top = '100%';
16
+ break;
17
+ case 'left':
18
+ inset.right = '100%';
19
+ inset.top = arrow.y !== null ? `${arrow.y}px` : '';
20
+ break;
21
+ case 'right':
22
+ inset.left = '100%';
23
+ inset.top = arrow.y !== null ? `${arrow.y}px` : '';
24
+ break;
25
+ case 'top':
26
+ inset.left = arrow.x !== null ? `${arrow.x}px` : '';
27
+ inset.top = '';
28
+ break;
29
+ default:
30
+ break;
31
+ }
32
+ return inset;
33
+ };
34
+ this.arrowTransform = (arrowPosition) => {
35
+ let transformProps = this._host.arrow && this._host.visible ? 'scale(1)' : 'scale(0)';
36
+ switch (arrowPosition) {
37
+ case 'bottom':
38
+ transformProps = `rotate(180deg) ${transformProps} translate(0, -100%)`;
39
+ break;
40
+ case 'left':
41
+ transformProps = `rotate(-90deg) ${transformProps} translate(50%, -50%)`;
42
+ break;
43
+ case 'right':
44
+ transformProps = `rotate(90deg) ${transformProps} translate(-50%, -50%)`;
45
+ break;
46
+ case 'top':
47
+ transformProps = `rotate(0deg) ${transformProps} translate(0, 0)`;
48
+ break;
49
+ default:
50
+ break;
51
+ }
52
+ return { transform: transformProps };
53
+ };
54
+ this.arrowTransformOrigin = (arrowPosition) => {
55
+ switch (arrowPosition) {
56
+ case 'bottom':
57
+ return { transformOrigin: 'center top' };
58
+ case 'left':
59
+ return { transformOrigin: 'right center' };
60
+ case 'right':
61
+ return { transformOrigin: 'left center' };
62
+ case 'top':
63
+ return { transformOrigin: 'center bottom' };
64
+ default:
65
+ return { transformOrigin: 'center top' };
66
+ }
67
+ };
68
+ this.calculatePosition = () => {
69
+ if (!this._caller)
70
+ return;
71
+ const middleware = new Array();
72
+ const config = {};
73
+ if (this._host.shiftPadding) {
74
+ config.padding = this._host.shiftPadding;
75
+ }
76
+ if (this._host.autoPlacement) {
77
+ middleware.push(autoPlacement());
78
+ }
79
+ if (this._host.offset) {
80
+ middleware.push(offset(this._host.offset));
81
+ }
82
+ if (!this._host.autoPlacement && this._host.flip) {
83
+ middleware.push(flip(config));
84
+ }
85
+ if (this._host.shift) {
86
+ middleware.push(shift(config));
87
+ }
88
+ if (this.arrowEl && this._host.arrow) {
89
+ middleware.push(arrow({
90
+ element: this.arrowEl,
91
+ padding: this._host.arrowPadding,
92
+ }));
93
+ }
94
+ computePosition(this._caller, this._host, {
95
+ middleware,
96
+ placement: this._host.placement,
97
+ strategy: this._host.strategy,
98
+ }).then(({ x, y, placement, middlewareData }) => {
99
+ Object.assign(this._host.style, {
100
+ left: `${x}px`,
101
+ top: `${y}px`,
102
+ });
103
+ const arrowStyle = {};
104
+ const arrowPosition = {
105
+ top: 'bottom',
106
+ right: 'left',
107
+ bottom: 'top',
108
+ left: 'right',
109
+ }[placement.split('-')[0]];
110
+ if (arrowPosition && this.arrowEl) {
111
+ Object.assign(arrowStyle, this.arrowTransform(arrowPosition));
112
+ Object.assign(arrowStyle, this.arrowInset(middlewareData, arrowPosition));
113
+ Object.assign(arrowStyle, this.arrowTransformOrigin(arrowPosition));
114
+ Object.assign(this.arrowEl.style, arrowStyle);
115
+ }
116
+ });
117
+ };
118
+ this._host = host;
119
+ this.arrowEl = arrowEl;
120
+ }
121
+ updateCaller(target) {
122
+ var _a, _b, _c;
123
+ // search caller in document or rootNode of host (if target is in shadowDOM)
124
+ const caller = (_c = (_b = (_a = this._host.parentElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector(target)) !== null && _c !== void 0 ? _c : this._host.getRootNode().querySelector(target);
125
+ if (!caller) {
126
+ throw Error(`Target not found: ${target}`);
127
+ }
128
+ this._caller = caller;
129
+ setAttributeIfEmpty(this._caller, 'aria-haspopup', 'true');
130
+ setAttributeIfEmpty(this._caller, 'aria-controls', target);
131
+ setAttributeIfEmpty(this._host, 'role', 'menu');
132
+ setAttributeIfEmpty(this._host, 'aria-labelledby', target);
133
+ return caller;
134
+ }
135
+ updatePosition() {
136
+ if (this.cleanupAutoUpdate)
137
+ this.cleanupAutoUpdate();
138
+ this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition);
139
+ }
140
+ dismiss() {
141
+ this.cleanupAutoUpdate();
142
+ }
143
+ }
144
+ export class Backdrop {
145
+ constructor(backdropId) {
146
+ this.defaultBackdropId = 'mds-backdrop';
147
+ this.backdropBackgroundVisible = 'rgba(var(--magma-backdrop-color, 0 0 0) / var(--magma-backdrop-opacity, 0.1))';
148
+ this.backdropBackgroundHidden = 'rgba(var(--magma-backdrop-color, 0 0 0) / 0)';
149
+ this.backdropId = backdropId !== null && backdropId !== void 0 ? backdropId : this.defaultBackdropId;
150
+ this.cssBackdropZIndex = `var(--${this.backdropId}-z-index)`;
151
+ this.cssBackdropDuration = `var(--${this.backdropId}-duration)`;
152
+ }
153
+ attachBackdrop() {
154
+ if (!this.backdropEl) {
155
+ this.backdropEl = document.createElement('div');
156
+ this.backdropEl.className = this.backdropId;
157
+ this.backdropEl.style.inset = '0';
158
+ this.backdropEl.style.pointerEvents = 'none';
159
+ this.backdropEl.style.position = 'fixed';
160
+ this.backdropEl.style.transition = `background-color ${this.cssBackdropDuration} ease-out`;
161
+ this.backdropEl.style.zIndex = this.cssBackdropZIndex;
162
+ }
163
+ this.backdropEl.style.backgroundColor = this.backdropBackgroundHidden;
164
+ document.body.appendChild(this.backdropEl);
165
+ clearTimeout(this.backdropTimer);
166
+ this.backdropTimer = setTimeout(() => {
167
+ this.backdropEl.style.backgroundColor = this.backdropBackgroundVisible;
168
+ }, 1);
169
+ }
170
+ detachBackdrop() {
171
+ if (!this.backdropEl) {
172
+ return;
173
+ }
174
+ this.backdropEl.style.backgroundColor = 'transparent';
175
+ clearTimeout(this.backdropTimer);
176
+ this.backdropTimer = setTimeout(() => {
177
+ this.backdropEl.remove();
178
+ }, cssDurationToMilliseconds(this.cssBackdropDuration));
179
+ }
180
+ }
@@ -1,13 +1,19 @@
1
1
  const hasSlottedElements = (el, name) => {
2
2
  var _a;
3
- let query = 'slot';
4
- if (name) {
5
- query = `slot[name=${name}]`;
3
+ const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
4
+ const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
5
+ if (slot) {
6
+ return slot.assignedElements({ flatten: true }).length > 0;
6
7
  }
8
+ return false;
9
+ };
10
+ const hasSlottedNodes = (el, name) => {
11
+ var _a;
12
+ const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
7
13
  const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
8
14
  if (slot) {
9
15
  return slot.assignedNodes().length > 0;
10
16
  }
11
17
  return false;
12
18
  };
13
- export { hasSlottedElements, };
19
+ export { hasSlottedElements, hasSlottedNodes, };
@@ -25,22 +25,30 @@ export class MdsPushNotification {
25
25
  es: localeEs,
26
26
  it: localeIt,
27
27
  });
28
- this.onClickClose = (e) => {
29
- e.stopPropagation();
30
- this.closedEvent.emit();
31
- };
32
- this.language = undefined;
33
- this.datetime = undefined;
28
+ /**
29
+ * Specifies if the notification date format shows time passed or displays date as a static string
30
+ */
34
31
  this.dateFormat = 'timeago';
32
+ /**
33
+ * Specifies if the component is dismissable or not, it should be set to true by default is used with it's parent component `mds-push-notifications`
34
+ */
35
35
  this.deletable = true;
36
- this.icon = undefined;
37
- this.initials = undefined;
36
+ /**
37
+ * Specifies the message of the component
38
+ */
38
39
  this.message = 'Nessun messaggio disponibile';
40
+ /**
41
+ * Specifies if the `src` attribute is used to show a the image as avatar or full image
42
+ */
39
43
  this.preview = 'image';
40
- this.src = undefined;
41
- this.subject = undefined;
44
+ /**
45
+ * Specifies the color tone of the component
46
+ */
42
47
  this.tone = 'weak';
43
- this.variant = undefined;
48
+ this.onClickClose = (e) => {
49
+ e.stopPropagation();
50
+ this.closedEvent.emit();
51
+ };
44
52
  }
45
53
  async updateLang() {
46
54
  this.language = this.t.lang(this.host);
@@ -104,6 +112,8 @@ export class MdsPushNotification {
104
112
  "tags": [],
105
113
  "text": "Specifies the notification date based on [standard ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html)."
106
114
  },
115
+ "getter": false,
116
+ "setter": false,
107
117
  "attribute": "datetime",
108
118
  "reflect": true
109
119
  },
@@ -127,6 +137,8 @@ export class MdsPushNotification {
127
137
  "tags": [],
128
138
  "text": "Specifies if the notification date format shows time passed or displays date as a static string"
129
139
  },
140
+ "getter": false,
141
+ "setter": false,
130
142
  "attribute": "date-format",
131
143
  "reflect": true,
132
144
  "defaultValue": "'timeago'"
@@ -145,6 +157,8 @@ export class MdsPushNotification {
145
157
  "tags": [],
146
158
  "text": "Specifies if the component is dismissable or not, it should be set to true by default is used with it's parent component `mds-push-notifications`"
147
159
  },
160
+ "getter": false,
161
+ "setter": false,
148
162
  "attribute": "deletable",
149
163
  "reflect": true,
150
164
  "defaultValue": "true"
@@ -163,6 +177,8 @@ export class MdsPushNotification {
163
177
  "tags": [],
164
178
  "text": "Specifies the icon to be displayed"
165
179
  },
180
+ "getter": false,
181
+ "setter": false,
166
182
  "attribute": "icon",
167
183
  "reflect": true
168
184
  },
@@ -180,6 +196,8 @@ export class MdsPushNotification {
180
196
  "tags": [],
181
197
  "text": "The user's inizials displayed if there's no image available, initials will override tone and variant senttings to keep user recognizable from others"
182
198
  },
199
+ "getter": false,
200
+ "setter": false,
183
201
  "attribute": "initials",
184
202
  "reflect": true
185
203
  },
@@ -197,6 +215,8 @@ export class MdsPushNotification {
197
215
  "tags": [],
198
216
  "text": "Specifies the message of the component"
199
217
  },
218
+ "getter": false,
219
+ "setter": false,
200
220
  "attribute": "message",
201
221
  "reflect": true,
202
222
  "defaultValue": "'Nessun messaggio disponibile'"
@@ -221,6 +241,8 @@ export class MdsPushNotification {
221
241
  "tags": [],
222
242
  "text": "Specifies if the `src` attribute is used to show a the image as avatar or full image"
223
243
  },
244
+ "getter": false,
245
+ "setter": false,
224
246
  "attribute": "preview",
225
247
  "reflect": true,
226
248
  "defaultValue": "'image'"
@@ -239,6 +261,8 @@ export class MdsPushNotification {
239
261
  "tags": [],
240
262
  "text": "Specifies the path to the image"
241
263
  },
264
+ "getter": false,
265
+ "setter": false,
242
266
  "attribute": "src",
243
267
  "reflect": true
244
268
  },
@@ -256,6 +280,8 @@ export class MdsPushNotification {
256
280
  "tags": [],
257
281
  "text": "Specifies the subject of the component"
258
282
  },
283
+ "getter": false,
284
+ "setter": false,
259
285
  "attribute": "subject",
260
286
  "reflect": true
261
287
  },
@@ -279,6 +305,8 @@ export class MdsPushNotification {
279
305
  "tags": [],
280
306
  "text": "Specifies the color tone of the component"
281
307
  },
308
+ "getter": false,
309
+ "setter": false,
282
310
  "attribute": "tone",
283
311
  "reflect": true,
284
312
  "defaultValue": "'weak'"
@@ -303,6 +331,8 @@ export class MdsPushNotification {
303
331
  "tags": [],
304
332
  "text": "Specifies the color variant of the component"
305
333
  },
334
+ "getter": false,
335
+ "setter": false,
306
336
  "attribute": "variant",
307
337
  "reflect": true
308
338
  }
@@ -0,0 +1,13 @@
1
+ const treeActionsDictionary = [
2
+ 'auto',
3
+ 'visible',
4
+ ];
5
+ const treeAppearanceDictionary = [
6
+ 'depth',
7
+ 'none',
8
+ ];
9
+ const treeIconDictionary = [
10
+ 'folder',
11
+ 'chevron',
12
+ ];
13
+ export { treeActionsDictionary, treeAppearanceDictionary, treeIconDictionary, };
@@ -0,0 +1 @@
1
+ export {};
@@ -1013,22 +1013,30 @@ const MdsPushNotification$1 = /*@__PURE__*/ proxyCustomElement(class MdsPushNoti
1013
1013
  es: localeEs,
1014
1014
  it: localeIt,
1015
1015
  });
1016
- this.onClickClose = (e) => {
1017
- e.stopPropagation();
1018
- this.closedEvent.emit();
1019
- };
1020
- this.language = undefined;
1021
- this.datetime = undefined;
1016
+ /**
1017
+ * Specifies if the notification date format shows time passed or displays date as a static string
1018
+ */
1022
1019
  this.dateFormat = 'timeago';
1020
+ /**
1021
+ * Specifies if the component is dismissable or not, it should be set to true by default is used with it's parent component `mds-push-notifications`
1022
+ */
1023
1023
  this.deletable = true;
1024
- this.icon = undefined;
1025
- this.initials = undefined;
1024
+ /**
1025
+ * Specifies the message of the component
1026
+ */
1026
1027
  this.message = 'Nessun messaggio disponibile';
1028
+ /**
1029
+ * Specifies if the `src` attribute is used to show a the image as avatar or full image
1030
+ */
1027
1031
  this.preview = 'image';
1028
- this.src = undefined;
1029
- this.subject = undefined;
1032
+ /**
1033
+ * Specifies the color tone of the component
1034
+ */
1030
1035
  this.tone = 'weak';
1031
- this.variant = undefined;
1036
+ this.onClickClose = (e) => {
1037
+ e.stopPropagation();
1038
+ this.closedEvent.emit();
1039
+ };
1032
1040
  }
1033
1041
  async updateLang() {
1034
1042
  this.language = this.t.lang(this.host);
@@ -316,6 +316,14 @@ export interface JsonDocsProp {
316
316
  * ```
317
317
  */
318
318
  required: boolean;
319
+ /**
320
+ * `true` if the prop has a `get()`. `false` otherwise
321
+ */
322
+ getter: boolean;
323
+ /**
324
+ * `true` if the prop has a `set()`. `false` otherwise
325
+ */
326
+ setter: boolean;
319
327
  }
320
328
  export interface JsonDocsMethod {
321
329
  name: string;
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2024-12-19T16:02:56",
2
+ "timestamp": "2025-02-06T09:47:21",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
- "version": "4.22.2",
5
+ "version": "4.25.1",
6
6
  "typescriptVersion": "5.5.4"
7
7
  },
8
8
  "components": [
@@ -65,7 +65,9 @@
65
65
  }
66
66
  ],
67
67
  "optional": false,
68
- "required": false
68
+ "required": false,
69
+ "getter": false,
70
+ "setter": false
69
71
  },
70
72
  {
71
73
  "name": "datetime",
@@ -89,7 +91,9 @@
89
91
  }
90
92
  ],
91
93
  "optional": true,
92
- "required": false
94
+ "required": false,
95
+ "getter": false,
96
+ "setter": false
93
97
  },
94
98
  {
95
99
  "name": "deletable",
@@ -111,7 +115,9 @@
111
115
  }
112
116
  ],
113
117
  "optional": false,
114
- "required": false
118
+ "required": false,
119
+ "getter": false,
120
+ "setter": false
115
121
  },
116
122
  {
117
123
  "name": "icon",
@@ -135,7 +141,9 @@
135
141
  }
136
142
  ],
137
143
  "optional": true,
138
- "required": false
144
+ "required": false,
145
+ "getter": false,
146
+ "setter": false
139
147
  },
140
148
  {
141
149
  "name": "initials",
@@ -159,7 +167,9 @@
159
167
  }
160
168
  ],
161
169
  "optional": true,
162
- "required": false
170
+ "required": false,
171
+ "getter": false,
172
+ "setter": false
163
173
  },
164
174
  {
165
175
  "name": "message",
@@ -181,7 +191,9 @@
181
191
  }
182
192
  ],
183
193
  "optional": false,
184
- "required": false
194
+ "required": false,
195
+ "getter": false,
196
+ "setter": false
185
197
  },
186
198
  {
187
199
  "name": "preview",
@@ -217,7 +229,9 @@
217
229
  }
218
230
  ],
219
231
  "optional": true,
220
- "required": false
232
+ "required": false,
233
+ "getter": false,
234
+ "setter": false
221
235
  },
222
236
  {
223
237
  "name": "src",
@@ -241,7 +255,9 @@
241
255
  }
242
256
  ],
243
257
  "optional": true,
244
- "required": false
258
+ "required": false,
259
+ "getter": false,
260
+ "setter": false
245
261
  },
246
262
  {
247
263
  "name": "subject",
@@ -265,7 +281,9 @@
265
281
  }
266
282
  ],
267
283
  "optional": true,
268
- "required": false
284
+ "required": false,
285
+ "getter": false,
286
+ "setter": false
269
287
  },
270
288
  {
271
289
  "name": "tone",
@@ -301,7 +319,9 @@
301
319
  }
302
320
  ],
303
321
  "optional": true,
304
- "required": false
322
+ "required": false,
323
+ "getter": false,
324
+ "setter": false
305
325
  },
306
326
  {
307
327
  "name": "variant",
@@ -388,7 +408,9 @@
388
408
  }
389
409
  ],
390
410
  "optional": true,
391
- "required": false
411
+ "required": false,
412
+ "getter": false,
413
+ "setter": false
392
414
  }
393
415
  ],
394
416
  "methods": [