@blockquote-web-components/blockquote-dialog 1.1.7 → 1.1.8
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/define/blockquote-dialog.js +1 -1
- package/package.json +7 -7
- package/src/BlockquoteDialog.js +17 -17
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote-web-components/blockquote-dialog",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Webcomponent blockquote-dialog following open-wc recommendations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
@@ -72,12 +72,12 @@
|
|
|
72
72
|
]
|
|
73
73
|
},
|
|
74
74
|
"prettier": {
|
|
75
|
-
"arrowParens": "avoid",
|
|
76
75
|
"bracketSameLine": true,
|
|
76
|
+
"bracketSpacing": false,
|
|
77
77
|
"htmlWhitespaceSensitivity": "ignore",
|
|
78
78
|
"printWidth": 100,
|
|
79
79
|
"singleQuote": true,
|
|
80
|
-
"trailingComma": "
|
|
80
|
+
"trailingComma": "es5",
|
|
81
81
|
"overrides": [
|
|
82
82
|
{
|
|
83
83
|
"files": "*.{scss,css}",
|
|
@@ -98,20 +98,20 @@
|
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@blockquote-web-components/blockquote-directive-ariaidref-slot": "^1.1.
|
|
101
|
+
"@blockquote-web-components/blockquote-directive-ariaidref-slot": "^1.1.5",
|
|
102
102
|
"@blockquote/dev-utilities": "^1.0.0",
|
|
103
103
|
"@material/web": "^1.4.1",
|
|
104
104
|
"lit": "^3.1.3"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
107
|
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.9.1",
|
|
108
|
-
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.11.
|
|
109
|
-
"@blockquote-web-components/blockquote-foundations-sass": "^1.1.
|
|
108
|
+
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.11.2",
|
|
109
|
+
"@blockquote-web-components/blockquote-foundations-sass": "^1.1.4",
|
|
110
110
|
"sinon": "^18.0.0"
|
|
111
111
|
},
|
|
112
112
|
"publishConfig": {
|
|
113
113
|
"access": "public"
|
|
114
114
|
},
|
|
115
115
|
"customElements": "custom-elements.json",
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "0d8e9582b65cca369553640cc72d2ca93f2c0a61"
|
|
117
117
|
}
|
package/src/BlockquoteDialog.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {html, LitElement, nothing, isServer} from 'lit';
|
|
2
|
+
import {ref, createRef} from 'lit/directives/ref.js';
|
|
3
|
+
import {blockquoteDirectiveAriaidrefSlot} from '@blockquote-web-components/blockquote-directive-ariaidref-slot';
|
|
4
4
|
import {
|
|
5
5
|
redispatchEvent,
|
|
6
6
|
isElementInvisible,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
getFirstAndLastFocusableChildren,
|
|
9
9
|
walkComposedTree,
|
|
10
10
|
} from '@blockquote/dev-utilities';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import {styles} from './styles/blockquote-dialog-styles.css.js';
|
|
12
|
+
import {styles as animations} from './styles/blockqoute-dialog-animations-styles.css.js';
|
|
13
13
|
|
|
14
14
|
// https://web.dev/learn/html/dialog
|
|
15
15
|
// https://github.com/oscarmarina/material-web/blob/main/dialog/dialog.ts
|
|
@@ -158,7 +158,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
getIsConnectedCallbackResolve() {
|
|
161
|
-
return new Promise(resolve => {
|
|
161
|
+
return new Promise((resolve) => {
|
|
162
162
|
/** @type {unknown} */ (this._isConnectedCallbackResolve) = resolve;
|
|
163
163
|
});
|
|
164
164
|
}
|
|
@@ -168,7 +168,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
168
168
|
await this.updateComplete;
|
|
169
169
|
this.scroller = this.shadowRoot?.querySelector('.scroller');
|
|
170
170
|
const [first, last] = getFirstAndLastFocusableChildren(
|
|
171
|
-
/** @type {IterableIterator<HTMLElement>} */ (this.treewalker)
|
|
171
|
+
/** @type {IterableIterator<HTMLElement>} */ (this.treewalker)
|
|
172
172
|
);
|
|
173
173
|
|
|
174
174
|
this._firstFocusableChild = first;
|
|
@@ -185,7 +185,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
185
185
|
|
|
186
186
|
async show() {
|
|
187
187
|
await this._isConnectedCallback;
|
|
188
|
-
const {
|
|
188
|
+
const {value} = this.dialogRef;
|
|
189
189
|
|
|
190
190
|
if (/** @type {HTMLDialogElement} */ (value)?.open) {
|
|
191
191
|
return;
|
|
@@ -215,7 +215,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
close() {
|
|
218
|
-
const {
|
|
218
|
+
const {value} = this.dialogRef;
|
|
219
219
|
if (!(/** @type {HTMLDialogElement} */ (value)?.open)) {
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
@@ -292,7 +292,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
292
292
|
* @param {SubmitEvent} ev
|
|
293
293
|
*/
|
|
294
294
|
_handleSubmit(ev) {
|
|
295
|
-
const {
|
|
295
|
+
const {target, submitter} = ev;
|
|
296
296
|
const isFormMethodDialog = /** @type {HTMLFormElement} */ (target)?.method === 'dialog';
|
|
297
297
|
const isSubmitterFormMethodDialog =
|
|
298
298
|
/** @type {HTMLButtonElement} */ (submitter)?.formMethod === 'dialog';
|
|
@@ -310,7 +310,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
310
310
|
* Dispatched when the dialog is open.
|
|
311
311
|
* @event open
|
|
312
312
|
*/
|
|
313
|
-
const preventDefault = redispatchEvent(this, 'open', {
|
|
313
|
+
const preventDefault = redispatchEvent(this, 'open', {cancelable: true});
|
|
314
314
|
return preventDefault;
|
|
315
315
|
}
|
|
316
316
|
|
|
@@ -324,7 +324,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
324
324
|
* Dispatched when the dialog is close.
|
|
325
325
|
* @event close
|
|
326
326
|
*/
|
|
327
|
-
const preventDefault = !redispatchEvent(this, ev, {
|
|
327
|
+
const preventDefault = !redispatchEvent(this, ev, {cancelable: true});
|
|
328
328
|
if (preventDefault) {
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
@@ -336,7 +336,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
336
336
|
* @param {Event} ev
|
|
337
337
|
*/
|
|
338
338
|
_handleCancel(ev) {
|
|
339
|
-
const {
|
|
339
|
+
const {target} = ev;
|
|
340
340
|
if (target !== this.dialogRef.value) {
|
|
341
341
|
return;
|
|
342
342
|
}
|
|
@@ -345,7 +345,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
345
345
|
* Dispatched when the dialog is cancel.
|
|
346
346
|
* @event cancel
|
|
347
347
|
*/
|
|
348
|
-
const preventDefault = !redispatchEvent(this, ev, {
|
|
348
|
+
const preventDefault = !redispatchEvent(this, ev, {cancelable: true});
|
|
349
349
|
if (preventDefault) {
|
|
350
350
|
return;
|
|
351
351
|
}
|
|
@@ -359,7 +359,7 @@ export class BlockquoteDialog extends LitElement {
|
|
|
359
359
|
return;
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
const {
|
|
362
|
+
const {value} = this.dialogRef;
|
|
363
363
|
value?.dispatchEvent(new Event('cancel'));
|
|
364
364
|
}
|
|
365
365
|
|
|
@@ -367,11 +367,11 @@ export class BlockquoteDialog extends LitElement {
|
|
|
367
367
|
this._nextClickIsFromContent = true;
|
|
368
368
|
}
|
|
369
369
|
|
|
370
|
-
_firstFocusTrap({
|
|
370
|
+
_firstFocusTrap({relatedTarget}) {
|
|
371
371
|
(relatedTarget != null ? this._firstFocusableChild : this._lastFocusableChild)?.focus();
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
_lastFocusTrap({
|
|
374
|
+
_lastFocusTrap({relatedTarget}) {
|
|
375
375
|
(relatedTarget != null ? this._lastFocusableChild : this._firstFocusableChild)?.focus();
|
|
376
376
|
}
|
|
377
377
|
}
|
package/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {BlockquoteDialog} from './BlockquoteDialog.js';
|