@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.
Files changed (156) hide show
  1. package/README.md +2 -2
  2. package/docs/assets/css/tailwind.css +6 -0
  3. package/docs/components/common/CodePreview.vue +14 -9
  4. package/docs/components/common/DocsFeatures.vue +41 -0
  5. package/docs/components/common/DocsHero.vue +216 -0
  6. package/docs/components/common/DocumentPage.vue +99 -112
  7. package/docs/components/common/ExampleBlocks.vue +157 -0
  8. package/docs/components/menu/DocsMenu.vue +3 -0
  9. package/docs/components/toolbar/Toolbar.vue +11 -2
  10. package/docs/components/toolbar/ToolbarColorToggle.vue +4 -4
  11. package/docs/components/toolbar/ToolbarSearch.vue +59 -62
  12. package/docs/composables/useDocMeta.ts +47 -0
  13. package/docs/icons.ts +28 -0
  14. package/docs/layouts/default.vue +1 -3
  15. package/docs/layouts/simple.vue +3 -1
  16. package/docs/main.ts +5 -0
  17. package/docs/pages/colors.vue +56 -47
  18. package/docs/pages/component/infiniteLoader/composable.vue +168 -0
  19. package/docs/pages/component/infiniteLoader/index.vue +36 -0
  20. package/docs/pages/component/infiniteLoader/usage.vue +161 -0
  21. package/docs/pages/component/select/size.vue +1 -1
  22. package/docs/pages/component/select/usage.vue +14 -7
  23. package/docs/pages/component/virtualGrid/index.vue +29 -0
  24. package/docs/pages/component/virtualGrid/usage.vue +20 -0
  25. package/docs/pages/component/virtualList/dynamicHeight.vue +75 -0
  26. package/docs/pages/component/virtualList/index.vue +36 -0
  27. package/docs/pages/component/virtualList/usage.vue +17 -0
  28. package/docs/pages/error.vue +5 -3
  29. package/docs/pages/icons.vue +64 -54
  30. package/docs/pages/index.vue +93 -82
  31. package/docs/pages/typography.vue +38 -28
  32. package/docs/router/index.ts +31 -3
  33. package/docs/search/components.json +1 -1
  34. package/docs/search/index.json +1 -0
  35. package/lib/components/container/theme/Container.base.theme.js +1 -1
  36. package/lib/components/divider/theme/Divider.base.theme.js +1 -1
  37. package/lib/components/input/Input.vue.js +23 -24
  38. package/lib/components/select/Select.vue.d.ts +16 -27
  39. package/lib/components/select/Select.vue.js +452 -345
  40. package/lib/components/table/Table.vue.js +1 -1
  41. package/lib/composables/useVirtualList.d.ts +1 -1
  42. package/lib/index.d.ts +1 -0
  43. package/lib/index.js +88 -76
  44. package/lib/index.umd.js +4 -4
  45. package/lib/install.js +15 -7
  46. package/lib/version.d.ts +1 -1
  47. package/lib/version.js +1 -1
  48. package/lib/virtual/components/infiniteLoader/InfiniteLoader.test.d.ts +1 -0
  49. package/lib/virtual/components/infiniteLoader/InfiniteLoader.vue.d.ts +49 -0
  50. package/lib/virtual/components/infiniteLoader/InfiniteLoader.vue.js +21 -0
  51. package/lib/virtual/components/infiniteLoader/InfiniteLoader.vue2.js +4 -0
  52. package/lib/virtual/components/virtualGrid/VirtualGrid.vue.d.ts +185 -0
  53. package/lib/virtual/components/virtualGrid/VirtualGrid.vue.js +241 -0
  54. package/lib/virtual/components/virtualGrid/VirtualGrid.vue2.js +4 -0
  55. package/lib/virtual/components/virtualGrid/types.d.ts +138 -0
  56. package/lib/virtual/components/virtualList/VirtualList.test.d.ts +1 -0
  57. package/lib/virtual/components/virtualList/VirtualList.vue.d.ts +135 -0
  58. package/lib/virtual/components/virtualList/VirtualList.vue.js +159 -0
  59. package/lib/virtual/components/virtualList/VirtualList.vue2.js +4 -0
  60. package/lib/virtual/components/virtualList/isDynamicRowHeight.d.ts +2 -0
  61. package/lib/virtual/components/virtualList/isDynamicRowHeight.js +6 -0
  62. package/lib/virtual/components/virtualList/types.d.ts +115 -0
  63. package/lib/virtual/components/virtualList/useDynamicRowHeight.d.ts +7 -0
  64. package/lib/virtual/components/virtualList/useDynamicRowHeight.js +68 -0
  65. package/lib/virtual/components/virtualList/useDynamicRowHeight.test.d.ts +1 -0
  66. package/lib/virtual/composables/infinite-loader/scanForUnloadedIndices.d.ts +8 -0
  67. package/lib/virtual/composables/infinite-loader/scanForUnloadedIndices.js +41 -0
  68. package/lib/virtual/composables/infinite-loader/scanForUnloadedIndices.test.d.ts +1 -0
  69. package/lib/virtual/composables/infinite-loader/types.d.ts +30 -0
  70. package/lib/virtual/composables/infinite-loader/useInfiniteLoader.d.ts +6 -0
  71. package/lib/virtual/composables/infinite-loader/useInfiniteLoader.js +42 -0
  72. package/lib/virtual/composables/infinite-loader/useInfiniteLoader.test.d.ts +1 -0
  73. package/lib/virtual/core/createCachedBounds.d.ts +6 -0
  74. package/lib/virtual/core/createCachedBounds.js +55 -0
  75. package/lib/virtual/core/getEstimatedSize.d.ts +6 -0
  76. package/lib/virtual/core/getEstimatedSize.js +22 -0
  77. package/lib/virtual/core/getOffsetForIndex.d.ts +11 -0
  78. package/lib/virtual/core/getOffsetForIndex.js +40 -0
  79. package/lib/virtual/core/getStartStopIndices.d.ts +13 -0
  80. package/lib/virtual/core/getStartStopIndices.js +31 -0
  81. package/lib/virtual/core/getStartStopIndices.test.d.ts +1 -0
  82. package/lib/virtual/core/types.d.ts +11 -0
  83. package/lib/virtual/core/useCachedBounds.d.ts +7 -0
  84. package/lib/virtual/core/useCachedBounds.js +18 -0
  85. package/lib/virtual/core/useIsRtl.d.ts +2 -0
  86. package/lib/virtual/core/useIsRtl.js +15 -0
  87. package/lib/virtual/core/useItemSize.d.ts +5 -0
  88. package/lib/virtual/core/useItemSize.js +27 -0
  89. package/lib/virtual/core/useVirtualizer.d.ts +33 -0
  90. package/lib/virtual/core/useVirtualizer.js +171 -0
  91. package/lib/virtual/index.d.ts +9 -0
  92. package/lib/virtual/test-utils/mockResizeObserver.d.ts +15 -0
  93. package/lib/virtual/types.d.ts +2 -0
  94. package/lib/virtual/utils/adjustScrollOffsetForRtl.d.ts +7 -0
  95. package/lib/virtual/utils/adjustScrollOffsetForRtl.js +24 -0
  96. package/lib/virtual/utils/areArraysEqual.d.ts +1 -0
  97. package/lib/virtual/utils/assert.d.ts +1 -0
  98. package/lib/virtual/utils/assert.js +7 -0
  99. package/lib/virtual/utils/getRTLOffsetType.d.ts +2 -0
  100. package/lib/virtual/utils/getRTLOffsetType.js +13 -0
  101. package/lib/virtual/utils/getScrollbarSize.d.ts +2 -0
  102. package/lib/virtual/utils/getScrollbarSize.js +11 -0
  103. package/lib/virtual/utils/isRtl.d.ts +1 -0
  104. package/lib/virtual/utils/isRtl.js +12 -0
  105. package/lib/virtual/utils/parseNumericStyleValue.d.ts +2 -0
  106. package/lib/virtual/utils/parseNumericStyleValue.js +15 -0
  107. package/lib/virtual/utils/shallowCompare.d.ts +1 -0
  108. package/lib/virtual/utils/shallowCompare.js +14 -0
  109. package/package.json +8 -3
  110. package/src/components/container/theme/Container.base.theme.ts +1 -1
  111. package/src/components/divider/theme/Divider.base.theme.ts +1 -1
  112. package/src/components/input/Input.vue +1 -2
  113. package/src/components/select/Select.vue +97 -20
  114. package/src/components/table/Table.vue +1 -1
  115. package/src/composables/useVirtualList.ts +1 -1
  116. package/src/index.ts +1 -0
  117. package/src/install.ts +9 -3
  118. package/src/version.ts +1 -1
  119. package/src/virtual/README.md +285 -0
  120. package/src/virtual/components/infiniteLoader/InfiniteLoader.test.ts +96 -0
  121. package/src/virtual/components/infiniteLoader/InfiniteLoader.vue +18 -0
  122. package/src/virtual/components/virtualGrid/VirtualGrid.vue +322 -0
  123. package/src/virtual/components/virtualGrid/types.ts +160 -0
  124. package/src/virtual/components/virtualList/VirtualList.test.ts +164 -0
  125. package/src/virtual/components/virtualList/VirtualList.vue +227 -0
  126. package/src/virtual/components/virtualList/isDynamicRowHeight.ts +13 -0
  127. package/src/virtual/components/virtualList/types.ts +127 -0
  128. package/src/virtual/components/virtualList/useDynamicRowHeight.test.ts +197 -0
  129. package/src/virtual/components/virtualList/useDynamicRowHeight.ts +149 -0
  130. package/src/virtual/composables/infinite-loader/scanForUnloadedIndices.test.ts +141 -0
  131. package/src/virtual/composables/infinite-loader/scanForUnloadedIndices.ts +82 -0
  132. package/src/virtual/composables/infinite-loader/types.ts +36 -0
  133. package/src/virtual/composables/infinite-loader/useInfiniteLoader.test.ts +236 -0
  134. package/src/virtual/composables/infinite-loader/useInfiniteLoader.ts +88 -0
  135. package/src/virtual/core/createCachedBounds.ts +72 -0
  136. package/src/virtual/core/getEstimatedSize.ts +29 -0
  137. package/src/virtual/core/getOffsetForIndex.ts +90 -0
  138. package/src/virtual/core/getStartStopIndices.test.ts +45 -0
  139. package/src/virtual/core/getStartStopIndices.ts +71 -0
  140. package/src/virtual/core/types.ts +17 -0
  141. package/src/virtual/core/useCachedBounds.ts +21 -0
  142. package/src/virtual/core/useIsRtl.ts +25 -0
  143. package/src/virtual/core/useItemSize.ts +34 -0
  144. package/src/virtual/core/useVirtualizer.ts +294 -0
  145. package/src/virtual/index.ts +25 -0
  146. package/src/virtual/test-utils/mockResizeObserver.ts +162 -0
  147. package/src/virtual/types.ts +3 -0
  148. package/src/virtual/utils/adjustScrollOffsetForRtl.ts +37 -0
  149. package/src/virtual/utils/areArraysEqual.ts +13 -0
  150. package/src/virtual/utils/assert.ts +10 -0
  151. package/src/virtual/utils/getRTLOffsetType.ts +51 -0
  152. package/src/virtual/utils/getScrollbarSize.ts +24 -0
  153. package/src/virtual/utils/isRtl.ts +13 -0
  154. package/src/virtual/utils/parseNumericStyleValue.ts +21 -0
  155. package/src/virtual/utils/shallowCompare.ts +29 -0
  156. 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>
