feat: P5 — first widget on screen (clock via SDK)
The dashboard finally has live content. `runtime.ts` now imports
`defineWidget` from `@dashward/widget-sdk` (added as a workspace
dependency of the container), defines a tabular-numerals clock widget
inline, and mounts it onto the 12-column grid via a generic
`mountWidget` + `createContext` pair that produces the SDK's
config/system/lifecycle/shell APIs.
container/runtime/runtime.ts
- mountWidget(def, parent, instanceId, size): creates a grid card,
applies grid-column/row span, builds the widget context, calls
def.mount; wraps in try/catch so a mount failure visibly degrades
the card (red border + error label) instead of breaking the page.
- createContext: localStorage-backed config (persists per
instanceId), theme reads dataset.theme and subscribes to the
dashward:ThemeChanged CustomEvent (DBus signal forwarded from
shell), shell.call delegates to window.__dashShell__. onMount
fires via microtask; onUnmount handlers stored; visibility is a
no-op until P7 (edit mode / workspace tracking).
- clockDef: defineWidget<ClockConfig>; shadow DOM root, large
tabular-numerals time string, re-renders on tick + config.onChange.
container/runtime/styles.css
- Real card style: half-transparent backdrop-filter blur with a
light/dark variant, rounded 18px corners, subtle border and shadow.
- .widget-error fallback for failed mount.
- grid-auto-rows: minmax(120px, auto) so widgets have a sensible
minimum row height.
container/package.json
- `@dashward/widget-sdk` is now a runtime dependency. esbuild
bundles it into runtime.js.
Verified on ubuntu2504-test VM: clock card renders top-left at 4-wide
× 2-tall, ticks every second, follows system theme live via the P4
bridge (light → glass-white card, dark → glass-black card).
Layout persistence, edit mode, dynamic disk loading of widget bundles,
and iframe crash isolation per design §11 / §14 land in P6+.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
4
pnpm-lock.yaml
generated
4
pnpm-lock.yaml
generated
@@ -16,6 +16,10 @@ importers:
|
||||
version: 5.9.3
|
||||
|
||||
container:
|
||||
dependencies:
|
||||
'@dashward/widget-sdk':
|
||||
specifier: workspace:*
|
||||
version: link:../sdk
|
||||
devDependencies:
|
||||
'@girs/gio-2.0':
|
||||
specifier: ^2.88.0-4.0.0
|
||||
|
||||
Reference in New Issue
Block a user