@particle-academy/react-fancy 5.61.0 → 5.61.1
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/CHANGELOG.md +39 -0
- package/dist/{chunk-QMCMRQ2G.cjs → chunk-645CRPU6.cjs} +4 -4
- package/dist/{chunk-QMCMRQ2G.cjs.map → chunk-645CRPU6.cjs.map} +1 -1
- package/dist/{chunk-CEZVKKYW.js → chunk-BLS2IGPY.js} +3 -3
- package/dist/{chunk-CEZVKKYW.js.map → chunk-BLS2IGPY.js.map} +1 -1
- package/dist/{chunk-4TTBPEQX.cjs → chunk-BMVYOVSW.cjs} +4 -4
- package/dist/{chunk-4TTBPEQX.cjs.map → chunk-BMVYOVSW.cjs.map} +1 -1
- package/dist/{chunk-NE3BZV3F.js → chunk-CHQH6M67.js} +81 -8
- package/dist/chunk-CHQH6M67.js.map +1 -0
- package/dist/{chunk-UGXBTIV5.js → chunk-NFTTNFQR.js} +3 -3
- package/dist/{chunk-UGXBTIV5.js.map → chunk-NFTTNFQR.js.map} +1 -1
- package/dist/{chunk-O4HZVZMY.cjs → chunk-X6TGRSVH.cjs} +81 -8
- package/dist/chunk-X6TGRSVH.cjs.map +1 -0
- package/dist/editor.cjs +4 -4
- package/dist/editor.d.cts +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.js +2 -2
- package/dist/full-screen.cjs +4 -4
- package/dist/full-screen.d.cts +2 -2
- package/dist/full-screen.d.ts +2 -2
- package/dist/full-screen.js +2 -2
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/mobile-menu.cjs +1 -1
- package/dist/mobile-menu.js +1 -1
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/styles.css +9 -0
- package/dist/styles.css.map +1 -1
- package/dist/{use-full-screen-H2j6qXDB.d.cts → use-full-screen-BUJ1ujG4.d.cts} +10 -1
- package/dist/{use-full-screen-H2j6qXDB.d.ts → use-full-screen-BUJ1ujG4.d.ts} +10 -1
- package/docs/FullScreen.md +14 -3
- package/package.json +1 -1
- package/dist/chunk-NE3BZV3F.js.map +0 -1
- package/dist/chunk-O4HZVZMY.cjs.map +0 -1
package/dist/styles.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/styles.css"],"sourcesContent":["/* @particle-academy/react-fancy — base styles + animations */\n\n/* ─── Brand colour scheme ────────────────────────────────────────────────────\n Three token families every Fancy package can rely on, so a component never\n has to invent a palette or hardcode a literal:\n\n brand one accent — the thing a consumer rebrands first\n primary-* the accent as a full 50→950 scale\n secondary-* the NEUTRAL scale for surfaces, borders and body text\n\n Why this exists: packages were already writing `bg-brand`, `text-primary-600`\n and `border-secondary-200` against tokens nothing defined. Tailwind generated\n no such utility, the class silently resolved to nothing, and the component\n rendered unstyled — correct markup, no colour, no error. Defining them here\n turns those classes into a contract instead of a hope.\n\n SECONDARY INVERTS WITH THE THEME. `text-secondary-900` means \"strongest\n foreground\", not \"nearly black\" — so it stays readable on a dark surface.\n That distinction is the whole point: mixing a literal background (`bg-white`)\n with a semantic foreground (`text-secondary-900`) is what produced\n white-on-white in a dark host.\n\n OVERRIDE IT. Redefine any of these in your own `@theme` (or on `:root`) and\n yours wins — nothing here is `!important`, and the utilities read the variable\n rather than baking a value in:\n\n @theme { --color-brand: var(--color-emerald-600); }\n ──────────────────────────────────────────────────────────────────────────── */\n@theme {\n /* THE HOST'S OWN COLOUR. `color=\"brand\"` on any component resolves to these.\n Three variables, not one: a generated hover assumes \"same hue, darker\",\n and a brand palette need not work that way — a navy whose hover is gold\n cannot be derived from navy. So the host states the hover instead of the\n kit guessing it.\n\n :root {\n --color-brand: #003057;\n --color-brand-contrast: #ffffff; text/icon ON the brand colour\n --color-brand-hover: #D4A017; need not be a shade of brand\n }\n\n PER MODE, SWAP THE PAIR. `--color-brand` and `--color-brand-contrast` only\n mean anything together. Repointing one alone fails QUIETLY -- the button\n still renders, it is just unreadable (a pale surface still carrying white\n text; or, on ghost/outline where brand is the LABEL, dark text on a dark\n background):\n\n .dark { --color-brand: #BFD7EA; --color-brand-contrast: #003057; }\n\n `--color-brand-hover` usually needs no per-mode value: an accent chosen to\n stand against the brand tends to stand against it in both modes.\n\n NOTE: this comment does not survive the build -- `@theme` is emitted\n without it. The consumer-facing copy is in README.md, and that is the one\n to keep correct.\n\n Defaults keep the kit's violet so nothing changes for a host that never\n sets them. Soft/outline/ghost variants derive their tints with opacity\n modifiers (`bg-brand/10`), which is what lets three variables cover four\n variants without asking for a whole scale. */\n --color-brand: var(--color-violet-600);\n --color-brand-contrast: var(--color-white);\n --color-brand-hover: var(--color-violet-700);\n\n --color-primary-50: var(--color-violet-50);\n --color-primary-100: var(--color-violet-100);\n --color-primary-200: var(--color-violet-200);\n --color-primary-300: var(--color-violet-300);\n --color-primary-400: var(--color-violet-400);\n --color-primary-500: var(--color-violet-500);\n --color-primary-600: var(--color-violet-600);\n --color-primary-700: var(--color-violet-700);\n --color-primary-800: var(--color-violet-800);\n --color-primary-900: var(--color-violet-900);\n --color-primary-950: var(--color-violet-950);\n\n /* Light-theme defaults: 50 = faintest surface, 900/950 = strongest text. */\n --color-secondary-50: var(--color-zinc-50);\n --color-secondary-100: var(--color-zinc-100);\n --color-secondary-200: var(--color-zinc-200);\n --color-secondary-300: var(--color-zinc-300);\n --color-secondary-400: var(--color-zinc-400);\n --color-secondary-500: var(--color-zinc-500);\n --color-secondary-600: var(--color-zinc-600);\n --color-secondary-700: var(--color-zinc-700);\n --color-secondary-800: var(--color-zinc-800);\n --color-secondary-900: var(--color-zinc-900);\n --color-secondary-950: var(--color-zinc-950);\n}\n\n@layer base {\n\n/* ─── Progress (circular) — named diameters ──────────────────────────────────\n These ship as real CSS rather than Tailwind classes on the element, because a\n consumer who has not @sourced this package gets no generated utilities and\n the ring would render with NO SIZE at all. They were inline styles before,\n which always worked but could not be overridden by className (issue #17).\n\n Being inside @layer base, a className utility now beats them — which is the\n whole point, and the reason #20 had to land first. */\n[data-react-fancy-progress][data-size=\"sm\"] { width: 2rem; height: 2rem; }\n[data-react-fancy-progress][data-size=\"md\"] { width: 3rem; height: 3rem; }\n[data-react-fancy-progress][data-size=\"lg\"] { width: 4rem; height: 4rem; }\n\n\n\n/* Dark: the neutral scale flips, so \"900\" still means strongest foreground and\n \"50\" still means faintest surface. Wrapped in :where() for zero specificity,\n matching the rest of this file — any consumer override beats it.\n\n EVERY dark selector in this file names `[data-theme=\"dark\"]` beside `.dark`\n (5.53.0). A consumer's `@custom-variant dark` cannot reach these: it rewrites\n `dark:` utilities, never a selector with `.dark` written into it.\n tests/data-theme.test.ts fails on any `.dark` selector without its twin. */\n:where(.dark, [data-theme=\"dark\"]) {\n --color-secondary-50: var(--color-zinc-950);\n --color-secondary-100: var(--color-zinc-900);\n --color-secondary-200: var(--color-zinc-800);\n --color-secondary-300: var(--color-zinc-700);\n --color-secondary-400: var(--color-zinc-600);\n --color-secondary-500: var(--color-zinc-500);\n --color-secondary-600: var(--color-zinc-400);\n --color-secondary-700: var(--color-zinc-300);\n --color-secondary-800: var(--color-zinc-200);\n --color-secondary-900: var(--color-zinc-100);\n --color-secondary-950: var(--color-zinc-50);\n}\n\n/* ─── Input & Field defaults ─────────────────────────────────────────────────\n Better UX out of the box: spacing between stacked fields, smooth transitions,\n and polished dark-mode defaults. All overridable via data-attribute selectors.\n ──────────────────────────────────────────────────────────────────────────── */\n\n/* Field spacing is the CONTAINER's job, not the field's.\n ────────────────────────────────────────────────────────────────────────────\n This used to be:\n\n [data-react-fancy-field] + [data-react-fancy-field] { margin-top: 1rem; }\n\n An adjacent-sibling selector cannot know which way its parent lays children\n out. Stacked vertically it read as spacing; inside a `grid-cols-2` row it\n pushed the right-hand cell 16px down, and `items-start` could not fix it\n because a margin is not alignment. The only escape was wrapping every field\n in a plain <div> so each became an only-child.\n\n Space fields with the container instead — `space-y-4`, or `gap-4` on a flex\n or grid parent. A container knows its own axis; a sibling selector never\n can. See CHANGELOG 5.17.0 for the migration.\n ──────────────────────────────────────────────────────────────────────────── */\n\n/* Smooth transitions on all text inputs, selects, and textareas */\n[data-react-fancy-input] input,\n[data-react-fancy-textarea],\n[data-react-fancy-select],\n[data-react-fancy-date-picker],\n[data-react-fancy-autocomplete] input,\n[data-react-fancy-pillbox],\n[data-react-fancy-otp-input] input,\n[data-react-fancy-time-picker] input,\n[data-react-fancy-color-picker] input {\n transition: border-color 0.15s ease, box-shadow 0.15s ease,\n background-color 0.15s ease;\n}\n\n/* Dark-mode input refinements — slightly darker bg for contrast against page */\n/* ─── Inherent dark-mode defaults ────────────────────────────────────────────\n Every rule below is wrapped in :where() so it carries ZERO specificity, which\n buys two properties at once:\n 1. Inherent — a sensible dark appearance ships out of the box, even when the\n consumer's Tailwind build doesn't generate react-fancy's `dark:` utility\n classes (e.g. they didn't @source the package). This is what lets the\n overlays (Dropdown, Menu, Popover, …) go dark on their own.\n 2. Override-friendly — because specificity is 0, ANY consumer override wins:\n a plain `dark:bg-…` utility, a custom class, or the component's own\n `dark:` class (when it IS generated) all take precedence — no !important,\n no need to target the data-attribute.\n ──────────────────────────────────────────────────────────────────────────── */\n\n/* Every colour below reads a semantic token (`--fancy-<role>-dark`, see\n THEME_TOKENS / README \"Semantic tokens\") with today's value as the fallback,\n so a host that sets nothing sees exactly what it saw before. */\n\n/* Inputs / selects / textareas — darker bg for contrast against the page */\n:where(.dark [data-react-fancy-input] input, [data-theme=\"dark\"] [data-react-fancy-input] input),\n:where(.dark [data-react-fancy-textarea], [data-theme=\"dark\"] [data-react-fancy-textarea]),\n:where(.dark [data-react-fancy-select], [data-theme=\"dark\"] [data-react-fancy-select]),\n:where(.dark [data-react-fancy-date-picker], [data-theme=\"dark\"] [data-react-fancy-date-picker]),\n:where(.dark [data-react-fancy-autocomplete] input, [data-theme=\"dark\"] [data-react-fancy-autocomplete] input),\n:where(.dark [data-react-fancy-pillbox], [data-theme=\"dark\"] [data-react-fancy-pillbox]),\n:where(.dark [data-react-fancy-otp-input] input, [data-theme=\"dark\"] [data-react-fancy-otp-input] input),\n:where(.dark [data-react-fancy-time-picker] input, [data-theme=\"dark\"] [data-react-fancy-time-picker] input) {\n background-color: var(--fancy-input-dark, #1e1e24);\n border-color: var(--fancy-border-strong-dark, #3f3f46);\n}\n\n/* Focus ring — brighter border + subtle glow */\n:where(.dark [data-react-fancy-input] input:focus, [data-theme=\"dark\"] [data-react-fancy-input] input:focus),\n:where(.dark [data-react-fancy-textarea]:focus, [data-theme=\"dark\"] [data-react-fancy-textarea]:focus),\n:where(.dark [data-react-fancy-select]:focus, [data-theme=\"dark\"] [data-react-fancy-select]:focus),\n:where(.dark [data-react-fancy-date-picker]:focus, [data-theme=\"dark\"] [data-react-fancy-date-picker]:focus),\n:where(.dark [data-react-fancy-autocomplete] input:focus, [data-theme=\"dark\"] [data-react-fancy-autocomplete] input:focus),\n:where(.dark [data-react-fancy-otp-input] input:focus, [data-theme=\"dark\"] [data-react-fancy-otp-input] input:focus),\n:where(.dark [data-react-fancy-time-picker] input:focus, [data-theme=\"dark\"] [data-react-fancy-time-picker] input:focus) {\n border-color: var(--fancy-focus-dark, #60a5fa);\n /* = rgba(96, 165, 250, 0.15) when the token is unset */\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--fancy-focus-dark, #60a5fa) 15%, transparent);\n}\n\n/* Field labels — brighter for readability */\n:where(.dark [data-react-fancy-field] > label:first-child, [data-theme=\"dark\"] [data-react-fancy-field] > label:first-child) {\n color: var(--fancy-text-dark, #f4f4f5);\n}\n\n/* Checkbox & radio */\n:where(.dark [data-react-fancy-checkbox] input, [data-theme=\"dark\"] [data-react-fancy-checkbox] input),\n:where(.dark [data-react-fancy-radio-group] input, [data-theme=\"dark\"] [data-react-fancy-radio-group] input) {\n background-color: var(--fancy-input-dark, #1e1e24);\n border-color: var(--fancy-border-strong-dark, #3f3f46);\n}\n\n/* Switch unchecked track */\n:where(.dark [data-react-fancy-switch] button[aria-checked=\"false\"], [data-theme=\"dark\"] [data-react-fancy-switch] button[aria-checked=\"false\"]) {\n background-color: var(--fancy-border-dark, #3f3f46);\n}\n\n/* Input wrapper affixes */\n:where(.dark [data-react-fancy-input-wrapper] > span:first-child, [data-theme=\"dark\"] [data-react-fancy-input-wrapper] > span:first-child),\n:where(.dark [data-react-fancy-input-wrapper] > span:last-child, [data-theme=\"dark\"] [data-react-fancy-input-wrapper] > span:last-child) {\n border-color: var(--fancy-border-strong-dark, #3f3f46);\n background-color: var(--fancy-surface-muted-dark, #27272a);\n}\n\n/* Date picker icon (calendar, clock) */\n:where(.dark [data-react-fancy-date-picker]::-webkit-calendar-picker-indicator, [data-theme=\"dark\"] [data-react-fancy-date-picker]::-webkit-calendar-picker-indicator) {\n filter: invert(0.8);\n}\n\n/* ─── Overlays — inherent dark surfaces ──────────────────────────────────────\n Dropdown / Menu / Popover / ContextMenu / MobileMenu flyout / Modal / Toast.\n Mirrors the components' own `dark:` utilities (zinc-900 surface, zinc-700\n border, zinc-300 text) so overlays render correctly in dark mode WITHOUT the\n consumer @sourcing react-fancy. When those utilities ARE generated they win\n (specificity 0 here), so there's no drift or double-styling. */\n:where(.dark [data-react-fancy-dropdown], [data-theme=\"dark\"] [data-react-fancy-dropdown]),\n:where(.dark [data-react-fancy-menu], [data-theme=\"dark\"] [data-react-fancy-menu]),\n:where(.dark [data-react-fancy-popover], [data-theme=\"dark\"] [data-react-fancy-popover]),\n:where(.dark [data-react-fancy-context-menu], [data-theme=\"dark\"] [data-react-fancy-context-menu]),\n:where(.dark [data-react-fancy-context-menu-sub-content], [data-theme=\"dark\"] [data-react-fancy-context-menu-sub-content]),\n:where(.dark [data-react-fancy-mobile-menu-flyout], [data-theme=\"dark\"] [data-react-fancy-mobile-menu-flyout]),\n:where(.dark [data-react-fancy-modal], [data-theme=\"dark\"] [data-react-fancy-modal]),\n:where(.dark [data-react-fancy-toast-item], [data-theme=\"dark\"] [data-react-fancy-toast-item]) {\n background-color: var(--fancy-surface-dark, #18181b); /* zinc-900 */\n border-color: var(--fancy-border-dark, #3f3f46); /* zinc-700 */\n color: var(--fancy-text-soft-dark, #d4d4d8); /* zinc-300 */\n}\n\n/* Overlay item hover states */\n:where(.dark [data-react-fancy-dropdown-item]:hover, [data-theme=\"dark\"] [data-react-fancy-dropdown-item]:hover),\n:where(.dark [data-react-fancy-menu-item]:hover, [data-theme=\"dark\"] [data-react-fancy-menu-item]:hover),\n:where(.dark [data-react-fancy-context-menu-item]:hover, [data-theme=\"dark\"] [data-react-fancy-context-menu-item]:hover) {\n background-color: var(--fancy-surface-muted-dark, #27272a); /* zinc-800 */\n}\n\n/* Overlay separators */\n:where(.dark [data-react-fancy-dropdown-separator], [data-theme=\"dark\"] [data-react-fancy-dropdown-separator]),\n:where(.dark [data-react-fancy-context-menu-separator], [data-theme=\"dark\"] [data-react-fancy-context-menu-separator]) {\n background-color: var(--fancy-border-dark, #3f3f46); /* zinc-700 */\n}\n\n/* ─── Media viewer — transparency checkerboard ───────────────────────────────\n Backdrop for <ImageViewer> / <MediaViewer> so transparent images read clearly.\n Light + dark variants; the dark rule is wrapped in :where() (zero specificity)\n so it ships out of the box without the consumer @sourcing react-fancy. */\n.fancy-checkerboard {\n background-color: #ffffff;\n background-image:\n linear-gradient(45deg, #e5e7eb 25%, transparent 25%),\n linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #e5e7eb 75%),\n linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n}\n\n:where(.dark, [data-theme=\"dark\"]) .fancy-checkerboard {\n background-color: #18181b; /* zinc-900 */\n background-image:\n linear-gradient(45deg, #27272a 25%, transparent 25%),\n linear-gradient(-45deg, #27272a 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #27272a 75%),\n linear-gradient(-45deg, transparent 75%, #27272a 75%);\n}\n}\n\n\n@keyframes fancy-fade-in {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-slide-left {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes fancy-slide-right {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@layer base {\n\n\n.fancy-fade-in {\n animation: fancy-fade-in 0.2s ease-out;\n}\n\n.fancy-slide-left {\n animation: fancy-slide-left 0.3s ease-out;\n}\n\n.fancy-slide-right {\n animation: fancy-slide-right 0.3s ease-out;\n}\n}\n\n\n/* Overlay / floating animations */\n\n@keyframes fancy-scale-in {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes fancy-slide-up {\n from {\n opacity: 0;\n transform: translateY(16px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes fancy-toast-in {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes fancy-collapse-open {\n from {\n grid-template-rows: 0fr;\n }\n to {\n grid-template-rows: 1fr;\n }\n}\n\n@keyframes fancy-collapse-close {\n from {\n grid-template-rows: 1fr;\n }\n to {\n grid-template-rows: 0fr;\n }\n}\n\n@layer base {\n\n\n.fancy-scale-in {\n animation: fancy-scale-in 0.15s ease-out;\n}\n\n.fancy-slide-up {\n animation: fancy-slide-up 0.2s ease-out;\n}\n\n.fancy-fade-out {\n animation: fancy-fade-out 0.15s ease-in forwards;\n}\n\n.fancy-toast-in {\n animation: fancy-toast-in 0.3s ease-out;\n}\n\n.fancy-collapse-open {\n animation: fancy-collapse-open 0.2s ease-out forwards;\n}\n\n.fancy-collapse-close {\n animation: fancy-collapse-close 0.15s ease-in forwards;\n}\n}\n\n\n/* Mobile flyout slide animations */\n\n@keyframes fancy-slide-in-left {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes fancy-slide-out-left {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-100%);\n }\n}\n\n@keyframes fancy-slide-in-right {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n/* Avatar glow — a looping halo ring (box-shadow only, no reflow). Color comes\n from the --fancy-glow custom property set on the element. */\n@keyframes fancy-avatar-glow {\n 0% {\n box-shadow: 0 0 0 0 color-mix(in srgb, var(--fancy-glow, #a855f7) 55%, transparent);\n opacity: 0.9;\n }\n 70% {\n box-shadow: 0 0 0 6px color-mix(in srgb, var(--fancy-glow, #a855f7) 0%, transparent);\n opacity: 0.5;\n }\n 100% {\n box-shadow: 0 0 0 0 color-mix(in srgb, var(--fancy-glow, #a855f7) 0%, transparent);\n opacity: 0.9;\n }\n}\n\n@layer base {\n\n\n.fancy-avatar-glow {\n position: absolute;\n inset: 0;\n border-radius: 9999px;\n pointer-events: none;\n box-shadow:\n 0 0 0 2px color-mix(in srgb, var(--fancy-glow, #a855f7) 70%, transparent),\n 0 0 10px 0 color-mix(in srgb, var(--fancy-glow, #a855f7) 45%, transparent);\n animation: fancy-avatar-glow 1.6s ease-out infinite;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fancy-avatar-glow {\n animation: none;\n }\n}\n}\n\n\n@keyframes fancy-slide-out-right {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@layer base {\n\n\n.fancy-slide-in-left {\n animation: fancy-slide-in-left 0.25s ease-out;\n}\n\n.fancy-slide-out-left {\n animation: fancy-slide-out-left 0.2s ease-in forwards;\n}\n\n.fancy-slide-in-right {\n animation: fancy-slide-in-right 0.25s ease-out;\n}\n\n.fancy-slide-out-right {\n animation: fancy-slide-out-right 0.2s ease-in forwards;\n}\n}\n\n\n/* Vertical drawer edges. The horizontal pair above predates Drawer (it was\n built for MobileMenu.Flyout, which only ever opened left/right); these\n complete the set so `side=\"top\"`/`side=\"bottom\"` animate rather than pop. */\n\n@keyframes fancy-slide-in-top {\n from {\n transform: translateY(-100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-slide-out-top {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-100%);\n }\n}\n\n@keyframes fancy-slide-in-bottom {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-slide-out-bottom {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(100%);\n }\n}\n\n@layer base {\n\n\n.fancy-slide-in-top {\n animation: fancy-slide-in-top 0.25s ease-out;\n}\n\n.fancy-slide-out-top {\n animation: fancy-slide-out-top 0.2s ease-in forwards;\n}\n\n.fancy-slide-in-bottom {\n animation: fancy-slide-in-bottom 0.25s ease-out;\n}\n\n.fancy-slide-out-bottom {\n animation: fancy-slide-out-bottom 0.2s ease-in forwards;\n}\n\n/* Reduced motion collapses the travel to a ~0 duration. Since 5.51.0\n `useAnimation` also unmounts when no animation runs at all, so this is no\n longer what keeps a closed drawer from staying in the DOM — but a ~0 duration\n keeps the exit on the same path as every other close. */\n@media (prefers-reduced-motion: reduce) {\n .fancy-slide-in-left,\n .fancy-slide-out-left,\n .fancy-slide-in-right,\n .fancy-slide-out-right,\n .fancy-slide-in-top,\n .fancy-slide-out-top,\n .fancy-slide-in-bottom,\n .fancy-slide-out-bottom {\n animation-duration: 0.01ms;\n }\n}\n\n/* ─── Marquee ────────────────────────────────────────────────────────────────\n Edge-to-edge auto-scrolling strip. The track holds two identical copies of\n the content; translateX(-50%) over one loop shifts exactly one copy, so the\n wrap is seamless. Duration/gap/fade arrive as custom properties set by the\n component. No animation under prefers-reduced-motion.\n ──────────────────────────────────────────────────────────────────────────── */\n\n[data-react-fancy-marquee] {\n overflow: hidden;\n width: 100%;\n}\n\n.fancy-marquee--fade {\n -webkit-mask-image: linear-gradient(\n to right,\n transparent,\n black var(--fancy-marquee-fade, 48px),\n black calc(100% - var(--fancy-marquee-fade, 48px)),\n transparent\n );\n mask-image: linear-gradient(\n to right,\n transparent,\n black var(--fancy-marquee-fade, 48px),\n black calc(100% - var(--fancy-marquee-fade, 48px)),\n transparent\n );\n}\n\n.fancy-marquee__track {\n display: flex;\n width: max-content;\n animation: fancy-marquee var(--fancy-marquee-duration, 40s) linear infinite;\n will-change: transform;\n}\n\n[data-react-fancy-marquee][data-direction=\"right\"] .fancy-marquee__track {\n animation-direction: reverse;\n}\n\n.fancy-marquee--pause-hover:hover .fancy-marquee__track,\n[data-react-fancy-marquee][data-paused] .fancy-marquee__track {\n animation-play-state: paused;\n}\n\n.fancy-marquee__group {\n display: flex;\n flex: none;\n}\n\n.fancy-marquee__unit {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--fancy-marquee-gap, 40px);\n padding-inline-end: var(--fancy-marquee-gap, 40px);\n white-space: nowrap;\n}\n\n.fancy-marquee__item,\n.fancy-marquee__separator {\n flex: none;\n}\n}\n\n\n@keyframes fancy-marquee {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-50%);\n }\n}\n\n@layer base {\n\n\n@media (prefers-reduced-motion: reduce) {\n .fancy-marquee__track {\n animation: none;\n }\n}\n}\n\n"],"mappings":";AA4BA,OAAO,EAgCL,aAAa,EAAE,IAAI,mBAAmB,EACtC,sBAAsB,EAAE,IAAI,cAAc,EAC1C,mBAAmB,EAAE,IAAI,mBAAmB,EAE5C,kBAAkB,EAAE,IAAI,kBAAkB,EAC1C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EA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F;AASA,GAAC;AACC,cAAU;AACV,WAAO;AACT;AAEA,GAAC;AACC;AAAA,MAAoB;AAAA,QAClB,GAAG,KAAK;AAAA,QACR,WAAW;AAAA,QACX,MAAM,IAAI,oBAAoB,EAAE,KAAK;AAAA,QACrC,MAAM,KAAK,KAAK,EAAE,IAAI,oBAAoB,EAAE,MAAM;AAAA,QAClD;AAEF;AAAA,MAAY;AAAA,QACV,GAAG,KAAK;AAAA,QACR,WAAW;AAAA,QACX,MAAM,IAAI,oBAAoB,EAAE,KAAK;AAAA,QACrC,MAAM,KAAK,KAAK,EAAE,IAAI,oBAAoB,EAAE,MAAM;AAAA,QAClD;AAEJ;AAEA,GAAC;AACC,aAAS;AACT,WAAO;AACP,eAAW,cAAc,IAAI,wBAAwB,EAAE,KAAK,OAAO;AACnE,iBAAa;AACf;AAEA,GAAC,yBAAyB,CAAC,sBAAwB,CAPlD;AAQC,yBAAqB;AACvB;AAEA,GAAC,0BAA0B,OAAO,CAXjC;AAAA,EAYD,CAAC,yBAAyB,CAAC,aAAa,CAZvC;AAaC,0BAAsB;AACxB;AAEA,GAAC;AACC,aAAS;AACT,UAAM;AACR;AAEA,GAAC;AACC,aAAS;AACT,UAAM;AACN,iBAAa;AACb,SAAK,IAAI,mBAAmB,EAAE;AAC9B,wBAAoB,IAAI,mBAAmB,EAAE;AAC7C,iBAAa;AACf;AAEA,GAAC;AAAA,EACD,CAAC;AACC,UAAM;AACR;AACA;AAGA,WAlCa;AAmCX;AACE,eAAW,WAAW;AACxB;AACA;AACE,eAAW,WAAW;AACxB;AACF;AAEA;AAGA,UAAO,wBAAyB;AAC9B,KAlDD;AAmDG,iBAAW;AACb;AACF;AACA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/styles.css"],"sourcesContent":["/* @particle-academy/react-fancy — base styles + animations */\n\n/* ─── Brand colour scheme ────────────────────────────────────────────────────\n Three token families every Fancy package can rely on, so a component never\n has to invent a palette or hardcode a literal:\n\n brand one accent — the thing a consumer rebrands first\n primary-* the accent as a full 50→950 scale\n secondary-* the NEUTRAL scale for surfaces, borders and body text\n\n Why this exists: packages were already writing `bg-brand`, `text-primary-600`\n and `border-secondary-200` against tokens nothing defined. Tailwind generated\n no such utility, the class silently resolved to nothing, and the component\n rendered unstyled — correct markup, no colour, no error. Defining them here\n turns those classes into a contract instead of a hope.\n\n SECONDARY INVERTS WITH THE THEME. `text-secondary-900` means \"strongest\n foreground\", not \"nearly black\" — so it stays readable on a dark surface.\n That distinction is the whole point: mixing a literal background (`bg-white`)\n with a semantic foreground (`text-secondary-900`) is what produced\n white-on-white in a dark host.\n\n OVERRIDE IT. Redefine any of these in your own `@theme` (or on `:root`) and\n yours wins — nothing here is `!important`, and the utilities read the variable\n rather than baking a value in:\n\n @theme { --color-brand: var(--color-emerald-600); }\n ──────────────────────────────────────────────────────────────────────────── */\n@theme {\n /* THE HOST'S OWN COLOUR. `color=\"brand\"` on any component resolves to these.\n Three variables, not one: a generated hover assumes \"same hue, darker\",\n and a brand palette need not work that way — a navy whose hover is gold\n cannot be derived from navy. So the host states the hover instead of the\n kit guessing it.\n\n :root {\n --color-brand: #003057;\n --color-brand-contrast: #ffffff; text/icon ON the brand colour\n --color-brand-hover: #D4A017; need not be a shade of brand\n }\n\n PER MODE, SWAP THE PAIR. `--color-brand` and `--color-brand-contrast` only\n mean anything together. Repointing one alone fails QUIETLY -- the button\n still renders, it is just unreadable (a pale surface still carrying white\n text; or, on ghost/outline where brand is the LABEL, dark text on a dark\n background):\n\n .dark { --color-brand: #BFD7EA; --color-brand-contrast: #003057; }\n\n `--color-brand-hover` usually needs no per-mode value: an accent chosen to\n stand against the brand tends to stand against it in both modes.\n\n NOTE: this comment does not survive the build -- `@theme` is emitted\n without it. The consumer-facing copy is in README.md, and that is the one\n to keep correct.\n\n Defaults keep the kit's violet so nothing changes for a host that never\n sets them. Soft/outline/ghost variants derive their tints with opacity\n modifiers (`bg-brand/10`), which is what lets three variables cover four\n variants without asking for a whole scale. */\n --color-brand: var(--color-violet-600);\n --color-brand-contrast: var(--color-white);\n --color-brand-hover: var(--color-violet-700);\n\n --color-primary-50: var(--color-violet-50);\n --color-primary-100: var(--color-violet-100);\n --color-primary-200: var(--color-violet-200);\n --color-primary-300: var(--color-violet-300);\n --color-primary-400: var(--color-violet-400);\n --color-primary-500: var(--color-violet-500);\n --color-primary-600: var(--color-violet-600);\n --color-primary-700: var(--color-violet-700);\n --color-primary-800: var(--color-violet-800);\n --color-primary-900: var(--color-violet-900);\n --color-primary-950: var(--color-violet-950);\n\n /* Light-theme defaults: 50 = faintest surface, 900/950 = strongest text. */\n --color-secondary-50: var(--color-zinc-50);\n --color-secondary-100: var(--color-zinc-100);\n --color-secondary-200: var(--color-zinc-200);\n --color-secondary-300: var(--color-zinc-300);\n --color-secondary-400: var(--color-zinc-400);\n --color-secondary-500: var(--color-zinc-500);\n --color-secondary-600: var(--color-zinc-600);\n --color-secondary-700: var(--color-zinc-700);\n --color-secondary-800: var(--color-zinc-800);\n --color-secondary-900: var(--color-zinc-900);\n --color-secondary-950: var(--color-zinc-950);\n}\n\n/* ─── Full screen in the top layer — neutralise the UA popover box ───────────\n An overlay-mode FullScreen is promoted with popover=\"manual\" so ancestor\n transforms / filters cannot trap it, and the UA sheet then styles it as a\n popover: padding .25em, a solid border, Canvas / CanvasText colours,\n overflow:auto. Any author rule outranks the UA origin, so this zero-\n specificity rule in the base layer puts those back to what a plain box has,\n while every utility a consumer passes through className still wins. Inline\n styles could not do that: they would beat the consumer's own classes. The\n box geometry (inset, width, height, margin) is set inline by the hook. */\n@layer base {\n :where([data-fullscreen-layer=\"top\"]) {\n padding: 0;\n border: 0 solid;\n background-color: transparent;\n color: inherit;\n overflow: visible;\n }\n}\n\n@layer base {\n\n/* ─── Progress (circular) — named diameters ──────────────────────────────────\n These ship as real CSS rather than Tailwind classes on the element, because a\n consumer who has not @sourced this package gets no generated utilities and\n the ring would render with NO SIZE at all. They were inline styles before,\n which always worked but could not be overridden by className (issue #17).\n\n Being inside @layer base, a className utility now beats them — which is the\n whole point, and the reason #20 had to land first. */\n[data-react-fancy-progress][data-size=\"sm\"] { width: 2rem; height: 2rem; }\n[data-react-fancy-progress][data-size=\"md\"] { width: 3rem; height: 3rem; }\n[data-react-fancy-progress][data-size=\"lg\"] { width: 4rem; height: 4rem; }\n\n\n\n/* Dark: the neutral scale flips, so \"900\" still means strongest foreground and\n \"50\" still means faintest surface. Wrapped in :where() for zero specificity,\n matching the rest of this file — any consumer override beats it.\n\n EVERY dark selector in this file names `[data-theme=\"dark\"]` beside `.dark`\n (5.53.0). A consumer's `@custom-variant dark` cannot reach these: it rewrites\n `dark:` utilities, never a selector with `.dark` written into it.\n tests/data-theme.test.ts fails on any `.dark` selector without its twin. */\n:where(.dark, [data-theme=\"dark\"]) {\n --color-secondary-50: var(--color-zinc-950);\n --color-secondary-100: var(--color-zinc-900);\n --color-secondary-200: var(--color-zinc-800);\n --color-secondary-300: var(--color-zinc-700);\n --color-secondary-400: var(--color-zinc-600);\n --color-secondary-500: var(--color-zinc-500);\n --color-secondary-600: var(--color-zinc-400);\n --color-secondary-700: var(--color-zinc-300);\n --color-secondary-800: var(--color-zinc-200);\n --color-secondary-900: var(--color-zinc-100);\n --color-secondary-950: var(--color-zinc-50);\n}\n\n/* ─── Input & Field defaults ─────────────────────────────────────────────────\n Better UX out of the box: spacing between stacked fields, smooth transitions,\n and polished dark-mode defaults. All overridable via data-attribute selectors.\n ──────────────────────────────────────────────────────────────────────────── */\n\n/* Field spacing is the CONTAINER's job, not the field's.\n ────────────────────────────────────────────────────────────────────────────\n This used to be:\n\n [data-react-fancy-field] + [data-react-fancy-field] { margin-top: 1rem; }\n\n An adjacent-sibling selector cannot know which way its parent lays children\n out. Stacked vertically it read as spacing; inside a `grid-cols-2` row it\n pushed the right-hand cell 16px down, and `items-start` could not fix it\n because a margin is not alignment. The only escape was wrapping every field\n in a plain <div> so each became an only-child.\n\n Space fields with the container instead — `space-y-4`, or `gap-4` on a flex\n or grid parent. A container knows its own axis; a sibling selector never\n can. See CHANGELOG 5.17.0 for the migration.\n ──────────────────────────────────────────────────────────────────────────── */\n\n/* Smooth transitions on all text inputs, selects, and textareas */\n[data-react-fancy-input] input,\n[data-react-fancy-textarea],\n[data-react-fancy-select],\n[data-react-fancy-date-picker],\n[data-react-fancy-autocomplete] input,\n[data-react-fancy-pillbox],\n[data-react-fancy-otp-input] input,\n[data-react-fancy-time-picker] input,\n[data-react-fancy-color-picker] input {\n transition: border-color 0.15s ease, box-shadow 0.15s ease,\n background-color 0.15s ease;\n}\n\n/* Dark-mode input refinements — slightly darker bg for contrast against page */\n/* ─── Inherent dark-mode defaults ────────────────────────────────────────────\n Every rule below is wrapped in :where() so it carries ZERO specificity, which\n buys two properties at once:\n 1. Inherent — a sensible dark appearance ships out of the box, even when the\n consumer's Tailwind build doesn't generate react-fancy's `dark:` utility\n classes (e.g. they didn't @source the package). This is what lets the\n overlays (Dropdown, Menu, Popover, …) go dark on their own.\n 2. Override-friendly — because specificity is 0, ANY consumer override wins:\n a plain `dark:bg-…` utility, a custom class, or the component's own\n `dark:` class (when it IS generated) all take precedence — no !important,\n no need to target the data-attribute.\n ──────────────────────────────────────────────────────────────────────────── */\n\n/* Every colour below reads a semantic token (`--fancy-<role>-dark`, see\n THEME_TOKENS / README \"Semantic tokens\") with today's value as the fallback,\n so a host that sets nothing sees exactly what it saw before. */\n\n/* Inputs / selects / textareas — darker bg for contrast against the page */\n:where(.dark [data-react-fancy-input] input, [data-theme=\"dark\"] [data-react-fancy-input] input),\n:where(.dark [data-react-fancy-textarea], [data-theme=\"dark\"] [data-react-fancy-textarea]),\n:where(.dark [data-react-fancy-select], [data-theme=\"dark\"] [data-react-fancy-select]),\n:where(.dark [data-react-fancy-date-picker], [data-theme=\"dark\"] [data-react-fancy-date-picker]),\n:where(.dark [data-react-fancy-autocomplete] input, [data-theme=\"dark\"] [data-react-fancy-autocomplete] input),\n:where(.dark [data-react-fancy-pillbox], [data-theme=\"dark\"] [data-react-fancy-pillbox]),\n:where(.dark [data-react-fancy-otp-input] input, [data-theme=\"dark\"] [data-react-fancy-otp-input] input),\n:where(.dark [data-react-fancy-time-picker] input, [data-theme=\"dark\"] [data-react-fancy-time-picker] input) {\n background-color: var(--fancy-input-dark, #1e1e24);\n border-color: var(--fancy-border-strong-dark, #3f3f46);\n}\n\n/* Focus ring — brighter border + subtle glow */\n:where(.dark [data-react-fancy-input] input:focus, [data-theme=\"dark\"] [data-react-fancy-input] input:focus),\n:where(.dark [data-react-fancy-textarea]:focus, [data-theme=\"dark\"] [data-react-fancy-textarea]:focus),\n:where(.dark [data-react-fancy-select]:focus, [data-theme=\"dark\"] [data-react-fancy-select]:focus),\n:where(.dark [data-react-fancy-date-picker]:focus, [data-theme=\"dark\"] [data-react-fancy-date-picker]:focus),\n:where(.dark [data-react-fancy-autocomplete] input:focus, [data-theme=\"dark\"] [data-react-fancy-autocomplete] input:focus),\n:where(.dark [data-react-fancy-otp-input] input:focus, [data-theme=\"dark\"] [data-react-fancy-otp-input] input:focus),\n:where(.dark [data-react-fancy-time-picker] input:focus, [data-theme=\"dark\"] [data-react-fancy-time-picker] input:focus) {\n border-color: var(--fancy-focus-dark, #60a5fa);\n /* = rgba(96, 165, 250, 0.15) when the token is unset */\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--fancy-focus-dark, #60a5fa) 15%, transparent);\n}\n\n/* Field labels — brighter for readability */\n:where(.dark [data-react-fancy-field] > label:first-child, [data-theme=\"dark\"] [data-react-fancy-field] > label:first-child) {\n color: var(--fancy-text-dark, #f4f4f5);\n}\n\n/* Checkbox & radio */\n:where(.dark [data-react-fancy-checkbox] input, [data-theme=\"dark\"] [data-react-fancy-checkbox] input),\n:where(.dark [data-react-fancy-radio-group] input, [data-theme=\"dark\"] [data-react-fancy-radio-group] input) {\n background-color: var(--fancy-input-dark, #1e1e24);\n border-color: var(--fancy-border-strong-dark, #3f3f46);\n}\n\n/* Switch unchecked track */\n:where(.dark [data-react-fancy-switch] button[aria-checked=\"false\"], [data-theme=\"dark\"] [data-react-fancy-switch] button[aria-checked=\"false\"]) {\n background-color: var(--fancy-border-dark, #3f3f46);\n}\n\n/* Input wrapper affixes */\n:where(.dark [data-react-fancy-input-wrapper] > span:first-child, [data-theme=\"dark\"] [data-react-fancy-input-wrapper] > span:first-child),\n:where(.dark [data-react-fancy-input-wrapper] > span:last-child, [data-theme=\"dark\"] [data-react-fancy-input-wrapper] > span:last-child) {\n border-color: var(--fancy-border-strong-dark, #3f3f46);\n background-color: var(--fancy-surface-muted-dark, #27272a);\n}\n\n/* Date picker icon (calendar, clock) */\n:where(.dark [data-react-fancy-date-picker]::-webkit-calendar-picker-indicator, [data-theme=\"dark\"] [data-react-fancy-date-picker]::-webkit-calendar-picker-indicator) {\n filter: invert(0.8);\n}\n\n/* ─── Overlays — inherent dark surfaces ──────────────────────────────────────\n Dropdown / Menu / Popover / ContextMenu / MobileMenu flyout / Modal / Toast.\n Mirrors the components' own `dark:` utilities (zinc-900 surface, zinc-700\n border, zinc-300 text) so overlays render correctly in dark mode WITHOUT the\n consumer @sourcing react-fancy. When those utilities ARE generated they win\n (specificity 0 here), so there's no drift or double-styling. */\n:where(.dark [data-react-fancy-dropdown], [data-theme=\"dark\"] [data-react-fancy-dropdown]),\n:where(.dark [data-react-fancy-menu], [data-theme=\"dark\"] [data-react-fancy-menu]),\n:where(.dark [data-react-fancy-popover], [data-theme=\"dark\"] [data-react-fancy-popover]),\n:where(.dark [data-react-fancy-context-menu], [data-theme=\"dark\"] [data-react-fancy-context-menu]),\n:where(.dark [data-react-fancy-context-menu-sub-content], [data-theme=\"dark\"] [data-react-fancy-context-menu-sub-content]),\n:where(.dark [data-react-fancy-mobile-menu-flyout], [data-theme=\"dark\"] [data-react-fancy-mobile-menu-flyout]),\n:where(.dark [data-react-fancy-modal], [data-theme=\"dark\"] [data-react-fancy-modal]),\n:where(.dark [data-react-fancy-toast-item], [data-theme=\"dark\"] [data-react-fancy-toast-item]) {\n background-color: var(--fancy-surface-dark, #18181b); /* zinc-900 */\n border-color: var(--fancy-border-dark, #3f3f46); /* zinc-700 */\n color: var(--fancy-text-soft-dark, #d4d4d8); /* zinc-300 */\n}\n\n/* Overlay item hover states */\n:where(.dark [data-react-fancy-dropdown-item]:hover, [data-theme=\"dark\"] [data-react-fancy-dropdown-item]:hover),\n:where(.dark [data-react-fancy-menu-item]:hover, [data-theme=\"dark\"] [data-react-fancy-menu-item]:hover),\n:where(.dark [data-react-fancy-context-menu-item]:hover, [data-theme=\"dark\"] [data-react-fancy-context-menu-item]:hover) {\n background-color: var(--fancy-surface-muted-dark, #27272a); /* zinc-800 */\n}\n\n/* Overlay separators */\n:where(.dark [data-react-fancy-dropdown-separator], [data-theme=\"dark\"] [data-react-fancy-dropdown-separator]),\n:where(.dark [data-react-fancy-context-menu-separator], [data-theme=\"dark\"] [data-react-fancy-context-menu-separator]) {\n background-color: var(--fancy-border-dark, #3f3f46); /* zinc-700 */\n}\n\n/* ─── Media viewer — transparency checkerboard ───────────────────────────────\n Backdrop for <ImageViewer> / <MediaViewer> so transparent images read clearly.\n Light + dark variants; the dark rule is wrapped in :where() (zero specificity)\n so it ships out of the box without the consumer @sourcing react-fancy. */\n.fancy-checkerboard {\n background-color: #ffffff;\n background-image:\n linear-gradient(45deg, #e5e7eb 25%, transparent 25%),\n linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #e5e7eb 75%),\n linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);\n background-size: 16px 16px;\n background-position: 0 0, 0 8px, 8px -8px, -8px 0;\n}\n\n:where(.dark, [data-theme=\"dark\"]) .fancy-checkerboard {\n background-color: #18181b; /* zinc-900 */\n background-image:\n linear-gradient(45deg, #27272a 25%, transparent 25%),\n linear-gradient(-45deg, #27272a 25%, transparent 25%),\n linear-gradient(45deg, transparent 75%, #27272a 75%),\n linear-gradient(-45deg, transparent 75%, #27272a 75%);\n}\n}\n\n\n@keyframes fancy-fade-in {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-slide-left {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes fancy-slide-right {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@layer base {\n\n\n.fancy-fade-in {\n animation: fancy-fade-in 0.2s ease-out;\n}\n\n.fancy-slide-left {\n animation: fancy-slide-left 0.3s ease-out;\n}\n\n.fancy-slide-right {\n animation: fancy-slide-right 0.3s ease-out;\n}\n}\n\n\n/* Overlay / floating animations */\n\n@keyframes fancy-scale-in {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@keyframes fancy-slide-up {\n from {\n opacity: 0;\n transform: translateY(16px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n@keyframes fancy-toast-in {\n from {\n opacity: 0;\n transform: translateX(100%);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n}\n\n@keyframes fancy-collapse-open {\n from {\n grid-template-rows: 0fr;\n }\n to {\n grid-template-rows: 1fr;\n }\n}\n\n@keyframes fancy-collapse-close {\n from {\n grid-template-rows: 1fr;\n }\n to {\n grid-template-rows: 0fr;\n }\n}\n\n@layer base {\n\n\n.fancy-scale-in {\n animation: fancy-scale-in 0.15s ease-out;\n}\n\n.fancy-slide-up {\n animation: fancy-slide-up 0.2s ease-out;\n}\n\n.fancy-fade-out {\n animation: fancy-fade-out 0.15s ease-in forwards;\n}\n\n.fancy-toast-in {\n animation: fancy-toast-in 0.3s ease-out;\n}\n\n.fancy-collapse-open {\n animation: fancy-collapse-open 0.2s ease-out forwards;\n}\n\n.fancy-collapse-close {\n animation: fancy-collapse-close 0.15s ease-in forwards;\n}\n}\n\n\n/* Mobile flyout slide animations */\n\n@keyframes fancy-slide-in-left {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n@keyframes fancy-slide-out-left {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-100%);\n }\n}\n\n@keyframes fancy-slide-in-right {\n from {\n transform: translateX(100%);\n }\n to {\n transform: translateX(0);\n }\n}\n\n/* Avatar glow — a looping halo ring (box-shadow only, no reflow). Color comes\n from the --fancy-glow custom property set on the element. */\n@keyframes fancy-avatar-glow {\n 0% {\n box-shadow: 0 0 0 0 color-mix(in srgb, var(--fancy-glow, #a855f7) 55%, transparent);\n opacity: 0.9;\n }\n 70% {\n box-shadow: 0 0 0 6px color-mix(in srgb, var(--fancy-glow, #a855f7) 0%, transparent);\n opacity: 0.5;\n }\n 100% {\n box-shadow: 0 0 0 0 color-mix(in srgb, var(--fancy-glow, #a855f7) 0%, transparent);\n opacity: 0.9;\n }\n}\n\n@layer base {\n\n\n.fancy-avatar-glow {\n position: absolute;\n inset: 0;\n border-radius: 9999px;\n pointer-events: none;\n box-shadow:\n 0 0 0 2px color-mix(in srgb, var(--fancy-glow, #a855f7) 70%, transparent),\n 0 0 10px 0 color-mix(in srgb, var(--fancy-glow, #a855f7) 45%, transparent);\n animation: fancy-avatar-glow 1.6s ease-out infinite;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fancy-avatar-glow {\n animation: none;\n }\n}\n}\n\n\n@keyframes fancy-slide-out-right {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(100%);\n }\n}\n\n@layer base {\n\n\n.fancy-slide-in-left {\n animation: fancy-slide-in-left 0.25s ease-out;\n}\n\n.fancy-slide-out-left {\n animation: fancy-slide-out-left 0.2s ease-in forwards;\n}\n\n.fancy-slide-in-right {\n animation: fancy-slide-in-right 0.25s ease-out;\n}\n\n.fancy-slide-out-right {\n animation: fancy-slide-out-right 0.2s ease-in forwards;\n}\n}\n\n\n/* Vertical drawer edges. The horizontal pair above predates Drawer (it was\n built for MobileMenu.Flyout, which only ever opened left/right); these\n complete the set so `side=\"top\"`/`side=\"bottom\"` animate rather than pop. */\n\n@keyframes fancy-slide-in-top {\n from {\n transform: translateY(-100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-slide-out-top {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(-100%);\n }\n}\n\n@keyframes fancy-slide-in-bottom {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0);\n }\n}\n\n@keyframes fancy-slide-out-bottom {\n from {\n transform: translateY(0);\n }\n to {\n transform: translateY(100%);\n }\n}\n\n@layer base {\n\n\n.fancy-slide-in-top {\n animation: fancy-slide-in-top 0.25s ease-out;\n}\n\n.fancy-slide-out-top {\n animation: fancy-slide-out-top 0.2s ease-in forwards;\n}\n\n.fancy-slide-in-bottom {\n animation: fancy-slide-in-bottom 0.25s ease-out;\n}\n\n.fancy-slide-out-bottom {\n animation: fancy-slide-out-bottom 0.2s ease-in forwards;\n}\n\n/* Reduced motion collapses the travel to a ~0 duration. Since 5.51.0\n `useAnimation` also unmounts when no animation runs at all, so this is no\n longer what keeps a closed drawer from staying in the DOM — but a ~0 duration\n keeps the exit on the same path as every other close. */\n@media (prefers-reduced-motion: reduce) {\n .fancy-slide-in-left,\n .fancy-slide-out-left,\n .fancy-slide-in-right,\n .fancy-slide-out-right,\n .fancy-slide-in-top,\n .fancy-slide-out-top,\n .fancy-slide-in-bottom,\n .fancy-slide-out-bottom {\n animation-duration: 0.01ms;\n }\n}\n\n/* ─── Marquee ────────────────────────────────────────────────────────────────\n Edge-to-edge auto-scrolling strip. The track holds two identical copies of\n the content; translateX(-50%) over one loop shifts exactly one copy, so the\n wrap is seamless. Duration/gap/fade arrive as custom properties set by the\n component. No animation under prefers-reduced-motion.\n ──────────────────────────────────────────────────────────────────────────── */\n\n[data-react-fancy-marquee] {\n overflow: hidden;\n width: 100%;\n}\n\n.fancy-marquee--fade {\n -webkit-mask-image: linear-gradient(\n to right,\n transparent,\n black var(--fancy-marquee-fade, 48px),\n black calc(100% - var(--fancy-marquee-fade, 48px)),\n transparent\n );\n mask-image: linear-gradient(\n to right,\n transparent,\n black var(--fancy-marquee-fade, 48px),\n black calc(100% - var(--fancy-marquee-fade, 48px)),\n transparent\n );\n}\n\n.fancy-marquee__track {\n display: flex;\n width: max-content;\n animation: fancy-marquee var(--fancy-marquee-duration, 40s) linear infinite;\n will-change: transform;\n}\n\n[data-react-fancy-marquee][data-direction=\"right\"] .fancy-marquee__track {\n animation-direction: reverse;\n}\n\n.fancy-marquee--pause-hover:hover .fancy-marquee__track,\n[data-react-fancy-marquee][data-paused] .fancy-marquee__track {\n animation-play-state: paused;\n}\n\n.fancy-marquee__group {\n display: flex;\n flex: none;\n}\n\n.fancy-marquee__unit {\n display: flex;\n flex: none;\n align-items: center;\n gap: var(--fancy-marquee-gap, 40px);\n padding-inline-end: var(--fancy-marquee-gap, 40px);\n white-space: nowrap;\n}\n\n.fancy-marquee__item,\n.fancy-marquee__separator {\n flex: none;\n}\n}\n\n\n@keyframes fancy-marquee {\n from {\n transform: translateX(0);\n }\n to {\n transform: translateX(-50%);\n }\n}\n\n@layer base {\n\n\n@media (prefers-reduced-motion: reduce) {\n .fancy-marquee__track {\n animation: none;\n }\n}\n}\n\n"],"mappings":";AA4BA,OAAO,EAgCL,aAAa,EAAE,IAAI,mBAAmB,EACtC,sBAAsB,EAAE,IAAI,cAAc,EAC1C,mBAAmB,EAAE,IAAI,mBAAmB,EAE5C,kBAAkB,EAAE,IAAI,kBAAkB,EAC1C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C,mBAAmB,EAAE,IAAI,mBAAmB,EAC5C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|
42
42
|
"data-fullscreen": "true" | "false";
|
|
43
43
|
"data-fullscreen-mode"?: FullScreenMode;
|
|
44
|
+
"data-fullscreen-layer"?: FullScreenLayer;
|
|
44
45
|
style?: CSSProperties;
|
|
45
46
|
onKeyDown: (event: KeyboardEvent<T>) => void;
|
|
46
47
|
}
|
|
@@ -59,6 +60,12 @@ interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {
|
|
|
59
60
|
toggle: () => void;
|
|
60
61
|
/** The mechanism in effect while active; `null` when not full screen. */
|
|
61
62
|
activeMode: FullScreenMode | null;
|
|
63
|
+
/**
|
|
64
|
+
* `"top"` while the surface is in the browser's top layer (a manual popover,
|
|
65
|
+
* or the native full screen), `"fixed"` while it relies on `position: fixed`
|
|
66
|
+
* (no popover API, or the browser refused). `null` when not full screen.
|
|
67
|
+
*/
|
|
68
|
+
layer: FullScreenLayer | null;
|
|
62
69
|
/** Attach to the element that goes full screen. Also inside `targetProps`. */
|
|
63
70
|
ref: RefObject<T | null>;
|
|
64
71
|
/**
|
|
@@ -75,6 +82,8 @@ interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {
|
|
|
75
82
|
*/
|
|
76
83
|
portalContainer: HTMLElement | null;
|
|
77
84
|
}
|
|
85
|
+
/** Which mechanism keeps the surface over the page. */
|
|
86
|
+
type FullScreenLayer = "top" | "fixed";
|
|
78
87
|
/**
|
|
79
88
|
* A controlled full-screen state for any surface: Editor today, DeckEditor and
|
|
80
89
|
* SheetWorkbook next. Render-time output is pure (no `window`/`document`), so it
|
|
@@ -82,4 +91,4 @@ interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {
|
|
|
82
91
|
*/
|
|
83
92
|
declare function useFullScreen<T extends HTMLElement = HTMLElement>(options?: UseFullScreenOptions): UseFullScreenResult<T>;
|
|
84
93
|
|
|
85
|
-
export { type
|
|
94
|
+
export { type FullScreenLayer as F, type UseFullScreenOptions as U, type FullScreenMode as a, type FullScreenTargetProps as b, type FullScreenToggleProps as c, type UseFullScreenResult as d, useFullScreen as u };
|
|
@@ -41,6 +41,7 @@ interface FullScreenTargetProps<T extends HTMLElement> {
|
|
|
41
41
|
ref: RefObject<T | null>;
|
|
42
42
|
"data-fullscreen": "true" | "false";
|
|
43
43
|
"data-fullscreen-mode"?: FullScreenMode;
|
|
44
|
+
"data-fullscreen-layer"?: FullScreenLayer;
|
|
44
45
|
style?: CSSProperties;
|
|
45
46
|
onKeyDown: (event: KeyboardEvent<T>) => void;
|
|
46
47
|
}
|
|
@@ -59,6 +60,12 @@ interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {
|
|
|
59
60
|
toggle: () => void;
|
|
60
61
|
/** The mechanism in effect while active; `null` when not full screen. */
|
|
61
62
|
activeMode: FullScreenMode | null;
|
|
63
|
+
/**
|
|
64
|
+
* `"top"` while the surface is in the browser's top layer (a manual popover,
|
|
65
|
+
* or the native full screen), `"fixed"` while it relies on `position: fixed`
|
|
66
|
+
* (no popover API, or the browser refused). `null` when not full screen.
|
|
67
|
+
*/
|
|
68
|
+
layer: FullScreenLayer | null;
|
|
62
69
|
/** Attach to the element that goes full screen. Also inside `targetProps`. */
|
|
63
70
|
ref: RefObject<T | null>;
|
|
64
71
|
/**
|
|
@@ -75,6 +82,8 @@ interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {
|
|
|
75
82
|
*/
|
|
76
83
|
portalContainer: HTMLElement | null;
|
|
77
84
|
}
|
|
85
|
+
/** Which mechanism keeps the surface over the page. */
|
|
86
|
+
type FullScreenLayer = "top" | "fixed";
|
|
78
87
|
/**
|
|
79
88
|
* A controlled full-screen state for any surface: Editor today, DeckEditor and
|
|
80
89
|
* SheetWorkbook next. Render-time output is pure (no `window`/`document`), so it
|
|
@@ -82,4 +91,4 @@ interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {
|
|
|
82
91
|
*/
|
|
83
92
|
declare function useFullScreen<T extends HTMLElement = HTMLElement>(options?: UseFullScreenOptions): UseFullScreenResult<T>;
|
|
84
93
|
|
|
85
|
-
export { type
|
|
94
|
+
export { type FullScreenLayer as F, type UseFullScreenOptions as U, type FullScreenMode as a, type FullScreenTargetProps as b, type FullScreenToggleProps as c, type UseFullScreenResult as d, useFullScreen as u };
|
package/docs/FullScreen.md
CHANGED
|
@@ -45,11 +45,21 @@ function DeckEditor({ fullScreen, defaultFullScreen, onFullScreenChange }) {
|
|
|
45
45
|
|
|
46
46
|
| `mode` | What happens | When it fails |
|
|
47
47
|
|---|---|---|
|
|
48
|
-
| `"overlay"` (default) | The element
|
|
49
|
-
| `"native"` |
|
|
48
|
+
| `"overlay"` (default) | The element covers the viewport in place: `position: fixed` plus, where the browser has the popover API, promotion into the **top layer** with `popover="manual"` | Never refused. Without the popover API it stays `position: fixed` (z-index 50, as `Modal`) and an ancestor with `transform`, `filter`, `perspective` or `contain: paint` confines it to that ancestor |
|
|
49
|
+
| `"native"` | `element.requestFullscreen()`, so the browser chrome hides too | Refused in an iframe without `allow="fullscreen"`, without a user gesture, or by a permissions policy. It then drops to the overlay, top layer included. `data-fullscreen-mode` says which one is active |
|
|
50
50
|
|
|
51
51
|
The overlay is the default because it never asks the browser for permission. The element is not portalled, so nothing inside remounts. An editor keeps its caret, undo history and seeded content.
|
|
52
52
|
|
|
53
|
+
**Why the top layer.** `position: fixed` is fixed to the viewport only while no ancestor has a transform, filter, perspective or paint containment. With one, the overlay is fixed to that ancestor instead. A Tabs panel whose fade-in animation holds its end keyframe (`animation-fill-mode: both`) traps it this way, and so does a dialog centred with `transform`. A top-layer element's containing block is the viewport whatever its ancestors do. `data-fullscreen-layer` reports `"top"` (popover, or the native full screen) or `"fixed"` (no popover API, or the browser refused).
|
|
54
|
+
|
|
55
|
+
What the top layer changes:
|
|
56
|
+
|
|
57
|
+
- **Light dismiss does not apply.** The popover is `manual`, so outside clicks do not close it, and Escape goes through the surface's own handling.
|
|
58
|
+
- **The UA popover box is reset.** `styles.css` puts padding, border, background, text colour and overflow back to a plain box, in a zero-specificity rule in the `base` layer, so your own classes still win. Geometry is set inline. Without `styles.css` the UA popover padding, border and `Canvas` colours show.
|
|
59
|
+
- **Portals opened from inside stay visible**, because they are redirected into the surface. Overlays rendered from OUTSIDE the surface while it is active, such as an app-level toast, sit under it, like anything else in the page.
|
|
60
|
+
- **Native mode requests the browser's full screen before any popover.** Chromium refuses `requestFullscreen()` on an element that is already an open popover, so the popover is only used if that request fails.
|
|
61
|
+
- If something else closes the popover, the surface drops back to `position: fixed` rather than disappearing.
|
|
62
|
+
|
|
53
63
|
In `native` mode the browser handles Esc itself. When the user leaves through the browser's UI, `onFullScreenChange(false)` fires so controlled state stays in sync.
|
|
54
64
|
|
|
55
65
|
## Behaviour
|
|
@@ -73,7 +83,7 @@ In `native` mode the browser handles Esc itself. When the user leaves through th
|
|
|
73
83
|
| zIndex | `number` | `50` | Stacking order of the overlay |
|
|
74
84
|
| labels | `{ enter?: string; exit?: string }` | "Enter full screen" / "Exit full screen" | Toggle accessible names |
|
|
75
85
|
|
|
76
|
-
`useFullScreen()` returns `{ fullScreen, setFullScreen, toggle, activeMode, ref, targetProps, toggleProps, portalContainer }`.
|
|
86
|
+
`useFullScreen()` returns `{ fullScreen, setFullScreen, toggle, activeMode, layer, ref, targetProps, toggleProps, portalContainer }`.
|
|
77
87
|
|
|
78
88
|
### FullScreen.Toggle
|
|
79
89
|
|
|
@@ -92,4 +102,5 @@ Renders nothing outside a `FullScreen` / `FullScreenProvider`.
|
|
|
92
102
|
| `[data-react-fancy-fullscreen]` | `<FullScreen>` root |
|
|
93
103
|
| `[data-fullscreen="true"]` | Any surface while full screen (also on the toggle) |
|
|
94
104
|
| `[data-fullscreen-mode="overlay" \| "native"]` | Which mechanism is active |
|
|
105
|
+
| `[data-fullscreen-layer="top" \| "fixed"]` | Whether the surface is in the top layer or relies on `position: fixed` |
|
|
95
106
|
| `[data-react-fancy-fullscreen-toggle]` | Any full-screen toggle |
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/scroll-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C3D,GAAI,UAAA,IAAc,OAAA,GAAU,EAAE,KAAA,EAAO,EAAE,GAAG,aAAA,EAAe,MAAA,EAAO,EAAE,GAAI,EAAC;AAAA,MACvE;AAAA,KACF;AAAA,IACA,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,cAAA,EAAgB,UAAA;AAAA,MAChB,YAAA,EAAc,aAAa,SAAA,GAAY,UAAA;AAAA,MACvC,KAAA,EAAO,aAAa,SAAA,GAAY,UAAA;AAAA,MAChC,oCAAA,EAAsC,EAAA;AAAA,MACtC,iBAAA,EAAmB,aAAa,MAAA,GAAS;AAAA;AAC3C,GACF;AACF","file":"chunk-NE3BZV3F.js","sourcesContent":["/**\n * Reference-counted body scroll lock.\n *\n * Two surfaces locking independently with the save-and-restore pattern\n * (`const original = body.style.overflow`) only unwind correctly in strict LIFO\n * order. Exit them out of order and the first one out restores `\"\"` while the\n * second is still covering the viewport, so the page scrolls behind it. Counting\n * holders keeps the lock until the last one lets go, and restores the value that\n * was there before the FIRST took it.\n *\n * Call only from an effect: it touches `document`.\n */\nlet holders = 0;\nlet saved = \"\";\n\nexport function lockBodyScroll(): () => void {\n if (holders === 0) {\n saved = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n }\n holders++;\n\n let released = false;\n return () => {\n if (released) return;\n released = true;\n holders--;\n if (holders === 0) document.body.style.overflow = saved;\n };\n}\n","import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type RefObject,\n} from \"react\";\nimport { useControllableState } from \"./use-controllable-state\";\nimport { lockBodyScroll } from \"../utils/scroll-lock\";\n\n/**\n * How a surface goes full screen.\n *\n * - `\"overlay\"` (default): the element itself becomes `position: fixed` over the\n * viewport, in place. It always works: inside an iframe without\n * `allow=\"fullscreen\"`, inside a dialog, without a user gesture. Nothing is\n * reparented, so an editor keeps its caret, undo stack and DOM.\n * - `\"native\"`: the browser Fullscreen API (`element.requestFullscreen()`),\n * which hides the browser chrome too. The overlay is applied first and stays\n * if the request is rejected or the API is missing, so the user gets full\n * screen either way; `activeMode` reports which one took.\n */\nexport type FullScreenMode = \"overlay\" | \"native\";\n\nexport interface UseFullScreenOptions {\n /** Controlled flag. Pair with `onFullScreenChange`. */\n fullScreen?: boolean;\n /** Initial flag when uncontrolled. @default false */\n defaultFullScreen?: boolean;\n /**\n * Fired with the requested state — from the toggle, Escape, an agent calling\n * `setFullScreen`, or the user leaving the browser's own full screen.\n */\n onFullScreenChange?: (fullScreen: boolean) => void;\n /** @default \"overlay\" */\n mode?: FullScreenMode;\n /** Leave full screen on Escape. @default true */\n closeOnEscape?: boolean;\n /** Stop the page behind from scrolling while active. @default true */\n lockScroll?: boolean;\n /** Stacking order of the overlay. Matches `Modal`. @default 50 */\n zIndex?: number;\n /** Accessible names for the toggle. */\n labels?: { enter?: string; exit?: string };\n}\n\nexport interface FullScreenTargetProps<T extends HTMLElement> {\n ref: RefObject<T | null>;\n \"data-fullscreen\": \"true\" | \"false\";\n \"data-fullscreen-mode\"?: FullScreenMode;\n style?: CSSProperties;\n onKeyDown: (event: ReactKeyboardEvent<T>) => void;\n}\n\nexport interface FullScreenToggleProps {\n type: \"button\";\n onClick: () => void;\n \"aria-pressed\": boolean;\n \"aria-label\": string;\n title: string;\n \"data-react-fancy-fullscreen-toggle\": \"\";\n \"data-fullscreen\": \"true\" | \"false\";\n}\n\nexport interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {\n fullScreen: boolean;\n setFullScreen: (fullScreen: boolean) => void;\n toggle: () => void;\n /** The mechanism in effect while active; `null` when not full screen. */\n activeMode: FullScreenMode | null;\n /** Attach to the element that goes full screen. Also inside `targetProps`. */\n ref: RefObject<T | null>;\n /**\n * Spread onto the surface's root. Carries the ref, the `data-fullscreen`\n * handle, the overlay style and the Escape/Tab handler. Merge your own\n * `style` / `onKeyDown` if the root has them.\n */\n targetProps: FullScreenTargetProps<T>;\n /** Spread onto a `<button>` to make it the toggle. */\n toggleProps: FullScreenToggleProps;\n /**\n * The element to portal into while active, else `null`. Provide it through\n * `PortalContainerContext` so menus opened inside stay visible.\n */\n portalContainer: HTMLElement | null;\n}\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"textarea:not([disabled])\",\n \"select:not([disabled])\",\n \"[contenteditable]:not([contenteditable='false'])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\", \");\n\n/** Active surfaces, innermost last. Only the top one answers a stray Escape. */\nconst activeStack: object[] = [];\n\nconst OVERLAY_STYLE: CSSProperties = {\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n maxWidth: \"none\",\n maxHeight: \"none\",\n margin: 0,\n borderRadius: 0,\n boxSizing: \"border-box\",\n};\n\ninterface ScrollMemo {\n el: Element;\n top: number;\n left: number;\n}\n\n/**\n * A controlled full-screen state for any surface: Editor today, DeckEditor and\n * SheetWorkbook next. Render-time output is pure (no `window`/`document`), so it\n * server-renders; everything that touches the DOM runs in effects.\n */\nexport function useFullScreen<T extends HTMLElement = HTMLElement>(\n options: UseFullScreenOptions = {},\n): UseFullScreenResult<T> {\n const {\n fullScreen: controlled,\n defaultFullScreen = false,\n onFullScreenChange,\n mode = \"overlay\",\n closeOnEscape = true,\n lockScroll = true,\n zIndex = 50,\n labels,\n } = options;\n\n const [fullScreen, setState] = useControllableState(controlled, defaultFullScreen, onFullScreenChange);\n const ref = useRef<T | null>(null);\n const token = useRef({});\n const [nativeActive, setNativeActive] = useState(false);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n // Whether the overlay STYLE is on. It trails `fullScreen` by one synchronous\n // commit on entry, so the layout effect below reads scroll offsets while the\n // surface is still in flow. Read after the style lands and the browser has\n // already clamped every scroll container around it: a panel at 569 read as\n // 342 in Chromium, and that is where the user was sent back to. The re-render\n // happens inside the layout phase, before paint, so nothing flashes.\n // Initialised from `fullScreen` so a surface that starts full screen renders\n // the overlay on the server and on hydration alike.\n const [applied, setApplied] = useState(fullScreen);\n\n const current = useRef(fullScreen);\n current.current = fullScreen;\n\n // Only report real transitions: Escape on an inactive surface, or a second\n // click racing a re-render, must not fire `onFullScreenChange(false)` twice.\n const setFullScreen = useCallback(\n (next: boolean) => {\n if (current.current === next) return;\n current.current = next;\n setState(next);\n },\n [setState],\n );\n const toggle = useCallback(() => setFullScreen(!current.current), [setFullScreen]);\n\n // Enter / exit bookkeeping. A LAYOUT effect so the cleanup runs after the\n // overlay style has been removed from the DOM but before paint: scroll offsets\n // restored there never flash, and the surface is back in flow to measure.\n useLayoutEffect(() => {\n if (!fullScreen) return;\n const el = ref.current;\n if (!el) return;\n\n // Taking the surface out of flow shrinks every scroll container around it,\n // which clamps their scrollTop. Remember them so exit lands where it began.\n const scrolled: ScrollMemo[] = [];\n for (let p = el.parentElement; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {\n if (p.scrollTop || p.scrollLeft) scrolled.push({ el: p, top: p.scrollTop, left: p.scrollLeft });\n }\n const winX = window.scrollX;\n const winY = window.scrollY;\n\n const release = lockScroll ? lockBodyScroll() : null;\n activeStack.push(token.current);\n setPortalContainer(el);\n setApplied(true);\n\n return () => {\n const i = activeStack.indexOf(token.current);\n if (i >= 0) activeStack.splice(i, 1);\n release?.();\n for (const m of scrolled) {\n if (m.el.scrollTop !== m.top) m.el.scrollTop = m.top;\n if (m.el.scrollLeft !== m.left) m.el.scrollLeft = m.left;\n }\n if (window.scrollX !== winX || window.scrollY !== winY) window.scrollTo(winX, winY);\n setPortalContainer(null);\n setApplied(false);\n };\n }, [fullScreen, lockScroll]);\n\n // Focus in and back out. A PASSIVE effect on purpose: React re-focuses\n // whatever had focus before a commit once the commit's mutations finish, so a\n // focus() issued from a layout-effect cleanup is silently undone.\n useEffect(() => {\n if (!fullScreen) return;\n const el = ref.current;\n if (!el) return;\n\n const opener =\n document.activeElement instanceof HTMLElement && document.activeElement !== document.body\n ? document.activeElement\n : null;\n\n // Focus must not stay behind the overlay, where the user cannot see it.\n if (!el.contains(document.activeElement)) {\n el.querySelector<HTMLElement>(FOCUSABLE)?.focus({ preventScroll: true });\n }\n\n return () => {\n // Give focus back only if it is still ours to give: inside the surface,\n // or lost to <body>. A user who clicked elsewhere keeps their choice.\n const active = document.activeElement;\n if (opener?.isConnected && (!active || active === document.body || el.contains(active))) {\n opener.focus({ preventScroll: true });\n }\n };\n }, [fullScreen]);\n\n // The browser Fullscreen API, on top of the overlay.\n useEffect(() => {\n if (!fullScreen || mode !== \"native\") return;\n const el = ref.current;\n if (!el || typeof el.requestFullscreen !== \"function\" || document.fullscreenEnabled === false) return;\n\n let cancelled = false;\n let entered = false;\n\n const onChange = () => {\n if (document.fullscreenElement === el) {\n entered = true;\n setNativeActive(true);\n } else if (entered) {\n // The user left through the browser's own UI (Esc, F11, the close\n // pill). Keep the controlled state honest rather than leaving an\n // overlay up that they believe they dismissed.\n entered = false;\n setNativeActive(false);\n if (!cancelled) setFullScreen(false);\n }\n };\n document.addEventListener(\"fullscreenchange\", onChange);\n\n // Blocked requests (iframe without allow=\"fullscreen\", no user gesture, a\n // permissions policy) reject, and some engines throw instead. Either way\n // the overlay is already up, so the user stays full screen in it.\n try {\n Promise.resolve(el.requestFullscreen()).then(onChange, () => {});\n } catch {\n /* stay in the overlay */\n }\n\n return () => {\n cancelled = true;\n document.removeEventListener(\"fullscreenchange\", onChange);\n if (document.fullscreenElement === el) {\n try {\n Promise.resolve(document.exitFullscreen()).catch(() => {});\n } catch {\n /* already left */\n }\n }\n setNativeActive(false);\n };\n }, [fullScreen, mode, setFullScreen]);\n\n // Escape with nothing focused never reaches the surface's own handler.\n useEffect(() => {\n if (!fullScreen || !closeOnEscape) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== \"Escape\" || e.defaultPrevented) return;\n const t = e.target;\n if (t !== document.body && t !== document.documentElement && t !== document) return;\n if (activeStack[activeStack.length - 1] !== token.current) return;\n setFullScreen(false);\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [fullScreen, closeOnEscape, setFullScreen]);\n\n const onKeyDown = useCallback(\n (e: ReactKeyboardEvent<T>) => {\n if (!current.current || e.defaultPrevented) return;\n const el = ref.current;\n if (!el) return;\n\n if (e.key === \"Tab\") {\n // Keep Tab inside the surface; what is behind the overlay is invisible.\n const items = Array.from(el.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (items.length === 0) return;\n const first = items[0];\n const last = items[items.length - 1];\n const active = document.activeElement;\n if (e.shiftKey && (active === first || active === el)) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && active === last) {\n e.preventDefault();\n first.focus();\n }\n return;\n }\n\n if (e.key !== \"Escape\" || !closeOnEscape) return;\n // An Escape from inside a layer opened FROM this surface (a menu, a\n // popover, a dialog) belongs to that layer. React bubbles portal events\n // through the component tree, so check the DOM: a portal wrapper that\n // does not contain this surface is nested inside it.\n const layer = (e.target as Element).closest?.(\"[data-react-fancy-portal]\");\n if (layer && !layer.contains(el)) return;\n // Stop it here so an enclosing dialog's document listener does not also\n // close: one Escape, one step back.\n e.preventDefault();\n e.stopPropagation();\n setFullScreen(false);\n },\n [closeOnEscape, setFullScreen],\n );\n\n const activeMode: FullScreenMode | null = fullScreen ? (nativeActive ? \"native\" : \"overlay\") : null;\n const enterLabel = labels?.enter ?? \"Enter full screen\";\n const exitLabel = labels?.exit ?? \"Exit full screen\";\n\n return {\n fullScreen,\n setFullScreen,\n toggle,\n activeMode,\n ref,\n portalContainer,\n targetProps: {\n ref,\n \"data-fullscreen\": fullScreen ? \"true\" : \"false\",\n ...(activeMode ? { \"data-fullscreen-mode\": activeMode } : {}),\n ...(fullScreen && applied ? { style: { ...OVERLAY_STYLE, zIndex } } : {}),\n onKeyDown,\n },\n toggleProps: {\n type: \"button\",\n onClick: toggle,\n \"aria-pressed\": fullScreen,\n \"aria-label\": fullScreen ? exitLabel : enterLabel,\n title: fullScreen ? exitLabel : enterLabel,\n \"data-react-fancy-fullscreen-toggle\": \"\",\n \"data-fullscreen\": fullScreen ? \"true\" : \"false\",\n },\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/scroll-lock.ts","../src/hooks/use-full-screen.ts"],"names":["useControllableState","useRef","useState","useCallback","useLayoutEffect","useEffect"],"mappings":";;;;;;AAYA,IAAI,OAAA,GAAU,CAAA;AACd,IAAI,KAAA,GAAQ,EAAA;AAEL,SAAS,cAAA,GAA6B;AAC3C,EAAA,IAAI,YAAY,CAAA,EAAG;AACjB,IAAA,KAAA,GAAQ,QAAA,CAAS,KAAK,KAAA,CAAM,QAAA;AAC5B,IAAA,QAAA,CAAS,IAAA,CAAK,MAAM,QAAA,GAAW,QAAA;AAAA,EACjC;AACA,EAAA,OAAA,EAAA;AAEA,EAAA,IAAI,QAAA,GAAW,KAAA;AACf,EAAA,OAAO,MAAM;AACX,IAAA,IAAI,QAAA,EAAU;AACd,IAAA,QAAA,GAAW,IAAA;AACX,IAAA,OAAA,EAAA;AACA,IAAA,IAAI,OAAA,KAAY,CAAA,EAAG,QAAA,CAAS,IAAA,CAAK,MAAM,QAAA,GAAW,KAAA;AAAA,EACpD,CAAA;AACF;;;AC6DA,IAAM,SAAA,GAAY;AAAA,EAChB,SAAA;AAAA,EACA,wBAAA;AAAA,EACA,uBAAA;AAAA,EACA,0BAAA;AAAA,EACA,wBAAA;AAAA,EACA,kDAAA;AAAA,EACA;AACF,CAAA,CAAE,KAAK,IAAI,CAAA;AAGX,IAAM,cAAwB,EAAC;AAE/B,IAAM,aAAA,GAA+B;AAAA,EACnC,QAAA,EAAU,OAAA;AAAA,EACV,GAAA,EAAK,CAAA;AAAA,EACL,KAAA,EAAO,CAAA;AAAA,EACP,MAAA,EAAQ,CAAA;AAAA,EACR,IAAA,EAAM,CAAA;AAAA,EACN,KAAA,EAAO,MAAA;A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A,IACL,UAAA;AAAA,IACA,aAAA;AAAA,IACA,MAAA;AAAA,IACA,UAAA;AAAA,IACA,GAAA;AAAA,IACA,eAAA;AAAA,IACA,WAAA,EAAa;AAAA,MACX,GAAA;AAAA,MACA,iBAAA,EAAmB,aAAa,MAAA,GAAS,OAAA;AAAA,MACzC,GAAI,UAAA,GAAa,EAAE,sBAAA,EAAwB,UAAA,KAAe,EAAC;AAAA,MAC3D,GAAI,UAAA,IAAc,OAAA,GAAU,EAAE,KAAA,EAAO,EAAE,GAAG,aAAA,EAAe,MAAA,EAAO,EAAE,GAAI,EAAC;AAAA,MACvE;AAAA,KACF;AAAA,IACA,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,OAAA,EAAS,MAAA;AAAA,MACT,cAAA,EAAgB,UAAA;AAAA,MAChB,YAAA,EAAc,aAAa,SAAA,GAAY,UAAA;AAAA,MACvC,KAAA,EAAO,aAAa,SAAA,GAAY,UAAA;AAAA,MAChC,oCAAA,EAAsC,EAAA;AAAA,MACtC,iBAAA,EAAmB,aAAa,MAAA,GAAS;AAAA;AAC3C,GACF;AACF","file":"chunk-O4HZVZMY.cjs","sourcesContent":["/**\n * Reference-counted body scroll lock.\n *\n * Two surfaces locking independently with the save-and-restore pattern\n * (`const original = body.style.overflow`) only unwind correctly in strict LIFO\n * order. Exit them out of order and the first one out restores `\"\"` while the\n * second is still covering the viewport, so the page scrolls behind it. Counting\n * holders keeps the lock until the last one lets go, and restores the value that\n * was there before the FIRST took it.\n *\n * Call only from an effect: it touches `document`.\n */\nlet holders = 0;\nlet saved = \"\";\n\nexport function lockBodyScroll(): () => void {\n if (holders === 0) {\n saved = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n }\n holders++;\n\n let released = false;\n return () => {\n if (released) return;\n released = true;\n holders--;\n if (holders === 0) document.body.style.overflow = saved;\n };\n}\n","import {\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent as ReactKeyboardEvent,\n type RefObject,\n} from \"react\";\nimport { useControllableState } from \"./use-controllable-state\";\nimport { lockBodyScroll } from \"../utils/scroll-lock\";\n\n/**\n * How a surface goes full screen.\n *\n * - `\"overlay\"` (default): the element itself becomes `position: fixed` over the\n * viewport, in place. It always works: inside an iframe without\n * `allow=\"fullscreen\"`, inside a dialog, without a user gesture. Nothing is\n * reparented, so an editor keeps its caret, undo stack and DOM.\n * - `\"native\"`: the browser Fullscreen API (`element.requestFullscreen()`),\n * which hides the browser chrome too. The overlay is applied first and stays\n * if the request is rejected or the API is missing, so the user gets full\n * screen either way; `activeMode` reports which one took.\n */\nexport type FullScreenMode = \"overlay\" | \"native\";\n\nexport interface UseFullScreenOptions {\n /** Controlled flag. Pair with `onFullScreenChange`. */\n fullScreen?: boolean;\n /** Initial flag when uncontrolled. @default false */\n defaultFullScreen?: boolean;\n /**\n * Fired with the requested state — from the toggle, Escape, an agent calling\n * `setFullScreen`, or the user leaving the browser's own full screen.\n */\n onFullScreenChange?: (fullScreen: boolean) => void;\n /** @default \"overlay\" */\n mode?: FullScreenMode;\n /** Leave full screen on Escape. @default true */\n closeOnEscape?: boolean;\n /** Stop the page behind from scrolling while active. @default true */\n lockScroll?: boolean;\n /** Stacking order of the overlay. Matches `Modal`. @default 50 */\n zIndex?: number;\n /** Accessible names for the toggle. */\n labels?: { enter?: string; exit?: string };\n}\n\nexport interface FullScreenTargetProps<T extends HTMLElement> {\n ref: RefObject<T | null>;\n \"data-fullscreen\": \"true\" | \"false\";\n \"data-fullscreen-mode\"?: FullScreenMode;\n style?: CSSProperties;\n onKeyDown: (event: ReactKeyboardEvent<T>) => void;\n}\n\nexport interface FullScreenToggleProps {\n type: \"button\";\n onClick: () => void;\n \"aria-pressed\": boolean;\n \"aria-label\": string;\n title: string;\n \"data-react-fancy-fullscreen-toggle\": \"\";\n \"data-fullscreen\": \"true\" | \"false\";\n}\n\nexport interface UseFullScreenResult<T extends HTMLElement = HTMLElement> {\n fullScreen: boolean;\n setFullScreen: (fullScreen: boolean) => void;\n toggle: () => void;\n /** The mechanism in effect while active; `null` when not full screen. */\n activeMode: FullScreenMode | null;\n /** Attach to the element that goes full screen. Also inside `targetProps`. */\n ref: RefObject<T | null>;\n /**\n * Spread onto the surface's root. Carries the ref, the `data-fullscreen`\n * handle, the overlay style and the Escape/Tab handler. Merge your own\n * `style` / `onKeyDown` if the root has them.\n */\n targetProps: FullScreenTargetProps<T>;\n /** Spread onto a `<button>` to make it the toggle. */\n toggleProps: FullScreenToggleProps;\n /**\n * The element to portal into while active, else `null`. Provide it through\n * `PortalContainerContext` so menus opened inside stay visible.\n */\n portalContainer: HTMLElement | null;\n}\n\nconst FOCUSABLE = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"textarea:not([disabled])\",\n \"select:not([disabled])\",\n \"[contenteditable]:not([contenteditable='false'])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\", \");\n\n/** Active surfaces, innermost last. Only the top one answers a stray Escape. */\nconst activeStack: object[] = [];\n\nconst OVERLAY_STYLE: CSSProperties = {\n position: \"fixed\",\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n maxWidth: \"none\",\n maxHeight: \"none\",\n margin: 0,\n borderRadius: 0,\n boxSizing: \"border-box\",\n};\n\ninterface ScrollMemo {\n el: Element;\n top: number;\n left: number;\n}\n\n/**\n * A controlled full-screen state for any surface: Editor today, DeckEditor and\n * SheetWorkbook next. Render-time output is pure (no `window`/`document`), so it\n * server-renders; everything that touches the DOM runs in effects.\n */\nexport function useFullScreen<T extends HTMLElement = HTMLElement>(\n options: UseFullScreenOptions = {},\n): UseFullScreenResult<T> {\n const {\n fullScreen: controlled,\n defaultFullScreen = false,\n onFullScreenChange,\n mode = \"overlay\",\n closeOnEscape = true,\n lockScroll = true,\n zIndex = 50,\n labels,\n } = options;\n\n const [fullScreen, setState] = useControllableState(controlled, defaultFullScreen, onFullScreenChange);\n const ref = useRef<T | null>(null);\n const token = useRef({});\n const [nativeActive, setNativeActive] = useState(false);\n const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);\n // Whether the overlay STYLE is on. It trails `fullScreen` by one synchronous\n // commit on entry, so the layout effect below reads scroll offsets while the\n // surface is still in flow. Read after the style lands and the browser has\n // already clamped every scroll container around it: a panel at 569 read as\n // 342 in Chromium, and that is where the user was sent back to. The re-render\n // happens inside the layout phase, before paint, so nothing flashes.\n // Initialised from `fullScreen` so a surface that starts full screen renders\n // the overlay on the server and on hydration alike.\n const [applied, setApplied] = useState(fullScreen);\n\n const current = useRef(fullScreen);\n current.current = fullScreen;\n\n // Only report real transitions: Escape on an inactive surface, or a second\n // click racing a re-render, must not fire `onFullScreenChange(false)` twice.\n const setFullScreen = useCallback(\n (next: boolean) => {\n if (current.current === next) return;\n current.current = next;\n setState(next);\n },\n [setState],\n );\n const toggle = useCallback(() => setFullScreen(!current.current), [setFullScreen]);\n\n // Enter / exit bookkeeping. A LAYOUT effect so the cleanup runs after the\n // overlay style has been removed from the DOM but before paint: scroll offsets\n // restored there never flash, and the surface is back in flow to measure.\n useLayoutEffect(() => {\n if (!fullScreen) return;\n const el = ref.current;\n if (!el) return;\n\n // Taking the surface out of flow shrinks every scroll container around it,\n // which clamps their scrollTop. Remember them so exit lands where it began.\n const scrolled: ScrollMemo[] = [];\n for (let p = el.parentElement; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {\n if (p.scrollTop || p.scrollLeft) scrolled.push({ el: p, top: p.scrollTop, left: p.scrollLeft });\n }\n const winX = window.scrollX;\n const winY = window.scrollY;\n\n const release = lockScroll ? lockBodyScroll() : null;\n activeStack.push(token.current);\n setPortalContainer(el);\n setApplied(true);\n\n return () => {\n const i = activeStack.indexOf(token.current);\n if (i >= 0) activeStack.splice(i, 1);\n release?.();\n for (const m of scrolled) {\n if (m.el.scrollTop !== m.top) m.el.scrollTop = m.top;\n if (m.el.scrollLeft !== m.left) m.el.scrollLeft = m.left;\n }\n if (window.scrollX !== winX || window.scrollY !== winY) window.scrollTo(winX, winY);\n setPortalContainer(null);\n setApplied(false);\n };\n }, [fullScreen, lockScroll]);\n\n // Focus in and back out. A PASSIVE effect on purpose: React re-focuses\n // whatever had focus before a commit once the commit's mutations finish, so a\n // focus() issued from a layout-effect cleanup is silently undone.\n useEffect(() => {\n if (!fullScreen) return;\n const el = ref.current;\n if (!el) return;\n\n const opener =\n document.activeElement instanceof HTMLElement && document.activeElement !== document.body\n ? document.activeElement\n : null;\n\n // Focus must not stay behind the overlay, where the user cannot see it.\n if (!el.contains(document.activeElement)) {\n el.querySelector<HTMLElement>(FOCUSABLE)?.focus({ preventScroll: true });\n }\n\n return () => {\n // Give focus back only if it is still ours to give: inside the surface,\n // or lost to <body>. A user who clicked elsewhere keeps their choice.\n const active = document.activeElement;\n if (opener?.isConnected && (!active || active === document.body || el.contains(active))) {\n opener.focus({ preventScroll: true });\n }\n };\n }, [fullScreen]);\n\n // The browser Fullscreen API, on top of the overlay.\n useEffect(() => {\n if (!fullScreen || mode !== \"native\") return;\n const el = ref.current;\n if (!el || typeof el.requestFullscreen !== \"function\" || document.fullscreenEnabled === false) return;\n\n let cancelled = false;\n let entered = false;\n\n const onChange = () => {\n if (document.fullscreenElement === el) {\n entered = true;\n setNativeActive(true);\n } else if (entered) {\n // The user left through the browser's own UI (Esc, F11, the close\n // pill). Keep the controlled state honest rather than leaving an\n // overlay up that they believe they dismissed.\n entered = false;\n setNativeActive(false);\n if (!cancelled) setFullScreen(false);\n }\n };\n document.addEventListener(\"fullscreenchange\", onChange);\n\n // Blocked requests (iframe without allow=\"fullscreen\", no user gesture, a\n // permissions policy) reject, and some engines throw instead. Either way\n // the overlay is already up, so the user stays full screen in it.\n try {\n Promise.resolve(el.requestFullscreen()).then(onChange, () => {});\n } catch {\n /* stay in the overlay */\n }\n\n return () => {\n cancelled = true;\n document.removeEventListener(\"fullscreenchange\", onChange);\n if (document.fullscreenElement === el) {\n try {\n Promise.resolve(document.exitFullscreen()).catch(() => {});\n } catch {\n /* already left */\n }\n }\n setNativeActive(false);\n };\n }, [fullScreen, mode, setFullScreen]);\n\n // Escape with nothing focused never reaches the surface's own handler.\n useEffect(() => {\n if (!fullScreen || !closeOnEscape) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key !== \"Escape\" || e.defaultPrevented) return;\n const t = e.target;\n if (t !== document.body && t !== document.documentElement && t !== document) return;\n if (activeStack[activeStack.length - 1] !== token.current) return;\n setFullScreen(false);\n };\n document.addEventListener(\"keydown\", onKey);\n return () => document.removeEventListener(\"keydown\", onKey);\n }, [fullScreen, closeOnEscape, setFullScreen]);\n\n const onKeyDown = useCallback(\n (e: ReactKeyboardEvent<T>) => {\n if (!current.current || e.defaultPrevented) return;\n const el = ref.current;\n if (!el) return;\n\n if (e.key === \"Tab\") {\n // Keep Tab inside the surface; what is behind the overlay is invisible.\n const items = Array.from(el.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (items.length === 0) return;\n const first = items[0];\n const last = items[items.length - 1];\n const active = document.activeElement;\n if (e.shiftKey && (active === first || active === el)) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && active === last) {\n e.preventDefault();\n first.focus();\n }\n return;\n }\n\n if (e.key !== \"Escape\" || !closeOnEscape) return;\n // An Escape from inside a layer opened FROM this surface (a menu, a\n // popover, a dialog) belongs to that layer. React bubbles portal events\n // through the component tree, so check the DOM: a portal wrapper that\n // does not contain this surface is nested inside it.\n const layer = (e.target as Element).closest?.(\"[data-react-fancy-portal]\");\n if (layer && !layer.contains(el)) return;\n // Stop it here so an enclosing dialog's document listener does not also\n // close: one Escape, one step back.\n e.preventDefault();\n e.stopPropagation();\n setFullScreen(false);\n },\n [closeOnEscape, setFullScreen],\n );\n\n const activeMode: FullScreenMode | null = fullScreen ? (nativeActive ? \"native\" : \"overlay\") : null;\n const enterLabel = labels?.enter ?? \"Enter full screen\";\n const exitLabel = labels?.exit ?? \"Exit full screen\";\n\n return {\n fullScreen,\n setFullScreen,\n toggle,\n activeMode,\n ref,\n portalContainer,\n targetProps: {\n ref,\n \"data-fullscreen\": fullScreen ? \"true\" : \"false\",\n ...(activeMode ? { \"data-fullscreen-mode\": activeMode } : {}),\n ...(fullScreen && applied ? { style: { ...OVERLAY_STYLE, zIndex } } : {}),\n onKeyDown,\n },\n toggleProps: {\n type: \"button\",\n onClick: toggle,\n \"aria-pressed\": fullScreen,\n \"aria-label\": fullScreen ? exitLabel : enterLabel,\n title: fullScreen ? exitLabel : enterLabel,\n \"data-react-fancy-fullscreen-toggle\": \"\",\n \"data-fullscreen\": fullScreen ? \"true\" : \"false\",\n },\n };\n}\n"]}
|