@vonage/vivid 5.4.0 → 5.6.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/LICENSE.md +201 -0
- package/accordion/definition.cjs +5 -0
- package/accordion/definition.js +5 -0
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +14 -3
- package/alert/definition.cjs +4 -12
- package/alert/definition.js +5 -13
- package/alert/index.cjs +11 -11
- package/alert/index.js +33 -37
- package/audio-player/definition.cjs +4 -0
- package/audio-player/definition.js +4 -0
- package/audio-player/index.cjs +1 -1
- package/audio-player/index.js +8 -2
- package/banner/definition.cjs +2 -4
- package/banner/definition.js +2 -4
- package/banner/index.cjs +2 -2
- package/banner/index.js +1 -1
- package/breadcrumb/definition.cjs +1 -0
- package/breadcrumb/definition.js +1 -0
- package/breadcrumb/index.cjs +1 -1
- package/breadcrumb/index.js +1 -0
- package/bundled/affix.js +1 -1
- package/bundled/anchored.cjs +1 -1
- package/bundled/anchored.js +6 -6
- package/bundled/attribute-binding-behaviour.cjs +1 -1
- package/bundled/attribute-binding-behaviour.js +3 -1
- package/bundled/base-color-picker.cjs +18 -13
- package/bundled/base-color-picker.js +107 -84
- package/bundled/base-progress.cjs +1 -1
- package/bundled/base-progress.js +3 -0
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +14 -10
- package/bundled/calendar-picker.template.cjs +1 -1
- package/bundled/calendar-picker.template.js +4 -2
- package/bundled/char-count.cjs +1 -1
- package/bundled/char-count.js +1 -1
- package/bundled/definition10.cjs +7 -7
- package/bundled/definition10.js +29 -19
- package/bundled/definition11.cjs +12 -19
- package/bundled/definition11.js +73 -204
- package/bundled/definition12.cjs +19 -10
- package/bundled/definition12.js +218 -36
- package/bundled/definition13.cjs +10 -1
- package/bundled/definition13.js +38 -14
- package/bundled/definition14.cjs +1 -5
- package/bundled/definition14.js +15 -24
- package/bundled/definition15.cjs +5 -30
- package/bundled/definition15.js +22 -73
- package/bundled/definition16.cjs +30 -19
- package/bundled/definition16.js +74 -97
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +86 -117
- package/bundled/definition18.cjs +13 -12
- package/bundled/definition18.js +125 -71
- package/bundled/definition19.cjs +16 -16
- package/bundled/definition19.js +132 -94
- package/bundled/definition2.cjs +8 -9
- package/bundled/definition2.js +89 -142
- package/bundled/definition22.cjs +1 -1
- package/bundled/definition22.js +1 -0
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +2 -1
- package/bundled/definition5.cjs +1 -1
- package/bundled/definition5.js +9 -3
- package/bundled/definition6.cjs +1 -1
- package/bundled/definition6.js +1 -0
- package/bundled/definition7.cjs +1 -1
- package/bundled/definition7.js +7 -4
- package/bundled/definition8.cjs +1 -1
- package/bundled/definition8.js +1 -0
- package/bundled/definition9.cjs +6 -6
- package/bundled/definition9.js +545 -488
- package/bundled/delegates-aria.cjs +1 -1
- package/bundled/delegates-aria.js +3 -1
- package/bundled/form-associated.cjs +1 -1
- package/bundled/form-associated.js +11 -3
- package/bundled/host-semantics.js +4 -4
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +22 -4
- package/bundled/localized.cjs +1 -1
- package/bundled/localized.js +149 -66
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +11 -8
- package/bundled/picker-field.template.cjs +14 -14
- package/bundled/picker-field.template.js +36 -56
- package/bundled/scrollIntoView.cjs +1 -1
- package/bundled/scrollIntoView.js +4 -1
- package/bundled/text-field.cjs +1 -1
- package/bundled/text-field.js +1 -1
- package/bundled/time-selection-picker.template.cjs +12 -12
- package/bundled/time-selection-picker.template.js +16 -12
- package/bundled/trapped-focus.cjs +1 -0
- package/bundled/trapped-focus.js +26 -0
- package/bundled/vivid-element.cjs +4 -4
- package/bundled/vivid-element.js +529 -492
- package/calendar/definition.cjs +2 -0
- package/calendar/definition.js +2 -0
- package/calendar/index.cjs +13 -13
- package/calendar/index.js +174 -144
- package/checkbox/definition.cjs +1 -0
- package/checkbox/definition.js +1 -0
- package/color-picker/definition.cjs +213 -112
- package/color-picker/definition.js +213 -112
- package/color-picker/index.cjs +104 -75
- package/color-picker/index.js +417 -326
- package/combobox/definition.cjs +17 -6
- package/combobox/definition.js +17 -6
- package/combobox/index.cjs +14 -9
- package/combobox/index.js +54 -42
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +6976 -484
- package/data-grid/definition.cjs +105 -7
- package/data-grid/definition.js +105 -7
- package/data-grid/index.cjs +52 -38
- package/data-grid/index.js +313 -242
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +2 -2
- package/date-range-picker/definition.cjs +2 -0
- package/date-range-picker/definition.js +2 -0
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -3
- package/date-time-picker/index.cjs +1 -1
- package/date-time-picker/index.js +2 -2
- package/dial-pad/definition.cjs +148 -0
- package/dial-pad/definition.js +148 -0
- package/dial-pad/index.cjs +27 -20
- package/dial-pad/index.js +202 -101
- package/dialog/definition.cjs +1 -0
- package/dialog/definition.js +1 -0
- package/dialog/index.cjs +1 -1
- package/dialog/index.js +1 -0
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/fab/definition.cjs +1 -0
- package/fab/definition.js +1 -0
- package/fab/index.cjs +1 -1
- package/fab/index.js +1 -0
- package/file-picker/definition.cjs +7 -2
- package/file-picker/definition.js +7 -2
- package/file-picker/index.cjs +6 -6
- package/file-picker/index.js +82 -73
- package/icon/definition.cjs +66 -41
- package/icon/definition.js +67 -42
- package/index.cjs +21 -0
- package/index.js +1 -1
- package/lib/color-picker/color-picker.d.ts +390 -12
- package/lib/color-picker/locale.d.ts +4 -0
- package/lib/data-grid/locale.d.ts +5 -0
- package/lib/date-picker/date-picker.d.ts +38 -38
- package/lib/date-range-picker/date-range-picker.d.ts +20 -20
- package/lib/date-time-picker/date-time-picker.d.ts +40 -40
- package/lib/dial-pad/dial-pad.d.ts +1 -0
- package/lib/icon/icon.d.ts +1 -1
- package/lib/menu/menu.d.ts +4 -4
- package/lib/rich-text-editor/definition.d.ts +3 -2
- package/lib/rich-text-editor/locale.d.ts +29 -3
- package/lib/rich-text-editor/popover.d.ts +19 -0
- package/lib/rich-text-editor/rich-text-editor.d.ts +16 -45
- package/lib/rich-text-editor/rich-text-editor.template.d.ts +2 -2
- package/lib/rich-text-editor/rte/config.d.ts +18 -0
- package/lib/rich-text-editor/rte/document.d.ts +28 -0
- package/lib/rich-text-editor/rte/exports.d.ts +23 -0
- package/lib/rich-text-editor/rte/feature.d.ts +46 -0
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +33 -0
- package/lib/rich-text-editor/rte/features/internal/foreign-html.d.ts +11 -0
- package/lib/rich-text-editor/rte/features/internal/history.d.ts +10 -0
- package/lib/rich-text-editor/rte/features/internal/text-style.d.ts +18 -0
- package/lib/rich-text-editor/rte/html-parser.d.ts +24 -0
- package/lib/rich-text-editor/rte/html-serializer.d.ts +30 -0
- package/lib/rich-text-editor/rte/instance.d.ts +57 -0
- package/lib/rich-text-editor/rte/utils/default-textblock.d.ts +2 -0
- package/lib/rich-text-editor/rte/utils/impl.d.ts +1 -0
- package/lib/rich-text-editor/rte/utils/textblock-attrs.d.ts +29 -0
- package/lib/rich-text-editor/rte/utils/textblock-marks.d.ts +10 -0
- package/lib/rich-text-editor/rte/utils/ui.d.ts +109 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +6 -5
- package/lib/text-area/text-area.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +1 -1
- package/lib/time-picker/time-picker.d.ts +20 -20
- package/lib/toggletip/toggletip.d.ts +4 -4
- package/lib/tooltip/tooltip.d.ts +4 -4
- package/locales/de-DE.cjs +58 -7
- package/locales/de-DE.js +58 -7
- package/locales/en-GB.cjs +60 -9
- package/locales/en-GB.js +60 -9
- package/locales/en-US.cjs +60 -9
- package/locales/en-US.js +60 -9
- package/locales/ja-JP.cjs +59 -8
- package/locales/ja-JP.js +59 -8
- package/locales/zh-CN.cjs +58 -7
- package/locales/zh-CN.js +58 -7
- package/menu/definition.cjs +1 -0
- package/menu/definition.js +1 -0
- package/number-field/definition.cjs +5 -3
- package/number-field/definition.js +5 -3
- package/number-field/index.cjs +5 -3
- package/number-field/index.js +34 -32
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +76 -62
- package/pagination/definition.cjs +2 -0
- package/pagination/definition.js +2 -0
- package/pagination/index.cjs +1 -1
- package/pagination/index.js +2 -0
- package/progress-ring/index.cjs +1 -1
- package/progress-ring/index.js +1 -1
- package/radio/definition.cjs +4 -0
- package/radio/definition.js +4 -0
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +1 -1
- package/radio-group/index.js +1 -1
- package/range-slider/definition.cjs +2 -1
- package/range-slider/definition.js +2 -1
- package/range-slider/index.cjs +1 -1
- package/range-slider/index.js +3 -1
- package/rich-text-editor/definition.cjs +17942 -1074
- package/rich-text-editor/definition.js +17926 -1079
- package/rich-text-editor/index.cjs +29 -130
- package/rich-text-editor/index.js +5565 -2474
- package/searchable-select/definition.cjs +6 -2
- package/searchable-select/definition.js +6 -2
- package/searchable-select/index.cjs +1 -1
- package/searchable-select/index.js +14 -10
- package/select/definition.cjs +22 -4
- package/select/definition.js +22 -4
- package/selectable-box/index.cjs +1 -1
- package/selectable-box/index.js +1 -1
- package/shared/color-picker/base-color-picker.d.ts +2 -1
- package/shared/patterns/anchored.d.ts +8 -8
- package/shared/patterns/char-count/char-count.d.ts +1 -1
- package/shared/patterns/localized.d.ts +386 -0
- package/shared/picker-field/mixins/calendar-picker.d.ts +10 -10
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +10 -10
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +20 -20
- package/shared/picker-field/mixins/single-date-picker.d.ts +28 -28
- package/shared/picker-field/mixins/single-value-picker.d.ts +8 -8
- package/shared/picker-field/mixins/time-selection-picker.d.ts +20 -20
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +20 -20
- package/shared/utils/promise.d.ts +7 -0
- package/simple-color-picker/definition.cjs +11 -6
- package/simple-color-picker/definition.js +11 -6
- package/simple-color-picker/index.cjs +6 -6
- package/simple-color-picker/index.js +44 -39
- package/slider/definition.cjs +7 -1
- package/slider/definition.js +7 -1
- package/styles/core/all.css +5 -1
- package/styles/core/theme.css +5 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/switch/definition.cjs +1 -0
- package/switch/definition.js +1 -0
- package/switch/index.cjs +1 -1
- package/switch/index.js +1 -0
- package/tabs/definition.cjs +2 -0
- package/tabs/definition.js +2 -0
- package/tabs/index.cjs +1 -1
- package/tabs/index.js +2 -0
- package/tag/definition.cjs +34 -14
- package/tag/definition.js +34 -14
- package/tag/index.cjs +25 -12
- package/tag/index.js +64 -47
- package/tag-group/definition.cjs +1 -2
- package/tag-group/definition.js +1 -2
- package/tag-group/index.cjs +1 -1
- package/tag-group/index.js +11 -12
- package/text-area/definition.cjs +13 -7
- package/text-area/definition.js +13 -7
- package/text-area/index.cjs +6 -6
- package/text-area/index.js +20 -14
- package/text-field/definition.cjs +16 -6
- package/text-field/definition.js +16 -6
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +5 -1
- package/toggletip/definition.js +5 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +6 -3
- package/tooltip/definition.js +6 -3
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-view/definition.cjs +28 -6
- package/tree-view/definition.js +28 -6
- package/tree-view/index.cjs +1 -1
- package/tree-view/index.js +28 -6
- package/unbundled/_commonjsHelpers.cjs +0 -26
- package/unbundled/_commonjsHelpers.js +1 -26
- package/unbundled/attribute-binding-behaviour.cjs +1 -0
- package/unbundled/attribute-binding-behaviour.js +1 -0
- package/unbundled/base-color-picker.cjs +45 -21
- package/unbundled/base-color-picker.js +45 -21
- package/unbundled/base-progress.cjs +3 -0
- package/unbundled/base-progress.js +3 -0
- package/unbundled/button.cjs +14 -10
- package/unbundled/button.js +14 -10
- package/unbundled/calendar-picker.template.cjs +3 -1
- package/unbundled/calendar-picker.template.js +3 -1
- package/unbundled/definition.cjs +1 -0
- package/unbundled/definition.js +1 -0
- package/unbundled/definition2.cjs +4 -1
- package/unbundled/definition2.js +4 -1
- package/unbundled/definition3.cjs +1 -0
- package/unbundled/definition3.js +1 -0
- package/unbundled/definition4.cjs +1 -0
- package/unbundled/definition4.js +1 -0
- package/unbundled/definition5.cjs +3 -2
- package/unbundled/definition5.js +4 -3
- package/unbundled/delegates-aria.cjs +1 -0
- package/unbundled/delegates-aria.js +1 -0
- package/unbundled/form-associated.cjs +4 -0
- package/unbundled/form-associated.js +4 -0
- package/unbundled/listbox.cjs +16 -1
- package/unbundled/listbox.js +16 -1
- package/unbundled/localized.cjs +36 -0
- package/unbundled/localized.js +37 -2
- package/unbundled/mixins.cjs +2 -0
- package/unbundled/mixins.js +2 -0
- package/unbundled/picker-field.template.cjs +3 -35
- package/unbundled/picker-field.template.js +3 -34
- package/unbundled/scrollIntoView.cjs +1 -0
- package/unbundled/scrollIntoView.js +1 -0
- package/unbundled/text-field.cjs +1 -1
- package/unbundled/text-field.js +1 -1
- package/unbundled/time-selection-picker.template.cjs +5 -1
- package/unbundled/time-selection-picker.template.js +5 -1
- package/unbundled/trapped-focus.cjs +37 -0
- package/unbundled/trapped-focus.js +34 -0
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/definition.cjs +54 -44
- package/video-player/definition.js +50 -40
- package/video-player/index.cjs +28 -28
- package/video-player/index.js +1448 -1442
- package/visually-hidden/index.cjs +1 -1
- package/visually-hidden/index.js +1 -1
- package/vivid.api.json +6463 -6099
- package/bundled/_has.cjs +0 -1
- package/bundled/_has.js +0 -34
- package/lib/rich-text-editor/facades/prose-mirror-vivid.schema.d.ts +0 -4
- package/lib/rich-text-editor/facades/vivid-prose-mirror.facade.d.ts +0 -18
- package/lib/rich-text-editor/image-placeholder/definition.d.ts +0 -2
- package/lib/rich-text-editor/image-placeholder/image-placeholder.d.ts +0 -7
- package/lib/rich-text-editor/image-placeholder/image-placeholder.template.d.ts +0 -4
- package/lib/rich-text-editor/menubar/consts.d.ts +0 -18
- package/lib/rich-text-editor/menubar/definition.d.ts +0 -2
- package/lib/rich-text-editor/menubar/menubar.d.ts +0 -386
- package/lib/rich-text-editor/menubar/menubar.template.d.ts +0 -4
package/tooltip/definition.cjs
CHANGED
|
@@ -9,8 +9,6 @@ const anchored = require('../unbundled/anchored.cjs');
|
|
|
9
9
|
const fastWebUtilities = require('@microsoft/fast-web-utilities');
|
|
10
10
|
const index = require('../unbundled/index.cjs');
|
|
11
11
|
|
|
12
|
-
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);box-sizing:border-box;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size, 30ch)}";
|
|
13
|
-
|
|
14
12
|
var __defProp = Object.defineProperty;
|
|
15
13
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
16
14
|
var result = void 0 ;
|
|
@@ -33,7 +31,10 @@ class Tooltip extends anchored.Anchored(vividElement.VividElement) {
|
|
|
33
31
|
this.#updateAnchorExpanded();
|
|
34
32
|
};
|
|
35
33
|
this.#closeOnEscape = (e) => {
|
|
36
|
-
|
|
34
|
+
/* v8 ignore else -- @preserve */
|
|
35
|
+
if (e.key === "Escape") {
|
|
36
|
+
this.#hide();
|
|
37
|
+
}
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
connectedCallback() {
|
|
@@ -99,6 +100,8 @@ __decorateClass([
|
|
|
99
100
|
fastElement.attr({ mode: "boolean" })
|
|
100
101
|
], Tooltip.prototype, "open");
|
|
101
102
|
|
|
103
|
+
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);box-sizing:border-box;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size, 30ch)}";
|
|
104
|
+
|
|
102
105
|
const getClasses = ({ open }) => fastWebUtilities.classNames("control", ["open", Boolean(open)]);
|
|
103
106
|
const TooltipTemplate = (context) => {
|
|
104
107
|
const popupTag = context.tagFor(popup_definition.Popup);
|
package/tooltip/definition.js
CHANGED
|
@@ -5,8 +5,6 @@ import { A as Anchored, a as anchorSlotTemplateFactory } from '../unbundled/anch
|
|
|
5
5
|
import { classNames } from '@microsoft/fast-web-utilities';
|
|
6
6
|
import { h as handleEscapeKeyAndStopPropogation } from '../unbundled/index.js';
|
|
7
7
|
|
|
8
|
-
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);box-sizing:border-box;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size, 30ch)}";
|
|
9
|
-
|
|
10
8
|
var __defProp = Object.defineProperty;
|
|
11
9
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
10
|
var result = void 0 ;
|
|
@@ -29,7 +27,10 @@ class Tooltip extends Anchored(VividElement) {
|
|
|
29
27
|
this.#updateAnchorExpanded();
|
|
30
28
|
};
|
|
31
29
|
this.#closeOnEscape = (e) => {
|
|
32
|
-
|
|
30
|
+
/* v8 ignore else -- @preserve */
|
|
31
|
+
if (e.key === "Escape") {
|
|
32
|
+
this.#hide();
|
|
33
|
+
}
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
connectedCallback() {
|
|
@@ -95,6 +96,8 @@ __decorateClass([
|
|
|
95
96
|
attr({ mode: "boolean" })
|
|
96
97
|
], Tooltip.prototype, "open");
|
|
97
98
|
|
|
99
|
+
const styles = ":host :host{display:var(--_popup-display, inline)}:host :host([slotted-anchor]){--_popup-display: contents}.control{pointer-events:none}.tooltip{width:var(--tooltip-inline-size, auto);box-sizing:border-box;padding:8px 12px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-bold);max-inline-size:var(--tooltip-max-inline-size, 30ch)}";
|
|
100
|
+
|
|
98
101
|
const getClasses = ({ open }) => classNames("control", ["open", Boolean(open)]);
|
|
99
102
|
const TooltipTemplate = (context) => {
|
|
100
103
|
const popupTag = context.tagFor(Popup);
|
package/tooltip/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("../bundled/
|
|
1
|
+
"use strict";const i=require("../bundled/definition11.cjs");i.registerTooltip();
|
package/tooltip/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r } from "../bundled/
|
|
1
|
+
import { r } from "../bundled/definition11.js";
|
|
2
2
|
r();
|
package/tree-view/definition.cjs
CHANGED
|
@@ -53,11 +53,13 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
53
53
|
this.handleFocus = (e) => {
|
|
54
54
|
if (this.slottedTreeItems.length > 0) {
|
|
55
55
|
if (e.target === this) {
|
|
56
|
+
/* v8 ignore else -- @preserve */
|
|
56
57
|
if (this.currentFocused !== null) {
|
|
57
58
|
treeItem_definition.TreeItem.focusItem(this.currentFocused);
|
|
58
59
|
}
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
62
|
+
/* v8 ignore else -- @preserve */
|
|
61
63
|
if (this.contains(e.target)) {
|
|
62
64
|
this.setAttribute("tabindex", "-1");
|
|
63
65
|
this.currentFocused = e.target;
|
|
@@ -83,22 +85,29 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
83
85
|
if (this.slottedTreeItems.length < 1) {
|
|
84
86
|
return true;
|
|
85
87
|
}
|
|
88
|
+
/* v8 ignore else -- @preserve */
|
|
86
89
|
if (!e.defaultPrevented) {
|
|
87
90
|
const treeItems = this.getVisibleNodes();
|
|
88
91
|
switch (e.key) {
|
|
89
|
-
case fastWebUtilities.keyHome:
|
|
92
|
+
case fastWebUtilities.keyHome: {
|
|
93
|
+
/* v8 ignore else -- @preserve */
|
|
90
94
|
if (treeItems.length) {
|
|
91
95
|
treeItem_definition.TreeItem.focusItem(treeItems[0]);
|
|
92
96
|
}
|
|
93
97
|
return;
|
|
94
|
-
|
|
98
|
+
}
|
|
99
|
+
case fastWebUtilities.keyEnd: {
|
|
100
|
+
/* v8 ignore else -- @preserve */
|
|
95
101
|
if (treeItems.length) {
|
|
96
102
|
treeItem_definition.TreeItem.focusItem(treeItems[treeItems.length - 1]);
|
|
97
103
|
}
|
|
98
104
|
return;
|
|
99
|
-
|
|
105
|
+
}
|
|
106
|
+
case fastWebUtilities.keyArrowLeft: {
|
|
107
|
+
/* v8 ignore else -- @preserve */
|
|
100
108
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
101
109
|
const item = e.target;
|
|
110
|
+
/* v8 ignore else -- @preserve */
|
|
102
111
|
if (item instanceof treeItem_definition.TreeItem && item.childItemLength() > 0 && item.expanded) {
|
|
103
112
|
item.expanded = false;
|
|
104
113
|
} else if (item instanceof treeItem_definition.TreeItem && item.parentElement instanceof treeItem_definition.TreeItem) {
|
|
@@ -106,9 +115,12 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
106
115
|
}
|
|
107
116
|
}
|
|
108
117
|
return false;
|
|
109
|
-
|
|
118
|
+
}
|
|
119
|
+
case fastWebUtilities.keyArrowRight: {
|
|
120
|
+
/* v8 ignore else -- @preserve */
|
|
110
121
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
111
122
|
const item = e.target;
|
|
123
|
+
/* v8 ignore else -- @preserve */
|
|
112
124
|
if (item instanceof treeItem_definition.TreeItem && item.childItemLength() > 0 && !item.expanded) {
|
|
113
125
|
item.expanded = true;
|
|
114
126
|
} else if (item instanceof treeItem_definition.TreeItem && item.childItemLength() > 0) {
|
|
@@ -116,16 +128,21 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
116
128
|
}
|
|
117
129
|
}
|
|
118
130
|
return;
|
|
119
|
-
|
|
131
|
+
}
|
|
132
|
+
case fastWebUtilities.keyArrowDown: {
|
|
133
|
+
/* v8 ignore else -- @preserve */
|
|
120
134
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
121
135
|
this.focusNextNode(1, e.target);
|
|
122
136
|
}
|
|
123
137
|
return;
|
|
124
|
-
|
|
138
|
+
}
|
|
139
|
+
case fastWebUtilities.keyArrowUp: {
|
|
140
|
+
/* v8 ignore else -- @preserve */
|
|
125
141
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
126
142
|
this.focusNextNode(-1, e.target);
|
|
127
143
|
}
|
|
128
144
|
return;
|
|
145
|
+
}
|
|
129
146
|
case fastWebUtilities.keyEnter:
|
|
130
147
|
this.handleClick(e);
|
|
131
148
|
return;
|
|
@@ -140,11 +157,13 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
140
157
|
* @internal
|
|
141
158
|
*/
|
|
142
159
|
this.handleSelectedChange = (e) => {
|
|
160
|
+
/* v8 ignore else -- @preserve */
|
|
143
161
|
if (!e.defaultPrevented) {
|
|
144
162
|
if (!(e.target instanceof Element) || !treeItem_definition.isTreeItemElement(e.target)) {
|
|
145
163
|
return true;
|
|
146
164
|
}
|
|
147
165
|
const item = e.target;
|
|
166
|
+
/* v8 ignore else -- @preserve */
|
|
148
167
|
if (item.selected) {
|
|
149
168
|
if (this.currentSelected && this.currentSelected !== item) {
|
|
150
169
|
this.currentSelected.selected = false;
|
|
@@ -168,6 +187,7 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
168
187
|
this.nested = this.checkForNestedItems();
|
|
169
188
|
const treeItems = this.getVisibleNodes();
|
|
170
189
|
treeItems.forEach((node) => {
|
|
190
|
+
/* v8 ignore else -- @preserve */
|
|
171
191
|
if (treeItem_definition.isTreeItemElement(node)) {
|
|
172
192
|
node.nested = this.nested;
|
|
173
193
|
}
|
|
@@ -217,8 +237,10 @@ class TreeView extends hostSemantics.HostSemantics(vividElement.VividElement) {
|
|
|
217
237
|
*/
|
|
218
238
|
focusNextNode(delta, item) {
|
|
219
239
|
const visibleNodes = this.getVisibleNodes();
|
|
240
|
+
/* v8 ignore else -- @preserve */
|
|
220
241
|
if (visibleNodes) {
|
|
221
242
|
const focusItem = visibleNodes[visibleNodes.indexOf(item) + delta];
|
|
243
|
+
/* v8 ignore else -- @preserve */
|
|
222
244
|
if (fastWebUtilities.isHTMLElement(focusItem)) {
|
|
223
245
|
treeItem_definition.TreeItem.focusItem(focusItem);
|
|
224
246
|
}
|
package/tree-view/definition.js
CHANGED
|
@@ -49,11 +49,13 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
49
49
|
this.handleFocus = (e) => {
|
|
50
50
|
if (this.slottedTreeItems.length > 0) {
|
|
51
51
|
if (e.target === this) {
|
|
52
|
+
/* v8 ignore else -- @preserve */
|
|
52
53
|
if (this.currentFocused !== null) {
|
|
53
54
|
TreeItem.focusItem(this.currentFocused);
|
|
54
55
|
}
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
58
|
+
/* v8 ignore else -- @preserve */
|
|
57
59
|
if (this.contains(e.target)) {
|
|
58
60
|
this.setAttribute("tabindex", "-1");
|
|
59
61
|
this.currentFocused = e.target;
|
|
@@ -79,22 +81,29 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
79
81
|
if (this.slottedTreeItems.length < 1) {
|
|
80
82
|
return true;
|
|
81
83
|
}
|
|
84
|
+
/* v8 ignore else -- @preserve */
|
|
82
85
|
if (!e.defaultPrevented) {
|
|
83
86
|
const treeItems = this.getVisibleNodes();
|
|
84
87
|
switch (e.key) {
|
|
85
|
-
case keyHome:
|
|
88
|
+
case keyHome: {
|
|
89
|
+
/* v8 ignore else -- @preserve */
|
|
86
90
|
if (treeItems.length) {
|
|
87
91
|
TreeItem.focusItem(treeItems[0]);
|
|
88
92
|
}
|
|
89
93
|
return;
|
|
90
|
-
|
|
94
|
+
}
|
|
95
|
+
case keyEnd: {
|
|
96
|
+
/* v8 ignore else -- @preserve */
|
|
91
97
|
if (treeItems.length) {
|
|
92
98
|
TreeItem.focusItem(treeItems[treeItems.length - 1]);
|
|
93
99
|
}
|
|
94
100
|
return;
|
|
95
|
-
|
|
101
|
+
}
|
|
102
|
+
case keyArrowLeft: {
|
|
103
|
+
/* v8 ignore else -- @preserve */
|
|
96
104
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
97
105
|
const item = e.target;
|
|
106
|
+
/* v8 ignore else -- @preserve */
|
|
98
107
|
if (item instanceof TreeItem && item.childItemLength() > 0 && item.expanded) {
|
|
99
108
|
item.expanded = false;
|
|
100
109
|
} else if (item instanceof TreeItem && item.parentElement instanceof TreeItem) {
|
|
@@ -102,9 +111,12 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
102
111
|
}
|
|
103
112
|
}
|
|
104
113
|
return false;
|
|
105
|
-
|
|
114
|
+
}
|
|
115
|
+
case keyArrowRight: {
|
|
116
|
+
/* v8 ignore else -- @preserve */
|
|
106
117
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
107
118
|
const item = e.target;
|
|
119
|
+
/* v8 ignore else -- @preserve */
|
|
108
120
|
if (item instanceof TreeItem && item.childItemLength() > 0 && !item.expanded) {
|
|
109
121
|
item.expanded = true;
|
|
110
122
|
} else if (item instanceof TreeItem && item.childItemLength() > 0) {
|
|
@@ -112,16 +124,21 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
112
124
|
}
|
|
113
125
|
}
|
|
114
126
|
return;
|
|
115
|
-
|
|
127
|
+
}
|
|
128
|
+
case keyArrowDown: {
|
|
129
|
+
/* v8 ignore else -- @preserve */
|
|
116
130
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
117
131
|
this.focusNextNode(1, e.target);
|
|
118
132
|
}
|
|
119
133
|
return;
|
|
120
|
-
|
|
134
|
+
}
|
|
135
|
+
case keyArrowUp: {
|
|
136
|
+
/* v8 ignore else -- @preserve */
|
|
121
137
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
122
138
|
this.focusNextNode(-1, e.target);
|
|
123
139
|
}
|
|
124
140
|
return;
|
|
141
|
+
}
|
|
125
142
|
case keyEnter:
|
|
126
143
|
this.handleClick(e);
|
|
127
144
|
return;
|
|
@@ -136,11 +153,13 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
136
153
|
* @internal
|
|
137
154
|
*/
|
|
138
155
|
this.handleSelectedChange = (e) => {
|
|
156
|
+
/* v8 ignore else -- @preserve */
|
|
139
157
|
if (!e.defaultPrevented) {
|
|
140
158
|
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
141
159
|
return true;
|
|
142
160
|
}
|
|
143
161
|
const item = e.target;
|
|
162
|
+
/* v8 ignore else -- @preserve */
|
|
144
163
|
if (item.selected) {
|
|
145
164
|
if (this.currentSelected && this.currentSelected !== item) {
|
|
146
165
|
this.currentSelected.selected = false;
|
|
@@ -164,6 +183,7 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
164
183
|
this.nested = this.checkForNestedItems();
|
|
165
184
|
const treeItems = this.getVisibleNodes();
|
|
166
185
|
treeItems.forEach((node) => {
|
|
186
|
+
/* v8 ignore else -- @preserve */
|
|
167
187
|
if (isTreeItemElement(node)) {
|
|
168
188
|
node.nested = this.nested;
|
|
169
189
|
}
|
|
@@ -213,8 +233,10 @@ class TreeView extends HostSemantics(VividElement) {
|
|
|
213
233
|
*/
|
|
214
234
|
focusNextNode(delta, item) {
|
|
215
235
|
const visibleNodes = this.getVisibleNodes();
|
|
236
|
+
/* v8 ignore else -- @preserve */
|
|
216
237
|
if (visibleNodes) {
|
|
217
238
|
const focusItem = visibleNodes[visibleNodes.indexOf(item) + delta];
|
|
239
|
+
/* v8 ignore else -- @preserve */
|
|
218
240
|
if (isHTMLElement(focusItem)) {
|
|
219
241
|
TreeItem.focusItem(focusItem);
|
|
220
242
|
}
|
package/tree-view/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("../bundled/vivid-element.cjs"),n=require("../bundled/definition22.cjs"),m=require("../bundled/host-semantics.cjs"),c=require("../bundled/key-codes.cjs"),h=require("../bundled/dom.cjs"),f=require("../bundled/ref.cjs"),g=require("../bundled/slotted.cjs"),I=require("../bundled/class-names.cjs"),p=".control{position:relative;display:flex;flex-direction:column;gap:4px}";var b=Object.defineProperty,d=(r,e,t,s)=>{for(var i=void 0,a=r.length-1,u;a>=0;a--)(u=r[a])&&(i=u(e,t,i)||i);return i&&b(e,t,i),i};function T(r,e){return h.isHTMLElement(r)?Array.from(r.querySelectorAll(e)).filter(i=>{if(i.parentElement instanceof n.TreeItem){if(i.parentElement.expanded)return!0}else return!0;return!1}):[]}class o extends m.HostSemantics(l.VividElement){constructor(){super(...arguments),this.currentFocused=null,this.handleFocus=e=>{if(this.slottedTreeItems.length>0){if(e.target===this){this.currentFocused!==null&&n.TreeItem.focusItem(this.currentFocused);return}this.contains(e.target)&&(this.setAttribute("tabindex","-1"),this.currentFocused=e.target)}},this.handleBlur=e=>{e.target instanceof HTMLElement&&(e.relatedTarget===null||!this.contains(e.relatedTarget))&&this.setAttribute("tabindex","0")},this.handleKeyDown=e=>{if(this.slottedTreeItems.length<1)return!0
|
|
1
|
+
"use strict";const l=require("../bundled/vivid-element.cjs"),n=require("../bundled/definition22.cjs"),m=require("../bundled/host-semantics.cjs"),c=require("../bundled/key-codes.cjs"),h=require("../bundled/dom.cjs"),f=require("../bundled/ref.cjs"),g=require("../bundled/slotted.cjs"),I=require("../bundled/class-names.cjs"),p=".control{position:relative;display:flex;flex-direction:column;gap:4px}";var b=Object.defineProperty,d=(r,e,t,s)=>{for(var i=void 0,a=r.length-1,u;a>=0;a--)(u=r[a])&&(i=u(e,t,i)||i);return i&&b(e,t,i),i};function T(r,e){return h.isHTMLElement(r)?Array.from(r.querySelectorAll(e)).filter(i=>{if(i.parentElement instanceof n.TreeItem){if(i.parentElement.expanded)return!0}else return!0;return!1}):[]}class o extends m.HostSemantics(l.VividElement){constructor(){super(...arguments),this.currentFocused=null,this.handleFocus=e=>{if(this.slottedTreeItems.length>0){if(e.target===this){/* v8 ignore else -- @preserve */this.currentFocused!==null&&n.TreeItem.focusItem(this.currentFocused);return}/* v8 ignore else -- @preserve */this.contains(e.target)&&(this.setAttribute("tabindex","-1"),this.currentFocused=e.target)}},this.handleBlur=e=>{e.target instanceof HTMLElement&&(e.relatedTarget===null||!this.contains(e.relatedTarget))&&this.setAttribute("tabindex","0")},this.handleKeyDown=e=>{if(this.slottedTreeItems.length<1)return!0;/* v8 ignore else -- @preserve */if(!e.defaultPrevented){const t=this.getVisibleNodes();switch(e.key){case c.keyHome:{/* v8 ignore else -- @preserve */t.length&&n.TreeItem.focusItem(t[0]);return}case c.keyEnd:{/* v8 ignore else -- @preserve */t.length&&n.TreeItem.focusItem(t[t.length-1]);return}case c.keyArrowLeft:{/* v8 ignore else -- @preserve */if(e.target&&this.isFocusableElement(e.target)){const s=e.target;/* v8 ignore else -- @preserve */s instanceof n.TreeItem&&s.childItemLength()>0&&s.expanded?s.expanded=!1:s instanceof n.TreeItem&&s.parentElement instanceof n.TreeItem&&n.TreeItem.focusItem(s.parentElement)}return!1}case c.keyArrowRight:{/* v8 ignore else -- @preserve */if(e.target&&this.isFocusableElement(e.target)){const s=e.target;/* v8 ignore else -- @preserve */s instanceof n.TreeItem&&s.childItemLength()>0&&!s.expanded?s.expanded=!0:s instanceof n.TreeItem&&s.childItemLength()>0&&this.focusNextNode(1,e.target)}return}case c.keyArrowDown:{/* v8 ignore else -- @preserve */e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(1,e.target);return}case c.keyArrowUp:{/* v8 ignore else -- @preserve */e.target&&this.isFocusableElement(e.target)&&this.focusNextNode(-1,e.target);return}case c.keyEnter:this.handleClick(e);return}}return!0},this.handleSelectedChange=e=>{/* v8 ignore else -- @preserve */if(!e.defaultPrevented){if(!(e.target instanceof Element)||!n.isTreeItemElement(e.target))return!0;const t=e.target;/* v8 ignore else -- @preserve */t.selected?(this.currentSelected&&this.currentSelected!==t&&(this.currentSelected.selected=!1),this.currentSelected=t):!t.selected&&this.currentSelected===t&&(this.currentSelected=null);return}},this.setItems=()=>{const e=this.treeView.querySelector("[selected]");this.currentSelected=e,(this.currentFocused===null||!this.contains(this.currentFocused))&&(this.currentFocused=this.getValidFocusableItem()),this.nested=this.checkForNestedItems(),this.getVisibleNodes().forEach(s=>{/* v8 ignore else -- @preserve */n.isTreeItemElement(s)&&(s.nested=this.nested)})},this.isFocusableElement=e=>n.isTreeItemElement(e),this.isSelectedElement=e=>e.selected}slottedTreeItemsChanged(){this.$fastController.isConnected&&this.setItems()}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),l.Updates.enqueue(()=>{this.setItems()})}handleClick(e){if(!e.defaultPrevented){if(!(e.target instanceof Element)||!n.isTreeItemElement(e.target))return!0;const t=e.target;t.disabled||(t.selected=!t.selected);return}}focusNextNode(e,t){const s=this.getVisibleNodes();/* v8 ignore else -- @preserve */if(s){const i=s[s.indexOf(t)+e];/* v8 ignore else -- @preserve */h.isHTMLElement(i)&&n.TreeItem.focusItem(i)}}getValidFocusableItem(){const e=this.getVisibleNodes();let t=e.findIndex(this.isSelectedElement);return t===-1&&(t=e.findIndex(this.isFocusableElement)),t!==-1?e[t]:null}checkForNestedItems(){return this.slottedTreeItems.some(e=>n.isTreeItemElement(e)&&e.querySelector("[data-vvd-component='tree-item']"))}getVisibleNodes(){return T(this,"[data-vvd-component='tree-item']")}}d([l.attr({attribute:"render-collapsed-nodes"})],o.prototype,"renderCollapsedNodes");d([l.observable],o.prototype,"currentSelected");d([l.observable],o.prototype,"slottedTreeItems");const v=r=>I.classNames("control"),E=l.html` <template
|
|
2
2
|
${f.ref("treeView")}
|
|
3
3
|
${m.applyHostSemantics({role:"tree"})}
|
|
4
4
|
@keydown="${(r,e)=>r.handleKeyDown(e.event)}"
|
package/tree-view/index.js
CHANGED
|
@@ -28,9 +28,11 @@ class a extends y(h) {
|
|
|
28
28
|
super(...arguments), this.currentFocused = null, this.handleFocus = (e) => {
|
|
29
29
|
if (this.slottedTreeItems.length > 0) {
|
|
30
30
|
if (e.target === this) {
|
|
31
|
+
/* v8 ignore else -- @preserve */
|
|
31
32
|
this.currentFocused !== null && n.focusItem(this.currentFocused);
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
35
|
+
/* v8 ignore else -- @preserve */
|
|
34
36
|
this.contains(e.target) && (this.setAttribute("tabindex", "-1"), this.currentFocused = e.target);
|
|
35
37
|
}
|
|
36
38
|
}, this.handleBlur = (e) => {
|
|
@@ -38,33 +40,48 @@ class a extends y(h) {
|
|
|
38
40
|
}, this.handleKeyDown = (e) => {
|
|
39
41
|
if (this.slottedTreeItems.length < 1)
|
|
40
42
|
return !0;
|
|
43
|
+
/* v8 ignore else -- @preserve */
|
|
41
44
|
if (!e.defaultPrevented) {
|
|
42
45
|
const t = this.getVisibleNodes();
|
|
43
46
|
switch (e.key) {
|
|
44
|
-
case w:
|
|
47
|
+
case w: {
|
|
48
|
+
/* v8 ignore else -- @preserve */
|
|
45
49
|
t.length && n.focusItem(t[0]);
|
|
46
50
|
return;
|
|
47
|
-
|
|
51
|
+
}
|
|
52
|
+
case T: {
|
|
53
|
+
/* v8 ignore else -- @preserve */
|
|
48
54
|
t.length && n.focusItem(t[t.length - 1]);
|
|
49
55
|
return;
|
|
50
|
-
|
|
56
|
+
}
|
|
57
|
+
case S: {
|
|
58
|
+
/* v8 ignore else -- @preserve */
|
|
51
59
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
52
60
|
const s = e.target;
|
|
61
|
+
/* v8 ignore else -- @preserve */
|
|
53
62
|
s instanceof n && s.childItemLength() > 0 && s.expanded ? s.expanded = !1 : s instanceof n && s.parentElement instanceof n && n.focusItem(s.parentElement);
|
|
54
63
|
}
|
|
55
64
|
return !1;
|
|
56
|
-
|
|
65
|
+
}
|
|
66
|
+
case k: {
|
|
67
|
+
/* v8 ignore else -- @preserve */
|
|
57
68
|
if (e.target && this.isFocusableElement(e.target)) {
|
|
58
69
|
const s = e.target;
|
|
70
|
+
/* v8 ignore else -- @preserve */
|
|
59
71
|
s instanceof n && s.childItemLength() > 0 && !s.expanded ? s.expanded = !0 : s instanceof n && s.childItemLength() > 0 && this.focusNextNode(1, e.target);
|
|
60
72
|
}
|
|
61
73
|
return;
|
|
62
|
-
|
|
74
|
+
}
|
|
75
|
+
case N: {
|
|
76
|
+
/* v8 ignore else -- @preserve */
|
|
63
77
|
e.target && this.isFocusableElement(e.target) && this.focusNextNode(1, e.target);
|
|
64
78
|
return;
|
|
65
|
-
|
|
79
|
+
}
|
|
80
|
+
case F: {
|
|
81
|
+
/* v8 ignore else -- @preserve */
|
|
66
82
|
e.target && this.isFocusableElement(e.target) && this.focusNextNode(-1, e.target);
|
|
67
83
|
return;
|
|
84
|
+
}
|
|
68
85
|
case x:
|
|
69
86
|
this.handleClick(e);
|
|
70
87
|
return;
|
|
@@ -72,16 +89,19 @@ class a extends y(h) {
|
|
|
72
89
|
}
|
|
73
90
|
return !0;
|
|
74
91
|
}, this.handleSelectedChange = (e) => {
|
|
92
|
+
/* v8 ignore else -- @preserve */
|
|
75
93
|
if (!e.defaultPrevented) {
|
|
76
94
|
if (!(e.target instanceof Element) || !l(e.target))
|
|
77
95
|
return !0;
|
|
78
96
|
const t = e.target;
|
|
97
|
+
/* v8 ignore else -- @preserve */
|
|
79
98
|
t.selected ? (this.currentSelected && this.currentSelected !== t && (this.currentSelected.selected = !1), this.currentSelected = t) : !t.selected && this.currentSelected === t && (this.currentSelected = null);
|
|
80
99
|
return;
|
|
81
100
|
}
|
|
82
101
|
}, this.setItems = () => {
|
|
83
102
|
const e = this.treeView.querySelector("[selected]");
|
|
84
103
|
this.currentSelected = e, (this.currentFocused === null || !this.contains(this.currentFocused)) && (this.currentFocused = this.getValidFocusableItem()), this.nested = this.checkForNestedItems(), this.getVisibleNodes().forEach((s) => {
|
|
104
|
+
/* v8 ignore else -- @preserve */
|
|
85
105
|
l(s) && (s.nested = this.nested);
|
|
86
106
|
});
|
|
87
107
|
}, this.isFocusableElement = (e) => l(e), this.isSelectedElement = (e) => e.selected;
|
|
@@ -113,8 +133,10 @@ class a extends y(h) {
|
|
|
113
133
|
*/
|
|
114
134
|
focusNextNode(e, t) {
|
|
115
135
|
const s = this.getVisibleNodes();
|
|
136
|
+
/* v8 ignore else -- @preserve */
|
|
116
137
|
if (s) {
|
|
117
138
|
const i = s[s.indexOf(t) + e];
|
|
139
|
+
/* v8 ignore else -- @preserve */
|
|
118
140
|
f(i) && n.focusItem(i);
|
|
119
141
|
}
|
|
120
142
|
}
|
|
@@ -6,31 +6,5 @@ function getDefaultExportFromCjs (x) {
|
|
|
6
6
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function getAugmentedNamespace(n) {
|
|
10
|
-
if (n.__esModule) return n;
|
|
11
|
-
var f = n.default;
|
|
12
|
-
if (typeof f == "function") {
|
|
13
|
-
var a = function a () {
|
|
14
|
-
if (this instanceof a) {
|
|
15
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
16
|
-
}
|
|
17
|
-
return f.apply(this, arguments);
|
|
18
|
-
};
|
|
19
|
-
a.prototype = f.prototype;
|
|
20
|
-
} else a = {};
|
|
21
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
22
|
-
Object.keys(n).forEach(function (k) {
|
|
23
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
24
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return n[k];
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
return a;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
9
|
exports.commonjsGlobal = commonjsGlobal;
|
|
35
|
-
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
36
10
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -4,29 +4,4 @@ function getDefaultExportFromCjs (x) {
|
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
if (n.__esModule) return n;
|
|
9
|
-
var f = n.default;
|
|
10
|
-
if (typeof f == "function") {
|
|
11
|
-
var a = function a () {
|
|
12
|
-
if (this instanceof a) {
|
|
13
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
14
|
-
}
|
|
15
|
-
return f.apply(this, arguments);
|
|
16
|
-
};
|
|
17
|
-
a.prototype = f.prototype;
|
|
18
|
-
} else a = {};
|
|
19
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
20
|
-
Object.keys(n).forEach(function (k) {
|
|
21
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
22
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return n[k];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
return a;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export { getAugmentedNamespace as a, commonjsGlobal as c, getDefaultExportFromCjs as g };
|
|
7
|
+
export { commonjsGlobal as c, getDefaultExportFromCjs as g };
|
|
@@ -14,6 +14,7 @@ class AttributeBindingBehavior {
|
|
|
14
14
|
bind(controller) {
|
|
15
15
|
this.source = controller.source;
|
|
16
16
|
this.context = controller.context;
|
|
17
|
+
/* v8 ignore else -- @preserve */
|
|
17
18
|
if (!this.bindingObserver) {
|
|
18
19
|
this.bindingObserver = fastElement.Observable.binding(
|
|
19
20
|
this.binding.evaluate,
|
|
@@ -12,6 +12,7 @@ class AttributeBindingBehavior {
|
|
|
12
12
|
bind(controller) {
|
|
13
13
|
this.source = controller.source;
|
|
14
14
|
this.context = controller.context;
|
|
15
|
+
/* v8 ignore else -- @preserve */
|
|
15
16
|
if (!this.bindingObserver) {
|
|
16
17
|
this.bindingObserver = Observable.binding(
|
|
17
18
|
this.binding.evaluate,
|
|
@@ -66,14 +66,22 @@ const BaseColorPicker = (Base) => {
|
|
|
66
66
|
this.proxy = document.createElement("input");
|
|
67
67
|
this.open = false;
|
|
68
68
|
this.swatches = [];
|
|
69
|
-
/**
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
69
|
this._canvasColor = "";
|
|
73
70
|
}
|
|
74
71
|
connectedCallback() {
|
|
75
72
|
super.connectedCallback();
|
|
76
|
-
|
|
73
|
+
requestAnimationFrame(() => {
|
|
74
|
+
this._refreshCanvasColor();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
get _computedCanvasColor() {
|
|
81
|
+
if (!this._canvasColor) {
|
|
82
|
+
this._canvasColor = getCSSCustomProperty("--vvd-color-canvas", this);
|
|
83
|
+
}
|
|
84
|
+
return this._canvasColor;
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
79
87
|
* @internal
|
|
@@ -85,8 +93,10 @@ const BaseColorPicker = (Base) => {
|
|
|
85
93
|
* @internal
|
|
86
94
|
*/
|
|
87
95
|
_applyContrastClass(color, threshold = 3) {
|
|
88
|
-
if (!color
|
|
89
|
-
const
|
|
96
|
+
if (!color) return false;
|
|
97
|
+
const canvasColor = this._computedCanvasColor;
|
|
98
|
+
if (!canvasColor) return false;
|
|
99
|
+
const ratio = getContrastRatio(color, canvasColor);
|
|
90
100
|
return ratio < threshold;
|
|
91
101
|
}
|
|
92
102
|
/**
|
|
@@ -109,7 +119,8 @@ const BaseColorPicker = (Base) => {
|
|
|
109
119
|
}
|
|
110
120
|
/**
|
|
111
121
|
* @internal
|
|
112
|
-
|
|
122
|
+
* /
|
|
123
|
+
/* v8 ignore next -- @preserve */
|
|
113
124
|
_handleColorSaving() {
|
|
114
125
|
}
|
|
115
126
|
/**
|
|
@@ -147,21 +158,25 @@ const BaseColorPicker = (Base) => {
|
|
|
147
158
|
const currentCol = index % rowLength;
|
|
148
159
|
const totalRows = Math.ceil(totalCells / rowLength);
|
|
149
160
|
switch (event.key) {
|
|
150
|
-
case "ArrowRight":
|
|
161
|
+
case "ArrowRight": {
|
|
162
|
+
/* v8 ignore else -- @preserve */
|
|
151
163
|
if (currentCol < rowLength - 1 && index + 1 < totalCells) {
|
|
152
164
|
this._focusSwatchByIndex(index + 1);
|
|
153
165
|
}
|
|
154
166
|
return false;
|
|
167
|
+
}
|
|
155
168
|
case "ArrowLeft":
|
|
156
169
|
if (currentCol > 0) {
|
|
157
170
|
this._focusSwatchByIndex(index - 1);
|
|
158
171
|
}
|
|
159
172
|
return false;
|
|
160
|
-
case "ArrowDown":
|
|
173
|
+
case "ArrowDown": {
|
|
174
|
+
/* v8 ignore else -- @preserve */
|
|
161
175
|
if (currentRow < totalRows - 1 && index + rowLength < totalCells) {
|
|
162
176
|
this._focusSwatchByIndex(index + rowLength);
|
|
163
177
|
}
|
|
164
178
|
return false;
|
|
179
|
+
}
|
|
165
180
|
case "ArrowUp":
|
|
166
181
|
if (currentRow > 0) {
|
|
167
182
|
this._focusSwatchByIndex(index - rowLength);
|
|
@@ -173,6 +188,7 @@ const BaseColorPicker = (Base) => {
|
|
|
173
188
|
lastRowStart + currentCol,
|
|
174
189
|
totalCells - 1
|
|
175
190
|
);
|
|
191
|
+
/* v8 ignore else -- @preserve */
|
|
176
192
|
if (index !== targetIndex) {
|
|
177
193
|
this._focusSwatchByIndex(targetIndex);
|
|
178
194
|
}
|
|
@@ -235,33 +251,38 @@ const BaseColorPicker = (Base) => {
|
|
|
235
251
|
/**
|
|
236
252
|
* @internal
|
|
237
253
|
*/
|
|
238
|
-
_renderColorSwatch(iconTag) {
|
|
254
|
+
_renderColorSwatch(iconTag, tooltipTag) {
|
|
239
255
|
return fastElement.html`
|
|
240
|
-
|
|
241
|
-
|
|
256
|
+
<${tooltipTag} placement="top"
|
|
257
|
+
text="${(x) => x.label ?? x.value}"
|
|
258
|
+
exportparts="vvd-theme-alternate">
|
|
259
|
+
<button
|
|
260
|
+
slot="anchor"
|
|
261
|
+
class="swatch ${(x, c) => fastWebUtilities.classNames(
|
|
242
262
|
c.parent.value === x.value ? "selected" : "",
|
|
243
263
|
c.parent._applyContrastClass(x.value) ? "contrast" : ""
|
|
244
264
|
)}"
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
265
|
+
role="gridcell"
|
|
266
|
+
style="--swatch-color: ${(x) => x.value};"
|
|
267
|
+
tabindex="${(x, c) => c.index === 0 ? "0" : "-1"}"
|
|
268
|
+
aria-label="${(x, c) => c.parent.locale.baseColorPicker.colorSwatchLabel(
|
|
249
269
|
x.value,
|
|
250
270
|
x.label,
|
|
251
271
|
c.parent.value === x.value
|
|
252
272
|
)}"
|
|
253
|
-
|
|
254
|
-
|
|
273
|
+
@click="${(x, c) => c.parent._handleSwatchSelection(x.value)}"
|
|
274
|
+
@keydown="${(x, c) => c.parent._handleCellKeydown(
|
|
255
275
|
c.event,
|
|
256
276
|
x.value,
|
|
257
277
|
c.index
|
|
258
278
|
)}"
|
|
259
|
-
|
|
260
|
-
|
|
279
|
+
>
|
|
280
|
+
${fastElement.when(
|
|
261
281
|
(x, c) => c.parent.value === x.value,
|
|
262
282
|
fastElement.html`<${iconTag} size="-6" name="check-solid" aria-hidden="true"></${iconTag}>`
|
|
263
283
|
)}
|
|
264
|
-
|
|
284
|
+
</button>
|
|
285
|
+
</${tooltipTag}>
|
|
265
286
|
`;
|
|
266
287
|
}
|
|
267
288
|
}
|
|
@@ -271,6 +292,9 @@ const BaseColorPicker = (Base) => {
|
|
|
271
292
|
__decorateClass([
|
|
272
293
|
fastElement.observable
|
|
273
294
|
], BaseColorPickerElement.prototype, "swatches");
|
|
295
|
+
__decorateClass([
|
|
296
|
+
fastElement.observable
|
|
297
|
+
], BaseColorPickerElement.prototype, "_canvasColor");
|
|
274
298
|
return BaseColorPickerElement;
|
|
275
299
|
};
|
|
276
300
|
|