@kubb/fabric-core 0.9.5 → 0.10.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/{Fabric-BXYWK9V4.d.cts → Fabric-BwLKB57c.d.ts} +2 -2
- package/dist/{Fabric-CDFwTDyP.d.ts → Fabric-DmNaPvSq.d.cts} +2 -2
- package/dist/{defineProperty-hUmuXj5B.cjs → defineProperty-Cs9FivAD.cjs} +36 -36
- package/dist/{defineProperty-hUmuXj5B.cjs.map → defineProperty-Cs9FivAD.cjs.map} +1 -1
- package/dist/{defineProperty-CS9Uk_6Q.js → defineProperty-DfrsyklJ.js} +37 -37
- package/dist/{defineProperty-CS9Uk_6Q.js.map → defineProperty-DfrsyklJ.js.map} +1 -1
- package/dist/index.cjs +397 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +410 -4
- package/dist/index.d.ts +410 -4
- package/dist/index.js +379 -3
- package/dist/index.js.map +1 -1
- package/dist/parsers/typescript.d.cts +1 -1
- package/dist/parsers/typescript.d.ts +1 -1
- package/dist/parsers.d.cts +1 -1
- package/dist/parsers.d.ts +1 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/plugins.js +1 -1
- package/dist/types-B1GXvvBG.d.ts +7 -0
- package/dist/types-zKAit5TK.d.cts +7 -0
- package/dist/types.d.cts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +1 -1
- package/src/components/App.ts +38 -0
- package/src/components/Const.ts +56 -0
- package/src/components/File.ts +79 -0
- package/src/components/Function.ts +171 -0
- package/src/components/Root.ts +36 -0
- package/src/components/Type.ts +45 -0
- package/src/composables/useApp.ts +17 -0
- package/src/composables/useContext.ts +16 -0
- package/src/composables/useFile.ts +19 -0
- package/src/composables/useLifecycle.ts +16 -0
- package/src/context.ts +82 -0
- package/src/contexts/AppContext.ts +15 -0
- package/src/contexts/FileCollectorContext.ts +18 -0
- package/src/contexts/RootContext.ts +16 -0
- package/src/index.ts +26 -0
- package/src/types.ts +5 -0
- package/src/utils/FileCollector.ts +30 -0
- package/src/utils/createJSDoc.ts +15 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as KubbFile from '../KubbFile.ts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* FileCollector is used to collect files from components via context
|
|
5
|
+
* instead of walking the DOM tree.
|
|
6
|
+
*/
|
|
7
|
+
export class FileCollector {
|
|
8
|
+
#files: Array<KubbFile.File> = []
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Add a file to the collector
|
|
12
|
+
*/
|
|
13
|
+
add(file: KubbFile.File): void {
|
|
14
|
+
this.#files.push(file)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get all collected files
|
|
19
|
+
*/
|
|
20
|
+
get files(): Array<KubbFile.File> {
|
|
21
|
+
return [...this.#files]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Clear all collected files
|
|
26
|
+
*/
|
|
27
|
+
clear(): void {
|
|
28
|
+
this.#files = []
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create JSDoc comment block from comments array
|
|
3
|
+
*/
|
|
4
|
+
export function createJSDoc({ comments }: { comments: string[] }): string {
|
|
5
|
+
if (!comments || comments.length === 0) return ''
|
|
6
|
+
|
|
7
|
+
const lines = comments
|
|
8
|
+
.flatMap((c) => String(c ?? '').split(/\r?\n/))
|
|
9
|
+
.map((l) => l.replace(/\*\//g, '*\\/').replace(/\r/g, ''))
|
|
10
|
+
.filter((l) => l.trim().length > 0)
|
|
11
|
+
|
|
12
|
+
if (lines.length === 0) return ''
|
|
13
|
+
|
|
14
|
+
return ['/**', ...lines.map((l) => ` * ${l}`), ' */'].join('\n')
|
|
15
|
+
}
|