@peers-app/peers-ui 0.33.21 → 0.33.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/command-palette/command-palette.js +3 -43
- package/dist/components/markdown-editor/autolink-plugin.d.ts +5 -1
- package/dist/components/markdown-editor/autolink-plugin.js +5 -8
- package/dist/components/markdown-editor/blocks.d.ts +83 -0
- package/dist/components/markdown-editor/blocks.js +201 -0
- package/dist/components/markdown-editor/code-plugin.d.ts +21 -0
- package/dist/components/markdown-editor/code-plugin.js +109 -0
- package/dist/components/markdown-editor/editor.d.ts +12 -5
- package/dist/components/markdown-editor/editor.js +27 -6
- package/dist/components/markdown-editor/link-plugin.d.ts +41 -0
- package/dist/components/markdown-editor/link-plugin.js +334 -0
- package/dist/components/markdown-editor/markdown-plugin.d.ts +23 -6
- package/dist/components/markdown-editor/markdown-plugin.js +94 -9
- package/dist/components/markdown-editor/mentions-plugin.d.ts +25 -0
- package/dist/components/markdown-editor/mentions-plugin.js +47 -22
- package/dist/components/markdown-editor/theme.d.ts +35 -0
- package/dist/components/markdown-editor/theme.js +36 -0
- package/dist/components/markdown-editor/toolbar.d.ts +11 -0
- package/dist/components/markdown-editor/toolbar.js +16 -5
- package/dist/components/qr-scanner.js +2 -34
- package/dist/theme.css +225 -4
- package/dist/ui-router/routes-loader.js +6 -9
- package/dist/ui-router/runnable-version.d.ts +9 -0
- package/dist/ui-router/runnable-version.js +20 -0
- package/dist/ui-router/ui-loader.js +2 -9
- package/package.json +10 -8
|
@@ -37,6 +37,7 @@ exports.findMentionQuery = findMentionQuery;
|
|
|
37
37
|
exports.parseQuery = parseQuery;
|
|
38
38
|
exports.pickerOptions = pickerOptions;
|
|
39
39
|
exports.sharedKinds = sharedKinds;
|
|
40
|
+
exports.placeMenu = placeMenu;
|
|
40
41
|
exports.MentionsPlugin = MentionsPlugin;
|
|
41
42
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
43
|
const code_1 = require("@lexical/code");
|
|
@@ -261,24 +262,35 @@ function AutoPick({ pick }) {
|
|
|
261
262
|
(0, react_1.useEffect)(() => pick(), []);
|
|
262
263
|
return null;
|
|
263
264
|
}
|
|
264
|
-
/** Whether the menu should open above the caret: the caret is in the lower half of the window. */
|
|
265
|
-
function opensAbove(anchor) {
|
|
266
|
-
return anchor.getBoundingClientRect().top > window.innerHeight / 2;
|
|
267
|
-
}
|
|
268
265
|
/** The menu's width and the card's, and the gap between them (`theme.css`). */
|
|
269
266
|
const MENU_WIDTH = 300;
|
|
270
267
|
const PREVIEW_GAP = 8;
|
|
271
268
|
/**
|
|
272
|
-
* Where the
|
|
273
|
-
*
|
|
269
|
+
* Where the menu goes for a caret at `caret`, in window coordinates. The picker decides it once
|
|
270
|
+
* per open, so the menu holds still while results arrive and change its height, and while the
|
|
271
|
+
* caret moves right as you type.
|
|
272
|
+
*
|
|
273
|
+
* @param caret - The caret's top and left edges in the window.
|
|
274
|
+
* @param view - The window's size.
|
|
274
275
|
*/
|
|
275
|
-
function
|
|
276
|
-
const { left } =
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
276
|
+
function placeMenu(caret, view = window) {
|
|
277
|
+
const { left } = caret;
|
|
278
|
+
const preview = left + MENU_WIDTH + PREVIEW_GAP + MENU_WIDTH <= view.innerWidth
|
|
279
|
+
? ""
|
|
280
|
+
: left - PREVIEW_GAP - MENU_WIDTH >= 0
|
|
281
|
+
? "is-preview-left"
|
|
282
|
+
: "is-preview-below";
|
|
283
|
+
return { above: caret.top > view.innerHeight / 2, preview };
|
|
284
|
+
}
|
|
285
|
+
/** The caret in the window: the selection's, which is current while Lexical moves the anchor. */
|
|
286
|
+
function caretRect(anchor) {
|
|
287
|
+
const selection = window.getSelection();
|
|
288
|
+
if (selection && selection.rangeCount > 0) {
|
|
289
|
+
const rect = selection.getRangeAt(0).getBoundingClientRect();
|
|
290
|
+
if (rect.top || rect.left)
|
|
291
|
+
return rect;
|
|
292
|
+
}
|
|
293
|
+
return anchor.getBoundingClientRect();
|
|
282
294
|
}
|
|
283
295
|
/**
|
|
284
296
|
* The mention picker: `<` finds everything (people, then records from every group the user is
|
|
@@ -307,6 +319,8 @@ function MentionsPlugin(props) {
|
|
|
307
319
|
const found = useMentionSearch(queryString, props.groupId);
|
|
308
320
|
const { docGroup } = found;
|
|
309
321
|
const [_mentionsOpen] = (0, react_1.useState)(() => (0, peers_sdk_1.observable)(false));
|
|
322
|
+
// Where the menu goes, decided at its first render each time it opens (see placeMenu).
|
|
323
|
+
const placement = (0, react_1.useRef)(null);
|
|
310
324
|
// The last query taken automatically. An undo brings it back; then it's offered, not retaken.
|
|
311
325
|
const autoPicked = (0, react_1.useRef)(null);
|
|
312
326
|
const { results, autoPick } = (0, react_1.useMemo)(() => pickerOptions(queryString, found, autoPicked.current), [queryString, found]);
|
|
@@ -354,7 +368,13 @@ function MentionsPlugin(props) {
|
|
|
354
368
|
if (query !== null && query !== autoPicked.current)
|
|
355
369
|
autoPicked.current = null;
|
|
356
370
|
setQueryString(query);
|
|
357
|
-
}, onSelectOption: onSelectOption, triggerFn: checkForMentionMatch, options: options, onOpen: () =>
|
|
371
|
+
}, onSelectOption: onSelectOption, triggerFn: checkForMentionMatch, options: options, onOpen: () => {
|
|
372
|
+
placement.current = null;
|
|
373
|
+
_mentionsOpen(true);
|
|
374
|
+
}, onClose: () => {
|
|
375
|
+
placement.current = null;
|
|
376
|
+
_mentionsOpen(false);
|
|
377
|
+
}, menuRenderFn: (anchorElementRef, { selectedIndex, selectOptionAndCleanUp, setHighlightedIndex }) => {
|
|
358
378
|
const anchor = anchorElementRef.current;
|
|
359
379
|
if (!(anchor && options.length)) {
|
|
360
380
|
return null;
|
|
@@ -370,16 +390,21 @@ function MentionsPlugin(props) {
|
|
|
370
390
|
} }, `${queryString}:${option.key}`));
|
|
371
391
|
}
|
|
372
392
|
const highlighted = selectedIndex === null ? undefined : options[selectedIndex];
|
|
393
|
+
placement.current ??= placeMenu(caretRect(anchor));
|
|
373
394
|
const classes = [
|
|
374
395
|
"peers-mention-menu",
|
|
375
|
-
|
|
376
|
-
|
|
396
|
+
placement.current.above ? "is-above" : "",
|
|
397
|
+
placement.current.preview,
|
|
377
398
|
];
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
399
|
+
// Lexical moves its anchor above the caret when the anchor's first child doesn't fit
|
|
400
|
+
// below, measuring it as results change: a zero-height wrapper keeps it from ever doing
|
|
401
|
+
// that, so only the placement above flips the menu. Its width still lets Lexical keep the
|
|
402
|
+
// menu inside the editor's right edge.
|
|
403
|
+
return ReactDOM.createPortal((0, jsx_runtime_1.jsx)("div", { className: "peers-mention-anchor", children: (0, jsx_runtime_1.jsxs)("div", { className: classes.filter(Boolean).join(" "), children: [(0, jsx_runtime_1.jsx)("ul", { className: "peers-mention-menu-list", children: options.map((option, i) => ((0, jsx_runtime_1.jsx)(MentionsTypeaheadMenuItem, { index: i, isSelected: selectedIndex === i, onClick: () => {
|
|
404
|
+
setHighlightedIndex(i);
|
|
405
|
+
selectOptionAndCleanUp(option);
|
|
406
|
+
}, onMouseEnter: () => {
|
|
407
|
+
setHighlightedIndex(i);
|
|
408
|
+
}, option: option, docGroup: docGroup }, option.key))) }), highlighted ? ((0, jsx_runtime_1.jsx)(mention_preview_card_1.MentionPreviewCard, { result: highlighted.result, showPackage: highlighted.showPackage })) : null] }) }), anchor);
|
|
384
409
|
} }));
|
|
385
410
|
}
|
|
@@ -5,8 +5,41 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
+
/** Class names for the editor's nodes and text formats (Lexical's theme). */
|
|
8
9
|
declare const _default: {
|
|
9
10
|
code: string;
|
|
11
|
+
codeHighlight: {
|
|
12
|
+
atrule: string;
|
|
13
|
+
attr: string;
|
|
14
|
+
boolean: string;
|
|
15
|
+
builtin: string;
|
|
16
|
+
cdata: string;
|
|
17
|
+
char: string;
|
|
18
|
+
class: string;
|
|
19
|
+
"class-name": string;
|
|
20
|
+
comment: string;
|
|
21
|
+
constant: string;
|
|
22
|
+
deleted: string;
|
|
23
|
+
doctype: string;
|
|
24
|
+
entity: string;
|
|
25
|
+
function: string;
|
|
26
|
+
important: string;
|
|
27
|
+
inserted: string;
|
|
28
|
+
keyword: string;
|
|
29
|
+
namespace: string;
|
|
30
|
+
number: string;
|
|
31
|
+
operator: string;
|
|
32
|
+
prolog: string;
|
|
33
|
+
property: string;
|
|
34
|
+
punctuation: string;
|
|
35
|
+
regex: string;
|
|
36
|
+
selector: string;
|
|
37
|
+
string: string;
|
|
38
|
+
symbol: string;
|
|
39
|
+
tag: string;
|
|
40
|
+
url: string;
|
|
41
|
+
variable: string;
|
|
42
|
+
};
|
|
10
43
|
heading: {
|
|
11
44
|
h1: string;
|
|
12
45
|
h2: string;
|
|
@@ -14,6 +47,7 @@ declare const _default: {
|
|
|
14
47
|
h4: string;
|
|
15
48
|
h5: string;
|
|
16
49
|
};
|
|
50
|
+
hr: string;
|
|
17
51
|
image: string;
|
|
18
52
|
link: string;
|
|
19
53
|
list: {
|
|
@@ -36,6 +70,7 @@ declare const _default: {
|
|
|
36
70
|
bold: string;
|
|
37
71
|
code: string;
|
|
38
72
|
hashtag: string;
|
|
73
|
+
highlight: string;
|
|
39
74
|
italic: string;
|
|
40
75
|
overflowed: string;
|
|
41
76
|
strikethrough: string;
|
|
@@ -7,8 +7,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
+
/** Class names for the editor's nodes and text formats (Lexical's theme). */
|
|
10
11
|
exports.default = {
|
|
11
12
|
code: "editor-code",
|
|
13
|
+
// Prism's token types, for highlighted code.
|
|
14
|
+
codeHighlight: {
|
|
15
|
+
atrule: "editor-token-keyword",
|
|
16
|
+
attr: "editor-token-attr",
|
|
17
|
+
boolean: "editor-token-constant",
|
|
18
|
+
builtin: "editor-token-function",
|
|
19
|
+
cdata: "editor-token-comment",
|
|
20
|
+
char: "editor-token-string",
|
|
21
|
+
class: "editor-token-function",
|
|
22
|
+
"class-name": "editor-token-function",
|
|
23
|
+
comment: "editor-token-comment",
|
|
24
|
+
constant: "editor-token-constant",
|
|
25
|
+
deleted: "editor-token-deleted",
|
|
26
|
+
doctype: "editor-token-comment",
|
|
27
|
+
entity: "editor-token-operator",
|
|
28
|
+
function: "editor-token-function",
|
|
29
|
+
important: "editor-token-keyword",
|
|
30
|
+
inserted: "editor-token-inserted",
|
|
31
|
+
keyword: "editor-token-keyword",
|
|
32
|
+
namespace: "editor-token-variable",
|
|
33
|
+
number: "editor-token-constant",
|
|
34
|
+
operator: "editor-token-operator",
|
|
35
|
+
prolog: "editor-token-comment",
|
|
36
|
+
property: "editor-token-attr",
|
|
37
|
+
punctuation: "editor-token-punctuation",
|
|
38
|
+
regex: "editor-token-string",
|
|
39
|
+
selector: "editor-token-function",
|
|
40
|
+
string: "editor-token-string",
|
|
41
|
+
symbol: "editor-token-constant",
|
|
42
|
+
tag: "editor-token-keyword",
|
|
43
|
+
url: "editor-token-string",
|
|
44
|
+
variable: "editor-token-variable",
|
|
45
|
+
},
|
|
12
46
|
heading: {
|
|
13
47
|
h1: "editor-heading-h1",
|
|
14
48
|
h2: "editor-heading-h2",
|
|
@@ -16,6 +50,7 @@ exports.default = {
|
|
|
16
50
|
h4: "editor-heading-h4",
|
|
17
51
|
h5: "editor-heading-h5",
|
|
18
52
|
},
|
|
53
|
+
hr: "editor-hr",
|
|
19
54
|
image: "editor-image",
|
|
20
55
|
link: "editor-link",
|
|
21
56
|
list: {
|
|
@@ -39,6 +74,7 @@ exports.default = {
|
|
|
39
74
|
bold: "editor-text-bold",
|
|
40
75
|
code: "editor-text-code",
|
|
41
76
|
hashtag: "editor-text-hashtag",
|
|
77
|
+
highlight: "editor-text-highlight",
|
|
42
78
|
italic: "editor-text-italic",
|
|
43
79
|
overflowed: "editor-text-overflowed",
|
|
44
80
|
strikethrough: "editor-text-strikethrough",
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
+
/** A button an app adds to the editor's toolbar, at its top right. */
|
|
1
2
|
export interface IToolbarControl {
|
|
3
|
+
/** The button's icon: a Bootstrap Icons class, such as `bi-trash`. */
|
|
2
4
|
iconClass: string;
|
|
5
|
+
/** What the button does. */
|
|
3
6
|
onClick: () => void;
|
|
7
|
+
/** The button's tooltip. */
|
|
4
8
|
title?: string;
|
|
5
9
|
}
|
|
10
|
+
/** The toolbar's options. */
|
|
6
11
|
export interface IToolbarProps {
|
|
12
|
+
/** The app's own buttons, after the formatting ones. */
|
|
7
13
|
topRightControls?: IToolbarControl[];
|
|
8
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* The editor's formatting toolbar: bold, italic, strikethrough, link and the three list kinds,
|
|
17
|
+
* each lit while the selection has it, plus the app's own buttons. Every app hides it for now
|
|
18
|
+
* (`hideToolbar`).
|
|
19
|
+
*/
|
|
9
20
|
export declare function ToolbarPlugin(props: IToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,10 +7,20 @@ const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext"
|
|
|
7
7
|
const utils_1 = require("@lexical/utils");
|
|
8
8
|
const lexical_1 = require("lexical");
|
|
9
9
|
const react_1 = require("react");
|
|
10
|
+
const link_plugin_1 = require("./link-plugin");
|
|
10
11
|
const LowPriority = 1;
|
|
12
|
+
/** The link shortcut, as the toolbar's tooltip shows it. */
|
|
13
|
+
const linkShortcutLabel = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform)
|
|
14
|
+
? "⌘⇧K"
|
|
15
|
+
: "Ctrl+Shift+K";
|
|
11
16
|
function Divider() {
|
|
12
17
|
return (0, jsx_runtime_1.jsx)("span", { className: "tool-bar-divider" });
|
|
13
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* The editor's formatting toolbar: bold, italic, strikethrough, link and the three list kinds,
|
|
21
|
+
* each lit while the selection has it, plus the app's own buttons. Every app hides it for now
|
|
22
|
+
* (`hideToolbar`).
|
|
23
|
+
*/
|
|
14
24
|
function ToolbarPlugin(props) {
|
|
15
25
|
const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
|
|
16
26
|
const toolbarRef = (0, react_1.useRef)(null);
|
|
@@ -20,6 +30,7 @@ function ToolbarPlugin(props) {
|
|
|
20
30
|
const [isItalic, setIsItalic] = (0, react_1.useState)(false);
|
|
21
31
|
const [_isUnderline, setIsUnderline] = (0, react_1.useState)(false);
|
|
22
32
|
const [isStrikethrough, setIsStrikethrough] = (0, react_1.useState)(false);
|
|
33
|
+
const [isLink, setIsLink] = (0, react_1.useState)(false);
|
|
23
34
|
// New state for list types
|
|
24
35
|
const [isUnorderedList, setIsUnorderedList] = (0, react_1.useState)(false);
|
|
25
36
|
const [isOrderedList, setIsOrderedList] = (0, react_1.useState)(false);
|
|
@@ -32,6 +43,7 @@ function ToolbarPlugin(props) {
|
|
|
32
43
|
setIsItalic(selection.hasFormat("italic"));
|
|
33
44
|
setIsUnderline(selection.hasFormat("underline"));
|
|
34
45
|
setIsStrikethrough(selection.hasFormat("strikethrough"));
|
|
46
|
+
setIsLink((0, link_plugin_1.$selectedLink)(selection) !== null);
|
|
35
47
|
// Update list format
|
|
36
48
|
const anchorNode = selection.anchor.getNode();
|
|
37
49
|
const element = anchorNode.getKey() === "root" ? anchorNode : anchorNode.getTopLevelElementOrThrow();
|
|
@@ -50,10 +62,7 @@ function ToolbarPlugin(props) {
|
|
|
50
62
|
editorState.read(() => {
|
|
51
63
|
$updateToolbar();
|
|
52
64
|
});
|
|
53
|
-
}), editor.registerCommand(lexical_1.
|
|
54
|
-
$updateToolbar();
|
|
55
|
-
return false;
|
|
56
|
-
}, LowPriority), editor.registerCommand(lexical_1.CAN_UNDO_COMMAND, (payload) => {
|
|
65
|
+
}), editor.registerCommand(lexical_1.CAN_UNDO_COMMAND, (payload) => {
|
|
57
66
|
setCanUndo(payload);
|
|
58
67
|
return false;
|
|
59
68
|
}, LowPriority), editor.registerCommand(lexical_1.CAN_REDO_COMMAND, (payload) => {
|
|
@@ -91,5 +100,7 @@ function ToolbarPlugin(props) {
|
|
|
91
100
|
editor.dispatchCommand(lexical_1.FORMAT_TEXT_COMMAND, "italic");
|
|
92
101
|
}, className: `toolbar-item spaced ${isItalic ? "active" : ""}`, "aria-label": "Format Italics", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-type-italic" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: () => {
|
|
93
102
|
editor.dispatchCommand(lexical_1.FORMAT_TEXT_COMMAND, "strikethrough");
|
|
94
|
-
}, className: `toolbar-item spaced ${isStrikethrough ? "active" : ""}`, "aria-label": "Format Strikethrough", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-type-strikethrough" }) }), (0, jsx_runtime_1.jsx)(
|
|
103
|
+
}, className: `toolbar-item spaced ${isStrikethrough ? "active" : ""}`, "aria-label": "Format Strikethrough", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-type-strikethrough" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onMouseDown: (event) => event.preventDefault(), onClick: () => {
|
|
104
|
+
editor.dispatchCommand(link_plugin_1.OPEN_LINK_EDITOR_COMMAND, undefined);
|
|
105
|
+
}, className: `toolbar-item spaced ${isLink ? "active" : ""}`, "aria-label": "Link", title: `Link (${linkShortcutLabel})`, children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-link-45deg" }) }), (0, jsx_runtime_1.jsx)(Divider, {}), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: insertUnorderedList, className: `toolbar-item spaced ${isUnorderedList ? "active" : ""}`, "aria-label": "Insert Unordered List", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-ul" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: insertOrderedList, className: `toolbar-item spaced ${isOrderedList ? "active" : ""}`, "aria-label": "Insert Ordered List", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-ol" }) }), (0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: insertCheckList, className: `toolbar-item spaced ${isCheckList ? "active" : ""}`, "aria-label": "Insert Check List", children: (0, jsx_runtime_1.jsx)("i", { className: "bi bi-list-check" }) }), (props.topRightControls?.length ?? 0) > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "float-end", children: props.topRightControls?.map((control) => ((0, jsx_runtime_1.jsx)("button", { tabIndex: -1, onClick: control.onClick, className: "toolbar-item spaced active", "aria-label": "Insert Check List", title: control.title, children: (0, jsx_runtime_1.jsx)("i", { className: control.iconClass }) }, control.title))) }))] }));
|
|
95
106
|
}
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.canScanQr = canScanQr;
|
|
37
4
|
exports.QrScanner = QrScanner;
|
|
@@ -130,7 +97,8 @@ function QrScanner(props) {
|
|
|
130
97
|
(async () => {
|
|
131
98
|
try {
|
|
132
99
|
if (!detector) {
|
|
133
|
-
|
|
100
|
+
// Loaded on first use. A `require`, as `import()` would be a separate bundle chunk.
|
|
101
|
+
jsqr = require("jsqr").default;
|
|
134
102
|
}
|
|
135
103
|
stream = await navigator.mediaDevices.getUserMedia({
|
|
136
104
|
video: { facingMode: { ideal: "environment" } },
|
package/dist/theme.css
CHANGED
|
@@ -316,20 +316,30 @@
|
|
|
316
316
|
card beside the list for the highlighted result. On a narrow screen the card
|
|
317
317
|
sits under the list. */
|
|
318
318
|
|
|
319
|
+
/* Zero height, so Lexical's typeahead never measures the menu and moves its anchor above the
|
|
320
|
+
caret; the menu itself hangs from it. Its width lets Lexical keep it inside the editor. */
|
|
321
|
+
.peers-mention-anchor {
|
|
322
|
+
height: 0;
|
|
323
|
+
position: relative;
|
|
324
|
+
width: 300px;
|
|
325
|
+
}
|
|
326
|
+
|
|
319
327
|
.peers-mention-menu {
|
|
320
328
|
--peers-mention-menu-bg: var(--peers-surface-bg, var(--bs-tertiary-bg));
|
|
321
329
|
--peers-mention-menu-border: var(--peers-surface-border, var(--bs-border-color));
|
|
322
330
|
font-size: 14px;
|
|
331
|
+
left: 0;
|
|
323
332
|
line-height: 1.35;
|
|
324
|
-
position:
|
|
325
|
-
|
|
333
|
+
position: absolute;
|
|
334
|
+
top: 0;
|
|
335
|
+
width: 100%;
|
|
326
336
|
z-index: 1000;
|
|
327
337
|
}
|
|
328
338
|
|
|
329
339
|
.peers-mention-menu.is-above {
|
|
330
340
|
bottom: 100%;
|
|
331
341
|
margin-bottom: 30px;
|
|
332
|
-
|
|
342
|
+
top: auto;
|
|
333
343
|
}
|
|
334
344
|
|
|
335
345
|
.peers-mention-menu-list,
|
|
@@ -449,7 +459,7 @@
|
|
|
449
459
|
}
|
|
450
460
|
|
|
451
461
|
@media (max-width: 640px) {
|
|
452
|
-
.peers-mention-
|
|
462
|
+
.peers-mention-anchor {
|
|
453
463
|
width: min(300px, calc(100vw - 24px));
|
|
454
464
|
}
|
|
455
465
|
|
|
@@ -2362,3 +2372,214 @@
|
|
|
2362
2372
|
stroke-linecap: round;
|
|
2363
2373
|
stroke-dasharray: 0.01 4.5;
|
|
2364
2374
|
}
|
|
2375
|
+
|
|
2376
|
+
/* ─── Markdown editor: links, code, dividers, callouts, highlight ─────────────────────────
|
|
2377
|
+
components/markdown-editor: link-plugin.tsx (the link popup), code-plugin.tsx (the language
|
|
2378
|
+
picker), blocks.ts (dividers and callouts), theme.ts (the class names). */
|
|
2379
|
+
|
|
2380
|
+
.editor-input .editor-link {
|
|
2381
|
+
cursor: pointer;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2384
|
+
/* The link popup, under the link the caret is in: its URL, Edit and Remove, or the URL input. */
|
|
2385
|
+
.peers-link-popup {
|
|
2386
|
+
position: fixed;
|
|
2387
|
+
z-index: 1080;
|
|
2388
|
+
min-width: 14rem;
|
|
2389
|
+
padding: 0.25rem 0.375rem;
|
|
2390
|
+
border: 1px solid var(--bs-border-color);
|
|
2391
|
+
border-radius: var(--bs-border-radius);
|
|
2392
|
+
background: var(--bs-body-bg);
|
|
2393
|
+
box-shadow: var(--bs-box-shadow-sm);
|
|
2394
|
+
font-size: 0.875rem;
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
.peers-link-popup-url {
|
|
2398
|
+
flex: 1 1 auto;
|
|
2399
|
+
min-width: 0;
|
|
2400
|
+
padding: 0 0.25rem;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
.peers-link-popup .form-control {
|
|
2404
|
+
min-width: 14rem;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
/* Code blocks, colored by language (Prism's tokens; theme.ts maps them to these classes). */
|
|
2408
|
+
.editor-input .editor-code {
|
|
2409
|
+
display: block;
|
|
2410
|
+
margin: 0.5rem 0;
|
|
2411
|
+
padding: 0.5rem 0.75rem;
|
|
2412
|
+
overflow-x: auto;
|
|
2413
|
+
border: 1px solid var(--bs-border-color-translucent);
|
|
2414
|
+
border-radius: var(--bs-border-radius);
|
|
2415
|
+
background: var(--bs-tertiary-bg);
|
|
2416
|
+
color: var(--bs-body-color);
|
|
2417
|
+
font-family: var(--bs-font-monospace);
|
|
2418
|
+
font-size: 0.875em;
|
|
2419
|
+
line-height: 1.5;
|
|
2420
|
+
white-space: pre;
|
|
2421
|
+
tab-size: 2;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
.editor-token-comment {
|
|
2425
|
+
color: var(--bs-secondary-color);
|
|
2426
|
+
font-style: italic;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
.editor-token-punctuation {
|
|
2430
|
+
color: var(--bs-secondary-color);
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
.editor-token-keyword {
|
|
2434
|
+
color: #a626a4;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2437
|
+
.editor-token-string,
|
|
2438
|
+
.editor-token-inserted {
|
|
2439
|
+
color: #50a14f;
|
|
2440
|
+
}
|
|
2441
|
+
|
|
2442
|
+
.editor-token-constant,
|
|
2443
|
+
.editor-token-deleted {
|
|
2444
|
+
color: #c18401;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
.editor-token-function {
|
|
2448
|
+
color: #4078f2;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
.editor-token-attr,
|
|
2452
|
+
.editor-token-variable {
|
|
2453
|
+
color: #e45649;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
.editor-token-operator {
|
|
2457
|
+
color: #0184bc;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
[data-bs-theme="dark"] .editor-token-keyword {
|
|
2461
|
+
color: #c678dd;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
[data-bs-theme="dark"] .editor-token-string,
|
|
2465
|
+
[data-bs-theme="dark"] .editor-token-inserted {
|
|
2466
|
+
color: #98c379;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
[data-bs-theme="dark"] .editor-token-constant,
|
|
2470
|
+
[data-bs-theme="dark"] .editor-token-deleted {
|
|
2471
|
+
color: #d19a66;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
[data-bs-theme="dark"] .editor-token-function {
|
|
2475
|
+
color: #61afef;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
[data-bs-theme="dark"] .editor-token-attr,
|
|
2479
|
+
[data-bs-theme="dark"] .editor-token-variable {
|
|
2480
|
+
color: #e06c75;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
[data-bs-theme="dark"] .editor-token-operator {
|
|
2484
|
+
color: #56b6c2;
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
/* The language picker, at the top right of the code block the caret is in. */
|
|
2488
|
+
.peers-code-language {
|
|
2489
|
+
position: fixed;
|
|
2490
|
+
z-index: 1070;
|
|
2491
|
+
width: auto;
|
|
2492
|
+
max-width: 10rem;
|
|
2493
|
+
padding: 0 1.75rem 0 0.5rem;
|
|
2494
|
+
transform: translateX(-100%);
|
|
2495
|
+
font-size: 0.75rem;
|
|
2496
|
+
opacity: 0.85;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
.peers-code-language:focus,
|
|
2500
|
+
.peers-code-language:hover {
|
|
2501
|
+
opacity: 1;
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
/* Dividers; a selected one (clicked, so Backspace removes it) is marked. */
|
|
2505
|
+
.editor-input .editor-hr {
|
|
2506
|
+
margin: 0.75rem 0;
|
|
2507
|
+
padding: 0.25rem 0;
|
|
2508
|
+
border: none;
|
|
2509
|
+
background: none;
|
|
2510
|
+
cursor: pointer;
|
|
2511
|
+
opacity: 1;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
.editor-input .editor-hr::after {
|
|
2515
|
+
content: "";
|
|
2516
|
+
display: block;
|
|
2517
|
+
height: 1px;
|
|
2518
|
+
background: var(--bs-border-color);
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
.editor-input .editor-hr.selected {
|
|
2522
|
+
outline: 2px solid var(--bs-primary);
|
|
2523
|
+
outline-offset: 1px;
|
|
2524
|
+
border-radius: 2px;
|
|
2525
|
+
}
|
|
2526
|
+
|
|
2527
|
+
/* Callouts (> [!NOTE] and the like): a quote with its kind's color and title. */
|
|
2528
|
+
.editor-input .editor-callout {
|
|
2529
|
+
margin: 0.5rem 0;
|
|
2530
|
+
padding: 0.375rem 0.75rem;
|
|
2531
|
+
border-left: 4px solid var(--peers-callout-color);
|
|
2532
|
+
border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0;
|
|
2533
|
+
background: color-mix(in srgb, var(--peers-callout-color) 8%, transparent);
|
|
2534
|
+
color: var(--bs-body-color);
|
|
2535
|
+
font-size: inherit;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
.editor-input .editor-callout::before {
|
|
2539
|
+
content: attr(data-callout-title);
|
|
2540
|
+
display: block;
|
|
2541
|
+
color: var(--peers-callout-color);
|
|
2542
|
+
font-weight: 600;
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
.editor-callout-note {
|
|
2546
|
+
--peers-callout-color: var(--bs-primary);
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
.editor-callout-tip {
|
|
2550
|
+
--peers-callout-color: var(--bs-success);
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
.editor-callout-important {
|
|
2554
|
+
--peers-callout-color: #8250df;
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
.editor-callout-warning {
|
|
2558
|
+
--peers-callout-color: #bf8700;
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
.editor-callout-caution {
|
|
2562
|
+
--peers-callout-color: var(--bs-danger);
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
[data-bs-theme="dark"] .editor-callout-important {
|
|
2566
|
+
--peers-callout-color: #a371f7;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
[data-bs-theme="dark"] .editor-callout-warning {
|
|
2570
|
+
--peers-callout-color: #d29922;
|
|
2571
|
+
}
|
|
2572
|
+
|
|
2573
|
+
/* ==Highlighted text==: Lexical wraps it in <mark>, which Bootstrap pads and colors. */
|
|
2574
|
+
.editor-input mark {
|
|
2575
|
+
padding: 0;
|
|
2576
|
+
background: none;
|
|
2577
|
+
color: inherit;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
.editor-text-highlight {
|
|
2581
|
+
padding: 0 0.1em;
|
|
2582
|
+
border-radius: 2px;
|
|
2583
|
+
background: rgba(255, 212, 0, 0.4);
|
|
2584
|
+
color: inherit;
|
|
2585
|
+
}
|
|
@@ -9,19 +9,16 @@ const runnable_version_1 = require("./runnable-version");
|
|
|
9
9
|
exports.allPackages = (0, peers_sdk_1.observable)([]);
|
|
10
10
|
let allRoutesLoaded = false;
|
|
11
11
|
const prefsSubscribed = new Set();
|
|
12
|
+
/**
|
|
13
|
+
* Follow this device's version selection for a package: a new one, or a cleared one that hands
|
|
14
|
+
* the package back to the group's version, rechecks it, so its app links, icon and routes follow
|
|
15
|
+
* without a UI reload.
|
|
16
|
+
*/
|
|
12
17
|
function subscribeToPrefs(packageId) {
|
|
13
18
|
if (prefsSubscribed.has(packageId))
|
|
14
19
|
return;
|
|
15
20
|
prefsSubscribed.add(packageId);
|
|
16
|
-
|
|
17
|
-
let lastPvId = pvar()?.activePackageVersionId;
|
|
18
|
-
pvar.subscribe(async (prefs) => {
|
|
19
|
-
const newPvId = prefs?.activePackageVersionId;
|
|
20
|
-
if (newPvId && newPvId !== lastPvId) {
|
|
21
|
-
lastPvId = newPvId;
|
|
22
|
-
await recheckPackage(packageId);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
21
|
+
(0, runnable_version_1.onDeviceSelectionChanged)(packageId, () => void recheckPackage(packageId));
|
|
25
22
|
}
|
|
26
23
|
/** Re-check whether a listed package may run here, refresh its app links, and reload its routes. */
|
|
27
24
|
async function recheckPackage(packageId) {
|
|
@@ -31,3 +31,12 @@ export declare function resolveRunnableVersion(pkg: IPackage, servingPackageVers
|
|
|
31
31
|
* @returns The subscription, to stop following.
|
|
32
32
|
*/
|
|
33
33
|
export declare function onSelectedPackageVersionChanged(onChange: (packageId: string) => void): import("@peers-app/peers-sdk").ISubscriptionResult;
|
|
34
|
+
/**
|
|
35
|
+
* Call `onChange` when this device's version selection for a package (its device override)
|
|
36
|
+
* changes: a new selection, or a cleared one that hands the package back to the group's version.
|
|
37
|
+
* A write that keeps the selection (such as pinning it) doesn't count.
|
|
38
|
+
*
|
|
39
|
+
* @param packageId - The package to follow.
|
|
40
|
+
* @param onChange - Called after each change of the selection.
|
|
41
|
+
*/
|
|
42
|
+
export declare function onDeviceSelectionChanged(packageId: string, onChange: () => void): void;
|