@picked/svelte 0.0.1-dev.1793776638554 → 0.0.1-dev.1793923852884

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.
Files changed (50) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/experience/set-picked-context.js +1 -1
  3. package/dist/plugins/devtools/DevToolsExperience.svelte +155 -80
  4. package/dist/plugins/devtools/customTools.d.ts +2 -2
  5. package/dist/plugins/devtools/derive/answer-display/answer-display.d.ts +14 -0
  6. package/dist/plugins/devtools/derive/answer-display/answer-display.js +1 -1
  7. package/dist/plugins/devtools/derive/answer-display/index.d.ts +2 -2
  8. package/dist/plugins/devtools/derive/answer-display/index.js +1 -1
  9. package/dist/plugins/devtools/derive/guide-sections/guide-sections.js +1 -1
  10. package/dist/plugins/devtools/derive/index.d.ts +5 -5
  11. package/dist/plugins/devtools/derive/index.js +1 -1
  12. package/dist/plugins/devtools/derive/personas/index.d.ts +2 -2
  13. package/dist/plugins/devtools/derive/personas/index.js +1 -1
  14. package/dist/plugins/devtools/derive/personas/personas.d.ts +88 -7
  15. package/dist/plugins/devtools/derive/personas/personas.js +1 -1
  16. package/dist/plugins/devtools/derive/plain-language/index.d.ts +1 -1
  17. package/dist/plugins/devtools/derive/plain-language/index.js +1 -1
  18. package/dist/plugins/devtools/derive/plain-language/plain-language.d.ts +5 -5
  19. package/dist/plugins/devtools/derive/plain-language/plain-language.js +1 -1
  20. package/dist/plugins/devtools/index.d.ts +1 -1
  21. package/dist/plugins/devtools/launcher/Launcher.svelte +13 -4
  22. package/dist/plugins/devtools/options.d.ts +6 -4
  23. package/dist/plugins/devtools/options.js +1 -1
  24. package/dist/plugins/devtools/review/journey/ExperienceDetails.svelte +129 -0
  25. package/dist/plugins/devtools/review/journey/JourneyPanel.svelte +54 -8
  26. package/dist/plugins/devtools/review/personas/ChoiceButton.svelte +40 -6
  27. package/dist/plugins/devtools/review/personas/PersonaBuilder.svelte +69 -45
  28. package/dist/plugins/devtools/review/personas/PersonaCard.svelte +226 -43
  29. package/dist/plugins/devtools/review/personas/PersonasPanel.svelte +171 -74
  30. package/dist/plugins/devtools/review/personas/load-persona.d.ts +41 -20
  31. package/dist/plugins/devtools/review/personas/load-persona.js +1 -1
  32. package/dist/plugins/devtools/review/personas/persona-route.d.ts +87 -0
  33. package/dist/plugins/devtools/review/personas/persona-route.js +1 -0
  34. package/dist/plugins/devtools/review/personas/persona-session.d.ts +94 -0
  35. package/dist/plugins/devtools/review/personas/persona-session.js +1 -0
  36. package/dist/plugins/devtools/sidebar/Sidebar.svelte +14 -48
  37. package/dist/plugins/devtools/sidebar/SidebarRow.svelte +2 -2
  38. package/dist/plugins/devtools/sidebar/nav.d.ts +26 -39
  39. package/dist/plugins/devtools/sidebar/nav.js +1 -1
  40. package/package.json +2 -2
  41. package/dist/plugins/devtools/screens/experience-instances/ExperienceInstancesListScreen.svelte +0 -10
  42. package/dist/plugins/devtools/screens/experiences/ExperienceDetailsScreen.svelte +0 -44
  43. package/dist/plugins/devtools/screens/experiences/ExperienceExperienceInstancesListScreen.svelte +0 -13
  44. package/dist/plugins/devtools/screens/experiences/ExperienceScreen.svelte +0 -32
  45. package/dist/plugins/devtools/screens/experiences/ExperienceTreeScreen.svelte +0 -500
  46. package/dist/plugins/devtools/screens/experiences/ExperiencesListScreen.svelte +0 -22
  47. package/dist/plugins/devtools/screens/features/FeaturesListScreen.svelte +0 -239
  48. package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +0 -286
  49. package/dist/plugins/devtools/screens/responses/ResponsesListScreen.svelte +0 -12
  50. 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,26 @@
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).
5
+ The Advanced row mirrors the Dashboard's folding nav group (sidebar-nav-group.tsx).
6
6
  -->
