histoire 0.5.1 → 0.5.4

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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import './src/component'
1
+ import './src/components'
2
2
 
3
3
  // https://github.com/microsoft/TypeScript/issues/33079
4
4
  export * from './dist/client/index'
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import "$histoire-theme";
21
- import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, computed, ref, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, watch, resolveComponent, withKeys, Fragment, renderList, createBlock, isRef, resolveDirective, withDirectives, createTextVNode, defineAsyncComponent, vShow, reactive, Transition, normalizeStyle, resolveDynamicComponent, createApp } from "vue";
21
+ import { pushScopeId, popScopeId, defineComponent, useCssVars, unref, computed, ref, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, normalizeClass, toDisplayString, createCommentVNode, watch, resolveComponent, withKeys, Fragment, renderList, createBlock, isRef, resolveDirective, withDirectives, createTextVNode, defineAsyncComponent, vShow, reactive, Transition, normalizeStyle, onMounted, resolveDynamicComponent, createApp } from "vue";
22
22
  import { defineStore, createPinia } from "pinia";
23
23
  import FloatingVue from "floating-vue";
24
24
  import { files, tree, onUpdate } from "$histoire-stories";
@@ -141,7 +141,7 @@ const _withScopeId$1 = (n) => (pushScopeId("data-v-1a78012e"), n = n(), popScope
141
141
  const _hoisted_1$9 = { "data-test-id": "story-list-folder" };
142
142
  const _hoisted_2$6 = ["onKeyup"];
143
143
  const _hoisted_3$4 = { class: "bind-tree-padding htw-flex htw-items-center htw-gap-2 htw-min-w-0" };
144
- const _hoisted_4$4 = { class: "htw-flex htw-flex-none htw-items-center" };
144
+ const _hoisted_4$3 = { class: "htw-flex htw-flex-none htw-items-center" };
145
145
  const _hoisted_5$1 = { class: "htw-truncate" };
146
146
  const _hoisted_6 = { key: 0 };
147
147
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
@@ -180,7 +180,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
180
180
  ]
