@openviking/react 0.1.5 → 0.1.6

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 (101) hide show
  1. package/README.md +13 -11
  2. package/dist/37~0.js +27 -0
  3. package/dist/3c~0.js +14 -8
  4. package/dist/3~0.js +1 -1
  5. package/dist/a~0.js +2 -2
  6. package/dist/ck~0.js +4 -0
  7. package/dist/client/paths.d.ts +4 -0
  8. package/dist/components/agent-connect/style.css +48 -4
  9. package/dist/components/directory-tour/style.css +46 -2
  10. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  11. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  12. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  13. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  14. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  15. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  16. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  17. package/dist/components/experience-dashboard/index.d.ts +2 -0
  18. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  19. package/dist/components/experience-dashboard/style.css +699 -0
  20. package/dist/components/experience-dashboard/style.js +0 -0
  21. package/dist/components/experience-dashboard/types.d.ts +106 -0
  22. package/dist/components/experience-dashboard.js +1 -0
  23. package/dist/components/file-browser-entries/style.css +144 -12
  24. package/dist/components/file-preview/style.css +48 -4
  25. package/dist/components/file-tree/style.css +63 -4
  26. package/dist/components/scope-switcher/style.css +48 -4
  27. package/dist/components/scope-switcher.js +1 -1
  28. package/dist/components/style.css +2168 -84
  29. package/dist/components/tui/style.css +122 -36
  30. package/dist/components/viking-bot/style.css +159 -12
  31. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  32. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  33. package/dist/components/wiki-dashboard/style.css +741 -0
  34. package/dist/components/wiki-dashboard/style.js +0 -0
  35. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  36. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  37. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  38. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  39. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  40. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  41. package/dist/components/wiki-dashboard.js +1 -0
  42. package/dist/c~0.js +1 -1
  43. package/dist/fi~0.js +354 -0
  44. package/dist/fj~0.js +503 -0
  45. package/dist/f~0.js +661 -315
  46. package/dist/icons/index.d.ts +28 -0
  47. package/dist/icons.js +1 -1
  48. package/dist/index.d.ts +4 -0
  49. package/dist/index.js +3 -1
  50. package/dist/k~0.js +277 -1
  51. package/dist/lk~0.js +52 -13
  52. package/dist/l~0.js +1021 -118
  53. package/dist/modules/console/index.d.ts +1 -2
  54. package/dist/modules/console/style.css +377 -56
  55. package/dist/modules/console.js +1 -1
  56. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  57. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  58. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  59. package/dist/modules/file-browser/dashboard-model.d.ts +14 -0
  60. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  61. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  62. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  63. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  64. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +3 -2
  65. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  66. package/dist/modules/file-browser/fs-directories.d.ts +8 -0
  67. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  68. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  69. package/dist/modules/file-browser/fs-model.d.ts +12 -2
  70. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  71. package/dist/modules/file-browser/fs-selection.d.ts +4 -0
  72. package/dist/modules/file-browser/index.d.ts +2 -2
  73. package/dist/modules/file-browser/style.css +1768 -24
  74. package/dist/modules/file-browser/types.d.ts +62 -0
  75. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  76. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  77. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  78. package/dist/modules/file-browser/use-file-browser.d.ts +2 -45
  79. package/dist/modules/file-browser/use-fs-tree.d.ts +2 -0
  80. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  81. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  82. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  83. package/dist/modules/file-browser.js +1 -1
  84. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  85. package/dist/modules/scope-cascade/index.d.ts +1 -2
  86. package/dist/modules/scope-cascade/scope-cascade.d.ts +1 -1
  87. package/dist/modules/scope-cascade/style.css +48 -4
  88. package/dist/modules/scope-cascade/types.d.ts +8 -3
  89. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  90. package/dist/modules/scope-cascade.js +1 -1
  91. package/dist/modules/style.css +2344 -191
  92. package/dist/n~0.js +13 -129
  93. package/dist/rt~0.js +152 -0
  94. package/dist/r~0.js +17 -38
  95. package/dist/shared/components/popover/popover.d.ts +1 -1
  96. package/dist/shared/components/popover/types.d.ts +7 -1
  97. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  98. package/dist/static/image/dashboard-background.png +0 -0
  99. package/dist/style.css +8897 -4616
  100. package/dist/viking-bot-composer~0.js +1 -1
  101. package/package.json +12 -2
@@ -29,7 +29,35 @@ export declare const PdfIcon: IconComponent;
29
29
  export declare const PptIcon: IconComponent;
30
30
  export declare const VideoIcon: IconComponent;
31
31
  export declare const WordIcon: IconComponent;
32
+ export declare const ExperienceBoardIcon: IconComponent;
33
+ export declare const WikiBoardIcon: IconComponent;
34
+ export declare const WikiConflictBoardIcon: IconComponent;
35
+ export declare const SpaceIcon: IconComponent;
36
+ export declare const UserIcon: IconComponent;
37
+ /**
38
+ * 库的默认图标:14 × 14 的圆形渐变块。装饰性图形,不进入可访问性树。
39
+ *
40
+ * `name` 决定取哪一种渐变,同一个名字始终一致;不传时取第一种。
41
+ *
42
+ * The default library icon: a 14 × 14 round gradient swatch. It is decorative and
43
+ * stays out of the accessibility tree.
44
+ *
45
+ * `name` selects the gradient and always resolves the same way for one name; the
46
+ * first gradient applies when it is omitted.
47
+ */
48
+ export declare function LibraryIcon({ name }: {
49
+ name?: string;
50
+ }): import("react").JSX.Element;
32
51
  export { getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey, } from './file-type-icon.js';
