moey-ui 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.
@@ -51,7 +51,7 @@ Moey is a mobile-first CSS + JS framework: one stylesheet (`moey.css`), one scri
51
51
 
52
52
  ## Helpers
53
53
 
54
- `stack` (column, gap 16px) · `hstack` (row, centered, gap 12px) · `cluster` (wrapping row) · `spacer` (pushes the rest away) · `stretched-link` (whole card clickable) · `hover-lift` · `focus-ring` · `icon-link icon-link-hover` · `sticky-top fixed-bottom` · `rtl-flip` (mirror an arrow icon in RTL)
54
+ `stack` (column, gap 16px) · `hstack` (row, centered, gap 12px) · `cluster` (wrapping row) · `spacer` (pushes the rest away) · `stretched-link` (whole card clickable) · `hover-lift` · `frosted` (frosted glass on a bar: tab bar, app header, sticky form buttons; bars are only slightly see-through by default, `--mo-glass`) · `focus-ring` · `icon-link icon-link-hover` · `sticky-top fixed-bottom` · `rtl-flip` (mirror an arrow icon in RTL)
55
55
 
56
56
  ## Layout
57
57
 
@@ -120,7 +120,7 @@ Stat tile: `<div class="card"><div class="card-body stat"><span class="stat-labe
120
120
  ```
121
121
  Form layouts: `form-stack` · `form-inline` · `form-section` (+`form-section-header`, `form-section-body`) · `form-actions`. `<form data-moey-dirty>` tracks unsaved changes.
122
122
 
