sk-clib 1.4.0 → 1.6.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,32 +199,16 @@
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;
215
- }
216
202
  .flex {
217
203
  display: flex;
218
204
  }
219
205
  .aspect-square {
220
206
  aspect-ratio: 1 / 1;
221
207
  }
222
- .size-6 {
223
- width: calc(var(--spacing) * 6);
224
- height: calc(var(--spacing) * 6);
225
- }
226
208
  .size-full {
227
209
  width: 100%;
228
210
  height: 100%;
229
211
  }
230
- .h-12 {
231
- height: calc(var(--spacing) * 12);
232
- }
233
212
  .h-fit {
234
213
  height: fit-content;
235
214
  }
@@ -251,9 +230,6 @@
251
230
  .cursor-pointer {
252
231
  cursor: pointer;
253
232
  }
254
- .resize {
255
- resize: both;
256
- }
257
233
  .flex-col {
258
234
  flex-direction: column;
259
235
  }
@@ -266,37 +242,18 @@
266
242
  .justify-center {
267
243
  justify-content: center;
268
244
  }
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
245
  .rounded-md {
279
246
  border-radius: var(--radius-md);
280
247
  }
281
- .border {
282
- border-style: var(--tw-border-style);
283
- border-width: 1px;
284
- }
285
248
  .bg-\[var\(--color-primary\)\] {
286
249
  background-color: var(--color-primary);
287
250
  }
288
251
  .bg-black {
289
252
  background-color: var(--color-black);
290
253
  }
291
- .bg-surface-0 {
292
- background-color: var(--color-surface-0);
293
- }
294
254
  .px-4 {
295
255
  padding-inline: calc(var(--spacing) * 4);
296
256
  }
297
- .px-\[20\%\] {
298
- padding-inline: 20%;
299
- }
300
257
  .py-2 {
301
258
  padding-block: calc(var(--spacing) * 2);
302
259
  }
@@ -344,38 +301,12 @@
344
301
  --tw-font-weight: var(--font-weight-semibold);
345
302
  font-weight: var(--font-weight-semibold);
346
303
  }
347
- .whitespace-nowrap {
348
- white-space: nowrap;
349
- }
350
304
  .text-white {
351
305
  color: var(--color-white);
352
306
  }
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
307
  .italic {
366
308
  font-style: italic;
367
309
  }
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
310
  .data-\[state\=toggled\]\:bg-black {
380
311
  &[data-state="toggled"] {
381
312
  background-color: var(--color-black);
@@ -387,25 +318,14 @@
387
318
  }
388
319
  }
389
320
  }
390
- @property --tw-border-style {
391
- syntax: "*";
392
- inherits: false;
393
- initial-value: solid;
394
- }
395
321
  @property --tw-font-weight {
396
322
  syntax: "*";
397
323
  inherits: false;
398
324
  }
399
- @property --tw-duration {
400
- syntax: "*";
401
- inherits: false;
402
- }
403
325
  @layer properties {
404
326
  @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
405
327
  *, ::before, ::after, ::backdrop {
406
- --tw-border-style: solid;
407
328
  --tw-font-weight: initial;
408
- --tw-duration: initial;
409
329
  }
410
330
  }
411
331
  }
@@ -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
+ -->