@peers-app/peers-ui 0.33.5 → 0.33.7
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/components/markdown-editor/editor.d.ts +25 -2
- package/dist/components/markdown-editor/editor.js +7 -3
- package/dist/components/markdown-editor/markdown-plugin.d.ts +4 -1
- package/dist/components/markdown-editor/markdown-plugin.js +32 -20
- package/dist/components/markdown-editor/mention-node.d.ts +28 -15
- package/dist/components/markdown-editor/mention-node.js +75 -129
- package/dist/components/markdown-editor/mentions-plugin.d.ts +9 -4
- package/dist/components/markdown-editor/mentions-plugin.js +102 -93
- package/dist/components/markdown-with-mentions.d.ts +12 -2
- package/dist/components/markdown-with-mentions.js +110 -110
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -1
- package/dist/mentions/mention-chip.d.ts +32 -0
- package/dist/mentions/mention-chip.js +75 -0
- package/dist/mentions/mention-chooser.d.ts +9 -0
- package/dist/mentions/mention-chooser.js +51 -0
- package/dist/mentions/mentions-client.d.ts +47 -0
- package/dist/mentions/mentions-client.js +198 -0
- package/dist/notifications/notifications-client.d.ts +3 -3
- package/dist/notifications/notifications-client.js +6 -63
- package/dist/root-layout/root-layout-host.js +2 -2
- package/dist/screens/console-logs/console-logs-list.js +7 -2
- package/dist/screens/console-logs/follow-newest.d.ts +11 -0
- package/dist/screens/console-logs/follow-newest.js +17 -0
- package/dist/screens/groups/group-details.js +5 -4
- package/dist/theme.css +79 -0
- package/dist/ui-router/open-in-group.d.ts +17 -0
- package/dist/ui-router/open-in-group.js +81 -0
- package/dist/ui-router/routes-loader.js +20 -11
- package/dist/ui-router/runnable-version.d.ts +10 -0
- package/dist/ui-router/runnable-version.js +30 -0
- package/dist/ui-router/ui-loader.js +5 -0
- package/package.json +4 -4
package/dist/theme.css
CHANGED
|
@@ -132,3 +132,82 @@
|
|
|
132
132
|
display: none;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
+
|
|
136
|
+
/* ─── Mentions ─────────────────────────────────────────────────────────
|
|
137
|
+
A mention chip (MentionChip) in the editor and in rendered markdown, the
|
|
138
|
+
picker's detail line, and the chooser for a record found in several places. */
|
|
139
|
+
|
|
140
|
+
.peers-mention {
|
|
141
|
+
background-color: rgba(var(--bs-link-color-rgb), 0.1);
|
|
142
|
+
border-radius: 4px;
|
|
143
|
+
color: var(--bs-link-color);
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
padding: 0 4px;
|
|
146
|
+
text-decoration: none;
|
|
147
|
+
box-decoration-break: clone;
|
|
148
|
+
-webkit-box-decoration-break: clone;
|
|
149
|
+
overflow-wrap: anywhere;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.peers-mention:hover,
|
|
153
|
+
.peers-mention:focus-visible {
|
|
154
|
+
background-color: rgba(var(--bs-link-color-rgb), 0.2);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.peers-mention-icon {
|
|
158
|
+
font-size: 0.9em;
|
|
159
|
+
margin-right: 3px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.peers-mention-done {
|
|
163
|
+
opacity: 0.7;
|
|
164
|
+
text-decoration: line-through;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* A mention the user can't read: its stored label, as plain text. */
|
|
168
|
+
.peers-mention.peers-mention-missing {
|
|
169
|
+
background: none;
|
|
170
|
+
color: inherit;
|
|
171
|
+
cursor: text;
|
|
172
|
+
padding: 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.typeahead-popover.mentions-menu .item .text {
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
min-width: 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.typeahead-popover.mentions-menu .peers-mention-menu-detail {
|
|
182
|
+
color: var(--bs-secondary-color);
|
|
183
|
+
font-size: 12px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.peers-mention-chooser {
|
|
187
|
+
align-items: center;
|
|
188
|
+
background-color: var(--peers-graph-overlay-color, rgba(0, 0, 0, 0.35));
|
|
189
|
+
display: flex;
|
|
190
|
+
inset: 0;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
padding: 16px;
|
|
193
|
+
position: fixed;
|
|
194
|
+
z-index: 1080;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.peers-mention-chooser-card {
|
|
198
|
+
background-color: var(--peers-surface-bg, var(--bs-body-bg));
|
|
199
|
+
border: 1px solid var(--peers-surface-border, var(--bs-border-color));
|
|
200
|
+
border-radius: 8px;
|
|
201
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
|
202
|
+
max-height: 70vh;
|
|
203
|
+
overflow-y: auto;
|
|
204
|
+
width: min(420px, 100%);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.peers-mention-chooser-head {
|
|
208
|
+
align-items: center;
|
|
209
|
+
display: flex;
|
|
210
|
+
gap: 12px;
|
|
211
|
+
justify-content: space-between;
|
|
212
|
+
padding: 12px 16px;
|
|
213
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a route that belongs to one of the user's groups, as a notification or a mention does.
|
|
3
|
+
*
|
|
4
|
+
* - A screen that shows any group itself (its route's `opensAnyGroup`) opens in place, with
|
|
5
|
+
* `groupId` added to the path for the screen to read.
|
|
6
|
+
* - A route in the active group opens as it is.
|
|
7
|
+
* - Otherwise Peers switches to the group, which reloads the window, and opens the route once the
|
|
8
|
+
* group's routes and tabs have loaded ({@link resumeGroupNavigation}).
|
|
9
|
+
*
|
|
10
|
+
* @param path - The route, such as `package-nav/<packageId>/app?taskId=<id>`.
|
|
11
|
+
* @param groupId - The group it belongs to; the user's id for Personal.
|
|
12
|
+
* @returns false, having opened nothing, when the group isn't one the user is in (left or
|
|
13
|
+
* disabled): selecting it would create a context for it and keep it across restarts.
|
|
14
|
+
*/
|
|
15
|
+
export declare function openInGroup(path: string, groupId: string): Promise<boolean>;
|
|
16
|
+
/** Finish {@link openInGroup}'s group switch after the new group's routes and tabs have loaded. */
|
|
17
|
+
export declare function resumeGroupNavigation(): Promise<void>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openInGroup = openInGroup;
|
|
4
|
+
exports.resumeGroupNavigation = resumeGroupNavigation;
|
|
5
|
+
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
6
|
+
const identity_routes_1 = require("../screens/identity/identity-routes");
|
|
7
|
+
const tabs_state_1 = require("../tabs-layout/tabs-state");
|
|
8
|
+
const find_route_1 = require("./find-route");
|
|
9
|
+
// The name is from when only notifications opened links in other groups; kept so a switch
|
|
10
|
+
// already under way when the app updates still finishes.
|
|
11
|
+
const pendingNavigationKey = "peers.notificationNavigation";
|
|
12
|
+
/**
|
|
13
|
+
* Open a route that belongs to one of the user's groups, as a notification or a mention does.
|
|
14
|
+
*
|
|
15
|
+
* - A screen that shows any group itself (its route's `opensAnyGroup`) opens in place, with
|
|
16
|
+
* `groupId` added to the path for the screen to read.
|
|
17
|
+
* - A route in the active group opens as it is.
|
|
18
|
+
* - Otherwise Peers switches to the group, which reloads the window, and opens the route once the
|
|
19
|
+
* group's routes and tabs have loaded ({@link resumeGroupNavigation}).
|
|
20
|
+
*
|
|
21
|
+
* @param path - The route, such as `package-nav/<packageId>/app?taskId=<id>`.
|
|
22
|
+
* @param groupId - The group it belongs to; the user's id for Personal.
|
|
23
|
+
* @returns false, having opened nothing, when the group isn't one the user is in (left or
|
|
24
|
+
* disabled): selecting it would create a context for it and keep it across restarts.
|
|
25
|
+
*/
|
|
26
|
+
async function openInGroup(path, groupId) {
|
|
27
|
+
const userContext = await (0, peers_sdk_1.getUserContext)();
|
|
28
|
+
const member = () => groupId === userContext.userId || userContext.groupIds().includes(groupId);
|
|
29
|
+
// Match the path the tab will render, including the host's group and normal query encoding.
|
|
30
|
+
const inPlacePath = (0, identity_routes_1.canonicalizeRoute)(withGroupId(path, groupId));
|
|
31
|
+
if (opensAnyGroup(inPlacePath) && member()) {
|
|
32
|
+
(0, tabs_state_1.goToTabPath)(inPlacePath);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
if ((userContext.currentlyActiveGroupId() || userContext.userId) !== groupId) {
|
|
36
|
+
if (!member())
|
|
37
|
+
return false;
|
|
38
|
+
// Group switching reloads the renderer. Carry the destination through startup; navigating
|
|
39
|
+
// after a delay can lose the link or write it into the old group's tabs.
|
|
40
|
+
sessionStorage.setItem(pendingNavigationKey, JSON.stringify({ userId: userContext.userId, groupId, path }));
|
|
41
|
+
userContext.currentlyActiveGroupId(groupId);
|
|
42
|
+
await userContext.waitForActiveGroupPersistence();
|
|
43
|
+
await peers_sdk_1.rpcServerCalls.flushDatabases();
|
|
44
|
+
window.location.reload();
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
(0, tabs_state_1.goToTabPath)(path);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
/** Finish {@link openInGroup}'s group switch after the new group's routes and tabs have loaded. */
|
|
51
|
+
async function resumeGroupNavigation() {
|
|
52
|
+
const pending = sessionStorage.getItem(pendingNavigationKey);
|
|
53
|
+
if (!pending)
|
|
54
|
+
return;
|
|
55
|
+
sessionStorage.removeItem(pendingNavigationKey);
|
|
56
|
+
const userContext = await (0, peers_sdk_1.getUserContext)();
|
|
57
|
+
try {
|
|
58
|
+
const target = JSON.parse(pending);
|
|
59
|
+
if (target.userId === userContext.userId &&
|
|
60
|
+
target.groupId === (userContext.currentlyActiveGroupId() || userContext.userId) &&
|
|
61
|
+
typeof target.path === "string")
|
|
62
|
+
(0, tabs_state_1.goToTabPath)(target.path);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// A stale or malformed session value must not prevent the shell from starting.
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Whether the active group's screen for this path shows any of the user's groups itself. */
|
|
69
|
+
function opensAnyGroup(path) {
|
|
70
|
+
// UIRouter includes the rendered props in the context passed to isMatch too.
|
|
71
|
+
const context = { path, uiCategory: "screen", props: {} };
|
|
72
|
+
return !!(0, find_route_1.findRoute)(context, context.props)?.opensAnyGroup;
|
|
73
|
+
}
|
|
74
|
+
/** The path with `groupId` set in its query, replacing one the link carried. */
|
|
75
|
+
function withGroupId(path, groupId) {
|
|
76
|
+
const at = path.indexOf("?");
|
|
77
|
+
const route = at < 0 ? path : path.slice(0, at);
|
|
78
|
+
const params = new URLSearchParams(at < 0 ? "" : path.slice(at + 1));
|
|
79
|
+
params.set("groupId", groupId);
|
|
80
|
+
return `${route}?${params.toString()}`;
|
|
81
|
+
}
|
|
@@ -19,20 +19,27 @@ function subscribeToPrefs(packageId) {
|
|
|
19
19
|
const newPvId = prefs?.activePackageVersionId;
|
|
20
20
|
if (newPvId && newPvId !== lastPvId) {
|
|
21
21
|
lastPvId = newPvId;
|
|
22
|
-
|
|
23
|
-
if (pkg) {
|
|
24
|
-
const enrichedPkg = await enrichWithPvAppNavs(pkg);
|
|
25
|
-
const _allPackages = (0, exports.allPackages)();
|
|
26
|
-
const idx = _allPackages.findIndex((p) => p.packageId === packageId);
|
|
27
|
-
if (idx >= 0) {
|
|
28
|
-
_allPackages[idx] = enrichedPkg;
|
|
29
|
-
(0, exports.allPackages)([..._allPackages]);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
reloadPackage(packageId);
|
|
22
|
+
await recheckPackage(packageId);
|
|
33
23
|
}
|
|
34
24
|
});
|
|
35
25
|
}
|
|
26
|
+
/** Re-check whether a listed package may run here, refresh its app links, and reload its routes. */
|
|
27
|
+
async function recheckPackage(packageId) {
|
|
28
|
+
// A package loadAllRoutes left out (disabled, or no selected version) stays out: no routes run.
|
|
29
|
+
if (!(0, exports.allPackages)().some((p) => p.packageId === packageId))
|
|
30
|
+
return;
|
|
31
|
+
const pkg = await (0, peers_sdk_1.Packages)().get(packageId);
|
|
32
|
+
if (pkg) {
|
|
33
|
+
const enrichedPkg = await enrichWithPvAppNavs(pkg);
|
|
34
|
+
const _allPackages = (0, exports.allPackages)();
|
|
35
|
+
const idx = _allPackages.findIndex((p) => p.packageId === packageId);
|
|
36
|
+
if (idx >= 0) {
|
|
37
|
+
_allPackages[idx] = enrichedPkg;
|
|
38
|
+
(0, exports.allPackages)([..._allPackages]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
reloadPackage(packageId);
|
|
42
|
+
}
|
|
36
43
|
/**
|
|
37
44
|
* Enrich an IPackage with appNavs from the device's active PackageVersion record.
|
|
38
45
|
*/
|
|
@@ -83,6 +90,8 @@ const loadAllRoutes = async () => {
|
|
|
83
90
|
return;
|
|
84
91
|
reloadPackage(pkg.packageId);
|
|
85
92
|
});
|
|
93
|
+
// A promotion changes only the selected version's row (dev to beta or stable).
|
|
94
|
+
(0, runnable_version_1.onSelectedPackageVersionChanged)((packageId) => void recheckPackage(packageId));
|
|
86
95
|
return true;
|
|
87
96
|
};
|
|
88
97
|
exports.loadAllRoutes = loadAllRoutes;
|
|
@@ -18,3 +18,13 @@ export declare function resolveRunnableVersion(pkg: IPackage): Promise<{
|
|
|
18
18
|
pv: IPackageVersion;
|
|
19
19
|
dataContext: DataContext;
|
|
20
20
|
} | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Call `onChange` when the version row a package runs on this device changes, such as a dev
|
|
23
|
+
* build promoted to beta or stable on another device: its Packages row and this device's
|
|
24
|
+
* selection stay the same, so watchers of those miss it, though whether it may run here can
|
|
25
|
+
* change. Only the selected row counts (this device's selection, else the group's).
|
|
26
|
+
*
|
|
27
|
+
* @param onChange - Gets the package whose selected version row changed.
|
|
28
|
+
* @returns The subscription, to stop following.
|
|
29
|
+
*/
|
|
30
|
+
export declare function onSelectedPackageVersionChanged(onChange: (packageId: string) => void): import("@peers-app/peers-sdk").ISubscriptionResult;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveRunnableVersion = resolveRunnableVersion;
|
|
4
|
+
exports.onSelectedPackageVersionChanged = onSelectedPackageVersionChanged;
|
|
4
5
|
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
5
6
|
/**
|
|
6
7
|
* The version of `pkg` this device runs, when it may run here: the device's own selection, else
|
|
@@ -50,3 +51,32 @@ async function resolveRunnableVersion(pkg) {
|
|
|
50
51
|
return undefined;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Call `onChange` when the version row a package runs on this device changes, such as a dev
|
|
56
|
+
* build promoted to beta or stable on another device: its Packages row and this device's
|
|
57
|
+
* selection stay the same, so watchers of those miss it, though whether it may run here can
|
|
58
|
+
* change. Only the selected row counts (this device's selection, else the group's).
|
|
59
|
+
*
|
|
60
|
+
* @param onChange - Gets the package whose selected version row changed.
|
|
61
|
+
* @returns The subscription, to stop following.
|
|
62
|
+
*/
|
|
63
|
+
function onSelectedPackageVersionChanged(onChange) {
|
|
64
|
+
return (0, peers_sdk_1.PackageVersions)().dataChanged.subscribe(async (evt) => {
|
|
65
|
+
const pv = evt.dataObject;
|
|
66
|
+
if (!pv?.packageId || evt.op === "delete")
|
|
67
|
+
return;
|
|
68
|
+
try {
|
|
69
|
+
const pkg = await (0, peers_sdk_1.Packages)().get(pv.packageId);
|
|
70
|
+
if (!pkg)
|
|
71
|
+
return;
|
|
72
|
+
const prefs = (0, peers_sdk_1.packagePrefsVar)(pkg.packageId);
|
|
73
|
+
await prefs.loadingPromise;
|
|
74
|
+
const selectedPvId = prefs()?.activePackageVersionId ?? pkg.activePackageVersionId;
|
|
75
|
+
if (selectedPvId === pv.packageVersionId)
|
|
76
|
+
onChange(pkg.packageId);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.warn(`Couldn't check a package version change for ${pv.packageId}`, error);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -352,4 +352,9 @@ function subscribeToPrefs(packageId) {
|
|
|
352
352
|
subscribeToPrefs(pkg.packageId);
|
|
353
353
|
reloadPackage(pkg.packageId);
|
|
354
354
|
});
|
|
355
|
+
// A promotion changes only the selected version's row, and can let a refused screen load.
|
|
356
|
+
(0, runnable_version_1.onSelectedPackageVersionChanged)((packageId) => {
|
|
357
|
+
if (packageId in uiLoadingPromises)
|
|
358
|
+
reloadPackage(packageId);
|
|
359
|
+
});
|
|
355
360
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peers-app/peers-ui",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/peers-app/peers-ui.git"
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"release:minor": "npm run release:guard && npm run clean && npm run build && npm version minor && git push && git push --tags",
|
|
30
30
|
"release:major": "npm run release:guard && npm run clean && npm run build && npm version major && git push && git push --tags",
|
|
31
31
|
"release": "npm run release:patch",
|
|
32
|
-
"test": "jest --no-watchman",
|
|
32
|
+
"test": "jest --no-watchman && node --test src/components/markdown-remark.test.mjs",
|
|
33
33
|
"test:watch": "jest --watch",
|
|
34
34
|
"test:coverage": "jest --coverage",
|
|
35
35
|
"lint": "biome check .",
|
|
36
36
|
"lint:fix": "biome check --write ."
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@peers-app/peers-sdk": "^0.33.
|
|
39
|
+
"@peers-app/peers-sdk": "^0.33.7",
|
|
40
40
|
"bootstrap": "^5.3.3",
|
|
41
41
|
"react": "^18.0.0",
|
|
42
42
|
"react-dom": "^18.0.0"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@babel/preset-react": "^7.24.1",
|
|
48
48
|
"@babel/preset-typescript": "^7.27.1",
|
|
49
49
|
"@biomejs/biome": "2.3.11",
|
|
50
|
-
"@peers-app/peers-sdk": "0.33.
|
|
50
|
+
"@peers-app/peers-sdk": "0.33.7",
|
|
51
51
|
"@testing-library/dom": "^10.4.0",
|
|
52
52
|
"@testing-library/jest-dom": "^6.6.3",
|
|
53
53
|
"@testing-library/react": "^16.3.0",
|