@dolanske/vui 1.4.1 → 1.4.3
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/package.json +1 -2
- package/src/App.vue +0 -103
- package/src/components/Accordion/Accordion.vue +0 -98
- package/src/components/Accordion/AccordionGroup.vue +0 -49
- package/src/components/Accordion/accordion.scss +0 -97
- package/src/components/Alert/Alert.vue +0 -59
- package/src/components/Alert/alert.scss +0 -162
- package/src/components/Avatar/Avatar.vue +0 -53
- package/src/components/Avatar/avatar.scss +0 -52
- package/src/components/Badge/Badge.vue +0 -21
- package/src/components/Badge/badge.scss +0 -210
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +0 -26
- package/src/components/Breadcrumbs/Breadcrumbs.vue +0 -29
- package/src/components/Breadcrumbs/breadcrumbs.scss +0 -31
- package/src/components/Button/Button.vue +0 -86
- package/src/components/Button/button.scss +0 -292
- package/src/components/ButtonGroup/ButtonGroup.vue +0 -28
- package/src/components/ButtonGroup/button-group.scss +0 -51
- package/src/components/Calendar/Calendar.vue +0 -66
- package/src/components/Calendar/calendar.scss +0 -88
- package/src/components/Card/Card.vue +0 -48
- package/src/components/Card/card.scss +0 -55
- package/src/components/Checkbox/Checkbox.vue +0 -54
- package/src/components/Checkbox/checkbox.scss +0 -80
- package/src/components/CopyClipboard/CopyClipboard.vue +0 -98
- package/src/components/CopyClipboard/copy-clipboard.scss +0 -25
- package/src/components/Divider/Divider.vue +0 -38
- package/src/components/Divider/divider.scss +0 -37
- package/src/components/Drawer/Drawer.vue +0 -102
- package/src/components/Drawer/drawer.scss +0 -37
- package/src/components/Dropdown/Dropdown.vue +0 -120
- package/src/components/Dropdown/DropdownItem.vue +0 -33
- package/src/components/Dropdown/DropdownTitle.vue +0 -14
- package/src/components/Dropdown/dropdown-item.scss +0 -84
- package/src/components/Dropdown/dropdown.scss +0 -53
- package/src/components/Flex/Flex.vue +0 -113
- package/src/components/Grid/Grid.vue +0 -87
- package/src/components/Input/Color.vue +0 -26
- package/src/components/Input/Counter.vue +0 -66
- package/src/components/Input/Dropzone.vue +0 -65
- package/src/components/Input/File.vue +0 -15
- package/src/components/Input/Input.vue +0 -123
- package/src/components/Input/Password.vue +0 -35
- package/src/components/Input/Textarea.vue +0 -78
- package/src/components/Input/input.scss +0 -302
- package/src/components/Kbd/Kbd.vue +0 -48
- package/src/components/Kbd/KbdGroup.vue +0 -28
- package/src/components/Kbd/kbd.scss +0 -19
- package/src/components/Modal/Confirm.vue +0 -56
- package/src/components/Modal/Modal.vue +0 -103
- package/src/components/Modal/modal.scss +0 -54
- package/src/components/OTP/OTP.vue +0 -133
- package/src/components/OTP/OTPItem.vue +0 -37
- package/src/components/OTP/otp.scss +0 -84
- package/src/components/Pagination/Pagination.vue +0 -92
- package/src/components/Pagination/pagination.ts +0 -78
- package/src/components/Popout/Popout.vue +0 -73
- package/src/components/Popout/popout.scss +0 -16
- package/src/components/Progress/Progress.vue +0 -103
- package/src/components/Progress/progress.scss +0 -47
- package/src/components/Radio/Radio.vue +0 -38
- package/src/components/Radio/RadioGroup.vue +0 -34
- package/src/components/Radio/radio.scss +0 -78
- package/src/components/Select/Select.vue +0 -212
- package/src/components/Select/select.scss +0 -82
- package/src/components/Sheet/Sheet.vue +0 -106
- package/src/components/Sheet/sheet.scss +0 -71
- package/src/components/Sidebar/Sidebar.vue +0 -116
- package/src/components/Sidebar/sidebar.scss +0 -124
- package/src/components/Skeleton/Skeleton.vue +0 -43
- package/src/components/Skeleton/skeleton.scss +0 -14
- package/src/components/Spinner/Spinner.vue +0 -42
- package/src/components/Spinner/spinner.scss +0 -47
- package/src/components/Switch/Switch.vue +0 -31
- package/src/components/Switch/switch.scss +0 -93
- package/src/components/Table/Cell.vue +0 -23
- package/src/components/Table/Head.vue +0 -66
- package/src/components/Table/Root.vue +0 -66
- package/src/components/Table/SelectAll.vue +0 -23
- package/src/components/Table/SelectRow.vue +0 -30
- package/src/components/Table/index.ts +0 -7
- package/src/components/Table/table.scss +0 -155
- package/src/components/Table/table.ts +0 -248
- package/src/components/Tabs/Tab.vue +0 -25
- package/src/components/Tabs/Tabs.vue +0 -90
- package/src/components/Tabs/tabs.scss +0 -87
- package/src/components/Toast/Toasts.vue +0 -52
- package/src/components/Toast/toast.scss +0 -45
- package/src/components/Toast/toast.ts +0 -75
- package/src/components/Tooltip/Tooltip.vue +0 -78
- package/src/components/Tooltip/tooltip.scss +0 -5
- package/src/examples/ExampleAccordions.vue +0 -69
- package/src/examples/ExampleAlerts.vue +0 -78
- package/src/examples/ExampleAvatars.vue +0 -44
- package/src/examples/ExampleBadges.vue +0 -48
- package/src/examples/ExampleBreadcrumbs.vue +0 -46
- package/src/examples/ExampleButtons.vue +0 -148
- package/src/examples/ExampleCalendars.vue +0 -40
- package/src/examples/ExampleCards.vue +0 -94
- package/src/examples/ExampleCheckboxes.vue +0 -123
- package/src/examples/ExampleCopyClipboard.vue +0 -47
- package/src/examples/ExampleDividers.vue +0 -39
- package/src/examples/ExampleDrawers.vue +0 -67
- package/src/examples/ExampleDropdowns.vue +0 -114
- package/src/examples/ExampleFlexGrid.vue +0 -124
- package/src/examples/ExampleInputs.vue +0 -236
- package/src/examples/ExampleKBD.vue +0 -65
- package/src/examples/ExampleModals.vue +0 -143
- package/src/examples/ExamplePalette.vue +0 -165
- package/src/examples/ExamplePopouts.vue +0 -41
- package/src/examples/ExampleSheets.vue +0 -77
- package/src/examples/ExampleSidebars.vue +0 -276
- package/src/examples/ExampleSkeletons.vue +0 -26
- package/src/examples/ExampleSpinners.vue +0 -80
- package/src/examples/ExampleTables.vue +0 -359
- package/src/examples/ExampleTabs.vue +0 -142
- package/src/examples/ExampleToasts.vue +0 -96
- package/src/examples/ExampleTooltips.vue +0 -70
- package/src/examples/shared/ExampleColor.vue +0 -28
- package/src/index.ts +0 -116
- package/src/internal/Backdrop/Backdrop.vue +0 -22
- package/src/internal/Backdrop/backdrop.scss +0 -34
- package/src/main.ts +0 -5
- package/src/shared/helpers.ts +0 -124
- package/src/shared/slots.ts +0 -61
- package/src/shared/theme.ts +0 -22
- package/src/shared/types.ts +0 -29
- package/src/style/animation.scss +0 -50
- package/src/style/core.scss +0 -133
- package/src/style/fonts.scss +0 -73
- package/src/style/layout.scss +0 -179
- package/src/style/media-query.scss +0 -29
- package/src/style/reset.scss +0 -135
- package/src/style/text.scss +0 -137
- package/src/style/theme.scss +0 -195
- package/src/style/tooltip.scss +0 -146
- package/src/style/typography.scss +0 -435
- package/src/style/utils.scss +0 -36
- package/src/style.scss +0 -1
- package/src/vite-env.d.ts +0 -1
package/src/index.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import Accordion from './components/Accordion/Accordion.vue'
|
|
2
|
-
import AccordionGroup from './components/Accordion/AccordionGroup.vue'
|
|
3
|
-
import Alert from './components/Alert/Alert.vue'
|
|
4
|
-
import Avatar from './components/Avatar/Avatar.vue'
|
|
5
|
-
import Badge from './components/Badge/Badge.vue'
|
|
6
|
-
import BreadcrumbItem from './components/Breadcrumbs/BreadcrumbItem.vue'
|
|
7
|
-
import Breadcrumbs from './components/Breadcrumbs/Breadcrumbs.vue'
|
|
8
|
-
import Button from './components/Button/Button.vue'
|
|
9
|
-
import ButtonGroup from './components/ButtonGroup/ButtonGroup.vue'
|
|
10
|
-
import Calendar from './components/Calendar/Calendar.vue'
|
|
11
|
-
import Card from './components/Card/Card.vue'
|
|
12
|
-
import Checkbox from './components/Checkbox/Checkbox.vue'
|
|
13
|
-
import CopyClipboard from './components/CopyClipboard/CopyClipboard.vue'
|
|
14
|
-
import Divider from './components/Divider/Divider.vue'
|
|
15
|
-
import Drawer from './components/Drawer/Drawer.vue'
|
|
16
|
-
import Dropdown from './components/Dropdown/Dropdown.vue'
|
|
17
|
-
import DropdownItem from './components/Dropdown/DropdownItem.vue'
|
|
18
|
-
import DropdownTitle from './components/Dropdown/DropdownTitle.vue'
|
|
19
|
-
import Flex from './components/Flex/Flex.vue'
|
|
20
|
-
import Grid from './components/Grid/Grid.vue'
|
|
21
|
-
import Color from './components/Input/Color.vue'
|
|
22
|
-
import Counter from './components/Input/Counter.vue'
|
|
23
|
-
import Dropzone from './components/Input/Dropzone.vue'
|
|
24
|
-
import File from './components/Input/File.vue'
|
|
25
|
-
import Input from './components/Input/Input.vue'
|
|
26
|
-
import Password from './components/Input/Password.vue'
|
|
27
|
-
import Textarea from './components/Input/Textarea.vue'
|
|
28
|
-
import Kbd from './components/Kbd/Kbd.vue'
|
|
29
|
-
import KbdGroup from './components/Kbd/KbdGroup.vue'
|
|
30
|
-
import Confirm from './components/Modal/Confirm.vue'
|
|
31
|
-
import Modal from './components/Modal/Modal.vue'
|
|
32
|
-
import OTP from './components/OTP/OTP.vue'
|
|
33
|
-
import OTPItem from './components/OTP/OTPItem.vue'
|
|
34
|
-
import { paginate } from './components/Pagination/pagination'
|
|
35
|
-
import Pagination from './components/Pagination/Pagination.vue'
|
|
36
|
-
import Popout from './components/Popout/Popout.vue'
|
|
37
|
-
import Progress from './components/Progress/Progress.vue'
|
|
38
|
-
import Radio from './components/Radio/Radio.vue'
|
|
39
|
-
import RadioGroup from './components/Radio/RadioGroup.vue'
|
|
40
|
-
import Select from './components/Select/Select.vue'
|
|
41
|
-
import Sheet from './components/Sheet/Sheet.vue'
|
|
42
|
-
import Sidebar from './components/Sidebar/Sidebar.vue'
|
|
43
|
-
import Skeleton from './components/Skeleton/Skeleton.vue'
|
|
44
|
-
import Spinner from './components/Spinner/Spinner.vue'
|
|
45
|
-
import Switch from './components/Switch/Switch.vue'
|
|
46
|
-
import * as Table from './components/Table'
|
|
47
|
-
import { defineTable } from './components/Table/table'
|
|
48
|
-
import Tab from './components/Tabs/Tab.vue'
|
|
49
|
-
import Tabs from './components/Tabs/Tabs.vue'
|
|
50
|
-
import { pushToast, removeToast } from './components/Toast/toast'
|
|
51
|
-
import Toasts from './components/Toast/Toasts.vue'
|
|
52
|
-
import Tooltip from './components/Tooltip/Tooltip.vue'
|
|
53
|
-
import Backdrop from './internal/Backdrop/Backdrop.vue'
|
|
54
|
-
import { searchString } from './shared/helpers'
|
|
55
|
-
import { setColorTheme, theme } from './shared/theme'
|
|
56
|
-
import './style.scss'
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
Accordion,
|
|
60
|
-
AccordionGroup,
|
|
61
|
-
Alert,
|
|
62
|
-
Avatar,
|
|
63
|
-
Backdrop,
|
|
64
|
-
Badge,
|
|
65
|
-
BreadcrumbItem,
|
|
66
|
-
Breadcrumbs,
|
|
67
|
-
Button,
|
|
68
|
-
ButtonGroup,
|
|
69
|
-
Calendar,
|
|
70
|
-
Card,
|
|
71
|
-
Checkbox,
|
|
72
|
-
Color,
|
|
73
|
-
Confirm,
|
|
74
|
-
CopyClipboard,
|
|
75
|
-
Counter,
|
|
76
|
-
defineTable,
|
|
77
|
-
Divider,
|
|
78
|
-
Drawer,
|
|
79
|
-
Dropdown,
|
|
80
|
-
DropdownItem,
|
|
81
|
-
DropdownTitle,
|
|
82
|
-
Dropzone,
|
|
83
|
-
File,
|
|
84
|
-
Flex,
|
|
85
|
-
Grid,
|
|
86
|
-
Input,
|
|
87
|
-
Kbd,
|
|
88
|
-
KbdGroup,
|
|
89
|
-
Modal,
|
|
90
|
-
OTP,
|
|
91
|
-
OTPItem,
|
|
92
|
-
paginate,
|
|
93
|
-
Pagination,
|
|
94
|
-
Password,
|
|
95
|
-
Popout,
|
|
96
|
-
Progress,
|
|
97
|
-
pushToast,
|
|
98
|
-
Radio,
|
|
99
|
-
RadioGroup,
|
|
100
|
-
removeToast,
|
|
101
|
-
searchString,
|
|
102
|
-
Select,
|
|
103
|
-
setColorTheme,
|
|
104
|
-
Sheet,
|
|
105
|
-
Sidebar,
|
|
106
|
-
Skeleton,
|
|
107
|
-
Spinner,
|
|
108
|
-
Switch,
|
|
109
|
-
Tab,
|
|
110
|
-
Table,
|
|
111
|
-
Tabs,
|
|
112
|
-
Textarea,
|
|
113
|
-
theme,
|
|
114
|
-
Toasts,
|
|
115
|
-
Tooltip,
|
|
116
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { onMounted } from 'vue'
|
|
3
|
-
import './backdrop.scss'
|
|
4
|
-
|
|
5
|
-
const emits = defineEmits<{
|
|
6
|
-
(e: 'close'): void
|
|
7
|
-
}>()
|
|
8
|
-
|
|
9
|
-
onMounted(() => {
|
|
10
|
-
window.addEventListener('keydown', (e) => {
|
|
11
|
-
if (e.key === 'Escape') {
|
|
12
|
-
emits('close')
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<template>
|
|
19
|
-
<div class="vui-backdrop" @click.self="emits('close')">
|
|
20
|
-
<slot />
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--backdrop-offset: 64px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.vui-backdrop {
|
|
6
|
-
z-index: var(--z-overlay);
|
|
7
|
-
position: fixed;
|
|
8
|
-
display: block;
|
|
9
|
-
width: 100dvw;
|
|
10
|
-
height: 100dvh;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
padding: var(--backdrop-offset);
|
|
14
|
-
overflow-y: auto;
|
|
15
|
-
|
|
16
|
-
&:after {
|
|
17
|
-
content: '';
|
|
18
|
-
position: fixed;
|
|
19
|
-
z-index: var(--z-behind);
|
|
20
|
-
inset: 0;
|
|
21
|
-
background-color: var(--color-bg-lowered);
|
|
22
|
-
opacity: 0.75;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
html:has(.vui-backdrop) {
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
:root.light {
|
|
31
|
-
.vui-backdrop:after {
|
|
32
|
-
background-color: var(--dark-color-bg);
|
|
33
|
-
}
|
|
34
|
-
}
|
package/src/main.ts
DELETED
package/src/shared/helpers.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { Placement } from '@floating-ui/vue'
|
|
2
|
-
|
|
3
|
-
export function createArray(length: number, startOffset: number = 0): number[] {
|
|
4
|
-
return Array
|
|
5
|
-
.from({ length })
|
|
6
|
-
.map((_, index) => startOffset + index)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Searches through the input and checkes wether it contains match
|
|
10
|
-
// It searches the input by splitting it by whitespace and matching each
|
|
11
|
-
// word against the string
|
|
12
|
-
export function searchString(match: string | string[], input: string): boolean {
|
|
13
|
-
if (!match)
|
|
14
|
-
return false
|
|
15
|
-
|
|
16
|
-
const joint: string = Array.isArray(match) ? match.join(' ') : match
|
|
17
|
-
|
|
18
|
-
const split = input.trim().split(/\s+/)
|
|
19
|
-
return split.every(s => joint.toLowerCase().includes(s.toLowerCase()))
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getMaybeRefLength(value: string | number): number {
|
|
23
|
-
return typeof value === 'number' ? value : value.length
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function isNil(value: any): value is undefined | null {
|
|
27
|
-
return value === undefined || value === null
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Checks wether a color is light or dark, depending on
|
|
32
|
-
*/
|
|
33
|
-
export function calculateColorLightness(r: number, g: number, b: number): 'dark' | 'light' {
|
|
34
|
-
const yiq = (r * 299 + g * 587 + b * 114) / 1000
|
|
35
|
-
return yiq >= 128 ? 'light' : 'dark'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Convert a CSS rgb string to a tuple of actual r,g,b values
|
|
40
|
-
*
|
|
41
|
-
* 'rgb(12,16,24)' --> [12, 16, 24]
|
|
42
|
-
*/
|
|
43
|
-
export function stringRgbToValues(rgbString: string): [number, number, number] {
|
|
44
|
-
return rgbString.match(/\d+/g)!.map(Number) as any as [number, number, number]
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// export function rgbToHex(r: number, g: number, b: number): string {
|
|
48
|
-
// return `#${[r, g, b].map((x) => {
|
|
49
|
-
// const hex = x.toString(16)
|
|
50
|
-
// return hex.length === 1 ? `0${hex}` : hex
|
|
51
|
-
// }).join('')}`
|
|
52
|
-
// }
|
|
53
|
-
|
|
54
|
-
export function randomMinMax(min: number, max: number): number {
|
|
55
|
-
min = Math.ceil(min)
|
|
56
|
-
max = Math.floor(max)
|
|
57
|
-
return Math.floor(Math.random() * (max - min + 1)) + min
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function delay(amount: number): Promise<any> {
|
|
61
|
-
return new Promise(r => setTimeout(r, amount))
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function setCharAt(str: string, char: string | number, index: number): string {
|
|
65
|
-
if (str.length === 0)
|
|
66
|
-
return char.toString()
|
|
67
|
-
return str.substring(0, index) + char + str.substring(index + 1)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Takes in a value and if it is a number, appends "px" to it, otherwise returns
|
|
72
|
-
* the original value.
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
export function formatUnitValue(value: string | number, unit: string = 'px'): string {
|
|
76
|
-
return typeof value === 'number'
|
|
77
|
-
? `${value}${unit}`
|
|
78
|
-
// If last value of string is NOT a number, do not add "px" at the end
|
|
79
|
-
// eslint-disable-next-line unicorn/prefer-number-properties
|
|
80
|
-
: isNaN(Number(value[value.length - 1]))
|
|
81
|
-
? value
|
|
82
|
-
: `${value}${unit}`
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function clamp(min: number, max: number, value: number): number {
|
|
86
|
-
return Math.min(Math.max(value, min), max)
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Checks wether an object is inside of Set, based on comparing values. Not reference
|
|
91
|
-
*
|
|
92
|
-
* @param set The Set
|
|
93
|
-
* @param obj Object which should be in the side
|
|
94
|
-
* @returns If object is inside the set
|
|
95
|
-
*/
|
|
96
|
-
export function isObjectInSet(set: Set<any>, obj: any): boolean {
|
|
97
|
-
for (const item of set) {
|
|
98
|
-
// Check if both have the same number of keys
|
|
99
|
-
if (Object.keys(item).length !== Object.keys(obj).length) {
|
|
100
|
-
continue
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
// Compare each key-value pair
|
|
104
|
-
let isEqual = true
|
|
105
|
-
|
|
106
|
-
for (const key in item) {
|
|
107
|
-
if (key in item && item[key] !== obj[key]) {
|
|
108
|
-
isEqual = false
|
|
109
|
-
break
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (isEqual) {
|
|
114
|
-
return true
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return false
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export function getPlacementAnimationName(position: Placement): string {
|
|
122
|
-
const suffix = position.includes('-') ? position.split('-')[0] : position
|
|
123
|
-
return `fade-${suffix}`
|
|
124
|
-
}
|
package/src/shared/slots.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ShallowRef, VNode } from 'vue'
|
|
2
|
-
import { computed, Fragment, shallowRef, watchEffect } from 'vue'
|
|
3
|
-
|
|
4
|
-
type VNodesProps<T extends object> = Array<VNode & { props: T }>
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Flattens slot children and keeps them in sync reactively.
|
|
8
|
-
* @param slotFn The slot function (e.g., slots.default)
|
|
9
|
-
* @returns Computed array of flattened VNodes
|
|
10
|
-
*/
|
|
11
|
-
export function useFlattenedSlot<T extends object>(slotFn?: () => VNode[] | undefined): ShallowRef<VNodesProps<T>> {
|
|
12
|
-
const rawChildren = shallowRef<VNodesProps<T>>([])
|
|
13
|
-
|
|
14
|
-
// Flatten VNodes recursively (handles Fragments)
|
|
15
|
-
function flatten(vnodes: VNode[]): VNodesProps<T> {
|
|
16
|
-
const result: VNode[] = []
|
|
17
|
-
|
|
18
|
-
const walk = (nodes: VNode[] | VNode | undefined): void => {
|
|
19
|
-
if (!nodes)
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
if (Array.isArray(nodes)) {
|
|
23
|
-
nodes.forEach(walk)
|
|
24
|
-
}
|
|
25
|
-
else if (nodes.type === Fragment || Array.isArray(nodes.children)) {
|
|
26
|
-
walk(nodes.children as VNode[])
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
result.push(nodes)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
walk(vnodes)
|
|
34
|
-
return result as VNodesProps<T>
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Re-compute children whenever slot content changes
|
|
38
|
-
watchEffect(() => {
|
|
39
|
-
const content = slotFn?.() ?? []
|
|
40
|
-
rawChildren.value = flatten(content)
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
return computed(() => rawChildren.value)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Checks whether all of the provided VNodes are of the same type. Throws an
|
|
48
|
-
* error if not. This function should be used in components that only allow a
|
|
49
|
-
* single type of component
|
|
50
|
-
*
|
|
51
|
-
* @param vnodes Array of VNodes to check
|
|
52
|
-
* @param name Expected name of the components
|
|
53
|
-
*/
|
|
54
|
-
export function enforceSlotType(vnodes: ShallowRef<VNodesProps<any>>, name: string): void {
|
|
55
|
-
watchEffect(() => {
|
|
56
|
-
// @ts-expect-error Accessing internals
|
|
57
|
-
if (vnodes.value.some(item => item.type.__name !== name)) {
|
|
58
|
-
throw new Error(`You can only pass \`<${name} />\` components as children.`)
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
}
|
package/src/shared/theme.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useColorMode } from '@vueuse/core'
|
|
2
|
-
import { readonly } from 'vue'
|
|
3
|
-
|
|
4
|
-
export type VuiTheme = 'light' | 'dark' | 'auto'
|
|
5
|
-
|
|
6
|
-
const themeImpl = useColorMode({
|
|
7
|
-
modes: {
|
|
8
|
-
dark: 'dark',
|
|
9
|
-
light: 'light',
|
|
10
|
-
// TODO: add black theme
|
|
11
|
-
// TODO: add high contrast light & dark theme
|
|
12
|
-
},
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
export const theme = readonly(themeImpl)
|
|
16
|
-
|
|
17
|
-
export function setColorTheme(newTheme: VuiTheme): void {
|
|
18
|
-
if (newTheme === themeImpl.value)
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
themeImpl.value = newTheme
|
|
22
|
-
}
|
package/src/shared/types.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { ComponentPublicInstance } from 'vue'
|
|
2
|
-
|
|
3
|
-
export enum Size {
|
|
4
|
-
s = 's',
|
|
5
|
-
m = 'm',
|
|
6
|
-
l = 'l',
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type Sizes = 's' | 'm' | 'l'
|
|
10
|
-
|
|
11
|
-
export type DeepRequired<T> = { [K in keyof T]: DeepRequired<T[K]> } & Required<T>
|
|
12
|
-
|
|
13
|
-
export type VueClass = string | Record<string, | boolean> | Array<string | Record<string, string | boolean>>
|
|
14
|
-
|
|
15
|
-
// FLoating UI imported types were ruining the build so here we go
|
|
16
|
-
export type PopoutMaybeElement<T> = T | ComponentPublicInstance | null | undefined
|
|
17
|
-
export type Placement = 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end'
|
|
18
|
-
|
|
19
|
-
export type Space = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl'
|
|
20
|
-
export enum SpaceSize {
|
|
21
|
-
xxs = 'xxs',
|
|
22
|
-
xs = 'xs',
|
|
23
|
-
s = 's',
|
|
24
|
-
m = 'm',
|
|
25
|
-
l = 'l',
|
|
26
|
-
xl = 'xl',
|
|
27
|
-
xxl = 'xxl',
|
|
28
|
-
xxxl = 'xxxl',
|
|
29
|
-
}
|
package/src/style/animation.scss
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
.fade-enter-active,
|
|
2
|
-
.fade-leave-active {
|
|
3
|
-
transition: opacity 0.15s cubic-bezier(0.65, 0, 0.35, 1);
|
|
4
|
-
will-change: opacity;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.fade-enter-from,
|
|
8
|
-
.fade-leave-to {
|
|
9
|
-
opacity: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Positioned fade-ins
|
|
13
|
-
|
|
14
|
-
// Defaults
|
|
15
|
-
.fade-top-enter-active,
|
|
16
|
-
.fade-top-leave-active,
|
|
17
|
-
.fade-bottom-enter-active,
|
|
18
|
-
.fade-bottom-leave-active,
|
|
19
|
-
.fade-right-enter-active,
|
|
20
|
-
.fade-right-leave-active,
|
|
21
|
-
.fade-left-enter-active,
|
|
22
|
-
.fade-left-leave-active {
|
|
23
|
-
transition: var(--transition);
|
|
24
|
-
transition-property: transform, opacity;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Specifics
|
|
28
|
-
.fade-top-enter-from,
|
|
29
|
-
.fade-top-leave-to {
|
|
30
|
-
opacity: 0;
|
|
31
|
-
transform: translateY(8px);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.fade-bottom-enter-from,
|
|
35
|
-
.fade-bottom-leave-to {
|
|
36
|
-
opacity: 0;
|
|
37
|
-
transform: translateY(8px);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.fade-right-enter-from,
|
|
41
|
-
.fade-right-leave-to {
|
|
42
|
-
opacity: 0;
|
|
43
|
-
transform: translateX(8px);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.fade-left-enter-from,
|
|
47
|
-
.fade-left-leave-to {
|
|
48
|
-
opacity: 0;
|
|
49
|
-
transform: translateX(-8px);
|
|
50
|
-
}
|
package/src/style/core.scss
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
@use 'sass:meta';
|
|
2
|
-
// Core of the UI library, it should only contain styles which are relevant to
|
|
3
|
-
// the library and each component should import it
|
|
4
|
-
|
|
5
|
-
// To overwrite any of these styles, simply create a style file and import it
|
|
6
|
-
// after this one
|
|
7
|
-
@use './reset.scss';
|
|
8
|
-
@use './fonts.scss';
|
|
9
|
-
@use './theme.scss';
|
|
10
|
-
|
|
11
|
-
:root {
|
|
12
|
-
color-scheme: dark;
|
|
13
|
-
|
|
14
|
-
--container-xs: 360px;
|
|
15
|
-
--container-s: 498px;
|
|
16
|
-
--container-m: 856px;
|
|
17
|
-
--container-l: 1140px;
|
|
18
|
-
--container-xl: 1540px;
|
|
19
|
-
--container-xxl: 1920px;
|
|
20
|
-
|
|
21
|
-
--border-radius-xs: 3px;
|
|
22
|
-
--border-radius-s: 5px;
|
|
23
|
-
--border-radius-m: 8px;
|
|
24
|
-
--border-radius-l: 12px;
|
|
25
|
-
|
|
26
|
-
--font-size-xxs: 1rem;
|
|
27
|
-
--font-size-xs: 1.15rem;
|
|
28
|
-
--font-size-s: 1.3rem;
|
|
29
|
-
--font-size-m: 1.5rem;
|
|
30
|
-
--font-size-l: 1.8rem;
|
|
31
|
-
--font-size-xl: 2rem;
|
|
32
|
-
--font-size-xxl: 2.6rem;
|
|
33
|
-
--font-size-xxxl: 3.4rem;
|
|
34
|
-
--font-size-xxxxl: 4.8rem;
|
|
35
|
-
|
|
36
|
-
--space-xxs: 4px;
|
|
37
|
-
--space-xs: 8px;
|
|
38
|
-
--space-s: 12px;
|
|
39
|
-
--space-m: 18px;
|
|
40
|
-
--space-l: 24px;
|
|
41
|
-
--space-xl: 34px;
|
|
42
|
-
--space-xxl: 48px;
|
|
43
|
-
--space-xxxl: 64px;
|
|
44
|
-
|
|
45
|
-
--transition-fast: 0.055s all ease-in-out;
|
|
46
|
-
--transition: 0.1s all cubic-bezier(0.65, 0, 0.35, 1);
|
|
47
|
-
--transition-slow: 0.25s all cubic-bezier(0.65, 0, 0.35, 1);
|
|
48
|
-
|
|
49
|
-
--global-font: 'Inter', sans-serif;
|
|
50
|
-
--global-font-mono: 'Geist Mono', 'Courier New', 'Courier', monospace;
|
|
51
|
-
|
|
52
|
-
--font-weight: 300;
|
|
53
|
-
--font-weight: 400;
|
|
54
|
-
--font-weight-medium: 500;
|
|
55
|
-
--font-weight-semibold: 600;
|
|
56
|
-
--font-weight-bold: 700;
|
|
57
|
-
--font-weight-extrabold: 800;
|
|
58
|
-
--font-weight-black: 900;
|
|
59
|
-
|
|
60
|
-
--line-height-tight: 1.125em;
|
|
61
|
-
--line-height-title: 1.25em;
|
|
62
|
-
--line-height-base: 1.4em;
|
|
63
|
-
|
|
64
|
-
--z-behind: -1;
|
|
65
|
-
--z-default: 1;
|
|
66
|
-
--z-active: 50;
|
|
67
|
-
--z-mask: 75;
|
|
68
|
-
--z-sticky: 100;
|
|
69
|
-
--z-nav: 200;
|
|
70
|
-
--z-overlay: 300;
|
|
71
|
-
--z-popout: 400;
|
|
72
|
-
--z-toast: 500;
|
|
73
|
-
--z-modal: 600;
|
|
74
|
-
|
|
75
|
-
--interactive-el-height: 36px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Disable motion for users who have requested it
|
|
79
|
-
@media (prefers-reduced-motion: reduce) {
|
|
80
|
-
:root {
|
|
81
|
-
--transition-fast: 0s all linear;
|
|
82
|
-
--transition: 0s all linear;
|
|
83
|
-
--transition-slow: 0s all linear;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
:root {
|
|
88
|
-
font-family: var(--global-font);
|
|
89
|
-
font-size: 63.5%;
|
|
90
|
-
position: relative;
|
|
91
|
-
background-color: var(--color-bg);
|
|
92
|
-
|
|
93
|
-
overflow-x: hidden;
|
|
94
|
-
width: 100%;
|
|
95
|
-
font-weight: var(--font-weight);
|
|
96
|
-
|
|
97
|
-
font-feature-settings: normal;
|
|
98
|
-
font-variation-settings: normal;
|
|
99
|
-
|
|
100
|
-
font-synthesis: none;
|
|
101
|
-
text-rendering: optimizeLegibility;
|
|
102
|
-
-webkit-font-smoothing: antialiased;
|
|
103
|
-
-moz-osx-font-smoothing: grayscale;
|
|
104
|
-
|
|
105
|
-
* {
|
|
106
|
-
-webkit-box-sizing: border-box;
|
|
107
|
-
-moz-box-sizing: border-box;
|
|
108
|
-
box-sizing: border-box;
|
|
109
|
-
outline: none;
|
|
110
|
-
|
|
111
|
-
&:focus-visible {
|
|
112
|
-
outline: 2px solid var(--color-text);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
body {
|
|
118
|
-
color: var(--color-text);
|
|
119
|
-
min-height: 100dvh;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Set base icon color
|
|
123
|
-
.iconify {
|
|
124
|
-
color: var(--color-text-light);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
@include meta.load-css('typography.scss');
|
|
128
|
-
@include meta.load-css('layout.scss');
|
|
129
|
-
@include meta.load-css('animation.scss');
|
|
130
|
-
@include meta.load-css('tooltip.scss');
|
|
131
|
-
@include meta.load-css('utils.scss');
|
|
132
|
-
@include meta.load-css('text.scss');
|
|
133
|
-
@include meta.load-css('media-query.scss');
|
package/src/style/fonts.scss
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Regular
|
|
2
|
-
@font-face {
|
|
3
|
-
font-display: swap;
|
|
4
|
-
font-family: 'Inter';
|
|
5
|
-
font-style: normal;
|
|
6
|
-
font-weight: 300;
|
|
7
|
-
src: url('/fonts/Inter_18pt-Light.ttf') format('truetype');
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@font-face {
|
|
11
|
-
font-display: swap;
|
|
12
|
-
font-family: 'Inter';
|
|
13
|
-
font-style: normal;
|
|
14
|
-
font-weight: 400;
|
|
15
|
-
src: url('/fonts/Inter_18pt-Regular.ttf') format('truetype');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@font-face {
|
|
19
|
-
font-display: swap;
|
|
20
|
-
font-family: 'Inter';
|
|
21
|
-
font-style: normal;
|
|
22
|
-
font-weight: 500;
|
|
23
|
-
src: url('/fonts/Inter_18pt-Medium.ttf') format('truetype');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@font-face {
|
|
27
|
-
font-display: swap;
|
|
28
|
-
font-family: 'Inter';
|
|
29
|
-
font-style: normal;
|
|
30
|
-
font-weight: 600;
|
|
31
|
-
src: url('/fonts/Inter_18pt-SemiBold.ttf') format('truetype');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@font-face {
|
|
35
|
-
font-display: swap;
|
|
36
|
-
font-family: 'Inter';
|
|
37
|
-
font-style: normal;
|
|
38
|
-
font-weight: 700;
|
|
39
|
-
src: url('/fonts/Inter_18pt-Bold.ttf') format('truetype');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@font-face {
|
|
43
|
-
font-display: swap;
|
|
44
|
-
font-family: 'Inter';
|
|
45
|
-
font-style: normal;
|
|
46
|
-
font-weight: 800;
|
|
47
|
-
src: url('/fonts/Inter_18pt-ExtraBold.ttf') format('truetype');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@font-face {
|
|
51
|
-
font-display: swap;
|
|
52
|
-
font-family: 'Inter';
|
|
53
|
-
font-style: normal;
|
|
54
|
-
font-weight: 900;
|
|
55
|
-
src: url('/fonts/Inter_18pt-Black.ttf') format('truetype');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Monospace
|
|
59
|
-
@font-face {
|
|
60
|
-
font-display: swap;
|
|
61
|
-
font-family: 'Geist Mono';
|
|
62
|
-
font-style: normal;
|
|
63
|
-
font-weight: 400;
|
|
64
|
-
src: url('/fonts/GeistMono-Regular.ttf') format('truetype');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@font-face {
|
|
68
|
-
font-display: swap;
|
|
69
|
-
font-family: 'Geist Mono';
|
|
70
|
-
font-style: normal;
|
|
71
|
-
font-weight: 600;
|
|
72
|
-
src: url('/fonts/GeistMono-SemiBold.ttf') format('truetype');
|
|
73
|
-
}
|