@histoire/controls 0.16.4 → 0.16.5

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 (52) hide show
  1. package/dist/components/HstCopyIcon.vue.d.ts +10 -13
  2. package/dist/components/HstWrapper.vue.d.ts +22 -30
  3. package/dist/components/button/HstButton.story.vue.d.ts +1 -1
  4. package/dist/components/button/HstButton.vue.d.ts +10 -15
  5. package/dist/components/button/HstButtonGroup.story.vue.d.ts +1 -1
  6. package/dist/components/button/HstButtonGroup.vue.d.ts +26 -21
  7. package/dist/components/checkbox/HstCheckbox.story.vue.d.ts +1 -1
  8. package/dist/components/checkbox/HstCheckbox.vue.d.ts +18 -19
  9. package/dist/components/checkbox/HstCheckboxList.story.vue.d.ts +1 -1
  10. package/dist/components/checkbox/HstCheckboxList.vue.d.ts +28 -21
  11. package/dist/components/checkbox/HstSimpleCheckbox.story.vue.d.ts +1 -1
  12. package/dist/components/checkbox/HstSimpleCheckbox.vue.d.ts +17 -18
  13. package/dist/components/colorselect/HstColorSelect.story.vue.d.ts +1 -1
  14. package/dist/components/colorselect/HstColorSelect.vue.d.ts +18 -19
  15. package/dist/components/design-tokens/HstColorShades.story.vue.d.ts +1 -1
  16. package/dist/components/design-tokens/HstColorShades.vue.d.ts +25 -20
  17. package/dist/components/design-tokens/HstTokenGrid.story.vue.d.ts +1 -1
  18. package/dist/components/design-tokens/HstTokenGrid.vue.d.ts +30 -32
  19. package/dist/components/design-tokens/HstTokenList.story.vue.d.ts +1 -1
  20. package/dist/components/design-tokens/HstTokenList.vue.d.ts +19 -18
  21. package/dist/components/json/HstJson.story.vue.d.ts +1 -1
  22. package/dist/components/json/HstJson.vue.d.ts +20 -19
  23. package/dist/components/number/HstNumber.story.vue.d.ts +1 -1
  24. package/dist/components/number/HstNumber.vue.d.ts +18 -19
  25. package/dist/components/radio/HstRadio.story.vue.d.ts +1 -1
  26. package/dist/components/radio/HstRadio.vue.d.ts +26 -21
  27. package/dist/components/select/CustomSelect.vue.d.ts +23 -20
  28. package/dist/components/select/HstSelect.story.vue.d.ts +1 -1
  29. package/dist/components/select/HstSelect.vue.d.ts +26 -21
  30. package/dist/components/slider/HstSlider.story.vue.d.ts +1 -1
  31. package/dist/components/slider/HstSlider.vue.d.ts +33 -22
  32. package/dist/components/text/HstText.story.vue.d.ts +1 -1
  33. package/dist/components/text/HstText.vue.d.ts +18 -19
  34. package/dist/components/textarea/HstTextarea.story.vue.d.ts +1 -1
  35. package/dist/components/textarea/HstTextarea.vue.d.ts +18 -19
  36. package/dist/index.d.ts +1566 -530
  37. package/dist/index.es.js +5357 -4920
  38. package/dist/style-standalone.css +148 -145
  39. package/dist/style.css +1 -1
  40. package/package.json +26 -26
  41. package/src/components/checkbox/HstCheckbox.vue +3 -3
  42. package/src/components/checkbox/HstCheckboxList.vue +3 -3
  43. package/src/components/checkbox/HstSimpleCheckbox.vue +2 -2
  44. package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +3 -69
  45. package/src/components/json/HstJson.vue +2 -2
  46. package/src/components/select/CustomSelect.vue +2 -2
  47. package/src/components/select/HstSelect.vue +2 -2
  48. package/tsconfig.json +1 -2
  49. package/vite.config.ts +18 -9
  50. package/dist/peeky-preview.d.ts +0 -1
  51. package/peeky.config.ts +0 -21
  52. package/src/peeky-preview.ts +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/controls",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
