@vertesia/ui 0.81.0 → 0.81.1

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 (111) hide show
  1. package/lib/esm/core/components/shadcn/dialog.js +7 -3
  2. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  3. package/lib/esm/core/components/shadcn/popover.js +3 -1
  4. package/lib/esm/core/components/shadcn/popover.js.map +1 -1
  5. package/lib/esm/core/components/shadcn/selectBox.js +1 -1
  6. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  7. package/lib/esm/core/components/shadcn/tooltip.js +5 -1
  8. package/lib/esm/core/components/shadcn/tooltip.js.map +1 -1
  9. package/lib/esm/features/agent/PayloadBuilder.js +22 -0
  10. package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
  11. package/lib/esm/features/agent/chat/ModernAgentConversation.js +6 -62
  12. package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
  13. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +1 -1
  14. package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  15. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +1 -1
  16. package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
  17. package/lib/esm/features/facets/AgentRunnerFacetsNav.js +86 -0
  18. package/lib/esm/features/facets/AgentRunnerFacetsNav.js.map +1 -0
  19. package/lib/esm/features/facets/index.js +1 -0
  20. package/lib/esm/features/facets/index.js.map +1 -1
  21. package/lib/esm/features/store/collections/CreateCollection.js +1 -1
  22. package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
  23. package/lib/esm/features/store/collections/EditCollectionView.js +4 -6
  24. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  25. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +25 -39
  26. package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -1
  27. package/lib/esm/features/store/objects/components/useContentPanelHooks.js +3 -3
  28. package/lib/esm/features/store/objects/components/useContentPanelHooks.js.map +1 -1
  29. package/lib/esm/features/store/types/ObjectSchemaEditor.js +4 -6
  30. package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
  31. package/lib/esm/features/store/types/TableLayoutEditor.js +4 -6
  32. package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -1
  33. package/lib/esm/widgets/index.js +1 -1
  34. package/lib/esm/widgets/index.js.map +1 -1
  35. package/lib/esm/widgets/json-view/JSONCode.js +16 -151
  36. package/lib/esm/widgets/json-view/JSONCode.js.map +1 -1
  37. package/lib/esm/widgets/{codemirror → monacoEditor}/MonacoEditor.js +18 -6
  38. package/lib/esm/widgets/monacoEditor/MonacoEditor.js.map +1 -0
  39. package/lib/esm/widgets/monacoEditor/index.js +2 -0
  40. package/lib/esm/widgets/monacoEditor/index.js.map +1 -0
  41. package/lib/tsconfig.tsbuildinfo +1 -1
  42. package/lib/types/core/components/shadcn/dialog.d.ts.map +1 -1
  43. package/lib/types/core/components/shadcn/popover.d.ts.map +1 -1
  44. package/lib/types/core/components/shadcn/tooltip.d.ts.map +1 -1
  45. package/lib/types/features/agent/PayloadBuilder.d.ts +1 -0
  46. package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
  47. package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
  48. package/lib/types/features/facets/AgentRunnerFacetsNav.d.ts +14 -0
  49. package/lib/types/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -0
  50. package/lib/types/features/facets/index.d.ts +1 -0
  51. package/lib/types/features/facets/index.d.ts.map +1 -1
  52. package/lib/types/features/store/collections/EditCollectionView.d.ts.map +1 -1
  53. package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts.map +1 -1
  54. package/lib/types/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -1
  55. package/lib/types/features/store/types/ObjectSchemaEditor.d.ts.map +1 -1
  56. package/lib/types/features/store/types/TableLayoutEditor.d.ts.map +1 -1
  57. package/lib/types/widgets/index.d.ts +1 -1
  58. package/lib/types/widgets/index.d.ts.map +1 -1
  59. package/lib/types/widgets/json-view/JSONCode.d.ts +2 -19
  60. package/lib/types/widgets/json-view/JSONCode.d.ts.map +1 -1
  61. package/lib/types/widgets/{codemirror → monacoEditor}/MonacoEditor.d.ts +6 -3
  62. package/lib/types/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -0
  63. package/lib/types/widgets/monacoEditor/index.d.ts +3 -0
  64. package/lib/types/widgets/monacoEditor/index.d.ts.map +1 -0
  65. package/lib/vertesia-ui-core.js +1 -1
  66. package/lib/vertesia-ui-core.js.map +1 -1
  67. package/lib/vertesia-ui-features.js +1 -1
  68. package/lib/vertesia-ui-features.js.map +1 -1
  69. package/lib/vertesia-ui-widgets.js +1 -1
  70. package/lib/vertesia-ui-widgets.js.map +1 -1
  71. package/package.json +6 -10
  72. package/src/core/components/shadcn/calendar.tsx +2 -2
  73. package/src/core/components/shadcn/dialog.tsx +23 -19
  74. package/src/core/components/shadcn/filters/index.ts +1 -1
  75. package/src/core/components/shadcn/popover.tsx +3 -1
  76. package/src/core/components/shadcn/selectBox.tsx +2 -2
  77. package/src/core/components/shadcn/tooltip.tsx +20 -16
  78. package/src/features/agent/PayloadBuilder.tsx +28 -0
  79. package/src/features/agent/chat/ModernAgentConversation.tsx +6 -104
  80. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +1 -1
  81. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +1 -1
  82. package/src/features/facets/AgentRunnerFacetsNav.tsx +125 -0
  83. package/src/features/facets/index.ts +1 -0
  84. package/src/features/store/collections/CreateCollection.tsx +1 -1
  85. package/src/features/store/collections/EditCollectionView.tsx +10 -8
  86. package/src/features/store/objects/components/PropertiesEditorModal.tsx +36 -51
  87. package/src/features/store/objects/components/useContentPanelHooks.ts +3 -3
  88. package/src/features/store/types/ObjectSchemaEditor.tsx +9 -7
  89. package/src/features/store/types/TableLayoutEditor.tsx +9 -7
  90. package/src/session/auth/auth-flow.md +1094 -0
  91. package/src/widgets/index.ts +1 -1
  92. package/src/widgets/json-view/JSONCode.tsx +30 -172
  93. package/src/widgets/{codemirror → monacoEditor}/MonacoEditor.tsx +30 -10
  94. package/src/widgets/monacoEditor/index.ts +3 -0
  95. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js +0 -103
  96. package/lib/esm/widgets/codemirror/CodeMirrorEditor.js.map +0 -1
  97. package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js +0 -33
  98. package/lib/esm/widgets/codemirror/CodemirrorStateSingleton.js.map +0 -1
  99. package/lib/esm/widgets/codemirror/MonacoEditor.js.map +0 -1
  100. package/lib/esm/widgets/codemirror/index.js +0 -3
  101. package/lib/esm/widgets/codemirror/index.js.map +0 -1
  102. package/lib/types/widgets/codemirror/CodeMirrorEditor.d.ts +0 -24
  103. package/lib/types/widgets/codemirror/CodeMirrorEditor.d.ts.map +0 -1
  104. package/lib/types/widgets/codemirror/CodemirrorStateSingleton.d.ts +0 -15
  105. package/lib/types/widgets/codemirror/CodemirrorStateSingleton.d.ts.map +0 -1
  106. package/lib/types/widgets/codemirror/MonacoEditor.d.ts.map +0 -1
  107. package/lib/types/widgets/codemirror/index.d.ts +0 -5
  108. package/lib/types/widgets/codemirror/index.d.ts.map +0 -1
  109. package/src/widgets/codemirror/CodeMirrorEditor.tsx +0 -122
  110. package/src/widgets/codemirror/CodemirrorStateSingleton.tsx +0 -39
  111. package/src/widgets/codemirror/index.ts +0 -6
