histoire 0.2.2 → 0.2.5

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.
Files changed (112) hide show
  1. package/dist/client/app/App.vue +2 -2
  2. package/dist/client/app/codegen/vue3.js +11 -2
  3. package/dist/client/app/codegen/vue3.ts +9 -1
  4. package/dist/client/app/components/app/AppHeader.vue +2 -2
  5. package/dist/client/app/components/app/Breadcrumb.vue +1 -1
  6. package/dist/client/app/components/base/BaseListItemLink.vue +1 -1
  7. package/dist/client/app/components/base/BaseTab.vue +1 -1
  8. package/dist/client/app/components/exposed/Story.vue +5 -0
  9. package/dist/client/app/components/exposed/Variant.vue +7 -0
  10. package/dist/client/app/components/search/SearchItem.vue +1 -0
  11. package/dist/client/app/components/search/SearchModal.vue +7 -6
  12. package/dist/client/app/components/story/StoryResponsivePreview.vue +72 -77
  13. package/dist/client/app/components/story/StorySidePanel.vue +1 -1
  14. package/dist/client/app/components/story/StorySourceCode.vue +3 -17
  15. package/dist/client/app/components/story/StoryVariantGridItem.vue +3 -3
  16. package/dist/client/app/components/story/StoryVariantSingleView.vue +10 -11
  17. package/dist/client/app/components/story/StoryViewer.vue +2 -0
  18. package/dist/client/app/components/story/{variant → toolbar}/StoryVariantBackground.vue +4 -4
  19. package/dist/client/app/components/story/{variant → toolbar}/StoryVariantNewTab.vue +2 -2
  20. package/dist/client/app/components/story/{variant → toolbar}/StoryVariantResponsiveSize.vue +5 -5
  21. package/dist/client/app/components/story/{variant → toolbar}/StoryVariantTitle.vue +0 -0
  22. package/dist/client/app/components/tree/StoryGroup.vue +75 -0
  23. package/dist/client/app/components/{story → tree}/StoryList.vue +8 -2
  24. package/{src/client/app/components/story → dist/client/app/components/tree}/StoryListFolder.vue +6 -4
  25. package/{src/client/app/components/story → dist/client/app/components/tree}/StoryListItem.vue +3 -3
  26. package/dist/client/app/global-components.js +0 -1
  27. package/dist/client/app/index.js +0 -1
  28. package/dist/client/app/sandbox.js +0 -1
  29. package/dist/client/app/stores/preview-settings.d.ts +8 -0
  30. package/dist/client/app/stores/preview-settings.js +14 -0
  31. package/dist/client/app/stores/preview-settings.ts +17 -0
  32. package/dist/client/app/stores/story.d.ts +57 -21
  33. package/dist/client/app/stores/story.js +13 -9
  34. package/dist/client/app/stores/story.ts +13 -9
  35. package/dist/client/app/style/floating-vue.pcss +3 -1
  36. package/dist/client/app/types.d.ts +18 -2
  37. package/dist/client/app/types.ts +20 -2
  38. package/dist/client/app/util/keyboard.js +0 -1
  39. package/dist/client/app/util/mapping.js +10 -10
  40. package/dist/client/app/util/mapping.ts +10 -5
  41. package/dist/client/app/util/preview-settings.d.ts +1 -8
  42. package/dist/client/app/util/preview-settings.js +0 -11
  43. package/dist/client/app/util/preview-settings.ts +1 -19
  44. package/dist/client/app/util/reactivity.js +0 -1
  45. package/dist/client/app/util/scroll.js +0 -1
  46. package/dist/client/app/util/variant.js +0 -1
  47. package/dist/client/index.js +0 -1
  48. package/dist/client/server/Story.server.vue +8 -2
  49. package/dist/client/server/index.js +0 -1
  50. package/dist/controls.js +0 -1
  51. package/dist/node/collect/index.js +2 -2
  52. package/dist/node/config.d.ts +8 -2
  53. package/dist/node/plugin.js +15 -7
  54. package/dist/node/stories.js +6 -1
  55. package/dist/node/tree.d.ts +16 -12
  56. package/dist/node/tree.js +45 -5
  57. package/dist/node/types.d.ts +10 -0
  58. package/dist/style.css +164 -31
  59. package/package.json +19 -19
  60. package/src/client/app/App.vue +2 -2
  61. package/src/client/app/codegen/vue3.ts +9 -1
  62. package/src/client/app/components/app/AppHeader.vue +2 -2
  63. package/src/client/app/components/app/Breadcrumb.vue +1 -1
  64. package/src/client/app/components/base/BaseListItemLink.vue +1 -1
  65. package/src/client/app/components/base/BaseTab.vue +1 -1
  66. package/src/client/app/components/exposed/Story.vue +5 -0
  67. package/src/client/app/components/exposed/Variant.vue +7 -0
  68. package/src/client/app/components/search/SearchItem.vue +1 -0
  69. package/src/client/app/components/search/SearchModal.vue +7 -6
  70. package/src/client/app/components/story/StoryResponsivePreview.vue +72 -77
  71. package/src/client/app/components/story/StorySidePanel.vue +1 -1
  72. package/src/client/app/components/story/StorySourceCode.vue +3 -17
  73. package/src/client/app/components/story/StoryVariantGridItem.vue +3 -3
  74. package/src/client/app/components/story/StoryVariantSingleView.vue +10 -11
  75. package/src/client/app/components/story/StoryViewer.vue +2 -0
  76. package/src/client/app/components/story/{variant → toolbar}/StoryVariantBackground.vue +4 -4
  77. package/src/client/app/components/story/{variant → toolbar}/StoryVariantNewTab.vue +2 -2
  78. package/src/client/app/components/story/{variant → toolbar}/StoryVariantResponsiveSize.vue +5 -5
  79. package/src/client/app/components/story/{variant → toolbar}/StoryVariantTitle.vue +0 -0
  80. package/src/client/app/components/tree/StoryGroup.vue +75 -0
  81. package/src/client/app/components/{story → tree}/StoryList.vue +8 -2
  82. package/{dist/client/app/components/story → src/client/app/components/tree}/StoryListFolder.vue +6 -4
  83. package/{dist/client/app/components/story → src/client/app/components/tree}/StoryListItem.vue +3 -3
  84. package/src/client/app/stores/preview-settings.ts +17 -0
  85. package/src/client/app/stores/story.ts +13 -9
  86. package/src/client/app/style/floating-vue.pcss +3 -1
  87. package/src/client/app/types.ts +20 -2
  88. package/src/client/app/util/mapping.ts +10 -5
  89. package/src/client/app/util/preview-settings.ts +1 -19
  90. package/src/client/server/Story.server.vue +8 -2
  91. package/src/node/collect/index.ts +3 -3
  92. package/src/node/config.ts +9 -2
  93. package/src/node/plugin.ts +16 -7
  94. package/src/node/stories.ts +6 -1
  95. package/src/node/tree.spec.ts +35 -17
  96. package/src/node/tree.ts +64 -10
  97. package/src/node/types.ts +11 -0
  98. package/tsconfig.json +2 -0
  99. package/dist/client/app/codegen/vue3.js.map +0 -1
  100. package/dist/client/app/global-components.js.map +0 -1
  101. package/dist/client/app/index.js.map +0 -1
  102. package/dist/client/app/sandbox.js.map +0 -1
  103. package/dist/client/app/stores/story.js.map +0 -1
  104. package/dist/client/app/util/keyboard.js.map +0 -1
  105. package/dist/client/app/util/mapping.js.map +0 -1
  106. package/dist/client/app/util/preview-settings.js.map +0 -1
  107. package/dist/client/app/util/reactivity.js.map +0 -1
  108. package/dist/client/app/util/scroll.js.map +0 -1
  109. package/dist/client/app/util/variant.js.map +0 -1
  110. package/dist/client/index.js.map +0 -1
  111. package/dist/client/server/index.js.map +0 -1
  112. package/dist/controls.js.map +0 -1
