Spaces:
Running

Prompt-Builder / DESIGN.md
ArielJoe's picture
refactor: modularize codebase, standardize to English, and redesign UI
8f3b9c2
|
Raw History Blame Contribute Delete
5.43 kB
# Design System — Prompt Builder (Hallmark Ink)
> Locked design specification for `web/index.html` and all 9 standalone detector test consoles (`web/*-test.html`). Derived from Hallmark `Ink` (`depth: full`, `scope: app`, paper colourway).
## 1. Visual Direction & Philosophy
Prompt Builder is an editorial desk instrument for inspecting Indonesian AI prompts before submission.
The interface follows **Hallmark Ink**: crisp archival paper (`--color-paper`), sharp hueless ink (`--color-ink`), quiet hairline partitions (`--color-rule`, `--color-rule-2`), restrained teal accent (`--color-accent`), and functional category ink markers exclusively where prompt findings must be distinguished.
- **One layout per screen**: split workbench on desktop (`<= 1440px`, 12-column responsive balance: structured prompt sheet on the left, live audit sheet on the right), single clean column below `860px`.
- **Flat surface ladder**: primary editing on `--color-paper`, subtle inset wells (`--color-paper-2`) only for assembled final prompt output, empty states, and loader skeletons; avoid nested card-inside-card stacks.
- **Zero decorative noise**: no emojis as UI icons, no gradient washes, no uppercase tracked eyebrows above headings, no middle-dot separators inside copy/labels.
- **Explicit affordance**: every interactive trigger (`button`, clickable `.entity`, tab trigger, interactive `<label>`, `<select>`) uses `cursor: pointer` and inherits a `2px solid var(--color-focus)` `:focus-visible` outline.
## 2. Tokens (`web/assets/css/tokens.css`)
All color, spacing, type, radius, elevation, and z-index primitives reside exclusively inside `:root` of `web/assets/css/tokens.css`. Raw color literals (`#...`, `rgb(...)`, `oklch(...)`) outside `tokens.css` are disallowed.
| Role | Token | Intent |
| --- | --- | --- |
| Primary canvas | `--color-paper` | Main sheet & workbench paper (`oklch(99.5% 0.003 100)`) |
| Inset well | `--color-paper-2` | Final prompt preview, empty states, quiet hover |
| Elevated paper tint | `--color-paper-3` | Disabled controls & recessed tracks |
| Primary ink | `--color-ink` | Headings, active text, primary copy |
| Secondary ink | `--color-ink-2` | Supporting body text |
| Muted ink | `--color-muted` | Placeholders, field subtitles, counters |
| Structural hairline | `--color-rule` | Topbar divider, pane rule, input borders |
| Subtle hairline | `--color-rule-2` | Inter-row separators inside fields & findings |
| Interactive accent | `--color-accent` | Primary action button, active tab underline, caret, progress |
| Accent tint | `--color-accent-soft` | Selection highlight & subtle ready status tint |
| Semantic states | `--color-error*`, `--color-ok*`, `--color-warn*` | Error banners, passed states, cautionary findings |
| Detector categories | `--cat-<name>`, `--cat-<name>-soft`, `--cat-<name>-ink` | 13 unified category colors (`risky_content`, `profanity`, `missing`, `pii`, `ner`, `slang`, `weak`, `typo`, `syntax`, `quality`, `filler`, `special_char`, `field_fit`) |
## 3. Typography
- **Display & UI body**: `Epilogue` (`--font-display`, `--font-body`). Headings use `-0.04em` display tracking (`--tracking-display`) and sentence-case clarity.
- **Code, spans & assembled prompt output**: `IBM Plex Mono` (`--font-outlier`). Applied to copyable assembled prompts, character/index readouts, redacted output, and detector spans.
- **Numeric figures**: `.num` enforces `font-variant-numeric: tabular-nums`.
## 4. Radii & Controls
- **Containers, popovers, well boxes, test cards**: `var(--radius-card)` (`12px`).
- **Buttons, textareas, inputs, selects, error banners, tabs**: `var(--radius-control)` (`8px`).
- **Inline entity spans, legend badges, severity chips**: `var(--radius-badge)` (`8px`).
- **Live server status dot & category marker dot**: `var(--radius-pill)` (`999px`).
### Shared Button Hierarchy
- `.btn--primary`: `--color-accent` fill, `--color-accent-ink` label (main submit / inspect action).
- `.btn--secondary`: `--color-paper` fill, `1px solid var(--color-rule)` border, `--color-ink` label (copy, sample fill, secondary actions).
- `.btn--quiet`: transparent fill, `--color-muted` label, fills with `--color-paper-2` on hover (clear, skip/Lewati, dismiss).
## 5. Consistent Empty, Loading & Error States
- **Empty state (`.empty-state`)**: `--color-paper-2` background, `1px solid var(--color-rule-2)` border, `var(--radius-card)` radius, centered concise heading + 1-line Indonesian guidance. Never uses checkmark/cross emojis.
- **Error banner (`.error-banner`)**: `--color-error-soft` background, `1px solid var(--color-error)` border, `--color-error-ink` text, `role="alert"`. Replaces blocking `window.alert()` dialogs across every test page.
- **Audit popover (`.eval-popover`)**: Crisp `--color-paper` modal surface framed by `--shadow-popover` (`z-modal`), paired with an SVG scrim spotlight mask (`aria-hidden="true"`). Falls back to a docked bottom sheet below `600px`.
## 6. Page Scope
1. `web/index.html` — Modular ES application (`web/assets/js/app.js`, `config.js`, `dom.js`, `api.js`, `popover.js`, `evaluator-ui.js`).
2. `web/*-test.html` (9 standalone detector consoles: `pii`, `ner`, `word-quality`, `risky-content`, `profanity`, `filler`, `special-char`, `syntax`, `field-fit`) — Sharing the `Ink` topbar shell, `tokens.css` variables, compiled `assets/css/tailwind.css`, and `web/assets/js/test-page-common.js`.