Skip to content

Commit

Permalink
Formatting pass
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWoods committed Feb 4, 2024
1 parent 2714040 commit c2ca78a
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 32 deletions.
2 changes: 1 addition & 1 deletion editor.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion index.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
6 changes: 4 additions & 2 deletions package.json
Expand Up @@ -3,8 +3,10 @@
"private": true,
"type": "module",
"scripts": {
"lint": "prettier . --ignore-path .gitignore --check && eslint . --ignore-path .gitignore",
"format": "prettier . --ignore-path .gitignore --write && eslint . --ignore-path .gitignore --fix",
"lint": "prettier . --ignore-path .gitignore --check",
"postlint": "eslint . --ignore-path .gitignore",
"format": "prettier . --ignore-path .gitignore --write",
"postformat": "eslint . --ignore-path .gitignore --fix",
"test": "npm run check && vitest",
"check": "tsc --noEmit",
"dev": "vite",
Expand Down
6 changes: 5 additions & 1 deletion public/css/editor.css
Expand Up @@ -86,7 +86,11 @@ input.focus + label.button--secondary {
linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.2) 75%),
linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.2) 75%);
background-size: 16px 16px;
background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
background-position:
0 0,
0 8px,
8px -8px,
-8px 0px;
}
.layer__preview--mask {
background-image: none;
Expand Down
26 changes: 21 additions & 5 deletions public/css/viewer.css
Expand Up @@ -8,8 +8,18 @@ body {
margin: 0;
min-height: calc(100vh - 1rem); /* Not sure why this works (: */

font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-family:
'Lato',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Open Sans',
'Helvetica Neue',
sans-serif;
color: var(--text-color);
background: var(--background);
text-align: center;
Expand Down Expand Up @@ -178,12 +188,16 @@ input:focus + label.button--primary,
input.focus + label.button--primary input:focus + label.button--secondary,
input.focus + label.button--secondary {
background: #ffbf1d;
box-shadow: 0 1px 2px #3c40434d, 0 1px 3px 1px #3c404326;
box-shadow:
0 1px 2px #3c40434d,
0 1px 3px 1px #3c404326;
}
.button--primary:active,
.button--secondary:active {
background: #ffd567;
box-shadow: 0 1px 2px #3c40434d, 0 2px 6px 2px #3c404326;
box-shadow:
0 1px 2px #3c40434d,
0 2px 6px 2px #3c404326;
}

.button__row {
Expand Down Expand Up @@ -339,7 +353,9 @@ input.focus + label.button--secondary {
border-radius: 0px;
-webkit-clip-path: inset(10% round 50%);
clip-path: inset(10% round 50%);
transition: clip-path 0.3s ease, -webkit-clip-path 0.3s ease;
transition:
clip-path 0.3s ease,
-webkit-clip-path 0.3s ease;
}
.icon {
transform: none;
Expand Down
2 changes: 1 addition & 1 deletion settings.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
4 changes: 2 additions & 2 deletions src/editor/canvas.js
Expand Up @@ -94,7 +94,7 @@ export async function toUrl(canvas, blob) {
if (blob && canvas.toBlob) {
/** @type {Blob | null} */
const blob = await new Promise((resolve) =>
canvas.toBlob(resolve, 'image/png')
canvas.toBlob(resolve, 'image/png'),
);
return URL.createObjectURL(blob);
} else {
Expand Down Expand Up @@ -187,7 +187,7 @@ export class CanvasController {
layer,
canvases.map(({ canvas, size }) => {
return { canvas, size, ctx: canvas.getContext('2d') };
})
}),
);
this.draw(layer);
}
Expand Down
2 changes: 1 addition & 1 deletion src/editor/export.js
Expand Up @@ -60,7 +60,7 @@ async function download(controller) {
if (url.startsWith('blob:')) {
URL.revokeObjectURL(url);
}
})
}),
);

try {
Expand Down
2 changes: 1 addition & 1 deletion src/editor/layer.js
Expand Up @@ -25,7 +25,7 @@ export async function layersFromFiles(files) {
const layer = createLayer('#ffffff', img);
layer.name = file.name;
return layer;
})
}),
);
}

