Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- **Your agent knows how to version a project.** Ask it to keep the mockups in your repository and it runs
`gockup export`, which writes the `.gockup` file and its assets.
- **Journeys**: name a way through your mockup, from the screen it starts at to the one it is meant to get to. The board
flags where each starts and marks the screens it goes through; a click on the flag lights the way, numbered, with what
is clicked on each screen: the shortest way, or the one through a screen you name with `via`. J, or the route button beside Present, lists them in the sidebar.
- **Try a journey**: use the mockup as if it were the app. The path shows each screen and what you clicked, and at the
end, the clicks that did nothing and the screens no click opens.
- `goto=back`, for a back arrow or a Cancel: while a journey is tried, it opens the screen the user came from.

### Fixed

- The tooltip of Present, in the top bar, was cut by the window's edge: it opens below the button.

## [0.3.0] - 2026-12-03

Expand Down
31 changes: 29 additions & 2 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,32 @@ centered, scaled down to fit and never up. Its gotos navigate; ← and → and t
(name, "i / n") go through its page in the board's order and stop at the ends. Esc, or the "Back to the
board" pill, comes back with the last screen presented selected.

## Trying a journey

Present shows screens; trying a journey is using the app, to find where it fails. They stay two modes.

- A journey is in sight on the board: a flag with its name over the screen it starts at, and the route mark in the
title of every screen one goes through. Nothing has to be opened to know it is there.
- A click on the flag **lights** it, the board staying where it is: its screens outlined in coral and numbered, a ring
around what is clicked on each, the arrow leaving from it, and the rest dimmed, with no other arrows. The way is the
shortest to the journey's end, through the screen it is `via` if it names one; one with no end lights every screen its start leads to, with no numbers. The
selected frame, when not on the way, is outlined in gray. A second click or Esc turns it off.
- The lit journey has a bar at the board's bottom left: name, how many screens, "Try it". The flag's ▶ tries it too.
- The sidebar's **Journeys** are listed only when asked for, by the route button beside ▶, J, or a route mark, which
also lights the journey. They stay under the tree, over Settings, and scroll past 280dp. The lit one has its steps
("1 Login · Create an account"), a click on one going to it, a pencil and a bin; one no click leads to the end of
says so in yellow. "New journey from Login" makes one from the selected screen, its name ready to be written.
- The window is the app, live and alone, as Present draws it, and the path in the sidebar's place: each screen gone
through, numbered, with what was clicked on it, the one it is on in coral. The last 8 are listed.
- The bottom pill has a step back, the screen's name, start over, and the route button, which hides the path and
stays as it was left. There is no next: only the app's own links lead on.
- What is typed stays on the way back; starting over clears it. A step back undoes the step, the app's own back
(`goto=back`) is one more.
- At the end, the journey's `to` or a screen nothing leads out of, once through its `via`, the path says "Got to Welcome in 4 steps" and
**what it showed**: the clicks that did nothing, in yellow, and the screens of its pages no click opens, in blue.
Three names at most, then "and 2 more"; with neither, one green line says so.
- Esc goes back to the board with the screen it was on selected.

## Settings

