@peers-app/peers-ui 0.34.6 → 0.34.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 (56) hide show
  1. package/dist/command-palette/command-palette-ui.js +14 -14
  2. package/dist/command-palette/command-palette.d.ts +10 -3
  3. package/dist/command-palette/command-palette.js +60 -6
  4. package/dist/command-palette/frame-commands.d.ts +37 -0
  5. package/dist/command-palette/frame-commands.js +43 -0
  6. package/dist/components/markdown-editor/editor.d.ts +5 -4
  7. package/dist/components/markdown-editor/editor.js +10 -145
  8. package/dist/components/markdown-editor/lexical-editor.d.ts +3 -0
  9. package/dist/components/markdown-editor/lexical-editor.js +153 -0
  10. package/dist/components/markdown-render.d.ts +8 -0
  11. package/dist/components/markdown-render.js +143 -0
  12. package/dist/components/markdown-with-mentions.d.ts +1 -1
  13. package/dist/components/markdown-with-mentions.js +7 -129
  14. package/dist/components/trust-level-dropdown.d.ts +6 -1
  15. package/dist/components/trust-level-dropdown.js +43 -14
  16. package/dist/globals.d.ts +13 -2
  17. package/dist/globals.js +24 -2
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.js +9 -1
  20. package/dist/isolated-screens/config.js +1 -5
  21. package/dist/isolated-screens/focus-relay.d.ts +24 -0
  22. package/dist/isolated-screens/focus-relay.js +104 -0
  23. package/dist/isolated-screens/frame-document.d.ts +7 -0
  24. package/dist/isolated-screens/frame-document.js +11 -1
  25. package/dist/isolated-screens/frame-permissions.d.ts +11 -0
  26. package/dist/isolated-screens/frame-permissions.js +33 -0
  27. package/dist/isolated-screens/frame-protocol.d.ts +90 -0
  28. package/dist/isolated-screens/frame-protocol.js +49 -0
  29. package/dist/isolated-screens/frame-runtime.js +115 -16
  30. package/dist/isolated-screens/frame-viewport.d.ts +9 -0
  31. package/dist/isolated-screens/frame-viewport.js +36 -0
  32. package/dist/isolated-screens/global-widgets.d.ts +74 -0
  33. package/dist/isolated-screens/global-widgets.js +270 -0
  34. package/dist/isolated-screens/isolated-screen.d.ts +57 -1
  35. package/dist/isolated-screens/isolated-screen.js +266 -15
  36. package/dist/isolated-screens/piece-frames.js +57 -5
  37. package/dist/isolated-screens/piece-reach.d.ts +24 -0
  38. package/dist/isolated-screens/piece-reach.js +40 -13
  39. package/dist/isolated-screens/widget-box.d.ts +48 -0
  40. package/dist/isolated-screens/widget-box.js +193 -0
  41. package/dist/lazy-module.d.ts +17 -0
  42. package/dist/lazy-module.js +26 -0
  43. package/dist/operator-console/console-session.js +1 -9
  44. package/dist/operator-console/operator-console-state.js +5 -1
  45. package/dist/root-layout/root-layout-host.js +3 -1
  46. package/dist/screens/groups/group-members.js +7 -17
  47. package/dist/screens/invites/accept-invite.js +15 -4
  48. package/dist/screens/packages/package-info.js +2 -1
  49. package/dist/screens/packages/package-widgets-panel.d.ts +15 -0
  50. package/dist/screens/packages/package-widgets-panel.js +64 -0
  51. package/dist/tabs-layout/tabs-state.d.ts +5 -2
  52. package/dist/tabs-layout/tabs-state.js +41 -17
  53. package/dist/ui-contracts/piece-height.d.ts +8 -2
  54. package/dist/ui-contracts/piece-height.js +6 -1
  55. package/dist/ui-contracts/piece.js +1 -1
  56. package/package.json +4 -3
