sh3-server 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/{index-CjnLDOvb.css → index-Bg2Y6Eat.css} +1 -1
- package/app/assets/index-DcenfgWp.js +21 -0
- package/app/assets/index-DcenfgWp.js.map +1 -0
- package/app/assets/tauri-backend-C24Wzcc_.js +2 -0
- package/app/assets/tauri-backend-C24Wzcc_.js.map +1 -0
- package/app/index.html +2 -2
- package/package.json +1 -1
- package/app/assets/index-DYoTAlLy.js +0 -21
- package/app/assets/index-DYoTAlLy.js.map +0 -1
- package/app/assets/tauri-backend-C83nL1gr.js +0 -2
- package/app/assets/tauri-backend-C83nL1gr.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{LazyStore as i}from"./index-YGsF1N98.js";import"./core-DsojzR6k.js";class n{#t;#e=new Map;constructor(e){this.#t=new i(`${e}.json`,{defaults:{},autoSave:!0})}read(e){return this.#e.get(e)}write(e,t){this.#e.set(e,t),this.#t.set(e,t).catch(s=>console.warn("SH3: store write failed",s))}delete(e){this.#e.delete(e),this.#t.delete(e).catch(t=>console.warn("SH3: store delete failed",t))}list(){return[...this.#e.keys()]}async init(){const e=await this.#t.entries();for(const[t,s]of e)this.#e.set(t,s);await this.#t.onChange((t,s)=>{s===void 0?this.#e.delete(t):this.#e.set(t,s)})}}export{n as TauriStoreBackend};
|
|
2
|
+
//# sourceMappingURL=tauri-backend-C24Wzcc_.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tauri-backend-C24Wzcc_.js","sources":["../../../sh3-core/src/platform/tauri-backend.ts"],"sourcesContent":["/*\n * TauriStoreBackend — implements the sh3 Backend interface using\n * @tauri-apps/plugin-store. Each zone gets its own .json store file\n * (e.g. \"workspace.json\", \"user.json\") in Tauri's app data directory.\n *\n * tauri-plugin-store v2 keeps an in-memory cache and flushes to disk\n * automatically. We pre-load the full store into a local Map during\n * init(), then serve reads/lists synchronously from that cache —\n * matching the Backend interface contract. Writes go to both the\n * local cache and the Tauri store (fire-and-forget async).\n *\n * Multi-window coherence: each Tauri WebviewWindow runs its own JS\n * context, so each gets its own TauriStoreBackend instance with an\n * independent #cache. Without coordination, a satellite window booted\n * from the host would never see writes made in the host (or vice\n * versa). init() subscribes to plugin-store's onChange event so any\n * cross-window write is mirrored into the local cache. The same event\n * fires for this window's own writes too, but the cache.set there is\n * idempotent.\n */\n\nimport { LazyStore } from '@tauri-apps/plugin-store';\nimport type { Backend } from '../state/types';\n\nexport class TauriStoreBackend implements Backend {\n #store: LazyStore;\n #cache = new Map<string, unknown>();\n\n constructor(zoneName: string) {\n this.#store = new LazyStore(`${zoneName}.json`, { defaults: {}, autoSave: true });\n }\n\n read(shardId: string): unknown | undefined {\n return this.#cache.get(shardId);\n }\n\n write(shardId: string, value: unknown): void {\n this.#cache.set(shardId, value);\n // Fire-and-forget — autoSave flushes to disk.\n this.#store.set(shardId, value).catch((e: unknown) => console.warn('SH3: store write failed', e));\n }\n\n delete(shardId: string): void {\n this.#cache.delete(shardId);\n this.#store.delete(shardId).catch((e: unknown) => console.warn('SH3: store delete failed', e));\n }\n\n list(): string[] {\n return [...this.#cache.keys()];\n }\n\n /**\n * Load the store from disk into the local cache and start mirroring\n * cross-window writes. Must be called once before read/list return\n * meaningful data. Called by the platform resolver at boot.\n */\n async init(): Promise<void> {\n const entries = await this.#store.entries<unknown>();\n for (const [key, value] of entries) {\n this.#cache.set(key, value);\n }\n // Mirror writes from other WebviewWindows (and our own) into the\n // local cache so reads stay coherent across the host + satellites.\n // The unlisten fn is intentionally not retained — the backend lives\n // for the page session and the subscription tears down with it.\n await this.#store.onChange<unknown>((key, value) => {\n if (value === undefined) {\n this.#cache.delete(key);\n } else {\n this.#cache.set(key, value);\n }\n });\n }\n}\n"],"names":["TauriStoreBackend","#store","#cache","zoneName","LazyStore","shardId","value","e","entries","key"],"mappings":"2EAwBO,MAAMA,CAAqC,CAChDC,GACAC,OAAa,IAEb,YAAYC,EAAkB,CAC5B,KAAKF,GAAS,IAAIG,EAAU,GAAGD,CAAQ,QAAS,CAAE,SAAU,CAAA,EAAI,SAAU,EAAA,CAAM,CAClF,CAEA,KAAKE,EAAsC,CACzC,OAAO,KAAKH,GAAO,IAAIG,CAAO,CAChC,CAEA,MAAMA,EAAiBC,EAAsB,CAC3C,KAAKJ,GAAO,IAAIG,EAASC,CAAK,EAE9B,KAAKL,GAAO,IAAII,EAASC,CAAK,EAAE,MAAOC,GAAe,QAAQ,KAAK,0BAA2BA,CAAC,CAAC,CAClG,CAEA,OAAOF,EAAuB,CAC5B,KAAKH,GAAO,OAAOG,CAAO,EAC1B,KAAKJ,GAAO,OAAOI,CAAO,EAAE,MAAOE,GAAe,QAAQ,KAAK,2BAA4BA,CAAC,CAAC,CAC/F,CAEA,MAAiB,CACf,MAAO,CAAC,GAAG,KAAKL,GAAO,MAAM,CAC/B,CAOA,MAAM,MAAsB,CAC1B,MAAMM,EAAU,MAAM,KAAKP,GAAO,QAAA,EAClC,SAAW,CAACQ,EAAKH,CAAK,IAAKE,EACzB,KAAKN,GAAO,IAAIO,EAAKH,CAAK,EAM5B,MAAM,KAAKL,GAAO,SAAkB,CAACQ,EAAKH,IAAU,CAC9CA,IAAU,OACZ,KAAKJ,GAAO,OAAOO,CAAG,EAEtB,KAAKP,GAAO,IAAIO,EAAKH,CAAK,CAE9B,CAAC,CACH,CACF"}
|
package/app/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>SH3</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DcenfgWp.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Bg2Y6Eat.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="app"></div>
|