@rpgjs/client 5.0.0-alpha.22 → 5.0.0-alpha.24
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/Game/Object.d.ts +2 -0
- package/dist/RpgClientEngine.d.ts +115 -9
- package/dist/components/gui/mobile/index.d.ts +8 -0
- package/dist/components/prebuilt/index.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -8
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index11.js +6 -5
- package/dist/index11.js.map +1 -1
- package/dist/index12.js +2 -2
- package/dist/index13.js +102 -10
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +67 -9
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +10 -263
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +9 -97
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +300 -89
- package/dist/index17.js.map +1 -1
- package/dist/index18.js +63 -80
- package/dist/index18.js.map +1 -1
- package/dist/index19.js +96 -348
- package/dist/index19.js.map +1 -1
- package/dist/index2.js +176 -24
- package/dist/index2.js.map +1 -1
- package/dist/index20.js +360 -17
- package/dist/index20.js.map +1 -1
- package/dist/index21.js +19 -50
- package/dist/index21.js.map +1 -1
- package/dist/index22.js +212 -5
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +6 -395
- package/dist/index23.js.map +1 -1
- package/dist/index24.js +4 -39
- package/dist/index24.js.map +1 -1
- package/dist/index25.js +19 -20
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +43 -2624
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +5 -110
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +394 -65
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +40 -15
- package/dist/index29.js.map +1 -1
- package/dist/index3.js +3 -3
- package/dist/index30.js +21 -23
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +2624 -86
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +107 -34
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +69 -22
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +19 -3
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +21 -329
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +91 -30
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +37 -7
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +22 -9
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +139 -10
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +3 -3
- package/dist/index40.js +16 -6
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +1 -325
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +530 -3680
- package/dist/index42.js.map +1 -1
- package/dist/index43.js +24 -67
- package/dist/index43.js.map +1 -1
- package/dist/index44.js +9 -184
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +6 -503
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +325 -2
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +3687 -17
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +69 -202
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +182 -7
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/index50.js +497 -106
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +48 -130
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +17 -134
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +3 -109
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +9 -138
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +111 -7
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +130 -48
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +137 -0
- package/dist/index57.js.map +1 -0
- package/dist/index58.js +112 -0
- package/dist/index58.js.map +1 -0
- package/dist/index59.js +9 -0
- package/dist/index59.js.map +1 -0
- package/dist/index6.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/index8.js +17 -2
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +10 -27
- package/dist/index9.js.map +1 -1
- package/dist/services/keyboardControls.d.ts +1 -2
- package/dist/services/mmorpg.d.ts +1 -1
- package/dist/services/standalone.d.ts +1 -1
- package/package.json +9 -9
- package/src/Game/Object.ts +8 -0
- package/src/Gui/Gui.ts +4 -31
- package/src/RpgClientEngine.ts +193 -20
- package/src/components/character.ce +146 -9
- package/src/components/gui/mobile/index.ts +24 -0
- package/src/components/gui/mobile/mobile.ce +80 -0
- package/src/components/prebuilt/index.ts +1 -0
- package/src/components/prebuilt/light-halo.ce +148 -0
- package/src/components/scenes/canvas.ce +2 -2
- package/src/components/scenes/event-layer.ce +1 -0
- package/src/components/scenes/transition.ce +60 -0
- package/src/index.ts +6 -1
- package/src/module.ts +15 -0
- package/src/services/keyboardControls.ts +1 -1
package/dist/index50.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index50.js","sources":["../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js"],"sourcesContent":["import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n"],"names":["defaultErrorMap"],"mappings":";;;AAEY,MAAC,SAAS,GAAG,CAAC,MAAM,KAAK;AACrC,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM;AACvD,IAAI,MA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W,MAAC,KAAK,GAAG,CAAC,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;AAC/C,MAAC,EAAE,GAAG,CAAC,KAAK,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;AAC5C,MAAC,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK;AACjC,MAAC,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK;AAC/B,MAAC,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK;AAC/B,MAAC,OAAO,GAAG,CAAC,CAAC,KAAK,OAAO,OAAO,KAAK,WAAW,IAAI,CAAC,YAAY;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index50.js","sources":["../../../node_modules/.pnpm/partysocket@1.1.5/node_modules/partysocket/dist/chunk-ZCZZNAX5.mjs"],"sourcesContent":["// src/ws.ts\nif (!globalThis.EventTarget || !globalThis.Event) {\n console.error(`\n PartySocket requires a global 'EventTarget' class to be available!\n You can polyfill this global by adding this to your code before any partysocket imports: \n \n \\`\\`\\`\n import 'partysocket/event-target-polyfill';\n \\`\\`\\`\n Please file an issue at https://github.com/partykit/partykit if you're still having trouble.\n`);\n}\nvar ErrorEvent = class extends Event {\n message;\n error;\n // biome-ignore lint/suspicious/noExplicitAny: vibes\n constructor(error, target) {\n super(\"error\", target);\n this.message = error.message;\n this.error = error;\n }\n};\nvar CloseEvent = class extends Event {\n code;\n reason;\n wasClean = true;\n // biome-ignore lint/style/useDefaultParameterLast: legacy\n // biome-ignore lint/suspicious/noExplicitAny: legacy\n constructor(code = 1e3, reason = \"\", target) {\n super(\"close\", target);\n this.code = code;\n this.reason = reason;\n }\n};\nvar Events = {\n Event,\n ErrorEvent,\n CloseEvent\n};\nfunction assert(condition, msg) {\n if (!condition) {\n throw new Error(msg);\n }\n}\nfunction cloneEventBrowser(e) {\n return new e.constructor(e.type, e);\n}\nfunction cloneEventNode(e) {\n if (\"data\" in e) {\n const evt2 = new MessageEvent(e.type, e);\n return evt2;\n }\n if (\"code\" in e || \"reason\" in e) {\n const evt2 = new CloseEvent(\n // @ts-expect-error we need to fix event/listener types\n e.code || 1999,\n // @ts-expect-error we need to fix event/listener types\n e.reason || \"unknown reason\",\n e\n );\n return evt2;\n }\n if (\"error\" in e) {\n const evt2 = new ErrorEvent(e.error, e);\n return evt2;\n }\n const evt = new Event(e.type, e);\n return evt;\n}\nvar _a;\nvar isNode =\n typeof process !== \"undefined\" &&\n typeof ((_a = process.versions) == null ? void 0 : _a.node) !== \"undefined\" &&\n typeof document === \"undefined\";\nvar cloneEvent = isNode ? cloneEventNode : cloneEventBrowser;\nvar DEFAULT = {\n maxReconnectionDelay: 1e4,\n minReconnectionDelay: 1e3 + Math.random() * 4e3,\n minUptime: 5e3,\n reconnectionDelayGrowFactor: 1.3,\n connectionTimeout: 4e3,\n maxRetries: Number.POSITIVE_INFINITY,\n maxEnqueuedMessages: Number.POSITIVE_INFINITY,\n startClosed: false,\n debug: false\n};\nvar didWarnAboutMissingWebSocket = false;\nvar ReconnectingWebSocket = class _ReconnectingWebSocket extends EventTarget {\n _ws;\n _retryCount = -1;\n _uptimeTimeout;\n _connectTimeout;\n _shouldReconnect = true;\n _connectLock = false;\n _binaryType = \"blob\";\n _closeCalled = false;\n _messageQueue = [];\n _debugLogger = console.log.bind(console);\n _url;\n _protocols;\n _options;\n constructor(url, protocols, options = {}) {\n super();\n this._url = url;\n this._protocols = protocols;\n this._options = options;\n if (this._options.startClosed) {\n this._shouldReconnect = false;\n }\n if (this._options.debugLogger) {\n this._debugLogger = this._options.debugLogger;\n }\n this._connect();\n }\n static get CONNECTING() {\n return 0;\n }\n static get OPEN() {\n return 1;\n }\n static get CLOSING() {\n return 2;\n }\n static get CLOSED() {\n return 3;\n }\n get CONNECTING() {\n return _ReconnectingWebSocket.CONNECTING;\n }\n get OPEN() {\n return _ReconnectingWebSocket.OPEN;\n }\n get CLOSING() {\n return _ReconnectingWebSocket.CLOSING;\n }\n get CLOSED() {\n return _ReconnectingWebSocket.CLOSED;\n }\n get binaryType() {\n return this._ws ? this._ws.binaryType : this._binaryType;\n }\n set binaryType(value) {\n this._binaryType = value;\n if (this._ws) {\n this._ws.binaryType = value;\n }\n }\n /**\n * Returns the number or connection retries\n */\n get retryCount() {\n return Math.max(this._retryCount, 0);\n }\n /**\n * The number of bytes of data that have been queued using calls to send() but not yet\n * transmitted to the network. This value resets to zero once all queued data has been sent.\n * This value does not reset to zero when the connection is closed; if you keep calling send(),\n * this will continue to climb. Read only\n */\n get bufferedAmount() {\n const bytes = this._messageQueue.reduce((acc, message) => {\n if (typeof message === \"string\") {\n acc += message.length;\n } else if (message instanceof Blob) {\n acc += message.size;\n } else {\n acc += message.byteLength;\n }\n return acc;\n }, 0);\n return bytes + (this._ws ? this._ws.bufferedAmount : 0);\n }\n /**\n * The extensions selected by the server. This is currently only the empty string or a list of\n * extensions as negotiated by the connection\n */\n get extensions() {\n return this._ws ? this._ws.extensions : \"\";\n }\n /**\n * A string indicating the name of the sub-protocol the server selected;\n * this will be one of the strings specified in the protocols parameter when creating the\n * WebSocket object\n */\n get protocol() {\n return this._ws ? this._ws.protocol : \"\";\n }\n /**\n * The current state of the connection; this is one of the Ready state constants\n */\n get readyState() {\n if (this._ws) {\n return this._ws.readyState;\n }\n return this._options.startClosed\n ? _ReconnectingWebSocket.CLOSED\n : _ReconnectingWebSocket.CONNECTING;\n }\n /**\n * The URL as resolved by the constructor\n */\n get url() {\n return this._ws ? this._ws.url : \"\";\n }\n /**\n * Whether the websocket object is now in reconnectable state\n */\n get shouldReconnect() {\n return this._shouldReconnect;\n }\n /**\n * An event listener to be called when the WebSocket connection's readyState changes to CLOSED\n */\n onclose = null;\n /**\n * An event listener to be called when an error occurs\n */\n onerror = null;\n /**\n * An event listener to be called when a message is received from the server\n */\n onmessage = null;\n /**\n * An event listener to be called when the WebSocket connection's readyState changes to OPEN;\n * this indicates that the connection is ready to send and receive data\n */\n onopen = null;\n /**\n * Closes the WebSocket connection or connection attempt, if any. If the connection is already\n * CLOSED, this method does nothing\n */\n close(code = 1e3, reason) {\n this._closeCalled = true;\n this._shouldReconnect = false;\n this._clearTimeouts();\n if (!this._ws) {\n this._debug(\"close enqueued: no ws instance\");\n return;\n }\n if (this._ws.readyState === this.CLOSED) {\n this._debug(\"close: already closed\");\n return;\n }\n this._ws.close(code, reason);\n }\n /**\n * Closes the WebSocket connection or connection attempt and connects again.\n * Resets retry counter;\n */\n reconnect(code, reason) {\n this._shouldReconnect = true;\n this._closeCalled = false;\n this._retryCount = -1;\n if (!this._ws || this._ws.readyState === this.CLOSED) {\n this._connect();\n } else {\n this._disconnect(code, reason);\n this._connect();\n }\n }\n /**\n * Enqueue specified data to be transmitted to the server over the WebSocket connection\n */\n send(data) {\n if (this._ws && this._ws.readyState === this.OPEN) {\n this._debug(\"send\", data);\n this._ws.send(data);\n } else {\n const { maxEnqueuedMessages = DEFAULT.maxEnqueuedMessages } =\n this._options;\n if (this._messageQueue.length < maxEnqueuedMessages) {\n this._debug(\"enqueue\", data);\n this._messageQueue.push(data);\n }\n }\n }\n _debug(...args) {\n if (this._options.debug) {\n this._debugLogger(\"RWS>\", ...args);\n }\n }\n _getNextDelay() {\n const {\n reconnectionDelayGrowFactor = DEFAULT.reconnectionDelayGrowFactor,\n minReconnectionDelay = DEFAULT.minReconnectionDelay,\n maxReconnectionDelay = DEFAULT.maxReconnectionDelay\n } = this._options;\n let delay = 0;\n if (this._retryCount > 0) {\n delay =\n minReconnectionDelay *\n reconnectionDelayGrowFactor ** (this._retryCount - 1);\n if (delay > maxReconnectionDelay) {\n delay = maxReconnectionDelay;\n }\n }\n this._debug(\"next delay\", delay);\n return delay;\n }\n _wait() {\n return new Promise((resolve) => {\n setTimeout(resolve, this._getNextDelay());\n });\n }\n _getNextProtocols(protocolsProvider) {\n if (!protocolsProvider) return Promise.resolve(null);\n if (\n typeof protocolsProvider === \"string\" ||\n Array.isArray(protocolsProvider)\n ) {\n return Promise.resolve(protocolsProvider);\n }\n if (typeof protocolsProvider === \"function\") {\n const protocols = protocolsProvider();\n if (!protocols) return Promise.resolve(null);\n if (typeof protocols === \"string\" || Array.isArray(protocols)) {\n return Promise.resolve(protocols);\n }\n if (protocols.then) {\n return protocols;\n }\n }\n throw Error(\"Invalid protocols\");\n }\n _getNextUrl(urlProvider) {\n if (typeof urlProvider === \"string\") {\n return Promise.resolve(urlProvider);\n }\n if (typeof urlProvider === \"function\") {\n const url = urlProvider();\n if (typeof url === \"string\") {\n return Promise.resolve(url);\n }\n if (url.then) {\n return url;\n }\n }\n throw Error(\"Invalid URL\");\n }\n _connect() {\n if (this._connectLock || !this._shouldReconnect) {\n return;\n }\n this._connectLock = true;\n const {\n maxRetries = DEFAULT.maxRetries,\n connectionTimeout = DEFAULT.connectionTimeout\n } = this._options;\n if (this._retryCount >= maxRetries) {\n this._debug(\"max retries reached\", this._retryCount, \">=\", maxRetries);\n return;\n }\n this._retryCount++;\n this._debug(\"connect\", this._retryCount);\n this._removeListeners();\n this._wait()\n .then(() =>\n Promise.all([\n this._getNextUrl(this._url),\n this._getNextProtocols(this._protocols || null)\n ])\n )\n .then(([url, protocols]) => {\n if (this._closeCalled) {\n this._connectLock = false;\n return;\n }\n if (\n !this._options.WebSocket &&\n typeof WebSocket === \"undefined\" &&\n !didWarnAboutMissingWebSocket\n ) {\n console.error(`\\u203C\\uFE0F No WebSocket implementation available. You should define options.WebSocket. \n\nFor example, if you're using node.js, run \\`npm install ws\\`, and then in your code:\n\nimport PartySocket from 'partysocket';\nimport WS from 'ws';\n\nconst partysocket = new PartySocket({\n host: \"127.0.0.1:1999\",\n room: \"test-room\",\n WebSocket: WS\n});\n\n`);\n didWarnAboutMissingWebSocket = true;\n }\n const WS = this._options.WebSocket || WebSocket;\n this._debug(\"connect\", { url, protocols });\n this._ws = protocols ? new WS(url, protocols) : new WS(url);\n this._ws.binaryType = this._binaryType;\n this._connectLock = false;\n this._addListeners();\n this._connectTimeout = setTimeout(\n () => this._handleTimeout(),\n connectionTimeout\n );\n })\n .catch((err) => {\n this._connectLock = false;\n this._handleError(new Events.ErrorEvent(Error(err.message), this));\n });\n }\n _handleTimeout() {\n this._debug(\"timeout event\");\n this._handleError(new Events.ErrorEvent(Error(\"TIMEOUT\"), this));\n }\n _disconnect(code = 1e3, reason) {\n this._clearTimeouts();\n if (!this._ws) {\n return;\n }\n this._removeListeners();\n try {\n if (\n this._ws.readyState === this.OPEN ||\n this._ws.readyState === this.CONNECTING\n ) {\n this._ws.close(code, reason);\n }\n this._handleClose(new Events.CloseEvent(code, reason, this));\n } catch (error) {}\n }\n _acceptOpen() {\n this._debug(\"accept open\");\n this._retryCount = 0;\n }\n _handleOpen = (event) => {\n this._debug(\"open event\");\n const { minUptime = DEFAULT.minUptime } = this._options;\n clearTimeout(this._connectTimeout);\n this._uptimeTimeout = setTimeout(() => this._acceptOpen(), minUptime);\n assert(this._ws, \"WebSocket is not defined\");\n this._ws.binaryType = this._binaryType;\n this._messageQueue.forEach((message) => {\n var _a2;\n return (_a2 = this._ws) == null ? void 0 : _a2.send(message);\n });\n this._messageQueue = [];\n if (this.onopen) {\n this.onopen(event);\n }\n this.dispatchEvent(cloneEvent(event));\n };\n _handleMessage = (event) => {\n this._debug(\"message event\");\n if (this.onmessage) {\n this.onmessage(event);\n }\n this.dispatchEvent(cloneEvent(event));\n };\n _handleError = (event) => {\n this._debug(\"error event\", event.message);\n this._disconnect(void 0, event.message === \"TIMEOUT\" ? \"timeout\" : void 0);\n if (this.onerror) {\n this.onerror(event);\n }\n this._debug(\"exec error listeners\");\n this.dispatchEvent(cloneEvent(event));\n this._connect();\n };\n _handleClose = (event) => {\n this._debug(\"close event\");\n this._clearTimeouts();\n if (this._shouldReconnect) {\n this._connect();\n }\n if (this.onclose) {\n this.onclose(event);\n }\n this.dispatchEvent(cloneEvent(event));\n };\n _removeListeners() {\n if (!this._ws) {\n return;\n }\n this._debug(\"removeListeners\");\n this._ws.removeEventListener(\"open\", this._handleOpen);\n this._ws.removeEventListener(\"close\", this._handleClose);\n this._ws.removeEventListener(\"message\", this._handleMessage);\n this._ws.removeEventListener(\"error\", this._handleError);\n }\n _addListeners() {\n if (!this._ws) {\n return;\n }\n this._debug(\"addListeners\");\n this._ws.addEventListener(\"open\", this._handleOpen);\n this._ws.addEventListener(\"close\", this._handleClose);\n this._ws.addEventListener(\"message\", this._handleMessage);\n this._ws.addEventListener(\"error\", this._handleError);\n }\n _clearTimeouts() {\n clearTimeout(this._connectTimeout);\n clearTimeout(this._uptimeTimeout);\n }\n};\n\nexport { ErrorEvent, CloseEvent, ReconnectingWebSocket };\n/*!\n * Reconnecting WebSocket\n * by Pedro Ladaria <pedro.ladaria@gmail.com>\n * https://github.com/pladaria/reconnecting-websocket\n * License MIT\n */\n//# sourceMappingURL=chunk-ZCZZNAX5.mjs.map\n"],"names":[],"mappings":"AAAA;AACA,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE;AAClD,EAAE,OAAO,CAAC,KAAK,CAAC;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC;AACF;AACG,IAAC,UAAU,GAAG,cAAc,KAAK,CAAC;AACrC,EAAE,OAAO;AACT,EAAE,KAAK;AACP;AACA,EAAE,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE;AAC7B,IAAI,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC;AAC1B,IAAI,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO;AAChC,IAAI,IAAI,CAAC,KAAK,GAAG,KAAK;AACtB,EAAE;AACF;AACG,IAAC,UAAU,GAAG,cAAc,KAAK,CAAC;AACrC,EAAE,IAAI;AACN,EAAE,MAAM;AACR,EAAE,QAAQ,GAAG,IAAI;AACjB;AACA;AACA,EAAE,WAAW,CAAC,IAAI,GAAG,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,EAAE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|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return keys;
|
|
40
|
-
};
|
|
41
|
-
util.find = (arr, checker) => {
|
|
42
|
-
for (const item of arr) {
|
|
43
|
-
if (checker(item))
|
|
44
|
-
return item;
|
|
1
|
+
import { computed } from 'canvasengine';
|
|
2
|
+
|
|
3
|
+
const parseDynamicValue = (value, object) => {
|
|
4
|
+
if (typeof value !== "string") {
|
|
5
|
+
return computed(() => String(value ?? ""));
|
|
6
|
+
}
|
|
7
|
+
const pattern = /\{([^}]+)\}/g;
|
|
8
|
+
const matches = [];
|
|
9
|
+
let match;
|
|
10
|
+
while ((match = pattern.exec(value)) !== null) {
|
|
11
|
+
matches.push({
|
|
12
|
+
property: match[1],
|
|
13
|
+
fullMatch: match[0],
|
|
14
|
+
index: match.index
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
if (matches.length === 0) {
|
|
18
|
+
return computed(() => value);
|
|
19
|
+
}
|
|
20
|
+
return computed(() => {
|
|
21
|
+
let result = value;
|
|
22
|
+
for (let i = matches.length - 1; i >= 0; i--) {
|
|
23
|
+
const { property, fullMatch } = matches[i];
|
|
24
|
+
let propertyValue = "";
|
|
25
|
+
try {
|
|
26
|
+
const propertyPath = property.split(".");
|
|
27
|
+
let currentValue = object;
|
|
28
|
+
for (let j = 0; j < propertyPath.length; j++) {
|
|
29
|
+
const prop = propertyPath[j];
|
|
30
|
+
if (typeof currentValue === "function") {
|
|
31
|
+
currentValue = currentValue();
|
|
32
|
+
}
|
|
33
|
+
if (currentValue && typeof currentValue === "object" && prop in currentValue) {
|
|
34
|
+
currentValue = currentValue[prop];
|
|
35
|
+
} else {
|
|
36
|
+
currentValue = void 0;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
45
39
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
util.isInteger = typeof Number.isInteger === "function"
|
|
49
|
-
? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
|
|
50
|
-
: (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
51
|
-
function joinValues(array, separator = " | ") {
|
|
52
|
-
return array.map((val) => (typeof val === "string" ? `'${val}'` : val)).join(separator);
|
|
53
|
-
}
|
|
54
|
-
util.joinValues = joinValues;
|
|
55
|
-
util.jsonStringifyReplacer = (_, value) => {
|
|
56
|
-
if (typeof value === "bigint") {
|
|
57
|
-
return value.toString();
|
|
40
|
+
if (typeof currentValue === "function") {
|
|
41
|
+
currentValue = currentValue();
|
|
58
42
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(
|
|
64
|
-
objectUtil.mergeShapes = (first, second) => {
|
|
65
|
-
return {
|
|
66
|
-
...first,
|
|
67
|
-
...second, // second overwrites first
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
})(objectUtil || (objectUtil = {}));
|
|
71
|
-
const ZodParsedType = util.arrayToEnum([
|
|
72
|
-
"string",
|
|
73
|
-
"nan",
|
|
74
|
-
"number",
|
|
75
|
-
"integer",
|
|
76
|
-
"float",
|
|
77
|
-
"boolean",
|
|
78
|
-
"date",
|
|
79
|
-
"bigint",
|
|
80
|
-
"symbol",
|
|
81
|
-
"function",
|
|
82
|
-
"undefined",
|
|
83
|
-
"null",
|
|
84
|
-
"array",
|
|
85
|
-
"object",
|
|
86
|
-
"unknown",
|
|
87
|
-
"promise",
|
|
88
|
-
"void",
|
|
89
|
-
"never",
|
|
90
|
-
"map",
|
|
91
|
-
"set",
|
|
92
|
-
]);
|
|
93
|
-
const getParsedType = (data) => {
|
|
94
|
-
const t = typeof data;
|
|
95
|
-
switch (t) {
|
|
96
|
-
case "undefined":
|
|
97
|
-
return ZodParsedType.undefined;
|
|
98
|
-
case "string":
|
|
99
|
-
return ZodParsedType.string;
|
|
100
|
-
case "number":
|
|
101
|
-
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
102
|
-
case "boolean":
|
|
103
|
-
return ZodParsedType.boolean;
|
|
104
|
-
case "function":
|
|
105
|
-
return ZodParsedType.function;
|
|
106
|
-
case "bigint":
|
|
107
|
-
return ZodParsedType.bigint;
|
|
108
|
-
case "symbol":
|
|
109
|
-
return ZodParsedType.symbol;
|
|
110
|
-
case "object":
|
|
111
|
-
if (Array.isArray(data)) {
|
|
112
|
-
return ZodParsedType.array;
|
|
113
|
-
}
|
|
114
|
-
if (data === null) {
|
|
115
|
-
return ZodParsedType.null;
|
|
116
|
-
}
|
|
117
|
-
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
|
118
|
-
return ZodParsedType.promise;
|
|
119
|
-
}
|
|
120
|
-
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
121
|
-
return ZodParsedType.map;
|
|
122
|
-
}
|
|
123
|
-
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
124
|
-
return ZodParsedType.set;
|
|
125
|
-
}
|
|
126
|
-
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
127
|
-
return ZodParsedType.date;
|
|
128
|
-
}
|
|
129
|
-
return ZodParsedType.object;
|
|
130
|
-
default:
|
|
131
|
-
return ZodParsedType.unknown;
|
|
43
|
+
propertyValue = currentValue != null ? String(currentValue) : "";
|
|
44
|
+
} catch (error) {
|
|
45
|
+
propertyValue = "";
|
|
46
|
+
}
|
|
47
|
+
result = result.replace(fullMatch, propertyValue);
|
|
132
48
|
}
|
|
49
|
+
return result;
|
|
50
|
+
});
|
|
133
51
|
};
|
|
134
52
|
|
|
135
|
-
export {
|
|
53
|
+
export { parseDynamicValue };
|
|
136
54
|
//# sourceMappingURL=index51.js.map
|
package/dist/index51.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index51.js","sources":["
|
|
1
|
+
{"version":3,"file":"index51.js","sources":["../src/components/dynamics/parse-value.ts"],"sourcesContent":["import { computed } from \"canvasengine\";\n\ninterface MatchResult {\n property: string;\n fullMatch: string;\n index: number;\n}\n\nexport const parseDynamicValue = (value: any, object?: any) => {\n if (typeof value !== 'string') {\n return computed(() => String(value ?? ''));\n }\n\n // Find all dynamic references like {propertyName}\n const pattern = /\\{([^}]+)\\}/g;\n const matches: MatchResult[] = [];\n let match;\n \n while ((match = pattern.exec(value)) !== null) {\n matches.push({\n property: match[1],\n fullMatch: match[0],\n index: match.index!\n });\n }\n\n // If no dynamic references found, return simple computed\n if (matches.length === 0) {\n return computed(() => value);\n }\n\n // Create computed that tracks all referenced signals\n return computed(() => {\n let result = value;\n \n // Replace from end to start to preserve indices\n for (let i = matches.length - 1; i >= 0; i--) {\n const { property, fullMatch } = matches[i];\n \n // Try to access the property from the object\n // Support nested properties like {param.maxHp}\n let propertyValue = '';\n try {\n const propertyPath = property.split('.');\n let currentValue = object;\n \n for (let j = 0; j < propertyPath.length; j++) {\n const prop = propertyPath[j];\n \n // Check if currentValue is a signal (function) and call it\n if (typeof currentValue === 'function') {\n currentValue = currentValue();\n }\n \n // Access the property\n if (currentValue && typeof currentValue === 'object' && prop in currentValue) {\n currentValue = currentValue[prop];\n } else {\n currentValue = undefined;\n break;\n }\n }\n \n // If the final value is a signal, call it\n if (typeof currentValue === 'function') {\n currentValue = currentValue();\n }\n \n propertyValue = currentValue != null ? String(currentValue) : '';\n } catch (error) {\n // If property doesn't exist or can't be accessed, use empty string\n propertyValue = '';\n }\n \n result = result.replace(fullMatch, propertyValue);\n }\n \n return result;\n });\n};\n"],"names":[],"mappings":";;AAQO,MAAM,iBAAA,GAAoB,CAAC,KAAA,EAAY,MAAA,KAAiB;AAC3D,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC3B,IAAA,OAAO,QAAA,CAA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AA,IAAY,QAAQ,YAAA,EAAc;AAC1E,YAAA,YAAA,GAAe,aAAa,IAAI,CAAA;AAAA,UACpC,CAAA,MAAO;AACH,YAAA,YAAA,GAAe,KAAA,CAAA;AACf,YAAA;AAAA,UACJ;AAAA,QACJ;AAGA,QAAA,IAAI,OAAO,iBAAiB,UAAA,EAAY;AACpC,UAAA,YAAA,GAAe,YAAA,EAAa;AAAA,QAChC;AAEA,QAAA,aAAA,GAAgB,YAAA,IAAgB,IAAA,GAAO,MAAA,CAAO,YAAY,CAAA,GAAI,EAAA;AAAA,MAClE,SAAS,KAAA,EAAO;AAEZ,QAAA,aAAA,GAAgB,EAAA;AAAA,MACpB;AAEA,MAAA,MAAA,GAAS,MAAA,CAAO,OAAA,CAAQ,SAAA,EAAW,aAAa,CAAA;AAAA,IACpD;AAEA,IAAA,OAAO,MAAA;AAAA,EACX,CAAC,CAAA;AACL;;;;"}
|
package/dist/index52.js
CHANGED
|
@@ -1,137 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useProps, useDefineProps, animatedSignal, h, Container, Rect, Text } from 'canvasengine';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"not_multiple_of",
|
|
19
|
-
"not_finite",
|
|
20
|
-
]);
|
|
21
|
-
const quotelessJson = (obj) => {
|
|
22
|
-
const json = JSON.stringify(obj, null, 2);
|
|
23
|
-
return json.replace(/"([^"]+)":/g, "$1:");
|
|
24
|
-
};
|
|
25
|
-
class ZodError extends Error {
|
|
26
|
-
get errors() {
|
|
27
|
-
return this.issues;
|
|
28
|
-
}
|
|
29
|
-
constructor(issues) {
|
|
30
|
-
super();
|
|
31
|
-
this.issues = [];
|
|
32
|
-
this.addIssue = (sub) => {
|
|
33
|
-
this.issues = [...this.issues, sub];
|
|
34
|
-
};
|
|
35
|
-
this.addIssues = (subs = []) => {
|
|
36
|
-
this.issues = [...this.issues, ...subs];
|
|
37
|
-
};
|
|
38
|
-
const actualProto = new.target.prototype;
|
|
39
|
-
if (Object.setPrototypeOf) {
|
|
40
|
-
// eslint-disable-next-line ban/ban
|
|
41
|
-
Object.setPrototypeOf(this, actualProto);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
this.__proto__ = actualProto;
|
|
45
|
-
}
|
|
46
|
-
this.name = "ZodError";
|
|
47
|
-
this.issues = issues;
|
|
48
|
-
}
|
|
49
|
-
format(_mapper) {
|
|
50
|
-
const mapper = _mapper ||
|
|
51
|
-
function (issue) {
|
|
52
|
-
return issue.message;
|
|
53
|
-
};
|
|
54
|
-
const fieldErrors = { _errors: [] };
|
|
55
|
-
const processError = (error) => {
|
|
56
|
-
for (const issue of error.issues) {
|
|
57
|
-
if (issue.code === "invalid_union") {
|
|
58
|
-
issue.unionErrors.map(processError);
|
|
59
|
-
}
|
|
60
|
-
else if (issue.code === "invalid_return_type") {
|
|
61
|
-
processError(issue.returnTypeError);
|
|
62
|
-
}
|
|
63
|
-
else if (issue.code === "invalid_arguments") {
|
|
64
|
-
processError(issue.argumentsError);
|
|
65
|
-
}
|
|
66
|
-
else if (issue.path.length === 0) {
|
|
67
|
-
fieldErrors._errors.push(mapper(issue));
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
let curr = fieldErrors;
|
|
71
|
-
let i = 0;
|
|
72
|
-
while (i < issue.path.length) {
|
|
73
|
-
const el = issue.path[i];
|
|
74
|
-
const terminal = i === issue.path.length - 1;
|
|
75
|
-
if (!terminal) {
|
|
76
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
77
|
-
// if (typeof el === "string") {
|
|
78
|
-
// curr[el] = curr[el] || { _errors: [] };
|
|
79
|
-
// } else if (typeof el === "number") {
|
|
80
|
-
// const errorArray: any = [];
|
|
81
|
-
// errorArray._errors = [];
|
|
82
|
-
// curr[el] = curr[el] || errorArray;
|
|
83
|
-
// }
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
87
|
-
curr[el]._errors.push(mapper(issue));
|
|
88
|
-
}
|
|
89
|
-
curr = curr[el];
|
|
90
|
-
i++;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
processError(this);
|
|
96
|
-
return fieldErrors;
|
|
97
|
-
}
|
|
98
|
-
static assert(value) {
|
|
99
|
-
if (!(value instanceof ZodError)) {
|
|
100
|
-
throw new Error(`Not a ZodError: ${value}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
toString() {
|
|
104
|
-
return this.message;
|
|
105
|
-
}
|
|
106
|
-
get message() {
|
|
107
|
-
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
108
|
-
}
|
|
109
|
-
get isEmpty() {
|
|
110
|
-
return this.issues.length === 0;
|
|
111
|
-
}
|
|
112
|
-
flatten(mapper = (issue) => issue.message) {
|
|
113
|
-
const fieldErrors = {};
|
|
114
|
-
const formErrors = [];
|
|
115
|
-
for (const sub of this.issues) {
|
|
116
|
-
if (sub.path.length > 0) {
|
|
117
|
-
const firstEl = sub.path[0];
|
|
118
|
-
fieldErrors[firstEl] = fieldErrors[firstEl] || [];
|
|
119
|
-
fieldErrors[firstEl].push(mapper(sub));
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
formErrors.push(mapper(sub));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return { formErrors, fieldErrors };
|
|
126
|
-
}
|
|
127
|
-
get formErrors() {
|
|
128
|
-
return this.flatten();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
ZodError.create = (issues) => {
|
|
132
|
-
const error = new ZodError(issues);
|
|
133
|
-
return error;
|
|
134
|
-
};
|
|
3
|
+
function component($$props) {
|
|
4
|
+
useProps($$props);
|
|
5
|
+
const defineProps = useDefineProps($$props);
|
|
6
|
+
var _a = defineProps(), text = _a.text, isSelected = _a.isSelected;
|
|
7
|
+
var alpha = animatedSignal(1, {
|
|
8
|
+
repeatType: "reverse",
|
|
9
|
+
duration: 500,
|
|
10
|
+
repeat: Infinity,
|
|
11
|
+
});
|
|
12
|
+
alpha.set(0.5);
|
|
13
|
+
var height = 40;
|
|
14
|
+
var width = 256;
|
|
15
|
+
let $this = h(Container, null, [h(Rect, { width, height, color: '#595971', alpha, visible: isSelected }), h(Container, { flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }, h(Text, { text, color: '#fff', fontSize: 18, margin: 10 }))]);
|
|
16
|
+
return $this
|
|
17
|
+
}
|
|
135
18
|
|
|
136
|
-
export {
|
|
19
|
+
export { component as default };
|
|
137
20
|
//# sourceMappingURL=index52.js.map
|
package/dist/index52.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index52.js","sources":["
|
|
1
|
+
{"version":3,"file":"index52.js","sources":["../src/components/gui/dialogbox/itemMenu.ce"],"sourcesContent":["<Container>\n <Rect width height color=\"#595971\" alpha visible={isSelected} />\n <Container flexDirection=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <Text text color=\"#fff\" fontSize={18} margin={10} />\n </Container>\n</Container>\n\n<script>\nimport { animatedSignal } from \"canvasengine\";\n\nconst { text, isSelected } = defineProps();\n\nconst alpha = animatedSignal(1, {\n repeatType: \"reverse\",\n duration: 500,\n repeat: Infinity,\n});\n\nalpha.set(0.5);\n\nconst height = 40;\nconst width = 256;\n</script>"],"names":[],"mappings":";;AAQqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU;AAC1E,IAAI,KAAK,GAAG,cAAc,CAAC,CAAC,EAAE;AAC9B,IAAI,UAAU,EAAE,SAAS;AACzB,IAAI,QAAQ,EAAE,GAAG;AACjB,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC,CAAC;AACF,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AACd,IAAI,MAAM,GAAG,EAAE;AACf,IAAI,KAAK,GAAG,GAAG;AACf,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACrQ,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index53.js
CHANGED
|
@@ -1,112 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { util, ZodParsedType } from './index51.js';
|
|
1
|
+
import * as external from './index45.js';
|
|
3
2
|
|
|
4
|
-
const errorMap = (issue, _ctx) => {
|
|
5
|
-
let message;
|
|
6
|
-
switch (issue.code) {
|
|
7
|
-
case ZodIssueCode.invalid_type:
|
|
8
|
-
if (issue.received === ZodParsedType.undefined) {
|
|
9
|
-
message = "Required";
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
13
|
-
}
|
|
14
|
-
break;
|
|
15
|
-
case ZodIssueCode.invalid_literal:
|
|
16
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
17
|
-
break;
|
|
18
|
-
case ZodIssueCode.unrecognized_keys:
|
|
19
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
20
|
-
break;
|
|
21
|
-
case ZodIssueCode.invalid_union:
|
|
22
|
-
message = `Invalid input`;
|
|
23
|
-
break;
|
|
24
|
-
case ZodIssueCode.invalid_union_discriminator:
|
|
25
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
26
|
-
break;
|
|
27
|
-
case ZodIssueCode.invalid_enum_value:
|
|
28
|
-
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
29
|
-
break;
|
|
30
|
-
case ZodIssueCode.invalid_arguments:
|
|
31
|
-
message = `Invalid function arguments`;
|
|
32
|
-
break;
|
|
33
|
-
case ZodIssueCode.invalid_return_type:
|
|
34
|
-
message = `Invalid function return type`;
|
|
35
|
-
break;
|
|
36
|
-
case ZodIssueCode.invalid_date:
|
|
37
|
-
message = `Invalid date`;
|
|
38
|
-
break;
|
|
39
|
-
case ZodIssueCode.invalid_string:
|
|
40
|
-
if (typeof issue.validation === "object") {
|
|
41
|
-
if ("includes" in issue.validation) {
|
|
42
|
-
message = `Invalid input: must include "${issue.validation.includes}"`;
|
|
43
|
-
if (typeof issue.validation.position === "number") {
|
|
44
|
-
message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else if ("startsWith" in issue.validation) {
|
|
48
|
-
message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
49
|
-
}
|
|
50
|
-
else if ("endsWith" in issue.validation) {
|
|
51
|
-
message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
util.assertNever(issue.validation);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else if (issue.validation !== "regex") {
|
|
58
|
-
message = `Invalid ${issue.validation}`;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
message = "Invalid";
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
case ZodIssueCode.too_small:
|
|
65
|
-
if (issue.type === "array")
|
|
66
|
-
message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
|
|
67
|
-
else if (issue.type === "string")
|
|
68
|
-
message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
|
|
69
|
-
else if (issue.type === "number")
|
|
70
|
-
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
71
|
-
else if (issue.type === "bigint")
|
|
72
|
-
message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
|
|
73
|
-
else if (issue.type === "date")
|
|
74
|
-
message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
|
|
75
|
-
else
|
|
76
|
-
message = "Invalid input";
|
|
77
|
-
break;
|
|
78
|
-
case ZodIssueCode.too_big:
|
|
79
|
-
if (issue.type === "array")
|
|
80
|
-
message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
|
|
81
|
-
else if (issue.type === "string")
|
|
82
|
-
message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
|
|
83
|
-
else if (issue.type === "number")
|
|
84
|
-
message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
85
|
-
else if (issue.type === "bigint")
|
|
86
|
-
message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
|
|
87
|
-
else if (issue.type === "date")
|
|
88
|
-
message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
|
|
89
|
-
else
|
|
90
|
-
message = "Invalid input";
|
|
91
|
-
break;
|
|
92
|
-
case ZodIssueCode.custom:
|
|
93
|
-
message = `Invalid input`;
|
|
94
|
-
break;
|
|
95
|
-
case ZodIssueCode.invalid_intersection_types:
|
|
96
|
-
message = `Intersection results could not be merged`;
|
|
97
|
-
break;
|
|
98
|
-
case ZodIssueCode.not_multiple_of:
|
|
99
|
-
message = `Number must be a multiple of ${issue.multipleOf}`;
|
|
100
|
-
break;
|
|
101
|
-
case ZodIssueCode.not_finite:
|
|
102
|
-
message = "Number must be finite";
|
|
103
|
-
break;
|
|
104
|
-
default:
|
|
105
|
-
message = _ctx.defaultError;
|
|
106
|
-
util.assertNever(issue);
|
|
107
|
-
}
|
|
108
|
-
return { message };
|
|
109
|
-
};
|
|
110
3
|
|
|
111
|
-
|
|
4
|
+
|
|
5
|
+
export { external as default, external as z };
|
|
112
6
|
//# sourceMappingURL=index53.js.map
|