@histoire/app 0.17.16 → 1.0.0-alpha.1

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 (200) hide show
  1. package/dist/app/style/main.pcss +1 -1
  2. package/dist/app/style/sandbox.css +1 -1
  3. package/dist/bundle-main-dev.js +1 -1
  4. package/dist/bundle-main.js +2 -2
  5. package/dist/bundled/App.vue2.js +11 -11
  6. package/dist/bundled/app.css +101 -0
  7. package/dist/bundled/components/HomeView.vue2.js +1 -1
  8. package/dist/bundled/components/app/AppHeader.vue2.js +3 -3
  9. package/dist/bundled/components/app/AppLogo.vue2.js +4 -4
  10. package/dist/bundled/components/app/Breadcrumb.vue.js +2 -2
  11. package/dist/bundled/components/app/Breadcrumb.vue2.js +8 -10
  12. package/dist/bundled/components/app/HomeCounter.vue2.js +2 -7
  13. package/dist/bundled/components/app/InitialLoading.vue2.js +1 -1
  14. package/dist/bundled/components/base/BaseCheckbox.vue2.js +1 -2
  15. package/dist/bundled/components/base/BaseEmpty.vue.js +2 -3
  16. package/dist/bundled/components/base/BaseIcon.vue.js +2 -2
  17. package/dist/bundled/components/base/BaseIcon.vue2.js +1 -2
  18. package/dist/bundled/components/base/BaseListItemLink.vue.js +1 -1
  19. package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +5 -5
  20. package/dist/bundled/components/base/BaseOverflowTab.vue.js +1 -1
  21. package/dist/bundled/components/base/BaseSelect.vue2.js +2 -2
  22. package/dist/bundled/components/base/BaseSplitPane.vue.js +2 -2
  23. package/dist/bundled/components/base/BaseSplitPane.vue2.js +3 -6
  24. package/dist/bundled/components/base/BaseTab.vue.js +1 -1
  25. package/dist/bundled/components/base/BaseTag.vue.js +1 -1
  26. package/dist/bundled/components/command/CommandPrompts.vue2.js +3 -7
  27. package/dist/bundled/components/command/CommandPromptsModal.vue2.js +1 -1
  28. package/dist/bundled/components/command/PromptSelect.vue2.js +3 -3
  29. package/dist/bundled/components/command/PromptText.vue2.js +1 -1
  30. package/dist/bundled/components/misc/CheckerboardPattern.vue.js +31 -34
  31. package/dist/bundled/components/misc/HatchedPattern.vue.js +2 -3
  32. package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +1 -1
  33. package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +2 -4
  34. package/dist/bundled/components/panel/ControlsComponentState.vue2.js +1 -2
  35. package/dist/bundled/components/panel/PaneTabs.vue2.js +12 -12
  36. package/dist/bundled/components/panel/StatePresets.vue2.js +3 -4
  37. package/dist/bundled/components/panel/StoryControls.vue2.js +5 -6
  38. package/dist/bundled/components/panel/StoryDocs.vue2.js +6 -6
  39. package/dist/bundled/components/panel/StoryEvents.vue2.js +2 -2
  40. package/dist/bundled/components/panel/StorySidePanel.vue2.js +10 -12
  41. package/dist/bundled/components/panel/StorySourceCode.vue.js +2 -2
  42. package/dist/bundled/components/panel/StorySourceCode.vue2.js +15 -20
  43. package/dist/bundled/components/search/SearchItem.vue.js +2 -2
  44. package/dist/bundled/components/search/SearchItem.vue2.js +4 -6
  45. package/dist/bundled/components/search/SearchLoading.vue2.js +2 -2
  46. package/dist/bundled/components/search/SearchModal.vue2.js +1 -1
  47. package/dist/bundled/components/search/SearchPane.vue2.js +42 -60
  48. package/dist/bundled/components/search/search-docs-data.js +1 -1
  49. package/dist/bundled/components/search/search-title-data.js +1 -1
  50. package/dist/bundled/components/story/GenericMountStory.vue2.js +1 -1
  51. package/dist/bundled/components/story/StoryResponsivePreview.vue.js +2 -2
  52. package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +9 -12
  53. package/dist/bundled/components/story/StoryVariantGrid.vue2.js +8 -11
  54. package/dist/bundled/components/story/StoryVariantGridItem.vue.js +2 -2
  55. package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +16 -19
  56. package/dist/bundled/components/story/StoryVariantListItem.vue.js +2 -2
  57. package/dist/bundled/components/story/StoryVariantListItem.vue2.js +4 -5
  58. package/dist/bundled/components/story/StoryVariantSingle.vue.js +2 -2
  59. package/dist/bundled/components/story/StoryVariantSingle.vue2.js +5 -6
  60. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +3 -3
  61. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +4 -4
  62. package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +4 -4
  63. package/dist/bundled/components/story/StoryView.vue2.js +5 -5
  64. package/dist/bundled/components/story/StoryViewer.vue.js +2 -2
  65. package/dist/bundled/components/story/StoryViewer.vue2.js +3 -4
  66. package/dist/bundled/components/toolbar/ToolbarBackground.vue.js +1 -1
  67. package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +3 -4
  68. package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +16 -17
  69. package/dist/bundled/components/tree/StoryGroup.vue2.js +9 -11
  70. package/dist/bundled/components/tree/StoryList.vue2.js +3 -3
  71. package/dist/bundled/components/tree/StoryListFolder.vue.js +2 -2
  72. package/dist/bundled/components/tree/StoryListFolder.vue2.js +13 -15
  73. package/dist/bundled/components/tree/StoryListItem.vue.js +2 -2
  74. package/dist/bundled/components/tree/StoryListItem.vue2.js +5 -6
  75. package/dist/bundled/index.js +4 -4
  76. package/dist/bundled/plugin.js +1 -2
  77. package/dist/bundled/sandbox.js +15 -20
  78. package/dist/bundled/stores/folder.js +1 -1
  79. package/dist/bundled/stores/preview-settings.js +1 -1
  80. package/dist/bundled/util/commands.js +1 -1
  81. package/dist/bundled/util/dark.js +1 -1
  82. package/dist/bundled/util/events.js +2 -4
  83. package/dist/bundled/util/scroll.js +1 -1
  84. package/dist/bundled/util/state.js +2 -2
  85. package/dist/style.css +281 -293
  86. package/package.json +24 -25
  87. package/scripts/copy.mjs +1 -1
  88. package/scripts/watchAndCopy.mjs +4 -4
  89. package/src/app/App.vue +15 -15
  90. package/src/app/api.ts +3 -3
  91. package/src/app/components/HomeView.vue +4 -3
  92. package/src/app/components/app/AppHeader.vue +2 -2
  93. package/src/app/components/app/AppLogo.vue +4 -4
  94. package/src/app/components/app/Breadcrumb.vue +5 -5
  95. package/src/app/components/app/HomeCounter.vue +1 -10
  96. package/src/app/components/app/MobileOverlay.vue +1 -1
  97. package/src/app/components/base/BaseCheckbox.vue +2 -3
  98. package/src/app/components/base/BaseIcon.vue +2 -2
  99. package/src/app/components/base/BaseKeyboardShortcut.vue +1 -1
  100. package/src/app/components/base/BaseListItem.vue +2 -2
  101. package/src/app/components/base/BaseListItemLink.vue +3 -3
  102. package/src/app/components/base/BaseOverflowMenu.vue +5 -5
  103. package/src/app/components/base/BaseSelect.vue +6 -5
  104. package/src/app/components/base/BaseSplitPane.vue +19 -15
  105. package/src/app/components/command/CommandPrompts.vue +8 -10
  106. package/src/app/components/command/CommandPromptsModal.vue +2 -1
  107. package/src/app/components/command/PromptSelect.vue +7 -5
  108. package/src/app/components/command/PromptText.vue +4 -3
  109. package/src/app/components/panel/ControlsComponentPropItem.vue +4 -4
  110. package/src/app/components/panel/ControlsComponentState.vue +3 -3
  111. package/src/app/components/panel/ControlsComponentStateItem.vue +2 -2
  112. package/src/app/components/panel/PaneTabs.vue +3 -3
  113. package/src/app/components/panel/StatePresets.vue +16 -13
  114. package/src/app/components/panel/StoryControls.vue +5 -5
  115. package/src/app/components/panel/StoryDocs.vue +28 -24
  116. package/src/app/components/panel/StoryEvent.vue +2 -2
  117. package/src/app/components/panel/StoryEvents.vue +3 -3
  118. package/src/app/components/panel/StorySidePanel.vue +2 -2
  119. package/src/app/components/panel/StorySourceCode.vue +12 -8
  120. package/src/app/components/search/SearchItem.vue +5 -4
  121. package/src/app/components/search/SearchItemContent.vue +4 -4
  122. package/src/app/components/search/SearchModal.vue +2 -1
  123. package/src/app/components/search/SearchPane.vue +64 -76
  124. package/src/app/components/search/search-docs-data.ts +3 -3
  125. package/src/app/components/search/search-title-data.ts +3 -3
  126. package/src/app/components/search/types.ts +1 -1
  127. package/src/app/components/story/GenericMountStory.vue +2 -2
  128. package/src/app/components/story/GenericRenderStory.vue +4 -3
  129. package/src/app/components/story/StoryResponsivePreview.vue +17 -16
  130. package/src/app/components/story/StoryVariantGrid.vue +10 -9
  131. package/src/app/components/story/StoryVariantGridItem.vue +14 -14
  132. package/src/app/components/story/StoryVariantListItem.vue +4 -3
  133. package/src/app/components/story/StoryVariantSingle.vue +3 -3
  134. package/src/app/components/story/StoryVariantSinglePreviewNative.vue +5 -5
  135. package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +14 -14
  136. package/src/app/components/story/StoryVariantSingleView.vue +4 -4
  137. package/src/app/components/story/StoryView.vue +8 -8
  138. package/src/app/components/story/StoryViewer.vue +2 -3
  139. package/src/app/components/toolbar/ToolbarNewTab.vue +1 -1
  140. package/src/app/components/toolbar/ToolbarTitle.vue +1 -1
  141. package/src/app/components/tree/StoryGroup.vue +3 -3
  142. package/src/app/components/tree/StoryList.vue +3 -3
  143. package/src/app/components/tree/StoryListFolder.vue +3 -3
  144. package/src/app/components/tree/StoryListItem.vue +2 -2
  145. package/src/app/index.ts +6 -7
  146. package/src/app/plugin.ts +4 -3
  147. package/src/app/router.ts +2 -2
  148. package/src/app/sandbox.ts +24 -27
  149. package/src/app/stores/command.ts +4 -3
  150. package/src/app/stores/events.ts +4 -4
  151. package/src/app/stores/folder.ts +10 -8
  152. package/src/app/stores/preview-settings.ts +2 -2
  153. package/src/app/stores/story.ts +4 -4
  154. package/src/app/style/main.pcss +1 -1
  155. package/src/app/style/sandbox.css +1 -1
  156. package/src/app/types.ts +3 -3
  157. package/src/app/util/commands.ts +5 -4
  158. package/src/app/util/dark.ts +3 -3
  159. package/src/app/util/docs.ts +6 -4
  160. package/src/app/util/events.ts +4 -3
  161. package/src/app/util/keyboard.ts +9 -8
  162. package/src/app/util/mapping.ts +9 -6
  163. package/src/app/util/open-in-editor.ts +1 -1
  164. package/src/app/util/preview-settings.ts +3 -3
  165. package/src/app/util/sandbox.ts +2 -3
  166. package/src/app/util/scroll.ts +5 -4
  167. package/src/app/util/select.ts +5 -4
  168. package/src/app/util/state.ts +6 -5
  169. package/src/app/util/tooltip.ts +2 -2
  170. package/src/app/util/variant.ts +4 -3
  171. package/src/bundle-main-dev.js +1 -1
  172. package/src/bundle-main.js +2 -2
  173. package/src/shim.d.ts +0 -6
  174. package/src/virtual.d.ts +1 -0
  175. package/tailwind.config.cjs +20 -21
  176. package/tsconfig.json +26 -26
  177. package/vite.config.ts +8 -7
  178. package/dist/bundled/components/app/Breadcrumb.vue3.js +0 -1
  179. package/dist/bundled/components/base/BaseEmpty.vue2.js +0 -1
  180. package/dist/bundled/components/base/BaseIcon.vue3.js +0 -1
  181. package/dist/bundled/components/base/BaseSplitPane.vue3.js +0 -1
  182. package/dist/bundled/components/misc/HatchedPattern.vue2.js +0 -1
  183. package/dist/bundled/components/panel/StorySourceCode.vue3.js +0 -1
  184. package/dist/bundled/components/search/SearchItem.vue3.js +0 -1
  185. package/dist/bundled/components/story/StoryResponsivePreview.vue3.js +0 -1
  186. package/dist/bundled/components/story/StoryVariantGridItem.vue3.js +0 -1
  187. package/dist/bundled/components/story/StoryVariantListItem.vue3.js +0 -1
  188. package/dist/bundled/components/story/StoryVariantSingle.vue3.js +0 -1
  189. package/dist/bundled/components/story/StoryViewer.vue3.js +0 -1
  190. package/dist/bundled/components/toolbar/ToolbarBackground.vue3.js +0 -1
  191. package/dist/bundled/components/tree/StoryListFolder.vue3.js +0 -1
  192. package/dist/bundled/components/tree/StoryListItem.vue3.js +0 -1
  193. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +0 -52
  194. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +0 -10
  195. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +0 -16
  196. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +0 -31
  197. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +0 -15
  198. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +0 -60
  199. package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +0 -11
  200. package/dist/bundled/style.css +0 -101
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
- "version": "0.17.16",
3
+ "type": "module",
4
+ "version": "1.0.0-alpha.1",
4
5
  "description": "Pre-bundled UI for Histoire",