4
4
  "description": "Prebuilt controls components",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -31,34 +31,34 @@
31
31
  "*.vue"
32
32
  ],
33
33
  "dependencies": {
34
- "@codemirror/commands": "^6.1.1",
35
- "@codemirror/lang-json": "^6.0.0",
36
- "@codemirror/language": "^6.2.1",
37
- "@codemirror/lint": "^6.0.0",
38
- "@codemirror/state": "^6.1.2",
39
- "@codemirror/theme-one-dark": "^6.1.0",
40
- "@codemirror/view": "^6.3.0",
41
- "@histoire/shared": "^0.16.4",
42
- "@histoire/vendors": "^0.16.0"
34
+ "@codemirror/commands": "^6.2.4",
35
+ "@codemirror/lang-json": "^6.0.1",
36
+ "@codemirror/language": "^6.8.0",
37
+ "@codemirror/lint": "^6.4.0",
38
+ "@codemirror/state": "^6.2.1",
39
+ "@codemirror/theme-one-dark": "^6.1.2",
40
+ "@codemirror/view": "^6.16.0",
41
+ "@histoire/shared": "^0.16.5",
42
+ "@histoire/vendors": "^0.16.5"
43
43
  },
44
44
  "devDependencies": {
45
- "@peeky/server": "^0.14.0",
46
- "@peeky/test": "^0.14.1",
47
- "@types/node": "^17.0.32",
48
- "@vitejs/plugin-vue": "^4.0.0",
45
+ "@types/node": "^17.0.45",
46
+ "@vitejs/plugin-vue": "^4.2.3",
49
47
  "@vue/runtime-dom": "^3.3.4",
50
- "@vue/test-utils": "^2.2.10",
51
- "@vueuse/core": "^9.12.0",
52
- "autoprefixer": "^10.4.4",
53
- "concurrently": "^7.1.0",
54
- "floating-vue": "^2.0.0-beta.19",
55
- "postcss": "^8.4.12",
48
+ "@vue/test-utils": "^2.4.1",
49
+ "@vueuse/core": "^9.13.0",
50
+ "autoprefixer": "^10.4.15",
51
+ "concurrently": "^7.6.0",
52
+ "floating-vue": "2.0.0-beta.19",
53
+ "jsdom": "^22.1.0",
54
+ "postcss": "^8.4.27",
56
55
  "postcss-import": "^14.1.0",
57
- "tailwindcss": "^3.0.23",
56
+ "tailwindcss": "^3.3.3",
58
57
  "typescript": "^4.9.5",
59
- "vite": "^4.4.8",
60
- "vue": "^3.2.47",
61
- "vue-tsc": "^1.0.24"
58
+ "vite": "^4.4.9",
59
+ "vitest": "^0.34.1",
60
+ "vue": "^3.3.4",
61
+ "vue-tsc": "^1.8.8"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "rimraf dist && pnpm run build:css && vite build && pnpm run build:types",
@@ -66,7 +66,7 @@
66
66
  "build:types": "vue-tsc --declaration --emitDeclarationOnly",
67
67
  "watch": "concurrently \"vite build --watch\" \"pnpm run build:types --watch\"",
68
68
  "watch:full": "concurrently \"vite build --watch\" \"pnpm run build:css --watch\" \"pnpm run build:types --watch\"",
69
- "test:open": "peeky open --port 5010",
70
- "test": "peeky run"
69
+ "test": "vitest run",
70
+ "test:dev": "vitest"
71
71
  }
72
72
  }
@@ -16,17 +16,17 @@ const props = defineProps<{
16
16
  title?: string
17
17
  }>()
18
18
 
