@forsakringskassan/docs-generator 1.24.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 (36) hide show
  1. package/LICENSE.md +24 -0
  2. package/README.md +311 -0
  3. package/dist/compile-example.js +13406 -0
  4. package/dist/generator.d.ts +512 -0
  5. package/dist/generator.js +84168 -0
  6. package/dist/markdown.d.ts +243 -0
  7. package/dist/markdown.js +19369 -0
  8. package/dist/runtime.d.ts +1 -0
  9. package/dist/runtime.js +206572 -0
  10. package/dist/style/core.css +840 -0
  11. package/dist/style/index.css +927 -0
  12. package/dist/style/site.css +86 -0
  13. package/dist/tsdoc-metadata.json +11 -0
  14. package/package.json +68 -0
  15. package/templates/base.template.html +132 -0
  16. package/templates/component.template.html +28 -0
  17. package/templates/content-with-menu.template.html +15 -0
  18. package/templates/content-without-menu.template.html +10 -0
  19. package/templates/default.template.html +10 -0
  20. package/templates/example.template.html +70 -0
  21. package/templates/json.template.json +1 -0
  22. package/templates/macro/menu.html +39 -0
  23. package/templates/partials/footer.html +3 -0
  24. package/templates/partials/header.html +14 -0
  25. package/templates/partials/livereload.html +1 -0
  26. package/templates/partials/matomo.html +29 -0
  27. package/templates/partials/search-dialog.html +25 -0
  28. package/templates/partials/search-toolbar.html +9 -0
  29. package/templates/partials/selectable-version.html +28 -0
  30. package/templates/partials/spritesheet.html +44 -0
  31. package/templates/partials/theme-select.html +68 -0
  32. package/templates/partials/topnav.html +22 -0
  33. package/templates/partials/version-banner.html +14 -0
  34. package/templates/partials/version.html +3 -0
  35. package/templates/pattern.template.html +19 -0
  36. package/tsconfig-examples.json +9 -0
