@histoire/controls 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 (117) hide show
  1. package/.histoire/dist/__sandbox.html +16 -0
  2. package/.histoire/dist/assets/BaseEmpty.d30f3079.js +11 -0
  3. package/.histoire/dist/assets/HomeView.8e044be6.js +24 -0
  4. package/.histoire/dist/assets/HstCheckbox.story.3d04d85b.js +144 -0
  5. package/.histoire/dist/assets/HstColorShades.story.68cf74d1.js +532 -0
  6. package/.histoire/dist/assets/HstCopyIcon.e40e725e.js +51 -0
  7. package/.histoire/dist/assets/HstNumber.story.1e1964ff.js +160 -0
  8. package/.histoire/dist/assets/HstSelect.story.04860383.js +277 -0
  9. package/.histoire/dist/assets/HstText.story.c915d831.js +137 -0
  10. package/.histoire/dist/assets/HstTextarea.story.802b9c26.js +105 -0
  11. package/.histoire/dist/assets/HstTokenGrid.story.025819d6.js +148 -0
  12. package/.histoire/dist/assets/HstTokenList.story.d3aa6575.js +176 -0
  13. package/.histoire/dist/assets/HstWrapper.246b6982.js +56 -0
  14. package/.histoire/dist/assets/SearchPane.daa2675c.js +426 -0
  15. package/.histoire/dist/assets/StoryView.2f64dad1.js +2260 -0
  16. package/.histoire/dist/assets/bundle-main.784e5bf7.js +1156 -0
  17. package/.histoire/dist/assets/bundle-sandbox.5e153933.js +84 -0
  18. package/.histoire/dist/assets/const.268165fd.js +658 -0
  19. package/.histoire/dist/assets/global-components.6736b2a9.js +5722 -0
  20. package/.histoire/dist/assets/search-docs-data.b9a75539.js +6 -0
  21. package/.histoire/dist/assets/style.04507241.css +2504 -0
  22. package/.histoire/dist/assets/vendor.2833ae3d.js +28970 -0
  23. package/.histoire/dist/index.html +16 -0
  24. package/dist/components/HstCopyIcon.vue.d.ts +3 -12
  25. package/dist/components/HstWrapper.vue.d.ts +4 -27
  26. package/dist/components/button/HstButton.story.vue.d.ts +1 -1
  27. package/dist/components/button/HstButton.vue.d.ts +3 -12
  28. package/dist/components/button/HstButtonGroup.story.vue.d.ts +1 -1
  29. package/dist/components/button/HstButtonGroup.vue.d.ts +7 -16
  30. package/dist/components/checkbox/HstCheckbox.story.vue.d.ts +1 -1
  31. package/dist/components/checkbox/HstCheckbox.vue.d.ts +5 -14
  32. package/dist/components/checkbox/HstCheckboxList.story.vue.d.ts +1 -1
  33. package/dist/components/checkbox/HstCheckboxList.vue.d.ts +7 -16
  34. package/dist/components/checkbox/HstSimpleCheckbox.story.vue.d.ts +1 -1
  35. package/dist/components/checkbox/HstSimpleCheckbox.vue.d.ts +5 -14
  36. package/dist/components/colorselect/HstColorSelect.story.vue.d.ts +1 -1
  37. package/dist/components/colorselect/HstColorSelect.vue.d.ts +5 -14
  38. package/dist/components/design-tokens/HstColorShades.story.vue.d.ts +1 -1
  39. package/dist/components/design-tokens/HstColorShades.vue.d.ts +3 -12
  40. package/dist/components/design-tokens/HstTokenGrid.story.vue.d.ts +1 -1
  41. package/dist/components/design-tokens/HstTokenGrid.vue.d.ts +5 -28
  42. package/dist/components/design-tokens/HstTokenList.story.vue.d.ts +1 -1
  43. package/dist/components/design-tokens/HstTokenList.vue.d.ts +4 -13
  44. package/dist/components/json/HstJson.story.vue.d.ts +1 -1
  45. package/dist/components/json/HstJson.vue.d.ts +5 -14
  46. package/dist/components/number/HstNumber.story.vue.d.ts +1 -1
  47. package/dist/components/number/HstNumber.vue.d.ts +5 -14
  48. package/dist/components/radio/HstRadio.story.vue.d.ts +1 -1
  49. package/dist/components/radio/HstRadio.vue.d.ts +7 -16
  50. package/dist/components/select/CustomSelect.vue.d.ts +7 -16
  51. package/dist/components/select/HstSelect.story.vue.d.ts +1 -1
  52. package/dist/components/select/HstSelect.vue.d.ts +7 -16
  53. package/dist/components/slider/HstSlider.story.vue.d.ts +1 -1
  54. package/dist/components/slider/HstSlider.vue.d.ts +5 -14
  55. package/dist/components/text/HstText.story.vue.d.ts +1 -1
  56. package/dist/components/text/HstText.vue.d.ts +5 -14
  57. package/dist/components/textarea/HstTextarea.story.vue.d.ts +1 -1
  58. package/dist/components/textarea/HstTextarea.vue.d.ts +5 -14
  59. package/dist/index.d.ts +736 -2492
  60. package/dist/index.es.css +1 -0
  61. package/dist/index.es.js +5281 -4823
  62. package/dist/style-standalone.css +74 -66
  63. package/dist/utils.d.ts +1 -1
  64. package/package.json +32 -32
  65. package/src/components/HstCopyIcon.vue +2 -2
  66. package/src/components/HstWrapper.vue +1 -2
  67. package/src/components/button/HstButton.story.vue +1 -1
  68. package/src/components/button/HstButtonGroup.story.vue +2 -2
  69. package/src/components/button/HstButtonGroup.vue +8 -5
  70. package/src/components/checkbox/HstCheckbox.spec.ts +3 -3
  71. package/src/components/checkbox/HstCheckbox.story.vue +1 -1
  72. package/src/components/checkbox/HstCheckbox.vue +2 -2
  73. package/src/components/checkbox/HstCheckboxList.story.vue +1 -1
  74. package/src/components/checkbox/HstCheckboxList.vue +9 -6
  75. package/src/components/checkbox/HstSimpleCheckbox.story.vue +1 -1
  76. package/src/components/checkbox/HstSimpleCheckbox.vue +2 -2
  77. package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +4 -0
  78. package/src/components/colorselect/HstColorSelect.vue +1 -4
  79. package/src/components/design-tokens/HstColorShades.story.vue +2 -2
  80. package/src/components/design-tokens/HstColorShades.vue +3 -3
  81. package/src/components/design-tokens/HstTokenGrid.story.vue +6 -6
  82. package/src/components/design-tokens/HstTokenGrid.vue +1 -1
  83. package/src/components/design-tokens/HstTokenList.story.vue +23 -23
  84. package/src/components/json/HstJson.story.vue +1 -1
  85. package/src/components/json/HstJson.vue +21 -18
  86. package/src/components/number/HstNumber.story.vue +1 -1
  87. package/src/components/number/HstNumber.vue +8 -8
  88. package/src/components/radio/HstRadio.story.vue +1 -1
  89. package/src/components/radio/HstRadio.vue +7 -5
  90. package/src/components/select/CustomSelect.vue +10 -8
  91. package/src/components/select/HstSelect.story.vue +1 -1
  92. package/src/components/select/HstSelect.vue +1 -1
  93. package/src/components/slider/HstSlider.vue +4 -4
  94. package/src/components/text/HstText.story.vue +1 -1
  95. package/src/components/textarea/HstTextarea.story.vue +1 -1
  96. package/src/index.ts +8 -8
  97. package/tailwind.config.cjs +1 -1
  98. package/tsconfig.json +26 -25
  99. package/vite.config.ts +9 -9
  100. package/dist/style.css +0 -1
  101. package/histoire-dist/__sandbox.html +0 -15
  102. package/histoire-dist/assets/BaseEmpty.a84c14c8.js +0 -1
  103. package/histoire-dist/assets/HomeView.f524bd4b.js +0 -1
  104. package/histoire-dist/assets/HstCheckbox.story.9f622545.js +0 -1
  105. package/histoire-dist/assets/HstInput.story.945401ce.js +0 -1
  106. package/histoire-dist/assets/SearchModal.76c035f2.js +0 -1
  107. package/histoire-dist/assets/StoryView.e4c41518.js +0 -15
  108. package/histoire-dist/assets/global-components.84d0ab22.js +0 -1
  109. package/histoire-dist/assets/histoire-text-dark.a529813a.svg +0 -89
  110. package/histoire-dist/assets/histoire-text.1d4474b5.svg +0 -89
  111. package/histoire-dist/assets/index.58f51dd0.js +0 -1
  112. package/histoire-dist/assets/preview-settings.a634d101.js +0 -1
  113. package/histoire-dist/assets/sandbox.2c60450a.js +0 -1
  114. package/histoire-dist/assets/style.7657d2ac.css +0 -1
  115. package/histoire-dist/assets/vendor.70a554f6.js +0 -9
  116. package/histoire-dist/index.html +0 -15
  117. /package/{histoire-dist/assets/histoire.8af7bd1f.svg → .histoire/dist/histoire.svg} +0 -0
