@djangocfg/widget-code 0.1.1 → 0.1.2
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/package.json +11 -10
- package/src/editor/context/EditorProvider.tsx +2 -0
- package/src/editor/types/index.ts +2 -0
- package/src/markdown-message/components.tsx +0 -1
- package/src/markdown-message/linkRules.ts +0 -1
- package/src/markdown-message/streamingBlocks.ts +1 -1
- package/src/pretty-code/pretty-code.stories.tsx +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/widget-code",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Code surfaces: a Monaco editor, a diff viewer, a Prism listing, a JSON editor and the markdown renderer that embeds them",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-editor",
|
|
@@ -69,14 +69,15 @@
|
|
|
69
69
|
"scripts": {
|
|
70
70
|
"check": "tsc --noEmit",
|
|
71
71
|
"check-types": "tsc --noEmit",
|
|
72
|
+
"lint": "eslint .",
|
|
72
73
|
"test": "vitest run",
|
|
73
74
|
"test:watch": "vitest"
|
|
74
75
|
},
|
|
75
76
|
"dependencies": {
|
|
76
|
-
"@djangocfg/widget-data": "^0.1.
|
|
77
|
-
"@djangocfg/widget-diagram": "^0.1.
|
|
78
|
-
"@djangocfg/widget-editor": "^0.1.
|
|
79
|
-
"@djangocfg/widget-kit": "^0.1.
|
|
77
|
+
"@djangocfg/widget-data": "^0.1.2",
|
|
78
|
+
"@djangocfg/widget-diagram": "^0.1.2",
|
|
79
|
+
"@djangocfg/widget-editor": "^0.1.2",
|
|
80
|
+
"@djangocfg/widget-kit": "^0.1.2",
|
|
80
81
|
"json-edit-react": "^1.30.2",
|
|
81
82
|
"monaco-editor": "^0.55.1",
|
|
82
83
|
"prism-react-renderer": "^2.4.1",
|
|
@@ -92,16 +93,16 @@
|
|
|
92
93
|
"remark-smartypants": "^3.0.2"
|
|
93
94
|
},
|
|
94
95
|
"peerDependencies": {
|
|
95
|
-
"@djangocfg/i18n": "^2.1.
|
|
96
|
-
"@djangocfg/ui-core": "^2.1.
|
|
96
|
+
"@djangocfg/i18n": "^2.1.543",
|
|
97
|
+
"@djangocfg/ui-core": "^2.1.543",
|
|
97
98
|
"lucide-react": "^0.545.0",
|
|
98
99
|
"react": "^19.0.0",
|
|
99
100
|
"react-dom": "^19.0.0"
|
|
100
101
|
},
|
|
101
102
|
"devDependencies": {
|
|
102
|
-
"@djangocfg/i18n": "^2.1.
|
|
103
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
104
|
-
"@djangocfg/ui-core": "^2.1.
|
|
103
|
+
"@djangocfg/i18n": "^2.1.543",
|
|
104
|
+
"@djangocfg/typescript-config": "^2.1.543",
|
|
105
|
+
"@djangocfg/ui-core": "^2.1.543",
|
|
105
106
|
"@storybook/react-vite": "^10.5.0",
|
|
106
107
|
"@types/node": "^25.9.5",
|
|
107
108
|
"@types/react": "19.2.15",
|
|
@@ -177,6 +177,7 @@ export function EditorProvider({ children, onSave }: EditorProviderProps) {
|
|
|
177
177
|
monaco,
|
|
178
178
|
editor,
|
|
179
179
|
isReady: monaco !== null && editor !== null,
|
|
180
|
+
setEditor,
|
|
180
181
|
|
|
181
182
|
openFile,
|
|
182
183
|
closeFile,
|
|
@@ -193,6 +194,7 @@ export function EditorProvider({ children, onSave }: EditorProviderProps) {
|
|
|
193
194
|
activeFile,
|
|
194
195
|
monaco,
|
|
195
196
|
editor,
|
|
197
|
+
setEditor,
|
|
196
198
|
openFile,
|
|
197
199
|
closeFile,
|
|
198
200
|
setActiveFile,
|
|
@@ -100,6 +100,8 @@ export interface EditorContextValue {
|
|
|
100
100
|
editor: monaco.editor.IStandaloneCodeEditor | null;
|
|
101
101
|
/** Whether editor is ready */
|
|
102
102
|
isReady: boolean;
|
|
103
|
+
/** Publish the mounted editor. Until a host calls it, `isReady` stays false. */
|
|
104
|
+
setEditor: (editor: monaco.editor.IStandaloneCodeEditor | null) => void;
|
|
103
105
|
|
|
104
106
|
// File operations
|
|
105
107
|
openFile: (path: string, content: string, language?: string) => void;
|
|
@@ -130,7 +130,6 @@ export function createMarkdownComponents(
|
|
|
130
130
|
try {
|
|
131
131
|
return <CodeBlock code={codeContent} language={language} isUser={isUser} isCompact={isCompact} codeTheme={codeTheme} />;
|
|
132
132
|
} catch (error) {
|
|
133
|
-
// eslint-disable-next-line no-console
|
|
134
133
|
console.warn('CodeBlock failed, using fallback:', error);
|
|
135
134
|
return <CodeBlockFallback code={codeContent} language={language} isUser={isUser} isCompact={isCompact} codeTheme={codeTheme} />;
|
|
136
135
|
}
|
|
@@ -124,7 +124,7 @@ export function splitStreamingBlocks(content: string): SplitResult {
|
|
|
124
124
|
// blocks, promote the tail to a completed block when it ends on a clean
|
|
125
125
|
// newline boundary and no fence is open.
|
|
126
126
|
let tail = current.join('\n');
|
|
127
|
-
|
|
127
|
+
const tailInOpenFence = fence.open;
|
|
128
128
|
|
|
129
129
|
if (!tailInOpenFence && tail.length > 0 && content.endsWith('\n')) {
|
|
130
130
|
// Content ended on a newline and the tail isn't inside a fence — treat
|
|
@@ -100,12 +100,12 @@ set -euo pipefail
|
|
|
100
100
|
ENV="\${1:-staging}"
|
|
101
101
|
TAG="\${2:-latest}"
|
|
102
102
|
|
|
103
|
-
echo "Deploying to
|
|
103
|
+
echo "Deploying to $ENV with tag $TAG"
|
|
104
104
|
|
|
105
|
-
docker build -t myapp
|
|
106
|
-
docker push registry.example.com/myapp
|
|
105
|
+
docker build -t myapp:$TAG .
|
|
106
|
+
docker push registry.example.com/myapp:$TAG
|
|
107
107
|
|
|
108
|
-
kubectl set image deployment/myapp app=registry.example.com/myapp
|
|
108
|
+
kubectl set image deployment/myapp app=registry.example.com/myapp:$TAG
|
|
109
109
|
kubectl rollout status deployment/myapp --timeout=2m
|
|
110
110
|
|
|
111
111
|
echo "Done."`;
|