@pixelverse/strichjs-sdk 1.5.5 → 1.6.1
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.
- package/CHANGELOG.md +18 -0
- package/dist/strich-noesm.js +26 -12
- package/dist/strich.d.ts +141 -8
- package/dist/strich.js +26 -12
- package/package.json +1 -1
package/dist/strich.d.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* BarcodeReader is the primary interface of the STRICH SDK.
|
|
3
3
|
*/
|
|
4
4
|
export declare class BarcodeReader {
|
|
5
|
-
private configuration;
|
|
6
5
|
/**
|
|
7
6
|
* User-supplied barcode detection handler.
|
|
8
7
|
*
|
|
@@ -21,7 +20,7 @@ export declare class BarcodeReader {
|
|
|
21
20
|
*
|
|
22
21
|
* @param configuration - A configuration object.
|
|
23
22
|
*/
|
|
24
|
-
constructor(configuration: Configuration);
|
|
23
|
+
constructor(/* @internal */ configuration: Configuration);
|
|
25
24
|
/**
|
|
26
25
|
* Initialize the BarcodeReader instance.
|
|
27
26
|
*
|
|
@@ -32,7 +31,6 @@ export declare class BarcodeReader {
|
|
|
32
31
|
* Start scanning for barcodes.
|
|
33
32
|
*/
|
|
34
33
|
start(): Promise<void>;
|
|
35
|
-
private tick;
|
|
36
34
|
/**
|
|
37
35
|
* Stop the BarcodeReader instance.
|
|
38
36
|
*
|
|
@@ -107,8 +105,9 @@ export declare interface Configuration {
|
|
|
107
105
|
*
|
|
108
106
|
* @remarks
|
|
109
107
|
* When using a selector, make sure the selector only matches a single element, e.g. by using an ID.
|
|
108
|
+
* When using the popup scanner, do not pass a selector.
|
|
110
109
|
*/
|
|
111
|
-
selector: string | HTMLElement;
|
|
110
|
+
selector: string | HTMLElement | undefined;
|
|
112
111
|
/**
|
|
113
112
|
* Mode: can be 'immediate' (default) for always-on scanning, and 'touch', to only scan when a touch occurs.
|
|
114
113
|
*
|
|
@@ -142,7 +141,9 @@ export declare interface Configuration {
|
|
|
142
141
|
*/
|
|
143
142
|
export declare interface EngineConfiguration {
|
|
144
143
|
/**
|
|
145
|
-
* The enabled symbologies.
|
|
144
|
+
* The enabled barcode symbologies.
|
|
145
|
+
*
|
|
146
|
+
* See https://docs.strich.io/supported-symbologies.html for an exhaustive list of supported symbologies.
|
|
146
147
|
*
|
|
147
148
|
* @remarks
|
|
148
149
|
* It is highly recommended to configure only the symbologies required by your application.
|
|
@@ -359,7 +360,7 @@ export declare interface OverlayConfiguration {
|
|
|
359
360
|
*/
|
|
360
361
|
focusOnTap?: boolean;
|
|
361
362
|
/**
|
|
362
|
-
* Color to use for drawing UI elements such as the
|
|
363
|
+
* Color to use for drawing UI elements such as the viewfinder and camera selector. Must be specified in rgb()
|
|
363
364
|
* format, with the color components given as integers with no separating whitespace.
|
|
364
365
|
*
|
|
365
366
|
* @defaultValue rgb(255,255,255)
|
|
@@ -400,20 +401,51 @@ export declare interface OverlayConfiguration {
|
|
|
400
401
|
*/
|
|
401
402
|
targetingLineActiveColor?: string;
|
|
402
403
|
/**
|
|
403
|
-
* Corner radius in pixels for rectangular elements such as
|
|
404
|
+
* Corner radius in pixels for rectangular elements such as viewfinder and camera selector.
|
|
404
405
|
*
|
|
405
406
|
* The allowed range of the corner radius is 0 to 8 pixels.
|
|
406
407
|
*
|
|
407
408
|
* @defaultValue 0
|
|
408
409
|
*/
|
|
409
410
|
cornerRadius?: number;
|
|
411
|
+
/**
|
|
412
|
+
* Border width in pixels of the viewfinder, the rectangle around the region of interest.
|
|
413
|
+
*
|
|
414
|
+
* @remarks
|
|
415
|
+
* The allowed range is 1 to 20 pixels. Values outside the range are clamped.
|
|
416
|
+
*
|
|
417
|
+
* @defaultValue 1
|
|
418
|
+
*/
|
|
419
|
+
viewfinderBorderWidth?: number;
|
|
420
|
+
/**
|
|
421
|
+
* Corner radius in pixels of the viewfinder, the rectangle around the region of interest.
|
|
422
|
+
*
|
|
423
|
+
* This property applies only to the viewfinder and overrides the {@link OverlayConfiguration.cornerRadius} property.
|
|
424
|
+
*
|
|
425
|
+
* The allowed range of the corner radius is 0 to 20 pixels.
|
|
426
|
+
*
|
|
427
|
+
* @defaultValue 0
|
|
428
|
+
*/
|
|
429
|
+
viewfinderCornerRadius?: number;
|
|
430
|
+
/**
|
|
431
|
+
* Color to use for de-emphasizing the area around the viewfinder.
|
|
432
|
+
*
|
|
433
|
+
* The color will be used to create a mask around the viewfinder/region of interest to aid the user in focusing
|
|
434
|
+
* the camera on the barcode.
|
|
435
|
+
*
|
|
436
|
+
* A semi-translucent dark color works best, e.g. rgba(0,0,0,0.5) would use a semi-translucent black.
|
|
437
|
+
*
|
|
438
|
+
* @defaultValue undefined
|
|
439
|
+
*/
|
|
440
|
+
maskColor?: string;
|
|
410
441
|
/**
|
|
411
442
|
* Override the STRICH logo displayed in the bottom-right corner with a custom image.
|
|
412
443
|
*
|
|
413
444
|
* The image is supplied as an absolute URL or inline as a data URL. The image should have a transparent background
|
|
414
445
|
* (WebP or PNG format). The recommended size is 140x30 pixels.
|
|
415
446
|
*
|
|
416
|
-
* @remarks This is a capability that is only available as a paid add-on for Enterprise licenses.
|
|
447
|
+
* @remarks This is a capability that is only available as a paid add-on for Enterprise licenses. Please note that
|
|
448
|
+
* attempting to hide or replace the STRICH logo by other means is a violation of the License Agreement.
|
|
417
449
|
*/
|
|
418
450
|
customLogoSrc?: string;
|
|
419
451
|
}
|
|
@@ -434,6 +466,107 @@ export declare interface Point {
|
|
|
434
466
|
y: number;
|
|
435
467
|
}
|
|
436
468
|
|
|
469
|
+
/**
|
|
470
|
+
* Popup scanner configuration
|
|
471
|
+
*/
|
|
472
|
+
export declare interface PopupConfiguration {
|
|
473
|
+
/**
|
|
474
|
+
* The barcode symbologies that should be detected.
|
|
475
|
+
*
|
|
476
|
+
* See {@link EngineConfiguration#symbologies} for details.
|
|
477
|
+
*/
|
|
478
|
+
symbologies: (SymbologyName | SymbologySpec)[];
|
|
479
|
+
/**
|
|
480
|
+
* An optional handler for detections.
|
|
481
|
+
*
|
|
482
|
+
* Receives barcode detections and must return `true` if scanning should stop, or `false` if scanning should
|
|
483
|
+
* continue. Any truthy value will be interpreted as `true`.
|
|
484
|
+
*/
|
|
485
|
+
detectionHandler?: (detections: CodeDetection[]) => boolean;
|
|
486
|
+
/**
|
|
487
|
+
* The camera resolution to use.
|
|
488
|
+
*
|
|
489
|
+
* @defaultValue full-hd
|
|
490
|
+
*/
|
|
491
|
+
resolution?: 'hd' | 'full-hd';
|
|
492
|
+
/**
|
|
493
|
+
* Optional overrides for textual content.
|
|
494
|
+
*/
|
|
495
|
+
labels?: {
|
|
496
|
+
/**
|
|
497
|
+
* The text to display in the dialog header area.
|
|
498
|
+
*
|
|
499
|
+
* @remarks
|
|
500
|
+
* If no value is supplied, a locale-dependent default text will be used.
|
|
501
|
+
*/
|
|
502
|
+
title?: string;
|
|
503
|
+
/**
|
|
504
|
+
* The text to display on the cancel button in the dialog bottom area.
|
|
505
|
+
*
|
|
506
|
+
* @remarks
|
|
507
|
+
* If no value is supplied, a locale-dependent default text will be used.
|
|
508
|
+
*/
|
|
509
|
+
cancel?: string;
|
|
510
|
+
};
|
|
511
|
+
/**
|
|
512
|
+
* Optional overrides for title area and cancel button.
|
|
513
|
+
*/
|
|
514
|
+
style?: {
|
|
515
|
+
/**
|
|
516
|
+
* Background color to use for title. Must be specified in rgb() or rgba() notation.
|
|
517
|
+
*
|
|
518
|
+
* @defaultValue rgba(15,42,66,0.9)
|
|
519
|
+
*/
|
|
520
|
+
titleBackgroundColor?: string;
|
|
521
|
+
/**
|
|
522
|
+
* Background color to use for title text. Must be specified in rgb() notation.
|
|
523
|
+
*
|
|
524
|
+
* @defaultValue rgb(236,237,237)
|
|
525
|
+
*/
|
|
526
|
+
titleColor?: string;
|
|
527
|
+
/**
|
|
528
|
+
* Background color to use for cancel button. Must be specified in rgb() or rgba() notation.
|
|
529
|
+
*
|
|
530
|
+
* @defaultValue transparent
|
|
531
|
+
*/
|
|
532
|
+
cancelButtonBackgroundColor?: string;
|
|
533
|
+
/**
|
|
534
|
+
* Color to use for cancel button outline and text. Must be specified in rgb() or rgba() notation.
|
|
535
|
+
*
|
|
536
|
+
* @defaultValue rgba(15,42,66,0.9)
|
|
537
|
+
*/
|
|
538
|
+
cancelButtonColor?: string;
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* Optional configuration for audible and haptic feedback.
|
|
542
|
+
*/
|
|
543
|
+
feedback?: FeedbackConfiguration;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Pre-built modal scanning interface, intended for simple use cases that do not require a lot of customization.
|
|
548
|
+
*
|
|
549
|
+
* For more advanced use cases and user interface customization, you can provide your own host element and integrate
|
|
550
|
+
* a {@link BarcodeReader} directly.
|
|
551
|
+
*
|
|
552
|
+
* @remarks
|
|
553
|
+
* Requires browser support for the <dialog> element, which is widely available since early 2022.
|
|
554
|
+
*/
|
|
555
|
+
export declare class PopupScanner {
|
|
556
|
+
/**
|
|
557
|
+
* Scan barcodes using a pre-built, modal popup interface.
|
|
558
|
+
*
|
|
559
|
+
* Scanning is active until one or more barcodes of the configured symbologies
|
|
560
|
+
* (see {@link PopupConfiguration#symbologies}) are detected. If a detection handler is provided
|
|
561
|
+
* (see {@link PopupConfiguration#detectionHandler}), scanning will continue until the detection
|
|
562
|
+
* handler returns a truthy value.
|
|
563
|
+
*
|
|
564
|
+
* @param configuration - The popup scanner configuration
|
|
565
|
+
* @returns Promise that resolves into the detected barcodes or undefined (user cancellation)
|
|
566
|
+
*/
|
|
567
|
+
static scan(configuration: PopupConfiguration): Promise<CodeDetection[] | undefined>;
|
|
568
|
+
}
|
|
569
|
+
|
|
437
570
|
/**
|
|
438
571
|
* A non-intersecting polygon with four points.
|
|
439
572
|
*/
|