@@ -19,11 +19,11 @@ const sandboxUrl = computed(() => {
19
19
  v-tooltip="'Open variant in new tab'"
20
20
  :href="sandboxUrl"
21
21
  target="_blank"
22
- class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500"
22
+ class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
23
23
  >
24
24
  <Icon
25
25
  icon="carbon:launch"
26
- class="base-list-item-link-icon htw-w-4 htw-h-4 htw-opacity-50"
26
+ class="base-list-item-link-icon htw-w-4 htw-h-4"
27
27
  />
28
28
  </a>
29
29
  </template>
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" setup>
2
2
  import { Icon } from '@iconify/vue'
3
+ import { usePreviewSettingsStore } from '../../../stores/preview-settings'
3
4
  import { histoireConfig } from '../../../util/config'
4
- import { usePreviewSettings } from '../../../util/preview-settings'
5
5
  import BaseCheckbox from '../../base/BaseCheckbox.vue'
6
6
 
7
- const settings = usePreviewSettings()
7
+ const settings = usePreviewSettingsStore().currentSettings
8
8
  </script>
9
9
 
10
10
  <template>
@@ -17,18 +17,18 @@ const settings = usePreviewSettings()
17
17
  >
18
18
  <div
19
19
  v-tooltip="'Responsive sizes'"
20
- class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2"
20
+ class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 htw-group"
21
21
  :class="{
22
22
  'htw-cursor-pointer hover:htw-text-primary-500': histoireConfig.responsivePresets?.length,
23
23
  }"
24
24
  >
25
25
  <Icon
26
26
  icon="carbon:devices"
27
- class="htw-w-4 htw-h-4 htw-opacity-50"
27
+ class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
28
28
  />
29
29
  <Icon
30
30
  icon="carbon:caret-down"
31
- class="htw-w-4 htw-h-4 htw-opacity-50"
31
+ class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
32
32
  />
33
33
  </div>
34
34
 
@@ -0,0 +1,75 @@
1
+ <script lang="ts" setup>
2
+ import type { Story, TreeGroup, TreeFolder, TreeLeaf } from '../../types'
3
+ import StoryListItem from './StoryListItem.vue'
4
+ import StoryListFolder from './StoryListFolder.vue'
5
+ import { Icon } from '@iconify/vue'
6
+ import { computed, withDefaults } from 'vue'
7
+ import { useStoryStore } from '../../stores/story'
8
+
9
+ const props = withDefaults(defineProps<{
10
+ path?: Array<string>
11
+ group: TreeGroup
12
+ stories: Story[]
13
+ }>(), {
14
+ path: () => [],
15
+ })
16
+
17
+ const storyStore = useStoryStore()
18
+
19
+ const folderPath = computed(() => [...props.path, props.group.title])
20
+ const isFolderOpen = computed(() => storyStore.isFolderOpened(folderPath.value, true))
21
+
22
+ function toggleOpen () {
23
+ storyStore.toggleFolder(folderPath.value, false)
24
+ }
25
+ </script>
26
+
27
+ <template>
28
+ <div
29
+ data-test-id="story-group"
30
+ class="htw-my-2 first:htw-mt-0 last:htw-mb-0"
31
+ >
32
+ <div
33
+ v-if="group.title"
34
+ role="button"
35
+ tabindex="0"
36
+ class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex htw-items-center htw-gap-1 htw-min-w-0"
37
+ @click="toggleOpen"
38
+ @keyup.enter="toggleOpen"
39
+ @keyup.space="toggleOpen"
40
+ >
41
+ <Icon
42
+ icon="carbon:caret-right"
43
+ class="htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30 htw-flex-none"
44
+ :class="{
45
+ 'htw-rotate-90': isFolderOpen,
46
+ }"
47
+ />
48
+ <span class="htw-truncate htw-opacity-50">{{ group.title }}</span>
49
+ <span class="htw-h-[1px] htw-flex-1 htw-bg-gray-500/10 htw-mx-2" />
50
+ </div>
51
+
52
+ <!-- Children -->
53
+ <div
54
+ v-if="isFolderOpen"
55
+ >
56
+ <template
57
+ v-for="element of group.children"
58
+ :key="element.title"
59
+ >
60
+ <StoryListFolder
61
+ v-if="(element as TreeFolder).children"
62
+ :path="folderPath"
63
+ :folder="(element as TreeFolder)"
64
+ :stories="stories"
65
+ :depth="0"
66
+ />
67
+ <StoryListItem
68
+ v-else
69
+ :story="stories[(element as TreeLeaf).index]"
70
+ :depth="0"
71
+ />
72
+ </template>
73
+ </div>
74
+ </div>
75
+ </template>
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" setup>
2
- import type { Story, Tree, TreeFolder, TreeLeaf } from '../../types'
2
+ import type { Story, Tree, TreeGroup, TreeFolder, TreeLeaf } from '../../types'
3
3
  import StoryListItem from './StoryListItem.vue'