123
- **Dialog / sheet / drawer** (native `<dialog>`; on phones a dialog becomes a bottom sheet)
123
+ **Dialog / sheet / drawer** (native `<dialog>`; on phones a dialog becomes a bottom sheet: `.dialog-center` keeps it centered, `.dialog-fullscreen-phone` covers the screen instead; page-wide colors: `--mo-dialog-bg` / `--mo-dialog-fg` on `:root`)
124
124
  ```html
125
125
  <button class="btn" data-moey-open="#invite">Invite</button>
126
126
  <dialog class="dialog" id="invite" aria-labelledby="invite-title">
@@ -194,15 +194,15 @@ On phones (below 1024px, or 768px with `navbar-expand-md`; `navbar-expand` never
194
194
 
195
195
  **Data table, more**: `data-moey-virtual` / `virtual: true` for thousands of rows; `detail: (row) => html` or `<template data-moey-detail>` for expandable rows; `children: [...]` or `<tr data-parent="id">` for tree rows; `groupBy: 'status'` / `data-moey-group-by` with `sum: true` / `data-moey-sum` for grouped rows. Never put a table inside a table cell.
196
196
 
197
- **Masonry**: `<div class="masonry grid-cols-2 md:grid-cols-4 gap-3" data-moey-masonry>…items…</div>` (images need width/height); `span-2` wide items, `.masonry-dense` fills holes, add `data-moey-sortable` to rearrange. `.gallery-tile` + `.gallery-caption` for picture tiles.
197
+ **Griddy** (items of different heights packed into columns): `<div class="griddy grid-cols-2 md:grid-cols-4 gap-3" data-moey-griddy>…items…</div>` (images need width/height); `span-2` wide items, `.griddy-dense` fills holes, `.griddy-glide` makes items glide when the layout changes, add `data-moey-sortable` to rearrange. `data-moey-enter="pop|rise|drop|fade|zoom|slide|flip|blur|none"` (any list or grid) animates items added later, `data-moey-enter-first` the first page too, `Moey.enter(list)` replays. `.gallery-tile` + `.gallery-caption` for picture tiles. (Old names `.masonry` / `data-moey-masonry` still work; use griddy.)
198
198
 
199
199
  **Filter & sort**: buttons in `<div data-moey-filters="#items">` with `data-moey-filter="tag"` (`"*"` = all) and `data-moey-sort-by="date"` (+ `data-moey-sort-dir="desc"`); items carry `data-tags="a b"` and `data-date`…; `data-moey-filter-search="#items"`, `data-moey-filter-count="#items"`, a `.filter-empty` inside.
200
200
 
201
201
  **Infinite scroll**: `data-moey-infinite` on the list; `moey:load` → append items inside `e.detail.waitUntil(promise)`, call `e.detail.done()` on the last page. A "Load more" button takes over after 3 loads.
202
202
 
203
- **Lightbox**: `data-moey-lightbox` on a gallery: `<a href="big.jpg" data-caption="…"><img src="small.jpg" alt="…"></a>` — also video (.mp4), audio (.mp3), YouTube/Vimeo links, `data-type="iframe"` pages/PDFs, `href="#template-id"` HTML. Parts: `data-moey-lightbox-thumbs="auto|always|never"`, `-counter`, `-caption`, `-zoom`, `-loop`, `-download`, `-share`, `-fullscreen`, `-slideshow="4000"` ("false" turns off). `data-moey-lightbox="name"` groups links across the page. `Moey.lightbox.open([...], options)`.
203
+ **Lightbox**: `data-moey-lightbox` on a gallery: `<a href="big.jpg" data-caption="…"><img src="small.jpg" alt="…"></a>` — also video (.mp4), audio (.mp3), a video site's embed address with `data-type="embed"`, `data-type="iframe"` pages/PDFs, `href="#template-id"` HTML. Parts: `data-moey-lightbox-thumbs="auto|always|never"`, `-counter`, `-caption`, `-zoom`, `-loop`, `-download`, `-share`, `-fullscreen`, `-slideshow="4000"` ("false" turns off). `data-moey-lightbox="name"` groups links across the page. `Moey.lightbox.open([...], options)`.
204
204
 
205
- **Audio & video**: `<div class="player" data-moey-player><video src="…" poster="…"></video></div>` (or `<audio>`, with `.player-head` > `.player-cover` + `.player-title`); `data-moey-controls="speed volume captions pip fullscreen"` or `"none"`. A file that can't play shows a message + Try again by itself (`data-moey-error-text`, event `moey:player-error`). Embeds that load on click: `<a class="embed" href="https://www.youtube.com/watch?v=…" data-moey-embed><img src="cover.jpg" alt=""><span class="embed-play"></span><span class="embed-title">…</span></a>` (`.embed-9x16` for Shorts). Never paste a raw YouTube iframe.
205
+ **Audio & video**: `<div class="player" data-moey-player><video src="…" poster="…"></video></div>` (or `<audio>`, with `.player-head` > `.player-cover` + `.player-title`); `data-moey-controls="speed volume captions pip fullscreen"` or `"none"`. A file that can't play shows a message + Try again by itself (`data-moey-error-text`, event `moey:player-error`). Embeds that load on click: `<a class="embed" href="the video page" data-src="the site's embed address" data-moey-embed><img src="cover.jpg" alt=""><span class="embed-play"></span><span class="embed-title">…</span></a>` (`data-src` is loaded exactly as given; `.embed-9x16` for vertical clips). Never paste a raw video-site iframe into a page.
206
206
 
207
207
  **Marquee** (logos, testimonials, tickers): `<div class="marquee" data-moey-marquee aria-label="…"><ul class="marquee-group"><li>…</li></ul></div>` — `data-moey-speed`, `.marquee-reverse`, `.marquee-vertical` (with a height). It pauses on hover/focus and has a pause button; don't remove it without another way to stop it.
208
208
 
@@ -229,7 +229,7 @@ On phones (below 1024px, or 768px with `navbar-expand-md`; `navbar-expand` never
229
229
 
230
230
  ## JavaScript API (only when needed)
231
231
 
232
- `Moey.toast()` · `Moey.confirm() / alert() / prompt()` · `Moey.open(el) / close(el)` · `Moey.tab()` · `Moey.tags()` · `Moey.chips()` · `Moey.toggle()` · `Moey.datatable()` · `Moey.select()` · `Moey.datepicker()` · `Moey.combobox()` · `Moey.palette()` · `Moey.notify()` · `Moey.clean(form)` · `Moey.chart()` · `Moey.kanban()` · `Moey.split()` · `Moey.calendar()` · `Moey.swipe()` · `Moey.refresh()` · `Moey.sortable()` · `Moey.timepicker()` · `Moey.chat()` · `Moey.shortcuts` · `Moey.tour()` · `Moey.marquee()` · `Moey.masonry()` · `Moey.filter()` · `Moey.infinite()` · `Moey.lightbox` · `Moey.player()`. Events are `moey:*` (e.g. `moey:select`, `moey:change`, `moey:open`, `moey:close`).
232
+ `Moey.toast()` · `Moey.confirm() / alert() / prompt()` · `Moey.open(el) / close(el)` · `Moey.tab()` · `Moey.tags()` · `Moey.chips()` · `Moey.toggle()` · `Moey.datatable()` · `Moey.select()` · `Moey.datepicker()` · `Moey.combobox()` · `Moey.palette()` · `Moey.notify()` · `Moey.clean(form)` · `Moey.chart()` · `Moey.kanban()` · `Moey.split()` · `Moey.calendar()` · `Moey.swipe()` · `Moey.refresh()` · `Moey.sortable()` · `Moey.timepicker()` · `Moey.chat()` · `Moey.shortcuts` · `Moey.tour()` · `Moey.marquee()` · `Moey.griddy()` · `Moey.enter()` · `Moey.filter()` · `Moey.infinite()` · `Moey.lightbox` · `Moey.player()`. Events are `moey:*` (e.g. `moey:select`, `moey:change`, `moey:open`, `moey:close`).
233
233
 
234
234
  ## Common mistakes to avoid
235
235
 
@@ -244,13 +244,13 @@ On phones (below 1024px, or 768px with `navbar-expand-md`; `navbar-expand` never
244
244
 
245
245
  ---
246
246
 
247
- # Moey documentation (v0.1.0)
247
+ # Moey documentation (v0.3.0)
248
248
 
249
249
  Every page of the docs, in order.
250
250
 
251
251
  # Overview (Getting started)
252
252
 
253
- v0.1.0 · MIT · no dependencies
253
+ v0.3.0 · MIT · no dependencies
254
254
  Apps that feel native on every screen.
255
255
 
256
256
  Moey is a clean, mobile-first front-end framework for admin dashboards, productivity apps and websites. Plain HTML, one stylesheet and one script — flat, accessible, light and dark, right to left.
@@ -304,7 +304,7 @@ Not just buttons and cards: the pieces productivity apps are made of, each worki
304
304
  Swipe actionsSwipe a row to archive or delete — like mail apps
305
305
  Pull to refreshPull down at the top of a list to load what's new
306
306
  SortableDrag anything into the order you want
307
- MasonryPictures and cards of every height, packed tight
307
+ GriddyPictures and cards of every height, packed tight
308
308
  LightboxSwipe, pinch and zoom through pictures, video and more
309
309
  Audio & videoA player in your colors; embeds that load on demand
310
310
  Keyboard shortcutsShortcuts on any button, and a "?" sheet to find them
@@ -317,9 +317,9 @@ Not just buttons and cards: the pieces productivity apps are made of, each worki
317
317
  ## Overview
318
318
 
319
319
  ```html
320
- <link rel="stylesheet" href="dist/moey.min.css">
321
- <link rel="stylesheet" href="moey-icons.min.css"> <!-- Moey Icons -->
322
- <script src="dist/moey.min.js" defer></script> <!-- behaviors -->
320
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.css">
321
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-icons@1.0.0/dist/moey-icons.min.css">
322
+ <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.js" defer></script>
323
323
  ```
324
324
 
325
325
  ### Cascade layers
@@ -406,9 +406,9 @@ Moey is one stylesheet and one script, with no dependencies and no build step. L
406
406
  Link the files straight from jsDelivr (the version in the address never changes, so it can be cached for a year):
407
407
 
408
408
  ```html
