xmlui 0.9.25 → 0.9.31

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 (40) hide show
  1. package/dist/{apiInterceptorWorker-CFF3bC6o.mjs → lib/apiInterceptorWorker-BcQy1dRU.mjs} +1 -1
  2. package/dist/{index-DtxDGaqF.mjs → lib/index-DqWRcUpA.mjs} +308 -185
  3. package/dist/{index.css → lib/index.css} +266 -162
  4. package/dist/{language-server-web-worker.mjs → lib/language-server-web-worker.mjs} +1 -1
  5. package/dist/{language-server.mjs → lib/language-server.mjs} +1 -1
  6. package/dist/{server-common-9TiLMTJj.mjs → lib/server-common-Cucl1Ik4.mjs} +6805 -4060
  7. package/dist/{xmlui.d.ts → lib/xmlui.d.ts} +5 -0
  8. package/dist/{xmlui.mjs → lib/xmlui.mjs} +1 -1
  9. package/dist/{style.css → metadata/style.css} +252 -156
  10. package/dist/{xmlui-metadata.mjs → metadata/xmlui-metadata.mjs} +126 -102
  11. package/dist/{xmlui-metadata.umd.js → metadata/xmlui-metadata.umd.js} +126 -102
  12. package/dist/scripts/package.json +37 -44
  13. package/dist/scripts/src/components/Bookmark/BookmarkNative.js +2 -2
  14. package/dist/scripts/src/components/CodeBlock/CodeBlock.js +8 -3
  15. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +23 -4
  16. package/dist/scripts/src/components/{Markdown → CodeBlock}/highlight-code.js +56 -13
  17. package/dist/scripts/src/components/FormItem/FormItemNative.js +0 -1
  18. package/dist/scripts/src/components/Heading/Heading.js +3 -0
  19. package/dist/scripts/src/components/Heading/HeadingNative.js +1 -1
  20. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +6 -6
  21. package/dist/scripts/src/components/Markdown/Markdown.js +5 -1
  22. package/dist/scripts/src/components/Markdown/MarkdownNative.js +41 -9
  23. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +2 -1
  24. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +17 -1
  25. package/dist/scripts/src/components/Switch/Switch.js +5 -3
  26. package/dist/scripts/src/components/Text/Text.js +4 -9
  27. package/dist/standalone/xmlui-standalone.es.d.ts +2179 -0
  28. package/dist/{xmlui-standalone.umd.js → standalone/xmlui-standalone.umd.js} +598 -371
  29. package/package.json +30 -34
  30. /package/dist/{core-XLM8cuFP.mjs → lib/core-XLM8cuFP.mjs} +0 -0
  31. /package/dist/{grammar.tmLanguage-CiEHpsbo.mjs → lib/grammar.tmLanguage-CiEHpsbo.mjs} +0 -0
  32. /package/dist/{language-server-web-worker.d.ts → lib/language-server-web-worker.d.ts} +0 -0
  33. /package/dist/{language-server.d.ts → lib/language-server.d.ts} +0 -0
  34. /package/dist/{lint-CYAUfk0_.mjs → lib/lint-CYAUfk0_.mjs} +0 -0
  35. /package/dist/{metadata-utils-CCIMqe69.mjs → lib/metadata-utils-CCIMqe69.mjs} +0 -0
  36. /package/dist/{transform-DC0Gy6qw.mjs → lib/transform-DC0Gy6qw.mjs} +0 -0
  37. /package/dist/{wasm-DDgzZJey.mjs → lib/wasm-DDgzZJey.mjs} +0 -0
  38. /package/dist/{xmlui-h2uM9PUY.mjs → lib/xmlui-h2uM9PUY.mjs} +0 -0
  39. /package/dist/{xmlui-parser.d.ts → lib/xmlui-parser.d.ts} +0 -0
  40. /package/dist/{xmlui-parser.mjs → lib/xmlui-parser.mjs} +0 -0
@@ -1,25 +1,21 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.9.25",
3
+ "version": "0.9.31",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
7
- "build:test-bed": "cd src/testing/infrastructure && xmlui build --build-mode=INLINE_ALL --withHostingMetaFiles --withMock",
7
+ "build:xmlui-test-bed": "cd src/testing/infrastructure && xmlui build --build-mode=INLINE_ALL --withHostingMetaFiles --withMock",
8
8
  "build:bin": "tsc -p tsconfig.bin.json",
9
9
  "build:xmlui": "vite build --mode lib",
10
10
  "build:xmlui-standalone": "vite build --mode standalone",
11
11
  "build:xmlui-metadata": "vite build --mode metadata",
12
12
  "build:ext-meta": "node scripts/build-extension-packages/build-extension-packages.mjs",
13
- "build": "rimraf dist && tsc && npm run build:bin && npm run build:xmlui-metadata && npm run build:xmlui && npm run build:xmlui-standalone",
14
- "build:extensions": "cd ../packages/xmlui-animations && npm run build && cd ../xmlui-charts && npm run build && cd ../xmlui-pdf && npm run build && cd ../xmlui-spreadsheet && cd ../xmlui-devtools && npm run build && npm run build",
15
- "test": "npm run test:unit",
16
13
  "test:unit": "vitest run",
