{"version":3,"file":"image-viewer2.mjs","sources":["../../../../../../packages/components/image-viewer/src/image-viewer.ts"],"sourcesContent":["import { buildProps, definePropType } from '@sgui-plus/utils/props'\r\nimport { isNumber } from '@sgui-plus/utils/util'\r\nimport { mutable } from '@sgui-plus/utils/types'\r\n\r\nimport type { Component, ExtractPropTypes } from 'vue'\r\nimport type ImageViewer from './image-viewer.vue'\r\n\r\nexport type ImageViewerAction =\r\n  | 'zoomIn'\r\n  | 'zoomOut'\r\n  | 'clockwise'\r\n  | 'anticlockwise'\r\n\r\nexport const imageViewerProps = buildProps({\r\n  /**\r\n   * @description preview link list.\r\n   */\r\n  urlList: {\r\n    type: definePropType<string[]>(Array),\r\n    default: () => mutable([] as const),\r\n  },\r\n  /**\r\n   * @description preview backdrop z-index.\r\n   */\r\n  zIndex: {\r\n    type: Number,\r\n  },\r\n  /**\r\n   * @description the initial preview image index, less than or equal to the length of `url-list`.\r\n   */\r\n  initialIndex: {\r\n    type: Number,\r\n    default: 0,\r\n  },\r\n  /**\r\n   * @description whether preview is infinite.\r\n   */\r\n  infinite: {\r\n    type: Boolean,\r\n    default: true,\r\n  },\r\n  /**\r\n   * @description whether user can emit close event when clicking backdrop.\r\n   */\r\n  hideOnClickModal: Boolean,\r\n  /**\r\n   * @description whether to append image itself to body. A nested parent element attribute transform should have this attribute set to `true`.\r\n   */\r\n  transfer: Boolean,\r\n  /**\r\n   * @description whether the image-viewer can be closed by pressing ESC.\r\n   */\r\n  closeOnPressEscape: {\r\n    type: Boolean,\r\n    default: true,\r\n  },\r\n  /**\r\n   * @description the zoom rate of the image viewer zoom event.\r\n   */\r\n  zoomRate: {\r\n    type: Number,\r\n    default: 1.2,\r\n  },\r\n} as const)\r\n\r\nexport type ImageViewerProps = ExtractPropTypes<typeof imageViewerProps>\r\n\r\nexport const imageViewerEmits = {\r\n  close: () => true,\r\n  switch: (index: number) => isNumber(index),\r\n}\r\nexport type ImageViewerEmits = typeof imageViewerEmits\r\n\r\nexport interface ImageViewerMode {\r\n  name: string\r\n  icon: Component\r\n}\r\n\r\nexport type ImageViewerInstance = InstanceType<typeof ImageViewer>\r\n"],"names":[],"mappings":";;;;AAGY,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,OAAO,EAAE;AACX,IAAI,IAAI,EAAE,cAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC;AAC9B,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,CAAC;AACd,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,gBAAgB,EAAE,OAAO;AAC3B,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,kBAAkB,EAAE;AACtB,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,IAAI;AACjB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,GAAG;AAChB,GAAG;AACH,CAAC,EAAE;AACS,MAAC,gBAAgB,GAAG;AAChC,EAAE,KAAK,EAAE,MAAM,IAAI;AACnB,EAAE,MAAM,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACpC;;;;"}