@heycys/gallery 0.1.0 → 0.1.2
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 +51 -1
- package/browser/editor/components/callout/index.mjs +40 -15
- package/browser/editor/components/columns/page.mjs +45 -32
- package/browser/editor/components/details/index.mjs +2 -1
- package/browser/editor/components/dialog/index.mjs +2 -1
- package/browser/editor/components/dialog/page.mjs +0 -18
- package/browser/editor/components/divider/index.mjs +1 -1
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/figure/page.mjs +10 -1
- package/browser/editor/components/file/page.mjs +2 -2
- package/browser/editor/components/flowchart/add.mjs +7 -6
- package/browser/editor/components/flowchart/page.mjs +1 -1
- package/browser/editor/components/heading/index.mjs +2 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +4 -20
- package/browser/editor/components/icons.mjs +13 -2
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/page.mjs +2 -2
- package/browser/editor/components/installed/index.mjs +82 -29
- package/browser/editor/components/installed/page.mjs +146 -34
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/kit.mjs +3 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/page.mjs +44 -14
- package/browser/editor/components/pages.mjs +2 -2
- package/browser/editor/components/registry.mjs +68 -33
- package/browser/editor/components/section/index.mjs +2 -1
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/table/index.mjs +64 -5
- package/browser/editor/components/table/page.mjs +30 -19
- package/browser/editor/page/annotate/anchors.mjs +4 -3
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/annotate/index.mjs +61 -34
- package/browser/editor/page/autosave.mjs +357 -38
- package/browser/editor/page/beside.mjs +5 -5
- package/browser/editor/page/block-menu/colors.mjs +3 -1
- package/browser/editor/page/block-menu/index.mjs +8 -6
- package/browser/editor/page/blocks.mjs +16 -7
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +145 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +970 -0
- package/browser/editor/page/board/settings.mjs +209 -0
- package/browser/editor/page/caret.mjs +5 -2
- package/browser/editor/page/changes/bar.mjs +94 -0
- package/browser/editor/page/changes/ghost.mjs +206 -0
- package/browser/editor/page/changes/gone-words.mjs +94 -0
- package/browser/editor/page/changes/index.mjs +447 -0
- package/browser/editor/page/changes/words.mjs +27 -0
- package/browser/editor/page/clipboard/import/colors.mjs +3 -3
- package/browser/editor/page/clipboard/import/html.mjs +29 -6
- package/browser/editor/page/clipboard/import/inline.mjs +32 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
- package/browser/editor/page/clipboard/import/read.mjs +6 -1
- package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
- package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
- package/browser/editor/page/clipboard/index.mjs +156 -26
- package/browser/editor/page/clipboard/own/blocks.mjs +25 -16
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +16 -7
- package/browser/editor/page/clipboard/own/export.mjs +6 -6
- package/browser/editor/page/clipboard/own/selection.mjs +3 -3
- package/browser/editor/page/clipboard/own/writers.mjs +0 -11
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +98 -25
- package/browser/editor/page/conflicts.mjs +13 -33
- package/browser/editor/page/convert.mjs +8 -7
- package/browser/editor/page/core.mjs +81 -27
- package/browser/editor/page/custom-page.mjs +106 -0
- package/browser/editor/page/drag/index.mjs +40 -24
- package/browser/editor/page/drag/preview.mjs +9 -4
- package/browser/editor/page/editor.mjs +120 -28
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +22 -13
- package/browser/editor/page/emoji-picker/grid.mjs +7 -5
- package/browser/editor/page/emoji-picker/icon-tab.mjs +4 -4
- package/browser/editor/page/emoji-picker/icons.mjs +0 -1
- package/browser/editor/page/emoji-picker/index.mjs +11 -9
- package/browser/editor/page/emoji-picker/styles.mjs +156 -2
- package/browser/editor/page/emoji-picker/support.mjs +6 -4
- package/browser/editor/page/emoji-picker/upload.mjs +14 -13
- package/browser/editor/page/fills.mjs +5 -3
- package/browser/editor/page/fold/index.mjs +348 -0
- package/browser/editor/page/fold/rule.mjs +125 -0
- package/browser/editor/page/folded.mjs +23 -0
- package/browser/editor/page/format-bar/bar.mjs +2 -1
- package/browser/editor/page/format-bar/index.mjs +1 -1
- package/browser/editor/page/geometry.mjs +8 -6
- package/browser/editor/page/handle/index.mjs +22 -14
- package/browser/editor/page/hints/index.mjs +1 -1
- package/browser/editor/page/history.mjs +24 -4
- package/browser/editor/page/insert/index.mjs +30 -17
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +69 -6
- package/browser/editor/page/margin.mjs +63 -27
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +86 -31
- package/browser/editor/page/merge.mjs +24 -0
- package/browser/editor/page/notices.mjs +3 -3
- package/browser/editor/page/offered.mjs +1 -1
- package/browser/editor/page/outline/folds.mjs +11 -10
- package/browser/editor/page/outline/index.mjs +131 -45
- package/browser/editor/page/outline/list.mjs +23 -11
- package/browser/editor/page/outline/read.mjs +1 -1
- package/browser/editor/page/outline/strip.mjs +7 -1
- package/browser/editor/page/page-objects.mjs +13 -2
- package/browser/editor/page/panel.mjs +9 -13
- package/browser/editor/page/present-links.mjs +11 -2
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/delete.mjs +8 -6
- package/browser/editor/page/selection/index.mjs +10 -3
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +101 -6
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/cell-bar.mjs +4 -1
- package/browser/editor/page/table/cells.mjs +103 -47
- package/browser/editor/page/table/icons.mjs +3 -1
- package/browser/editor/page/table/index.mjs +40 -16
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +150 -0
- package/browser/editor/page/table/widths.mjs +9 -4
- package/browser/editor/page/text-select/index.mjs +43 -14
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/tooltip.mjs +1 -1
- package/browser/editor/page/type-grid.mjs +4 -3
- package/browser/editor/page/typing/code-edges.mjs +63 -17
- package/browser/editor/page/typing/index.mjs +65 -9
- package/browser/editor/page/typing/leave.mjs +1 -1
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/annotations.mjs +8 -10
- package/browser/shared/block-packs.mjs +404 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/code-folds.mjs +5 -1
- package/browser/shared/colors.mjs +17 -14
- package/browser/shared/component-catalog.mjs +345 -54
- package/browser/shared/component-source.mjs +37 -0
- package/browser/shared/components/callout.mjs +4 -2
- package/browser/shared/components/index.mjs +72 -9
- package/browser/shared/components/installed.mjs +110 -8
- package/browser/shared/components/page.mjs +22 -3
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -1
- package/browser/shared/components/text.mjs +2 -2
- package/browser/shared/document-look.mjs +183 -0
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/README.md +4 -2
- package/browser/shared/emoji/data/categories.json +1 -1
- package/browser/shared/emoji/data/keywords-en.json +1 -1
- package/browser/shared/emoji/data/keywords-zh.json +1 -1
- package/browser/shared/emoji/data/names.json +1 -1
- package/browser/shared/emoji/data/positions.json +1 -1
- package/browser/shared/emoji/data/twemoji-index.json +1 -1
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +10 -12
- package/browser/shared/emoji/emoji.mjs +8 -7
- package/browser/shared/emoji/icon-value.mjs +4 -3
- package/browser/shared/extension-sidebar.mjs +126 -0
- package/browser/shared/extensions.mjs +79 -0
- package/browser/shared/file-table.mjs +101 -0
- package/browser/shared/html-tree.mjs +11 -5
- package/browser/shared/i18n/en.mjs +374 -35
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/long-runs.mjs +39 -0
- package/browser/shared/net-cache.mjs +133 -0
- package/browser/shared/net-keys.mjs +32 -0
- package/browser/shared/net-policy.mjs +177 -0
- package/browser/shared/new-names.mjs +5 -2
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +458 -0
- package/browser/shared/pack-manifest.mjs +77 -0
- package/browser/shared/page-address.mjs +6 -3
- package/browser/shared/page-cards.mjs +308 -0
- package/browser/shared/page-links.mjs +69 -6
- package/browser/shared/pages.mjs +388 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/preferences.mjs +10 -4
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +13 -5
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/table-chart.mjs +33 -1
- package/browser/shared/todos.mjs +83 -0
- package/browser/shared/user-directory.mjs +24 -0
- package/browser/shared/versions.mjs +14 -0
- package/browser/shared/web-links.mjs +134 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-look.mjs +91 -0
- package/browser/shared/workspace-name.mjs +154 -0
- package/browser/shared/workspace-query.mjs +125 -0
- package/browser/shared/workspace-registry.mjs +272 -0
- package/browser/shared/workspace.mjs +171 -20
- package/browser/shared/zoom.mjs +5 -5
- package/dist/chunk-2NRBY6AJ.mjs +2 -0
- package/dist/chunk-32ZUEFZ7.mjs +2 -0
- package/dist/chunk-35NQ4PLQ.mjs +2 -0
- package/dist/chunk-3KJHLHUO.mjs +2 -0
- package/dist/chunk-3NJACR4W.mjs +2 -0
- package/dist/chunk-4AV456RQ.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5XYHDBJ5.mjs +2 -0
- package/dist/chunk-5ZJA7CXT.mjs +2 -0
- package/dist/chunk-6A53MZYZ.mjs +2 -0
- package/dist/chunk-6EXH3ORZ.mjs +166 -0
- package/dist/chunk-6EZ7FNIK.mjs +3 -0
- package/dist/{chunk-UXUK4PMC.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/{chunk-6U2SLSDN.mjs → chunk-6VTU6KEO.mjs} +1 -1
- package/dist/chunk-B4P2CM2J.mjs +3 -0
- package/dist/chunk-BPL64HGA.mjs +4 -0
- package/dist/chunk-BVEFGE4B.mjs +2 -0
- package/dist/chunk-BZ5RAF7L.mjs +2 -0
- package/dist/chunk-CRJEG7MT.mjs +2 -0
- package/dist/{chunk-B3VTYBYR.mjs → chunk-D4CKRD3V.mjs} +91 -91
- package/dist/chunk-D4EURAX4.mjs +4 -0
- package/dist/chunk-DQCE7TJY.mjs +5 -0
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/{chunk-DB4WKGYF.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-FJYN7RTH.mjs +4 -0
- package/dist/chunk-FWNRPMCJ.mjs +12 -0
- package/dist/chunk-FWW4CSAZ.mjs +2 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-GY3FAUVM.mjs +2 -0
- package/dist/chunk-HLYV7RIH.mjs +2 -0
- package/dist/chunk-HMYTM3GT.mjs +15 -0
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-KTKHRC6H.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-MHW7ZKOU.mjs +2 -0
- package/dist/chunk-N76HWBA3.mjs +10 -0
- package/dist/chunk-N7AZZLGT.mjs +548 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-YXAUQPVK.mjs → chunk-NFMCP2HI.mjs} +3 -3
- package/dist/chunk-NG375ILQ.mjs +2 -0
- package/dist/chunk-NVRNLK25.mjs +6 -0
- package/dist/chunk-NWFBE2YA.mjs +2 -0
- package/dist/chunk-NWR2LT5B.mjs +2 -0
- package/dist/chunk-OJKMINIU.mjs +20 -0
- package/dist/chunk-OUUP3WKT.mjs +2 -0
- package/dist/chunk-OW5NWPOJ.mjs +10 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-POQSE4C2.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/{chunk-Z52HTUW7.mjs → chunk-PVER7LSC.mjs} +2 -2
- package/dist/chunk-PZDLJJTJ.mjs +3 -0
- package/dist/chunk-Q47PLKIJ.mjs +15 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QKXMPUXC.mjs +2 -0
- package/dist/chunk-QOUEFUCH.mjs +16 -0
- package/dist/chunk-RFDZXFJF.mjs +13 -0
- package/dist/chunk-RKPWLGZ3.mjs +4 -0
- package/dist/chunk-RMECZA2K.mjs +2 -0
- package/dist/{chunk-EUX7IC5J.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SX4LJYT6.mjs +8 -0
- package/dist/chunk-SXHBYZST.mjs +16 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TEZAWDSQ.mjs +2 -0
- package/dist/chunk-UBBRTJ2R.mjs +24 -0
- package/dist/chunk-UFNYFFKO.mjs +20 -0
- package/dist/chunk-UGWYKHBL.mjs +170 -0
- package/dist/chunk-UKSHDZZ6.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-UNOYVIYR.mjs +2 -0
- package/dist/chunk-V6RIYQZZ.mjs +4 -0
- package/dist/chunk-VJPFVNNW.mjs +15 -0
- package/dist/chunk-VS3ZMVGX.mjs +5 -0
- package/dist/chunk-VTKNEYT3.mjs +6 -0
- package/dist/chunk-VXACTLO3.mjs +3 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YQGT4AB2.mjs +6 -0
- package/dist/chunk-ZB4H7ZN4.mjs +2 -0
- package/dist/{chunk-ACOPDCNB.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZUNVAXLH.mjs +2 -0
- package/dist/chunk-ZWPMCK7P.mjs +2 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-EVJ3BX3M.mjs → update-fetch.mjs} +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +95 -0
- package/kit/board.js +250 -0
- package/kit/charts.js +5 -71
- package/kit/code.js +14 -14
- package/kit/math.js +18 -2
- package/kit/report.css +500 -151
- package/kit/runtime.js +1720 -170
- package/kit/state.js +10 -1
- package/kit/tables.js +172 -37
- package/kit/ui.js +166 -27
- package/package.json +2 -1
- package/packs/gallery/card/component.json +14 -0
- package/packs/gallery/card/example.html +10 -0
- package/packs/gallery/card/preview.svg +1 -0
- package/packs/gallery/card/style.css +6 -0
- package/packs/gallery/card/template.html +6 -0
- package/packs/gallery/card/writing.md +14 -0
- package/packs/gallery/chart-card/component.json +15 -0
- package/packs/gallery/chart-card/example.html +14 -0
- package/packs/gallery/chart-card/kit.js +130 -0
- package/packs/gallery/chart-card/preview.svg +1 -0
- package/packs/gallery/chart-card/style.css +42 -0
- package/packs/gallery/chart-card/template.html +13 -0
- package/packs/gallery/chart-card/writing.md +20 -0
- package/packs/gallery/chart-view/component.json +20 -0
- package/packs/gallery/chart-view/example.html +13 -0
- package/packs/gallery/chart-view/kit.js +355 -0
- package/packs/gallery/chart-view/preview.svg +1 -0
- package/packs/gallery/chart-view/style.css +94 -0
- package/packs/gallery/chart-view/template.html +3 -0
- package/packs/gallery/chart-view/writing.md +22 -0
- package/packs/gallery/countdown/component.json +18 -0
- package/packs/gallery/countdown/example.html +3 -0
- package/packs/gallery/countdown/kit.js +156 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +130 -0
- package/packs/gallery/countdown/template.html +3 -0
- package/packs/gallery/countdown/writing.md +22 -0
- package/packs/gallery/habit/component.json +14 -0
- package/packs/gallery/habit/example.html +3 -0
- package/packs/gallery/habit/kit.js +295 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +246 -0
- package/packs/gallery/habit/template.html +3 -0
- package/packs/gallery/habit/writing.md +21 -0
- package/packs/gallery/heatmap/component.json +18 -0
- package/packs/gallery/heatmap/example.html +3 -0
- package/packs/gallery/heatmap/kit.js +351 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +201 -0
- package/packs/gallery/heatmap/template.html +3 -0
- package/packs/gallery/heatmap/writing.md +21 -0
- package/packs/gallery/kanban/component.json +18 -0
- package/packs/gallery/kanban/example.html +12 -0
- package/packs/gallery/kanban/kit.js +540 -0
- package/packs/gallery/kanban/preview.svg +1 -0
- package/packs/gallery/kanban/style.css +212 -0
- package/packs/gallery/kanban/template.html +3 -0
- package/packs/gallery/kanban/writing.md +20 -0
- package/packs/gallery/metric/component.json +22 -0
- package/packs/gallery/metric/example.html +15 -0
- package/packs/gallery/metric/kit.js +248 -0
- package/packs/gallery/metric/preview.svg +1 -0
- package/packs/gallery/metric/style.css +92 -0
- package/packs/gallery/metric/template.html +3 -0
- package/packs/gallery/metric/writing.md +23 -0
- package/packs/gallery/note/component.json +14 -0
- package/packs/gallery/note/example.html +3 -0
- package/packs/gallery/note/kit.js +102 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +76 -0
- package/packs/gallery/note/template.html +3 -0
- package/packs/gallery/note/writing.md +18 -0
- package/packs/gallery/pack.json +8 -0
- package/packs/gallery/recent/component.json +13 -0
- package/packs/gallery/recent/example.html +1 -0
- package/packs/gallery/recent/kit.js +238 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +158 -0
- package/packs/gallery/recent/template.html +1 -0
- package/packs/gallery/recent/writing.md +15 -0
- package/packs/gallery/static/component.json +13 -0
- package/packs/gallery/static/example.html +11 -0
- package/packs/gallery/static/preview.svg +1 -0
- package/packs/gallery/static/style.css +138 -0
- package/packs/gallery/static/template.html +1 -0
- package/packs/gallery/static/writing.md +18 -0
- package/packs/gallery/stats/component.json +13 -0
- package/packs/gallery/stats/example.html +1 -0
- package/packs/gallery/stats/kit.js +166 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +151 -0
- package/packs/gallery/stats/template.html +1 -0
- package/packs/gallery/stats/writing.md +11 -0
- package/packs/gallery/today/component.json +12 -0
- package/packs/gallery/today/example.html +1 -0
- package/packs/gallery/today/kit.js +185 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +120 -0
- package/packs/gallery/today/template.html +1 -0
- package/packs/gallery/today/writing.md +14 -0
- package/packs/gallery/todos/component.json +19 -0
- package/packs/gallery/todos/example.html +3 -0
- package/packs/gallery/todos/kit.js +342 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +267 -0
- package/packs/gallery/todos/template.html +3 -0
- package/packs/gallery/todos/writing.md +30 -0
- package/packs/gallery/weather/component.json +19 -0
- package/packs/gallery/weather/example.html +3 -0
- package/packs/gallery/weather/kit.js +312 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +258 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/release.json +13 -11
- package/sdk/doc-kit.d.ts +404 -7
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +71 -26
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/example-report.html +1 -1
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +221 -0
- package/skill/references/writing-html.md +9 -7
- package/skill/sdk/doc-kit.d.ts +404 -7
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BK2e_07w.js +13 -0
- package/web/assets/index-CWFI83mF.css +1 -0
- package/web/index.html +2 -2
- package/browser/editor/components/callout/page.mjs +0 -13
- package/dist/chunk-2PBALTR3.mjs +0 -57
- package/dist/chunk-3LA3EMDE.mjs +0 -15
- package/dist/chunk-5FRMCDPY.mjs +0 -16
- package/dist/chunk-5LEK2CBS.mjs +0 -2
- package/dist/chunk-5OFN5AHC.mjs +0 -2
- package/dist/chunk-5SIYS5HN.mjs +0 -2
- package/dist/chunk-5TEK3RAD.mjs +0 -2
- package/dist/chunk-6CYG3Z4V.mjs +0 -2
- package/dist/chunk-7GHT2UCA.mjs +0 -15
- package/dist/chunk-7QQBR7PB.mjs +0 -2
- package/dist/chunk-ATCJYAR4.mjs +0 -2
- package/dist/chunk-C7HWOBIF.mjs +0 -2
- package/dist/chunk-E7VYDG2X.mjs +0 -2
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FQGQH4KM.mjs +0 -2
- package/dist/chunk-G7TOXONE.mjs +0 -6
- package/dist/chunk-GPF4YWWB.mjs +0 -9
- package/dist/chunk-GYQV7Y4J.mjs +0 -120
- package/dist/chunk-HMHK3EQ6.mjs +0 -2
- package/dist/chunk-HQQMJCQJ.mjs +0 -10
- package/dist/chunk-IERUOGC3.mjs +0 -6
- package/dist/chunk-ITNLYXXV.mjs +0 -3
- package/dist/chunk-L4DVONOG.mjs +0 -2
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LC7YNQFG.mjs +0 -2
- package/dist/chunk-LHTFLRB6.mjs +0 -4
- package/dist/chunk-NFIBI4IP.mjs +0 -26
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O52JMOCZ.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-QMQUXTU4.mjs +0 -12
- package/dist/chunk-QVWVFC5K.mjs +0 -6
- package/dist/chunk-QYKCJ7FG.mjs +0 -8
- package/dist/chunk-QZY6Q64C.mjs +0 -2
- package/dist/chunk-TDQP3DKQ.mjs +0 -10
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-UNUEWH4S.mjs +0 -2
- package/dist/chunk-V4CPWKMZ.mjs +0 -2
- package/dist/chunk-VACRB2NE.mjs +0 -3
- package/dist/chunk-W63L7367.mjs +0 -7
- package/dist/chunk-W7CXPCRV.mjs +0 -6
- package/dist/chunk-XINNG4F2.mjs +0 -4
- package/dist/chunk-YL2DPWVS.mjs +0 -4
- package/dist/chunk-YZ5Z6H4W.mjs +0 -4
- package/dist/chunk-ZBIM6ARY.mjs +0 -216
- package/skill/references/building-components.md +0 -327
- package/web/assets/index-B6Ai3wsa.js +0 -13
- package/web/assets/index-SYPC3EZy.css +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/card",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"name": { "zh": "卡片", "en": "Card" },
|
|
6
|
+
"description": { "zh": "带标题的卡片,里面放任意内容", "en": "A card with a title, any blocks inside it" },
|
|
7
|
+
"words": "kapian card 卡片 框 frame box",
|
|
8
|
+
"parts": {
|
|
9
|
+
"title": { "at": ":scope > h3", "edit": "text" },
|
|
10
|
+
"body": { "edit": "flow" }
|
|
11
|
+
},
|
|
12
|
+
"places": ["document"],
|
|
13
|
+
"markdown": "parts"
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 120"><rect width="240" height="120" rx="8" fill="#f2f4f7"/><rect x="16" y="14" width="208" height="92" rx="8" fill="#ffffff" stroke="#d0d5dd"/><rect x="30" y="28" width="96" height="12" rx="4" fill="#667085"/><rect x="30" y="52" width="176" height="8" rx="4" fill="#d0d5dd"/><rect x="30" y="68" width="150" height="8" rx="4" fill="#d0d5dd"/><rect x="30" y="84" width="120" height="8" rx="4" fill="#d0d5dd"/></svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* Every selector starts at the instance and goes down a step at a time (>), so that nothing here
|
|
2
|
+
reaches the rest of the page or the blocks in the slot, which read as the page's. The look is a
|
|
3
|
+
card's of the kit (.doc-figure): its border, its radius and its title's size, in the kit's colors,
|
|
4
|
+
which follow the theme. */
|
|
5
|
+
[data-doc-component="gallery/card"] { margin: var(--doc-component-gap) 0; padding: 20px 24px 8px; border: 1px solid var(--doc-border); border-radius: 10px; background: var(--doc-surface); }
|
|
6
|
+
[data-doc-component="gallery/card"] > h3 { margin: 0 0 4px; font-size: var(--doc-card-title-font-size); line-height: var(--doc-card-title-line-height); font-weight: 600; letter-spacing: -.025em; }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 卡片 (gallery/card)
|
|
2
|
+
|
|
3
|
+
A card that frames a few blocks under a title: a summary beside the text, a set of points to keep together, a step of a guide. Use it where a framed group reads better than a heading; for a whole section, a heading is enough.
|
|
4
|
+
|
|
5
|
+
## How to write it
|
|
6
|
+
|
|
7
|
+
Write the element as example.html does (`gallery block show gallery/card` prints it):
|
|
8
|
+
|
|
9
|
+
- the title, its `h3`: required, a few words.
|
|
10
|
+
- the body, its `<div data-doc-slot="body">`: required, the document's own blocks, written as anywhere in the document (paragraphs, lists, tables, formulas, a chart card). The reader edits them as any.
|
|
11
|
+
|
|
12
|
+
## How it looks
|
|
13
|
+
|
|
14
|
+
A frame with rounded corners in the kit's border color, its title at the top. It draws nothing of its own and has no script: what the file says is what a reader sees.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/chart-card",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"name": { "zh": "表格图表卡片", "en": "Chart from a table" },
|
|
6
|
+
"description": { "zh": "一个标题、一张表格和它画出的条形图,改表格里的数,图跟着重画", "en": "A title, a table and the bar chart drawn from it: edit a number and the chart draws again" },
|
|
7
|
+
"words": "biaogetubiaokapian tubiao chart bar table 图表 条形图 表格 画图",
|
|
8
|
+
"parts": {
|
|
9
|
+
"title": { "at": ":scope > h3", "edit": "text" },
|
|
10
|
+
"table": { "edit": "flow" }
|
|
11
|
+
},
|
|
12
|
+
"runtime": { "generated": [":scope > .gallery-chart-card-bars"] },
|
|
13
|
+
"places": ["document"],
|
|
14
|
+
"markdown": "parts"
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<div data-doc-component="gallery/chart-card">
|
|
2
|
+
<h3>各渠道的新增用户(千人)</h3>
|
|
3
|
+
<div data-doc-slot="table">
|
|
4
|
+
<table>
|
|
5
|
+
<thead><tr><th>渠道</th><th>上月</th><th>本月</th></tr></thead>
|
|
6
|
+
<tbody>
|
|
7
|
+
<tr><td>搜索</td><td>42</td><td>48</td></tr>
|
|
8
|
+
<tr><td>社交媒体</td><td>31</td><td>27</td></tr>
|
|
9
|
+
<tr><td>老用户推荐</td><td>18</td><td>24</td></tr>
|
|
10
|
+
<tr><td>线下活动</td><td>9</td><td>—</td></tr>
|
|
11
|
+
</tbody>
|
|
12
|
+
</table>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// gallery/chart-card: a card with a title, the bar chart this script draws from the table in its slot,
|
|
2
|
+
// and that table. The table is the document's, a plain table in the slot: the reader edits it as any
|
|
3
|
+
// table of the page, and each change of it (`source`) draws the bars again. Its first column names the
|
|
4
|
+
// bars; each column after it that holds a number is a series, its header the legend's words (bars one
|
|
5
|
+
// under another, a legend above them when there are two or more); a cell with no number has no bar.
|
|
6
|
+
// The chart is no chart card of the kit's: "/" makes what a template's slot holds as a paste of it
|
|
7
|
+
// makes blocks, and a paste makes a table and never a chart card, so the block draws the bars itself.
|
|
8
|
+
// They are laid out in percents and colored by the kit's variables, so that a width or a theme draws
|
|
9
|
+
// nothing again; the manifest's `runtime` names what is drawn, which the file never holds.
|
|
10
|
+
|
|
11
|
+
DocKit.component({
|
|
12
|
+
id: "gallery/chart-card",
|
|
13
|
+
on: ["source"],
|
|
14
|
+
mount(host, context) {
|
|
15
|
+
const drawn = document.createElement("div");
|
|
16
|
+
drawn.className = "gallery-chart-card-bars";
|
|
17
|
+
const slot = context.part("table");
|
|
18
|
+
host.insertBefore(drawn, slot && slot.parentElement === host ? slot : null);
|
|
19
|
+
const draw = () => drawBars(drawn, tableOf(context.part("table")));
|
|
20
|
+
draw();
|
|
21
|
+
return { update: draw };
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The first table in `slot` as words: the names of its columns (the last row of its <thead>, or its
|
|
27
|
+
* first row) and the rows after them, a <tfoot> left out. Null where the slot holds no table.
|
|
28
|
+
* @param {HTMLElement | null} slot
|
|
29
|
+
* @returns {{ columns: string[], rows: string[][] } | null}
|
|
30
|
+
*/
|
|
31
|
+
function tableOf(slot) {
|
|
32
|
+
const table = slot?.querySelector("table");
|
|
33
|
+
if (!(table instanceof HTMLTableElement)) return null;
|
|
34
|
+
/** @param {HTMLTableRowElement} row */
|
|
35
|
+
const words = (row) => [...row.cells].map((cell) => (cell.textContent ?? "").replace(/\s+/g, " ").trim());
|
|
36
|
+
const rows = [...table.rows].filter((row) => row.parentElement?.localName !== "tfoot");
|
|
37
|
+
const head = table.tHead?.rows[table.tHead.rows.length - 1] ?? rows[0];
|
|
38
|
+
if (!head) return null;
|
|
39
|
+
return { columns: words(head), rows: rows.filter((row) => row !== head && row.parentElement?.localName !== "thead").map(words) };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A cell's number as a reader writes one (1,234 · 12.5% · −3), or null.
|
|
44
|
+
* @param {string} text
|
|
45
|
+
*/
|
|
46
|
+
function numberOf(text) {
|
|
47
|
+
const plain = text.replace(/[\s,,]/g, "").replace(/^[−–]/, "-").replace(/%$/, "");
|
|
48
|
+
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[-+]?\d+)?$/i.test(plain) ? Number(plain) : null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* An element of the drawing, of `kind` (its class) and with `words`.
|
|
53
|
+
* @param {string} kind
|
|
54
|
+
* @param {string} [words]
|
|
55
|
+
*/
|
|
56
|
+
function part(kind, words) {
|
|
57
|
+
const node = document.createElement("span");
|
|
58
|
+
node.className = `gallery-chart-card-${kind}`;
|
|
59
|
+
if (words !== undefined) node.textContent = words;
|
|
60
|
+
return node;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The bars of `table` in `drawn`, all it held before taken off.
|
|
65
|
+
* @param {HTMLElement} drawn
|
|
66
|
+
* @param {{ columns: string[], rows: string[][] } | null} table
|
|
67
|
+
*/
|
|
68
|
+
function drawBars(drawn, table) {
|
|
69
|
+
const chinese = /^zh/i.test(document.documentElement.lang || "zh");
|
|
70
|
+
const [name = "", ...rest] = table?.columns ?? [];
|
|
71
|
+
const rows = table?.rows ?? [];
|
|
72
|
+
const series = rest.map((label, index) => ({ label, column: index + 1 })).filter(({ column }) => rows.some((row) => numberOf(row[column] ?? "") !== null));
|
|
73
|
+
drawn.replaceChildren();
|
|
74
|
+
drawn.classList.remove("gallery-chart-card-below", "gallery-chart-card-many");
|
|
75
|
+
drawn.removeAttribute("role");
|
|
76
|
+
drawn.removeAttribute("aria-label");
|
|
77
|
+
if (series.length === 0) {
|
|
78
|
+
const empty = document.createElement("p");
|
|
79
|
+
empty.className = "gallery-chart-card-empty";
|
|
80
|
+
empty.textContent = chinese ? "表格里还没有数:第一列写名字,后面的列写数。" : "The table has no numbers yet: names in its first column, numbers in the columns after it.";
|
|
81
|
+
drawn.append(empty);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const values = rows.flatMap((row) => series.map(({ column }) => numberOf(row[column] ?? ""))).filter((value) => value !== null);
|
|
85
|
+
const low = Math.min(0, ...values);
|
|
86
|
+
const span = Math.max(0, ...values) - low || 1;
|
|
87
|
+
/** @param {number} value */
|
|
88
|
+
const at = (value) => ((value - low) / span) * 100;
|
|
89
|
+
const zero = at(0);
|
|
90
|
+
drawn.classList.toggle("gallery-chart-card-below", low < 0);
|
|
91
|
+
drawn.classList.toggle("gallery-chart-card-many", series.length > 1);
|
|
92
|
+
drawn.style.setProperty("--gallery-chart-card-zero", `${zero}%`);
|
|
93
|
+
drawn.setAttribute("role", "img");
|
|
94
|
+
drawn.setAttribute("aria-label", chinese ? `${series.map(({ label }) => label).join("、")},按${name}` : `${series.map(({ label }) => label).join(", ")} by ${name}`);
|
|
95
|
+
const color = (/** @type {number} */ index) => `var(--doc-series-${(index % 6) + 1})`;
|
|
96
|
+
if (series.length > 1) {
|
|
97
|
+
const legend = part("legend");
|
|
98
|
+
series.forEach(({ label }, index) => {
|
|
99
|
+
const key = part("key");
|
|
100
|
+
const swatch = part("swatch");
|
|
101
|
+
swatch.style.background = color(index);
|
|
102
|
+
key.append(swatch, label);
|
|
103
|
+
legend.append(key);
|
|
104
|
+
});
|
|
105
|
+
drawn.append(legend);
|
|
106
|
+
}
|
|
107
|
+
for (const row of rows) {
|
|
108
|
+
const line = part("row");
|
|
109
|
+
const lanes = part("lanes");
|
|
110
|
+
series.forEach(({ column }, index) => {
|
|
111
|
+
const lane = part("lane");
|
|
112
|
+
const value = numberOf(row[column] ?? "");
|
|
113
|
+
if (value !== null) {
|
|
114
|
+
const from = Math.min(zero, at(value));
|
|
115
|
+
const to = Math.max(zero, at(value));
|
|
116
|
+
const bar = part("bar");
|
|
117
|
+
bar.style.left = `${from}%`;
|
|
118
|
+
bar.style.width = `max(1px, ${to - from}%)`;
|
|
119
|
+
bar.style.background = color(index);
|
|
120
|
+
const said = part("value", row[column]);
|
|
121
|
+
if (value < 0) said.style.right = `calc(${100 - from}% + 4px)`;
|
|
122
|
+
else said.style.left = `calc(${to}% + 4px)`;
|
|
123
|
+
lane.append(bar, said);
|
|
124
|
+
}
|
|
125
|
+
lanes.append(lane);
|
|
126
|
+
});
|
|
127
|
+
line.append(part("label", row[0] ?? ""), lanes);
|
|
128
|
+
drawn.append(line);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 120"><rect width="240" height="120" rx="8" fill="#f2f4f7"/><rect x="16" y="14" width="208" height="92" rx="8" fill="#ffffff" stroke="#d0d5dd"/><rect x="30" y="26" width="40" height="8" rx="3" fill="#98a2b3"/><rect x="78" y="26" width="120" height="8" rx="3" fill="#2678d8"/><rect x="30" y="48" width="40" height="8" rx="3" fill="#98a2b3"/><rect x="78" y="48" width="84" height="8" rx="3" fill="#2678d8"/><rect x="30" y="70" width="40" height="8" rx="3" fill="#98a2b3"/><rect x="78" y="70" width="136" height="8" rx="3" fill="#2678d8"/><rect x="78" y="90" width="136" height="2" fill="#d0d5dd"/></svg>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* Every selector starts at the instance and goes down a step at a time (>), so that nothing here
|
|
2
|
+
reaches the rest of the page or the table in the slot, which reads as the page's. The frame is
|
|
3
|
+
gallery/card's; the bars the script draws take the kit's series colors, which follow the theme, and
|
|
4
|
+
are laid out in percents of the card's width. */
|
|
5
|
+
[data-doc-component="gallery/chart-card"] {
|
|
6
|
+
margin: var(--doc-component-gap) 0;
|
|
7
|
+
padding: 20px 24px 8px;
|
|
8
|
+
border: 1px solid var(--doc-border);
|
|
9
|
+
border-radius: 10px;
|
|
10
|
+
background: var(--doc-surface);
|
|
11
|
+
> h3 { margin: 0 0 12px; font-size: var(--doc-card-title-font-size); line-height: var(--doc-card-title-line-height); font-weight: 600; letter-spacing: -.025em; }
|
|
12
|
+
> .gallery-chart-card-bars {
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: fit-content(40%) minmax(0, 1fr);
|
|
15
|
+
gap: 8px 12px;
|
|
16
|
+
align-items: center;
|
|
17
|
+
margin: 0 0 12px;
|
|
18
|
+
font-size: 13px;
|
|
19
|
+
line-height: 1.4;
|
|
20
|
+
color: var(--doc-text);
|
|
21
|
+
> .gallery-chart-card-legend {
|
|
22
|
+
grid-column: 1 / -1;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-wrap: wrap;
|
|
25
|
+
gap: 4px 16px;
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
color: var(--doc-muted);
|
|
28
|
+
> .gallery-chart-card-key { display: inline-flex; align-items: center; gap: 6px; }
|
|
29
|
+
> .gallery-chart-card-key > .gallery-chart-card-swatch { width: 10px; height: 10px; border-radius: 2px; }
|
|
30
|
+
}
|
|
31
|
+
> .gallery-chart-card-row { display: contents; }
|
|
32
|
+
> .gallery-chart-card-row > .gallery-chart-card-label { text-align: right; overflow-wrap: anywhere; }
|
|
33
|
+
> .gallery-chart-card-row > .gallery-chart-card-lanes { display: flex; flex-direction: column; gap: 2px; margin-right: 4em; }
|
|
34
|
+
> .gallery-chart-card-row > .gallery-chart-card-lanes > .gallery-chart-card-lane { position: relative; height: 18px; }
|
|
35
|
+
&.gallery-chart-card-many > .gallery-chart-card-row > .gallery-chart-card-lanes > .gallery-chart-card-lane { height: 13px; }
|
|
36
|
+
&.gallery-chart-card-below > .gallery-chart-card-row > .gallery-chart-card-lanes { margin-left: 4em; }
|
|
37
|
+
&.gallery-chart-card-below > .gallery-chart-card-row > .gallery-chart-card-lanes > .gallery-chart-card-lane { background: linear-gradient(var(--doc-grid), var(--doc-grid)) var(--gallery-chart-card-zero) 0 / 1px 100% no-repeat; }
|
|
38
|
+
> .gallery-chart-card-row > .gallery-chart-card-lanes > .gallery-chart-card-lane > .gallery-chart-card-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
|
|
39
|
+
> .gallery-chart-card-row > .gallery-chart-card-lanes > .gallery-chart-card-lane > .gallery-chart-card-value { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; line-height: 1; color: var(--doc-muted); white-space: nowrap; }
|
|
40
|
+
> .gallery-chart-card-empty { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--doc-muted); }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div data-doc-component="gallery/chart-card">
|
|
2
|
+
<h3>图表的标题</h3>
|
|
3
|
+
<div data-doc-slot="table">
|
|
4
|
+
<table>
|
|
5
|
+
<thead><tr><th>项目</th><th>数值</th></tr></thead>
|
|
6
|
+
<tbody>
|
|
7
|
+
<tr><td>项目 A</td><td>12</td></tr>
|
|
8
|
+
<tr><td>项目 B</td><td>18</td></tr>
|
|
9
|
+
<tr><td>项目 C</td><td>9</td></tr>
|
|
10
|
+
</tbody>
|
|
11
|
+
</table>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 表格图表卡片 (gallery/chart-card)
|
|
2
|
+
|
|
3
|
+
A card with a title, a table, and the bar chart the block draws from that table, with no script of the document's. Use it for a comparison of a few numbers by name (channels, teams, months) that the reader may change; for any other chart, write a chart of the document's own (references/writing-html.md, "Figures and charts").
|
|
4
|
+
|
|
5
|
+
## How to write it
|
|
6
|
+
|
|
7
|
+
Write the element as example.html does (`gallery block show gallery/chart-card` prints it):
|
|
8
|
+
|
|
9
|
+
- the title, its `h3`: what the numbers are, with their unit.
|
|
10
|
+
- the table, in its `<div data-doc-slot="table">`: a plain table of the document's, with no `data-doc-chart` and no `<caption>` (the card's title is its title):
|
|
11
|
+
- its header row: the names of the columns;
|
|
12
|
+
- the first column: the name of each bar;
|
|
13
|
+
- each column after it that holds numbers: a series, its header the legend's words (two or more draw their bars one under another, a legend above them);
|
|
14
|
+
- a cell with no number (empty, a dash, `n/a`): no bar. A number may have thousands separators and a `%`.
|
|
15
|
+
|
|
16
|
+
The reader edits the table as any table of the document's, and the bars draw again.
|
|
17
|
+
|
|
18
|
+
## How it looks
|
|
19
|
+
|
|
20
|
+
A framed card: the title, horizontal bars from zero with each value at its end, in the kit's series colors, which follow the theme, then the table. The bars are drawn by the block's script and are not in the file: where the block is not, and in a Markdown export, a reader has the title and the table.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/chart-view",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"name": { "zh": "图表", "en": "Chart" },
|
|
6
|
+
"description": { "zh": "表格的视图:按一列分组的计数、合计或平均,或每一行的数,画成条形图,表格一改就重画", "en": "A view of a table: a count, sum or average by a column, or each row's number, drawn as bars that follow each edit of the table" },
|
|
7
|
+
"words": "tubiao tiaoxingtu chart bar bars graph 图表 条形图 柱状图 统计 视图 view",
|
|
8
|
+
"parts": {
|
|
9
|
+
"settings": { "at": ":scope > script", "edit": "data" }
|
|
10
|
+
},
|
|
11
|
+
"runtime": { "generated": [":scope > .gallery-chart-view-face"] },
|
|
12
|
+
"places": ["document"],
|
|
13
|
+
"settings": [
|
|
14
|
+
{ "key": "by", "label": { "zh": "分组依据", "en": "Group by" }, "type": "text", "default": "" },
|
|
15
|
+
{ "key": "op", "label": { "zh": "计算", "en": "Calculate" }, "type": "select", "options": ["count", "sum", "average"], "default": "count" },
|
|
16
|
+
{ "key": "value", "label": { "zh": "数值列", "en": "Numbers" }, "type": "text", "default": "" },
|
|
17
|
+
{ "key": "title", "label": { "zh": "标题", "en": "Title" }, "type": "text", "default": "" }
|
|
18
|
+
],
|
|
19
|
+
"needs": ["tables"]
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<table data-doc-chart-source="sales">
|
|
2
|
+
<thead><tr><th>客户</th><th>区域</th><th>金额</th><th>状态</th></tr></thead>
|
|
3
|
+
<tbody>
|
|
4
|
+
<tr><td>华东物流</td><td>华东</td><td>12,800</td><td>已成交</td></tr>
|
|
5
|
+
<tr><td>北方食品</td><td>华北</td><td>8,600</td><td>洽谈中</td></tr>
|
|
6
|
+
<tr><td>南方家居</td><td>华南</td><td>15,200</td><td>已成交</td></tr>
|
|
7
|
+
<tr><td>东海电子</td><td>华东</td><td>9,300</td><td>洽谈中</td></tr>
|
|
8
|
+
<tr><td>西部能源</td><td>西部</td><td>6,400</td><td>已成交</td></tr>
|
|
9
|
+
</tbody>
|
|
10
|
+
</table>
|
|
11
|
+
<div data-doc-component="gallery/chart-view" data-doc-from="sales">
|
|
12
|
+
<script type="application/json">{"by":"区域","op":"sum","value":"金额","title":"各区域的金额(元)"}</script>
|
|
13
|
+
</div>
|