sk-clib 0.0.6 → 1.1.1

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 (35) hide show
  1. package/dist/docs/DocTree.svelte +67 -0
  2. package/dist/docs/DocTree.svelte.d.ts +20 -0
  3. package/dist/docs/_layouts/bare.svelte +12 -0
  4. package/dist/docs/_layouts/bare.svelte.d.ts +15 -0
  5. package/dist/docs/contributing/+page.svelte +12 -0
  6. package/dist/docs/contributing/documentation/+page.svelte +12 -0
  7. package/dist/docs/contributing/documentation/sublevel/+page.svelte +12 -0
  8. package/dist/docs/contributing/library/+page.svelte +12 -0
  9. package/dist/docs/contributing/library/other.svelte +12 -0
  10. package/dist/docs/getting_started/+page.svelte +13 -0
  11. package/dist/docs/getting_started/installation.svelte +12 -0
  12. package/dist/docs/getting_started/usage.svelte +18 -0
  13. package/dist/docs/handler/handler.d.ts +49 -0
  14. package/dist/docs/handler/handler.js +74 -0
  15. package/dist/docs/handler/index.d.ts +1 -0
  16. package/dist/docs/handler/index.js +1 -0
  17. package/dist/docs/index.d.ts +0 -0
  18. package/dist/docs/index.js +1 -0
  19. package/dist/index.d.ts +1 -4
  20. package/dist/index.js +1 -5
  21. package/dist/prism.css +143 -0
  22. package/dist/prism.d.ts +46 -0
  23. package/dist/prism.js +22 -0
  24. package/dist/styles.css +397 -0
  25. package/dist/ui/button/components/button.svelte +24 -0
  26. package/dist/ui/button/components/button.svelte.d.ts +10 -0
  27. package/dist/ui/button/index.d.ts +2 -0
  28. package/dist/ui/button/index.js +1 -0
  29. package/dist/ui/button/types.d.ts +4 -0
  30. package/dist/ui/button/types.js +1 -0
  31. package/dist/ui/index.d.ts +5 -0
  32. package/dist/ui/index.js +8 -1
  33. package/dist/ui/text/types.js +1 -1
  34. package/dist/utils.js +49 -36
  35. package/package.json +21 -5
