flipfolio 0.1.0 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/folder-gallery-element.js","../src/folder-gallery.js"],"sourcesContent":["/* ============================================================================\n * <folder-gallery> - Custom Element wrapper around the framework-agnostic core.\n *\n * import { defineFolderGallery } from 'folder-gallery/element';\n * defineFolderGallery(); // registers <folder-gallery>\n *\n * <folder-gallery mode=\"grid\"></folder-gallery>\n * el.items = [{ label, color, src }, ...]; // set items via property\n * el.addEventListener('fg-select', e => ...); // events bubble from the core\n *\n * Uses the element itself as the light-DOM root, so the shared\n * folder-gallery.css styles it. (Shadow-DOM encapsulation is a later option.)\n * ========================================================================== */\n\nimport { createFolderGallery } from './folder-gallery.js';\n\nconst asBool = (v) => v !== null && v !== 'false';\n\n// SSR-safe base: on a server (Next/Nuxt) there is no HTMLElement, and merely\n// evaluating `class extends HTMLElement` at import time would throw. Fall back\n// to a stub there; the real element is only ever registered in the browser via\n// defineFolderGallery (guarded on customElements below).\nconst ElementBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {};\n\nexport class FolderGalleryElement extends ElementBase {\n static get observedAttributes() {\n return ['mode', 'peek', 'loop', 'scroll-nav', 'reduced-motion', 'default-active-index', 'label', 'folder-path'];\n }\n\n constructor() {\n super();\n this._handle = null;\n this._items = [];\n }\n\n /** Items are an array - set via property (attributes can't hold objects). */\n get items() { return this._items; }\n set items(value) {\n this._items = Array.isArray(value) ? value : [];\n if (this.isConnected) this._render();\n }\n\n connectedCallback() {\n // Optional declarative items via a JSON `items` attribute.\n if (!this._items.length && this.getAttribute('items')) {\n try { this._items = JSON.parse(this.getAttribute('items')); } catch (_) { /* ignore malformed */ }\n }\n this._render();\n }\n\n disconnectedCallback() { this._destroy(); }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (!this._handle) return;\n if (name === 'mode') { this._handle.setMode(newValue); return; }\n if (name === 'peek') { this._handle.setPeek(newValue); return; }\n this._render(); // any other observed attribute → rebuild\n }\n\n _options() {\n const opts = { items: this._items };\n if (this.hasAttribute('mode')) opts.mode = this.getAttribute('mode');\n if (this.hasAttribute('peek')) opts.peek = this.getAttribute('peek');\n if (this.hasAttribute('loop')) opts.loop = asBool(this.getAttribute('loop'));\n if (this.hasAttribute('scroll-nav')) opts.scrollNav = asBool(this.getAttribute('scroll-nav'));\n if (this.hasAttribute('reduced-motion')) opts.reducedMotion = this.getAttribute('reduced-motion');\n if (this.hasAttribute('default-active-index')) opts.defaultActiveIndex = parseInt(this.getAttribute('default-active-index'), 10) || 0;\n if (this.hasAttribute('label')) opts.label = this.getAttribute('label');\n if (this.hasAttribute('folder-path')) opts.folderPath = this.getAttribute('folder-path');\n if (typeof this.contentRenderer === 'function') opts.contentRenderer = this.contentRenderer;\n if (typeof this.onSelect === 'function') opts.onSelect = this.onSelect;\n return opts;\n }\n\n _render() {\n this._destroy();\n this._handle = createFolderGallery(this, this._options());\n }\n _destroy() {\n if (this._handle) { this._handle.destroy(); this._handle = null; }\n }\n\n /* Imperative API - delegate to the core handle. */\n next() { this._handle && this._handle.next(); }\n prev() { this._handle && this._handle.prev(); }\n goTo(i) { this._handle && this._handle.goTo(i); }\n setMode(m) { this.setAttribute('mode', m); }\n setPeek(p) { this.setAttribute('peek', p); }\n getActiveIndex() { return this._handle ? this._handle.getActiveIndex() : -1; }\n getMode() { return this._handle ? this._handle.getMode() : (this.getAttribute('mode') || 'stack'); }\n}\n\nexport function defineFolderGallery(tag = 'folder-gallery') {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, FolderGalleryElement);\n }\n return FolderGalleryElement;\n}\n\nexport default FolderGalleryElement;\n","/* ============================================================================\n * folder-gallery - a framework-agnostic 3D folder gallery (core, v0.1.0, WIP)\n *\n * import { createFolderGallery } from 'folder-gallery';\n * import 'folder-gallery/styles.css';\n *\n * const gallery = createFolderGallery(rootEl, {\n * items: [{ label, color, src }, ...], // or { content: Node | html }\n * mode: 'stack', // 'stack' | 'grid' | 'carousel'\n * onSelect: (item, index) => { ... },\n * });\n * gallery.next(); gallery.setMode('grid'); gallery.destroy();\n *\n * Ported from a hand-built portfolio engine. No framework, no dependencies.\n * Owns its own DOM and removes every listener on destroy().\n * ========================================================================== */\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n/* Default manila-folder-with-tab silhouette (viewBox 0 0 480 342). */\nconst DEFAULT_FOLDER_PATH =\n 'M 0 22 C 0 10 10 0 22 0 L 155 0 C 168 0 172 6 176 14 C 180 24 188 32 204 32 ' +\n 'L 458 32 C 470 32 480 42 480 54 L 480 320 C 480 332 470 342 458 342 ' +\n 'L 22 342 C 10 342 0 332 0 320 Z';\n\nconst DEFAULTS = {\n mode: 'stack', // 'stack' | 'grid' | 'carousel'\n folderPath: DEFAULT_FOLDER_PATH,\n loop: true,\n scrollNav: true,\n reducedMotion: 'auto', // 'auto' | 'off' | 'force'\n peek: 'hover', // 'hover' | 'always' | 'off'\n defaultActiveIndex: 0,\n label: 'Folder gallery',\n};\n\nconst PEEK_MODES = new Set(['hover', 'always', 'off']);\n\nconst MODE_WIDTHS = { stack: 480, grid: 720, carousel: 720 };\nconst SCROLL_THRESHOLD = 30;\nconst SCROLL_COOLDOWN = { stack: 450, carousel: 300 };\n\nfunction hexToRgb(hex) {\n const h = String(hex).replace('#', '');\n return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];\n}\n/* Derive the folder's three surfaces from one base color (same offsets as the\n * original engine): back/tab −30, frosted front +40 at 0.55, solid front +35.\n * The solid variant is what keeps NON-active cards fully opaque - only the\n * active card gets the translucent frosted treatment. Also picks a label\n * color (white or ink) by the frontSolid surface's YIQ brightness, so a\n * dark folder color doesn't leave the label unreadable regardless of theme. */\nfunction folderColors(hex) {\n const [r, g, b] = hexToRgb(hex);\n const dn = (v) => Math.max(v - 30, 0);\n const up = (v, o) => Math.min(v + o, 255);\n const fr = up(r, 35);\n const fg = up(g, 35);\n const fb = up(b, 35);\n const yiq = (fr * 299 + fg * 587 + fb * 114) / 1000;\n return {\n back: `rgb(${dn(r)},${dn(g)},${dn(b)})`,\n front: `rgba(${up(r, 40)},${up(g, 40)},${up(b, 40)},0.55)`,\n frontSolid: `rgb(${fr},${fg},${fb})`,\n label: yiq >= 128 ? '#1c1c1a' : '#ffffff',\n };\n}\n\n/* Built-in default content renderer. Accepts item.content (a Node or HTML\n * string) or item.src (an image). Consumers pass their own contentRenderer\n * (card, item, index) to hold arbitrary content - that's the whole point. */\nfunction defaultContentRenderer(card, item /* , index */) {\n const wrap = document.createElement('div');\n wrap.className = 'fg-content';\n // Duck-type DOM nodes (nodeType) rather than `instanceof Node` - `Node`\n // isn't a global in every embedding (SSR shims, minimal DOM harnesses).\n if (item.content && typeof item.content === 'object' && typeof item.content.nodeType === 'number') {\n wrap.appendChild(item.content);\n } else if (typeof item.content === 'string') {\n wrap.innerHTML = item.content;\n } else if (item.src) {\n const img = document.createElement('img');\n img.className = 'fg-image';\n img.src = item.src;\n img.alt = item.label || '';\n img.loading = 'lazy';\n img.decoding = 'async';\n wrap.appendChild(img);\n }\n card.appendChild(wrap);\n}\n\nexport function createFolderGallery(root, options = {}) {\n if (!root || !root.nodeType) throw new Error('createFolderGallery: a root element is required');\n\n const opts = { ...DEFAULTS, ...options };\n const items = Array.isArray(opts.items) ? opts.items : [];\n const n = items.length;\n const renderContent =\n typeof opts.contentRenderer === 'function' ? opts.contentRenderer : defaultContentRenderer;\n\n const reduced =\n opts.reducedMotion === 'force' ||\n (opts.reducedMotion !== 'off' &&\n typeof matchMedia === 'function' &&\n matchMedia('(prefers-reduced-motion: reduce)').matches);\n\n let mode = MODE_WIDTHS[opts.mode] ? opts.mode : 'stack';\n let active = Math.min(Math.max(opts.defaultActiveIndex | 0, 0), Math.max(n - 1, 0));\n let scrollCooldown = false;\n let scrollAccum = 0;\n\n /* ── Listener bookkeeping for destroy() ── */\n const cleanups = [];\n const on = (el, ev, fn, o) => { el.addEventListener(ev, fn, o); cleanups.push(() => el.removeEventListener(ev, fn, o)); };\n const emit = (name, detail) => root.dispatchEvent(new CustomEvent(name, { detail, bubbles: true }));\n\n /* ── Build own DOM (no page scaffold assumed) ── */\n root.classList.add('fg-root');\n root.setAttribute('data-fg-mode', mode);\n root.setAttribute('data-fg-peek', PEEK_MODES.has(opts.peek) ? opts.peek : 'hover');\n const scene = document.createElement('div');\n scene.className = 'fg-scene';\n scene.setAttribute('role', 'listbox');\n scene.setAttribute('aria-label', opts.label);\n scene.setAttribute('aria-roledescription', 'folder gallery');\n const dotsEl = document.createElement('div');\n dotsEl.className = 'fg-dots';\n dotsEl.setAttribute('role', 'tablist');\n const live = document.createElement('div');\n live.className = 'fg-sr-only';\n live.setAttribute('aria-live', 'polite');\n live.setAttribute('aria-atomic', 'true');\n root.append(scene, dotsEl, live);\n\n function teardown() {\n cleanups.forEach((fn) => fn());\n cleanups.length = 0;\n root.replaceChildren();\n root.classList.remove('fg-root');\n root.removeAttribute('data-fg-mode');\n root.removeAttribute('data-fg-peek');\n }\n\n if (n === 0) {\n return { next() {}, prev() {}, goTo() {}, setMode() {}, setPeek() {}, getActiveIndex: () => -1, getMode: () => mode, destroy: teardown };\n }\n\n /* ── Normalized transform - identical function list for every mode ── */\n function setCardTransform(card, { x, y, z, rx, ry, s, zIndex, opacity, isActive }) {\n card.style.transform = `translate3d(${x}px,${y}px,${z}px) rotateX(${rx}deg) rotateY(${ry}deg) scale(${s})`;\n card.style.transformOrigin = 'center bottom';\n card.style.zIndex = String(zIndex);\n card.style.opacity = String(opacity);\n card.setAttribute('aria-selected', isActive ? 'true' : 'false');\n card.classList.toggle('is-active', isActive);\n }\n\n /* ── Build cards ── */\n const cardEls = items.map((item, i) => {\n const card = document.createElement('div');\n card.className = 'fg-card';\n card.tabIndex = i === active ? 0 : -1; // roving tabindex\n card.setAttribute('role', 'option');\n card.setAttribute('aria-label', item.label || `Item ${i + 1}`);\n if (item.color) {\n const c = folderColors(item.color);\n card.style.setProperty('--fg-folder-bg', item.color);\n card.style.setProperty('--fg-front', c.front);\n card.style.setProperty('--fg-front-solid', c.frontSolid);\n card.style.setProperty('--fg-label-on-color', c.label);\n }\n\n const svg = document.createElementNS(SVG_NS, 'svg');\n svg.setAttribute('class', 'fg-folder');\n svg.setAttribute('viewBox', '0 0 480 342');\n svg.setAttribute('preserveAspectRatio', 'none');\n svg.setAttribute('aria-hidden', 'true');\n const path = document.createElementNS(SVG_NS, 'path');\n path.setAttribute('d', opts.folderPath);\n path.setAttribute('fill', item.color ? folderColors(item.color).back : 'var(--fg-folder-bg)');\n svg.appendChild(path);\n\n card.appendChild(svg);\n\n renderContent(card, item, i);\n\n const front = document.createElement('div');\n front.className = 'fg-front';\n /* Decal: the photo prints on the folder's FRONT PANEL. The back and tab\n keep their color, so the folder stays a folder: colored tabs in the\n stack, a real material boundary at the front's lip. */\n if (item.decal) {\n card.classList.add('fg-card--decal');\n const photo = document.createElement('img');\n photo.className = 'fg-decal';\n photo.src = item.decal;\n photo.alt = '';\n photo.loading = 'lazy';\n photo.decoding = 'async';\n front.appendChild(photo);\n }\n if (item.label) {\n const label = document.createElement('div');\n label.className = 'fg-label';\n label.textContent = item.label;\n front.appendChild(label);\n }\n card.appendChild(front);\n\n scene.appendChild(card);\n return card;\n });\n\n /* ── Dots ── */\n const dots = cardEls.map((_, i) => {\n const dot = document.createElement('button');\n dot.type = 'button';\n dot.className = 'fg-dot';\n dot.setAttribute('role', 'tab');\n dot.setAttribute('aria-label', items[i].label || `Go to ${i + 1}`);\n on(dot, 'click', () => goTo(i));\n dotsEl.appendChild(dot);\n return dot;\n });\n\n /* ── Layouts ── */\n function layoutStack() {\n scene.style.height = '';\n cardEls.forEach((card, i) => {\n const behind = (i - active + n) % n;\n if (behind === 0) {\n setCardTransform(card, { x: 0, y: 100, z: 20, rx: 0, ry: 0, s: 1, zIndex: n + 1, opacity: 1, isActive: true });\n return;\n }\n const safeN = Math.max(n - 1, 1);\n const tz = -behind * 25 - behind * behind * 3;\n const rx = reduced ? 0 : -behind * 3;\n const ty = 100 - behind * 28 - behind * behind * 2;\n const sc = 1 - behind * 0.06 - (behind / safeN) * (behind / safeN) * 0.04;\n setCardTransform(card, { x: 0, y: ty, z: tz, rx, ry: 0, s: Math.max(sc, 0.5), zIndex: n - behind, opacity: 1 - behind * 0.08, isActive: false });\n });\n }\n function layoutGrid() {\n const sceneW = scene.clientWidth || MODE_WIDTHS.grid;\n // Two columns on narrow scenes so folders stay tappable and readable.\n const cols = sceneW < 520 ? 2 : n <= 4 ? 2 : 3;\n const gap = 16;\n const cardW = sceneW;\n const cardH = sceneW * (2 / 3);\n const sc = (sceneW - (cols - 1) * gap) / (cols * cardW);\n const scaledW = cardW * sc;\n const scaledH = cardH * sc;\n const tabScaled = 22 * sc;\n const rows = Math.ceil(n / cols);\n cardEls.forEach((card, i) => {\n const col = i % cols;\n const row = Math.floor(i / cols);\n const itemsInRow = Math.min(cols, n - row * cols);\n const rowW = itemsInRow * scaledW + (itemsInRow - 1) * gap;\n const rowStartX = (sceneW - rowW) / 2;\n const cellLeft = rowStartX + col * (scaledW + gap);\n const cellTop = row * (scaledH + tabScaled + gap) + tabScaled;\n const tx = cellLeft + scaledW / 2 - cardW / 2;\n const ty = cellTop + scaledH - cardH;\n setCardTransform(card, { x: tx, y: ty, z: 0, rx: 0, ry: 0, s: sc, zIndex: i === active ? 2 : 1, opacity: 1, isActive: i === active });\n });\n scene.style.height = rows * (scaledH + tabScaled + gap) + 20 + 'px';\n }\n function layoutCarousel() {\n const sceneW = scene.clientWidth || MODE_WIDTHS.carousel;\n const cardW = sceneW;\n const cardH = cardW * (2 / 3);\n const activeSc = 0.62;\n const activeW = cardW * activeSc;\n const sceneH = Math.max(cardH * activeSc + 40, 180);\n scene.style.height = sceneH + 'px';\n const offsetStep = Math.min(130, (sceneW - activeW) / 4);\n cardEls.forEach((card, i) => {\n let offset = i - active;\n if (n > 2 && offset > Math.floor(n / 2)) offset -= n;\n if (n > 2 && offset < -Math.floor(n / 2)) offset += n;\n const sc = Math.max(activeSc - Math.abs(offset) * 0.06, 0.28);\n const z = -Math.abs(offset) * 50;\n const op = Math.max(1 - Math.abs(offset) * 0.25, 0.15);\n const tx = sceneW / 2 + offset * offsetStep - cardW / 2;\n const ty = sceneH - 20 - cardH;\n setCardTransform(card, { x: tx, y: ty, z, rx: 0, ry: 0, s: sc, zIndex: n - Math.abs(offset), opacity: op, isActive: offset === 0 });\n });\n }\n // Scene width tracks the active mode so the layout math (which assumes the\n // mode's logical width) matches the actually-rendered card width. Layouts\n // then read scene.clientWidth, so everything stays self-consistent at any size.\n function sizeScene() {\n scene.style.width = `min(${MODE_WIDTHS[mode]}px, 92vw)`;\n }\n function applyLayout() {\n sizeScene();\n (mode === 'grid' ? layoutGrid : mode === 'carousel' ? layoutCarousel : layoutStack)();\n dots.forEach((d, i) => {\n d.classList.toggle('is-active', i === active);\n d.setAttribute('aria-selected', i === active ? 'true' : 'false');\n });\n cardEls.forEach((c, i) => { c.tabIndex = i === active ? 0 : -1; });\n const cur = items[active];\n live.textContent = cur && cur.label ? `${active + 1} of ${n}: ${cur.label}` : `${active + 1} of ${n}`;\n }\n\n /* ── Navigation ── */\n function goTo(i) {\n const next = opts.loop ? ((i % n) + n) % n : Math.min(Math.max(i, 0), n - 1);\n if (next === active) return;\n active = next;\n applyLayout();\n emit('fg-activechange', { index: active, item: items[active] });\n }\n function select(i) {\n emit('fg-select', { index: i, item: items[i] });\n if (typeof opts.onSelect === 'function') opts.onSelect(items[i], i);\n }\n function setMode(m) {\n if (m === mode || !MODE_WIDTHS[m]) return;\n mode = m;\n root.setAttribute('data-fg-mode', mode);\n applyLayout();\n emit('fg-modechange', { mode });\n }\n function setPeek(p) {\n if (!PEEK_MODES.has(p)) return;\n root.setAttribute('data-fg-peek', p);\n }\n\n /* ── Interaction ── */\n cardEls.forEach((card, i) => {\n on(card, 'click', () => { i === active ? select(i) : goTo(i); });\n on(card, 'keydown', (e) => {\n if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); select(i); }\n });\n });\n /* Arrow keys work two ways, matching the reference implementation:\n 1. Focus already inside the gallery (Tab to a card/dot) - bubbles here\n and re-focuses the new active card, standard roving-tabindex UX.\n 2. Mouse hovering the gallery, focus anywhere else on the page - a\n document-level listener picks it up. Without this route, arrow\n keys only work AFTER a click puts focus on a card - and a click is\n also what fires onSelect, which in real use is often a link. Making\n keyboard nav depend on that first click means the only way to\n \"activate\" arrows is to risk navigating away. Hover is enough. */\n function handleArrowKeys(e) {\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { e.preventDefault(); goTo(active + 1); return true; }\n if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { e.preventDefault(); goTo(active - 1); return true; }\n if (e.key === 'Home') { e.preventDefault(); goTo(0); return true; }\n if (e.key === 'End') { e.preventDefault(); goTo(n - 1); return true; }\n return false;\n }\n on(scene, 'keydown', (e) => { if (handleArrowKeys(e)) cardEls[active].focus(); });\n on(dotsEl, 'keydown', (e) => { if (handleArrowKeys(e)) cardEls[active].focus(); });\n\n let hovered = false;\n on(root, 'mouseenter', () => { hovered = true; });\n on(root, 'mouseleave', () => { hovered = false; });\n on(document, 'keydown', (e) => {\n if (!hovered) return;\n // Don't hijack arrows if focus is on an interactive control outside\n // the gallery (nav link, a form field elsewhere on the page).\n const ae = document.activeElement;\n if (ae && ae !== document.body && !root.contains(ae)) return;\n handleArrowKeys(e); // no forced focus - the user hasn't tabbed in\n });\n\n if (opts.scrollNav) {\n /* Bound to root, not just the scene box: root is the widget's full\n footprint (scene + dots), so wheel events over the dots row or any\n gap the consumer's own layout leaves around the gallery still cycle\n it, instead of requiring the pointer over the exact folder art. */\n on(root, 'wheel', (e) => {\n if (mode === 'grid') return;\n const atStart = !opts.loop && active === 0 && e.deltaY < 0;\n const atEnd = !opts.loop && active === n - 1 && e.deltaY > 0;\n if (atStart || atEnd) return;\n e.preventDefault();\n if (scrollCooldown) return;\n scrollAccum += e.deltaY;\n if (Math.abs(scrollAccum) >= SCROLL_THRESHOLD) {\n const dir = scrollAccum > 0 ? 1 : -1;\n scrollAccum = 0;\n scrollCooldown = true;\n goTo(active + dir);\n setTimeout(() => { scrollCooldown = false; scrollAccum = 0; }, SCROLL_COOLDOWN[mode] || 300);\n }\n }, { passive: false });\n }\n\n /* Dominant-axis swipe: up or left advances, down or right goes back.\n Horizontal is the natural phone gesture in carousel; vertical matches\n the wheel direction on the stack. Both work everywhere. */\n let touchStartX = 0;\n let touchStartY = 0;\n on(scene, 'touchstart', (e) => {\n touchStartX = e.touches[0].clientX;\n touchStartY = e.touches[0].clientY;\n }, { passive: true });\n on(scene, 'touchend', (e) => {\n const dx = touchStartX - e.changedTouches[0].clientX;\n const dy = touchStartY - e.changedTouches[0].clientY;\n const ax = Math.abs(dx);\n const ay = Math.abs(dy);\n if (Math.max(ax, ay) < 40) return;\n const dir = ax > ay ? (dx > 0 ? 1 : -1) : (dy > 0 ? 1 : -1);\n goTo(active + dir);\n }, { passive: true });\n\n let resizeTimer;\n on(window, 'resize', () => { clearTimeout(resizeTimer); resizeTimer = setTimeout(applyLayout, 150); });\n\n applyLayout();\n\n /* ── Public handle ── */\n return {\n next: () => goTo(active + 1),\n prev: () => goTo(active - 1),\n goTo,\n setMode,\n setPeek,\n getActiveIndex: () => active,\n getMode: () => mode,\n destroy: teardown,\n };\n}\n\nexport default createFolderGallery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBA,IAAM,SAAS;AAGf,IAAM,sBACJ;AAIF,IAAM,WAAW;AAAA,EACf,MAAM;AAAA;AAAA,EACN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,eAAe;AAAA;AAAA,EACf,MAAM;AAAA;AAAA,EACN,oBAAoB;AAAA,EACpB,OAAO;AACT;AAEA,IAAM,aAAa,o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,aAAa,QAAQ,CAAC;AAAA,EAAG;AAAA,EAC3C,QAAQ,GAAG;AAAE,SAAK,aAAa,QAAQ,CAAC;AAAA,EAAG;AAAA,EAC3C,iBAAiB;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,eAAe,IAAI;AAAA,EAAI;AAAA,EAC7E,UAAU;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,QAAQ,IAAK,KAAK,aAAa,MAAM,KAAK;AAAA,EAAU;AACrG;AAEO,SAAS,oBAAoB,MAAM,kBAAkB;AAC1D,MAAI,OAAO,mBAAmB,eAAe,CAAC,eAAe,IAAI,GAAG,GAAG;AACrE,mBAAe,OAAO,KAAK,oBAAoB;AAAA,EACjD;AACA,SAAO;AACT;AAEA,IAAO,iCAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/folder-gallery-element.js","../src/folder-gallery.js"],"sourcesContent":["/* ============================================================================\n * <folder-gallery> - Custom Element wrapper around the framework-agnostic core.\n *\n * import { defineFolderGallery } from 'folder-gallery/element';\n * defineFolderGallery(); // registers <folder-gallery>\n *\n * <folder-gallery mode=\"grid\"></folder-gallery>\n * el.items = [{ label, color, src }, ...]; // set items via property\n * el.addEventListener('fg-select', e => ...); // events bubble from the core\n *\n * Uses the element itself as the light-DOM root, so the shared\n * folder-gallery.css styles it. (Shadow-DOM encapsulation is a later option.)\n * ========================================================================== */\n\nimport { createFolderGallery } from './folder-gallery.js';\n\nconst asBool = (v) => v !== null && v !== 'false';\n\n// SSR-safe base: on a server (Next/Nuxt) there is no HTMLElement, and merely\n// evaluating `class extends HTMLElement` at import time would throw. Fall back\n// to a stub there; the real element is only ever registered in the browser via\n// defineFolderGallery (guarded on customElements below).\nconst ElementBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {};\n\nexport class FolderGalleryElement extends ElementBase {\n static get observedAttributes() {\n return ['mode', 'peek', 'drag', 'loop', 'scroll-nav', 'reduced-motion', 'default-active-index', 'label', 'folder-path'];\n }\n\n constructor() {\n super();\n this._handle = null;\n this._items = [];\n }\n\n /** Items are an array - set via property (attributes can't hold objects). */\n get items() { return this._items; }\n set items(value) {\n this._items = Array.isArray(value) ? value : [];\n if (this.isConnected) this._render();\n }\n\n connectedCallback() {\n // Optional declarative items via a JSON `items` attribute.\n if (!this._items.length && this.getAttribute('items')) {\n try { this._items = JSON.parse(this.getAttribute('items')); } catch (_) { /* ignore malformed */ }\n }\n this._render();\n }\n\n disconnectedCallback() { this._destroy(); }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (!this._handle) return;\n if (name === 'mode') { this._handle.setMode(newValue); return; }\n if (name === 'peek') { this._handle.setPeek(newValue); return; }\n this._render(); // any other observed attribute → rebuild\n }\n\n _options() {\n const opts = { items: this._items };\n if (this.hasAttribute('mode')) opts.mode = this.getAttribute('mode');\n if (this.hasAttribute('peek')) opts.peek = this.getAttribute('peek');\n if (this.hasAttribute('drag')) opts.drag = this.getAttribute('drag');\n if (this.hasAttribute('loop')) opts.loop = asBool(this.getAttribute('loop'));\n if (this.hasAttribute('scroll-nav')) opts.scrollNav = asBool(this.getAttribute('scroll-nav'));\n if (this.hasAttribute('reduced-motion')) opts.reducedMotion = this.getAttribute('reduced-motion');\n if (this.hasAttribute('default-active-index')) opts.defaultActiveIndex = parseInt(this.getAttribute('default-active-index'), 10) || 0;\n if (this.hasAttribute('label')) opts.label = this.getAttribute('label');\n if (this.hasAttribute('folder-path')) opts.folderPath = this.getAttribute('folder-path');\n if (typeof this.contentRenderer === 'function') opts.contentRenderer = this.contentRenderer;\n if (typeof this.onSelect === 'function') opts.onSelect = this.onSelect;\n return opts;\n }\n\n _render() {\n this._destroy();\n this._handle = createFolderGallery(this, this._options());\n }\n _destroy() {\n if (this._handle) { this._handle.destroy(); this._handle = null; }\n }\n\n /* Imperative API - delegate to the core handle. */\n next() { this._handle && this._handle.next(); }\n prev() { this._handle && this._handle.prev(); }\n goTo(i) { this._handle && this._handle.goTo(i); }\n setMode(m) { this.setAttribute('mode', m); }\n setPeek(p) { this.setAttribute('peek', p); }\n setColor(i, hex) { this._handle && this._handle.setColor(i, hex); }\n setGradient(i, gradient) { this._handle && this._handle.setGradient(i, gradient); }\n getActiveIndex() { return this._handle ? this._handle.getActiveIndex() : -1; }\n getMode() { return this._handle ? this._handle.getMode() : (this.getAttribute('mode') || 'stack'); }\n getPeek() { return this._handle ? this._handle.getPeek() : (this.getAttribute('peek') || 'hover'); }\n getColor(i) { return this._handle ? this._handle.getColor(i) : undefined; }\n getGradient(i) { return this._handle ? this._handle.getGradient(i) : undefined; }\n getItems() { return this._handle ? this._handle.getItems() : []; }\n}\n\nexport function defineFolderGallery(tag = 'folder-gallery') {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, FolderGalleryElement);\n }\n return FolderGalleryElement;\n}\n\nexport default FolderGalleryElement;\n","/* ============================================================================\n * flipfolio - a framework-agnostic 3D folder gallery (core)\n *\n * import { createFolderGallery } from 'flipfolio';\n * import 'flipfolio/styles.css';\n *\n * const gallery = createFolderGallery(rootEl, {\n * items: [{ label, color, src }, ...], // or { content: Node | html }\n * mode: 'stack', // 'stack' | 'grid' | 'carousel'\n * onSelect: (item, index) => { ... },\n * });\n * gallery.next(); gallery.setMode('grid'); gallery.destroy();\n *\n * Ported from a hand-built portfolio engine. No framework, no dependencies.\n * Owns its own DOM and removes every listener on destroy().\n * ========================================================================== */\n\nconst SVG_NS = 'http://www.w3.org/2000/svg';\n\n/* Default manila-folder-with-tab silhouette (viewBox 0 0 480 342). */\nconst DEFAULT_FOLDER_PATH =\n 'M 0 22 C 0 10 10 0 22 0 L 155 0 C 168 0 172 6 176 14 C 180 24 188 32 204 32 ' +\n 'L 458 32 C 470 32 480 42 480 54 L 480 320 C 480 332 470 342 458 342 ' +\n 'L 22 342 C 10 342 0 332 0 320 Z';\n\n/* A right-side tab is the default mirrored across the viewBox midline; a tabless\n * tray drops the tab notch entirely. Consumers pass one as `folderPath` instead\n * of hand-authoring an SVG path. The default (left tab) stays FOLDER_PATHS.left. */\nexport const FOLDER_PATHS = {\n left: DEFAULT_FOLDER_PATH,\n right:\n 'M 480 22 C 480 10 470 0 458 0 L 325 0 C 312 0 308 6 304 14 C 300 24 292 32 276 32 ' +\n 'L 22 32 C 10 32 0 42 0 54 L 0 320 C 0 332 10 342 22 342 ' +\n 'L 458 342 C 470 342 480 332 480 320 Z',\n tray:\n 'M 0 22 C 0 10 10 0 22 0 L 458 0 C 470 0 480 10 480 22 L 480 320 ' +\n 'C 480 332 470 342 458 342 L 22 342 C 10 342 0 332 0 320 Z',\n};\n\nconst DEFAULTS = {\n mode: 'stack', // 'stack' | 'grid' | 'carousel'\n folderPath: DEFAULT_FOLDER_PATH,\n loop: true,\n scrollNav: true,\n reducedMotion: 'auto', // 'auto' | 'off' | 'force'\n peek: 'hover', // 'hover' | 'always' | 'off'\n drag: 'fling', // 'fling' | 'off' - grab the active folder and throw it (stack mode)\n defaultActiveIndex: 0,\n label: 'Folder gallery',\n};\n\nconst PEEK_MODES = new Set(['hover', 'always', 'off']);\nconst DRAG_MODES = new Set(['fling', 'off']);\n\n/* Track the live instance per root so re-initializing the same element tears the\n * previous one down first (its window/document listeners are otherwise\n * unreachable and would leak, plus its DOM would be duplicated). */\nconst INSTANCES = new WeakMap();\n\nconst MODE_WIDTHS = { stack: 480, grid: 720, carousel: 720 };\nconst SCROLL_THRESHOLD = 30;\nconst SCROLL_COOLDOWN = { stack: 450, carousel: 300 };\n\n/* Parse #rgb or #rrggbb (with or without the hash) to [r,g,b]. Returns null for\n * anything else so callers can no-op instead of painting rgb(NaN,...) surfaces. */\nfunction hexToRgb(hex) {\n let h = String(hex).trim().replace(/^#/, '');\n if (h.length === 3) h = h.replace(/./g, (c) => c + c);\n if (!/^[0-9a-f]{6}$/i.test(h)) return null;\n return [parseInt(h.slice(0, 2), 16), parseInt(h.slice(2, 4), 16), parseInt(h.slice(4, 6), 16)];\n}\n/* Derive the folder's three surfaces from one base color (same offsets as the\n * original engine): back/tab −30, frosted front +40 at 0.55, solid front +35.\n * The solid variant is what keeps NON-active cards fully opaque - only the\n * active card gets the translucent frosted treatment. Also picks a label\n * color (white or ink) by the frontSolid surface's YIQ brightness, so a\n * dark folder color doesn't leave the label unreadable regardless of theme. */\nfunction folderColors(hex) {\n const rgb = hexToRgb(hex);\n if (!rgb) return null;\n const [r, g, b] = rgb;\n const dn = (v) => Math.max(v - 30, 0);\n const up = (v, o) => Math.min(v + o, 255);\n const fr = up(r, 35);\n const fg = up(g, 35);\n const fb = up(b, 35);\n const yiq = (fr * 299 + fg * 587 + fb * 114) / 1000;\n return {\n back: `rgb(${dn(r)},${dn(g)},${dn(b)})`,\n front: `rgba(${up(r, 40)},${up(g, 40)},${up(b, 40)},0.55)`,\n frontSolid: `rgb(${fr},${fg},${fb})`,\n label: yiq >= 128 ? '#1c1c1a' : '#ffffff',\n };\n}\n\n/* Paint a folder's whole palette from a single hex: the SVG back, the frosted\n * and solid front surfaces, and the auto-contrast label color. Shared by the\n * build-time pass and the runtime setColor() handle method so both derive the\n * palette identically. */\nfunction paintFolder(card, hex) {\n const c = folderColors(hex);\n if (!c) return; // ignore a malformed color rather than paint rgb(NaN,...)\n card.style.setProperty('--fg-folder-bg', hex);\n card.style.setProperty('--fg-front', c.front);\n card.style.setProperty('--fg-front-solid', c.frontSolid);\n card.style.setProperty('--fg-label-on-color', c.label);\n const path = card.querySelector('.fg-folder path');\n if (path) path.setAttribute('fill', c.back);\n}\n\n/* Paint a CSS gradient across the folder's front panel, beneath the label and\n * any peek contents. A falsy gradient clears it. */\nfunction paintGradient(card, gradient) {\n const front = card.querySelector('.fg-front');\n if (!front) return;\n let layer = front.querySelector('.fg-gradient');\n if (!gradient) {\n if (layer) layer.remove();\n card.classList.remove('fg-card--gradient');\n return;\n }\n if (!layer) {\n layer = document.createElement('div');\n layer.className = 'fg-gradient';\n layer.setAttribute('aria-hidden', 'true');\n front.insertBefore(layer, front.firstChild);\n }\n layer.style.background = gradient;\n card.classList.add('fg-card--gradient');\n}\n\n/* Built-in default content renderer. Accepts item.content (a Node or HTML\n * string) or item.src (an image). Consumers pass their own contentRenderer\n * (card, item, index) to hold arbitrary content - that's the whole point. */\nfunction defaultContentRenderer(card, item /* , index */) {\n const wrap = document.createElement('div');\n wrap.className = 'fg-content';\n // Duck-type DOM nodes (nodeType) rather than `instanceof Node` - `Node`\n // isn't a global in every embedding (SSR shims, minimal DOM harnesses).\n if (item.content && typeof item.content === 'object' && typeof item.content.nodeType === 'number') {\n wrap.appendChild(item.content);\n } else if (typeof item.content === 'string') {\n wrap.innerHTML = item.content;\n } else if (item.src) {\n const img = document.createElement('img');\n img.className = 'fg-image';\n img.src = item.src;\n img.alt = item.label || '';\n img.loading = 'lazy';\n img.decoding = 'async';\n wrap.appendChild(img);\n }\n card.appendChild(wrap);\n}\n\nexport function createFolderGallery(root, options = {}) {\n if (!root || root.nodeType !== 1) throw new Error('createFolderGallery: a root element is required');\n\n // Re-init on the same root: tear the old instance down so it can't leak.\n const prior = INSTANCES.get(root);\n if (prior) prior();\n\n // Drop undefined values before merging: a wrapper passing an unset prop\n // (loop, scrollNav, ...) as `undefined` must NOT clobber the real default.\n const provided = {};\n for (const k in options) if (options[k] !== undefined) provided[k] = options[k];\n const opts = { ...DEFAULTS, ...provided };\n const items = Array.isArray(opts.items) ? opts.items : [];\n const n = items.length;\n const renderContent =\n typeof opts.contentRenderer === 'function' ? opts.contentRenderer : defaultContentRenderer;\n\n const reducedQuery =\n opts.reducedMotion === 'auto' && typeof matchMedia === 'function'\n ? matchMedia('(prefers-reduced-motion: reduce)')\n : null;\n // `let` so an OS reduced-motion toggle after init re-syncs the JS motion\n // branches (fling short-circuit, stack tilt) with the CSS, which updates live.\n let reduced = opts.reducedMotion === 'force' || (reducedQuery ? reducedQuery.matches : false);\n\n let mode = MODE_WIDTHS[opts.mode] ? opts.mode : 'stack';\n let active = Math.min(Math.max(opts.defaultActiveIndex | 0, 0), Math.max(n - 1, 0));\n let scrollCooldown = false;\n let scrollAccum = 0;\n\n /* ── Listener bookkeeping for destroy() ── */\n const cleanups = [];\n const on = (el, ev, fn, o) => { el.addEventListener(ev, fn, o); cleanups.push(() => el.removeEventListener(ev, fn, o)); };\n const emit = (name, detail) => root.dispatchEvent(new CustomEvent(name, { detail, bubbles: true }));\n let destroyed = false;\n\n // Tracked timers/frames so teardown() can cancel anything the fling\n // choreography or the resize debounce has in flight (they mutate layout).\n const timers = new Set();\n const rafs = new Set();\n const later = (fn, ms) => { const id = setTimeout(() => { timers.delete(id); fn(); }, ms); timers.add(id); return id; };\n const frame = (fn) => { const id = requestAnimationFrame(() => { rafs.delete(id); fn(); }); rafs.add(id); return id; };\n\n /* ── Build own DOM (no page scaffold assumed) ── */\n root.classList.add('fg-root');\n root.setAttribute('data-fg-mode', mode);\n root.setAttribute('data-fg-peek', PEEK_MODES.has(opts.peek) ? opts.peek : 'hover');\n root.setAttribute('data-fg-drag', DRAG_MODES.has(opts.drag) ? opts.drag : 'fling');\n const scene = document.createElement('div');\n scene.className = 'fg-scene';\n scene.setAttribute('role', 'listbox');\n scene.setAttribute('aria-label', opts.label);\n scene.setAttribute('aria-roledescription', 'folder gallery');\n const dotsEl = document.createElement('div');\n dotsEl.className = 'fg-dots';\n dotsEl.setAttribute('role', 'tablist');\n const live = document.createElement('div');\n live.className = 'fg-sr-only';\n live.setAttribute('aria-live', 'polite');\n live.setAttribute('aria-atomic', 'true');\n root.append(scene, dotsEl, live);\n\n function teardown() {\n if (destroyed) return;\n destroyed = true;\n timers.forEach(clearTimeout); timers.clear();\n rafs.forEach(cancelAnimationFrame); rafs.clear();\n cleanups.forEach((fn) => fn());\n cleanups.length = 0;\n root.replaceChildren();\n root.classList.remove('fg-root');\n root.removeAttribute('data-fg-mode');\n root.removeAttribute('data-fg-peek');\n root.removeAttribute('data-fg-drag');\n INSTANCES.delete(root);\n }\n\n if (n === 0) {\n // Full no-op surface so an empty gallery matches the handle type: calling\n // any method (setColor, getItems, ...) is safe rather than a TypeError.\n const noop = () => {};\n INSTANCES.set(root, teardown);\n return {\n next: noop, prev: noop, goTo: noop, setMode: noop, setPeek: noop,\n setColor: noop, setGradient: noop,\n getActiveIndex: () => -1, getMode: () => mode,\n getPeek: () => root.getAttribute('data-fg-peek'),\n getColor: () => undefined, getGradient: () => undefined, getItems: () => [],\n destroy: teardown,\n };\n }\n\n /* ── Normalized transform - identical function list for every mode ── */\n function setCardTransform(card, { x, y, z, rx, ry, s, zIndex, opacity, isActive }) {\n /* A card mid-throw owns its own motion: layout updates its role\n (selection, stacking) but leaves transform and opacity to the fling,\n so the pile can shuffle immediately while the thrown folder finishes\n its flight. The fling handler relayouts it once it has faded out. */\n if (!card.classList.contains('fg-card--flung')) {\n card.style.transform = `translate3d(${x}px,${y}px,${z}px) rotateX(${rx}deg) rotateY(${ry}deg) scale(${s})`;\n card.style.opacity = String(opacity);\n }\n // transform-origin: center bottom is set once in CSS on .fg-card.\n card.style.zIndex = String(zIndex);\n card.setAttribute('aria-selected', isActive ? 'true' : 'false');\n card.classList.toggle('is-active', isActive);\n }\n\n /* ── Build cards ── */\n const cardEls = items.map((item, i) => {\n const card = document.createElement('div');\n card.className = 'fg-card';\n card.tabIndex = i === active ? 0 : -1; // roving tabindex\n card.setAttribute('role', 'option');\n card.setAttribute('aria-label', item.label || `Item ${i + 1}`);\n card.setAttribute('aria-setsize', String(n));\n card.setAttribute('aria-posinset', String(i + 1));\n card.setAttribute('data-fg-index', String(i)); // lets consumers target one folder in CSS/JS\n\n const svg = document.createElementNS(SVG_NS, 'svg');\n svg.setAttribute('class', 'fg-folder');\n svg.setAttribute('viewBox', '0 0 480 342');\n svg.setAttribute('preserveAspectRatio', 'none');\n svg.setAttribute('aria-hidden', 'true');\n const path = document.createElementNS(SVG_NS, 'path');\n path.setAttribute('d', opts.folderPath);\n path.setAttribute('fill', 'var(--fg-folder-bg)');\n svg.appendChild(path);\n\n card.appendChild(svg);\n\n renderContent(card, item, i);\n\n const front = document.createElement('div');\n front.className = 'fg-front';\n /* Decal: the photo prints on the folder's FRONT PANEL. The back and tab\n keep their color, so the folder stays a folder: colored tabs in the\n stack, a real material boundary at the front's lip. */\n if (item.decal) {\n card.classList.add('fg-card--decal');\n const photo = document.createElement('img');\n photo.className = 'fg-decal';\n photo.src = item.decal;\n photo.alt = '';\n photo.loading = 'lazy';\n photo.decoding = 'async';\n front.appendChild(photo);\n }\n if (item.label) {\n const label = document.createElement('div');\n label.className = 'fg-label';\n label.textContent = item.label;\n front.appendChild(label);\n }\n card.appendChild(front);\n\n // Palette + optional gradient front (both derive from item; paintFolder\n // needs the SVG path in place, so it runs after the folder is assembled).\n if (item.color) paintFolder(card, item.color);\n if (item.gradient) paintGradient(card, item.gradient);\n\n scene.appendChild(card);\n return card;\n });\n\n /* ── Dots ── */\n const dots = cardEls.map((_, i) => {\n const dot = document.createElement('button');\n dot.type = 'button';\n dot.className = 'fg-dot';\n dot.setAttribute('role', 'tab');\n dot.setAttribute('aria-label', items[i].label || `Go to ${i + 1}`);\n on(dot, 'click', () => goTo(i));\n dotsEl.appendChild(dot);\n return dot;\n });\n\n /* ── Layouts ── */\n // Grid renders each folder at its true cell width (not a full-scene card\n // scaled down), so absolute-unit content stays crisp and legible. Stack and\n // carousel use the full scene width, so they clear any grid width first.\n const clearGridWidth = (card) => { if (card.style.width) card.style.width = ''; };\n\n function layoutStack() {\n scene.style.height = '';\n cardEls.forEach((card, i) => {\n clearGridWidth(card);\n const behind = (i - active + n) % n;\n if (behind === 0) {\n setCardTransform(card, { x: 0, y: 100, z: 20, rx: 0, ry: 0, s: 1, zIndex: n + 1, opacity: 1, isActive: true });\n return;\n }\n const safeN = Math.max(n - 1, 1);\n const tz = -behind * 25 - behind * behind * 3;\n const rx = reduced ? 0 : -behind * 3;\n const ty = 100 - behind * 28 - behind * behind * 2;\n const sc = 1 - behind * 0.06 - (behind / safeN) * (behind / safeN) * 0.04;\n setCardTransform(card, { x: 0, y: ty, z: tz, rx, ry: 0, s: Math.max(sc, 0.5), zIndex: n - behind, opacity: 1 - behind * 0.08, isActive: false });\n });\n }\n function layoutGrid() {\n const sceneW = scene.clientWidth || MODE_WIDTHS.grid;\n const gap = Number.isFinite(opts.grid && opts.grid.gap) ? opts.grid.gap : 16;\n // A pinned column count wins; otherwise two columns on narrow scenes (so\n // folders stay tappable) or for small sets, three otherwise.\n const cols = Math.max(1, Math.round(\n opts.grid && opts.grid.columns ? opts.grid.columns : sceneW < 520 ? 2 : n <= 4 ? 2 : 3\n ));\n // Each card is sized to its cell and rendered at scale 1 (no shrink-to-blur),\n // so the folder art and any content inside read at their true size.\n const cellW = (sceneW - (cols - 1) * gap) / cols;\n const cellH = cellW * (2 / 3);\n const rows = Math.ceil(n / cols);\n cardEls.forEach((card, i) => {\n const col = i % cols;\n const row = Math.floor(i / cols);\n const itemsInRow = Math.min(cols, n - row * cols);\n const rowW = itemsInRow * cellW + (itemsInRow - 1) * gap;\n const rowStartX = (sceneW - rowW) / 2;\n const x = rowStartX + col * (cellW + gap);\n const y = row * (cellH + gap);\n card.style.width = cellW + 'px';\n setCardTransform(card, { x, y, z: 0, rx: 0, ry: 0, s: 1, zIndex: i === active ? 2 : 1, opacity: 1, isActive: i === active });\n });\n scene.style.height = rows * cellH + (rows - 1) * gap + 'px';\n }\n function layoutCarousel() {\n const sceneW = scene.clientWidth || MODE_WIDTHS.carousel;\n const cardW = sceneW;\n const cardH = cardW * (2 / 3);\n cardEls.forEach(clearGridWidth);\n const activeSc = 0.62;\n const activeW = cardW * activeSc;\n const sceneH = Math.max(cardH * activeSc + 40, 180);\n scene.style.height = sceneH + 'px';\n const offsetStep = Math.min(130, (sceneW - activeW) / 4);\n cardEls.forEach((card, i) => {\n let offset = i - active;\n if (n > 2 && offset > Math.floor(n / 2)) offset -= n;\n if (n > 2 && offset < -Math.floor(n / 2)) offset += n;\n const sc = Math.max(activeSc - Math.abs(offset) * 0.06, 0.28);\n const z = -Math.abs(offset) * 50;\n const op = Math.max(1 - Math.abs(offset) * 0.25, 0.15);\n const tx = sceneW / 2 + offset * offsetStep - cardW / 2;\n const ty = sceneH - 20 - cardH;\n setCardTransform(card, { x: tx, y: ty, z, rx: 0, ry: 0, s: sc, zIndex: n - Math.abs(offset), opacity: op, isActive: offset === 0 });\n });\n }\n // Scene width tracks the active mode so the layout math (which assumes the\n // mode's logical width) matches the actually-rendered card width. Layouts\n // then read scene.clientWidth, so everything stays self-consistent at any size.\n function sizeScene() {\n scene.style.width = `min(${MODE_WIDTHS[mode]}px, 92vw)`;\n }\n function applyLayout() {\n sizeScene();\n (mode === 'grid' ? layoutGrid : mode === 'carousel' ? layoutCarousel : layoutStack)();\n dots.forEach((d, i) => {\n d.classList.toggle('is-active', i === active);\n d.setAttribute('aria-selected', i === active ? 'true' : 'false');\n });\n cardEls.forEach((c, i) => { c.tabIndex = i === active ? 0 : -1; });\n const cur = items[active];\n live.textContent = cur && cur.label ? `${active + 1} of ${n}: ${cur.label}` : `${active + 1} of ${n}`;\n }\n\n /* ── Navigation ── */\n function goTo(i) {\n if (destroyed) return;\n // Coerce first: an unvalidated NaN/undefined would set active to NaN and\n // blank every card (translate3d(NaNpx,...)) plus emit index: NaN.\n const t = Number.isFinite(+i) ? Math.trunc(+i) : active;\n const next = opts.loop ? ((t % n) + n) % n : Math.min(Math.max(t, 0), n - 1);\n if (next === active) return;\n active = next;\n applyLayout();\n emit('fg-activechange', { index: active, item: items[active] });\n }\n function select(i) {\n if (destroyed) return;\n emit('fg-select', { index: i, item: items[i] });\n if (typeof opts.onSelect === 'function') opts.onSelect(items[i], i);\n }\n function setMode(m) {\n if (destroyed || m === mode || !MODE_WIDTHS[m]) return;\n mode = m;\n root.setAttribute('data-fg-mode', mode);\n applyLayout();\n emit('fg-modechange', { mode });\n }\n function setPeek(p) {\n if (destroyed || !PEEK_MODES.has(p) || p === root.getAttribute('data-fg-peek')) return;\n root.setAttribute('data-fg-peek', p);\n emit('fg-peekchange', { peek: p });\n }\n\n /* ── Interaction ── */\n const dragEnabled = opts.drag !== 'off';\n let suppressClick = false; // a real drag eats the click that follows pointerup\n\n cardEls.forEach((card, i) => {\n on(card, 'click', () => {\n if (suppressClick) { suppressClick = false; return; }\n i === active ? select(i) : goTo(i);\n });\n on(card, 'keydown', (e) => {\n if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); select(i); }\n });\n });\n /* Arrow keys work two ways, matching the reference implementation:\n 1. Focus already inside the gallery (Tab to a card/dot) - bubbles here\n and re-focuses the new active card, standard roving-tabindex UX.\n 2. Mouse hovering the gallery, focus anywhere else on the page - a\n document-level listener picks it up. Without this route, arrow\n keys only work AFTER a click puts focus on a card - and a click is\n also what fires onSelect, which in real use is often a link. Making\n keyboard nav depend on that first click means the only way to\n \"activate\" arrows is to risk navigating away. Hover is enough. */\n function handleArrowKeys(e) {\n if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { e.preventDefault(); goTo(active + 1); return true; }\n if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { e.preventDefault(); goTo(active - 1); return true; }\n if (e.key === 'Home') { e.preventDefault(); goTo(0); return true; }\n if (e.key === 'End') { e.preventDefault(); goTo(n - 1); return true; }\n return false;\n }\n on(scene, 'keydown', (e) => { if (handleArrowKeys(e)) cardEls[active].focus(); });\n on(dotsEl, 'keydown', (e) => { if (handleArrowKeys(e)) cardEls[active].focus(); });\n\n let hovered = false;\n on(root, 'mouseenter', () => { hovered = true; });\n on(root, 'mouseleave', () => { hovered = false; });\n on(document, 'keydown', (e) => {\n if (!hovered) return;\n // Don't hijack arrows if focus is on an interactive control outside\n // the gallery (nav link, a form field elsewhere on the page).\n const ae = document.activeElement;\n if (ae && ae !== document.body && !root.contains(ae)) return;\n handleArrowKeys(e); // no forced focus - the user hasn't tabbed in\n });\n\n if (opts.scrollNav) {\n /* Bound to root, not just the scene box: root is the widget's full\n footprint (scene + dots), so wheel events over the dots row or any\n gap the consumer's own layout leaves around the gallery still cycle\n it, instead of requiring the pointer over the exact folder art. */\n on(root, 'wheel', (e) => {\n if (mode === 'grid') return;\n const atStart = !opts.loop && active === 0 && e.deltaY < 0;\n const atEnd = !opts.loop && active === n - 1 && e.deltaY > 0;\n if (atStart || atEnd) return;\n e.preventDefault();\n if (scrollCooldown) return;\n scrollAccum += e.deltaY;\n if (Math.abs(scrollAccum) >= SCROLL_THRESHOLD) {\n const dir = scrollAccum > 0 ? 1 : -1;\n scrollAccum = 0;\n scrollCooldown = true;\n goTo(active + dir);\n later(() => { scrollCooldown = false; scrollAccum = 0; }, SCROLL_COOLDOWN[mode] || 300);\n }\n }, { passive: false });\n }\n\n /* Dominant-axis swipe: up or left advances, down or right goes back.\n Horizontal is the natural phone gesture in carousel; vertical matches\n the wheel direction on the stack. Both work everywhere. */\n let touchStartX = 0;\n let touchStartY = 0;\n on(scene, 'touchstart', (e) => {\n touchStartX = e.touches[0].clientX;\n touchStartY = e.touches[0].clientY;\n }, { passive: true });\n on(scene, 'touchend', (e) => {\n // In stack mode the pointer-based drag below owns the gesture; letting\n // both fire would advance twice per swipe.\n if (dragEnabled && mode === 'stack') return;\n const dx = touchStartX - e.changedTouches[0].clientX;\n const dy = touchStartY - e.changedTouches[0].clientY;\n const ax = Math.abs(dx);\n const ay = Math.abs(dy);\n if (Math.max(ax, ay) < 40) return;\n const dir = ax > ay ? (dx > 0 ? 1 : -1) : (dy > 0 ? 1 : -1);\n goTo(active + dir);\n }, { passive: true });\n\n /* ── Drag: grab the active folder and throw it (stack mode) ──\n Pointer Events give one code path for mouse, touch, and pen. The\n gesture constants come from the folder-deck prototype this feature is\n ported from: rotation follows the drag at 0.04deg/px, a release past\n 90px of travel (or a genuine throw, over 0.5px/ms) flings the folder\n off along the dominant axis and advances; anything shorter springs\n back into the pile on the card's own transition. Direction keeps the\n swipe semantics: left or up is next, right or down is previous. */\n if (dragEnabled) {\n const DRAG_ROT = 0.04;\n const FLING_DIST = 90;\n const FLING_VEL = 0.5;\n const TAP_SLOP = 6;\n let dragCard = null;\n let dragBase = '';\n let startPX = 0, startPY = 0, dragDX = 0, dragDY = 0;\n let lastX = 0, lastY = 0, lastT = 0, velX = 0, velY = 0;\n\n on(scene, 'pointerdown', (e) => {\n if (mode !== 'stack') return;\n if (e.button !== undefined && e.button !== 0) return;\n const card = e.target && e.target.closest ? e.target.closest('.fg-card') : null;\n if (!card || !card.classList.contains('is-active')) return;\n dragCard = card;\n dragBase = card.style.transform;\n startPX = e.clientX; startPY = e.clientY;\n dragDX = 0; dragDY = 0;\n lastX = e.clientX; lastY = e.clientY;\n lastT = (typeof performance !== 'undefined' ? performance.now() : Date.now());\n velX = 0; velY = 0;\n card.classList.add('fg-card--dragging');\n if (card.setPointerCapture && e.pointerId !== undefined) {\n try { card.setPointerCapture(e.pointerId); } catch (_) { /* jsdom / detached */ }\n }\n });\n on(window, 'pointermove', (e) => {\n if (!dragCard) return;\n dragDX = e.clientX - startPX;\n dragDY = e.clientY - startPY;\n const now = (typeof performance !== 'undefined' ? performance.now() : Date.now());\n const dt = Math.max(now - lastT, 1);\n velX = (e.clientX - lastX) / dt;\n velY = (e.clientY - lastY) / dt;\n lastX = e.clientX; lastY = e.clientY; lastT = now;\n // translateZ lifts the grabbed folder clear of every plane in the\n // pile (tilted tops can poke past the active card's resting depth)\n // and reads as physically picking it up.\n dragCard.style.transform = `${dragBase} translate3d(${dragDX}px, ${dragDY}px, 40px) rotate(${(dragDX * DRAG_ROT).toFixed(2)}deg)`;\n });\n const endDrag = () => {\n if (!dragCard) return;\n const card = dragCard;\n dragCard = null;\n card.classList.remove('fg-card--dragging');\n const dist = Math.hypot(dragDX, dragDY);\n if (dist < TAP_SLOP) { card.style.transform = dragBase; return; } // a tap: the click handler owns it\n suppressClick = true;\n const horizontal = Math.abs(dragDX) >= Math.abs(dragDY);\n const flung = dist > FLING_DIST || Math.hypot(velX, velY) > FLING_VEL;\n const dir = horizontal ? (dragDX > 0 ? -1 : 1) : (dragDY > 0 ? -1 : 1);\n const target = active + dir;\n const blocked = !opts.loop && (target < 0 || target > n - 1);\n if (!flung || blocked) { card.style.transform = dragBase; return; } // spring back into the pile\n const semantic = dir > 0 ? 'next' : 'prev';\n emit('fg-flingstart', { index: active, direction: semantic });\n if (reduced) { goTo(target); emit('fg-flingend', { index: target, direction: semantic }); return; }\n const offX = horizontal ? Math.sign(dragDX) * Math.max(window.innerWidth * 0.7, 480) : dragDX * 3;\n const offY = horizontal ? dragDY * 3 : Math.sign(dragDY) * Math.max(window.innerHeight * 0.7, 480);\n /* Choreography: the pile answers the throw IMMEDIATELY (goTo below;\n layout skips the flung card), while the thrown folder finishes its\n own flight - a longer, momentum-eased sail that fades over 340ms.\n Once it is fully invisible, it re-enters by DROPPING IN from above\n its new slot: never straight from off-screen, which would cross\n the other folders' 3D planes and slice them visibly. */\n card.classList.add('fg-card--flung');\n card.style.transform = `${dragBase} translate3d(${offX}px, ${offY}px, 40px) rotate(${Math.sign(dragDX || 1) * 18}deg)`;\n card.style.opacity = '0';\n goTo(target); // shuffle starts now; the flung card is exempt from this relayout\n later(() => {\n card.classList.add('fg-card--snap');\n card.classList.remove('fg-card--flung');\n applyLayout(); // now it takes its slot transform (invisible, transitions off)\n const slot = card.style.transform;\n const slotOpacity = card.style.opacity;\n card.style.transform = `${slot} translate3d(0, -90px, 0)`;\n card.style.opacity = '0';\n /* Phase boundary via double rAF, NOT a synchronous reflow flush:\n WebKit does not treat forced reflows as transition boundaries and\n will compute the transition from the last PAINTED state (the\n fling-off position), which flashes the card across the pile.\n Painting one real frame at the staging point (invisible,\n transitions off) gives every engine the same before-state. */\n frame(() => frame(() => {\n card.classList.remove('fg-card--snap');\n card.classList.add('fg-card--entering'); // quicker settle curve for the drop\n card.style.transform = slot; // descend into the pile\n card.style.opacity = slotOpacity;\n later(() => {\n card.classList.remove('fg-card--entering');\n emit('fg-flingend', { index: target, direction: semantic });\n }, 700);\n }));\n }, 400); // after the 340ms flung fade, with margin: never snap a visible card\n };\n on(window, 'pointerup', endDrag);\n on(window, 'pointercancel', endDrag);\n }\n\n let resizeTimer;\n on(window, 'resize', () => { clearTimeout(resizeTimer); resizeTimer = later(applyLayout, 150); });\n\n // Keep `reduced` in sync if the OS setting changes while mounted (the CSS\n // updates live; this re-runs the JS motion branches to match).\n if (reducedQuery && reducedQuery.addEventListener) {\n on(reducedQuery, 'change', (e) => { if (!destroyed) { reduced = e.matches; applyLayout(); } });\n }\n\n applyLayout();\n\n /* ── Public handle ── */\n const handle = {\n next: () => goTo(active + 1),\n prev: () => goTo(active - 1),\n goTo,\n setMode,\n setPeek,\n setColor: (i, hex) => { const card = cardEls[i]; if (card && !destroyed) paintFolder(card, hex); },\n setGradient: (i, gradient) => { const card = cardEls[i]; if (card && !destroyed) paintGradient(card, gradient); },\n getActiveIndex: () => active,\n getMode: () => mode,\n getPeek: () => root.getAttribute('data-fg-peek'),\n getColor: (i) => { const card = cardEls[i]; return card ? card.style.getPropertyValue('--fg-folder-bg') || undefined : undefined; },\n getGradient: (i) => {\n const layer = cardEls[i] && cardEls[i].querySelector('.fg-gradient');\n return layer ? layer.style.background || undefined : undefined;\n },\n getItems: () => items.slice(),\n destroy: teardown,\n };\n INSTANCES.set(root, teardown);\n return handle;\n}\n\nexport default createFolderGallery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACiBA,IAAM,SAAS;AAGf,IAAM,sBACJ;AAkBF,IAAM,WAAW;AAAA,EACf,MAAM;AAAA;AAAA,EACN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,WAAW;AAAA,EACX,eAAe;AAAA;AAAA,EACf,MAAM;AAAA;AAAA,EACN,MAAM;AAAA;AAAA,EACN,oBAAoB;AAAA,EACpB,OAAO;AACT;AAEA,IAAM,aAAa,oBAAI,IAAI,CAAC,SAAS,UAAU,KAAK,CAAC;AACrD,IAAM,aAAa,oBAAI,IAAI,CAAC,SAAS,KAAK,CAAC;AAK3C,IAAM,YAAY,oBAAI,QAAQ;AAE9B,IAAM,cAAc,EAAE,OAAO,KAAK,MAAM,KAAK,UAAU,IAAI;AAC3D,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AA,EAAG;AACnE;AAEO,SAAS,oBAAoB,MAAM,kBAAkB;AAC1D,MAAI,OAAO,mBAAmB,eAAe,CAAC,eAAe,IAAI,GAAG,GAAG;AACrE,mBAAe,OAAO,KAAK,oBAAoB;AAAA,EACjD;AACA,SAAO;AACT;AAEA,IAAO,iCAAQ;","names":[]}
package/dist/element.d.ts CHANGED
@@ -9,8 +9,14 @@ export declare class FolderGalleryElement extends HTMLElement {
9
9
  goTo(index: number): void;
10
10
  setMode(mode: GalleryMode): void;
11
11
  setPeek(peek: PeekMode): void;
12
+ setColor(index: number, hex: string): void;
13
+ setGradient(index: number, gradient: string | null): void;
12
14
  getActiveIndex(): number;
13
15
  getMode(): GalleryMode;
16
+ getPeek(): PeekMode;
17
+ getColor(index: number): string | undefined;
18
+ getGradient(index: number): string | undefined;
19
+ getItems(): FolderItem[];
14
20
  }
