runeforge 0.0.62 → 0.0.63
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/LICENSE +21 -21
- package/README.md +1410 -1407
- package/dist/components/Avatar.svelte +31 -31
- package/dist/components/IconRenderer.svelte +73 -73
- package/dist/components/Modal.svelte +75 -75
- package/dist/components/common/Header.svelte +40 -40
- package/dist/components/crud/EmbeddedField.svelte +203 -203
- package/dist/components/crud/Field.svelte +122 -122
- package/dist/components/crud/GenericCRUD.svelte +426 -426
- package/dist/components/crud/SearchInput.svelte +53 -53
- package/dist/components/crud/columns/Avatar.svelte +15 -15
- package/dist/components/crud/columns/Icon.svelte +8 -8
- package/dist/components/crud/fields/BooleanField.svelte +38 -38
- package/dist/components/crud/fields/DatetimeField.svelte +250 -250
- package/dist/components/crud/fields/DefaultField.svelte +67 -67
- package/dist/components/crud/fields/FileField.svelte +70 -70
- package/dist/components/crud/fields/MultiSelectField.svelte +70 -70
- package/dist/components/crud/fields/SelectField.svelte +67 -67
- package/dist/components/crud/fields/TextareaField.svelte +55 -55
- package/dist/components/crud/fields/TreeField.svelte +1 -0
- package/dist/components/crud/utils/resolution.js +1 -0
- package/dist/components/crud/utils/tree.d.ts +5 -0
- package/dist/components/crud/utils/tree.js +29 -0
- package/dist/components/crud/views/Create.svelte +239 -239
- package/dist/components/crud/views/Read.svelte +131 -131
- package/dist/components/crud/views/Update.svelte +215 -215
- package/dist/components/crud/views/list/List.svelte +291 -291
- package/dist/components/crud/views/list/Modals.svelte +56 -56
- package/dist/components/crud/views/list/Table.svelte +173 -173
- package/dist/components/crud/views/list/Toolbar.svelte +340 -340
- package/dist/components/form/Button.svelte +27 -27
- package/dist/components/form/Label.svelte +37 -37
- package/dist/components/form/MultiSelect.svelte +248 -248
- package/dist/components/form/PasswordInput.svelte +68 -68
- package/dist/components/form/Required.svelte +1 -1
- package/dist/components/form/Select.svelte +209 -209
- package/dist/components/form/Tree.svelte +43 -4
- package/dist/components/form/Tree.svelte.d.ts +1 -0
- package/dist/components/form/TreeNode.svelte +31 -2
- package/dist/components/form/TreeNode.svelte.d.ts +2 -0
- package/dist/components/navigation/Breadcrumbs.svelte +111 -111
- package/dist/components/table/ColumnFilter.svelte +168 -168
- package/dist/components/table/PaginatedTable.svelte +542 -542
- package/dist/components/table/Paginator.svelte +113 -113
- package/dist/components/table/SortHeader.svelte +43 -43
- package/dist/components/table/TableBody.svelte +150 -150
- package/dist/components/table/TableHeader.svelte +88 -88
- package/dist/icons/defaults/Clear.svelte +6 -6
- package/dist/icons/defaults/Create.svelte +6 -6
- package/dist/icons/defaults/Delete.svelte +6 -6
- package/dist/icons/defaults/Download.svelte +7 -7
- package/dist/icons/defaults/Edit.svelte +7 -7
- package/dist/icons/defaults/Filter.svelte +6 -6
- package/dist/icons/defaults/FilterActive.svelte +6 -6
- package/dist/icons/defaults/Folder.svelte +6 -6
- package/dist/icons/defaults/Grip.svelte +7 -7
- package/dist/icons/defaults/Home.svelte +6 -6
- package/dist/icons/defaults/PasswordHide.svelte +9 -9
- package/dist/icons/defaults/PasswordShow.svelte +7 -7
- package/dist/icons/defaults/SortAsc.svelte +6 -6
- package/dist/icons/defaults/SortDesc.svelte +6 -6
- package/dist/icons/defaults/SortNone.svelte +6 -6
- package/dist/icons/defaults/View.svelte +7 -7
- package/dist/types/attribute.d.ts +3 -0
- package/dist/types/crud/fields.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { page } from '$app/state';
|
|
3
|
-
import { goto } from '$app/navigation';
|
|
4
|
-
import { getStrings } from '../../i18n/context.js';
|
|
5
|
-
import type { SearchConfiguration } from '../../types/crud/list-config.js';
|
|
6
|
-
|
|
7
|
-
const strings = getStrings();
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
config = {} as SearchConfiguration
|
|
11
|
-
}: {
|
|
12
|
-
config?: SearchConfiguration;
|
|
13
|
-
} = $props();
|
|
14
|
-
|
|
15
|
-
const param = $derived(config.param ?? 'search');
|
|
16
|
-
const debounceMs = $derived(config.debounceMs ?? 300);
|
|
17
|
-
|
|
18
|
-
// Intentional one-time hydration of local state from the initial `param`
|
|
19
|
-
// value (not a live binding) - svelte-check's state_referenced_locally
|
|
20
|
-
// warning is a false positive here, same as PaginatedTable's initialSort
|
|
21
|
-
// etc. After mount this is the source of truth for what the user is
|
|
22
|
-
// typing, so it doesn't fight with the URL updates this component itself
|
|
23
|
-
// triggers on every keystroke.
|
|
24
|
-
let value = $state(page.url.searchParams.get(param) ?? '');
|
|
25
|
-
let debounceTimer: ReturnType<typeof setTimeout>;
|
|
26
|
-
|
|
27
|
-
function onInput() {
|
|
28
|
-
clearTimeout(debounceTimer);
|
|
29
|
-
debounceTimer = setTimeout(() => {
|
|
30
|
-
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
31
|
-
const params = new URLSearchParams(page.url.searchParams);
|
|
32
|
-
const trimmed = value.trim();
|
|
33
|
-
if (trimmed) params.set(param, trimmed);
|
|
34
|
-
else params.delete(param);
|
|
35
|
-
// A new search term can leave the current page past the end of the
|
|
36
|
-
// narrowed result set, and any open create/read/edit view stops
|
|
37
|
-
// making sense once the underlying list changes - drop both.
|
|
38
|
-
params.delete('page');
|
|
39
|
-
params.delete('view');
|
|
40
|
-
params.delete('id');
|
|
41
|
-
const qs = params.toString();
|
|
42
|
-
goto(qs ? `?${qs}` : '?', { keepFocus: true, noScroll: true, replaceState: true });
|
|
43
|
-
}, debounceMs);
|
|
44
|
-
}
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<input
|
|
48
|
-
type="search"
|
|
49
|
-
bind:value
|
|
50
|
-
oninput={onInput}
|
|
51
|
-
placeholder={config.placeholder ?? strings.searchPlaceholder}
|
|
52
|
-
class="input input-bordered w-64 shrink-0"
|
|
53
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { page } from '$app/state';
|
|
3
|
+
import { goto } from '$app/navigation';
|
|
4
|
+
import { getStrings } from '../../i18n/context.js';
|
|
5
|
+
import type { SearchConfiguration } from '../../types/crud/list-config.js';
|
|
6
|
+
|
|
7
|
+
const strings = getStrings();
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
config = {} as SearchConfiguration
|
|
11
|
+
}: {
|
|
12
|
+
config?: SearchConfiguration;
|
|
13
|
+
} = $props();
|
|
14
|
+
|
|
15
|
+
const param = $derived(config.param ?? 'search');
|
|
16
|
+
const debounceMs = $derived(config.debounceMs ?? 300);
|
|
17
|
+
|
|
18
|
+
// Intentional one-time hydration of local state from the initial `param`
|
|
19
|
+
// value (not a live binding) - svelte-check's state_referenced_locally
|
|
20
|
+
// warning is a false positive here, same as PaginatedTable's initialSort
|
|
21
|
+
// etc. After mount this is the source of truth for what the user is
|
|
22
|
+
// typing, so it doesn't fight with the URL updates this component itself
|
|
23
|
+
// triggers on every keystroke.
|
|
24
|
+
let value = $state(page.url.searchParams.get(param) ?? '');
|
|
25
|
+
let debounceTimer: ReturnType<typeof setTimeout>;
|
|
26
|
+
|
|
27
|
+
function onInput() {
|
|
28
|
+
clearTimeout(debounceTimer);
|
|
29
|
+
debounceTimer = setTimeout(() => {
|
|
30
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
31
|
+
const params = new URLSearchParams(page.url.searchParams);
|
|
32
|
+
const trimmed = value.trim();
|
|
33
|
+
if (trimmed) params.set(param, trimmed);
|
|
34
|
+
else params.delete(param);
|
|
35
|
+
// A new search term can leave the current page past the end of the
|
|
36
|
+
// narrowed result set, and any open create/read/edit view stops
|
|
37
|
+
// making sense once the underlying list changes - drop both.
|
|
38
|
+
params.delete('page');
|
|
39
|
+
params.delete('view');
|
|
40
|
+
params.delete('id');
|
|
41
|
+
const qs = params.toString();
|
|
42
|
+
goto(qs ? `?${qs}` : '?', { keepFocus: true, noScroll: true, replaceState: true });
|
|
43
|
+
}, debounceMs);
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<input
|
|
48
|
+
type="search"
|
|
49
|
+
bind:value
|
|
50
|
+
oninput={onInput}
|
|
51
|
+
placeholder={config.placeholder ?? strings.searchPlaceholder}
|
|
52
|
+
class="input input-bordered w-64 shrink-0"
|
|
53
|
+
/>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import AvatarComponent from '../../Avatar.svelte';
|
|
3
|
-
import { initials } from '../utils/misc.js';
|
|
4
|
-
import type { CellProps } from '../../../types/table.js';
|
|
5
|
-
|
|
6
|
-
type AvatarRow = { firstName?: string; lastName?: string; email?: string };
|
|
7
|
-
|
|
8
|
-
let { value, row }: CellProps<AvatarRow, string | null | undefined> = $props();
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<AvatarComponent
|
|
12
|
-
src={value ?? null}
|
|
13
|
-
text={initials(row.firstName, row.lastName)}
|
|
14
|
-
alt={row.email ?? ''}
|
|
15
|
-
/>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import AvatarComponent from '../../Avatar.svelte';
|
|
3
|
+
import { initials } from '../utils/misc.js';
|
|
4
|
+
import type { CellProps } from '../../../types/table.js';
|
|
5
|
+
|
|
6
|
+
type AvatarRow = { firstName?: string; lastName?: string; email?: string };
|
|
7
|
+
|
|
8
|
+
let { value, row }: CellProps<AvatarRow, string | null | undefined> = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<AvatarComponent
|
|
12
|
+
src={value ?? null}
|
|
13
|
+
text={initials(row.firstName, row.lastName)}
|
|
14
|
+
alt={row.email ?? ''}
|
|
15
|
+
/>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import IconRenderer from '../../IconRenderer.svelte';
|
|
3
|
-
import type { CellProps } from '../../../types/table.js';
|
|
4
|
-
|
|
5
|
-
let { value }: CellProps<Record<string, unknown>, string> = $props();
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<IconRenderer name={String(value ?? '')} />
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import IconRenderer from '../../IconRenderer.svelte';
|
|
3
|
+
import type { CellProps } from '../../../types/table.js';
|
|
4
|
+
|
|
5
|
+
let { value }: CellProps<Record<string, unknown>, string> = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<IconRenderer name={String(value ?? '')} />
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
<script lang="ts" generics="T extends object = Record<string, unknown>">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { FieldDefinition } from '../../../types/crud/fields.js';
|
|
4
|
-
|
|
5
|
-
let {
|
|
6
|
-
field,
|
|
7
|
-
record = $bindable({} as Record<string, unknown>),
|
|
8
|
-
parentRecord = undefined,
|
|
9
|
-
readonly = false,
|
|
10
|
-
labelRow,
|
|
11
|
-
errorRow
|
|
12
|
-
}: {
|
|
13
|
-
field: FieldDefinition<T>;
|
|
14
|
-
record?: Record<string, unknown>;
|
|
15
|
-
parentRecord?: Record<string, unknown>;
|
|
16
|
-
readonly?: boolean;
|
|
17
|
-
labelRow: Snippet;
|
|
18
|
-
errorRow: Snippet;
|
|
19
|
-
} = $props();
|
|
20
|
-
|
|
21
|
-
const name = $derived(readonly ? undefined : field.attribute);
|
|
22
|
-
const saved = $derived(record[field.attribute]);
|
|
23
|
-
const fieldDisabled = $derived(field.disabled ? field.disabled(record, parentRecord) : false);
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
{@render labelRow()}
|
|
27
|
-
<input
|
|
28
|
-
type="checkbox"
|
|
29
|
-
id={field.attribute}
|
|
30
|
-
{name}
|
|
31
|
-
class="toggle toggle-primary"
|
|
32
|
-
checked={!!saved}
|
|
33
|
-
disabled={readonly || fieldDisabled}
|
|
34
|
-
onchange={(e) => {
|
|
35
|
-
record[field.attribute] = (e.currentTarget as HTMLInputElement).checked;
|
|
36
|
-
}}
|
|
37
|
-
/>
|
|
38
|
-
{@render errorRow()}
|
|
1
|
+
<script lang="ts" generics="T extends object = Record<string, unknown>">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { FieldDefinition } from '../../../types/crud/fields.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
field,
|
|
7
|
+
record = $bindable({} as Record<string, unknown>),
|
|
8
|
+
parentRecord = undefined,
|
|
9
|
+
readonly = false,
|
|
10
|
+
labelRow,
|
|
11
|
+
errorRow
|
|
12
|
+
}: {
|
|
13
|
+
field: FieldDefinition<T>;
|
|
14
|
+
record?: Record<string, unknown>;
|
|
15
|
+
parentRecord?: Record<string, unknown>;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
labelRow: Snippet;
|
|
18
|
+
errorRow: Snippet;
|
|
19
|
+
} = $props();
|
|
20
|
+
|
|
21
|
+
const name = $derived(readonly ? undefined : field.attribute);
|
|
22
|
+
const saved = $derived(record[field.attribute]);
|
|
23
|
+
const fieldDisabled = $derived(field.disabled ? field.disabled(record, parentRecord) : false);
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{@render labelRow()}
|
|
27
|
+
<input
|
|
28
|
+
type="checkbox"
|
|
29
|
+
id={field.attribute}
|
|
30
|
+
{name}
|
|
31
|
+
class="toggle toggle-primary"
|
|
32
|
+
checked={!!saved}
|
|
33
|
+
disabled={readonly || fieldDisabled}
|
|
34
|
+
onchange={(e) => {
|
|
35
|
+
record[field.attribute] = (e.currentTarget as HTMLInputElement).checked;
|
|
36
|
+
}}
|
|
37
|
+
/>
|
|
38
|
+
{@render errorRow()}
|