fuma 2.0.46 → 2.0.48

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.
@@ -1,77 +1,16 @@
1
1
  <script lang="ts">
2
- import { type SvelteComponent } from 'svelte'
3
- import { slide } from 'svelte/transition'
4
- import { mdiEyeOffOutline, mdiEyeOutline } from '@mdi/js'
5
2
  import { Card } from '../ui/card/index.js'
6
- import { Table } from '../ui/table/index.js'
7
- import { Icon } from '../ui/icon/index.js'
8
3
 
9
4
  export let name = ''
10
5
  export let description = ''
11
- export let component: SvelteComponent
12
-
13
- type Props = { id: string; value: string }[]
14
- let props: Props = []
15
- let isPropsVisible = false
16
-
17
- $: initMeta(component)
18
-
19
- function initMeta(c: SvelteComponent | undefined) {
20
- if (!c) return
21
- updateComponentMeta(c)
22
- component.$$.after_update.push(() => updateComponentMeta(c))
23
- }
24
-
25
- function updateComponentMeta(c: SvelteComponent) {
26
- const ctx = c.$$.ctx
27
- const propsIndex = Object.entries<number>(c.$$.props)
28
- props = propsIndex.map(([id, index]) => ({
29
- id,
30
- value: ctx[index] as string
31
- }))
32
- }
33
6
  </script>
34
7
 
35
8
  <Card class="mx-auto mb-6 max-w-4xl">
36
9
  <div slot="title" class="flex items-center gap-4">
37
10
  <span class="grow">{name}</span>
38
- <button class="btn btn-square btn-sm" on:click={() => (isPropsVisible = !isPropsVisible)}>
39
- <Icon
40
- size={20}
41
- title="Affichage des props"
42
- path={isPropsVisible ? mdiEyeOutline : mdiEyeOffOutline}
43
- />
44
- </button>
45
11
  </div>
46
12
 
47
13
  <svelte:fragment slot="subtitle">{description}</svelte:fragment>
48
14
 
49
15
  <slot />
50
-
51
- {#if isPropsVisible}
52
- <div transition:slide class="pt-6">
53
- <Table
54
- items={props}
55
- fields={[
56
- {
57
- key: 'name',
58
- label: 'Prop',
59
- cell: (p) => p.id,
60
- locked: true
61
- },
62
- {
63
- key: 'type',
64
- label: 'Type',
65
- cell: (p) => typeof p.value
66
- },
67
- {
68
- key: 'value',
69
- label: 'Value',
70
- cell: (p) => p.value,
71
- visible: true
72
- }
73
- ]}
74
- />
75
- </div>
76
- {/if}
77
16
  </Card>
@@ -1,4 +1,3 @@
1
- import { SvelteComponent } from "svelte";
2
1
  interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
2
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
3
  $$bindings?: Bindings;
@@ -20,7 +19,6 @@ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
20
19
  declare const Meta: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
20
  name?: string;
22
21
  description?: string;
23
- component: SvelteComponent;
24
22
  }, {
25
23
  default: {};
26
24
  }>, {
@@ -38,6 +38,7 @@
38
38
  export let disabled = false
39
39
  export let shortcutKey = ''
40
40
  export let Icon: Component<{ class: string }> | undefined = undefined
41
+ export let debounceMs = 150
41
42
 
42
43
  let klass = ''
43
44
  export { klass as class }
@@ -90,7 +91,7 @@
90
91
  }
91
92
  }
92
93
 
93
- const searchItemsDebounce = debounce(searchItems, 150)
94
+ const searchItemsDebounce = debounce(searchItems, debounceMs)
94
95
 
95
96
  function handleFocus() {
96
97
  isFocus = true
@@ -160,7 +161,7 @@
160
161
  trigger={inputElement}
161
162
  {isError}
162
163
  {isLoading}
163
- {focusIndex}
164
+ bind:focusIndex
164
165
  let:index
165
166
  class="w-full min-w-40 {classList}"
166
167
  on:select={({ detail }) => select(detail)}
@@ -29,6 +29,7 @@ declare class __sveltets_Render<RelationItem extends {
29
29
  Icon?: Component<{
30
30
  class: string;
31
31
  }, {}, string> | undefined;
32
+ debounceMs?: number;
32
33
  class?: string;
33
34
  classList?: string;
34
35
  inputElement?: HTMLInputElement | undefined;
@@ -27,6 +27,7 @@
27
27
  export let slotSuggestion: SnippetLike<[RelationItem]> = slotItem
28
28
  export let input: HTMLInputAttributes | undefined = undefined
29
29
  export let append: Snippet | undefined = undefined
30
+ export let debounceMs = 150
30
31
 
31
32
  let klass = ''
32
33
  export { klass as class }
@@ -82,7 +83,7 @@
82
83
  }
83
84
  }
84
85
 
85
- const searchItemsDebounce = debounce(searchItems, 150)
86
+ const searchItemsDebounce = debounce(searchItems, debounceMs)
86
87
 
87
88
  function handleFocus() {
88
89
  searchItems()
@@ -155,7 +156,7 @@
155
156
  items={proposedItems}
156
157
  {isError}
157
158
  {isLoading}
158
- {focusIndex}
159
+ bind:focusIndex
159
160
  let:index
160
161
  class="w-full min-w-40 {classList}"
161
162
  on:select={({ detail }) => select(detail)}
@@ -18,6 +18,7 @@ declare class __sveltets_Render<RelationItem extends {
18
18
  slotSuggestion?: SnippetLike<[RelationItem]> | undefined;
19
19
  input?: HTMLInputAttributes | undefined;
20
20
  append?: Snippet | undefined;
21
+ debounceMs?: number;
21
22
  class?: string;
22
23
  classList?: string;
23
24
  value?: RelationItem[] | null | undefined;
@@ -36,7 +36,7 @@
36
36
  role="menuitem"
37
37
  on:click={() => dispatch('select', index)}
38
38
  on:keydown={() => dispatch('select', index)}
39
- class="flex cursor-pointer items-center justify-start gap-3 rounded px-3 py-2 hover:bg-base-200"
39
+ class="hover:bg-base-200 flex cursor-pointer items-center justify-start gap-3 rounded px-3 py-2"
40
40
  class:bg-base-300={isFocused}
41
41
  >
42
42
  <slot {item} {index} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "2.0.46",
3
+ "version": "2.0.48",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",