409
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.css">
409
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.css">
410
410
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-icons@1.0.0/dist/moey-icons.min.css">
411
- <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.js" defer></script>
411
+ <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.js" defer></script>
412
412
  ```
413
413
 
414
414
  ### npm
@@ -440,9 +440,9 @@ The `viewport` line matters: it makes the page fit a phone. The small script bef
440
440
  <meta name="viewport" content="width=device-width, initial-scale=1">
441
441
  <title>My app</title>
442
442
  <script>try { const t = localStorage.getItem('moey-theme'); if (t) document.documentElement.dataset.moTheme = t; } catch {}</script>
443
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.css">
443
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.css">
444
444
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-icons@1.0.0/dist/moey-icons.min.css">
445
- <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.js" defer></script>
445
+ <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.js" defer></script>
446
446
  </head>
447
447
  <body>
448
448
  <main class="container py-8">
@@ -465,6 +465,16 @@ The `viewport` line matters: it makes the page fit a phone. The small script bef
465
465
 
466
466
  ---
467
467
 
468
+ # Changelog (Getting started)
469
+
470
+ ## Changelog
471
+
472
+ What changed in each version of Moey. A link with a version in it (`moey-ui@0.3.0`) always serves exactly that version, so your pages never change until you change the link.
473
+
474
+ {{changelog}}
475
+
476
+ ---
477
+
468
478
  # Examples (Getting started)
469
479
 
470
480
  ## Examples
@@ -1062,7 +1072,7 @@ Generated from Moey's own CSS, so this list is always complete. Click a componen
1062
1072
  | Data table | `--mo-datatable-height` |
1063
1073
  | Datepicker | `--mo-dp-cell` |
1064
1074
  | Description list | `--mo-dl-label` `--mo-dl-gap` |
1065
- | Dialog / drawer / sheet | `--mo-dialog-padding` `--mo-dialog-footer-padding` `--mo-dialog-bg` `--mo-dialog-duration` `--mo-dialog-width` `--mo-sheet-height` `--mo-sheet-max-width` `--mo-drawer-size` |
1075
+ | Dialog / drawer / sheet | `--mo-dialog-padding` `--mo-dialog-footer-padding` `--mo-dialog-bg` `--mo-dialog-fg` `--mo-dialog-duration` `--mo-dialog-width` `--mo-sheet-height` `--mo-sheet-max-width` `--mo-drawer-size` |
1066
1076
  | Divider | `--mo-divider-color` `--mo-divider-space` `--mo-divider-style` |
1067
1077
  | Dropzone | `--mo-dropzone-min-height` |
1068
1078
  | Floating labels | `--mo-floating-height` `--mo-floating-scale` |
@@ -1605,16 +1615,24 @@ Stat tiles on top, a wide chart and a side list below — one grid.
1605
1615
  </div>
1606
1616
  ```
1607
1617
 
1618
+ ### Items of different heights: Griddy
1619
+
1620
+ In a normal grid every row is as tall as its tallest item, so shorter cards leave holes under them. Add `.griddy` and `data-moey-griddy` to a grid and its items pack into columns instead, like a pin board, with the same `grid-cols-*` and `gap-*` utilities. New items can arrive with an animation, and items glide when the layout changes. All about Griddy.
1621
+
1622
+ ```html
1623
+ <div class="griddy grid-cols-2 md:grid-cols-3 gap-3" data-moey-griddy>…</div>
1624
+ ```
1625
+
1608
1626
  ---
1609
1627
 
1610
- # Masonry (Layout)
1628
+ # Griddy (Layout)
1611
1629
 
1612
- ## Masonry
1630
+ ## Griddy
1613
1631
 
1614
- Items of different heights packed into columns with no holes — photo galleries, pin boards, cards of notes and reviews. Columns come from the grid utilities you already know, the order stays the reading order, and it re-packs as images load and screens change.
1632
+ A CSS grid whose items of different heights pack into columns with no holes: photo galleries, pin boards, cards of notes and reviews. Columns come from the grid utilities you already know, the order stays the reading order, and it packs again as pictures load and screens change. New items can arrive with an animation, and items glide to their new place when the layout changes.
1615
1633
 
1616
1634
  ```html
1617
- <div class="masonry grid-cols-2 md:grid-cols-3 gap-3" data-moey-masonry>
1635
+ <div class="griddy grid-cols-2 md:grid-cols-3 gap-3" data-moey-griddy>
1618
1636
  <a class="gallery-tile" href="lisbon.jpg"><img src="lisbon-small.jpg" alt="Lisbon at dawn" width="800" height="1000"></a>
1619
1637
  <a class="gallery-tile" href="lake.jpg"><img src="lake-small.jpg" alt="A lake up north" width="800" height="560"></a>
1620
1638
  …
@@ -1623,47 +1641,85 @@ Items of different heights packed into columns with no holes — photo galleries
1623
1641
 
1624
1642
  ### How it works
1625
1643
 
1626
- - **A grid with columns:** `.masonry` plus the column utilities — `grid-cols-2 md:grid-cols-3`. Without them it makes as many columns of about 14rem as fit (`--mo-masonry-min`).
1644
+ - **A grid with columns:** `.griddy` plus the column utilities, `grid-cols-2 md:grid-cols-3`. Without them it makes as many columns of about 14rem as fit (`--mo-griddy-min`).
1627
1645
 
1628
- - **Any items:** pictures, cards, notes. Give images their `width` and `height` so the space is kept before they load.
1646
+ - **Any items:** pictures, cards, notes. Give pictures their `width` and `height` so the space is kept before they load.
1629
1647
 
1630
- - **Moey packs them:** each item takes exactly the height it needs, so the columns fill with no holes — and re-packs when an image loads, the window changes or items come and go.
1648
+ - **Moey packs them:** each item goes to the column that is shortest so far, at its exact height, so the columns fill with no holes. It packs again when a picture loads, fonts arrive, the window changes, items come and go, or a class changes the columns, the gap or an item's width. It measures each item's real size, so zoom or an entrance animation never makes items overlap.
1631
1649
 
1632
- - **Reading order stays:** items stay in the page's order, left to right, so the keyboard and screen readers go through them sensibly. In browsers with built-in CSS masonry, Moey just uses that.
1650
+ - **Reading order stays:** items stay in the page's order, roughly left to right, so the keyboard and screen readers go through them sensibly. In browsers with built-in CSS masonry, Moey just uses that.
1633
1651
 
1634
1652
  ### Cards, not just pictures
1635
1653
 
1636
1654
  ```html