4
4
  import StoryListFolder from './StoryListFolder.vue'
5
+ import StoryGroup from './StoryGroup.vue'
5
6
 
6
7
  const props = defineProps<{
7
8
  tree: Tree
@@ -15,8 +16,13 @@ const props = defineProps<{
15
16
  v-for="element of tree"
16
17
  :key="element.title"
17
18
  >
19
+ <StoryGroup
20
+ v-if="(element as TreeGroup).group"
21
+ :group="(element as TreeGroup)"
22
+ :stories="stories"
23
+ />
18
24
  <StoryListFolder
19
- v-if="(element as TreeFolder).children"
25
+ v-else-if="(element as TreeFolder).children"
20
26
  :folder="(element as TreeFolder)"
21
27
  :stories="stories"
22
28
  />
@@ -25,7 +25,7 @@ function toggleOpen () {
25
25
  }
26
26
 
27
27
  const folderPadding = computed(() => {
28
- return (props.depth * 16) + 'px'
28
+ return (props.depth * 12) + 'px'
29
29
  })
30
30
  </script>
31
31
 
@@ -34,13 +34,13 @@ const folderPadding = computed(() => {
34
34
  <div
35
35
  role="button"
36
36
  tabindex="0"
37
- class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex"
37
+ class="htw-px-0.5 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900 htw-cursor-pointer htw-select-none htw-flex"
38
38
  @click="toggleOpen"
39
39
  @keyup.enter="toggleOpen"
40
40
  @keyup.space="toggleOpen"
41
41
  >
42
42
  <span class="bind-tree-padding htw-flex htw-items-center htw-gap-2 htw-min-w-0">
43
- <span class="htw-flex htw-gap-1 htw-flex-none htw-items-center">
43
+ <span class="htw-flex htw-flex-none htw-items-center">
44
44
  <Icon
45
45
  icon="carbon:caret-right"
46
46
  class="htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30"
@@ -56,6 +56,8 @@ const folderPadding = computed(() => {
56
56
  <span class="htw-truncate">{{ folder.title }}</span>
57
57
  </span>
58
58
  </div>
59
+
60
+ <!-- Children -->
59
61
  <div
60
62
  v-if="isFolderOpen"
61
63
  >
@@ -66,7 +68,7 @@ const folderPadding = computed(() => {
66
68
  <StoryListFolder
67
69
  v-if="(element as TreeFolder).children"
68
70
  :path="folderPath"
69
- :folder="element"
71
+ :folder="(element as TreeFolder)"
70
72
  :stories="stories"
71
73
  :depth="depth + 1"
72
74
  />
@@ -14,7 +14,7 @@ const props = withDefaults(defineProps<{
14
14
  })
15
15
 
16
16
  const filePadding = computed(() => {
17
- return (props.depth * 16) + 'px'
17
+ return (props.depth * 12) + 'px'
18
18
  })
19
19
 
20
20
  const route = useRoute()
@@ -36,9 +36,9 @@ useScrollOnActive(active, el)
36
36
  storyId: story.id,
37
37
  },
38
38
  }"
39
- class="htw-pl-0.5 htw-pr-2 htw-py-2 md:htw-py-1.5 htw-m-1 htw-rounded-sm"
39
+ class="htw-pl-0.5 htw-pr-2 htw-py-2 md:htw-py-1.5 htw-mx-1 htw-rounded-sm"
40
40
  >
41
- <span class="bind-tree-margin htw-flex htw-items-center htw-gap-2 htw-pl-5 htw-min-w-0">
41
+ <span class="bind-tree-margin htw-flex htw-items-center htw-gap-2 htw-pl-4 htw-min-w-0">
42
42
  <Icon
43
43
  :icon="story.icon ?? 'carbon:cube'"
44
44
  class="base-list-item-link-icon htw-w-5 htw-h-5 sm:htw-w-4 sm:htw-h-4 htw-flex-none"
@@ -8,4 +8,3 @@ export function registerGlobalComponents(app) {
8
8
  app.component('Variant', Variant);
9
9
  registerVueComponents(app);
10
10
  }
11
- //# sourceMappingURL=global-components.js.map
@@ -24,4 +24,3 @@ app.use(FloatingVue, {
24
24
  app.use(router);
25
25
  registerGlobalComponents(app);
26
26
  app.mount('#app');
27
- //# sourceMappingURL=index.js.map
@@ -85,4 +85,3 @@ watch(isDark, value => {
85
85
  }, {
86
86
  immediate: true,
87
87
  });
88
- //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1,8 @@
1
+ import type { PreviewSettings } from '../types';
2
+ export declare const usePreviewSettingsStore: import("pinia").StoreDefinition<"preview-settings", import("pinia")._UnwrapAll<Pick<{
3
+ currentSettings: import("@vueuse/shared").RemovableRef<PreviewSettings>;
4
+ }, "currentSettings">>, import("pinia")._UnwrapAll<Pick<{
5
+ currentSettings: import("@vueuse/shared").RemovableRef<PreviewSettings>;
6
+ }, never>>, Pick<{
7
+ currentSettings: import("@vueuse/shared").RemovableRef<PreviewSettings>;
8
+ }, never>>;
@@ -0,0 +1,14 @@
1
+ import { defineStore } from 'pinia';
2
+ import { useStorage } from '@vueuse/core';
3
+ export const usePreviewSettingsStore = defineStore('preview-settings', () => {
4
+ const currentSettings = useStorage('_histoire-sandbox-settings-v2', {
5
+ responsiveWidth: 720,
6
+ responsiveHeight: null,
7
+ rotate: false,
8
+ backgroundColor: 'transparent',
9
+ checkerboard: false,
10
+ });
11
+ return {
12
+ currentSettings,
13
+ };
14
+ });
@@ -0,0 +1,17 @@
1
+ import { defineStore } from 'pinia'
2
+ import { useStorage } from '@vueuse/core'
3
+ import type { PreviewSettings } from '../types'
4
+
5
+ export const usePreviewSettingsStore = defineStore('preview-settings', () => {
6
+ const currentSettings = useStorage<PreviewSettings>('_histoire-sandbox-settings-v2', {
7
+ responsiveWidth: 720,
8
+ responsiveHeight: null,
9
+ rotate: false,
10
+ backgroundColor: 'transparent',
11
+ checkerboard: false,
12
+ })
13
+
14
+ return {
15
+ currentSettings,
16
+ }
17
+ })
@@ -3,6 +3,7 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
3
3
  stories: import("vue").Ref<{
4
4
  id: string;
5
5
  title: string;
6
+ group?: string;
6
7
  variants: {
7
8
  id: string;
8
9
  title: string;
@@ -12,7 +13,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
12
13
  slots?: () => Readonly<any>;
13
14
  state?: any;
14
15
  source?: string;
15
- ready?: boolean;
16
+ responsiveDisabled?: boolean;
17
+ configReady?: boolean;
18
+ previewReady?: boolean;
16
19
  }[];
17
20
  layout?: {
18
21
  type: "single";
@@ -38,13 +41,16 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
38
41
  slots?: () => Readonly<any>;
39
42
  state?: any;
40
43
  source?: string;
41
- ready?: boolean;
44
+ responsiveDisabled?: boolean;
45
+ configReady?: boolean;
46
+ previewReady?: boolean;
42
47
  };
43
48
  }[]>;
44
49
  setStories: (value: Story[]) => void;
45
50
  currentStory: import("vue").ComputedRef<{
46
51
  id: string;
47
52
  title: string;
53
+ group?: string;
48
54
  variants: {
49
55
  id: string;
50
56
  title: string;
@@ -54,7 +60,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
54
60
  slots?: () => Readonly<any>;
55
61
  state?: any;
56
62
  source?: string;
57
- ready?: boolean;
63
+ responsiveDisabled?: boolean;
64
+ configReady?: boolean;
65
+ previewReady?: boolean;
58
66
  }[];
59
67
  layout?: {
60
68
  type: "single";
@@ -80,7 +88,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
80
88
  slots?: () => Readonly<any>;
81
89
  state?: any;
82
90
  source?: string;
83
- ready?: boolean;
91
+ responsiveDisabled?: boolean;
92
+ configReady?: boolean;
93
+ previewReady?: boolean;
84
94
  };
85
95
  }>;
86
96
  currentVariant: import("vue").ComputedRef<{
@@ -92,14 +102,17 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
92
102
  slots?: () => Readonly<any>;
93
103
  state?: any;
94
104
  source?: string;
95
- ready?: boolean;
105
+ responsiveDisabled?: boolean;
106
+ configReady?: boolean;
107
+ previewReady?: boolean;
96
108
  }>;
97
- isFolderOpened: (path: Array<string>) => boolean;
98
- toggleFolder: (path: Array<string>, force?: boolean) => void;
109
+ isFolderOpened: (path: Array<string>, defaultValue?: boolean) => boolean;
110
+ toggleFolder: (path: Array<string>, defaultToggleValue?: boolean) => void;
99
111
  }, "stories">>, import("pinia")._UnwrapAll<Pick<{
100
112
  stories: import("vue").Ref<{
101
113
  id: string;
102
114
  title: string;
115
+ group?: string;
103
116
  variants: {
104
117
  id: string;
105
118
  title: string;
@@ -109,7 +122,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
109
122
  slots?: () => Readonly<any>;
110
123
  state?: any;
111
124
  source?: string;
112
- ready?: boolean;
125
+ responsiveDisabled?: boolean;
126
+ configReady?: boolean;
127
+ previewReady?: boolean;
113
128
  }[];
114
129
  layout?: {
115
130
  type: "single";
@@ -135,13 +150,16 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
135
150
  slots?: () => Readonly<any>;
136
151
  state?: any;
137
152
  source?: string;
138
- ready?: boolean;
153
+ responsiveDisabled?: boolean;
154
+ configReady?: boolean;
155
+ previewReady?: boolean;
139
156
  };
140
157
  }[]>;
141
158
  setStories: (value: Story[]) => void;
142
159
  currentStory: import("vue").ComputedRef<{
143
160
  id: string;
144
161
  title: string;
162
+ group?: string;
145
163
  variants: {
146
164
  id: string;
147
165
  title: string;
@@ -151,7 +169,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
151
169
  slots?: () => Readonly<any>;
152
170
  state?: any;
153
171
  source?: string;
154
- ready?: boolean;
172
+ responsiveDisabled?: boolean;
173
+ configReady?: boolean;
174
+ previewReady?: boolean;
155
175
  }[];
156
176
  layout?: {
157
177
  type: "single";
@@ -177,7 +197,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
177
197
  slots?: () => Readonly<any>;
178
198
  state?: any;
179
199
  source?: string;
180
- ready?: boolean;
200
+ responsiveDisabled?: boolean;
201
+ configReady?: boolean;
202
+ previewReady?: boolean;
181
203
  };
182
204
  }>;
183
205
  currentVariant: import("vue").ComputedRef<{
@@ -189,14 +211,17 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
189
211
  slots?: () => Readonly<any>;
190
212
  state?: any;
191
213
  source?: string;
192
- ready?: boolean;
214
+ responsiveDisabled?: boolean;
215
+ configReady?: boolean;
216
+ previewReady?: boolean;
193
217
  }>;
194
- isFolderOpened: (path: Array<string>) => boolean;
195
- toggleFolder: (path: Array<string>, force?: boolean) => void;
218
+ isFolderOpened: (path: Array<string>, defaultValue?: boolean) => boolean;
219
+ toggleFolder: (path: Array<string>, defaultToggleValue?: boolean) => void;
196
220
  }, "currentStory" | "currentVariant">>, Pick<{
197
221
  stories: import("vue").Ref<{
198
222
  id: string;
199
223
  title: string;
224
+ group?: string;
200
225
  variants: {
201
226
  id: string;
202
227
  title: string;
@@ -206,7 +231,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
206
231
  slots?: () => Readonly<any>;
207
232
  state?: any;
208
233
  source?: string;
209
- ready?: boolean;
234
+ responsiveDisabled?: boolean;
235
+ configReady?: boolean;
236
+ previewReady?: boolean;
210
237
  }[];
211
238
  layout?: {
212
239
  type: "single";
@@ -232,13 +259,16 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
232
259
  slots?: () => Readonly<any>;
233
260
  state?: any;
234
261
  source?: string;
235
- ready?: boolean;
262
+ responsiveDisabled?: boolean;
263
+ configReady?: boolean;
264
+ previewReady?: boolean;
236
265
  };
237
266
  }[]>;
238
267
  setStories: (value: Story[]) => void;
239
268
  currentStory: import("vue").ComputedRef<{
240
269
  id: string;
241
270
  title: string;
271
+ group?: string;
242
272
  variants: {
243
273
  id: string;
244
274
  title: string;
@@ -248,7 +278,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
248
278
  slots?: () => Readonly<any>;
249
279
  state?: any;
250
280
  source?: string;
251
- ready?: boolean;
281
+ responsiveDisabled?: boolean;
282
+ configReady?: boolean;
283
+ previewReady?: boolean;
252
284
  }[];
253
285
  layout?: {
254
286
  type: "single";
@@ -274,7 +306,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
274
306
  slots?: () => Readonly<any>;
275
307
  state?: any;
276
308
  source?: string;
277
- ready?: boolean;
309
+ responsiveDisabled?: boolean;
310
+ configReady?: boolean;
311
+ previewReady?: boolean;
278
312
  };
279
313
  }>;
280
314
  currentVariant: import("vue").ComputedRef<{
@@ -286,8 +320,10 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
286
320
  slots?: () => Readonly<any>;
287
321
  state?: any;
288
322
  source?: string;
289
- ready?: boolean;
323
+ responsiveDisabled?: boolean;
324
+ configReady?: boolean;
325
+ previewReady?: boolean;
290
326
  }>;
291
- isFolderOpened: (path: Array<string>) => boolean;
292
- toggleFolder: (path: Array<string>, force?: boolean) => void;
327
+ isFolderOpened: (path: Array<string>, defaultValue?: boolean) => boolean;
328
+ toggleFolder: (path: Array<string>, defaultToggleValue?: boolean) => void;
293
329
  }, "setStories" | "isFolderOpened" | "toggleFolder">>;
@@ -13,20 +13,25 @@ export const useStoryStore = defineStore('story', () => {
13
13
  function getStringPath(path) {
14
14
  return path.join('␜');
15
15
  }
16
- function toggleFolder(path, force) {
16
+ function toggleFolder(path, defaultToggleValue = true) {
17
17
  const stringPath = getStringPath(path);
18
- if (force === undefined) {
19
- force = !openedFolders.value.get(stringPath);
18
+ const currentValue = openedFolders.value.get(stringPath);
19
+ if (currentValue == null) {
20
+ openedFolders.value.set(stringPath, defaultToggleValue);
20
21
  }
21
- if (force) {
22
- openedFolders.value.set(stringPath, true);
22
+ else if (currentValue) {
23
+ openedFolders.value.set(stringPath, false);
23
24
  }
24
25
  else {
25
- openedFolders.value.delete(stringPath);
26
+ openedFolders.value.set(stringPath, true);
26
27
  }
27
28
  }
28
- function isFolderOpened(path) {
29
- return openedFolders.value.get(getStringPath(path));
29
+ function isFolderOpened(path, defaultValue = false) {
30
+ const value = openedFolders.value.get(getStringPath(path));
31
+ if (value == null) {
32
+ return defaultValue;
33
+ }
34
+ return value;
30
35
  }
31
36
  function openFileFolders(path) {
32
37
  for (let pathLength = 1; pathLength < path.length; pathLength++) {
@@ -45,4 +50,3 @@ export const useStoryStore = defineStore('story', () => {
45
50
  toggleFolder,
46
51
  };
47
52
  });
48
- //# sourceMappingURL=story.js.map
@@ -23,22 +23,26 @@ export const useStoryStore = defineStore('story', () => {
23
23
  return path.join('␜')
24
24
  }
25
25
 
26
- function toggleFolder (path: Array<string>, force?: boolean) {
26
+ function toggleFolder (path: Array<string>, defaultToggleValue = true) {
27
27
  const stringPath = getStringPath(path)
28
28
 
29
- if (force === undefined) {
30
- force = !openedFolders.value.get(stringPath)
31
- }
29
+ const currentValue = openedFolders.value.get(stringPath)
32
30
 
33
- if (force) {
34
- openedFolders.value.set(stringPath, true)
31
+ if (currentValue == null) {
32
+ openedFolders.value.set(stringPath, defaultToggleValue)
33
+ } else if (currentValue) {
34
+ openedFolders.value.set(stringPath, false)
35
35
  } else {
36
- openedFolders.value.delete(stringPath)
36
+ openedFolders.value.set(stringPath, true)
37
37
  }
38
38
  }
39
39
 
40
- function isFolderOpened (path: Array<string>) {
41
- return openedFolders.value.get(getStringPath(path))
40
+ function isFolderOpened (path: Array<string>, defaultValue = false) {
41
+ const value = openedFolders.value.get(getStringPath(path))
42
+ if (value == null) {
43
+ return defaultValue
44
+ }
45
+ return value
42
46
  }
43
47
 
44
48
  function openFileFolders (path: Array<string>) {
@@ -29,4 +29,6 @@
29
29
  }
30
30
  }
31
31
 
32
-
32
+ .v-popper__popper:focus-visible {
33
+ outline: none;
34
+ }
@@ -9,6 +9,7 @@ export interface StoryFile {
9
9
  export interface Story {
10
10
  id: string;
11
11
  title: string;
12
+ group?: string;
12
13
  variants: Variant[];
13
14
  layout?: {
14
15
  type: 'single';
@@ -30,7 +31,9 @@ export interface Variant {
30
31
  slots?: () => Readonly<any>;
31
32
  state?: any;
32
33
  source?: string;
33
- ready?: boolean;
34
+ responsiveDisabled?: boolean;
35
+ configReady?: boolean;
36
+ previewReady?: boolean;
34
37
  }
35
38
  export declare type TreeLeaf = {
36
39
  title: string;
@@ -40,7 +43,13 @@ export declare type TreeFolder = {
40
43
  title: string;
41
44
  children: (TreeFolder | TreeLeaf)[];
42
45
  };
43
- export declare type Tree = (TreeFolder | TreeLeaf)[];
46
+ export interface TreeGroup {
47
+ group: true;
48
+ id: string;
49
+ title: string;
50
+ children: (TreeFolder | TreeLeaf)[];
51
+ }
52
+ export declare type Tree = (TreeGroup | TreeFolder | TreeLeaf)[];
44
53
  export interface SearchResult {
45
54
  kind: 'story' | 'variant';
46
55
  rank: number;
@@ -51,3 +60,10 @@ export interface SearchResult {
51
60
  icon?: string;
52
61
  iconColor?: string;
53
62
  }
63
+ export interface PreviewSettings {
64
+ responsiveWidth: number;
65
+ responsiveHeight: number;
66
+ rotate: boolean;
67
+ backgroundColor: string;
68
+ checkerboard: boolean;
69
+ }
@@ -11,6 +11,7 @@ export interface StoryFile {
11
11
  export interface Story {
12
12
  id: string
13
13
  title: string
14
+ group?: string
14
15
  variants: Variant[]
15
16
  layout?: {
16
17
  type: 'single'
@@ -33,7 +34,9 @@ export interface Variant {
33
34
  slots?: () => Readonly<any>
34
35
  state?: any
35
36
  source?: string
36
- ready?: boolean
37
+ responsiveDisabled?: boolean
38
+ configReady?: boolean
39
+ previewReady?: boolean
37
40
  }
38
41
 
39
42
  export type TreeLeaf = {
@@ -46,7 +49,14 @@ export type TreeFolder = {
46
49
  children: (TreeFolder | TreeLeaf)[]
47
50
  }
48
51
 
49
- export type Tree = (TreeFolder | TreeLeaf)[]
52
+ export interface TreeGroup {
53
+ group: true
54
+ id: string
55
+ title: string
56
+ children: (TreeFolder | TreeLeaf)[]
57
+ }
58
+
59
+ export type Tree = (TreeGroup | TreeFolder | TreeLeaf)[]
50
60
 
51
61
  export interface SearchResult {
52
62
  kind: 'story' | 'variant'
@@ -58,3 +68,11 @@ export interface SearchResult {
58
68
  icon?: string
59
69
  iconColor?: string
60
70
  }
71
+
72
+ export interface PreviewSettings {
73
+ responsiveWidth: number
74
+ responsiveHeight: number
75
+ rotate: boolean
76
+ backgroundColor: string
77
+ checkerboard: boolean
78
+ }
@@ -80,4 +80,3 @@ export function formatKey(key) {
80
80
  }
81
81
  return key.charAt(0).toUpperCase() + key.substring(1).toLowerCase();
82
82
  }
83
- //# sourceMappingURL=keyboard.js.map