@epic-web/workshop-app 4.10.1 → 4.12.0
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/build/client/assets/{_-Bd2gNcck.js → _-DYArYM0Z.js} +2 -2
- package/build/client/assets/{_-Bd2gNcck.js.map → _-DYArYM0Z.js.map} +1 -1
- package/build/client/assets/_exerciseNumber-DN5AsSNn.js +2 -0
- package/build/client/assets/{_exerciseNumber-CfF6tJcN.js.map → _exerciseNumber-DN5AsSNn.js.map} +1 -1
- package/build/client/assets/{_exerciseNumber_._stepNumber-DCbWNWpZ.js → _exerciseNumber_._stepNumber-Ct5BCuA1.js} +2 -2
- package/build/client/assets/{_exerciseNumber_._stepNumber-DCbWNWpZ.js.map → _exerciseNumber_._stepNumber-Ct5BCuA1.js.map} +1 -1
- package/build/client/assets/_exerciseNumber_.finished-W3hcmvgu.js +2 -0
- package/build/client/assets/{_exerciseNumber_.finished-CykPBfYE.js.map → _exerciseNumber_.finished-W3hcmvgu.js.map} +1 -1
- package/build/client/assets/{_layout-rEQoj43V.js → _layout-B9Y-8OU6.js} +2 -2
- package/build/client/assets/{_layout-rEQoj43V.js.map → _layout-B9Y-8OU6.js.map} +1 -1
- package/build/client/assets/{_layout-DHBLG7Ti.js → _layout-CLLcE4oc.js} +2 -2
- package/build/client/assets/{_layout-DHBLG7Ti.js.map → _layout-CLLcE4oc.js.map} +1 -1
- package/build/client/assets/_layout-qyqfsEt3.js +2 -0
- package/build/client/assets/_layout-qyqfsEt3.js.map +1 -0
- package/build/client/assets/{account-CnLkZd_O.js → account-DHsaqKNy.js} +2 -2
- package/build/client/assets/{account-CnLkZd_O.js.map → account-DHsaqKNy.js.map} +1 -1
- package/build/client/assets/{button-CyZl24U2.js → button-BA3iiLRs.js} +2 -2
- package/build/client/assets/{button-CyZl24U2.js.map → button-BA3iiLRs.js.map} +1 -1
- package/build/client/assets/cache-l0sNRNKZ.js +2 -0
- package/build/client/assets/cache-l0sNRNKZ.js.map +1 -0
- package/build/client/assets/{client-hints-BE5mB4r0.js → client-hints-DLYDs4RF.js} +2 -2
- package/build/client/assets/{client-hints-BE5mB4r0.js.map → client-hints-DLYDs4RF.js.map} +1 -1
- package/build/client/assets/{components-BMzmvxYw.js → components-wgHiPsTg.js} +2 -2
- package/build/client/assets/{components-BMzmvxYw.js.map → components-wgHiPsTg.js.map} +1 -1
- package/build/client/assets/diff-DczVYWk4.js +2 -0
- package/build/client/assets/{diff-PfwTHr6-.js.map → diff-DczVYWk4.js.map} +1 -1
- package/build/client/assets/{diff-P5f7-8E4.js → diff-hpVBklM0.js} +2 -2
- package/build/client/assets/{diff-P5f7-8E4.js.map → diff-hpVBklM0.js.map} +1 -1
- package/build/client/assets/discord-CgwNGD2p.js +2 -0
- package/build/client/assets/discord-CgwNGD2p.js.map +1 -0
- package/build/client/assets/{discord-COPE8EOZ.js → discord-yZor-3t1.js} +2 -2
- package/build/client/assets/{discord-COPE8EOZ.js.map → discord-yZor-3t1.js.map} +1 -1
- package/build/client/assets/{entry.client-B0vV2fsa.js → entry.client-Cs8lBz8l.js} +2 -2
- package/build/client/assets/{entry.client-B0vV2fsa.js.map → entry.client-Cs8lBz8l.js.map} +1 -1
- package/build/client/assets/{epic-video-CYnG2ziQ.js → epic-video--ydmGfR4.js} +96 -96
- package/build/client/assets/{epic-video-CYnG2ziQ.js.map → epic-video--ydmGfR4.js.map} +1 -1
- package/build/client/assets/{error-boundary-DxfVshQ5.js → error-boundary-BVTbN8PZ.js} +2 -2
- package/build/client/assets/{error-boundary-DxfVshQ5.js.map → error-boundary-BVTbN8PZ.js.map} +1 -1
- package/build/client/assets/finished-3FuL-PiH.js +2 -0
- package/build/client/assets/{finished-zLjWvstg.js.map → finished-3FuL-PiH.js.map} +1 -1
- package/build/client/assets/{index-4E9_Sx3m.js → index-C6ToujzV.js} +2 -2
- package/build/client/assets/{index-4E9_Sx3m.js.map → index-C6ToujzV.js.map} +1 -1
- package/build/client/assets/index-DCO6tIXL.js +2 -0
- package/build/client/assets/{index-BXefr1BB.js.map → index-DCO6tIXL.js.map} +1 -1
- package/build/client/assets/{index-90bzTYUX.js → index-DMhFsRrG.js} +2 -2
- package/build/client/assets/{index-90bzTYUX.js.map → index-DMhFsRrG.js.map} +1 -1
- package/build/client/assets/{index-Doi37489.js → index-DjzedX4O.js} +2 -2
- package/build/client/assets/{index-Doi37489.js.map → index-DjzedX4O.js.map} +1 -1
- package/build/client/assets/{loading-CNWJVymJ.js → loading-B0uKxERz.js} +2 -2
- package/build/client/assets/{loading-CNWJVymJ.js.map → loading-B0uKxERz.js.map} +1 -1
- package/build/client/assets/{login-DxG854vQ.js → login-CHE9W6po.js} +2 -2
- package/build/client/assets/{login-DxG854vQ.js.map → login-CHE9W6po.js.map} +1 -1
- package/build/client/assets/manifest-b955f6ee.js +1 -0
- package/build/client/assets/{mdx-CR7Me1v_.js → mdx-DF11h1m-.js} +2 -2
- package/build/client/assets/{mdx-CR7Me1v_.js.map → mdx-DF11h1m-.js.map} +1 -1
- package/build/client/assets/{misc-CypjEQkt.js → misc-S5ZD98sI.js} +2 -2
- package/build/client/assets/{misc-CypjEQkt.js.map → misc-S5ZD98sI.js.map} +1 -1
- package/build/client/assets/{nav-chevrons-BYKwyIgG.js → nav-chevrons-DaXg0NPS.js} +2 -2
- package/build/client/assets/{nav-chevrons-BYKwyIgG.js.map → nav-chevrons-DaXg0NPS.js.map} +1 -1
- package/build/client/assets/onboarding-CBm-xBhv.js +2 -0
- package/build/client/assets/{onboarding-b9lcdh4n.js.map → onboarding-CBm-xBhv.js.map} +1 -1
- package/build/client/assets/{presence-DXXVJbaH.js → presence-CW1_eiIo.js} +2 -2
- package/build/client/assets/{presence-DXXVJbaH.js.map → presence-CW1_eiIo.js.map} +1 -1
- package/build/client/assets/{progress-B_mReZVE.js → progress-BwanvUpB.js} +2 -2
- package/build/client/assets/{progress-B_mReZVE.js.map → progress-BwanvUpB.js.map} +1 -1
- package/build/client/assets/{progress-bar-DCrt7X4t.js → progress-bar-wMXWRGq0.js} +2 -2
- package/build/client/assets/{progress-bar-DCrt7X4t.js.map → progress-bar-wMXWRGq0.js.map} +1 -1
- package/build/client/assets/{request-info-CUT0ULYN.js → request-info-DHtGM4FI.js} +2 -2
- package/build/client/assets/{request-info-CUT0ULYN.js.map → request-info-DHtGM4FI.js.map} +1 -1
- package/build/client/assets/{root-DWqeqKvM.js → root-CW5sLiRQ.js} +2 -2
- package/build/client/assets/{root-DWqeqKvM.js.map → root-CW5sLiRQ.js.map} +1 -1
- package/build/client/assets/{support-DrY-qRGh.js → support-D1ydJNdm.js} +2 -2
- package/build/client/assets/{support-DrY-qRGh.js.map → support-D1ydJNdm.js.map} +1 -1
- package/build/client/assets/{tooltip-CfmIzAYi.js → tooltip-BtzSIxlB.js} +2 -2
- package/build/client/assets/{tooltip-CfmIzAYi.js.map → tooltip-BtzSIxlB.js.map} +1 -1
- package/build/client/assets/{user-C4QTtQw5.js → user-CdUDQ7a8.js} +2 -2
- package/build/client/assets/{user-C4QTtQw5.js.map → user-CdUDQ7a8.js.map} +1 -1
- package/build/server/index.js +150 -84
- package/build/server/index.js.map +1 -1
- package/package.json +3 -3
- package/build/client/assets/_exerciseNumber-CfF6tJcN.js +0 -2
- package/build/client/assets/_exerciseNumber_.finished-CykPBfYE.js +0 -2
- package/build/client/assets/_layout-CKMWSKRh.js +0 -2
- package/build/client/assets/_layout-CKMWSKRh.js.map +0 -1
- package/build/client/assets/diff-PfwTHr6-.js +0 -2
- package/build/client/assets/discord-DIog7bBO.js +0 -2
- package/build/client/assets/discord-DIog7bBO.js.map +0 -1
- package/build/client/assets/finished-zLjWvstg.js +0 -2
- package/build/client/assets/index-BXefr1BB.js +0 -2
- package/build/client/assets/manifest-60765f76.js +0 -1
- package/build/client/assets/onboarding-b9lcdh4n.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as e}from"./index-Czg1ruVn.js";import{B as i}from"./button-
|
|
2
|
-
//# sourceMappingURL=account-
|
|
1
|
+
import{j as e}from"./index-Czg1ruVn.js";import{B as i}from"./button-BA3iiLRs.js";import{I as c}from"./misc-S5ZD98sI.js";import{u as d,a as m}from"./user-CdUDQ7a8.js";import{u}from"./presence-CW1_eiIo.js";import{u as x,a as h,L as o,F as a}from"./components-wgHiPsTg.js";import"./clsx-B-dksMZM.js";import"./request-info-DHtGM4FI.js";function O(){const r=x(),l=h(),s=d(),t=m(),n=u();return e.jsxs("main",{className:"container flex h-full w-full max-w-3xl flex-grow flex-col items-center justify-center gap-4",children:[e.jsx("img",{className:"h-36 w-36 rounded-full",alt:(t==null?void 0:t.displayName)??s.name??s.email,src:s.avatarUrl}),e.jsx("h1",{className:"mb-1 text-2xl",children:"Your Account"}),e.jsx("p",{className:"text-center text-gray-700 dark:text-gray-300",children:s.name?`Hi ${(t==null?void 0:t.displayName)??s.name}, your device is logged in with ${s.email}.`:`Your device is logged in with ${s.email}.`}),t?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-center text-gray-700 dark:text-gray-300",children:["And you are connected to discord as ",t.displayName," (",t.id,")."]}),e.jsx(l.Form,{method:"post",className:"mt-2",children:e.jsx(i,{varient:"mono",name:"intent",value:"disconnect-discord",children:"Disconnect Discord"})})]}):e.jsxs(o,{to:r.discordAuthUrl,className:"inline-flex items-center gap-2 underline",children:[e.jsx(c,{name:"Discord",size:"lg"}),"Connect Discord"]}),e.jsxs(a,{method:"POST",children:[e.jsx("input",{name:"optOut",type:"hidden",value:n!=null&&n.optOut?"false":"true"}),e.jsxs(i,{varient:"mono",name:"intent",value:"presence-opt-out",children:[n!=null&&n.optOut?"Opt in to":"Opt out of"," presence"]})]}),e.jsx("p",{children:e.jsxs("small",{children:["Note: it is your ",e.jsx("i",{className:"italic",children:"device"})," that's logged in, not your browser. So all browsers on this device will be logged in with the same account on this device."]})}),e.jsx(a,{method:"post",className:"mt-2",children:e.jsx(i,{varient:"primary",name:"intent",value:"logout",children:"Log out"})}),e.jsxs("p",{children:["Check"," ",e.jsx(o,{to:"/onboarding",className:"underline",children:"/onboarding"})," ","if you'd like to review onboarding again."]}),e.jsxs("p",{children:["Check"," ",e.jsx(o,{to:"/support",className:"underline",children:"/support"})," ","if you need support."]})]})}export{O as default};
|
|
2
|
+
//# sourceMappingURL=account-DHsaqKNy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-
|
|
1
|
+
{"version":3,"file":"account-DHsaqKNy.js","sources":["../../../app/routes/_app+/account.tsx"],"sourcesContent":["import { deleteCache } from '@epic-web/workshop-utils/cache.server'\nimport {\n\tdeleteDb,\n\tdeleteDiscordInfo,\n\trequireAuthInfo,\n\tsetPresencePreferences,\n} from '@epic-web/workshop-utils/db.server'\nimport { json, redirect, type LoaderFunctionArgs } from '@remix-run/node'\nimport { Form, Link, useFetcher, useLoaderData } from '@remix-run/react'\nimport { Button } from '#app/components/button.tsx'\nimport { Icon } from '#app/components/icons.tsx'\nimport { useOptionalDiscordMember, useUser } from '#app/components/user.tsx'\nimport { ensureUndeployed } from '#app/utils/misc.tsx'\nimport { usePresencePreferences } from '#app/utils/presence.tsx'\nimport { redirectWithToast } from '#app/utils/toast.server.ts'\nimport { getDiscordAuthURL } from '../discord.callback.ts'\n\nexport async function loader({ request }: LoaderFunctionArgs) {\n\tensureUndeployed()\n\tawait requireAuthInfo({ request })\n\treturn json({ discordAuthUrl: getDiscordAuthURL() })\n}\n\nexport async function action({ request }: { request: Request }) {\n\tensureUndeployed()\n\tconst formData = await request.formData()\n\tconst intent = formData.get('intent')\n\tif (intent === 'disconnect-discord') {\n\t\tawait deleteDiscordInfo()\n\t\treturn redirectWithToast('/account', {\n\t\t\ttype: 'success',\n\t\t\ttitle: 'Disconnected',\n\t\t\tdescription: 'Local discord data has been deleted.',\n\t\t})\n\t} else if (intent === 'logout') {\n\t\tawait deleteDb()\n\t\tawait deleteCache()\n\t\treturn redirectWithToast('/login', {\n\t\t\ttype: 'success',\n\t\t\ttitle: 'Logged out',\n\t\t\tdescription: 'Goodbye! Come back soon!',\n\t\t})\n\t} else if (intent === 'presence-opt-out') {\n\t\tconst optOut = formData.get('optOut') === 'true'\n\t\tawait setPresencePreferences({ optOut })\n\t\treturn redirectWithToast('/account', {\n\t\t\ttitle: optOut ? 'Opted out' : 'Opted in',\n\t\t\tdescription: `You are now ${optOut ? 'invisible' : 'visible'}.`,\n\t\t\ttype: 'success',\n\t\t})\n\t}\n\n\treturn redirect('/account')\n}\n\nexport default function Account() {\n\tconst data = useLoaderData<typeof loader>()\n\tconst disconnectFetcher = useFetcher()\n\tconst user = useUser()\n\tconst discordMember = useOptionalDiscordMember()\n\tconst presencePreferences = usePresencePreferences()\n\treturn (\n\t\t<main className=\"container flex h-full w-full max-w-3xl flex-grow flex-col items-center justify-center gap-4\">\n\t\t\t<img\n\t\t\t\tclassName=\"h-36 w-36 rounded-full\"\n\t\t\t\talt={discordMember?.displayName ?? user.name ?? user.email}\n\t\t\t\tsrc={user.avatarUrl}\n\t\t\t/>\n\t\t\t<h1 className=\"mb-1 text-2xl\">Your Account</h1>\n\t\t\t<p className=\"text-center text-gray-700 dark:text-gray-300\">\n\t\t\t\t{user.name\n\t\t\t\t\t? `Hi ${\n\t\t\t\t\t\t\tdiscordMember?.displayName ?? user.name\n\t\t\t\t\t\t}, your device is logged in with ${user.email}.`\n\t\t\t\t\t: `Your device is logged in with ${user.email}.`}\n\t\t\t</p>\n\t\t\t{discordMember ? (\n\t\t\t\t<>\n\t\t\t\t\t<p className=\"text-center text-gray-700 dark:text-gray-300\">\n\t\t\t\t\t\tAnd you are connected to discord as {discordMember.displayName} (\n\t\t\t\t\t\t{discordMember.id}).\n\t\t\t\t\t</p>\n\t\t\t\t\t<disconnectFetcher.Form method=\"post\" className=\"mt-2\">\n\t\t\t\t\t\t<Button varient=\"mono\" name=\"intent\" value=\"disconnect-discord\">\n\t\t\t\t\t\t\tDisconnect Discord\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</disconnectFetcher.Form>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<Link\n\t\t\t\t\tto={data.discordAuthUrl}\n\t\t\t\t\tclassName=\"inline-flex items-center gap-2 underline\"\n\t\t\t\t>\n\t\t\t\t\t<Icon name=\"Discord\" size=\"lg\" />\n\t\t\t\t\tConnect Discord\n\t\t\t\t</Link>\n\t\t\t)}\n\t\t\t<Form method=\"POST\">\n\t\t\t\t<input\n\t\t\t\t\tname=\"optOut\"\n\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\tvalue={presencePreferences?.optOut ? 'false' : 'true'}\n\t\t\t\t/>\n\t\t\t\t<Button varient=\"mono\" name=\"intent\" value=\"presence-opt-out\">\n\t\t\t\t\t{presencePreferences?.optOut ? 'Opt in to' : 'Opt out of'} presence\n\t\t\t\t</Button>\n\t\t\t</Form>\n\t\t\t<p>\n\t\t\t\t<small>\n\t\t\t\t\tNote: it is your <i className=\"italic\">device</i> that's logged in,\n\t\t\t\t\tnot your browser. So all browsers on this device will be logged in\n\t\t\t\t\twith the same account on this device.\n\t\t\t\t</small>\n\t\t\t</p>\n\t\t\t<Form method=\"post\" className=\"mt-2\">\n\t\t\t\t<Button varient=\"primary\" name=\"intent\" value=\"logout\">\n\t\t\t\t\tLog out\n\t\t\t\t</Button>\n\t\t\t</Form>\n\t\t\t<p>\n\t\t\t\tCheck{' '}\n\t\t\t\t<Link to=\"/onboarding\" className=\"underline\">\n\t\t\t\t\t/onboarding\n\t\t\t\t</Link>{' '}\n\t\t\t\tif you'd like to review onboarding again.\n\t\t\t</p>\n\t\t\t<p>\n\t\t\t\tCheck{' '}\n\t\t\t\t<Link to=\"/support\" className=\"underline\">\n\t\t\t\t\t/support\n\t\t\t\t</Link>{' '}\n\t\t\t\tif you need support.\n\t\t\t</p>\n\t\t</main>\n\t)\n}\n"],"names":["Account","data","useLoaderData","disconnectFetcher","useFetcher","user","useUser","discordMember","useOptionalDiscordMember","presencePreferences","usePresencePreferences","jsxs","className","children","jsx","alt","displayName","name","email","src","avatarUrl","Fragment","id","Form","method","Button","varient","value","Link","to","discordAuthUrl","Icon","size","type","optOut"],"mappings":"4UAuDA,SAAwBA,GAAU,CACjC,MAAMC,EAAOC,IACPC,EAAoBC,IACpBC,EAAOC,IACPC,EAAgBC,IAChBC,EAAsBC,IAE3B,OAAAC,EAAAA,KAAC,OAAK,CAAAC,UAAU,8FACfC,SAAA,CAAAC,EAAA,IAAC,MAAA,CACAF,UAAU,yBACVG,KAAKR,GAAAA,YAAAA,EAAeS,cAAeX,EAAKY,MAAQZ,EAAKa,MACrDC,IAAKd,EAAKe,SAAA,CACX,EACCN,EAAA,IAAA,KAAA,CAAGF,UAAU,gBAAgBC,SAAY,cAAA,CAAA,QACzC,IAAE,CAAAD,UAAU,+CACXC,SAAKR,EAAAY,KACH,OACAV,GAAAA,YAAAA,EAAeS,cAAeX,EAAKY,IACpC,mCAAmCZ,EAAKa,KAAK,IAC5C,iCAAiCb,EAAKa,KAAK,IAC/C,EACCX,EAECI,EAAA,KAAAU,WAAA,CAAAR,SAAA,CAACF,EAAA,KAAA,IAAA,CAAEC,UAAU,+CAA+CC,SAAA,CAAA,uCACtBN,EAAcS,YAAY,KAC9DT,EAAce,GAAG,IAAA,EACnB,QACCnB,EAAkBoB,KAAlB,CAAuBC,OAAO,OAAOZ,UAAU,OAC/CC,SAACC,EAAA,IAAAW,EAAA,CAAOC,QAAQ,OAAOT,KAAK,SAASU,MAAM,qBAAqBd,8BAEhE,CACD,CAAA,CAAA,CAAA,CACD,EAEAF,EAAA,KAACiB,EAAA,CACAC,GAAI5B,EAAK6B,eACTlB,UAAU,2CAEVC,SAAA,CAAAC,EAAA,IAACiB,EAAK,CAAAd,KAAK,UAAUe,KAAK,IAAK,CAAA,EAAE,iBAAA,CAAA,CAElC,EAEDrB,EAAA,KAACY,EAAK,CAAAC,OAAO,OACZX,SAAA,CAAAC,EAAA,IAAC,QAAA,CACAG,KAAK,SACLgB,KAAK,SACLN,MAAOlB,GAAAA,MAAAA,EAAqByB,OAAS,QAAU,MAAA,CAChD,SACCT,EAAO,CAAAC,QAAQ,OAAOT,KAAK,SAASU,MAAM,mBACzCd,SAAA,CAAAJ,GAAAA,MAAAA,EAAqByB,OAAS,YAAc,aAAa,WAAA,CAC3D,CAAA,CAAA,CACD,CAAA,EACApB,EAAA,IAAC,IACA,CAAAD,SAAAF,EAAA,KAAC,QAAM,CAAAE,SAAA,CAAA,oBACYC,EAAA,IAAA,IAAA,CAAEF,UAAU,SAASC,SAAM,QAAA,CAAA,EAAI,6HAAA,EAGlD,CACD,CAAA,EACCC,EAAA,IAAAS,EAAA,CAAKC,OAAO,OAAOZ,UAAU,OAC7BC,SAAAC,EAAA,IAACW,EAAO,CAAAC,QAAQ,UAAUT,KAAK,SAASU,MAAM,SAASd,mBAEvD,CACD,CAAA,SACC,IAAE,CAAAA,SAAA,CAAA,QACI,UACLe,EAAK,CAAAC,GAAG,cAAcjB,UAAU,YAAYC,SAE7C,aAAA,CAAA,EAAQ,IAAI,2CAAA,CAEb,CAAA,SACC,IAAE,CAAAA,SAAA,CAAA,QACI,UACLe,EAAK,CAAAC,GAAG,WAAWjB,UAAU,YAAYC,SAE1C,UAAA,CAAA,EAAQ,IAAI,sBAAA,CAEb,CAAA,CAAA,CACD,CAAA,CAEF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{j as n}from"./index-Czg1ruVn.js";import{c as r}from"./clsx-B-dksMZM.js";import{L as u}from"./components-
|
|
2
|
-
//# sourceMappingURL=button-
|
|
1
|
+
import{j as n}from"./index-Czg1ruVn.js";import{c as r}from"./clsx-B-dksMZM.js";import{L as u}from"./components-wgHiPsTg.js";function l(){return n.jsx("span",{className:"inline-block animate-spin",children:"🌀"})}function d(){return n.jsx("span",{children:"✅"})}function m(){return n.jsx("span",{children:"❌"})}function a({varient:e,clip:o=!0}){const t="inline-flex bg-foreground text-background outline-none hover:bg-background hover:text-foreground focus:bg-background focus:text-foreground",s="px-8 py-4 font-bold",c="px-8 py-4 text-xl font-bold",i="px-8 py-4 font-mono text-sm uppercase";return r(t,{"clip-path-button":o,[s]:e==="primary",[c]:e==="big",[i]:e==="mono"})}function g({varient:e,status:o="idle",...t}){const s={pending:n.jsx(l,{}),success:n.jsx(d,{}),error:n.jsx(m,{}),idle:null}[o];return n.jsx("div",{className:"clip-path-button-outer w-fit border-2 border-foreground bg-foreground",children:n.jsxs("button",{...t,className:r(t.className,a({varient:e}),"flex justify-center gap-4"),children:[n.jsx("div",{children:t.children}),s]})})}function j({varient:e,...o}){return n.jsx("div",{className:"clip-path-button-outer w-fit border-2 border-foreground bg-foreground",children:n.jsx(u,{...o,className:r(o.className,a({varient:e}))})})}export{g as B,j as a};
|
|
2
|
+
//# sourceMappingURL=button-BA3iiLRs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-
|
|
1
|
+
{"version":3,"file":"button-BA3iiLRs.js","sources":["../../../app/components/button.tsx"],"sourcesContent":["import { Link } from '@remix-run/react'\nimport { clsx } from 'clsx'\n\nfunction PendingState() {\n\treturn <span className=\"inline-block animate-spin\">🌀</span>\n}\n\nfunction SuccessState() {\n\treturn <span>✅</span>\n}\n\nfunction ErrorState() {\n\treturn <span>❌</span>\n}\n\nexport function getButtonClassName({\n\tvarient,\n\tclip = true,\n}: {\n\tvarient: 'primary' | 'big' | 'mono'\n\tclip?: boolean\n}) {\n\tconst baseClassName =\n\t\t'inline-flex bg-foreground text-background outline-none hover:bg-background hover:text-foreground focus:bg-background focus:text-foreground'\n\tconst primaryClassName = 'px-8 py-4 font-bold'\n\tconst bigClassName = 'px-8 py-4 text-xl font-bold'\n\tconst monoClassName = 'px-8 py-4 font-mono text-sm uppercase'\n\tconst className = clsx(baseClassName, {\n\t\t'clip-path-button': clip,\n\t\t[primaryClassName]: varient === 'primary',\n\t\t[bigClassName]: varient === 'big',\n\t\t[monoClassName]: varient === 'mono',\n\t})\n\treturn className\n}\n\nexport function Button({\n\tvarient,\n\tstatus = 'idle',\n\t...props\n}: React.ComponentPropsWithoutRef<'button'> &\n\tParameters<typeof getButtonClassName>[0] & {\n\t\tstatus?: 'pending' | 'success' | 'error' | 'idle'\n\t}) {\n\tconst companion = {\n\t\tpending: <PendingState />,\n\t\tsuccess: <SuccessState />,\n\t\terror: <ErrorState />,\n\t\tidle: null,\n\t}[status]\n\treturn (\n\t\t<div className=\"clip-path-button-outer w-fit border-2 border-foreground bg-foreground\">\n\t\t\t<button\n\t\t\t\t{...props}\n\t\t\t\tclassName={clsx(\n\t\t\t\t\tprops.className,\n\t\t\t\t\tgetButtonClassName({ varient }),\n\t\t\t\t\t'flex justify-center gap-4',\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<div>{props.children}</div>\n\t\t\t\t{companion}\n\t\t\t</button>\n\t\t</div>\n\t)\n}\n\nexport function ButtonLink({\n\tvarient,\n\t...props\n}: React.ComponentPropsWithoutRef<typeof Link> &\n\tParameters<typeof getButtonClassName>[0]) {\n\treturn (\n\t\t<div className=\"clip-path-button-outer w-fit border-2 border-foreground bg-foreground\">\n\t\t\t<Link\n\t\t\t\t{...props}\n\t\t\t\tclassName={clsx(props.className, getButtonClassName({ varient }))}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n"],"names":["PendingState","jsx","SuccessState","ErrorState","getButtonClassName","varient","clip","baseClassName","primaryClassName","bigClassName","monoClassName","clsx","Button","status","props","companion","jsxs","ButtonLink","Link"],"mappings":"4HAGA,SAASA,GAAe,CACvB,OAAQC,EAAAA,IAAA,OAAA,CAAK,UAAU,4BAA4B,SAAE,IAAA,CAAA,CACtD,CAEA,SAASC,GAAe,CAChB,OAAAD,EAAA,IAAC,QAAK,SAAC,GAAA,CAAA,CACf,CAEA,SAASE,GAAa,CACd,OAAAF,EAAA,IAAC,QAAK,SAAC,GAAA,CAAA,CACf,CAEO,SAASG,EAAmB,CAClC,QAAAC,EACA,KAAAC,EAAO,EACR,EAGG,CACF,MAAMC,EACL,6IACKC,EAAmB,sBACnBC,EAAe,8BACfC,EAAgB,wCAOf,OANWC,EAAKJ,EAAe,CACrC,mBAAoBD,EACpB,CAACE,CAAgB,EAAGH,IAAY,UAChC,CAACI,CAAY,EAAGJ,IAAY,MAC5B,CAACK,CAAa,EAAGL,IAAY,MAAA,CAC7B,CAEF,CAEO,SAASO,EAAO,CACtB,QAAAP,EACA,OAAAQ,EAAS,OACT,GAAGC,CACJ,EAGI,CACH,MAAMC,EAAY,CACjB,cAAUf,EAAa,EAAA,EACvB,cAAUE,EAAa,EAAA,EACvB,YAAQC,EAAW,EAAA,EACnB,KAAM,MACLU,CAAM,EAEP,OAAAZ,EAAAA,IAAC,MAAI,CAAA,UAAU,wEACd,SAAAe,EAAA,KAAC,SAAA,CACC,GAAGF,EACJ,UAAWH,EACVG,EAAM,UACNV,EAAmB,CAAE,QAAAC,EAAS,EAC9B,2BACD,EAEA,SAAA,CAACJ,EAAAA,IAAA,MAAA,CAAK,WAAM,QAAS,CAAA,EACpBc,CAAA,CAAA,CAEH,CAAA,CAAA,CAEF,CAEO,SAASE,EAAW,CAC1B,QAAAZ,EACA,GAAGS,CACJ,EAC2C,CAEzC,OAAAb,EAAAA,IAAC,MAAI,CAAA,UAAU,wEACd,SAAAA,EAAA,IAACiB,EAAA,CACC,GAAGJ,EACJ,UAAWH,EAAKG,EAAM,UAAWV,EAAmB,CAAE,QAAAC,CAAA,CAAS,CAAC,CAAA,CAElE,CAAA,CAAA,CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-l0sNRNKZ.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as k,r as d,j as p}from"./index-Czg1ruVn.js";import{u as C}from"./request-info-
|
|
1
|
+
import{e as k,r as d,j as p}from"./index-Czg1ruVn.js";import{u as C}from"./request-info-DHtGM4FI.js";function g(e){function r(o,t){var a;const s=e[t];if(!s)throw new Error(`Unknown client hint: ${typeof t=="string"?t:"Unknown"}`);const u=(a=o.split(";").map(c=>c.trim()).find(c=>c.startsWith(s.cookieName+"=")))==null?void 0:a.split("=")[1];return u?decodeURIComponent(u):null}function n(o){const t=typeof document<"u"?document.cookie:typeof o<"u"?o.headers.get("Cookie")??"":"";return Object.entries(e).reduce((s,[u,a])=>{const c=u;return"transform"in a?s[c]=a.transform(r(t,c)??a.fallback):s[c]=r(t,c)??a.fallback,s},{})}function i(){return`
|
|
2
2
|
// This block of code allows us to check if the client hints have changed and
|
|
3
3
|
// force a reload of the page with updated hints if they have so you don't get
|
|
4
4
|
// a flash of incorrect content.
|
|
@@ -33,4 +33,4 @@ function checkClientHints() {
|
|
|
33
33
|
|
|
34
34
|
checkClientHints();
|
|
35
35
|
`}return{getHints:n,getClientHintCheckScript:i}}const l={cookieName:"CH-prefers-color-scheme",getValueCode:"window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'",fallback:"light",transform(e){return e==="dark"?"dark":"light"}};function v(e,r=l.cookieName){const n=window.matchMedia("(prefers-color-scheme: dark)");function i(){const o=n.matches?"dark":"light";document.cookie=`${r}=${o}; Max-Age=31536000; Path=/`,e(o)}return n.addEventListener("change",i),function(){n.removeEventListener("change",i)}}const m={cookieName:"CH-reduced-motion",getValueCode:"window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'reduce' : 'no-preference'",fallback:"no-preference",transform(e){return e==="reduce"?"reduce":"no-preference"}};function H(e,r=m.cookieName){const n=window.matchMedia("(prefers-reduced-motion: reduce)");function i(){const o=n.matches?"reduce":"no-preference";document.cookie=`${r}=${o}; Max-Age=31536000; Path=/`,e(o)}return n.addEventListener("change",i),function(){n.removeEventListener("change",i)}}const S={cookieName:"CH-time-zone",getValueCode:"Intl.DateTimeFormat().resolvedOptions().timeZone",fallback:"UTC"},h="EpicShop_CH-prefers-color-scheme",f="EpicShop_CH-reduced-motion",w=g({theme:{...l,cookieName:h},timeZone:{...S,cookieName:"EpicShop_CH-time-zone"},reducedMotion:{...m,cookieName:f}});function b(){return C().hints}function E(){const{revalidate:e}=k();return d.useEffect(()=>v(()=>e(),h),[e]),d.useEffect(()=>H(()=>e(),f),[e]),p.jsx("script",{dangerouslySetInnerHTML:{__html:w.getClientHintCheckScript()}})}export{E as C,b as u};
|
|
36
|
-
//# sourceMappingURL=client-hints-
|
|
36
|
+
//# sourceMappingURL=client-hints-DLYDs4RF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-hints-BE5mB4r0.js","sources":["../../../../../node_modules/@epic-web/client-hints/dist/index.js","../../../../../node_modules/@epic-web/client-hints/dist/color-scheme.js","../../../../../node_modules/@epic-web/client-hints/dist/reduced-motion.js","../../../../../node_modules/@epic-web/client-hints/dist/time-zone.js","../../../app/utils/client-hints.tsx"],"sourcesContent":["export function getHintUtils(hints) {\n function getCookieValue(cookieString, name) {\n const hint = hints[name];\n if (!hint) {\n throw new Error(`Unknown client hint: ${typeof name === 'string' ? name : 'Unknown'}`);\n }\n const value = cookieString\n .split(';')\n .map((c) => c.trim())\n .find((c) => c.startsWith(hint.cookieName + '='))\n ?.split('=')[1];\n return value ? decodeURIComponent(value) : null;\n }\n function getHints(request) {\n const cookieString = typeof document !== 'undefined'\n ? document.cookie\n : typeof request !== 'undefined'\n ? request.headers.get('Cookie') ?? ''\n : '';\n return Object.entries(hints).reduce((acc, [name, hint]) => {\n const hintName = name;\n if ('transform' in hint) {\n // @ts-expect-error - this is fine (PRs welcome though)\n acc[hintName] = hint.transform(getCookieValue(cookieString, hintName) ?? hint.fallback);\n }\n else {\n // @ts-expect-error - this is fine (PRs welcome though)\n acc[hintName] = getCookieValue(cookieString, hintName) ?? hint.fallback;\n }\n return acc;\n }, {});\n }\n /**\n * This returns a string of JavaScript that can be used to check if the client\n * hints have changed and will reload the page if they have.\n */\n function getClientHintCheckScript() {\n return `\n// This block of code allows us to check if the client hints have changed and\n// force a reload of the page with updated hints if they have so you don't get\n// a flash of incorrect content.\nfunction checkClientHints() {\n\tif (!navigator.cookieEnabled) return;\n\n\t// set a short-lived cookie to make sure we can set cookies\n\tdocument.cookie = \"canSetCookies=1; Max-Age=60; SameSite=Lax\";\n\tconst canSetCookies = document.cookie.includes(\"canSetCookies=1\");\n\tdocument.cookie = \"canSetCookies=; Max-Age=-1; path=/\";\n\tif (!canSetCookies) return;\n\n\tconst cookies = document.cookie.split(';').map(c => c.trim()).reduce((acc, cur) => {\n\t\tconst [key, value] = cur.split('=');\n\t\tacc[key] = value;\n\t\treturn acc;\n\t}, {});\n\n\tlet cookieChanged = false;\n\tconst hints = [\n\t${Object.values(hints)\n .map((hint) => {\n const cookieName = JSON.stringify(hint.cookieName);\n return `{ name: ${cookieName}, actual: String(${hint.getValueCode}), value: cookies[${cookieName}] != null ? cookies[${cookieName}] : encodeURIComponent(\"${hint.fallback}\") }`;\n })\n .join(',\\n')}\n\t];\n\tfor (const hint of hints) {\n\t\tdocument.cookie = encodeURIComponent(hint.name) + '=' + encodeURIComponent(hint.actual) + '; Max-Age=31536000; path=/';\n\t\tif (decodeURIComponent(hint.value) !== hint.actual) {\n\t\t\tcookieChanged = true;\n\t\t}\n\t}\n\tif (cookieChanged) window.location.reload();\n}\n\ncheckClientHints();\n`;\n }\n return { getHints, getClientHintCheckScript };\n}\n","export const clientHint = {\n cookieName: 'CH-prefers-color-scheme',\n getValueCode: `window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'`,\n fallback: 'light',\n transform(value) {\n return value === 'dark' ? 'dark' : 'light';\n },\n};\n/**\n * Subscribe to changes in the user's color scheme preference. Optionally pass\n * in a cookie name to use for the cookie that will be set if different from the\n * default.\n */\nexport function subscribeToSchemeChange(subscriber, cookieName = clientHint.cookieName) {\n const schemaMatch = window.matchMedia('(prefers-color-scheme: dark)');\n function handleThemeChange() {\n const value = schemaMatch.matches ? 'dark' : 'light';\n document.cookie = `${cookieName}=${value}; Max-Age=31536000; Path=/`;\n subscriber(value);\n }\n schemaMatch.addEventListener('change', handleThemeChange);\n return function cleanupSchemaChange() {\n schemaMatch.removeEventListener('change', handleThemeChange);\n };\n}\n","export const clientHint = {\n cookieName: 'CH-reduced-motion',\n getValueCode: `window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'reduce' : 'no-preference'`,\n fallback: 'no-preference',\n transform(value) {\n return value === 'reduce' ? 'reduce' : 'no-preference';\n },\n};\n/**\n * Subscribe to changes in the user's motion preference. Optionally pass\n * in a cookie name to use for the cookie that will be set if different from the\n * default.\n */\nexport function subscribeToMotionChange(subscriber, cookieName = clientHint.cookieName) {\n const motionMatch = window.matchMedia('(prefers-reduced-motion: reduce)');\n function handleMotionChange() {\n const value = motionMatch.matches ? 'reduce' : 'no-preference';\n document.cookie = `${cookieName}=${value}; Max-Age=31536000; Path=/`;\n subscriber(value);\n }\n motionMatch.addEventListener('change', handleMotionChange);\n return function cleanupMotionChange() {\n motionMatch.removeEventListener('change', handleMotionChange);\n };\n}\n","export const clientHint = {\n cookieName: 'CH-time-zone',\n getValueCode: 'Intl.DateTimeFormat().resolvedOptions().timeZone',\n fallback: 'UTC',\n};\n","/**\n * This file contains utilities for using client hints for user preference which\n * are needed by the server, but are only known by the browser.\n */\nimport { getHintUtils } from '@epic-web/client-hints'\nimport {\n\tclientHint as colorSchemeHint,\n\tsubscribeToSchemeChange,\n} from '@epic-web/client-hints/color-scheme'\nimport {\n\tclientHint as reducedMotionHint,\n\tsubscribeToMotionChange,\n} from '@epic-web/client-hints/reduced-motion'\nimport { clientHint as timeZoneHint } from '@epic-web/client-hints/time-zone'\nimport { useRevalidator } from '@remix-run/react'\nimport * as React from 'react'\nimport { useRequestInfo } from './request-info.ts'\n\nconst themeCookieName = 'EpicShop_CH-prefers-color-scheme'\nconst motionCookieName = 'EpicShop_CH-reduced-motion'\nconst hintsUtils = getHintUtils({\n\ttheme: {\n\t\t...colorSchemeHint,\n\t\tcookieName: themeCookieName,\n\t},\n\ttimeZone: {\n\t\t...timeZoneHint,\n\t\tcookieName: 'EpicShop_CH-time-zone',\n\t},\n\treducedMotion: {\n\t\t...reducedMotionHint,\n\t\tcookieName: motionCookieName,\n\t},\n\t// add other hints here\n})\n\nexport const { getHints } = hintsUtils\n\n/**\n * @returns an object with the client hints and their values\n */\nexport function useHints() {\n\tconst requestInfo = useRequestInfo()\n\treturn requestInfo.hints\n}\n\n/**\n * @returns inline script element that checks for client hints and sets cookies\n * if they are not set then reloads the page if any cookie was set to an\n * inaccurate value.\n */\nexport function ClientHintCheck() {\n\tconst { revalidate } = useRevalidator()\n\tReact.useEffect(\n\t\t() => subscribeToSchemeChange(() => revalidate(), themeCookieName),\n\t\t[revalidate],\n\t)\n\tReact.useEffect(\n\t\t() => subscribeToMotionChange(() => revalidate(), motionCookieName),\n\t\t[revalidate],\n\t)\n\n\treturn (\n\t\t<script\n\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t__html: hintsUtils.getClientHintCheckScript(),\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"names":["getHintUtils","hints","getCookieValue","cookieString","name","hint","value","_a","getHints","request","acc","hintName","getClientHintCheckScript","cookieName","clientHint","subscribeToSchemeChange","subscriber","schemaMatch","handleThemeChange","subscribeToMotionChange","motionMatch","handleMotionChange","themeCookieName","motionCookieName","hintsUtils","colorSchemeHint","timeZoneHint","reducedMotionHint","useHints","useRequestInfo","ClientHintCheck","revalidate","useRevalidator","React.useEffect","jsx"],"mappings":"qGAAO,SAASA,EAAaC,EAAO,CAChC,SAASC,EAAeC,EAAcC,EAAM,OACxC,MAAMC,EAAOJ,EAAMG,CAAI,EACvB,GAAI,CAACC,EACD,MAAM,IAAI,MAAM,wBAAwB,OAAOD,GAAS,SAAWA,EAAO,SAAS,EAAE,EAEzF,MAAME,GAAQC,EAAAJ,EACT,MAAM,GAAG,EACT,IAAK,GAAM,EAAE,KAAI,CAAE,EACnB,KAAM,GAAM,EAAE,WAAWE,EAAK,WAAa,GAAG,CAAC,IAHtC,YAAAE,EAIR,MAAM,KAAK,GACjB,OAAOD,EAAQ,mBAAmBA,CAAK,EAAI,IAC9C,C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
+
{"version":3,"file":"client-hints-DLYDs4RF.js","sources":["../../../../../node_modules/@epic-web/client-hints/dist/index.js","../../../../../node_modules/@epic-web/client-hints/dist/color-scheme.js","../../../../../node_modules/@epic-web/client-hints/dist/reduced-motion.js","../../../../../node_modules/@epic-web/client-hints/dist/time-zone.js","../../../app/utils/client-hints.tsx"],"sourcesContent":["export function getHintUtils(hints) {\n function getCookieValue(cookieString, name) {\n const hint = hints[name];\n if (!hint) {\n throw new Error(`Unknown client hint: ${typeof name === 'string' ? name : 'Unknown'}`);\n }\n const value = cookieString\n .split(';')\n .map((c) => c.trim())\n .find((c) => c.startsWith(hint.cookieName + '='))\n ?.split('=')[1];\n return value ? decodeURIComponent(value) : null;\n }\n function getHints(request) {\n const cookieString = typeof document !== 'undefined'\n ? document.cookie\n : typeof request !== 'undefined'\n ? request.headers.get('Cookie') ?? ''\n : '';\n return Object.entries(hints).reduce((acc, [name, hint]) => {\n const hintName = name;\n if ('transform' in hint) {\n // @ts-expect-error - this is fine (PRs welcome though)\n acc[hintName] = hint.transform(getCookieValue(cookieString, hintName) ?? hint.fallback);\n }\n else {\n // @ts-expect-error - this is fine (PRs welcome though)\n acc[hintName] = getCookieValue(cookieString, hintName) ?? hint.fallback;\n }\n return acc;\n }, {});\n }\n /**\n * This returns a string of JavaScript that can be used to check if the client\n * hints have changed and will reload the page if they have.\n */\n function getClientHintCheckScript() {\n return `\n// This block of code allows us to check if the client hints have changed and\n// force a reload of the page with updated hints if they have so you don't get\n// a flash of incorrect content.\nfunction checkClientHints() {\n\tif (!navigator.cookieEnabled) return;\n\n\t// set a short-lived cookie to make sure we can set cookies\n\tdocument.cookie = \"canSetCookies=1; Max-Age=60; SameSite=Lax\";\n\tconst canSetCookies = document.cookie.includes(\"canSetCookies=1\");\n\tdocument.cookie = \"canSetCookies=; Max-Age=-1; path=/\";\n\tif (!canSetCookies) return;\n\n\tconst cookies = document.cookie.split(';').map(c => c.trim()).reduce((acc, cur) => {\n\t\tconst [key, value] = cur.split('=');\n\t\tacc[key] = value;\n\t\treturn acc;\n\t}, {});\n\n\tlet cookieChanged = false;\n\tconst hints = [\n\t${Object.values(hints)\n .map((hint) => {\n const cookieName = JSON.stringify(hint.cookieName);\n return `{ name: ${cookieName}, actual: String(${hint.getValueCode}), value: cookies[${cookieName}] != null ? cookies[${cookieName}] : encodeURIComponent(\"${hint.fallback}\") }`;\n })\n .join(',\\n')}\n\t];\n\tfor (const hint of hints) {\n\t\tdocument.cookie = encodeURIComponent(hint.name) + '=' + encodeURIComponent(hint.actual) + '; Max-Age=31536000; path=/';\n\t\tif (decodeURIComponent(hint.value) !== hint.actual) {\n\t\t\tcookieChanged = true;\n\t\t}\n\t}\n\tif (cookieChanged) window.location.reload();\n}\n\ncheckClientHints();\n`;\n }\n return { getHints, getClientHintCheckScript };\n}\n","export const clientHint = {\n cookieName: 'CH-prefers-color-scheme',\n getValueCode: `window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'`,\n fallback: 'light',\n transform(value) {\n return value === 'dark' ? 'dark' : 'light';\n },\n};\n/**\n * Subscribe to changes in the user's color scheme preference. Optionally pass\n * in a cookie name to use for the cookie that will be set if different from the\n * default.\n */\nexport function subscribeToSchemeChange(subscriber, cookieName = clientHint.cookieName) {\n const schemaMatch = window.matchMedia('(prefers-color-scheme: dark)');\n function handleThemeChange() {\n const value = schemaMatch.matches ? 'dark' : 'light';\n document.cookie = `${cookieName}=${value}; Max-Age=31536000; Path=/`;\n subscriber(value);\n }\n schemaMatch.addEventListener('change', handleThemeChange);\n return function cleanupSchemaChange() {\n schemaMatch.removeEventListener('change', handleThemeChange);\n };\n}\n","export const clientHint = {\n cookieName: 'CH-reduced-motion',\n getValueCode: `window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'reduce' : 'no-preference'`,\n fallback: 'no-preference',\n transform(value) {\n return value === 'reduce' ? 'reduce' : 'no-preference';\n },\n};\n/**\n * Subscribe to changes in the user's motion preference. Optionally pass\n * in a cookie name to use for the cookie that will be set if different from the\n * default.\n */\nexport function subscribeToMotionChange(subscriber, cookieName = clientHint.cookieName) {\n const motionMatch = window.matchMedia('(prefers-reduced-motion: reduce)');\n function handleMotionChange() {\n const value = motionMatch.matches ? 'reduce' : 'no-preference';\n document.cookie = `${cookieName}=${value}; Max-Age=31536000; Path=/`;\n subscriber(value);\n }\n motionMatch.addEventListener('change', handleMotionChange);\n return function cleanupMotionChange() {\n motionMatch.removeEventListener('change', handleMotionChange);\n };\n}\n","export const clientHint = {\n cookieName: 'CH-time-zone',\n getValueCode: 'Intl.DateTimeFormat().resolvedOptions().timeZone',\n fallback: 'UTC',\n};\n","/**\n * This file contains utilities for using client hints for user preference which\n * are needed by the server, but are only known by the browser.\n */\nimport { getHintUtils } from '@epic-web/client-hints'\nimport {\n\tclientHint as colorSchemeHint,\n\tsubscribeToSchemeChange,\n} from '@epic-web/client-hints/color-scheme'\nimport {\n\tclientHint as reducedMotionHint,\n\tsubscribeToMotionChange,\n} from '@epic-web/client-hints/reduced-motion'\nimport { clientHint as timeZoneHint } from '@epic-web/client-hints/time-zone'\nimport { useRevalidator } from '@remix-run/react'\nimport * as React from 'react'\nimport { useRequestInfo } from './request-info.ts'\n\nconst themeCookieName = 'EpicShop_CH-prefers-color-scheme'\nconst motionCookieName = 'EpicShop_CH-reduced-motion'\nconst hintsUtils = getHintUtils({\n\ttheme: {\n\t\t...colorSchemeHint,\n\t\tcookieName: themeCookieName,\n\t},\n\ttimeZone: {\n\t\t...timeZoneHint,\n\t\tcookieName: 'EpicShop_CH-time-zone',\n\t},\n\treducedMotion: {\n\t\t...reducedMotionHint,\n\t\tcookieName: motionCookieName,\n\t},\n\t// add other hints here\n})\n\nexport const { getHints } = hintsUtils\n\n/**\n * @returns an object with the client hints and their values\n */\nexport function useHints() {\n\tconst requestInfo = useRequestInfo()\n\treturn requestInfo.hints\n}\n\n/**\n * @returns inline script element that checks for client hints and sets cookies\n * if they are not set then reloads the page if any cookie was set to an\n * inaccurate value.\n */\nexport function ClientHintCheck() {\n\tconst { revalidate } = useRevalidator()\n\tReact.useEffect(\n\t\t() => subscribeToSchemeChange(() => revalidate(), themeCookieName),\n\t\t[revalidate],\n\t)\n\tReact.useEffect(\n\t\t() => subscribeToMotionChange(() => revalidate(), motionCookieName),\n\t\t[revalidate],\n\t)\n\n\treturn (\n\t\t<script\n\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t__html: hintsUtils.getClientHintCheckScript(),\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"names":["getHintUtils","hints","getCookieValue","cookieString","name","hint","value","_a","getHints","request","acc","hintName","getClientHintCheckScript","cookieName","clientHint","subscribeToSchemeChange","subscriber","schemaMatch","handleThemeChange","subscribeToMotionChange","motionMatch","handleMotionChange","themeCookieName","motionCookieName","hintsUtils","colorSchemeHint","timeZoneHint","reducedMotionHint","useHints","useRequestInfo","ClientHintCheck","revalidate","useRevalidator","React.useEffect","jsx"],"mappings":"qGAAO,SAASA,EAAaC,EAAO,CAChC,SAASC,EAAeC,EAAcC,EAAM,OACxC,MAAMC,EAAOJ,EAAMG,CAAI,EACvB,GAAI,CAACC,EACD,MAAM,IAAI,MAAM,wBAAwB,OAAOD,GAAS,SAAWA,EAAO,SAAS,EAAE,EAEzF,MAAME,GAAQC,EAAAJ,EACT,MAAM,GAAG,EACT,IAAK,GAAM,EAAE,KAAI,CAAE,EACnB,KAAM,GAAM,EAAE,WAAWE,EAAK,WAAa,GAAG,CAAC,IAHtC,YAAAE,EAIR,MAAM,KAAK,GACjB,OAAOD,EAAQ,mBAAmBA,CAAK,EAAI,IAC9C,CACD,SAASE,EAASC,EAAS,CACvB,MAAMN,EAAe,OAAO,SAAa,IACnC,SAAS,OACT,OAAOM,EAAY,IACfA,EAAQ,QAAQ,IAAI,QAAQ,GAAK,GACjC,GACV,OAAO,OAAO,QAAQR,CAAK,EAAE,OAAO,CAACS,EAAK,CAACN,EAAMC,CAAI,IAAM,CACvD,MAAMM,EAAWP,EACjB,MAAI,cAAeC,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U,SAAW,SAAW,eAC1C,CACL,EAMO,SAASa,EAAwBH,EAAYH,EAAaC,EAAW,WAAY,CACpF,MAAMM,EAAc,OAAO,WAAW,kCAAkC,EACxE,SAASC,GAAqB,CAC1B,MAAMf,EAAQc,EAAY,QAAU,SAAW,gBAC/C,SAAS,OAAS,GAAGP,CAAU,IAAIP,CAAK,6BACxCU,EAAWV,CAAK,CACnB,CACD,OAAAc,EAAY,iBAAiB,SAAUC,CAAkB,EAClD,UAA+B,CAClCD,EAAY,oBAAoB,SAAUC,CAAkB,CACpE,CACA,CCxBO,MAAMP,EAAa,CACtB,WAAY,eACZ,aAAc,mDACd,SAAU,KACd,ECcMQ,EAAkB,mCAClBC,EAAmB,6BACnBC,EAAaxB,EAAa,CAC/B,MAAO,CACN,GAAGyB,EACH,WAAYH,CACb,EACA,SAAU,CACT,GAAGI,EACH,WAAY,uBACb,EACA,cAAe,CACd,GAAGC,EACH,WAAYJ,CACb,CAED,CAAC,EAOM,SAASK,GAAW,CAE1B,OADoBC,IACD,KACpB,CAOO,SAASC,GAAkB,CAC3B,KAAA,CAAE,WAAAC,GAAeC,IACjBC,OAAAA,EAAA,UACL,IAAMlB,EAAwB,IAAMgB,IAAcT,CAAe,EACjE,CAACS,CAAU,CAAA,EAENE,EAAA,UACL,IAAMd,EAAwB,IAAMY,IAAcR,CAAgB,EAClE,CAACQ,CAAU,CAAA,EAIXG,EAAA,IAAC,SAAA,CACA,wBAAyB,CACxB,OAAQV,EAAW,yBAAyB,CAC7C,CAAA,CAAA,CAGH","x_google_ignoreList":[0,1,2,3]}
|
|
@@ -162,5 +162,5 @@ ${y.map((T,N)=>`import * as route${N} from ${JSON.stringify(t.routes[T.route.id]
|
|
|
162
162
|
${h?`window.__remixManifest = ${JSON.stringify(xn(t,u),null,2)};`:""}
|
|
163
163
|
window.__remixRouteModules = {${y.map((T,N)=>`${JSON.stringify(T.route.id)}:route${N}`).join(",")}};
|
|
164
164
|
|
|
165
|
-
import(${JSON.stringify(t.entry.module)});`:" ";return l.createElement(l.Fragment,null,l.createElement("script",P({},e,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:Me(_),type:void 0})),l.createElement("script",P({},e,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:Me(k),type:"module",async:!0})))},[]);if(!c&&typeof __remixContext=="object"&&__remixContext.a)for(let S=0;S<__remixContext.a;S++)p.push(l.createElement(ze,{key:S,scriptProps:e,serializeData:b,serializeError:R}));let g=y.map(S=>{let E=t.routes[S.route.id];return(E.imports||[]).concat([E.module])}).flat(1),x=ne?[]:t.entry.imports.concat(g);return ne?null:l.createElement(l.Fragment,null,h?null:l.createElement("link",{rel:"modulepreload",href:t.url,crossOrigin:e.crossOrigin}),l.createElement("link",{rel:"modulepreload",href:t.entry.module,crossOrigin:e.crossOrigin}),In(x).map(S=>l.createElement("link",{key:S,rel:"modulepreload",href:S,crossOrigin:e.crossOrigin})),w,p)}function ze({dataKey:e,deferredData:t,routeId:r,scriptProps:n,serializeData:a,serializeError:i}){return typeof document>"u"&&t&&e&&r&&H(t.pendingKeys.includes(e),`Deferred data for route ${r} with key ${e} was not pending but tried to render a script for it.`),l.createElement(l.Suspense,{fallback:typeof document>"u"&&t&&e&&r?null:l.createElement("script",P({},n,{async:!0,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:" "}}))},typeof document>"u"&&t&&e&&r?l.createElement(Dn,{resolve:t.data[e],errorElement:l.createElement(Fn,{dataKey:e,routeId:r,scriptProps:n,serializeError:i}),children:s=>l.createElement("script",P({},n,{async:!0,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:a(r,e,s)}}))}):l.createElement("script",P({},n,{async:!0,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:" "}})))}function Fn({dataKey:e,routeId:t,scriptProps:r,serializeError:n}){let a=Jt();return l.createElement("script",P({},r,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:n(t,e,a)}}))}function In(e){return[...new Set(e)]}function Zn(){return Ht()}function Qn(e){return zt(e)}function qn(e={}){return br(e)}function xt(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}export{Dn as A,vr as F,On as L,Gn as M,Pn as N,Kt as R,Nn as S,P as _,qn as a,
|
|
166
|
-
//# sourceMappingURL=components-
|
|
165
|
+
import(${JSON.stringify(t.entry.module)});`:" ";return l.createElement(l.Fragment,null,l.createElement("script",P({},e,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:Me(_),type:void 0})),l.createElement("script",P({},e,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:Me(k),type:"module",async:!0})))},[]);if(!c&&typeof __remixContext=="object"&&__remixContext.a)for(let S=0;S<__remixContext.a;S++)p.push(l.createElement(ze,{key:S,scriptProps:e,serializeData:b,serializeError:R}));let g=y.map(S=>{let E=t.routes[S.route.id];return(E.imports||[]).concat([E.module])}).flat(1),x=ne?[]:t.entry.imports.concat(g);return ne?null:l.createElement(l.Fragment,null,h?null:l.createElement("link",{rel:"modulepreload",href:t.url,crossOrigin:e.crossOrigin}),l.createElement("link",{rel:"modulepreload",href:t.entry.module,crossOrigin:e.crossOrigin}),In(x).map(S=>l.createElement("link",{key:S,rel:"modulepreload",href:S,crossOrigin:e.crossOrigin})),w,p)}function ze({dataKey:e,deferredData:t,routeId:r,scriptProps:n,serializeData:a,serializeError:i}){return typeof document>"u"&&t&&e&&r&&H(t.pendingKeys.includes(e),`Deferred data for route ${r} with key ${e} was not pending but tried to render a script for it.`),l.createElement(l.Suspense,{fallback:typeof document>"u"&&t&&e&&r?null:l.createElement("script",P({},n,{async:!0,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:" "}}))},typeof document>"u"&&t&&e&&r?l.createElement(Dn,{resolve:t.data[e],errorElement:l.createElement(Fn,{dataKey:e,routeId:r,scriptProps:n,serializeError:i}),children:s=>l.createElement("script",P({},n,{async:!0,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:a(r,e,s)}}))}):l.createElement("script",P({},n,{async:!0,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:" "}})))}function Fn({dataKey:e,routeId:t,scriptProps:r,serializeError:n}){let a=Jt();return l.createElement("script",P({},r,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:n(t,e,a)}}))}function In(e){return[...new Set(e)]}function Zn(){return Ht()}function Qn(e){return zt(e)}function qn(e={}){return br(e)}function xt(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}export{Dn as A,vr as F,On as L,Gn as M,Pn as N,Kt as R,Nn as S,P as _,qn as a,Hn as b,Bn as c,Qn as d,at as e,Wn as f,pn as g,Ce as h,H as i,Vn as j,zn as k,Kn as l,Rt as m,Yn as n,Mn as o,z as p,Jn as q,qe as r,bn as s,Xn as t,Zn as u};
|
|
166
|
+
//# sourceMappingURL=components-wgHiPsTg.js.map
|