@picked/svelte 0.0.1-dev.1780617185476 → 0.0.1-dev.1783478000089
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.
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* re-renders reactively.
|
|
8
8
|
*/
|
|
9
9
|
import type { ExperienceStore, ExperienceTarget } from '@picked/client'
|
|
10
|
-
import { evaluateConditionMemo, hashRule,
|
|
10
|
+
import { evaluateConditionMemo, hashRule, ruleReferencesActionDeep } from '@picked/client/server'
|
|
11
11
|
import { getPicked, useUnit } from '../hooks'
|
|
12
12
|
import ExperienceHost from './ExperienceHost.svelte'
|
|
13
13
|
|
|
@@ -45,6 +45,16 @@
|
|
|
45
45
|
|
|
46
46
|
const experiences = useUnit(client.experiences.listStore)
|
|
47
47
|
const conditionResults = useUnit(client.conditionResults.store)
|
|
48
|
+
const conditions = useUnit(client.conditions.listStore)
|
|
49
|
+
|
|
50
|
+
const conditionsByKey = $derived.by(() => {
|
|
51
|
+
const byKey: Parameters<typeof ruleReferencesActionDeep>[1] = {}
|
|
52
|
+
for (const condition of $conditions) {
|
|
53
|
+
byKey[condition.key] = condition
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return byKey
|
|
57
|
+
})
|
|
48
58
|
|
|
49
59
|
/**
|
|
50
60
|
* Returns the sort rank for a placement; unknown placements sort last.
|
|
@@ -80,8 +90,9 @@
|
|
|
80
90
|
// Action-referencing conditions are never cached (their side effect must re-run), so they can
|
|
81
91
|
// never resolve through the synchronous `peek` the slot path relies on. Slots do not support
|
|
82
92
|
// action-gated conditions in v1; excluding them also stops the selection effect from re-firing
|
|
83
|
-
// the action on every render.
|
|
84
|
-
|
|
93
|
+
// the action on every render. The deep check follows composed `conditions.<key>` references so a
|
|
94
|
+
// condition that reaches an action transitively is excluded too.
|
|
95
|
+
if (ruleReferencesActionDeep(config.decisionLogic, conditionsByKey)) {
|
|
85
96
|
return null
|
|
86
97
|
}
|
|
87
98
|
|
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};
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
const g = svg.append('g').attr('transform', `translate(${margin.left},${margin.top})`)
|
|
245
245
|
|
|
246
246
|
const linkGenerator = d3
|
|
247
|
-
.linkHorizontal<d3.HierarchyPointLink<ProcessedNode>, ProcessedNode
|
|
247
|
+
.linkHorizontal<d3.HierarchyPointLink<ProcessedNode>, d3.HierarchyPointNode<ProcessedNode>>()
|
|
248
248
|
.x((d) => d.y)
|
|
249
249
|
.y((d) => d.x)
|
|
250
250
|
|
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.1783478000089",
|
|
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.1-dev.
|
|
109
|
+
"@picked/client": "0.0.1-dev.1783478000089",
|
|
110
110
|
"effector": "^23.3.0",
|
|
111
111
|
"svelte": "^5.46.4"
|
|
112
112
|
},
|