mui-collage-fab 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,8 @@ npm install mui-collage-fab @mui/material @emotion/react @emotion/styled
19
19
  ```
20
20
 
21
21
  `react`, `react-dom`, `@mui/material` and the two emotion packages are peer
22
- dependencies, so the package never ships its own copy of React or MUI.
22
+ dependencies, so the package never ships its own copy of React or MUI. The
23
+ published bundle targets ES2020 and runs on Node.js 18 or newer when server rendered.
23
24
 
24
25
  ## Usage
25
26
 
@@ -161,7 +162,7 @@ the same pitch in opposite directions.
161
162
 
162
163
  ## Development
163
164
 
164
- Requires Node.js 22.13 or newer.
165
+ Requires Node.js 22.12 or newer. The development toolchain is pinned in `mise.toml`.
165
166
 
166
167
  ```bash
167
168
  npm install
@@ -181,8 +182,10 @@ npm run dev
181
182
  | `npm run types:test` | Type-check the public API surface (`expectTypeOf` + `@ts-expect-error`). |
182
183
  | `npm run check:package` | `publint`, `attw --pack` and a tarball content assertion. |
183
184
  | `npm run check:size` | Enforce the size-limit budgets for `dist-lib`. |
184
- | `npm run lint` | ESLint, type-aware, with hooks and jsx-a11y rules. |
185
- | `npm run format:check` | Prettier check. `npm run format` rewrites in place. |
185
+ | `npm run lint` | Oxlint, type-aware, with hooks and jsx-a11y rules. |
186
+ | `npm run format:check` | Oxfmt check. `npm run format` rewrites in place. |
187
+ | `npm run check:node` | Assert `@types/node`, `mise.toml` and `devEngines` share a major. |
188
+ | `npm run check:deps` | Dependency-cruiser: cycles, orphans and library/site imports. |
186
189
  | `npm run check:unused` | Knip: unused files, exports and dependencies. |
187
190
  | `npm run check:release` | `semantic-release --dry-run`, validating the release config. |
188
191
  | `npm run check:actions-security` | Zizmor audit of the workflows. |
@@ -194,7 +197,8 @@ npm run dev
194
197
  `npm run doctor` (listr2) runs the checks in sequence and keeps going after a
195
198
  failure, so one pass reports everything that is broken:
196
199
 
197
- 1. `format:check`, `lint`, `typecheck` — style and static analysis.
200
+ 1. `format:check`, `lint`, `typecheck`, `check:deps` — style, static analysis and the
201
+ dependency graph.
198
202
  2. `types:test` — the public prop unions and slot overrides, pinned by type tests.
199
203
  3. `test:coverage` — Vitest with coverage thresholds of 85 statements / 75 branches.
200
204
  4. `build`, `build:lib` — demo and library bundles.
@@ -208,12 +212,14 @@ Property tests (`fast-check`, `tests/geometry.property.test.ts`) generate sizes,
208
212
  fade widths, counts and directions and assert the geometry invariants rather than
209
213
  enumerating cases: one pitch of translation per slice, a cut line pinned in container
210
214
  space, and a mask window wide enough to cover the fan. `check:unused` (knip) catches dead
211
- files, exports and dependencies; `check:release` loads every semantic-release plugin
212
- through `--dry-run`; the e2e suite also runs a Pixel-class mobile project with touch
213
- gesture specs, and zizmor audits the workflows themselves in CI.
214
-
215
- `--fast` drops `test:e2e` and `audit`, `--only=lint,unit` runs a subset. Each failed
216
- step keeps its output in `node_modules/.cache/doctor/<step>.log`. CI runs
215
+ files, exports and dependencies; `check:deps` (dependency-cruiser) rejects runtime cycles,
216
+ orphan modules and imports that reach from the published library into demo code;
217
+ `check:release` loads every semantic-release plugin through `--dry-run`; the e2e suite
218
+ also runs a Pixel-class mobile project with touch gesture specs, and zizmor audits the
219
+ workflows themselves in CI.
220
+
221
+ `--fast` drops `test:e2e` and `audit`, `--only=lint,unit` runs a subset. Each failed step
222
+ keeps its output in `node_modules/.cache/doctor/<step>.log`. CI runs
217
223
  `npm run doctor -- --fast` plus a separate e2e job covering chromium, firefox, webkit and
218
224
  a Pixel-class mobile viewport, `zizmor` on the workflows, and `dependency-review` on pull
