@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.
Files changed (43) hide show
  1. package/dist/{Fabric-BXYWK9V4.d.cts → Fabric-BwLKB57c.d.ts} +2 -2
  2. package/dist/{Fabric-CDFwTDyP.d.ts → Fabric-DmNaPvSq.d.cts} +2 -2
  3. package/dist/{defineProperty-hUmuXj5B.cjs → defineProperty-Cs9FivAD.cjs} +36 -36
  4. package/dist/{defineProperty-hUmuXj5B.cjs.map → defineProperty-Cs9FivAD.cjs.map} +1 -1
  5. package/dist/{defineProperty-CS9Uk_6Q.js → defineProperty-DfrsyklJ.js} +37 -37
  6. package/dist/{defineProperty-CS9Uk_6Q.js.map → defineProperty-DfrsyklJ.js.map} +1 -1
  7. package/dist/index.cjs +397 -2
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +410 -4
  10. package/dist/index.d.ts +410 -4
  11. package/dist/index.js +379 -3
  12. package/dist/index.js.map +1 -1
  13. package/dist/parsers/typescript.d.cts +1 -1
  14. package/dist/parsers/typescript.d.ts +1 -1
  15. package/dist/parsers.d.cts +1 -1
  16. package/dist/parsers.d.ts +1 -1
  17. package/dist/plugins.cjs +1 -1
  18. package/dist/plugins.d.cts +1 -1
  19. package/dist/plugins.d.ts +1 -1
  20. package/dist/plugins.js +1 -1
  21. package/dist/types-B1GXvvBG.d.ts +7 -0
  22. package/dist/types-zKAit5TK.d.cts +7 -0
  23. package/dist/types.d.cts +3 -2
  24. package/dist/types.d.ts +3 -2
  25. package/package.json +1 -1
  26. package/src/components/App.ts +38 -0
  27. package/src/components/Const.ts +56 -0
  28. package/src/components/File.ts +79 -0
  29. package/src/components/Function.ts +171 -0
  30. package/src/components/Root.ts +36 -0
  31. package/src/components/Type.ts +45 -0
  32. package/src/composables/useApp.ts +17 -0
  33. package/src/composables/useContext.ts +16 -0
  34. package/src/composables/useFile.ts +19 -0
  35. package/src/composables/useLifecycle.ts +16 -0
  36. package/src/context.ts +82 -0
  37. package/src/contexts/AppContext.ts +15 -0
  38. package/src/contexts/FileCollectorContext.ts +18 -0
  39. package/src/contexts/RootContext.ts +16 -0
  40. package/src/index.ts +26 -0
  41. package/src/types.ts +5 -0
  42. package/src/utils/FileCollector.ts +30 -0
  43. 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
+ }