@minca/core 0.1.18 → 0.2.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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/watch-notifications.d.ts +6 -0
- package/dist/node/watch-notifications.d.ts.map +1 -1
- package/dist/node/watch-notifications.js +47 -9
- package/dist/node/watch-notifications.js.map +1 -1
- package/dist/session/account-hint.d.ts +2 -2
- package/dist/session/account-hint.d.ts.map +1 -1
- package/dist/session/account-hint.js +3 -3
- package/dist/session/account-hint.js.map +1 -1
- package/dist/session/connection.d.ts +18 -0
- package/dist/session/connection.d.ts.map +1 -1
- package/dist/session/connection.js +11 -0
- package/dist/session/connection.js.map +1 -1
- package/dist/session/index.d.ts +2 -2
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +2 -2
- package/dist/session/index.js.map +1 -1
- package/docs/building-an-app.md +16 -0
- package/docs/node.md +25 -16
- package/docs/sign-in.md +30 -37
- package/docs/standard-library.md +14 -0
- package/docs/usernames.md +2 -2
- package/package.json +1 -6
- package/dist/elements/auth-styles.d.ts +0 -18
- package/dist/elements/auth-styles.d.ts.map +0 -1
- package/dist/elements/auth-styles.js +0 -206
- package/dist/elements/auth-styles.js.map +0 -1
- package/dist/elements/dom.d.ts +0 -29
- package/dist/elements/dom.d.ts.map +0 -1
- package/dist/elements/dom.js +0 -91
- package/dist/elements/dom.js.map +0 -1
- package/dist/elements/index.d.ts +0 -13
- package/dist/elements/index.d.ts.map +0 -1
- package/dist/elements/index.js +0 -11
- package/dist/elements/index.js.map +0 -1
- package/dist/elements/minca-auth.d.ts +0 -55
- package/dist/elements/minca-auth.d.ts.map +0 -1
- package/dist/elements/minca-auth.js +0 -768
- package/dist/elements/minca-auth.js.map +0 -1
package/docs/node.md
CHANGED
|
@@ -920,6 +920,28 @@ and nor is what a collection held when an automation first looked there.
|
|
|
920
920
|
How to show a match is up to the app. A "Notify me" button is usually where a
|
|
921
921
|
proposal starts.
|
|
922
922
|
|
|
923
|
+
For a list of what happened, pass `onActivity` too. After each change it gets
|
|
924
|
+
what the automations match now, newest first, up to 50, each record once under
|
|
925
|
+
the automation that asks about it most particularly. A match is dated by what
|
|
926
|
+
set it off, and listed if it would have notified when that was written, so
|
|
927
|
+
the 24 hours don't apply. It comes from the records, so it holds what arrived
|
|
928
|
+
while the app was closed, and devices holding the same records list the same.
|
|
929
|
+
Like notifications, it looks at the newest 50 records of a collection, by the
|
|
930
|
+
time their writers gave them, so an older match drops out under newer ones. A
|
|
931
|
+
match dated more than five minutes ahead waits for its time.
|
|
932
|
+
|
|
933
|
+
```js
|
|
934
|
+
watchNotifications(node, {
|
|
935
|
+
onNotify: ({ automation, record }) => showPopup(automation, record),
|
|
936
|
+
onActivity: (matches) => setActivity(matches),
|
|
937
|
+
});
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
What the person has read of it is the app's to keep: a time in the account
|
|
941
|
+
registry, say, and what is newer counts as new. A record that arrives late,
|
|
942
|
+
dated before that time, then isn't new, though it still notifies within its
|
|
943
|
+
24 hours.
|
|
944
|
+
|
|
923
945
|
## Carriers, hosting and notifications
|
|
924
946
|
|
|
925
947
|
A carrier is an always-on node that keeps the account's spaces online while
|
|
@@ -1131,28 +1153,15 @@ a [`KnockView`](https://minca.dev/api/core/interfaces/KnockView/). Knocking and
|
|
|
1131
1153
|
These aren't protocol. Another client may draw sign-in and
|
|
1132
1154
|
[calls](../../calls/README.md) however it likes.
|
|
1133
1155
|
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
```html
|
|
1138
|
-
<minca-auth app-name="Todo" relays="wss://relay.minca.social"></minca-auth>
|
|
1139
|
-
```
|
|
1140
|
-
|
|
1141
|
-
- Attributes: `app-name`, and `relays` and `nodes`, comma-separated.
|
|
1142
|
-
- It fires `minca-session` with `detail: { session }`, or `null` when signed
|
|
1143
|
-
out. The event bubbles and is composed.
|
|
1144
|
-
- A page can give it its own flow with `element.auth = createMincaAuth(…)`.
|
|
1145
|
-
- It sizes to its container, so it fits a page, a modal or a side panel, and
|
|
1146
|
-
draws nothing once someone is in.
|
|
1147
|
-
- Colours, font and radius are custom properties (`--minca-accent`,
|
|
1148
|
-
`--minca-font`, …).
|
|
1156
|
+
Sign-in has no drawn screens in the library: a page draws its own on
|
|
1157
|
+
[`createMincaAuth`](sign-in.md), as the account home does.
|
|
1149
1158
|
|
|
1150
1159
|
## React
|
|
1151
1160
|
|
|
1152
1161
|
`@minca/react` follows sign-in or the connection, and keeps what you read
|
|
1153
1162
|
live. `MincaProvider` goes at the top, given an `auth` or a `connection`;
|
|
1154
1163
|
`useMinca`, `useAuth`, `useSession`, `useConnection` and `useAccount` read
|
|
1155
|
-
it
|
|
1164
|
+
it. Below it, hooks such as `useNode`,
|
|
1156
1165
|
`useSpaces`, `useQuery`, `useRecord` and `useCan` read and keep current what
|
|
1157
1166
|
you show, with `useLive` and `useWatched` for anything else. Each one, and what
|
|
1158
1167
|
it gives, is in the [React reference](https://minca.dev/api/react/).
|
package/docs/sign-in.md
CHANGED
|
@@ -8,33 +8,34 @@ pairing a phone.
|
|
|
8
8
|
|
|
9
9
|
## The sign-in screen
|
|
10
10
|
|
|
11
|
-
The
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
The flow is state and actions: draw a screen for each `stage`, and call an
|
|
12
|
+
action from its buttons. `subscribe` calls back after every change.
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { createMincaAuth } from '@minca/core/session';
|
|
16
|
+
|
|
17
|
+
const auth = createMincaAuth({ appName: 'Todo', network: { relays: ['wss://relay.minca.social'] } });
|
|
18
|
+
|
|
19
|
+
auth.subscribe((state) => {
|
|
20
|
+
if (state.stage === 'ready') start(state.session.node);
|
|
21
|
+
else draw(state); // a screen for state.stage
|
|
22
|
+
});
|
|
23
|
+
passkeyButton.addEventListener('click', () => auth.signInWithPasskey());
|
|
24
|
+
void auth.start();
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
In React,
|
|
26
|
-
and show `<MincaAuth>` until the person is signed in:
|
|
27
|
+
In React, hand the flow to `MincaProvider`, and read it with `useMinca`:
|
|
27
28
|
|
|
28
29
|
```tsx
|
|
29
30
|
import { createRoot } from 'react-dom/client';
|
|
30
31
|
import { createMincaAuth } from '@minca/core/session';
|
|
31
|
-
import { MincaProvider,
|
|
32
|
+
import { MincaProvider, useMinca } from '@minca/react';
|
|
32
33
|
|
|
33
34
|
const auth = createMincaAuth({ appName: 'Todo', network: { relays: ['wss://relay.minca.social'] } });
|
|
34
35
|
|
|
35
36
|
function App() {
|
|
36
37
|
const { state } = useMinca();
|
|
37
|
-
if (state?.stage !== 'ready') return <
|
|
38
|
+
if (state?.stage !== 'ready') return <p>{state?.stage}</p>; // a screen for each stage
|
|
38
39
|
return <p>Signed in.</p>;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -45,9 +46,11 @@ createRoot(root).render(
|
|
|
45
46
|
);
|
|
46
47
|
```
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
The account home draws every stage
|
|
50
|
+
([its screens](https://github.com/leifriksheim/minca/tree/main/apps/home/src/components));
|
|
51
|
+
start from those. Everything below the provider works as it does for a
|
|
52
|
+
connected app. The rest of this page is what each stage means and which
|
|
53
|
+
action moves it on.
|
|
51
54
|
|
|
52
55
|
## Places
|
|
53
56
|
|
|
@@ -107,7 +110,7 @@ on the same stage. A dismissed passkey or folder prompt sets no error.
|
|
|
107
110
|
Chrome keeps a pod's folder between visits, but not the permission to use
|
|
108
111
|
it, unless the person chose "Allow on every visit". Then `start()` sets
|
|
109
112
|
`podToReopen` to the folder's name and goes on as if there were no pod.
|
|
110
|
-
|
|
113
|
+
Offer it first on the welcome screen. `reopenPod()`, called
|
|
111
114
|
from that click, asks for the permission and carries on as `start()` would
|
|
112
115
|
have.
|
|
113
116
|
|
|
@@ -285,8 +288,8 @@ the person confirms on the computer. The phone then signs in, joins each
|
|
|
285
288
|
space (`{ kind: 'joining', joined, total }`), and ends on `received`.
|
|
286
289
|
|
|
287
290
|
It waits 60 seconds for the computer to answer, and 10 minutes for the
|
|
288
|
-
person to confirm. Where accounts are already kept,
|
|
289
|
-
before
|
|
291
|
+
person to confirm. Where accounts are already kept, a page drawing its own
|
|
292
|
+
screens must warn the person before the tap that calls `acceptPairing()`: a link someone else sent would put the phone in their
|
|
290
293
|
account.
|
|
291
294
|
|
|
292
295
|
After that, the account goes to `unlock` with `setup: 'paired'` if it has no
|
|
@@ -302,7 +305,7 @@ asking, and only its spaces are joined.
|
|
|
302
305
|
|
|
303
306
|
`answerPairing(true)` adds the account, or switches to it, and keeps the
|
|
304
307
|
other one filed to switch back to. `answerPairing(false)` lets it go.
|
|
305
|
-
|
|
308
|
+
Ask the person: "Add this account?" or "Switch to <name>?".
|
|
306
309
|
|
|
307
310
|
Switching doesn't sign the other account out: its session key is left as it
|
|
308
311
|
is, as when a tab closes. Only the session open when the account arrives
|
|
@@ -361,20 +364,10 @@ in a pod is not removed this way: the pod is its copy.
|
|
|
361
364
|
|
|
362
365
|
## Linking to the account home
|
|
363
366
|
|
|
364
|
-
|
|
365
|
-
`
|
|
366
|
-
account
|
|
367
|
-
|
|
368
|
-
```ts
|
|
369
|
-
import { accountHomeLink, popupFeatures } from '@minca/core/session';
|
|
370
|
-
|
|
371
|
-
const home = 'https://home.minca.social/connect';
|
|
372
|
-
window.open(accountHomeLink(home, did, 'notifications'), 'minca', popupFeatures(480, 640));
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
That opens `…#notifications&account=<did>`. `popupFeatures(width, height)`
|
|
376
|
-
centres the popup on the window it opens from. Given only a size, a browser
|
|
377
|
-
puts it where it likes, often the top left of the screen.
|
|
367
|
+
A connected app opens the person's account home with
|
|
368
|
+
[`connection.openHome()`](building-an-app.md#the-account-home). It opens the
|
|
369
|
+
account page beside the connect page, with the account in the fragment, so it
|
|
370
|
+
never reaches the home's server: `…#notifications&account=<did>`.
|
|
378
371
|
|
|
379
372
|
On the home, `readAccountHint()` gives the DID, or null when there is none or
|
|
380
373
|
it isn't a P-256 `did:key`. `clearAccountHint()` takes it out of the address
|
package/docs/standard-library.md
CHANGED
|
@@ -308,6 +308,20 @@ until an admin redefines the member role.
|
|
|
308
308
|
The example app reads no `std.space-profile` in a space for two. It names
|
|
309
309
|
the space for the other person.
|
|
310
310
|
|
|
311
|
+
## Text is Markdown
|
|
312
|
+
|
|
313
|
+
The `text` of a `std.message`, `std.comment` or `std.post` is Markdown:
|
|
314
|
+
CommonMark, with GitHub's tables and `~~strikethrough~~`. A plain sentence is
|
|
315
|
+
Markdown too, so an app that shows text as it is still shows it right.
|
|
316
|
+
|
|
317
|
+
````json
|
|
318
|
+
{ "text": "Shipped **today**:\n\n- the chat\n- `code` blocks\n\n```\nnpm run dev\n```" }
|
|
319
|
+
````
|
|
320
|
+
|
|
321
|
+
Draw it as elements, never as HTML, so a message can't put markup on the
|
|
322
|
+
screen. A screen gets this from the kit: `MentionText` draws it and
|
|
323
|
+
`MentionInput` writes it.
|
|
324
|
+
|
|
311
325
|
## Mentions and replies
|
|
312
326
|
|
|
313
327
|
A `std.message`, `std.comment` or `std.post` names the accounts it calls on
|
package/docs/usernames.md
CHANGED
|
@@ -53,8 +53,8 @@ within a month of the name lapsing, so this is rare.
|
|
|
53
53
|
|
|
54
54
|
## At sign-up
|
|
55
55
|
|
|
56
|
-
Pass `usernames` to `createMincaAuth`, and the
|
|
57
|
-
|
|
56
|
+
Pass `usernames` to `createMincaAuth`, and the account is made with a
|
|
57
|
+
username: the create screen asks for one.
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
60
|
import { createMincaAuth } from '@minca/core/session';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@minca/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Self-sovereign P2P protocol for the browser — identity, schemas, storage, networking, and gossip sync",
|
|
6
6
|
"repository": {
|
|
@@ -46,11 +46,6 @@
|
|
|
46
46
|
"types": "./dist/session/index.d.ts",
|
|
47
47
|
"import": "./dist/session/index.js"
|
|
48
48
|
},
|
|
49
|
-
"./elements": {
|
|
50
|
-
"@minca/source": "./src/elements/index.ts",
|
|
51
|
-
"types": "./dist/elements/index.d.ts",
|
|
52
|
-
"import": "./dist/elements/index.js"
|
|
53
|
-
},
|
|
54
49
|
"./inbox": {
|
|
55
50
|
"@minca/source": "./src/inbox/index.ts",
|
|
56
51
|
"types": "./dist/inbox/index.d.ts",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module elements/auth-styles
|
|
3
|
-
* How `<minca-auth>` looks.
|
|
4
|
-
*
|
|
5
|
-
* Black and white, hairline borders, one accent. Every colour, the font and
|
|
6
|
-
* the corner radius are custom properties on the element, so a host page
|
|
7
|
-
* restyles it without reaching inside:
|
|
8
|
-
*
|
|
9
|
-
* ```css
|
|
10
|
-
* minca-auth { --minca-accent: #4f46e5; --minca-font: 'Inter', sans-serif; }
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* It sizes itself to its container rather than the window — a container query,
|
|
14
|
-
* not a media query — so the same element fits a full page, a modal or a side
|
|
15
|
-
* panel without being told which.
|
|
16
|
-
*/
|
|
17
|
-
export declare const AUTH_CSS = "\nminca-auth {\n --minca-ink: #000;\n --minca-body: #171717;\n --minca-muted: #666;\n --minca-faint: #8f8f8f;\n --minca-surface: #fff;\n --minca-sunken: #fafafa;\n --minca-line: #eaeaea;\n --minca-line-strong: #d4d4d4;\n --minca-accent: #000;\n --minca-accent-hover: #383838;\n --minca-on-accent: #fff;\n --minca-danger: #e5484d;\n --minca-danger-soft: #fff0f0;\n --minca-warn: #9a5a0b;\n --minca-good: #2f7a52;\n --minca-radius: 6px;\n --minca-font: \"Geist\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;\n --minca-mono: \"Geist Mono\", ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace;\n\n display: block;\n container-type: inline-size;\n color: var(--minca-body);\n font-family: var(--minca-font);\n font-size: 14px;\n letter-spacing: -0.006em;\n -webkit-font-smoothing: antialiased;\n}\nminca-auth[hidden] { display: none; }\nminca-auth *, minca-auth *::before, minca-auth *::after { box-sizing: border-box; }\nminca-auth :is(h1, p) { margin: 0; }\n\nminca-auth .wa-card { width: 100%; max-width: 380px; margin: 0 auto; }\nminca-auth .wa-wordmark { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; color: var(--minca-ink); font-weight: 600; font-size: 16px; letter-spacing: -0.03em; }\nminca-auth .wa-title { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: var(--minca-ink); margin-bottom: 8px; line-height: 1.2; }\nminca-auth .wa-subtitle { font-size: 15px; color: var(--minca-muted); margin-bottom: 32px; line-height: 1.5; }\nminca-auth .wa-hint { font-size: 14px; color: var(--minca-muted); margin-bottom: 20px; line-height: 1.6; }\nminca-auth .wa-small { font-size: 13px; color: var(--minca-muted); margin-top: 8px; line-height: 1.6; }\nminca-auth .wa-meter { display: flex; gap: 4px; margin-top: 2px; }\nminca-auth .wa-meter > span { flex: 1; height: 4px; border-radius: 2px; background: var(--minca-line); transition: background-color .15s ease; }\nminca-auth .wa-meter[data-strength=\"weak\"] > span:first-child { background: var(--minca-danger); }\nminca-auth .wa-meter[data-strength=\"fair\"] > span:not(:last-child) { background: var(--minca-warn); }\nminca-auth .wa-meter[data-strength=\"strong\"] > span { background: var(--minca-good); }\nminca-auth .wa-small[data-strength] { margin-top: 0; }\nminca-auth .wa-small[data-strength=\"weak\"] { color: var(--minca-danger); }\nminca-auth .wa-error { color: var(--minca-danger); font-size: 14px; font-weight: 500; }\nminca-auth .wa-error-box { margin-top: 16px; padding: 12px 14px; border-radius: var(--minca-radius); background: var(--minca-danger-soft); }\n\nminca-auth .wa-form { display: flex; flex-direction: column; gap: 8px; }\nminca-auth .wa-form + .wa-form { margin-top: 10px; }\nminca-auth input {\n width: 100%; height: 40px; padding: 0 12px;\n border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong);\n background: var(--minca-surface); color: var(--minca-ink);\n font: inherit; font-size: 14px; outline: none;\n transition: border-color .15s ease, box-shadow .15s ease;\n}\nminca-auth input::placeholder { color: var(--minca-faint); }\nminca-auth .wa-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--minca-ink); margin-top: 10px; }\nminca-auth .wa-optional { font-weight: 400; color: var(--minca-faint); }\nminca-auth .wa-under { margin-top: -2px; font-size: 12px; }\nminca-auth .wa-username {\n display: flex; align-items: center; height: 40px;\n border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong); background: var(--minca-surface);\n transition: border-color .15s ease, box-shadow .15s ease;\n}\nminca-auth .wa-username:focus-within { border-color: var(--minca-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }\nminca-auth .wa-username input, minca-auth .wa-username input:focus { flex: 1; min-width: 0; height: 100%; border: none; box-shadow: none; background: transparent; }\nminca-auth .wa-username > span { padding-right: 12px; color: var(--minca-muted); white-space: nowrap; }\nminca-auth .wa-domain { all: unset; padding: 0 12px 0 0; color: var(--minca-muted); white-space: nowrap; cursor: pointer; }\nminca-auth .wa-domain:hover, minca-auth .wa-domain:focus-visible { color: var(--minca-ink); text-decoration: underline; text-underline-offset: 3px; }\nminca-auth .wa-domain[hidden] { display: none; }\nminca-auth .wa-under a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }\nminca-auth .wa-mark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin: 0 10px 0 -4px; padding: 0 !important; border-radius: 50%; font-size: 11px; font-weight: 700; }\nminca-auth .wa-mark:empty { display: none; }\nminca-auth .wa-mark[data-name=\"free\"] { background: var(--minca-good); color: #fff !important; }\nminca-auth .wa-mark[data-name=\"taken\"] { background: var(--minca-danger); color: #fff !important; }\nminca-auth .wa-small[data-name=\"taken\"] { color: var(--minca-danger); }\nminca-auth .wa-small[data-name=\"free\"]:not(.wa-under) { color: var(--minca-good); }\nminca-auth input:focus { border-color: var(--minca-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }\nminca-auth .wa-offscreen {\n position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;\n overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;\n}\n\nminca-auth button { font: inherit; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }\nminca-auth button:not(:disabled) { cursor: pointer; }\nminca-auth button:disabled { opacity: .5; cursor: not-allowed; }\nminca-auth :focus-visible { outline: 2px solid var(--minca-ink); outline-offset: 2px; }\nminca-auth button:focus:not(:focus-visible) { outline: none; }\n\nminca-auth .wa-button {\n width: 100%; height: 40px; padding: 0 16px;\n border-radius: var(--minca-radius); border: 1px solid transparent;\n background: var(--minca-accent); color: var(--minca-on-accent);\n font-size: 14px; font-weight: 500;\n}\nminca-auth .wa-button:not(:disabled):hover { background: var(--minca-accent-hover); }\nminca-auth .wa-link {\n background: none; border: none; padding: 4px 0; margin-right: 12px;\n color: var(--minca-muted); font-size: 13px; font-weight: 500; text-align: left;\n}\nminca-auth .wa-link:not(:disabled):hover { color: var(--minca-ink); }\nminca-auth .wa-links { display: flex; flex-wrap: wrap; margin-top: 10px; }\n\n/* Choices are one list: a box, a hairline between each. */\nminca-auth .wa-options {\n display: flex; flex-direction: column; overflow: hidden;\n border: 1px solid var(--minca-line); border-radius: var(--minca-radius); background: var(--minca-surface);\n}\nminca-auth .wa-option {\n display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px;\n text-align: left; border: none; border-radius: 0; background: none; color: var(--minca-body);\n}\nminca-auth .wa-option:not(:disabled):hover { background: var(--minca-sunken); }\n/* After .wa-option, which has no border of its own, and as specific: the line between rows wins. */\nminca-auth .wa-options > :not(:first-child) { border-top: 1px solid var(--minca-line); }\nminca-auth .wa-option-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }\n/* Where a page draws each kind of choice's icon, by its data-option; empty, it takes no room. */\nminca-auth .wa-option-icon { display: none; flex-shrink: 0; width: 36px; height: 36px; background: center / contain no-repeat; }\nminca-auth .wa-options > .wa-steps { margin: 0; padding: 12px 16px 14px 36px; }\nminca-auth .wa-option-title { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--minca-ink); }\nminca-auth .wa-option-text { color: var(--minca-muted); font-size: 13px; line-height: 1.5; }\nminca-auth .wa-badge {\n font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;\n background: var(--minca-sunken); border: 1px solid var(--minca-line); color: var(--minca-muted);\n}\n\nminca-auth .wa-accounts { display: flex; flex-direction: column; gap: 8px; }\nminca-auth .wa-account { border: 1px solid var(--minca-line); border-radius: var(--minca-radius); background: var(--minca-surface); }\nminca-auth .wa-account-open { padding: 20px; border-color: var(--minca-line-strong); }\nminca-auth .wa-account-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }\nminca-auth .wa-account-head .wa-account-name { font-size: 17px; }\nminca-auth .wa-account-row {\n display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px;\n text-align: left; color: var(--minca-body);\n}\nminca-auth .wa-account-row:not(:disabled):hover { background: var(--minca-sunken); }\nminca-auth .wa-account-name { display: block; font-weight: 600; color: var(--minca-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\nminca-auth .wa-chevron { color: var(--minca-faint); font-size: 18px; }\nminca-auth .wa-small .wa-link { padding: 0; margin: 0 8px 0 0; font-size: 13px; }\nminca-auth .wa-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--minca-line); }\nminca-auth .wa-footer .wa-links { margin-top: 0; }\nminca-auth .wa-avatar { flex-shrink: 0; display: block; border-radius: 8px; }\nminca-auth .wa-avatar-round { border-radius: 50% !important; }\n\nminca-auth .wa-code {\n display: block; margin-top: 16px; padding: 12px; border-radius: var(--minca-radius);\n background: var(--minca-sunken); border: 1px solid var(--minca-line);\n font-family: var(--minca-mono); font-size: 13px; color: var(--minca-ink);\n word-break: break-all; user-select: all;\n}\n\nminca-auth .wa-code-large { font-size: 17px; letter-spacing: 0.04em; text-align: center; padding: 16px 12px; margin-top: 0; }\nminca-auth .wa-row { display: flex; gap: 8px; margin-top: 10px; }\nminca-auth .wa-secondary {\n flex: 1; height: 36px; padding: 0 12px;\n border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong);\n background: var(--minca-surface); color: var(--minca-ink); font-size: 13px; font-weight: 500;\n}\nminca-auth .wa-secondary:not(:disabled):hover { background: var(--minca-sunken); }\nminca-auth .wa-check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 16px; font-size: 14px; line-height: 1.5; color: var(--minca-body); cursor: pointer; }\nminca-auth .wa-check input { width: 16px; height: 16px; margin: 3px 0 0; padding: 0; flex-shrink: 0; accent-color: var(--minca-accent); box-shadow: none; }\nminca-auth .wa-steps { margin: 0 0 20px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--minca-body); }\n\nminca-auth .wa-info { position: relative; display: inline; }\nminca-auth .wa-info-button {\n display: inline-flex; align-items: center; justify-content: center;\n width: 16px; height: 16px; padding: 0; margin-left: 6px; vertical-align: text-bottom;\n border-radius: 999px; border: 1px solid var(--minca-line-strong); background: none;\n color: var(--minca-faint); font-size: 10px; font-weight: 700; line-height: 1;\n}\nminca-auth .wa-popover {\n position: absolute; z-index: 30; top: 22px; left: 0; width: min(260px, 80cqi);\n padding: 12px 14px; border-radius: var(--minca-radius);\n background: var(--minca-surface); border: 1px solid var(--minca-line);\n box-shadow: 0 12px 28px -12px rgba(15, 17, 21, .22);\n font-size: 12.5px; line-height: 1.6; color: var(--minca-muted); font-weight: 400;\n}\nminca-auth .wa-popover[hidden] { display: none; }\n\n@container (max-width: 340px) {\n minca-auth .wa-title { font-size: 24px; }\n minca-auth .wa-subtitle { margin-bottom: 24px; }\n minca-auth .wa-wordmark { margin-bottom: 28px; }\n minca-auth .wa-popover { left: auto; right: -8px; }\n}\n";
|
|
18
|
-
//# sourceMappingURL=auth-styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-styles.d.ts","sourceRoot":"","sources":["../../src/elements/auth-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,wkXA4LpB,CAAC"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module elements/auth-styles
|
|
3
|
-
* How `<minca-auth>` looks.
|
|
4
|
-
*
|
|
5
|
-
* Black and white, hairline borders, one accent. Every colour, the font and
|
|
6
|
-
* the corner radius are custom properties on the element, so a host page
|
|
7
|
-
* restyles it without reaching inside:
|
|
8
|
-
*
|
|
9
|
-
* ```css
|
|
10
|
-
* minca-auth { --minca-accent: #4f46e5; --minca-font: 'Inter', sans-serif; }
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* It sizes itself to its container rather than the window — a container query,
|
|
14
|
-
* not a media query — so the same element fits a full page, a modal or a side
|
|
15
|
-
* panel without being told which.
|
|
16
|
-
*/
|
|
17
|
-
export const AUTH_CSS = `
|
|
18
|
-
minca-auth {
|
|
19
|
-
--minca-ink: #000;
|
|
20
|
-
--minca-body: #171717;
|
|
21
|
-
--minca-muted: #666;
|
|
22
|
-
--minca-faint: #8f8f8f;
|
|
23
|
-
--minca-surface: #fff;
|
|
24
|
-
--minca-sunken: #fafafa;
|
|
25
|
-
--minca-line: #eaeaea;
|
|
26
|
-
--minca-line-strong: #d4d4d4;
|
|
27
|
-
--minca-accent: #000;
|
|
28
|
-
--minca-accent-hover: #383838;
|
|
29
|
-
--minca-on-accent: #fff;
|
|
30
|
-
--minca-danger: #e5484d;
|
|
31
|
-
--minca-danger-soft: #fff0f0;
|
|
32
|
-
--minca-warn: #9a5a0b;
|
|
33
|
-
--minca-good: #2f7a52;
|
|
34
|
-
--minca-radius: 6px;
|
|
35
|
-
--minca-font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
36
|
-
--minca-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
37
|
-
|
|
38
|
-
display: block;
|
|
39
|
-
container-type: inline-size;
|
|
40
|
-
color: var(--minca-body);
|
|
41
|
-
font-family: var(--minca-font);
|
|
42
|
-
font-size: 14px;
|
|
43
|
-
letter-spacing: -0.006em;
|
|
44
|
-
-webkit-font-smoothing: antialiased;
|
|
45
|
-
}
|
|
46
|
-
minca-auth[hidden] { display: none; }
|
|
47
|
-
minca-auth *, minca-auth *::before, minca-auth *::after { box-sizing: border-box; }
|
|
48
|
-
minca-auth :is(h1, p) { margin: 0; }
|
|
49
|
-
|
|
50
|
-
minca-auth .wa-card { width: 100%; max-width: 380px; margin: 0 auto; }
|
|
51
|
-
minca-auth .wa-wordmark { display: flex; align-items: center; gap: 8px; margin-bottom: 40px; color: var(--minca-ink); font-weight: 600; font-size: 16px; letter-spacing: -0.03em; }
|
|
52
|
-
minca-auth .wa-title { font-size: 28px; font-weight: 600; letter-spacing: -0.04em; color: var(--minca-ink); margin-bottom: 8px; line-height: 1.2; }
|
|
53
|
-
minca-auth .wa-subtitle { font-size: 15px; color: var(--minca-muted); margin-bottom: 32px; line-height: 1.5; }
|
|
54
|
-
minca-auth .wa-hint { font-size: 14px; color: var(--minca-muted); margin-bottom: 20px; line-height: 1.6; }
|
|
55
|
-
minca-auth .wa-small { font-size: 13px; color: var(--minca-muted); margin-top: 8px; line-height: 1.6; }
|
|
56
|
-
minca-auth .wa-meter { display: flex; gap: 4px; margin-top: 2px; }
|
|
57
|
-
minca-auth .wa-meter > span { flex: 1; height: 4px; border-radius: 2px; background: var(--minca-line); transition: background-color .15s ease; }
|
|
58
|
-
minca-auth .wa-meter[data-strength="weak"] > span:first-child { background: var(--minca-danger); }
|
|
59
|
-
minca-auth .wa-meter[data-strength="fair"] > span:not(:last-child) { background: var(--minca-warn); }
|
|
60
|
-
minca-auth .wa-meter[data-strength="strong"] > span { background: var(--minca-good); }
|
|
61
|
-
minca-auth .wa-small[data-strength] { margin-top: 0; }
|
|
62
|
-
minca-auth .wa-small[data-strength="weak"] { color: var(--minca-danger); }
|
|
63
|
-
minca-auth .wa-error { color: var(--minca-danger); font-size: 14px; font-weight: 500; }
|
|
64
|
-
minca-auth .wa-error-box { margin-top: 16px; padding: 12px 14px; border-radius: var(--minca-radius); background: var(--minca-danger-soft); }
|
|
65
|
-
|
|
66
|
-
minca-auth .wa-form { display: flex; flex-direction: column; gap: 8px; }
|
|
67
|
-
minca-auth .wa-form + .wa-form { margin-top: 10px; }
|
|
68
|
-
minca-auth input {
|
|
69
|
-
width: 100%; height: 40px; padding: 0 12px;
|
|
70
|
-
border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong);
|
|
71
|
-
background: var(--minca-surface); color: var(--minca-ink);
|
|
72
|
-
font: inherit; font-size: 14px; outline: none;
|
|
73
|
-
transition: border-color .15s ease, box-shadow .15s ease;
|
|
74
|
-
}
|
|
75
|
-
minca-auth input::placeholder { color: var(--minca-faint); }
|
|
76
|
-
minca-auth .wa-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--minca-ink); margin-top: 10px; }
|
|
77
|
-
minca-auth .wa-optional { font-weight: 400; color: var(--minca-faint); }
|
|
78
|
-
minca-auth .wa-under { margin-top: -2px; font-size: 12px; }
|
|
79
|
-
minca-auth .wa-username {
|
|
80
|
-
display: flex; align-items: center; height: 40px;
|
|
81
|
-
border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong); background: var(--minca-surface);
|
|
82
|
-
transition: border-color .15s ease, box-shadow .15s ease;
|
|
83
|
-
}
|
|
84
|
-
minca-auth .wa-username:focus-within { border-color: var(--minca-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
|
|
85
|
-
minca-auth .wa-username input, minca-auth .wa-username input:focus { flex: 1; min-width: 0; height: 100%; border: none; box-shadow: none; background: transparent; }
|
|
86
|
-
minca-auth .wa-username > span { padding-right: 12px; color: var(--minca-muted); white-space: nowrap; }
|
|
87
|
-
minca-auth .wa-domain { all: unset; padding: 0 12px 0 0; color: var(--minca-muted); white-space: nowrap; cursor: pointer; }
|
|
88
|
-
minca-auth .wa-domain:hover, minca-auth .wa-domain:focus-visible { color: var(--minca-ink); text-decoration: underline; text-underline-offset: 3px; }
|
|
89
|
-
minca-auth .wa-domain[hidden] { display: none; }
|
|
90
|
-
minca-auth .wa-under a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
|
|
91
|
-
minca-auth .wa-mark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin: 0 10px 0 -4px; padding: 0 !important; border-radius: 50%; font-size: 11px; font-weight: 700; }
|
|
92
|
-
minca-auth .wa-mark:empty { display: none; }
|
|
93
|
-
minca-auth .wa-mark[data-name="free"] { background: var(--minca-good); color: #fff !important; }
|
|
94
|
-
minca-auth .wa-mark[data-name="taken"] { background: var(--minca-danger); color: #fff !important; }
|
|
95
|
-
minca-auth .wa-small[data-name="taken"] { color: var(--minca-danger); }
|
|
96
|
-
minca-auth .wa-small[data-name="free"]:not(.wa-under) { color: var(--minca-good); }
|
|
97
|
-
minca-auth input:focus { border-color: var(--minca-muted); box-shadow: 0 0 0 3px rgba(0, 0, 0, .06); }
|
|
98
|
-
minca-auth .wa-offscreen {
|
|
99
|
-
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
|
|
100
|
-
overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
minca-auth button { font: inherit; transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
|
|
104
|
-
minca-auth button:not(:disabled) { cursor: pointer; }
|
|
105
|
-
minca-auth button:disabled { opacity: .5; cursor: not-allowed; }
|
|
106
|
-
minca-auth :focus-visible { outline: 2px solid var(--minca-ink); outline-offset: 2px; }
|
|
107
|
-
minca-auth button:focus:not(:focus-visible) { outline: none; }
|
|
108
|
-
|
|
109
|
-
minca-auth .wa-button {
|
|
110
|
-
width: 100%; height: 40px; padding: 0 16px;
|
|
111
|
-
border-radius: var(--minca-radius); border: 1px solid transparent;
|
|
112
|
-
background: var(--minca-accent); color: var(--minca-on-accent);
|
|
113
|
-
font-size: 14px; font-weight: 500;
|
|
114
|
-
}
|
|
115
|
-
minca-auth .wa-button:not(:disabled):hover { background: var(--minca-accent-hover); }
|
|
116
|
-
minca-auth .wa-link {
|
|
117
|
-
background: none; border: none; padding: 4px 0; margin-right: 12px;
|
|
118
|
-
color: var(--minca-muted); font-size: 13px; font-weight: 500; text-align: left;
|
|
119
|
-
}
|
|
120
|
-
minca-auth .wa-link:not(:disabled):hover { color: var(--minca-ink); }
|
|
121
|
-
minca-auth .wa-links { display: flex; flex-wrap: wrap; margin-top: 10px; }
|
|
122
|
-
|
|
123
|
-
/* Choices are one list: a box, a hairline between each. */
|
|
124
|
-
minca-auth .wa-options {
|
|
125
|
-
display: flex; flex-direction: column; overflow: hidden;
|
|
126
|
-
border: 1px solid var(--minca-line); border-radius: var(--minca-radius); background: var(--minca-surface);
|
|
127
|
-
}
|
|
128
|
-
minca-auth .wa-option {
|
|
129
|
-
display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px;
|
|
130
|
-
text-align: left; border: none; border-radius: 0; background: none; color: var(--minca-body);
|
|
131
|
-
}
|
|
132
|
-
minca-auth .wa-option:not(:disabled):hover { background: var(--minca-sunken); }
|
|
133
|
-
/* After .wa-option, which has no border of its own, and as specific: the line between rows wins. */
|
|
134
|
-
minca-auth .wa-options > :not(:first-child) { border-top: 1px solid var(--minca-line); }
|
|
135
|
-
minca-auth .wa-option-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
|
|
136
|
-
/* Where a page draws each kind of choice's icon, by its data-option; empty, it takes no room. */
|
|
137
|
-
minca-auth .wa-option-icon { display: none; flex-shrink: 0; width: 36px; height: 36px; background: center / contain no-repeat; }
|
|
138
|
-
minca-auth .wa-options > .wa-steps { margin: 0; padding: 12px 16px 14px 36px; }
|
|
139
|
-
minca-auth .wa-option-title { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--minca-ink); }
|
|
140
|
-
minca-auth .wa-option-text { color: var(--minca-muted); font-size: 13px; line-height: 1.5; }
|
|
141
|
-
minca-auth .wa-badge {
|
|
142
|
-
font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px;
|
|
143
|
-
background: var(--minca-sunken); border: 1px solid var(--minca-line); color: var(--minca-muted);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
minca-auth .wa-accounts { display: flex; flex-direction: column; gap: 8px; }
|
|
147
|
-
minca-auth .wa-account { border: 1px solid var(--minca-line); border-radius: var(--minca-radius); background: var(--minca-surface); }
|
|
148
|
-
minca-auth .wa-account-open { padding: 20px; border-color: var(--minca-line-strong); }
|
|
149
|
-
minca-auth .wa-account-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
|
|
150
|
-
minca-auth .wa-account-head .wa-account-name { font-size: 17px; }
|
|
151
|
-
minca-auth .wa-account-row {
|
|
152
|
-
display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px;
|
|
153
|
-
text-align: left; color: var(--minca-body);
|
|
154
|
-
}
|
|
155
|
-
minca-auth .wa-account-row:not(:disabled):hover { background: var(--minca-sunken); }
|
|
156
|
-
minca-auth .wa-account-name { display: block; font-weight: 600; color: var(--minca-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
157
|
-
minca-auth .wa-chevron { color: var(--minca-faint); font-size: 18px; }
|
|
158
|
-
minca-auth .wa-small .wa-link { padding: 0; margin: 0 8px 0 0; font-size: 13px; }
|
|
159
|
-
minca-auth .wa-footer { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--minca-line); }
|
|
160
|
-
minca-auth .wa-footer .wa-links { margin-top: 0; }
|
|
161
|
-
minca-auth .wa-avatar { flex-shrink: 0; display: block; border-radius: 8px; }
|
|
162
|
-
minca-auth .wa-avatar-round { border-radius: 50% !important; }
|
|
163
|
-
|
|
164
|
-
minca-auth .wa-code {
|
|
165
|
-
display: block; margin-top: 16px; padding: 12px; border-radius: var(--minca-radius);
|
|
166
|
-
background: var(--minca-sunken); border: 1px solid var(--minca-line);
|
|
167
|
-
font-family: var(--minca-mono); font-size: 13px; color: var(--minca-ink);
|
|
168
|
-
word-break: break-all; user-select: all;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
minca-auth .wa-code-large { font-size: 17px; letter-spacing: 0.04em; text-align: center; padding: 16px 12px; margin-top: 0; }
|
|
172
|
-
minca-auth .wa-row { display: flex; gap: 8px; margin-top: 10px; }
|
|
173
|
-
minca-auth .wa-secondary {
|
|
174
|
-
flex: 1; height: 36px; padding: 0 12px;
|
|
175
|
-
border-radius: var(--minca-radius); border: 1px solid var(--minca-line-strong);
|
|
176
|
-
background: var(--minca-surface); color: var(--minca-ink); font-size: 13px; font-weight: 500;
|
|
177
|
-
}
|
|
178
|
-
minca-auth .wa-secondary:not(:disabled):hover { background: var(--minca-sunken); }
|
|
179
|
-
minca-auth .wa-check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0 16px; font-size: 14px; line-height: 1.5; color: var(--minca-body); cursor: pointer; }
|
|
180
|
-
minca-auth .wa-check input { width: 16px; height: 16px; margin: 3px 0 0; padding: 0; flex-shrink: 0; accent-color: var(--minca-accent); box-shadow: none; }
|
|
181
|
-
minca-auth .wa-steps { margin: 0 0 20px; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--minca-body); }
|
|
182
|
-
|
|
183
|
-
minca-auth .wa-info { position: relative; display: inline; }
|
|
184
|
-
minca-auth .wa-info-button {
|
|
185
|
-
display: inline-flex; align-items: center; justify-content: center;
|
|
186
|
-
width: 16px; height: 16px; padding: 0; margin-left: 6px; vertical-align: text-bottom;
|
|
187
|
-
border-radius: 999px; border: 1px solid var(--minca-line-strong); background: none;
|
|
188
|
-
color: var(--minca-faint); font-size: 10px; font-weight: 700; line-height: 1;
|
|
189
|
-
}
|
|
190
|
-
minca-auth .wa-popover {
|
|
191
|
-
position: absolute; z-index: 30; top: 22px; left: 0; width: min(260px, 80cqi);
|
|
192
|
-
padding: 12px 14px; border-radius: var(--minca-radius);
|
|
193
|
-
background: var(--minca-surface); border: 1px solid var(--minca-line);
|
|
194
|
-
box-shadow: 0 12px 28px -12px rgba(15, 17, 21, .22);
|
|
195
|
-
font-size: 12.5px; line-height: 1.6; color: var(--minca-muted); font-weight: 400;
|
|
196
|
-
}
|
|
197
|
-
minca-auth .wa-popover[hidden] { display: none; }
|
|
198
|
-
|
|
199
|
-
@container (max-width: 340px) {
|
|
200
|
-
minca-auth .wa-title { font-size: 24px; }
|
|
201
|
-
minca-auth .wa-subtitle { margin-bottom: 24px; }
|
|
202
|
-
minca-auth .wa-wordmark { margin-bottom: 28px; }
|
|
203
|
-
minca-auth .wa-popover { left: auto; right: -8px; }
|
|
204
|
-
}
|
|
205
|
-
`;
|
|
206
|
-
//# sourceMappingURL=auth-styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-styles.js","sourceRoot":"","sources":["../../src/elements/auth-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4LvB,CAAC"}
|
package/dist/elements/dom.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module elements/dom
|
|
3
|
-
* Just enough DOM building for the elements to stay readable without a
|
|
4
|
-
* framework: `h('button', { onclick }, 'Save')`.
|
|
5
|
-
*/
|
|
6
|
-
export type Child = Node | string | number | false | null | undefined | ReadonlyArray<Child>;
|
|
7
|
-
type Props = Record<string, unknown> & {
|
|
8
|
-
class?: string;
|
|
9
|
-
style?: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Makes an element. Props starting with `on` become listeners, `class` and
|
|
13
|
-
* `style` are set as attributes, booleans toggle attributes, anything else is
|
|
14
|
-
* set as a property when the element has one and an attribute otherwise.
|
|
15
|
-
*/
|
|
16
|
-
export declare function h<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Props | null, ...children: Child[]): HTMLElementTagNameMap[K];
|
|
17
|
-
export declare function h(tag: string, props?: Props | null, ...children: Child[]): HTMLElement;
|
|
18
|
-
/** Markup from trusted, constant strings — an icon, never anything a person typed. */
|
|
19
|
-
export declare function svg(markup: string): Element;
|
|
20
|
-
/**
|
|
21
|
-
* Adds a stylesheet to the document once, by id.
|
|
22
|
-
*
|
|
23
|
-
* A constructed stylesheet where the browser has them — it needs no inline
|
|
24
|
-
* `<style>`, so a strict Content-Security-Policy is no obstacle — and a style
|
|
25
|
-
* element otherwise.
|
|
26
|
-
*/
|
|
27
|
-
export declare function adoptStyles(id: string, css: string): void;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/elements/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE7F,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAK1E;;;;GAIG;AACH,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACrD,GAAG,EAAE,CAAC,EACN,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,GAAG,QAAQ,EAAE,KAAK,EAAE,GACnB,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAC5B,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;AAwCxF,sFAAsF;AACtF,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI3C;AAWD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAoBzD"}
|
package/dist/elements/dom.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module elements/dom
|
|
3
|
-
* Just enough DOM building for the elements to stay readable without a
|
|
4
|
-
* framework: `h('button', { onclick }, 'Save')`.
|
|
5
|
-
*/
|
|
6
|
-
/** Always set as attributes: their properties want other types, or do not exist on every element */
|
|
7
|
-
const ATTRIBUTES = new Set(['class', 'style', 'role', 'spellcheck', 'autocomplete', 'tabindex', 'for']);
|
|
8
|
-
export function h(tag, props = null, ...children) {
|
|
9
|
-
const element = globalThis.document.createElement(tag);
|
|
10
|
-
for (const [name, value] of Object.entries(props ?? {})) {
|
|
11
|
-
if (value === undefined || value === null || value === false)
|
|
12
|
-
continue;
|
|
13
|
-
if (name.startsWith('on') && typeof value === 'function') {
|
|
14
|
-
element.addEventListener(name.slice(2), (event) => {
|
|
15
|
-
Reflect.apply(value, element, [event]);
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
else if (value === true) {
|
|
19
|
-
element.setAttribute(name, '');
|
|
20
|
-
}
|
|
21
|
-
else if (ATTRIBUTES.has(name) ||
|
|
22
|
-
name.startsWith('data-') ||
|
|
23
|
-
name.startsWith('aria-') ||
|
|
24
|
-
!(name in element)) {
|
|
25
|
-
// What setAttribute would make of it anyway; props hold text and numbers.
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-base-to-string -- the DOM's own conversion
|
|
27
|
-
element.setAttribute(name, String(value));
|
|
28
|
-
}
|
|
29
|
-
else if (!Reflect.set(element, name, value)) {
|
|
30
|
-
throw new TypeError(`Cannot set ${name} on <${tag}>`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
append(element, children);
|
|
34
|
-
return element;
|
|
35
|
-
}
|
|
36
|
-
// Array.isArray does not narrow a readonly array out of a union.
|
|
37
|
-
const isChildList = (child) => Array.isArray(child);
|
|
38
|
-
function append(parent, children) {
|
|
39
|
-
for (const child of children) {
|
|
40
|
-
if (child === null || child === undefined || child === false)
|
|
41
|
-
continue;
|
|
42
|
-
if (isChildList(child))
|
|
43
|
-
append(parent, child);
|
|
44
|
-
else if (typeof child === 'object')
|
|
45
|
-
parent.appendChild(child);
|
|
46
|
-
else
|
|
47
|
-
parent.appendChild(globalThis.document.createTextNode(String(child)));
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/** Markup from trusted, constant strings — an icon, never anything a person typed. */
|
|
51
|
-
export function svg(markup) {
|
|
52
|
-
const template = globalThis.document.createElement('template');
|
|
53
|
-
template.innerHTML = markup.trim();
|
|
54
|
-
return template.content.firstElementChild;
|
|
55
|
-
}
|
|
56
|
-
/** Kept on the document itself, so two copies of this library on one page still add each sheet once */
|
|
57
|
-
function adoptedIds(doc) {
|
|
58
|
-
const found = Reflect.get(doc, '__mincaStyles');
|
|
59
|
-
if (found instanceof Set)
|
|
60
|
-
return found;
|
|
61
|
-
const ids = new Set();
|
|
62
|
-
Reflect.set(doc, '__mincaStyles', ids);
|
|
63
|
-
return ids;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Adds a stylesheet to the document once, by id.
|
|
67
|
-
*
|
|
68
|
-
* A constructed stylesheet where the browser has them — it needs no inline
|
|
69
|
-
* `<style>`, so a strict Content-Security-Policy is no obstacle — and a style
|
|
70
|
-
* element otherwise.
|
|
71
|
-
*/
|
|
72
|
-
export function adoptStyles(id, css) {
|
|
73
|
-
const doc = globalThis.document;
|
|
74
|
-
const adopted = adoptedIds(doc);
|
|
75
|
-
if (adopted.has(id))
|
|
76
|
-
return;
|
|
77
|
-
adopted.add(id);
|
|
78
|
-
if ('adoptedStyleSheets' in doc &&
|
|
79
|
-
typeof CSSStyleSheet === 'function' &&
|
|
80
|
-
'replaceSync' in CSSStyleSheet.prototype) {
|
|
81
|
-
const sheet = new CSSStyleSheet();
|
|
82
|
-
sheet.replaceSync(css);
|
|
83
|
-
doc.adoptedStyleSheets = [...doc.adoptedStyleSheets, sheet];
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
const style = doc.createElement('style');
|
|
87
|
-
style.id = id;
|
|
88
|
-
style.textContent = css;
|
|
89
|
-
doc.head.appendChild(style);
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=dom.js.map
|
package/dist/elements/dom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../src/elements/dom.ts"],"names":[],"mappings":"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"}
|
package/dist/elements/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module elements
|
|
3
|
-
* Web components for Minca, usable from any framework or none. Importing this
|
|
4
|
-
* registers them.
|
|
5
|
-
*
|
|
6
|
-
* - `<minca-auth>` — the sign-in flow: where the data lives, which account,
|
|
7
|
-
* the ways into it. Fires `minca-session` when someone signs in or out.
|
|
8
|
-
*/
|
|
9
|
-
export { MincaAuthElement, defineMincaAuth } from './minca-auth.js';
|
|
10
|
-
export type { MincaSessionEventDetail } from './minca-auth.js';
|
|
11
|
-
export { createMincaAuth } from '../session/auth.js';
|
|
12
|
-
export type { MincaAuth, MincaAuthConfig, AuthState, MincaSession } from '../session/auth.js';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|