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.
package/README.md CHANGED
@@ -1,22 +1,58 @@
1
- # [sk-clib](https://treltasev.github.io/sk-clib/)
1
+ # Svelte library
2
2
 
3
- [![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/sk-clib)
3
+ Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4
4
 
5
- A flexible and modular component library built for my SvelteKit projects.
5
+ Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
6
 
7
- ## 📦 Installation
7
+ ## Creating a project
8
+
9
+ If you're seeing this, you've probably already done this step. Congrats!
8
10
 
9
11
  ```bash
10
- npm install sk-clib # Install from npmjs
12
+ # create a new project in the current directory
13
+ npx sv create
14
+
15
+ # create a new project in my-app
16
+ npx sv create my-app
11
17
  ```
12
18
 
13
- ```css
14
- /* app.css */
15
- @import 'sk-clib/style';
19
+ ## Developing
20
+
21
+ Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
16
22
 
17
- /* ... Other Styling ... */
23
+ ```bash
24
+ npm run dev
25
+
26
+ # or start the server and open the app in a new browser tab
27
+ npm run dev -- --open
28
+ ```
29
+
30
+ Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
+
32
+ ## Building
33
+
34
+ To build your library:
35
+
36
+ ```bash
37
+ npm run package
18
38
  ```
19
39
 
20
- ## 🔧 Documentation
40
+ To create a production version of your showcase app:
21
41
 
22
- Take a look at [https://treltasev.github.io/sk-clib/](https://treltasev.github.io/sk-clib/)
42
+ ```bash
43
+ npm run build
44
+ ```
45
+
46
+ You can preview the production build with `npm run preview`.
47
+
48
+ > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
49
+
50
+ ## Publishing
51
+
52
+ Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53
+
54
+ To publish your library to [npm](https://www.npmjs.com):
55
+
56
+ ```bash
57
+ npm publish
58
+ ```
package/dist/styles.css CHANGED
@@ -7,7 +7,6 @@
7
7
  "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
8
8
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
9
9
  "Courier New", monospace;
10
- --color-gray-400: oklch(70.7% 0.022 261.325);
11
10
  --color-black: #000;
12
11
  --color-white: #fff;
13
12
  --spacing: 0.25rem;
@@ -31,10 +30,6 @@
31
30
  --radius-md: 0.375rem;
32
31
  --default-font-family: var(--font-sans);
33
32
  --default-mono-font-family: var(--font-mono);
34
- --color-primary: #ff7073;
35
- --color-secondary: #70ff73;
36
- --color-surface-0: #141212;
37
- --color-surface-2: #262222;
38
33
  }
39
34
  }
40
35
  @layer base {
@@ -204,14 +199,8 @@
204
199
  max-width: 96rem;
205
200
  }
206
201
  }
207
- .mt-5 {
208
- margin-top: calc(var(--spacing) * 5);
209
- }
210
- .mb-20 {
211
- margin-bottom: calc(var(--spacing) * 20);
212
- }
213
- .block {
214
- display: block;
202
+ .contents {
203
+ display: contents;
215
204
  }
216
205
  .flex {
217
206
  display: flex;
@@ -219,17 +208,10 @@
219
208
  .aspect-square {
220
209
  aspect-ratio: 1 / 1;
221
210
  }
222
- .size-6 {
223
- width: calc(var(--spacing) * 6);
224
- height: calc(var(--spacing) * 6);
225
- }
226
211
  .size-full {
227
212
  width: 100%;
228
213
  height: 100%;
229
214
  }
230
- .h-12 {
231
- height: calc(var(--spacing) * 12);
232
- }
233
215
  .h-fit {
234
216
  height: fit-content;
235
217
  }
@@ -251,9 +233,6 @@
251
233
  .cursor-pointer {
252
234
  cursor: pointer;
253
235
  }
254
- .resize {
255
- resize: both;
256
- }
257
236
  .flex-col {
258
237
  flex-direction: column;
259
238
  }
@@ -266,37 +245,18 @@
266
245
  .justify-center {
267
246
  justify-content: center;
268
247
  }
269
- .gap-4 {
270
- gap: calc(var(--spacing) * 4);
271
- }
272
- .overflow-y-auto {
273
- overflow-y: auto;
274
- }
275
- .scroll-smooth {
276
- scroll-behavior: smooth;
277
- }
278
248
  .rounded-md {
279
249
  border-radius: var(--radius-md);
280
250
  }
281
- .border {
282
- border-style: var(--tw-border-style);
283
- border-width: 1px;
284
- }
285
251
  .bg-\[var\(--color-primary\)\] {
286
252
  background-color: var(--color-primary);
287
253
  }
288
254
  .bg-black {
289
255
  background-color: var(--color-black);
290
256
  }
291
- .bg-surface-0 {
292
- background-color: var(--color-surface-0);
293
- }
294
257
  .px-4 {
295
258
  padding-inline: calc(var(--spacing) * 4);
296
259
  }
297
- .px-\[20\%\] {
298
- padding-inline: 20%;
299
- }
300
260
  .py-2 {
301
261
  padding-block: calc(var(--spacing) * 2);
302
262
  }
@@ -344,38 +304,12 @@
344
304
  --tw-font-weight: var(--font-weight-semibold);
345
305
  font-weight: var(--font-weight-semibold);
346
306
  }
347
- .whitespace-nowrap {
348
- white-space: nowrap;
349
- }
350
307
  .text-white {
351
308
  color: var(--color-white);
352
309
  }
353
- .text-white\/40 {
354
- color: color-mix(in srgb, #fff 40%, transparent);
355
- @supports (color: color-mix(in lab, red, red)) {
356
- color: color-mix(in oklab, var(--color-white) 40%, transparent);
357
- }
358
- }
359
- .text-white\/80 {
360
- color: color-mix(in srgb, #fff 80%, transparent);
361
- @supports (color: color-mix(in lab, red, red)) {
362
- color: color-mix(in oklab, var(--color-white) 80%, transparent);
363
- }
364
- }
365
310
  .italic {
366
311
  font-style: italic;
367
312
  }
368
- .duration-200 {
369
- --tw-duration: 200ms;
370
- transition-duration: 200ms;
371
- }
372
- .hover\:text-white\/100 {
373
- &:hover {
374
- @media (hover: hover) {
375
- color: var(--color-white);
376
- }
377
- }
378
- }
379
313
  .data-\[state\=toggled\]\:bg-black {
380
314
  &[data-state="toggled"] {
381
315
  background-color: var(--color-black);
@@ -387,25 +321,14 @@
387
321
  }
388
322
  }
389
323
  }
390
- @property --tw-border-style {
391
- syntax: "*";
392
- inherits: false;
393
- initial-value: solid;
394
- }
395
324
  @property --tw-font-weight {
396
325
  syntax: "*";
397
326
  inherits: false;
398
327
  }
399
- @property --tw-duration {
400
- syntax: "*";
401
- inherits: false;
402
- }
403
328
  @layer properties {
404
329
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
405
330
  *, ::before, ::after, ::backdrop {
406
- --tw-border-style: solid;
407
331
  --tw-font-weight: initial;
408
- --tw-duration: initial;
409
332
  }
410
333
  }
411
334
  }
@@ -1,24 +1,26 @@
1
- <script lang="ts">
2
- // --- Logic ---
3
- import { cn } from '../../../utils';
4
- import type { Props } from '..';
5
-
6
- let { children, class: className, buttonClass = $bindable('px-4 py-2 rounded-md bg-[var(--color-primary)] color-[var(--color-white)]'), ...rest }: Props = $props();
7
-
8
- // Setup Button's Default Class
9
- let buttonCls = $state(cn(buttonClass, className));
10
- $effect(() => {
11
- buttonCls = cn(buttonClass, className);
12
- });
13
- </script>
14
-
15
- <button class={cn(buttonCls)} {...rest} tabindex="0">
16
- {@render children?.()}
17
- </button>
18
-
19
- <!--@component
20
- Generated by SvelteForge🔥
21
-
22
- # Button Component
23
- Simple button component for easy customization and easy onclick functionality
24
- -->
1
+ <script lang="ts">
2
+ // --- Logic ---
3
+ import { cn } from '../../../utils';
4
+ import type { Props } from '..';
5
+
6
+ let { children, class: className, buttonClass = $bindable('px-4 py-2 rounded-md bg-[var(--color-primary)] color-[var(--color-white)]'), ...rest }: Props = $props();
7
+
8
+
9
+ // Setup Button's Default Class
10
+ let buttonCls = $state(cn(buttonClass, className));
11
+ $effect(() => {
12
+ buttonCls = cn(buttonClass, className);
13
+ });
14
+ </script>
15
+
16
+ <button class={cn(buttonCls)} {...rest} tabindex="0">
17
+ {@render children?.()}
18
+ </button>
19
+
20
+ <!--@component
21
+ Generated by SvelteForge🔥
22
+
23
+ # Button Component
24
+ Simple button component for easy customization and easy onclick functionality
25
+ Button is easily configured, colored, and will also abide to WCAG standards.
26
+ -->
@@ -2,8 +2,9 @@ import type { Props } from '..';
2
2
  /**
3
3
  * Generated by SvelteForge🔥
4
4
  *
5
- * # Button Component
6
- * Simple button component for easy customization and easy onclick functionality
5
+ * # Button Component
6
+ * Simple button component for easy customization and easy onclick functionality
7
+ * Button is easily configured, colored, and will also abide to WCAG standards.
7
8
  */
8
9
  declare const Button: import("svelte").Component<Props, {}, "buttonClass">;
9
10
  type Button = ReturnType<typeof Button>;
@@ -1,28 +1,28 @@
1
- <script lang="ts">
2
-
3
- // --- Components ---
4
- import { Frame } from "../.."
5
-
6
- // --- Logic ---
7
- import { cn } from '../../../utils';
8
- import type { Props } from ".."
9
-
10
- let {
11
- children,
12
- class: className,
13
- ...rest
14
- }: Props = $props();
15
-
16
- </script>
17
-
18
- <Frame class={ cn(className) } {...rest} flex>
19
- {@render children?.()}
20
- </Frame>
21
-
22
- <!--@component
23
- Generated by SvelteForge🔥
24
-
25
- # Flex Component
26
- Wrapper component for Frame with the flex attribute passed
27
- -->
28
-
1
+ <script lang="ts">
2
+
3
+ // --- Components ---
4
+ import { Frame } from "../.."
5
+
6
+ // --- Logic ---
7
+ import { cn } from '../../../utils';
8
+ import type { Props } from ".."
9
+
10
+ let {
11
+ children,
12
+ class: className,
13
+ ...rest
14
+ }: Props = $props();
15
+
16
+ </script>
17
+
18
+ <Frame class={ cn(className) } {...rest} flex>
19
+ {@render children?.()}
20
+ </Frame>
21
+
22
+ <!--@component
23
+ Generated by SvelteForge🔥
24
+
25
+ # Flex Component
26
+ Wrapper component for Frame with the flex attribute passed
27
+ -->
28
+
@@ -1,83 +1,83 @@
1
- <script lang="ts">
2
- // --- Logic ---
3
- import { cn, Tokenizer } from '../../../utils';
4
- import type { Props } from '..';
5
-
6
- let {
7
- children,
8
- class: className,
9
- flex = $bindable(undefined),
10
- row = $bindable(undefined),
11
- col = $bindable(undefined),
12
- center = $bindable(undefined),
13
- centerx = $bindable(undefined),
14
- centery = $bindable(undefined),
15
- fill = $bindable(undefined),
16
- fillw = $bindable(undefined),
17
- fillh = $bindable(undefined),
18
- noshrink = $bindable(undefined),
19
- aspectSquare = $bindable(undefined),
20
- cursorAuto = $bindable(undefined),
21
- cursorDefault = $bindable(undefined),
22
- cursorPointer = $bindable(undefined),
23
- ...rest
24
- }: Props = $props();
25
-
26
- const tokenInstance = new Tokenizer(className);
27
-
28
-
29
- function addTokenIf(statement: any, token: string) {
30
- if (statement === true) {
31
- className += ` ${token}`;
32
- }
33
- }
34
-
35
- // Flex Box
36
- tokenInstance.addTokenIf(flex, 'flex');
37
- tokenInstance.addTokenIf(row, 'flex-row');
38
- tokenInstance.addTokenIf(col, 'flex-col');
39
-
40
- // Positioning
41
- tokenInstance.addTokenIf(center, 'items-center justify-center');
42
- tokenInstance.addTokenIf(centerx, 'items-center');
43
- tokenInstance.addTokenIf(centery, 'justify-center');
44
-
45
- // Size Fillings
46
- tokenInstance.addTokenIf(fill, 'size-full');
47
- tokenInstance.addTokenIf(fillw, 'w-full');
48
- tokenInstance.addTokenIf(fillh, 'h-full');
49
-
50
- // Flex Config
51
- tokenInstance.addTokenIf(noshrink, 'shrink-0');
52
-
53
- // Aspect Ratios
54
- tokenInstance.addTokenIf(aspectSquare, 'aspect-square');
55
-
56
- // Cursor Options
57
- tokenInstance.addTokenIf(cursorAuto, 'cursor-auto');
58
- tokenInstance.addTokenIf(cursorDefault, 'cursor-default');
59
- tokenInstance.addTokenIf(cursorPointer, 'cursor-pointer');
60
- </script>
61
-
62
- <div class={cn(tokenInstance.className)} {...rest}>
63
- {@render children?.()}
64
- </div>
65
-
66
- <!--@component
67
- Generated by SvelteForge🔥 [Component Template]
68
-
69
- # Frame Component
70
- A simple wrapper for flexbox and other layout options.
71
- This component is a wrapper for the `div` element, with additional classes and properties to control layout and styling.
72
- It is designed to be used in conjunction with other components to create complex layouts.
73
-
74
- ## Usage
75
- ```svelte
76
- <Frame class="my-frame" flex row center fill>
77
- <ChildComponent />
78
- </Frame>
79
- ```
80
-
81
- This will create a flex container that is a row, centered, and fills the available space.
82
- The `class` prop can be used to add additional classes to the frame, and the `children` prop can be used to pass in child components.
83
- -->
1
+ <script lang="ts">
2
+ // --- Logic ---
3
+ import { cn, Tokenizer } from '../../../utils';
4
+ import type { Props } from '..';
5
+
6
+ let {
7
+ children,
8
+ class: className,
9
+ flex = $bindable(undefined),
10
+ row = $bindable(undefined),
11
+ col = $bindable(undefined),
12
+ center = $bindable(undefined),
13
+ centerx = $bindable(undefined),
14
+ centery = $bindable(undefined),
15
+ fill = $bindable(undefined),
16
+ fillw = $bindable(undefined),
17
+ fillh = $bindable(undefined),
18
+ noshrink = $bindable(undefined),
19
+ aspectSquare = $bindable(undefined),
20
+ cursorAuto = $bindable(undefined),
21
+ cursorDefault = $bindable(undefined),
22
+ cursorPointer = $bindable(undefined),
23
+ ...rest
24
+ }: Props = $props();
25
+
26
+ const tokenInstance = new Tokenizer(className);
27
+
28
+
29
+ function addTokenIf(statement: any, token: string) {
30
+ if (statement === true) {
31
+ className += ` ${token}`;
32
+ }
33
+ }
34
+
35
+ // Flex Box
36
+ tokenInstance.addTokenIf(flex, 'flex');
37
+ tokenInstance.addTokenIf(row, 'flex-row');
38
+ tokenInstance.addTokenIf(col, 'flex-col');
39
+
40
+ // Positioning
41
+ tokenInstance.addTokenIf(center, 'items-center justify-center');
42
+ tokenInstance.addTokenIf(centerx, 'items-center');
43
+ tokenInstance.addTokenIf(centery, 'justify-center');
44
+
45
+ // Size Fillings
46
+ tokenInstance.addTokenIf(fill, 'size-full');
47
+ tokenInstance.addTokenIf(fillw, 'w-full');
48
+ tokenInstance.addTokenIf(fillh, 'h-full');
49
+
50
+ // Flex Config
51
+ tokenInstance.addTokenIf(noshrink, 'shrink-0');
52
+
53
+ // Aspect Ratios
54
+ tokenInstance.addTokenIf(aspectSquare, 'aspect-square');
55
+
56
+ // Cursor Options
57
+ tokenInstance.addTokenIf(cursorAuto, 'cursor-auto');
58
+ tokenInstance.addTokenIf(cursorDefault, 'cursor-default');
59
+ tokenInstance.addTokenIf(cursorPointer, 'cursor-pointer');
60
+ </script>
61
+
62
+ <div class={cn(tokenInstance.className)} {...rest}>
63
+ {@render children?.()}
64
+ </div>
65
+
66
+ <!--@component
67
+ Generated by SvelteForge🔥 [Component Template]
68
+
69
+ # Frame Component
70
+ A simple wrapper for flexbox and other layout options.
71
+ This component is a wrapper for the `div` element, with additional classes and properties to control layout and styling.
72
+ It is designed to be used in conjunction with other components to create complex layouts.
73
+
74
+ ## Usage
75
+ ```svelte
76
+ <Frame class="my-frame" flex row center fill>
77
+ <ChildComponent />
78
+ </Frame>
79
+ ```
80
+
81
+ This will create a flex container that is a row, centered, and fills the available space.
82
+ The `class` prop can be used to add additional classes to the frame, and the `children` prop can be used to pass in child components.
83
+ -->