From 0eddef73fa2a67983b6fd8f4995f6125bede8a78 Mon Sep 17 00:00:00 2001 From: Orest Bida Date: Thu, 30 Mar 2023 10:10:30 +0200 Subject: [PATCH 1/6] Update dev. dependencies --- package.json | 6 +- pnpm-lock.yaml | 537 ++++++++++++++++++++++++++----------------------- 2 files changed, 283 insertions(+), 260 deletions(-) diff --git a/package.json b/package.json index 1f5dd9b..90b3d3e 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,10 @@ }, "homepage": "https://github.com/orestbida/iframemanager#readme", "devDependencies": { - "cssnano": "^5.1.14", + "cssnano": "^6.0.0", "postcss": "^8.4.21", "postcss-cli": "^10.1.0", - "postcss-custom-properties": "^12.1.11", - "terser": "^5.16.3" + "postcss-custom-properties": "^13.1.4", + "terser": "^5.16.8" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54f6350..336f352 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,21 +1,46 @@ lockfileVersion: 5.4 specifiers: - cssnano: ^5.1.14 + cssnano: ^6.0.0 postcss: ^8.4.21 postcss-cli: ^10.1.0 - postcss-custom-properties: ^12.1.11 - terser: ^5.16.3 + postcss-custom-properties: ^13.1.4 + terser: ^5.16.8 devDependencies: - cssnano: 5.1.14_postcss@8.4.21 + cssnano: 6.0.0_postcss@8.4.21 postcss: 8.4.21 postcss-cli: 10.1.0_postcss@8.4.21 - postcss-custom-properties: 12.1.11_postcss@8.4.21 - terser: 5.16.3 + postcss-custom-properties: 13.1.4_postcss@8.4.21 + terser: 5.16.8 packages: + /@csstools/cascade-layer-name-parser/1.0.1_eu5cdbcexitnvbdq5yia3g22um: + resolution: {integrity: sha512-SAAi5DpgJJWkfTvWSaqkgyIsTawa83hMwKrktkj6ra2h+q6ZN57vOGZ6ySHq6RSo+CbP64fA3aPChPBRDDUgtw==} + engines: {node: ^14 || ^16 || >=18} + peerDependencies: + '@csstools/css-parser-algorithms': ^2.0.0 + '@csstools/css-tokenizer': ^2.0.0 + dependencies: + '@csstools/css-parser-algorithms': 2.1.0_5vzy4lghjvuzkedkkk4tqwjftm + '@csstools/css-tokenizer': 2.1.0 + dev: true + + /@csstools/css-parser-algorithms/2.1.0_5vzy4lghjvuzkedkkk4tqwjftm: + resolution: {integrity: sha512-KP8TicdXpUyeB1NMlbHud/1l39xvLGvqNFWMpG4qC6H1zs9SadGUHe5SO92n/659sDW9aGDvm9AMru0DZkN1Bw==} + engines: {node: ^14 || ^16 || >=18} + peerDependencies: + '@csstools/css-tokenizer': ^2.0.0 + dependencies: + '@csstools/css-tokenizer': 2.1.0 + dev: true + + /@csstools/css-tokenizer/2.1.0: + resolution: {integrity: sha512-dtqFyoJBHUxGi9zPZdpCKP1xk8tq6KPHJ/NY4qWXiYo6IcSGwzk3L8x2XzZbbyOyBs9xQARoGveU2AsgLj6D2A==} + engines: {node: ^14 || ^16 || >=18} + dev: true + /@jridgewell/gen-mapping/0.3.2: resolution: {integrity: sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==} engines: {node: '>=6.0.0'} @@ -71,7 +96,7 @@ packages: engines: {node: '>= 8'} dependencies: '@nodelib/fs.scandir': 2.1.5 - fastq: 1.13.0 + fastq: 1.15.0 dev: true /@trysound/sax/0.2.0: @@ -79,8 +104,8 @@ packages: engines: {node: '>=10.13.0'} dev: true - /acorn/8.8.1: - resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==} + /acorn/8.8.2: + resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==} engines: {node: '>=0.4.0'} hasBin: true dev: true @@ -97,8 +122,8 @@ packages: color-convert: 2.0.1 dev: true - /anymatch/3.1.2: - resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} + /anymatch/3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} dependencies: normalize-path: 3.0.0 @@ -121,15 +146,15 @@ packages: fill-range: 7.0.1 dev: true - /browserslist/4.21.4: - resolution: {integrity: sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==} + /browserslist/4.21.5: + resolution: {integrity: sha512-tUkiguQGW7S3IhB7N+c2MV/HZPSCPAAiYBZXLsBhFB/PCy6ZKKsZrmBayHV9fdGV/ARIfJ14NkxKzRDjvp7L6w==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001431 - electron-to-chromium: 1.4.284 - node-releases: 2.0.6 - update-browserslist-db: 1.0.10_browserslist@4.21.4 + caniuse-lite: 1.0.30001473 + electron-to-chromium: 1.4.345 + node-releases: 2.0.10 + update-browserslist-db: 1.0.10_browserslist@4.21.5 dev: true /buffer-from/1.1.2: @@ -139,21 +164,21 @@ packages: /caniuse-api/3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} dependencies: - browserslist: 4.21.4 - caniuse-lite: 1.0.30001431 + browserslist: 4.21.5 + caniuse-lite: 1.0.30001473 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 dev: true - /caniuse-lite/1.0.30001431: - resolution: {integrity: sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==} + /caniuse-lite/1.0.30001473: + resolution: {integrity: sha512-ewDad7+D2vlyy+E4UJuVfiBsU69IL+8oVmTuZnH5Q6CIUbxNfI50uVpRHbUPDD6SUaN2o0Lh4DhTrvLG/Tn1yg==} dev: true /chokidar/3.5.3: resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} engines: {node: '>= 8.10.0'} dependencies: - anymatch: 3.1.2 + anymatch: 3.1.3 braces: 3.0.2 glob-parent: 5.1.2 is-binary-path: 2.1.0 @@ -197,8 +222,8 @@ packages: engines: {node: '>= 10'} dev: true - /css-declaration-sorter/6.3.1_postcss@8.4.21: - resolution: {integrity: sha512-fBffmak0bPAnyqc/HO8C3n2sHrp9wcqQz6ES9koRF2/mLOVAx9zIQ3Y7R29sYCteTPqMCwns4WYQoCX91Xl3+w==} + /css-declaration-sorter/6.4.0_postcss@8.4.21: + resolution: {integrity: sha512-jDfsatwWMWN0MODAFuHszfjphEXfNw9JUAhmY4pLu3TyTU+ohUpsbVtbU+1MZn4a47D9kqh03i4eyOm+74+zew==} engines: {node: ^10 || ^12 || >=14} peerDependencies: postcss: ^8.0.9 @@ -206,22 +231,30 @@ packages: postcss: 8.4.21 dev: true - /css-select/4.3.0: - resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} + /css-select/5.1.0: + resolution: {integrity: sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==} dependencies: boolbase: 1.0.0 css-what: 6.1.0 - domhandler: 4.3.1 - domutils: 2.8.0 + domhandler: 5.0.3 + domutils: 3.0.1 nth-check: 2.1.1 dev: true - /css-tree/1.1.3: - resolution: {integrity: sha512-tRpdppF7TRazZrjJ6v3stzv93qxRcSsFmW6cX0Zm2NVKpxE1WV1HblnghVv9TreireHkqI/VDEsfolRF1p6y7Q==} - engines: {node: '>=8.0.0'} + /css-tree/2.2.1: + resolution: {integrity: sha512-OA0mILzGc1kCOCSJerOeqDxDQ4HOh+G8NbOJFOTgOCzpw7fCBubk0fEyxp8AgOL/jvLgYA/uV0cMbe43ElF1JA==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'} dependencies: - mdn-data: 2.0.14 - source-map: 0.6.1 + mdn-data: 2.0.28 + source-map-js: 1.0.2 + dev: true + + /css-tree/2.3.1: + resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} + dependencies: + mdn-data: 2.0.30 + source-map-js: 1.0.2 dev: true /css-what/6.1.0: @@ -235,70 +268,69 @@ packages: hasBin: true dev: true - /cssnano-preset-default/5.2.13_postcss@8.4.21: - resolution: {integrity: sha512-PX7sQ4Pb+UtOWuz8A1d+Rbi+WimBIxJTRyBdgGp1J75VU0r/HFQeLnMYgHiCAp6AR4rqrc7Y4R+1Rjk3KJz6DQ==} - engines: {node: ^10 || ^12 || >=14.0} + /cssnano-preset-default/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-BDxlaFzObRDXUiCCBQUNQcI+f1/aX2mgoNtXGjV6PG64POcHoDUoX+LgMWw+Q4609QhxwkcSnS65YFs42RA6qQ==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - css-declaration-sorter: 6.3.1_postcss@8.4.21 - cssnano-utils: 3.1.0_postcss@8.4.21 + css-declaration-sorter: 6.4.0_postcss@8.4.21 + cssnano-utils: 4.0.0_postcss@8.4.21 postcss: 8.4.21 postcss-calc: 8.2.4_postcss@8.4.21 - postcss-colormin: 5.3.0_postcss@8.4.21 - postcss-convert-values: 5.1.3_postcss@8.4.21 - postcss-discard-comments: 5.1.2_postcss@8.4.21 - postcss-discard-duplicates: 5.1.0_postcss@8.4.21 - postcss-discard-empty: 5.1.1_postcss@8.4.21 - postcss-discard-overridden: 5.1.0_postcss@8.4.21 - postcss-merge-longhand: 5.1.7_postcss@8.4.21 - postcss-merge-rules: 5.1.3_postcss@8.4.21 - postcss-minify-font-values: 5.1.0_postcss@8.4.21 - postcss-minify-gradients: 5.1.1_postcss@8.4.21 - postcss-minify-params: 5.1.4_postcss@8.4.21 - postcss-minify-selectors: 5.2.1_postcss@8.4.21 - postcss-normalize-charset: 5.1.0_postcss@8.4.21 - postcss-normalize-display-values: 5.1.0_postcss@8.4.21 - postcss-normalize-positions: 5.1.1_postcss@8.4.21 - postcss-normalize-repeat-style: 5.1.1_postcss@8.4.21 - postcss-normalize-string: 5.1.0_postcss@8.4.21 - postcss-normalize-timing-functions: 5.1.0_postcss@8.4.21 - postcss-normalize-unicode: 5.1.1_postcss@8.4.21 - postcss-normalize-url: 5.1.0_postcss@8.4.21 - postcss-normalize-whitespace: 5.1.1_postcss@8.4.21 - postcss-ordered-values: 5.1.3_postcss@8.4.21 - postcss-reduce-initial: 5.1.1_postcss@8.4.21 - postcss-reduce-transforms: 5.1.0_postcss@8.4.21 - postcss-svgo: 5.1.0_postcss@8.4.21 - postcss-unique-selectors: 5.1.1_postcss@8.4.21 - dev: true - - /cssnano-utils/3.1.0_postcss@8.4.21: - resolution: {integrity: sha512-JQNR19/YZhz4psLX/rQ9M83e3z2Wf/HdJbryzte4a3NSuafyp9w/I4U+hx5C2S9g41qlstH7DEWnZaaj83OuEA==} - engines: {node: ^10 || ^12 || >=14.0} + postcss-colormin: 6.0.0_postcss@8.4.21 + postcss-convert-values: 6.0.0_postcss@8.4.21 + postcss-discard-comments: 6.0.0_postcss@8.4.21 + postcss-discard-duplicates: 6.0.0_postcss@8.4.21 + postcss-discard-empty: 6.0.0_postcss@8.4.21 + postcss-discard-overridden: 6.0.0_postcss@8.4.21 + postcss-merge-longhand: 6.0.0_postcss@8.4.21 + postcss-merge-rules: 6.0.0_postcss@8.4.21 + postcss-minify-font-values: 6.0.0_postcss@8.4.21 + postcss-minify-gradients: 6.0.0_postcss@8.4.21 + postcss-minify-params: 6.0.0_postcss@8.4.21 + postcss-minify-selectors: 6.0.0_postcss@8.4.21 + postcss-normalize-charset: 6.0.0_postcss@8.4.21 + postcss-normalize-display-values: 6.0.0_postcss@8.4.21 + postcss-normalize-positions: 6.0.0_postcss@8.4.21 + postcss-normalize-repeat-style: 6.0.0_postcss@8.4.21 + postcss-normalize-string: 6.0.0_postcss@8.4.21 + postcss-normalize-timing-functions: 6.0.0_postcss@8.4.21 + postcss-normalize-unicode: 6.0.0_postcss@8.4.21 + postcss-normalize-url: 6.0.0_postcss@8.4.21 + postcss-normalize-whitespace: 6.0.0_postcss@8.4.21 + postcss-ordered-values: 6.0.0_postcss@8.4.21 + postcss-reduce-initial: 6.0.0_postcss@8.4.21 + postcss-reduce-transforms: 6.0.0_postcss@8.4.21 + postcss-svgo: 6.0.0_postcss@8.4.21 + postcss-unique-selectors: 6.0.0_postcss@8.4.21 + dev: true + + /cssnano-utils/4.0.0_postcss@8.4.21: + resolution: {integrity: sha512-Z39TLP+1E0KUcd7LGyF4qMfu8ZufI0rDzhdyAMsa/8UyNUU8wpS0fhdBxbQbv32r64ea00h4878gommRVg2BHw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 dev: true - /cssnano/5.1.14_postcss@8.4.21: - resolution: {integrity: sha512-Oou7ihiTocbKqi0J1bB+TRJIQX5RMR3JghA8hcWSw9mjBLQ5Y3RWqEDoYG3sRNlAbCIXpqMoZGbq5KDR3vdzgw==} - engines: {node: ^10 || ^12 || >=14.0} + /cssnano/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-RGlcbzGhzEBCHuQe3k+Udyj5M00z0pm9S+VurHXFEOXxH+y0sVrJH2sMzoyz2d8N1EScazg+DVvmgyx0lurwwA==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - cssnano-preset-default: 5.2.13_postcss@8.4.21 - lilconfig: 2.0.6 + cssnano-preset-default: 6.0.0_postcss@8.4.21 + lilconfig: 2.1.0 postcss: 8.4.21 - yaml: 1.10.2 dev: true - /csso/4.2.0: - resolution: {integrity: sha512-wvlcdIbf6pwKEk7vHj8/Bkc0B4ylXZruLvOgs9doS5eOsOpuodOV2zJChSpkp+pRpYQLQMeF04nr3Z68Sta9jA==} - engines: {node: '>=8.0.0'} + /csso/5.0.5: + resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'} dependencies: - css-tree: 1.1.3 + css-tree: 2.2.1 dev: true /dependency-graph/0.11.0: @@ -313,43 +345,44 @@ packages: path-type: 4.0.0 dev: true - /dom-serializer/1.4.1: - resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==} + /dom-serializer/2.0.0: + resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==} dependencies: domelementtype: 2.3.0 - domhandler: 4.3.1 - entities: 2.2.0 + domhandler: 5.0.3 + entities: 4.4.0 dev: true /domelementtype/2.3.0: resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} dev: true - /domhandler/4.3.1: - resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} + /domhandler/5.0.3: + resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} engines: {node: '>= 4'} dependencies: domelementtype: 2.3.0 dev: true - /domutils/2.8.0: - resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} + /domutils/3.0.1: + resolution: {integrity: sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==} dependencies: - dom-serializer: 1.4.1 + dom-serializer: 2.0.0 domelementtype: 2.3.0 - domhandler: 4.3.1 + domhandler: 5.0.3 dev: true - /electron-to-chromium/1.4.284: - resolution: {integrity: sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==} + /electron-to-chromium/1.4.345: + resolution: {integrity: sha512-znGhOQK2TUYLICgS25uaM0a7pHy66rSxbre7l762vg9AUoCcJK+Bu+HCPWpjL/U/kK8/Hf+6E0szAUJSyVYb3Q==} dev: true /emoji-regex/8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} dev: true - /entities/2.2.0: - resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} + /entities/4.4.0: + resolution: {integrity: sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==} + engines: {node: '>=0.12'} dev: true /escalade/3.1.1: @@ -368,8 +401,8 @@ packages: micromatch: 4.0.5 dev: true - /fastq/1.13.0: - resolution: {integrity: sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==} + /fastq/1.15.0: + resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} dependencies: reusify: 1.0.4 dev: true @@ -381,11 +414,11 @@ packages: to-regex-range: 5.0.1 dev: true - /fs-extra/11.1.0: - resolution: {integrity: sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==} + /fs-extra/11.1.1: + resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} engines: {node: '>=14.14'} dependencies: - graceful-fs: 4.2.10 + graceful-fs: 4.2.11 jsonfile: 6.1.0 universalify: 2.0.0 dev: true @@ -415,23 +448,23 @@ packages: is-glob: 4.0.3 dev: true - /globby/13.1.2: - resolution: {integrity: sha512-LKSDZXToac40u8Q1PQtZihbNdTYSNMuWe+K5l+oa6KgDzSvVrHXlJy40hUP522RjAIoNLJYBJi7ow+rbFpIhHQ==} + /globby/13.1.3: + resolution: {integrity: sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dependencies: dir-glob: 3.0.1 fast-glob: 3.2.12 - ignore: 5.2.0 + ignore: 5.2.4 merge2: 1.4.1 slash: 4.0.0 dev: true - /graceful-fs/4.2.10: - resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} + /graceful-fs/4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} dev: true - /ignore/5.2.0: - resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} + /ignore/5.2.4: + resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} dev: true @@ -469,11 +502,11 @@ packages: dependencies: universalify: 2.0.0 optionalDependencies: - graceful-fs: 4.2.10 + graceful-fs: 4.2.11 dev: true - /lilconfig/2.0.6: - resolution: {integrity: sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==} + /lilconfig/2.1.0: + resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} engines: {node: '>=10'} dev: true @@ -485,8 +518,12 @@ packages: resolution: {integrity: sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==} dev: true - /mdn-data/2.0.14: - resolution: {integrity: sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==} + /mdn-data/2.0.28: + resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==} + dev: true + + /mdn-data/2.0.30: + resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} dev: true /merge2/1.4.1: @@ -502,14 +539,14 @@ packages: picomatch: 2.3.1 dev: true - /nanoid/3.3.4: - resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==} + /nanoid/3.3.6: + resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true - /node-releases/2.0.6: - resolution: {integrity: sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==} + /node-releases/2.0.10: + resolution: {integrity: sha512-5GFldHPXVG/YZmFzJvKK2zDSzPKhEp0+ZR5SVaoSag9fsL5YgHbUHDfnG5494ISANDcK4KwPXAx2xqVEydmd7w==} dev: true /normalize-path/3.0.0: @@ -517,11 +554,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /normalize-url/6.1.0: - resolution: {integrity: sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==} - engines: {node: '>=10'} - dev: true - /nth-check/2.1.1: resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} dependencies: @@ -553,7 +585,7 @@ packages: postcss: ^8.2.2 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.10 + postcss-selector-parser: 6.0.11 postcss-value-parser: 4.2.0 dev: true @@ -566,9 +598,9 @@ packages: dependencies: chokidar: 3.5.3 dependency-graph: 0.11.0 - fs-extra: 11.1.0 + fs-extra: 11.1.1 get-stdin: 9.0.0 - globby: 13.1.2 + globby: 13.1.3 picocolors: 1.0.0 postcss: 8.4.21 postcss-load-config: 4.0.1_postcss@8.4.21 @@ -576,75 +608,78 @@ packages: pretty-hrtime: 1.0.3 read-cache: 1.0.0 slash: 5.0.0 - yargs: 17.6.2 + yargs: 17.7.1 transitivePeerDependencies: - ts-node dev: true - /postcss-colormin/5.3.0_postcss@8.4.21: - resolution: {integrity: sha512-WdDO4gOFG2Z8n4P8TWBpshnL3JpmNmJwdnfP2gbk2qBA8PWwOYcmjmI/t3CmMeL72a7Hkd+x/Mg9O2/0rD54Pg==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-colormin/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-EuO+bAUmutWoZYgHn2T1dG1pPqHU6L4TjzPlu4t1wZGXQ/fxV16xg2EJmYi0z+6r+MGV1yvpx1BHkUaRrPa2bw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 caniuse-api: 3.0.0 colord: 2.9.3 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-convert-values/5.1.3_postcss@8.4.21: - resolution: {integrity: sha512-82pC1xkJZtcJEfiLw6UXnXVXScgtBrjlO5CBmuDQc+dlb88ZYheFsjTn40+zBVi3DkfF7iezO0nJUPLcJK3pvA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-convert-values/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-U5D8QhVwqT++ecmy8rnTb+RL9n/B806UVaS3m60lqle4YDFcpbS3ae5bTQIh3wOGUSDHSEtMYLs/38dNG7EYFw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-custom-properties/12.1.11_postcss@8.4.21: - resolution: {integrity: sha512-0IDJYhgU8xDv1KY6+VgUwuQkVtmYzRwu+dMjnmdMafXYv86SWqfxkc7qdDvWS38vsjaEtv8e0vGOUQrAiMBLpQ==} - engines: {node: ^12 || ^14 || >=16} + /postcss-custom-properties/13.1.4_postcss@8.4.21: + resolution: {integrity: sha512-iSAdaZrM3KMec8cOSzeTUNXPYDlhqsMJHpt62yrjwG6nAnMtRHPk5JdMzGosBJtqEahDolvD5LNbcq+EZ78o5g==} + engines: {node: ^14 || ^16 || >=18} peerDependencies: - postcss: ^8.2 + postcss: ^8.4 dependencies: + '@csstools/cascade-layer-name-parser': 1.0.1_eu5cdbcexitnvbdq5yia3g22um + '@csstools/css-parser-algorithms': 2.1.0_5vzy4lghjvuzkedkkk4tqwjftm + '@csstools/css-tokenizer': 2.1.0 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-discard-comments/5.1.2_postcss@8.4.21: - resolution: {integrity: sha512-+L8208OVbHVF2UQf1iDmRcbdjJkuBF6IS29yBDSiWUIzpYaAhtNl6JYnYm12FnkeCwQqF5LeklOu6rAqgfBZqQ==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-discard-comments/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-p2skSGqzPMZkEQvJsgnkBhCn8gI7NzRH2683EEjrIkoMiwRELx68yoUJ3q3DGSGuQ8Ug9Gsn+OuDr46yfO+eFw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 dev: true - /postcss-discard-duplicates/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-zmX3IoSI2aoenxHV6C7plngHWWhUOV3sP1T8y2ifzxzbtnuhk1EdPwm0S1bIUNaJ2eNbWeGLEwzw8huPD67aQw==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-discard-duplicates/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-bU1SXIizMLtDW4oSsi5C/xHKbhLlhek/0/yCnoMQany9k3nPBq+Ctsv/9oMmyqbR96HYHxZcHyK2HR5P/mqoGA==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 dev: true - /postcss-discard-empty/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-zPz4WljiSuLWsI0ir4Mcnr4qQQ5e1Ukc3i7UfE2XcrwKK2LIPIqE5jxMRxO6GbI3cv//ztXDsXwEWT3BHOGh3A==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-discard-empty/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-b+h1S1VT6dNhpcg+LpyiUrdnEZfICF0my7HAKgJixJLW7BnNmpRH34+uw/etf5AhOlIhIAuXApSzzDzMI9K/gQ==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 dev: true - /postcss-discard-overridden/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-21nOL7RqWR1kasIVdKs8HNqQJhFxLsyRfAnUDm4Fe4t4mCWL9OJiHvlHPjcd8zc5Myu89b/7wZDnOSjFgeWRtw==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-discard-overridden/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-4VELwssYXDFigPYAZ8vL4yX4mUepF/oCBeeIT4OXsJPYOtvJumyz9WflmJWTfDwCUcpDR+z0zvCWBXgTx35SVw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -663,38 +698,38 @@ packages: ts-node: optional: true dependencies: - lilconfig: 2.0.6 + lilconfig: 2.1.0 postcss: 8.4.21 - yaml: 2.1.3 + yaml: 2.2.1 dev: true - /postcss-merge-longhand/5.1.7_postcss@8.4.21: - resolution: {integrity: sha512-YCI9gZB+PLNskrK0BB3/2OzPnGhPkBEwmwhfYk1ilBHYVAZB7/tkTHFBAnCrvBBOmeYyMYw3DMjT55SyxMBzjQ==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-merge-longhand/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-4VSfd1lvGkLTLYcxFuISDtWUfFS4zXe0FpF149AyziftPFQIWxjvFSKhA4MIxMe4XM3yTDgQMbSNgzIVxChbIg==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 postcss-value-parser: 4.2.0 - stylehacks: 5.1.1_postcss@8.4.21 + stylehacks: 6.0.0_postcss@8.4.21 dev: true - /postcss-merge-rules/5.1.3_postcss@8.4.21: - resolution: {integrity: sha512-LbLd7uFC00vpOuMvyZop8+vvhnfRGpp2S+IMQKeuOZZapPRY4SMq5ErjQeHbHsjCUgJkRNrlU+LmxsKIqPKQlA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-merge-rules/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-rCXkklftzEkniyv3f4mRCQzxD6oE4Quyh61uyWTUbCJ26Pv2hoz+fivJSsSBWxDBeScR4fKCfF3HHTcD7Ybqnw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 caniuse-api: 3.0.0 - cssnano-utils: 3.1.0_postcss@8.4.21 + cssnano-utils: 4.0.0_postcss@8.4.21 postcss: 8.4.21 - postcss-selector-parser: 6.0.10 + postcss-selector-parser: 6.0.11 dev: true - /postcss-minify-font-values/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-el3mYTgx13ZAPPirSVsHqFzl+BBBDrXvbySvPGFnQcTI4iNslrPaFq4muTkLZmKlGk4gyFAYUBMH30+HurREyA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-minify-font-values/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-zNRAVtyh5E8ndZEYXA4WS8ZYsAp798HiIQ1V2UF/C/munLp2r1UGHwf1+6JFu7hdEhJFN+W1WJQKBrtjhFgEnA==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -702,52 +737,52 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-minify-gradients/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-VGvXMTpCEo4qHTNSa9A0a3D+dxGFZCYwR6Jokk+/3oB6flu2/PnPXAh2x7x52EkY5xlIHLm+Le8tJxe/7TNhzw==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-minify-gradients/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-wO0F6YfVAR+K1xVxF53ueZJza3L+R3E6cp0VwuXJQejnNUH0DjcAFe3JEBeTY1dLwGa0NlDWueCA1VlEfiKgAA==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: colord: 2.9.3 - cssnano-utils: 3.1.0_postcss@8.4.21 + cssnano-utils: 4.0.0_postcss@8.4.21 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-minify-params/5.1.4_postcss@8.4.21: - resolution: {integrity: sha512-+mePA3MgdmVmv6g+30rn57USjOGSAyuxUmkfiWpzalZ8aiBkdPYjXWtHuwJGm1v5Ojy0Z0LaSYhHaLJQB0P8Jw==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-minify-params/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-Fz/wMQDveiS0n5JPcvsMeyNXOIMrwF88n7196puSuQSWSa+/Ofc1gDOSY2xi8+A4PqB5dlYCKk/WfqKqsI+ReQ==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 - cssnano-utils: 3.1.0_postcss@8.4.21 + browserslist: 4.21.5 + cssnano-utils: 4.0.0_postcss@8.4.21 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-minify-selectors/5.2.1_postcss@8.4.21: - resolution: {integrity: sha512-nPJu7OjZJTsVUmPdm2TcaiohIwxP+v8ha9NehQ2ye9szv4orirRU3SDdtUmKH+10nzn0bAyOXZ0UEr7OpvLehg==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-minify-selectors/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-ec/q9JNCOC2CRDNnypipGfOhbYPuUkewGwLnbv6omue/PSASbHSU7s6uSQ0tcFRVv731oMIx8k0SP4ZX6be/0g==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.10 + postcss-selector-parser: 6.0.11 dev: true - /postcss-normalize-charset/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-mSgUJ+pd/ldRGVx26p2wz9dNZ7ji6Pn8VWBajMXFf8jk7vUoSrZ2lt/wZR7DtlZYKesmZI680qjr2CeFF2fbUg==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-charset/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-cqundwChbu8yO/gSWkuFDmKrCZ2vJzDAocheT2JTd0sFNA4HMGoKMfbk2B+J0OmO0t5GUkiAkSM5yF2rSLUjgQ==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 dev: true - /postcss-normalize-display-values/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-WP4KIM4o2dazQXWmFaqMmcvsKmhdINFblgSeRgn8BJ6vxaMyaJkwAzpPpuvSIoG/rmX3M+IrRZEz2H0glrQNEA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-display-values/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-Qyt5kMrvy7dJRO3OjF7zkotGfuYALETZE+4lk66sziWSPzlBEt7FrUshV6VLECkI4EN8Z863O6Nci4NXQGNzYw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -755,9 +790,9 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-positions/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-6UpCb0G4eofTCQLFVuI3EVNZzBNPiIKcA1AKVka+31fTVySphr3VUgAIULBhxZkKgwLImhzMR2Bw1ORK+37INg==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-positions/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-mPCzhSV8+30FZyWhxi6UoVRYd3ZBJgTRly4hOkaSifo0H+pjDYcii/aVT4YE6QpOil15a5uiv6ftnY3rm0igPg==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -765,9 +800,9 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-repeat-style/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-repeat-style/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-50W5JWEBiOOAez2AKBh4kRFm2uhrT3O1Uwdxz7k24aKtbD83vqmcVG7zoIwo6xI2FZ/HDlbrCopXhLeTpQib1A==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -775,9 +810,9 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-string/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-oYiIJOf4T9T1N4i+abeIc7Vgm/xPCGih4bZz5Nm0/ARVJ7K6xrDlLwvwqOydvyL3RHNf8qZk6vo3aatiw/go3w==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-string/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-KWkIB7TrPOiqb8ZZz6homet2KWKJwIlysF5ICPZrXAylGe2hzX/HSf4NTX2rRPJMAtlRsj/yfkrWGavFuB+c0w==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -785,9 +820,9 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-timing-functions/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-DOEkzJ4SAXv5xkHl0Wa9cZLF3WCBhF3o1SKVxKQAa+0pYKlueTpCgvkFAHfk+Y64ezX9+nITGrDZeVGgITJXjg==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-timing-functions/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-tpIXWciXBp5CiFs8sem90IWlw76FV4oi6QEWfQwyeREVwUy39VSeSqjAT7X0Qw650yAimYW5gkl2Gd871N5SQg==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -795,31 +830,30 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-unicode/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-qnCL5jzkNUmKVhZoENp1mJiGNPcsJCs1aaRmURmeJGES23Z/ajaln+EPTD+rBeNkSryI+2WTdW+lwcVdOikrpA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-unicode/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-ui5crYkb5ubEUDugDc786L/Me+DXp2dLg3fVJbqyAl0VPkAeALyAijF2zOsnZyaS1HyfPuMH0DwyY18VMFVNkg==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-url/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-5upGeDO+PVthOxSmds43ZeMeZfKH+/DKgGRD7TElkkyS46JXAUhMzIKiCa7BabPeIy3AQcTkXwVVN7DbqsiCew==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-url/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-98mvh2QzIPbb02YDIrYvAg4OUzGH7s1ZgHlD3fIdTHLgPLRpv1ZTKJDnSAKr4Rt21ZQFzwhGMXxpXlfrUBKFHw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - normalize-url: 6.1.0 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-normalize-whitespace/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-83ZJ4t3NUDETIHTa3uEg6asWjSBYL5EdkVB0sDncx9ERzOKBVJIUeDO9RyA9Zwtig8El1d79HBp0JEi8wvGQnA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-normalize-whitespace/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-7cfE1AyLiK0+ZBG6FmLziJzqQCpTQY+8XjMhMAz8WSBSCsCNNUKujgIgjCAmDT3cJ+3zjTXFkoD15ZPsckArVw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -827,31 +861,31 @@ packages: postcss-value-parser: 4.2.0 dev: true - /postcss-ordered-values/5.1.3_postcss@8.4.21: - resolution: {integrity: sha512-9UO79VUhPwEkzbb3RNpqqghc6lcYej1aveQteWY+4POIwlqkYE21HKWaLDF6lWNuqCobEAyTovVhtI32Rbv2RQ==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-ordered-values/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-K36XzUDpvfG/nWkjs6d1hRBydeIxGpKS2+n+ywlKPzx1nMYDYpoGbcjhj5AwVYJK1qV2/SDoDEnHzlPD6s3nMg==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - cssnano-utils: 3.1.0_postcss@8.4.21 + cssnano-utils: 4.0.0_postcss@8.4.21 postcss: 8.4.21 postcss-value-parser: 4.2.0 dev: true - /postcss-reduce-initial/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-//jeDqWcHPuXGZLoolFrUXBDyuEGbr9S2rMo19bkTIjBQ4PqkaO+oI8wua5BOUxpfi97i3PCoInsiFIEBfkm9w==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-reduce-initial/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-s2UOnidpVuXu6JiiI5U+fV2jamAw5YNA9Fdi/GRK0zLDLCfXmSGqQtzpUPtfN66RtCbb9fFHoyZdQaxOB3WxVA==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 caniuse-api: 3.0.0 postcss: 8.4.21 dev: true - /postcss-reduce-transforms/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-2fbdbmgir5AvpW9RLtdONx1QoYG2/EtqpNQbFASDlixBbAYuTcJ0dECwlqNqH7VbaUnEnh8SrxOe2sRIn24XyQ==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-reduce-transforms/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-FQ9f6xM1homnuy1wLe9lP1wujzxnwt1EwiigtWwuyf8FsqqXUDUp2Ulxf9A5yjlUOTdCJO6lonYjg1mgqIIi2w==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: @@ -870,33 +904,33 @@ packages: thenby: 1.3.4 dev: true - /postcss-selector-parser/6.0.10: - resolution: {integrity: sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==} + /postcss-selector-parser/6.0.11: + resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==} engines: {node: '>=4'} dependencies: cssesc: 3.0.0 util-deprecate: 1.0.2 dev: true - /postcss-svgo/5.1.0_postcss@8.4.21: - resolution: {integrity: sha512-D75KsH1zm5ZrHyxPakAxJWtkyXew5qwS70v56exwvw542d9CRtTo78K0WeFxZB4G7JXKKMbEZtZayTGdIky/eA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-svgo/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-r9zvj/wGAoAIodn84dR/kFqwhINp5YsJkLoujybWG59grR/IHx+uQ2Zo+IcOwM0jskfYX3R0mo+1Kip1VSNcvw==} + engines: {node: ^14 || ^16 || >= 18} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 postcss-value-parser: 4.2.0 - svgo: 2.8.0 + svgo: 3.0.2 dev: true - /postcss-unique-selectors/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-5JiODlELrz8L2HwxfPnhOWZYWDxVHWL83ufOv84NrcgipI7TaeRsatAhK4Tr2/ZiYldpK/wBvw5BD3qfaK96GA==} - engines: {node: ^10 || ^12 || >=14.0} + /postcss-unique-selectors/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-EPQzpZNxOxP7777t73RQpZE5e9TrnCrkvp7AH7a0l89JmZiPnS82y216JowHXwpBCQitfyxrof9TK3rYbi7/Yw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: postcss: 8.4.21 - postcss-selector-parser: 6.0.10 + postcss-selector-parser: 6.0.11 dev: true /postcss-value-parser/4.2.0: @@ -907,7 +941,7 @@ packages: resolution: {integrity: sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.4 + nanoid: 3.3.6 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true @@ -977,11 +1011,6 @@ packages: engines: {node: '>=0.10.0'} dev: true - /stable/0.1.8: - resolution: {integrity: sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==} - deprecated: 'Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility' - dev: true - /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -998,38 +1027,37 @@ packages: ansi-regex: 5.0.1 dev: true - /stylehacks/5.1.1_postcss@8.4.21: - resolution: {integrity: sha512-sBpcd5Hx7G6seo7b1LkpttvTz7ikD0LlH5RmdcBNb6fFR0Fl7LQwHDFr300q4cwUqi+IYrFGmsIHieMBfnN/Bw==} - engines: {node: ^10 || ^12 || >=14.0} + /stylehacks/6.0.0_postcss@8.4.21: + resolution: {integrity: sha512-+UT589qhHPwz6mTlCLSt/vMNTJx8dopeJlZAlBMJPWA3ORqu6wmQY7FBXf+qD+FsqoBJODyqNxOUP3jdntFRdw==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 postcss: 8.4.21 - postcss-selector-parser: 6.0.10 + postcss-selector-parser: 6.0.11 dev: true - /svgo/2.8.0: - resolution: {integrity: sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==} - engines: {node: '>=10.13.0'} + /svgo/3.0.2: + resolution: {integrity: sha512-Z706C1U2pb1+JGP48fbazf3KxHrWOsLme6Rv7imFBn5EnuanDW1GPaA/P1/dvObE670JDePC3mnj0k0B7P0jjQ==} + engines: {node: '>=14.0.0'} hasBin: true dependencies: '@trysound/sax': 0.2.0 commander: 7.2.0 - css-select: 4.3.0 - css-tree: 1.1.3 - csso: 4.2.0 + css-select: 5.1.0 + css-tree: 2.3.1 + csso: 5.0.5 picocolors: 1.0.0 - stable: 0.1.8 dev: true - /terser/5.16.3: - resolution: {integrity: sha512-v8wWLaS/xt3nE9dgKEWhNUFP6q4kngO5B8eYFUuebsu7Dw/UNAnpUod6UHo04jSSkv8TzKHjZDSd7EXdDQAl8Q==} + /terser/5.16.8: + resolution: {integrity: sha512-QI5g1E/ef7d+PsDifb+a6nnVgC4F22Bg6T0xrBrz6iloVB4PUkkunp6V8nzoOOZJIzjWVdAGqCdlKlhLq/TbIA==} engines: {node: '>=10'} hasBin: true dependencies: '@jridgewell/source-map': 0.3.2 - acorn: 8.8.1 + acorn: 8.8.2 commander: 2.20.3 source-map-support: 0.5.21 dev: true @@ -1050,13 +1078,13 @@ packages: engines: {node: '>= 10.0.0'} dev: true - /update-browserslist-db/1.0.10_browserslist@4.21.4: + /update-browserslist-db/1.0.10_browserslist@4.21.5: resolution: {integrity: sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==} hasBin: true peerDependencies: browserslist: '>= 4.21.0' dependencies: - browserslist: 4.21.4 + browserslist: 4.21.5 escalade: 3.1.1 picocolors: 1.0.0 dev: true @@ -1079,13 +1107,8 @@ packages: engines: {node: '>=10'} dev: true - /yaml/1.10.2: - resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} - engines: {node: '>= 6'} - dev: true - - /yaml/2.1.3: - resolution: {integrity: sha512-AacA8nRULjKMX2DvWvOAdBZMOfQlypSFkjcOcu9FalllIDJ1kvlREzcdIZmidQUqqeMv7jorHjq2HlLv/+c2lg==} + /yaml/2.2.1: + resolution: {integrity: sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==} engines: {node: '>= 14'} dev: true @@ -1094,8 +1117,8 @@ packages: engines: {node: '>=12'} dev: true - /yargs/17.6.2: - resolution: {integrity: sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==} + /yargs/17.7.1: + resolution: {integrity: sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==} engines: {node: '>=12'} dependencies: cliui: 8.0.1 From 2bfb5ff5468e5f06e37613e1f605b00a0cfa35ed Mon Sep 17 00:00:00 2001 From: Orest Bida Date: Thu, 30 Mar 2023 10:21:56 +0200 Subject: [PATCH 2/6] Fix uncaught exception when service div is no longer present (close #34) --- dist/iframemanager.js | 2 +- src/iframemanager.js | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/dist/iframemanager.js b/dist/iframemanager.js index 6d0b4ec..fdc69d1 100644 --- a/dist/iframemanager.js +++ b/dist/iframemanager.js @@ -3,4 +3,4 @@ * Author Orest Bida * Released under the MIT License */ -(()=>{'use strict';const e='click',t='{data-id}',n='accept',o='reject',c='c-h-n',i='c-h-b',s='show-ph';let r,a,l,f,d,u={},v=!1,m='',p={},b=new Map,h='api';const w=['onload','onerror','src'],_=e=>'function'==typeof e,g=e=>'string'==typeof e,$=e=>a.createElement(e),S=()=>$('div'),I=()=>{const e=$('button');return e.type='button',e},T=(e,t)=>e.className=t,x=(e,t)=>e.classList.add(t),y=(e,t)=>e.appendChild(t),P=e=>e&&Object.keys(e)||[],k=(e,t)=>{for(const n in t)j(e,n,t[n])},D=e=>{const t=e.dataset,n={},o='data-iframe-',c=e.getAttributeNames().filter((e=>e.slice(0,12)===o)).map((e=>e.slice(12))),i=e.querySelector('[data-placeholder]'),s=i?.hasAttribute('data-visible');s&&i.removeAttribute('data-visible');const r=i?.cloneNode(!0);for(const t of c)n[t]=e.getAttribute(o+t);return{t:t.id,o:t.title,i:t.thumbnail,l:t.params,u:e,v:null,m:i,p:r,h:null,_:!1,g:!1,$:!0,S:'widget'in t,I:s,T:n}},O=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{for(const c of o)c.isIntersecting&&(E(t,n[c.target.dataset.index]),e.unobserve(c.target))}));for(const t of n)e.observe(t.u)}},E=(e,n)=>{const o=e=>{n.h.style.backgroundImage=`url('${e}')`;const t=new Image;t.onload=()=>x(n.h,'loaded'),t.src=e};if(g(n.i))''!==n.i&&o(n.i);else if(_(e))e(n.t,(e=>o(e)));else if(g(e)){const c=e.replace(t,n.t);o(c)}},M=(e,n)=>{if(e._)return;if(e._=!0,e.m){const t=e.p.cloneNode(!0);e.m.replaceWith(t),e.m=t}const o=n.iframe;if(_(n.onAccept))return void n.onAccept(e.u,(t=>{if(!(t instanceof HTMLIFrameElement))return!1;k(t,o),k(t,e.T),e.P=t,e._=!0,x(e.u,i),(!e.I||e.S)&&x(e.u,s)}));e.P=$('iframe');const c=e.l||n?.iframe?.params;let r=(n.embedUrl||'').replace(t,e.t);e.o&&(e.P.title=e.o),c&&g(c)&&(r+='?'===c.slice(0,1)?c:`?${c}`),e.P.onload=()=>{x(e.u,i),e.P.onload=void 0,_(o?.onload)&&o.onload(e.t,e.P)},k(e.P,o),k(e.P,e.T),e.P.src=r,y(e.v,e.P)},j=(e,t,n)=>{w.includes(t)||e.setAttribute(t,n)},C=e=>{x(e.u,c),e.$=!1},L=e=>{e.u.classList.remove(c,i,s),e.$=!0},N=e=>(e=a.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`))?e.pop():'',A=(t,n,o)=>{const i=u[t],s=n.languages;i.forEach((i=>{if(!i.g&&s){const r=s[m]?.loadBtn,l=s[m]?.notice,f=s[m]?.loadAllBtn,d=a.createElement('div'),u=S(),v=S(),p=S(),b=S();T(d,'cll'),i.v=d;const w=()=>{C(i),M(i,n)};if(r){const t=I();t.textContent=r,T(t,'c-l-b'),t.addEventListener(e,w),y(b,t)}if(f){const n=I();n.textContent=f,T(n,r?'c-la-b':'c-l-b'),n.addEventListener(e,(()=>{w(),h=e,W.acceptService(t)})),y(b,n)}const _=S(),P=S(),k=S(),D=S(),O=S();T(_,'cc-text'),T(D,'c-bg-i'),i.h=D,T(k,'c-ld'),g(i.i)&&''===i.i||T(P,'c-bg');const E=i.o,j=a.createDocumentFragment();if(E){const e=$('span');T(e,'c-tl'),e.insertAdjacentHTML('beforeend',E),y(j,e)}y(_,j),u&&_.insertAdjacentHTML('beforeend',l||''),y(v,_),T(O,'c-t-cn'),T(v,'c-n-t'),T(p,'c-n-c'),T(u,'c-nt'),T(b,'c-n-a'),y(O,v),(r||f)&&y(O,b),y(p,O),y(u,p),y(P,D),y(d,u),(n.thumbnailUrl||i.i)&&y(d,P),y(d,k),o&&x(i.u,c),i.u.prepend(d),i.g=!0,setTimeout((()=>x(i.u,'c-an')),20)}}))},F=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{if(v)e.disconnect();else for(let c=0;c{const i=o[c].target;setTimeout((()=>{const e=i.dataset.index;M(n[e],t),C(n[e])}),50*c),e.unobserve(i)})(c)}));n.forEach((t=>{t._||e.observe(t.u)}))}},G=(e,t)=>e in t?e:P(t).length>0?m in t?m:P(t)[0]:void 0,H=(e,t)=>{const{cookie:n}=t;N(n.name)||(e=>{const{hostname:t,protocol:n}=location,o=e.name,c=new Date,i=e.path||'/',s=864e5*(e.expiration||182),r=e.sameSite||'Lax',l=e.domain||t;c.setTime(c.getTime()+s);let f=o+'=1'+(0!==s?`; Expires=${c.toUTCString()}`:'')+`; Path=${i}`+`; SameSite=${r}`;l.indexOf('.')>-1&&(f+=`; Domain=${l}`),'https:'===n&&(f+='; Secure'),a.cookie=f})(n),F(e,t)},J=(e,t)=>{const{cookie:n}=t;N(n.name)&&(e=>{const t=e.name,n=e.path||'/',o=e.domain||location.hostname;a.cookie=`${t}=; Path=${n}; Domain=${o}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`})(n),((e,t)=>{const n=u[e];for(let e=0;e{var o;n[e]._&&(_(t.onReject)?(t.onReject(n[e].P||n[e].u),n[e]._=!1):((o=n[e]).P.parentNode.removeChild(o.P),o._=!1)),L(n[e])})(e)})(e,t)},V=(e,t,n)=>{_(d)&&d({eventSource:{type:h,service:e,action:t},changedServices:n})},W={acceptService:e=>{v=!1;const t=[];if('all'===e){for(const e of f)b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e));t.length>0&&V(e,n,t)}else f.includes(e)&&(b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e),V(e,n,t)));h='api'},rejectService:e=>{const t=[];if('all'===e){v=!0;for(const e of f)J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e));t.length>0&&V(e,o,t)}else f.includes(e)&&(J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e),V(e,o,t)))},childExists:async({parent:e=r,childProperty:t,childSelector:n='iframe',timeout:o=1e3,maxTimeout:c=15e3})=>{let i=1;const s=t?()=>e[t]:()=>e.querySelector(n);return new Promise((e=>{const t=()=>{if(s()||i++*o>c)return e(void 0!==s());setTimeout(t,o)};t()}))},getState:()=>({services:new Map(b),acceptedServices:[...b].filter((([e,t])=>!!t)).map((([e])=>e))}),getConfig:()=>l,run:e=>{if(a=document,r=window,l=e,p=l.services,d=l.onChange,f=P(p),0===f.length)return;m=l.currLang;const t=p[f[0]].languages;!0===l.autoLang?m=G(navigator.language.slice(0,2).toLowerCase(),t):g(l.currLang)&&(m=G(l.currLang,t));for(const e of f){u[e]=[];const t=a.querySelectorAll(`div[data-service="${e}"]`),n=t.length;if(0===n)continue;for(let o=0;oW)})(); \ No newline at end of file +(()=>{'use strict';const e='click',t='{data-id}',n='accept',o='reject',c='c-h-n',i='c-h-b',s='show-ph';let r,a,l,f,d,u={},v=!1,m='',p={},b=new Map,h='api';const w=['onload','onerror','src'],_=e=>'function'==typeof e,g=e=>'string'==typeof e,$=e=>a.createElement(e),S=()=>$('div'),I=()=>{const e=$('button');return e.type='button',e},T=(e,t)=>e.className=t,x=(e,t)=>e.classList.add(t),y=(e,t)=>e.appendChild(t),P=e=>e&&Object.keys(e)||[],D=(e,t)=>{for(const n in t)j(e,n,t[n])},O=e=>{const t=e.dataset,n={},o='data-iframe-',c=e.getAttributeNames().filter((e=>e.slice(0,12)===o)).map((e=>e.slice(12))),i=e.querySelector('[data-placeholder]'),s=i?.hasAttribute('data-visible');s&&i.removeAttribute('data-visible');const r=i?.cloneNode(!0);for(const t of c)n[t]=e.getAttribute(o+t);return{t:t.id,o:t.title,i:t.thumbnail,l:t.params,u:e,v:null,m:i,p:r,h:null,_:!1,g:!1,$:!0,S:'widget'in t,I:s,T:n}},k=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{for(const c of o)c.isIntersecting&&(E(t,n[c.target.dataset.index]),e.unobserve(c.target))}));for(const t of n)e.observe(t.u)}},E=(e,n)=>{const o=e=>{n.h.style.backgroundImage=`url('${e}')`;const t=new Image;t.onload=()=>x(n.h,'loaded'),t.src=e};if(g(n.i))''!==n.i&&o(n.i);else if(_(e))e(n.t,(e=>o(e)));else if(g(e)){const c=e.replace(t,n.t);o(c)}},M=(e,n)=>{if(e._)return;if(e._=!0,e.m){const t=e.p.cloneNode(!0);e.m.replaceWith(t),e.m=t}const o=n.iframe;if(_(n.onAccept))return void n.onAccept(e.u,(t=>{if(!(t instanceof HTMLIFrameElement))return!1;D(t,o),D(t,e.T),e.P=t,e._=!0,x(e.u,i),(!e.I||e.S)&&x(e.u,s)}));e.P=$('iframe');const c=e.l||n?.iframe?.params;let r=(n.embedUrl||'').replace(t,e.t);e.o&&(e.P.title=e.o),c&&g(c)&&(r+='?'===c.slice(0,1)?c:`?${c}`),e.P.onload=()=>{x(e.u,i),e.P.onload=void 0,_(o?.onload)&&o.onload(e.t,e.P)},D(e.P,o),D(e.P,e.T),e.P.src=r,y(e.v,e.P)},j=(e,t,n)=>{w.includes(t)||e.setAttribute(t,n)},C=e=>{x(e.u,c),e.$=!1},L=e=>{e.u.classList.remove(c,i,s),e.$=!0},N=e=>(e=a.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`))?e.pop():'',A=(t,n,o)=>{const i=u[t],s=n.languages;i.forEach((i=>{if(!i.g&&s){const r=s[m]?.loadBtn,l=s[m]?.notice,f=s[m]?.loadAllBtn,d=a.createElement('div'),u=S(),v=S(),p=S(),b=S();T(d,'cll'),i.v=d;const w=()=>{C(i),M(i,n)};if(r){const t=I();t.textContent=r,T(t,'c-l-b'),t.addEventListener(e,w),y(b,t)}if(f){const n=I();n.textContent=f,T(n,r?'c-la-b':'c-l-b'),n.addEventListener(e,(()=>{w(),h=e,W.acceptService(t)})),y(b,n)}const _=S(),P=S(),D=S(),O=S(),k=S();T(_,'cc-text'),T(O,'c-bg-i'),i.h=O,T(D,'c-ld'),g(i.i)&&''===i.i||T(P,'c-bg');const E=i.o,j=a.createDocumentFragment();if(E){const e=$('span');T(e,'c-tl'),e.insertAdjacentHTML('beforeend',E),y(j,e)}y(_,j),u&&_.insertAdjacentHTML('beforeend',l||''),y(v,_),T(k,'c-t-cn'),T(v,'c-n-t'),T(p,'c-n-c'),T(u,'c-nt'),T(b,'c-n-a'),y(k,v),(r||f)&&y(k,b),y(p,k),y(u,p),y(P,O),y(d,u),(n.thumbnailUrl||i.i)&&y(d,P),y(d,D),o&&x(i.u,c),i.u.prepend(d),i.g=!0,setTimeout((()=>x(i.u,'c-an')),20)}}))},F=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{if(v)e.disconnect();else for(let c=0;c{const i=o[c].target;setTimeout((()=>{const e=i.dataset.index;M(n[e],t),C(n[e])}),50*c),e.unobserve(i)})(c)}));n.forEach((t=>{t._||e.observe(t.u)}))}},G=(e,t)=>e in t?e:P(t).length>0?m in t?m:P(t)[0]:void 0,H=(e,t)=>{const{cookie:n}=t;N(n.name)||(e=>{const{hostname:t,protocol:n}=location,o=e.name,c=new Date,i=e.path||'/',s=864e5*(e.expiration||182),r=e.sameSite||'Lax',l=e.domain||t;c.setTime(c.getTime()+s);let f=o+'=1'+(0!==s?`; Expires=${c.toUTCString()}`:'')+`; Path=${i}`+`; SameSite=${r}`;l.indexOf('.')>-1&&(f+=`; Domain=${l}`),'https:'===n&&(f+='; Secure'),a.cookie=f})(n),F(e,t)},J=(e,t)=>{const{cookie:n}=t;N(n.name)&&(e=>{const t=e.name,n=e.path||'/',o=e.domain||location.hostname;a.cookie=`${t}=; Path=${n}; Domain=${o}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`})(n),((e,t)=>{const n=u[e];for(let e=0;e{var o;n[e]._&&(_(t.onReject)?(t.onReject(n[e].P||n[e].u),n[e]._=!1):((o=n[e]).P.parentNode.removeChild(o.P),o._=!1)),L(n[e])})(e)})(e,t)},V=(e,t,n)=>{_(d)&&d({eventSource:{type:h,service:e,action:t},changedServices:n})},W={acceptService:e=>{v=!1;const t=[];if('all'===e){for(const e of f)b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e));t.length>0&&V(e,n,t)}else f.includes(e)&&(b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e),V(e,n,t)));h='api'},rejectService:e=>{const t=[];if('all'===e){v=!0;for(const e of f)J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e));t.length>0&&V(e,o,t)}else f.includes(e)&&(J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e),V(e,o,t)))},childExists:async({parent:e=r,childProperty:t,childSelector:n='iframe',timeout:o=1e3,maxTimeout:c=15e3})=>{let i=1;const s=t?()=>e[t]:()=>e.querySelector(n);return new Promise((e=>{const t=()=>{if(s()||i++*o>c)return e(void 0!==s());setTimeout(t,o)};t()}))},getState:()=>({services:new Map(b),acceptedServices:[...b].filter((([e,t])=>!!t)).map((([e])=>e))}),getConfig:()=>l,run:e=>{if(a=document,r=window,l=e,p=l.services,d=l.onChange,f=P(p),0===f.length)return;m=l.currLang;const t=p[f[0]].languages;!0===l.autoLang?m=G(navigator.language.slice(0,2).toLowerCase(),t):g(l.currLang)&&(m=G(l.currLang,t));for(const e of f){const t=p[e],n=t.cookie||={},o=n.name||=`im_${e}`,c=N(o);b.set(e,!!c),u[e]=[];const i=a.querySelectorAll(`div[data-service="${e}"]`),s=i.length;if(0!==s){for(let t=0;tW)})(); \ No newline at end of file diff --git a/src/iframemanager.js b/src/iframemanager.js index 47b91ff..f45d9f1 100644 --- a/src/iframemanager.js +++ b/src/iframemanager.js @@ -862,6 +862,18 @@ // for each service for(const serviceName of serviceNames){ + const currService = services[serviceName]; + + /** + * Use service's name as cookie name, + * if no cookie.name is specified + */ + const cookieObj = (currService.cookie ||= {}); + const cookieName = (cookieObj.name ||= `im_${serviceName}`); + + const cookieExists = getCookie(cookieName); + servicesState.set(serviceName, !!cookieExists); + // add new empty array of videos (with current service name as property) iframeDivs[serviceName] = []; @@ -883,23 +895,6 @@ iframeDivs[serviceName].push(getDivProps(foundDivs[j])); } - const currService = services[serviceName]; - - /** - * Use service's name as cookie name, - * if no cookie.name is specified - */ - const { cookie } = currService; - !cookie && (currService.cookie = {}); - const cookieObj = currService.cookie; - - const cookieName = cookieObj.name || `im_${serviceName}`; - cookieObj.name = cookieName; - - const cookieExists = getCookie(cookieName); - - servicesState.set(serviceName, !!cookieExists); - // if cookie is not set => show notice if(cookieExists){ createAllNotices(serviceName, currService, true); From 384e390d5aa15f6f014048cdee1bedfada231442 Mon Sep 17 00:00:00 2001 From: Orest Bida Date: Thu, 30 Mar 2023 11:01:31 +0200 Subject: [PATCH 3/6] Code refactoring & cleanup --- dist/iframemanager.js | 2 +- src/iframemanager.js | 260 +++++++++++++++++++++--------------------- 2 files changed, 133 insertions(+), 129 deletions(-) diff --git a/dist/iframemanager.js b/dist/iframemanager.js index fdc69d1..71efd1f 100644 --- a/dist/iframemanager.js +++ b/dist/iframemanager.js @@ -3,4 +3,4 @@ * Author Orest Bida * Released under the MIT License */ -(()=>{'use strict';const e='click',t='{data-id}',n='accept',o='reject',c='c-h-n',i='c-h-b',s='show-ph';let r,a,l,f,d,u={},v=!1,m='',p={},b=new Map,h='api';const w=['onload','onerror','src'],_=e=>'function'==typeof e,g=e=>'string'==typeof e,$=e=>a.createElement(e),S=()=>$('div'),I=()=>{const e=$('button');return e.type='button',e},T=(e,t)=>e.className=t,x=(e,t)=>e.classList.add(t),y=(e,t)=>e.appendChild(t),P=e=>e&&Object.keys(e)||[],D=(e,t)=>{for(const n in t)j(e,n,t[n])},O=e=>{const t=e.dataset,n={},o='data-iframe-',c=e.getAttributeNames().filter((e=>e.slice(0,12)===o)).map((e=>e.slice(12))),i=e.querySelector('[data-placeholder]'),s=i?.hasAttribute('data-visible');s&&i.removeAttribute('data-visible');const r=i?.cloneNode(!0);for(const t of c)n[t]=e.getAttribute(o+t);return{t:t.id,o:t.title,i:t.thumbnail,l:t.params,u:e,v:null,m:i,p:r,h:null,_:!1,g:!1,$:!0,S:'widget'in t,I:s,T:n}},k=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{for(const c of o)c.isIntersecting&&(E(t,n[c.target.dataset.index]),e.unobserve(c.target))}));for(const t of n)e.observe(t.u)}},E=(e,n)=>{const o=e=>{n.h.style.backgroundImage=`url('${e}')`;const t=new Image;t.onload=()=>x(n.h,'loaded'),t.src=e};if(g(n.i))''!==n.i&&o(n.i);else if(_(e))e(n.t,(e=>o(e)));else if(g(e)){const c=e.replace(t,n.t);o(c)}},M=(e,n)=>{if(e._)return;if(e._=!0,e.m){const t=e.p.cloneNode(!0);e.m.replaceWith(t),e.m=t}const o=n.iframe;if(_(n.onAccept))return void n.onAccept(e.u,(t=>{if(!(t instanceof HTMLIFrameElement))return!1;D(t,o),D(t,e.T),e.P=t,e._=!0,x(e.u,i),(!e.I||e.S)&&x(e.u,s)}));e.P=$('iframe');const c=e.l||n?.iframe?.params;let r=(n.embedUrl||'').replace(t,e.t);e.o&&(e.P.title=e.o),c&&g(c)&&(r+='?'===c.slice(0,1)?c:`?${c}`),e.P.onload=()=>{x(e.u,i),e.P.onload=void 0,_(o?.onload)&&o.onload(e.t,e.P)},D(e.P,o),D(e.P,e.T),e.P.src=r,y(e.v,e.P)},j=(e,t,n)=>{w.includes(t)||e.setAttribute(t,n)},C=e=>{x(e.u,c),e.$=!1},L=e=>{e.u.classList.remove(c,i,s),e.$=!0},N=e=>(e=a.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`))?e.pop():'',A=(t,n,o)=>{const i=u[t],s=n.languages;i.forEach((i=>{if(!i.g&&s){const r=s[m]?.loadBtn,l=s[m]?.notice,f=s[m]?.loadAllBtn,d=a.createElement('div'),u=S(),v=S(),p=S(),b=S();T(d,'cll'),i.v=d;const w=()=>{C(i),M(i,n)};if(r){const t=I();t.textContent=r,T(t,'c-l-b'),t.addEventListener(e,w),y(b,t)}if(f){const n=I();n.textContent=f,T(n,r?'c-la-b':'c-l-b'),n.addEventListener(e,(()=>{w(),h=e,W.acceptService(t)})),y(b,n)}const _=S(),P=S(),D=S(),O=S(),k=S();T(_,'cc-text'),T(O,'c-bg-i'),i.h=O,T(D,'c-ld'),g(i.i)&&''===i.i||T(P,'c-bg');const E=i.o,j=a.createDocumentFragment();if(E){const e=$('span');T(e,'c-tl'),e.insertAdjacentHTML('beforeend',E),y(j,e)}y(_,j),u&&_.insertAdjacentHTML('beforeend',l||''),y(v,_),T(k,'c-t-cn'),T(v,'c-n-t'),T(p,'c-n-c'),T(u,'c-nt'),T(b,'c-n-a'),y(k,v),(r||f)&&y(k,b),y(p,k),y(u,p),y(P,O),y(d,u),(n.thumbnailUrl||i.i)&&y(d,P),y(d,D),o&&x(i.u,c),i.u.prepend(d),i.g=!0,setTimeout((()=>x(i.u,'c-an')),20)}}))},F=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{if(v)e.disconnect();else for(let c=0;c{const i=o[c].target;setTimeout((()=>{const e=i.dataset.index;M(n[e],t),C(n[e])}),50*c),e.unobserve(i)})(c)}));n.forEach((t=>{t._||e.observe(t.u)}))}},G=(e,t)=>e in t?e:P(t).length>0?m in t?m:P(t)[0]:void 0,H=(e,t)=>{const{cookie:n}=t;N(n.name)||(e=>{const{hostname:t,protocol:n}=location,o=e.name,c=new Date,i=e.path||'/',s=864e5*(e.expiration||182),r=e.sameSite||'Lax',l=e.domain||t;c.setTime(c.getTime()+s);let f=o+'=1'+(0!==s?`; Expires=${c.toUTCString()}`:'')+`; Path=${i}`+`; SameSite=${r}`;l.indexOf('.')>-1&&(f+=`; Domain=${l}`),'https:'===n&&(f+='; Secure'),a.cookie=f})(n),F(e,t)},J=(e,t)=>{const{cookie:n}=t;N(n.name)&&(e=>{const t=e.name,n=e.path||'/',o=e.domain||location.hostname;a.cookie=`${t}=; Path=${n}; Domain=${o}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`})(n),((e,t)=>{const n=u[e];for(let e=0;e{var o;n[e]._&&(_(t.onReject)?(t.onReject(n[e].P||n[e].u),n[e]._=!1):((o=n[e]).P.parentNode.removeChild(o.P),o._=!1)),L(n[e])})(e)})(e,t)},V=(e,t,n)=>{_(d)&&d({eventSource:{type:h,service:e,action:t},changedServices:n})},W={acceptService:e=>{v=!1;const t=[];if('all'===e){for(const e of f)b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e));t.length>0&&V(e,n,t)}else f.includes(e)&&(b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e),V(e,n,t)));h='api'},rejectService:e=>{const t=[];if('all'===e){v=!0;for(const e of f)J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e));t.length>0&&V(e,o,t)}else f.includes(e)&&(J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e),V(e,o,t)))},childExists:async({parent:e=r,childProperty:t,childSelector:n='iframe',timeout:o=1e3,maxTimeout:c=15e3})=>{let i=1;const s=t?()=>e[t]:()=>e.querySelector(n);return new Promise((e=>{const t=()=>{if(s()||i++*o>c)return e(void 0!==s());setTimeout(t,o)};t()}))},getState:()=>({services:new Map(b),acceptedServices:[...b].filter((([e,t])=>!!t)).map((([e])=>e))}),getConfig:()=>l,run:e=>{if(a=document,r=window,l=e,p=l.services,d=l.onChange,f=P(p),0===f.length)return;m=l.currLang;const t=p[f[0]].languages;!0===l.autoLang?m=G(navigator.language.slice(0,2).toLowerCase(),t):g(l.currLang)&&(m=G(l.currLang,t));for(const e of f){const t=p[e],n=t.cookie||={},o=n.name||=`im_${e}`,c=N(o);b.set(e,!!c),u[e]=[];const i=a.querySelectorAll(`div[data-service="${e}"]`),s=i.length;if(0!==s){for(let t=0;tW)})(); \ No newline at end of file +(()=>{'use strict';const e='click',t='{data-id}',n='accept',o='reject',c='c-h-n',i='c-h-b',s='show-ph';let r,a,l,f,d,u={},v=!1,m='',p={},b=new Map,h='api';const w=['onload','onerror','src'],_=e=>'function'==typeof e,g=e=>'string'==typeof e,$=e=>a.createElement(e),S=()=>$('div'),I=()=>{const e=$('button');return e.type='button',e},T=(e,t)=>e.className=t,x=(e,t)=>e.classList.add(t),y=(e,t)=>e.appendChild(t),P=e=>e&&Object.keys(e)||[],D=(e,t)=>{for(const n in t)j(e,n,t[n])},O=e=>{const t=e.dataset,n={},o='data-iframe-',c=e.getAttributeNames().filter((e=>e.slice(0,12)===o)).map((e=>e.slice(12))),i=e.querySelector('[data-placeholder]'),s=i?.hasAttribute('data-visible');s&&i.removeAttribute('data-visible');const r=i?.cloneNode(!0);for(const t of c)n[t]=e.getAttribute(o+t);return{t:t.id,o:t.title,i:t.thumbnail,l:t.params,u:e,v:null,m:i,p:r,h:null,_:!1,g:!1,$:!0,S:'widget'in t,I:s,T:n}},k=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{for(const c of o)c.isIntersecting&&(E(t,n[c.target.dataset.index]),e.unobserve(c.target))}));for(const t of n)e.observe(t.u)}},E=(e,n)=>{const o=e=>{n.h.style.backgroundImage=`url('${e}')`;const t=new Image;t.onload=()=>x(n.h,'loaded'),t.src=e};if(g(n.i))''!==n.i&&o(n.i);else if(_(e))e(n.t,(e=>o(e)));else if(g(e)){const c=e.replace(t,n.t);o(c)}},M=(e,n)=>{if(e._)return;if(e._=!0,e.m){const t=e.p.cloneNode(!0);e.m.replaceWith(t),e.m=t}const o=n.iframe;if(_(n.onAccept))return void n.onAccept(e.u,(t=>{if(!(t instanceof HTMLIFrameElement))return!1;D(t,o),D(t,e.T),e.P=t,e._=!0,x(e.u,i),(!e.I||e.S)&&x(e.u,s)}));e.P=$('iframe');const c=e.l||n.iframe?.params;let r=(n.embedUrl||'').replace(t,e.t);e.o&&(e.P.title=e.o),c&&g(c)&&(r+='?'===c.slice(0,1)?c:`?${c}`),e.P.onload=()=>{x(e.u,i),e.P.onload=void 0,_(o?.onload)&&o.onload(e.t,e.P)},D(e.P,o),D(e.P,e.T),e.P.src=r,y(e.v,e.P)},j=(e,t,n)=>{w.includes(t)||e.setAttribute(t,n)},C=e=>{x(e.u,c),e.$=!1},L=e=>{e.u.classList.remove(c,i,s),e.$=!0},N=e=>(e=a.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`))?e.pop():'',A=(t,n,o)=>{const i=u[t],s=n.languages;i.forEach((i=>{if(!i.g&&s){const r=s[m]?.loadBtn,l=s[m]?.notice,f=s[m]?.loadAllBtn,d=a.createElement('div'),u=S(),v=S(),p=S(),b=S();T(d,'cll'),i.v=d;const w=()=>{C(i),M(i,n)};if(r){const t=I();t.textContent=r,T(t,'c-l-b'),t.addEventListener(e,w),y(b,t)}if(f){const n=I();n.textContent=f,T(n,r?'c-la-b':'c-l-b'),n.addEventListener(e,(()=>{w(),h=e,W.acceptService(t)})),y(b,n)}const _=S(),P=S(),D=S(),O=S(),k=S();T(_,'cc-text'),T(O,'c-bg-i'),i.h=O,T(D,'c-ld'),g(i.i)&&''===i.i||T(P,'c-bg');const E=i.o,j=a.createDocumentFragment();if(E){const e=$('span');T(e,'c-tl'),e.insertAdjacentHTML('beforeend',E),y(j,e)}y(_,j),u&&_.insertAdjacentHTML('beforeend',l||''),y(v,_),T(k,'c-t-cn'),T(v,'c-n-t'),T(p,'c-n-c'),T(u,'c-nt'),T(b,'c-n-a'),y(k,v),(r||f)&&y(k,b),y(p,k),y(u,p),y(P,O),y(d,u),(n.thumbnailUrl||i.i)&&y(d,P),y(d,D),o&&x(i.u,c),i.u.prepend(d),i.g=!0,setTimeout((()=>x(i.u,'c-an')),20)}}))},F=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{if(v)e.disconnect();else for(let c=0;c{const i=o[c].target;setTimeout((()=>{const e=i.dataset.index;M(n[e],t),C(n[e])}),50*c),e.unobserve(i)})(c)}));n.forEach((t=>{t._||e.observe(t.u)}))}},G=(e,t)=>e in t?e:P(t).length>0?m in t?m:P(t)[0]:void 0,H=(e,t)=>{const{cookie:n}=t;N(n.name)||(e=>{const{hostname:t,protocol:n}=location,o=e.name,c=new Date,i=e.path||'/',s=864e5*(e.expiration||182),r=e.sameSite||'Lax',l=e.domain||t;c.setTime(c.getTime()+s);let f=o+'=1'+(0!==s?`; Expires=${c.toUTCString()}`:'')+`; Path=${i}`+`; SameSite=${r}`;l.indexOf('.')>-1&&(f+=`; Domain=${l}`),'https:'===n&&(f+='; Secure'),a.cookie=f})(n),F(e,t)},J=(e,t)=>{const{cookie:n}=t;N(n.name)&&(e=>{const t=e.name,n=e.path||'/',o=e.domain||location.hostname;a.cookie=`${t}=; Path=${n}; Domain=${o}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`})(n),((e,t)=>{const n=u[e];for(let e=0;e{var o;n[e]._&&(_(t.onReject)?(t.onReject(n[e].P||n[e].u),n[e]._=!1):((o=n[e]).P.parentNode.removeChild(o.P),o._=!1)),L(n[e])})(e)})(e,t)},V=(e,t,n)=>{_(d)&&d({eventSource:{type:h,service:e,action:t},changedServices:n})},W={acceptService:e=>{v=!1;const t=[];if('all'===e){for(const e of f)b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e));t.length>0&&V(e,n,t)}else f.includes(e)&&(b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e),V(e,n,t)));h='api'},rejectService:e=>{const t=[];if('all'===e){v=!0;for(const e of f)J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e));t.length>0&&V(e,o,t)}else f.includes(e)&&(J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e),V(e,o,t)))},childExists:async({parent:e=r,childProperty:t,childSelector:n='iframe',timeout:o=1e3,maxTimeout:c=15e3})=>{let i=1;const s=t?()=>e[t]:()=>e.querySelector(n);return new Promise((e=>{const t=()=>{if(s()||i++*o>c)return e(void 0!==s());setTimeout(t,o)};t()}))},getState:()=>({services:new Map(b),acceptedServices:[...b].filter((([e,t])=>!!t)).map((([e])=>e))}),getConfig:()=>l,run:e=>{if(a=document,r=window,l=e,p=l.services,d=l.onChange,f=P(p),0===f.length)return;m=l.currLang;const t=p[f[0]].languages;!0===l.autoLang?m=G(navigator.language.slice(0,2).toLowerCase(),t):g(l.currLang)&&(m=G(l.currLang,t));for(const e of f){const t=p[e],n=t.cookie||={},o=n.name||=`im_${e}`,c=N(o);b.set(e,!!c),u[e]=[];const i=a.querySelectorAll(`div[data-service="${e}"]`),s=i.length;if(0!==s){for(let t=0;tW)})(); \ No newline at end of file diff --git a/src/iframemanager.js b/src/iframemanager.js index f45d9f1..a791ad8 100644 --- a/src/iframemanager.js +++ b/src/iframemanager.js @@ -7,7 +7,7 @@ 'use strict'; /** - * @typedef {Object} IframeObj + * @typedef {Object} servicePropObj * @property {string} _id * @property {string} _title * @property {string} _thumbnail @@ -47,8 +47,9 @@ */ /** - * @typedef {Object} Service + * @typedef {Object} ServiceConfig * @property {string} embedUrl + * @property {string | () => string} [thumbnailUrl] * @property {IframeProp} [iframe] * @property {CookieStructure} cookie * @property {Object.} languages @@ -81,15 +82,15 @@ config, /** - * @type {Object.} + * @type {Object.} */ - iframeDivs = {}, + allServiceProps = {}, stopObserver = false, currLang = '', /** - * @type {Object.} + * @type {Object.} */ services = {}, @@ -175,20 +176,20 @@ } /** - * @param {HTMLDivElement} div - * @returns {IframeObj} + * @param {HTMLDivElement} serviceDiv + * @returns {servicePropObj} */ - const getDivProps = (div) => { + const getDivProps = (serviceDiv) => { - const dataset = div.dataset; + const dataset = serviceDiv.dataset; const iframeAttrs = {}; const iframeAttrSelector = 'data-iframe-'; - const iframeAttrNames = div.getAttributeNames() + const iframeAttrNames = serviceDiv.getAttributeNames() .filter(attr => attr.slice(0, 12) === iframeAttrSelector) .map(attr => attr.slice(12)); - const placeholderDiv = div.querySelector('[data-placeholder]'); + const placeholderDiv = serviceDiv.querySelector('[data-placeholder]'); const dataVisible = placeholderDiv?.hasAttribute('data-visible'); dataVisible && placeholderDiv.removeAttribute('data-visible'); const placeholderClone = placeholderDiv?.cloneNode(true); @@ -197,14 +198,14 @@ * Get all "data-iframe-* attributes */ for(const attrName of iframeAttrNames) - iframeAttrs[attrName] = div.getAttribute(iframeAttrSelector + attrName); + iframeAttrs[attrName] = serviceDiv.getAttribute(iframeAttrSelector + attrName); return { _id: dataset.id, _title: dataset.title, _thumbnail: dataset.thumbnail, _params: dataset.params, - _div: div, + _div: serviceDiv, _innerContainer: null, _placeholderDiv: placeholderDiv, _initialPlaceholderClone: placeholderClone, @@ -224,49 +225,49 @@ */ const lazyLoadThumbnails = (serviceName, thumbnailUrl) => { - const videos = iframeDivs[serviceName]; + const serviceProps = allServiceProps[serviceName]; if ('IntersectionObserver' in win) { const thumbnailObserver = new IntersectionObserver((entries) => { for(const entry of entries){ if(entry.isIntersecting){ - // true index of the video in the array relative to current service - loadThumbnail(thumbnailUrl, videos[entry.target.dataset.index]); + // index relative to the current service array + loadThumbnail(thumbnailUrl, serviceProps[entry.target.dataset.index]); thumbnailObserver.unobserve(entry.target); } } }); - for(const video of videos) - thumbnailObserver.observe(video._div); + for(const serviceProp of serviceProps) + thumbnailObserver.observe(serviceProp._div); } }; /** * @param {string} url - * @param {IframeObj} video + * @param {servicePropObj} serviceProp */ - const loadThumbnail = (url, video) => { + const loadThumbnail = (url, serviceProp) => { const loadBackgroundImage = (src) => { - video._backgroundDiv.style.backgroundImage = `url('${src}')`; + serviceProp._backgroundDiv.style.backgroundImage = `url('${src}')`; const img = new Image(); - img.onload = () => addClass(video._backgroundDiv, 'loaded'); + img.onload = () => addClass(serviceProp._backgroundDiv, 'loaded'); img.src = src; } // Set custom thumbnail if provided - if(isString(video._thumbnail)){ - video._thumbnail !== '' && loadBackgroundImage(video._thumbnail); + if(isString(serviceProp._thumbnail)){ + serviceProp._thumbnail !== '' && loadBackgroundImage(serviceProp._thumbnail); }else{ if(isFunction(url)){ - url(video._id, (src) => loadBackgroundImage(src)); + url(serviceProp._id, (src) => loadBackgroundImage(src)); }else if(isString(url)){ - const src = url.replace(DATA_ID_PLACEHOLDER, video._id); + const src = url.replace(DATA_ID_PLACEHOLDER, serviceProp._id); loadBackgroundImage(src); } } @@ -275,29 +276,29 @@ /** * Create iframe and append it into the specified div - * @param {IframeObj} video - * @param {Service} service + * @param {servicePropObj} serviceProp + * @param {ServiceConfig} serviceConfig */ - const createIframe = (video, service) => { + const createIframe = (serviceProp, serviceConfig) => { // Create iframe only if doesn't already have one - if(video._hasIframe) + if(serviceProp._hasIframe) return; - video._hasIframe = true; + serviceProp._hasIframe = true; - if(video._placeholderDiv){ - const newFreshPlaceholder = video._initialPlaceholderClone.cloneNode(true); - video._placeholderDiv.replaceWith(newFreshPlaceholder); - video._placeholderDiv = newFreshPlaceholder; + if(serviceProp._placeholderDiv){ + const newFreshPlaceholder = serviceProp._initialPlaceholderClone.cloneNode(true); + serviceProp._placeholderDiv.replaceWith(newFreshPlaceholder); + serviceProp._placeholderDiv = newFreshPlaceholder; } - const iframeProps = service.iframe; + const iframeProps = serviceConfig.iframe; - if(isFunction(service.onAccept)){ + if(isFunction(serviceConfig.onAccept)){ // Let the onAccept method create the iframe - service.onAccept(video._div, (iframe) => { + serviceConfig.onAccept(serviceProp._div, (iframe) => { if(!(iframe instanceof HTMLIFrameElement)) return false; @@ -310,34 +311,34 @@ /** * Add all data-attr-* attributes (iframe specific) */ - setIframeAttributes(iframe, video._iframeAttributes); + setIframeAttributes(iframe, serviceProp._iframeAttributes); - video._iframe = iframe; - video._hasIframe = true; + serviceProp._iframe = iframe; + serviceProp._hasIframe = true; // Hide loading circle - addClass(video._div, HIDE_LOADER_CLASS); + addClass(serviceProp._div, HIDE_LOADER_CLASS); // Show placeholder - (!video._dataPlaceholderVisible || video._dataWidget) - && addClass(video._div, SHOW_PLACEHOLDER_CLASS); + (!serviceProp._dataPlaceholderVisible || serviceProp._dataWidget) + && addClass(serviceProp._div, SHOW_PLACEHOLDER_CLASS); }); return; } - video._iframe = createNode('iframe'); + serviceProp._iframe = createNode('iframe'); /** * @type {string} */ - const iframeParams = video._params || service?.iframe?.params; + const iframeParams = serviceProp._params || serviceConfig.iframe?.params; // Replace data-id with valid resource id - const embedUrl = service.embedUrl || ''; - let src = embedUrl.replace(DATA_ID_PLACEHOLDER, video._id); + const embedUrl = serviceConfig.embedUrl || ''; + let src = embedUrl.replace(DATA_ID_PLACEHOLDER, serviceProp._id); - video._title && (video._iframe.title = video._title); + serviceProp._title && (serviceProp._iframe.title = serviceProp._title); // Add parameters to src if(iframeParams && isString(iframeParams)){ @@ -347,27 +348,27 @@ } // When iframe is loaded => hide background image - video._iframe.onload = () => { - addClass(video._div, HIDE_LOADER_CLASS); - video._iframe.onload = undefined; + serviceProp._iframe.onload = () => { + addClass(serviceProp._div, HIDE_LOADER_CLASS); + serviceProp._iframe.onload = undefined; isFunction(iframeProps?.onload) - && iframeProps.onload(video._id, video._iframe); + && iframeProps.onload(serviceProp._id, serviceProp._iframe); }; /** * Add global internal attributes */ - setIframeAttributes(video._iframe, iframeProps); + setIframeAttributes(serviceProp._iframe, iframeProps); /** * Add all data-attr-* attributes (iframe specific) */ - setIframeAttributes(video._iframe, video._iframeAttributes); + setIframeAttributes(serviceProp._iframe, serviceProp._iframeAttributes); - video._iframe.src = src; + serviceProp._iframe.src = src; - appendChild(video._innerContainer, video._iframe); + appendChild(serviceProp._innerContainer, serviceProp._iframe); }; /** @@ -382,33 +383,33 @@ /** * Remove iframe HTMLElement from div - * @param {IframeObj} video + * @param {servicePropObj} serviceProp */ - const removeIframe = (video) => { - video._iframe.parentNode.removeChild(video._iframe); - video._hasIframe = false; + const removeIframe = (serviceProp) => { + serviceProp._iframe.parentNode.removeChild(serviceProp._iframe); + serviceProp._hasIframe = false; }; /** * Add necessary classes to hide notice - * @param {IframeObj} video + * @param {servicePropObj} serviceProp */ - const hideNotice = (video) => { - addClass(video._div, HIDE_NOTICE_CLASS); - video._showNotice = false; + const hideNotice = (serviceProp) => { + addClass(serviceProp._div, HIDE_NOTICE_CLASS); + serviceProp._showNotice = false; }; /** * Add necessary classes to show notice - * @param {IframeObj} video + * @param {servicePropObj} serviceProp */ - const showNotice = (video) => { - video._div.classList.remove( + const showNotice = (serviceProp) => { + serviceProp._div.classList.remove( HIDE_NOTICE_CLASS, HIDE_LOADER_CLASS, SHOW_PLACEHOLDER_CLASS ); - video._showNotice = true; + serviceProp._showNotice = true; }; /** @@ -471,18 +472,18 @@ /** * Create all notices relative to the specified service * @param {string} serviceName - * @param {Service} service + * @param {ServiceConfig} serviceConfig * @param {boolean} hidden */ - const createAllNotices = (serviceName, service, hidden) => { + const createAllNotices = (serviceName, serviceConfig, hidden) => { // get number of iframes of current service - const videos = iframeDivs[serviceName]; - const languages = service.languages; + const serviceProps = allServiceProps[serviceName]; + const languages = serviceConfig.languages; - videos.forEach(video => { + serviceProps.forEach(serviceProp => { - if(!video._hasNotice && languages){ + if(!serviceProp._hasNotice && languages){ const loadBtnText = languages[currLang]?.loadBtn; const noticeText = languages[currLang]?.notice; const loadAllBtnText = languages[currLang]?.loadAllBtn; @@ -494,11 +495,11 @@ const buttons = createDiv(); setClassName(fragment, 'cll'); - video._innerContainer = fragment; + serviceProp._innerContainer = fragment; const showVideo = () => { - hideNotice(video); - createIframe(video, service); + hideNotice(serviceProp); + createIframe(serviceProp, serviceConfig); }; if(loadBtnText){ @@ -534,14 +535,14 @@ setClassName(notice_text, 'cc-text'); setClassName(ytVideoBackgroundInner, 'c-bg-i'); - video._backgroundDiv = ytVideoBackgroundInner; + serviceProp._backgroundDiv = ytVideoBackgroundInner; setClassName(loaderBg, 'c-ld'); - if(!isString(video._thumbnail) || video._thumbnail !== ''){ + if(!isString(serviceProp._thumbnail) || serviceProp._thumbnail !== ''){ setClassName(ytVideoBackground, 'c-bg'); } - const iframeTitle = video._title; + const iframeTitle = serviceProp._title; const fragment_2 = doc.createDocumentFragment(); if(iframeTitle) { @@ -571,30 +572,31 @@ appendChild(ytVideoBackground, ytVideoBackgroundInner); appendChild(fragment, notice); - (service.thumbnailUrl || video._thumbnail) && appendChild(fragment, ytVideoBackground); + (serviceConfig.thumbnailUrl || serviceProp._thumbnail) && appendChild(fragment, ytVideoBackground); appendChild(fragment, loaderBg); - hidden && addClass(video._div, HIDE_NOTICE_CLASS); + hidden && addClass(serviceProp._div, HIDE_NOTICE_CLASS); // Avoid reflow with fragment (only 1 appendChild) - video._div.prepend(fragment); - video._hasNotice = true; + serviceProp._div.prepend(fragment); + serviceProp._hasNotice = true; - setTimeout(()=> addClass(video._div, 'c-an'), 20); + setTimeout(()=> addClass(serviceProp._div, 'c-an'), 20); } }); }; /** - * Hides all notices relative to the specified service - * and creates iframe with the video + * Hide notices for the specified service + * and then create iframes. + * * @param {string} serviceName - * @param {Service} service + * @param {ServiceConfig} serviceConfig */ - const hideAllNotices = (serviceName, service) => { + const hideAllNotices = (serviceName, serviceConfig) => { // get number of iframes of current service - const videos = iframeDivs[serviceName]; + const serviceProps = allServiceProps[serviceName]; if ('IntersectionObserver' in win) { const observer = new IntersectionObserver((entries) => { @@ -611,8 +613,8 @@ const target = entries[i].target; setTimeout(() => { const dataIndex = target.dataset.index; - createIframe(videos[dataIndex], service); - hideNotice(videos[dataIndex]); + createIframe(serviceProps[dataIndex], serviceConfig); + hideNotice(serviceProps[dataIndex]); }, i*50); observer.unobserve(target); })(i); @@ -620,83 +622,86 @@ } }); - videos.forEach((video) => { - if(!video._hasIframe) - observer.observe(video._div); + serviceProps.forEach((serviceProp) => { + if(!serviceProp._hasIframe) + observer.observe(serviceProp._div); }); } }; /** - * Show all notices relative to the specified service - * and hides iframe with the video + * Show notices for the specified service + * and remove iframes. + * * @param {string} serviceName - * @param {Service} service + * @param {ServiceConfig} serviceConfig */ - const showAllNotices = (serviceName, service) => { + const showAllNotices = (serviceName, serviceConfig) => { - // get number of iframes of current service - const videos = iframeDivs[serviceName]; + const serviceProps = allServiceProps[serviceName]; - for(let i=0; i { - // if doesn't have iframe => create it - if(videos[i]._hasIframe){ - if(isFunction(service.onReject)){ - service.onReject(videos[i]._iframe || videos[i]._div); - videos[i]._hasIframe = false; + + /** + * Create iframe if it doesn't exist + */ + if(serviceProps[i]._hasIframe){ + if(isFunction(serviceConfig.onReject)){ + serviceConfig.onReject(serviceProps[i]._iframe || serviceProps[i]._div); + serviceProps[i]._hasIframe = false; }else{ - removeIframe(videos[i]); + removeIframe(serviceProps[i]); } } - showNotice(videos[i]); + + showNotice(serviceProps[i]); })(i); } }; /** * Validate language (make sure it exists) + * * @param {string} lang - * @param {Object} allLanguages + * @param {Object.} allLanguages * @returns {string} language */ const getValidatedLanguage = (lang, allLanguages) => { if(lang in allLanguages){ return lang; }else if(getKeys(allLanguages).length > 0){ - if(currLang in allLanguages){ - return currLang ; - }else{ - return getKeys(allLanguages)[0]; - } + return currLang in allLanguages + ? currLang + : getKeys(allLanguages)[0]; } }; /** * @param {string} serviceName - * @param {Service} service + * @param {ServiceConfig} serviceConfig */ - const acceptHelper = (serviceName, service) => { - const { cookie } = service; + const acceptHelper = (serviceName, serviceConfig) => { + const { cookie } = serviceConfig; if(!getCookie(cookie.name)) setCookie(cookie); - hideAllNotices(serviceName, service); + hideAllNotices(serviceName, serviceConfig); }; /** * @param {string} serviceName - * @param {Service} service + * @param {ServiceConfig} serviceConfig */ - const rejectHelper = (serviceName, service) => { - const { cookie } = service; + const rejectHelper = (serviceName, serviceConfig) => { + const { cookie } = serviceConfig; if(getCookie(cookie.name)) eraseCookie(cookie); - showAllNotices(serviceName, service); + showAllNotices(serviceName, serviceConfig); }; /** @@ -725,7 +730,6 @@ const changedServices = []; if(serviceName === 'all'){ - let changed = false; for(const name of serviceNames){ if(!servicesState.get(name)){ @@ -874,8 +878,8 @@ const cookieExists = getCookie(cookieName); servicesState.set(serviceName, !!cookieExists); - // add new empty array of videos (with current service name as property) - iframeDivs[serviceName] = []; + // add new empty array of serviceProps (with current service name as property) + allServiceProps[serviceName] = []; /** * @type {NodeListOf} @@ -892,7 +896,7 @@ // add each iframe to array of iframes of the current service for(let j=0; j show notice From a3f099a31ac9751dd47ffe7be7cc0f4885fd468e Mon Sep 17 00:00:00 2001 From: Orest Bida Date: Thu, 30 Mar 2023 12:02:43 +0200 Subject: [PATCH 4/6] Minor code tweaks/refactoring --- dist/iframemanager.js | 2 +- src/iframemanager.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/iframemanager.js b/dist/iframemanager.js index 71efd1f..cb263f6 100644 --- a/dist/iframemanager.js +++ b/dist/iframemanager.js @@ -3,4 +3,4 @@ * Author Orest Bida * Released under the MIT License */ -(()=>{'use strict';const e='click',t='{data-id}',n='accept',o='reject',c='c-h-n',i='c-h-b',s='show-ph';let r,a,l,f,d,u={},v=!1,m='',p={},b=new Map,h='api';const w=['onload','onerror','src'],_=e=>'function'==typeof e,g=e=>'string'==typeof e,$=e=>a.createElement(e),S=()=>$('div'),I=()=>{const e=$('button');return e.type='button',e},T=(e,t)=>e.className=t,x=(e,t)=>e.classList.add(t),y=(e,t)=>e.appendChild(t),P=e=>e&&Object.keys(e)||[],D=(e,t)=>{for(const n in t)j(e,n,t[n])},O=e=>{const t=e.dataset,n={},o='data-iframe-',c=e.getAttributeNames().filter((e=>e.slice(0,12)===o)).map((e=>e.slice(12))),i=e.querySelector('[data-placeholder]'),s=i?.hasAttribute('data-visible');s&&i.removeAttribute('data-visible');const r=i?.cloneNode(!0);for(const t of c)n[t]=e.getAttribute(o+t);return{t:t.id,o:t.title,i:t.thumbnail,l:t.params,u:e,v:null,m:i,p:r,h:null,_:!1,g:!1,$:!0,S:'widget'in t,I:s,T:n}},k=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{for(const c of o)c.isIntersecting&&(E(t,n[c.target.dataset.index]),e.unobserve(c.target))}));for(const t of n)e.observe(t.u)}},E=(e,n)=>{const o=e=>{n.h.style.backgroundImage=`url('${e}')`;const t=new Image;t.onload=()=>x(n.h,'loaded'),t.src=e};if(g(n.i))''!==n.i&&o(n.i);else if(_(e))e(n.t,(e=>o(e)));else if(g(e)){const c=e.replace(t,n.t);o(c)}},M=(e,n)=>{if(e._)return;if(e._=!0,e.m){const t=e.p.cloneNode(!0);e.m.replaceWith(t),e.m=t}const o=n.iframe;if(_(n.onAccept))return void n.onAccept(e.u,(t=>{if(!(t instanceof HTMLIFrameElement))return!1;D(t,o),D(t,e.T),e.P=t,e._=!0,x(e.u,i),(!e.I||e.S)&&x(e.u,s)}));e.P=$('iframe');const c=e.l||n.iframe?.params;let r=(n.embedUrl||'').replace(t,e.t);e.o&&(e.P.title=e.o),c&&g(c)&&(r+='?'===c.slice(0,1)?c:`?${c}`),e.P.onload=()=>{x(e.u,i),e.P.onload=void 0,_(o?.onload)&&o.onload(e.t,e.P)},D(e.P,o),D(e.P,e.T),e.P.src=r,y(e.v,e.P)},j=(e,t,n)=>{w.includes(t)||e.setAttribute(t,n)},C=e=>{x(e.u,c),e.$=!1},L=e=>{e.u.classList.remove(c,i,s),e.$=!0},N=e=>(e=a.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`))?e.pop():'',A=(t,n,o)=>{const i=u[t],s=n.languages;i.forEach((i=>{if(!i.g&&s){const r=s[m]?.loadBtn,l=s[m]?.notice,f=s[m]?.loadAllBtn,d=a.createElement('div'),u=S(),v=S(),p=S(),b=S();T(d,'cll'),i.v=d;const w=()=>{C(i),M(i,n)};if(r){const t=I();t.textContent=r,T(t,'c-l-b'),t.addEventListener(e,w),y(b,t)}if(f){const n=I();n.textContent=f,T(n,r?'c-la-b':'c-l-b'),n.addEventListener(e,(()=>{w(),h=e,W.acceptService(t)})),y(b,n)}const _=S(),P=S(),D=S(),O=S(),k=S();T(_,'cc-text'),T(O,'c-bg-i'),i.h=O,T(D,'c-ld'),g(i.i)&&''===i.i||T(P,'c-bg');const E=i.o,j=a.createDocumentFragment();if(E){const e=$('span');T(e,'c-tl'),e.insertAdjacentHTML('beforeend',E),y(j,e)}y(_,j),u&&_.insertAdjacentHTML('beforeend',l||''),y(v,_),T(k,'c-t-cn'),T(v,'c-n-t'),T(p,'c-n-c'),T(u,'c-nt'),T(b,'c-n-a'),y(k,v),(r||f)&&y(k,b),y(p,k),y(u,p),y(P,O),y(d,u),(n.thumbnailUrl||i.i)&&y(d,P),y(d,D),o&&x(i.u,c),i.u.prepend(d),i.g=!0,setTimeout((()=>x(i.u,'c-an')),20)}}))},F=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{if(v)e.disconnect();else for(let c=0;c{const i=o[c].target;setTimeout((()=>{const e=i.dataset.index;M(n[e],t),C(n[e])}),50*c),e.unobserve(i)})(c)}));n.forEach((t=>{t._||e.observe(t.u)}))}},G=(e,t)=>e in t?e:P(t).length>0?m in t?m:P(t)[0]:void 0,H=(e,t)=>{const{cookie:n}=t;N(n.name)||(e=>{const{hostname:t,protocol:n}=location,o=e.name,c=new Date,i=e.path||'/',s=864e5*(e.expiration||182),r=e.sameSite||'Lax',l=e.domain||t;c.setTime(c.getTime()+s);let f=o+'=1'+(0!==s?`; Expires=${c.toUTCString()}`:'')+`; Path=${i}`+`; SameSite=${r}`;l.indexOf('.')>-1&&(f+=`; Domain=${l}`),'https:'===n&&(f+='; Secure'),a.cookie=f})(n),F(e,t)},J=(e,t)=>{const{cookie:n}=t;N(n.name)&&(e=>{const t=e.name,n=e.path||'/',o=e.domain||location.hostname;a.cookie=`${t}=; Path=${n}; Domain=${o}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`})(n),((e,t)=>{const n=u[e];for(let e=0;e{var o;n[e]._&&(_(t.onReject)?(t.onReject(n[e].P||n[e].u),n[e]._=!1):((o=n[e]).P.parentNode.removeChild(o.P),o._=!1)),L(n[e])})(e)})(e,t)},V=(e,t,n)=>{_(d)&&d({eventSource:{type:h,service:e,action:t},changedServices:n})},W={acceptService:e=>{v=!1;const t=[];if('all'===e){for(const e of f)b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e));t.length>0&&V(e,n,t)}else f.includes(e)&&(b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e),V(e,n,t)));h='api'},rejectService:e=>{const t=[];if('all'===e){v=!0;for(const e of f)J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e));t.length>0&&V(e,o,t)}else f.includes(e)&&(J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e),V(e,o,t)))},childExists:async({parent:e=r,childProperty:t,childSelector:n='iframe',timeout:o=1e3,maxTimeout:c=15e3})=>{let i=1;const s=t?()=>e[t]:()=>e.querySelector(n);return new Promise((e=>{const t=()=>{if(s()||i++*o>c)return e(void 0!==s());setTimeout(t,o)};t()}))},getState:()=>({services:new Map(b),acceptedServices:[...b].filter((([e,t])=>!!t)).map((([e])=>e))}),getConfig:()=>l,run:e=>{if(a=document,r=window,l=e,p=l.services,d=l.onChange,f=P(p),0===f.length)return;m=l.currLang;const t=p[f[0]].languages;!0===l.autoLang?m=G(navigator.language.slice(0,2).toLowerCase(),t):g(l.currLang)&&(m=G(l.currLang,t));for(const e of f){const t=p[e],n=t.cookie||={},o=n.name||=`im_${e}`,c=N(o);b.set(e,!!c),u[e]=[];const i=a.querySelectorAll(`div[data-service="${e}"]`),s=i.length;if(0!==s){for(let t=0;tW)})(); \ No newline at end of file +(()=>{'use strict';const e='click',t='{data-id}',n='accept',o='reject',c='c-h-n',i='c-h-b',s='show-ph';let r,a,l,f,d,u={},v=!1,m='',p={},b=new Map,h='api';const w=['onload','onerror','src'],_=e=>'function'==typeof e,g=e=>'string'==typeof e,$=e=>a.createElement(e),S=()=>$('div'),I=()=>{const e=$('button');return e.type='button',e},T=(e,t)=>e.className=t,x=(e,t)=>e.classList.add(t),y=(e,t)=>e.appendChild(t),P=e=>e&&Object.keys(e)||[],D=(e,t)=>{for(const n in t)j(e,n,t[n])},O=e=>{const t=e.dataset,n={},o='data-iframe-',c=e.getAttributeNames().filter((e=>e.slice(0,12)===o)).map((e=>e.slice(12))),i=e.querySelector('[data-placeholder]'),s=i?.hasAttribute('data-visible');s&&i.removeAttribute('data-visible');const r=i?.cloneNode(!0);for(const t of c)n[t]=e.getAttribute(o+t);return{t:t.id,o:t.title,i:t.thumbnail,l:t.params,u:e,v:null,m:i,p:r,h:null,_:!1,g:!1,$:!0,S:'widget'in t,I:s,T:n}},k=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{for(const c of o)c.isIntersecting&&(E(t,n[c.target.dataset.index]),e.unobserve(c.target))}));for(const t of n)e.observe(t.u)}},E=(e,n)=>{const o=e=>{n.h.style.backgroundImage=`url('${e}')`;const t=new Image;t.onload=()=>x(n.h,'loaded'),t.src=e};if(g(n.i))''!==n.i&&o(n.i);else if(_(e))e(n.t,(e=>o(e)));else if(g(e)){const c=e.replace(t,n.t);o(c)}},M=(e,n)=>{if(e._)return;if(e._=!0,e.m){const t=e.p.cloneNode(!0);e.m.replaceWith(t),e.m=t}const o=n.iframe;if(_(n.onAccept))return void n.onAccept(e.u,(t=>{if(!(t instanceof HTMLIFrameElement))return!1;D(t,o),D(t,e.T),e.P=t,e._=!0,x(e.u,i),(!e.I||e.S)&&x(e.u,s)}));e.P=$('iframe');const c=e.l||n.iframe?.params;let r=(n.embedUrl||'').replace(t,e.t);e.o&&(e.P.title=e.o),c&&g(c)&&(r+='?'===c.slice(0,1)?c:`?${c}`),e.P.onload=()=>{x(e.u,i),e.P.onload=void 0,_(o?.onload)&&o.onload(e.t,e.P)},D(e.P,o),D(e.P,e.T),e.P.src=r,y(e.v,e.P)},j=(e,t,n)=>{w.includes(t)||e.setAttribute(t,n)},C=e=>{x(e.u,c),e.$=!1},L=e=>{e.u.classList.remove(c,i,s),e.$=!0},N=e=>(e=a.cookie.match(`(^|;)\\s*${e}\\s*=\\s*([^;]+)`))?e.pop():'',A=(t,n,o)=>{const i=u[t],s=n.languages;i.forEach((i=>{if(!i.g&&s){const r=s[m]?.loadBtn,l=s[m]?.notice,f=s[m]?.loadAllBtn,d=a.createElement('div'),u=S(),v=S(),p=S(),b=S();T(d,'cll'),i.v=d;const w=()=>{C(i),M(i,n)};if(r){const t=I();t.textContent=r,T(t,'c-l-b'),t.addEventListener(e,w),y(b,t)}if(f){const n=I();n.textContent=f,T(n,r?'c-la-b':'c-l-b'),n.addEventListener(e,(()=>{w(),h=e,W.acceptService(t)})),y(b,n)}const _=S(),P=S(),D=S(),O=S(),k=S();T(_,'cc-text'),T(O,'c-bg-i'),i.h=O,T(D,'c-ld'),g(i.i)&&''===i.i||T(P,'c-bg');const E=i.o,j=a.createDocumentFragment();if(E){const e=$('span');T(e,'c-tl'),e.insertAdjacentHTML('beforeend',E),y(j,e)}y(_,j),u&&_.insertAdjacentHTML('beforeend',l||''),y(v,_),T(k,'c-t-cn'),T(v,'c-n-t'),T(p,'c-n-c'),T(u,'c-nt'),T(b,'c-n-a'),y(k,v),(r||f)&&y(k,b),y(p,k),y(u,p),y(P,O),y(d,u),(n.thumbnailUrl||i.i)&&y(d,P),y(d,D),o&&x(i.u,c),i.u.prepend(d),i.g=!0,setTimeout((()=>x(i.u,'c-an')),20)}}))},F=(e,t)=>{const n=u[e];if('IntersectionObserver'in r){const e=new IntersectionObserver((o=>{if(v)e.disconnect();else for(let c=0;c{const i=o[c].target;setTimeout((()=>{const e=i.dataset.index;M(n[e],t),C(n[e])}),50*c),e.unobserve(i)})(c)}));n.forEach((t=>{t._||e.observe(t.u)}))}},G=(e,t)=>e in t?e:P(t).length>0?m in t?m:P(t)[0]:void 0,H=(e,t)=>{const{cookie:n}=t;N(n.name)||(e=>{const{hostname:t,protocol:n}=location,o=e.name,c=new Date,i=e.path||'/',s=864e5*(e.expiration||182),r=e.sameSite||'Lax',l=e.domain||t;c.setTime(c.getTime()+s);let f=o+'=1'+(0!==s?`; Expires=${c.toUTCString()}`:'')+`; Path=${i}`+`; SameSite=${r}`;l.indexOf('.')>-1&&(f+=`; Domain=${l}`),'https:'===n&&(f+='; Secure'),a.cookie=f})(n),F(e,t)},J=(e,t)=>{const{cookie:n}=t;N(n.name)&&(e=>{const t=e.name,n=e.path||'/',o=e.domain||location.hostname;a.cookie=`${t}=; Path=${n}; Domain=${o}; Expires=Thu, 01 Jan 1970 00:00:01 GMT;`})(n),((e,t)=>{const n=u[e];for(let e=0;e{var o;n[e]._&&(_(t.onReject)?(t.onReject(n[e].P,n[e].u,(()=>L(n[e]))),n[e]._=!1):(o=n[e],o.P?.remove(),o._=!1)),L(n[e])})(e)})(e,t)},V=(e,t,n)=>{_(d)&&d({eventSource:{type:h,service:e,action:t},changedServices:n})},W={acceptService:e=>{v=!1;const t=[];if('all'===e){for(const e of f)b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e));t.length>0&&V(e,n,t)}else f.includes(e)&&(b.get(e)||(b.set(e,!0),H(e,p[e]),t.push(e),V(e,n,t)));h='api'},rejectService:e=>{const t=[];if('all'===e){v=!0;for(const e of f)J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e));t.length>0&&V(e,o,t)}else f.includes(e)&&(J(e,p[e]),b.get(e)&&(b.set(e,!1),t.push(e),V(e,o,t)))},childExists:async({parent:e=r,childProperty:t,childSelector:n='iframe',timeout:o=1e3,maxTimeout:c=15e3})=>{let i=1;const s=t?()=>e[t]:()=>e.querySelector(n);return new Promise((e=>{const t=()=>{if(s()||i++*o>c)return e(void 0!==s());setTimeout(t,o)};t()}))},getState:()=>({services:new Map(b),acceptedServices:[...b].filter((([e,t])=>!!t)).map((([e])=>e))}),getConfig:()=>l,run:e=>{if(a=document,r=window,l=e,p=l.services,d=l.onChange,f=P(p),0===f.length)return;m=l.currLang;const t=p[f[0]].languages;!0===l.autoLang?m=G(navigator.language.slice(0,2).toLowerCase(),t):g(l.currLang)&&(m=G(l.currLang,t));for(const e of f){const t=p[e],n=t.cookie||={},o=n.name||=`im_${e}`,c=N(o);b.set(e,!!c),u[e]=[];const i=a.querySelectorAll(`div[data-service="${e}"]`),s=i.length;if(0!==s){for(let t=0;tW)})(); \ No newline at end of file diff --git a/src/iframemanager.js b/src/iframemanager.js index a791ad8..737a53f 100644 --- a/src/iframemanager.js +++ b/src/iframemanager.js @@ -386,7 +386,7 @@ * @param {servicePropObj} serviceProp */ const removeIframe = (serviceProp) => { - serviceProp._iframe.parentNode.removeChild(serviceProp._iframe); + serviceProp._iframe?.remove(); serviceProp._hasIframe = false; }; @@ -649,9 +649,9 @@ */ if(serviceProps[i]._hasIframe){ if(isFunction(serviceConfig.onReject)){ - serviceConfig.onReject(serviceProps[i]._iframe || serviceProps[i]._div); + serviceConfig.onReject(serviceProps[i]._iframe, serviceProps[i]._div, () => showNotice(serviceProps[i])); serviceProps[i]._hasIframe = false; - }else{ + } else { removeIframe(serviceProps[i]); } } From 422a145d831a14b5c8cc9c5eca6b046b576c4b29 Mon Sep 17 00:00:00 2001 From: Orest Bida Date: Thu, 30 Mar 2023 12:03:48 +0200 Subject: [PATCH 5/6] Fix custom services demo examples --- demo/app.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/demo/app.js b/demo/app.js index 76fb1f3..59ec8bf 100644 --- a/demo/app.js +++ b/demo/app.js @@ -97,7 +97,7 @@ im.run({ * * @param {HTMLDivElement} serviceDiv */ - onReject: (serviceDiv) => { + onReject: (iframe, serviceDiv) => { // remove: div[data-service] > div[placeholder] > div.leaflet-map serviceDiv.lastElementChild.firstElementChild.remove(); }, @@ -120,8 +120,10 @@ im.run({ tweet && setIframe(tweet.firstChild); }, - onReject: (iframe) => { - iframe?.parentElement.remove(); + onReject: async (iframe, serviceDiv, showNotice) => { + await im.childExists({parent: serviceDiv}); + showNotice(); + serviceDiv.querySelector('.twitter-tweet')?.remove(); }, languages : { @@ -209,8 +211,10 @@ im.run({ await im.childExists({parent: div}) && setIframe(div.querySelector('iframe')); }, - onReject: (iframe) => { - iframe?.parentElement?.parentElement?.remove(); + onReject: async (iframe, serviceDiv, showNotice) => { + await im.childExists({parent: serviceDiv}); + showNotice(); + serviceDiv.querySelector('.map')?.remove(); }, languages : { From e37181ee10c1b6e00ba470c9872ec4090a39c5ba Mon Sep 17 00:00:00 2001 From: Orest Bida Date: Thu, 30 Mar 2023 12:04:48 +0200 Subject: [PATCH 6/6] Release 1.2.2 --- README.md | 4 ++-- dist/iframemanager.js | 2 +- package.json | 2 +- src/iframemanager.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ec3e85e..5a0a34e 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ The plugin was mainly developed to aid [**CookieConsent**](https://github.com/or 1. #### Download the [latest release](https://github.com/orestbida/iframemanager/releases/latest) or use via CDN: ```bash - https://cdn.jsdelivr.net/gh/orestbida/iframemanager@1.2.1/dist/iframemanager.js - https://cdn.jsdelivr.net/gh/orestbida/iframemanager@1.2.1/dist/iframemanager.css + https://cdn.jsdelivr.net/gh/orestbida/iframemanager@1.2.2/dist/iframemanager.js + https://cdn.jsdelivr.net/gh/orestbida/iframemanager@1.2.2/dist/iframemanager.css ``` 2. #### Import script + stylesheet: diff --git a/dist/iframemanager.js b/dist/iframemanager.js index cb263f6..40821d3 100644 --- a/dist/iframemanager.js +++ b/dist/iframemanager.js @@ -1,5 +1,5 @@ /*! - * iframemanager v1.2.1 + * iframemanager v1.2.2 * Author Orest Bida * Released under the MIT License */ diff --git a/package.json b/package.json index 90b3d3e..2d47556 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@orestbida/iframemanager", - "version": "1.2.1", + "version": "1.2.2", "description": "GDPR friendly iframe manager written in vanilla js", "main": "dist/iframemanager.js", "files": [ diff --git a/src/iframemanager.js b/src/iframemanager.js index 737a53f..200f0eb 100644 --- a/src/iframemanager.js +++ b/src/iframemanager.js @@ -1,5 +1,5 @@ /*! - * iframemanager v1.2.1 + * iframemanager v1.2.2 * Author Orest Bida * Released under the MIT License */