ReviewOS

also looking at this

stacks/ts-qr-codes

chore(deps): update dependency react to 19.2.7

#2137
Closed chris wants to merge buddy-bot/update-major-update-react into main
222 files +16350 -1825

Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.

docs/.vitepress/theme/components/QRDemo.vuemodified+2-2
Changes to docs/.vitepress/theme/components/QRDemo.vue
@@ -1,10 +1,10 @@
11<script setup>
2import { QRCode } from '@stacksjs/qrx'
2import { QRCode, QRErrorCorrectLevel } from '@stacksjs/qrx'
33import { onMounted, ref, watch } from 'vue'
44// import { QRCode, QRCodeCorrectLevel } from './qrcode'
55
66const text = ref('Hello World!')
7const errorLevel = ref('2') // H level by default
7const errorLevel = ref(QRErrorCorrectLevel.H)
88const useSVG = ref(true)
99const qrContainer = ref(null)
1010let qrCode = null
docs/.vitepress/vite.config.tsmodified+4-0
Changes to docs/.vitepress/vite.config.ts
@@ -13,10 +13,14 @@ export default defineConfig({
1313 output: {
1414 assetFileNames: 'assets/[name].[hash][extname]',
1515 },
16 external: ['path', 'process', 'bunfig'],
1617 },
1718 },
1819
1920 resolve: {
21 alias: {
22 '@stacksjs/qrx': resolve(__dirname, '../../packages/qrx/src/index.ts'),
23 },
2024 dedupe: [
2125 'vue',
2226 '@vue/runtime-core',
packages/qrx/src/qr/index.tsmodified+4-3
Changes to packages/qrx/src/qr/index.ts
@@ -1,7 +1,9 @@
1import type { QRCodeOptions, RSBlock } from './types'
2import { QRErrorCorrectLevel, QRMaskPattern, QRMode } from './types'
1import type { QRCodeOptions, RSBlock } from '../types'
2import { QRErrorCorrectLevel, QRMaskPattern, QRMode } from '../types'
33import { getAndroid, getUTF8Length, isSupportCanvas } from './utils'
44
5export * from './utils'
6
57/**
68 * A TypeScript library for working with QR codes.
79 *
@@ -1545,7 +1547,6 @@ export class QRCode {
15451547 colorLight: '#ffffff',
15461548 correctLevel: QRErrorCorrectLevel.H,
15471549 useSVG: false,
1548 // Force the type definitions to be Required<T>.
15491550 }
15501551
15511552 if (typeof vOption === 'string') {
packages/qrx/src/qr/types.tsdeleted+0-57
Changes to packages/qrx/src/qr/types.ts
@@ -1,57 +0,0 @@
1/**
2 * Enumeration of QR modes.
3 */
4export enum QRMode {
5 MODE_NUMBER = 1, // 1 << 0 is equivalent to 1
6 MODE_ALPHA_NUM = 2, // 1 << 1 is equivalent to 2
7 MODE_8BIT_BYTE = 4, // 1 << 2 is equivalent to 4
8 MODE_KANJI = 8, // 1 << 3 is equivalent to 8
9}
10
11/**
12 * Enumeration of QR error-correction levels.
13 */
14export enum QRErrorCorrectLevel {
15 L = 1,
16 M = 0,
17 Q = 3,
18 H = 2,
19}
20
21/**
22 * Enumeration of QR masking patterns.
23 */
24export enum QRMaskPattern {
25 PATTERN000 = 0,
26 PATTERN001 = 1,
27 PATTERN010 = 2,
28 PATTERN011 = 3,
29 PATTERN100 = 4,
30 PATTERN101 = 5,
31 PATTERN110 = 6,
32 PATTERN111 = 7,
33}
34
35/**
36 * Helper interface defining the structure of RS Blocks.
37 */
38export interface RSBlock {
39 totalCount: number
40 dataCount: number
41 errorCount: number
42}
43
44/**
45 * Config for drawing/rendering the QRCode.
46 */
47export interface QRCodeConfig {
48 text: string
49 width: number
50 height: number
51 colorDark: string
52 colorLight: string
53 correctLevel: QRErrorCorrectLevel
54 useSVG: boolean
55}
56
57export type QRCodeOptions = Partial<QRCodeConfig>
packages/qrx/src/types.tsmodified+58-3
Changes to packages/qrx/src/types.ts
@@ -1,6 +1,3 @@
1export interface QRCodeOptions {}
2interface QRCodeConfig {}
3
41export interface QrxConfig {
52 type: 'bar' | 'qr'
63 options: BarcodeConfig | QRCodeConfig
@@ -94,3 +91,61 @@ export interface Barcode {
9491 Pharmacode: (value: string, options?: BarcodeConfig) => Barcode
9592 Codabar: (value: string, options?: BarcodeConfig) => Barcode
9693}
94
95/**
96 * Enumeration of QR modes.
97 */
98export enum QRMode {
99 MODE_NUMBER = 1, // 1 << 0 is equivalent to 1
100 MODE_ALPHA_NUM = 2, // 1 << 1 is equivalent to 2
101 MODE_8BIT_BYTE = 4, // 1 << 2 is equivalent to 4
102 MODE_KANJI = 8, // 1 << 3 is equivalent to 8
103}
104
105/**
106 * Enumeration of QR error-correction levels.
107 */
108export enum QRErrorCorrectLevel {
109 L = 1,
110 M = 0,
111 Q = 3,
112 H = 2,
113}
114
115/**
116 * Enumeration of QR masking patterns.
117 */
118export enum QRMaskPattern {
119 PATTERN000 = 0,
120 PATTERN001 = 1,
121 PATTERN010 = 2,
122 PATTERN011 = 3,
123 PATTERN100 = 4,
124 PATTERN101 = 5,
125 PATTERN110 = 6,
126 PATTERN111 = 7,
127}
128
129/**
130 * Helper interface defining the structure of RS Blocks.
131 */
132export interface RSBlock {
133 totalCount: number
134 dataCount: number
135 errorCount: number
136}
137
138/**
139 * Config for drawing/rendering the QRCode.
140 */
141export interface QRCodeConfig {
142 text: string
143 width: number
144 height: number
145 colorDark: string
146 colorLight: string
147 correctLevel: QRErrorCorrectLevel
148 useSVG: boolean
149}
150
151export type QRCodeOptions = Partial<QRCodeConfig>