chore: P0 skeleton
Bootstrap the Dashward repo per arch/UBUNTU-DASHBOARD-SPACE.md: - pnpm-workspaces monorepo (sdk, extension, container, widgets-builtin/*) - GNOME extension stub (metadata.json, src/*.ts placeholders for warden, guard, supervisor, entry UX, DBus service) - WebKit container stub (GJS main + page-side runtime + dashboard.html) - TypeScript widget SDK (defineWidget + types) - Builtin clock widget as the first SDK consumer example - DBus interface XML (proto/shell.iface.xml) and shared types - esbuild configs for extension and container; tsc for SDK - Design doc copied in at repo root for discoverability No functional logic yet -- all components are placeholders that compose in extension.ts so the build chain can be exercised. P1 (workspace warden) starts next. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
sdk/package.json
Normal file
22
sdk/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@dashward/widget-sdk",
|
||||
"version": "0.0.0",
|
||||
"description": "TypeScript SDK for authoring Dashward widgets.",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc -p tsconfig.json",
|
||||
"dev": "tsc -p tsconfig.json --watch"
|
||||
}
|
||||
}
|
||||
5
sdk/src/define-widget.ts
Normal file
5
sdk/src/define-widget.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { WidgetDefinition } from './types.js';
|
||||
|
||||
export function defineWidget<T>(def: WidgetDefinition<T>): WidgetDefinition<T> {
|
||||
return def;
|
||||
}
|
||||
11
sdk/src/index.ts
Normal file
11
sdk/src/index.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export { defineWidget } from './define-widget.js';
|
||||
export type {
|
||||
Theme,
|
||||
WidgetHost,
|
||||
WidgetContext,
|
||||
WidgetDefinition,
|
||||
ConfigApi,
|
||||
SystemApi,
|
||||
LifecycleApi,
|
||||
ShellApi,
|
||||
} from './types.js';
|
||||
41
sdk/src/types.ts
Normal file
41
sdk/src/types.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
export type Theme = 'light' | 'dark';
|
||||
|
||||
export interface WidgetHost {
|
||||
readonly element: HTMLElement;
|
||||
readonly instanceId: string;
|
||||
}
|
||||
|
||||
export interface ConfigApi<T> {
|
||||
get(): T;
|
||||
set(value: Partial<T>): Promise<void>;
|
||||
onChange(handler: (value: T) => void): () => void;
|
||||
}
|
||||
|
||||
export interface SystemApi {
|
||||
getTheme(): Theme;
|
||||
onThemeChange(handler: (theme: Theme) => void): () => void;
|
||||
}
|
||||
|
||||
export interface LifecycleApi {
|
||||
onMount(handler: () => void): void;
|
||||
onUnmount(handler: () => void): void;
|
||||
onVisibilityChange(handler: (visible: boolean) => void): () => void;
|
||||
}
|
||||
|
||||
export interface ShellApi {
|
||||
call<T = unknown>(method: string, args?: unknown): Promise<T>;
|
||||
}
|
||||
|
||||
export interface WidgetContext<T> {
|
||||
config: ConfigApi<T>;
|
||||
system: SystemApi;
|
||||
lifecycle: LifecycleApi;
|
||||
shell: ShellApi;
|
||||
}
|
||||
|
||||
export interface WidgetDefinition<T> {
|
||||
id: string;
|
||||
defaultConfig: T;
|
||||
mount(host: WidgetHost, ctx: WidgetContext<T>): void;
|
||||
configUI?(host: WidgetHost, ctx: WidgetContext<T>): void;
|
||||
}
|
||||
8
sdk/tsconfig.json
Normal file
8
sdk/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user