@@ -6,14 +6,14 @@ import {
6
6
  ModalBody,
7
7
  ModalFooter,
8
8
  ModalTitle,
9
- useToast
9
+ useToast,
10
+ useTheme
10
11
  } from '@vertesia/ui/core';
11
12
  import { ContentObject } from '@vertesia/common';
12
13
  import { useNavigate } from "@vertesia/ui/router";
13
14
 
14
- // Import Monaco Editor
15
- import Editor, { Monaco } from '@monaco-editor/react';
16
- import { editor } from 'monaco-editor';
15
+ // Import Monaco Editor wrapper
16
+ import { MonacoEditor, IEditorApi } from '@vertesia/ui/widgets';
17
17
 
18
18
  // Import SaveVersionConfirmModal
19
19
  import { SaveVersionConfirmModal } from './SaveVersionConfirmModal';
@@ -28,13 +28,13 @@ export interface PropertiesEditorModalProps {
28
28
  export function PropertiesEditorModal({ isOpen, onClose, object, refetch }: PropertiesEditorModalProps) {
29
29
  const { client, store } = useUserSession();
30
30
  const toast = useToast();
31
+ const { theme } = useTheme();
31
32
  const navigate = useNavigate();
32
33
  const [isLoading, setIsLoading] = useState(false);
33
34
  const [propertiesJson, setPropertiesJson] = useState('');
34
35
  const [showConfirmation, setShowConfirmation] = useState(false);
35
36
  const [parsedProperties, setParsedProperties] = useState<any>(null);
36
- const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null);
37
- const monacoRef = useRef<Monaco | null>(null);
37
+ const editorRef = useRef<IEditorApi | undefined>(undefined);
38
38
  const [jsonSchema, setJsonSchema] = useState<any>(null);
39
39
  //TODO state not used
40
40
  const [_newVersionId, setNewVersionId] = useState<string | null>(null);
@@ -51,47 +51,33 @@ export function PropertiesEditorModal({ isOpen, onClose, object, refetch }: Prop
51
51
  }
52
52
  }, [isOpen, object]);