7
7
  <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'
8
+ /** @file The devtools sidebar: the main tabs, then the folding Advanced group. */
9
+ import { ADVANCED_LABEL } from '../derive/plain-language'
13
10
  import type { NavModel } from './nav'
14
- import { CUSTOM_TOOLS_GROUP, CUSTOM_TOOLS_LABEL, nextFocusIndex } from './nav'
11
+ import { nextFocusIndex } from './nav'
15
12
  import SidebarRow from './SidebarRow.svelte'
16
13
 
17
14
  interface Props {
18
15
  nav: NavModel
19
16
  /** The selected tab's id. */
20
17
  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
18
+ /** Whether the Advanced group lists its screens. */
19
+ advancedOpen: boolean
25
20
  onSelect: (id: string) => void
26
- onToggleDeveloper: () => void
27
- onToggleCustom: () => void
21
+ onToggleAdvanced: () => void
28
22
  }
29
23
 
30
- const {
31
- nav,
32
- selected,
33
- developerOpen,
34
- customOpen,
35
- onSelect,
36
- onToggleDeveloper,
37
- onToggleCustom,
38
- }: Props = $props()
24
+ const { nav, selected, advancedOpen, onSelect, onToggleAdvanced }: Props = $props()
39
25
 
40
26
  let list: HTMLElement | undefined = $state()
41
27
 
@@ -71,36 +57,16 @@
71
57
  onPress={() => onSelect(item.id)}
72
58
  />