@@ -19,7 +19,7 @@ Object.defineProperty(exports, "launcherApp", { enumerable: true, get: function
19
19
  Object.defineProperty(exports, "normalizeTabHistory", { enumerable: true, get: function () { return tab_order_2.normalizeTabHistory; } });
20
20
  Object.defineProperty(exports, "previousAppTabId", { enumerable: true, get: function () { return tab_order_2.previousAppTabId; } });
21
21
  Object.defineProperty(exports, "tabsByRecentUse", { enumerable: true, get: function () { return tab_order_2.tabsByRecentUse; } });
22
- // Persistent vars for storage (write-only, no subscription to avoid oscillation)
22
+ // The window restores its tabs from storage. In a frame these are live bindings to the host.
23
23
  const _persistentActiveTabs = (0, peers_sdk_1.groupDeviceVar)("activeTabs", {
24
24
  defaultValue: [tab_order_1.launcherApp],
25
25
  });
@@ -33,9 +33,23 @@ let finishNavigationRestore = () => { };
33
33
  const navigationReady = new Promise((resolve) => {
34
34
  finishNavigationRestore = resolve;
35
35
  });
36
- // In-memory observables for UI state (loaded once, then write-through to persistent vars)
37
- /** Open tabs. Writes through to device storage after the initial restore. */
36
+ // Expose the existing binding's reads and subscriptions with the same readiness promise as the
37
+ // window. The host owns the tabs. A frame has no second copy to synchronize or write back.
38
+ function frameNavigationValue(source) {
39
+ return Object.assign(() => source(), {
40
+ subscribe: source.subscribe,
41
+ notifySubscribers: source.notifySubscribers,
42
+ subscriberCount: source.subscriberCount,
43
+ loadingPromise: navigationReady,
44
+ });
45
+ }
46
+ /**
47
+ * Open tabs. Writes through to device storage after the initial restore. In a package's frame
48
+ * they're the host's, read only, and follow it.
49
+ */
38
50
  exports.activeTabs = (() => {
51
+ if ((0, frame_realm_1.frameHost)())
52
+ return frameNavigationValue(_persistentActiveTabs);
39
53
  const obs = (0, peers_sdk_1.observable)([tab_order_1.launcherApp]);
40
54
  // Write-through to persistent var on change
41
55
  obs.subscribe((value) => {
@@ -43,8 +57,10 @@ exports.activeTabs = (() => {
43
57
  });
44
58
  return Object.assign(obs, { loadingPromise: navigationReady });
45
59
  })();
46
- /** Id of the tab whose path is showing. */
60
+ /** Id of the tab whose path is showing. In a package's frame, the host's, kept current. */
47
61
  exports.activeTabId = (() => {
62
+ if ((0, frame_realm_1.frameHost)())
63
+ return frameNavigationValue(_persistentActiveTabId);
48
64
  const obs = (0, peers_sdk_1.observable)("launcher");
49
65
  // Write-through to persistent var on change
50
66
  obs.subscribe((value) => {
@@ -61,6 +77,8 @@ let tabHistoryRestored = false;
61
77
  * Ctrl+Tab), never the tab strip. Kept per device.
62
78
  */
63
79
  exports.tabHistory = (() => {
80
+ if ((0, frame_realm_1.frameHost)())
81
+ return frameNavigationValue(_persistentTabHistory);
64
82
  const obs = (0, peers_sdk_1.observable)([]);
65
83
  obs.subscribe((value) => {
66
84
  if (tabHistoryRestored) {
@@ -69,20 +87,11 @@ exports.tabHistory = (() => {
69
87
  });
70
88
  return Object.assign(obs, { loadingPromise: navigationReady });
71
89
  })();
72
- void Promise.all([
90
+ const navigationLoaded = Promise.all([
73
91
  _persistentActiveTabs.loadingPromise,
74
92
  _persistentActiveTabId.loadingPromise,
75
93
  _persistentTabHistory.loadingPromise,
76
- ]).then(() => {
77
- const restored = restoreNavigationState(_persistentActiveTabs(), _persistentActiveTabId());
78
- (0, exports.activeTabs)(restored.tabs);
79
- if ((0, exports.activeTabId)() !== restored.activeId) {
80
- (0, exports.activeTabId)(restored.activeId);
81
- }
82
- tabHistoryRestored = true;
83
- (0, exports.tabHistory)((0, tab_order_1.normalizeTabHistory)(_persistentTabHistory() ?? [], (0, exports.activeTabs)(), (0, exports.activeTabId)()));
84
- finishNavigationRestore();
85
- });
94
+ ]);
86
95
  function sameIds(left, right) {
87
96
  return left.length === right.length && left.every((id, index) => id === right[index]);
88
97
  }
@@ -92,8 +101,23 @@ function refreshTabHistory() {
92
101
  (0, exports.tabHistory)(next);
93
102
  }
94
103
  }
95
- exports.activeTabs.subscribe(refreshTabHistory);
96
- exports.activeTabId.subscribe(refreshTabHistory);
104
+ if ((0, frame_realm_1.frameHost)()) {
105
+ void navigationLoaded.then(finishNavigationRestore);
106
+ }
107
+ else {
108
+ void navigationLoaded.then(() => {
109
+ const restored = restoreNavigationState(_persistentActiveTabs(), _persistentActiveTabId());
110
+ (0, exports.activeTabs)(restored.tabs);
111
+ if ((0, exports.activeTabId)() !== restored.activeId) {
112
+ (0, exports.activeTabId)(restored.activeId);
113
+ }
114
+ tabHistoryRestored = true;
115
+ (0, exports.tabHistory)((0, tab_order_1.normalizeTabHistory)(_persistentTabHistory() ?? [], (0, exports.activeTabs)(), (0, exports.activeTabId)()));
116
+ finishNavigationRestore();
117
+ });
118
+ exports.activeTabs.subscribe(refreshTabHistory);
119
+ exports.activeTabId.subscribe(refreshTabHistory);
120
+ }
97
121
  /** Tab ids whose bodies have been mounted at least once. */
98
122
  exports.initializedTabs = new Set();
99
123
  /**
@@ -1,9 +1,10 @@
1
+ import type React from "react";
1
2
  /**
2
3
  * How the box a piece draws in is sized: `fill` for a view that fills its embedder's box,
3
4
  * `content` for one that takes its own height, and for a popover. A piece drawn in a frame of its
4
5
  * own reads it to know whether to report its height.
5
6
  */
6
- export declare const PieceHeightContext: import("react").Context<"fill" | "content">;
7
+ export declare const PieceHeightContext: React.Context<"fill" | "content">;
7
8
  /** The size of the box a piece draws in. */
8
9
  export interface IPieceSize {
9
10
  /** Width in CSS pixels. */
@@ -15,4 +16,9 @@ export interface IPieceSize {
15
16
  * The measured size of the box a piece draws in, which `usePieceSize` reads. `<Piece>` measures
16
17
  * its box; a piece drawn in a frame of its own is measured inside that frame.
17
18
  */
18
- export declare const PieceSizeContext: import("react").Context<IPieceSize>;
19
+ export declare const PieceSizeContext: React.Context<IPieceSize>;
20
+ /**
21
+ * The embedder's `loading` view for the piece drawn here. A piece drawn in a frame of its own
22
+ * keeps showing it until that frame has drawn the piece.
23
+ */
24
+ export declare const PieceLoadingContext: React.Context<(() => React.ReactNode) | undefined>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PieceSizeContext = exports.PieceHeightContext = void 0;
3
+ exports.PieceLoadingContext = exports.PieceSizeContext = exports.PieceHeightContext = void 0;
4
4
  const react_1 = require("react");
5
5
  /**
6
6
  * How the box a piece draws in is sized: `fill` for a view that fills its embedder's box,
@@ -13,3 +13,8 @@ exports.PieceHeightContext = (0, react_1.createContext)("content");
13
13
  * its box; a piece drawn in a frame of its own is measured inside that frame.
14
14
  */
15
15
  exports.PieceSizeContext = (0, react_1.createContext)({ width: 0, height: 0 });
16
+ /**
17
+ * The embedder's `loading` view for the piece drawn here. A piece drawn in a frame of its own
18
+ * keeps showing it until that frame has drawn the piece.
19
+ */
20
+ exports.PieceLoadingContext = (0, react_1.createContext)(undefined);
@@ -225,7 +225,7 @@ function Piece(props) {
225
225
  return unavailable({ reason: "failed", message: checked.error, retry });
226
226
  }
227
227
  const Component = current.component;
228
- const body = ((0, jsx_runtime_1.jsx)(PieceErrorBoundary, { resetKey: Component, name: props.of.name, onRetry: retry, render: (value) => unavailable(value, true), children: (0, jsx_runtime_1.jsx)(PieceAncestry.Provider, { value: inside, children: (0, jsx_runtime_1.jsx)(Component, { props: checked?.value ?? {}, emit: emit ?? {}, close: () => closeRef.current?.(), groupId: available.dataContextId }) }) }, attempt));
228
+ const body = ((0, jsx_runtime_1.jsx)(PieceErrorBoundary, { resetKey: Component, name: props.of.name, onRetry: retry, render: (value) => unavailable(value, true), children: (0, jsx_runtime_1.jsx)(PieceAncestry.Provider, { value: inside, children: (0, jsx_runtime_1.jsx)(piece_height_1.PieceLoadingContext.Provider, { value: props.loading, children: (0, jsx_runtime_1.jsx)(Component, { props: checked?.value ?? {}, emit: emit ?? {}, close: () => closeRef.current?.(), groupId: available.dataContextId }) }) }) }, attempt));
229
229
  if (isPopover) {
230
230
  return ((0, jsx_runtime_1.jsx)(popover_surface_1.PopoverSurface, { anchor: props.anchor, label: props.label, onClose: () => closeRef.current?.(), children: (0, jsx_runtime_1.jsx)(piece_height_1.PieceHeightContext.Provider, { value: "content", children: body }) }));
231
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peers-app/peers-ui",
3
- "version": "0.34.6",
3
+ "version": "0.34.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/peers-app/peers-ui.git"
@@ -36,7 +36,7 @@
36
36
  "lint:fix": "biome check --write ."
37
37
  },
38
38
  "peerDependencies": {
39
- "@peers-app/peers-sdk": "^0.34.6",
39
+ "@peers-app/peers-sdk": "^0.34.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.34.6",
50
+ "@peers-app/peers-sdk": "0.34.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",
@@ -107,6 +107,7 @@
107
107
  "ml-tree-similarity": "^2.2.0",
108
108
  "moment": "^2.30.1",
109
109
  "moment-timezone": "^0.5.46",
110
+ "prismjs": "^1.30.0",
110
111
  "react-infinite-scroll-component": "^6.1.0",
111
112
  "react-markdown": "^9.0.1",
112
113
  "react-qr-code": "^2.2.0",