Skip to content

Commit

Permalink
Merge pull request #8 from dysfunc/interface-updates-and-cleanup
Browse files Browse the repository at this point in the history
🧹 interface updates and cleanup
  • Loading branch information
dysfunc authored Mar 31, 2021
2 parents f43fbd8 + 21c3a2e commit ef554d2
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 171 deletions.
1 change: 1 addition & 0 deletions .github/workflows/run-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- run: yarn
- run: yarn install:docs
- run: yarn test:integration
- uses: actions/upload-artifact@v2
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>svelte-viewable</title>
<title>@svelte-plugins/viewable</title>

<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="stylesheet" href="/global.css" />
Expand Down
4 changes: 0 additions & 4 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@
"serve": "vite preview"
},
"devDependencies": {
"@rollup/plugin-replace": "^2.4.1",
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.5",
"@svelte-plugins/viewable": "../",
"autoprefixer": "^10.2.5",
"postcss": "^8.2.8",
"svelte": "^3.35.0",
"svelte-highlight": "^0.7.1",
"svelte-hmr": "^0.13.0",
"svelte-preprocess": "^4.6.9",
"vite": "^2.1.3"
}
}
Binary file modified docs/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions docs/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import ContainerExample from './ContainerExample.svelte';
import ImageExample from "./ImageExample.svelte";
let obstructions = false;
let enableObstructionDetection = false;
const handleClick = () => (obstructions = !obstructions);
const handleClick = () => (enableObstructionDetection = !enableObstructionDetection);
</script>

<button id="obstructions" on:click={handleClick}>
Expand All @@ -13,13 +13,13 @@

Scroll down...

