mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 17:37:40 +00:00
* plugins: components catalog 2 (forms, tabs, table, tree, markdown, code, images)
Adds 18 components to TSX components panels, drawn with Orca's own
primitives and gated by ui.catalog 2 / ui.has() (Orca 1.4.247):
Textarea, Checkbox, RadioGroup, Slider, Field, Tabs/Tab, Collapsible,
Toolbar, Grid, a virtualized Table with sort, selection and pull-based
paging, a keyboard Tree with lazy children, Markdown (sanitized, links
through the checked open path), CodeView (Orca's highlighter), Image
(header-checked plugin files read by main), KeyValue, Callout and
Skeleton, plus a tooltip prop on Button and IconButton.
Value controls share the edit protocol; handlers get plain JSON event
args, including small objects ({ keys }, { key, expanded }). The test kit
gains matching actions and hides unselected tabs and closed collapsibles;
a components-gallery example and e2e cover the catalog end to end.
* plugins: worker test harness, host refusals in tests and check
- orca/testing gains mountWorker(main, { host, events, commands }): it calls
the default-exported activate(orca) with the orca object Orca itself builds
(createPluginWorkerOrcaApi, moved to shared so the kit reuses it), backed by
mockHost. emit() checks payloads against Orca's event schemas and only
delivers subscribed events; command(), request() (the worker's
orca.panels.handle, as a panel's plugin.request), posts, logs, refusals and
deactivate(). Storage and settings share the mock host's in-memory store.
- orca plugin test loads a worker main's module graph as Orca's worker host
does (.ts/.mts transform, Node resolution, no runtime orca import).
- mockHost records refusals (capability_denied, not_permitted, ...) even
when plugin code catches them; panel.refusals exposes them and
orca plugin check reports them as warnings. Check dedupes repeated issues.
- Typings, docs and a generated references/testing.md skill reference; the
reference generator reads the split orca typings.
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import {
|
|
atom,
|
|
Button,
|
|
Checkbox,
|
|
Collapsible,
|
|
Field,
|
|
Input,
|
|
RadioGroup,
|
|
read,
|
|
Row,
|
|
set,
|
|
Slider,
|
|
Stack,
|
|
Switch,
|
|
Text,
|
|
Textarea
|
|
} from 'orca'
|
|
|
|
export const title = atom('gallery.title', '', { persist: 'plugin' })
|
|
export const notes = atom('')
|
|
export const priority = atom('normal')
|
|
export const effort = atom(3)
|
|
export const notify = atom(true)
|
|
export const agreed = atom(false)
|
|
export const submitted = atom<string | null>(null)
|
|
|
|
export function FormsTab() {
|
|
const titleError = read(title).trim() === '' ? 'Give the task a title' : undefined
|
|
return (
|
|
<Stack gap="md">
|
|
<Field label="Task" description="What needs doing" error={titleError} required>
|
|
<Input
|
|
label="Title"
|
|
labelHidden
|
|
value={read(title)}
|
|
onChange={(value) => set(title, value)}
|
|
/>
|
|
<Textarea
|
|
label="Notes"
|
|
rows={3}
|
|
placeholder="Cmd/Ctrl+Enter to save"
|
|
value={read(notes)}
|
|
onChange={(value) => set(notes, value)}
|
|
onSubmit={(value) => set(submitted, `${read(title)}: ${value}`)}
|
|
/>
|
|
</Field>
|
|
<RadioGroup
|
|
label="Priority"
|
|
orientation="horizontal"
|
|
value={read(priority)}
|
|
onChange={(value) => set(priority, value)}
|
|
options={[
|
|
{ value: 'low', label: 'Low' },
|
|
{ value: 'normal', label: 'Normal' },
|
|
{ value: 'high', label: 'High', description: 'Pinned to the top' }
|
|
]}
|
|
/>
|
|
<Slider
|
|
label="Effort"
|
|
min={1}
|
|
max={8}
|
|
showValue
|
|
value={read(effort)}
|
|
onChange={(value) => set(effort, value)}
|
|
/>
|
|
<Switch label="Notify me" checked={read(notify)} onChange={(value) => set(notify, value)} />
|
|
<Checkbox
|
|
label="I have read the guidelines"
|
|
description="Required before saving"
|
|
checked={read(agreed)}
|
|
onChange={(value) => set(agreed, value)}
|
|
/>
|
|
<Collapsible title="Advanced" description="Rarely needed">
|
|
<Text muted>Nothing here yet: a Collapsible keeps rare options out of the way.</Text>
|
|
</Collapsible>
|
|
<Row justify="end">
|
|
<Button
|
|
variant="solid"
|
|
tone="accent"
|
|
disabled={titleError !== undefined || !read(agreed)}
|
|
onPress={() => set(submitted, read(title))}
|
|
>
|
|
Save
|
|
</Button>
|
|
</Row>
|
|
{read(submitted) ? <Text tone="success">Saved {read(submitted)}</Text> : null}
|
|
</Stack>
|
|
)
|
|
}
|