@picked/svelte 0.0.1-dev.1793776638554 → 0.0.1-dev.1793835766402
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/.tsbuildinfo +1 -1
- package/dist/plugins/devtools/DevToolsExperience.svelte +145 -93
- package/dist/plugins/devtools/customTools.d.ts +2 -2
- package/dist/plugins/devtools/derive/guide-sections/guide-sections.js +1 -1
- package/dist/plugins/devtools/derive/index.d.ts +3 -3
- package/dist/plugins/devtools/derive/index.js +1 -1
- package/dist/plugins/devtools/derive/personas/index.d.ts +2 -2
- package/dist/plugins/devtools/derive/personas/index.js +1 -1
- package/dist/plugins/devtools/derive/personas/personas.d.ts +88 -7
- package/dist/plugins/devtools/derive/personas/personas.js +1 -1
- package/dist/plugins/devtools/derive/plain-language/index.d.ts +1 -1
- package/dist/plugins/devtools/derive/plain-language/index.js +1 -1
- package/dist/plugins/devtools/derive/plain-language/plain-language.d.ts +3 -5
- package/dist/plugins/devtools/derive/plain-language/plain-language.js +1 -1
- package/dist/plugins/devtools/index.d.ts +1 -1
- package/dist/plugins/devtools/launcher/Launcher.svelte +13 -4
- package/dist/plugins/devtools/options.d.ts +6 -4
- package/dist/plugins/devtools/options.js +1 -1
- package/dist/plugins/devtools/review/journey/ExperienceDetails.svelte +129 -0
- package/dist/plugins/devtools/review/journey/JourneyPanel.svelte +54 -8
- package/dist/plugins/devtools/review/personas/PersonaBuilder.svelte +3 -34
- package/dist/plugins/devtools/review/personas/PersonaCard.svelte +226 -43
- package/dist/plugins/devtools/review/personas/PersonasPanel.svelte +171 -74
- package/dist/plugins/devtools/review/personas/load-persona.d.ts +41 -20
- package/dist/plugins/devtools/review/personas/load-persona.js +1 -1
- package/dist/plugins/devtools/review/personas/persona-route.d.ts +87 -0
- package/dist/plugins/devtools/review/personas/persona-route.js +1 -0
- package/dist/plugins/devtools/review/personas/persona-session.d.ts +94 -0
- package/dist/plugins/devtools/review/personas/persona-session.js +1 -0
- package/dist/plugins/devtools/sidebar/Sidebar.svelte +3 -68
- package/dist/plugins/devtools/sidebar/SidebarRow.svelte +5 -42
- package/dist/plugins/devtools/sidebar/nav.d.ts +18 -44
- package/dist/plugins/devtools/sidebar/nav.js +1 -1
- package/package.json +2 -2
- package/dist/plugins/devtools/screens/experience-instances/ExperienceInstancesListScreen.svelte +0 -10
- package/dist/plugins/devtools/screens/experiences/ExperienceDetailsScreen.svelte +0 -44
- package/dist/plugins/devtools/screens/experiences/ExperienceExperienceInstancesListScreen.svelte +0 -13
- package/dist/plugins/devtools/screens/experiences/ExperienceScreen.svelte +0 -32
- package/dist/plugins/devtools/screens/experiences/ExperienceTreeScreen.svelte +0 -500
- package/dist/plugins/devtools/screens/experiences/ExperiencesListScreen.svelte +0 -22
- package/dist/plugins/devtools/screens/features/FeaturesListScreen.svelte +0 -239
- package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +0 -286
- package/dist/plugins/devtools/screens/responses/ResponsesListScreen.svelte +0 -12
- package/dist/plugins/devtools/screens/responses/ResponsesTable.svelte +0 -88
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file A persona session: the tab walks through the experience as one persona. Every field a
|
|
3
|
+
* screen asks shows the persona's response as its default, flagged `prefilled`, so the reviewer
|
|
4
|
+
* moves on with Continue or changes a value as a visitor would. Nothing is committed for them.
|
|
5
|
+
*
|
|
6
|
+
* The session lasts for the tab, in `sessionStorage`, so a reload keeps it, until the reviewer
|
|
7
|
+
* stops it. A shared link starts one with the `picked-persona` query parameter.
|
|
8
|
+
*/
|
|
9
|
+
import type { FieldValue } from '@picked/client';
|
|
10
|
+
/** The `sessionStorage` key that names the persona a tab walks through as. */
|
|
11
|
+
export declare const ACTIVE_PERSONA_KEY = "picked-devtools-persona-session";
|
|
12
|
+
/** The query parameter a shared link names a persona with. */
|
|
13
|
+
export declare const PERSONA_LINK_PARAM = "picked-persona";
|
|
14
|
+
/**
|
|
15
|
+
* The persona this tab walks through as.
|
|
16
|
+
*
|
|
17
|
+
* @param {Pick<Storage, 'getItem'>} storage - The tab's `sessionStorage`.
|
|
18
|
+
* @returns {string | null} The persona's id, or `null` outside a persona session.
|
|
19
|
+
* @example readActivePersona(sessionStorage)
|
|
20
|
+
*/
|
|
21
|
+
export declare function readActivePersona(storage: Pick<Storage, 'getItem'>): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Notes the persona this tab walks through as, or ends the session.
|
|
24
|
+
*
|
|
25
|
+
* @param {Pick<Storage, 'setItem' | 'removeItem'>} storage - The tab's `sessionStorage`.
|
|
26
|
+
* @param {string | null} id - The persona's id; `null` ends the session.
|
|
27
|
+
* @example writeActivePersona(sessionStorage, null)
|
|
28
|
+
*/
|
|
29
|
+
export declare function writeActivePersona(storage: Pick<Storage, 'setItem' | 'removeItem'>, id: string | null): void;
|
|
30
|
+
/**
|
|
31
|
+
* The link that starts a walk-through as a site persona on its entry page.
|
|
32
|
+
*
|
|
33
|
+
* @param {{ origin: string; pathname: string; search: string }} here - This page's address.
|
|
34
|
+
* @param {string} here.origin - Its origin.
|
|
35
|
+
* @param {string} here.pathname - Its path.
|
|
36
|
+
* @param {string} here.search - Its query.
|
|
37
|
+
* @param {string | null} entryUrl - The persona's entry page.
|
|
38
|
+
* @param {string} id - The persona's id.
|
|
39
|
+
* @returns {string} The full URL.
|
|
40
|
+
* @example personaLink(window.location, '/sale', 'mover') // 'https://shop.example/sale?picked-persona=mover'
|
|
41
|
+
*/
|
|
42
|
+
export declare function personaLink(here: {
|
|
43
|
+
origin: string;
|
|
44
|
+
pathname: string;
|
|
45
|
+
search: string;
|
|
46
|
+
}, entryUrl: string | null, id: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Takes the persona a shared link names off the address bar, so a reload does not start it again.
|
|
49
|
+
*
|
|
50
|
+
* @param {{ href: string }} location - The page's location.
|
|
51
|
+
* @param {string} location.href - Its URL.
|
|
52
|
+
* @param {(url: string) => void} replace - Replaces the address without a reload.
|
|
53
|
+
* @returns {string | null} The persona's id, or `null` when the page was not opened from a link.
|
|
54
|
+
* @example takePersonaLink(window.location, (url) => history.replaceState(history.state, '', url))
|
|
55
|
+
*/
|
|
56
|
+
export declare function takePersonaLink(location: {
|
|
57
|
+
href: string;
|
|
58
|
+
}, replace: (url: string) => void): string | null;
|
|
59
|
+
/** A field as a walk-through reads and pre-fills it. */
|
|
60
|
+
export interface PrefillField {
|
|
61
|
+
key: string;
|
|
62
|
+
defaultValue?: FieldValue;
|
|
63
|
+
prefilled?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** A store a walk-through reads, and hears change. */
|
|
66
|
+
export interface ReadableStore<T> {
|
|
67
|
+
getState: () => T;
|
|
68
|
+
watch: (watcher: (state: T) => unknown) => () => void;
|
|
69
|
+
}
|
|
70
|
+
/** The part of the client a walk-through pre-fills. */
|
|
71
|
+
export interface PrefillClient {
|
|
72
|
+
fields: {
|
|
73
|
+
listStore: ReadableStore<readonly PrefillField[]>;
|
|
74
|
+
update: (key: string, updates: {
|
|
75
|
+
defaultValue?: FieldValue;
|
|
76
|
+
prefilled?: boolean;
|
|
77
|
+
}) => void;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** A running pre-fill. */
|
|
81
|
+
export interface Prefill {
|
|
82
|
+
/** Puts back each field's own default and stops pre-filling. */
|
|
83
|
+
stop: () => void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Pre-fills every field a screen asks with the persona's response, now and as fields arrive.
|
|
87
|
+
*
|
|
88
|
+
* @param {PrefillClient} client - The client.
|
|
89
|
+
* @param {Readonly<Record<string, FieldValue>>} answers - The persona's responses.
|
|
90
|
+
* @param {ReadableStore<ReadonlySet<string>>} asked - The keys the experiences' screens ask.
|
|
91
|
+
* @returns {Prefill} Stops the pre-fill.
|
|
92
|
+
* @example const prefill = prefillPersona(client, persona.responses, session.askedStore)
|
|
93
|
+
*/
|
|
94
|
+
export declare function prefillPersona(client: PrefillClient, answers: Readonly<Record<string, FieldValue>>, asked: ReadableStore<ReadonlySet<string>>): Prefill;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadUrl as e}from"./load-persona.js";var t=`picked-devtools-persona-session`,n=`picked-persona`;function r(e){try{let n=e.getItem(t);return n!==null&&n.length>0?n:null}catch{return null}}function i(e,n){try{n===null?e.removeItem(t):e.setItem(t,n)}catch{}}function a(t,r,i){let a=new URL(e(r,t),t.origin);return a.searchParams.set(n,i),a.toString()}function o(e,t){let r=new URL(e.href),i=r.searchParams.get(n);return i===null||i.length===0?null:(r.searchParams.delete(n),t(r.toString()),i)}function s(e,t,n){let r=new Map,i=()=>{let i=n.getState();for(let n of e.fields.listStore.getState())n.prefilled!==!0&&i.has(n.key)&&Object.hasOwn(t,n.key)&&(r.has(n.key)||r.set(n.key,{defaultValue:n.defaultValue,prefilled:n.prefilled}),e.fields.update(n.key,{defaultValue:t[n.key],prefilled:!0}))},a=[e.fields.listStore.watch(i),n.watch(i)];return{stop:()=>{for(let e of a)e();for(let[t,n]of r)e.fields.update(t,n);r.clear()}}}export{t as ACTIVE_PERSONA_KEY,n as PERSONA_LINK_PARAM,a as personaLink,s as prefillPersona,r as readActivePersona,o as takePersonaLink,i as writeActivePersona};
|
|
@@ -2,40 +2,21 @@
|
|
|
2
2
|
@paired-component apps/dashboard/src/shared/ui/navigation/sidebar-row-classes.ts
|
|
3
3
|
@design-parity A row mirrors the Dashboard sidebar row: 28px high, text-sm, rounded-md, a 10%
|
|
4
4
|
current-colour fill when selected and 5% on hover, a label that fades out instead of wrapping.
|
|
5
|
-
The Custom Tools and Developer rows mirror the Dashboard's folding nav group (sidebar-nav-group.tsx).
|
|
6
5
|
-->
|
|
7
6
|
<script lang="ts">
|
|
8
|
-
/**
|
|
9
|
-
* @file The devtools sidebar: the main tabs, the folding Custom Tools group, then the folding
|
|
10
|
-
* Developer group.
|
|
11
|
-
*/
|
|
12
|
-
import { DEVELOPER_LABEL } from '../derive/plain-language'
|
|
7
|
+
/** @file The devtools sidebar: one row per tab. */
|
|
13
8
|
import type { NavModel } from './nav'
|
|
14
|
-
import {
|
|
9
|
+
import { nextFocusIndex } from './nav'
|
|
15
10
|
import SidebarRow from './SidebarRow.svelte'
|
|
16
11
|
|
|
17
12
|
interface Props {
|
|
18
13
|
nav: NavModel
|
|
19
14
|
/** The selected tab's id. */
|
|
20
15
|
selected: string
|
|
21
|
-
/** Whether the Developer group lists its screens. */
|
|
22
|
-
developerOpen: boolean
|
|
23
|
-
/** Whether the Custom Tools group lists its tools. */
|
|
24
|
-
customOpen: boolean
|
|
25
16
|
onSelect: (id: string) => void
|
|
26
|
-
onToggleDeveloper: () => void
|
|
27
|
-
onToggleCustom: () => void
|
|
28
17
|
}
|
|
29
18
|
|
|
30
|
-
const {
|
|
31
|
-
nav,
|
|
32
|
-
selected,
|
|
33
|
-
developerOpen,
|
|
34
|
-
customOpen,
|
|
35
|
-
onSelect,
|
|
36
|
-
onToggleDeveloper,
|
|
37
|
-
onToggleCustom,
|
|
38
|
-
}: Props = $props()
|
|
19
|
+
const { nav, selected, onSelect }: Props = $props()
|
|
39
20
|
|
|
40
21
|
let list: HTMLElement | undefined = $state()
|
|
41
22
|
|
|
@@ -66,50 +47,10 @@
|
|
|
66
47
|
<SidebarRow
|
|
67
48
|
label={item.label}
|
|
68
49
|
testId="devtools-nav-{item.id}"
|
|
69
|
-
depth={0}
|
|
70
50
|
selected={selected === item.id}
|
|
71
51
|
onPress={() => onSelect(item.id)}
|
|
72
52
|
/>
|
|
73
53
|
{/each}
|
|
74
|
-
{#if nav.custom.length > 0}
|
|
75
|
-
<SidebarRow
|
|
76
|
-
label={CUSTOM_TOOLS_LABEL}
|
|
77
|
-
testId="devtools-nav-{CUSTOM_TOOLS_GROUP}"
|
|
78
|
-
depth={0}
|
|
79
|
-
expanded={customOpen}
|
|
80
|
-
onPress={onToggleCustom}
|
|
81
|
-
/>
|
|
82
|
-
{#if customOpen}
|
|
83
|
-
{#each nav.custom as item (item.id)}
|
|
84
|
-
<SidebarRow
|
|
85
|
-
label={item.label}
|
|
86
|
-
testId="devtools-nav-{item.id}"
|
|
87
|
-
depth={2}
|
|
88
|
-
selected={selected === item.id}
|
|
89
|
-
onPress={() => onSelect(item.id)}
|
|
90
|
-
/>
|
|
91
|
-
{/each}
|
|
92
|
-
{/if}
|
|
93
|
-
{/if}
|
|
94
|
-
<li class="divider" role="presentation"></li>
|
|
95
|
-
<SidebarRow
|
|
96
|
-
label={DEVELOPER_LABEL}
|
|
97
|
-
testId="devtools-nav-developer"
|
|
98
|
-
depth={0}
|
|
99
|
-
expanded={developerOpen}
|
|
100
|
-
onPress={onToggleDeveloper}
|
|
101
|
-
/>
|
|
102
|
-
{#if developerOpen}
|
|
103
|
-
{#each nav.developer as item (item.id)}
|
|
104
|
-
<SidebarRow
|
|
105
|
-
label={item.label}
|
|
106
|
-
testId="devtools-nav-{item.id}"
|
|
107
|
-
depth={2}
|
|
108
|
-
selected={selected === item.id}
|
|
109
|
-
onPress={() => onSelect(item.id)}
|
|
110
|
-
/>
|
|
111
|
-
{/each}
|
|
112
|
-
{/if}
|
|
113
54
|
</ul>
|
|
114
55
|
</nav>
|
|
115
56
|
|
|
@@ -130,10 +71,4 @@
|
|
|
130
71
|
flex-direction: column;
|
|
131
72
|
gap: 1px;
|
|
132
73
|
}
|
|
133
|
-
|
|
134
|
-
.divider {
|
|
135
|
-
height: 1px;
|
|
136
|
-
margin: var(--space-2) 0;
|
|
137
|
-
background-color: var(--color-gray-200);
|
|
138
|
-
}
|
|
139
74
|
</style>
|
|
@@ -1,45 +1,27 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
/** @file One row of the devtools sidebar: a tab
|
|
2
|
+
/** @file One row of the devtools sidebar: a tab. */
|
|
3
3
|
|
|
4
4
|
interface Props {
|
|
5
5
|
label: string
|
|
6
6
|
testId: string
|
|
7
|
-
/** Indent depth: 0 for a top-level row, 2 for a screen inside the Developer group. */
|
|
8
|
-
depth: 0 | 2
|
|
9
7
|
onPress: () => void
|
|
10
|
-
/**
|
|
8
|
+
/** Whether it is the selected tab. */
|
|
11
9
|
selected?: boolean
|
|
12
|
-
/** A disclosure row: whether its group is open. Renders the chevron. */
|
|
13
|
-
expanded?: boolean
|
|
14
10
|
}
|
|
15
11
|
|
|
16
|
-
const { label, testId,
|
|
12
|
+
const { label, testId, onPress, selected = false }: Props = $props()
|
|
17
13
|
</script>
|
|
18
14
|
|
|
19
15
|
<li>
|
|
20
16
|
<button
|
|
21
17
|
type="button"
|
|
22
|
-
class="row
|
|
18
|
+
class="row"
|
|
23
19
|
class:active={selected}
|
|
24
20
|
aria-current={selected ? 'page' : undefined}
|
|
25
|
-
aria-expanded={expanded}
|
|
26
21
|
data-nav-row
|
|
27
22
|
data-testid={testId}
|
|
28
23
|
onclick={onPress}
|
|
29
24
|
>
|
|
30
|
-
{#if expanded !== undefined}
|
|
31
|
-
<span class="icon" class:open={expanded} aria-hidden="true">
|
|
32
|
-
<svg width="12" height="12" viewBox="0 0 16 16" fill="none">
|
|
33
|
-
<path
|
|
34
|
-
d="M6 4l4 4-4 4"
|
|
35
|
-
stroke="currentColor"
|
|
36
|
-
stroke-width="1.5"
|
|
37
|
-
stroke-linecap="round"
|
|
38
|
-
stroke-linejoin="round"
|
|
39
|
-
/>
|
|
40
|
-
</svg>
|
|
41
|
-
</span>
|
|
42
|
-
{/if}
|
|
43
25
|
<span class="label">{label}</span>
|
|
44
26
|
</button>
|
|
45
27
|
</li>
|
|
@@ -66,10 +48,6 @@
|
|
|
66
48
|
color 0.15s ease;
|
|
67
49
|
}
|
|
68
50
|
|
|
69
|
-
.row.depth-2 {
|
|
70
|
-
padding-left: var(--space-5);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
51
|
.row:hover {
|
|
74
52
|
color: var(--color-gray-900);
|
|
75
53
|
background-color: color-mix(in srgb, currentColor 5%, transparent);
|
|
@@ -86,20 +64,6 @@
|
|
|
86
64
|
outline-offset: -2px;
|
|
87
65
|
}
|
|
88
66
|
|
|
89
|
-
.icon {
|
|
90
|
-
display: flex;
|
|
91
|
-
flex-shrink: 0;
|
|
92
|
-
align-items: center;
|
|
93
|
-
justify-content: center;
|
|
94
|
-
width: 16px;
|
|
95
|
-
height: 16px;
|
|
96
|
-
transition: transform 0.15s ease;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.icon.open {
|
|
100
|
-
transform: rotate(90deg);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
67
|
.label {
|
|
104
68
|
flex: 1;
|
|
105
69
|
min-width: 0;
|
|
@@ -109,8 +73,7 @@
|
|
|
109
73
|
}
|
|
110
74
|
|
|
111
75
|
@media (prefers-reduced-motion: reduce) {
|
|
112
|
-
.row
|
|
113
|
-
.icon {
|
|
76
|
+
.row {
|
|
114
77
|
transition: none;
|
|
115
78
|
}
|
|
116
79
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import type { CustomToolIcon } from '../customTools';
|
|
3
3
|
import type { StorageGetter } from '../launcher/launcher';
|
|
4
4
|
/**
|
|
5
|
-
* What a sidebar entry opens: a review tab, a custom tool, the Custom Tools page
|
|
6
|
-
*
|
|
5
|
+
* What a sidebar entry opens: a review tab, a custom tool, the Custom Tools page listed while no
|
|
6
|
+
* unplaced tool is registered, or one of the SDK's own screens.
|
|
7
7
|
*/
|
|
8
|
-
export type NavKind = 'review' | 'tool' | 'custom-tools' | '
|
|
8
|
+
export type NavKind = 'review' | 'tool' | 'custom-tools' | 'screen';
|
|
9
9
|
/** One entry of the sidebar: a row, or an icon at its foot. */
|
|
10
10
|
export interface NavItem {
|
|
11
11
|
/** Unique across the whole sidebar. */
|
|
@@ -15,32 +15,24 @@ export interface NavItem {
|
|
|
15
15
|
/** The glyph of an icon at the sidebar's foot. */
|
|
16
16
|
icon?: CustomToolIcon;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
* The sidebar's entries: the top-level tabs, the Custom Tools group's tools, the Developer group's
|
|
20
|
-
* screens, and the foot's icons.
|
|
21
|
-
*/
|
|
18
|
+
/** The sidebar's entries: its rows, and the icons at its foot. */
|
|
22
19
|
export interface NavModel {
|
|
23
20
|
primary: readonly NavItem[];
|
|
24
|
-
custom: readonly NavItem[];
|
|
25
|
-
developer: readonly NavItem[];
|
|
26
21
|
footer: readonly NavItem[];
|
|
27
22
|
}
|
|
28
23
|
/** `sessionStorage` key holding the selected tab's id. */
|
|
29
24
|
export declare const TAB_STORAGE_KEY = "picked-devtools-tab";
|
|
30
|
-
/**
|
|
31
|
-
export declare const DEVELOPER_OPEN_STORAGE_KEY = "picked-devtools-developer-open";
|
|
32
|
-
/** `sessionStorage` key holding `'false'` while the Custom Tools group is folded. */
|
|
33
|
-
export declare const CUSTOM_TOOLS_OPEN_STORAGE_KEY = "picked-devtools-custom-tools-open";
|
|
34
|
-
/** The label of the Custom Tools row and group. */
|
|
25
|
+
/** The label of the Custom Tools row. */
|
|
35
26
|
export declare const CUSTOM_TOOLS_LABEL = "Custom Tools";
|
|
36
27
|
/** The tab a first open lands on, and where a vanished tab falls back to. */
|
|
37
28
|
export declare const DEFAULT_TAB = "guide";
|
|
38
|
-
/** The id of the Custom Tools row listed while no tool
|
|
29
|
+
/** The id of the Custom Tools row, listed while no unplaced tool is registered; it links the how-to page. */
|
|
39
30
|
export declare const CUSTOM_TOOLS_TAB = "custom-tools";
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The SDK's own screens, in the order the sidebar lists them after the review tabs and the site's
|
|
33
|
+
* tools. Experiences, Feature flags and Responses are review tabs, so they are not here.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SCREENS: readonly {
|
|
44
36
|
id: string;
|
|
45
37
|
label: string;
|
|
46
38
|
}[];
|
|
@@ -53,13 +45,13 @@ export declare const DEVELOPER_SCREENS: readonly {
|
|
|
53
45
|
*/
|
|
54
46
|
export declare function toolTabId(toolId: string): string;
|
|
55
47
|
/**
|
|
56
|
-
* The sidebar id of
|
|
48
|
+
* The sidebar id of one of the SDK's own screens.
|
|
57
49
|
*
|
|
58
|
-
* @param {string} screenId - The screen's id in {@link
|
|
50
|
+
* @param {string} screenId - The screen's id in {@link SCREENS}.
|
|
59
51
|
* @returns {string} Its tab id, prefixed so it never collides with a review tab.
|
|
60
|
-
* @example
|
|
52
|
+
* @example screenTabId('events') // 'screen:events'
|
|
61
53
|
*/
|
|
62
|
-
export declare function
|
|
54
|
+
export declare function screenTabId(screenId: string): string;
|
|
63
55
|
/** What decides the sidebar's rows. */
|
|
64
56
|
export interface NavInput {
|
|
65
57
|
/** Whether the workspace publishes a feature, which lists Feature flags. */
|
|
@@ -69,7 +61,7 @@ export interface NavInput {
|
|
|
69
61
|
id: string;
|
|
70
62
|
label: string;
|
|
71
63
|
}[];
|
|
72
|
-
/** The unplaced custom tools, in registration order, each a row
|
|
64
|
+
/** The unplaced custom tools, in registration order, each a top-level row after the review tools. */
|
|
73
65
|
customTools: readonly {
|
|
74
66
|
id: string;
|
|
75
67
|
label: string;
|
|
@@ -82,10 +74,10 @@ export interface NavInput {
|
|
|
82
74
|
}[];
|
|
83
75
|
}
|
|
84
76
|
/**
|
|
85
|
-
* Builds the sidebar's entries.
|
|
77
|
+
* Builds the sidebar's entries: the review tabs, the site's tools, then the SDK's own screens.
|
|
86
78
|
*
|
|
87
79
|
* @param {NavInput} input - What this session lists.
|
|
88
|
-
* @returns {NavModel} The
|
|
80
|
+
* @returns {NavModel} The rows and the foot's icons.
|
|
89
81
|
* @example buildNav({ variations: true, tools: [], customTools: [], footerTools: [] })
|
|
90
82
|
*/
|
|
91
83
|
export declare function buildNav(input: NavInput): NavModel;
|
|
@@ -98,24 +90,6 @@ export declare function buildNav(input: NavInput): NavModel;
|
|
|
98
90
|
* @example resolveTab('journey', nav) // 'journey'
|
|
99
91
|
*/
|
|
100
92
|
export declare function resolveTab(stored: string | null, nav: NavModel): string;
|
|
101
|
-
/**
|
|
102
|
-
* Whether a tab sits inside the Custom Tools group.
|
|
103
|
-
*
|
|
104
|
-
* @param {string} tab - A tab id.
|
|
105
|
-
* @param {NavModel} nav - The sidebar's rows.
|
|
106
|
-
* @returns {boolean} `true` for an unplaced custom tool.
|
|
107
|
-
* @example isInCustomTools('tool:simulator', nav) // true
|
|
108
|
-
*/
|
|
109
|
-
export declare function isInCustomTools(tab: string, nav: NavModel): boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Whether a tab sits inside the Developer group.
|
|
112
|
-
*
|
|
113
|
-
* @param {string} tab - A tab id.
|
|
114
|
-
* @param {NavModel} nav - The sidebar's rows.
|
|
115
|
-
* @returns {boolean} `true` for a developer screen.
|
|
116
|
-
* @example isInDeveloper('dev:events', nav) // true
|
|
117
|
-
*/
|
|
118
|
-
export declare function isInDeveloper(tab: string, nav: NavModel): boolean;
|
|
119
93
|
/**
|
|
120
94
|
* Where a key moves focus among the sidebar's visible rows.
|
|
121
95
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{TAB_LABELS as e}from"../derive/plain-language/plain-language.js";var t=`picked-devtools-tab`,n=`
|
|
1
|
+
import{TAB_LABELS as e}from"../derive/plain-language/plain-language.js";var t=`picked-devtools-tab`,n=`Custom Tools`,r=`guide`,i=`custom-tools`,a=[{id:`project`,label:`Project`},{id:`components`,label:`Components`},{id:`config`,label:`Config`},{id:`content`,label:`Content`},{id:`events`,label:`Events`},{id:`fields`,label:`Fields`},{id:`frameworks`,label:`Frameworks`},{id:`history`,label:`History`},{id:`identity`,label:`Identity`},{id:`predicates`,label:`Predicates`}];function o(e){return`tool:${e}`}function s(e){return`screen:${e}`}function c(t){let r=[{id:`guide`,label:e.guide,kind:`review`},{id:`session`,label:e.session,kind:`review`},{id:`answers`,label:e.answers,kind:`review`},{id:`journey`,label:e.journey,kind:`review`},{id:`personas`,label:e.personas,kind:`review`}];t.variations&&r.push({id:`variations`,label:e.variations,kind:`review`});let c=e=>({id:o(e.id),label:e.label,kind:`tool`}),l=t.tools.map(c),u=t.customTools.map(c),d=a.map(e=>({id:s(e.id),label:e.label,kind:`screen`})),f=u.length===0?[{id:i,label:n,kind:`custom-tools`}]:[],p=t.footerTools.map(e=>({id:o(e.id),label:e.label,kind:`tool`,icon:e.icon??`wrench`}));return{primary:[...r,...l,...u,...f,...d],footer:p}}function l(e,t){return e===null?r:[...t.primary,...t.footer].some(t=>t.id===e)?e:r}function u(e,t,n){let r=Math.max(0,n-1);switch(e){case`ArrowDown`:return Math.min(t+1,r);case`ArrowUp`:return Math.max(t-1,0);case`Home`:return 0;case`End`:return r;default:return null}}function d(e,t){try{return e().getItem(t)}catch{return null}}function f(e,t,n){try{e().setItem(t,n)}catch{}}export{n as CUSTOM_TOOLS_LABEL,i as CUSTOM_TOOLS_TAB,r as DEFAULT_TAB,a as SCREENS,t as TAB_STORAGE_KEY,c as buildNav,u as nextFocusIndex,d as readStored,l as resolveTab,s as screenTabId,o as toolTabId,f as writeStored};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1793835766402",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"license": "SEE LICENSE IN LICENSE",
|
|
114
114
|
"module": "./dist/index.js",
|
|
115
115
|
"peerDependencies": {
|
|
116
|
-
"@picked/client": "0.0.1-dev.
|
|
116
|
+
"@picked/client": "0.0.1-dev.1793835766402",
|
|
117
117
|
"effector": "^23.4.4",
|
|
118
118
|
"svelte": "^5.55.7"
|
|
119
119
|
},
|
package/dist/plugins/devtools/screens/experience-instances/ExperienceInstancesListScreen.svelte
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import ExperienceInstancesTable from '../../components/ExperienceInstancesTable.svelte'
|
|
3
|
-
import { getPicked } from '../../../../hooks'
|
|
4
|
-
|
|
5
|
-
const client = getPicked()
|
|
6
|
-
|
|
7
|
-
$: experienceInstances = client.experienceInstances.listStore
|
|
8
|
-
</script>
|
|
9
|
-
|
|
10
|
-
<ExperienceInstancesTable experienceInstances={$experienceInstances} />
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
/** @file Detail screen for a single experience, showing its config, target selectors, and condition. */
|
|
3
|
-
import type { ExperienceStore } from '@picked/client'
|
|
4
|
-
import { getPicked } from '../../../../hooks'
|
|
5
|
-
import { Button, Card, Text, CodeBlock, Stack } from '../../ui'
|
|
6
|
-
|
|
7
|
-
const client = getPicked()
|
|
8
|
-
export let experience: ExperienceStore
|
|
9
|
-
|
|
10
|
-
$: config = experience.configStore
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<Stack direction="vertical" gap="medium" padding="medium">
|
|
14
|
-
<Stack direction="horizontal" gap="small">
|
|
15
|
-
<Button variant="primary" size="small" onclick={() => client.experiences.open({ key: experience.key, options: { bypassCondition: true } })}>
|
|
16
|
-
Launch experience
|
|
17
|
-
</Button>
|
|
18
|
-
</Stack>
|
|
19
|
-
|
|
20
|
-
<Card sectioned>
|
|
21
|
-
<Stack direction="vertical" gap="medium" padding="medium">
|
|
22
|
-
|
|
23
|
-
<div>
|
|
24
|
-
<Text weight="semibold">Target selectors</Text>
|
|
25
|
-
<ul>
|
|
26
|
-
{#if $config.targetSelectors.length > 0}
|
|
27
|
-
{#each $config.targetSelectors as selector (selector)}
|
|
28
|
-
<li>
|
|
29
|
-
<CodeBlock code="{selector.selector} || {selector.placement}" />
|
|
30
|
-
</li>
|
|
31
|
-
{/each}
|
|
32
|
-
{:else}
|
|
33
|
-
<li><Text color="subdued">(none)</Text></li>
|
|
34
|
-
{/if}
|
|
35
|
-
</ul>
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<div>
|
|
39
|
-
<Text weight="semibold">Condition</Text>
|
|
40
|
-
<CodeBlock code={JSON.stringify($config.decisionLogic, null, 2)} />
|
|
41
|
-
</div>
|
|
42
|
-
</Stack>
|
|
43
|
-
</Card>
|
|
44
|
-
</Stack>
|
package/dist/plugins/devtools/screens/experiences/ExperienceExperienceInstancesListScreen.svelte
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ExperienceStore } from '@picked/client'
|
|
3
|
-
import { getPicked } from '../../../../hooks'
|
|
4
|
-
import ExperienceInstancesTable from '../../components/ExperienceInstancesTable.svelte'
|
|
5
|
-
|
|
6
|
-
export let experience: ExperienceStore
|
|
7
|
-
|
|
8
|
-
const client = getPicked()
|
|
9
|
-
|
|
10
|
-
$: experienceInstances = client.experienceInstances.getByExperienceId(experience.id)
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<ExperienceInstancesTable experienceInstances={$experienceInstances} />
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { ExperienceStore } from '@picked/client'
|
|
3
|
-
import Tabs from '../../components/Tabs.svelte'
|
|
4
|
-
import ExperienceTreeScreen from './ExperienceTreeScreen.svelte'
|
|
5
|
-
import ExperienceDetailsScreen from './ExperienceDetailsScreen.svelte'
|
|
6
|
-
import ExperienceExperienceInstancesListScreen from './ExperienceExperienceInstancesListScreen.svelte'
|
|
7
|
-
|
|
8
|
-
export let experience: ExperienceStore
|
|
9
|
-
|
|
10
|
-
$: tabs = [
|
|
11
|
-
{
|
|
12
|
-
id: 'details',
|
|
13
|
-
label: 'Details',
|
|
14
|
-
component: ExperienceDetailsScreen,
|
|
15
|
-
props: { experience },
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
id: 'tree',
|
|
19
|
-
label: 'Tree',
|
|
20
|
-
component: ExperienceTreeScreen,
|
|
21
|
-
props: { experience },
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
id: 'experience-instances',
|
|
25
|
-
label: 'Instances',
|
|
26
|
-
component: ExperienceExperienceInstancesListScreen,
|
|
27
|
-
props: { experience },
|
|
28
|
-
},
|
|
29
|
-
]
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<Tabs {tabs} />
|