15
21
 
16
22
  /** Registers the <folder-gallery> custom element (default tag: 'folder-gallery'). */
package/dist/element.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createFolderGallery
3
- } from "./chunk-DT6YOBGV.js";
3
+ } from "./chunk-RFBZ3WPG.js";
4
4
 
5
5
  // src/folder-gallery-element.js
6
6
  var asBool = (v) => v !== null && v !== "false";
@@ -8,7 +8,7 @@ var ElementBase = typeof HTMLElement !== "undefined" ? HTMLElement : class {
8
8
  };
9
9
  var FolderGalleryElement = class extends ElementBase {
10
10
  static get observedAttributes() {
11
- return ["mode", "peek", "loop", "scroll-nav", "reduced-motion", "default-active-index", "label", "folder-path"];
11
+ return ["mode", "peek", "drag", "loop", "scroll-nav", "reduced-motion", "default-active-index", "label", "folder-path"];
12
12
  }
13
13
  constructor() {
14
14
  super();
@@ -51,6 +51,7 @@ var FolderGalleryElement = class extends ElementBase {
51
51
  const opts = { items: this._items };
52
52
  if (this.hasAttribute("mode")) opts.mode = this.getAttribute("mode");
53
53
  if (this.hasAttribute("peek")) opts.peek = this.getAttribute("peek");
54
+ if (this.hasAttribute("drag")) opts.drag = this.getAttribute("drag");
54
55
  if (this.hasAttribute("loop")) opts.loop = asBool(this.getAttribute("loop"));
55
56
  if (this.hasAttribute("scroll-nav")) opts.scrollNav = asBool(this.getAttribute("scroll-nav"));
56
57
  if (this.hasAttribute("reduced-motion")) opts.reducedMotion = this.getAttribute("reduced-motion");
@@ -87,12 +88,30 @@ var FolderGalleryElement = class extends ElementBase {
87
88
  setPeek(p) {
88
89
  this.setAttribute("peek", p);
89
90
  }
91
+ setColor(i, hex) {
92
+ this._handle && this._handle.setColor(i, hex);
93
+ }
94
+ setGradient(i, gradient) {
95
+ this._handle && this._handle.setGradient(i, gradient);
96
+ }
90
97
  getActiveIndex() {
91
98
  return this._handle ? this._handle.getActiveIndex() : -1;
92
99
  }
93
100
  getMode() {
94
101
  return this._handle ? this._handle.getMode() : this.getAttribute("mode") || "stack";
95
102
  }
103
+ getPeek() {
104
+ return this._handle ? this._handle.getPeek() : this.getAttribute("peek") || "hover";
105
+ }
106
+ getColor(i) {
107
+ return this._handle ? this._handle.getColor(i) : void 0;
108
+ }
109
+ getGradient(i) {
110
+ return this._handle ? this._handle.getGradient(i) : void 0;
111
+ }
112
+ getItems() {
113
+ return this._handle ? this._handle.getItems() : [];
114
+ }
96
115
  };
97
116
  function defineFolderGallery(tag = "folder-gallery") {
98
117
  if (typeof customElements !== "undefined" && !customElements.get(tag)) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/folder-gallery-element.js"],"sourcesContent":["/* ============================================================================\n * <folder-gallery> - Custom Element wrapper around the framework-agnostic core.\n *\n * import { defineFolderGallery } from 'folder-gallery/element';\n * defineFolderGallery(); // registers <folder-gallery>\n *\n * <folder-gallery mode=\"grid\"></folder-gallery>\n * el.items = [{ label, color, src }, ...]; // set items via property\n * el.addEventListener('fg-select', e => ...); // events bubble from the core\n *\n * Uses the element itself as the light-DOM root, so the shared\n * folder-gallery.css styles it. (Shadow-DOM encapsulation is a later option.)\n * ========================================================================== */\n\nimport { createFolderGallery } from './folder-gallery.js';\n\nconst asBool = (v) => v !== null && v !== 'false';\n\n// SSR-safe base: on a server (Next/Nuxt) there is no HTMLElement, and merely\n// evaluating `class extends HTMLElement` at import time would throw. Fall back\n// to a stub there; the real element is only ever registered in the browser via\n// defineFolderGallery (guarded on customElements below).\nconst ElementBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {};\n\nexport class FolderGalleryElement extends ElementBase {\n static get observedAttributes() {\n return ['mode', 'peek', 'loop', 'scroll-nav', 'reduced-motion', 'default-active-index', 'label', 'folder-path'];\n }\n\n constructor() {\n super();\n this._handle = null;\n this._items = [];\n }\n\n /** Items are an array - set via property (attributes can't hold objects). */\n get items() { return this._items; }\n set items(value) {\n this._items = Array.isArray(value) ? value : [];\n if (this.isConnected) this._render();\n }\n\n connectedCallback() {\n // Optional declarative items via a JSON `items` attribute.\n if (!this._items.length && this.getAttribute('items')) {\n try { this._items = JSON.parse(this.getAttribute('items')); } catch (_) { /* ignore malformed */ }\n }\n this._render();\n }\n\n disconnectedCallback() { this._destroy(); }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (!this._handle) return;\n if (name === 'mode') { this._handle.setMode(newValue); return; }\n if (name === 'peek') { this._handle.setPeek(newValue); return; }\n this._render(); // any other observed attribute → rebuild\n }\n\n _options() {\n const opts = { items: this._items };\n if (this.hasAttribute('mode')) opts.mode = this.getAttribute('mode');\n if (this.hasAttribute('peek')) opts.peek = this.getAttribute('peek');\n if (this.hasAttribute('loop')) opts.loop = asBool(this.getAttribute('loop'));\n if (this.hasAttribute('scroll-nav')) opts.scrollNav = asBool(this.getAttribute('scroll-nav'));\n if (this.hasAttribute('reduced-motion')) opts.reducedMotion = this.getAttribute('reduced-motion');\n if (this.hasAttribute('default-active-index')) opts.defaultActiveIndex = parseInt(this.getAttribute('default-active-index'), 10) || 0;\n if (this.hasAttribute('label')) opts.label = this.getAttribute('label');\n if (this.hasAttribute('folder-path')) opts.folderPath = this.getAttribute('folder-path');\n if (typeof this.contentRenderer === 'function') opts.contentRenderer = this.contentRenderer;\n if (typeof this.onSelect === 'function') opts.onSelect = this.onSelect;\n return opts;\n }\n\n _render() {\n this._destroy();\n this._handle = createFolderGallery(this, this._options());\n }\n _destroy() {\n if (this._handle) { this._handle.destroy(); this._handle = null; }\n }\n\n /* Imperative API - delegate to the core handle. */\n next() { this._handle && this._handle.next(); }\n prev() { this._handle && this._handle.prev(); }\n goTo(i) { this._handle && this._handle.goTo(i); }\n setMode(m) { this.setAttribute('mode', m); }\n setPeek(p) { this.setAttribute('peek', p); }\n getActiveIndex() { return this._handle ? this._handle.getActiveIndex() : -1; }\n getMode() { return this._handle ? this._handle.getMode() : (this.getAttribute('mode') || 'stack'); }\n}\n\nexport function defineFolderGallery(tag = 'folder-gallery') {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, FolderGalleryElement);\n }\n return FolderGalleryElement;\n}\n\nexport default FolderGalleryElement;\n"],"mappings":";;;;;AAgBA,IAAM,SAAS,CAAC,MAAM,MAAM,QAAQ,MAAM;AAM1C,IAAM,cAAc,OAAO,gBAAgB,cAAc,cAAc,MAAM;AAAC;AAEvE,IAAM,uBAAN,cAAmC,YAAY;AAAA,EACpD,WAAW,qBAAqB;AAC9B,WAAO,CAAC,QAAQ,QAAQ,QAAQ,cAAc,kBAAkB,wBAAwB,SAAS,aAAa;AAAA,EAChH;AAAA,EAEA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AACf,SAAK,SAAS,CAAC;AAAA,EACjB;AAAA;AAAA,EAGA,IAAI,QAAQ;AAAE,WAAO,KAAK;AAAA,EAAQ;AAAA,EAClC,IAAI,MAAM,OAAO;AACf,SAAK,SAAS,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;AAC9C,QAAI,KAAK,YAAa,MAAK,QAAQ;AAAA,EACrC;AAAA,EAEA,oBAAoB;AAElB,QAAI,CAAC,KAAK,OAAO,UAAU,KAAK,aAAa,OAAO,GAAG;AACrD,UAAI;AAAE,aAAK,SA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UAAU;AACR,SAAK,SAAS;AACd,SAAK,UAAU,oBAAoB,MAAM,KAAK,SAAS,CAAC;AAAA,EAC1D;AAAA,EACA,WAAW;AACT,QAAI,KAAK,SAAS;AAAE,WAAK,QAAQ,QAAQ;AAAG,WAAK,UAAU;AAAA,IAAM;AAAA,EACnE;AAAA;AAAA,EAGA,OAAO;AAAE,SAAK,WAAW,KAAK,QAAQ,KAAK;AAAA,EAAG;AAAA,EAC9C,OAAO;AAAE,SAAK,WAAW,KAAK,QAAQ,KAAK;AAAA,EAAG;AAAA,EAC9C,KAAK,GAAG;AAAE,SAAK,WAAW,KAAK,QAAQ,KAAK,CAAC;AAAA,EAAG;AAAA,EAChD,QAAQ,GAAG;AAAE,SAAK,aAAa,QAAQ,CAAC;AAAA,EAAG;AAAA,EAC3C,QAAQ,GAAG;AAAE,SAAK,aAAa,QAAQ,CAAC;AAAA,EAAG;AAAA,EAC3C,iBAAiB;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,eAAe,IAAI;AAAA,EAAI;AAAA,EAC7E,UAAU;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,QAAQ,IAAK,KAAK,aAAa,MAAM,KAAK;AAAA,EAAU;AACrG;AAEO,SAAS,oBAAoB,MAAM,kBAAkB;AAC1D,MAAI,OAAO,mBAAmB,eAAe,CAAC,eAAe,IAAI,GAAG,GAAG;AACrE,mBAAe,OAAO,KAAK,oBAAoB;AAAA,EACjD;AACA,SAAO;AACT;AAEA,IAAO,iCAAQ;","names":[]}
1
+ {"version":3,"sources":["../src/folder-gallery-element.js"],"sourcesContent":["/* ============================================================================\n * <folder-gallery> - Custom Element wrapper around the framework-agnostic core.\n *\n * import { defineFolderGallery } from 'folder-gallery/element';\n * defineFolderGallery(); // registers <folder-gallery>\n *\n * <folder-gallery mode=\"grid\"></folder-gallery>\n * el.items = [{ label, color, src }, ...]; // set items via property\n * el.addEventListener('fg-select', e => ...); // events bubble from the core\n *\n * Uses the element itself as the light-DOM root, so the shared\n * folder-gallery.css styles it. (Shadow-DOM encapsulation is a later option.)\n * ========================================================================== */\n\nimport { createFolderGallery } from './folder-gallery.js';\n\nconst asBool = (v) => v !== null && v !== 'false';\n\n// SSR-safe base: on a server (Next/Nuxt) there is no HTMLElement, and merely\n// evaluating `class extends HTMLElement` at import time would throw. Fall back\n// to a stub there; the real element is only ever registered in the browser via\n// defineFolderGallery (guarded on customElements below).\nconst ElementBase = typeof HTMLElement !== 'undefined' ? HTMLElement : class {};\n\nexport class FolderGalleryElement extends ElementBase {\n static get observedAttributes() {\n return ['mode', 'peek', 'drag', 'loop', 'scroll-nav', 'reduced-motion', 'default-active-index', 'label', 'folder-path'];\n }\n\n constructor() {\n super();\n this._handle = null;\n this._items = [];\n }\n\n /** Items are an array - set via property (attributes can't hold objects). */\n get items() { return this._items; }\n set items(value) {\n this._items = Array.isArray(value) ? value : [];\n if (this.isConnected) this._render();\n }\n\n connectedCallback() {\n // Optional declarative items via a JSON `items` attribute.\n if (!this._items.length && this.getAttribute('items')) {\n try { this._items = JSON.parse(this.getAttribute('items')); } catch (_) { /* ignore malformed */ }\n }\n this._render();\n }\n\n disconnectedCallback() { this._destroy(); }\n\n attributeChangedCallback(name, _oldValue, newValue) {\n if (!this._handle) return;\n if (name === 'mode') { this._handle.setMode(newValue); return; }\n if (name === 'peek') { this._handle.setPeek(newValue); return; }\n this._render(); // any other observed attribute → rebuild\n }\n\n _options() {\n const opts = { items: this._items };\n if (this.hasAttribute('mode')) opts.mode = this.getAttribute('mode');\n if (this.hasAttribute('peek')) opts.peek = this.getAttribute('peek');\n if (this.hasAttribute('drag')) opts.drag = this.getAttribute('drag');\n if (this.hasAttribute('loop')) opts.loop = asBool(this.getAttribute('loop'));\n if (this.hasAttribute('scroll-nav')) opts.scrollNav = asBool(this.getAttribute('scroll-nav'));\n if (this.hasAttribute('reduced-motion')) opts.reducedMotion = this.getAttribute('reduced-motion');\n if (this.hasAttribute('default-active-index')) opts.defaultActiveIndex = parseInt(this.getAttribute('default-active-index'), 10) || 0;\n if (this.hasAttribute('label')) opts.label = this.getAttribute('label');\n if (this.hasAttribute('folder-path')) opts.folderPath = this.getAttribute('folder-path');\n if (typeof this.contentRenderer === 'function') opts.contentRenderer = this.contentRenderer;\n if (typeof this.onSelect === 'function') opts.onSelect = this.onSelect;\n return opts;\n }\n\n _render() {\n this._destroy();\n this._handle = createFolderGallery(this, this._options());\n }\n _destroy() {\n if (this._handle) { this._handle.destroy(); this._handle = null; }\n }\n\n /* Imperative API - delegate to the core handle. */\n next() { this._handle && this._handle.next(); }\n prev() { this._handle && this._handle.prev(); }\n goTo(i) { this._handle && this._handle.goTo(i); }\n setMode(m) { this.setAttribute('mode', m); }\n setPeek(p) { this.setAttribute('peek', p); }\n setColor(i, hex) { this._handle && this._handle.setColor(i, hex); }\n setGradient(i, gradient) { this._handle && this._handle.setGradient(i, gradient); }\n getActiveIndex() { return this._handle ? this._handle.getActiveIndex() : -1; }\n getMode() { return this._handle ? this._handle.getMode() : (this.getAttribute('mode') || 'stack'); }\n getPeek() { return this._handle ? this._handle.getPeek() : (this.getAttribute('peek') || 'hover'); }\n getColor(i) { return this._handle ? this._handle.getColor(i) : undefined; }\n getGradient(i) { return this._handle ? this._handle.getGradient(i) : undefined; }\n getItems() { return this._handle ? this._handle.getItems() : []; }\n}\n\nexport function defineFolderGallery(tag = 'folder-gallery') {\n if (typeof customElements !== 'undefined' && !customElements.get(tag)) {\n customElements.define(tag, FolderGalleryElement);\n }\n return FolderGalleryElement;\n}\n\nexport default FolderGalleryElement;\n"],"mappings":";;;;;AAgBA,IAAM,SAAS,CAAC,MAAM,MAAM,QAAQ,MAAM;AAM1C,IAAM,cAAc,OAAO,gBAAgB,cAAc,cAAc,MAAM;AAAC;AAEvE,IAAM,uBAAN,cAAmC,YAAY;AAAA,EACpD,WAAW,qBAAqB;AAC9B,WAAO,CAAC,QAAQ,QAAQ,QAAQ,QAAQ,cAAc,kBAAkB,wBAAwB,SAAS,aAAa;AAAA,EACxH;A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AAU,KAAK,QAAQ,eAAe,IAAI;AAAA,EAAI;AAAA,EAC7E,UAAU;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,QAAQ,IAAK,KAAK,aAAa,MAAM,KAAK;AAAA,EAAU;AAAA,EACnG,UAAU;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,QAAQ,IAAK,KAAK,aAAa,MAAM,KAAK;AAAA,EAAU;AAAA,EACnG,SAAS,GAAG;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,SAAS,CAAC,IAAI;AAAA,EAAW;AAAA,EAC1E,YAAY,GAAG;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,YAAY,CAAC,IAAI;AAAA,EAAW;AAAA,EAChF,WAAW;AAAE,WAAO,KAAK,UAAU,KAAK,QAAQ,SAAS,IAAI,CAAC;AAAA,EAAG;AACnE;AAEO,SAAS,oBAAoB,MAAM,kBAAkB;AAC1D,MAAI,OAAO,mBAAmB,eAAe,CAAC,eAAe,IAAI,GAAG,GAAG;AACrE,mBAAe,OAAO,KAAK,oBAAoB;AAAA,EACjD;AACA,SAAO;AACT;AAEA,IAAO,iCAAQ;","names":[]}
@@ -1,4 +1,4 @@
1
- /* folder-gallery - default stylesheet (v0.1.0, WIP)
1
+ /* flipfolio - default stylesheet
2
2
  * Themeable via the custom properties on .fg-root. Light and dark are both
3
3
  * first-class: `prefers-color-scheme` picks the default, and an explicit
4
4
  * `data-fg-theme="light" | "dark"` on .fg-root always wins.
@@ -12,6 +12,14 @@
12
12
  --fg-transition-transform: 700ms;
13
13
  --fg-transition-fade: 300ms;
14
14
  --fg-active-blur: 12px;
15
+ --fg-scene-height: 440px; /* stack canvas height; grid/carousel size in JS */
16
+ --fg-gap: 1rem; /* space between the scene and the dots row */
17
+ /* label typography */
18
+ --fg-label-size: 0.95rem;
19
+ --fg-label-weight: 600;
20
+ --fg-label-tracking: 0.01em;
21
+ /* gradient front strength (item.gradient / setGradient) */
22
+ --fg-gradient-opacity: 0.6;
15
23
 
16
24
  /* ── surface tokens (LIGHT is the base; dark overrides below) ──
17
25
  --fg-front / --fg-front-solid are normally set PER CARD by the engine,
@@ -23,6 +31,7 @@
23
31
  --fg-dot: #8a8a86;
24
32
  --fg-dot-active: #1c1c1a;
25
33
  --fg-shadow: 0 12px 32px rgba(30, 30, 30, 0.16), 0 4px 12px rgba(30, 30, 30, 0.08);
34
+ --fg-folder-shadow: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.22));
26
35
  --fg-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.35);
27
36
  --fg-inset-highlight-active: inset 0 1px 0 rgba(255, 255, 255, 0.45);
28
37
  /* peek: how far contents slide out of the folder */
@@ -32,11 +41,14 @@
32
41
  display: flex;
33
42
  flex-direction: column;
34
43
  align-items: center;
35
- gap: 1rem;
44
+ gap: var(--fg-gap);
36
45
  }
37
46
 
47
+ /* Dark is the default only when the media query says so AND light isn't forced.
48
+ Scoping with :not([data-fg-theme='light']) lets the one dark block below
49
+ serve both "OS dark" and "forced dark", so no light block needs repeating. */
38
50
  @media (prefers-color-scheme: dark) {
39
- .fg-root {
51
+ .fg-root:not([data-fg-theme='light']) {
40
52
  --fg-folder-bg: #2a3a3a;
41
53
  --fg-front: rgba(90, 90, 90, 0.55);
42
54
  --fg-front-solid: rgb(115, 115, 115);
@@ -48,18 +60,7 @@
48
60
  --fg-inset-highlight-active: inset 0 1px 0 rgba(255, 255, 255, 0.15);
49
61
  }
50
62
  }
51
- /* Explicit theme attribute beats the media query in BOTH directions. */
52
- .fg-root[data-fg-theme='light'] {
53
- --fg-folder-bg: #e8c96a;
54
- --fg-front: rgba(255, 255, 255, 0.55);
55
- --fg-front-solid: rgb(240, 236, 224);
56
- --fg-label: #1c1c1a;
57
- --fg-dot: #8a8a86;
58
- --fg-dot-active: #1c1c1a;
59
- --fg-shadow: 0 12px 32px rgba(30, 30, 30, 0.16), 0 4px 12px rgba(30, 30, 30, 0.08);
60
- --fg-inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.35);
61
- --fg-inset-highlight-active: inset 0 1px 0 rgba(255, 255, 255, 0.45);
62
- }
63
+ /* Forced dark, regardless of OS preference. */
63
64
  .fg-root[data-fg-theme='dark'] {
64
65
  --fg-folder-bg: #2a3a3a;
65
66
  --fg-front: rgba(90, 90, 90, 0.55);
@@ -75,7 +76,7 @@
75
76
  .fg-scene {
76
77
  position: relative;
77
78
  width: min(480px, 92vw); /* JS overrides per mode; this is the stack default */
78
- height: 440px;
79
+ height: var(--fg-scene-height, 440px); /* stack default; grid/carousel set it in JS */
79
80
  perspective: var(--fg-perspective);
80
81
  transform-style: preserve-3d;
81
82
  }
@@ -98,6 +99,38 @@
98
99
  outline: none;
99
100
  }
100
101
  .fg-card.is-active { cursor: default; }
102
+
103
+ /* ── drag: grab the active folder and throw it (stack mode) ── */
104
+ [data-fg-drag='fling'][data-fg-mode='stack'] .fg-card.is-active {
105
+ cursor: grab;
106
+ /* the gesture owns the pointer; without this, touch drags scroll the page */
107
+ touch-action: none;
108
+ }
109
+ .fg-card--dragging,
110
+ [data-fg-drag='fling'][data-fg-mode='stack'] .fg-card--dragging {
111
+ transition: none;
112
+ cursor: grabbing;
113
+ }
114
+ /* One-frame teleport for a thrown folder rejoining the back of the pile
115
+ (see the fling handler): transitioning that move would slide the card
116
+ through the other folders' planes. */
117
+ .fg-card--snap { transition: none; }
118
+ /* While flying off, the fade must FINISH before the relayout snaps the
119
+ card to its staging point: snapping a still-visible card mid-flight
120
+ reads as a flicker. Opacity completes inside the 400ms timer; the
121
+ transform launches hard and glides (a throw keeps its momentum). */
122
+ .fg-card--flung {
123
+ transition:
124
+ transform 560ms cubic-bezier(0.16, 1, 0.3, 1),
125
+ opacity 340ms ease-out;
126
+ }
127
+ /* Dropping back into the pile: a quicker, softer settle than the default
128
+ 700ms shuffle, so the landing reads as its own beat. */
129
+ .fg-card--entering {
130
+ transition:
131
+ transform 620ms cubic-bezier(0.16, 1, 0.3, 1),
132
+ opacity 320ms ease-out;
133
+ }
101
134
  .fg-card:focus-visible {
102
135
  outline: 2px solid var(--fg-dot-active);
103
136
  outline-offset: 4px;
@@ -109,7 +142,7 @@
109
142
  inset: 0;
110
143
  width: 100%;
111
144
  height: 100%;
112
- filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.22));
145
+ filter: var(--fg-folder-shadow, drop-shadow(0 8px 24px rgba(0, 0, 0, 0.22)));
113
146
  }
114
147
 
115
148
  .fg-content {
@@ -183,10 +216,6 @@
183
216
  box-shadow: var(--fg-shadow), var(--fg-inset-highlight-active);
184
217
  }
185
218
 
186
- /* ── decal: the folder is skinned with an image (item.decal) ──
187
- The image is clipped to the silhouette inside the SVG; the front panel
188
- becomes a label scrim so the photo shows through and the label stays
189
- readable. Overrides both the solid and frosted front treatments. */
190
219
  /* ── decal: the photo prints on the folder's front panel ──
191
220
  The back and tab keep their color, so the stack still reads as folders.
192
221
  The print carries its own lighting: a lip hairline where the front edge
@@ -223,14 +252,27 @@
223
252
  }
224
253
  .fg-card--decal .fg-label { color: #ffffff; position: relative; z-index: 1; }
225
254
 
255
+ /* ── gradient front: item.gradient (or setGradient) paints a CSS gradient
256
+ across the front panel, over the frosted/solid surface but under the label
257
+ and any peek contents. The frosted backdrop-filter still reads through. ── */
258
+ .fg-gradient {
259
+ position: absolute;
260
+ inset: 0;
261
+ z-index: 0;
262
+ border-radius: inherit;
263
+ opacity: var(--fg-gradient-opacity, 0.6);
264
+ pointer-events: none;
265
+ }
266
+ .fg-card--gradient .fg-label { position: relative; z-index: 1; }
267
+
226
268
  .fg-label {
227
269
  /* Falls back to the theme label color when the card has no item.color;
228
270
  otherwise the engine sets --fg-label-on-color per card so the label
229
271
  stays readable against that folder's own front-panel brightness. */
230
272
  color: var(--fg-label-on-color, var(--fg-label));
231
- font-weight: 600;
232
- font-size: 0.95rem;
233
- letter-spacing: 0.01em;
273
+ font-weight: var(--fg-label-weight, 600);
274
+ font-size: var(--fg-label-size, 0.95rem);
275
+ letter-spacing: var(--fg-label-tracking, 0.01em);
234
276
  }
235
277
 
236
278
  .fg-dots { display: flex; gap: 0.5rem; }