33
52
  export type { FileTypeIconComponent } from './file-type-icon.js';
34
53
  export { VikingBotIcon } from './viking-bot-icons.js';
35
54
  export type { VikingBotIconName } from './viking-bot-icons.js';
55
+ export declare const WikiWarningIcon: IconComponent;
56
+ export declare const WikiBookIcon: IconComponent;
57
+ export declare const FileInputIcon: IconComponent;
58
+ export declare const ScanSearchIcon: IconComponent;
59
+ export declare const ActivityIcon: IconComponent;
60
+ export declare const WikiEditIcon: IconComponent;
61
+ export declare const WikiSuccessIcon: IconComponent;
62
+ export declare const WikiHistoryIcon: IconComponent;
63
+ export declare const WikiDiscussIcon: IconComponent;
package/dist/icons.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ArrowRightIcon, AudioIcon, ChevronRightIcon, DocumentIcon, FolderIcon, FolderOpenIcon, PdfIcon, PptIcon, VideoIcon, WordIcon, getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey } from "./k~0.js";
1
+ export { ActivityIcon, ArrowRightIcon, AudioIcon, ChevronRightIcon, DocumentIcon, ExperienceBoardIcon, FileInputIcon, FolderIcon, FolderOpenIcon, LibraryIcon, PdfIcon, PptIcon, ScanSearchIcon, SpaceIcon, UserIcon, VideoIcon, WikiBoardIcon, WikiBookIcon, WikiConflictBoardIcon, WikiDiscussIcon, WikiEditIcon, WikiHistoryIcon, WikiSuccessIcon, WikiWarningIcon, WordIcon, getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey } from "./k~0.js";
2
2
  export { VikingBotIcon } from "./lg~0.js";
package/dist/index.d.ts CHANGED
@@ -18,3 +18,7 @@ export { ScopeCascade } from './modules/scope-cascade/index.js';
18
18
  export type { ScopeCascadeProps } from './modules/scope-cascade/index.js';
19
19
  export { DirectoryTour } from './components/directory-tour/index.js';
20
20
  export type { DirectoryTourProps } from './components/directory-tour/index.js';
21
+ export { WikiDashboard } from './components/wiki-dashboard/index.js';
22
+ export type { WikiDashboardProps } from './components/wiki-dashboard/index.js';
23
+ export { ExperienceDashboard } from './components/experience-dashboard/index.js';
24
+ export type { ExperienceDashboardProps } from './components/experience-dashboard/index.js';
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  export { AgentConnect } from "./u~0.js";
2
2
  export { Console } from "./a~0.js";
3
3
  export { DirectoryTour } from "./e~0.js";
4
+ export { ExperienceDashboard } from "./f~0.js";
4
5
  export { FileBrowser } from "./l~0.js";
5
6
  export { FileBrowserEntries } from "./2~0.js";
6
7
  export { FileTree } from "./n~0.js";
7
8
  export { ScopeCascade } from "./lk~0.js";
8
- export { ScopeSelector, ScopeSwitcher } from "./f~0.js";
9
+ export { ScopeSelector, ScopeSwitcher } from "./fi~0.js";
9
10
  export { Tui } from "./3c~0.js";
10
11
  export { VikingBot } from "./c~0.js";
12
+ export { WikiDashboard } from "./fj~0.js";
package/dist/k~0.js CHANGED
@@ -1,6 +1,109 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useId } from "react";
3
3
  import "./lg~0.js";
