@hachej/boring-ui-kit 0.4.48 → 0.4.50

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.
Files changed (56) hide show
  1. package/THIRD_PARTY_NOTICES.md +208 -0
  2. package/bin/boring-ui-blocks.mjs +33 -1
  3. package/dist/drawio-viewer.d.ts +4 -0
  4. package/dist/drawio-viewer.js +6 -0
  5. package/dist/file-tree-view.d.ts +25 -2
  6. package/dist/file-tree-view.js +8 -4
  7. package/dist/vendor/drawio-viewer-static.d.ts +3 -0
  8. package/dist/vendor/drawio-viewer-static.js +5 -0
  9. package/package.json +6 -2
  10. package/r/agent-target.json +4 -4
  11. package/r/app-shell.json +12 -12
  12. package/r/board-viewer.json +6 -6
  13. package/r/button.json +1 -1
  14. package/r/dock.json +1 -1
  15. package/r/documents.json +12 -12
  16. package/r/drawing-viewer.json +57 -0
  17. package/r/feedback.json +6 -6
  18. package/r/file-tree.json +5 -5
  19. package/r/highlights.json +3 -3
  20. package/r/html-viewer.json +3 -3
  21. package/r/looks-viewer.json +2 -2
  22. package/r/maquette-viewer.json +1 -1
  23. package/r/markdown-editor.json +3 -3
  24. package/r/mockup-viewer.json +1 -1
  25. package/r/pi-ambient.json +9 -9
  26. package/r/pi-app-kinds.json +10 -10
  27. package/r/pi-app.json +10 -10
  28. package/r/pi-artifacts.json +2 -2
  29. package/r/pi-chat-approval.json +2 -2
  30. package/r/pi-chat-attachments.json +1 -1
  31. package/r/pi-chat-markdown.json +2 -2
  32. package/r/pi-chat-mentions.json +1 -1
  33. package/r/pi-chat-pickers.json +1 -1
  34. package/r/pi-chat-plugins.json +11 -11
  35. package/r/pi-chat-question.json +1 -1
  36. package/r/pi-chat-slash.json +2 -2
  37. package/r/pi-chat-subagent.json +1 -1
  38. package/r/pi-chat-voice.json +3 -3
  39. package/r/pi-chat.json +9 -9
  40. package/r/pi-workspace.json +3 -3
  41. package/r/placed-agent.json +4 -4
  42. package/r/provider-setup.json +1 -1
  43. package/r/registry.json +210 -161
  44. package/r/shared-chat.json +6 -6
  45. package/r/spaces.json +1 -1
  46. package/r/task-list-viewer.json +2 -2
  47. package/r/version-history.json +2 -2
  48. package/r/viewer-code.json +2 -2
  49. package/r/viewer-frame.json +4 -4
  50. package/r/viewer-html.json +4 -4
  51. package/r/viewer-image.json +2 -2
  52. package/r/viewer-markdown.json +5 -5
  53. package/r/viewer-pdf.json +3 -3
  54. package/r/viewers.json +6 -6
  55. package/r/windows.json +1 -1
  56. package/styles/file-tree.css +4 -0
@@ -118,3 +118,211 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
118
118
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
119
119
  SOFTWARE.
