@crewlethq/ui 0.17.1 → 0.19.0

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 (226) hide show
  1. package/README.md +55 -3
  2. package/dist/AccessDeniedCard/AccessDeniedCard.d.ts +39 -0
  3. package/dist/AccessDeniedCard/index.d.ts +3 -0
  4. package/dist/AccessDeniedCard/index.js +8 -0
  5. package/dist/AccessDeniedCard-WXM5DBDZ.css +8 -0
  6. package/dist/AppShell/index.js +2 -2
  7. package/dist/ArrangeBoard/ArrangeBoard.d.ts +32 -0
  8. package/dist/ArrangeBoard/index.d.ts +3 -0
  9. package/dist/ArrangeBoard/index.js +2 -0
  10. package/dist/ArrangeBoard-MQE35P6Z.css +80 -0
  11. package/dist/ArrangeFrame/ArrangeFrame.d.ts +82 -0
  12. package/dist/ArrangeFrame/index.d.ts +5 -0
  13. package/dist/ArrangeFrame/index.js +5 -0
  14. package/dist/ArrangeFrame/useGridResize.d.ts +66 -0
  15. package/dist/ArrangeFrame-3PLZAG22.css +329 -0
  16. package/dist/ArrangeGroup/ArrangeGroup.d.ts +42 -0
  17. package/dist/ArrangeGroup/index.d.ts +3 -0
  18. package/dist/ArrangeGroup/index.js +4 -0
  19. package/dist/ArrangeGroup-SHFHA7BE.css +170 -0
  20. package/dist/ArrangeList/ArrangeList.d.ts +64 -0
  21. package/dist/ArrangeList/index.d.ts +3 -0
  22. package/dist/ArrangeList/index.js +10 -0
  23. package/dist/ArrangeList-NNRTDFI5.css +94 -0
  24. package/dist/ArtifactCard/ArtifactCard.d.ts +61 -0
  25. package/dist/ArtifactCard/index.d.ts +3 -0
  26. package/dist/ArtifactCard/index.js +12 -0
  27. package/dist/ArtifactCard-EXVAEBV6.css +109 -0
  28. package/dist/AuthLayout/index.js +2 -2
  29. package/dist/AvatarPicker/index.js +5 -5
  30. package/dist/Canvas/index.js +2 -2
  31. package/dist/Card/index.js +1 -1
  32. package/dist/ChangeMark/ChangeMark.d.ts +26 -0
  33. package/dist/ChangeMark/index.d.ts +3 -0
  34. package/dist/ChangeMark/index.js +8 -0
  35. package/dist/ChangeMark-3VMTW7MT.css +22 -0
  36. package/dist/Checkbox/index.js +3 -3
  37. package/dist/Combobox/index.js +3 -3
  38. package/dist/CommandPalette/index.js +5 -5
  39. package/dist/Composer/index.js +3 -3
  40. package/dist/ConfirmField/index.js +3 -3
  41. package/dist/CursorFlag/CursorFlag.d.ts +34 -0
  42. package/dist/CursorFlag/index.d.ts +3 -0
  43. package/dist/CursorFlag/index.js +3 -0
  44. package/dist/CursorFlag-AJQJBUGY.css +61 -0
  45. package/dist/DataTable/index.js +7 -7
  46. package/dist/DataView/index.js +13 -13
  47. package/dist/DateTimePicker/index.js +2 -2
  48. package/dist/Divider/Divider.d.ts +15 -0
  49. package/dist/Divider/index.d.ts +3 -0
  50. package/dist/Divider/index.js +2 -0
  51. package/dist/Divider-3Z77ZAJH.css +37 -0
  52. package/dist/FollowBanner/FollowBanner.d.ts +35 -0
  53. package/dist/FollowBanner/index.d.ts +2 -0
  54. package/dist/FollowBanner/index.js +7 -0
  55. package/dist/FrameProtocol/index.d.ts +2 -0
  56. package/dist/FrameProtocol/index.js +2 -0
  57. package/dist/FrameProtocol/protocol.d.ts +164 -0
  58. package/dist/HuePicker/HuePicker.d.ts +16 -4
  59. package/dist/HuePicker/index.js +3 -3
  60. package/dist/{HuePicker-5QIUR6L7.css → HuePicker-PAIGH6LR.css} +6 -0
  61. package/dist/IconTile/IconTile.d.ts +23 -0
  62. package/dist/IconTile/index.d.ts +3 -0
  63. package/dist/IconTile/index.js +2 -0
  64. package/dist/IconTile-4GNWTLAW.css +30 -0
  65. package/dist/Input/index.js +2 -2
  66. package/dist/LinkInterstitial/LinkInterstitial.d.ts +41 -0
  67. package/dist/LinkInterstitial/index.d.ts +3 -0
  68. package/dist/LinkInterstitial/index.js +11 -0
  69. package/dist/LinkInterstitial-ET4MSVSV.css +34 -0
  70. package/dist/ListInput/index.js +4 -4
  71. package/dist/LiveCursor/LiveCursor.d.ts +34 -0
  72. package/dist/LiveCursor/index.d.ts +3 -0
  73. package/dist/LiveCursor/index.js +4 -0
  74. package/dist/LiveCursor-DZHGIYWE.css +47 -0
  75. package/dist/MarkdownEditor/index.js +3 -3
  76. package/dist/Menu/index.js +2 -2
  77. package/dist/Modal/Modal.d.ts +20 -0
  78. package/dist/Modal/index.js +2 -2
  79. package/dist/{Modal-RQAYGG4L.css → Modal-XOSV6FAH.css} +14 -0
  80. package/dist/Note/Note.d.ts +23 -0
  81. package/dist/Note/index.d.ts +3 -0
  82. package/dist/Note/index.js +2 -0
  83. package/dist/Note-RT4L6VUT.css +58 -0
  84. package/dist/OrgTable/index.js +5 -5
  85. package/dist/PinTile/PinTile.d.ts +37 -0
  86. package/dist/PinTile/index.d.ts +3 -0
  87. package/dist/PinTile/index.js +4 -0
  88. package/dist/PinTile-IIA25MNZ.css +141 -0
  89. package/dist/PresenceModel/index.d.ts +2 -0
  90. package/dist/PresenceModel/index.js +3 -0
  91. package/dist/PresenceModel/presence.d.ts +80 -0
  92. package/dist/PresenceRing/PresenceRing.d.ts +31 -0
  93. package/dist/PresenceRing/index.d.ts +3 -0
  94. package/dist/PresenceRing/index.js +2 -0
  95. package/dist/PresenceRing-M4C22Q6U.css +68 -0
  96. package/dist/PresenceStack/PresenceStack.d.ts +36 -0
  97. package/dist/PresenceStack/index.d.ts +3 -0
  98. package/dist/PresenceStack/index.js +9 -0
  99. package/dist/PresenceStack-QSXQJND5.css +59 -0
  100. package/dist/PricingCard/index.js +2 -2
  101. package/dist/Principal/Principal.d.ts +35 -0
  102. package/dist/Principal/index.d.ts +2 -0
  103. package/dist/Principal/index.js +4 -0
  104. package/dist/PrincipalPicker/PrincipalPicker.d.ts +45 -0
  105. package/dist/PrincipalPicker/index.d.ts +3 -0
  106. package/dist/PrincipalPicker/index.js +12 -0
  107. package/dist/PrincipalPicker-7NNZTGUP.css +41 -0
  108. package/dist/Reorder/index.d.ts +2 -0
  109. package/dist/Reorder/index.js +4 -0
  110. package/dist/Reorder/useReorder.d.ts +138 -0
  111. package/dist/SandboxedFrame/SandboxedFrame.d.ts +142 -0
  112. package/dist/SandboxedFrame/index.d.ts +3 -0
  113. package/dist/SandboxedFrame/index.js +8 -0
  114. package/dist/SandboxedFrame-L6HBQZCD.css +50 -0
  115. package/dist/ShareDialog/ShareDialog.d.ts +101 -0
  116. package/dist/ShareDialog/index.d.ts +5 -0
  117. package/dist/ShareDialog/index.js +19 -0
  118. package/dist/ShareDialog/roles.d.ts +10 -0
  119. package/dist/ShareDialog-YZ4F37MW.css +146 -0
  120. package/dist/SheetGrid/SheetGrid.d.ts +78 -0
  121. package/dist/SheetGrid/cells.d.ts +117 -0
  122. package/dist/SheetGrid/index.d.ts +5 -0
  123. package/dist/SheetGrid/index.js +18 -0
  124. package/dist/SheetGrid-4HOXDVIB.css +595 -0
  125. package/dist/SheetModel/clipboard.d.ts +37 -0
  126. package/dist/SheetModel/edits.d.ts +68 -0
  127. package/dist/SheetModel/index.d.ts +14 -0
  128. package/dist/SheetModel/index.js +3 -0
  129. package/dist/SheetModel/labels.d.ts +71 -0
  130. package/dist/SheetModel/navigation.d.ts +79 -0
  131. package/dist/SheetModel/options.d.ts +28 -0
  132. package/dist/SheetModel/types.d.ts +126 -0
  133. package/dist/SheetModel/values.d.ts +76 -0
  134. package/dist/SheetModel/view.d.ts +32 -0
  135. package/dist/StatGroup/StatGroup.d.ts +7 -1
  136. package/dist/StatGroup/index.js +1 -1
  137. package/dist/{StatGroup-HVG6O62W.css → StatGroup-PADTJCUQ.css} +7 -0
  138. package/dist/Switcher/index.js +8 -8
  139. package/dist/Tag/Tag.d.ts +13 -0
  140. package/dist/Tag/index.js +1 -1
  141. package/dist/{Tag-4BRQS6GN.css → Tag-SRGTK5KI.css} +42 -0
  142. package/dist/TagsInput/index.js +4 -4
  143. package/dist/ThemeSwitcher/apply.d.ts +43 -0
  144. package/dist/ThemeSwitcher/index.d.ts +4 -2
  145. package/dist/ThemeSwitcher/index.js +3 -2
  146. package/dist/ThemeSwitcher/preferences.d.ts +2 -19
  147. package/dist/ThemeToggle/index.js +3 -2
  148. package/dist/TimeWindowPicker/index.js +4 -4
  149. package/dist/Timeline/Timeline.d.ts +7 -2
  150. package/dist/Timeline/index.js +1 -1
  151. package/dist/TreeCanvas/index.js +3 -3
  152. package/dist/TreeGrid/index.js +2 -2
  153. package/dist/VersionTimeline/VersionTimeline.d.ts +76 -0
  154. package/dist/VersionTimeline/index.d.ts +3 -0
  155. package/dist/VersionTimeline/index.js +10 -0
  156. package/dist/VersionTimeline-EBJ6MIPJ.css +108 -0
  157. package/dist/{chunk-SBRE7IML.js → chunk-2ONWEDQT.js} +1 -1
  158. package/dist/chunk-35XVR5JQ.js +81 -0
  159. package/dist/chunk-3BYIWOTV.js +29 -0
  160. package/dist/chunk-4KP4RC3O.js +25 -0
  161. package/dist/chunk-5XACKNYR.js +53 -0
  162. package/dist/chunk-63WJLRB2.js +24 -0
  163. package/dist/{chunk-L4ZLXYPO.js → chunk-6A7P6II6.js} +1 -1
  164. package/dist/chunk-6KWNXIDE.js +18 -0
  165. package/dist/chunk-6MIXD6IW.js +49 -0
  166. package/dist/{chunk-FA2V2VT6.js → chunk-7FQEUNHX.js} +4 -4
  167. package/dist/{chunk-DEEVA6TV.js → chunk-7IJARUIF.js} +17 -4
  168. package/dist/{chunk-JCO3SIST.js → chunk-7ZNKEPLN.js} +2 -2
  169. package/dist/chunk-AIVZVKYZ.js +126 -0
  170. package/dist/{chunk-FSKTOIYC.js → chunk-AJESMWJS.js} +5 -5
  171. package/dist/{chunk-O67VF5MS.js → chunk-AUQPBL4O.js} +2 -2
  172. package/dist/chunk-CENOOTAV.js +1 -0
  173. package/dist/chunk-DEJHAOC5.js +279 -0
  174. package/dist/{chunk-UCYIRDND.js → chunk-DQSXWQMJ.js} +1 -1
  175. package/dist/{chunk-JF7X673Z.js → chunk-EIGEIT4O.js} +2 -2
  176. package/dist/chunk-F6V2PTN6.js +142 -0
  177. package/dist/chunk-FFMCMSJB.js +1 -0
  178. package/dist/chunk-FW7HN6AP.js +40 -0
  179. package/dist/chunk-G3EEUNZQ.js +46 -0
  180. package/dist/{chunk-LOECRMHA.js → chunk-GFV4LJHH.js} +4 -3
  181. package/dist/chunk-HTCJSUIZ.js +216 -0
  182. package/dist/{chunk-75CLJNDQ.js → chunk-I6NZKJGK.js} +1 -1
  183. package/dist/chunk-I6POAB4V.js +20 -0
  184. package/dist/chunk-IXJHTFXG.js +17 -0
  185. package/dist/chunk-JEDWC3GI.js +98 -0
  186. package/dist/{chunk-QVAFL2LE.js → chunk-JXRI5YD2.js} +3 -3
  187. package/dist/{chunk-ZFH7H7GS.js → chunk-LOLELDBW.js} +1 -1
  188. package/dist/{chunk-6TSZCBID.js → chunk-NP2C4Y4E.js} +1 -1
  189. package/dist/{chunk-6NN2F7GM.js → chunk-OIMAK5AE.js} +6 -6
  190. package/dist/chunk-PPAQFGS2.js +12 -0
  191. package/dist/chunk-PUQY4WXR.js +1235 -0
  192. package/dist/chunk-QO7QEQKV.js +24 -0
  193. package/dist/chunk-RT323I4I.js +49 -0
  194. package/dist/chunk-S35G6PNC.js +80 -0
  195. package/dist/{chunk-HENOTGUV.js → chunk-T7ICFXEC.js} +2 -2
  196. package/dist/{chunk-2OLCUNG7.js → chunk-TBIZSQHB.js} +1 -1
  197. package/dist/chunk-TODND5AD.js +99 -0
  198. package/dist/{chunk-PQ63NLFC.js → chunk-UXELEORU.js} +3 -3
  199. package/dist/{chunk-6NIMZ5XC.js → chunk-VJLYGPPE.js} +1 -1
  200. package/dist/chunk-VYDFB6PJ.js +243 -0
  201. package/dist/{chunk-7QFAORCY.js → chunk-WHZFDS62.js} +1 -1
  202. package/dist/chunk-WXAULPBH.js +135 -0
  203. package/dist/chunk-XJ2QEBMM.js +277 -0
  204. package/dist/{chunk-NXDEPUVG.js → chunk-XU4ZUGLE.js} +20 -5
  205. package/dist/chunk-YM3GJHGW.js +69 -0
  206. package/dist/{chunk-T3ZWBZ65.js → chunk-YSJYWQSP.js} +2 -2
  207. package/dist/{chunk-CXBAIVYZ.js → chunk-YSY6UJ4F.js} +1 -1
  208. package/dist/chunk-YYZRLLLY.js +822 -0
  209. package/dist/{chunk-EG6NYWVK.js → chunk-YZCJ63JF.js} +1 -1
  210. package/dist/{chunk-K3OWD7BJ.js → chunk-Z24ZUSTX.js} +4 -19
  211. package/dist/chunk-ZXXDZJQN.js +36 -0
  212. package/dist/generated/index.d.ts +27 -0
  213. package/dist/generated/index.js +98 -69
  214. package/dist/index.js +98 -69
  215. package/dist/styles.css +13625 -11206
  216. package/dist/utils/index.js +1 -1
  217. package/package.json +3 -3
  218. package/dist/chunk-EXHQ2QVW.js +0 -1
  219. package/dist/{chunk-CRVETI5L.js → chunk-4Z7PW3L6.js} +0 -0
  220. package/dist/{chunk-OYOQU7O5.js → chunk-EDGCPVVD.js} +1 -1
  221. package/dist/{chunk-NS7BVLL3.js → chunk-JULMZNGT.js} +1 -1
  222. package/dist/{chunk-2UU5IGZI.js → chunk-L4H7SSWF.js} +1 -1
  223. package/dist/{chunk-4GB57WIT.js → chunk-Q55TXPA3.js} +1 -1
  224. package/dist/{chunk-77IEHFY4.js → chunk-QQGWES46.js} +1 -1
  225. package/dist/{chunk-B2Z2CDM5.js → chunk-T5TFZ2JB.js} +1 -1
  226. package/dist/{chunk-AMH67MLM.js → chunk-TXAFKH2A.js} +1 -1
