@bud.sh/app 0.5.1 → 0.6.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 (115) hide show
  1. package/README.md +41 -31
  2. package/dist/client/assets/bud/design.js +1 -1
  3. package/dist/client/assets/canvas-Bih9EdKJ.js +1 -0
  4. package/dist/client/assets/difference-worker-Bzg-rizy.js +8 -0
  5. package/dist/client/assets/dist-CdE5wBkg.js +5 -0
  6. package/dist/client/assets/files-1dLuoM2f.js +1 -0
  7. package/dist/client/assets/i18n-CkO6VFI0.js +1 -0
  8. package/dist/client/assets/index-Cn2mxroU.css +2 -0
  9. package/dist/client/assets/{index-Dn2pfmXf.js → index-DtISWZp9.js} +2 -2
  10. package/dist/client/assets/pages-BJ-tNJ4J.js +1 -0
  11. package/dist/client/assets/{project-branches-CMGRmrqr.js → project-branches-Ce3rXrkc.js} +1 -1
  12. package/dist/client/assets/project-comments-CPUONfs8.js +1 -0
  13. package/dist/client/assets/project-thread-links-C-TGkq59.js +1 -0
  14. package/dist/client/assets/{project-threads-ZbKDh78d.js → project-threads-Bv7IDBgi.js} +105 -105
  15. package/dist/client/assets/project-work-DAE9-olg.js +1 -0
  16. package/dist/client/assets/{task-design-BPpc4Gd7.js → task-design-CwySIAOl.js} +3 -3
  17. package/dist/client/assets/tasks-KWsCLi_h.js +3 -0
  18. package/dist/client/assets/wasm-inline-DSUyFn1L.js +1 -0
  19. package/dist/client/assets/workspace-CVdcfaaB.js +2 -0
  20. package/dist/client/index.html +3 -3
  21. package/dist/hosted/assets/{canvas-BYTOp1p7.js → canvas-AII16n9i.js} +97 -6
  22. package/dist/hosted/assets/{comment-data-Cn5y2VxV.js → comment-data-BXfMElfx.js} +1998 -381
  23. package/dist/hosted/assets/dist-BCSTeNf4.js +4785 -0
  24. package/dist/hosted/assets/{files-B1P2_24q.js → files-D_1yeAVO.js} +10 -5
  25. package/dist/hosted/assets/{pages-B0ZlVdci.js → pages-CN_SbKWA.js} +3 -3
  26. package/dist/hosted/assets/{project-branches-DlCWmfRo.js → project-branches-Bxp0DCwg.js} +1 -1
  27. package/dist/hosted/assets/{project-thread-links-BZXQ200n.js → project-thread-links-KqQoKBLE.js} +76 -4
  28. package/dist/{node-host/assets/screen-DapOVrga.js → hosted/assets/screen-DpAcDUKR.js} +25 -1
  29. package/dist/hosted/assets/tasks-D66LlwxM.js +1423 -0
  30. package/dist/hosted/assets/wasm-inline-Dl9tqabx.js +4 -0
  31. package/dist/hosted/hosted.js +7885 -6219
  32. package/dist/node/assets/Stream-CAm1eJ2n.js +16604 -0
  33. package/dist/{server/assets/bridge-B_Blt55E.js → node/assets/bridge-DQSBYHmw.js} +124 -290
  34. package/dist/node/assets/config-9_jWwNBh.js +1067 -0
  35. package/dist/node/assets/load-config.server-CMVtRVmO.js +261 -0
  36. package/dist/node/assets/module-3GgtT4Xs.js +308 -0
  37. package/dist/node/assets/server-DTQFuoX2.js +846 -0
  38. package/dist/node/assets/src-D-kG1GxB.js +2 -0
  39. package/dist/node/assets/{src-CerrKjID.js → src-Dwe9APUx.js} +93 -3
  40. package/dist/node/assets/src-DysjfbM8.js +8592 -0
  41. package/dist/node/bridge.js +1 -845
  42. package/dist/node/cli.js +206 -0
  43. package/dist/node/design.js +811 -8
  44. package/dist/node/index.js +2 -739
  45. package/dist/node/plugins.js +5711 -0
  46. package/dist/node/server.js +1 -6746
  47. package/dist/node/vite.js +121 -0
  48. package/dist/{server/assets/canvas-CkMK4hoN.js → node-host/assets/canvas-BeDoufy1.js} +97 -7
  49. package/dist/node-host/assets/{comment-data-yfWEdDQL.js → comment-data-DE2T9yTj.js} +1974 -355
  50. package/dist/node-host/assets/dist-BCSTeNf4.js +4785 -0
  51. package/dist/node-host/assets/{files-anHi-apm.js → files-Dl-PTS09.js} +11 -6
  52. package/dist/node-host/assets/{pages-CW4aF6dK.js → pages-DL2sk6_U.js} +3 -3
  53. package/dist/node-host/assets/{project-branches-D7rVCxQX.js → project-branches-DGp5ELct.js} +1 -1
  54. package/dist/{server/assets/project-thread-links-lLS_rq7c.js → node-host/assets/project-thread-links-CgBV3Jcm.js} +76 -5
  55. package/dist/{hosted/assets/screen-CfdC3NbR.js → node-host/assets/screen-B55yyVfb.js} +25 -1
  56. package/dist/node-host/assets/tasks-DZRNkoxe.js +1425 -0
  57. package/dist/node-host/assets/wasm-inline-Dl9tqabx.js +4 -0
  58. package/dist/node-host/node-host.js +6127 -4438
  59. package/dist/server/assets/{branch-previews-ClkoJ0lM.js → branch-previews-DedrpnVR.js} +1555 -673
  60. package/dist/{node-host/assets/canvas-DxmcFZCh.js → server/assets/canvas-CJWQ-jjv.js} +98 -6
  61. package/dist/server/assets/{comment-data-NLeHG89b.js → comment-data-Rg42ToTW.js} +1660 -26
  62. package/dist/server/assets/dist-BCSTeNf4.js +4785 -0
  63. package/dist/server/assets/{events-iHpLGr3k.js → events-BH_rAu7O.js} +155 -20
  64. package/dist/server/assets/{files-CRdl489E.js → files-CPJqKeMo.js} +12 -7
  65. package/dist/server/assets/{listener-BAYn9Q-u.js → listener-D61O6PzF.js} +708 -12
  66. package/dist/server/assets/{pages-DXVlJlBC.js → pages-KJY_Ba92.js} +4 -4
  67. package/dist/server/assets/{project-branches-CwTsf6WQ.js → project-branches-qG9ACZvo.js} +2 -2
  68. package/dist/{node-host/assets/project-thread-links-m-OLpsD9.js → server/assets/project-thread-links-CqK0lqCF.js} +77 -4
  69. package/dist/{node-host/assets/tasks-request-B0aeNocI.js → server/assets/project-work-DoIwxWMm.js} +87 -2
  70. package/dist/server/assets/run-BJ8r5jSh.js +572 -0
  71. package/dist/server/assets/{screen-B1zH_1O3.js → screen-CBrHPFug.js} +26 -2
  72. package/dist/server/assets/{server-DxK-UB_Z.js → server-Dkbp5stG.js} +1521 -793
  73. package/dist/server/assets/{services-BRrgXYlT.js → services-BTfig8A8.js} +234 -997
  74. package/dist/server/assets/tasks-Bgu5Lg9Y.js +1427 -0
  75. package/dist/server/assets/wasm-inline-Dl9tqabx.js +4 -0
  76. package/dist/server/capture.js +1 -2
  77. package/dist/server/migration.js +569 -12
  78. package/dist/server/runtime.js +7 -5
  79. package/dist/server/server.js +3 -3
  80. package/dist/types/assets/{config-DIC2cf_S.d.ts → config-CvcYmE2s.d.ts} +188 -50
  81. package/dist/types/assets/{contract-CAT-XFNq.d.ts → contract-B7yuuqSn.d.ts} +44 -2
  82. package/dist/types/assets/{items-CaVkByHk.d.ts → items-BQdaVksf.d.ts} +12 -1
  83. package/dist/types/assets/memory-state-BBW-FAVA.d.ts +236 -0
  84. package/dist/types/assets/picker-Be5Gx4WR.d.ts +9 -0
  85. package/dist/types/assets/{task-design-xJOhRNWh.d.ts → task-design-BDHKFHpp.d.ts} +3 -1
  86. package/dist/types/bridge.d.ts +1 -1
  87. package/dist/types/companion.d.ts +3 -3
  88. package/dist/types/design.d.ts +2 -2
  89. package/dist/types/hosted.d.ts +3 -3
  90. package/dist/types/index.d.ts +2 -2
  91. package/dist/types/node-host.d.ts +2 -2
  92. package/dist/types/plugins.d.ts +445 -0
  93. package/dist/types/screen.d.ts +2 -2
  94. package/dist/types/server.d.ts +2 -228
  95. package/dist/types/vite.d.ts +16 -0
  96. package/package.json +19 -3
  97. package/dist/client/assets/canvas-8GXJIuDK.js +0 -1
  98. package/dist/client/assets/difference-worker-C99ychYw.js +0 -8
  99. package/dist/client/assets/files-DkWt1l9H.js +0 -1
  100. package/dist/client/assets/i18n-hH_Ba5QO.js +0 -1
  101. package/dist/client/assets/index-tpHYVXma.css +0 -2
  102. package/dist/client/assets/pages-BVd6MQmu.js +0 -1
  103. package/dist/client/assets/project-comments-D1IIQwsW.js +0 -1
  104. package/dist/client/assets/project-thread-links-DKwe_SYb.js +0 -1
  105. package/dist/client/assets/project-work-D4DZqBCZ.js +0 -1
  106. package/dist/client/assets/tasks-Cn0VOZ9Z.js +0 -1
  107. package/dist/client/assets/tasks-request-BLyOzokZ.js +0 -1
  108. package/dist/client/assets/workspace-DGErsSg6.js +0 -2
  109. package/dist/hosted/assets/tasks-_yKh2Z6q.js +0 -649
  110. package/dist/hosted/assets/tasks-request-CFPLvLc7.js +0 -113
  111. package/dist/node-host/assets/tasks-BBK_CybR.js +0 -651
  112. package/dist/server/assets/project-work-CSZlCwH-.js +0 -88
  113. package/dist/server/assets/tasks-CGdz-uox.js +0 -652
  114. package/dist/server/assets/tasks-request-D2NBjCTl.js +0 -115
  115. package/dist/types/assets/picker-D1Bw3ndx.d.ts +0 -14
