@rokkit/stories 1.0.0-next.158 → 1.0.0-next.159

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/stories",
3
- "version": "1.0.0-next.158",
3
+ "version": "1.0.0-next.159",
4
4
  "description": "Utilities for building tutorials.",
5
5
  "repository": {
6
6
  "type": "git",
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Jerry Thomas
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,25 +0,0 @@
1
- /**
2
- * @typedef {Object} Example
3
- * @property {Object[]} files
4
- * @property {import('svelte').SvelteComponent} App
5
- */
6
- export class StoryBuilder {
7
- constructor(sources: any, modules: any);
8
- get loading(): boolean;
9
- get error(): null;
10
- get examples(): Record<string, Example>;
11
- get fragments(): Object[];
12
- /**
13
- * @param {string} name
14
- * @returns {Example}
15
- */
16
- getExample(name: string): Example;
17
- getFragment(index: any): Object;
18
- hasExample(name: any): boolean;
19
- hasFragment(index: any): boolean;
20
- #private;
21
- }
22
- export type Example = {
23
- files: Object[];
24
- App: import("svelte").SvelteComponent;
25
- };
package/dist/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export { default as Code } from "./Code.svelte";
2
- export { default as CodeViewer } from "./CodeViewer.svelte";
3
- export { default as CopyToClipboard } from "./CopyToClipboard.svelte";
4
- export { default as Demo } from "./Demo.svelte";
5
- export { default as StoryViewer } from "./StoryViewer.svelte";
6
- export { default as StoryComponent } from "./StoryComponent.svelte";
7
- export { default as StoryError } from "./StoryError.svelte";
8
- export { default as StoryLoading } from "./StoryLoading.svelte";
9
- export { StoryBuilder } from "./builder.svelte.js";
10
- export { highlightCode, preloadHighlighter } from "./lib/shiki.js";
11
- export { fetchImports, getSlug, getSections, getAllSections, groupFiles, fetchStories, findSection, findGroupForSection } from "./lib/stories.js";
@@ -1,20 +0,0 @@
1
- /**
2
- * Highlight code using Shiki
3
- *
4
- * @param {string} code - The code to highlight
5
- * @param {object} options - Options for highlighting
6
- * @param {string} options.lang - The language to highlight
7
- * @param {string} options.theme - The theme to use for highlighting
8
- * @returns {Promise<string>} - The highlighted code as HTML
9
- */
10
- export function highlightCode(code: string, options?: {
11
- lang: string;
12
- theme: string;
13
- }): Promise<string>;
14
- export function preloadHighlighter(): Promise<void>;
15
- /**
16
- * Reset highlighter state - for testing only
17
- * @internal
18
- * @throws {Error} If called outside of test environment
19
- */
20
- export function resetForTesting(): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,118 +0,0 @@
1
- /**
2
- * Fetches the content of the sources.
3
- *
4
- * @param {Object} sources - The modules to fetch the content from.
5
- * @returns {Promise<File[]>} - The content of the modules.
6
- */
7
- export function fetchImports(sources: Object): Promise<File[]>;
8
- /**
9
- * Returns the slug of a file.
10
- *
11
- * @param {string} file - The file to get the slug from.
12
- * @returns {string} - The slug of the file.
13
- */
14
- export function getSlug(file: string): string;
15
- /**
16
- * Converts the input content into a group by catgeory
17
- * @param {ModuleFile[]} metadata - The metadata to convert.
18
- * @returns {Metadata[]} Array of section objects
19
- */
20
- export function getSections(metadata: ModuleFile[]): Metadata[];
21
- /**
22
- *
23
- * @param {File[]} files
24
- * @returns
25
- */
26
- export function groupFiles(files: File[]): {};
27
- /**
28
- * Fetches the stories.
29
- *
30
- * @param {Object} sources - The sources to fetch the content from.
31
- * @param {Object} modules - The modules to fetch the content from.
32
- * @returns {Promise<Object<string, Story>>} - The stories.
33
- */
34
- export function fetchStories(sources: Object, modules: Object): Promise<{
35
- [x: string]: Story;
36
- }>;
37
- /**
38
- * Get all individual sections flattened from groups
39
- * @param {Metadata[]} sections - The sections to flatten
40
- * @returns {Array} Array of all tutorial sections
41
- */
42
- export function getAllSections(sections: Metadata[]): any[];
43
- /**
44
- * Find a section by its ID
45
- * @param {string} slug - The section ID to find
46
- * @returns {Object|null} The section object or null if not found
47
- */
48
- export function findSection(sections: any, slug: string): Object | null;
49
- /**
50
- * Get the group that contains a specific section
51
- * @param {string} sectionId - The section ID to find the group for
52
- * @returns {Object|null} The group object or null if not found
53
- */
54
- export function findGroupForSection(sections: any, slug: any): Object | null;
55
- export type SourceFile = {
56
- /**
57
- * - The file path.
58
- */
59
- file: string;
60
- /**
61
- * - The group name.
62
- */
63
- group?: string | undefined;
64
- /**
65
- * - The file name.
66
- */
67
- name: string;
68
- /**
69
- * - The language of the file.
70
- */
71
- language: string;
72
- /**
73
- * - The content of the file.
74
- */
75
- content: string;
76
- };
77
- export type ModuleFile = {
78
- /**
79
- * - The file path.
80
- */
81
- file: string;
82
- /**
83
- * - The group name.
84
- */
85
- group?: string | undefined;
86
- /**
87
- * - The file name.
88
- */
89
- name: string;
90
- /**
91
- * - The language of the file.
92
- */
93
- language: string;
94
- /**
95
- * - The content of the file.
96
- */
97
- content: Object;
98
- };
99
- export type File = SourceFile | ModuleFile;
100
- export type Metadata = {
101
- title: string;
102
- description: string;
103
- category: string;
104
- tags: string[];
105
- depth: number;
106
- order: number;
107
- children?: Metadata[] | undefined;
108
- };
109
- export type Story = {
110
- /**
111
- * - Array of files.
112
- */
113
- files: File[];
114
- /**
115
- * - The preview component.
116
- */
117
- App?: import("svelte").SvelteComponent<Record<string, any>, any, any> | undefined;
118
- };
@@ -1 +0,0 @@
1
- export {};