@histoire/controls 0.15.0 → 0.15.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.
package/dist/index.es.js CHANGED
@@ -525,10 +525,13 @@ const Qa = {
525
525
  }, Me = /* @__PURE__ */ tt({
526
526
  ...Xa,
527
527
  props: {
528
- content: null
528
+ content: { type: [String, Function] }
529
529
  },
530
530
  setup(s) {
531
- const t = s, { copy: e, copied: i } = da(), n = () => e(t.content);
531
+ const t = s, { copy: e, copied: i } = da(), n = async () => {
532
+ const r = typeof t.content == "function" ? await t.content() : t.content;
533
+ e(r);
534
+ };
532
535
  return (r, o) => Wt((C(), Q(H(zs), {
533
536
  icon: "carbon:copy-file",
534
537
  class: "htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/controls",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Prebuilt controls components",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -38,7 +38,8 @@
38
38
  "@codemirror/state": "^6.1.2",
39
39
  "@codemirror/theme-one-dark": "^6.1.0",
40
40
  "@codemirror/view": "^6.3.0",
41
- "@histoire/vendors": "^0.15.0"
41
+ "@histoire/shared": "^0.15.2",
42
+ "@histoire/vendors": "^0.15.2"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@peeky/server": "^0.14.0",
@@ -8,14 +8,18 @@ export default {
8
8
  import { Icon } from '@iconify/vue'
9
9
  import { useClipboard } from '@vueuse/core'
10
10
  import { VTooltip as vTooltip } from 'floating-vue'
11
+ import type { Awaitable } from '@histoire/shared'
11
12
 
12
13
  const props = defineProps<{
13
- content: string
14
+ content: string | (() => Awaitable<string>)
14
15
  }>()
15
16
 
16
17
  const { copy, copied } = useClipboard()
17
18
 
18
- const action = () => copy(props.content)
19
+ const action = async () => {
20
+ const content = typeof props.content === 'function' ? await props.content() : props.content
21
+ copy(content)
22
+ }
19
23
  </script>
20
24
 
21
25
  <template>
@@ -12,7 +12,7 @@ import HstButton from './HstButton.vue'
12
12
 
13
13
  const props = defineProps<{
14
14
  title?: string
15
- modelValue: string
15
+ modelValue?: string
16
16
  options: string[] | number[] | HstControlOption[] | Record<string, string | number>
17
17
  }>()
18
18
 
@@ -9,7 +9,7 @@ import HstWrapper from '../HstWrapper.vue'
9
9
  import HstSimpleCheckbox from './HstSimpleCheckbox.vue'
10
10
 
11
11
  const props = defineProps<{
12
- modelValue: boolean
12
+ modelValue?: boolean
13
13
  title?: string
14
14
  }>()
15
15
 
@@ -8,7 +8,7 @@ export default {
8
8
  import { computed, ref, watch } from 'vue'
9
9
 
10
10
  const props = defineProps<{
11
- modelValue: boolean
11
+ modelValue?: boolean
12
12
  withToggle?: boolean
13
13
  }>()
14
14
 
@@ -11,7 +11,7 @@ import HstWrapper from '../HstWrapper.vue'
11
11
 
12
12
  const props = defineProps<{
13
13
  title?: string
14
- modelValue: number
14
+ modelValue?: number
15
15
  }>()
16
16
 
17
17
  const emit = defineEmits({
@@ -11,7 +11,7 @@ import { HstControlOption } from '../../types'
11
11
 
12
12
  const props = defineProps<{
13
13
  title?: string
14
- modelValue: string
14
+ modelValue?: string
15
15
  options: HstControlOption[]
16
16
  }>()
17
17
 
@@ -11,7 +11,7 @@ import { HstControlOption } from '../../types'
11
11
 
12
12
  defineProps<{
13
13
  title?: string
14
- modelValue: string
14
+ modelValue?: string
15
15
  options: Record<string, any> | string[] | HstControlOption[]
16
16
  }>()
17
17
 
@@ -13,7 +13,7 @@ import { VTooltip as vTooltip } from 'floating-vue'
13
13
 
14
14
  const props = defineProps<{
15
15
  title?: string
16
- modelValue: number
16
+ modelValue?: number
17
17
  min: number
18
18
  max: number
19
19
  }>()
@@ -10,7 +10,7 @@ import HstWrapper from '../HstWrapper.vue'
10
10
 
11
11
  defineProps<{
12
12
  title?: string
13
- modelValue: string
13
+ modelValue?: string
14
14
  }>()
15
15
 
16
16
  const emit = defineEmits({
@@ -11,7 +11,7 @@ import HstWrapper from '../HstWrapper.vue'
11
11
 
12
12
  defineProps<{
13
13
  title?: string
14
- modelValue: string
14
+ modelValue?: string
15
15
  }>()
16
16
 
17
17
  const emit = defineEmits({