ray-template/docs/assets/reference_hooks_browser.md.DTXFP5RX.lean.js

2 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as I}from"./chunks/AdminExample.vue_vue_type_script_setup_true_lang.wPcM-fsm.js";import{aa as j,ab as R,S as O,p as V,d as H,ac as M,o as v,b as z,w as m,j as t,E as o,k as F,a as C,t as L,_ as Y,c as $,a3 as f}from"./chunks/framework.D8G7yXPy.js";import{u as U}from"./chunks/unref-element.BgeEuJ_j.js";import{B as G,_ as X}from"./chunks/DemoFrame.vue_vue_type_script_setup_true_lang.CEMQDpbD.js";import"./chunks/light.BQgF5P5u.js";function J(k){return j()?(R(k),!0):!1}let W=999;const r="data-element-fullscreen",c=new WeakSet,K=(k,d)=>{const{beforeEnter:i,beforeExit:p,enter:e,exit:h,backgroundColor:B,zIndex:x,transition:b="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"}={},E=V(!1);let l,a;const g=()=>{a&&(p==null||p(),a(),h==null||h())},u=()=>{const s=U(k);if(!(s instanceof HTMLElement)||c.has(s))return;a&&g(),i==null||i();const{top:w,left:S,width:_,height:T}=s.getBoundingClientRect(),D={position:"fixed","box-sizing":"border-box",top:`${w}px`,left:`${S}px`,width:`${_}px`,height:`${T}px`,transform:"translate(0, 0)","z-index":String(x??++W),transition:"none",...B?{"background-color":B}:{}},q=Object.keys(D).map(n=>[n,s.style.getPropertyValue(n),s.style.getPropertyPriority(n)]),A=s.getAttribute(r);c.add(s),a=()=>{l!==void 0&&cancelAnimationFrame(l),l=void 0;for(const[n,y,P]of q)s.style.setProperty(n,y,P);A===null?s.removeAttribute(r):s.setAttribute(r,A),a=void 0,c.delete(s),E.value=!1},s.setAttribute(r,"true");for(const[n,y]of Object.entries(D))s.style.setProperty(n,y);s.offsetHeight,s.style.transition=b,l=requestAnimationFrame(()=>{Object.assign(s.style,{top:"0px",left:"0px",width:"100dvw",height:"100dvh"}),l=void 0}),E.value=!0,e==null||e()},N=()=>{E.value?g():u()};return J(()=>{a&&(a(),h==null||h())}),{enter:u,exit:g,toggleFullscreen:N,isFullscreen:O(E)}},Q={ref:"preview",class:"ray-demo fullscreen-demo"},Z=H({__name:"FullscreenDemo",setup(k){const{isFullscreen:d,toggleFullscreen:i}=K(M("preview"));return(p,e)=>(v(),z(X,null,{default:m(()=>[t("div",Q,[o(F(G),{onClick:F(i)},{default:m(()=>[C(L(F(d)?"退出全屏 / Exit full screen":"元素全屏 / Full screen"),1)]),_:1},8,["onClick"])],512)]),_:1}))}}),ss=Y(Z,[["__scopeId","data-v-32a633ef"]]),ts=JSON.parse('{"title":"窗口、全屏和日期","description":"","frontmatter":{},"headers":[],"relativePath":"reference/hooks/browser.md","filePath":"reference/hooks/browser.md"}'),is={name:"reference/hooks/browser.md"},ps=Object.assign(is,{setup(k){return(d,i)=>(v(),$("div",null,[i[0]||(i[0]=t("h1",{id:"窗口、全屏和日期",tabindex:"-1"},[C("窗口、全屏和日期 "),t("a",{class:"header-anchor",href:"#窗口、全屏和日期","aria-label":'Permalink to "窗口、全屏和日期"'},"​")],-1)),i[1]||(i[1]=t("h2",{id:"交互示例",tabindex:"-1"},[C("交互示例 "),t("a",{class:"header-anchor",href:"#交互示例","aria-label":'Permalink to "交互示例"'},"​")],-1)),o(I,{path:"/web-hooks",title:"窗口宽度和日期范围",focus:"useDevice,useDayjs"}),i[2]||(i[2]=f("",6)),o(ss),i[3]||(i[3]=f("",10))]))}});export{ts as __pageData,ps as default};