@warkypublic/svelix 0.1.46 → 0.2.1
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 +93 -33
- package/dist/components/BetterMenu/BetterMenu.svelte +21 -37
- package/dist/components/BetterMenu/BetterMenuAsyncButton.svelte +21 -31
- package/dist/components/BetterMenu/BetterMenuPreview.svelte +27 -29
- package/dist/components/BetterMenu/MenuRenderer.svelte +40 -51
- package/dist/components/Boxer/Boxer.svelte +492 -602
- package/dist/components/Boxer/BoxerTarget.svelte +6 -46
- package/dist/components/Boxer/BoxerTarget.svelte.d.ts +1 -0
- package/dist/components/Boxer/types.d.ts +0 -1
- package/dist/components/Button.svelte +19 -43
- package/dist/components/ButtonPreview.svelte +2 -11
- package/dist/components/CardGrid/CardGrid.svelte +489 -614
- package/dist/components/CardGrid/CardGrid.svelte.d.ts +4 -0
- package/dist/components/CardGrid/CardGridFilterPanel.svelte +111 -90
- package/dist/components/CardGrid/DefaultCard.svelte +86 -97
- package/dist/components/CardGrid/DefaultCard.svelte.d.ts +1 -0
- package/dist/components/CardGrid/ImageCardStory.svelte +87 -36
- package/dist/components/CardGrid/cardGrid.d.ts +24 -0
- package/dist/components/CardGrid/cardGrid.js +20 -0
- package/dist/components/ContentEditor/CollaboraInsertTextDemo.svelte +5 -10
- package/dist/components/ContentEditor/ContentEditor.svelte +24 -50
- package/dist/components/ContentEditor/subcomponents/AudioPlayer.svelte +17 -17
- package/dist/components/ContentEditor/subcomponents/CollaboraEditor.svelte +244 -309
- package/dist/components/ContentEditor/subcomponents/EmailViewer.svelte +2 -3
- package/dist/components/ContentEditor/subcomponents/ImageViewer.svelte +14 -15
- package/dist/components/ContentEditor/subcomponents/MarkdownViewer.svelte +74 -90
- package/dist/components/ContentEditor/subcomponents/MonacoEditor.svelte +75 -103
- package/dist/components/ContentEditor/subcomponents/Office365Editor.svelte +234 -297
- package/dist/components/ContentEditor/subcomponents/PdfViewer.svelte +14 -20
- package/dist/components/ContentEditor/subcomponents/TextEditor.svelte +122 -150
- package/dist/components/ContentEditor/subcomponents/UnknownFile.svelte +105 -126
- package/dist/components/ContentEditor/subcomponents/VideoPlayer.svelte +17 -17
- package/dist/components/ContentEditor/subcomponents/ZipViewer.svelte +2 -3
- package/dist/components/ErrorBoundary/ErrorBoundary.svelte +41 -58
- package/dist/components/ErrorBoundary/ErrorBoundaryPreview.svelte +8 -16
- package/dist/components/Former/Former.svelte +306 -424
- package/dist/components/Former/FormerButtonArea.svelte +17 -68
- package/dist/components/Former/FormerDrawer.svelte +16 -80
- package/dist/components/Former/FormerDrawerPreview.svelte +99 -89
- package/dist/components/Former/FormerModal.svelte +16 -74
- package/dist/components/Former/FormerModalPreview.svelte +99 -89
- package/dist/components/Former/FormerPreview.svelte +76 -78
- package/dist/components/Former/FormerRestApiPreview.svelte +55 -48
- package/dist/components/Former/formerOverlayHelpers.svelte.d.ts +11 -0
- package/dist/components/Former/formerOverlayHelpers.svelte.js +38 -0
- package/dist/components/Former/index.d.ts +1 -0
- package/dist/components/Former/index.js +1 -0
- package/dist/components/FormerControllers/ButtonCtrl.svelte +13 -49
- package/dist/components/FormerControllers/CtrlFieldShell.svelte +15 -0
- package/dist/components/FormerControllers/CtrlFieldShell.svelte.d.ts +12 -0
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.svelte +285 -457
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlCalendar.svelte +95 -136
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlPickerPanel.svelte +3 -62
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlTimeFields.svelte +143 -217
- package/dist/components/FormerControllers/IconButtonCtrl.svelte +13 -47
- package/dist/components/FormerControllers/InlineWrapper.svelte +12 -41
- package/dist/components/FormerControllers/InlineWrapperPreview.svelte +4 -26
- package/dist/components/FormerControllers/NativeSelectCtrl.svelte +7 -39
- package/dist/components/FormerControllers/NumberInputCtrl.svelte +21 -43
- package/dist/components/FormerControllers/PasswordInputCtrl.svelte +8 -33
- package/dist/components/FormerControllers/SwitchCtrl.svelte +4 -20
- package/dist/components/FormerControllers/TextAreaCtrl.svelte +7 -34
- package/dist/components/FormerControllers/TextInputCtrl.svelte +7 -34
- package/dist/components/FormerControllers/ctrlLoading.svelte.d.ts +8 -0
- package/dist/components/FormerControllers/ctrlLoading.svelte.js +43 -0
- package/dist/components/FormerControllers/index.d.ts +2 -0
- package/dist/components/FormerControllers/index.js +2 -0
- package/dist/components/FormerControllers/utils.d.ts +1 -0
- package/dist/components/FormerControllers/utils.js +3 -0
- package/dist/components/GlobalStateStore/GlobalStateStoreProvider.svelte +73 -120
- package/dist/components/Gridler/components/Gridler.svelte +344 -442
- package/dist/components/Gridler/components/GridlerCanvas.svelte +720 -1115
- package/dist/components/Gridler/components/GridlerEditor.svelte +2 -15
- package/dist/components/Gridler/components/GridlerFull.svelte +521 -841
- package/dist/components/Gridler/components/GridlerFull.svelte.d.ts +1 -1
- package/dist/components/Gridler/components/GridlerFullWithFormerPreview.svelte +194 -147
- package/dist/components/Gridler/components/GridlerSearch.svelte +7 -16
- package/dist/components/Gridler/components/GridlerSearchToggle.svelte +7 -19
- package/dist/components/Gridler/types.d.ts +1 -1
- package/dist/components/Gridler/utils/serverPaging.d.ts +1 -0
- package/dist/components/Gridler/utils/serverPaging.js +7 -0
- package/dist/components/Icons/IconAdd.svelte +1 -3
- package/dist/components/Icons/IconAlertCircle.svelte +1 -3
- package/dist/components/Icons/IconAlertTriangle.svelte +1 -3
- package/dist/components/Icons/IconCamera.svelte +1 -3
- package/dist/components/Icons/IconClose.svelte +1 -3
- package/dist/components/Icons/IconEdit.svelte +1 -3
- package/dist/components/Icons/IconFilter.svelte +1 -3
- package/dist/components/Icons/IconSearch.svelte +1 -3
- package/dist/components/Icons/IconSort.svelte +1 -3
- package/dist/components/Icons/IconTrash.svelte +1 -3
- package/dist/components/Portal/Portal.svelte +14 -38
- package/dist/components/Screenshot/Screenshot.svelte +7 -13
- package/dist/components/Svark/Svark.svelte +680 -852
- package/dist/components/Svark/SvarkContextMenu.svelte +44 -63
- package/dist/components/Svark/SvarkInfiniteLoader.svelte +2 -6
- package/dist/components/Svark/SvarkPager.svelte +2 -28
- package/dist/components/Svark/SvarkSelectionDemo.svelte +4 -8
- package/dist/components/Svark/SvarkTopBar.svelte +9 -74
- package/dist/components/SvarkGrid/SvarkGrid.svelte +877 -1123
- package/dist/components/SvarkGrid/components/SvarkColumnFilterForm.svelte +45 -58
- package/dist/components/SvarkGrid/components/SvarkContextMenu.svelte +44 -63
- package/dist/components/SvarkGrid/components/SvarkHeaderFilterCell.svelte +41 -75
- package/dist/components/SvarkGrid/components/SvarkInfiniteLoader.svelte +2 -6
- package/dist/components/SvarkGrid/components/SvarkPager.svelte +2 -28
- package/dist/components/SvarkGrid/components/SvarkSearchPopover.svelte +8 -16
- package/dist/components/SvarkGrid/components/SvarkTopBar.svelte +6 -62
- package/dist/components/SvarkGrid/internal/SvarkGridView.svelte +345 -507
- package/dist/components/VTree/VTree.svelte +454 -431
- package/dist/components/VTree/VTree.utils.d.ts +23 -0
- package/dist/components/VTree/VTree.utils.js +73 -0
- package/dist/components/VTree/VTreeContextMenu.svelte +21 -33
- package/dist/components/VTree/VTreeControlledSelectionDemo.svelte +20 -0
- package/dist/components/VTree/VTreeControlledSelectionDemo.svelte.d.ts +18 -0
- package/dist/components/VTree/VTreeCustomizationDemo.svelte +23 -0
- package/dist/components/VTree/VTreeCustomizationDemo.svelte.d.ts +18 -0
- package/dist/components/VTree/VTreeEventsDemo.svelte +48 -58
- package/dist/components/VTree/VTreeInteractionDemo.svelte +29 -0
- package/dist/components/VTree/VTreeInteractionDemo.svelte.d.ts +18 -0
- package/dist/components/VTree/VTreeMultiSelectDemo.svelte +27 -0
- package/dist/components/VTree/VTreeMultiSelectDemo.svelte.d.ts +18 -0
- package/dist/components/VTree/VTreeRow.svelte +77 -115
- package/dist/components/VTree/VTreeRow.svelte.d.ts +34 -18
- package/dist/components/VTree/VTreeSearch.svelte +6 -13
- package/dist/components/VTree/VTreeVirtualViewport.svelte +54 -143
- package/dist/components/VTree/VTreeVirtualViewport.svelte.d.ts +35 -18
- package/dist/components/VTree/types.d.ts +39 -1
- package/llm/COMPONENT_GUIDE.md +25 -0
- package/package.json +51 -50
|
@@ -1,63 +1,50 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let op = $state<FilterOp>(current?.op ?? 'contains');
|
|
26
|
-
let value = $state(current?.value ?? '');
|
|
27
|
-
let sort = $state<'none' | 'asc' | 'desc'>(currentSort);
|
|
28
|
-
|
|
29
|
-
$effect(() => {
|
|
30
|
-
op = (current?.op ?? 'contains') as FilterOp;
|
|
31
|
-
value = current?.value ?? '';
|
|
32
|
-
sort = currentSort ?? 'none';
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
function applyIfValid(nextOp: FilterOp, nextValue: string) {
|
|
36
|
-
const v = nextValue.trim();
|
|
37
|
-
// Empty value means "no filter".
|
|
38
|
-
if (!v) {
|
|
39
|
-
onClear();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
onSet({ value: v, op: nextOp });
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function handleOpChange(next: string) {
|
|
46
|
-
const nextOp = (next as FilterOp) ?? 'contains';
|
|
47
|
-
op = nextOp;
|
|
48
|
-
applyIfValid(nextOp, value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function handleValueInput(next: string) {
|
|
52
|
-
value = next;
|
|
53
|
-
applyIfValid(op, next);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function handleClear() {
|
|
57
|
-
value = '';
|
|
58
|
-
op = 'contains';
|
|
1
|
+
<script lang="ts">const { columnId, columnLabel, current, currentSort = "none", onSet, onClear, onSetSort, onClose } = $props();
|
|
2
|
+
const operatorOptions = [{
|
|
3
|
+
value: "contains",
|
|
4
|
+
label: "Contains"
|
|
5
|
+
}, {
|
|
6
|
+
value: "equals",
|
|
7
|
+
label: "Equals"
|
|
8
|
+
}];
|
|
9
|
+
// eslint-disable-next-line svelte/no-unused-svelte-ignore
|
|
10
|
+
// svelte-ignore state_referenced_locally -- intentional initial capture; $effect below syncs prop changes
|
|
11
|
+
let op = $state(current?.op ?? "contains");
|
|
12
|
+
// svelte-ignore state_referenced_locally
|
|
13
|
+
let value = $state(current?.value ?? "");
|
|
14
|
+
// svelte-ignore state_referenced_locally
|
|
15
|
+
let sort = $state(currentSort);
|
|
16
|
+
$effect(() => {
|
|
17
|
+
op = current?.op ?? "contains";
|
|
18
|
+
value = current?.value ?? "";
|
|
19
|
+
sort = currentSort ?? "none";
|
|
20
|
+
});
|
|
21
|
+
function applyIfValid(nextOp, nextValue) {
|
|
22
|
+
const v = nextValue.trim();
|
|
23
|
+
// Empty value means "no filter".
|
|
24
|
+
if (!v) {
|
|
59
25
|
onClear();
|
|
26
|
+
return;
|
|
60
27
|
}
|
|
28
|
+
onSet({
|
|
29
|
+
value: v,
|
|
30
|
+
op: nextOp
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function handleOpChange(next) {
|
|
34
|
+
const nextOp = next ?? "contains";
|
|
35
|
+
op = nextOp;
|
|
36
|
+
applyIfValid(nextOp, value);
|
|
37
|
+
}
|
|
38
|
+
function handleValueInput(next) {
|
|
39
|
+
value = next;
|
|
40
|
+
applyIfValid(op, next);
|
|
41
|
+
}
|
|
42
|
+
function handleClear() {
|
|
43
|
+
value = "";
|
|
44
|
+
op = "contains";
|
|
45
|
+
onClear();
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
61
48
|
</script>
|
|
62
49
|
|
|
63
50
|
<form class="px-3 pt-1 pb-2" aria-label={`Filter ${columnLabel}`} onsubmit={(e) => e.preventDefault()}>
|
|
@@ -1,67 +1,48 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!node) return;
|
|
27
|
-
|
|
28
|
-
const rect = node.getBoundingClientRect();
|
|
29
|
-
const vw = window.innerWidth;
|
|
30
|
-
const vh = window.innerHeight;
|
|
31
|
-
|
|
32
|
-
// Keep the menu inside the viewport with a small gutter.
|
|
33
|
-
const gutter = 8;
|
|
34
|
-
clampedX = Math.max(gutter, Math.min(clampedX, vw - rect.width - gutter));
|
|
35
|
-
clampedY = Math.max(gutter, Math.min(clampedY, vh - rect.height - gutter));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
$effect(() => {
|
|
39
|
-
if (!open) return;
|
|
40
|
-
|
|
41
|
-
const overlay = registerOverlay({ kind: 'contextmenu', mount: 'portal' });
|
|
42
|
-
backdropZ = overlay.layer.backdrop;
|
|
43
|
-
menuZ = overlay.layer.content;
|
|
44
|
-
|
|
45
|
-
clampedX = x;
|
|
46
|
-
clampedY = y;
|
|
47
|
-
|
|
48
|
-
// Wait for the menu to render before measuring and clamping.
|
|
49
|
-
void tick().then(clampToViewport);
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
overlay.unregister();
|
|
53
|
-
backdropZ = 1090;
|
|
54
|
-
menuZ = 1100;
|
|
55
|
-
menuRef = null;
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
$effect(() => {
|
|
60
|
-
if (!open) return;
|
|
61
|
-
clampedX = x;
|
|
62
|
-
clampedY = y;
|
|
63
|
-
void tick().then(clampToViewport);
|
|
1
|
+
<script lang="ts">import Portal from "../../Portal/Portal.svelte";
|
|
2
|
+
import { registerOverlay } from "../../OverlayStack";
|
|
3
|
+
import { tick } from "svelte";
|
|
4
|
+
const { open, x, y, items, onselectitem } = $props();
|
|
5
|
+
let backdropZ = $state(1090);
|
|
6
|
+
let menuZ = $state(1100);
|
|
7
|
+
let menuRef = $state(null);
|
|
8
|
+
let clampedX = $state(0);
|
|
9
|
+
let clampedY = $state(0);
|
|
10
|
+
function clampToViewport() {
|
|
11
|
+
const node = menuRef;
|
|
12
|
+
if (!node) return;
|
|
13
|
+
const rect = node.getBoundingClientRect();
|
|
14
|
+
const vw = window.innerWidth;
|
|
15
|
+
const vh = window.innerHeight;
|
|
16
|
+
// Keep the menu inside the viewport with a small gutter.
|
|
17
|
+
const gutter = 8;
|
|
18
|
+
clampedX = Math.max(gutter, Math.min(clampedX, vw - rect.width - gutter));
|
|
19
|
+
clampedY = Math.max(gutter, Math.min(clampedY, vh - rect.height - gutter));
|
|
20
|
+
}
|
|
21
|
+
$effect(() => {
|
|
22
|
+
if (!open) return;
|
|
23
|
+
const overlay = registerOverlay({
|
|
24
|
+
kind: "contextmenu",
|
|
25
|
+
mount: "portal"
|
|
64
26
|
});
|
|
27
|
+
backdropZ = overlay.layer.backdrop;
|
|
28
|
+
menuZ = overlay.layer.content;
|
|
29
|
+
clampedX = x;
|
|
30
|
+
clampedY = y;
|
|
31
|
+
// Wait for the menu to render before measuring and clamping.
|
|
32
|
+
void tick().then(clampToViewport);
|
|
33
|
+
return () => {
|
|
34
|
+
overlay.unregister();
|
|
35
|
+
backdropZ = 1090;
|
|
36
|
+
menuZ = 1100;
|
|
37
|
+
menuRef = null;
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
$effect(() => {
|
|
41
|
+
if (!open) return;
|
|
42
|
+
clampedX = x;
|
|
43
|
+
clampedY = y;
|
|
44
|
+
void tick().then(clampToViewport);
|
|
45
|
+
});
|
|
65
46
|
</script>
|
|
66
47
|
|
|
67
48
|
<Portal>
|
|
@@ -1,78 +1,44 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
menuStore = undefined;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const columnId = $derived(String(cell.__svarkColumnId ?? (column as any)?.id ?? ''));
|
|
46
|
-
const columnLabel = $derived(String(cell.__svarkColumnLabel ?? (cell as any)?.text ?? columnId));
|
|
47
|
-
const filterable = $derived(Boolean(cell.__svarkFilterable));
|
|
48
|
-
const currentFilter = $derived(cell.__svarkCurrentFilter);
|
|
49
|
-
const isActive = $derived(Boolean(currentFilter?.value?.trim?.() ?? currentFilter?.value));
|
|
50
|
-
const searchHighlight = $derived(Boolean(cell.__svarkSearchHighlight));
|
|
51
|
-
const currentSort = $derived((cell.__svarkCurrentSort ?? 'none') as 'none' | 'asc' | 'desc');
|
|
52
|
-
const menuId = $derived(String(cell.__svarkMenuId ?? `svarkgrid-filter-${columnId}`));
|
|
53
|
-
const canSort = $derived(Boolean((column as any)?.sort));
|
|
54
|
-
|
|
55
|
-
// Read SVAR's sort marks so we can render an indicator (we replace the default header cell).
|
|
56
|
-
const { sortMarks } = api.getReactiveState() as any;
|
|
57
|
-
const sortMark = $derived(sortMarks ? $sortMarks[columnId] : undefined);
|
|
58
|
-
|
|
59
|
-
let iconBtnRef = $state<HTMLButtonElement | null>(null);
|
|
60
|
-
|
|
61
|
-
function openMenu() {
|
|
62
|
-
if (!menuStore) return;
|
|
63
|
-
const rect = iconBtnRef?.getBoundingClientRect();
|
|
64
|
-
menuStore.show(menuId, {
|
|
65
|
-
x: rect ? rect.left : 0,
|
|
66
|
-
y: rect ? rect.bottom + 8 : 0,
|
|
67
|
-
renderer: FilterMenu as any
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function onIconClick(e: MouseEvent) {
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
e.stopPropagation(); // don't trigger column sort
|
|
74
|
-
openMenu();
|
|
75
|
-
}
|
|
1
|
+
<script lang="ts">/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
import SvarkColumnFilterForm from "./SvarkColumnFilterForm.svelte";
|
|
4
|
+
import IconSort from "../../Icons/IconSort.svelte";
|
|
5
|
+
import IconFilter from "../../Icons/IconFilter.svelte";
|
|
6
|
+
const { api, cell, column, row: _row, onaction: _onaction } = $props();
|
|
7
|
+
let menuStore;
|
|
8
|
+
try {
|
|
9
|
+
menuStore = getContext("betterMenuStore");
|
|
10
|
+
} catch {
|
|
11
|
+
menuStore = undefined;
|
|
12
|
+
}
|
|
13
|
+
const columnId = $derived(String(cell.__svarkColumnId ?? column?.id ?? ""));
|
|
14
|
+
const columnLabel = $derived(String(cell.__svarkColumnLabel ?? cell?.text ?? columnId));
|
|
15
|
+
const filterable = $derived(Boolean(cell.__svarkFilterable));
|
|
16
|
+
const currentFilter = $derived(cell.__svarkCurrentFilter);
|
|
17
|
+
const isActive = $derived(Boolean(currentFilter?.value?.trim?.() ?? currentFilter?.value));
|
|
18
|
+
const searchHighlight = $derived(Boolean(cell.__svarkSearchHighlight));
|
|
19
|
+
const currentSort = $derived(cell.__svarkCurrentSort ?? "none");
|
|
20
|
+
const menuId = $derived(String(cell.__svarkMenuId ?? `svarkgrid-filter-${columnId}`));
|
|
21
|
+
const canSort = $derived(Boolean(column?.sort));
|
|
22
|
+
// Read SVAR's sort marks so we can render an indicator (we replace the default header cell).
|
|
23
|
+
// eslint-disable-next-line svelte/no-unused-svelte-ignore
|
|
24
|
+
// svelte-ignore state_referenced_locally -- api is the SVAR grid api, captured once at mount
|
|
25
|
+
const { sortMarks } = api.getReactiveState();
|
|
26
|
+
const sortMark = $derived(sortMarks ? $sortMarks[columnId] : undefined);
|
|
27
|
+
let iconBtnRef = $state(null);
|
|
28
|
+
function openMenu() {
|
|
29
|
+
if (!menuStore) return;
|
|
30
|
+
const rect = iconBtnRef?.getBoundingClientRect();
|
|
31
|
+
menuStore.show(menuId, {
|
|
32
|
+
x: rect ? rect.left : 0,
|
|
33
|
+
y: rect ? rect.bottom + 8 : 0,
|
|
34
|
+
renderer: FilterMenu
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function onIconClick(e) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
e.stopPropagation();
|
|
40
|
+
openMenu();
|
|
41
|
+
}
|
|
76
42
|
</script>
|
|
77
43
|
|
|
78
44
|
{#snippet FilterMenu({ onClose }: { onClose: () => void })}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
dark?: boolean;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
let { dark = false }: Props = $props();
|
|
1
|
+
<script lang="ts">let { dark = false } = $props();
|
|
2
|
+
export {};
|
|
7
3
|
</script>
|
|
8
4
|
|
|
9
5
|
<div class="svark-inf-loader" class:svark-inf-loader-dark={dark} aria-label="Loading more rows...">
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
dark?: boolean;
|
|
4
|
-
page: number;
|
|
5
|
-
total: number;
|
|
6
|
-
totalPages: number;
|
|
7
|
-
pageStart: number;
|
|
8
|
-
pageEnd: number;
|
|
9
|
-
loading: boolean;
|
|
10
|
-
onFirst: () => void;
|
|
11
|
-
onPrev: () => void;
|
|
12
|
-
onNext: () => void;
|
|
13
|
-
onLast: () => void;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
let {
|
|
17
|
-
dark = false,
|
|
18
|
-
page,
|
|
19
|
-
total,
|
|
20
|
-
totalPages,
|
|
21
|
-
pageStart,
|
|
22
|
-
pageEnd,
|
|
23
|
-
loading,
|
|
24
|
-
onFirst,
|
|
25
|
-
onPrev,
|
|
26
|
-
onNext,
|
|
27
|
-
onLast
|
|
28
|
-
}: Props = $props();
|
|
1
|
+
<script lang="ts">let { dark = false, page, total, totalPages, pageStart, pageEnd, loading, onFirst, onPrev, onNext, onLast } = $props();
|
|
2
|
+
export {};
|
|
29
3
|
</script>
|
|
30
4
|
|
|
31
5
|
<div class="svark-pager" class:svark-pager-dark={dark} aria-label="Pagination">
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const { value, onChange, onClose }: Props = $props();
|
|
9
|
-
|
|
10
|
-
let inputEl = $state<HTMLInputElement | null>(null);
|
|
11
|
-
|
|
12
|
-
$effect(() => {
|
|
13
|
-
queueMicrotask(() => {
|
|
14
|
-
inputEl?.focus();
|
|
15
|
-
inputEl?.select();
|
|
16
|
-
});
|
|
1
|
+
<script lang="ts">const { value, onChange, onClose } = $props();
|
|
2
|
+
let inputEl = $state(null);
|
|
3
|
+
$effect(() => {
|
|
4
|
+
queueMicrotask(() => {
|
|
5
|
+
inputEl?.focus();
|
|
6
|
+
inputEl?.select();
|
|
17
7
|
});
|
|
8
|
+
});
|
|
9
|
+
export {};
|
|
18
10
|
</script>
|
|
19
11
|
|
|
20
12
|
<form class="px-3 pt-1 pb-2" role="search" aria-label="Grid search" onsubmit={(e) => e.preventDefault()}>
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export interface Props {
|
|
5
|
-
dark?: boolean;
|
|
6
|
-
topBarLeft?: Snippet;
|
|
7
|
-
topBarRight?: Snippet;
|
|
8
|
-
searchOpen: boolean;
|
|
9
|
-
onToggleSearch: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let {
|
|
13
|
-
dark = false,
|
|
14
|
-
topBarLeft,
|
|
15
|
-
topBarRight,
|
|
16
|
-
searchOpen,
|
|
17
|
-
onToggleSearch,
|
|
18
|
-
}: Props = $props();
|
|
1
|
+
<script lang="ts">let { dark = false, topBarLeft, topBarRight, searchOpen, onToggleSearch } = $props();
|
|
2
|
+
export {};
|
|
19
3
|
</script>
|
|
20
4
|
|
|
21
5
|
<div class="svark-toolbar" class:svark-toolbar-dark={dark} aria-label="Grid tools">
|
|
@@ -84,44 +68,7 @@
|
|
|
84
68
|
gap: 0.5rem;
|
|
85
69
|
}
|
|
86
70
|
|
|
87
|
-
.svark-
|
|
88
|
-
.svark-select {
|
|
89
|
-
min-width: 0;
|
|
90
|
-
height: 28px;
|
|
91
|
-
padding: 0 0.5rem;
|
|
92
|
-
border: 1px solid var(--color-surface-200, #e2e8f0);
|
|
93
|
-
border-radius: 6px;
|
|
94
|
-
background: var(--color-surface-50, #ffffff);
|
|
95
|
-
color: var(--color-surface-contrast-50, #111827);
|
|
96
|
-
font-size: 12px;
|
|
97
|
-
outline: none;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.svark-toolbar-dark .svark-input,
|
|
101
|
-
.svark-toolbar-dark .svark-select {
|
|
102
|
-
border-color: var(--color-surface-800, #384047);
|
|
103
|
-
background: var(--color-surface-900, #2a2b2d);
|
|
104
|
-
color: var(--color-surface-contrast-900, rgba(255, 255, 255, 0.92));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.svark-input:focus,
|
|
108
|
-
.svark-select:focus {
|
|
109
|
-
border-color: var(--color-primary-500, #4f46e5);
|
|
110
|
-
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
|
|
111
|
-
box-shadow: 0 0 0 3px
|
|
112
|
-
color-mix(in oklab, var(--color-primary-500, #4f46e5) 22%, transparent);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.svark-toolbar-dark .svark-input:focus,
|
|
116
|
-
.svark-toolbar-dark .svark-select:focus {
|
|
117
|
-
border-color: var(--color-primary-400, #7a67eb);
|
|
118
|
-
box-shadow: 0 0 0 3px rgba(122, 103, 235, 0.18);
|
|
119
|
-
box-shadow: 0 0 0 3px
|
|
120
|
-
color-mix(in oklab, var(--color-primary-400, #7a67eb) 28%, transparent);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.svark-tool-btn,
|
|
124
|
-
.svark-chip-btn {
|
|
71
|
+
.svark-tool-btn {
|
|
125
72
|
height: 28px;
|
|
126
73
|
padding: 0 0.5rem;
|
|
127
74
|
border: 1px solid var(--color-surface-200, #e2e8f0);
|
|
@@ -133,19 +80,16 @@
|
|
|
133
80
|
transition: background 0.15s;
|
|
134
81
|
}
|
|
135
82
|
|
|
136
|
-
.svark-toolbar-dark .svark-tool-btn
|
|
137
|
-
.svark-toolbar-dark .svark-chip-btn {
|
|
83
|
+
.svark-toolbar-dark .svark-tool-btn {
|
|
138
84
|
border-color: var(--color-surface-800, #384047);
|
|
139
85
|
color: var(--color-surface-contrast-900, rgba(255, 255, 255, 0.9));
|
|
140
86
|
}
|
|
141
87
|
|
|
142
|
-
.svark-tool-btn:hover
|
|
143
|
-
.svark-chip-btn:hover {
|
|
88
|
+
.svark-tool-btn:hover {
|
|
144
89
|
background: var(--color-surface-100, #eaedf5);
|
|
145
90
|
}
|
|
146
91
|
|
|
147
|
-
.svark-toolbar-dark .svark-tool-btn:hover
|
|
148
|
-
.svark-toolbar-dark .svark-chip-btn:hover {
|
|
92
|
+
.svark-toolbar-dark .svark-tool-btn:hover {
|
|
149
93
|
background: var(--color-surface-800, #384047);
|
|
150
94
|
}
|
|
151
95
|
|