219
225
  requests.
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react");c=s(c,1);let l=require("@mui/material"),u=require("@mui/material/styles"),d=require("@mui/material/utils"),f=require("@mui/utils/useSlotProps");f=s(f,1);let p=require("@mui/utils/composeClasses");p=s(p,1);let m=require("@mui/utils/generateUtilityClass");m=s(m,1);let h=require("react/jsx-runtime");var g={small:40,medium:48,large:56};function _(e){return typeof e==`number`?e:g[e]}function v(e,t){let{count:n,size:r,gap:i,fadeWidth:a,open:o,direction:s}=t,c=r+i,l=(n-1)*c+r+a,u=e*c,d=s===`left`||s===`up`,f=s===`left`||s===`right`,p=e===0?l:(n-e)*(r/n),m=e===0?-a/2:r/n*e,h=o?u:0,g=d?p-l-a/2+h:m-l-a/2-h,_=d?`#000 0px, #000 ${l}px, transparent ${l+a}px, transparent ${2*l}px`:`transparent 0px, transparent ${l}px, #000 ${l+a}px, #000 ${2*l}px`,v=`${d?`-`:``}${h}`;return{translate:f?`translateX(${v}px)`:`translateY(${v}px)`,maskImage:n>1?`linear-gradient(${f?`to right`:`to bottom`}, ${_})`:`none`,maskSize:f?`${2*l}px 100%`:`100% ${2*l}px`,maskPosition:f?`${g}px 0px`:`0px ${g}px`}}var y={direction:`left`,size:`large`,variant:`circular`,gap:16,fadeWidth:12,trigger:`hover`,defaultOpen:!1,disableClickAway:!1,transitionDuration:400,transitionEasing:`cubic-bezier(0.4, 0, 0.2, 1)`},b={circular:`50%`,rounded:`25%`,square:0},x=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function S(e,t){return`${e}ms ${t}`}function C(e){return(0,m.default)(`MuiCollageFab`,e)}var w=(e,t)=>(0,p.default)({root:[`root`,e?`expanded`:`collapsed`],item:[`item`]},C,t),T=(0,u.styled)(`div`,{name:`MuiCollageFab`,slot:`root`,overridesResolver:(e,t)=>t.root})(({ownerState:e})=>{let{open:t,direction:n,size:r,gap:i,count:a,transitionDuration:o,transitionEasing:s}=e,c=n===`left`||n===`right`,l=n===`left`||n===`up`,u=t?a*r+Math.max(a-1,0)*i:r;return{position:`relative`,width:c?u:r,height:c?r:u,display:`flex`,flexDirection:c?`row`:`column`,justifyContent:l?`flex-end`:`flex-start`,transition:`${c?`width`:`height`} ${S(o,s)}`,filter:`drop-shadow(0px 6px 12px rgba(0,0,0,0.25))`,cursor:t?`default`:`pointer`,WebkitTapHighlightColor:`transparent`}}),E=(0,u.styled)(`div`,{name:`MuiCollageFab`,slot:`item`,overridesResolver:(e,t)=>t.item})(({ownerState:e})=>{let{direction:t,size:n,index:r,geometry:i,cornerRadius:a,transitionDuration:o,transitionEasing:s}=e,c=t===`left`||t===`right`,l=t===`left`?{right:0}:t===`right`?{left:0}:t===`up`?{bottom:0}:{top:0},u=S(o,s);return{position:`absolute`,...l,...c?{top:0}:{left:0},width:n,height:n,borderRadius:a,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:r,transform:i.translate,WebkitMaskImage:i.maskImage,maskImage:i.maskImage,WebkitMaskSize:i.maskSize,maskSize:i.maskSize,WebkitMaskPosition:i.maskPosition,maskPosition:i.maskPosition,WebkitMaskRepeat:`no-repeat`,maskRepeat:`no-repeat`,transition:`transform ${u}, -webkit-mask-position ${u}, mask-position ${u}`,"& > *":{boxShadow:`none !important`,borderRadius:`inherit !important`,width:`100%`,height:`100%`,margin:0}}});function D(e){let{index:t,ownerState:n,geometry:r,className:i,component:a,inert:o,itemRefs:s,slotProps:l,children:u}=e,p=c.useMemo(()=>({...n,index:t,isAnchor:t===0,geometry:r}),[n,t,r]),m=c.useRef(null),g=c.useCallback(e=>{s.current[t]=e},[s,t]),_=(0,d.useForkRef)(g,m);c.useEffect(()=>{let e=m.current;e&&`inert`in HTMLElement.prototype&&(e.inert=o)},[o]);let v=(0,f.default)({elementType:a,externalSlotProps:l,ownerState:p,additionalProps:{ref:_,className:i,"aria-hidden":o||void 0,children:u}});return(0,h.jsx)(a,{...v})}var O=c.forwardRef(function(e,t){let{children:n,direction:r=y.direction,size:i=y.size,variant:a=y.variant,gap:o=y.gap,fadeWidth:s=y.fadeWidth,trigger:p=y.trigger,open:m,defaultOpen:g=y.defaultOpen,onOpen:S,onClose:C,disableClickAway:O=y.disableClickAway,transitionDuration:k=y.transitionDuration,transitionEasing:A=y.transitionEasing,classes:j,slots:M,slotProps:N,className:P,...F}=(0,u.useThemeProps)({props:e,name:`MuiCollageFab`}),[I,L]=(0,d.useControlled)({controlled:m,default:g,name:`CollageFab`,state:`open`}),R=c.useMemo(()=>c.Children.toArray(n).filter(e=>c.isValidElement(e)),[n]),z=R.length,B={open:I,direction:r,trigger:p,size:_(i),variant:a,cornerRadius:b[a],gap:o,fadeWidth:s,count:z,transitionDuration:k,transitionEasing:A},V=w(I,j),H=c.useRef(null),U=c.useRef([]),W=c.useRef(!1),G=c.useRef(`mouse`),K=c.useRef(!1),q=(0,d.useForkRef)(H,t),J=c.useCallback((e,t)=>{e!==I&&(L(e),e?S?.(t):C?.(t))},[I,L,S,C]),Y=e=>{p===`hover`&&e.pointerType===`mouse`&&J(!0,e)},X=e=>{p===`hover`&&e.pointerType===`mouse`&&J(!1,e)},Z=e=>{p!==`manual`&&(G.current=e.pointerType,W.current=!1,e.pointerType===`mouse`||I||(W.current=!0,J(!0,e)))},ee=e=>{W.current&&(W.current=!1,e.stopPropagation(),e.preventDefault())},te=e=>{p!==`manual`&&(p===`click`?J(!I,e):I&&G.current!==`mouse`&&J(!1,e))},ne=e=>{if(p!==`manual`){if(I){if(e.key!==`Escape`)return;e.stopPropagation(),J(!1,e),H.current?.focus()}else(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),K.current=!0,J(!0,e))}},re=e=>{J(!1,e)},Q=M?.root??T,ie=M?.item??E,ae=(0,f.default)({elementType:Q,externalForwardedProps:F,externalSlotProps:N?.root,ownerState:B,additionalProps:{ref:q,role:`group`,tabIndex:!I&&p!==`manual`?0:-1,onPointerEnter:Y,onPointerLeave:X,onPointerDown:Z,onClick:te,onClickCapture:ee,onKeyDown:ne},className:[V.root,P]});if(c.useEffect(()=>{if(!I||!K.current)return;K.current=!1;let e=U.current[0];e&&(e.querySelector(x)??e).focus()},[I]),z===0)return null;let $=(0,h.jsx)(Q,{...ae,children:R.map((e,t)=>(0,h.jsx)(D,{index:t,ownerState:B,geometry:v(t,B),className:V.item,component:ie,inert:!I&&p!==`manual`,itemRefs:U,slotProps:N?.item,children:e},t))});return O||p===`manual`?$:(0,h.jsx)(l.ClickAwayListener,{onClickAway:re,children:$})});exports.CollageFab=O;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react");c=s(c,1);let l=require("@mui/material"),u=require("@mui/material/styles"),d=require("@mui/material/utils"),f=require("@mui/utils/useSlotProps");f=s(f,1);let p=require("@mui/utils/composeClasses");p=s(p,1);let m=require("@mui/utils/generateUtilityClass");m=s(m,1);let h=require("react/jsx-runtime");var g={small:40,medium:48,large:56};function _(e){return typeof e==`number`?e:g[e]}var v={left:{x:-1,y:0},right:{x:1,y:0},up:{x:0,y:-1},down:{x:0,y:1}};function y({x:e,y:t},n){return e!==0&&t!==0?`translate(${e}px, ${t}px)`:n?`translateX(${e}px)`:`translateY(${t}px)`}function b(e,t){let n=v[t.direction],r=e*(t.size+t.gap);return{x:n.x*r,y:n.y*r}}function x(e){return e.every(e=>e<=0)&&e.some(e=>e<0)?`end`:`start`}function S(e){let{count:t,size:n}=e,r=Array.from({length:t},(t,n)=>b(n,e)),i=r.map(e=>e.x),a=r.map(e=>e.y);return{extent:{width:Math.max(...i,0)-Math.min(...i,0)+n,height:Math.max(...a,0)-Math.min(...a,0)+n},align:{x:x(i),y:x(a)}}}function C(e,t){let{count:n,size:r,gap:i,fadeWidth:a,open:o,direction:s}=t,c=r+i,l=(n-1)*c+r+a,u=v[s],d=u.x!==0,f=(d?u.x:u.y)<0,p=o?b(e,t):{x:0,y:0},m=e===0?l:(n-e)*(r/n),h=e===0?-a/2:r/n*e,g=(f?m:h)-l-a/2,_=d?{x:g,y:0}:{x:0,y:g},x={x:_.x-p.x,y:_.y-p.y},S=f?`#000 0px, #000 ${l}px, transparent ${l+a}px, transparent ${2*l}px`:`transparent 0px, transparent ${l}px, #000 ${l+a}px, #000 ${2*l}px`;return{translate:y(p,d),maskImage:n>1?`linear-gradient(${d?`to right`:`to bottom`}, ${S})`:`none`,maskSize:d?`${2*l}px 100%`:`100% ${2*l}px`,maskPosition:`${x.x}px ${x.y}px`}}var w={direction:`left`,size:`large`,variant:`circular`,gap:16,fadeWidth:12,trigger:`hover`,defaultOpen:!1,disableClickAway:!1,transitionDuration:400,transitionEasing:`cubic-bezier(0.4, 0, 0.2, 1)`},T={circular:`50%`,rounded:`25%`,square:0},ee=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`;function E(e,t){return`${e}ms ${t}`}function D(e){return(0,m.default)(`MuiCollageFab`,e)}var te=(e,t)=>(0,p.default)({root:[`root`,e?`expanded`:`collapsed`],item:[`item`]},D,t),O=(0,u.styled)(`div`,{name:`MuiCollageFab`,slot:`root`,overridesResolver:(e,t)=>t.root})(({ownerState:e})=>{let{open:t,size:n,transitionDuration:r,transitionEasing:i}=e,{extent:a}=S(e),o=E(r,i);return{position:`relative`,width:t?a.width:n,height:t?a.height:n,transition:`width ${o}, height ${o}`,filter:`drop-shadow(0px 6px 12px rgba(0,0,0,0.25))`,cursor:t?`default`:`pointer`,WebkitTapHighlightColor:`transparent`}}),k=(0,u.styled)(`div`,{name:`MuiCollageFab`,slot:`item`,overridesResolver:(e,t)=>t.item})(({ownerState:e})=>{let{size:t,index:n,geometry:r,cornerRadius:i,transitionDuration:a,transitionEasing:o}=e,{align:s}=S(e),c={...s.x===`end`?{right:0}:{left:0},...s.y===`end`?{bottom:0}:{top:0}},l=E(a,o);return{position:`absolute`,...c,width:t,height:t,borderRadius:i,overflow:`hidden`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:n,transform:r.translate,WebkitMaskImage:r.maskImage,maskImage:r.maskImage,WebkitMaskSize:r.maskSize,maskSize:r.maskSize,WebkitMaskPosition:r.maskPosition,maskPosition:r.maskPosition,WebkitMaskRepeat:`no-repeat`,maskRepeat:`no-repeat`,transition:`transform ${l}, -webkit-mask-position ${l}, mask-position ${l}`,"& > *":{boxShadow:`none !important`,borderRadius:`inherit !important`,width:`100%`,height:`100%`,margin:0}}});function A(e){let{index:t,ownerState:n,geometry:r,className:i,component:a,inert:o,itemRefs:s,slotProps:l,children:u}=e,p=c.useMemo(()=>({...n,index:t,isAnchor:t===0,geometry:r}),[n,t,r]),m=c.useRef(null),g=c.useCallback(e=>{s.current[t]=e},[s,t]),_=(0,d.useForkRef)(g,m);c.useEffect(()=>{let e=m.current;e&&`inert`in HTMLElement.prototype&&(e.inert=o)},[o]);let v=(0,f.default)({elementType:a,externalSlotProps:l,ownerState:p,additionalProps:{ref:_,className:i,"aria-hidden":o||void 0,children:u}});return(0,h.jsx)(a,{...v})}var j=c.forwardRef(function(e,t){let{children:n,direction:r=w.direction,size:i=w.size,variant:a=w.variant,gap:o=w.gap,fadeWidth:s=w.fadeWidth,trigger:p=w.trigger,open:m,defaultOpen:g=w.defaultOpen,onOpen:v,onClose:y,disableClickAway:b=w.disableClickAway,transitionDuration:x=w.transitionDuration,transitionEasing:S=w.transitionEasing,classes:E,slots:D,slotProps:j,className:ne,...M}=(0,u.useThemeProps)({props:e,name:`MuiCollageFab`}),[N,P]=(0,d.useControlled)({controlled:m,default:g,name:`CollageFab`,state:`open`}),F=c.useMemo(()=>c.Children.toArray(n).filter(e=>c.isValidElement(e)),[n]),I=F.length,L={open:N,direction:r,trigger:p,size:_(i),variant:a,cornerRadius:T[a],gap:o,fadeWidth:s,count:I,transitionDuration:x,transitionEasing:S},R=te(N,E),z=c.useRef(null),B=c.useRef([]),V=c.useRef(!1),H=c.useRef(`mouse`),U=c.useRef(!1),W=(0,d.useForkRef)(z,t),G=c.useCallback((e,t)=>{e!==N&&(P(e),e?v?.(t):y?.(t))},[N,P,v,y]),K=e=>{p===`hover`&&e.pointerType===`mouse`&&G(!0,e)},q=e=>{p===`hover`&&e.pointerType===`mouse`&&G(!1,e)},J=e=>{p!==`manual`&&(H.current=e.pointerType,V.current=!1,e.pointerType===`mouse`||N||(V.current=!0,G(!0,e)))},Y=e=>{V.current&&(V.current=!1,e.stopPropagation(),e.preventDefault())},X=e=>{p!==`manual`&&(p===`click`?G(!N,e):N&&H.current!==`mouse`&&G(!1,e))},Z=e=>{if(p!==`manual`){if(N){if(e.key!==`Escape`)return;e.stopPropagation(),G(!1,e),z.current?.focus()}else(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),U.current=!0,G(!0,e))}},re=e=>{G(!1,e)},Q=D?.root??O,ie=D?.item??k,ae=(0,f.default)({elementType:Q,externalForwardedProps:M,externalSlotProps:j?.root,ownerState:L,additionalProps:{ref:W,role:`group`,tabIndex:!N&&p!==`manual`?0:-1,onPointerEnter:K,onPointerLeave:q,onPointerDown:J,onClick:X,onClickCapture:Y,onKeyDown:Z},className:[R.root,ne]});if(c.useEffect(()=>{if(!N||!U.current)return;U.current=!1;let e=B.current[0];e&&(e.querySelector(ee)??e).focus()},[N]),I===0)return null;let $=(0,h.jsx)(Q,{...ae,children:F.map((e,t)=>(0,h.jsx)(A,{index:t,ownerState:L,geometry:C(t,L),className:R.item,component:ie,inert:!N&&p!==`manual`,itemRefs:B,slotProps:j?.item,children:e},t))});return b||p===`manual`?$:(0,h.jsx)(l.ClickAwayListener,{onClickAway:re,children:$})});exports.CollageFab=j;
package/dist-lib/index.js CHANGED
@@ -15,17 +15,73 @@ var u = {
15
15
  function d(e) {
16
16
  return typeof e == "number" ? e : u[e];
17
17
  }
18
- function f(e, t) {
19
- let { count: n, size: r, gap: i, fadeWidth: a, open: o, direction: s } = t, c = r + i, l = (n - 1) * c + r + a, u = e * c, d = s === "left" || s === "up", f = s === "left" || s === "right", p = e === 0 ? l : (n - e) * (r / n), m = e === 0 ? -a / 2 : r / n * e, h = o ? u : 0, g = d ? p - l - a / 2 + h : m - l - a / 2 - h, _ = d ? `#000 0px, #000 ${l}px, transparent ${l + a}px, transparent ${2 * l}px` : `transparent 0px, transparent ${l}px, #000 ${l + a}px, #000 ${2 * l}px`, v = `${d ? "-" : ""}${h}`;
18
+ var f = {
19
+ left: {
20
+ x: -1,
21
+ y: 0
22
+ },
23
+ right: {
24
+ x: 1,
25
+ y: 0
26
+ },
27
+ up: {
28
+ x: 0,
29
+ y: -1
30
+ },
31
+ down: {
32
+ x: 0,
33
+ y: 1
34
+ }
35
+ };
36
+ function p({ x: e, y: t }, n) {
37
+ return e !== 0 && t !== 0 ? `translate(${e}px, ${t}px)` : n ? `translateX(${e}px)` : `translateY(${t}px)`;
38
+ }
39
+ function m(e, t) {
40
+ let n = f[t.direction], r = e * (t.size + t.gap);
41
+ return {
42
+ x: n.x * r,
43
+ y: n.y * r
44
+ };
45
+ }
46
+ function h(e) {
47
+ return e.every((e) => e <= 0) && e.some((e) => e < 0) ? "end" : "start";
48
+ }
49
+ function g(e) {
50
+ let { count: t, size: n } = e, r = Array.from({ length: t }, (t, n) => m(n, e)), i = r.map((e) => e.x), a = r.map((e) => e.y);
20
51
  return {
21
- translate: f ? `translateX(${v}px)` : `translateY(${v}px)`,
22
- maskImage: n > 1 ? `linear-gradient(${f ? "to right" : "to bottom"}, ${_})` : "none",
23
- maskSize: f ? `${2 * l}px 100%` : `100% ${2 * l}px`,
24
- maskPosition: f ? `${g}px 0px` : `0px ${g}px`
52
+ extent: {
53
+ width: Math.max(...i, 0) - Math.min(...i, 0) + n,
54
+ height: Math.max(...a, 0) - Math.min(...a, 0) + n
55
+ },
56
+ align: {
57
+ x: h(i),
58
+ y: h(a)
59
+ }
60
+ };
61
+ }
62
+ function _(e, t) {
63
+ let { count: n, size: r, gap: i, fadeWidth: a, open: o, direction: s } = t, c = r + i, l = (n - 1) * c + r + a, u = f[s], d = u.x !== 0, h = (d ? u.x : u.y) < 0, g = o ? m(e, t) : {
64
+ x: 0,
65
+ y: 0
66
+ }, _ = e === 0 ? l : (n - e) * (r / n), v = e === 0 ? -a / 2 : r / n * e, y = (h ? _ : v) - l - a / 2, b = d ? {
67
+ x: y,
68
+ y: 0
69
+ } : {
70
+ x: 0,
71
+ y
72
+ }, x = {
73
+ x: b.x - g.x,
74
+ y: b.y - g.y
75
+ }, S = h ? `#000 0px, #000 ${l}px, transparent ${l + a}px, transparent ${2 * l}px` : `transparent 0px, transparent ${l}px, #000 ${l + a}px, #000 ${2 * l}px`;
76
+ return {
77
+ translate: p(g, d),
78
+ maskImage: n > 1 ? `linear-gradient(${d ? "to right" : "to bottom"}, ${S})` : "none",
79
+ maskSize: d ? `${2 * l}px 100%` : `100% ${2 * l}px`,
80
+ maskPosition: `${x.x}px ${x.y}px`
25
81
  };
26
82
  }