@@ -0,0 +1,24 @@
1
+ import { cx } from './chunk-ODEQTPFM.js';
2
+ import './ArrangeBoard-MQE35P6Z.css';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ function ArrangeBoard({
6
+ editing,
7
+ columns = 12,
8
+ className,
9
+ style,
10
+ children,
11
+ ...rest
12
+ }) {
13
+ return /* @__PURE__ */ jsx(
14
+ "div",
15
+ {
16
+ className: cx("crewlet-arrange-board", editing && "is-editing", className),
17
+ style: { ...style, "--crewlet-arrange-board-columns": columns },
18
+ ...rest,
19
+ children
20
+ }
21
+ );
22
+ }
23
+
24
+ export { ArrangeBoard };
@@ -0,0 +1,49 @@
1
+ import { ConfirmModal } from './chunk-7IJARUIF.js';
2
+ import { InlineCode } from './chunk-5CLW2CXT.js';
3
+ import { Callout } from './chunk-SVSCLHHI.js';
4
+ import './LinkInterstitial-ET4MSVSV.css';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ var LABELS = {
8
+ title: "Open an external link?",
9
+ intro: (source) => source ? `${source} wants to open a page outside Crewlet. Open it only if you trust where it goes.` : "This page wants to open a link outside Crewlet. Open it only if you trust where it goes.",
10
+ destination: "Destination",
11
+ insecure: "This link does not use a secure connection, so anyone on the network can read what you send to it.",
12
+ open: "Open link",
13
+ cancel: "Cancel"
14
+ };
15
+ function openExternal(url) {
16
+ window.open(url.href, "_blank", "noopener,noreferrer");
17
+ }
18
+ function LinkInterstitial({ url, source, onClose, onOpened, labels }) {
19
+ const text = { ...LABELS, ...labels };
20
+ const mail = url?.protocol === "mailto:";
21
+ const where = url ? mail ? decodeURIComponent(url.pathname) : url.hostname : "";
22
+ return /* @__PURE__ */ jsx(
23
+ ConfirmModal,
24
+ {
25
+ open: url !== null,
26
+ onClose,
27
+ onConfirm: () => {
28
+ if (!url) return;
29
+ openExternal(url);
30
+ onOpened?.(url);
31
+ onClose();
32
+ },
33
+ title: text.title,
34
+ message: text.intro(source),
35
+ confirmLabel: text.open,
36
+ cancelLabel: text.cancel,
37
+ shape: "framed",
38
+ size: "md",
39
+ children: url ? /* @__PURE__ */ jsxs("div", { className: "crewlet-link-interstitial", children: [
40
+ /* @__PURE__ */ jsx("span", { className: "crewlet-link-interstitial__label", children: text.destination }),
41
+ /* @__PURE__ */ jsx("span", { className: "crewlet-link-interstitial__host", children: where }),
42
+ /* @__PURE__ */ jsx(InlineCode, { className: "crewlet-link-interstitial__href", children: url.href }),
43
+ url.protocol === "http:" ? /* @__PURE__ */ jsx(Callout, { variant: "warning", children: text.insecure }) : null
44
+ ] }) : null
45
+ }
46
+ );
47
+ }
48
+
49
+ export { LinkInterstitial, openExternal };
@@ -0,0 +1,80 @@
1
+ import { NODE_HUES } from './chunk-AYKXMIOR.js';
2
+
3
+ // src/PresenceModel/presence.ts
4
+ var PRESENCE_ACTIVITIES = ["editing", "viewing", "idle"];
5
+ var BAND = {
6
+ editing: { human: 0, agent: 1 },
7
+ viewing: { human: 2, agent: 3 },
8
+ idle: { human: 4, agent: 5 }
9
+ };
10
+ function presenceOrder(members) {
11
+ return members.map((member, index) => ({ member, index })).sort((a, b) => BAND[a.member.activity][a.member.kind] - BAND[b.member.activity][b.member.kind] || a.index - b.index).map(({ member }) => member);
12
+ }
13
+ var LIVELINESS = { editing: 2, viewing: 1, idle: 0 };
14
+ function collapseSessions(members) {
15
+ const bySeat = /* @__PURE__ */ new Map();
16
+ const out = [];
17
+ for (const member of members) {
18
+ if (member.seat === void 0) {
19
+ out.push(member);
20
+ continue;
21
+ }
22
+ const at = bySeat.get(member.seat);
23
+ if (at === void 0) {
24
+ bySeat.set(member.seat, out.length);
25
+ out.push(member);
26
+ } else if (LIVELINESS[member.activity] > LIVELINESS[out[at].activity]) {
27
+ out[at] = member;
28
+ }
29
+ }
30
+ return out;
31
+ }
32
+ function assignPresenceHues(members, held = /* @__PURE__ */ new Map()) {
33
+ const out = /* @__PURE__ */ new Map();
34
+ const uses = new Map(NODE_HUES.map((hue) => [hue, 0]));
35
+ const take = (id, hue) => {
36
+ out.set(id, hue);
37
+ uses.set(hue, (uses.get(hue) ?? 0) + 1);
38
+ };
39
+ for (const member of members) {
40
+ if (member.kind === "agent" && member.hue !== void 0) take(member.id, member.hue);
41
+ }
42
+ for (const member of members) {
43
+ if (out.has(member.id)) continue;
44
+ const previous = held.get(member.id);
45
+ if (previous !== void 0) take(member.id, previous);
46
+ }
47
+ for (const member of members) {
48
+ if (out.has(member.id)) continue;
49
+ let pick = NODE_HUES[0];
50
+ for (const hue of NODE_HUES) if ((uses.get(hue) ?? 0) < (uses.get(pick) ?? 0)) pick = hue;
51
+ take(member.id, pick);
52
+ }
53
+ return out;
54
+ }
55
+ function joinNames(names, shown = 2) {
56
+ if (names.length === 0) return "";
57
+ if (names.length === 1) return names[0];
58
+ if (names.length <= shown) return `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
59
+ const rest = names.length - shown;
60
+ return `${names.slice(0, shown).join(", ")} and ${rest === 1 ? "1 other" : `${rest} others`}`;
61
+ }
62
+ var PRESENCE_LABELS = {
63
+ activity: (activity, kind) => activity === "editing" ? "Editing" : activity === "idle" ? "Idle" : kind === "agent" ? "Reading" : "Viewing",
64
+ here: (others, withSelf) => {
65
+ if (withSelf) return others === 0 ? "Only you are here" : `You and ${others === 1 ? "1 other" : `${others} others`} are here`;
66
+ return others === 1 ? "1 person is here" : `${others} people are here`;
67
+ },
68
+ member: (member) => {
69
+ if (member.location) return `${member.name}, ${member.location}`;
70
+ return `${member.name}, ${PRESENCE_LABELS.activity(member.activity, member.kind).toLowerCase()}`;
71
+ },
72
+ more: (count) => `${count} more`,
73
+ editing: (names) => `${names} is editing`,
74
+ alsoHere: (names) => names.length === 0 ? "" : `${joinNames(names)} ${names.length === 1 ? "is" : "are"} also here.`
75
+ };
76
+ function presenceLabels(overrides) {
77
+ return { ...PRESENCE_LABELS, ...overrides };
78
+ }
79
+
80
+ export { PRESENCE_ACTIVITIES, PRESENCE_LABELS, assignPresenceHues, collapseSessions, joinNames, presenceLabels, presenceOrder };
@@ -1,6 +1,6 @@
1
- import { HuePicker } from './chunk-NXDEPUVG.js';
2
- import { NODE_HUE_NAMES } from './chunk-AYKXMIOR.js';
1
+ import { HuePicker } from './chunk-XU4ZUGLE.js';
3
2
  import { Popover } from './chunk-BWRGFKJP.js';
3
+ import { NODE_HUE_NAMES } from './chunk-AYKXMIOR.js';
4
4
  import { CharacterPicker } from './chunk-5PSXBL73.js';
5
5
  import { Avatar } from './chunk-5OM447RW.js';
6
6
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,5 +1,5 @@
1
1
  import { useTreeState, useMeasuredSizes, layoutForest, treeAncestors, useLayoutAnchor, treeExpandable, layoutConnectors, treeItemAction, treeStep, treePosInSet, treeSetSize, treeLevel, placeGroups } from './chunk-MY374UUD.js';
2
- import { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, Canvas } from './chunk-AMH67MLM.js';
2
+ import { CANVAS_COMPOSE_CONTEXT, CANVAS_FIT_MAX_ZOOM, Canvas } from './chunk-TXAFKH2A.js';
3
3
  import { focusables } from './chunk-R25RGPUB.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
5
5
  import './TreeCanvas-L2XYONWL.css';
@@ -0,0 +1,99 @@
1
+ import { PrincipalAvatar } from './chunk-4KP4RC3O.js';
2
+ import { RelativeTime } from './chunk-3CZ7XAVY.js';
3
+ import { AvatarStack } from './chunk-UAN5NE7M.js';
4
+ import { Card } from './chunk-YZCJ63JF.js';
5
+ import { VisuallyHidden } from './chunk-BZFWDIV6.js';
6
+ import { cx } from './chunk-ODEQTPFM.js';
7
+ import './ArtifactCard-EXVAEBV6.css';
8
+ import { useId } from 'react';
9
+ import { TableGlyph, FileTextGlyph, FileCodeGlyph, PinGlyph } from '@crewlethq/icons/glyphs';
10
+ import { jsx, jsxs } from 'react/jsx-runtime';
11
+
12
+ var ARTIFACT_KINDS = ["html", "markdown", "sheet"];
13
+ var KIND_GLYPHS = {
14
+ html: FileCodeGlyph,
15
+ markdown: FileTextGlyph,
16
+ sheet: TableGlyph
17
+ };
18
+ function ArtifactKindGlyph({ kind, size = "md" }) {
19
+ const Drawn = KIND_GLYPHS[kind];
20
+ return /* @__PURE__ */ jsx(Drawn, { size });
21
+ }
22
+ var LABELS = {
23
+ kinds: { html: "Page", markdown: "Document", sheet: "Sheet" },
24
+ pinned: "Pinned",
25
+ version: (version) => `v${version}`,
26
+ changes: (count) => count === 1 ? "1 change since you looked" : `${count} changes since you looked`,
27
+ present: (count) => count === 1 ? "1 here now" : `${count} here now`,
28
+ updated: "Updated"
29
+ };
30
+ function ArtifactCard({
31
+ title,
32
+ kind,
33
+ href,
34
+ preview,
35
+ owner,
36
+ updatedAt,
37
+ updatedBy,
38
+ presence,
39
+ changes,
40
+ pinned = false,
41
+ version,
42
+ project,
43
+ size = "card",
44
+ className,
45
+ now,
46
+ labels
47
+ }) {
48
+ const text = { ...LABELS, ...labels, kinds: { ...LABELS.kinds, ...labels?.kinds } };
49
+ const titleId = useId();
50
+ const factsId = useId();
51
+ const present = presence && presence.length > 0 ? presence : null;
52
+ return /* @__PURE__ */ jsxs(
53
+ Card,
54
+ {
55
+ href,
56
+ variant: "subtle",
57
+ padding: "none",
58
+ className: cx("crewlet-artifact-card", `crewlet-artifact-card--${size}`, className),
59
+ "aria-labelledby": titleId,
60
+ "aria-describedby": factsId,
61
+ children: [
62
+ size === "card" ? /* @__PURE__ */ jsx("span", { className: "crewlet-artifact-card__preview", "aria-hidden": true, children: preview ?? /* @__PURE__ */ jsx("span", { className: "crewlet-artifact-card__glyph", children: /* @__PURE__ */ jsx(ArtifactKindGlyph, { kind, size: 32 }) }) }) : /* @__PURE__ */ jsx("span", { className: "crewlet-artifact-card__glyph crewlet-artifact-card__glyph--compact", "aria-hidden": true, children: /* @__PURE__ */ jsx(ArtifactKindGlyph, { kind, size: "lg" }) }),
63
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__body", children: [
64
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__title-row", children: [
65
+ /* @__PURE__ */ jsx("span", { id: titleId, className: "crewlet-artifact-card__title", children: title }),
66
+ pinned ? /* @__PURE__ */ jsx("span", { className: "crewlet-artifact-card__pin", title: text.pinned, "aria-hidden": true, children: /* @__PURE__ */ jsx(PinGlyph, { size: "xs" }) }) : null
67
+ ] }),
68
+ /* @__PURE__ */ jsxs("span", { id: factsId, className: "crewlet-artifact-card__facts", children: [
69
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__line", children: [
70
+ /* @__PURE__ */ jsx("span", { children: text.kinds[kind] }),
71
+ project ? /* @__PURE__ */ jsx("span", { children: project }) : null,
72
+ version !== void 0 ? /* @__PURE__ */ jsx("span", { children: text.version(version) }) : null,
73
+ pinned ? /* @__PURE__ */ jsx(VisuallyHidden, { children: text.pinned }) : null
74
+ ] }),
75
+ /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__line", children: [
76
+ owner ? /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__owner", children: [
77
+ /* @__PURE__ */ jsx(PrincipalAvatar, { principal: owner, size: "xs" }),
78
+ /* @__PURE__ */ jsx("span", { children: owner.name })
79
+ ] }) : null,
80
+ /* @__PURE__ */ jsxs("span", { children: [
81
+ updatedBy ? `${updatedBy} ` : `${text.updated} `,
82
+ /* @__PURE__ */ jsx(RelativeTime, { value: updatedAt, now })
83
+ ] })
84
+ ] }),
85
+ present || changes !== void 0 && changes > 0 ? /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__line", children: [
86
+ present ? /* @__PURE__ */ jsxs("span", { className: "crewlet-artifact-card__presence", children: [
87
+ /* @__PURE__ */ jsx(AvatarStack, { members: present, max: 3, size: "xs", decorative: true }),
88
+ /* @__PURE__ */ jsx("span", { children: text.present(present.length) })
89
+ ] }) : null,
90
+ changes !== void 0 && changes > 0 ? /* @__PURE__ */ jsx("span", { className: "crewlet-artifact-card__changes", children: text.changes(changes) }) : null
91
+ ] }) : null
92
+ ] })
93
+ ] })
94
+ ]
95
+ }
96
+ );
97
+ }
98
+
99
+ export { ARTIFACT_KINDS, ArtifactCard, ArtifactKindGlyph };
@@ -1,9 +1,9 @@
1
- import { Modal } from './chunk-DEEVA6TV.js';
1
+ import { Modal } from './chunk-7IJARUIF.js';
2
2
  import { useListbox, useHighlightRest } from './chunk-F73MC7EZ.js';
3
3
  import { Kbd } from './chunk-SMBKXWML.js';
4
- import { Input } from './chunk-4GB57WIT.js';
5
- import { isComposing } from './chunk-R25RGPUB.js';
4
+ import { Input } from './chunk-Q55TXPA3.js';
6
5
  import { Count } from './chunk-BHHIIK3M.js';
6
+ import { isComposing } from './chunk-R25RGPUB.js';
7
7
  import { VisuallyHidden } from './chunk-BZFWDIV6.js';
8
8
  import { cx } from './chunk-ODEQTPFM.js';
9
9
  import './CommandPalette-HBTNKHZQ.css';
@@ -1,5 +1,5 @@
1
1
  import { Kbd } from './chunk-SMBKXWML.js';
2
- import { Textarea } from './chunk-4GB57WIT.js';
2
+ import { Textarea } from './chunk-Q55TXPA3.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './Composer-ABGJIAIR.css';
5
5
  import { forwardRef } from 'react';
@@ -0,0 +1,243 @@
1
+ import { Skeleton } from './chunk-W5J7R5EB.js';
2
+ import { frameThemeMessage, readFrameHello, frameOriginMatches, negotiateBridge, FRAME_MESSAGE, portTargetOrigin, checkFrameSandbox, httpOrigin, isFrameNonce, frameFragment, readOpenLink, externalUrl, isFocusExit } from './chunk-F6V2PTN6.js';
3
+ import { Callout } from './chunk-SVSCLHHI.js';
4
+ import { Button } from './chunk-OG6CL3EB.js';
5
+ import { cx } from './chunk-ODEQTPFM.js';
6
+ import './SandboxedFrame-L6HBQZCD.css';
7
+ import { useState, useMemo, useRef, useEffect } from 'react';
8
+ import { jsx, jsxs } from 'react/jsx-runtime';
9
+
10
+ var LABELS = {
11
+ loading: (title) => `Loading ${title}`,
12
+ failed: "This page failed to load.",
13
+ failedDetail: "It did not finish starting. Reload it, and if it fails again, ask its owner to republish it.",
14
+ navigated: "This page left its frame, so it was closed.",
15
+ navigatedDetail: "An artifact may only show its own pages. Reload it to open it again.",
16
+ refused: "This page cannot be shown safely.",
17
+ refusedDetail: "It arrived with a frame policy this dashboard does not accept.",
18
+ outdated: "This page needs a newer dashboard.",
19
+ outdatedDetail: "Reload the dashboard to update it, then open the page again.",
20
+ reload: "Reload"
21
+ };
22
+ var FRAME_HELLO_TIMEOUT_MS = 1e4;
23
+ function framePolicy(src, origin, mode, sandbox, nonce, theme) {
24
+ const verdict = checkFrameSandbox(sandbox, mode);
25
+ if (!verdict.ok) return { ok: false, refusal: { kind: "sandbox", tokens: verdict.refused } };
26
+ const served = httpOrigin(src);
27
+ if (served === null) return { ok: false, refusal: { kind: "src" } };
28
+ const named = mode === "per_artifact" ? origin === served : origin === served || origin === "null";
29
+ if (!named) return { ok: false, refusal: { kind: "src" } };
30
+ if (!isFrameNonce(nonce)) return { ok: false, refusal: { kind: "nonce" } };
31
+ const url = new URL(src);
32
+ url.hash = frameFragment(nonce, theme);
33
+ return { ok: true, url: url.href, sandbox: verdict.value, origin: served };
34
+ }
35
+ function SandboxedFrame(props) {
36
+ const { src, nonce, origin, mode, sandbox } = props;
37
+ return /* @__PURE__ */ jsx(FrameInstance, { ...props }, [src, nonce, origin, mode, sandbox].join("\n"));
38
+ }
39
+ function FrameInstance(props) {
40
+ const {
41
+ src,
42
+ origin,
43
+ mode,
44
+ sandbox,
45
+ allow,
46
+ title,
47
+ theme,
48
+ nonce,
49
+ onReady: _onReady,
50
+ onMessage: _onMessage,
51
+ onOpenLink: _onOpenLink,
52
+ onFocusExit: _onFocusExit,
53
+ onStateChange: _onStateChange,
54
+ onRefusal: _onRefusal,
55
+ onReload,
56
+ helloTimeoutMs = FRAME_HELLO_TIMEOUT_MS,
57
+ labels,
58
+ className,
59
+ ...rest
60
+ } = props;
61
+ const text = { ...LABELS, ...labels };
62
+ const [initialTheme] = useState(theme);
63
+ const policy = useMemo(
64
+ () => framePolicy(src, origin, mode, sandbox, nonce, initialTheme),
65
+ [src, origin, mode, sandbox, nonce, initialTheme]
66
+ );
67
+ const [state, setState] = useState(policy.ok ? "loading" : "refused");
68
+ const latest = useRef(props);
69
+ latest.current = props;
70
+ const frameRef = useRef(null);
71
+ const regionRef = useRef(null);
72
+ const portRef = useRef(null);
73
+ useEffect(() => {
74
+ if (!policy.ok) latest.current.onRefusal?.(policy.refusal);
75
+ }, [policy]);
76
+ useEffect(() => {
77
+ latest.current.onStateChange?.(state);
78
+ }, [state]);
79
+ useEffect(() => {
80
+ if (!policy.ok) return void 0;
81
+ const frame = frameRef.current;
82
+ if (!frame) return void 0;
83
+ let ended = false;
84
+ let greeted = 0;
85
+ let credit = false;
86
+ let owed = false;
87
+ let loadTimer;
88
+ const refuse = (refusal) => latest.current.onRefusal?.(refusal);
89
+ const closePort = () => {
90
+ portRef.current?.close();
91
+ portRef.current = null;
92
+ };
93
+ const end = (next) => {
94
+ ended = true;
95
+ clearTimeout(mountTimer);
96
+ clearTimeout(loadTimer);
97
+ closePort();
98
+ setState(next);
99
+ };
100
+ const onPortMessage = (port, event) => {
101
+ if (ended || portRef.current !== port) return;
102
+ const data = event.data;
103
+ const raw = readOpenLink(data);
104
+ if (raw !== null) {
105
+ const url = externalUrl(raw);
106
+ if (url) latest.current.onOpenLink?.(url);
107
+ else refuse({ kind: "link", url: raw });
108
+ return;
109
+ }
110
+ if (isFocusExit(data)) {
111
+ const exit = latest.current.onFocusExit;
112
+ if (exit) exit();
113
+ else regionRef.current?.focus();
114
+ return;
115
+ }
116
+ latest.current.onMessage?.(data, port);
117
+ };
118
+ const onWindowMessage = (event) => {
119
+ if (ended || event.source === null || event.source !== frame.contentWindow) return;
120
+ const hello = readFrameHello(event.data);
121
+ if (!hello) return;
122
+ if (!frameOriginMatches(mode, policy.origin, event.origin)) {
123
+ refuse({ kind: "origin", origin: event.origin });
124
+ return;
125
+ }
126
+ if (hello.nonce !== nonce) {
127
+ refuse({ kind: "hello-nonce" });
128
+ return;
129
+ }
130
+ if (greeted > 0 && (mode === "shared" || credit)) {
131
+ refuse({ kind: "rehello" });
132
+ if (mode === "shared") end("navigated");
133
+ return;
134
+ }
135
+ const bridge = negotiateBridge(hello.bridge);
136
+ if (bridge === null) {
137
+ refuse({ kind: "bridge", offered: hello.bridge });
138
+ end("outdated");
139
+ return;
140
+ }
141
+ const channel = new MessageChannel();
142
+ const message = { type: FRAME_MESSAGE.port, bridge };
143
+ event.source.postMessage(message, {
144
+ targetOrigin: portTargetOrigin(mode, policy.origin),
145
+ transfer: [channel.port2]
146
+ });
147
+ closePort();
148
+ const port = channel.port1;
149
+ portRef.current = port;
150
+ port.onmessage = (portEvent) => onPortMessage(port, portEvent);
151
+ port.postMessage(frameThemeMessage(latest.current.theme));
152
+ greeted += 1;
153
+ clearTimeout(mountTimer);
154
+ if (owed) {
155
+ owed = false;
156
+ clearTimeout(loadTimer);
157
+ } else {
158
+ credit = true;
159
+ }
160
+ setState("ready");
161
+ latest.current.onReady?.(port, hello);
162
+ };
163
+ const onLoad = () => {
164
+ if (ended) return;
165
+ if (credit) {
166
+ credit = false;
167
+ return;
168
+ }
169
+ owed = true;
170
+ clearTimeout(loadTimer);
171
+ loadTimer = setTimeout(() => end(greeted > 0 ? "navigated" : "failed"), helloTimeoutMs);
172
+ };
173
+ window.addEventListener("message", onWindowMessage);
174
+ frame.addEventListener("load", onLoad);
175
+ const mountTimer = setTimeout(() => {
176
+ if (greeted === 0) end("failed");
177
+ }, helloTimeoutMs);
178
+ return () => {
179
+ ended = true;
180
+ window.removeEventListener("message", onWindowMessage);
181
+ frame.removeEventListener("load", onLoad);
182
+ clearTimeout(mountTimer);
183
+ clearTimeout(loadTimer);
184
+ closePort();
185
+ };
186
+ }, [policy, mode, nonce, helloTimeoutMs]);
187
+ const { mode: themeMode, palette, density } = theme;
188
+ useEffect(() => {
189
+ portRef.current?.postMessage(frameThemeMessage({ mode: themeMode, palette, density }));
190
+ }, [themeMode, palette, density]);
191
+ const live = policy.ok && (state === "loading" || state === "ready");
192
+ const ending = END_TEXT[state];
193
+ const credentialless = { credentialless: "" };
194
+ return /* @__PURE__ */ jsxs(
195
+ "div",
196
+ {
197
+ ...rest,
198
+ ref: regionRef,
199
+ role: "region",
200
+ "aria-label": title,
201
+ "aria-busy": state === "loading" || void 0,
202
+ tabIndex: -1,
203
+ "data-state": state,
204
+ className: cx("crewlet-sandboxed-frame", className),
205
+ children: [
206
+ live ? /* @__PURE__ */ jsx(
207
+ "iframe",
208
+ {
209
+ ref: frameRef,
210
+ className: "crewlet-sandboxed-frame__frame",
211
+ src: policy.url,
212
+ sandbox: policy.sandbox,
213
+ allow: allow ?? "",
214
+ title,
215
+ referrerPolicy: "no-referrer",
216
+ ...credentialless
217
+ }
218
+ ) : null,
219
+ state === "loading" ? /* @__PURE__ */ jsx("div", { className: "crewlet-sandboxed-frame__loading", children: /* @__PURE__ */ jsx(Skeleton, { variant: "box", width: "100%", height: "100%", label: text.loading(title) }) }) : null,
220
+ ending ? /* @__PURE__ */ jsx("div", { className: "crewlet-sandboxed-frame__end", children: /* @__PURE__ */ jsx(
221
+ Callout,
222
+ {
223
+ variant: "danger",
224
+ title: text[ending.title],
225
+ live: "polite",
226
+ action: onReload ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "small", onClick: onReload, children: text.reload }) : void 0,
227
+ children: text[ending.detail]
228
+ }
229
+ ) }) : null
230
+ ]
231
+ }
232
+ );
233
+ }
234
+ var END_TEXT = {
235
+ loading: null,
236
+ ready: null,
237
+ failed: { title: "failed", detail: "failedDetail" },
238
+ navigated: { title: "navigated", detail: "navigatedDetail" },
239
+ refused: { title: "refused", detail: "refusedDetail" },
240
+ outdated: { title: "outdated", detail: "outdatedDetail" }
241
+ };
242
+
243
+ export { FRAME_HELLO_TIMEOUT_MS, SandboxedFrame };
@@ -1,5 +1,5 @@
1
1
  import { BrandLockup } from './chunk-7KBNFFM3.js';
2
- import { Card } from './chunk-EG6NYWVK.js';
2
+ import { Card } from './chunk-YZCJ63JF.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './AuthLayout-ODHBUPHQ.css';
5
5
  import { useId } from 'react';