@monimesl/dot-simulator 0.1.0-alpha.3 → 0.1.0-alpha.5
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/README.md +5 -0
- package/dist/client/service-bridge.js +157 -27
- package/dist/client/service-bridge.js.map +1 -1
- package/dist/client/simulator.js +299 -40
- package/dist/client/simulator.js.map +1 -1
- package/dist/client/webview-bridge.js +12 -0
- package/dist/client/webview-bridge.js.map +1 -1
- package/dist/node/index.d.ts +13 -2
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +79 -9
- package/dist/node/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simulator.js","names":[],"sources":["../../../../core/dist/index.js","../../src/compatibility.ts","../../src/host-calls.ts","../../src/permissions.ts","../../src/host.ts","../../src/versions.ts","../../src/paths.ts","../../src/client/dash/dev-server.ts","../../src/client/dash/system.ts","../../src/client/dom.ts","../../src/client/dash/ui.ts","../../src/client/dash/index.ts","../../src/client/dash/permissions.ts","../../src/client/wire.ts","../../src/client/simulator.ts"],"sourcesContent":["//#region src/view/component.ts\nfunction defineComponent(manifest) {\n\treturn {\n\t\tprops: {},\n\t\tevents: [],\n\t\t...manifest\n\t};\n}\nfunction eventProp(event) {\n\treturn `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;\n}\nfunction isEventProp(name) {\n\tconst letterAfterOn = name.charAt(2);\n\treturn name.startsWith(\"on\") && letterAfterOn >= \"A\" && letterAfterOn <= \"Z\";\n}\nfunction eventName(prop) {\n\tconst name = prop.slice(2);\n\treturn name.charAt(0).toLowerCase() + name.slice(1);\n}\nfunction componentRegistry(manifests) {\n\tconst registry = {};\n\tfor (const manifest of manifests) {\n\t\tif (manifest.name in registry) throw new Error(`Component <${manifest.name}> is defined twice`);\n\t\tregistry[manifest.name] = manifest;\n\t}\n\treturn registry;\n}\n//#endregion\n//#region src/view/values.ts\nfunction toText(value) {\n\tswitch (typeof value) {\n\t\tcase \"string\": return value;\n\t\tcase \"number\":\n\t\tcase \"boolean\":\n\t\tcase \"bigint\": return String(value);\n\t\tcase \"object\": return value === null ? \"\" : JSON.stringify(value);\n\t\tdefault: return \"\";\n\t}\n}\nfunction toList(value) {\n\tif (Array.isArray(value)) return value;\n\tif (typeof value === \"object\" && value !== null && Symbol.iterator in value) return Array.from(value);\n\treturn [];\n}\n//#endregion\n//#region src/source/location.ts\nfunction createLocator(source) {\n\tconst lineStarts = [0];\n\tfor (let index = 0; index < source.length; index++) if (source[index] === \"\\n\") lineStarts.push(index + 1);\n\treturn (offset) => {\n\t\tlet low = 0;\n\t\tlet high = lineStarts.length - 1;\n\t\twhile (low < high) {\n\t\t\tconst middle = Math.floor((low + high + 1) / 2);\n\t\t\tif (lineStarts[middle] <= offset) low = middle;\n\t\t\telse high = middle - 1;\n\t\t}\n\t\treturn {\n\t\t\tline: low + 1,\n\t\t\tcolumn: offset - lineStarts[low] + 1,\n\t\t\toffset\n\t\t};\n\t};\n}\nfunction locationAt(source, offset) {\n\treturn createLocator(source)(offset);\n}\nfunction locatedMessage(message, file, location) {\n\tconst where = [\n\t\tfile,\n\t\tlocation?.line,\n\t\tlocation?.column\n\t].filter((part) => part !== void 0).join(\":\");\n\treturn where ? `${where}: ${message}` : message;\n}\n//#endregion\n//#region src/source/error.ts\nvar SourceError = class extends Error {\n\treason;\n\tfile;\n\tloc;\n\tconstructor(reason, file, location) {\n\t\tsuper(locatedMessage(reason, file, location));\n\t\tthis.reason = reason;\n\t\tthis.file = file;\n\t\tthis.loc = location;\n\t}\n};\n//#endregion\n//#region src/view/components/button.ts\nconst Button = defineComponent({\n\tname: \"Button\",\n\tprops: {\n\t\tvariant: [\"primary\", \"secondary\"],\n\t\tdisabled: \"boolean\",\n\t\tloading: \"boolean\"\n\t},\n\tevents: [\"click\"],\n\tchildren: \"text\"\n});\n//#endregion\n//#region src/view/components/divider.ts\nconst Divider = defineComponent({\n\tname: \"Divider\",\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/options.ts\nconst SIZES = [\n\t\"small\",\n\t\"medium\",\n\t\"large\"\n];\nconst TONES = [\n\t\"default\",\n\t\"muted\",\n\t\"info\",\n\t\"success\",\n\t\"warning\",\n\t\"danger\"\n];\nconst STATUS_TONES = [\n\t\"default\",\n\t\"info\",\n\t\"success\",\n\t\"warning\",\n\t\"danger\"\n];\nconst ICON_NAMES = [\n\t\"arrow-down\",\n\t\"arrow-left\",\n\t\"arrow-right\",\n\t\"arrow-up\",\n\t\"bank\",\n\t\"bell\",\n\t\"bolt\",\n\t\"calendar\",\n\t\"card\",\n\t\"cart\",\n\t\"cash\",\n\t\"check\",\n\t\"chevron-down\",\n\t\"chevron-left\",\n\t\"chevron-right\",\n\t\"chevron-up\",\n\t\"clock\",\n\t\"close\",\n\t\"copy\",\n\t\"download\",\n\t\"edit\",\n\t\"error\",\n\t\"eye\",\n\t\"eye-off\",\n\t\"file\",\n\t\"gift\",\n\t\"grid\",\n\t\"heart\",\n\t\"help\",\n\t\"history\",\n\t\"home\",\n\t\"image\",\n\t\"info\",\n\t\"list\",\n\t\"location\",\n\t\"lock\",\n\t\"logout\",\n\t\"mail\",\n\t\"minus\",\n\t\"mobile\",\n\t\"more\",\n\t\"phone\",\n\t\"plus\",\n\t\"qr-code\",\n\t\"receipt\",\n\t\"refresh\",\n\t\"search\",\n\t\"send\",\n\t\"settings\",\n\t\"share\",\n\t\"star\",\n\t\"success\",\n\t\"trash\",\n\t\"upload\",\n\t\"user\",\n\t\"users\",\n\t\"wallet\",\n\t\"warning\",\n\t\"water\",\n\t\"wifi\"\n];\n//#endregion\n//#region src/view/components/feedback.ts\nconst Spinner = defineComponent({\n\tname: \"Spinner\",\n\tprops: { size: SIZES },\n\tchildren: \"none\"\n});\nconst ProgressBar = defineComponent({\n\tname: \"ProgressBar\",\n\tprops: { value: \"number\" },\n\tchildren: \"none\"\n});\nconst Notice = defineComponent({\n\tname: \"Notice\",\n\tprops: {\n\t\ttone: STATUS_TONES,\n\t\ttitle: \"string\"\n\t},\n\tchildren: \"text\"\n});\nconst Badge = defineComponent({\n\tname: \"Badge\",\n\tprops: { tone: STATUS_TONES },\n\tchildren: \"text\"\n});\n//#endregion\n//#region src/view/components/footer.ts\nconst Footer = defineComponent({\n\tname: \"Footer\",\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/icon.ts\nconst Icon = defineComponent({\n\tname: \"Icon\",\n\tprops: {\n\t\tname: ICON_NAMES,\n\t\tsize: SIZES,\n\t\ttone: TONES\n\t},\n\tchildren: \"none\",\n\tinline: true\n});\n//#endregion\n//#region src/view/components/image.ts\nconst Image = defineComponent({\n\tname: \"Image\",\n\tprops: {\n\t\tsrc: \"string\",\n\t\talt: \"string\",\n\t\twidth: \"number\",\n\t\theight: \"number\",\n\t\tfit: [\"cover\", \"contain\"],\n\t\tshape: [\n\t\t\t\"rounded\",\n\t\t\t\"square\",\n\t\t\t\"circle\"\n\t\t]\n\t},\n\tevents: [\"load\", \"error\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/input.ts\nconst Input = defineComponent({\n\tname: \"Input\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tplaceholder: \"string\",\n\t\tlabel: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\tprefix: \"string\",\n\t\tsuffix: \"string\",\n\t\ttype: [\n\t\t\t\"text\",\n\t\t\t\"number\",\n\t\t\t\"email\",\n\t\t\t\"phone\",\n\t\t\t\"password\"\n\t\t],\n\t\tmaxLength: \"number\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\", \"submit\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/list.ts\nconst List = defineComponent({\n\tname: \"List\",\n\tchildren: \"elements\"\n});\nconst ListItem = defineComponent({\n\tname: \"ListItem\",\n\tprops: {\n\t\ttitle: \"string\",\n\t\tsubtitle: \"string\",\n\t\tvalue: \"string\",\n\t\ticon: ICON_NAMES,\n\t\timage: \"string\"\n\t},\n\tevents: [\"tap\"],\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/overlays.ts\nconst Sheet = defineComponent({\n\tname: \"Sheet\",\n\tprops: {\n\t\topen: \"boolean\",\n\t\ttitle: \"string\"\n\t},\n\tevents: [\"close\"],\n\tchildren: \"elements\"\n});\nconst Toast = defineComponent({\n\tname: \"Toast\",\n\tprops: {\n\t\tmessage: \"string\",\n\t\ttone: STATUS_TONES,\n\t\tduration: \"number\"\n\t},\n\tevents: [\"hide\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/select.ts\nconst Select = defineComponent({\n\tname: \"Select\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tplaceholder: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"elements\"\n});\nconst Option = defineComponent({\n\tname: \"Option\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/skeleton.ts\nconst Skeleton = defineComponent({\n\tname: \"Skeleton\",\n\tprops: {\n\t\tshape: [\n\t\t\t\"text\",\n\t\t\t\"circle\",\n\t\t\t\"box\"\n\t\t],\n\t\tlines: \"number\",\n\t\theight: \"number\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/text.ts\nconst Text = defineComponent({\n\tname: \"Text\",\n\tprops: {\n\t\tvariant: [\n\t\t\t\"title\",\n\t\t\t\"body\",\n\t\t\t\"caption\"\n\t\t],\n\t\ttone: TONES,\n\t\tweight: [\n\t\t\t\"regular\",\n\t\t\t\"medium\",\n\t\t\t\"bold\"\n\t\t],\n\t\talign: [\n\t\t\t\"start\",\n\t\t\t\"center\",\n\t\t\t\"end\"\n\t\t],\n\t\tmaxLines: \"number\"\n\t},\n\tchildren: \"text\",\n\tinline: true\n});\n//#endregion\n//#region src/view/components/text-area.ts\nconst TextArea = defineComponent({\n\tname: \"TextArea\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tplaceholder: \"string\",\n\t\tlabel: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\trows: \"number\",\n\t\tmaxLength: \"number\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/toggles.ts\nconst Switch = defineComponent({\n\tname: \"Switch\",\n\tprops: {\n\t\tchecked: \"boolean\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\nconst Checkbox = defineComponent({\n\tname: \"Checkbox\",\n\tprops: {\n\t\tchecked: \"boolean\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\nconst RadioGroup = defineComponent({\n\tname: \"RadioGroup\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"elements\"\n});\nconst Radio = defineComponent({\n\tname: \"Radio\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/view.ts\nconst SPACE = [\n\t\"none\",\n\t\"small\",\n\t\"medium\",\n\t\"large\"\n];\nconst View = defineComponent({\n\tname: \"View\",\n\tprops: {\n\t\tgap: SPACE,\n\t\tdirection: [\"column\", \"row\"],\n\t\talign: [\n\t\t\t\"stretch\",\n\t\t\t\"start\",\n\t\t\t\"center\",\n\t\t\t\"end\"\n\t\t],\n\t\tjustify: [\n\t\t\t\"start\",\n\t\t\t\"center\",\n\t\t\t\"end\",\n\t\t\t\"between\"\n\t\t],\n\t\twrap: \"boolean\",\n\t\tgrow: \"boolean\",\n\t\tpadding: SPACE,\n\t\tpaddingTop: SPACE,\n\t\tpaddingStart: SPACE,\n\t\tpaddingEnd: SPACE,\n\t\tpaddingBottom: SPACE,\n\t\tvariant: [\"plain\", \"card\"]\n\t},\n\tevents: [\"tap\"],\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/index.ts\nconst builtinComponents = {\n\tBadge,\n\tButton,\n\tCheckbox,\n\tDivider,\n\tFooter,\n\tIcon,\n\tImage,\n\tInput,\n\tList,\n\tListItem,\n\tNotice,\n\tOption,\n\tProgressBar,\n\tRadio,\n\tRadioGroup,\n\tSelect,\n\tSheet,\n\tSkeleton,\n\tSpinner,\n\tSwitch,\n\tText,\n\tTextArea,\n\tToast,\n\tView\n};\nconst builtinRegistry = componentRegistry(Object.values(builtinComponents));\n//#endregion\n//#region src/event/emitter.ts\nvar EventEmitter = class {\n\t#listeners = /* @__PURE__ */ new Map();\n\ton(name, listener) {\n\t\tconst listeners = this.#listeners.get(name) ?? /* @__PURE__ */ new Set();\n\t\tthis.#listeners.set(name, listeners);\n\t\tlisteners.add(listener);\n\t\treturn () => listeners.delete(listener);\n\t}\n\temit(name, ...args) {\n\t\tthis.#listeners.get(name)?.forEach((listener) => listener(...args));\n\t}\n};\n//#endregion\n//#region src/event/core.ts\nfunction createEvent(type, detail = {}, data = {}) {\n\treturn {\n\t\ttype,\n\t\tdetail,\n\t\tdata\n\t};\n}\n//#endregion\n//#region src/host/host.ts\nfunction hostTransport() {\n\tconst transport = globalThis.__hostTransport;\n\tif (!transport) throw new Error(\"No Dot host found: expected `globalThis.__hostTransport` to be available at runtime. Dots run inside the Dash App, or a simulator via `dotctl dev`.\");\n\treturn transport;\n}\n//#endregion\n//#region src/host/context.ts\nconst DEFAULT_SYSTEM_CONTEXT = {\n\tscheme: \"light\",\n\tappState: \"active\"\n};\n//#endregion\n//#region src/host/calls.ts\nvar HostError = class extends Error {\n\tname = \"HostError\";\n\tcode;\n\tconstructor(code, message) {\n\t\tsuper(message);\n\t\tthis.code = code;\n\t}\n};\nlet connectedCaller = null;\nfunction connectHost(caller) {\n\tconnectedCaller = caller;\n}\nfunction callHost(method, params, options = {}) {\n\tif (!connectedCaller) {\n\t\tconst error = new HostError(\"unsupported\", `No host to run \"${method}\": host calls run in the service`);\n\t\treturn createHostRequest(Promise.reject(error));\n\t}\n\treturn connectedCaller(method, params, options);\n}\nfunction createHostRequest(promise, cancel = () => {}) {\n\tconst request = promise;\n\trequest.cancel = cancel;\n\treturn request;\n}\n//#endregion\n//#region src/host/permissions.ts\nconst PERMISSIONS = [\"account\"];\nfunction isPermission(value) {\n\treturn PERMISSIONS.includes(value);\n}\n//#endregion\n//#region src/host/files.ts\nconst DOT_FILE_PATH_MAX_LENGTH = 512;\nconst MAX_NAME_LENGTH = 255;\nfunction dotFilePathProblem(path, { allowRoot = false } = {}) {\n\tif (path === \"\") return allowRoot ? null : \"A path is needed, such as \\\"receipts/42.pdf\\\"\";\n\tif (path.length > 512) return `\"${path.slice(0, 40)}…\" is longer than 512 characters`;\n\tif (path.startsWith(\"/\")) return `\"${path}\" starts with \"/\": paths are relative to the dot's storage, such as \"receipts/42.pdf\"`;\n\tif ([...path].some((char) => char === \"\\\\\" || char.charCodeAt(0) < 32)) return `\"${path}\" has a backslash or a control character`;\n\tfor (const name of path.split(\"/\")) {\n\t\tif (name === \"\" || name === \".\" || name === \"..\") return `\"${path}\" has an empty, \".\" or \"..\" part: write each folder once, such as \"receipts/42.pdf\"`;\n\t\tif (name.length > MAX_NAME_LENGTH) return `\"${path}\" has a name longer than ${MAX_NAME_LENGTH} characters`;\n\t}\n\treturn null;\n}\n//#endregion\n//#region src/host/network.ts\nconst LABEL = \"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\";\nconst NETWORK_HOST_PATTERN = new RegExp(`^(?:\\\\*\\\\.${LABEL}(?:\\\\.${LABEL})+|${LABEL}(?:\\\\.${LABEL})*)$`);\nconst NETWORK_HOST_MAX_LENGTH = 253;\nfunction isNetworkHost(value) {\n\treturn value.length <= 253 && NETWORK_HOST_PATTERN.test(value);\n}\nfunction allowsHost(hosts, host) {\n\tconst name = host.toLowerCase().replace(/\\.$/, \"\");\n\treturn hosts.some((pattern) => pattern.startsWith(\"*.\") ? name.endsWith(pattern.slice(1)) : name === pattern);\n}\n//#endregion\n//#region src/version/semantic-version.ts\nconst SEMVER_PATTERN = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\nfunction isSemanticVersion(value) {\n\treturn typeof value === \"string\" && SEMVER_PATTERN.test(value);\n}\nfunction majorVersion(version) {\n\treturn parseVersion(version).major;\n}\nfunction isVersionAtLeast(version, minimum) {\n\treturn compareVersions(version, minimum) >= 0;\n}\nfunction compareVersions(left, right) {\n\tconst leftVersion = parseVersion(left);\n\tconst rightVersion = parseVersion(right);\n\tconst differences = [\n\t\tleftVersion.major - rightVersion.major,\n\t\tleftVersion.minor - rightVersion.minor,\n\t\tleftVersion.patch - rightVersion.patch\n\t];\n\tfor (const difference of differences) if (difference !== 0) return difference;\n\treturn comparePrereleases(leftVersion.prerelease, rightVersion.prerelease);\n}\nfunction parseVersion(version) {\n\tconst match = SEMVER_PATTERN.exec(version);\n\tif (!match) throw new Error(`\"${version}\" is not a semantic version`);\n\tconst [, major, minor, patch, prerelease] = match;\n\treturn {\n\t\tmajor: Number(major),\n\t\tminor: Number(minor),\n\t\tpatch: Number(patch),\n\t\tprerelease: prerelease === void 0 ? [] : prerelease.split(\".\")\n\t};\n}\nfunction comparePrereleases(left, right) {\n\tif (left.length === 0 || right.length === 0) return right.length - left.length;\n\tconst shared = Math.min(left.length, right.length);\n\tfor (let index = 0; index < shared; index++) {\n\t\tconst order = compareIdentifiers(left[index], right[index]);\n\t\tif (order !== 0) return order;\n\t}\n\treturn left.length - right.length;\n}\nfunction compareIdentifiers(left, right) {\n\tconst leftIsNumber = /^\\d+$/.test(left);\n\tconst rightIsNumber = /^\\d+$/.test(right);\n\tif (leftIsNumber && rightIsNumber) return Number(left) - Number(right);\n\tif (leftIsNumber) return -1;\n\tif (rightIsNumber) return 1;\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n}\n//#endregion\n//#region src/host/react.ts\nconst REACT_HOST_PATH = \"/__dot/react/\";\nconst REACT_HOST_MODULES = {\n\treact: \"react.js\",\n\t\"react/jsx-runtime\": \"react-jsx-runtime.js\",\n\t\"react-dom/client\": \"react-dom-client.js\"\n};\nfunction reactHostUrl(dotReactVersion, file) {\n\treturn `${REACT_HOST_PATH}${majorVersion(dotReactVersion)}/${file}`;\n}\nfunction isReactCompatible(hostVersion, dotVersion) {\n\treturn majorVersion(hostVersion) === majorVersion(dotVersion) && isVersionAtLeast(hostVersion, dotVersion);\n}\nfunction newestReactOfMajor(versions, major) {\n\treturn versions.filter((version) => majorVersion(version) === major).sort(compareVersions).at(-1);\n}\n//#endregion\n//#region src/protocol/transport.ts\nfunction createAdaptorTransport(adapter) {\n\treturn {\n\t\tpost: (message) => adapter.postMessage(message),\n\t\tlisten(listener) {\n\t\t\tconst onMessage = (event) => listener(event.data);\n\t\t\tadapter.addEventListener(\"message\", onMessage);\n\t\t\treturn () => adapter.removeEventListener(\"message\", onMessage);\n\t\t}\n\t};\n}\nfunction createTransportPair() {\n\tconst firstListeners = /* @__PURE__ */ new Set();\n\tconst secondListeners = /* @__PURE__ */ new Set();\n\tconst createSide = (ownListeners, otherListeners) => ({\n\t\tpost: (message) => {\n\t\t\tconst copy = JSON.parse(JSON.stringify(message));\n\t\t\totherListeners.forEach((listener) => listener(copy));\n\t\t},\n\t\tlisten(listener) {\n\t\t\townListeners.add(listener);\n\t\t\treturn () => ownListeners.delete(listener);\n\t\t}\n\t});\n\treturn [createSide(firstListeners, secondListeners), createSide(secondListeners, firstListeners)];\n}\nconst PAGE_HOOKS = Object.keys({\n\tonLoad: true,\n\tonShow: true,\n\tonHide: true,\n\tonUnload: true\n});\n//#endregion\n//#region src/page/navigation.ts\nconst MAX_STACK_DEPTH = 8;\nconst PAGE_ID = /^[A-Za-z0-9_-]+(?:\\/[A-Za-z0-9_-]+)*$/;\nfunction isPageId(value) {\n\treturn PAGE_ID.test(value);\n}\nvar NavigationStack = class {\n\tlimit;\n\t#pages = [];\n\t#nextInstanceId = 1;\n\tconstructor(limit = 8) {\n\t\tthis.limit = limit;\n\t}\n\tget pages() {\n\t\treturn this.#pages;\n\t}\n\tget top() {\n\t\treturn this.#pages.at(-1);\n\t}\n\t/**\n\t* Applies a navigation, or refuses it and returns false: a push onto a full stack, or going back\n\t* from the first page (which the host handles itself, e.g. by closing the dot).\n\t*/\n\tapply(navigation) {\n\t\tswitch (navigation.action) {\n\t\t\tcase \"push\":\n\t\t\t\tif (this.#pages.length >= this.limit) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\tthis.#pages.pop();\n\t\t\t\tbreak;\n\t\t\tcase \"reset\":\n\t\t\t\tthis.#pages = [];\n\t\t\t\tbreak;\n\t\t\tcase \"back\": {\n\t\t\t\tconst count = Math.min(navigation.delta, this.#pages.length - 1);\n\t\t\t\tif (count < 1) return false;\n\t\t\t\tthis.#pages = this.#pages.slice(0, -count);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tconst { page, options } = navigation;\n\t\tthis.#pages = [...this.#pages, {\n\t\t\tinstanceId: this.#nextInstanceId++,\n\t\t\tpage,\n\t\t\toptions\n\t\t}];\n\t\treturn true;\n\t}\n};\n//#endregion\n//#region src/page/state.ts\nfunction applyChanges(state, changes) {\n\tconst next = { ...state };\n\tfor (const [key, value] of Object.entries(changes)) if (value !== void 0) next[key] = value;\n\treturn next;\n}\n//#endregion\n//#region src/messageChannel.ts\nvar MessageChannel = class {\n\t#transport;\n\t#handlers = /* @__PURE__ */ new Map();\n\tconstructor(transport) {\n\t\tthis.#transport = transport;\n\t}\n\tsend(type, payload) {\n\t\tthis.#transport.post({\n\t\t\ttype,\n\t\t\tpayload\n\t\t});\n\t}\n\thandle(type, handler) {\n\t\tconst previous = this.#handlers.get(type);\n\t\tthis.#handlers.set(type, handler);\n\t\treturn previous;\n\t}\n\tlisten(onError) {\n\t\treturn this.#transport.listen((rawMessage) => {\n\t\t\tconst message = rawMessage;\n\t\t\tconst handler = this.#handlers.get(message.type);\n\t\t\tif (!handler) {\n\t\t\t\tonError(/* @__PURE__ */ new Error(`No handler registered for message \"${message.type}\"`), message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\thandler(message.payload);\n\t\t\t} catch (error) {\n\t\t\t\tonError(error, message);\n\t\t\t}\n\t\t});\n\t}\n};\n//#endregion\nexport { Badge, Button, Checkbox, DEFAULT_SYSTEM_CONTEXT, DOT_FILE_PATH_MAX_LENGTH, Divider, EventEmitter, Footer, HostError, ICON_NAMES, Icon, Image, Input, List, ListItem, MAX_STACK_DEPTH, MessageChannel, NETWORK_HOST_MAX_LENGTH, NETWORK_HOST_PATTERN, NavigationStack, Notice, Option, PAGE_HOOKS, PERMISSIONS, ProgressBar, REACT_HOST_MODULES, REACT_HOST_PATH, Radio, RadioGroup, SEMVER_PATTERN, SIZES, STATUS_TONES, Select, Sheet, Skeleton, SourceError, Spinner, Switch, TONES, Text, TextArea, Toast, View, allowsHost, applyChanges, builtinComponents, builtinRegistry, callHost, compareVersions, componentRegistry, connectHost, createAdaptorTransport, createEvent, createHostRequest, createLocator, createTransportPair, defineComponent, dotFilePathProblem, eventName, eventProp, hostTransport, isEventProp, isNetworkHost, isPageId, isPermission, isReactCompatible, isSemanticVersion, isVersionAtLeast, locatedMessage, locationAt, majorVersion, newestReactOfMajor, reactHostUrl, toList, toText };\n\n//# sourceMappingURL=index.js.map","import { isReactCompatible, isVersionAtLeast, majorVersion } from '@monimesl/dot-core';\n\nimport type { HostManifest } from './manifest';\n\nexport type IncompatibilityReason = 'runtimeTooOld' | 'dashTooOld' | 'reactUnavailable';\n\n// The two versions a host knows about itself.\nexport interface HostVersions {\n // The Dash version this host is, checked against the dot's `dash.minVersion`.\n readonly dashVersion: string;\n // The oldest @monimesl/dot-runtime this host runs. Dots built with an older one must be rebuilt.\n readonly minRuntimeVersion: string;\n // The React versions the host ships. Left out by a host that serves the React the dot was built\n // with, as the simulator does.\n readonly reactVersions?: readonly string[] | undefined;\n}\n\n// Why a host refuses to open a dot: it was built with a runtime older than the host runs, it needs\n// a newer Dash than the host is, or it imports a React the host doesn't ship.\nexport class IncompatibleDotError extends Error {\n override readonly name = 'IncompatibleDotError';\n readonly reason: IncompatibilityReason;\n\n constructor(reason: IncompatibilityReason, message: string) {\n super(message);\n this.reason = reason;\n }\n}\n\n// Throws an IncompatibleDotError when a host with these versions cannot run the dot.\nexport function checkCompatibility(\n manifest: HostManifest,\n { dashVersion, minRuntimeVersion, reactVersions }: HostVersions,\n): void {\n if (!isVersionAtLeast(manifest.runtime, minRuntimeVersion)) {\n throw new IncompatibleDotError(\n 'runtimeTooOld',\n `This dot was built with Dot runtime ${manifest.runtime}, but this host runs ${minRuntimeVersion} or newer. ` +\n 'Rebuild it with a newer @monimesl/dot-runtime.',\n );\n }\n const minDashVersion = manifest.dash?.minVersion;\n if (minDashVersion !== undefined && !isVersionAtLeast(dashVersion, minDashVersion)) {\n throw new IncompatibleDotError(\n 'dashTooOld',\n `This dot needs Dash ${minDashVersion} or newer, and this is Dash ${dashVersion}.`,\n );\n }\n if (\n reactVersions !== undefined &&\n !reactVersions.some((version) => isReactCompatible(version, manifest.react))\n ) {\n throw new IncompatibleDotError(\n 'reactUnavailable',\n `This dot needs React ${manifest.react} or a newer ${majorVersion(manifest.react)}.x, which this host doesn't ship.`,\n );\n }\n}\n","import type {\n DotPermission,\n HostErrorCode,\n HostResult,\n LogicLayerMessages,\n} from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\nimport type { PermissionGate } from './permissions';\n\nexport interface HostCall {\n readonly method: string;\n readonly params: unknown;\n // Aborted when the call ends early: cancelled, out of time, or dismissed with its page.\n readonly signal: AbortSignal;\n}\n\n// Runs one host method. Throw a `HostError` to fail with its code; anything else fails as `failed`.\nexport type HostHandler = (call: HostCall) => unknown;\n\n// A method that needs a permission: it runs only if the dot declared it and the person allowed it.\nexport interface PermissionedHandler {\n readonly permission: DotPermission;\n readonly handle: HostHandler;\n}\n\nexport type HostHandlers = Readonly<Record<string, HostHandler | PermissionedHandler>>;\n\nconst UI_METHOD_PREFIX = 'dash.ui.';\n\ninterface RunningCall {\n readonly method: string;\n readonly controller: AbortController;\n timer?: ReturnType<typeof setTimeout>;\n}\n\n// Runs the service's host calls with `handlers`, and answers each call exactly once.\nexport class HostCallRunner {\n readonly #handlers: HostHandlers;\n readonly #permissions: PermissionGate;\n readonly #answer: (result: HostResult) => void;\n readonly #running = new Map<number, RunningCall>();\n\n constructor(\n handlers: HostHandlers,\n permissions: PermissionGate,\n answer: (result: HostResult) => void,\n ) {\n this.#handlers = handlers;\n this.#permissions = permissions;\n this.#answer = answer;\n }\n\n run({ id, method, params, timeout }: LogicLayerMessages['hostCall']): void {\n const entry = this.#handlers[method];\n if (!entry) {\n this.#answer({ id, error: { code: 'unsupported', message: `This host has no \"${method}\"` } });\n return;\n }\n const call: RunningCall = { method, controller: new AbortController() };\n if (timeout !== undefined) {\n call.timer = setTimeout(() => {\n this.#fail(id, new HostError('timeout', `\"${method}\" took longer than ${timeout}ms`));\n }, timeout);\n }\n this.#running.set(id, call);\n void this.#invoke(id, entry, { method, params, signal: call.controller.signal });\n }\n\n // The service stopped waiting, so the call ends without an answer.\n cancel(id: number): void {\n this.#end(id)?.controller.abort();\n }\n\n // Dialogs belong to the page on top: when it changes, the ones still open are dismissed.\n dismissUI(): void {\n for (const [id, call] of this.#running) {\n if (call.method.startsWith(UI_METHOD_PREFIX)) {\n this.#fail(id, new HostError('cancelled', 'The page it was shown on is no longer on top'));\n }\n }\n }\n\n async #invoke(\n id: number,\n entry: HostHandler | PermissionedHandler,\n call: HostCall,\n ): Promise<void> {\n try {\n if (typeof entry === 'function') {\n this.#succeed(id, await entry(call));\n return;\n }\n await this.#permissions.check(call.method, entry.permission, call.signal);\n this.#succeed(id, await entry.handle(call));\n } catch (error) {\n this.#fail(id, error);\n }\n }\n\n #succeed(id: number, value: unknown): void {\n if (this.#end(id)) {\n this.#answer({ id, value });\n }\n }\n\n #fail(id: number, error: unknown): void {\n const call = this.#end(id);\n if (!call) {\n return;\n }\n call.controller.abort();\n this.#answer({ id, error: describeError(error) });\n }\n\n #end(id: number): RunningCall | undefined {\n const call = this.#running.get(id);\n if (call) {\n this.#running.delete(id);\n clearTimeout(call.timer);\n }\n return call;\n }\n}\n\nfunction describeError(error: unknown): { code: HostErrorCode; message: string } {\n if (error instanceof HostError) {\n return { code: error.code, message: error.message };\n }\n return { code: 'failed', message: error instanceof Error ? error.message : String(error) };\n}\n","import type { DotPermission } from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\n// A dot asking for a permission it declared, the first time a call needs it.\nexport interface PermissionRequest {\n readonly dotName: string;\n readonly permission: DotPermission;\n // Why the dot needs it, from its dot.json.\n readonly reason: string;\n}\n\n// Each permission a dot declared in its dot.json, with the reason Dash shows the person.\nexport type DeclaredPermissions = Readonly<Partial<Record<string, string>>>;\n\n// Asks the person, and resolves with whether they allowed it. `signal` aborts when the call that\n// needs the permission ends first; the host then takes its prompt down and rejects.\nexport type AskPermission = (request: PermissionRequest, signal: AbortSignal) => Promise<boolean>;\n\n// Lets a call that needs a permission through only if the dot declared it and the person allowed\n// it. The person is asked once per run; the answer, yes or no, is kept.\nexport class PermissionGate {\n readonly #dotName: string;\n readonly #declared: DeclaredPermissions;\n readonly #ask: AskPermission;\n readonly #answers = new Map<DotPermission, boolean>();\n\n constructor(dotName: string, declared: DeclaredPermissions, ask: AskPermission) {\n this.#dotName = dotName;\n this.#declared = declared;\n this.#ask = ask;\n }\n\n // Rejects with a `denied` HostError when the call may not run.\n async check(method: string, permission: DotPermission, signal: AbortSignal): Promise<void> {\n const reason = this.#declared[permission];\n if (reason === undefined) {\n throw new HostError(\n 'denied',\n `\"${method}\" needs the \"${permission}\" permission. Add it to dot.json's permissions, with the reason Dash shows the person.`,\n );\n }\n let allowed = this.#answers.get(permission);\n if (allowed === undefined) {\n allowed = await this.#ask({ dotName: this.#dotName, permission, reason }, signal);\n this.#answers.set(permission, allowed);\n }\n if (!allowed) {\n throw new HostError('denied', `The person did not allow \"${permission}\"`);\n }\n }\n}\n","import type {\n Envelope,\n HostLayerMessages,\n HostResult,\n LogicLayerMessages,\n Navigation,\n SystemContext,\n Transport,\n} from '@monimesl/dot-core';\nimport { NavigationStack } from '@monimesl/dot-core';\n\nimport type { HostVersions } from './compatibility';\nimport { checkCompatibility } from './compatibility';\nimport type { HostHandlers } from './host-calls';\nimport { HostCallRunner } from './host-calls';\nimport type { HostManifest } from './manifest';\nimport type { AskPermission } from './permissions';\nimport { PermissionGate } from './permissions';\n\nexport type Direction = 'toService' | 'toWebview' | 'toHost' | 'fromHost';\n\nexport interface HostOptions extends HostVersions {\n ui: Transport;\n logic: Transport;\n manifest: HostManifest;\n systemContext: SystemContext;\n // The methods dots may call, such as `dash.ui.alert`; any other is answered `unsupported`.\n handlers?: HostHandlers;\n // Asks the person for a permission the dot declared, the first time a method needs it.\n askPermission: AskPermission;\n observe?: (direction: Direction, message: Envelope) => void;\n}\n\nexport interface Host {\n stop(): void;\n // false on the first page, where a device closes the dot instead.\n back(): boolean;\n setSystemContext(context: SystemContext): void;\n}\n\n// The host contract in JavaScript; native hosts implement the same in Swift or Kotlin.\n// Throws an IncompatibleDotError, before either layer hears anything, if it cannot run the dot.\nexport function startHost({\n logic,\n ui,\n manifest,\n dashVersion,\n minRuntimeVersion,\n systemContext,\n handlers = {},\n askPermission,\n observe,\n}: HostOptions): Host {\n checkCompatibility(manifest, { dashVersion, minRuntimeVersion });\n const stack = new NavigationStack();\n let context = systemContext;\n const permissions = new PermissionGate(manifest.name, manifest.permissions ?? {}, askPermission);\n const calls = new HostCallRunner(handlers, permissions, (result) => {\n const message: Envelope<'hostResult', HostResult> = { type: 'hostResult', payload: result };\n observe?.('fromHost', message);\n logic.post(message);\n });\n const broadcast = (message: Envelope) => {\n observe?.('fromHost', message);\n ui.post(message);\n logic.post(message);\n };\n const syncStack = () => {\n const message: Envelope<'syncStack', HostLayerMessages['syncStack']> = {\n type: 'syncStack',\n payload: { pages: stack.pages, limit: stack.limit },\n };\n broadcast(message);\n };\n const syncSystemContext = () => {\n const message: Envelope<'syncSystemContext', HostLayerMessages['syncSystemContext']> = {\n type: 'syncSystemContext',\n payload: context,\n };\n broadcast(message);\n };\n const navigate = (navigation: Navigation): boolean => {\n if (navigation.action !== 'back' && !manifest.pages.includes(navigation.page)) {\n return false;\n }\n const previousTop = stack.top;\n if (!stack.apply(navigation)) {\n return false;\n }\n syncStack();\n if (stack.top !== previousTop) {\n calls.dismissUI();\n }\n return true;\n };\n\n // Only the page on top may navigate; a request from a page below it is dropped.\n const navigateFromPage = ({ from, ...navigation }: LogicLayerMessages['navigate']) => {\n if (from === stack.top?.instanceId) {\n navigate(navigation);\n }\n };\n // Service messages meant for the host itself; every other one is relayed to the webview.\n const hostMessageHandlers = new Map<string, (payload: unknown) => void>([\n ['navigate', (payload) => navigateFromPage(payload as LogicLayerMessages['navigate'])],\n ['hostCall', (payload) => calls.run(payload as LogicLayerMessages['hostCall'])],\n ['hostCancel', (payload) => calls.cancel((payload as LogicLayerMessages['hostCancel']).id)],\n ]);\n\n const stopService = logic.listen((raw) => {\n const message = raw as Envelope;\n const handleHostMessage = hostMessageHandlers.get(message.type);\n if (handleHostMessage) {\n observe?.('toHost', message);\n handleHostMessage(message.payload);\n return;\n }\n observe?.('toWebview', message);\n ui.post(message);\n });\n const stopWebview = ui.listen((raw) => {\n const message = raw as Envelope;\n observe?.('toService', message);\n logic.post(message);\n if (message.type === 'connect') {\n syncSystemContext();\n navigate({ action: 'reset', page: manifest.entry, options: {} });\n }\n });\n return {\n back: () => navigate({ action: 'back', delta: 1 }),\n setSystemContext: (next) => {\n context = next;\n syncSystemContext();\n },\n stop: () => {\n stopService();\n stopWebview();\n },\n };\n}\n","import type { HostVersions } from './compatibility';\n\n// The Dash version the simulator acts as, for dots that set `dash.minVersion`.\nexport const SIMULATED_DASH_VERSION = '1.0.0';\n\n// The oldest @monimesl/dot-runtime whose bundles the simulator's bridge runs. Raise it when the\n// messages between the layers and the host change in a way older runtimes don't understand.\nexport const MIN_RUNTIME_VERSION = '0.1.0-alpha.1';\n\nexport const SIMULATOR_VERSIONS: HostVersions = {\n dashVersion: SIMULATED_DASH_VERSION,\n minRuntimeVersion: MIN_RUNTIME_VERSION,\n};\n","export const CLIENT_PATH = '/__dot/';\nexport const EVENTS_PATH = `${CLIENT_PATH}events`;\nexport const HTTP_PATH = `${CLIENT_PATH}network/http/`;\nexport const FILE_PATH = `${CLIENT_PATH}file/`;\n\nexport const DOT_PATH = '/dot/';\nexport const WEBVIEW_URL = `${DOT_PATH}ui/index.html`;\nexport const SERVICE_URL = `${DOT_PATH}logic/dot.js`;\nexport const MANIFEST_URL = `${DOT_PATH}manifest.json`;\n","import type { HostErrorCode } from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\ntype Answer<Result> = { result: Result } | { error: { code: HostErrorCode; message: string } };\n\n// Runs a Dash call on the dev server, as a native host runs it on the device.\nexport async function callDevServer<Result>(\n path: string,\n params: unknown,\n signal: AbortSignal,\n): Promise<Result> {\n const response = await fetch(path, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(params),\n signal,\n });\n const answer = (await response.json()) as Answer<Result>;\n if ('error' in answer) {\n throw new HostError(answer.error.code, answer.error.message);\n }\n return answer.result;\n}\n","import type { DashMethods, TorchState, VibrateOptions } from '@monimesl/dot-dash';\nimport { HostError } from '@monimesl/dot-core';\n\nexport type ShareParams = DashMethods['dash.system.share']['params'];\n\nconst SHAKE_DURATION_MS = 300;\n\nconst SHAKE: Keyframe[] = [\n { transform: 'translateX(0)' },\n { transform: 'translateX(-5px)' },\n { transform: 'translateX(5px)' },\n { transform: 'translateX(-3px)' },\n { transform: 'translateX(3px)' },\n { transform: 'translateX(0)' },\n];\n\nexport async function vibrate(\n phone: HTMLElement,\n note: (text: string) => void,\n options: VibrateOptions,\n): Promise<void> {\n note(`vibrated: ${options.style}`);\n await phone.animate(SHAKE, { duration: SHAKE_DURATION_MS }).finished;\n}\n\nexport function torch(phone: HTMLElement, note: (text: string) => void, state: TorchState): void {\n phone.dataset.torch = state;\n note(`torch: ${state}`);\n}\n\nexport async function copyText(note: (text: string) => void, text: string): Promise<void> {\n try {\n await navigator.clipboard.writeText(text);\n } catch (error) {\n throw new HostError('failed', `The browser kept the clipboard: ${(error as Error).message}`);\n }\n note(`copied: ${text}`);\n}\n\n// Notes what a device's share sheet would get.\nexport function share(note: (text: string) => void, params: ShareParams): void {\n const parts = [params.text, params.url, params.file && `file ${params.file}`].filter(Boolean);\n if (parts.length === 0) {\n throw new HostError('invalid', 'Give share a text, a url or a file');\n }\n note(`shared: ${parts.join(' · ')}`);\n}\n\nexport function delay(milliseconds: number, signal: AbortSignal): Promise<void> {\n if (!Number.isFinite(milliseconds) || milliseconds < 0) {\n throw new HostError(\n 'invalid',\n `A delay is a number of milliseconds, 0 or more, not ${milliseconds}`,\n );\n }\n return new Promise((resolve) => {\n const timer = setTimeout(resolve, milliseconds);\n signal.addEventListener('abort', () => clearTimeout(timer));\n });\n}\n","export function element<T extends Element>(selector: string): T {\n const node = document.querySelector<T>(selector);\n if (!node) {\n throw new Error(`Simulator page is missing ${selector}`);\n }\n return node;\n}\n\nexport function createElement<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className: string,\n text?: string,\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n node.className = className;\n if (text !== undefined) {\n node.textContent = text;\n }\n return node;\n}\n","import { HostError } from '@monimesl/dot-core';\nimport type { AlertAction, AlertOptions, AlertResult } from '@monimesl/dot-dash';\n\nimport { createElement } from '../dom';\n\n// dash.ui.alert always sends actions, but a host does not trust what the service sends.\nconst DEFAULT_ACTIONS: AlertAction[] = [{ id: 'ok', label: 'OK' }];\n\nexport function alert(\n phone: HTMLElement,\n options: AlertOptions,\n signal: AbortSignal,\n): Promise<AlertResult> {\n return new Promise((resolve, reject) => {\n const layer = createElement('div', 'dialog-layer');\n const dialog = createElement('div', 'dialog');\n dialog.setAttribute('role', 'alertdialog');\n const body = createElement('div', 'dialog-body');\n body.append(createElement('div', 'dialog-title', options.title));\n if (options.message) {\n body.append(createElement('div', 'dialog-message', options.message));\n }\n const actions = options.actions ?? DEFAULT_ACTIONS;\n // Two actions sit side by side, as on iOS; more are stacked.\n const buttons = createElement(\n 'div',\n actions.length === 2 ? 'dialog-actions' : 'dialog-actions stacked',\n );\n for (const action of actions) {\n const button = createElement('button', action.role ?? 'default', action.label);\n button.addEventListener('click', () => {\n layer.remove();\n resolve({ action: action.id });\n });\n buttons.append(button);\n }\n dialog.append(body, buttons);\n layer.append(dialog);\n signal.addEventListener('abort', () => {\n layer.remove();\n reject(new HostError('cancelled', 'The alert was dismissed'));\n });\n phone.append(layer);\n });\n}\n","import type { AlertOptions, TorchState, VibrateOptions } from '@monimesl/dot-dash';\n\nimport type { HostHandlers } from '../../host-calls';\nimport { FILE_PATH, HTTP_PATH } from '../../paths';\nimport { callDevServer } from './dev-server';\nimport type { ShareParams } from './system';\nimport { copyText, delay, share, torch, vibrate } from './system';\nimport { alert } from './ui';\n\nconst HTTP_METHODS = ['request', 'download', 'upload'] as const;\n\nconst FILE_OPERATIONS = [\n 'read',\n 'write',\n 'stat',\n 'list',\n 'createFolder',\n 'move',\n 'copy',\n 'remove',\n 'save',\n 'open',\n 'usage',\n] as const;\n\n// Stand-ins for what a device does natively; the dev server reaches the network and files.\nexport function dashHandlers(phone: HTMLElement, note: (text: string) => void): HostHandlers {\n return {\n 'dash.ui.alert': ({ params, signal }) => alert(phone, params as AlertOptions, signal),\n 'dash.system.vibrate': ({ params }) => vibrate(phone, note, params as VibrateOptions),\n 'dash.system.torch': ({ params }) =>\n torch(phone, note, (params as { state: TorchState }).state),\n 'dash.system.copyText': ({ params }) => copyText(note, (params as { text: string }).text),\n 'dash.system.share': ({ params }) => share(note, params as ShareParams),\n 'dash.system.delay': ({ params, signal }) =>\n delay((params as { milliseconds: number }).milliseconds, signal),\n ...devServerHandlers('dash.network.http', HTTP_PATH, HTTP_METHODS),\n ...devServerHandlers('dash.file', FILE_PATH, FILE_OPERATIONS),\n };\n}\n\nfunction devServerHandlers(group: string, path: string, names: readonly string[]): HostHandlers {\n return Object.fromEntries(\n names.map((name) => [\n `${group}.${name}`,\n ({ params, signal }: { params: unknown; signal: AbortSignal }) =>\n callDevServer(`${path}${name}`, params, signal),\n ]),\n );\n}\n","import type { DotPermission } from '@monimesl/dot-core';\n\nimport type { PermissionRequest } from '../../permissions';\nimport { alert } from './ui';\n\n// Finishes \"Allow “Counter” to …?\".\nconst PERMISSION_SUMMARIES: Record<DotPermission, string> = {\n account: 'see your Dash account: your name, and your email or phone',\n};\n\n// Asks as Dash would: the dot's name, what it wants, and the reason from its dot.json.\nexport async function askPermission(\n phone: HTMLElement,\n note: (text: string) => void,\n request: PermissionRequest,\n signal: AbortSignal,\n): Promise<boolean> {\n const { action } = await alert(\n phone,\n {\n title: `Allow “${request.dotName}” to ${PERMISSION_SUMMARIES[request.permission]}?`,\n message: request.reason,\n actions: [\n { id: 'deny', label: \"Don't Allow\", role: 'cancel' },\n { id: 'allow', label: 'Allow' },\n ],\n },\n signal,\n );\n const allowed = action === 'allow';\n if (allowed) {\n note(`permission ${request.permission}: allowed`);\n } else {\n note(`permission ${request.permission}: not allowed`);\n }\n return allowed;\n}\n","import type { Transport } from '@monimesl/dot-core';\n\n// Native bridges only carry strings, so JSON-encoding here makes state that a device could not\n// carry fail in the simulator too.\ninterface Wire {\n readonly dot: string;\n}\n\nfunction isWire(data: unknown): data is Wire {\n return typeof (data as Partial<Wire> | null)?.dot === 'string';\n}\n\nexport function wireTransport(channel: Transport): Transport {\n return {\n post: (message) => channel.post({ dot: JSON.stringify(message) } satisfies Wire),\n listen: (listener) =>\n channel.listen((data) => {\n if (isWire(data)) {\n listener(JSON.parse(data.dot));\n }\n }),\n };\n}\n\n// The simulator page and the webview's iframe, each accepting messages only from the other.\nexport function windowChannel(other: () => Window | null): Transport {\n return {\n post: (message) => other()?.postMessage(message, location.origin),\n listen(listener) {\n const onMessage = (event: MessageEvent) => {\n if (event.source === other()) {\n listener(event.data);\n }\n };\n window.addEventListener('message', onMessage);\n return () => window.removeEventListener('message', onMessage);\n },\n };\n}\n","import type { AppState, ColorScheme, Envelope, SystemContext } from '@monimesl/dot-core';\nimport { createAdaptorTransport } from '@monimesl/dot-core';\n\nimport type { Direction, Host } from '../host';\nimport type { HostManifest } from '../manifest';\nimport { checkCompatibility } from '../compatibility';\nimport { startHost } from '../host';\nimport { SIMULATOR_VERSIONS } from '../versions';\nimport { CLIENT_PATH, EVENTS_PATH, MANIFEST_URL, WEBVIEW_URL } from '../paths';\nimport { dashHandlers } from './dash';\nimport { askPermission } from './dash/permissions';\nimport { createElement, element } from './dom';\nimport { windowChannel, wireTransport } from './wire';\n\nconst MAX_LOG_ENTRIES = 500;\n\nconst screen = element<HTMLIFrameElement>('#screen');\nconst log = element<HTMLOListElement>('#log');\nconst errorBanner = element<HTMLPreElement>('#error');\nconst phone = element<HTMLDivElement>('.phone');\nconst schemeSelect = element<HTMLSelectElement>('#scheme');\nconst browserDark = matchMedia('(prefers-color-scheme: dark)');\n\ninterface RunningApp {\n readonly host: Host;\n readonly worker: Worker;\n}\n\nlet runningApp: RunningApp | null = null;\nlet launchCount = 0;\n\nasync function launch(): Promise<void> {\n stopRunningApp();\n launchCount += 1;\n const thisLaunch = launchCount;\n if (log.childElementCount > 0) {\n note('dot restarted');\n }\n\n let manifest: HostManifest;\n try {\n const response = await fetch(MANIFEST_URL);\n manifest = (await response.json()) as HostManifest;\n } catch {\n showError(`Nothing to run: ${MANIFEST_URL} is missing. Did the build fail?`);\n return;\n }\n // Another reload started while the manifest loaded; only the newest launch may start the dot.\n if (thisLaunch !== launchCount) {\n return;\n }\n\n // startHost checks too, but checking first means a refused dot never starts a worker.\n try {\n checkCompatibility(manifest, SIMULATOR_VERSIONS);\n } catch (error) {\n screen.src = 'about:blank';\n showError((error as Error).message);\n return;\n }\n\n const worker = new Worker(`${CLIENT_PATH}service-bridge.js`);\n const service = wireTransport(createAdaptorTransport(worker));\n const webview = wireTransport(windowChannel(() => screen.contentWindow));\n const host = startHost({\n logic: service,\n ui: webview,\n manifest,\n ...SIMULATOR_VERSIONS,\n systemContext: systemContext(),\n handlers: dashHandlers(phone, note),\n askPermission: (request, signal) => askPermission(phone, note, request, signal),\n observe: record,\n });\n worker.addEventListener('error', (event) => showError(`Service crashed: ${event.message}`));\n screen.src = WEBVIEW_URL;\n runningApp = { host, worker };\n}\n\nfunction stopRunningApp(): void {\n if (!runningApp) {\n return;\n }\n runningApp.host.stop();\n runningApp.worker.terminate();\n runningApp = null;\n}\n\nfunction goBack(): void {\n if (runningApp && !runningApp.host.back()) {\n note('back on the first page: a device would close the dot');\n }\n}\n\nconst ARROWS: Record<Direction, string> = {\n toHost: 'both --> host',\n fromHost: 'host --> both',\n toService: 'ui --> logic',\n toWebview: 'logic <-- ui',\n};\n\nfunction note(text: string): void {\n log.append(createElement('li', 'note', text));\n}\n\nfunction record(direction: Direction, message: Envelope): void {\n const entry = createElement('li', direction);\n const details = document.createElement('details');\n const summary = document.createElement('summary');\n const time = new Date().toLocaleTimeString([], { hour12: false });\n summary.append(\n createElement('span', 'time', time),\n createElement('span', 'arrow', ARROWS[direction]),\n createElement('span', 'type', message.type),\n );\n const payload = document.createElement('pre');\n payload.textContent = JSON.stringify(message.payload, null, 2);\n details.append(summary, payload);\n entry.append(details);\n if (message.type === 'error') {\n entry.classList.add('failed');\n }\n log.append(entry);\n while (log.childElementCount > MAX_LOG_ENTRIES) {\n log.firstElementChild?.remove();\n }\n log.scrollTop = log.scrollHeight;\n}\n\nfunction syncLaunch(): void {\n launch().catch((error: unknown) => {\n showError(`Could not start the dot: ${String(error)}`);\n });\n}\n\nfunction showError(message: string | null): void {\n errorBanner.hidden = message === null;\n errorBanner.textContent = message ?? '';\n}\n\nfunction systemContext(): SystemContext {\n return { scheme: schemeSelect.value as ColorScheme, appState: appState() };\n}\n\n// Leaving the simulator's tab stands in for leaving Dash.\nfunction appState(): AppState {\n if (document.visibilityState === 'hidden') {\n return 'background';\n }\n return 'active';\n}\n\nfunction browserScheme(): ColorScheme {\n return browserDark.matches ? 'dark' : 'light';\n}\n\nfunction changeScheme(scheme: ColorScheme): void {\n schemeSelect.value = scheme;\n phone.dataset.scheme = scheme;\n runningApp?.host.setSystemContext(systemContext());\n}\n\nconst events = new EventSource(EVENTS_PATH);\nevents.addEventListener('reload', () => {\n showError(null);\n syncLaunch();\n});\nevents.addEventListener('build-error', (event) => showError(String(event.data)));\n\nelement('#reload').addEventListener('click', syncLaunch);\nelement('#back').addEventListener('click', goBack);\nelement('#clear').addEventListener('click', () => log.replaceChildren());\nschemeSelect.addEventListener('change', () => changeScheme(schemeSelect.value as ColorScheme));\nbrowserDark.addEventListener('change', () => changeScheme(browserScheme()));\ndocument.addEventListener('visibilitychange', () => {\n runningApp?.host.setSystemContext(systemContext());\n});\n\nchangeScheme(browserScheme());\nsyncLaunch();\n"],"mappings":";;CACA,SAAS,gBAAgB,UAAU;EAClC,OAAO;GACN,OAAO,CAAC;GACR,QAAQ,CAAC;GACT,GAAG;EACJ;CACD;CAYA,SAAS,kBAAkB,WAAW;EACrC,MAAM,WAAW,CAAC;EAClB,KAAK,MAAM,YAAY,WAAW;GACjC,IAAI,SAAS,QAAQ,UAAU,MAAM,IAAI,MAAM,cAAc,SAAS,KAAK,mBAAmB;GAC9F,SAAS,SAAS,QAAQ;EAC3B;EACA,OAAO;CACR;CAgEA,MAAM,SAAS,gBAAgB;EAC9B,MAAM;EACN,OAAO;GACN,SAAS,CAAC,WAAW,WAAW;GAChC,UAAU;GACV,SAAS;EACV;EACA,QAAQ,CAAC,OAAO;EAChB,UAAU;CACX,CAAC;CAGD,MAAM,UAAU,gBAAgB;EAC/B,MAAM;EACN,UAAU;CACX,CAAC;CAGD,MAAM,QAAQ;EACb;EACA;EACA;CACD;CACA,MAAM,QAAQ;EACb;EACA;EACA;EACA;EACA;EACA;CACD;CACA,MAAM,eAAe;EACpB;EACA;EACA;EACA;EACA;CACD;CACA,MAAM,aAAa;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CAGA,MAAM,UAAU,gBAAgB;EAC/B,MAAM;EACN,OAAO,EAAE,MAAM,MAAM;EACrB,UAAU;CACX,CAAC;CACD,MAAM,cAAc,gBAAgB;EACnC,MAAM;EACN,OAAO,EAAE,OAAO,SAAS;EACzB,UAAU;CACX,CAAC;CACD,MAAM,SAAS,gBAAgB;EAC9B,MAAM;EACN,OAAO;GACN,MAAM;GACN,OAAO;EACR;EACA,UAAU;CACX,CAAC;CACD,MAAM,QAAQ,gBAAgB;EAC7B,MAAM;EACN,OAAO,EAAE,MAAM,aAAa;EAC5B,UAAU;CACX,CAAC;CAGD,MAAM,SAAS,gBAAgB;EAC9B,MAAM;EACN,UAAU;CACX,CAAC;CAGD,MAAM,OAAO,gBAAgB;EAC5B,MAAM;EACN,OAAO;GACN,MAAM;GACN,MAAM;GACN,MAAM;EACP;EACA,UAAU;EACV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AC5B,WAAW"}
|
|
1
|
+
{"version":3,"file":"simulator.js","names":[],"sources":["../../../../core/dist/index.js","../../src/compatibility.ts","../../src/host-calls.ts","../../src/permissions.ts","../../src/host.ts","../../src/versions.ts","../../src/paths.ts","../../src/client/dash/dev-server.ts","../../src/client/dash/system.ts","../../src/client/dom.ts","../../src/client/dash/ui.ts","../../src/client/dash/index.ts","../../src/client/dash/permissions.ts","../../src/client/wire.ts","../../src/client/simulator.ts"],"sourcesContent":["//#region src/view/component.ts\nfunction defineComponent(manifest) {\n\treturn {\n\t\tprops: {},\n\t\tevents: [],\n\t\t...manifest\n\t};\n}\nfunction eventProp(event) {\n\treturn `on${event.charAt(0).toUpperCase()}${event.slice(1)}`;\n}\nfunction isEventProp(name) {\n\tconst letterAfterOn = name.charAt(2);\n\treturn name.startsWith(\"on\") && letterAfterOn >= \"A\" && letterAfterOn <= \"Z\";\n}\nfunction eventName(prop) {\n\tconst name = prop.slice(2);\n\treturn name.charAt(0).toLowerCase() + name.slice(1);\n}\nfunction componentRegistry(manifests) {\n\tconst registry = {};\n\tfor (const manifest of manifests) {\n\t\tif (manifest.name in registry) throw new Error(`Component <${manifest.name}> is defined twice`);\n\t\tregistry[manifest.name] = manifest;\n\t}\n\treturn registry;\n}\n//#endregion\n//#region src/view/values.ts\nfunction toText(value) {\n\tswitch (typeof value) {\n\t\tcase \"string\": return value;\n\t\tcase \"number\":\n\t\tcase \"boolean\":\n\t\tcase \"bigint\": return String(value);\n\t\tcase \"object\": return value === null ? \"\" : JSON.stringify(value);\n\t\tdefault: return \"\";\n\t}\n}\nfunction toList(value) {\n\tif (Array.isArray(value)) return value;\n\tif (typeof value === \"object\" && value !== null && Symbol.iterator in value) return Array.from(value);\n\treturn [];\n}\n//#endregion\n//#region src/source/location.ts\nfunction createLocator(source) {\n\tconst lineStarts = [0];\n\tfor (let index = 0; index < source.length; index++) if (source[index] === \"\\n\") lineStarts.push(index + 1);\n\treturn (offset) => {\n\t\tlet low = 0;\n\t\tlet high = lineStarts.length - 1;\n\t\twhile (low < high) {\n\t\t\tconst middle = Math.floor((low + high + 1) / 2);\n\t\t\tif (lineStarts[middle] <= offset) low = middle;\n\t\t\telse high = middle - 1;\n\t\t}\n\t\treturn {\n\t\t\tline: low + 1,\n\t\t\tcolumn: offset - lineStarts[low] + 1,\n\t\t\toffset\n\t\t};\n\t};\n}\nfunction locationAt(source, offset) {\n\treturn createLocator(source)(offset);\n}\nfunction locatedMessage(message, file, location) {\n\tconst where = [\n\t\tfile,\n\t\tlocation?.line,\n\t\tlocation?.column\n\t].filter((part) => part !== void 0).join(\":\");\n\treturn where ? `${where}: ${message}` : message;\n}\n//#endregion\n//#region src/source/error.ts\nvar SourceError = class extends Error {\n\treason;\n\tfile;\n\tloc;\n\tconstructor(reason, file, location) {\n\t\tsuper(locatedMessage(reason, file, location));\n\t\tthis.reason = reason;\n\t\tthis.file = file;\n\t\tthis.loc = location;\n\t}\n};\n//#endregion\n//#region src/view/components/amount-input.ts\nconst AmountInput = defineComponent({\n\tname: \"AmountInput\",\n\tprops: {\n\t\tvalue: \"number\",\n\t\tcurrency: \"string\",\n\t\tdecimals: \"number\",\n\t\tlabel: \"string\",\n\t\tplaceholder: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/button.ts\nconst Button = defineComponent({\n\tname: \"Button\",\n\tprops: {\n\t\tvariant: [\"primary\", \"secondary\"],\n\t\tdisabled: \"boolean\",\n\t\tloading: \"boolean\"\n\t},\n\tevents: [\"click\"],\n\tchildren: \"text\"\n});\n//#endregion\n//#region src/view/components/options.ts\nconst SIZES = [\n\t\"small\",\n\t\"medium\",\n\t\"large\"\n];\nconst SPACES = [\n\t\"none\",\n\t\"small\",\n\t\"medium\",\n\t\"large\"\n];\nconst TONES = [\n\t\"default\",\n\t\"muted\",\n\t\"info\",\n\t\"success\",\n\t\"warning\",\n\t\"danger\"\n];\nconst STATUS_TONES = [\n\t\"default\",\n\t\"info\",\n\t\"success\",\n\t\"warning\",\n\t\"danger\"\n];\nconst ICON_NAMES = [\n\t\"arrow-down\",\n\t\"arrow-left\",\n\t\"arrow-right\",\n\t\"arrow-up\",\n\t\"bank\",\n\t\"bell\",\n\t\"bolt\",\n\t\"calendar\",\n\t\"card\",\n\t\"cart\",\n\t\"cash\",\n\t\"check\",\n\t\"chevron-down\",\n\t\"chevron-left\",\n\t\"chevron-right\",\n\t\"chevron-up\",\n\t\"clock\",\n\t\"close\",\n\t\"copy\",\n\t\"download\",\n\t\"edit\",\n\t\"error\",\n\t\"eye\",\n\t\"eye-off\",\n\t\"file\",\n\t\"gift\",\n\t\"grid\",\n\t\"heart\",\n\t\"help\",\n\t\"history\",\n\t\"home\",\n\t\"image\",\n\t\"info\",\n\t\"list\",\n\t\"location\",\n\t\"lock\",\n\t\"logout\",\n\t\"mail\",\n\t\"minus\",\n\t\"mobile\",\n\t\"more\",\n\t\"phone\",\n\t\"plus\",\n\t\"qr-code\",\n\t\"receipt\",\n\t\"refresh\",\n\t\"search\",\n\t\"send\",\n\t\"settings\",\n\t\"share\",\n\t\"star\",\n\t\"success\",\n\t\"trash\",\n\t\"upload\",\n\t\"user\",\n\t\"users\",\n\t\"wallet\",\n\t\"warning\",\n\t\"water\",\n\t\"wifi\"\n];\n//#endregion\n//#region src/view/components/carousel.ts\nconst Carousel = defineComponent({\n\tname: \"Carousel\",\n\tprops: {\n\t\tautoplay: \"boolean\",\n\t\tinterval: \"number\",\n\t\tloop: \"boolean\",\n\t\tindicator: [\"dots\", \"none\"],\n\t\tgap: SPACES,\n\t\teffect: [\"slide\", \"scale\"],\n\t\tindex: \"number\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/chip.ts\nconst Chip = defineComponent({\n\tname: \"Chip\",\n\tprops: {\n\t\tlabel: \"string\",\n\t\ticon: ICON_NAMES,\n\t\tselected: \"boolean\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"tap\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/code-input.ts\nconst CodeInput = defineComponent({\n\tname: \"CodeInput\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlength: \"number\",\n\t\tlabel: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\tsecure: \"boolean\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\", \"complete\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/divider.ts\nconst Divider = defineComponent({\n\tname: \"Divider\",\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/empty-state.ts\nconst EmptyState = defineComponent({\n\tname: \"EmptyState\",\n\tprops: {\n\t\ticon: ICON_NAMES,\n\t\ttitle: \"string\",\n\t\ttext: \"string\"\n\t},\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/feedback.ts\nconst Spinner = defineComponent({\n\tname: \"Spinner\",\n\tprops: { size: SIZES },\n\tchildren: \"none\"\n});\nconst ProgressBar = defineComponent({\n\tname: \"ProgressBar\",\n\tprops: { value: \"number\" },\n\tchildren: \"none\"\n});\nconst Notice = defineComponent({\n\tname: \"Notice\",\n\tprops: {\n\t\ttone: STATUS_TONES,\n\t\ttitle: \"string\"\n\t},\n\tchildren: \"text\"\n});\nconst Badge = defineComponent({\n\tname: \"Badge\",\n\tprops: { tone: STATUS_TONES },\n\tchildren: \"text\"\n});\n//#endregion\n//#region src/view/components/footer.ts\nconst Footer = defineComponent({\n\tname: \"Footer\",\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/grid.ts\nconst Grid = defineComponent({\n\tname: \"Grid\",\n\tprops: {\n\t\tcolumns: \"number\",\n\t\tgap: SPACES\n\t},\n\tchildren: \"elements\"\n});\nconst GridItem = defineComponent({\n\tname: \"GridItem\",\n\tprops: {\n\t\tlabel: \"string\",\n\t\ticon: ICON_NAMES,\n\t\timage: \"string\",\n\t\tbadge: \"string\"\n\t},\n\tevents: [\"tap\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/icon.ts\nconst Icon = defineComponent({\n\tname: \"Icon\",\n\tprops: {\n\t\tname: ICON_NAMES,\n\t\tsize: SIZES,\n\t\ttone: TONES\n\t},\n\tchildren: \"none\",\n\tinline: true\n});\n//#endregion\n//#region src/view/components/image.ts\nconst Image = defineComponent({\n\tname: \"Image\",\n\tprops: {\n\t\tsrc: \"string\",\n\t\talt: \"string\",\n\t\twidth: \"number\",\n\t\theight: \"number\",\n\t\tfit: [\"cover\", \"contain\"],\n\t\tshape: [\n\t\t\t\"rounded\",\n\t\t\t\"square\",\n\t\t\t\"circle\"\n\t\t]\n\t},\n\tevents: [\"load\", \"error\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/input.ts\nconst Input = defineComponent({\n\tname: \"Input\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tplaceholder: \"string\",\n\t\tlabel: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\tprefix: \"string\",\n\t\tsuffix: \"string\",\n\t\ttype: [\n\t\t\t\"text\",\n\t\t\t\"number\",\n\t\t\t\"email\",\n\t\t\t\"phone\",\n\t\t\t\"password\"\n\t\t],\n\t\tmaxLength: \"number\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\", \"submit\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/list.ts\nconst List = defineComponent({\n\tname: \"List\",\n\tprops: { size: [\"sm\", \"md\"] },\n\tchildren: \"elements\"\n});\nconst ListItem = defineComponent({\n\tname: \"ListItem\",\n\tprops: {\n\t\ttitle: \"string\",\n\t\tsubtitle: \"string\",\n\t\tvalue: \"string\",\n\t\ticon: ICON_NAMES,\n\t\timage: \"string\"\n\t},\n\tevents: [\"tap\"],\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/overlays.ts\nconst Sheet = defineComponent({\n\tname: \"Sheet\",\n\tprops: {\n\t\topen: \"boolean\",\n\t\ttitle: \"string\",\n\t\tshowCloseIcon: \"boolean\"\n\t},\n\tevents: [\"close\"],\n\tchildren: \"elements\"\n});\nconst Toast = defineComponent({\n\tname: \"Toast\",\n\tprops: {\n\t\tmessage: \"string\",\n\t\ttone: STATUS_TONES,\n\t\tduration: \"number\"\n\t},\n\tevents: [\"hide\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/qr-code.ts\nconst QRCode = defineComponent({\n\tname: \"QRCode\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tsize: \"number\",\n\t\tlabel: \"string\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/select.ts\nconst Select = defineComponent({\n\tname: \"Select\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tplaceholder: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"elements\"\n});\nconst Option = defineComponent({\n\tname: \"Option\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/skeleton.ts\nconst Skeleton = defineComponent({\n\tname: \"Skeleton\",\n\tprops: {\n\t\tshape: [\n\t\t\t\"text\",\n\t\t\t\"circle\",\n\t\t\t\"box\"\n\t\t],\n\t\tlines: \"number\",\n\t\theight: \"number\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/tabs.ts\nconst Tabs = defineComponent({\n\tname: \"Tabs\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tvariant: [\"underline\", \"segmented\"]\n\t},\n\tevents: [\"change\"],\n\tchildren: \"elements\"\n});\nconst Tab = defineComponent({\n\tname: \"Tab\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tbadge: \"number\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/text.ts\nconst Text = defineComponent({\n\tname: \"Text\",\n\tprops: {\n\t\tvariant: [\n\t\t\t\"title\",\n\t\t\t\"body\",\n\t\t\t\"caption\"\n\t\t],\n\t\ttone: TONES,\n\t\tweight: [\n\t\t\t\"regular\",\n\t\t\t\"medium\",\n\t\t\t\"bold\"\n\t\t],\n\t\talign: [\n\t\t\t\"start\",\n\t\t\t\"center\",\n\t\t\t\"end\"\n\t\t],\n\t\tmaxLines: \"number\"\n\t},\n\tchildren: \"text\",\n\tinline: true\n});\n//#endregion\n//#region src/view/components/text-area.ts\nconst TextArea = defineComponent({\n\tname: \"TextArea\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tplaceholder: \"string\",\n\t\tlabel: \"string\",\n\t\thint: \"string\",\n\t\terror: \"string\",\n\t\trows: \"number\",\n\t\tmaxLength: \"number\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/toggles.ts\nconst Switch = defineComponent({\n\tname: \"Switch\",\n\tprops: {\n\t\tchecked: \"boolean\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\nconst Checkbox = defineComponent({\n\tname: \"Checkbox\",\n\tprops: {\n\t\tchecked: \"boolean\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"none\"\n});\nconst RadioGroup = defineComponent({\n\tname: \"RadioGroup\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tevents: [\"change\"],\n\tchildren: \"elements\"\n});\nconst Radio = defineComponent({\n\tname: \"Radio\",\n\tprops: {\n\t\tvalue: \"string\",\n\t\tlabel: \"string\",\n\t\tdisabled: \"boolean\"\n\t},\n\tchildren: \"none\"\n});\n//#endregion\n//#region src/view/components/view.ts\nconst View = defineComponent({\n\tname: \"View\",\n\tprops: {\n\t\tgap: SPACES,\n\t\tdirection: [\"column\", \"row\"],\n\t\talign: [\n\t\t\t\"stretch\",\n\t\t\t\"start\",\n\t\t\t\"center\",\n\t\t\t\"end\"\n\t\t],\n\t\tjustify: [\n\t\t\t\"start\",\n\t\t\t\"center\",\n\t\t\t\"end\",\n\t\t\t\"between\"\n\t\t],\n\t\twrap: \"boolean\",\n\t\tgrow: \"boolean\",\n\t\tpadding: SPACES,\n\t\tpaddingTop: SPACES,\n\t\tpaddingStart: SPACES,\n\t\tpaddingEnd: SPACES,\n\t\tpaddingBottom: SPACES,\n\t\tvariant: [\"plain\", \"card\"]\n\t},\n\tevents: [\"tap\"],\n\tchildren: \"elements\"\n});\n//#endregion\n//#region src/view/components/index.ts\nconst builtinComponents = {\n\tAmountInput,\n\tBadge,\n\tButton,\n\tCarousel,\n\tCheckbox,\n\tChip,\n\tCodeInput,\n\tDivider,\n\tEmptyState,\n\tFooter,\n\tGrid,\n\tGridItem,\n\tIcon,\n\tImage,\n\tInput,\n\tList,\n\tListItem,\n\tNotice,\n\tOption,\n\tProgressBar,\n\tQRCode,\n\tRadio,\n\tRadioGroup,\n\tSelect,\n\tSheet,\n\tSkeleton,\n\tSpinner,\n\tSwitch,\n\tTab,\n\tTabs,\n\tText,\n\tTextArea,\n\tToast,\n\tView\n};\nconst builtinRegistry = componentRegistry(Object.values(builtinComponents));\n//#endregion\n//#region src/event/emitter.ts\nvar EventEmitter = class {\n\t#listeners = /* @__PURE__ */ new Map();\n\ton(name, listener) {\n\t\tconst listeners = this.#listeners.get(name) ?? /* @__PURE__ */ new Set();\n\t\tthis.#listeners.set(name, listeners);\n\t\tlisteners.add(listener);\n\t\treturn () => listeners.delete(listener);\n\t}\n\temit(name, ...args) {\n\t\tthis.#listeners.get(name)?.forEach((listener) => listener(...args));\n\t}\n};\n//#endregion\n//#region src/event/core.ts\nfunction createEvent(type, detail = {}, data = {}) {\n\treturn {\n\t\ttype,\n\t\tdetail,\n\t\tdata\n\t};\n}\n//#endregion\n//#region src/host/host.ts\nfunction hostTransport() {\n\tconst transport = globalThis.__hostTransport;\n\tif (!transport) throw new Error(\"No Dot host found: expected `globalThis.__hostTransport` to be available at runtime. Dots run inside the Dash App, or a simulator via `dotctl dev`.\");\n\treturn transport;\n}\n//#endregion\n//#region src/host/context.ts\nconst DEFAULT_SYSTEM_CONTEXT = {\n\tplatform: \"ios\",\n\tscheme: \"light\",\n\tappState: \"active\"\n};\n//#endregion\n//#region src/host/calls.ts\nvar HostError = class extends Error {\n\tname = \"HostError\";\n\tcode;\n\tconstructor(code, message) {\n\t\tsuper(message);\n\t\tthis.code = code;\n\t}\n};\nlet connectedCaller = null;\nfunction connectHost(caller) {\n\tconnectedCaller = caller;\n}\nfunction callHost(method, params, options = {}) {\n\tif (!connectedCaller) {\n\t\tconst error = new HostError(\"unsupported\", `No host to run \"${method}\": host calls run in the service`);\n\t\treturn createHostRequest(Promise.reject(error));\n\t}\n\treturn connectedCaller(method, params, options);\n}\nfunction createHostRequest(promise, cancel = () => {}) {\n\tconst request = promise;\n\trequest.cancel = cancel;\n\treturn request;\n}\n//#endregion\n//#region src/host/permissions.ts\nconst PERMISSIONS = [\"account\"];\nfunction isPermission(value) {\n\treturn PERMISSIONS.includes(value);\n}\n//#endregion\n//#region src/host/files.ts\nconst DOT_FILE_PATH_MAX_LENGTH = 512;\nconst MAX_NAME_LENGTH = 255;\nfunction dotFilePathProblem(path, { allowRoot = false } = {}) {\n\tif (path === \"\") return allowRoot ? null : \"A path is needed, such as \\\"receipts/42.pdf\\\"\";\n\tif (path.length > 512) return `\"${path.slice(0, 40)}…\" is longer than 512 characters`;\n\tif (path.startsWith(\"/\")) return `\"${path}\" starts with \"/\": paths are relative to the dot's storage, such as \"receipts/42.pdf\"`;\n\tif ([...path].some((char) => char === \"\\\\\" || char.charCodeAt(0) < 32)) return `\"${path}\" has a backslash or a control character`;\n\tfor (const name of path.split(\"/\")) {\n\t\tif (name === \"\" || name === \".\" || name === \"..\") return `\"${path}\" has an empty, \".\" or \"..\" part: write each folder once, such as \"receipts/42.pdf\"`;\n\t\tif (name.length > MAX_NAME_LENGTH) return `\"${path}\" has a name longer than ${MAX_NAME_LENGTH} characters`;\n\t}\n\treturn null;\n}\n//#endregion\n//#region src/host/network.ts\nconst LABEL = \"[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\";\nconst NETWORK_HOST_PATTERN = new RegExp(`^(?:\\\\*\\\\.${LABEL}(?:\\\\.${LABEL})+|${LABEL}(?:\\\\.${LABEL})*)$`);\nconst NETWORK_HOST_MAX_LENGTH = 253;\nfunction isNetworkHost(value) {\n\treturn value.length <= 253 && NETWORK_HOST_PATTERN.test(value);\n}\nfunction allowsHost(hosts, host) {\n\tconst name = host.toLowerCase().replace(/\\.$/, \"\");\n\treturn hosts.some((pattern) => pattern.startsWith(\"*.\") ? name.endsWith(pattern.slice(1)) : name === pattern);\n}\n//#endregion\n//#region src/version/semantic-version.ts\nconst SEMVER_PATTERN = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\nfunction isSemanticVersion(value) {\n\treturn typeof value === \"string\" && SEMVER_PATTERN.test(value);\n}\nfunction majorVersion(version) {\n\treturn parseVersion(version).major;\n}\nfunction isVersionAtLeast(version, minimum) {\n\treturn compareVersions(version, minimum) >= 0;\n}\nfunction compareVersions(left, right) {\n\tconst leftVersion = parseVersion(left);\n\tconst rightVersion = parseVersion(right);\n\tconst differences = [\n\t\tleftVersion.major - rightVersion.major,\n\t\tleftVersion.minor - rightVersion.minor,\n\t\tleftVersion.patch - rightVersion.patch\n\t];\n\tfor (const difference of differences) if (difference !== 0) return difference;\n\treturn comparePrereleases(leftVersion.prerelease, rightVersion.prerelease);\n}\nfunction parseVersion(version) {\n\tconst match = SEMVER_PATTERN.exec(version);\n\tif (!match) throw new Error(`\"${version}\" is not a semantic version`);\n\tconst [, major, minor, patch, prerelease] = match;\n\treturn {\n\t\tmajor: Number(major),\n\t\tminor: Number(minor),\n\t\tpatch: Number(patch),\n\t\tprerelease: prerelease === void 0 ? [] : prerelease.split(\".\")\n\t};\n}\nfunction comparePrereleases(left, right) {\n\tif (left.length === 0 || right.length === 0) return right.length - left.length;\n\tconst shared = Math.min(left.length, right.length);\n\tfor (let index = 0; index < shared; index++) {\n\t\tconst order = compareIdentifiers(left[index], right[index]);\n\t\tif (order !== 0) return order;\n\t}\n\treturn left.length - right.length;\n}\nfunction compareIdentifiers(left, right) {\n\tconst leftIsNumber = /^\\d+$/.test(left);\n\tconst rightIsNumber = /^\\d+$/.test(right);\n\tif (leftIsNumber && rightIsNumber) return Number(left) - Number(right);\n\tif (leftIsNumber) return -1;\n\tif (rightIsNumber) return 1;\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n}\n//#endregion\n//#region src/host/react.ts\nconst REACT_HOST_PATH = \"/__dot/react/\";\nconst REACT_HOST_MODULES = {\n\treact: \"react.js\",\n\t\"react/jsx-runtime\": \"react-jsx-runtime.js\",\n\t\"react-dom\": \"react-dom.js\",\n\t\"react-dom/client\": \"react-dom-client.js\"\n};\nfunction reactHostUrl(dotReactVersion, file) {\n\treturn `${REACT_HOST_PATH}${majorVersion(dotReactVersion)}/${file}`;\n}\nfunction isReactCompatible(hostVersion, dotVersion) {\n\treturn majorVersion(hostVersion) === majorVersion(dotVersion) && isVersionAtLeast(hostVersion, dotVersion);\n}\nfunction newestReactOfMajor(versions, major) {\n\treturn versions.filter((version) => majorVersion(version) === major).sort(compareVersions).at(-1);\n}\n//#endregion\n//#region src/protocol/transport.ts\nfunction createAdaptorTransport(adapter) {\n\treturn {\n\t\tpost: (message) => adapter.postMessage(message),\n\t\tlisten(listener) {\n\t\t\tconst onMessage = (event) => listener(event.data);\n\t\t\tadapter.addEventListener(\"message\", onMessage);\n\t\t\treturn () => adapter.removeEventListener(\"message\", onMessage);\n\t\t}\n\t};\n}\nfunction createTransportPair() {\n\tconst firstListeners = /* @__PURE__ */ new Set();\n\tconst secondListeners = /* @__PURE__ */ new Set();\n\tconst createSide = (ownListeners, otherListeners) => ({\n\t\tpost: (message) => {\n\t\t\tconst copy = JSON.parse(JSON.stringify(message));\n\t\t\totherListeners.forEach((listener) => listener(copy));\n\t\t},\n\t\tlisten(listener) {\n\t\t\townListeners.add(listener);\n\t\t\treturn () => ownListeners.delete(listener);\n\t\t}\n\t});\n\treturn [createSide(firstListeners, secondListeners), createSide(secondListeners, firstListeners)];\n}\nconst PAGE_HOOKS = Object.keys({\n\tonLoad: true,\n\tonShow: true,\n\tonHide: true,\n\tonUnload: true\n});\n//#endregion\n//#region src/page/navigation.ts\nconst MAX_STACK_DEPTH = 8;\nconst PAGE_ID = /^[A-Za-z0-9_-]+(?:\\/[A-Za-z0-9_-]+)*$/;\nfunction isPageId(value) {\n\treturn PAGE_ID.test(value);\n}\nvar NavigationStack = class {\n\tlimit;\n\t#pages = [];\n\t#nextInstanceId = 1;\n\tconstructor(limit = 8) {\n\t\tthis.limit = limit;\n\t}\n\tget pages() {\n\t\treturn this.#pages;\n\t}\n\tget top() {\n\t\treturn this.#pages.at(-1);\n\t}\n\t/**\n\t* Applies a navigation, or refuses it and returns false: a push onto a full stack, or going back\n\t* from the first page (which the host handles itself, e.g. by closing the dot).\n\t*/\n\tapply(navigation) {\n\t\tswitch (navigation.action) {\n\t\t\tcase \"push\":\n\t\t\t\tif (this.#pages.length >= this.limit) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"replace\":\n\t\t\t\tthis.#pages.pop();\n\t\t\t\tbreak;\n\t\t\tcase \"reset\":\n\t\t\t\tthis.#pages = [];\n\t\t\t\tbreak;\n\t\t\tcase \"back\": {\n\t\t\t\tconst count = Math.min(navigation.delta, this.#pages.length - 1);\n\t\t\t\tif (count < 1) return false;\n\t\t\t\tthis.#pages = this.#pages.slice(0, -count);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tconst { page, options } = navigation;\n\t\tthis.#pages = [...this.#pages, {\n\t\t\tinstanceId: this.#nextInstanceId++,\n\t\t\tpage,\n\t\t\toptions\n\t\t}];\n\t\treturn true;\n\t}\n};\n//#endregion\n//#region src/page/state.ts\nfunction applyChanges(state, changes) {\n\tconst next = { ...state };\n\tfor (const [key, value] of Object.entries(changes)) if (value !== void 0) next[key] = value;\n\treturn next;\n}\n//#endregion\n//#region src/page/bars.ts\nconst HEX_COLOR = /^#[0-9a-fA-F]{6}$/;\nfunction checkNavigationBar(options) {\n\tconst { title, hidden, backgroundColor, textColor } = options;\n\tif (title !== void 0 && typeof title !== \"string\") throw new TypeError(\"The navigation bar's title must be text\");\n\tif (hidden !== void 0 && typeof hidden !== \"boolean\") throw new TypeError(\"The navigation bar's `hidden` must be true or false\");\n\tfor (const [name, color] of Object.entries({\n\t\tbackgroundColor,\n\t\ttextColor\n\t})) if (color !== void 0 && (typeof color !== \"string\" || !HEX_COLOR.test(color))) throw new TypeError(`The navigation bar's ${name} must be a color such as \"#1A73E8\"`);\n}\nfunction checkTabBar(options) {\n\tif (options.hidden !== void 0 && typeof options.hidden !== \"boolean\") throw new TypeError(\"The tab bar's `hidden` must be true or false\");\n}\nfunction checkConfigs(configs) {\n\tcheckNavigationBar(configs.navigationBar ?? {});\n\tcheckTabBar(configs.tabBar ?? {});\n}\nfunction mergeConfigs(...configs) {\n\tconst bars = {\n\t\tnavigationBar: {},\n\t\ttabBar: {}\n\t};\n\tfor (const config of configs) {\n\t\tbars.navigationBar = {\n\t\t\t...bars.navigationBar,\n\t\t\t...config?.navigationBar\n\t\t};\n\t\tbars.tabBar = {\n\t\t\t...bars.tabBar,\n\t\t\t...config?.tabBar\n\t\t};\n\t}\n\treturn bars;\n}\n//#endregion\n//#region src/messageChannel.ts\nvar MessageChannel = class {\n\t#transport;\n\t#handlers = /* @__PURE__ */ new Map();\n\tconstructor(transport) {\n\t\tthis.#transport = transport;\n\t}\n\tsend(type, payload) {\n\t\tthis.#transport.post({\n\t\t\ttype,\n\t\t\tpayload\n\t\t});\n\t}\n\thandle(type, handler) {\n\t\tconst previous = this.#handlers.get(type);\n\t\tthis.#handlers.set(type, handler);\n\t\treturn previous;\n\t}\n\tlisten(onError) {\n\t\treturn this.#transport.listen((rawMessage) => {\n\t\t\tconst message = rawMessage;\n\t\t\tconst handler = this.#handlers.get(message.type);\n\t\t\tif (!handler) {\n\t\t\t\tonError(/* @__PURE__ */ new Error(`No handler registered for message \"${message.type}\"`), message);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\thandler(message.payload);\n\t\t\t} catch (error) {\n\t\t\t\tonError(error, message);\n\t\t\t}\n\t\t});\n\t}\n};\n//#endregion\nexport { AmountInput, Badge, Button, Carousel, Checkbox, Chip, CodeInput, DEFAULT_SYSTEM_CONTEXT, DOT_FILE_PATH_MAX_LENGTH, Divider, EmptyState, EventEmitter, Footer, Grid, GridItem, HostError, ICON_NAMES, Icon, Image, Input, List, ListItem, MAX_STACK_DEPTH, MessageChannel, NETWORK_HOST_MAX_LENGTH, NETWORK_HOST_PATTERN, NavigationStack, Notice, Option, PAGE_HOOKS, PERMISSIONS, ProgressBar, QRCode, REACT_HOST_MODULES, REACT_HOST_PATH, Radio, RadioGroup, SEMVER_PATTERN, SIZES, STATUS_TONES, Select, Sheet, Skeleton, SourceError, Spinner, Switch, TONES, Tab, Tabs, Text, TextArea, Toast, View, allowsHost, applyChanges, builtinComponents, builtinRegistry, callHost, checkConfigs, checkNavigationBar, checkTabBar, compareVersions, componentRegistry, connectHost, createAdaptorTransport, createEvent, createHostRequest, createLocator, createTransportPair, defineComponent, dotFilePathProblem, eventName, eventProp, hostTransport, isEventProp, isNetworkHost, isPageId, isPermission, isReactCompatible, isSemanticVersion, isVersionAtLeast, locatedMessage, locationAt, majorVersion, mergeConfigs, newestReactOfMajor, reactHostUrl, toList, toText };\n\n//# sourceMappingURL=index.js.map","import { isReactCompatible, isVersionAtLeast, majorVersion } from '@monimesl/dot-core';\n\nimport type { HostManifest } from './manifest';\n\nexport type IncompatibilityReason = 'runtimeTooOld' | 'dashTooOld' | 'reactUnavailable';\n\n// The two versions a host knows about itself.\nexport interface HostVersions {\n // The Dash version this host is, checked against the dot's `dash.minVersion`.\n readonly dashVersion: string;\n // The oldest @monimesl/dot-runtime this host runs. Dots built with an older one must be rebuilt.\n readonly minRuntimeVersion: string;\n // The React versions the host ships. Left out by a host that serves the React the dot was built\n // with, as the simulator does.\n readonly reactVersions?: readonly string[] | undefined;\n}\n\n// Why a host refuses to open a dot: it was built with a runtime older than the host runs, it needs\n// a newer Dash than the host is, or it imports a React the host doesn't ship.\nexport class IncompatibleDotError extends Error {\n override readonly name = 'IncompatibleDotError';\n readonly reason: IncompatibilityReason;\n\n constructor(reason: IncompatibilityReason, message: string) {\n super(message);\n this.reason = reason;\n }\n}\n\n// Throws an IncompatibleDotError when a host with these versions cannot run the dot.\nexport function checkCompatibility(\n manifest: HostManifest,\n { dashVersion, minRuntimeVersion, reactVersions }: HostVersions,\n): void {\n if (!isVersionAtLeast(manifest.runtime, minRuntimeVersion)) {\n throw new IncompatibleDotError(\n 'runtimeTooOld',\n `This dot was built with Dot runtime ${manifest.runtime}, but this host runs ${minRuntimeVersion} or newer. ` +\n 'Rebuild it with a newer @monimesl/dot-runtime.',\n );\n }\n const minDashVersion = manifest.dash?.minVersion;\n if (minDashVersion !== undefined && !isVersionAtLeast(dashVersion, minDashVersion)) {\n throw new IncompatibleDotError(\n 'dashTooOld',\n `This dot needs Dash ${minDashVersion} or newer, and this is Dash ${dashVersion}.`,\n );\n }\n if (\n reactVersions !== undefined &&\n !reactVersions.some((version) => isReactCompatible(version, manifest.react))\n ) {\n throw new IncompatibleDotError(\n 'reactUnavailable',\n `This dot needs React ${manifest.react} or a newer ${majorVersion(manifest.react)}.x, which this host doesn't ship.`,\n );\n }\n}\n","import type {\n DotPermission,\n HostErrorCode,\n HostResult,\n LogicLayerMessages,\n} from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\nimport type { PermissionGate } from './permissions';\n\nexport interface HostCall {\n readonly method: string;\n readonly params: unknown;\n // Aborted when the call ends early: cancelled, out of time, or dismissed with its page.\n readonly signal: AbortSignal;\n}\n\n// Runs one host method. Throw a `HostError` to fail with its code; anything else fails as `failed`.\nexport type HostHandler = (call: HostCall) => unknown;\n\n// A method that needs a permission: it runs only if the dot declared it and the person allowed it.\nexport interface PermissionedHandler {\n readonly permission: DotPermission;\n readonly handle: HostHandler;\n}\n\nexport type HostHandlers = Readonly<Record<string, HostHandler | PermissionedHandler>>;\n\nconst UI_METHOD_PREFIX = 'dash.ui.';\n\ninterface RunningCall {\n readonly method: string;\n readonly controller: AbortController;\n timer?: ReturnType<typeof setTimeout>;\n}\n\n// Runs the service's host calls with `handlers`, and answers each call exactly once.\nexport class HostCallRunner {\n readonly #handlers: HostHandlers;\n readonly #permissions: PermissionGate;\n readonly #answer: (result: HostResult) => void;\n readonly #running = new Map<number, RunningCall>();\n\n constructor(\n handlers: HostHandlers,\n permissions: PermissionGate,\n answer: (result: HostResult) => void,\n ) {\n this.#handlers = handlers;\n this.#permissions = permissions;\n this.#answer = answer;\n }\n\n run({ id, method, params, timeout }: LogicLayerMessages['hostCall']): void {\n const entry = this.#handlers[method];\n if (!entry) {\n this.#answer({ id, error: { code: 'unsupported', message: `This host has no \"${method}\"` } });\n return;\n }\n const call: RunningCall = { method, controller: new AbortController() };\n if (timeout !== undefined) {\n call.timer = setTimeout(() => {\n this.#fail(id, new HostError('timeout', `\"${method}\" took longer than ${timeout}ms`));\n }, timeout);\n }\n this.#running.set(id, call);\n void this.#invoke(id, entry, { method, params, signal: call.controller.signal });\n }\n\n // The service stopped waiting, so the call ends without an answer.\n cancel(id: number): void {\n this.#end(id)?.controller.abort();\n }\n\n // Dialogs belong to the page on top: when it changes, the ones still open are dismissed.\n dismissUI(): void {\n for (const [id, call] of this.#running) {\n if (call.method.startsWith(UI_METHOD_PREFIX)) {\n this.#fail(id, new HostError('cancelled', 'The page it was shown on is no longer on top'));\n }\n }\n }\n\n async #invoke(\n id: number,\n entry: HostHandler | PermissionedHandler,\n call: HostCall,\n ): Promise<void> {\n try {\n if (typeof entry === 'function') {\n this.#succeed(id, await entry(call));\n return;\n }\n await this.#permissions.check(call.method, entry.permission, call.signal);\n this.#succeed(id, await entry.handle(call));\n } catch (error) {\n this.#fail(id, error);\n }\n }\n\n #succeed(id: number, value: unknown): void {\n if (this.#end(id)) {\n this.#answer({ id, value });\n }\n }\n\n #fail(id: number, error: unknown): void {\n const call = this.#end(id);\n if (!call) {\n return;\n }\n call.controller.abort();\n this.#answer({ id, error: describeError(error) });\n }\n\n #end(id: number): RunningCall | undefined {\n const call = this.#running.get(id);\n if (call) {\n this.#running.delete(id);\n clearTimeout(call.timer);\n }\n return call;\n }\n}\n\nfunction describeError(error: unknown): { code: HostErrorCode; message: string } {\n if (error instanceof HostError) {\n return { code: error.code, message: error.message };\n }\n return { code: 'failed', message: error instanceof Error ? error.message : String(error) };\n}\n","import type { DotPermission } from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\n// A dot asking for a permission it declared, the first time a call needs it.\nexport interface PermissionRequest {\n readonly dotName: string;\n readonly permission: DotPermission;\n // Why the dot needs it, from its dot.json.\n readonly reason: string;\n}\n\n// Each permission a dot declared in its dot.json, with the reason Dash shows the person.\nexport type DeclaredPermissions = Readonly<Partial<Record<string, string>>>;\n\n// Asks the person, and resolves with whether they allowed it. `signal` aborts when the call that\n// needs the permission ends first; the host then takes its prompt down and rejects.\nexport type AskPermission = (request: PermissionRequest, signal: AbortSignal) => Promise<boolean>;\n\n// Lets a call that needs a permission through only if the dot declared it and the person allowed\n// it. The person is asked once per run; the answer, yes or no, is kept.\nexport class PermissionGate {\n readonly #dotName: string;\n readonly #declared: DeclaredPermissions;\n readonly #ask: AskPermission;\n readonly #answers = new Map<DotPermission, boolean>();\n\n constructor(dotName: string, declared: DeclaredPermissions, ask: AskPermission) {\n this.#dotName = dotName;\n this.#declared = declared;\n this.#ask = ask;\n }\n\n // Rejects with a `denied` HostError when the call may not run.\n async check(method: string, permission: DotPermission, signal: AbortSignal): Promise<void> {\n const reason = this.#declared[permission];\n if (reason === undefined) {\n throw new HostError(\n 'denied',\n `\"${method}\" needs the \"${permission}\" permission. Add it to dot.json's permissions, with the reason Dash shows the person.`,\n );\n }\n let allowed = this.#answers.get(permission);\n if (allowed === undefined) {\n allowed = await this.#ask({ dotName: this.#dotName, permission, reason }, signal);\n this.#answers.set(permission, allowed);\n }\n if (!allowed) {\n throw new HostError('denied', `The person did not allow \"${permission}\"`);\n }\n }\n}\n","import type {\n Envelope,\n HostLayerMessages,\n HostResult,\n LogicLayerMessages,\n Navigation,\n PageBars,\n StackEntry,\n SystemContext,\n Transport,\n} from '@monimesl/dot-core';\nimport { NavigationStack } from '@monimesl/dot-core';\n\nimport type { HostVersions } from './compatibility';\nimport { checkCompatibility } from './compatibility';\nimport type { HostHandlers } from './host-calls';\nimport { HostCallRunner } from './host-calls';\nimport type { HostManifest } from './manifest';\nimport type { AskPermission } from './permissions';\nimport { PermissionGate } from './permissions';\n\nexport type Direction = 'toService' | 'toWebview' | 'toHost' | 'fromHost';\n\n// What Dash's bars show for the page on top: the dot's name as the title, unless the page set one.\nexport interface HostBars {\n readonly title: string;\n readonly navigationBarHidden: boolean;\n // As #RRGGBB, or undefined for Dash's own colors.\n readonly navigationBarColor: string | undefined;\n readonly navigationBarTextColor: string | undefined;\n readonly tabBarHidden: boolean;\n}\n\nexport interface HostOptions extends HostVersions {\n ui: Transport;\n logic: Transport;\n manifest: HostManifest;\n systemContext: SystemContext;\n // The methods dots may call, such as `dash.ui.alert`; any other is answered `unsupported`.\n handlers?: HostHandlers;\n // Asks the person for a permission the dot declared, the first time a method needs it.\n askPermission: AskPermission;\n observe?: (direction: Direction, message: Envelope) => void;\n // Opened in place of the dot's first page, such as the pages open before it reloaded. Pages the\n // dot no longer has are left out.\n restorePages?: readonly StackEntry[];\n // Called when what Dash's bars show changes, as when a page opens or sets its bars.\n onBarsChange?: (bars: HostBars, pages: readonly StackEntry[]) => void;\n}\n\nexport interface Host {\n // The open pages, first page first.\n readonly pages: readonly StackEntry[];\n stop(): void;\n // false on the first page, where a device closes the dot instead.\n back(): boolean;\n setSystemContext(context: SystemContext): void;\n}\n\n// The host contract in JavaScript; native hosts implement the same in Swift or Kotlin.\n// Throws an IncompatibleDotError, before either layer hears anything, if it cannot run the dot.\nexport function startHost({\n logic,\n ui,\n manifest,\n dashVersion,\n minRuntimeVersion,\n systemContext,\n handlers = {},\n askPermission,\n observe,\n restorePages = [],\n onBarsChange,\n}: HostOptions): Host {\n checkCompatibility(manifest, { dashVersion, minRuntimeVersion });\n const stack = new NavigationStack();\n let context = systemContext;\n const permissions = new PermissionGate(manifest.name, manifest.permissions ?? {}, askPermission);\n const calls = new HostCallRunner(handlers, permissions, (result) => {\n const message: Envelope<'hostResult', HostResult> = { type: 'hostResult', payload: result };\n observe?.('fromHost', message);\n logic.post(message);\n });\n const broadcast = (message: Envelope) => {\n observe?.('fromHost', message);\n ui.post(message);\n logic.post(message);\n };\n // What each open page set in Dash's bars, by instance.\n const barsByInstance = new Map<number, PageBars>();\n const showBars = () => {\n const top = stack.top;\n const bars = top && barsByInstance.get(top.instanceId);\n onBarsChange?.(\n {\n title: bars?.navigationBar.title ?? manifest.name,\n navigationBarHidden: bars?.navigationBar.hidden ?? false,\n navigationBarColor: bars?.navigationBar.backgroundColor,\n navigationBarTextColor: bars?.navigationBar.textColor,\n tabBarHidden: bars?.tabBar.hidden ?? false,\n },\n stack.pages,\n );\n };\n const syncStack = () => {\n const message: Envelope<'syncStack', HostLayerMessages['syncStack']> = {\n type: 'syncStack',\n payload: { pages: stack.pages, limit: stack.limit },\n };\n broadcast(message);\n const open = new Set(stack.pages.map((entry) => entry.instanceId));\n for (const instanceId of barsByInstance.keys()) {\n if (!open.has(instanceId)) {\n barsByInstance.delete(instanceId);\n }\n }\n showBars();\n };\n const syncSystemContext = () => {\n const message: Envelope<'syncSystemContext', HostLayerMessages['syncSystemContext']> = {\n type: 'syncSystemContext',\n payload: context,\n };\n broadcast(message);\n };\n const navigate = (navigation: Navigation): boolean => {\n if (navigation.action !== 'back' && !manifest.pages.includes(navigation.page)) {\n return false;\n }\n const previousTop = stack.top;\n if (!stack.apply(navigation)) {\n return false;\n }\n syncStack();\n if (stack.top !== previousTop) {\n calls.dismissUI();\n }\n return true;\n };\n\n const openFirstPages = () => {\n const [first, ...rest] = restorePages.filter((entry) => manifest.pages.includes(entry.page));\n if (!first) {\n navigate({ action: 'reset', page: manifest.entry, options: {} });\n return;\n }\n stack.apply({ action: 'reset', page: first.page, options: first.options });\n for (const entry of rest) {\n stack.apply({ action: 'push', page: entry.page, options: entry.options });\n }\n syncStack();\n };\n\n // Only the page on top may navigate; a request from a page below it is dropped.\n const navigateFromPage = ({ from, ...navigation }: LogicLayerMessages['navigate']) => {\n if (from === stack.top?.instanceId) {\n navigate(navigation);\n }\n };\n // Service messages meant for the host itself; every other one is relayed to the webview.\n const hostMessageHandlers = new Map<string, (payload: unknown) => void>([\n ['navigate', (payload) => navigateFromPage(payload as LogicLayerMessages['navigate'])],\n ['hostCall', (payload) => calls.run(payload as LogicLayerMessages['hostCall'])],\n ['hostCancel', (payload) => calls.cancel((payload as LogicLayerMessages['hostCancel']).id)],\n [\n 'pageBars',\n (payload) => {\n const { instanceId, ...bars } = payload as LogicLayerMessages['pageBars'];\n barsByInstance.set(instanceId, bars);\n showBars();\n },\n ],\n ]);\n\n const stopService = logic.listen((raw) => {\n const message = raw as Envelope;\n const handleHostMessage = hostMessageHandlers.get(message.type);\n if (handleHostMessage) {\n observe?.('toHost', message);\n handleHostMessage(message.payload);\n return;\n }\n observe?.('toWebview', message);\n ui.post(message);\n });\n const stopWebview = ui.listen((raw) => {\n const message = raw as Envelope;\n observe?.('toService', message);\n logic.post(message);\n if (message.type === 'connect') {\n syncSystemContext();\n openFirstPages();\n }\n });\n return {\n get pages() {\n return stack.pages;\n },\n back: () => navigate({ action: 'back', delta: 1 }),\n setSystemContext: (next) => {\n context = next;\n syncSystemContext();\n },\n stop: () => {\n stopService();\n stopWebview();\n },\n };\n}\n","import type { HostVersions } from './compatibility';\n\n// The Dash version the simulator acts as, for dots that set `dash.minVersion`.\nexport const SIMULATED_DASH_VERSION = '1.0.0';\n\n// The oldest @monimesl/dot-runtime whose bundles the simulator's bridge runs. Raise it when the\n// messages between the layers and the host change in a way older runtimes don't understand.\nexport const MIN_RUNTIME_VERSION = '0.1.0-alpha.1';\n\nexport const SIMULATOR_VERSIONS: HostVersions = {\n dashVersion: SIMULATED_DASH_VERSION,\n minRuntimeVersion: MIN_RUNTIME_VERSION,\n};\n","export const CLIENT_PATH = '/__dot/';\nexport const EVENTS_PATH = `${CLIENT_PATH}events`;\nexport const HTTP_PATH = `${CLIENT_PATH}network/http/`;\nexport const FILE_PATH = `${CLIENT_PATH}file/`;\n\nexport const DOT_PATH = '/dot/';\nexport const WEBVIEW_URL = `${DOT_PATH}ui/index.html`;\nexport const WEBVIEW_SCRIPT_URL = `${DOT_PATH}ui/dot.js`;\nexport const SERVICE_URL = `${DOT_PATH}logic/dot.js`;\nexport const MANIFEST_URL = `${DOT_PATH}manifest.json`;\n","import type { HostErrorCode } from '@monimesl/dot-core';\nimport { HostError } from '@monimesl/dot-core';\n\ntype Answer<Result> = { result: Result } | { error: { code: HostErrorCode; message: string } };\n\n// Runs a Dash call on the dev server, as a native host runs it on the device.\nexport async function callDevServer<Result>(\n path: string,\n params: unknown,\n signal: AbortSignal,\n): Promise<Result> {\n const response = await fetch(path, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(params),\n signal,\n });\n const answer = (await response.json()) as Answer<Result>;\n if ('error' in answer) {\n throw new HostError(answer.error.code, answer.error.message);\n }\n return answer.result;\n}\n","import type { DashMethods, TorchState, VibrateOptions } from '@monimesl/dot-dash';\nimport { HostError } from '@monimesl/dot-core';\n\nexport type ShareParams = DashMethods['dash.system.share']['params'];\n\nconst SHAKE_DURATION_MS = 300;\n\nconst SHAKE: Keyframe[] = [\n { transform: 'translateX(0)' },\n { transform: 'translateX(-5px)' },\n { transform: 'translateX(5px)' },\n { transform: 'translateX(-3px)' },\n { transform: 'translateX(3px)' },\n { transform: 'translateX(0)' },\n];\n\nexport async function vibrate(\n phone: HTMLElement,\n note: (text: string) => void,\n options: VibrateOptions,\n): Promise<void> {\n note(`vibrated: ${options.style}`);\n await phone.animate(SHAKE, { duration: SHAKE_DURATION_MS }).finished;\n}\n\nexport function torch(phone: HTMLElement, note: (text: string) => void, state: TorchState): void {\n phone.dataset.torch = state;\n note(`torch: ${state}`);\n}\n\nexport async function copyText(note: (text: string) => void, text: string): Promise<void> {\n try {\n await navigator.clipboard.writeText(text);\n } catch (error) {\n throw new HostError('failed', `The browser kept the clipboard: ${(error as Error).message}`);\n }\n note(`copied: ${text}`);\n}\n\n// Notes what a device's share sheet would get.\nexport function share(note: (text: string) => void, params: ShareParams): void {\n const parts = [params.text, params.url, params.file && `file ${params.file}`].filter(Boolean);\n if (parts.length === 0) {\n throw new HostError('invalid', 'Give share a text, a url or a file');\n }\n note(`shared: ${parts.join(' · ')}`);\n}\n\nexport function delay(milliseconds: number, signal: AbortSignal): Promise<void> {\n if (!Number.isFinite(milliseconds) || milliseconds < 0) {\n throw new HostError(\n 'invalid',\n `A delay is a number of milliseconds, 0 or more, not ${milliseconds}`,\n );\n }\n return new Promise((resolve) => {\n const timer = setTimeout(resolve, milliseconds);\n signal.addEventListener('abort', () => clearTimeout(timer));\n });\n}\n","export function element<T extends Element>(selector: string): T {\n const node = document.querySelector<T>(selector);\n if (!node) {\n throw new Error(`Simulator page is missing ${selector}`);\n }\n return node;\n}\n\nexport function createElement<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className: string,\n text?: string,\n): HTMLElementTagNameMap[K] {\n const node = document.createElement(tag);\n node.className = className;\n if (text !== undefined) {\n node.textContent = text;\n }\n return node;\n}\n","import { HostError } from '@monimesl/dot-core';\nimport type { AlertAction, AlertOptions, AlertResult } from '@monimesl/dot-dash';\n\nimport { createElement } from '../dom';\n\n// dash.ui.alert always sends actions, but a host does not trust what the service sends.\nconst DEFAULT_ACTIONS: AlertAction[] = [{ id: 'ok', label: 'OK' }];\n\nexport function alert(\n phone: HTMLElement,\n options: AlertOptions,\n signal: AbortSignal,\n): Promise<AlertResult> {\n return new Promise((resolve, reject) => {\n const layer = createElement('div', 'dialog-layer');\n const dialog = createElement('div', 'dialog');\n dialog.setAttribute('role', 'alertdialog');\n const body = createElement('div', 'dialog-body');\n body.append(createElement('div', 'dialog-title', options.title));\n if (options.message) {\n body.append(createElement('div', 'dialog-message', options.message));\n }\n const actions = options.actions ?? DEFAULT_ACTIONS;\n // Two actions sit side by side, as on iOS; more are stacked.\n const buttons = createElement(\n 'div',\n actions.length === 2 ? 'dialog-actions' : 'dialog-actions stacked',\n );\n for (const action of actions) {\n const button = createElement('button', action.role ?? 'default', action.label);\n button.addEventListener('click', () => {\n layer.remove();\n resolve({ action: action.id });\n });\n buttons.append(button);\n }\n dialog.append(body, buttons);\n layer.append(dialog);\n signal.addEventListener('abort', () => {\n layer.remove();\n reject(new HostError('cancelled', 'The alert was dismissed'));\n });\n phone.append(layer);\n });\n}\n","import type { AlertOptions, TorchState, VibrateOptions } from '@monimesl/dot-dash';\n\nimport type { HostHandlers } from '../../host-calls';\nimport { FILE_PATH, HTTP_PATH } from '../../paths';\nimport { callDevServer } from './dev-server';\nimport type { ShareParams } from './system';\nimport { copyText, delay, share, torch, vibrate } from './system';\nimport { alert } from './ui';\n\nconst HTTP_METHODS = ['request', 'download', 'upload'] as const;\n\nconst FILE_OPERATIONS = [\n 'read',\n 'write',\n 'stat',\n 'list',\n 'createFolder',\n 'move',\n 'copy',\n 'remove',\n 'save',\n 'open',\n 'usage',\n] as const;\n\n// Stand-ins for what a device does natively; the dev server reaches the network and files.\nexport function dashHandlers(phone: HTMLElement, note: (text: string) => void): HostHandlers {\n return {\n 'dash.ui.alert': ({ params, signal }) => alert(phone, params as AlertOptions, signal),\n 'dash.system.vibrate': ({ params }) => vibrate(phone, note, params as VibrateOptions),\n 'dash.system.torch': ({ params }) =>\n torch(phone, note, (params as { state: TorchState }).state),\n 'dash.system.copyText': ({ params }) => copyText(note, (params as { text: string }).text),\n 'dash.system.share': ({ params }) => share(note, params as ShareParams),\n 'dash.system.delay': ({ params, signal }) =>\n delay((params as { milliseconds: number }).milliseconds, signal),\n ...devServerHandlers('dash.network.http', HTTP_PATH, HTTP_METHODS),\n ...devServerHandlers('dash.file', FILE_PATH, FILE_OPERATIONS),\n };\n}\n\nfunction devServerHandlers(group: string, path: string, names: readonly string[]): HostHandlers {\n return Object.fromEntries(\n names.map((name) => [\n `${group}.${name}`,\n ({ params, signal }: { params: unknown; signal: AbortSignal }) =>\n callDevServer(`${path}${name}`, params, signal),\n ]),\n );\n}\n","import type { DotPermission } from '@monimesl/dot-core';\n\nimport type { PermissionRequest } from '../../permissions';\nimport { alert } from './ui';\n\n// Finishes \"Allow “Counter” to …?\".\nconst PERMISSION_SUMMARIES: Record<DotPermission, string> = {\n account: 'see your Dash account: your name, and your email or phone',\n};\n\n// Asks as Dash would: the dot's name, what it wants, and the reason from its dot.json.\nexport async function askPermission(\n phone: HTMLElement,\n note: (text: string) => void,\n request: PermissionRequest,\n signal: AbortSignal,\n): Promise<boolean> {\n const { action } = await alert(\n phone,\n {\n title: `Allow “${request.dotName}” to ${PERMISSION_SUMMARIES[request.permission]}?`,\n message: request.reason,\n actions: [\n { id: 'deny', label: \"Don't Allow\", role: 'cancel' },\n { id: 'allow', label: 'Allow' },\n ],\n },\n signal,\n );\n const allowed = action === 'allow';\n if (allowed) {\n note(`permission ${request.permission}: allowed`);\n } else {\n note(`permission ${request.permission}: not allowed`);\n }\n return allowed;\n}\n","import type { Transport } from '@monimesl/dot-core';\n\n// Native bridges only carry strings, so JSON-encoding here makes state that a device could not\n// carry fail in the simulator too.\ninterface Wire {\n readonly dot: string;\n}\n\nfunction isWire(data: unknown): data is Wire {\n return typeof (data as Partial<Wire> | null)?.dot === 'string';\n}\n\nexport function wireTransport(channel: Transport): Transport {\n return {\n post: (message) => channel.post({ dot: JSON.stringify(message) } satisfies Wire),\n listen: (listener) =>\n channel.listen((data) => {\n if (isWire(data)) {\n listener(JSON.parse(data.dot));\n }\n }),\n };\n}\n\n// The simulator page and the webview's iframe, each accepting messages only from the other.\nexport function windowChannel(other: () => Window | null): Transport {\n return {\n post: (message) => other()?.postMessage(message, location.origin),\n listen(listener) {\n const onMessage = (event: MessageEvent) => {\n if (event.source === other()) {\n listener(event.data);\n }\n };\n window.addEventListener('message', onMessage);\n return () => window.removeEventListener('message', onMessage);\n },\n };\n}\n","import type {\n AppState,\n ColorScheme,\n Envelope,\n Platform,\n StackEntry,\n SystemContext,\n} from '@monimesl/dot-core';\nimport { createAdaptorTransport } from '@monimesl/dot-core';\n\nimport type { Direction, Host, HostBars } from '../host';\nimport type { HostManifest } from '../manifest';\nimport { checkCompatibility } from '../compatibility';\nimport { startHost } from '../host';\nimport { SIMULATOR_VERSIONS } from '../versions';\nimport { CLIENT_PATH, EVENTS_PATH, MANIFEST_URL, WEBVIEW_URL } from '../paths';\nimport { dashHandlers } from './dash';\nimport { askPermission } from './dash/permissions';\nimport { createElement, element } from './dom';\nimport type { HotReload } from './hot-reload';\nimport { windowChannel, wireTransport } from './wire';\n\nconst MAX_LOG_ENTRIES = 500;\n\nconst screen = element<HTMLIFrameElement>('#screen');\nconst log = element<HTMLOListElement>('#log');\nconst errorBanner = element<HTMLPreElement>('#error');\nconst phone = element<HTMLDivElement>('.phone');\nconst platformSelect = element<HTMLSelectElement>('#platform');\nconst inputModeSelect = element<HTMLSelectElement>('#input-mode');\nconst schemeSelect = element<HTMLSelectElement>('#scheme');\nconst navigationBar = element<HTMLElement>('.navigation-bar');\nconst navigationTitle = element<HTMLElement>('#navigation-title');\nconst navigationBack = element<HTMLButtonElement>('#navigation-back');\nconst tabBar = element<HTMLElement>('.tab-bar');\nconst browserDark = matchMedia('(prefers-color-scheme: dark)');\nconst COARSE_POINTER_MEDIA = /\\(\\s*(?:any-)?pointer\\s*:\\s*coarse\\s*\\)/gi;\nconst EMULATED_TOUCH_STYLE = 'data-dot-simulator-touch';\n\ntype InputMode = 'browser' | 'touch';\n\ninterface RunningApp {\n readonly host: Host;\n readonly worker: Worker;\n}\n\nlet runningApp: RunningApp | null = null;\nlet launchCount = 0;\nlet hotReloads = 0;\n\n// `restorePages` are the pages to open in place of the first one.\nasync function launch(restorePages: readonly StackEntry[] = []): Promise<void> {\n stopRunningApp();\n launchCount += 1;\n const thisLaunch = launchCount;\n if (log.childElementCount > 0) {\n note('dot restarted');\n }\n\n let manifest: HostManifest;\n try {\n const response = await fetch(MANIFEST_URL);\n manifest = (await response.json()) as HostManifest;\n } catch {\n showError(`Nothing to run: ${MANIFEST_URL} is missing. Did the build fail?`);\n return;\n }\n // Another reload started while the manifest loaded; only the newest launch may start the dot.\n if (thisLaunch !== launchCount) {\n return;\n }\n\n // startHost checks too, but checking first means a refused dot never starts a worker.\n try {\n checkCompatibility(manifest, SIMULATOR_VERSIONS);\n } catch (error) {\n screen.src = 'about:blank';\n showError((error as Error).message);\n return;\n }\n\n const worker = new Worker(`${CLIENT_PATH}service-bridge.js`);\n const service = wireTransport(createAdaptorTransport(worker));\n const webview = wireTransport(windowChannel(() => screen.contentWindow));\n const host = startHost({\n logic: service,\n ui: webview,\n manifest,\n ...SIMULATOR_VERSIONS,\n systemContext: systemContext(),\n handlers: dashHandlers(phone, note),\n askPermission: (request, signal) => askPermission(phone, note, request, signal),\n observe: record,\n restorePages,\n onBarsChange: showBars,\n });\n worker.addEventListener('error', (event) => showError(`Service crashed: ${event.message}`));\n screen.src = WEBVIEW_URL;\n runningApp = { host, worker };\n}\n\nfunction stopRunningApp(): void {\n if (!runningApp) {\n return;\n }\n runningApp.host.stop();\n runningApp.worker.terminate();\n runningApp = null;\n}\n\n// As Dash would show its bars for the page on top.\nfunction showBars(bars: HostBars, pages: readonly StackEntry[]): void {\n navigationBar.hidden = bars.navigationBarHidden;\n navigationTitle.textContent = bars.title;\n navigationBack.hidden = pages.length < 2;\n setBarColor('--bar', bars.navigationBarColor);\n setBarColor('--bar-text', bars.navigationBarTextColor);\n tabBar.hidden = bars.tabBarHidden;\n}\n\n// Dash's own color when the page sets none.\nfunction setBarColor(property: string, color: string | undefined): void {\n if (color) {\n phone.style.setProperty(property, color);\n } else {\n phone.style.removeProperty(property);\n }\n}\n\nfunction goBack(): void {\n if (runningApp && !runningApp.host.back()) {\n note('back on the first page: a device would close the dot');\n }\n}\n\nconst ARROWS: Record<Direction, string> = {\n toHost: 'both --> host',\n fromHost: 'host --> both',\n toService: 'ui --> logic',\n toWebview: 'logic <-- ui',\n};\n\nfunction note(text: string): void {\n log.append(createElement('li', 'note', text));\n}\n\nfunction record(direction: Direction, message: Envelope): void {\n const entry = createElement('li', direction);\n const details = document.createElement('details');\n const summary = document.createElement('summary');\n const time = new Date().toLocaleTimeString([], { hour12: false });\n summary.append(\n createElement('span', 'time', time),\n createElement('span', 'arrow', ARROWS[direction]),\n createElement('span', 'type', message.type),\n );\n const payload = document.createElement('pre');\n payload.textContent = JSON.stringify(message.payload, null, 2);\n details.append(summary, payload);\n entry.append(details);\n if (message.type === 'error') {\n entry.classList.add('failed');\n }\n log.append(entry);\n while (log.childElementCount > MAX_LOG_ENTRIES) {\n log.firstElementChild?.remove();\n }\n log.scrollTop = log.scrollHeight;\n}\n\nfunction syncLaunch(restorePages: readonly StackEntry[] = []): void {\n launch(restorePages).catch((error: unknown) => {\n showError(`Could not start the dot: ${String(error)}`);\n });\n}\n\n// A new build: the dot starts again on the pages it had open.\nfunction relaunch(): void {\n syncLaunch(runningApp?.host.pages ?? []);\n}\n\n// A new build of only the pages: it runs in place, and each open page keeps its state.\nfunction hotReload(): void {\n if (!runningApp) {\n syncLaunch();\n return;\n }\n hotReloads += 1;\n const reload: HotReload = { dotHotReload: hotReloads };\n // The service first, so a page whose initial state changed is starting over when its view redraws.\n runningApp.worker.postMessage(reload);\n screen.contentWindow?.postMessage(reload, location.origin);\n note('dot updated in place');\n}\n\nfunction showError(message: string | null): void {\n errorBanner.hidden = message === null;\n errorBanner.textContent = message ?? '';\n}\n\nfunction systemContext(): SystemContext {\n return {\n platform: platformSelect.value as Platform,\n scheme: schemeSelect.value as ColorScheme,\n appState: appState(),\n };\n}\n\n// Leaving the simulator's tab stands in for leaving Dash.\nfunction appState(): AppState {\n if (document.visibilityState === 'hidden') {\n return 'background';\n }\n return 'active';\n}\n\nfunction browserScheme(): ColorScheme {\n return browserDark.matches ? 'dark' : 'light';\n}\n\nfunction changeScheme(scheme: ColorScheme): void {\n schemeSelect.value = scheme;\n phone.dataset.scheme = scheme;\n runningApp?.host.setSystemContext(systemContext());\n}\n\nfunction changeInputMode(mode: InputMode): void {\n inputModeSelect.value = mode;\n phone.dataset.inputMode = mode;\n applyInputMode();\n}\n\nfunction applyInputMode(): void {\n const document = screen.contentDocument;\n if (!document) {\n return;\n }\n\n document.documentElement.dataset.dotSimulatorInput = inputModeSelect.value;\n document.querySelector(`style[${EMULATED_TOUCH_STYLE}]`)?.remove();\n if (inputModeSelect.value !== 'touch') {\n return;\n }\n\n const css = coarsePointerCss(document);\n if (!css) {\n return;\n }\n const style = document.createElement('style');\n style.setAttribute(EMULATED_TOUCH_STYLE, '');\n style.textContent = css;\n document.head.append(style);\n}\n\nfunction coarsePointerCss(document: Document): string {\n let css = '';\n for (const sheet of document.styleSheets) {\n try {\n css += coarsePointerRules(sheet.cssRules);\n } catch {\n // Cross-origin stylesheets cannot expose their rules. The mini-app's own styles are same-origin.\n }\n }\n return css;\n}\n\nfunction coarsePointerRules(rules: CSSRuleList): string {\n let css = '';\n for (const rule of rules) {\n const nestedRules = (rule as CSSRule & { cssRules?: CSSRuleList }).cssRules;\n if (!nestedRules) {\n continue;\n }\n\n if (rule.type === CSSRule.MEDIA_RULE) {\n const media = rule as CSSMediaRule;\n COARSE_POINTER_MEDIA.lastIndex = 0;\n if (COARSE_POINTER_MEDIA.test(media.conditionText)) {\n COARSE_POINTER_MEDIA.lastIndex = 0;\n const condition = media.conditionText.replace(COARSE_POINTER_MEDIA, '(min-width: 0px)');\n const contents = Array.from(media.cssRules, (child) => child.cssText).join('\\n');\n css += condition === '(min-width: 0px)' ? contents : `@media ${condition}{${contents}}`;\n continue;\n }\n }\n\n const contents = coarsePointerRules(nestedRules);\n if (!contents) {\n continue;\n }\n const openingBrace = rule.cssText.indexOf('{');\n if (openingBrace !== -1) {\n css += `${rule.cssText.slice(0, openingBrace)}{${contents}}`;\n }\n }\n return css;\n}\n\nconst events = new EventSource(EVENTS_PATH);\nevents.addEventListener('reload', () => {\n showError(null);\n relaunch();\n});\nevents.addEventListener('hot-reload', () => {\n showError(null);\n hotReload();\n});\nevents.addEventListener('build-error', (event) => showError(String(event.data)));\n\n// Starts the dot over, on its first page.\nelement('#reload').addEventListener('click', () => syncLaunch());\nelement('#back').addEventListener('click', goBack);\nnavigationBack.addEventListener('click', goBack);\nelement('#clear').addEventListener('click', () => log.replaceChildren());\nschemeSelect.addEventListener('change', () => changeScheme(schemeSelect.value as ColorScheme));\ninputModeSelect.addEventListener('change', () =>\n changeInputMode(inputModeSelect.value as InputMode),\n);\nplatformSelect.addEventListener('change', () => {\n phone.dataset.platform = platformSelect.value;\n runningApp?.host.setSystemContext(systemContext());\n});\nscreen.addEventListener('load', applyInputMode);\nbrowserDark.addEventListener('change', () => changeScheme(browserScheme()));\ndocument.addEventListener('visibilitychange', () => {\n runningApp?.host.setSystemContext(systemContext());\n});\n\nchangeScheme(browserScheme());\nchangeInputMode('touch');\nsyncLaunch();\n"],"mappings":";;CACA,SAAS,gBAAgB,UAAU;EAClC,OAAO;GACN,OAAO,CAAC;GACR,QAAQ,CAAC;GACT,GAAG;EACJ;CACD;CAYA,SAAS,kBAAkB,WAAW;EACrC,MAAM,WAAW,CAAC;EAClB,KAAK,MAAM,YAAY,WAAW;GACjC,IAAI,SAAS,QAAQ,UAAU,MAAM,IAAI,MAAM,cAAc,SAAS,KAAK,mBAAmB;GAC9F,SAAS,SAAS,QAAQ;EAC3B;EACA,OAAO;CACR;CAgEA,MAAM,cAAc,gBAAgB;EACnC,MAAM;EACN,OAAO;GACN,OAAO;GACP,UAAU;GACV,UAAU;GACV,OAAO;GACP,aAAa;GACb,MAAM;GACN,OAAO;GACP,UAAU;EACX;EACA,QAAQ,CAAC,QAAQ;EACjB,UAAU;CACX,CAAC;CAGD,MAAM,SAAS,gBAAgB;EAC9B,MAAM;EACN,OAAO;GACN,SAAS,CAAC,WAAW,WAAW;GAChC,UAAU;GACV,SAAS;EACV;EACA,QAAQ,CAAC,OAAO;EAChB,UAAU;CACX,CAAC;CAGD,MAAM,QAAQ;EACb;EACA;EACA;CACD;CACA,MAAM,SAAS;EACd;EACA;EACA;EACA;CACD;CACA,MAAM,QAAQ;EACb;EACA;EACA;EACA;EACA;EACA;CACD;CACA,MAAM,eAAe;EACpB;EACA;EACA;EACA;EACA;CACD;CACA,MAAM,aAAa;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD;CAGA,MAAM,WAAW,gBAAgB;EAChC,MAAM;EACN,OAAO;GACN,UAAU;GACV,UAAU;GACV,MAAM;GACN,WAAW,CAAC,QAAQ,MAAM;GAC1B,KAAK;GACL,QAAQ,CAAC,SAAS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,QAAQ,CAAC,CAAC,iBAAiB,eAAe,IAAI,gBAAgB,CAAC;CACvE,aAAa,iBAAiB,gBAAgB,aAAa,aAAa,KAAoB,CAAC;CAC7F,gBAAgB,iBAAiB,gBAC/B,gBAAgB,gBAAgB,KAAkB,CACpD;CACA,eAAe,iBAAiB,gBAAgB;EAC9C,MAAM,QAAQ,WAAW,eAAe;EACxC,YAAY,KAAK,iBAAiB,cAAc,CAAC;CACnD,CAAC;CACD,OAAO,iBAAiB,QAAQ,cAAc;CAC9C,YAAY,iBAAiB,gBAAgB,aAAa,cAAc,CAAC,CAAC;CAC1E,SAAS,iBAAiB,0BAA0B;EAClD,YAAY,KAAK,iBAAiB,cAAc,CAAC;CACnD,CAAC;CAED,aAAa,cAAc,CAAC;CAC5B,gBAAgB,OAAO;CACvB,WAAW"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
(function() {
|
|
2
|
+
const WEBVIEW_SCRIPT_URL = `/dot/ui/dot.js`;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/client/hot-reload.ts
|
|
5
|
+
function hotReloadIn(data) {
|
|
6
|
+
const reload = data?.dotHotReload;
|
|
7
|
+
return typeof reload === "number" ? reload : void 0;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
2
10
|
//#region src/client/wire.ts
|
|
3
11
|
function isWire(data) {
|
|
4
12
|
return typeof data?.dot === "string";
|
|
@@ -26,6 +34,10 @@
|
|
|
26
34
|
//#endregion
|
|
27
35
|
//#region src/client/webview-bridge.ts
|
|
28
36
|
globalThis.__hostTransport = wireTransport(windowChannel(() => window.parent));
|
|
37
|
+
window.addEventListener("message", (event) => {
|
|
38
|
+
const reload = hotReloadIn(event.data);
|
|
39
|
+
if (reload !== void 0 && event.source === window.parent) import(`${WEBVIEW_SCRIPT_URL}?hot=${reload}`);
|
|
40
|
+
});
|
|
29
41
|
//#endregion
|
|
30
42
|
})();
|
|
31
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webview-bridge.js","names":[],"sources":["../../src/client/wire.ts","../../src/client/webview-bridge.ts"],"sourcesContent":["import type { Transport } from '@monimesl/dot-core';\n\n// Native bridges only carry strings, so JSON-encoding here makes state that a device could not\n// carry fail in the simulator too.\ninterface Wire {\n readonly dot: string;\n}\n\nfunction isWire(data: unknown): data is Wire {\n return typeof (data as Partial<Wire> | null)?.dot === 'string';\n}\n\nexport function wireTransport(channel: Transport): Transport {\n return {\n post: (message) => channel.post({ dot: JSON.stringify(message) } satisfies Wire),\n listen: (listener) =>\n channel.listen((data) => {\n if (isWire(data)) {\n listener(JSON.parse(data.dot));\n }\n }),\n };\n}\n\n// The simulator page and the webview's iframe, each accepting messages only from the other.\nexport function windowChannel(other: () => Window | null): Transport {\n return {\n post: (message) => other()?.postMessage(message, location.origin),\n listen(listener) {\n const onMessage = (event: MessageEvent) => {\n if (event.source === other()) {\n listener(event.data);\n }\n };\n window.addEventListener('message', onMessage);\n return () => window.removeEventListener('message', onMessage);\n },\n };\n}\n","import { windowChannel, wireTransport } from './wire';\n\nglobalThis.__hostTransport = wireTransport(windowChannel(() => window.parent));\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"webview-bridge.js","names":[],"sources":["../../src/paths.ts","../../src/client/hot-reload.ts","../../src/client/wire.ts","../../src/client/webview-bridge.ts"],"sourcesContent":["export const CLIENT_PATH = '/__dot/';\nexport const EVENTS_PATH = `${CLIENT_PATH}events`;\nexport const HTTP_PATH = `${CLIENT_PATH}network/http/`;\nexport const FILE_PATH = `${CLIENT_PATH}file/`;\n\nexport const DOT_PATH = '/dot/';\nexport const WEBVIEW_URL = `${DOT_PATH}ui/index.html`;\nexport const WEBVIEW_SCRIPT_URL = `${DOT_PATH}ui/dot.js`;\nexport const SERVICE_URL = `${DOT_PATH}logic/dot.js`;\nexport const MANIFEST_URL = `${DOT_PATH}manifest.json`;\n","// What the simulator page posts to the dot's worker and web view to run its new build in place.\nexport interface HotReload {\n readonly dotHotReload: number;\n}\n\nexport function hotReloadIn(data: unknown): number | undefined {\n const reload = (data as Partial<HotReload> | null)?.dotHotReload;\n return typeof reload === 'number' ? reload : undefined;\n}\n","import type { Transport } from '@monimesl/dot-core';\n\n// Native bridges only carry strings, so JSON-encoding here makes state that a device could not\n// carry fail in the simulator too.\ninterface Wire {\n readonly dot: string;\n}\n\nfunction isWire(data: unknown): data is Wire {\n return typeof (data as Partial<Wire> | null)?.dot === 'string';\n}\n\nexport function wireTransport(channel: Transport): Transport {\n return {\n post: (message) => channel.post({ dot: JSON.stringify(message) } satisfies Wire),\n listen: (listener) =>\n channel.listen((data) => {\n if (isWire(data)) {\n listener(JSON.parse(data.dot));\n }\n }),\n };\n}\n\n// The simulator page and the webview's iframe, each accepting messages only from the other.\nexport function windowChannel(other: () => Window | null): Transport {\n return {\n post: (message) => other()?.postMessage(message, location.origin),\n listen(listener) {\n const onMessage = (event: MessageEvent) => {\n if (event.source === other()) {\n listener(event.data);\n }\n };\n window.addEventListener('message', onMessage);\n return () => window.removeEventListener('message', onMessage);\n },\n };\n}\n","import { WEBVIEW_SCRIPT_URL } from '../paths';\nimport { hotReloadIn } from './hot-reload';\nimport { windowChannel, wireTransport } from './wire';\n\nglobalThis.__hostTransport = wireTransport(windowChannel(() => window.parent));\n\n// The new build hands its views to the webview already running here.\nwindow.addEventListener('message', (event) => {\n const reload = hotReloadIn(event.data);\n if (reload !== undefined && event.source === window.parent) {\n void import(`${WEBVIEW_SCRIPT_URL}?hot=${reload}`);\n }\n});\n"],"mappings":";CAOA,MAAa,qBAAqB;;;CCFlC,SAAgB,YAAY,MAAmC;EAC7D,MAAM,SAAU,MAAoC;EACpD,OAAO,OAAO,WAAW,WAAW,SAAS,KAAA;CAC/C;;;CCAA,SAAS,OAAO,MAA6B;EAC3C,OAAO,OAAQ,MAA+B,QAAQ;CACxD;CAEA,SAAgB,cAAc,SAA+B;EAC3D,OAAO;GACL,OAAO,YAAY,QAAQ,KAAK,EAAE,KAAK,KAAK,UAAU,OAAO,EAAE,CAAgB;GAC/E,SAAS,aACP,QAAQ,QAAQ,SAAS;IACvB,IAAI,OAAO,IAAI,GACb,SAAS,KAAK,MAAM,KAAK,GAAG,CAAC;GAEjC,CAAC;EACL;CACF;CAGA,SAAgB,cAAc,OAAuC;EACnE,OAAO;GACL,OAAO,YAAY,MAAM,CAAC,EAAE,YAAY,SAAS,SAAS,MAAM;GAChE,OAAO,UAAU;IACf,MAAM,aAAa,UAAwB;KACzC,IAAI,MAAM,WAAW,MAAM,GACzB,SAAS,MAAM,IAAI;IAEvB;IACA,OAAO,iBAAiB,WAAW,SAAS;IAC5C,aAAa,OAAO,oBAAoB,WAAW,SAAS;GAC9D;EACF;CACF;;;CClCA,WAAW,kBAAkB,cAAc,oBAAoB,OAAO,MAAM,CAAC;CAG7E,OAAO,iBAAiB,YAAY,UAAU;EAC5C,MAAM,SAAS,YAAY,MAAM,IAAI;EACrC,IAAI,WAAW,KAAA,KAAa,MAAM,WAAW,OAAO,QAClD,OAAY,GAAG,mBAAmB,OAAO;CAE7C,CAAC"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DotPermission, Envelope, SystemContext, Transport } from "@monimesl/dot-core";
|
|
1
|
+
import { DotPermission, Envelope, StackEntry, SystemContext, Transport } from "@monimesl/dot-core";
|
|
2
2
|
//#region src/permissions.d.ts
|
|
3
3
|
interface PermissionRequest {
|
|
4
4
|
readonly dotName: string;
|
|
@@ -53,6 +53,13 @@ type HostHandlers = Readonly<Record<string, HostHandler | PermissionedHandler>>;
|
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/host.d.ts
|
|
55
55
|
type Direction = 'toService' | 'toWebview' | 'toHost' | 'fromHost';
|
|
56
|
+
interface HostBars {
|
|
57
|
+
readonly title: string;
|
|
58
|
+
readonly navigationBarHidden: boolean;
|
|
59
|
+
readonly navigationBarColor: string | undefined;
|
|
60
|
+
readonly navigationBarTextColor: string | undefined;
|
|
61
|
+
readonly tabBarHidden: boolean;
|
|
62
|
+
}
|
|
56
63
|
interface HostOptions extends HostVersions {
|
|
57
64
|
ui: Transport;
|
|
58
65
|
logic: Transport;
|
|
@@ -61,13 +68,16 @@ interface HostOptions extends HostVersions {
|
|
|
61
68
|
handlers?: HostHandlers;
|
|
62
69
|
askPermission: AskPermission;
|
|
63
70
|
observe?: (direction: Direction, message: Envelope) => void;
|
|
71
|
+
restorePages?: readonly StackEntry[];
|
|
72
|
+
onBarsChange?: (bars: HostBars, pages: readonly StackEntry[]) => void;
|
|
64
73
|
}
|
|
65
74
|
interface Host {
|
|
75
|
+
readonly pages: readonly StackEntry[];
|
|
66
76
|
stop(): void;
|
|
67
77
|
back(): boolean;
|
|
68
78
|
setSystemContext(context: SystemContext): void;
|
|
69
79
|
}
|
|
70
|
-
export declare function startHost({ logic, ui, manifest, dashVersion, minRuntimeVersion, systemContext, handlers, askPermission, observe }: HostOptions): Host;
|
|
80
|
+
export declare function startHost({ logic, ui, manifest, dashVersion, minRuntimeVersion, systemContext, handlers, askPermission, observe, restorePages, onBarsChange }: HostOptions): Host;
|
|
71
81
|
//#endregion
|
|
72
82
|
//#region src/versions.d.ts
|
|
73
83
|
export declare const SIMULATED_DASH_VERSION = "1.0.0";
|
|
@@ -87,6 +97,7 @@ interface SimulatorOptions {
|
|
|
87
97
|
interface Simulator {
|
|
88
98
|
readonly url: string;
|
|
89
99
|
reload(): void;
|
|
100
|
+
hotReload(): void;
|
|
90
101
|
error(message: string): void;
|
|
91
102
|
close(): Promise<void>;
|
|
92
103
|
}
|
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/permissions.ts","../../src/manifest.ts","../../src/compatibility.ts","../../src/host-calls.ts","../../src/host.ts","../../src/versions.ts","../../src/server.ts"],"mappings":";;UAIiB;WACN;WACA,YAAY;WAEZ;;KAIC,sBAAsB,SAAS,QAAQ;KAIvC,iBAAiB,SAAS,mBAAmB,QAAQ,gBAAgB;;;UCbhE;WACN;WAEA;WAEA;WACA;WACA;WACA;aAAkB;;WAClB,cAAc;WAEd;aAAqB;;;;;KCVpB;UAGK;WAEN;WAEA;WAGA;;qBAKE,6BAA6B;WACtB;WACT,QAAQ;EAEL,YAAA,QAAQ,uBAAuB;;wBAO7B,mBACd,UAAU,gBACR,aAAa,mBAAmB,iBAAiB;;;UCtBpC;WACN;WACA;WAEA,QAAQ;;KAIP,eAAe,MAAM;UAGhB;WACN,YAAY;WACZ,QAAQ;;KAGP,eAAe,SAAS,eAAe,cAAc;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/permissions.ts","../../src/manifest.ts","../../src/compatibility.ts","../../src/host-calls.ts","../../src/host.ts","../../src/versions.ts","../../src/server.ts"],"mappings":";;UAIiB;WACN;WACA,YAAY;WAEZ;;KAIC,sBAAsB,SAAS,QAAQ;KAIvC,iBAAiB,SAAS,mBAAmB,QAAQ,gBAAgB;;;UCbhE;WACN;WAEA;WAEA;WACA;WACA;WACA;aAAkB;;WAClB,cAAc;WAEd;aAAqB;;;;;KCVpB;UAGK;WAEN;WAEA;WAGA;;qBAKE,6BAA6B;WACtB;WACT,QAAQ;EAEL,YAAA,QAAQ,uBAAuB;;wBAO7B,mBACd,UAAU,gBACR,aAAa,mBAAmB,iBAAiB;;;UCtBpC;WACN;WACA;WAEA,QAAQ;;KAIP,eAAe,MAAM;UAGhB;WACN,YAAY;WACZ,QAAQ;;KAGP,eAAe,SAAS,eAAe,cAAc;;;KCLrD;UAGK;WACN;WACA;WAEA;WACA;WACA;;UAGM,oBAAoB;EACnC,IAAI;EACJ,OAAO;EACP,UAAU;EACV,eAAe;EAEf,WAAW;EAEX,eAAe;EACf,WAAW,WAAW,WAAW,SAAS;EAG1C,wBAAwB;EAExB,gBAAgB,MAAM,UAAU,gBAAgB;;UAGjC;WAEN,gBAAgB;EACzB;EAEA;EACA,iBAAiB,SAAS;;wBAKZ,YACd,OACA,IACA,UACA,aACA,mBACA,eACA,UACA,eACA,SACA,cACA,gBACC,cAAc;;;qBCtEJ;qBAIA;qBAEA,oBAAoB;;;UCahB;EACf;EAGA;EACA;EACA;EACA;EACA;EAEA;;UAGe;WACN;EAET;EAEA;EACA,MAAM;EACN,SAAS;;qBAGE;wBAmBS,iBACpB,QACA,cACA,MACA,MACA,MACA,WACA,cACC,mBAAmB,QAAQ"}
|