@@ -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
- <h2 class="text-h3">Page not found</h2>
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>
@@ -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
- <h2 class="text-4xl font-semibold">Icons</h2>
39
- <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>
40
- <x-divider class="mt-4 mb-8"/>
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
- <p class="text-xl mt-8 my-4">SVG Icon Libraries</p>
43
- <div class="font-bold text-lg">
44
- <ul>
45
- <li><x-link
46
- external
47
- color="sky"
48
- underline
49
- href="https://icones.js.org/"
50
- target="_blank"
51
- >Icônes - All the libraries</x-link></li>
52
- <li><x-link
53
- external
54
- color="sky"
55
- underline
56
- href="https://heroicons.com/"
57
- target="_blank"
58
- >Hero Icons (MIT)</x-link></li>
59
- <li><x-link
60
- external
61
- color="sky"
62
- underline
63
- href="https://tabler-icons.io/"
64
- target="_blank"
65
- >Tabler Icons (MIT)</x-link></li>
66
- <li><x-link
67
- external
68
- color="sky"
69
- underline
70
- href="https://feathericons.com/"
71
- target="_blank"
72
- >Feather Icons (MIT)</x-link></li>
73
- </ul>
74
- </div>
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
- <h3 class="text-2xl mt-8 mb-4">1. Create the icons file -> <strong>icons.js</strong></h3>
77
- <code-snippet
78
- lang="js"
79
- :code="iconExample"
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
- <h3 class="text-2xl mt-8 mb-4">2. Add icons on UI install options -> <strong>main.js</strong></h3>
83
- <code-snippet
84
- lang="js"
85
- :code="installExample"
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
- <h3 class="text-2xl mt-8 mb-4">3. Add icons from open source libraries</h3>
89
- <p class="mb-2 text-xl">Start adding the icons you need.</p>
90
- <p class="mb-2">SVG wrapper optional, copy only the content part of the SVG:</p>
91
- <p class="mb-4 border dark:border-gray-600 rounded-md p-4">&#x3C;svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; width=&#x22;24&#x22; height=&#x22;24&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22; stroke=&#x22;currentColor&#x22; stroke-width=&#x22;2&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; class=&#x22;feather feather-check&#x22;&#x3E;<strong>&#x3C;polyline points=&#x22;20 6 9 17 4 12&#x22;&#x3E;&#x3C;/polyline&#x3E;</strong>&#x3C;/svg&#x3E;</p>
92
- <code-snippet lang="js" :code="iconExample1"/>
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">&#x3C;svg xmlns=&#x22;http://www.w3.org/2000/svg&#x22; width=&#x22;24&#x22; height=&#x22;24&#x22; viewBox=&#x22;0 0 24 24&#x22; fill=&#x22;none&#x22; stroke=&#x22;currentColor&#x22; stroke-width=&#x22;2&#x22; stroke-linecap=&#x22;round&#x22; stroke-linejoin=&#x22;round&#x22; class=&#x22;feather feather-check&#x22;&#x3E;<strong>&#x3C;polyline points=&#x22;20 6 9 17 4 12&#x22;&#x3E;&#x3C;/polyline&#x3E;</strong>&#x3C;/svg&#x3E;</p>
101
+ <code-snippet lang="js" :code="iconExample1"/>
93
102
 
