Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: only install polyfill if there is no native support #447

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
# Icon must end with two \r
Icon

# VitePress
.vitepress/cache
.vitepress/dist

# Thumbnails
._*
Expand Down
2 changes: 1 addition & 1 deletion src/components/QrcodeCapture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</template>

<script setup lang="ts">
import { type BarcodeFormat } from 'barcode-detector'
import { type PropType } from 'vue'
import { processFile } from '../misc/scanner'
import { type BarcodeFormat } from 'barcode-detector/pure'

const props = defineProps({
formats: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/QrcodeDropZone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</template>

<script setup lang="ts">
import { type BarcodeFormat } from 'barcode-detector'
import { type PropType } from 'vue'
import { processFile, processUrl } from '../misc/scanner'
import { type BarcodeFormat } from 'barcode-detector/pure'

const props = defineProps({
formats: {
Expand Down
12 changes: 6 additions & 6 deletions src/components/QrcodeStream.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@
</template>

<script setup lang="ts">
import type { DetectedBarcode, BarcodeFormat } from 'barcode-detector/pure'
import type { BarcodeFormat, DetectedBarcode } from 'barcode-detector'
import {
onUnmounted,
computed,
onMounted,
onUnmounted,
ref,
watch,
type PropType,
type CSSProperties
type CSSProperties,
type PropType
} from 'vue'

import { keepScanning, setScanningFormats } from '../misc/scanner'
import * as cameraController from '../misc/camera'
import type { Point } from '../types/types'
import { keepScanning, setScanningFormats } from '../misc/scanner'
import { assert } from '../misc/util'
import type { Point } from '../types/types'

const props = defineProps({
// in this file: don't use `props.constraints` directly. Use `constraintsCached`.
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { App, Plugin } from 'vue'

import QrcodeStream from './components/QrcodeStream.vue'
import QrcodeCapture from './components/QrcodeCapture.vue'
import QrcodeDropZone from './components/QrcodeDropZone.vue'
import QrcodeStream from './components/QrcodeStream.vue'

// Install the components
export function install(app: App) {
Expand All @@ -12,10 +12,10 @@ export function install(app: App) {
}

// Expose the components
export { QrcodeStream, QrcodeCapture, QrcodeDropZone }
export { QrcodeCapture, QrcodeDropZone, QrcodeStream }

// Expose some exports from "barcode-detector"
export { setZXingModuleOverrides, type BarcodeFormat } from 'barcode-detector/pure'
export { setZXingModuleOverrides, type BarcodeFormat } from 'barcode-detector'

// Plugin definition
const plugin: Plugin = { install }
Expand Down
2 changes: 1 addition & 1 deletion src/misc/scanner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type DetectedBarcode, type BarcodeFormat, BarcodeDetector } from 'barcode-detector/pure'
import { type BarcodeFormat, type DetectedBarcode, BarcodeDetector } from 'barcode-detector'
import { eventOn } from './callforth'
import { DropImageFetchError } from './errors'

Expand Down
Loading