FacetDocs

The loop

Most work is four steps, and each is one call.

  1. Build what you mean: facet --doc f.facet build @screen.json --preview s.png.
  2. Look at the preview and read every warning. Warnings name the layer and the fix.
  3. Read back what is there, in the language: facet --doc f.facet source Screen.
  4. Change it in place: edit the JSON, then build @screen.json --sync. Layers keep their ids, instances stay linked, and the change is one undo step.

A generator on a loop. When a script writes the JSON, facet --doc f.facet build --watch --run 'python3 make.py' runs it, syncs what it prints, and does both again each time a file changes: save the script and the design follows in the app, in well under a second. --files 'recipes/*.py,kit.json' names what to watch (* within a name, ** across folders); without it, the files under the current folder, leaving out designs, pictures, hidden folders and build output. A script that writes a file instead of printing names it: build --watch --run 'python3 make.py' @out.json. A run that fails, or a build that is refused, is printed and the watch goes on; Ctrl-C stops it. It works for any language that can print JSON. From another shell (or when the watch runs in the background), facet --doc f.facet build --watch --stop ends it.

$ facet source Hello
{"font":"Inter 15/22","column":["Evening practice",{"text":"Twelve days in a row","color":"#6F6879"}],"gap":4,"padding":20,"fill":"#FFFFFF","name":"Hello","width":260,"at":[0,0],"cornerRadius":14}

source prints the shortest form that builds the layer again. Containers come back as {"row": [...]}, plain texts as strings, kit colors and text styles by name. It costs about a ninth of the tokens tree --full does, so reading before a change is cheap.

When a layer looks wrong, tree NODE shows each layer's size and place, inspect NODE every property of one, and shot NODE -o x.png --scale 2 a close look.

Small changes

For one or two values, modify is shorter than a sync:

facet --doc f.facet modify Hello '{"fill": "@paper", "font": "Inter 16/24"}'
facet --doc f.facet modify Hello '{"$nodes": {"Evening practice": {"text": "Morning practice"}}}'

Undo

Each call is one undo step, whatever it changed: facet --doc f.facet undo.

Documentation for Facet 0.3.228-g032727de