@picked/react 0.0.1-dev.1777513622441 → 0.0.1-dev.1777530309364

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.
@@ -9,5 +9,4 @@ 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
- export { useAction, useActionResult } from './action';
13
12
  //# 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,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"}
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"}
@@ -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{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};
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{useFeature as o,useFeatureResult as s}from"./feature.js";import{getField as c}from"./field.js";import{useSetStepContext as l,useStep as u}from"./step.js";import{useLocalStorage as d,useSessionStorage as f}from"./storage.js";export{e as ClientContext,t as ClientProvider,n as ExperienceContext,r as ExperienceProvider,c as getField,i as useExperience,o as useFeature,s as useFeatureResult,d as useLocalStorage,a as usePicked,f as useSessionStorage,l as useSetStepContext,u as useStep};
@@ -14,9 +14,8 @@ export interface ReactFrameworkPluginOptions {
14
14
  * This plugin registers the React framework and allows rendering React components
15
15
  * with the client's experience data.
16
16
  *
17
- * @param {ReactFrameworkPluginOptions} options - Configuration options for the React plugin
17
+ * @param {ReactFrameworkPluginOptions} options - Configuration options for the React plugin.
18
18
  * @returns {Plugin} The plugin.
19
- *
20
19
  * @example
21
20
  * ```typescript
22
21
  * createClient({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/framework/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAU,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAChG,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAG9E,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACrC,MAAM,CACJ,MAAM,mBAAmB,EACzB;IAAE,SAAS,EAAE,kBAAkB,CAAC;IAAC,KAAK,CAAC,EAAE,qBAAqB,CAAA;CAAE,CACjE,CACF,CAAA;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,iBAAiB,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,2BAA2B,KAAG,MAuB3E,CAAA"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugins/framework/plugin.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAU,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAChG,OAAO,EAAuB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAG9E,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACrC,MAAM,CACJ,MAAM,mBAAmB,EACzB;IAAE,SAAS,EAAE,kBAAkB,CAAC;IAAC,KAAK,CAAC,EAAE,qBAAqB,CAAA;CAAE,CACjE,CACF,CAAA;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,iBAAiB,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,GAAI,SAAS,2BAA2B,KAAG,MAwB3E,CAAA"}
@@ -1 +1 @@
1
- import{adaptReactComponent as e}from"../../component.js";import{renderReactComponent as t}from"../../render/browser.js";var n=n=>({name:`react-framework`,setup:r=>{r.registerFramework({name:`react`,render(...e){return t(...e,{stylesheets:n.stylesheets,css:n.css})}});let i=n.components.experience;i&&r.registerComponent(`experience`,e(i.component,i.style))}});export{n as reactFrameworkPlugin};
1
+ import{adaptReactComponent as e}from"../../component.js";import{renderReactComponent as t,unRenderReactComponent as n}from"../../render/browser.js";var r=r=>({name:`react-framework`,setup:i=>{i.registerFramework({name:`react`,render(...e){return t(...e,{stylesheets:r.stylesheets,css:r.css})},unRender:n});let a=r.components.experience;a&&i.registerComponent(`experience`,e(a.component,a.style))}});export{r as reactFrameworkPlugin};
@@ -3,5 +3,5 @@ export declare const renderReactComponent: (shadowRoot: ShadowRoot, component: A
3
3
  stylesheets?: string[];
4
4
  css?: string[];
5
5
  }) => Promise<void>;
6
- export declare const unRenderReactComponent: (target: Element) => void;
6
+ export declare const unRenderReactComponent: (shadowRoot: ShadowRoot) => void;
7
7
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/render/browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AASlF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,EACtB,WAAW,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5C,QAAQ,MAAM,EACd,YAAY,kBAAkB,EAC9B,SAAS;IACP,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf,kBA0DF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,QAAQ,OAAO,SAMrD,CAAA"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../src/render/browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AASlF,eAAO,MAAM,oBAAoB,GAC/B,YAAY,UAAU,EACtB,WAAW,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5C,QAAQ,MAAM,EACd,YAAY,kBAAkB,EAC9B,SAAS;IACP,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf,kBA0DF,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU,SAM5D,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/react",
3
- "version": "0.0.1-dev.1777513622441",
3
+ "version": "0.0.1-dev.1777530309364",
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.1777513622441",
88
+ "@picked/client": "0.0.1-dev.1777530309364",
89
89
  "effector": "^23.3.0",
90
90
  "effector-react": "^23.3.0",
91
91
  "react": "19.2.2",
@@ -1,36 +0,0 @@
1
- import { Action, ExperienceInstance } from '@picked/client';
2
- type ActionResult = string | string[] | boolean | void | undefined;
3
- /**
4
- * Returns the current evokable action function, reactive to store updates.
5
- * When `options.experience` is provided, the wrapped call passes that
6
- * experience as the action's context so manually-invoked handlers can
7
- * behave as if they were triggered by that experience — for example, to
8
- * call `context.experience.close()` after a submit.
9
- *
10
- * @param {string} actionKey - The registered action key.
11
- * @param {object} [options] - Optional invocation overrides.
12
- * @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
13
- * @returns {() => ReturnType<Action>} The callable action function.
14
- * @example
15
- * const evoke = useAction('log-event')
16
- * const bound = useAction('submit-form', { experience: useExperience() })
17
- */
18
- export declare function useAction(actionKey: string, options?: {
19
- experience: ExperienceInstance;
20
- }): () => ReturnType<Action>;
21
- /**
22
- * Returns the latest result of invoking the keyed action, reactive to store updates.
23
- * Re-evaluates whenever the underlying evokable store emits.
24
- *
25
- * @param {string} actionKey - The registered action key.
26
- * @param {object} [options] - Optional invocation overrides.
27
- * @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
28
- * @returns {ActionResult} The latest action return value.
29
- * @example
30
- * const result = useActionResult('is-logged-in')
31
- */
32
- export declare function useActionResult(actionKey: string, options?: {
33
- experience: ExperienceInstance;
34
- }): ActionResult;
35
- export {};
36
- //# sourceMappingURL=action.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/hooks/action.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAKhE,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AAElE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,UAAU,EAAE,kBAAkB,CAAA;CAAE,GAC3C,MAAM,UAAU,CAAC,MAAM,CAAC,CAG1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,UAAU,EAAE,kBAAkB,CAAA;CAAE,GAC3C,YAAY,CAmCd"}
@@ -1 +0,0 @@
1
- import{usePicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";import{useUnit as o}from"effector-react";function s(t,n){return o(e().actions.getEvokableAction(t,n))}function c(s,c){let l=e().actions.getEvokableAction(s,c),u=i(void 0,{skipVoid:!1}),d=r(),f=t({source:l,mapParams:(e,t)=>t,effect:n(async e=>{if(e)return await e()})});return a({clock:d,target:f}),a({clock:f.doneData,target:u}),d(),a({clock:l,target:d}),o(u)}export{s as useAction,c as useActionResult};