@@ -1,7 +1,8 @@
1
- import { $t as Button, H as CanvasWorkspace, U as captureCanvasPoint, Zt as Loader, _n as Icon, bt as conversationHref, en as ToolbarSeparator, et as BranchSidebar, gn as Text, in as IconButton, l as projectStore, ln as readPreference, mn as t, on as Tooltip, rn as Select, t as commentsUnavailable, tn as WorkspaceLayout, un as writePreference } from "./comment-data-yfWEdDQL.js";
2
- import { i as pictureKey, n as createProjectPreviews, t as createProjectBranches } from "./project-branches-D7rVCxQX.js";
3
- import { n as createProjectComments, r as loadComments, t as defineScreen } from "./screen-DapOVrga.js";
4
- import { t as ProjectThreadLinks } from "./project-thread-links-m-OLpsD9.js";
1
+ import { zn as Icon } from "./events-BH_rAu7O.js";
2
+ import { Cn as IconButton, Fn as Text, Gt as Loader, K as BranchSidebar, Nn as t, On as readPreference, Sn as Select, Tn as Tooltip, U as CanvasWorkspace, W as captureCanvasPoint, bn as WorkspaceLayout, kn as writePreference, l as projectStore, mt as conversationHref, qt as Button, t as commentsUnavailable, yn as ToolbarSeparator } from "./comment-data-Rg42ToTW.js";
3
+ import { i as pictureKey, n as createProjectPreviews, t as createProjectBranches } from "./project-branches-qG9ACZvo.js";
4
+ import { n as createProjectComments, r as loadComments, t as defineScreen } from "./screen-CBrHPFug.js";
5
+ import { n as ProjectThreadLinks, t as ProjectMakeTask } from "./project-thread-links-CqK0lqCF.js";
5
6
  import { on, ref } from "remix/component";