53
53
 
54
- // Handle editor mounting
55
- function handleEditorDidMount(editor: editor.IStandaloneCodeEditor, monaco: Monaco) {
56
- editorRef.current = editor;
57
- monacoRef.current = monaco;
58
-
59
- // Apply JSON schema validation if available
60
- if (jsonSchema) {
61
- setMonacoJsonSchema(monaco, jsonSchema);
62
- }
63
- }
64
-
65
54
  // Fetch JSON schema for the object type
66
55
  async function fetchJsonSchema(typeId: string) {
67
56
  try {
68
57
  const typeDetails = await store.types.retrieve(typeId);
69
58
  if (typeDetails.object_schema) {
70
59
  setJsonSchema(typeDetails.object_schema);
71
-
72
- // Apply schema if Monaco is already mounted
73
- if (monacoRef.current) {
74
- setMonacoJsonSchema(monacoRef.current, typeDetails.object_schema);
75
- }
76
60
  }
77
61
  } catch (error) {
78
62
  console.error('Failed to fetch JSON schema:', error);
79
63
  }
80
64
  }
81
65
 
82
- // Configure Monaco editor with JSON schema
83
- function setMonacoJsonSchema(monaco: Monaco, schema: any) {
84
- monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
85
- validate: true,
86
- schemas: [
87
- {
88
- uri: 'http://myserver/object-schema.json',
89
- fileMatch: ['*'],
90
- schema
91
- }
92
- ]
93
- });
94
- }
66
+ // Configure Monaco editor with JSON schema validation
67
+ const beforeMount = (monaco: typeof import('monaco-editor')) => {
68
+ if (jsonSchema) {
69
+ monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
70
+ validate: true,
71
+ schemas: [
72
+ {
73
+ uri: 'http://myserver/object-schema.json',
74
+ fileMatch: ['*'],
75
+ schema: jsonSchema
76
+ }
77
+ ]
78
+ });
79
+ }
80
+ };
95
81
 
96
82
  // Validate JSON and open confirmation modal
97
83
  function handleSave() {
@@ -113,6 +99,11 @@ export function PropertiesEditorModal({ isOpen, onClose, object, refetch }: Prop
113
99
  }
114
100
  }
115
101
 
102
+ // Handle editor changes
103
+ const handleEditorChange = (value: string) => {
104
+ setPropertiesJson(value);
105
+ };
106
+
116
107
  // Save properties
117
108
  async function saveProperties(createVersion: boolean, versionLabel?: string) {
118
109
  try {
@@ -170,11 +161,11 @@ export function PropertiesEditorModal({ isOpen, onClose, object, refetch }: Prop
170
161
  description: 'The object properties have been updated successfully.',
171
162
  duration: 2000
172
163
  });
173
-
164
+
174
165
  if (refetch) {
175
166
  await refetch();
176
167
  }
177
-
168
+
178
169
  setShowConfirmation(false);
179
170
  onClose();
180
171
  }
@@ -214,21 +205,15 @@ export function PropertiesEditorModal({ isOpen, onClose, object, refetch }: Prop
214
205
  <span className="ml-2 text-green-600">(JSON schema validation enabled)</span>
215
206
  )}
216
207
  </div>
217
- <div className="h-[75vh] border border-gray-300 dark:border-gray-700 rounded-md">
218
- <Editor
219
- height="100%"
220
- language="json"
208
+ <div className="h-[75vh] border rounded-md overflow-hidden">
209
+ <MonacoEditor
221
210
  value={propertiesJson}
222
- onChange={(value) => setPropertiesJson(value || '')}
223
- onMount={handleEditorDidMount}
224
- options={{
225
- minimap: { enabled: false },
226
- scrollBeyondLastLine: false,
227
- formatOnPaste: true,
228
- formatOnType: true,
229
- automaticLayout: true,
230
- wordWrap: 'on'
231
- }}
211
+ language="json"
212
+ editorRef={editorRef}
213
+ onChange={(update) => handleEditorChange(update.state.doc.toString())}
214
+ beforeMount={beforeMount}
215
+ theme={theme === 'dark' ? 'vs-dark' : 'vs'}
216
+ minLines={40}
232
217
  />
233
218
  </div>
234
219
  </ModalBody>
@@ -1,6 +1,6 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { useUserSession } from "@vertesia/ui/session";
3
1
  import { DocAnalyzerProgress, DocProcessorOutputFormat, MarkdownRenditionFormat, WorkflowExecutionStatus } from "@vertesia/common";
2
+ import { useUserSession } from "@vertesia/ui/session";
3
+ import { useCallback, useEffect, useState } from "react";
4
4
 
