@histoire/app 0.9.1 → 0.9.2

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.
@@ -6,7 +6,7 @@ import { clientSupportPlugins } from "virtual:$histoire-support-plugins-client";
6
6
  import { isDark } from "../../util/dark.js";
7
7
  import "./StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js";
8
8
  import _export_sfc from "../../_virtual/plugin-vue_export-helper.js";
9
- const _withScopeId = (n) => (pushScopeId("data-v-5ab4829f"), n = n(), popScopeId(), n);
9
+ const _withScopeId = (n) => (pushScopeId("data-v-ed3a82aa"), n = n(), popScopeId(), n);
10
10
  const _hoisted_1 = { class: "htw-bg-gray-100 dark:htw-bg-gray-800 htw-h-full htw-overflow-hidden htw-flex htw-flex-col" };
11
11
  const _hoisted_2 = {
12
12
  key: 0,
@@ -18,13 +18,17 @@ const _hoisted_5 = {
18
18
  key: 1,
19
19
  class: "htw-text-red-500 htw-h-full htw-p-2 htw-overflow-auto htw-font-mono htw-text-sm"
20
20
  };
21
- const _hoisted_6 = ["value"];
22
- const _hoisted_7 = {
23
- key: 3,
21
+ const _hoisted_6 = {
22
+ key: 2,
23
+ class: "htw-opacity-50 htw-p-4"
24
+ };
25
+ const _hoisted_7 = ["value"];
26
+ const _hoisted_8 = {
27
+ key: 4,
24
28
  class: "htw-w-full htw-h-full htw-overflow-auto",
25
29
  "data-test-id": "story-source-code"
26
30
  };
27
- const _hoisted_8 = ["innerHTML"];
31
+ const _hoisted_9 = ["innerHTML"];
28
32
  const _sfc_main = /* @__PURE__ */ defineComponent({
29
33
  __name: "StorySourceCode",
30
34
  props: {
@@ -84,10 +88,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
84
88
  });
85
89
  const sourceHtml = computed(() => {
86
90
  var _a;
87
- return (_a = highlighter.value) == null ? void 0 : _a.codeToHtml(sourceCode.value, {
91
+ return sourceCode.value ? (_a = highlighter.value) == null ? void 0 : _a.codeToHtml(sourceCode.value, {
88
92
  lang: "html",
89
93
  theme: isDark.value ? "github-dark" : "github-light"
90
- });
94
+ }) : "";
91
95
  });
92
96
  return (_ctx, _cache) => {
93
97
  return openBlock(), createElementBlock("div", _hoisted_1, [
@@ -99,21 +103,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
103
  class: "htw-flex-none"
100
104
  }, null, 8, ["content"])
101
105
  ])) : createCommentVNode("", true),
102
- error.value ? (openBlock(), createElementBlock("div", _hoisted_5, " Error: " + toDisplayString(error.value), 1)) : !unref(sourceHtml) ? (openBlock(), createElementBlock("textarea", {
103
- key: 2,
106
+ error.value ? (openBlock(), createElementBlock("div", _hoisted_5, " Error: " + toDisplayString(error.value), 1)) : !sourceCode.value ? (openBlock(), createElementBlock("i", _hoisted_6, " Not available ")) : !unref(sourceHtml) ? (openBlock(), createElementBlock("textarea", {
107
+ key: 3,
104
108
  class: "__histoire-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0",
105
109
  value: sourceCode.value,
106
110
  readonly: "",
107
111
  "data-test-id": "story-source-code"
108
- }, null, 8, _hoisted_6)) : (openBlock(), createElementBlock("div", _hoisted_7, [
112
+ }, null, 8, _hoisted_7)) : (openBlock(), createElementBlock("div", _hoisted_8, [
109
113
  createElementVNode("div", {
110
114
  class: "__histoire-code htw-p-4 htw-w-fit",
111
115
  innerHTML: unref(sourceHtml)
112
- }, null, 8, _hoisted_8)
116
+ }, null, 8, _hoisted_9)
113
117
  ]))
114
118
  ]);
