@michaelyagi/shoji 0.1.0-beta.5 → 0.1.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,9 +3,9 @@
3
3
  [![CI](https://github.com/MichaelYagi/shoji/actions/workflows/ci.yml/badge.svg)](https://github.com/MichaelYagi/shoji/actions/workflows/ci.yml)
4
4
  [![npm (beta)](https://img.shields.io/npm/v/%40michaelyagi%2Fshoji/beta.svg)](https://www.npmjs.com/package/@michaelyagi/shoji)
5
5
 
6
- A zero-dependency, plugin-first TypeScript lightbox/gallery. Drop in two `<script>`/`<link>` tags, or install from npm — everything beyond the minimal lightbox, including every official plugin, is opt-in.
6
+ > **AI-authored.** 100% of the code was written by Claude (Anthropic); I shaped the architecture, scope, and every decision, and did all the testing.
7
7
 
8
- > **Status: beta.** The API is still settling — expect breaking changes between `0.x` releases.
8
+ A zero-dependency, plugin-first TypeScript lightbox/gallery. Drop in two `<script>`/`<link>` tags, or install from npm — everything beyond the minimal lightbox, including every official plugin, is opt-in.
9
9
 
10
10
  ## Features
11
11
 
@@ -14,7 +14,7 @@ A zero-dependency, plugin-first TypeScript lightbox/gallery. Drop in two `<scrip
14
14
  - **Plugin system** — zoom (pinch/pan/wheel), fullscreen, rotate/flip, autoplay/slideshow, active-thumbnail sync, YouTube video embeds, and a grid/masonry/justified layout engine, each independently opt-in.
15
15
  - **Accessibility is not a plugin** — keyboard nav, focus trapping, ARIA roles, and screen-reader announcements live in core.
16
16
  - **Themeable via CSS custom properties** — no hardcoded colors/sizes in JS.
17
- - **Single-file distribution** — `dist/shoji.js` + `dist/shoji.css` (core + every official plugin, self-registering) for zero-setup `<script>` tag use, plus tree-shakable per-plugin ESM entries for bundler users.
17
+ - **Three distributions** — single-file (`dist/shoji.js` + `dist/shoji.css`, core + every plugin, self-registering) for zero-setup `<script>` tag use; core + individual plugin files (`dist/core/shoji-core.(min.)js` + `dist/plugins/{name}.(min.)js`) for `<script>`-tag consumers who want to pick exactly which plugins ship; and tree-shakable per-plugin ESM entries for bundler users.
18
18
  - Size-budgeted and CI-enforced: core ≤ 21 kB, each plugin ≤ 8 kB, full bundle ≤ 90 kB (all min+gzip).
19
19
 
20
20
  ## Install
@@ -534,8 +534,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
534
534
  const translateY = to.top + to.height / 2 - (from.top + from.height / 2);
535
535
  return `translate3d(${translateX}px, ${translateY}px, 0) scale3d(${scale}, ${scale}, 1)`;
536
536
  }
537
+ function effectiveOriginBox(origin) {
538
+ const img = origin.querySelector("img");
539
+ if (img) {
540
+ const rect = img.getBoundingClientRect();
541
+ if (rect.width > 0 && rect.height > 0) return rect;
542
+ }
543
+ return origin.getBoundingClientRect();
544
+ }
537
545
  function computeTransform(origin, target, aspectRatio, naturalSize) {
538
- const originRect = origin.getBoundingClientRect();
546
+ const originRect = effectiveOriginBox(origin);
539
547
  const targetRect = effectiveTargetBox(target, aspectRatio, naturalSize);
540
548
  if (targetRect.width === 0 || targetRect.height === 0 || originRect.width === 0 || originRect.height === 0) {
541
549
  return null;