ic-siwa 0.1.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.
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Astro components for IC-SIWA
3
+ *
4
+ * Usage:
5
+ * ```astro
6
+ * ---
7
+ * import { LoginButton } from 'ic-siwa/astro';
8
+ * ---
9
+ *
10
+ * <LoginButton canisterId="xxxxx-xxxxx-xxxxx-xxxxx-xxx" />
11
+ * ```
12
+ */
13
+
14
+ // Note: Astro components are exported via package.json exports map
15
+ // This file provides documentation and type information
16
+
17
+ export interface LoginButtonProps {
18
+ /** Canister ID of the ic_siwa_provider */
19
+ canisterId: string;
20
+ /** IC host URL (default: https://ic0.app) */
21
+ host?: string;
22
+ /** Button label text */
23
+ label?: string;
24
+ /** Button size: xs, sm, md, lg, xl */
25
+ size?: "xs" | "sm" | "md" | "lg" | "xl";
26
+ /** Button color variant */
27
+ variant?: "primary" | "secondary" | "accent" | "neutral";
28
+ /** Button style */
29
+ style?: "solid" | "outline" | "soft" | "ghost";
30
+ /** Additional CSS classes */
31
+ class?: string;
32
+ /** Show wallet address when logged in */
33
+ showAddress?: boolean;
34
+ /** Custom ID for the button element */
35
+ id?: string;
36
+ }
37
+
38
+ /**
39
+ * Custom events emitted by LoginButton:
40
+ *
41
+ * - `siwa:login-start` - Emitted when login process begins
42
+ * - `siwa:login-success` - Emitted on successful login
43
+ * - detail: { principal: string, address: string }
44
+ * - `siwa:login-error` - Emitted on login failure
45
+ * - detail: { error: string }
46
+ * - `siwa:logout` - Emitted when user logs out
47
+ *
48
+ * @example
49
+ * ```html
50
+ * <div id="login-container">
51
+ * <LoginButton canisterId="..." />
52
+ * </div>
53
+ *
54
+ * <script>
55
+ * document.getElementById('login-container')
56
+ * .addEventListener('siwa:login-success', (e) => {
57
+ * console.log('Logged in:', e.detail.principal);
58
+ * });
59
+ * </script>
60
+ * ```
61
+ */
62
+ export type LoginButtonEvents = {
63
+ "siwa:login-start": CustomEvent<void>;
64
+ "siwa:login-success": CustomEvent<{principal: string; address: string}>;
65
+ "siwa:login-error": CustomEvent<{error: string}>;
66
+ "siwa:logout": CustomEvent<void>;
67
+ };