Skip to content

Canvas 1.3.0

Choose a tag to compare

@jamesrochabrun jamesrochabrun released this 05 Jul 08:43
· 13 commits to main since this release

Tweakable props system

Pages can now declare expressive, host-rendered tweak controls, and hosts can render, live-apply, and persist them natively.

New

  • TweaksBridge — injects a dc_set_props runtime into the page at document start. Pages declare props (slider, select, color, toggle, text), read current values via this.props, and re-render through dc_on_props_changed. Declared schemas post to native with key order preserved; native pushes values back via setProp.
  • TweakProp / TweakPropValue — value models for declared props.
  • TweaksState — @Observable model holding the current page's schema.
  • TweaksPanelView — popover-ready panel: "Describe a tweak…" field, an Ideas action, and one native SwiftUI control per declared prop.
  • TweaksPromptBuilder — agent prompts (ideas + custom instruction) with the props contract appended so generated declarations stay machine-editable.
  • TweakPropsSourceEditor — deterministic default-value rewriting in page source: comment/string-aware scanning, tolerant parsing (single quotes, bare keys), splice verified by re-parse. Non-scalar defaults degrade to live-only, never corrupting the file.

Changed

  • InspectableWebView gains an optional onTweakPropsChange callback (defaulted — source compatible).

Tests

158 tests, including a live WKWebView integration test covering the full round trip (page declares → native receives; native setProp → page re-renders).

Full Changelog: 1.2.2...1.3.0