sk-clib 1.5.0 → 1.7.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.
@@ -1,67 +0,0 @@
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}
@@ -1,20 +0,0 @@
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;
@@ -1,14 +0,0 @@
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
- <a href={`#${prev}`}>
11
- <Header xxl class="mt-5" id={`${prev}`}>{title}</Header>
12
- </a>
13
-
14
- {@render children?.()}
@@ -1,15 +0,0 @@
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
- };
@@ -1,28 +0,0 @@
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, either way, you’ll need to cloen this repo, most likeley as a fork.</p>
12
- <pre class="language-bash">{@html `<code class="language-bash">bun clone https://github.com/TreltaSev/sk-clib.git
13
- <span class="token builtin class-name">cd</span> sk-clib
14
- <span class="token function">npm</span> <span class="token function">install</span>
15
- <span class="token function">npm</span> run dev</code>`}</pre>
16
- <p>This should be enough to get you started.</p>
17
- <h2>Commands</h2>
18
- <ul>
19
- <li><code>npm run dev</code> – Start development server with live preview</li>
20
- <li><code>npm run build</code> – Build the library for publishing</li>
21
- <li><code>npm run lint</code> – Lint codebase</li>
22
- <li><code>npm run check</code> – Run type checking</li>
23
- <li><code>npm run test</code> – (If applicable) Run tests</li>
24
- </ul>
25
- <h2>✅ Publishing</h2>
26
- <p>Make sure everything builds correctly:</p>
27
- <pre class="language-bash">{@html `<code class="language-bash"><span class="token function">npm</span> run build</code>`}</pre>
28
- </Layout_MDSVEX_DEFAULT>
@@ -1,12 +0,0 @@
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>Just add ’[release]’ to your commit message and push to main.</p>
12
- </Layout_MDSVEX_DEFAULT>
@@ -1,12 +0,0 @@
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>Push to production branch</p>
12
- </Layout_MDSVEX_DEFAULT>
@@ -1,13 +0,0 @@
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>
@@ -1,16 +0,0 @@
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"><span class="token function">npm</span> <span class="token function">install</span> sk-clib <span class="token comment"># Install from npmjs</span></code>`}</pre>
12
- <pre class="language-css">{@html `<code class="language-css"><span class="token comment">/* app.css */</span>
13
- <span class="token atrule"><span class="token rule">@import</span> <span class="token string">'sk-clib/style'</span><span class="token punctuation">;</span></span>
14
-
15
- <span class="token comment">/* ... Other Styling ... */</span></code>`}</pre>
16
- </Layout_MDSVEX_DEFAULT>
@@ -1,18 +0,0 @@
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>
@@ -1,49 +0,0 @@
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
- }
@@ -1,74 +0,0 @@
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 };
@@ -1 +0,0 @@
1
- export { DocsHandler } from "./handler";
@@ -1 +0,0 @@
1
- export { DocsHandler } from "./handler";
File without changes
@@ -1 +0,0 @@
1
- "use strict";
package/dist/prism.css DELETED
@@ -1,143 +0,0 @@
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
- }
package/dist/prism.d.ts DELETED
@@ -1,46 +0,0 @@
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
- }