1637
- <div class="masonry gap-4" data-moey-masonry>
1655
+ <div class="griddy gap-4" data-moey-griddy>
1638
1656
  <div class="card">…</div>
1639
1657
  <div class="card">…</div>
1640
1658
  </div>
1641
1659
  ```
1642
1660
 
1661
+ ### New items arrive
1662
+
1663
+ Add `data-moey-enter` and items added later (infinite scroll, "Load more", a post added by any script) play an entrance, one after another. Pick the effect with its value. Items that only move (sorting, dragging, filters) don't play it, and nothing moves for visitors who turned motion off. Try them:
1664
+
1665
+ ```html
1666
+ <div class="griddy gap-3" data-moey-griddy data-moey-enter="pop">…</div>
1667
+
1668
+ <!-- effects: (empty) fade up · fade · rise · drop · zoom · pop · slide · flip · blur · none -->
1669
+ <!-- data-moey-enter-first: the items already there when the page loads arrive too -->
1670
+ <!-- your own: [data-moey-enter] > .is-entering { animation: … } (--mo-enter-index: 0, 1, 2… for the stagger) -->
1671
+
1672
+ <script>
1673
+ Moey.enter(list); // play it again on every item
1674
+ Moey.enter(list, [a, b]); // or on the ones you give
1675
+ </script>
1676
+ ```
1677
+
1678
+ It works on any list or grid, not only Griddy: a feed, a list group, a row of cards. The items wait `--mo-enter-stagger` (60ms, 55ms for `pop`) one after another.
1679
+
1680
+ ### Gliding
1681
+
1682
+ Add `.griddy-glide` and the items already on the page slide to their new place when the layout changes: an item gets wider, the column count or the gap changes, the window is resized, a filter hides some. An item placed for the first time goes straight to its spot, so new items never fly in from a corner. Try it:
1683
+
1684
+ ```html
1685
+ <div class="griddy griddy-glide grid-cols-3 gap-3" data-moey-griddy>…</div>
1686
+
1687
+ <script>
1688
+ item.classList.add('span-2'); // the others glide out of the way
1689
+ grid.classList.replace('grid-cols-3', 'grid-cols-4'); // a new column count: everything glides
1690
+ </script>
1691
+ ```
1692
+
1643
1693
  ### Wide items, holes filled, drag to arrange
1644
1694
 
1645
- `span-2` makes an item two columns wide; `.masonry-dense` lets later items move up into the holes this leaves (like a packing puzzle). Add data-moey-sortable and people can drag the tiles into their own order. Try it:
1695
+ `span-2` makes an item two columns wide; `.griddy-dense` lets later items move up into the holes this leaves (like a packing puzzle). Add data-moey-sortable and people can drag the tiles into their own order. Try it:
1646
1696
 
1647
1697
  ```html
1648
- <div class="masonry masonry-dense grid-cols-2 md:grid-cols-4 gap-3" data-moey-masonry data-moey-sortable>
1698
+ <div class="griddy griddy-dense grid-cols-2 md:grid-cols-4 gap-3" data-moey-griddy data-moey-sortable>
1649
1699
  <figure class="gallery-tile span-2" data-id="lisbon">…</figure>
1650
1700
  <figure class="gallery-tile" data-id="lake">…</figure>
1651
1701
  …
1652
1702
  </div>
1653
1703
  ```
1654
1704
 
1655
- With `.masonry-dense` the order on screen can differ from the page's — fine for pictures, but keep it off when the order matters (news, steps).
1705
+ With `.griddy-dense` the order on screen can differ from the page's. That's fine for pictures, but keep it off when the order matters (news, steps).
1656
1706
 
1657
1707
  ### Reference
1658
1708
 
1659
1709
  | Class / attribute | What it does |
1660
1710
  | --- | --- |
1661
- | `.masonry[data-moey-masonry]` | Packs its items into columns with no holes |
1662
- | `grid-cols-*` · `md:grid-cols-*` · `gap-*` | Columns and spacing (else automatic: `--mo-masonry-min`, 14rem) |
1711
+ | `.griddy[data-moey-griddy]` | Packs its items into columns with no holes |
1712
+ | `grid-cols-*` · `md:grid-cols-*` · `gap-*` | Columns and spacing (else automatic: `--mo-griddy-min`, 14rem) |
1663
1713
  | `span-2` · `span-3` | An item across two or three columns |
1664
- | `.masonry-dense` | Later items fill holes (order on screen may change) |
1714
+ | `.griddy-dense` | Later items fill holes (order on screen may change) |
1715
+ | `.griddy-glide` | Items already there glide to their new place when the layout changes (.4s) |
1716
+ | `data-moey-enter="…"` | Items added later arrive, one after another: (empty) fade up · `fade` · `rise` · `drop` · `zoom` · `pop` · `slide` · `flip` · `blur` · `none`. Any list or grid. While they do, they get `.is-entering` and `--mo-enter-index` |
1717
+ | `data-moey-enter-first` | The items already there when the page loads arrive too |
1718
+ | `--mo-enter-stagger` | The wait between items (60ms; 55ms for `pop`) |
1665
1719
  | `.gallery-tile` + `.gallery-caption` / `figcaption` | A rounded picture tile with a caption on hover (always shown on touch) |
1666
- | `Moey.masonry(el).layout()` | Pack again (after changing items from code — usually automatic) |
1720
+ | `Moey.griddy(el).layout()` | Pack again (after changing items from code; usually automatic) |
1721
+ | `Moey.enter(list, items?)` | Play the arrival again, on all items or the ones given |
1722
+ | `.masonry` · `.masonry-dense` · `data-moey-masonry` · `Moey.masonry()` | Griddy's earlier names: they still work |
1667
1723
 
1668
1724
  ---
1669
1725
 
@@ -1750,7 +1806,7 @@ Add `.is-collapsed` to `.app` for an icon-only sidebar on desktop. Labels, badge
1750
1806
  | `--mo-sidebar-width-collapsed` | 4.25rem |
1751
1807
  | `--mo-sidebar-bg` | `var(--mo-bg-surface)` |
1752
1808
  | `--mo-topbar-height` | 3.75rem |
1753
- | `--mo-topbar-bg` | page color, slightly see-through |
1809
+ | `--mo-topbar-bg` | the page color, shown slightly see-through (`--mo-glass`); `<header class="app-topbar frosted">` for frosted glass |
1754
1810
  | `--mo-app-padding` | 1rem → 1.5rem (md) → 2rem (2xl) |
1755
1811
 
1756
1812
  The active link uses the current theme, so `` recolors it.
@@ -2009,6 +2065,10 @@ Code is set in **JetBrains Mono**, self-hosted with Moey like Inter — nothing
2009
2065
 
2010
2066
  Ligatures are off, so `=>` and `!=` show exactly as typed (turn them on with `font-variant-ligatures: normal`). Prefer another code font? Set `--mo-font-mono`.
2011
2067
 
2068
+ ### Scrolling
2069
+
2070
+ A link to a spot on the same page (`href="#shipping"`) glides there, unless the visitor turned motion off. Only those links glide: when your own script moves the page (`scrollTo()`, `scrollIntoView()`, "jump to post"), it lands at once, exactly where you aimed. Want a scroll area that always glides? Add `scroll-smooth` to it.
2071
+
2012
2072
  ---
2013
2073
 
2014
2074
  # Typography (Content)
@@ -2199,7 +2259,7 @@ Screenshots and diagrams often need a light and a dark version. Put both in and
2199
2259
 
2200
2260
  ## Audio & video
2201
2261
 
2202
- A player that looks like the rest of your app, for video, music, podcasts and voice notes — big touch targets, the keys people know from video sites, and nothing lost without JavaScript (the browser's own controls stay). Plus embeds — YouTube, Vimeo, maps — that load only when someone presses play.
2262
+ A player that looks like the rest of your app, for video, music, podcasts and voice notes — big touch targets, the keys people know from video sites, and nothing lost without JavaScript (the browser's own controls stay). Plus embeds from any video site, maps or pages that load only when someone presses play.
2203
2263
 
2204
2264
  ### Video
2205
2265
 
@@ -2275,21 +2335,21 @@ The same player, small, inside a chat bubble — only the speed button (`data-mo
2275
2335
 
