Skip to content

Commit b389238

Browse files
feat: export types from SplitPanel component for better type support (#21)
1 parent 7c04ded commit b389238

File tree

3 files changed

+84
-49
lines changed

3 files changed

+84
-49
lines changed

packages/vue-split-panel/src/SplitPanel.vue

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,5 @@
1-
<script lang="ts">
2-
export interface SplitPanelProps {
3-
/** Sets the split panel's orientation */
4-
orientation?: 'horizontal' | 'vertical';
5-
6-
/** Sets the split panel's text direction */
7-
direction?: 'ltr' | 'rtl';
8-
9-
/** If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the panels component is resized */
10-
primary?: 'start' | 'end';
11-
12-
/** The invisible region around the divider where dragging can occur. This is usually wider than the divider to facilitate easier dragging. CSS value */
13-
dividerHitArea?: string;
14-
15-
/** Whether the size v-model should be in relative percentages or absolute pixels */
16-
sizeUnit?: '%' | 'px';
17-
18-
/** Disable the manual resizing of the panels */
19-
disabled?: boolean;
20-
21-
/** The minimum allowed size of the primary panel */
22-
minSize?: number;
23-
24-
/** The maximum allowed size of the primary panel */
25-
maxSize?: number;
26-
27-
/** Whether to allow the primary panel to be collapsed on enter key on divider or when the collapse threshold is met */
28-
collapsible?: boolean;
29-
30-
/** How far to drag beyond the minSize to collapse/expand the primary panel */
31-
collapseThreshold?: number;
32-
33-
/** How long should the collapse/expand state transition for in CSS value */
34-
transitionDuration?: string;
35-
36-
/** CSS transition timing function for the expand transition */
37-
transitionTimingFunctionExpand?: string;
38-
39-
/** CSS transition timing function for the collapse transition */
40-
transitionTimingFunctionCollapse?: string;
41-
42-
/** What size values the divider should snap to */
43-
snapPoints?: number[];
44-
45-
/** How close to the snap point the size should be before the snapping occurs */
46-
snapThreshold?: number;
47-
}
48-
</script>
49-
501
<script lang="ts" setup>
2+
import type { SplitPanelProps } from './types';
513
import { clamp, useDraggable, useElementSize, useResizeObserver } from '@vueuse/core';
524
import { computed, onMounted, ref, useTemplateRef, watch } from 'vue';
535
import { closestNumber } from './utils/closest-number';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default as SplitPanel } from './SplitPanel.vue';
2+
export * from './types';
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
export interface SplitPanelProps {
2+
/**
3+
* Sets the split panel's orientation
4+
* @default 'horizontal'
5+
*/
6+
orientation?: 'horizontal' | 'vertical';
7+
8+
/**
9+
* Sets the split panel's text direction
10+
* @default 'ltr'
11+
*/
12+
direction?: 'ltr' | 'rtl';
13+
14+
/** If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the panels component is resized */
15+
primary?: 'start' | 'end';
16+
17+
/**
18+
* The invisible region around the divider where dragging can occur. This is usually wider than the divider to facilitate easier dragging. CSS value
19+
* @default '12px'
20+
*/
21+
dividerHitArea?: string;
22+
23+
/**
24+
* Whether the size v-model should be in relative percentages or absolute pixels
25+
* @default '%'
26+
*/
27+
sizeUnit?: '%' | 'px';
28+
29+
/**
30+
* Disable the manual resizing of the panels
31+
* @default false
32+
*/
33+
disabled?: boolean;
34+
35+
/**
36+
* The minimum allowed size of the primary panel
37+
* @default 0
38+
*/
39+
minSize?: number;
40+
41+
/** The maximum allowed size of the primary panel */
42+
maxSize?: number;
43+
44+
/**
45+
* Whether to allow the primary panel to be collapsed on enter key on divider or when the collapse threshold is met
46+
* @default false
47+
*/
48+
collapsible?: boolean;
49+
50+
/** How far to drag beyond the minSize to collapse/expand the primary panel */
51+
collapseThreshold?: number;
52+
53+
/**
54+
* How long should the collapse/expand state transition for in CSS value
55+
* @default '0'
56+
*/
57+
transitionDuration?: string;
58+
59+
/**
60+
* CSS transition timing function for the expand transition
61+
* @default 'cubic-bezier(0, 0, 0.2, 1)'
62+
*/
63+
transitionTimingFunctionExpand?: string;
64+
65+
/**
66+
* CSS transition timing function for the collapse transition
67+
* @default 'cubic-bezier(0.4, 0, 0.6, 1)'
68+
*/
69+
transitionTimingFunctionCollapse?: string;
70+
71+
/**
72+
* What size values the divider should snap to
73+
* @default []
74+
*/
75+
snapPoints?: number[];
76+
77+
/**
78+
* How close to the snap point the size should be before the snapping occurs
79+
* @default 12
80+
*/
81+
snapThreshold?: number;
82+
}

0 commit comments

Comments
 (0)