@histoire/app 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (85) hide show
  1. package/dist/bundled/App.vue2.js +1 -1
  2. package/dist/bundled/app.css +7 -7
  3. package/dist/bundled/components/HomeView.vue2.js +3 -6
  4. package/dist/bundled/components/app/AppHeader.vue2.js +2 -3
  5. package/dist/bundled/components/app/AppLogo.vue2.js +4 -5
  6. package/dist/bundled/components/app/Breadcrumb.vue2.js +4 -7
  7. package/dist/bundled/components/app/HomeCounter.vue2.js +1 -1
  8. package/dist/bundled/components/app/InitialLoading.vue2.js +1 -1
  9. package/dist/bundled/components/app/MobileOverlay.vue2.js +1 -1
  10. package/dist/bundled/components/base/BaseButton.vue2.js +1 -1
  11. package/dist/bundled/components/base/BaseCheckbox.vue2.js +2 -3
  12. package/dist/bundled/components/base/BaseEmpty.vue.js +1 -1
  13. package/dist/bundled/components/base/BaseIcon.vue2.js +1 -1
  14. package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +1 -1
  15. package/dist/bundled/components/base/BaseListItem.vue2.js +1 -1
  16. package/dist/bundled/components/base/BaseListItemLink.vue.js +1 -1
  17. package/dist/bundled/components/base/BaseOverflowMenu.vue2.js +1 -1
  18. package/dist/bundled/components/base/BaseOverflowTab.vue.js +1 -1
  19. package/dist/bundled/components/base/BaseSelect.vue2.js +1 -1
  20. package/dist/bundled/components/base/BaseSplitPane.vue2.js +1 -1
  21. package/dist/bundled/components/base/BaseTab.vue.js +1 -1
  22. package/dist/bundled/components/base/BaseTag.vue.js +1 -1
  23. package/dist/bundled/components/command/CommandPrompts.vue2.js +10 -11
  24. package/dist/bundled/components/command/CommandPromptsModal.vue2.js +1 -1
  25. package/dist/bundled/components/command/PromptSelect.vue2.js +3 -4
  26. package/dist/bundled/components/command/PromptText.vue2.js +3 -4
  27. package/dist/bundled/components/misc/CheckerboardPattern.vue.js +1 -1
  28. package/dist/bundled/components/misc/HatchedPattern.vue.js +1 -1
  29. package/dist/bundled/components/panel/ControlsComponentPropItem.vue2.js +5 -11
  30. package/dist/bundled/components/panel/ControlsComponentProps.vue2.js +1 -1
  31. package/dist/bundled/components/panel/ControlsComponentState.vue2.js +1 -1
  32. package/dist/bundled/components/panel/ControlsComponentStateItem.vue2.js +1 -1
  33. package/dist/bundled/components/panel/PaneTabs.vue2.js +1 -1
  34. package/dist/bundled/components/panel/StatePresets.vue2.js +1 -1
  35. package/dist/bundled/components/panel/StoryControls.vue2.js +3 -4
  36. package/dist/bundled/components/panel/StoryDocs.vue2.js +4 -8
  37. package/dist/bundled/components/panel/StoryEvent.vue2.js +1 -1
  38. package/dist/bundled/components/panel/StoryEvents.vue2.js +1 -1
  39. package/dist/bundled/components/panel/StorySidePanel.vue2.js +1 -1
  40. package/dist/bundled/components/panel/StorySourceCode.vue.js +1 -1
  41. package/dist/bundled/components/panel/StorySourceCode.vue2.js +12 -21
  42. package/dist/bundled/components/search/SearchItem.vue2.js +1 -1
  43. package/dist/bundled/components/search/SearchItemContent.vue2.js +2 -3
  44. package/dist/bundled/components/search/SearchLoading.vue2.js +1 -1
  45. package/dist/bundled/components/search/SearchPane.vue2.js +2 -5
  46. package/dist/bundled/components/story/GenericMountStory.vue2.js +2 -3
  47. package/dist/bundled/components/story/GenericRenderStory.vue2.js +2 -3
  48. package/dist/bundled/components/story/StoryResponsivePreview.vue2.js +1 -1
  49. package/dist/bundled/components/story/StoryVariantGrid.vue2.js +2 -3
  50. package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +1 -1
  51. package/dist/bundled/components/story/StoryVariantListItem.vue2.js +1 -1
  52. package/dist/bundled/components/story/StoryVariantSingle.vue2.js +5 -11
  53. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +1 -1
  54. package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue2.js +1 -1
  55. package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +3 -4
  56. package/dist/bundled/components/story/StoryView.vue2.js +4 -6
  57. package/dist/bundled/components/story/StoryViewer.vue2.js +4 -7
  58. package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +1 -1
  59. package/dist/bundled/components/toolbar/ToolbarBackground.vue2.js +1 -1
  60. package/dist/bundled/components/toolbar/ToolbarNewTab.vue2.js +1 -1
  61. package/dist/bundled/components/toolbar/ToolbarResponsiveSize.vue2.js +20 -24
  62. package/dist/bundled/components/toolbar/ToolbarTextDirection.vue2.js +1 -1
  63. package/dist/bundled/components/toolbar/ToolbarTitle.vue2.js +1 -1
  64. package/dist/bundled/components/tree/StoryGroup.vue2.js +1 -1
  65. package/dist/bundled/components/tree/StoryList.vue2.js +1 -1
  66. package/dist/bundled/components/tree/StoryListFolder.vue.js +1 -1
  67. package/dist/bundled/components/tree/StoryListFolder.vue2.js +2 -2
  68. package/dist/bundled/components/tree/StoryListItem.vue.js +1 -1
  69. package/dist/bundled/components/tree/StoryListItem.vue2.js +3 -3
  70. package/dist/bundled/sandbox.js +7 -13
  71. package/dist/bundled/stores/command.js +2 -3
  72. package/dist/bundled/stores/events.js +1 -4
  73. package/dist/bundled/stores/story.js +1 -4
  74. package/dist/bundled/util/commands.js +3 -5
  75. package/dist/bundled/util/dark.js +1 -2
  76. package/dist/bundled/util/docs.js +4 -5
  77. package/dist/bundled/util/events.js +1 -2
  78. package/dist/bundled/util/preview-settings.js +1 -2
  79. package/dist/style.css +0 -2
  80. package/package.json +6 -6
  81. package/src/app/components/panel/StorySourceCode.vue +3 -3
  82. package/src/app/components/tree/StoryGroup.vue +1 -1
  83. package/src/app/components/tree/StoryListFolder.vue +1 -1
  84. package/src/app/components/tree/StoryListItem.vue +1 -1
  85. package/src/app/sandbox.ts +4 -4