19
- const emits = defineEmits({
19
+ const emit = defineEmits({
20
20
  'update:modelValue': (newValue: Booleanish) => true,
21
21
  })
22
22
 
23
23
  function toggle () {
24
24
  if (typeof props.modelValue === 'string') {
25
- emits('update:modelValue', props.modelValue === 'false' ? 'true' : 'false')
25
+ emit('update:modelValue', props.modelValue === 'false' ? 'true' : 'false')
26
26
  return
27
27
  }
28
28
 
29
- emits('update:modelValue', !props.modelValue)
29
+ emit('update:modelValue', !props.modelValue)
30
30
  }
31
31
 
32
32
  const isTrue = computed(() => {
@@ -29,15 +29,15 @@ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
29
29
  return props.options
30
30
  })
31
31
 
32
- const emits = defineEmits<{
32
+ const emit = defineEmits<{
33
33
  (e: 'update:modelValue', value: Array<string>): void
34
34
  }>()
35
35
 
36
36
  function toggleOption (value: string) {
37
37
  if (props.modelValue.includes(value)) {
38
- emits('update:modelValue', props.modelValue.filter(element => element !== value))
38
+ emit('update:modelValue', props.modelValue.filter(element => element !== value))
39
39
  } else {
40
- emits('update:modelValue', [...props.modelValue, value])
40
+ emit('update:modelValue', [...props.modelValue, value])
41
41
  }
42
42
  }
43
43
  </script>
@@ -12,7 +12,7 @@ const props = defineProps<{
12
12
  withToggle?: boolean
13
13
  }>()
14
14
 
15
- const emits = defineEmits({
15
+ const emit = defineEmits({
16
16
  'update:modelValue': (newValue: boolean) => true,
17
17
  })
18
18
 
@@ -21,7 +21,7 @@ function toggle () {
21
21
  return
22
22
  }
23
23
 
24
- emits('update:modelValue', !props.modelValue)
24
+ emit('update:modelValue', !props.modelValue)
25
25
  }
26
26
 
27
27
  watch(() => props.modelValue, () => {
@@ -1,71 +1,5 @@
1
- // Peeky snapshots v1.0
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
- exports[`HstCheckbox toggle to checked 1`] = `
4
- <label
5
- 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"
6
- role="checkbox"
7
- tabindex="0"
8
- >
9
- <span class="htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip">
10
- Label
11
- </span>
12
- <span class="htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1">
13
- <span class="htw-block htw-grow htw-max-w-full">
14
- <div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative">
15
- <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">
16
- </div>
17
- <svg
18
- width="16"
19
- height="16"
20
- viewbox="0 0 24 24"
21
- class="htw-relative htw-z-10"
22
- >
23
- <path
24
- d="m 4 12 l 5 5 l 10 -10"
25
- fill="none"
26
- class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none"
27
- stroke-dasharray="21.21"
28
- stroke-dashoffset="21.21"
29
- >
30
- </path>
31
- </svg>
32
- </div>
33
- </span>
34
- </span>
35
- </label>
36
- `;
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>"`;
37
4
 
38
- exports[`HstCheckbox toggle to unchecked 1`] = `
39
- <label
40
- 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"
41
- role="checkbox"
42
- tabindex="0"
43
- >
44
- <span class="htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip">
45
- Label
46
- </span>
47
- <span class="htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1">
48
- <span class="htw-block htw-grow htw-max-w-full">
49
- <div class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative">
50
- <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">
51
- </div>
52
- <svg
53
- width="16"
54
- height="16"
55
- viewbox="0 0 24 24"
56
- class="htw-relative htw-z-10"
57
- >
58
- <path
59
- d="m 4 12 l 5 5 l 10 -10"
60
- fill="none"
61
- class="htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150"
62
- stroke-dasharray="21.21"
63
- stroke-dashoffset="0"
64
- >
65
- </path>
66
- </svg>
67
- </div>
68
- </span>
69
- </span>
70
- </label>
71
- `;
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>"`;
@@ -38,7 +38,7 @@ const props = defineProps<{
38
38
  modelValue: unknown
39
39
  }>()
40
40
 
41
- const emits = defineEmits({
41
+ const emit = defineEmits({
42
42
  'update:modelValue': (newValue: unknown) => true,
43
43
  })
44
44
 
@@ -106,7 +106,7 @@ watch(() => props.modelValue, () => {
106
106
  watch(() => internalValue.value, () => {
107
107
  invalidValue.value = false
108
108
  try {
109
- emits('update:modelValue', JSON.parse(internalValue.value))
109
+ emit('update:modelValue', JSON.parse(internalValue.value))
110
110
  } catch (e) {
111
111
  invalidValue.value = true
112
112
  }
@@ -15,7 +15,7 @@ const props = defineProps<{
15
15
  options: Record<string, any> | string[] | number[] | HstControlOption[]
16
16
  }>()
17
17
 
18
- const emits = defineEmits<{
18
+ const emit = defineEmits<{
19
19
  (e: 'update:modelValue', value: string): void
20
20
  }>()
21
21
 
@@ -36,7 +36,7 @@ const formattedOptions: ComputedRef<[any, string][]> = computed(() => {
36
36
  const selectedLabel = computed(() => formattedOptions.value.find(([value]) => value === props.modelValue)?.[1])
37
37
 
38
38
  function selectValue (value: any, hide: () => void) {
39
- emits('update:modelValue', value)
39
+ emit('update:modelValue', value)
40
40
  hide()
41
41
  }
42
42
  </script>
@@ -15,7 +15,7 @@ defineProps<{
15
15
  options: Record<string, any> | string[] | HstControlOption[]
16
16
  }>()
17
17
 
18
- const emits = defineEmits<{
18
+ const emit = defineEmits<{
19
19
  (e: 'update:modelValue', value: any): void
20
20
  }>()
21
21
  </script>
@@ -30,7 +30,7 @@ const emits = defineEmits<{
30
30
  <CustomSelect
31
31
  :options="options"
32
32
  :model-value="modelValue"
33
- @update:model-value="emits('update:modelValue', $event)"
33
+ @update:model-value="emit('update:modelValue', $event)"
34
34
  />
35
35
 
36
36
  <template #actions>
package/tsconfig.json CHANGED
@@ -12,8 +12,7 @@
12
12
  "resolveJsonModule": true,
13
13
  "skipLibCheck": true,
14
14
  "types": [
15
- "node",
16
- "@peeky/test"
15
+ "node"
17
16
  ],
18
17
  "lib": [
19
18
  "ESNext",
package/vite.config.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference types="vitest" />
2
+
1
3
  import { defineConfig } from 'vite'
2
4
  import vue from '@vitejs/plugin-vue'
3
5
 
@@ -6,15 +8,17 @@ export default defineConfig({
6
8
  vue(),
7
9
  ],
8
10
  resolve: {
9
- alias: {
10
- 'floating-vue': '@histoire/vendors/floating-vue',
11
- '@iconify/vue': '@histoire/vendors/iconify',
12
- pinia: '@histoire/vendors/pinia',
13
- 'scroll-into-view-if-needed': '@histoire/vendors/scroll',
14
- 'vue-router': '@histoire/vendors/vue-router',
15
- '@vueuse/core': '@histoire/vendors/vue-use',
16
- vue: '@histoire/vendors/vue',
17
- },
11
+ alias: process.env.VITEST
12
+ ? {}
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
+ },
18
22
  },
19
23
 
20
24
  build: {
@@ -34,4 +38,9 @@ export default defineConfig({
34
38
  ],
35
39
  },
36
40
  },
41
+
42
+ test: {
43
+ environment: 'jsdom',
44
+ globals: true,
45
+ },
37
46
  })
@@ -1 +0,0 @@
1
- import './style/main.css';
package/peeky.config.ts DELETED
@@ -1,21 +0,0 @@
1
- import { defineConfig } from '@peeky/test'
2
-
3
- export default defineConfig({
4
- runtimeEnv: 'dom',
5
- previewSetupFiles: [
6
- 'src/peeky-preview.ts',
7
- ],
8
- vite: {
9
- resolve: {
10
- alias: {
11
- 'floating-vue': 'floating-vue',
12
- '@iconify/vue': '@iconify/vue',
13
- pinia: 'pinia',
14
- 'scroll-into-view-if-needed': 'scroll-into-view-if-needed',
15
- 'vue-router': 'vue-router',
16
- '@vueuse/core': '@vueuse/core',
17
- vue: 'vue',
18
- },
19
- },
20
- },
21
- })
@@ -1 +0,0 @@
1
- import './style/main.css'