115
119
  };
116
120
  }
117
121
  });
118
- var StorySourceCode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5ab4829f"]]);
122
+ var StorySourceCode = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ed3a82aa"]]);
119
123
  export { StorySourceCode as default };
@@ -1,7 +1,7 @@
1
1
  import { createTextVNode, defineComponent, ref, watch, computed, openBlock, createElementBlock, Fragment, createElementVNode, createVNode, unref, withDirectives, withKeys, withModifiers, vModelText, createBlock, withCtx, renderList, createCommentVNode } from "@histoire/vendors/vue";
2
2
  import { useFocus, useDebounce } from "@histoire/vendors/vue-use";
3
3
  import { Icon } from "@histoire/vendors/iconify";
4
- import flexsearch from "flexsearch";
4
+ import * as flexsearch from "flexsearch";
5
5
  import charset from "../../node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js";
6
6
  import language from "../../node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js";
7
7
  import { useStoryStore } from "../../stores/story.js";
@@ -76,7 +76,7 @@
76
76
  color: var(--0589c2c6);
77
77
  }
78
78
 
79
- .__histoire-code-placeholder[data-v-5ab4829f] {
79
+ .__histoire-code-placeholder[data-v-ed3a82aa] {
80
80
  color: inherit;
81
81
  font-size: inherit;
82
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Pre-bundled UI for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "types": "./src/index.ts",
26
26
  "dependencies": {
27
- "@histoire/controls": "^0.9.1",
28
- "@histoire/shared": "^0.9.1",
29
- "@histoire/vendors": "^0.9.1",
27
+ "@histoire/controls": "^0.9.2",
28
+ "@histoire/shared": "^0.9.2",
29
+ "@histoire/vendors": "^0.9.2",
30
30
  "@types/flexsearch": "^0.7.3",
31
31
  "flexsearch": "^0.7.21",
32
32
  "shiki": "0.10.1"
@@ -64,10 +64,12 @@ watch(() => [props.variant, generateSourceCodeFn.value], async () => {
64
64
  immediate: true,
65
65
  })
66
66
 
67
- const sourceHtml = computed(() => highlighter.value?.codeToHtml(sourceCode.value, {
68
- lang: 'html',
69
- theme: isDark.value ? 'github-dark' : 'github-light',
70
- }))
67
+ const sourceHtml = computed(() => sourceCode.value
68
+ ? highlighter.value?.codeToHtml(sourceCode.value, {
69
+ lang: 'html',
70
+ theme: isDark.value ? 'github-dark' : 'github-light',
71
+ })
72
+ : '')
71
73
  </script>
72
74
 
73
75
  <template>
@@ -96,6 +98,13 @@ const sourceHtml = computed(() => highlighter.value?.codeToHtml(sourceCode.value
96
98
  Error: {{ error }}
97
99
  </div>
98
100
 
101
+ <i
102
+ v-else-if="!sourceCode"
103
+ class="htw-opacity-50 htw-p-4"
104
+ >
105
+ Not available
106
+ </i>
107
+
99
108
  <textarea
100
109
  v-else-if="!sourceHtml"
101
110
  class="__histoire-code-placeholder htw-w-full htw-h-full htw-p-4 htw-outline-none htw-bg-transparent htw-resize-none htw-m-0"
@@ -2,7 +2,7 @@
2
2
  import { useFocus, useDebounce } from '@vueuse/core'
3
3
  import { computed, ref, watch } from 'vue'
4
4
  import { Icon } from '@iconify/vue'
5
- import flexsearch from 'flexsearch'
5
+ import * as flexsearch from 'flexsearch'
6
6
  import charset from 'flexsearch/dist/module/lang/latin/advanced.js'
7
7
  import language from 'flexsearch/dist/module/lang/en.js'
8
8
  import { useStoryStore } from '../../stores/story'