-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make unified server run in dev mode.
- **Move initialization code out of `index.html` and make `unified-server` work in dev mode.** - **Teach `remote-board-server` some more about unified server URLs.** - **Teach unified server to load assets.** - **Fix build.** - **docs(changeset): Make unified server run in dev mode.** Progress on #4342.
- Loading branch information
Showing
22 changed files
with
347 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"@breadboard-ai/unified-server": minor | ||
"@breadboard-ai/remote-board-server": patch | ||
"@breadboard-ai/visual-editor": patch | ||
"@google-labs/breadboard-schema": patch | ||
--- | ||
|
||
Make unified server run in dev mode. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
VITE_CONNECTION_SERVER_URL=http://localhost:3000/connection | ||
VITE_LANGUAGE_PACK=@breadboard-ai/shared-ui/strings/en_US | ||
VITE_ASSET_PACK=/icons/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# To connect the Visual Editor to a Connection Server, provide the Connection | ||
# Server URL here. | ||
VITE_CONNECTION_SERVER_URL= | ||
VITE_LANGUAGE_PACK=@breadboard-ai/shared-ui/strings/en_US | ||
VITE_ASSET_PACK=/icons/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
public | ||
index.html | ||
icons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* @license | ||
* Copyright 2024 Google LLC | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import * as pkg from "../package.json" with { type: "json" }; | ||
import * as StringsHelper from "@breadboard-ai/shared-ui/strings"; | ||
|
||
const icon = document.createElement("link"); | ||
icon.rel = "icon"; | ||
icon.type = "image/svg+xml"; | ||
icon.href = MAIN_ICON; | ||
document.head.appendChild(icon); | ||
|
||
const assetPack = document.createElement("style"); | ||
assetPack.textContent = ASSET_PACK; | ||
document.head.appendChild(assetPack); | ||
|
||
const params = new URLSearchParams(location.search); | ||
if (params.has("dark")) { | ||
globalThis.localStorage.setItem("dark-theme", "true"); | ||
} else if (params.has("light")) { | ||
globalThis.localStorage.removeItem("dark-theme"); | ||
} | ||
|
||
if (globalThis.localStorage.getItem("dark-theme") === "true") { | ||
document.documentElement.classList.add("dark-theme"); | ||
} | ||
|
||
async function init() { | ||
const version = pkg.default.version; | ||
await StringsHelper.initFrom(LANGUAGE_PACK); | ||
|
||
const { Main } = await import("@breadboard-ai/visual-editor"); | ||
const { SettingsStore } = await import( | ||
"@breadboard-ai/shared-ui/data/settings-store.js" | ||
); | ||
|
||
const config = { | ||
settings: SettingsStore.instance(), | ||
version, | ||
}; | ||
|
||
window.oncontextmenu = (evt) => evt.preventDefault(); | ||
|
||
const main = new Main(config); | ||
document.body.appendChild(main); | ||
|
||
const Strings = StringsHelper.forSection("Global"); | ||
console.log( | ||
`[${Strings.from("APP_NAME")} Visual Editor: Version ${version}]` | ||
); | ||
} | ||
|
||
init(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="vite/client" /> | ||
|
||
declare const MAIN_ICON: string; | ||
declare const ASSET_PACK: string; | ||
declare const LANGUAGE_PACK: unknown; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.