@picked/svelte 0.0.60-next.1 → 0.0.60-next.2
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/action.d.ts +17 -3
- package/dist/hooks/action.js +1 -1
- package/package.json +2 -2
package/dist/hooks/action.d.ts
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
import { Action } from '@picked/client';
|
|
1
|
+
import { Action, ExperienceInstance } from '@picked/client';
|
|
2
2
|
import { Store } from 'effector';
|
|
3
3
|
/**
|
|
4
4
|
* Returns the reactive evokable action store for the given action key.
|
|
5
5
|
*
|
|
6
|
+
* When `options.experience` is provided, the wrapped call passes that
|
|
7
|
+
* experience as the action's context, so manually-invoked handlers can
|
|
8
|
+
* behave as if they were triggered by that experience — for example to
|
|
9
|
+
* call `context.experience.close()` after a submit.
|
|
10
|
+
*
|
|
6
11
|
* @param {string} actionKey - The registered action key.
|
|
12
|
+
* @param {object} [options] - Optional invocation overrides.
|
|
13
|
+
* @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
|
|
7
14
|
* @returns {Store<() => ReturnType<Action>>} A store containing the callable action function or undefined.
|
|
8
15
|
* @example
|
|
9
16
|
* ```ts
|
|
10
17
|
* const actionStore = getAction('log-event')
|
|
18
|
+
* const bound = getAction('submit-form', { experience: getExperience() })
|
|
11
19
|
* ```
|
|
12
20
|
*/
|
|
13
|
-
export declare function getAction(actionKey: string
|
|
21
|
+
export declare function getAction(actionKey: string, options?: {
|
|
22
|
+
experience: ExperienceInstance;
|
|
23
|
+
}): Store<() => ReturnType<Action>>;
|
|
14
24
|
/**
|
|
15
25
|
* Returns a reactive store holding the latest result of invoking the keyed action.
|
|
16
26
|
* Re-evaluates automatically when the underlying action store updates.
|
|
17
27
|
*
|
|
18
28
|
* @param {string} actionKey - The registered action key.
|
|
29
|
+
* @param {object} [options] - Optional invocation overrides.
|
|
30
|
+
* @param {ExperienceInstance} options.experience - Experience to bind as the action's context.
|
|
19
31
|
* @returns {Store<string | string[] | boolean | void | undefined>} A store containing the latest action return value.
|
|
20
32
|
* @example
|
|
21
33
|
* ```ts
|
|
22
34
|
* const result = getActionResult('is-logged-in')
|
|
23
35
|
* ```
|
|
24
36
|
*/
|
|
25
|
-
export declare function getActionResult(actionKey: string
|
|
37
|
+
export declare function getActionResult(actionKey: string, options?: {
|
|
38
|
+
experience: ExperienceInstance;
|
|
39
|
+
}): import('effector').StoreWritable<string | boolean | void | string[] | undefined>;
|
package/dist/hooks/action.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";import"@picked/client";function o(t){return e().actions.getEvokableAction(t)}function s(e){let
|
|
1
|
+
import{getPicked as e}from"./client.js";import{attach as t,createEffect as n,createEvent as r,createStore as i,sample as a}from"effector";import"@picked/client";function o(t,n){return e().actions.getEvokableAction(t,n)}function s(e,s){let c=o(e,s),l=i(void 0,{skipVoid:!1}),u=r(),d=t({source:c,mapParams:(e,t)=>t,effect:n(async e=>{if(e)return await e()})});return a({clock:u,target:d}),a({clock:d.doneData,target:l}),u(),a({clock:c,target:u}),l}export{o as getAction,s as getActionResult};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.60-next.
|
|
3
|
+
"version": "0.0.60-next.2",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"module": "./dist/index.js",
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@picked/client": "0.0.60-next.
|
|
91
|
+
"@picked/client": "0.0.60-next.2",
|
|
92
92
|
"effector": "^23.3.0",
|
|
93
93
|
"svelte": "^5.46.4"
|
|
94
94
|
},
|