@notis_ai/cli 0.2.25 → 0.2.27
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 +186 -5
- package/config/notis_app_design_rules.json +36 -14
- package/config/portal-route-roots.json +1 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +2866 -553
- package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-cli/references/intelligence.md +1 -1
- package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-query/SKILL.md +0 -1
- package/dist/base-skills/notis-query/references/documents.md +7 -0
- package/dist/base-skills/notis-query/references/query.md +1 -0
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/SKILL.md +96 -24
- package/dist/base-skills/notis-spaces/references/architecture.md +4 -3
- package/dist/base-skills/notis-spaces/references/context.md +3 -0
- package/dist/base-skills/notis-spaces/references/design.md +37 -18
- package/dist/base-skills/notis-spaces/references/reading.md +8 -1
- package/dist/base-skills/notis-spaces/references/reports.md +6 -6
- package/dist/base-skills/notis-spaces/references/sdk.md +71 -7
- package/dist/base-skills/notis-spaces/references/store.md +22 -13
- package/dist/base-skills/notis-spaces/references/views.md +99 -6
- package/dist/sdk/package.json +3 -0
- package/dist/sdk/src/cloudComputerWords.ts +53 -0
- package/dist/sdk/src/components/Audience.tsx +76 -0
- package/dist/sdk/src/components/DocumentPage.tsx +15 -4
- package/dist/sdk/src/components/MarkdownEditor.tsx +44 -14
- package/dist/sdk/src/components/MultiSelectActionBar.tsx +16 -5
- package/dist/sdk/src/components/NotisSelectionBoundary.tsx +79 -25
- package/dist/sdk/src/components/Skeleton.tsx +162 -6
- package/dist/sdk/src/hooks/useAction.ts +12 -2
- package/dist/sdk/src/hooks/useAgentQueue.ts +125 -0
- package/dist/sdk/src/hooks/useCloudComputerJob.ts +142 -0
- package/dist/sdk/src/hooks/useCloudComputerService.ts +388 -0
- package/dist/sdk/src/hooks/useCloudComputerShell.ts +95 -7
- package/dist/sdk/src/hooks/useCollectionInteractions.ts +40 -2
- package/dist/sdk/src/hooks/useItemThread.ts +58 -0
- package/dist/sdk/src/hooks/useMarqueeSelection.ts +6 -1
- package/dist/sdk/src/hooks/useNativeDocuments.ts +61 -8
- package/dist/sdk/src/hooks/useNotisNavigation.ts +31 -8
- package/dist/sdk/src/hooks/useQuery.ts +67 -10
- package/dist/sdk/src/hooks/useViewParams.ts +47 -11
- package/dist/sdk/src/index.ts +31 -4
- package/dist/sdk/src/interactions.ts +2 -0
- package/dist/sdk/src/nativeData.ts +2 -0
- package/dist/sdk/src/optimisticRows.ts +329 -0
- package/dist/sdk/src/perf.ts +188 -0
- package/dist/sdk/src/provider.tsx +2 -1
- package/dist/sdk/src/queryCache.ts +366 -17
- package/dist/sdk/src/runtime.ts +55 -4
- package/dist/sdk/src/skeleton.ts +103 -0
- package/dist/sdk/src/space.ts +662 -28
- package/dist/sdk/src/spacePublicUI.ts +36 -0
- package/dist/sdk/src/ui/engine/step.ts +54 -0
- package/dist/sdk/src/ui/icons.tsx +3 -1
- package/dist/sdk/src/words/shell.ts +1 -0
- package/dist/skill-sync/index.js +88 -13
- package/dist/skill-sync-worker.mjs +127 -38
- package/dist/space-harness/host.js +272 -105
- package/dist/space-sdk/dist/chunk-BWHAORT4.js +5 -0
- package/dist/space-sdk/dist/index.js +9 -4
- package/dist/space-sdk/dist/ui.js +12 -12
- package/dist/space-sdk/package.json +3 -0
- package/dist/space-sdk/src/cloudComputerWords.d.ts +34 -0
- package/dist/space-sdk/src/components/Audience.d.ts +46 -0
- package/dist/space-sdk/src/components/DocumentPage.d.ts +3 -1
- package/dist/space-sdk/src/components/MarkdownEditor.d.ts +21 -0
- package/dist/space-sdk/src/components/MultiSelectActionBar.d.ts +5 -1
- package/dist/space-sdk/src/components/NotisSelectionBoundary.d.ts +19 -2
- package/dist/space-sdk/src/components/Skeleton.d.ts +7 -2
- package/dist/space-sdk/src/hooks/useAction.d.ts +8 -1
- package/dist/space-sdk/src/hooks/useAgentQueue.d.ts +61 -0
- package/dist/space-sdk/src/hooks/useCloudComputerJob.d.ts +35 -0
- package/dist/space-sdk/src/hooks/useCloudComputerService.d.ts +75 -0
- package/dist/space-sdk/src/hooks/useCloudComputerShell.d.ts +36 -3
- package/dist/space-sdk/src/hooks/useCollectionInteractions.d.ts +6 -0
- package/dist/space-sdk/src/hooks/useItemThread.d.ts +32 -0
- package/dist/space-sdk/src/hooks/useMarqueeSelection.d.ts +2 -1
- package/dist/space-sdk/src/hooks/useNativeDocumentBody.d.ts +1 -0
- package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +20 -5
- package/dist/space-sdk/src/hooks/useNotisNavigation.d.ts +11 -2
- package/dist/space-sdk/src/hooks/useQuery.d.ts +24 -2
- package/dist/space-sdk/src/hooks/useViewParams.d.ts +2 -0
- package/dist/space-sdk/src/index.d.ts +24 -4
- package/dist/space-sdk/src/nativeData.d.ts +6 -0
- package/dist/space-sdk/src/queryCache.d.ts +97 -2
- package/dist/space-sdk/src/runtime.d.ts +53 -4
- package/dist/space-sdk/src/skeleton.d.ts +42 -0
- package/dist/space-sdk/src/space.ts +662 -28
- package/dist/space-sdk/src/tailwind-candidates.d.ts +761 -6
- package/dist/space-sdk/src/ui/cloud/CloudComputerFrame.d.ts +29 -0
- package/dist/space-sdk/src/ui/cloud/CloudComputerWaking.d.ts +20 -0
- package/dist/space-sdk/src/ui/comments/CommentPane.d.ts +15 -2
- package/dist/space-sdk/src/ui/comments/PassageComments.d.ts +50 -0
- package/dist/space-sdk/src/ui/comments/commentFiles.d.ts +64 -0
- package/dist/space-sdk/src/ui/comments/commentModel.d.ts +49 -1
- package/dist/space-sdk/src/ui/comments/commentWords.d.ts +26 -0
- package/dist/space-sdk/src/ui/comments/index.d.ts +4 -0
- package/dist/space-sdk/src/ui/comments/passageModel.d.ts +82 -0
- package/dist/space-sdk/src/ui/comments/useComments.d.ts +34 -4
- package/dist/space-sdk/src/ui/comments/usePassageComments.d.ts +67 -0
- package/dist/space-sdk/src/ui/engine/index.d.ts +2 -2
- package/dist/space-sdk/src/ui/engine/step.d.ts +9 -0
- package/dist/space-sdk/src/ui/fields/fields.d.ts +2 -1
- package/dist/space-sdk/src/ui/index.d.ts +4 -0
- package/dist/space-sdk/src/ui/layout/Panels.d.ts +9 -2
- package/dist/space-sdk/src/ui/layout/SidePane.d.ts +42 -0
- package/dist/space-sdk/src/ui/layout/index.d.ts +2 -1
- package/dist/space-sdk/src/ui/layout/panelMath.d.ts +11 -2
- package/dist/space-sdk/src/ui/list/ListReader.d.ts +38 -7
- package/dist/space-sdk/src/ui/list/Row.d.ts +4 -0
- package/dist/space-sdk/src/ui/list/SelectionBar.d.ts +9 -4
- package/dist/space-sdk/src/ui/list/useListKeys.d.ts +4 -0
- package/dist/space-sdk/src/words/shell.ts +1 -0
- package/dist/view-renderer/dist/host.js +355 -188
- package/dist/view-renderer/dist/theme.css +1 -1
- package/dist/view-renderer/src/dom.js +15 -2
- package/dist/view-renderer/src/host.tsx +4 -1
- package/dist/view-renderer/src/index.js +3 -0
- package/dist/view-renderer/src/pool.js +8 -4
- package/dist/view-renderer/src/renderer.js +92 -23
- package/dist/view-renderer/src/skeleton.js +450 -0
- package/package.json +4 -4
- package/skills/notis-cli/AGENT_INSTRUCTIONS.md +8 -4
- package/skills/notis-onboarding/BRIEF.md +15 -9
- package/skills/notis-spaces/cli.md +43 -4
- package/src/command-specs/auth.js +5 -3
- package/src/command-specs/cc.js +410 -0
- package/src/command-specs/computer.js +320 -0
- package/src/command-specs/diagnostics.js +2 -13
- package/src/command-specs/documents.js +22 -4
- package/src/command-specs/index.js +7 -0
- package/src/command-specs/onboarding.js +127 -7
- package/src/command-specs/skills.js +2 -2
- package/src/command-specs/spaces.js +162 -30
- package/src/command-specs/tools.js +26 -8
- package/src/command-specs/views.js +4 -1
- package/src/runtime/agent-setup.js +20 -2
- package/src/runtime/app-boundary-validator.js +2 -1
- package/src/runtime/app-platform.js +13 -0
- package/src/runtime/auth-recovery.js +5 -0
- package/src/runtime/channel.js +16 -2
- package/src/runtime/cloud-transfer.js +587 -0
- package/src/runtime/computer-ssh.js +127 -0
- package/src/runtime/oauth.js +50 -4
- package/src/runtime/skill-sync/cloud-client.ts +98 -15
- package/src/runtime/skill-sync/index.ts +42 -4
- package/src/runtime/skill-sync/local-scanner.ts +1 -0
- package/src/runtime/skill-sync/types.ts +6 -0
- package/src/runtime/space-audience.js +94 -0
- package/src/runtime/space-collection-scaffold.js +2 -1
- package/src/runtime/space-fixture-broker.js +2 -1
- package/src/runtime/space-lock.js +1 -4
- package/src/runtime/space-platform.js +18 -2
- package/src/runtime/space-source.js +105 -7
- package/src/runtime/space-test-server.js +13 -2
- package/src/runtime/space-verification.js +99 -6
- package/src/runtime/space-view-manifest.js +22 -4
- package/src/runtime/sync-skills.js +24 -20
- package/src/runtime/transport.js +19 -0
- package/src/runtime/view-render.js +2 -2
- package/src/skill-sync-worker.js +5 -1
- package/template/.harness/index.html.tmpl +1 -1
- package/dist/skill-sync/index.js.map +0 -7
- package/dist/space-sdk/dist/chunk-SVZATGZB.js +0 -5
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
# Store publishing
|
|
2
2
|
|
|
3
|
-
Use this when the user asks to publish a Space, or an update to one,
|
|
4
|
-
Store. You prepare everything; the user chooses where it goes and presses
|
|
5
|
-
|
|
3
|
+
Use this when the user asks to share or publish a Space, or an update to one,
|
|
4
|
+
in the Store. You prepare everything; the user chooses where it goes and presses
|
|
5
|
+
Share on the submission page. Store publication stays separate from deploying
|
|
6
6
|
the installed Space ([Delivery](release.md)).
|
|
7
7
|
|
|
8
8
|
## Never publish for the user
|
|
9
9
|
|
|
10
10
|
There is no agent publish operation, and you never press, simulate or script
|
|
11
|
-
the
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
user
|
|
11
|
+
the Share button. Do not search for a publish or share tool: none exists, and
|
|
12
|
+
looking for one only delays the page link. Only the page's Share button publishes, after the user picks
|
|
13
|
+
the places there: anyone with the link, their team's Store or the public Store.
|
|
14
|
+
Asking you to share or publish means: prepare the submission and send the page
|
|
15
|
+
link. A link or team listing goes live as soon as the user presses Share; a
|
|
16
|
+
public listing goes to the sandbox reviewer, and Notis messages the user with
|
|
17
|
+
its result.
|
|
16
18
|
|
|
17
19
|
## The flow
|
|
18
20
|
|
|
@@ -37,20 +39,27 @@ status, listing text, locales, sample rows and counts, screenshots, findings,
|
|
|
37
39
|
word-for-word translation. No personal names, account details, customer or
|
|
38
40
|
company data from the source.
|
|
39
41
|
3. **Write sample rows** with `store_submission_update {submission_id,
|
|
40
|
-
sample_rows}` (see below),
|
|
42
|
+
sample_rows}` (see below) whenever the Space has databases, even when the
|
|
43
|
+
user did not mention them: without them the screenshots and every installed
|
|
44
|
+
copy start empty, and the scan says so in an amber finding. Then read the
|
|
45
|
+
screenshots. Pass
|
|
41
46
|
`retake_screenshots: true` after sample rows or listing text change what the
|
|
42
47
|
views show.
|
|
43
48
|
4. **Handle the findings** (see below): ask about privacy, fix the rest in the
|
|
44
49
|
source Space, and list every fix.
|
|
45
|
-
5. **Send the link.** When `can_publish` is true,
|
|
46
|
-
|
|
50
|
+
5. **Send the link.** When `can_publish` is true, say it is ready to share and
|
|
51
|
+
give the user the submission page `link`, where they choose the places and
|
|
52
|
+
press Share; add the fixes you made and their answers. Never say it is ready
|
|
53
|
+
to publish or that it is published: nothing is shared until they press Share.
|
|
47
54
|
If it stays false, say what still blocks it from `blocked_reason` and what
|
|
48
55
|
they can do.
|
|
49
56
|
|
|
50
57
|
## Sample rows
|
|
51
58
|
|
|
52
59
|
- Up to 8 rows per database, keyed by database key: `{database_key:
|
|
53
|
-
[{key, properties, body}]}`.
|
|
60
|
+
[{key, properties, body}]}`. The submission's `sample_databases` lists each
|
|
61
|
+
database's `key`, `name` and `properties` (a choice property's `options`, a
|
|
62
|
+
relation's target `database`). Use only those properties, by name; a
|
|
54
63
|
relation lists the `key` of another row in the same sample set. `body` is
|
|
55
64
|
optional plain text (one paragraph per line); `key` is optional short text.
|
|
56
65
|
- Realistic and wholly synthetic: plausible titles, dates, amounts and states
|
|
@@ -113,6 +122,6 @@ Update available card and update when their owner chooses.
|
|
|
113
122
|
## Status
|
|
114
123
|
|
|
115
124
|
Read the submission with `store_submission_read {submission_id}`. `ready` means
|
|
116
|
-
|
|
125
|
+
it is ready to share from its submission page; `in_review` means the public review is running and Notis
|
|
117
126
|
will message the user with the result; `published` is live; `rejected` lists what
|
|
118
127
|
to fix, which starts again from step 4 with a new `store_prepare`.
|
|
@@ -44,6 +44,7 @@ import { defineSpace } from '@notis/sdk/config';
|
|
|
44
44
|
export default defineSpace({
|
|
45
45
|
specVersion: 2,
|
|
46
46
|
name: 'Notes',
|
|
47
|
+
icon: 'phosphor:notebook',
|
|
47
48
|
path: 'notes',
|
|
48
49
|
description: 'Browse notes and open one with its files.',
|
|
49
50
|
readableContext: 'The note parameter opens one note. The list shows all notes available through this Space.',
|
|
@@ -80,8 +81,38 @@ export default defineSpace({
|
|
|
80
81
|
```
|
|
81
82
|
|
|
82
83
|
The saved `read` action is deliberately constrained to one native record for
|
|
83
|
-
body
|
|
84
|
-
to the same declared resource.
|
|
84
|
+
body and record-Site reads; `shows.notes` owns the Editor's collection list. Keep
|
|
85
|
+
both tied to the same declared resource.
|
|
86
|
+
|
|
87
|
+
A Site of the whole Space (or of one of its pages) runs each `shows` list
|
|
88
|
+
through such an action too, and that one-record action refuses the list's
|
|
89
|
+
request. Publishing is then refused with `site_list_action_required`. For a
|
|
90
|
+
Space meant to be published, give each listed database a `read` action that
|
|
91
|
+
accepts exactly that list: its `filter` fixed to the list's `where` (with
|
|
92
|
+
declared defaults filled in), plus the paging the list sends. Anyone with the
|
|
93
|
+
Site link can call it, so never leave `filter` open on a database that holds
|
|
94
|
+
more than the Site shows. A Site uses one such action per database, the
|
|
95
|
+
first by action name.
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// For shows: { notes: { database: 'notes', where: { field: { property: 'Status' }, op: 'equals', value: 'published' } } }
|
|
99
|
+
read: {
|
|
100
|
+
tool: 'LOCAL_NOTIS_DATABASE_QUERY',
|
|
101
|
+
inputs: { type: 'object', additionalProperties: false,
|
|
102
|
+
required: ['request'], properties: { request: {
|
|
103
|
+
type: 'object', additionalProperties: false, required: ['filter'],
|
|
104
|
+
properties: {
|
|
105
|
+
filter: { const: { field: { property: 'Status' }, op: 'equals', value: 'published' } },
|
|
106
|
+
mode: { const: 'rows' },
|
|
107
|
+
page_size: { type: 'integer', minimum: 1, maximum: 100 },
|
|
108
|
+
offset: { type: 'integer', minimum: 0 },
|
|
109
|
+
include_content: { type: 'boolean' },
|
|
110
|
+
sorts: { type: 'array' },
|
|
111
|
+
},
|
|
112
|
+
} } },
|
|
113
|
+
arguments: { database_id: { $asset: 'notes' }, request: { $input: 'request' } },
|
|
114
|
+
},
|
|
115
|
+
```
|
|
85
116
|
|
|
86
117
|
## Write the view
|
|
87
118
|
|
|
@@ -124,7 +155,8 @@ export default function Notes() {
|
|
|
124
155
|
```
|
|
125
156
|
|
|
126
157
|
That is the whole view. J/K (wrapping), Enter, Escape, selection with X,
|
|
127
|
-
Shift+J/K
|
|
158
|
+
Shift+J/K, Mod+A and the select-all checkbox before the title, E with Notis's
|
|
159
|
+
Archive words and toast, the selection bar,
|
|
128
160
|
the `?` sheet, open as Side, Center or Full, the one-pane rule next to chat and the
|
|
129
161
|
phone layout come with it. `openParam` names the declared record param, so the
|
|
130
162
|
open note lives in the link. `search` fills the host top bar search field and
|
|
@@ -136,6 +168,70 @@ words and a key the clash check accepts. Add `tabs` for real saved filters and
|
|
|
136
168
|
`create` for a "+" that makes a record. Other kinds of view start from their own
|
|
137
169
|
piece; see [Design](design.md#pick-the-piece).
|
|
138
170
|
|
|
171
|
+
## A view of your own
|
|
172
|
+
|
|
173
|
+
When no piece fits what the person does on the page, write the layout yourself
|
|
174
|
+
on the hooks and blocks. This practice view shows one card at a time, centred,
|
|
175
|
+
large, with its own keys:
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
import { useAction, useShown, ViewSkeleton } from '@notis/sdk';
|
|
179
|
+
import { Button, EmptyState, Notice, Section, useShortcut } from '@notis/sdk/ui';
|
|
180
|
+
import { useState } from 'react';
|
|
181
|
+
|
|
182
|
+
type Flashcard = { record_key: string; front: string; back: string };
|
|
183
|
+
const words = {
|
|
184
|
+
flip: { en: 'Show answer', fr: 'Voir la réponse' },
|
|
185
|
+
known: { en: 'I knew it', fr: 'Je savais' },
|
|
186
|
+
next: { en: 'Next card', fr: 'Carte suivante' },
|
|
187
|
+
previous: { en: 'Previous card', fr: 'Carte précédente' },
|
|
188
|
+
done: { en: 'Every card is reviewed', fr: 'Toutes les cartes sont revues' },
|
|
189
|
+
loading: { en: 'Loading cards', fr: 'Chargement des cartes' },
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export default function Practice() {
|
|
193
|
+
const cards = useShown<Flashcard>('due', { allPages: true });
|
|
194
|
+
const markKnown = useAction('mark_known'); // a declared write action
|
|
195
|
+
const [index, setIndex] = useState(0);
|
|
196
|
+
const [flipped, setFlipped] = useState(false);
|
|
197
|
+
const rows = cards.data?.rows ?? [];
|
|
198
|
+
const card = rows[index];
|
|
199
|
+
const go = (step: number) => { setFlipped(false); setIndex((i) => Math.max(0, Math.min(i + step, rows.length - 1))); };
|
|
200
|
+
// Move on only once the write is saved; a failure stays on this card and shows below.
|
|
201
|
+
const known = (key: string) => markKnown.call({ record_keys: [key] }).then(() => go(1), () => undefined);
|
|
202
|
+
|
|
203
|
+
useShortcut({ id: 'practice.flip', keys: 'f', scope: 'route', label: words.flip, run: () => setFlipped(true) });
|
|
204
|
+
const idle = () => !markKnown.loading; // no card change while a save is pending
|
|
205
|
+
useShortcut({ id: 'practice.next', keys: 'arrowright', scope: 'route', label: words.next, when: idle, run: () => go(1) });
|
|
206
|
+
useShortcut({ id: 'practice.previous', keys: 'arrowleft', scope: 'route', label: words.previous, when: idle, run: () => go(-1) });
|
|
207
|
+
|
|
208
|
+
if (cards.error && !cards.hasData) return <Notice tone="danger" onRetry={() => void cards.refetch()}>{cards.error.message}</Notice>;
|
|
209
|
+
if (!cards.hasData) return <ViewSkeleton variant="detail" label={words.loading} />;
|
|
210
|
+
if (!card) return <EmptyState title={words.done} />;
|
|
211
|
+
return (
|
|
212
|
+
<div className="flex h-full min-h-0 flex-col items-center justify-center gap-8 p-6">
|
|
213
|
+
<Section kind="data" meta={`${index + 1} / ${rows.length}`} className="w-full max-w-xl">
|
|
214
|
+
<p className="text-3xl font-medium text-foreground">{card.front}</p>
|
|
215
|
+
{flipped && <p className="mt-6 text-xl text-muted-foreground">{card.back}</p>}
|
|
216
|
+
</Section>
|
|
217
|
+
<div className="flex gap-2">
|
|
218
|
+
{flipped
|
|
219
|
+
? <Button variant="primary" disabled={markKnown.loading} onClick={() => void known(card.record_key)}>{words.known}</Button>
|
|
220
|
+
: <Button variant="primary" onClick={() => setFlipped(true)}>{words.flip}</Button>}
|
|
221
|
+
</div>
|
|
222
|
+
{markKnown.error && <Notice tone="danger">{markKnown.error.message}</Notice>}
|
|
223
|
+
</div>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
The host still gives it the top bar, the `?` sheet (the three keys are listed
|
|
229
|
+
there with their EN and FR words), light and dark, and the phone frame; the
|
|
230
|
+
view owns its layout. Keep `useShortcut` for every key (never a listener on
|
|
231
|
+
`window`), words in EN and FR, theme tokens for colour, and `h-full`/`min-h-0`
|
|
232
|
+
for height. Mix in pieces where they help: a `TabRow` for decks, a `Menu` for
|
|
233
|
+
card options, `DocumentPage` to edit the open card.
|
|
234
|
+
|
|
139
235
|
Keep hooks unconditional; conditional record/list branches can be separate
|
|
140
236
|
components. The [SDK reference](sdk.md) covers data hooks, record components,
|
|
141
237
|
navigation and the toolkit pieces.
|
|
@@ -215,9 +311,6 @@ presentations; ordinary collection views keep Portal chrome.
|
|
|
215
311
|
A Space whose published view hides chrome starts hidden from each person's sidebar;
|
|
216
312
|
it stays reachable by link and search. Each person can turn on **Show hidden Spaces**
|
|
217
313
|
in the sidebar's Spaces menu, then choose **Show in sidebar** in that Space's menu.
|
|
218
|
-
Skill review Spaces stay out of the sidebar, even with **Show hidden Spaces** on:
|
|
219
|
-
people open them from the Skill page's **Changes** list. A review a person already
|
|
220
|
-
chose to show stays in their sidebar until they hide it.
|
|
221
314
|
Optional `markdown: './markdown.ts'` names a module exporting a pure function of
|
|
222
315
|
`{params, shown}`. Its output must represent this view, not make hidden writes.
|
|
223
316
|
Use `<RenderChartData>` with the chart's actual rows so rendered Markdown contains
|
package/dist/sdk/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of the Cloud Computer hooks and `CloudComputerWaking`, in English and French. `{seconds}` is a wait in
|
|
3
|
+
* seconds and `{price}` an hourly price already formatted for the reader's language.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { NNBSP, fillWords, w, type Locale, type Words } from './words';
|
|
7
|
+
|
|
8
|
+
export const CLOUD_COMPUTER_WORDS = Object.freeze({
|
|
9
|
+
starting: w('Starting your Cloud Computer', 'Démarrage de ton Cloud Computer'),
|
|
10
|
+
startingHint: w('This can take up to a minute the first time.', 'Ça peut prendre jusqu’à une minute la première fois.'),
|
|
11
|
+
restoring: w('Your Cloud Computer is restoring its files', 'Ton Cloud Computer restaure ses fichiers'),
|
|
12
|
+
restoringHint: w('It is bringing your files back after a pause. This can take a few minutes.',
|
|
13
|
+
'Il récupère tes fichiers après une pause. Ça peut prendre quelques minutes.'),
|
|
14
|
+
restoringTimedOut: w('It is still restoring its files. Try again in a few minutes.',
|
|
15
|
+
'Il restaure encore ses fichiers. Réessaie dans quelques minutes.'),
|
|
16
|
+
failedTitle: w('Your Cloud Computer could not start this', 'Ton Cloud Computer n’a pas pu lancer ça'),
|
|
17
|
+
failedGeneric: w('Something went wrong while starting it.', 'Un problème est survenu au démarrage.'),
|
|
18
|
+
timedOut: w('It did not start within {seconds} seconds.', `Il n’a pas démarré en {seconds}${NNBSP}secondes.`),
|
|
19
|
+
noAnswer: w('Your Cloud Computer did not answer.', 'Ton Cloud Computer n’a pas répondu.'),
|
|
20
|
+
retry: w('Try again', 'Réessayer'),
|
|
21
|
+
approvalTitle: w('Allow this Space to use your Cloud Computer', 'Autorise ce Space à utiliser ton Cloud Computer'),
|
|
22
|
+
approvalHint: w('Notis asks once for each version of this Space.', 'Notis te le demande une fois par version de ce Space.'),
|
|
23
|
+
allow: w('Allow', 'Autoriser'),
|
|
24
|
+
retryIn: w('Try again in {seconds} s', `Réessayer dans {seconds}${NNBSP}s`),
|
|
25
|
+
priceInfo: w('What it costs', 'Ce que ça coûte'),
|
|
26
|
+
price: w('About {price} per hour while it runs, from your credit.', 'Environ {price} par heure tant qu’il tourne, sur ton crédit.'),
|
|
27
|
+
unavailable: w('This page needs the Cloud Computer in Notis. Open it in Notis to use it.',
|
|
28
|
+
'Cette page a besoin du Cloud Computer dans Notis. Ouvre-la dans Notis pour l’utiliser.'),
|
|
29
|
+
noGate: w('This service cannot be reached yet. Wait until it is ready.', 'Ce service n’est pas encore joignable. Attends qu’il soit prêt.'),
|
|
30
|
+
notOffered: w('The Cloud Computer is not available in this Space.', 'Le Cloud Computer n’est pas disponible dans ce Space.'),
|
|
31
|
+
frameTitle: w('Cloud Computer service', 'Service du Cloud Computer'),
|
|
32
|
+
frameOpening: w('Opening it', 'Ouverture'),
|
|
33
|
+
frameFailed: w('This service could not open here.', 'Ce service n’a pas pu s’ouvrir ici.'),
|
|
34
|
+
}) satisfies Readonly<Record<string, Words>>;
|
|
35
|
+
|
|
36
|
+
export type CloudComputerWordKey = keyof typeof CLOUD_COMPUTER_WORDS;
|
|
37
|
+
|
|
38
|
+
/** "$0.14" in English, "0,14 $" in French; three decimals under one cent. */
|
|
39
|
+
export function formatHourlyPrice(usd: number, locale: Locale): string {
|
|
40
|
+
const digits = usd > 0 && usd < 0.01 ? 3 : 2;
|
|
41
|
+
return new Intl.NumberFormat(locale === 'fr' ? 'fr-FR' : 'en-US', {
|
|
42
|
+
style: 'currency', currency: 'USD', currencyDisplay: 'narrowSymbol', minimumFractionDigits: digits, maximumFractionDigits: digits,
|
|
43
|
+
}).format(usd);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** "About $0.14 per hour while it runs, from your credit." in both languages, or null when the price is unknown. */
|
|
47
|
+
export function cloudComputerPriceWords(hourlyUsd: number | null | undefined): Words | null {
|
|
48
|
+
if (typeof hourlyUsd !== 'number' || !Number.isFinite(hourlyUsd) || hourlyUsd < 0) return null;
|
|
49
|
+
return {
|
|
50
|
+
en: fillWords(CLOUD_COMPUTER_WORDS.price, { price: formatHourlyPrice(hourlyUsd, 'en') }).en,
|
|
51
|
+
fr: fillWords(CLOUD_COMPUTER_WORDS.price, { price: formatHourlyPrice(hourlyUsd, 'fr') }).fr,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { type CSSProperties, type ReactElement, type ReactNode } from 'react';
|
|
4
|
+
import { useNotisRuntime } from '../provider';
|
|
5
|
+
import { spaceAudience, type SpaceAudience } from '../space';
|
|
6
|
+
import { pick, type Locale, type Words } from '../words/types';
|
|
7
|
+
|
|
8
|
+
/** The words of the view-as switch, in English and French. */
|
|
9
|
+
export const AUDIENCE_WORDS = Object.freeze({
|
|
10
|
+
viewAsPublic: { en: 'View as the public', fr: 'Voir comme le public' },
|
|
11
|
+
backToEditing: { en: 'Back to editing', fr: 'Revenir en édition' },
|
|
12
|
+
}) satisfies Readonly<Record<string, Words>>;
|
|
13
|
+
|
|
14
|
+
export interface UseAudienceResult {
|
|
15
|
+
/** Who the page is drawn for. `public` while an editor views the Space as the public. */
|
|
16
|
+
audience: SpaceAudience;
|
|
17
|
+
/** An editor is viewing this Space as the public. */
|
|
18
|
+
viewingAsPublic: boolean;
|
|
19
|
+
/** The viewer is an editor and this host can switch View as the public on and off. */
|
|
20
|
+
canViewAsPublic: boolean;
|
|
21
|
+
/** Switch View as the public on or off; does nothing where `canViewAsPublic` is false. */
|
|
22
|
+
setViewingAsPublic(on: boolean): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Who the Space is drawn for: its editors or the public (Site and link visitors, signed-in people who cannot edit).
|
|
27
|
+
* Outside a Space, and on servers that predate audiences, the answer is `public`. The server enforces the same
|
|
28
|
+
* split, so this only decides what differs on screen.
|
|
29
|
+
*/
|
|
30
|
+
export function useAudience(): UseAudienceResult {
|
|
31
|
+
const runtime = useNotisRuntime();
|
|
32
|
+
const space = runtime?.resource?.kind === 'space' ? runtime.space : undefined;
|
|
33
|
+
const viewingAsPublic = space?.viewAs === 'public';
|
|
34
|
+
const isEditor = viewingAsPublic || space?.audience === 'editor';
|
|
35
|
+
const setter = runtime?.setSpaceViewAs;
|
|
36
|
+
const canViewAsPublic = Boolean(isEditor && setter);
|
|
37
|
+
return {
|
|
38
|
+
audience: spaceAudience(space),
|
|
39
|
+
viewingAsPublic,
|
|
40
|
+
canViewAsPublic,
|
|
41
|
+
setViewingAsPublic(on: boolean) { if (canViewAsPublic) setter!(on ? 'public' : null); },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Shown to the Space's editors only (never while they view it as the public). */
|
|
46
|
+
export function Editors({ children }: { children?: ReactNode }): ReactElement | null {
|
|
47
|
+
return useAudience().audience === 'editor' ? <>{children}</> : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Shown to the public only, and to editors viewing the Space as the public. */
|
|
51
|
+
export function Public({ children }: { children?: ReactNode }): ReactElement | null {
|
|
52
|
+
return useAudience().audience === 'public' ? <>{children}</> : null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ViewAsPublicProps {
|
|
56
|
+
className?: string;
|
|
57
|
+
style?: CSSProperties;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The View as the public switch, placed by the Space's own page. Editors only: renders nothing for the public and
|
|
62
|
+
* on hosts that cannot switch. The host's Share menu offers the same switch when the page does not place it.
|
|
63
|
+
*/
|
|
64
|
+
export function ViewAsPublic({ className, style }: ViewAsPublicProps): ReactElement | null {
|
|
65
|
+
const runtime = useNotisRuntime();
|
|
66
|
+
const { viewingAsPublic, canViewAsPublic, setViewingAsPublic } = useAudience();
|
|
67
|
+
if (!canViewAsPublic) return null;
|
|
68
|
+
const locale: Locale = runtime?.context?.locale === 'fr' ? 'fr' : 'en';
|
|
69
|
+
return <button type="button" className={className} aria-pressed={viewingAsPublic} data-notis-view-as-public=""
|
|
70
|
+
onClick={() => setViewingAsPublic(!viewingAsPublic)}
|
|
71
|
+
style={{ display: 'inline-flex', alignItems: 'center', height: 32, padding: '0 12px', borderRadius: 8, border: 'none',
|
|
72
|
+
background: 'hsl(var(--muted))', color: 'hsl(var(--foreground))', fontSize: 13, fontWeight: 500, cursor: 'pointer',
|
|
73
|
+
whiteSpace: 'nowrap', ...style }}>
|
|
74
|
+
{pick(viewingAsPublic ? AUDIENCE_WORDS.backToEditing : AUDIENCE_WORDS.viewAsPublic, locale)}
|
|
75
|
+
</button>;
|
|
76
|
+
}
|
|
@@ -7,6 +7,8 @@ import { DocumentEditor } from './DocumentEditor';
|
|
|
7
7
|
import { HtmlFrame, ShareControl } from './RecordComponents';
|
|
8
8
|
import { Skeleton } from './Skeleton';
|
|
9
9
|
import { renderIcon } from '../ui/icons';
|
|
10
|
+
import { useIsoLayoutEffect } from '../ui/util';
|
|
11
|
+
import { beginWait, isWaiting } from '../perf';
|
|
10
12
|
import type { NotisDocumentPageProps } from '../runtime';
|
|
11
13
|
|
|
12
14
|
const copy = {
|
|
@@ -50,8 +52,10 @@ function columnStyle(width: NotisDocumentPageProps['width'] = 'standard'): CSSPr
|
|
|
50
52
|
* same column width and gutter, so the page replaces it without a layout shift. Hosts show it while the
|
|
51
53
|
* record and the editor load; a Space can show it while its own data decides which record opens.
|
|
52
54
|
*/
|
|
53
|
-
export function DocumentPageSkeleton({ width = 'standard', className, label }: {
|
|
55
|
+
export function DocumentPageSkeleton({ width = 'standard', className, label, title }: {
|
|
54
56
|
width?: NotisDocumentPageProps['width']; className?: string; label?: string;
|
|
57
|
+
/** The record's title when already known (from the list row that opened it): shown in place of its bar. */
|
|
58
|
+
title?: string | null;
|
|
55
59
|
}): ReactElement {
|
|
56
60
|
const t = useCopy();
|
|
57
61
|
return <div role="status" aria-busy="true" aria-label={label || t.loading} data-notis-skeleton="document-page" className={className}
|
|
@@ -64,7 +68,9 @@ export function DocumentPageSkeleton({ width = 'standard', className, label }: {
|
|
|
64
68
|
</div>
|
|
65
69
|
<div className={`${SKELETON}__column`} style={{ ...columnStyle(width), display: 'flex', flexDirection: 'column' }}>
|
|
66
70
|
<Skeleton className={`${SKELETON}__icon`} style={{ borderRadius: 12, height: undefined }} />
|
|
67
|
-
<
|
|
71
|
+
{title ? <div data-notis-skeleton-title="" style={{ margin: '2px 0 10px', minHeight: 36, fontSize: 32, lineHeight: '36px',
|
|
72
|
+
fontWeight: 700, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{title}</div>
|
|
73
|
+
: <Skeleton style={{ width: '58%', height: 36, margin: '2px 0 10px' }} />}
|
|
68
74
|
<Skeleton style={{ width: '72%', height: 14, margin: '15px 0' }} />
|
|
69
75
|
<div style={{ display: 'grid', gap: 12, marginTop: 24 }}>
|
|
70
76
|
{[100, 96, 88, 100, 64].map((size, index) => <Skeleton key={index} style={{ width: `${size}%`, height: 16 }} />)}
|
|
@@ -117,10 +123,12 @@ function DocumentPageFallback(props: NotisDocumentPageProps) {
|
|
|
117
123
|
{actions}
|
|
118
124
|
{share ? <ShareControl recordKey={recordKey} /> : null}
|
|
119
125
|
{/* The host's '...' menu is not available here: its entries show as buttons, icon only when they carry one. */}
|
|
126
|
+
{/* REC-004: an icon-only item never shrinks (its icon would be cut); a text item shortens its label with an ellipsis,
|
|
127
|
+
which a flex box never draws for its own words, so the text item is an inline block. */}
|
|
120
128
|
{menuItems.map((item, index) => <button key={`${item.label}-${index}`} type="button" onClick={item.onSelect} disabled={item.disabled} title={item.label}
|
|
121
129
|
aria-label={item.icon ? item.label : undefined}
|
|
122
|
-
style={{ display: 'inline-flex', alignItems: 'center', background: 'none', border: 0, padding: item.icon ? 6 : '4px 8px', borderRadius: 6, cursor: item.disabled ? 'default' : 'pointer', font: 'inherit', fontSize: 13,
|
|
123
|
-
flex: '0 1 auto', minWidth: 0, maxWidth: CRUMB_MAX, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: item.destructive ? 'hsl(var(--destructive))' : 'hsl(var(--muted-foreground))', opacity: item.disabled ? 0.5 : 1 }}>{item.icon ? <span style={ICON_BOX}>{renderIcon(item.icon)}</span> : item.label}</button>)}
|
|
130
|
+
style={{ display: item.icon ? 'inline-flex' : 'inline-block', alignItems: 'center', verticalAlign: 'middle', background: 'none', border: 0, padding: item.icon ? 6 : '4px 8px', borderRadius: 6, cursor: item.disabled ? 'default' : 'pointer', font: 'inherit', fontSize: 13, lineHeight: '20px',
|
|
131
|
+
flex: item.icon ? 'none' : '0 1 auto', minWidth: item.icon ? undefined : 0, maxWidth: CRUMB_MAX, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: item.destructive ? 'hsl(var(--destructive))' : 'hsl(var(--muted-foreground))', opacity: item.disabled ? 0.5 : 1 }}>{item.icon ? <span style={ICON_BOX}>{renderIcon(item.icon)}</span> : item.label}</button>)}
|
|
124
132
|
</div>
|
|
125
133
|
</div> : null}
|
|
126
134
|
{props.viewer === 'html' ? <HtmlFrame recordKey={recordKey} /> :
|
|
@@ -171,6 +179,9 @@ export function DocumentPage(props: NotisDocumentPageProps): ReactElement {
|
|
|
171
179
|
}, [recordKey, onTitle]);
|
|
172
180
|
const title = reported?.recordKey === recordKey ? reported.title : null;
|
|
173
181
|
useTopBarTitleLeaf(leaf && title !== null ? title.trim() || t.untitled : null, back, { recordKey });
|
|
182
|
+
// Another record opening here is timed until the host paints it (a list's open has started that wait already).
|
|
183
|
+
const timed = Boolean(Host);
|
|
184
|
+
useIsoLayoutEffect(() => { if (timed && recordKey && !isWaiting('notis:record-open')) beginWait('notis:record-open'); }, [recordKey, timed]);
|
|
174
185
|
return Host ? <Host {...props} topBarTitle={inTopBar} onTitle={reportTitle} /> : <DocumentPageFallback {...props} />;
|
|
175
186
|
}
|
|
176
187
|
|
|
@@ -21,19 +21,30 @@ const readOnlyStyle: CSSProperties = {
|
|
|
21
21
|
cursor: 'default', outline: 'none',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
/** What `useMarkdownEditorDraft` gives an editor: the text to show, and what to call on a change or a save key. */
|
|
25
|
+
export interface MarkdownEditorDraft {
|
|
26
|
+
draft: string;
|
|
27
|
+
/** The editor's text changed (typed, pasted, a block edited). */
|
|
28
|
+
change: (markdown: string) => void;
|
|
29
|
+
/** Saves now (Cmd-S), when there is something to save. */
|
|
30
|
+
save: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The editing state every MarkdownEditor shares, the host's and the fallback's: takes a new `value` while nothing
|
|
35
|
+
* is typed, autosaves `autosaveMs` after the last change through `onSave` (with the revision it opened or last
|
|
36
|
+
* saved), saves again when typing went on during a save, and saves what is left when the editor goes away.
|
|
37
|
+
*/
|
|
38
|
+
export function useMarkdownEditorDraft({
|
|
25
39
|
value,
|
|
26
40
|
revision,
|
|
27
41
|
readOnly,
|
|
28
42
|
autosaveMs = 1500,
|
|
29
|
-
placeholder,
|
|
30
|
-
className,
|
|
31
43
|
onChange,
|
|
32
44
|
onSave,
|
|
33
45
|
onDirtyChange,
|
|
34
46
|
onSavingChange,
|
|
35
|
-
}: NotisMarkdownEditorProps) {
|
|
36
|
-
const locale = useNotisRuntime()?.context?.locale === 'fr' ? 'fr' : 'en';
|
|
47
|
+
}: NotisMarkdownEditorProps): MarkdownEditorDraft {
|
|
37
48
|
const [draft, setDraft] = useState(value);
|
|
38
49
|
const [saveAttempt, setSaveAttempt] = useState(0);
|
|
39
50
|
const draftRef = useRef(value);
|
|
@@ -99,39 +110,58 @@ function MarkdownEditorFallback({
|
|
|
99
110
|
return () => window.clearTimeout(timer);
|
|
100
111
|
}, [autosaveMs, draft, onSave, readOnly, save, saveAttempt]);
|
|
101
112
|
|
|
102
|
-
const
|
|
103
|
-
|
|
113
|
+
const onChangeRef = useRef(onChange);
|
|
114
|
+
onChangeRef.current = onChange;
|
|
115
|
+
const onDirtyChangeRef = useRef(onDirtyChange);
|
|
116
|
+
onDirtyChangeRef.current = onDirtyChange;
|
|
117
|
+
const change = useCallback((next: string) => {
|
|
118
|
+
if (next === draftRef.current) return;
|
|
104
119
|
draftRef.current = next;
|
|
105
120
|
setDraft(next);
|
|
106
121
|
if (!dirtyRef.current) {
|
|
107
122
|
dirtyRef.current = true;
|
|
108
|
-
|
|
123
|
+
onDirtyChangeRef.current?.(true);
|
|
109
124
|
}
|
|
110
|
-
|
|
111
|
-
};
|
|
125
|
+
onChangeRef.current?.(next);
|
|
126
|
+
}, []);
|
|
112
127
|
|
|
128
|
+
return { draft, change, save };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** The plain EN/FR textarea for a draft: the fallback outside Notis, and the host's when its editor cannot open. */
|
|
132
|
+
export function MarkdownTextArea({ state, readOnly, placeholder, className }: {
|
|
133
|
+
state: MarkdownEditorDraft;
|
|
134
|
+
readOnly?: boolean;
|
|
135
|
+
placeholder?: string;
|
|
136
|
+
className?: string;
|
|
137
|
+
}) {
|
|
138
|
+
const locale = useNotisRuntime()?.context?.locale === 'fr' ? 'fr' : 'en';
|
|
113
139
|
const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
|
|
114
140
|
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 's') {
|
|
115
141
|
event.preventDefault();
|
|
116
|
-
void save();
|
|
142
|
+
void state.save();
|
|
117
143
|
}
|
|
118
144
|
};
|
|
119
|
-
|
|
120
145
|
return (
|
|
121
146
|
<textarea
|
|
122
|
-
value={draft}
|
|
147
|
+
value={state.draft}
|
|
123
148
|
readOnly={readOnly}
|
|
124
149
|
aria-readonly={readOnly || undefined}
|
|
125
150
|
data-readonly={readOnly ? '' : undefined}
|
|
126
151
|
placeholder={readOnly ? undefined : placeholder ?? pick(MARKDOWN_EDITOR_WORDS.placeholder, locale)}
|
|
127
152
|
className={className}
|
|
128
|
-
onChange={
|
|
153
|
+
onChange={(event: ChangeEvent<HTMLTextAreaElement>) => state.change(event.currentTarget.value)}
|
|
129
154
|
onKeyDown={handleKeyDown}
|
|
130
155
|
style={readOnly ? readOnlyStyle : editableStyle}
|
|
131
156
|
/>
|
|
132
157
|
);
|
|
133
158
|
}
|
|
134
159
|
|
|
160
|
+
function MarkdownEditorFallback(props: NotisMarkdownEditorProps) {
|
|
161
|
+
const state = useMarkdownEditorDraft(props);
|
|
162
|
+
return <MarkdownTextArea state={state} readOnly={props.readOnly} placeholder={props.placeholder} className={props.className} />;
|
|
163
|
+
}
|
|
164
|
+
|
|
135
165
|
/** Use Notis' editor while leaving persistence entirely under app control; outside Notis a plain EN/FR textarea stands in. */
|
|
136
166
|
export function MarkdownEditor(props: NotisMarkdownEditorProps): ReactElement {
|
|
137
167
|
const runtime = useNotisRuntime();
|
|
@@ -27,6 +27,10 @@ export interface MultiSelectActionBarProps {
|
|
|
27
27
|
actions: MultiSelectAction[];
|
|
28
28
|
/** Override the "{count} selected" label units. Default: "selected" with no item word. */
|
|
29
29
|
itemLabel?: { singular: string; plural: string };
|
|
30
|
+
/** Complete count text in the caller's language, including plural agreement. */
|
|
31
|
+
selectionLabel?: string;
|
|
32
|
+
/** Accessible toolbar name in the caller's language. */
|
|
33
|
+
toolbarLabel?: string;
|
|
30
34
|
/** Optional extra class on the outer container (composed alongside the inline styles). */
|
|
31
35
|
className?: string;
|
|
32
36
|
/** Optional override for the bar's positioning style. Defaults to bottom-center floating. */
|
|
@@ -125,6 +129,8 @@ export function MultiSelectActionBar({
|
|
|
125
129
|
selectedCount,
|
|
126
130
|
actions,
|
|
127
131
|
itemLabel,
|
|
132
|
+
selectionLabel,
|
|
133
|
+
toolbarLabel,
|
|
128
134
|
className,
|
|
129
135
|
style,
|
|
130
136
|
shortcutsEnabled = true,
|
|
@@ -196,9 +202,9 @@ export function MultiSelectActionBar({
|
|
|
196
202
|
? itemLabel.singular
|
|
197
203
|
: itemLabel.plural
|
|
198
204
|
: 'selected';
|
|
199
|
-
const countLabel = itemLabel
|
|
205
|
+
const countLabel = selectionLabel ?? (itemLabel
|
|
200
206
|
? `${selectedCount} ${countWord} selected`
|
|
201
|
-
: `${selectedCount} selected
|
|
207
|
+
: `${selectedCount} selected`);
|
|
202
208
|
|
|
203
209
|
const composedStyle: CSSProperties = { ...containerBaseStyle, ...(style || {}) };
|
|
204
210
|
|
|
@@ -215,7 +221,7 @@ export function MultiSelectActionBar({
|
|
|
215
221
|
onClearSelection();
|
|
216
222
|
}}
|
|
217
223
|
role="toolbar"
|
|
218
|
-
aria-label={`Bulk actions for ${selectedCount} selected ${countWord}`}
|
|
224
|
+
aria-label={toolbarLabel ?? `Bulk actions for ${selectedCount} selected ${countWord}`}
|
|
219
225
|
className={className}
|
|
220
226
|
style={composedStyle}
|
|
221
227
|
>
|
|
@@ -225,8 +231,13 @@ export function MultiSelectActionBar({
|
|
|
225
231
|
[data-notis-bulk-actions] { flex-wrap: wrap; width: calc(100% - 2rem) !important; }
|
|
226
232
|
[data-notis-bulk-count] { flex-basis: 100%; padding: 0.375rem 0.5rem !important; font-size: 14px !important; }
|
|
227
233
|
[data-notis-bulk-divider] { display: none; }
|
|
228
|
-
|
|
229
|
-
|
|
234
|
+
/* Every action gets an equal column, icon over label, so none is cut off at the edge
|
|
235
|
+
(longer labels such as French ones wrap inside their column instead). */
|
|
236
|
+
[data-notis-bulk-action-list] { display: grid !important; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; overflow: visible !important; }
|
|
237
|
+
[data-notis-bulk-actions] button { flex-direction: column; justify-content: flex-start; gap: 4px !important; min-width: 0; min-height: 56px; padding: 8px 4px 6px !important; font-size: 12px !important; line-height: 1.25; white-space: normal !important; text-align: center; }
|
|
238
|
+
[data-notis-bulk-actions] kbd { display: none !important; }
|
|
239
|
+
[data-notis-bulk-action-icon][data-has-shortcut] { display: inline-flex !important; }
|
|
240
|
+
[data-notis-bulk-action-icon] svg { width: 18px; height: 18px; }
|
|
230
241
|
}
|
|
231
242
|
@media (hover: none) and (pointer: coarse) {
|
|
232
243
|
[data-notis-bulk-actions] kbd { display: none !important; }
|