@authon/js 0.1.3 → 0.1.4
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/dist/index.js +41 -7
- package/dist/index.mjs +37 -3
- package/package.json +4 -6
package/dist/index.js
CHANGED
|
@@ -25,11 +25,45 @@ __export(index_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
|
-
//
|
|
29
|
-
var
|
|
28
|
+
// ../shared/dist/index.mjs
|
|
29
|
+
var PROVIDER_DISPLAY_NAMES = {
|
|
30
|
+
google: "Google",
|
|
31
|
+
apple: "Apple",
|
|
32
|
+
kakao: "Kakao",
|
|
33
|
+
naver: "Naver",
|
|
34
|
+
facebook: "Facebook",
|
|
35
|
+
github: "GitHub",
|
|
36
|
+
discord: "Discord",
|
|
37
|
+
x: "X",
|
|
38
|
+
line: "LINE",
|
|
39
|
+
microsoft: "Microsoft"
|
|
40
|
+
};
|
|
41
|
+
var PROVIDER_COLORS = {
|
|
42
|
+
google: { bg: "#ffffff", text: "#1f1f1f" },
|
|
43
|
+
apple: { bg: "#000000", text: "#ffffff" },
|
|
44
|
+
kakao: { bg: "#FEE500", text: "#191919" },
|
|
45
|
+
naver: { bg: "#03C75A", text: "#ffffff" },
|
|
46
|
+
facebook: { bg: "#1877F2", text: "#ffffff" },
|
|
47
|
+
github: { bg: "#24292e", text: "#ffffff" },
|
|
48
|
+
discord: { bg: "#5865F2", text: "#ffffff" },
|
|
49
|
+
x: { bg: "#000000", text: "#ffffff" },
|
|
50
|
+
line: { bg: "#06C755", text: "#ffffff" },
|
|
51
|
+
microsoft: { bg: "#ffffff", text: "#1f1f1f" }
|
|
52
|
+
};
|
|
53
|
+
var DEFAULT_BRANDING = {
|
|
54
|
+
primaryColorStart: "#7c3aed",
|
|
55
|
+
primaryColorEnd: "#4f46e5",
|
|
56
|
+
lightBg: "#ffffff",
|
|
57
|
+
lightText: "#111827",
|
|
58
|
+
darkBg: "#0f172a",
|
|
59
|
+
darkText: "#f1f5f9",
|
|
60
|
+
borderRadius: 12,
|
|
61
|
+
showEmailPassword: true,
|
|
62
|
+
showDivider: true,
|
|
63
|
+
locale: "en"
|
|
64
|
+
};
|
|
30
65
|
|
|
31
66
|
// src/providers.ts
|
|
32
|
-
var import_shared = require("@authon/shared");
|
|
33
67
|
var PROVIDER_ICONS = {
|
|
34
68
|
google: `<svg viewBox="0 0 24 24" width="20" height="20"><path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/><path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/><path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/></svg>`,
|
|
35
69
|
apple: `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>`,
|
|
@@ -43,10 +77,10 @@ var PROVIDER_ICONS = {
|
|
|
43
77
|
microsoft: `<svg viewBox="0 0 24 24" width="20" height="20"><rect fill="#F25022" x="1" y="1" width="10" height="10"/><rect fill="#7FBA00" x="13" y="1" width="10" height="10"/><rect fill="#00A4EF" x="1" y="13" width="10" height="10"/><rect fill="#FFB900" x="13" y="13" width="10" height="10"/></svg>`
|
|
44
78
|
};
|
|
45
79
|
function getProviderButtonConfig(provider) {
|
|
46
|
-
const colors =
|
|
80
|
+
const colors = PROVIDER_COLORS[provider];
|
|
47
81
|
return {
|
|
48
82
|
provider,
|
|
49
|
-
label: `Continue with ${
|
|
83
|
+
label: `Continue with ${PROVIDER_DISPLAY_NAMES[provider]}`,
|
|
50
84
|
bgColor: colors.bg,
|
|
51
85
|
textColor: colors.text,
|
|
52
86
|
iconSvg: PROVIDER_ICONS[provider]
|
|
@@ -66,7 +100,7 @@ var ModalRenderer = class {
|
|
|
66
100
|
onClose;
|
|
67
101
|
constructor(options) {
|
|
68
102
|
this.mode = options.mode;
|
|
69
|
-
this.branding = { ...
|
|
103
|
+
this.branding = { ...DEFAULT_BRANDING, ...options.branding };
|
|
70
104
|
this.onProviderClick = options.onProviderClick;
|
|
71
105
|
this.onEmailSubmit = options.onEmailSubmit;
|
|
72
106
|
this.onClose = options.onClose;
|
|
@@ -78,7 +112,7 @@ var ModalRenderer = class {
|
|
|
78
112
|
this.enabledProviders = providers;
|
|
79
113
|
}
|
|
80
114
|
setBranding(branding) {
|
|
81
|
-
this.branding = { ...
|
|
115
|
+
this.branding = { ...DEFAULT_BRANDING, ...branding };
|
|
82
116
|
}
|
|
83
117
|
open(view = "signIn") {
|
|
84
118
|
this.close();
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
1
|
+
// ../shared/dist/index.mjs
|
|
2
|
+
var PROVIDER_DISPLAY_NAMES = {
|
|
3
|
+
google: "Google",
|
|
4
|
+
apple: "Apple",
|
|
5
|
+
kakao: "Kakao",
|
|
6
|
+
naver: "Naver",
|
|
7
|
+
facebook: "Facebook",
|
|
8
|
+
github: "GitHub",
|
|
9
|
+
discord: "Discord",
|
|
10
|
+
x: "X",
|
|
11
|
+
line: "LINE",
|
|
12
|
+
microsoft: "Microsoft"
|
|
13
|
+
};
|
|
14
|
+
var PROVIDER_COLORS = {
|
|
15
|
+
google: { bg: "#ffffff", text: "#1f1f1f" },
|
|
16
|
+
apple: { bg: "#000000", text: "#ffffff" },
|
|
17
|
+
kakao: { bg: "#FEE500", text: "#191919" },
|
|
18
|
+
naver: { bg: "#03C75A", text: "#ffffff" },
|
|
19
|
+
facebook: { bg: "#1877F2", text: "#ffffff" },
|
|
20
|
+
github: { bg: "#24292e", text: "#ffffff" },
|
|
21
|
+
discord: { bg: "#5865F2", text: "#ffffff" },
|
|
22
|
+
x: { bg: "#000000", text: "#ffffff" },
|
|
23
|
+
line: { bg: "#06C755", text: "#ffffff" },
|
|
24
|
+
microsoft: { bg: "#ffffff", text: "#1f1f1f" }
|
|
25
|
+
};
|
|
26
|
+
var DEFAULT_BRANDING = {
|
|
27
|
+
primaryColorStart: "#7c3aed",
|
|
28
|
+
primaryColorEnd: "#4f46e5",
|
|
29
|
+
lightBg: "#ffffff",
|
|
30
|
+
lightText: "#111827",
|
|
31
|
+
darkBg: "#0f172a",
|
|
32
|
+
darkText: "#f1f5f9",
|
|
33
|
+
borderRadius: 12,
|
|
34
|
+
showEmailPassword: true,
|
|
35
|
+
showDivider: true,
|
|
36
|
+
locale: "en"
|
|
37
|
+
};
|
|
3
38
|
|
|
4
39
|
// src/providers.ts
|
|
5
|
-
import { PROVIDER_COLORS, PROVIDER_DISPLAY_NAMES } from "@authon/shared";
|
|
6
40
|
var PROVIDER_ICONS = {
|
|
7
41
|
google: `<svg viewBox="0 0 24 24" width="20" height="20"><path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/><path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/><path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/></svg>`,
|
|
8
42
|
apple: `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/></svg>`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authon/js",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Authon core SDK — ShadowDOM login modal for any app",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "tsup
|
|
17
|
-
"dev": "tsup
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@authon/shared": "workspace:*"
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"dev": "tsup --watch"
|
|
21
18
|
},
|
|
22
19
|
"devDependencies": {
|
|
20
|
+
"@authon/shared": "workspace:*",
|
|
23
21
|
"tsup": "^8.4.0",
|
|
24
22
|
"typescript": "^5.7.0"
|
|
25
23
|
},
|