@@ -3,3 +3,7 @@
3
3
  exports[`HstCheckbox > toggle to checked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"21.21\\"></path></svg></div></span></span></label>"`;
4
4
 
5
5
  exports[`HstCheckbox > toggle to unchecked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"0\\"></path></svg></div></span></span></label>"`;
6
+
7
+ exports[`hstCheckbox > toggle to checked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"21.21\\"></path></svg></div></span></span></label>"`;
8
+
9
+ exports[`hstCheckbox > toggle to unchecked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"0\\"></path></svg></div></span></span></label>"`;
@@ -6,7 +6,7 @@ export default {
6
6
  </script>
7
7
 
8
8
  <script lang="ts" setup>
9
- import { computed, ref } from 'vue'
9
+ import { computed } from 'vue'
10
10
  import HstWrapper from '../HstWrapper.vue'
11
11
 
12
12
  const props = defineProps<{
@@ -18,8 +18,6 @@ const emit = defineEmits({
18
18
  'update:modelValue': (newValue: string) => true,
19
19
  })
20
20
 
21
- const input = ref<HTMLInputElement>(null)
22
-
23
21
  const stringModel = computed({
24
22
  get: () => props.modelValue,
25
23
  set: value => {
@@ -72,7 +70,6 @@ function processChange(inp) {
72
70
  >
73
71
  <div class="htw-flex htw-flex-row htw-gap-1">
74
72
  <input
75
- ref="input"
76
73
  v-bind="{ ...$attrs, class: null, style: null }"
77
74
  v-model="stringModel"
78
75
  type="text"
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import HstColorShades from './HstColorShades.vue'
3
2
  import type { CSSProperties } from 'vue'
3
+ import HstColorShades from './HstColorShades.vue'
4
4
 
5
5
  const colors = {
6
6
  slate: {
@@ -329,7 +329,7 @@ const colors = {
329
329
  <div
330
330
  class="htw-rounded htw-h-[100px] htw-text-5xl htw-flex htw-items-end"
331
331
  :style="{
332
- color: color,
332
+ color,
333
333
  } as CSSProperties"
334
334
  >
335
335
  Aa
@@ -5,10 +5,10 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { computed, ref } from 'vue'
8
+ import type { CSSProperties } from 'vue'
9
9
  import { VTooltip as vTooltip } from 'floating-vue'
10
+ import { computed, ref } from 'vue'
10
11
  import HstCopyIcon from '../HstCopyIcon.vue'
11
- import type { CSSProperties } from 'vue'
12
12
 
13
13
  const props = defineProps<{
14
14
  shades: Record<string, any>
@@ -16,7 +16,7 @@ const props = defineProps<{
16
16
  search?: string
17
17
  }>()
18
18
 
19
- const flattenShades = (shades: Record<string, any>, path = ''): Record<string, string> => {
19
+ function flattenShades(shades: Record<string, any>, path = ''): Record<string, string> {
20
20
  return Object.entries(shades).reduce((acc, [key, color]) => {
21
21
  const nextPath = path ? key === 'DEFAULT' ? path : `${path}-${key}` : key
22
22
  const obj = typeof color === 'object' ? flattenShades(color, nextPath) : { [nextPath]: color }
@@ -2,13 +2,13 @@
2
2
  import HstTokenGrid from './HstTokenGrid.vue'
3
3
 
4
4
  const tokens = {
5
- sm: 'filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))',
6
- DEFAULT: 'filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))',
7
- md: 'filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))',
8
- lg: 'filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))',
9
- xl: 'filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))',
5
+ 'sm': 'filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.05))',
6
+ 'DEFAULT': 'filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06))',
7
+ 'md': 'filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))',
8
+ 'lg': 'filter: drop-shadow(0 10px 8px rgb(0 0 0 / 0.04)) drop-shadow(0 4px 3px rgb(0 0 0 / 0.1))',
9
+ 'xl': 'filter: drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08))',
10
10
  '2xl': 'filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15))',
11
- none: 'filter: drop-shadow(0 0 #0000)',
11
+ 'none': 'filter: drop-shadow(0 0 #0000)',
12
12
  }
13
13
  </script>
14
14
 
@@ -5,8 +5,8 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { computed, ref, withDefaults } from 'vue'
9
8
  import { VTooltip as vTooltip } from 'floating-vue'
9
+ import { computed, ref, withDefaults } from 'vue'
10
10
  import HstCopyIcon from '../HstCopyIcon.vue'
11
11
 
12
12
  const props = withDefaults(defineProps<{
@@ -1,29 +1,29 @@
1
1
  <script lang="ts" setup>
2
- import HstTokenList from './HstTokenList.vue'
3
2
  import type { CSSProperties } from 'vue'
3
+ import HstTokenList from './HstTokenList.vue'
4
4
 
5
5
  const tokens = {
6
- 0: 0,
7
- 1: '0.25rem',
8
- 2: '0.5rem',
9
- 3: '0.75rem',
10
- 4: '1rem',
11
- 5: '1.25rem',
12
- 6: '1.5rem',
13
- 8: '2rem',
14
- 10: '2.5rem',
15
- 12: '3rem',
16
- 16: '4rem',
17
- 20: '5rem',
18
- 24: '6rem',
19
- 32: '8rem',
20
- 40: '10rem',
21
- 48: '12rem',
22
- 56: '14rem',
23
- 64: '16rem',
24
- auto: 'auto',
25
- px: '1px',
26
- screen: '100vw',
6
+ '0': 0,
7
+ '1': '0.25rem',
8
+ '2': '0.5rem',
9
+ '3': '0.75rem',
10
+ '4': '1rem',
11
+ '5': '1.25rem',
12
+ '6': '1.5rem',
13
+ '8': '2rem',
14
+ '10': '2.5rem',
15
+ '12': '3rem',
16
+ '16': '4rem',
17
+ '20': '5rem',
18
+ '24': '6rem',
19
+ '32': '8rem',
20
+ '40': '10rem',
21
+ '48': '12rem',
22
+ '56': '14rem',
23
+ '64': '16rem',
24
+ 'auto': 'auto',
25
+ 'px': '1px',
26
+ 'screen': '100vw',
27
27
  '1/2': '50%',
28
28
  '1/3': '33.333333%',
29
29
  '2/3': '66.666667%',
@@ -50,7 +50,7 @@ const tokens = {
50
50
  '9/12': '75%',
51
51
  '10/12': '83.333333%',
52
52
  '11/12': '91.666667%',
53
- full: '100%',
53
+ 'full': '100%',
54
54
  }
55
55
  </script>
56
56
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstJson from './HstJson.vue'
3
3
 
4
- function initState () {
4
+ function initState() {
5
5
  return {
6
6
  film: {
7
7
  year: 2017,
@@ -6,32 +6,34 @@ export default {
6
6
  </script>
7
7
 
8
8
  <script lang="ts" setup>
9
- import { ref, onMounted, watch, watchEffect } from 'vue'
10
- import { Icon } from '@iconify/vue'
11
- import HstWrapper from '../HstWrapper.vue'
12
- import { VTooltip as vTooltip } from 'floating-vue'
13
- import { Compartment } from '@codemirror/state'
14
- import {
15
- EditorView,
16
- keymap,
17
- highlightActiveLineGutter,
18
- highlightActiveLine,
19
- highlightSpecialChars,
9
+ import type {
20
10
  ViewUpdate,
21
11
  } from '@codemirror/view'
22
12
  import { defaultKeymap } from '@codemirror/commands'
23
13
  import { json } from '@codemirror/lang-json'
24
14
  import {
25
- defaultHighlightStyle,
26
- syntaxHighlighting,
27
- indentOnInput,
28
15
  bracketMatching,
16
+ defaultHighlightStyle,
29
17
  foldGutter,
30
18
  foldKeymap,
19
+ indentOnInput,
20
+ syntaxHighlighting,
31
21
  } from '@codemirror/language'
32
22
  import { lintKeymap } from '@codemirror/lint'
33
- import { oneDarkTheme, oneDarkHighlightStyle } from '@codemirror/theme-one-dark'
23
+ import { Compartment } from '@codemirror/state'
24
+ import { oneDarkHighlightStyle, oneDarkTheme } from '@codemirror/theme-one-dark'
25
+ import {
26
+ EditorView,
27
+ highlightActiveLine,
28
+ highlightActiveLineGutter,
29
+ highlightSpecialChars,
30
+ keymap,
31
+ } from '@codemirror/view'
32
+ import { Icon } from '@iconify/vue'
33
+ import { VTooltip as vTooltip } from 'floating-vue'
34
+ import { onMounted, ref, watch, watchEffect } from 'vue'
34
35
  import { isDark } from '../../utils'
36
+ import HstWrapper from '../HstWrapper.vue'
35
37
 
36
38
  const props = defineProps<{
37
39
  title?: string
@@ -94,7 +96,8 @@ watch(() => props.modelValue, () => {
94
96
 
95
97
  try {
96
98
  sameDocument = (JSON.stringify(JSON.parse(internalValue.value)) === JSON.stringify(props.modelValue))
97
- } catch (e) {
99
+ }
100
+ catch (e) {
98
101
  sameDocument = false
99
102
  }
100
103
 
@@ -107,11 +110,11 @@ watch(() => internalValue.value, () => {
107
110
  invalidValue.value = false
108
111
  try {
109
112
  emit('update:modelValue', JSON.parse(internalValue.value))
110
- } catch (e) {
113
+ }
114
+ catch (e) {
111
115
  invalidValue.value = true
112
116
  }
113
117
  })
114
-
115
118
  </script>
116
119
 
117
120
  <template>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstNumber from './HstNumber.vue'
3
3
 
4
- function initState () {
4
+ function initState() {
5
5
  return {
6
6
  count: 20,
7
7
  step: 1,
@@ -6,7 +6,7 @@ export default {
6
6
  </script>
7
7
 
8
8
  <script lang="ts" setup>
9
- import { computed, ref, onUnmounted } from 'vue'
9
+ import { computed, onUnmounted, ref } from 'vue'
10
10
  import HstWrapper from '../HstWrapper.vue'
11
11
 
12
12
  const props = defineProps<{
@@ -20,14 +20,14 @@ const emit = defineEmits({
20
20
 
21
21
  const numberModel = computed({
22
22
  get: () => props.modelValue,
23
- set: value => {
23
+ set: (value) => {
24
24
  emit('update:modelValue', value)
25
25
  },
26
26
  })
27
27
 
28
28
  const input = ref<HTMLInputElement>()
29
29
 
30
- function focusAndSelect () {
30
+ function focusAndSelect() {
31
31
  input.value.focus()
32
32
  input.value.select()
33
33
  }
@@ -38,7 +38,7 @@ const isDragging = ref(false)
38
38
  let startX: number
39
39
  let startValue: number
40
40
 
41
- function onMouseDown (event: MouseEvent) {
41
+ function onMouseDown(event: MouseEvent) {
42
42
  isDragging.value = true
43
43
  startX = event.clientX
44
44
  startValue = numberModel.value
@@ -46,15 +46,15 @@ function onMouseDown (event: MouseEvent) {
46
46
  window.addEventListener('mouseup', stopDragging)
47
47
  }
48
48
 
49
- function onMouseMove (event: MouseEvent) {
50
- let step = parseFloat(input.value.step)
51
- if (isNaN(step)) {
49
+ function onMouseMove(event: MouseEvent) {
50
+ let step = Number.parseFloat(input.value.step)
51
+ if (Number.isNaN(step)) {
52
52
  step = 1
53
53
  }
54
54
  numberModel.value = startValue + Math.round((event.clientX - startX) / 10 / step) * step
55
55
  }
56
56
 
57
- function stopDragging () {
57
+ function stopDragging() {
58
58
  isDragging.value = false
59
59
  window.removeEventListener('mousemove', onMouseMove)
60
60
  window.removeEventListener('mouseup', stopDragging)
@@ -14,7 +14,7 @@ const objectOptions = Object.keys(options).map(key => ({
14
14
  value: key,
15
15
  }))
16
16
 
17
- function initState () {
17
+ function initState() {
18
18
  return {
19
19
  character: flatOptions[0],
20
20
  }
@@ -5,9 +5,10 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { computed, ComputedRef, ref } from 'vue'
8
+ import type { ComputedRef } from 'vue'
9
+ import type { HstControlOption } from '../../types'
10
+ import { computed, ref } from 'vue'
9
11
  import HstWrapper from '../HstWrapper.vue'
10
- import { HstControlOption } from '../../types'
11
12
 
12
13
  const props = defineProps<{
13
14
  title?: string
@@ -20,7 +21,8 @@ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
20
21
  return Object.fromEntries(props.options.map((value: string | HstControlOption) => {
21
22
  if (typeof value === 'string') {
22
23
  return [value, value]
23
- } else {
24
+ }
25
+ else {
24
26
  return [value.value, value.label]
25
27
  }
26
28
  }))
@@ -32,7 +34,7 @@ const emit = defineEmits<{
32
34
  (e: 'update:modelValue', value: string): void
33
35
  }>()
34
36
 
35
- function selectOption (value: string) {
37
+ function selectOption(value: string) {
36
38
  emit('update:modelValue', value)
37
39
  animationEnabled.value = true
38
40
  }
@@ -51,7 +53,7 @@ const animationEnabled = ref(false)
51
53
  >
52
54
  <div class="-htw-my-1">
53
55
  <template
54
- v-for="( label, value ) in formattedOptions"
56
+ v-for="(label, value) in formattedOptions"
55
57
  :key="value"
56
58
  >
57
59
  <input
@@ -5,10 +5,11 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { Dropdown as VDropdown } from 'floating-vue'
9
- import { computed, ComputedRef } from 'vue'
8
+ import type { ComputedRef } from 'vue'
9
+ import type { HstControlOption } from '../../types'
10
10
  import { Icon } from '@iconify/vue'
11
- import { HstControlOption } from '../../types'
11
+ import { Dropdown as VDropdown } from 'floating-vue'
12
+ import { computed } from 'vue'
12
13
 
13
14
  const props = defineProps<{
14
15
  modelValue: string
@@ -21,21 +22,23 @@ const emit = defineEmits<{
21
22
 
22
23
  const formattedOptions: ComputedRef<[any, string][]> = computed(() => {
23
24
  if (Array.isArray(props.options)) {
24
- return props.options.map(option => {
25
+ return props.options.map((option) => {
25
26
  if (typeof option === 'string' || typeof option === 'number') {
26
27
  return [option, String(option)] as [any, string]
27
- } else {
28
+ }
29
+ else {
28
30
  return [option.value, option.label] as [any, string]
29
31
  }
30
32
  })
31
- } else {
33
+ }
34
+ else {
32
35
  return Object.entries(props.options)
33
36
  }
34
37
  })
35
38
 
36
39
  const selectedLabel = computed(() => formattedOptions.value.find(([value]) => value === props.modelValue)?.[1])
37
40
 
38
- function selectValue (value: any, hide: () => void) {
41
+ function selectValue(value: any, hide: () => void) {
39
42
  emit('update:modelValue', value)
40
43
  hide()
41
44
  }
@@ -113,5 +116,4 @@ function selectValue (value: any, hide: () => void) {
113
116
  .v-popper__popper:focus-visible {
114
117
  outline: none;
115
118
  }
116
-
117
119
  </style>
@@ -16,7 +16,7 @@ const objectOptions = Object.keys(options).map(key => ({
16
16
 
17
17
  const numberOptions = [0, 1, 2, 3, 4, 5]
18
18
 
19
- function initState () {
19
+ function initState() {
20
20
  return {
21
21
  label: 'My really long label',
22
22
  select: 'crash-bandicoot',
@@ -5,9 +5,9 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
+ import type { HstControlOption } from '../../types'
8
9
  import HstWrapper from '../HstWrapper.vue'
9
10
  import CustomSelect from './CustomSelect.vue'
10
- import { HstControlOption } from '../../types'
11
11
 
12
12
  defineProps<{
13
13
  title?: string
@@ -6,10 +6,10 @@ export default {
6
6
  </script>
7
7
 
8
8
  <script lang="ts" setup>
9
- import { computed, ref } from 'vue'
10
9
  import type { CSSProperties } from 'vue'
11
- import HstWrapper from '../HstWrapper.vue'
12
10
  import { VTooltip as vTooltip } from 'floating-vue'
11
+ import { computed, ref } from 'vue'
12
+ import HstWrapper from '../HstWrapper.vue'
13
13
 
14
14
  const props = defineProps<{
15
15
  title?: string
@@ -27,7 +27,7 @@ const input = ref<HTMLInputElement>(null)
27
27
 
28
28
  const numberModel = computed({
29
29
  get: () => props.modelValue,
30
- set: value => {
30
+ set: (value) => {
31
31
  emit('update:modelValue', value)
32
32
  },
33
33
  })
@@ -41,7 +41,7 @@ const tooltipStyle = computed<CSSProperties>(() => {
41
41
  if (input.value) {
42
42
  const position = gap + ((input.value.clientWidth - 2 * gap) * percentage.value)
43
43
  return {
44
- left: position + 'px',
44
+ left: `${position}px`,
45
45
  }
46
46
  }
47
47
  return {}
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstText from './HstText.vue'
3
3
 
4
- function initState () {
4
+ function initState() {
5
5
  return {
6
6
  label: 'My really long label',
7
7
  text: '',
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstTextarea from './HstTextarea.vue'
3
3
 
4
- function initState () {
4
+ function initState() {
5
5
  return {
6
6
  text: '',
7
7
  }
package/src/index.ts CHANGED
@@ -2,18 +2,18 @@ import HstButtonVue from './components/button/HstButton.vue'
2
2
  import HstButtonGroupVue from './components/button/HstButtonGroup.vue'
3
3
  import HstCheckboxVue from './components/checkbox/HstCheckbox.vue'
4
4
  import HstCheckboxListVue from './components/checkbox/HstCheckboxList.vue'
5
- import HstTextVue from './components/text/HstText.vue'
6
- import HstNumberVue from './components/number/HstNumber.vue'
7
- import HstSliderVue from './components/slider/HstSlider.vue'
8
- import HstTextareaVue from './components/textarea/HstTextarea.vue'
9
- import HstSelectVue from './components/select/HstSelect.vue'
5
+ import HstColorSelectVue from './components/colorselect/HstColorSelect.vue'
10
6
  import HstColorShadesVue from './components/design-tokens/HstColorShades.vue'
11
- import HstTokenListVue from './components/design-tokens/HstTokenList.vue'
12
7
  import HstTokenGridVue from './components/design-tokens/HstTokenGrid.vue'
8
+ import HstTokenListVue from './components/design-tokens/HstTokenList.vue'
13
9
  import HstCopyIconVue from './components/HstCopyIcon.vue'
14
- import HstRadioVue from './components/radio/HstRadio.vue'
15
10
  import HstJsonVue from './components/json/HstJson.vue'
16
- import HstColorSelectVue from './components/colorselect/HstColorSelect.vue'
11
+ import HstNumberVue from './components/number/HstNumber.vue'
12
+ import HstRadioVue from './components/radio/HstRadio.vue'
13
+ import HstSelectVue from './components/select/HstSelect.vue'
14
+ import HstSliderVue from './components/slider/HstSlider.vue'
15
+ import HstTextVue from './components/text/HstText.vue'
16
+ import HstTextareaVue from './components/textarea/HstTextarea.vue'
17
17
 
18
18
  export const HstButton = HstButtonVue
19
19
  export const HstButtonGroup = HstButtonGroupVue
@@ -1,4 +1,4 @@
1
- const path = require('path')
1
+ const path = require('node:path')
2
2
  const inheritedConfig = require('../../tailwind.config.cjs')
3
3
 
4
4
  module.exports = {
package/tsconfig.json CHANGED
@@ -1,34 +1,16 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "node",
6
- "outDir": "dist",
7
- "rootDir": "src",
8
- "baseUrl": ".",
9
- "allowSyntheticDefaultImports": true,
10
- "esModuleInterop": true,
11
- "removeComments": false,
12
- "resolveJsonModule": true,
13
- "skipLibCheck": true,
14
- "types": [
15
- "node"
16
- ],
4
+ // Volar
5
+ "jsx": "preserve",
17
6
  "lib": [
18
7
  "ESNext",
19
8
  "DOM"
20
9
  ],
21
- "sourceMap": false,
22
- "preserveWatchOutput": true,
23
- "preserveSymlinks": true,
24
- // Strict
25
- "noImplicitAny": false,
26
- "noImplicitThis": true,
27
- "alwaysStrict": true,
28
- "strictBindCallApply": true,
29
- "strictFunctionTypes": true,
30
- // Volar
31
- "jsx": "preserve",
10
+ "baseUrl": ".",
11
+ "rootDir": "src",
12
+ "module": "ESNext",
13
+ "moduleResolution": "node",
32
14
  // Alias
33
15
  "paths": {
34
16
  "floating-vue": ["./node_modules/@histoire/vendors/floating-vue"],
@@ -38,7 +20,26 @@
38
20
  "vue-router": ["./node_modules/@histoire/vendors/vue-router"],
39
21
  "@vueuse/core": ["./node_modules/@histoire/vendors/vue-use"],
40
22
  "vue": ["./node_modules/@histoire/vendors/vue"]
41
- }
23
+ },
24
+ "resolveJsonModule": true,
25
+ "types": [
26
+ "node"
27
+ ],
28
+ "strictBindCallApply": true,
29
+ "strictFunctionTypes": true,
30
+ "alwaysStrict": true,
31
+ // Strict
32
+ "noImplicitAny": false,
33
+ "noImplicitThis": true,
34
+ // Output
35
+ "outDir": "dist",
36
+ "removeComments": false,
37
+ "sourceMap": false,
38
+ "allowSyntheticDefaultImports": true,
39
+ "esModuleInterop": true,
40
+ "preserveSymlinks": true,
41
+ "skipLibCheck": true,
42
+ "preserveWatchOutput": true
42
43
  },
43
44
  "include": [
44
45
  "src"
package/vite.config.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /// <reference types="vitest" />
2
2
 
3
- import { defineConfig } from 'vite'
4
3
  import vue from '@vitejs/plugin-vue'
4
+ import { defineConfig } from 'vite'
5
5
 
6
6
  export default defineConfig({
7
7
  plugins: [
@@ -11,14 +11,14 @@ export default defineConfig({
11
11
  alias: process.env.VITEST
12
12
  ? {}
13
13
  : {
14
- 'floating-vue': '@histoire/vendors/floating-vue',
15
- '@iconify/vue': '@histoire/vendors/iconify',
16
- pinia: '@histoire/vendors/pinia',
17
- 'scroll-into-view-if-needed': '@histoire/vendors/scroll',
18
- 'vue-router': '@histoire/vendors/vue-router',
19
- '@vueuse/core': '@histoire/vendors/vue-use',
20
- vue: '@histoire/vendors/vue',
21
- },
14
+ 'floating-vue': '@histoire/vendors/floating-vue',
15
+ '@iconify/vue': '@histoire/vendors/iconify',
16
+ 'pinia': '@histoire/vendors/pinia',
17
+ 'scroll-into-view-if-needed': '@histoire/vendors/scroll',
18
+ 'vue-router': '@histoire/vendors/vue-router',
19
+ '@vueuse/core': '@histoire/vendors/vue-use',
20
+ 'vue': '@histoire/vendors/vue',
21
+ },
22
22
  },
23
23
 
24
24
  build: {
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- .htw-range-input::-webkit-slider-thumb{height:.75rem;width:.75rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.htw-dark .htw-range-input)::-webkit-slider-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-webkit-slider-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.htw-range-input::-moz-range-thumb{height:.75rem;width:.75rem;-moz-appearance:none;-webkit-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.htw-dark .htw-range-input)::-moz-range-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-moz-range-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}.__histoire-json-code[data-v-9f3f2832] .cm-editor{height:100%;min-width:280px}