pxd 0.1.3 → 0.1.4
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/components/_internal/dismiss-container.vue +1 -1
- package/dist/components/_internal/mention-editor.d.vue.ts +1 -1
- package/dist/components/_internal/mention-editor.vue +2 -2
- package/dist/components/_internal/step-item.vue +1 -1
- package/dist/components/_internal/tree-node.d.vue.ts +3 -0
- package/dist/components/_internal/tree-node.vue +16 -7
- package/dist/components/active-graph/index.vue +1 -1
- package/dist/components/avatar/index.d.vue.ts +2 -2
- package/dist/components/avatar/index.vue +1 -1
- package/dist/components/backtop/index.vue +1 -1
- package/dist/components/badge/index.vue +3 -3
- package/dist/components/browser/index.vue +1 -1
- package/dist/components/bubble/index.vue +5 -5
- package/dist/components/button/index.d.vue.ts +1 -1
- package/dist/components/button/index.vue +6 -5
- package/dist/components/button/types.d.ts +1 -1
- package/dist/components/button-group/types.d.ts +1 -1
- package/dist/components/calendar/index.vue +5 -5
- package/dist/components/card/index.vue +2 -2
- package/dist/components/carousel/index.d.vue.ts +0 -1
- package/dist/components/carousel/index.vue +22 -17
- package/dist/components/carousel/types.d.ts +0 -1
- package/dist/components/checkbox/index.vue +1 -1
- package/dist/components/choicebox-item/index.vue +2 -2
- package/dist/components/code-block/index.d.vue.ts +22 -0
- package/dist/components/code-block/index.vue +166 -0
- package/dist/components/code-block/types.d.ts +14 -0
- package/dist/components/command-menu/index.d.vue.ts +1 -1
- package/dist/components/command-menu/index.vue +1 -2
- package/dist/components/config-provider/index.d.vue.ts +4 -0
- package/dist/components/confirm-popover/index.d.vue.ts +7 -8
- package/dist/components/confirm-popover/index.vue +36 -10
- package/dist/components/confirm-popover/types.d.ts +2 -0
- package/dist/components/copy-button/index.vue +1 -5
- package/dist/components/date-picker/index.vue +1 -1
- package/dist/components/description/index.vue +1 -1
- package/dist/components/drawer/index.d.vue.ts +3 -3
- package/dist/components/drawer/index.vue +9 -15
- package/dist/components/ellipsis-text/index.vue +1 -1
- package/dist/components/error/index.vue +2 -2
- package/dist/components/image-preview/index.d.vue.ts +38 -0
- package/dist/components/image-preview/index.vue +351 -0
- package/dist/components/image-preview/types.d.ts +18 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/input/index.vue +5 -4
- package/dist/components/kbd/index.vue +1 -1
- package/dist/components/list-group/index.vue +7 -1
- package/dist/components/list-item/index.vue +21 -8
- package/dist/components/marquee/index.vue +6 -2
- package/dist/components/mention/index.d.vue.ts +1 -1
- package/dist/components/message/index.vue +1 -1
- package/dist/components/modal/index.d.vue.ts +2 -2
- package/dist/components/modal/index.vue +9 -15
- package/dist/components/note/index.vue +1 -1
- package/dist/components/number-input/index.vue +6 -6
- package/dist/components/overlay/index.d.vue.ts +0 -1
- package/dist/components/overlay/index.vue +2 -8
- package/dist/components/overlay/types.d.ts +1 -2
- package/dist/components/pagination/index.vue +4 -4
- package/dist/components/pin-input/index.d.vue.ts +1 -1
- package/dist/components/pin-input/index.vue +5 -1
- package/dist/components/popover/index.vue +26 -21
- package/dist/components/popover/types.d.ts +1 -0
- package/dist/components/project-banner/index.vue +22 -9
- package/dist/components/questionnaire/index.vue +1 -1
- package/dist/components/resizable/index.d.vue.ts +5 -0
- package/dist/components/resizable/index.vue +256 -107
- package/dist/components/resizable/types.d.ts +6 -0
- package/dist/components/select/index.vue +4 -2
- package/dist/components/skeleton/index.d.vue.ts +1 -1
- package/dist/components/swipe-cell/index.vue +1 -1
- package/dist/components/switch/index.vue +1 -1
- package/dist/components/tabs/index.vue +1 -1
- package/dist/components/teleport/index.vue +20 -22
- package/dist/components/textarea/index.vue +1 -0
- package/dist/components/time-picker/index.vue +4 -4
- package/dist/components/toc/index.vue +1 -1
- package/dist/components/todo-list/index.d.vue.ts +1 -1
- package/dist/components/toggle/index.vue +2 -2
- package/dist/components/toggle-button/index.vue +11 -5
- package/dist/components/toggle-button/types.d.ts +3 -2
- package/dist/components/toggle-button-group/index.vue +1 -0
- package/dist/components/toggle-button-group/types.d.ts +2 -2
- package/dist/components/tour/index.vue +3 -3
- package/dist/components/tree/index.d.vue.ts +18 -15
- package/dist/components/tree/index.vue +102 -77
- package/dist/components/tree/types.d.ts +4 -0
- package/dist/composables/_internal/use-code-highlight.d.ts +12 -0
- package/dist/composables/_internal/use-code-highlight.js +47 -0
- package/dist/composables/_internal/use-lock-scroll.js +5 -22
- package/dist/composables/_internal/use-overlay-manager.d.ts +0 -1
- package/dist/composables/_internal/use-overlay-manager.js +2 -18
- package/dist/composables/_internal/use-popover-responsive.js +9 -12
- package/dist/composables/_internal/use-swipe-gesture.d.ts +1 -1
- package/dist/composables/_internal/use-swipe-gesture.js +5 -4
- package/dist/composables/_internal/use-tailwind-variant.js +1 -1
- package/dist/composables/use-media-query.d.ts +3 -1
- package/dist/composables/use-media-query.js +33 -51
- package/dist/composables/use-outside-click.d.ts +2 -1
- package/dist/composables/use-outside-click.js +3 -7
- package/dist/composables/use-repeat-action.d.ts +1 -1
- package/dist/composables/use-repeat-action.js +3 -3
- package/dist/constants/size.d.ts +1 -0
- package/dist/constants/size.js +7 -6
- package/dist/constants/tooltip-variants.d.ts +1 -1
- package/dist/constants/tooltip-variants.js +1 -1
- package/dist/locales/en-us.d.ts +4 -0
- package/dist/locales/en-us.js +4 -0
- package/dist/locales/zh-cn.d.ts +4 -0
- package/dist/locales/zh-cn.js +4 -0
- package/dist/styles/styles.css +1 -1
- package/dist/styles/tw.css +12 -7
- package/dist/utils/_internal/cn-tables.d.ts +27 -0
- package/dist/utils/_internal/cn-tables.js +131 -0
- package/dist/utils/cn.d.ts +1 -0
- package/dist/utils/cn.js +3 -0
- package/package.json +6 -4
- package/volar.d.ts +2 -0
|
@@ -40,6 +40,24 @@ const targetEl = computed(() => {
|
|
|
40
40
|
} catch {}
|
|
41
41
|
return container ?? document.body;
|
|
42
42
|
});
|
|
43
|
+
function syncContainer() {
|
|
44
|
+
const el = containerRef.value;
|
|
45
|
+
if (!el || !homeLocation) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (props.disabled) {
|
|
49
|
+
if (isTeleported) {
|
|
50
|
+
const { parent, nextSibling } = homeLocation;
|
|
51
|
+
parent.insertBefore(el, nextSibling);
|
|
52
|
+
isTeleported = false;
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (targetEl.value) {
|
|
57
|
+
targetEl.value.append(el);
|
|
58
|
+
isTeleported = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
43
61
|
onMounted(() => {
|
|
44
62
|
mounted.value = true;
|
|
45
63
|
if (inVue3 || inServer) {
|
|
@@ -51,29 +69,9 @@ onMounted(() => {
|
|
|
51
69
|
parent: el.parentNode,
|
|
52
70
|
nextSibling: el.nextSibling
|
|
53
71
|
};
|
|
54
|
-
|
|
55
|
-
targetEl.value.append(el);
|
|
56
|
-
isTeleported = true;
|
|
57
|
-
}
|
|
72
|
+
syncContainer();
|
|
58
73
|
}
|
|
59
|
-
watch(() => [targetEl.value, props.disabled],
|
|
60
|
-
const el = containerRef.value;
|
|
61
|
-
if (!el || !homeLocation) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (props.disabled) {
|
|
65
|
-
if (isTeleported) {
|
|
66
|
-
const { parent, nextSibling } = homeLocation;
|
|
67
|
-
parent.insertBefore(el, nextSibling);
|
|
68
|
-
isTeleported = false;
|
|
69
|
-
}
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (targetEl.value) {
|
|
73
|
-
targetEl.value.append(el);
|
|
74
|
-
isTeleported = true;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
74
|
+
watch(() => [targetEl.value, props.disabled], syncContainer);
|
|
77
75
|
});
|
|
78
76
|
onBeforeUnmount(() => {
|
|
79
77
|
if (inVue3) {
|
|
@@ -156,6 +156,7 @@ function onCompositionEnd(event) {
|
|
|
156
156
|
v-model="modelValue"
|
|
157
157
|
class="py-2.5 px-3 size-full min-h-inherit resize-none appearance-none rounded-inherit border-none bg-transparent font-inherit outline-none placeholder:text-gray-600 placeholder:select-none disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-700 disabled:placeholder:text-gray-400"
|
|
158
158
|
:class="nativeTextareaClasses"
|
|
159
|
+
spellcheck="false"
|
|
159
160
|
autocorrect="off"
|
|
160
161
|
autocomplete="off"
|
|
161
162
|
autocapitalize="off"
|
|
@@ -306,19 +306,19 @@ onBeforeUnmount(() => {
|
|
|
306
306
|
<PButton
|
|
307
307
|
size="xs"
|
|
308
308
|
variant="ghost"
|
|
309
|
-
class="sm:px-0.5 rounded-md text-
|
|
309
|
+
class="sm:px-0.5 rounded-md text-13px"
|
|
310
310
|
@click="onCancelClick"
|
|
311
311
|
>
|
|
312
312
|
{{ configProvider.locale.interaction.cancel }}
|
|
313
313
|
</PButton>
|
|
314
314
|
|
|
315
|
-
<PButton size="xs" variant="ghost" class="sm:px-0 text-
|
|
315
|
+
<PButton size="xs" variant="ghost" class="sm:px-0 text-13px" @click="onSetNowClick">
|
|
316
316
|
{{ configProvider.locale.date.now }}
|
|
317
317
|
</PButton>
|
|
318
318
|
</div>
|
|
319
319
|
|
|
320
320
|
<div
|
|
321
|
-
class="sm:text-
|
|
321
|
+
class="sm:text-15px max-sm:text-base flex max-w-full transform-gpu items-stretch tabular-nums outline-none select-none"
|
|
322
322
|
@click.stop="onTimeListClick"
|
|
323
323
|
>
|
|
324
324
|
<div class="p-2 gap-1 relative mx-auto flex items-center">
|
|
@@ -381,7 +381,7 @@ onBeforeUnmount(() => {
|
|
|
381
381
|
v-for="(preset, i) in presets"
|
|
382
382
|
:key="preset.label"
|
|
383
383
|
:data-index="i"
|
|
384
|
-
class="px-1.5 py-0.5 sm:text-
|
|
384
|
+
class="px-1.5 py-0.5 sm:text-13px sm:leading-4 max-sm:leading-5 max-sm:text-sm cursor-pointer appearance-none rounded-sm border-none bg-gray-300 font-inherit whitespace-nowrap text-foreground self-focus-ring outline-none hover:bg-gray-400 active:bg-gray-500 motion-safe:transition-colors"
|
|
385
385
|
>
|
|
386
386
|
{{ preset.label }}
|
|
387
387
|
</button>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref, shallowRef, watch } from "vue";
|
|
3
|
-
import { useMotionReduced } from "../../composables/use-motion-reduce.js";
|
|
4
3
|
import { useTailwindVariant } from "../../composables/_internal/use-tailwind-variant.js";
|
|
4
|
+
import { useMotionReduced } from "../../composables/use-motion-reduce.js";
|
|
5
5
|
import { useMutationObserver } from "../../composables/use-mutation-observer.js";
|
|
6
6
|
import { useScrollspy } from "../../composables/use-scrollspy.js";
|
|
7
7
|
import { getScrollElement, isViewportScroll, resolveScrollBehavior } from "../../utils/dom.js";
|
|
@@ -50,8 +50,8 @@ declare const __VLS_base: import("vue").DefineComponent<TodoProps, {
|
|
|
50
50
|
onToggle?: ((expanded: boolean, event: MouseEvent) => any) | undefined;
|
|
51
51
|
}>, {
|
|
52
52
|
options: TodoOption[];
|
|
53
|
-
readonly: boolean;
|
|
54
53
|
collapsible: boolean;
|
|
54
|
+
readonly: boolean;
|
|
55
55
|
defaultExpanded: boolean;
|
|
56
56
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
57
57
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -142,9 +142,9 @@ async function onCheckboxChange(e) {
|
|
|
142
142
|
<div
|
|
143
143
|
:data-checked="isChecked"
|
|
144
144
|
:data-disabled="isDisabled"
|
|
145
|
-
class="pxd-toggle--handle-icon shadow-sm bg-white relative flex aspect-square h-full translate-x-(--tx) transform-gpu items-center justify-center overflow-hidden rounded-full text-
|
|
145
|
+
class="pxd-toggle--handle-icon shadow-sm bg-white relative flex aspect-square h-full translate-x-(--tx) transform-gpu items-center justify-center overflow-hidden rounded-full text-10px text-foreground-secondary motion-safe:transition-appearance dark:data-[checked=true]:bg-background-100 dark:data-[disabled=true]:bg-gray-900 dark:data-[disabled=true]:text-gray-500"
|
|
146
146
|
>
|
|
147
|
-
<div class="inset-0
|
|
147
|
+
<div class="inset-0 absolute flex items-center justify-center">
|
|
148
148
|
<Transition name="pxd-transition--fade" mode="out-in">
|
|
149
149
|
<LoaderCircleIcon v-if="loading" class="motion-safe:animate-spin" />
|
|
150
150
|
<slot v-else-if="modelValue" name="checked" />
|
|
@@ -15,6 +15,10 @@ defineOptions({
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
const props = defineProps({
|
|
18
|
+
icon: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
18
22
|
size: {
|
|
19
23
|
type: String,
|
|
20
24
|
required: false
|
|
@@ -65,13 +69,13 @@ const isChecked = computed(() => {
|
|
|
65
69
|
});
|
|
66
70
|
const configProvider = useConfigProvider();
|
|
67
71
|
const { attrs, classes } = useTailwindVariant({
|
|
68
|
-
base: "pxd-toggle-button gap-2 font-
|
|
72
|
+
base: "pxd-toggle-button gap-2 font-normal relative inline-flex shrink-0 appearance-none items-center justify-center border leading-none self-focus-ring outline-none group-data-[gap=0]/toggle-button-group:not-first:rounded-l-none group-data-[gap=0]/toggle-button-group:not-first:border-l-0 group-data-[gap=0]/toggle-button-group:not-last:rounded-r-none focus-visible:z-1 motion-safe:transition-colors",
|
|
69
73
|
variants: {
|
|
70
74
|
size: {
|
|
71
|
-
xs: `${BASIC_HEIGHTS.xs} px-1.
|
|
72
|
-
sm: `${BASIC_HEIGHTS.sm} px-
|
|
75
|
+
xs: `${BASIC_HEIGHTS.xs} px-1.5 text-xs rounded-sm`,
|
|
76
|
+
sm: `${BASIC_HEIGHTS.sm} px-2 text-sm rounded-md`,
|
|
73
77
|
md: `${BASIC_HEIGHTS.md} px-2.5 text-sm rounded-md`,
|
|
74
|
-
lg: `${BASIC_HEIGHTS.lg} px-
|
|
78
|
+
lg: `${BASIC_HEIGHTS.lg} px-3 text-base rounded-lg`
|
|
75
79
|
},
|
|
76
80
|
variant: {
|
|
77
81
|
default: "border-gray-400 bg-background-100",
|
|
@@ -81,7 +85,8 @@ const { attrs, classes } = useTailwindVariant({
|
|
|
81
85
|
true: "cursor-not-allowed",
|
|
82
86
|
false: "cursor-pointer"
|
|
83
87
|
},
|
|
84
|
-
checked: {}
|
|
88
|
+
checked: {},
|
|
89
|
+
icon: { true: "aspect-square" }
|
|
85
90
|
},
|
|
86
91
|
compoundVariants: [
|
|
87
92
|
{
|
|
@@ -112,6 +117,7 @@ const { attrs, classes } = useTailwindVariant({
|
|
|
112
117
|
}
|
|
113
118
|
]
|
|
114
119
|
}, { selection: () => ({
|
|
120
|
+
icon: props.icon,
|
|
115
121
|
size: props.size || toggleButtonGroupContext?.props.size || configProvider.size,
|
|
116
122
|
checked: isChecked.value,
|
|
117
123
|
variant: computedVariant.value,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { ComponentLabel,
|
|
1
|
+
import type { ComponentLabel, ComponentSizeWithXs, ComponentValue } from '../../types/shared/props'
|
|
2
2
|
import type { CheckboxProps } from '../checkbox/types'
|
|
3
3
|
|
|
4
4
|
type ToggleButtonModelValue = ComponentValue | boolean
|
|
5
5
|
|
|
6
6
|
export interface ToggleButtonProps {
|
|
7
|
-
|
|
7
|
+
icon?: boolean
|
|
8
|
+
size?: ComponentSizeWithXs
|
|
8
9
|
label?: ComponentLabel
|
|
9
10
|
value?: ToggleButtonModelValue
|
|
10
11
|
variant?: 'default' | 'ghost'
|
|
@@ -59,6 +59,7 @@ const configProvider = useConfigProvider();
|
|
|
59
59
|
const { attrs, classes } = useTailwindVariant({
|
|
60
60
|
base: "pxd-toggle-button-group group/toggle-button-group w-max",
|
|
61
61
|
variants: { size: {
|
|
62
|
+
xs: "rounded-sm",
|
|
62
63
|
sm: "rounded-md",
|
|
63
64
|
md: "rounded-md",
|
|
64
65
|
lg: "rounded-lg"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
ComponentSizeWithXs,
|
|
3
3
|
ComponentValue,
|
|
4
4
|
ComponentOption,
|
|
5
5
|
ResponsiveValue,
|
|
@@ -8,7 +8,7 @@ import type { CheckboxProps } from '../checkbox/types'
|
|
|
8
8
|
|
|
9
9
|
export interface ToggleButtonGroupProps {
|
|
10
10
|
gap?: ResponsiveValue<string | number>
|
|
11
|
-
size?:
|
|
11
|
+
size?: ComponentSizeWithXs
|
|
12
12
|
disabled?: boolean
|
|
13
13
|
multiple?: boolean
|
|
14
14
|
options?: ComponentOption[]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onBeforeUnmount, shallowRef, watch } from "vue";
|
|
3
|
-
import { useMotionReduced } from "../../composables/use-motion-reduce.js";
|
|
4
3
|
import { useTourTarget } from "../../composables/_internal/use-tour-target.js";
|
|
4
|
+
import { useMotionReduced } from "../../composables/use-motion-reduce.js";
|
|
5
5
|
import { useConfigProvider } from "../../contexts/config-provider.js";
|
|
6
6
|
import { cachedOff, cachedOn, isCompositionKeydown } from "../../utils/event.js";
|
|
7
7
|
import { getUniqueId } from "../../utils/helper.js";
|
|
@@ -222,8 +222,8 @@ defineExpose({
|
|
|
222
222
|
|
|
223
223
|
<template>
|
|
224
224
|
<POverlay
|
|
225
|
+
variant="none"
|
|
225
226
|
:z-index="zIndex"
|
|
226
|
-
:show-overlay="false"
|
|
227
227
|
:model-value="modelValue"
|
|
228
228
|
:close-on-press-escape="false"
|
|
229
229
|
:close-on-click-overlay="false"
|
|
@@ -263,7 +263,7 @@ defineExpose({
|
|
|
263
263
|
/>
|
|
264
264
|
|
|
265
265
|
<template #content>
|
|
266
|
-
<h4 v-if="activeStep?.title" :id="titleId" class="font-medium m-0 text-
|
|
266
|
+
<h4 v-if="activeStep?.title" :id="titleId" class="font-medium m-0 text-15px">
|
|
267
267
|
{{ activeStep.title }}
|
|
268
268
|
</h4>
|
|
269
269
|
|
|
@@ -8,41 +8,42 @@ declare function setActiveKey(value: ComponentValue): void;
|
|
|
8
8
|
declare function getCheckedKeys(includeIndeterminate?: boolean): ComponentValue[];
|
|
9
9
|
declare function getVisibleKeys(): ComponentValue[];
|
|
10
10
|
declare function getData(value: ComponentValue): TreeOption | undefined;
|
|
11
|
-
declare var __VLS_1: {},
|
|
11
|
+
declare var __VLS_1: {}, __VLS_29: {
|
|
12
12
|
node: TreeOption;
|
|
13
13
|
depth: number;
|
|
14
14
|
loading: boolean;
|
|
15
15
|
expanded: boolean;
|
|
16
|
-
},
|
|
16
|
+
}, __VLS_32: {
|
|
17
17
|
node: TreeOption;
|
|
18
18
|
depth: number;
|
|
19
|
+
loading: boolean;
|
|
19
20
|
expanded: boolean;
|
|
20
21
|
hasChildren: boolean;
|
|
21
|
-
},
|
|
22
|
+
}, __VLS_35: {
|
|
22
23
|
node: TreeOption;
|
|
23
24
|
depth: number;
|
|
24
25
|
parts: import("./types").TreeHighlightPart[] | undefined;
|
|
25
26
|
hasChildren: boolean;
|
|
26
|
-
},
|
|
27
|
+
}, __VLS_38: {
|
|
27
28
|
node: TreeOption;
|
|
28
29
|
hasChildren: boolean;
|
|
29
|
-
},
|
|
30
|
+
}, __VLS_55: {}, __VLS_63: {
|
|
30
31
|
node: TreeOption | undefined;
|
|
31
32
|
};
|
|
32
33
|
type __VLS_Slots = {} & {
|
|
33
34
|
search?: (props: typeof __VLS_1) => any;
|
|
34
35
|
} & {
|
|
35
|
-
'node-switcher'?: (props: typeof
|
|
36
|
+
'node-switcher'?: (props: typeof __VLS_29) => any;
|
|
36
37
|
} & {
|
|
37
|
-
'node-icon'?: (props: typeof
|
|
38
|
+
'node-icon'?: (props: typeof __VLS_32) => any;
|
|
38
39
|
} & {
|
|
39
|
-
'node-content'?: (props: typeof
|
|
40
|
+
'node-content'?: (props: typeof __VLS_35) => any;
|
|
40
41
|
} & {
|
|
41
|
-
'node-suffix'?: (props: typeof
|
|
42
|
+
'node-suffix'?: (props: typeof __VLS_38) => any;
|
|
42
43
|
} & {
|
|
43
|
-
empty?: (props: typeof
|
|
44
|
+
empty?: (props: typeof __VLS_55) => any;
|
|
44
45
|
} & {
|
|
45
|
-
'node-drag-preview'?: (props: typeof
|
|
46
|
+
'node-drag-preview'?: (props: typeof __VLS_63) => any;
|
|
46
47
|
};
|
|
47
48
|
declare const __VLS_base: import("vue").DefineComponent<TreeProps, {
|
|
48
49
|
focus: () => void | undefined;
|
|
@@ -59,8 +60,8 @@ declare const __VLS_base: import("vue").DefineComponent<TreeProps, {
|
|
|
59
60
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
60
61
|
change: (args_0: import("./types").TreeChangeDetail) => any;
|
|
61
62
|
"update:modelValue": (args_0: TreeModelValue) => any;
|
|
62
|
-
expand: (args_0: import("./types").TreeNodeDetail) => any;
|
|
63
63
|
collapse: (args_0: import("./types").TreeNodeDetail) => any;
|
|
64
|
+
expand: (args_0: import("./types").TreeNodeDetail) => any;
|
|
64
65
|
move: (args_0: import("./types").TreeMoveDetail) => any;
|
|
65
66
|
"update:data": (args_0: TreeOptions) => any;
|
|
66
67
|
"update:expandedKeys": (args_0: ComponentValue[]) => any;
|
|
@@ -68,8 +69,8 @@ declare const __VLS_base: import("vue").DefineComponent<TreeProps, {
|
|
|
68
69
|
}, string, import("vue").PublicProps, Readonly<TreeProps> & Readonly<{
|
|
69
70
|
onChange?: ((args_0: import("./types").TreeChangeDetail) => any) | undefined;
|
|
70
71
|
"onUpdate:modelValue"?: ((args_0: TreeModelValue) => any) | undefined;
|
|
71
|
-
onExpand?: ((args_0: import("./types").TreeNodeDetail) => any) | undefined;
|
|
72
72
|
onCollapse?: ((args_0: import("./types").TreeNodeDetail) => any) | undefined;
|
|
73
|
+
onExpand?: ((args_0: import("./types").TreeNodeDetail) => any) | undefined;
|
|
73
74
|
onMove?: ((args_0: import("./types").TreeMoveDetail) => any) | undefined;
|
|
74
75
|
"onUpdate:data"?: ((args_0: TreeOptions) => any) | undefined;
|
|
75
76
|
"onUpdate:expandedKeys"?: ((args_0: ComponentValue[]) => any) | undefined;
|
|
@@ -77,16 +78,18 @@ declare const __VLS_base: import("vue").DefineComponent<TreeProps, {
|
|
|
77
78
|
}>, {
|
|
78
79
|
data: TreeOptions;
|
|
79
80
|
loading: boolean;
|
|
80
|
-
disabled: boolean;
|
|
81
81
|
lazy: boolean;
|
|
82
|
+
disabled: boolean;
|
|
82
83
|
itemSize: number;
|
|
83
84
|
overScan: number;
|
|
84
85
|
multiple: boolean;
|
|
85
86
|
virtual: boolean;
|
|
87
|
+
draggable: boolean;
|
|
86
88
|
searchPlaceholder: string;
|
|
87
89
|
filterable: boolean;
|
|
90
|
+
showSwitcher: boolean;
|
|
91
|
+
showCheckbox: boolean;
|
|
88
92
|
indent: number;
|
|
89
|
-
draggable: boolean;
|
|
90
93
|
checkStrictly: boolean;
|
|
91
94
|
expandOnly: boolean;
|
|
92
95
|
dropInsideLeaf: boolean;
|
|
@@ -43,6 +43,16 @@ const props = defineProps({
|
|
|
43
43
|
required: false,
|
|
44
44
|
default: false
|
|
45
45
|
},
|
|
46
|
+
showSwitcher: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: false,
|
|
49
|
+
default: true
|
|
50
|
+
},
|
|
51
|
+
showCheckbox: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
required: false,
|
|
54
|
+
default: true
|
|
55
|
+
},
|
|
46
56
|
disabled: {
|
|
47
57
|
type: Boolean,
|
|
48
58
|
required: false,
|
|
@@ -210,10 +220,9 @@ const containerStyle = computed(() => {
|
|
|
210
220
|
}
|
|
211
221
|
return { height: isNumber(height) ? height + "px" : height };
|
|
212
222
|
});
|
|
213
|
-
/** Painted only while focused: a marker on a blurred element lies about where the focus is. */
|
|
214
223
|
const focused = shallowRef(false);
|
|
215
|
-
/** Dragging while a query is active would drop a node relative to an incomplete neighbourhood. */
|
|
216
224
|
const dragEnabled = computed(() => props.draggable && !props.disabled && searchValue.value.trim().length === 0);
|
|
225
|
+
const rowsTransition = computed(() => props.virtual || searchValue.value ? "pxd-tree-transition-none" : "pxd-tree-transition");
|
|
217
226
|
const slots = useSlots();
|
|
218
227
|
const hasNodeSlot = computed(() => !!slots["node-switcher"] || !!slots["node-icon"] || !!slots["node-content"] || !!slots["node-suffix"]);
|
|
219
228
|
const { matches: remoteMatches, remote: remoteMode, pending: searchPending, active: remoteActive } = useTreeSearch({
|
|
@@ -625,7 +634,7 @@ defineExpose({
|
|
|
625
634
|
ref="containerRef"
|
|
626
635
|
role="tree"
|
|
627
636
|
tabindex="0"
|
|
628
|
-
class="pxd-tree m-0 relative w-full max-w-full
|
|
637
|
+
class="pxd-tree m-0 relative w-full max-w-full rounded-inherit bg-background-100 outline-none"
|
|
629
638
|
:class="{ 'min-h-22': loading && !rows.length }"
|
|
630
639
|
:style="containerStyle"
|
|
631
640
|
:aria-busy="loading"
|
|
@@ -636,90 +645,106 @@ defineExpose({
|
|
|
636
645
|
@focus="focused = true"
|
|
637
646
|
@blur="focused = false"
|
|
638
647
|
>
|
|
639
|
-
<
|
|
648
|
+
<TransitionGroup
|
|
649
|
+
tag="div"
|
|
650
|
+
:name="rowsTransition"
|
|
651
|
+
class="pxd-tree--content w-full"
|
|
652
|
+
:class="{ relative: virtual }"
|
|
653
|
+
:style="contentStyle"
|
|
654
|
+
>
|
|
640
655
|
<div
|
|
641
656
|
v-for="entry in renderEntries"
|
|
642
657
|
:key="entry.key"
|
|
643
658
|
:data-checked="checked.has(entry.key)"
|
|
644
|
-
class="pxd-tree--row w-full"
|
|
659
|
+
class="pxd-tree--row grid w-full grid-rows-[1fr]"
|
|
645
660
|
:class="{ 'left-0 top-0 absolute': virtual }"
|
|
646
661
|
:style="virtual ? { transform: 'translateY(' + entry.start + 'px)' } : void 0"
|
|
647
662
|
>
|
|
648
|
-
<
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
663
|
+
<div class="pxd-tree--clip min-h-0">
|
|
664
|
+
<PTreeNode
|
|
665
|
+
v-if="hasNodeSlot"
|
|
666
|
+
:id="entry.id"
|
|
667
|
+
:node="entry.node"
|
|
668
|
+
:value="entry.key"
|
|
669
|
+
:depth="entry.depth"
|
|
670
|
+
:index="entry.index"
|
|
671
|
+
:has-children="entry.hasChildren"
|
|
672
|
+
:expanded="entry.expanded"
|
|
673
|
+
:loading="loadingKeys.has(entry.key)"
|
|
674
|
+
:checked="checked.has(entry.key)"
|
|
675
|
+
:indeterminate="indeterminate.has(entry.key)"
|
|
676
|
+
:active="entry.active"
|
|
677
|
+
:multiple="multiple"
|
|
678
|
+
:disabled="disabled"
|
|
679
|
+
:show-switcher="showSwitcher"
|
|
680
|
+
:show-checkbox="showCheckbox"
|
|
681
|
+
:set-size="rows.length"
|
|
682
|
+
:indent="indent"
|
|
683
|
+
:selectable="isSelectable(entry.key)"
|
|
684
|
+
:highlight-query="highlightQuery"
|
|
685
|
+
:item-class="itemClass"
|
|
686
|
+
:draggable="dragEnabled"
|
|
687
|
+
:dragging="entry.key === dragValue"
|
|
688
|
+
:drop-position="
|
|
689
|
+
dropTarget?.targetValue === entry.key ? dropTarget.position : void 0
|
|
690
|
+
"
|
|
691
|
+
@row-click="onRowClick"
|
|
692
|
+
@drag-pointerdown="onDragPointerdown"
|
|
693
|
+
@check="onCheckboxClick"
|
|
694
|
+
@toggle="onSwitcherClick"
|
|
695
|
+
>
|
|
696
|
+
<template v-if="$slots['node-switcher']" #node-switcher="scope">
|
|
697
|
+
<slot name="node-switcher" v-bind="scope" />
|
|
698
|
+
</template>
|
|
679
699
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
700
|
+
<template v-if="$slots['node-icon']" #node-icon="scope">
|
|
701
|
+
<slot name="node-icon" v-bind="scope" />
|
|
702
|
+
</template>
|
|
683
703
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
704
|
+
<template v-if="$slots['node-content']" #node-content="scope">
|
|
705
|
+
<slot name="node-content" v-bind="scope" />
|
|
706
|
+
</template>
|
|
687
707
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
708
|
+
<template v-if="$slots['node-suffix']" #node-suffix="scope">
|
|
709
|
+
<slot name="node-suffix" v-bind="scope" />
|
|
710
|
+
</template>
|
|
711
|
+
</PTreeNode>
|
|
692
712
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
713
|
+
<PTreeNode
|
|
714
|
+
v-else
|
|
715
|
+
:id="entry.id"
|
|
716
|
+
:node="entry.node"
|
|
717
|
+
:value="entry.key"
|
|
718
|
+
:depth="entry.depth"
|
|
719
|
+
:index="entry.index"
|
|
720
|
+
:has-children="entry.hasChildren"
|
|
721
|
+
:expanded="entry.expanded"
|
|
722
|
+
:loading="loadingKeys.has(entry.key)"
|
|
723
|
+
:checked="checked.has(entry.key)"
|
|
724
|
+
:indeterminate="indeterminate.has(entry.key)"
|
|
725
|
+
:active="entry.active"
|
|
726
|
+
:multiple="multiple"
|
|
727
|
+
:disabled="disabled"
|
|
728
|
+
:show-switcher="showSwitcher"
|
|
729
|
+
:show-checkbox="showCheckbox"
|
|
730
|
+
:set-size="rows.length"
|
|
731
|
+
:indent="indent"
|
|
732
|
+
:selectable="isSelectable(entry.key)"
|
|
733
|
+
:highlight-query="highlightQuery"
|
|
734
|
+
:item-class="itemClass"
|
|
735
|
+
:draggable="dragEnabled"
|
|
736
|
+
:dragging="entry.key === dragValue"
|
|
737
|
+
:drop-position="
|
|
738
|
+
dropTarget?.targetValue === entry.key ? dropTarget.position : void 0
|
|
739
|
+
"
|
|
740
|
+
@row-click="onRowClick"
|
|
741
|
+
@drag-pointerdown="onDragPointerdown"
|
|
742
|
+
@check="onCheckboxClick"
|
|
743
|
+
@toggle="onSwitcherClick"
|
|
744
|
+
/>
|
|
745
|
+
</div>
|
|
721
746
|
</div>
|
|
722
|
-
</
|
|
747
|
+
</TransitionGroup>
|
|
723
748
|
|
|
724
749
|
<PLoadingMask v-if="loading" />
|
|
725
750
|
|
|
@@ -731,7 +756,7 @@ defineExpose({
|
|
|
731
756
|
</div>
|
|
732
757
|
</div>
|
|
733
758
|
|
|
734
|
-
<PTeleport
|
|
759
|
+
<PTeleport>
|
|
735
760
|
<div
|
|
736
761
|
v-if="dragValue !== void 0"
|
|
737
762
|
aria-hidden="true"
|
|
@@ -747,5 +772,5 @@ defineExpose({
|
|
|
747
772
|
</template>
|
|
748
773
|
|
|
749
774
|
<style>
|
|
750
|
-
.pxd-tree--row[data-checked=true]+.pxd-tree--row[data-checked=true]>.pxd-tree--node{border-top-left-radius:0;border-top-right-radius:0}.pxd-tree--row[data-checked=true]:has(+.pxd-tree--row[data-checked=true])>.pxd-tree--node{border-bottom-left-radius:0;border-bottom-right-radius:0}
|
|
775
|
+
.pxd-tree--row[data-checked=true]+.pxd-tree--row[data-checked=true]>.pxd-tree--clip>.pxd-tree--node{border-top-left-radius:0;border-top-right-radius:0}.pxd-tree--row[data-checked=true]:has(+.pxd-tree--row[data-checked=true])>.pxd-tree--clip>.pxd-tree--node{border-bottom-left-radius:0;border-bottom-right-radius:0}@media (hover:hover){.pxd-tree--row:has(>.pxd-tree--clip>.pxd-tree--node:is([data-checked=true],:hover)):has(+.pxd-tree--row>.pxd-tree--clip>.pxd-tree--node:is([data-checked=true],:hover))>.pxd-tree--clip>.pxd-tree--node{border-bottom-left-radius:0;border-bottom-right-radius:0}.pxd-tree--row:has(>.pxd-tree--clip>.pxd-tree--node:is([data-checked=true],:hover))+.pxd-tree--row>.pxd-tree--clip>.pxd-tree--node:is([data-checked=true],:hover){border-top-left-radius:0;border-top-right-radius:0}}.pxd-tree-transition-enter-active,.pxd-tree-transition-leave-active{transition-duration:var(--default-transition-duration);transition-property:grid-template-rows,opacity;transition-timing-function:var(--default-transition-timing-function)}.pxd-tree-transition-leave-active{transition-duration:var(--faster-transition-duration)}.pxd-tree-transition-enter-active>.pxd-tree--clip,.pxd-tree-transition-leave-active>.pxd-tree--clip{overflow:hidden}.pxd-tree-transition-enter-from,.pxd-tree-transition-leave-to{grid-template-rows:0fr;opacity:0}
|
|
751
776
|
</style>
|
|
@@ -105,6 +105,10 @@ export interface TreeProps {
|
|
|
105
105
|
modelValue?: TreeModelValue
|
|
106
106
|
multiple?: boolean
|
|
107
107
|
checkStrictly?: boolean
|
|
108
|
+
/** Hides the switcher column, its leaf spacer included: expansion stays on the keyboard and `expandKey`. */
|
|
109
|
+
showSwitcher?: boolean
|
|
110
|
+
/** Hides the built-in checkbox: a row click still checks. */
|
|
111
|
+
showCheckbox?: boolean
|
|
108
112
|
disabled?: boolean
|
|
109
113
|
selectable?: TreeSelectableFn
|
|
110
114
|
expandOnly?: boolean
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Past this length the regex scan and one Range per token cost more than the colors are worth. */
|
|
2
|
+
export declare const MAX_HIGHLIGHT_LENGTH = 20000;
|
|
3
|
+
declare function scheduleHighlight(): void;
|
|
4
|
+
/**
|
|
5
|
+
* `highlightAll()` clears every range the previous run registered and keeps its highlight sets in
|
|
6
|
+
* module state, so one run per instance would wipe every other block. All blocks share one batched,
|
|
7
|
+
* serialized run over `document`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useCodeHighlight(): {
|
|
10
|
+
scheduleHighlight: typeof scheduleHighlight;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { onMounted } from "vue";
|
|
2
|
+
export const MAX_HIGHLIGHT_LENGTH = 2e4;
|
|
3
|
+
let modulePromise = null;
|
|
4
|
+
let pending = false;
|
|
5
|
+
let flushing = false;
|
|
6
|
+
let unavailable = false;
|
|
7
|
+
function isHighlightSupported() {
|
|
8
|
+
return typeof CSS !== "undefined" && "highlights" in CSS && "Highlight" in globalThis;
|
|
9
|
+
}
|
|
10
|
+
function loadModule() {
|
|
11
|
+
modulePromise ??= import("microlighter").catch(() => {
|
|
12
|
+
unavailable = true;
|
|
13
|
+
return null;
|
|
14
|
+
});
|
|
15
|
+
return modulePromise;
|
|
16
|
+
}
|
|
17
|
+
async function flush() {
|
|
18
|
+
if (flushing) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
flushing = true;
|
|
22
|
+
try {
|
|
23
|
+
while (pending) {
|
|
24
|
+
pending = false;
|
|
25
|
+
const module = await loadModule();
|
|
26
|
+
if (!module) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
await module.highlightAll();
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
unavailable = true;
|
|
33
|
+
} finally {
|
|
34
|
+
flushing = false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function scheduleHighlight() {
|
|
38
|
+
if (pending || unavailable || !isHighlightSupported()) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
pending = true;
|
|
42
|
+
queueMicrotask(flush);
|
|
43
|
+
}
|
|
44
|
+
export function useCodeHighlight() {
|
|
45
|
+
onMounted(scheduleHighlight);
|
|
46
|
+
return { scheduleHighlight };
|
|
47
|
+
}
|