1- import type { Preview } from '@storybook/vue3-vite' ;
2- import { setup } from '@storybook/vue3' ;
3- import { create as createTheme } from 'storybook/theming' ;
4- import { router } from '@inertiajs/vue3' ;
5- import { action } from 'storybook/actions' ;
1+ import type { Preview } from '@storybook/vue3-vite' ;
2+ import { setup } from '@storybook/vue3' ;
3+ import { create as createTheme } from 'storybook/theming' ;
4+ import { router } from '@inertiajs/vue3' ;
5+ import { action } from 'storybook/actions' ;
66import './storybook.css' ;
77import './theme.css' ;
8- import { translate } from '@/translations/translator' ;
8+ import { translate } from '@/translations/translator' ;
99import registerUiComponents from '@/bootstrap/ui' ;
1010import DateFormatter from '@/components/DateFormatter' ;
1111import cleanCodeSnippet from './clean-code-snippet' ;
12+ import PortalVue from 'portal-vue' ;
13+ import FullscreenHeader from '@/components/publish/FullscreenHeader.vue' ;
14+ import Portal from '@/components/portals/Portal.vue' ;
15+ import PortalTargets from '@/components/portals/PortalTargets.vue' ;
16+ import { keys , portals , slug , stacks } from '@api' ;
1217
1318// Intercept Inertia navigation and log to Actions tab.
1419router . on ( 'before' , ( event ) => {
@@ -18,8 +23,50 @@ router.on('before', (event) => {
1823
1924setup ( async ( app ) => {
2025 window . __ = translate ;
26+
27+ window . Statamic = {
28+ $config : {
29+ get ( key ) {
30+ const config = {
31+ linkToDocs : true ,
32+ paginationSize : 50 ,
33+ paginationSizeOptions : [ 10 , 25 , 50 , 100 , 500 ] ,
34+ sites : [ {
35+ handle : 'default' ,
36+ lang : 'en' ,
37+ } ] ,
38+ selectedSite : 'default' ,
39+ } ;
40+
41+ return config [ key ] ?? null ;
42+ }
43+ } ,
44+ $commandPalette : {
45+ add ( command ) {
46+ //
47+ }
48+ } ,
49+ $progress : {
50+ loading ( name , loading ) {
51+ //
52+ }
53+ }
54+ } ;
55+
2156 app . config . globalProperties . __ = translate ;
2257 app . config . globalProperties . $date = new DateFormatter ;
58+ app . config . globalProperties . cp_url = ( url ) => url ;
59+ app . config . globalProperties . $portals = portals ;
60+ app . config . globalProperties . $stacks = stacks ;
61+ app . config . globalProperties . $slug = slug ;
62+ app . config . globalProperties . $keys = keys ;
63+
64+ app . use ( PortalVue , { portalName : 'v-portal' } ) ;
65+
66+ app . component ( 'portal' , Portal ) ;
67+ app . component ( 'PortalTargets' , PortalTargets ) ;
68+ app . component ( 'publish-field-fullscreen-header' , FullscreenHeader ) ;
69+
2370 await registerUiComponents ( app ) ;
2471} ) ;
2572
@@ -37,6 +84,7 @@ const preview: Preview = {
3784 base : 'light' ,
3885 fontBase : '"Lexend", sans-serif' ,
3986 fontCode : '"Source Code Pro", monospace' ,
87+ textColor : '#181a1b' ,
4088 } ) ,
4189 source : {
4290 transform : ( code : string ) => cleanCodeSnippet ( code ) ,
@@ -50,11 +98,11 @@ const preview: Preview = {
5098 options : {
5199 storySort : {
52100 order : [
53- // 'Getting Started',
54- // 'Installation',
55- '*' ,
56- 'Components'
101+ 'Overview' ,
102+ 'Components' ,
103+ '*'
57104 ] ,
105+ method : 'alphabetical' ,
58106 } ,
59107 } ,
60108 } ,
@@ -87,7 +135,10 @@ const preview: Preview = {
87135 }
88136 }
89137
90- return story ( ) ;
138+ return {
139+ components : { PortalTargets } ,
140+ template : '<div><story /><PortalTargets /></div>' ,
141+ } ;
91142 } ,
92143 ] ,
93144} ;
0 commit comments