@epic-web/workshop-app 4.2.1 → 4.2.3

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.
Files changed (41) hide show
  1. package/build/client/assets/{_exerciseNumber-B_VU-pG1.js → _exerciseNumber-s_qbmGEJ.js} +2 -2
  2. package/build/client/assets/{_exerciseNumber-B_VU-pG1.js.map → _exerciseNumber-s_qbmGEJ.js.map} +1 -1
  3. package/build/client/assets/{_exerciseNumber_.finished-DldgXnJy.js → _exerciseNumber_.finished-DJgT9oaU.js} +2 -2
  4. package/build/client/assets/{_exerciseNumber_.finished-DldgXnJy.js.map → _exerciseNumber_.finished-DJgT9oaU.js.map} +1 -1
  5. package/build/client/assets/{_layout-CGXamJB4.js → _layout-49l6Rvwp.js} +2 -2
  6. package/build/client/assets/_layout-49l6Rvwp.js.map +1 -0
  7. package/build/client/assets/{_layout-CPxDcKGb.js → _layout-D7Qo_r0X.js} +2 -2
  8. package/build/client/assets/{_layout-CPxDcKGb.js.map → _layout-D7Qo_r0X.js.map} +1 -1
  9. package/build/client/assets/client-hints-KnbHFIgn.js +36 -0
  10. package/build/client/assets/client-hints-KnbHFIgn.js.map +1 -0
  11. package/build/client/assets/{diff-Blb5EPiO.js → diff-CLRdJhCn.js} +2 -2
  12. package/build/client/assets/{diff-Blb5EPiO.js.map → diff-CLRdJhCn.js.map} +1 -1
  13. package/build/client/assets/{diff-MSYB00VZ.js → diff-CT3-9rtW.js} +2 -2
  14. package/build/client/assets/{diff-MSYB00VZ.js.map → diff-CT3-9rtW.js.map} +1 -1
  15. package/build/client/assets/{epic-video-BwJwnV_j.js → epic-video-Df7qGSN7.js} +2 -2
  16. package/build/client/assets/{epic-video-BwJwnV_j.js.map → epic-video-Df7qGSN7.js.map} +1 -1
  17. package/build/client/assets/{finished-CGll5TOI.js → finished-Dw3SJA8A.js} +2 -2
  18. package/build/client/assets/{finished-CGll5TOI.js.map → finished-Dw3SJA8A.js.map} +1 -1
  19. package/build/client/assets/{index-zG3_j9lj.js → index-CLnz0tXz.js} +2 -2
  20. package/build/client/assets/{index-zG3_j9lj.js.map → index-CLnz0tXz.js.map} +1 -1
  21. package/build/client/assets/{index-DqBktlAI.js → index-YgRENgjt.js} +2 -2
  22. package/build/client/assets/{index-DqBktlAI.js.map → index-YgRENgjt.js.map} +1 -1
  23. package/build/client/assets/{loading-CaagEELb.js → loading-D-DClzm1.js} +2 -2
  24. package/build/client/assets/{loading-CaagEELb.js.map → loading-D-DClzm1.js.map} +1 -1
  25. package/build/client/assets/{login-2BiFV7_R.js → login-CjvZj820.js} +2 -2
  26. package/build/client/assets/{login-2BiFV7_R.js.map → login-CjvZj820.js.map} +1 -1
  27. package/build/client/assets/{manifest-5e8d103b.js → manifest-50f87ab0.js} +1 -1
  28. package/build/client/assets/{mdx-DdywIxB6.js → mdx-ytg-y2nh.js} +2 -2
  29. package/build/client/assets/{mdx-DdywIxB6.js.map → mdx-ytg-y2nh.js.map} +1 -1
  30. package/build/client/assets/{onboarding-eFvyCmxD.js → onboarding-BxcIdiGj.js} +2 -2
  31. package/build/client/assets/{onboarding-eFvyCmxD.js.map → onboarding-BxcIdiGj.js.map} +1 -1
  32. package/build/client/assets/{root-D_snSGY7.js → root-B02acrJe.js} +2 -2
  33. package/build/client/assets/{root-D_snSGY7.js.map → root-B02acrJe.js.map} +1 -1
  34. package/build/server/index.js +2 -2
  35. package/build/server/index.js.map +1 -1
  36. package/node_modules/@epic-web/client-hints/dist/index.js +32 -20
  37. package/node_modules/@epic-web/client-hints/package.json +1 -1
  38. package/package.json +4 -4
  39. package/build/client/assets/_layout-CGXamJB4.js.map +0 -1
  40. package/build/client/assets/client-hints-BHTHvBjk.js +0 -24
  41. package/build/client/assets/client-hints-BHTHvBjk.js.map +0 -1
