@lapis-notes/csv 0.0.0-stage → 0.2.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/CHANGELOG.md +22 -0
- package/LICENSE.md +4 -0
- package/README.md +19 -2
- package/dist/app.css +210 -0
- package/dist/csv-settings.d.ts +13 -0
- package/dist/csv-settings.js +28 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/lib/CsvSheet.svelte +58 -0
- package/dist/lib/CsvSheet.svelte.d.ts +11 -0
- package/dist/lib/CsvTable.svelte +58 -0
- package/dist/lib/CsvTable.svelte.d.ts +11 -0
- package/dist/lib/codemirror/csv-language-extensions.d.ts +3 -0
- package/dist/lib/codemirror/csv-language-extensions.js +11 -0
- package/dist/lib/codemirror/csv-language.d.ts +3 -0
- package/dist/lib/codemirror/csv-language.js +24 -0
- package/dist/lib/codemirror/csv-rainbow-theme.d.ts +3 -0
- package/dist/lib/codemirror/csv-rainbow-theme.js +15 -0
- package/dist/lib/codemirror/csv-source-extensions.d.ts +7 -0
- package/dist/lib/codemirror/csv-source-extensions.js +9 -0
- package/dist/lib/codemirror/csv.parser.d.ts +2 -0
- package/dist/lib/codemirror/csv.parser.js +16 -0
- package/dist/lib/codemirror/csv.parser.terms.d.ts +1 -0
- package/dist/lib/codemirror/csv.parser.terms.js +2 -0
- package/dist/lib/codemirror/syntax.grammar +36 -0
- package/dist/lib/components/csv-cell.svelte +137 -0
- package/dist/lib/components/csv-cell.svelte.d.ts +11 -0
- package/dist/lib/components/csv-data-table-column-head.svelte +76 -0
- package/dist/lib/components/csv-data-table-column-head.svelte.d.ts +17 -0
- package/dist/lib/components/csv-data-table-column-header.svelte +159 -0
- package/dist/lib/components/csv-data-table-column-header.svelte.d.ts +23 -0
- package/dist/lib/components/csv-data-table-data-cell.svelte +72 -0
- package/dist/lib/components/csv-data-table-data-cell.svelte.d.ts +18 -0
- package/dist/lib/components/csv-data-table-drag-overlay.svelte +119 -0
- package/dist/lib/components/csv-data-table-drag-overlay.svelte.d.ts +13 -0
- package/dist/lib/components/csv-data-table-row-actions.svelte +47 -0
- package/dist/lib/components/csv-data-table-row-actions.svelte.d.ts +8 -0
- package/dist/lib/components/csv-data-table-row-grip-cell.svelte +102 -0
- package/dist/lib/components/csv-data-table-row-grip-cell.svelte.d.ts +19 -0
- package/dist/lib/components/csv-data-table-row.svelte +38 -0
- package/dist/lib/components/csv-data-table-row.svelte.d.ts +11 -0
- package/dist/lib/components/csv-data-table.svelte +903 -0
- package/dist/lib/components/csv-data-table.svelte.d.ts +21 -0
- package/dist/lib/components/csv-find.svelte +382 -0
- package/dist/lib/components/csv-find.svelte.d.ts +24 -0
- package/dist/lib/components/csv-row-virtualizer.svelte.d.ts +9 -0
- package/dist/lib/components/csv-row-virtualizer.svelte.js +59 -0
- package/dist/lib/components/csv-source-view.svelte +127 -0
- package/dist/lib/components/csv-source-view.svelte.d.ts +10 -0
- package/dist/lib/components/csv-status-bar.svelte +101 -0
- package/dist/lib/components/csv-status-bar.svelte.d.ts +14 -0
- package/dist/lib/components/csv-table-dnd.d.ts +9 -0
- package/dist/lib/components/csv-table-dnd.js +12 -0
- package/dist/lib/components/csv-table-drag-measure.d.ts +7 -0
- package/dist/lib/components/csv-table-drag-measure.js +38 -0
- package/dist/lib/components/csv-table-selection.d.ts +28 -0
- package/dist/lib/components/csv-table-selection.js +178 -0
- package/dist/lib/components/csv-table-view.svelte +265 -0
- package/dist/lib/components/csv-table-view.svelte.d.ts +16 -0
- package/dist/lib/csv-plugin.d.ts +9 -0
- package/dist/lib/csv-plugin.js +107 -0
- package/dist/lib/csv-view-settings.d.ts +43 -0
- package/dist/lib/csv-view-settings.js +86 -0
- package/dist/lib/ids.d.ts +8 -0
- package/dist/lib/ids.js +19 -0
- package/dist/lib/model/csv-column-sort.d.ts +16 -0
- package/dist/lib/model/csv-column-sort.js +81 -0
- package/dist/lib/model/csv-grid.d.ts +31 -0
- package/dist/lib/model/csv-grid.js +161 -0
- package/dist/lib/model/csv-search.d.ts +38 -0
- package/dist/lib/model/csv-search.js +101 -0
- package/dist/lib/model/csv-table-model.d.ts +10 -0
- package/dist/lib/model/csv-table-model.js +18 -0
- package/dist/lib/model/parse-csv.d.ts +10 -0
- package/dist/lib/model/parse-csv.js +13 -0
- package/dist/lib/model/serialize-csv.d.ts +5 -0
- package/dist/lib/model/serialize-csv.js +10 -0
- package/dist/lib/sheet/csv-sheet-toolbar.svelte +244 -0
- package/dist/lib/sheet/csv-sheet-toolbar.svelte.d.ts +20 -0
- package/dist/lib/sheet/csv-sheet-view.svelte +444 -0
- package/dist/lib/sheet/csv-sheet-view.svelte.d.ts +18 -0
- package/dist/lib/sheet/csv-sheet.svelte +1121 -0
- package/dist/lib/sheet/csv-sheet.svelte.d.ts +37 -0
- package/dist/lib/sheet/sheet-glyph.svelte +57 -0
- package/dist/lib/sheet/sheet-glyph.svelte.d.ts +7 -0
- package/dist/lib/sheet/sheet-history.d.ts +14 -0
- package/dist/lib/sheet/sheet-history.js +33 -0
- package/dist/lib/sheet/sheet-layout.d.ts +121 -0
- package/dist/lib/sheet/sheet-layout.js +336 -0
- package/dist/lib/sheet/sheet-paint.d.ts +45 -0
- package/dist/lib/sheet/sheet-paint.js +274 -0
- package/dist/lib/sheet/sheet-theme.d.ts +2 -0
- package/dist/lib/sheet/sheet-theme.js +26 -0
- package/dist/lib/views/csv-view-mode.d.ts +3 -0
- package/dist/lib/views/csv-view-mode.js +6 -0
- package/dist/lib/views/csv-view.d.ts +24 -0
- package/dist/lib/views/csv-view.js +125 -0
- package/dist/styles/csv-find.css +313 -0
- package/dist/styles/csv-table.css +882 -0
- package/dist/styles.css +37 -0
- package/manifest.json +45 -0
- package/package.json +86 -3
- package/registry-content/overview.md +3 -0
- package/registry.json +322 -0
- package/styles.css +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import BetweenVerticalEndIcon from "@lucide/svelte/icons/between-vertical-end";
|
|
3
|
+
import BetweenVerticalStartIcon from "@lucide/svelte/icons/between-vertical-start";
|
|
4
|
+
import EllipsisIcon from "@lucide/svelte/icons/ellipsis";
|
|
5
|
+
import Trash2Icon from "@lucide/svelte/icons/trash-2";
|
|
6
|
+
import { Button } from "@lapismd/design-core/shadcn/button";
|
|
7
|
+
import * as DropdownMenu from "@lapismd/design-core/shadcn/dropdown-menu";
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
onInsertAbove?: () => void;
|
|
11
|
+
onInsertBelow?: () => void;
|
|
12
|
+
onDelete?: () => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
let { onInsertAbove, onInsertBelow, onDelete }: Props = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<DropdownMenu.Root>
|
|
19
|
+
<DropdownMenu.Trigger>
|
|
20
|
+
{#snippet child({ props }: { props: Record<string, unknown> })}
|
|
21
|
+
<Button
|
|
22
|
+
{...props}
|
|
23
|
+
class="csv-data-table__row-actions"
|
|
24
|
+
size="icon"
|
|
25
|
+
variant="ghost"
|
|
26
|
+
aria-label="Row actions"
|
|
27
|
+
>
|
|
28
|
+
<EllipsisIcon />
|
|
29
|
+
</Button>
|
|
30
|
+
{/snippet}
|
|
31
|
+
</DropdownMenu.Trigger>
|
|
32
|
+
<DropdownMenu.Content align="end" class="csv-data-table__menu">
|
|
33
|
+
<DropdownMenu.Item onclick={() => onInsertAbove?.()}>
|
|
34
|
+
<BetweenVerticalStartIcon class="csv-data-table__header-icon" />
|
|
35
|
+
Insert row above
|
|
36
|
+
</DropdownMenu.Item>
|
|
37
|
+
<DropdownMenu.Item onclick={() => onInsertBelow?.()}>
|
|
38
|
+
<BetweenVerticalEndIcon class="csv-data-table__header-icon" />
|
|
39
|
+
Insert row below
|
|
40
|
+
</DropdownMenu.Item>
|
|
41
|
+
<DropdownMenu.Separator />
|
|
42
|
+
<DropdownMenu.Item onclick={() => onDelete?.()}>
|
|
43
|
+
<Trash2Icon class="csv-data-table__header-icon" />
|
|
44
|
+
Delete row
|
|
45
|
+
</DropdownMenu.Item>
|
|
46
|
+
</DropdownMenu.Content>
|
|
47
|
+
</DropdownMenu.Root>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
onInsertAbove?: () => void;
|
|
3
|
+
onInsertBelow?: () => void;
|
|
4
|
+
onDelete?: () => void;
|
|
5
|
+
};
|
|
6
|
+
declare const CsvDataTableRowActions: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type CsvDataTableRowActions = ReturnType<typeof CsvDataTableRowActions>;
|
|
8
|
+
export default CsvDataTableRowActions;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createDraggable, createDroppable } from "@dnd-kit/svelte";
|
|
3
|
+
import GripVertical from "@lucide/svelte/icons/grip-vertical";
|
|
4
|
+
import * as Table from "@lapismd/design-core/shadcn/table";
|
|
5
|
+
import { Button } from "@lapismd/design-core/shadcn/button";
|
|
6
|
+
import { cn } from "@lapis-notes/ui";
|
|
7
|
+
import type { Snippet } from "svelte";
|
|
8
|
+
import type { CsvTableDragSource } from "./csv-table-dnd";
|
|
9
|
+
import { dropIndicatorClasses } from "./csv-table-dnd";
|
|
10
|
+
|
|
11
|
+
type Props = {
|
|
12
|
+
rowIndex: number;
|
|
13
|
+
colIndex: number;
|
|
14
|
+
class?: string;
|
|
15
|
+
dragSource: CsvTableDragSource | null;
|
|
16
|
+
dragOverIndex: number | null;
|
|
17
|
+
selectedClass?: string;
|
|
18
|
+
isColDragSource?: boolean;
|
|
19
|
+
onSelectRow?: () => void;
|
|
20
|
+
onmousedown?: (event: MouseEvent) => void;
|
|
21
|
+
onmouseenter?: (event: MouseEvent) => void;
|
|
22
|
+
oncontextmenu?: (event: MouseEvent) => void;
|
|
23
|
+
children: Snippet;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
let {
|
|
27
|
+
rowIndex,
|
|
28
|
+
colIndex,
|
|
29
|
+
class: className,
|
|
30
|
+
dragSource,
|
|
31
|
+
dragOverIndex,
|
|
32
|
+
selectedClass,
|
|
33
|
+
isColDragSource = false,
|
|
34
|
+
onSelectRow,
|
|
35
|
+
onmousedown,
|
|
36
|
+
onmouseenter,
|
|
37
|
+
oncontextmenu,
|
|
38
|
+
children,
|
|
39
|
+
}: Props = $props();
|
|
40
|
+
|
|
41
|
+
let cellRef = $state<HTMLElement | null>(null);
|
|
42
|
+
|
|
43
|
+
const rowDraggable = createDraggable({
|
|
44
|
+
get id() {
|
|
45
|
+
return `csv-row:${rowIndex}`;
|
|
46
|
+
},
|
|
47
|
+
type: "csv-table-row",
|
|
48
|
+
get data() {
|
|
49
|
+
return { type: "csv-table-row" as const, index: rowIndex };
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const rowDroppable = createDroppable({
|
|
54
|
+
get id() {
|
|
55
|
+
return `csv-row-drop:${rowIndex}:grip`;
|
|
56
|
+
},
|
|
57
|
+
accept: "csv-table-row",
|
|
58
|
+
get data() {
|
|
59
|
+
return { type: "csv-table-row" as const, index: rowIndex };
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
$effect(() => {
|
|
64
|
+
if (!cellRef) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const cleanupDraggable = rowDraggable.attach(cellRef);
|
|
68
|
+
const cleanupDroppable = rowDroppable.attach(cellRef);
|
|
69
|
+
return () => {
|
|
70
|
+
cleanupDraggable();
|
|
71
|
+
cleanupDroppable();
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<Table.Cell
|
|
77
|
+
bind:ref={cellRef}
|
|
78
|
+
data-csv-col-index={colIndex}
|
|
79
|
+
{onmousedown}
|
|
80
|
+
{onmouseenter}
|
|
81
|
+
{oncontextmenu}
|
|
82
|
+
class={cn(
|
|
83
|
+
"csv-data-table__cell",
|
|
84
|
+
className,
|
|
85
|
+
selectedClass,
|
|
86
|
+
dropIndicatorClasses(dragSource, dragOverIndex, rowIndex, colIndex),
|
|
87
|
+
isColDragSource && "is-drag-source is-col-drag-source",
|
|
88
|
+
)}
|
|
89
|
+
>
|
|
90
|
+
<Button
|
|
91
|
+
variant="ghost"
|
|
92
|
+
size="xs"
|
|
93
|
+
data-grab-handle=""
|
|
94
|
+
class="csv-data-table__row-grip"
|
|
95
|
+
aria-label="Drag row"
|
|
96
|
+
onclick={() => onSelectRow?.()}
|
|
97
|
+
{@attach rowDraggable.attachHandle}
|
|
98
|
+
>
|
|
99
|
+
<GripVertical />
|
|
100
|
+
</Button>
|
|
101
|
+
{@render children()}
|
|
102
|
+
</Table.Cell>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
import type { CsvTableDragSource } from "./csv-table-dnd";
|
|
3
|
+
type Props = {
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
colIndex: number;
|
|
6
|
+
class?: string;
|
|
7
|
+
dragSource: CsvTableDragSource | null;
|
|
8
|
+
dragOverIndex: number | null;
|
|
9
|
+
selectedClass?: string;
|
|
10
|
+
isColDragSource?: boolean;
|
|
11
|
+
onSelectRow?: () => void;
|
|
12
|
+
onmousedown?: (event: MouseEvent) => void;
|
|
13
|
+
onmouseenter?: (event: MouseEvent) => void;
|
|
14
|
+
oncontextmenu?: (event: MouseEvent) => void;
|
|
15
|
+
children: Snippet;
|
|
16
|
+
};
|
|
17
|
+
declare const CsvDataTableRowGripCell: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type CsvDataTableRowGripCell = ReturnType<typeof CsvDataTableRowGripCell>;
|
|
19
|
+
export default CsvDataTableRowGripCell;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Table from "@lapismd/design-core/shadcn/table";
|
|
3
|
+
import { cn } from "@lapis-notes/ui";
|
|
4
|
+
import type { Snippet } from "svelte";
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
rowIndex: number;
|
|
8
|
+
virtualIndex: number;
|
|
9
|
+
class?: string;
|
|
10
|
+
isRowDragSource?: boolean;
|
|
11
|
+
children: Snippet;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
rowIndex,
|
|
16
|
+
virtualIndex,
|
|
17
|
+
class: className,
|
|
18
|
+
isRowDragSource = false,
|
|
19
|
+
children,
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
let hovered = $state(false);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<Table.Row
|
|
26
|
+
data-index={virtualIndex}
|
|
27
|
+
data-csv-row-index={rowIndex}
|
|
28
|
+
data-csv-hover={hovered ? "true" : undefined}
|
|
29
|
+
class={cn(className, isRowDragSource && "is-drag-source is-row-drag-source")}
|
|
30
|
+
onpointerenter={() => {
|
|
31
|
+
hovered = true;
|
|
32
|
+
}}
|
|
33
|
+
onpointerleave={() => {
|
|
34
|
+
hovered = false;
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{@render children()}
|
|
38
|
+
</Table.Row>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
2
|
+
type Props = {
|
|
3
|
+
rowIndex: number;
|
|
4
|
+
virtualIndex: number;
|
|
5
|
+
class?: string;
|
|
6
|
+
isRowDragSource?: boolean;
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
|
+
declare const CsvDataTableRow: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type CsvDataTableRow = ReturnType<typeof CsvDataTableRow>;
|
|
11
|
+
export default CsvDataTableRow;
|