@picked/svelte 0.0.38 → 0.0.39-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.
@@ -1 +1 @@
1
- import{getContext as t}from"svelte";import{CLIENT_CONTEXT_KEY as e,EXPERIENCE_CONTEXT_KEY as r}from"../context.js";function o(){return t(e)}function i(){return t(r)}export{i as getExperience,o as getPicked};
1
+ import{getContext as t}from"svelte";import{EXPERIENCE_CONTEXT_KEY as e,CLIENT_CONTEXT_KEY as r}from"../context.js";function o(){return t(r)}function i(){return t(e)}export{i as getExperience,o as getPicked};
@@ -1 +1 @@
1
- import{writable as b}from"svelte/store";import{supportsSessionStorage as m,supportsLocalStorage as d,createStorageKey as x,sessionStore as y,localStore as k}from"@picked/client";import{getExperience as K}from"./client.js";const L={fallback:null,scope:"global"};function a(e,t,i){const{fallback:l,scope:u}={...L,...i},s=e==="session"?y:k,p=e==="session"?m:d,o=b(l);if(p()){const S=K(),r=x(t,u,S),c=s.get(r).text();c!==null&&o.set(c),o.subscribe(n=>{n?s.set(r,n):s.remove(r)});const f=n=>{o.set(n.text())},g=s.subscribe(r,f);return{...o,destroy:()=>{g()}}}return{...o,destroy:()=>{}}}function I(e,t){return a("session",e,t)}function O(e,t){return a("local",e,t)}export{O as createLocalStorageStore,I as createSessionStorageStore};
1
+ import{writable as b}from"svelte/store";import{createStorageKey as m,sessionStore as d,localStore as x,supportsSessionStorage as y,supportsLocalStorage as k}from"@picked/client";import{getExperience as K}from"./client.js";const L={fallback:null,scope:"global"};function a(e,t,i){const{fallback:l,scope:u}={...L,...i},s=e==="session"?d:x,p=e==="session"?y:k,o=b(l);if(p()){const S=K(),r=m(t,u,S),c=s.get(r).text();c!==null&&o.set(c),o.subscribe(n=>{n?s.set(r,n):s.remove(r)});const f=n=>{o.set(n.text())},g=s.subscribe(r,f);return{...o,destroy:()=>{g()}}}return{...o,destroy:()=>{}}}function I(e,t){return a("session",e,t)}function O(e,t){return a("local",e,t)}export{O as createLocalStorageStore,I as createSessionStorageStore};
@@ -1 +1 @@
1
- import{getContext as f,setContext as s}from"svelte";import{is as r,scopeBind as n,createWatch as p,fork as m}from"effector";import{SCOPE_CONTEXT_KEY as c}from"../context.js";const g=e=>{const t=m(e);return s(c,t)},C=()=>f(c);function u(e){const t=C();return t?r.effect(e)?n(e,{scope:t}):r.event(e)&&typeof e=="function"?n(e,{scope:t}):{subscribe:o=>(o(t.getState(e)),p({unit:e,fn:o,scope:t}))}:e}export{C as getContextScope,g as setContextScope,u as useUnit};
1
+ import{getContext as f,setContext as s}from"svelte";import{fork as p,is as r,scopeBind as n,createWatch as m}from"effector";import{SCOPE_CONTEXT_KEY as c}from"../context.js";const g=e=>{const t=p(e);return s(c,t)},C=()=>f(c);function u(e){const t=C();return t?r.effect(e)?n(e,{scope:t}):r.event(e)&&typeof e=="function"?n(e,{scope:t}):{subscribe:o=>(o(t.getState(e)),m({unit:e,fn:o,scope:t}))}:e}export{C as getContextScope,g as setContextScope,u as useUnit};
@@ -1,12 +1,26 @@
1
1
  import { AdaptedComponent, ExperienceInstance, Picked } from '@picked/client';
2
+ /**
3
+ * Result of server-side rendering a Svelte component.
4
+ * Matches svelte/server's RenderOutput with additional stylesheet/css arrays.
5
+ */
6
+ export interface StaticRenderResult {
7
+ /** Stylesheets to include in the document */
8
+ stylesheets: string[];
9
+ /** Inline CSS to include in the document */
10
+ css: string[];
11
+ /** HTML that goes into the `<head>` */
12
+ head: string;
13
+ /** @deprecated use `body` instead */
14
+ html: string;
15
+ /** HTML that goes somewhere into the `<body>` */
16
+ body: string;
17
+ /** CSP hashes for inline scripts */
18
+ hashes: {
19
+ script: `sha256-${string}`[];
20
+ };
21
+ }
2
22
  export declare function createContext(client: Picked, experience: ExperienceInstance): Map<symbol, Picked | ExperienceInstance>;
3
23
  export declare const staticRenderSvelteComponent: (component: AdaptedComponent<string, unknown>, client: Picked, experience: ExperienceInstance, options: {
4
24
  stylesheets?: string[];
5
25
  css?: string[];
6
- }) => Promise<{
7
- head: string;
8
- html: string;
9
- body: string;
10
- stylesheets: string[];
11
- css: string[];
12
- }>;
26
+ }) => Promise<StaticRenderResult>;
@@ -1 +1 @@
1
- import{render as n}from"svelte/server";import{isValidAdaptedComponent as f}from"../component.js";import{CLIENT_CONTEXT_KEY as i,EXPERIENCE_CONTEXT_KEY as C}from"../context.js";import{mergeArrays as a}from"../utils/array.js";function m(t,s){return new Map([[i,t],[C,s]])}const T=async(t,s,r,o)=>{if(!f(t))throw new Error("The component is invalid.");const p=a(t.style?.sheets,o.stylesheets),E=a(t.style?.css,o.css);let e;if(t.component instanceof Promise){const{default:d}=await t.component;e=n(d,{props:{client:s,experience:r},context:m(s,r)})}else e=n(t.component,{props:{client:s,experience:r},context:m(s,r)});return{stylesheets:p,css:E,...e}};export{m as createContext,T as staticRenderSvelteComponent};
1
+ import{render as a}from"svelte/server";import{isValidAdaptedComponent as E}from"../component.js";import{CLIENT_CONTEXT_KEY as p,EXPERIENCE_CONTEXT_KEY as f}from"../context.js";import{mergeArrays as n}from"../utils/array.js";function d(t,s){return new Map([[p,t],[f,s]])}const C=async(t,s,e,o)=>{if(!E(t))throw new Error("The component is invalid.");const h=n(t.style?.sheets,o.stylesheets),m=n(t.style?.css,o.css),r=t.component instanceof Promise?a((await t.component).default,{props:{client:s,experience:e},context:d(s,e)}):a(t.component,{props:{client:s,experience:e},context:d(s,e)});return{stylesheets:h,css:m,head:r.head,html:r.html,body:r.body,hashes:r.hashes}};export{d as createContext,C as staticRenderSvelteComponent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/svelte",
3
- "version": "0.0.38",
3
+ "version": "0.0.39-next.2",
4
4
  "dependencies": {
5
5
  "d3": "^7.9.0"
6
6
  },
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "module": "./dist/index.js",
77
77
  "peerDependencies": {
78
- "@picked/client": "0.0.38",
78
+ "@picked/client": "0.0.39-next.2",
79
79
  "effector": "^23.3.0",
80
80
  "svelte": "^5.34.3"
81
81
  },