@@ -1,24 +0,0 @@
1
- import{e as k,r as d,j as p}from"./index-D1WEsmVZ.js";import{b as g}from"./components-Dj3sm47B.js";function C(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
- const cookies = document.cookie.split(';').map(c => c.trim()).reduce((acc, cur) => {
3
- const [key, value] = cur.split('=');
4
- acc[key] = value;
5
- return acc;
6
- }, {});
7
- let cookieChanged = false;
8
- const hints = [
9
- ${Object.values(e).map(o=>{const t=JSON.stringify(o.cookieName);return`{ name: ${t}, actual: String(${o.getValueCode}), value: cookies[${t}] ?? encodeURIComponent("${o.fallback}") }`}).join(`,
10
- `)}
11
- ];
12
- for (const hint of hints) {
13
- document.cookie = encodeURIComponent(hint.name) + '=' + encodeURIComponent(hint.actual) + '; Max-Age=31536000; path=/';
14
- if (decodeURIComponent(hint.value) !== hint.actual) {
15
- cookieChanged = true;
16
- }
17
- }
18
- // if the cookie changed, reload the page, unless the browser doesn't support
19
- // cookies (in which case we would enter an infinite loop of reloads)
20
- if (cookieChanged && navigator.cookieEnabled) {
21
- window.location.reload();
22
- }
23
- `}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 w(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 H={cookieName:"CH-time-zone",getValueCode:"Intl.DateTimeFormat().resolvedOptions().timeZone",fallback:"UTC"};function b(){return g("root").requestInfo}const h="EpicShop_CH-prefers-color-scheme",f="EpicShop_CH-reduced-motion",N=C({theme:{...l,cookieName:h},timeZone:{...H,cookieName:"EpicShop_CH-time-zone"},reducedMotion:{...m,cookieName:f}});function $(){return b().hints}function I(){const{revalidate:e}=k();return d.useEffect(()=>v(()=>e(),h),[e]),d.useEffect(()=>w(()=>e(),f),[e]),p.jsx("script",{dangerouslySetInnerHTML:{__html:N.getClientHintCheckScript()}})}export{I as C,b as a,$ as u};
24
- //# sourceMappingURL=client-hints-BHTHvBjk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-hints-BHTHvBjk.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/request-info.ts","../../../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 `\nconst cookies = document.cookie.split(';').map(c => c.trim()).reduce((acc, cur) => {\n\tconst [key, value] = cur.split('=');\n\tacc[key] = value;\n\treturn acc;\n}, {});\nlet cookieChanged = false;\nconst hints = [\n${Object.values(hints)\n .map((hint) => {\n const cookieName = JSON.stringify(hint.cookieName);\n return `{ name: ${cookieName}, actual: String(${hint.getValueCode}), value: cookies[${cookieName}] ?? encodeURIComponent(\"${hint.fallback}\") }`;\n })\n .join(',\\n')}\n];\nfor (const hint of hints) {\n\tdocument.cookie = encodeURIComponent(hint.name) + '=' + encodeURIComponent(hint.actual) + '; Max-Age=31536000; path=/';\n\tif (decodeURIComponent(hint.value) !== hint.actual) {\n\t\tcookieChanged = true;\n\t}\n}\n// if the cookie changed, reload the page, unless the browser doesn't support\n// cookies (in which case we would enter an infinite loop of reloads)\nif (cookieChanged && navigator.cookieEnabled) {\n\twindow.location.reload();\n}\n\t\t\t`;\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","import { type SerializeFrom } from '@remix-run/node'\nimport { useRouteLoaderData } from '@remix-run/react'\nimport { type loader as rootLoader } from '#app/root.tsx'\n\n/**\n * @returns the request info from the root loader\n */\nexport function useRequestInfo() {\n\tconst data = useRouteLoaderData('root') as SerializeFrom<typeof rootLoader>\n\treturn data.requestInfo\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","useRequestInfo","useRouteLoaderData","themeCookieName","motionCookieName","hintsUtils","colorSchemeHint","timeZoneHint","reducedMotionHint","useHints","ClientHintCheck","revalidate","useRevalidator","React.useEffect","jsx"],"mappings":"mGAAO,SAASA,EAAaC,EAAO,CAChC,SAASC,EAAeC,EAAcC,EAAM,OACxC,MAAMC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