makersclaw 0.4.0 → 0.5.1

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 (102) hide show
  1. package/package.json +1 -1
  2. package/r/annotate.json +3 -3
  3. package/r/approval-request.json +4 -4
  4. package/r/audio-player.json +2 -2
  5. package/r/auth-form.json +2 -2
  6. package/r/board.json +2 -2
  7. package/r/calendar-view.json +9 -9
  8. package/r/cart.json +2 -2
  9. package/r/chart.json +7 -7
  10. package/r/chat.json +3 -3
  11. package/r/code-editor.json +2 -2
  12. package/r/comment-box.json +5 -5
  13. package/r/contact-section.json +2 -2
  14. package/r/core.json +5 -5
  15. package/r/csv-import.json +3 -3
  16. package/r/data-table.json +4 -4
  17. package/r/diagram.json +2 -2
  18. package/r/doc-editor.json +2 -2
  19. package/r/doc-page.json +3 -3
  20. package/r/email-render.json +2 -2
  21. package/r/faq.json +2 -2
  22. package/r/file-upload.json +2 -2
  23. package/r/flow-canvas.json +4 -4
  24. package/r/footer.json +2 -2
  25. package/r/gantt.json +3 -3
  26. package/r/job-panel.json +2 -2
  27. package/r/json-editor.json +3 -3
  28. package/r/map.json +2 -2
  29. package/r/menubar.json +2 -2
  30. package/r/mind-map.json +6 -6
  31. package/r/navigation-menu.json +2 -2
  32. package/r/order-detail.json +2 -2
  33. package/r/org-chart.json +4 -4
  34. package/r/page-builder.json +2 -2
  35. package/r/payment-methods.json +2 -2
  36. package/r/pdf-document.json +2 -2
  37. package/r/pdf-viewer.json +3 -3
  38. package/r/product-detail.json +2 -2
  39. package/r/product-grid.json +3 -3
  40. package/r/record-form.json +2 -2
  41. package/r/record-notes.json +6 -6
  42. package/r/registry.json +121 -121
  43. package/r/search-dialog.json +2 -2
  44. package/r/settings-list.json +2 -2
  45. package/r/setup-checklist.json +2 -2
  46. package/r/share-dialog.json +2 -2
  47. package/r/sidebar.json +4 -4
  48. package/r/signature-pad.json +3 -3
  49. package/r/sketch-canvas.json +2 -2
  50. package/r/spreadsheet.json +3 -3
  51. package/r/stat-cards.json +3 -3
  52. package/r/task-list.json +3 -3
  53. package/r/task-model.json +2 -2
  54. package/r/testimonials.json +2 -2
  55. package/r/transaction-list.json +2 -2
  56. package/r/whiteboard.json +3 -3
  57. package/registry/blocks/approval-request/README.md +2 -1
  58. package/registry/blocks/approval-request/approval-request.jsx +5 -3
  59. package/registry/blocks/calendar-view/README.md +8 -0
  60. package/registry/blocks/calendar-view/agenda.jsx +5 -4
  61. package/registry/blocks/calendar-view/calendar.jsx +23 -8
  62. package/registry/blocks/calendar-view/demo.jsx +2 -0
  63. package/registry/blocks/calendar-view/month.jsx +6 -5
  64. package/registry/blocks/calendar-view/time-grid.jsx +9 -7
  65. package/registry/blocks/calendar-view/tray.jsx +5 -4
  66. package/registry/blocks/chart/README.md +9 -4
  67. package/registry/blocks/chart/cartesian.jsx +31 -24
  68. package/registry/blocks/chart/core.jsx +21 -0
  69. package/registry/blocks/chart/pie.jsx +15 -10
  70. package/registry/blocks/chart/sparkline.jsx +32 -14
  71. package/registry/blocks/chat/message.jsx +4 -4
  72. package/registry/blocks/comment-box/README.md +1 -1
  73. package/registry/blocks/comment-box/comment-time.jsx +4 -6
  74. package/registry/blocks/data-table/README.md +4 -0
  75. package/registry/blocks/data-table/data-table.jsx +20 -6
  76. package/registry/blocks/flow-canvas/edges.jsx +4 -2
  77. package/registry/blocks/flow-canvas/theme.js +59 -48
  78. package/registry/blocks/mind-map/README.md +9 -2
  79. package/registry/blocks/mind-map/mind-map.jsx +51 -12
  80. package/registry/blocks/mind-map/tree.js +33 -0
  81. package/registry/blocks/org-chart/org-chart.jsx +1 -1
  82. package/registry/blocks/pdf-viewer/notes.jsx +4 -3
  83. package/registry/blocks/record-notes/README.md +1 -1
  84. package/registry/blocks/record-notes/record-notes.jsx +4 -5
  85. package/registry/blocks/sidebar/sidebar-panel.jsx +4 -4
  86. package/registry/blocks/sidebar/sidebar.jsx +13 -13
  87. package/registry/blocks/signature-pad/signature.js +8 -1
  88. package/registry/blocks/spreadsheet/cells.jsx +2 -2
  89. package/templates/next/files/README.md +77 -19
  90. package/templates/next/files/app/auto-refresh.jsx +39 -74
  91. package/templates/next/files/app/frame.js +197 -6
  92. package/templates/next/files/check/run.mjs +26 -10
  93. package/templates/next/files/components/ui/calendar.jsx +24 -0
  94. package/templates/next/files/components/ui/field.jsx +12 -3
  95. package/templates/next/files/components/ui/index.js +1 -0
  96. package/templates/next/files/components/ui/sheet.jsx +38 -2
  97. package/templates/next/files/components/ui/toggle.jsx +20 -2
  98. package/templates/next/files/lib/actions.js +63 -5
  99. package/templates/next/files/lib/data.js +4 -1
  100. package/templates/next/files/lib/db.js +18 -1
  101. package/templates/next/files/lib/hooks.js +52 -17
  102. package/templates/next/template.json +2 -2
