@qr-platform/qr-code.js 0.11.3 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ name: Claude Code
2
+
3
+ on:
4
+ issue_comment:
5
+ types: [created]
6
+ pull_request_review_comment:
7
+ types: [created]
8
+ issues:
9
+ types: [opened, assigned]
10
+ pull_request_review:
11
+ types: [submitted]
12
+
13
+ jobs:
14
+ claude:
15
+ if: |
16
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17
+ (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18
+ (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19
+ (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20
+ runs-on: ubuntu-latest
21
+ permissions:
22
+ contents: read
23
+ pull-requests: read
24
+ issues: read
25
+ id-token: write
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v4
29
+ with:
30
+ fetch-depth: 1
31
+
32
+ - name: Run Claude Code
33
+ id: claude
34
+ uses: anthropics/claude-code-action@beta
35
+ with:
36
+ anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
37
+
@@ -13,7 +13,8 @@ These examples focus on the fundamental QR code generation settings.
13
13
 
14
14
  **Example 1: High Error Correction & Specific Type Number**
15
15
 
16
- ```typescriptconst qrCoreHighEC = new QRCodeJs({
16
+ ```typescript
17
+ const qrCoreHighEC = new QRCodeJs({
17
18
  data: 'https://example.com/high-ec',
18
19
  qrOptions: {
19
20
  typeNumber: 10, // Larger QR code version
@@ -28,7 +29,8 @@ qrCoreHighEC.append(document.getElementById('core-high-ec-container'));
28
29
 
29
30
  **Example 2: Auto Type Number & Medium Error Correction**
30
31
 
31
- ```typescriptconst qrCoreAutoEC = new QRCodeJs({
32
+ ```typescript
33
+ const qrCoreAutoEC = new QRCodeJs({
32
34
  data: 'https://example.com/auto-ec-medium',
33
35
  qrOptions: {
34
36
  typeNumber: 0, // Auto-detect size
@@ -49,7 +51,8 @@ Demonstrates how to control the positioning and scaling within the container or
49
51
 
50
52
  **Example 1: Scaled Down with Offsets**
51
53
 
52
- ```typescriptconst qrLayoutScaledOffset = new QRCodeJs({
54
+ ```typescript
55
+ const qrLayoutScaledOffset = new QRCodeJs({
53
56
  data: 'https://example.com/layout-scaled-offset',
54
57
  scale: 0.75, // QR code occupies 75% of the space
55
58
  offset: -15, // Moves QR code 15px up relative to center
@@ -67,7 +70,8 @@ qrLayoutScaledOffset.append(document.getElementById('layout-scaled-offset-contai
67
70
 
68
71
  **Example 2: Responsive QR Code**
69
72
 
70
- ```typescriptconst qrLayoutResponsive = new QRCodeJs({
73
+ ```typescript
74
+ const qrLayoutResponsive = new QRCodeJs({
71
75
  data: 'https://example.com/layout-responsive',
72
76
  isResponsive: true, // SVG will resize with container
73
77
  margin: 10, // Add a 10px quiet zone
@@ -92,7 +96,8 @@ Showcases different shapes and colors for the main data dots.
92
96
 
93
97
  **Example 1: Classy Rounded Dots**
94
98
 
95
- ```typescriptconst qrDotsClassy = new QRCodeJs({
99
+ ```typescript
100
+ const qrDotsClassy = new QRCodeJs({
96
101
  data: 'https://example.com/dots-classy',
97
102
  dotsOptions: {
98
103
  type: 'classyRounded',
@@ -105,7 +110,8 @@ qrDotsClassy.append(document.getElementById('dots-classy-container'));
105
110
 
106
111
  **Example 2: Star Dots**
107
112
 
108
- ```typescriptconst qrDotsStar = new QRCodeJs({
113
+ ```typescript
114
+ const qrDotsStar = new QRCodeJs({
109
115
  data: 'https://example.com/dots-star',
110
116
  dotsOptions: {
111
117
  type: 'star',
@@ -118,7 +124,8 @@ qrDotsStar.append(document.getElementById('dots-star-container'));
118
124
 
119
125
  **Example 3: Diamond Dots**
120
126
 
121
- ```typescriptconst qrDotsDiamond = new QRCodeJs({
127
+ ```typescript
128
+ const qrDotsDiamond = new QRCodeJs({
122
129
  data: 'https://example.com/dots-diamond',
123
130
  dotsOptions: {
124
131
  type: 'diamond',
@@ -137,7 +144,8 @@ Customizes the three large corner squares.
137
144
 
138
145
  **Example 1: Outpoint Corner Squares**
139
146
 
140
- ```typescriptconst qrCornerSquareOutpoint = new QRCodeJs({
147
+ ```typescript
148
+ const qrCornerSquareOutpoint = new QRCodeJs({
141
149
  data: 'https://example.com/corner-square-outpoint',
142
150
  dotsOptions: { color: '#444' },
143
151
  cornersSquareOptions: {
@@ -150,7 +158,8 @@ qrCornerSquareOutpoint.append(document.getElementById('corner-square-outpoint-co
150
158
 
151
159
  **Example 2: Rounded Corner Squares**
152
160
 
153
- ```typescriptconst qrCornerSquareRounded = new QRCodeJs({
161
+ ```typescript
162
+ const qrCornerSquareRounded = new QRCodeJs({
154
163
  data: 'https://example.com/corner-square-rounded',
155
164
  dotsOptions: { type: 'dot', color: '#7B1FA2' }, // Purple dots
156
165
  cornersSquareOptions: {
@@ -169,7 +178,8 @@ Customizes the smaller dots within the corner squares.
169
178
 
170
179
  **Example 1: Heart Corner Dots**
171
180
 
172
- ```typescriptconst qrCornerDotHeart = new QRCodeJs({
181
+ ```typescript
182
+ const qrCornerDotHeart = new QRCodeJs({
173
183
  data: 'https://example.com/corner-dot-heart',
174
184
  dotsOptions: { color: '#555' },
175
185
  cornersSquareOptions: { type: 'square', color: '#E64A19' }, // Orange square corners
@@ -183,7 +193,8 @@ qrCornerDotHeart.append(document.getElementById('corner-dot-heart-container'));
183
193
 
184
194
  **Example 2: Square Corner Dots with Different Color**
185
195
 
186
- ```typescriptconst qrCornerDotSquare = new QRCodeJs({
196
+ ```typescript
197
+ const qrCornerDotSquare = new QRCodeJs({
187
198
  data: 'https://example.com/corner-dot-square',
188
199
  dotsOptions: { type: 'rounded', color: '#004D40' }, // Dark Teal dots
189
200
  cornersSquareOptions: { type: 'rounded', color: '#FBC02D' }, // Yellow rounded corners
@@ -203,7 +214,8 @@ Applies color, rounding, and gradients to the background.
203
214
 
204
215
  **Example 1: Colored and Rounded Background**
205
216
 
206
- ```typescriptconst qrBackgroundStyled = new QRCodeJs({
217
+ ```typescript
218
+ const qrBackgroundStyled = new QRCodeJs({
207
219
  data: 'https://example.com/background-styled',
208
220
  dotsOptions: { color: '#FFFFFF' }, // White dots for contrast
209
221
  backgroundOptions: {
@@ -216,7 +228,8 @@ qrBackgroundStyled.append(document.getElementById('background-styled-container')
216
228
 
217
229
  **Example 2: Background with Subtle Radial Gradient**
218
230
 
219
- ```typescriptconst qrBackgroundGradient = new QRCodeJs({
231
+ ```typescript
232
+ const qrBackgroundGradient = new QRCodeJs({
220
233
  data: 'https://example.com/background-gradient',
221
234
  dotsOptions: { color: '#333' },
222
235
  backgroundOptions: {
@@ -241,7 +254,8 @@ Applies linear and radial gradients to various elements.
241
254
 
242
255
  **Example 1: Linear Gradient on Dots**
243
256
 
244
- ```typescriptconst qrGradientDotsLinear = new QRCodeJs({
257
+ ```typescript
258
+ const qrGradientDotsLinear = new QRCodeJs({
245
259
  data: 'https://example.com/gradient-dots-linear',
246
260
  dotsOptions: {
247
261
  type: 'rounded',
@@ -261,7 +275,8 @@ qrGradientDotsLinear.append(document.getElementById('gradient-dots-linear-contai
261
275
 
262
276
  **Example 2: Radial Gradient on Corner Squares & Linear on Dots**
263
277
 
264
- ```typescriptconst qrGradientMultiple = new QRCodeJs({
278
+ ```typescript
279
+ const qrGradientMultiple = new QRCodeJs({
265
280
  data: 'https://example.com/gradient-multiple',
266
281
  dotsOptions: {
267
282
  type: 'square',
@@ -307,7 +322,8 @@ Embeds logos or images within the QR code.
307
322
 
308
323
  **Example 1: Centered Logo with Fill**
309
324
 
310
- ```typescriptconst qrImageCenter = new QRCodeJs({
325
+ ```typescript
326
+ const qrImageCenter = new QRCodeJs({
311
327
  data: 'https://example.com/image-center',
312
328
  qrOptions: { errorCorrectionLevel: 'Q' }, // Higher EC recommended
313
329
  image: 'https://upload.wikimedia.org/wikipedia/commons/a/a5/Instagram_icon.png', // Example: Instagram logo
@@ -325,7 +341,8 @@ qrImageCenter.append(document.getElementById('image-center-container'));
325
341
 
326
342
  **Example 2: Image as Background**
327
343
 
328
- ```typescriptconst qrImageBackground = new QRCodeJs({
344
+ ```typescript
345
+ const qrImageBackground = new QRCodeJs({
329
346
  data: 'https://example.com/image-background',
330
347
  qrOptions: { errorCorrectionLevel: 'M' },
331
348
  image: 'https://source.unsplash.com/random/300x300?nature,water', // Example: Random nature image
@@ -348,6 +365,7 @@ qrImageBackground.append(document.getElementById('image-background-container'));
348
365
  **Example 3: Using the Override Option with Images**
349
366
 
350
367
  ```typescript
368
+
351
369
  // Setting a global image with override that will take precedence
352
370
  // even over images specified in instance options
353
371
  QRCodeJs.setImage('https://example.com/global-priority-logo.png', { override: true });
@@ -384,6 +402,7 @@ Demonstrates using `QRCodeJs.setSettings()` for establishing global presets and
384
402
  `QRCodeJs.setSettings()` acts as a macro, calling other static setters like `setData()`, `setImage()`, `setTemplate()`, `setStyle()`, `setOptions()`, etc., based on the provided `SettingsOptions`. It overrides/resets previous static configurations for the aspects it covers.
385
403
 
386
404
  ```typescript
405
+
387
406
  // Define a comprehensive global preset using SettingsOptions
388
407
  const companyGlobalPreset: SettingsOptions = {
389
408
  name: 'CompanyStandardGlobalQR',
@@ -430,6 +449,7 @@ qrOverrideGlobalData.append(document.getElementById('global-settings-override-da
430
449
  `QRCodeBuilder.useSettings()` resets any configurations previously applied to *that builder instance* and establishes the provided `SettingsOptions` as the new baseline.
431
450
 
432
451
  ```typescript
452
+
433
453
  const eventSpecificBuilderConfig: SettingsOptions = {
434
454
  name: 'TechConferenceBuilderQR',
435
455
  data: 'https://techconf.example/main-schedule', // Baseline data for this builder
@@ -472,6 +492,7 @@ qrEventSpecialBuilder.append(document.getElementById('builder-usesettings-contai
472
492
  The `overrideOpts: { override: true }` parameter makes static settings "sticky", meaning they are harder to override by instance options or non-overriding builder methods.
473
493
 
474
494
  ```typescript
495
+
475
496
  // Set data with override:true; it will take precedence over instance data
476
497
  QRCodeJs.setData('https://permanent-global-link.com', { override: true });
477
498
 
@@ -503,6 +524,7 @@ Uses premium border features for advanced styling and text. Requires a license.
503
524
  **Example 1: Using Text Override Option**
504
525
 
505
526
  ```typescript
527
+
506
528
  // Ensure license is activated first
507
529
  // await QRCodeJs.license('YOUR-LICENSE-KEY');
508
530
 
@@ -571,7 +593,8 @@ QRCodeJs.setText(null);
571
593
 
572
594
  **Example 2: Elaborate Border with Multiple Decorations**
573
595
 
574
- ```typescript// Ensure license is activated first
596
+ ```typescript
597
+ // Ensure license is activated first
575
598
  // await QRCodeJs.license('YOUR-LICENSE-KEY');
576
599
 
577
600
  const qrBorderElaborate = new QRCodeJs({
@@ -637,6 +660,7 @@ qrBorderElaborate.append(document.getElementById('border-elaborate-container'));
637
660
  Demonstrates using the fluent builder pattern (`useTemplate`, `useStyle`) to combine base settings with specific styles for a complex result.
638
661
 
639
662
  ```typescript
663
+
640
664
  // Define a base template (could be predefined like 'dots' or 'rounded')
641
665
  const baseTemplate = {
642
666
  qrOptions: { errorCorrectionLevel: 'Q' },
@@ -683,6 +707,7 @@ qrBuilderExampleWithBuild.update({ data: 'https://example.com/builder-pattern-ad
683
707
  Demonstrates using the class instance pattern (`setTemplate`, `setStyle`) to combine base settings with specific styles for a complex result.
684
708
 
685
709
  ```typescript
710
+
686
711
  // Define a base template (could be predefined like 'dots' or 'rounded')
687
712
  const baseTemplate = {
688
713
  qrOptions: { errorCorrectionLevel: 'Q' },
@@ -719,6 +744,7 @@ const qrBuilderExample = new QRCodeJs({ data: 'https://example.com/class-instanc
719
744
  This example shows how to set global defaults for a template, style, and border configuration. Subsequent `QRCodeJs` instances will inherit these settings unless overridden during instantiation.
720
745
 
721
746
  ```typescript
747
+
722
748
  // 1. Define and set global defaults
723
749
  const globalTemplate = { backgroundOptions: { color: '#E8F5E9' } }; // Light Green background
724
750
  const globalStyle = { dotsOptions: { type: 'classy', color: '#1B5E20' } }; // Dark Green classy dots
@@ -758,6 +784,7 @@ qrGlobalCombinedOverride.append(document.getElementById('global-combined-overrid
758
784
  This example demonstrates chaining builder methods to combine a template, style, and border configuration for a single instance without affecting global defaults.
759
785
 
760
786
  ```typescript
787
+
761
788
  // 1. Define components (optional, could be predefined names or IDs)
762
789
  const baseTpl = { qrOptions: { errorCorrectionLevel: 'M' }, margin: 5 };
763
790
  const dotsStyle = { dotsOptions: { type: 'dots', color: '#01579B' } }; // Light Blue dots
@@ -786,7 +813,8 @@ qrBuilderCombined.append(document.getElementById('builder-combined-container'));
786
813
 
787
814
  Validate if the generated QR code is scannable using the built-in validator. This requires a premium license.
788
815
 
789
- ```typescript// Ensure license is activated first
816
+ ```typescript
817
+ // Ensure license is activated first
790
818
  // await QRCodeJs.license('YOUR-LICENSE-KEY');
791
819
 
792
820
  const qrCodeToValidate = new QRCodeJs({
package/docs/examples.md CHANGED
@@ -216,6 +216,7 @@ qrChained.append(document.getElementById('template-style-chain-container'));
216
216
  Demonstrating fundamental settings like data, shape, and error correction.
217
217
 
218
218
  **Example 1: Minimal QR Code**
219
+ ```javascript
219
220
 
220
221
  const qrMinimal = new QRCodeJs({
221
222
  data: 'Just the data!'
@@ -224,6 +225,7 @@ qrMinimal.append(document.getElementById('minimal-qr-container'));
224
225
  ```
225
226
 
226
227
  **Example 2: Circle Shape**
228
+ ```javascript
227
229
 
228
230
  const qrCircle = new QRCodeJs({
229
231
  data: 'https://example.com/circle',
@@ -233,6 +235,7 @@ qrCircle.append(document.getElementById('circle-qr-container'));
233
235
  ```
234
236
 
235
237
  **Example 3: High Error Correction**
238
+ ```javascript
236
239
 
237
240
  const qrHighEC = new QRCodeJs({
238
241
  data: 'Important Data',
@@ -250,6 +253,7 @@ qrHighEC.append(document.getElementById('high-ec-qr-container'));
250
253
  Controlling margin, scale, and offsets.
251
254
 
252
255
  **Example 1: Adding Margin**
256
+ ```javascript
253
257
 
254
258
  const qrMargin = new QRCodeJs({
255
259
  data: 'With Margin',
@@ -259,6 +263,7 @@ qrMargin.append(document.getElementById('margin-qr-container'));
259
263
  ```
260
264
 
261
265
  **Example 2: Scaling Down**
266
+ ```javascript
262
267
 
263
268
  const qrScaled = new QRCodeJs({
264
269
  data: 'Scaled Down',
@@ -274,6 +279,7 @@ qrScaled.append(document.getElementById('scaled-qr-container'));
274
279
  Changing the appearance of the data dots.
275
280
 
276
281
  **Example 1: Rounded Dots**
282
+ ```javascript
277
283
 
278
284
  const qrRoundedDots = new QRCodeJs({
279
285
  data: 'Rounded Dots',
@@ -286,6 +292,7 @@ qrRoundedDots.append(document.getElementById('rounded-dots-container'));
286
292
  ```
287
293
 
288
294
  **Example 2: Dot Style Dots**
295
+ ```javascript
289
296
 
290
297
  const qrDotDots = new QRCodeJs({
291
298
  data: 'Dot Style Dots',
@@ -302,6 +309,7 @@ qrDotDots.append(document.getElementById('dot-dots-container'));
302
309
  ### Styling Options - Corner Squares
303
310
 
304
311
  Customizing the large corner squares.
312
+ ```javascript
305
313
 
306
314
  const qrStyledCorners = new QRCodeJs({
307
315
  data: 'Styled Corners',
@@ -319,6 +327,7 @@ qrStyledCorners.append(document.getElementById('styled-corners-container'));
319
327
  ### Styling Options - Corner Dots
320
328
 
321
329
  Customizing the small dots inside the corner squares.
330
+ ```javascript
322
331
 
323
332
  const qrStyledCornerDots = new QRCodeJs({
324
333
  data: 'Styled Corner Dots',
@@ -339,6 +348,7 @@ qrStyledCornerDots.append(document.getElementById('styled-corner-dots-container'
339
348
  Modifying the background color and shape.
340
349
 
341
350
  **Example 1: Colored Background**
351
+ ```javascript
342
352
 
343
353
  const qrColoredBg = new QRCodeJs({
344
354
  data: 'Colored Background',
@@ -351,6 +361,7 @@ qrColoredBg.append(document.getElementById('colored-bg-container'));
351
361
  ```
352
362
 
353
363
  **Example 2: Rounded Background**
364
+ ```javascript
354
365
 
355
366
  const qrRoundedBg = new QRCodeJs({
356
367
  data: 'Rounded Background',
@@ -421,6 +432,7 @@ qrGradientBg.append(document.getElementById('gradient-bg-container'));
421
432
  ### Image Embedding
422
433
 
423
434
  Adding a simple logo.
435
+ ```javascript
424
436
 
425
437
  const qrWithLogo = new QRCodeJs({
426
438
  data: 'QR with Logo',
@@ -679,6 +691,7 @@ qrUseSettings1.append(document.getElementById('builder-usesettings-container-1')
679
691
  ### Border Options (Free Version)
680
692
 
681
693
  Adding a basic border (includes "QR-Platform" branding).
694
+ ```javascript
682
695
 
683
696
  const qrFreeBorder = new QRCodeJs({
684
697
  data: 'Free Border Example',
@@ -693,6 +706,7 @@ const qrFreeBorder = new QRCodeJs({
693
706
  qrFreeBorder.append(document.getElementById('free-border-container'));
694
707
  ```
695
708
  **Example: Setting a Global Default Border**
709
+ ```javascript
696
710
 
697
711
 
698
712
  // Set a default border configuration by name
@@ -710,6 +724,7 @@ qrWithDefaultBorder.append(document.getElementById('default-border-container'));
710
724
  ```
711
725
 
712
726
  **Example: Using the Builder Pattern for Borders**
727
+ ```javascript
713
728
 
714
729
 
715
730
  // Start the builder with a border configuration by name