histoire 0.2.3 → 0.2.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.
@@ -39,7 +39,7 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
39
39
  <div class="htw-ml-auto htw-flex-none htw-flex">
40
40
  <a
41
41
  v-tooltip="makeTooltip('Search', ({ isMac }) => isMac ? 'meta+k' : 'ctrl+k')"
42
- class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
42
+ 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"
43
43
  data-test-id="search-btn"
44
44
  @click="$emit('search')"
45
45
  >
@@ -51,7 +51,7 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
51
51
 
52
52
  <a
53
53
  v-tooltip="makeTooltip('Toggle dark mode', ({ isMac }) => isMac ? 'meta+shift+d' : 'ctrl+shift+d')"
54
- class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
54
+ 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
55
  @click="toggleDark()"
56
56
  >
57
57
  <Icon
@@ -36,7 +36,7 @@ export default defineComponent({
36
36
  >
37
37
  <a
38
38
  :href="href"
39
- class="htw-flex htw-items-center htw-gap-2"
39
+ class="htw-flex htw-items-center htw-gap-2 htw-text-gray-900 dark:htw-text-gray-100"
40
40
  :class="[
41
41
  $attrs.class,
42
42
  (isActive != null ? isActive : linkIsActive)
@@ -27,7 +27,7 @@ export default defineComponent({
27
27
  <a
28
28
  v-bind="$attrs"
29
29
  :href="href"
30
- class="htw-px-4 htw-h-full htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative"
30
+ class="htw-px-4 htw-h-full htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative htw-text-gray-900 dark:htw-text-gray-100"
31
31
  :class="{
32
32
  'htw-text-primary-500 dark:htw-text-primary-400': matched != null ? matched : (exact && isExactActive) || (!exact && isActive),
33
33
  }"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useFocus } from '@vueuse/core'
2
+ import { useFocus, useDebounce } from '@vueuse/core'
3
3
  import { computed, ref, watch } from 'vue'
4
4
  import { Icon } from '@iconify/vue'
5
5
  import { useStoryStore } from '../../stores/story'
@@ -40,7 +40,8 @@ watch(() => props.shown, value => {
40
40
 
41
41
  // Search
42
42
 
43
- const search = ref('')
43
+ const searchInputText = ref('')
44
+ const rateLimitedSearch = useDebounce(searchInputText, 300)
44
45
 
45
46
  const storyStore = useStoryStore()
46
47
 
@@ -85,8 +86,8 @@ function variantResultFactory (story: Story, variant: Variant, rank: number): Se
85
86
 
86
87
  const results = computed(() => {
87
88
  const list: SearchResult[] = []
88
- if (search.value) {
89
- const s = search.value.toLowerCase()
89
+ if (rateLimitedSearch.value) {
90
+ const s = rateLimitedSearch.value.toLowerCase()
90
91
  for (const story of storyStore.stories) {
91
92
  const storyMatched = story.title.toLowerCase().includes(s)
92
93
  let storyPathMatched = false
@@ -149,7 +150,7 @@ function selectPrevious () {
149
150
 
150
151
  <input
151
152
  ref="input"
152
- v-model="search"
153
+ v-model="searchInputText"
153
154
  placeholder="Search for stories, variants..."
154
155
  class="htw-bg-transparent htw-w-full htw-flex-1 htw-pl-0 htw-pr-6 htw-py-4 htw-outline-none"
155
156
  @keydown.down.prevent="selectNext()"
@@ -158,7 +159,7 @@ function selectPrevious () {
158
159
  >
159
160
  </div>
160
161
 
161
- <BaseEmpty v-if="search && !results.length">
162
+ <BaseEmpty v-if="rateLimitedSearch && !results.length">
162
163
  No results
163
164
  </BaseEmpty>
164
165
 
@@ -19,7 +19,7 @@ const sandboxUrl = computed(() => {
19
19
  v-tooltip="'Open variant in new tab'"
20
20
  :href="sandboxUrl"
21
21
  target="_blank"
22
- class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100"
22
+ class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
23
23
  >
24
24
  <Icon
25
25
  icon="carbon:launch"
package/dist/style.css CHANGED
@@ -1575,6 +1575,11 @@ button {
1575
1575
  color:rgb(255 255 255 / 0.4)
1576
1576
  }
1577
1577
 
1578
+ .htw-text-gray-900{
1579
+ --tw-text-opacity:1;
1580
+ color:rgb(var(--_histoire-color-gray-900) / var(--tw-text-opacity))
1581
+ }
1582
+
1578
1583
  .htw-text-primary-500{
1579
1584
  --tw-text-opacity:1;
1580
1585
  color:rgb(var(--_histoire-color-primary-500) / var(--tw-text-opacity))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.2.3",
3
+ "version": "0.2.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.2.3",
36
+ "@histoire/controls": "^0.2.4",
37
37
  "@iconify/vue": "^3.2.1",
38
38
  "@vitejs/plugin-vue": "^2.3.1",
39
39
  "@vueuse/core": "^8.2.5",
@@ -39,7 +39,7 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
39
39
  <div class="htw-ml-auto htw-flex-none htw-flex">
40
40
  <a
41
41
  v-tooltip="makeTooltip('Search', ({ isMac }) => isMac ? 'meta+k' : 'ctrl+k')"
42
- class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
42
+ 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"
43
43
  data-test-id="search-btn"
44
44
  @click="$emit('search')"
45
45
  >
@@ -51,7 +51,7 @@ onKeyboardShortcut(['ctrl+shift+d', 'meta+shift+d'], (event) => {
51
51
 
52
52
  <a
53
53
  v-tooltip="makeTooltip('Toggle dark mode', ({ isMac }) => isMac ? 'meta+shift+d' : 'ctrl+shift+d')"
54
- class="htw-p-2 sm:htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer"
54
+ 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
55
  @click="toggleDark()"
56
56
  >
57
57
  <Icon
@@ -36,7 +36,7 @@ export default defineComponent({
36
36
  >
37
37
  <a
38
38
  :href="href"
39
- class="htw-flex htw-items-center htw-gap-2"
39
+ class="htw-flex htw-items-center htw-gap-2 htw-text-gray-900 dark:htw-text-gray-100"
40
40
  :class="[
41
41
  $attrs.class,
42
42
  (isActive != null ? isActive : linkIsActive)
@@ -27,7 +27,7 @@ export default defineComponent({
27
27
  <a
28
28
  v-bind="$attrs"
29
29
  :href="href"
30
- class="htw-px-4 htw-h-full htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative"
30
+ class="htw-px-4 htw-h-full htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative htw-text-gray-900 dark:htw-text-gray-100"
31
31
  :class="{
32
32
  'htw-text-primary-500 dark:htw-text-primary-400': matched != null ? matched : (exact && isExactActive) || (!exact && isActive),
33
33
  }"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { useFocus } from '@vueuse/core'
2
+ import { useFocus, useDebounce } from '@vueuse/core'
3
3
  import { computed, ref, watch } from 'vue'
4
4
  import { Icon } from '@iconify/vue'
5
5
  import { useStoryStore } from '../../stores/story'
@@ -40,7 +40,8 @@ watch(() => props.shown, value => {
40
40
 
41
41
  // Search
42
42
 
43
- const search = ref('')
43
+ const searchInputText = ref('')
44
+ const rateLimitedSearch = useDebounce(searchInputText, 300)
44
45
 
45
46
  const storyStore = useStoryStore()
46
47
 
@@ -85,8 +86,8 @@ function variantResultFactory (story: Story, variant: Variant, rank: number): Se
85
86
 
86
87
  const results = computed(() => {
87
88
  const list: SearchResult[] = []
88
- if (search.value) {
89
- const s = search.value.toLowerCase()
89
+ if (rateLimitedSearch.value) {
90
+ const s = rateLimitedSearch.value.toLowerCase()
90
91
  for (const story of storyStore.stories) {
91
92
  const storyMatched = story.title.toLowerCase().includes(s)
92
93
  let storyPathMatched = false
@@ -149,7 +150,7 @@ function selectPrevious () {
149
150
 
150
151
  <input
151
152
  ref="input"
152
- v-model="search"
153
+ v-model="searchInputText"
153
154
  placeholder="Search for stories, variants..."
154
155
  class="htw-bg-transparent htw-w-full htw-flex-1 htw-pl-0 htw-pr-6 htw-py-4 htw-outline-none"
155
156
  @keydown.down.prevent="selectNext()"
@@ -158,7 +159,7 @@ function selectPrevious () {
158
159
  >
159
160
  </div>
160
161
 
161
- <BaseEmpty v-if="search && !results.length">
162
+ <BaseEmpty v-if="rateLimitedSearch && !results.length">
162
163
  No results
163
164
  </BaseEmpty>
164
165
 
@@ -19,7 +19,7 @@ const sandboxUrl = computed(() => {
19
19
  v-tooltip="'Open variant in new tab'"
20
20
  :href="sandboxUrl"
21
21
  target="_blank"
22
- class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100"
22
+ class="htw-flex htw-items-center htw-gap-1 htw-h-full htw-px-2 hover:htw-text-primary-500 htw-opacity-50 hover:htw-opacity-100 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100"
23
23
  >
24
24
  <Icon
25
25
  icon="carbon:launch"
package/tsconfig.json CHANGED
@@ -27,6 +27,8 @@
27
27
  "alwaysStrict": true,
28
28
  "strictBindCallApply": true,
29
29
  "strictFunctionTypes": true,
30
+ // Volar
31
+ "jsx": "preserve",
30
32
  },
31
33
  "include": [
32
34
  "src"