@julianelda/domos 0.0.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.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Svelte library
2
+
3
+ Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
4
+
5
+ Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
+
7
+ ## Creating a project
8
+
9
+ If you're seeing this, you've probably already done this step. Congrats!
10
+
11
+ ```sh
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
17
+ ```
18
+
19
+ To recreate this project with the same configuration:
20
+
21
+ ```sh
22
+ # recreate this project
23
+ bun x sv create --template library --types ts --add prettier eslint vitest="usages:unit,component" playwright tailwindcss="plugins:typography,forms" storybook --install bun domos
24
+ ```
25
+
26
+ ## Developing
27
+
28
+ Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
29
+
30
+ ```sh
31
+ npm run dev
32
+
33
+ # or start the server and open the app in a new browser tab
34
+ npm run dev -- --open
35
+ ```
36
+
37
+ Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
38
+
39
+ ## Building
40
+
41
+ To build your library:
42
+
43
+ ```sh
44
+ npm pack
45
+ ```
46
+
47
+ To create a production version of your showcase app:
48
+
49
+ ```sh
50
+ npm run build
51
+ ```
52
+
53
+ You can preview the production build with `npm run preview`.
54
+
55
+ > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
56
+
57
+ ## Publishing
58
+
59
+ 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/)).
60
+
61
+ To publish your library to [npm](https://www.npmjs.com):
62
+
63
+ ```sh
64
+ npm publish
65
+ ```
@@ -0,0 +1,44 @@
1
+ <script module>
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Button from "./button.svelte";
4
+ import { fn } from "storybook/test";
5
+
6
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
7
+ const { Story } = defineMeta({
8
+ title: "Button",
9
+ component: Button,
10
+ argTypes: {
11
+ id: { control: "text" },
12
+ style: {
13
+ control: { type: "select" },
14
+ options: ["primary", "secondary"],
15
+ },
16
+ text: { control: "text" },
17
+ type: {
18
+ control: { type: "select" },
19
+ options: ["button", "submit"],
20
+ },
21
+ },
22
+ args: {
23
+ onclick: fn(),
24
+ },
25
+ });
26
+ </script>
27
+
28
+ <Story
29
+ name="Primary"
30
+ args={{
31
+ id: "button",
32
+ style: "primary",
33
+ text: "Button primary",
34
+ type: "button",
35
+ }} />
36
+
37
+ <Story
38
+ name="Secondary"
39
+ args={{
40
+ id: "button",
41
+ style: "secondary",
42
+ text: "Button secondary",
43
+ type: "button",
44
+ }} />
@@ -0,0 +1,27 @@
1
+ export default Button;
2
+ type Button = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Button: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ import Button from "./button.svelte";
15
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
16
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
+ $$bindings?: Bindings;
18
+ } & Exports;
19
+ (internal: unknown, props: {
20
+ $$events?: Events;
21
+ $$slots?: Slots;
22
+ }): Exports & {
23
+ $set?: any;
24
+ $on?: any;
25
+ };
26
+ z_$$bindings?: Bindings;
27
+ }
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ id: string;
4
+ onClick: () => void;
5
+ style: "primary" | "secondary";
6
+ text: string;
7
+ type: "button" | "submit";
8
+ }
9
+
10
+ const {
11
+ id,
12
+ onClick,
13
+ style = "primary",
14
+ text,
15
+ type = "button",
16
+ }: Props = $props();
17
+ </script>
18
+
19
+ <button
20
+ data-testid={id}
21
+ {id}
22
+ onclick={onClick}
23
+ {type}
24
+ class={[
25
+ "cursor-pointer appearance-none rounded-lg p-2 text-lg shadow-sm hover:border-primary-500 hover:bg-primary-500 focus:ring-primary-300 focus-visible:outline focus-visible:outline-offset-2 focus-visible:outline-primary-300 active:bg-primary-700 dark:hover:bg-primary-500",
26
+ style === "primary"
27
+ ? "border-primary-700 bg-primary-700 text-ink-white "
28
+ : "border border-ink-500 bg-card-background-light text-ink-black hover:text-white dark:bg-slate dark:text-ink-white",
29
+ ]}>
30
+ {text}
31
+ </button>
@@ -0,0 +1,10 @@
1
+ interface Props {
2
+ id: string;
3
+ onClick: () => void;
4
+ style: "primary" | "secondary";
5
+ text: string;
6
+ type: "button" | "submit";
7
+ }
8
+ declare const Button: import("svelte").Component<Props, {}, "">;
9
+ type Button = ReturnType<typeof Button>;
10
+ export default Button;
@@ -0,0 +1,14 @@
1
+ <script module>
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+ import Card from "./card.svelte";
4
+
5
+ const { Story } = defineMeta({
6
+ title: "Card",
7
+ component: Card,
8
+ });
9
+ </script>
10
+
11
+ <Story name="Default">
12
+ <h2 class="text-lg font-semibold">Card Title</h2>
13
+ <p class="text-sm text-gray-500">This is a card description.</p>
14
+ </Story>
@@ -0,0 +1,27 @@
1
+ export default Card;
2
+ type Card = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Card: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ import Card from "./card.svelte";
15
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
16
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
+ $$bindings?: Bindings;
18
+ } & Exports;
19
+ (internal: unknown, props: {
20
+ $$events?: Events;
21
+ $$slots?: Slots;
22
+ }): Exports & {
23
+ $set?: any;
24
+ $on?: any;
25
+ };
26
+ z_$$bindings?: Bindings;
27
+ }
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ const { children } = $props();
3
+ </script>
4
+
5
+ <div
6
+ class="rounded-md bg-card-background-light p-1 shadow-sm
7
+ sm:p-4
8
+ dark:bg-card-background-dark">
9
+ {@render children?.()}
10
+ </div>
@@ -0,0 +1,5 @@
1
+ declare const Card: import("svelte").Component<{
2
+ children: any;
3
+ }, {}, "">;
4
+ type Card = ReturnType<typeof Card>;
5
+ export default Card;
@@ -0,0 +1,3 @@
1
+ export { default as Button } from "./button/button.svelte";
2
+ export { default as Input } from "./input/input.svelte";
3
+ export { default as Select } from "./select/select.svelte";
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default as Button } from "./button/button.svelte";
2
+ export { default as Input } from "./input/input.svelte";
3
+ export { default as Select } from "./select/select.svelte";
@@ -0,0 +1,34 @@
1
+ <script lang="ts">
2
+ import InputField from "../input-field/input-field.svelte";
3
+ import InputLabel from "../input-label/input-label.svelte";
4
+ import type { InputProps } from "./input.types.js";
5
+
6
+ const {
7
+ disabled,
8
+ hideLabel,
9
+ id,
10
+ label,
11
+ onChange,
12
+ onKeyDown,
13
+ placeholder,
14
+ type,
15
+ value,
16
+ }: InputProps = $props();
17
+ </script>
18
+
19
+ <div class="flex-1">
20
+ <InputLabel
21
+ {hideLabel}
22
+ {id}
23
+ {label} />
24
+ <div class="mt-1">
25
+ <InputField
26
+ {disabled}
27
+ {id}
28
+ {onChange}
29
+ {onKeyDown}
30
+ {placeholder}
31
+ {type}
32
+ {value} />
33
+ </div>
34
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { InputProps } from "./input.types.ts";
2
+ declare const Input: import("svelte").Component<InputProps, {}, "">;
3
+ type Input = ReturnType<typeof Input>;
4
+ export default Input;
@@ -0,0 +1,3 @@
1
+ import type { InputFieldProps } from "./../input-field/input-field.types.ts";
2
+ import type { InputLabelProps } from "./../input-label/input-label.types.ts";
3
+ export type InputProps = InputFieldProps & InputLabelProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import type { InputFieldProps } from "./input-field.types.js";
3
+
4
+ const {
5
+ disabled = false,
6
+ id,
7
+ onChange,
8
+ onKeyDown,
9
+ placeholder = "",
10
+ type = "text",
11
+ value,
12
+ withIconLeft = false,
13
+ }: InputFieldProps = $props();
14
+ </script>
15
+
16
+ <input
17
+ data-testid={id}
18
+ {id}
19
+ {disabled}
20
+ oninput={(e) => onChange?.((e.target as HTMLInputElement).value)}
21
+ onkeydown={(e) => onKeyDown?.((e.target as HTMLInputElement).value)}
22
+ {placeholder}
23
+ {type}
24
+ {value}
25
+ class={[
26
+ "form-input block w-full appearance-none border border-ink-gray bg-white p-2 px-3 text-ink-black ring-inset focus:border-primary-300 focus:ring-1 focus:ring-primary-300 focus:ring-inset dark:bg-slate dark:text-app-text-dark",
27
+ withIconLeft === true ? "rounded-l-md" : "rounded-md",
28
+ ]} />
@@ -0,0 +1,4 @@
1
+ import type { InputFieldProps } from "./input-field.types.ts";
2
+ declare const InputField: import("svelte").Component<InputFieldProps, {}, "">;
3
+ type InputField = ReturnType<typeof InputField>;
4
+ export default InputField;
@@ -0,0 +1,10 @@
1
+ export interface InputFieldProps {
2
+ disabled?: boolean;
3
+ id: string;
4
+ onChange?: (value: number | string) => void;
5
+ onKeyDown?: (value: number | string) => void;
6
+ placeholder?: string;
7
+ type: "number" | "search" | "text";
8
+ value: number | string;
9
+ withIconLeft?: boolean;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ <script lang="ts">
2
+ import type { InputLabelProps } from "./input-label.types.js";
3
+
4
+ const {
5
+ hideLabel = false,
6
+ id,
7
+ label,
8
+ value = "",
9
+ }: InputLabelProps = $props();
10
+ </script>
11
+
12
+ <div class="flex">
13
+ <label
14
+ class={["font-heading mr-auto font-bold", hideLabel && "sr-only"]}
15
+ for={id}>
16
+ {label}
17
+ {#if value !== ""}
18
+ <span class="sr-only">{value}</span>
19
+ {/if}
20
+ </label>
21
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { InputLabelProps } from "./input-label.types.ts";
2
+ declare const InputLabel: import("svelte").Component<InputLabelProps, {}, "">;
3
+ type InputLabel = ReturnType<typeof InputLabel>;
4
+ export default InputLabel;
@@ -0,0 +1,6 @@
1
+ export interface InputLabelProps {
2
+ hideLabel?: boolean;
3
+ id: string;
4
+ label: string;
5
+ value?: string;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import InputLabel from "../input-label/input-label.svelte";
3
+ import SelectField from "../select-field/select-field.svelte";
4
+ import type { SelectProps } from "./select.types.js";
5
+
6
+ const { hideLabel, id, label, onChange, options, value }: SelectProps =
7
+ $props();
8
+ </script>
9
+
10
+ <div class="flex-1">
11
+ <InputLabel
12
+ {hideLabel}
13
+ {id}
14
+ {label} />
15
+ <div class="mt-1">
16
+ <SelectField
17
+ {id}
18
+ {onChange}
19
+ {options}
20
+ {value} />
21
+ </div>
22
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { SelectProps } from "./select.types.ts";
2
+ declare const Select: import("svelte").Component<SelectProps, {}, "">;
3
+ type Select = ReturnType<typeof Select>;
4
+ export default Select;
@@ -0,0 +1,3 @@
1
+ import type { InputLabelProps } from "./../input-label/input-label.types.ts";
2
+ import type { SelectFieldProps } from "./../select-field/select-field.types.ts";
3
+ export type SelectProps = InputLabelProps & SelectFieldProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import type { SelectFieldProps } from "./select-field.types.js";
3
+
4
+ const {
5
+ id,
6
+ inInputField = false,
7
+ onChange,
8
+ options,
9
+ value,
10
+ }: SelectFieldProps = $props();
11
+ </script>
12
+
13
+ <select
14
+ class={[
15
+ "w-full form-select appearance-none rounded-md border border-ink-gray py-2 pr-8 pl-2 text-ink-black focus:ring-1 focus:ring-primary-300 focus:ring-inset dark:bg-slate dark:text-ink-white",
16
+ inInputField && "h-full rounded-l-none bg-transparent",
17
+ !inInputField && "block pl-3",
18
+ ]}
19
+ data-testid={id}
20
+ {id}
21
+ name={id}
22
+ oninput={(e) => onChange((e.target as HTMLSelectElement).value as string)}
23
+ {value}>
24
+ {#each options as option (option.value)}
25
+ <option value={option.value}>
26
+ {option.label}
27
+ </option>
28
+ {/each}
29
+ </select>
@@ -0,0 +1,4 @@
1
+ import type { SelectFieldProps } from "./select-field.types.ts";
2
+ declare const SelectField: import("svelte").Component<SelectFieldProps, {}, "">;
3
+ type SelectField = ReturnType<typeof SelectField>;
4
+ export default SelectField;
@@ -0,0 +1,10 @@
1
+ export interface SelectFieldProps {
2
+ id: string;
3
+ inInputField?: boolean;
4
+ onChange: (value: string) => void;
5
+ options: {
6
+ label: string;
7
+ value: string;
8
+ }[];
9
+ value: string;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@julianelda/domos",
3
+ "version": "0.0.1",
4
+ "scripts": {
5
+ "dev": "vite dev",
6
+ "build": "vite build && npm run prepack",
7
+ "preview": "vite preview",
8
+ "prepare": "svelte-kit sync || echo ''",
9
+ "prepack": "svelte-kit sync && svelte-package && publint",
10
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
12
+ "lint": "prettier --check . && eslint .",
13
+ "format": "prettier --write .",
14
+ "test": "vitest --project=client",
15
+ "test:e2e": "playwright test",
16
+ "storybook": "storybook dev -p 6006",
17
+ "build-storybook": "storybook build"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "!dist/**/*.test.*",
22
+ "!dist/**/*.spec.*"
23
+ ],
24
+ "main": "./dist/index.js",
25
+ "module": "./dist/index.js",
26
+ "sideEffects": [
27
+ "**/*.css"
28
+ ],
29
+ "svelte": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "type": "module",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "svelte": "./dist/index.js"
36
+ }
37
+ },
38
+ "peerDependencies": {
39
+ "svelte": "^5.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@eslint/compat": "^2.0.2",
43
+ "@eslint/js": "^9.39.2",
44
+ "@playwright/test": "^1.58.1",
45
+ "@prettier/plugin-oxc": "^0.1.3",
46
+ "@storybook/addon-a11y": "^10.2.7",
47
+ "@storybook/addon-svelte-csf": "^5.0.10",
48
+ "@storybook/addon-themes": "^10.2.7",
49
+ "@storybook/sveltekit": "^10.2.7",
50
+ "@sveltejs/adapter-auto": "^7.0.0",
51
+ "@sveltejs/kit": "^2.50.2",
52
+ "@sveltejs/package": "^2.5.7",
53
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
54
+ "@tailwindcss/forms": "^0.5.11",
55
+ "@tailwindcss/typography": "^0.5.19",
56
+ "@tailwindcss/vite": "^4.1.18",
57
+ "@types/node": "^24",
58
+ "@vitest/browser-playwright": "^4.0.18",
59
+ "eslint": "^9.39.2",
60
+ "eslint-config-prettier": "^10.1.8",
61
+ "eslint-plugin-storybook": "^10.2.7",
62
+ "eslint-plugin-svelte": "^3.14.0",
63
+ "globals": "^17.3.0",
64
+ "playwright": "^1.58.1",
65
+ "prettier": "^3.8.1",
66
+ "prettier-plugin-svelte": "^3.4.1",
67
+ "prettier-plugin-tailwindcss": "^0.7.2",
68
+ "publint": "^0.3.17",
69
+ "storybook": "^10.2.7",
70
+ "svelte": "^5.49.2",
71
+ "svelte-check": "^4.3.6",
72
+ "tailwindcss": "^4.1.18",
73
+ "typescript": "^5.9.3",
74
+ "typescript-eslint": "^8.54.0",
75
+ "vite": "^7.3.1",
76
+ "vitest": "^4.0.18",
77
+ "vitest-browser-svelte": "^2.0.2"
78
+ },
79
+ "keywords": [
80
+ "svelte"
81
+ ],
82
+ "dependencies": {
83
+ "@julianelda/chroma": "^1.0.0",
84
+ "@julianelda/stilo": "^1.0.2",
85
+ "clsx": "^2.1.1"
86
+ }
87
+ }