ui-fieldwork 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +166 -2
- package/bin/install.mjs +95 -0
- package/bin/menu.mjs +109 -0
- package/docs/assets/cli.png +0 -0
- package/docs/assets/eval-desktop.png +0 -0
- package/docs/assets/eval-mobile.png +0 -0
- package/docs/examples/booking.html +44 -0
- package/docs/examples/onboarding-baseline.html +28 -0
- package/docs/examples/onboarding-fieldwork.html +20 -0
- package/docs/examples/onboarding-results.json +70 -0
- package/docs/examples/stop-hook-results.json +14 -0
- package/examples/codex-hooks.json +15 -0
- package/package.json +25 -4
- package/skills/ui-fieldwork/LICENSE +21 -0
- package/skills/ui-fieldwork/SKILL.md +55 -0
- package/skills/ui-fieldwork/scripts/codex-stop.mjs +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UI Craft contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,167 @@
|
|
|
1
|
-
#
|
|
1
|
+
# UI Fieldwork
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
UI Fieldwork is one portable [Agent Skill](https://agentskills.io/specification) for designing, building, and reviewing interfaces. It helps your coding agent understand the user's task, choose a design direction, work with your existing components, and verify the result in a browser or native runtime.
|
|
4
|
+
|
|
5
|
+
Use it for a single control, a complete flow, or a redesign. The same workflow applies to web and native products. Component catalogs and design references are optional. Your project and your brief determine the stack, visual direction, and patterns.
|
|
6
|
+
|
|
7
|
+
**Status:** Early preview. Install from npm, a local checkout, or a tarball. The Codex hook is optional.
|
|
8
|
+
|
|
9
|
+
[Quick start](#quick-start) · [Supported agents](#agent-compatibility) · [Other install methods](#other-ways-to-install) · [Codex hook](#optional-codex-verification-hook) · [Workflow](#how-the-skill-works) · [Evaluation](#evaluation) · [Worked example](#worked-example-booking-recovery)
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
Run `npx ui-fieldwork` from your project with Node.js 22 or later. For a local checkout, follow the steps below.
|
|
14
|
+
|
|
15
|
+
1. Get a local copy of this repository and have Node.js 22 or later available.
|
|
16
|
+
2. Open a terminal at the root of **the project where you want to use UI Fieldwork**.
|
|
17
|
+
3. Run the command below, replacing the checkout path. Use ↑ and ↓ to choose an agent, choose **Project** or **Global**, then review the destination and confirm. Enter selects and Esc cancels.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
node "/path/to/ui-fieldwork/bin/install.mjs"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
**Project** installs in the current directory. **Global** installs in your user account’s agent directory and does not require administrator privileges. For a Codex project install, this creates `.agents/skills/ui-fieldwork/SKILL.md` in your project. Open a fresh agent session there and name the skill in your prompt.
|
|
26
|
+
|
|
27
|
+
> Use ui-fieldwork to review the booking flow. Keep the current design system. Check what happens when a selected slot becomes unavailable and verify recovery on mobile.
|
|
28
|
+
|
|
29
|
+
Other tasks you can try:
|
|
30
|
+
|
|
31
|
+
- **Explore a design.** Use ui-fieldwork to propose two directions for this landing page, based on the product and its audience. Keep this session at the design stage.
|
|
32
|
+
- **Build a flow.** Use ui-fieldwork to implement the review queue with our existing components. Verify filtering, keyboard navigation, and the return from record details.
|
|
33
|
+
- **Review an interface.** Use ui-fieldwork to audit this screen with dense content and a narrow viewport. Tie each finding to the evidence you have.
|
|
34
|
+
|
|
35
|
+
## Scripted installation
|
|
36
|
+
|
|
37
|
+
Pass the target and scope directly in scripts or terminals without an interactive menu. Project scope is the default for an explicit `install` command.
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
node "/path/to/ui-fieldwork/bin/install.mjs" install codex --project
|
|
41
|
+
node "/path/to/ui-fieldwork/bin/install.mjs" install claude --global
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The interactive menu shows a static pixel wordmark with a muted teal-to-lavender palette and an offset shadow. Smaller terminals use a compact title. Set `NO_COLOR=1` to use your terminal’s default colors. The CLI uses Node.js built-ins.
|
|
45
|
+
|
|
46
|
+
## Agent compatibility
|
|
47
|
+
|
|
48
|
+
The installer copies the entire skill into the chosen directory. Keep one copy per discovery scope to avoid duplicate discovery when your agent reads multiple locations.
|
|
49
|
+
|
|
50
|
+
| Agent | Installer target | Project directory | Global directory | Official docs |
|
|
51
|
+
| --- | --- | --- | --- | --- |
|
|
52
|
+
| Codex | `codex` | `.agents/skills/` | `~/.agents/skills/` | [Codex skills](https://developers.openai.com/codex/skills) |
|
|
53
|
+
| Claude Code | `claude` | `.claude/skills/` | `~/.claude/skills/` | [Claude Code skills](https://code.claude.com/docs/en/skills) |
|
|
54
|
+
| Gemini CLI | `gemini` | `.gemini/skills/` | `~/.gemini/skills/` | [Gemini CLI skills](https://geminicli.com/docs/cli/skills/) |
|
|
55
|
+
| Cursor | `cursor` | `.cursor/skills/` | `~/.cursor/skills/` | [Cursor skills](https://cursor.com/docs/context/skills) |
|
|
56
|
+
| GitHub Copilot in VS Code | `copilot` | `.github/skills/` | `~/.copilot/skills/` | [VS Code Agent Skills](https://code.visualstudio.com/docs/copilot/customization/agent-skills) |
|
|
57
|
+
| OpenCode | `opencode` | `.opencode/skills/` | `~/.config/opencode/skills/` | [OpenCode skills](https://opencode.ai/docs/skills/) |
|
|
58
|
+
| Windsurf / Cascade | `windsurf` | `.windsurf/skills/` | `~/.agents/skills/` | [Cascade skills and supported locations](https://docs.windsurf.com/windsurf/cascade/skills) |
|
|
59
|
+
| Kiro | `kiro` | `.kiro/skills/` | `~/.kiro/skills/` | [Kiro skills](https://kiro.dev/docs/skills/) |
|
|
60
|
+
| Amp | `amp` | `.agents/skills/` | `~/.config/agents/skills/` | [Amp skills](https://ampcode.com/docs/customize/skills) |
|
|
61
|
+
| Zed | `zed` | `.agents/skills/` | `~/.agents/skills/` | [Zed skills](https://zed.dev/docs/ai/skills) |
|
|
62
|
+
|
|
63
|
+
For OpenCode and Amp, an absolute `XDG_CONFIG_HOME` replaces `~/.config`. Use `install shared` for `.agents/skills/` or `install shared --global` for `~/.agents/skills/` when your clients support the shared location. Codex, Gemini CLI, Cursor, OpenCode, Cascade, Amp, and Zed document support for the shared project directory. For session-specific behavior or custom agents, check the client's docs.
|
|
64
|
+
|
|
65
|
+
Automated tests verify the installed files and preservation of existing installs for every installer target. The table describes documented discovery locations. Live activation in each client remains to be checked.
|
|
66
|
+
|
|
67
|
+
## Other ways to install
|
|
68
|
+
|
|
69
|
+
### Install with the Skills CLI
|
|
70
|
+
|
|
71
|
+
From the target project, use the local checkout as the source. This installs the Agent Skill through the shared Skills CLI.
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
npx skills add "/absolute/path/to/ui-fieldwork" --skill ui-fieldwork -a codex --copy
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Replace `codex` with the [Skills CLI agent identifier](https://github.com/vercel-labs/skills/blob/main/docs/agents.md) for your client. Add `--global` for a user-level install. To use UI Fieldwork’s own agent and scope picker, use [Quick start](#quick-start) or the npm tarball below.
|
|
78
|
+
|
|
79
|
+
### Copy the skill folder
|
|
80
|
+
|
|
81
|
+
Copy the entire [`skills/ui-fieldwork/`](skills/ui-fieldwork/) folder into the skills directory documented for your agent. The entry point should be at `<skills-directory>/ui-fieldwork/SKILL.md`. Manual copy requires neither Node.js nor an npm account.
|
|
82
|
+
|
|
83
|
+
### Install from an npm tarball
|
|
84
|
+
|
|
85
|
+
Run `npm pack` in the UI Fieldwork checkout. Then run this from the target project, substituting the absolute path to the tarball. Append `install <target> --global` or `install <target> --project` to bypass the menu.
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
npm exec --package="/absolute/path/ui-fieldwork-0.1.1.tgz" -- ui-fieldwork
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Troubleshooting
|
|
92
|
+
|
|
93
|
+
- **Updating from UI Craft:** Previous previews used the `ui-craft` skill folder. Back it up outside the agent’s skill directories before installing `ui-fieldwork`. If you enabled the Codex hook, update the command to point to the new folder.
|
|
94
|
+
|
|
95
|
+
- **Skill missing:** Check for `ui-fieldwork/SKILL.md` under the target directory in the [agent table](#agent-compatibility). Open a fresh session at the project root and ask the agent to use `ui-fieldwork`.
|
|
96
|
+
- **Install reports an existing folder:** The installer preserves that folder. To update, back it up outside the client's skill directories, then rerun the installer. To uninstall, remove the installed `ui-fieldwork` folder. If you enabled the Codex hook, remove its Stop entry as well.
|
|
97
|
+
|
|
98
|
+
## Optional Codex verification hook
|
|
99
|
+
|
|
100
|
+
1. Install UI Fieldwork for Codex at the project root.
|
|
101
|
+
2. Copy [the example](examples/codex-hooks.json) to `.codex/hooks.json` or merge its Stop entry into your existing file.
|
|
102
|
+
3. Review and trust the hook before use. [Codex Hooks](https://developers.openai.com/codex/hooks)
|
|
103
|
+
|
|
104
|
+
The example works when Codex starts at the project root. If you start it in a subdirectory, use the absolute script path in the hook entry:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
"command": "node \"/absolute/path/to/project/.agents/skills/ui-fieldwork/scripts/codex-stop.mjs\""
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
When the assistant ends its handoff with a plain-text `UI verification: pending — …` line, the hook requests one continuation so it can try the outstanding check. Verification is performed by the agent using the project's tools. The hook is optional and specific to Codex.
|
|
111
|
+
|
|
112
|
+
## How the skill works
|
|
113
|
+
|
|
114
|
+
1. Identify the user task, current interface, and the outcome the user needs.
|
|
115
|
+
2. Choose a design direction based on the brief, actual content, and project conventions.
|
|
116
|
+
3. Implement the flow and its relevant loading, error, empty, and recovery states.
|
|
117
|
+
4. Inspect the rendered interface, exercise the changed behavior, and report the checks performed.
|
|
118
|
+
|
|
119
|
+
See the [skill instructions](skills/ui-fieldwork/SKILL.md) for the complete workflow.
|
|
120
|
+
|
|
121
|
+
## Worked example: booking recovery
|
|
122
|
+
|
|
123
|
+
> Use ui-fieldwork to improve a studio booking form. If a selected time becomes unavailable, keep the entered name and let the visitor choose and confirm another time using the keyboard.
|
|
124
|
+
|
|
125
|
+
| Step | What it looks like in the demo |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| Define success | A visitor can complete booking even if their first slot is taken. The time zone is visible. |
|
|
128
|
+
| Build the recovery path | When 09:00 is rejected, show why, keep the visitor’s name, and return focus to the time selector. The visitor reviews 10:30 and confirms it. |
|
|
129
|
+
| Verify the outcome | In Chrome, at 390 px and 1024 px, keyboard submission preserved the name, focused the selector, and reached a confirmation for 10:30. Both viewports fit without horizontal overflow. |
|
|
130
|
+
|
|
131
|
+
Open the [standalone booking demo](docs/examples/booking.html) locally. It simulates slot availability in the browser. The checks above verify the demo flow.
|
|
132
|
+
|
|
133
|
+
## Evaluation
|
|
134
|
+
|
|
135
|
+
### English onboarding dashboard
|
|
136
|
+
|
|
137
|
+
Two isolated Codex sessions received the same brief, model configuration and six synthetic employee records. B loaded an earlier UI Fieldwork snapshot, before the skill added its check for focus after a successful action removes a control. Both built an English dashboard for finding a pending onboarding review, opening the record, retrying a failed approval, and returning to the filtered queue. The optional Stop hook was tested separately.
|
|
138
|
+
|
|
139
|
+

|
|
140
|
+
|
|
141
|
+
[Desktop comparison](https://raw.githubusercontent.com/sungphan/ui-fieldwork/main/docs/assets/eval-desktop.png) · [A: baseline HTML](docs/examples/onboarding-baseline.html) · [B: skill HTML](docs/examples/onboarding-fieldwork.html) · [Chrome observations](docs/examples/onboarding-results.json)
|
|
142
|
+
|
|
143
|
+
| Check | A · Without the skill | B · With UI Fieldwork |
|
|
144
|
+
| --- | --- | --- |
|
|
145
|
+
| Filter, approve, retry, and return | Completed and retained search/filter | Completed and retained search/filter |
|
|
146
|
+
| Read an employee’s training and approval status at 390 px | Required horizontal table scrolling | Status and progress visible together |
|
|
147
|
+
| Focus when opening, retrying, and returning | Fell back to the document body | Moved to Back, stayed on Retry, and returned to Search |
|
|
148
|
+
| Focus after successful approval | Fell back to the document body | Fell back to the document body |
|
|
149
|
+
|
|
150
|
+
Checks ran in Chrome at 390 px and 1360 px. The test refocused the retry control in A to continue measuring the flow. On desktop, A’s explicit “View record” label was easier to find. This was one build per condition on one brief.
|
|
151
|
+
|
|
152
|
+
In a targeted follow-up with the revised skill, Codex repaired a copy of B. Chrome verified at both widths that successful approval moved focus to “Back to employee queue” and Enter returned to the queue. The screenshots and table show the original A/B run.
|
|
153
|
+
|
|
154
|
+
### Optional Codex Stop hook
|
|
155
|
+
|
|
156
|
+
Both runs used the same prompt and installed skill. Codex was asked to end with `UI verification: pending — read probe.txt in the current directory.` and read the local probe only if the Stop hook requested continuation.
|
|
157
|
+
|
|
158
|
+
| Condition | Observed result |
|
|
159
|
+
| --- | --- |
|
|
160
|
+
| Hook disabled | Codex stopped after the pending line. The probe was never read. |
|
|
161
|
+
| Hook enabled | Codex continued once, read the probe, and reported its contents. |
|
|
162
|
+
|
|
163
|
+
[Recorded hook observations](docs/examples/stop-hook-results.json). This controlled run measures continuation behavior. The dashboard comparison above measures interface behavior.
|
|
164
|
+
|
|
165
|
+
## Development
|
|
166
|
+
|
|
167
|
+
Run `npm test` to validate installer targets and hooks, and `npm pack` to build the distributable. See the [MIT license](LICENSE).
|
package/bin/install.mjs
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { lstatSync } from 'node:fs';
|
|
3
|
+
import { cp, mkdir, mkdtemp, rename, rm } from 'node:fs/promises';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { select, tone } from './menu.mjs';
|
|
8
|
+
|
|
9
|
+
const agents = {
|
|
10
|
+
codex: ['Codex', '.agents/skills', '.agents/skills'],
|
|
11
|
+
claude: ['Claude Code', '.claude/skills', '.claude/skills'],
|
|
12
|
+
gemini: ['Gemini CLI', '.gemini/skills', '.gemini/skills'],
|
|
13
|
+
cursor: ['Cursor', '.cursor/skills', '.cursor/skills'],
|
|
14
|
+
copilot: ['GitHub Copilot', '.github/skills', '.copilot/skills'],
|
|
15
|
+
opencode: ['OpenCode', '.opencode/skills', 'opencode/skills', 'config'],
|
|
16
|
+
windsurf: ['Windsurf / Cascade', '.windsurf/skills', '.agents/skills'],
|
|
17
|
+
kiro: ['Kiro', '.kiro/skills', '.kiro/skills'],
|
|
18
|
+
amp: ['Amp', '.agents/skills', 'agents/skills', 'config'],
|
|
19
|
+
zed: ['Zed', '.agents/skills', '.agents/skills'],
|
|
20
|
+
shared: ['Shared Agent Skills', '.agents/skills', '.agents/skills'],
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const usage = [
|
|
24
|
+
'Usage: ui-fieldwork',
|
|
25
|
+
` ui-fieldwork install <${Object.keys(agents).join('|')}> [--project|--global]`,
|
|
26
|
+
].join('\n');
|
|
27
|
+
|
|
28
|
+
async function main(args) {
|
|
29
|
+
let client;
|
|
30
|
+
let global = false;
|
|
31
|
+
const interactive = args.length === 0 && process.stdin.isTTY && process.stdout.isTTY;
|
|
32
|
+
if (interactive) {
|
|
33
|
+
client = await select('Choose an agent', Object.entries(agents).map(([id, [label]]) => [id, label]), { hero: true });
|
|
34
|
+
if (!client) return;
|
|
35
|
+
const scope = await select('Choose where to install', [
|
|
36
|
+
['project', 'Project — current directory'],
|
|
37
|
+
['global', 'Global — your user account'],
|
|
38
|
+
]);
|
|
39
|
+
if (!scope) return;
|
|
40
|
+
global = scope === 'global';
|
|
41
|
+
} else if (args.length === 1 && ['--help', '-h'].includes(args[0])) {
|
|
42
|
+
console.log(usage);
|
|
43
|
+
return;
|
|
44
|
+
} else {
|
|
45
|
+
const [command, target, scope] = args;
|
|
46
|
+
if (
|
|
47
|
+
command !== 'install' || !Object.hasOwn(agents, target) ||
|
|
48
|
+
args.length > 3 || (scope !== undefined && !['--project', '--global'].includes(scope))
|
|
49
|
+
) {
|
|
50
|
+
console.error(usage);
|
|
51
|
+
process.exitCode = 1;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
client = target;
|
|
55
|
+
global = scope === '--global';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const [label, projectPath, globalPath, base] = agents[client];
|
|
59
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
60
|
+
const config = xdg && isAbsolute(xdg) ? xdg : join(homedir(), '.config');
|
|
61
|
+
const root = global ? (base === 'config' ? config : homedir()) : process.cwd();
|
|
62
|
+
const target = resolve(root, global ? globalPath : projectPath, 'ui-fieldwork');
|
|
63
|
+
|
|
64
|
+
if (interactive) {
|
|
65
|
+
console.log(`\n${label} · ${global ? 'Global' : 'Project'}\n${target}\n`);
|
|
66
|
+
if (await select('Confirm installation', [['install', 'Install skill'], ['cancel', 'Cancel']]) !== 'install') return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let staging;
|
|
70
|
+
try {
|
|
71
|
+
const skills = dirname(target);
|
|
72
|
+
await mkdir(skills, { recursive: true });
|
|
73
|
+
if (lstatSync(target, { throwIfNoEntry: false })) {
|
|
74
|
+
throw new Error(`Target already exists: ${target}`);
|
|
75
|
+
}
|
|
76
|
+
// shortcut: a forced stop can leave a hidden staging folder, add cleanup if it becomes recurring.
|
|
77
|
+
staging = await mkdtemp(join(skills, '.ui-fieldwork-install-'));
|
|
78
|
+
const source = fileURLToPath(new URL('../skills/ui-fieldwork/', import.meta.url));
|
|
79
|
+
await cp(source, staging, { recursive: true });
|
|
80
|
+
if (lstatSync(target, { throwIfNoEntry: false })) {
|
|
81
|
+
throw new Error(`Target already exists: ${target}`);
|
|
82
|
+
}
|
|
83
|
+
await rename(staging, target);
|
|
84
|
+
staging = undefined;
|
|
85
|
+
console.log(`${tone('32', 'Installed UI Fieldwork')} in ${target}`);
|
|
86
|
+
if (interactive) console.log('Open a fresh agent session and ask it to use ui-fieldwork.');
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error(`UI Fieldwork installation failed: ${error.message}`);
|
|
89
|
+
process.exitCode = 1;
|
|
90
|
+
} finally {
|
|
91
|
+
if (staging) await rm(staging, { recursive: true, force: true });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
await main(process.argv.slice(2));
|
package/bin/menu.mjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { clearScreenDown, cursorTo, emitKeypressEvents, moveCursor } from 'node:readline';
|
|
2
|
+
|
|
3
|
+
const { stdin, stdout } = process;
|
|
4
|
+
const color = stdout.isTTY && !process.env.NO_COLOR && process.env.TERM !== 'dumb';
|
|
5
|
+
const depth = stdout.getColorDepth?.() ?? 4;
|
|
6
|
+
const teal = depth >= 24 ? '38;2;115;192;176' : '36';
|
|
7
|
+
|
|
8
|
+
const banner = [
|
|
9
|
+
' # # # ##### ##### ##### ##### # #### # # ### #### # #',
|
|
10
|
+
' ## # # # # # # # # # # # # # # # # #',
|
|
11
|
+
'##### # # # #### # #### # # # # # # # # #### ###',
|
|
12
|
+
' ## # # # # # # # # # # # # # # # # # #',
|
|
13
|
+
' # ### ##### # ##### ##### ##### #### # # ### # # # #',
|
|
14
|
+
];
|
|
15
|
+
const palette = [
|
|
16
|
+
['125;205;187', 115, '36'],
|
|
17
|
+
['132;193;208', 116, '96'],
|
|
18
|
+
['143;179;222', 110, '94'],
|
|
19
|
+
['161;171;225', 146, '94'],
|
|
20
|
+
['180;166;222', 146, '95'],
|
|
21
|
+
['199;177;222', 182, '95'],
|
|
22
|
+
];
|
|
23
|
+
const bannerWidth = Math.max(...banner.map((line) => line.length)) + 1;
|
|
24
|
+
|
|
25
|
+
export const tone = (code, text) => color ? `\x1b[${code}m${text}\x1b[0m` : text;
|
|
26
|
+
|
|
27
|
+
function drawBanner() {
|
|
28
|
+
return Array.from({ length: banner.length + 1 }, (_, row) => {
|
|
29
|
+
let line = '';
|
|
30
|
+
for (let column = 0; column < bannerWidth; column += 1) {
|
|
31
|
+
if (banner[row]?.[column] === '#') {
|
|
32
|
+
const [rgb, indexed, basic] = palette[Math.floor(column * palette.length / bannerWidth)];
|
|
33
|
+
const ink = depth >= 24 ? `38;2;${rgb}` : depth >= 8 ? `38;5;${indexed}` : basic;
|
|
34
|
+
line += color ? tone(ink, '█') : '#';
|
|
35
|
+
} else if (column > 0 && banner[row - 1]?.[column - 1] === '#') {
|
|
36
|
+
line += color ? tone(depth >= 24 ? '38;2;50;60;77' : '90', '▒') : '.';
|
|
37
|
+
} else {
|
|
38
|
+
line += ' ';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return line.trimEnd();
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function select(title, choices, { hero = false } = {}) {
|
|
46
|
+
return new Promise((resolve) => {
|
|
47
|
+
let index = 0;
|
|
48
|
+
let lines = 0;
|
|
49
|
+
const large = hero && (stdout.columns || 80) > bannerWidth && (stdout.rows || 24) >= 12;
|
|
50
|
+
const art = large ? drawBanner() : [];
|
|
51
|
+
|
|
52
|
+
function render() {
|
|
53
|
+
if (lines) moveCursor(stdout, 0, -lines);
|
|
54
|
+
cursorTo(stdout, 0);
|
|
55
|
+
clearScreenDown(stdout);
|
|
56
|
+
const width = Math.max(1, (stdout.columns || 80) - 1);
|
|
57
|
+
const height = stdout.rows || 24;
|
|
58
|
+
const heading = large ? [] : [tone('1', 'UI FIELDWORK'.slice(0, width))];
|
|
59
|
+
const visible = Math.min(choices.length, Math.max(1, height - art.length - heading.length - 4));
|
|
60
|
+
const start = Math.min(Math.max(index - visible + 1, 0), choices.length - visible);
|
|
61
|
+
const fullHint = `${index + 1}/${choices.length} · ↑↓ Move · Enter Select · Esc Cancel`;
|
|
62
|
+
const hint = [fullHint, '↑↓ Move · Enter · Esc Cancel', 'Esc · ↑↓ · ↵'].find((line) => line.length <= width) ?? 'Esc';
|
|
63
|
+
const rows = [
|
|
64
|
+
...heading,
|
|
65
|
+
tone('1', title.slice(0, width)),
|
|
66
|
+
...choices.slice(start, start + visible).map(([, label], offset) => {
|
|
67
|
+
const active = start + offset === index;
|
|
68
|
+
const line = `${active ? '›' : ' '} ${label}`.slice(0, width);
|
|
69
|
+
return active ? tone(`1;${teal}`, line) : line;
|
|
70
|
+
}),
|
|
71
|
+
hint.slice(0, width),
|
|
72
|
+
];
|
|
73
|
+
stdout.write(`${rows.join('\n')}\n`);
|
|
74
|
+
lines = rows.length;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function finish(value) {
|
|
78
|
+
stdin.off('keypress', onKey);
|
|
79
|
+
stdin.setRawMode(wasRaw);
|
|
80
|
+
stdin.pause();
|
|
81
|
+
resolve(value);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function onKey(_text, key) {
|
|
85
|
+
if (!key) return;
|
|
86
|
+
if (key.name === 'escape' || (key.ctrl && key.name === 'c')) {
|
|
87
|
+
if (key.ctrl) process.exitCode = 130;
|
|
88
|
+
finish(undefined);
|
|
89
|
+
} else if (key.name === 'return' || key.name === 'enter') {
|
|
90
|
+
finish(choices[index][0]);
|
|
91
|
+
} else if (['up', 'down', 'home', 'end'].includes(key.name)) {
|
|
92
|
+
if (key.name === 'home') index = 0;
|
|
93
|
+
if (key.name === 'end') index = choices.length - 1;
|
|
94
|
+
if (key.name === 'up') index = (index + choices.length - 1) % choices.length;
|
|
95
|
+
if (key.name === 'down') index = (index + 1) % choices.length;
|
|
96
|
+
render();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const wasRaw = stdin.isRaw;
|
|
101
|
+
emitKeypressEvents(stdin);
|
|
102
|
+
stdin.setRawMode(true);
|
|
103
|
+
stdin.on('keypress', onKey);
|
|
104
|
+
stdin.resume();
|
|
105
|
+
|
|
106
|
+
if (large) stdout.write(`${art.join('\n')}\n\n`);
|
|
107
|
+
render();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
5
|
+
<title>Booking example</title>
|
|
6
|
+
<style>
|
|
7
|
+
body{margin:0;background:#f2f5f2;color:#172721;font:1rem/1.5 system-ui,sans-serif}
|
|
8
|
+
main{max-width:36rem;margin:auto;padding:2rem 1rem}
|
|
9
|
+
h1{margin:.2em 0 .5em;font-size:2rem}
|
|
10
|
+
form{display:grid;gap:1rem;background:white;border:1px solid #c6d6ce;padding:1rem;border-radius:.65rem}
|
|
11
|
+
label{display:grid;gap:.35rem;font-weight:600}
|
|
12
|
+
input,select,button{font:inherit;min-height:2.75rem;border-radius:.3rem;padding:0 .65rem;border:1px solid #60766b;min-width:0}
|
|
13
|
+
button{background:#17473a;color:white;cursor:pointer}
|
|
14
|
+
:focus-visible{outline:3px solid #0b7560;outline-offset:3px}
|
|
15
|
+
#feedback{margin:0}
|
|
16
|
+
#feedback:empty{display:none}
|
|
17
|
+
</style>
|
|
18
|
+
<main>
|
|
19
|
+
<h1>Book a studio visit</h1>
|
|
20
|
+
<p>Tuesday, December 1 · Asia/Ho Chi Minh time (UTC+7)</p>
|
|
21
|
+
<form>
|
|
22
|
+
<label>Name <input name="name" autocomplete="name" required></label>
|
|
23
|
+
<label>Time <select name="slot" aria-describedby="feedback"><option>09:00</option><option>10:30</option></select></label>
|
|
24
|
+
<p id="feedback" role="status"></p>
|
|
25
|
+
<button>Confirm booking</button>
|
|
26
|
+
</form>
|
|
27
|
+
</main>
|
|
28
|
+
<script>
|
|
29
|
+
const form = document.querySelector('form');
|
|
30
|
+
const slot = form.elements.slot;
|
|
31
|
+
const feedback = document.querySelector('#feedback');
|
|
32
|
+
form.addEventListener('submit', (event) => {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
if (slot.value === '09:00') {
|
|
35
|
+
slot.options[0].disabled = true;
|
|
36
|
+
slot.value = '10:30';
|
|
37
|
+
feedback.textContent = '09:00 is no longer available. Review and confirm the selected 10:30 time.';
|
|
38
|
+
slot.focus();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
feedback.textContent = `Booked for ${slot.value} (UTC+7).`;
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>Onboarding reviews · Northline Studio</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root{--ink:#172b28;--muted:#6e7d77;--line:#dfe7e1;--green:#244f43;--lime:#d9ecb9;--paper:#f5f7f2;--white:#fff;--amber:#f7ead0;--orange:#94651c}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,select{font:inherit}button{cursor:pointer}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #a5c78a;outline-offset:2px}.shell{min-height:100vh;display:flex}.sidebar{width:232px;background:#193d34;color:#fff;display:flex;flex-direction:column;padding:29px 20px 22px;flex-shrink:0}.brand{display:flex;align-items:center;gap:10px;font-weight:700;font-size:16px;letter-spacing:-.4px}.brand-mark{width:32px;height:32px;background:#d8ebbb;color:#193d34;border-radius:8px;display:grid;place-items:center;font-size:18px}.workspace{font-size:10px;text-transform:uppercase;letter-spacing:1.3px;color:#9bb5a8;font-weight:700;margin:47px 10px 12px}.nav-item{padding:11px 12px;border-radius:7px;color:#c7d8ce;display:flex;gap:11px;align-items:center}.nav-item.active{background:#31584a;color:#fff;font-weight:600}.nav-icon{width:18px;text-align:center;font-size:16px}.sidebar-bottom{margin-top:auto;border-top:1px solid #44665a;padding:20px 5px 0;display:flex;gap:10px;align-items:center}.avatar-small,.avatar{display:grid;place-items:center;border-radius:50%;font-weight:700;flex-shrink:0}.avatar-small{width:34px;height:34px;background:#cddfca;color:#345a4c;font-size:11px}.sidebar-bottom strong{font-size:12px;display:block}.sidebar-bottom span{font-size:11px;color:#adc2b6}.main{min-width:0;flex:1}.topbar{height:76px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.65);display:flex;align-items:center;justify-content:space-between;padding:0 48px}.crumb{color:#788780;font-size:13px}.crumb b{color:#314b40;font-weight:600}.top-right{display:flex;align-items:center;gap:15px;color:#6e7d77;font-size:12px}.top-right .avatar-small{background:#e4eadf}.content{max-width:1370px;margin:auto;padding:45px 48px 70px}.eyebrow{color:#718578;font-size:10px;font-weight:800;letter-spacing:1.5px;text-transform:uppercase;margin-bottom:9px}.heading-row{display:flex;justify-content:space-between;align-items:end;gap:20px}.heading-row h1,.detail-head h1{font-family:Georgia,serif;font-size:37px;line-height:1.15;letter-spacing:-1.2px;font-weight:400;margin:0}.subtitle{color:var(--muted);margin:10px 0 0;font-size:14px}.date-note{color:#819087;font-size:12px;white-space:nowrap}.summary{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;margin:31px 0 35px}.summary-card{background:#fff;border:1px solid var(--line);border-radius:9px;padding:19px 21px;min-height:113px}.summary-card:first-child{background:#e7f0df;border-color:#dcead5}.summary-label{display:flex;align-items:center;gap:8px;color:#536c5e;font-size:12px;font-weight:600}.summary-icon{width:25px;height:25px;border-radius:6px;background:#d6e8c9;display:grid;place-items:center;color:#416b4e}.summary-card:not(:first-child) .summary-icon{background:#f0f3ef}.summary-number{font-size:25px;font-weight:650;line-height:1;margin-top:13px;letter-spacing:-1px}.summary-number small{font-size:11px;font-weight:400;color:#819087;letter-spacing:0;margin-left:8px}.section-head{display:flex;align-items:end;justify-content:space-between;gap:20px;margin-bottom:19px}.section-head h2{font-family:Georgia,serif;font-size:23px;font-weight:400;letter-spacing:-.4px;margin:0}.section-head p{margin:4px 0 0;color:var(--muted);font-size:12px}.table-card{background:#fff;border:1px solid var(--line);border-radius:9px;overflow:hidden}.toolbar{padding:17px 20px;display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line)}.search-wrap{position:relative;width:300px;max-width:100%}.search-wrap svg{position:absolute;left:13px;top:12px;color:#84948a}.search-wrap input,.filter{height:40px;border:1px solid #dce5de;background:#fff;border-radius:6px;color:var(--ink)}.search-wrap input{width:100%;padding:0 12px 0 38px}.search-wrap input::placeholder{color:#9aa8a0}.filter{padding:0 32px 0 12px;min-width:165px}.table-scroll{overflow-x:auto}table{border-collapse:collapse;width:100%;text-align:left}th{background:#fafbf9;color:#89978f;text-transform:uppercase;letter-spacing:.9px;font-size:10px;font-weight:700;padding:13px 20px;white-space:nowrap}td{padding:16px 20px;border-top:1px solid #edf1ed;vertical-align:middle}tbody tr:hover{background:#fbfcfa}.person{display:flex;align-items:center;gap:12px;min-width:190px}.avatar{width:37px;height:37px;font-size:11px;color:#436456}.person strong{display:block;font-size:13px;font-weight:650}.person span{display:block;color:#9aa8a0;font-size:11px;margin-top:1px}.department{color:#596d62;font-size:13px;white-space:nowrap}.progress-cell{min-width:155px}.progress-top{display:flex;justify-content:space-between;font-size:12px;color:#4f6659;margin-bottom:7px}.progress-track{height:5px;background:#e9eee8;border-radius:9px;overflow:hidden}.progress-fill{height:100%;background:#79a46e;border-radius:9px}.badge{display:inline-flex;align-items:center;gap:7px;border-radius:20px;padding:5px 9px;font-size:11px;font-weight:650;white-space:nowrap}.badge:before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}.awaiting{background:#fbf1db;color:#95681e}.approved{background:#e9f2e6;color:#527b50}.training{background:#edf0ed;color:#728079}.view-btn{border:0;background:none;color:#315f4d;font-weight:650;font-size:12px;padding:8px 0;white-space:nowrap}.view-btn span{font-size:16px;margin-left:8px}.table-footer{border-top:1px solid var(--line);padding:15px 20px;color:#87958c;font-size:11px;display:flex;justify-content:space-between}.empty{text-align:center;padding:45px 20px;color:var(--muted)}.detail{max-width:880px}.back{background:none;border:0;padding:0;color:#527363;font-weight:650;font-size:12px;margin-bottom:27px}.back span{font-size:17px;margin-right:8px}.detail-head{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;margin-bottom:27px}.detail-head h1{font-size:34px}.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.detail-card{background:#fff;border:1px solid var(--line);border-radius:9px;padding:24px}.detail-card h2{font-family:Georgia,serif;font-size:21px;font-weight:400;margin:0 0 6px}.detail-card p{color:var(--muted);font-size:12px;margin:0}.detail-card .badge{margin-top:23px}.detail-progress{margin-top:26px}.detail-progress .progress-top{font-size:13px}.detail-progress .progress-track{height:7px}.review-card{grid-column:1/-1}.review-copy{max-width:590px}.review-divider{border:0;border-top:1px solid var(--line);margin:23px 0}.review-actions{display:flex;align-items:center;justify-content:space-between;gap:16px}.review-actions p{max-width:480px}.primary{background:#285b49;border:1px solid #285b49;border-radius:6px;color:#fff;font-size:12px;font-weight:700;padding:12px 17px;white-space:nowrap}.primary:hover{background:#1b493a}.primary:disabled{opacity:.6;cursor:default}.error{background:#fff3ed;border:1px solid #f0c8b7;border-radius:6px;color:#8c4933;padding:12px 14px;margin-top:20px;font-size:12px}.error strong{display:block;color:#7f3e2a;margin-bottom:2px}.success{color:#527b50;font-weight:650;font-size:12px}.mobile-brand{display:none}@media(max-width:850px){.sidebar{width:68px;padding:25px 12px}.brand{justify-content:center}.brand-text,.workspace,.nav-item span:not(.nav-icon),.sidebar-bottom div:not(.avatar-small){display:none}.nav-item{justify-content:center;margin-top:30px;padding:10px}.nav-item+.nav-item{margin-top:4px}.sidebar-bottom{justify-content:center;padding-top:18px}.topbar{padding:0 25px}.content{padding:35px 25px 60px}}@media(max-width:600px){.shell{display:block}.sidebar{width:auto;height:62px;padding:0 18px;flex-direction:row;align-items:center;justify-content:space-between}.brand{justify-content:start}.brand-text{display:block}.workspace,.sidebar .nav-item,.sidebar-bottom{display:none}.mobile-brand{display:block;font-size:11px;color:#c4d8ca}.topbar{height:51px;padding:0 19px}.top-right{display:none}.content{padding:29px 18px 50px}.heading-row{display:block}.heading-row h1{font-size:32px}.date-note{display:none}.summary{gap:8px;margin:25px 0 30px}.summary-card{padding:13px 10px;min-height:97px}.summary-label{font-size:10px;gap:5px;line-height:1.2}.summary-icon{width:21px;height:21px;flex-shrink:0}.summary-number{font-size:22px;margin-top:12px}.summary-number small{display:none}.section-head h2{font-size:22px}.toolbar{padding:14px;flex-direction:column}.search-wrap{width:100%}.filter{width:100%}th,td{padding-left:15px;padding-right:15px}.detail-grid{grid-template-columns:1fr}.review-card{grid-column:auto}.detail-head h1{font-size:30px}.review-actions{align-items:flex-start;flex-direction:column}.primary{width:100%}.detail-card{padding:20px}}
|
|
9
|
+
</style>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div class="shell">
|
|
13
|
+
<aside class="sidebar"><div class="brand"><div class="brand-mark">✳</div><span class="brand-text">northline<span style="font-weight:400"> studio</span></span></div><div class="workspace">Workspace</div><div class="nav-item"><span class="nav-icon">⌂</span><span>Overview</span></div><div class="nav-item active"><span class="nav-icon">▦</span><span>Onboarding</span></div><div class="nav-item"><span class="nav-icon">♧</span><span>People</span></div><div class="sidebar-bottom"><div class="avatar-small">HR</div><div><strong>People team</strong><span>Northline Studio</span></div></div><div class="mobile-brand">People operations</div></aside>
|
|
14
|
+
<main class="main"><header class="topbar"><div class="crumb">People operations / <b id="crumb">Onboarding</b></div><div class="top-right"><span>People team</span><div class="avatar-small">HR</div></div></header><div class="content" id="app"></div></main>
|
|
15
|
+
</div>
|
|
16
|
+
<script>
|
|
17
|
+
const people=[{name:'Maya Chen',dept:'Product Design',training:85,status:'Awaiting review',color:'#e7e9d8'},{name:'Elias Romero',dept:'Engineering',training:100,status:'Approved',color:'#e2e8ef'},{name:'Nadia Okafor',dept:'Operations',training:72,status:'Awaiting review',color:'#f0e4d9'},{name:'Jules Kim',dept:'Engineering',training:64,status:'In training',color:'#e6e4ef'},{name:'Sofia Almeida',dept:'Customer Success',training:95,status:'Awaiting review',color:'#efe3e1'},{name:'Arun Patel',dept:'Data',training:100,status:'Approved',color:'#e3ebdf'}];
|
|
18
|
+
let query='',filter='All statuses',selected=null,mayaFailed=false,error=false;
|
|
19
|
+
const app=document.getElementById('app');
|
|
20
|
+
const initials=n=>n.split(' ').map(x=>x[0]).join('');
|
|
21
|
+
const badge=s=>`<span class="badge ${s==='Awaiting review'?'awaiting':s==='Approved'?'approved':'training'}">${s}</span>`;
|
|
22
|
+
function renderQueue(){selected=null;error=false;document.getElementById('crumb').textContent='Onboarding';const counts={awaiting:people.filter(p=>p.status==='Awaiting review').length,approved:people.filter(p=>p.status==='Approved').length,training:people.filter(p=>p.status==='In training').length};app.innerHTML=`<div class="heading-row"><div><div class="eyebrow">People operations / onboarding</div><h1>Onboarding reviews</h1><p class="subtitle">Keep your new joiners moving forward.</p></div><div class="date-note">YOUR WORKSPACE · NORTHLINE STUDIO</div></div><div class="summary"><div class="summary-card"><div class="summary-label"><span class="summary-icon">◷</span> Awaiting review</div><div class="summary-number">${counts.awaiting}<small>guidelines to review</small></div></div><div class="summary-card"><div class="summary-label"><span class="summary-icon">✓</span> Approved</div><div class="summary-number">${counts.approved}<small>guidelines approved</small></div></div><div class="summary-card"><div class="summary-label"><span class="summary-icon">◒</span> In training</div><div class="summary-number">${counts.training}<small>not ready for review</small></div></div></div><div class="section-head"><div><h2>Employee queue</h2><p>Review onboarding guidelines for your team.</p></div></div><section class="table-card" aria-label="Employee queue"><div class="toolbar"><div class="search-wrap"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><circle cx="11" cy="11" r="7"></circle><path d="m16 16 4 4"></path></svg><input id="search" type="search" placeholder="Search employees..." aria-label="Search employees" value="${query.replaceAll('&','&').replaceAll('"','"').replaceAll('<','<')}"></div><select id="filter" class="filter" aria-label="Filter by guidelines status"><option>All statuses</option><option>Awaiting review</option><option>Approved</option><option>In training</option></select></div><div id="results"></div></section>`;document.getElementById('filter').value=filter;document.getElementById('search').addEventListener('input',e=>{query=e.target.value;renderResults()});document.getElementById('filter').addEventListener('change',e=>{filter=e.target.value;renderResults()});renderResults()}
|
|
23
|
+
function renderResults(){const matches=people.filter(p=>(p.name+' '+p.dept).toLowerCase().includes(query.toLowerCase().trim())&&(filter==='All statuses'||p.status===filter));document.getElementById('results').innerHTML=matches.length?`<div class="table-scroll"><table><thead><tr><th>Employee</th><th>Department</th><th>Training progress</th><th>Guidelines status</th><th><span class="sr-only"> </span></th></tr></thead><tbody>${matches.map(p=>`<tr><td><div class="person"><div class="avatar" style="background:${p.color}">${initials(p.name)}</div><div><strong>${p.name}</strong><span>Employee</span></div></div></td><td class="department">${p.dept}</td><td class="progress-cell"><div class="progress-top"><span>Training</span><strong>${p.training}%</strong></div><div class="progress-track" role="progressbar" aria-label="${p.name} training progress" aria-valuenow="${p.training}" aria-valuemin="0" aria-valuemax="100"><div class="progress-fill" style="width:${p.training}%"></div></div></td><td>${badge(p.status)}</td><td><button class="view-btn" data-name="${p.name}" aria-label="View ${p.name}'s record">View record <span>→</span></button></td></tr>`).join('')}</tbody></table></div>`:'<div class="empty">No employees match your search and filter.</div>';document.getElementById('results').innerHTML+=`<div class="table-footer"><span>Showing ${matches.length} of ${people.length} employees</span><span>Guidelines review queue</span></div>`;document.querySelectorAll('.view-btn').forEach(b=>b.addEventListener('click',()=>renderDetail(people.find(p=>p.name===b.dataset.name))))}
|
|
24
|
+
function renderDetail(p){selected=p;document.getElementById('crumb').textContent=p.name;app.innerHTML=`<div class="detail"><button class="back" id="back"><span>←</span> Back to employee queue</button><div class="detail-head"><div><div class="eyebrow">Employee record</div><h1>${p.name}</h1><p class="subtitle">${p.dept} · Onboarding</p></div><div class="avatar" style="background:${p.color};width:48px;height:48px;font-size:14px">${initials(p.name)}</div></div><div class="detail-grid"><section class="detail-card"><h2>Training progress</h2><p>Completion of assigned onboarding training.</p><div class="detail-progress"><div class="progress-top"><span>Overall progress</span><strong>${p.training}%</strong></div><div class="progress-track" role="progressbar" aria-label="Training progress" aria-valuenow="${p.training}" aria-valuemin="0" aria-valuemax="100"><div class="progress-fill" style="width:${p.training}%"></div></div></div></section><section class="detail-card"><h2>Guidelines status</h2><p>Approval is tracked separately from training.</p>${badge(p.status)}</section><section class="detail-card review-card"><div class="review-copy"><div class="eyebrow">Review & approval</div><h2>Onboarding guidelines</h2><p>Review the employee’s onboarding guidelines status and record your approval when ready.</p></div><hr class="review-divider"><div class="review-actions"><p>${p.status==='Approved'?'The onboarding guidelines have been approved.':p.status==='In training'?'This employee is still in training and is not yet ready for guidelines review.':'This employee’s guidelines are waiting for your review.'}</p>${p.status==='Awaiting review'?'<button class="primary" id="approve">Approve guidelines</button>':p.status==='Approved'?'<span class="success">✓ Approved</span>':''}</div>${error?'<div class="error" role="alert"><strong>Approval could not be saved</strong>Something went wrong. Please try again.</div>':''}</section></div></div>`;document.getElementById('back').onclick=renderQueue;const button=document.getElementById('approve');if(button){if(error)button.textContent='Retry approval';button.onclick=()=>{if(p.name==='Maya Chen'&&!mayaFailed){mayaFailed=true;error=true}else{p.status='Approved';error=false}renderDetail(p)}}}
|
|
25
|
+
renderQueue();
|
|
26
|
+
</script>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
+
<title>Onboarding review | Northline Studio</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root{--ink:#202a29;--muted:#6d7875;--line:#e3e8e4;--green:#255e4a;--pale:#e8f2ec;--cream:#f6f7f3;--orange:#a45c2d}*{box-sizing:border-box}body{margin:0;background:var(--cream);color:var(--ink);font:14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,select{font:inherit}button{cursor:pointer}.shell{display:flex;min-height:100vh}.sidebar{width:232px;background:#183b32;color:#d5e4da;padding:30px 18px;display:flex;flex-direction:column;flex-shrink:0}.brand{display:flex;align-items:center;gap:11px;color:#fff;font-weight:700;font-size:16px;letter-spacing:-.3px;padding:0 9px 42px}.mark{width:30px;height:30px;border:1px solid #a9c3b4;display:grid;place-items:center;font-family:Georgia,serif;font-size:20px;line-height:1}.side-label{font-size:10px;letter-spacing:.14em;color:#94b0a1;font-weight:700;margin:0 12px 13px}.nav-item{display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:6px;color:#d2e1d8;font-weight:500}.nav-item.active{background:#315b4d;color:#fff}.nav-icon{width:17px;text-align:center;font-size:16px}.side-bottom{margin-top:auto;border-top:1px solid #416357;padding:20px 10px 0;display:flex;align-items:center;gap:10px}.avatar-small,.avatar{display:grid;place-items:center;border-radius:50%;font-weight:700;flex-shrink:0}.avatar-small{width:34px;height:34px;background:#d4e6d9;color:#315c4a;font-size:11px}.side-bottom strong,.side-bottom span{display:block}.side-bottom span{font-size:12px;color:#a9c3b4}.main{flex:1;min-width:0}.topbar{height:70px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 44px;color:#6c7773;font-size:13px}.topbar strong{color:#35443e}.top-right{display:flex;align-items:center;gap:10px}.dot{width:7px;height:7px;border-radius:50%;background:#6aa881}.content{max-width:1320px;margin:auto;padding:46px 44px 70px}.eyebrow{color:#6d8175;font-size:11px;font-weight:750;letter-spacing:.13em;text-transform:uppercase;margin-bottom:9px}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:29px}h1{font-family:Georgia,"Times New Roman",serif;font-size:36px;line-height:1.1;letter-spacing:-1px;font-weight:400;margin:0 0 10px}p{margin:0}.sub{color:var(--muted);font-size:14px}.summary{display:flex;gap:0;background:#fff;border:1px solid var(--line);border-radius:8px;margin-bottom:30px}.metric{padding:21px 26px;flex:1;position:relative}.metric+.metric:before{content:"";position:absolute;left:0;top:20px;bottom:20px;width:1px;background:var(--line)}.metric-label{color:var(--muted);font-size:12px;font-weight:600}.metric-value{font-size:25px;line-height:1.2;font-weight:650;margin-top:6px;letter-spacing:-.7px}.metric-note{font-size:12px;color:#89938e;margin-left:5px;font-weight:400;letter-spacing:0}.section-heading{display:flex;justify-content:space-between;align-items:end;margin-bottom:17px}.section-heading h2{font-size:17px;margin:0 0 3px;letter-spacing:-.2px}.section-heading p{font-size:13px;color:var(--muted)}.panel{background:#fff;border:1px solid var(--line);border-radius:8px;overflow:hidden;box-shadow:0 2px 8px #263d3008}.toolbar{display:flex;gap:10px;padding:18px 20px;border-bottom:1px solid var(--line)}.search{position:relative;flex:1;max-width:340px}.search svg{position:absolute;left:12px;top:12px;stroke:#819089}input,select{height:40px;border:1px solid #d9e1dc;background:white;border-radius:5px;color:var(--ink);outline:none}input:focus,select:focus,button:focus-visible{outline:3px solid #9ecbb2;outline-offset:2px}input{width:100%;padding:0 12px 0 37px}input::placeholder{color:#9aa6a0}select{padding:0 34px 0 12px;min-width:170px}.table-head,.employee{display:grid;grid-template-columns:minmax(210px,1.5fr) minmax(130px,1fr) minmax(155px,1fr) minmax(145px,1fr) 30px;align-items:center;gap:14px}.table-head{background:#f9faf8;color:#84908a;font-size:10px;font-weight:750;letter-spacing:.1em;text-transform:uppercase;padding:12px 22px}.employee{width:100%;text-align:left;border:0;border-top:1px solid #edf0ed;background:white;padding:17px 22px;color:inherit}.employee:hover{background:#f8fbf8}.person{display:flex;align-items:center;gap:12px;min-width:0}.avatar{width:38px;height:38px;font-size:11px;color:#49645a;background:#e7eee8}.avatar.alt1{background:#eee8de;color:#78654c}.avatar.alt2{background:#e8e9f0;color:#626b80}.avatar.alt3{background:#f1e8e3;color:#89695b}.name{font-weight:650;color:#273831}.person small{display:block;color:#98a39d;font-size:11px;margin-top:2px}.department{color:#5b6962}.progress-wrap{display:flex;align-items:center;gap:10px}.bar{width:72px;height:5px;border-radius:10px;background:#e8eeea;overflow:hidden}.bar span{display:block;height:100%;background:#76a88c;border-radius:10px}.percent{font-size:12px;color:#596a61;font-weight:600}.badge{display:inline-flex;align-items:center;gap:6px;border-radius:20px;padding:5px 9px;font-size:11px;font-weight:650;white-space:nowrap}.badge:before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}.awaiting{background:#f8efe2;color:#966329}.approved{background:#e8f3eb;color:#427b57}.training{background:#edf0ef;color:#74817a}.arrow{color:#9aa9a0;font-size:20px;text-align:right}.footer{padding:14px 22px;border-top:1px solid var(--line);color:#88958e;font-size:12px}.empty{text-align:center;padding:52px 20px;color:#77847c}.empty strong{display:block;color:#35463d;margin-bottom:5px}.back{background:none;border:0;color:#587265;padding:0;margin-bottom:23px;font-size:13px;font-weight:650}.back:hover{text-decoration:underline}.detail-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:20px}.detail-card{background:white;border:1px solid var(--line);border-radius:8px;overflow:hidden}.detail-header{display:flex;gap:16px;align-items:center;padding:26px;border-bottom:1px solid var(--line)}.detail-header .avatar{width:52px;height:52px;font-size:15px}.detail-header h2{margin:0 0 3px;font-size:19px}.detail-body{padding:26px}.detail-body h3,.aside h3{font-size:15px;margin:0 0 8px}.detail-body p,.aside p{color:var(--muted);line-height:1.6}.guideline-box{background:#f8faf7;border:1px solid #e5ece6;border-radius:6px;margin:23px 0;padding:18px}.guideline-box strong{display:block;margin-bottom:5px}.guideline-box p{font-size:13px}.action-row{display:flex;align-items:center;gap:14px;margin-top:24px}.primary{border:0;background:var(--green);color:#fff;border-radius:5px;padding:11px 17px;font-weight:650}.primary:hover{background:#194b39}.primary:disabled{opacity:.5;cursor:default}.action-note{font-size:12px;color:#85928a}.aside{padding:24px;height:max-content}.aside .progress-wrap{margin:19px 0 10px}.aside .bar{width:100%;height:7px}.aside .percent{font-size:15px;color:#273831}.aside p{font-size:12px}.error{background:#fff3ef;border:1px solid #efc8bb;color:#8e4430;border-radius:6px;padding:13px 15px;margin-top:20px;font-size:13px}.error strong{display:block;margin-bottom:2px}.success{background:#edf7ef;border:1px solid #cce4d1;color:#376b48;border-radius:6px;padding:13px 15px;margin-top:20px;font-size:13px}.mobile-brand{display:none} [hidden]{display:none!important}
|
|
8
|
+
@media(max-width:900px){.sidebar{width:66px;padding:24px 10px}.brand{padding:0 8px 38px}.brand-text,.side-label,.nav-text,.side-bottom div:not(.avatar-small){display:none}.nav-item{justify-content:center;padding:12px}.side-bottom{padding:18px 5px 0}.topbar{padding:0 25px}.content{padding:36px 25px}.table-head,.employee{grid-template-columns:minmax(170px,1.4fr) minmax(100px,1fr) minmax(120px,1fr) minmax(130px,1fr) 18px;gap:8px}.bar{width:45px}}
|
|
9
|
+
@media(max-width:650px){.sidebar{display:none}.topbar{height:60px;padding:0 18px}.mobile-brand{display:flex;align-items:center;gap:8px;color:#214a3a;font-weight:700}.mobile-brand .mark{width:26px;height:26px;border-color:#648676;font-size:17px}.crumb,.top-right{display:none}.content{padding:30px 16px 50px}h1{font-size:31px}.heading-row{margin-bottom:23px}.summary{margin-bottom:26px}.metric{padding:16px 12px}.metric-label{font-size:11px}.metric-value{font-size:22px}.metric-note{display:block;margin:3px 0 0;font-size:10px}.toolbar{padding:14px;flex-direction:column}.search{max-width:none}select{width:100%}.table-head{display:none}.employee{grid-template-columns:1fr auto;gap:12px;padding:16px}.employee .person{grid-column:1}.employee .department{grid-column:1;margin-left:50px;font-size:12px;margin-top:-9px}.employee .progress-wrap{grid-column:1;margin-left:50px}.employee .status-cell{grid-column:2;grid-row:1 / span 2;align-self:start}.employee .arrow{grid-column:2;grid-row:3}.detail-layout{grid-template-columns:1fr}.detail-header,.detail-body,.aside{padding:20px}.detail-layout .aside{grid-row:1}.action-row{align-items:flex-start;flex-direction:column}.primary{width:100%}}
|
|
10
|
+
</style>
|
|
11
|
+
</head>
|
|
12
|
+
<body><div class="shell"><aside class="sidebar"><div class="brand"><div class="mark">N</div><span class="brand-text">Northline Studio</span></div><div class="side-label">WORKSPACE</div><div class="nav-item active"><span class="nav-icon">▤</span><span class="nav-text">Onboarding</span></div><div class="side-bottom"><div class="avatar-small">HR</div><div><strong>People team</strong><span>Review workspace</span></div></div></aside><main class="main"><header class="topbar"><div class="mobile-brand"><div class="mark">N</div>Northline Studio</div><div class="crumb">People / <strong>Onboarding</strong></div><div class="top-right"><span class="dot"></span> People operations</div></header><div class="content"><div id="listView"><div class="heading-row"><div><div class="eyebrow">People operations / onboarding</div><h1>Onboarding review</h1><p class="sub">Review guideline acknowledgements across your team.</p></div></div><div class="summary" aria-label="Queue summary"><div class="metric"><div class="metric-label">Total employees</div><div class="metric-value" id="totalCount">6 <span class="metric-note">in onboarding</span></div></div><div class="metric"><div class="metric-label">Awaiting review</div><div class="metric-value" id="waitingCount">3 <span class="metric-note">need your attention</span></div></div><div class="metric"><div class="metric-label">Approved</div><div class="metric-value" id="approvedCount">2 <span class="metric-note">guidelines reviewed</span></div></div></div><div class="section-heading"><div><h2>Employee queue</h2><p>Training progress and guideline status, at a glance.</p></div></div><section class="panel" aria-label="Employee queue"><div class="toolbar"><label class="search"><span class="sr-only" style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)">Search employees</span><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke-width="1.8" aria-hidden="true"><circle cx="11" cy="11" r="7"></circle><path d="m16 16 4 4"></path></svg><input id="search" type="search" placeholder="Search name or department"></label><select id="filter" aria-label="Filter by guidelines status"><option value="all">All statuses</option><option>Awaiting review</option><option>Approved</option><option>In training</option></select></div><div class="table-head"><span>Employee</span><span>Department</span><span>Training progress</span><span>Guidelines</span><span></span></div><div id="rows"></div><div class="footer" id="resultCount" aria-live="polite"></div></section></div><div id="detailView" hidden><button class="back" id="back">← Back to employee queue</button><div class="heading-row"><div><div class="eyebrow">Onboarding / employee review</div><h1>Guidelines review</h1><p class="sub">Review this employee’s onboarding guidelines status.</p></div></div><div class="detail-layout"><section class="detail-card"><div class="detail-header"><div id="detailAvatar" class="avatar"></div><div><h2 id="detailName"></h2><p class="sub" id="detailDept"></p></div></div><div class="detail-body"><h3>Onboarding guidelines</h3><p>Confirm the guidelines review for this employee. This approval is tracked separately from their training progress.</p><div class="guideline-box"><strong>Guidelines status</strong><div id="detailStatus"></div><p style="margin-top:10px">The status reflects the review of onboarding guidelines.</p></div><div id="feedback" aria-live="polite"></div><div class="action-row"><button class="primary" id="approve">Approve guidelines</button><span class="action-note" id="actionNote"></span></div></div></section><aside class="detail-card aside"><h3>Training progress</h3><p>Progress through assigned onboarding training.</p><div class="progress-wrap"><div class="bar"><span id="detailBar"></span></div><span class="percent" id="detailPercent"></span></div><p>Training progress does not determine guidelines approval.</p></aside></div></div></div></main></div>
|
|
13
|
+
<script>
|
|
14
|
+
const employees=[{name:'Maya Chen',dept:'Product Design',progress:85,status:'Awaiting review'},{name:'Elias Romero',dept:'Engineering',progress:100,status:'Approved'},{name:'Nadia Okafor',dept:'Operations',progress:72,status:'Awaiting review'},{name:'Jules Kim',dept:'Engineering',progress:64,status:'In training'},{name:'Sofia Almeida',dept:'Customer Success',progress:95,status:'Awaiting review'},{name:'Arun Patel',dept:'Data',progress:100,status:'Approved'}];
|
|
15
|
+
const $=id=>document.getElementById(id);let selected=null, mayaFailed=false, lastButton=null;
|
|
16
|
+
const initials=name=>name.split(' ').map(part=>part[0]).join('');const badge=status=>`<span class="badge ${status==='Approved'?'approved':status==='In training'?'training':'awaiting'}">${status}</span>`;
|
|
17
|
+
function render(){const term=$('search').value.trim().toLowerCase(),filter=$('filter').value;const matches=employees.map((e,i)=>({...e,i})).filter(e=>(e.name+' '+e.dept).toLowerCase().includes(term)&&(filter==='all'||e.status===filter));$('rows').innerHTML=matches.length?matches.map(e=>`<button class="employee" data-index="${e.i}" aria-label="Open ${e.name}, ${e.status}"><span class="person"><span class="avatar alt${e.i%4}">${initials(e.name)}</span><span><span class="name">${e.name}</span><small>Employee</small></span></span><span class="department">${e.dept}</span><span class="progress-wrap"><span class="bar"><span style="width:${e.progress}%"></span></span><span class="percent">${e.progress}%</span></span><span class="status-cell">${badge(e.status)}</span><span class="arrow" aria-hidden="true">›</span></button>`).join(''):'<div class="empty"><strong>No employees found</strong>Try a different search or status filter.</div>';$('resultCount').textContent=`Showing ${matches.length} of ${employees.length} employees`;$('waitingCount').innerHTML=`${employees.filter(e=>e.status==='Awaiting review').length} <span class="metric-note">need your attention</span>`;$('approvedCount').innerHTML=`${employees.filter(e=>e.status==='Approved').length} <span class="metric-note">guidelines reviewed</span>`;}
|
|
18
|
+
function openDetail(index,button){selected=index;lastButton=button;const e=employees[index];$('detailName').textContent=e.name;$('detailDept').textContent=e.dept;$('detailAvatar').textContent=initials(e.name);$('detailAvatar').className='avatar alt'+index%4;$('detailStatus').innerHTML=badge(e.status);$('detailBar').style.width=e.progress+'%';$('detailPercent').textContent=e.progress+'%';$('feedback').innerHTML='';$('approve').hidden=e.status!=='Awaiting review';$('approve').textContent='Approve guidelines';$('actionNote').textContent=e.status==='Approved'?'Guidelines have been approved.':e.status==='In training'?'Guidelines are not ready for review yet.':'';$('listView').hidden=true;$('detailView').hidden=false;window.scrollTo(0,0);$('back').focus();}
|
|
19
|
+
$('rows').addEventListener('click',event=>{const button=event.target.closest('button[data-index]');if(button)openDetail(Number(button.dataset.index),button)});$('search').addEventListener('input',render);$('filter').addEventListener('change',render);$('back').addEventListener('click',()=>{$('detailView').hidden=true;$('listView').hidden=false;render();const row=$('rows').querySelector(`[data-index="${selected}"]`);(row||$('search')).focus()});$('approve').addEventListener('click',()=>{const e=employees[selected];if(selected===0&&!mayaFailed){mayaFailed=true;$('feedback').innerHTML='<div class="error" role="alert"><strong>Approval could not be saved</strong>Please try again. The guidelines are still awaiting review.</div>';$('approve').textContent='Retry approval';return}e.status='Approved';$('detailStatus').innerHTML=badge(e.status);$('feedback').innerHTML='<div class="success" role="status"><strong>Guidelines approved.</strong> This employee’s review is complete.</div>';$('approve').hidden=true;$('actionNote').textContent='Guidelines have been approved.';render()});render();
|
|
20
|
+
</script></body></html>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"arm": "baseline",
|
|
4
|
+
"width": 1360,
|
|
5
|
+
"otherEmployeeExcluded": true,
|
|
6
|
+
"detail": true,
|
|
7
|
+
"error": true,
|
|
8
|
+
"gaveSuccess": true,
|
|
9
|
+
"retainedFilter": true,
|
|
10
|
+
"retainedSearch": true,
|
|
11
|
+
"approvedLeavesQueue": true,
|
|
12
|
+
"docFits": true,
|
|
13
|
+
"focusOnOpen": "BODY",
|
|
14
|
+
"focusOnFailure": "BODY",
|
|
15
|
+
"focusOnSuccess": "BODY",
|
|
16
|
+
"focusOnReturn": "BODY",
|
|
17
|
+
"errors": []
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"arm": "fieldwork",
|
|
21
|
+
"width": 1360,
|
|
22
|
+
"otherEmployeeExcluded": true,
|
|
23
|
+
"detail": true,
|
|
24
|
+
"error": true,
|
|
25
|
+
"gaveSuccess": true,
|
|
26
|
+
"retainedFilter": true,
|
|
27
|
+
"retainedSearch": true,
|
|
28
|
+
"approvedLeavesQueue": true,
|
|
29
|
+
"docFits": true,
|
|
30
|
+
"focusOnOpen": "back",
|
|
31
|
+
"focusOnFailure": "approve",
|
|
32
|
+
"focusOnSuccess": "BODY",
|
|
33
|
+
"focusOnReturn": "search",
|
|
34
|
+
"errors": []
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"arm": "baseline",
|
|
38
|
+
"width": 390,
|
|
39
|
+
"otherEmployeeExcluded": true,
|
|
40
|
+
"detail": true,
|
|
41
|
+
"error": true,
|
|
42
|
+
"gaveSuccess": true,
|
|
43
|
+
"retainedFilter": true,
|
|
44
|
+
"retainedSearch": true,
|
|
45
|
+
"approvedLeavesQueue": true,
|
|
46
|
+
"docFits": true,
|
|
47
|
+
"focusOnOpen": "BODY",
|
|
48
|
+
"focusOnFailure": "BODY",
|
|
49
|
+
"focusOnSuccess": "BODY",
|
|
50
|
+
"focusOnReturn": "BODY",
|
|
51
|
+
"errors": []
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"arm": "fieldwork",
|
|
55
|
+
"width": 390,
|
|
56
|
+
"otherEmployeeExcluded": true,
|
|
57
|
+
"detail": true,
|
|
58
|
+
"error": true,
|
|
59
|
+
"gaveSuccess": true,
|
|
60
|
+
"retainedFilter": true,
|
|
61
|
+
"retainedSearch": true,
|
|
62
|
+
"approvedLeavesQueue": true,
|
|
63
|
+
"docFits": true,
|
|
64
|
+
"focusOnOpen": "back",
|
|
65
|
+
"focusOnFailure": "approve",
|
|
66
|
+
"focusOnSuccess": "BODY",
|
|
67
|
+
"focusOnReturn": "search",
|
|
68
|
+
"errors": []
|
|
69
|
+
}
|
|
70
|
+
]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"off": {
|
|
3
|
+
"pending_line": "UI verification: pending — read probe.txt in the current directory.",
|
|
4
|
+
"probe_reads": 0,
|
|
5
|
+
"probe_output": null,
|
|
6
|
+
"completed": true
|
|
7
|
+
},
|
|
8
|
+
"on": {
|
|
9
|
+
"pending_line": "UI verification: pending — read probe.txt in the current directory.",
|
|
10
|
+
"probe_reads": 1,
|
|
11
|
+
"probe_output": "UI Fieldwork hook fixture ready",
|
|
12
|
+
"completed": true
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ui-fieldwork",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "A standalone design, build, and verification skill for coding agents",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"ui-fieldwork": "bin/install.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"skills",
|
|
16
|
+
"examples",
|
|
17
|
+
"docs/assets",
|
|
18
|
+
"docs/examples"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --test"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/sungphan/ui-fieldwork.git"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 UI Craft contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-fieldwork
|
|
3
|
+
description: Plan, build, redesign, or audit user interfaces across web, mobile, desktop, and other interactive surfaces. Use for art direction, task flows, component behavior, adaptive layout, accessibility, or generic-looking UI. Ground decisions in the product and verify the changed experience at runtime.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# UI Fieldwork
|
|
8
|
+
|
|
9
|
+
Honor the user's scope, platform and stack. Start with the project's design system, tooling and assets. Apply the guidance relevant to the changed task.
|
|
10
|
+
|
|
11
|
+
## Understand the job
|
|
12
|
+
|
|
13
|
+
- Inspect relevant screens, components, tokens, copy and data. For each affected task, identify the audience, entry state, main action or decision, expected result, and relevant failure or recovery path. Use that scenario to define acceptance checks.
|
|
14
|
+
- In brainstorm mode, present proposals and tradeoffs. In an audit, tie findings to evidence and rank by impact on the task. For targeted fixes, preserve the existing direction. For an open-ended redesign, compare approaches that differ in structure, interaction or storytelling.
|
|
15
|
+
- For a design decision that benefits from research, compare references that solve the same task. Record the pattern, why it fits, and where it breaks. Use galleries for visual exploration, shipped flows for precedents, and research or platform guidance for claims about usability and interaction.
|
|
16
|
+
- For desktop and data-heavy workflows, keep frequent actions visible, retain relevant drafts, filters and selection, and preserve familiar shortcuts. Keep comparison data together when adapting to mobile. Check that data and actions inside panels and tables remain reachable with the relevant input methods.
|
|
17
|
+
|
|
18
|
+
## Adapt to the environment
|
|
19
|
+
|
|
20
|
+
Identify the supported devices, window sizes, input methods and relevant system settings. Use these examples to select checks for the affected task.
|
|
21
|
+
|
|
22
|
+
| Environment | Design and verification |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| Web and embedded views | Respect existing URL, history and scrolling behavior. Try zoom or text resizing and narrow reflow. Check nested scroll areas and controls obscured by fixed UI. |
|
|
25
|
+
| Native or hybrid mobile and tablets | Follow system navigation and safe areas. Try touch, larger system text, supported window sizes and the on-screen keyboard with a focused field. Exercise Back, dismissal or pause/resume when they affect task state. Keep essential actions reachable without hover. |
|
|
26
|
+
| Desktop apps, workspaces and terminal UI | Test the smallest supported window and the primary keyboard or pointer path. Preserve familiar navigation and focus during window, pane or list changes. |
|
|
27
|
+
| Remote, controller, kiosk or other specialized input | Follow the platform's input and focus conventions. Test the real input path, including selection, Back or cancel, recovery and legibility at the intended viewing distance. |
|
|
28
|
+
|
|
29
|
+
- Give interactive controls accessible names, visible focus and usable target sizes. Where relevant, offer a reachable alternative to hover, precise dragging or gestures. Try long translations, larger text and reading direction when the product supports them.
|
|
30
|
+
|
|
31
|
+
## Design and build
|
|
32
|
+
|
|
33
|
+
- Design one representative screen and complete its primary flow before scaling the pattern. Use representative content and data, including dense records, long labels, and translated copy when supported.
|
|
34
|
+
- Make the next action and relevant information easy to find. For marketing or editorial work, choose a visual anchor grounded in the actual content and use specific copy. Use typography, spacing, alignment and tokens to create hierarchy. Give imagery and motion a clear job.
|
|
35
|
+
- Keep controls needed mid-task easy to reach from where the user works. When changing language, view or preferences, carry over the meaningful section, selection or draft. Choose placement for the flow. If a control or header stays fixed, check that it leaves focused items and jump targets visible.
|
|
36
|
+
- On narrow layouts, keep essential destinations visible or provide an obvious way to reach them. Let short navigation lists wrap or stack when appropriate. If a strip scrolls sideways, make the overflow discoverable and ensure keyboard focus reveals each destination.
|
|
37
|
+
- For ecommerce, follow the purchase decision across product detail, cart, and checkout. Surface price, availability, delivery and policy details before commitment. When guest checkout is supported, keep that path visible and preserve it across steps. Exercise the changed step and its handoff.
|
|
38
|
+
- Review the render for generic copy, interchangeable sections, repeated badges, redundant cards, or decoration competing with the task. Explain what a change would improve on this screen. Treat these signals as critique prompts and allow them where they serve a clear purpose.
|
|
39
|
+
- Respect the user’s component and framework choices. Reuse suitable project components. Browse catalogs for ideas when helpful and let the project requirements drive implementation. Use native controls for simple interactions and check the platform’s keyboard and focus conventions for complex widgets. For a web modal, test initial focus, Tab containment, Escape and focus restoration. Preserve readable contrast and reduced-motion behavior.
|
|
40
|
+
- Design task-relevant loading, empty, success and failure states. Acknowledge input promptly and keep routine feedback near the action. Keep form labels visible, preserve valid input and offer a concrete recovery step. Report save or sync success after confirmation. For longer tasks, show honest progress and offer cancellation or background continuation when supported. Check avoidable sequential requests and costly UI dependencies on the changed path.
|
|
41
|
+
|
|
42
|
+
## Verify and hand off
|
|
43
|
+
|
|
44
|
+
- For implementation, inspect the running interface on representative widths where supported. Try realistic content, the main action and the state most likely to fail. Check that the action is discoverable and usable, including when content wraps or a panel scrolls. Reuse project checks and tools.
|
|
45
|
+
- Exercise relevant keyboard navigation through success, failure and return. For a control used mid-task, start in context, tab to it, activate it and continue. Check context when focus reaches the control and again after activation. If the focused control disappears or becomes unavailable, move focus to a logical next target when needed. Run applicable project checks. Ground screenshot observations, interaction results and source findings in what was inspected.
|
|
46
|
+
- Fix defects in scope and repeat the check that exposed them. Summarize the changed surface and end the handoff with one plain-text evidence line when the turn changes UI code. Add the route, behavior, or concrete reason on the same line.
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
UI verification: checked — <render and interaction evidence>
|
|
50
|
+
UI verification: partial — <checks performed and gap>
|
|
51
|
+
UI verification: unavailable — <concrete runtime blocker>
|
|
52
|
+
UI verification: pending — <runnable browser check remaining>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If a runnable check remains, perform it during the turn whenever possible. The optional Codex hook reads the final pending evidence line and can resume the turn once. An audit-only or planning turn can report evidence in ordinary prose.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
|
|
3
|
+
let event;
|
|
4
|
+
try {
|
|
5
|
+
event = JSON.parse(readFileSync(0, 'utf8'));
|
|
6
|
+
} catch {
|
|
7
|
+
process.exit(0);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (
|
|
11
|
+
event?.hook_event_name === 'Stop' &&
|
|
12
|
+
event.stop_hook_active === false &&
|
|
13
|
+
typeof event.last_assistant_message === 'string' &&
|
|
14
|
+
/(?:^|\n)UI verification: pending[ \t]*—[ \t]*\S[^\r\n]*$/i.test(
|
|
15
|
+
event.last_assistant_message.trimEnd(),
|
|
16
|
+
)
|
|
17
|
+
) {
|
|
18
|
+
console.log(JSON.stringify({
|
|
19
|
+
decision: 'block',
|
|
20
|
+
reason: 'Run the pending UI verification already identified in this turn if it is available and in scope. Report the result or the concrete blocker. If the user ended or narrowed the task, respect that instruction.',
|
|
21
|
+
}));
|
|
22
|
+
}
|