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

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