@peers-app/peers-ui 0.33.6 → 0.33.8

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.
Files changed (31) hide show
  1. package/dist/components/markdown-editor/editor.d.ts +40 -3
  2. package/dist/components/markdown-editor/editor.js +8 -3
  3. package/dist/components/markdown-editor/markdown-plugin.d.ts +4 -1
  4. package/dist/components/markdown-editor/markdown-plugin.js +32 -20
  5. package/dist/components/markdown-editor/mention-node.d.ts +28 -15
  6. package/dist/components/markdown-editor/mention-node.js +75 -129
  7. package/dist/components/markdown-editor/mention-preview-card.d.ts +13 -0
  8. package/dist/components/markdown-editor/mention-preview-card.js +30 -0
  9. package/dist/components/markdown-editor/mentions-plugin.d.ts +43 -4
  10. package/dist/components/markdown-editor/mentions-plugin.js +211 -107
  11. package/dist/components/markdown-editor/selection-effects-plugin.d.ts +18 -0
  12. package/dist/components/markdown-editor/selection-effects-plugin.js +49 -0
  13. package/dist/components/markdown-with-mentions.d.ts +12 -2
  14. package/dist/components/markdown-with-mentions.js +110 -110
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.js +9 -1
  17. package/dist/mentions/mention-chip.d.ts +33 -0
  18. package/dist/mentions/mention-chip.js +76 -0
  19. package/dist/mentions/mention-chooser.d.ts +9 -0
  20. package/dist/mentions/mention-chooser.js +51 -0
  21. package/dist/mentions/mentions-client.d.ts +47 -0
  22. package/dist/mentions/mentions-client.js +198 -0
  23. package/dist/notifications/notifications-client.d.ts +3 -3
  24. package/dist/notifications/notifications-client.js +6 -63
  25. package/dist/root-layout/root-layout-host.js +2 -2
  26. package/dist/theme.css +224 -0
  27. package/dist/ui-router/open-in-group.d.ts +17 -0
  28. package/dist/ui-router/open-in-group.js +81 -0
  29. package/dist/ui-router/routes-loader.js +46 -27
  30. package/dist/ui-router/runnable-version.js +2 -1
  31. package/package.json +4 -4
@@ -40,6 +40,47 @@ async function recheckPackage(packageId) {
40
40
  }
41
41
  reloadPackage(packageId);
42
42
  }
43
+ const refreshing = {};
44
+ /**
45
+ * Bring one package's entry up to date after its Packages row changed. The list keeps what
46
+ * {@link loadAllRoutes} would list now (not disabled, with a selected version), so a package
47
+ * installed while the app is open appears once its version is activated, and its routes load
48
+ * then. Its routes bundle still runs only when `resolveRunnableVersion` allows it. Refreshes of
49
+ * one package run one at a time, each from the stored row, so a slow one can't overwrite a newer.
50
+ */
51
+ function refreshPackage(packageId) {
52
+ const next = (refreshing[packageId] ?? Promise.resolve()).then(async () => {
53
+ try {
54
+ const pkg = await (0, peers_sdk_1.Packages)().get(packageId);
55
+ const listed = !!pkg && !pkg.disabled && !!pkg.activePackageVersionId;
56
+ const entry = pkg && listed ? await enrichWithPvAppNavs(pkg) : undefined;
57
+ const _allPackages = (0, exports.allPackages)();
58
+ const idx = _allPackages.findIndex((p) => p.packageId === packageId);
59
+ if (entry) {
60
+ if (idx >= 0)
61
+ _allPackages[idx] = entry;
62
+ else
63
+ _allPackages.push(entry);
64
+ subscribeToPrefs(packageId);
65
+ }
66
+ else if (idx >= 0) {
67
+ _allPackages.splice(idx, 1);
68
+ }
69
+ (0, exports.allPackages)([..._allPackages]);
70
+ if (!entry)
71
+ return;
72
+ if (packageId in routeLoadingPromises)
73
+ reloadPackage(packageId);
74
+ else
75
+ await loadRoutesBundle(entry);
76
+ }
77
+ catch (error) {
78
+ console.warn(`Couldn't refresh the app links of package ${packageId}`, error);
79
+ }
80
+ });
81
+ refreshing[packageId] = next;
82
+ return next;
83
+ }
43
84
  /**
44
85
  * Enrich an IPackage with appNavs from the device's active PackageVersion record.
45
86
  */
@@ -62,33 +103,10 @@ const loadAllRoutes = async () => {
62
103
  for (const pkg of enriched) {
63
104
  subscribeToPrefs(pkg.packageId);
64
105
  }
65
- (0, peers_sdk_1.Packages)().dataChanged.subscribe(async (evt) => {
66
- const enrichedPkg = await enrichWithPvAppNavs(evt.dataObject);
67
- const _allPackages = (0, exports.allPackages)();
68
- if (evt.op === "insert") {
69
- _allPackages.push(enrichedPkg);
70
- subscribeToPrefs(evt.dataObject.packageId);
71
- }
72
- else if (evt.op === "delete") {
73
- const idx = _allPackages.findIndex((p) => p.packageId === evt.dataObject.packageId);
74
- if (idx >= 0) {
75
- _allPackages.splice(idx, 1);
76
- }
77
- }
78
- else {
79
- const idx = _allPackages.findIndex((p) => p.packageId === evt.dataObject.packageId);
80
- if (idx >= 0) {
81
- _allPackages[idx] = enrichedPkg;
82
- }
83
- }
84
- (0, exports.allPackages)([..._allPackages]);
85
- });
86
106
  (0, peers_sdk_1.Packages)().dataChanged.subscribe((evt) => {
87
- const pkg = evt.dataObject;
88
- const loadingPromise = routeLoadingPromises[pkg.packageId];
89
- if (!loadingPromise)
90
- return;
91
- reloadPackage(pkg.packageId);
107
+ const packageId = evt.dataObject?.packageId;
108
+ if (packageId)
109
+ void refreshPackage(packageId);
92
110
  });
93
111
  // A promotion changes only the selected version's row (dev to beta or stable).
94
112
  (0, runnable_version_1.onSelectedPackageVersionChanged)((packageId) => void recheckPackage(packageId));
@@ -144,7 +162,8 @@ function loadRoutesBundle(pkg, forceRefresh) {
144
162
  }
145
163
  const reloadPackage = (0, peers_sdk_1.debounceByArgs)(async (packageId) => {
146
164
  const pkg = await (0, peers_sdk_1.Packages)().get(packageId);
147
- if (pkg) {
165
+ // A refresh queued before the package was disabled must not run its routes afterwards.
166
+ if (pkg && !pkg.disabled) {
148
167
  await loadRoutesBundle(pkg, true);
149
168
  }
150
169
  }, 200);
@@ -22,7 +22,8 @@ async function resolveRunnableVersion(pkg) {
22
22
  try {
23
23
  const dataContext = await (0, peers_sdk_1.getDefaultDataContext)();
24
24
  const stored = await (0, peers_sdk_1.Packages)(dataContext).get(pkg.packageId);
25
- if (!stored)
25
+ // The package may have been disabled since the caller read its row.
26
+ if (!stored || stored.disabled)
26
27
  return undefined;
27
28
  let devicePvId;
28
29
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-ui",
3
- "version": "0.33.6",
3
+ "version": "0.33.8",
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.6",
39
+ "@peers-app/peers-sdk": "^0.33.8",
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.6",
50
+ "@peers-app/peers-sdk": "0.33.8",
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",