fuma 2.0.47 → 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.
package/dist/private/Meta.svelte
CHANGED
|
@@ -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
|
}>, {
|
|
@@ -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
|
|
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} />
|