intable 0.0.6 → 0.0.8

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 (197) hide show
  1. package/.github/copilot-instructions.md +102 -0
  2. package/README.md +16 -263
  3. package/docs/index-BaMALNy6.css +1 -0
  4. package/docs/index-CDN48t9E.js +3 -0
  5. package/docs/index-Cc4RNkLY.css +1 -0
  6. package/docs/index-MRnbkYmU.js +3 -0
  7. package/docs/index.html +15 -0
  8. package/docs/vite.svg +1 -0
  9. package/index.html +13 -0
  10. package/package.json +35 -38
  11. package/packages/intable/README.md +379 -0
  12. package/packages/intable/package.json +51 -0
  13. package/packages/intable/src/assets/ClearFormat.svg +3 -0
  14. package/packages/intable/src/assets/Forms.svg +4 -0
  15. package/packages/intable/src/assets/MergeCell.svg +4 -0
  16. package/packages/intable/src/assets/SplitCell.svg +4 -0
  17. package/packages/intable/src/assets/gap.svg +3 -0
  18. package/packages/intable/src/assets/loading.svg +12 -0
  19. package/packages/intable/src/assets/paint.svg +9 -0
  20. package/packages/intable/src/assets/solid.svg +1 -0
  21. package/packages/intable/src/components/Columns.tsx +86 -0
  22. package/packages/intable/src/components/DocTree.tsx +36 -0
  23. package/packages/intable/src/components/Menu.tsx +109 -0
  24. package/packages/intable/src/components/Popover.tsx +55 -0
  25. package/packages/intable/src/components/RecycleList.tsx +99 -0
  26. package/packages/intable/src/components/Render.tsx +26 -0
  27. package/packages/intable/src/components/Split.tsx +56 -0
  28. package/packages/intable/src/components/Tree.tsx +115 -0
  29. package/packages/intable/src/components/utils.tsx +12 -0
  30. package/packages/intable/src/hooks/index.ts +200 -0
  31. package/packages/intable/src/hooks/useDir.ts +78 -0
  32. package/packages/intable/src/hooks/useSelector.ts +91 -0
  33. package/packages/intable/src/hooks/useSort.tsx +118 -0
  34. package/packages/intable/src/hooks/useVirtualizer.ts +180 -0
  35. package/packages/intable/src/index.tsx +489 -0
  36. package/packages/intable/src/plugins/CellChangeHighlightPlugin.tsx +5 -0
  37. package/packages/intable/src/plugins/CellMergePlugin.tsx +153 -0
  38. package/packages/intable/src/plugins/CellSelectionPlugin.tsx +175 -0
  39. package/packages/intable/src/plugins/CommandPlugin.tsx +74 -0
  40. package/packages/intable/src/plugins/CopyPastePlugin.tsx +99 -0
  41. package/packages/intable/src/plugins/DiffPlugin.tsx +120 -0
  42. package/packages/intable/src/plugins/DragPlugin.tsx +81 -0
  43. package/packages/intable/src/plugins/EditablePlugin.tsx +252 -0
  44. package/packages/intable/src/plugins/ExpandPlugin.tsx +80 -0
  45. package/packages/intable/src/plugins/HeaderGroup.tsx +289 -0
  46. package/packages/intable/src/plugins/HistoryPlugin.tsx +49 -0
  47. package/packages/intable/src/plugins/MenuPlugin.tsx +195 -0
  48. package/packages/intable/src/plugins/RenderPlugin/components.tsx +51 -0
  49. package/packages/intable/src/plugins/RenderPlugin/index.tsx +81 -0
  50. package/packages/intable/src/plugins/ResizePlugin.tsx +122 -0
  51. package/packages/intable/src/plugins/RowGroupPlugin.tsx +122 -0
  52. package/packages/intable/src/plugins/RowSelectionPlugin.tsx +65 -0
  53. package/packages/intable/src/plugins/TreePlugin.tsx +212 -0
  54. package/packages/intable/src/plugins/VirtualScrollPlugin.tsx +190 -0
  55. package/packages/intable/src/plugins/ZodValidatorPlugin.tsx +61 -0
  56. package/packages/intable/src/style.scss +244 -0
  57. package/{dist → packages/intable/src}/theme/antd.scss +14 -5
  58. package/packages/intable/src/theme/dark.scss +46 -0
  59. package/{dist → packages/intable/src}/theme/element-plus.scss +6 -5
  60. package/packages/intable/src/theme/github.scss +80 -0
  61. package/packages/intable/src/theme/material.scss +73 -0
  62. package/packages/intable/src/theme/shadcn.scss +66 -0
  63. package/packages/intable/src/theme/stripe.scss +57 -0
  64. package/packages/intable/src/tree.ts +13 -0
  65. package/packages/intable/src/types/auto-imports.d.ts +13 -0
  66. package/packages/intable/src/utils.ts +122 -0
  67. package/packages/intable/src/wc.tsx +35 -0
  68. package/packages/intable/src/web-component.ts +1 -0
  69. package/packages/react/package.json +36 -0
  70. package/packages/react/src/index.ts +44 -0
  71. package/packages/react/src/plugins/antd.ts +94 -0
  72. package/packages/react/src/style.scss +12 -0
  73. package/packages/react/src/types/auto-imports.d.ts +10 -0
  74. package/packages/vue/package.json +34 -0
  75. package/packages/vue/src/index.ts +63 -0
  76. package/packages/vue/src/plugins/element-plus.ts +69 -0
  77. package/packages/vue/src/style.scss +12 -0
  78. package/packages/vue/src/types/auto-imports.d.ts +10 -0
  79. package/pnpm-workspace.yaml +2 -0
  80. package/public/vite.svg +1 -0
  81. package/scripts/build.js +184 -0
  82. package/scripts/publish.js +95 -0
  83. package/src/assets/ClearFormat.svg +3 -0
  84. package/src/assets/Forms.svg +4 -0
  85. package/src/assets/MergeCell.svg +4 -0
  86. package/src/assets/SplitCell.svg +4 -0
  87. package/src/assets/gap.svg +3 -0
  88. package/src/assets/loading.svg +12 -0
  89. package/src/assets/paint.svg +9 -0
  90. package/src/assets/solid.svg +1 -0
  91. package/src/demo-vue.ts +54 -0
  92. package/src/index.scss +105 -0
  93. package/src/index.tsx +20 -0
  94. package/src/pages/demo/BasicDemo.tsx +19 -0
  95. package/src/pages/demo/CellMergeDemo.tsx +41 -0
  96. package/src/pages/demo/CellSelectionDemo.tsx +24 -0
  97. package/src/pages/demo/CompositeDemo.tsx +60 -0
  98. package/src/pages/demo/CopyPasteDemo.tsx +26 -0
  99. package/src/pages/demo/DiffDemo.tsx +33 -0
  100. package/src/pages/demo/DragDemo.tsx +25 -0
  101. package/src/pages/demo/EditableDemo.tsx +58 -0
  102. package/src/pages/demo/ExpandDemo.tsx +32 -0
  103. package/src/pages/demo/HeaderGroupDemo.tsx +36 -0
  104. package/src/pages/demo/HistoryDemo.tsx +28 -0
  105. package/src/pages/demo/ReactDemo.tsx +59 -0
  106. package/src/pages/demo/ResizeDemo.tsx +24 -0
  107. package/src/pages/demo/RowGroupDemo.tsx +43 -0
  108. package/src/pages/demo/RowSelectionDemo.tsx +27 -0
  109. package/src/pages/demo/TreeDemo.tsx +45 -0
  110. package/src/pages/demo/VirtualScrollDemo.tsx +21 -0
  111. package/src/pages/demo/helpers.tsx +39 -0
  112. package/src/pages/demo/index.tsx +180 -0
  113. package/src/pages/index.tsx +2 -0
  114. package/src/pages/website.scss +37 -0
  115. package/src/pages/website.tsx +651 -0
  116. package/src/styles/index.scss +172 -0
  117. package/src/types/auto-imports.d.ts +13 -0
  118. package/stats.html +4949 -0
  119. package/tsconfig.app.json +34 -0
  120. package/tsconfig.json +7 -0
  121. package/tsconfig.node.json +26 -0
  122. package/vite.config.ts +70 -0
  123. package/dist/__uno.css +0 -1
  124. package/dist/chevron-right.js +0 -6
  125. package/dist/components/Columns.d.ts +0 -3
  126. package/dist/components/Columns.js +0 -71
  127. package/dist/components/DocTree.d.ts +0 -4
  128. package/dist/components/DocTree.js +0 -32
  129. package/dist/components/Menu.d.ts +0 -1
  130. package/dist/components/Menu.js +0 -107
  131. package/dist/components/Popover.d.ts +0 -14
  132. package/dist/components/Popover.js +0 -41
  133. package/dist/components/Render.d.ts +0 -4
  134. package/dist/components/Render.js +0 -20
  135. package/dist/components/Split.d.ts +0 -15
  136. package/dist/components/Split.js +0 -76
  137. package/dist/components/Tree.d.ts +0 -37
  138. package/dist/components/Tree.js +0 -82
  139. package/dist/components/utils.d.ts +0 -3
  140. package/dist/components/utils.js +0 -8
  141. package/dist/hooks/index.d.ts +0 -40
  142. package/dist/hooks/index.js +0 -157
  143. package/dist/hooks/useDir.d.ts +0 -11
  144. package/dist/hooks/useDir.js +0 -42
  145. package/dist/hooks/useSelector.d.ts +0 -16
  146. package/dist/hooks/useSelector.js +0 -35
  147. package/dist/hooks/useSort.d.ts +0 -18
  148. package/dist/hooks/useSort.js +0 -83
  149. package/dist/hooks/useVirtualizer.d.ts +0 -25
  150. package/dist/hooks/useVirtualizer.js +0 -67
  151. package/dist/index.d.ts +0 -130
  152. package/dist/index.js +0 -347
  153. package/dist/loading.js +0 -6
  154. package/dist/plugins/CellChangeHighlightPlugin.d.ts +0 -2
  155. package/dist/plugins/CellChangeHighlightPlugin.js +0 -4
  156. package/dist/plugins/CellMergePlugin.d.ts +0 -12
  157. package/dist/plugins/CellMergePlugin.js +0 -2
  158. package/dist/plugins/CellSelectionPlugin.d.ts +0 -15
  159. package/dist/plugins/CellSelectionPlugin.js +0 -115
  160. package/dist/plugins/CommandPlugin.d.ts +0 -14
  161. package/dist/plugins/CommandPlugin.js +0 -12
  162. package/dist/plugins/CopyPastePlugin.d.ts +0 -14
  163. package/dist/plugins/CopyPastePlugin.js +0 -42
  164. package/dist/plugins/DiffPlugin.d.ts +0 -23
  165. package/dist/plugins/DiffPlugin.js +0 -56
  166. package/dist/plugins/DragPlugin.d.ts +0 -14
  167. package/dist/plugins/DragPlugin.js +0 -47
  168. package/dist/plugins/EditablePlugin.d.ts +0 -48
  169. package/dist/plugins/EditablePlugin.js +0 -141
  170. package/dist/plugins/ExpandPlugin.d.ts +0 -18
  171. package/dist/plugins/ExpandPlugin.js +0 -50
  172. package/dist/plugins/HistoryPlugin.d.ts +0 -10
  173. package/dist/plugins/HistoryPlugin.js +0 -30
  174. package/dist/plugins/MenuPlugin.d.ts +0 -18
  175. package/dist/plugins/MenuPlugin.js +0 -107
  176. package/dist/plugins/RenderPlugin/components.d.ts +0 -5
  177. package/dist/plugins/RenderPlugin/components.js +0 -87
  178. package/dist/plugins/RenderPlugin/index.d.ts +0 -30
  179. package/dist/plugins/RenderPlugin/index.js +0 -49
  180. package/dist/plugins/ResizePlugin.d.ts +0 -27
  181. package/dist/plugins/ResizePlugin.js +0 -81
  182. package/dist/plugins/RowGroupPlugin.d.ts +0 -17
  183. package/dist/plugins/RowGroupPlugin.js +0 -83
  184. package/dist/plugins/RowSelectionPlugin.d.ts +0 -20
  185. package/dist/plugins/RowSelectionPlugin.js +0 -42
  186. package/dist/plugins/VirtualScrollPlugin.d.ts +0 -15
  187. package/dist/plugins/VirtualScrollPlugin.js +0 -96
  188. package/dist/plus.js +0 -6
  189. package/dist/style.css +0 -3
  190. package/dist/types/auto-imports.d.js +0 -0
  191. package/dist/utils.d.ts +0 -30
  192. package/dist/utils.js +0 -70
  193. package/dist/wc.d.ts +0 -1
  194. package/dist/wc.js +0 -21
  195. package/dist/web-component.d.ts +0 -1
  196. package/dist/web-component.js +0 -2
  197. package/dist/x.js +0 -6