27
83
  // src/components/collageFabDefaults.ts
28
- var p = {
84
+ var v = {
29
85
  direction: "left",
30
86
  size: "large",
31
87
  variant: "circular",
@@ -36,66 +92,65 @@ var p = {
36
92
  disableClickAway: !1,
37
93
  transitionDuration: 400,
38
94
  transitionEasing: "cubic-bezier(0.4, 0, 0.2, 1)"
39
- }, m = {
95
+ }, y = {
40
96
  circular: "50%",
41
97
  rounded: "25%",
42
98
  square: 0
43
- }, h = "a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])";
44
- function g(e, t) {
99
+ }, b = "a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])";
100
+ function x(e, t) {
45
101
  return `${e}ms ${t}`;
46
102
  }
47
- function _(e) {
103
+ function S(e) {
48
104
  return c("MuiCollageFab", e);
49
105
  }
50
- var v = (e, t) => s({
106
+ var C = (e, t) => s({
51
107
  root: ["root", e ? "expanded" : "collapsed"],
52
108
  item: ["item"]
53
- }, _, t), y = n("div", {
109
+ }, S, t), w = n("div", {
54
110
  name: "MuiCollageFab",
55
111
  slot: "root",
56
112
  overridesResolver: (e, t) => t.root
57
113
  })(({ ownerState: e }) => {
58
- let { open: t, direction: n, size: r, gap: i, count: a, transitionDuration: o, transitionEasing: s } = e, c = n === "left" || n === "right", l = n === "left" || n === "up", u = t ? a * r + Math.max(a - 1, 0) * i : r;
114
+ let { open: t, size: n, transitionDuration: r, transitionEasing: i } = e, { extent: a } = g(e), o = x(r, i);
59
115
  return {
60
116
  position: "relative",
61
- width: c ? u : r,
62
- height: c ? r : u,
63
- display: "flex",
64
- flexDirection: c ? "row" : "column",
65
- justifyContent: l ? "flex-end" : "flex-start",
66
- transition: `${c ? "width" : "height"} ${g(o, s)}`,
117
+ width: t ? a.width : n,
118
+ height: t ? a.height : n,
119
+ transition: `width ${o}, height ${o}`,
67
120
  filter: "drop-shadow(0px 6px 12px rgba(0,0,0,0.25))",
68
121
  cursor: t ? "default" : "pointer",
69
122
  WebkitTapHighlightColor: "transparent"
70
123
  };
71
- }), b = n("div", {
124
+ }), T = n("div", {
72
125
  name: "MuiCollageFab",
73
126
  slot: "item",
74
127
  overridesResolver: (e, t) => t.item
75
128
  })(({ ownerState: e }) => {
76
- let { direction: t, size: n, index: r, geometry: i, cornerRadius: a, transitionDuration: o, transitionEasing: s } = e, c = t === "left" || t === "right", l = t === "left" ? { right: 0 } : t === "right" ? { left: 0 } : t === "up" ? { bottom: 0 } : { top: 0 }, u = g(o, s);
129
+ let { size: t, index: n, geometry: r, cornerRadius: i, transitionDuration: a, transitionEasing: o } = e, { align: s } = g(e), c = {
130
+ ...s.x === "end" ? { right: 0 } : { left: 0 },
131
+ ...s.y === "end" ? { bottom: 0 } : { top: 0 }
132
+ }, l = x(a, o);
77
133
  return {
78
134
  position: "absolute",
79
- ...l,
80
- ...c ? { top: 0 } : { left: 0 },
81
- width: n,
82
- height: n,
83
- borderRadius: a,
135
+ ...c,
136
+ width: t,
137
+ height: t,
138
+ borderRadius: i,
84
139
  overflow: "hidden",
85
140
  display: "flex",
86
141
  alignItems: "center",
87
142
  justifyContent: "center",
88
- zIndex: r,
89
- transform: i.translate,
90
- WebkitMaskImage: i.maskImage,
91
- maskImage: i.maskImage,
92
- WebkitMaskSize: i.maskSize,
93
- maskSize: i.maskSize,
94
- WebkitMaskPosition: i.maskPosition,
95
- maskPosition: i.maskPosition,
143
+ zIndex: n,
144
+ transform: r.translate,
145
+ WebkitMaskImage: r.maskImage,
146
+ maskImage: r.maskImage,
147
+ WebkitMaskSize: r.maskSize,
148
+ maskSize: r.maskSize,
149
+ WebkitMaskPosition: r.maskPosition,
150
+ maskPosition: r.maskPosition,
96
151
  WebkitMaskRepeat: "no-repeat",
97
152
  maskRepeat: "no-repeat",
98
- transition: `transform ${u}, -webkit-mask-position ${u}, mask-position ${u}`,
153
+ transition: `transform ${l}, -webkit-mask-position ${l}, mask-position ${l}`,
99
154
  "& > *": {
100
155
  boxShadow: "none !important",
101
156
  borderRadius: "inherit !important",
@@ -105,7 +160,7 @@ var v = (e, t) => s({
105
160
  }
106
161
  };
107
162
  });
108
- function x(t) {
163
+ function E(t) {
109
164
  let { index: n, ownerState: r, geometry: i, className: s, component: c, inert: u, itemRefs: d, slotProps: f, children: p } = t, m = e.useMemo(() => ({
110
165
  ...r,
111
166
  index: n,
@@ -135,28 +190,28 @@ function x(t) {
135
190
  });
136
191
  return /* @__PURE__ */ l(c, { ...v });
137
192
  }
138
- var S = e.forwardRef(function(n, s) {
139
- let { children: c, direction: u = p.direction, size: g = p.size, variant: _ = p.variant, gap: S = p.gap, fadeWidth: C = p.fadeWidth, trigger: w = p.trigger, open: T, defaultOpen: E = p.defaultOpen, onOpen: D, onClose: O, disableClickAway: k = p.disableClickAway, transitionDuration: ee = p.transitionDuration, transitionEasing: te = p.transitionEasing, classes: A, slots: j, slotProps: M, className: N, ...P } = r({
193
+ var D = e.forwardRef(function(n, s) {
194
+ let { children: c, direction: u = v.direction, size: f = v.size, variant: p = v.variant, gap: m = v.gap, fadeWidth: h = v.fadeWidth, trigger: g = v.trigger, open: x, defaultOpen: S = v.defaultOpen, onOpen: D, onClose: O, disableClickAway: k = v.disableClickAway, transitionDuration: ee = v.transitionDuration, transitionEasing: te = v.transitionEasing, classes: A, slots: j, slotProps: M, className: N, ...P } = r({
140
195
  props: n,
141
196
  name: "MuiCollageFab"
142
197
  }), [F, I] = i({
143
- controlled: T,
144
- default: E,
198
+ controlled: x,
199
+ default: S,
145
200
  name: "CollageFab",
146
201
  state: "open"
147
202
  }), L = e.useMemo(() => e.Children.toArray(c).filter((t) => e.isValidElement(t)), [c]), R = L.length, z = {
148
203
  open: F,
149
204
  direction: u,
150
- trigger: w,
151
- size: d(g),
152
- variant: _,
153
- cornerRadius: m[_],
154
- gap: S,
155
- fadeWidth: C,
205
+ trigger: g,
206
+ size: d(f),
207
+ variant: p,
208
+ cornerRadius: y[p],
209
+ gap: m,
210
+ fadeWidth: h,
156
211
  count: R,
157
212
  transitionDuration: ee,
158
213
  transitionEasing: te
159
- }, B = v(F, A), V = e.useRef(null), H = e.useRef([]), U = e.useRef(!1), W = e.useRef("mouse"), G = e.useRef(!1), K = a(V, s), q = e.useCallback((e, t) => {
214
+ }, B = C(F, A), V = e.useRef(null), H = e.useRef([]), U = e.useRef(!1), W = e.useRef("mouse"), G = e.useRef(!1), K = a(V, s), q = e.useCallback((e, t) => {
160
215
  e !== F && (I(e), e ? D?.(t) : O?.(t));
161
216
  }, [
162
217
  F,
@@ -164,17 +219,17 @@ var S = e.forwardRef(function(n, s) {
164
219
  D,
165
220
  O
166
221
  ]), J = (e) => {
167
- w === "hover" && e.pointerType === "mouse" && q(!0, e);
222
+ g === "hover" && e.pointerType === "mouse" && q(!0, e);
168
223
  }, Y = (e) => {
169
- w === "hover" && e.pointerType === "mouse" && q(!1, e);
224
+ g === "hover" && e.pointerType === "mouse" && q(!1, e);
170
225
  }, X = (e) => {
171
- w !== "manual" && (W.current = e.pointerType, U.current = !1, e.pointerType === "mouse" || F || (U.current = !0, q(!0, e)));
226
+ g !== "manual" && (W.current = e.pointerType, U.current = !1, e.pointerType === "mouse" || F || (U.current = !0, q(!0, e)));
172
227
  }, Z = (e) => {
173
228
  U.current && (U.current = !1, e.stopPropagation(), e.preventDefault());
174
229
  }, ne = (e) => {
175
- w !== "manual" && (w === "click" ? q(!F, e) : F && W.current !== "mouse" && q(!1, e));
230
+ g !== "manual" && (g === "click" ? q(!F, e) : F && W.current !== "mouse" && q(!1, e));
176
231
  }, re = (e) => {
177
- if (w !== "manual") {
232
+ if (g !== "manual") {
178
233
  if (F) {
179
234
  if (e.key !== "Escape") return;
180
235
  e.stopPropagation(), q(!1, e), V.current?.focus();
@@ -182,7 +237,7 @@ var S = e.forwardRef(function(n, s) {
182
237
  }
183
238
  }, ie = (e) => {
184
239
  q(!1, e);
185
- }, Q = j?.root ?? y, ae = j?.item ?? b, oe = o({
240
+ }, Q = j?.root ?? w, ae = j?.item ?? T, oe = o({
186
241
  elementType: Q,
187
242
  externalForwardedProps: P,
188
243
  externalSlotProps: M?.root,
@@ -190,7 +245,7 @@ var S = e.forwardRef(function(n, s) {
190
245
  additionalProps: {
191
246
  ref: K,
192
247
  role: "group",
193
- tabIndex: !F && w !== "manual" ? 0 : -1,
248
+ tabIndex: !F && g !== "manual" ? 0 : -1,
194
249
  onPointerEnter: J,
195
250
  onPointerLeave: Y,
196
251
  onPointerDown: X,
@@ -204,25 +259,25 @@ var S = e.forwardRef(function(n, s) {
204
259
  if (!F || !G.current) return;
205
260
  G.current = !1;
206
261
  let e = H.current[0];
207
- e && (e.querySelector(h) ?? e).focus();
262
+ e && (e.querySelector(b) ?? e).focus();
208
263
  }, [F]), R === 0) return null;
209
264
  let $ = /* @__PURE__ */ l(Q, {
210
265
  ...oe,
211
- children: L.map((e, t) => /* @__PURE__ */ l(x, {
266
+ children: L.map((e, t) => /* @__PURE__ */ l(E, {
212
267
  index: t,
213
268
  ownerState: z,
214
- geometry: f(t, z),
269
+ geometry: _(t, z),
215
270
  className: B.item,
216
271
  component: ae,
217
- inert: !F && w !== "manual",
272
+ inert: !F && g !== "manual",
218
273
  itemRefs: H,
219
274
  slotProps: M?.item,
220
275
  children: e
221
276
  }, t))
222
277
  });
223
- return k || w === "manual" ? $ : /* @__PURE__ */ l(t, {
278
+ return k || g === "manual" ? $ : /* @__PURE__ */ l(t, {
224
279
  onClickAway: ie,
225
280
  children: $
226
281
  });
227
282
  });
228
- export { S as CollageFab };
283
+ export { D as CollageFab };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mui-collage-fab",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Material UI floating action button that unfolds a stack of overlapping Fab circles into a row.",
5
5
  "license": "MIT",
6
6
  "author": "Radomir Wojtera",
@@ -48,7 +48,13 @@
48
48
  "provenance": true
49
49
  },
50
50
  "engines": {
51
- "node": ">=22.13.0"
51
+ "node": ">=18.0.0"
52
+ },
53
+ "devEngines": {
54
+ "runtime": {
55
+ "name": "node",
56
+ "version": ">=22.12.0"
57
+ }
52
58
  },
53
59
  "scripts": {
54
60
  "dev": "vite",
@@ -56,9 +62,9 @@
56
62
  "build:preview": "tsc --noEmit && vite build --base=\"${SITE_BASE_PATH:?set SITE_BASE_PATH to the deployed preview path}\"",
57
63
  "build:lib": "vite build --config vite.lib.config.ts && node scripts/build-dts.mjs",
58
64
  "preview": "vite preview",
59
- "format:check": "prettier --check .",
60
- "format": "prettier --write .",
61
- "lint": "eslint .",
65
+ "format:check": "oxfmt --check",
66
+ "format": "oxfmt",
67
+ "lint": "oxlint",
62
68
  "typecheck": "tsc --noEmit",
63
69
  "test": "vitest run",
64
70
  "test:watch": "vitest",
@@ -75,6 +81,8 @@
75
81
  "doctor": "node scripts/doctor.mjs",
76
82
  "doctor:fast": "node scripts/doctor.mjs --fast",
77
83
  "check:actions": "node scripts/actionlint.mjs",
84
+ "check:node": "node scripts/check-node.mjs",
85
+ "check:deps": "depcruise src --config .dependency-cruiser.mjs",
78
86
  "check:unused": "knip",
79
87
  "check:release": "semantic-release --dry-run --no-ci",
80
88
  "check:actions-security": "zizmor .github/workflows"
@@ -94,7 +102,6 @@
94
102
  "@axe-core/playwright": "^4.14.0",
95
103
  "@emotion/react": "^11.13.3",
96
104
  "@emotion/styled": "^11.13.0",
97
- "@eslint/js": "^10.0.1",
98
105
  "@mui/icons-material": "^5.16.7",
99
106
  "@mui/material": "^5.16.7",
100
107
  "@playwright/test": "^1.65.1",
@@ -113,15 +120,15 @@
113
120
  "@typescript/native": "npm:typescript@^7.0.2",
114
121
  "@vitejs/plugin-react": "^6.3.0",
115
122
  "@vitest/coverage-v8": "^5.1.0",
116
- "eslint": "^10.14.0",
117
- "eslint-config-prettier": "^10.1.8",
118
- "eslint-plugin-jsx-a11y": "^6.10.2",
119
- "eslint-plugin-react-hooks": "^7.1.1",
120
- "globals": "^17.14.0",
123
+ "dependency-cruiser": "^18.7.2",
124
+ "fast-check": "^4.5.0",
121
125
  "jest-axe": "^11.0.0",
122
126
  "jsdom": "^31.0.1",
127
+ "knip": "^6.20.0",
123
128
  "listr2": "^11.4.1",
124
- "prettier": "^3.10.1",
129
+ "oxfmt": "^0.78.0",
130
+ "oxlint": "^1.93.0",
131
+ "oxlint-tsgolint": "^7.0.2007",
125
132
  "publint": "^0.3.25",
126
133
  "react": "^18.3.1",
127
134
  "react-dom": "^18.3.1",
@@ -132,11 +139,8 @@
132
139
  "size-limit": "^14.3.0",
133
140
  "typedoc": "^0.28.20",
134
141
  "typescript": "npm:@typescript/typescript6@^6.0.2",
135
- "typescript-eslint": "^8.72.2",
136
142
  "vite": "^8.3.4",
137
- "vitest": "^5.1.0",
138
- "fast-check": "^4.5.0",
139
- "knip": "^6.20.0"
143
+ "vitest": "^5.1.0"
140
144
  },
141
145
  "size-limit": [
142
146
  {
@@ -149,10 +153,5 @@
149
153
  "path": "dist-lib/index.cjs",
150
154
  "limit": "3.1 kB"
151
155
  }
152
- ],
153
- "overrides": {
154
- "eslint-plugin-jsx-a11y": {
155
- "eslint": "$eslint"
156
- }
157
- }
156
+ ]
158
157
  }