{#if obstructions}
{#if enableObstructionDetection}
<div id="overlay"></div>
{/if}

<div class="container">
<p>Open dev console to see debug output.</p>
<ContainerExample />
<ContainerExample enableObstructionDetection={enableObstructionDetection} />
</div>

<div class="container">
Expand Down Expand Up @@ -68,7 +68,7 @@ Scroll down...
top: 15%;
z-index: 99;
}
.container {
border-bottom: 1px solid #eee;
height: 100vh;
Expand Down
6 changes: 4 additions & 2 deletions docs/src/ContainerExample.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
whenHundredForFour: { duration: 6, percentage: 100, fn }
};
export let enableObstructionDetection = false;
let element;
let duration;
let percent;
Expand All @@ -26,10 +28,10 @@
let debug = true;
</script>

<Viewable bind:duration bind:percent bind:percentY bind:percentX {rules} {element} {debug}>
<Viewable bind:duration bind:percent bind:percentY bind:percentX {rules} {element} {enableObstructionDetection} {debug}>
<div bind:this={element} class={`${activeRule}`}>
<p>Duration: {duration}s</p>
<p>Viewable: {percent}% x: {percentX}% y: {percentY}%</p>
<p>Viewable area: {percent}% x: {percentX}% y: {percentY}%</p>
</div>
</Viewable>

Expand Down
151 changes: 8 additions & 143 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,6 @@
# yarn lockfile v1


"@rollup/plugin-replace@^2.4.1":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.4.2.tgz#a2d539314fbc77c244858faa523012825068510a"
integrity sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==
dependencies:
"@rollup/pluginutils" "^3.1.0"
magic-string "^0.25.7"

"@rollup/pluginutils@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==
dependencies:
"@types/estree" "0.0.39"
estree-walker "^1.0.1"
picomatch "^2.2.2"

"@rollup/pluginutils@^4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.1.0.tgz#0dcc61c780e39257554feb7f77207dceca13c838"
Expand All @@ -28,7 +11,7 @@
picomatch "^2.2.2"

"@svelte-plugins/viewable@../":
version "0.1.1"
version "0.1.2"

"@sveltejs/vite-plugin-svelte@^1.0.0-next.5":
version "1.0.0-next.5"
Expand All @@ -44,28 +27,6 @@
source-map "^0.7.3"
svelte-hmr "^0.13.3"

"@types/[email protected]":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==

"@types/node@*":
version "14.14.37"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.37.tgz#a3dd8da4eb84a996c36e331df98d82abd76b516e"
integrity sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==

"@types/pug@^2.0.4":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@types/pug/-/pug-2.0.4.tgz#8772fcd0418e3cd2cc171555d73007415051f4b2"
integrity sha1-h3L80EGOPNLMFxVV1zAHQVBR9LI=

"@types/sass@^1.16.0":
version "1.16.0"
resolved "https://registry.yarnpkg.com/@types/sass/-/sass-1.16.0.tgz#b41ac1c17fa68ffb57d43e2360486ef526b3d57d"
integrity sha512-2XZovu4NwcqmtZtsBR5XYLw18T8cBCnU2USFHTnYLLHz9fkhnoEMoDsqShJIOFsFhn5aJHjweiUUdTrDGujegA==
dependencies:
"@types/node" "*"

ansi-styles@^4.1.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
Expand Down Expand Up @@ -97,9 +58,9 @@ browserslist@^4.16.3:
node-releases "^1.1.70"

caniuse-lite@^1.0.30001181, caniuse-lite@^1.0.30001196:
version "1.0.30001204"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001204.tgz#256c85709a348ec4d175e847a3b515c66e79f2aa"
integrity sha512-JUdjWpcxfJ9IPamy2f5JaRDCaqJOxDzOSKtbdx4rH9VivMd1vIzoPumsJa9LoMIi4Fx2BV2KZOxWhNkBjaYivQ==
version "1.0.30001205"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001205.tgz#d79bf6a6fb13196b4bb46e5143a22ca0242e0ef8"
integrity sha512-TL1GrS5V6LElbitPazidkBMD9sa448bQDDLrumDqaggmKFcuU2JW1wTOHJPukAcOMtEmLcmDJEzfRrf+GjM0Og==

chalk@^4.1.0:
version "4.1.0"
Expand Down Expand Up @@ -133,11 +94,6 @@ debug@^4.3.2:
dependencies:
ms "2.1.2"

detect-indent@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.0.0.tgz#0abd0f549f69fc6659a254fe96786186b6f528fd"
integrity sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==

electron-to-chromium@^1.3.649:
version "1.3.703"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.703.tgz#6d9b9a75c42a40775f5930329e642b22b227317f"
Expand All @@ -153,11 +109,6 @@ escalade@^3.1.1:
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==

estree-walker@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700"
integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==

estree-walker@^2.0.1:
version "2.0.2"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
Expand All @@ -178,18 +129,6 @@ function-bind@^1.1.1:
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==

handlebars@^4.5.3:
version "4.7.7"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1"
integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==
dependencies:
minimist "^1.2.5"
neo-async "^2.6.0"
source-map "^0.6.1"
wordwrap "^1.0.0"
optionalDependencies:
uglify-js "^3.1.4"

has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
Expand All @@ -207,42 +146,13 @@ hash-sum@^2.0.0:
resolved "https://registry.yarnpkg.com/hash-sum/-/hash-sum-2.0.0.tgz#81d01bb5de8ea4a214ad5d6ead1b523460b0b45a"
integrity sha512-WdZTbAByD+pHfl/g9QSsBIIwy8IT+EsPiKDs0KNX+zSHhdDLFKdZu0BQHljvO+0QI/BasbMSUa8wYNCZTvhslg==

[email protected]:
version "9.17.1"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.17.1.tgz#14a4eded23fd314b05886758bb906e39dd627f9a"
integrity sha512-TA2/doAur5Ol8+iM3Ov7qy3jYcr/QiJ2eDTdRF4dfbjG7AaaB99J5G+zSl11ljbl6cIcahgPY6SKb3sC3EJ0fw==
dependencies:
handlebars "^4.5.3"

[email protected]:
version "1.0.4"
resolved "https://registry.yarnpkg.com/highlightjs-svelte/-/highlightjs-svelte-1.0.4.tgz#fb4c2cc12ef3d137a4ba45eec1f1622a8318ae08"
integrity sha512-YsxXjKw2T8TWiY81HSXfKEf+v+Vgy1eKBV7rpny/eVBfGedJD6OexqiUswmtFkXaBe4kVj6E7IK44XlO7SJcAA==

is-core-module@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.2.0.tgz#97037ef3d52224d85163f5597b2b63d9afed981a"
integrity sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==
dependencies:
has "^1.0.3"

magic-string@^0.25.7:
version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
dependencies:
sourcemap-codec "^1.4.4"

min-indent@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869"
integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==

minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

[email protected]:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
Expand All @@ -253,11 +163,6 @@ nanoid@^3.1.22:
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.22.tgz#b35f8fb7d151990a8aebd5aa5015c03cf726f844"
integrity sha512-/2ZUaJX2ANuLtTvqTlgqBQNJoQO398KyJgZloL0PZkC0dpysjncRUPsFe3DUPzz/y3h+u7C46np8RMuvF3jsSQ==

neo-async@^2.6.0:
version "2.6.2"
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==

node-releases@^1.1.70:
version "1.1.71"
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb"
Expand Down Expand Up @@ -327,57 +232,22 @@ source-map@^0.7.3:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==

sourcemap-codec@^1.4.4:
version "1.4.8"
resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==

strip-indent@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001"
integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==
dependencies:
min-indent "^1.0.0"

supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
dependencies:
has-flag "^4.0.0"

svelte-highlight@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/svelte-highlight/-/svelte-highlight-0.7.1.tgz#6b193b31cd062f9375be290d2ac02a35cfc6a4e3"
integrity sha512-rOboHnWy7FEZpszZ9YQKmebtmIgZqyaGaYtkr9KWXlV1bIspqTNdgxAW74eecwUEreFmaJLmuP9wKf2e58wqLw==
dependencies:
highlight.js "9.17.1"
highlightjs-svelte "1.0.4"

svelte-hmr@^0.13.0, svelte-hmr@^0.13.3:
svelte-hmr@^0.13.3:
version "0.13.3"
resolved "https://registry.yarnpkg.com/svelte-hmr/-/svelte-hmr-0.13.3.tgz#fba5739b477ea44caf70e542a24a4352bee2b897"
integrity sha512-gagW62pLQ2lULmvNA3pIZu9pBCYOaGu3rQikUOv6Nokz5VxUgT9/mQLfMxj9phDEKHCg/lgr3i6PkqZDbO9P2Q==

svelte-preprocess@^4.6.9:
version "4.7.0"
resolved "https://registry.yarnpkg.com/svelte-preprocess/-/svelte-preprocess-4.7.0.tgz#10a0acf1a8b1afdd7e0aff3769f4175eb77776fe"
integrity sha512-iNrY4YGqi0LD2e6oT9YbdSzOKntxk8gmzfqso1z/lUJOZh4o6fyIqkirmiZ8/dDJFqtIE1spVgDFWgkfhLEYlw==
dependencies:
"@types/pug" "^2.0.4"
"@types/sass" "^1.16.0"
detect-indent "^6.0.0"
strip-indent "^3.0.0"

svelte@^3.35.0:
version "3.36.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.36.0.tgz#3fc4c6fc7a04c3d4249b4fcccae28fc14f442f64"
integrity sha512-LSmdCYoAS6kzLff9nejB5KK5FBJaqyiivs7hPl0OJZ+OxiggI8lMAhvo5W3y8vSP0IWS5++Yb5EbKuQdzOSIoA==

uglify-js@^3.1.4:
version "3.13.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.3.tgz#ce72a1ad154348ea2af61f50933c76cc8802276e"
integrity sha512-otIc7O9LyxpUcQoXzj2hL4LPWKklO6LJWoJUzNa8A17Xgi4fOeDC8FBDOLHnC/Slo1CQgsZMcM6as0M76BZaig==
version "3.37.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.37.0.tgz#dc7cd24bcc275cdb3f8c684ada89e50489144ccd"
integrity sha512-TRF30F4W4+d+Jr2KzUUL1j8Mrpns/WM/WacxYlo5MMb2E5Qy2Pk1Guj6GylxsW9OnKQl1tnF8q3hG/hQ3h6VUA==

vite@^2.1.3:
version "2.1.5"
Expand All @@ -390,8 +260,3 @@ vite@^2.1.3:
rollup "^2.38.5"
optionalDependencies:
fsevents "~2.3.1"

wordwrap@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@svelte-plugins/viewable",
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"description": "A simple rule-based approach to tracking element viewability.",
"author": "Kieran Boyle (https://github.com/dysfunc)",
Expand Down Expand Up @@ -39,12 +39,12 @@
"dev": "rollup -cw",
"bundle": "rollup -c",
"deploy": "npx gh-pages -d dist",
"prepack": "BUNDLE=true rollup -c",
"lint": "eslint --fix \"src/**/*.{.js,svelte}\"",
"format": "prettier --write \"src/**/*.{js,json,svelte}\"",
"install:docs": "yarn --cwd ./docs",
"test": "jest --coverage",
"test:coverage": "jest --coverage && open ./coverage/lcov-report/index.html",
"test:integration": "mkdir -p ./tests/artifacts/cdplogs && yarn bundle && yarn --cwd ./docs && yarn --cwd ./docs dev & cypress run --browser chrome --headless",
"test:integration": "mkdir -p ./tests/artifacts/cdplogs && yarn bundle && yarn --cwd ./docs dev & cypress run --browser chrome --headless",
"test:integration:debug": "cypress open"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit ef554d2

Please sign in to comment.