.bf-studio-head, .bf-studio-save { display: flex; justify-content: flex-end; align-items: center; gap: var(--bf-space-3); } .bf-studio-head { justify-content: space-between; flex-wrap: wrap; } .bf-studio-head > *, .bf-studio-head .bf-row { min-width: 0; } /* The wrap stays local: these rows hold buttons, where wrapping is inert until the line is full, and a `.bf-row` elsewhere may hold controls, where it is not (portal.css, under the 640px breakpoint). */ .bf-studio-head .bf-row { flex-wrap: wrap; justify-content: flex-end; } .bf-studio { display: grid; grid-template-columns: 180px minmax(360px, 1fr) 260px; min-width: 0; min-height: 620px; border: 1px solid var(--app-border); background: var(--app-surface); } .bf-studio__palette, .bf-studio__properties, .bf-studio__canvas { min-width: 0; } /* The document's own row, above all three columns: Undo and Redo act on the whole document rather than on the selected block, so they sit where neither the palette nor the properties panel can be read as their scope. `1 / -1` holds in the stacked layout the 1200px query drops to as well. */ .bf-studio__bar { grid-column: 1 / -1; flex-wrap: wrap; padding: var(--bf-space-3); border-block-end: 1px solid var(--app-border); background: var(--app-surface-alt); } /* Import and Export at the bar's far end; an import's note on its own line. */ .bf-studio__file { margin-inline-start: auto; } .bf-studio__file .bf-input { width: auto; max-width: 16rem; } .bf-studio__file-note { flex-basis: 100%; margin: 0; font-size: var(--bf-text-sm); } .bf-studio__file-note:empty { display: none; } .bf-studio__palette, .bf-studio__properties { padding: var(--bf-space-4); background: var(--app-surface-alt); } .bf-studio__palette { border-inline-end: 1px solid var(--app-border); } .bf-studio__properties { border-inline-start: 1px solid var(--app-border); } .bf-studio__palette h3, .bf-studio__properties h3 { margin: 0 0 var(--bf-space-4); font: var(--bf-font-weight-semibold) var(--bf-text-sm)/var(--bf-leading-normal) var(--bf-font-body); text-transform: uppercase; letter-spacing: var(--bf-tracking-wide); } .bf-studio-tool { display: flex; flex-direction: column; width: 100%; min-height: 56px; margin-block-end: var(--bf-space-2); padding: var(--bf-space-3); border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text); text-align: start; cursor: pointer; } .bf-studio-tool:hover:not(:disabled), .bf-studio-tool:focus-visible { border-color: var(--app-link); } /* A palette tool at the widget cap. dashboard-editor.js disables these buttons there, and a disabled control has to look disabled: portal.css gives .bf-btn:disabled half opacity and a not-allowed cursor, and these are not .bf-btn, so at the cap the palette was dead and pixel-identical to a live one in both engines. The same two declarations, and the hover border above is withdrawn with them, because a border that still answers the pointer reads as a control that still works. */ .bf-studio-tool:disabled { opacity: 0.5; cursor: not-allowed; } .bf-studio-tool span { color: var(--app-text-muted); font-size: var(--bf-text-xs); } /* The canvas draws the same shape the live page does: a column of blocks, top to bottom, with rows where the document says so. No graph paper and no grid, because there is no longer anything to snap to. A block sits where it is written, which is the whole point of the model. `position: relative` is what the inserter is placed against. Absolute and never fixed: fixed is measured against the viewport, so it drifts off its block on any scroll and breaks under an iOS soft keyboard. The toolbar was placed the same way once and is not any more; it is in normal flow and sticky, and placeToolbar() clears the inline top and left it used to set. */ .bf-studio__canvas { /* There was a 112px lane here, kept clear so an absolutely positioned toolbar could sit over the first block. Nothing occupies it any more: the toolbar is in normal flow and sticky, placeToolbar() clears the inline top and left it used to set, and measured at 1440px the bar renders below the blocks rather than above them. The lane was the first thing a person saw on opening the editor, 112px of nothing between the palette row and the first block, and it reserved that space even with no block selected and the toolbar hidden. Removing it does not let the bar cover a block. It cannot reach the top of the canvas in flow, and while the canvas scrolls it pins at `top: var(--bf-space-2)` over whatever is passing under it, which the lane never affected either way. */ position: relative; display: flex; flex-direction: column; gap: var(--bf-space-2); align-items: stretch; padding: var(--bf-space-4); background-color: var(--app-bg); } /* A container on the canvas. Outlined so its extent is visible, which is what makes nesting legible: without it, a block inside a row and a block beside one look the same. */ .bf-studio-group { display: flex; flex-direction: column; gap: var(--bf-space-1); padding: var(--bf-space-2); border: 1px dashed var(--app-border); } .bf-studio-group__children { display: flex; flex-direction: column; gap: var(--bf-space-2); min-width: 0; } /* A row's children run across, and share the line in twelfths the same way the live page does, so what the canvas shows is what the page will draw. */ .bf-studio-group--row > .bf-studio-group__children { flex-direction: row; flex-wrap: wrap; align-items: stretch; } /* All twelve, not only the eight the panel's select offers. A document may hold any share validate() accepts, from the pane or from the converter, and a share with no rule here draws at its content width: the canvas would then show a row the live page lays out differently, which is the one thing this canvas exists not to do. */ .bf-studio-group--row > .bf-studio-group__children > * { min-width: 0; } .bf-studio-group--row > .bf-studio-group__children > .bf-w1 { flex: 1 1 calc(100% / 12 * 1 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w2 { flex: 2 1 calc(100% / 12 * 2 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w3 { flex: 3 1 calc(100% / 12 * 3 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w4 { flex: 4 1 calc(100% / 12 * 4 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w5 { flex: 5 1 calc(100% / 12 * 5 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w6 { flex: 6 1 calc(100% / 12 * 6 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w7 { flex: 7 1 calc(100% / 12 * 7 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w8 { flex: 8 1 calc(100% / 12 * 8 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w9 { flex: 9 1 calc(100% / 12 * 9 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w10 { flex: 10 1 calc(100% / 12 * 10 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w11 { flex: 11 1 calc(100% / 12 * 11 - var(--bf-space-2)); } .bf-studio-group--row > .bf-studio-group__children > .bf-w12 { flex: 12 1 100%; } /* The height floor a block asked for, in the same 64px units the live page uses, so a block given a minimum height looks on the canvas like what it will be on the page. Halved, because the canvas is an outline of the page rather than the page: a full 512px node would push everything after it off a laptop screen while it is being edited. */ .bf-studio-node.bf-minh2 { min-height: 64px; } .bf-studio-node.bf-minh3 { min-height: 96px; } .bf-studio-node.bf-minh4 { min-height: 128px; } .bf-studio-node.bf-minh5 { min-height: 160px; } .bf-studio-node.bf-minh6 { min-height: 192px; } .bf-studio-node.bf-minh7 { min-height: 224px; } .bf-studio-node.bf-minh8 { min-height: 256px; } /* A deliberate gap above a block, as the live page draws it. */ .bf-studio-node.bf-space-sm, .bf-studio-group.bf-space-sm { margin-block-start: var(--bf-space-2); } .bf-studio-node.bf-space-md, .bf-studio-group.bf-space-md { margin-block-start: var(--bf-space-5); } .bf-studio-node.bf-space-lg, .bf-studio-group.bf-space-lg { margin-block-start: var(--bf-space-6); } /* The container's own button, which is how the group itself is selected, moved and ungrouped. Quieter than a block, because it is structure. */ .bf-studio-node--group { background: none; border-style: dashed; color: var(--app-text-muted); } .bf-studio-group__empty { margin: 0; padding: var(--bf-space-3); color: var(--app-text-muted); font-size: var(--bf-text-sm); text-align: center; border: 1px dashed var(--app-border); } .bf-studio__empty { color: var(--app-text-muted); text-align: center; padding-block: var(--bf-space-16); } .bf-studio-node { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 44px; padding: var(--bf-space-3); border: 1px solid var(--app-border); background: var(--app-surface); color: var(--app-text); cursor: pointer; text-align: start; } /* A selected block is an object, so it carries a visible outline rather than a hover reveal, which is the pattern people never find out is there. Drawn outside the border so it survives a block bordered the same colour, and offset so it stays clear of the neighbour's gap. */ .bf-studio-node[aria-pressed="true"] { border-color: var(--app-link); box-shadow: inset 3px 0 0 var(--app-link); outline: 2px solid var(--app-link); outline-offset: 1px; } /* Edit mode: the properties panel has the focus and the canvas has stopped answering arrows, so the outline goes dashed. The block is still the one being worked on; the keyboard is no longer on it. */ .bf-studio[data-mode="edit"] .bf-studio-node[aria-pressed="true"] { outline-style: dashed; } .bf-studio-node__kind { color: var(--app-text-muted); font-size: var(--bf-text-xs); text-transform: uppercase; letter-spacing: var(--bf-tracking-wide); } .bf-studio-node__title { max-width: 100%; margin-block-start: var(--bf-space-2); font-weight: var(--bf-font-weight-semibold); overflow-wrap: anywhere; } /* The one toolbar, moved onto whichever block is selected: above it, and below only when there is no room above, because a toolbar that covers the block it acts on is worse than none. `max-content` so it is as wide as its buttons: the script clamps its left edge, and a toolbar stretched across the canvas would have nothing to clamp. */ /* The lane at the top of the canvas. Sticky so it stays reachable while the document scrolls, and in normal flow so it can never cover a block. */ .bf-block-toolbar { /* Sticky in the canvas's own lane, not floated over the selected block. The grid gave every block a 64px row, so a bar placed above one landed in the gap between rows; a flow canvas stacks blocks tightly and the same bar covered the block above it outright. Measured at 96px of toolbar over a 63px block, which hid it completely. In normal flow it cannot. */ position: sticky; top: var(--bf-space-2); z-index: 2; display: flex; align-items: center; gap: var(--bf-space-2); width: max-content; max-width: 100%; padding: var(--bf-space-2); border: 1px solid var(--app-link); background: var(--app-surface-alt); /* The controls wrap rather than scroll out of sight. `max-width` alone caps only the box: the buttons cannot shrink under their labels, so they overflowed a visible box and took the document to 515px of scrollWidth at 375. Wrapping is the stronger half of docs/design.md rule 6, because a wrapped row cannot widen anything at all, and it keeps every control drawn: with eight of them the row needs 741px against the 718px canvas a 1440px viewport leaves, so Remove sat past the right edge of a scrollport with nothing to say it was there. `overflow-x: auto` stays underneath as the backstop for the one case wrapping cannot answer, a single control wider than the container. The ring turns inward as `.bf-device__actions--form` and `.bf-tabs` turn theirs: a scrollport clips one drawn outside the control at its edge. */ flex-wrap: wrap; overflow-x: auto; } .bf-block-toolbar :focus-visible { outline-offset: -2px; } .bf-block-toolbar__label { min-width: 0; padding-inline-end: var(--bf-space-2); border-inline-end: 1px solid var(--app-border); color: var(--app-text-muted); font-size: var(--bf-text-xs); text-transform: uppercase; letter-spacing: var(--bf-tracking-wide); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* The inserter, opened from the toolbar and placed under it. The kinds stack rather than sit in a row: this list is meant to grow, and a row of three that becomes a row of twelve is a redesign. */ .bf-block-inserter { position: absolute; z-index: 3; width: 220px; max-width: 100%; padding: var(--bf-space-3); border: 1px solid var(--app-border); background: var(--app-surface-alt); } .bf-block-inserter p { margin: 0 0 var(--bf-space-2); color: var(--app-text-muted); font-size: var(--bf-text-xs); } /* `display: flex` outranks the `hidden` attribute's own `display: none`, the same reason `.bf-studio__properties [hidden]` is declared below. Without this the page opens with an empty toolbar floating over the grid. */ .bf-block-toolbar[hidden], .bf-block-inserter[hidden] { display: none; } .bf-studio__properties [hidden] { display: none; } .bf-studio__properties .bf-row { flex-wrap: wrap; } @media (max-width: 1200px) { .bf-studio { grid-template-columns: 1fr; } /* Read, not drawn, on the terms .bf-visually-hidden sets. Below this width the canvas is narrower than the six controls, so the toolbar grows the scrollbar its own overflow rule allows, and those 20px took it from 56px to 76px and over the middle of the block above. */ .bf-block-toolbar__label { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); } .bf-studio__palette, .bf-studio__properties { border: 0; border-block-end: 1px solid var(--app-border); } .bf-studio__canvas { min-height: 420px; } } @media (max-width: 640px) { .bf-studio-head { align-items: stretch; flex-direction: column; } .bf-studio-head .bf-row { justify-content: flex-start; } /* One column of blocks a few pixels apart, and a toolbar 76px tall once the scrollbar its overflow adds is counted. It cannot sit in that gap, so it sat on the next block: every hit test over that block returned the toolbar and a pointer could never select it again. The row gap gives it the same lane between blocks that the block-start padding gives it over the first, and the placement check in the browser suite measures both. The lane is wider here than at desktop widths because the toolbar wraps to two lines once its seven buttons no longer fit one. */ .bf-studio__canvas { --bf-toolbar-lane: 92px; row-gap: var(--bf-toolbar-lane); } } /* --- list view ------------------------------------------------------------ The document as a tree, under the palette. One full-width row per block at its own indent, which is what makes a block inside a narrow row inside a section reachable in one click: on the canvas that block is a small target in a box inside a box. */ .bf-list-view { margin-block-start: var(--bf-space-4); } .bf-list-view__tree, .bf-list-view__group { margin: 0; padding: 0; list-style: none; } /* The indent is the nesting, and it is the only thing that carries it: the rows are otherwise identical, so a depth drawn any other way would be a second claim about the same structure. */ .bf-list-view__group { padding-inline-start: var(--bf-space-4); border-inline-start: 1px solid var(--app-border); margin-inline-start: var(--bf-space-2); } .bf-list-view__item { display: flex; align-items: baseline; gap: var(--bf-space-2); padding: var(--bf-space-1) var(--bf-space-2); border-radius: var(--bf-radius-sm); cursor: pointer; /* A treeitem holds its own group list, so the row is the part of it that is not the children: wrapping the flex line is what keeps a nested list from being laid out beside the label it belongs under. */ flex-wrap: wrap; } .bf-list-view__item:hover { background: var(--app-row-hover); } /* The same marker the canvas gives the selected block, at the scale of a row: one selection, drawn the same way in both panels, because two different highlights read as two different selections. */ .bf-list-view__item[aria-selected="true"] { background: var(--app-row-hover); box-shadow: inset 3px 0 0 var(--app-link); } .bf-list-view__kind { flex: 0 0 auto; font-size: var(--bf-text-xs); text-transform: uppercase; letter-spacing: var(--bf-tracking-wide); color: var(--app-text-muted); } .bf-list-view__title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; } /* The nested list is a flex item of the row above it, and it has to take the whole line rather than sit beside the label. */ .bf-list-view__item > .bf-list-view__group { flex: 1 0 100%; } /* The row variation picker: six buttons in a 260px column, so they wrap rather than overflow. `.bf-row` only wraps below the narrow breakpoint, and this panel is narrow at every width. */ .bf-variations { flex-wrap: wrap; gap: var(--bf-space-2); } /* --- the source picker ---------------------------------------------------- Inside the Source field rather than over the page. A modal would cover the block whose reading is being chosen, and the sample value beside each key is only useful next to the block it is going into. */ .bf-source-picker { margin-block-start: var(--bf-space-2); padding: var(--bf-space-2); border: 1px solid var(--app-border); background: var(--app-surface); } .bf-source-picker__list { max-height: 320px; overflow-y: auto; margin-block-start: var(--bf-space-2); } .bf-source-picker__group { margin: var(--bf-space-2) 0 var(--bf-space-1); font-size: var(--bf-text-xs); text-transform: uppercase; letter-spacing: var(--bf-tracking-wide); color: var(--app-text-muted); } .bf-source-picker__item { display: flex; flex-direction: column; width: 100%; padding: var(--bf-space-2); border: 0; background: none; color: var(--app-text); text-align: start; cursor: pointer; } .bf-source-picker__item:hover, .bf-source-picker__item:focus-visible { background: var(--app-row-hover); } /* The key is shown as well as the label, because the label is derived from the key and the key is what gets stored. */ .bf-source-picker__key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--bf-text-xs); color: var(--app-text-muted); overflow-wrap: anywhere; } /* What the reading says right now, which is what lets an operator recognise their own sensor in a list of names a Warden chose. The body colour rather than the link colour: this is information, not an affordance, and cyan-600 on the light surface measures 4.32:1 at this size, under the 4.5:1 AA floor for small text. */ .bf-source-picker__sample { font-size: var(--bf-text-xs); color: var(--app-text); font-weight: var(--bf-font-weight-semibold); } /* The drop indicator, drawn on the row the block would land beside or in. A line rather than a gap: a gap opened by moving rows is a layout change per pointer tick over a tree that can hold sixty of them. */ .bf-list-view__item--before { box-shadow: inset 0 2px 0 var(--app-link); } .bf-list-view__item--after { box-shadow: inset 0 -2px 0 var(--app-link); } /* Inside a container is an outline rather than an edge, because the block is going into the branch rather than beside it. */ .bf-list-view__item--inside { outline: 2px dashed var(--app-link); outline-offset: -2px; } .bf-list-view__item--dragging { opacity: 0.5; } /* The pattern list, under the palette it extends. The same tool buttons the palette uses, so a pattern and a block read as the same kind of offer. */ .bf-studio__patterns { margin-block-start: var(--bf-space-4); padding-block-start: var(--bf-space-4); border-block-start: 1px solid var(--app-border); } /* --- Picking a block up ---------------------------------------------------- The old HTML5 drag drew a line at the drop edge and nothing else, so the only feedback was a 2px rule. These three classes are the replacement, and between them they are the whole of what a person sees: the block leaves the page, a copy of it follows the cursor, and a slot the same size holds its place among blocks that shuffle around it in ordinary flow. */ /* The copy under the cursor. Fixed, because it is following a pointer whose coordinates are the viewport's; its left and top are written by dashboard-drag.js, which is the one thing here that cannot be a rule. Slightly enlarged and lifted off the page, which is the whole of "picked up": a copy at exactly the block's size reads as the page redrawing rather than as something in hand. */ .bf-lift { position: fixed; z-index: 40; margin: 0; /* It must never be the element under the cursor: the drop position is found with elementsFromPoint, and a clone that answered would be the only thing ever found. */ pointer-events: none; transform: scale(1.04); transform-origin: top left; box-shadow: var(--bf-shadow-flare-hover); opacity: 0.95; } /* Where it would land. Sized to the block being carried, so the gap the other blocks open is the gap it will actually occupy and nothing jumps on drop. */ .bf-drop-slot { border: 2px dashed var(--app-link); background: var(--app-row-hover); } /* The block itself while a copy of it is in hand. Out of flow rather than merely faded: the slot is standing in for it, and leaving both would say the block is in two places. */ .bf-studio-node--lifted { display: none; } /* A press that has become a drag. The cursor keeps saying so wherever it goes, and selection is suppressed because dragging across a canvas of buttons otherwise paints half the page blue. */ body.bf-dragging { cursor: grabbing; user-select: none; } /* The pointer gesture is this file's, so the browser must not also treat a drag on a block as a scroll or a text selection. */ .bf-studio-node { touch-action: none; } /* --- The raw JSON pane, coloured ----------------------------------------- Two layers in one box: a
holding the same text as spans, and the
textarea that posts it with transparent glyphs and a visible caret. Every
metric below is shared by both, because any difference between them is
colour sliding off the letters it belongs to. The frame is on the wrapper
so the textarea can be transparent without losing the field's border. */
.bf-code-edit {
position: relative;
background: var(--app-input-bg);
border: 1px solid var(--app-border);
}
.bf-code-edit > .bf-code-edit__ink,
.bf-code-edit > .bf-code-edit__area {
margin: 0;
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: var(--bf-text-base);
line-height: 20px;
padding: var(--bf-space-3) var(--bf-space-4);
border: 0;
white-space: pre-wrap;
overflow-wrap: anywhere;
tab-size: 2;
}
.bf-code-edit > .bf-code-edit__ink {
position: absolute;
inset: 0;
overflow: hidden;
pointer-events: none;
/* Punctuation: the braces, brackets and commas that carry no value. Left as
the base colour so the structure recedes and the content reads. */
color: var(--app-text-muted);
}
.bf-code-edit > .bf-code-edit__area {
position: relative;
background: transparent;
/* The glyphs are drawn by the layer underneath. The caret is not, so it is
named separately or the pane has no visible insertion point. */
color: transparent;
caret-color: var(--app-text);
}
/* Selection has to stay visible with transparent text: without this a drag
across the pane highlights nothing a person can see. */
.bf-code-edit > .bf-code-edit__area::selection {
background: var(--app-link);
color: var(--app-bg);
}
/* The focus ring belongs to the box a person sees, not to the transparent
layer that receives the focus. */
.bf-code-edit:focus-within {
border-color: var(--bf-border-accent);
box-shadow: var(--bf-shadow-flare-hover);
}
/* Too large to colour. dashboard-json.js stops building spans past its own
bound and says so here, which puts the text back in the textarea's own
colour rather than leaving an invisible pane. */
.bf-code-edit--plain > .bf-code-edit__ink {
display: none;
}
.bf-code-edit--plain > .bf-code-edit__area {
color: var(--app-text);
}
/* Four kinds of token, and only one of them takes a hue. The portal's palette
is cyan, one orange and neutrals: cyan carries the keys and passes AA on
both themes, while orange on white is about 3.3:1 and fails it for text. So
the rest are told apart by weight and slant instead of by colour, which also
means the pane does not depend on colour vision to be read. A wider syntax
palette would need new brand colours, which is a design decision and not
this pane's to make. */
.bf-json__key {
color: var(--app-link);
}
.bf-json__str {
color: var(--app-text);
}
/* The numbers are what an operator reads this pane for, so they are the one
thing given emphasis rather than taken away from. */
.bf-json__num {
color: var(--app-text);
font-weight: 600;
}
.bf-json__bool,
.bf-json__null {
font-style: italic;
}
/* Both of these say "there is nothing here", which stops being true the moment
a block is on its way in. They also take up room: the canvas notice is
centred with generous padding, so leaving it in place pushed the drop slot
for the first block near the bottom of the canvas, a long way from where the
block would actually land. */
body.bf-dragging .bf-studio__empty,
body.bf-dragging .bf-studio-group__empty {
display: none;
}