Skip to content

Commit 7f888ce

Browse files
committed
Changes:
* remove eslint and prettier in favor of deno tools * removed dts-bundle generator in favor of dedicated vite plugin * updated types * updated dependencies
1 parent 1e32548 commit 7f888ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1401
-3147
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 199 deletions
This file was deleted.

.github/codeql/codeql-config.yml

100644100755
File mode changed.

.github/workflows/badges.yml

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ on:
1313

1414
jobs:
1515
badges:
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-24.04
1717
steps:
1818
- name: Checkout 🛎
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020

2121
- name: Update version badges 🏷
22-
run: npx -p dependency-version-badge update-badge typescript eslint prettier vite
22+
run: npx -p dependency-version-badge update-badge typescript vite
2323

2424
- name: Commit any changed files 💾
2525
uses: stefanzweifel/git-auto-commit-action@v4

.github/workflows/ci.yml

100644100755
Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,43 @@
11
name: ci
2-
on: push
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- src
8+
- test
9+
- package.json
10+
- .github/workflows/ci.yml
311
jobs:
412
test:
5-
runs-on: ubuntu-20.04
6-
name: Test on Node 20
13+
runs-on: ubuntu-24.04
14+
name: Test on Node 22
715
steps:
816
- name: Checkout
917
uses: actions/checkout@v4
1018

11-
- name: Setup Node
19+
- name: PNPM setup
20+
uses: pnpm/action-setup@v3
21+
22+
- name: Deno Setup
23+
uses: denoland/setup-deno@v2
24+
with:
25+
deno-version: v2.x
26+
27+
- name: Node Setup
1228
uses: actions/setup-node@v4
1329
with:
14-
node-version: 20
15-
# - uses: bahmutov/npm-install@v1
16-
- run: npm install
17-
- run: npm run lint:ts
18-
- run: npm run build
30+
node-version: 22
31+
cache: pnpm
32+
33+
- name: Install Dependencies
34+
run: pnpm install --no-frozen-lockfile
35+
36+
- name: Install Dependencies
37+
run: pnpm install --no-frozen-lockfile
38+
39+
- name: Lint
40+
run: pnpm lint
41+
42+
- name: Build
43+
run: pnpm build

.github/workflows/codeql.yml

100644100755
File mode changed.

.gitignore

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
experiments
33
.npmignore
44
.vscode
5+
test/_screenshots_

.lgtm.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.npmignore

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
experiments
55
node_modules
66
docs
7+
src
8+
test
9+
tsconfig.json
10+
vite.config.mts

.prettierrc.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

LICENSE

100644100755
File mode changed.

README.md

