@singlebase/elements 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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/authui.cjs +2 -0
- package/dist/authui.cjs.map +1 -0
- package/dist/authui.d.ts +22 -0
- package/dist/authui.js +24 -0
- package/dist/authui.js.map +1 -0
- package/dist/controllers/auth-controller.d.ts +17 -0
- package/dist/controllers/event-bridge.d.ts +27 -0
- package/dist/controllers/settings-controller.d.ts +18 -0
- package/dist/display-8HEcKYR4.js +3444 -0
- package/dist/display-8HEcKYR4.js.map +1 -0
- package/dist/display-CLDNNZQy.cjs +976 -0
- package/dist/display-CLDNNZQy.cjs.map +1 -0
- package/dist/elements/account-screen.d.ts +99 -0
- package/dist/elements/auth-screen.d.ts +215 -0
- package/dist/elements/base.d.ts +69 -0
- package/dist/elements/buttons.d.ts +45 -0
- package/dist/elements/display.d.ts +51 -0
- package/dist/elements/form-base.d.ts +23 -0
- package/dist/elements/guard.d.ts +65 -0
- package/dist/elements/uploader.d.ts +225 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +147 -0
- package/dist/singlebase-elements.min.js +7616 -0
- package/dist/singlebase-elements.min.js.map +1 -0
- package/dist/standalone.d.ts +2 -0
- package/dist/styles/shared.d.ts +8 -0
- package/dist/styles/tokens.d.ts +44 -0
- package/dist/upload-messages.d.ts +45 -0
- package/dist/uploader-D-Da1trc.js +2290 -0
- package/dist/uploader-D-Da1trc.js.map +1 -0
- package/dist/uploader-eFYKpk8b.cjs +1390 -0
- package/dist/uploader-eFYKpk8b.cjs.map +1 -0
- package/dist/uploader.cjs +2 -0
- package/dist/uploader.cjs.map +1 -0
- package/dist/uploader.d.ts +10 -0
- package/dist/uploader.js +9 -0
- package/dist/uploader.js.map +1 -0
- package/dist/utils/files.d.ts +38 -0
- package/dist/utils/inspect.d.ts +23 -0
- package/dist/utils/profile.d.ts +9 -0
- package/dist/utils/redirect.d.ts +15 -0
- package/package.json +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Singlebase
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @singlebase/elements
|
|
2
|
+
|
|
3
|
+
Singlebase web components, framework-free:
|
|
4
|
+
|
|
5
|
+
- `<singlebase-authui>` and friends — sign-in, sign-up, codes, OAuth and the account view
|
|
6
|
+
- `<singlebase-uploader>` — pick, check and upload files straight to storage
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @singlebase/elements @singlebase/singlebase-sdk
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@singlebase/elements"; // everything
|
|
14
|
+
import "@singlebase/elements/authui"; // auth elements only
|
|
15
|
+
import "@singlebase/elements/uploader"; // uploader only
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or with no build step:
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script type="module"
|
|
22
|
+
src="https://cdn.jsdelivr.net/npm/@singlebase/elements/dist/singlebase-elements.min.js"
|
|
23
|
+
data-singlebase-url-access-key="YOUR_PROJECT_KEY"
|
|
24
|
+
data-singlebase-api-key="wk_YOUR_WEB_KEY"></script>
|
|
25
|
+
|
|
26
|
+
<singlebase-authui></singlebase-authui>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Documentation: https://github.com/singlebase/singlebase-js
|
package/dist/authui.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./display-CLDNNZQy.cjs"),r=require("./uploader-eFYKpk8b.cjs"),t=require("@singlebase/core");exports.AuthController=e.AuthController;exports.SettingsController=e.SettingsController;Object.defineProperty(exports,"SinglebaseAccountScreen",{enumerable:!0,get:()=>e.SinglebaseAccountScreen});Object.defineProperty(exports,"SinglebaseAuthButtons",{enumerable:!0,get:()=>e.SinglebaseAuthButtons});Object.defineProperty(exports,"SinglebaseAuthDisplay",{enumerable:!0,get:()=>e.SinglebaseAuthDisplay});Object.defineProperty(exports,"SinglebaseAuthGuard",{enumerable:!0,get:()=>e.SinglebaseAuthGuard});Object.defineProperty(exports,"SinglebaseAuthScreen",{enumerable:!0,get:()=>e.SinglebaseAuthScreen});exports.defaultMessages=e.defaultMessages;exports.fullNameOf=e.fullNameOf;exports.initialsOf=e.initialsOf;exports.isGuestScreen=e.isGuestScreen;exports.isProtectedScreen=e.isProtectedScreen;exports.isScreen=e.isScreen;exports.resolveMessages=e.resolveMessages;exports.resolveRedirectTarget=r.resolveRedirectTarget;Object.defineProperty(exports,"OPERATORS",{enumerable:!0,get:()=>t.OPERATORS});Object.defineProperty(exports,"matchesPredicate",{enumerable:!0,get:()=>t.matchesPredicate});Object.defineProperty(exports,"validatePredicate",{enumerable:!0,get:()=>t.validatePredicate});
|
|
2
|
+
//# sourceMappingURL=authui.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authui.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/authui.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@singlebase/elements/authui` — the authentication elements on their own:
|
|
3
|
+
* <singlebase-authui>, <singlebase-authui-guard>, <singlebase-authui-buttons>
|
|
4
|
+
* and <singlebase-authui-display>. Importing it registers them.
|
|
5
|
+
*/
|
|
6
|
+
export { SinglebaseAuthScreen } from "./elements/auth-screen.js";
|
|
7
|
+
export type { Screen, GuestScreen, ProtectedScreen } from "./elements/auth-screen.js";
|
|
8
|
+
export { isScreen, isGuestScreen, isProtectedScreen } from "./elements/auth-screen.js";
|
|
9
|
+
export { SinglebaseAuthGuard } from "./elements/guard.js";
|
|
10
|
+
export type { GuardState } from "./elements/guard.js";
|
|
11
|
+
export { SinglebaseAuthButtons } from "./elements/buttons.js";
|
|
12
|
+
export type { ButtonsType } from "./elements/buttons.js";
|
|
13
|
+
export { SinglebaseAuthDisplay } from "./elements/display.js";
|
|
14
|
+
export { SinglebaseAccountScreen } from "./elements/account-screen.js";
|
|
15
|
+
export { AuthController } from "./controllers/auth-controller.js";
|
|
16
|
+
export { SettingsController } from "./controllers/settings-controller.js";
|
|
17
|
+
export { defaultMessages, resolveMessages } from "./messages.js";
|
|
18
|
+
export type { SinglebaseAuthMessages } from "./messages.js";
|
|
19
|
+
export { fullNameOf, initialsOf } from "./utils/profile.js";
|
|
20
|
+
export { resolveRedirectTarget } from "./utils/redirect.js";
|
|
21
|
+
export { matchesPredicate, validatePredicate, OPERATORS } from "@singlebase/core";
|
|
22
|
+
export type { Predicate, Operator } from "@singlebase/core";
|
package/dist/authui.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { A as a, S as t, a as r, b as i, c as l, d as n, e as o, f as c, g as S, i as u, h as g, j as d, k as f, r as A } from "./display-8HEcKYR4.js";
|
|
2
|
+
import { r as b } from "./uploader-D-Da1trc.js";
|
|
3
|
+
import { OPERATORS as p, matchesPredicate as O, validatePredicate as P } from "@singlebase/core";
|
|
4
|
+
export {
|
|
5
|
+
a as AuthController,
|
|
6
|
+
p as OPERATORS,
|
|
7
|
+
t as SettingsController,
|
|
8
|
+
r as SinglebaseAccountScreen,
|
|
9
|
+
i as SinglebaseAuthButtons,
|
|
10
|
+
l as SinglebaseAuthDisplay,
|
|
11
|
+
n as SinglebaseAuthGuard,
|
|
12
|
+
o as SinglebaseAuthScreen,
|
|
13
|
+
c as defaultMessages,
|
|
14
|
+
S as fullNameOf,
|
|
15
|
+
u as initialsOf,
|
|
16
|
+
g as isGuestScreen,
|
|
17
|
+
d as isProtectedScreen,
|
|
18
|
+
f as isScreen,
|
|
19
|
+
O as matchesPredicate,
|
|
20
|
+
A as resolveMessages,
|
|
21
|
+
b as resolveRedirectTarget,
|
|
22
|
+
P as validatePredicate
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=authui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authui.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from "lit";
|
|
2
|
+
import type { AuthClient, AuthState } from "@singlebase/singlebase-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Subscribes a host element to an AuthClient's session state and triggers a
|
|
5
|
+
* re-render on every change, so individual elements never hand-roll
|
|
6
|
+
* subscribe/unsubscribe bookkeeping. Call bind(client) whenever the host's
|
|
7
|
+
* resolved client changes (e.g. context updates, or .client is set).
|
|
8
|
+
*/
|
|
9
|
+
export declare class AuthController implements ReactiveController {
|
|
10
|
+
private host;
|
|
11
|
+
private client;
|
|
12
|
+
private unsubscribe;
|
|
13
|
+
state: AuthState;
|
|
14
|
+
constructor(host: ReactiveControllerHost);
|
|
15
|
+
bind(client: AuthClient | null): void;
|
|
16
|
+
hostDisconnected(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from "lit";
|
|
2
|
+
import type { AuthClient } from "@singlebase/singlebase-sdk";
|
|
3
|
+
export declare const BRIDGED_EVENTS: readonly ["load", "success", "error", "signin", "signup", "signout", "session", "account-updated", "password-change", "email-change", "username-change", "expired", "navigate", "goto"];
|
|
4
|
+
/** "account-updated" -> "onAccountUpdated" */
|
|
5
|
+
export declare function callbackPropFor(event: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Re-publishes core auth events on the host element in the two ways host
|
|
8
|
+
* apps actually consume them:
|
|
9
|
+
*
|
|
10
|
+
* - a DOM CustomEvent (`singlebase-signin`, and the spec's `auth:signin`),
|
|
11
|
+
* bubbling and composed so `document.addEventListener` works;
|
|
12
|
+
* - a callback property (`el.onSignin = fn`), since HTML attributes cannot
|
|
13
|
+
* carry functions.
|
|
14
|
+
*
|
|
15
|
+
* Event details never include tokens — consumers read the session through
|
|
16
|
+
* the client, per the spec's events rule.
|
|
17
|
+
*/
|
|
18
|
+
export declare class EventBridge implements ReactiveController {
|
|
19
|
+
private host;
|
|
20
|
+
private unsubscribes;
|
|
21
|
+
private client;
|
|
22
|
+
constructor(host: ReactiveControllerHost & HTMLElement);
|
|
23
|
+
bind(client: AuthClient | null): void;
|
|
24
|
+
private publish;
|
|
25
|
+
private release;
|
|
26
|
+
hostDisconnected(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from "lit";
|
|
2
|
+
import type { AuthClient, AuthSettings } from "@singlebase/singlebase-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Loads auth.settings once per bound client and caches it, so composing
|
|
5
|
+
* many form elements inside <singlebase-authui> doesn't mean many redundant
|
|
6
|
+
* auth.settings calls. Each element may also be given .settings directly
|
|
7
|
+
* (e.g. by a parent that already loaded them) to skip the fetch entirely.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SettingsController implements ReactiveController {
|
|
10
|
+
private host;
|
|
11
|
+
private client;
|
|
12
|
+
private cache;
|
|
13
|
+
settings: AuthSettings | null;
|
|
14
|
+
error: unknown;
|
|
15
|
+
constructor(host: ReactiveControllerHost);
|
|
16
|
+
hostConnected(): void;
|
|
17
|
+
load(client: AuthClient | null, override?: AuthSettings | null): void;
|
|
18
|
+
}
|