Expand Down
14 changes: 7 additions & 7 deletions src/editor/main.js
Expand Up @@ -26,7 +26,7 @@ const template = document.querySelector('.layer__template');
const options = document.querySelector('.options');
/** @type {NodeListOf<HTMLDivElement>} */
const canvasContainers = document.querySelectorAll(
'.icon__mask, .icon__original'
'.icon__mask, .icon__original',
);

/** @type {import("./history.js").History} */
Expand All @@ -53,21 +53,21 @@ function createCanvases(preview) {

/** @type {HTMLCanvasElement} */
const backgroundPreview = document.querySelector(
'.layer__preview--background'
'.layer__preview--background',
);
const canvases = createCanvases(backgroundPreview);

layers.set(
document.querySelector('input[name="layer"][value="background"'),
background
background,
);

const newLayer = copyLayer(background);

history = new History(
newLayer,
document.querySelector('input[name="layer"][value="background"'),
0
0,
);

controller.add(background, canvases);
Expand Down Expand Up @@ -305,18 +305,18 @@ if (window.EyeDropper) {

for (const element of document.querySelectorAll('.toggle--layers')) {
element.addEventListener('click', () =>
document.body.classList.toggle('open')
document.body.classList.toggle('open'),
);
}

{
const exportDialog = new DialogManager(
document.querySelector('.export-dialog')
document.querySelector('.export-dialog'),
);
const lazyLoadSetup = lazy(() =>
import('./export.js').then(({ setupExportDialog }) => {
exportDialog.setupContent = () => setupExportDialog(controller);
})
}),
);

for (const element of document.querySelectorAll('.toggle--export')) {
Expand Down
2 changes: 1 addition & 1 deletion src/viewer/dialog.js
Expand Up @@ -12,7 +12,7 @@ export class DialogManager {
* Title of the dialog, will be focused on when dialog is opened.
*/
this.title = dialog.querySelector(
`#${dialog.getAttribute('aria-labelledby')}`
`#${dialog.getAttribute('aria-labelledby')}`,
);
/**
* @type {NodeListOf<HTMLElement>}
Expand Down
2 changes: 1 addition & 1 deletion src/viewer/libs.js
Expand Up @@ -42,6 +42,6 @@ if (document.monetization && ad) {
}
document.monetization.addEventListener(
'monetizationstart',
onMonetizationStart
onMonetizationStart,
);
}
8 changes: 4 additions & 4 deletions src/viewer/upload-icon.js
Expand Up @@ -82,25 +82,25 @@ if (fileInput) {
fileInput.addEventListener(
'change',
() => updateDisplayedIcon(fileInput.files[0]),
pas
pas,
);
// Update the displayed icon when a file is dropped in
fileDrop.addEventListener(
'filedrop',
(evt) => updateDisplayedIcon(evt.files[0]),
pas
pas,
);

// File input focus polyfill for Firefox
fileInput.addEventListener(
'focus',
() => fileInput.classList.add('focus'),
pas
pas,
);
fileInput.addEventListener(
'blur',
() => fileInput.classList.remove('focus'),
pas
pas,
);
}

Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Expand Up @@ -5,7 +5,7 @@
"tests/**/*",
"src/missing-types.d.ts",
"*.mjs",
"*.cjs"
"*.cjs",
],
"compilerOptions": {
"allowJs": true,
Expand All @@ -20,6 +20,6 @@
"noEmit": true,
"baseUrl": ".",
"types": ["node", "vite/client", "vite-plugin-pwa/client"],
"lib": ["dom", "dom.iterable", "es2015", "es2018.promise"]
}
"lib": ["dom", "dom.iterable", "es2015", "es2018.promise"],
},
}
2 changes: 1 addition & 1 deletion vite.config.js
Expand Up @@ -33,7 +33,7 @@ export default defineConfig({
},
}),
webfont(
'https://fonts.googleapis.com/css2?family=Lato:wght@400;900&display=swap'
'https://fonts.googleapis.com/css2?family=Lato:wght@400;900&display=swap',
),
pwa({
manifest: false,
Expand Down

0 comments on commit c2ca78a

Please sign in to comment.