@notis_ai/cli 0.2.29 → 0.2.31
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/README.md +26 -8
- package/dist/agent-hooks/notis-agent-hook.mjs +38399 -10883
- package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-cli/SKILL.md +11 -0
- package/dist/base-skills/notis-cli/references/native-databases.md +1 -1
- package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-query/references/query.md +6 -4
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/SKILL.md +8 -3
- package/dist/base-skills/notis-spaces/references/architecture.md +4 -1
- package/dist/base-skills/notis-spaces/references/design.md +7 -1
- package/dist/base-skills/notis-spaces/references/fixtures.md +27 -2
- package/dist/base-skills/notis-spaces/references/release.md +6 -5
- package/dist/base-skills/notis-spaces/references/sdk.md +172 -48
- package/dist/base-skills/notis-spaces/references/troubleshooting.md +3 -0
- package/dist/base-skills/notis-spaces/references/views.md +20 -0
- package/dist/sdk/src/hooks/useNativeDocuments.ts +50 -12
- package/dist/sdk/src/hooks/useThreadItem.ts +56 -0
- package/dist/sdk/src/index.ts +7 -2
- package/dist/sdk/src/runtime.ts +8 -1
- package/dist/sdk/src/space.ts +233 -1
- package/dist/sdk/src/tailwind.ts +53 -3
- package/dist/sdk/src/ui/icons.tsx +1 -0
- package/dist/sdk/src/words/types.ts +28 -0
- package/dist/skill-sync/index.js +10 -90
- package/dist/skill-sync-worker.mjs +232 -120
- package/dist/space-harness/host.js +309 -96
- package/dist/space-sdk/dist/chunk-3DFOGU26.js +3 -0
- package/dist/space-sdk/dist/index.js +4 -2
- package/dist/space-sdk/dist/ui.js +19 -14
- package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +23 -0
- package/dist/space-sdk/src/hooks/useThreadItem.d.ts +28 -0
- package/dist/space-sdk/src/index.d.ts +4 -2
- package/dist/space-sdk/src/runtime.d.ts +8 -1
- package/dist/space-sdk/src/space.ts +233 -1
- package/dist/space-sdk/src/tailwind-candidates.d.ts +765 -16
- package/dist/space-sdk/src/tailwind.ts +53 -3
- package/dist/space-sdk/src/ui/actions/useToast.d.ts +2 -0
- package/dist/space-sdk/src/ui/blocks/DataTable.d.ts +19 -4
- package/dist/space-sdk/src/ui/blocks/Meter.d.ts +12 -3
- package/dist/space-sdk/src/ui/blocks/Tabs.d.ts +7 -1
- package/dist/space-sdk/src/ui/blocks/index.d.ts +1 -1
- package/dist/space-sdk/src/ui/charts/CalendarHeatmap.d.ts +69 -0
- package/dist/space-sdk/src/ui/charts/Chart.d.ts +18 -3
- package/dist/space-sdk/src/ui/charts/chartData.d.ts +19 -0
- package/dist/space-sdk/src/ui/charts/heatmapData.d.ts +81 -0
- package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +56 -10
- package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +16 -7
- package/dist/space-sdk/src/ui/comments/agentRuntime.d.ts +59 -0
- package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +5 -2
- package/dist/space-sdk/src/ui/comments/commentModel.d.ts +103 -8
- package/dist/space-sdk/src/ui/comments/commentWords.d.ts +82 -0
- package/dist/space-sdk/src/ui/comments/hostComments.d.ts +37 -0
- package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
- package/dist/space-sdk/src/ui/comments/paneParts.d.ts +119 -0
- package/dist/space-sdk/src/ui/comments/useCommentRouting.d.ts +75 -0
- package/dist/space-sdk/src/ui/comments/useComments.d.ts +147 -15
- package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +24 -8
- package/dist/space-sdk/src/ui/index.d.ts +6 -3
- package/dist/space-sdk/src/ui/layout/SidePane.d.ts +6 -1
- package/dist/space-sdk/src/ui/list/Row.d.ts +11 -1
- package/dist/space-sdk/src/ui/overlay/Tooltip.d.ts +8 -2
- package/dist/space-sdk/src/ui/period/dateFormat.d.ts +2 -0
- package/dist/space-sdk/src/ui/period/dateWords.d.ts +9 -0
- package/dist/space-sdk/src/ui/period/periods.d.ts +15 -2
- package/dist/space-sdk/src/ui/styles.d.ts +27 -5
- package/dist/space-sdk/src/words/types.ts +28 -0
- package/dist/view-renderer/dist/host.js +379 -166
- package/dist/view-renderer/src/dom.js +3 -2
- package/dist/view-renderer/src/errors.js +9 -0
- package/dist/view-renderer/src/host.tsx +18 -8
- package/dist/view-renderer/src/remote-broker.js +3 -1
- package/dist/view-renderer/src/renderer.js +87 -17
- package/dist/view-renderer/src/skeleton.js +70 -18
- package/package.json +5 -4
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +2 -1
- package/skills/notis-query/cli.md +3 -0
- package/skills/notis-spaces/cli.md +8 -8
- package/src/cli.js +10 -2
- package/src/command-specs/computer.js +21 -1
- package/src/command-specs/profile.js +12 -5
- package/src/command-specs/spaces.js +101 -31
- package/src/command-specs/tools.js +3 -0
- package/src/runtime/agent-identity.js +187 -0
- package/src/runtime/api-hosts.generated.js +35 -0
- package/src/runtime/api-hosts.js +109 -0
- package/src/runtime/app-platform.js +68 -24
- package/src/runtime/channel.js +3 -7
- package/src/runtime/http-agent.js +53 -0
- package/src/runtime/native-record-files.js +11 -0
- package/src/runtime/oauth.js +97 -5
- package/src/runtime/profiles.js +200 -41
- package/src/runtime/skill-sync/cloud-client.ts +0 -10
- package/src/runtime/skill-sync/index.ts +13 -15
- package/src/runtime/skill-sync/local-scanner.ts +0 -67
- package/src/runtime/skill-sync/types.ts +1 -0
- package/src/runtime/skill-sync/write-cloud-skill.ts +7 -23
- package/src/runtime/skill-sync-service.js +4 -5
- package/src/runtime/space-dependencies.js +66 -0
- package/src/runtime/space-fixture-broker.js +23 -8
- package/src/runtime/space-platform.js +49 -3
- package/src/runtime/space-source.js +76 -2
- package/src/runtime/space-test-server.js +125 -10
- package/src/runtime/space-verification.js +106 -42
- package/src/runtime/space-view-manifest.js +38 -5
- package/src/runtime/telemetry.js +14 -1
- package/src/runtime/transport.js +31 -4
- package/src/runtime/upsell.js +3 -6
- package/src/runtime/view-render.js +6 -1
- package/src/skill-sync-worker.js +13 -2
- package/src/space-harness-host.ts +6 -3
- package/template/tailwind.config.ts +2 -35
- package/dist/space-sdk/dist/chunk-BFGB6XXC.js +0 -5
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Build-only SDK content discovery and Notis theme colours. Author configuration and PostCSS plugins stay intact:
|
|
3
|
+
* a colour, theme value or opacity step the Space defines itself always wins over the defaults added here.
|
|
4
|
+
*/
|
|
2
5
|
import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
6
|
import { tmpdir } from 'node:os';
|
|
4
7
|
import { dirname, join, relative, resolve } from 'node:path';
|
|
5
8
|
import { fileURLToPath } from 'node:url';
|
|
6
9
|
|
|
10
|
+
const tone = (name: string) => `hsl(var(--${name}))`;
|
|
11
|
+
const pair = (name: string) => ({ DEFAULT: tone(name), foreground: tone(`${name}-foreground`) });
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The colours the Notis host sets on every Space page (light and dark), as Tailwind colours, so `bg-accent`,
|
|
15
|
+
* `text-chart-2` and opacity modifiers such as `bg-chart-2/40` or `bg-foreground/12` work in every Space.
|
|
16
|
+
*/
|
|
17
|
+
export const NOTIS_THEME_COLORS = {
|
|
18
|
+
border: tone('border'), input: tone('input'), ring: tone('ring'),
|
|
19
|
+
background: tone('background'), foreground: tone('foreground'),
|
|
20
|
+
primary: pair('primary'), secondary: pair('secondary'), destructive: pair('destructive'), muted: pair('muted'),
|
|
21
|
+
accent: pair('accent'), popover: pair('popover'), card: pair('card'),
|
|
22
|
+
chart: { 1: tone('chart-1'), 2: tone('chart-2'), 3: tone('chart-3'), 4: tone('chart-4'), 5: tone('chart-5') },
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
/** Tailwind 4 theme block: `default` keeps every colour a Space sets in its own `@theme` or `@config` first. */
|
|
26
|
+
const THEME_MARK = '/* notis-theme-colors */';
|
|
27
|
+
const themeBlock = () => {
|
|
28
|
+
const lines: string[] = [];
|
|
29
|
+
for (const [name, value] of Object.entries(NOTIS_THEME_COLORS)) {
|
|
30
|
+
if (typeof value === 'string') { lines.push(` --color-${name}: ${value};`); continue; }
|
|
31
|
+
for (const [key, shade] of Object.entries(value)) lines.push(` --color-${name}${key === 'DEFAULT' ? '' : `-${key}`}: ${shade};`);
|
|
32
|
+
}
|
|
33
|
+
return `${THEME_MARK}\n@theme default inline {\n${lines.join('\n')}\n}`;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Tailwind 3 only knows the opacity steps of its scale (5, 10, 15...): every whole percent works, as in Tailwind 4. */
|
|
37
|
+
const OPACITY_STEPS = Object.fromEntries(Array.from({ length: 101 }, (_, step) => [String(step), String(step / 100)]));
|
|
38
|
+
|
|
7
39
|
export function notisTailwindContent() {
|
|
8
40
|
let root = process.cwd();
|
|
9
41
|
let temporary: string | undefined;
|
|
@@ -26,7 +58,8 @@ export function notisTailwindContent() {
|
|
|
26
58
|
const sdkSource = dirname(fileURLToPath(import.meta.url));
|
|
27
59
|
const relativeSource = './' + relative(dirname(stylesheet), sdkSource).replaceAll('\\', '/');
|
|
28
60
|
const directive = `@source ${JSON.stringify(relativeSource)};`;
|
|
29
|
-
|
|
61
|
+
const added = [source.includes(directive) ? '' : `${directive}\n`, source.includes(THEME_MARK) ? '' : `${themeBlock()}\n`].join('');
|
|
62
|
+
return added ? { code: `${source}\n${added}`, map: null } : null;
|
|
30
63
|
}
|
|
31
64
|
if (!/@tailwind\s/.test(source)) return null;
|
|
32
65
|
const explicit = source.match(/@config\s+(['"])(.*?)\1\s*;/);
|
|
@@ -41,11 +74,28 @@ export function notisTailwindContent() {
|
|
|
41
74
|
const sdkGlob = join(dirname(fileURLToPath(import.meta.url)), '**/*.{ts,tsx}').replaceAll('\\', '/');
|
|
42
75
|
writeFileSync(wrapper, `import config from ${JSON.stringify(config)};
|
|
43
76
|
import { resolve } from 'node:path';
|
|
77
|
+
const defaults = ${JSON.stringify({ colors: NOTIS_THEME_COLORS, opacity: OPACITY_STEPS })};
|
|
78
|
+
const theme = config.theme || {};
|
|
79
|
+
const extend = theme.extend || {};
|
|
80
|
+
const presets = (config.presets || []).filter(preset => preset && typeof preset === 'object').map(preset => preset.theme || {});
|
|
81
|
+
// The Space's own colours and opacity steps win: a default fills only what the Space (or its presets) leaves unset,
|
|
82
|
+
// one level deep, so a Space's own card keeps the Notis card-foreground. A scale the Space replaces stays as it is.
|
|
83
|
+
const fill = (key) => {
|
|
84
|
+
if (typeof theme[key] === 'function' || (key === 'opacity' && theme.opacity)) return extend[key];
|
|
85
|
+
const own = [...presets.flatMap(t => [t[key], (t.extend || {})[key]]), theme[key], extend[key]].filter(v => v && typeof v === 'object');
|
|
86
|
+
const added = {};
|
|
87
|
+
for (const [name, value] of Object.entries(defaults[key])) {
|
|
88
|
+
const set = own.map(o => o[name]).filter(v => v !== undefined);
|
|
89
|
+
if (!set.length) added[name] = value;
|
|
90
|
+
else if (typeof value === 'object' && set.every(v => v && typeof v === 'object')) added[name] = Object.assign({}, value, ...set);
|
|
91
|
+
}
|
|
92
|
+
return typeof extend[key] === 'function' ? (utils) => ({ ...added, ...extend[key](utils) }) : { ...extend[key], ...added };
|
|
93
|
+
};
|
|
44
94
|
const content = config.content || [];
|
|
45
95
|
const files = Array.isArray(content) ? content : (content.files || []);
|
|
46
96
|
const base = ${JSON.stringify(root)};
|
|
47
97
|
const relativeBase = ${JSON.stringify(dirname(config))};
|
|
48
|
-
export default { ...config, content: {
|
|
98
|
+
export default { ...config, theme: { ...theme, extend: { ...extend, colors: fill('colors'), opacity: fill('opacity') } }, content: {
|
|
49
99
|
...(Array.isArray(content) ? {} : content),
|
|
50
100
|
relative: false,
|
|
51
101
|
files: [...files.map(file => typeof file !== 'string' ? file :
|
|
@@ -24,6 +24,8 @@ export interface ToastOptions {
|
|
|
24
24
|
undo?: UndoFn | null;
|
|
25
25
|
/** A muted second line under the words. */
|
|
26
26
|
reason?: Words | string | null;
|
|
27
|
+
/** How long it stays, in ms (default ACTION_TOAST_MS); Dismiss still hides it sooner. */
|
|
28
|
+
durationMs?: number;
|
|
27
29
|
}
|
|
28
30
|
export interface UseToastOptions {
|
|
29
31
|
/** An Undo threw or rejected (the toast already says so). */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DataTable: a read-only table for a dashboard `Section kind="data"` (machines, threads, jobs), styled like the
|
|
3
|
-
* ChartTable: 40px rows with a hairline above each, a sticky 36px muted header, the edge cells 24px in. Cells
|
|
4
|
-
* wrap
|
|
3
|
+
* ChartTable: 40px rows with a hairline above each, a sticky 36px muted header, the edge cells 24px in. Cells
|
|
4
|
+
* truncate, unless a column wraps (`wrap`) or the headers do (`wrapHeaders`). One primary column takes the room left, never under its `minWidth` (default 120 px); the others
|
|
5
5
|
* fit their content or a fixed width, and a column can hide under a container width so a phone never scrolls
|
|
6
6
|
* sideways. When the columns kept still do not fit, the last ones hide on their own, so the primary text is never
|
|
7
7
|
* crushed. A real table, so view Markdown reads it.
|
|
@@ -14,7 +14,7 @@ export interface DataTableColumn<R> {
|
|
|
14
14
|
id: string;
|
|
15
15
|
/** The header text. */
|
|
16
16
|
label: Text;
|
|
17
|
-
/** The cell of one row. Text truncates with an ellipsis
|
|
17
|
+
/** The cell of one row. Text truncates with an ellipsis, unless the column wraps. */
|
|
18
18
|
cell: (row: R) => ReactNode;
|
|
19
19
|
/** Default 'start'. Use 'end' for numbers. */
|
|
20
20
|
align?: 'start' | 'end';
|
|
@@ -32,6 +32,11 @@ export interface DataTableColumn<R> {
|
|
|
32
32
|
hideBelow?: number;
|
|
33
33
|
/** On the primary column: the narrowest it gets, in px (padding excluded). Default 120. */
|
|
34
34
|
minWidth?: number;
|
|
35
|
+
/**
|
|
36
|
+
* The column's cells and header wrap onto more lines instead of truncating (a note, a question), and their rows grow
|
|
37
|
+
* to fit. For long text the reader needs whole; keep figures, dates and ids on one line.
|
|
38
|
+
*/
|
|
39
|
+
wrap?: boolean;
|
|
35
40
|
}
|
|
36
41
|
export interface DataTableGroup<R> {
|
|
37
42
|
key: string;
|
|
@@ -47,12 +52,22 @@ export interface DataTableProps<R> {
|
|
|
47
52
|
rowKey: (row: R) => string;
|
|
48
53
|
/** Makes rows pressable: a button in the primary cell covers the row and takes Tab focus. */
|
|
49
54
|
onRowPress?: (row: R) => void;
|
|
55
|
+
/**
|
|
56
|
+
* With `onRowPress`: whether this row opens anything. A row it returns false for is plain (no hover, no button, no
|
|
57
|
+
* press), so a row with nowhere to go never looks clickable. Default every row.
|
|
58
|
+
*/
|
|
59
|
+
canPressRow?: (row: R) => boolean;
|
|
50
60
|
/** The accessible name of a row's press target. Default the primary cell's text. */
|
|
51
61
|
rowLabel?: (row: R) => string;
|
|
52
62
|
/** The table's accessible name (the Section title, usually). */
|
|
53
63
|
label?: Text;
|
|
54
64
|
/** Shown in place of the rows when there are none. Default an EmptyState. */
|
|
55
65
|
empty?: ReactNode;
|
|
66
|
+
/**
|
|
67
|
+
* Header labels wrap onto a second line instead of truncating (longer French headers over narrow figure columns).
|
|
68
|
+
* Default false: one line, with an ellipsis.
|
|
69
|
+
*/
|
|
70
|
+
wrapHeaders?: boolean;
|
|
56
71
|
className?: string;
|
|
57
72
|
}
|
|
58
73
|
/** Columns hidden because they did not fit, with the first and last columns still shown (they take the edge insets). */
|
|
@@ -79,7 +94,7 @@ export declare function dataTableHideCss(tableId: string, limits: readonly (numb
|
|
|
79
94
|
* A read-only table: 40px rows, a sticky 36px header, cells that truncate, optional group headings with their
|
|
80
95
|
* counts and pressable rows. Columns with `hideBelow` hide under that container width.
|
|
81
96
|
*/
|
|
82
|
-
export declare function DataTable<R>({ columns, rows, groups, rowKey, onRowPress, rowLabel, label, empty, className }: DataTableProps<R>): React.JSX.Element;
|
|
97
|
+
export declare function DataTable<R>({ columns, rows, groups, rowKey, onRowPress, canPressRow, rowLabel, label, empty, wrapHeaders, className }: DataTableProps<R>): React.JSX.Element;
|
|
83
98
|
export declare namespace DataTable {
|
|
84
99
|
var displayName: string;
|
|
85
100
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Meter: how full something is (memory, disk, seats, a quota), as a label and its figure over a thin track. Flat:
|
|
3
|
-
* no border, no coloured text. The fill is neutral until it reaches the optional limit, then the
|
|
4
|
-
* destructive (state as a full fill, never by text colour).
|
|
3
|
+
* no border, no coloured text. The fill is neutral (or the `tone` given) until it reaches the optional limit, then the
|
|
4
|
+
* whole fill turns destructive (state as a full fill, never by text colour).
|
|
5
5
|
*/
|
|
6
6
|
import type { ReactNode } from 'react';
|
|
7
7
|
import { type Words } from '../../words/types';
|
|
8
|
+
import type { Tone } from '../list/Row';
|
|
8
9
|
type Text = Words | string;
|
|
10
|
+
/** The fill colour of a Meter: neutral grey by default, or one of the toolkit's tones (the same tones Badge and Row labels take). */
|
|
11
|
+
export type MeterTone = Tone;
|
|
9
12
|
export interface MeterProps {
|
|
10
13
|
/** What is measured ("Memory"); also the meter's accessible name. */
|
|
11
14
|
label: Text;
|
|
@@ -26,13 +29,19 @@ export interface MeterProps {
|
|
|
26
29
|
limitLabel?: Text;
|
|
27
30
|
/** A muted line under the track on the left ("4 apps running"). */
|
|
28
31
|
hint?: Text;
|
|
32
|
+
/**
|
|
33
|
+
* The fill's colour, from the toolkit tones (the Badge ones): `success` for a goal met, `warning` for a goal near,
|
|
34
|
+
* `info` for one category among several. Default 'default', the neutral grey. A reached `limit` still turns it
|
|
35
|
+
* destructive.
|
|
36
|
+
*/
|
|
37
|
+
tone?: MeterTone;
|
|
29
38
|
className?: string;
|
|
30
39
|
}
|
|
31
40
|
/**
|
|
32
41
|
* A label and its figure ("Memory 8.2 / 36") over a 6px rounded track with a neutral fill. With `limit`, a tick
|
|
33
42
|
* marks it and the fill turns destructive once the value reaches it (`data-over`). role="meter", named by the label.
|
|
34
43
|
*/
|
|
35
|
-
export declare function Meter({ label, value, max, valueText, limit, limitLabel, hint, className }: MeterProps): import("react").JSX.Element;
|
|
44
|
+
export declare function Meter({ label, value, max, valueText, limit, limitLabel, hint, tone, className }: MeterProps): import("react").JSX.Element;
|
|
36
45
|
export declare namespace Meter {
|
|
37
46
|
var displayName: string;
|
|
38
47
|
}
|
|
@@ -78,6 +78,12 @@ export interface TabsProps<V extends string> {
|
|
|
78
78
|
children?: ReactNode;
|
|
79
79
|
/** Stable prefix for tab and panel ids. Default a generated one. */
|
|
80
80
|
id?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The tabs that do not fit wrap onto a next line instead of scrolling sideways (a phone page with five or six
|
|
83
|
+
* sections, every tab in sight). Default false: one line that scrolls. For a row over a list, TabRow folds the rest
|
|
84
|
+
* into a More menu instead.
|
|
85
|
+
*/
|
|
86
|
+
wrap?: boolean;
|
|
81
87
|
className?: string;
|
|
82
88
|
panelClassName?: string;
|
|
83
89
|
}
|
|
@@ -128,7 +134,7 @@ export declare function tabPanelProps(prefix: string, value: string): {
|
|
|
128
134
|
/** The next enabled tab from `from` in `direction`, wrapping round. Null when no other tab is enabled. */
|
|
129
135
|
export declare function stepTab<V extends string>(tabs: readonly TabItem<V>[], from: V, direction: 1 | -1): V | null;
|
|
130
136
|
/** A strip of view pills whose choice switches the content below it, with its panel when `children` is given. */
|
|
131
|
-
export declare function Tabs<V extends string>({ tabs, value, onChange, label, keys, activation, children, id, className, panelClassName, }: TabsProps<V>): import("react").JSX.Element;
|
|
137
|
+
export declare function Tabs<V extends string>({ tabs, value, onChange, label, keys, activation, children, id, wrap, className, panelClassName, }: TabsProps<V>): import("react").JSX.Element;
|
|
132
138
|
/**
|
|
133
139
|
* The 44px row of pills over a list or a page (TLB1, TLB2). Role 'tabs' switches the content below (tablist), role
|
|
134
140
|
* 'filter' narrows one list (radiogroup); one look for both. It never wraps or scrolls: the pills its row has no room
|
|
@@ -3,7 +3,7 @@ export type { BadgeProps, ButtonProps, ButtonSize, ButtonVariant, EmptyStateProp
|
|
|
3
3
|
export { TABROW_WORDS, TABS_WORDS, TabRow, Tabs, stepTab, tabIds, tabPanelProps } from './Tabs';
|
|
4
4
|
export type { TabItem, TabRowItem, TabRowProps, TabsProps } from './Tabs';
|
|
5
5
|
export { Meter } from './Meter';
|
|
6
|
-
export type { MeterProps } from './Meter';
|
|
6
|
+
export type { MeterProps, MeterTone } from './Meter';
|
|
7
7
|
export { DataTable } from './DataTable';
|
|
8
8
|
export type { DataTableColumn, DataTableGroup, DataTableProps } from './DataTable';
|
|
9
9
|
export { INFOTIP_WORDS, InfoTip } from './InfoTip';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CalendarHeatmap: one small cell per day, coloured by its value, weeks as columns and the seven weekdays as rows,
|
|
3
|
+
* month names on top and Mon, Wed, Fri on the left (a GitHub-style contribution grid). It fits its container: cells
|
|
4
|
+
* shrink to 10px, then the grid scrolls sideways inside itself with the latest week in view.
|
|
5
|
+
*
|
|
6
|
+
* A grid (role="grid"): the arrows move a day (up and down) or a week (left and right), Home and End go to the first
|
|
7
|
+
* and last day, and each cell says its value and day ("3 on Mon, Jun 15", with the year for a day of another year
|
|
8
|
+
* than today's), the same words as its tooltip. With `onSelect` the cells are buttons. The days with data also go to a hidden
|
|
9
|
+
* data table (RenderChartData) for view Markdown.
|
|
10
|
+
*/
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import { type Locale, type Words } from '../../words/types';
|
|
13
|
+
import type { Tone } from '../list/Row';
|
|
14
|
+
import { type HeatmapDay } from './heatmapData';
|
|
15
|
+
/** The day a cell stands for, given to `onSelect`. */
|
|
16
|
+
export type CalendarHeatmapDay = HeatmapDay;
|
|
17
|
+
export interface CalendarHeatmapProps {
|
|
18
|
+
/** One row per dated value (or per entry with `valueKey={null}`). Rows on the same day add up. */
|
|
19
|
+
data: readonly object[];
|
|
20
|
+
/** Field with the row's day: a Date, an ISO day ("2026-06-15"), an ISO time or a timestamp. Default `date`. */
|
|
21
|
+
dateKey?: string;
|
|
22
|
+
/** Field with the row's number. Default `value`. Null counts the rows instead (each dated row is 1). */
|
|
23
|
+
valueKey?: string | null;
|
|
24
|
+
/** First day drawn. Default the first of the month eleven months before `to` (the "Last 12 months" period). */
|
|
25
|
+
from?: Date | string | number;
|
|
26
|
+
/** Last day drawn. Default today. Days after it are not drawn. */
|
|
27
|
+
to?: Date | string | number;
|
|
28
|
+
/** A fixed clock for "today". */
|
|
29
|
+
today?: Date;
|
|
30
|
+
/**
|
|
31
|
+
* The colour of a sequential scale: the first chart colour by default, or a toolkit tone (`success` for a goal kept,
|
|
32
|
+
* `warning`, `danger`, `info`). Ignored by a diverging scale.
|
|
33
|
+
*/
|
|
34
|
+
tone?: Tone;
|
|
35
|
+
/**
|
|
36
|
+
* `sequential` (default): from no colour to full colour as values grow. `diverging`: good to bad data around a
|
|
37
|
+
* `midpoint` (a mood, a balance), success colours above it and danger colours below (swapped with
|
|
38
|
+
* `higherIsBetter={false}`).
|
|
39
|
+
*/
|
|
40
|
+
scale?: 'sequential' | 'diverging';
|
|
41
|
+
/** The diverging scale's neutral value. Default the middle of `domain`, else 0. */
|
|
42
|
+
midpoint?: number;
|
|
43
|
+
/** Diverging only: false when lower is better (above the midpoint draws in danger colours). Default true. */
|
|
44
|
+
higherIsBetter?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A fixed value scale `[min, max]` (a mood from 1 to 5) instead of one that fits the data. With it every value takes
|
|
47
|
+
* a colour, the minimum included; without it a value at or below zero draws empty.
|
|
48
|
+
*/
|
|
49
|
+
domain?: readonly [number, number];
|
|
50
|
+
/** Colour steps, the empty one included. Default 5 (2 to 9). */
|
|
51
|
+
levels?: number;
|
|
52
|
+
/** The value in the cell names, tooltips and data table. Default whole numbers (one decimal under 10). */
|
|
53
|
+
format?: (value: number, locale: Locale) => string;
|
|
54
|
+
/** Makes the cells buttons: a press, Enter or Space gives that day. */
|
|
55
|
+
onSelect?: (day: CalendarHeatmapDay) => void;
|
|
56
|
+
/** Accessible name of the grid and title of its data table. Default "Activity by day". */
|
|
57
|
+
title?: Words | string;
|
|
58
|
+
/** The Less ... More colour key under the grid. Default true. */
|
|
59
|
+
legend?: boolean;
|
|
60
|
+
/** The first day of a week column, 0 Sunday to 6 Saturday. Default 1, Monday. */
|
|
61
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
62
|
+
locale?: Locale;
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
/** A GitHub-style grid of days coloured by value, with a tooltip and a spoken name per day and a hidden data table. */
|
|
66
|
+
export declare function CalendarHeatmap({ data, dateKey: dateField, valueKey, from, to, today: todayProp, tone, scale: scaleKind, midpoint, higherIsBetter, domain, levels, format: formatProp, onSelect, title, legend, weekStartsOn, locale: localeProp, className, }: CalendarHeatmapProps): React.JSX.Element;
|
|
67
|
+
export declare namespace CalendarHeatmap {
|
|
68
|
+
var displayName: string;
|
|
69
|
+
}
|
|
@@ -143,7 +143,10 @@ export interface ChartSeries {
|
|
|
143
143
|
/** Field of each row holding the value. */
|
|
144
144
|
key: string;
|
|
145
145
|
label: Words | string;
|
|
146
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Any CSS colour. Default the chart tokens in order (`--chart-1` to `--chart-5`, then again), so a sixth series
|
|
148
|
+
* needs its own colour here, such as `hsl(var(--chart-1) / .5)`.
|
|
149
|
+
*/
|
|
147
150
|
color?: string;
|
|
148
151
|
}
|
|
149
152
|
export interface ChartProps {
|
|
@@ -187,7 +190,8 @@ export interface ChartProps {
|
|
|
187
190
|
labelFormat?: (value: number, locale: Locale) => string;
|
|
188
191
|
/**
|
|
189
192
|
* A fixed value scale `[min, max]`, such as `[0, 100]` for percentages, instead of one that fits the data. Values
|
|
190
|
-
* outside it are clipped. Vertical charts only.
|
|
193
|
+
* outside it are clipped. Vertical charts only. Without it, a vertical chart with values under zero reaches below
|
|
194
|
+
* zero too (diverging bars: a balance, a net change), with a line at zero.
|
|
191
195
|
*/
|
|
192
196
|
domain?: readonly [number, number];
|
|
193
197
|
/**
|
|
@@ -200,6 +204,17 @@ export interface ChartProps {
|
|
|
200
204
|
* hovered (deck period-r6). Default: true when the last row's `to` is today.
|
|
201
205
|
*/
|
|
202
206
|
live?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* One series of bars: the bars that are not the live one or the hovered one draw lighter (default true). False
|
|
209
|
+
* draws every bar full colour, for bars that each stand alone (months of a budget, stages of a funnel).
|
|
210
|
+
*/
|
|
211
|
+
dim?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* The colour of one bar, for bars of a series that differ by what their row is (a stage, a category, over or under a
|
|
214
|
+
* budget): any CSS colour, or undefined for the series colour. Called with the row, the series and the row's index.
|
|
215
|
+
* The legend keeps the series colours, so say what the colours mean in the section or the axis labels.
|
|
216
|
+
*/
|
|
217
|
+
barColor?: (row: object, series: ChartSeries, index: number) => string | undefined;
|
|
203
218
|
locale?: Locale;
|
|
204
219
|
className?: string;
|
|
205
220
|
}
|
|
@@ -208,7 +223,7 @@ export declare function seriesColor(series: ChartSeries, index: number): string;
|
|
|
208
223
|
/** The hidden table of a chart: one row per point, the point name then each series value. */
|
|
209
224
|
export declare function chartTableRows(data: readonly object[], series: readonly ChartSeries[], compare: ChartSeries | null, nameOf: (row: object) => string, format: (value: number) => string): Array<Array<string | null>>;
|
|
210
225
|
/** A period chart (bars, a line or an area) with an optional dashed comparison; 140px bars or a 200px plot by default. */
|
|
211
|
-
export declare function Chart({ kind, data, series: seriesProp, compare: compareProp, xKey: xKeyProp, labelKey, nameKey: nameKeyProp, title, height: heightProp, stacked, horizontal: horizontalProp, format: formatProp, labelFormat: labelFormatProp, domain: domainProp, valueAxis: valueAxisProp, live: liveProp, locale: localeProp, className, }: ChartProps): React.JSX.Element;
|
|
226
|
+
export declare function Chart({ kind, data, series: seriesProp, compare: compareProp, xKey: xKeyProp, labelKey, nameKey: nameKeyProp, title, height: heightProp, stacked, horizontal: horizontalProp, format: formatProp, labelFormat: labelFormatProp, domain: domainProp, valueAxis: valueAxisProp, live: liveProp, dim, barColor, locale: localeProp, className, }: ChartProps): React.JSX.Element;
|
|
212
227
|
export declare namespace Chart {
|
|
213
228
|
var displayName: string;
|
|
214
229
|
}
|
|
@@ -28,6 +28,11 @@ export interface PeriodChartRow {
|
|
|
28
28
|
value: number;
|
|
29
29
|
compare: number | null;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* The bin of a range: hours for a day, days up to a month, weeks up to about six months, then months. A range
|
|
33
|
+
* that starts on the 1st and spans six calendar months or more (last 6 months, a year to date from June) is
|
|
34
|
+
* binned by month, so each bar is a whole month (and Compare previous moves back by whole months).
|
|
35
|
+
*/
|
|
31
36
|
export declare function binUnit(range: DateRange): BinUnit;
|
|
32
37
|
/** The bins of a range. Weeks step seven days from the first day; the last week and month stop at the range end. */
|
|
33
38
|
export declare function buildBins(range: DateRange, unit?: BinUnit): Bin[];
|
|
@@ -70,6 +75,10 @@ export declare function showAxisLabel(index: number, count: number, spacing?: nu
|
|
|
70
75
|
export declare function edgeAnchor(x: number, left: number, right: number): 'start' | 'middle' | 'end';
|
|
71
76
|
/** Top of the value axis: 10% above the highest value (this period or the comparison), never below 1. */
|
|
72
77
|
export declare function chartMax(values: ReadonlyArray<number | null | undefined>): number;
|
|
78
|
+
/**
|
|
79
|
+
* Bottom of the value axis: 0 when no value is under zero, else 10% under the lowest one (diverging bars, a balance).
|
|
80
|
+
*/
|
|
81
|
+
export declare function chartMin(values: ReadonlyArray<number | null | undefined>): number;
|
|
73
82
|
/**
|
|
74
83
|
* The top of a value axis drawn in quarters, raised from `max` so every quarter is a round number (110 gives 120:
|
|
75
84
|
* 30, 60, 90, 120), never 27.5. With `integers` (counts) each quarter is a whole number too: 1.1 gives 4, never 1.2.
|
|
@@ -88,3 +97,13 @@ export declare function sparkPaths(values: readonly (number | null | undefined)[
|
|
|
88
97
|
line: string;
|
|
89
98
|
area: string;
|
|
90
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* The scale of values on both sides of zero: one round step for both sides, so zero sits on a gridline and the
|
|
102
|
+
* labels stay evenly spaced however lopsided the values are (-3 and 1000 give -250 to 1000 in steps of 250).
|
|
103
|
+
* `min` is under zero; `max` at or under zero ends the scale at zero. At most six steps: the step doubles past that.
|
|
104
|
+
*/
|
|
105
|
+
export declare function divergingScale(min: number, max: number, integers?: boolean): {
|
|
106
|
+
low: number;
|
|
107
|
+
high: number;
|
|
108
|
+
ticks: number[];
|
|
109
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar heatmap math (CalendarHeatmap): the days of a range bucketed into week columns, the values summed per day,
|
|
3
|
+
* and each value's colour level. Pure: date-fns and Intl only, no React. Days are keyed by their local ISO day
|
|
4
|
+
* (`2026-06-15`), built with calendar arithmetic, so a daylight saving change never skips or repeats a day.
|
|
5
|
+
*/
|
|
6
|
+
import type { Locale } from '../../words/types';
|
|
7
|
+
import { type DateInput } from '../calendar/calendarMath';
|
|
8
|
+
/** One day of the heatmap: its value (the sum of its rows), or null when no row falls on it. */
|
|
9
|
+
export interface HeatmapDay {
|
|
10
|
+
date: Date;
|
|
11
|
+
/** The local ISO day, `2026-06-15`. */
|
|
12
|
+
key: string;
|
|
13
|
+
value: number | null;
|
|
14
|
+
/** The data rows of that day, in data order. */
|
|
15
|
+
rows: readonly object[];
|
|
16
|
+
}
|
|
17
|
+
/** One week column: seven slots from the week's first day; a slot outside the range is null (not drawn). */
|
|
18
|
+
export interface HeatmapWeek {
|
|
19
|
+
start: Date;
|
|
20
|
+
days: readonly (HeatmapDay | null)[];
|
|
21
|
+
}
|
|
22
|
+
export interface HeatmapRange {
|
|
23
|
+
from: Date;
|
|
24
|
+
to: Date;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The days a heatmap covers: `to` defaults to today, `from` to the first of the month eleven months before `to` (the
|
|
28
|
+
* toolkit's "Last 12 months"). Swapped when given backwards.
|
|
29
|
+
*/
|
|
30
|
+
export declare function heatmapRange(from: DateInput, to: DateInput, today: Date): HeatmapRange;
|
|
31
|
+
/**
|
|
32
|
+
* Sums the rows per local day. A row counts when its `dateKey` field is a day (a Date, an ISO day or time, a
|
|
33
|
+
* timestamp) and its `valueKey` field a finite number (or a string reading as one); with `valueKey` null every dated row counts 1, so a list of
|
|
34
|
+
* entries gives how many fell on each day.
|
|
35
|
+
*/
|
|
36
|
+
export declare function bucketDays(data: readonly object[], dateKey: string, valueKey: string | null): Map<string, {
|
|
37
|
+
value: number;
|
|
38
|
+
rows: object[];
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* The week columns of a range: each starts on `weekStartsOn` (0 Sunday to 6 Saturday; Monday by default) and holds
|
|
42
|
+
* seven slots. Days before `from` and after `to` are null.
|
|
43
|
+
*/
|
|
44
|
+
export declare function heatmapWeeks(range: HeatmapRange, byDay: ReadonlyMap<string, {
|
|
45
|
+
value: number;
|
|
46
|
+
rows: readonly object[];
|
|
47
|
+
}>, weekStartsOn?: number): HeatmapWeek[];
|
|
48
|
+
export type HeatmapScaleKind = 'sequential' | 'diverging';
|
|
49
|
+
export interface HeatmapScale {
|
|
50
|
+
kind: HeatmapScaleKind;
|
|
51
|
+
/** Colour steps, the empty one included (2 to 9). */
|
|
52
|
+
levels: number;
|
|
53
|
+
lo: number;
|
|
54
|
+
hi: number;
|
|
55
|
+
mid: number;
|
|
56
|
+
/** A `domain` was given: every value is placed on it, zero and below included. */
|
|
57
|
+
fixed: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface HeatmapScaleOptions {
|
|
60
|
+
kind?: HeatmapScaleKind;
|
|
61
|
+
levels?: number;
|
|
62
|
+
domain?: readonly [number, number];
|
|
63
|
+
midpoint?: number;
|
|
64
|
+
}
|
|
65
|
+
/** The scale of a set of values: by default from 0 to the largest value (sequential) or around 0 (diverging). */
|
|
66
|
+
export declare function heatmapScale(values: readonly number[], options?: HeatmapScaleOptions): HeatmapScale;
|
|
67
|
+
/**
|
|
68
|
+
* The colour level of a value. Sequential: 0 (the empty colour) to `levels - 1`; a value at or below zero is 0 unless a
|
|
69
|
+
* domain is fixed, the largest value is the top level, and equal values all take it. Diverging: from `-(levels - 1)`
|
|
70
|
+
* (furthest below the midpoint) to `levels - 1` (furthest above), 0 at the midpoint. No value (null) is 0.
|
|
71
|
+
*/
|
|
72
|
+
export declare function heatmapLevel(value: number | null, scale: HeatmapScale): number;
|
|
73
|
+
/** The fill opacity of a level: a quarter for the first step up to full for the top one. */
|
|
74
|
+
export declare function heatmapAlpha(level: number, levels: number): number;
|
|
75
|
+
/** The month labels over the columns: a label where the first drawn day of a column starts a new month. */
|
|
76
|
+
export declare function heatmapMonths(weeks: readonly HeatmapWeek[]): Array<{
|
|
77
|
+
column: number;
|
|
78
|
+
month: Date;
|
|
79
|
+
}>;
|
|
80
|
+
/** A day as a cell names it: "Mon, Jun 15" / "lun. 15 juin" (French writes the first "1er"), with the year when asked. */
|
|
81
|
+
export declare function heatmapDayLabel(date: Date, locale: Locale, withYear?: boolean): string;
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The comment pane and its pieces, rendered from a `useComments` controller:
|
|
3
3
|
*
|
|
4
|
-
* - `CommentPane`: the
|
|
5
|
-
*
|
|
4
|
+
* - `CommentPane`: the comments of the view in the host Comments panel beside the chat (the filter menu with Open, Done
|
|
5
|
+
* and All, the New comment button listing the Space's modes, Copy changes, the new comment box with its To chip, the
|
|
6
|
+
* thread cards and the Undo toast). It draws nothing inside the Space, and nothing at all while the host shows no
|
|
7
|
+
* comments (`hostComments`). Threads come flat, newest first; on the Space home (no scope) they group by page. Pass
|
|
8
|
+
* `order` and `groupBy` to list them your way.
|
|
6
9
|
* - `CommentPins`: the numbered pins and zones on the anchor element. Put it inside the element the comments sit on (a
|
|
7
10
|
* slide, a section) and give that element `position: relative`. With `controller.commenting` on it covers the element:
|
|
8
11
|
* a click drops a pin, a press and drag marks a zone (when the table has zone columns). The pane's "Comment on this
|
|
9
12
|
* item" starts a comment on the whole anchor, with no pin.
|
|
13
|
+
* - `CommentToolBar`: the comment tool bar on the page, one button per mode, toggled with C (SPC-118).
|
|
10
14
|
* - `CommentThreadCard`, `NewCommentBox` and `CommentAvatar` for Spaces that lay the pane out themselves.
|
|
11
15
|
*
|
|
16
|
+
* A card archives (E) and unarchives (Shift+E) with an Undo toast (Z), edits your own comments in place and deletes at
|
|
17
|
+
* once with Undo, as the viewer's rights allow. At its top, "Thread <title>" names the thread that owns it (or "Goes to"
|
|
18
|
+
* the thread a reply would go to). Each signature names who wrote the comment; an agent's carries its harness logo, with
|
|
19
|
+
* what it ran on in a hover card (`CommentAgentBadge`). A band name reads "Fred And The Machine" (`agentDisplayName`).
|
|
20
|
+
*
|
|
12
21
|
* Files: with an Attachments files column and a host that uploads (`runtime.spaceFiles`), a new comment and a reply take
|
|
13
22
|
* pictures and files: paste, drop on the box or the paperclip (`commentFiles`). Otherwise the boxes take text only.
|
|
14
23
|
*
|
|
15
24
|
* Keyboard: Enter sends a reply or a new comment and Shift+Enter adds a line; Escape in an empty new comment drops it
|
|
16
|
-
* (with text, the first Escape leaves the field); Escape leaves
|
|
25
|
+
* (with text, the first Escape leaves the field); Escape leaves a comment mode; a thread card selects with Enter; with
|
|
26
|
+
* focus in the pane, E archives the focused thread and Shift+E unarchives it.
|
|
17
27
|
*/
|
|
18
28
|
import React, { type KeyboardEvent as ReactKeyboardEvent } from 'react';
|
|
29
|
+
import type { KeySpec } from '../../words';
|
|
19
30
|
import { type CommentRecord, type CommentThread } from './commentModel';
|
|
31
|
+
import { type CommentListOptions } from './paneParts';
|
|
20
32
|
import type { CommentController } from './useComments';
|
|
21
33
|
export interface CommentAvatarProps {
|
|
22
34
|
author: string;
|
|
@@ -25,8 +37,9 @@ export interface CommentAvatarProps {
|
|
|
25
37
|
className?: string;
|
|
26
38
|
}
|
|
27
39
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
40
|
+
* "From {name}", a link to the agent's thread for the person whose agent it is: the source of a comment an agent wrote,
|
|
41
|
+
* for a Space that lays its cards out itself. The pane's cards no longer show it: the thread that owns a comment thread
|
|
42
|
+
* is named once at its top, and each signature names only who wrote.
|
|
30
43
|
*/
|
|
31
44
|
export declare function CommentAgentSource({ controller, comment }: {
|
|
32
45
|
controller: CommentController;
|
|
@@ -34,6 +47,8 @@ export declare function CommentAgentSource({ controller, comment }: {
|
|
|
34
47
|
}): React.JSX.Element | null;
|
|
35
48
|
/** The author's initial. Decorative: the author's name is always written next to it. */
|
|
36
49
|
export declare function CommentAvatar({ author, me, className }: CommentAvatarProps): React.JSX.Element;
|
|
50
|
+
/** The start of a comment's text for a button's name: about 40 characters, cut at a word. */
|
|
51
|
+
export declare function commentExcerpt(comment: Pick<CommentRecord, 'body' | 'attachments'>): string;
|
|
37
52
|
/** Enter sends a comment; Shift+Enter, and Enter while composing an accented letter, add to the text. */
|
|
38
53
|
export declare function sendsOnEnter(event: ReactKeyboardEvent<HTMLTextAreaElement>): boolean;
|
|
39
54
|
export interface CommentThreadCardProps {
|
|
@@ -46,21 +61,52 @@ export declare function CommentThreadCard({ controller, thread, showAnchor }: Co
|
|
|
46
61
|
export interface NewCommentBoxProps {
|
|
47
62
|
controller: CommentController;
|
|
48
63
|
}
|
|
49
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* The box for the comment `controller.draftPin` started. Takes focus when it opens. Its To chip names the thread the
|
|
66
|
+
* comment goes to (the best match, or the one picked with the chip or by typing @ first).
|
|
67
|
+
*/
|
|
50
68
|
export declare function NewCommentBox({ controller }: NewCommentBoxProps): React.JSX.Element | null;
|
|
51
69
|
export interface CommentPinsProps {
|
|
52
70
|
controller: CommentController;
|
|
53
71
|
/** The anchor the pins sit on. Default: `controller.anchorKey`. */
|
|
54
72
|
anchorKey?: string | null;
|
|
55
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* A pin was pressed. Default: `controller.revealThread` (the thread is selected and the host shows its Comments
|
|
75
|
+
* panel). A Space that handles it calls `controller.revealThread` itself to keep that.
|
|
76
|
+
*/
|
|
56
77
|
onOpen?(thread: CommentThread): void;
|
|
57
78
|
}
|
|
58
79
|
/**
|
|
59
80
|
* Numbered pins at each thread's x and y on the anchor element, the zones threads mark, and the pin or zone of the
|
|
60
81
|
* comment being written. In Add comment mode it also covers the element to take the click or drag that places one.
|
|
61
82
|
*/
|
|
62
|
-
export declare function CommentPins(
|
|
63
|
-
export interface
|
|
83
|
+
export declare function CommentPins(props: CommentPinsProps): React.JSX.Element | null;
|
|
84
|
+
export interface CommentToolBarProps {
|
|
85
|
+
controller: CommentController;
|
|
86
|
+
/**
|
|
87
|
+
* The key that shows and hides the tool bar. Default 'c' (SPC-118), registered as a Notis key while the tool bar is
|
|
88
|
+
* mounted, so it wins over Notis's own C (new chat) on this page. False: no key, the Space toggles
|
|
89
|
+
* `controller.setToolBar` itself.
|
|
90
|
+
*/
|
|
91
|
+
toggleKey?: KeySpec | false;
|
|
92
|
+
/** Always show the bar (it then has no close button). Default: shown while `controller.toolBar` is on. */
|
|
93
|
+
pinned?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* 'overlay' (default): the bar floats over the top left of its positioned parent (the page card), with an inset, and
|
|
96
|
+
* never moves the content below it. At phone width (480 px or less) it sits just above the card instead, and the
|
|
97
|
+
* card moves down by the bar's height to make that room, so it never covers the card or its pins. 'inline': it sits
|
|
98
|
+
* in the flow where the Space puts it.
|
|
99
|
+
*/
|
|
100
|
+
place?: 'overlay' | 'inline';
|
|
101
|
+
className?: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The comment tool bar on the page (SPC-118): one button per mode the Space offers (`controller.modes`). A mode shows
|
|
105
|
+
* "Point at something to comment" (or its own hint) until you point; Escape cancels. C shows and hides it. Put it where
|
|
106
|
+
* the Space wants it on the page; it draws nothing while the host shows no comments.
|
|
107
|
+
*/
|
|
108
|
+
export declare function CommentToolBar(props: CommentToolBarProps): React.JSX.Element | null;
|
|
109
|
+
export interface CommentPaneProps extends CommentListOptions {
|
|
64
110
|
controller: CommentController;
|
|
65
111
|
/** The heading. Default "Comments". */
|
|
66
112
|
title?: string;
|
|
@@ -68,4 +114,4 @@ export interface CommentPaneProps {
|
|
|
68
114
|
showCopy?: boolean;
|
|
69
115
|
className?: string;
|
|
70
116
|
}
|
|
71
|
-
export declare
|
|
117
|
+
export declare const CommentPane: (props: CommentPaneProps) => React.ReactPortal | null;
|
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
* - `CommentableRichText`: around rich text (the Markdown editor, or rendered Markdown). It highlights every thread's
|
|
7
7
|
* passage, follows the text as it is edited and laid out, offers Comment on a selection, and a click on a highlight
|
|
8
8
|
* opens its thread.
|
|
9
|
-
* - `PassageCommentPane`: the standard comment pane for these threads: each card shows its field and quote (
|
|
10
|
-
* changed when the words are gone
|
|
11
|
-
*
|
|
9
|
+
* - `PassageCommentPane`: the standard comment pane for these threads: each card shows its field and quote (Passage
|
|
10
|
+
* changed, with the old quote, when the words are gone; the thread stays open), the filter menu (Open, Done, All),
|
|
11
|
+
* the New comment button (on words, on the whole page), the new comment box with its To chip, replies, Archive,
|
|
12
|
+
* Edit and Delete with Undo. Threads come newest first; `order="reading"` lists them in reading order instead. It
|
|
13
|
+
* draws in the host Comments panel beside the chat, never inside the Space (`hostComments`).
|
|
12
14
|
*/
|
|
13
15
|
import React, { type ReactNode } from 'react';
|
|
14
16
|
import { type Words } from '../../words';
|
|
17
|
+
import type { CommentOrder } from './commentModel';
|
|
18
|
+
import { type CommentListOptions } from './paneParts';
|
|
15
19
|
import type { PassageCommentController } from './usePassageComments';
|
|
16
20
|
export interface CommentableTextProps {
|
|
17
21
|
comments: PassageCommentController;
|
|
@@ -23,7 +27,7 @@ export interface CommentableTextProps {
|
|
|
23
27
|
children: ReactNode;
|
|
24
28
|
className?: string;
|
|
25
29
|
}
|
|
26
|
-
export declare function CommentableText(
|
|
30
|
+
export declare function CommentableText(props: CommentableTextProps): React.JSX.Element;
|
|
27
31
|
export interface CommentableRichTextProps {
|
|
28
32
|
comments: PassageCommentController;
|
|
29
33
|
/** The field's key, as declared in `fields`. */
|
|
@@ -32,9 +36,14 @@ export interface CommentableRichTextProps {
|
|
|
32
36
|
children: ReactNode;
|
|
33
37
|
className?: string;
|
|
34
38
|
}
|
|
35
|
-
export declare function CommentableRichText(
|
|
36
|
-
export interface PassageCommentPaneProps {
|
|
39
|
+
export declare function CommentableRichText(props: CommentableRichTextProps): React.JSX.Element;
|
|
40
|
+
export interface PassageCommentPaneProps extends Omit<CommentListOptions, 'order'> {
|
|
37
41
|
comments: PassageCommentController;
|
|
42
|
+
/**
|
|
43
|
+
* The order of the threads. Default 'newest' (SPC-116). 'reading' keeps reading order (open threads first, each in
|
|
44
|
+
* the order of the fields and their words), as panes beside a document often want.
|
|
45
|
+
*/
|
|
46
|
+
order?: CommentOrder | 'reading';
|
|
38
47
|
/** Closes the pane: shows a close button in its heading. */
|
|
39
48
|
onClose?(): void;
|
|
40
49
|
/** The heading. Default "Comments". */
|
|
@@ -47,4 +56,4 @@ export interface PassageCommentPaneProps {
|
|
|
47
56
|
onGroup?(group: string): void;
|
|
48
57
|
className?: string;
|
|
49
58
|
}
|
|
50
|
-
export declare
|
|
59
|
+
export declare const PassageCommentPane: (props: PassageCommentPaneProps) => React.ReactPortal | null;
|