makersclaw 0.2.0 → 0.3.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.
- package/THIRD-PARTY-NOTICES.md +180 -0
- package/package.json +3 -2
- package/r/annotate.json +62 -0
- package/r/approval-request.json +52 -0
- package/r/audio-player.json +74 -0
- package/r/auth-form.json +55 -0
- package/r/board.json +10 -6
- package/r/calendar-view.json +105 -0
- package/r/cart.json +62 -0
- package/r/chart.json +83 -0
- package/r/chat.json +95 -0
- package/r/code-editor.json +94 -0
- package/r/comment-box.json +64 -0
- package/r/contact-section.json +53 -0
- package/r/core.json +205 -8
- package/r/csv-import.json +63 -0
- package/r/data-table.json +69 -0
- package/r/diagram.json +74 -0
- package/r/doc-editor.json +82 -0
- package/r/doc-page.json +61 -0
- package/r/email-render.json +73 -0
- package/r/faq.json +50 -0
- package/r/file-upload.json +54 -0
- package/r/flow-canvas.json +93 -0
- package/r/footer.json +52 -0
- package/r/gantt.json +70 -0
- package/r/job-panel.json +12 -7
- package/r/json-editor.json +66 -0
- package/r/map.json +89 -0
- package/r/menubar.json +52 -0
- package/r/mind-map.json +67 -0
- package/r/navigation-menu.json +52 -0
- package/r/order-detail.json +54 -0
- package/r/org-chart.json +66 -0
- package/r/page-builder.json +105 -0
- package/r/payment-methods.json +51 -0
- package/r/pdf-document.json +79 -0
- package/r/pdf-viewer.json +88 -0
- package/r/product-detail.json +76 -0
- package/r/product-grid.json +65 -0
- package/r/record-form.json +67 -0
- package/r/record-notes.json +55 -0
- package/r/registry.json +3411 -29
- package/r/search-dialog.json +51 -0
- package/r/settings-list.json +66 -0
- package/r/setup-checklist.json +51 -0
- package/r/share-dialog.json +52 -0
- package/r/sidebar.json +69 -0
- package/r/signature-pad.json +72 -0
- package/r/sketch-canvas.json +99 -0
- package/r/spreadsheet.json +90 -0
- package/r/stat-cards.json +66 -0
- package/r/task-list.json +63 -0
- package/r/task-model.json +98 -0
- package/r/testimonials.json +52 -0
- package/r/transaction-list.json +53 -0
- package/r/whiteboard.json +66 -0
- package/registry/blocks/annotate/README.md +179 -0
- package/registry/blocks/annotate/annotate-data.js +250 -0
- package/registry/blocks/annotate/annotate.jsx +646 -0
- package/registry/blocks/annotate/block.json +10 -0
- package/registry/blocks/annotate/demo.jsx +135 -0
- package/registry/blocks/annotate/index.js +15 -0
- package/registry/blocks/approval-request/README.md +116 -0
- package/registry/blocks/approval-request/approval-request.jsx +386 -0
- package/registry/blocks/approval-request/block.json +10 -0
- package/registry/blocks/approval-request/demo.jsx +127 -0
- package/registry/blocks/approval-request/index.js +4 -0
- package/registry/blocks/audio-player/README.md +167 -0
- package/registry/blocks/audio-player/audio-player.jsx +623 -0
- package/registry/blocks/audio-player/block.json +14 -0
- package/registry/blocks/audio-player/colors.js +109 -0
- package/registry/blocks/audio-player/demo.jsx +209 -0
- package/registry/blocks/audio-player/index.js +6 -0
- package/registry/blocks/audio-player/time.js +67 -0
- package/registry/blocks/audio-player/wavesurfer.js +9 -0
- package/registry/blocks/auth-form/README.md +126 -0
- package/registry/blocks/auth-form/auth-form.jsx +568 -0
- package/registry/blocks/auth-form/block.json +10 -0
- package/registry/blocks/auth-form/demo.jsx +131 -0
- package/registry/blocks/auth-form/index.js +3 -0
- package/registry/blocks/board/README.md +55 -5
- package/registry/blocks/board/block.json +2 -2
- package/registry/blocks/board/board.jsx +230 -86
- package/registry/blocks/board/demo.jsx +103 -24
- package/registry/blocks/calendar-view/README.md +180 -0
- package/registry/blocks/calendar-view/agenda.jsx +147 -0
- package/registry/blocks/calendar-view/block.json +76 -0
- package/registry/blocks/calendar-view/calendar-model.js +442 -0
- package/registry/blocks/calendar-view/calendar.jsx +627 -0
- package/registry/blocks/calendar-view/demo.jsx +195 -0
- package/registry/blocks/calendar-view/draft.jsx +49 -0
- package/registry/blocks/calendar-view/index.js +39 -0
- package/registry/blocks/calendar-view/month.jsx +346 -0
- package/registry/blocks/calendar-view/paint.js +69 -0
- package/registry/blocks/calendar-view/time-grid.jsx +527 -0
- package/registry/blocks/calendar-view/tray.jsx +87 -0
- package/registry/blocks/cart/README.md +146 -0
- package/registry/blocks/cart/block.json +10 -0
- package/registry/blocks/cart/cart.jsx +597 -0
- package/registry/blocks/cart/demo.jsx +98 -0
- package/registry/blocks/cart/index.js +4 -0
- package/registry/blocks/cart/money.js +28 -0
- package/registry/blocks/chart/README.md +316 -0
- package/registry/blocks/chart/block.json +10 -0
- package/registry/blocks/chart/cartesian.jsx +642 -0
- package/registry/blocks/chart/core.jsx +262 -0
- package/registry/blocks/chart/demo.jsx +357 -0
- package/registry/blocks/chart/heatmap.jsx +336 -0
- package/registry/blocks/chart/index.js +8 -0
- package/registry/blocks/chart/pie.jsx +245 -0
- package/registry/blocks/chart/sparkline.jsx +88 -0
- package/registry/blocks/chat/README.md +273 -0
- package/registry/blocks/chat/attachment.jsx +95 -0
- package/registry/blocks/chat/block.json +10 -0
- package/registry/blocks/chat/chat.jsx +132 -0
- package/registry/blocks/chat/composer.jsx +364 -0
- package/registry/blocks/chat/demo.jsx +578 -0
- package/registry/blocks/chat/header.jsx +34 -0
- package/registry/blocks/chat/index.js +9 -0
- package/registry/blocks/chat/message.jsx +450 -0
- package/registry/blocks/chat/scroller.jsx +247 -0
- package/registry/blocks/chat/text.jsx +104 -0
- package/registry/blocks/code-editor/README.md +210 -0
- package/registry/blocks/code-editor/block.json +22 -0
- package/registry/blocks/code-editor/code-editor.jsx +534 -0
- package/registry/blocks/code-editor/codemirror.js +38 -0
- package/registry/blocks/code-editor/demo.jsx +205 -0
- package/registry/blocks/code-editor/index.js +8 -0
- package/registry/blocks/code-editor/json.js +317 -0
- package/registry/blocks/code-editor/sql.js +136 -0
- package/registry/blocks/code-editor/text.js +101 -0
- package/registry/blocks/code-editor/theme.js +186 -0
- package/registry/blocks/comment-box/README.md +123 -0
- package/registry/blocks/comment-box/block.json +10 -0
- package/registry/blocks/comment-box/comment-body.jsx +217 -0
- package/registry/blocks/comment-box/comment-box.jsx +198 -0
- package/registry/blocks/comment-box/comment-time.jsx +77 -0
- package/registry/blocks/comment-box/demo.jsx +141 -0
- package/registry/blocks/comment-box/index.js +8 -0
- package/registry/blocks/contact-section/README.md +152 -0
- package/registry/blocks/contact-section/block.json +11 -0
- package/registry/blocks/contact-section/contact-section.jsx +509 -0
- package/registry/blocks/contact-section/demo.jsx +93 -0
- package/registry/blocks/contact-section/index.js +4 -0
- package/registry/blocks/csv-import/README.md +133 -0
- package/registry/blocks/csv-import/block.json +13 -0
- package/registry/blocks/csv-import/csv-import.jsx +479 -0
- package/registry/blocks/csv-import/demo.jsx +106 -0
- package/registry/blocks/csv-import/import.js +200 -0
- package/registry/blocks/csv-import/index.js +7 -0
- package/registry/blocks/data-table/README.md +386 -0
- package/registry/blocks/data-table/block.json +10 -0
- package/registry/blocks/data-table/data-table.jsx +1164 -0
- package/registry/blocks/data-table/demo.jsx +588 -0
- package/registry/blocks/data-table/index.js +5 -0
- package/registry/blocks/data-table/model.js +169 -0
- package/registry/blocks/diagram/README.md +108 -0
- package/registry/blocks/diagram/block.json +13 -0
- package/registry/blocks/diagram/demo.jsx +113 -0
- package/registry/blocks/diagram/diagram.jsx +481 -0
- package/registry/blocks/diagram/index.js +7 -0
- package/registry/blocks/diagram/mermaid.js +52 -0
- package/registry/blocks/diagram/palette.js +313 -0
- package/registry/blocks/diagram/source.js +98 -0
- package/registry/blocks/doc-editor/README.md +215 -0
- package/registry/blocks/doc-editor/block.json +15 -0
- package/registry/blocks/doc-editor/demo.jsx +225 -0
- package/registry/blocks/doc-editor/doc-editor.jsx +291 -0
- package/registry/blocks/doc-editor/doc.js +309 -0
- package/registry/blocks/doc-editor/index.js +7 -0
- package/registry/blocks/doc-editor/schema.jsx +56 -0
- package/registry/blocks/doc-editor/shadcn-classes.js +110 -0
- package/registry/blocks/doc-editor/theme.js +82 -0
- package/registry/blocks/doc-page/README.md +119 -0
- package/registry/blocks/doc-page/autosave.js +104 -0
- package/registry/blocks/doc-page/block.json +10 -0
- package/registry/blocks/doc-page/demo.jsx +137 -0
- package/registry/blocks/doc-page/doc-page.jsx +276 -0
- package/registry/blocks/doc-page/index.js +4 -0
- package/registry/blocks/email-render/README.md +151 -0
- package/registry/blocks/email-render/block.json +14 -0
- package/registry/blocks/email-render/demo.jsx +153 -0
- package/registry/blocks/email-render/doc-email.jsx +210 -0
- package/registry/blocks/email-render/email.jsx +221 -0
- package/registry/blocks/email-render/index.js +10 -0
- package/registry/blocks/email-render/render.js +50 -0
- package/registry/blocks/email-render/theme.js +215 -0
- package/registry/blocks/faq/README.md +101 -0
- package/registry/blocks/faq/block.json +11 -0
- package/registry/blocks/faq/demo.jsx +89 -0
- package/registry/blocks/faq/faq.jsx +220 -0
- package/registry/blocks/faq/index.js +4 -0
- package/registry/blocks/file-upload/README.md +138 -0
- package/registry/blocks/file-upload/block.json +10 -0
- package/registry/blocks/file-upload/demo.jsx +204 -0
- package/registry/blocks/file-upload/file-upload.jsx +635 -0
- package/registry/blocks/file-upload/index.js +4 -0
- package/registry/blocks/flow-canvas/README.md +420 -0
- package/registry/blocks/flow-canvas/block.json +13 -0
- package/registry/blocks/flow-canvas/board.js +819 -0
- package/registry/blocks/flow-canvas/chrome.jsx +649 -0
- package/registry/blocks/flow-canvas/context.jsx +35 -0
- package/registry/blocks/flow-canvas/demo.jsx +249 -0
- package/registry/blocks/flow-canvas/edges.jsx +107 -0
- package/registry/blocks/flow-canvas/flow-canvas.jsx +1329 -0
- package/registry/blocks/flow-canvas/index.js +41 -0
- package/registry/blocks/flow-canvas/nodes.jsx +392 -0
- package/registry/blocks/flow-canvas/theme.js +174 -0
- package/registry/blocks/footer/README.md +133 -0
- package/registry/blocks/footer/block.json +11 -0
- package/registry/blocks/footer/demo.jsx +119 -0
- package/registry/blocks/footer/footer.jsx +406 -0
- package/registry/blocks/footer/index.js +4 -0
- package/registry/blocks/gantt/README.md +220 -0
- package/registry/blocks/gantt/block.json +10 -0
- package/registry/blocks/gantt/demo.jsx +148 -0
- package/registry/blocks/gantt/gantt.jsx +923 -0
- package/registry/blocks/gantt/index.js +7 -0
- package/registry/blocks/gantt/rows.jsx +468 -0
- package/registry/blocks/gantt/schedule.js +278 -0
- package/registry/blocks/job-panel/README.md +80 -0
- package/registry/blocks/job-panel/block.json +3 -3
- package/registry/blocks/job-panel/demo.jsx +230 -3
- package/registry/blocks/job-panel/job-panel.jsx +169 -3
- package/registry/blocks/json-editor/README.md +133 -0
- package/registry/blocks/json-editor/block.json +10 -0
- package/registry/blocks/json-editor/demo.jsx +92 -0
- package/registry/blocks/json-editor/index.js +7 -0
- package/registry/blocks/json-editor/json-editor.jsx +305 -0
- package/registry/blocks/json-editor/json-tree.jsx +393 -0
- package/registry/blocks/json-editor/tree.js +225 -0
- package/registry/blocks/map/README.md +221 -0
- package/registry/blocks/map/block.json +14 -0
- package/registry/blocks/map/demo.jsx +201 -0
- package/registry/blocks/map/geo.js +198 -0
- package/registry/blocks/map/index.js +8 -0
- package/registry/blocks/map/list.jsx +128 -0
- package/registry/blocks/map/map-view.jsx +715 -0
- package/registry/blocks/map/maplibre.js +30 -0
- package/registry/blocks/map/marks.jsx +146 -0
- package/registry/blocks/map/theme.js +142 -0
- package/registry/blocks/menubar/README.md +109 -0
- package/registry/blocks/menubar/block.json +10 -0
- package/registry/blocks/menubar/demo.jsx +128 -0
- package/registry/blocks/menubar/index.js +4 -0
- package/registry/blocks/menubar/menubar.jsx +199 -0
- package/registry/blocks/mind-map/README.md +206 -0
- package/registry/blocks/mind-map/block.json +10 -0
- package/registry/blocks/mind-map/demo.jsx +103 -0
- package/registry/blocks/mind-map/index.js +31 -0
- package/registry/blocks/mind-map/mind-map.jsx +1125 -0
- package/registry/blocks/mind-map/topic.jsx +143 -0
- package/registry/blocks/mind-map/tree.js +645 -0
- package/registry/blocks/navigation-menu/README.md +124 -0
- package/registry/blocks/navigation-menu/block.json +10 -0
- package/registry/blocks/navigation-menu/demo.jsx +84 -0
- package/registry/blocks/navigation-menu/index.js +4 -0
- package/registry/blocks/navigation-menu/navigation-menu.jsx +448 -0
- package/registry/blocks/order-detail/README.md +109 -0
- package/registry/blocks/order-detail/block.json +10 -0
- package/registry/blocks/order-detail/demo.jsx +88 -0
- package/registry/blocks/order-detail/index.js +4 -0
- package/registry/blocks/order-detail/order-detail.jsx +354 -0
- package/registry/blocks/org-chart/README.md +145 -0
- package/registry/blocks/org-chart/block.json +10 -0
- package/registry/blocks/org-chart/demo.jsx +94 -0
- package/registry/blocks/org-chart/index.js +7 -0
- package/registry/blocks/org-chart/org-chart.jsx +631 -0
- package/registry/blocks/org-chart/org.js +245 -0
- package/registry/blocks/org-chart/person.jsx +96 -0
- package/registry/blocks/page-builder/README.md +257 -0
- package/registry/blocks/page-builder/block.json +14 -0
- package/registry/blocks/page-builder/demo.jsx +145 -0
- package/registry/blocks/page-builder/grapes.js +18 -0
- package/registry/blocks/page-builder/index.js +11 -0
- package/registry/blocks/page-builder/page-builder.jsx +704 -0
- package/registry/blocks/page-builder/page-view.jsx +33 -0
- package/registry/blocks/page-builder/page.js +118 -0
- package/registry/blocks/page-builder/panels.jsx +588 -0
- package/registry/blocks/page-builder/sections.js +209 -0
- package/registry/blocks/page-builder/theme.js +87 -0
- package/registry/blocks/page-builder/thumbs.jsx +189 -0
- package/registry/blocks/page-builder/tokens.js +329 -0
- package/registry/blocks/payment-methods/README.md +104 -0
- package/registry/blocks/payment-methods/block.json +10 -0
- package/registry/blocks/payment-methods/demo.jsx +71 -0
- package/registry/blocks/payment-methods/index.js +4 -0
- package/registry/blocks/payment-methods/payment-methods.jsx +302 -0
- package/registry/blocks/pdf-document/README.md +213 -0
- package/registry/blocks/pdf-document/block.json +13 -0
- package/registry/blocks/pdf-document/demo.jsx +136 -0
- package/registry/blocks/pdf-document/index.js +33 -0
- package/registry/blocks/pdf-document/money.js +83 -0
- package/registry/blocks/pdf-document/pdf-document.jsx +144 -0
- package/registry/blocks/pdf-document/primitives.jsx +271 -0
- package/registry/blocks/pdf-document/quote.jsx +179 -0
- package/registry/blocks/pdf-document/theme.js +193 -0
- package/registry/blocks/pdf-viewer/README.md +191 -0
- package/registry/blocks/pdf-viewer/block.json +14 -0
- package/registry/blocks/pdf-viewer/demo.jsx +252 -0
- package/registry/blocks/pdf-viewer/helpers.js +270 -0
- package/registry/blocks/pdf-viewer/index.js +8 -0
- package/registry/blocks/pdf-viewer/notes.jsx +195 -0
- package/registry/blocks/pdf-viewer/pdf-viewer.jsx +1368 -0
- package/registry/blocks/pdf-viewer/pdfjs.js +37 -0
- package/registry/blocks/pdf-viewer/ssr-shim-end.js +6 -0
- package/registry/blocks/pdf-viewer/ssr-shim.js +44 -0
- package/registry/blocks/product-detail/README.md +217 -0
- package/registry/blocks/product-detail/block.json +10 -0
- package/registry/blocks/product-detail/demo.jsx +233 -0
- package/registry/blocks/product-detail/index.js +7 -0
- package/registry/blocks/product-detail/price.jsx +115 -0
- package/registry/blocks/product-detail/product-detail.jsx +348 -0
- package/registry/blocks/product-detail/product-media.jsx +102 -0
- package/registry/blocks/product-detail/product-options.jsx +144 -0
- package/registry/blocks/product-grid/README.md +162 -0
- package/registry/blocks/product-grid/block.json +10 -0
- package/registry/blocks/product-grid/demo.jsx +255 -0
- package/registry/blocks/product-grid/index.js +5 -0
- package/registry/blocks/product-grid/product-card.jsx +232 -0
- package/registry/blocks/product-grid/product-grid.jsx +235 -0
- package/registry/blocks/record-form/README.md +196 -0
- package/registry/blocks/record-form/block.json +10 -0
- package/registry/blocks/record-form/demo.jsx +525 -0
- package/registry/blocks/record-form/index.js +4 -0
- package/registry/blocks/record-form/record-fields.jsx +457 -0
- package/registry/blocks/record-form/record-form.jsx +415 -0
- package/registry/blocks/record-form/rules.js +81 -0
- package/registry/blocks/record-notes/README.md +139 -0
- package/registry/blocks/record-notes/block.json +10 -0
- package/registry/blocks/record-notes/demo.jsx +179 -0
- package/registry/blocks/record-notes/index.js +4 -0
- package/registry/blocks/record-notes/record-notes.jsx +266 -0
- package/registry/blocks/search-dialog/README.md +108 -0
- package/registry/blocks/search-dialog/block.json +10 -0
- package/registry/blocks/search-dialog/demo.jsx +116 -0
- package/registry/blocks/search-dialog/index.js +3 -0
- package/registry/blocks/search-dialog/search-dialog.jsx +235 -0
- package/registry/blocks/settings-list/README.md +171 -0
- package/registry/blocks/settings-list/block.json +10 -0
- package/registry/blocks/settings-list/demo.jsx +333 -0
- package/registry/blocks/settings-list/index.js +4 -0
- package/registry/blocks/settings-list/row-state.jsx +93 -0
- package/registry/blocks/settings-list/settings-list.jsx +349 -0
- package/registry/blocks/settings-list/settings-matrix.jsx +118 -0
- package/registry/blocks/setup-checklist/README.md +142 -0
- package/registry/blocks/setup-checklist/block.json +10 -0
- package/registry/blocks/setup-checklist/demo.jsx +159 -0
- package/registry/blocks/setup-checklist/index.js +4 -0
- package/registry/blocks/setup-checklist/setup-checklist.jsx +446 -0
- package/registry/blocks/share-dialog/README.md +113 -0
- package/registry/blocks/share-dialog/block.json +10 -0
- package/registry/blocks/share-dialog/demo.jsx +140 -0
- package/registry/blocks/share-dialog/index.js +3 -0
- package/registry/blocks/share-dialog/share-dialog.jsx +384 -0
- package/registry/blocks/sidebar/README.md +190 -0
- package/registry/blocks/sidebar/block.json +43 -0
- package/registry/blocks/sidebar/demo.jsx +577 -0
- package/registry/blocks/sidebar/index.js +4 -0
- package/registry/blocks/sidebar/sidebar-panel.jsx +149 -0
- package/registry/blocks/sidebar/sidebar.jsx +864 -0
- package/registry/blocks/signature-pad/README.md +137 -0
- package/registry/blocks/signature-pad/block.json +13 -0
- package/registry/blocks/signature-pad/colors.js +115 -0
- package/registry/blocks/signature-pad/demo.jsx +94 -0
- package/registry/blocks/signature-pad/index.js +6 -0
- package/registry/blocks/signature-pad/pad.js +7 -0
- package/registry/blocks/signature-pad/signature-pad.jsx +434 -0
- package/registry/blocks/signature-pad/signature.js +68 -0
- package/registry/blocks/sketch-canvas/README.md +280 -0
- package/registry/blocks/sketch-canvas/block.json +13 -0
- package/registry/blocks/sketch-canvas/demo.jsx +159 -0
- package/registry/blocks/sketch-canvas/excalidraw.js +40 -0
- package/registry/blocks/sketch-canvas/index.js +9 -0
- package/registry/blocks/sketch-canvas/palette.js +226 -0
- package/registry/blocks/sketch-canvas/sketch-canvas.jsx +1188 -0
- package/registry/blocks/sketch-canvas/sketch.js +179 -0
- package/registry/blocks/sketch-canvas/ssr-shim-end.js +6 -0
- package/registry/blocks/sketch-canvas/ssr-shim.js +45 -0
- package/registry/blocks/sketch-canvas/stamps.js +104 -0
- package/registry/blocks/sketch-canvas/theme.js +131 -0
- package/registry/blocks/spreadsheet/README.md +307 -0
- package/registry/blocks/spreadsheet/block.json +13 -0
- package/registry/blocks/spreadsheet/cells.jsx +455 -0
- package/registry/blocks/spreadsheet/chrome.jsx +325 -0
- package/registry/blocks/spreadsheet/demo.jsx +177 -0
- package/registry/blocks/spreadsheet/grid.js +387 -0
- package/registry/blocks/spreadsheet/index.js +34 -0
- package/registry/blocks/spreadsheet/spreadsheet.jsx +1732 -0
- package/registry/blocks/spreadsheet/types.js +473 -0
- package/registry/blocks/stat-cards/README.md +173 -0
- package/registry/blocks/stat-cards/block.json +10 -0
- package/registry/blocks/stat-cards/demo.jsx +257 -0
- package/registry/blocks/stat-cards/index.js +4 -0
- package/registry/blocks/stat-cards/stat-cards.jsx +307 -0
- package/registry/blocks/stat-cards/usage.jsx +243 -0
- package/registry/blocks/task-list/README.md +176 -0
- package/registry/blocks/task-list/block.json +10 -0
- package/registry/blocks/task-list/demo.jsx +134 -0
- package/registry/blocks/task-list/index.js +5 -0
- package/registry/blocks/task-list/task-list.jsx +907 -0
- package/registry/blocks/task-model/README.md +455 -0
- package/registry/blocks/task-model/block.json +167 -0
- package/registry/blocks/task-model/changes.js +89 -0
- package/registry/blocks/task-model/dates.js +371 -0
- package/registry/blocks/task-model/demo.jsx +215 -0
- package/registry/blocks/task-model/dnd.jsx +240 -0
- package/registry/blocks/task-model/index.js +97 -0
- package/registry/blocks/task-model/model.js +919 -0
- package/registry/blocks/task-model/parts.jsx +449 -0
- package/registry/blocks/task-model/toolbar.jsx +271 -0
- package/registry/blocks/testimonials/README.md +139 -0
- package/registry/blocks/testimonials/block.json +11 -0
- package/registry/blocks/testimonials/demo.jsx +137 -0
- package/registry/blocks/testimonials/index.js +4 -0
- package/registry/blocks/testimonials/testimonials.jsx +430 -0
- package/registry/blocks/transaction-list/README.md +126 -0
- package/registry/blocks/transaction-list/block.json +10 -0
- package/registry/blocks/transaction-list/demo.jsx +79 -0
- package/registry/blocks/transaction-list/index.js +4 -0
- package/registry/blocks/transaction-list/transaction-list.jsx +383 -0
- package/registry/blocks/whiteboard/README.md +179 -0
- package/registry/blocks/whiteboard/block.json +10 -0
- package/registry/blocks/whiteboard/demo.jsx +169 -0
- package/registry/blocks/whiteboard/index.js +6 -0
- package/registry/blocks/whiteboard/templates.js +150 -0
- package/registry/blocks/whiteboard/whiteboard.jsx +721 -0
- package/src/install.mjs +18 -0
- package/src/shadcn.mjs +8 -0
- package/templates/next/files/README.md +145 -11
- package/templates/next/files/app/globals.css +55 -4
- package/templates/next/files/check/run.mjs +3 -3
- package/templates/next/files/components/ui/avatar.jsx +141 -0
- package/templates/next/files/components/ui/breadcrumb.jsx +149 -0
- package/templates/next/files/components/ui/button-group.jsx +70 -0
- package/templates/next/files/components/ui/button.jsx +132 -12
- package/templates/next/files/components/ui/calendar.jsx +609 -0
- package/templates/next/files/components/ui/carousel.jsx +281 -0
- package/templates/next/files/components/ui/collapsible.jsx +208 -0
- package/templates/next/files/components/ui/combobox.jsx +608 -0
- package/templates/next/files/components/ui/command.jsx +577 -0
- package/templates/next/files/components/ui/context-menu.jsx +191 -0
- package/templates/next/files/components/ui/date-picker.jsx +360 -0
- package/templates/next/files/components/ui/distribution.jsx +117 -0
- package/templates/next/files/components/ui/feedback.jsx +143 -0
- package/templates/next/files/components/ui/field.jsx +115 -3
- package/templates/next/files/components/ui/file-input.jsx +234 -0
- package/templates/next/files/components/ui/icon.jsx +130 -8
- package/templates/next/files/components/ui/image.jsx +143 -0
- package/templates/next/files/components/ui/index.js +47 -2
- package/templates/next/files/components/ui/input-group.jsx +213 -0
- package/templates/next/files/components/ui/input-otp.jsx +170 -0
- package/templates/next/files/components/ui/item.jsx +206 -0
- package/templates/next/files/components/ui/menu.jsx +454 -82
- package/templates/next/files/components/ui/notice.jsx +126 -14
- package/templates/next/files/components/ui/pagination.jsx +156 -0
- package/templates/next/files/components/ui/popover.jsx +284 -0
- package/templates/next/files/components/ui/radio.jsx +193 -0
- package/templates/next/files/components/ui/rating.jsx +131 -0
- package/templates/next/files/components/ui/resizable.jsx +338 -0
- package/templates/next/files/components/ui/scroll-area.jsx +123 -0
- package/templates/next/files/components/ui/separator.jsx +119 -0
- package/templates/next/files/components/ui/sheet.jsx +96 -11
- package/templates/next/files/components/ui/slider.jsx +174 -0
- package/templates/next/files/components/ui/stat.jsx +574 -0
- package/templates/next/files/components/ui/steps.jsx +338 -0
- package/templates/next/files/components/ui/swatch.jsx +33 -0
- package/templates/next/files/components/ui/table.jsx +130 -0
- package/templates/next/files/components/ui/toast.jsx +440 -0
- package/templates/next/files/components/ui/toggle.jsx +195 -0
- package/templates/next/files/components/ui/tooltip.jsx +270 -0
- package/templates/next/template.json +264 -8
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
// The grid's pure helpers: the view (which columns show, in what order,
|
|
2
|
+
// how wide, what is sorted and filtered), rows through that view, ranges,
|
|
3
|
+
// the clipboard as TSV, paste and fill as lists of changes, undo. No
|
|
4
|
+
// React: they run on the server and in a test.
|
|
5
|
+
import { isBlank, parseCell, typeOf } from "./types";
|
|
6
|
+
|
|
7
|
+
// ── the view ────────────────────────────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
/** A view is plain JSON, the part of a table a person arranges and may
|
|
10
|
+
* save (base-view keeps one per tab):
|
|
11
|
+
* order column keys in the order they show (unknown keys are skipped;
|
|
12
|
+
* columns missing from it follow, in `columns` order)
|
|
13
|
+
* hidden keys not shown
|
|
14
|
+
* widths { key: px }
|
|
15
|
+
* frozen how many leading columns stay put while the rest scroll (1)
|
|
16
|
+
* sort [{ key, dir: "asc" | "desc" }] — first wins, the rest break ties
|
|
17
|
+
* filters [{ id, key, op, value }] — every one must hold */
|
|
18
|
+
export function emptyView() {
|
|
19
|
+
return { order: [], hidden: [], widths: {}, frozen: 1, sort: [], filters: [] };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function normalizeView(view) {
|
|
23
|
+
const v = view ?? {};
|
|
24
|
+
return {
|
|
25
|
+
order: Array.isArray(v.order) ? v.order : [],
|
|
26
|
+
hidden: Array.isArray(v.hidden) ? v.hidden : [],
|
|
27
|
+
widths: v.widths && typeof v.widths === "object" ? v.widths : {},
|
|
28
|
+
frozen: Number.isInteger(v.frozen) ? Math.max(0, v.frozen) : 1,
|
|
29
|
+
sort: Array.isArray(v.sort) ? v.sort : [],
|
|
30
|
+
filters: Array.isArray(v.filters) ? v.filters : [],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The columns in view order (hidden ones included, flagged). */
|
|
35
|
+
export function orderedColumns(columns, view) {
|
|
36
|
+
const byKey = new Map(columns.map((c) => [c.key, c]));
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
const out = [];
|
|
39
|
+
for (const k of view.order) {
|
|
40
|
+
const c = byKey.get(k);
|
|
41
|
+
if (c && !seen.has(k)) {
|
|
42
|
+
seen.add(k);
|
|
43
|
+
out.push(c);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
for (const c of columns) if (!seen.has(c.key)) out.push(c);
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The columns that show, in order, each with its width. */
|
|
51
|
+
export function visibleColumns(columns, view, custom, narrow = false) {
|
|
52
|
+
const hidden = new Set(view.hidden);
|
|
53
|
+
return orderedColumns(columns, view)
|
|
54
|
+
.filter((c) => !hidden.has(c.key))
|
|
55
|
+
.map((c) => {
|
|
56
|
+
const w = view.widths[c.key] ?? c.width ?? typeOf(c, custom).width ?? 160;
|
|
57
|
+
return { ...c, width: Math.round(narrow ? Math.min(w, 220) : w) };
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ── rows through the view ───────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
/** Does `row` pass every filter? A filter whose value is still blank (a
|
|
64
|
+
* half-made condition) passes, so the rows do not vanish while typing. */
|
|
65
|
+
export function passesFilters(row, filters, columnsByKey, ctx, custom) {
|
|
66
|
+
for (const f of filters) {
|
|
67
|
+
const col = columnsByKey.get(f.key);
|
|
68
|
+
if (!col) continue;
|
|
69
|
+
const t = typeOf(col, custom);
|
|
70
|
+
const op = t.allFilters.find((o) => o.id === f.op) ?? t.allFilters[0];
|
|
71
|
+
if (!op) continue;
|
|
72
|
+
if (op.arg !== "none" && isBlank(f.value)) continue;
|
|
73
|
+
const v = row[col.key];
|
|
74
|
+
// An empty cell never matches a value condition ("> 100", "contains").
|
|
75
|
+
if (op.arg !== "none" && t.empty(v) && !["ne", "not-contains", "none"].includes(op.id)) return false;
|
|
76
|
+
if (!op.test(v, f.value, col, ctx, t)) return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Does any shown cell's text contain `query`? */
|
|
82
|
+
export function matchesSearch(row, query, cols, ctx, custom) {
|
|
83
|
+
const q = query.trim().toLowerCase();
|
|
84
|
+
if (!q) return true;
|
|
85
|
+
return cols.some((c) => typeOf(c, custom).format(row[c.key], c, ctx).toLowerCase().includes(q));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Rows filtered, searched and sorted — a new array; the input is untouched. */
|
|
89
|
+
export function processRows(rows, columns, view, { search = "", ctx, custom } = {}) {
|
|
90
|
+
const byKey = new Map(columns.map((c) => [c.key, c]));
|
|
91
|
+
const shown = visibleColumns(columns, view, custom);
|
|
92
|
+
let out = rows;
|
|
93
|
+
if (view.filters.length) out = out.filter((r) => passesFilters(r, view.filters, byKey, ctx, custom));
|
|
94
|
+
if (search.trim()) out = out.filter((r) => matchesSearch(r, search, shown, ctx, custom));
|
|
95
|
+
const sorts = view.sort.map((s) => ({ ...s, col: byKey.get(s.key) })).filter((s) => s.col);
|
|
96
|
+
if (sorts.length) {
|
|
97
|
+
const typed = sorts.map((s) => ({ ...s, t: typeOf(s.col, custom), sign: s.dir === "desc" ? -1 : 1 }));
|
|
98
|
+
// Stable: equal rows keep the order they came in.
|
|
99
|
+
out = out
|
|
100
|
+
.map((r, i) => [r, i])
|
|
101
|
+
.sort(([a, ia], [b, ib]) => {
|
|
102
|
+
for (const s of typed) {
|
|
103
|
+
const va = a[s.key];
|
|
104
|
+
const vb = b[s.key];
|
|
105
|
+
const ea = s.t.empty(va);
|
|
106
|
+
const eb = s.t.empty(vb);
|
|
107
|
+
if (ea || eb) {
|
|
108
|
+
if (ea && eb) continue;
|
|
109
|
+
return ea ? 1 : -1; // empties last, whichever way
|
|
110
|
+
}
|
|
111
|
+
const d = s.t.compare(va, vb, s.col, ctx);
|
|
112
|
+
if (d) return d * s.sign;
|
|
113
|
+
}
|
|
114
|
+
return ia - ib;
|
|
115
|
+
})
|
|
116
|
+
.map(([r]) => r);
|
|
117
|
+
} else if (out === rows) out = rows.slice();
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ── ranges ──────────────────────────────────────────────────────────────
|
|
122
|
+
|
|
123
|
+
/** Two corners → { r0, r1, c0, c1 }, inclusive and ordered. */
|
|
124
|
+
export function rangeOf(a, b) {
|
|
125
|
+
return { r0: Math.min(a.r, b.r), r1: Math.max(a.r, b.r), c0: Math.min(a.c, b.c), c1: Math.max(a.c, b.c) };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const clamp = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
129
|
+
|
|
130
|
+
export const inRange = (g, r, c) => r >= g.r0 && r <= g.r1 && c >= g.c0 && c <= g.c1;
|
|
131
|
+
|
|
132
|
+
/** Where a key press moves the active cell: arrows by one, ⌘/Ctrl +
|
|
133
|
+
* arrow to the edge, Home/End to the row's ends (with ⌘, the table's),
|
|
134
|
+
* PageUp/Down by `page` rows. Returns null for any other key. */
|
|
135
|
+
export function moveBy(key, { r, c }, { rows, cols, page = 10, jump = false }) {
|
|
136
|
+
const lastR = rows - 1;
|
|
137
|
+
const lastC = cols - 1;
|
|
138
|
+
switch (key) {
|
|
139
|
+
case "ArrowUp":
|
|
140
|
+
return { r: jump ? 0 : clamp(r - 1, 0, lastR), c };
|
|
141
|
+
case "ArrowDown":
|
|
142
|
+
return { r: jump ? lastR : clamp(r + 1, 0, lastR), c };
|
|
143
|
+
case "ArrowLeft":
|
|
144
|
+
return { r, c: jump ? 0 : clamp(c - 1, 0, lastC) };
|
|
145
|
+
case "ArrowRight":
|
|
146
|
+
return { r, c: jump ? lastC : clamp(c + 1, 0, lastC) };
|
|
147
|
+
case "Home":
|
|
148
|
+
return { r: jump ? 0 : r, c: 0 };
|
|
149
|
+
case "End":
|
|
150
|
+
return { r: jump ? lastR : r, c: lastC };
|
|
151
|
+
case "PageUp":
|
|
152
|
+
return { r: clamp(r - page, 0, lastR), c };
|
|
153
|
+
case "PageDown":
|
|
154
|
+
return { r: clamp(r + page, 0, lastR), c };
|
|
155
|
+
default:
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ── the clipboard ───────────────────────────────────────────────────────
|
|
161
|
+
|
|
162
|
+
/** Tab-separated text → rows of cells. Quoted cells (what Sheets and
|
|
163
|
+
* Excel write when a cell holds a tab, a newline or a quote) are read
|
|
164
|
+
* whole; a trailing newline adds no row. */
|
|
165
|
+
export function parseTSV(text) {
|
|
166
|
+
const s = String(text ?? "").replace(/\r\n?/g, "\n");
|
|
167
|
+
const rows = [];
|
|
168
|
+
let row = [];
|
|
169
|
+
let cell = "";
|
|
170
|
+
let i = 0;
|
|
171
|
+
let quoted = false;
|
|
172
|
+
let atStart = true;
|
|
173
|
+
while (i < s.length) {
|
|
174
|
+
const ch = s[i];
|
|
175
|
+
if (quoted) {
|
|
176
|
+
if (ch === '"') {
|
|
177
|
+
if (s[i + 1] === '"') {
|
|
178
|
+
cell += '"';
|
|
179
|
+
i += 2;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
quoted = false;
|
|
183
|
+
i++;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
cell += ch;
|
|
187
|
+
i++;
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
if (ch === '"' && atStart) {
|
|
191
|
+
quoted = true;
|
|
192
|
+
atStart = false;
|
|
193
|
+
i++;
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
if (ch === "\t") {
|
|
197
|
+
row.push(cell);
|
|
198
|
+
cell = "";
|
|
199
|
+
atStart = true;
|
|
200
|
+
i++;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (ch === "\n") {
|
|
204
|
+
row.push(cell);
|
|
205
|
+
rows.push(row);
|
|
206
|
+
row = [];
|
|
207
|
+
cell = "";
|
|
208
|
+
atStart = true;
|
|
209
|
+
i++;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
cell += ch;
|
|
213
|
+
atStart = false;
|
|
214
|
+
i++;
|
|
215
|
+
}
|
|
216
|
+
if (cell !== "" || row.length) {
|
|
217
|
+
row.push(cell);
|
|
218
|
+
rows.push(row);
|
|
219
|
+
}
|
|
220
|
+
return rows;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Rows of text → TSV, quoting a cell that holds a tab, newline or quote. */
|
|
224
|
+
export function toTSV(matrix) {
|
|
225
|
+
return matrix
|
|
226
|
+
.map((row) => row.map((v) => (/[\t\n"]/.test(v) ? `"${String(v).replace(/"/g, '""')}"` : String(v ?? ""))).join("\t"))
|
|
227
|
+
.join("\n");
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** The range's cells as text rows (what a copy puts on the clipboard). */
|
|
231
|
+
export function rangeText(range, rows, cols, ctx, custom) {
|
|
232
|
+
const out = [];
|
|
233
|
+
for (let r = range.r0; r <= range.r1; r++) {
|
|
234
|
+
const row = rows[r];
|
|
235
|
+
const line = [];
|
|
236
|
+
for (let c = range.c0; c <= range.c1; c++) {
|
|
237
|
+
const col = cols[c];
|
|
238
|
+
line.push(row && col ? typeOf(col, custom).toText(row[col.key], col, ctx) : "");
|
|
239
|
+
}
|
|
240
|
+
out.push(line);
|
|
241
|
+
}
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// ── changes ─────────────────────────────────────────────────────────────
|
|
246
|
+
// A change is { rowId, key, value, prev }. A batch of them is one undo step.
|
|
247
|
+
|
|
248
|
+
const same = (a, b) => a === b || (Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((x, i) => x === b[i])) || (isBlank(a) && isBlank(b) && !(a === false || b === false));
|
|
249
|
+
|
|
250
|
+
/** Keep only changes that change something. */
|
|
251
|
+
export function realChanges(changes) {
|
|
252
|
+
return changes.filter((ch) => !same(ch.value, ch.prev));
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** `rows` with `changes` laid on — a new array; untouched rows keep their identity. */
|
|
256
|
+
export function applyChanges(rows, changes, field = "value") {
|
|
257
|
+
if (!changes.length) return rows;
|
|
258
|
+
const byRow = new Map();
|
|
259
|
+
for (const ch of changes) {
|
|
260
|
+
if (!byRow.has(ch.rowId)) byRow.set(ch.rowId, {});
|
|
261
|
+
byRow.get(ch.rowId)[ch.key] = ch[field];
|
|
262
|
+
}
|
|
263
|
+
return rows.map((r) => (byRow.has(r.id) ? { ...r, ...byRow.get(r.id) } : r));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** The changes that undo `changes`. */
|
|
267
|
+
export function invertChanges(changes) {
|
|
268
|
+
return changes.map((ch) => ({ ...ch, value: ch.prev, prev: ch.value })).reverse();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Text rows pasted with their top-left at (r, c) → what to change. One
|
|
273
|
+
* value pasted onto a bigger range fills the range (as Sheets does);
|
|
274
|
+
* a block that runs past the last row lists the rest in `extra` (text
|
|
275
|
+
* rows the caller may add as new rows). Read-only columns are skipped;
|
|
276
|
+
* text that does not parse is reported in `errors` and skipped.
|
|
277
|
+
*/
|
|
278
|
+
export function pasteChanges(matrix, range, rows, cols, ctx, custom) {
|
|
279
|
+
const changes = [];
|
|
280
|
+
const errors = [];
|
|
281
|
+
const creates = new Map(); // col key → new options
|
|
282
|
+
if (!matrix.length) return { changes, errors, creates, extra: [] };
|
|
283
|
+
const single = matrix.length === 1 && matrix[0].length === 1;
|
|
284
|
+
const height = single ? range.r1 - range.r0 + 1 : matrix.length;
|
|
285
|
+
const width = single ? range.c1 - range.c0 + 1 : Math.max(...matrix.map((l) => l.length));
|
|
286
|
+
const extra = [];
|
|
287
|
+
for (let i = 0; i < height; i++) {
|
|
288
|
+
const r = range.r0 + i;
|
|
289
|
+
const line = single ? matrix[0] : matrix[i];
|
|
290
|
+
if (r >= rows.length) {
|
|
291
|
+
extra.push(line);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
const row = rows[r];
|
|
295
|
+
for (let j = 0; j < width; j++) {
|
|
296
|
+
const col = cols[range.c0 + j];
|
|
297
|
+
if (!col || col.readOnly || col.computed) continue;
|
|
298
|
+
const text = single ? line[0] : line[j] ?? "";
|
|
299
|
+
const withNew = { ...col, options: [...(col.options ?? []), ...(creates.get(col.key) ?? [])] };
|
|
300
|
+
const res = parseCell(text, withNew, ctx, custom);
|
|
301
|
+
if ("error" in res) {
|
|
302
|
+
errors.push({ rowId: row.id, key: col.key, text, error: res.error });
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
if (res.create) creates.set(col.key, [...(creates.get(col.key) ?? []), ...res.create]);
|
|
306
|
+
changes.push({ rowId: row.id, key: col.key, value: res.value, prev: row[col.key] });
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return { changes: realChanges(changes), errors, creates, extra };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Fill from the `range` down (or up) to row `to`: the range's rows repeat.
|
|
314
|
+
* A single column of two or more numbers that step evenly continues the
|
|
315
|
+
* series (1, 2, 3 → 4, 5…), as a spreadsheet does.
|
|
316
|
+
*/
|
|
317
|
+
export function fillChanges(range, to, rows, cols) {
|
|
318
|
+
const changes = [];
|
|
319
|
+
const h = range.r1 - range.r0 + 1;
|
|
320
|
+
const down = to > range.r1;
|
|
321
|
+
const targets = [];
|
|
322
|
+
if (down) for (let r = range.r1 + 1; r <= Math.min(to, rows.length - 1); r++) targets.push(r);
|
|
323
|
+
else for (let r = range.r0 - 1; r >= Math.max(to, 0); r--) targets.push(r);
|
|
324
|
+
for (let c = range.c0; c <= range.c1; c++) {
|
|
325
|
+
const col = cols[c];
|
|
326
|
+
if (!col || col.readOnly || col.computed) continue;
|
|
327
|
+
const src = [];
|
|
328
|
+
for (let r = range.r0; r <= range.r1; r++) src.push(rows[r]?.[col.key]);
|
|
329
|
+
let step = null;
|
|
330
|
+
if (h >= 2 && src.every((v) => typeof v === "number")) {
|
|
331
|
+
const d = src[1] - src[0];
|
|
332
|
+
if (src.every((v, i) => i === 0 || Math.abs(v - src[i - 1] - d) < 1e-9)) step = d;
|
|
333
|
+
}
|
|
334
|
+
targets.forEach((r, k) => {
|
|
335
|
+
const row = rows[r];
|
|
336
|
+
if (!row) return;
|
|
337
|
+
let value;
|
|
338
|
+
if (step !== null) value = down ? src[h - 1] + step * (k + 1) : src[0] - step * (k + 1);
|
|
339
|
+
else value = down ? src[k % h] : src[h - 1 - (k % h)];
|
|
340
|
+
if (Array.isArray(value)) value = value.slice();
|
|
341
|
+
changes.push({ rowId: row.id, key: col.key, value, prev: row[col.key] });
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
return realChanges(changes);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** Clearing a range: each cell to its type's empty. */
|
|
348
|
+
export function clearChanges(range, rows, cols, ctx, custom) {
|
|
349
|
+
const changes = [];
|
|
350
|
+
for (let r = range.r0; r <= range.r1; r++) {
|
|
351
|
+
const row = rows[r];
|
|
352
|
+
if (!row) continue;
|
|
353
|
+
for (let c = range.c0; c <= range.c1; c++) {
|
|
354
|
+
const col = cols[c];
|
|
355
|
+
if (!col || col.readOnly || col.computed) continue;
|
|
356
|
+
const empty = parseCell("", col, ctx, custom);
|
|
357
|
+
changes.push({ rowId: row.id, key: col.key, value: "error" in empty ? null : empty.value, prev: row[col.key] });
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return realChanges(changes);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** A number summary of the range's numeric cells, for the status bar. */
|
|
364
|
+
export function summarize(range, rows, cols) {
|
|
365
|
+
let count = 0;
|
|
366
|
+
let filled = 0;
|
|
367
|
+
let sum = 0;
|
|
368
|
+
let nums = 0;
|
|
369
|
+
let numCol = null;
|
|
370
|
+
for (let r = range.r0; r <= range.r1; r++) {
|
|
371
|
+
const row = rows[r];
|
|
372
|
+
if (!row) continue;
|
|
373
|
+
for (let c = range.c0; c <= range.c1; c++) {
|
|
374
|
+
const col = cols[c];
|
|
375
|
+
if (!col) continue;
|
|
376
|
+
count++;
|
|
377
|
+
const v = row[col.key];
|
|
378
|
+
if (!isBlank(v) && v !== false) filled++;
|
|
379
|
+
if (typeof v === "number" && (col.type === "number" || col.type === "currency")) {
|
|
380
|
+
sum += v;
|
|
381
|
+
nums++;
|
|
382
|
+
numCol = numCol === null || numCol?.key === col.key ? col : numCol && numCol.type === col.type ? numCol : false;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return { count, filled, sum, nums, avg: nums ? sum / nums : 0, numCol: numCol || null };
|
|
387
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// The Spreadsheet block — `makersclaw add spreadsheet`. Fixed: compose it
|
|
2
|
+
// through its props (README.md beside this file). The helpers (the column
|
|
3
|
+
// types, the view, TSV, paste and fill) are plain functions and work
|
|
4
|
+
// anywhere, the server included. Blocks built on this one (base-view,
|
|
5
|
+
// csv-import) import it, never @tanstack/react-virtual directly.
|
|
6
|
+
export { Spreadsheet } from "./spreadsheet";
|
|
7
|
+
export { CellValue, CellPanel, OptionBadge, editorFor } from "./cells";
|
|
8
|
+
export { TYPE_ORDER, sortWords } from "./chrome";
|
|
9
|
+
export {
|
|
10
|
+
COLUMN_TYPES,
|
|
11
|
+
typeOf,
|
|
12
|
+
parseCell,
|
|
13
|
+
convertValue,
|
|
14
|
+
guessType,
|
|
15
|
+
parseNumberText,
|
|
16
|
+
parseDateText,
|
|
17
|
+
optionValue,
|
|
18
|
+
isBlank,
|
|
19
|
+
} from "./types";
|
|
20
|
+
export {
|
|
21
|
+
emptyView,
|
|
22
|
+
normalizeView,
|
|
23
|
+
orderedColumns,
|
|
24
|
+
visibleColumns,
|
|
25
|
+
processRows,
|
|
26
|
+
passesFilters,
|
|
27
|
+
parseTSV,
|
|
28
|
+
toTSV,
|
|
29
|
+
pasteChanges,
|
|
30
|
+
fillChanges,
|
|
31
|
+
clearChanges,
|
|
32
|
+
applyChanges,
|
|
33
|
+
invertChanges,
|
|
34
|
+
} from "./grid";
|