@@ -0,0 +1,67 @@
1
+ <script lang="ts">
2
+ // --- Components ---
3
+ import { Header } from '..';
4
+ import DocTree from "./DocTree.svelte"
5
+
6
+ // --- Logic ---
7
+ import type { HTMLAttributes } from 'svelte/elements';
8
+
9
+ export type DocNode = {
10
+ root?: {
11
+ metadata?: {
12
+ order?: number;
13
+ title?: string;
14
+ };
15
+ component?: typeof import('svelte').SvelteComponent;
16
+ };
17
+ component?: typeof import('svelte').SvelteComponent;
18
+ [key: string]: any;
19
+ };
20
+
21
+ /**
22
+ * Sorts the children of a documentation node by their `order` metadata.
23
+ */
24
+ function getSortedDocs(obj: Record<string, any>) {
25
+ return Object.entries(obj)
26
+ .filter(([key]) => key !== 'root')
27
+ .sort(([, a], [, b]) => {
28
+ const orderA = a?.root?.metadata?.order ?? a?.metadata?.order ?? 9999;
29
+ const orderB = b?.root?.metadata?.order ?? b?.metadata?.order ?? 9999;
30
+ return orderA - orderB;
31
+ });
32
+ }
33
+
34
+
35
+ export type tProps = HTMLAttributes<HTMLDivElement> & {
36
+ node: DocNode,
37
+ prev?: string,
38
+ }
39
+
40
+ let { children, node, prev = $bindable(''), ...rest }: tProps | any = $props();
41
+ </script>
42
+
43
+ {#if node.root}
44
+ {@const Component = node.root.component as any}
45
+ <Component prev/>
46
+ {/if}
47
+
48
+ {#each getSortedDocs(node) as [key, value]}
49
+ {#if value.root?.component}
50
+ <value.root.component prev={`${prev}${key ? '/' : ''}${key}`}/>
51
+ {:else if value.component}
52
+ <value.component prev={`${prev}${key ? '/' : ''}${key}`}/>
53
+ {/if}
54
+
55
+ {#each Object.entries(value).filter(([k]) => k !== 'root') as [subKey, subValue]}
56
+ {#if typeof subValue === 'object' && subValue !== null && 'component' in subValue}
57
+ <!-- Render actual doc file -->
58
+ {@const SubComponent = subValue.component as any}
59
+ <SubComponent prev={`${prev}${subKey ? '/' : ''}${subKey}`}/>
60
+ {:else if typeof subValue === 'object' && !['metadata'].includes(subKey)}
61
+ <!-- Recurse into folder-like object -->
62
+ <DocTree prev={`${prev}${subKey ? '/' : ''}${subKey}`} node={subValue}/>
63
+ {:else}
64
+ <!-- Not valid doc node -->
65
+ {/if}
66
+ {/each}
67
+ {/each}
@@ -0,0 +1,20 @@
1
+ import DocTree from "./DocTree.svelte";
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ export type DocNode = {
4
+ root?: {
5
+ metadata?: {
6
+ order?: number;
7
+ title?: string;
8
+ };
9
+ component?: typeof import('svelte').SvelteComponent;
10
+ };
11
+ component?: typeof import('svelte').SvelteComponent;
12
+ [key: string]: any;
13
+ };
14
+ export type tProps = HTMLAttributes<HTMLDivElement> & {
15
+ node: DocNode;
16
+ prev?: string;
17
+ };
18
+ declare const DocTree: import("svelte").Component<any, {}, "prev">;
19
+ type DocTree = ReturnType<typeof DocTree>;
20
+ export default DocTree;
@@ -0,0 +1,12 @@
1
+ <script>
2
+ import { Header } from '../..';
3
+ let {
4
+ children,
5
+ title = $bindable('Not given a title :('),
6
+ prev = $bindable(undefined)
7
+ } = $props();
8
+ </script>
9
+
10
+ <Header xl class="mt-5" id={`${prev}`}>{title}</Header>
11
+
12
+ {@render children?.()}
@@ -0,0 +1,15 @@
1
+ export default Bare;
2
+ type Bare = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Bare: import("svelte").Component<{
7
+ children: any;
8
+ title?: string;
9
+ prev?: any;
10
+ }, {}, "title" | "prev">;
11
+ type $$ComponentProps = {
12
+ children: any;
13
+ title?: string;
14
+ prev?: any;
15
+ };
@@ -0,0 +1,12 @@
1
+ <script context="module">
2
+ export const metadata = {"title":"Contributing"};
3
+ const { title } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <p>You can choose to either contribute to the documentation or the library</p>
12
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,12 @@
1
+ <script context="module">
2
+ export const metadata = {"order":1,"title":"Contributing to Documentation"};
3
+ const { order, title } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <p>So, you want to contribute to the documentation?</p>
12
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,12 @@
1
+ <script context="module">
2
+ export const metadata = {"title":"This is a sub level","order":6};
3
+ const { title, order } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <p>This is a dope sub level</p>
12
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,12 @@
1
+ <script context="module">
2
+ export const metadata = {"order":2,"title":"Contributing to Library"};
3
+ const { order, title } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <p>So, you want to contribute to the library?</p>
12
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,12 @@
1
+ <script context="module">
2
+ export const metadata = {"title":"Other Doc Key","order":2};
3
+ const { title, order } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <p> sma lama duma</p>
12
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,13 @@
1
+ <script context="module">
2
+ export const metadata = {"order":0,"strong":true,"title":null};
3
+ const { order, strong, title } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <header>sk-clib</header>
12
+ <p>A flexible and modular component library built for my SvelteKit projects.</p>
13
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,12 @@
1
+ <script context="module">
2
+ export const metadata = {"title":"📦 Installation","order":1};
3
+ const { title, order } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <pre class="language-bash">{@html `<code class="language-bash">bun <span class="token function">install</span> sk-clib</code>`}</pre>
12
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,18 @@
1
+ <script context="module">
2
+ export const metadata = {"title":"🔧 Usage","order":0};
3
+ const { title, order } = metadata;
4
+ </script>
5
+
6
+ <script>
7
+ import Layout_MDSVEX_DEFAULT from '/home/runner/work/sk-clib/sk-clib/src/lib/docs/_layouts/bare.svelte';
8
+ </script>
9
+
10
+ <Layout_MDSVEX_DEFAULT {...$$props} {...metadata}>
11
+ <p>Once installed, you can import and use components like this:</p>
12
+ <pre class="language-html">{@html `<code class="language-html"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span><span class="token punctuation">></span></span><span class="token script"><span class="token language-javascript">
13
+ <span class="token keyword">import</span> <span class="token punctuation">&#123;</span> Header<span class="token punctuation">,</span> Text <span class="token punctuation">&#125;</span> <span class="token keyword">from</span> <span class="token string">'sk-clib'</span><span class="token punctuation">;</span>
14
+ </span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">></span></span>
15
+
16
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>Header</span> <span class="token attr-name">lg</span> <span class="token attr-name">bold</span><span class="token punctuation">></span></span>Welp... Hi there :)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>Header</span><span class="token punctuation">></span></span>
17
+ <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>Text</span> <span class="token attr-name">size</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>lg<span class="token punctuation">"</span></span> <span class="token attr-name">weight</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>bold<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>Hello World<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>Text</span><span class="token punctuation">></span></span></code>`}</pre>
18
+ </Layout_MDSVEX_DEFAULT>
@@ -0,0 +1,49 @@
1
+ import type { SvelteComponent } from 'svelte';
2
+ /**
3
+ * Read DocComponent object, where `.component` is just a svelteComponent that can be rendered
4
+ */
5
+ export type DocComponent = {
6
+ path: string;
7
+ component: typeof SvelteComponent;
8
+ metadata?: Record<string, unknown>;
9
+ };
10
+ /**
11
+ * Represents a Svelte component that has been dynamically imported.
12
+ *
13
+ * @property default - The default export of the imported module, which should be a Svelte component constructor.
14
+ */
15
+ export type ImportedComponent = {
16
+ default: typeof SvelteComponent;
17
+ metadata: Record<string, unknown>;
18
+ };
19
+ /**
20
+ * Handles the discovery, parsing, organization, and setup of documentation components.
21
+ *
22
+ * The `DocsHandler` class is responsible for scanning the documentation directory,
23
+ * parsing all documentation files, and organizing them into a nested object structure
24
+ * that mirrors the folder hierarchy. It also provides access to the parsed documentation
25
+ * components and their metadata for rendering or further processing.
26
+ *
27
+ * Usage:
28
+ * ```ts
29
+ * const handler = new DocsHandler();
30
+ * const docs = handler.docs;
31
+ * ```
32
+ */
33
+ export declare class DocsHandler {
34
+ docs: Record<string, any>;
35
+ constructor();
36
+ /**
37
+ * While the naming scheme of this method is kind-of uffed-scay
38
+ * Basically this runs all the methods below to not only find, but parse, sort, and setup
39
+ * all the doc components
40
+ */
41
+ handle(): Record<string, any>;
42
+ /**
43
+ * Finds all the available documentation files, then uses the mdsvex pre-processor to convert
44
+ * them into render-able components before being passed through and casted to `DocComponent`
45
+ *
46
+ * @returns A list of doc components that can be rendered
47
+ */
48
+ findAll(): DocComponent[];
49
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Handles the discovery, parsing, organization, and setup of documentation components.
3
+ *
4
+ * The `DocsHandler` class is responsible for scanning the documentation directory,
5
+ * parsing all documentation files, and organizing them into a nested object structure
6
+ * that mirrors the folder hierarchy. It also provides access to the parsed documentation
7
+ * components and their metadata for rendering or further processing.
8
+ *
9
+ * Usage:
10
+ * ```ts
11
+ * const handler = new DocsHandler();
12
+ * const docs = handler.docs;
13
+ * ```
14
+ */
15
+ var DocsHandler = /** @class */ (function () {
16
+ function DocsHandler() {
17
+ this.docs = this.handle();
18
+ }
19
+ /**
20
+ * While the naming scheme of this method is kind-of uffed-scay
21
+ * Basically this runs all the methods below to not only find, but parse, sort, and setup
22
+ * all the doc components
23
+ */
24
+ DocsHandler.prototype.handle = function () {
25
+ var parsedDocs = this.findAll();
26
+ var root = {};
27
+ for (var _i = 0, parsedDocs_1 = parsedDocs; _i < parsedDocs_1.length; _i++) {
28
+ var entry = parsedDocs_1[_i];
29
+ // Remove leading slash and split path
30
+ var parts = entry.path.replace(/^\/?src\/lib\/docs\//, '').split('/');
31
+ var current = root;
32
+ for (var i = 0; i < parts.length; i++) {
33
+ var part = parts[i];
34
+ var isLast = i === parts.length - 1;
35
+ // If it's a +page.svx file, use 'root' as the key
36
+ if (isLast && part === '+page.svx') {
37
+ current['root'] = entry;
38
+ }
39
+ else if (isLast) {
40
+ // If it's another file, use the file name (without extension) as the key
41
+ var fileKey = part.replace(/\.[^/.]+$/, '');
42
+ current[fileKey] = entry;
43
+ }
44
+ else {
45
+ // Folder: create if not exists
46
+ if (!current[part])
47
+ current[part] = {};
48
+ current = current[part];
49
+ }
50
+ }
51
+ }
52
+ return root;
53
+ };
54
+ /**
55
+ * Finds all the available documentation files, then uses the mdsvex pre-processor to convert
56
+ * them into render-able components before being passed through and casted to `DocComponent`
57
+ *
58
+ * @returns A list of doc components that can be rendered
59
+ */
60
+ DocsHandler.prototype.findAll = function () {
61
+ var imported_docs = import.meta.glob('@doc/**/**/*.{md,svx}', { eager: true });
62
+ var parsedDocs = Object.entries(imported_docs).map(function (_a) {
63
+ var path = _a[0], module = _a[1];
64
+ return {
65
+ path: path,
66
+ component: module.default,
67
+ metadata: module.metadata
68
+ };
69
+ });
70
+ return parsedDocs;
71
+ };
72
+ return DocsHandler;
73
+ }());
74
+ export { DocsHandler };
@@ -0,0 +1 @@
1
+ export { DocsHandler } from "./handler";
@@ -0,0 +1 @@
1
+ export { DocsHandler } from "./handler";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
package/dist/index.d.ts CHANGED
@@ -1,4 +1 @@
1
- export { default as Flex } from "./ui/flex/components/flex.svelte";
2
- export { default as Frame } from "./ui/frame/components/frame.svelte";
3
- export { default as Header } from "./ui/header/components/header.svelte";
4
- export { default as Text } from "./ui/text/components/text.svelte";
1
+ export * from "./ui";
package/dist/index.js CHANGED
@@ -1,5 +1 @@
1
- // Reexport your entry components here
2
- export { default as Flex } from "./ui/flex/components/flex.svelte";
3
- export { default as Frame } from "./ui/frame/components/frame.svelte";
4
- export { default as Header } from "./ui/header/components/header.svelte";
5
- export { default as Text } from "./ui/text/components/text.svelte";
1
+ export * from "./ui";
package/dist/prism.css ADDED
@@ -0,0 +1,143 @@
1
+ /**
2
+ * atom-dark theme for `prism.js`
3
+ * Based on Atom's `atom-dark` theme: https://github.com/atom/atom-dark-syntax
4
+ * @author Joe Gibson (@gibsjose)
5
+ */
6
+
7
+ code[class*="language-"],
8
+ pre[class*="language-"] {
9
+ color: #c5c8c6;
10
+ text-shadow: 0 1px rgba(0, 0, 0, 0.3);
11
+ font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace;
12
+ direction: ltr;
13
+ text-align: left;
14
+ white-space: pre;
15
+ word-spacing: normal;
16
+ word-break: normal;
17
+ line-height: 1.5;
18
+
19
+ -moz-tab-size: 4;
20
+ -o-tab-size: 4;
21
+ tab-size: 4;
22
+
23
+ -webkit-hyphens: none;
24
+ -moz-hyphens: none;
25
+ -ms-hyphens: none;
26
+ hyphens: none;
27
+ }
28
+
29
+ /* Code blocks */
30
+ pre[class*="language-"] {
31
+ padding: 1em;
32
+ margin: .5em 0;
33
+ overflow: auto;
34
+ border-radius: 0.3em;
35
+ }
36
+
37
+ :not(pre) > code[class*="language-"],
38
+ pre[class*="language-"] {
39
+ background: #1d1f21;
40
+ }
41
+
42
+ /* Inline code */
43
+ :not(pre) > code[class*="language-"] {
44
+ padding: .1em;
45
+ border-radius: .3em;
46
+ }
47
+
48
+ .token.comment,
49
+ .token.prolog,
50
+ .token.doctype,
51
+ .token.cdata {
52
+ color: #7C7C7C;
53
+ }
54
+
55
+ .token.punctuation {
56
+ color: #c5c8c6;
57
+ }
58
+
59
+ .namespace {
60
+ opacity: .7;
61
+ }
62
+
63
+ .token.property,
64
+ .token.keyword,
65
+ .token.tag {
66
+ color: var(--color-primary);
67
+ }
68
+
69
+ .token.class-name {
70
+ color: #FFFFB6;
71
+ text-decoration: underline;
72
+ }
73
+
74
+ .token.boolean,
75
+ .token.constant {
76
+ color: #99CC99;
77
+ }
78
+
79
+ .token.symbol,
80
+ .token.deleted {
81
+ color: #f92672;
82
+ }
83
+
84
+ .token.number {
85
+ color: #FF73FD;
86
+ }
87
+
88
+ .token.selector,
89
+ .token.attr-name,
90
+ .token.string,
91
+ .token.char,
92
+ .token.builtin,
93
+ .token.inserted {
94
+ color: var(--color-secondary);
95
+ }
96
+
97
+ .token.variable {
98
+ color: #C6C5FE;
99
+ }
100
+
101
+ .token.operator {
102
+ color: #EDEDED;
103
+ }
104
+
105
+ .token.entity {
106
+ color: #FFFFB6;
107
+ cursor: help;
108
+ }
109
+
110
+ .token.url {
111
+ color: #96CBFE;
112
+ }
113
+
114
+ .language-css .token.string,
115
+ .style .token.string {
116
+ color: #87C38A;
117
+ }
118
+
119
+ .token.atrule,
120
+ .token.attr-value {
121
+ color: #F9EE98;
122
+ }
123
+
124
+ .token.function {
125
+ color: #DAD085;
126
+ }
127
+
128
+ .token.regex {
129
+ color: #E9C062;
130
+ }
131
+
132
+ .token.important {
133
+ color: #fd971f;
134
+ }
135
+
136
+ .token.important,
137
+ .token.bold {
138
+ font-weight: bold;
139
+ }
140
+
141
+ .token.italic {
142
+ font-style: italic;
143
+ }
@@ -0,0 +1,46 @@
1
+ export namespace languages {
2
+ export namespace markup {
3
+ namespace tag { }
4
+ namespace doctype { }
5
+ }
6
+ import html = markup;
7
+ export { html };
8
+ import mathml = markup;
9
+ export { mathml };
10
+ import svg = markup;
11
+ export { svg };
12
+ export let xml: any;
13
+ import ssml = xml;
14
+ export { ssml };
15
+ import atom = xml;
16
+ export { atom };
17
+ import rss = xml;
18
+ export { rss };
19
+ export let clike: {
20
+ comment: {
21
+ pattern: RegExp;
22
+ lookbehind: boolean;
23
+ greedy: boolean;
24
+ }[];
25
+ string: {
26
+ pattern: RegExp;
27
+ greedy: boolean;
28
+ };
29
+ "class-name": {
30
+ pattern: RegExp;
31
+ lookbehind: boolean;
32
+ inside: {
33
+ punctuation: RegExp;
34
+ };
35
+ };
36
+ keyword: RegExp;
37
+ boolean: RegExp;
38
+ function: RegExp;
39
+ number: RegExp;
40
+ operator: RegExp;
41
+ punctuation: RegExp;
42
+ };
43
+ export let javascript: any;
44
+ import js = javascript;
45
+ export { js };
46
+ }