@maggioli-design-system/mds-modal 3.1.0 → 3.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/dist/cjs/{index-90939077.js → index-6de6438b.js} +251 -198
- package/dist/cjs/loader.cjs.js +3 -2
- package/dist/cjs/mds-modal.cjs.entry.js +34 -7
- package/dist/cjs/mds-modal.cjs.js +6 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/common/aria.js +19 -0
- package/dist/collection/components/mds-modal/mds-modal.css +37 -67
- package/dist/collection/components/mds-modal/mds-modal.js +33 -6
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +8 -0
- package/dist/collection/dictionary/typography.js +3 -3
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +1 -1
- package/dist/components/mds-modal.js +33 -6
- package/dist/esm/{index-5dfae565.js → index-640a40d3.js} +251 -199
- package/dist/esm/loader.js +3 -2
- package/dist/esm/mds-modal.entry.js +34 -7
- package/dist/esm/mds-modal.js +3 -2
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm-es5/index-640a40d3.js +2 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/esm-es5/mds-modal.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/mds-modal.js +1 -1
- package/dist/mds-modal/p-0f3e1d2d.system.js +2 -0
- package/dist/mds-modal/{p-4288d1a7.system.entry.js → p-2c61dab9.system.entry.js} +1 -1
- package/dist/mds-modal/p-6fde22cf.js +2 -0
- package/dist/mds-modal/p-ba28961b.entry.js +1 -0
- package/dist/mds-modal/p-bea21063.system.js +1 -0
- package/dist/stats.json +36 -32
- package/dist/types/common/aria.d.ts +4 -0
- package/dist/types/components/mds-modal/meta/types.d.ts +2 -2
- package/dist/types/components/mds-modal/test/mds-modal.stories.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +68 -7
- package/dist/types/types/autocomplete.d.ts +2 -2
- package/dist/types/types/button.d.ts +4 -4
- package/dist/types/types/floating-ui.d.ts +2 -2
- package/dist/types/types/form-rel.d.ts +1 -1
- package/dist/types/types/input-text-type.d.ts +1 -1
- package/dist/types/types/input-value-type.d.ts +1 -1
- package/dist/types/types/loading.d.ts +1 -1
- package/dist/types/types/typography.d.ts +8 -8
- package/dist/types/types/variant.d.ts +10 -10
- package/loader/index.d.ts +9 -0
- package/package.json +4 -4
- package/src/common/aria.ts +27 -0
- package/src/components/mds-modal/mds-modal.tsx +39 -4
- package/src/components/mds-modal/test/mds-modal.e2e.ts +4 -5
- package/src/components/mds-modal/test/mds-modal.stories.tsx +20 -0
- package/src/dictionary/typography.ts +3 -3
- package/src/fixtures/icons.json +5 -2
- package/src/types/typography.ts +3 -3
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +1 -1
- package/www/build/p-0f3e1d2d.system.js +2 -0
- package/www/build/{p-4288d1a7.system.entry.js → p-2c61dab9.system.entry.js} +1 -1
- package/www/build/p-6fde22cf.js +2 -0
- package/www/build/p-ba28961b.entry.js +1 -0
- package/www/build/p-bea21063.system.js +1 -0
- package/dist/esm-es5/index-5dfae565.js +0 -2
- package/dist/mds-modal/p-19fa0f59.js +0 -2
- package/dist/mds-modal/p-5935b9a5.system.js +0 -1
- package/dist/mds-modal/p-9c47a964.system.js +0 -2
- package/dist/mds-modal/p-f1135a2e.entry.js +0 -1
- package/www/build/p-19fa0f59.js +0 -2
- package/www/build/p-5935b9a5.system.js +0 -1
- package/www/build/p-9c47a964.system.js +0 -2
- package/www/build/p-f1135a2e.entry.js +0 -1
|
@@ -22,66 +22,18 @@ function _interopNamespace(e) {
|
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'mds-modal';
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
|
27
|
+
* Simon Friis Vindum (@paldepind)
|
|
28
|
+
* Licensed under the MIT License
|
|
29
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
|
30
|
+
*
|
|
31
|
+
* Modified for Stencil's renderer and slot projection
|
|
32
|
+
*/
|
|
25
33
|
let scopeId;
|
|
26
34
|
let hostTagName;
|
|
27
35
|
let isSvgMode = false;
|
|
28
36
|
let queuePending = false;
|
|
29
|
-
const win = typeof window !== 'undefined' ? window : {};
|
|
30
|
-
const doc = win.document || { head: {} };
|
|
31
|
-
const plt = {
|
|
32
|
-
$flags$: 0,
|
|
33
|
-
$resourcesUrl$: '',
|
|
34
|
-
jmp: (h) => h(),
|
|
35
|
-
raf: (h) => requestAnimationFrame(h),
|
|
36
|
-
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
37
|
-
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
38
|
-
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
39
|
-
};
|
|
40
|
-
const promiseResolve = (v) => Promise.resolve(v);
|
|
41
|
-
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
42
|
-
try {
|
|
43
|
-
new CSSStyleSheet();
|
|
44
|
-
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
45
|
-
}
|
|
46
|
-
catch (e) { }
|
|
47
|
-
return false;
|
|
48
|
-
})()
|
|
49
|
-
;
|
|
50
|
-
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
51
|
-
if (listeners) {
|
|
52
|
-
listeners.map(([flags, name, method]) => {
|
|
53
|
-
const target = getHostListenerTarget(elm, flags) ;
|
|
54
|
-
const handler = hostListenerProxy(hostRef, method);
|
|
55
|
-
const opts = hostListenerOpts(flags);
|
|
56
|
-
plt.ael(target, name, handler, opts);
|
|
57
|
-
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
62
|
-
try {
|
|
63
|
-
{
|
|
64
|
-
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
65
|
-
// instance is ready, let's call it's member method for this event
|
|
66
|
-
hostRef.$lazyInstance$[methodName](ev);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
consoleError(e);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const getHostListenerTarget = (elm, flags) => {
|
|
78
|
-
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
79
|
-
return doc;
|
|
80
|
-
return elm;
|
|
81
|
-
};
|
|
82
|
-
// prettier-ignore
|
|
83
|
-
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
84
|
-
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
|
85
37
|
const createTime = (fnName, tagName = '') => {
|
|
86
38
|
{
|
|
87
39
|
return () => {
|
|
@@ -96,76 +48,7 @@ const uniqueTime = (key, measureText) => {
|
|
|
96
48
|
};
|
|
97
49
|
}
|
|
98
50
|
};
|
|
99
|
-
const
|
|
100
|
-
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
101
|
-
let style = styles.get(scopeId);
|
|
102
|
-
if (supportsConstructableStylesheets && allowCS) {
|
|
103
|
-
style = (style || new CSSStyleSheet());
|
|
104
|
-
if (typeof style === 'string') {
|
|
105
|
-
style = cssText;
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
style.replaceSync(cssText);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
style = cssText;
|
|
113
|
-
}
|
|
114
|
-
styles.set(scopeId, style);
|
|
115
|
-
};
|
|
116
|
-
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
117
|
-
let scopeId = getScopeId(cmpMeta);
|
|
118
|
-
const style = styles.get(scopeId);
|
|
119
|
-
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
120
|
-
// so the fallback is to always use the document for the root node in those cases
|
|
121
|
-
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
122
|
-
if (style) {
|
|
123
|
-
if (typeof style === 'string') {
|
|
124
|
-
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
125
|
-
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
126
|
-
let styleElm;
|
|
127
|
-
if (!appliedStyles) {
|
|
128
|
-
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
129
|
-
}
|
|
130
|
-
if (!appliedStyles.has(scopeId)) {
|
|
131
|
-
{
|
|
132
|
-
{
|
|
133
|
-
styleElm = doc.createElement('style');
|
|
134
|
-
styleElm.innerHTML = style;
|
|
135
|
-
}
|
|
136
|
-
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
137
|
-
}
|
|
138
|
-
if (appliedStyles) {
|
|
139
|
-
appliedStyles.add(scopeId);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
144
|
-
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return scopeId;
|
|
148
|
-
};
|
|
149
|
-
const attachStyles = (hostRef) => {
|
|
150
|
-
const cmpMeta = hostRef.$cmpMeta$;
|
|
151
|
-
const elm = hostRef.$hostElement$;
|
|
152
|
-
const flags = cmpMeta.$flags$;
|
|
153
|
-
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
154
|
-
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
155
|
-
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
156
|
-
// only required when we're NOT using native shadow dom (slot)
|
|
157
|
-
// or this browser doesn't support native shadow dom
|
|
158
|
-
// and this host element was NOT created with SSR
|
|
159
|
-
// let's pick out the inner content for slot projection
|
|
160
|
-
// create a node to represent where the original
|
|
161
|
-
// content was first placed, which is useful later on
|
|
162
|
-
// DOM WRITE!!
|
|
163
|
-
elm['s-sc'] = scopeId;
|
|
164
|
-
elm.classList.add(scopeId + '-h');
|
|
165
|
-
}
|
|
166
|
-
endAttachStyles();
|
|
167
|
-
};
|
|
168
|
-
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
51
|
+
const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
|
|
169
52
|
/**
|
|
170
53
|
* Default style mode id
|
|
171
54
|
*/
|
|
@@ -180,6 +63,18 @@ const isComplexType = (o) => {
|
|
|
180
63
|
o = typeof o;
|
|
181
64
|
return o === 'object' || o === 'function';
|
|
182
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
|
68
|
+
* out of a DOM's head.
|
|
69
|
+
*
|
|
70
|
+
* @param doc The DOM containing the `head` to query against
|
|
71
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
|
72
|
+
* exists or the tag has no content.
|
|
73
|
+
*/
|
|
74
|
+
function queryNonceMetaTagContent(doc) {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
|
77
|
+
}
|
|
183
78
|
/**
|
|
184
79
|
* Production h() function based on Preact by
|
|
185
80
|
* Jason Miller (@developit)
|
|
@@ -188,7 +83,6 @@ const isComplexType = (o) => {
|
|
|
188
83
|
*
|
|
189
84
|
* Modified for Stencil's compiler and vdom
|
|
190
85
|
*/
|
|
191
|
-
// const stack: any[] = [];
|
|
192
86
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
|
193
87
|
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
|
194
88
|
const h = (nodeName, vnodeData, ...children) => {
|
|
@@ -254,6 +148,151 @@ const newVNode = (tag, text) => {
|
|
|
254
148
|
};
|
|
255
149
|
const Host = {};
|
|
256
150
|
const isHost = (node) => node && node.$tag$ === Host;
|
|
151
|
+
/**
|
|
152
|
+
* Parse a new property value for a given property type.
|
|
153
|
+
*
|
|
154
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
155
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
156
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
|
157
|
+
* 2. the type stored from `propType`.
|
|
158
|
+
*
|
|
159
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
160
|
+
*
|
|
161
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
162
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
163
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
164
|
+
* ```tsx
|
|
165
|
+
* <my-cmp prop-val={0}></my-cmp>
|
|
166
|
+
* ```
|
|
167
|
+
*
|
|
168
|
+
* HTML prop values on the other hand, will always a string
|
|
169
|
+
*
|
|
170
|
+
* @param propValue the new value to coerce to some type
|
|
171
|
+
* @param propType the type of the prop, expressed as a binary number
|
|
172
|
+
* @returns the parsed/coerced value
|
|
173
|
+
*/
|
|
174
|
+
const parsePropertyValue = (propValue, propType) => {
|
|
175
|
+
// ensure this value is of the correct prop type
|
|
176
|
+
if (propValue != null && !isComplexType(propValue)) {
|
|
177
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
178
|
+
// per the HTML spec, any string value means it is a boolean true value
|
|
179
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
|
180
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
181
|
+
}
|
|
182
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
183
|
+
// could have been passed as a number or boolean
|
|
184
|
+
// but we still want it as a string
|
|
185
|
+
return String(propValue);
|
|
186
|
+
}
|
|
187
|
+
// redundant return here for better minification
|
|
188
|
+
return propValue;
|
|
189
|
+
}
|
|
190
|
+
// not sure exactly what type we want
|
|
191
|
+
// so no need to change to a different type
|
|
192
|
+
return propValue;
|
|
193
|
+
};
|
|
194
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
195
|
+
const createEvent = (ref, name, flags) => {
|
|
196
|
+
const elm = getElement(ref);
|
|
197
|
+
return {
|
|
198
|
+
emit: (detail) => {
|
|
199
|
+
return emitEvent(elm, name, {
|
|
200
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
201
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
202
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
203
|
+
detail,
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
|
210
|
+
* @param elm the target of the Event
|
|
211
|
+
* @param name the name to give the custom Event
|
|
212
|
+
* @param opts options for configuring a custom Event
|
|
213
|
+
* @returns the custom Event
|
|
214
|
+
*/
|
|
215
|
+
const emitEvent = (elm, name, opts) => {
|
|
216
|
+
const ev = plt.ce(name, opts);
|
|
217
|
+
elm.dispatchEvent(ev);
|
|
218
|
+
return ev;
|
|
219
|
+
};
|
|
220
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
|
221
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
|
222
|
+
let style = styles.get(scopeId);
|
|
223
|
+
if (supportsConstructableStylesheets && allowCS) {
|
|
224
|
+
style = (style || new CSSStyleSheet());
|
|
225
|
+
if (typeof style === 'string') {
|
|
226
|
+
style = cssText;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
style.replaceSync(cssText);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
style = cssText;
|
|
234
|
+
}
|
|
235
|
+
styles.set(scopeId, style);
|
|
236
|
+
};
|
|
237
|
+
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
|
|
238
|
+
var _a;
|
|
239
|
+
let scopeId = getScopeId(cmpMeta);
|
|
240
|
+
const style = styles.get(scopeId);
|
|
241
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
|
242
|
+
// so the fallback is to always use the document for the root node in those cases
|
|
243
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
|
244
|
+
if (style) {
|
|
245
|
+
if (typeof style === 'string') {
|
|
246
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
|
247
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
|
248
|
+
let styleElm;
|
|
249
|
+
if (!appliedStyles) {
|
|
250
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
|
251
|
+
}
|
|
252
|
+
if (!appliedStyles.has(scopeId)) {
|
|
253
|
+
{
|
|
254
|
+
{
|
|
255
|
+
styleElm = doc.createElement('style');
|
|
256
|
+
styleElm.innerHTML = style;
|
|
257
|
+
}
|
|
258
|
+
// Apply CSP nonce to the style tag if it exists
|
|
259
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
260
|
+
if (nonce != null) {
|
|
261
|
+
styleElm.setAttribute('nonce', nonce);
|
|
262
|
+
}
|
|
263
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
|
264
|
+
}
|
|
265
|
+
if (appliedStyles) {
|
|
266
|
+
appliedStyles.add(scopeId);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
|
271
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return scopeId;
|
|
275
|
+
};
|
|
276
|
+
const attachStyles = (hostRef) => {
|
|
277
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
278
|
+
const elm = hostRef.$hostElement$;
|
|
279
|
+
const flags = cmpMeta.$flags$;
|
|
280
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
|
281
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
|
282
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
|
283
|
+
// only required when we're NOT using native shadow dom (slot)
|
|
284
|
+
// or this browser doesn't support native shadow dom
|
|
285
|
+
// and this host element was NOT created with SSR
|
|
286
|
+
// let's pick out the inner content for slot projection
|
|
287
|
+
// create a node to represent where the original
|
|
288
|
+
// content was first placed, which is useful later on
|
|
289
|
+
// DOM WRITE!!
|
|
290
|
+
elm['s-sc'] = scopeId;
|
|
291
|
+
elm.classList.add(scopeId + '-h');
|
|
292
|
+
}
|
|
293
|
+
endAttachStyles();
|
|
294
|
+
};
|
|
295
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
|
257
296
|
/**
|
|
258
297
|
* Production setAccessor() function based on Preact by
|
|
259
298
|
* Jason Miller (@developit)
|
|
@@ -710,32 +749,6 @@ const renderVdom = (hostRef, renderFnResults) => {
|
|
|
710
749
|
// synchronous patch
|
|
711
750
|
patch(oldVNode, rootVnode);
|
|
712
751
|
};
|
|
713
|
-
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
|
714
|
-
const createEvent = (ref, name, flags) => {
|
|
715
|
-
const elm = getElement(ref);
|
|
716
|
-
return {
|
|
717
|
-
emit: (detail) => {
|
|
718
|
-
return emitEvent(elm, name, {
|
|
719
|
-
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
|
720
|
-
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
|
721
|
-
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
|
722
|
-
detail,
|
|
723
|
-
});
|
|
724
|
-
},
|
|
725
|
-
};
|
|
726
|
-
};
|
|
727
|
-
/**
|
|
728
|
-
* Helper function to create & dispatch a custom Event on a provided target
|
|
729
|
-
* @param elm the target of the Event
|
|
730
|
-
* @param name the name to give the custom Event
|
|
731
|
-
* @param opts options for configuring a custom Event
|
|
732
|
-
* @returns the custom Event
|
|
733
|
-
*/
|
|
734
|
-
const emitEvent = (elm, name, opts) => {
|
|
735
|
-
const ev = plt.ce(name, opts);
|
|
736
|
-
elm.dispatchEvent(ev);
|
|
737
|
-
return ev;
|
|
738
|
-
};
|
|
739
752
|
const attachToAncestor = (hostRef, ancestorComponent) => {
|
|
740
753
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
|
741
754
|
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
|
@@ -902,51 +915,8 @@ const safeCall = (instance, method, arg) => {
|
|
|
902
915
|
const then = (promise, thenFn) => {
|
|
903
916
|
return promise && promise.then ? promise.then(thenFn) : thenFn();
|
|
904
917
|
};
|
|
905
|
-
const addHydratedFlag = (elm) => elm.
|
|
906
|
-
|
|
907
|
-
/**
|
|
908
|
-
* Parse a new property value for a given property type.
|
|
909
|
-
*
|
|
910
|
-
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
|
911
|
-
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
|
912
|
-
* 1. `any`, the type given to `propValue` in the function signature
|
|
913
|
-
* 2. the type stored from `propType`.
|
|
914
|
-
*
|
|
915
|
-
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
|
916
|
-
*
|
|
917
|
-
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
|
918
|
-
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
|
919
|
-
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
|
920
|
-
* ```tsx
|
|
921
|
-
* <my-cmp prop-val={0}></my-cmp>
|
|
922
|
-
* ```
|
|
923
|
-
*
|
|
924
|
-
* HTML prop values on the other hand, will always a string
|
|
925
|
-
*
|
|
926
|
-
* @param propValue the new value to coerce to some type
|
|
927
|
-
* @param propType the type of the prop, expressed as a binary number
|
|
928
|
-
* @returns the parsed/coerced value
|
|
929
|
-
*/
|
|
930
|
-
const parsePropertyValue = (propValue, propType) => {
|
|
931
|
-
// ensure this value is of the correct prop type
|
|
932
|
-
if (propValue != null && !isComplexType(propValue)) {
|
|
933
|
-
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
|
934
|
-
// per the HTML spec, any string value means it is a boolean true value
|
|
935
|
-
// but we'll cheat here and say that the string "false" is the boolean false
|
|
936
|
-
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
|
937
|
-
}
|
|
938
|
-
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
|
939
|
-
// could have been passed as a number or boolean
|
|
940
|
-
// but we still want it as a string
|
|
941
|
-
return String(propValue);
|
|
942
|
-
}
|
|
943
|
-
// redundant return here for better minification
|
|
944
|
-
return propValue;
|
|
945
|
-
}
|
|
946
|
-
// not sure exactly what type we want
|
|
947
|
-
// so no need to change to a different type
|
|
948
|
-
return propValue;
|
|
949
|
-
};
|
|
918
|
+
const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
|
|
919
|
+
;
|
|
950
920
|
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
|
951
921
|
const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
952
922
|
// check our new property value against our internal value
|
|
@@ -990,6 +960,16 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
990
960
|
}
|
|
991
961
|
}
|
|
992
962
|
};
|
|
963
|
+
/**
|
|
964
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
|
965
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
|
966
|
+
* decorators, callbacks for when attributes change, and so on.
|
|
967
|
+
*
|
|
968
|
+
* @param Cstr the constructor for a component that we need to process
|
|
969
|
+
* @param cmpMeta metadata collected previously about the component
|
|
970
|
+
* @param flags a number used to store a series of bit flags
|
|
971
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
|
972
|
+
*/
|
|
993
973
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
994
974
|
if (cmpMeta.$members$) {
|
|
995
975
|
if (Cstr.watchers) {
|
|
@@ -1213,15 +1193,20 @@ const connectedCallback = (elm) => {
|
|
|
1213
1193
|
const disconnectedCallback = (elm) => {
|
|
1214
1194
|
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
|
1215
1195
|
const hostRef = getHostRef(elm);
|
|
1196
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
1216
1197
|
{
|
|
1217
1198
|
if (hostRef.$rmListeners$) {
|
|
1218
1199
|
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
|
1219
1200
|
hostRef.$rmListeners$ = undefined;
|
|
1220
1201
|
}
|
|
1221
1202
|
}
|
|
1203
|
+
{
|
|
1204
|
+
safeCall(instance, 'disconnectedCallback');
|
|
1205
|
+
}
|
|
1222
1206
|
}
|
|
1223
1207
|
};
|
|
1224
1208
|
const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1209
|
+
var _a;
|
|
1225
1210
|
const endBootstrap = createTime();
|
|
1226
1211
|
const cmpTags = [];
|
|
1227
1212
|
const exclude = options.exclude || [];
|
|
@@ -1304,6 +1289,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1304
1289
|
{
|
|
1305
1290
|
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
|
|
1306
1291
|
visibilityStyle.setAttribute('data-styles', '');
|
|
1292
|
+
// Apply CSP nonce to the style tag if it exists
|
|
1293
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
|
1294
|
+
if (nonce != null) {
|
|
1295
|
+
visibilityStyle.setAttribute('nonce', nonce);
|
|
1296
|
+
}
|
|
1307
1297
|
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
|
1308
1298
|
}
|
|
1309
1299
|
// Process deferred connectedCallbacks now all components have been registered
|
|
@@ -1319,6 +1309,47 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1319
1309
|
// Fallback appLoad event
|
|
1320
1310
|
endBootstrap();
|
|
1321
1311
|
};
|
|
1312
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
|
1313
|
+
if (listeners) {
|
|
1314
|
+
listeners.map(([flags, name, method]) => {
|
|
1315
|
+
const target = getHostListenerTarget(elm, flags) ;
|
|
1316
|
+
const handler = hostListenerProxy(hostRef, method);
|
|
1317
|
+
const opts = hostListenerOpts(flags);
|
|
1318
|
+
plt.ael(target, name, handler, opts);
|
|
1319
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
|
1324
|
+
try {
|
|
1325
|
+
{
|
|
1326
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
|
1327
|
+
// instance is ready, let's call it's member method for this event
|
|
1328
|
+
hostRef.$lazyInstance$[methodName](ev);
|
|
1329
|
+
}
|
|
1330
|
+
else {
|
|
1331
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
catch (e) {
|
|
1336
|
+
consoleError(e);
|
|
1337
|
+
}
|
|
1338
|
+
};
|
|
1339
|
+
const getHostListenerTarget = (elm, flags) => {
|
|
1340
|
+
if (flags & 4 /* LISTENER_FLAGS.TargetDocument */)
|
|
1341
|
+
return doc;
|
|
1342
|
+
return elm;
|
|
1343
|
+
};
|
|
1344
|
+
// prettier-ignore
|
|
1345
|
+
const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
|
1346
|
+
/**
|
|
1347
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
|
1348
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
|
1349
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
|
1350
|
+
* @returns void
|
|
1351
|
+
*/
|
|
1352
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
|
1322
1353
|
const hostRefs = /*@__PURE__*/ new WeakMap();
|
|
1323
1354
|
const getHostRef = (ref) => hostRefs.get(ref);
|
|
1324
1355
|
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
|
@@ -1362,6 +1393,27 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1362
1393
|
}, consoleError);
|
|
1363
1394
|
};
|
|
1364
1395
|
const styles = /*@__PURE__*/ new Map();
|
|
1396
|
+
const win = typeof window !== 'undefined' ? window : {};
|
|
1397
|
+
const doc = win.document || { head: {} };
|
|
1398
|
+
const plt = {
|
|
1399
|
+
$flags$: 0,
|
|
1400
|
+
$resourcesUrl$: '',
|
|
1401
|
+
jmp: (h) => h(),
|
|
1402
|
+
raf: (h) => requestAnimationFrame(h),
|
|
1403
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
|
1404
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
|
1405
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
|
1406
|
+
};
|
|
1407
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
|
1408
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
|
1409
|
+
try {
|
|
1410
|
+
new CSSStyleSheet();
|
|
1411
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
|
1412
|
+
}
|
|
1413
|
+
catch (e) { }
|
|
1414
|
+
return false;
|
|
1415
|
+
})()
|
|
1416
|
+
;
|
|
1365
1417
|
const queueDomReads = [];
|
|
1366
1418
|
const queueDomWrites = [];
|
|
1367
1419
|
const queueTask = (queue, write) => (cb) => {
|
|
@@ -1412,3 +1464,4 @@ exports.getElement = getElement;
|
|
|
1412
1464
|
exports.h = h;
|
|
1413
1465
|
exports.promiseResolve = promiseResolve;
|
|
1414
1466
|
exports.registerInstance = registerInstance;
|
|
1467
|
+
exports.setNonce = setNonce;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-6de6438b.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Esm v2.
|
|
8
|
+
Stencil Client Patch Esm v2.22.1 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchEsm = () => {
|
|
11
11
|
return index.promiseResolve();
|
|
@@ -18,4 +18,5 @@ const defineCustomElements = (win, options) => {
|
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
exports.setNonce = index.setNonce;
|
|
21
22
|
exports.defineCustomElements = defineCustomElements;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-6de6438b.js');
|
|
6
6
|
|
|
7
7
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
8
8
|
|
|
@@ -18,13 +18,14 @@ const MdsModal = class {
|
|
|
18
18
|
this.top = null;
|
|
19
19
|
this.bottom = null;
|
|
20
20
|
this.animationState = 'intro';
|
|
21
|
-
/**
|
|
22
|
-
* Specifies the animation position of the modal window
|
|
23
|
-
*/
|
|
24
|
-
this.position = null;
|
|
25
21
|
this.animationName = (customState = null, customPosition = null) => {
|
|
26
22
|
return `animate-${customPosition !== null ? customPosition : this.position}${customState !== null ? '-' + customState : ''}`;
|
|
27
23
|
};
|
|
24
|
+
this.checkKeyboardEscape = (event) => {
|
|
25
|
+
if (event.code === 'Escape') {
|
|
26
|
+
this.close.emit();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
28
29
|
this.closeModal = (e = null) => {
|
|
29
30
|
var _a;
|
|
30
31
|
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.localName) !== 'mds-modal') {
|
|
@@ -35,6 +36,9 @@ const MdsModal = class {
|
|
|
35
36
|
this.close.emit();
|
|
36
37
|
}
|
|
37
38
|
};
|
|
39
|
+
this.stateOpened = undefined;
|
|
40
|
+
this.opened = undefined;
|
|
41
|
+
this.position = null;
|
|
38
42
|
}
|
|
39
43
|
componentWillLoad() {
|
|
40
44
|
this.bottom = this.hostElement.querySelector('[slot="bottom"]') !== null;
|
|
@@ -47,6 +51,10 @@ const MdsModal = class {
|
|
|
47
51
|
if (this.position === null) {
|
|
48
52
|
this.position = 'right';
|
|
49
53
|
}
|
|
54
|
+
if (this.window) {
|
|
55
|
+
const modal = this.hostElement.querySelector('[slot="window"]');
|
|
56
|
+
modal.setAttribute('role', 'modal');
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
componentWillRender() {
|
|
52
60
|
this.animationState = this.opened ? 'intro' : 'outro';
|
|
@@ -59,6 +67,14 @@ const MdsModal = class {
|
|
|
59
67
|
this.hostElement.classList.add(this.animationName(this.animationState));
|
|
60
68
|
window.clearTimeout(this.animationDeelay);
|
|
61
69
|
}, 500);
|
|
70
|
+
if (this.opened) {
|
|
71
|
+
this.addKeyboardEscapeListener();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.removeKeyboardEscapeListener();
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
this.removeKeyboardEscapeListener();
|
|
62
78
|
}
|
|
63
79
|
positionChange(_newValue, oldValue) {
|
|
64
80
|
window.clearTimeout(this.animationDeelay);
|
|
@@ -66,19 +82,30 @@ const MdsModal = class {
|
|
|
66
82
|
this.hostElement.classList.remove(this.animationName('intro', oldValue));
|
|
67
83
|
this.hostElement.classList.remove(this.animationName('outro', oldValue));
|
|
68
84
|
}
|
|
85
|
+
addKeyboardEscapeListener() {
|
|
86
|
+
window.addEventListener('keydown', this.checkKeyboardEscape.bind(this));
|
|
87
|
+
}
|
|
88
|
+
removeKeyboardEscapeListener() {
|
|
89
|
+
window.removeEventListener('keydown', this.checkKeyboardEscape.bind(this));
|
|
90
|
+
}
|
|
69
91
|
openedChange(newValue) {
|
|
70
92
|
this.stateOpened = newValue;
|
|
71
93
|
window.clearTimeout(this.animationDeelay);
|
|
94
|
+
if (newValue) {
|
|
95
|
+
this.addKeyboardEscapeListener();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.removeKeyboardEscapeListener();
|
|
72
99
|
}
|
|
73
100
|
onCloseListener() {
|
|
74
101
|
this.opened = false;
|
|
75
102
|
}
|
|
76
103
|
render() {
|
|
77
|
-
return (index.h(index.Host, { class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
104
|
+
return (index.h(index.Host, { "aria-modal": clsx(this.opened ? 'true' : 'false'), class: clsx(this.stateOpened && this.animationName('opened')), onClick: (e) => { this.closeModal(e); } }, this.window
|
|
78
105
|
?
|
|
79
106
|
index.h("slot", { name: "window" })
|
|
80
107
|
:
|
|
81
|
-
index.h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`) }, this.top &&
|
|
108
|
+
index.h("div", { class: clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`), role: "dialog" }, this.top &&
|
|
82
109
|
index.h("slot", { name: "top" }), index.h("slot", null), this.bottom &&
|
|
83
110
|
index.h("slot", { name: "bottom" })), !this.window && index.h("i", { innerHTML: miBaselineClose, class: "svg close" })));
|
|
84
111
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6de6438b.js');
|
|
4
6
|
|
|
5
7
|
/*
|
|
6
|
-
Stencil Client Patch Browser v2.
|
|
8
|
+
Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
|
|
7
9
|
*/
|
|
8
10
|
const patchBrowser = () => {
|
|
9
11
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-modal.cjs.js', document.baseURI).href));
|
|
@@ -17,3 +19,5 @@ const patchBrowser = () => {
|
|
|
17
19
|
patchBrowser().then(options => {
|
|
18
20
|
return index.bootstrapLazy([["mds-modal.cjs",[[1,"mds-modal",{"opened":[1540],"position":[1537],"stateOpened":[32]},[[4,"close","onCloseListener"]]]]]], options);
|
|
19
21
|
});
|
|
22
|
+
|
|
23
|
+
exports.setNonce = index.setNonce;
|