feat: add native Symcon archive trends and explicit room naming
This commit is contained in:
1 parent
bb153490b0
commit
cfc77787a0
28 files changed
+2449
-1250
No files matched your search
+12
-3
@@ -22,6 +22,7 @@ const common = {
|
||||
legalComments: "eof",
|
||||
banner: { js: "/*! NextFloor, MIT licence. Includes three.js (MIT) and Lit (BSD-3-Clause); see LICENSE and THIRD_PARTY_NOTICES.md */" },
|
||||
logLevel: "info",
|
||||
define: { __NF_TREND_HASH__: JSON.stringify("dev") },
|
||||
};
|
||||
|
||||
const hashOf = (file) => createHash("sha256").update(readFileSync(file)).digest("hex").slice(0, 12);
|
||||
@@ -32,6 +33,7 @@ const langFiles = readdirSync("lang").filter((f) => /^[a-z]{2}\.json$/.test(f));
|
||||
const langs = JSON.stringify(Object.fromEntries(langFiles.map((f) => [f.slice(0, 2), hashOf(`lang/${f}`)])));
|
||||
|
||||
const viewerConfig = { ...common, entryPoints: ["src/viewer/viewer3d.ts"], outfile: `${out}/nextfloor-3d.js` };
|
||||
const trendConfig = { ...common, entryPoints: ["src/components/trend-dialog.ts"], outfile: `${out}/nextfloor-trend.js` };
|
||||
// the card's visual editor only loads in the dashboard's card dialog
|
||||
const cardEditorConfig = { ...common, entryPoints: ["src/card-editor.ts"], outfile: `${out}/nextfloor-card-editor.js`, define: { __NF_LANGS__: langs, "globalThis.__NF_SHARED_TEXTS__": "true" } };
|
||||
// the editor is only needed by admins who open it, so it is a bundle of its own as well
|
||||
@@ -40,7 +42,7 @@ const editorConfig = (viewerHash) => ({
|
||||
...common,
|
||||
entryPoints: ["src/components/editor.ts"],
|
||||
outfile: `${out}/nextfloor-editor.js`,
|
||||
define: { __NF_VIEWER_HASH__: JSON.stringify(viewerHash), __NF_LANGS__: langs, "globalThis.__NF_SHARED_TEXTS__": "true" },
|
||||
define: { ...common.define, __NF_VIEWER_HASH__: JSON.stringify(viewerHash), __NF_LANGS__: langs, "globalThis.__NF_SHARED_TEXTS__": "true" },
|
||||
});
|
||||
// The main bundle loads the 3D bundle with a hash of its content in the URL, so a new 3D bundle is
|
||||
// never taken from the browser cache (the integration version only changes after a restart).
|
||||
@@ -52,6 +54,7 @@ const mainConfig = (viewerHash, editorHash, cardEditorHash) => ({
|
||||
entryPoints: ["src/main.ts"],
|
||||
outfile: `${out}/nextfloor.js`,
|
||||
define: {
|
||||
...common.define,
|
||||
__NF_VIEWER_HASH__: JSON.stringify(viewerHash),
|
||||
__NF_EDITOR_HASH__: JSON.stringify(editorHash),
|
||||
__NF_CARD_EDITOR_HASH__: JSON.stringify(cardEditorHash),
|
||||
@@ -66,13 +69,14 @@ const symconEditorConfig = (viewerHash) => ({
|
||||
...common,
|
||||
entryPoints: ["src/components/editor.ts"],
|
||||
outfile: `${symconOut}/nextfloor-editor.js`,
|
||||
define: { __NF_VIEWER_HASH__: JSON.stringify(viewerHash), __NF_LANGS__: langs, "globalThis.__NF_SHARED_TEXTS__": "true" },
|
||||
define: { ...common.define, __NF_VIEWER_HASH__: JSON.stringify(viewerHash), __NF_LANGS__: langs, "globalThis.__NF_SHARED_TEXTS__": "true" },
|
||||
});
|
||||
const symconHostConfig = (viewerHash, editorHash, cardEditorHash) => ({
|
||||
...common,
|
||||
entryPoints: ["src/symcon-host.ts"],
|
||||
outfile: `${symconOut}/nextfloor-designer.js`,
|
||||
define: {
|
||||
...common.define,
|
||||
__NF_VIEWER_HASH__: JSON.stringify(viewerHash),
|
||||
__NF_EDITOR_HASH__: JSON.stringify(editorHash),
|
||||
__NF_CARD_EDITOR_HASH__: JSON.stringify(cardEditorHash),
|
||||
@@ -107,7 +111,7 @@ function copySymconAssets() {
|
||||
// Size budgets, small enough for old wall tablets. The editor bundles only load for admins and the card's settings, so they
|
||||
// may grow more than the view; German and English texts ride in every bundle.
|
||||
// Native multi-utility discovery and reports add about 8 KB to the shared runtime.
|
||||
const BUDGET = { "nextfloor.js": 660 * 1024, "nextfloor-3d.js": 1000 * 1024, "nextfloor-editor.js": 720 * 1024, "nextfloor-card-editor.js": 240 * 1024 };
|
||||
const BUDGET = { "nextfloor.js": 660 * 1024, "nextfloor-3d.js": 1000 * 1024, "nextfloor-editor.js": 720 * 1024, "nextfloor-card-editor.js": 240 * 1024, "nextfloor-trend.js": 100 * 1024 };
|
||||
|
||||
copyAssets();
|
||||
copySymconAssets();
|
||||
@@ -115,6 +119,8 @@ if (watch) {
|
||||
// in watch mode the hash is not tracked; a dev reload fetches the bundle anyway
|
||||
for (const c of [
|
||||
viewerConfig,
|
||||
trendConfig,
|
||||
{ ...trendConfig, outfile: `${symconOut}/nextfloor-trend.js` },
|
||||
editorConfig("dev"),
|
||||
cardEditorConfig,
|
||||
mainConfig("dev", "dev", "dev"),
|
||||
@@ -125,6 +131,9 @@ if (watch) {
|
||||
builderConfig,
|
||||
]) await (await context(c)).watch();
|
||||
} else {
|
||||
await build(trendConfig);
|
||||
copyFileSync(trendConfig.outfile, `${symconOut}/nextfloor-trend.js`);
|
||||
common.define.__NF_TREND_HASH__ = JSON.stringify(hashOf(trendConfig.outfile));
|
||||
await build(viewerConfig);
|
||||
const editor = editorConfig(hashOf(viewerConfig.outfile));
|
||||
await build(editor);
|
||||
|
||||
Reference in new issue
Block a user