@coding-script/script-engine 0.0.8 → 0.0.9
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/dist/autocomplete/completion-source.js +1 -1
- package/dist/components/data-types-section.js +1 -0
- package/dist/components/drag-handle.js +1 -0
- package/dist/components/main-function-section.js +3 -1
- package/dist/components/panel-header.js +1 -0
- package/dist/components/toolbar.js +3 -0
- package/dist/components/variables-section.js +3 -1
- package/dist/index.js +1 -1
- package/dist/script-code.js +5 -1
- package/dist/type-panel/type-panel.js +3 -1
- package/package.json +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { syntaxTree } from "@codemirror/language";
|
|
2
2
|
import { resolveChainType } from "./resolve.js";
|
|
3
|
-
import { groovyConfig } from "../languages/groovy";
|
|
3
|
+
import { groovyConfig } from "../languages/groovy.js";
|
|
4
4
|
function formatFunctionSignature(fn) {
|
|
5
5
|
const params = fn.parameters.map((p)=>`${p.name}: ${p.dataType}`).join(', ');
|
|
6
6
|
return `(${params})`;
|
|
@@ -2,6 +2,7 @@ import react from "react";
|
|
|
2
2
|
import { SectionHeader } from "./section-header.js";
|
|
3
3
|
import { TypeSection } from "./type-section.js";
|
|
4
4
|
const DataTypesSection = ({ allTypes, expanded, onToggle, colors })=>/*#__PURE__*/ react.createElement("div", {
|
|
5
|
+
className: "data-types-section",
|
|
5
6
|
style: {
|
|
6
7
|
marginTop: 4
|
|
7
8
|
}
|
|
@@ -2,6 +2,7 @@ import react from "react";
|
|
|
2
2
|
const DragHandle = ({ colors, dragging, handleHovered, onMouseDown, onHoverChange })=>{
|
|
3
3
|
const handleActiveColor = dragging || handleHovered ? colors.accent : colors.border;
|
|
4
4
|
return /*#__PURE__*/ react.createElement("div", {
|
|
5
|
+
className: "se-drag-handle",
|
|
5
6
|
onMouseDown: onMouseDown,
|
|
6
7
|
onMouseEnter: ()=>onHoverChange(true),
|
|
7
8
|
onMouseLeave: ()=>onHoverChange(false),
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { SectionHeader } from "./section-header.js";
|
|
3
|
-
const MainFunctionSection = ({ metadata, colors })=>/*#__PURE__*/ react.createElement("div",
|
|
3
|
+
const MainFunctionSection = ({ metadata, colors })=>/*#__PURE__*/ react.createElement("div", {
|
|
4
|
+
className: "main-function-section"
|
|
5
|
+
}, /*#__PURE__*/ react.createElement(SectionHeader, {
|
|
4
6
|
colors: colors,
|
|
5
7
|
label: "主函数"
|
|
6
8
|
}), /*#__PURE__*/ react.createElement("div", {
|
|
@@ -2,6 +2,7 @@ import react, { useState } from "react";
|
|
|
2
2
|
const PanelHeader = ({ colors, onCollapse })=>{
|
|
3
3
|
const [collapseHovered, setCollapseHovered] = useState(false);
|
|
4
4
|
return /*#__PURE__*/ react.createElement("div", {
|
|
5
|
+
className: "panel-header",
|
|
5
6
|
style: {
|
|
6
7
|
padding: '8px 12px',
|
|
7
8
|
display: 'flex',
|
|
@@ -121,6 +121,7 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
|
|
|
121
121
|
onThemeChange?.(next);
|
|
122
122
|
};
|
|
123
123
|
return /*#__PURE__*/ react.createElement("div", {
|
|
124
|
+
className: "script-editor-toolbar",
|
|
124
125
|
style: {
|
|
125
126
|
display: 'flex',
|
|
126
127
|
alignItems: 'center',
|
|
@@ -133,6 +134,7 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
|
|
|
133
134
|
fontSize: 13
|
|
134
135
|
}
|
|
135
136
|
}, title && /*#__PURE__*/ react.createElement("span", {
|
|
137
|
+
className: "script-editor-toolbar-title",
|
|
136
138
|
style: {
|
|
137
139
|
color: toolbarText,
|
|
138
140
|
fontWeight: 600,
|
|
@@ -142,6 +144,7 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
|
|
|
142
144
|
textOverflow: 'ellipsis'
|
|
143
145
|
}
|
|
144
146
|
}, title), !title && /*#__PURE__*/ react.createElement("span", {
|
|
147
|
+
className: "script-editor-toolbar-title",
|
|
145
148
|
style: {
|
|
146
149
|
marginRight: 'auto'
|
|
147
150
|
}
|
|
@@ -3,7 +3,9 @@ import { SectionHeader } from "./section-header.js";
|
|
|
3
3
|
import { VariableRow } from "./variable-row.js";
|
|
4
4
|
const VariablesSection = ({ sortedBinds, sortedRequests, colors })=>{
|
|
5
5
|
if (0 === sortedBinds.length && 0 === sortedRequests.length) return null;
|
|
6
|
-
return /*#__PURE__*/ react.createElement("div",
|
|
6
|
+
return /*#__PURE__*/ react.createElement("div", {
|
|
7
|
+
className: "variables-section"
|
|
8
|
+
}, sortedRequests.length > 0 && /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(SectionHeader, {
|
|
7
9
|
colors: colors,
|
|
8
10
|
label: "函数入参"
|
|
9
11
|
}), sortedRequests.map((req)=>/*#__PURE__*/ react.createElement(VariableRow, {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./script-code.js";
|
|
2
2
|
export * from "./types/index.js";
|
|
3
3
|
export { GroovyFormatter, GroovyScriptConvertorUtil } from "./utils/groovy-formatter.js";
|
|
4
|
-
export { BUILTIN_LANGUAGES, groovyConfig, javascriptConfig, resolveLanguageConfig } from "./languages";
|
|
4
|
+
export { BUILTIN_LANGUAGES, groovyConfig, javascriptConfig, resolveLanguageConfig } from "./languages/index.js";
|
package/dist/script-code.js
CHANGED
|
@@ -7,7 +7,7 @@ import { oneDark } from "@codemirror/theme-one-dark";
|
|
|
7
7
|
import { tags } from "@lezer/highlight";
|
|
8
8
|
import { autocompletion, completionKeymap } from "@codemirror/autocomplete";
|
|
9
9
|
import { createCompletionSource } from "./autocomplete/index.js";
|
|
10
|
-
import { resolveLanguageConfig } from "./languages";
|
|
10
|
+
import { resolveLanguageConfig } from "./languages/index.js";
|
|
11
11
|
import { TypePanel } from "./type-panel/index.js";
|
|
12
12
|
import { Toolbar } from "./components/toolbar.js";
|
|
13
13
|
import { ExpandSidebarButton } from "./components/expand-sidebar-button.js";
|
|
@@ -350,6 +350,7 @@ const ScriptCodeEditor = (props)=>{
|
|
|
350
350
|
});
|
|
351
351
|
};
|
|
352
352
|
return /*#__PURE__*/ react.createElement("div", {
|
|
353
|
+
className: "script-editor",
|
|
353
354
|
style: isFullscreen ? {
|
|
354
355
|
position: 'fixed',
|
|
355
356
|
top: 0,
|
|
@@ -383,6 +384,7 @@ const ScriptCodeEditor = (props)=>{
|
|
|
383
384
|
toolbarExtra: toolbarExtra,
|
|
384
385
|
description: metadata?.description
|
|
385
386
|
}), /*#__PURE__*/ react.createElement("div", {
|
|
387
|
+
className: "script-editor-body",
|
|
386
388
|
style: {
|
|
387
389
|
display: 'flex',
|
|
388
390
|
border: `1px solid ${borderColor}`,
|
|
@@ -393,6 +395,7 @@ const ScriptCodeEditor = (props)=>{
|
|
|
393
395
|
minHeight: isFullscreen ? 0 : void 0
|
|
394
396
|
}
|
|
395
397
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
398
|
+
className: "script-editor-code",
|
|
396
399
|
style: {
|
|
397
400
|
flex: 1,
|
|
398
401
|
minWidth: 0,
|
|
@@ -405,6 +408,7 @@ const ScriptCodeEditor = (props)=>{
|
|
|
405
408
|
onClick: ()=>setSidebarOpen(true)
|
|
406
409
|
}), /*#__PURE__*/ react.createElement("div", {
|
|
407
410
|
ref: editorContainerRef,
|
|
411
|
+
className: "script-editor-codemirror",
|
|
408
412
|
style: isFullscreen ? {
|
|
409
413
|
height: '100%'
|
|
410
414
|
} : void 0
|
|
@@ -72,6 +72,7 @@ const TypePanel = ({ metadata, theme, minHeight, maxHeight, width, onWidthChange
|
|
|
72
72
|
]);
|
|
73
73
|
return /*#__PURE__*/ react.createElement("div", {
|
|
74
74
|
ref: panelRef,
|
|
75
|
+
className: "type-panel",
|
|
75
76
|
style: {
|
|
76
77
|
width,
|
|
77
78
|
flexShrink: 0,
|
|
@@ -89,6 +90,7 @@ const TypePanel = ({ metadata, theme, minHeight, maxHeight, width, onWidthChange
|
|
|
89
90
|
onMouseDown: onHandleMouseDown,
|
|
90
91
|
onHoverChange: setHandleHovered
|
|
91
92
|
}), /*#__PURE__*/ react.createElement("div", {
|
|
93
|
+
className: "type-panel-body",
|
|
92
94
|
style: {
|
|
93
95
|
flex: 1,
|
|
94
96
|
minWidth: 0,
|
|
@@ -105,7 +107,7 @@ const TypePanel = ({ metadata, theme, minHeight, maxHeight, width, onWidthChange
|
|
|
105
107
|
colors: colors,
|
|
106
108
|
onCollapse: onCollapse
|
|
107
109
|
}), /*#__PURE__*/ react.createElement("div", {
|
|
108
|
-
className: SCROLL_CLASS
|
|
110
|
+
className: `type-panel-content ${SCROLL_CLASS}`,
|
|
109
111
|
style: {
|
|
110
112
|
flex: 1,
|
|
111
113
|
overflowY: 'auto',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coding-script/script-engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "script-engine components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"coding-script",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"@codemirror/language": "^6.12.2",
|
|
36
36
|
"@codemirror/state": "^6.5.4",
|
|
37
37
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
38
|
-
"@codemirror/view": "^6.39.16"
|
|
38
|
+
"@codemirror/view": "^6.39.16",
|
|
39
|
+
"@lezer/highlight": "^1.2.3"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
42
|
"react": ">=18",
|