{"version":3,"file":"thumb.mjs","sources":["../../../../../../packages/components/thumb/src/thumb.ts"],"sourcesContent":["import { isNumber, isValidComponentSize, isValidComponentType } from '@hongluan-ui/utils'\n\nimport type { ExtractPropTypes, PropType } from 'vue'\nimport type { ComponentSize, ComponentType } from '@hongluan-ui/constants'\nimport type Thumb from './thumb.vue'\n\nexport const thumbProps = {\n  appendToBody: {\n    type: Boolean,\n    default: false,\n  },\n  /**\n   * @description when enabling preview, use this flag to control whether clicking on backdrop can exit preview mode.\n   */\n  hideOnClickModal: Boolean,\n  /**\n   * @description image source, same as native.\n   */\n  src: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description indicate how the image should be resized to fit its container, same as [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).\n   */\n  fit: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description whether to use lazy load.\n   */\n  lazy: Boolean,\n  /**\n   * @description Indicates how the browser should load the image, same as [native](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading)\n   */\n  loading: {\n    type: String as PropType<'eager' | 'lazy'>,\n  },\n  /**\n   * @description the container to add scroll listener when using lazy load.\n   */\n  scrollContainer: [String, Object] as PropType<string | HTMLElement | undefined>,\n  /**\n   * @description allow big image preview.\n   */\n  previewSrcList: {\n    type: Array as PropType<string[]>,\n    default: () => [] as string[],\n  },\n  /**\n   * @description whether to append image-viewer to body. A nested parent element attribute transform should have this attribute set to `true`.\n   */\n  previewTeleported: Boolean,\n  /**\n   * @description set image preview z-index.\n   */\n  zIndex: {\n    type: Number,\n  },\n  size: {\n    type: String as PropType<ComponentSize>,\n    validator: isValidComponentSize,\n  },\n  type: {\n    type: String as PropType<ComponentType>,\n    validator: isValidComponentType,\n  },\n  round: Boolean,\n  radius: Boolean,\n  bordered: Boolean,\n  effect: String,\n  full: Boolean,\n  /**\n   * @description initial preview image index, less than the length of `url-list`.\n   */\n  initialIndex: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description whether the viewer preview is infinite.\n   */\n  infinite: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether the image-viewer can be closed by pressing ESC.\n   */\n  closeOnPressEscape: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description the zoom rate of the image viewer zoom event\n   */\n  zoomRate: {\n    type: Number,\n    default: 1.2,\n  },\n  /**\n   * @description the min scale of the image viewer zoom event.\n   */\n  minScale: {\n    type: Number,\n    default: 0.2,\n  },\n  /**\n   * @description the max scale of the image viewer zoom event.\n   */\n  maxScale: {\n    type: Number,\n    default: 7,\n  },\n  /**\n   * @description set HTML attribute: crossorigin.\n   */\n  crossorigin: {\n    type: String as PropType<'anonymous' | 'use-credentials' | ''>,\n  },\n}\nexport type ThumbProps = ExtractPropTypes<typeof thumbProps>\n\nexport const thumbEmits = {\n  load: (evt: Event) => evt instanceof Event,\n  error: (evt: Event) => evt instanceof Event,\n  switch: (val: number) => isNumber(val),\n  close: () => true,\n  show: () => true,\n}\nexport type ThumbEmits = typeof thumbEmits\nexport type ThumbInstance = InstanceType<typeof Thumb>\n"],"names":[],"mappings":";;;;AACY,MAAC,UAAU,GAAG;AAC1B,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,gBAAgB,EAAE,OAAO;AAC3B,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,GAAG,EAAE;AACP,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE,OAAO;AACf,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AACnC,EAAE,cAAc,EAAE;AAClB,IAAI,IAAI,EAAE,KAAK;AACf,IAAI,OAA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