@indielayer/ui 1.16.0 → 1.18.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/README.md +2 -2
- package/docs/assets/css/tailwind.css +6 -0
- package/docs/components/common/CodePreview.vue +14 -9
- package/docs/components/common/DocsFeatures.vue +41 -0
- package/docs/components/common/DocsHero.vue +216 -0
- package/docs/components/common/DocumentPage.vue +99 -112
- package/docs/components/common/ExampleBlocks.vue +157 -0
- package/docs/components/menu/DocsMenu.vue +3 -0
- package/docs/components/toolbar/Toolbar.vue +11 -2
- package/docs/components/toolbar/ToolbarColorToggle.vue +4 -4
- package/docs/components/toolbar/ToolbarSearch.vue +59 -62
- package/docs/composables/useDocMeta.ts +47 -0
- package/docs/icons.ts +28 -0
- package/docs/layouts/default.vue +1 -3
- package/docs/layouts/simple.vue +3 -1
- package/docs/main.ts +5 -0
- package/docs/pages/colors.vue +56 -47
- package/docs/pages/component/infiniteLoader/composable.vue +168 -0
- package/docs/pages/component/infiniteLoader/index.vue +36 -0
- package/docs/pages/component/infiniteLoader/usage.vue +161 -0
- package/docs/pages/component/select/size.vue +1 -1
- package/docs/pages/component/select/usage.vue +14 -7
- package/docs/pages/component/virtualGrid/index.vue +29 -0
- package/docs/pages/component/virtualGrid/usage.vue +20 -0
- package/docs/pages/component/virtualList/dynamicHeight.vue +75 -0
- package/docs/pages/component/virtualList/index.vue +36 -0
- package/docs/pages/component/virtualList/usage.vue +17 -0
- package/docs/pages/error.vue +5 -3
- package/docs/pages/icons.vue +64 -54
- package/docs/pages/index.vue +93 -82
- package/docs/pages/typography.vue +38 -28
- package/docs/router/index.ts +31 -3
- package/docs/search/components.json +1 -1
- package/docs/search/index.json +1 -0
- package/lib/components/container/theme/Container.base.theme.js +1 -1
- package/lib/components/divider/theme/Divider.base.theme.js +1 -1
- package/lib/components/input/Input.vue.js +23 -24
- package/lib/components/select/Select.vue.d.ts +16 -27
- package/lib/components/select/Select.vue.js +452 -345
- package/lib/components/table/Table.vue.js +1 -1
- package/lib/composables/useVirtualList.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +88 -76
- package/lib/index.umd.js +4 -4
- package/lib/install.js +15 -7
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/virtual/components/infiniteLoader/InfiniteLoader.test.d.ts +1 -0
- package/lib/virtual/components/infiniteLoader/InfiniteLoader.vue.d.ts +49 -0
- package/lib/virtual/components/infiniteLoader/InfiniteLoader.vue.js +21 -0
- package/lib/virtual/components/infiniteLoader/InfiniteLoader.vue2.js +4 -0
- package/lib/virtual/components/virtualGrid/VirtualGrid.vue.d.ts +185 -0
- package/lib/virtual/components/virtualGrid/VirtualGrid.vue.js +241 -0
- package/lib/virtual/components/virtualGrid/VirtualGrid.vue2.js +4 -0
- package/lib/virtual/components/virtualGrid/types.d.ts +138 -0
- package/lib/virtual/components/virtualList/VirtualList.test.d.ts +1 -0
- package/lib/virtual/components/virtualList/VirtualList.vue.d.ts +135 -0
- package/lib/virtual/components/virtualList/VirtualList.vue.js +159 -0
- package/lib/virtual/components/virtualList/VirtualList.vue2.js +4 -0
- package/lib/virtual/components/virtualList/isDynamicRowHeight.d.ts +2 -0
- package/lib/virtual/components/virtualList/isDynamicRowHeight.js +6 -0
- package/lib/virtual/components/virtualList/types.d.ts +115 -0
- package/lib/virtual/components/virtualList/useDynamicRowHeight.d.ts +7 -0
- package/lib/virtual/components/virtualList/useDynamicRowHeight.js +68 -0
- package/lib/virtual/components/virtualList/useDynamicRowHeight.test.d.ts +1 -0
- package/lib/virtual/composables/infinite-loader/scanForUnloadedIndices.d.ts +8 -0
- package/lib/virtual/composables/infinite-loader/scanForUnloadedIndices.js +41 -0
- package/lib/virtual/composables/infinite-loader/scanForUnloadedIndices.test.d.ts +1 -0
- package/lib/virtual/composables/infinite-loader/types.d.ts +30 -0
- package/lib/virtual/composables/infinite-loader/useInfiniteLoader.d.ts +6 -0
- package/lib/virtual/composables/infinite-loader/useInfiniteLoader.js +42 -0
- package/lib/virtual/composables/infinite-loader/useInfiniteLoader.test.d.ts +1 -0
- package/lib/virtual/core/createCachedBounds.d.ts +6 -0
- package/lib/virtual/core/createCachedBounds.js +55 -0
- package/lib/virtual/core/getEstimatedSize.d.ts +6 -0
- package/lib/virtual/core/getEstimatedSize.js +22 -0
- package/lib/virtual/core/getOffsetForIndex.d.ts +11 -0
- package/lib/virtual/core/getOffsetForIndex.js +40 -0
- package/lib/virtual/core/getStartStopIndices.d.ts +13 -0
- package/lib/virtual/core/getStartStopIndices.js +31 -0
- package/lib/virtual/core/getStartStopIndices.test.d.ts +1 -0
- package/lib/virtual/core/types.d.ts +11 -0
- package/lib/virtual/core/useCachedBounds.d.ts +7 -0
- package/lib/virtual/core/useCachedBounds.js +18 -0
- package/lib/virtual/core/useIsRtl.d.ts +2 -0
- package/lib/virtual/core/useIsRtl.js +15 -0
- package/lib/virtual/core/useItemSize.d.ts +5 -0
- package/lib/virtual/core/useItemSize.js +27 -0
- package/lib/virtual/core/useVirtualizer.d.ts +33 -0
- package/lib/virtual/core/useVirtualizer.js +171 -0
- package/lib/virtual/index.d.ts +9 -0
- package/lib/virtual/test-utils/mockResizeObserver.d.ts +15 -0
- package/lib/virtual/types.d.ts +2 -0
- package/lib/virtual/utils/adjustScrollOffsetForRtl.d.ts +7 -0
- package/lib/virtual/utils/adjustScrollOffsetForRtl.js +24 -0
- package/lib/virtual/utils/areArraysEqual.d.ts +1 -0
- package/lib/virtual/utils/assert.d.ts +1 -0
- package/lib/virtual/utils/assert.js +7 -0
- package/lib/virtual/utils/getRTLOffsetType.d.ts +2 -0
- package/lib/virtual/utils/getRTLOffsetType.js +13 -0
- package/lib/virtual/utils/getScrollbarSize.d.ts +2 -0
- package/lib/virtual/utils/getScrollbarSize.js +11 -0
- package/lib/virtual/utils/isRtl.d.ts +1 -0
- package/lib/virtual/utils/isRtl.js +12 -0
- package/lib/virtual/utils/parseNumericStyleValue.d.ts +2 -0
- package/lib/virtual/utils/parseNumericStyleValue.js +15 -0
- package/lib/virtual/utils/shallowCompare.d.ts +1 -0
- package/lib/virtual/utils/shallowCompare.js +14 -0
- package/package.json +8 -3
- package/src/components/container/theme/Container.base.theme.ts +1 -1
- package/src/components/divider/theme/Divider.base.theme.ts +1 -1
- package/src/components/input/Input.vue +1 -2
- package/src/components/select/Select.vue +97 -20
- package/src/components/table/Table.vue +1 -1
- package/src/composables/useVirtualList.ts +1 -1
- package/src/index.ts +1 -0
- package/src/install.ts +9 -3
- package/src/version.ts +1 -1
- package/src/virtual/README.md +285 -0
- package/src/virtual/components/infiniteLoader/InfiniteLoader.test.ts +96 -0
- package/src/virtual/components/infiniteLoader/InfiniteLoader.vue +18 -0
- package/src/virtual/components/virtualGrid/VirtualGrid.vue +322 -0
- package/src/virtual/components/virtualGrid/types.ts +160 -0
- package/src/virtual/components/virtualList/VirtualList.test.ts +164 -0
- package/src/virtual/components/virtualList/VirtualList.vue +227 -0
- package/src/virtual/components/virtualList/isDynamicRowHeight.ts +13 -0
- package/src/virtual/components/virtualList/types.ts +127 -0
- package/src/virtual/components/virtualList/useDynamicRowHeight.test.ts +197 -0
- package/src/virtual/components/virtualList/useDynamicRowHeight.ts +149 -0
- package/src/virtual/composables/infinite-loader/scanForUnloadedIndices.test.ts +141 -0
- package/src/virtual/composables/infinite-loader/scanForUnloadedIndices.ts +82 -0
- package/src/virtual/composables/infinite-loader/types.ts +36 -0
- package/src/virtual/composables/infinite-loader/useInfiniteLoader.test.ts +236 -0
- package/src/virtual/composables/infinite-loader/useInfiniteLoader.ts +88 -0
- package/src/virtual/core/createCachedBounds.ts +72 -0
- package/src/virtual/core/getEstimatedSize.ts +29 -0
- package/src/virtual/core/getOffsetForIndex.ts +90 -0
- package/src/virtual/core/getStartStopIndices.test.ts +45 -0
- package/src/virtual/core/getStartStopIndices.ts +71 -0
- package/src/virtual/core/types.ts +17 -0
- package/src/virtual/core/useCachedBounds.ts +21 -0
- package/src/virtual/core/useIsRtl.ts +25 -0
- package/src/virtual/core/useItemSize.ts +34 -0
- package/src/virtual/core/useVirtualizer.ts +294 -0
- package/src/virtual/index.ts +25 -0
- package/src/virtual/test-utils/mockResizeObserver.ts +162 -0
- package/src/virtual/types.ts +3 -0
- package/src/virtual/utils/adjustScrollOffsetForRtl.ts +37 -0
- package/src/virtual/utils/areArraysEqual.ts +13 -0
- package/src/virtual/utils/assert.ts +10 -0
- package/src/virtual/utils/getRTLOffsetType.ts +51 -0
- package/src/virtual/utils/getScrollbarSize.ts +24 -0
- package/src/virtual/utils/isRtl.ts +13 -0
- package/src/virtual/utils/parseNumericStyleValue.ts +21 -0
- package/src/virtual/utils/shallowCompare.ts +29 -0
- package/volar.d.ts +3 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import { XVirtualList, useDynamicRowHeight } from '@indielayer/ui'
|
|
4
|
+
|
|
5
|
+
const loremTexts = [
|
|
6
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
|
|
7
|
+
'Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
8
|
+
'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.',
|
|
9
|
+
'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium.',
|
|
10
|
+
'Totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.',
|
|
11
|
+
'Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit.',
|
|
12
|
+
'Sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit.',
|
|
13
|
+
'Ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.',
|
|
14
|
+
'Lorem ipsum dolor sit amet.',
|
|
15
|
+
'Consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident.',
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
const items = Array.from({ length: 1000 }, (_, i) => ({
|
|
19
|
+
id: i,
|
|
20
|
+
text: loremTexts[i % loremTexts.length],
|
|
21
|
+
}))
|
|
22
|
+
|
|
23
|
+
const collapsedRows = ref<Set<number>>(new Set())
|
|
24
|
+
|
|
25
|
+
const toggleRow = (index: number) => {
|
|
26
|
+
const newSet = new Set(collapsedRows.value)
|
|
27
|
+
|
|
28
|
+
if (newSet.has(index)) {
|
|
29
|
+
newSet.delete(index)
|
|
30
|
+
} else {
|
|
31
|
+
newSet.add(index)
|
|
32
|
+
}
|
|
33
|
+
collapsedRows.value = newSet
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const isRowCollapsed = (index: number) => {
|
|
37
|
+
return collapsedRows.value.has(index)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const getText = (index: number) => {
|
|
41
|
+
return items[index].text
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const rowHeight = useDynamicRowHeight({
|
|
45
|
+
defaultRowHeight: 50,
|
|
46
|
+
})
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<x-virtual-list
|
|
51
|
+
:row-count="items.length"
|
|
52
|
+
:row-height="rowHeight"
|
|
53
|
+
style="height: 500px; border: 1px solid #ccc;"
|
|
54
|
+
>
|
|
55
|
+
<template #row="{ index, style }">
|
|
56
|
+
<div
|
|
57
|
+
:style="style"
|
|
58
|
+
:class="[
|
|
59
|
+
'flex items-start py-3 px-4 border-b border-gray-200 cursor-pointer transition-colors gap-2',
|
|
60
|
+
index % 2 === 0 ? 'bg-white' : 'bg-gray-50',
|
|
61
|
+
'hover:bg-gray-200',
|
|
62
|
+
isRowCollapsed(index) ? 'whitespace-nowrap overflow-hidden text-ellipsis' : ''
|
|
63
|
+
]"
|
|
64
|
+
@click="toggleRow(index)"
|
|
65
|
+
>
|
|
66
|
+
<span class="flex-shrink-0 w-6 h-6 inline-flex items-center justify-center text-sm">
|
|
67
|
+
{{ isRowCollapsed(index) ? '➕' : '➖' }}
|
|
68
|
+
</span>
|
|
69
|
+
<span class="flex-1 leading-normal">
|
|
70
|
+
<strong class="text-gray-700 mr-2">{{ index }}:</strong>{{ getText(index) }}
|
|
71
|
+
</span>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
</x-virtual-list>
|
|
75
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { XVirtualList } from '@indielayer/ui'
|
|
3
|
+
import UsageDemoCode from './usage.vue?raw'
|
|
4
|
+
import UsageDemo from './usage.vue'
|
|
5
|
+
import DynamicHeightDemoCode from './dynamicHeight.vue?raw'
|
|
6
|
+
import DynamicHeightDemo from './dynamicHeight.vue'
|
|
7
|
+
|
|
8
|
+
const title = 'VirtualList'
|
|
9
|
+
const description = 'VirtualList is a component that allows you to render a list of items in a virtualized way. It is a high-performance component that is used to render large lists of items.'
|
|
10
|
+
const components = [XVirtualList]
|
|
11
|
+
const demos = [{
|
|
12
|
+
name: 'Usage',
|
|
13
|
+
description: '',
|
|
14
|
+
code: UsageDemoCode,
|
|
15
|
+
component: UsageDemo,
|
|
16
|
+
}, {
|
|
17
|
+
name: 'Dynamic Height',
|
|
18
|
+
description: '',
|
|
19
|
+
code: DynamicHeightDemoCode,
|
|
20
|
+
component: DynamicHeightDemo,
|
|
21
|
+
}]
|
|
22
|
+
const back = ''
|
|
23
|
+
const next = ''
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<document-page
|
|
28
|
+
github="https://github.com/indielayer/ui/blob/main/packages/ui/docs/pages/component/virtualList"
|
|
29
|
+
:title="title"
|
|
30
|
+
:description="description"
|
|
31
|
+
:components="components"
|
|
32
|
+
:demos="demos"
|
|
33
|
+
:back="back"
|
|
34
|
+
:next="next"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const listItems = Array.from({ length: 10000 }, (_, i) => `Item ${i + 1}`)
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<x-virtual-list
|
|
7
|
+
:row-count="listItems.length"
|
|
8
|
+
:row-height="48"
|
|
9
|
+
class="h-96 border border-gray-200 rounded-md bg-white"
|
|
10
|
+
>
|
|
11
|
+
<template #row="{ index, style }">
|
|
12
|
+
<div :style="style" class="h-12 flex items-center justify-center border-b border-gray-200">
|
|
13
|
+
{{ listItems[index] }}
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
</x-virtual-list>
|
|
17
|
+
</template>
|
package/docs/pages/error.vue
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="text-center px-8 py-20">
|
|
3
|
-
<img class="mb-5 mx-auto max-w-80 max-h-80" src="../assets/images/error.svg" />
|
|
4
|
-
<
|
|
2
|
+
<div class="docs-container text-center px-8 py-20">
|
|
3
|
+
<img class="mb-5 mx-auto max-w-80 max-h-80" src="../assets/images/error.svg" alt="" />
|
|
4
|
+
<h1 class="text-h2 mb-2">Page not found</h1>
|
|
5
|
+
<p class="text-gray-500 dark:text-gray-400 mb-8">The page you are looking for does not exist.</p>
|
|
6
|
+
<x-button to="/getting-started" color="primary">Back to docs</x-button>
|
|
5
7
|
</div>
|
|
6
8
|
</template>
|
package/docs/pages/icons.vue
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useDocMeta } from '../composables/useDocMeta'
|
|
3
|
+
|
|
4
|
+
useDocMeta({
|
|
5
|
+
title: 'Icons',
|
|
6
|
+
description: 'Custom icon set integration for Indielayer UI components.',
|
|
7
|
+
path: '/icons',
|
|
8
|
+
})
|
|
9
|
+
|
|
2
10
|
const iconExample = `// icons.js
|
|
3
11
|
export default {
|
|
4
12
|
check: '<polyline points="20 6 9 17 4 12"></polyline>'
|
|
@@ -35,64 +43,66 @@ const iconExample2 = `<template>
|
|
|
35
43
|
</script>
|
|
36
44
|
|
|
37
45
|
<template>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
<div class="docs-container">
|
|
47
|
+
<h2 class="text-4xl font-semibold">Icons</h2>
|
|
48
|
+
<h1 class="text-lg my-2 text-gray-500 dark:text-gray-400">Building your own SVG icon library from multiple open source libraries</h1>
|
|
49
|
+
<x-divider class="mt-4 mb-8"/>
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
51
|
+
<p class="text-xl mt-8 my-4">SVG Icon Libraries</p>
|
|
52
|
+
<div class="font-bold text-lg">
|
|
53
|
+
<ul>
|
|
54
|
+
<li><x-link
|
|
55
|
+
external
|
|
56
|
+
color="sky"
|
|
57
|
+
underline
|
|
58
|
+
href="https://icones.js.org/"
|
|
59
|
+
target="_blank"
|
|
60
|
+
>Icônes - All the libraries</x-link></li>
|
|
61
|
+
<li><x-link
|
|
62
|
+
external
|
|
63
|
+
color="sky"
|
|
64
|
+
underline
|
|
65
|
+
href="https://heroicons.com/"
|
|
66
|
+
target="_blank"
|
|
67
|
+
>Hero Icons (MIT)</x-link></li>
|
|
68
|
+
<li><x-link
|
|
69
|
+
external
|
|
70
|
+
color="sky"
|
|
71
|
+
underline
|
|
72
|
+
href="https://tabler-icons.io/"
|
|
73
|
+
target="_blank"
|
|
74
|
+
>Tabler Icons (MIT)</x-link></li>
|
|
75
|
+
<li><x-link
|
|
76
|
+
external
|
|
77
|
+
color="sky"
|
|
78
|
+
underline
|
|
79
|
+
href="https://feathericons.com/"
|
|
80
|
+
target="_blank"
|
|
81
|
+
>Feather Icons (MIT)</x-link></li>
|
|
82
|
+
</ul>
|
|
83
|
+
</div>
|
|
75
84
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
<h3 class="text-2xl mt-8 mb-4">1. Create the icons file -> <strong>icons.js</strong></h3>
|
|
86
|
+
<code-snippet
|
|
87
|
+
lang="js"
|
|
88
|
+
:code="iconExample"
|
|
89
|
+
/>
|
|
81
90
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
<h3 class="text-2xl mt-8 mb-4">2. Add icons on UI install options -> <strong>main.js</strong></h3>
|
|
92
|
+
<code-snippet
|
|
93
|
+
lang="js"
|
|
94
|
+
:code="installExample"
|
|
95
|
+
/>
|
|
87
96
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
<h3 class="text-2xl mt-8 mb-4">3. Add icons from open source libraries</h3>
|
|
98
|
+
<p class="mb-2 text-xl">Start adding the icons you need.</p>
|
|
99
|
+
<p class="mb-2">SVG wrapper optional, copy only the content part of the SVG:</p>
|
|
100
|
+
<p class="mb-4 border dark:border-gray-600 rounded-md p-4"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><strong><polyline points="20 6 9 17 4 12"></polyline></strong></svg></p>
|
|
101
|
+
<code-snippet lang="js" :code="iconExample1"/>
|
|
93
102
|
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
<div class="my-4">
|
|
104
|
+
Icon "check" <x-icon icon="check"/>
|
|
105
|
+
</div>
|
|
106
|
+
<code-snippet lang="js" :code="iconExample2"/>
|
|
96
107
|
</div>
|
|
97
|
-
<code-snippet lang="js" :code="iconExample2"/>
|
|
98
108
|
</template>
|
package/docs/pages/index.vue
CHANGED
|
@@ -1,57 +1,73 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import DocsHero from '../components/common/DocsHero.vue'
|
|
3
|
+
import DocsFeatures from '../components/common/DocsFeatures.vue'
|
|
4
|
+
import { useDocMeta } from '../composables/useDocMeta'
|
|
5
|
+
|
|
6
|
+
useDocMeta({
|
|
7
|
+
title: 'Indielayer UI',
|
|
8
|
+
description: 'Tailwind CSS UI components for Vue.js 3 and Nuxt.js 3. Build and prototype fast web applications.',
|
|
9
|
+
path: '/getting-started',
|
|
10
|
+
})
|
|
11
|
+
</script>
|
|
12
|
+
|
|
1
13
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
14
|
+
<docs-hero />
|
|
15
|
+
<docs-features />
|
|
16
|
+
|
|
17
|
+
<div class="docs-container">
|
|
18
|
+
<section id="installation">
|
|
19
|
+
<h2 class="text-h3 mb-2">Getting started</h2>
|
|
20
|
+
<p class="text-gray-500 dark:text-gray-400 mb-8">
|
|
21
|
+
Tailwind CSS UI components for Vue.js 3 / Nuxt.js 3. Build and prototype fast web applications.
|
|
22
|
+
</p>
|
|
5
23
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
<h3 class="text-2xl mb-4">Quickstart a new Vue 3 or Nuxt 3 project</h3>
|
|
25
|
+
<p class="my-4">
|
|
26
|
+
This following command will install and execute <x-link
|
|
27
|
+
external
|
|
28
|
+
href="https://github.com/indielayer/ui/tree/main/packages/create-ui"
|
|
29
|
+
target="_blank"
|
|
30
|
+
shadow
|
|
31
|
+
color="primary"
|
|
32
|
+
>@indielayer/create-ui</x-link>, the official Indielayer UI project scaffolding tool. You will be presented with prompts for a number of optional features such as TypeScript.
|
|
33
|
+
</p>
|
|
34
|
+
<code-snippet :code="`pnpm create @indielayer/ui`" lang="bash"/>
|
|
35
|
+
<pre class="bg-slate-600 text-slate-50 text-xs mt-4 px-4 py-2 rounded-md">? Project type: › - Use arrow-keys. Return to submit.
|
|
18
36
|
❯ Vue 3
|
|
19
37
|
Nuxt 3</pre>
|
|
20
38
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
<h3 class="text-2xl mt-16 mb-4 text-gray-500">Manual guide</h3>
|
|
40
|
+
<h3 class="text-2xl mb-4">1. Install via package manager</h3>
|
|
41
|
+
<multi-snippet
|
|
42
|
+
:snippets="[{
|
|
43
|
+
label: 'npm',
|
|
44
|
+
lang: 'bash',
|
|
45
|
+
code: 'npm install @indielayer/ui'
|
|
46
|
+
}, {
|
|
47
|
+
label: 'yarn',
|
|
48
|
+
lang: 'bash',
|
|
49
|
+
code: 'yarn add @indielayer/ui'
|
|
50
|
+
}, {
|
|
51
|
+
label: 'pnpm',
|
|
52
|
+
lang: 'bash',
|
|
53
|
+
code: 'pnpm add @indielayer/ui'
|
|
54
|
+
}]"
|
|
55
|
+
/>
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
<h3 class="text-2xl mt-8 mb-4">2. Setup TailwindCSS</h3>
|
|
58
|
+
<p>If you do not have Tailwind CSS 3 installed in your project, please see the <x-link href="https://tailwindcss.com/docs/guides/vite" external shadow color="primary">Tailwind 3 Vite install guide here</x-link> before proceeding.</p>
|
|
59
|
+
<p class="my-4">
|
|
60
|
+
Add Indielayer Tailwind CSS preset <b>tailwind.preset.js</b> to your Tailwind CSS configuration file tailwind.config.js and <b>purge css configurations.</b>
|
|
61
|
+
</p>
|
|
62
|
+
<code-snippet
|
|
63
|
+
lang="js"
|
|
64
|
+
:code="`// tailwind.config.js
|
|
47
65
|
const colors = require('tailwindcss/colors')
|
|
48
66
|
const indielayer = require('@indielayer/ui/tailwind.preset')
|
|
49
67
|
|
|
50
68
|
module.exports = {
|
|
51
69
|
darkMode: 'class',
|
|
52
|
-
// load indielayer ui presets
|
|
53
70
|
presets: [indielayer()],
|
|
54
|
-
// allow PurgeCSS to analyze components
|
|
55
71
|
content: [
|
|
56
72
|
'./index.html',
|
|
57
73
|
'./**/*.vue',
|
|
@@ -71,12 +87,12 @@ module.exports = {
|
|
|
71
87
|
},
|
|
72
88
|
plugins: [],
|
|
73
89
|
}`"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
/>
|
|
91
|
+
<h3 class="text-2xl mt-8 mb-4">3. Load the UI in your project</h3>
|
|
92
|
+
<h4 class="text-xl mt-8 mb-4">Load on a Vue 3 project</h4>
|
|
93
|
+
<code-snippet
|
|
94
|
+
lang="js"
|
|
95
|
+
:code="`import { createApp } from 'vue'
|
|
80
96
|
import UI, { BaseTheme } from '@indielayer/ui'
|
|
81
97
|
|
|
82
98
|
const app = createApp(App)
|
|
@@ -84,38 +100,31 @@ const app = createApp(App)
|
|
|
84
100
|
app.use(UI, {
|
|
85
101
|
theme: BaseTheme,
|
|
86
102
|
})`"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
109
|
-
export default defineNuxtConfig({
|
|
103
|
+
/>
|
|
104
|
+
<h4 class="text-xl mt-8 mb-4">Load on a Nuxt 3 project</h4>
|
|
105
|
+
<multi-snippet
|
|
106
|
+
class="my-4"
|
|
107
|
+
:snippets="[{
|
|
108
|
+
label: 'npm',
|
|
109
|
+
lang: 'bash',
|
|
110
|
+
code: 'npm install @indielayer/ui @vueuse/core floating-vue @vuepic/vue-datepicker -D'
|
|
111
|
+
}, {
|
|
112
|
+
label: 'yarn',
|
|
113
|
+
lang: 'bash',
|
|
114
|
+
code: 'yarn add @indielayer/ui @vueuse/core floating-vue @vuepic/vue-datepicker -D'
|
|
115
|
+
}, {
|
|
116
|
+
label: 'pnpm',
|
|
117
|
+
lang: 'bash',
|
|
118
|
+
code: 'pnpm add @indielayer/ui @vueuse/core floating-vue @vuepic/vue-datepicker -D'
|
|
119
|
+
}]"
|
|
120
|
+
/>
|
|
121
|
+
<code-snippet
|
|
122
|
+
lang="js"
|
|
123
|
+
:code="`export default defineNuxtConfig({
|
|
110
124
|
modules: [
|
|
111
125
|
['@indielayer/ui/nuxt'],
|
|
112
126
|
],
|
|
113
127
|
css: ['~/assets/tailwind.css'],
|
|
114
|
-
/**
|
|
115
|
-
* @tailwind base;
|
|
116
|
-
* @tailwind components;
|
|
117
|
-
* @tailwind utilities;
|
|
118
|
-
*/
|
|
119
128
|
postcss: {
|
|
120
129
|
plugins: {
|
|
121
130
|
'tailwindcss/nesting': {},
|
|
@@ -124,11 +133,11 @@ export default defineNuxtConfig({
|
|
|
124
133
|
},
|
|
125
134
|
},
|
|
126
135
|
})`"
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
/>
|
|
137
|
+
<h3 class="text-2xl mt-8 mb-4">4. (optional) Load only the components you want</h3>
|
|
138
|
+
<code-snippet
|
|
139
|
+
lang="js"
|
|
140
|
+
:code="`import { createApp } from 'vue'
|
|
132
141
|
import { createUI, BaseTheme, XButton, XAlert } from '@indielayer/ui'
|
|
133
142
|
|
|
134
143
|
const app = createApp(App)
|
|
@@ -139,5 +148,7 @@ const UI = createUI({
|
|
|
139
148
|
})
|
|
140
149
|
|
|
141
150
|
app.use(UI)`"
|
|
142
|
-
|
|
151
|
+
/>
|
|
152
|
+
</section>
|
|
153
|
+
</div>
|
|
143
154
|
</template>
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { useDocMeta } from '../composables/useDocMeta'
|
|
3
|
+
|
|
4
|
+
useDocMeta({
|
|
5
|
+
title: 'Typography',
|
|
6
|
+
description: 'Type scale and typography utilities used across Indielayer UI.',
|
|
7
|
+
path: '/typography',
|
|
8
|
+
})
|
|
9
|
+
|
|
2
10
|
const textClasses = {
|
|
3
11
|
'text-xs': {
|
|
4
12
|
size: '0.75rem',
|
|
@@ -57,37 +65,39 @@ const textClasses = {
|
|
|
57
65
|
</script>
|
|
58
66
|
|
|
59
67
|
<template>
|
|
60
|
-
<
|
|
61
|
-
|
|
68
|
+
<div class="docs-container">
|
|
69
|
+
<h1 class="text-4xl font-semibold">Typography</h1>
|
|
70
|
+
<h2 class="text-lg my-2 text-gray-500 dark:text-gray-400">Big letters, small letters, fonts and stuff</h2>
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
<x-divider class="mt-4 mb-8"/>
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
<div>
|
|
75
|
+
<div>Main font</div>
|
|
76
|
+
<div class="text-gray-500 dark:text-gray-400">Inter</div>
|
|
77
|
+
<div class="text-6xl mt-4">AaBbCc</div>
|
|
78
|
+
</div>
|
|
70
79
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
<div class="mt-10">
|
|
81
|
+
<table class="text-left w-full">
|
|
82
|
+
<tbody>
|
|
83
|
+
<tr>
|
|
84
|
+
<th class="py-2">Class</th>
|
|
85
|
+
<th>Size</th>
|
|
86
|
+
<th>Line Height</th>
|
|
87
|
+
<th>Preview</th>
|
|
88
|
+
</tr>
|
|
89
|
+
<tr v-for="(c, key) in textClasses" :key="key" class="border-t">
|
|
90
|
+
<td class="py-2">{{ key }}</td>
|
|
91
|
+
<td class="text-secondary-500 font-light">{{ c.size }}</td>
|
|
92
|
+
<td class="text-secondary-500 font-light">{{ c.line }}</td>
|
|
93
|
+
<td :class="key" class="max-w-lg truncate">Preview text</td>
|
|
94
|
+
</tr>
|
|
95
|
+
</tbody>
|
|
96
|
+
</table>
|
|
97
|
+
</div>
|
|
89
98
|
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
<div class="text-secondary-500 mt-4">
|
|
100
|
+
See more about Tailwind typography classes here -> <x-link href="https://tailwindcss.com/docs/font-size" target="_blank" underline>Tailwind Documentation</x-link>
|
|
101
|
+
</div>
|
|
92
102
|
</div>
|
|
93
103
|
</template>
|
package/docs/router/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import IconsPage from '../pages/icons.vue'
|
|
|
10
10
|
import PlayPage from '../pages/play.vue'
|
|
11
11
|
import TypographyPage from '../pages/typography.vue'
|
|
12
12
|
import ColorsPage from '../pages/colors.vue'
|
|
13
|
+
import ErrorPage from '../pages/error.vue'
|
|
13
14
|
|
|
14
15
|
const pages: Record<string, any> = import.meta.glob('../pages/component/*/index.vue', { eager: true })
|
|
15
16
|
|
|
@@ -59,14 +60,41 @@ const routes: RouteRecordRaw[] = [{
|
|
|
59
60
|
path: '/play',
|
|
60
61
|
component: PlayPage,
|
|
61
62
|
}, {
|
|
62
|
-
path: '/:pathMatch(.*)*',
|
|
63
|
+
path: '/:pathMatch(.*)*',
|
|
64
|
+
name: 'NotFound',
|
|
65
|
+
component: ErrorPage,
|
|
63
66
|
}]
|
|
64
67
|
|
|
65
68
|
const router = createRouter({
|
|
66
|
-
history: createWebHistory(
|
|
69
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
|
67
70
|
routes,
|
|
68
71
|
scrollBehavior(to, from, savedPosition) {
|
|
69
|
-
document.getElementById('main')
|
|
72
|
+
const main = document.getElementById('main')
|
|
73
|
+
|
|
74
|
+
if (to.hash) {
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
const el = document.querySelector(to.hash)
|
|
78
|
+
|
|
79
|
+
if (el && main) {
|
|
80
|
+
const top = (el as HTMLElement).offsetTop - 80
|
|
81
|
+
|
|
82
|
+
main.scrollTo({ top, behavior: 'smooth' })
|
|
83
|
+
}
|
|
84
|
+
resolve({ el: to.hash, behavior: 'smooth', top: 80 })
|
|
85
|
+
}, 100)
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (savedPosition) {
|
|
90
|
+
main?.scrollTo(savedPosition)
|
|
91
|
+
|
|
92
|
+
return savedPosition
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main?.scrollTo(0, 0)
|
|
96
|
+
|
|
97
|
+
return { top: 0 }
|
|
70
98
|
},
|
|
71
99
|
})
|
|
72
100
|
|