@histoire/app 0.13.0 → 0.13.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.
@@ -1,5 +1,12 @@
1
+ import { isDark as isDark$1 } from "./util/dark.js";
2
+ import { toggleDark } from "./util/dark.js";
1
3
  import { logEvent } from "./util/events.js";
2
4
  "use strict";
5
+ function isDark() {
6
+ return isDark$1.value;
7
+ }
3
8
  export {
4
- logEvent
9
+ isDark,
10
+ logEvent,
11
+ toggleDark
5
12
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, resolveDirective, openBlock, createElementBlock, createElementVNode, unref, createVNode, withDirectives } from "@histoire/vendors/vue";
1
+ import { defineComponent, computed, resolveDirective, openBlock, createElementBlock, createElementVNode, unref, createVNode, withDirectives, createCommentVNode } from "@histoire/vendors/vue";
2
2
  import { Icon } from "@histoire/vendors/iconify";
3
3
  import "./AppLogo.vue.js";
4
4
  import { isDark, toggleDark } from "../../util/dark.js";
@@ -50,7 +50,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
50
50
  ])), [
51
51
  [_directive_tooltip, unref(makeTooltip)("Search", ({ isMac }) => isMac ? "meta+k" : "ctrl+k")]
52
52
  ]),
53
- withDirectives((openBlock(), createElementBlock("a", {
53
+ !unref(histoireConfig).theme.hideColorSchemeSwitch ? withDirectives((openBlock(), createElementBlock("a", {
54
+ key: 0,
54
55
  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",
55
56
  onClick: _cache[1] || (_cache[1] = ($event) => unref(toggleDark)())
56
57
  }, [
@@ -60,7 +61,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
60
61
  }, null, 8, ["icon"])
61
62
  ])), [
62
63
  [_directive_tooltip, unref(makeTooltip)("Toggle dark mode", ({ isMac }) => isMac ? "meta+shift+d" : "ctrl+shift+d")]
63
- ])
64
+ ]) : createCommentVNode("", true)
64
65
  ])
65
66
  ]);
66
67
  };
@@ -11,6 +11,10 @@
11
11
  }
12
12
  }
13
13
 
14
+ .bind-icon-color[data-v-36846ccf] {
15
+ color: var(--5792748b);
16
+ }
17
+
14
18
  .landscape > div > .dragger[data-v-ed925107] {
15
19
  width: .625rem;
16
20
  }
@@ -36,14 +40,17 @@
36
40
  bottom: -.625rem;
37
41
  }
38
42
 
39
- .bind-icon-color[data-v-36846ccf] {
40
- color: var(--5792748b);
41
- }
42
-
43
43
  .bind-icon-color[data-v-6046525f] {
44
44
  color: var(--663732b6);
45
45
  }
46
46
 
47
+ .bind-tree-margin[data-v-19810958] {
48
+ margin-left: var(--444efc12);
49
+ }
50
+ .bind-icon-color[data-v-19810958] {
51
+ color: var(--ae892164);
52
+ }
53
+
47
54
  .bind-tree-padding[data-v-2d2e4786] {
48
55
  padding-left: var(--6851b0a7);
49
56
  }
@@ -53,19 +60,16 @@
53
60
  font-size: inherit;
54
61
  }
55
62
 
56
- .bind-tree-margin[data-v-19810958] {
57
- margin-left: var(--444efc12);
58
- }
59
- .bind-icon-color[data-v-19810958] {
60
- color: var(--ae892164);
63
+ .bind-icon-color[data-v-ddfc5b4f] {
64
+ color: var(--4d25d048);
61
65
  }
62
66
 
63
67
  .bind-icon-color[data-v-ab890d9c] {
64
68
  color: var(--89126aaa);
65
69
  }
66
70
 
67
- .bind-icon-color[data-v-ddfc5b4f] {
68
- color: var(--4d25d048);
71
+ .bind-icon-color[data-v-d95fcb03] {
72
+ color: var(--beebbd52);
69
73
  }
70
74
 
71
75
  .bind-icon-color[data-v-f7c98176] {
@@ -80,10 +84,6 @@
80
84
  color: var(--35068428);
81
85
  }
82
86
 
83
- .bind-icon-color[data-v-d95fcb03] {
84
- color: var(--beebbd52);
85
- }
86
-
87
87
  .bind-preview-bg[data-v-a83b1911] {
88
88
  background-color: var(--03d1950e);
89
89
  }
@@ -1,7 +1,12 @@
1
1
  import { watch } from "@histoire/vendors/vue";
2
2
  import { useDark, useToggle } from "@histoire/vendors/vue-use";
3
+ import { histoireConfig } from "./config.js";
3
4
  "use strict";
4
- const isDark = useDark({ valueDark: "htw-dark" });
5
+ const isDark = useDark({
6
+ valueDark: "htw-dark",
7
+ initialValue: histoireConfig.theme.defaultColorScheme,
8
+ storageKey: histoireConfig.theme.storeColorScheme ? "histoire-color-scheme" : null
9
+ });
5
10
  const toggleDark = useToggle(isDark);
6
11
  function applyDarkToControls() {
7
12
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
4
4
  "description": "Pre-bundled UI for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "types": "./src/index.ts",
26
26
  "dependencies": {
27
- "@histoire/controls": "^0.13.0",
28
- "@histoire/shared": "^0.13.0",
29
- "@histoire/vendors": "^0.13.0",
27
+ "@histoire/controls": "^0.13.2",
28
+ "@histoire/shared": "^0.13.2",
29
+ "@histoire/vendors": "^0.13.2",
30
30
  "@types/flexsearch": "^0.7.3",
31
31
  "flexsearch": "0.7.21",
32
- "shiki-es": "^0.1.2"
32
+ "shiki-es": "^0.2.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@tailwindcss/typography": "^0.5.2",
package/src/app/api.ts CHANGED
@@ -1 +1,9 @@
1
+ import { isDark as _isDark } from './util/dark.js'
2
+
1
3
  export { logEvent } from './util/events.js'
4
+
5
+ export { toggleDark } from './util/dark.js'
6
+
7
+ export function isDark () {
8
+ return _isDark.value
9
+ }
@@ -50,6 +50,7 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
50
50
  </a>
51
51
 
52
52
  <a
53
+ v-if="!histoireConfig.theme.hideColorSchemeSwitch"
53
54
  v-tooltip="makeTooltip('Toggle dark mode', ({ isMac }) => isMac ? 'meta+shift+d' : 'ctrl+shift+d')"
54
55
  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"
55
56
  @click="toggleDark()"
@@ -1,7 +1,12 @@
1
1
  import { watch } from 'vue'
2
2
  import { useDark, useToggle } from '@vueuse/core'
3
+ import { histoireConfig } from './config.js'
3
4
 
4
- export const isDark = useDark({ valueDark: 'htw-dark' })
5
+ export const isDark = useDark({
6
+ valueDark: 'htw-dark',
7
+ initialValue: histoireConfig.theme.defaultColorScheme,
8
+ storageKey: histoireConfig.theme.storeColorScheme ? 'histoire-color-scheme' : null,
9
+ })
5
10
  export const toggleDark = useToggle(isDark)
6
11
 
7
12
  function applyDarkToControls () {