@picked/svelte 0.0.64-next.6 → 0.0.64-next.7
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/hooks/step.d.ts +12 -0
- package/dist/hooks/step.js +1 -1
- package/package.json +2 -2
package/dist/hooks/step.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ export interface StepContext extends FormInstance {
|
|
|
10
10
|
* `layoutContentId` against `client.contents` and stays reactive.
|
|
11
11
|
*/
|
|
12
12
|
layoutContentStore: Store<Content | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Reactive store of the current step's CMS content `data`, or `null` when the step
|
|
15
|
+
* has no `layoutContentId` or the referenced content is not yet registered. Derived
|
|
16
|
+
* from `layoutContentStore`; stays reactive to late content registration. This is the
|
|
17
|
+
* same value `getStepContent()` yields, exposed here so a step can read everything it
|
|
18
|
+
* needs from a single `getStep()` call.
|
|
19
|
+
*/
|
|
20
|
+
content: Store<Record<string, unknown> | null>;
|
|
13
21
|
isActive: Store<boolean>;
|
|
14
22
|
/** @deprecated Use `isActive` instead. */
|
|
15
23
|
isActiveStep: Store<boolean>;
|
|
@@ -34,6 +42,10 @@ export declare function getStep(): StepContext;
|
|
|
34
42
|
* data, or `null` when no content is registered for the step's `layoutContentId`.
|
|
35
43
|
* Subscribers automatically receive updates when content is registered or replaced.
|
|
36
44
|
*
|
|
45
|
+
* When a step context is present this returns its `content` store directly (the same
|
|
46
|
+
* store exposed by `getStep().content`); on the slot-render path, where no step context
|
|
47
|
+
* exists, it resolves the experience's layout content instead.
|
|
48
|
+
*
|
|
37
49
|
* @returns {Store<Record<string, unknown> | null>} A store of the Content record's `data`.
|
|
38
50
|
* @example
|
|
39
51
|
* ```svelte
|
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){let i=n(),{activeStep:c}=r(),l=c.map(e=>e?.key===t),u=i.steps.listStore.map(e=>e.find(e=>e.key===t)??{id:t,key:t,name:``,fieldKeys:[]}),d=s(t,u.map(e=>e.name),u.map(e=>e.fieldKeys))
|
|
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){let i=n(),{activeStep:c}=r(),l=c.map(e=>e?.key===t),u=i.steps.listStore.map(e=>e.find(e=>e.key===t)??{id:t,key:t,name:``,fieldKeys:[]}),d=s(t,u.map(e=>e.name),u.map(e=>e.fieldKeys)),f=o(u,i.contents.indexStore,(e,t)=>e.layoutContentId?t[e.layoutContentId]??null:null,{skipVoid:!1});return a(e,{step:u,layoutContentStore:f,content:f.map(e=>e?.data??null,{skipVoid:!1}),isActive:l,isActiveStep:l,...d})}function l(){return i(e)}function u(){let t=i(e);return t?t.content:d().map(e=>e?.data??null,{skipVoid:!1})}function d(){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,c as setStepContext};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.64-next.
|
|
3
|
+
"version": "0.0.64-next.7",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
"module": "./dist/index.js",
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@picked/client": "0.0.64-next.
|
|
109
|
+
"@picked/client": "0.0.64-next.7",
|
|
110
110
|
"effector": "^23.3.0",
|
|
111
111
|
"svelte": "^5.46.4"
|
|
112
112
|
},
|