@picked/svelte 0.0.59 → 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
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};
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
const client = getPicked()
|
|
26
26
|
|
|
27
27
|
const dashboardProjectUrl = `${client.dashboardUrl}/p/${client.projectId}`
|
|
28
|
+
const isPreview = Boolean(client.searchParams['preview-token']?.[0])
|
|
28
29
|
|
|
29
30
|
const tabs = [
|
|
30
31
|
{
|
|
@@ -122,14 +123,19 @@
|
|
|
122
123
|
</div>
|
|
123
124
|
</div>
|
|
124
125
|
{:else}
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
<div class="launcher">
|
|
127
|
+
{#if isPreview}
|
|
128
|
+
<span class="preview-tag" role="status" aria-live="polite">Preview mode</span>
|
|
129
|
+
{/if}
|
|
130
|
+
<button
|
|
131
|
+
class="floating-button"
|
|
132
|
+
onclick={() => experience.open()}
|
|
133
|
+
aria-label="Open Picked Devtools"
|
|
134
|
+
title="Open Picked Devtools"
|
|
135
|
+
>
|
|
136
|
+
<PickedIcon height={25} width={25}/>
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
133
139
|
{/if}
|
|
134
140
|
|
|
135
141
|
<style>
|
|
@@ -307,16 +313,21 @@
|
|
|
307
313
|
padding-right: var(--space-4);
|
|
308
314
|
}
|
|
309
315
|
|
|
310
|
-
.
|
|
316
|
+
.launcher {
|
|
311
317
|
position: fixed;
|
|
312
318
|
bottom: 1rem;
|
|
313
319
|
right: 1.5rem;
|
|
314
|
-
|
|
315
|
-
|
|
320
|
+
z-index: 999999;
|
|
321
|
+
display: flex;
|
|
322
|
+
align-items: stretch;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.floating-button {
|
|
326
|
+
border-radius: 0 6px 6px 0;
|
|
327
|
+
background-color: #ffffff;
|
|
316
328
|
display: grid;
|
|
317
329
|
place-items: center;
|
|
318
330
|
cursor: pointer;
|
|
319
|
-
z-index: 999999;
|
|
320
331
|
border: 0 transparent;
|
|
321
332
|
padding: 6px;
|
|
322
333
|
box-shadow: 2px 2px 4px #00000029;
|
|
@@ -326,6 +337,21 @@
|
|
|
326
337
|
}
|
|
327
338
|
}
|
|
328
339
|
|
|
340
|
+
.preview-tag {
|
|
341
|
+
display: flex;
|
|
342
|
+
align-items: center;
|
|
343
|
+
padding: 0 10px;
|
|
344
|
+
background: #2563eb;
|
|
345
|
+
color: #ffffff;
|
|
346
|
+
border-radius: 6px 0 0 6px;
|
|
347
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
348
|
+
'Helvetica Neue', Arial, sans-serif;
|
|
349
|
+
font-size: 12px;
|
|
350
|
+
font-weight: 500;
|
|
351
|
+
line-height: 1.4;
|
|
352
|
+
box-shadow: 2px 2px 4px #00000029;
|
|
353
|
+
}
|
|
354
|
+
|
|
329
355
|
/** Compact inline form elements for use within table cells */
|
|
330
356
|
.devtools :global(.inline-select),
|
|
331
357
|
.devtools :global(.inline-input) {
|
|
@@ -2,7 +2,9 @@ import { Plugin } from '@picked/client';
|
|
|
2
2
|
export interface SvelteDevtoolsPluginOptions {
|
|
3
3
|
/**
|
|
4
4
|
* When `true`, the devtools experience launches automatically on page load.
|
|
5
|
-
* When `false`, devtools can only be opened via the Picked Chrome extension
|
|
5
|
+
* When `false`, devtools can only be opened via the Picked Chrome extension,
|
|
6
|
+
* **unless** a preview token is present — in which case the launcher always
|
|
7
|
+
* mounts so the previewed site remains inspectable in production builds.
|
|
6
8
|
*
|
|
7
9
|
* @default false
|
|
8
10
|
*/
|
|
@@ -12,8 +14,8 @@ export interface SvelteDevtoolsPluginOptions {
|
|
|
12
14
|
* Registers the devtools experience for on-demand loading via the Chrome DevTools extension.
|
|
13
15
|
* The devtools component is lazily loaded — it is never included in the initial bundle.
|
|
14
16
|
*
|
|
15
|
-
* @param options - Optional configuration for the devtools plugin.
|
|
16
|
-
* @returns An array of plugins to register with the Picked client.
|
|
17
|
+
* @param {SvelteDevtoolsPluginOptions} [options] - Optional configuration for the devtools plugin.
|
|
18
|
+
* @returns {Plugin[]} An array of plugins to register with the Picked client.
|
|
17
19
|
* @example
|
|
18
20
|
* ```typescript
|
|
19
21
|
* const client = new Picked({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptSvelteComponent as e}from"../../component.js";import{__vitePreload as t}from"../../_virtual/_vite/preload-helper.js";import{lazyComponent as n}from"@picked/client";import{createExperience as r,createExperiencePlugin as i}from"@picked/client/plugins/create-experience";var a=a=>{let o=r({id:`devtools`,key:`devtools`,name:`Picked Devtools`,condition:!1,initializeOpen:!1,targets:[{selector:`body`,placement:`append`}],component:e(n(()=>t(()=>import(`./DevToolsExperience.svelte`),[])))});return o.addStep({name:`Tools`}),[{name:`svelte-devtools`,setup:e=>{a?.enabled
|
|
1
|
+
import{adaptSvelteComponent as e}from"../../component.js";import{__vitePreload as t}from"../../_virtual/_vite/preload-helper.js";import{lazyComponent as n}from"@picked/client";import{createExperience as r,createExperiencePlugin as i}from"@picked/client/plugins/create-experience";var a=a=>{let o=r({id:`devtools`,key:`devtools`,name:`Picked Devtools`,condition:!1,initializeOpen:!1,targets:[{selector:`body`,placement:`append`}],component:e(n(()=>t(()=>import(`./DevToolsExperience.svelte`),[])))});return o.addStep({name:`Tools`}),[{name:`svelte-devtools`,setup:e=>{let t=!!e.searchParams[`preview-token`]?.[0];!a?.enabled&&!t||e.eventBus.watch(t=>{t.type===`ready`&&e.experiences.launch({key:o.key,options:{bypassCondition:!0}})})}},i({experiences:[o]})]};export{a as svelteDevtoolsPlugin};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.
|
|
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.
|
|
91
|
+
"@picked/client": "0.0.60-next.2",
|
|
92
92
|
"effector": "^23.3.0",
|
|
93
93
|
"svelte": "^5.46.4"
|
|
94
94
|
},
|