6
7
  import { Fragment, jsx, jsxs } from "remix/component/jsx-runtime";
7
8
  //#region app/client/preview-image.tsx
@@ -291,6 +292,92 @@ function PreviewRefresh(handle) {
291
292
  };
292
293
  }
293
294
  //#endregion
295
+ //#region app/client/task-context.ts
296
+ var CROP = {
297
+ width: 1200,
298
+ height: 800
299
+ };
300
+ var QUALITY = .82;
301
+ /**
302
+ * What a task made from a canvas comment takes along: the page around the comment's point with
303
+ * the point marked, and the element there with its source.
304
+ * @param previews - The canvas's pictures, for the branch the comment is on.
305
+ * @param thread - The discussion.
306
+ * @param sizes - The project's viewports.
307
+ * @returns The context, or undefined when the comment has no picture to take it from.
308
+ */
309
+ async function canvasTaskContext(previews, thread, sizes) {
310
+ let anchor = thread.anchor;
311
+ if (!anchor || "type" in anchor) return void 0;
312
+ let size = sizes.find((candidate) => candidate.width === anchor.viewport) ?? sizes[0];
313
+ if (!size) return void 0;
314
+ let picture = await previews.picture(anchor.pageId, "light", size);
315
+ if (!picture) return void 0;
316
+ let { capture, images } = picture;
317
+ let pin = capture.pins?.find((entry) => entry.id === thread.id && entry.x !== null);
318
+ let point = pin && pin.x !== null && pin.y !== null ? {
319
+ x: pin.x,
320
+ y: pin.y
321
+ } : {
322
+ x: anchor.offsetX * capture.width,
323
+ y: anchor.offsetY
324
+ };
325
+ let [image, element] = await Promise.all([cropAround(capture, images, point).catch(() => void 0), previews.describe(anchor.pageId, capture, point.x, point.y).catch(() => null)]);
326
+ return {
327
+ ...image ? { image } : {},
328
+ element,
329
+ point
330
+ };
331
+ }
332
+ /**
333
+ * Cuts the page around a point out of a capture's slices and marks the point.
334
+ * @param capture - The capture's size, scale and slices.
335
+ * @param images - The slices' images, top to bottom.
336
+ * @param point - The point in CSS pixels.
337
+ * @returns The JPEG as base64.
338
+ */
339
+ async function cropAround(capture, images, point) {
340
+ let width = Math.min(CROP.width, capture.width);
341
+ let height = Math.min(CROP.height, capture.height);
342
+ let left = Math.max(0, Math.min(capture.width - width, Math.round(point.x - width / 2)));
343
+ let top = Math.max(0, Math.min(capture.height - height, Math.round(point.y - height / 2)));
344
+ let canvas = new OffscreenCanvas(width, height);
345
+ let context = canvas.getContext("2d");
346
+ if (!context) throw new Error("No canvas.");
347
+ context.fillStyle = "#fff";
348
+ context.fillRect(0, 0, width, height);
349
+ let tileTop = 0;
350
+ for (let [index, tile] of capture.tiles.entries()) {
351
+ let tileBottom = tileTop + tile.height;
352
+ let from = Math.max(top, tileTop);
353
+ let to = Math.min(top + height, tileBottom);
354
+ if (to > from && images[index]) {
355
+ let bitmap = await createImageBitmap(images[index]);
356
+ context.drawImage(bitmap, left * capture.scale, (from - tileTop) * capture.scale, width * capture.scale, (to - from) * capture.scale, 0, from - top, width, to - from);
357
+ bitmap.close();
358
+ }
359
+ tileTop = tileBottom;
360
+ }
361
+ let x = point.x - left;
362
+ let y = point.y - top;
363
+ context.lineWidth = 6;
364
+ context.strokeStyle = "#fff";
365
+ context.beginPath();
366
+ context.arc(x, y, 18, 0, Math.PI * 2);
367
+ context.stroke();
368
+ context.lineWidth = 3;
369
+ context.strokeStyle = "#ef4444";
370
+ context.stroke();
371
+ let blob = await canvas.convertToBlob({
372
+ type: "image/jpeg",
373
+ quality: QUALITY
374
+ });
375
+ let bytes = new Uint8Array(await blob.arrayBuffer());
376
+ let binary = "";
377
+ for (let index = 0; index < bytes.length; index += 32768) binary += String.fromCharCode(...bytes.subarray(index, index + 32768));
378
+ return btoa(binary);
379
+ }
380
+ //#endregion
294
381
  //#region app/client/project-differences.ts