2276
2336
  ### Embeds that load on demand
2277
2337
 
2278
- An `` shows a light cover with a play button. Only when it's pressed does the real player load — so pages stay fast, and nothing from YouTube or Vimeo reaches the visitor until they choose (YouTube's no-cookie player, Vimeo's do-not-track). Without JavaScript it's a plain link to the video.
2338
+ An `` shows a light cover with a play button. Only when it's pressed does the real player load, so pages stay fast and nothing from the other site reaches the visitor until they choose. It works with any video site, map or page: put the site's embed address (usually under Share → Embed) in `data-src`, and the normal page in `href` for visitors without JavaScript. Moey loads the embed address exactly as given, so add the site's own options there, such as autoplay (they pressed play already) or a privacy-friendly mode.
2279
2339
 
2280
2340
  ```html
2281
- <a class="embed max-w-2xl" href="https://www.youtube.com/watch?v=aqz-KE-bpKQ" data-moey-embed>
2341
+ <a class="embed max-w-2xl" href="https://video.example.com/watch/…" data-src="https://player.example.com/embed/…?autoplay=1" data-moey-embed>
2282
2342
  <img src="img/gallery/harbor-night.svg" alt="">
2283
2343
  <span class="embed-play"></span>
2284
- <span class="embed-title">Big Buck Bunny — a short film</span>
2285
- <span class="embed-note">Plays from YouTube</span>
2344
+ <span class="embed-title">A short film</span>
2345
+ <span class="embed-note">Plays from the video site</span>
2286
2346
  </a>
2287
2347
  ```
2288
2348
 
2289
- Shapes: 16:9 (default), `.embed-4x3`, `.embed-1x1`, `.embed-9x16` for Shorts and Reels:
2349
+ Shapes: 16:9 (default), `.embed-4x3`, `.embed-1x1`, `.embed-9x16` for vertical clips:
2290
2350
 
2291
2351
  ```html
2292
- <a class="embed embed-9x16" href="https://www.youtube.com/shorts/aqz-KE-bpKQ" data-moey-embed>
2352
+ <a class="embed embed-9x16" href="https://video.example.com/watch/…" data-src="https://player.example.com/embed/…" data-moey-embed>
2293
2353
  <img src="img/gallery/festival.svg" alt="">
2294
2354
  <span class="embed-play"></span>
2295
2355
  <span class="embed-title">A vertical clip</span>
@@ -2303,7 +2363,7 @@ Shapes: 16:9 (default), `.embed-4x3`, `.embed-1x1`, `.embed-9x16` for Shorts and
2303
2363
  </a>
2304
2364
  ```
2305
2365
 
2306
- Want them in a full-screen viewer instead? Links to videos, audio and YouTube work in the Lightbox too.
2366
+ Want them in a full-screen viewer instead? Videos, audio and embed addresses work in the Lightbox too.
2307
2367
 
2308
2368
  ### Reference
2309
2369
 
@@ -2313,7 +2373,7 @@ Want them in a full-screen viewer instead? Links to videos, audio and YouTube wo
2313
2373
  | `data-moey-controls="speed volume captions pip fullscreen"` · `"none"` | Which buttons (play, seek and time always) |
2314
2374
  | `data-moey-speeds="1,1.5,2"` | The speeds the speed button goes through |
2315
2375
  | `.player-head` · `.player-cover` · `.player-title` · `.player-sub` | Audio: a cover and titles above the bar |
