vira 22.2.2 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/define-vira-element.d.ts +22 -1
- package/dist/elements/define-vira-element.js +18 -1
- package/dist/elements/dropdown/dropdown-helpers.d.ts +26 -3
- package/dist/elements/dropdown/dropdown-helpers.js +26 -3
- package/dist/elements/dropdown/vira-dropdown-item.element.d.ts +17 -6
- package/dist/elements/dropdown/vira-dropdown-item.element.js +12 -6
- package/dist/elements/dropdown/vira-dropdown-options.element.d.ts +14 -3
- package/dist/elements/dropdown/vira-dropdown-options.element.js +18 -7
- package/dist/elements/dropdown/vira-dropdown.element.d.ts +20 -8
- package/dist/elements/dropdown/vira-dropdown.element.js +28 -16
- package/dist/elements/index.d.ts +10 -10
- package/dist/elements/index.js +10 -10
- package/dist/elements/shared-text-input-logic.d.ts +20 -0
- package/dist/elements/shared-text-input-logic.js +13 -3
- package/dist/elements/vira-button.element.d.ts +17 -5
- package/dist/elements/vira-button.element.js +27 -15
- package/dist/elements/vira-collapsible-wrapper.element.d.ts +9 -2
- package/dist/elements/vira-collapsible-wrapper.element.js +10 -3
- package/dist/elements/vira-icon.element.d.ts +10 -3
- package/dist/elements/vira-icon.element.js +9 -2
- package/dist/elements/vira-image.element.d.ts +7 -7
- package/dist/elements/vira-image.element.js +20 -17
- package/dist/elements/vira-input.element.d.ts +20 -7
- package/dist/elements/vira-input.element.js +32 -16
- package/dist/elements/vira-link.element.d.ts +10 -2
- package/dist/elements/vira-link.element.js +11 -3
- package/dist/icons/icon-color.test-helper.d.ts +6 -0
- package/dist/icons/icon-color.test-helper.js +9 -0
- package/dist/icons/icon-css-vars.d.ts +10 -3
- package/dist/icons/icon-css-vars.js +7 -0
- package/dist/icons/icon-svg.d.ts +17 -1
- package/dist/icons/icon-svg.js +13 -2
- package/dist/icons/icon-svgs/check-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/check-24.icon.js +9 -2
- package/dist/icons/icon-svgs/chevron-up-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/chevron-up-24.icon.js +9 -2
- package/dist/icons/icon-svgs/close-x-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/close-x-24.icon.js +9 -2
- package/dist/icons/icon-svgs/element-16.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/element-16.icon.js +9 -2
- package/dist/icons/icon-svgs/element-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/element-24.icon.js +9 -2
- package/dist/icons/icon-svgs/eye-closed-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/eye-closed-24.icon.js +9 -2
- package/dist/icons/icon-svgs/eye-open-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/eye-open-24.icon.js +9 -3
- package/dist/icons/icon-svgs/loader-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/loader-24.icon.js +9 -2
- package/dist/icons/icon-svgs/loader-animated-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/loader-animated-24.icon.js +10 -3
- package/dist/icons/icon-svgs/options-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/options-24.icon.js +10 -3
- package/dist/icons/icon-svgs/status-failure-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/status-failure-24.icon.js +9 -2
- package/dist/icons/icon-svgs/status-in-progress-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/status-in-progress-24.icon.js +9 -2
- package/dist/icons/icon-svgs/status-success-24.icon.d.ts +8 -1
- package/dist/icons/icon-svgs/status-success-24.icon.js +9 -2
- package/dist/icons/index.d.ts +33 -28
- package/dist/icons/index.js +33 -28
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/re-exports/colorjs-io.d.ts +12 -0
- package/dist/re-exports/colorjs-io.js +7 -0
- package/dist/re-exports/index.d.ts +1 -1
- package/dist/re-exports/index.js +1 -1
- package/dist/styles/border.d.ts +7 -1
- package/dist/styles/border.js +6 -0
- package/dist/styles/color.d.ts +12 -2
- package/dist/styles/color.js +12 -2
- package/dist/styles/disabled.d.ts +5 -0
- package/dist/styles/disabled.js +5 -0
- package/dist/styles/durations.d.ts +17 -7
- package/dist/styles/durations.js +14 -4
- package/dist/styles/focus.d.ts +12 -4
- package/dist/styles/focus.js +11 -3
- package/dist/styles/form-themes.d.ts +12 -6
- package/dist/styles/form-themes.js +7 -1
- package/dist/styles/index.d.ts +10 -10
- package/dist/styles/index.js +10 -10
- package/dist/styles/native-styles.d.ts +11 -0
- package/dist/styles/native-styles.js +11 -0
- package/dist/styles/scrollbar.d.ts +5 -0
- package/dist/styles/scrollbar.js +5 -0
- package/dist/styles/shadows.d.ts +5 -0
- package/dist/styles/shadows.js +5 -0
- package/dist/styles/user-select.d.ts +5 -0
- package/dist/styles/user-select.js +5 -0
- package/dist/util/index.d.ts +1 -1
- package/dist/util/index.js +1 -1
- package/dist/util/pop-up-manager.d.ts +61 -6
- package/dist/util/pop-up-manager.js +43 -33
- package/package.json +34 -30
- package/dist/elements/dropdown/dropdown.mock.d.ts +0 -13
- package/dist/elements/dropdown/dropdown.mock.js +0 -18
package/dist/styles/focus.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { addPx } from '@augment-vir/common';
|
|
2
2
|
import { css, unsafeCSS } from 'element-vir';
|
|
3
3
|
import { defineCssVars } from 'lit-css-vars';
|
|
4
|
-
import { viraBorders } from './border';
|
|
4
|
+
import { viraBorders } from './border.js';
|
|
5
|
+
/**
|
|
6
|
+
* CSS vars for Vira focus colors.
|
|
7
|
+
*
|
|
8
|
+
* @category CSS Vars
|
|
9
|
+
* @category Styles
|
|
10
|
+
*/
|
|
5
11
|
export const viraFocusCssVars = defineCssVars({
|
|
6
12
|
'vira-focus-outline-color': '#59b1ff',
|
|
7
13
|
'vira-focus-outline-border-radius': css `calc(${viraBorders['vira-form-input-radius'].value} + 4px)`,
|
|
@@ -9,8 +15,10 @@ export const viraFocusCssVars = defineCssVars({
|
|
|
9
15
|
/**
|
|
10
16
|
* Create styles that look like an outline for the given selector.
|
|
11
17
|
*
|
|
12
|
-
* It is recommended to use the pseudo
|
|
13
|
-
* clicking from creating focus styles in Chrome.
|
|
18
|
+
* It is recommended to use the pseudo selector chain ":focus:focus-visible:not(:active)" to
|
|
19
|
+
* preventing clicking an element from creating focus styles in Chrome.
|
|
20
|
+
*
|
|
21
|
+
* @category Styles
|
|
14
22
|
*/
|
|
15
23
|
export function createFocusStyles({ selector, elementBorderSize, outlineGap = 2, outlineWidth = 2, }) {
|
|
16
24
|
const outlineSpacing = unsafeCSS(addPx(outlineWidth + outlineGap + elementBorderSize));
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS vars for vira form elements.
|
|
3
|
+
*
|
|
4
|
+
* @category CSS Vars
|
|
5
|
+
* @category Styles
|
|
6
|
+
*/
|
|
1
7
|
export declare const viraFormCssVars: import("lit-css-vars").CssVarDefinitions<{
|
|
2
|
-
'vira-form-border-color':
|
|
3
|
-
'vira-form-background-color':
|
|
4
|
-
'vira-form-foreground-color':
|
|
5
|
-
'vira-form-focus-color': import("lit").CSSResult;
|
|
6
|
-
'vira-form-selection-hover-background-color':
|
|
7
|
-
'vira-form-selection-hover-foreground-color':
|
|
8
|
+
readonly 'vira-form-border-color': "#cccccc";
|
|
9
|
+
readonly 'vira-form-background-color': "white";
|
|
10
|
+
readonly 'vira-form-foreground-color': "black";
|
|
11
|
+
readonly 'vira-form-focus-color': import("lit").CSSResult;
|
|
12
|
+
readonly 'vira-form-selection-hover-background-color': "#d2eaff";
|
|
13
|
+
readonly 'vira-form-selection-hover-foreground-color': "black";
|
|
8
14
|
}>;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { defineCssVars } from 'lit-css-vars';
|
|
2
|
-
import { viraFocusCssVars } from './focus';
|
|
2
|
+
import { viraFocusCssVars } from './focus.js';
|
|
3
|
+
/**
|
|
4
|
+
* CSS vars for vira form elements.
|
|
5
|
+
*
|
|
6
|
+
* @category CSS Vars
|
|
7
|
+
* @category Styles
|
|
8
|
+
*/
|
|
3
9
|
export const viraFormCssVars = defineCssVars({
|
|
4
10
|
'vira-form-border-color': '#cccccc',
|
|
5
11
|
'vira-form-background-color': 'white',
|
package/dist/styles/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** This file is automatically updated by update-index-exports.ts */
|
|
2
|
-
export * from './border';
|
|
3
|
-
export * from './color';
|
|
4
|
-
export * from './disabled';
|
|
5
|
-
export * from './durations';
|
|
6
|
-
export * from './focus';
|
|
7
|
-
export * from './form-themes';
|
|
8
|
-
export * from './native-styles';
|
|
9
|
-
export * from './scrollbar';
|
|
10
|
-
export * from './shadows';
|
|
11
|
-
export * from './user-select';
|
|
2
|
+
export * from './border.js';
|
|
3
|
+
export * from './color.js';
|
|
4
|
+
export * from './disabled.js';
|
|
5
|
+
export * from './durations.js';
|
|
6
|
+
export * from './focus.js';
|
|
7
|
+
export * from './form-themes.js';
|
|
8
|
+
export * from './native-styles.js';
|
|
9
|
+
export * from './scrollbar.js';
|
|
10
|
+
export * from './shadows.js';
|
|
11
|
+
export * from './user-select.js';
|
package/dist/styles/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** This file is automatically updated by update-index-exports.ts */
|
|
2
|
-
export * from './border';
|
|
3
|
-
export * from './color';
|
|
4
|
-
export * from './disabled';
|
|
5
|
-
export * from './durations';
|
|
6
|
-
export * from './focus';
|
|
7
|
-
export * from './form-themes';
|
|
8
|
-
export * from './native-styles';
|
|
9
|
-
export * from './scrollbar';
|
|
10
|
-
export * from './shadows';
|
|
11
|
-
export * from './user-select';
|
|
2
|
+
export * from './border.js';
|
|
3
|
+
export * from './color.js';
|
|
4
|
+
export * from './disabled.js';
|
|
5
|
+
export * from './durations.js';
|
|
6
|
+
export * from './focus.js';
|
|
7
|
+
export * from './form-themes.js';
|
|
8
|
+
export * from './native-styles.js';
|
|
9
|
+
export * from './scrollbar.js';
|
|
10
|
+
export * from './shadows.js';
|
|
11
|
+
export * from './user-select.js';
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A chunk of CSS that succinctly removes all padding and margin from an element.
|
|
3
|
+
*
|
|
4
|
+
* @category Styles
|
|
5
|
+
*/
|
|
1
6
|
export declare const noNativeSpacing: import("element-vir").CSSResult;
|
|
7
|
+
/**
|
|
8
|
+
* A chunk of CSS that succinctly removes all default built-in form element styles. This is
|
|
9
|
+
* particularly useful for `<button>` elements.
|
|
10
|
+
*
|
|
11
|
+
* @category Styles
|
|
12
|
+
*/
|
|
2
13
|
export declare const noNativeFormStyles: import("element-vir").CSSResult;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import { css } from 'element-vir';
|
|
2
|
+
/**
|
|
3
|
+
* A chunk of CSS that succinctly removes all padding and margin from an element.
|
|
4
|
+
*
|
|
5
|
+
* @category Styles
|
|
6
|
+
*/
|
|
2
7
|
export const noNativeSpacing = css `
|
|
3
8
|
padding: 0;
|
|
4
9
|
margin: 0;
|
|
5
10
|
`;
|
|
11
|
+
/**
|
|
12
|
+
* A chunk of CSS that succinctly removes all default built-in form element styles. This is
|
|
13
|
+
* particularly useful for `<button>` elements.
|
|
14
|
+
*
|
|
15
|
+
* @category Styles
|
|
16
|
+
*/
|
|
6
17
|
export const noNativeFormStyles = css `
|
|
7
18
|
${noNativeSpacing};
|
|
8
19
|
cursor: unset;
|
package/dist/styles/scrollbar.js
CHANGED
package/dist/styles/shadows.d.ts
CHANGED
package/dist/styles/shadows.js
CHANGED
package/dist/util/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './pop-up-manager';
|
|
1
|
+
export * from './pop-up-manager.js';
|
package/dist/util/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './pop-up-manager';
|
|
1
|
+
export * from './pop-up-manager.js';
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { MaybePromise } from '@augment-vir/common';
|
|
2
2
|
import { Coords } from 'device-navigation';
|
|
3
3
|
import { ExtractEventByType, ExtractEventTypes, ListenOptions, RemoveListenerCallback } from 'typed-event-target';
|
|
4
|
+
/**
|
|
5
|
+
* A type used for representing a rectangle's position.
|
|
6
|
+
*
|
|
7
|
+
* @category Internal
|
|
8
|
+
*/
|
|
4
9
|
export type PositionRect = {
|
|
5
10
|
top: number;
|
|
6
11
|
left: number;
|
|
7
12
|
right: number;
|
|
8
13
|
bottom: number;
|
|
9
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* The default empty {@link PositionRect}, with all values set to 0.
|
|
17
|
+
*
|
|
18
|
+
* @category Internal
|
|
19
|
+
*/
|
|
10
20
|
export declare const emptyPositionRect: PositionRect;
|
|
21
|
+
/**
|
|
22
|
+
* Options for {@link PopUpManager}.
|
|
23
|
+
*
|
|
24
|
+
* @category Pop Up
|
|
25
|
+
*/
|
|
11
26
|
export type PopUpManagerOptions = {
|
|
12
27
|
/**
|
|
13
28
|
* The minimum number of pixels for allowing the pop-up to go downwards. If the downward
|
|
@@ -43,6 +58,11 @@ export type PopUpManagerOptions = {
|
|
|
43
58
|
*/
|
|
44
59
|
supportNavigation: boolean;
|
|
45
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Output type from {@link PopUpManager.showPopUp}
|
|
63
|
+
*
|
|
64
|
+
* @category Pop Up
|
|
65
|
+
*/
|
|
46
66
|
export type ShowPopUpResult = {
|
|
47
67
|
/**
|
|
48
68
|
* Indicates if the "pop up" should pop in the downwards direction or not. If not, it should pop
|
|
@@ -52,27 +72,53 @@ export type ShowPopUpResult = {
|
|
|
52
72
|
popDown: boolean;
|
|
53
73
|
positions: Record<'root' | 'container' | 'diff', PositionRect>;
|
|
54
74
|
};
|
|
55
|
-
declare const HidePopUpEvent_base: (new (eventInitDict?: EventInit
|
|
56
|
-
new (type: string, eventInitDict?: EventInit
|
|
75
|
+
declare const HidePopUpEvent_base: (new (eventInitDict?: EventInit) => import("typed-event-target").TypedEvent<"hide-pop-up">) & Pick<{
|
|
76
|
+
new (type: string, eventInitDict?: EventInit): Event;
|
|
57
77
|
prototype: Event;
|
|
58
78
|
readonly NONE: 0;
|
|
59
79
|
readonly CAPTURING_PHASE: 1;
|
|
60
80
|
readonly AT_TARGET: 2;
|
|
61
81
|
readonly BUBBLING_PHASE: 3;
|
|
62
|
-
}, "
|
|
82
|
+
}, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedEvent<"hide-pop-up">, "type">;
|
|
83
|
+
/**
|
|
84
|
+
* An event fired from {@link PopUpManager} when the pop up should be hidden.
|
|
85
|
+
*
|
|
86
|
+
* @category Pop Up
|
|
87
|
+
*/
|
|
63
88
|
export declare class HidePopUpEvent extends HidePopUpEvent_base {
|
|
64
89
|
}
|
|
65
|
-
declare const NavSelectEvent_base: (new (eventInitDict:
|
|
66
|
-
|
|
90
|
+
declare const NavSelectEvent_base: (new (eventInitDict: {
|
|
91
|
+
bubbles?: boolean;
|
|
92
|
+
cancelable?: boolean;
|
|
93
|
+
composed?: boolean;
|
|
94
|
+
detail: Coords;
|
|
95
|
+
}) => import("typed-event-target").TypedCustomEvent<Coords, "nav-select">) & Pick<{
|
|
96
|
+
new (type: string, eventInitDict?: EventInit): Event;
|
|
67
97
|
prototype: Event;
|
|
68
98
|
readonly NONE: 0;
|
|
69
99
|
readonly CAPTURING_PHASE: 1;
|
|
70
100
|
readonly AT_TARGET: 2;
|
|
71
101
|
readonly BUBBLING_PHASE: 3;
|
|
72
|
-
}, "
|
|
102
|
+
}, "prototype" | "NONE" | "CAPTURING_PHASE" | "AT_TARGET" | "BUBBLING_PHASE"> & Pick<import("typed-event-target").TypedCustomEvent<Coords, "nav-select">, "type">;
|
|
103
|
+
/**
|
|
104
|
+
* An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
|
|
105
|
+
* by the user.
|
|
106
|
+
*
|
|
107
|
+
* @category Pop Up
|
|
108
|
+
*/
|
|
73
109
|
export declare class NavSelectEvent extends NavSelectEvent_base {
|
|
74
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* All events that can be emitted by {@link PopUpManager}.
|
|
113
|
+
*
|
|
114
|
+
* @category Internal
|
|
115
|
+
*/
|
|
75
116
|
export type PopUpManagerEvents = HidePopUpEvent | NavSelectEvent;
|
|
117
|
+
/**
|
|
118
|
+
* A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
|
|
119
|
+
*
|
|
120
|
+
* @category Pop Up
|
|
121
|
+
*/
|
|
76
122
|
export declare class PopUpManager {
|
|
77
123
|
private listenTarget;
|
|
78
124
|
private options;
|
|
@@ -80,11 +126,20 @@ export declare class PopUpManager {
|
|
|
80
126
|
private lastRootElement;
|
|
81
127
|
constructor(options?: Partial<PopUpManagerOptions> | undefined);
|
|
82
128
|
private attachGlobalListeners;
|
|
129
|
+
/** Listen to events emitted from a {@link PopUpManager} instance. */
|
|
83
130
|
listen<const EventDefinition extends Readonly<{
|
|
84
131
|
type: ExtractEventTypes<PopUpManagerEvents>;
|
|
85
132
|
}>>(event: EventDefinition, listener: (event: ExtractEventByType<PopUpManagerEvents, EventDefinition['type']>) => MaybePromise<void>, options?: ListenOptions | undefined): RemoveListenerCallback;
|
|
133
|
+
/** Trigger removal or hiding of the pop up. */
|
|
86
134
|
removePopUp(): void;
|
|
135
|
+
/** Trigger showing the pop up. */
|
|
87
136
|
showPopUp(rootElement: HTMLElement, options?: Partial<PopUpManagerOptions> | undefined): ShowPopUpResult;
|
|
137
|
+
/**
|
|
138
|
+
* Cleanup and destroy the {@link PopUpManager} instance. This:
|
|
139
|
+
*
|
|
140
|
+
* - Removes the existing pop up
|
|
141
|
+
* - Cleans up all internal and external listeners
|
|
142
|
+
*/
|
|
88
143
|
destroy(): void;
|
|
89
144
|
}
|
|
90
145
|
export {};
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assert } from '@augment-vir/assert';
|
|
2
2
|
import { mapObjectValues } from '@augment-vir/common';
|
|
3
|
+
import { findOverflowAncestor } from '@augment-vir/web';
|
|
3
4
|
import { NavController, NavDirection } from 'device-navigation';
|
|
4
5
|
import { listenToPageActivation } from 'page-active';
|
|
5
|
-
import { assertInstanceOf } from 'run-time-assertions';
|
|
6
6
|
import { ListenTarget, defineTypedCustomEvent, defineTypedEvent, listenToGlobal, } from 'typed-event-target';
|
|
7
|
+
/**
|
|
8
|
+
* The default empty {@link PositionRect}, with all values set to 0.
|
|
9
|
+
*
|
|
10
|
+
* @category Internal
|
|
11
|
+
*/
|
|
7
12
|
export const emptyPositionRect = {
|
|
8
13
|
top: 0,
|
|
9
14
|
left: 0,
|
|
10
15
|
right: 0,
|
|
11
16
|
bottom: 0,
|
|
12
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* An event fired from {@link PopUpManager} when the pop up should be hidden.
|
|
20
|
+
*
|
|
21
|
+
* @category Pop Up
|
|
22
|
+
*/
|
|
13
23
|
export class HidePopUpEvent extends defineTypedEvent('hide-pop-up') {
|
|
14
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* An event fired from {@link PopUpManager} when an individual item in the pop up has been selected
|
|
27
|
+
* by the user.
|
|
28
|
+
*
|
|
29
|
+
* @category Pop Up
|
|
30
|
+
*/
|
|
15
31
|
export class NavSelectEvent extends defineTypedCustomEvent()('nav-select') {
|
|
16
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* A "pop up" manager for items that pop up from the HTML page, like dropdowns or menus.
|
|
35
|
+
*
|
|
36
|
+
* @category Pop Up
|
|
37
|
+
*/
|
|
17
38
|
export class PopUpManager {
|
|
39
|
+
listenTarget = new ListenTarget();
|
|
40
|
+
options = {
|
|
41
|
+
minDownSpace: 200,
|
|
42
|
+
verticalDiffThreshold: 20,
|
|
43
|
+
supportNavigation: true,
|
|
44
|
+
};
|
|
45
|
+
cleanupCallbacks = [];
|
|
46
|
+
lastRootElement;
|
|
18
47
|
constructor(options) {
|
|
19
|
-
Object.defineProperty(this, "listenTarget", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: new ListenTarget()
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "options", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: {
|
|
30
|
-
minDownSpace: 200,
|
|
31
|
-
verticalDiffThreshold: 20,
|
|
32
|
-
supportNavigation: true,
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(this, "cleanupCallbacks", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: []
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, "lastRootElement", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: void 0
|
|
46
|
-
});
|
|
47
48
|
this.options = { ...this.options, ...options };
|
|
48
49
|
}
|
|
49
50
|
attachGlobalListeners(rootElement) {
|
|
@@ -104,7 +105,7 @@ export class PopUpManager {
|
|
|
104
105
|
const currentlyFocused = navController.getCurrentlyFocused();
|
|
105
106
|
if (currentlyFocused) {
|
|
106
107
|
navController.enterInto();
|
|
107
|
-
this.listenTarget.dispatch(new NavSelectEvent({ detail: currentlyFocused.coords }));
|
|
108
|
+
this.listenTarget.dispatch(new NavSelectEvent({ detail: currentlyFocused.node.coords }));
|
|
108
109
|
event.stopImmediatePropagation();
|
|
109
110
|
event.preventDefault();
|
|
110
111
|
}
|
|
@@ -113,18 +114,21 @@ export class PopUpManager {
|
|
|
113
114
|
}),
|
|
114
115
|
];
|
|
115
116
|
}
|
|
117
|
+
/** Listen to events emitted from a {@link PopUpManager} instance. */
|
|
116
118
|
listen(event, listener, options) {
|
|
117
119
|
return this.listenTarget.listen(event, listener, options);
|
|
118
120
|
}
|
|
121
|
+
/** Trigger removal or hiding of the pop up. */
|
|
119
122
|
removePopUp() {
|
|
120
123
|
this.cleanupCallbacks.forEach((callback) => callback());
|
|
121
124
|
this.listenTarget.dispatch(new HidePopUpEvent());
|
|
122
125
|
}
|
|
126
|
+
/** Trigger showing the pop up. */
|
|
123
127
|
showPopUp(rootElement, options) {
|
|
124
128
|
this.lastRootElement = rootElement;
|
|
125
129
|
const currentOptions = { ...this.options, ...options };
|
|
126
|
-
const container =
|
|
127
|
-
|
|
130
|
+
const container = findOverflowAncestor(rootElement);
|
|
131
|
+
assert.instanceOf(container, HTMLElement);
|
|
128
132
|
const rootRect = rootElement.getBoundingClientRect();
|
|
129
133
|
const containerRect = container.getBoundingClientRect();
|
|
130
134
|
const containerScrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
@@ -162,6 +166,12 @@ export class PopUpManager {
|
|
|
162
166
|
},
|
|
163
167
|
};
|
|
164
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Cleanup and destroy the {@link PopUpManager} instance. This:
|
|
171
|
+
*
|
|
172
|
+
* - Removes the existing pop up
|
|
173
|
+
* - Cleans up all internal and external listeners
|
|
174
|
+
*/
|
|
165
175
|
destroy() {
|
|
166
176
|
this.removePopUp();
|
|
167
177
|
this.listenTarget.destroy();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -18,53 +18,57 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/electrovir/element-vir"
|
|
21
|
+
"url": "git+https://github.com/electrovir/element-vir.git"
|
|
22
22
|
},
|
|
23
23
|
"license": "(MIT or CC0 1.0)",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "electrovir",
|
|
26
26
|
"url": "https://github.com/electrovir"
|
|
27
27
|
},
|
|
28
|
+
"type": "module",
|
|
28
29
|
"main": "dist/index.js",
|
|
30
|
+
"module": "dist/index.js",
|
|
29
31
|
"types": "dist/index.d.ts",
|
|
30
32
|
"scripts": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
+
"build": "npm run docs",
|
|
34
|
+
"compile": "virmator compile",
|
|
35
|
+
"docs": "virmator docs",
|
|
36
|
+
"test": "virmator test web",
|
|
37
|
+
"test:docs": "virmator docs check"
|
|
33
38
|
},
|
|
34
39
|
"dependencies": {
|
|
35
|
-
"@augment-vir/
|
|
36
|
-
"@augment-vir/common": "^
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
40
|
+
"@augment-vir/assert": "^30.3.0",
|
|
41
|
+
"@augment-vir/common": "^30.3.0",
|
|
42
|
+
"@augment-vir/web": "^30.3.0",
|
|
43
|
+
"colorjs.io": "^0.5.2",
|
|
44
|
+
"date-vir": "^6.0.1",
|
|
45
|
+
"device-navigation": "^3.0.1",
|
|
46
|
+
"lit-css-vars": "^3.0.10",
|
|
47
|
+
"observavir": "^2.0.3",
|
|
42
48
|
"page-active": "^1.0.0",
|
|
43
|
-
"spa-router-vir": "^4.0.
|
|
44
|
-
"type-fest": "^4.
|
|
45
|
-
"typed-event-target": "^
|
|
49
|
+
"spa-router-vir": "^4.0.4",
|
|
50
|
+
"type-fest": "^4.26.1",
|
|
51
|
+
"typed-event-target": "^4.0.0"
|
|
46
52
|
},
|
|
47
53
|
"devDependencies": {
|
|
48
|
-
"@augment-vir/
|
|
49
|
-
"@augment-vir/node-js": "^28.0.0",
|
|
50
|
-
"@open-wc/testing": "^4.0.0",
|
|
51
|
-
"@types/chai": "^4.3.16",
|
|
52
|
-
"@types/mocha": "^10.0.6",
|
|
54
|
+
"@augment-vir/test": "^30.3.0",
|
|
53
55
|
"@web/dev-server-esbuild": "^1.0.2",
|
|
54
|
-
"@web/test-runner": "^0.
|
|
56
|
+
"@web/test-runner": "^0.19.0",
|
|
55
57
|
"@web/test-runner-commands": "^0.9.0",
|
|
56
58
|
"@web/test-runner-playwright": "^0.11.0",
|
|
57
|
-
"@web/test-runner-visual-regression": "^0.
|
|
58
|
-
"esbuild": "^0.
|
|
59
|
-
"istanbul-smart-text-reporter": "^1.1.
|
|
60
|
-
"markdown-code-example-inserter": "^
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"vite": "^
|
|
65
|
-
"vite-tsconfig-paths": "^4.3.2"
|
|
59
|
+
"@web/test-runner-visual-regression": "^0.10.0",
|
|
60
|
+
"esbuild": "^0.24.0",
|
|
61
|
+
"istanbul-smart-text-reporter": "^1.1.5",
|
|
62
|
+
"markdown-code-example-inserter": "^3.0.0",
|
|
63
|
+
"typedoc": "^0.26.10",
|
|
64
|
+
"typescript": "5.6.3",
|
|
65
|
+
"vite": "^5.4.10",
|
|
66
|
+
"vite-tsconfig-paths": "^5.0.1"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"element-vir": "
|
|
69
|
+
"element-vir": "^23.0.0"
|
|
70
|
+
},
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=22"
|
|
69
73
|
}
|
|
70
74
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const mockOptions: readonly [{
|
|
2
|
-
readonly label: "Option 0";
|
|
3
|
-
readonly id: 0;
|
|
4
|
-
}, {
|
|
5
|
-
readonly label: "Option 1";
|
|
6
|
-
readonly id: 1;
|
|
7
|
-
}, {
|
|
8
|
-
readonly label: "Option 2";
|
|
9
|
-
readonly id: 2;
|
|
10
|
-
}, {
|
|
11
|
-
readonly label: "Option 3";
|
|
12
|
-
readonly id: 3;
|
|
13
|
-
}];
|