@djangocfg/widget-code 0.1.1 → 0.1.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/widget-code",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1",
77
- "@djangocfg/widget-diagram": "^0.1.1",
78
- "@djangocfg/widget-editor": "^0.1.1",
79
- "@djangocfg/widget-kit": "^0.1.1",
77
+ "@djangocfg/widget-data": "^0.1.3",
78
+ "@djangocfg/widget-diagram": "^0.1.3",
79
+ "@djangocfg/widget-editor": "^0.1.3",
80
+ "@djangocfg/widget-kit": "^0.1.3",
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.542",
96
- "@djangocfg/ui-core": "^2.1.542",
96
+ "@djangocfg/i18n": "^2.1.544",
97
+ "@djangocfg/ui-core": "^2.1.544",
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.542",
103
- "@djangocfg/typescript-config": "^2.1.542",
104
- "@djangocfg/ui-core": "^2.1.542",
103
+ "@djangocfg/i18n": "^2.1.544",
104
+ "@djangocfg/typescript-config": "^2.1.544",
105
+ "@djangocfg/ui-core": "^2.1.544",
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
  }
@@ -22,7 +22,6 @@ export function applyPreprocess(
22
22
  try {
23
23
  s = rule.preprocess(s);
24
24
  } catch (err) {
25
- // eslint-disable-next-line no-console
26
25
  console.warn(
27
26
  `[MarkdownMessage] linkRule "${rule.name ?? '(anonymous)'}" preprocess threw; skipping`,
28
27
  err,
@@ -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
- let tailInOpenFence = fence.open;
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 \$ENV with tag \$TAG"
103
+ echo "Deploying to $ENV with tag $TAG"
104
104
 
105
- docker build -t myapp:\$TAG .
106
- docker push registry.example.com/myapp:\$TAG
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:\$TAG
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."`;