@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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { CELL_ALIGN_CLASSES } from "../../../../shared/components/table.mjs";
|
|
1
2
|
import { languageFromFence } from "./languages.mjs";
|
|
2
|
-
import { decodeEntities, parseInlineMarkdown, unescapeMarkdown } from "./inline.mjs";
|
|
3
|
+
import { decodeEntities, parseCellMarkdown, parseInlineMarkdown, unescapeMarkdown } from "./inline.mjs";
|
|
3
4
|
import { spec } from "./rich.mjs";
|
|
4
5
|
|
|
5
6
|
// Markdown and plain text as block specs (notion-lite editor/input/clipboard/parse.js). Notion
|
|
@@ -52,8 +53,9 @@ import { spec } from "./rich.mjs";
|
|
|
52
53
|
// which holds paragraphs alone, noted; GitHub's alerts (> [!NOTE], [!TIP],
|
|
53
54
|
// [!IMPORTANT], [!WARNING], [!CAUTION]) callouts
|
|
54
55
|
// pictures a paragraph's pictures blocks of their own, the text around them paragraphs; an
|
|
55
|
-
// item's blocks it holds;
|
|
56
|
-
//
|
|
56
|
+
// item's blocks it holds; a table cell's its own, amid its words (单元格里的图片: the
|
|
57
|
+
// import makes each a file of the page's, transfer/import.mjs); elsewhere (a heading,
|
|
58
|
+
// a disclosure's title) a picture of the web a link, any other its alt text, noted
|
|
57
59
|
// HTML <details><summary> … </details> a toggle, its blocks read as Markdown; an HTML block
|
|
58
60
|
// of pictures alone (<p align="center"><img …></p>, a link around them) its picture
|
|
59
61
|
// blocks, of an <hr> a divider, of line breaks or empty tags nothing; any other HTML
|
|
@@ -71,6 +73,18 @@ import { spec } from "./rich.mjs";
|
|
|
71
73
|
// `firstLine`): `notes` [{ line, kind, text }]; what the import tries or looks for afterwards is
|
|
72
74
|
// returned with its line too: the formulas (`formulas`, KaTeX draws them or not) and the links to
|
|
73
75
|
// addresses that are no web ones (`links`: a file beside the document, a place in it).
|
|
76
|
+
//
|
|
77
|
+
// Yuque's Markdown (`yuque`: its toolbar's 复制为 Markdown, which yuque.mjs reads so; never the
|
|
78
|
+
// import's) is that, and what Yuque writes besides:
|
|
79
|
+
// :::info … ::: its 提示 (info, tips, success, warning, danger, color1–5; up to a line of ::: alone),
|
|
80
|
+
// a spec { type: "report_callout", props: { alert } } of the blocks between
|
|
81
|
+
// HTML every HTML block a spec { type: "html", props: { html } } (yuque.mjs reads it as the
|
|
82
|
+
// paste reads HTML: a picture's alt is no caption, Yuque's being a file's name)
|
|
83
|
+
// tables a row of more cells than its header's (Yuque writes a | in a cell as it is) its cells
|
|
84
|
+
// past the header's last one that one's, joined by |; the delimiter row's alignments
|
|
85
|
+
// each cell's (props.looks: doc-align-left / center / right)
|
|
86
|
+
// code a ```mermaid fence code, never a flow
|
|
87
|
+
// inline inline.mjs's: $ … $ with spaces inside, <font style> colors
|
|
74
88
|
|
|
75
89
|
// A callout's first line: an emoji first is its icon, then its text.
|
|
76
90
|
const EMOJI = /^(\p{Extended_Pictographic}(?:[\u{FE0F}\u{200D}\u{1F3FB}-\u{1F3FF}]|\p{Extended_Pictographic})*)\s*/u;
|
|
@@ -81,14 +95,23 @@ function callout(head, children, inline = parseInlineMarkdown) {
|
|
|
81
95
|
return spec("callout", [], match ? { icon: match[1] } : {}, blocks.length ? blocks : [spec("text")]);
|
|
82
96
|
}
|
|
83
97
|
|
|
84
|
-
/** A table spec of rows of rich text (columns c0, c1, …). */
|
|
85
|
-
export function tableSpec(rows, header) {
|
|
98
|
+
/** A table spec of rows of rich text (columns c0, c1, …); `looks`, each column's look of its cells (a class, or none); `lines`: each row's line in a document (what the import notes of its pictures is at it). */
|
|
99
|
+
export function tableSpec(rows, header, looks = [], lines = null) {
|
|
86
100
|
const width = Math.max(1, ...rows.map((row) => row.length));
|
|
87
101
|
const columns = Array.from({ length: width }, (_, i) => `c${i}`);
|
|
102
|
+
const looked = Object.fromEntries(columns.map((column, i) => [column, looks[i]]).filter(([, look]) => look));
|
|
88
103
|
return spec("table", [], { table_block_column_order: columns, table_block_column_format: {}, table_block_column_header: header, table_block_row_header: false },
|
|
89
|
-
rows.map((row) => spec("table_row", [], { cells: Object.fromEntries(row.map((cell, i) => [columns[i], cell])) })));
|
|
104
|
+
rows.map((row, index) => spec("table_row", [], { cells: Object.fromEntries(row.map((cell, i) => [columns[i], cell])), ...(Object.keys(looked).length ? { looks: looked } : {}), ...(lines ? { line: lines[index] } : {}) })));
|
|
90
105
|
}
|
|
91
106
|
|
|
107
|
+
// A delimiter row's cell's alignment (:--, :-:, --:) as a cell's look (the table's classes: left,
|
|
108
|
+
// center, right), or null.
|
|
109
|
+
const [LEFT, CENTER, RIGHT] = CELL_ALIGN_CLASSES;
|
|
110
|
+
const alignOf = (cell) => {
|
|
111
|
+
const text = cell.trim();
|
|
112
|
+
return text.startsWith(":") && text.endsWith(":") ? CENTER : text.startsWith(":") ? LEFT : text.endsWith(":") ? RIGHT : null;
|
|
113
|
+
};
|
|
114
|
+
|
|
92
115
|
const indentOf = (raw) => raw.match(/^[ \t]*/)[0].replace(/\t/g, " ").length;
|
|
93
116
|
const dedent = (lines, n) => lines.map((line) => line.replace(new RegExp(`^[ \\t]{0,${n}}`), ""));
|
|
94
117
|
|
|
@@ -167,6 +190,8 @@ function parseLines(lines, doc = null, base = 0) {
|
|
|
167
190
|
const lineOf = (i) => (doc ? doc.firstLine + base + i : 0);
|
|
168
191
|
// Inline text: Notion's rules for a paste; a document's rules, its pictures links or words (textOnly), for a document.
|
|
169
192
|
const inline = (text, i) => (doc ? textOnly(docInline(doc, text, lineOf(i)), lineOf(i), doc) : parseInlineMarkdown(text));
|
|
193
|
+
// A table's cell, which holds pictures (单元格里的图片): a document's rules or a paste's, its pictures kept.
|
|
194
|
+
const cellInline = (text, i) => (doc ? docInline(doc, text, lineOf(i)) : parseCellMarkdown(text));
|
|
170
195
|
// A list item: Notion's rules for a paste (a page export's line of no words, " ", none); a
|
|
171
196
|
// document's, its pictures blocks it holds (before the blocks indented under it).
|
|
172
197
|
const item = (type, text, i, props = {}) => {
|
|
@@ -196,6 +221,18 @@ function parseLines(lines, doc = null, base = 0) {
|
|
|
196
221
|
const language = m[2] ? languageFromFence(m[2]) ?? m[2][0].toUpperCase() + m[2].slice(1) : undefined;
|
|
197
222
|
block = spec("code", code ? [[code]] : [], language ? { language } : {});
|
|
198
223
|
}
|
|
224
|
+
} else if (doc?.yuque && (m = YUQUE_ALERT.exec(line))) {
|
|
225
|
+
// Yuque's 提示: its blocks up to a line of ::: alone (one opened in it closing first).
|
|
226
|
+
const start = i;
|
|
227
|
+
const body = [];
|
|
228
|
+
for (let depth = 1, at = i + 1; at < lines.length; at++) {
|
|
229
|
+
const each = lines[at].trim();
|
|
230
|
+
depth += YUQUE_ALERT.test(each) ? 1 : each === ":::" ? -1 : 0;
|
|
231
|
+
i = at;
|
|
232
|
+
if (depth === 0) break;
|
|
233
|
+
body.push(lines[at]);
|
|
234
|
+
}
|
|
235
|
+
block = spec("report_callout", [], { alert: m[1].toLowerCase() }, parseLines(dedent(body, indent), doc, base + start + 1));
|
|
199
236
|
} else if ((math = displayMathStart(line))) {
|
|
200
237
|
if (math.single) {
|
|
201
238
|
block = spec("equation", mathTitle([math.rest.slice(0, -math.close.length)], math.unescape));
|
|
@@ -312,7 +349,8 @@ function parseLines(lines, doc = null, base = 0) {
|
|
|
312
349
|
}
|
|
313
350
|
const written = dedent(body, indent).join("\n").trim();
|
|
314
351
|
const bare = written.replace(/<!--[\s\S]*?-->/g, "").replace(PICTURE_TAGS, "").trim();
|
|
315
|
-
if (
|
|
352
|
+
if (doc.yuque) block = spec("html", [], { html: written, line: lineOf(start) }); // read as the paste reads HTML (yuque.mjs)
|
|
353
|
+
else if (!bare && /<img\s/i.test(written)) blocks = paragraphBlocks(docInline(doc, written.replace(/\s+/g, " "), lineOf(start)), lineOf(start)); // pictures alone (<p align="center"><img …></p>): picture blocks
|
|
316
354
|
else if (!bare && /<hr\b/i.test(written)) block = spec("divider");
|
|
317
355
|
else if (!bare) continue; // line breaks or empty tags alone: a viewer's spacing
|
|
318
356
|
else block = spec("html", [], { html: written, line: lineOf(start) });
|
|
@@ -342,9 +380,13 @@ function parseLines(lines, doc = null, base = 0) {
|
|
|
342
380
|
// GFM's table: its header row, its delimiter row, then its rows.
|
|
343
381
|
// Each row's cells read at its line (what they leave out noted there).
|
|
344
382
|
const rows = [[tableCells(lines[i], true), i]];
|
|
383
|
+
const delimiter = tableCells(lines[i + 1], true);
|
|
345
384
|
for (i += 2; i < lines.length && lines[i].trim() && (/^\s*\|/.test(lines[i]) || !startsBlock(lines[i].trim())); i++) rows.push([tableCells(lines[i], true), i]);
|
|
346
385
|
i--;
|
|
347
|
-
|
|
386
|
+
// Yuque's: a | it wrote as it is joins the cells past the header's last one to that one; its alignments its cells'.
|
|
387
|
+
const width = rows[0][0].length;
|
|
388
|
+
const fitted = doc.yuque ? rows.map(([row, at]) => [row.length > width ? [...row.slice(0, width - 1), row.slice(width - 1).join("|")] : row, at]) : rows;
|
|
389
|
+
block = tableSpec(fitted.map(([row, at]) => row.map((cell) => cellInline(cell, at))), true, doc.yuque ? delimiter.map(alignOf) : [], fitted.map(([, at]) => lineOf(at)));
|
|
348
390
|
} else if (/^\|.*\|$/.test(line)) {
|
|
349
391
|
const rows = [];
|
|
350
392
|
let header = false;
|
|
@@ -354,7 +396,7 @@ function parseLines(lines, doc = null, base = 0) {
|
|
|
354
396
|
if (rows.length === 1) header = true;
|
|
355
397
|
continue;
|
|
356
398
|
}
|
|
357
|
-
rows.push(cells.map((cell) => (
|
|
399
|
+
rows.push(cells.map((cell) => cellInline(cell, i)));
|
|
358
400
|
}
|
|
359
401
|
i--;
|
|
360
402
|
block = tableSpec(rows, header);
|
|
@@ -409,6 +451,8 @@ const DROPPED_HTML = new Set(["script", "style", "textarea"]);
|
|
|
409
451
|
// The tags an HTML block of pictures alone is made of (a README's <p align="center"><img …></p>).
|
|
410
452
|
const PICTURE_TAGS = /<\/?(?:p|div|a|center|picture|source|span|br|img|hr)(?=[\s/>])[^>]*>/gi;
|
|
411
453
|
const ALERTS = { note: "ℹ️", tip: "💡", important: "❗", warning: "⚠️", caution: "🚨" };
|
|
454
|
+
// Yuque's 提示 opened (its Markdown's): ::: and its kind, alone on its line.
|
|
455
|
+
const YUQUE_ALERT = /^:::[ \t]*([A-Za-z][\w-]*)[ \t]*$/;
|
|
412
456
|
const LINK_DEFINITION = /^\[([^\]^][^\]]*)\]:\s*(<[^>]*>|\S+)(?:\s+("[^"]*"|'[^']*'|\([^)]*\)))?\s*$/;
|
|
413
457
|
const FOOTNOTE_DEFINITION = /^\[\^([^\]\s]+)\]:\s?(.*)$/;
|
|
414
458
|
// East Asian wide characters (CJK, kana, Hangul, their punctuation and full-width forms): a line
|
|
@@ -583,7 +627,7 @@ function documentCode(name, meta, code, line, doc) {
|
|
|
583
627
|
const braces = /^\{([^}]*)\}/.exec(meta.trim());
|
|
584
628
|
const fence = name || /\.([\w+#-]+)/.exec(braces?.[1] ?? "")?.[1] || "";
|
|
585
629
|
const title = /(?:^|[\s{])title=(?:"([^"]*)"|'([^']*)'|([^\s}]+))/.exec(meta);
|
|
586
|
-
if (fence.toLowerCase() === "mermaid") {
|
|
630
|
+
if (fence.toLowerCase() === "mermaid" && !doc.yuque) {
|
|
587
631
|
const steps = flowSteps(code);
|
|
588
632
|
if (steps) return spec("flow", [], { steps, line });
|
|
589
633
|
doc.notes.push({ line, kind: "mermaid", text: "a mermaid diagram that is not one chain of steps is kept as its code" });
|
|
@@ -729,11 +773,12 @@ function takeDefinitions(lines, doc) {
|
|
|
729
773
|
* title }] (in order), notes: [{ line, kind, text }], formulas: [{ tex, line, display }] (each
|
|
730
774
|
* formula read, for the import to try), links: [{ href, line }] (each link to an address that is no
|
|
731
775
|
* web one: a file beside it, a place in it) }. `firstLine`: the number of its first line in its file
|
|
732
|
-
* (after a front matter the import took off).
|
|
776
|
+
* (after a front matter the import took off). `yuque`: Yuque's Markdown, read with what Yuque
|
|
777
|
+
* writes besides (this file's header; a paste's, yuque.mjs).
|
|
733
778
|
*/
|
|
734
|
-
export function readMarkdownDocument(text, { firstLine = 1 } = {}) {
|
|
779
|
+
export function readMarkdownDocument(text, { firstLine = 1, yuque = false } = {}) {
|
|
735
780
|
const lines = text.replace(/\r\n?/g, "\n").split("\n");
|
|
736
|
-
const doc = { firstLine, refs: new Map(), definitions: new Map(), order: [], notes: [], formulas: [], links: [], at: firstLine };
|
|
781
|
+
const doc = { firstLine, yuque, refs: new Map(), definitions: new Map(), order: [], notes: [], formulas: [], links: [], at: firstLine };
|
|
737
782
|
doc.footnote = (label) => {
|
|
738
783
|
const definition = doc.definitions.get(label.toLowerCase());
|
|
739
784
|
if (!definition) {
|
|
@@ -4,6 +4,7 @@ import { mathifyRichText, mathifySpecs } from "./math.mjs";
|
|
|
4
4
|
import { fromMarkdown } from "./markdown.mjs";
|
|
5
5
|
import { parseInlineMarkdown } from "./inline.mjs";
|
|
6
6
|
import { vscodeLanguage } from "./languages.mjs";
|
|
7
|
+
import { readYuque } from "./yuque.mjs";
|
|
7
8
|
import { addressOf } from "../../links/address.mjs";
|
|
8
9
|
|
|
9
10
|
// What a paste from another program is (Notion 860313 clipboardActions' external content, notion-lite
|
|
@@ -20,7 +21,8 @@ import { addressOf } from "../../links/address.mjs";
|
|
|
20
21
|
// (\[ … \]) → a formula block.
|
|
21
22
|
// Besides Notion's: formulas AI answers copy (math.mjs, markdown.mjs, inline.mjs) and colors
|
|
22
23
|
// (feishu-lite: html.mjs `colors`; nearest for Word, Google Docs and Notion, whose styles are meant,
|
|
23
|
-
// as Feishu's 129153 · P; else only the page's own).
|
|
24
|
+
// as Feishu's 129153 · P; else only the page's own); and first of all Yuque's (yuque.mjs): its
|
|
25
|
+
// document's nodes (text/ne-inode, its HTML's <ne-clipboard>, text/lake) or its toolbar's Markdown.
|
|
24
26
|
|
|
25
27
|
const OFFICE = /schemas-microsoft-com:office|xmlns:m="http:\/\/schemas\.microsoft\.com\/office\/2004\/12\/omml"/;
|
|
26
28
|
const WORDPRESS = /<!-- wp:/;
|
|
@@ -92,6 +94,9 @@ function sameAddress(one, other) {
|
|
|
92
94
|
* text } (notion-lite readClipboard, after the editor's own formats).
|
|
93
95
|
*/
|
|
94
96
|
export function readExternal(data, options = {}) {
|
|
97
|
+
// Yuque's (yuque.mjs): its document's structure, which its HTML says only in part, or its Markdown.
|
|
98
|
+
const yuque = readYuque(data, options);
|
|
99
|
+
if (yuque) return yuque;
|
|
95
100
|
const external = externalContent(data, options);
|
|
96
101
|
const { text, html } = external;
|
|
97
102
|
const convert = { colors: external.colors };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { escapeMarkup, escapeText } from "../../../../shared/escape.mjs";
|
|
2
2
|
import { knownLanguage, languageId } from "../../../../shared/code-languages.mjs";
|
|
3
3
|
import { iconKind, validIcon } from "../../../../shared/emoji/icon-value.mjs";
|
|
4
|
-
import { BLOCK_TYPES, TOGGLES, accepts, clipboardOf } from "../../../components/registry.mjs";
|
|
4
|
+
import { BLOCK_TYPES, COLOR_DEFAULTS, TOGGLES, accepts, clipboardOf } from "../../../components/registry.mjs";
|
|
5
5
|
import { validDirection, validStart } from "../../../components/list/index.mjs";
|
|
6
6
|
import { MAX_COLUMNS, MIN_COLUMNS } from "../../../components/columns/index.mjs";
|
|
7
|
-
import { MAX_TABLE_CELLS } from "../../../components/table/index.mjs";
|
|
7
|
+
import { MAX_TABLE_CELLS, validLook, validTable } from "../../../components/table/index.mjs";
|
|
8
8
|
import { imageSource, kindOfBlock, webPage } from "../own/rules.mjs";
|
|
9
9
|
import { NOTION_COLOR_NAMES } from "./colors.mjs";
|
|
10
10
|
import { plainOf } from "./rich.mjs";
|
|
@@ -27,10 +27,14 @@ import { t } from "../../../../shared/i18n/index.mjs";
|
|
|
27
27
|
// other blocks after it; callout → highlight with its emoji (💡 without); toggle → disclosure;
|
|
28
28
|
// code → code (its language where the kit knows it, else 自动识别, or the name a whole document's
|
|
29
29
|
// fence gives it, `fence`; its `title`); equation → formula block;
|
|
30
|
-
// table → table (its header row and column
|
|
30
|
+
// table → table (its header row and column; besides Notion's, yuque.mjs's merged cells, a row's
|
|
31
|
+
// `spans` naming the cells it has, else each cell in a column of its own, and the cells' looks: their
|
|
32
|
+
// alignment); image → image (an address of the web or data:);
|
|
31
33
|
// embed → embed (an address of the web); file → a link; column_list → columns (two or more, else
|
|
32
34
|
// their blocks); tab → tabs area; divider → divider; the kit's own flowchart (report_flow, besides
|
|
33
|
-
// Notion's: html.mjs) → a flowchart of nodes (stepOf), where a box takes none its nodes' blocks
|
|
35
|
+
// Notion's: html.mjs) → a flowchart of nodes (stepOf), where a box takes none its nodes' blocks;
|
|
36
|
+
// report_callout (besides Notion's: Yuque's 提示, yuque.mjs and markdown.mjs) → the page's callout
|
|
37
|
+
// (提示块) of its blocks, its color a background.
|
|
34
38
|
// Two of a whole Markdown document's, which the import makes (src/transfer/import.mjs; never a
|
|
35
39
|
// paste): section → a section of its blocks; html (an HTML block kept as written) → a paragraph of
|
|
36
40
|
// its `marker` alone, which the import writes the HTML in place of (fillReport).
|
|
@@ -48,13 +52,19 @@ const colorClass = (value) => {
|
|
|
48
52
|
};
|
|
49
53
|
const SAFE_LINK = /^(https?:|mailto:|tel:|#)/i;
|
|
50
54
|
|
|
51
|
-
/**
|
|
52
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Rich text as inline HTML of the format bar's marks. `pictures` (a table's cell, which holds them:
|
|
57
|
+
* 单元格里的图片): a picture piece (inline.mjs's, html.mjs's in a cell) an <img> of its address, alt and
|
|
58
|
+
* width as written, which the paste makes a picture of the document's folder (page/table/pictures.mjs);
|
|
59
|
+
* else, a picture a reader left in text, its alt.
|
|
60
|
+
*/
|
|
61
|
+
export function richHtml(title, { pictures = false } = {}) {
|
|
53
62
|
return (title ?? []).map(([text, annotations = []]) => {
|
|
54
63
|
const has = (name) => annotations.some((a) => a[0] === name);
|
|
55
64
|
const formula = annotations.find((a) => a[0] === "e");
|
|
56
|
-
const picture = annotations.find((a) => a[0] === "img");
|
|
57
|
-
|
|
65
|
+
const picture = annotations.find((a) => a[0] === "img");
|
|
66
|
+
const img = picture && pictures ? `<img src="${escapeMarkup(picture[1])}" alt="${escapeMarkup(picture[2] ?? "")}"${/^\d+$/.test(picture[4] ?? "") ? ` width="${picture[4]}"` : ""}>` : "";
|
|
67
|
+
let html = formula ? `<span class="doc-math-inline">\\(${escapeText(formula[1])}\\)</span>` : img ? img.repeat([...text].length || 1) : escapeText(picture ? picture[2] ?? "" : text).replace(/\n/g, "<br>");
|
|
58
68
|
if (!formula && has("c")) html = `<code>${html}</code>`;
|
|
59
69
|
if (has("sup")) html = `<sup>${html}</sup>`;
|
|
60
70
|
if (has("sub")) html = `<sub>${html}</sub>`;
|
|
@@ -239,6 +249,15 @@ function blockOf(s, options) {
|
|
|
239
249
|
const icon = s.props?.icon && !/^(\/|[a-z]+:)/i.test(s.props.icon) && validIcon(s.props.icon) ? s.props.icon : "💡";
|
|
240
250
|
return [{ type: "highlight", blocks: [{ type: "icon", icon }, ...(blocks.length ? blocks : [{ type: "paragraph", html: "" }])] }];
|
|
241
251
|
}
|
|
252
|
+
case "report_callout": {
|
|
253
|
+
// Besides Notion's (yuque.mjs: Yuque's 提示): the page's callout of its blocks, none inside another
|
|
254
|
+
// (as a highlight block's), its color a background (one of the nine, Notion's name; the callout's
|
|
255
|
+
// own default, its blue, no class).
|
|
256
|
+
const made = BLOCK_TYPES.callout;
|
|
257
|
+
const blocks = children(made?.box).flatMap((block) => (made?.nests === false && BLOCK_TYPES[block.type] === made ? heldBy(block) : [block]));
|
|
258
|
+
const name = typeof s.props?.color === "string" && s.props.color !== COLOR_DEFAULTS[made?.kind]?.background ? colorClass(`${s.props.color}_background`) : null;
|
|
259
|
+
return [{ type: "callout", blocks: blocks.length ? blocks : [{ type: "paragraph", html: "" }], ...(name ? { color: name } : {}) }];
|
|
260
|
+
}
|
|
242
261
|
case "toggle": return [{ type: "details", html: richHtml(s.title), blocks: children(BLOCK_TYPES.details?.box) }];
|
|
243
262
|
case "section": {
|
|
244
263
|
const blocks = children(BLOCK_TYPES.section?.box);
|
|
@@ -254,10 +273,23 @@ function blockOf(s, options) {
|
|
|
254
273
|
case "table": {
|
|
255
274
|
const order = (s.props?.table_block_column_order ?? []).slice(0, MAX_TABLE_CELLS);
|
|
256
275
|
// As many rows as the table may have cells for (the server writes no more).
|
|
257
|
-
const
|
|
258
|
-
if (!
|
|
259
|
-
|
|
260
|
-
|
|
276
|
+
const specs = (s.children ?? []).slice(0, Math.floor(MAX_TABLE_CELLS / Math.max(1, order.length)));
|
|
277
|
+
if (!specs.length || !order.length) return [];
|
|
278
|
+
const flags = { outside: true, ...(s.props.table_block_column_header ? { header: true } : {}), ...(s.props.table_block_row_header ? { column: true } : {}) };
|
|
279
|
+
// Besides Notion's (yuque.mjs): merged cells, a row's `spans` naming the cells it has, and the cells' looks.
|
|
280
|
+
const merged = specs.some((row) => row.props?.spans);
|
|
281
|
+
const columnsOf = (row) => (merged ? order.filter((column) => Array.isArray(row.props?.spans?.[column])) : order);
|
|
282
|
+
const rows = specs.map((row) => columnsOf(row).map((column) => richHtml(row.props?.cells?.[column] ?? [], { pictures: true })));
|
|
283
|
+
const lookOf = (row, column) => {
|
|
284
|
+
const look = row.props?.looks?.[column];
|
|
285
|
+
return typeof look === "string" && validLook(look) ? look : "";
|
|
286
|
+
};
|
|
287
|
+
const looks = specs.map((row) => columnsOf(row).map((column) => lookOf(row, column)));
|
|
288
|
+
const looked = looks.some((row) => row.some(Boolean)) ? { looks } : {};
|
|
289
|
+
const table = { type: "table", rows, ...(merged ? { spans: specs.map((row) => columnsOf(row).map((column) => row.props.spans[column])) } : {}), ...looked, ...flags };
|
|
290
|
+
if (!merged || validTable(table, () => true)) return [table];
|
|
291
|
+
// Spans that tile no table (cut short, or said wrong): each cell in its own column, as Notion spreads them.
|
|
292
|
+
return [{ type: "table", rows: specs.map((row) => order.map((column) => richHtml(row.props?.cells?.[column] ?? [], { pictures: true }))), ...flags }];
|
|
261
293
|
}
|
|
262
294
|
case "image": {
|
|
263
295
|
const src = writtenAddress(s.props?.source ?? "");
|