@picked/svelte 0.0.1-dev.1771981674305 → 0.0.1-dev.1772064704206
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/component.d.ts +3 -3
- package/dist/form/build-responses.d.ts +13 -0
- package/dist/form/build-responses.js +1 -0
- package/dist/form/create-field-evaluator.d.ts +17 -0
- package/dist/form/create-field-evaluator.js +1 -0
- package/dist/form/create-field-validation.d.ts +41 -0
- package/dist/form/create-field-validation.js +1 -0
- package/dist/form/create-form.js +1 -0
- package/dist/form/create-form.svelte.d.ts +41 -0
- package/dist/form/create-form.svelte.js +1 -0
- package/dist/form/create-submit-pipeline.js +1 -0
- package/dist/form/create-submit-pipeline.svelte.d.ts +53 -0
- package/dist/form/create-submit-pipeline.svelte.js +1 -0
- package/dist/form/get-form.d.ts +16 -0
- package/dist/form/get-form.js +1 -0
- package/dist/form/index.d.ts +2 -16
- package/dist/form/index.js +1 -1
- package/dist/hooks/field.d.ts +5 -0
- package/dist/hooks/step.d.ts +8 -8
- package/dist/hooks/step.js +1 -1
- package/dist/plugins/devtools/DevToolsExperience.svelte +25 -173
- package/dist/plugins/devtools/components/ExperienceInstanceListItem.svelte +1 -1
- package/dist/plugins/devtools/components/ExperienceInstancesTable.svelte +10 -14
- package/dist/plugins/devtools/experience.d.ts +1 -0
- package/dist/plugins/devtools/experience.js +1 -0
- package/dist/plugins/devtools/plugin.d.ts +4 -12
- package/dist/plugins/devtools/plugin.js +1 -1
- package/dist/plugins/devtools/screens/components/ComponentsListScreen.svelte +13 -17
- package/dist/plugins/devtools/screens/events/EventsTable.svelte +20 -24
- package/dist/plugins/devtools/screens/experience-instances/ExperienceInstancesListScreen.svelte +3 -1
- package/dist/plugins/devtools/screens/experiences/ExperienceDetailsScreen.svelte +25 -29
- package/dist/plugins/devtools/screens/experiences/ExperienceExperienceInstancesListScreen.svelte +3 -1
- package/dist/plugins/devtools/screens/experiences/ExperienceTreeScreen.svelte +2 -2
- package/dist/plugins/devtools/screens/features/FeaturesListScreen.svelte +9 -11
- package/dist/plugins/devtools/screens/frameworks/FrameworksListScreen.svelte +12 -16
- package/dist/plugins/devtools/screens/history/HistoryEntriesTable.svelte +10 -14
- package/dist/plugins/devtools/screens/predicates/PredicatesListScreen.svelte +12 -16
- package/dist/plugins/devtools/screens/project/ProjectScreen.svelte +1 -47
- package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +10 -9
- package/dist/plugins/devtools/screens/responses/ResponsesTable.svelte +24 -26
- package/dist/plugins/devtools/ui/actions/Button.svelte +0 -4
- package/dist/plugins/devtools/ui/data/DataTable.svelte +3 -13
- package/dist/plugins/devtools/ui/tokens.css.js +1 -0
- package/dist/render/browser.js +1 -1
- package/dist/render/server.js +1 -1
- package/package.json +2 -2
- package/dist/_virtual/preload-helper.js +0 -1
- package/dist/plugins/devtools/PickedIcon.svelte +0 -19
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
import { Plugin } from '@picked/client';
|
|
2
|
-
export interface SvelteDevtoolsPluginOptions {
|
|
3
|
-
/**
|
|
4
|
-
* When `true`, the devtools experience launches automatically on page load.
|
|
5
|
-
* When `false`, devtools can only be opened via the Picked Chrome extension.
|
|
6
|
-
*
|
|
7
|
-
* @default false
|
|
8
|
-
*/
|
|
9
|
-
enabled?: boolean;
|
|
10
|
-
}
|
|
11
2
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
3
|
+
* Enables Svelte component rendering compatability.
|
|
4
|
+
* This plugin registers the Svelte framework and allows rendering Svelte components
|
|
5
|
+
* with the client's experience data.
|
|
14
6
|
*/
|
|
15
|
-
export declare const svelteDevtoolsPlugin: (
|
|
7
|
+
export declare const svelteDevtoolsPlugin: () => Plugin[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{supportsDocument as c,isPickedRoot as a}from"@picked/client";import{createExperiencePlugin as g}from"@picked/client/plugins/create-experience";import{devtoolsExperience as r}from"./experience.js";const m=()=>[{name:"svelte-devtools",setup:t=>{if(!c())return;const s=t.experienceInstances.getByExperienceId(r.id),i=e=>{if(!(!e.target||!("tagName"in e.target)||typeof e.target.tagName!="string")&&e.key==="."&&!["INPUT","TEXTAREA"].includes(e.target.tagName)&&!(e.currentTarget instanceof HTMLElement&&a(e.currentTarget))&&!(e.target instanceof HTMLElement&&a(e.target))){const n=s.getState();n.length>0?n.forEach(o=>o.toggleOpen()):t.launchExperienceById(r.id)}};document.addEventListener("keydown",i),t.eventBus.watch(e=>{e.type==="ready"&&t.launchExperienceById(r.id)})}},g({experiences:[r]})];export{m as svelteDevtoolsPlugin};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getPicked } from '../../../../hooks'
|
|
3
|
-
import {
|
|
3
|
+
import { DataTable, EmptyState } from '../../ui'
|
|
4
4
|
|
|
5
5
|
const client = getPicked()
|
|
6
6
|
|
|
@@ -12,19 +12,15 @@
|
|
|
12
12
|
]
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{/snippet}
|
|
28
|
-
</DataTable>
|
|
29
|
-
</Card>
|
|
30
|
-
</Stack>
|
|
15
|
+
<DataTable columns={columns} rows={$components}>
|
|
16
|
+
{#snippet row(item)}
|
|
17
|
+
{@const component = item}
|
|
18
|
+
<tr>
|
|
19
|
+
<td>{component.name}</td>
|
|
20
|
+
<td>{component.component.frameworkName}</td>
|
|
21
|
+
</tr>
|
|
22
|
+
{/snippet}
|
|
23
|
+
{#snippet empty()}
|
|
24
|
+
<EmptyState message="No components" />
|
|
25
|
+
{/snippet}
|
|
26
|
+
</DataTable>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { combine, createStore, createEvent, sample } from 'effector'
|
|
3
3
|
import { getPicked } from '../../../../hooks'
|
|
4
4
|
import EventListItem from './EventListItem.svelte'
|
|
5
|
-
import {
|
|
5
|
+
import { DataTable, EmptyState } from '../../ui'
|
|
6
6
|
import type { EventHistoryEntry } from '@picked/client'
|
|
7
7
|
|
|
8
8
|
const { events } = getPicked()
|
|
@@ -51,26 +51,22 @@
|
|
|
51
51
|
}
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{/snippet}
|
|
74
|
-
</DataTable>
|
|
75
|
-
</Card>
|
|
76
|
-
</Stack>
|
|
54
|
+
<DataTable
|
|
55
|
+
columns={columns}
|
|
56
|
+
rows={$sortedEvents}
|
|
57
|
+
sortKey="time"
|
|
58
|
+
sortDirection={$sortDirectionStore}
|
|
59
|
+
onSort={handleSort}
|
|
60
|
+
>
|
|
61
|
+
{#snippet row(item)}
|
|
62
|
+
{@const event = item}
|
|
63
|
+
<EventListItem
|
|
64
|
+
{event}
|
|
65
|
+
isExpanded={expandedRowIds.has(event.id)}
|
|
66
|
+
onToggle={() => toggleRow(event.id)}
|
|
67
|
+
/>
|
|
68
|
+
{/snippet}
|
|
69
|
+
{#snippet empty()}
|
|
70
|
+
<EmptyState message="No events yet. Interact with the page to see events." />
|
|
71
|
+
{/snippet}
|
|
72
|
+
</DataTable>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ExperienceStore } from '@picked/client'
|
|
3
3
|
import { getPicked } from '../../../../hooks'
|
|
4
|
-
import { Button,
|
|
4
|
+
import { Button, Text, CodeBlock, Stack } from '../../ui'
|
|
5
5
|
|
|
6
6
|
const client = getPicked()
|
|
7
7
|
export let experience: ExperienceStore
|
|
@@ -10,38 +10,34 @@
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<Stack direction="vertical" gap="medium" padding="medium">
|
|
13
|
-
<
|
|
13
|
+
<div>
|
|
14
14
|
<Button variant="primary" size="small" onclick={() => client.launchExperienceById(experience.id)}>
|
|
15
15
|
Launch experience
|
|
16
16
|
</Button>
|
|
17
|
-
</
|
|
17
|
+
</div>
|
|
18
18
|
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<Text>{$config.type}</Text>
|
|
24
|
-
</div>
|
|
19
|
+
<div>
|
|
20
|
+
<Text weight="semibold">Type</Text>
|
|
21
|
+
<Text>{$config.name}</Text>
|
|
22
|
+
</div>
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
<div>
|
|
25
|
+
<Text weight="semibold">Target selectors</Text>
|
|
26
|
+
<ul>
|
|
27
|
+
{#if $config.targetSelectors.length > 0}
|
|
28
|
+
{#each $config.targetSelectors as selector (selector)}
|
|
29
|
+
<li>
|
|
30
|
+
<CodeBlock code="{selector.selector} || {selector.placement}" />
|
|
31
|
+
</li>
|
|
32
|
+
{/each}
|
|
33
|
+
{:else}
|
|
34
|
+
<li><Text color="subdued">(none)</Text></li>
|
|
35
|
+
{/if}
|
|
36
|
+
</ul>
|
|
37
|
+
</div>
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</Stack>
|
|
46
|
-
</Card>
|
|
39
|
+
<div>
|
|
40
|
+
<Text weight="semibold">Decision logic</Text>
|
|
41
|
+
<CodeBlock code={JSON.stringify($config.decisionLogic, null, 2)} />
|
|
42
|
+
</div>
|
|
47
43
|
</Stack>
|
package/dist/plugins/devtools/screens/experiences/ExperienceExperienceInstancesListScreen.svelte
CHANGED
|
@@ -10,4 +10,6 @@
|
|
|
10
10
|
$: experienceInstances = client.experienceInstances.getByExperienceId(experience.id)
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<
|
|
13
|
+
<div>
|
|
14
|
+
<ExperienceInstancesTable experienceInstances={$experienceInstances} />
|
|
15
|
+
</div>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
let zoom = 1
|
|
10
10
|
let selectedNode = null
|
|
11
11
|
let highlightedPath: string[][] = []
|
|
12
|
-
let error = null
|
|
12
|
+
let error: string | null = null
|
|
13
13
|
const loading = false
|
|
14
14
|
|
|
15
15
|
let treeRenderingDone = false
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
.attr(
|
|
140
140
|
'd',
|
|
141
141
|
d3
|
|
142
|
-
.linkHorizontal<d3.HierarchyPointLink<ProcessedNode>, ProcessedNode
|
|
142
|
+
.linkHorizontal<d3.HierarchyPointLink<ProcessedNode>, d3.HierarchyPointNode<ProcessedNode>>()
|
|
143
143
|
.x((d) => d.y)
|
|
144
144
|
.y((d) => d.x),
|
|
145
145
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { createStore, createEvent } from 'effector'
|
|
3
3
|
import type { FeatureBucket } from '@picked/client'
|
|
4
4
|
import { getPicked, useUnit } from '../../../../hooks'
|
|
5
|
-
import {
|
|
5
|
+
import { DataTable, EmptyState, Button, Text, CopyButton, Card, CodeBlock, Stack } from '../../ui'
|
|
6
6
|
|
|
7
7
|
interface FeatureSelection {
|
|
8
8
|
included: boolean
|
|
@@ -87,9 +87,8 @@
|
|
|
87
87
|
generated URL. Recipients will see the overridden values on page load.
|
|
88
88
|
</Text>
|
|
89
89
|
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
{#snippet row(item)}
|
|
90
|
+
<DataTable columns={columns} rows={$featuresList}>
|
|
91
|
+
{#snippet row(item)}
|
|
93
92
|
{@const feature = item}
|
|
94
93
|
{@const selection = $selections[feature.id]}
|
|
95
94
|
{@const currentValue = getBucketValue(feature)}
|
|
@@ -106,7 +105,7 @@
|
|
|
106
105
|
</td>
|
|
107
106
|
<td>
|
|
108
107
|
<Text size="small" weight="medium">{feature.name}</Text>
|
|
109
|
-
<CodeBlock code={feature.
|
|
108
|
+
<CodeBlock code={feature.key} inline />
|
|
110
109
|
</td>
|
|
111
110
|
<td>
|
|
112
111
|
{#if currentValue !== null}
|
|
@@ -142,11 +141,10 @@
|
|
|
142
141
|
</tr>
|
|
143
142
|
{/if}
|
|
144
143
|
{/snippet}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
</Card>
|
|
144
|
+
{#snippet empty()}
|
|
145
|
+
<EmptyState message="No features registered" />
|
|
146
|
+
{/snippet}
|
|
147
|
+
</DataTable>
|
|
150
148
|
|
|
151
149
|
<Card>
|
|
152
150
|
{#snippet header()}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getPicked } from '../../../../hooks'
|
|
3
|
-
import {
|
|
3
|
+
import { DataTable, EmptyState } from '../../ui'
|
|
4
4
|
|
|
5
5
|
const client = getPicked()
|
|
6
6
|
|
|
@@ -9,18 +9,14 @@
|
|
|
9
9
|
const columns = [{ key: 'name', header: 'Name' }]
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{/snippet}
|
|
24
|
-
</DataTable>
|
|
25
|
-
</Card>
|
|
26
|
-
</Stack>
|
|
12
|
+
<DataTable columns={columns} rows={$frameworks}>
|
|
13
|
+
{#snippet row(item)}
|
|
14
|
+
{@const framework = item}
|
|
15
|
+
<tr>
|
|
16
|
+
<td>{framework.name}</td>
|
|
17
|
+
</tr>
|
|
18
|
+
{/snippet}
|
|
19
|
+
{#snippet empty()}
|
|
20
|
+
<EmptyState message="No frameworks" />
|
|
21
|
+
{/snippet}
|
|
22
|
+
</DataTable>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HistoryEntry } from '@picked/client'
|
|
3
3
|
import HistoryEntryListItem from './HistoryEntryListItem.svelte'
|
|
4
|
-
import {
|
|
4
|
+
import { DataTable, EmptyState } from '../../ui'
|
|
5
5
|
|
|
6
6
|
export let historyEntries: HistoryEntry[]
|
|
7
7
|
|
|
@@ -14,16 +14,12 @@
|
|
|
14
14
|
]
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{/snippet}
|
|
27
|
-
</DataTable>
|
|
28
|
-
</Card>
|
|
29
|
-
</Stack>
|
|
17
|
+
<DataTable columns={columns} rows={historyEntries}>
|
|
18
|
+
{#snippet row(item)}
|
|
19
|
+
{@const historyEntry = item}
|
|
20
|
+
<HistoryEntryListItem {historyEntry} />
|
|
21
|
+
{/snippet}
|
|
22
|
+
{#snippet empty()}
|
|
23
|
+
<EmptyState message="No history entries" />
|
|
24
|
+
{/snippet}
|
|
25
|
+
</DataTable>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { getPicked } from '../../../../hooks'
|
|
3
|
-
import {
|
|
3
|
+
import { DataTable, EmptyState } from '../../ui'
|
|
4
4
|
|
|
5
5
|
const client = getPicked()
|
|
6
6
|
|
|
@@ -9,18 +9,14 @@
|
|
|
9
9
|
const columns = [{ key: 'name', header: 'Name' }]
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{/snippet}
|
|
24
|
-
</DataTable>
|
|
25
|
-
</Card>
|
|
26
|
-
</Stack>
|
|
12
|
+
<DataTable columns={columns} rows={$predicates}>
|
|
13
|
+
{#snippet row(item)}
|
|
14
|
+
{@const predicate = item}
|
|
15
|
+
<tr>
|
|
16
|
+
<td>{predicate.name}</td>
|
|
17
|
+
</tr>
|
|
18
|
+
{/snippet}
|
|
19
|
+
{#snippet empty()}
|
|
20
|
+
<EmptyState message="No predicates" />
|
|
21
|
+
{/snippet}
|
|
22
|
+
</DataTable>
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
<
|
|
2
|
-
import { getPicked } from '../../../../hooks'
|
|
3
|
-
import { Button, Card, CodeBlock, DataTable, Stack, Text } from '../../ui'
|
|
4
|
-
|
|
5
|
-
const client = getPicked()
|
|
6
|
-
|
|
7
|
-
const dashboardProjectUrl = `${client.dashboardUrl}/p/${client.projectId}`
|
|
8
|
-
|
|
9
|
-
const columns = [
|
|
10
|
-
{ key: 'label', header: 'Property' },
|
|
11
|
-
{ key: 'value', header: 'Value' },
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
const rows = [
|
|
15
|
-
{ label: 'Project ID', value: client.projectId },
|
|
16
|
-
{ label: 'Organization ID', value: client.organizationId },
|
|
17
|
-
{ label: 'API URL', value: client.apiUrl },
|
|
18
|
-
{ label: 'Dashboard URL', value: client.dashboardUrl },
|
|
19
|
-
]
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Stack direction="vertical" gap="medium" padding="medium">
|
|
23
|
-
<Text size="caption" color="subdued">
|
|
24
|
-
Project configuration for this Picked client instance.
|
|
25
|
-
</Text>
|
|
26
|
-
|
|
27
|
-
<Card sectioned>
|
|
28
|
-
<DataTable {columns} {rows}>
|
|
29
|
-
{#snippet row(item)}
|
|
30
|
-
<tr>
|
|
31
|
-
<td>
|
|
32
|
-
<Text size="small" weight="medium">{item.label}</Text>
|
|
33
|
-
</td>
|
|
34
|
-
<td>
|
|
35
|
-
<CodeBlock code={item.value} inline />
|
|
36
|
-
</td>
|
|
37
|
-
</tr>
|
|
38
|
-
{/snippet}
|
|
39
|
-
</DataTable>
|
|
40
|
-
</Card>
|
|
41
|
-
|
|
42
|
-
<Stack direction="horizontal" gap="small">
|
|
43
|
-
<Button variant="primary" size="small" href={dashboardProjectUrl} target="_blank">
|
|
44
|
-
Open in Dashboard
|
|
45
|
-
</Button>
|
|
46
|
-
</Stack>
|
|
47
|
-
</Stack>
|
|
1
|
+
<p>todo: project</p>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { ResponseListItem, PrimitiveFieldValue, Field } from '@picked/client'
|
|
2
|
+
import type { ResponseListItem, PrimitiveFieldValue, Field, FieldValue } from '@picked/client'
|
|
3
3
|
import { getPicked } from '../../../../hooks'
|
|
4
4
|
import { Button, Text, CodeBlock, Banner, Stack } from '../../ui'
|
|
5
5
|
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
let isEditing = false
|
|
12
12
|
let editValue = ''
|
|
13
13
|
let editError = ''
|
|
14
|
-
let selectedOptions: Set<
|
|
14
|
+
let selectedOptions: Set<FieldValue> = new Set()
|
|
15
15
|
|
|
16
|
-
$: hasOptions = field?.options && field.options.length > 0
|
|
16
|
+
$: hasOptions = Array.isArray(field?.options) && field.options.length > 0
|
|
17
|
+
$: staticOptions = Array.isArray(field?.options) ? field.options : null
|
|
17
18
|
$: currentValue = response?.value ?? null
|
|
18
19
|
|
|
19
20
|
function formatValue(value: unknown): string {
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
selectedOptions = new Set()
|
|
53
54
|
}
|
|
54
55
|
|
|
55
|
-
function toggleOption(optionValue:
|
|
56
|
+
function toggleOption(optionValue: FieldValue) {
|
|
56
57
|
if (field?.multiple) {
|
|
57
58
|
if (selectedOptions.has(optionValue)) {
|
|
58
59
|
selectedOptions.delete(optionValue)
|
|
@@ -65,7 +66,7 @@
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function parseValue(input: string):
|
|
69
|
+
function parseValue(input: string): FieldValue {
|
|
69
70
|
input = input.trim()
|
|
70
71
|
|
|
71
72
|
if (input === '' || input === '-') {
|
|
@@ -99,14 +100,14 @@
|
|
|
99
100
|
|
|
100
101
|
async function saveEdit() {
|
|
101
102
|
try {
|
|
102
|
-
let newValue:
|
|
103
|
+
let newValue: FieldValue
|
|
103
104
|
|
|
104
105
|
if (hasOptions) {
|
|
105
106
|
const values = Array.from(selectedOptions)
|
|
106
107
|
if (field?.multiple) {
|
|
107
108
|
newValue = values
|
|
108
109
|
} else {
|
|
109
|
-
newValue = values
|
|
110
|
+
newValue = values.at(0) ?? null
|
|
110
111
|
}
|
|
111
112
|
} else {
|
|
112
113
|
newValue = parseValue(editValue)
|
|
@@ -142,9 +143,9 @@
|
|
|
142
143
|
<td>
|
|
143
144
|
{#if isEditing}
|
|
144
145
|
<Stack direction="vertical" gap="small">
|
|
145
|
-
{#if hasOptions &&
|
|
146
|
+
{#if hasOptions && staticOptions}
|
|
146
147
|
<Stack direction="vertical" gap="small">
|
|
147
|
-
{#each
|
|
148
|
+
{#each staticOptions as option (option.id)}
|
|
148
149
|
<label class="option-label">
|
|
149
150
|
{#if field.multiple}
|
|
150
151
|
<input
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type { ResponseListItem, Field } from '@picked/client'
|
|
3
3
|
import { getPicked } from '../../../../hooks'
|
|
4
4
|
import ResponseTableRow from './ResponseTableRow.svelte'
|
|
5
|
-
import {
|
|
5
|
+
import { DataTable, EmptyState, Button, RadioGroup, Stack } from '../../ui'
|
|
6
6
|
|
|
7
7
|
export let responses: ResponseListItem[] = []
|
|
8
8
|
|
|
@@ -51,29 +51,27 @@
|
|
|
51
51
|
$: filterOptions[2] = { value: 'unset', label: `Unset (${allFields.length - responses.length})` }
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
|
-
<Stack
|
|
55
|
-
<
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</DataTable>
|
|
78
|
-
</Card>
|
|
54
|
+
<Stack direction="vertical" gap="none">
|
|
55
|
+
<Stack direction="horizontal" gap="small" align="space-between" justify="center" padding="small">
|
|
56
|
+
<RadioGroup
|
|
57
|
+
label="Show"
|
|
58
|
+
name="filter"
|
|
59
|
+
options={filterOptions}
|
|
60
|
+
value={filter}
|
|
61
|
+
onchange={(val) => { filter = val }}
|
|
62
|
+
orientation="horizontal"
|
|
63
|
+
/>
|
|
64
|
+
{#if responses.length > 0}
|
|
65
|
+
<Button variant="destructive" size="small" onclick={handleClearAll}>Clear All</Button>
|
|
66
|
+
{/if}
|
|
67
|
+
</Stack>
|
|
68
|
+
<DataTable columns={columns} rows={fieldRows}>
|
|
69
|
+
{#snippet row(item)}
|
|
70
|
+
{@const rowData = item}
|
|
71
|
+
<ResponseTableRow field={rowData.field} response={rowData.response} />
|
|
72
|
+
{/snippet}
|
|
73
|
+
{#snippet empty()}
|
|
74
|
+
<EmptyState message="No fields registered yet" />
|
|
75
|
+
{/snippet}
|
|
76
|
+
</DataTable>
|
|
79
77
|
</Stack>
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
type?: 'button' | 'submit' | 'reset'
|
|
19
19
|
fullWidth?: boolean
|
|
20
20
|
href?: string
|
|
21
|
-
target?: string
|
|
22
21
|
onclick?: (event: MouseEvent) => void
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -32,7 +31,6 @@
|
|
|
32
31
|
type = 'button',
|
|
33
32
|
fullWidth = false,
|
|
34
33
|
href,
|
|
35
|
-
target,
|
|
36
34
|
onclick,
|
|
37
35
|
}: Props = $props()
|
|
38
36
|
|
|
@@ -45,8 +43,6 @@
|
|
|
45
43
|
class:full-width={fullWidth}
|
|
46
44
|
class:is-disabled={isDisabled}
|
|
47
45
|
{href}
|
|
48
|
-
{target}
|
|
49
|
-
rel={target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
50
46
|
aria-disabled={isDisabled || undefined}
|
|
51
47
|
tabindex={isDisabled ? -1 : undefined}
|
|
52
48
|
onclick={isDisabled
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts" generics="
|
|
1
|
+
<script lang="ts" generics="TRow">
|
|
2
2
|
import type { Snippet } from 'svelte'
|
|
3
3
|
|
|
4
4
|
interface Column {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
interface Props {
|
|
11
11
|
columns: Column[]
|
|
12
|
-
rows:
|
|
13
|
-
row: Snippet<[
|
|
12
|
+
rows: TRow[]
|
|
13
|
+
row: Snippet<[TRow, number]>
|
|
14
14
|
empty?: Snippet
|
|
15
15
|
sortKey?: string | null
|
|
16
16
|
sortDirection?: 'asc' | 'desc'
|
|
@@ -131,14 +131,4 @@
|
|
|
131
131
|
:global(tbody tr.selected) {
|
|
132
132
|
background-color: color-mix(in srgb, var(--color-blue-500) 8%, var(--color-white));
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
th:first-child,
|
|
136
|
-
:global(tbody td:first-child) {
|
|
137
|
-
padding-left: var(--space-4);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
th:last-child,
|
|
141
|
-
:global(tbody td:last-child) {
|
|
142
|
-
padding-right: var(--space-4);
|
|
143
|
-
}
|
|
144
134
|
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=".devtools{--color-blue-500: #3b82f6;--color-blue-600: #2563eb;--color-blue-700: #1d4ed8;--color-blue-800: #1e40af;--color-gray-50: #f9fafb;--color-gray-100: #f3f4f6;--color-gray-200: #e5e7eb;--color-gray-300: #d1d5db;--color-gray-500: #6b7280;--color-gray-600: #4b5563;--color-gray-700: #374151;--color-gray-900: #111827;--color-red-500: #ef4444;--color-red-600: #dc2626;--color-red-700: #b91c1c;--color-red-800: #991b1b;--color-green-100: #dcfce7;--color-green-700: #15803d;--color-green-800: #166534;--color-yellow-100: #fef9c3;--color-yellow-700: #a16207;--color-yellow-800: #854d0e;--color-white: #ffffff;--color-black: #000000;--text-xs: .75rem;--text-sm: .875rem;--text-base: 1rem;--text-lg: 1.125rem;--text-xl: 1.25rem;--text-2xl: 1.5rem;--font-normal: 400;--font-medium: 500;--font-semibold: 600;--space-0: 0;--space-0-5: .125rem;--space-1: .25rem;--space-1-5: .375rem;--space-2: .5rem;--space-2-5: .625rem;--space-3: .75rem;--space-4: 1rem;--space-5: 1.25rem;--space-6: 1.5rem;--space-8: 2rem;--radius-sm: .125rem;--radius-md: .375rem;--radius-lg: .5rem;--radius-xl: .75rem;--radius-full: 9999px;--shadow-card: 0 1px 2px 0 rgba(0, 0, 0, .03);--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);--ring-color: var(--color-blue-500);--ring-width: 2px;--ring-offset: 2px;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:var(--text-sm);line-height:1.5;color:var(--color-gray-900)}.devtools .inline-select,.devtools .inline-input{font-size:var(--text-xs);padding:var(--space-0-5) var(--space-1);border:1px solid var(--color-gray-300);border-radius:var(--radius-sm);font-family:inherit}.devtools .inline-input{width:100%}.devtools .inline-select:focus,.devtools .inline-input:focus{outline:none;box-shadow:0 0 0 var(--ring-width) var(--ring-color)}.devtools textarea{width:100%;min-height:60px;font-family:monospace;font-size:var(--text-xs);padding:var(--space-1);border:1px solid var(--color-gray-300);border-radius:var(--radius-md)}.devtools textarea:focus{outline:none;box-shadow:0 0 0 var(--ring-width) var(--ring-color)}.devtools .details-cell{background-color:var(--color-gray-50);padding:var(--space-4);border-left:3px solid var(--color-blue-500)}.devtools .expand-icon{margin-right:var(--space-2);display:inline-block;width:12px}.devtools .event-row{cursor:pointer}.devtools .include-cell{text-align:center;width:2.5rem}.devtools .option-label{display:flex;align-items:center;gap:var(--space-2);cursor:pointer}";export{e as default};
|
package/dist/render/browser.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{mount as a}from"svelte";import{isValidAdaptedComponent as u}from"../component.js";import{CLIENT_CONTEXT_KEY as d,EXPERIENCE_CONTEXT_KEY as E}from"../context.js";import{mergeArrays as p}from"../utils/array.js";import f from"../utils/ErrorBoundary.svelte";function y(n,e){return new Map([[d,n],[E,e]])}const g=async(n,e,s,o,i)=>{if(!u(e))throw new Error("The component is invalid.");const c=p(e.style?.sheets,i.stylesheets),m=p(e.style?.css,i.css);c.length&&c.forEach(r=>{const t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href",r),t.setAttribute("type","text/css"),t.setAttribute("picked-injected","true"),n.appendChild(t)}),m.length&&m.forEach(r=>{const t=document.createElement("style");t.textContent=r,t.setAttribute("type","text/css"),t.setAttribute("picked-injected","true"),n.appendChild(t)});const l=r=>{a(f,{target:n,props:{component:r,componentProps:{client:s,experience:o}},context:y(s,o)})};if(e.component instanceof Promise){const{default:r}=await e.component;l(r);return}l(e.component)},x=n=>{};export{y as createContext,g as renderSvelteComponent,x as unRenderSvelteComponent};
|