runeforge 0.0.13 → 0.0.15

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 CHANGED
@@ -69,6 +69,7 @@ Runeforge provides a set of composable, metadata-driven components for building
69
69
  - Svelte 5 (runes mode)
70
70
  - Tailwind CSS 4
71
71
  - DaisyUI 5
72
+ - Cally
72
73
 
73
74
  ---
74
75
 
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" generics="T extends object = Record<string, unknown>">
2
+ import { onMount } from 'svelte';
2
3
  import Avatar from '../Avatar.svelte';
3
4
  import Label from '../form/Label.svelte';
4
5
  import Select from '../form/Select.svelte';
@@ -8,6 +9,10 @@
8
9
 
9
10
  const strings = getStrings();
10
11
 
12
+ onMount(() => {
13
+ import('cally');
14
+ });
15
+
11
16
  let {
12
17
  field,
13
18
  record = $bindable({} as Record<string, unknown>),
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" generics="T extends object">
2
+ import { onMount } from 'svelte';
2
3
  import Label from '../form/Label.svelte';
3
4
  import Button from '../form/Button.svelte';
4
5
  import { getIconSet } from '../../icons/context.js';
@@ -6,6 +7,10 @@
6
7
  import { getStrings } from '../../i18n/context.js';
7
8
 
8
9
  const strings = getStrings();
10
+
11
+ onMount(() => {
12
+ import('cally');
13
+ });
9
14
  import type { DistinctEntry } from '../../types/table.js';
10
15
  import type { FilterState } from './state.svelte.js';
11
16
  import type { ColumnDefinition } from '../../types/crud.js';
@@ -106,14 +111,33 @@
106
111
  {dateRange.from || '…'} → {dateRange.to || '…'}
107
112
  </p>
108
113
  {/if}
114
+ {#if filter.hasActive(column.attribute)}
115
+ <Button variant="ghost" class="btn-sm mt-2 w-full" onclick={clear}>
116
+ {strings.clearFilter}
117
+ </Button>
118
+ {/if}
109
119
  {:else}
110
- <input
111
- type="text"
112
- class="input input-bordered input-sm w-full"
113
- placeholder={strings.filterPlaceholder}
114
- value={filter.textFor(column.attribute)}
115
- oninput={(e) => setText(e.currentTarget.value)}
116
- />
120
+ <div class="relative">
121
+ <input
122
+ type="text"
123
+ class={['input input-bordered input-sm w-full', filter.hasActive(column.attribute) && 'pr-7']}
124
+ placeholder={strings.filterPlaceholder}
125
+ value={filter.textFor(column.attribute)}
126
+ oninput={(e) => setText(e.currentTarget.value)}
127
+ />
128
+ {#if filter.hasActive(column.attribute)}
129
+ {@const Icon = icons.clear}
130
+ <Button
131
+ variant="ghost"
132
+ class="btn-xs btn-square btn-circle absolute top-1/2 right-1 -translate-y-1/2"
133
+ aria-label={strings.clearFilter}
134
+ title={strings.clearFilter}
135
+ onclick={clear}
136
+ >
137
+ <Icon class="size-3" />
138
+ </Button>
139
+ {/if}
140
+ </div>
117
141
 
118
142
  {#if entries.length > 0 && entries.length < maxCheckboxValues}
119
143
  <div class="mt-2 flex max-h-60 flex-col gap-1 overflow-y-auto">
@@ -133,10 +157,4 @@
133
157
  </div>
134
158
  {/if}
135
159
  {/if}
136
-
137
- {#if filter.hasActive(column.attribute)}
138
- <Button variant="ghost" class="btn-sm mt-2 w-full" onclick={clear}>
139
- {strings.clearFilter}
140
- </Button>
141
- {/if}
142
160
  </div>
@@ -0,0 +1,6 @@
1
+ <script lang="ts">
2
+ let { size = '1em', class: cls = '' }: { size?: string | number; class?: string } = $props();
3
+ </script>
4
+ <svg xmlns="http://www.w3.org/2000/svg" width={size} height={size} viewBox="0 0 16 16" fill="currentColor" class={cls}>
5
+ <path d="M2.146 2.146a.5.5 0 0 1 .708 0L8 7.293l5.146-5.147a.5.5 0 1 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854a.5.5 0 0 1 0-.708z"/>
6
+ </svg>
@@ -0,0 +1,7 @@
1
+ type $$ComponentProps = {
2
+ size?: string | number;
3
+ class?: string;
4
+ };
5
+ declare const Clear: import("svelte").Component<$$ComponentProps, {}, "">;
6
+ type Clear = ReturnType<typeof Clear>;
7
+ export default Clear;
@@ -10,7 +10,7 @@
10
10
  * setIconSet(bootstrapIconSet);
11
11
  */
12
12
  import * as Icons from 'svelte-bootstrap-icons';
13
- const { ChevronExpand, CaretUpFill, CaretDownFill, Funnel, FunnelFill, Plus, Eye, PencilSquare, Trash3, HouseDoor, Folder, EyeSlash, } = Icons;
13
+ const { ChevronExpand, CaretUpFill, CaretDownFill, Funnel, FunnelFill, Plus, Eye, PencilSquare, Trash3, HouseDoor, Folder, EyeSlash, X, } = Icons;
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
15
  function asIcon(c) { return c; }
16
16
  export const bootstrapIconSet = {
@@ -19,6 +19,7 @@ export const bootstrapIconSet = {
19
19
  sortDesc: asIcon(CaretDownFill),
20
20
  filter: asIcon(Funnel),
21
21
  filterActive: asIcon(FunnelFill),
22
+ clear: asIcon(X),
22
23
  create: asIcon(Plus),
23
24
  view: asIcon(Eye),
24
25
  edit: asIcon(PencilSquare),
@@ -3,6 +3,7 @@ import SortAsc from '../defaults/SortAsc.svelte';
3
3
  import SortDesc from '../defaults/SortDesc.svelte';
4
4
  import Filter from '../defaults/Filter.svelte';
5
5
  import FilterActive from '../defaults/FilterActive.svelte';
6
+ import Clear from '../defaults/Clear.svelte';
6
7
  import Create from '../defaults/Create.svelte';
7
8
  import View from '../defaults/View.svelte';
8
9
  import Edit from '../defaults/Edit.svelte';
@@ -17,6 +18,7 @@ export const defaultIconSet = {
17
18
  sortDesc: SortDesc,
18
19
  filter: Filter,
19
20
  filterActive: FilterActive,
21
+ clear: Clear,
20
22
  create: Create,
21
23
  view: View,
22
24
  edit: Edit,
@@ -9,6 +9,7 @@ export interface CRUDIconSet {
9
9
  sortDesc: IconComponent;
10
10
  filter: IconComponent;
11
11
  filterActive: IconComponent;
12
+ clear: IconComponent;
12
13
  create: IconComponent;
13
14
  view: IconComponent;
14
15
  edit: IconComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runeforge",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "SvelteKit toolkit for building metadata-driven CRUD interfaces with tables, forms, and actions",
5
5
  "license": "MIT",
6
6
  "author": "Ezequiel Puerta",
@@ -37,6 +37,9 @@
37
37
  "svelte": "^5.0.0",
38
38
  "tailwindcss": "^4.0.0"
39
39
  },
40
+ "dependencies": {
41
+ "cally": "^0.9.2"
42
+ },
40
43
  "devDependencies": {
41
44
  "@eslint/js": "^10.0.1",
42
45
  "@playwright/test": "^1.60.0",