17
- "test:e2e": "playwright test",
14
+ "test:e2e-non-smoke": "playwright test --project non-smoke",
18
15
  "test:e2e-smoke": "playwright test --project smoke",
19
16
  "test:e2e-ui": "npm run test:e2e -- --ui",
20
17
  "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
21
- "prepublishOnly": "clean-package && npm run build",
22
- "cleanPackage": "clean-package",
18
+ "prepublishOnly": "clean-package",
23
19
  "postpublish": "clean-package restore",
24
20
  "generate-docs": "node scripts/generate-docs/get-docs.mjs",
25
21
  "prepare-docs-data": "npm run build:xmlui-metadata",
@@ -156,36 +152,36 @@
156
152
  "src/styles"
157
153
  ],
158
154
  "bin": {
159
- "xmlui": "dist/scripts/bin/bootstrap.js"
155
+ "xmlui": "./bin/bootstrap.js"
160
156
  },
161
157
  "clean-package": {
162
158
  "replace": {
163
159
  "bin": {
164
160
  "xmlui": "dist/scripts/bin/bootstrap.js"
165
161
  },
166
- "main": "./dist/xmlui.umd.js",
167
- "module": "./dist/xmlui.mjs",
168
- "types": "./dist/xmlui.d.ts",
162
+ "main": "./dist/standalone/xmlui-standalone.umd.js",
163
+ "module": "./dist/lib/xmlui.mjs",
164
+ "types": "./dist/lib/xmlui.d.ts",
169
165
  "exports": {
170
166
  ".": {
171
- "import": "./dist/xmlui.mjs",
172
- "require": "./dist/xmlui.umd.js"
167
+ "import": "./dist/lib/xmlui.mjs",
168
+ "require": "./dist/standalone/xmlui-standalone.umd.js"
173
169
  },
174
170
  "./language-server": {
175
- "import": "./dist/language-server.mjs",
176
- "require": "./dist/language-server.mjs"
171
+ "import": "./dist/lib/language-server.mjs",
172
+ "require": "./dist/lib/language-server.mjs"
177
173
  },
178
174
  "./language-server-web-worker": {
179
- "import": "./dist/language-server-web-worker.mjs",
180
- "require": "./dist/language-server-web-worker.mjs"
175
+ "import": "./dist/lib/language-server-web-worker.mjs",
176
+ "require": "./dist/lib/language-server-web-worker.mjs"
181
177
  },
182
178
  "./parser": {
183
- "import": "./dist/xmlui-parser.mjs",
184
- "require": "./dist/xmlui-parser.mjs"
179
+ "import": "./dist/lib/xmlui-parser.mjs",
180
+ "require": "./dist/lib/xmlui-parser.mjs"
185
181
  },
186
182
  "./*.css": {
187
- "import": "./dist/*.css",
188
- "require": "./dist/*.css"
183
+ "import": "./dist/lib/*.css",
184
+ "require": "./dist/lib/*.css"
189
185
  },
190
186
  "./index.scss": {
191
187
  "import": "./src/index.scss",
@@ -198,35 +194,34 @@
198
194
  }
199
195
  }
200
196
  },
201
- "main": "./dist/xmlui.umd.js",
197
+ "main": "./src/index.ts",
202
198
  "exports": {
203
199
  ".": {
204
- "import": "./dist/xmlui.mjs",
205
- "require": "./dist/xmlui.umd.js"
206
- },
207
- "./language-server": {
208
- "import": "./dist/language-server.mjs",
209
- "require": "./dist/language-server.mjs"
210
- },
211
- "./language-server-web-worker": {
212
- "import": "./dist/language-server-web-worker.mjs",
213
- "require": "./dist/language-server-web-worker.mjs"
200
+ "import": "./src/index.ts",
201
+ "require": "./src/index.ts"
214
202
  },
215
203
  "./parser": {
216
- "import": "./dist/xmlui-parser.mjs",
217
- "require": "./dist/xmlui-parser.mjs"
218
- },
219
- "./*.css": {
220
- "import": "./dist/*.css",
221
- "require": "./dist/*.css"
204
+ "import": "./src/parsers/xmlui-parser/index.ts",
205
+ "require": "./src/parsers/xmlui-parser/index.ts"
222
206
  },
223
207
  "./index.scss": {
224
208
  "import": "./src/index.scss",
225
209
  "require": "./src/index.scss"
226
210
  },
211
+ "./themes.scss": {
212
+ "import": "./src/components-core/theming/_themes.scss"
213
+ },
227
214
  "./vite-xmlui-plugin": {
228
- "import": "./dist/scripts/bin/vite-xmlui-plugin.js",
229
- "require": "./dist/scripts/bin/vite-xmlui-plugin.js"
215
+ "import": "./bin/vite-xmlui-plugin.ts",
216
+ "require": "./bin/vite-xmlui-plugin.ts"
217
+ },
218
+ "./language-server": {
219
+ "import": "./src/language-server/server.ts",
220
+ "require": "./src/language-server/server.ts"
221
+ },
222
+ "./language-server-web-worker": {
223
+ "import": "./src/language-server/server-web-worker.ts",
224
+ "require": "./src/language-server/server-web-worker.ts"
230
225
  }
231
226
  },
232
227
  "browserslist": {
@@ -246,7 +241,5 @@
246
241
  },
247
242
  "msw": {
248
243
  "workerDirectory": "src/testing/infrastructure/public"
249
- },
250
- "module": "./dist/xmlui.mjs",
251
- "types": "./dist/xmlui.d.ts"
244
+ }
252
245
  }
@@ -18,12 +18,12 @@ const Bookmark = ({ uid, level = exports.defaultProps.level, children, title, om
18
18
  const registerHeading = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.registerHeading;
19
19
  const observeIntersection = tableOfContentsContext === null || tableOfContentsContext === void 0 ? void 0 : tableOfContentsContext.hasTableOfContents;
20
20
  (0, react_1.useLayoutEffect)(() => {
21
- var _a, _b;
21
+ var _a, _b, _c;
22
22
  if (observeIntersection && elementRef.current && uid && !omitFromToc) {
23
23
  return registerHeading === null || registerHeading === void 0 ? void 0 : registerHeading({
24
24
  id: uid,
25
25
  level,
26
- text: title || ((_b = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) || uid,
26
+ text: title || ((_c = (_b = (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.textContent) === null || _b === void 0 ? void 0 : _b.trim()) === null || _c === void 0 ? void 0 : _c.replace(/#$/, "")) || uid,
27
27
  anchor: elementRef.current,
28
28
  });
29
29
  }
@@ -13,19 +13,24 @@ const CodeBlockNative_1 = require("./CodeBlockNative");
13
13
  const COMP = "CodeBlock";
14
14
  exports.CodeBlockMd = (0, ComponentDefs_1.createMetadata)({
15
15
  description: `The \`${COMP}\` component displays code with optional syntax highlighting and meta information.`,
16
+ status: "in progress",
16
17
  props: {},
17
18
  themeVars: (0, themeVars_1.parseScssVar)(CodeBlock_module_scss_1.default.themeVars),
18
19
  defaultThemeVars: {
19
- "backgroundColor-CodeBlock": "$color-surface-100",
20
+ "backgroundColor-CodeBlock": "#f2f7fc", // "$color-surface-100"
20
21
  "backgroundColor-CodeBlock-header": "$color-primary-100",
21
- //"borderLeft-CodeBlock": "$color-surface-300 2px solid",
22
22
  "marginTop-CodeBlock": "$space-5",
23
23
  "marginBottom-CodeBlock": "$space-5",
24
+ "backgroundColor-CodeBlock-highlightRow": "$color-surface-200",
25
+ "backgroundColor-CodeBlock-highlightString": "$color-surface-300",
26
+ "borderRadius-CodeBlock": "$space-2",
24
27
  dark: {
25
28
  "backgroundColor-CodeBlock-header": "$color-primary-200",
29
+ "backgroundColor-CodeBlock": "#112033",
30
+ "backgroundColor-CodeBlock-highlightRow": "$color-surface-100",
26
31
  }
27
32
  },
28
33
  });
29
- exports.codeBlockComponentRenderer = (0, renderers_1.createComponentRenderer)("CodeBlock", exports.CodeBlockMd, ({ node, extractValue, renderChild, layoutCss }) => {
34
+ exports.codeBlockComponentRenderer = (0, renderers_1.createComponentRenderer)("CodeBlock", exports.CodeBlockMd, ({ node, renderChild, layoutCss }) => {
30
35
  return ((0, jsx_runtime_1.jsx)(CodeBlockNative_1.CodeBlock, { style: layoutCss, children: renderChild(node.children) }));
31
36
  });
@@ -8,14 +8,14 @@ exports.markdownCodeBlockParser = markdownCodeBlockParser;
8
8
  const jsx_runtime_1 = require("react/jsx-runtime");
9
9
  const CodeBlock_module_scss_1 = __importDefault(require("./CodeBlock.module.scss"));
10
10
  const TextNative_1 = require("../Text/TextNative");
11
- const highlight_code_1 = require("../Markdown/highlight-code");
11
+ const highlight_code_1 = require("./highlight-code");
12
12
  const ButtonNative_1 = require("../Button/ButtonNative");
13
13
  const IconNative_1 = __importDefault(require("../Icon/IconNative"));
14
14
  const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
15
15
  const unist_util_visit_1 = require("unist-util-visit");
16
16
  function CodeBlock({ children, meta, textToCopy, style }) {
17
17
  if (!meta) {
18
- return (0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: children });
18
+ return ((0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: children }));
19
19
  }
20
20
  return ((0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: [meta.filename && ((0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockHeader, children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { variant: "em", children: meta.filename }) })), (0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlockCopyWrapper, children: [children, (0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockCopyButton, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "outlined", themeColor: "primary", size: "sm", icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "copy", "aria-hidden": true }), onClick: () => {
21
21
  if (!textToCopy)
@@ -28,6 +28,10 @@ function markdownCodeBlockParser() {
28
28
  return function transformer(tree) {
29
29
  (0, unist_util_visit_1.visit)(tree, "code", visitor);
30
30
  };
31
+ /**
32
+ * This visitor visits each node in the mdast tree and adds all meta information to the code block html element
33
+ * that we use later in the Markdown component.
34
+ */
31
35
  function visitor(node, _, parent) {
32
36
  var _a;
33
37
  const { lang, meta } = node;
@@ -51,10 +55,25 @@ function markdownCodeBlockParser() {
51
55
  return acc;
52
56
  if (item.indexOf("=") === -1) {
53
57
  if (item.startsWith("/") && item.endsWith("/")) {
54
- acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstrings.data] = item.substring(1, item.length - 1);
58
+ const unparsedSubstrings = acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstrings.data];
59
+ const newItemBase64 = window.btoa(item.substring(1, item.length - 1));
60
+ if (!unparsedSubstrings) {
61
+ acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstrings.data] = newItemBase64;
62
+ }
63
+ else {
64
+ acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstrings.data] =
65
+ `${unparsedSubstrings} ${newItemBase64}`;
66
+ }
55
67
  }
56
68
  if (item.startsWith("{") && item.endsWith("}")) {
57
- acc[highlight_code_1.CodeHighlighterMetaKeys.highlightRows.data] = item.substring(1, item.length - 1);
69
+ const unparsedRows = acc[highlight_code_1.CodeHighlighterMetaKeys.highlightRows.data];
70
+ const newItem = item.substring(1, item.length - 1);
71
+ if (!unparsedRows) {
72
+ acc[highlight_code_1.CodeHighlighterMetaKeys.highlightRows.data] = newItem;
73
+ }
74
+ else {
75
+ acc[highlight_code_1.CodeHighlighterMetaKeys.highlightRows.data] = `${unparsedRows}, ${newItem}`;
76
+ }
58
77
  }
59
78
  if (item === "copy") {
60
79
  acc[highlight_code_1.CodeHighlighterMetaKeys.copy.data] = "true";
@@ -14,6 +14,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.CodeHighlighterMetaKeysData = exports.CodeHighlighterMetaKeys = void 0;
15
15
  exports.parseMetaAndHighlightCode = parseMetaAndHighlightCode;
16
16
  const react_1 = require("react");
17
+ const highlightRowsClass = "codeBlockHighlightRow";
18
+ const highlightSubstringsClass = "codeBlockHighlightString";
17
19
  /**
18
20
  * This function handles two things:
19
21
  * 1. The extraction of meta information from code blocks and exposing them as data-meta attributes
@@ -24,7 +26,7 @@ const react_1 = require("react");
24
26
  */
25
27
  function parseMetaAndHighlightCode(node, codeHighlighter, themeTone) {
26
28
  const codeStr = mapTextContent(node);
27
- const meta = extractMetaFromChildren(node, exports.CodeHighlighterMetaKeysData, codeStr.split("\n").length);
29
+ const meta = extractMetaFromChildren(node, exports.CodeHighlighterMetaKeysData, codeStr);
28
30
  const { language } = meta, restMeta = __rest(meta, ["language"]);
29
31
  if (language && codeHighlighter.availableLangs.includes(language)) {
30
32
  // NOTE: Keep in mind, at this point, we are working with the markdown text
@@ -82,7 +84,7 @@ function mapTextContent(node) {
82
84
  return splitNode.join("\n");
83
85
  }
84
86
  }
85
- function extractMetaFromChildren(node, keys, codeLength = 0) {
87
+ function extractMetaFromChildren(node, keys, code = "") {
86
88
  if (!node)
87
89
  return {};
88
90
  if (typeof node === "string")
@@ -108,10 +110,8 @@ function extractMetaFromChildren(node, keys, codeLength = 0) {
108
110
  [exports.CodeHighlighterMetaKeys.copy.prop]: parseBoolean(meta[exports.CodeHighlighterMetaKeys.copy.data]),
109
111
  [exports.CodeHighlighterMetaKeys.filename.prop]: meta[exports.CodeHighlighterMetaKeys.filename.data],
110
112
  [exports.CodeHighlighterMetaKeys.rowNumbers.prop]: parseBoolean(meta[exports.CodeHighlighterMetaKeys.rowNumbers.data]),
111
- [exports.CodeHighlighterMetaKeys.highlightRows.prop]: meta[exports.CodeHighlighterMetaKeys.highlightRows.data]
112
- ? parseRowHighlights(meta[exports.CodeHighlighterMetaKeys.highlightRows.data], codeLength)
113
- : [],
114
- [exports.CodeHighlighterMetaKeys.highlightSubstrings.prop]: [], // TODO
113
+ [exports.CodeHighlighterMetaKeys.highlightRows.prop]: parseRowHighlights(code.split("\n").length, meta[exports.CodeHighlighterMetaKeys.highlightRows.data]),
114
+ [exports.CodeHighlighterMetaKeys.highlightSubstrings.prop]: parseSubstringHighlights(code, meta[exports.CodeHighlighterMetaKeys.highlightSubstrings.data]),
115
115
  };
116
116
  }
117
117
  return {};
@@ -123,23 +123,29 @@ function parseBoolean(str) {
123
123
  return false;
124
124
  return false;
125
125
  }
126
- function parseRowHighlights(str, codeLines) {
126
+ function parseRowHighlights(codeLines, str) {
127
+ if (!str)
128
+ return [];
127
129
  if (str === "")
128
130
  return [];
129
131
  return str
130
132
  .split(",")
131
133
  .map((item) => {
132
134
  item = item.trim();
133
- const splitted = item.split("-");
134
- const start = Number.isNaN(parseInt(splitted[0], 10)) ? -1 : parseInt(splitted[0], 10);
135
+ const split = item.split("-");
136
+ let start = 0;
135
137
  let end = 0;
136
- if (splitted.length === 1) {
137
- end = Number.isNaN(start + 1) ? -1 : start + 1;
138
+ if (split.length === 0)
139
+ return { start, end, properties: { class: highlightRowsClass } };
140
+ const val = parseAndRemoveIfInvalid(split[0]);
141
+ start = val - 1;
142
+ if (split.length === 1) {
143
+ end = val;
138
144
  }
139
145
  else {
140
- end = Number.isNaN(parseInt(splitted[1], 10)) ? -1 : parseInt(splitted[1], 10);
146
+ end = parseAndRemoveIfInvalid(split[1]);
141
147
  }
142
- return { start, end };
148
+ return { start, end, properties: { class: highlightRowsClass } };
143
149
  })
144
150
  .filter((item) => {
145
151
  if (item.start === -1 || item.end === -1)
@@ -148,6 +154,43 @@ function parseRowHighlights(str, codeLines) {
148
154
  return false;
149
155
  return true;
150
156
  });
157
+ function parseAndRemoveIfInvalid(value) {
158
+ const parsed = parseInt(value, 10);
159
+ if (Number.isNaN(parsed))
160
+ return -1;
161
+ if (parsed < 0)
162
+ return -1;
163
+ if (parsed > codeLines)
164
+ return -1;
165
+ return parsed;
166
+ }
167
+ }
168
+ function parseSubstringHighlights(code, str) {
169
+ if (!str)
170
+ return [];
171
+ if (!code)
172
+ return [];
173
+ return str
174
+ .split(" ")
175
+ .map((item) => window.atob(item))
176
+ .reduce((acc, item) => acc.concat(findAllNonOverlappingSubstrings(code, item)), []);
177
+ function findAllNonOverlappingSubstrings(str, code) {
178
+ const result = [];
179
+ let startIndex = 0;
180
+ const searchLength = code.length;
181
+ while (startIndex <= str.length - searchLength) {
182
+ const index = str.indexOf(code, startIndex);
183
+ if (index === -1)
184
+ break;
185
+ result.push({
186
+ start: index,
187
+ end: index + searchLength,
188
+ properties: { class: highlightSubstringsClass },
189
+ });
190
+ startIndex = index + searchLength; // Jump past this match
191
+ }
192
+ return result;
193
+ }
151
194
  }
152
195
  exports.CodeHighlighterMetaKeys = {
153
196
  language: { data: "data-language", prop: "language" },
@@ -164,7 +164,6 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
164
164
  break;
165
165
  }
166
166
  case "text": {
167
- console.log("gap", gap);
168
167
  formControl = ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus, maxLength: maxTextLength !== null && maxTextLength !== void 0 ? maxTextLength : validations === null || validations === void 0 ? void 0 : validations.maxLength, gap: gap })));
169
168
  break;
170
169
  }
@@ -62,6 +62,9 @@ exports.HeadingMd = (0, ComponentDefs_1.createMetadata)({
62
62
  [`textColor-${COMP}`]: "inherit",
63
63
  [`fontWeight-${COMP}`]: "$fontWeight-bold",
64
64
  [`letterSpacing-${COMP} `]: "0",
65
+ [`color-anchor-${COMP} `]: "$color-surface-400",
66
+ [`gap-anchor-${COMP} `]: "$space-2",
67
+ [`textDecorationLine-anchor-${COMP} `]: "underline",
65
68
  light: {
66
69
  // --- No light-specific theme vars
67
70
  },
@@ -50,7 +50,7 @@ exports.Heading = (0, react_1.forwardRef)(function Heading(_a, forwardedRef) {
50
50
  return registerHeading === null || registerHeading === void 0 ? void 0 : registerHeading({
51
51
  id: anchorId,
52
52
  level: parseInt(level.replace("h", "")),
53
- text: elementRef.current.textContent.trim(),
53
+ text: elementRef.current.textContent.trim().replace(/#$/, ""), // Remove trailing #
54
54
  anchor: anchorRef.current,
55
55
  });
56
56
  }
@@ -860,8 +860,8 @@ exports.HtmlOlMd = (0, ComponentDefs_1.createMetadata)({
860
860
  isHtmlTag: true,
861
861
  themeVars: (0, themeVars_1.parseScssVar)(HtmlTags_module_scss_1.default.themeVarsList), // Use only themeVarsList
862
862
  defaultThemeVars: {
863
- "marginTop-HtmlOl": "$space-4",
864
- "marginBottom-HtmlOl": "$space-4",
863
+ "marginTop-HtmlOl": "$space-5",
864
+ "marginBottom-HtmlOl": "$space-5",
865
865
  },
866
866
  });
867
867
  exports.htmlOlTagRenderer = (0, renderers_1.createComponentRenderer)("ol", exports.HtmlOlMd, // Use HtmlOlMd instead of HtmlListMd
@@ -1278,7 +1278,7 @@ exports.HtmlThMd = (0, ComponentDefs_1.createMetadata)({
1278
1278
  "padding-HtmlTh": "$space-2",
1279
1279
  "fontSize-HtmlTh": "$fontSize-tiny",
1280
1280
  "fontWeight-HtmlTh": "$fontWeight-bold",
1281
- "backgroundColor-HtmlTh--hover": "$color-surface-200",
1281
+ //"backgroundColor-HtmlTh--hover": "$color-surface-200",
1282
1282
  },
1283
1283
  });
1284
1284
  exports.htmlThTagRenderer = (0, renderers_1.createComponentRenderer)("th", exports.HtmlThMd, ({ node, renderChild, extractValue, extractResourceUrl, layoutCss }) => {
@@ -1323,7 +1323,7 @@ exports.HtmlTrMd = (0, ComponentDefs_1.createMetadata)({
1323
1323
  defaultThemeVars: {
1324
1324
  "fontSize-HtmlTr": "$fontSize-small",
1325
1325
  "backgroundColor-row-HtmlTr": "inherit",
1326
- "backgroundColor-HtmlTr--hover": "$color-primary-50",
1326
+ //"backgroundColor-HtmlTr--hover": "$color-primary-50",
1327
1327
  },
1328
1328
  });
1329
1329
  exports.htmlTrTagRenderer = (0, renderers_1.createComponentRenderer)("tr", exports.HtmlTrMd, ({ node, renderChild, extractValue, extractResourceUrl, layoutCss }) => {
@@ -1366,8 +1366,8 @@ exports.HtmlUlMd = (0, ComponentDefs_1.createMetadata)({
1366
1366
  isHtmlTag: true,
1367
1367
  themeVars: (0, themeVars_1.parseScssVar)(HtmlTags_module_scss_1.default.themeVarsList), // Use only themeVarsList
1368
1368
  defaultThemeVars: {
1369
- "marginTop-HtmlUl": "$space-2",
1370
- "marginBottom-HtmlUl": "$space-2",
1369
+ "marginTop-HtmlUl": "$space-5",
1370
+ "marginBottom-HtmlUl": "$space-5",
1371
1371
  },
1372
1372
  });
1373
1373
  exports.htmlUlTagRenderer = (0, renderers_1.createComponentRenderer)("ul", exports.HtmlUlMd, // Use HtmlOlMd instead of HtmlListMd
@@ -34,8 +34,12 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
34
34
  },
35
35
  defaultThemeVars: {
36
36
  "backgroundColor-Admonition": "$color-primary-100",
37
- "borderRadius-Admonition": "$space-2",
38
37
  "border-Admonition": "1px solid $color-primary-300",
38
+ "backgroundColor-Admonition-warning": "$color-warn-100",
39
+ "borderColor-Admonition-warning": "$color-warn-300",
40
+ "backgroundColor-Admonition-danger": "$color-danger-100",
41
+ "borderColor-Admonition-danger": "$color-danger-300",
42
+ "borderRadius-Admonition": "$space-2",
39
43
  "iconSize-Admonition": "$space-5",
40
44
  "paddingLeft-Admonition": "$space-2",
41
45
  "paddingRight-Admonition": "$space-6",
@@ -28,9 +28,10 @@ const TextNative_1 = require("../Text/TextNative");
28
28
  const LinkNative_1 = require("../Link/LinkNative");
29
29
  const Toggle_1 = require("../Toggle/Toggle");
30
30
  const NestedAppNative_1 = require("../NestedApp/NestedAppNative");
31
- const highlight_code_1 = require("./highlight-code");
31
+ const highlight_code_1 = require("../CodeBlock/highlight-code");
32
32
  const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
33
33
  const CodeBlockNative_1 = require("../CodeBlock/CodeBlockNative");
34
+ const classnames_1 = __importDefault(require("classnames"));
34
35
  function PreTagComponent({ id, children, codeHighlighter }) {
35
36
  // TEMP: After ironing out theming for syntax highlighting, this should be removed
36
37
  const { activeThemeTone } = (0, ThemeContext_1.useTheme)();
@@ -49,6 +50,17 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
49
50
  return null;
50
51
  }
51
52
  children = removeIndents ? removeTextIndents(children) : children;
53
+ const renderHeading = (level, children) => {
54
+ if (typeof children === "string") {
55
+ const [headingLabel, anchorId] = getCustomAnchor(children);
56
+ if (anchorId) {
57
+ const currentPath = window.location.href.replace(/(?<!\/)#.*$/, "");
58
+ const href = `${currentPath}#${anchorId}`;
59
+ return ((0, jsx_runtime_1.jsxs)(HeadingNative_1.Heading, { level: level, id: anchorId, children: [headingLabel, (0, jsx_runtime_1.jsx)("a", { href: href, id: anchorId, "aria-label": "Permalink for this section", children: "#" })] }));
60
+ }
61
+ }
62
+ return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: level, children: children });
63
+ };
52
64
  return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.markdownContent, style: Object.assign({}, style), children: (0, jsx_runtime_1.jsx)(react_markdown_1.MarkdownHooks, { remarkPlugins: [remark_gfm_1.default, CodeBlockNative_1.markdownCodeBlockParser], rehypePlugins: [rehype_raw_1.default], components: {
53
65
  details(_a) {
54
66
  var { children, node } = _a, props = __rest(_a, ["children", "node"]);
@@ -70,22 +82,22 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
70
82
  }
71
83
  },
72
84
  h1({ children }) {
73
- return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h1", children: children });
85
+ return renderHeading("h1", children);
74
86
  },
75
87
  h2({ children }) {
76
- return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h2", children: children });
88
+ return renderHeading("h2", children);
77
89
  },
78
90
  h3({ children }) {
79
- return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h3", children: children });
91
+ return renderHeading("h3", children);
80
92
  },
81
93
  h4({ children }) {
82
- return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h4", children: children });
94
+ return renderHeading("h4", children);
83
95
  },
84
96
  h5({ children }) {
85
- return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h5", children: children });
97
+ return renderHeading("h5", children);
86
98
  },
87
99
  h6({ children }) {
88
- return (0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: "h6", children: children });
100
+ return renderHeading("h6", children);
89
101
  },
90
102
  p({ id, children }) {
91
103
  return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "markdown", children: children }));
@@ -94,7 +106,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
94
106
  return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "code", children: children }));
95
107
  },
96
108
  pre({ id, children }) {
97
- return (0, jsx_runtime_1.jsx)(PreTagComponent, { id: id, codeHighlighter: codeHighlighter, children: children });
109
+ return ((0, jsx_runtime_1.jsx)(PreTagComponent, { id: id, codeHighlighter: codeHighlighter, children: children }));
98
110
  },
99
111
  strong({ id, children }) {
100
112
  return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, { uid: id, variant: "strong", children: children }));
@@ -180,6 +192,20 @@ function removeTextIndents(input) {
180
192
  const trimmedLines = lines.map((line) => line.startsWith(" ".repeat(minIndent)) ? line.slice(minIndent) : line);
181
193
  return trimmedLines.join("\n");
182
194
  }
195
+ function getCustomAnchor(value) {
196
+ if (!value) {
197
+ return ["", ""];
198
+ }
199
+ // --- Match the pattern: "Heading text [#anchor]"
200
+ const match = value.match(/^(.*?)\s*\[#([^\]]+)\]$/);
201
+ if (match) {
202
+ const headingLabel = match[1].trim(); // Extract the heading text
203
+ const anchorId = match[2].trim(); // Extract the anchor ID
204
+ return [headingLabel, anchorId];
205
+ }
206
+ // If no match, return the full value as the heading label and an empty anchor ID
207
+ return [value.trim(), ""];
208
+ }
183
209
  const HorizontalRule = () => {
184
210
  return (0, jsx_runtime_1.jsx)("hr", { className: Markdown_module_scss_1.default.horizontalRule });
185
211
  };
@@ -237,7 +263,13 @@ const Blockquote = ({ children, style }) => {
237
263
  };
238
264
  const processedChildren = react_2.default.Children.map(children, processNode);
239
265
  // Render admonition blockquote with the updated structure
240
- return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.admonitionBlockquote, style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: Markdown_module_scss_1.default.admonitionContainer, children: [(0, jsx_runtime_1.jsx)("div", { className: `${Markdown_module_scss_1.default.admonitionIcon} ${Markdown_module_scss_1.default[type] || ""}`, children: emojiMap[type] || "💡" }), (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.admonitionContent, children: processedChildren })] }) }));
266
+ return ((0, jsx_runtime_1.jsx)("blockquote", { className: (0, classnames_1.default)(Markdown_module_scss_1.default.admonitionBlockquote, {
267
+ [Markdown_module_scss_1.default.info]: type === "info",
268
+ [Markdown_module_scss_1.default.warning]: type === "warning",
269
+ [Markdown_module_scss_1.default.danger]: type === "danger",
270
+ [Markdown_module_scss_1.default.note]: type === "note",
271
+ [Markdown_module_scss_1.default.tip]: type === "tip",
272
+ }), style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: Markdown_module_scss_1.default.admonitionContainer, children: [(0, jsx_runtime_1.jsx)("div", { className: `${Markdown_module_scss_1.default.admonitionIcon} ${Markdown_module_scss_1.default[type] || ""}`, children: emojiMap[type] || "💡" }), (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.admonitionContent, children: processedChildren })] }) }));
241
273
  }
242
274
  return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.blockquoteContainer, children: children }) }));
243
275
  };
@@ -39,7 +39,8 @@ exports.RadioGroupMd = (0, ComponentDefs_1.createMetadata)({
39
39
  themeVars: (0, themeVars_1.parseScssVar)(RadioGroup_module_scss_1.default.themeVars),
40
40
  defaultThemeVars: {
41
41
  [`gap-${RGOption}`]: "$space-1_5",
42
- [`borderWidth-${RGOption}`]: "2px",
42
+ [`borderWidth-${RGOption}`]: "1px",
43
+ [`backgroundColor-checked-${RGOption}-indicator`]: `$backgroundColor-primary`,
43
44
  [`backgroundColor-checked-${RGOption}--disabled]`]: `$borderColor-${RGOption}--disabled`,
44
45
  [`backgroundColor-checked-${RGOption}-error`]: `$borderColor-${RGOption}-error`,
45
46
  [`backgroundColor-checked-${RGOption}-warning`]: `$borderColor-${RGOption}-warning`,
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.RadioGroupOption = exports.RadioGroup = void 0;
40
+ exports.useRadioGroupValue = useRadioGroupValue;
40
41
  const jsx_runtime_1 = require("react/jsx-runtime");
41
42
  const react_1 = __importStar(require("react"));
42
43
  const InnerRadioGroup = __importStar(require("@radix-ui/react-radio-group"));
@@ -89,16 +90,31 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup({ id, value = "
89
90
  [RadioGroup_module_scss_1.default.disabled]: !enabled,
90
91
  }), children: children }) }) }) }));
91
92
  });
93
+ function useRadioGroupValue() {
94
+ const context = (0, react_1.useContext)(RadioGroupValidationStatusContext);
95
+ if (!context) {
96
+ throw new Error("useRadioGroupValue must be used within a RadioGroup");
97
+ }
98
+ const { value } = context;
99
+ const isChecked = (0, react_1.useCallback)((optionValue) => value === optionValue, [value]);
100
+ return {
101
+ value,
102
+ isChecked,
103
+ };
104
+ }
92
105
  const RadioGroupOption = ({ value, label, enabled = true, optionRenderer, style, }) => {
93
106
  const id = (0, react_1.useId)();
94
107
  const validationContext = (0, react_1.useContext)(RadioGroupValidationStatusContext);
108
+ const { isChecked } = useRadioGroupValue();
95
109
  const statusStyles = (0, react_1.useMemo)(() => ({
96
110
  [RadioGroup_module_scss_1.default.disabled]: !enabled,
97
111
  [RadioGroup_module_scss_1.default.error]: value === validationContext.value && validationContext.status === "error",
98
112
  [RadioGroup_module_scss_1.default.warning]: value === validationContext.value && validationContext.status === "warning",
99
113
  [RadioGroup_module_scss_1.default.valid]: value === validationContext.value && validationContext.status === "valid",
100
114
  }), [enabled, validationContext.status, validationContext.value, value]);
101
- const item = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles), value: value, disabled: !enabled, id: id, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.label, statusStyles), children: label !== null && label !== void 0 ? label : value })] })), [enabled, id, label, statusStyles, value]);
115
+ const item = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles, {
116
+ [RadioGroup_module_scss_1.default.checked]: isChecked(value),
117
+ }), value: value, disabled: !enabled, id: id, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.label, statusStyles), children: label !== null && label !== void 0 ? label : value })] })), [enabled, id, label, statusStyles, value]);
102
118
  return ((0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.radioOptionContainer, style: style, children: optionRenderer ? ((0, jsx_runtime_1.jsxs)("label", { className: RadioGroup_module_scss_1.default.optionLabel, children: [(0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.itemContainer, children: item }), optionRenderer({
103
119
  $checked: value === validationContext.value,
104
120
  })] })) : (item) }, id));
@@ -48,9 +48,11 @@ exports.SwitchMd = (0, ComponentDefs_1.createMetadata)({
48
48
  [`backgroundColor-checked-${COMP}-warning`]: `$borderColor-${COMP}-warning`,
49
49
  [`borderColor-checked-${COMP}-success`]: `$borderColor-${COMP}-success`,
50
50
  [`backgroundColor-checked-${COMP}-success`]: `$borderColor-${COMP}-success`,
51
- [`backgroundColor-${COMP}`]: "$color-surface-400",
52
- [`borderColor-${COMP}`]: "$color-surface-400",
53
- [`backgroundColor-indicator-${COMP}`]: "$backgroundColor-primary",
51
+ [`backgroundColor-${COMP}`]: "$backgroundColor-primary",
52
+ [`borderColor-${COMP}`]: "$color-surface-200",
53
+ [`borderWidth-${COMP}`]: "1px",
54
+ [`backgroundColor-indicator-${COMP}`]: "$color-surface-200",
55
+ [`backgroundColor-indicator-checked-${COMP}`]: "$backgroundColor-primary",
54
56
  [`borderColor-checked-${COMP}`]: "$color-primary-500",
55
57
  [`backgroundColor-checked-${COMP}`]: "$color-primary-500",
56
58
  [`backgroundColor-${COMP}--disabled`]: "$color-surface-200",