@picked/svelte 0.0.1-dev.1789541668638 → 0.0.1-dev.1793753513002
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/LICENSE +1 -0
- package/README.md +51 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/_virtual/_vite/preload-helper.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/experience/ExperienceHost.svelte +29 -13
- package/dist/experience/ExperienceSlot.svelte +21 -3
- package/dist/experience/ExperienceWrapper.svelte +23 -0
- package/dist/form/index.js +1 -1
- package/dist/hooks/action.d.ts +47 -18
- package/dist/hooks/action.js +1 -1
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/step.d.ts +14 -0
- package/dist/hooks/step.js +1 -1
- package/dist/plugins/devtools/DevToolsExperience.svelte +545 -203
- package/dist/plugins/devtools/components/AdaptedToolHost.svelte +2 -2
- package/dist/plugins/devtools/constants.d.ts +5 -0
- package/dist/plugins/devtools/constants.js +1 -0
- package/dist/plugins/devtools/customTools.d.ts +42 -6
- package/dist/plugins/devtools/customTools.js +1 -1
- package/dist/plugins/devtools/derive/answer-display/answer-display.d.ts +112 -0
- package/dist/plugins/devtools/derive/answer-display/answer-display.js +1 -0
- package/dist/plugins/devtools/derive/answer-display/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/answer-display/index.js +1 -0
- package/dist/plugins/devtools/derive/answer-history/answer-history.d.ts +76 -0
- package/dist/plugins/devtools/derive/answer-history/answer-history.js +1 -0
- package/dist/plugins/devtools/derive/answer-history/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/answer-history/index.js +1 -0
- package/dist/plugins/devtools/derive/guide-sections/guide-sections.d.ts +67 -0
- package/dist/plugins/devtools/derive/guide-sections/guide-sections.js +1 -0
- package/dist/plugins/devtools/derive/guide-sections/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/guide-sections/index.js +1 -0
- package/dist/plugins/devtools/derive/index.d.ts +28 -0
- package/dist/plugins/devtools/derive/index.js +1 -0
- package/dist/plugins/devtools/derive/journey-outline/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/journey-outline/index.js +1 -0
- package/dist/plugins/devtools/derive/journey-outline/journey-outline.d.ts +86 -0
- package/dist/plugins/devtools/derive/journey-outline/journey-outline.js +1 -0
- package/dist/plugins/devtools/derive/journey-pick/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/journey-pick/index.js +1 -0
- package/dist/plugins/devtools/derive/journey-pick/journey-pick.d.ts +73 -0
- package/dist/plugins/devtools/derive/journey-pick/journey-pick.js +1 -0
- package/dist/plugins/devtools/derive/journey-timeline/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/journey-timeline/index.js +1 -0
- package/dist/plugins/devtools/derive/journey-timeline/journey-timeline.d.ts +70 -0
- package/dist/plugins/devtools/derive/journey-timeline/journey-timeline.js +1 -0
- package/dist/plugins/devtools/derive/journey-tree/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/journey-tree/index.js +1 -0
- package/dist/plugins/devtools/derive/journey-tree/journey-tree.d.ts +191 -0
- package/dist/plugins/devtools/derive/journey-tree/journey-tree.js +1 -0
- package/dist/plugins/devtools/derive/plain-language/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/plain-language/index.js +1 -0
- package/dist/plugins/devtools/derive/plain-language/plain-language.d.ts +73 -0
- package/dist/plugins/devtools/derive/plain-language/plain-language.js +1 -0
- package/dist/plugins/devtools/derive/plain-logic/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/plain-logic/index.js +1 -0
- package/dist/plugins/devtools/derive/plain-logic/plain-logic.d.ts +48 -0
- package/dist/plugins/devtools/derive/plain-logic/plain-logic.js +1 -0
- package/dist/plugins/devtools/derive/safety-posture/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/safety-posture/index.js +1 -0
- package/dist/plugins/devtools/derive/safety-posture/safety-posture.d.ts +43 -0
- package/dist/plugins/devtools/derive/safety-posture/safety-posture.js +1 -0
- package/dist/plugins/devtools/derive/visited-steps/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/visited-steps/index.js +1 -0
- package/dist/plugins/devtools/derive/visited-steps/visited-steps.d.ts +35 -0
- package/dist/plugins/devtools/derive/visited-steps/visited-steps.js +1 -0
- package/dist/plugins/devtools/derive/walk-route/index.d.ts +3 -0
- package/dist/plugins/devtools/derive/walk-route/index.js +1 -0
- package/dist/plugins/devtools/derive/walk-route/walk-route.d.ts +22 -0
- package/dist/plugins/devtools/derive/walk-route/walk-route.js +1 -0
- package/dist/plugins/devtools/index.d.ts +5 -2
- package/dist/plugins/devtools/index.js +1 -1
- package/dist/plugins/devtools/launcher/Launcher.svelte +150 -0
- package/dist/plugins/devtools/launcher/launcher.d.ts +36 -0
- package/dist/plugins/devtools/launcher/launcher.js +1 -0
- package/dist/plugins/devtools/options.d.ts +106 -0
- package/dist/plugins/devtools/options.js +1 -0
- package/dist/plugins/devtools/plugin.d.ts +8 -8
- package/dist/plugins/devtools/plugin.js +1 -1
- package/dist/plugins/devtools/posture-context.d.ts +15 -0
- package/dist/plugins/devtools/posture-context.js +1 -0
- package/dist/plugins/devtools/review/answers/AnswersPanel.svelte +526 -0
- package/dist/plugins/devtools/review/guide/GuideLine.svelte +20 -0
- package/dist/plugins/devtools/review/guide/GuidePanel.svelte +133 -0
- package/dist/plugins/devtools/review/index.d.ts +6 -0
- package/dist/plugins/devtools/review/index.js +1 -0
- package/dist/plugins/devtools/review/journey/JourneyMap.svelte +1076 -0
- package/dist/plugins/devtools/review/journey/JourneyPanel.svelte +584 -0
- package/dist/plugins/devtools/review/journey/JourneyTimeline.svelte +750 -0
- package/dist/plugins/devtools/review/journey/TimelineMarker.svelte +59 -0
- package/dist/plugins/devtools/review/session/SessionPanel.svelte +214 -0
- package/dist/plugins/devtools/review/variations/VariationsPanel.svelte +279 -0
- package/dist/plugins/devtools/screens/config/ConfigScreen.svelte +6 -0
- package/dist/plugins/devtools/screens/custom-tools/CustomToolsScreen.svelte +3 -3
- package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +6 -0
- package/dist/plugins/devtools/session/index.d.ts +3 -0
- package/dist/plugins/devtools/session/index.js +1 -0
- package/dist/plugins/devtools/session/session.d.ts +90 -0
- package/dist/plugins/devtools/session/session.js +1 -0
- package/dist/plugins/devtools/session-access.d.ts +32 -0
- package/dist/plugins/devtools/session-access.js +1 -0
- package/dist/plugins/devtools/sidebar/Sidebar.svelte +105 -0
- package/dist/plugins/devtools/sidebar/SidebarRow.svelte +117 -0
- package/dist/plugins/devtools/sidebar/nav.d.ts +105 -0
- package/dist/plugins/devtools/sidebar/nav.js +1 -0
- package/dist/plugins/devtools/ui/actions/Button.svelte +10 -1
- package/dist/plugins/devtools/ui/actions/CopyButton.svelte +13 -1
- package/dist/plugins/devtools/ui/data/Badge.svelte +3 -2
- package/dist/plugins/devtools/ui/data/EmptyState.svelte +16 -1
- package/dist/plugins/devtools/ui/feedback/Banner.svelte +3 -2
- package/dist/plugins/framework/index.js +1 -1
- package/dist/render/browser.js +1 -1
- package/package.json +23 -12
- package/dist/form/__tests__/CreateFormHarness.svelte +0 -30
- package/dist/hooks/events.d.ts +0 -2
- package/dist/hooks/events.js +0 -1
- package/dist/vite-env.d.js +0 -0
package/dist/hooks/action.d.ts
CHANGED
|
@@ -1,18 +1,40 @@
|
|
|
1
|
-
/** @file Svelte
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
/** @file Svelte bindings for running actions registered with the Picked client. */
|
|
2
|
+
import type { ActionBinding, ActionKeys, EvokableAction, ExperienceInstance, WorkflowActionKeys } from '@picked/client';
|
|
3
|
+
import type { Store } from 'effector';
|
|
4
|
+
export type { ActionBinding } from '@picked/client';
|
|
5
|
+
/** A key `getActionResult` takes: any action key except one a workflow is triggered by. */
|
|
6
|
+
type HostActionKey<K extends string> = K extends WorkflowActionKeys ? never : K;
|
|
4
7
|
/**
|
|
5
|
-
* Returns
|
|
8
|
+
* Returns a store binding a component to an action a workflow is triggered by: `run` runs it
|
|
9
|
+
* through `client.actions.run`, and `status`, `response` and `error` follow the latest run.
|
|
10
|
+
* Nothing runs the action except `run`. Every caller binding the same key and experience gets
|
|
11
|
+
* the same store, and so shares one run state.
|
|
6
12
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
13
|
+
* @param {WorkflowActionKeys} actionKey - The key of an action a workflow is triggered by.
|
|
14
|
+
* @param {object} [options] - Optional invocation overrides.
|
|
15
|
+
* @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
|
|
16
|
+
* @returns {Store<ActionBinding>} A store of the latest run's state, and `run`.
|
|
17
|
+
* @example
|
|
18
|
+
* ```svelte
|
|
19
|
+
* <script>
|
|
20
|
+
* const callback = getAction('request-callback')
|
|
21
|
+
* </script>
|
|
22
|
+
* <button onclick={() => $callback.run()} disabled={$callback.status === 'running'}>Call me</button>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAction(actionKey: WorkflowActionKeys, options?: {
|
|
26
|
+
experience: ExperienceInstance;
|
|
27
|
+
}): Store<ActionBinding>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the reactive store of the callable action. Calling it runs the action with the
|
|
30
|
+
* arguments it is called with. When `options.experience` is provided, the call passes that
|
|
31
|
+
* experience as the action's context, so a handler can behave as if the experience triggered
|
|
32
|
+
* it, for example by calling `context.experience.close()` after a submit.
|
|
11
33
|
*
|
|
12
|
-
* @param {ActionKeys} actionKey - Action key from the workspace schema.
|
|
34
|
+
* @param {ActionKeys} actionKey - Action key from the workspace schema, or one the app registers.
|
|
13
35
|
* @param {object} [options] - Optional invocation overrides.
|
|
14
36
|
* @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
|
|
15
|
-
* @returns {Store<
|
|
37
|
+
* @returns {Store<EvokableAction>} A store of the callable action.
|
|
16
38
|
* @example
|
|
17
39
|
* ```ts
|
|
18
40
|
* const actionStore = getAction('log-event')
|
|
@@ -21,20 +43,27 @@ import { type Store } from 'effector';
|
|
|
21
43
|
*/
|
|
22
44
|
export declare function getAction(actionKey: ActionKeys, options?: {
|
|
23
45
|
experience: ExperienceInstance;
|
|
24
|
-
}): Store<
|
|
46
|
+
}): Store<EvokableAction>;
|
|
25
47
|
/**
|
|
26
|
-
* Returns a
|
|
27
|
-
*
|
|
48
|
+
* Returns a store of the latest result of running a host's action, evaluated again on each call, so
|
|
49
|
+
* on each component that reads it, and whenever the action, the responses or the fields change;
|
|
50
|
+
* with `options.experience`, it follows those changes while the experience's instance is listed in
|
|
51
|
+
* `client.experienceInstances`. Every caller reading the same key and experience gets the same
|
|
52
|
+
* store, so the action runs once per change, and once for the calls of one task. When the
|
|
53
|
+
* evaluation that started last throws, the store holds `undefined`. A key a workflow is triggered
|
|
54
|
+
* by is refused: its action posts to the Picked API on every run, so read it with
|
|
55
|
+
* {@link getAction}. At runtime a published action holds `undefined` here.
|
|
28
56
|
*
|
|
29
|
-
* @
|
|
57
|
+
* @template {ActionKeys} K
|
|
58
|
+
* @param {K} actionKey - Action key of a host's action.
|
|
30
59
|
* @param {object} [options] - Optional invocation overrides.
|
|
31
60
|
* @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
|
|
32
|
-
* @returns {Store<
|
|
61
|
+
* @returns {Store<unknown>} A store of the action's latest result.
|
|
33
62
|
* @example
|
|
34
63
|
* ```ts
|
|
35
|
-
* const
|
|
64
|
+
* const loggedIn = getActionResult('is-logged-in')
|
|
36
65
|
* ```
|
|
37
66
|
*/
|
|
38
|
-
export declare function getActionResult(actionKey:
|
|
67
|
+
export declare function getActionResult<K extends ActionKeys>(actionKey: K & HostActionKey<K>, options?: {
|
|
39
68
|
experience: ExperienceInstance;
|
|
40
|
-
}):
|
|
69
|
+
}): Store<unknown>;
|
package/dist/hooks/action.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getPicked as e}from"./client.js";
|
|
1
|
+
import{getPicked as e}from"./client.js";function t(t,n){return e().actions.getActionBinding(t,n)}function n(t,n){let{actions:r}=e();return r.refreshActionResult(t,n),r.getActionResult(t,n)}export{t as getAction,n as getActionResult};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export { getPicked, getExperience } from './client';
|
|
|
3
3
|
export { getPredicate, getPredicateResult } from './predicate';
|
|
4
4
|
export { getFeature, getFeatureResult, getFeatureEnabled } from './feature';
|
|
5
5
|
export { getAction, getActionResult } from './action';
|
|
6
|
-
export {
|
|
6
|
+
export type { ActionBinding } from './action';
|
|
7
|
+
export { getStep, setStepContext, getStepContent, getStepLayoutContent } from './step';
|
|
7
8
|
export { getContent } from './content';
|
|
8
9
|
export { getReference, getReferences } from './reference';
|
|
9
10
|
export { useUnit, getContextScope, setContextScope } from './stores';
|
|
10
11
|
export { createSessionStorageStore, createLocalStorageStore } from './storage.js';
|
|
11
|
-
export { getTrackRecommendationPresentEvent } from './events';
|
|
12
12
|
export { createQuery, queryCache, queryPresets, type QueryResult, type QueryFactory, } from './create-query';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureEnabled as a,getFeatureResult as o}from"./feature.js";import{getAction as s,getActionResult as c}from"./action.js";import{getStep as l,getStepContent as u,setStepContext as
|
|
1
|
+
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureEnabled as a,getFeatureResult as o}from"./feature.js";import{getAction as s,getActionResult as c}from"./action.js";import{getStep as l,getStepContent as u,getStepLayoutContent as d,setStepContext as f}from"./step.js";import{getContent as p}from"./content.js";import{getReference as m,getReferences as h}from"./reference.js";import{getContextScope as g,setContextScope as _,useUnit as v}from"./stores.js";import{createLocalStorageStore as y,createSessionStorageStore as b}from"./storage.js";import{createQuery as x,queryCache as S,queryPresets as C}from"./create-query/index.js";export{y as createLocalStorageStore,x as createQuery,b as createSessionStorageStore,s as getAction,c as getActionResult,p as getContent,g as getContextScope,e as getExperience,i as getFeature,a as getFeatureEnabled,o as getFeatureResult,t as getPicked,n as getPredicate,r as getPredicateResult,m as getReference,h as getReferences,l as getStep,u as getStepContent,d as getStepLayoutContent,S as queryCache,C as queryPresets,_ as setContextScope,f as setStepContext,v as useUnit};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -92,3 +92,17 @@ export declare function getStepContent(): Store<StepLayoutContent | null>;
|
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
export declare function getStepContent<K extends keyof StepContentModelsMap>(): Store<ContentForStep<K> | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Returns a store of the current step's layout Content record, or `null` when the step has no
|
|
97
|
+
* layout content or it is not registered yet.
|
|
98
|
+
*
|
|
99
|
+
* The record carries its `contentModelKey`. Under a step context it is that step's layout; on the
|
|
100
|
+
* slot render path, the layout of the experience's content-bearing step.
|
|
101
|
+
*
|
|
102
|
+
* @returns {Store<Content | null>} A store of the layout Content record.
|
|
103
|
+
* @example
|
|
104
|
+
* ```svelte
|
|
105
|
+
* const record = getStepLayoutContent()
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare function getStepLayoutContent(): Store<Content | null>;
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getExperience as t,getPicked as n}from"./client.js";import{getStepRouter as r}from"../router/context.js";import{getContext as i,setContext as a}from"svelte";import{combine as o}from"effector";import{createForm as s}from"../form/create-form.svelte";function c(t,i){let c=n(),{activeStep:l}=r(),u=l.map(e=>e?.key===t),d=c.steps.listStore.map(e=>e.find(e=>e.key===t)??{id:t,key:t,name:``,fieldKeys:[]}),f=d.map(e=>e.name),p=d.map(e=>e.fieldKeys),m=s(t,f,p,i),h=o(d,c.contents.indexStore,(e,t)=>e.layoutContentId?t[e.layoutContentId]??null:null,{skipVoid:!1}),g=h.map(e=>e?.data??null,{skipVoid:!1});return a(e,{step:d,layoutContentStore:h,content:g,isActive:u,isActiveStep:u,...m})}function l(t){let n=i(e);return t?.onBeforeSubmit&&n.form.onBeforeSubmit(t.onBeforeSubmit),t?.onSuccess&&n.form.onSuccess(t.onSuccess),t?.onError&&n.form.onError(t.onError),n}function u(){let t=i(e);return t?t.content:
|
|
1
|
+
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getExperience as t,getPicked as n}from"./client.js";import{getStepRouter as r}from"../router/context.js";import{getContext as i,setContext as a}from"svelte";import{combine as o}from"effector";import{createForm as s}from"../form/create-form.svelte";function c(t,i){let c=n(),{activeStep:l}=r(),u=l.map(e=>e?.key===t),d=c.steps.listStore.map(e=>e.find(e=>e.key===t)??{id:t,key:t,name:``,fieldKeys:[]}),f=d.map(e=>e.name),p=d.map(e=>e.fieldKeys),m=s(t,f,p,i),h=o(d,c.contents.indexStore,(e,t)=>e.layoutContentId?t[e.layoutContentId]??null:null,{skipVoid:!1}),g=h.map(e=>e?.data??null,{skipVoid:!1});return a(e,{step:d,layoutContentStore:h,content:g,isActive:u,isActiveStep:u,...m})}function l(t){let n=i(e);return t?.onBeforeSubmit&&n.form.onBeforeSubmit(t.onBeforeSubmit),t?.onSuccess&&n.form.onSuccess(t.onSuccess),t?.onError&&n.form.onError(t.onError),n}function u(){let t=i(e);return t?t.content:f().map(e=>e?.data??null,{skipVoid:!1})}function d(){return i(e)?.layoutContentStore??f()}function f(){let e=t(),r=n();return o(e.treeStore,r.contents.indexStore,(e,t)=>{let n=e.steps.find(e=>e.layoutContentId);return n?.layoutContentId?t[n.layoutContentId]??null:null})}export{l as getStep,u as getStepContent,d as getStepLayoutContent,c as setStepContext};
|