fuma 2.1.0 → 2.1.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/dist/state/param.svelte.d.ts +6 -7
- package/dist/state/param.svelte.js +16 -18
- package/dist/ui/table/Table.svelte +2 -3
- package/dist/ui/table/Table.svelte.d.ts +2 -2
- package/dist/ui/table/TableViewSelect.svelte +2 -1
- package/dist/ui/table/cell/TableCellArray.svelte +1 -1
- package/dist/ui/table/field.d.ts +7 -7
- package/dist/ui/table/head/TableHeadDate.svelte +1 -5
- package/dist/ui/table/head/TableHeadNumber.svelte +0 -1
- package/package.json +16 -12
- package/dist/ui/table/type.d.ts +0 -2
- package/dist/ui/table/type.js +0 -1
|
@@ -1,18 +1,17 @@
|
|
|
1
|
+
import type { ResolvedPathname } from '$app/types';
|
|
1
2
|
export declare const param: {
|
|
2
3
|
readonly with: (params: Record<string, string | number>, ...keysToRemove: string[]) => string;
|
|
3
4
|
readonly without: (...keys: string[]) => string;
|
|
4
5
|
readonly toggle: (params: Record<string, string>, ...keysToRemove: string[]) => string;
|
|
5
|
-
readonly has: (key: string) => boolean;
|
|
6
|
+
readonly has: (key: string, value?: string) => boolean;
|
|
6
7
|
readonly get: (key: string) => string | null;
|
|
7
|
-
readonly hasValue: (key: string, value: string) => boolean;
|
|
8
8
|
readonly keys: () => URLSearchParamsIterator<string>;
|
|
9
9
|
};
|
|
10
10
|
export declare const urlParam: {
|
|
11
|
-
with: (params: Record<string, string | number>, ...keysToRemove: string[]) =>
|
|
12
|
-
without: (...args: string[]) =>
|
|
13
|
-
toggle: (params: Record<string, string>, ...keysToRemove: string[]) =>
|
|
14
|
-
has: (key: string) => boolean;
|
|
11
|
+
with: (params: Record<string, string | number>, ...keysToRemove: string[]) => ResolvedPathname;
|
|
12
|
+
without: (...args: string[]) => ResolvedPathname;
|
|
13
|
+
toggle: (params: Record<string, string>, ...keysToRemove: string[]) => ResolvedPathname;
|
|
14
|
+
has: (key: string, value?: string) => boolean;
|
|
15
15
|
get: (key: string) => string | null;
|
|
16
|
-
hasValue: (key: string, value: string) => boolean;
|
|
17
16
|
keys: () => URLSearchParamsIterator<string>;
|
|
18
17
|
};
|
|
@@ -1,56 +1,54 @@
|
|
|
1
1
|
import { page } from '$app/state';
|
|
2
|
+
import { SvelteURLSearchParams } from 'svelte/reactivity';
|
|
2
3
|
export const param = {
|
|
3
4
|
get with() {
|
|
4
5
|
return (params, ...keysToRemove) => {
|
|
5
|
-
const
|
|
6
|
+
const searchParams = new SvelteURLSearchParams(page.url.searchParams);
|
|
6
7
|
Object.entries(params).forEach(([key, value]) => {
|
|
7
|
-
|
|
8
|
+
searchParams.set(key, String(value));
|
|
8
9
|
});
|
|
9
10
|
keysToRemove.forEach((key) => {
|
|
10
|
-
|
|
11
|
+
searchParams.delete(key);
|
|
11
12
|
});
|
|
12
|
-
return
|
|
13
|
+
return searchParams.toString();
|
|
13
14
|
};
|
|
14
15
|
},
|
|
15
16
|
get without() {
|
|
16
17
|
return (...keys) => {
|
|
17
|
-
const
|
|
18
|
+
const searchParams = new SvelteURLSearchParams(page.url.searchParams);
|
|
18
19
|
keys.forEach((key) => {
|
|
19
|
-
|
|
20
|
+
searchParams.delete(key);
|
|
20
21
|
});
|
|
21
|
-
return
|
|
22
|
+
return searchParams.toString();
|
|
22
23
|
};
|
|
23
24
|
},
|
|
24
25
|
get toggle() {
|
|
25
26
|
return (params, ...keysToRemove) => {
|
|
26
|
-
const
|
|
27
|
+
const searchParams = new SvelteURLSearchParams(page.url.searchParams);
|
|
27
28
|
Object.entries(params).forEach(([key, value]) => {
|
|
28
|
-
if (
|
|
29
|
-
|
|
29
|
+
if (searchParams.get(key) === value)
|
|
30
|
+
searchParams.delete(key);
|
|
30
31
|
else
|
|
31
|
-
|
|
32
|
+
searchParams.set(key, value);
|
|
32
33
|
});
|
|
33
34
|
keysToRemove.forEach((key) => {
|
|
34
|
-
|
|
35
|
+
searchParams.delete(key);
|
|
35
36
|
});
|
|
36
|
-
return
|
|
37
|
+
return searchParams.toString();
|
|
37
38
|
};
|
|
38
39
|
},
|
|
39
40
|
get has() {
|
|
40
|
-
return (key) => page.url.searchParams.has(key);
|
|
41
|
+
return (key, value) => page.url.searchParams.has(key, value);
|
|
41
42
|
},
|
|
42
43
|
get get() {
|
|
43
44
|
return (key) => page.url.searchParams.get(key);
|
|
44
45
|
},
|
|
45
|
-
get hasValue() {
|
|
46
|
-
return (key, value) => page.url.searchParams.get(key) === value;
|
|
47
|
-
},
|
|
48
46
|
get keys() {
|
|
49
47
|
return () => page.url.searchParams.keys();
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
50
|
function addPathname(fn) {
|
|
53
|
-
return (...args) => page.url.pathname + fn(...args);
|
|
51
|
+
return (...args) => (page.url.pathname + '?' + fn(...args));
|
|
54
52
|
}
|
|
55
53
|
export const urlParam = {
|
|
56
54
|
...param,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" generics="Item extends ItemBase">
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
2
3
|
import { afterNavigate } from '$app/navigation'
|
|
3
|
-
|
|
4
4
|
import {
|
|
5
5
|
context,
|
|
6
6
|
createKeys,
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
type TableField,
|
|
11
11
|
TableHead
|
|
12
12
|
} from './index.js'
|
|
13
|
-
import type { SnippetLike } from './type.js'
|
|
14
13
|
|
|
15
14
|
let {
|
|
16
15
|
key = 'table',
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
key?: string
|
|
29
28
|
fields: TableField<Item>[]
|
|
30
29
|
items: Item[]
|
|
31
|
-
actions?:
|
|
30
|
+
actions?: Snippet<[Item]>
|
|
32
31
|
placholder?: string
|
|
33
32
|
class?: string
|
|
34
33
|
classRow?: string
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
1
2
|
import { type ItemBase, type TableField } from './index.js';
|
|
2
|
-
import type { SnippetLike } from './type.js';
|
|
3
3
|
declare function $$render<Item extends ItemBase>(): {
|
|
4
4
|
props: {
|
|
5
5
|
key?: string;
|
|
6
6
|
fields: TableField<Item>[];
|
|
7
7
|
items: Item[];
|
|
8
|
-
actions?:
|
|
8
|
+
actions?: Snippet<[Item]>;
|
|
9
9
|
placholder?: string;
|
|
10
10
|
class?: string;
|
|
11
11
|
classRow?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { ChevronDownIcon, PlusIcon, SaveIcon } from '@lucide/svelte'
|
|
3
|
-
import { enhance } from '$app/forms'
|
|
4
3
|
import { page } from '$app/state'
|
|
5
4
|
|
|
6
5
|
import { Dialog } from '../dialog/index.js'
|
|
@@ -49,6 +48,8 @@
|
|
|
49
48
|
let isNewView = $derived(!!query && !selectedView)
|
|
50
49
|
</script>
|
|
51
50
|
|
|
51
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable
|
|
52
|
+
@typescript-eslint/no-unused-vars */
|
|
52
53
|
<DropDown>
|
|
53
54
|
{#snippet activator()}
|
|
54
55
|
<button
|
package/dist/ui/table/field.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
1
2
|
import type { Options } from '../../utils/options.js';
|
|
2
|
-
import type { SnippetLike } from './type.js';
|
|
3
3
|
export type Primitive = string | number | boolean | Date;
|
|
4
4
|
export type ItemBase = {
|
|
5
5
|
id: string | number;
|
|
@@ -15,8 +15,8 @@ type TableFieldCommon<Item extends ItemBase> = {
|
|
|
15
15
|
sortable?: boolean;
|
|
16
16
|
/** Internal usage */
|
|
17
17
|
_visible?: boolean;
|
|
18
|
-
cell: ((item: Item) =>
|
|
19
|
-
head?:
|
|
18
|
+
cell: ((item: Item) => Snippet<[Item]>) | ((item: Item) => null | undefined | Primitive | Primitive[]);
|
|
19
|
+
head?: Snippet<[Item]>;
|
|
20
20
|
};
|
|
21
21
|
type TableFieldPrimitve = {
|
|
22
22
|
type?: 'string' | 'textarea' | 'number' | 'boolean' | 'date';
|
|
@@ -37,8 +37,8 @@ export declare function syncFieldsWithParams<Item extends ItemBase>(tablekey: st
|
|
|
37
37
|
locked?: boolean;
|
|
38
38
|
visible?: boolean;
|
|
39
39
|
sortable?: boolean;
|
|
40
|
-
cell: ((item: Item) =>
|
|
41
|
-
head?:
|
|
40
|
+
cell: ((item: Item) => Snippet<[Item]>) | ((item: Item) => null | undefined | Primitive | Primitive[]);
|
|
41
|
+
head?: Snippet<[Item]> | undefined;
|
|
42
42
|
type?: "string" | "textarea" | "number" | "boolean" | "date";
|
|
43
43
|
} | {
|
|
44
44
|
_visible: boolean;
|
|
@@ -49,8 +49,8 @@ export declare function syncFieldsWithParams<Item extends ItemBase>(tablekey: st
|
|
|
49
49
|
locked?: boolean;
|
|
50
50
|
visible?: boolean;
|
|
51
51
|
sortable?: boolean;
|
|
52
|
-
cell: ((item: Item) =>
|
|
53
|
-
head?:
|
|
52
|
+
cell: ((item: Item) => Snippet<[Item]>) | ((item: Item) => null | undefined | Primitive | Primitive[]);
|
|
53
|
+
head?: Snippet<[Item]> | undefined;
|
|
54
54
|
type: "select" | "multiselect";
|
|
55
55
|
})[];
|
|
56
56
|
export {};
|
|
@@ -19,11 +19,7 @@
|
|
|
19
19
|
start?: string
|
|
20
20
|
end?: string
|
|
21
21
|
order?: 'asc' | 'desc'
|
|
22
|
-
}>(
|
|
23
|
-
// svelte-ignore state_referenced_locally
|
|
24
|
-
page.url.searchParams.get(field.key),
|
|
25
|
-
{}
|
|
26
|
-
)
|
|
22
|
+
}>(page.url.searchParams.get(field.key), {})
|
|
27
23
|
|
|
28
24
|
let range: RangeAsDate = $state({
|
|
29
25
|
start: initialValue.start ? new Date(initialValue.start) : null,
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
.default({})
|
|
24
24
|
|
|
25
25
|
let { min, max, order } = $derived(paramModel.parse(page.url.searchParams.get(field.key)))
|
|
26
|
-
let isNegatifRange = $derived(min !== undefined && max !== undefined && max < min)
|
|
27
26
|
|
|
28
27
|
const updateUrl = debounce(() => {
|
|
29
28
|
const query: Record<string, string | number> = {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fuma",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jonas Voisard",
|
|
@@ -14,16 +14,15 @@
|
|
|
14
14
|
"prepublishOnly": "npm run package",
|
|
15
15
|
"sync": "svelte-kit sync",
|
|
16
16
|
"svelte-check": "svelte-check --tsconfig ./tsconfig.json",
|
|
17
|
-
"check": "run-p sync svelte-check lint
|
|
17
|
+
"check": "run-p sync svelte-check lint",
|
|
18
18
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
19
19
|
"test": "vitest",
|
|
20
|
-
"format": "prettier
|
|
21
|
-
"lint": "
|
|
20
|
+
"format": "prettier --write .",
|
|
21
|
+
"lint": "prettier --check . && eslint .",
|
|
22
22
|
"migrate": "prisma migrate dev",
|
|
23
23
|
"generate": "prisma generate",
|
|
24
24
|
"studio": "prisma studio",
|
|
25
|
-
"seed": "prisma db seed"
|
|
26
|
-
"biome": "biome"
|
|
25
|
+
"seed": "prisma db seed"
|
|
27
26
|
},
|
|
28
27
|
"svelte": "./dist/index.js",
|
|
29
28
|
"types": "./dist/index.d.ts",
|
|
@@ -72,29 +71,34 @@
|
|
|
72
71
|
},
|
|
73
72
|
"devDependencies": {
|
|
74
73
|
"@biomejs/biome": "2.4.2",
|
|
74
|
+
"@eslint/compat": "^2.0.5",
|
|
75
75
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
76
|
-
"@sveltejs/kit": "^2.
|
|
76
|
+
"@sveltejs/kit": "^2.58.0",
|
|
77
77
|
"@sveltejs/package": "^2.5.7",
|
|
78
78
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
79
79
|
"@tailwindcss/vite": "^4.2.4",
|
|
80
80
|
"@types/node": "^25.6.0",
|
|
81
81
|
"daisyui": "^5.5.19",
|
|
82
|
+
"eslint": "^9.39.4",
|
|
83
|
+
"eslint-config-prettier": "^10.1.8",
|
|
84
|
+
"eslint-plugin-svelte": "^3.17.1",
|
|
82
85
|
"npm-run-all": "^4.1.5",
|
|
83
86
|
"prettier": "^3.8.3",
|
|
84
87
|
"prettier-plugin-svelte": "^3.5.1",
|
|
85
|
-
"prettier-plugin-tailwindcss": "^0.7.
|
|
88
|
+
"prettier-plugin-tailwindcss": "^0.7.4",
|
|
86
89
|
"publint": "^0.1.16",
|
|
87
90
|
"shiki": "^4.0.2",
|
|
88
91
|
"svelte-check": "^4.4.6",
|
|
89
92
|
"tailwindcss": "^4.2.4",
|
|
90
93
|
"typescript": "^5.9.3",
|
|
94
|
+
"typescript-eslint": "^8.59.1",
|
|
91
95
|
"vite": "^7.3.2",
|
|
92
96
|
"vite-plugin-devtools-json": "^1.0.0",
|
|
93
97
|
"vitest": "^4.1.5"
|
|
94
98
|
},
|
|
95
99
|
"dependencies": {
|
|
96
100
|
"@faker-js/faker": "^10.4.0",
|
|
97
|
-
"@lucide/svelte": "^1.
|
|
101
|
+
"@lucide/svelte": "^1.14.0",
|
|
98
102
|
"dayjs": "^1.11.20",
|
|
99
103
|
"debounce": "^3.0.0",
|
|
100
104
|
"devalue": "^5.7.1",
|
|
@@ -103,10 +107,10 @@
|
|
|
103
107
|
"litepicker": "^2.0.12",
|
|
104
108
|
"perod": "^1.4.1",
|
|
105
109
|
"runed": "^0.37.1",
|
|
106
|
-
"svelte": "^5.55.
|
|
110
|
+
"svelte": "^5.55.5",
|
|
107
111
|
"svelte-easy-crop": "^5.0.1",
|
|
108
|
-
"svelte-sonner": "^1.1.
|
|
112
|
+
"svelte-sonner": "^1.1.1",
|
|
109
113
|
"tippy.js": "^6.3.7",
|
|
110
|
-
"zod": "^4.
|
|
114
|
+
"zod": "^4.4.1"
|
|
111
115
|
}
|
|
112
116
|
}
|
package/dist/ui/table/type.d.ts
DELETED
package/dist/ui/table/type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|