94
- <div class="my-4">
95
- Icon "check" <x-icon icon="check"/>
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>
@@ -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
- <h2 class="text-4xl font-semibold">Getting Started</h2>
3
- <h1 class="text-lg my-2 text-gray-500 dark:text-gray-400">Tailwind CSS UI components for Vue.js 3 / Nuxt.js 3. Build and prototype fast web applications.</h1>
4
- <x-divider class="mt-4 mb-8"/>
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
- <h3 class="text-2xl mb-4">Quickstart a new Vue 3 or Nuxt 3 project</h3>
7
- <p class="my-4">
8
- This following command will install and execute <x-link
9
- external
10
- href="https://github.com/indielayer/ui/tree/main/packages/create-ui"
11
- target="_blank"
12
- shadow
13
- color="primary"
14
- >@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.
15
- </p>
16
- <code-snippet :code="`npm init @indielayer/ui`" lang="bash"/>
17
- <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.
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
- <h3 class="text-2xl mt-16 mb-4 text-gray-500">Manual guide</h3>
22
- <h3 class="text-2xl mb-4">1. Install via package manager</h3>
23
- <multi-snippet
24
- :snippets="[{
25
- label: 'npm',
26
- lang: 'bash',
27
- code: 'npm install @indielayer/ui'
28
- }, {
29
- label: 'yarn',
30
- lang: 'bash',
31
- code: 'yarn add @indielayer/ui'
32
- }, {
33
- label: 'pnpm',
34
- lang: 'bash',
35
- code: 'pnpm add @indielayer/ui'
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
- <h3 class="text-2xl mt-8 mb-4">2. Setup TailwindCSS</h3>
40
- <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>
41
- <p class="my-4">
42
- 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>
43
- </p>
44
- <code-snippet
45
- lang="js"
46
- :code="`// tailwind.config.js
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
- <h3 class="text-2xl mt-8 mb-4">3. Load the UI in your project</h3>
76
- <h4 class="text-xl mt-8 mb-4">Load on a Vue 3 project</h4>
77
- <code-snippet
78
- lang="js"
79
- :code="`import { createApp } from 'vue'
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
- <h4 class="text-xl mt-8 mb-4">Load on a Nuxt 3 project</h4>
89
- <multi-snippet
90
- class="my-4"
91
- :snippets="[{
92
- label: 'npm',
93
- lang: 'bash',
94
- code: 'npm install @indielayer/ui @vueuse/core floating-vue @vuepic/vue-datepicker -D'
95
- }, {
96
- label: 'yarn',
97
- lang: 'bash',
98
- code: 'yarn add @indielayer/ui @vueuse/core floating-vue @vuepic/vue-datepicker -D'
99
- }, {
100
- label: 'pnpm',
101
- lang: 'bash',
102
- code: 'pnpm add @indielayer/ui @vueuse/core floating-vue @vuepic/vue-datepicker -D'
103
- }]"
104
- />
105
- <code-snippet
106
- lang="js"
107
- :code="`
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
- <h3 class="text-2xl mt-8 mb-4">4. (optional) Load only the components you want</h3>
129
- <code-snippet
130
- lang="js"
131
- :code="`import { createApp } from 'vue'
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
- <h1 class="text-4xl font-semibold">Typography</h1>
61
- <h2 class="text-lg my-2 text-gray-500 dark:text-gray-400">Big letters, small letters, fonts and stuff</h2>
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
- <x-divider class="mt-4 mb-8"/>
72
+ <x-divider class="mt-4 mb-8"/>
64
73
 
