makersclaw 0.8.0 → 0.8.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.
- package/README.md +9 -3
- package/package.json +1 -1
- package/r/activity-log.json +52 -0
- package/r/agent-changes.json +51 -0
- package/r/agent-chat.json +53 -0
- package/r/agent-column.json +85 -0
- package/r/agent-dock.json +57 -0
- package/r/agent-kit.json +49 -0
- package/r/agent-marks.json +49 -0
- package/r/agent-pane.json +93 -0
- package/r/ai-action.json +56 -0
- package/r/annotate.json +3 -3
- package/r/approval-request.json +2 -2
- package/r/approval.json +54 -0
- package/r/ask-bar.json +50 -0
- package/r/audio-player.json +2 -2
- package/r/auth-form.json +2 -2
- package/r/automation-editor.json +66 -0
- package/r/automation-list.json +57 -0
- package/r/automation-model.json +118 -0
- package/r/automations-screen.json +71 -0
- package/r/board.json +2 -2
- package/r/calendar-view.json +3 -3
- package/r/cart.json +2 -2
- package/r/chart.json +2 -2
- package/r/chat-pane.json +84 -0
- package/r/chat.json +2 -2
- package/r/code-editor.json +2 -2
- package/r/comment-box.json +3 -3
- package/r/connect-card.json +51 -0
- package/r/contact-section.json +2 -2
- package/r/core.json +13 -7
- package/r/cost.json +51 -0
- package/r/csv-import.json +3 -3
- package/r/data-picker.json +60 -0
- package/r/data-table.json +2 -2
- package/r/diagram.json +2 -2
- package/r/doc-editor.json +2 -2
- package/r/doc-page.json +3 -3
- package/r/email-render.json +2 -2
- package/r/faq.json +2 -2
- package/r/file-upload.json +2 -2
- package/r/first-run.json +63 -0
- package/r/fix-note.json +57 -0
- package/r/flow-canvas.json +2 -2
- package/r/flow-editor.json +79 -0
- package/r/footer.json +2 -2
- package/r/gantt.json +3 -3
- package/r/job-panel.json +2 -2
- package/r/json-editor.json +3 -3
- package/r/library-shelf.json +56 -0
- package/r/map.json +2 -2
- package/r/margin-notes.json +67 -0
- package/r/menubar.json +2 -2
- package/r/mind-map.json +3 -3
- package/r/navigation-menu.json +2 -2
- package/r/needs-you.json +55 -0
- package/r/order-detail.json +2 -2
- package/r/org-chart.json +3 -3
- package/r/pace-bar.json +69 -0
- package/r/page-builder.json +2 -2
- package/r/payment-methods.json +2 -2
- package/r/pdf-document.json +2 -2
- package/r/pdf-viewer.json +2 -2
- package/r/product-detail.json +2 -2
- package/r/product-grid.json +3 -3
- package/r/record-form.json +2 -2
- package/r/record-grid.json +52 -0
- package/r/record-notes.json +4 -4
- package/r/registry.json +4086 -1512
- package/r/run-history.json +52 -0
- package/r/run-view.json +80 -0
- package/r/schedule-card.json +54 -0
- package/r/schedule-engine.json +79 -0
- package/r/schedule-gantt.json +83 -0
- package/r/schedule-ruler.json +64 -0
- package/r/search-dialog.json +2 -2
- package/r/settings-list.json +2 -2
- package/r/setup-checklist.json +2 -2
- package/r/share-dialog.json +2 -2
- package/r/sidebar.json +2 -2
- package/r/signature-pad.json +2 -2
- package/r/sketch-canvas.json +2 -2
- package/r/source-receipt.json +52 -0
- package/r/spreadsheet.json +3 -3
- package/r/stat-cards.json +3 -3
- package/r/step-picker.json +53 -0
- package/r/step-settings.json +72 -0
- package/r/suggestion.json +58 -0
- package/r/sum-bar.json +64 -0
- package/r/task-list.json +3 -3
- package/r/task-model.json +2 -2
- package/r/testimonials.json +2 -2
- package/r/tier-map.json +67 -0
- package/r/time-grid.json +73 -0
- package/r/time-strip.json +64 -0
- package/r/top-bar.json +66 -0
- package/r/transaction-list.json +2 -2
- package/r/trigger-picker.json +61 -0
- package/r/whiteboard.json +3 -3
- package/r/workflow-view.json +55 -0
- package/registry/blocks/activity-log/README.md +112 -0
- package/registry/blocks/activity-log/activity-log.jsx +351 -0
- package/registry/blocks/activity-log/block.json +33 -0
- package/registry/blocks/activity-log/demo.jsx +48 -0
- package/registry/blocks/activity-log/index.js +4 -0
- package/registry/blocks/agent-changes/README.md +94 -0
- package/registry/blocks/agent-changes/agent-changes.jsx +118 -0
- package/registry/blocks/agent-changes/block.json +28 -0
- package/registry/blocks/agent-changes/demo.jsx +39 -0
- package/registry/blocks/agent-changes/index.js +3 -0
- package/registry/blocks/agent-chat/README.md +145 -0
- package/registry/blocks/agent-chat/agent-chat.jsx +415 -0
- package/registry/blocks/agent-chat/block.json +30 -0
- package/registry/blocks/agent-chat/demo.jsx +165 -0
- package/registry/blocks/agent-chat/index.js +3 -0
- package/registry/blocks/agent-column/README.md +197 -0
- package/registry/blocks/agent-column/agent-column.jsx +492 -0
- package/registry/blocks/agent-column/block.json +67 -0
- package/registry/blocks/agent-column/column-picker.jsx +163 -0
- package/registry/blocks/agent-column/demo.jsx +50 -0
- package/registry/blocks/agent-column/index.js +7 -0
- package/registry/blocks/agent-column/model.js +164 -0
- package/registry/blocks/agent-column/receipt.jsx +483 -0
- package/registry/blocks/agent-column/spreadsheet-type.jsx +24 -0
- package/registry/blocks/agent-dock/README.md +210 -0
- package/registry/blocks/agent-dock/agent-dock.jsx +356 -0
- package/registry/blocks/agent-dock/block.json +47 -0
- package/registry/blocks/agent-dock/demo.jsx +153 -0
- package/registry/blocks/agent-dock/dock-model.js +118 -0
- package/registry/blocks/agent-dock/index.js +5 -0
- package/registry/blocks/agent-kit/README.md +73 -0
- package/registry/blocks/agent-kit/agent-kit.jsx +86 -0
- package/registry/blocks/agent-kit/block.json +10 -0
- package/registry/blocks/agent-kit/demo.jsx +35 -0
- package/registry/blocks/agent-kit/index.js +3 -0
- package/registry/blocks/agent-marks/README.md +80 -0
- package/registry/blocks/agent-marks/agent-marks.jsx +133 -0
- package/registry/blocks/agent-marks/block.json +27 -0
- package/registry/blocks/agent-marks/demo.jsx +49 -0
- package/registry/blocks/agent-marks/index.js +3 -0
- package/registry/blocks/agent-pane/README.md +225 -0
- package/registry/blocks/agent-pane/agent-pane.jsx +244 -0
- package/registry/blocks/agent-pane/block.json +41 -0
- package/registry/blocks/agent-pane/composer.jsx +6 -0
- package/registry/blocks/agent-pane/demo.jsx +233 -0
- package/registry/blocks/agent-pane/dock-context.js +10 -0
- package/registry/blocks/agent-pane/index.js +4 -0
- package/registry/blocks/agent-pane/prose.jsx +84 -0
- package/registry/blocks/agent-pane/questions.jsx +134 -0
- package/registry/blocks/agent-pane/transcript.jsx +268 -0
- package/registry/blocks/agent-pane/work.jsx +368 -0
- package/registry/blocks/ai-action/README.md +94 -0
- package/registry/blocks/ai-action/ai-action.jsx +188 -0
- package/registry/blocks/ai-action/block.json +34 -0
- package/registry/blocks/ai-action/demo.jsx +93 -0
- package/registry/blocks/ai-action/index.js +3 -0
- package/registry/blocks/approval/README.md +145 -0
- package/registry/blocks/approval/approval.jsx +163 -0
- package/registry/blocks/approval/block.json +31 -0
- package/registry/blocks/approval/demo.jsx +121 -0
- package/registry/blocks/approval/index.js +3 -0
- package/registry/blocks/ask-bar/README.md +105 -0
- package/registry/blocks/ask-bar/ask-bar.jsx +166 -0
- package/registry/blocks/ask-bar/block.json +26 -0
- package/registry/blocks/ask-bar/demo.jsx +78 -0
- package/registry/blocks/ask-bar/index.js +3 -0
- package/registry/blocks/automation-editor/README.md +291 -0
- package/registry/blocks/automation-editor/automation-editor.jsx +656 -0
- package/registry/blocks/automation-editor/block.json +39 -0
- package/registry/blocks/automation-editor/demo.jsx +284 -0
- package/registry/blocks/automation-editor/index.js +4 -0
- package/registry/blocks/automation-editor/run-inputs.jsx +82 -0
- package/registry/blocks/automation-list/README.md +129 -0
- package/registry/blocks/automation-list/automation-list.jsx +476 -0
- package/registry/blocks/automation-list/block.json +35 -0
- package/registry/blocks/automation-list/demo.jsx +67 -0
- package/registry/blocks/automation-list/index.js +3 -0
- package/registry/blocks/automation-model/README.md +109 -0
- package/registry/blocks/automation-model/block.json +135 -0
- package/registry/blocks/automation-model/catalog.js +256 -0
- package/registry/blocks/automation-model/check.js +161 -0
- package/registry/blocks/automation-model/demo.jsx +42 -0
- package/registry/blocks/automation-model/edit.js +262 -0
- package/registry/blocks/automation-model/fixes.js +287 -0
- package/registry/blocks/automation-model/glyph.jsx +13 -0
- package/registry/blocks/automation-model/graph.js +410 -0
- package/registry/blocks/automation-model/index.js +33 -0
- package/registry/blocks/automation-model/overlay.js +175 -0
- package/registry/blocks/automation-model/parts.jsx +94 -0
- package/registry/blocks/automation-model/schedule.js +53 -0
- package/registry/blocks/automation-model/templates.js +128 -0
- package/registry/blocks/automation-model/values.js +29 -0
- package/registry/blocks/automation-model/words.js +439 -0
- package/registry/blocks/automations-screen/README.md +207 -0
- package/registry/blocks/automations-screen/automations-screen.jsx +452 -0
- package/registry/blocks/automations-screen/block.json +47 -0
- package/registry/blocks/automations-screen/demo.jsx +364 -0
- package/registry/blocks/automations-screen/index.js +4 -0
- package/registry/blocks/automations-screen/screen-model.js +129 -0
- package/registry/blocks/chat-pane/README.md +143 -0
- package/registry/blocks/chat-pane/block.json +48 -0
- package/registry/blocks/chat-pane/chat-attach.js +166 -0
- package/registry/blocks/chat-pane/chat-composer.jsx +195 -0
- package/registry/blocks/chat-pane/chat-context.js +17 -0
- package/registry/blocks/chat-pane/chat-model.js +43 -0
- package/registry/blocks/chat-pane/chat-pane.jsx +398 -0
- package/registry/blocks/chat-pane/chats-list.jsx +52 -0
- package/registry/blocks/chat-pane/demo.jsx +103 -0
- package/registry/blocks/chat-pane/index.js +9 -0
- package/registry/blocks/connect-card/README.md +99 -0
- package/registry/blocks/connect-card/block.json +10 -0
- package/registry/blocks/connect-card/connect-card.jsx +103 -0
- package/registry/blocks/connect-card/demo.jsx +49 -0
- package/registry/blocks/connect-card/index.js +3 -0
- package/registry/blocks/cost/README.md +115 -0
- package/registry/blocks/cost/block.json +10 -0
- package/registry/blocks/cost/cost.jsx +176 -0
- package/registry/blocks/cost/demo.jsx +66 -0
- package/registry/blocks/cost/index.js +3 -0
- package/registry/blocks/data-picker/README.md +81 -0
- package/registry/blocks/data-picker/block.json +38 -0
- package/registry/blocks/data-picker/data-picker.jsx +210 -0
- package/registry/blocks/data-picker/demo.jsx +34 -0
- package/registry/blocks/data-picker/fields.js +89 -0
- package/registry/blocks/data-picker/index.js +4 -0
- package/registry/blocks/data-table/demo.jsx +1 -1
- package/registry/blocks/first-run/README.md +118 -0
- package/registry/blocks/first-run/block.json +11 -0
- package/registry/blocks/first-run/demo.jsx +88 -0
- package/registry/blocks/first-run/first-run-model.js +51 -0
- package/registry/blocks/first-run/first-run.jsx +156 -0
- package/registry/blocks/first-run/index.js +5 -0
- package/registry/blocks/first-run/probe-rules.js +26 -0
- package/registry/blocks/fix-note/README.md +79 -0
- package/registry/blocks/fix-note/block.json +35 -0
- package/registry/blocks/fix-note/demo.jsx +30 -0
- package/registry/blocks/fix-note/fix-note.jsx +235 -0
- package/registry/blocks/fix-note/index.js +3 -0
- package/registry/blocks/flow-editor/README.md +108 -0
- package/registry/blocks/flow-editor/block.json +44 -0
- package/registry/blocks/flow-editor/demo.jsx +115 -0
- package/registry/blocks/flow-editor/flow-canvas.jsx +568 -0
- package/registry/blocks/flow-editor/flow-editor.jsx +154 -0
- package/registry/blocks/flow-editor/index.js +6 -0
- package/registry/blocks/flow-editor/minimap.jsx +78 -0
- package/registry/blocks/flow-editor/outline.jsx +134 -0
- package/registry/blocks/library-shelf/README.md +117 -0
- package/registry/blocks/library-shelf/block.json +28 -0
- package/registry/blocks/library-shelf/demo.jsx +68 -0
- package/registry/blocks/library-shelf/index.js +3 -0
- package/registry/blocks/library-shelf/library-shelf.jsx +211 -0
- package/registry/blocks/library-shelf/probe-rules.js +15 -0
- package/registry/blocks/margin-notes/README.md +222 -0
- package/registry/blocks/margin-notes/block.json +10 -0
- package/registry/blocks/margin-notes/demo.jsx +144 -0
- package/registry/blocks/margin-notes/index.js +20 -0
- package/registry/blocks/margin-notes/margin-model.js +224 -0
- package/registry/blocks/margin-notes/margin-notes.jsx +465 -0
- package/registry/blocks/needs-you/README.md +177 -0
- package/registry/blocks/needs-you/block.json +34 -0
- package/registry/blocks/needs-you/demo.jsx +143 -0
- package/registry/blocks/needs-you/index.js +3 -0
- package/registry/blocks/needs-you/needs-you.jsx +441 -0
- package/registry/blocks/pace-bar/README.md +230 -0
- package/registry/blocks/pace-bar/block.json +10 -0
- package/registry/blocks/pace-bar/demo.jsx +255 -0
- package/registry/blocks/pace-bar/index.js +22 -0
- package/registry/blocks/pace-bar/pace-bar.jsx +461 -0
- package/registry/blocks/pace-bar/pace-model.js +288 -0
- package/registry/blocks/record-grid/README.md +100 -0
- package/registry/blocks/record-grid/block.json +28 -0
- package/registry/blocks/record-grid/demo.jsx +43 -0
- package/registry/blocks/record-grid/index.js +3 -0
- package/registry/blocks/record-grid/record-grid.jsx +251 -0
- package/registry/blocks/run-history/README.md +138 -0
- package/registry/blocks/run-history/block.json +10 -0
- package/registry/blocks/run-history/demo.jsx +74 -0
- package/registry/blocks/run-history/index.js +3 -0
- package/registry/blocks/run-history/run-history.jsx +218 -0
- package/registry/blocks/run-view/README.md +174 -0
- package/registry/blocks/run-view/block.json +50 -0
- package/registry/blocks/run-view/demo.jsx +286 -0
- package/registry/blocks/run-view/index.js +5 -0
- package/registry/blocks/run-view/run-controls.jsx +266 -0
- package/registry/blocks/run-view/run-view.jsx +236 -0
- package/registry/blocks/run-view/runs-list.jsx +99 -0
- package/registry/blocks/schedule-card/README.md +121 -0
- package/registry/blocks/schedule-card/block.json +10 -0
- package/registry/blocks/schedule-card/demo.jsx +82 -0
- package/registry/blocks/schedule-card/index.js +3 -0
- package/registry/blocks/schedule-card/schedule-card.jsx +136 -0
- package/registry/blocks/schedule-engine/README.md +137 -0
- package/registry/blocks/schedule-engine/block.json +10 -0
- package/registry/blocks/schedule-engine/demo.jsx +82 -0
- package/registry/blocks/schedule-engine/engine.js +769 -0
- package/registry/blocks/schedule-engine/index.js +9 -0
- package/registry/blocks/schedule-engine/ops.js +71 -0
- package/registry/blocks/schedule-engine/place.js +294 -0
- package/registry/blocks/schedule-engine/tree.js +79 -0
- package/registry/blocks/schedule-engine/waits.js +80 -0
- package/registry/blocks/schedule-gantt/README.md +159 -0
- package/registry/blocks/schedule-gantt/block.json +10 -0
- package/registry/blocks/schedule-gantt/demo.jsx +223 -0
- package/registry/blocks/schedule-gantt/gantt-model.js +219 -0
- package/registry/blocks/schedule-gantt/geometry.js +176 -0
- package/registry/blocks/schedule-gantt/index.js +26 -0
- package/registry/blocks/schedule-gantt/schedule-gantt.jsx +882 -0
- package/registry/blocks/schedule-gantt/sheet.jsx +372 -0
- package/registry/blocks/schedule-gantt/track.jsx +190 -0
- package/registry/blocks/schedule-ruler/README.md +148 -0
- package/registry/blocks/schedule-ruler/block.json +10 -0
- package/registry/blocks/schedule-ruler/demo.jsx +181 -0
- package/registry/blocks/schedule-ruler/index.js +21 -0
- package/registry/blocks/schedule-ruler/ruler-model.js +239 -0
- package/registry/blocks/schedule-ruler/schedule-ruler.jsx +548 -0
- package/registry/blocks/source-receipt/README.md +97 -0
- package/registry/blocks/source-receipt/block.json +30 -0
- package/registry/blocks/source-receipt/demo.jsx +71 -0
- package/registry/blocks/source-receipt/index.js +3 -0
- package/registry/blocks/source-receipt/source-receipt.jsx +107 -0
- package/registry/blocks/spreadsheet/spreadsheet.jsx +15 -1
- package/registry/blocks/step-picker/README.md +78 -0
- package/registry/blocks/step-picker/block.json +31 -0
- package/registry/blocks/step-picker/demo.jsx +23 -0
- package/registry/blocks/step-picker/index.js +3 -0
- package/registry/blocks/step-picker/step-picker.jsx +144 -0
- package/registry/blocks/step-settings/README.md +100 -0
- package/registry/blocks/step-settings/block.json +44 -0
- package/registry/blocks/step-settings/demo.jsx +93 -0
- package/registry/blocks/step-settings/fields.jsx +58 -0
- package/registry/blocks/step-settings/flow-settings.jsx +115 -0
- package/registry/blocks/step-settings/index.js +5 -0
- package/registry/blocks/step-settings/step-settings.jsx +290 -0
- package/registry/blocks/suggestion/README.md +171 -0
- package/registry/blocks/suggestion/block.json +40 -0
- package/registry/blocks/suggestion/demo.jsx +91 -0
- package/registry/blocks/suggestion/index.js +3 -0
- package/registry/blocks/suggestion/suggestion.jsx +436 -0
- package/registry/blocks/sum-bar/README.md +122 -0
- package/registry/blocks/sum-bar/block.json +10 -0
- package/registry/blocks/sum-bar/demo.jsx +110 -0
- package/registry/blocks/sum-bar/index.js +5 -0
- package/registry/blocks/sum-bar/sum-bar.jsx +209 -0
- package/registry/blocks/sum-bar/sum-model.js +126 -0
- package/registry/blocks/tier-map/README.md +217 -0
- package/registry/blocks/tier-map/block.json +10 -0
- package/registry/blocks/tier-map/demo.jsx +222 -0
- package/registry/blocks/tier-map/index.js +24 -0
- package/registry/blocks/tier-map/tier-map.jsx +574 -0
- package/registry/blocks/tier-map/tier-model.js +318 -0
- package/registry/blocks/time-grid/README.md +305 -0
- package/registry/blocks/time-grid/block.json +10 -0
- package/registry/blocks/time-grid/demo.jsx +279 -0
- package/registry/blocks/time-grid/grid-model.js +322 -0
- package/registry/blocks/time-grid/index.js +25 -0
- package/registry/blocks/time-grid/time-grid.jsx +1325 -0
- package/registry/blocks/time-strip/README.md +141 -0
- package/registry/blocks/time-strip/block.json +10 -0
- package/registry/blocks/time-strip/demo.jsx +129 -0
- package/registry/blocks/time-strip/index.js +19 -0
- package/registry/blocks/time-strip/strip-model.js +178 -0
- package/registry/blocks/time-strip/time-strip.jsx +260 -0
- package/registry/blocks/top-bar/README.md +149 -0
- package/registry/blocks/top-bar/block.json +35 -0
- package/registry/blocks/top-bar/demo.jsx +78 -0
- package/registry/blocks/top-bar/index.js +5 -0
- package/registry/blocks/top-bar/probe-rules.js +74 -0
- package/registry/blocks/top-bar/top-bar-model.js +152 -0
- package/registry/blocks/top-bar/top-bar.jsx +244 -0
- package/registry/blocks/trigger-picker/README.md +98 -0
- package/registry/blocks/trigger-picker/block.json +38 -0
- package/registry/blocks/trigger-picker/demo.jsx +59 -0
- package/registry/blocks/trigger-picker/index.js +3 -0
- package/registry/blocks/trigger-picker/trigger-picker.jsx +374 -0
- package/registry/blocks/workflow-view/README.md +123 -0
- package/registry/blocks/workflow-view/block.json +10 -0
- package/registry/blocks/workflow-view/demo.jsx +90 -0
- package/registry/blocks/workflow-view/index.js +3 -0
- package/registry/blocks/workflow-view/workflow-view.jsx +203 -0
- package/src/install.mjs +77 -16
- package/src/registry.mjs +3 -0
- package/templates/next/browser/lib/data.js +6 -1
- package/templates/next/files/README.md +627 -24
- package/templates/next/files/check/automation-format.ts +2103 -0
- package/templates/next/files/check/automation-package.ts +142 -0
- package/templates/next/files/check/run.mjs +968 -9
- package/templates/next/files/components/ui/field.jsx +17 -4
- package/templates/next/files/components/ui/icon.jsx +13 -0
- package/templates/next/files/components/ui/index.js +2 -1
- package/templates/next/files/components/ui/layout.jsx +77 -2
- package/templates/next/files/components/ui/notice.jsx +70 -0
- package/templates/next/files/components/ui/page.jsx +124 -0
- package/templates/next/files/components/ui/stat.jsx +22 -7
- package/templates/next/files/components/ui/toast.jsx +6 -3
- package/templates/next/files/lib/automations.js +660 -0
- package/templates/next/files/lib/claw.js +241 -5
- package/templates/next/files/lib/door.js +92 -0
- package/templates/next/files/lib/hooks.js +1627 -8
- package/templates/next/files/lib/platform.js +529 -21
- package/templates/next/template.json +13 -3
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Gantt geometry: the axis and the link lines, as plain numbers. Pure, so
|
|
2
|
+
// the chart stays readable and the routing can be tested on its own.
|
|
3
|
+
|
|
4
|
+
import { dayOf, isoOf, weekdayOf } from "../schedule-engine";
|
|
5
|
+
|
|
6
|
+
export const ZOOMS = {
|
|
7
|
+
day: { label: "Days", ppd: 28, pad: 5 },
|
|
8
|
+
week: { label: "Weeks", ppd: 11, pad: 7 },
|
|
9
|
+
month: { label: "Months", ppd: 4, pad: 10 },
|
|
10
|
+
// The whole project in the width there is: the block works the ppd out.
|
|
11
|
+
fit: { label: "Fit", ppd: 6, pad: 6 },
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
15
|
+
const DAY_MS = 86400000;
|
|
16
|
+
const dateOf = (day) => new Date(day * DAY_MS);
|
|
17
|
+
const monthStart = (day) => {
|
|
18
|
+
const d = dateOf(day);
|
|
19
|
+
return Math.round(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1) / DAY_MS);
|
|
20
|
+
};
|
|
21
|
+
const addMonths = (day, n) => {
|
|
22
|
+
const d = dateOf(day);
|
|
23
|
+
return Math.round(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + n, 1) / DAY_MS);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** "Oct 28" */
|
|
27
|
+
export function shortDate(iso) {
|
|
28
|
+
const d = dayOf(iso);
|
|
29
|
+
if (d == null) return "";
|
|
30
|
+
return `${MONTHS[dateOf(d).getUTCMonth()]} ${dateOf(d).getUTCDate()}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The span the chart covers: every date in `dates`, padded, snapped to the zoom's grid. */
|
|
34
|
+
export function rangeFor(zoom, dates, today) {
|
|
35
|
+
const { pad } = ZOOMS[zoom] ?? ZOOMS.week;
|
|
36
|
+
let lo = dayOf(today) ?? Math.floor(Date.now() / DAY_MS);
|
|
37
|
+
let hi = lo;
|
|
38
|
+
for (const iso of dates) {
|
|
39
|
+
const d = dayOf(iso);
|
|
40
|
+
if (d == null) continue;
|
|
41
|
+
lo = Math.min(lo, d);
|
|
42
|
+
hi = Math.max(hi, d);
|
|
43
|
+
}
|
|
44
|
+
lo -= pad;
|
|
45
|
+
hi += pad * 2;
|
|
46
|
+
if (zoom === "month" || zoom === "fit") {
|
|
47
|
+
lo = monthStart(lo);
|
|
48
|
+
hi = zoom === "fit" ? hi : addMonths(hi, 1) - 1;
|
|
49
|
+
} else {
|
|
50
|
+
lo -= weekdayOf(lo);
|
|
51
|
+
hi += 6 - weekdayOf(hi);
|
|
52
|
+
}
|
|
53
|
+
const min = zoom === "day" ? 35 : zoom === "week" ? 91 : zoom === "fit" ? 60 : 120;
|
|
54
|
+
if (hi - lo < min) hi = lo + min;
|
|
55
|
+
return { from: lo, to: hi };
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The axis over [from, to]: `top` and `bottom` tiers of { start, end,
|
|
60
|
+
* label, dim? }, grid `lines` { day, strong }, and weekend `shade` spans.
|
|
61
|
+
*/
|
|
62
|
+
export function axisFor(zoom, from, to) {
|
|
63
|
+
const top = [];
|
|
64
|
+
const bottom = [];
|
|
65
|
+
const lines = [];
|
|
66
|
+
const shade = [];
|
|
67
|
+
if (zoom === "month" || zoom === "fit") {
|
|
68
|
+
for (let y = dateOf(from).getUTCFullYear(); y <= dateOf(to).getUTCFullYear(); y += 1) {
|
|
69
|
+
const a = Math.round(Date.UTC(y, 0, 1) / DAY_MS);
|
|
70
|
+
const b = Math.round(Date.UTC(y + 1, 0, 1) / DAY_MS) - 1;
|
|
71
|
+
top.push({ start: Math.max(a, from), end: Math.min(b, to), label: String(y) });
|
|
72
|
+
}
|
|
73
|
+
for (let m = monthStart(from); m <= to; m = addMonths(m, 1)) {
|
|
74
|
+
bottom.push({ start: Math.max(m, from), end: Math.min(addMonths(m, 1) - 1, to), label: MONTHS[dateOf(m).getUTCMonth()] });
|
|
75
|
+
lines.push({ day: m, strong: true });
|
|
76
|
+
}
|
|
77
|
+
for (let d = from; d <= to; d += 1) if (weekdayOf(d) === 0 && dateOf(d).getUTCDate() !== 1) lines.push({ day: d, strong: false });
|
|
78
|
+
return { top, bottom, lines, shade };
|
|
79
|
+
}
|
|
80
|
+
for (let m = monthStart(from); m <= to; m = addMonths(m, 1)) {
|
|
81
|
+
const d = dateOf(m);
|
|
82
|
+
top.push({ start: Math.max(m, from), end: Math.min(addMonths(m, 1) - 1, to), label: `${MONTHS[d.getUTCMonth()]} ${d.getUTCFullYear()}` });
|
|
83
|
+
}
|
|
84
|
+
for (let d = from; d <= to; d += 1) {
|
|
85
|
+
const w = weekdayOf(d);
|
|
86
|
+
if (w === 5) shade.push({ start: d, end: d + 1 });
|
|
87
|
+
if (zoom === "day") {
|
|
88
|
+
bottom.push({ start: d, end: d, label: String(dateOf(d).getUTCDate()), dim: w >= 5 });
|
|
89
|
+
lines.push({ day: d, strong: w === 0 });
|
|
90
|
+
} else if (w === 0) {
|
|
91
|
+
bottom.push({ start: d, end: Math.min(d + 6, to), label: String(dateOf(d).getUTCDate()) });
|
|
92
|
+
lines.push({ day: d, strong: true });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { top, bottom, lines, shade };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The line for one link, as orthogonal segments. Boxes are the bars on
|
|
100
|
+
* screen: { x0, x1, y (centre), top, bottom, milestone }. Finish-to-start
|
|
101
|
+
* drops into the successor from above or below at its start, the way a
|
|
102
|
+
* scheduler draws it; the other kinds run beside the bars. `bold` routes
|
|
103
|
+
* into the bar's centre line instead of its edge, so the critical path
|
|
104
|
+
* reads as one continuous line.
|
|
105
|
+
*
|
|
106
|
+
* → { segments: [{ x1, y1, x2, y2 }], head: { x, y, dir } | null }
|
|
107
|
+
* dir: "down" | "up" | "left" | "right"
|
|
108
|
+
*/
|
|
109
|
+
export function routeLink(predBox, succ, kind, { rowH = 32, bold = false } = {}) {
|
|
110
|
+
const STUB = 6;
|
|
111
|
+
// A line leaves a milestone from its centre, so it drops straight out
|
|
112
|
+
// of the diamond instead of jogging round its tip.
|
|
113
|
+
const pred = predBox.milestone ? { ...predBox, x0: (predBox.x0 + predBox.x1) / 2, x1: (predBox.x0 + predBox.x1) / 2 } : predBox;
|
|
114
|
+
const below = succ.y > pred.y;
|
|
115
|
+
const boundary = pred.y + (below ? rowH / 2 : -rowH / 2);
|
|
116
|
+
const segs = [];
|
|
117
|
+
const add = (x1, y1, x2, y2) => {
|
|
118
|
+
if (x1 === x2 && y1 === y2) return;
|
|
119
|
+
segs.push({ x1, y1, x2, y2 });
|
|
120
|
+
};
|
|
121
|
+
const edgeY = below ? succ.top : succ.bottom;
|
|
122
|
+
const vHead = below ? "down" : "up";
|
|
123
|
+
|
|
124
|
+
if (kind === "SS") {
|
|
125
|
+
const xv = Math.min(pred.x0, succ.x0) - STUB;
|
|
126
|
+
add(pred.x0, pred.y, xv, pred.y);
|
|
127
|
+
add(xv, pred.y, xv, succ.y);
|
|
128
|
+
add(xv, succ.y, succ.x0, succ.y);
|
|
129
|
+
return { segments: segs, head: bold ? null : { x: succ.x0, y: succ.y, dir: "right" } };
|
|
130
|
+
}
|
|
131
|
+
if (kind === "FF") {
|
|
132
|
+
const xv = Math.max(pred.x1, succ.x1) + STUB;
|
|
133
|
+
add(pred.x1, pred.y, xv, pred.y);
|
|
134
|
+
add(xv, pred.y, xv, succ.y);
|
|
135
|
+
add(xv, succ.y, succ.x1, succ.y);
|
|
136
|
+
return { segments: segs, head: bold ? null : { x: succ.x1, y: succ.y, dir: "left" } };
|
|
137
|
+
}
|
|
138
|
+
if (kind === "SF") {
|
|
139
|
+
const xa = pred.x0 - STUB;
|
|
140
|
+
if (succ.x1 + STUB <= xa) {
|
|
141
|
+
add(pred.x0, pred.y, xa, pred.y);
|
|
142
|
+
add(xa, pred.y, xa, succ.y);
|
|
143
|
+
add(xa, succ.y, succ.x1, succ.y);
|
|
144
|
+
} else {
|
|
145
|
+
const xb = succ.x1 + STUB;
|
|
146
|
+
add(pred.x0, pred.y, xa, pred.y);
|
|
147
|
+
add(xa, pred.y, xa, boundary);
|
|
148
|
+
add(xa, boundary, xb, boundary);
|
|
149
|
+
add(xb, boundary, xb, succ.y);
|
|
150
|
+
add(xb, succ.y, succ.x1, succ.y);
|
|
151
|
+
}
|
|
152
|
+
return { segments: segs, head: bold ? null : { x: succ.x1, y: succ.y, dir: "left" } };
|
|
153
|
+
}
|
|
154
|
+
// Finish to start.
|
|
155
|
+
const drop = succ.milestone ? (succ.x0 + succ.x1) / 2 : bold ? succ.x0 : succ.x0 + 4;
|
|
156
|
+
const endY = bold ? succ.y : edgeY;
|
|
157
|
+
if (drop >= pred.x1) {
|
|
158
|
+
add(pred.x1, pred.y, drop, pred.y);
|
|
159
|
+
add(drop, pred.y, drop, endY);
|
|
160
|
+
} else {
|
|
161
|
+
const xa = pred.x1 + STUB;
|
|
162
|
+
add(pred.x1, pred.y, xa, pred.y);
|
|
163
|
+
add(xa, pred.y, xa, boundary);
|
|
164
|
+
add(xa, boundary, drop, boundary);
|
|
165
|
+
add(drop, boundary, drop, endY);
|
|
166
|
+
}
|
|
167
|
+
return { segments: segs, head: bold ? null : { x: drop, y: endY, dir: vHead } };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Today at the server, then the browser's own day once mounted. */
|
|
171
|
+
export function isoToday() {
|
|
172
|
+
const d = new Date();
|
|
173
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export { dayOf, isoOf };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// The schedule-gantt block — `makersclaw add schedule-gantt`. Fixed:
|
|
2
|
+
// compose it through its props (README.md beside this file). The model's
|
|
3
|
+
// helpers are plain functions; they work on the server too.
|
|
4
|
+
export { ScheduleGantt } from "./schedule-gantt";
|
|
5
|
+
export { TagChip, CellInput, ROW } from "./sheet";
|
|
6
|
+
export { ZOOMS, axisFor, rangeFor, routeLink, shortDate, isoToday } from "./geometry";
|
|
7
|
+
export {
|
|
8
|
+
COLUMNS,
|
|
9
|
+
DEFAULT_COLUMNS,
|
|
10
|
+
MONTHS,
|
|
11
|
+
WEEKDAYS,
|
|
12
|
+
baselineDelta,
|
|
13
|
+
barLabel,
|
|
14
|
+
columnsFor,
|
|
15
|
+
describeDrag,
|
|
16
|
+
dayWords,
|
|
17
|
+
dragLines,
|
|
18
|
+
fixedWidth,
|
|
19
|
+
gapOf,
|
|
20
|
+
lengthWords,
|
|
21
|
+
linkLines,
|
|
22
|
+
loopWords,
|
|
23
|
+
monthDay,
|
|
24
|
+
selectionMoves,
|
|
25
|
+
slackWords,
|
|
26
|
+
} from "./gantt-model";
|