295
382
  var results = /* @__PURE__ */ new Map();
296
383
  function worker() {
@@ -1008,7 +1095,12 @@ function ProjectCanvas(handle) {
1008
1095
  await comments.loadThread(thread.id, true);
1009
1096
  }
1010
1097
  }),
1011
- renderThreadActions: (thread) => /* @__PURE__ */ jsx(ProjectThreadLinks, {
1098
+ renderThreadActions: (thread) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ProjectMakeTask, {
1099
+ thread,
1100
+ canMake: comments.snapshot.capabilities.link && project.storage.work?.state === "ready",
1101
+ busy: comments.busy,
1102
+ onMake: async (id) => comments.makeTask(id, await canvasTaskContext(previews, thread, sizes).catch(() => void 0))
1103
+ }), /* @__PURE__ */ jsx(ProjectThreadLinks, {
1012
1104
  part: "action",
1013
1105
  project,
1014
1106
  thread,
@@ -1018,7 +1110,7 @@ function ProjectCanvas(handle) {
1018
1110
  await comments.load();
1019
1111
  await comments.loadThread(thread.id, true);
1020
1112
  }
1021
- }),
1113
+ })] }),
1022
1114
  initialThreadId: requestedThread,
1023
1115
  loaded: comments.loaded,
1024
1116
  busy: comments.busy,