@getauthui/core 0.1.8 → 0.1.9
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 +3 -3
- package/dist/{authui-user-button-BTKKRjIx.js → authui-user-button-lt0fIem4.js} +54 -37
- package/dist/authui.cdn.js +6 -6
- package/dist/authui.cdn.mjs +128 -112
- package/dist/authui.js +2 -2
- package/dist/components/authui-modal.d.ts +5 -1
- package/dist/components/authui-modal.d.ts.map +1 -1
- package/dist/components/authui-show.d.ts +8 -0
- package/dist/components/authui-show.d.ts.map +1 -1
- package/dist/react/index.d.ts +12 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react.js +56 -47
- package/package.json +1 -1
package/dist/authui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as t, c as r, o } from "./authui-user-button-
|
|
2
|
-
import { A as U, b as C, d as v, e as w, f as E, g as O, h as M, i as P, j as b, C as L, E as x, F as T, P as F, k as _, l as y, m as B, n as j, p as k, q, r as R, s as z, t as D, u as G, v as H, w as J, x as K, y as N } from "./authui-user-button-
|
|
1
|
+
import { a as t, c as r, o } from "./authui-user-button-lt0fIem4.js";
|
|
2
|
+
import { A as U, b as C, d as v, e as w, f as E, g as O, h as M, i as P, j as b, C as L, E as x, F as T, P as F, k as _, l as y, m as B, n as j, p as k, q, r as R, s as z, t as D, u as G, v as H, w as J, x as K, y as N } from "./authui-user-button-lt0fIem4.js";
|
|
3
3
|
import * as l from "appwrite";
|
|
4
4
|
function s(e) {
|
|
5
5
|
return t.configure(e), I;
|
|
@@ -14,7 +14,11 @@ export declare class AuthUIModal extends AuthUIElement {
|
|
|
14
14
|
open: boolean;
|
|
15
15
|
/** Which screen to show. */
|
|
16
16
|
view: AuthUIView;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Close automatically after a successful sign in. Default: true.
|
|
19
|
+
* Accepts the string `"false"` / `"0"` / `"off"` / `"no"` so HTML can turn it
|
|
20
|
+
* off (Lit's Boolean converter treats any present attribute as true).
|
|
21
|
+
*/
|
|
18
22
|
closeOnSuccess: boolean;
|
|
19
23
|
private handledPending;
|
|
20
24
|
private scrollCue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authui-modal.d.ts","sourceRoot":"","sources":["../../src/components/authui-modal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;GAIG;AACH,qBACa,WAAY,SAAQ,aAAa;IAC5C,MAAM,CAAC,MAAM,4BAyFX;IAEF,4DAA4D;IAChB,IAAI,UAAS;IACzD,4BAA4B;IACA,IAAI,EAAE,UAAU,CAAa;IACzD
|
|
1
|
+
{"version":3,"file":"authui-modal.d.ts","sourceRoot":"","sources":["../../src/components/authui-modal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;GAIG;AACH,qBACa,WAAY,SAAQ,aAAa;IAC5C,MAAM,CAAC,MAAM,4BAyFX;IAEF,4DAA4D;IAChB,IAAI,UAAS;IACzD,4BAA4B;IACA,IAAI,EAAE,UAAU,CAAa;IACzD;;;;OAIG;IAeH,cAAc,UAAQ;IAEb,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,SAAS,CAAS;IAClB,OAAO,CAAC,MAAM,CAAC,CAAoB;IACpC,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7C,OAAO,CAAC,kBAAkB,CAA+B;IAEzD,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAQ5B,OAAO,CAAC,WAAW,CAGjB;IAEF,OAAO,CAAC,YAAY,CAAqB;IAEzC,IAAI,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAQ7B,IAAI,IAAI,IAAI;IAIZ,OAAO,CAAC,aAAa,CAUnB;IAEF,OAAO,CAAC,WAAW;IAenB,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAuCtD,OAAO,CAAC,SAAS,CAGf;IAEF,OAAO,CAAC,WAAW,CAGjB;IAEF,OAAO,CAAC,UAAU,CAEhB;IAEF,OAAO,CAAC,YAAY;IAcpB,SAAS,CAAC,MAAM;CA2CjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LitElement, nothing } from 'lit';
|
|
2
|
+
import { AuthUIStatus } from '../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* In-module FOUC guard. Prefer constructable stylesheets so strict CSP
|
|
4
5
|
* `style-src 'self'` does not block the rule. Fall back to a <style> tag
|
|
@@ -9,6 +10,13 @@ import { LitElement, nothing } from 'lit';
|
|
|
9
10
|
export declare const FOUC_CSS = "authui-show:not([ready]){display:none}";
|
|
10
11
|
/** Extra critical CSS for the page <head>, covering undefined custom elements. */
|
|
11
12
|
export declare const CRITICAL_FOUC_CSS: string;
|
|
13
|
+
/** Parse a comma or space separated status list, ignoring unknown values. */
|
|
14
|
+
export declare function parseAuthStatusList(value: string | null | undefined): AuthUIStatus[];
|
|
15
|
+
/**
|
|
16
|
+
* Whether `status` satisfies `when` / `unless` the same way `<authui-show>` does.
|
|
17
|
+
* Used by the React `Show` wrapper so children are not mounted while hidden.
|
|
18
|
+
*/
|
|
19
|
+
export declare function matchesAuthStatus(status: AuthUIStatus, when?: string | null, unless?: string | null): boolean;
|
|
12
20
|
/**
|
|
13
21
|
* Renders its children only while the auth status matches.
|
|
14
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authui-show.d.ts","sourceRoot":"","sources":["../../src/components/authui-show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,OAAO,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"authui-show.d.ts","sourceRoot":"","sources":["../../src/components/authui-show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,OAAO,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,2CAA2C,CAAC;AAEjE,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,QAEqD,CAAC;AA+BpF,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,CAMpF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,EACpB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAOT;AAED;;;;;;;;;;;GAWG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,qDAAqD;IACzB,IAAI,SAAM;IACtC,qDAAqD;IACzB,MAAM,SAAM;IAE/B,OAAO,CAAC,MAAM,CAA6C;IACpE,OAAO,CAAC,WAAW,CAA6B;IAEhD,iBAAiB,IAAI,IAAI;IAMzB,oBAAoB,IAAI,IAAI;IAM5B,gEAAgE;IAChE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,SAAS,CAAC,OAAO,IAAI,IAAI;IAOzB,SAAS,CAAC,MAAM;CAGjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -14,7 +14,14 @@ export declare function useAuthUI(): {
|
|
|
14
14
|
configured: boolean;
|
|
15
15
|
configError: string | null;
|
|
16
16
|
};
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Configures Auth UI and renders children. Put it near the root of your app.
|
|
19
|
+
*
|
|
20
|
+
* Configuration runs during render (not in an effect) so the first paint already
|
|
21
|
+
* sees `configured: true` and a non-null `getClient()` when `endpoint` and
|
|
22
|
+
* `project` are present. Changing any config field reconfigures the store.
|
|
23
|
+
* `configure()` is idempotent, so React Strict Mode double-invoke is safe.
|
|
24
|
+
*/
|
|
18
25
|
export declare function AuthUIProvider({ config, children, }: {
|
|
19
26
|
config: AuthUIConfig;
|
|
20
27
|
children?: ReactNode;
|
|
@@ -45,10 +52,13 @@ export declare function AuthUIUserButton(props: {
|
|
|
45
52
|
* Renders children only while the auth status matches.
|
|
46
53
|
* `when` and `unless` accept a status or a comma separated list:
|
|
47
54
|
* `signed-in`, `signed-out`, `mfa-required`, `loading`.
|
|
55
|
+
*
|
|
56
|
+
* Unlike the Lit `<authui-show>` element (which only skips its slot), this
|
|
57
|
+
* React wrapper returns `null` so children are not mounted while hidden.
|
|
48
58
|
*/
|
|
49
59
|
export declare function Show(props: {
|
|
50
60
|
when?: string;
|
|
51
61
|
unless?: string;
|
|
52
62
|
children?: ReactNode;
|
|
53
|
-
}): ReactElement;
|
|
63
|
+
}): ReactElement | null;
|
|
54
64
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.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AS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,GAAG,YAAY,CAEf;AAgBD,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,GAAG,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAAC;CACxE,GAAG,YAAY,CAEf;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,YAAY,CAE5F;AAED;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,YAAY,GAAG,IAAI,CAItB"}
|
package/dist/react.js
CHANGED
|
@@ -1,64 +1,73 @@
|
|
|
1
|
-
import { createElement as
|
|
2
|
-
import { a as
|
|
3
|
-
function
|
|
4
|
-
const [
|
|
5
|
-
return
|
|
6
|
-
...
|
|
1
|
+
import { createElement as t, useState as i, useEffect as r, useRef as a, Fragment as o } from "react";
|
|
2
|
+
import { a as s, z as l, c as f, o as h } from "./authui-user-button-lt0fIem4.js";
|
|
3
|
+
function S() {
|
|
4
|
+
const [e, n] = i(() => s.getState());
|
|
5
|
+
return r(() => s.on("change", n), []), {
|
|
6
|
+
...e,
|
|
7
7
|
open: h,
|
|
8
|
-
close:
|
|
9
|
-
signOut: () =>
|
|
10
|
-
store:
|
|
8
|
+
close: f,
|
|
9
|
+
signOut: () => s.signOut(),
|
|
10
|
+
store: s
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function d(e) {
|
|
14
|
+
return JSON.stringify(e);
|
|
15
|
+
}
|
|
16
|
+
function A({
|
|
17
|
+
config: e,
|
|
18
|
+
children: n
|
|
16
19
|
}) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, [t.endpoint, t.project]), n(r, null, e);
|
|
20
|
+
const u = d(e), c = a(null);
|
|
21
|
+
return c.current !== u && (c.current = u, s.configure(e)), t(o, null, n);
|
|
20
22
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
function I(e) {
|
|
24
|
+
const [n, u] = i(null);
|
|
25
|
+
return r(() => {
|
|
26
|
+
!n || e.closeOnSuccess === void 0 || (n.closeOnSuccess = e.closeOnSuccess);
|
|
27
|
+
}, [n, e.closeOnSuccess]), t("authui-modal", {
|
|
28
|
+
ref: u,
|
|
29
|
+
view: e.view,
|
|
30
|
+
open: e.open || void 0,
|
|
31
|
+
// Lit boolean attrs treat presence as true; write the string "false" so HTML
|
|
32
|
+
// and React can turn the default off. Also set the JS property above.
|
|
33
|
+
"close-on-success": e.closeOnSuccess === !1 ? "false" : e.closeOnSuccess === !0 ? "" : void 0
|
|
26
34
|
});
|
|
27
35
|
}
|
|
28
|
-
function
|
|
29
|
-
return
|
|
36
|
+
function O(e) {
|
|
37
|
+
return t(
|
|
30
38
|
"authui-button",
|
|
31
|
-
{ view:
|
|
32
|
-
|
|
39
|
+
{ view: e.view, variant: e.variant, size: e.size },
|
|
40
|
+
e.children
|
|
33
41
|
);
|
|
34
42
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
43
|
+
function w(e) {
|
|
44
|
+
return t(v, e);
|
|
37
45
|
}
|
|
38
|
-
function
|
|
39
|
-
const [
|
|
40
|
-
return
|
|
41
|
-
if (!
|
|
42
|
-
const c = () =>
|
|
43
|
-
return
|
|
44
|
-
}, [
|
|
46
|
+
function v(e) {
|
|
47
|
+
const [n, u] = i(null);
|
|
48
|
+
return r(() => {
|
|
49
|
+
if (!n || !e.onSuccess) return;
|
|
50
|
+
const c = () => e.onSuccess?.();
|
|
51
|
+
return n.addEventListener("authui-success", c), () => n.removeEventListener("authui-success", c);
|
|
52
|
+
}, [n, e.onSuccess]), t("authui-sign-in", { ref: u, view: e.view });
|
|
45
53
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
54
|
+
function U(e) {
|
|
55
|
+
return t("authui-account", { tab: e.tab });
|
|
48
56
|
}
|
|
49
|
-
function
|
|
50
|
-
return
|
|
57
|
+
function E(e) {
|
|
58
|
+
return t("authui-user-button", { src: e.src }, e.children);
|
|
51
59
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
60
|
+
function b(e) {
|
|
61
|
+
const { status: n } = S();
|
|
62
|
+
return l(n, e.when, e.unless) ? t(o, null, e.children) : null;
|
|
54
63
|
}
|
|
55
64
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
U as AuthUIAccount,
|
|
66
|
+
O as AuthUIButton,
|
|
67
|
+
I as AuthUIModal,
|
|
68
|
+
A as AuthUIProvider,
|
|
69
|
+
w as AuthUISignIn,
|
|
70
|
+
E as AuthUIUserButton,
|
|
71
|
+
b as Show,
|
|
72
|
+
S as useAuthUI
|
|
64
73
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getauthui/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Drop-in authentication UI for Appwrite. One script tag, every sign-in method, MFA, sessions and account management as web components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/authui.js",
|