@pretty-chitty/core 2.3.5 → 2.3.7
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/dist/1ea77c9e193d437b9bfa.woff +0 -0
- package/dist/2282b9ff81c2cd7cf5b4.mp3 +0 -0
- package/dist/22a445dd65cce94defdd.woff2 +0 -0
- package/dist/2b94f846c05846d73536.mp3 +0 -0
- package/dist/32d6296b80e676d66bda.woff +0 -0
- package/dist/36e7e033bfef7b32bf3c.mp3 +0 -0
- package/dist/37f3b2ddcbe588b2aaa5.jpg +0 -0
- package/dist/3f0fb9058a03e14ad2fa.jpg +0 -0
- package/dist/412050b824afb24fef88.mp3 +0 -0
- package/dist/468cf705a21091e5f755.mp3 +0 -0
- package/dist/47a823ae095f5f4cfd82.woff +0 -0
- package/dist/5062c95fb3c68af2ee2e.woff2 +0 -0
- package/dist/5aecd40f51b84ffb6efa.woff2 +0 -0
- package/dist/5d184fc5808150d51726.mp3 +0 -0
- package/dist/60b937eec087d648c831.woff2 +0 -0
- package/dist/63da6d06ce0ff84b8b2c.mp3 +0 -0
- package/dist/63f3d4f28784375801ac.woff +0 -0
- package/dist/669804475e1d5e52a4f5.mp3 +0 -0
- package/dist/6a6d042ba2a9290aba9c.woff2 +0 -0
- package/dist/72e60d1c7f7c603f31d6.woff +0 -0
- package/dist/788c3dfe27f9734edff5.mp3 +0 -0
- package/dist/7e339dfbea59fe54f2e3.png +0 -0
- package/dist/7ecd698217d211cad841.mp3 +0 -0
- package/dist/8c8f3dcefaec6a40d787.mp3 +0 -0
- package/dist/8d29c92c7f9ca79d8a5c.mp3 +0 -0
- package/dist/8ea5f16c95238d2ff902.mp3 +0 -0
- package/dist/97e19a7d82ab67080019.mp3 +0 -0
- package/dist/98373f88bbc3b8237b09.mp3 +0 -0
- package/dist/98c71bee993adc81d5be.mp3 +0 -0
- package/dist/a09db3cc936e581f320a.mp3 +0 -0
- package/dist/a51c64560480e6fdae0d.mp3 +0 -0
- package/dist/ad2392bc6cdf9bb1b5fd.mp3 +0 -0
- package/dist/b3708bfbeff0d340bdef.mp3 +0 -0
- package/dist/b81893c113e684d9eec4.woff +0 -0
- package/dist/bc6bc3d7802469910f83.mp3 +0 -0
- package/dist/bde37bf538e175149c3b.mp3 +0 -0
- package/dist/d6b5a560b17d31cd3c7c.mp3 +0 -0
- package/dist/dd3231a4b15c4f8f2b94.mp3 +0 -0
- package/dist/f63358bf5b9e4f8d7f79.mp3 +0 -0
- package/dist/fc02be176de567378fa4.woff2 +0 -0
- package/dist/fe1535c25dc5d879c085.mp3 +0 -0
- package/dist/index.html +12 -0
- package/dist/main.034dfcc6b83fdd218994.hot-update.js +265 -0
- package/dist/main.034dfcc6b83fdd218994.hot-update.js.map +1 -0
- package/dist/main.034dfcc6b83fdd218994.hot-update.json +1 -0
- package/dist/main.0c0a98b3b3e1e004beb2.hot-update.js +265 -0
- package/dist/main.0c0a98b3b3e1e004beb2.hot-update.js.map +1 -0
- package/dist/main.0c0a98b3b3e1e004beb2.hot-update.json +1 -0
- package/dist/main.13daf8cac0f0a3231f6a.hot-update.js +190 -0
- package/dist/main.13daf8cac0f0a3231f6a.hot-update.js.map +1 -0
- package/dist/main.13daf8cac0f0a3231f6a.hot-update.json +1 -0
- package/dist/main.14e055541f09be93a122.hot-update.js +321 -0
- package/dist/main.14e055541f09be93a122.hot-update.js.map +1 -0
- package/dist/main.14e055541f09be93a122.hot-update.json +1 -0
- package/dist/main.26499c88c63113e7a3f8.hot-update.js +190 -0
- package/dist/main.26499c88c63113e7a3f8.hot-update.js.map +1 -0
- package/dist/main.26499c88c63113e7a3f8.hot-update.json +1 -0
- package/dist/main.2c3a3f1928ea25c4b79a.hot-update.js +11 -0
- package/dist/main.2c3a3f1928ea25c4b79a.hot-update.js.map +1 -0
- package/dist/main.2c3a3f1928ea25c4b79a.hot-update.json +1 -0
- package/dist/main.324b63996b3b36daf5af.hot-update.js +603 -0
- package/dist/main.324b63996b3b36daf5af.hot-update.js.map +1 -0
- package/dist/main.324b63996b3b36daf5af.hot-update.json +1 -0
- package/dist/main.4b0f7799388b5de9908d.hot-update.js +265 -0
- package/dist/main.4b0f7799388b5de9908d.hot-update.js.map +1 -0
- package/dist/main.4b0f7799388b5de9908d.hot-update.json +1 -0
- package/dist/main.6424291443afea7eb7ac.hot-update.js +187 -0
- package/dist/main.6424291443afea7eb7ac.hot-update.js.map +1 -0
- package/dist/main.6424291443afea7eb7ac.hot-update.json +1 -0
- package/dist/main.69127e32a0c76b421f15.hot-update.js +392 -0
- package/dist/main.69127e32a0c76b421f15.hot-update.js.map +1 -0
- package/dist/main.69127e32a0c76b421f15.hot-update.json +1 -0
- package/dist/main.755d91e1a6c7e6bd6702.hot-update.js +265 -0
- package/dist/main.755d91e1a6c7e6bd6702.hot-update.js.map +1 -0
- package/dist/main.755d91e1a6c7e6bd6702.hot-update.json +1 -0
- package/dist/main.75a666c9d30baa58c5ec.hot-update.js +265 -0
- package/dist/main.75a666c9d30baa58c5ec.hot-update.js.map +1 -0
- package/dist/main.75a666c9d30baa58c5ec.hot-update.json +1 -0
- package/dist/main.828f4c348446c6c3640d.hot-update.js +11 -0
- package/dist/main.828f4c348446c6c3640d.hot-update.js.map +1 -0
- package/dist/main.828f4c348446c6c3640d.hot-update.json +1 -0
- package/dist/main.8459249b2915a8823bd3.hot-update.js +321 -0
- package/dist/main.8459249b2915a8823bd3.hot-update.js.map +1 -0
- package/dist/main.8459249b2915a8823bd3.hot-update.json +1 -0
- package/dist/main.87f757c2602cac7001cb.hot-update.js +382 -0
- package/dist/main.87f757c2602cac7001cb.hot-update.js.map +1 -0
- package/dist/main.87f757c2602cac7001cb.hot-update.json +1 -0
- package/dist/main.8aa248086ab27072c348.hot-update.js +265 -0
- package/dist/main.8aa248086ab27072c348.hot-update.js.map +1 -0
- package/dist/main.8aa248086ab27072c348.hot-update.json +1 -0
- package/dist/main.8ce461bf769f3943b7ed.hot-update.js +265 -0
- package/dist/main.8ce461bf769f3943b7ed.hot-update.js.map +1 -0
- package/dist/main.8ce461bf769f3943b7ed.hot-update.json +1 -0
- package/dist/main.9fdbde5beb7c70940250.hot-update.js +392 -0
- package/dist/main.9fdbde5beb7c70940250.hot-update.js.map +1 -0
- package/dist/main.9fdbde5beb7c70940250.hot-update.json +1 -0
- package/dist/main.af59faaae348c919e033.hot-update.js +11 -0
- package/dist/main.af59faaae348c919e033.hot-update.js.map +1 -0
- package/dist/main.af59faaae348c919e033.hot-update.json +1 -0
- package/dist/main.b11900976593b0e609ee.hot-update.js +187 -0
- package/dist/main.b11900976593b0e609ee.hot-update.js.map +1 -0
- package/dist/main.b11900976593b0e609ee.hot-update.json +1 -0
- package/dist/main.b57518d376449c846971.hot-update.js +265 -0
- package/dist/main.b57518d376449c846971.hot-update.js.map +1 -0
- package/dist/main.b57518d376449c846971.hot-update.json +1 -0
- package/dist/main.b5fa8b91f66c4a67740b.hot-update.js +265 -0
- package/dist/main.b5fa8b91f66c4a67740b.hot-update.js.map +1 -0
- package/dist/main.b5fa8b91f66c4a67740b.hot-update.json +1 -0
- package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.js +265 -0
- package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.js.map +1 -0
- package/dist/main.bdb9e6ab1d13cf4250e8.hot-update.json +1 -0
- package/dist/main.c9b051fce9f983306d51.hot-update.js +265 -0
- package/dist/main.c9b051fce9f983306d51.hot-update.js.map +1 -0
- package/dist/main.c9b051fce9f983306d51.hot-update.json +1 -0
- package/dist/main.d03d8e0bfcbd86932c58.hot-update.js +638 -0
- package/dist/main.d03d8e0bfcbd86932c58.hot-update.js.map +1 -0
- package/dist/main.d03d8e0bfcbd86932c58.hot-update.json +1 -0
- package/dist/main.d3b74a9a35325f35373d.hot-update.js +265 -0
- package/dist/main.d3b74a9a35325f35373d.hot-update.js.map +1 -0
- package/dist/main.d3b74a9a35325f35373d.hot-update.json +1 -0
- package/dist/main.d61b231278a9c69df2f8.hot-update.js +265 -0
- package/dist/main.d61b231278a9c69df2f8.hot-update.js.map +1 -0
- package/dist/main.d61b231278a9c69df2f8.hot-update.json +1 -0
- package/dist/pretty-chitty.js +243813 -0
- package/dist/pretty-chitty.js.map +1 -0
- package/package.json +1 -1
- package/src/library/components/ActionLogDisplay.tsx +1 -1
- package/src/library/components/ActionLogSidebar.tsx +1 -1
- package/src/library/components/BottomBar.tsx +2 -0
- package/src/library/components/BottomBarButton.tsx +3 -3
- package/src/library/components/MatchViewer.tsx +23 -9
- package/src/library/components/Panel/MultiPanel.tsx +7 -6
- package/src/library/components/Panel/PanelContents.tsx +4 -2
- package/src/library/components/Panel/SinglePanel.tsx +7 -6
- package/src/library/components/SettingsDisplay.tsx +152 -90
- package/src/library/components/TopBar.tsx +2 -0
- package/src/library/components/TopBarPlayers.tsx +4 -2
- package/src/library/game/Chit.ts +3 -2
- package/src/library/game/DisplaySettings.test.ts +80 -0
- package/src/library/game/DisplaySettings.ts +153 -0
- package/src/library/game/GameButton.ts +2 -0
- package/src/library/game/GameTheme.ts +10 -0
- package/src/library/game/Pick.ts +3 -2
- package/src/library/game/PlayerPromptStatusChit.ts +2 -0
- package/src/library/game/SparkChit.ts +2 -0
- package/src/library/game/typeName.test.ts +51 -0
- package/src/library/game/typeName.ts +40 -0
- package/src/library/hooks/useDisplaySettings.tsx +58 -0
- package/src/library/index.ts +1 -0
- package/src/library/utilities/CanvasStack/CanvasStack.ts +40 -3
- package/src/library/hooks/usePanelScale.tsx +0 -23
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.b11900976593b0e609ee.hot-update.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAmD;AACI;AACF;AACP;AAEF;AAEA;AAGG;AACa;AACX;AAEjD,SAASW,UAAUA,CAAAC,IAAA,EAAsD;EAAAC,EAAA;EAAA,IAAnDC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAC5B,IAAMC,KAAK,GAAGX,iEAAY,CAAC,CAAC;EAC5B,oBACEJ,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E,EAAG;QAAC,oCAAAd,MAAA,CAAkCY,QAAQ,CAACE,EAAE,CAAG;QAACzC,EAAE,EAAE;UAAEgC,KAAK,EAAEN,QAAQ;UAAEgB,UAAU,eAAAf,MAAA,CAAe7B,KAAK,CAAC6C,QAAQ;QAAG;MAAE,gBACzI5D,0DAAA,CAACyB,mBAAmB;QAACG,MAAM,EAAE4B,QAAQ,CAACE;MAAG,CAAE,CACxC;IAAC;EAAA,CACP,CACI,CACF,CACG,CAAC;AAEjB;AAACrB,GAAA,CA/CuBF,MAAM;EAAA,QACd/B,6DAAY,EACTG,oDAAO;AAAA;AAAAsD,GAAA,GAFF1B,MAAM;AAAA,IAAAX,EAAA,EAAAU,GAAA,EAAA2B,GAAA;AAAAC,sCAAA,CAAAtC,EAAA;AAAAsC,sCAAA,CAAA5B,GAAA;AAAA4B,sCAAA,CAAAD,GAAA,Y;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC7C9B,sD","sources":["webpack://@pretty-chitty/core/./src/library/components/TopBar.tsx","webpack://@pretty-chitty/core/webpack/runtime/getFullHash"],"sourcesContent":["import React, { ReactNode, useState } from \"react\";\nimport { Box, IconButton, Stack } from \"@mui/material\";\nimport { useGameTheme } from \"../hooks/useGameTheme\";\nimport TopBarDropdown from \"./TopBarDropdown\";\nimport BottomBarBreak from \"./BottomBarBreak\";\nimport TopBarPlayers from \"./TopBarPlayers\";\nimport { useTimeController } from \"../hooks/useTimeController\";\nimport { useChit } from \"../hooks/useChits\";\nimport { RootChit } from \"../game/RootChit\";\nimport { DropdownChit } from \"../game/DropdownChit\";\nimport { ArrowBack } from \"@material-ui/icons\";\nimport { ZINDEX_TOP_BAR_HEADER } from \"../utilities/zIndex\";\nimport { usePlayerId } from \"../hooks/usePlayer\";\n\nfunction BaseTopBar({ children }: { children: ReactNode | ReactNode[] }) {\n const theme = useGameTheme();\n return (\n <Box\n sx={{\n position: \"relative\",\n background: theme.barColor,\n height: theme.topBarHeight,\n // A fixed-height bar in the viewer's flex column: never squeezed when the table needs the room\n flexShrink: 0,\n }}\n >\n {children}\n </Box>\n );\n}\n\nfunction DropdownChitWrapper({ chitId }: { chitId: string | undefined }) {\n const chit = useChit<DropdownChit>(chitId ?? \"\");\n const playerId = usePlayerId();\n\n if (!chitId) {\n return null;\n }\n\n if (chit) {\n return <TopBarDropdown label={chit.renderLabel(playerId)}>{chit.renderBody(playerId)}</TopBarDropdown>;\n }\n return null;\n}\n\nexport default function TopBar({ onBack }: { onBack?: () => void }) {\n const theme = useGameTheme();\n const rootChit = useChit<RootChit<any>>(\"root\");\n const dropdowns = rootChit?.getDropdowns() ?? [];\n\n const barWidth = `${(1 / (dropdowns.length + 1)) * 100}%`;\n const BUTTON_WIDTH = theme.topBarHeight - theme.spacing * 2;\n\n return (\n <BaseTopBar>\n <Stack direction=\"row\" sx={{ width: \"100%\", height: \"100%\" }}>\n {onBack && (\n <Box\n sx={{\n height: \"100%\",\n width: BUTTON_WIDTH,\n position: \"relative\",\n background: theme.barColor,\n zIndex: ZINDEX_TOP_BAR_HEADER,\n }}\n >\n <IconButton\n sx={{\n width: BUTTON_WIDTH,\n color: theme.barTextColor,\n height: \"100%\",\n }}\n onClick={onBack}\n >\n <ArrowBack />\n </IconButton>\n </Box>\n )}\n <Stack direction=\"row\" flex={1} sx={{ width: `calc(100% - ${BUTTON_WIDTH}px)` }}>\n <Box sx={{ width: barWidth }}>\n <TopBarPlayers />\n </Box>\n {dropdowns.map((dropdown) => (\n // a tutorial points at a dropdown (a player aid) as `{ ui: \"dropdown:<chit id>\" }`\n <Box key={dropdown.id} data-tutorial-target={`dropdown:${dropdown.id}`} sx={{ width: barWidth, borderLeft: `1px solid ${theme.barBreak}` }}>\n <DropdownChitWrapper chitId={dropdown.id} />\n </Box>\n ))}\n </Stack>\n </Stack>\n </BaseTopBar>\n );\n}\n","__webpack_require__.h = () => (\"13daf8cac0f0a3231f6a\")"],"names":["React","Box","IconButton","Stack","useGameTheme","TopBarDropdown","TopBarPlayers","useChit","ArrowBack","ZINDEX_TOP_BAR_HEADER","usePlayerId","BaseTopBar","_ref","_s","children","theme","createElement","sx","position","background","barColor","height","topBarHeight","flexShrink","_c","DropdownChitWrapper","_ref2","_s2","chitId","chit","playerId","label","renderLabel","renderBody","_c2","TopBar","_ref3","_s3","_rootChit$getDropdown","onBack","rootChit","dropdowns","getDropdowns","barWidth","concat","length","BUTTON_WIDTH","spacing","direction","width","zIndex","color","barTextColor","onClick","flex","map","dropdown","key","id","borderLeft","barBreak","_c3","$RefreshReg$"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"c":["main"],"r":[],"m":[]}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
self["webpackHotUpdate_pretty_chitty_core"]("main",{
|
|
3
|
+
|
|
4
|
+
/***/ "./src/library/game/DisplaySettings.ts":
|
|
5
|
+
/*!*********************************************!*\
|
|
6
|
+
!*** ./src/library/game/DisplaySettings.ts ***!
|
|
7
|
+
\*********************************************/
|
|
8
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
9
|
+
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
/* harmony export */ ANIMATION_SPEEDS: () => (/* binding */ ANIMATION_SPEEDS),
|
|
13
|
+
/* harmony export */ DEFAULT_DISPLAY_SETTINGS: () => (/* binding */ DEFAULT_DISPLAY_SETTINGS),
|
|
14
|
+
/* harmony export */ DISPLAY_SECTIONS: () => (/* binding */ DISPLAY_SECTIONS),
|
|
15
|
+
/* harmony export */ DISPLAY_STEP_COUNT: () => (/* binding */ DISPLAY_STEP_COUNT),
|
|
16
|
+
/* harmony export */ DISPLAY_STEP_LABELS: () => (/* binding */ DISPLAY_STEP_LABELS),
|
|
17
|
+
/* harmony export */ NORMAL_STEP: () => (/* binding */ NORMAL_STEP),
|
|
18
|
+
/* harmony export */ allAtStep: () => (/* binding */ allAtStep),
|
|
19
|
+
/* harmony export */ animationSpeedStep: () => (/* binding */ animationSpeedStep),
|
|
20
|
+
/* harmony export */ loadDisplaySettings: () => (/* binding */ loadDisplaySettings),
|
|
21
|
+
/* harmony export */ overallStep: () => (/* binding */ overallStep),
|
|
22
|
+
/* harmony export */ saveDisplaySettings: () => (/* binding */ saveDisplaySettings),
|
|
23
|
+
/* harmony export */ scaledTheme: () => (/* binding */ scaledTheme),
|
|
24
|
+
/* harmony export */ sectionMultiplier: () => (/* binding */ sectionMultiplier)
|
|
25
|
+
/* harmony export */ });
|
|
26
|
+
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
27
|
+
/* provided dependency */ var __react_refresh_error_overlay__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/overlay/index.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/overlay/index.js");
|
|
28
|
+
__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js");
|
|
29
|
+
|
|
30
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
31
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
32
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
33
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
34
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
36
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
37
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
38
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
39
|
+
/** The parts of the match screen a player can size on their own */
|
|
40
|
+
|
|
41
|
+
/** A step per section: 0 (smallest) to 4 (biggest), 2 being the game's own theme */
|
|
42
|
+
|
|
43
|
+
var DISPLAY_STEP_COUNT = 5;
|
|
44
|
+
var NORMAL_STEP = 2;
|
|
45
|
+
var DISPLAY_STEP_LABELS = ["Smallest", "Smaller", "Normal", "Bigger", "Biggest"];
|
|
46
|
+
var DISPLAY_SECTIONS = [{
|
|
47
|
+
key: "panelLayout",
|
|
48
|
+
label: "Panel Layout",
|
|
49
|
+
smallerHint: "More panels",
|
|
50
|
+
biggerHint: "Bigger panels"
|
|
51
|
+
}, {
|
|
52
|
+
key: "panelPadding",
|
|
53
|
+
label: "Panel Padding",
|
|
54
|
+
smallerHint: "Tighter",
|
|
55
|
+
biggerHint: "Roomier"
|
|
56
|
+
}, {
|
|
57
|
+
key: "topBar",
|
|
58
|
+
label: "Top Bar",
|
|
59
|
+
smallerHint: "Smaller",
|
|
60
|
+
biggerHint: "Bigger"
|
|
61
|
+
}, {
|
|
62
|
+
key: "actionLog",
|
|
63
|
+
label: "Action Log",
|
|
64
|
+
smallerHint: "Smaller",
|
|
65
|
+
biggerHint: "Bigger"
|
|
66
|
+
}, {
|
|
67
|
+
key: "bottomBar",
|
|
68
|
+
label: "Bottom Bar",
|
|
69
|
+
smallerHint: "Smaller",
|
|
70
|
+
biggerHint: "Bigger"
|
|
71
|
+
}];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* What each step multiplies the theme's sizes by. Panel layout is the odd one out: it is the scale
|
|
75
|
+
* the layout is worked out at, where a higher scale fits more (smaller) panels on screen, so it
|
|
76
|
+
* runs downwards as the panels get bigger.
|
|
77
|
+
*/
|
|
78
|
+
var MULTIPLIERS = {
|
|
79
|
+
panelLayout: [1.8, 1.35, 1, 0.8, 0.65],
|
|
80
|
+
panelPadding: [0.25, 0.5, 1, 1.75, 2.5],
|
|
81
|
+
topBar: [0.75, 0.875, 1, 1.2, 1.4],
|
|
82
|
+
actionLog: [0.8, 0.9, 1, 1.2, 1.4],
|
|
83
|
+
bottomBar: [0.7, 0.85, 1, 1.15, 1.3]
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Animation playback speeds, slowest to fastest: one step below normal (the default) and three
|
|
88
|
+
* doublings above it, up to 8x.
|
|
89
|
+
*/
|
|
90
|
+
var ANIMATION_SPEEDS = [0.5, 1, 2, 4, 8];
|
|
91
|
+
var DEFAULT_DISPLAY_SETTINGS = {
|
|
92
|
+
panelLayout: NORMAL_STEP,
|
|
93
|
+
panelPadding: NORMAL_STEP,
|
|
94
|
+
topBar: NORMAL_STEP,
|
|
95
|
+
actionLog: NORMAL_STEP,
|
|
96
|
+
bottomBar: NORMAL_STEP
|
|
97
|
+
};
|
|
98
|
+
var STORAGE_KEY = "displaySettings";
|
|
99
|
+
/** The free-form panel scale that came before these settings */
|
|
100
|
+
var LEGACY_PANEL_SCALE_KEY = "panelScale";
|
|
101
|
+
function clampStep(step) {
|
|
102
|
+
var n = typeof step === "number" && Number.isFinite(step) ? Math.round(step) : NORMAL_STEP;
|
|
103
|
+
return Math.max(0, Math.min(DISPLAY_STEP_COUNT - 1, n));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The index of the value in `values` nearest to `value`, measured as a ratio (they are all scales) */
|
|
107
|
+
function nearestIndex(values, value) {
|
|
108
|
+
var best = 0;
|
|
109
|
+
for (var i = 1; i < values.length; i++) {
|
|
110
|
+
if (Math.abs(Math.log(values[i] / value)) < Math.abs(Math.log(values[best] / value))) {
|
|
111
|
+
best = i;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return best;
|
|
115
|
+
}
|
|
116
|
+
function sectionMultiplier(section, settings) {
|
|
117
|
+
return MULTIPLIERS[section][clampStep(settings[section])];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The animation speed step nearest to a duration multiplier (1 / speed), as `ClientTimeState` keeps it */
|
|
121
|
+
function animationSpeedStep(durationMultiplier) {
|
|
122
|
+
return nearestIndex(ANIMATION_SPEEDS, 1 / (durationMultiplier || 1));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The step every section shares, or undefined when they have been set individually */
|
|
126
|
+
function overallStep(settings) {
|
|
127
|
+
var steps = DISPLAY_SECTIONS.map(function (s) {
|
|
128
|
+
return settings[s.key];
|
|
129
|
+
});
|
|
130
|
+
return steps.every(function (s) {
|
|
131
|
+
return s === steps[0];
|
|
132
|
+
}) ? steps[0] : undefined;
|
|
133
|
+
}
|
|
134
|
+
function allAtStep(step) {
|
|
135
|
+
var result = _objectSpread({}, DEFAULT_DISPLAY_SETTINGS);
|
|
136
|
+
var _iterator = _createForOfIteratorHelper(DISPLAY_SECTIONS),
|
|
137
|
+
_step;
|
|
138
|
+
try {
|
|
139
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
140
|
+
var key = _step.value.key;
|
|
141
|
+
result[key] = clampStep(step);
|
|
142
|
+
}
|
|
143
|
+
} catch (err) {
|
|
144
|
+
_iterator.e(err);
|
|
145
|
+
} finally {
|
|
146
|
+
_iterator.f();
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
function loadDisplaySettings(storage) {
|
|
151
|
+
var result = _objectSpread({}, DEFAULT_DISPLAY_SETTINGS);
|
|
152
|
+
try {
|
|
153
|
+
var _storage$getItem;
|
|
154
|
+
var raw = storage === null || storage === void 0 ? void 0 : storage.getItem(STORAGE_KEY);
|
|
155
|
+
if (raw) {
|
|
156
|
+
var parsed = JSON.parse(raw);
|
|
157
|
+
var _iterator2 = _createForOfIteratorHelper(DISPLAY_SECTIONS),
|
|
158
|
+
_step2;
|
|
159
|
+
try {
|
|
160
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
161
|
+
var key = _step2.value.key;
|
|
162
|
+
result[key] = clampStep(parsed === null || parsed === void 0 ? void 0 : parsed[key]);
|
|
163
|
+
}
|
|
164
|
+
} catch (err) {
|
|
165
|
+
_iterator2.e(err);
|
|
166
|
+
} finally {
|
|
167
|
+
_iterator2.f();
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
var legacyScale = parseFloat((_storage$getItem = storage === null || storage === void 0 ? void 0 : storage.getItem(LEGACY_PANEL_SCALE_KEY)) !== null && _storage$getItem !== void 0 ? _storage$getItem : "");
|
|
172
|
+
if (legacyScale > 0) {
|
|
173
|
+
result.panelLayout = nearestIndex(MULTIPLIERS.panelLayout, legacyScale);
|
|
174
|
+
}
|
|
175
|
+
} catch (_unused) {
|
|
176
|
+
// unreadable storage: everything stays at the game's own sizes
|
|
177
|
+
}
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
function saveDisplaySettings(storage, settings) {
|
|
181
|
+
try {
|
|
182
|
+
storage === null || storage === void 0 || storage.setItem(STORAGE_KEY, JSON.stringify(settings));
|
|
183
|
+
} catch (_unused2) {
|
|
184
|
+
// storage unavailable: the setting lasts until the page closes
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* A copy of `theme` with the sizes that belong to `section` multiplied by the player's setting for
|
|
190
|
+
* it. Returns `theme` itself when the section is at its normal size.
|
|
191
|
+
*/
|
|
192
|
+
function scaledTheme(theme, section, settings) {
|
|
193
|
+
var m = sectionMultiplier(section, settings);
|
|
194
|
+
if (m === 1 || section === "panelLayout") {
|
|
195
|
+
return theme;
|
|
196
|
+
}
|
|
197
|
+
// Copy the fields onto the same prototype, so getters (fontFamily) and methods still work and
|
|
198
|
+
// no setter runs
|
|
199
|
+
var result = Object.assign(Object.create(Object.getPrototypeOf(theme)), theme);
|
|
200
|
+
switch (section) {
|
|
201
|
+
case "panelPadding":
|
|
202
|
+
result.panelSpacing = theme.getPanelSpacing() * m;
|
|
203
|
+
break;
|
|
204
|
+
case "topBar":
|
|
205
|
+
result.topBarHeight = theme.topBarHeight * m;
|
|
206
|
+
result.fontScalar = theme.fontScalar * m;
|
|
207
|
+
result.spacing = theme.spacing * m;
|
|
208
|
+
break;
|
|
209
|
+
case "actionLog":
|
|
210
|
+
result.fontScalar = theme.fontScalar * m;
|
|
211
|
+
result.actionLogSidebarWidth = theme.actionLogSidebarWidth * m;
|
|
212
|
+
break;
|
|
213
|
+
case "bottomBar":
|
|
214
|
+
result.bottomBarHeight = theme.bottomBarHeight * m;
|
|
215
|
+
result.bottomBarFontScalar = theme.bottomBarFontScalar * m;
|
|
216
|
+
result.bottomBarIconSize = theme.bottomBarIconSize * m;
|
|
217
|
+
result.spacing = theme.spacing * m;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId;
|
|
224
|
+
const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports(
|
|
225
|
+
$ReactRefreshModuleId$
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
function $ReactRefreshModuleRuntime$(exports) {
|
|
229
|
+
if (true) {
|
|
230
|
+
let errorOverlay;
|
|
231
|
+
if (typeof __react_refresh_error_overlay__ !== 'undefined') {
|
|
232
|
+
errorOverlay = __react_refresh_error_overlay__;
|
|
233
|
+
}
|
|
234
|
+
let testMode;
|
|
235
|
+
if (typeof __react_refresh_test__ !== 'undefined') {
|
|
236
|
+
testMode = __react_refresh_test__;
|
|
237
|
+
}
|
|
238
|
+
return __react_refresh_utils__.executeRuntime(
|
|
239
|
+
exports,
|
|
240
|
+
$ReactRefreshModuleId$,
|
|
241
|
+
module.hot,
|
|
242
|
+
errorOverlay,
|
|
243
|
+
testMode
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) {
|
|
249
|
+
$ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$);
|
|
250
|
+
} else {
|
|
251
|
+
$ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/***/ })
|
|
255
|
+
|
|
256
|
+
},
|
|
257
|
+
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
258
|
+
/******/ /* webpack/runtime/getFullHash */
|
|
259
|
+
/******/ (() => {
|
|
260
|
+
/******/ __webpack_require__.h = () => ("6424291443afea7eb7ac")
|
|
261
|
+
/******/ })();
|
|
262
|
+
/******/
|
|
263
|
+
/******/ }
|
|
264
|
+
);
|
|
265
|
+
//# sourceMappingURL=main.b57518d376449c846971.hot-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.b57518d376449c846971.hot-update.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAGA;;AAGO,IAAMA,kBAAkB,GAAG,CAAC;AAC5B,IAAMC,WAAW,GAAG,CAAC;AACrB,IAAMC,mBAAmB,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;AAElF,IAAMC,gBAAmG,GAAG,CACjH;EAAEC,GAAG,EAAE,aAAa;EAAEC,KAAK,EAAE,cAAc;EAAEC,WAAW,EAAE,aAAa;EAAEC,UAAU,EAAE;AAAgB,CAAC,EACtG;EAAEH,GAAG,EAAE,cAAc;EAAEC,KAAK,EAAE,eAAe;EAAEC,WAAW,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAU,CAAC,EAC9F;EAAEH,GAAG,EAAE,QAAQ;EAAEC,KAAK,EAAE,SAAS;EAAEC,WAAW,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAS,CAAC,EACjF;EA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CAAC,GAAGN,CAAC;MACjD;IACF,KAAK,QAAQ;MACX5B,MAAM,CAACmC,YAAY,GAAGR,KAAK,CAACQ,YAAY,GAAGP,CAAC;MAC5C5B,MAAM,CAACoC,UAAU,GAAGT,KAAK,CAACS,UAAU,GAAGR,CAAC;MACxC5B,MAAM,CAACqC,OAAO,GAAGV,KAAK,CAACU,OAAO,GAAGT,CAAC;MAClC;IACF,KAAK,WAAW;MACd5B,MAAM,CAACoC,UAAU,GAAGT,KAAK,CAACS,UAAU,GAAGR,CAAC;MACxC5B,MAAM,CAACsC,qBAAqB,GAAGX,KAAK,CAACW,qBAAqB,GAAGV,CAAC;MAC9D;IACF,KAAK,WAAW;MACd5B,MAAM,CAACuC,eAAe,GAAGZ,KAAK,CAACY,eAAe,GAAGX,CAAC;MAClD5B,MAAM,CAACwC,mBAAmB,GAAGb,KAAK,CAACa,mBAAmB,GAAGZ,CAAC;MAC1D5B,MAAM,CAACyC,iBAAiB,GAAGd,KAAK,CAACc,iBAAiB,GAAGb,CAAC;MACtD5B,MAAM,CAACqC,OAAO,GAAGV,KAAK,CAACU,OAAO,GAAGT,CAAC;MAClC;EACJ;EACA,OAAO5B,MAAM;AACf,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCxJA,sD","sources":["webpack://@pretty-chitty/core/./src/library/game/DisplaySettings.ts","webpack://@pretty-chitty/core/webpack/runtime/getFullHash"],"sourcesContent":["import { GameTheme } from \"./GameTheme\";\n\n/** The parts of the match screen a player can size on their own */\nexport type DisplaySection = \"panelLayout\" | \"panelPadding\" | \"topBar\" | \"actionLog\" | \"bottomBar\";\n\n/** A step per section: 0 (smallest) to 4 (biggest), 2 being the game's own theme */\nexport type DisplaySettings = Record<DisplaySection, number>;\n\nexport const DISPLAY_STEP_COUNT = 5;\nexport const NORMAL_STEP = 2;\nexport const DISPLAY_STEP_LABELS = [\"Smallest\", \"Smaller\", \"Normal\", \"Bigger\", \"Biggest\"];\n\nexport const DISPLAY_SECTIONS: { key: DisplaySection; label: string; smallerHint: string; biggerHint: string }[] = [\n { key: \"panelLayout\", label: \"Panel Layout\", smallerHint: \"More panels\", biggerHint: \"Bigger panels\" },\n { key: \"panelPadding\", label: \"Panel Padding\", smallerHint: \"Tighter\", biggerHint: \"Roomier\" },\n { key: \"topBar\", label: \"Top Bar\", smallerHint: \"Smaller\", biggerHint: \"Bigger\" },\n { key: \"actionLog\", label: \"Action Log\", smallerHint: \"Smaller\", biggerHint: \"Bigger\" },\n { key: \"bottomBar\", label: \"Bottom Bar\", smallerHint: \"Smaller\", biggerHint: \"Bigger\" },\n];\n\n/**\n * What each step multiplies the theme's sizes by. Panel layout is the odd one out: it is the scale\n * the layout is worked out at, where a higher scale fits more (smaller) panels on screen, so it\n * runs downwards as the panels get bigger.\n */\nconst MULTIPLIERS: Record<DisplaySection, number[]> = {\n panelLayout: [1.8, 1.35, 1, 0.8, 0.65],\n panelPadding: [0.25, 0.5, 1, 1.75, 2.5],\n topBar: [0.75, 0.875, 1, 1.2, 1.4],\n actionLog: [0.8, 0.9, 1, 1.2, 1.4],\n bottomBar: [0.7, 0.85, 1, 1.15, 1.3],\n};\n\n/**\n * Animation playback speeds, slowest to fastest: one step below normal (the default) and three\n * doublings above it, up to 8x.\n */\nexport const ANIMATION_SPEEDS = [0.5, 1, 2, 4, 8];\n\nexport const DEFAULT_DISPLAY_SETTINGS: DisplaySettings = {\n panelLayout: NORMAL_STEP,\n panelPadding: NORMAL_STEP,\n topBar: NORMAL_STEP,\n actionLog: NORMAL_STEP,\n bottomBar: NORMAL_STEP,\n};\n\nconst STORAGE_KEY = \"displaySettings\";\n/** The free-form panel scale that came before these settings */\nconst LEGACY_PANEL_SCALE_KEY = \"panelScale\";\n\nfunction clampStep(step: unknown): number {\n const n = typeof step === \"number\" && Number.isFinite(step) ? Math.round(step) : NORMAL_STEP;\n return Math.max(0, Math.min(DISPLAY_STEP_COUNT - 1, n));\n}\n\n/** The index of the value in `values` nearest to `value`, measured as a ratio (they are all scales) */\nfunction nearestIndex(values: number[], value: number): number {\n let best = 0;\n for (let i = 1; i < values.length; i++) {\n if (Math.abs(Math.log(values[i] / value)) < Math.abs(Math.log(values[best] / value))) {\n best = i;\n }\n }\n return best;\n}\n\nexport function sectionMultiplier(section: DisplaySection, settings: DisplaySettings): number {\n return MULTIPLIERS[section][clampStep(settings[section])];\n}\n\n/** The animation speed step nearest to a duration multiplier (1 / speed), as `ClientTimeState` keeps it */\nexport function animationSpeedStep(durationMultiplier: number): number {\n return nearestIndex(ANIMATION_SPEEDS, 1 / (durationMultiplier || 1));\n}\n\n/** The step every section shares, or undefined when they have been set individually */\nexport function overallStep(settings: DisplaySettings): number | undefined {\n const steps = DISPLAY_SECTIONS.map((s) => settings[s.key]);\n return steps.every((s) => s === steps[0]) ? steps[0] : undefined;\n}\n\nexport function allAtStep(step: number): DisplaySettings {\n const result = { ...DEFAULT_DISPLAY_SETTINGS };\n for (const { key } of DISPLAY_SECTIONS) {\n result[key] = clampStep(step);\n }\n return result;\n}\n\nexport function loadDisplaySettings(storage: Pick<Storage, \"getItem\"> | undefined): DisplaySettings {\n const result = { ...DEFAULT_DISPLAY_SETTINGS };\n try {\n const raw = storage?.getItem(STORAGE_KEY);\n if (raw) {\n const parsed = JSON.parse(raw);\n for (const { key } of DISPLAY_SECTIONS) {\n result[key] = clampStep(parsed?.[key]);\n }\n return result;\n }\n const legacyScale = parseFloat(storage?.getItem(LEGACY_PANEL_SCALE_KEY) ?? \"\");\n if (legacyScale > 0) {\n result.panelLayout = nearestIndex(MULTIPLIERS.panelLayout, legacyScale);\n }\n } catch {\n // unreadable storage: everything stays at the game's own sizes\n }\n return result;\n}\n\nexport function saveDisplaySettings(storage: Pick<Storage, \"setItem\"> | undefined, settings: DisplaySettings) {\n try {\n storage?.setItem(STORAGE_KEY, JSON.stringify(settings));\n } catch {\n // storage unavailable: the setting lasts until the page closes\n }\n}\n\n/**\n * A copy of `theme` with the sizes that belong to `section` multiplied by the player's setting for\n * it. Returns `theme` itself when the section is at its normal size.\n */\nexport function scaledTheme(theme: GameTheme, section: DisplaySection, settings: DisplaySettings): GameTheme {\n const m = sectionMultiplier(section, settings);\n if (m === 1 || section === \"panelLayout\") {\n return theme;\n }\n // Copy the fields onto the same prototype, so getters (fontFamily) and methods still work and\n // no setter runs\n const result: GameTheme = Object.assign(Object.create(Object.getPrototypeOf(theme)), theme);\n switch (section) {\n case \"panelPadding\":\n result.panelSpacing = theme.getPanelSpacing() * m;\n break;\n case \"topBar\":\n result.topBarHeight = theme.topBarHeight * m;\n result.fontScalar = theme.fontScalar * m;\n result.spacing = theme.spacing * m;\n break;\n case \"actionLog\":\n result.fontScalar = theme.fontScalar * m;\n result.actionLogSidebarWidth = theme.actionLogSidebarWidth * m;\n break;\n case \"bottomBar\":\n result.bottomBarHeight = theme.bottomBarHeight * m;\n result.bottomBarFontScalar = theme.bottomBarFontScalar * m;\n result.bottomBarIconSize = theme.bottomBarIconSize * m;\n result.spacing = theme.spacing * m;\n break;\n }\n return result;\n}\n","__webpack_require__.h = () => (\"6424291443afea7eb7ac\")"],"names":["DISPLAY_STEP_COUNT","NORMAL_STEP","DISPLAY_STEP_LABELS","DISPLAY_SECTIONS","key","label","smallerHint","biggerHint","MULTIPLIERS","panelLayout","panelPadding","topBar","actionLog","bottomBar","ANIMATION_SPEEDS","DEFAULT_DISPLAY_SETTINGS","STORAGE_KEY","LEGACY_PANEL_SCALE_KEY","clampStep","step","n","Number","isFinite","Math","round","max","min","nearestIndex","values","value","best","i","length","abs","log","sectionMultiplier","section","settings","animationSpeedStep","durationMultiplier","overallStep","steps","map","s","every","undefined","allAtStep","result","_objectSpread","_iterator","_createForOfIteratorHelper","_step","done","err","e","f","loadDisplaySettings","storage","_storage$getItem","raw","getItem","parsed","JSON","parse","_iterator2","_step2","legacyScale","parseFloat","_unused","saveDisplaySettings","setItem","stringify","_unused2","scaledTheme","theme","m","Object","assign","create","getPrototypeOf","panelSpacing","getPanelSpacing","topBarHeight","fontScalar","spacing","actionLogSidebarWidth","bottomBarHeight","bottomBarFontScalar","bottomBarIconSize"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"c":["main"],"r":[],"m":[]}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
self["webpackHotUpdate_pretty_chitty_core"]("main",{
|
|
3
|
+
|
|
4
|
+
/***/ "./src/library/game/DisplaySettings.ts":
|
|
5
|
+
/*!*********************************************!*\
|
|
6
|
+
!*** ./src/library/game/DisplaySettings.ts ***!
|
|
7
|
+
\*********************************************/
|
|
8
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
9
|
+
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
/* harmony export */ ANIMATION_SPEEDS: () => (/* binding */ ANIMATION_SPEEDS),
|
|
13
|
+
/* harmony export */ DEFAULT_DISPLAY_SETTINGS: () => (/* binding */ DEFAULT_DISPLAY_SETTINGS),
|
|
14
|
+
/* harmony export */ DISPLAY_SECTIONS: () => (/* binding */ DISPLAY_SECTIONS),
|
|
15
|
+
/* harmony export */ DISPLAY_STEP_COUNT: () => (/* binding */ DISPLAY_STEP_COUNT),
|
|
16
|
+
/* harmony export */ DISPLAY_STEP_LABELS: () => (/* binding */ DISPLAY_STEP_LABELS),
|
|
17
|
+
/* harmony export */ NORMAL_STEP: () => (/* binding */ NORMAL_STEP),
|
|
18
|
+
/* harmony export */ allAtStep: () => (/* binding */ allAtStep),
|
|
19
|
+
/* harmony export */ animationSpeedStep: () => (/* binding */ animationSpeedStep),
|
|
20
|
+
/* harmony export */ loadDisplaySettings: () => (/* binding */ loadDisplaySettings),
|
|
21
|
+
/* harmony export */ overallStep: () => (/* binding */ overallStep),
|
|
22
|
+
/* harmony export */ saveDisplaySettings: () => (/* binding */ saveDisplaySettings),
|
|
23
|
+
/* harmony export */ scaledTheme: () => (/* binding */ scaledTheme),
|
|
24
|
+
/* harmony export */ sectionMultiplier: () => (/* binding */ sectionMultiplier)
|
|
25
|
+
/* harmony export */ });
|
|
26
|
+
/* provided dependency */ var __react_refresh_utils__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js");
|
|
27
|
+
/* provided dependency */ var __react_refresh_error_overlay__ = __webpack_require__(/*! ./node_modules/@pmmmwh/react-refresh-webpack-plugin/overlay/index.js */ "./node_modules/@pmmmwh/react-refresh-webpack-plugin/overlay/index.js");
|
|
28
|
+
__webpack_require__.$Refresh$.runtime = __webpack_require__(/*! ./node_modules/react-refresh/runtime.js */ "./node_modules/react-refresh/runtime.js");
|
|
29
|
+
|
|
30
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
31
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
32
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
33
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
34
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
36
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
37
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
38
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
39
|
+
/** The parts of the match screen a player can size on their own */
|
|
40
|
+
|
|
41
|
+
/** A step per section: 0 (smallest) to 4 (biggest), 2 being the game's own theme */
|
|
42
|
+
|
|
43
|
+
var DISPLAY_STEP_COUNT = 5;
|
|
44
|
+
var NORMAL_STEP = 2;
|
|
45
|
+
var DISPLAY_STEP_LABELS = ["Smallest", "Smaller", "Normal", "Bigger", "Biggest"];
|
|
46
|
+
var DISPLAY_SECTIONS = [{
|
|
47
|
+
key: "panelLayout",
|
|
48
|
+
label: "Panel Layout",
|
|
49
|
+
smallerHint: "More panels",
|
|
50
|
+
biggerHint: "Bigger panels"
|
|
51
|
+
}, {
|
|
52
|
+
key: "panelPadding",
|
|
53
|
+
label: "Panel Padding",
|
|
54
|
+
smallerHint: "Tighter",
|
|
55
|
+
biggerHint: "Roomier"
|
|
56
|
+
}, {
|
|
57
|
+
key: "topBar",
|
|
58
|
+
label: "Top Bar",
|
|
59
|
+
smallerHint: "Smaller",
|
|
60
|
+
biggerHint: "Bigger"
|
|
61
|
+
}, {
|
|
62
|
+
key: "actionLog",
|
|
63
|
+
label: "Action Log",
|
|
64
|
+
smallerHint: "Smaller",
|
|
65
|
+
biggerHint: "Bigger"
|
|
66
|
+
}, {
|
|
67
|
+
key: "bottomBar",
|
|
68
|
+
label: "Bottom Bar",
|
|
69
|
+
smallerHint: "Smaller",
|
|
70
|
+
biggerHint: "Bigger"
|
|
71
|
+
}];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* What each step multiplies the theme's sizes by. Panel layout is the odd one out: it is the scale
|
|
75
|
+
* the layout is worked out at, where a higher scale fits more (smaller) panels on screen, so it
|
|
76
|
+
* runs downwards as the panels get bigger.
|
|
77
|
+
*/
|
|
78
|
+
var MULTIPLIERS = {
|
|
79
|
+
panelLayout: [1.8, 1.35, 1, 0.8, 0.65],
|
|
80
|
+
panelPadding: [0.25, 0.5, 1, 1.75, 2.5],
|
|
81
|
+
topBar: [0.75, 0.875, 1, 1.2, 1.4],
|
|
82
|
+
actionLog: [0.8, 0.9, 1, 1.2, 1.4],
|
|
83
|
+
bottomBar: [0.7, 0.85, 1, 1.15, 1.3]
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Animation playback speeds, slowest to fastest: one step below normal (the default) and three
|
|
88
|
+
* doublings above it, up to 8x.
|
|
89
|
+
*/
|
|
90
|
+
var ANIMATION_SPEEDS = [0.5, 1, 2, 4, 8];
|
|
91
|
+
var DEFAULT_DISPLAY_SETTINGS = {
|
|
92
|
+
panelLayout: 4,
|
|
93
|
+
panelPadding: 4,
|
|
94
|
+
topBar: 4,
|
|
95
|
+
actionLog: 4,
|
|
96
|
+
bottomBar: 4
|
|
97
|
+
};
|
|
98
|
+
var STORAGE_KEY = "displaySettings";
|
|
99
|
+
/** The free-form panel scale that came before these settings */
|
|
100
|
+
var LEGACY_PANEL_SCALE_KEY = "panelScale";
|
|
101
|
+
function clampStep(step) {
|
|
102
|
+
var n = typeof step === "number" && Number.isFinite(step) ? Math.round(step) : NORMAL_STEP;
|
|
103
|
+
return Math.max(0, Math.min(DISPLAY_STEP_COUNT - 1, n));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** The index of the value in `values` nearest to `value`, measured as a ratio (they are all scales) */
|
|
107
|
+
function nearestIndex(values, value) {
|
|
108
|
+
var best = 0;
|
|
109
|
+
for (var i = 1; i < values.length; i++) {
|
|
110
|
+
if (Math.abs(Math.log(values[i] / value)) < Math.abs(Math.log(values[best] / value))) {
|
|
111
|
+
best = i;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return best;
|
|
115
|
+
}
|
|
116
|
+
function sectionMultiplier(section, settings) {
|
|
117
|
+
return MULTIPLIERS[section][clampStep(settings[section])];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** The animation speed step nearest to a duration multiplier (1 / speed), as `ClientTimeState` keeps it */
|
|
121
|
+
function animationSpeedStep(durationMultiplier) {
|
|
122
|
+
return nearestIndex(ANIMATION_SPEEDS, 1 / (durationMultiplier || 1));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The step every section shares, or undefined when they have been set individually */
|
|
126
|
+
function overallStep(settings) {
|
|
127
|
+
var steps = DISPLAY_SECTIONS.map(function (s) {
|
|
128
|
+
return settings[s.key];
|
|
129
|
+
});
|
|
130
|
+
return steps.every(function (s) {
|
|
131
|
+
return s === steps[0];
|
|
132
|
+
}) ? steps[0] : undefined;
|
|
133
|
+
}
|
|
134
|
+
function allAtStep(step) {
|
|
135
|
+
var result = _objectSpread({}, DEFAULT_DISPLAY_SETTINGS);
|
|
136
|
+
var _iterator = _createForOfIteratorHelper(DISPLAY_SECTIONS),
|
|
137
|
+
_step;
|
|
138
|
+
try {
|
|
139
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
140
|
+
var key = _step.value.key;
|
|
141
|
+
result[key] = clampStep(step);
|
|
142
|
+
}
|
|
143
|
+
} catch (err) {
|
|
144
|
+
_iterator.e(err);
|
|
145
|
+
} finally {
|
|
146
|
+
_iterator.f();
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
function loadDisplaySettings(storage) {
|
|
151
|
+
var result = _objectSpread({}, DEFAULT_DISPLAY_SETTINGS);
|
|
152
|
+
try {
|
|
153
|
+
var _storage$getItem;
|
|
154
|
+
var raw = storage === null || storage === void 0 ? void 0 : storage.getItem(STORAGE_KEY);
|
|
155
|
+
if (raw) {
|
|
156
|
+
var parsed = JSON.parse(raw);
|
|
157
|
+
var _iterator2 = _createForOfIteratorHelper(DISPLAY_SECTIONS),
|
|
158
|
+
_step2;
|
|
159
|
+
try {
|
|
160
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
161
|
+
var key = _step2.value.key;
|
|
162
|
+
result[key] = clampStep(parsed === null || parsed === void 0 ? void 0 : parsed[key]);
|
|
163
|
+
}
|
|
164
|
+
} catch (err) {
|
|
165
|
+
_iterator2.e(err);
|
|
166
|
+
} finally {
|
|
167
|
+
_iterator2.f();
|
|
168
|
+
}
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
var legacyScale = parseFloat((_storage$getItem = storage === null || storage === void 0 ? void 0 : storage.getItem(LEGACY_PANEL_SCALE_KEY)) !== null && _storage$getItem !== void 0 ? _storage$getItem : "");
|
|
172
|
+
if (legacyScale > 0) {
|
|
173
|
+
result.panelLayout = nearestIndex(MULTIPLIERS.panelLayout, legacyScale);
|
|
174
|
+
}
|
|
175
|
+
} catch (_unused) {
|
|
176
|
+
// unreadable storage: everything stays at the game's own sizes
|
|
177
|
+
}
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
function saveDisplaySettings(storage, settings) {
|
|
181
|
+
try {
|
|
182
|
+
storage === null || storage === void 0 || storage.setItem(STORAGE_KEY, JSON.stringify(settings));
|
|
183
|
+
} catch (_unused2) {
|
|
184
|
+
// storage unavailable: the setting lasts until the page closes
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* A copy of `theme` with the sizes that belong to `section` multiplied by the player's setting for
|
|
190
|
+
* it. Returns `theme` itself when the section is at its normal size.
|
|
191
|
+
*/
|
|
192
|
+
function scaledTheme(theme, section, settings) {
|
|
193
|
+
var m = sectionMultiplier(section, settings);
|
|
194
|
+
if (m === 1 || section === "panelLayout") {
|
|
195
|
+
return theme;
|
|
196
|
+
}
|
|
197
|
+
// Copy the fields onto the same prototype, so getters (fontFamily) and methods still work and
|
|
198
|
+
// no setter runs
|
|
199
|
+
var result = Object.assign(Object.create(Object.getPrototypeOf(theme)), theme);
|
|
200
|
+
switch (section) {
|
|
201
|
+
case "panelPadding":
|
|
202
|
+
result.panelSpacing = theme.getPanelSpacing() * m;
|
|
203
|
+
break;
|
|
204
|
+
case "topBar":
|
|
205
|
+
result.topBarHeight = theme.topBarHeight * m;
|
|
206
|
+
result.fontScalar = theme.fontScalar * m;
|
|
207
|
+
result.spacing = theme.spacing * m;
|
|
208
|
+
break;
|
|
209
|
+
case "actionLog":
|
|
210
|
+
result.fontScalar = theme.fontScalar * m;
|
|
211
|
+
result.actionLogSidebarWidth = theme.actionLogSidebarWidth * m;
|
|
212
|
+
break;
|
|
213
|
+
case "bottomBar":
|
|
214
|
+
result.bottomBarHeight = theme.bottomBarHeight * m;
|
|
215
|
+
result.bottomBarFontScalar = theme.bottomBarFontScalar * m;
|
|
216
|
+
result.bottomBarIconSize = theme.bottomBarIconSize * m;
|
|
217
|
+
result.spacing = theme.spacing * m;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const $ReactRefreshModuleId$ = __webpack_require__.$Refresh$.moduleId;
|
|
224
|
+
const $ReactRefreshCurrentExports$ = __react_refresh_utils__.getModuleExports(
|
|
225
|
+
$ReactRefreshModuleId$
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
function $ReactRefreshModuleRuntime$(exports) {
|
|
229
|
+
if (true) {
|
|
230
|
+
let errorOverlay;
|
|
231
|
+
if (typeof __react_refresh_error_overlay__ !== 'undefined') {
|
|
232
|
+
errorOverlay = __react_refresh_error_overlay__;
|
|
233
|
+
}
|
|
234
|
+
let testMode;
|
|
235
|
+
if (typeof __react_refresh_test__ !== 'undefined') {
|
|
236
|
+
testMode = __react_refresh_test__;
|
|
237
|
+
}
|
|
238
|
+
return __react_refresh_utils__.executeRuntime(
|
|
239
|
+
exports,
|
|
240
|
+
$ReactRefreshModuleId$,
|
|
241
|
+
module.hot,
|
|
242
|
+
errorOverlay,
|
|
243
|
+
testMode
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (typeof Promise !== 'undefined' && $ReactRefreshCurrentExports$ instanceof Promise) {
|
|
249
|
+
$ReactRefreshCurrentExports$.then($ReactRefreshModuleRuntime$);
|
|
250
|
+
} else {
|
|
251
|
+
$ReactRefreshModuleRuntime$($ReactRefreshCurrentExports$);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/***/ })
|
|
255
|
+
|
|
256
|
+
},
|
|
257
|
+
/******/ function(__webpack_require__) { // webpackRuntimeModules
|
|
258
|
+
/******/ /* webpack/runtime/getFullHash */
|
|
259
|
+
/******/ (() => {
|
|
260
|
+
/******/ __webpack_require__.h = () => ("bdb9e6ab1d13cf4250e8")
|
|
261
|
+
/******/ })();
|
|
262
|
+
/******/
|
|
263
|
+
/******/ }
|
|
264
|
+
);
|
|
265
|
+
//# sourceMappingURL=main.b5fa8b91f66c4a67740b.hot-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.b5fa8b91f66c4a67740b.hot-update.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;AAGA;;AAGO,IAAMA,kBAAkB,GAAG,CAAC;AAC5B,IAAMC,WAAW,GAAG,CAAC;AACrB,IAAMC,mBAAmB,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC;AAElF,IAAMC,gBAAmG,GAAG,CACjH;EAAEC,GAAG,EAAE,aAAa;EAAEC,KAAK,EAAE,cAAc;EAAEC,WAAW,EAAE,aAAa;EAAEC,UAAU,EAAE;AAAgB,CAAC,EACtG;EAAEH,GAAG,EAAE,cAAc;EAAEC,KAAK,EAAE,eAAe;EAAEC,WAAW,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAU,CAAC,EAC9F;EAAEH,GAAG,EAAE,QAAQ;EAAEC,KAAK,EAAE,SAAS;EAAEC,WAAW,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAS,CAAC,EACjF;EAAEH,GAAG,EAAE,WAAW;EAAEC,KAAK,EAAE,YAAY;EAAEC,WAAW,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAS,CAAC,EACvF;EAAEH,GAAG,EAAE,WAAW;EAAEC,KAAK,EAAE,YAAY;EAAEC,WAAW,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAS,CAAC,CACxF;;AAED;AACA;AACA;AACA;AACA;AACA,IAAMC,WAA6C,GAAG;EACpDC,WAAW,EAAE,CAAC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ACS,UAAU,GAAGR,CAAC;MACxC5B,MAAM,CAACsC,qBAAqB,GAAGX,KAAK,CAACW,qBAAqB,GAAGV,CAAC;MAC9D;IACF,KAAK,WAAW;MACd5B,MAAM,CAACuC,eAAe,GAAGZ,KAAK,CAACY,eAAe,GAAGX,CAAC;MAClD5B,MAAM,CAACwC,mBAAmB,GAAGb,KAAK,CAACa,mBAAmB,GAAGZ,CAAC;MAC1D5B,MAAM,CAACyC,iBAAiB,GAAGd,KAAK,CAACc,iBAAiB,GAAGb,CAAC;MACtD5B,MAAM,CAACqC,OAAO,GAAGV,KAAK,CAACU,OAAO,GAAGT,CAAC;MAClC;EACJ;EACA,OAAO5B,MAAM;AACf,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UCxJA,sD","sources":["webpack://@pretty-chitty/core/./src/library/game/DisplaySettings.ts","webpack://@pretty-chitty/core/webpack/runtime/getFullHash"],"sourcesContent":["import { GameTheme } from \"./GameTheme\";\n\n/** The parts of the match screen a player can size on their own */\nexport type DisplaySection = \"panelLayout\" | \"panelPadding\" | \"topBar\" | \"actionLog\" | \"bottomBar\";\n\n/** A step per section: 0 (smallest) to 4 (biggest), 2 being the game's own theme */\nexport type DisplaySettings = Record<DisplaySection, number>;\n\nexport const DISPLAY_STEP_COUNT = 5;\nexport const NORMAL_STEP = 2;\nexport const DISPLAY_STEP_LABELS = [\"Smallest\", \"Smaller\", \"Normal\", \"Bigger\", \"Biggest\"];\n\nexport const DISPLAY_SECTIONS: { key: DisplaySection; label: string; smallerHint: string; biggerHint: string }[] = [\n { key: \"panelLayout\", label: \"Panel Layout\", smallerHint: \"More panels\", biggerHint: \"Bigger panels\" },\n { key: \"panelPadding\", label: \"Panel Padding\", smallerHint: \"Tighter\", biggerHint: \"Roomier\" },\n { key: \"topBar\", label: \"Top Bar\", smallerHint: \"Smaller\", biggerHint: \"Bigger\" },\n { key: \"actionLog\", label: \"Action Log\", smallerHint: \"Smaller\", biggerHint: \"Bigger\" },\n { key: \"bottomBar\", label: \"Bottom Bar\", smallerHint: \"Smaller\", biggerHint: \"Bigger\" },\n];\n\n/**\n * What each step multiplies the theme's sizes by. Panel layout is the odd one out: it is the scale\n * the layout is worked out at, where a higher scale fits more (smaller) panels on screen, so it\n * runs downwards as the panels get bigger.\n */\nconst MULTIPLIERS: Record<DisplaySection, number[]> = {\n panelLayout: [1.8, 1.35, 1, 0.8, 0.65],\n panelPadding: [0.25, 0.5, 1, 1.75, 2.5],\n topBar: [0.75, 0.875, 1, 1.2, 1.4],\n actionLog: [0.8, 0.9, 1, 1.2, 1.4],\n bottomBar: [0.7, 0.85, 1, 1.15, 1.3],\n};\n\n/**\n * Animation playback speeds, slowest to fastest: one step below normal (the default) and three\n * doublings above it, up to 8x.\n */\nexport const ANIMATION_SPEEDS = [0.5, 1, 2, 4, 8];\n\nexport const DEFAULT_DISPLAY_SETTINGS: DisplaySettings = {\n panelLayout: 4,\n panelPadding: 4,\n topBar: 4,\n actionLog: 4,\n bottomBar: 4,\n};\n\nconst STORAGE_KEY = \"displaySettings\";\n/** The free-form panel scale that came before these settings */\nconst LEGACY_PANEL_SCALE_KEY = \"panelScale\";\n\nfunction clampStep(step: unknown): number {\n const n = typeof step === \"number\" && Number.isFinite(step) ? Math.round(step) : NORMAL_STEP;\n return Math.max(0, Math.min(DISPLAY_STEP_COUNT - 1, n));\n}\n\n/** The index of the value in `values` nearest to `value`, measured as a ratio (they are all scales) */\nfunction nearestIndex(values: number[], value: number): number {\n let best = 0;\n for (let i = 1; i < values.length; i++) {\n if (Math.abs(Math.log(values[i] / value)) < Math.abs(Math.log(values[best] / value))) {\n best = i;\n }\n }\n return best;\n}\n\nexport function sectionMultiplier(section: DisplaySection, settings: DisplaySettings): number {\n return MULTIPLIERS[section][clampStep(settings[section])];\n}\n\n/** The animation speed step nearest to a duration multiplier (1 / speed), as `ClientTimeState` keeps it */\nexport function animationSpeedStep(durationMultiplier: number): number {\n return nearestIndex(ANIMATION_SPEEDS, 1 / (durationMultiplier || 1));\n}\n\n/** The step every section shares, or undefined when they have been set individually */\nexport function overallStep(settings: DisplaySettings): number | undefined {\n const steps = DISPLAY_SECTIONS.map((s) => settings[s.key]);\n return steps.every((s) => s === steps[0]) ? steps[0] : undefined;\n}\n\nexport function allAtStep(step: number): DisplaySettings {\n const result = { ...DEFAULT_DISPLAY_SETTINGS };\n for (const { key } of DISPLAY_SECTIONS) {\n result[key] = clampStep(step);\n }\n return result;\n}\n\nexport function loadDisplaySettings(storage: Pick<Storage, \"getItem\"> | undefined): DisplaySettings {\n const result = { ...DEFAULT_DISPLAY_SETTINGS };\n try {\n const raw = storage?.getItem(STORAGE_KEY);\n if (raw) {\n const parsed = JSON.parse(raw);\n for (const { key } of DISPLAY_SECTIONS) {\n result[key] = clampStep(parsed?.[key]);\n }\n return result;\n }\n const legacyScale = parseFloat(storage?.getItem(LEGACY_PANEL_SCALE_KEY) ?? \"\");\n if (legacyScale > 0) {\n result.panelLayout = nearestIndex(MULTIPLIERS.panelLayout, legacyScale);\n }\n } catch {\n // unreadable storage: everything stays at the game's own sizes\n }\n return result;\n}\n\nexport function saveDisplaySettings(storage: Pick<Storage, \"setItem\"> | undefined, settings: DisplaySettings) {\n try {\n storage?.setItem(STORAGE_KEY, JSON.stringify(settings));\n } catch {\n // storage unavailable: the setting lasts until the page closes\n }\n}\n\n/**\n * A copy of `theme` with the sizes that belong to `section` multiplied by the player's setting for\n * it. Returns `theme` itself when the section is at its normal size.\n */\nexport function scaledTheme(theme: GameTheme, section: DisplaySection, settings: DisplaySettings): GameTheme {\n const m = sectionMultiplier(section, settings);\n if (m === 1 || section === \"panelLayout\") {\n return theme;\n }\n // Copy the fields onto the same prototype, so getters (fontFamily) and methods still work and\n // no setter runs\n const result: GameTheme = Object.assign(Object.create(Object.getPrototypeOf(theme)), theme);\n switch (section) {\n case \"panelPadding\":\n result.panelSpacing = theme.getPanelSpacing() * m;\n break;\n case \"topBar\":\n result.topBarHeight = theme.topBarHeight * m;\n result.fontScalar = theme.fontScalar * m;\n result.spacing = theme.spacing * m;\n break;\n case \"actionLog\":\n result.fontScalar = theme.fontScalar * m;\n result.actionLogSidebarWidth = theme.actionLogSidebarWidth * m;\n break;\n case \"bottomBar\":\n result.bottomBarHeight = theme.bottomBarHeight * m;\n result.bottomBarFontScalar = theme.bottomBarFontScalar * m;\n result.bottomBarIconSize = theme.bottomBarIconSize * m;\n result.spacing = theme.spacing * m;\n break;\n }\n return result;\n}\n","__webpack_require__.h = () => (\"bdb9e6ab1d13cf4250e8\")"],"names":["DISPLAY_STEP_COUNT","NORMAL_STEP","DISPLAY_STEP_LABELS","DISPLAY_SECTIONS","key","label","smallerHint","biggerHint","MULTIPLIERS","panelLayout","panelPadding","topBar","actionLog","bottomBar","ANIMATION_SPEEDS","DEFAULT_DISPLAY_SETTINGS","STORAGE_KEY","LEGACY_PANEL_SCALE_KEY","clampStep","step","n","Number","isFinite","Math","round","max","min","nearestIndex","values","value","best","i","length","abs","log","sectionMultiplier","section","settings","animationSpeedStep","durationMultiplier","overallStep","steps","map","s","every","undefined","allAtStep","result","_objectSpread","_iterator","_createForOfIteratorHelper","_step","done","err","e","f","loadDisplaySettings","storage","_storage$getItem","raw","getItem","parsed","JSON","parse","_iterator2","_step2","legacyScale","parseFloat","_unused","saveDisplaySettings","setItem","stringify","_unused2","scaledTheme","theme","m","Object","assign","create","getPrototypeOf","panelSpacing","getPanelSpacing","topBarHeight","fontScalar","spacing","actionLogSidebarWidth","bottomBarHeight","bottomBarFontScalar","bottomBarIconSize"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"c":["main"],"r":[],"m":[]}
|