@@ -0,0 +1,43 @@
1
+ import { createMutable } from 'solid-js/store'
2
+ import { range } from 'es-toolkit'
3
+ import { Intable } from '../../../packages/intable/src'
4
+ import { replaceArray } from './helpers'
5
+
6
+ const cols = createMutable([
7
+ { id: 'name', name: 'Name', width: 120 },
8
+ { id: 'category', name: 'Category', width: 120 },
9
+ { id: 'region', name: 'Region', width: 120 },
10
+ { id: 'value', name: 'Value', width: 100 },
11
+ ])
12
+
13
+ const categories = ['Electronics', 'Clothing', 'Food']
14
+ const regions = ['East', 'West', 'North', 'South']
15
+
16
+ const data = createMutable(
17
+ range(40).map(i => ({
18
+ id: i,
19
+ name: 'Item ' + i,
20
+ category: categories[i % 3],
21
+ region: regions[i % 4],
22
+ value: Math.round(Math.random() * 1000),
23
+ })),
24
+ )
25
+
26
+ /**
27
+ * Rows are grouped by `category` then `region`.
28
+ * Click group headers to expand/collapse.
29
+ */
30
+ export const RowGroupDemo = () => (
31
+ <Intable
32
+ class='w-full h-60vh'
33
+ columns={cols}
34
+ onColumnsChange={v => replaceArray(cols, v)}
35
+ data={data}
36
+ onDataChange={v => replaceArray(data, v)}
37
+ index
38
+ border
39
+ stickyHeader
40
+ size='small'
41
+ rowGroup={{ fields: ['category', 'region'] }}
42
+ />
43
+ )
@@ -0,0 +1,27 @@
1
+ import { Intable } from '../../../packages/intable/src'
2
+ import { makeCols, makeData, replaceArray } from './helpers'
3
+
4
+ const cols = makeCols(6)
5
+ const data = makeData(20, 6)
6
+
7
+ /**
8
+ * Checkbox column on the left. Click to select, header checkbox for select-all.
9
+ */
10
+ export const RowSelectionDemo = () => (
11
+ <Intable
12
+ class='w-full h-60vh'
13
+ columns={cols}
14
+ onColumnsChange={v => replaceArray(cols, v)}
15
+ data={data}
16
+ onDataChange={v => replaceArray(data, v)}
17
+ index
18
+ border
19
+ stickyHeader
20
+ size='small'
21
+ rowSelection={{
22
+ enable: true,
23
+ multiple: true,
24
+ onChange: (selected, unselected) => console.log('selected:', selected, 'unselected:', unselected),
25
+ }}
26
+ />
27
+ )
@@ -0,0 +1,45 @@
1
+ import { createMutable } from 'solid-js/store'
2
+ import { Intable } from '../../../packages/intable/src'
3
+ import { replaceArray } from './helpers'
4
+
5
+ const cols = createMutable([
6
+ { id: 'name', name: 'Name', width: 200 },
7
+ { id: 'size', name: 'Size', width: 100 },
8
+ { id: 'type', name: 'Type', width: 120 },
9
+ ])
10
+
11
+ const data = createMutable([
12
+ { id: 1, name: 'src', size: '-', type: 'folder', children: [
13
+ { id: 2, name: 'index.ts', size: '2KB', type: 'file' },
14
+ { id: 3, name: 'utils', size: '-', type: 'folder', children: [
15
+ { id: 4, name: 'helper.ts', size: '1KB', type: 'file' },
16
+ { id: 5, name: 'math.ts', size: '3KB', type: 'file' },
17
+ ]},
18
+ { id: 6, name: 'components', size: '-', type: 'folder', children: [
19
+ { id: 7, name: 'App.tsx', size: '4KB', type: 'file' },
20
+ { id: 8, name: 'Button.tsx', size: '1KB', type: 'file' },
21
+ ]},
22
+ ]},
23
+ { id: 9, name: 'package.json', size: '1KB', type: 'file' },
24
+ { id: 10, name: 'README.md', size: '2KB', type: 'file' },
25
+ ])
26
+
27
+ /**
28
+ * Tree-structured data with expand/collapse.
29
+ * TreePlugin must be added manually.
30
+ */
31
+ export const TreeDemo = () => (
32
+ <Intable
33
+ class='w-full h-60vh'
34
+ columns={cols}
35
+ onColumnsChange={v => replaceArray(cols, v)}
36
+ data={data}
37
+ onDataChange={v => replaceArray(data, v)}
38
+ index
39
+ border
40
+ stickyHeader
41
+ size='small'
42
+ tree={{ children: 'children' }}
43
+ rowKey='id'
44
+ />
45
+ )
@@ -0,0 +1,21 @@
1
+ import { Intable } from '../../../packages/intable/src'
2
+ import { VirtualScrollPlugin } from '../../../packages/intable/src/plugins/VirtualScrollPlugin'
3
+ import { makeCols, makeData, replaceArray } from './helpers'
4
+
5
+ const cols = makeCols(50, { width: 80 })
6
+ const data = makeData(1000, 50)
7
+
8
+ export const VirtualScrollDemo = () => (
9
+ <Intable
10
+ class='h-60vh'
11
+ columns={cols}
12
+ onColumnsChange={v => replaceArray(cols, v)}
13
+ data={data}
14
+ onDataChange={v => replaceArray(data, v)}
15
+ index
16
+ border
17
+ stickyHeader
18
+ size='small'
19
+ plugins={[VirtualScrollPlugin]}
20
+ />
21
+ )
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Shared helpers for demo data generation.
3
+ */
4
+ import { createMutable } from 'solid-js/store'
5
+ import { batch } from 'solid-js'
6
+ import { range } from 'es-toolkit'
7
+
8
+ /** Generate flat tabular data */
9
+ export function makeData(rows: number, colCount: number) {
10
+ const colIds = range(colCount).map(i => 'col_' + i)
11
+ return createMutable(
12
+ range(rows).map((_, i) =>
13
+ Object.fromEntries([
14
+ ['id', i],
15
+ ...colIds.map(id => [id, `${id}_${i + 1}`]),
16
+ ]),
17
+ ),
18
+ )
19
+ }
20
+
21
+ /** Generate column definitions */
22
+ export function makeCols(count: number, extra?: Partial<{ width: number; editable: boolean }>) {
23
+ return createMutable(
24
+ range(count).map(i => ({
25
+ id: 'col_' + i,
26
+ name: 'Col ' + i,
27
+ width: 100,
28
+ ...extra,
29
+ })),
30
+ )
31
+ }
32
+
33
+ /** Shortcut for batch-replacing a reactive array */
34
+ export function replaceArray<T>(arr: T[], next: T[]) {
35
+ batch(() => {
36
+ arr.length = 0
37
+ arr.push(...next)
38
+ })
39
+ }
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Plugin test demo index — renders a list of demo sections,
3
+ * one per plugin, to visually verify each feature.
4
+ */
5
+ import { createSignal, createEffect, onCleanup, For, Show, mergeProps } from 'solid-js'
6
+ import { useSearchParams } from '@solidjs/router'
7
+
8
+ import { BasicDemo } from './BasicDemo'
9
+ import { VirtualScrollDemo } from './VirtualScrollDemo'
10
+ import { HeaderGroupDemo } from './HeaderGroupDemo'
11
+ import { CellSelectionDemo } from './CellSelectionDemo'
12
+ import { EditableDemo } from './EditableDemo'
13
+ import { ExpandDemo } from './ExpandDemo'
14
+ import { RowSelectionDemo } from './RowSelectionDemo'
15
+ import { ResizeDemo } from './ResizeDemo'
16
+ import { DragDemo } from './DragDemo'
17
+ import { RowGroupDemo } from './RowGroupDemo'
18
+ import { CellMergeDemo } from './CellMergeDemo'
19
+ import { HistoryDemo } from './HistoryDemo'
20
+ import { DiffDemo } from './DiffDemo'
21
+ import { TreeDemo } from './TreeDemo'
22
+ import { CopyPasteDemo } from './CopyPasteDemo'
23
+ import { CompositeDemo } from './CompositeDemo'
24
+ import { ReactDemo } from './ReactDemo'
25
+
26
+ // ── Theme CSS (equivalent to: import 'intable/theme/*') ──────────────────────
27
+ import antdCss from '../../../packages/intable/src/theme/antd.scss?inline'
28
+ import elementPlusCss from '../../../packages/intable/src/theme/element-plus.scss?inline'
29
+ import darkCss from '../../../packages/intable/src/theme/dark.scss?inline'
30
+ import shadcnCss from '../../../packages/intable/src/theme/shadcn.scss?inline'
31
+ import stripeCss from '../../../packages/intable/src/theme/stripe.scss?inline'
32
+ import materialCss from '../../../packages/intable/src/theme/material.scss?inline'
33
+ import githubCss from '../../../packages/intable/src/theme/github.scss?inline'
34
+
35
+ const THEMES = [
36
+ { name: 'Default', css: '', color: '#e5e7eb' },
37
+ { name: 'Antd', css: antdCss, color: '#1677ff' },
38
+ { name: 'Element Plus', css: elementPlusCss,color: '#409eff' },
39
+ { name: 'Dark', css: darkCss, color: '#0d1117' },
40
+ { name: 'GitHub', css: githubCss, color: '#1f2328' },
41
+ { name: 'Shadcn', css: shadcnCss, color: '#18181b' },
42
+ { name: 'Stripe', css: stripeCss, color: '#635bff' },
43
+ { name: 'Material', css: materialCss, color: '#6750a4' },
44
+ ]
45
+
46
+ const STYLE_ID = 'intable-theme-override'
47
+
48
+ function applyTheme(css: string) {
49
+ let el = document.getElementById(STYLE_ID) as HTMLStyleElement | null
50
+ if (!el) {
51
+ el = document.createElement('style')
52
+ el.id = STYLE_ID
53
+ document.head.appendChild(el)
54
+ }
55
+ el.textContent = css
56
+ }
57
+
58
+ // ── Custom theme dropdown ─────────────────────────────────────────────────────
59
+ function ThemeSelect(props: { themes: typeof THEMES; value: string; onChange: (v: string) => void }) {
60
+ const [open, setOpen] = createSignal(false)
61
+ let ref!: HTMLDivElement
62
+
63
+ const current = () => props.themes.find(t => t.name === props.value)!
64
+
65
+ const handleOutside = (e: MouseEvent) => {
66
+ if (!ref.contains(e.target as Node)) setOpen(false)
67
+ }
68
+ createEffect(() => {
69
+ if (open()) document.addEventListener('mousedown', handleOutside)
70
+ else document.removeEventListener('mousedown', handleOutside)
71
+ })
72
+ onCleanup(() => document.removeEventListener('mousedown', handleOutside))
73
+
74
+ return (
75
+ <div ref={ref} class='relative w-full'>
76
+ <button
77
+ type='button'
78
+ class='flex items-center gap-1.5 w-full text-xs px-2 py-1.5 rd-1 b-(1 solid #d1d5db) bg-white c-#374151 cursor-pointer text-left'
79
+ onClick={() => setOpen(o => !o)}
80
+ >
81
+ <span class='inline-block w-2.5 h-2.5 rd-full shrink-0 b-(1 solid #0002)' style={{ background: current().color }} />
82
+ <span class='flex-1'>{current().name}</span>
83
+ <svg class='w-3 h-3 c-gray shrink-0' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'>
84
+ <path stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5' />
85
+ </svg>
86
+ </button>
87
+ <Show when={open()}>
88
+ <div class='absolute top-full left-0 right-0 mt-0.5 bg-white b-(1 solid #d1d5db) rd-1 shadow-md z-50 py-0.5'>
89
+ <For each={props.themes}>{t => (
90
+ <button
91
+ type='button'
92
+ class={`flex items-center gap-1.5 w-full px-2 py-1.5 text-xs text-left cursor-pointer transition-colors ${
93
+ props.value === t.name ? 'bg-blue-50 c-blue-600 font-medium' : 'hover:bg-gray-50 c-#374151'
94
+ }`}
95
+ onClick={() => { props.onChange(t.name); setOpen(false) }}
96
+ >
97
+ <span class='inline-block w-2.5 h-2.5 rd-full shrink-0 b-(1 solid #0002)' style={{ background: t.color }} />
98
+ {t.name}
99
+ </button>
100
+ )}</For>
101
+ </div>
102
+ </Show>
103
+ </div>
104
+ )
105
+ }
106
+
107
+ // ── Demo list ─────────────────────────────────────────────────────────────────
108
+ const demos = [
109
+ { name: 'Basic', comp: BasicDemo, desc: 'Minimal table with index, border, sticky header' },
110
+ { name: 'VirtualScroll', comp: VirtualScrollDemo, desc: 'Virtual scroll (X+Y) with 10k rows × 50 cols' },
111
+ { name: 'HeaderGroup', comp: HeaderGroupDemo, desc: 'Nested column header groups with colspan/rowspan' },
112
+ { name: 'CellSelection', comp: CellSelectionDemo, desc: 'Click and drag to select cell ranges' },
113
+ { name: 'Editable', comp: EditableDemo, desc: 'Double-click cells to edit (text, number, select, date…)' },
114
+ { name: 'Expand', comp: ExpandDemo, desc: 'Expandable rows with custom detail render' },
115
+ { name: 'RowSelection', comp: RowSelectionDemo, desc: 'Checkbox row selection (single & multiple)' },
116
+ { name: 'Resize', comp: ResizeDemo, desc: 'Drag column/row borders to resize' },
117
+ { name: 'Drag', comp: DragDemo, desc: 'Drag-and-drop column & row reordering' },
118
+ { name: 'RowGroup', comp: RowGroupDemo, desc: 'Group rows by field values with collapsible headers' },
119
+ { name: 'CellMerge', comp: CellMergeDemo, desc: 'Merge cells (rowspan/colspan)' },
120
+ { name: 'CopyPaste', comp: CopyPasteDemo, desc: 'Copy / paste cell ranges (Ctrl+C / Ctrl+V)' },
121
+ { name: 'Tree', comp: TreeDemo, desc: 'Tree-structured data with expand/collapse' },
122
+ { name: 'History', comp: HistoryDemo, desc: 'Undo / Redo (Ctrl+Z / Ctrl+Y)' },
123
+ { name: 'Diff', comp: DiffDemo, desc: 'Track changes & commit (Ctrl+S)' },
124
+ { name: 'Composite', comp: CompositeDemo, desc: 'All features combined' },
125
+ { name: 'React', comp: ReactDemo, desc: 'React integration demo' }
126
+ ]
127
+
128
+ export const DemoApp = () => {
129
+ const [_qs, setQs] = useSearchParams<any>()
130
+ const qs = mergeProps({ active: demos[0].name, theme: THEMES[0].name }, () => _qs)
131
+
132
+ createEffect(() => {
133
+ const t = THEMES.find(t => t.name === qs.theme)
134
+ applyTheme(t?.css ?? '')
135
+ })
136
+
137
+ onCleanup(() => document.getElementById(STYLE_ID)?.remove())
138
+
139
+ return (
140
+ <div class='flex h-100vh'>
141
+ {/* sidebar */}
142
+ <nav class='w-52 shrink-0 of-y-auto b-r-(1 solid #e5e7eb) p-2 bg-#fafafa flex flex-col gap-1'>
143
+ <h2 class='font-bold text-lg px-2 py-1'>Plugin Demos</h2>
144
+
145
+ {/* Theme switcher — custom dropdown for proper color rendering */}
146
+ <div class='px-2 pb-2 b-b-(1 solid #e5e7eb) mb-1 relative'>
147
+ <label class='text-xs c-gray font-medium tracking-wide uppercase block mb-1'>Theme</label>
148
+ <ThemeSelect themes={THEMES} value={qs.theme} onChange={t => setQs({ theme: t })} />
149
+ </div>
150
+
151
+ {/* Demo list */}
152
+ <For each={demos}>{d => (
153
+ <button
154
+ class={`block w-full text-left px-3 py-1.5 rd-1 text-sm truncate cursor-pointer ${qs.active === d.name ? 'bg-blue-500 c-white' : 'hover:bg-gray/10'}`}
155
+ onClick={() => setQs({ active: d.name })}
156
+ >
157
+ {d.name}
158
+ </button>
159
+ )}</For>
160
+ </nav>
161
+
162
+ {/* main */}
163
+ <main class='flex-1 w-0 p-4 of-auto'>
164
+ <For each={demos}>{d => (
165
+ <Show when={qs.active === d.name}>
166
+ <div class='flex items-baseline gap-3 mb-1'>
167
+ <h2 class='font-bold text-xl'>{d.name}</h2>
168
+ <span class='text-xs c-gray font-mono'>Theme: {qs.theme}</span>
169
+ </div>
170
+ <p class='c-gray text-sm mb-3'>{d.desc}</p>
171
+ <d.comp />
172
+ </Show>
173
+ )}</For>
174
+ </main>
175
+ </div>
176
+ )
177
+ }
178
+
179
+ export default DemoApp
180
+
@@ -0,0 +1,2 @@
1
+ import { Website } from './website'
2
+ export default Website
@@ -0,0 +1,37 @@
1
+ /* intable official website — supplemental styles
2
+ * These override the component's default light-theme CSS variables
3
+ * so the live demo section matches the OLED dark aesthetic.
4
+ */
5
+
6
+ /* ── Live demo: dark-theme table overrides ─────────────────────────────────── */
7
+ .wt-live-demo {
8
+ /* Override the .data-table's own CSS variable declarations */
9
+ .data-table {
10
+ --bg: #0a0a12;
11
+ --c-primary: #6366f1;
12
+ --menu-bg: #1e1e2e;
13
+ --li-hover-bg: rgba(255, 255, 255, .06);
14
+ --table-b-c: rgba(255, 255, 255, .07);
15
+ --table-c: #cbd5e1;
16
+ --table-bg: #0a0a12;
17
+ --table-header-c: #64748b;
18
+ --table-header-bg: #0f0f1a;
19
+ --table-row-hover-bg: rgba(255, 255, 255, .04);
20
+ --select-area-bg: rgba(99, 102, 241, .15);
21
+ color-scheme: dark;
22
+
23
+ background: #0a0a12;
24
+
25
+ th, td {
26
+ border-color: rgba(255, 255, 255, .07);
27
+ }
28
+
29
+ thead th {
30
+ background: #0f0f1a;
31
+ }
32
+
33
+ tr:hover > td {
34
+ background: rgba(255, 255, 255, .04);
35
+ }
36
+ }
37
+ }