120
120
  ```
121
+
122
+ ## draw.io viewer (`@hachej/boring-ui-kit/drawio-viewer`)
123
+
124
+ The kit carries, unmodified, `viewer-static.min.js` of jgraph/drawio v32.4.1 (https://github.com/jgraph/drawio, sha256 bc7586cb62eec98018c13b78619078d3a7179cc7bfc711c566dda19527520a30), Copyright JGraph Ltd, as the text of `src/vendor/drawio-viewer-static.ts`. The project has no NOTICE file. The script bundles DOMPurify (Apache-2.0 or MPL-2.0), pako (MIT and Zlib) and other libraries whose notices it keeps inline. Its licence:
125
+
126
+ ```text
127
+ Apache License
128
+ Version 2.0, January 2004
129
+ http://www.apache.org/licenses/
130
+
131
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
132
+
133
+ 1. Definitions.
134
+
135
+ "License" shall mean the terms and conditions for use, reproduction,
136
+ and distribution as defined by Sections 1 through 9 of this document.
137
+
138
+ "Licensor" shall mean the copyright owner or entity authorized by
139
+ the copyright owner that is granting the License.
140
+
141
+ "Legal Entity" shall mean the union of the acting entity and all
142
+ other entities that control, are controlled by, or are under common
143
+ control with that entity. For the purposes of this definition,
144
+ "control" means (i) the power, direct or indirect, to cause the
145
+ direction or management of such entity, whether by contract or
146
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
147
+ outstanding shares, or (iii) beneficial ownership of such entity.
148
+
149
+ "You" (or "Your") shall mean an individual or Legal Entity
150
+ exercising permissions granted by this License.
151
+
152
+ "Source" form shall mean the preferred form for making modifications,
153
+ including but not limited to software source code, documentation
154
+ source, and configuration files.
155
+
156
+ "Object" form shall mean any form resulting from mechanical
157
+ transformation or translation of a Source form, including but
158
+ not limited to compiled object code, generated documentation,
159
+ and conversions to other media types.
160
+
161
+ "Work" shall mean the work of authorship, whether in Source or
162
+ Object form, made available under the License, as indicated by a
163
+ copyright notice that is included in or attached to the work
164
+ (an example is provided in the Appendix below).
165
+
166
+ "Derivative Works" shall mean any work, whether in Source or Object
167
+ form, that is based on (or derived from) the Work and for which the
168
+ editorial revisions, annotations, elaborations, or other modifications
169
+ represent, as a whole, an original work of authorship. For the purposes
170
+ of this License, Derivative Works shall not include works that remain
171
+ separable from, or merely link (or bind by name) to the interfaces of,
172
+ the Work and Derivative Works thereof.
173
+
174
+ "Contribution" shall mean any work of authorship, including
175
+ the original version of the Work and any modifications or additions
176
+ to that Work or Derivative Works thereof, that is intentionally
177
+ submitted to Licensor for inclusion in the Work by the copyright owner
178
+ or by an individual or Legal Entity authorized to submit on behalf of
179
+ the copyright owner. For the purposes of this definition, "submitted"
180
+ means any form of electronic, verbal, or written communication sent
181
+ to the Licensor or its representatives, including but not limited to
182
+ communication on electronic mailing lists, source code control systems,
183
+ and issue tracking systems that are managed by, or on behalf of, the
184
+ Licensor for the purpose of discussing and improving the Work, but
185
+ excluding communication that is conspicuously marked or otherwise
186
+ designated in writing by the copyright owner as "Not a Contribution."
187
+
188
+ "Contributor" shall mean Licensor and any individual or Legal Entity
189
+ on behalf of whom a Contribution has been received by Licensor and
190
+ subsequently incorporated within the Work.
191
+
192
+ 2. Grant of Copyright License. Subject to the terms and conditions of
193
+ this License, each Contributor hereby grants to You a perpetual,
194
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
195
+ copyright license to reproduce, prepare Derivative Works of,
196
+ publicly display, publicly perform, sublicense, and distribute the
197
+ Work and such Derivative Works in Source or Object form.
198
+
199
+ 3. Grant of Patent License. Subject to the terms and conditions of
200
+ this License, each Contributor hereby grants to You a perpetual,
201
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
202
+ (except as stated in this section) patent license to make, have made,
203
+ use, offer to sell, sell, import, and otherwise transfer the Work,
204
+ where such license applies only to those patent claims licensable
205
+ by such Contributor that are necessarily infringed by their
206
+ Contribution(s) alone or by combination of their Contribution(s)
207
+ with the Work to which such Contribution(s) was submitted. If You
208
+ institute patent litigation against any entity (including a
209
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
210
+ or a Contribution incorporated within the Work constitutes direct
211
+ or contributory patent infringement, then any patent licenses
212
+ granted to You under this License for that Work shall terminate
213
+ as of the date such litigation is filed.
214
+
215
+ 4. Redistribution. You may reproduce and distribute copies of the
216
+ Work or Derivative Works thereof in any medium, with or without
217
+ modifications, and in Source or Object form, provided that You
218
+ meet the following conditions:
219
+
220
+ (a) You must give any other recipients of the Work or
221
+ Derivative Works a copy of this License; and
222
+
223
+ (b) You must cause any modified files to carry prominent notices
224
+ stating that You changed the files; and
225
+
226
+ (c) You must retain, in the Source form of any Derivative Works
227
+ that You distribute, all copyright, patent, trademark, and
228
+ attribution notices from the Source form of the Work,
229
+ excluding those notices that do not pertain to any part of
230
+ the Derivative Works; and
231
+
232
+ (d) If the Work includes a "NOTICE" text file as part of its
233
+ distribution, then any Derivative Works that You distribute must
234
+ include a readable copy of the attribution notices contained
235
+ within such NOTICE file, excluding those notices that do not
236
+ pertain to any part of the Derivative Works, in at least one
237
+ of the following places: within a NOTICE text file distributed
238
+ as part of the Derivative Works; within the Source form or
239
+ documentation, if provided along with the Derivative Works; or,
240
+ within a display generated by the Derivative Works, if and
241
+ wherever such third-party notices normally appear. The contents
242
+ of the NOTICE file are for informational purposes only and
243
+ do not modify the License. You may add Your own attribution
244
+ notices within Derivative Works that You distribute, alongside
245
+ or as an addendum to the NOTICE text from the Work, provided
246
+ that such additional attribution notices cannot be construed
247
+ as modifying the License.
248
+
249
+ You may add Your own copyright statement to Your modifications and
250
+ may provide additional or different license terms and conditions
251
+ for use, reproduction, or distribution of Your modifications, or
252
+ for any such Derivative Works as a whole, provided Your use,
253
+ reproduction, and distribution of the Work otherwise complies with
254
+ the conditions stated in this License.
255
+
256
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
257
+ any Contribution intentionally submitted for inclusion in the Work
258
+ by You to the Licensor shall be under the terms and conditions of
259
+ this License, without any additional terms or conditions.
260
+ Notwithstanding the above, nothing herein shall supersede or modify
261
+ the terms of any separate license agreement you may have executed
262
+ with Licensor regarding such Contributions.
263
+
264
+ 6. Trademarks. This License does not grant permission to use the trade
265
+ names, trademarks, service marks, or product names of the Licensor,
266
+ except as required for reasonable and customary use in describing the
267
+ origin of the Work and reproducing the content of the NOTICE file.
268
+
269
+ 7. Disclaimer of Warranty. Unless required by applicable law or
270
+ agreed to in writing, Licensor provides the Work (and each
271
+ Contributor provides its Contributions) on an "AS IS" BASIS,
272
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
273
+ implied, including, without limitation, any warranties or conditions
274
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
275
+ PARTICULAR PURPOSE. You are solely responsible for determining the
276
+ appropriateness of using or redistributing the Work and assume any
277
+ risks associated with Your exercise of permissions under this License.
278
+
279
+ 8. Limitation of Liability. In no event and under no legal theory,
280
+ whether in tort (including negligence), contract, or otherwise,
281
+ unless required by applicable law (such as deliberate and grossly
282
+ negligent acts) or agreed to in writing, shall any Contributor be
283
+ liable to You for damages, including any direct, indirect, special,
284
+ incidental, or consequential damages of any character arising as a
285
+ result of this License or out of the use or inability to use the
286
+ Work (including but not limited to damages for loss of goodwill,
287
+ work stoppage, computer failure or malfunction, or any and all
288
+ other commercial damages or losses), even if such Contributor
289
+ has been advised of the possibility of such damages.
290
+
291
+ 9. Accepting Warranty or Additional Liability. While redistributing
292
+ the Work or Derivative Works thereof, You may choose to offer,
293
+ and charge a fee for, acceptance of support, warranty, indemnity,
294
+ or other liability obligations and/or rights consistent with this
295
+ License. However, in accepting such obligations, You may act only
296
+ on Your own behalf and on Your sole responsibility, not on behalf
297
+ of any other Contributor, and only if You agree to indemnify,
298
+ defend, and hold each Contributor harmless for any liability
299
+ incurred by, or claims asserted against, such Contributor by reason
300
+ of your accepting any such warranty or additional liability.
301
+
302
+ END OF TERMS AND CONDITIONS
303
+
304
+ APPENDIX: How to apply the Apache License to your work.
305
+
306
+ To apply the Apache License to your work, attach the following
307
+ boilerplate notice, with the fields enclosed by brackets "[]"
308
+ replaced with your own identifying information. (Don't include
309
+ the brackets!) The text should be enclosed in the appropriate
310
+ comment syntax for the file format. We also recommend that a
311
+ file or class name and description of purpose be included on the
312
+ same "printed page" as the copyright notice for easier
313
+ identification within third-party archives.
314
+
315
+ Copyright [yyyy] [name of copyright owner]
316
+
317
+ Licensed under the Apache License, Version 2.0 (the "License");
318
+ you may not use this file except in compliance with the License.
319
+ You may obtain a copy of the License at
320
+
321
+ http://www.apache.org/licenses/LICENSE-2.0
322
+
323
+ Unless required by applicable law or agreed to in writing, software
324
+ distributed under the License is distributed on an "AS IS" BASIS,
325
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
326
+ See the License for the specific language governing permissions and
327
+ limitations under the License.
328
+ ```
@@ -10,7 +10,7 @@
10
10
  //
11
11
  // `check` writes nothing. `add`, `update` and `manifest` write the shadcn files they install and the manifest, nothing else.
12
12
  import { createHash } from 'node:crypto';
13
- import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from 'node:fs';
13
+ import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from 'node:fs';
14
14
  import { dirname, join, relative, resolve, sep } from 'node:path';
15
15
  import { spawnSync } from 'node:child_process';
16
16
  import { fileURLToPath } from 'node:url';
@@ -307,6 +307,37 @@ function shadcnAdd(app, args, log, overwrite) {
307
307
  return { status: result.status ?? 1, skipped: skipped.map(([path]) => path), created };
308
308
  }
309
309
 
310
+ /**
311
+ * A package manager follows a symlinked `node_modules` or scope directory and writes into the tree it points at: another checkout's install.
312
+ * Refused before anything runs. Per-package links (workspaces, pnpm) stay valid, and `check` never gets here: it writes nothing.
313
+ */
314
+ function refuseBorrowedInstall(app) {
315
+ const borrowed = [];
316
+ for (const dir of installRoots(app)) {
317
+ const modules = join(dir, 'node_modules');
318
+ const stat = lstatSync(modules, { throwIfNoEntry: false });
319
+ if (stat?.isSymbolicLink()) borrowed.push(modules);
320
+ else if (stat) borrowed.push(...readdirSync(modules).filter(name => name.startsWith('@')).map(name => join(modules, name)).filter(path => lstatSync(path).isSymbolicLink()));
321
+ }
322
+ if (borrowed.length) throw new Error(`refusing to install through a borrowed install: ${borrowed.map(path => `${path} is a symlink`).join(', ')}. A package manager would write into the tree it points at. A borrowed install is read-only: \`check\` still works, and \`add\` and \`update\` need an owned physical install.`);
323
+ }
324
+
325
+ /** Where a package manager run from `app` may write: the app, and every directory up to its workspace root when it is in a workspace. */
326
+ function installRoots(app) {
327
+ const walked = [];
328
+ for (let dir = app; ; dir = dirname(dir)) {
329
+ walked.push(dir);
330
+ if (isWorkspaceRoot(dir)) return walked;
331
+ if (dirname(dir) === dir) return [app];
332
+ }
333
+ }
334
+
335
+ function isWorkspaceRoot(dir) {
336
+ if (existsSync(join(dir, 'pnpm-workspace.yaml'))) return true;
337
+ try { return JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')).workspaces !== undefined; }
338
+ catch { return false; }
339
+ }
340
+
310
341
  const line = v => `${v.check} ${v.rule} ${v.file}${v.line ? `:${v.line}:${v.column}` : ''} ${v.detail}`;
311
342
 
312
343
  export function main(argv, cwd = process.cwd(), log = console.log, error = console.error) {
@@ -328,6 +359,7 @@ export function main(argv, cwd = process.cwd(), log = console.log, error = conso
328
359
  return 1;
329
360
  }
330
361
  if (command === 'manifest') { log(`${flags.manifest ?? MANIFEST}: ${writeManifest(app, flags.manifest)} file(s)`); return 0; }
362
+ if (command === 'add' || (command === 'update' && !flags.dryRun)) refuseBorrowedInstall(app);
331
363
  if (command === 'add') {
332
364
  appPaths(app);
333
365
  if (!flags.pass.length) throw new Error('add needs shadcn add arguments');
@@ -0,0 +1,4 @@
1
+ export { DRAWIO_VIEWER_SCRIPT } from './vendor/drawio-viewer-static.js';
2
+ /** The jgraph/drawio release the vendored viewer comes from. */
3
+ export declare const DRAWIO_VIEWER_VERSION = "32.4.1";
4
+ //# sourceMappingURL=drawio-viewer.d.ts.map
@@ -0,0 +1,6 @@
1
+ // `@hachej/boring-ui-kit/drawio-viewer` (D-1398): the official diagrams.net viewer, vendored and pinned (scripts/vendor-drawio-viewer.mjs),
2
+ // as text. The drawing-viewer registry block imports this subpath lazily, only when a draw.io file opens, and runs the text inside its
3
+ // sandboxed frame: nothing is fetched from diagrams.net. The kit never evaluates it.
4
+ export { DRAWIO_VIEWER_SCRIPT } from './vendor/drawio-viewer-static.js';
5
+ /** The jgraph/drawio release the vendored viewer comes from. */
6
+ export const DRAWIO_VIEWER_VERSION = '32.4.1';
@@ -1,6 +1,6 @@
1
1
  import type { Collapsible } from '@base-ui/react/collapsible';
2
2
  import type { ComponentProps, ReactNode } from 'react';
3
- import type { RevisionProvider, SavedRevision } from '@hachej/boring-files/revision';
3
+ import type { FileEntry, RevisionProvider, SavedRevision } from '@hachej/boring-files/revision';
4
4
  import type { FileTreeController } from './file-tree.js';
5
5
  /** Every word of the tree, so a host can translate it. Functions receive what they name. */
6
6
  export declare const defaultFileTreeLabels: {
@@ -109,6 +109,16 @@ export interface FileTreeDialogProps {
109
109
  readonly footer: ReactNode;
110
110
  }
111
111
  /** Host presentation. The registry supplies real shadcn Base UI controls and shared version rows; no primitive fallback. */
112
+ /** A row's status badge, as `decorate` gave it. */
113
+ export interface FileTreeBadgeProps {
114
+ readonly tone: FileDecorationTone;
115
+ readonly children: ReactNode;
116
+ readonly role: 'note';
117
+ readonly 'aria-label': string;
118
+ readonly title: string;
119
+ readonly 'data-file-badge': '';
120
+ readonly 'data-tone': FileDecorationTone;
121
+ }
112
122
  export interface FileTreeComponents {
113
123
  readonly Button: (props: FileTreeButtonProps) => ReactNode;
114
124
  readonly Actions: (props: FileTreeActionsProps) => ReactNode;
@@ -138,6 +148,8 @@ export interface FileTreeComponents {
138
148
  readonly value: number | null;
139
149
  readonly 'aria-label': string;
140
150
  }) => ReactNode;
151
+ /** The host's shadcn `Badge` for a row's status (`decorate`); without it the status is plain text. */
152
+ readonly Badge?: (props: FileTreeBadgeProps) => ReactNode;
141
153
  /** The host's shadcn `Dialog`. Without it the tree offers neither Delete nor Move to… (dragging a file onto a folder still moves it). */
142
154
  readonly Dialog?: (props: FileTreeDialogProps) => ReactNode;
143
155
  }
@@ -159,6 +171,15 @@ export type UploadBlob = (file: globalThis.File, options: {
159
171
  readonly signal: AbortSignal;
160
172
  readonly onProgress: (progress: UploadProgress) => void;
161
173
  }) => Promise<unknown>;
174
+ export type FileDecorationTone = 'neutral' | 'success' | 'warning' | 'danger';
175
+ /** A row's status from the host (D-1374): a badge, read with the file's name, and a short secondary text. */
176
+ export interface FileDecoration {
177
+ readonly badge?: {
178
+ readonly label: string;
179
+ readonly tone: FileDecorationTone;
180
+ };
181
+ readonly detail?: string;
182
+ }
162
183
  export interface FileTreeProps {
163
184
  readonly components: FileTreeComponents;
164
185
  readonly revisionProvider: RevisionProvider;
@@ -201,6 +222,8 @@ export interface FileTreeProps {
201
222
  readonly onRenamed?: (from: string, to: string) => void;
202
223
  /** A delete from the tree committed (a host showing `path` closes it). */
203
224
  readonly onDeleted?: (path: string) => void;
225
+ /** The host's status for a row (for example « Lu · 12 lignes »); nothing, or no prop, leaves the row as it is. */
226
+ readonly decorate?: (entry: FileEntry) => FileDecoration | null | undefined;
204
227
  }
205
228
  /** One borrowed binding powers browsing, search, upload and history. Historical previews never replace an editor's draft. */
206
229
  export declare function FileTree(props: FileTreeProps): import("react").JSX.Element;
@@ -208,5 +231,5 @@ export interface FileTreeViewProps extends Omit<FileTreeProps, 'revisionProvider
208
231
  readonly controller: FileTreeController;
209
232
  }
210
233
  /** Renders a borrowed controller, for a workspace whose chat and tree share upload state. */
211
- export declare function FileTreeView({ components, controller, onOpen, selectedPath, className, uploadDirectory, locale, labels: given, upload, history, refresh, variant, title, onClose, refreshKey, historyKey, maxBytes, tooLarge, uploadBlob, capabilities, onRenamed, onDeleted }: FileTreeViewProps): import("react").JSX.Element;
234
+ export declare function FileTreeView({ components, controller, onOpen, selectedPath, className, uploadDirectory, locale, labels: given, upload, history, refresh, variant, title, onClose, refreshKey, historyKey, maxBytes, tooLarge, uploadBlob, capabilities, onRenamed, onDeleted, decorate }: FileTreeViewProps): import("react").JSX.Element;
212
235
  //# sourceMappingURL=file-tree-view.d.ts.map
@@ -171,7 +171,7 @@ function BoundFileTree(props) {
171
171
  return owned?.provider === props.revisionProvider ? _jsx(FileTreeView, { ...props, controller: owned.controller }) : _jsx("p", { role: "status", children: props.labels?.loading ?? LOCALES[props.locale ?? 'en'].loading });
172
172
  }
173
173
  /** Renders a borrowed controller, for a workspace whose chat and tree share upload state. */
174
- export function FileTreeView({ components, controller, onOpen, selectedPath, className, uploadDirectory = 'uploads', locale = 'en', labels: given, upload = true, history = true, refresh = true, variant = 'list', title, onClose, refreshKey, historyKey, maxBytes, tooLarge, uploadBlob, capabilities, onRenamed, onDeleted }) {
174
+ export function FileTreeView({ components, controller, onOpen, selectedPath, className, uploadDirectory = 'uploads', locale = 'en', labels: given, upload = true, history = true, refresh = true, variant = 'list', title, onClose, refreshKey, historyKey, maxBytes, tooLarge, uploadBlob, capabilities, onRenamed, onDeleted, decorate }) {
175
175
  const changed = useRef({ onRenamed, onDeleted });
176
176
  changed.current = { onRenamed, onDeleted };
177
177
  /** Tell the host about a committed rename or delete, so a viewer showing the file follows or closes. */
@@ -184,7 +184,7 @@ export function FileTreeView({ components, controller, onOpen, selectedPath, cla
184
184
  changed.current.onDeleted?.(mutation.path);
185
185
  return mutation;
186
186
  };
187
- const { Button, Actions, Menu: SidebarMenu, MenuItem: SidebarMenuItem, MenuSub: SidebarMenuSub, Input, Collapsible: CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, Empty, Progress, Dialog } = components;
187
+ const { Button, Actions, Menu: SidebarMenu, MenuItem: SidebarMenuItem, MenuSub: SidebarMenuSub, Input, Collapsible: CollapsibleRoot, CollapsibleTrigger, CollapsibleContent, Empty, Progress, Dialog, Badge } = components;
188
188
  const can = {
189
189
  // The client's methods turn the actions on; capabilities, when the host passes them, only narrow.
190
190
  rename: controller.actions.rename && (capabilities === undefined || capabilities.effective.includes('rename')),
@@ -471,8 +471,9 @@ export function FileTreeView({ components, controller, onOpen, selectedPath, cla
471
471
  const mutation = mutationRows.get(entry.path);
472
472
  const changeable = mutable(entry);
473
473
  const draggable = changeable && can.rename && !folder;
474
+ const decoration = decorate?.(entry) ?? undefined;
474
475
  const button = _jsxs(Button, { type: "button", variant: selectedPath === entry.path ? 'secondary' : 'ghost', "data-active": selectedPath === entry.path, tabIndex: -1, title: entry.path, disabled: temporary, className: "file-tree-row-button", draggable: draggable || undefined, onClick: () => { focus(entry.path); if (!folder)
475
- onOpen?.(entry.path); }, children: [folder ? _jsx(ChevronRight, { "aria-hidden": "true" }) : list && _jsx("span", { className: "file-tree-chevron-space", "aria-hidden": "true" }), _jsx(Icon, { "aria-hidden": "true" }), _jsxs("span", { className: "file-tree-copy", children: [_jsx("span", { className: "file-tree-name", children: name }), list ? folder ? childCount !== undefined && _jsx("span", { "data-file-meta": true, children: childCount }) : _jsxs("span", { "data-file-meta": true, children: [kind.label, " \u00B7 ", fileSize(blob?.size ?? entry.size, locale), parent && ` · ${parent}`] }) : parent && _jsx("span", { className: "file-tree-parent", "data-file-meta": true, children: parent })] })] });
476
+ onOpen?.(entry.path); }, children: [folder ? _jsx(ChevronRight, { "aria-hidden": "true" }) : list && _jsx("span", { className: "file-tree-chevron-space", "aria-hidden": "true" }), _jsx(Icon, { "aria-hidden": "true" }), _jsxs("span", { className: "file-tree-copy", children: [_jsx("span", { className: "file-tree-name", children: name }), list ? folder ? childCount !== undefined && _jsx("span", { "data-file-meta": true, children: childCount }) : _jsxs("span", { "data-file-meta": true, children: [kind.label, " \u00B7 ", fileSize(blob?.size ?? entry.size, locale), parent && ` · ${parent}`] }) : parent && _jsx("span", { className: "file-tree-parent", "data-file-meta": true, children: parent }), decoration?.detail && _jsx("span", { "data-file-detail": true, children: decoration.detail })] })] });
476
477
  const editing = renaming?.path === entry.path && can.rename;
477
478
  const mutationFailed = mutation?.state.kind === 'settled';
478
479
  const item = _jsxs(SidebarMenuItem, { role: "treeitem", "data-path": entry.path, "data-blob-type": blob?.type, "data-upload-state": status?.kind, "data-mutation-state": mutation ? mutationFailed ? 'failed' : 'pending' : undefined, "data-drop-target": folder && dropTarget === entry.path ? 'true' : undefined, "data-dragging": dragged === entry.path || undefined, "aria-busy": status?.kind === 'pending' || mutation?.state.kind === 'pending' || undefined, ...(folder ? dropHandlers(entry.path) : {}), ...(draggable ? {
@@ -503,7 +504,10 @@ export function FileTreeView({ components, controller, onOpen, selectedPath, cla
503
504
  },
504
505
  // Focus moved somewhere on purpose cancels; a closing menu that drops focus (no related target) does not.
505
506
  onBlur: event => { if (event.relatedTarget)
506
- setRenaming(current => current?.path === entry.path ? undefined : current); } })] }) : folder ? _jsx(CollapsibleTrigger, { render: button }) : button, (status?.kind === 'pending' || mutation?.state.kind === 'pending') && _jsx(LoaderCircle, { "data-upload-spinner": status ? '' : undefined, "data-mutation-spinner": mutation ? '' : undefined, className: "animate-spin motion-reduce:animate-none", "aria-hidden": "true" }), status?.kind === 'failed' && _jsx(Button, { type: "button", variant: "ghost", "data-upload-retry": true, "aria-label": status.retryLabel, onClick: status.retry, children: status.retryLabel }), mutation && mutationFailed && _jsx(Button, { type: "button", variant: "ghost", size: "icon", "data-mutation-dismiss": true, "aria-label": labels.dismiss(entry.path), title: labels.dismiss(entry.path), onClick: () => controller.dismiss(mutation.operationId), children: _jsx(X, { "aria-hidden": "true" }) }), !temporary && !status && !editing && mutation?.state.kind !== 'pending' && (!folder || changeable && (can.rename || can.delete)) && _jsx(FileActions, { Actions: Actions, controller: controller, entry: entry, labels: labels, onOpen: onOpen && !folder ? () => onOpen(entry.path) : undefined, onHistory: history && !folder ? () => setHistoryPath(entry.path) : undefined, onError: setUploadError, onRename: changeable && can.rename && renameable(entry) ? () => startRename(entry.path) : undefined, onMove: changeable && can.rename && Dialog ? () => ask('move', entry.path) : undefined, onDelete: changeable && can.delete ? () => ask('delete', entry.path) : undefined })] }), status?.kind === 'failed' && _jsx("span", { "data-upload-error": true, children: status.reason }), editing && renaming?.error && _jsx("span", { "data-mutation-error": true, role: "alert", children: renaming.error }), mutation && mutationFailed && _jsx("span", { "data-mutation-error": true, children: mutationReason(mutation) }), folder && !state.query && _jsx(CollapsibleContent, { render: _jsx(SidebarMenuSub, { role: "group" }), children: renderEntries(entry.path, level + 1) })] }, entry.path);
507
+ setRenaming(current => current?.path === entry.path ? undefined : current); } })] }) : folder ? _jsx(CollapsibleTrigger, { render: button }) : button, decoration?.badge && !editing && (() => {
508
+ const badge = { tone: decoration.badge.tone, children: decoration.badge.label, role: 'note', 'aria-label': `${name}: ${decoration.badge.label}`, title: decoration.badge.label, 'data-file-badge': '', 'data-tone': decoration.badge.tone };
509
+ return Badge ? _jsx(Badge, { ...badge }) : _jsx("span", { role: badge.role, "aria-label": badge['aria-label'], title: badge.title, "data-file-badge": "", "data-tone": badge.tone, children: badge.children });
510
+ })(), (status?.kind === 'pending' || mutation?.state.kind === 'pending') && _jsx(LoaderCircle, { "data-upload-spinner": status ? '' : undefined, "data-mutation-spinner": mutation ? '' : undefined, className: "animate-spin motion-reduce:animate-none", "aria-hidden": "true" }), status?.kind === 'failed' && _jsx(Button, { type: "button", variant: "ghost", "data-upload-retry": true, "aria-label": status.retryLabel, onClick: status.retry, children: status.retryLabel }), mutation && mutationFailed && _jsx(Button, { type: "button", variant: "ghost", size: "icon", "data-mutation-dismiss": true, "aria-label": labels.dismiss(entry.path), title: labels.dismiss(entry.path), onClick: () => controller.dismiss(mutation.operationId), children: _jsx(X, { "aria-hidden": "true" }) }), !temporary && !status && !editing && mutation?.state.kind !== 'pending' && (!folder || changeable && (can.rename || can.delete)) && _jsx(FileActions, { Actions: Actions, controller: controller, entry: entry, labels: labels, onOpen: onOpen && !folder ? () => onOpen(entry.path) : undefined, onHistory: history && !folder ? () => setHistoryPath(entry.path) : undefined, onError: setUploadError, onRename: changeable && can.rename && renameable(entry) ? () => startRename(entry.path) : undefined, onMove: changeable && can.rename && Dialog ? () => ask('move', entry.path) : undefined, onDelete: changeable && can.delete ? () => ask('delete', entry.path) : undefined })] }), status?.kind === 'failed' && _jsx("span", { "data-upload-error": true, children: status.reason }), editing && renaming?.error && _jsx("span", { "data-mutation-error": true, role: "alert", children: renaming.error }), mutation && mutationFailed && _jsx("span", { "data-mutation-error": true, children: mutationReason(mutation) }), folder && !state.query && _jsx(CollapsibleContent, { render: _jsx(SidebarMenuSub, { role: "group" }), children: renderEntries(entry.path, level + 1) })] }, entry.path);
507
511
  return folder ? _jsx(CollapsibleRoot, { render: item, open: state.expanded.has(entry.path), onOpenChange: () => { void controller.toggle(entry.path); } }, entry.path) : item;
508
512
  };
509
513
  const visibleListing = state.query ? state.search : state.directories.get('');
@@ -0,0 +1,3 @@
1
+ /** The viewer's script text, run only inside the drawing viewer's sandboxed frame. */
2
+ export declare const DRAWIO_VIEWER_SCRIPT: string;
3
+ //# sourceMappingURL=drawio-viewer-static.d.ts.map