@@ -415,16 +415,19 @@ export function useJob() {
415
415
  const movedRef = useRef(null); // the last status|progress|updated_at seen
416
416
  const aliveRef = useRef(true);
417
417
 
418
- useEffect(() => {
419
- aliveRef.current = true;
420
- return () => {
421
- aliveRef.current = false;
422
- abortRef.current?.abort();
423
- followRef.current?.();
424
- followRef.current = null;
425
- };
418
+ // No job at all: the panel closes.
419
+ const idle = useCallback(() => {
420
+ pathRef.current = null;
421
+ sessionRef.current = null;
422
+ requestRef.current = null;
423
+ movedRef.current = null;
424
+ setState(IDLE);
426
425
  }, []);
427
426
 
427
+ /** An ask or a stream `controller` cut off by an unmount the hook came
428
+ * back from, with nothing started since: see the effect below. */
429
+ const cutOff = (controller) => Boolean(controller.unmounted) && abortRef.current === controller && aliveRef.current;
430
+
428
431
  const apply = useCallback((request) => {
429
432
  if (!aliveRef.current) return;
430
433
  requestRef.current = request;
@@ -490,6 +493,33 @@ export function useJob() {
490
493
  [apply],
491
494
  );
492
495
 
496
+ // Unmounting aborts what is in flight and stops following. React runs
497
+ // that cleanup and mounts the hook again in development (its double
498
+ // mount; a fast refresh does the same), and up to 0.4.0 the hook came
499
+ // back to a panel that lied: 0.3.x called the aborted job done — work
500
+ // that never ran — and 0.4.0 left it running with nothing behind it
501
+ // (makersclaw-store BLOCKS.md; mind-maps and landing-page-reviewer
502
+ // started jobs from a timer instead). Now, back on its feet, the hook
503
+ // follows a live request again, and an ask the cleanup cut off before
504
+ // it was answered closes the panel: neither done nor failed (start and
505
+ // legacyStart, via cutOff).
506
+ useEffect(() => {
507
+ aliveRef.current = true;
508
+ const request = requestRef.current;
509
+ if (!followRef.current && pathRef.current === "request" && request?.id && LIVE.has(request.status)) {
510
+ const controller = new AbortController();
511
+ abortRef.current = controller;
512
+ follow(request.id, controller.signal);
513
+ }
514
+ return () => {
515
+ aliveRef.current = false;
516
+ if (abortRef.current) abortRef.current.unmounted = true;
517
+ abortRef.current?.abort();
518
+ followRef.current?.();
519
+ followRef.current = null;
520
+ };
521
+ }, [follow]);
522
+
493
523
  // The 0.3.x door, as it was: _claw/chat streamed into the app. Taken
494
524
  // only on a claw that has no _claw/ask.
495
525
  const legacyStart = useCallback(async (text, { sessionId, signal }) => {
@@ -531,8 +561,13 @@ export function useJob() {
531
561
  };
532
562
 
533
563
  const result = await startJob(text, { sessionId: thread ?? undefined, onEvent, signal });
534
- // Aborted means a new start, a cancel or a reset already set the state.
535
- if (!aliveRef.current || signal.aborted) return result;
564
+ // Aborted means a new start, a cancel or a reset already set the
565
+ // state — or an unmount cut the stream, and the panel closes.
566
+ if (!aliveRef.current || signal.aborted) {
567
+ const current = abortRef.current;
568
+ if (current?.signal === signal && cutOff(current)) idle();
569
+ return result;
570
+ }
536
571
  // A stream that ends without `done` (a dropped connection, a 4xx
537
572
  // before the first frame) must still leave the panel closable.
538
573
  if (!result.ok && !result.aborted)
@@ -565,7 +600,11 @@ export function useJob() {
565
600
  setState((s) => ({ ...s, sessionId: null }));
566
601
  result = await asking(null);
567
602
  }
568
- if (!aliveRef.current || controller.signal.aborted) return result;
603
+ if (!aliveRef.current || controller.signal.aborted) {
604
+ // Cut off unanswered by an unmount: nothing to follow, no panel.
605
+ if (cutOff(controller)) idle();
606
+ return result;
607
+ }
569
608
 
570
609
  // A 404 that names no refusal: a claw from before _claw/ask. Its
571
610
  // _claw/chat still runs the job, so a 0.4.0 app works there too.
@@ -624,12 +663,8 @@ export function useJob() {
624
663
  abortRef.current?.abort();
625
664
  followRef.current?.();
626
665
  followRef.current = null;
627
- pathRef.current = null;
628
- sessionRef.current = null;
629
- requestRef.current = null;
630
- movedRef.current = null;
631
- setState(IDLE);
632
- }, []);
666
+ idle();
667
+ }, [idle]);
633
668
 
634
669
  // Take the founder to the conversation: the question when it needs
635
670
  // them, the account of the work otherwise. False on the 0.3.x path.
@@ -96,8 +96,8 @@
96
96
  {
97
97
  "name": "calendar",
98
98
  "type": "component",
99
- "title": "Calendar, parseDate, isDateString, toDateString, todayString, addDays, addMonths, startOfMonth, endOfMonth, dayOfWeek, formatDate, firstDayOfWeek",
100
- "description": "A month grid, the WAI-ARIA date grid (arrows a day or a week, Page Up/Down a month, Home/End the week's edges, Enter picks): mode single · multiple · range, dates as \"YYYY-MM-DD\" strings in and out (no timezone drift); numberOfMonths side by side (stacked on a phone); captionLayout label · dropdown (month and year Selects) · none (the parent shows and moves a controlled month); min, max, disabled(date); today ringed, outside days muted, range start/middle/end; marked days (a dot in a tone, a label for readers; emphasizeMarked draws them bold and the rest muted; onlyMarked makes the rest unpickable, unstruck); week numbers; week start and names from Intl, weekStartsOn overrides; size md (44px days) · sm. The string-date helpers do the same arithmetic in a surface.",
99
+ "title": "Calendar, parseDate, isDateString, toDateString, todayString, addDays, addMonths, startOfMonth, endOfMonth, dayOfWeek, formatDate, toLocalDate, firstDayOfWeek",
100
+ "description": "A month grid, the WAI-ARIA date grid (arrows a day or a week, Page Up/Down a month, Home/End the week's edges, Enter picks): mode single · multiple · range, dates as \"YYYY-MM-DD\" strings in and out (no timezone drift); numberOfMonths side by side (stacked on a phone); captionLayout label · dropdown (month and year Selects) · none (the parent shows and moves a controlled month); min, max, disabled(date); today ringed, outside days muted, range start/middle/end; marked days (a dot in a tone, a label for readers; emphasizeMarked draws them bold and the rest muted; onlyMarked makes the rest unpickable, unstruck); week numbers; week start and names from Intl, weekStartsOn overrides; size md (44px days) · sm. The string-date helpers do the same arithmetic in a surface; toLocalDate turns a day (a `date` column's \"YYYY-MM-DD\") into its LOCAL midnight, for code that shows days beside times.",
101
101
  "tags": ["calendar", "date", "month", "range", "schedule", "day picker", "week"],
102
102
  "files": ["components/ui/calendar.jsx"]
103
103
  },