@xleddyl/443-components-vue 0.16.89 → 0.16.91
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/CATALOG.md +20 -19
- package/README.md +35 -5
- package/dist/components/core/Input.vue +1 -1
- package/dist/components/core/Input.vue.d.ts +1 -0
- package/dist/components/core/Textarea.vue +1 -1
- package/dist/components/core/Textarea.vue.d.ts +1 -0
- package/dist/components/data/Tree.vue +10 -18
- package/dist/components/data/Tree.vue.d.ts +2 -0
- package/dist/components/forms/Checkbox.vue +1 -1
- package/dist/components/forms/CheckboxGroup.vue +1 -1
- package/dist/components/forms/ColorInput.vue +1 -1
- package/dist/components/forms/ColorInput.vue.d.ts +1 -0
- package/dist/components/forms/Combobox.vue +1 -1
- package/dist/components/forms/DateInput.vue +1 -1
- package/dist/components/forms/DateInput.vue.d.ts +1 -0
- package/dist/components/forms/DatePicker.vue +1 -1
- package/dist/components/forms/DatePicker.vue.d.ts +1 -0
- package/dist/components/forms/FileInput.vue +1 -1
- package/dist/components/forms/FileInput.vue.d.ts +1 -0
- package/dist/components/forms/NumberInput.vue +1 -1
- package/dist/components/forms/NumberInput.vue.d.ts +1 -0
- package/dist/components/forms/PaletteSelect.vue +1 -1
- package/dist/components/forms/PaletteSelect.vue.d.ts +1 -0
- package/dist/components/forms/PasswordInput.vue +1 -1
- package/dist/components/forms/PasswordInput.vue.d.ts +1 -0
- package/dist/components/forms/PinInput.vue +1 -1
- package/dist/components/forms/PinInput.vue.d.ts +1 -0
- package/dist/components/forms/RadioGroup.vue +1 -1
- package/dist/components/forms/SegmentedControl.vue +1 -1
- package/dist/components/forms/Select.vue +1 -1
- package/dist/components/forms/Slider.vue +1 -1
- package/dist/components/forms/Slider.vue.d.ts +1 -0
- package/dist/components/forms/Switch.vue +1 -1
- package/dist/components/forms/Switch.vue.d.ts +1 -0
- package/dist/components/forms/TimeInput.vue +1 -1
- package/dist/components/forms/TimeInput.vue.d.ts +1 -0
- package/dist/components/forms/TreeSelect.vue +1 -1
- package/dist/components/forms/TreeSelect.vue.d.ts +1 -0
- package/dist/components/overlays/CommandList.vue +423 -0
- package/dist/components/overlays/CommandList.vue.d.ts +255 -0
- package/dist/components/overlays/CommandPalette.vue +48 -315
- package/dist/components/overlays/CommandPalette.vue.d.ts +2 -1
- package/dist/components/overlays/Popover.vue +24 -5
- package/dist/components/overlays/Popover.vue.d.ts +4 -1
- package/dist/components/overlays/index.d.ts +1 -0
- package/dist/components/overlays/index.mjs +1 -0
- package/dist/components/overlays/types.d.ts +1 -0
- package/dist/composables/useField.mjs +1 -1
- package/dist/editor/RichTextEditor.vue +1 -1
- package/dist/editor/RichTextEditor.vue.d.ts +1 -0
- package/dist/editor/TemplateEditor.vue +1 -1
- package/dist/editor/TemplateEditor.vue.d.ts +1 -0
- package/dist/internal/core/DivElement.d.ts +2 -0
- package/dist/internal/core/DivElement.mjs +8 -0
- package/dist/internal/floating/layer.d.ts +1 -0
- package/dist/internal/floating/layer.mjs +56 -7
- package/dist/internal/floating/position.d.ts +2 -0
- package/dist/internal/floating/position.mjs +25 -0
- package/dist/internal/overlays/HintTooltip.vue +10 -2
- package/dist/internal/overlays/HintTooltip.vue.d.ts +2 -0
- package/dist/styles/data/tree.css +29 -5
- package/dist/styles/overlays/command.css +22 -0
- package/dist/styles/overlays/floating.css +1 -0
- package/package.json +1 -1
|
@@ -3,8 +3,10 @@ import { activeElement, isFocusLost } from "../core/focus.mjs";
|
|
|
3
3
|
import {
|
|
4
4
|
ANCHOR_STYLE_PROPERTIES,
|
|
5
5
|
addAnchorName,
|
|
6
|
+
anchorRect,
|
|
6
7
|
anchorStyles,
|
|
7
8
|
computePosition,
|
|
9
|
+
isElementTarget,
|
|
8
10
|
measuredSide,
|
|
9
11
|
parsePlacement,
|
|
10
12
|
removeAnchorName
|
|
@@ -26,10 +28,15 @@ export function useFloatingLayer(options) {
|
|
|
26
28
|
let cleanupPositioning = null;
|
|
27
29
|
let removeFallbackListeners = null;
|
|
28
30
|
let returnTarget = null;
|
|
31
|
+
let removeForeignListeners = null;
|
|
29
32
|
function anchorElement() {
|
|
30
33
|
const anchor = options.anchor();
|
|
31
34
|
return anchor instanceof Element ? anchor : null;
|
|
32
35
|
}
|
|
36
|
+
function foreignAnchor() {
|
|
37
|
+
const anchor = options.anchor();
|
|
38
|
+
return isElementTarget(anchor) && anchor.ownerDocument !== document ? anchor : null;
|
|
39
|
+
}
|
|
33
40
|
function clearInlinePosition(element) {
|
|
34
41
|
for (const property of ANCHOR_STYLE_PROPERTIES) element.style.removeProperty(property);
|
|
35
42
|
element.style.removeProperty("--k-arrow-offset");
|
|
@@ -38,10 +45,11 @@ export function useFloatingLayer(options) {
|
|
|
38
45
|
const element = options.floating.value;
|
|
39
46
|
const anchor = options.anchor();
|
|
40
47
|
if (!element || !anchor) return;
|
|
41
|
-
|
|
48
|
+
const rect = anchorRect(anchor);
|
|
49
|
+
if (options.matchWidth) element.style.minWidth = `${rect.width}px`;
|
|
42
50
|
if (!element.offsetWidth) return;
|
|
43
51
|
const position = computePosition(
|
|
44
|
-
|
|
52
|
+
rect,
|
|
45
53
|
{ width: element.offsetWidth, height: element.offsetHeight },
|
|
46
54
|
options.placement(),
|
|
47
55
|
options.offset(),
|
|
@@ -94,23 +102,58 @@ export function useFloatingLayer(options) {
|
|
|
94
102
|
const observer = new ResizeObserver(applyManualPosition);
|
|
95
103
|
observer.observe(element);
|
|
96
104
|
if (target) observer.observe(target);
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
const views = [window, foreignAnchor()?.ownerDocument.defaultView].filter(
|
|
106
|
+
(view) => Boolean(view)
|
|
107
|
+
);
|
|
108
|
+
for (const view of views) {
|
|
109
|
+
view.addEventListener("scroll", schedule, { capture: true, passive: true });
|
|
110
|
+
view.addEventListener("resize", schedule, { passive: true });
|
|
111
|
+
}
|
|
99
112
|
cleanupPositioning = () => {
|
|
100
113
|
cancelAnimationFrame(frame);
|
|
101
114
|
observer.disconnect();
|
|
102
|
-
|
|
103
|
-
|
|
115
|
+
for (const view of views) {
|
|
116
|
+
view.removeEventListener("scroll", schedule, { capture: true });
|
|
117
|
+
view.removeEventListener("resize", schedule);
|
|
118
|
+
}
|
|
104
119
|
clearInlinePosition(element);
|
|
105
120
|
};
|
|
106
121
|
}
|
|
122
|
+
function addForeignListeners() {
|
|
123
|
+
removeForeignListeners?.();
|
|
124
|
+
removeForeignListeners = null;
|
|
125
|
+
const anchor = foreignAnchor();
|
|
126
|
+
if (options.mode !== "auto" || !anchor) return;
|
|
127
|
+
const owner = anchor.ownerDocument;
|
|
128
|
+
const onPointerDown = (event) => {
|
|
129
|
+
if (!anchor.contains(event.target)) hide();
|
|
130
|
+
};
|
|
131
|
+
const onKeyDown = (event) => {
|
|
132
|
+
if (event.key === "Escape" && !event.defaultPrevented) hide();
|
|
133
|
+
};
|
|
134
|
+
owner.addEventListener("pointerdown", onPointerDown, true);
|
|
135
|
+
owner.addEventListener("keydown", onKeyDown);
|
|
136
|
+
removeForeignListeners = () => {
|
|
137
|
+
owner.removeEventListener("pointerdown", onPointerDown, true);
|
|
138
|
+
owner.removeEventListener("keydown", onKeyDown);
|
|
139
|
+
};
|
|
140
|
+
}
|
|
107
141
|
function opening() {
|
|
108
142
|
if (isOpen.value) return;
|
|
109
143
|
isOpen.value = true;
|
|
110
144
|
returnTarget = activeElement();
|
|
111
145
|
startPositioning();
|
|
146
|
+
addForeignListeners();
|
|
112
147
|
options.onBeforeOpen?.();
|
|
113
148
|
}
|
|
149
|
+
function focusPreferred(element) {
|
|
150
|
+
const target = options.focusTarget?.();
|
|
151
|
+
if (!isElementTarget(target) || !target.isConnected || element.contains(target)) return false;
|
|
152
|
+
const focusable = target;
|
|
153
|
+
if (typeof focusable.focus !== "function" || !focusable.getClientRects().length) return false;
|
|
154
|
+
focusable.focus({ preventScroll: true });
|
|
155
|
+
return focusable.ownerDocument.activeElement === focusable;
|
|
156
|
+
}
|
|
114
157
|
function opened() {
|
|
115
158
|
options.onOpen?.();
|
|
116
159
|
}
|
|
@@ -118,6 +161,7 @@ export function useFloatingLayer(options) {
|
|
|
118
161
|
const element = options.floating.value;
|
|
119
162
|
if (!element || options.returnFocus?.() === false) return;
|
|
120
163
|
if (!isFocusLost(element)) return;
|
|
164
|
+
if (focusPreferred(element)) return;
|
|
121
165
|
const fallback = anchorElement();
|
|
122
166
|
const target = returnTarget && returnTarget.isConnected && !element.contains(returnTarget) ? returnTarget : fallback;
|
|
123
167
|
if (target instanceof HTMLElement) target.focus({ preventScroll: true });
|
|
@@ -126,6 +170,8 @@ export function useFloatingLayer(options) {
|
|
|
126
170
|
if (!isOpen.value) return;
|
|
127
171
|
isOpen.value = false;
|
|
128
172
|
returnTarget = null;
|
|
173
|
+
removeForeignListeners?.();
|
|
174
|
+
removeForeignListeners = null;
|
|
129
175
|
const element = options.floating.value;
|
|
130
176
|
waitForAnimations(element).then(() => {
|
|
131
177
|
if (!isOpen.value) stopPositioning();
|
|
@@ -209,7 +255,9 @@ export function useFloatingLayer(options) {
|
|
|
209
255
|
else show(source);
|
|
210
256
|
}
|
|
211
257
|
function reposition() {
|
|
212
|
-
if (isOpen.value)
|
|
258
|
+
if (!isOpen.value) return;
|
|
259
|
+
startPositioning();
|
|
260
|
+
addForeignListeners();
|
|
213
261
|
}
|
|
214
262
|
let listening = null;
|
|
215
263
|
onMounted(() => {
|
|
@@ -224,6 +272,7 @@ export function useFloatingLayer(options) {
|
|
|
224
272
|
listening?.removeEventListener("beforetoggle", onBeforeToggle);
|
|
225
273
|
listening?.removeEventListener("toggle", onToggle);
|
|
226
274
|
removeFallbackListeners?.();
|
|
275
|
+
removeForeignListeners?.();
|
|
227
276
|
stopPositioning();
|
|
228
277
|
});
|
|
229
278
|
return {
|
|
@@ -5,6 +5,8 @@ export interface VirtualAnchor {
|
|
|
5
5
|
getBoundingClientRect(): DOMRect;
|
|
6
6
|
}
|
|
7
7
|
export type AnchorTarget = Element | VirtualAnchor;
|
|
8
|
+
export declare function isElementTarget(anchor: AnchorTarget | null | undefined): anchor is Element;
|
|
9
|
+
export declare function anchorRect(anchor: AnchorTarget): DOMRect;
|
|
8
10
|
export interface ComputedPosition {
|
|
9
11
|
x: number;
|
|
10
12
|
y: number;
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
export function isElementTarget(anchor) {
|
|
2
|
+
return Boolean(anchor && anchor.nodeType === 1);
|
|
3
|
+
}
|
|
4
|
+
function frameOf(view) {
|
|
5
|
+
try {
|
|
6
|
+
return view?.frameElement ?? null;
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function anchorRect(anchor) {
|
|
12
|
+
const rect = anchor.getBoundingClientRect();
|
|
13
|
+
let x = rect.x;
|
|
14
|
+
let y = rect.y;
|
|
15
|
+
let view = isElementTarget(anchor) ? anchor.ownerDocument.defaultView : null;
|
|
16
|
+
while (view && view !== window) {
|
|
17
|
+
const frame = frameOf(view);
|
|
18
|
+
if (!frame) break;
|
|
19
|
+
const box = frame.getBoundingClientRect();
|
|
20
|
+
x += box.left + frame.clientLeft;
|
|
21
|
+
y += box.top + frame.clientTop;
|
|
22
|
+
view = frame.ownerDocument.defaultView;
|
|
23
|
+
}
|
|
24
|
+
return new DOMRect(x, y, rect.width, rect.height);
|
|
25
|
+
}
|
|
1
26
|
const VIEWPORT_PADDING = 8;
|
|
2
27
|
const ARROW_PADDING = 12;
|
|
3
28
|
const OPPOSITE = { top: "bottom", bottom: "top", left: "right", right: "left" };
|
|
@@ -20,7 +20,8 @@ const props = defineProps({
|
|
|
20
20
|
text: { type: String, required: true },
|
|
21
21
|
placement: { type: null, required: false, default: "top" },
|
|
22
22
|
openDelay: { type: Number, required: false, default: 500 },
|
|
23
|
-
closeDelay: { type: Number, required: false, default: 80 }
|
|
23
|
+
closeDelay: { type: Number, required: false, default: 80 },
|
|
24
|
+
active: { type: Boolean, required: false }
|
|
24
25
|
});
|
|
25
26
|
const floatingRef = useTemplateRef("floatingRef");
|
|
26
27
|
const trigger = shallowRef(null);
|
|
@@ -53,9 +54,16 @@ function matches(element, selector) {
|
|
|
53
54
|
onMounted(() => {
|
|
54
55
|
const element = floatingRef.value?.parentElement ?? null;
|
|
55
56
|
trigger.value = element;
|
|
56
|
-
if (element && (matches(element, ":hover") || matches(element, ":focus-visible")))
|
|
57
|
+
if (element && (props.active || matches(element, ":hover") || matches(element, ":focus-visible")))
|
|
57
58
|
hover.scheduleOpen();
|
|
58
59
|
});
|
|
60
|
+
watch(
|
|
61
|
+
() => props.active,
|
|
62
|
+
(active) => {
|
|
63
|
+
if (active) hover.scheduleOpen();
|
|
64
|
+
else hover.scheduleClose(true);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
59
67
|
watch(
|
|
60
68
|
() => props.text,
|
|
61
69
|
(text) => {
|
|
@@ -5,6 +5,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
5
5
|
placement?: OverlayPlacement;
|
|
6
6
|
openDelay?: number;
|
|
7
7
|
closeDelay?: number;
|
|
8
|
+
active?: boolean;
|
|
8
9
|
innerHTML?: string | undefined | undefined;
|
|
9
10
|
class?: import("vue").ClassValue;
|
|
10
11
|
style?: import("vue").StyleValue;
|
|
@@ -202,6 +203,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
202
203
|
placement?: OverlayPlacement;
|
|
203
204
|
openDelay?: number;
|
|
204
205
|
closeDelay?: number;
|
|
206
|
+
active?: boolean;
|
|
205
207
|
innerHTML?: string | undefined | undefined;
|
|
206
208
|
class?: import("vue").ClassValue;
|
|
207
209
|
style?: import("vue").StyleValue;
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
background: var(--k-danger);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
.k-tree .k-tree-row.is-invalid > .k-tree-text,
|
|
125
126
|
.k-tree .k-tree-row.is-invalid .k-tree-label {
|
|
126
127
|
color: var(--k-danger-text);
|
|
127
128
|
}
|
|
@@ -301,22 +302,45 @@
|
|
|
301
302
|
border-radius: var(--k-radius-sm);
|
|
302
303
|
background: var(--k-elevated);
|
|
303
304
|
opacity: 0;
|
|
304
|
-
|
|
305
|
+
visibility: hidden;
|
|
305
306
|
translate: 0 -50%;
|
|
306
|
-
transition:
|
|
307
|
+
transition:
|
|
308
|
+
opacity var(--k-duration) var(--k-ease),
|
|
309
|
+
visibility var(--k-duration) var(--k-ease);
|
|
307
310
|
}
|
|
308
311
|
|
|
309
312
|
.k-tree-actions:empty {
|
|
310
313
|
display: none;
|
|
311
314
|
}
|
|
312
315
|
|
|
316
|
+
.k-tree-moves {
|
|
317
|
+
display: contents;
|
|
318
|
+
}
|
|
319
|
+
|
|
313
320
|
.k-tree-row:is(:hover, :focus-within) > .k-tree-actions,
|
|
314
|
-
.k-tree-row[aria-selected='true'] > .k-tree-actions.has-slot
|
|
321
|
+
.k-tree-row[aria-selected='true'] > .k-tree-actions.has-slot,
|
|
322
|
+
.k-tree-actions:has([aria-expanded='true']) {
|
|
315
323
|
opacity: 1;
|
|
316
|
-
|
|
324
|
+
visibility: visible;
|
|
317
325
|
}
|
|
318
326
|
|
|
319
327
|
.k-tree.is-dragging .k-tree-row > .k-tree-actions {
|
|
320
328
|
opacity: 0;
|
|
321
|
-
|
|
329
|
+
visibility: hidden;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@media (hover: none) {
|
|
333
|
+
.k-tree-actions {
|
|
334
|
+
position: static;
|
|
335
|
+
flex: none;
|
|
336
|
+
background: none;
|
|
337
|
+
opacity: 1;
|
|
338
|
+
visibility: visible;
|
|
339
|
+
translate: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.k-tree-row:not(:focus-within, [aria-selected='true']) > .k-tree-actions:not(.has-slot),
|
|
343
|
+
.k-tree-row:not(:focus-within, [aria-selected='true']) > .k-tree-actions > .k-tree-moves {
|
|
344
|
+
display: none;
|
|
345
|
+
}
|
|
322
346
|
}
|
|
@@ -55,6 +55,23 @@
|
|
|
55
55
|
max-height: min(36rem, calc(100dvh - 6rem));
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
.k-command-list {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex: 1;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
min-width: 0;
|
|
63
|
+
min-height: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.k-popover:has(> .k-command-list) {
|
|
67
|
+
width: min(22rem, calc(100vw - 1rem));
|
|
68
|
+
padding: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.k-popover > .k-command-list {
|
|
72
|
+
max-height: min(24rem, calc(100dvh - 2rem));
|
|
73
|
+
}
|
|
74
|
+
|
|
58
75
|
.k-command-bar {
|
|
59
76
|
--k-icon-size: 1.25rem;
|
|
60
77
|
display: flex;
|
|
@@ -108,6 +125,11 @@
|
|
|
108
125
|
margin-top: 0.375rem;
|
|
109
126
|
}
|
|
110
127
|
|
|
128
|
+
.k-command-group.is-pinned:not(:last-child) {
|
|
129
|
+
padding-bottom: 0.375rem;
|
|
130
|
+
border-bottom: 1px solid var(--k-line);
|
|
131
|
+
}
|
|
132
|
+
|
|
111
133
|
.k-command-group-label {
|
|
112
134
|
display: flex;
|
|
113
135
|
flex-wrap: wrap;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
border-radius: var(--k-popover-radius, var(--k-radius-lg));
|
|
22
22
|
box-shadow: var(--k-popover-shadow, var(--k-shadow-overlay));
|
|
23
23
|
opacity: 0;
|
|
24
|
+
pointer-events: auto;
|
|
24
25
|
transform: translate(var(--k-floating-shift-x), var(--k-floating-shift-y)) scale(0.97);
|
|
25
26
|
transform-origin: var(--k-floating-origin, top center);
|
|
26
27
|
transition:
|
package/package.json
CHANGED