@@ -8,10 +8,7 @@ const useStoryStore = defineStore("story", () => {
8
8
  stories.value = value;
9
9
  }
10
10
  const currentStory = computed(() => stories.value.find((s) => s.id === router.currentRoute.value.params.storyId));
11
- const currentVariant = computed(() => {
12
- var _a;
13
- return (_a = currentStory.value) == null ? void 0 : _a.variants.find((v) => v.id === router.currentRoute.value.query.variantId);
14
- });
11
+ const currentVariant = computed(() => currentStory.value?.variants.find((v) => v.id === router.currentRoute.value.query.variantId));
15
12
  const maps = computed(() => {
16
13
  const storyMap = /* @__PURE__ */ new Map();
17
14
  const variantMap = /* @__PURE__ */ new Map();
@@ -9,13 +9,12 @@ const builtinCommands = [
9
9
  icon: "carbon:script-reference",
10
10
  showIf: ({ route }) => route.name === "story" && !!useStoryStore().currentStory,
11
11
  getParams: () => {
12
- var _a, _b, _c;
13
12
  const story = useStoryStore().currentStory;
14
13
  let file;
15
14
  if (story.docsOnly) {
16
- file = ((_a = story.file) == null ? void 0 : _a.docsFilePath) ?? ((_b = story.file) == null ? void 0 : _b.filePath);
15
+ file = story.file?.docsFilePath ?? story.file?.filePath;
17
16
  } else {
18
- file = (_c = story.file) == null ? void 0 : _c.filePath;
17
+ file = story.file?.filePath;
19
18
  }
20
19
  return {
21
20
  file
@@ -35,13 +34,12 @@ const builtinCommands = [
35
34
  }
36
35
  ];
37
36
  function executeCommand(command, params) {
38
- var _a;
39
37
  if (import.meta.hot) {
40
38
  import.meta.hot.send("histoire:dev-command", {
41
39
  id: command.id,
42
40
  params
43
41
  });
44
- (_a = command.clientAction) == null ? void 0 : _a.call(command, params, getCommandContext());
42
+ command.clientAction?.(params, getCommandContext());
45
43
  }
46
44
  }
47
45
  function getCommandContext() {
@@ -10,8 +10,7 @@ const isDark = useDark({
10
10
  });
11
11
  const toggleDark = useToggle(isDark);
12
12
  function applyDarkToControls() {
13
- var _a;
14
- (_a = window.__hst_controls_dark) == null ? void 0 : _a.forEach((ref) => {
13
+ window.__hst_controls_dark?.forEach((ref) => {
15
14
  ref.value = isDark.value;
16
15
  });
17
16
  }
@@ -2,22 +2,21 @@ import { unindent } from "@histoire/shared";
2
2
  import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
3
3
  "use strict";
4
4
  async function getSourceCode(story, variant) {
5
- var _a, _b, _c, _d;
6
5
  if (variant.source) {
7
6
  return variant.source;
8
- } else if ((_a = variant.slots) == null ? void 0 : _a.call(variant).source) {
9
- const source = (_b = variant.slots) == null ? void 0 : _b.call(variant).source()[0].children;
7
+ } else if (variant.slots?.().source) {
8
+ const source = variant.slots?.().source()[0].children;
10
9
  if (source) {
11
10
  return unindent(source);
12
11
  }
13
12
  } else {
14
- const clientPlugin = clientSupportPlugins[(_c = story.file) == null ? void 0 : _c.supportPluginId];
13
+ const clientPlugin = clientSupportPlugins[story.file?.supportPluginId];
15
14
  if (clientPlugin) {
16
15
  const pluginModule = await clientPlugin();
17
16
  return pluginModule.generateSourceCode(variant);
18
17
  }
19
18
  }
20
- const sourceLoader = (_d = story.file) == null ? void 0 : _d.source;
19
+ const sourceLoader = story.file?.source;
21
20
  if (sourceLoader) {
22
21
  return (await sourceLoader()).default;
23
22
  }
@@ -1,7 +1,6 @@
1
1
  import { EVENT_SEND } from "./const.js";
2
2
  "use strict";
3
3
  async function logEvent(name, argument) {
4
- var _a;
5
4
  console.log("[histoire] Event fired", { name, argument });
6
5
  const event = {
7
6
  name,
@@ -9,7 +8,7 @@ async function logEvent(name, argument) {
9
8
  // Needed for HTMLEvent that can't be cloned
10
9
  };
11
10
  if (location.href.includes("__sandbox")) {
12
- (_a = window.parent) == null ? void 0 : _a.postMessage({
11
+ window.parent?.postMessage({
13
12
  type: EVENT_SEND,
14
13
  event
15
14
  });
@@ -12,8 +12,7 @@ function applyPreviewSettings(settings) {
12
12
  }
13
13
  }
14
14
  function getContrastColor(setting) {
15
- var _a;
16
- return ((_a = histoireConfig.backgroundPresets.find((preset) => preset.color === setting.backgroundColor)) == null ? void 0 : _a.contrastColor) ?? "unset";
15
+ return histoireConfig.backgroundPresets.find((preset) => preset.color === setting.backgroundColor)?.contrastColor ?? "unset";
17
16
  }
18
17
  export {
19
18
  applyPreviewSettings,
package/dist/style.css CHANGED
@@ -254,7 +254,6 @@
254
254
  height:.75rem;
255
255
  width:.75rem;
256
256
  -webkit-appearance:none;
257
- -moz-appearance:none;
258
257
  appearance:none;
259
258
  border-radius:9999px;
260
259
  border-width:1px;
@@ -281,7 +280,6 @@
281
280
  height:.75rem;
282
281
  width:.75rem;
283
282
  -moz-appearance:none;
284
- -webkit-appearance:none;
285
283
  appearance:none;
286
284
  border-radius:9999px;
287
285
  border-width:1px;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
3
  "type": "module",
4
- "version": "1.0.0-alpha.1",
4
+ "version": "1.0.0-alpha.3",
5
5
  "description": "Pre-bundled UI for Histoire",
6
6
  "author": {
7
7
  "name": "Guillaume Chau"
@@ -25,10 +25,10 @@
25
25
  "types": "./src/index.ts",
26
26
  "dependencies": {
27
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"
28
+ "shiki": "^3.0.0",
29
+ "@histoire/controls": "^1.0.0-alpha.3",
30
+ "@histoire/vendors": "^1.0.0-alpha.3",
31
+ "@histoire/shared": "^1.0.0-alpha.3"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@tailwindcss/typography": "^0.5.15",
@@ -45,7 +45,7 @@
45
45
  "postcss-import": "^16.1.0",
46
46
  "tailwindcss": "^3.4.16",
47
47
  "typescript": "5.6.3",
48
- "vite": "^6.0.5",
48
+ "vite": "^7.0.0",
49
49
  "vue": "^3.5.13"
50
50
  },
51
51
  "scripts": {
@@ -1,10 +1,10 @@
1
1
  <script lang="ts" setup>
2
- import type { Highlighter } from 'shiki-es'
2
+ import type { Highlighter } from 'shiki'
3
3
  import type { Story, Variant } from '../../types'
4
4
  import { HstCopyIcon } from '@histoire/controls'
5
5
  import { unindent } from '@histoire/shared'
6
6
  import { Icon } from '@iconify/vue'
7
- import { getHighlighter } from 'shiki-es'
7
+ import { createHighlighter } from 'shiki'
8
8
  import { clientSupportPlugins } from 'virtual:$histoire-support-plugins-client'
9
9
  import { computed, markRaw, nextTick, onMounted, ref, shallowRef, watch, watchEffect } from 'vue'
10
10
  import { isDark } from '../../util/dark'
@@ -87,7 +87,7 @@ const displayedSourceCode = computed(() => {
87
87
  // HTML render
88
88
 
89
89
  onMounted(async () => {
90
- highlighter.value = await getHighlighter({
90
+ highlighter.value = await createHighlighter({
91
91
  langs: [
92
92
  'html',
93
93
  'jsx',
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Story, TreeGroup } from '../../types'
3
3
  import { Icon } from '@iconify/vue'
4
- import { computed, withDefaults } from 'vue'
4
+ import { computed } from 'vue'
5
5
  import { useFolderStore } from '../../stores/folder'
6
6
  import StoryListFolder from './StoryListFolder.vue'
7
7
  import StoryListItem from './StoryListItem.vue'
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Story, TreeFolder, TreeLeaf } from '../../types'
3
3
  import { Icon } from '@iconify/vue'
4
- import { computed, withDefaults } from 'vue'
4
+ import { computed } from 'vue'
5
5
  import { useFolderStore } from '../../stores/folder'
6
6
  import StoryListItem from './StoryListItem.vue'
7
7
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import type { Story } from '../../types'
3
3
  import { Icon } from '@iconify/vue'
4
- import { computed, ref, withDefaults } from 'vue'
4
+ import { computed, ref } from 'vue'
5
5
  import { useRoute } from 'vue-router'
6
6
  import { useScrollOnActive } from '../../util/scroll'
7
7
  import BaseListItemLink from '../base/BaseListItemLink.vue'
@@ -72,10 +72,10 @@ const app = createApp({
72
72
  ]),
73
73
  this.story && this.variant
74
74
  ? h(GenericRenderStory, { story: this.story, variant: this.variant, onReady: () => {
75
- window.parent?.postMessage({
76
- type: SANDBOX_READY,
77
- })
78
- } })
75
+ window.parent?.postMessage({
76
+ type: SANDBOX_READY,
77
+ })
78
+ } })
79
79
  : null,
80
80
  ]
81
81
  },