4
+ const SvgDiscuss = (props)=>/*#__PURE__*/ jsx("svg", {
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: 14,
7
+ height: 14,
8
+ fill: "none",
9
+ viewBox: "0 0 12.928 12.867",
10
+ ...props,
11
+ children: /*#__PURE__*/ jsx("path", {
12
+ stroke: "currentColor",
13
+ strokeLinecap: "round",
14
+ strokeLinejoin: "round",
15
+ strokeWidth: 1.2,
16
+ d: "M2.988 5.983a5 5 0 0 1-.055-.716C2.933 2.689 5.036.6 7.631.6c2.594 0 4.697 2.09 4.697 4.667a4.6 4.6 0 0 1-.303 1.653c-.041.107-.061.16-.07.202a.5.5 0 0 0-.014.113c-.001.042.004.09.016.183l.235 1.908c.025.206.038.31.004.385a.3.3 0 0 1-.15.146c-.076.033-.18.018-.385-.012l-1.858-.273a1.4 1.4 0 0 0-.19-.02.5.5 0 0 0-.116.012c-.044.009-.099.03-.21.07a4.7 4.7 0 0 1-2.374.245m-3.028 2.388c1.73 0 3.132-1.437 3.132-3.209S5.615 5.85 3.885 5.85.754 7.286.754 9.058c0 .357.056.7.16 1.02.045.135.067.202.074.248a.5.5 0 0 1 .006.125c-.002.046-.014.1-.037.205L.6 12.266l1.747-.238c.095-.013.143-.02.185-.02.043.001.067.004.11.012.04.008.101.03.223.072.32.113.663.175 1.02.175"
17
+ })
18
+ });
19
+ const discussreact = SvgDiscuss;
20
+ const SvgHistory = (props)=>/*#__PURE__*/ jsx("svg", {
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ width: 12,
23
+ height: 12,
24
+ fill: "none",
25
+ viewBox: "0 0 12 12",
26
+ ...props,
27
+ children: /*#__PURE__*/ jsx("path", {
28
+ stroke: "currentColor",
29
+ strokeLinecap: "round",
30
+ strokeLinejoin: "round",
31
+ strokeWidth: 1.2,
32
+ d: "M1.5 6A4.5 4.5 0 1 0 6 1.5a4.88 4.88 0 0 0-3.37 1.37L1.5 4M4 4H1.5V1.5m4.5 2V6l2 1"
33
+ })
34
+ });
35
+ const historyreact = SvgHistory;
36
+ const SvgSuccess = (props)=>/*#__PURE__*/ jsx("svg", {
37
+ xmlns: "http://www.w3.org/2000/svg",
38
+ width: 14,
39
+ height: 14,
40
+ fill: "none",
41
+ viewBox: "0 0 14 14",
42
+ ...props,
43
+ children: /*#__PURE__*/ jsx("path", {
44
+ fill: "currentColor",
45
+ d: "M11.813 7a4.813 4.813 0 1 0-9.626 0 4.813 4.813 0 0 0 9.626 0m-2.76-1.884a.438.438 0 0 1 .619.618l-3.15 3.15a.44.44 0 0 1-.619 0L4.328 7.31a.437.437 0 1 1 .619-.618l1.265 1.265zM12.687 7A5.688 5.688 0 1 1 1.313 7a5.688 5.688 0 0 1 11.376 0"
46
+ })
47
+ });
48
+ const successreact = SvgSuccess;
49
+ const SvgEdit = (props)=>/*#__PURE__*/ jsx("svg", {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ width: 14,
52
+ height: 14,
53
+ fill: "none",
54
+ viewBox: "0 0 14 14",
55
+ ...props,
56
+ children: /*#__PURE__*/ jsx("path", {
57
+ fill: "currentColor",
58
+ d: "M9.366 2.266a1.604 1.604 0 0 1 2.268 0l.1.1a1.605 1.605 0 0 1 0 2.268l-6.758 6.759a.44.44 0 0 1-.203.115l-2.334.583a.438.438 0 0 1-.53-.53l.583-2.334.018-.056a.4.4 0 0 1 .097-.147zm2.884 8.963a.437.437 0 1 1 0 .875H7.583a.438.438 0 0 1 0-.875zM3.311 9.557l-.377 1.508 1.509-.377L9.88 5.25 8.75 4.119zm7.704-6.673a.73.73 0 0 0-1.03 0l-.616.616L10.5 4.631l.616-.615a.73.73 0 0 0 0-1.032z"
59
+ })
60
+ });
61
+ const editreact = SvgEdit;
62
+ const SvgActivity = (props)=>/*#__PURE__*/ jsx("svg", {
63
+ xmlns: "http://www.w3.org/2000/svg",
64
+ width: 14,
65
+ height: 14,
66
+ fill: "none",
67
+ viewBox: "0 0 14 14",
68
+ ...props,
69
+ children: /*#__PURE__*/ jsx("path", {
70
+ stroke: "currentColor",
71
+ strokeLinecap: "round",
72
+ strokeLinejoin: "round",
73
+ d: "M12.833 7H10.5l-1.75 5.25-3.5-10.5L3.5 7H1.167"
74
+ })
75
+ });
76
+ const activityreact = SvgActivity;
77
+ const SvgScanSearch = (props)=>/*#__PURE__*/ jsx("svg", {
78
+ xmlns: "http://www.w3.org/2000/svg",
79
+ width: 14,
80
+ height: 14,
81
+ fill: "none",
82
+ viewBox: "0 0 14 14",
83
+ ...props,
84
+ children: /*#__PURE__*/ jsx("path", {
85
+ stroke: "currentColor",
86
+ strokeLinecap: "round",
87
+ strokeLinejoin: "round",
88
+ d: "M1.75 4.083V2.917A1.167 1.167 0 0 1 2.917 1.75h1.166m5.834 0h1.166a1.167 1.167 0 0 1 1.167 1.167v1.166m0 5.834v1.166a1.167 1.167 0 0 1-1.167 1.167H9.917m-5.834 0H2.917a1.167 1.167 0 0 1-1.167-1.167V9.917m7.583-.584L8.225 8.225M8.75 7a1.75 1.75 0 1 1-3.5 0 1.75 1.75 0 0 1 3.5 0"
89
+ })
90
+ });
91
+ const scan_searchreact = SvgScanSearch;
92
+ const SvgFileInput = (props)=>/*#__PURE__*/ jsx("svg", {
93
+ xmlns: "http://www.w3.org/2000/svg",
94
+ width: 14,
95
+ height: 14,
96
+ fill: "none",
97
+ viewBox: "0 0 14 14",
98
+ ...props,
99
+ children: /*#__PURE__*/ jsx("path", {
100
+ stroke: "currentColor",
101
+ strokeLinecap: "round",
102
+ strokeLinejoin: "round",
103
+ d: "M2.333 12.833H10.5a1.167 1.167 0 0 0 1.167-1.166V4.083L8.75 1.167H3.5a1.167 1.167 0 0 0-1.167 1.166v2.334m5.834-3.5V3.5a1.167 1.167 0 0 0 1.166 1.167h2.334M1.167 8.75H7M5.25 7 7 8.75 5.25 10.5"
104
+ })
105
+ });
106
+ const file_inputreact = SvgFileInput;
4
107
  const SvgArrowRight = (props)=>/*#__PURE__*/ jsx("svg", {
5
108
  xmlns: "http://www.w3.org/2000/svg",
6
109
  width: 14,
@@ -181,6 +284,39 @@ const SvgPdf = (props)=>/*#__PURE__*/ jsxs("svg", {
181
284
  ]
182
285
  });
183
286
  const pdfreact = SvgPdf;
287
+ const SvgSpace = (props)=>/*#__PURE__*/ jsx("svg", {
288
+ xmlns: "http://www.w3.org/2000/svg",
289
+ width: 14,
290
+ height: 14,
291
+ fill: "none",
292
+ viewBox: "0 0 14 14",
293
+ ...props,
294
+ children: /*#__PURE__*/ jsx("path", {
295
+ stroke: "currentColor",
296
+ strokeLinecap: "round",
297
+ strokeLinejoin: "round",
298
+ strokeWidth: 1.2,
299
+ d: "M1.925 4.083 7 7l5.075-2.917M7 7v5.833m5.25-8.166c0-.205-.054-.406-.157-.583a1.17 1.17 0 0 0-.426-.427L7.583 1.324a1.17 1.17 0 0 0-1.167 0L2.333 3.657a1.17 1.17 0 0 0-.583 1.01v4.666a1.16 1.16 0 0 0 .583 1.009l4.084 2.334a1.17 1.17 0 0 0 1.167 0l4.083-2.334a1.17 1.17 0 0 0 .583-1.009z"
300
+ })
301
+ });
302
+ const spacereact = SvgSpace;
303
+ const SvgUser = (props)=>/*#__PURE__*/ jsx("svg", {
304
+ xmlns: "http://www.w3.org/2000/svg",
305
+ width: 14,
306
+ height: 14,
307
+ fill: "none",
308
+ viewBox: "0 0 14 14",
309
+ ...props,
310
+ children: /*#__PURE__*/ jsx("path", {
311
+ stroke: "currentColor",
312
+ strokeLinecap: "round",
313
+ strokeLinejoin: "round",
314
+ strokeWidth: 1.2,
315
+ d: "M1.75 11.667A7.58 7.58 0 0 1 7 9.333c2.038 0 3.888.888 5.25 2.334M9.625 4.375a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0"
316
+ })
317
+ });
318
+ const userreact = SvgUser;
319
+ var library_swatches_namespaceObject = /*#__PURE__*/ JSON.parse('{"z":["linear-gradient(145deg, #ffd8ec 8%, #ffabc8 46%, #d8cbff 100%)","linear-gradient(145deg, #d9e8ff 8%, #b8a6ff 52%, #f3d6ff 100%)","linear-gradient(145deg, #ffe6bc 8%, #ffaf96 48%, #ff8bc5 100%)","linear-gradient(145deg, #eaf7ba 8%, #b5efb8 52%, #73d9c6 100%)","linear-gradient(145deg, #fff1ba 8%, #ffc776 52%, #bd9cff 100%)"]}');
184
320
  const SvgPpt = (props)=>/*#__PURE__*/ jsxs("svg", {
185
321
  xmlns: "http://www.w3.org/2000/svg",
186
322
  width: 16,
@@ -236,6 +372,44 @@ const SvgVideo = (props)=>/*#__PURE__*/ jsx("svg", {
236
372
  })
237
373
  });
238
374
  const videoreact = SvgVideo;
375
+ const SvgWarning = (props)=>/*#__PURE__*/ jsx("svg", {
376
+ xmlns: "http://www.w3.org/2000/svg",
377
+ width: 14,
378
+ height: 14,
379
+ fill: "none",
380
+ overflow: "visible",
381
+ preserveAspectRatio: "none",
382
+ style: {
383
+ display: "block"
384
+ },
385
+ viewBox: "0 0 14 14",
386
+ ...props,
387
+ children: /*#__PURE__*/ jsx("path", {
388
+ fill: "currentColor",
389
+ d: "M6.344 2.034a1.62 1.62 0 0 1 1.311 0c.285.125.495.358.686.626.192.269.404.635.668 1.087l2.852 4.9c.264.451.477.816.616 1.116.139.297.237.596.204.905a1.6 1.6 0 0 1-.658 1.13c-.252.182-.56.247-.888.277-.33.03-.755.03-1.281.03H4.146c-.526 0-.951 0-1.282-.03-.328-.03-.635-.095-.887-.276a1.6 1.6 0 0 1-.658-1.13c-.033-.31.065-.609.204-.906.139-.3.352-.665.616-1.117l2.853-4.9c.263-.452.475-.817.667-1.086.19-.268.4-.5.685-.626m.958.8a.75.75 0 0 0-.604 0c-.065.03-.162.103-.326.333-.163.229-.352.552-.624 1.019l-2.854 4.9c-.271.468-.46.792-.578 1.046-.119.256-.134.376-.127.444.022.204.13.39.3.513.057.041.171.088.455.114.281.026.659.026 1.202.026h5.708c.543 0 .92 0 1.202-.026.284-.026.398-.073.456-.114a.73.73 0 0 0 .299-.513c.007-.068-.008-.188-.127-.444-.118-.254-.307-.578-.578-1.045l-2.853-4.9c-.272-.467-.462-.791-.625-1.02-.164-.23-.261-.304-.326-.332m-.74 4.75V5.25a.438.438 0 0 1 .875 0v2.333a.437.437 0 1 1-.875 0m.905 1.807a.437.437 0 0 1-.436.438h-.06a.44.44 0 0 1-.438-.437v-.059c0-.241.196-.437.438-.437h.059c.241 0 .437.196.437.437z"
390
+ })
391
+ });
392
+ const warningreact = SvgWarning;
393
+ const SvgWikiBook = (props)=>/*#__PURE__*/ jsx("svg", {
394
+ xmlns: "http://www.w3.org/2000/svg",
395
+ width: 16,
396
+ height: 16,
397
+ fill: "none",
398
+ overflow: "visible",
399
+ preserveAspectRatio: "none",
400
+ style: {
401
+ display: "block"
402
+ },
403
+ viewBox: "0 0 16 16",
404
+ ...props,
405
+ children: /*#__PURE__*/ jsx("path", {
406
+ stroke: "currentColor",
407
+ strokeLinecap: "round",
408
+ strokeLinejoin: "round",
409
+ d: "M8.056 7.556c0-1.245 0-1.867.242-2.343.213-.418.553-.758.97-.97C9.745 4 10.368 4 11.612 4h.222c.623 0 .934 0 1.171.121.21.107.38.277.486.486.121.237.121.548.121 1.17v4.779c0 .622 0 .933-.121 1.17a1.1 1.1 0 0 1-.486.486c-.237.121-.548.121-1.17.121h-.764c-.696 0-1.044 0-1.36.096-.28.085-.54.224-.765.41-.255.21-.448.499-.834 1.078L8.056 14 8 13.917c-.386-.58-.579-.869-.834-1.078a2.2 2.2 0 0 0-.765-.41c-.316-.096-.664-.096-1.36-.096h-.763c-.622 0-.934 0-1.171-.12a1.1 1.1 0 0 1-.486-.486c-.121-.238-.121-.55-.121-1.171V5.778c0-.622 0-.934.121-1.171.107-.21.277-.38.486-.486C3.344 4 3.655 4 4.277 4H4.5c1.245 0 1.867 0 2.342.242.418.213.758.553.971.971.243.476.243 1.098.243 2.343m0 6.444V7.556"
410
+ })
411
+ });
412
+ const wiki_bookreact = SvgWikiBook;
239
413
  const SvgWord = (props)=>/*#__PURE__*/ jsxs("svg", {
240
414
  xmlns: "http://www.w3.org/2000/svg",
241
415
  width: 16,
@@ -312,6 +486,75 @@ const SvgWord = (props)=>/*#__PURE__*/ jsxs("svg", {
312
486
  ]
313
487
  });
314
488
  const wordreact = SvgWord;
489
+ const SvgExperienceBoard = (props)=>/*#__PURE__*/ jsx("svg", {
490
+ xmlns: "http://www.w3.org/2000/svg",
491
+ width: 14,
492
+ height: 14,
493
+ fill: "none",
494
+ "aria-hidden": "true",
495
+ viewBox: "0 0 14 14",
496
+ ...props,
497
+ children: /*#__PURE__*/ jsx("g", {
498
+ stroke: "currentColor",
499
+ strokeLinecap: "round",
500
+ strokeLinejoin: "round",
501
+ strokeWidth: 1.2,
502
+ children: /*#__PURE__*/ jsx("path", {
503
+ d: "M5.25 1.75H2.333a.583.583 0 0 0-.583.583v4.084c0 .322.261.583.583.583H5.25a.583.583 0 0 0 .583-.583V2.333a.583.583 0 0 0-.583-.583M11.667 1.75H8.75a.583.583 0 0 0-.583.583v1.75c0 .322.26.584.583.584h2.917a.583.583 0 0 0 .583-.584v-1.75a.583.583 0 0 0-.583-.583M11.667 7H8.75a.583.583 0 0 0-.583.583v4.084c0 .322.26.583.583.583h2.917a.583.583 0 0 0 .583-.583V7.583A.583.583 0 0 0 11.667 7M5.25 9.333H2.333a.583.583 0 0 0-.583.584v1.75c0 .322.261.583.583.583H5.25a.583.583 0 0 0 .583-.583v-1.75a.583.583 0 0 0-.583-.584"
504
+ })
505
+ })
506
+ });
507
+ const experience_boardreact = SvgExperienceBoard;
508
+ const SvgWikiBoard = (props)=>/*#__PURE__*/ jsx("svg", {
509
+ xmlns: "http://www.w3.org/2000/svg",
510
+ width: 14,
511
+ height: 14,
512
+ fill: "none",
513
+ "aria-hidden": "true",
514
+ viewBox: "0 0 14 14",
515
+ ...props,
516
+ children: /*#__PURE__*/ jsx("g", {
517
+ stroke: "currentColor",
518
+ strokeLinecap: "round",
519
+ strokeLinejoin: "round",
520
+ strokeWidth: 1.2,
521
+ children: /*#__PURE__*/ jsx("path", {
522
+ d: "M5.25 1.75H2.333a.583.583 0 0 0-.583.583v4.084c0 .322.261.583.583.583H5.25a.583.583 0 0 0 .583-.583V2.333a.583.583 0 0 0-.583-.583M11.667 1.75H8.75a.583.583 0 0 0-.583.583v1.75c0 .322.26.584.583.584h2.917a.583.583 0 0 0 .583-.584v-1.75a.583.583 0 0 0-.583-.583M11.667 7H8.75a.583.583 0 0 0-.583.583v4.084c0 .322.26.583.583.583h2.917a.583.583 0 0 0 .583-.583V7.583A.583.583 0 0 0 11.667 7M5.25 9.333H2.333a.583.583 0 0 0-.583.584v1.75c0 .322.261.583.583.583H5.25a.583.583 0 0 0 .583-.583v-1.75a.583.583 0 0 0-.583-.584"
523
+ })
524
+ })
525
+ });
526
+ const wiki_boardreact = SvgWikiBoard;
527
+ const SvgWikiConflictBoard = (props)=>/*#__PURE__*/ jsxs("svg", {
528
+ xmlns: "http://www.w3.org/2000/svg",
529
+ width: 12,
530
+ height: 12,
531
+ fill: "none",
532
+ "aria-hidden": "true",
533
+ viewBox: "0 0 12 12",
534
+ ...props,
535
+ children: [
536
+ /*#__PURE__*/ jsx("path", {
537
+ stroke: "currentColor",
538
+ strokeLinecap: "round",
539
+ strokeLinejoin: "round",
540
+ strokeWidth: 0.8,
541
+ d: "M2 1.5h2.5A.5.5 0 0 1 5 2v3.5a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V2a.5.5 0 0 1 .5-.5m5.5 0H10a.5.5 0 0 1 .5.5v1.5a.5.5 0 0 1-.5.5H7.5a.5.5 0 0 1-.5-.5V2a.5.5 0 0 1 .5-.5m0 4.5H10a.5.5 0 0 1 .5.5V10a.5.5 0 0 1-.5.5H7.5A.5.5 0 0 1 7 10V6.5a.5.5 0 0 1 .5-.5M2 8h2.5a.5.5 0 0 1 .5.5V10a.5.5 0 0 1-.5.5H2a.5.5 0 0 1-.5-.5V8.5A.5.5 0 0 1 2 8"
542
+ }),
543
+ /*#__PURE__*/ jsx("path", {
544
+ fill: "var(--ov-ui-color-dashboard-surface, var(--ov-ui-color-bg-3, var(--ov-ui-bg-3-default, #f7f7f9)))",
545
+ d: "M4.5 8a4 4 0 0 1 8 0 4 4 0 0 1-4 4H4.658a.16.16 0 0 1-.158-.158z"
546
+ }),
547
+ /*#__PURE__*/ jsx("path", {
548
+ fill: "currentColor",
549
+ d: "M8.125 5.162a.93.93 0 0 1 .75 0c.162.072.282.205.39.358.11.154.232.363.383.621l1.63 2.8c.15.258.273.466.352.637.08.17.135.341.116.518a.92.92 0 0 1-.376.647c-.143.103-.32.14-.507.157-.19.017-.432.016-.732.016H6.87c-.3 0-.543.001-.732-.016-.187-.017-.364-.054-.508-.157a.92.92 0 0 1-.376-.647c-.019-.177.038-.348.117-.518s.202-.38.352-.637l1.63-2.801c.15-.258.272-.466.382-.62s.229-.286.391-.358"
550
+ }),
551
+ /*#__PURE__*/ jsx("path", {
552
+ fill: "#fff",
553
+ d: "M8.25 8.333V7a.25.25 0 0 1 .5 0v1.333a.25.25 0 0 1-.5 0m.517 1.034a.25.25 0 0 1-.25.25h-.033a.25.25 0 0 1-.25-.25v-.034a.25.25 0 0 1 .25-.25h.033a.25.25 0 0 1 .25.25z"
554
+ })
555
+ ]
556
+ });
557
+ const wiki_conflict_boardreact = SvgWikiConflictBoard;
315
558
  function NextjsIcon({ 'aria-label': ariaLabel, ...props }) {
316
559
  const gradientId = `ov-ft-nextjs-${useId().replaceAll(':', '')}`;
317
560
  return /*#__PURE__*/ jsxs("svg", {
@@ -1438,4 +1681,37 @@ const PdfIcon = createIcon(pdfreact, 'PdfIcon');
1438
1681
  const PptIcon = createIcon(pptreact, 'PptIcon');
1439
1682
  const VideoIcon = createIcon(videoreact, 'VideoIcon');
1440
1683
  const WordIcon = createIcon(wordreact, 'WordIcon');
1441
- export { ArrowRightIcon, AudioIcon, ChevronRightIcon, DocumentIcon, FolderIcon, FolderOpenIcon, PdfIcon, PptIcon, VideoIcon, WordIcon, getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey };
1684
+ const ExperienceBoardIcon = createIcon(experience_boardreact, 'ExperienceBoardIcon');
1685
+ const WikiBoardIcon = createIcon(wiki_boardreact, 'WikiBoardIcon');
1686
+ const WikiConflictBoardIcon = createIcon(wiki_conflict_boardreact, 'WikiConflictBoardIcon');
1687
+ const SpaceIcon = createIcon(spacereact, 'SpaceIcon');
1688
+ const UserIcon = createIcon(userreact, 'UserIcon');
1689
+ const LIBRARY_FALLBACKS = library_swatches_namespaceObject.z;
1690
+ function gradientOf(name) {
1691
+ const hash = Array.from(name).reduce((total, character)=>total + character.charCodeAt(0), 0);
1692
+ return hash % LIBRARY_FALLBACKS.length;
1693
+ }
1694
+ function LibraryIcon({ name = '' }) {
1695
+ const index = gradientOf(name);
1696
+ const swatch = index + 1;
1697
+ return /*#__PURE__*/ jsx("span", {
1698
+ "aria-hidden": "true",
1699
+ style: {
1700
+ display: 'block',
1701
+ width: 14,
1702
+ height: 14,
1703
+ borderRadius: '50%',
1704
+ background: `var(--ov-ui-color-library-swatch-${swatch}, var(--ov-ui-library-swatch-${swatch}-default, ${LIBRARY_FALLBACKS[index]}))`
1705
+ }
1706
+ });
1707
+ }
1708
+ const WikiWarningIcon = createIcon(warningreact, 'WikiWarningIcon');
1709
+ const WikiBookIcon = createIcon(wiki_bookreact, 'WikiBookIcon');
1710
+ const FileInputIcon = createIcon(file_inputreact, 'FileInputIcon');
1711
+ const ScanSearchIcon = createIcon(scan_searchreact, 'ScanSearchIcon');
1712
+ const ActivityIcon = createIcon(activityreact, 'ActivityIcon');
1713
+ const WikiEditIcon = createIcon(editreact, 'WikiEditIcon');
1714
+ const WikiSuccessIcon = createIcon(successreact, 'WikiSuccessIcon');
1715
+ const WikiHistoryIcon = createIcon(historyreact, 'WikiHistoryIcon');
1716
+ const WikiDiscussIcon = createIcon(discussreact, 'WikiDiscussIcon');
1717
+ export { ActivityIcon, ArrowRightIcon, AudioIcon, ChevronRightIcon, DocumentIcon, ExperienceBoardIcon, FileInputIcon, FolderIcon, FolderOpenIcon, LibraryIcon, PdfIcon, PptIcon, ScanSearchIcon, SpaceIcon, UserIcon, VideoIcon, WikiBoardIcon, WikiBookIcon, WikiConflictBoardIcon, WikiDiscussIcon, WikiEditIcon, WikiHistoryIcon, WikiSuccessIcon, WikiWarningIcon, WordIcon, getFileTypeColor, getFileTypeIcon, resolveFileTypeIconKey };
package/dist/lk~0.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState, useSyncExternalStore } from "react";
2
+ import { useEffect, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { resolveLocale } from "./nx~0.js";
4
- import { ScopeSelector, ScopeSwitcher } from "./f~0.js";
4
+ import { LibraryIcon, SpaceIcon, UserIcon } from "./k~0.js";
5
+ import { ScopeSelector, ScopeSwitcher } from "./fi~0.js";
5
6
  import { useLocale } from "./28~0.js";
6
7
  const messages = {
7
8
  levelNames: [
@@ -42,7 +43,7 @@ const empty = (enabled, parentIds = [])=>({
42
43
  scopeKey: JSON.stringify(parentIds),
43
44
  parentIds
44
45
  });
45
- function createScopeController() {
46
+ function createScopeController(onChange) {
46
47
  const snapshots = [
47
48
  empty(true),
48
49
  empty(false),
@@ -52,7 +53,21 @@ function createScopeController() {
52
53
  const requests = [];
53
54
  let api;
54
55
  let active = false;
55
- const notify = (index)=>listeners[index].forEach((listener)=>listener());
56
+ let selectionKey = '';
57
+ const notify = (index)=>{
58
+ listeners[index].forEach((listener)=>listener());
59
+ const [library, space, user] = snapshots;
60
+ const selection = library.selected && space.selected && user.selected ? {
61
+ libraryId: library.selected.id,
62
+ spaceId: space.selected.id,
63
+ userId: user.selected.id
64
+ } : null;
65
+ const key = JSON.stringify(selection);
66
+ if (key !== selectionKey) {
67
+ selectionKey = key;
68
+ onChange?.(selection);
69
+ }
70
+ };
56
71
  const update = (index, patch)=>{
57
72
  snapshots[index] = {
58
73
  ...snapshots[index],
@@ -158,8 +173,10 @@ function createScopeController() {
158
173
  }
159
174
  };
160
175
  }
161
- function useScopeCascade({ loadLibraries, loadSpaces, loadUsers }) {
162
- const [instance] = useState(createScopeController);
176
+ function useScopeCascade({ loadLibraries, loadSpaces, loadUsers }, onChange) {
177
+ const notify = useRef(onChange);
178
+ notify.current = onChange;
179
+ const [instance] = useState(()=>createScopeController((selection)=>notify.current?.(selection)));
163
180
  useEffect(()=>instance.start({
164
181
  loadLibraries,
165
182
  loadSpaces,
@@ -175,6 +192,19 @@ function useScopeCascade({ loadLibraries, loadSpaces, loadUsers }) {
175
192
  function useScopeCascadeLevel(level) {
176
193
  return useSyncExternalStore(level.subscribe, level.getSnapshot, level.getSnapshot);
177
194
  }
195
+ function defaultIcon(index, option) {
196
+ if (0 === index) return /*#__PURE__*/ jsx(LibraryIcon, {
197
+ name: option?.id ?? ''
198
+ });
199
+ return 1 === index ? /*#__PURE__*/ jsx(SpaceIcon, {}) : /*#__PURE__*/ jsx(UserIcon, {});
200
+ }
201
+ function withDefaultIcons(options, index) {
202
+ if (options.every((option)=>null != option.icon)) return options;
203
+ return options.map((option)=>null != option.icon ? option : {
204
+ ...option,
205
+ icon: defaultIcon(index, option)
206
+ });
207
+ }
178
208
  function ConnectedLevel(props) {
179
209
  const state = useScopeCascadeLevel(props.level);
180
210
  return /*#__PURE__*/ jsx(LevelView, {
@@ -182,9 +212,10 @@ function ConnectedLevel(props) {
182
212
  state: state
183
213
  }, state.scopeKey);
184
214
  }
185
- function LevelView({ level, locale, state, name, labels, retryLabel }) {
215
+ function LevelView({ index, level, locale, state, name, labels, retryLabel }) {
186
216
  const [keyword, setKeyword] = useState('');
187
217
  const text = resolveScopeCascadeLabels(locale);
218
+ const options = withDefaultIcons(state.options, index);
188
219
  return /*#__PURE__*/ jsx(ScopeSelector, {
189
220
  locale: locale,
190
221
  labels: labels,
@@ -195,13 +226,13 @@ function LevelView({ level, locale, state, name, labels, retryLabel }) {
195
226
  },
196
227
  trigger: {
197
228
  label: state.selected?.label ?? name,
198
- icon: state.selected?.icon
229
+ icon: state.selected?.icon ?? defaultIcon(index, state.selected)
199
230
  },
200
231
  data: {
201
232
  selectedId: state.selected?.id ?? '',
202
- total: state.options.length,
203
- options: state.options,
204
- visibleOptions: state.options.filter((option)=>option.label.toLocaleLowerCase().includes(keyword.toLocaleLowerCase()))
233
+ total: options.length,
234
+ options,
235
+ visibleOptions: options.filter((option)=>option.label.toLocaleLowerCase().includes(keyword.toLocaleLowerCase()))
205
236
  },
206
237
  state: {
207
238
  disabled: !state.enabled,
@@ -231,14 +262,20 @@ function LevelView({ level, locale, state, name, labels, retryLabel }) {
231
262
  }
232
263
  });
233
264
  }
234
- function ScopeCascade({ controller, locale: localeProp, labels, levelNames: names, retryLabel, ...props }) {
265
+ function ScopeCascade({ locale: localeProp, loadLibraries, loadSpaces, loadUsers, onChange, labels, levelNames: names, retryLabel, ...props }) {
235
266
  const locale = useLocale(localeProp);
236
267
  const levelNames = names ?? resolveScopeCascadeLabels(locale).levelNames;
268
+ const controller = useScopeCascade({
269
+ loadLibraries,
270
+ loadSpaces,
271
+ loadUsers
272
+ }, onChange);
237
273
  return /*#__PURE__*/ jsxs(ScopeSwitcher, {
238
274
  ...props,
239
275
  locale: locale,
240
276
  children: [
241
277
  /*#__PURE__*/ jsx(ConnectedLevel, {
278
+ index: 0,
242
279
  locale: locale,
243
280
  level: controller.levels[0],
244
281
  name: levelNames[0],
@@ -246,6 +283,7 @@ function ScopeCascade({ controller, locale: localeProp, labels, levelNames: name
246
283
  retryLabel: retryLabel
247
284
  }),
248
285
  /*#__PURE__*/ jsx(ConnectedLevel, {
286
+ index: 1,
249
287
  locale: locale,
250
288
  level: controller.levels[1],
251
289
  name: levelNames[1],
@@ -253,6 +291,7 @@ function ScopeCascade({ controller, locale: localeProp, labels, levelNames: name
253
291
  retryLabel: retryLabel
254
292
  }),
255
293
  /*#__PURE__*/ jsx(ConnectedLevel, {
294
+ index: 2,
256
295
  locale: locale,
257
296
  level: controller.levels[2],
258
297
  name: levelNames[2],
@@ -262,4 +301,4 @@ function ScopeCascade({ controller, locale: localeProp, labels, levelNames: name
262
301
  ]
263
302
  });
264
303
  }
265
- export { ScopeCascade, useScopeCascade, useScopeCascadeLevel };
304
+ export { ScopeCascade };