2316
- | `a.embed[data-moey-embed]` (+ `data-src`, `data-title`) | A cover that becomes the player when pressed (YouTube, Vimeo, any page) |
2376
+ | `a.embed[data-moey-embed]` (+ `data-src`, `data-title`) | A cover that becomes the player when pressed: `data-src` (else `href`) is loaded exactly as given (any video site, a map, any page) |
2317
2377
  | `.embed-play` · `.embed-title` · `.embed-note` · `.embed-4x3\|1x1\|9x16` | The cover's parts · shapes |
2318
2378
  | `.is-error` · event `moey:player-error` · `data-moey-error-text` | The file can't be loaded or played: the bar says so ("Can't play this file", or your text) with a **Try again** button; screen readers hear it |
2319
2379
  | `Moey.player(el)` · event `moey:embed` | `{ media, play(), pause() }` · an embed was loaded |
@@ -3940,9 +4000,9 @@ Tapping the field opens the list as a bottom sheet (no keyboard needed); drag it
3940
4000
  <textarea class="form-control" id="body" name="description" data-mob placeholder="Tell people about this product…"></textarea>
3941
4001
  </div>
3942
4002
  ``` ### Set it up, step by step **Load Mob next to Moey.** It is its own small package (no dependencies, about 20 KB gzipped), so pages without an editor don't pay for it. From a CDN: ```html
3943
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.css">
4003
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.css">
3944
4004
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mobtexteditor@1/mob.css">
3945
- <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.1.0/dist/moey.min.js" defer></script>
4005
+ <script src="https://cdn.jsdelivr.net/npm/moey-ui@0.3.0/dist/moey.min.js" defer></script>
3946
4006
  <script src="https://cdn.jsdelivr.net/npm/mobtexteditor@1/mob.js" defer></script>
3947
4007
  ``` or with npm: `npm install mobtexteditor` and `import 'mobtexteditor/mob.css'; import Mob from 'mobtexteditor';`
3948
4008
 
@@ -5553,7 +5613,7 @@ With `moey.js` it all works on its own:
5553
5613
 
5554
5614
  - **Focus** — goes to the dialog itself, or to the element with `autofocus` (e.g. the first input of a form).
5555
5615
 
5556
- - **On phones** — it becomes a bottom sheet with a handle you can drag down to close. Want a sheet on every screen size? Use `.sheet`.
5616
+ - **On phones** — it becomes a bottom sheet with a handle you can drag down to close. Want a sheet on every screen size? Use `.sheet`. Rather have it cover the phone's screen? Add `.dialog-fullscreen-phone`.
5557
5617
 
5558
5618
  | Class | What it does |
5559
5619
  | --- | --- |
@@ -5566,8 +5626,37 @@ With `moey.js` it all works on its own:
5566
5626
  | `data-moey-close-outside="true"` | A click outside closes it (off by default). On `<body>` it sets the page default. |
5567
5627
  | `data-moey-static` | Only your own buttons close it |
5568
5628
  | `.dialog-center` | Stays centered on phones instead of becoming a bottom sheet |
5629
+ | `.dialog-fullscreen-phone` | A normal dialog on larger screens, the whole screen on phones (under 576px) instead of a bottom sheet: a post, a long form, a reader |
5569
5630
  | `.dialog-icon` + `theme-*` | Round icon for confirm dialogs |
5570
5631
  | `--mo-dialog-padding` · `--mo-dialog-footer-padding` | Inner spacing (24px) · space above and below the footer buttons (14px) |
5632
+ | `--mo-dialog-bg` · `--mo-dialog-fg` | Background and text of dialogs, drawers and sheets. Set them on `:root` to give every one your page's colors (a theme with its own palette), or on one dialog |
5633
+
5634
+ ### Full screen on phones
5635
+
5636
+ A post, an article or a long form reads better on the whole screen of a phone than in a sheet. `.dialog-fullscreen-phone` keeps a normal dialog on larger screens and covers the screen under 576px (clearing the notch and home bar). Make the window narrow to see it switch:
5637
+
5638
+ ## Packing day
5639
+
5640
+ Posted by the studio · 4 min read
5641
+
5642
+ Every Friday the whole week's orders go out at once. The totes are folded in thirds, the mugs get a paper sleeve, and every box gets a handwritten note.
5643
+
5644
+ On a phone this dialog fills the screen like a page of its own; on a laptop it stays a dialog over the page.
5645
+
5646
+ Done
5647
+
5648
+ ```html
5649
+ <dialog class="dialog dialog-lg dialog-fullscreen-phone" id="post" aria-labelledby="post-title">…</dialog>
5650
+ ```
5651
+
5652
+ Your page has its own colors (a theme, a blog)? Give the dialogs the same ones, once, for the whole page:
5653
+
5654
+ ```css
5655
+ :root {
5656
+ --mo-dialog-bg: #fbf7f0; /* dialogs, drawers and sheets */
5657
+ --mo-dialog-fg: #2b2622;
5658
+ }
5659
+ ```
5571
5660
 
5572
5661
  ### Clicking outside
5573
5662
 
@@ -7045,7 +7134,7 @@ A sample page at phone width — tap ☰ to open the menu.
7045
7134
  | --- | --- |
7046
7135
  | (default) | A flat surface |
7047
7136
  | `.navbar-transparent` | No background — over a hero image or colored header |
7048
- | `.navbar-blur` | Frosted glass: see-through with a blur (great with sticky) |
7137
+ | `.navbar-blur` | Frosted glass: see-through with a blur (great with sticky). For other bars: `.frosted` |
7049
7138
  | `.navbar-floating` | An inset, rounded bar |
7050
7139
  | `.navbar-vivid` · `.navbar-deep` + `.navbar-<color>` | Filled with the color (*-600, or a dark *-800); links and ghost buttons turn light. Give buttons their own `theme-*` if needed. |
7051
7140
  | `.navbar-sticky` | Stays at the top; gets a soft shadow once the page scrolls |
@@ -7223,6 +7312,7 @@ Phones get the tab bar, wide screens the sidebar — the same sections in both.
7223
7312
  | `.tabbar-badge` | A count, or a dot when empty |
7224
7313
  | `.tabbar-action` | The big round middle button (its label is visually hidden) |
7225
7314
  | `.tabbar-floating` · `.tabbar-always` | A rounded floating pill · stays on wide screens too |
7315
+ | `.frosted` | Frosted glass: more see-through, with the page blurred behind (by default the bar is only slightly see-through, which is lighter to scroll) |
7226
7316
  | `data-moey-hide-on-scroll` | Slides away while scrolling down |
7227
7317
  | `data-moey-no-current` | On a tab: tapping it doesn't move the mark (it opens something) |
7228
7318
  | `--mo-tabbar-space` | Read-only: the room the bar takes (the page and toasts use it; 0 when there's no bar) |
@@ -9811,7 +9901,7 @@ Tab to an item (or its handle), Space picks it up, ↑ ↓ move it (← → in a
9811
9901
 
9812
9902
  ## Filter & sort
9813
9903
 
9814
- Buttons that show only what matches — "Nature", "City" — a search box, and sorting, for any set of items: a gallery, product cards, a team page. Items glide to their new places, a count keeps track, and it works with masonry.
9904
+ Buttons that show only what matches — "Nature", "City" — a search box, and sorting, for any set of items: a gallery, product cards, a team page. Items glide to their new places, a count keeps track, and it works with Griddy.
9815
9905
 
9816
9906
  ```html
