@vtbag/utensil-drawer
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,1 +0,1 @@ | ||
"use strict";(()=>{function r(t,e,n=!1){c([...document.querySelectorAll(t)],e,n)}function c(t,e,n=!1){e[e.length-1]==="~"&&(e=e.slice(0,-1)+"-",d(t)),t.forEach((o,i,s)=>{n&&(o.style.viewTransitionName=`${e}${s.length>1?i:""}`)||(o.style.viewTransitionName||=`${e}${s.length>1?i:""}`)})}function d(t){for(let e=t.length-1;e>0;--e){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function g(){addEventListener("DOMContentLoaded",a("old")),addEventListener("pagereveal",a("new")),addEventListener("pageswap",a("old"))}function a(t){return()=>{document.querySelectorAll("script").forEach(e=>{((e.getAttribute("data-vtbag-decl")??"")+";"+(e.getAttribute(`data-vtbag-decl-${t}`)??"")).split(/\s*;\s*/).forEach(o=>{let[i,s]=o.split(/=/,2);if(s!==void 0){let l=i.endsWith("~");l&&(i=i.slice(0,-1)),r(i.trim(),s.trim(),!l)}})})}}g();})(); | ||
"use strict";(()=>{function r(t,e,n=!1){c([...document.querySelectorAll(t)],e,n)}function c(t,e,n=!1){e[e.length-1]==="~"&&(e=e.slice(0,-1)+"-",d(t)),t.forEach((o,s,a)=>{let i=`${e}${a.length>1&&e!==""&&e!=="none"&&e!=="auto"?s:""}`;n&&(o.style.viewTransitionName=i)||(o.style.viewTransitionName||=i)})}function d(t){for(let e=t.length-1;e>0;--e){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t}function u(){addEventListener("DOMContentLoaded",l("old")),addEventListener("pagereveal",l("new")),addEventListener("pageswap",l("old"))}function l(t){return()=>{document.querySelectorAll("script").forEach(e=>{((e.getAttribute("data-vtbag-decl")??"")+";"+(e.getAttribute(`data-vtbag-decl-${t}`)??"")).split(/\s*;\s*/).forEach(o=>{let[s,a]=o.split(/=/,2);if(a!==void 0){let i=s.endsWith("~");i&&(s=s.slice(0,-1)),r(s.trim(),a.trim(),!i)}})})}}u();})(); |
@@ -19,4 +19,5 @@ /* Sets the view transition name in the style attribute of selected elements, see setGivenViewTransitionNames. | ||
elements.forEach((element, idx, array) => { | ||
(force && (element.style.viewTransitionName = `${prefix}${array.length > 1 ? idx : ''}`)) || | ||
(element.style.viewTransitionName ||= `${prefix}${array.length > 1 ? idx : ''}`); | ||
const name = `${prefix}${array.length > 1 && prefix !== '' && prefix !== 'none' && prefix !== 'auto' ? idx : ''}`; | ||
(force && (element.style.viewTransitionName = name)) || | ||
(element.style.viewTransitionName ||= name); | ||
}); | ||
@@ -23,0 +24,0 @@ } |
{ | ||
"name": "@vtbag/utensil-drawer", | ||
"type": "module", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "lib/index.js", | ||
@@ -60,2 +60,3 @@ "description": "Pull out just what you need to craft seamless transitions. The Utensil Drawer holds reusable functions to help you build websites with view transitions. It is a bit sparse right now, but like the one in your kitchen, it is bound to fill up over time.", | ||
"prettier": "^3.5.0", | ||
"publint": "^0.3.3", | ||
"serve": "^14.0.1", | ||
@@ -62,0 +63,0 @@ "typescript": "^5.7.3" |
8067
78
10