@@ -0,0 +1,243 @@
1
+ /**
2
+ * @public
3
+ */
4
+ export declare function createMarkdownRenderer(options: MarkdownOptions): MarkdownRenderer;
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ declare interface Document_2 {
10
+ /** unique identifier for this document */
11
+ id: string;
12
+ /** human-readable pseudo-identifier for this document (consider it unique but there is no contraint enforcing this) */
13
+ name: string;
14
+ /** alternative names this document can be referenced by */
15
+ alias: string[];
16
+ /** true if document should be visible in menu and similar sources */
17
+ visible: boolean;
18
+ attributes: NormalizedDocumentAttributes;
19
+ body: string;
20
+ /** Document outline (i.e. the heading structure) */
21
+ outline: DocumentOutline;
22
+ /** format of body */
23
+ format: "markdown" | "html" | "json";
24
+ tags: string[];
25
+ template: string;
26
+ fileInfo: FileInfo;
27
+ }
28
+ export { Document_2 as Document }
29
+
30
+ /**
31
+ * @public
32
+ */
33
+ export declare type DocumentBadge = "success" | "error" | "info";
34
+
35
+ /**
36
+ * Represents a document outline (i.e. the heading structure).
37
+ *
38
+ * @public
39
+ */
40
+ export declare type DocumentOutline = DocumentOutlineEntry[];
41
+
42
+ /**
43
+ * Represents a single heading (and its subheadings) in a document outline.
44
+ *
45
+ * @public
46
+ */
47
+ export declare interface DocumentOutlineEntry {
48
+ /** Heading title */
49
+ title: string;
50
+ /** Heading rank, e.g. `##` (h2) is rank 2 */
51
+ rank: number;
52
+ /** Heading anchor (id or name attribute) */
53
+ anchor: string;
54
+ /** Subheadings */
55
+ subheadings: DocumentOutline;
56
+ }
57
+
58
+ /**
59
+ * Represents an example needing compilation.
60
+ *
61
+ * The actual compilation is deferred and can be executed by calling
62
+ * `compile(..)`.
63
+ *
64
+ * @public
65
+ */
66
+ export declare interface ExampleCompiledResult {
67
+ /** Sourcecode of this example (original or imported) */
68
+ source: string;
69
+ /** Language of sourcecode (original or imported) */
70
+ language: string;
71
+ /** Associated comments from markdown */
72
+ comments: string[];
73
+ /** Tags */
74
+ tags: string[];
75
+ /** HTML markup to inject into document */
76
+ markup: string;
77
+ /** asset filename */
78
+ output: string;
79
+ /** enables running example live in the browser */
80
+ runtime: true;
81
+ /** task data for compiler */
82
+ task: ExampleCompileTask;
83
+ }
84
+
85
+ /**
86
+ * Task data shared between main process and worker.
87
+ *
88
+ * @public
89
+ */
90
+ export declare interface ExampleCompileTask {
91
+ /** output filename (without path) */
92
+ outputFile: string;
93
+ /** example sourcecode */
94
+ sourcecode: string;
95
+ /** original path to file containing example source */
96
+ sourceFile: string;
97
+ /** absolute path to document containing this example */
98
+ parent: string;
99
+ }
100
+
101
+ /**
102
+ * @public
103
+ */
104
+ export declare type ExampleResult = ExampleCompiledResult | ExampleStaticResult;
105
+
106
+ /**
107
+ * Represents an example with static code only, e.g plain HTML.
108
+ *
109
+ * @public
110
+ */
111
+ export declare interface ExampleStaticResult {
112
+ /** Sourcecode of this example (original or imported) */
113
+ source: string;
114
+ /** Language of sourcecode (original or imported) */
115
+ language: string;
116
+ /** Associated comments from markdown */
117
+ comments: string[];
118
+ /** Tags */
119
+ tags: string[];
120
+ /** HTML markup to inject into document */
121
+ markup: string;
122
+ /** asset filename */
123
+ output: null;
124
+ /** enables/disables running example live in the browser */
125
+ runtime: boolean;
126
+ }
127
+
128
+ /**
129
+ * @public
130
+ */
131
+ export declare interface FileInfo {
132
+ /** path relative to configured base */
133
+ path: string;
134
+ /** filename without extension */
135
+ name: string;
136
+ /** path relative to project root */
137
+ fullPath: string;
138
+ /** output filename or `false` to disable writing result to a file */
139
+ outputName: string | false;
140
+ }
141
+
142
+ /**
143
+ * Options for [[createMarkdownRenderer]].
144
+ *
145
+ * @public
146
+ */
147
+ export declare interface MarkdownOptions {
148
+ /** List of all available documents */
149
+ readonly docs: Document_2[];
150
+ /** Callback for adding a static resource */
151
+ addResource(dst: string, src: string): void;
152
+ /** Callback when an example should be generated */
153
+ generateExample(options: {
154
+ source: string;
155
+ language: string;
156
+ filename: string;
157
+ tags: string[];
158
+ }): ExampleResult;
159
+ /**
160
+ * Handle error which can be recovered from.
161
+ *
162
+ * If a string is returned it replaces the intended content but otherwise
163
+ * continues rendering.
164
+ *
165
+ * If the exception is rethrown it will cause the renderer to bail out.
166
+ *
167
+ * @param error - The error to be handled.
168
+ * @returns A replacement string or rethrows error.
169
+ */
170
+ handleSoftError(error: SoftErrorType): string;
171
+ }
172
+
173
+ /**
174
+ * Markdown renderer.
175
+ *
176
+ * @public
177
+ */
178
+ export declare interface MarkdownRenderer {
179
+ /**
180
+ * Render given markdown content to HTML
181
+ *
182
+ * @param doc - Document metadata.
183
+ * @param content - Markdown content to render.
184
+ * @returns HTML rendered from markdown content.
185
+ */
186
+ render(doc: Document_2, content: string): string;
187
+ }
188
+
189
+ /**
190
+ * @public
191
+ */
192
+ export declare interface NormalizedDocumentAttributes {
193
+ title?: string;
194
+ layout?: string;
195
+ status?: string;
196
+ badge?: DocumentBadge;
197
+ component?: string[];
198
+ href?: string;
199
+ /** normalized sortorder (defaults to Infinity) */
200
+ sortorder: number;
201
+ }
202
+
203
+ /**
204
+ * A soft error than can be recovered from.
205
+ *
206
+ * @public
207
+ */
208
+ export declare class SoftError<T extends SoftErrorCode> extends Error {
209
+ readonly code: T;
210
+ readonly details: SoftErrorDetails[T];
211
+ /* Excluded from this release type: __constructor */
212
+ }
213
+
214
+ /**
215
+ * @public
216
+ */
217
+ export declare type SoftErrorCode = keyof SoftErrorDetails;
218
+
219
+ /**
220
+ * @public
221
+ */
222
+ export declare interface SoftErrorDetails {
223
+ ELINKTARGET: {
224
+ key: string;
225
+ hash: string;
226
+ title: string;
227
+ };
228
+ ELINKFORMAT: undefined;
229
+ EINCLUDETARGET: {
230
+ id: string;
231
+ };
232
+ EINCLUDERECURSION: undefined;
233
+ ETAGMISSING: undefined;
234
+ }
235
+
236
+ /**
237
+ * @public
238
+ */
239
+ export declare type SoftErrorType = {
240
+ [T in SoftErrorCode]: SoftError<T>;
241
+ }[SoftErrorCode];
242
+
243
+ export { }