- Settings is a row at the foot of a project's sidebar, under a rule, there whatever the list's length (the
Expand Down Expand Up @@ -206,7 +232,8 @@ overview: it opens on the board, with every screen.
changed screens are selected.
- Over the cards, while there are any, a strip names the pages the model changed, four at most, each with how many
screens and a click to open it: their cards can be far down. "Mark all as seen" at its right takes every mark off.
- Nothing is selected on it: no row but Overview is filled, and there are no tools, zoom or Present.
- Nothing is selected on it: no row but Overview is filled, and there are no tools, zoom or Present; the
journeys are the project's, so their button stays, and lighting one opens its page.

## Dialogs

Expand Down Expand Up @@ -247,7 +274,7 @@ light); a click on the veil or Esc closes it and does nothing else.
always live. A frame that is live but not selected takes no clicks itself: a click selects it.
- Tools as in Figma: Move (V) drags frames and, on the bare board, draws a box to pick them; Hand (H, or
Space or Ctrl held, or the middle button, or scrolling) pans; Note (N) places a note. Each tool shows its
name and shortcuts in a tooltip.
name and shortcuts in a tooltip, above it; the top bar's open below, where there is room.
- Frames are picked together by Shift+click (on a picked one, it leaves), by the box (the frames it
touches; with Shift, added) or Ctrl+A (the page's); Esc or a click on one frame goes back to one. Each
picked frame is outlined, the whole of them in a coral hairline 4dp out, the crumbs say "3 screens",
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ one to check its own work. You watch it happen.
- **The model at work, in the open.** What it changes lights up on the board, and one click takes it back.
- **Notes that stay.** Pin the why to a screen. The model reads it before touching that screen again.
- **A flow you can click.** Present a screen and walk the app through its links, with live widgets.
- **A journey you can try.** Use the mockup as if it were the app, and see the clicks that did nothing and the
screens nobody can reach.
- **An app you already have.** The `from_app` prompt reads your UI code and rebuilds its screens as a project.
- **Plain text underneath.** A project exports to one `.gockup` file you can review and version; screens
export to PNG.
Expand Down
92 changes: 84 additions & 8 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,11 @@ func layoutTip(c *Ctx, th *material.Theme) layout.Dimensions {
},
)
call := m.Stop()
// above the child, centered, drawn after everything else so nothing covers it
// centered on the child, drawn after everything else so nothing covers it
at := image.Pt((dims.Size.X-tip.Size.X)/2, -tip.Size.Y-gtx.Dp(8))
if c.String("side") == "below" {
at.Y = dims.Size.Y + gtx.Dp(8)
}
m = op.Record(gtx.Ops)
st := op.Offset(at).Push(gtx.Ops)
call.Add(gtx.Ops)
Expand Down Expand Up @@ -272,6 +275,15 @@ type studio struct {
picked []string
// presenting is the screen shown alone, live, for its flow to be tried
presenting string
// trial is the journey being tried; pathHidden, whether its path is out
// of the way, kept from one to the next.
trial trial
pathHidden bool
// journeysOpen is whether the sidebar lists the journeys, whose ways are by
// name, and lit the one shown on the board, "" for none.
journeysOpen bool
ways map[string]way
lit string
// explorer opens the system's file dialogs; nil off a window
explorer *explorer.Explorer
searchQuery string
Expand Down Expand Up @@ -450,6 +462,11 @@ func (a *studio) registry(th *material.Theme) *Registry {
Props: []Prop{{Name: "color", Type: Color, Default: textColor}},
Layout: a.layoutVeil,
})
ui.Register("Tried", Component{
Doc: "the journey's screen, live",
Props: []Prop{{Name: "left", Type: Number, Doc: "what the path takes of the window, dp"}},
Layout: a.layoutTried,
})
ui.Register("Presented", Component{
Doc: "the screen being presented, live, in the middle of the window; the arrow keys go through the page",
Layout: func(c *Ctx) layout.Dimensions { return a.layoutPresented(c.Gtx) },
Expand All @@ -474,9 +491,10 @@ func (a *studio) registry(th *material.Theme) *Registry {
},
})
ui.Register("Tip", Component{
Doc: "shows text and a shortcut in a tooltip above its child while the pointer is over it",
Doc: "shows text and a shortcut in a tooltip beside its child while the pointer is over it",
Children: true,
Props: []Prop{{Name: "text", Type: String}, {Name: "key", Type: String}},
Props: []Prop{{Name: "text", Type: String}, {Name: "key", Type: String},
{Name: "side", Type: Enum, Enum: []string{"above", "below"}, Doc: "below for a child at the window's top, where there is no room above"}},
Layout: func(c *Ctx) layout.Dimensions {
return layoutTip(c, th)
},
Expand Down Expand Up @@ -753,7 +771,7 @@ func (a *studio) act(action string) {
var err error
switch verb {
case "home":
a.project, a.presenting = "", ""
a.project, a.presenting, a.trial, a.lit, a.journeysOpen = "", "", trial{}, "", false
case "toast-undo":
err = a.undoToast()
case "toast-go":
Expand All @@ -770,7 +788,7 @@ func (a *studio) act(action string) {
a.leavePage()
case "open":
a.paged = false
a.project, a.selKind, a.selName, a.presenting = arg, "", "", ""
a.project, a.selKind, a.selName, a.presenting, a.trial, a.lit, a.journeysOpen = arg, "", "", "", trial{}, "", false
a.opened = time.Now()
a.board, a.snaps = board{fit: true}, nil
case "tab":
Expand Down Expand Up @@ -957,6 +975,26 @@ func (a *studio) act(action string) {
a.exportProjectTo(arg)
case "import":
a.importPicked()
case "journeys":
a.journeysOpen = !a.journeysOpen
case "journeys-on":
a.journeysOn(arg)
case "light":
a.lightJourney(arg)
case "journey-new":
err = a.newJourney()
case "journey-rename":
a.renaming = arg
case "try":
a.try(arg)
case "try-back":
a.trialBack()
case "try-restart":
a.restartTrial()
case "try-path":
a.pathHidden = !a.pathHidden
case "try-exit":
a.trialExit()
case "present":
if a.selKind == dsl.ScreenDecl {
a.present(a.selName)
Expand Down Expand Up @@ -1128,6 +1166,8 @@ func (a *studio) renameItem(kind dsl.DeclKind, old, name string) error {
next, err = dsl.RenameScreen(a.decls, old, name)
case dsl.FragmentDecl:
next, err = dsl.RenameFragment(a.decls, old, name)
case dsl.JourneyDecl:
next, err = dsl.RenameJourney(a.decls, old, name)
case assetKind:
next, err = dsl.RenameAsset(a.decls, old, name)
assets = maps.Clone(a.assets)
Expand All @@ -1148,6 +1188,9 @@ func (a *studio) renameItem(kind dsl.DeclKind, old, name string) error {
if a.selKind == kind && a.selName == old {
a.selName = name
}
if kind == dsl.JourneyDecl && a.lit == old {
a.lit = name
}
return nil
}

Expand Down Expand Up @@ -1322,6 +1365,8 @@ func (a *studio) regen() {
switch {
case a.settings:
src = a.settingsScreen()
case a.trial.on():
src = a.trialScreen()
case a.presenting != "":
src = a.presentScreen()
case a.project != "":
Expand Down Expand Up @@ -1422,7 +1467,7 @@ func (a *studio) useDesignSystem() error {
func (a *studio) loadProject() {
decls, err := a.db.Decls(a.project)
if errors.Is(err, store.ErrNotFound) {
a.project = ""
a.project, a.trial = "", trial{}
return
}
a.decls, a.loadErr = decls, err
Expand All @@ -1449,6 +1494,11 @@ func (a *studio) loadProject() {
}
snaps := a.snaps
snaps.SetAssets(assets)
a.board.measure = func(sc *dsl.Screen, px float32) []image.Rectangle {
sess := NewSession(reg)
sess.SetAssets(assets)
return sess.gotoAreas(sc, px)
}
a.board.render = func(sc *dsl.Screen, px, scale float32) (*image.RGBA, error) {
return snaps.renderLaidOutAt(sc, px, scale)
}
Expand All @@ -1475,7 +1525,7 @@ func (a *studio) loadProject() {
break
}
}
if first.Kind != dsl.NoteDecl {
if first.Kind != dsl.NoteDecl && first.Kind != dsl.JourneyDecl {
a.selKind, a.selName = first.Kind, first.Name
}
}
Expand All @@ -1494,6 +1544,8 @@ func (a *studio) loadProject() {
a.enterPage(decls[i].Group)
}
a.canvas = a.canvasScreen()
a.loadJourneys()
a.keepTrying()
}

// canvasScreen is the selected screen, or the selected component laid out
Expand Down Expand Up @@ -1574,7 +1626,7 @@ func (a *studio) projectScreen() string {
if a.overview() {
a.overviewCards(&b, time.Now())
}
fmt.Fprintf(&b, "ProjectSidebar width=%d {\nBackLink\n", a.sideWidth)
fmt.Fprintf(&b, "ProjectSidebar width=%d {\nSidebarTree weight=1 {\nBackLink\n", a.sideWidth)
if ref := "project:" + a.project; a.renaming == ref {
fmt.Fprintf(&b, "Inset top=6 { RenameTitle name=%q key=%q submit=%q }\n", a.project, ref, "rename-to:"+ref+groupSep)
} else {
Expand All @@ -1583,6 +1635,10 @@ func (a *studio) projectScreen() string {
b.WriteString("SearchField\n")
a.sidebarTree(&b, broken)
b.WriteString("}\n")
if a.journeysOpen {
a.journeysSection(&b)
}
b.WriteString("}\n")
fmt.Fprintf(&b, "Inset left=%d top=10 { Flex axis=vertical spacing=8 {\nPill { Inset top=6 bottom=6 { Flex axis=horizontal align=center spacing=8 {\n", a.sidebarSpan())
fmt.Fprintf(&b, "Crumb text=\"Projects\" open=\"home\"\nCrumb text=\"/\" color=%q\nCrumb text=%q open=\"page-all\"\n", mutedColor, a.project)
if a.paged {
Expand All @@ -1602,6 +1658,11 @@ func (a *studio) projectScreen() string {
a.notices(&b)
b.WriteString("} }\n}\n")
b.WriteString("Inset top=10 right=10 { Flex axis=vertical spacing=10 align=end {\nPill top=6 bottom=6 left=6 right=8 { Flex axis=horizontal align=center spacing=8 {\n")
if a.journeysOpen {
fmt.Fprintf(&b, "JourneysButton color=%q bg=%q\n", pickedText, pickedFill)
} else {
b.WriteString("JourneysButton\n")
}
if a.selKind == dsl.ScreenDecl {
b.WriteString("PresentButton\n")
}
Expand Down Expand Up @@ -1641,6 +1702,10 @@ func (a *studio) projectScreen() string {
fmt.Fprintf(&b, "ToolBar %s\nZoomBar zoom=%q\n} }\n", tools, fmt.Sprintf("%d%%", int(math.Round(float64(a.board.zoom*100)))))
}
b.WriteString("}\n")
if w, ok := a.ways[a.lit]; ok && a.selKind == dsl.ScreenDecl {
fmt.Fprintf(&b, "Inset left=%d bottom=10 { JourneyBar name=%q text=%q try=%q close=%q }\n",
a.sidebarSpan(), a.lit, plural(len(w.steps), "screen"), "try:"+a.lit, "light:"+a.lit)
}
if len(a.toast) > 0 {
first, more := a.toast[0], ""
if n := len(a.toast) - 1; n > 0 {
Expand Down Expand Up @@ -1988,6 +2053,7 @@ func (a *studio) layoutCanvas(gtx layout.Context) layout.Dimensions {
key.Filter{Name: "E", Required: key.ModShortcut | key.ModShift},
key.Filter{Name: "A", Required: key.ModShortcut},
key.Filter{Name: "P", Optional: key.ModShift},
key.Filter{Name: "J", Optional: key.ModShift},
)
if !ok {
break
Expand All @@ -2001,6 +2067,8 @@ func (a *studio) layoutCanvas(gtx layout.Context) layout.Dimensions {
}
case e.Name == "P":
a.act("present")
case e.Name == "J":
a.act("journeys")
case e.Name == "A":
if a.selKind == dsl.ScreenDecl {
a.pickAll()
Expand Down Expand Up @@ -2031,7 +2099,15 @@ func (a *studio) layoutCanvas(gtx layout.Context) layout.Dimensions {
}
a.board.picked[name] = true
}
a.board.lit, a.board.way = a.lit, nil
if w, ok := a.ways[a.lit]; ok {
a.board.way = &w
}
zoomed := a.board.layout(gtx, a.th, a.sess, screens, a.places, a.boardNotes(screens), a.selName)
if did := a.board.did; did != "" {
a.board.did = ""
a.act(did)
}
if a.boardPicks() {
zoomed = true
}
Expand Down
Loading
Loading