@poveste/plugin-svelte 0.1.2 → 0.2.0
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/client/MountStory.js +1 -1
- package/dist/client/MountStory.svelte +3 -3
- package/dist/client/MountVariant.js +1 -1
- package/dist/client/MountVariant.svelte +3 -3
- package/dist/client/RenderStory.js +1 -1
- package/dist/client/RenderStory.svelte +4 -4
- package/dist/client/RenderVariant.js +1 -1
- package/dist/client/RenderVariant.svelte +4 -4
- package/dist/client/mount.js +1 -1
- package/dist/client/render.js +1 -1
- package/dist/collect/Story.js +1 -1
- package/dist/collect/Story.svelte +4 -4
- package/dist/collect/Variant.js +1 -1
- package/dist/collect/Variant.svelte +2 -2
- package/dist/collect/index.js +1 -1
- package/package.json +6 -6
- package/src/client/MountStory.svelte +3 -3
- package/src/client/MountVariant.svelte +3 -3
- package/src/client/RenderStory.svelte +4 -4
- package/src/client/RenderVariant.svelte +4 -4
- package/src/client/mount.ts +1 -1
- package/src/client/render.ts +3 -3
- package/src/collect/Story.svelte +4 -4
- package/src/collect/Variant.svelte +2 -2
- package/src/collect/index.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./MountVariant.svelte";import{getContext as t,setContext as n}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as r from"svelte/internal/client";import{omitInheritStoryProps as i}from"@poveste/shared";function a(a,o){let s=r.sanitize_slots(o),c=r.legacy_rest_props(o,[`children`,`$$slots`,`$$events`,`$$legacy`]),l=r.legacy_rest_props(c,[]);r.push(o,!1);let u=r.mutable_source(),d=t(`
|
|
1
|
+
import e from"./MountVariant.svelte";import{getContext as t,setContext as n}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as r from"svelte/internal/client";import{omitInheritStoryProps as i}from"@poveste/shared";function a(a,o){let s=r.sanitize_slots(o),c=r.legacy_rest_props(o,[`children`,`$$slots`,`$$events`,`$$legacy`]),l=r.legacy_rest_props(c,[]);r.push(o,!1);let u=r.mutable_source(),d=t(`__pvtStory`);n(`__pvtIndex`,{value:0}),n(`__pvtSlots`,s),r.legacy_pre_effect(()=>i,()=>{r.set(u,Object.keys(d).filter(e=>!i.includes(e)).reduce((e,t)=>(e[t]=d[t],e),{}))}),r.legacy_pre_effect_reset(),r.init();var f=r.comment(),p=r.first_child(f),m=t=>{e(t,r.spread_props(()=>r.get(u),()=>l,{implicit:!0,children:(e,t)=>{var n=r.comment(),i=r.first_child(n);r.slot(i,o,`default`,{},null),r.append(e,n)},$$slots:{default:!0,controls:(e,t)=>{var n=r.comment(),i=r.first_child(n);r.slot(i,o,`controls`,{},null),r.append(e,n)}}}))},h=e=>{var t=r.comment(),n=r.first_child(t);r.slot(n,o,`default`,{},null),r.append(e,t)};r.if(p,e=>{r.untrack(()=>d.variants.length===1&&d.variants[0].id===`_default`)?e(m):e(h,-1)}),r.append(a,f),r.pop()}export{a as default};
|
|
@@ -3,10 +3,10 @@ import { omitInheritStoryProps } from '@poveste/shared'
|
|
|
3
3
|
import { getContext, setContext } from 'svelte'
|
|
4
4
|
import MountVariant from './MountVariant.svelte'
|
|
5
5
|
|
|
6
|
-
const story = getContext('
|
|
6
|
+
const story = getContext('__pvtStory')
|
|
7
7
|
let index = { value: 0 }
|
|
8
|
-
setContext('
|
|
9
|
-
setContext('
|
|
8
|
+
setContext('__pvtIndex', index)
|
|
9
|
+
setContext('__pvtSlots', $$slots)
|
|
10
10
|
|
|
11
11
|
$: inheritedFromStory = Object.keys(story).filter(key => !omitInheritStoryProps.includes(key)).reduce((acc, key) => {
|
|
12
12
|
acc[key] = story[key]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{afterUpdate as e,getContext as t}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as n from"svelte/internal/client";n.from_html(`<!> <!>`,1);function r(r,i){let a=n.sanitize_slots(i);n.push(i,!1);let o=n.prop(i,`source`,8,null),s=n.prop(i,`responsiveDisabled`,8,!1),c=n.prop(i,`autoPropsDisabled`,8,!1),l=n.prop(i,`setupApp`,8,null),u=n.prop(i,`implicit`,8,!1),d=t(`
|
|
1
|
+
import{afterUpdate as e,getContext as t}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as n from"svelte/internal/client";n.from_html(`<!> <!>`,1);function r(r,i){let a=n.sanitize_slots(i);n.push(i,!1);let o=n.prop(i,`source`,8,null),s=n.prop(i,`responsiveDisabled`,8,!1),c=n.prop(i,`autoPropsDisabled`,8,!1),l=n.prop(i,`setupApp`,8,null),u=n.prop(i,`implicit`,8,!1),d=t(`__pvtStory`),f=t(`__pvtIndex`),p=t(`__pvtSlots`),m=d.variants[f.value];f.value++;function h(){Object.assign(m,{slots:()=>({default:!0,controls:a.controls??p.controls}),source:o(),responsiveDisabled:s(),autoPropsDisabled:c(),setupApp:l(),configReady:!0}),!u()&&!d.meta?.hasVariantChildComponents&&(d.meta=d.meta||{},Object.assign(d.meta,{hasVariantChildComponents:!0}))}h(),e(()=>{h()}),n.init();var g=n.comment(),_=n.first_child(g);n.if(_,e=>{}),n.append(r,g),n.pop()}export{r as default};
|
|
@@ -7,9 +7,9 @@ export let autoPropsDisabled = false
|
|
|
7
7
|
export let setupApp = null
|
|
8
8
|
export let implicit = false
|
|
9
9
|
|
|
10
|
-
const story = getContext('
|
|
11
|
-
const index = getContext('
|
|
12
|
-
const storySlots = getContext('
|
|
10
|
+
const story = getContext('__pvtStory')
|
|
11
|
+
const index = getContext('__pvtIndex')
|
|
12
|
+
const storySlots = getContext('__pvtSlots')
|
|
13
13
|
|
|
14
14
|
const variant = story.variants[index.value]
|
|
15
15
|
index.value++
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getContext as e,setContext as t}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as n from"svelte/internal/client";var r=n.from_html(`<!> <!>`,1);function i(i,a){n.push(a,!1);let o=e(`
|
|
1
|
+
import{getContext as e,setContext as t}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as n from"svelte/internal/client";var r=n.from_html(`<!> <!>`,1);function i(i,a){n.push(a,!1);let o=e(`__pvtStory`),s=e(`__pvtVariant`),c=e(`__pvtSlot`);t(`__pvtIndex`,{value:0});let l=n.prop(a,`source`,8,null);n.legacy_pre_effect(()=>n.deep_read_state(l()),()=>{l()!=null&&Object.assign(s,{source:l()})}),n.legacy_pre_effect_reset(),n.init();var u=r(),d=n.first_child(u),f=e=>{var t=n.comment(),r=n.first_child(t);n.slot(r,a,`controls`,{},null),n.append(e,t)};n.if(d,e=>{c===`controls`&&e(f)});var p=n.sibling(d,2),m=e=>{var t=n.comment(),r=n.first_child(t);n.slot(r,a,`default`,{},null),n.append(e,t)};n.if(p,e=>{n.untrack(()=>c===`default`||o.meta?.hasVariantChildComponents)&&e(m)}),n.append(i,u),n.pop()}export{i as default};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext, setContext } from 'svelte'
|
|
3
3
|
|
|
4
|
-
const story = getContext('
|
|
5
|
-
const currentVariant = getContext('
|
|
6
|
-
const slotName = getContext('
|
|
4
|
+
const story = getContext('__pvtStory')
|
|
5
|
+
const currentVariant = getContext('__pvtVariant')
|
|
6
|
+
const slotName = getContext('__pvtSlot')
|
|
7
7
|
|
|
8
8
|
let index = { value: 0 }
|
|
9
|
-
setContext('
|
|
9
|
+
setContext('__pvtIndex', index)
|
|
10
10
|
|
|
11
11
|
export let source = null
|
|
12
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getContext as e}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as t from"svelte/internal/client";var n=t.from_html(`<!> <!>`,1);function r(r,i){t.push(i,!1);let a=t.mutable_source(),o=e(`
|
|
1
|
+
import{getContext as e}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as t from"svelte/internal/client";var n=t.from_html(`<!> <!>`,1);function r(r,i){t.push(i,!1);let a=t.mutable_source(),o=e(`__pvtStory`),s=e(`__pvtVariant`),c=e(`__pvtSlot`),l=e(`__pvtIndex`),u=o.variants[l.value];l.value++;let d=t.prop(i,`source`,8,null);t.legacy_pre_effect(()=>{},()=>{t.set(a,s.id===u.id)}),t.legacy_pre_effect(()=>t.deep_read_state(d()),()=>{d()!=null&&Object.assign(s,{source:d()})}),t.legacy_pre_effect_reset(),t.init();var f=t.comment(),p=t.first_child(f),m=e=>{var r=n(),a=t.first_child(r),o=e=>{var n=t.comment(),r=t.first_child(n);t.slot(r,i,`default`,{},null),t.append(e,n)};t.if(a,e=>{c===`default`&&e(o)});var s=t.sibling(a,2),l=e=>{var n=t.comment(),r=t.first_child(n);t.slot(r,i,`controls`,{},null),t.append(e,n)};t.if(s,e=>{c===`controls`&&e(l)}),t.append(e,r)};t.if(p,e=>{t.get(a)&&e(m)}),t.append(r,f),t.pop()}export{r as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from 'svelte'
|
|
3
3
|
|
|
4
|
-
const story = getContext('
|
|
5
|
-
const currentVariant = getContext('
|
|
6
|
-
const slotName = getContext('
|
|
7
|
-
const index = getContext('
|
|
4
|
+
const story = getContext('__pvtStory')
|
|
5
|
+
const currentVariant = getContext('__pvtVariant')
|
|
6
|
+
const slotName = getContext('__pvtSlot')
|
|
7
|
+
const index = getContext('__pvtIndex')
|
|
8
8
|
|
|
9
9
|
const variant = story.variants[index.value]
|
|
10
10
|
index.value++
|
package/dist/client/mount.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callSetupFunctions as e,mountSvelteComponent as t}from"../util/svelte.js";import n from"./MountVariant.svelte";import r from"./MountStory.svelte";import i from"./Stub.svelte";import{components as a}from"@poveste/controls";import{defineComponent as o,h as s,onMounted as c,onUnmounted as l,ref as u,watch as d}from"@poveste/vendors/vue";import*as f from"virtual:$poveste-generated-global-setup";import*as p from"virtual:$poveste-setup";var m=o({name:`MountStory`,props:{story:{type:Object,required:!0}},setup(i){let a=u(),o,s,m=null;async function g(){s=document.createElement(`div`),a.value.appendChild(s);let c=await t(i.story.file.component,{target:s,props:{Hst:{Story:r,Variant:n,...h()}},context:new Map(Object.entries({
|
|
1
|
+
import{callSetupFunctions as e,mountSvelteComponent as t}from"../util/svelte.js";import n from"./MountVariant.svelte";import r from"./MountStory.svelte";import i from"./Stub.svelte";import{components as a}from"@poveste/controls";import{defineComponent as o,h as s,onMounted as c,onUnmounted as l,ref as u,watch as d}from"@poveste/vendors/vue";import*as f from"virtual:$poveste-generated-global-setup";import*as p from"virtual:$poveste-setup";var m=o({name:`MountStory`,props:{story:{type:Object,required:!0}},setup(i){let a=u(),o,s,m=null;async function g(){s=document.createElement(`div`),a.value.appendChild(s);let c=await t(i.story.file.component,{target:s,props:{Hst:{Story:r,Variant:n,...h()}},context:new Map(Object.entries({__pvtStory:i.story}))},`client`);o=c.app,m=c.destroy,await e(f,p,{app:o,story:i.story,variant:null})}function _(){m?.(),m=null,s&&=(s.parentNode?.removeChild(s),null),o=null}return d(()=>i.story.id,async()=>{_(),await g()}),c(async()=>{await g()}),l(()=>{_()}),{el:a}},render(){return s(`div`,{ref:`el`})}});function h(){let e={};for(let t in a)e[t.substring(3)]=i;return e}export{m as default};
|
package/dist/client/render.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callSetupFunctions as e,createWrappedComponent as t,getLegacyStateApi as n,mountSvelteComponent as r}from"../util/svelte.js";import i from"./RenderStory.svelte";import a from"./RenderVariant.svelte";import{syncState as o}from"./util.js";import s from"./Wrap.svelte";import{components as c}from"@poveste/controls";import{defineComponent as l,h as u,onMounted as d,onUnmounted as f,ref as p,watch as m}from"@poveste/vendors/vue";import*as h from"virtual:$poveste-generated-global-setup";import*as g from"virtual:$poveste-setup";var _=l({name:`RenderStory`,props:{variant:{type:Object,required:!0},story:{type:Object,required:!0},slotName:{type:String,default:`default`}},setup(t,{emit:s}){let c=p(),l,u,_=[];function y(e,t){document.addEventListener(e,t);let n=()=>document.removeEventListener(e,t);return _.push(n),{off:n}}async function b(){u=document.createElement(`div`),c.value.appendChild(u);let d=[],{off:f}=y(`SvelteRegisterComponent`,e=>{let{component:t}=e.detail;d.push(t)}),p=await r(t.story.file.component,{target:u,props:{Hst:{Story:i,Variant:a,...v()}},context:new Map(Object.entries({
|
|
1
|
+
import{callSetupFunctions as e,createWrappedComponent as t,getLegacyStateApi as n,mountSvelteComponent as r}from"../util/svelte.js";import i from"./RenderStory.svelte";import a from"./RenderVariant.svelte";import{syncState as o}from"./util.js";import s from"./Wrap.svelte";import{components as c}from"@poveste/controls";import{defineComponent as l,h as u,onMounted as d,onUnmounted as f,ref as p,watch as m}from"@poveste/vendors/vue";import*as h from"virtual:$poveste-generated-global-setup";import*as g from"virtual:$poveste-setup";var _=l({name:`RenderStory`,props:{variant:{type:Object,required:!0},story:{type:Object,required:!0},slotName:{type:String,default:`default`}},setup(t,{emit:s}){let c=p(),l,u,_=[];function y(e,t){document.addEventListener(e,t);let n=()=>document.removeEventListener(e,t);return _.push(n),{off:n}}async function b(){u=document.createElement(`div`),c.value.appendChild(u);let d=[],{off:f}=y(`SvelteRegisterComponent`,e=>{let{component:t}=e.detail;d.push(t)}),p=await r(t.story.file.component,{target:u,props:{Hst:{Story:i,Variant:a,...v()}},context:new Map(Object.entries({__pvtStory:t.story,__pvtVariant:t.variant,__pvtSlot:t.slotName}))},`client`);l=p.app,_.push(()=>{p.destroy()});let m=d.find(e=>e.$$&&l?.$$&&e.$$===l.$$)??l;f(),d=[];function b(){let e=m?.$replace;e&&(m.$replace=(...t)=>{let n=e.apply(m,t);return m=n??m,n})}b();let x=n(m);if(x){let{apply:e,stop:n}=o(t.variant.state,e=>{x.injectState(e)});_.push(n);let r,i=()=>{e(x.captureState()),r=requestAnimationFrame(i)};r=requestAnimationFrame(i),_.push(()=>{cancelAnimationFrame(r)}),e(x.captureState())}await e(h,g,{app:l,story:t.story,variant:t.variant},t.variant.setupApp),s(`ready`)}function x(){_.forEach(e=>e()),_=[],u&&=(u.parentNode?.removeChild(u),null),l=null}return m(()=>t.story.id,async()=>{x(),await b()}),d(async()=>{await b()}),f(()=>{x()}),{el:c}},render(){return u(`div`,{ref:`el`})}});function v(){let e={};for(let t in c)e[t.substring(3)]=y(c[t]);return e}function y(e){return t(s,e)}export{_ as default};
|
package/dist/collect/Story.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getContext as e,setContext as t}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as n from"svelte/internal/client";function r(r,i){n.push(i,!1);let a=n.prop(i,`title`,8,null),o=n.prop(i,`id`,8,null),s=n.prop(i,`group`,8,null),c=n.prop(i,`layout`,8,null),l=n.prop(i,`icon`,8,null),u=n.prop(i,`iconColor`,8,null),d=n.prop(i,`docsOnly`,8,!1),f=e(`
|
|
1
|
+
import{getContext as e,setContext as t}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as n from"svelte/internal/client";function r(r,i){n.push(i,!1);let a=n.prop(i,`title`,8,null),o=n.prop(i,`id`,8,null),s=n.prop(i,`group`,8,null),c=n.prop(i,`layout`,8,null),l=n.prop(i,`icon`,8,null),u=n.prop(i,`iconColor`,8,null),d=n.prop(i,`docsOnly`,8,!1),f=e(`__pvtAddStory`),p=e(`__pvtStoryFile`),m={id:o()??p.id,title:a()??p.fileName,group:s(),layout:c(),icon:l(),iconColor:u(),docsOnly:d(),variants:[]};f(m),t(`__pvtStory`,m),t(`__pvtAddVariant`,e=>{m.variants.push(e)}),n.init();var h=n.comment(),g=n.first_child(h);n.slot(g,i,`default`,{},null),n.append(r,h),n.pop()}export{r as default};
|
|
@@ -9,8 +9,8 @@ export let icon = null
|
|
|
9
9
|
export let iconColor = null
|
|
10
10
|
export let docsOnly = false
|
|
11
11
|
|
|
12
|
-
const addStory = getContext('
|
|
13
|
-
const file = getContext('
|
|
12
|
+
const addStory = getContext('__pvtAddStory')
|
|
13
|
+
const file = getContext('__pvtStoryFile')
|
|
14
14
|
|
|
15
15
|
const story = {
|
|
16
16
|
id: id ?? file.id,
|
|
@@ -25,8 +25,8 @@ const story = {
|
|
|
25
25
|
|
|
26
26
|
addStory(story)
|
|
27
27
|
|
|
28
|
-
setContext('
|
|
29
|
-
setContext('
|
|
28
|
+
setContext('__pvtStory', story)
|
|
29
|
+
setContext('__pvtAddVariant', (variant) => {
|
|
30
30
|
story.variants.push(variant)
|
|
31
31
|
})
|
|
32
32
|
</script>
|
package/dist/collect/Variant.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getContext as e}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as t from"svelte/internal/client";function n(n,r){t.push(r,!1);let i=t.prop(r,`title`,8,`untitled`),a=t.prop(r,`id`,8,null),o=t.prop(r,`icon`,8,null),s=t.prop(r,`iconColor`,8,null),c=e(`
|
|
1
|
+
import{getContext as e}from"svelte";import"svelte/internal/disclose-version";import"svelte/internal/flags/legacy";import*as t from"svelte/internal/client";function n(n,r){t.push(r,!1);let i=t.prop(r,`title`,8,`untitled`),a=t.prop(r,`id`,8,null),o=t.prop(r,`icon`,8,null),s=t.prop(r,`iconColor`,8,null),c=e(`__pvtStory`),l=e(`__pvtAddVariant`);function u(){return`${c.id}-${c.variants.length}`}l({id:a()??u(),title:i(),icon:o(),iconColor:s()}),t.init(),t.pop()}export{n as default};
|
|
@@ -6,8 +6,8 @@ export let id = null
|
|
|
6
6
|
export let icon = null
|
|
7
7
|
export let iconColor = null
|
|
8
8
|
|
|
9
|
-
const story = getContext('
|
|
10
|
-
const addVariant = getContext('
|
|
9
|
+
const story = getContext('__pvtStory')
|
|
10
|
+
const addVariant = getContext('__pvtAddVariant')
|
|
11
11
|
|
|
12
12
|
function generateId () {
|
|
13
13
|
return `${story.id}-${story.variants.length}`
|
package/dist/collect/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callSetupFunctions as e,mountSvelteComponent as t}from"../util/svelte.js";import n from"./Story.svelte";import r from"./Variant.svelte";import*as i from"virtual:$poveste-generated-global-setup";import*as a from"virtual:$poveste-setup";import{tick as o}from"svelte";async function s({file:s,el:c,storyData:l}){let{default:u}=await import(/* @vite-ignore */s.moduleId),d=await t(u,{target:c,props:{Hst:{Story:n,Variant:r}},context:new Map(Object.entries({
|
|
1
|
+
import{callSetupFunctions as e,mountSvelteComponent as t}from"../util/svelte.js";import n from"./Story.svelte";import r from"./Variant.svelte";import*as i from"virtual:$poveste-generated-global-setup";import*as a from"virtual:$poveste-setup";import{tick as o}from"svelte";async function s({file:s,el:c,storyData:l}){let{default:u}=await import(/* @vite-ignore */s.moduleId),d=await t(u,{target:c,props:{Hst:{Story:n,Variant:r}},context:new Map(Object.entries({__pvtAddStory(e){l.push(e)},__pvtStoryFile:s}))},`client`);await e(i,a,{app:d.app,story:null,variant:null}),await o(),l[0]?.variants.length||l[0].variants.push({id:`_default`,title:`default`}),d.destroy()}export{s as run};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poveste/plugin-svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "Poveste plugin for Svelte 4/5 and SvelteKit support",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Sorin Gitlan"
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"types": "./dist/index.node.d.ts",
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"svelte": "^4.0.0 || ^5.0.0",
|
|
29
|
-
"poveste": "^0.
|
|
29
|
+
"poveste": "^0.2.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"change-case": "^5.4.4",
|
|
33
33
|
"globby": "^14.0.2",
|
|
34
34
|
"launch-editor": "^2.9.1",
|
|
35
35
|
"pathe": "^1.1.2",
|
|
36
|
-
"@poveste/
|
|
37
|
-
"@poveste/
|
|
38
|
-
"@poveste/vendors": "^0.
|
|
36
|
+
"@poveste/controls": "^0.2.0",
|
|
37
|
+
"@poveste/shared": "^0.2.0",
|
|
38
|
+
"@poveste/vendors": "^0.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"svelte-preprocess": "^6.0.3",
|
|
48
48
|
"typescript": "5.6.3",
|
|
49
49
|
"vite": "^8.0.0",
|
|
50
|
-
"poveste": "0.
|
|
50
|
+
"poveste": "0.2.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "rimraf dist && vite build && tsc -d -P tsconfig.build.json && pnpm run build:types",
|
|
@@ -3,10 +3,10 @@ import { omitInheritStoryProps } from '@poveste/shared'
|
|
|
3
3
|
import { getContext, setContext } from 'svelte'
|
|
4
4
|
import MountVariant from './MountVariant.svelte'
|
|
5
5
|
|
|
6
|
-
const story = getContext('
|
|
6
|
+
const story = getContext('__pvtStory')
|
|
7
7
|
let index = { value: 0 }
|
|
8
|
-
setContext('
|
|
9
|
-
setContext('
|
|
8
|
+
setContext('__pvtIndex', index)
|
|
9
|
+
setContext('__pvtSlots', $$slots)
|
|
10
10
|
|
|
11
11
|
$: inheritedFromStory = Object.keys(story).filter(key => !omitInheritStoryProps.includes(key)).reduce((acc, key) => {
|
|
12
12
|
acc[key] = story[key]
|
|
@@ -7,9 +7,9 @@ export let autoPropsDisabled = false
|
|
|
7
7
|
export let setupApp = null
|
|
8
8
|
export let implicit = false
|
|
9
9
|
|
|
10
|
-
const story = getContext('
|
|
11
|
-
const index = getContext('
|
|
12
|
-
const storySlots = getContext('
|
|
10
|
+
const story = getContext('__pvtStory')
|
|
11
|
+
const index = getContext('__pvtIndex')
|
|
12
|
+
const storySlots = getContext('__pvtSlots')
|
|
13
13
|
|
|
14
14
|
const variant = story.variants[index.value]
|
|
15
15
|
index.value++
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext, setContext } from 'svelte'
|
|
3
3
|
|
|
4
|
-
const story = getContext('
|
|
5
|
-
const currentVariant = getContext('
|
|
6
|
-
const slotName = getContext('
|
|
4
|
+
const story = getContext('__pvtStory')
|
|
5
|
+
const currentVariant = getContext('__pvtVariant')
|
|
6
|
+
const slotName = getContext('__pvtSlot')
|
|
7
7
|
|
|
8
8
|
let index = { value: 0 }
|
|
9
|
-
setContext('
|
|
9
|
+
setContext('__pvtIndex', index)
|
|
10
10
|
|
|
11
11
|
export let source = null
|
|
12
12
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { getContext } from 'svelte'
|
|
3
3
|
|
|
4
|
-
const story = getContext('
|
|
5
|
-
const currentVariant = getContext('
|
|
6
|
-
const slotName = getContext('
|
|
7
|
-
const index = getContext('
|
|
4
|
+
const story = getContext('__pvtStory')
|
|
5
|
+
const currentVariant = getContext('__pvtVariant')
|
|
6
|
+
const slotName = getContext('__pvtSlot')
|
|
7
|
+
const index = getContext('__pvtIndex')
|
|
8
8
|
|
|
9
9
|
const variant = story.variants[index.value]
|
|
10
10
|
index.value++
|
package/src/client/mount.ts
CHANGED
package/src/client/render.ts
CHANGED
|
@@ -83,9 +83,9 @@ export default _defineComponent({
|
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
context: new Map(Object.entries({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
__pvtStory: props.story,
|
|
87
|
+
__pvtVariant: props.variant,
|
|
88
|
+
__pvtSlot: props.slotName,
|
|
89
89
|
})),
|
|
90
90
|
}, 'client')
|
|
91
91
|
app = mountedApp.app
|
package/src/collect/Story.svelte
CHANGED
|
@@ -9,8 +9,8 @@ export let icon = null
|
|
|
9
9
|
export let iconColor = null
|
|
10
10
|
export let docsOnly = false
|
|
11
11
|
|
|
12
|
-
const addStory = getContext('
|
|
13
|
-
const file = getContext('
|
|
12
|
+
const addStory = getContext('__pvtAddStory')
|
|
13
|
+
const file = getContext('__pvtStoryFile')
|
|
14
14
|
|
|
15
15
|
const story = {
|
|
16
16
|
id: id ?? file.id,
|
|
@@ -25,8 +25,8 @@ const story = {
|
|
|
25
25
|
|
|
26
26
|
addStory(story)
|
|
27
27
|
|
|
28
|
-
setContext('
|
|
29
|
-
setContext('
|
|
28
|
+
setContext('__pvtStory', story)
|
|
29
|
+
setContext('__pvtAddVariant', (variant) => {
|
|
30
30
|
story.variants.push(variant)
|
|
31
31
|
})
|
|
32
32
|
</script>
|
|
@@ -6,8 +6,8 @@ export let id = null
|
|
|
6
6
|
export let icon = null
|
|
7
7
|
export let iconColor = null
|
|
8
8
|
|
|
9
|
-
const story = getContext('
|
|
10
|
-
const addVariant = getContext('
|
|
9
|
+
const story = getContext('__pvtStory')
|
|
10
|
+
const addVariant = getContext('__pvtAddVariant')
|
|
11
11
|
|
|
12
12
|
function generateId () {
|
|
13
13
|
return `${story.id}-${story.variants.length}`
|
package/src/collect/index.ts
CHANGED
|
@@ -24,10 +24,10 @@ export async function run({ file, el, storyData }: ServerRunPayload) {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
context: new Map(Object.entries({
|
|
27
|
-
|
|
27
|
+
__pvtAddStory(data) {
|
|
28
28
|
storyData.push(data)
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
__pvtStoryFile: file,
|
|
31
31
|
})),
|
|
32
32
|
}, 'client')
|
|
33
33
|
const app = mountedApp.app
|