5
- "license": "MIT",
6
6
  "author": {
7
7
  "name": "Guillaume Chau"
8
8
  },
9
+ "license": "MIT",
9
10
  "repository": {
10
11
  "url": "https://github.com/Akryum/histoire.git",
11
12
  "type": "git",
@@ -14,7 +15,6 @@
14
15
  "publishConfig": {
15
16
  "access": "public"
16
17
  },
17
- "type": "module",
18
18
  "exports": {
19
19
  ".": {
20
20
  "types": "./dist/index.d.ts",
@@ -24,30 +24,29 @@
24
24
  },
25
25
  "types": "./src/index.ts",
26
26
  "dependencies": {
27
- "@types/flexsearch": "^0.7.6",
28
- "flexsearch": "0.7.21",
29
- "shiki-es": "^0.2.0",
30
- "@histoire/controls": "^0.17.16",
31
- "@histoire/shared": "^0.17.16",
32
- "@histoire/vendors": "^0.17.16"
27
+ "fuse.js": "^7.0.0",
28
+ "shiki-es": "^0.14.0",
29
+ "@histoire/controls": "^1.0.0-alpha.1",
30
+ "@histoire/shared": "^1.0.0-alpha.1",
31
+ "@histoire/vendors": "^1.0.0-alpha.1"
33
32
  },
34
33
  "devDependencies": {
35
- "@tailwindcss/typography": "^0.5.10",
36
- "@types/fs-extra": "^9.0.13",
37
- "@types/node": "^18.11.9",
38
- "@vitejs/plugin-vue": "^4.5.0",
39
- "autoprefixer": "^10.4.16",
40
- "chokidar": "^3.5.3",
41
- "concurrently": "^7.6.0",
42
- "fs-extra": "^10.1.0",
43
- "globby": "^13.2.2",
44
- "pathe": "^1.1.1",
45
- "postcss": "^8.4.31",
46
- "postcss-import": "^14.1.0",
47
- "tailwindcss": "^3.3.5",
48
- "typescript": "^4.9.5",
49
- "vite": "^5.0.11",
50
- "vue": "^3.3.8"
34
+ "@tailwindcss/typography": "^0.5.15",
35
+ "@types/fs-extra": "^11.0.4",
36
+ "@types/node": "^22.10.1",
37
+ "@vitejs/plugin-vue": "^5.2.1",
38
+ "autoprefixer": "^10.4.20",
39
+ "chokidar": "^4.0.1",
40
+ "concurrently": "^9.1.0",
41
+ "fs-extra": "^11.2.0",
42
+ "globby": "^14.0.2",
43
+ "pathe": "^1.1.2",
44
+ "postcss": "^8.4.49",
45
+ "postcss-import": "^16.1.0",
46
+ "tailwindcss": "^3.4.16",
47
+ "typescript": "5.6.3",
48
+ "vite": "^6.0.5",
49
+ "vue": "^3.5.13"
51
50
  },
52
51
  "scripts": {
53
52
  "build": "rimraf dist && vite build && pnpm run build:css && node ./scripts/copy.mjs",
package/scripts/copy.mjs CHANGED
@@ -2,7 +2,7 @@ import fs from 'fs-extra'
2
2
  import { globbySync } from 'globby'
3
3
  import { normalizePath } from 'vite'
4
4
 
5
- function toDist (file) {
5
+ function toDist(file) {
6
6
  return normalizePath(file).replace(/^src\//, 'dist/')
7
7
  }
8
8
 
@@ -2,7 +2,7 @@ import chokidar from 'chokidar'
2
2
  import fs from 'fs-extra'
3
3
  import { normalizePath } from 'vite'
4
4
 
5
- function toDist (file) {
5
+ function toDist(file) {
6
6
  return normalizePath(file).replace(/^src\//, 'dist/')
7
7
  }
8
8
 
@@ -10,6 +10,6 @@ function toDist (file) {
10
10
  // they change.
11
11
  chokidar
12
12
  .watch('src/**/!(*.ts|*.vue|tsconfig.json)')
13
- .on('change', (file) => fs.copy(file, toDist(file)))
14
- .on('add', (file) => fs.copy(file, toDist(file)))
15
- .on('unlink', (file) => fs.remove(toDist(file)))
13
+ .on('change', file => fs.copy(file, toDist(file)))
14
+ .on('add', file => fs.copy(file, toDist(file)))
15
+ .on('unlink', file => fs.remove(toDist(file)))
package/src/app/App.vue CHANGED
@@ -5,31 +5,31 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { files as rawFiles, tree as rawTree, onUpdate } from 'virtual:$histoire-stories'
9
- import StoryList from './components/tree/StoryList.vue'
10
- import BaseSplitPane from './components/base/BaseSplitPane.vue'
8
+ import type { StoryFile, Tree } from './types'
9
+ import { useTitle } from '@vueuse/core'
10
+ import { onUpdate, files as rawFiles, tree as rawTree } from 'virtual:$histoire-stories'
11
11
  import { computed, onMounted, ref, watch } from 'vue'
12
12
  import AppHeader from './components/app/AppHeader.vue'
13
- import type { StoryFile, Tree } from './types'
13
+ import Breadcrumb from './components/app/Breadcrumb.vue'
14
+ import InitialLoading from './components/app/InitialLoading.vue'
15
+ import BaseSplitPane from './components/base/BaseSplitPane.vue'
16
+ import CommandPromptsModal from './components/command/CommandPromptsModal.vue'
17
+ import SearchModal from './components/search/SearchModal.vue'
18
+ import GenericMountStory from './components/story/GenericMountStory.vue'
19
+ import StoryList from './components/tree/StoryList.vue'
20
+ import { useCommandStore } from './stores/command'
14
21
  import { useStoryStore } from './stores/story'
15
- import { mapFile } from './util/mapping'
16
- import { useTitle } from '@vueuse/core'
17
22
  import { histoireConfig } from './util/config'
18
23
  import { onKeyboardShortcut } from './util/keyboard'
24
+ import { mapFile } from './util/mapping'
19
25
  import { isMobile } from './util/responsive'
20
- import { useCommandStore } from './stores/command'
21
- import Breadcrumb from './components/app/Breadcrumb.vue'
22
- import SearchModal from './components/search/SearchModal.vue'
23
- import CommandPromptsModal from './components/command/CommandPromptsModal.vue'
24
- import InitialLoading from './components/app/InitialLoading.vue'
25
- import GenericMountStory from './components/story/GenericMountStory.vue'
26
26
 
27
27
  const files = ref<StoryFile[]>(rawFiles.map(file => mapFile(file)))
28
28
  const tree = ref<Tree>(rawTree)
29
29
 
30
30
  onUpdate((newFiles: StoryFile[], newTree: Tree) => {
31
31
  loading.value = false
32
- files.value = newFiles.map(file => {
32
+ files.value = newFiles.map((file) => {
33
33
  const existingFile = files.value.find(f => f.id === file.id)
34
34
  return mapFile(file, existingFile)
35
35
  })
@@ -44,7 +44,7 @@ const stories = computed(() => files.value.reduce((acc, file) => {
44
44
  // Store
45
45
 
46
46
  const storyStore = useStoryStore()
47
- watch(stories, value => {
47
+ watch(stories, (value) => {
48
48
  storyStore.setStories(value)
49
49
  }, {
50
50
  immediate: true,
@@ -66,7 +66,7 @@ useTitle(computed(() => {
66
66
  const loadSearch = ref(false)
67
67
  const isSearchOpen = ref(false)
68
68
 
69
- watch(isSearchOpen, value => {
69
+ watch(isSearchOpen, (value) => {
70
70
  if (value) {
71
71
  loadSearch.value = true
72
72
  }
package/src/app/api.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { isDark as _isDark } from './util/dark.js'
2
2
 
3
- export { logEvent } from './util/events.js'
4
-
5
3
  export { toggleDark } from './util/dark.js'
6
4
 
7
- export function isDark () {
5
+ export { logEvent } from './util/events.js'
6
+
7
+ export function isDark() {
8
8
  return _isDark.value
9
9
  }
@@ -1,8 +1,8 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed } from 'vue'
3
- import { histoireConfig, customLogos } from '../util/config'
4
3
  import HistoireLogo from '../assets/histoire.svg'
5
4
  import { useStoryStore } from '../stores/story'
5
+ import { customLogos, histoireConfig } from '../util/config'
6
6
  import HomeCounter from './app/HomeCounter.vue'
7
7
 
8
8
  const logoUrl = computed(() => histoireConfig.theme?.logo?.square ? customLogos.square : HistoireLogo)
@@ -13,10 +13,11 @@ const stats = computed(() => {
13
13
  let variantCount = 0
14
14
  let docsCount = 0;
15
15
 
16
- (storyStore.stories || []).forEach(story => {
16
+ (storyStore.stories || []).forEach((story) => {
17
17
  if (story.docsOnly) {
18
18
  docsCount++
19
- } else {
19
+ }
20
+ else {
20
21
  storyCount++
21
22
  if (story.variants) {
22
23
  variantCount += story.variants.length
@@ -1,11 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import { Icon } from '@iconify/vue'
3
3
  import { computed } from 'vue'
4
- import AppLogo from './AppLogo.vue'
4
+ import { histoireConfig } from '../../util/config'
5
5
  import { isDark, toggleDark } from '../../util/dark'
6
6
  import { onKeyboardShortcut } from '../../util/keyboard'
7
7
  import { makeTooltip } from '../../util/tooltip'
8
- import { histoireConfig } from '../../util/config'
8
+ import AppLogo from './AppLogo.vue'
9
9
 
10
10
  defineEmits({
11
11
  search: () => true,
@@ -1,11 +1,11 @@
1
1
  <script lang="ts" setup>
2
- import { isDark } from '../../util/dark'
3
2
  import { computed } from 'vue'
4
- import { histoireConfig, customLogos } from '../../util/config'
5
-
6
3
  import HistoireLogoDark from '../../assets/histoire-text-dark.svg'
7
4
  import HistoireLogoLight from '../../assets/histoire-text.svg'
8
5
 
6
+ import { customLogos, histoireConfig } from '../../util/config'
7
+ import { isDark } from '../../util/dark'
8
+
9
9
  const logoUrl = computed(() => {
10
10
  if (isDark.value) {
11
11
  return histoireConfig.theme.logo?.dark ? customLogos.dark : HistoireLogoDark
@@ -13,7 +13,7 @@ const logoUrl = computed(() => {
13
13
  return histoireConfig.theme.logo?.light ? customLogos.light : HistoireLogoLight
14
14
  })
15
15
 
16
- const altText = computed(() => histoireConfig.theme.title + ' logo')
16
+ const altText = computed(() => `${histoireConfig.theme.title} logo`)
17
17
  </script>
18
18
 
19
19
  <template>
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" setup>
2
- import { computed, ref, watch } from 'vue'
2
+ import type { Story, Tree } from '../../types'
3
3
  import { Icon } from '@iconify/vue'
4
+ import { computed, ref, watch } from 'vue'
4
5
  import { useStoryStore } from '../../stores/story'
5
- import { Story, Tree } from '../../types'
6
- import MobileOverlay from './MobileOverlay.vue'
7
6
  import StoryList from '../tree/StoryList.vue'
7
+ import MobileOverlay from './MobileOverlay.vue'
8
8
 
9
9
  defineProps<{
10
10
  tree: Tree
@@ -21,11 +21,11 @@ const folders = computed(() => {
21
21
 
22
22
  const isMenuOpened = ref(false)
23
23
 
24
- function openMenu () {
24
+ function openMenu() {
25
25
  isMenuOpened.value = true
26
26
  }
27
27
 
28
- function closeMenu () {
28
+ function closeMenu() {
29
29
  isMenuOpened.value = false
30
30
  }
31
31
 
@@ -1,6 +1,4 @@
1
1
  <script setup lang="ts">
2
- import { ref, toRefs } from 'vue'
3
- import { useTransition, syncRefs } from '@vueuse/core'
4
2
  import { Icon } from '@iconify/vue'
5
3
 
6
4
  const props = defineProps({
@@ -17,13 +15,6 @@ const props = defineProps({
17
15
  default: 0,
18
16
  },
19
17
  })
20
-
21
- const { count } = toRefs(props)
22
- const delayedCount = ref(0)
23
-
24
- const animatedCount = useTransition(delayedCount, { delay: 100, duration: 700 })
25
-
26
- syncRefs(count, delayedCount)
27
18
  </script>
28
19
 
29
20
  <template>
@@ -36,7 +27,7 @@ syncRefs(count, delayedCount)
36
27
  <span
37
28
  class="htw-text-primary-500 htw-min-w-[80px] htw-font-bold"
38
29
  >
39
- {{ animatedCount.toFixed() }}
30
+ {{ count }}
40
31
  </span>
41
32
  <span
42
33
  class="htw-text-sm htw-text-gray-900 dark:htw-text-gray-100"
@@ -6,7 +6,7 @@ defineProps<{
6
6
  opened: boolean
7
7
  }>()
8
8
 
9
- const emit = defineEmits<{(e: 'close'): void}>()
9
+ const emit = defineEmits<{ (e: 'close'): void }>()
10
10
  </script>
11
11
 
12
12
  <template>
@@ -9,11 +9,10 @@ const props = defineProps({
9
9
  })
10
10
 
11
11
  const emit = defineEmits({
12
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
- 'update:modelValue': (newValue: boolean) => true,
12
+ 'update:modelValue': (_newValue: boolean) => true,
14
13
  })
15
14
 
16
- function toggle () {
15
+ function toggle() {
17
16
  emit('update:modelValue', !props.modelValue)
18
17
  animationEnabled.value = true
19
18
  }
@@ -6,8 +6,8 @@ const props = defineProps<{
6
6
  icon: string
7
7
  }>()
8
8
 
9
- const isUrl = computed(() => props.icon.startsWith('http') || props.icon.startsWith('data:image') ||
10
- props.icon.startsWith('.') || props.icon.startsWith('/'))
9
+ const isUrl = computed(() => props.icon.startsWith('http') || props.icon.startsWith('data:image')
10
+ || props.icon.startsWith('.') || props.icon.startsWith('/'))
11
11
  </script>
12
12
 
13
13
  <template>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import { formatKey } from '../../util/keyboard.js'
3
2
  import { computed } from 'vue'
3
+ import { formatKey } from '../../util/keyboard.js'
4
4
 
5
5
  const props = defineProps<{
6
6
  shortcut: string
@@ -7,7 +7,7 @@ const emit = defineEmits<{
7
7
  (e: 'navigate'): void
8
8
  }>()
9
9
 
10
- function handleNavigate () {
10
+ function handleNavigate() {
11
11
  emit('navigate')
12
12
  }
13
13
  </script>
@@ -19,7 +19,7 @@ function handleNavigate () {
19
19
  $attrs.class,
20
20
  isActive
21
21
  ? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
22
- : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900'
22
+ : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900',
23
23
  ]"
24
24
  @click="handleNavigate()"
25
25
  @keyup.enter="handleNavigate()"
@@ -15,8 +15,8 @@ export default defineComponent({
15
15
  navigate: () => true,
16
16
  },
17
17
 
18
- setup (props, { emit }) {
19
- function handleNavigate (event, navigate: (event) => unknown) {
18
+ setup(props, { emit }) {
19
+ function handleNavigate(event, navigate: (event) => unknown) {
20
20
  emit('navigate')
21
21
  navigate(event)
22
22
  }
@@ -42,7 +42,7 @@ export default defineComponent({
42
42
  $attrs.class,
43
43
  (isActive != null ? isActive : linkIsActive)
44
44
  ? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
45
- : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900'
45
+ : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900',
46
46
  ]"
47
47
  @click="handleNavigate($event, navigate)"
48
48
  @keyup.enter="handleNavigate($event, navigate)"
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import { ref, h, onBeforeUnmount, reactive, computed } from 'vue'
3
- import { useResizeObserver } from '@vueuse/core'
4
2
  import { Icon } from '@iconify/vue'
3
+ import { useResizeObserver } from '@vueuse/core'
4
+ import { computed, h, onBeforeUnmount, reactive, ref } from 'vue'
5
5
 
6
6
  // Container
7
7
 
@@ -43,7 +43,7 @@ const visibleChildrenCount = computed(() => {
43
43
  const ChildWrapper = {
44
44
  name: 'ChildWrapper',
45
45
  props: ['index'],
46
- setup (props, { slots }) {
46
+ setup(props, { slots }) {
47
47
  const el = ref<HTMLDivElement>()
48
48
 
49
49
  const state = reactive({ width: 0, index: props.index })
@@ -69,7 +69,7 @@ const ChildWrapper = {
69
69
  /**
70
70
  * Wraps each child with a <ChildWrapper>
71
71
  */
72
- const ChildrenRender = (props, { slots }) => {
72
+ function ChildrenRender(props, { slots }) {
73
73
  const [fragment] = slots.default()
74
74
  return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, () => [vnode]))
75
75
  }
@@ -77,7 +77,7 @@ const ChildrenRender = (props, { slots }) => {
77
77
  /**
78
78
  * Only renders a part of a children list
79
79
  */
80
- const ChildrenSlice = (props, { slots }) => {
80
+ function ChildrenSlice(props, { slots }) {
81
81
  const [fragment] = slots.default()
82
82
  return fragment.children.slice(props.start, props.end)
83
83
  }
@@ -1,7 +1,8 @@
1
1
  <script lang="ts" setup>
2
- import { Dropdown as VDropdown } from 'floating-vue'
3
- import { computed, ComputedRef } from 'vue'
2
+ import type { ComputedRef } from 'vue'
4
3
  import { Icon } from '@iconify/vue'
4
+ import { Dropdown as VDropdown } from 'floating-vue'
5
+ import { computed } from 'vue'
5
6
 
6
7
  const props = defineProps<{
7
8
  modelValue: string
@@ -15,14 +16,14 @@ const emit = defineEmits<{
15
16
 
16
17
  const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
17
18
  if (Array.isArray(props.options)) {
18
- return Object.fromEntries(props.options.map((value) => [value, value]))
19
+ return Object.fromEntries(props.options.map(value => [value, value]))
19
20
  }
20
21
  return props.options
21
22
  })
22
23
 
23
24
  const selectedLabel = computed(() => formattedOptions.value[props.modelValue])
24
25
 
25
- function selectValue (value: string, hide: () => void) {
26
+ function selectValue(value: string, hide: () => void) {
26
27
  emit('update:modelValue', value)
27
28
  emit('select', value)
28
29
  hide()
@@ -51,7 +52,7 @@ function selectValue (value: string, hide: () => void) {
51
52
  <template #popper="{ hide }">
52
53
  <div class="htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700">
53
54
  <div
54
- v-for="( label, value ) in formattedOptions"
55
+ v-for="(label, value) in formattedOptions"
55
56
  v-bind="{ ...$attrs, class: null, style: null }"
56
57
  :key="label"
57
58
  class="htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { ref, computed, watch, onUnmounted } from 'vue'
2
+ import { computed, onUnmounted, ref, watch } from 'vue'
3
3
 
4
4
  const SAVE_PREFIX = '__histoire'
5
5
 
@@ -48,8 +48,7 @@ const props = defineProps({
48
48
  })
49
49
 
50
50
  const emit = defineEmits({
51
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
52
- 'update:split': (value: number) => true,
51
+ 'update:split': (_value: number) => true,
53
52
  })
54
53
 
55
54
  const currentSplit = ref(props.defaultSplit)
@@ -70,7 +69,8 @@ if (props.saveId) {
70
69
  let parsedValue
71
70
  try {
72
71
  parsedValue = JSON.parse(savedValue)
73
- } catch (e) {
72
+ }
73
+ catch (e) {
74
74
  console.error(e)
75
75
  }
76
76
 
@@ -79,11 +79,11 @@ if (props.saveId) {
79
79
  }
80
80
  }
81
81
 
82
- watch(currentSplit, value => {
82
+ watch(currentSplit, (value) => {
83
83
  localStorage.setItem(storageKey, JSON.stringify(value))
84
84
  })
85
85
 
86
- watch(currentSplit, value => {
86
+ watch(currentSplit, (value) => {
87
87
  if (value !== props.split) {
88
88
  emit('update:split', value)
89
89
  }
@@ -95,9 +95,11 @@ if (props.saveId) {
95
95
  const boundSplit = computed(() => {
96
96
  if (currentSplit.value < props.min) {
97
97
  return props.min
98
- } else if (currentSplit.value > props.max) {
98
+ }
99
+ else if (currentSplit.value > props.max) {
99
100
  return props.max
100
- } else {
101
+ }
102
+ else {
101
103
  return currentSplit.value
102
104
  }
103
105
  })
@@ -115,7 +117,7 @@ let startPosition = 0
115
117
  let startSplit = 0
116
118
  const el = ref(null)
117
119
 
118
- function dragStart (e) {
120
+ function dragStart(e) {
119
121
  dragging.value = true
120
122
  startPosition = props.orientation === 'landscape' ? e.pageX : e.pageY
121
123
  startSplit = boundSplit.value
@@ -123,32 +125,34 @@ function dragStart (e) {
123
125
  window.addEventListener('mouseup', dragEnd)
124
126
  }
125
127
 
126
- function dragMove (e) {
128
+ function dragMove(e) {
127
129
  if (dragging.value) {
128
130
  let position
129
131
  let totalSize
130
132
  if (props.orientation === 'landscape') {
131
133
  position = e.pageX
132
134
  totalSize = el.value.offsetWidth
133
- } else {
135
+ }
136
+ else {
134
137
  position = e.pageY
135
138
  totalSize = el.value.offsetHeight
136
139
  }
137
140
  const dPosition = position - startPosition
138
141
  if (props.fixed) {
139
142
  currentSplit.value = startSplit + dPosition
140
- } else {
143
+ }
144
+ else {
141
145
  currentSplit.value = startSplit + ~~(dPosition / totalSize * 200) / 2
142
146
  }
143
147
  }
144
148
  }
145
149
 
146
- function dragEnd () {
150
+ function dragEnd() {
147
151
  dragging.value = false
148
152
  removeDragListeners()
149
153
  }
150
154
 
151
- function removeDragListeners () {
155
+ function removeDragListeners() {
152
156
  window.removeEventListener('mousemove', dragMove)
153
157
  window.removeEventListener('mouseup', dragEnd)
154
158
  }
@@ -166,7 +170,7 @@ onUnmounted(() => {
166
170
  'htw-flex-col': orientation === 'portrait',
167
171
  'htw-cursor-ew-resize': dragging && orientation === 'landscape',
168
172
  'htw-cursor-ns-resize': dragging && orientation === 'portrait',
169
- [orientation]: true
173
+ [orientation]: true,
170
174
  }"
171
175
  >
172
176
  <div
@@ -1,11 +1,11 @@
1
1
  <script lang="ts" setup>
2
- import { reactive, ref, nextTick, onMounted } from 'vue'
3
2
  import type { ClientCommand } from '@histoire/shared'
4
- import { getCommandContext, executeCommand } from '../../util/commands.js'
3
+ import { nextTick, onMounted, reactive, ref } from 'vue'
4
+ import { executeCommand, getCommandContext } from '../../util/commands.js'
5
5
  import BaseButton from '../base/BaseButton.vue'
6
6
  import BaseKeyboardShortcut from '../base/BaseKeyboardShortcut.vue'
7
- import PromptText from './PromptText.vue'
8
7
  import PromptSelect from './PromptSelect.vue'
8
+ import PromptText from './PromptText.vue'
9
9
 
10
10
  const props = defineProps<{
11
11
  command: ClientCommand
@@ -27,18 +27,16 @@ for (const prompt of props.command.prompts) {
27
27
  let defaultValue
28
28
  if (typeof prompt.defaultValue === 'function') {
29
29
  defaultValue = prompt.defaultValue(answers)
30
- } else {
30
+ }
31
+ else {
31
32
  defaultValue = prompt.defaultValue
32
33
  }
33
34
  answers[prompt.field] = defaultValue
34
35
  }
35
36
 
36
- function submit () {
37
+ function submit() {
37
38
  const params = props.command.getParams
38
- ? props.command.getParams({
39
- ...getCommandContext(),
40
- answers,
41
- })
39
+ ? props.command.getParams({ ...getCommandContext(), answers })
42
40
  : answers
43
41
  executeCommand(props.command, params)
44
42
  emit('close')
@@ -48,7 +46,7 @@ function submit () {
48
46
 
49
47
  const promptComps = ref<any[]>([])
50
48
 
51
- function focusPrompt (index: number) {
49
+ function focusPrompt(index: number) {
52
50
  nextTick(() => {
53
51
  promptComps.value[index]?.focus?.()
54
52
  })
@@ -1,6 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { defineAsyncComponent } from 'vue'
3
3
  import { useCommandStore } from '../../stores/command.js'
4
+
4
5
  const CommandPrompts = defineAsyncComponent(() => import('./CommandPrompts.vue'))
5
6
 
6
7
  defineProps({
@@ -14,7 +15,7 @@ const emit = defineEmits({
14
15
  close: () => true,
15
16
  })
16
17
 
17
- function close () {
18
+ function close() {
18
19
  emit('close')
19
20
  }
20
21