@histoire/plugin-svelte
Version:
Histoire plugin for Svelte support
2 lines (1 loc) • 507 B
JavaScript
import{watch as u}from"@histoire/vendors/vue";import{clone as r,applyState as s}from"@histoire/shared";function f(n){const i={};for(const t in n){if(t==="Hst")continue;const e=n[t];typeof e!="function"&&(typeof e>"u"||e instanceof HTMLElement||typeof e=="object"&&(e!=null&&e.$$)||(i[t]=e))}return i}function y(n,i){let t=!1;const e=u(()=>n,o=>{o!=null&&(t?t=!1:(t=!0,i(f(o))))},{deep:!0,immediate:!0});function c(o){o!=null&&(t?t=!1:(t=!0,s(n,r(f(o)))))}return{apply:c,stop(){e()}}}export{y as syncState};