diff --git a/package-lock.json b/package-lock.json index 05c9ad3c..50949213 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,10 +8,6 @@ "name": "jbuk-frontend", "version": "0.0.1", "license": "CC0-1.0", - "dependencies": { - "@11ty/is-land": "^5.0.0", - "@zachleat/snow-fall": "^1.0.3" - }, "devDependencies": { "@eslint/js": "^10.0.1", "@stylistic/eslint-plugin": "^5.1.0", @@ -24,16 +20,6 @@ "stylelint-config-standard": "^40.0.0" } }, - "node_modules/@11ty/is-land": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/@11ty/is-land/-/is-land-5.0.1.tgz", - "integrity": "sha512-Rh/sLhE4vrc2JaSjeY385v2UxnDY9BhnQtitETb3SKyr0A48Q5Vn06q2AvDBHObtk9+dcFWsoZX4jhT+O9g+xQ==", - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/11ty" - } - }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", @@ -1032,12 +1018,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@zachleat/snow-fall": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@zachleat/snow-fall/-/snow-fall-1.0.3.tgz", - "integrity": "sha512-Y9srRbmO+k31vSm+eINYRV9DRoeWGV5/hlAn9o34bLpoWo+T5945v6XGBrFzQYjhyEGB4j/4zXuTW1zTxp2Reg==", - "license": "MIT" - }, "node_modules/acorn": { "version": "8.17.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", diff --git a/package.json b/package.json index b0ac9882..9c08f32a 100644 --- a/package.json +++ b/package.json @@ -27,10 +27,6 @@ "compress": "./scripts/compress.sh", "build": "npm run lint && npm run build-css && npm run build-js && npm run compress" }, - "dependencies": { - "@11ty/is-land": "^5.0.0", - "@zachleat/snow-fall": "^1.0.3" - }, "allowScripts": { "esbuild@0.27.7": true, "lightningcss-cli@1.32.0": true diff --git a/public/assets/js/is-land.min.js b/public/assets/js/is-land.min.js deleted file mode 100644 index 17203312..00000000 --- a/public/assets/js/is-land.min.js +++ /dev/null @@ -1,2 +0,0 @@ -//! -const e=window,t=e.document,a=e.navigator;function i(){let e,t;return{promise:new Promise((a,i)=>{e=a,t=i}),resolve:e,reject:t}}class r extends HTMLElement{static attributePrefix="on:";static attr={template:"data-island",ready:"ready",defer:"defer-hydration",type:"type",import:"import"};static _tagNames=new Set;static _once=new Map;static ctm(){return"undefined"!=typeof globalThis}static define(t=e.customElements){let a="is-land";this.ctm()&&!t.get(a)&&t.define(a,this)}static _initTypes={default:async e=>{await import(e.getAttribute(r.attr.import))}};static addInitType(e,t){this._initTypes[e]=t}static _fallback={};static addFallback(e,a){this._fallback[e]=a;let i=Array.from(this._tagNames);i.length&&t.querySelectorAll(i.map(e=>`${e}:defined`).join(",")).forEach(e=>{e.replaceFallbackContent()})}getFallback(){return Object.assign({[`:not(:defined):not(${this.localName}):not([${r.attr.defer}])`]:(e,t)=>{let a=r.renameNode(e,t+e.localName);return()=>{a.shadowRoot&&e.shadowRoot.append(...a.shadowRoot.childNodes),e.append(...a.childNodes),a.replaceWith(e)}}},r._fallback)}static renameNode(e,a){let i=t.createElement(a);for(let t of e.getAttributeNames())i.setAttribute(t,e.getAttribute(t));let r=e.shadowRoot;if(!r){let t=e.querySelector(":scope > template[shadowrootmode], :scope > template[shadowroot]");if(t){let a=t.getAttribute("shadowrootmode")||t.getAttribute("shadowroot")||"closed";r=e.attachShadow({mode:a}),r.appendChild(t.content.cloneNode(!0))}}return r&&i.attachShadow({mode:r.mode}).append(...r.childNodes),i.append(...e.childNodes),e.replaceWith(i),i}constructor(){super(),this._ready=i(),this._fallbackExec={},r._tagNames.add(this.localName)}getParents(e,a=!1){let i=[];for(;(e=e.parentNode)&&e&&e!==t.body;)if(e.matches&&e.matches(this.localName)){if(a&&e===a)break;s.hasConditions(e,r.attributePrefix)&&i.push(e)}return i}replaceTemplates(){let e=this.querySelectorAll(`template[${r.attr.template}]`);for(let t of e){if(this.getParents(t,this).length>0)continue;let e=t.getAttribute(r.attr.template);if("replace"===e){let e=Array.from(this.childNodes);for(let t of e)this.removeChild(t);this.appendChild(t.content);break}{let a=t.innerHTML;if("once"===e&&a){if(r._once.has(a))return void t.remove();r._once.set(a,!0)}t.replaceWith(t.content)}}}async beforeReady(){let e,t=this.getAttribute(r.attr.type);t?e=r._initTypes[t]:this.getAttribute(r.attr.import)&&(e=r._initTypes.default),e&&await e(this)}async ready(e,t){return Array.isArray(t)||(t=this.getParents(e)),Promise.all(t.map(e=>e.wait()))}replaceFallbackContent(){let e=`${this.localName}--`;for(let[t,a]of Object.entries(this.getFallback())){if(this._fallbackExec[t])continue;let i=Array.from(this.querySelectorAll(t)).reverse(),r=[];for(let t of i){if(!t.isConnected)continue;let i=this.getParents(t);if(i[0]===this){let s=a(t,e);r.push({node:t,parents:i,returned:s})}}for(let{node:e,parents:t,returned:a}of r.reverse())this.ready(e,t).then(a);this._fallbackExec[t]=!0}}wait(){return this._ready.promise}async connectedCallback(){s.hasConditions(this,r.attributePrefix)&&this.replaceFallbackContent(),await this.hydrate()}async hydrate(){let e=[],t=this.getParents(this);t.length&&e.push(t[0].wait()),e.push(...s.getConditions(this,r.attributePrefix)),await Promise.all(e),this.replaceTemplates(),await this.beforeReady(),this._ready.resolve();let{ready:a,defer:i}=r.attr;this.setAttribute(a,""),this.querySelectorAll(`[${i}]`).forEach(e=>e.removeAttribute(i))}}class s{static _media={};static map={visible:s.visible,idle:s.idle,load:s.pageLoad,interaction:s.interaction,media:s.media,"save-data":s.saveData};static getMap(e=""){return Object.keys(s.map).map(t=>e+t)}static hasConditions(e,t){for(let a of s.getMap(t))if(e.hasAttribute(a))return!0;return!1}static getConditions(e,t){let a=[];for(let i of s.getMap()){let r=t+i;if(e.hasAttribute(r)){let t=e.getAttribute(r);a.push(s.map[i](t,e))}}return a}static visible(t,a){let{promise:r,resolve:s}=i();if("IntersectionObserver"in e){let e=new IntersectionObserver(t=>{let[a]=t;a.isIntersecting&&(e.unobserve(a.target),s())});e.observe(a)}else s();return r}static pageLoad(){if(s._cacheLoad)return s._cacheLoad;let{promise:a,resolve:r}=i();return"complete"===t.readyState?r():e.addEventListener("load",()=>r(),{once:!0}),s._cacheLoad=a,a}static idle(){if(s._cacheIdle)return s._cacheIdle;let{promise:t,resolve:a}=i();return"requestIdleCallback"in e?requestIdleCallback(()=>a()):a(),s._cacheIdle=Promise.all([s.pageLoad(),t]),s._cacheIdle}static interaction(e,t){let a=(e||"click,touchstart").split(",").map(e=>e.trim()),{promise:r,resolve:s}=i();function o(e){s();for(let e of a)t.removeEventListener(e,o)}for(let e of a)t.addEventListener(e,o,{once:!0,passive:!0});return r}static media(t){if(s._media[t])return s._media[t];let{promise:a,resolve:r}=i(),o={matches:!0};return t&&"matchMedia"in e&&(o=e.matchMedia(t)),o.matches?r():o.addListener(e=>{e.matches&&r()}),s._media[t]=a,a}static saveData(e){let{promise:t,resolve:r}=i();return"connection"in a&&a.connection.saveData!==("false"!==e)||r(),t}}new URL(import.meta.url).searchParams.has("nodefine")||r.define(),e.Island=r;export{r as Island}; \ No newline at end of file diff --git a/public/assets/js/is-land.min.js.br b/public/assets/js/is-land.min.js.br deleted file mode 100644 index 34fe76f2..00000000 Binary files a/public/assets/js/is-land.min.js.br and /dev/null differ diff --git a/public/assets/js/is-land.min.js.zst b/public/assets/js/is-land.min.js.zst deleted file mode 100644 index f8784490..00000000 Binary files a/public/assets/js/is-land.min.js.zst and /dev/null differ diff --git a/public/assets/js/snow-fall.js.br b/public/assets/js/snow-fall.js.br deleted file mode 100644 index b44b6670..00000000 Binary files a/public/assets/js/snow-fall.js.br and /dev/null differ diff --git a/public/assets/js/snow-fall.js.zst b/public/assets/js/snow-fall.js.zst deleted file mode 100644 index 6c26bd2a..00000000 Binary files a/public/assets/js/snow-fall.js.zst and /dev/null differ diff --git a/public/assets/js/winter.js b/public/assets/js/winter.js deleted file mode 100644 index c28d74d5..00000000 --- a/public/assets/js/winter.js +++ /dev/null @@ -1,125 +0,0 @@ -class Snow extends HTMLElement { - static random(min, max) { - return min + Math.floor(Math.random() * (max - min) + 1); - } - - static attrs = { - count: "count", // default: 100 - mode: "mode", - text: "text", // text in snow flake (emoji, too) - } - - generateCss(mode, count) { - let css = []; - css.push(` -:host([mode="element"]) { - display: block; - position: relative; - overflow: hidden; -} -:host([mode="page"]) { - position: fixed; - top: 0; - left: 0; - right: 0; -} -:host([mode="page"]), -:host([mode="element"]) > * { - pointer-events: none; -} -:host([mode="element"]) ::slotted(*) { - pointer-events: all; -} -* { - position: absolute; -} -:host([text]) * { - font-size: var(--snow-fall-size, 1em); -} -:host(:not([text])) * { - width: var(--snow-fall-size, 10px); - height: var(--snow-fall-size, 10px); - background: var(--snow-fall-color, rgba(255,255,255,.5)); - border-radius: 50%; -} -`); - - // using vw units (max 100) - let dimensions = { width: 100, height: 100 }; - let units = { x: "vw", y: "vh"}; - - if(mode === "element") { - dimensions = { - width: this.firstElementChild.clientWidth, - height: this.firstElementChild.clientHeight, - }; - units = { x: "px", y: "px"}; - } - - // Thank you @alphardex: https://codepen.io/alphardex/pen/dyPorwJ - for(let j = 1; j<= count; j++ ) { - let x = Snow.random(1, 100) * dimensions.width/100; // vw - let offset = Snow.random(-10, 10) * dimensions.width/100; // vw - - let yoyo = Math.round(Snow.random(30, 100)); // % time - let yStart = yoyo * dimensions.height/100; // vh - let yEnd = dimensions.height; // vh - - let scale = Snow.random(1, 10000) * .0001; - let duration = Snow.random(10, 30); - let delay = Snow.random(0, 30) * -1; - - css.push(` -:nth-child(${j}) { - opacity: ${Snow.random(0, 1000) * 0.001}; - transform: translate(${x}${units.x}, -10px) scale(${scale}); - animation: fall-${j} ${duration}s ${delay}s linear infinite; -} - -@keyframes fall-${j} { - ${yoyo}% { - transform: translate(${x + offset}${units.x}, ${yStart}${units.y}) scale(${scale}); - } - - to { - transform: translate(${x + offset / 2}${units.x}, ${yEnd}${units.y}) scale(${scale}); - } -}`) - } - return css.join("\n"); - } - - connectedCallback() { - // https://caniuse.com/mdn-api_cssstylesheet_replacesync - if(this.shadowRoot || !("replaceSync" in CSSStyleSheet.prototype)) { - return; - } - - let count = parseInt(this.getAttribute(Snow.attrs.count)) || 100; - - let mode; - if(this.hasAttribute(Snow.attrs.mode)) { - mode = this.getAttribute(Snow.attrs.mode); - } else { - mode = this.firstElementChild ? "element" : "page"; - this.setAttribute(Snow.attrs.mode, mode); - } - - let sheet = new CSSStyleSheet(); - sheet.replaceSync(this.generateCss(mode, count)); - - let shadowroot = this.attachShadow({ mode: "open" }); - shadowroot.adoptedStyleSheets = [sheet]; - - let d = document.createElement("div"); - let text = this.getAttribute(Snow.attrs.text); - d.innerText = text || ""; - for(let j = 0, k = count; j @section('scripts') - - - - - - @show