@olympeio-extensions/qrcode-zxing 2.11.0 → 2.11.3
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/main-node.js.map +1 -1
- package/main-web.js.map +1 -1
- package/package.json +1 -1
package/main-node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main-node.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;ACVA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;ACLA;AACgB;;AAEhB;AACA;AACA","sources":["webpack://@olympeio-extensions/qrcode-zxing/webpack/universalModuleDefinition","webpack://@olympeio-extensions/qrcode-zxing/external umd \"olympe\"","webpack://@olympeio-extensions/qrcode-zxing/webpack/bootstrap","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/compat get default export","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/define property getters","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/hasOwnProperty shorthand","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/make namespace object","webpack://@olympeio-extensions/qrcode-zxing/./src/main-node.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"olympe\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"olympe\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@olympeio-extensions/qrcode-zxing\"] = factory(require(\"olympe\"));\n\telse\n\t\troot[\"@olympeio-extensions/qrcode-zxing\"] = factory(root[\"olympe\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\n// Import Olympe runtime or DRAW\nimport 'olympe';\n\n// Import project bricks (we use webpack-import-glob-loader to import all bricks)\n;\n;\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"main-node.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;ACVA,oD;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;ACLA;AACgB;;AAEhB;AACA;AACA","sources":["webpack://@olympeio-extensions/qrcode-zxing/webpack/universalModuleDefinition","webpack://@olympeio-extensions/qrcode-zxing/external umd \"olympe\"","webpack://@olympeio-extensions/qrcode-zxing/webpack/bootstrap","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/compat get default export","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/define property getters","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/hasOwnProperty shorthand","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/make namespace object","webpack://@olympeio-extensions/qrcode-zxing/./src/main-node.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"olympe\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"olympe\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@olympeio-extensions/qrcode-zxing\"] = factory(require(\"olympe\"));\n\telse\n\t\troot[\"@olympeio-extensions/qrcode-zxing\"] = factory(root[\"olympe\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\n// Import Olympe runtime or DRAW\nimport 'olympe';\n\n// Import project bricks (we use webpack-import-glob-loader to import all bricks)\n;\n;\n"],"names":[],"sourceRoot":""}
|
package/main-web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main-web.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;ACV2D;AAChB;AACuC;AACN;AACvC;;AAErC;AACA;AACA,IAAI,+DAAmB,EAAE,+DAAmB,EAAE,+DAAmB,EAAE,gEAAoB;AACvF;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AAEtB,uBAAuB,2CAAO;;AAE7C;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,UAAU;AACzB;AACA;;AAEA,QAAQ,mDAAa;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,6DAAiB;AACpD,mDAAmD,iEAAqB;;AAExE;AACA;AACA,+BAA+B,YAAY;AAC3C,mCAAmC,WAAW;AAC9C;AACA,4DAA4D;AAC5D,4DAA4D;AAC5D,4DAA4D;AAC5D,4DAA4D;AAC5D,4DAA4D;AAC5D;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,qDAAa;;;;;;;;;;;AC/Db;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;ACNA;AACgB;;AAEhB;AACA;AAC4B,CAA4B","sources":["webpack://@olympeio-extensions/qrcode-zxing/webpack/universalModuleDefinition","webpack://@olympeio-extensions/qrcode-zxing/./src/web/QRScanner.js","webpack://@olympeio-extensions/qrcode-zxing/./src/web/QRViewer.js","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"@olympeio/core\"","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"@zxing/browser\"","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"@zxing/library\"","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"rxjs\"","webpack://@olympeio-extensions/qrcode-zxing/external umd \"olympe\"","webpack://@olympeio-extensions/qrcode-zxing/webpack/bootstrap","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/compat get default export","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/define property getters","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/hasOwnProperty shorthand","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/make namespace object","webpack://@olympeio-extensions/qrcode-zxing/./src/main-web.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"olympe\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"olympe\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@olympeio-extensions/qrcode-zxing\"] = factory(require(\"olympe\"));\n\telse\n\t\troot[\"@olympeio-extensions/qrcode-zxing\"] = factory(root[\"olympe\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {\nreturn ","import { UIBrick, registerBrick, UIContext } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport { BarcodeFormat, DecodeHintType, NotFoundException } from '@zxing/library';\nimport { BrowserMultiFormatReader, IScannerControls } from '@zxing/browser';\nimport { combineLatest } from 'rxjs';\n\nconst ALL_FORMATS = [\n // 1D product\n BarcodeFormat.UPC_A, BarcodeFormat.UPC_E, BarcodeFormat.EAN_8, BarcodeFormat.EAN_13,\n // 1D product\n BarcodeFormat.CODE_39, BarcodeFormat.CODE_128, BarcodeFormat.ITF, BarcodeFormat.RSS_14,\n // 2D\n BarcodeFormat.QR_CODE, BarcodeFormat.DATA_MATRIX, BarcodeFormat.AZTEC, BarcodeFormat.PDF_417\n];\n\nexport class QRScanner extends UIBrick {\n\n /**\n * This method runs when the brick is ready in the HTML DOM.\n * @override\n * @param {!UIContext} context\n * @param {!Element} elementDom\n */\n draw(context, elementDom) {\n const logger = getLogger('QRScanner');\n\n const videoElement = document.createElement('video');\n const focusOverlay = document.createElement('div');\n\n combineLatest(\n context.getProperty('Width').observe(),\n context.getProperty('Height').observe()\n ).subscribe(([width, height]) => {\n if (width <= 0 || height <= 0) {\n logger.error('Width and Height should be positive number');\n logger.warn('Please set positive width and height');\n videoElement.width = 1;\n videoElement.height = 1;\n } else {\n videoElement.width = width;\n videoElement.height = height;\n }\n this.resizeComponent(videoElement, focusOverlay);\n });\n\n // setup accepted barcode formats\n const decodeContinuously = (constraints) => {\n const hints = new Map();\n hints.set(DecodeHintType.POSSIBLE_FORMATS, ALL_FORMATS);\n\n // start the scanner (MediaStream selection is done by the lib, following the constraints)\n const codeReader = new BrowserMultiFormatReader();\n codeReader.setHints(hints);\n\n codeReader.decodeFromConstraints(constraints, videoElement, (result, err) => {\n if (result) {\n // export scanned value\n context.getProperty('scanned value').set(result.getText());\n context.getEvent('On Scanned').trigger();\n }\n if (err) {\n if (!(err instanceof NotFoundException)) {\n logger.error(err);\n }\n }\n }).then((obj) => {\n // register the scanner controls for stopping it later\n context.set('IScannerControls', obj);\n\n // set the size & position of the overlay to match the actual video\n this.resizeComponent(videoElement, focusOverlay);\n }).catch((reason) => {\n logger.error(reason);\n });\n };\n\n // observe UI props and render accordingly\n combineLatest(\n context.observe('is active'),\n context.observe('front camera')\n ).subscribe(([isActive, frontCamera]) => {\n this.stopScanner(context); // stop any previous scanner run\n if (isActive) {\n // set constraints, so that\n // - camera uses the max width/height available, while keeping aspect ratio\n // - faces front or back according to prop\n const constraints = {\n video: {\n width: { 'max': videoElement.width },\n height: { 'max': videoElement.height },\n facingMode: frontCamera ? 'user' : 'environment'\n },\n audio: false,\n };\n decodeContinuously(constraints);\n elementDom.appendChild(focusOverlay);\n } else {\n if (elementDom.contains(focusOverlay)) {\n elementDom.removeChild(focusOverlay);\n }\n }\n }\n );\n elementDom.appendChild(videoElement);\n }\n\n /**\n * Method called any time we want to refresh the DOM element\n *\n * @param videoElement\n * @param focusOverlay\n */\n resizeComponent(videoElement, focusOverlay) {\n\n let actualScaling = Math.min(videoElement.width / videoElement.videoWidth, videoElement.height / videoElement.videoHeight);\n const w = actualScaling * videoElement.videoWidth;\n const h = actualScaling * videoElement.videoHeight;\n const borderWidth = w / 10;\n\n const focusOverlayStyle = \"z-index: 1; box-sizing: border-box !important; border: solid rgba(0, 0, 0, 0.3); box-shadow: rgba(255, 0, 0, 0.5) 0px 0px 0px 5px inset; position: absolute;\";\n focusOverlay.setAttribute('style', focusOverlayStyle +\n ` width: ${w}px; height: ${h}px; border-width:${borderWidth}px; ` +\n `top: ${(videoElement.height - h) / 2}px; left: ${(videoElement.width - w) / 2}px;`\n );\n }\n\n /**\n * @param {!UIContext} context\n */\n stopScanner(context) {\n // stop the media stream\n const controls = /** @type {IScannerControls} */(context.get('IScannerControls'));\n if (controls !== null) {\n controls.stop();\n context.remove('IScannerControls');\n }\n }\n\n /**\n * This method runs when the brick is ready in the HTML DOM.\n * @override\n */\n destroy(context) {\n this.stopScanner(context);\n }\n}\n\n// Registry\nregisterBrick('017670012f3f3cc70b49', QRScanner);\n","import { UIBrick, registerBrick } from 'olympe';\nimport {BarcodeFormat, MultiFormatWriter} from '@zxing/library';\nimport { combineLatest } from \"rxjs\";\n\nexport default class QRViewer extends UIBrick {\n\n /**\n * This method runs when the brick is ready in the HTML DOM.\n * @override\n * @param {!Context} context\n * @param {!Element} elementDom\n */\n draw(context, elementDom) {\n\n combineLatest(\n context.observe('data'),\n context.observe('Width'),\n context.observe('Height')\n ).subscribe(([data, width, height]) => {\n\n // Clean dom before recreating content\n if(elementDom.lastChild){\n elementDom.removeChild(elementDom.lastChild);\n }\n\n if(data.length > 0){\n // QR Code is the only supported format yet, maybe future versions of the lib will support barcode as well\n const writer = new MultiFormatWriter();\n const matrix = writer.encode(data, BarcodeFormat.QR_CODE, width, height, null);\n\n // Compute the image\n const buffer = [];\n for(let y = 0; y < height; y++) {\n for(let x = 0; x < width; x++) {\n const color = matrix.get(x, y) ? 0 : 255;\n const pos = (y * width + x) * 4; // position in buffer based on x and y\n buffer[pos ] = color; // some R value [0, 255]\n buffer[pos+1] = color; // some G value\n buffer[pos+2] = color; // some B value\n buffer[pos+3] = 255; // set alpha channel\n }\n }\n\n // create off-screen canvas element\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n canvas.addEventListener('click', () => {\n context.getEvent('On Click').trigger();\n });\n\n const ctx = canvas.getContext('2d');\n const iData = ctx.createImageData(width, height);\n iData.data.set(buffer);\n ctx.putImageData(iData, 0, 0);\n \n elementDom.appendChild(canvas);\n }\n });\n }\n}\n\nregisterBrick('017b3b02371dafb244ec', QRViewer);\n","module.exports = require(\"@olympeio/core\");","module.exports = require(\"@zxing/browser\");","module.exports = require(\"@zxing/library\");","module.exports = require(\"rxjs\");","module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Import Olympe runtime or DRAW\nimport 'olympe';\n\n// Import project bricks (we use webpack-import-glob-loader to import all bricks)\n;\nimport './web/QRScanner.js'; import './web/QRViewer.js';\n\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"main-web.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;;;;;;ACV2D;AAChB;AACuC;AACN;AACvC;;AAErC;AACA;AACA,IAAI,+DAAmB,EAAE,+DAAmB,EAAE,+DAAmB,EAAE,gEAAoB;AACvF;AACA,IAAI,iEAAqB,EAAE,kEAAsB,EAAE,6DAAiB,EAAE,gEAAoB;AAC1F;AACA,IAAI,iEAAqB,EAAE,qEAAyB,EAAE,+DAAmB,EAAE,iEAAqB;AAChG;;AAEO,wBAAwB,2CAAO;;AAEtC;AACA;AACA;AACA,eAAe,YAAY;AAC3B,eAAe,UAAU;AACzB;AACA;AACA,uBAAuB,yDAAS;;AAEhC;AACA;;AAEA,QAAQ,mDAAa;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,sBAAsB,2EAA+B;;AAErD;AACA,mCAAmC,oEAAwB;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,6DAAiB;AAC1D;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;;AAEA;AACA,QAAQ,mDAAa;AACrB;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;A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ACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA,E;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA,E;;;;;WCPA,wF;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D,E;;;;;;;;;;;;;;;ACNA;AACgB;;AAEhB;AACA;AAC4B,CAA4B","sources":["webpack://@olympeio-extensions/qrcode-zxing/webpack/universalModuleDefinition","webpack://@olympeio-extensions/qrcode-zxing/./src/web/QRScanner.js","webpack://@olympeio-extensions/qrcode-zxing/./src/web/QRViewer.js","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"@olympeio/core\"","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"@zxing/browser\"","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"@zxing/library\"","webpack://@olympeio-extensions/qrcode-zxing/external commonjs \"rxjs\"","webpack://@olympeio-extensions/qrcode-zxing/external umd \"olympe\"","webpack://@olympeio-extensions/qrcode-zxing/webpack/bootstrap","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/compat get default export","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/define property getters","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/hasOwnProperty shorthand","webpack://@olympeio-extensions/qrcode-zxing/webpack/runtime/make namespace object","webpack://@olympeio-extensions/qrcode-zxing/./src/main-web.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"olympe\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"olympe\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@olympeio-extensions/qrcode-zxing\"] = factory(require(\"olympe\"));\n\telse\n\t\troot[\"@olympeio-extensions/qrcode-zxing\"] = factory(root[\"olympe\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {\nreturn ","import { UIBrick, registerBrick, UIContext } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport { BarcodeFormat, DecodeHintType, NotFoundException } from '@zxing/library';\nimport { BrowserMultiFormatReader, IScannerControls } from '@zxing/browser';\nimport { combineLatest } from 'rxjs';\n\nconst ALL_FORMATS = [\n // 1D product\n BarcodeFormat.UPC_A, BarcodeFormat.UPC_E, BarcodeFormat.EAN_8, BarcodeFormat.EAN_13,\n // 1D product\n BarcodeFormat.CODE_39, BarcodeFormat.CODE_128, BarcodeFormat.ITF, BarcodeFormat.RSS_14,\n // 2D\n BarcodeFormat.QR_CODE, BarcodeFormat.DATA_MATRIX, BarcodeFormat.AZTEC, BarcodeFormat.PDF_417\n];\n\nexport class QRScanner extends UIBrick {\n\n /**\n * This method runs when the brick is ready in the HTML DOM.\n * @override\n * @param {!UIContext} context\n * @param {!Element} elementDom\n */\n draw(context, elementDom) {\n const logger = getLogger('QRScanner');\n\n const videoElement = document.createElement('video');\n const focusOverlay = document.createElement('div');\n\n combineLatest(\n context.getProperty('Width').observe(),\n context.getProperty('Height').observe()\n ).subscribe(([width, height]) => {\n if (width <= 0 || height <= 0) {\n logger.error('Width and Height should be positive number');\n logger.warn('Please set positive width and height');\n videoElement.width = 1;\n videoElement.height = 1;\n } else {\n videoElement.width = width;\n videoElement.height = height;\n }\n this.resizeComponent(videoElement, focusOverlay);\n });\n\n // setup accepted barcode formats\n const decodeContinuously = (constraints) => {\n const hints = new Map();\n hints.set(DecodeHintType.POSSIBLE_FORMATS, ALL_FORMATS);\n\n // start the scanner (MediaStream selection is done by the lib, following the constraints)\n const codeReader = new BrowserMultiFormatReader();\n codeReader.setHints(hints);\n\n codeReader.decodeFromConstraints(constraints, videoElement, (result, err) => {\n if (result) {\n // export scanned value\n context.getProperty('scanned value').set(result.getText());\n context.getEvent('On Scanned').trigger();\n }\n if (err) {\n if (!(err instanceof NotFoundException)) {\n logger.error(err);\n }\n }\n }).then((obj) => {\n // register the scanner controls for stopping it later\n context.set('IScannerControls', obj);\n\n // set the size & position of the overlay to match the actual video\n this.resizeComponent(videoElement, focusOverlay);\n }).catch((reason) => {\n logger.error(reason);\n });\n };\n\n // observe UI props and render accordingly\n combineLatest(\n context.observe('is active'),\n context.observe('front camera')\n ).subscribe(([isActive, frontCamera]) => {\n this.stopScanner(context); // stop any previous scanner run\n if (isActive) {\n // set constraints, so that\n // - camera uses the max width/height available, while keeping aspect ratio\n // - faces front or back according to prop\n const constraints = {\n video: {\n width: { 'max': videoElement.width },\n height: { 'max': videoElement.height },\n facingMode: frontCamera ? 'user' : 'environment'\n },\n audio: false,\n };\n decodeContinuously(constraints);\n elementDom.appendChild(focusOverlay);\n } else {\n if (elementDom.contains(focusOverlay)) {\n elementDom.removeChild(focusOverlay);\n }\n }\n }\n );\n elementDom.appendChild(videoElement);\n }\n\n /**\n * Method called any time we want to refresh the DOM element\n *\n * @param videoElement\n * @param focusOverlay\n */\n resizeComponent(videoElement, focusOverlay) {\n\n let actualScaling = Math.min(videoElement.width / videoElement.videoWidth, videoElement.height / videoElement.videoHeight);\n const w = actualScaling * videoElement.videoWidth;\n const h = actualScaling * videoElement.videoHeight;\n const borderWidth = w / 10;\n\n const focusOverlayStyle = \"z-index: 1; box-sizing: border-box !important; border: solid rgba(0, 0, 0, 0.3); box-shadow: rgba(255, 0, 0, 0.5) 0px 0px 0px 5px inset; position: absolute;\";\n focusOverlay.setAttribute('style', focusOverlayStyle +\n ` width: ${w}px; height: ${h}px; border-width:${borderWidth}px; ` +\n `top: ${(videoElement.height - h) / 2}px; left: ${(videoElement.width - w) / 2}px;`\n );\n }\n\n /**\n * @param {!UIContext} context\n */\n stopScanner(context) {\n // stop the media stream\n const controls = /** @type {IScannerControls} */(context.get('IScannerControls'));\n if (controls !== null) {\n controls.stop();\n context.remove('IScannerControls');\n }\n }\n\n /**\n * This method runs when the brick is ready in the HTML DOM.\n * @override\n */\n destroy(context) {\n this.stopScanner(context);\n }\n}\n\n// Registry\nregisterBrick('017670012f3f3cc70b49', QRScanner);\n","import { UIBrick, registerBrick } from 'olympe';\nimport {BarcodeFormat, MultiFormatWriter} from '@zxing/library';\nimport { combineLatest } from \"rxjs\";\n\nexport default class QRViewer extends UIBrick {\n\n /**\n * This method runs when the brick is ready in the HTML DOM.\n * @override\n * @param {!Context} context\n * @param {!Element} elementDom\n */\n draw(context, elementDom) {\n\n combineLatest(\n context.observe('data'),\n context.observe('Width'),\n context.observe('Height')\n ).subscribe(([data, width, height]) => {\n\n // Clean dom before recreating content\n if(elementDom.lastChild){\n elementDom.removeChild(elementDom.lastChild);\n }\n\n if(data.length > 0){\n // QR Code is the only supported format yet, maybe future versions of the lib will support barcode as well\n const writer = new MultiFormatWriter();\n const matrix = writer.encode(data, BarcodeFormat.QR_CODE, width, height, null);\n\n // Compute the image\n const buffer = [];\n for(let y = 0; y < height; y++) {\n for(let x = 0; x < width; x++) {\n const color = matrix.get(x, y) ? 0 : 255;\n const pos = (y * width + x) * 4; // position in buffer based on x and y\n buffer[pos ] = color; // some R value [0, 255]\n buffer[pos+1] = color; // some G value\n buffer[pos+2] = color; // some B value\n buffer[pos+3] = 255; // set alpha channel\n }\n }\n\n // create off-screen canvas element\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n canvas.addEventListener('click', () => {\n context.getEvent('On Click').trigger();\n });\n\n const ctx = canvas.getContext('2d');\n const iData = ctx.createImageData(width, height);\n iData.data.set(buffer);\n ctx.putImageData(iData, 0, 0);\n \n elementDom.appendChild(canvas);\n }\n });\n }\n}\n\nregisterBrick('017b3b02371dafb244ec', QRViewer);\n","module.exports = require(\"@olympeio/core\");","module.exports = require(\"@zxing/browser\");","module.exports = require(\"@zxing/library\");","module.exports = require(\"rxjs\");","module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Import Olympe runtime or DRAW\nimport 'olympe';\n\n// Import project bricks (we use webpack-import-glob-loader to import all bricks)\n;\nimport './web/QRScanner.js'; import './web/QRViewer.js';\n\n"],"names":[],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@olympeio-extensions/qrcode-zxing","version":"2.11.
|
|
1
|
+
{"name":"@olympeio-extensions/qrcode-zxing","version":"2.11.3","main":"main-node.js","browser":"main-web.js","dependencies":{"@olympeio/core":"2.11.3","@olympeio/runtime-web":"~9.11.0","@olympeio/runtime-node":"~9.11.0","@zxing/browser":"0.0.9","@zxing/library":"0.18.6","rxjs":"7.8.1"},"codeAsData":"codeAsData"}
|