73
59
  {/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
60
  <li class="divider" role="presentation"></li>
95
61
  <SidebarRow
96
- label={DEVELOPER_LABEL}
97
- testId="devtools-nav-developer"
62
+ label={ADVANCED_LABEL}
63
+ testId="devtools-nav-advanced"
98
64
  depth={0}
99
- expanded={developerOpen}
100
- onPress={onToggleDeveloper}
65
+ expanded={advancedOpen}
66
+ onPress={onToggleAdvanced}
101
67
  />
102
- {#if developerOpen}
103
- {#each nav.developer as item (item.id)}
68
+ {#if advancedOpen}
69
+ {#each nav.advanced as item (item.id)}
104
70
  <SidebarRow
105
71
  label={item.label}
106
72
  testId="devtools-nav-{item.id}"
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
- /** @file One row of the devtools sidebar: a tab, or the disclosure that folds the Developer group. */
2
+ /** @file One row of the devtools sidebar: a tab, or the disclosure that folds the Advanced group. */
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. */
7
+ /** Indent depth: 0 for a top-level row, 2 for a screen inside the Advanced group. */
8
8
  depth: 0 | 2
9
9
  onPress: () => void
10
10
  /** A tab row: whether it is the selected tab. */
@@ -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 shown while no tool
6
- * sits in that group, or a developer screen.
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' | 'developer';
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,27 @@ 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: the top-level tabs, the Advanced group's screens, and the foot's icons. */
22
19
  export interface NavModel {
23
20
  primary: readonly NavItem[];
24
- custom: readonly NavItem[];
25
- developer: readonly NavItem[];
21
+ advanced: readonly NavItem[];
26
22
  footer: readonly NavItem[];
27
23
  }
28
24
  /** `sessionStorage` key holding the selected tab's id. */
29
25
  export declare const TAB_STORAGE_KEY = "picked-devtools-tab";
30
- /** `sessionStorage` key holding `'true'` while the Developer group is open. */
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. */
26
+ /** `sessionStorage` key holding `'true'` while the Advanced group is open. */
27
+ export declare const ADVANCED_OPEN_STORAGE_KEY = "picked-devtools-advanced-open";
28
+ /** The label of the Custom Tools row. */
35
29
  export declare const CUSTOM_TOOLS_LABEL = "Custom Tools";
36
30
  /** The tab a first open lands on, and where a vanished tab falls back to. */
37
31
  export declare const DEFAULT_TAB = "guide";
38
- /** The id of the Custom Tools row listed while no tool sits in that group; it links the how-to page. */
32
+ /** The id of the Custom Tools row, listed while no unplaced tool is registered; it links the how-to page. */
39
33
  export declare const CUSTOM_TOOLS_TAB = "custom-tools";
40
- /** The id of the row that folds the Custom Tools group. */
41
- export declare const CUSTOM_TOOLS_GROUP = "custom-tools-group";
42
- /** The developer screens, in the order the Developer group lists them. */
43
- export declare const DEVELOPER_SCREENS: readonly {
34
+ /**
35
+ * The SDK's own screens, in the alphabetical order the folding Advanced group lists them.
36
+ * Experiences, Feature flags and Responses are review tabs, so they are not here.
37
+ */
38
+ export declare const SCREENS: readonly {
44
39
  id: string;
45
40
  label: string;
46
41
  }[];
@@ -53,13 +48,13 @@ export declare const DEVELOPER_SCREENS: readonly {
53
48
  */
54
49
  export declare function toolTabId(toolId: string): string;
55
50
  /**
56
- * The sidebar id of a developer screen.
51
+ * The sidebar id of one of the SDK's own screens.
57
52
  *
58
- * @param {string} screenId - The screen's id in {@link DEVELOPER_SCREENS}.
53
+ * @param {string} screenId - The screen's id in {@link SCREENS}.
59
54
  * @returns {string} Its tab id, prefixed so it never collides with a review tab.
60
- * @example developerTabId('responses') // 'dev:responses'
55
+ * @example screenTabId('events') // 'screen:events'
61
56
  */
62
- export declare function developerTabId(screenId: string): string;
57
+ export declare function screenTabId(screenId: string): string;
63
58
  /** What decides the sidebar's rows. */
64
59
  export interface NavInput {
65
60
  /** Whether the workspace publishes a feature, which lists Feature flags. */
@@ -69,7 +64,7 @@ export interface NavInput {
69
64
  id: string;
70
65
  label: string;
71
66
  }[];
72
- /** The unplaced custom tools, in registration order, each a row of the Custom Tools group. */
67
+ /** The unplaced custom tools, in registration order, each a top-level row after the review tools. */
73
68
  customTools: readonly {
74
69
  id: string;
75
70
  label: string;
@@ -82,10 +77,11 @@ export interface NavInput {
82
77
  }[];
83
78
  }
84
79
  /**
85
- * Builds the sidebar's entries.
80
+ * Builds the sidebar's entries: the review tabs and the site's tools, then the Advanced group of
81
+ * the SDK's own screens.
86
82
  *
87
83
  * @param {NavInput} input - What this session lists.
88
- * @returns {NavModel} The top-level tabs, the Custom Tools and Developer groups' rows, and the foot's icons.
84
+ * @returns {NavModel} The top-level tabs, the Advanced group's screens and the foot's icons.
89
85
  * @example buildNav({ variations: true, tools: [], customTools: [], footerTools: [] })
90
86
  */
91
87
  export declare function buildNav(input: NavInput): NavModel;
@@ -99,23 +95,14 @@ export declare function buildNav(input: NavInput): NavModel;
99
95
  */
100
96
  export declare function resolveTab(stored: string | null, nav: NavModel): string;
101
97
  /**
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.
98
+ * Whether a tab sits inside the Advanced group.
112
99
  *
113
100
  * @param {string} tab - A tab id.
114
101
  * @param {NavModel} nav - The sidebar's rows.
115
- * @returns {boolean} `true` for a developer screen.
116
- * @example isInDeveloper('dev:events', nav) // true
102
+ * @returns {boolean} `true` for one of the SDK's own screens.
103
+ * @example isInAdvanced('screen:events', nav) // true
117
104
  */
118
- export declare function isInDeveloper(tab: string, nav: NavModel): boolean;
105
+ export declare function isInAdvanced(tab: string, nav: NavModel): boolean;
119
106
  /**
120
107
  * Where a key moves focus among the sidebar's visible rows.
121
108
  *
@@ -1 +1 @@
1
- import{TAB_LABELS as e}from"../derive/plain-language/plain-language.js";var t=`picked-devtools-tab`,n=`picked-devtools-developer-open`,r=`picked-devtools-custom-tools-open`,i=`Custom Tools`,a=`guide`,o=`custom-tools`,s=`custom-tools-group`,c=[{id:`project`,label:`Project`},{id:`components`,label:`Components`},{id:`config`,label:`Config`},{id:`content`,label:`Content`},{id:`events`,label:`Events`},{id:`experience-instances`,label:`Experience Instances`},{id:`experiences`,label:`Experiences`},{id:`features`,label:`Feature flags`},{id:`fields`,label:`Fields`},{id:`frameworks`,label:`Frameworks`},{id:`history`,label:`History`},{id:`identity`,label:`Identity`},{id:`predicates`,label:`Predicates`},{id:`responses`,label:`Responses`}];function l(e){return`tool:${e}`}function u(e){return`dev:${e}`}function d(t){let n=[{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&&n.push({id:`variations`,label:e.variations,kind:`review`});let r=e=>({id:l(e.id),label:e.label,kind:`tool`}),a=t.tools.map(r),s=t.customTools.map(r),d=c.map(e=>({id:u(e.id),label:e.label,kind:`developer`})),f=s.length===0?[{id:o,label:i,kind:`custom-tools`}]:[],p=t.footerTools.map(e=>({id:l(e.id),label:e.label,kind:`tool`,icon:e.icon??`wrench`}));return{primary:[...n,...a,...f],custom:s,developer:d,footer:p}}function f(e,t){return e===null?a:[...t.primary,...t.custom,...t.developer,...t.footer].some(t=>t.id===e)?e:a}function p(e,t){return t.custom.some(t=>t.id===e)}function m(e,t){return t.developer.some(t=>t.id===e)}function h(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 g(e,t){try{return e().getItem(t)}catch{return null}}function _(e,t,n){try{e().setItem(t,n)}catch{}}export{s as CUSTOM_TOOLS_GROUP,i as CUSTOM_TOOLS_LABEL,r as CUSTOM_TOOLS_OPEN_STORAGE_KEY,o as CUSTOM_TOOLS_TAB,a as DEFAULT_TAB,n as DEVELOPER_OPEN_STORAGE_KEY,c as DEVELOPER_SCREENS,t as TAB_STORAGE_KEY,d as buildNav,u as developerTabId,p as isInCustomTools,m as isInDeveloper,h as nextFocusIndex,g as readStored,f as resolveTab,l as toolTabId,_ as writeStored};
1
+ import{TAB_LABELS as e}from"../derive/plain-language/plain-language.js";var t=`picked-devtools-tab`,n=`picked-devtools-advanced-open`,r=`Custom Tools`,i=`guide`,a=`custom-tools`,o=[{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`},{id:`project`,label:`Project`}];function s(e){return`tool:${e}`}function c(e){return`screen:${e}`}function l(t){let n=[{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&&n.push({id:`variations`,label:e.variations,kind:`review`});let i=e=>({id:s(e.id),label:e.label,kind:`tool`}),l=t.tools.map(i),u=t.customTools.map(i),d=o.map(e=>({id:c(e.id),label:e.label,kind:`screen`})),f=u.length===0?[{id:a,label:r,kind:`custom-tools`}]:[],p=t.footerTools.map(e=>({id:s(e.id),label:e.label,kind:`tool`,icon:e.icon??`wrench`}));return{primary:[...n,...l,...u,...f],advanced:d,footer:p}}function u(e,t){return e===null?i:[...t.primary,...t.advanced,...t.footer].some(t=>t.id===e)?e:i}function d(e,t){return t.advanced.some(t=>t.id===e)}function f(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 p(e,t){try{return e().getItem(t)}catch{return null}}function m(e,t,n){try{e().setItem(t,n)}catch{}}export{n as ADVANCED_OPEN_STORAGE_KEY,r as CUSTOM_TOOLS_LABEL,a as CUSTOM_TOOLS_TAB,i as DEFAULT_TAB,o as SCREENS,t as TAB_STORAGE_KEY,l as buildNav,d as isInAdvanced,f as nextFocusIndex,p as readStored,u as resolveTab,c as screenTabId,s as toolTabId,m as writeStored};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/svelte",
3
- "version": "0.0.1-dev.1793776638554",
3
+ "version": "0.0.1-dev.1793923852884",
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.1793776638554",
116
+ "@picked/client": "0.0.1-dev.1793923852884",
117
117
  "effector": "^23.4.4",
118
118
  "svelte": "^5.55.7"
119
119
  },
@@ -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>
@@ -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} />