@joy-ride/game 0.26.0 → 0.26.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/bookmarklet.d.ts +1 -1
- package/embed-chunks/{CodeBlock-QLZWgPoe.js → CodeBlock-Dn8EZ_BP.js} +1 -1
- package/embed-chunks/{Documentation-BJMN2wVe.js → Documentation-FnghYLFE.js} +2 -2
- package/embed-chunks/{EmbedPanel-sqS3N8pg.js → EmbedPanel-DZGEiiy9.js} +1 -1
- package/embed-chunks/{JoyRideView-DaI5oip_.js → JoyRideView-EDSeeY9m.js} +1 -1
- package/embed-chunks/runtime~JoyRideView~browser-session-core-D3nCbCee.js +1 -0
- package/embed-chunks/runtime~browser-session-core-CXDCVDsi.js +1 -0
- package/embed-chunks/runtime~index~embed-BVbNVFHj.js +210 -0
- package/embed-chunks/{src-rpwqYZr-.js → src-BBr94UQ7.js} +2 -2
- package/embed-chunks/{vehicle-popover-C34y-W5W.js → vehicle-popover-DxuDMFyq.js} +1 -1
- package/embed.js +1 -1
- package/{index-BqJy85Tu.d.ts → index-BeKl7UbC.d.ts} +8 -9
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/npm-chunks/{Documentation-Nc7GWFnR.js → Documentation-_R0nI0HT.js} +2 -2
- package/npm-chunks/{EmbedPanel-DRQcCEA1.js → EmbedPanel-lzZkV-zO.js} +1 -1
- package/npm-chunks/{JoyRideView-B3g_Yxhd.js → JoyRideView-fHWzVVNB.js} +1 -1
- package/npm-chunks/runtime~JoyRideView~browser-session-core-BkwDrc9q.js +1 -0
- package/npm-chunks/runtime~browser-session-core-Y1rfFp6D.js +1 -0
- package/npm-chunks/{runtime~react-Jmjjtxii.js → runtime~react-CoMJOwyg.js} +1 -1
- package/npm-chunks/runtime~react~browser-session-core-35T1PZHO.js +1 -0
- package/npm-chunks/{vehicle-popover-DAESh8qQ.js → vehicle-popover-Deuulng7.js} +1 -1
- package/package.json +1 -1
- package/{playground-DrT_x51v.d.ts → playground-e0rOBXY5.d.ts} +1 -0
- package/react.d.ts +2 -2
- package/react.js +2 -2
- package/embed-chunks/runtime~JoyRideView~browser-session-core-Bkk9BE6P.js +0 -1
- package/embed-chunks/runtime~browser-session-core-COeP2p6D.js +0 -1
- package/embed-chunks/runtime~index~embed-cWNM8Fsj.js +0 -210
- package/npm-chunks/runtime~JoyRideView~browser-session-core-CBQyAv9f.js +0 -1
- package/npm-chunks/runtime~browser-session-core-CuLU4VUg.js +0 -1
- package/npm-chunks/runtime~react~browser-session-core-n5P8q7G8.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./configuration~react~vehicle-popover~EmbedPanel~Documentation~JoyRideView~browser-session-co~fvauaeow-mgPW9A8j.js";import{a as t,i as n,r,t as i}from"./configuration~react~vehicle-popover~EmbedPanel~JoyRideView~browser-session-core-rFMaxKZs.js";import{N as a,S as o,a as s,c,h as l,l as u,m as d,o as f,u as p,x as m,y as h}from"./X.es-VqSWeM6N.js";import{A as g,L as _,T as v,b as y,m as b,v as x}from"./input-DHpsGB-l.js";import{t as S}from"./CodeBlock-35k1cnjA.js";import{a as C,c as w,f as T,g as E,h as D,i as O,l as k,m as A,n as j,o as M,p as N,r as P,s as F,t as I,v as L,y as R}from"./vehicle-popover-DAESh8qQ.js";import*as z from"react";import{useState as B}from"react";import{Fragment as ee,jsx as V,jsxs as H}from"react/jsx-runtime";var U=z.createContext(void 0);function W(){let e=z.useContext(U);if(e===void 0)throw Error(h(10));return e}var G={value:()=>null},te=z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,hiddenUntilFound:a,keepMounted:s,loopFocus:l,onValueChange:u,multiple:d=!1,orientation:f=`vertical`,value:m,defaultValue:h,style:g,..._}=e,v=h??p,y=z.useRef([]),[b,x]=k({controlled:m,default:v,name:`Accordion`,state:`value`}),S=o((e,t,n)=>{let r;r=d?t?[...b,e]:b.filter(t=>t!==e):b[0]===e?[]:[e],u?.(r,n),!n.isCanceled&&x(r)}),C=z.useMemo(()=>({value:b,disabled:i,orientation:f}),[b,i,f]),T=z.useMemo(()=>({disabled:i,handleValueChange:S,hiddenUntilFound:a??!1,keepMounted:s??!1,state:C,value:b}),[i,S,a,s,C,b]),E=c(`div`,e,{state:C,ref:t,props:_,stateAttributesMapping:G});return V(U.Provider,{value:T,children:V(w,{elementsRef:y,children:E})})});function ne(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,s]=k({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=T(a,!0,!0),d=g(),[f,p]=z.useState(),m=f===null?void 0:f??d,h=o(e=>{let t=!a,n=y(x,e.nativeEvent);r(t,n),!n.isCanceled&&s(t)});return z.useMemo(()=>({defaultPanelId:d,disabled:i,handleTrigger:h,mounted:c,open:a,panelId:m,setMounted:l,setOpen:s,setPanelIdState:p,transitionStatus:u}),[d,i,h,c,a,m,l,s,p,u])}var re=z.createContext(void 0);function ie(){let e=z.useContext(re);if(e===void 0)throw Error(h(15));return e}var K=z.createContext(void 0);function q(){let e=z.useContext(K);if(e===void 0)throw Error(h(9));return e}var ae=`data-open`,oe=`data-closed`,J=L,se=`data-panel-open`,ce={[ae]:``},le={[oe]:``},ue={open(e){return e?{[se]:``}:null}},de={open(e){return e?ce:le}},fe=`data-index`,Y={...de,index:e=>({[fe]:String(e)}),...E,value:()=>null},pe=z.forwardRef(function(e,t){let{className:n,disabled:r=!1,onOpenChange:i,render:a,value:s,style:l,...u}=e,{ref:d,index:f}=F(),{disabled:p,handleValueChange:m,state:h,value:_}=W(),v=g(),y=s??v,b=r||p,x=_.includes(y),S=o((e,t)=>{i?.(e,t),!t.isCanceled&&m(y,e,t)}),C=ne({open:x,onOpenChange:S,disabled:b}),w=z.useMemo(()=>({...C,onOpenChange:S,state:{open:C.open,disabled:C.disabled,transitionStatus:C.transitionStatus}}),[C,S]),T=z.useMemo(()=>({...h,hidden:!x&&!C.mounted,index:f,disabled:b,open:x}),[C.mounted,b,f,x,h]),E=g(),[D,O]=z.useState(),k=D===null?void 0:D??E,A=z.useMemo(()=>({defaultTriggerId:E,open:x,state:T,setTriggerId:O,triggerId:k}),[E,x,T,O,k]),j=c(`div`,e,{state:T,ref:[t,d],props:u,stateAttributesMapping:Y});return V(re.Provider,{value:w,children:V(K.Provider,{value:A,children:j})})}),me=z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=q();return c(`h3`,e,{state:o,ref:t,props:a,stateAttributesMapping:Y})}),he={...Y,...ue},ge=z.forwardRef(function(e,t){let{disabled:n,className:r,id:i,render:a,nativeButton:o=!0,style:s,...u}=e,{panelId:d,open:f,handleTrigger:p,disabled:h}=ie(),{getButtonProps:g,buttonRef:_}=l({disabled:n||h,native:o}),{defaultTriggerId:v,state:y,setTriggerId:b}=q(),x=i||void 0,S=x??v;return m(()=>(b(e=>x??(e===null?void 0:e)),()=>{b(e=>e===x?null:e)}),[x,b]),c(`button`,e,{state:y,ref:[t,_],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:p},u,g],stateAttributesMapping:he})}),X={height:void 0,width:void 0};function _e(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:s,open:c,setMounted:l,setOpen:u,transitionStatus:f}=e,p=z.useRef(null),h=z.useRef(null),[g,_]=z.useState(X),x=z.useRef(X),S=z.useRef(!1),w=z.useRef(c),T=z.useRef(!1),[E,O]=z.useState(!1),k=z.useRef(null),j=d(t,p),P=C(c),F=A(p),I=!c&&!a,L=E?`idle`:f,R=c&&(w.current||T.current),B=!c&&a&&h.current===`css-animation`&&g.height===void 0&&g.width===void 0?x.current:g,ee=n&&I&&h.current!==`css-animation`,V=o((e,t=!0)=>{t&&(x.current=e),_(e)}),H=o(()=>{k.current?.(),k.current=null}),U=o(e=>{H(),k.current=()=>{k.current=null,e()}}),W=o(()=>{c&&a&&h.current===`css-animation`&&(T.current=!0)});m(()=>{E&&f!==`starting`&&O(!1)},[E,f]),z.useEffect(()=>()=>{W(),H()},[W,H]),m(()=>{c||(w.current=!1,T.current=!1);let e=p.current;if(!e)return;!c&&k.current&&H();let t=ve(e,R);if(h.current=t,c&&f===`idle`&&w.current&&t===`css-animation`){x.current=Z(e);return}if(c&&f===`starting`){let n=S.current;if(S.current=!1,t===`none`){V(Z(e)),O(!0);return}if(t===`css-transition`){let t=be(e);if(V(Z(e)),!n)return t;let r=Q(e,`transition-duration`,`0s`);return U(r),O(!0),t}V(Z(e));let r=Q(e,`animation-name`,`none`);if(!n){r();return}let i=Q(e,`animation-duration`,`0s`);r(),U(i),O(!0);return}if(!c&&a&&(f===`idle`||f===`starting`)){if(t===`none`){V(X,!1),l(!1);return}V(Z(e));return}if(f!==`ending`)return;if(t===`none`){l(!1);return}let n=Z(e);n.height>0||n.width>0?(V(n),t===`css-animation`&&Q(e,`animation-name`,`none`)()):l(!1)},[a,c,H,V,l,U,R,f]),N({enabled:c&&a&&L===`idle`,open:!0,ref:p,onComplete(){c&&V(X,!1)}}),z.useEffect(()=>{if(c||!a||L!==`ending`)return;if(!p.current){l(!1),V(X,!1);return}let e=new AbortController,t=-1;function n(){P.current||(l(!1),V(X,!1))}return t=D.request(()=>{F(n,e.signal)}),()=>{D.cancel(t),e.abort()}},[P,a,c,L,F,V,l]),m(()=>{let e=p.current;e&&n&&I&&e.setAttribute(`hidden`,`until-found`)},[I,n]),z.useEffect(function(){let e=p.current;if(!e)return;let t=v.create(),n=-1,r=(r,i)=>{t.start(0,()=>{P.current||(n=D.request(()=>{P.current||(r&&(S.current=!1),i&&e.setAttribute(J,``),e.setAttribute(`hidden`,`until-found`))}))})},i=M(e,`beforematch`,t=>{let n=y(b,t);if(s(!0,n),n.isCanceled){r(!1,!1);return}S.current=!0;let i=e.hasAttribute(J);e.removeAttribute(J),u(!0),r(!0,i)});return()=>{t.clear(),D.cancel(n),i()}},[P,s,u]);let G=i||n||a||c;return{height:B.height,props:{...ee?{[J]:``}:void 0,hidden:I,id:r},ref:j,shouldPreventOpenAnimation:R,shouldRender:G,transitionStatus:L,width:B.width}}function Z(e){return{height:e.scrollHeight,width:e.scrollWidth}}function ve(e,t){let n=a(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&ye(n.animationDuration),i=ye(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function ye(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function Q(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function be(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=D.request(n);return()=>{D.cancel(r),n()}}var xe=`--accordion-panel-height`,Se=`--accordion-panel-width`,Ce=z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,id:a,render:o,style:s,...l}=e,{hiddenUntilFound:d,keepMounted:f}=W(),{defaultPanelId:p,mounted:h,onOpenChange:g,open:_,setMounted:v,setOpen:y,setPanelIdState:b,transitionStatus:x}=ie(),S=r??d,C=i??f,w=a||void 0,T=a??p;m(()=>(b(e=>w??(e===null?void 0:e)),()=>{b(e=>e===w?null:e)}),[w,b]);let{height:E,props:D,ref:O,shouldPreventOpenAnimation:k,shouldRender:A,transitionStatus:j,width:M}=_e({externalRef:t,hiddenUntilFound:S,id:T,keepMounted:C,mounted:h,onOpenChange:g,open:_,setMounted:v,setOpen:y,transitionStatus:x}),{state:N,triggerId:P}=q(),F={...N,transitionStatus:j},I=u(s,F),L=c(`div`,{...e,style:void 0},{state:F,ref:O,props:[D,{"aria-labelledby":P,role:`region`,style:{[xe]:E===void 0?`auto`:`${E}px`,[Se]:M===void 0?`auto`:`${M}px`}},l,I?{style:I}:void 0,k?{style:{animationName:`none`}}:void 0],stateAttributesMapping:Y});return A?L:null});function we({className:e,...t}){return V(te,{"data-slot":`accordion`,className:f(`flex w-full flex-col`,e),...t})}function Te({className:e,...t}){return V(pe,{"data-slot":`accordion-item`,className:f(`not-last:border-b`,e),...t})}function Ee({className:e,children:t,...n}){return V(me,{className:`flex`,children:H(ge,{"data-slot":`accordion-trigger`,className:f(`group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...n,children:[t,V(_,{"aria-hidden":`true`,"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),V(R,{"aria-hidden":`true`,"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function De({className:e,children:t,...n}){return V(Ce,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up`,...n,children:V(`div`,{className:f(`h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}function Oe({className:e,size:t=`default`,...n}){return V(`div`,{"data-slot":`card`,"data-size":t,className:f(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function ke({className:e,...t}){return V(`div`,{"data-slot":`card-header`,className:f(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...t})}function Ae({className:e,...t}){return V(`div`,{"data-slot":`card-title`,className:f(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function je({className:e,...t}){return V(`div`,{"data-slot":`card-description`,className:f(`text-sm text-muted-foreground`,e),...t})}function Me({className:e,...t}){return V(`div`,{"data-slot":`card-action`,className:f(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}var $={game:{title:`Game`,description:`Visuals, sound, performance, tools, and rules`},dialog:{title:`Dialog`,description:`Appearance, visible tabs, and visitor settings access`}};function Ne({value:a,onChange:o}){let[c,l]=B(),u=r(t(i,a)),d=(e,t,n)=>o({...a,[e]:{...a[e],[t]:n}});return H(`section`,{"aria-label":`Embed options`,className:`space-y-3 py-2 text-xs`,ref:e=>{let t=e?.getRootNode();t instanceof ShadowRoot&&t!==c&&l(t)},children:[V(Oe,{size:`sm`,className:`gap-0 bg-muted/30`,children:H(ke,{className:`grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3`,children:[V(Ae,{children:`Configure your embed`}),V(je,{children:`Choose the experience and what visitors can change.`}),V(Me,{children:V(s,{variant:`outline`,size:`sm`,onClick:()=>{let e={...a};for(let t of Object.keys(n))Object.assign(e,{[t]:{...e[t],...n[t]}});o(e)},children:`Use SFW defaults`})})]})}),V(we,{defaultValue:[],className:`gap-2`,children:Object.keys($).map(t=>H(Te,{value:t,className:`rounded-lg border bg-card/40 px-3`,children:[V(Ee,{className:`py-3 hover:no-underline`,children:H(`span`,{className:`grid gap-1`,children:[V(`span`,{children:$[t].title}),V(`span`,{className:`text-[11px] font-normal text-muted-foreground`,children:$[t].description})]})}),V(De,{children:V(`div`,{className:`divide-y border-t`,children:e.filter(e=>e.category===t).map(e=>{let t=`embed-${e.category}-${e.key}`,n=u[e.category][e.key],r=[`hint`,`tabs`].includes(e.control);return H(`div`,{className:r?`grid gap-3 py-3`:`flex items-center justify-between gap-4 py-3`,children:[H(`label`,{htmlFor:t,className:`grid min-w-0 gap-1 font-medium`,children:[V(`span`,{children:e.label}),e.help&&V(`span`,{className:`max-w-72 font-normal text-muted-foreground`,children:e.help})]}),V(O,{id:t,entry:e,value:n,container:c,onChange:t=>d(e.category,e.key,t)})]},e.key)})})})]},t))})]})}function Pe({embed:e}){let[t,n]=B(`html`),r={html:{code:e.html,language:`html`,title:`HTML embed`},async:{code:e.async,language:`javascript`,title:`CDN`},npm:{code:e.npm,language:`javascript`,title:`JavaScript`},react:{code:e.react??``,language:`tsx`,title:`React`},bookmarklet:{code:e.bookmarklet,language:`javascript`,title:`Bookmarklet URL`}}[t];return H(`section`,{className:`min-h-full px-3 py-2.5 text-sm`,children:[e.error?V(`p`,{role:`alert`,children:e.error}):H(ee,{children:[V(I,{value:t,onValueChange:e=>n(e),className:`my-2.5 gap-0`,children:H(j,{className:`w-full`,"aria-label":`Embed format`,children:[V(P,{value:`html`,className:`text-sm`,children:`HTML`}),V(P,{value:`async`,className:`text-sm`,children:`CDN`}),V(P,{value:`npm`,className:`text-sm`,children:`JavaScript`}),V(P,{value:`react`,className:`text-sm`,disabled:!e.react,children:`React`}),V(P,{value:`bookmarklet`,className:`text-sm`,children:`Bookmarklet`})]})}),(t===`npm`||t===`react`)&&V(`div`,{className:`mb-3`,children:V(S,{code:`npm install @joy-ride/game`,language:`shell`,title:`Install the package`,compact:!0})}),V(S,{code:r.code,language:r.language,title:r.title,compact:!0,maxHeight:210,wrap:t===`html`||t===`bookmarklet`})]}),e.configuration&&e.onConfigure&&V(Ne,{value:e.configuration,onChange:e.onConfigure})]})}export{Pe as EmbedPanel};
|
|
1
|
+
import{t as e}from"./configuration~react~vehicle-popover~EmbedPanel~Documentation~JoyRideView~browser-session-co~fvauaeow-mgPW9A8j.js";import{a as t,i as n,r,t as i}from"./configuration~react~vehicle-popover~EmbedPanel~JoyRideView~browser-session-core-rFMaxKZs.js";import{N as a,S as o,a as s,c,h as l,l as u,m as d,o as f,u as p,x as m,y as h}from"./X.es-VqSWeM6N.js";import{A as g,L as _,T as v,b as y,m as b,v as x}from"./input-DHpsGB-l.js";import{t as S}from"./CodeBlock-35k1cnjA.js";import{a as C,c as w,f as T,g as E,h as D,i as O,l as k,m as A,n as j,o as M,p as N,r as P,s as F,t as I,v as L,y as R}from"./vehicle-popover-Deuulng7.js";import*as z from"react";import{useState as B}from"react";import{Fragment as ee,jsx as V,jsxs as H}from"react/jsx-runtime";var U=z.createContext(void 0);function W(){let e=z.useContext(U);if(e===void 0)throw Error(h(10));return e}var G={value:()=>null},te=z.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,hiddenUntilFound:a,keepMounted:s,loopFocus:l,onValueChange:u,multiple:d=!1,orientation:f=`vertical`,value:m,defaultValue:h,style:g,..._}=e,v=h??p,y=z.useRef([]),[b,x]=k({controlled:m,default:v,name:`Accordion`,state:`value`}),S=o((e,t,n)=>{let r;r=d?t?[...b,e]:b.filter(t=>t!==e):b[0]===e?[]:[e],u?.(r,n),!n.isCanceled&&x(r)}),C=z.useMemo(()=>({value:b,disabled:i,orientation:f}),[b,i,f]),T=z.useMemo(()=>({disabled:i,handleValueChange:S,hiddenUntilFound:a??!1,keepMounted:s??!1,state:C,value:b}),[i,S,a,s,C,b]),E=c(`div`,e,{state:C,ref:t,props:_,stateAttributesMapping:G});return V(U.Provider,{value:T,children:V(w,{elementsRef:y,children:E})})});function ne(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,s]=k({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=T(a,!0,!0),d=g(),[f,p]=z.useState(),m=f===null?void 0:f??d,h=o(e=>{let t=!a,n=y(x,e.nativeEvent);r(t,n),!n.isCanceled&&s(t)});return z.useMemo(()=>({defaultPanelId:d,disabled:i,handleTrigger:h,mounted:c,open:a,panelId:m,setMounted:l,setOpen:s,setPanelIdState:p,transitionStatus:u}),[d,i,h,c,a,m,l,s,p,u])}var re=z.createContext(void 0);function ie(){let e=z.useContext(re);if(e===void 0)throw Error(h(15));return e}var K=z.createContext(void 0);function q(){let e=z.useContext(K);if(e===void 0)throw Error(h(9));return e}var ae=`data-open`,oe=`data-closed`,J=L,se=`data-panel-open`,ce={[ae]:``},le={[oe]:``},ue={open(e){return e?{[se]:``}:null}},de={open(e){return e?ce:le}},fe=`data-index`,Y={...de,index:e=>({[fe]:String(e)}),...E,value:()=>null},pe=z.forwardRef(function(e,t){let{className:n,disabled:r=!1,onOpenChange:i,render:a,value:s,style:l,...u}=e,{ref:d,index:f}=F(),{disabled:p,handleValueChange:m,state:h,value:_}=W(),v=g(),y=s??v,b=r||p,x=_.includes(y),S=o((e,t)=>{i?.(e,t),!t.isCanceled&&m(y,e,t)}),C=ne({open:x,onOpenChange:S,disabled:b}),w=z.useMemo(()=>({...C,onOpenChange:S,state:{open:C.open,disabled:C.disabled,transitionStatus:C.transitionStatus}}),[C,S]),T=z.useMemo(()=>({...h,hidden:!x&&!C.mounted,index:f,disabled:b,open:x}),[C.mounted,b,f,x,h]),E=g(),[D,O]=z.useState(),k=D===null?void 0:D??E,A=z.useMemo(()=>({defaultTriggerId:E,open:x,state:T,setTriggerId:O,triggerId:k}),[E,x,T,O,k]),j=c(`div`,e,{state:T,ref:[t,d],props:u,stateAttributesMapping:Y});return V(re.Provider,{value:w,children:V(K.Provider,{value:A,children:j})})}),me=z.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=q();return c(`h3`,e,{state:o,ref:t,props:a,stateAttributesMapping:Y})}),he={...Y,...ue},ge=z.forwardRef(function(e,t){let{disabled:n,className:r,id:i,render:a,nativeButton:o=!0,style:s,...u}=e,{panelId:d,open:f,handleTrigger:p,disabled:h}=ie(),{getButtonProps:g,buttonRef:_}=l({disabled:n||h,native:o}),{defaultTriggerId:v,state:y,setTriggerId:b}=q(),x=i||void 0,S=x??v;return m(()=>(b(e=>x??(e===null?void 0:e)),()=>{b(e=>e===x?null:e)}),[x,b]),c(`button`,e,{state:y,ref:[t,_],props:[{"aria-controls":f?d:void 0,"aria-expanded":f,id:S,onClick:p},u,g],stateAttributesMapping:he})}),X={height:void 0,width:void 0};function _e(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:a,onOpenChange:s,open:c,setMounted:l,setOpen:u,transitionStatus:f}=e,p=z.useRef(null),h=z.useRef(null),[g,_]=z.useState(X),x=z.useRef(X),S=z.useRef(!1),w=z.useRef(c),T=z.useRef(!1),[E,O]=z.useState(!1),k=z.useRef(null),j=d(t,p),P=C(c),F=A(p),I=!c&&!a,L=E?`idle`:f,R=c&&(w.current||T.current),B=!c&&a&&h.current===`css-animation`&&g.height===void 0&&g.width===void 0?x.current:g,ee=n&&I&&h.current!==`css-animation`,V=o((e,t=!0)=>{t&&(x.current=e),_(e)}),H=o(()=>{k.current?.(),k.current=null}),U=o(e=>{H(),k.current=()=>{k.current=null,e()}}),W=o(()=>{c&&a&&h.current===`css-animation`&&(T.current=!0)});m(()=>{E&&f!==`starting`&&O(!1)},[E,f]),z.useEffect(()=>()=>{W(),H()},[W,H]),m(()=>{c||(w.current=!1,T.current=!1);let e=p.current;if(!e)return;!c&&k.current&&H();let t=ve(e,R);if(h.current=t,c&&f===`idle`&&w.current&&t===`css-animation`){x.current=Z(e);return}if(c&&f===`starting`){let n=S.current;if(S.current=!1,t===`none`){V(Z(e)),O(!0);return}if(t===`css-transition`){let t=be(e);if(V(Z(e)),!n)return t;let r=Q(e,`transition-duration`,`0s`);return U(r),O(!0),t}V(Z(e));let r=Q(e,`animation-name`,`none`);if(!n){r();return}let i=Q(e,`animation-duration`,`0s`);r(),U(i),O(!0);return}if(!c&&a&&(f===`idle`||f===`starting`)){if(t===`none`){V(X,!1),l(!1);return}V(Z(e));return}if(f!==`ending`)return;if(t===`none`){l(!1);return}let n=Z(e);n.height>0||n.width>0?(V(n),t===`css-animation`&&Q(e,`animation-name`,`none`)()):l(!1)},[a,c,H,V,l,U,R,f]),N({enabled:c&&a&&L===`idle`,open:!0,ref:p,onComplete(){c&&V(X,!1)}}),z.useEffect(()=>{if(c||!a||L!==`ending`)return;if(!p.current){l(!1),V(X,!1);return}let e=new AbortController,t=-1;function n(){P.current||(l(!1),V(X,!1))}return t=D.request(()=>{F(n,e.signal)}),()=>{D.cancel(t),e.abort()}},[P,a,c,L,F,V,l]),m(()=>{let e=p.current;e&&n&&I&&e.setAttribute(`hidden`,`until-found`)},[I,n]),z.useEffect(function(){let e=p.current;if(!e)return;let t=v.create(),n=-1,r=(r,i)=>{t.start(0,()=>{P.current||(n=D.request(()=>{P.current||(r&&(S.current=!1),i&&e.setAttribute(J,``),e.setAttribute(`hidden`,`until-found`))}))})},i=M(e,`beforematch`,t=>{let n=y(b,t);if(s(!0,n),n.isCanceled){r(!1,!1);return}S.current=!0;let i=e.hasAttribute(J);e.removeAttribute(J),u(!0),r(!0,i)});return()=>{t.clear(),D.cancel(n),i()}},[P,s,u]);let G=i||n||a||c;return{height:B.height,props:{...ee?{[J]:``}:void 0,hidden:I,id:r},ref:j,shouldPreventOpenAnimation:R,shouldRender:G,transitionStatus:L,width:B.width}}function Z(e){return{height:e.scrollHeight,width:e.scrollWidth}}function ve(e,t){let n=a(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&ye(n.animationDuration),i=ye(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function ye(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function Q(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{r===``?e.style.removeProperty(t):e.style.setProperty(t,r,i)}}function be(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})}let r=D.request(n);return()=>{D.cancel(r),n()}}var xe=`--accordion-panel-height`,Se=`--accordion-panel-width`,Ce=z.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,id:a,render:o,style:s,...l}=e,{hiddenUntilFound:d,keepMounted:f}=W(),{defaultPanelId:p,mounted:h,onOpenChange:g,open:_,setMounted:v,setOpen:y,setPanelIdState:b,transitionStatus:x}=ie(),S=r??d,C=i??f,w=a||void 0,T=a??p;m(()=>(b(e=>w??(e===null?void 0:e)),()=>{b(e=>e===w?null:e)}),[w,b]);let{height:E,props:D,ref:O,shouldPreventOpenAnimation:k,shouldRender:A,transitionStatus:j,width:M}=_e({externalRef:t,hiddenUntilFound:S,id:T,keepMounted:C,mounted:h,onOpenChange:g,open:_,setMounted:v,setOpen:y,transitionStatus:x}),{state:N,triggerId:P}=q(),F={...N,transitionStatus:j},I=u(s,F),L=c(`div`,{...e,style:void 0},{state:F,ref:O,props:[D,{"aria-labelledby":P,role:`region`,style:{[xe]:E===void 0?`auto`:`${E}px`,[Se]:M===void 0?`auto`:`${M}px`}},l,I?{style:I}:void 0,k?{style:{animationName:`none`}}:void 0],stateAttributesMapping:Y});return A?L:null});function we({className:e,...t}){return V(te,{"data-slot":`accordion`,className:f(`flex w-full flex-col`,e),...t})}function Te({className:e,...t}){return V(pe,{"data-slot":`accordion-item`,className:f(`not-last:border-b`,e),...t})}function Ee({className:e,children:t,...n}){return V(me,{className:`flex`,children:H(ge,{"data-slot":`accordion-trigger`,className:f(`group/accordion-trigger relative flex flex-1 items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...n,children:[t,V(_,{"aria-hidden":`true`,"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),V(R,{"aria-hidden":`true`,"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function De({className:e,children:t,...n}){return V(Ce,{"data-slot":`accordion-content`,className:`overflow-hidden text-sm data-open:animate-accordion-down data-closed:animate-accordion-up`,...n,children:V(`div`,{className:f(`h-(--accordion-panel-height) pt-0 pb-2.5 data-ending-style:h-0 data-starting-style:h-0 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}function Oe({className:e,size:t=`default`,...n}){return V(`div`,{"data-slot":`card`,"data-size":t,className:f(`group/card flex flex-col gap-(--card-spacing) overflow-hidden rounded-xl bg-card py-(--card-spacing) text-sm text-card-foreground ring-1 ring-foreground/10 [--card-spacing:--spacing(4)] has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:[--card-spacing:--spacing(3)] data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl`,e),...n})}function ke({className:e,...t}){return V(`div`,{"data-slot":`card-header`,className:f(`group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-(--card-spacing) has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-(--card-spacing)`,e),...t})}function Ae({className:e,...t}){return V(`div`,{"data-slot":`card-title`,className:f(`font-heading text-base leading-snug font-medium group-data-[size=sm]/card:text-sm`,e),...t})}function je({className:e,...t}){return V(`div`,{"data-slot":`card-description`,className:f(`text-sm text-muted-foreground`,e),...t})}function Me({className:e,...t}){return V(`div`,{"data-slot":`card-action`,className:f(`col-start-2 row-span-2 row-start-1 self-start justify-self-end`,e),...t})}var $={game:{title:`Game`,description:`Visuals, sound, performance, tools, and rules`},dialog:{title:`Dialog`,description:`Appearance, visible tabs, and visitor settings access`}};function Ne({value:a,onChange:o}){let[c,l]=B(),u=r(t(i,a)),d=(e,t,n)=>o({...a,[e]:{...a[e],[t]:n}});return H(`section`,{"aria-label":`Embed options`,className:`space-y-3 py-2 text-xs`,ref:e=>{let t=e?.getRootNode();t instanceof ShadowRoot&&t!==c&&l(t)},children:[V(Oe,{size:`sm`,className:`gap-0 bg-muted/30`,children:H(ke,{className:`grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3`,children:[V(Ae,{children:`Configure your embed`}),V(je,{children:`Choose the experience and what visitors can change.`}),V(Me,{children:V(s,{variant:`outline`,size:`sm`,onClick:()=>{let e={...a};for(let t of Object.keys(n))Object.assign(e,{[t]:{...e[t],...n[t]}});o(e)},children:`Use SFW defaults`})})]})}),V(we,{defaultValue:[],className:`gap-2`,children:Object.keys($).map(t=>H(Te,{value:t,className:`rounded-lg border bg-card/40 px-3`,children:[V(Ee,{className:`py-3 hover:no-underline`,children:H(`span`,{className:`grid gap-1`,children:[V(`span`,{children:$[t].title}),V(`span`,{className:`text-[11px] font-normal text-muted-foreground`,children:$[t].description})]})}),V(De,{children:V(`div`,{className:`divide-y border-t`,children:e.filter(e=>e.category===t).map(e=>{let t=`embed-${e.category}-${e.key}`,n=u[e.category][e.key],r=[`hint`,`tabs`].includes(e.control);return H(`div`,{className:r?`grid gap-3 py-3`:`flex items-center justify-between gap-4 py-3`,children:[H(`label`,{htmlFor:t,className:`grid min-w-0 gap-1 font-medium`,children:[V(`span`,{children:e.label}),e.help&&V(`span`,{className:`max-w-72 font-normal text-muted-foreground`,children:e.help})]}),V(O,{id:t,entry:e,value:n,container:c,onChange:t=>d(e.category,e.key,t)})]},e.key)})})})]},t))})]})}function Pe({embed:e}){let[t,n]=B(`html`),r={html:{code:e.html,language:`html`,title:`HTML embed`},async:{code:e.async,language:`javascript`,title:`CDN`},npm:{code:e.npm,language:`javascript`,title:`JavaScript`},react:{code:e.react??``,language:`tsx`,title:`React`},bookmarklet:{code:e.bookmarklet,language:`javascript`,title:`Bookmarklet URL`}}[t];return H(`section`,{className:`min-h-full px-3 py-2.5 text-sm`,children:[e.error?V(`p`,{role:`alert`,children:e.error}):H(ee,{children:[V(I,{value:t,onValueChange:e=>n(e),className:`my-2.5 gap-0`,children:H(j,{className:`w-full`,"aria-label":`Embed format`,children:[V(P,{value:`html`,className:`text-sm`,children:`HTML`}),V(P,{value:`async`,className:`text-sm`,children:`CDN`}),V(P,{value:`npm`,className:`text-sm`,children:`JavaScript`}),V(P,{value:`react`,className:`text-sm`,disabled:!e.react,children:`React`}),V(P,{value:`bookmarklet`,className:`text-sm`,children:`Bookmarklet`})]})}),(t===`npm`||t===`react`)&&V(`div`,{className:`mb-3`,children:V(S,{code:`npm install @joy-ride/game`,language:`shell`,title:`Install the package`,compact:!0})}),V(S,{code:r.code,language:r.language,title:r.title,compact:!0,maxHeight:210,wrap:t===`html`||t===`bookmarklet`})]}),e.configuration&&e.onConfigure&&V(Ne,{value:e.configuration,onChange:e.onConfigure})]})}export{Pe as EmbedPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime~react~JoyRideView~browser-session-core-BRSYGakW.js";import{r as t}from"./controls~react~vehicle-popover~JoyRideView~browser-session-core~renderer-Cnf30Q_A.js";import{t as n}from"./controls~react~vehicle-popover~Documentation~JoyRideView~browser-session-core-CLDwfJ48.js";import{n as r}from"./runtime~JoyRideView~browser-session-core-
|
|
1
|
+
import{t as e}from"./runtime~react~JoyRideView~browser-session-core-BRSYGakW.js";import{r as t}from"./controls~react~vehicle-popover~JoyRideView~browser-session-core~renderer-Cnf30Q_A.js";import{t as n}from"./controls~react~vehicle-popover~Documentation~JoyRideView~browser-session-core-CLDwfJ48.js";import{n as r}from"./runtime~JoyRideView~browser-session-core-BkwDrc9q.js";import{n as i,t as a}from"./theme-C4ZE2-nQ.js";import{a as o,i as s,n as c,r as l,t as u}from"./X.es-VqSWeM6N.js";import*as d from"react";import{forwardRef as f,useEffect as p,useImperativeHandle as m,useLayoutEffect as h,useMemo as g,useRef as _,useState as v}from"react";import{createPortal as y}from"react-dom";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";var C={steer:0,gas:!1,brake:!1,boost:!1,handbrake:!1,attractor:!1},w={position:`fixed`,bottom:`calc(var(--joy-ride-controls-bottom, 0px) + max(18px, env(safe-area-inset-bottom)))`,zIndex:t(`controls`),touchAction:`none`,userSelect:`none`,WebkitUserSelect:`none`,color:`#f4f4f0`,fontFamily:`Arial, sans-serif`},T={border:`1px solid rgba(255,255,255,.38)`,background:`rgba(24,26,29,.84)`,color:`inherit`,boxShadow:`0 4px 16px #0005`,touchAction:`none`,cursor:`pointer`};function E({onChange:e}){let[t,r]=v(!1),[i,a]=v(C),s=_(C),c=_(null),l=_(e);l.current=e,p(()=>{let e=window.matchMedia(`(pointer: coarse) and (max-width: 850px)`),t=()=>r(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let u=e=>{let t={...s.current,...e};s.current=t,a(t),l.current({...n(t.gas,t.brake),steer:t.steer,action:t.handbrake,boost:t.boost,attractor:t.attractor})};if(p(()=>{let e=()=>{c.current=null,s.current=C,a(C),l.current({throttle:0,steer:0,action:!1,boost:!1})};return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e),e()}},[]),!t)return null;let d=e=>{let t=e.currentTarget.getBoundingClientRect(),n=t.width/2;u({steer:Math.max(-1,Math.min(1,(n-(e.clientX-t.left))/(n*.72)))})},f=(e,t,n,r)=>x(o,{type:`button`,"aria-label":t,"aria-pressed":i[e],onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),u({[e]:!0})},onPointerUp:t=>{t.preventDefault(),u({[e]:!1})},onPointerCancel:()=>u({[e]:!1}),onLostPointerCapture:()=>u({[e]:!1}),style:{...T,gridArea:r,width:e===`attractor`?`100%`:62,height:e===`attractor`?44:62,borderRadius:16,background:i[e]?`rgba(90,94,98,.96)`:T.background,display:`grid`,placeItems:`center`,lineHeight:1,fontSize:10,fontWeight:700,letterSpacing:`.08em`,textTransform:`uppercase`},children:S(`span`,{style:{display:`grid`,gap:3,justifyItems:`center`},children:[x(`span`,{"aria-hidden":`true`,style:{fontSize:20,lineHeight:1},children:n}),t]})});return S(`div`,{"data-jr-touch-controls":``,"aria-label":`Touch driving controls`,children:[x(`div`,{style:{...w,left:`max(16px, env(safe-area-inset-left))`},children:S(`div`,{role:`slider`,"aria-label":`Steering`,"aria-valuemin":-100,"aria-valuemax":100,"aria-valuenow":Math.round(-i.steer*100),tabIndex:0,onKeyDown:e=>{e.key===`ArrowLeft`&&(e.preventDefault(),u({steer:1})),e.key===`ArrowRight`&&(e.preventDefault(),u({steer:-1}))},onKeyUp:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&u({steer:0})},onPointerDown:e=>{e.preventDefault(),c.current=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),d(e)},onPointerMove:e=>{c.current===e.pointerId&&d(e)},onPointerUp:e=>{c.current===e.pointerId&&(c.current=null,u({steer:0}))},onPointerCancel:()=>{c.current=null,u({steer:0})},style:{...T,width:116,height:116,borderRadius:`50%`,position:`relative`,display:`grid`,placeItems:`center`},children:[x(`span`,{"aria-hidden":`true`,style:{position:`absolute`,top:14,fontSize:10,fontWeight:700,letterSpacing:`.1em`,opacity:.8},children:`STEER`}),x(`span`,{"aria-hidden":`true`,style:{width:48,height:48,borderRadius:`50%`,background:`#d1d3d2`,boxShadow:`0 2px 8px #0008`,transform:`translateX(${-i.steer*27}px)`,pointerEvents:`none`}})]})}),S(`div`,{style:{...w,right:`max(16px, env(safe-area-inset-right))`,display:`grid`,gridTemplateAreas:`"attractor attractor" "boost gas" "handbrake brake"`,gap:8},children:[f(`attractor`,`Attract`,`◎`,`attractor`),f(`boost`,`Boost`,x(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:x(`path`,{d:`M13.7 2 5 13h6l-.7 9L19 10h-6l.7-8Z`})}),`boost`),f(`gas`,`Gas`,`↑`,`gas`),f(`handbrake`,`Drift`,`↺`,`handbrake`),f(`brake`,`Brake`,`↓`,`brake`)]})]})}var D=new Map([[`bold`,d.createElement(d.Fragment,null,d.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,d.createElement(d.Fragment,null,d.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),d.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,d.createElement(d.Fragment,null,d.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,d.createElement(d.Fragment,null,d.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,d.createElement(d.Fragment,null,d.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,d.createElement(d.Fragment,null,d.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),O=d.forwardRef((e,t)=>d.createElement(s,{ref:t,...e,weights:D}));O.displayName=`InfoIcon`;var k=f(function({visible:e=!0,className:t=``,children:n,...r},i){return x(`div`,{ref:i,role:`toolbar`,"data-jr-toolbar":``,"data-visible":e,className:`inline-flex items-center gap-0.5 transition-opacity duration-150 ease-out data-[visible=false]:pointer-events-none data-[visible=false]:opacity-0 ${t}`,...r,children:n})});function A({iconOnly:e=!1,className:t=``,children:n,...r}){return x(o,{type:`button`,variant:`ghost`,size:e?`icon-xs`:`xs`,className:`h-[25px] min-h-[25px] rounded-sm border-0 bg-[#202326] px-2 text-[10px] font-semibold text-white shadow-[0_3px_10px_#0004] hover:bg-[#34383b] hover:text-white focus-visible:ring-white/40 [&_svg]:size-[13px] ${e?`w-[25px] p-0`:``} ${t}`,...r,children:n})}var j=i(a);function M(n,r){let i=_(n);i.current=n;let a=_(null),[o,s]=v(null),d=!!n.onExit,f=!!n.overlay&&(d||!!n.onToggleMute||!!n.onControlsHelp);p(()=>{if(!f)return;let e=document.createElement(`joy-ride-vehicle-toolbar`);e.dataset.jrUi=``,e.style.cssText=`position:fixed;left:0;top:0;z-index:${t(`controls`)};pointer-events:none`;let n=e.attachShadow({mode:`open`}),r=document.createElement(`style`);return r.textContent=j,n.append(r),document.body.append(e),s(n),()=>{e.remove(),s(null)}},[f]);let m=t=>e(e=>{let t=r.current?.handle.getPlayground()?.registry;t?t.report(e):console.error(`JoyRide host callback failed`,e)},t);return{adapter:g(()=>({toolbar:()=>a.current,cameraFrame(){let e=Array.from(document.querySelectorAll(`[data-jr-touch-controls] > div`)),t=e.length?Math.min(...e.map(e=>e.getBoundingClientRect().top))-16:window.innerHeight;return e.length?{x:0,y:0,width:window.innerWidth,height:Math.max(160,t)}:null}}),[]),toolbar:n.overlay&&o&&(d||n.onToggleMute||n.onControlsHelp)?y(S(k,{ref:a,"data-jr-ui":``,"aria-label":`Vehicle controls`,visible:!1,inert:!0,className:`fixed pointer-events-auto`,style:{zIndex:t(`controls`)},children:[n.onToggleMute&&x(A,{iconOnly:!0,"aria-label":(n.masterVolume??1)>0?`Mute audio`:`Unmute audio`,onClick:()=>m(i.current.onToggleMute),children:(n.masterVolume??1)>0?x(l,{size:14}):x(c,{size:14})}),n.onControlsHelp&&x(A,{iconOnly:!0,"aria-label":`Open controls help`,title:`Controls help`,onClick:()=>m(i.current.onControlsHelp),children:x(O,{size:14})}),d&&x(A,{iconOnly:!0,"aria-label":`Quit simulation`,onClick:()=>m(i.current.onExit),children:x(u,{size:14})})]}),o):null}}function N({ref:e,overlayRoot:t,className:n,style:r,onControlsHelp:i,...a}){return a}var P=e=>n=>{let i=n,a=N(n),{ref:o,overlay:s=r.overlay,overlayRoot:c,className:l,style:u,mode:d,initialMode:f=r.initialMode,paused:p=r.paused,showTouchControls:g=r.showTouchControls}=i,v=_(null),C=_(null),w=_(a);w.current=a;let T=M(i,C);h(()=>{if(!v.current)return;let t=e(v.current,w.current,T.adapter);return C.current=t,()=>{t.dispose(),C.current=null}},[T.adapter]),m(o,()=>C.current.handle,[]),h(()=>{C.current?.update(a)});let D=x(`canvas`,{ref:v,className:l,style:{display:`block`,width:s?void 0:`100%`,height:s?void 0:`100%`,outline:`none`,touchAction:`none`,...u,...s?{position:`absolute`,zIndex:t(`world`),pointerEvents:`none`}:{}},"data-jr-overlay":s?``:void 0,tabIndex:s?-1:0,"aria-label":`Joy Ride vehicle simulation`});return s&&typeof document<`u`?S(b,{children:[y(S(b,{children:[D,g&&!p&&(d??f)===`car`&&x(E,{onChange:e=>C.current?.touchChange(e)})]}),c??document.body),T.toolbar]}):D};export{P as createJoyRide};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./configuration~react~vehicle-popover~JoyRideView~browser-session-core~renderer-B70Mpi9X.js";import{t}from"./configuration~react~vehicle-popover~EmbedPanel~JoyRideView~browser-session-core-rFMaxKZs.js";var n={...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,{phase:`live`,default:t}])),overlay:{phase:`mount`,default:!1},playground:{phase:`mount`},definitions:{phase:`mount`},audioEngine:{phase:`mount`},initialMode:{phase:`mount`,default:`car`},initialAngle:{phase:`mount`},spawnTarget:{phase:`mount`},initialPuddles:{phase:`mount`},initialGroundMarks:{phase:`mount`},initialArrivalPending:{phase:`mount`,default:!1},mode:{phase:`live`},onLightingChange:{phase:`live`},preset:{phase:`live`,default:e.porsche911997},showVehicle:{phase:`live`,default:!0},paused:{phase:`live`,default:!1},audioEnabled:{phase:`live`,default:!0},screenShakeProfiles:{phase:`live`},automatedInput:{phase:`live`,default:null},bindings:{phase:`live`},onReady:{phase:`live`},foregroundSelector:{phase:`live`},destructibleBurnSeconds:{phase:`live`},canPlaceManually:{phase:`live`,default:!0},onStateChange:{phase:`live`},onExit:{phase:`live`},onToggleMute:{phase:`live`},onAudioInteraction:{phase:`live`},onDriveInput:{phase:`live`},onStartRequest:{phase:`live`},onCarClick:{phase:`live`}},r=Object.freeze(Object.fromEntries(Object.entries(n).filter(([,e])=>`default`in e).map(([e,t])=>[e,`default`in t?t.default:void 0]))),i=Object.freeze(Object.entries(n).filter(([,e])=>e.phase===`mount`).map(([e])=>e));export{r as n,n as r,i as t};
|