Skip to content

feat(widgets): project full system token set into generated widget iframes - #3589

Open
Raing5Days wants to merge 1 commit into
GCWing:mainfrom
Raing5Days:feat/generative-ui-extra-css-interface
Open

Raing5Days wants to merge 1 commit into
GCWing:mainfrom
Raing5Days:feat/generative-ui-extra-css-interface

Conversation

@Raing5Days

Copy link
Copy Markdown
Contributor

Summary

  • Extend the generated-widget appearance payload from typography-only projection to the full system token set: spacing, radius, control sizing, layout, motion, layering, and typography variables are now read from the host design-system root (data-openbitfun-design-system-root + data-density) and fall back to static token values.
  • Update the GenerativeUI tool contract text (design-system reminder and widget_code schema description) so the model is told that spacing/radius/typography/motion variables are host-projected system tokens instead of "iframe-local scaffold values".
  • Benefits every consumer of readWidgetAppearancePayload: GenerativeUI widget iframes, the static renderer, DesktopCard custom HTML frames, canvas runtime appearance, and HTML export.

Type and Areas

Type: Feature

Areas: Web UI (generative widget appearance payload), Rust core (GenerativeUI tool prompt contract)

Motivation / Impact

Widgets previously rendered radius/spacing/control sizing from frozen iframe scaffold defaults, so they could drift from the active host appearance, density mode, and user font settings. Widgets can now rely on the same resolved system tokens the host uses; no widget authoring change is required, and model-facing guidance no longer instructs the model to treat these variables as iframe-local.

Verification

  • pnpm --dir src/web-ui run test:run src/tools/generative-widget/appearancePayload.test.ts src/tools/generative-widget/GenerativeWidgetFrame.test.tsx — passed (9 tests, incl. new host-projection test)
  • pnpm --dir src/web-ui run test:run src/tools/openbitfun-canvas/runtime/canvasRuntimeInstaller.test.ts src/tools/openbitfun-canvas/OpenBitFunCanvasPanel.test.tsx src/tools/openbitfun-canvas/runtime/CanvasRuntimeApp.test.tsx — passed (12 tests)
  • cargo test -p openbitfun-core --lib --features agent-runtime,tools-miniapp appearance_prompt — passed (3 tests)
  • pnpm run check:web — passed (canvas:sdk:check + appearance gates + type-check)
  • pnpm run theme:color-audit:all — passed (28 surfaces)
  • pnpm run fmt:rs — passed

Not verified: live in-app rendering (widget following density/font changes) — needs a desktop dev run.

Reviewer Notes

  • The iframe shell fallback CSS already contained every system token, so the payload only refreshes projected values; static fallbacks remain for headless/jsdom contexts.
  • No color values or theme JSON changed; theme governance baselines are untouched.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Generated with OpenBitFun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant