{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/ui/skeleton/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-10-27 15:54:13\n * @LastEditTime: 2022-03-05 11:05:59\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\ui\\skeleton\\index.ts\n */\nimport { h, defineComponent, computed, VNode, ComponentPublicInstance } from 'vue'\n\nimport type { PropType } from 'vue'\n\nimport useDark, { useDarkProps } from 'casc-cesium-composables/private/use-dark'\n\nimport { hSlot } from 'casc-cesium-utils/private/render'\n\nexport const skeletonTypes = [\n  'text',\n  'rect',\n  'circle',\n  'VcBtn',\n  'VcBadge',\n  'VcChip',\n  'VcToolbar',\n  'VcCheckbox',\n  'VcRadio',\n  'VcToggle',\n  'VcSlider',\n  'VcRange',\n  'VcInput',\n  'VcAvatar'\n]\n\nexport const skeletonAnimations = ['wave', 'pulse', 'pulse-x', 'pulse-y', 'fade', 'blink', 'none']\nexport const skeletonProps = {\n  ...useDarkProps,\n\n  tag: {\n    type: String,\n    default: 'div'\n  },\n\n  type: {\n    type: String,\n    validator: (v: string) => skeletonTypes.includes(v),\n    default: 'rect'\n  },\n\n  animation: {\n    type: String as PropType<'wave' | 'pulse' | 'pulse-x' | 'pulse-y' | 'fade' | 'blink' | 'none'>,\n    validator: (v: string) => skeletonAnimations.includes(v),\n    default: 'wave'\n  },\n\n  square: Boolean,\n  bordered: Boolean,\n\n  size: String as PropType<string>,\n  width: String,\n  height: String\n}\nexport default defineComponent({\n  name: 'VcSkeleton',\n\n  props: skeletonProps,\n\n  setup(props, { slots }) {\n    const isDark = useDark(props)\n\n    const style = computed(() => (props.size !== void 0 ? { width: props.size, height: props.size } : { width: props.width, height: props.height }))\n\n    const classes = computed(\n      () =>\n        `vc-skeleton vc-skeleton--${isDark.value === true ? 'dark' : 'light'} vc-skeleton--type-${props.type}` +\n        (props.animation !== 'none' ? ` vc-skeleton--anim vc-skeleton--anim-${props.animation}` : '') +\n        (props.square === true ? ' vc-skeleton--square' : '') +\n        (props.bordered === true ? ' vc-skeleton--bordered' : '')\n    )\n\n    return () =>\n      h(\n        props.tag,\n        {\n          class: classes.value,\n          style: style.value\n        },\n        hSlot(slots.default)\n      )\n  }\n})\n\n// export type VcSkeletonProps = ExtractPropTypes<typeof skeletonProps>\nexport interface VcSkeletonProps {\n  /**\n   * Notify the component that the background is a dark color.\n   */\n  dark?: boolean | undefined\n  /**\n   * Type of skeleton placeholder.\n   * Default value: rect\n   */\n  type?:\n    | 'text'\n    | 'rect'\n    | 'circle'\n    | 'VcBtn'\n    | 'VcBadge'\n    | 'VcChip'\n    | 'VcToolbar'\n    | 'VcCheckbox'\n    | 'VcRadio'\n    | 'VcToggle'\n    | 'VcSlider'\n    | 'VcRange'\n    | 'VcInput'\n    | 'VcAvatar'\n    | undefined\n  /**\n   * The animation effect of the skeleton placeholder.\n   * Default value: wave\n   */\n  animation?: 'wave' | 'pulse' | 'pulse-x' | 'pulse-y' | 'fade' | 'blink' | 'none' | undefined\n  /**\n   * Animation speed (in milliseconds, without unit).\n   * Default value: 300\n   */\n  animationSpeed?: string | number | undefined\n  /**\n   * Removes border-radius so borders are squared.\n   */\n  square?: boolean | undefined\n  /**\n   * Applies a default border to the component.\n   */\n  bordered?: boolean | undefined\n  /**\n   * Size in CSS units, including unit name; Overrides 'height' and 'width' props and applies the value to both height and width.\n   */\n  size?: string | undefined\n  /**\n   * Width in CSS units, including unit name; Apply custom width; Use this prop or through CSS; Overridden by 'size' prop if used.\n   */\n  width?: string | undefined\n  /**\n   * Height in CSS units, including unit name; Apply custom height; Use this prop or through CSS; Overridden by 'size' prop if used.\n   */\n  height?: string | undefined\n  /**\n   * HTML tag to use.\n   * Default value: div\n   */\n  tag?: string | undefined\n  color?: string\n}\n\nexport interface VcSkeletonSlots {\n  /**\n   * Default slot in the devland unslotted content of the component\n   */\n  default: () => VNode[]\n}\n\nexport type VcSkeletonRef = ComponentPubl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