Skip to content

Commit

Permalink
fix!: Update development dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyfarrell committed Oct 16, 2023
1 parent 3987317 commit 83d0c21
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 83 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: npm install
- name: Lint
run: npm test
110 changes: 55 additions & 55 deletions loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,76 @@
// 1. No external resources blocking loader display
// 2. Terser friendly (no multi-line JS templates)
const getSVG = () => {
const rect = (_, index) => `<rect x="-4" y="24" ry="10" width="8" height="16" transform="rotate(${index * 30})" style="animation-delay:${(index - 11) / 10}s" />`;
const rect = (_, index) => `<rect x="-4" y="24" ry="10" width="8" height="16" transform="rotate(${index * 30})" style="animation-delay:${(index - 11) / 10}s" />`;

return '' +
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100">' +
'<style>' +
'@keyframes cycle{' +
'from{opacity:0}' +
'to{opacity:1}' +
'}' +
return '' +
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="-50 -50 100 100">' +
'<style>' +
'@keyframes cycle{' +
'from{opacity:0}' +
'to{opacity:1}' +
'}' +

'rect{' +
'fill:#fffc;' +
'animation:cycle 1.2s infinite' +
'}' +
'</style>' +
Array.from({length: 12})
.map(rect)
.join('') +
'</svg>';
'rect{' +
'fill:#fffc;' +
'animation:cycle 1.2s infinite' +
'}' +
'</style>' +
Array.from({length: 12})
.map(rect)
.join('') +
'</svg>';
};

const createElement = (tag, properties) => Object.assign(document.createElement(tag), properties);
const createStyle = textContent => createElement('style', {textContent});
const tagName = 'cfware-loading';

customElements.define(tagName, class CFWareLoading extends HTMLElement {
constructor() {
super();
constructor() {
super();

this.attachShadow({mode: 'open'}).append(
createStyle(
':host{' +
'display:grid;' +
'grid:1fr auto auto 1fr/1fr;' +
'opacity:1;' +
'background:#333;' +
'color:#ddd;' +
'user-select:none;' +
'font-size:1.2rem;' +
'line-height:1;' +
'text-align:center' +
'}' +
this.attachShadow({mode: 'open'}).append(
createStyle(
':host{' +
'display:grid;' +
'grid:1fr auto auto 1fr/1fr;' +
'opacity:1;' +
'background:#333;' +
'color:#ddd;' +
'user-select:none;' +
'font-size:1.2rem;' +
'line-height:1;' +
'text-align:center' +
'}' +

'img{' +
'width:4rem;' +
'margin:auto' +
'}'
),
createElement('div'),
createElement('img', {
alt: '',
src: `data:image/svg+xml;base64,${btoa(getSVG())}`
}),
'Loading'
);
}
'img{' +
'width:4rem;' +
'margin:auto' +
'}'
),
createElement('div'),
createElement('img', {
alt: '',
src: `data:image/svg+xml;base64,${btoa(getSVG())}`
}),
'Loading'
);
}
});

document.head.prepend(createStyle(
'html,body{' +
'display:grid;' +
'height:100%;' +
'margin:0;' +
'overflow:hidden' +
'}' +
'html,body{' +
'display:grid;' +
'height:100%;' +
'margin:0;' +
'overflow:hidden' +
'}' +

'body[loaded] ' + tagName + ',' +
'body:not([loaded]) :not(' + tagName + '){' +
'display:none' +
'}'
'body[loaded] ' + tagName + ',' +
'body:not([loaded]) :not(' + tagName + '){' +
'display:none' +
'}'
));

document.body.prepend(createElement(tagName));
50 changes: 25 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@cfware/loading",
"version": "0.1.3",
"description": "Display a loading spinner until the `loaded` attribute is set to the document body",
"type": "module",
"main": "loading.js",
"exports": "./loading.js",
"scripts": {
"test": "cfware-lint ."
},
"engines": {
"node": ">=16.12.0"
},
"author": "Corey Farrell",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/cfware/loading.git"
},
"bugs": {
"url": "https://github.com/cfware/loading/issues"
},
"homepage": "https://github.com/cfware/loading#readme",
"devDependencies": {
"@cfware/lint": "^3.0.4"
}
"name": "@cfware/loading",
"version": "0.1.3",
"description": "Display a loading spinner until the `loaded` attribute is set to the document body",
"type": "module",
"main": "loading.js",
"exports": "./loading.js",
"scripts": {
"test": "cfware-lint ."
},
"engines": {
"node": ">=18"
},
"author": "Corey Farrell",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/cfware/loading.git"
},
"bugs": {
"url": "https://github.com/cfware/loading/issues"
},
"homepage": "https://github.com/cfware/loading#readme",
"devDependencies": {
"@cfware/lint": "^4"
}
}

0 comments on commit 83d0c21

Please sign in to comment.