100644100755
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
[![NPM Version](https://img.shields.io/npm/v/@thednp/dll.svg)](https://www.npmjs.com/package/@thednp/dll)
44
[![NPM Downloads](https://img.shields.io/npm/dm/@thednp/dll.svg)](http://npm-stat.com/charts.html?package=@thednp/dll)
55
[![jsDeliver](https://data.jsdelivr.com/v1/package/npm/@thednp/dll/badge)](https://www.jsdelivr.com/package/npm/@thednp/dll)
6-
[![typescript version](https://img.shields.io/badge/typescript-5.5.3-brightgreen)](https://www.typescriptlang.org/)
7-
[![eslint version](https://img.shields.io/badge/eslint-8.57.0-brightgreen)](https://github.com/eslint)
8-
[![prettier version](https://img.shields.io/badge/prettier-2.8.8-brightgreen)](https://prettier.io/)
9-
[![vite version](https://img.shields.io/badge/vite-5.3.4-brightgreen)](https://github.com/vitejs)
6+
[![typescript version](https://img.shields.io/badge/typescript-5.7.2-brightgreen)](https://www.typescriptlang.org/)
7+
[![vite version](https://img.shields.io/badge/vite-5.4.11-brightgreen)](https://github.com/vitejs)
108

119
Double Lazy Load for videos, images and background images. Sourced with Typescript.
1210

dist/dll.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
"use strict";const I="DOMContentLoaded",N="load",R="loadstart",k=navigator.userAgentData,l=k,{userAgent:E}=navigator,f=E,v=/iPhone|iPad|iPod|Android/i;l?l.brands.some(e=>v.test(e.brand)):v.test(f);const S=/(iPhone|iPod|iPad)/;l?l.brands.some(e=>S.test(e.brand)):S.test(f);f&&f.includes("Firefox");const{head:p}=document;["webkitPerspective","perspective"].some(e=>e in p.style);const h=(e,t,n,o)=>{const s=o||!1;e.addEventListener(t,n,s)},T=(e,t,n,o)=>{const s=o||!1;e.removeEventListener(t,n,s)},L=(e,t,n,o)=>{const s=r=>{(r.target===e||r.currentTarget===e)&&(n.apply(e,[r]),T(e,t,s,o))};h(e,t,s,o)},V=()=>{};(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:()=>(e=!0,e)});L(document,I,V,t)}catch{}return e})();["webkitTransform","transform"].some(e=>e in p.style);["webkitAnimation","animation"].some(e=>e in p.style);["webkitTransition","transition"].some(e=>e in p.style);const A=(e,t)=>e.getAttribute(t),$=(e,t)=>e.removeAttribute(t),M=e=>e!=null&&typeof e=="object"||!1,a=e=>M(e)&&typeof e.nodeType=="number"&&[1,2,3,4,5,6,7,8,9,10,11].some(t=>e.nodeType===t)||!1,y=e=>a(e)&&e.nodeType===1||!1,j=e=>typeof e=="string"||!1,q=e=>M(e)&&e.constructor.name==="Window"||!1,x=e=>a(e)&&e.nodeType===9||!1,m=e=>q(e)?e.document:x(e)?e:a(e)?e.ownerDocument:window.document,C=(e,...t)=>Object.assign(e,...t),g=e=>{if(!e)return;if(j(e))return m().createElement(e);const{tagName:t}=e,n=g(t);if(!n)return;const o={...e};return delete o.tagName,C(n,o)},G=e=>Object.entries(e),U=(e,t)=>{G(t).forEach(([n,o])=>{if(o&&j(n)&&n.includes("--"))e.style.setProperty(n,o);else{const s={};s[n]=o,C(e.style,s)}})},D=e=>typeof e=="function"||!1,W=(e,t)=>y(e)?e:(a(t)?t:m()).querySelector(e),w=(e,t)=>(a(t)?t:m()).querySelectorAll(e),c="data-src",F=e=>y(e)&&e.tagName==="VIDEO",u=e=>y(e)&&e.tagName==="SOURCE",O=e=>y(e)&&e.tagName==="IMG",P=(e,t)=>{const n=u(e),o=n?R:N,s=n?g("VIDEO"):null,r=g(n?"SOURCE":"IMG"),i=n?s:r,d=A(e,c);if(!i||!d)return;const b=()=>{O(e)||u(e)?(e.src=d,u(e)&&F(e.parentElement)&&e.parentElement.load()):U(e,{backgroundImage:`url("${d}")`}),$(e,c),D(t)&&t(),T(i,o,b)};h(i,o,b),(O(r)||u(r))&&(r.src=d,s&&s.append(r))},z=e=>{const t=w(`[${c}]`,e),n=e&&A(e,c);return n&&!t?[e]:!n&&t?[...t]:n&&t?[e,...t]:!n&&!t?[...w(`[${c}]`)]:null},J=(e,t)=>{const n=W(e);if(!n)return;const o=D(t)?t:null,s=z(n);s&&s.length&&s.forEach((r,i)=>{i===s.length-1&&o?P(r,o):P(r)})};module.exports=J;
1+
"use strict";const R="load",j="loadstart",m=(e,n,t,o)=>{e.addEventListener(n,t,!1)},C=(e,n,t,o)=>{e.removeEventListener(n,t,!1)},h=(e,n)=>e.getAttribute(n),E=(e,n)=>e.removeAttribute(n),v=e=>e!=null&&typeof e=="object"||!1,f=e=>v(e)&&typeof e.nodeType=="number"&&[1,2,3,4,5,6,7,8,9,10,11].some(n=>e.nodeType===n)||!1,l=e=>f(e)&&e.nodeType===1||!1,T=e=>typeof e=="string"||!1,L=e=>v(e)&&e.constructor.name==="Window"||!1,D=e=>f(e)&&e.nodeType===9||!1,p=e=>D(e)?e:f(e)?e.ownerDocument:L(e)?e.document:globalThis.document,I=(e,...n)=>Object.assign(e,...n),d=e=>{if(!e)return;if(T(e))return p().createElement(e);const{tagName:n}=e,t=d(n);if(!t)return;const o={...e};return delete o.tagName,I(t,o)},M=e=>Object.entries(e),V=(e,n)=>{M(n).forEach(([t,o])=>{if(o&&T(t)&&t.includes("--"))e.style.setProperty(t,o);else{const s={};s[t]=o,I(e.style,s)}})},S=(e,n)=>(f(n)?n:p()).querySelectorAll(e),g=e=>l(e)&&"offsetWidth"in e||!1,N=e=>typeof e=="function"||!1,q=(e,n)=>l(e)?e:(l(n)?n:p()).querySelector(e),i="data-src",w=e=>g(e)&&e.tagName==="VIDEO",u=e=>g(e)&&e.tagName==="SOURCE",b=e=>g(e)&&e.tagName==="IMG",O=(e,n)=>{const t=u(e),o=t?j:R,s=t?d("VIDEO"):null,r=d(t?"SOURCE":"IMG"),c=t?s:r,a=h(e,i);if(!c||!a)return;const y=()=>{b(e)||u(e)?(e.src=a,u(e)&&w(e.parentElement)&&e.parentElement.load()):V(e,{backgroundImage:`url("${a}")`}),E(e,i),N(n)&&n(),C(c,o,y)};m(c,o,y),(b(r)||u(r))&&(r.src=a,s&&s.append(r))},A=e=>{const n=S(`[${i}]`,e),t=e&&h(e,i);return t&&!n?[e]:!t&&n?[...n]:t&&n?[e,...n]:!t&&!n?[...S(`[${i}]`)]:null},G=(e,n)=>{const t=q(e);if(!t)return;const o=N(n)?n:null,s=A(t);s&&s.length&&s.forEach((r,c)=>{c===s.length-1&&o?O(r,o):O(r)})};module.exports=G;
22
//# sourceMappingURL=dll.cjs.map

dist/dll.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dll.d.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
export type CallbackFunction = (...args: any[]) => any;
2-
/**
3-
* Lazy load one or more items with `data-src` attribute.
4-
* * target can be `<img>` | `<video>` | `HTMLElement`
5-
* * or any `HTMLElement` that contains the above elements
6-
* * or `HTMLElement` that has the `data-src` attribute
7-
*
8-
* @param target target
9-
* @param callback
10-
*/
11-
declare const DLL: (target: HTMLElement | string, callback?: CallbackFunction) => void;
12-
13-
export {
14-
DLL as default,
15-
};
16-
17-
export as namespace DLL;
18-
19-
export {};
1+
declare type CallbackFunction = (...args: unknown[]) => void;
2+
3+
/**
4+
* Lazy load one or more items with `data-src` attribute.
5+
* * target can be `<img>` | `<video>` | `Element`
6+
* * or any `Element` that contains the above elements
7+
* * or `Element` that has the `data-src` attribute
8+
*
9+
* @param target target
10+
* @param callback
11+
*/
12+
declare const DLL: (target: Element | string, callback?: CallbackFunction) => void;
13+
export default DLL;
14+
15+
export { }

dist/dll.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dll.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)