@mustib/web-components 0.0.0-alpha.6 → 0.0.0-alpha.7
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/common-BBjg-zl9.js +604 -0
- package/components/mu-element.d.ts +3 -1
- package/components/mu-element.js +2 -1
- package/components/mu-icon.d.ts +4 -0
- package/components/mu-icon.js +14 -1
- package/components/mu-range-fill.js +2 -1
- package/components/mu-range-thumb-value.js +2 -1
- package/components/mu-range-thumb.js +2 -1
- package/components/mu-range.js +2 -1
- package/components/mu-select-item.js +2 -1
- package/components/mu-select-items.js +2 -1
- package/components/mu-select-label-content.js +2 -1
- package/components/mu-select-label.d.ts +1 -1
- package/components/mu-select-label.js +2 -1
- package/components/mu-select.js +2 -1
- package/components/mu-sortable-item.js +2 -1
- package/components/mu-sortable-trigger.js +2 -1
- package/components/mu-sortable.js +2 -1
- package/components/mu-toast-item.d.ts +6 -0
- package/components/mu-toast-item.js +229 -0
- package/components/mu-toast.d.ts +6 -0
- package/components/mu-toast.js +216 -0
- package/components/mu-transparent.js +2 -1
- package/components/mu-trigger.js +2 -1
- package/constants-DPnKJ57t.js +8 -0
- package/index.d.ts +9 -2
- package/index.js +11 -1
- package/{mu-element-CEvBHYiI.js → mu-element-yEZ17QUl.js} +2 -195
- package/mu-toast-DfNHcc7U.d.ts +276 -0
- package/package.json +2 -2
- package/utils/Toast.d.ts +6 -0
- package/utils/Toast.js +321 -0
- package/utils/ToastController.d.ts +6 -0
- package/utils/ToastController.js +189 -0
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { M as MuElement } from './mu-element-
|
|
1
|
+
export { M as MuElement } from './mu-element-yEZ17QUl.js';
|
|
2
2
|
export { MuIcon } from './components/mu-icon.js';
|
|
3
3
|
export { MuRange } from './components/mu-range.js';
|
|
4
4
|
export { MuRangeFill } from './components/mu-range-fill.js';
|
|
@@ -9,8 +9,18 @@ export { MuSelectItem } from './components/mu-select-item.js';
|
|
|
9
9
|
export { MuSelectItems } from './components/mu-select-items.js';
|
|
10
10
|
export { MuSelectLabel } from './components/mu-select-label.js';
|
|
11
11
|
export { MuSelectLabelContent } from './components/mu-select-label-content.js';
|
|
12
|
+
export { MuSortable } from './components/mu-sortable.js';
|
|
13
|
+
export { MuSortableItem } from './components/mu-sortable-item.js';
|
|
14
|
+
export { MuSortableTrigger } from './components/mu-sortable-trigger.js';
|
|
15
|
+
export { MuToast } from './components/mu-toast.js';
|
|
16
|
+
export { MuToastItem } from './components/mu-toast-item.js';
|
|
17
|
+
export { Toast } from './utils/Toast.js';
|
|
18
|
+
export { ToastController } from './utils/ToastController.js';
|
|
12
19
|
export { MuTransparent } from './components/mu-transparent.js';
|
|
13
20
|
export { MuTrigger } from './components/mu-trigger.js';
|
|
21
|
+
import './common-BBjg-zl9.js';
|
|
14
22
|
import 'lit';
|
|
15
23
|
import 'lit/decorators.js';
|
|
16
24
|
import 'lit/directives/repeat.js';
|
|
25
|
+
import 'lit/directive-helpers.js';
|
|
26
|
+
import './constants-DPnKJ57t.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { p as parseJson, A as AppError, L as LIBRARY_ERROR_SCOPE } from './common-BBjg-zl9.js';
|
|
1
2
|
import { css, LitElement } from 'lit';
|
|
2
3
|
import { property } from 'lit/decorators.js';
|
|
3
4
|
|
|
@@ -36,200 +37,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
36
37
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
37
38
|
};
|
|
38
39
|
|
|
39
|
-
const capitalizeFirst = (str) => str[0].toUpperCase().concat(str.slice(1).toLowerCase());
|
|
40
|
-
/**
|
|
41
|
-
* Capitalizes the first letter of a string or each word in a string.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} str - The string to capitalize.
|
|
44
|
-
* @param {object} [options] - Optional parameters.
|
|
45
|
-
* @param {boolean} [options.onlyFirstWord=false] - Whether to capitalize only the first word (default: false).
|
|
46
|
-
* @param {string} [options.splitter=' '] - The delimiter to split the string into words (default: ' ').
|
|
47
|
-
* @param {string} [options.joiner=options.splitter] - The delimiter to join the capitalized words (default: options.splitter).
|
|
48
|
-
* @returns {string} The capitalized string.
|
|
49
|
-
*/
|
|
50
|
-
function capitalize(str, options) {
|
|
51
|
-
const { onlyFirstWord: onlyFirst = false, splitter = ' ', joiner = splitter, } = options || {};
|
|
52
|
-
if (typeof str !== 'string' || str === '')
|
|
53
|
-
return str;
|
|
54
|
-
return (onlyFirst ? [str] : str.split(splitter))
|
|
55
|
-
.map(capitalizeFirst)
|
|
56
|
-
.join(joiner);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
class AppError extends Error {
|
|
60
|
-
options;
|
|
61
|
-
static throw(type, error, options) {
|
|
62
|
-
return new AppError(options)
|
|
63
|
-
.push(type, error, options?.pushOptions)
|
|
64
|
-
.throw();
|
|
65
|
-
}
|
|
66
|
-
static async aggregate(aggregateFunc, options) {
|
|
67
|
-
const appError = new AppError(options);
|
|
68
|
-
try {
|
|
69
|
-
await aggregateFunc(appError);
|
|
70
|
-
appError.end();
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
if (error instanceof Error) {
|
|
74
|
-
Error.captureStackTrace(error, options?.stackTraceConstructor ?? AppError.aggregate);
|
|
75
|
-
}
|
|
76
|
-
throw error;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
length = 0;
|
|
80
|
-
errors = {};
|
|
81
|
-
get message() {
|
|
82
|
-
return this.toString();
|
|
83
|
-
}
|
|
84
|
-
constructor(options) {
|
|
85
|
-
super();
|
|
86
|
-
this.options = options;
|
|
87
|
-
}
|
|
88
|
-
async catch(catchFunc) {
|
|
89
|
-
try {
|
|
90
|
-
await catchFunc();
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
if (error instanceof AppError) {
|
|
94
|
-
for (const [type, errors] of Object.entries(error.errors)) {
|
|
95
|
-
if (errors)
|
|
96
|
-
errors.forEach((err) => this.push(type, err.message, { scope: err.scope }));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
if (error instanceof Error) {
|
|
101
|
-
Error.captureStackTrace(error, this.catch);
|
|
102
|
-
}
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
toString(options) {
|
|
108
|
-
const formattedErrors = [];
|
|
109
|
-
Object.keys(this.errors).forEach((errorType) => {
|
|
110
|
-
const rawErrors = this.errors[errorType];
|
|
111
|
-
if (!rawErrors)
|
|
112
|
-
return;
|
|
113
|
-
const { indentation = 4 } = this.options || {};
|
|
114
|
-
const formattedErrorType = rawErrors.reduce((result, err) => {
|
|
115
|
-
const hasMatchedScope = this.matchesScope({
|
|
116
|
-
errScope: err.scope,
|
|
117
|
-
includesScope: options?.includesScope,
|
|
118
|
-
excludesScope: options?.excludesScope,
|
|
119
|
-
});
|
|
120
|
-
if (hasMatchedScope) {
|
|
121
|
-
result.push(`${result.length + 1}- ${err.message}.`);
|
|
122
|
-
}
|
|
123
|
-
return result;
|
|
124
|
-
}, []);
|
|
125
|
-
const hasManyErrors = formattedErrorType.length > 1;
|
|
126
|
-
const indentationPrefix = `${' '.repeat(indentation)}`;
|
|
127
|
-
if (formattedErrorType.length > 0)
|
|
128
|
-
formattedErrors.push(`${errorType} Error${hasManyErrors ? 's' : ''}:\n${indentationPrefix}${formattedErrorType.join(`\n${indentationPrefix}`)}`);
|
|
129
|
-
});
|
|
130
|
-
return formattedErrors.join('\n');
|
|
131
|
-
}
|
|
132
|
-
matchesScope({ errScope, includesScope, excludesScope, }) {
|
|
133
|
-
if (includesScope === undefined && excludesScope === undefined)
|
|
134
|
-
return true;
|
|
135
|
-
if (errScope === undefined)
|
|
136
|
-
return false;
|
|
137
|
-
if (excludesScope) {
|
|
138
|
-
return !excludesScope.some((scope) => errScope.includes(scope));
|
|
139
|
-
}
|
|
140
|
-
if (includesScope) {
|
|
141
|
-
return includesScope.some((scope) => errScope.includes(scope));
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
push(type, error, options) {
|
|
146
|
-
const errorType = capitalize(type, { onlyFirstWord: true });
|
|
147
|
-
const errors = this.errors[errorType];
|
|
148
|
-
const newError = Array.isArray(error)
|
|
149
|
-
? error.map((err) => ({ message: err, scope: options?.scope }))
|
|
150
|
-
: [{ message: error, scope: options?.scope }];
|
|
151
|
-
if (Array.isArray(errors)) {
|
|
152
|
-
errors.push(...newError);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
this.errors[errorType] = newError;
|
|
156
|
-
this.length++;
|
|
157
|
-
}
|
|
158
|
-
return this;
|
|
159
|
-
}
|
|
160
|
-
throw() {
|
|
161
|
-
Error.captureStackTrace(this, this.options?.stackTraceConstructor || this.throw);
|
|
162
|
-
throw this;
|
|
163
|
-
}
|
|
164
|
-
end() {
|
|
165
|
-
if (this.length > 0)
|
|
166
|
-
this.throw();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const LIBRARY_ERROR_SCOPE = Symbol('@mustib/utils');
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Creates a debounced version of the provided function that delays its execution until after
|
|
174
|
-
* a specified number of milliseconds have elapsed since the last time it was invoked.
|
|
175
|
-
*
|
|
176
|
-
* @param func - The function to debounce.
|
|
177
|
-
* @param ms - The number of milliseconds to delay; defaults to 100ms.
|
|
178
|
-
* @returns A debounced version of the input function.
|
|
179
|
-
*/
|
|
180
|
-
function debounce(func, ms = 100) {
|
|
181
|
-
let timeoutId;
|
|
182
|
-
return function debounced(...args) {
|
|
183
|
-
clearTimeout(timeoutId);
|
|
184
|
-
timeoutId = setTimeout(() => func(...args), ms);
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Returns a promise that resolves after a specified number of milliseconds.
|
|
190
|
-
*
|
|
191
|
-
* @param milliseconds - The number of milliseconds to wait before resolving the promise. Defaults to 0.
|
|
192
|
-
* @returns A promise that resolves after the specified delay.
|
|
193
|
-
*/
|
|
194
|
-
function wait(milliseconds = 0) {
|
|
195
|
-
return new Promise(r => { setTimeout(r, milliseconds); });
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Creates a throttled version of the given function that, when invoked repeatedly,
|
|
200
|
-
* will only call the original function at most once every `ms` milliseconds.
|
|
201
|
-
*
|
|
202
|
-
* @param func - The function to throttle.
|
|
203
|
-
* @param ms - The number of milliseconds to throttle invocations to. Defaults to 100ms.
|
|
204
|
-
* @returns A throttled version of the input function.
|
|
205
|
-
*/
|
|
206
|
-
function throttle(func, ms = 100) {
|
|
207
|
-
let isThrottled = false;
|
|
208
|
-
return function throttled(...args) {
|
|
209
|
-
if (isThrottled)
|
|
210
|
-
return;
|
|
211
|
-
isThrottled = true;
|
|
212
|
-
func(...args);
|
|
213
|
-
setTimeout(() => { isThrottled = false; }, ms);
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Parses a string as JSON and returns the parsed value. If the string cannot be parsed as JSON,
|
|
219
|
-
* it returns undefined.
|
|
220
|
-
*
|
|
221
|
-
* @param {string} value - The string to parse as JSON.
|
|
222
|
-
* @return {T | undefined} - The parsed JSON value or undefined (since undefined is not a valid JSON).
|
|
223
|
-
*/
|
|
224
|
-
function parseJson(value) {
|
|
225
|
-
try {
|
|
226
|
-
return JSON.parse(value);
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
return undefined;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
40
|
function getElementBoundaries(element) {
|
|
234
41
|
const { top: elementTop, bottom, left: elementLeft, right, width, height, } = element.getBoundingClientRect();
|
|
235
42
|
const pageWidth = document.documentElement.clientWidth;
|
|
@@ -1166,4 +973,4 @@ __decorate([
|
|
|
1166
973
|
})
|
|
1167
974
|
], MuElement.prototype, "eventActionEvents", void 0);
|
|
1168
975
|
|
|
1169
|
-
export { EventAction as E, MuElement as M, __decorate as _, disableElementScroll as
|
|
976
|
+
export { EventAction as E, MuElement as M, __decorate as _, disableElementScroll as d, enableElementScroll as e, getElementBoundaries as g };
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { TemplateResult, PropertyValues, CSSResultGroup } from 'lit';
|
|
2
|
+
import { MuElement, MuElementComponent } from './components/mu-element.js';
|
|
3
|
+
import { MuIcon } from './components/mu-icon.js';
|
|
4
|
+
import { EventData, CustomEventEmitter } from '@mustib/utils';
|
|
5
|
+
|
|
6
|
+
type LockedEvent<T = undefined> = EventData<T, T, false, false>;
|
|
7
|
+
|
|
8
|
+
type AnimationKeyframes = Keyframe[] | PropertyIndexedKeyframes;
|
|
9
|
+
|
|
10
|
+
type ToastData = {
|
|
11
|
+
/**
|
|
12
|
+
* The message to display in the toast
|
|
13
|
+
*/
|
|
14
|
+
message: string | TemplateResult;
|
|
15
|
+
|
|
16
|
+
spinner?: boolean | TemplateResult;
|
|
17
|
+
|
|
18
|
+
direction?: 'ltr' | 'rtl';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The label of the toast
|
|
22
|
+
*/
|
|
23
|
+
label?: undefined | string | TemplateResult;
|
|
24
|
+
|
|
25
|
+
role?: 'alert' | 'status';
|
|
26
|
+
|
|
27
|
+
leaveAnimationDuration?: number;
|
|
28
|
+
|
|
29
|
+
enterAnimationDuration?: number;
|
|
30
|
+
|
|
31
|
+
priority?: 'immediate' | 'normal' | 'important';
|
|
32
|
+
|
|
33
|
+
enterAnimationKeyframes?: AnimationKeyframes;
|
|
34
|
+
|
|
35
|
+
progressAnimationKeyframes?: AnimationKeyframes;
|
|
36
|
+
|
|
37
|
+
leaveAnimationKeyframes?: AnimationKeyframes;
|
|
38
|
+
|
|
39
|
+
interactingBehavior?: 'reset-progress' | 'pause-progress' | 'nothing';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Remove the toast if it is not rendered within the specified time (in ms).
|
|
43
|
+
* If the toast fails to render in this time, it will be discarded.
|
|
44
|
+
* If not set, the toast will wait indefinitely to render if queued.
|
|
45
|
+
*/
|
|
46
|
+
maxRenderWaitTime?: undefined | number;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The action of the toast
|
|
50
|
+
*/
|
|
51
|
+
action?:
|
|
52
|
+
| undefined
|
|
53
|
+
| ((toast: Toast) => TemplateResult)
|
|
54
|
+
| {
|
|
55
|
+
label: string;
|
|
56
|
+
onClick: (toast: Toast) => void;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The duration of the toast
|
|
61
|
+
*/
|
|
62
|
+
duration?: undefined | number;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The hue of the toast color
|
|
66
|
+
*/
|
|
67
|
+
colorHue?: undefined | number;
|
|
68
|
+
|
|
69
|
+
closeBtn?: boolean | TemplateResult;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The name of the icon to display in the toast. This is the name of the icon from the {@link MuIcon} component
|
|
73
|
+
* @see {@link MuIcon.icons} or a custom lit {@link TemplateResult}
|
|
74
|
+
*/
|
|
75
|
+
labelIcon?: undefined | keyof typeof MuIcon.icons | TemplateResult;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
type Events$3 = {
|
|
79
|
+
'state.request.remove.toast': LockedEvent<{
|
|
80
|
+
toast: Toast$1;
|
|
81
|
+
}>;
|
|
82
|
+
};
|
|
83
|
+
declare class ToastController {
|
|
84
|
+
private portal;
|
|
85
|
+
private toastsIdMap;
|
|
86
|
+
private queuedToastsQueue;
|
|
87
|
+
toastsQueue: Toast$1[];
|
|
88
|
+
private _maxVisibleToastsCount;
|
|
89
|
+
private _stackToasts;
|
|
90
|
+
interactingBehavior: Toast$1['interactingBehavior'];
|
|
91
|
+
colorHue: {
|
|
92
|
+
success: number;
|
|
93
|
+
error: number;
|
|
94
|
+
warning: number;
|
|
95
|
+
info: number;
|
|
96
|
+
};
|
|
97
|
+
defaultDuration: number;
|
|
98
|
+
defaultLeaveAnimationDuration: number;
|
|
99
|
+
defaultEnterAnimationDuration: number;
|
|
100
|
+
defaultDirection: "ltr" | "rtl";
|
|
101
|
+
get maxVisibleToastsCount(): number;
|
|
102
|
+
set maxVisibleToastsCount(value: number);
|
|
103
|
+
get position(): MuToast["position"];
|
|
104
|
+
set position(value: MuToast['position']);
|
|
105
|
+
set stackToasts(value: boolean);
|
|
106
|
+
/**
|
|
107
|
+
* Indicates if toast notifications should stack atop each other,
|
|
108
|
+
* such that only the latest is fully visible while older toasts
|
|
109
|
+
* are partially hidden beneath it. This enhances focus and reduces clutter.
|
|
110
|
+
*/
|
|
111
|
+
get stackToasts(): boolean;
|
|
112
|
+
constructor(portal: MuToast);
|
|
113
|
+
gracefulRemoveVisible(): void;
|
|
114
|
+
gracefulRemoveAll(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Re-parents the toast portal to the specified node.
|
|
117
|
+
*
|
|
118
|
+
* Useful for ensuring toasts appear correctly when top-layer elements like fullscreen containers
|
|
119
|
+
* or dialogs are active. The specified node should be a valid container element (not void elements like <img />).
|
|
120
|
+
*
|
|
121
|
+
* @param node - The new parent node for the toast portal.
|
|
122
|
+
*/
|
|
123
|
+
reParent(node?: Node): void;
|
|
124
|
+
/**
|
|
125
|
+
* Makes the toast portal a popover,
|
|
126
|
+
* ensuring that toasts appear above all other elements
|
|
127
|
+
* (e.g., dialogs, fullscreen content) in the top-layer.
|
|
128
|
+
* This is useful for proper overlay stacking and visibility.
|
|
129
|
+
*/
|
|
130
|
+
popover(): void;
|
|
131
|
+
success(message: string): Toast$1;
|
|
132
|
+
error(message: string): Toast$1;
|
|
133
|
+
warning(message: string): Toast$1;
|
|
134
|
+
info(message: string): Toast$1;
|
|
135
|
+
create(toastData: ToastData | string): Toast$1;
|
|
136
|
+
private rolloverQueuedToasts;
|
|
137
|
+
emitter: CustomEventEmitter<Events$3>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type Events$2 = {
|
|
141
|
+
'state.toast-item.first.rendered': LockedEvent<{
|
|
142
|
+
element: MuToastItem;
|
|
143
|
+
}>;
|
|
144
|
+
'state.await.rendering': LockedEvent;
|
|
145
|
+
'internal.status.enter': LockedEvent;
|
|
146
|
+
'internal.status.progress': LockedEvent;
|
|
147
|
+
'internal.status.leave': LockedEvent;
|
|
148
|
+
};
|
|
149
|
+
declare class Toast$1 {
|
|
150
|
+
private controller;
|
|
151
|
+
private internalToast;
|
|
152
|
+
get id(): string;
|
|
153
|
+
get action(): ((toast: Toast$1) => TemplateResult) | {
|
|
154
|
+
label: string;
|
|
155
|
+
onClick: (toast: Toast$1) => void;
|
|
156
|
+
} | undefined;
|
|
157
|
+
get message(): string | TemplateResult;
|
|
158
|
+
get label(): string | TemplateResult | undefined;
|
|
159
|
+
get role(): "alert" | "status";
|
|
160
|
+
get duration(): number;
|
|
161
|
+
get colorHue(): number;
|
|
162
|
+
get spinner(): boolean | TemplateResult;
|
|
163
|
+
get labelIcon(): keyof typeof MuIcon.icons | TemplateResult | undefined;
|
|
164
|
+
get closeBtn(): boolean | TemplateResult;
|
|
165
|
+
get leaveAnimationDuration(): number;
|
|
166
|
+
get enterAnimationDuration(): number;
|
|
167
|
+
get direction(): "rtl" | "ltr";
|
|
168
|
+
get interactingBehavior(): "reset-progress" | "pause-progress" | "nothing";
|
|
169
|
+
get status(): "queued" | "await-rendering" | "enter" | "progress" | "leave";
|
|
170
|
+
get priority(): "immediate" | "normal" | "important";
|
|
171
|
+
set colorHue(value: number);
|
|
172
|
+
set spinner(value: boolean | TemplateResult);
|
|
173
|
+
set labelIcon(value: keyof typeof MuIcon.icons | TemplateResult | undefined);
|
|
174
|
+
set message(value: string | TemplateResult);
|
|
175
|
+
set label(value: string | TemplateResult | undefined);
|
|
176
|
+
set action(value: ((toast: Toast$1) => TemplateResult) | {
|
|
177
|
+
label: string;
|
|
178
|
+
onClick: (toast: Toast$1) => void;
|
|
179
|
+
} | undefined);
|
|
180
|
+
set closeBtn(value: boolean | TemplateResult);
|
|
181
|
+
set duration(value: number);
|
|
182
|
+
constructor({ toastData, controller, }: {
|
|
183
|
+
toastData: ToastData;
|
|
184
|
+
controller: ToastController;
|
|
185
|
+
});
|
|
186
|
+
private _generateInternalToastData;
|
|
187
|
+
gracefulRemove(): Promise<void>;
|
|
188
|
+
remove(): void;
|
|
189
|
+
pauseProgress(): Promise<void>;
|
|
190
|
+
resumeProgress(): Promise<void>;
|
|
191
|
+
resetProgress(): Promise<void>;
|
|
192
|
+
emitter: CustomEventEmitter<Events$2>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
type MuToastItemComponent = {
|
|
196
|
+
attributes: Attributes$1;
|
|
197
|
+
events: Events$1;
|
|
198
|
+
};
|
|
199
|
+
type Events$1 = object;
|
|
200
|
+
type Attributes$1 = MuElementComponent['attributes'];
|
|
201
|
+
declare class MuToastItem extends MuElement {
|
|
202
|
+
static styles: any[];
|
|
203
|
+
eventActionData: undefined;
|
|
204
|
+
_addEventActionAttributes: undefined;
|
|
205
|
+
toast: Toast$1;
|
|
206
|
+
progressElement?: HTMLElement;
|
|
207
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
208
|
+
private pausedByEvents;
|
|
209
|
+
render(): unknown;
|
|
210
|
+
}
|
|
211
|
+
declare global {
|
|
212
|
+
interface HTMLElementTagNameMap {
|
|
213
|
+
'mu-toast-item': MuToastItem;
|
|
214
|
+
}
|
|
215
|
+
interface GlobalEventHandlersEventMap extends Events$1 {
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
type MuToastComponent = {
|
|
220
|
+
attributes: Attributes;
|
|
221
|
+
events: Events;
|
|
222
|
+
};
|
|
223
|
+
type Events = object;
|
|
224
|
+
type Attributes = MuElementComponent['attributes'] & {
|
|
225
|
+
/**
|
|
226
|
+
* The position of the toast
|
|
227
|
+
*/
|
|
228
|
+
position?: 'top-center' | 'bottom-center' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
229
|
+
/**
|
|
230
|
+
* Automatically re-parent the toast container to top-layer elements such as
|
|
231
|
+
* open `<dialog>`s or the fullscreen element. This is useful when the toast
|
|
232
|
+
* must appear above modals, dialogs or fullscreen content without requiring
|
|
233
|
+
* manual re-parenting.
|
|
234
|
+
*
|
|
235
|
+
* ⚠️ **Performance note:** enabling this feature causes the component to
|
|
236
|
+
* observe the entire document for attribute and child‑list mutations. It
|
|
237
|
+
* tracks changes to determine when dialogs are opened or closed, which can
|
|
238
|
+
* be expensive in applications with frequent DOM modifications. Use only when
|
|
239
|
+
* necessary and test performance impact in your target environment.
|
|
240
|
+
*/
|
|
241
|
+
'auto-re-parent'?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* Indicates if the toast is empty
|
|
244
|
+
* must not be set directly, it is managed internally
|
|
245
|
+
*/
|
|
246
|
+
empty?: boolean;
|
|
247
|
+
};
|
|
248
|
+
declare class MuToast extends MuElement {
|
|
249
|
+
static styles?: CSSResultGroup | undefined;
|
|
250
|
+
protected _addEventActionAttributes: undefined;
|
|
251
|
+
eventActionData: undefined;
|
|
252
|
+
controller: ToastController;
|
|
253
|
+
position: Exclude<Attributes['position'], undefined>;
|
|
254
|
+
autoReParent: boolean;
|
|
255
|
+
private setIsEmpty;
|
|
256
|
+
private _topLayerElements;
|
|
257
|
+
private _fullscreenElement;
|
|
258
|
+
private autoReParentObserver;
|
|
259
|
+
private addTopLayerElement;
|
|
260
|
+
private removeTopLayerElement;
|
|
261
|
+
fullscreenReParentHandler: () => void;
|
|
262
|
+
protected willUpdate(_changedProperties: PropertyValues): void;
|
|
263
|
+
connectedCallback(): void;
|
|
264
|
+
disconnectedCallback(): void;
|
|
265
|
+
protected render(): unknown;
|
|
266
|
+
}
|
|
267
|
+
declare global {
|
|
268
|
+
interface HTMLElementTagNameMap {
|
|
269
|
+
'mu-toast': MuToast;
|
|
270
|
+
}
|
|
271
|
+
interface GlobalEventHandlersEventMap extends Events {
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export { Toast$1 as T, MuToast as b, MuToastItem as c, ToastController as d };
|
|
276
|
+
export type { AnimationKeyframes as A, LockedEvent as L, MuToastComponent as M, MuToastItemComponent as a, ToastData as e };
|
package/package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "A customizable web-components library with lit",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "0.0.0-alpha.
|
|
6
|
+
"version": "0.0.0-alpha.7",
|
|
7
7
|
"lint-staged": {
|
|
8
8
|
"*.{js,ts,astro}": "biome check --write"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@mustib/utils": "2.
|
|
11
|
+
"@mustib/utils": "2.9.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"lit": "^3.3.1"
|