Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/opal-frontend/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"projectService": true
}
}
1 change: 1 addition & 0 deletions packages/opal-frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
2 changes: 2 additions & 0 deletions packages/opal-frontend/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
tsconfig.tsbuildinfo
10 changes: 10 additions & 0 deletions packages/opal-frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Opal Frontend</title>
</head>
<body>
<script type="module" src="/src/index.ts"></script>
<opal-main></opal-main>
</body>
115 changes: 115 additions & 0 deletions packages/opal-frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"name": "@breadboard-ai/opal-frontend",
"private": true,
"version": "0.1.0",
"description": "The Opal Frontend",
"main": "./dist/src/index.js",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"default": "./dist/src/index.js"
},
"./package.json": "./package.json"
},
"types": "dist/src/index.d.ts",
"type": "module",
"scripts": {
"build": "wireit",
"build:vite": "wireit",
"build:tsc": "wireit",
"dev": "vite",
"lint": "wireit"
},
"wireit": {
"build": {
"dependencies": [
"build:vite"
]
},
"typescript-files-and-deps": {
"files": [
"src/**/*.ts",
"tsconfig.json",
"vite.config.ts",
"../../core/tsconfig/base.json",
"package.json"
]
},
"check:tsc": {
"command": "tsc -b --pretty --noEmit",
"env": {
"FORCE_COLOR": "1"
},
"dependencies": [
"typescript-files-and-deps"
],
"files": [],
"output": []
},
"build:tsc": {
"command": "tsc -b --pretty",
"env": {
"FORCE_COLOR": "1"
},
"dependencies": [
"typescript-files-and-deps"
],
"files": [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has no "output", so it can never get cached by wireit

"dist/tsc/"
]
},
"build:vite": {
"command": "vite build",
"env": {
"FORCE_COLOR": "1"
},
"dependencies": [
"check:tsc"
],
"files": [
"vite.config.ts",
"*.html"
],
"output": [
"dist/"
]
},
"lint": {
"command": "eslint --max-warnings=0 'src/**/*.ts'",
"files": [
"src/**/*.ts",
"../../eslint.config.js"
],
"output": []
}
},
"repository": {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: more idiomatic to have the package metadata the the top

"directory": "packages/opal-frontend",
"type": "git",
"url": "git+https://github.com/breadboard-ai/breadboard.git"
},
"files": [
"dist/",
"index.html"
],
"keywords": [],
"author": "Google Labs Team",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/breadboard-ai/breadboard/issues"
},
"homepage": "https://github.com/breadboard-ai/breadboard/tree/main/packages/opal-frontend#readme",
"devDependencies": {
"@google-labs/tsconfig": "^0.0.2",
"@types/node": "^22.0.0",
"typescript": "^5.8.3",
"vite": "^7.2.6",
"wireit": "^0.15.0-pre.2"
},
"dependencies": {
"@lit-labs/signals": "^0.1.3",
"lit": "^3.3.2",
"signal-polyfill": "^0.2.2",
"signal-utils": "^0.21.1"
}
}
47 changes: 47 additions & 0 deletions packages/opal-frontend/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @license
* Copyright 2025 Google LLC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

* SPDX-License-Identifier: Apache-2.0
*/

import { signal } from "signal-utils";
import { SignalWatcher } from "@lit-labs/signals";
import { LitElement, html, css } from "lit";
import { customElement } from "lit/decorators.js";

/**
* @constructor
* @extends {LitElement}
*/
const SignalWatcherBase = SignalWatcher(LitElement);

@customElement("opal-main")
/** @extends {LitElement} */
class OpalMain extends SignalWatcherBase {
static override styles = css`
:host {
display: block;
font-family: system-ui, sans-serif;
padding: 2rem;
}
`;

@signal accessor time = new Date().toLocaleTimeString();

override connectedCallback() {
super.connectedCallback();
setInterval(() => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just a test, but the timer needs to get closed on disconnectedCallback

this.time = new Date().toLocaleTimeString();
}, 1000);
}

override render() {
return html`<h1>Hello, Signals! The time is ${this.time}</h1>`;
}
}

declare global {
interface HTMLElementTagNameMap {
"opal-main": OpalMain;
}
}
20 changes: 20 additions & 0 deletions packages/opal-frontend/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2022",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's bump to 2024 for target and lib?

"module": "nodenext",
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
"useDefineForClassFields": false,
"outDir": "dist/tsc",
"moduleResolution": "nodenext",
"resolveJsonModule": true,
"isolatedModules": true,
"strict": true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to make sure we have all the same strictness checks enabled externally as internal.

"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"types": ["vite/client", "node"]
},
"include": ["src/**/*.ts"],
"extends": "@google-labs/tsconfig/base.json"
}
26 changes: 26 additions & 0 deletions packages/opal-frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2025 Google LLC
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026

* SPDX-License-Identifier: Apache-2.0
*/

import { defineConfig, type UserConfig } from "vite";

export default defineConfig((): UserConfig => {
return {
optimizeDeps: { esbuildOptions: { target: "esnext" } },
build: {
target: "esnext",
outDir: "dist/client",
},
resolve: {
dedupe: ["lit"],
},
server: {
port: 3333,
watch: {
ignored: ["**/.wireit/**"],
},
},
};
});
4 changes: 3 additions & 1 deletion packages/unified-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
},
"build:vite": {
"dependencies": [
"../visual-editor#build"
"../visual-editor#build",
"../opal-frontend#build"
]
},
"build:tsc": {
Expand Down Expand Up @@ -167,6 +168,7 @@
"dependencies": {
"@breadboard-ai/types": "0.9.0",
"@breadboard-ai/utils": "^0.1.0",
"@breadboard-ai/opal-frontend": "0.1.0",
"@breadboard-ai/visual-editor": "1.30.0",
"@google-cloud/storage": "^7.15.2",
"compression": "^1.8.1",
Expand Down
Loading