@lovince/ui-svelte 1.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.
@@ -0,0 +1,65 @@
1
+ import { MyButtonProps, MyInputProps } from '@lovince/ui-shared';
2
+ export { MyButtonProps, MyInputProps } from '@lovince/ui-shared';
3
+
4
+ interface SvelteMyButtonProps extends MyButtonProps {
5
+ onButtonClick?: (detail: {
6
+ variant: string;
7
+ }) => void;
8
+ onClick?: (event: MouseEvent) => void;
9
+ }
10
+ interface SvelteMyInputProps extends MyInputProps {
11
+ onInputChange?: (detail: {
12
+ value: string;
13
+ }) => void;
14
+ onInput?: (event: InputEvent) => void;
15
+ onChange?: (event: Event) => void;
16
+ onFocus?: (event: FocusEvent) => void;
17
+ onBlur?: (event: FocusEvent) => void;
18
+ }
19
+ declare function createSvelteEventHandler<T extends Event>(dispatch: (event: string, detail?: any) => void, eventName: string): (event: T) => void;
20
+
21
+ declare const COMPONENT_METADATA: {
22
+ readonly MyButton: {
23
+ readonly props: {
24
+ readonly variant: {
25
+ readonly type: "string";
26
+ readonly default: "primary";
27
+ readonly options: readonly ["primary", "secondary", "danger", "success", "outline"];
28
+ };
29
+ readonly disabled: {
30
+ readonly type: "boolean";
31
+ readonly default: false;
32
+ };
33
+ readonly size: {
34
+ readonly type: "string";
35
+ readonly default: "md";
36
+ readonly options: readonly ["sm", "md", "lg"];
37
+ };
38
+ };
39
+ readonly events: readonly ["button-click", "click"];
40
+ };
41
+ readonly MyInput: {
42
+ readonly props: {
43
+ readonly value: {
44
+ readonly type: "string";
45
+ readonly default: "";
46
+ };
47
+ readonly placeholder: {
48
+ readonly type: "string";
49
+ readonly default: "";
50
+ };
51
+ readonly disabled: {
52
+ readonly type: "boolean";
53
+ readonly default: false;
54
+ };
55
+ readonly type: {
56
+ readonly type: "string";
57
+ readonly default: "text";
58
+ readonly options: readonly ["text", "email", "password"];
59
+ };
60
+ };
61
+ readonly events: readonly ["input-change", "input", "change", "focus", "blur"];
62
+ };
63
+ };
64
+
65
+ export { COMPONENT_METADATA, type SvelteMyButtonProps, type SvelteMyInputProps, createSvelteEventHandler };
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ // src/index.ts
2
+ function createSvelteEventHandler(dispatch, eventName) {
3
+ return (event) => {
4
+ dispatch(eventName, event);
5
+ };
6
+ }
7
+ var COMPONENT_METADATA = {
8
+ MyButton: {
9
+ props: {
10
+ variant: { type: "string", default: "primary", options: ["primary", "secondary", "danger", "success", "outline"] },
11
+ disabled: { type: "boolean", default: false },
12
+ size: { type: "string", default: "md", options: ["sm", "md", "lg"] }
13
+ },
14
+ events: ["button-click", "click"]
15
+ },
16
+ MyInput: {
17
+ props: {
18
+ value: { type: "string", default: "" },
19
+ placeholder: { type: "string", default: "" },
20
+ disabled: { type: "boolean", default: false },
21
+ type: { type: "string", default: "text", options: ["text", "email", "password"] }
22
+ },
23
+ events: ["input-change", "input", "change", "focus", "blur"]
24
+ }
25
+ };
26
+ export {
27
+ COMPONENT_METADATA,
28
+ createSvelteEventHandler
29
+ };
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@lovince/ui-svelte",
3
+ "version": "1.0.1",
4
+ "description": "Svelte wrappers for UI components",
5
+ "type": "module",
6
+ "svelte": "./dist/index.js",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup"
21
+ },
22
+ "keywords": [
23
+ "ui",
24
+ "svelte",
25
+ "web-components"
26
+ ],
27
+ "author": "Steve",
28
+ "license": "MIT",
29
+ "peerDependencies": {
30
+ "@lovince/ui-core": "^1.0.0",
31
+ "svelte": "^3.0.0 || ^4.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "tsup": "^8.5.1",
35
+ "typescript": "^5.9.3"
36
+ }
37
+ }