@svadmin/lite 0.3.0 → 0.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@svadmin/lite",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "SSR-compatible lightweight admin UI for @svadmin — zero client-side JS, works in IE11",
5
5
  "type": "module",
6
6
  "files": [
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "peerDependencies": {
23
23
  "svelte": "^5.0.0",
24
- "@svadmin/core": "^0.19.5",
24
+ "@svadmin/core": "^0.21.1",
25
25
  "@sveltejs/kit": "^2.0.0"
26
26
  },
27
27
  "dependencies": {
@@ -21,10 +21,10 @@
21
21
  canEdit = true,
22
22
  }: Props = $props();
23
23
 
24
- const pk = resource.primaryKey ?? 'id';
25
- const id = record[pk];
24
+ let pk = $derived(resource.primaryKey ?? 'id');
25
+ let id = $derived(record[pk]);
26
26
  const showFields = $derived(
27
- resource.fields.filter(f => f.showInShow !== false && f.showInList !== false)
27
+ resource.fields.filter(f => f.showInShow !== false)
28
28
  );
29
29
  </script>
30
30
 
@@ -29,7 +29,7 @@
29
29
  canDelete = true,
30
30
  }: Props = $props();
31
31
 
32
- const pk = resource.primaryKey ?? 'id';
32
+ let pk = $derived(resource.primaryKey ?? 'id');
33
33
  const listFields = $derived(
34
34
  resource.fields.filter(f => f.showInList !== false)
35
35
  );
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  </script>
14
14
 
15
15
  {#if mode === 'show'}
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
 
14
14
  function formatDate(v: unknown): string {
15
15
  if (!v) return '';
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  </script>
14
14
 
15
15
  {#if mode === 'show'}
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
 
14
14
  function getFiles(v: unknown): string[] {
15
15
  if (!v) return [];
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
 
14
14
  function getUrls(v: unknown): string[] {
15
15
  if (!v) return [];
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
 
14
14
  function getJsonString(v: unknown): string {
15
15
  if (v == null) return '';
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  </script>
14
14
 
15
15
  {#if mode === 'show'}
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
 
14
14
  function displayOptions(valuesRaw: unknown): string[] {
15
15
  if (!valuesRaw || !Array.isArray(valuesRaw)) return [];
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  </script>
14
14
 
15
15
  {#if mode === 'show'}
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  let { field, value, error = [], mode = 'show' }: Props = $props();
13
- const hasError = error.length > 0;
13
+ let hasError = $derived(error.length > 0);
14
14
 
15
15
  // In Lite version, relations might need to be rendered via server-side joined data
16
16
  // passed through options, or just standard inputs requesting ID.
@@ -10,7 +10,7 @@
10
10
  }
11
11
 
12
12
  let { field, value, error = [], mode = 'show' }: Props = $props();
13
- const hasError = error.length > 0;
13
+ let hasError = $derived(error.length > 0);
14
14
 
15
15
  function displaySelect(v: unknown): string {
16
16
  if (v == null) return '—';
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  const tags = $derived(Array.isArray(value) ? value.map(String) : []);
14
14
  </script>
15
15
 
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  </script>
14
14
 
15
15
  {#if mode === 'show'}
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  let { field, value, error = [], mode = 'show' }: Props = $props();
12
- const hasError = error.length > 0;
12
+ let hasError = $derived(error.length > 0);
13
13
  </script>
14
14
 
15
15
  {#if mode === 'show'}
@@ -24,8 +24,8 @@
24
24
  canShow = true,
25
25
  }: Props = $props();
26
26
 
27
- const pk = resource.primaryKey ?? 'id';
28
- const idStr = String(record[pk]);
27
+ let pk = $derived(resource.primaryKey ?? 'id');
28
+ let idStr = $derived(String(record[pk]));
29
29
  </script>
30
30
 
31
31
  <div class="lite-page">
@@ -22,8 +22,8 @@
22
22
  canDelete = true,
23
23
  }: Props = $props();
24
24
 
25
- const pk = resource.primaryKey ?? 'id';
26
- const idStr = String(record[pk]);
25
+ let pk = $derived(resource.primaryKey ?? 'id');
26
+ let idStr = $derived(String(record[pk]));
27
27
 
28
28
  const showFields = $derived(
29
29
  resource.fields.filter(f => f.showInShow !== false)
@@ -48,9 +48,9 @@
48
48
  <div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px;">
49
49
  {#each showFields as field}
50
50
  <div>
51
- <label style="display: block; font-size: 13px; font-weight: 500; color: #64748b; margin-bottom: 8px;">
51
+ <div style="display: block; font-size: 13px; font-weight: 500; color: #64748b; margin-bottom: 8px;">
52
52
  {field.label}
53
- </label>
53
+ </div>
54
54
  <div style="color: #0f172a; font-size: 14px;">
55
55
  <LiteShowField {field} value={record[field.key]} />
56
56
  </div>