9817
9907
  <!-- the controls point at the items with a selector -->
@@ -9824,7 +9914,7 @@ Buttons that show only what matches — "Nature", "City" — a search box, and s
9824
9914
  <span data-moey-filter-count="#gallery"></span> photos
9825
9915
 
9826
9916
  <!-- the items carry their tags and the values to sort by -->
9827
- <div class="masonry" id="gallery" data-moey-masonry>
9917
+ <div class="griddy" id="gallery" data-moey-griddy>
9828
9918
  <a class="gallery-tile" href="lake.jpg" data-tags="nature cool" data-date="2026-03-14" data-name="lake">…</a>
9829
9919
  …
9830
9920
  <p class="filter-empty" hidden>No photos match.</p>
@@ -9867,7 +9957,7 @@ gallery.addEventListener('moey:filter', (e) => console.log(e.detail.shown, 'of',
9867
9957
  The next items load as you reach the end of the list — feeds, galleries, search results. After a few loads it waits for a "Load more" button, so people can still get to your footer; it says when it's loading and when there's nothing more.
9868
9958
 
9869
9959
  ```html
9870
- <div class="masonry" id="feed" data-moey-masonry data-moey-infinite>
9960
+ <div class="griddy" id="feed" data-moey-griddy data-moey-infinite data-moey-enter>
9871
9961
  …the first items…
9872
9962
  </div>
9873
9963
 
@@ -9888,17 +9978,29 @@ The next items load as you reach the end of the list — feeds, galleries, searc
9888
9978
 
9889
9979
  - **Load in `moey:load`:** fetch the next page, append the items, and hand the promise to `e.detail.waitUntil()` so the spinner shows while it loads.
9890
9980
 
9891
- - **Say when it's over:** call `e.detail.done()` on the last page — "That's everything" appears (`data-moey-infinite-end` to change the words).
9981
+ - **Say when it's over:** call `e.detail.done()` on the last page: "That's everything" appears (`data-moey-infinite-end` to change the words).
9982
+
9983
+ - **Choose how far it goes alone:** after `data-moey-infinite-auto` loads (3) a "Load more" button takes over, so people can still reach your footer. A click makes it automatic again for the same number of loads. `data-moey-infinite-auto="all"` never stops; `data-moey-infinite="button"` always uses the button.
9984
+
9985
+ ### A button first, then automatic
9892
9986
 
9893
- - **Choose how far it goes alone:** after `data-moey-infinite-auto` loads (3) a "Load more" button takes over; `data-moey-infinite="button"` always uses the button.
9987
+ `data-moey-infinite="once"` starts with the "Load more" button, so nothing loads until someone asks. After the first click it loads by itself as they scroll (up to `data-moey-infinite-auto` loads, then the button again). While it loads, the button stays where it is, with a spinner and "Loading…" inside it, so nothing on the page jumps. Try it:
9988
+
9989
+ ```html
9990
+ <div class="griddy" id="feed" data-moey-griddy data-moey-infinite="once" data-moey-enter="pop">
9991
+ …the first items…
9992
+ </div>
9993
+ ```
9894
9994
 
9895
9995
  ### Good to know
9896
9996
 
9897
9997
  - It loads a little before the end (400px early), so scrolling rarely has to wait.
9898
9998
 
9899
- - It works with masonry, filters, list groups and cards; new items join the layout and the current filter.
9999
+ - It works with griddy, filters, list groups and cards; new items join the layout and the current filter.
10000
+
10001
+ - Add `data-moey-enter` and the new items fade up into place, one after another (more).
9900
10002
 
9901
- - Screen readers hear "Loading…", "8 more loaded" and "That's everything".
10003
+ - Screen readers hear "Loading…", "8 more loaded" and "That's everything". When the button goes away after a click, keyboard focus moves to the first new item.
9902
10004
 
9903
10005
  - Keep links to items working: give the items real URLs so people can come back to them.
9904
10006
 
@@ -9906,8 +10008,9 @@ The next items load as you reach the end of the list — feeds, galleries, searc
9906
10008
 
9907
10009
  | Attribute / API | What it does |
9908
10010
  | --- | --- |
9909
- | `data-moey-infinite` · `="button"` | Loads more near the end · only with the button |
9910
- | `data-moey-infinite-auto="3"` · `data-moey-infinite-end` | Loads before the button takes over · the words at the end |
10011
+ | `data-moey-infinite` · `="button"` · `="once"` | Loads more near the end · only with the button · the button first, then automatic |
10012
+ | `data-moey-infinite-auto="3"` · `="all"` | Automatic loads before the button takes over · never stop |
10013
+ | `data-moey-infinite-more` · `data-moey-infinite-end` | The button's words ("Load more") · the words at the end |
9911
10014
  | Event `moey:load` | `detail: { page, waitUntil(promise), done() }` |
9912
10015
  | `Moey.infinite(el)` | `{ load(), reset() }` (reset after a new search) |
9913
10016
 
@@ -9917,7 +10020,7 @@ The next items load as you reach the end of the list — feeds, galleries, searc
9917
10020
 
9918
10021
  ## Lightbox
9919
10022
 
9920
- A full-screen viewer for pictures, video, audio, YouTube, Vimeo, pages and any HTML — made for fingers first: the picture follows your finger to the next one, swipe down to close, pinch or double-tap to zoom, one tap to hide everything but the picture. On a computer: arrows, thumbnails, the mouse wheel and the keyboard. Every part can be switched on or off.
10023
+ A full-screen viewer for pictures, video, audio, embedded players from any video site, pages and any HTML — made for fingers first: the picture follows your finger to the next one, swipe down to close, pinch or double-tap to zoom, one tap to hide everything but the picture. On a computer: arrows, thumbnails, the mouse wheel and the keyboard. Every part can be switched on or off.
9921
10024
 
9922
10025
  ```html
9923
10026
  <div class="grid grid-cols-3 md:grid-cols-4 gap-2" data-moey-lightbox>
@@ -9950,14 +10053,14 @@ A full-screen viewer for pictures, video, audio, YouTube, Vimeo, pages and any H
9950
10053
 
9951
10054
  ### Not just pictures
9952
10055
 
9953
- The type comes from the address (`.mp4` → video, `.mp3` → audio, a YouTube or Vimeo link → that player, `.pdf` → a page) or from `data-type`. Videos and embeds load only when shown, and stop when you move on or close. YouTube uses its privacy-friendly no-cookie player.
10056
+ The type comes from the file (`.mp4` → video, `.mp3` → audio, `.pdf` → a page) or from `data-type`. For a video on a video site, use the site's **embed address** (usually under Share → Embed) with `data-type="embed"`: Moey loads it exactly as given, so you choose the site and its privacy options. Videos and embeds load only when shown, and stop when you move on or close.
9954
10057
 
9955
10058
  ```html
9956
10059
  <div data-moey-lightbox>
9957
10060
  <a href="photo.jpg"><img src="photo-small.jpg" alt="…"></a>
9958
10061
  <a href="clip.mp4" data-poster="clip-cover.jpg">Video</a> <!-- video -->
9959
10062
  <a href="episode-12.mp3" data-poster="cover.jpg">Listen</a> <!-- audio, with cover art -->
9960
- <a href="https://www.youtube.com/watch?v=…">Watch on YouTube</a> <!-- youtube / vimeo -->
10063
+ <a href="https://player.example.com/embed/…" data-type="embed">Watch</a> <!-- a video site's embed address -->
9961
10064
  <a href="#size-guide">Size guide</a> <!-- HTML from a <template> or element -->
9962
10065
  <a href="menu.pdf" data-type="iframe">Menu (PDF)</a> <!-- a page, a PDF, a map -->
9963
10066
  </div>
@@ -10031,7 +10134,7 @@ gallery.addEventListener('moey:lightbox', (e) => {
10031
10134
  | --- | --- |
10032
10135
  | `data-moey-lightbox` (on a gallery or a link) · `="name"` | Links open in the viewer · links with the same name are one set |
10033
10136
  | `href` · `data-moey-lightbox-src` | What to show (the big version) |
10034
- | `data-type="image\|video\|audio\|youtube\|vimeo\|iframe\|inline"` | The kind (else guessed from the address) |
10137
+ | `data-type="image\|video\|audio\|embed\|iframe\|inline"` | The kind (else guessed from the file type). `embed`: a video player's embed address, in a 16:9 frame; `iframe`: a page, a PDF, a map |
10035
10138
  | `data-caption` · `data-poster` · `data-thumb` · `data-srcset` | Caption · video / audio cover · thumbnail · sharper sources for big screens |
10036
10139
  | `data-moey-lightbox-thumbs\|counter\|caption\|zoom\|loop\|fullscreen\|download\|share\|slideshow` | The parts (see above) |
10037
10140
  | `Moey.lightbox` | `open(items \| link, options)` · `close()` · `next()` · `prev()` · `go(i)` · `index` |
@@ -11393,6 +11496,37 @@ Press Tab to move through them. The ring shows for the keyboard only — a mouse
11393
11496
 
11394
11497
  ---
11395
11498
 
11499
+ # Frosted glass (Helpers)
11500
+
11501
+ ## Frosted glass
11502
+
11503
+ Bars that float over the page (the app header, the tab bar, sticky form buttons) are slightly see-through by default, with no blur, so scrolling stays light even on older phones. Add `.frosted` where you want the frosted-glass look: the page shows through, softly blurred.
11504
+
11505
+ ```html
11506
+ <nav class="tabbar frosted" aria-label="Main">…</nav>
11507
+ <header class="app-topbar frosted">…</header>
11508
+ <div class="form-actions form-actions-sticky frosted">…</div>
11509
+ ```
11510
+
11511
+ ### How it works
11512
+
11513
+ - **The setting:** `--mo-glass` is how solid those bars are, 97% by default. Set it on `:root` to change them all, for example `--mo-glass: 100%` for fully solid bars.
11514
+
11515
+ - **`.frosted`** lowers it to 78% and blurs the page behind. It works on any element with a background; for your own, use `color-mix(in oklab, your color var(--mo-glass), transparent)` so it follows the setting.
11516
+
11517
+ - **The navbar** has its own: `.navbar-blur`.
11518
+
11519
+ - **Why not by default:** the browser redraws a blur every time the page moves behind it. That's fine on a laptop but costs battery and smoothness on older phones, so it's your choice where it's worth it.
11520
+
11521
+ ### Reference
11522
+
11523
+ | Class / variable | What it does |
11524
+ | --- | --- |
11525
+ | `.frosted` | Frosted glass: more see-through (78%), with the page blurred behind |
11526
+ | `--mo-glass` | How solid floating bars are: 97% by default (app header, tab bar, sticky form buttons, chat day labels) |
11527
+
11528
+ ---
11529
+
11396
11530
  # Hover lift (Helpers)
11397
11531
 
11398
11532
  ## Hover lift