@picked/react 0.0.1-dev.1778136207545 → 0.0.1-dev.1778458140037
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/index.d.ts +1 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/step.d.ts +1 -22
- package/dist/hooks/step.d.ts.map +1 -1
- package/dist/hooks/step.js +1 -1
- package/package.json +2 -2
- package/dist/hooks/content.d.ts +0 -23
- package/dist/hooks/content.d.ts.map +0 -1
- package/dist/hooks/content.js +0 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { ClientContext, ClientProvider, ExperienceContext, ExperienceProvider } from '../context';
|
|
5
5
|
export { usePicked, useExperience } from './client';
|
|
6
|
-
export { useStep, useSetStepContext
|
|
6
|
+
export { useStep, useSetStepContext } from './step';
|
|
7
7
|
export type { StepContext } from './step';
|
|
8
8
|
export { useSessionStorage, useLocalStorage } from './storage';
|
|
9
9
|
export type { UseStorageOptions } from './storage';
|
|
10
10
|
export * from './field';
|
|
11
11
|
export { useFeature, useFeatureResult } from './feature';
|
|
12
12
|
export { useAction, useActionResult } from './action';
|
|
13
|
-
export { getContent } from './content';
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACjG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACjG,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ClientContext as e,ClientProvider as t,ExperienceContext as n,ExperienceProvider as r}from"../context.js";import{useExperience as i,usePicked as a}from"./client.js";import{useAction as o,useActionResult as s}from"./action.js";import{
|
|
1
|
+
import{ClientContext as e,ClientProvider as t,ExperienceContext as n,ExperienceProvider as r}from"../context.js";import{useExperience as i,usePicked as a}from"./client.js";import{useAction as o,useActionResult as s}from"./action.js";import{useFeature as c,useFeatureResult as l}from"./feature.js";import{getField as u}from"./field.js";import{useSetStepContext as d,useStep as f}from"./step.js";import{useLocalStorage as p,useSessionStorage as m}from"./storage.js";export{e as ClientContext,t as ClientProvider,n as ExperienceContext,r as ExperienceProvider,u as getField,o as useAction,s as useActionResult,i as useExperience,c as useFeature,l as useFeatureResult,p as useLocalStorage,a as usePicked,m as useSessionStorage,d as useSetStepContext,f as useStep};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import {
|
|
2
|
+
import { ExperienceStep } from '@picked/client';
|
|
3
3
|
import { FormInstance } from '../form';
|
|
4
4
|
import { ReactFormField } from '../utils/map-field-to-react';
|
|
5
5
|
export interface StepContext {
|
|
6
6
|
step: Store<ExperienceStep>;
|
|
7
7
|
/** Reactive store of fields with React-style event handlers and current state. */
|
|
8
8
|
fields: Store<ReactFormField[]>;
|
|
9
|
-
/**
|
|
10
|
-
* Reactive store of the current step's CMS layout content. Resolves the step's
|
|
11
|
-
* `layoutContentId` against `client.contents` and stays reactive — when content is
|
|
12
|
-
* registered or updated, subscribers re-render. Yields `null` when the step has no
|
|
13
|
-
* `layoutContentId` or the referenced content has not been registered yet.
|
|
14
|
-
*/
|
|
15
|
-
layoutContentStore: Store<Content | null>;
|
|
16
9
|
isActive: boolean;
|
|
17
10
|
/** @deprecated Use `isActive` instead. */
|
|
18
11
|
isActiveStep: boolean;
|
|
@@ -38,18 +31,4 @@ export declare function useStep(): StepContext;
|
|
|
38
31
|
* @example useSetStepContext('step-1')
|
|
39
32
|
*/
|
|
40
33
|
export declare function useSetStepContext(stepKey: string): StepContext;
|
|
41
|
-
/**
|
|
42
|
-
* Returns the current step's resolved CMS content data, or `null` when no content is
|
|
43
|
-
* registered for the step's `layoutContentId`. Subscribes to `useStep().layoutContentStore`
|
|
44
|
-
* via Effector's `useUnit`, so the component re-renders on content updates.
|
|
45
|
-
*
|
|
46
|
-
* @returns {Record<string, unknown> | null} The Content record's `data`, or `null`.
|
|
47
|
-
* @throws {Error} When called outside `StepContextProvider`.
|
|
48
|
-
* @example
|
|
49
|
-
* ```tsx
|
|
50
|
-
* const content = useStepContent()
|
|
51
|
-
* return <Layout headline={content?.headline as string ?? ''} />
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
export declare function useStepContent(): Record<string, unknown> | null;
|
|
55
34
|
//# sourceMappingURL=step.d.ts.map
|
package/dist/hooks/step.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/hooks/step.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAGjE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAA;IAC3B,kFAAkF;IAClF,MAAM,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC,CAAA;IAC/B,QAAQ,EAAE,OAAO,CAAA;IACjB,0CAA0C;IAC1C,YAAY,EAAE,OAAO,CAAA;IACrB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAA;CAC3B;AAED,eAAO,MAAM,mBAAmB,6CAA0C,CAAA;AAE1E;;;;;GAKG;AACH,wBAAgB,OAAO,IAAI,WAAW,CAOrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAyC9D"}
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useExperience as e}from"./client.js";import{useForm as t}from"../form/index.js";import{useStepRouter as n}from"../router/context.js";import{createContext as r,useContext as i,useMemo as a}from"react";
|
|
1
|
+
import{useExperience as e}from"./client.js";import{useForm as t}from"../form/index.js";import{useStepRouter as n}from"../router/context.js";import{createContext as r,useContext as i,useMemo as a}from"react";var o=r(null);function s(){let e=i(o);if(!e)throw Error(`useStep must be used within a StepContextProvider`);return e}function c(r){let i=e(),{activeStep:o}=n(),s=a(()=>o?.key===r,[o?.key,r]),c=a(()=>i.treeStore.map(e=>e.steps.find(e=>e.key===r)??{id:r,key:r,name:``,fieldKeys:[]},{skipVoid:!1}),[i,r]),{form:l,fields:u}=t(r,a(()=>c.map(e=>e.name,{skipVoid:!1}),[c]),a(()=>c.map(e=>e.fieldKeys,{skipVoid:!1}),[c]));return{step:c,fields:u,isActive:s,isActiveStep:s,form:l}}export{o as StepContextProvider,c as useSetStepContext,s as useStep};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/react",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1778458140037",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@picked/client": "workspace:*",
|
|
6
6
|
"@repo/eslint-config": "workspace:*",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"module": "./dist/index.js",
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@picked/client": "0.0.1-dev.
|
|
88
|
+
"@picked/client": "0.0.1-dev.1778458140037",
|
|
89
89
|
"effector": "^23.3.0",
|
|
90
90
|
"effector-react": "^23.3.0",
|
|
91
91
|
"react": "19.2.2",
|
package/dist/hooks/content.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Store } from 'effector';
|
|
2
|
-
import { Content } from '@picked/client';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the registry store for a content id, mirroring `getField(key)`. Resolves
|
|
5
|
-
* the Picked client via `usePicked()` and returns `client.contents.getById(id)`.
|
|
6
|
-
* Consumers are responsible for calling `useUnit` to subscribe.
|
|
7
|
-
*
|
|
8
|
-
* @param {string} id - The content record id to look up.
|
|
9
|
-
* @returns {Store<Content | null>} The registry store; `null` until content is registered.
|
|
10
|
-
* @throws {Error} When called outside `ClientProvider` (the same error `usePicked` throws).
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* import { useUnit } from 'effector-react'
|
|
14
|
-
* import { getContent } from '@picked/react'
|
|
15
|
-
*
|
|
16
|
-
* const Banner = () => {
|
|
17
|
-
* const content = useUnit(getContent('lc_banner'))
|
|
18
|
-
* return <h1>{content?.data?.headline as string ?? ''}</h1>
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function getContent(id: string): Store<Content | null>;
|
|
23
|
-
//# sourceMappingURL=content.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/hooks/content.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAG7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAG5D"}
|
package/dist/hooks/content.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{usePicked as e}from"./client.js";function t(t){return e().contents.getById(t)}export{t as getContent};
|