build(#10336): show popups on Story
This commit is contained in:
parent
b56d173f8a
commit
8ca9621d42
|
@ -14,6 +14,7 @@ const appInitialized = Symbol();
|
||||||
|
|
||||||
let moduleInitialized = false;
|
let moduleInitialized = false;
|
||||||
let unobserve = () => {};
|
let unobserve = () => {};
|
||||||
|
let misskeyOS = null;
|
||||||
|
|
||||||
function loadTheme(applyTheme: typeof import('../src/scripts/theme')['applyTheme']) {
|
function loadTheme(applyTheme: typeof import('../src/scripts/theme')['applyTheme']) {
|
||||||
unobserve();
|
unobserve();
|
||||||
|
@ -51,7 +52,8 @@ queueMicrotask(() => {
|
||||||
import('../src/directives'),
|
import('../src/directives'),
|
||||||
import('../src/widgets'),
|
import('../src/widgets'),
|
||||||
import('../src/scripts/theme'),
|
import('../src/scripts/theme'),
|
||||||
]).then(([{ default: components }, { default: directives }, { default: widgets }, { applyTheme }]) => {
|
import('../src/os'),
|
||||||
|
]).then(([{ default: components }, { default: directives }, { default: widgets }, { applyTheme }, os]) => {
|
||||||
setup((app) => {
|
setup((app) => {
|
||||||
moduleInitialized = true;
|
moduleInitialized = true;
|
||||||
if (app[appInitialized]) {
|
if (app[appInitialized]) {
|
||||||
|
@ -62,6 +64,7 @@ queueMicrotask(() => {
|
||||||
components(app);
|
components(app);
|
||||||
directives(app);
|
directives(app);
|
||||||
widgets(app);
|
widgets(app);
|
||||||
|
misskeyOS = os;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -79,6 +82,17 @@ const preview = {
|
||||||
return story;
|
return story;
|
||||||
},
|
},
|
||||||
mswDecorator,
|
mswDecorator,
|
||||||
|
(Story, context) => {
|
||||||
|
return {
|
||||||
|
setup() {
|
||||||
|
return {
|
||||||
|
context,
|
||||||
|
popups: misskeyOS.popups,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
template: '<div><component :is="popup.component" v-for="popup in popups" :key="popup.id" v-bind="popup.props" v-on="popup.events"/><story /></div>',
|
||||||
|
};
|
||||||
|
},
|
||||||
],
|
],
|
||||||
parameters: {
|
parameters: {
|
||||||
msw: {
|
msw: {
|
||||||
|
|
Loading…
Reference in New Issue