Repository navigation
Lab Breakdown and Experiments - #13
Closed
bcsfreitas wants to merge 39 commits into
Closed
bcsfreitas wants to merge 39 commits into
bcsfreitas wants to merge 39 commits into
Conversation
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). The tree reader follows a component file through the .vue files it imports inside its system (the system's aliases, ~/ at the copied app source) down to Nuxt UI pieces, whose leaves are the theme slots their templates render, and icons. Plain HTML is skipped, v-for tags are one node, and each node's ID is its path in the tree. The catalog names each component's breakdown preview and the component page data carries its tree.
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). The preview document reports where each Breakdown piece's elements and theme slots are (nodes: node ID -> boxes and slot boxes), and the studio names the pieces to outline (highlight: hover and selected). Both are validated as transport, like props.
Everyone's experiments of a component, listed from a summary in the main manifest: views marked <!-- @Lab-Experiment <system-id> <slug> [date] -->. New experiment makes the person's "<Component> experiments" prototype the first time, through the prototype creation service, and starts the view from the component's rendering source. Duplicate copies anyone's experiment into your own. A Lab handler on the dev server does both. Spec: .scratch/component-breakdown/spec.md (ticket 04).
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). Each component file gets a breakdown entry in its system's preview document, mounted like its playground from an instrumented copy served under its own name (button.vue -> button.lab-breakdown.vue), so examples and playgrounds keep the plain file. In the copy, and in the .vue files it imports inside the system or the prototypes, every tag the tree reader names reports its component to the runtime's $lab under its node ID and takes its ui and class through $lab's override store. The runtime marks each piece's elements with data-lab-node, reports their boxes and theme slot boxes (nodes) whenever they change, and outlines the pieces the studio highlights.
Browser scenarios on the dev server (as Ben, and as someone who hasn't joined) and on the static build; the Lab README, the glossary's Experiment and the build-prototype skill's word on the marker. Spec: .scratch/component-breakdown/spec.md (ticket 04).
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). A Breakdown tab after Playground, at /lab/<system>/<slug>/breakdown. The stage is fed a tree and a preview ID: it lays the tree out top-down on a dotted canvas that pans and zooms, with elbow connectors, a source chip on each and a Nuxt UI piece's theme slots in a grid under it. The root card shows the component live with the Playground's opening values; hovering a card lifts it and outlines its piece in the preview, clicking selects it (blue outline, its name in the toolbar), and Escape or a click on the empty canvas lets go. The bottom toolbar zooms and cross-fades to the component alone, kept in the address (?view=component), and leaves room for an inspector. A preview frame can now send further host messages after each ready.
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). The build splits a .vue file's TypeScript script into its own module (<file>?vue&type=script...), so imports from an instrumented copy arrived with a query on the importer and the copied app files they name were left plain. The importer's file part now decides.
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). The canvas opens fitted to its height too, above the toolbar, so a short tree shows whole. The hovered piece's outline is dashed so it reads inside the selected one. The Lab tabs test lists Breakdown.
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). The Lab README covers the Breakdown tab: the tree reader, node IDs, the instrumented preview and its messages, the cards, the canvas and the toolbar's inspector slot. The Systems README lists each component's Breakdown preview.
Spec: .scratch/component-breakdown/spec.md (ticket 01, Breakdown tree). On the real Endless Studios system: the tab and its address, the button's tree (its file, UButton, its theme slots) live in the root card with its element marked, the sidebar through its copied app file, the canvas's zoom, pan and Component/Breakdown toggle, and hover, select, Escape and the empty canvas.
✅ Deploy Preview for ea-prototyping-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
# Conflicts: # i18n/locales/en.json # src/modules/lab/README.md # src/modules/lab/module.ts # src/modules/lab/utils/lab.ts # tests/unit/lab-addresses.test.ts
Each card below the root clips a frame of the same Breakdown preview to the box its document reports for that piece (a theme slot's element for a slot card), and says "Not shown with this content" when the piece isn't rendered. Frames mount only for cards near the view at a readable zoom. Every frame hears the stage's host messages through useBreakdownMessages. Spec: .scratch/component-breakdown/spec.md (ticket 02).
Knobs come from the classes each theme slot renders with, one family per kind of utility, stepping along Tailwind's scale and shown in pixels. The preview stylesheet names every class a knob can write with @source inline. Spec: .scratch/component-breakdown/spec.md (ticket 03)
The host sends a Breakdown's unsaved changes (overrides) and the area a hovered knob changes (knob); the document reports each theme slot's classes beside its boxes, restyles pieces in place and draws the knob's area in its colour. Spec: .scratch/component-breakdown/spec.md (ticket 03)
Selecting a piece shows its knobs, Reset and Save with the count of unsaved changes; on a system component Save reads Save as experiment and stays disabled until saving lands. Spec: .scratch/component-breakdown/spec.md (ticket 03)
The files were written with Windows line endings; the repository uses LF. Spec: .scratch/component-breakdown/spec.md (ticket 03)
An instrumented copy is served under a name no file has, so a change to the component's file (or a file it imports) never reached the Breakdown's frames. The plugin now reloads the copy of a changed .vue file, so the root and every piece card follow the file on disk. Spec: .scratch/component-breakdown/spec.md (ticket 02).
The knobs scroll inside the toolbar instead of shrinking to nothing. Spec: .scratch/component-breakdown/spec.md (ticket 03)
Knob overrides now travel in the Breakdown's shared messages, so every frame (root, piece cards, the component alone) follows the knobs; the hovered knob's area goes with the highlight to the pieces. Spec: .scratch/component-breakdown/spec.md (ticket 03)
The source writer for Lab experiments: each change goes into its piece's tag as plain theme classes (a ui object, a key merged into one, a dynamic ui spread, or the tag's static class for its root slot), replacing the class of the same knob family and leaving prefixed ones. Spec: .scratch/component-breakdown/spec.md (ticket 05).
A save handler that checks the view is an experiment, canEdit and the file's version before writing; Save as experiment and Save as my experiment write the changes into the experiment they make. Each experiment's Breakdown (tree, preview, version) comes from Lab build data, and its instrumented preview from the manifest's views. Spec: .scratch/component-breakdown/spec.md (ticket 05).
An experiment's page shows its own Breakdown (tree from its file, its instrumented preview, piece cards and knobs). Save writes the changes into the file over the version the changes began on; someone else's experiment saves as a copy of your own and the original component as a new experiment. Leaving with unsaved changes asks first, and the deployed site shows no Save. Spec: .scratch/component-breakdown/spec.md (ticket 05).
A Nuxt UI piece's own class lands on its root slot after its ui, so the preview passes that slot's overrides through the class too and the writer replaces a class of the same family there. The root slot is the first one the piece's template renders, carried on each Nuxt UI tag. Spec: .scratch/component-breakdown/spec.md (ticket 05).
Adds Breakdown and Knob to the glossary, names the breakdown in the Lab's module description, says in the Lab README which pieces have no knobs (as the sweep found), and tells the build-prototype skill what the experiment marker and saved knob classes mean for an agent editing an experiment. Spec: .scratch/component-breakdown/spec.md (ticket 06).
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions: "Starting from the component's Default example (or first example)"; US 35, 38, 42). Review fixes P1, P10, P2, P3 and item 6. - A system component's Breakdown now reads its tree from, and previews, the same source New experiment copies (tooling/systems/start-source.ts, served beside the component as <name>.lab-start.vue), so every piece's node ID matches the new experiment's tag and Save as experiment writes each change. Checked for all 36 Endless Studios components. - A component file that only renders one copied app component (the sidebar) starts from that app component's template and script, so its pieces are in the experiment's file. - A piece whose tag lives in another file has no knobs; the inspector names the file. Save as experiment and Save as my experiment refuse a change they can't place, keeping it pending, and the toast says why. - Save writes only into your own experiment; on anyone else's, Admins included, it is Save as my experiment. The ownership rule is shared with the prototypes module's useMayChange.
Spec: .scratch/component-breakdown/spec.md (US 17, 22, 23, 30, 47; Testing Decisions: the 36-component sweep). Review fixes P4-P8 and the sweep's two causes. - Stepping goes to the nearest value in the pressed direction: a value off the scale lands on the next size (or stays at the scale's end), sizes that are equal count once, and a colour off the theme's list stays. Tailwind's 5xl-9xl sizes are on the scale. - Every theme text size is read from its tokens (multi-word names, a `_` in the token as a `.` in the class), shown in pixels, offered by the knob, safelisted, and registered with the preview's tailwind-merge font-size group, so a knob's size replaces a theme size. - Colour options show a swatch of the colour the system paints the class with, measured in the root's preview document (`swatches` messages). - An experiment whose structure can't be read has Try again; someone not joined reads why Save as experiment is unavailable (LabJoinNote). - Overlays show open in a Breakdown (default-open), so their theme slots have knobs; a Nuxt UI piece whose theme has no slots (container, link) has knobs on its own element, written into its class. A piece's knobs come only from its own theme slots, and a slot belongs to the deepest piece marking its element.
Spec: .scratch/component-breakdown/spec.md (Testing Decisions). Review fixes S1 and S2. - Knob-family and source-chip colours are studio theme tokens (--color-knob-*, --color-source-*) instead of hex values in components; the system's own colour swatches stay data. Unit test: lab-colours. - The Lab's e2e tests find elements by accessible role and name. Only the spec's data attributes and a few unnamed hooks (data-knob-handle, data-lab-overlay, data-lab-knob-overlay, data-lab-knob-area) remain.
Spec: .scratch/component-breakdown/spec.md (US 35). Follow-up to the start-source change: the Breakdown entry is now the component's start source, so the build's compile check skipped it and one broken component file stopped the static site. The check now covers Breakdowns too, through the component file behind the start source. Covered by tests/e2e/lab-playground.test.ts on the deployed site.
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions, no behaviour change). Review fix S14. `posix` and `within` were written five times in tooling/ and the Lab's module; they now live in tooling/paths.ts. tooling/manifest/build.ts keeps re-exporting `posix` for its existing importers.
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions,
"node IDs"; no behaviour change). Review fix S12.
- ROOT_NODE, slotId, pieceOf, slotOf and fileOwnerOf live in
tooling/preview/protocol.ts, which the studio, the preview runtime and
the tooling already share, instead of hand-made `split('#')` and
`lastIndexOf` in eight places.
- The runtime's BreakdownOverrides was the protocol's PreviewOverrides
under another name; it is gone.
- Unit test: lab-node-ids.
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions; no behaviour change). Review fix S13. The outline layer and the knob highlight layer were built the same way, placed boxes with the same function and had their own copy of NodeBox. runtime/pieces.ts now holds overlayLayer, place and ownsSlot for both, and NodeBox is the one box type.
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions; no behaviour change). Review fix S15. The Breakdown's tree reader, its instrumentation, the start source and the source writer compared Vue template nodes with bare numbers (6, 7) or their own ELEMENT and COMPONENT constants. They now use NodeTypes and ElementTypes from @vue/compiler-core, declared as a dependency at the version Vue already installs (no new package in yarn.lock), and the writer reuses the tree reader's TemplateAttribute instead of its own copy.
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions, "an experiment is a view marked with its component"). Review fix S8. "A marker naming another system than its prototype's is ignored" was written in the manifest, Save, the experiments service (twice) and the Breakdown trees. experimentOf(source, prototype) in tooling/manifest/experiments.ts now decides it for all of them. Finding your prototype for a component now also skips a view whose marker names another system, as the manifest already did. Unit test in lab-experiments.
Spec: .scratch/component-breakdown/spec.md (Implementation Decisions; no
behaviour change). Review fixes S6 and S7.
- labContext(root, contributorsFolder) in experiments/context.ts reads the
studio's settings and installed file types once, for both handlers and
the experiments' build data, instead of three copies.
- installedSystems is the one systems loader for Save, the experiments
service and the Breakdown trees; viewTypeIn the one view-type lookup;
refuse and gone the one set of refusals ("This experiment no longer
exists." was written twice).
- ExperimentsContext moves there too; service.ts still exports it.
…e them on its tags
Collaborator
Author
|
Closing: discarded during branch cleanup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two tabs to each component's Lab bench, after the reference video in the spec:
Spec and tickets are local files:
.scratch/component-breakdown/spec.mdand.scratch/component-breakdown/issues/01…06.Tickets
Verification
yarn lint,yarn typecheck,yarn test(141 files, 1145 tests) on b0fd767.yarn buildandyarn build:inspect.Decisions taken during the run (open to review)
uiprop, never the shared theme. Pieces whose tag lives in another file have no knobs and say which file.@vue/compiler-coreis declared directly (same version already installed with Vue).Follow-ups (not in this PR)