@coding-script/script-engine 0.0.5 → 0.0.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.
@@ -51,17 +51,6 @@ function calcTooltipPos(anchorRect, el) {
51
51
  maxHeight: Math.max(maxHeight, 80)
52
52
  };
53
53
  }
54
- const KV_RE = /^([^:]+):\s*([\s\S]+)$/;
55
- function renderDescLine(line, accent) {
56
- const m = line.match(KV_RE);
57
- if (m) return /*#__PURE__*/ react.createElement("span", null, /*#__PURE__*/ react.createElement("span", {
58
- style: {
59
- color: accent,
60
- fontWeight: 600
61
- }
62
- }, m[1]), /*#__PURE__*/ react.createElement("span", null, ": ", m[2]));
63
- return line;
64
- }
65
54
  const QuestionIcon = ({ color })=>/*#__PURE__*/ react.createElement("svg", {
66
55
  width: "13",
67
56
  height: "13",
@@ -125,7 +114,7 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
125
114
  }, [
126
115
  description
127
116
  ]);
128
- const descLines = description ? description.replace(/\\n/g, '\n').split('\n').filter((l)=>l.trim()) : [];
117
+ const descHtml = description ? description.replace(/\\n/g, '\n').replace(/\n/g, '<br>') : '';
129
118
  const handleThemeToggle = ()=>{
130
119
  const next = isDark ? 'light' : 'dark';
131
120
  onThemeChange?.(next);
@@ -155,7 +144,7 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
155
144
  style: {
156
145
  marginRight: 'auto'
157
146
  }
158
- }), descLines.length > 0 && /*#__PURE__*/ react.createElement(ToolbarButton, {
147
+ }), descHtml && /*#__PURE__*/ react.createElement(ToolbarButton, {
159
148
  ref: descBtnRef,
160
149
  label: /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(QuestionIcon, {
161
150
  color: "currentColor"
@@ -216,7 +205,7 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
216
205
  textColor: item.textColor,
217
206
  borderColor: item.borderColor,
218
207
  onClick: item.onClick
219
- })), toolbarExtra, showDesc && tipPos && descLines.length > 0 && /*#__PURE__*/ react.createElement("div", {
208
+ })), toolbarExtra, showDesc && tipPos && descHtml && /*#__PURE__*/ react.createElement("div", {
220
209
  ref: tipRef,
221
210
  style: {
222
211
  position: 'fixed',
@@ -236,12 +225,10 @@ const Toolbar = ({ title, theme, onThemeChange, enableThemeToggle, enableFormat,
236
225
  zIndex: 9999,
237
226
  boxShadow: '0 4px 16px rgba(0,0,0,0.3)',
238
227
  pointerEvents: 'auto'
228
+ },
229
+ dangerouslySetInnerHTML: {
230
+ __html: descHtml
239
231
  }
240
- }, descLines.map((line, i)=>/*#__PURE__*/ react.createElement("div", {
241
- key: i,
242
- style: {
243
- marginBottom: i < descLines.length - 1 ? 4 : 0
244
- }
245
- }, renderDescLine(line, colors.accent)))));
232
+ }));
246
233
  };
247
234
  export { Toolbar };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coding-script/script-engine",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "script-engine components",
5
5
  "keywords": [
6
6
  "coding-script",