@miethe/ui 0.2.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/CHANGELOG.md +77 -0
- package/README.md +1536 -0
- package/dist/bulk-actions/Button.d.ts +28 -0
- package/dist/bulk-actions/Button.d.ts.map +1 -0
- package/dist/bulk-actions/Button.js +45 -0
- package/dist/bulk-actions/Button.js.map +1 -0
- package/dist/bulk-actions/bulk-action-bar.d.ts +91 -0
- package/dist/bulk-actions/bulk-action-bar.d.ts.map +1 -0
- package/dist/bulk-actions/bulk-action-bar.js +94 -0
- package/dist/bulk-actions/bulk-action-bar.js.map +1 -0
- package/dist/bulk-actions/index.d.ts +5 -0
- package/dist/bulk-actions/index.d.ts.map +1 -0
- package/dist/bulk-actions/index.js +7 -0
- package/dist/bulk-actions/index.js.map +1 -0
- package/dist/bulk-actions/utils.d.ts +6 -0
- package/dist/bulk-actions/utils.d.ts.map +1 -0
- package/dist/bulk-actions/utils.js +9 -0
- package/dist/bulk-actions/utils.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +23 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/button.d.ts +12 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +34 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +7 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +4 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +7 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/content-viewer/ContentPane.d.ts +107 -0
- package/dist/content-viewer/ContentPane.d.ts.map +1 -0
- package/dist/content-viewer/ContentPane.js +247 -0
- package/dist/content-viewer/ContentPane.js.map +1 -0
- package/dist/content-viewer/ContentViewerProvider.d.ts +83 -0
- package/dist/content-viewer/ContentViewerProvider.d.ts.map +1 -0
- package/dist/content-viewer/ContentViewerProvider.js +92 -0
- package/dist/content-viewer/ContentViewerProvider.js.map +1 -0
- package/dist/content-viewer/FileTree.d.ts +71 -0
- package/dist/content-viewer/FileTree.d.ts.map +1 -0
- package/dist/content-viewer/FileTree.js +294 -0
- package/dist/content-viewer/FileTree.js.map +1 -0
- package/dist/content-viewer/adapters.d.ts +101 -0
- package/dist/content-viewer/adapters.d.ts.map +1 -0
- package/dist/content-viewer/adapters.js +32 -0
- package/dist/content-viewer/adapters.js.map +1 -0
- package/dist/content-viewer/index.d.ts +8 -0
- package/dist/content-viewer/index.d.ts.map +1 -0
- package/dist/content-viewer/index.js +5 -0
- package/dist/content-viewer/index.js.map +1 -0
- package/dist/diff/DiffViewer.d.ts +112 -0
- package/dist/diff/DiffViewer.d.ts.map +1 -0
- package/dist/diff/DiffViewer.js +414 -0
- package/dist/diff/DiffViewer.js.map +1 -0
- package/dist/diff/diff.d.ts +32 -0
- package/dist/diff/diff.d.ts.map +1 -0
- package/dist/diff/diff.js +8 -0
- package/dist/diff/diff.js.map +1 -0
- package/dist/diff/index.d.ts +4 -0
- package/dist/diff/index.d.ts.map +1 -0
- package/dist/diff/index.js +3 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/display/FilePreviewPane.d.ts +31 -0
- package/dist/display/FilePreviewPane.d.ts.map +1 -0
- package/dist/display/FilePreviewPane.js +144 -0
- package/dist/display/FilePreviewPane.js.map +1 -0
- package/dist/display/FrontmatterDisplay.d.ts +33 -0
- package/dist/display/FrontmatterDisplay.d.ts.map +1 -0
- package/dist/display/FrontmatterDisplay.js +79 -0
- package/dist/display/FrontmatterDisplay.js.map +1 -0
- package/dist/display/index.d.ts +5 -0
- package/dist/display/index.d.ts.map +1 -0
- package/dist/display/index.js +4 -0
- package/dist/display/index.js.map +1 -0
- package/dist/editor/MarkdownEditor.d.ts +28 -0
- package/dist/editor/MarkdownEditor.d.ts.map +1 -0
- package/dist/editor/MarkdownEditor.js +160 -0
- package/dist/editor/MarkdownEditor.js.map +1 -0
- package/dist/editor/SplitPreview.d.ts +28 -0
- package/dist/editor/SplitPreview.d.ts.map +1 -0
- package/dist/editor/SplitPreview.js +34 -0
- package/dist/editor/SplitPreview.js.map +1 -0
- package/dist/editor/index.d.ts +5 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +4 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/filters/filters-dropdown.d.ts +24 -0
- package/dist/filters/filters-dropdown.d.ts.map +1 -0
- package/dist/filters/filters-dropdown.js +36 -0
- package/dist/filters/filters-dropdown.js.map +1 -0
- package/dist/filters/index.d.ts +9 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/index.js +5 -0
- package/dist/filters/index.js.map +1 -0
- package/dist/filters/sort-dropdown.d.ts +13 -0
- package/dist/filters/sort-dropdown.d.ts.map +1 -0
- package/dist/filters/sort-dropdown.js +20 -0
- package/dist/filters/sort-dropdown.js.map +1 -0
- package/dist/filters/tag-filter-popover.d.ts +39 -0
- package/dist/filters/tag-filter-popover.d.ts.map +1 -0
- package/dist/filters/tag-filter-popover.js +72 -0
- package/dist/filters/tag-filter-popover.js.map +1 -0
- package/dist/filters/tool-filter-popover.d.ts +42 -0
- package/dist/filters/tool-filter-popover.d.ts.map +1 -0
- package/dist/filters/tool-filter-popover.js +67 -0
- package/dist/filters/tool-filter-popover.js.map +1 -0
- package/dist/hooks/use-debounce.d.ts +9 -0
- package/dist/hooks/use-debounce.d.ts.map +1 -0
- package/dist/hooks/use-debounce.js +21 -0
- package/dist/hooks/use-debounce.js.map +1 -0
- package/dist/hooks/use-intersection-observer.d.ts +11 -0
- package/dist/hooks/use-intersection-observer.d.ts.map +1 -0
- package/dist/hooks/use-intersection-observer.js +25 -0
- package/dist/hooks/use-intersection-observer.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/pickers/EntityPickerDialog.d.ts +233 -0
- package/dist/pickers/EntityPickerDialog.d.ts.map +1 -0
- package/dist/pickers/EntityPickerDialog.js +355 -0
- package/dist/pickers/EntityPickerDialog.js.map +1 -0
- package/dist/pickers/EntityPickerViewToggle.d.ts +8 -0
- package/dist/pickers/EntityPickerViewToggle.d.ts.map +1 -0
- package/dist/pickers/EntityPickerViewToggle.js +17 -0
- package/dist/pickers/EntityPickerViewToggle.js.map +1 -0
- package/dist/pickers/index.d.ts +5 -0
- package/dist/pickers/index.d.ts.map +1 -0
- package/dist/pickers/index.js +3 -0
- package/dist/pickers/index.js.map +1 -0
- package/dist/primitives/Badge.d.ts +16 -0
- package/dist/primitives/Badge.d.ts.map +1 -0
- package/dist/primitives/Badge.js +43 -0
- package/dist/primitives/Badge.js.map +1 -0
- package/dist/primitives/BaseArtifactModal.d.ts +114 -0
- package/dist/primitives/BaseArtifactModal.d.ts.map +1 -0
- package/dist/primitives/BaseArtifactModal.js +76 -0
- package/dist/primitives/BaseArtifactModal.js.map +1 -0
- package/dist/primitives/Dialog.d.ts +20 -0
- package/dist/primitives/Dialog.d.ts.map +1 -0
- package/dist/primitives/Dialog.js +24 -0
- package/dist/primitives/Dialog.js.map +1 -0
- package/dist/primitives/DropdownMenu.d.ts +28 -0
- package/dist/primitives/DropdownMenu.d.ts.map +1 -0
- package/dist/primitives/DropdownMenu.js +34 -0
- package/dist/primitives/DropdownMenu.js.map +1 -0
- package/dist/primitives/EnterpriseOwnerBadge.d.ts +9 -0
- package/dist/primitives/EnterpriseOwnerBadge.d.ts.map +1 -0
- package/dist/primitives/EnterpriseOwnerBadge.js +12 -0
- package/dist/primitives/EnterpriseOwnerBadge.js.map +1 -0
- package/dist/primitives/GroupedSelect.d.ts +30 -0
- package/dist/primitives/GroupedSelect.d.ts.map +1 -0
- package/dist/primitives/GroupedSelect.js +47 -0
- package/dist/primitives/GroupedSelect.js.map +1 -0
- package/dist/primitives/Input.d.ts +6 -0
- package/dist/primitives/Input.d.ts.map +1 -0
- package/dist/primitives/Input.js +9 -0
- package/dist/primitives/Input.js.map +1 -0
- package/dist/primitives/LockIcon.d.ts +11 -0
- package/dist/primitives/LockIcon.d.ts.map +1 -0
- package/dist/primitives/LockIcon.js +15 -0
- package/dist/primitives/LockIcon.js.map +1 -0
- package/dist/primitives/MaskedSecretInput.d.ts +16 -0
- package/dist/primitives/MaskedSecretInput.d.ts.map +1 -0
- package/dist/primitives/MaskedSecretInput.js +42 -0
- package/dist/primitives/MaskedSecretInput.js.map +1 -0
- package/dist/primitives/ModalHeader.d.ts +66 -0
- package/dist/primitives/ModalHeader.d.ts.map +1 -0
- package/dist/primitives/ModalHeader.js +58 -0
- package/dist/primitives/ModalHeader.js.map +1 -0
- package/dist/primitives/Popover.d.ts +9 -0
- package/dist/primitives/Popover.d.ts.map +1 -0
- package/dist/primitives/Popover.js +13 -0
- package/dist/primitives/Popover.js.map +1 -0
- package/dist/primitives/ScrollArea.d.ts +6 -0
- package/dist/primitives/ScrollArea.d.ts.map +1 -0
- package/dist/primitives/ScrollArea.js +11 -0
- package/dist/primitives/ScrollArea.js.map +1 -0
- package/dist/primitives/SearchableCombobox.d.ts +30 -0
- package/dist/primitives/SearchableCombobox.d.ts.map +1 -0
- package/dist/primitives/SearchableCombobox.js +124 -0
- package/dist/primitives/SearchableCombobox.js.map +1 -0
- package/dist/primitives/SearchablePickerDialog.d.ts +20 -0
- package/dist/primitives/SearchablePickerDialog.d.ts.map +1 -0
- package/dist/primitives/SearchablePickerDialog.js +78 -0
- package/dist/primitives/SearchablePickerDialog.js.map +1 -0
- package/dist/primitives/StatusBadge.d.ts +21 -0
- package/dist/primitives/StatusBadge.d.ts.map +1 -0
- package/dist/primitives/StatusBadge.js +25 -0
- package/dist/primitives/StatusBadge.js.map +1 -0
- package/dist/primitives/TabNavigation.d.ts +68 -0
- package/dist/primitives/TabNavigation.d.ts.map +1 -0
- package/dist/primitives/TabNavigation.js +74 -0
- package/dist/primitives/TabNavigation.js.map +1 -0
- package/dist/primitives/Tabs.d.ts +8 -0
- package/dist/primitives/Tabs.d.ts.map +1 -0
- package/dist/primitives/Tabs.js +14 -0
- package/dist/primitives/Tabs.js.map +1 -0
- package/dist/primitives/Tooltip.d.ts +8 -0
- package/dist/primitives/Tooltip.d.ts.map +1 -0
- package/dist/primitives/Tooltip.js +12 -0
- package/dist/primitives/Tooltip.js.map +1 -0
- package/dist/primitives/VerticalTabNavigation.d.ts +75 -0
- package/dist/primitives/VerticalTabNavigation.d.ts.map +1 -0
- package/dist/primitives/VerticalTabNavigation.js +166 -0
- package/dist/primitives/VerticalTabNavigation.js.map +1 -0
- package/dist/primitives/ViewModeToggle.d.ts +12 -0
- package/dist/primitives/ViewModeToggle.d.ts.map +1 -0
- package/dist/primitives/ViewModeToggle.js +56 -0
- package/dist/primitives/ViewModeToggle.js.map +1 -0
- package/dist/primitives/WizardShell.d.ts +81 -0
- package/dist/primitives/WizardShell.d.ts.map +1 -0
- package/dist/primitives/WizardShell.js +73 -0
- package/dist/primitives/WizardShell.js.map +1 -0
- package/dist/primitives/index.d.ts +38 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/index.js +24 -0
- package/dist/primitives/index.js.map +1 -0
- package/dist/primitives/utils.d.ts +6 -0
- package/dist/primitives/utils.d.ts.map +1 -0
- package/dist/primitives/utils.js +9 -0
- package/dist/primitives/utils.js.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +63 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +345 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/perf-marks.d.ts +28 -0
- package/dist/utils/perf-marks.d.ts.map +1 -0
- package/dist/utils/perf-marks.js +45 -0
- package/dist/utils/perf-marks.js.map +1 -0
- package/dist/utils/readme-utils.d.ts +67 -0
- package/dist/utils/readme-utils.d.ts.map +1 -0
- package/dist/utils/readme-utils.js +164 -0
- package/dist/utils/readme-utils.js.map +1 -0
- package/dist/utils/type-colors.d.ts +70 -0
- package/dist/utils/type-colors.d.ts.map +1 -0
- package/dist/utils/type-colors.js +118 -0
- package/dist/utils/type-colors.js.map +1 -0
- package/package.json +131 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frontmatter parsing utility for YAML frontmatter in markdown files.
|
|
3
|
+
*
|
|
4
|
+
* Handles detection, parsing, and stripping of YAML frontmatter blocks
|
|
5
|
+
* delimited by `---` markers at the start of content.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This implementation uses a simple YAML parser for common cases.
|
|
8
|
+
* For production use with complex YAML, consider adding `yaml` or `js-yaml` package.
|
|
9
|
+
*/
|
|
10
|
+
/** Regex pattern to detect and capture frontmatter */
|
|
11
|
+
const FRONTMATTER_REGEX = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
|
|
12
|
+
/**
|
|
13
|
+
* Detects whether content contains YAML frontmatter.
|
|
14
|
+
*
|
|
15
|
+
* Frontmatter must start at the beginning of the content with `---`
|
|
16
|
+
* followed by a newline, and end with `---` followed by a newline.
|
|
17
|
+
*
|
|
18
|
+
* @param content - The string content to check
|
|
19
|
+
* @returns true if frontmatter is present, false otherwise
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* detectFrontmatter('---\ntitle: Hello\n---\nContent'); // true
|
|
24
|
+
* detectFrontmatter('# Just markdown'); // false
|
|
25
|
+
* detectFrontmatter(''); // false
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function detectFrontmatter(content) {
|
|
29
|
+
if (!content || typeof content !== 'string') {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return FRONTMATTER_REGEX.test(content);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Parses YAML frontmatter from content.
|
|
36
|
+
*
|
|
37
|
+
* Extracts the YAML block and returns both the parsed frontmatter object
|
|
38
|
+
* and the remaining content with frontmatter stripped.
|
|
39
|
+
*
|
|
40
|
+
* @param content - The string content to parse
|
|
41
|
+
* @returns Object containing frontmatter (null if invalid/missing) and clean content
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const result = parseFrontmatter('---\ntitle: Hello\nauthor: World\n---\nContent here');
|
|
46
|
+
* // result.frontmatter = { title: 'Hello', author: 'World' }
|
|
47
|
+
* // result.content = 'Content here'
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export function parseFrontmatter(content) {
|
|
51
|
+
if (!content || typeof content !== 'string') {
|
|
52
|
+
return { frontmatter: null, content: content || '' };
|
|
53
|
+
}
|
|
54
|
+
const match = content.match(FRONTMATTER_REGEX);
|
|
55
|
+
if (!match) {
|
|
56
|
+
return { frontmatter: null, content };
|
|
57
|
+
}
|
|
58
|
+
const yamlContent = match[1] ?? '';
|
|
59
|
+
const cleanContent = content.slice(match[0].length);
|
|
60
|
+
try {
|
|
61
|
+
const frontmatter = parseYaml(yamlContent);
|
|
62
|
+
return { frontmatter, content: cleanContent };
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.warn('[frontmatter] Failed to parse YAML frontmatter:', error instanceof Error ? error.message : String(error));
|
|
66
|
+
return { frontmatter: null, content: cleanContent };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Strips frontmatter from content, returning only the body.
|
|
71
|
+
*
|
|
72
|
+
* This is a convenience function when you only need the content
|
|
73
|
+
* without the frontmatter metadata.
|
|
74
|
+
*
|
|
75
|
+
* @param content - The string content to process
|
|
76
|
+
* @returns Content with frontmatter removed
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* stripFrontmatter('---\ntitle: Hello\n---\nContent'); // 'Content'
|
|
81
|
+
* stripFrontmatter('No frontmatter'); // 'No frontmatter'
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function stripFrontmatter(content) {
|
|
85
|
+
if (!content || typeof content !== 'string') {
|
|
86
|
+
return content || '';
|
|
87
|
+
}
|
|
88
|
+
return content.replace(FRONTMATTER_REGEX, '');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Simple YAML parser for frontmatter.
|
|
92
|
+
*
|
|
93
|
+
* Handles common frontmatter patterns:
|
|
94
|
+
* - Key-value pairs (string, number, boolean, null)
|
|
95
|
+
* - Arrays (inline [...] and block - item format)
|
|
96
|
+
* - Nested objects (indentation-based)
|
|
97
|
+
* - Quoted strings (single and double)
|
|
98
|
+
* - Multi-line strings (limited support)
|
|
99
|
+
*
|
|
100
|
+
* @internal
|
|
101
|
+
* @param yaml - Raw YAML string to parse
|
|
102
|
+
* @returns Parsed object
|
|
103
|
+
* @throws Error if YAML is malformed
|
|
104
|
+
*/
|
|
105
|
+
function parseYaml(yaml) {
|
|
106
|
+
if (!yaml.trim()) {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
const result = {};
|
|
110
|
+
const lines = yaml.split(/\r?\n/);
|
|
111
|
+
const stack = [
|
|
112
|
+
{ obj: result, indent: -1 },
|
|
113
|
+
];
|
|
114
|
+
let currentArrayKey = null;
|
|
115
|
+
let currentArrayIndent = -1;
|
|
116
|
+
for (let i = 0; i < lines.length; i++) {
|
|
117
|
+
const line = lines[i];
|
|
118
|
+
// Skip empty lines and comments (line is always defined in this loop)
|
|
119
|
+
if (!line || !line.trim() || line.trim().startsWith('#')) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const indent = line.search(/\S/);
|
|
123
|
+
const trimmedLine = line.trim();
|
|
124
|
+
// Handle array items (- value)
|
|
125
|
+
if (trimmedLine.startsWith('- ')) {
|
|
126
|
+
if (currentArrayKey && indent > currentArrayIndent) {
|
|
127
|
+
const arrayValue = trimmedLine.slice(2).trim();
|
|
128
|
+
const currentFrame = stack[stack.length - 1];
|
|
129
|
+
if (currentFrame) {
|
|
130
|
+
const arr = currentFrame.obj[currentArrayKey];
|
|
131
|
+
arr.push(parseValue(arrayValue));
|
|
132
|
+
}
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Reset array context if indent changes
|
|
137
|
+
if (indent <= currentArrayIndent) {
|
|
138
|
+
currentArrayKey = null;
|
|
139
|
+
currentArrayIndent = -1;
|
|
140
|
+
}
|
|
141
|
+
// Pop stack for decreased indent
|
|
142
|
+
while (stack.length > 1) {
|
|
143
|
+
const topFrame = stack[stack.length - 1];
|
|
144
|
+
if (!topFrame || indent > topFrame.indent)
|
|
145
|
+
break;
|
|
146
|
+
stack.pop();
|
|
147
|
+
}
|
|
148
|
+
// Parse key-value pair
|
|
149
|
+
const colonIndex = trimmedLine.indexOf(':');
|
|
150
|
+
if (colonIndex === -1) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const key = trimmedLine.slice(0, colonIndex).trim();
|
|
154
|
+
const rawValue = trimmedLine.slice(colonIndex + 1).trim();
|
|
155
|
+
if (!key) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
const targetFrame = stack[stack.length - 1];
|
|
159
|
+
if (!targetFrame) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const target = targetFrame.obj;
|
|
163
|
+
if (rawValue === '') {
|
|
164
|
+
// Check if next line starts an array or nested object
|
|
165
|
+
const nextLine = lines[i + 1];
|
|
166
|
+
if (nextLine && nextLine.trim().startsWith('- ')) {
|
|
167
|
+
// Array starting on next line
|
|
168
|
+
target[key] = [];
|
|
169
|
+
currentArrayKey = key;
|
|
170
|
+
currentArrayIndent = indent;
|
|
171
|
+
}
|
|
172
|
+
else if (nextLine) {
|
|
173
|
+
const nextIndent = nextLine.search(/\S/);
|
|
174
|
+
if (nextIndent > indent && nextLine.includes(':')) {
|
|
175
|
+
// Nested object
|
|
176
|
+
const nested = {};
|
|
177
|
+
target[key] = nested;
|
|
178
|
+
stack.push({ obj: nested, indent });
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
target[key] = null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
target[key] = null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else if (rawValue.startsWith('[') && rawValue.endsWith(']')) {
|
|
189
|
+
// Inline array
|
|
190
|
+
target[key] = parseInlineArray(rawValue);
|
|
191
|
+
}
|
|
192
|
+
else if (rawValue.startsWith('{') && rawValue.endsWith('}')) {
|
|
193
|
+
// Inline object
|
|
194
|
+
target[key] = parseInlineObject(rawValue);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
target[key] = parseValue(rawValue);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return result;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Parse a single YAML value.
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
function parseValue(value) {
|
|
207
|
+
if (!value) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
// Handle quoted strings
|
|
211
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
212
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
213
|
+
return value.slice(1, -1);
|
|
214
|
+
}
|
|
215
|
+
// Handle booleans
|
|
216
|
+
const lowerValue = value.toLowerCase();
|
|
217
|
+
if (lowerValue === 'true' || lowerValue === 'yes' || lowerValue === 'on') {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
if (lowerValue === 'false' || lowerValue === 'no' || lowerValue === 'off') {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
// Handle null
|
|
224
|
+
if (lowerValue === 'null' || lowerValue === '~') {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
// Handle numbers
|
|
228
|
+
if (/^-?\d+$/.test(value)) {
|
|
229
|
+
return parseInt(value, 10);
|
|
230
|
+
}
|
|
231
|
+
if (/^-?\d+\.\d+$/.test(value)) {
|
|
232
|
+
return parseFloat(value);
|
|
233
|
+
}
|
|
234
|
+
// Handle ISO date strings (keep as string for now)
|
|
235
|
+
// Return as-is string
|
|
236
|
+
return value;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Parse inline YAML array: [item1, item2, item3]
|
|
240
|
+
* @internal
|
|
241
|
+
*/
|
|
242
|
+
function parseInlineArray(value) {
|
|
243
|
+
const inner = value.slice(1, -1).trim();
|
|
244
|
+
if (!inner) {
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
const items = [];
|
|
248
|
+
let current = '';
|
|
249
|
+
let depth = 0;
|
|
250
|
+
let inQuote = null;
|
|
251
|
+
for (let i = 0; i < inner.length; i++) {
|
|
252
|
+
const char = inner[i];
|
|
253
|
+
if (inQuote) {
|
|
254
|
+
current += char;
|
|
255
|
+
if (char === inQuote && inner[i - 1] !== '\\') {
|
|
256
|
+
inQuote = null;
|
|
257
|
+
}
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (char === '"' || char === "'") {
|
|
261
|
+
inQuote = char;
|
|
262
|
+
current += char;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (char === '[' || char === '{') {
|
|
266
|
+
depth++;
|
|
267
|
+
current += char;
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (char === ']' || char === '}') {
|
|
271
|
+
depth--;
|
|
272
|
+
current += char;
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (char === ',' && depth === 0) {
|
|
276
|
+
items.push(parseValue(current.trim()));
|
|
277
|
+
current = '';
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
current += char;
|
|
281
|
+
}
|
|
282
|
+
if (current.trim()) {
|
|
283
|
+
items.push(parseValue(current.trim()));
|
|
284
|
+
}
|
|
285
|
+
return items;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Parse inline YAML object: {key1: value1, key2: value2}
|
|
289
|
+
* @internal
|
|
290
|
+
*/
|
|
291
|
+
function parseInlineObject(value) {
|
|
292
|
+
const inner = value.slice(1, -1).trim();
|
|
293
|
+
if (!inner) {
|
|
294
|
+
return {};
|
|
295
|
+
}
|
|
296
|
+
const result = {};
|
|
297
|
+
let current = '';
|
|
298
|
+
let depth = 0;
|
|
299
|
+
let inQuote = null;
|
|
300
|
+
const pairs = [];
|
|
301
|
+
for (let i = 0; i < inner.length; i++) {
|
|
302
|
+
const char = inner[i];
|
|
303
|
+
if (inQuote) {
|
|
304
|
+
current += char;
|
|
305
|
+
if (char === inQuote && inner[i - 1] !== '\\') {
|
|
306
|
+
inQuote = null;
|
|
307
|
+
}
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
if (char === '"' || char === "'") {
|
|
311
|
+
inQuote = char;
|
|
312
|
+
current += char;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (char === '[' || char === '{') {
|
|
316
|
+
depth++;
|
|
317
|
+
current += char;
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
320
|
+
if (char === ']' || char === '}') {
|
|
321
|
+
depth--;
|
|
322
|
+
current += char;
|
|
323
|
+
continue;
|
|
324
|
+
}
|
|
325
|
+
if (char === ',' && depth === 0) {
|
|
326
|
+
pairs.push(current.trim());
|
|
327
|
+
current = '';
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
current += char;
|
|
331
|
+
}
|
|
332
|
+
if (current.trim()) {
|
|
333
|
+
pairs.push(current.trim());
|
|
334
|
+
}
|
|
335
|
+
for (const pair of pairs) {
|
|
336
|
+
const colonIndex = pair.indexOf(':');
|
|
337
|
+
if (colonIndex !== -1) {
|
|
338
|
+
const key = pair.slice(0, colonIndex).trim();
|
|
339
|
+
const val = pair.slice(colonIndex + 1).trim();
|
|
340
|
+
result[key] = parseValue(val);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../src/utils/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,sDAAsD;AACtD,MAAM,iBAAiB,GAAG,mCAAmC,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAI9C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC;IACvD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE/C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,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KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAC3B,OAAO,GAAG,EAAE,CAAC;YACb,SAAS;QACX,CAAC;QAED,OAAO,IAAI,IAAI,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9C,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { parseFrontmatter, stripFrontmatter, detectFrontmatter, } from './frontmatter';
|
|
2
|
+
export { extractFirstParagraph, extractFolderReadme, } from './readme-utils';
|
|
3
|
+
export type { ReadmeSearchEntry } from './readme-utils';
|
|
4
|
+
export { markStart, markEnd } from './perf-marks';
|
|
5
|
+
export { typeBarColors, TYPE_BAR_FALLBACK, getTypeBarColor, artifactTypeCardTints, getCardTint, } from './type-colors';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,WAAW,GACZ,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @miethe/ui — utils submodule
|
|
2
|
+
export { parseFrontmatter, stripFrontmatter, detectFrontmatter, } from './frontmatter';
|
|
3
|
+
export { extractFirstParagraph, extractFolderReadme, } from './readme-utils';
|
|
4
|
+
export { markStart, markEnd } from './perf-marks';
|
|
5
|
+
export { typeBarColors, TYPE_BAR_FALLBACK, getTypeBarColor, artifactTypeCardTints, getCardTint, } from './type-colors';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,WAAW,GACZ,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* perf-marks.ts
|
|
3
|
+
*
|
|
4
|
+
* Lightweight Performance API wrappers for instrumenting content-viewer
|
|
5
|
+
* render flows. Marks are visible in browser DevTools → Performance panel traces.
|
|
6
|
+
*
|
|
7
|
+
* All marks share the configurable prefix so they can be filtered as a
|
|
8
|
+
* group in the DevTools User Timings lane.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* markStart('diff-viewer.render');
|
|
12
|
+
* // ... work ...
|
|
13
|
+
* markEnd('diff-viewer.render');
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Place a start mark.
|
|
17
|
+
* @param name Logical name for the measurement (no prefix or suffix needed).
|
|
18
|
+
*/
|
|
19
|
+
export declare function markStart(name: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Place an end mark and record a measure between the matching start mark and
|
|
22
|
+
* this end mark. If the start mark doesn't exist (e.g. the component mounted
|
|
23
|
+
* before instrumentation was added) the measure call is silently skipped.
|
|
24
|
+
*
|
|
25
|
+
* @param name Must match the name used in the corresponding markStart call.
|
|
26
|
+
*/
|
|
27
|
+
export declare function markEnd(name: string): void;
|
|
28
|
+
//# sourceMappingURL=perf-marks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perf-marks.d.ts","sourceRoot":"","sources":["../../src/utils/perf-marks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI5C;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAU1C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* perf-marks.ts
|
|
3
|
+
*
|
|
4
|
+
* Lightweight Performance API wrappers for instrumenting content-viewer
|
|
5
|
+
* render flows. Marks are visible in browser DevTools → Performance panel traces.
|
|
6
|
+
*
|
|
7
|
+
* All marks share the configurable prefix so they can be filtered as a
|
|
8
|
+
* group in the DevTools User Timings lane.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* markStart('diff-viewer.render');
|
|
12
|
+
* // ... work ...
|
|
13
|
+
* markEnd('diff-viewer.render');
|
|
14
|
+
*/
|
|
15
|
+
const PREFIX = 'content-viewer';
|
|
16
|
+
/**
|
|
17
|
+
* Place a start mark.
|
|
18
|
+
* @param name Logical name for the measurement (no prefix or suffix needed).
|
|
19
|
+
*/
|
|
20
|
+
export function markStart(name) {
|
|
21
|
+
if (typeof performance !== 'undefined') {
|
|
22
|
+
performance.mark(`${PREFIX}.${name}.start`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Place an end mark and record a measure between the matching start mark and
|
|
27
|
+
* this end mark. If the start mark doesn't exist (e.g. the component mounted
|
|
28
|
+
* before instrumentation was added) the measure call is silently skipped.
|
|
29
|
+
*
|
|
30
|
+
* @param name Must match the name used in the corresponding markStart call.
|
|
31
|
+
*/
|
|
32
|
+
export function markEnd(name) {
|
|
33
|
+
if (typeof performance === 'undefined')
|
|
34
|
+
return;
|
|
35
|
+
const startMark = `${PREFIX}.${name}.start`;
|
|
36
|
+
const endMark = `${PREFIX}.${name}.end`;
|
|
37
|
+
performance.mark(endMark);
|
|
38
|
+
try {
|
|
39
|
+
performance.measure(`${PREFIX}.${name}`, startMark, endMark);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Start mark may not exist if component mounted before instrumentation
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=perf-marks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perf-marks.js","sourceRoot":"","sources":["../../src/utils/perf-marks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAEhC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE,CAAC;QACvC,WAAW,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,IAAI,QAAQ,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,IAAI,OAAO,WAAW,KAAK,WAAW;QAAE,OAAO;IAC/C,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,IAAI,QAAQ,CAAC;IAC5C,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,IAAI,MAAM,CAAC;IACxC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1B,IAAI,CAAC;QACH,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;IACzE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* README and first-paragraph extraction utilities for markdown content.
|
|
3
|
+
*
|
|
4
|
+
* These utilities are generic and work with any entry type that has a `path`
|
|
5
|
+
* field and optionally `content` and `metadata` fields. The `CatalogEntry`
|
|
6
|
+
* type from SkillMeat structurally satisfies `ReadmeSearchEntry`, so no
|
|
7
|
+
* call-site changes are required in the main app.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Duck-typed interface for entries that can be searched for a README file.
|
|
11
|
+
*
|
|
12
|
+
* Only the fields actually accessed by `extractFolderReadme` are required.
|
|
13
|
+
* Any object with at least a `path` string field satisfies this interface,
|
|
14
|
+
* including SkillMeat's `CatalogEntry`.
|
|
15
|
+
*/
|
|
16
|
+
export interface ReadmeSearchEntry {
|
|
17
|
+
/** File path for this entry (forward or backward slash separators accepted) */
|
|
18
|
+
path: string;
|
|
19
|
+
/** Optional raw file content — used to extract the first paragraph */
|
|
20
|
+
content?: string;
|
|
21
|
+
/** Optional metadata object — checked for a `description` fallback */
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extract README content from folder artifacts.
|
|
26
|
+
*
|
|
27
|
+
* Looks for README.md or readme.md files in the folder's direct artifacts
|
|
28
|
+
* and extracts a summary (first paragraph or summary section).
|
|
29
|
+
*
|
|
30
|
+
* @param folderPath - The folder path to find README for
|
|
31
|
+
* @param entries - All catalog entries to search
|
|
32
|
+
* @returns Extracted summary string or null if no README found
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const readme = extractFolderReadme('plugins/dev-tools', catalogEntries);
|
|
37
|
+
* // Returns: "A collection of development tools for..."
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractFolderReadme(folderPath: string, entries: ReadmeSearchEntry[]): string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Extract the first meaningful paragraph from markdown content.
|
|
43
|
+
*
|
|
44
|
+
* Skips headings, empty lines, and frontmatter.
|
|
45
|
+
* Returns first paragraph of at least 20 characters.
|
|
46
|
+
* Truncates at 300 characters with ellipsis if longer.
|
|
47
|
+
*
|
|
48
|
+
* @param content - Raw markdown content
|
|
49
|
+
* @returns First paragraph or null if none found
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const markdown = `---
|
|
54
|
+
* title: My Doc
|
|
55
|
+
* ---
|
|
56
|
+
* # Heading
|
|
57
|
+
*
|
|
58
|
+
* This is the first paragraph with meaningful content.
|
|
59
|
+
*
|
|
60
|
+
* This is the second paragraph.
|
|
61
|
+
* `;
|
|
62
|
+
* const paragraph = extractFirstParagraph(markdown);
|
|
63
|
+
* // Returns: "This is the first paragraph with meaningful content."
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function extractFirstParagraph(content: string): string | null;
|
|
67
|
+
//# sourceMappingURL=readme-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readme-utils.d.ts","sourceRoot":"","sources":["../../src/utils/readme-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,iBAAiB,EAAE,GAC3B,MAAM,GAAG,IAAI,CA4Df;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiFpE"}
|