@uploadcare/file-uploader 1.3.0-alpha.4 → 1.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/README.md +4 -4
- package/abstract/ActivityBlock.d.ts +1 -1
- package/abstract/ActivityBlock.d.ts.map +1 -1
- package/abstract/ActivityBlock.js +0 -2
- package/abstract/Block.d.ts +11 -4
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +16 -26
- package/abstract/CTX.d.ts +7 -7
- package/abstract/CTX.d.ts.map +1 -1
- package/abstract/CTX.js +1 -1
- package/abstract/LocaleManager.d.ts +3 -3
- package/abstract/SecureUploadsManager.d.ts +2 -2
- package/abstract/SecureUploadsManager.d.ts.map +1 -1
- package/abstract/SolutionBlock.d.ts +2 -2
- package/abstract/SolutionBlock.d.ts.map +1 -1
- package/abstract/TypedCollection.d.ts +1 -1
- package/abstract/TypedCollection.d.ts.map +1 -1
- package/abstract/TypedCollection.js +4 -4
- package/abstract/TypedData.d.ts +2 -2
- package/abstract/TypedData.d.ts.map +1 -1
- package/abstract/TypedData.js +4 -4
- package/abstract/UploaderBlock.d.ts +5 -5
- package/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +5 -5
- package/abstract/UploaderPublicApi.d.ts +21 -22
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +3 -3
- package/abstract/ValidationManager.d.ts +3 -3
- package/abstract/ValidationManager.d.ts.map +1 -1
- package/abstract/a11y.d.ts +2 -2
- package/abstract/a11y.d.ts.map +1 -1
- package/abstract/buildOutputCollectionState.d.ts +1 -1
- package/abstract/buildOutputCollectionState.d.ts.map +1 -1
- package/abstract/defineComponents.d.ts.map +1 -1
- package/abstract/defineComponents.js +0 -5
- package/abstract/l10nProcessor.d.ts.map +1 -1
- package/abstract/l10nProcessor.js +3 -3
- package/abstract/loadFileUploaderFrom.d.ts.map +1 -1
- package/abstract/localeRegistry.d.ts.map +1 -1
- package/abstract/sharedConfigKey.d.ts.map +1 -1
- package/abstract/uploadEntrySchema.d.ts +2 -2
- package/abstract/uploadEntrySchema.d.ts.map +1 -1
- package/abstract/uploadEntrySchema.js +1 -1
- package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
- package/blocks/CameraSource/CameraSource.js +11 -12
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/CropFrame.d.ts +11 -11
- package/blocks/CloudImageEditor/src/CropFrame.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/CropFrame.js +1 -2
- package/blocks/CloudImageEditor/src/EditorButtonControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorButtonControl.js +2 -3
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +1 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +8 -4
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts +3 -3
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +2 -2
- package/blocks/CloudImageEditor/src/EditorImageFader.d.ts +1 -1
- package/blocks/CloudImageEditor/src/EditorImageFader.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.js +1 -1
- package/blocks/CloudImageEditor/src/EditorScroller.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorScroller.js +1 -2
- package/blocks/CloudImageEditor/src/EditorSlider.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorSlider.js +2 -3
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +1 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +14 -15
- package/blocks/CloudImageEditor/src/crop-utils.d.ts +14 -14
- package/blocks/CloudImageEditor/src/crop-utils.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/css/common.css +2 -2
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/elements/button/BtnUi.js +5 -5
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/elements/line-loader/LineLoaderUi.js +1 -2
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/elements/presence-toggle/PresenceToggle.js +2 -3
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/elements/slider/SliderUi.js +2 -3
- package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts +15 -0
- package/blocks/CloudImageEditor/src/lib/FocusVisible.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/lib/FocusVisible.js +33 -0
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts +10 -0
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/lib/applyFocusVisiblePolyfill.js +256 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +1 -1
- package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts +3 -3
- package/blocks/CloudImageEditor/src/lib/transformationUtils.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/state.d.ts +4 -4
- package/blocks/CloudImageEditor/src/template.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/template.js +4 -5
- package/blocks/CloudImageEditor/src/types.d.ts +2 -2
- package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts +3 -3
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.d.ts.map +1 -1
- package/blocks/CloudImageEditorActivity/CloudImageEditorActivity.js +1 -2
- package/blocks/Config/Config.d.ts +11 -3
- package/blocks/Config/Config.d.ts.map +1 -1
- package/blocks/Config/initialConfig.d.ts +1 -1
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Copyright/Copyright.d.ts.map +1 -1
- package/blocks/Copyright/Copyright.js +1 -2
- package/blocks/DropArea/DropArea.d.ts +2 -2
- package/blocks/DropArea/DropArea.d.ts.map +1 -1
- package/blocks/DropArea/DropArea.js +5 -5
- package/blocks/DropArea/addDropzone.d.ts.map +1 -1
- package/blocks/DropArea/getDropItems.d.ts +2 -2
- package/blocks/DropArea/getDropItems.d.ts.map +1 -1
- package/blocks/ExternalSource/ExternalSource.d.ts +5 -5
- package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
- package/blocks/ExternalSource/ExternalSource.js +9 -9
- package/blocks/ExternalSource/buildStyles.js +2 -2
- package/blocks/ExternalSource/query-string.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.d.ts +3 -3
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +11 -12
- package/blocks/Icon/Icon.d.ts +1 -0
- package/blocks/Icon/Icon.d.ts.map +1 -1
- package/blocks/Icon/Icon.js +5 -3
- package/blocks/Img/ImgBase.js +9 -9
- package/blocks/Img/ImgConfig.d.ts +2 -2
- package/blocks/Img/ImgConfig.d.ts.map +1 -1
- package/blocks/Img/ImgConfig.js +3 -3
- package/blocks/Img/utils/parseObjectToString.js +1 -1
- package/blocks/Modal/Modal.d.ts.map +1 -1
- package/blocks/Modal/Modal.js +1 -2
- package/blocks/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/blocks/ProgressBar/ProgressBar.js +1 -2
- package/blocks/ProgressBarCommon/ProgressBarCommon.d.ts.map +1 -1
- package/blocks/ProgressBarCommon/ProgressBarCommon.js +1 -2
- package/blocks/Range/Range.d.ts +16 -0
- package/blocks/Range/Range.d.ts.map +1 -0
- package/blocks/Range/Range.js +44 -0
- package/blocks/Range/range.css +65 -0
- package/blocks/Select/Select.d.ts.map +1 -1
- package/blocks/Select/Select.js +9 -14
- package/blocks/SimpleBtn/SimpleBtn.d.ts +2 -2
- package/blocks/SimpleBtn/SimpleBtn.d.ts.map +1 -1
- package/blocks/SimpleBtn/SimpleBtn.js +3 -4
- package/blocks/SourceBtn/SourceBtn.d.ts +2 -2
- package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
- package/blocks/SourceBtn/SourceBtn.js +4 -4
- package/blocks/SourceList/SourceList.d.ts.map +1 -1
- package/blocks/SourceList/SourceList.js +4 -5
- package/blocks/StartFrom/StartFrom.d.ts.map +1 -1
- package/blocks/StartFrom/StartFrom.js +1 -2
- package/blocks/UploadCtxProvider/EventEmitter.d.ts +19 -19
- package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
- package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts +4 -4
- package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
- package/blocks/UploadList/UploadList.d.ts +2 -2
- package/blocks/UploadList/UploadList.d.ts.map +1 -1
- package/blocks/UploadList/UploadList.js +11 -10
- package/blocks/UrlSource/UrlSource.d.ts.map +1 -1
- package/blocks/UrlSource/UrlSource.js +6 -7
- package/blocks/themes/uc-basic/index.css +1 -0
- package/blocks/utils/debounce.d.ts +1 -3
- package/blocks/utils/debounce.d.ts.map +1 -1
- package/blocks/utils/throttle.d.ts +1 -3
- package/blocks/utils/throttle.d.ts.map +1 -1
- package/blocks/utils/userAgent.d.ts +1 -1
- package/blocks/utils/userAgent.d.ts.map +1 -1
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.ssr.d.ts +2 -116
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +79 -190
- package/package.json +8 -10
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts +2 -2
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
- package/solutions/file-uploader/inline/FileUploaderInline.js +5 -5
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +1 -2
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +2 -2
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +3 -6
- package/types/jsx.d.ts +3 -9
- package/utils/getPluralForm.d.ts.map +1 -1
- package/utils/isSecureTokenExpired.d.ts +1 -1
- package/utils/memoize.d.ts.map +1 -1
- package/utils/mixinClass.d.ts +1 -3
- package/utils/mixinClass.d.ts.map +1 -1
- package/utils/prettyBytes.d.ts.map +1 -1
- package/utils/template-utils.d.ts.map +1 -1
- package/utils/toKebabCase.d.ts.map +1 -1
- package/utils/uniqueArray.d.ts.map +1 -1
- package/utils/validators/collection/validateCollectionUploadError.d.ts +1 -1
- package/utils/validators/collection/validateMultiple.d.ts +1 -1
- package/utils/validators/file/validateFileType.d.ts +1 -1
- package/utils/validators/file/validateIsImage.d.ts +1 -1
- package/utils/validators/file/validateMaxSizeLimit.d.ts +1 -1
- package/utils/validators/file/validateUploadError.d.ts +1 -1
- package/utils/waitForAttribute.d.ts +6 -12
- package/utils/waitForAttribute.d.ts.map +1 -1
- package/utils/waitForAttribute.js +8 -38
- package/utils/waitForAttribute.test.js +47 -10
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-basic.min.css +1 -1
- package/web/uc-cloud-image-editor.min.css +1 -1
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.css +1 -1
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +3 -3
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +3 -3
- package/abstract/bindCompatibilityFallbackProcessor.d.ts +0 -3
- package/abstract/bindCompatibilityFallbackProcessor.d.ts.map +0 -1
- package/abstract/bindCompatibilityFallbackProcessor.js +0 -16
- package/utils/withResolvers.d.ts +0 -7
- package/utils/withResolvers.d.ts.map +0 -1
- package/utils/withResolvers.js +0 -17
- package/utils/withResolvers.test.d.ts +0 -2
- package/utils/withResolvers.test.d.ts.map +0 -1
- package/utils/withResolvers.test.js +0 -27
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { html } from '@symbiotejs/symbiote';
|
|
3
2
|
import { debounce } from '../../utils/debounce.js';
|
|
4
3
|
import { Block } from '../../../abstract/Block.js';
|
|
5
4
|
import { EditorCropButtonControl } from './EditorCropButtonControl.js';
|
|
@@ -22,14 +21,14 @@ function renderTabToggle(id) {
|
|
|
22
21
|
return /* HTML */ `
|
|
23
22
|
<uc-presence-toggle
|
|
24
23
|
class="uc-tab-toggle"
|
|
25
|
-
|
|
24
|
+
set="visible: presence.tabToggle.${id}; styles: presence.tabToggleStyles;"
|
|
26
25
|
>
|
|
27
26
|
<uc-btn-ui
|
|
28
27
|
theme="tab"
|
|
29
28
|
ref="tab-toggle-${id}"
|
|
30
29
|
data-id="${id}"
|
|
31
30
|
icon="${id}"
|
|
32
|
-
|
|
31
|
+
set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${id}"
|
|
33
32
|
>
|
|
34
33
|
</uc-btn-ui>
|
|
35
34
|
</uc-presence-toggle>
|
|
@@ -38,11 +37,11 @@ function renderTabToggle(id) {
|
|
|
38
37
|
|
|
39
38
|
/** @param {String} id */
|
|
40
39
|
function renderTabContent(id) {
|
|
41
|
-
return
|
|
40
|
+
return /* HTML */ `
|
|
42
41
|
<uc-presence-toggle
|
|
43
42
|
id="tab_${id}"
|
|
44
43
|
class="uc-tab-content"
|
|
45
|
-
|
|
44
|
+
set="visible: presence.tabContent.${id}; styles: presence.tabContentStyles"
|
|
46
45
|
>
|
|
47
46
|
<uc-editor-scroller hidden-scrollbar>
|
|
48
47
|
<div class="uc-controls-list_align">
|
|
@@ -335,7 +334,7 @@ export class EditorToolbar extends Block {
|
|
|
335
334
|
this.sub('*editorTransformations', (editorTransformations) => {
|
|
336
335
|
let appliedFilter = editorTransformations?.filter?.name;
|
|
337
336
|
if (this.$['*currentFilter'] !== appliedFilter) {
|
|
338
|
-
this.$['*currentFilter'] = appliedFilter
|
|
337
|
+
this.$['*currentFilter'] = appliedFilter;
|
|
339
338
|
}
|
|
340
339
|
});
|
|
341
340
|
|
|
@@ -400,8 +399,8 @@ export class EditorToolbar extends Block {
|
|
|
400
399
|
}
|
|
401
400
|
}
|
|
402
401
|
|
|
403
|
-
EditorToolbar.template =
|
|
404
|
-
<uc-line-loader-ui
|
|
402
|
+
EditorToolbar.template = /* HTML */ `
|
|
403
|
+
<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui>
|
|
405
404
|
<div class="uc-info-tooltip_container">
|
|
406
405
|
<div class="uc-info-tooltip_wrapper">
|
|
407
406
|
<div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div>
|
|
@@ -411,31 +410,31 @@ EditorToolbar.template = html`
|
|
|
411
410
|
<uc-presence-toggle
|
|
412
411
|
role="tablist"
|
|
413
412
|
class="uc-sub-toolbar"
|
|
414
|
-
|
|
413
|
+
set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles"
|
|
415
414
|
>
|
|
416
415
|
<div class="uc-tab-content-row">${ALL_TABS.map(renderTabContent).join('')}</div>
|
|
417
416
|
<div class="uc-controls-row">
|
|
418
417
|
<uc-presence-toggle
|
|
419
418
|
class="uc-tab-toggles"
|
|
420
|
-
|
|
419
|
+
set="visible: presence.tabToggles; styles: presence.tabTogglesStyles"
|
|
421
420
|
>
|
|
422
421
|
<div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div>
|
|
423
422
|
${ALL_TABS.map(renderTabToggle).join('')}
|
|
424
423
|
</uc-presence-toggle>
|
|
425
|
-
<uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax"
|
|
426
|
-
<uc-btn-ui theme="primary-icon" icon="done"
|
|
424
|
+
<uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel"> </uc-btn-ui>
|
|
425
|
+
<uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply"> </uc-btn-ui>
|
|
427
426
|
</div>
|
|
428
427
|
</uc-presence-toggle>
|
|
429
428
|
<uc-presence-toggle
|
|
430
429
|
class="uc-sub-toolbar"
|
|
431
|
-
|
|
430
|
+
set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles"
|
|
432
431
|
>
|
|
433
432
|
<div class="uc-slider">
|
|
434
433
|
<uc-editor-slider ref="slider-el"></uc-editor-slider>
|
|
435
434
|
</div>
|
|
436
435
|
<div class="uc-controls-row">
|
|
437
|
-
<uc-btn-ui theme="secondary"
|
|
438
|
-
<uc-btn-ui theme="primary"
|
|
436
|
+
<uc-btn-ui theme="secondary" set="onclick: on.cancelSlider;" l10n="@text:cancel"> </uc-btn-ui>
|
|
437
|
+
<uc-btn-ui theme="primary" set="onclick: on.applySlider;" l10n="@text:apply"> </uc-btn-ui>
|
|
439
438
|
</div>
|
|
440
439
|
</uc-presence-toggle>
|
|
441
440
|
</div>
|
|
@@ -18,7 +18,7 @@ export function createSvgNode(name: string, attrs?: {
|
|
|
18
18
|
* @param {import('./types.js').Direction} direction
|
|
19
19
|
* @param {number} sizeMultiplier
|
|
20
20
|
*/
|
|
21
|
-
export function cornerPath(rect: import(
|
|
21
|
+
export function cornerPath(rect: import('./types.js').Rectangle, direction: import('./types.js').Direction, sizeMultiplier: number): {
|
|
22
22
|
d: string;
|
|
23
23
|
center: number[];
|
|
24
24
|
};
|
|
@@ -27,12 +27,12 @@ export function cornerPath(rect: import("./types.js").Rectangle, direction: impo
|
|
|
27
27
|
* @param {Extract<import('./types.js').Direction, 'n' | 's' | 'w' | 'e'>} direction
|
|
28
28
|
* @param {number} sizeMultiplier
|
|
29
29
|
*/
|
|
30
|
-
export function sidePath(rect: import(
|
|
30
|
+
export function sidePath(rect: import('./types.js').Rectangle, direction: Extract<import('./types.js').Direction, 'n' | 's' | 'w' | 'e'>, sizeMultiplier: number): {
|
|
31
31
|
d: string;
|
|
32
32
|
center: number[];
|
|
33
33
|
};
|
|
34
34
|
/** @param {import('./types.js').Direction} direction */
|
|
35
|
-
export function thumbCursor(direction: import(
|
|
35
|
+
export function thumbCursor(direction: import('./types.js').Direction): "move" | "ew-resize" | "ns-resize" | "nwse-resize" | "nesw-resize";
|
|
36
36
|
/**
|
|
37
37
|
* @param {{
|
|
38
38
|
* rect: import('./types.js').Rectangle;
|
|
@@ -41,9 +41,9 @@ export function thumbCursor(direction: import("./types.js").Direction): "move" |
|
|
|
41
41
|
* }} options
|
|
42
42
|
*/
|
|
43
43
|
export function moveRect({ rect, delta: [dx, dy], imageBox }: {
|
|
44
|
-
rect: import(
|
|
44
|
+
rect: import('./types.js').Rectangle;
|
|
45
45
|
delta: [number, number];
|
|
46
|
-
imageBox: import(
|
|
46
|
+
imageBox: import('./types.js').Rectangle;
|
|
47
47
|
}): {
|
|
48
48
|
x: number;
|
|
49
49
|
y: number;
|
|
@@ -54,7 +54,7 @@ export function moveRect({ rect, delta: [dx, dy], imageBox }: {
|
|
|
54
54
|
* @param {import('./types.js').Rectangle} rect1
|
|
55
55
|
* @param {import('./types.js').Rectangle} rect2
|
|
56
56
|
*/
|
|
57
|
-
export function constraintRect(rect1: import(
|
|
57
|
+
export function constraintRect(rect1: import('./types.js').Rectangle, rect2: import('./types.js').Rectangle): {
|
|
58
58
|
x: number;
|
|
59
59
|
y: number;
|
|
60
60
|
width: number;
|
|
@@ -70,33 +70,33 @@ export function constraintRect(rect1: import("./types.js").Rectangle, rect2: imp
|
|
|
70
70
|
* }} options
|
|
71
71
|
*/
|
|
72
72
|
export function resizeRect({ direction, ...rest }: {
|
|
73
|
-
rect: import(
|
|
73
|
+
rect: import('./types.js').Rectangle;
|
|
74
74
|
delta: [number, number];
|
|
75
|
-
direction: import(
|
|
75
|
+
direction: import('./types.js').Direction;
|
|
76
76
|
aspectRatio?: number;
|
|
77
|
-
imageBox: import(
|
|
77
|
+
imageBox: import('./types.js').Rectangle;
|
|
78
78
|
}): import("./types.js").Rectangle;
|
|
79
79
|
/**
|
|
80
80
|
* @param {import('./types.js').Rectangle} rect
|
|
81
81
|
* @param {[Number, Number]} point
|
|
82
82
|
*/
|
|
83
|
-
export function rectContainsPoint(rect: import(
|
|
83
|
+
export function rectContainsPoint(rect: import('./types.js').Rectangle, [x, y]: [number, number]): boolean;
|
|
84
84
|
/**
|
|
85
85
|
* @param {import('./types.js').Rectangle} rect1
|
|
86
86
|
* @param {import('./types.js').Rectangle} rect2
|
|
87
87
|
*/
|
|
88
|
-
export function isRectInsideRect(rect1: import(
|
|
88
|
+
export function isRectInsideRect(rect1: import('./types.js').Rectangle, rect2: import('./types.js').Rectangle): boolean;
|
|
89
89
|
/**
|
|
90
90
|
* @param {import('./types.js').Rectangle} rect
|
|
91
91
|
* @param {number} aspectRatio
|
|
92
92
|
*/
|
|
93
|
-
export function isRectMatchesAspectRatio(rect: import(
|
|
93
|
+
export function isRectMatchesAspectRatio(rect: import('./types.js').Rectangle, aspectRatio: number): boolean;
|
|
94
94
|
/**
|
|
95
95
|
* @param {import('./types.js').ImageSize} imageSize
|
|
96
96
|
* @param {Number} angle
|
|
97
97
|
* @returns {import('./types.js').ImageSize}
|
|
98
98
|
*/
|
|
99
|
-
export function rotateSize({ width, height }: import(
|
|
99
|
+
export function rotateSize({ width, height }: import('./types.js').ImageSize, angle: number): import('./types.js').ImageSize;
|
|
100
100
|
/**
|
|
101
101
|
* @param {number} width
|
|
102
102
|
* @param {number} height
|
|
@@ -112,7 +112,7 @@ export function calculateMaxCenteredCropFrame(width: number, height: number, asp
|
|
|
112
112
|
* @param {import('./types.js').Rectangle} rect
|
|
113
113
|
* @returns {import('./types.js').Rectangle}
|
|
114
114
|
*/
|
|
115
|
-
export function roundRect(rect: import(
|
|
115
|
+
export function roundRect(rect: import('./types.js').Rectangle): import('./types.js').Rectangle;
|
|
116
116
|
/**
|
|
117
117
|
* @param {Number} value
|
|
118
118
|
* @param {Number} min
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crop-utils.d.ts","sourceRoot":"","sources":["crop-utils.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,sCAHW,UAAU
|
|
1
|
+
{"version":3,"file":"crop-utils.d.ts","sourceRoot":"","sources":["crop-utils.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,sCAHW,UAAU;;SAKpB;AAED;;;;GAIG;AACH;;IAFa,UAAU,CAMtB;AAED;;;;GAIG;AACH,iCAJW,OAAO,YAAY,EAAE,SAAS,aAC9B,OAAO,YAAY,EAAE,SAAS,kBAC9B,MAAM;;;EA2BhB;AAED;;;;GAIG;AACH,+BAJW,OAAO,YAAY,EAAE,SAAS,aAC9B,QAAQ,OAAO,YAAY,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,kBAC9D,MAAM;;;EA0BhB;AAED,wDAAwD;AACxD,uCADY,OAAO,YAAY,EAAE,SAAS,sEAezC;AAED;;;;;;GAMG;AACH,8DANW;IACV,IAAQ,EAAE,OAAO,YAAY,EAAE,SAAS,CAAC;IACzC,KAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAY,EAAE,OAAO,YAAY,EAAE,SAAS,CAAC;CAC1C;;;;;EAWH;AAED;;;GAGG;AACH,sCAHW,OAAO,YAAY,EAAE,SAAS,SAC9B,OAAO,YAAY,EAAE,SAAS;;;;;EAqBxC;AA8cD;;;;;;;;GAQG;AACH,mDARW;IACV,IAAQ,EAAE,OAAO,YAAY,EAAE,SAAS,CAAC;IACzC,KAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAa,EAAE,OAAO,YAAY,EAAE,SAAS,CAAC;IAC9C,WAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAY,EAAE,OAAO,YAAY,EAAE,SAAS,CAAC;CAC1C,kCAuBH;AAED;;;GAGG;AACH,wCAHW,OAAO,YAAY,EAAE,SAAS,UAC9B,gBAAgB,WAI1B;AAED;;;GAGG;AACH,wCAHW,OAAO,YAAY,EAAE,SAAS,SAC9B,OAAO,YAAY,EAAE,SAAS,WASxC;AAED;;;GAGG;AACH,+CAHW,OAAO,YAAY,EAAE,SAAS,eAC9B,MAAM,WAKhB;AAED;;;;GAIG;AACH,8CAJW,OAAO,YAAY,EAAE,SAAS,kBAE5B,OAAO,YAAY,EAAE,SAAS,CAK1C;AAED;;;;GAIG;AACH,qDAJW,MAAM,UACN,MAAM,eACN,MAAM;;;;;EAyBhB;AAED;;;GAGG;AACH,gCAHW,OAAO,YAAY,EAAE,SAAS,GAC5B,OAAO,YAAY,EAAE,SAAS,CAS1C;AAED;;;;;GAKG;AACH,uEAEC"}
|
|
@@ -375,7 +375,7 @@ uc-editor-operation-control > button {
|
|
|
375
375
|
height: var(--size-icon);
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
uc-editor-filter-control uc-icon.uc-original-icon > svg {
|
|
378
|
+
uc-editor-filter-control > uc-icon.uc-original-icon > svg {
|
|
379
379
|
width: 100%;
|
|
380
380
|
height: 100%;
|
|
381
381
|
}
|
|
@@ -448,7 +448,7 @@ uc-editor-filter-control > button .uc-preview {
|
|
|
448
448
|
transition: var(--transition-duration-3);
|
|
449
449
|
}
|
|
450
450
|
|
|
451
|
-
uc-editor-filter-control .uc-original-icon {
|
|
451
|
+
uc-editor-filter-control > .uc-original-icon {
|
|
452
452
|
color: var(--color-effect);
|
|
453
453
|
opacity: 0.3;
|
|
454
454
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BtnUi.d.ts","sourceRoot":"","sources":["BtnUi.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BtnUi.d.ts","sourceRoot":"","sources":["BtnUi.js"],"names":[],"mappings":"AAGA;IAII,uBAA0B;IAC1B,qBAAwB;IACxB,qBAAwB;IAExB;;;;;;;MAQC;IAWH,mBAOC;IAkCD,sBAQC;CACF;;;;sBAhFqB,kCAAkC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { html } from '@symbiotejs/symbiote';
|
|
2
1
|
import { Block } from '../../../../../abstract/Block.js';
|
|
3
2
|
import { classNames } from '../../lib/classNames.js';
|
|
4
3
|
|
|
@@ -53,7 +52,7 @@ export class BtnUi extends Block {
|
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
54
|
|
|
56
|
-
this.sub('text', () => {
|
|
55
|
+
this.sub('text', (txt) => {
|
|
57
56
|
this._iconSingle = false;
|
|
58
57
|
});
|
|
59
58
|
|
|
@@ -80,11 +79,12 @@ export class BtnUi extends Block {
|
|
|
80
79
|
}
|
|
81
80
|
}
|
|
82
81
|
}
|
|
82
|
+
|
|
83
83
|
BtnUi.bindAttributes({ text: 'text', icon: 'icon', reverse: 'reverse', theme: 'theme' });
|
|
84
84
|
|
|
85
|
-
BtnUi.template =
|
|
86
|
-
<button type="button"
|
|
87
|
-
<uc-icon
|
|
85
|
+
BtnUi.template = /* HTML */ `
|
|
86
|
+
<button type="button" set="@role:aria-role; @aria-controls: aria-controls">
|
|
87
|
+
<uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon>
|
|
88
88
|
<div class="uc-text">{{text}}</div>
|
|
89
89
|
</button>
|
|
90
90
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineLoaderUi.d.ts","sourceRoot":"","sources":["LineLoaderUi.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LineLoaderUi.d.ts","sourceRoot":"","sources":["LineLoaderUi.js"],"names":[],"mappings":"AAEA;IAII,iBAAoB;IAEpB,sCAMC;IAgBH,eAUC;IAED,cAEC;CACF;;;;sBA7CqB,kCAAkC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { html } from '@symbiotejs/symbiote';
|
|
2
1
|
import { Block } from '../../../../../abstract/Block.js';
|
|
3
2
|
|
|
4
3
|
export class LineLoaderUi extends Block {
|
|
@@ -46,7 +45,7 @@ export class LineLoaderUi extends Block {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
LineLoaderUi.template =
|
|
48
|
+
LineLoaderUi.template = /* HTML */ `
|
|
50
49
|
<div class="uc-inner">
|
|
51
50
|
<div class="uc-line" ref="line-el"></div>
|
|
52
51
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresenceToggle.d.ts","sourceRoot":"","sources":["PresenceToggle.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PresenceToggle.d.ts","sourceRoot":"","sources":["PresenceToggle.js"],"names":[],"mappings":"AAiBA;IAII,kBAAqB;IACrB,kCAA0C;IAC1C,iCAAwC;IACxC,8BAAiC;IAqBnC,uBAQC;CAgBF;;;;;;;;;sBApEqB,kCAAkC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { html } from '@symbiotejs/symbiote';
|
|
2
|
-
import { Block } from '../../../../../abstract/Block.js';
|
|
3
1
|
import { applyClassNames } from '../../lib/classNames.js';
|
|
2
|
+
import { Block } from '../../../../../abstract/Block.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* @typedef {Object} Style
|
|
@@ -69,4 +68,4 @@ export class PresenceToggle extends Block {
|
|
|
69
68
|
}, 0);
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
PresenceToggle.template =
|
|
71
|
+
PresenceToggle.template = /* HTML */ `<slot></slot> `;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderUi.d.ts","sourceRoot":"","sources":["SliderUi.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SliderUi.d.ts","sourceRoot":"","sources":["SliderUi.js"],"names":[],"mappings":"AAEA;IACE,WAiBE;IA6BE,WAAiB;IAenB,sCAIE;IAGF,+BAAgG;IAyBlG,+BAWC;IAED,iCAgBC;IAED,qBAmCC;IALC,uCAA2B;IAI3B,iBAAwB;CAM3B;;;;sBAvKqB,kCAAkC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { html } from '@symbiotejs/symbiote';
|
|
2
1
|
import { Block } from '../../../../../abstract/Block.js';
|
|
3
2
|
|
|
4
3
|
export class SliderUi extends Block {
|
|
@@ -167,13 +166,13 @@ export class SliderUi extends Block {
|
|
|
167
166
|
this._observer?.disconnect();
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
|
-
SliderUi.template =
|
|
169
|
+
SliderUi.template = /* HTML */ `
|
|
171
170
|
<div class="uc-steps" ref="steps-el"></div>
|
|
172
171
|
<div ref="thumb-el" class="uc-thumb"></div>
|
|
173
172
|
<input
|
|
174
173
|
class="uc-input"
|
|
175
174
|
type="range"
|
|
176
175
|
ref="input-el"
|
|
177
|
-
|
|
176
|
+
set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;"
|
|
178
177
|
/>
|
|
179
178
|
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class FocusVisible {
|
|
2
|
+
/**
|
|
3
|
+
* @param {boolean} focusVisible
|
|
4
|
+
* @param {HTMLElement} element
|
|
5
|
+
*/
|
|
6
|
+
static handleFocusVisible(focusVisible: boolean, element: HTMLElement): void;
|
|
7
|
+
/** @param {ShadowRoot | Document} scope */
|
|
8
|
+
static register(scope: ShadowRoot | Document): void;
|
|
9
|
+
/** @param {Document | ShadowRoot} scope */
|
|
10
|
+
static unregister(scope: Document | ShadowRoot): void;
|
|
11
|
+
}
|
|
12
|
+
export namespace FocusVisible {
|
|
13
|
+
let _destructors: WeakMap<WeakKey, any>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FocusVisible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusVisible.d.ts","sourceRoot":"","sources":["FocusVisible.js"],"names":[],"mappings":"AAEA;IACE;;;OAGG;IACH,wCAHW,OAAO,WACP,WAAW,QASrB;IAED,2CAA2C;IAC3C,uBADY,UAAU,GAAG,QAAQ,QAGhC;IAED,2CAA2C;IAC3C,yBADY,QAAQ,GAAG,UAAU,QAQhC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { applyFocusVisiblePolyfill } from './applyFocusVisiblePolyfill.js';
|
|
2
|
+
|
|
3
|
+
export class FocusVisible {
|
|
4
|
+
/**
|
|
5
|
+
* @param {boolean} focusVisible
|
|
6
|
+
* @param {HTMLElement} element
|
|
7
|
+
*/
|
|
8
|
+
static handleFocusVisible(focusVisible, element) {
|
|
9
|
+
if (focusVisible) {
|
|
10
|
+
let customOutline = element.style.getPropertyValue('--focus-visible-outline');
|
|
11
|
+
element.style.outline = customOutline || '2px solid var(--color-focus-ring)';
|
|
12
|
+
} else {
|
|
13
|
+
element.style.outline = 'none';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @param {ShadowRoot | Document} scope */
|
|
18
|
+
static register(scope) {
|
|
19
|
+
FocusVisible._destructors.set(scope, applyFocusVisiblePolyfill(scope, FocusVisible.handleFocusVisible));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @param {Document | ShadowRoot} scope */
|
|
23
|
+
static unregister(scope) {
|
|
24
|
+
if (!FocusVisible._destructors.has(scope)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let removeFocusVisiblePolyfill = FocusVisible._destructors.get(scope);
|
|
28
|
+
removeFocusVisiblePolyfill();
|
|
29
|
+
FocusVisible._destructors.delete(scope);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
FocusVisible._destructors = new WeakMap();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies the :focus-visible polyfill at the given scope. A scope, in this case, is either the top-level Document or a
|
|
3
|
+
* Shadow Root.
|
|
4
|
+
*
|
|
5
|
+
* @param {Document | ShadowRoot} scope
|
|
6
|
+
* @param {(focusVisible: boolean, el: EventTarget) => void} [callback]
|
|
7
|
+
* @see https://github.com/WICG/focus-visible
|
|
8
|
+
*/
|
|
9
|
+
export function applyFocusVisiblePolyfill(scope: Document | ShadowRoot, callback?: ((focusVisible: boolean, el: EventTarget) => void) | undefined): () => void;
|
|
10
|
+
//# sourceMappingURL=applyFocusVisiblePolyfill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyFocusVisiblePolyfill.d.ts","sourceRoot":"","sources":["applyFocusVisiblePolyfill.js"],"names":[],"mappings":"AAgDA;;;;;;;GAOG;AACH,iDAJW,QAAQ,GAAG,UAAU,6BACN,OAAO,MAAM,WAAW,KAAK,IAAI,2BA0M1D"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function for legacy browsers and iframes which sometimes focus on elements like document, body, and
|
|
3
|
+
* non-interactive SVG.
|
|
4
|
+
*
|
|
5
|
+
* @param {EventTarget} el
|
|
6
|
+
*/
|
|
7
|
+
function isValidFocusTarget(el) {
|
|
8
|
+
if (
|
|
9
|
+
el &&
|
|
10
|
+
el !== document &&
|
|
11
|
+
/** @type {Element} */ (el).nodeName !== 'HTML' &&
|
|
12
|
+
/** @type {Element} */ (el).nodeName !== 'BODY' &&
|
|
13
|
+
'classList' in el &&
|
|
14
|
+
'contains' in /** @type {Element} */ (el).classList
|
|
15
|
+
) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Computes whether the given element should automatically trigger the `focus-visible` class being added, i.e., whether
|
|
23
|
+
* it should always match `:focus-visible` when focused.
|
|
24
|
+
*
|
|
25
|
+
* @param {EventTarget} el
|
|
26
|
+
* @returns {boolean}
|
|
27
|
+
*/
|
|
28
|
+
function focusTriggersKeyboardModality(el) {
|
|
29
|
+
let { tagName } = /** @type {Element} */ (el);
|
|
30
|
+
|
|
31
|
+
if (tagName === 'INPUT' && !(/** @type {HTMLInputElement} */ (el).readOnly)) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (tagName === 'TEXTAREA' && !(/** @type {HTMLTextAreaElement} */ (el).readOnly)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (/** @type {HTMLElement} */ (el).isContentEditable) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let hadKeyboardEvent = true;
|
|
47
|
+
let hadFocusVisibleRecently = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Applies the :focus-visible polyfill at the given scope. A scope, in this case, is either the top-level Document or a
|
|
51
|
+
* Shadow Root.
|
|
52
|
+
*
|
|
53
|
+
* @param {Document | ShadowRoot} scope
|
|
54
|
+
* @param {(focusVisible: boolean, el: EventTarget) => void} [callback]
|
|
55
|
+
* @see https://github.com/WICG/focus-visible
|
|
56
|
+
*/
|
|
57
|
+
export function applyFocusVisiblePolyfill(scope, callback) {
|
|
58
|
+
let hadFocusVisibleRecentlyTimeout = null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Add the `focus-visible` class to the given element if the author did not add it.
|
|
62
|
+
*
|
|
63
|
+
* @param {EventTarget} el
|
|
64
|
+
*/
|
|
65
|
+
function addFocusVisibleClass(el) {
|
|
66
|
+
/** @type {Element} */ (el).setAttribute('focus-visible', '');
|
|
67
|
+
callback(true, el);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Remove the `focus-visible` class from the given element if the author did not originally add it.
|
|
72
|
+
*
|
|
73
|
+
* @param {EventTarget} el
|
|
74
|
+
*/
|
|
75
|
+
function removeFocusVisibleClass(el) {
|
|
76
|
+
if (!(/** @type {Element} */ (el).hasAttribute('focus-visible'))) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
/** @type {Element} */ (el).removeAttribute('focus-visible');
|
|
80
|
+
callback(false, el);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* If the most recent user interaction was via the keyboard, and the keypress did not include a meta, alt/option, or
|
|
85
|
+
* control key, then the keyboard's modality. Otherwise, the modality is not the keyboard.Apply `focus-visible` to any
|
|
86
|
+
* current active element and keep track of our keyboard modality state with `hadKeyboardEvent`.
|
|
87
|
+
*
|
|
88
|
+
* @param {KeyboardEvent} e
|
|
89
|
+
*/
|
|
90
|
+
function onKeyDown(e) {
|
|
91
|
+
if (e.metaKey || e.altKey || e.ctrlKey) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (isValidFocusTarget(scope.activeElement)) {
|
|
96
|
+
addFocusVisibleClass(scope.activeElement);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
hadKeyboardEvent = true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* If at any point a user clicks with a pointing device, ensure that we change the modality away from the keyboard.
|
|
104
|
+
* This avoids the situation where a user presses a key on an already focused element, and then clicks on a different
|
|
105
|
+
* element focusing it with a pointing device while we still think we're in keyboard modality.
|
|
106
|
+
*
|
|
107
|
+
* @param {Event} e
|
|
108
|
+
*/
|
|
109
|
+
function onPointerDown(e) {
|
|
110
|
+
hadKeyboardEvent = false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* On `focus`, add the `focus-visible` class to the target if: - the target received focus as a result of keyboard
|
|
115
|
+
* navigation or - the event target is an element that will likely require interaction via the keyboard (e.g., a text
|
|
116
|
+
* box).
|
|
117
|
+
*
|
|
118
|
+
* @param {Event} e
|
|
119
|
+
*/
|
|
120
|
+
function onFocus(e) {
|
|
121
|
+
// Prevent IE from focusing the document or HTML element.
|
|
122
|
+
if (!isValidFocusTarget(e.target)) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) {
|
|
127
|
+
addFocusVisibleClass(e.target);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* On `blur`, remove the `focus-visible` class from the target.
|
|
133
|
+
*
|
|
134
|
+
* @param {Event} e
|
|
135
|
+
*/
|
|
136
|
+
function onBlur(e) {
|
|
137
|
+
if (!isValidFocusTarget(e.target)) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (/** @type {Element} */ (e.target).hasAttribute('focus-visible')) {
|
|
142
|
+
// To detect a tab/window switch, we look for a blur event followed
|
|
143
|
+
// rapidly by a visibility change.
|
|
144
|
+
// If we don't see a visibility change within 100ms, it's probably a
|
|
145
|
+
// regular focus change.
|
|
146
|
+
hadFocusVisibleRecently = true;
|
|
147
|
+
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
|
148
|
+
hadFocusVisibleRecentlyTimeout = window.setTimeout(() => {
|
|
149
|
+
hadFocusVisibleRecently = false;
|
|
150
|
+
}, 100);
|
|
151
|
+
removeFocusVisibleClass(e.target);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Add a group of listeners to detect usage of any pointing devices. These listeners will be added when the polyfill
|
|
157
|
+
* first loads and anytime the window is blurred so that they are active when the window regains focus.
|
|
158
|
+
*/
|
|
159
|
+
function addInitialPointerMoveListeners() {
|
|
160
|
+
/* eslint-disable no-use-before-define */
|
|
161
|
+
document.addEventListener('mousemove', onInitialPointerMove);
|
|
162
|
+
document.addEventListener('mousedown', onInitialPointerMove);
|
|
163
|
+
document.addEventListener('mouseup', onInitialPointerMove);
|
|
164
|
+
document.addEventListener('pointermove', onInitialPointerMove);
|
|
165
|
+
document.addEventListener('pointerdown', onInitialPointerMove);
|
|
166
|
+
document.addEventListener('pointerup', onInitialPointerMove);
|
|
167
|
+
document.addEventListener('touchmove', onInitialPointerMove);
|
|
168
|
+
document.addEventListener('touchstart', onInitialPointerMove);
|
|
169
|
+
document.addEventListener('touchend', onInitialPointerMove);
|
|
170
|
+
/* eslint-enable no-use-before-define */
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function removeInitialPointerMoveListeners() {
|
|
174
|
+
/* eslint-disable no-use-before-define */
|
|
175
|
+
document.removeEventListener('mousemove', onInitialPointerMove);
|
|
176
|
+
document.removeEventListener('mousedown', onInitialPointerMove);
|
|
177
|
+
document.removeEventListener('mouseup', onInitialPointerMove);
|
|
178
|
+
document.removeEventListener('pointermove', onInitialPointerMove);
|
|
179
|
+
document.removeEventListener('pointerdown', onInitialPointerMove);
|
|
180
|
+
document.removeEventListener('pointerup', onInitialPointerMove);
|
|
181
|
+
document.removeEventListener('touchmove', onInitialPointerMove);
|
|
182
|
+
document.removeEventListener('touchstart', onInitialPointerMove);
|
|
183
|
+
document.removeEventListener('touchend', onInitialPointerMove);
|
|
184
|
+
/* eslint-enable no-use-before-define */
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* If the user changes tabs, keep track of whether or not the previously focused element had .focus-visible.
|
|
189
|
+
*
|
|
190
|
+
* @param {Event} e
|
|
191
|
+
*/
|
|
192
|
+
function onVisibilityChange(e) {
|
|
193
|
+
if (document.visibilityState === 'hidden') {
|
|
194
|
+
// If the tab becomes active again, the browser will handle calling focus
|
|
195
|
+
// on the element (Safari actually calls it twice).
|
|
196
|
+
// If this tab change caused a blur on an element with focus-visible,
|
|
197
|
+
// re-apply the class when the user switches back to the tab.
|
|
198
|
+
if (hadFocusVisibleRecently) {
|
|
199
|
+
hadKeyboardEvent = true;
|
|
200
|
+
}
|
|
201
|
+
addInitialPointerMoveListeners();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* When the polyfill first loads, assume the user is in keyboard modality. If any event is received from a pointing
|
|
207
|
+
* device (e.g., mouse, pointer, touch), turn off keyboard modality. This accounts for situations where focus enters
|
|
208
|
+
* the page from the URL bar.
|
|
209
|
+
*
|
|
210
|
+
* @param {Event} e
|
|
211
|
+
*/
|
|
212
|
+
function onInitialPointerMove(e) {
|
|
213
|
+
// Work around a Safari quirk that fires a mousemove on <html> whenever the
|
|
214
|
+
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯
|
|
215
|
+
if (
|
|
216
|
+
/** @type {Element} */ (e.target).nodeName &&
|
|
217
|
+
/** @type {Element} */ (e.target).nodeName.toLowerCase() === 'html'
|
|
218
|
+
) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
hadKeyboardEvent = false;
|
|
223
|
+
removeInitialPointerMoveListeners();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// We are interested in changes at the global scope only for some kinds of states.
|
|
227
|
+
// For example, global pointer input, global key presses, and global
|
|
228
|
+
// visibility change should affect the state at every scope:
|
|
229
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
230
|
+
document.addEventListener('mousedown', onPointerDown, true);
|
|
231
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
232
|
+
document.addEventListener('touchstart', onPointerDown, true);
|
|
233
|
+
document.addEventListener('visibilitychange', onVisibilityChange, true);
|
|
234
|
+
|
|
235
|
+
addInitialPointerMoveListeners();
|
|
236
|
+
|
|
237
|
+
// We specifically care about state changes in the local scope for focus and blur.
|
|
238
|
+
// This is because focus/blur events that originate from within a
|
|
239
|
+
// shadow root are not re-dispatched from the host element if it was already
|
|
240
|
+
// the active element in its own scope:
|
|
241
|
+
scope.addEventListener('focus', onFocus, true);
|
|
242
|
+
scope.addEventListener('blur', onBlur, true);
|
|
243
|
+
|
|
244
|
+
return () => {
|
|
245
|
+
removeInitialPointerMoveListeners();
|
|
246
|
+
|
|
247
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
248
|
+
document.removeEventListener('mousedown', onPointerDown, true);
|
|
249
|
+
document.removeEventListener('pointerdown', onPointerDown, true);
|
|
250
|
+
document.removeEventListener('touchstart', onPointerDown, true);
|
|
251
|
+
document.removeEventListener('visibilitychange', onVisibilityChange, true);
|
|
252
|
+
|
|
253
|
+
scope.removeEventListener('focus', onFocus, true);
|
|
254
|
+
scope.removeEventListener('blur', onBlur, true);
|
|
255
|
+
};
|
|
256
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function parseCropPreset(cropPreset: import(
|
|
1
|
+
export function parseCropPreset(cropPreset: import('../../../../types/exported.d.ts').ConfigType['cropPreset']): import("../types.js").CropAspectRatio[] | undefined;
|
|
2
2
|
//# sourceMappingURL=parseCropPreset.d.ts.map
|