Skip to content

Bootstrap Scene: Model / Engine / React split - #8

Merged
einari merged 7 commits into
mainfrom
feature/bootstrap-repo
Aug 15, 2026
Merged

Bootstrap Scene: Model / Engine / React split#8
einari merged 7 commits into
mainfrom
feature/bootstrap-repo

Conversation

@einari

@einari einari commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Added

  • Cratis.Scene.Model (C#) — the platform-agnostic Screen object model: the SceneElement → VisualElement → FrameworkElement → Control → Panel/ItemsControl/ContentControl/ExternalComponent element hierarchy, Layout (flow and freeform arrangement per slot, width × height size classes), Form (the three population/mapping tiers), contribution points and navigation, and UiProfile/Theme. No React, DOM or CSS vocabulary anywhere in this project.
  • @cratis/scene.model — the TypeScript mirror, hand-maintained and guarded by a real cross-language parity spec: a shared scene-model-shape.json manifest that both a C# spec (reflection over the assembly) and a TypeScript spec (walking each type's own PropertyNames const) assert against independently, so a desync on either side fails its own build.
  • @cratis/scene.engine — the Renderer<TOutput> contract a renderer implements (one method per concrete element kind), and a renderElement() tree walk. Binding resolution is injected via a BindingResolver callback rather than solved here — the profile/contribution/layout/theme resolution engines are separate, later issues.
  • @cratis/scene.react — implements the renderer contract against real React/DOM, with a small core component set (core:text/button/card) and Storybook wired at the package level.
  • Repository scaffold: .ai/ instruction corpus and its Copilot/Claude/Codex adapters, build/lint/format config, and CI workflows (dotnet + JS build, NuGet + npm trusted publishing, semver label gate) — copied from Cratis/Arc, the closest real dual-stack framework repo.

Notes

  • The design-time editor building on this object model belongs in Studio (StudioIssues#156), not here.
  • Verified end to end: dotnet build/dotnet test clean (Debug + Release, 0 warnings), yarn ci clean across all three JS packages, yarn build-storybook succeeds, and the parity spec genuinely fails on both sides when deliberately desynced (verified, then reverted).

(#1)

einari and others added 7 commits August 14, 2026 18:41
Copies the shared .ai/ instruction corpus and its Copilot/Claude/Codex
adapters, root build/lint/format config (Directory.Build.props,
Directory.Packages.props, .editorconfig, .globalconfig, tsconfig,
vitest, eslint, yarn workspace tooling), and CI workflows (dotnet/JS
build, NuGet + npm trusted publishing, semver label gate) from
Cratis/Arc, the closest real dual-stack framework repo (Stage turned
out to be .NET-only).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Records for the element hierarchy (harvested from Studio's wireframe
tool's SceneObject/UIElement/FrameworkElement/Control/Panel shape,
stripped of editor-only concerns), layouts (flow and freeform
arrangement per slot, width x height size classes), forms (the three
population/mapping tiers), contribution points and navigation, and
ui profiles/themes. No React, DOM or CSS vocabulary anywhere in this
project — Scene.React and future renderers map these primitives to
their own platform.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Every consumer of this package also has the DOM's own global
Element type in scope (react/vite tsconfig pulls in the DOM lib),
so the bare name would shadow it at every import site.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Follow-up to the previous commit's rename — the type reference
edits didn't make it into that commit alongside the file rename.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Mirrors every Cratis.Scene.Model record/enum as a TypeScript
interface/enum plus a co-located own-property-names const array
(interfaces have no runtime shape, so the const is what the parity
spec actually inspects).

Both sides assert their own reflected/declared shape against a
shared scene-model-shape.json manifest independently (Model.Specs/
for_SceneModelShape on the C# side, model/for_shape on the TS side)
-- verified end-to-end: 11 C# specs and 38 TS tests all pass against
the same manifest.

Also:
- fixes the root package.json/root tsconfig.json/eslint config,
  which still referenced Arc's own packages after being copied
  wholesale during the bootstrap commit
- brings over Arc's TypeScript-7-compatibility yarn plugin, needed
  by the same typescript-eslint version pin
- converts the shared vitest.setup.ts to plain JS (vitest.setup.js)
  and drops its @cratis/fundamentals import (a Scene.Model dependency
  Arc has but Scene does not) -- also sidesteps a Vite 8 oxc-transform
  bug where a setup file outside every package's own tsconfig rootDir
  fails to resolve a tsconfig at all

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Renderer<TOutput> is the contract Scene.React implements -- one
method per concrete element kind Scene.Model ships (ContentControl,
ItemsControl, ExternalComponent, Panel), so Scene.Native/Scene.Desktop
are sibling positions rather than special cases. renderElement() walks
a resolved tree bottom-up, delegating binding resolution (an
ItemsControl's itemsSource) to an injected BindingResolver rather than
solving it here -- the actual profile/contribution/layout/theme
resolution engines are Scene#2 through #5, layered on top of this walk.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implements Scene.Engine's Renderer contract against real React/DOM
(SceneElementView + createReactRenderer), plus a small `core`
component set (core:text, core:button, core:card) -- the minimum
vocabulary Scene#3's package resolution always falls back to. An
unresolved ExternalComponent renders a visibly broken placeholder
rather than silently disappearing.

Storybook is wired at the package level (aliased straight to
scene.model/scene.engine source for a fast dev loop) with two stories
covering a resolved tree and an unresolved component; `yarn
build-storybook` succeeds end to end.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@einari einari added screen Screen/UI work: Screenplay UI constructs, Scene runtime, Stage rendering, Studio designers minor labels Aug 14, 2026
@einari
einari merged commit 9edbeae into main Aug 15, 2026
2 of 3 checks passed
@einari
einari deleted the feature/bootstrap-repo branch August 15, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor screen Screen/UI work: Screenplay UI constructs, Scene runtime, Stage rendering, Studio designers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant