@qualcomm-ui/mdx-vite 2.16.2 → 2.17.0
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/ai-knowledge/generator/filter-text-directives.d.ts +3 -0
- package/dist/ai-knowledge/generator/filter-text-directives.d.ts.map +1 -0
- package/dist/ai-knowledge/generator/knowledge-generator.d.ts.map +1 -1
- package/dist/ai-knowledge/generator/section-extractor.d.ts.map +1 -1
- package/dist/cli.js +368 -86
- package/dist/cli.js.map +4 -4
- package/dist/docs-plugin/mdx-plugins.d.ts.map +1 -1
- package/dist/docs-plugin/remark/index.d.ts +1 -0
- package/dist/docs-plugin/remark/index.d.ts.map +1 -1
- package/dist/docs-plugin/remark/remark-spoilers.d.ts +1 -0
- package/dist/docs-plugin/remark/remark-spoilers.d.ts.map +1 -1
- package/dist/docs-plugin/remark/remark-steps.d.ts +58 -0
- package/dist/docs-plugin/remark/remark-steps.d.ts.map +1 -0
- package/dist/index.js +155 -43
- package/dist/index.js.map +4 -4
- package/dist/tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-plugins.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/mdx-plugins.ts"],"names":[],"mappings":"AAGA,OAAoB,EAAC,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAWpE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAW1C,OAAO,EAAe,KAAK,mBAAmB,EAAC,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"mdx-plugins.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/mdx-plugins.ts"],"names":[],"mappings":"AAGA,OAAoB,EAAC,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAWpE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAW1C,OAAO,EAAe,KAAK,mBAAmB,EAAC,MAAM,YAAY,CAAA;AAajE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAA8C,CAAA;AAE7E,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACjD;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,EAAE,CAWzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,sBAA2B,GACnC,aAAa,CAyBf;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAA8C,CAAA;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAahD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-spoilers.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-spoilers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,IAAI,EAAC,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAGnC,UAAU,cAAc;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"remark-spoilers.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-spoilers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,IAAI,EAAC,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAGnC,UAAU,cAAc;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC5B;AAUD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,WAE1C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,CA+F1D,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Root } from "mdast";
|
|
2
|
+
import type { Plugin } from "unified";
|
|
3
|
+
export declare function isStepBlock(text: string): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Transforms `:::steps` blocks into a styled `<div>` wrapper.
|
|
6
|
+
*
|
|
7
|
+
* Accepts an optional heading specifier to control which headings receive
|
|
8
|
+
* step numbering. Supports a single level (`h3`) or a range (`h2-h5`).
|
|
9
|
+
* Defaults to `h2-h4`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```
|
|
13
|
+
* :::steps
|
|
14
|
+
*
|
|
15
|
+
* ## Step 1
|
|
16
|
+
*
|
|
17
|
+
* Content for step 1.
|
|
18
|
+
*
|
|
19
|
+
* ## Step 2
|
|
20
|
+
*
|
|
21
|
+
* Content for step 2.
|
|
22
|
+
*
|
|
23
|
+
* :::/steps
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* With a single heading level:
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
* :::steps h3
|
|
30
|
+
*
|
|
31
|
+
* ### Step 1
|
|
32
|
+
*
|
|
33
|
+
* :::/steps
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* With a custom heading range:
|
|
37
|
+
*
|
|
38
|
+
* ```
|
|
39
|
+
* :::steps h2-h5
|
|
40
|
+
*
|
|
41
|
+
* ## Step 1
|
|
42
|
+
*
|
|
43
|
+
* :::/steps
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* result:
|
|
47
|
+
*
|
|
48
|
+
* ```jsx
|
|
49
|
+
* <div className="qui-docs__steps">
|
|
50
|
+
* <h2 data-step>Step 1</h2>
|
|
51
|
+
* <p>Content for step 1.</p>
|
|
52
|
+
* <h2 data-step>Step 2</h2>
|
|
53
|
+
* <p>Content for step 2.</p>
|
|
54
|
+
* </div>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare const remarkSteps: Plugin<[], Root>;
|
|
58
|
+
//# sourceMappingURL=remark-steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-steps.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-steps.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAwB,IAAI,EAAC,MAAM,OAAO,CAAA;AACtD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAyCnC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,WAEvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CA8DxC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5310,7 +5310,7 @@ import remarkParse4 from "remark-parse";
|
|
|
5310
5310
|
import remarkParseFrontmatter2 from "remark-parse-frontmatter";
|
|
5311
5311
|
import remarkStringify4 from "remark-stringify";
|
|
5312
5312
|
import { unified as unified5 } from "unified";
|
|
5313
|
-
import { visit as
|
|
5313
|
+
import { visit as visit12 } from "unist-util-visit";
|
|
5314
5314
|
import { kebabCase as kebabCase3 } from "@qualcomm-ui/utils/change-case";
|
|
5315
5315
|
|
|
5316
5316
|
// src/docs-plugin/remark/remark-extract-meta.ts
|
|
@@ -5899,11 +5899,27 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
5899
5899
|
}
|
|
5900
5900
|
};
|
|
5901
5901
|
|
|
5902
|
-
// src/ai-knowledge/generator/
|
|
5902
|
+
// src/ai-knowledge/generator/filter-text-directives.ts
|
|
5903
5903
|
import { visit as visit8 } from "unist-util-visit";
|
|
5904
|
+
var filterTextDirectives = () => {
|
|
5905
|
+
return (tree, _file, done) => {
|
|
5906
|
+
visit8(tree, "text", (node) => {
|
|
5907
|
+
const value = node.value?.trim?.();
|
|
5908
|
+
if (value && (isStepBlock(value) || isSpoilerBlock(value))) {
|
|
5909
|
+
Object.assign(node, {
|
|
5910
|
+
value: ``
|
|
5911
|
+
});
|
|
5912
|
+
}
|
|
5913
|
+
});
|
|
5914
|
+
done();
|
|
5915
|
+
};
|
|
5916
|
+
};
|
|
5917
|
+
|
|
5918
|
+
// src/ai-knowledge/generator/npm-install-tabs-plugin.ts
|
|
5919
|
+
import { visit as visit9 } from "unist-util-visit";
|
|
5904
5920
|
var formatNpmInstallTabs = () => {
|
|
5905
5921
|
return (tree, _file, done) => {
|
|
5906
|
-
|
|
5922
|
+
visit9(
|
|
5907
5923
|
tree,
|
|
5908
5924
|
"mdxJsxFlowElement",
|
|
5909
5925
|
(node, index, parent) => {
|
|
@@ -5932,7 +5948,7 @@ var formatNpmInstallTabs = () => {
|
|
|
5932
5948
|
};
|
|
5933
5949
|
|
|
5934
5950
|
// src/ai-knowledge/generator/qds-theme-plugin.ts
|
|
5935
|
-
import { visit as
|
|
5951
|
+
import { visit as visit10 } from "unist-util-visit";
|
|
5936
5952
|
function themeDataToJson(data, cssPropertyName) {
|
|
5937
5953
|
if (!data || typeof data !== "object") {
|
|
5938
5954
|
return "";
|
|
@@ -5991,7 +6007,7 @@ async function formatThemeNodes() {
|
|
|
5991
6007
|
}
|
|
5992
6008
|
};
|
|
5993
6009
|
return () => (tree, _file, done) => {
|
|
5994
|
-
|
|
6010
|
+
visit10(tree, "mdxJsxFlowElement", (node) => {
|
|
5995
6011
|
const handler = node.name && handlers[node.name];
|
|
5996
6012
|
if (!handler) {
|
|
5997
6013
|
return;
|
|
@@ -6026,7 +6042,7 @@ async function formatThemeNodes() {
|
|
|
6026
6042
|
import { toString as toString2 } from "mdast-util-to-string";
|
|
6027
6043
|
import remarkStringify3 from "remark-stringify";
|
|
6028
6044
|
import { unified as unified4 } from "unified";
|
|
6029
|
-
import { visit as
|
|
6045
|
+
import { visit as visit11 } from "unist-util-visit";
|
|
6030
6046
|
import { kebabCase as kebabCase2 } from "@qualcomm-ui/utils/change-case";
|
|
6031
6047
|
var SectionExtractor = class {
|
|
6032
6048
|
depths;
|
|
@@ -6114,6 +6130,7 @@ var SectionExtractor = class {
|
|
|
6114
6130
|
code: codeNode.value,
|
|
6115
6131
|
language: codeNode.lang ?? ""
|
|
6116
6132
|
});
|
|
6133
|
+
} else if (node.type === "text" && (isStepBlock(node.value.trim()) || isSpoilerBlock(node.value.trim()))) {
|
|
6117
6134
|
} else {
|
|
6118
6135
|
contentNodes.push(node);
|
|
6119
6136
|
}
|
|
@@ -6182,9 +6199,9 @@ var SectionExtractor = class {
|
|
|
6182
6199
|
*/
|
|
6183
6200
|
transformLinks() {
|
|
6184
6201
|
return () => (tree) => {
|
|
6185
|
-
|
|
6202
|
+
visit11(tree, "link", (node) => {
|
|
6186
6203
|
let text = "";
|
|
6187
|
-
|
|
6204
|
+
visit11(node, "text", (textNode) => {
|
|
6188
6205
|
text += textNode.value;
|
|
6189
6206
|
});
|
|
6190
6207
|
Object.assign(node, {
|
|
@@ -6333,7 +6350,7 @@ var KnowledgeGenerator = class {
|
|
|
6333
6350
|
}
|
|
6334
6351
|
formatFrontmatterExpressions(frontmatter) {
|
|
6335
6352
|
return () => (tree) => {
|
|
6336
|
-
|
|
6353
|
+
visit12(
|
|
6337
6354
|
tree,
|
|
6338
6355
|
"mdxFlowExpression",
|
|
6339
6356
|
(node, index, parent) => {
|
|
@@ -6373,7 +6390,7 @@ var KnowledgeGenerator = class {
|
|
|
6373
6390
|
if (!baseUrl || this.config.outputMode !== "per-page") {
|
|
6374
6391
|
return;
|
|
6375
6392
|
}
|
|
6376
|
-
|
|
6393
|
+
visit12(tree, "link", (node) => {
|
|
6377
6394
|
if (node.url.startsWith("/")) {
|
|
6378
6395
|
node.url = `${baseUrl}${node.url}`;
|
|
6379
6396
|
} else if (node.url.startsWith("./#") && pageUrl) {
|
|
@@ -6417,7 +6434,7 @@ var KnowledgeGenerator = class {
|
|
|
6417
6434
|
* into Markdown, resolving relative links, and cleaning up formatting.
|
|
6418
6435
|
*/
|
|
6419
6436
|
async processMdxContent(mdxContent, pageInfo, frontmatter) {
|
|
6420
|
-
const processor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(this.propFormatter.propsToMarkdownList()).use(this.formatFrontmatterExpressions(frontmatter)).use(await formatThemeNodes()).use(formatDemos(pageInfo.demosFolder)).use(this.transformRelativeUrls(pageInfo.url));
|
|
6437
|
+
const processor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(this.propFormatter.propsToMarkdownList()).use(this.formatFrontmatterExpressions(frontmatter)).use(await formatThemeNodes()).use(formatDemos(pageInfo.demosFolder)).use(filterTextDirectives).use(this.transformRelativeUrls(pageInfo.url));
|
|
6421
6438
|
this.applyPlugins(pageInfo, processor);
|
|
6422
6439
|
processor.use(remarkStringify4);
|
|
6423
6440
|
return await processor.run(processor.parse(mdxContent));
|
|
@@ -7167,7 +7184,7 @@ var rehypeSectionize = (options = defaultOptions) => {
|
|
|
7167
7184
|
};
|
|
7168
7185
|
|
|
7169
7186
|
// src/docs-plugin/remark/remark-code-tabs.ts
|
|
7170
|
-
import { visit as
|
|
7187
|
+
import { visit as visit13 } from "unist-util-visit";
|
|
7171
7188
|
function parseTabAttributes(meta) {
|
|
7172
7189
|
if (!meta) {
|
|
7173
7190
|
return { label: null, remainingMeta: "", tabsGroup: null };
|
|
@@ -7253,7 +7270,7 @@ function renderTabs(tabs, parent) {
|
|
|
7253
7270
|
var remarkCodeTabs = () => {
|
|
7254
7271
|
return (tree) => {
|
|
7255
7272
|
const transformations = [];
|
|
7256
|
-
|
|
7273
|
+
visit13(
|
|
7257
7274
|
tree,
|
|
7258
7275
|
"code",
|
|
7259
7276
|
(node, index, parent) => {
|
|
@@ -7295,10 +7312,10 @@ var remarkCodeTabs = () => {
|
|
|
7295
7312
|
};
|
|
7296
7313
|
|
|
7297
7314
|
// src/docs-plugin/remark/remark-frontmatter-description.ts
|
|
7298
|
-
import { visit as
|
|
7315
|
+
import { visit as visit14 } from "unist-util-visit";
|
|
7299
7316
|
var remarkFrontmatterDescription = () => {
|
|
7300
7317
|
return (tree) => {
|
|
7301
|
-
|
|
7318
|
+
visit14(
|
|
7302
7319
|
tree,
|
|
7303
7320
|
"mdxFlowExpression",
|
|
7304
7321
|
(node, index, parent) => {
|
|
@@ -7324,14 +7341,14 @@ var remarkFrontmatterDescription = () => {
|
|
|
7324
7341
|
};
|
|
7325
7342
|
|
|
7326
7343
|
// src/docs-plugin/remark/remark-frontmatter-title.ts
|
|
7327
|
-
import { visit as
|
|
7344
|
+
import { visit as visit15 } from "unist-util-visit";
|
|
7328
7345
|
function isMdxTextExpression(node) {
|
|
7329
7346
|
const n = node;
|
|
7330
7347
|
return n.type === "mdxTextExpression" && typeof n.value === "string";
|
|
7331
7348
|
}
|
|
7332
7349
|
var remarkFrontmatterTitle = () => {
|
|
7333
7350
|
return (tree) => {
|
|
7334
|
-
|
|
7351
|
+
visit15(
|
|
7335
7352
|
tree,
|
|
7336
7353
|
"heading",
|
|
7337
7354
|
(node, index, parent) => {
|
|
@@ -7364,7 +7381,7 @@ var remarkFrontmatterTitle = () => {
|
|
|
7364
7381
|
|
|
7365
7382
|
// src/docs-plugin/remark/remark-self-link-headings.ts
|
|
7366
7383
|
import { toString as toString3 } from "mdast-util-to-string";
|
|
7367
|
-
import { visit as
|
|
7384
|
+
import { visit as visit16 } from "unist-util-visit";
|
|
7368
7385
|
var emptyOptions2 = {};
|
|
7369
7386
|
function remarkSelfLinkHeadings(baseUrl = "", options) {
|
|
7370
7387
|
if (!baseUrl) {
|
|
@@ -7392,7 +7409,7 @@ function remarkSelfLinkHeadings(baseUrl = "", options) {
|
|
|
7392
7409
|
}
|
|
7393
7410
|
return (tree) => {
|
|
7394
7411
|
seenIds.clear();
|
|
7395
|
-
|
|
7412
|
+
visit16(tree, "heading", (node) => {
|
|
7396
7413
|
if (allowedLevels.has(node.depth)) {
|
|
7397
7414
|
const text = toString3(node);
|
|
7398
7415
|
const slug = prefix + createSlug(text);
|
|
@@ -7409,7 +7426,16 @@ function remarkSelfLinkHeadings(baseUrl = "", options) {
|
|
|
7409
7426
|
}
|
|
7410
7427
|
|
|
7411
7428
|
// src/docs-plugin/remark/remark-spoilers.ts
|
|
7412
|
-
import { visit as
|
|
7429
|
+
import { visit as visit17 } from "unist-util-visit";
|
|
7430
|
+
function getSpoilerStartMatch(text) {
|
|
7431
|
+
return text.match(/^:::\s*spoiler\s*(.*)$/);
|
|
7432
|
+
}
|
|
7433
|
+
function getSpoilerEndMatch(text) {
|
|
7434
|
+
return text.trim() === ":::";
|
|
7435
|
+
}
|
|
7436
|
+
function isSpoilerBlock(text) {
|
|
7437
|
+
return !!getSpoilerStartMatch(text) || getSpoilerEndMatch(text);
|
|
7438
|
+
}
|
|
7413
7439
|
var remarkSpoilers = (options = {}) => {
|
|
7414
7440
|
const {
|
|
7415
7441
|
defaultSummary = "Open spoiler",
|
|
@@ -7417,7 +7443,7 @@ var remarkSpoilers = (options = {}) => {
|
|
|
7417
7443
|
summaryClassName = []
|
|
7418
7444
|
} = options;
|
|
7419
7445
|
return (tree) => {
|
|
7420
|
-
|
|
7446
|
+
visit17(tree, "paragraph", (node, index, parent) => {
|
|
7421
7447
|
if (!parent || index === void 0) {
|
|
7422
7448
|
return;
|
|
7423
7449
|
}
|
|
@@ -7425,7 +7451,7 @@ var remarkSpoilers = (options = {}) => {
|
|
|
7425
7451
|
if (firstChild?.type !== "text") {
|
|
7426
7452
|
return;
|
|
7427
7453
|
}
|
|
7428
|
-
const match = firstChild.value
|
|
7454
|
+
const match = getSpoilerStartMatch(firstChild.value);
|
|
7429
7455
|
if (!match) {
|
|
7430
7456
|
return;
|
|
7431
7457
|
}
|
|
@@ -7436,7 +7462,7 @@ var remarkSpoilers = (options = {}) => {
|
|
|
7436
7462
|
const child = parent.children[endIndex];
|
|
7437
7463
|
if (child.type === "paragraph") {
|
|
7438
7464
|
const firstText = child.children[0];
|
|
7439
|
-
if (firstText?.type === "text" && firstText.value.trim()
|
|
7465
|
+
if (firstText?.type === "text" && getSpoilerEndMatch(firstText.value.trim())) {
|
|
7440
7466
|
break;
|
|
7441
7467
|
}
|
|
7442
7468
|
}
|
|
@@ -7486,6 +7512,88 @@ var remarkSpoilers = (options = {}) => {
|
|
|
7486
7512
|
};
|
|
7487
7513
|
};
|
|
7488
7514
|
|
|
7515
|
+
// src/docs-plugin/remark/remark-steps.ts
|
|
7516
|
+
import { visit as visit18 } from "unist-util-visit";
|
|
7517
|
+
var defaultAllowedHeadings = /* @__PURE__ */ new Set([2, 3, 4]);
|
|
7518
|
+
function parseHeadingRange(value) {
|
|
7519
|
+
const match = value.match(/^h([1-6])(?:-h([1-6]))?$/);
|
|
7520
|
+
if (!match) {
|
|
7521
|
+
return void 0;
|
|
7522
|
+
}
|
|
7523
|
+
const start = Number(match[1]);
|
|
7524
|
+
const end = match[2] ? Number(match[2]) : start;
|
|
7525
|
+
if (start > end) {
|
|
7526
|
+
return void 0;
|
|
7527
|
+
}
|
|
7528
|
+
const depths = /* @__PURE__ */ new Set();
|
|
7529
|
+
for (let i = start; i <= end; i++) {
|
|
7530
|
+
depths.add(i);
|
|
7531
|
+
}
|
|
7532
|
+
return depths;
|
|
7533
|
+
}
|
|
7534
|
+
function isHeading(node) {
|
|
7535
|
+
return node.type === "heading";
|
|
7536
|
+
}
|
|
7537
|
+
function getStepStartMatch(text) {
|
|
7538
|
+
return text.match(/^:::\s*steps(?:\s+(h[1-6](?:-h[1-6])?))?\s*$/);
|
|
7539
|
+
}
|
|
7540
|
+
function getStepEndMatch(text) {
|
|
7541
|
+
return text.match(/^:::\s*\/steps\s*$/);
|
|
7542
|
+
}
|
|
7543
|
+
function isStepBlock(text) {
|
|
7544
|
+
return !!(getStepStartMatch(text) || getStepEndMatch(text));
|
|
7545
|
+
}
|
|
7546
|
+
var remarkSteps = () => {
|
|
7547
|
+
return (tree) => {
|
|
7548
|
+
visit18(tree, "paragraph", (node, index, parent) => {
|
|
7549
|
+
if (!parent || index === void 0) {
|
|
7550
|
+
return;
|
|
7551
|
+
}
|
|
7552
|
+
const firstChild = node.children[0];
|
|
7553
|
+
if (firstChild?.type !== "text") {
|
|
7554
|
+
return;
|
|
7555
|
+
}
|
|
7556
|
+
const match = getStepStartMatch(firstChild.value);
|
|
7557
|
+
if (!match) {
|
|
7558
|
+
return;
|
|
7559
|
+
}
|
|
7560
|
+
const allowedHeadings = match[1] ? parseHeadingRange(match[1]) ?? defaultAllowedHeadings : defaultAllowedHeadings;
|
|
7561
|
+
let endIndex = index + 1;
|
|
7562
|
+
const contentNodes = [];
|
|
7563
|
+
while (endIndex < parent.children.length) {
|
|
7564
|
+
const child = parent.children[endIndex];
|
|
7565
|
+
if (child.type === "paragraph") {
|
|
7566
|
+
const firstText = child.children[0];
|
|
7567
|
+
if (firstText?.type === "text" && getStepEndMatch(firstText.value)) {
|
|
7568
|
+
break;
|
|
7569
|
+
}
|
|
7570
|
+
}
|
|
7571
|
+
if (isHeading(child) && allowedHeadings.has(child.depth)) {
|
|
7572
|
+
child.data = {
|
|
7573
|
+
...child.data,
|
|
7574
|
+
hProperties: {
|
|
7575
|
+
...child.data?.hProperties,
|
|
7576
|
+
"data-step": ""
|
|
7577
|
+
}
|
|
7578
|
+
};
|
|
7579
|
+
}
|
|
7580
|
+
contentNodes.push(child);
|
|
7581
|
+
endIndex++;
|
|
7582
|
+
}
|
|
7583
|
+
if (endIndex >= parent.children.length) {
|
|
7584
|
+
return;
|
|
7585
|
+
}
|
|
7586
|
+
const stepsNode = {
|
|
7587
|
+
attributes: [],
|
|
7588
|
+
children: contentNodes,
|
|
7589
|
+
name: "HeadingSteps",
|
|
7590
|
+
type: "mdxJsxFlowElement"
|
|
7591
|
+
};
|
|
7592
|
+
parent.children.splice(index, endIndex - index + 1, stepsNode);
|
|
7593
|
+
});
|
|
7594
|
+
};
|
|
7595
|
+
};
|
|
7596
|
+
|
|
7489
7597
|
// src/docs-plugin/shiki/utils.ts
|
|
7490
7598
|
function removeCodeAnnotations(code) {
|
|
7491
7599
|
const hideAnnotationRegex = /\/\/\s*\[!code\s+hide(?::\d+)?\]/;
|
|
@@ -7747,6 +7855,7 @@ function getRemarkPlugins() {
|
|
|
7747
7855
|
remarkFrontmatterTitle,
|
|
7748
7856
|
remarkFrontmatterDescription,
|
|
7749
7857
|
remarkSpoilers,
|
|
7858
|
+
remarkSteps,
|
|
7750
7859
|
remarkExtractMeta
|
|
7751
7860
|
];
|
|
7752
7861
|
}
|
|
@@ -7758,7 +7867,7 @@ import { readFile as readFile5 } from "node:fs/promises";
|
|
|
7758
7867
|
import postcss from "postcss";
|
|
7759
7868
|
import selectorParser from "postcss-selector-parser";
|
|
7760
7869
|
import { compile } from "tailwindcss";
|
|
7761
|
-
import { visit as
|
|
7870
|
+
import { visit as visit19 } from "unist-util-visit";
|
|
7762
7871
|
import { camelCase } from "@qualcomm-ui/utils/change-case";
|
|
7763
7872
|
async function loadStylesheetContent(id) {
|
|
7764
7873
|
const resolveId = id === "tailwindcss" ? "tailwindcss/index.css" : id;
|
|
@@ -8433,7 +8542,7 @@ function angularDemoPlugin({
|
|
|
8433
8542
|
}
|
|
8434
8543
|
async function extractRelativeImports2(filePath) {
|
|
8435
8544
|
try {
|
|
8436
|
-
let
|
|
8545
|
+
let visit21 = function(node) {
|
|
8437
8546
|
if (ts2.isImportDeclaration(node)) {
|
|
8438
8547
|
const moduleSpecifier = node.moduleSpecifier;
|
|
8439
8548
|
if (ts2.isStringLiteral(moduleSpecifier)) {
|
|
@@ -8452,9 +8561,9 @@ function angularDemoPlugin({
|
|
|
8452
8561
|
}
|
|
8453
8562
|
}
|
|
8454
8563
|
}
|
|
8455
|
-
ts2.forEachChild(node,
|
|
8564
|
+
ts2.forEachChild(node, visit21);
|
|
8456
8565
|
};
|
|
8457
|
-
var
|
|
8566
|
+
var visit20 = visit21;
|
|
8458
8567
|
const content = await readFile6(filePath, "utf-8");
|
|
8459
8568
|
const sourceFile = ts2.createSourceFile(
|
|
8460
8569
|
filePath,
|
|
@@ -8464,7 +8573,7 @@ function angularDemoPlugin({
|
|
|
8464
8573
|
ts2.ScriptKind.TS
|
|
8465
8574
|
);
|
|
8466
8575
|
const relativeImports = [];
|
|
8467
|
-
|
|
8576
|
+
visit21(sourceFile);
|
|
8468
8577
|
return relativeImports;
|
|
8469
8578
|
} catch (error) {
|
|
8470
8579
|
logDev(
|
|
@@ -8487,16 +8596,16 @@ function angularDemoPlugin({
|
|
|
8487
8596
|
}
|
|
8488
8597
|
function stripImports(code, fileName) {
|
|
8489
8598
|
try {
|
|
8490
|
-
let
|
|
8599
|
+
let visit21 = function(node) {
|
|
8491
8600
|
if (ts2.isImportDeclaration(node)) {
|
|
8492
8601
|
importRanges.push({
|
|
8493
8602
|
end: node.getEnd(),
|
|
8494
8603
|
start: node.getFullStart()
|
|
8495
8604
|
});
|
|
8496
8605
|
}
|
|
8497
|
-
ts2.forEachChild(node,
|
|
8606
|
+
ts2.forEachChild(node, visit21);
|
|
8498
8607
|
};
|
|
8499
|
-
var
|
|
8608
|
+
var visit20 = visit21;
|
|
8500
8609
|
const sourceFile = ts2.createSourceFile(
|
|
8501
8610
|
fileName,
|
|
8502
8611
|
code,
|
|
@@ -8505,7 +8614,7 @@ function angularDemoPlugin({
|
|
|
8505
8614
|
ts2.ScriptKind.TS
|
|
8506
8615
|
);
|
|
8507
8616
|
const importRanges = [];
|
|
8508
|
-
|
|
8617
|
+
visit21(sourceFile);
|
|
8509
8618
|
return importRanges.map((range) => {
|
|
8510
8619
|
let endPos = range.end;
|
|
8511
8620
|
if (code[endPos] === "\n") {
|
|
@@ -8617,7 +8726,7 @@ function angularDemoPlugin({
|
|
|
8617
8726
|
let templateUrl = null;
|
|
8618
8727
|
let hasDefaultExport = false;
|
|
8619
8728
|
const importsFromAst = [];
|
|
8620
|
-
function
|
|
8729
|
+
function visit20(node) {
|
|
8621
8730
|
if (ts2.isImportDeclaration(node)) {
|
|
8622
8731
|
importsFromAst.push(node.getFullText(sourceFile).trim());
|
|
8623
8732
|
}
|
|
@@ -8665,9 +8774,9 @@ function angularDemoPlugin({
|
|
|
8665
8774
|
if (ts2.isExportAssignment(node) && !node.isExportEquals) {
|
|
8666
8775
|
hasDefaultExport = true;
|
|
8667
8776
|
}
|
|
8668
|
-
ts2.forEachChild(node,
|
|
8777
|
+
ts2.forEachChild(node, visit20);
|
|
8669
8778
|
}
|
|
8670
|
-
|
|
8779
|
+
visit20(sourceFile);
|
|
8671
8780
|
return {
|
|
8672
8781
|
componentClass,
|
|
8673
8782
|
hasDefaultExport,
|
|
@@ -9124,7 +9233,7 @@ function extractImports(code, fileName) {
|
|
|
9124
9233
|
);
|
|
9125
9234
|
const thirdPartyImports = [];
|
|
9126
9235
|
const relativeImports = [];
|
|
9127
|
-
function
|
|
9236
|
+
function visit20(node) {
|
|
9128
9237
|
if (ts3.isImportDeclaration(node)) {
|
|
9129
9238
|
const importSpec = parseImportDeclaration(node, fileName);
|
|
9130
9239
|
if (importSpec) {
|
|
@@ -9135,9 +9244,9 @@ function extractImports(code, fileName) {
|
|
|
9135
9244
|
}
|
|
9136
9245
|
}
|
|
9137
9246
|
}
|
|
9138
|
-
ts3.forEachChild(node,
|
|
9247
|
+
ts3.forEachChild(node, visit20);
|
|
9139
9248
|
}
|
|
9140
|
-
|
|
9249
|
+
visit20(sourceFile);
|
|
9141
9250
|
return { relativeImports, thirdPartyImports };
|
|
9142
9251
|
}
|
|
9143
9252
|
function getScriptKind(fileName) {
|
|
@@ -9734,16 +9843,16 @@ function reactDemoPlugin({
|
|
|
9734
9843
|
}
|
|
9735
9844
|
function stripImports(code, fileName) {
|
|
9736
9845
|
try {
|
|
9737
|
-
let
|
|
9846
|
+
let visit21 = function(node) {
|
|
9738
9847
|
if (ts4.isImportDeclaration(node)) {
|
|
9739
9848
|
importRanges.push({
|
|
9740
9849
|
end: node.getEnd(),
|
|
9741
9850
|
start: node.getFullStart()
|
|
9742
9851
|
});
|
|
9743
9852
|
}
|
|
9744
|
-
ts4.forEachChild(node,
|
|
9853
|
+
ts4.forEachChild(node, visit21);
|
|
9745
9854
|
};
|
|
9746
|
-
var
|
|
9855
|
+
var visit20 = visit21;
|
|
9747
9856
|
const sourceFile = ts4.createSourceFile(
|
|
9748
9857
|
fileName,
|
|
9749
9858
|
code,
|
|
@@ -9752,7 +9861,7 @@ function reactDemoPlugin({
|
|
|
9752
9861
|
getScriptKind(fileName)
|
|
9753
9862
|
);
|
|
9754
9863
|
const importRanges = [];
|
|
9755
|
-
|
|
9864
|
+
visit21(sourceFile);
|
|
9756
9865
|
return importRanges.map((range) => {
|
|
9757
9866
|
let endPos = range.end;
|
|
9758
9867
|
if (code[endPos] === "\n") {
|
|
@@ -9806,6 +9915,8 @@ export {
|
|
|
9806
9915
|
getShikiTransformers,
|
|
9807
9916
|
isCssAsset,
|
|
9808
9917
|
isDemoFile,
|
|
9918
|
+
isSpoilerBlock,
|
|
9919
|
+
isStepBlock,
|
|
9809
9920
|
quiDocsPlugin,
|
|
9810
9921
|
quiRehypePlugins,
|
|
9811
9922
|
quiRemarkPlugins,
|
|
@@ -9822,6 +9933,7 @@ export {
|
|
|
9822
9933
|
remarkGfm2 as remarkGfm,
|
|
9823
9934
|
remarkMdxFrontmatter,
|
|
9824
9935
|
remarkSelfLinkHeadings,
|
|
9825
|
-
remarkSpoilers
|
|
9936
|
+
remarkSpoilers,
|
|
9937
|
+
remarkSteps
|
|
9826
9938
|
};
|
|
9827
9939
|
//# sourceMappingURL=index.js.map
|