65
- <div>
66
- <div>Main font</div>
67
- <div class="text-gray-500 dark:text-gray-400">Inter</div>
68
- <div class="text-6xl mt-4">AaBbCc</div>
69
- </div>
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
- <div class="mt-10">
72
- <table class="text-left w-full">
73
- <tbody>
74
- <tr>
75
- <th class="py-2">Class</th>
76
- <th>Size</th>
77
- <th>Line Height</th>
78
- <th>Preview</th>
79
- </tr>
80
- <tr v-for="(c, key) in textClasses" :key="key" class="border-t">
81
- <td class="py-2">{{ key }}</td>
82
- <td class="text-secondary-500 font-light">{{ c.size }}</td>
83
- <td class="text-secondary-500 font-light">{{ c.line }}</td>
84
- <td :class="key" class="max-w-lg truncate">Preview text</td>
85
- </tr>
86
- </tbody>
87
- </table>
88
- </div>
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
- <div class="text-secondary-500 mt-4">
91
- See more about Tailwind typography classes here -> <x-link href="https://tailwindcss.com/docs/font-size" target="_blank" underline>Tailwind Documentation</x-link>
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>
@@ -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(.*)*', name: 'NotFound', redirect: { name: 'getting-started' },
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')?.scrollTo(0, 0)
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