5
5
  // Maximum text size before cropping (128K characters)
6
6
  const MAX_TEXT_DISPLAY_SIZE = 128 * 1024;
@@ -29,7 +29,7 @@ export function useObjectText(objectId: string, initialText?: string, loadOnMoun
29
29
  .getObjectText(objectId)
30
30
  .then((res) => {
31
31
  setFullText(res.text);
32
- if (res.text.length > MAX_TEXT_DISPLAY_SIZE) {
32
+ if (res.text && res.text.length > MAX_TEXT_DISPLAY_SIZE) {
33
33
  setDisplayText(res.text.substring(0, MAX_TEXT_DISPLAY_SIZE));
34
34
  setIsCropped(true);
35
35
  } else {
@@ -1,15 +1,11 @@
1
- import { basicSetup } from 'codemirror';
2
1
  import { useMemo, useRef, useState } from 'react';
3
2
 
4
3
  import { useUserSession } from '@vertesia/ui/session';
5
- import { json } from '@codemirror/lang-json';
6
- import { CodeMirrorEditor, EditorApi, SchemaEditor, useSchema } from '@vertesia/ui/widgets';
7
- import { Button, useToast } from '@vertesia/ui/core';
4
+ import { MonacoEditor, EditorApi, SchemaEditor, useSchema } from '@vertesia/ui/widgets';
5
+ import { Button, useToast, useTheme } from '@vertesia/ui/core';
8
6
  import { ContentObjectType } from '@vertesia/common';
9
7
  import { Ajv } from "ajv";
10
8
 
11
- const CODE_MIRROR_EXTENSIONS = [basicSetup, json()];
12
-
13
9
  interface ObjectSchemaEditorProps {
14
10
  objectType: ContentObjectType;
15
11
  onSchemaUpdate: (jsonSchema: any) => void;
@@ -17,6 +13,7 @@ interface ObjectSchemaEditorProps {
17
13
  export function ObjectSchemaEditor({ objectType, onSchemaUpdate }: ObjectSchemaEditorProps) {
18
14
  const { store } = useUserSession();
19
15
  const toast = useToast();
16
+ const { theme } = useTheme();
20
17
 
21
18
  const [isUpdating, setUpdating] = useState(false);
22
19
  const schema = useSchema(objectType.object_schema);
@@ -103,7 +100,12 @@ export function ObjectSchemaEditor({ objectType, onSchemaUpdate }: ObjectSchemaE
103
100
  <div className="px-4 py-2">
104
101
  {
105
102
  displayJson
106
- ? <CodeMirrorEditor value={value} extensions={CODE_MIRROR_EXTENSIONS} editorRef={editorRef} />
103
+ ? <MonacoEditor
104
+ value={value}
105
+ language="json"
106
+ editorRef={editorRef}
107
+ theme={theme === 'dark' ? 'vs-dark' : 'vs'}
108
+ />
107
109
  : <SchemaEditor schema={schema} />
108
110
  }
109
111
  </div>
@@ -1,12 +1,8 @@
1
- import { basicSetup } from 'codemirror';
2
1
  import { useMemo, useRef, useState } from 'react';
3
- import { json } from '@codemirror/lang-json';
4
2
  import { ColumnLayout, ContentObjectType } from '@vertesia/common';
5
- import { Button, useToast } from '@vertesia/ui/core';
3
+ import { Button, useToast, useTheme } from '@vertesia/ui/core';
6
4
  import { useUserSession } from '@vertesia/ui/session';
7
- import { CodeMirrorEditor, EditorApi } from '@vertesia/ui/widgets';
8
-
9
- const extensions = [basicSetup, json()];
5
+ import { MonacoEditor, EditorApi } from '@vertesia/ui/widgets';
10
6
 
11
7
  interface TableLayoutEditorProps {
12
8
  objectType: ContentObjectType;
@@ -14,6 +10,7 @@ interface TableLayoutEditorProps {
14
10
  }
15
11
  export function TableLayoutEditor({ objectType, onLayoutUpdate }: TableLayoutEditorProps) {
16
12
  const toast = useToast();
13
+ const { theme } = useTheme();
17
14
 
18
15
  const [isUpdating, setUpdating] = useState(false);
19
16
  const { store } = useUserSession();
@@ -89,7 +86,12 @@ export function TableLayoutEditor({ objectType, onLayoutUpdate }: TableLayoutEdi
89
86
  </div>
90
87
  </div>
91
88
  <div className="px-4 py-2">
92
- <CodeMirrorEditor value={value} extensions={extensions} editorRef={editorRef} />
89
+ <MonacoEditor
90
+ value={value}
91
+ language="json"
92
+ editorRef={editorRef}
93
+ theme={theme === 'dark' ? 'vs-dark' : 'vs'}
94
+ />
93
95
  </div>
94
96
  </div>
95
97
  )