@tik-choco/mistvault 0.2.0 → 0.3.1
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.ja.md +41 -1
- package/README.md +43 -1
- package/README.zh.md +41 -1
- package/dist/elements/PanelElement.d.ts +30 -0
- package/dist/elements/PanelElement.js +56 -0
- package/dist/elements/RoomControls.d.ts +21 -0
- package/dist/elements/RoomControls.js +27 -0
- package/dist/elements/ScopeVaultPanelElement.d.ts +10 -0
- package/dist/elements/ScopeVaultPanelElement.js +27 -0
- package/dist/elements/VaultPanelElement.d.ts +39 -0
- package/dist/elements/VaultPanelElement.js +191 -0
- package/dist/elements/dom.d.ts +14 -0
- package/dist/elements/dom.js +58 -0
- package/dist/elements/index.d.ts +15 -0
- package/dist/elements/index.js +12 -0
- package/dist/preact/ScopeVaultPanel.d.ts +5 -1
- package/dist/preact/ScopeVaultPanel.js +6 -18
- package/dist/preact/VaultPanel.d.ts +5 -1
- package/dist/preact/VaultPanel.js +11 -108
- package/dist/preact/ui.css +29 -28
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/memory.d.ts +27 -0
- package/dist/testing/memory.js +110 -0
- package/package.json +17 -4
- package/dist/preact/RoomControls.d.ts +0 -13
- package/dist/preact/RoomControls.js +0 -12
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function flatten(values) {
|
|
2
|
+
return values.flatMap(value => Array.isArray(value) ? flatten(value) : value === false || value == null ? [] : [value]);
|
|
3
|
+
}
|
|
4
|
+
function children(parent, values) {
|
|
5
|
+
const next = flatten(values).map((value, i) => {
|
|
6
|
+
if (typeof value !== 'string')
|
|
7
|
+
return value;
|
|
8
|
+
const old = parent.childNodes[i];
|
|
9
|
+
if (old?.nodeType === 3) {
|
|
10
|
+
if (old.nodeValue !== value)
|
|
11
|
+
old.nodeValue = value;
|
|
12
|
+
return old;
|
|
13
|
+
}
|
|
14
|
+
return parent.ownerDocument.createTextNode(value);
|
|
15
|
+
});
|
|
16
|
+
const wanted = new Set(next);
|
|
17
|
+
for (const child of Array.from(parent.childNodes))
|
|
18
|
+
if (!wanted.has(child))
|
|
19
|
+
parent.removeChild(child);
|
|
20
|
+
let cursor = parent.firstChild;
|
|
21
|
+
for (const child of next) {
|
|
22
|
+
if (child !== cursor)
|
|
23
|
+
parent.insertBefore(child, cursor);
|
|
24
|
+
cursor = child.nextSibling;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class Dom {
|
|
28
|
+
host;
|
|
29
|
+
nodes = new Map();
|
|
30
|
+
used = new Set();
|
|
31
|
+
constructor(host) {
|
|
32
|
+
this.host = host;
|
|
33
|
+
}
|
|
34
|
+
node = (key, tag, props, ...content) => {
|
|
35
|
+
let node = this.nodes.get(key);
|
|
36
|
+
if (!node) {
|
|
37
|
+
node = this.host.ownerDocument.createElement(tag);
|
|
38
|
+
this.nodes.set(key, node);
|
|
39
|
+
}
|
|
40
|
+
this.used.add(key);
|
|
41
|
+
children(node, content);
|
|
42
|
+
for (const [name, value] of Object.entries(props.attrs ?? {}))
|
|
43
|
+
if (node.getAttribute(name) !== value)
|
|
44
|
+
node.setAttribute(name, value);
|
|
45
|
+
for (const [name, value] of Object.entries(props))
|
|
46
|
+
if (name !== 'attrs' && Reflect.get(node, name) !== value)
|
|
47
|
+
Reflect.set(node, name, value);
|
|
48
|
+
return node;
|
|
49
|
+
};
|
|
50
|
+
finish(...content) {
|
|
51
|
+
children(this.host, content);
|
|
52
|
+
for (const key of this.nodes.keys())
|
|
53
|
+
if (!this.used.has(key))
|
|
54
|
+
this.nodes.delete(key);
|
|
55
|
+
this.used.clear();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export const selectInput = (e) => e.currentTarget.select();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VaultPanelElement } from './VaultPanelElement.js';
|
|
2
|
+
import { ScopeVaultPanelElement } from './ScopeVaultPanelElement.js';
|
|
3
|
+
import type { PendingHandledResult } from './VaultPanelElement.js';
|
|
4
|
+
export { VaultPanelElement, ScopeVaultPanelElement };
|
|
5
|
+
export type { PendingHandledResult };
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
'mistvault-panel': VaultPanelElement;
|
|
9
|
+
'mistvault-scope-panel': ScopeVaultPanelElement;
|
|
10
|
+
}
|
|
11
|
+
interface HTMLElementEventMap {
|
|
12
|
+
'mistvault-pending-handled': CustomEvent<PendingHandledResult>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare function defineMistvaultElements(): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VaultPanelElement } from './VaultPanelElement.js';
|
|
2
|
+
import { ScopeVaultPanelElement } from './ScopeVaultPanelElement.js';
|
|
3
|
+
export { VaultPanelElement, ScopeVaultPanelElement };
|
|
4
|
+
export function defineMistvaultElements() {
|
|
5
|
+
if (typeof customElements === 'undefined' || typeof HTMLElement === 'undefined')
|
|
6
|
+
return;
|
|
7
|
+
if (!customElements.get('mistvault-panel'))
|
|
8
|
+
customElements.define('mistvault-panel', VaultPanelElement);
|
|
9
|
+
if (!customElements.get('mistvault-scope-panel'))
|
|
10
|
+
customElements.define('mistvault-scope-panel', ScopeVaultPanelElement);
|
|
11
|
+
}
|
|
12
|
+
defineMistvaultElements();
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ScopeVault } from '../scopeVault.js';
|
|
2
|
+
import type { ScopeVaultPanelElement } from '../elements/index.js';
|
|
3
|
+
import '../elements/index.js';
|
|
2
4
|
export interface ScopeVaultPanelProps {
|
|
3
5
|
vault: ScopeVault;
|
|
4
6
|
locale?: string;
|
|
5
7
|
}
|
|
6
|
-
export declare function ScopeVaultPanel({ vault, locale }: ScopeVaultPanelProps): import("preact").
|
|
8
|
+
export declare function ScopeVaultPanel({ vault, locale }: ScopeVaultPanelProps): import("preact").VNode<import("preact").Attributes & {
|
|
9
|
+
ref: import("preact").RefObject<ScopeVaultPanelElement>;
|
|
10
|
+
}>;
|
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { RoomControls } from './RoomControls.js';
|
|
5
|
-
import { useVaultView } from './useVault.js';
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { useLayoutEffect, useRef } from 'preact/hooks';
|
|
3
|
+
import '../elements/index.js';
|
|
6
4
|
export function ScopeVaultPanel({ vault, locale }) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
async function copyRoom() {
|
|
11
|
-
try {
|
|
12
|
-
await navigator.clipboard.writeText(view.room);
|
|
13
|
-
setNotice(t('copied'));
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
setNotice(t('copyError'));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return _jsxs("section", { class: "mv-panel mv-stack", "aria-label": t('title'), children: [_jsx("h2", { children: t('title') }), _jsxs("div", { class: "mv-status-card", children: [_jsxs("div", { class: "mv-status-text", role: "status", "data-state": view.status, children: [_jsx("strong", { children: t(`status_${view.status}`) }), view.error && _jsx("span", { class: "mv-error", children: view.error })] }), _jsxs("div", { class: "mv-actions", children: [_jsx("button", { type: "button", disabled: busy, onClick: () => { void vault.saveNow(); }, children: t('save') }), _jsx("button", { type: "button", disabled: busy, onClick: () => { void vault.restoreNow(); }, children: t('restore') })] })] }), _jsx("div", { class: "mv-stack", children: _jsx(RoomControls, { locale: locale, mode: view.mode, room: view.config.room, controller: vault, disableUnchanged: !!view.config.by, onInvalid: () => setNotice(t('invalidRoom')) }) }), view.mode !== 'off' && _jsxs("div", { class: "mv-room", children: [_jsxs("div", { class: "mv-room-row", children: [_jsxs("label", { children: [t('room'), _jsx("input", { readOnly: true, value: view.room, placeholder: t('roomPending'), onFocus: e => e.currentTarget.select() })] }), _jsx("button", { type: "button", disabled: !view.room, onClick: () => { void copyRoom(); }, children: t('copy') })] }), _jsx("p", { class: "mv-muted mv-hint", children: t('scopeRoomHint') })] }), notice && _jsx("p", { class: "mv-notice", role: "status", children: notice })] });
|
|
5
|
+
const ref = useRef(null);
|
|
6
|
+
useLayoutEffect(() => { Object.assign(ref.current, { locale, vault }); });
|
|
7
|
+
return h('mistvault-scope-panel', { ref });
|
|
20
8
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { VaultController } from '../controller.js';
|
|
2
|
+
import type { VaultPanelElement } from '../elements/index.js';
|
|
3
|
+
import '../elements/index.js';
|
|
2
4
|
export interface VaultPanelProps {
|
|
3
5
|
controller: VaultController;
|
|
4
6
|
locale?: string;
|
|
@@ -9,4 +11,6 @@ export interface VaultPanelProps {
|
|
|
9
11
|
/** Called after a supplied pending code is imported or dismissed. Clear pendingCode in the caller. */
|
|
10
12
|
onPendingHandled?: (result: 'imported' | 'cancelled') => void;
|
|
11
13
|
}
|
|
12
|
-
export declare function VaultPanel({ controller, locale, appName, pendingCode, onPendingHandled, extraRooms }: VaultPanelProps): import("preact").
|
|
14
|
+
export declare function VaultPanel({ controller, locale, appName, pendingCode, onPendingHandled, extraRooms }: VaultPanelProps): import("preact").VNode<import("preact").Attributes & {
|
|
15
|
+
ref: import("preact").RefObject<VaultPanelElement>;
|
|
16
|
+
}>;
|
|
@@ -1,111 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { consumeVaultLink, parseVaultCode, vaultLink } from '../code.js';
|
|
5
|
-
import { vaultMessage } from '../i18n.js';
|
|
6
|
-
import { useVault } from './useVault.js';
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { useLayoutEffect, useRef } from 'preact/hooks';
|
|
3
|
+
import '../elements/index.js';
|
|
7
4
|
export function VaultPanel({ controller, locale, appName, pendingCode, onPendingHandled, extraRooms }) {
|
|
8
|
-
const
|
|
9
|
-
const t = (key, values) => vaultMessage(locale, key, values);
|
|
10
|
-
const additional = [...new Set(extraRooms)].filter(room => room && room !== view.room);
|
|
11
|
-
const [visible, setVisible] = useState(false), [input, setInput] = useState('');
|
|
12
|
-
const [importing, setImporting] = useState(false), [inputError, setInputError] = useState('');
|
|
13
|
-
const [propPending, setPropPending] = useState(pendingCode || null);
|
|
14
|
-
const [localPending, setLocalPending] = useState(() => {
|
|
15
|
-
try {
|
|
16
|
-
return typeof window === 'undefined' ? null : consumeVaultLink();
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const [confirmError, setConfirmError] = useState('');
|
|
23
|
-
const [notice, setNotice] = useState(''), [time, setTime] = useState(Date.now());
|
|
24
|
-
const confirmRef = useRef(null), importRef = useRef(null);
|
|
25
|
-
const importButtonRef = useRef(null), titleRef = useRef(null);
|
|
26
|
-
const pending = propPending ?? localPending;
|
|
27
|
-
const parsedPending = pending === null ? null : parseVaultCode(pending);
|
|
28
|
-
useLayoutEffect(() => { setPropPending(pendingCode || null); }, [pendingCode]);
|
|
5
|
+
const ref = useRef(null);
|
|
29
6
|
useLayoutEffect(() => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
useLayoutEffect(() => { setImporting(false); setInput(''); setInputError(''); setNotice(''); }, [view.mode, controller]);
|
|
38
|
-
useEffect(() => { const timer = setInterval(() => setTime(Date.now()), 60000); return () => clearInterval(timer); }, []);
|
|
39
|
-
const copy = async (value) => {
|
|
40
|
-
try {
|
|
41
|
-
await navigator.clipboard.writeText(value);
|
|
42
|
-
setNotice(t('copied'));
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
setNotice(t('copyError'));
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const closeImport = () => {
|
|
49
|
-
setImporting(false);
|
|
50
|
-
setInput('');
|
|
51
|
-
setInputError('');
|
|
52
|
-
importButtonRef.current?.focus();
|
|
53
|
-
};
|
|
54
|
-
const prepareImport = () => {
|
|
55
|
-
const code = parseVaultCode(input);
|
|
56
|
-
if (!code) {
|
|
57
|
-
setInputError(t('invalidCode'));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
setInputError('');
|
|
61
|
-
setNotice('');
|
|
62
|
-
setLocalPending(code);
|
|
63
|
-
};
|
|
64
|
-
const finishPending = (result) => {
|
|
65
|
-
if (propPending !== null) {
|
|
66
|
-
setPropPending(null);
|
|
67
|
-
onPendingHandled?.(result);
|
|
68
|
-
}
|
|
69
|
-
else
|
|
70
|
-
setLocalPending(null);
|
|
71
|
-
setInput('');
|
|
72
|
-
setInputError('');
|
|
73
|
-
setImporting(false);
|
|
74
|
-
setVisible(false);
|
|
75
|
-
setConfirmError('');
|
|
76
|
-
requestAnimationFrame(() => {
|
|
77
|
-
if (confirmRef.current)
|
|
78
|
-
return;
|
|
79
|
-
const button = importButtonRef.current;
|
|
80
|
-
if (button?.isConnected && !button.closest('details:not([open])'))
|
|
81
|
-
button.focus();
|
|
82
|
-
else
|
|
83
|
-
titleRef.current?.focus();
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
const confirmImport = () => {
|
|
87
|
-
if (!parsedPending || !controller.importCode(parsedPending)) {
|
|
88
|
-
setConfirmError(t('importError'));
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
if (view.mode === 'off')
|
|
92
|
-
controller.enable();
|
|
93
|
-
finishPending('imported');
|
|
94
|
-
};
|
|
95
|
-
const importForm = importing && _jsxs("div", { class: "mv-import", children: [_jsxs("label", { children: [t('importLabel'), _jsx("input", { ref: importRef, type: "password", value: input, autoComplete: "off", "aria-invalid": !!inputError, onInput: e => { setInput(e.currentTarget.value); setInputError(''); }, onKeyDown: e => { if (e.key === 'Enter') {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
prepareImport();
|
|
98
|
-
}
|
|
99
|
-
else if (e.key === 'Escape')
|
|
100
|
-
closeImport(); } })] }), inputError && _jsx("p", { class: "mv-error", role: "alert", children: inputError }), _jsxs("div", { class: "mv-actions", children: [_jsx("button", { type: "button", class: "mv-primary", onClick: prepareImport, children: t('import') }), _jsx("button", { type: "button", onClick: closeImport, children: t('cancel') })] })] });
|
|
101
|
-
const busy = view.status === 'saving' || view.status === 'restoring';
|
|
102
|
-
const enabled = view.appEnabled && view.hasCode;
|
|
103
|
-
const minutes = Math.max(0, Math.floor((Math.max(time, Date.now()) - view.savedAt) / 60000));
|
|
104
|
-
const savedTime = minutes < 1 ? t('savedNow') : minutes < 60 ? t('savedAgo', { minutes }) :
|
|
105
|
-
minutes < 1440 ? t('savedHoursAgo', { hours: Math.floor(minutes / 60) }) :
|
|
106
|
-
minutes < 2880 ? t('savedDayAgo') : t('savedDaysAgo', { days: Math.floor(minutes / 1440) });
|
|
107
|
-
return _jsxs("section", { class: "mv-panel", "aria-label": t('title'), children: [pending !== null && _jsxs("div", { ref: confirmRef, class: "mv-confirm", role: "group", "aria-label": t('pendingTitle') + ' ' + t(parsedPending ? 'confirmation' : 'invalidCode'), tabIndex: -1, children: [_jsx("h3", { children: t('pendingTitle') }), _jsx("p", { children: parsedPending ? t('confirmation') : t('invalidCode') }), confirmError && _jsx("p", { class: "mv-error", role: "alert", children: confirmError }), _jsxs("div", { class: "mv-actions", children: [parsedPending && _jsx("button", { type: "button", class: "mv-primary", onClick: confirmImport, children: t('confirm') }), _jsx("button", { type: "button", onClick: () => finishPending('cancelled'), children: t('cancel') })] })] }), _jsx("h2", { ref: titleRef, tabIndex: -1, children: t('title') }), view.mode === 'off' ? _jsxs("div", { class: "mv-welcome", children: [_jsx("p", { class: "mv-muted", children: t('explanation') }), _jsxs("div", { class: "mv-stack", children: [_jsx("button", { type: "button", class: "mv-primary", onClick: () => controller.enable(), children: t('turnOn') }), _jsx("button", { ref: importButtonRef, type: "button", "aria-expanded": importing, onClick: () => importing ? closeImport() : setImporting(true), children: t('useCode') })] }), importForm] }) : _jsxs(_Fragment, { children: [_jsxs("div", { class: "mv-status-card", children: [_jsxs("div", { class: "mv-status-text", role: "status", "aria-live": "polite", "data-state": !view.appEnabled ? 'off' : view.status, children: [_jsx("strong", { children: !view.appEnabled && view.status === 'off' ? t('status_appOff') : t(`status_${view.status}`) }), view.savedAt > 0 && _jsxs("span", { class: "mv-muted", children: [' ', savedTime] }), view.error && _jsxs("span", { class: "mv-error", children: [' ', view.error] })] }), _jsxs("div", { class: "mv-actions", children: [_jsx("button", { type: "button", disabled: !enabled || busy, onClick: () => { void controller.saveNow(); }, children: t('save') }), _jsx("button", { type: "button", disabled: !enabled || busy, onClick: () => { void controller.restoreNow(); }, children: t('restore') })] })] }), _jsxs("label", { class: "mv-switch", children: [_jsx("span", { children: t('app', { app: appName || t('appFallback') }) }), _jsx("input", { type: "checkbox", role: "switch", checked: view.appEnabled, onChange: e => controller.setAppEnabled(e.currentTarget.checked) })] }), _jsxs("div", { class: "mv-room", children: [_jsxs("div", { class: "mv-room-row", children: [_jsxs("label", { children: [t('room'), _jsx("input", { readOnly: true, value: view.room, placeholder: t(view.appEnabled ? 'roomPending' : 'roomUnavailable'), onFocus: e => e.currentTarget.select() })] }), _jsx("button", { type: "button", disabled: !view.room, onClick: () => { void copy(view.room); }, children: t('copy') })] }), _jsx("p", { class: "mv-muted mv-hint", children: t('hint') })] }), _jsxs("details", { class: "mv-disclosure", onToggle: e => { if (!e.currentTarget.open)
|
|
108
|
-
setVisible(false); }, children: [_jsx("summary", { children: t('code') }), _jsxs("div", { class: "mv-disclosure-body", children: [_jsx("p", { class: "mv-muted", children: t('codeHint') }), _jsx("input", { class: "mv-code", "aria-label": t('code'), readOnly: true, type: visible ? 'text' : 'password', value: visible ? controller.revealCode() ?? '' : view.hasCode ? '0000000000000000' : '', autoComplete: "off", onFocus: e => e.currentTarget.select() }), _jsxs("div", { class: "mv-actions", children: [_jsx("button", { type: "button", disabled: !view.hasCode, onClick: () => setVisible(!visible), children: t(visible ? 'hide' : 'reveal') }), _jsx("button", { type: "button", disabled: !view.hasCode, onClick: () => { const code = controller.revealCode(); if (code)
|
|
109
|
-
void copy(code); }, children: t('copy') })] }), _jsxs("div", { class: "mv-stack", children: [_jsx("button", { type: "button", disabled: !view.hasCode, onClick: () => { const code = controller.revealCode(); if (code)
|
|
110
|
-
void copy(vaultLink(window.location.href, code)); }, children: t('link') }), _jsx("button", { ref: importButtonRef, type: "button", "aria-expanded": importing, onClick: () => importing ? closeImport() : setImporting(true), children: t('importAnother') })] }), importForm] })] }), _jsxs("details", { class: "mv-disclosure", children: [_jsx("summary", { children: t('advanced') }), _jsx("div", { class: "mv-disclosure-body", children: _jsx(RoomControls, { locale: locale, mode: view.mode, room: view.room, controller: controller, onInvalid: () => setNotice(t('invalid')) }) })] }), view.hasParts && _jsx("p", { class: "mv-parts mv-muted", children: t('parts', view.parts) })] }), additional.length > 0 && _jsxs("div", { class: "mv-stack", children: [_jsx("h3", { children: t('extraRooms') }), _jsx("ul", { children: additional.map(room => _jsx("li", { children: room }, room)) }), _jsx("button", { type: "button", onClick: () => { void copy(additional.join('\n')); }, children: t('copyAll') })] }), notice && _jsx("p", { class: "mv-notice", role: "status", children: notice })] });
|
|
7
|
+
const panel = ref.current;
|
|
8
|
+
const handled = (e) => onPendingHandled?.(e.detail);
|
|
9
|
+
panel.addEventListener('mistvault-pending-handled', handled);
|
|
10
|
+
Object.assign(panel, { locale, appName, pendingCode, extraRooms, controller });
|
|
11
|
+
return () => panel.removeEventListener('mistvault-pending-handled', handled);
|
|
12
|
+
});
|
|
13
|
+
return h('mistvault-panel', { ref });
|
|
111
14
|
}
|
package/dist/preact/ui.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
mistvault-panel, mistvault-scope-panel { display: block; }
|
|
1
2
|
.mv-panel {
|
|
2
|
-
color: var(--mv-fg, inherit);
|
|
3
|
-
background: var(--mv-bg, transparent);
|
|
3
|
+
color: var(--mv-fg, var(--mist-fg, inherit));
|
|
4
|
+
background: var(--mv-bg, var(--mist-bg, transparent));
|
|
4
5
|
font: inherit;
|
|
5
6
|
line-height: 1.5;
|
|
6
7
|
max-width: 44rem;
|
|
@@ -11,47 +12,47 @@
|
|
|
11
12
|
.mv-panel h2 { font-size: 1.3em; line-height: 1.25; margin: 0 0 1rem; }
|
|
12
13
|
.mv-panel h3 { font-size: 1em; line-height: 1.3; margin: 0; }
|
|
13
14
|
.mv-panel p { margin: 0; overflow-wrap: anywhere; }
|
|
14
|
-
.mv-panel .mv-muted { color: var(--mv-muted, #6d7772); font-size: .9em; }
|
|
15
|
+
.mv-panel .mv-muted { color: var(--mv-muted, var(--mist-muted, #6d7772)); font-size: .9em; }
|
|
15
16
|
.mv-panel label { display: block; font-weight: 600; }
|
|
16
17
|
.mv-panel input:not([type=checkbox]), .mv-panel select {
|
|
17
18
|
display: block;
|
|
18
19
|
min-width: 0;
|
|
19
20
|
width: 100%;
|
|
20
21
|
padding: .65rem .7rem;
|
|
21
|
-
border: 1px solid var(--mv-border, rgba(127, 127, 127, .35));
|
|
22
|
+
border: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .35)));
|
|
22
23
|
border-radius: .5rem;
|
|
23
24
|
color: inherit;
|
|
24
|
-
background: var(--mv-bg, transparent);
|
|
25
|
+
background: var(--mv-bg, var(--mist-bg, transparent));
|
|
25
26
|
font: inherit;
|
|
26
27
|
font-weight: 400;
|
|
27
28
|
}
|
|
28
|
-
.mv-panel input::placeholder { color: var(--mv-muted, #6d7772); opacity: 1; }
|
|
29
|
+
.mv-panel input::placeholder { color: var(--mv-muted, var(--mist-muted, #6d7772)); opacity: 1; }
|
|
29
30
|
.mv-panel button {
|
|
30
31
|
min-height: 2.75rem;
|
|
31
32
|
padding: .6rem .8rem;
|
|
32
|
-
border: 1px solid var(--mv-border, rgba(127, 127, 127, .35));
|
|
33
|
+
border: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .35)));
|
|
33
34
|
border-radius: .5rem;
|
|
34
35
|
color: inherit;
|
|
35
|
-
background: var(--mv-bg, transparent);
|
|
36
|
+
background: var(--mv-bg, var(--mist-bg, transparent));
|
|
36
37
|
font: inherit;
|
|
37
38
|
font-weight: 600;
|
|
38
39
|
line-height: 1.3;
|
|
39
40
|
cursor: pointer;
|
|
40
41
|
overflow-wrap: anywhere;
|
|
41
42
|
}
|
|
42
|
-
.mv-panel button:hover:not(:disabled) { border-color: var(--mv-accent, #315fbd); }
|
|
43
|
-
.mv-panel button.mv-primary { color: var(--mv-bg, #fff); background: var(--mv-accent, #315fbd); border-color: var(--mv-accent, #315fbd); }
|
|
43
|
+
.mv-panel button:hover:not(:disabled) { border-color: var(--mv-accent, var(--mist-accent, #315fbd)); }
|
|
44
|
+
.mv-panel button.mv-primary { color: var(--mv-bg, var(--mist-bg, #fff)); background: var(--mv-accent, var(--mist-accent, #315fbd)); border-color: var(--mv-accent, var(--mist-accent, #315fbd)); }
|
|
44
45
|
.mv-panel button:disabled { opacity: .5; cursor: default; }
|
|
45
|
-
.mv-panel :focus-visible { outline: 2px solid var(--mv-accent, #315fbd); outline-offset: 3px; }
|
|
46
|
+
.mv-panel :focus-visible { outline: 2px solid var(--mv-accent, var(--mist-accent, #315fbd)); outline-offset: 3px; }
|
|
46
47
|
.mv-panel .mv-welcome > p { margin-bottom: 1.25rem; }
|
|
47
48
|
.mv-panel .mv-stack { display: grid; gap: .55rem; }
|
|
48
49
|
.mv-panel .mv-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
|
|
49
50
|
.mv-panel .mv-actions button { flex: 1 1 7rem; }
|
|
50
51
|
.mv-panel .mv-status-card, .mv-panel .mv-confirm {
|
|
51
52
|
padding: 1rem;
|
|
52
|
-
border: 1px solid var(--mv-border, rgba(127, 127, 127, .35));
|
|
53
|
+
border: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .35)));
|
|
53
54
|
border-radius: .75rem;
|
|
54
|
-
background: color-mix(in srgb, var(--mv-accent, #315fbd) 7%, transparent);
|
|
55
|
+
background: color-mix(in srgb, var(--mv-accent, var(--mist-accent, #315fbd)) 7%, transparent);
|
|
55
56
|
}
|
|
56
57
|
.mv-panel .mv-status-text { display: grid; gap: .15rem; margin-bottom: .85rem; }
|
|
57
58
|
.mv-panel .mv-status-text strong::before {
|
|
@@ -60,12 +61,12 @@
|
|
|
60
61
|
height: .55rem;
|
|
61
62
|
margin-inline-end: .5rem;
|
|
62
63
|
border-radius: 50%;
|
|
63
|
-
background: var(--mv-accent, #315fbd);
|
|
64
|
+
background: var(--mv-accent, var(--mist-accent, #315fbd));
|
|
64
65
|
content: '';
|
|
65
66
|
vertical-align: .05em;
|
|
66
67
|
}
|
|
67
|
-
.mv-panel .mv-status-text[data-state=off] strong::before { background: var(--mv-muted, #6d7772); }
|
|
68
|
-
.mv-panel .mv-status-text[data-state=error] strong::before { background: var(--mv-error, #b33b3b); }
|
|
68
|
+
.mv-panel .mv-status-text[data-state=off] strong::before { background: var(--mv-muted, var(--mist-muted, #6d7772)); }
|
|
69
|
+
.mv-panel .mv-status-text[data-state=error] strong::before { background: var(--mv-error, var(--mist-error, #b33b3b)); }
|
|
69
70
|
.mv-panel .mv-switch {
|
|
70
71
|
display: flex;
|
|
71
72
|
align-items: center;
|
|
@@ -81,9 +82,9 @@
|
|
|
81
82
|
width: 2.6rem;
|
|
82
83
|
height: 1.5rem;
|
|
83
84
|
margin: 0;
|
|
84
|
-
border: 1px solid var(--mv-border, rgba(127, 127, 127, .55));
|
|
85
|
+
border: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .55)));
|
|
85
86
|
border-radius: 1rem;
|
|
86
|
-
background: var(--mv-border, #9ca9a1);
|
|
87
|
+
background: var(--mv-border, var(--mist-border, #9ca9a1));
|
|
87
88
|
cursor: pointer;
|
|
88
89
|
}
|
|
89
90
|
.mv-panel .mv-switch input::before {
|
|
@@ -92,11 +93,11 @@
|
|
|
92
93
|
height: 1.1rem;
|
|
93
94
|
margin: .13rem;
|
|
94
95
|
border-radius: 50%;
|
|
95
|
-
background: var(--mv-bg, #fff);
|
|
96
|
+
background: var(--mv-bg, var(--mist-bg, #fff));
|
|
96
97
|
content: '';
|
|
97
98
|
transition: transform .15s ease;
|
|
98
99
|
}
|
|
99
|
-
.mv-panel .mv-switch input:checked { border-color: var(--mv-accent, #315fbd); background: var(--mv-accent, #315fbd); }
|
|
100
|
+
.mv-panel .mv-switch input:checked { border-color: var(--mv-accent, var(--mist-accent, #315fbd)); background: var(--mv-accent, var(--mist-accent, #315fbd)); }
|
|
100
101
|
.mv-panel .mv-switch input:checked::before { transform: translateX(1.1rem); }
|
|
101
102
|
.mv-panel .mv-room { padding-bottom: 1.1rem; }
|
|
102
103
|
.mv-panel .mv-room-row { display: flex; align-items: end; gap: .5rem; }
|
|
@@ -104,25 +105,25 @@
|
|
|
104
105
|
.mv-panel .mv-room-row input { margin-top: .4rem; }
|
|
105
106
|
.mv-panel .mv-room-row button { flex: 0 0 auto; }
|
|
106
107
|
.mv-panel .mv-hint { margin-top: .4rem; }
|
|
107
|
-
.mv-panel .mv-disclosure { min-width: 0; border-top: 1px solid var(--mv-border, rgba(127, 127, 127, .35)); }
|
|
108
|
-
.mv-panel .mv-disclosure:last-of-type { border-bottom: 1px solid var(--mv-border, rgba(127, 127, 127, .35)); }
|
|
108
|
+
.mv-panel .mv-disclosure { min-width: 0; border-top: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .35))); }
|
|
109
|
+
.mv-panel .mv-disclosure:last-of-type { border-bottom: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .35))); }
|
|
109
110
|
.mv-panel .mv-disclosure summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 0; font-weight: 600; cursor: pointer; list-style: none; }
|
|
110
111
|
.mv-panel .mv-disclosure summary::-webkit-details-marker { display: none; }
|
|
111
|
-
.mv-panel .mv-disclosure summary::after { color: var(--mv-muted, #6d7772); content: '+'; font-size: 1.3em; font-weight: 400; line-height: 1; }
|
|
112
|
+
.mv-panel .mv-disclosure summary::after { color: var(--mv-muted, var(--mist-muted, #6d7772)); content: '+'; font-size: 1.3em; font-weight: 400; line-height: 1; }
|
|
112
113
|
.mv-panel .mv-disclosure[open] summary::after { content: '−'; }
|
|
113
114
|
.mv-panel .mv-disclosure-body { display: grid; gap: .65rem; padding: 0 0 1rem; }
|
|
114
115
|
.mv-panel .mv-disclosure-body label, .mv-panel .mv-import label { display: grid; gap: .4rem; }
|
|
115
116
|
.mv-panel .mv-disclosure-body > button { justify-self: start; }
|
|
116
|
-
.mv-panel .mv-import { display: grid; gap: .55rem; margin-top: .8rem; padding-top: .9rem; border-top: 1px solid var(--mv-border, rgba(127, 127, 127, .35)); }
|
|
117
|
+
.mv-panel .mv-import { display: grid; gap: .55rem; margin-top: .8rem; padding-top: .9rem; border-top: 1px solid var(--mv-border, var(--mist-border, rgba(127, 127, 127, .35))); }
|
|
117
118
|
.mv-panel .mv-confirm { margin-bottom: 1.25rem; }
|
|
118
119
|
.mv-panel .mv-confirm p { margin: .55rem 0 .9rem; }
|
|
119
120
|
.mv-panel .mv-parts, .mv-panel .mv-notice { margin-top: .9rem; }
|
|
120
|
-
.mv-panel .mv-error { color: var(--mv-error, #b33b3b); font-size: .9em; }
|
|
121
|
+
.mv-panel .mv-error { color: var(--mv-error, var(--mist-error, #b33b3b)); font-size: .9em; }
|
|
121
122
|
@media (prefers-color-scheme: dark) {
|
|
122
123
|
.mv-panel { color-scheme: dark; }
|
|
123
|
-
.mv-panel .mv-muted, .mv-panel input::placeholder, .mv-panel .mv-disclosure summary::after { color: var(--mv-muted, #afbdb5); }
|
|
124
|
-
.mv-panel .mv-error { color: var(--mv-error, #ff9999); }
|
|
125
|
-
.mv-panel .mv-status-text[data-state=error] strong::before { background: var(--mv-error, #ff9999); }
|
|
124
|
+
.mv-panel .mv-muted, .mv-panel input::placeholder, .mv-panel .mv-disclosure summary::after { color: var(--mv-muted, var(--mist-muted, #afbdb5)); }
|
|
125
|
+
.mv-panel .mv-error { color: var(--mv-error, var(--mist-error, #ff9999)); }
|
|
126
|
+
.mv-panel .mv-status-text[data-state=error] strong::before { background: var(--mv-error, var(--mist-error, #ff9999)); }
|
|
126
127
|
}
|
|
127
128
|
@media (prefers-reduced-motion: reduce) { .mv-panel .mv-switch input::before { transition: none; } }
|
|
128
129
|
@media (forced-colors: active) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './memory.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './memory.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { EscrowTransport } from '../core/client.js';
|
|
2
|
+
import type { EscrowHead } from '../core/head.js';
|
|
3
|
+
import type { EscrowMessage, EscrowPut } from '../core/protocol.js';
|
|
4
|
+
export declare function memoryStorage(): Storage;
|
|
5
|
+
/** A protocol-level provider with real encrypted blobs, signatures and compare-and-swap. */
|
|
6
|
+
export declare class MemoryProvider implements EscrowTransport {
|
|
7
|
+
readonly heads: Map<string, EscrowHead>;
|
|
8
|
+
readonly tombstones: Map<string, EscrowHead>;
|
|
9
|
+
readonly blobs: Map<string, Uint8Array<ArrayBufferLike>>;
|
|
10
|
+
readonly requests: EscrowMessage[];
|
|
11
|
+
readonly messages: Map<string, Set<(from: string, bytes: Uint8Array) => void>>;
|
|
12
|
+
readonly peers: Map<string, Set<(id: string, joined: boolean) => void>>;
|
|
13
|
+
online: boolean;
|
|
14
|
+
quota: Set<string>;
|
|
15
|
+
beforePut?: (message: EscrowPut) => Promise<void>;
|
|
16
|
+
join: import("vitest").Mock<(_room: string) => Promise<void>>;
|
|
17
|
+
leave: import("vitest").Mock<(_room: string) => void>;
|
|
18
|
+
storageAdd: import("vitest").Mock<(_name: string, bytes: Uint8Array) => Promise<string>>;
|
|
19
|
+
storageGet: import("vitest").Mock<(cid: string) => Promise<Uint8Array<ArrayBufferLike>>>;
|
|
20
|
+
onMessage(room: string, cb: (from: string, bytes: Uint8Array) => void): () => void;
|
|
21
|
+
onPeer(room: string, cb: (id: string, joined: boolean) => void): () => void;
|
|
22
|
+
send(room: string, _to: string | null, bytes: Uint8Array): void;
|
|
23
|
+
failures: unknown[];
|
|
24
|
+
reply(room: string, message: EscrowMessage): void;
|
|
25
|
+
advertise(): void;
|
|
26
|
+
answer(room: string, m: EscrowMessage): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { headHash, verifyHead, deleteSigningPayload } from '../core/head.js';
|
|
3
|
+
import { fromBase64url } from '../core/crypto.js';
|
|
4
|
+
import { encodeEscrowMessage, parseEscrowMessage } from '../core/protocol.js';
|
|
5
|
+
export function memoryStorage() {
|
|
6
|
+
const values = new Map();
|
|
7
|
+
return { get length() { return values.size; }, clear: () => values.clear(), key: n => [...values.keys()][n] ?? null,
|
|
8
|
+
getItem: k => values.get(k) ?? null, removeItem: k => { values.delete(k); }, setItem: (k, v) => { values.set(k, v); } };
|
|
9
|
+
}
|
|
10
|
+
/** A protocol-level provider with real encrypted blobs, signatures and compare-and-swap. */
|
|
11
|
+
export class MemoryProvider {
|
|
12
|
+
heads = new Map();
|
|
13
|
+
tombstones = new Map();
|
|
14
|
+
blobs = new Map();
|
|
15
|
+
requests = [];
|
|
16
|
+
messages = new Map();
|
|
17
|
+
peers = new Map();
|
|
18
|
+
online = true;
|
|
19
|
+
quota = new Set();
|
|
20
|
+
beforePut;
|
|
21
|
+
join = vi.fn(async (_room) => { });
|
|
22
|
+
leave = vi.fn((_room) => { });
|
|
23
|
+
storageAdd = vi.fn(async (_name, bytes) => {
|
|
24
|
+
const cid = 'cid-' + this.blobs.size;
|
|
25
|
+
this.blobs.set(cid, new Uint8Array(bytes));
|
|
26
|
+
return cid;
|
|
27
|
+
});
|
|
28
|
+
storageGet = vi.fn(async (cid) => {
|
|
29
|
+
const bytes = this.blobs.get(cid);
|
|
30
|
+
if (!bytes)
|
|
31
|
+
throw new Error('Missing blob');
|
|
32
|
+
return bytes;
|
|
33
|
+
});
|
|
34
|
+
onMessage(room, cb) {
|
|
35
|
+
const set = this.messages.get(room) ?? new Set();
|
|
36
|
+
this.messages.set(room, set);
|
|
37
|
+
set.add(cb);
|
|
38
|
+
return () => { set.delete(cb); };
|
|
39
|
+
}
|
|
40
|
+
onPeer(room, cb) {
|
|
41
|
+
const set = this.peers.get(room) ?? new Set();
|
|
42
|
+
this.peers.set(room, set);
|
|
43
|
+
set.add(cb);
|
|
44
|
+
return () => { set.delete(cb); };
|
|
45
|
+
}
|
|
46
|
+
send(room, _to, bytes) {
|
|
47
|
+
const message = parseEscrowMessage(bytes);
|
|
48
|
+
if (!message)
|
|
49
|
+
throw new Error('Invalid request');
|
|
50
|
+
this.requests.push(message);
|
|
51
|
+
if (this.online)
|
|
52
|
+
void this.answer(room, message).catch(e => { this.failures.push(e); });
|
|
53
|
+
}
|
|
54
|
+
failures = [];
|
|
55
|
+
reply(room, message) { for (const cb of this.messages.get(room) ?? [])
|
|
56
|
+
cb('provider', encodeEscrowMessage(message)); }
|
|
57
|
+
advertise() { for (const room of this.messages.keys())
|
|
58
|
+
this.reply(room, { v: 1, type: 'escrow_provider', version: 1, maxBlob: 33554432, features: ['delete', 'delete-continue'] }); }
|
|
59
|
+
async answer(room, m) {
|
|
60
|
+
if (m.type === 'escrow_hello') {
|
|
61
|
+
this.advertise();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (m.type === 'escrow_get') {
|
|
65
|
+
this.reply(room, { v: 1, type: 'escrow_head', id: m.id, slot: m.slot, head: this.heads.get(m.slot) ?? null });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (m.type === 'escrow_put') {
|
|
69
|
+
await this.beforePut?.(m);
|
|
70
|
+
const h = m.head, old = this.heads.get(h.slot), tombstone = this.tombstones.get(h.slot);
|
|
71
|
+
if (!await verifyHead(h, { slot: h.slot, writer: h.writer }))
|
|
72
|
+
throw new Error('Invalid signature');
|
|
73
|
+
if (this.quota.has(h.slot)) {
|
|
74
|
+
this.reply(room, { v: 1, type: 'escrow_error', id: m.id, code: 'quota', message: 'Full' });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (!old && tombstone && (h.seq !== tombstone.seq + 1 || h.parent !== await headHash(tombstone))) {
|
|
78
|
+
this.reply(room, { v: 1, type: 'escrow_error', id: m.id, code: 'deleted', head: tombstone, message: 'Deleted' });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const hash = await headHash(h);
|
|
82
|
+
if (old && hash !== await headHash(old) && (h.writer !== old.writer || h.seq !== old.seq + 1 || h.parent !== await headHash(old)) || !old && !tombstone && h.parent !== null) {
|
|
83
|
+
this.reply(room, { v: 1, type: 'escrow_error', id: m.id, code: 'conflict', head: old ?? null, message: 'Changed' });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const blob = this.blobs.get(h.cid);
|
|
87
|
+
if (!blob || blob.length !== h.size)
|
|
88
|
+
throw new Error('Invalid blob');
|
|
89
|
+
this.heads.set(h.slot, h);
|
|
90
|
+
this.tombstones.delete(h.slot);
|
|
91
|
+
this.reply(room, { v: 1, type: 'escrow_ack', id: m.id, slot: h.slot, seq: h.seq, hash });
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (m.type === 'escrow_delete') {
|
|
95
|
+
const old = this.heads.get(m.slot);
|
|
96
|
+
if (old) {
|
|
97
|
+
const key = await crypto.subtle.importKey('raw', fromBase64url(old.writer), 'Ed25519', false, ['verify']);
|
|
98
|
+
if (!await crypto.subtle.verify('Ed25519', key, fromBase64url(m.sig), deleteSigningPayload(m)))
|
|
99
|
+
throw new Error('Invalid delete signature');
|
|
100
|
+
if (old.seq !== m.seq || await headHash(old) !== m.head) {
|
|
101
|
+
this.reply(room, { v: 1, type: 'escrow_error', id: m.id, code: 'conflict', head: old, message: 'Changed' });
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.heads.delete(m.slot);
|
|
105
|
+
this.tombstones.set(m.slot, old);
|
|
106
|
+
}
|
|
107
|
+
this.reply(room, { v: 1, type: 'escrow_deleted', id: m.id, slot: m.slot });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tik-choco/mistvault",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Browser-encrypted distributed vaults with portable transport and optional
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Browser-encrypted distributed vaults with portable transport and optional framework-independent Web Components UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
"types": "./dist/preact/index.d.ts",
|
|
20
20
|
"default": "./dist/preact/index.js"
|
|
21
21
|
},
|
|
22
|
+
"./elements": {
|
|
23
|
+
"types": "./dist/elements/index.d.ts",
|
|
24
|
+
"default": "./dist/elements/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./testing": {
|
|
27
|
+
"types": "./dist/testing/index.d.ts",
|
|
28
|
+
"default": "./dist/testing/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./elements.css": "./dist/preact/ui.css",
|
|
22
31
|
"./ui.css": "./dist/preact/ui.css"
|
|
23
32
|
},
|
|
24
33
|
"files": [
|
|
@@ -34,18 +43,22 @@
|
|
|
34
43
|
"prepare": "npm run build"
|
|
35
44
|
},
|
|
36
45
|
"devDependencies": {
|
|
37
|
-
"@tik-choco/mistai": "
|
|
46
|
+
"@tik-choco/mistai": "^0.10.5",
|
|
38
47
|
"happy-dom": "^21.0.4",
|
|
39
48
|
"preact": "^10.29.1",
|
|
40
49
|
"typescript": "~6.0.2",
|
|
41
50
|
"vitest": "^4.0.0"
|
|
42
51
|
},
|
|
43
52
|
"peerDependencies": {
|
|
44
|
-
"preact": "^10.0.0"
|
|
53
|
+
"preact": "^10.0.0",
|
|
54
|
+
"vitest": ">=1"
|
|
45
55
|
},
|
|
46
56
|
"peerDependenciesMeta": {
|
|
47
57
|
"preact": {
|
|
48
58
|
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"vitest": {
|
|
61
|
+
"optional": true
|
|
49
62
|
}
|
|
50
63
|
},
|
|
51
64
|
"publishConfig": {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { VaultMode } from '../settings.js';
|
|
2
|
-
interface RoomControlsProps {
|
|
3
|
-
locale?: string;
|
|
4
|
-
mode: VaultMode;
|
|
5
|
-
room: string;
|
|
6
|
-
controller: {
|
|
7
|
-
configure(mode: VaultMode, room: string): boolean;
|
|
8
|
-
};
|
|
9
|
-
disableUnchanged?: boolean;
|
|
10
|
-
onInvalid(): void;
|
|
11
|
-
}
|
|
12
|
-
export declare function RoomControls(props: RoomControlsProps): import("preact").JSX.Element;
|
|
13
|
-
export {};
|