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.
- package/README.md +213 -0
- package/dist/astro/index.d.ts +68 -0
- package/dist/astro/index.d.ts.map +1 -0
- package/dist/astro/index.js +14 -0
- package/dist/astro/index.js.map +1 -0
- package/dist/candid/ic_siwa_provider.d.ts +121 -0
- package/dist/candid/ic_siwa_provider.d.ts.map +1 -0
- package/dist/candid/ic_siwa_provider.js +64 -0
- package/dist/candid/ic_siwa_provider.js.map +1 -0
- package/dist/candid/index.d.ts +6 -0
- package/dist/candid/index.d.ts.map +1 -0
- package/dist/candid/index.js +6 -0
- package/dist/candid/index.js.map +1 -0
- package/dist/client.d.ts +124 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +391 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +47 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +63 -0
- package/dist/errors.js.map +1 -0
- package/dist/identity.d.ts +44 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +42 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/storage.d.ts +36 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +50 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +79 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
- package/src/astro/LoginButton.astro +364 -0
- package/src/astro/index.ts +67 -0
|
@@ -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
|
+
};
|