181
181
  }, [
182
182
  createElementVNode("span", _hoisted_3$4, [
183
- createElementVNode("span", _hoisted_4$4, [
183
+ createElementVNode("span", _hoisted_4$3, [
184
184
  createVNode(unref(Icon), {
185
185
  icon: "carbon:caret-right",
186
186
  class: normalizeClass(["htw-w-4 htw-h-4 htw-transition-transform htw-duration-150 htw-opacity-30", {
@@ -225,7 +225,7 @@ const _hoisted_1$8 = {
225
225
  };
226
226
  const _hoisted_2$5 = ["onKeyup"];
227
227
  const _hoisted_3$3 = { class: "htw-truncate htw-opacity-50" };
228
- const _hoisted_4$3 = /* @__PURE__ */ createElementVNode("span", { class: "htw-h-[1px] htw-flex-1 htw-bg-gray-500/10 htw-mx-2" }, null, -1);
228
+ const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("span", { class: "htw-h-[1px] htw-flex-1 htw-bg-gray-500/10 htw-mx-2" }, null, -1);
229
229
  const _hoisted_5 = { key: 1 };
230
230
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
231
231
  name: "StoryGroup",
@@ -262,7 +262,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
262
262
  }])
263
263
  }, null, 8, ["class"]),
264
264
  createElementVNode("span", _hoisted_3$3, toDisplayString(__props.group.title), 1),
265
- _hoisted_4$3
265
+ _hoisted_4$2
266
266
  ], 40, _hoisted_2$5)) : createCommentVNode("", true),
267
267
  unref(isFolderOpen) ? (openBlock(), createElementBlock("div", _hoisted_5, [
268
268
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.group.children, (element) => {
@@ -435,7 +435,7 @@ function genKeyboardShortcutHtml(shortcut) {
435
435
  const _hoisted_1$5 = { class: "htw-px-4 htw-h-16 htw-flex htw-items-center htw-gap-2" };
436
436
  const _hoisted_2$4 = { class: "htw-py-3 sm:htw-py-4 htw-flex-1 htw-h-full htw-flex htw-items-center htw-pr-2" };
437
437
  const _hoisted_3$2 = ["href"];
438
- const _hoisted_4$2 = { class: "htw-ml-auto htw-flex-none htw-flex" };
438
+ const _hoisted_4$1 = { class: "htw-ml-auto htw-flex-none htw-flex" };
439
439
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
440
440
  name: "AppHeader",
441
441
  emits: {
@@ -462,7 +462,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
462
462
  createVNode(_sfc_main$6, { class: "htw-max-w-full htw-max-h-full" })
463
463
  ], 8, _hoisted_3$2)
464
464
  ]),
465
- createElementVNode("div", _hoisted_4$2, [
465
+ createElementVNode("div", _hoisted_4$1, [
466
466
  withDirectives((openBlock(), createElementBlock("a", {
467
467
  class: "htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer htw-text-gray-900 dark:htw-text-gray-100",
468
468
  "data-test-id": "search-btn",
@@ -496,7 +496,7 @@ const _withScopeId = (n) => (pushScopeId("data-v-5fe505b0"), n = n(), popScopeId
496
496
  const _hoisted_1$4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "htw-opacity-40" }, " / ", -1));
497
497
  const _hoisted_2$3 = { class: "htw-flex htw-items-center htw-gap-2" };
498
498
  const _hoisted_3$1 = { class: "htw-opacity-40 htw-text-sm" };
499
- const _hoisted_4$1 = /* @__PURE__ */ createTextVNode(" Select a story... ");
499
+ const _hoisted_4 = /* @__PURE__ */ createTextVNode(" Select a story... ");
500
500
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
501
501
  name: "Breadcrumb",
502
502
  props: {
@@ -553,7 +553,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
553
553
  createElementVNode("span", _hoisted_3$1, toDisplayString(unref(story).variants.length), 1)
554
554
  ])
555
555
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
556
- _hoisted_4$1
556
+ _hoisted_4
557
557
  ], 64)),
558
558
  createVNode(unref(Icon), {
559
559
  icon: "carbon:chevron-sort",
@@ -689,12 +689,11 @@ const _hoisted_1 = {
689
689
  key: 0,
690
690
  class: "htw-hidden"
691
691
  };
692
- const _hoisted_2 = { class: "htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100" };
693
- const _hoisted_3 = {
692
+ const _hoisted_2 = {
694
693
  key: 0,
695
694
  class: "htw-h-full htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800"
696
695
  };
697
- const _hoisted_4 = { class: "htw-flex htw-flex-col htw-h-full" };
696
+ const _hoisted_3 = { class: "htw-flex htw-flex-col htw-h-full" };
698
697
  const __default__ = {
699
698
  name: "HistoireApp"
700
699
  };
@@ -747,6 +746,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
747
746
  loading.value = false;
748
747
  });
749
748
  }
749
+ const mounted = ref(false);
750
+ onMounted(() => {
751
+ mounted.value = true;
752
+ });
750
753
  return (_ctx, _cache) => {
751
754
  const _component_RouterView = resolveComponent("RouterView");
752
755
  return openBlock(), createElementBlock(Fragment, null, [
@@ -755,8 +758,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
755
758
  story: unref(storyStore).currentStory
756
759
  }, null, 8, ["story"]))
757
760
  ])) : createCommentVNode("", true),
758
- createElementVNode("div", _hoisted_2, [
759
- unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_3, [
761
+ createElementVNode("div", {
762
+ class: "htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100",
763
+ style: normalizeStyle({
764
+ opacity: mounted.value && !loading.value ? 1 : 0
765
+ })
766
+ }, [
767
+ unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
760
768
  createVNode(_sfc_main$5, {
761
769
  onSearch: _cache[0] || (_cache[0] = ($event) => isSearchOpen.value = true)
762
770
  }),
@@ -774,7 +782,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
774
782
  class: "htw-h-full"
775
783
  }, {
776
784
  first: withCtx(() => [
777
- createElementVNode("div", _hoisted_4, [
785
+ createElementVNode("div", _hoisted_3, [
778
786
  createVNode(_sfc_main$5, {
779
787
  class: "htw-flex-none",
780
788
  onSearch: _cache[1] || (_cache[1] = ($event) => isSearchOpen.value = true)
@@ -795,14 +803,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
795
803
  key: 2,
796
804
  shown: isSearchOpen.value,
797
805
  onClose: _cache[2] || (_cache[2] = ($event) => isSearchOpen.value = false)
798
- }, null, 8, ["shown"])) : createCommentVNode("", true),
799
- createVNode(Transition, { name: "__histoire-fade" }, {
800
- default: withCtx(() => [
801
- loading.value ? (openBlock(), createBlock(_sfc_main$1, { key: 0 })) : createCommentVNode("", true)
802
- ]),
803
- _: 1
804
- })
805
- ])
806
+ }, null, 8, ["shown"])) : createCommentVNode("", true)
807
+ ], 4),
808
+ createVNode(Transition, { name: "__histoire-fade" }, {
809
+ default: withCtx(() => [
810
+ loading.value ? (openBlock(), createBlock(_sfc_main$1, { key: 0 })) : createCommentVNode("", true)
811
+ ]),
812
+ _: 1
813
+ })
806
814
  ], 64);
807
815
  };
808
816
  }
@@ -9,7 +9,7 @@ export default {
9
9
  import { files as rawFiles, tree as rawTree, onUpdate } from '$histoire-stories'
10
10
  import StoryList from './components/tree/StoryList.vue'
11
11
  import BaseSplitPane from './components/base/BaseSplitPane.vue'
12
- import { computed, ref, watch } from 'vue'
12
+ import { computed, onMounted, ref, watch } from 'vue'
13
13
  import AppHeader from './components/app/AppHeader.vue'
14
14
  import type { StoryFile, Tree } from './types'
15
15
  import { useStoryStore } from './stores/story'
@@ -84,6 +84,11 @@ if (import.meta.hot && !rawFiles.length) {
84
84
  loading.value = false
85
85
  })
86
86
  }
87
+
88
+ const mounted = ref(false)
89
+ onMounted(() => {
90
+ mounted.value = true
91
+ })
87
92
  </script>
88
93
 
89
94
  <template>
@@ -97,7 +102,13 @@ if (import.meta.hot && !rawFiles.length) {
97
102
  />
98
103
  </div>
99
104
 
100
- <div class="htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100">
105
+ <div
106
+ class="htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100"
107
+ :style="{
108
+ // Prevent flash of content
109
+ opacity: mounted && !loading ? 1 : 0,
110
+ }"
111
+ >
101
112
  <div
102
113
  v-if="isMobile"
103
114
  class="htw-h-full htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800"
@@ -142,11 +153,11 @@ if (import.meta.hot && !rawFiles.length) {
142
153
  :shown="isSearchOpen"
143
154
  @close="isSearchOpen = false"
144
155
  />
145
-
146
- <transition name="__histoire-fade">
147
- <InitialLoading
148
- v-if="loading"
149
- />
150
- </transition>
151
156
  </div>
157
+
158
+ <transition name="__histoire-fade">
159
+ <InitialLoading
160
+ v-if="loading"
161
+ />
162
+ </transition>
152
163
  </template>
@@ -51,6 +51,7 @@ export async function build(ctx) {
51
51
  const variantCount = ctx.storyFiles.reduce((sum, file) => sum + (file.story?.variants.length ?? 0), 0);
52
52
  const emptyStoryCount = ctx.storyFiles.length - storyCount;
53
53
  const results = await viteBuild({
54
+ mode: 'development',
54
55
  plugins: await createVitePlugins(false, ctx),
55
56
  build: {
56
57
  rollupOptions: {
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import './src/component'
1
+ import './src/components'
2
2
 
3
3
  export * from './dist/node/index'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.5.1",
3
+ "version": "0.5.4",
4
4
  "description": "A fast story book powered by Vite",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,7 +33,7 @@
33
33
  "histoire": "./bin.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@histoire/controls": "^0.5.1",
36
+ "@histoire/controls": "^0.5.4",
37
37
  "@iconify/vue": "^3.2.1",
38
38
  "@types/markdown-it": "^12.2.3",
39
39
  "@vueuse/core": "^8.2.5",
@@ -9,7 +9,7 @@ export default {
9
9
  import { files as rawFiles, tree as rawTree, onUpdate } from '$histoire-stories'
10
10
  import StoryList from './components/tree/StoryList.vue'
11
11
  import BaseSplitPane from './components/base/BaseSplitPane.vue'
12
- import { computed, ref, watch } from 'vue'
12
+ import { computed, onMounted, ref, watch } from 'vue'
13
13
  import AppHeader from './components/app/AppHeader.vue'
14
14
  import type { StoryFile, Tree } from './types'
15
15
  import { useStoryStore } from './stores/story'
@@ -84,6 +84,11 @@ if (import.meta.hot && !rawFiles.length) {
84
84
  loading.value = false
85
85
  })
86
86
  }
87
+
88
+ const mounted = ref(false)
89
+ onMounted(() => {
90
+ mounted.value = true
91
+ })
87
92
  </script>
88
93
 
89
94
  <template>
@@ -97,7 +102,13 @@ if (import.meta.hot && !rawFiles.length) {
97
102
  />
98
103
  </div>
99
104
 
100
- <div class="htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100">
105
+ <div
106
+ class="htw-h-screen htw-bg-white dark:htw-bg-gray-700 dark:htw-text-gray-100"
107
+ :style="{
108
+ // Prevent flash of content
109
+ opacity: mounted && !loading ? 1 : 0,
110
+ }"
111
+ >
101
112
  <div
102
113
  v-if="isMobile"
103
114
  class="htw-h-full htw-flex htw-flex-col htw-divide-y htw-divide-gray-100 dark:htw-divide-gray-800"
@@ -142,11 +153,11 @@ if (import.meta.hot && !rawFiles.length) {
142
153
  :shown="isSearchOpen"
143
154
  @close="isSearchOpen = false"
144
155
  />
145
-
146
- <transition name="__histoire-fade">
147
- <InitialLoading
148
- v-if="loading"
149
- />
150
- </transition>
151
156
  </div>
157
+
158
+ <transition name="__histoire-fade">
159
+ <InitialLoading
160
+ v-if="loading"
161
+ />
162
+ </transition>
152
163
  </template>
@@ -4,7 +4,7 @@ import type {
4
4
  StoryLayout,
5
5
  Story,
6
6
  Variant,
7
- } from './dist/client/app/types'
7
+ } from './client/app/types'
8
8
  import type {
9
9
  HstCheckbox,
10
10
  HstText,
@@ -15,6 +15,8 @@ import type {
15
15
  HstColorShades,
16
16
  } from '@histoire/controls'
17
17
 
18
+ // Utils
19
+
18
20
  declare type NonUndefinedable<T> = T extends undefined ? never : T
19
21
  declare type TypePropsToRuntimeProps<T> = {
20
22
  [K in keyof T]-?: {} extends Pick<T, K> ? {
@@ -25,6 +27,8 @@ declare type TypePropsToRuntimeProps<T> = {
25
27
  }
26
28
  }
27
29
 
30
+ // <Story>
31
+
28
32
  interface VueStoryProps {
29
33
  /**
30
34
  * Title of the story.
@@ -78,6 +82,8 @@ declare const VueStoryComponent: import('vue').DefineComponent<
78
82
  TypePropsToRuntimeProps<VueStoryProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<TypePropsToRuntimeProps<VueStoryProps>>> & {}, {}
79
83
  >
80
84
 
85
+ // <Variant>
86
+
81
87
  interface VueVariantProps {
82
88
  /**
83
89
  * Title of the variant.
@@ -119,6 +125,8 @@ declare const VueVariantComponent: import('vue').DefineComponent<
119
125
  TypePropsToRuntimeProps<VueVariantProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, Readonly<import('vue').ExtractPropTypes<TypePropsToRuntimeProps<VueVariantProps>>> & {}, {}
120
126
  >
121
127
 
128
+ // Register global components
129
+
122
130
  declare module '@vue/runtime-core' {
123
131
  export interface GlobalComponents {
124
132
  Story: typeof VueStoryComponent
package/src/node/build.ts CHANGED
@@ -61,6 +61,7 @@ export async function build (ctx: Context) {
61
61
  const emptyStoryCount = ctx.storyFiles.length - storyCount
62
62
 
63
63
  const results = await viteBuild({
64
+ mode: 'development',
64
65
  plugins: await createVitePlugins(false, ctx),
65
66
  build: {
66
67
  rollupOptions: {