@heycys/gallery 0.1.1 → 0.2.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 +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/columns/page.mjs +4 -4
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/embed/page.mjs +1 -1
- package/browser/editor/components/file/page.mjs +4 -4
- 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 +7 -6
- package/browser/editor/components/icons.mjs +11 -0
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/index.mjs +2 -0
- package/browser/editor/components/image/page.mjs +172 -90
- package/browser/editor/components/installed/index.mjs +15 -4
- package/browser/editor/components/installed/page.mjs +103 -25
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/icons.mjs +13 -8
- package/browser/editor/components/media/page.mjs +5 -3
- package/browser/editor/components/media/toolbar.mjs +12 -3
- package/browser/editor/components/paragraph/index.mjs +4 -3
- package/browser/editor/components/registry.mjs +30 -9
- package/browser/editor/components/table/index.mjs +61 -2
- package/browser/editor/components/table/page.mjs +1 -1
- package/browser/editor/page/after/index.mjs +288 -0
- package/browser/editor/page/align.mjs +91 -0
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/autosave.mjs +310 -37
- package/browser/editor/page/beside.mjs +5 -6
- package/browser/editor/page/block-menu/index.mjs +6 -3
- package/browser/editor/page/blocks.mjs +3 -1
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +182 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +1059 -0
- package/browser/editor/page/board/motion.mjs +177 -0
- package/browser/editor/page/board/settings.mjs +210 -0
- package/browser/editor/page/caret.mjs +1 -1
- package/browser/editor/page/changes/bar.mjs +6 -14
- package/browser/editor/page/changes/index.mjs +2 -2
- 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 +133 -15
- package/browser/editor/page/clipboard/own/blocks.mjs +13 -14
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +6 -2
- package/browser/editor/page/clipboard/own/selection.mjs +1 -1
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +80 -22
- package/browser/editor/page/conflicts.mjs +7 -7
- package/browser/editor/page/core.mjs +34 -16
- package/browser/editor/page/custom-page.mjs +110 -0
- package/browser/editor/page/editor.mjs +71 -17
- package/browser/editor/page/emoji-picker/styles.mjs +7 -12
- package/browser/editor/page/emoji-picker/upload.mjs +2 -2
- package/browser/editor/page/handle/index.mjs +5 -8
- package/browser/editor/page/history.mjs +41 -6
- package/browser/editor/page/insert/index.mjs +20 -22
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/look.mjs +54 -3
- package/browser/editor/page/margin.mjs +18 -3
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +33 -14
- package/browser/editor/page/notices.mjs +2 -2
- package/browser/editor/page/page-objects.mjs +9 -2
- package/browser/editor/page/panel.mjs +4 -9
- package/browser/editor/page/present-links.mjs +15 -5
- package/browser/editor/page/present-shell.mjs +63 -0
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/index.mjs +10 -2
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +48 -4
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/binding.mjs +87 -0
- package/browser/editor/page/table/cells.mjs +102 -46
- package/browser/editor/page/table/index.mjs +24 -9
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +103 -0
- package/browser/editor/page/table/widths.mjs +82 -10
- package/browser/editor/page/text-select/index.mjs +26 -12
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/typing/index.mjs +97 -15
- package/browser/editor/page/typing/leave.mjs +19 -5
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/block-packs.mjs +419 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/colors.mjs +3 -2
- package/browser/shared/component-catalog.mjs +330 -46
- package/browser/shared/component-source.mjs +39 -0
- package/browser/shared/components/heading.mjs +2 -1
- package/browser/shared/components/index.mjs +12 -3
- package/browser/shared/components/installed.mjs +35 -3
- package/browser/shared/components/page.mjs +20 -8
- package/browser/shared/components/paragraph.mjs +8 -1
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -0
- package/browser/shared/document-look.mjs +10 -5
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/line-icons.mjs +37 -0
- 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/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +330 -27
- package/browser/shared/json-layout.mjs +47 -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/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +359 -67
- package/browser/shared/pack-manifest.mjs +88 -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 +500 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/pinyin.mjs +92 -0
- package/browser/shared/present-step.mjs +17 -0
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +8 -1
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/sidebar-head.mjs +70 -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 +139 -0
- package/browser/shared/workspace-columns.mjs +120 -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/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/chunk-3MBRL2PM.mjs +16 -0
- package/dist/chunk-4OKWZY5E.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5K44HLTZ.mjs +2 -0
- package/dist/{chunk-5ZKJ3H4P.mjs → chunk-5XA2ZBAE.mjs} +3 -3
- package/dist/{chunk-4FS7Z7WR.mjs → chunk-67N2QJYT.mjs} +1 -1
- package/dist/chunk-6KBYRA2C.mjs +2 -0
- package/dist/chunk-6N3PX4XX.mjs +8 -0
- package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/chunk-7JDX4E65.mjs +13 -0
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/chunk-7OG26PGF.mjs +2 -0
- package/dist/chunk-AHN3NFKJ.mjs +3 -0
- package/dist/chunk-ALZ6ZENZ.mjs +3 -0
- package/dist/chunk-AR5D57ZD.mjs +170 -0
- package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
- package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
- package/dist/chunk-CMA72MAG.mjs +2 -0
- package/dist/{chunk-LCTHTZIL.mjs → chunk-DAZL73VK.mjs} +91 -91
- package/dist/{chunk-Y6RLRPG3.mjs → chunk-DJISHPUL.mjs} +1 -1
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-FDLXYYG4.mjs → chunk-EAIFITAV.mjs} +1 -1
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/chunk-EP25HDAJ.mjs +2 -0
- package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-F4ZA6JRZ.mjs +3 -0
- package/dist/chunk-F6HVDZR4.mjs +2 -0
- package/dist/chunk-FDMAXMQA.mjs +2 -0
- package/dist/chunk-FETSREUN.mjs +5 -0
- package/dist/chunk-GHOYKMQ3.mjs +4 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-HDWTZ763.mjs +12 -0
- package/dist/chunk-HPOI4ZX7.mjs +6 -0
- package/dist/{chunk-BGGDRNYQ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/{chunk-E7LWZRXY.mjs → chunk-ITOH5EGO.mjs} +1 -1
- package/dist/chunk-IV64FFI4.mjs +2 -0
- package/dist/chunk-J43Z6LSS.mjs +2 -0
- package/dist/chunk-J5PUIV3Y.mjs +4 -0
- package/dist/chunk-JA7G53PC.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JLTZF4LA.mjs +2 -0
- package/dist/chunk-JZT7I2OJ.mjs +2 -0
- package/dist/chunk-K5XATEOO.mjs +2 -0
- package/dist/chunk-L2SUIS5S.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-LM4XFQHZ.mjs +2 -0
- package/dist/chunk-MN7BZL4R.mjs +2 -0
- package/dist/chunk-MTYYHM2G.mjs +15 -0
- package/dist/chunk-MXUBKDRO.mjs +15 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-SYGN7GLU.mjs → chunk-OEXWRJME.mjs} +1 -1
- package/dist/chunk-OFHXGWOX.mjs +2 -0
- package/dist/chunk-ORID3AE7.mjs +166 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-PGDE24N5.mjs +2 -0
- package/dist/chunk-POTA2FV4.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QE5RG76S.mjs +549 -0
- package/dist/chunk-R2ZDLJYT.mjs +10 -0
- package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SWUTTZCN.mjs +2 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TR7TWGHB.mjs +2 -0
- package/dist/chunk-U5XL7D6A.mjs +3 -0
- package/dist/{chunk-XNROSH2T.mjs → chunk-U7NZI6N4.mjs} +2 -2
- package/dist/chunk-UGWMMEJ5.mjs +15 -0
- package/dist/chunk-UJQJKNGK.mjs +2 -0
- package/dist/chunk-UYVCQK3H.mjs +22 -0
- package/dist/chunk-VFX2KNHP.mjs +4 -0
- package/dist/chunk-VS7JIGJW.mjs +24 -0
- package/dist/chunk-W7665ZEC.mjs +6 -0
- package/dist/chunk-WQDQWCX5.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YLPSMDIS.mjs +5 -0
- package/dist/chunk-YNAWBAYN.mjs +3 -0
- package/dist/chunk-YROX2O22.mjs +2 -0
- package/dist/chunk-ZDLPUOAG.mjs +6 -0
- package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZQS6H473.mjs +16 -0
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZWWC4KLF.mjs +20 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-U6KNPJPR.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 +17 -17
- package/kit/report.css +335 -18
- package/kit/runtime.js +1638 -125
- package/kit/state.js +10 -1
- package/kit/tables.js +130 -43
- package/kit/ui.js +79 -35
- 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 +216 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +118 -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 +334 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +174 -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 +513 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +189 -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 +129 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +97 -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 +293 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +85 -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 +171 -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 +347 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +73 -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 +220 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +149 -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 +489 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +214 -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 +387 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +140 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/countdown/component.json +18 -0
- package/packs/gallery-soft/countdown/example.html +3 -0
- package/packs/gallery-soft/countdown/kit.js +206 -0
- package/packs/gallery-soft/countdown/preview.svg +1 -0
- package/packs/gallery-soft/countdown/style.css +211 -0
- package/packs/gallery-soft/countdown/template.html +3 -0
- package/packs/gallery-soft/countdown/writing.md +24 -0
- package/packs/gallery-soft/habit/component.json +14 -0
- package/packs/gallery-soft/habit/example.html +3 -0
- package/packs/gallery-soft/habit/kit.js +366 -0
- package/packs/gallery-soft/habit/preview.svg +1 -0
- package/packs/gallery-soft/habit/style.css +251 -0
- package/packs/gallery-soft/habit/template.html +3 -0
- package/packs/gallery-soft/habit/writing.md +23 -0
- package/packs/gallery-soft/heatmap/component.json +18 -0
- package/packs/gallery-soft/heatmap/example.html +3 -0
- package/packs/gallery-soft/heatmap/kit.js +498 -0
- package/packs/gallery-soft/heatmap/preview.svg +1 -0
- package/packs/gallery-soft/heatmap/style.css +181 -0
- package/packs/gallery-soft/heatmap/template.html +3 -0
- package/packs/gallery-soft/heatmap/writing.md +23 -0
- package/packs/gallery-soft/note/component.json +14 -0
- package/packs/gallery-soft/note/example.html +3 -0
- package/packs/gallery-soft/note/kit.js +162 -0
- package/packs/gallery-soft/note/preview.svg +1 -0
- package/packs/gallery-soft/note/style.css +148 -0
- package/packs/gallery-soft/note/template.html +3 -0
- package/packs/gallery-soft/note/writing.md +20 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/packs/gallery-soft/recent/component.json +13 -0
- package/packs/gallery-soft/recent/example.html +1 -0
- package/packs/gallery-soft/recent/kit.js +335 -0
- package/packs/gallery-soft/recent/preview.svg +1 -0
- package/packs/gallery-soft/recent/style.css +160 -0
- package/packs/gallery-soft/recent/template.html +1 -0
- package/packs/gallery-soft/recent/writing.md +17 -0
- package/packs/gallery-soft/static/component.json +13 -0
- package/packs/gallery-soft/static/example.html +12 -0
- package/packs/gallery-soft/static/preview.svg +1 -0
- package/packs/gallery-soft/static/style.css +186 -0
- package/packs/gallery-soft/static/template.html +1 -0
- package/packs/gallery-soft/static/writing.md +20 -0
- package/packs/gallery-soft/stats/component.json +13 -0
- package/packs/gallery-soft/stats/example.html +1 -0
- package/packs/gallery-soft/stats/kit.js +341 -0
- package/packs/gallery-soft/stats/preview.svg +1 -0
- package/packs/gallery-soft/stats/style.css +119 -0
- package/packs/gallery-soft/stats/template.html +1 -0
- package/packs/gallery-soft/stats/writing.md +13 -0
- package/packs/gallery-soft/today/component.json +12 -0
- package/packs/gallery-soft/today/example.html +1 -0
- package/packs/gallery-soft/today/kit.js +222 -0
- package/packs/gallery-soft/today/preview.svg +1 -0
- package/packs/gallery-soft/today/style.css +178 -0
- package/packs/gallery-soft/today/template.html +1 -0
- package/packs/gallery-soft/today/writing.md +16 -0
- package/packs/gallery-soft/todos/component.json +19 -0
- package/packs/gallery-soft/todos/example.html +3 -0
- package/packs/gallery-soft/todos/kit.js +527 -0
- package/packs/gallery-soft/todos/preview.svg +1 -0
- package/packs/gallery-soft/todos/style.css +212 -0
- package/packs/gallery-soft/todos/template.html +3 -0
- package/packs/gallery-soft/todos/writing.md +32 -0
- package/packs/gallery-soft/weather/component.json +19 -0
- package/packs/gallery-soft/weather/example.html +3 -0
- package/packs/gallery-soft/weather/kit.js +411 -0
- package/packs/gallery-soft/weather/preview.svg +1 -0
- package/packs/gallery-soft/weather/style.css +185 -0
- package/packs/gallery-soft/weather/template.html +3 -0
- package/packs/gallery-soft/weather/writing.md +28 -0
- package/release.json +12 -10
- package/sdk/doc-kit.d.ts +396 -5
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +56 -23
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +225 -0
- package/skill/references/writing-html.md +8 -4
- package/skill/sdk/doc-kit.d.ts +396 -5
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BM_K-Auu.css +1 -0
- package/web/assets/index-DRslOBiv.js +15 -0
- package/web/index.html +2 -2
- package/dist/chunk-3HIRPVLU.mjs +0 -2
- package/dist/chunk-5MHMDLZD.mjs +0 -4
- package/dist/chunk-64K7IPLO.mjs +0 -255
- package/dist/chunk-6QXGZM36.mjs +0 -8
- package/dist/chunk-6RGJOMJP.mjs +0 -16
- package/dist/chunk-AJ73XJF3.mjs +0 -2
- package/dist/chunk-AUZGSZJH.mjs +0 -13
- package/dist/chunk-BFE45AKL.mjs +0 -2
- package/dist/chunk-BXO2ZY5P.mjs +0 -2
- package/dist/chunk-CEH4MRCC.mjs +0 -2
- package/dist/chunk-CY2FNNAB.mjs +0 -16
- package/dist/chunk-DFUDV4LX.mjs +0 -2
- package/dist/chunk-DKXG4XDG.mjs +0 -2
- package/dist/chunk-EZQ34M3F.mjs +0 -124
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FUKQNOQS.mjs +0 -9
- package/dist/chunk-JPOSLGOC.mjs +0 -6
- package/dist/chunk-JVHHHGEA.mjs +0 -3
- package/dist/chunk-L3QKH4OK.mjs +0 -26
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LEF6DRCK.mjs +0 -59
- package/dist/chunk-NO5NJCHO.mjs +0 -2
- package/dist/chunk-NQPVAU63.mjs +0 -2
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O35FIXRB.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-PL6GHLGD.mjs +0 -15
- package/dist/chunk-QJIR2BLP.mjs +0 -6
- package/dist/chunk-QUPLVPB2.mjs +0 -7
- package/dist/chunk-R7BNENLY.mjs +0 -4
- package/dist/chunk-S6O4UHLC.mjs +0 -2
- package/dist/chunk-SGJWQKEI.mjs +0 -2
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-TYK6VNAB.mjs +0 -10
- package/dist/chunk-UALRNVSE.mjs +0 -4
- package/dist/chunk-V3HXVQEM.mjs +0 -2
- package/dist/chunk-V5VXUJKG.mjs +0 -2
- package/dist/chunk-VBXMADMP.mjs +0 -2
- package/dist/chunk-VNV55RUA.mjs +0 -2
- package/dist/chunk-VPD2PS35.mjs +0 -2
- package/dist/chunk-W4VKN3GF.mjs +0 -7
- package/dist/chunk-W5BXXPDJ.mjs +0 -3
- package/dist/chunk-XUNHRCOG.mjs +0 -6
- package/skill/references/building-components.md +0 -367
- package/web/assets/index-Bh74DfsV.css +0 -1
- package/web/assets/index-UW0RyFFt.js +0 -13
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { escapeMarkup, escapeTyped } from "../../../shared/escape.mjs";
|
|
1
|
+
import { escapeMarkup, escapeText, escapeTyped } from "../../../shared/escape.mjs";
|
|
2
2
|
import { mayBePage } from "../../../shared/page-address.mjs";
|
|
3
3
|
import { OUTER, boldThroughout, boxKind, can, holdsAtoms, isEmpty, isFirstLine, isHost, keepLine, nestedLists, newTail, pastedLines, removable, removalTarget, splitBelow, UNIT, textEnd, unitElement } from "../core.mjs";
|
|
4
4
|
import { formulaMaker } from "../formula/index.mjs";
|
|
5
5
|
import { inlineItems, spaceAround } from "../../../shared/inline-spacing.mjs";
|
|
6
6
|
import { caretAt, editable, hostOf, select } from "../caret.mjs";
|
|
7
7
|
import { formatRange, joinMarks, outOfMarks, rangeAt, rangeOffsets } from "../marks.mjs";
|
|
8
|
-
import { BASIC_UNITS, KIND_NAMES, accepts, clipboardOf, takesFormula, texOnly } from "../../components/registry.mjs";
|
|
8
|
+
import { BASIC_UNITS, HOSTS, KIND_NAMES, accepts, clipboardOf, replacedByFile, takesFormula, texOnly } from "../../components/registry.mjs";
|
|
9
9
|
import { listType } from "../../components/list/index.mjs";
|
|
10
10
|
import { nodeAround } from "../../components/flowchart/index.mjs";
|
|
11
11
|
import { cellsData } from "../../components/table/index.mjs";
|
|
12
12
|
import { MIME, OLD_MIME, PASTED_SOURCE, build, checkBlocks, describe, describeAcross, formats, groupItems, holdsFormulas, joinedHtml, kindOfBlock, ownData, ownRange, parse, parseCells, parseText, plainText, prefixCopies, relinkCopies, reportOf, selectedHtml, textFormats, unmadeCopy } from "./own/index.mjs";
|
|
13
13
|
import { bareAddress, externalContent, readExternal } from "./import/read.mjs";
|
|
14
|
+
import { parseClipboardHTML, tableRows } from "./import/html.mjs";
|
|
14
15
|
import { fromMarkdown } from "./import/markdown.mjs";
|
|
15
16
|
import { addressOf } from "../links/address.mjs";
|
|
16
17
|
import { pageObjects, pageOf, typedAsIs } from "../page-objects.mjs";
|
|
@@ -47,6 +48,9 @@ import { t } from "../../../shared/i18n/index.mjs";
|
|
|
47
48
|
// block that takes links.
|
|
48
49
|
// With blocks selected: the blocks go after them, in the first box out from there that takes them all;
|
|
49
50
|
// and so with the caret on a formula block, which has no text to paste into.
|
|
51
|
+
// Into a table's cells (table/cells.mjs, what the clipboard holds as cells: cellsOf), cells go from
|
|
52
|
+
// the caret's cell or the selected ones; in a cell, picture files are pictures of the cell
|
|
53
|
+
// (单元格里的图片, table/pictures.mjs), and a table pasted anywhere keeps its cells' pictures.
|
|
50
54
|
// One undo step. Images and embeds of an address are filled once on the page (one step with the paste).
|
|
51
55
|
|
|
52
56
|
/**
|
|
@@ -62,8 +66,9 @@ import { t } from "../../../shared/i18n/index.mjs";
|
|
|
62
66
|
* for words), or null. titleBold(): whether bold
|
|
63
67
|
* is armed at the caret (a flowchart node's empty title: format-bar/), so that what is pasted there
|
|
64
68
|
* is bold as what is typed is. showCaret(): the caret in view after text went in (caret.mjs).
|
|
69
|
+
* pictures(): the pictures of table cells (table/pictures.mjs: fromFiles, resolve, maker), or null.
|
|
65
70
|
*/
|
|
66
|
-
export function createClipboard({ editing, blocks, struct, recordText, say, loadKatex = async () => Boolean(globalThis.katex), mention: mentionFor = null, linkPasted = () => {}, pageLink = async () => null, titleBold = () => false, showCaret = () => {} }) {
|
|
71
|
+
export function createClipboard({ editing, blocks, struct, recordText, say, loadKatex = async () => Boolean(globalThis.katex), mention: mentionFor = null, linkPasted = () => {}, pageLink = async () => null, titleBold = () => false, showCaret = () => {}, pictures = () => null }) {
|
|
67
72
|
// ---------- copying ----------
|
|
68
73
|
|
|
69
74
|
// Ctrl+C or Ctrl+X with blocks selected (and no text): the blocks go to the clipboard, and with
|
|
@@ -217,10 +222,14 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
217
222
|
// are (its HTML, a table of one cell, the import unwraps with a divider after it); more a table
|
|
218
223
|
// of them as they were, not as another program's table comes in (made over: a header row, its
|
|
219
224
|
// numbers read).
|
|
220
|
-
|
|
221
|
-
|
|
225
|
+
// The report they were copied from: their pictures are its files.
|
|
226
|
+
const copied = cellsData(data);
|
|
227
|
+
const cells = parseCells(copied || "null");
|
|
228
|
+
const from = cells ? reportIn(copied) : null;
|
|
229
|
+
const whence = from ? { from, same: from === reportOf(document) } : {};
|
|
230
|
+
if (cells?.length === 1 && cells[0].length === 1) return { kind: "rich", html: cells[0][0], own: true, ...whence };
|
|
222
231
|
const table = cells ? checkBlocks([{ type: "table", rows: cells }]) : null;
|
|
223
|
-
if (table) return { kind: "blocks", blocks: table, own: true };
|
|
232
|
+
if (table) return { kind: "blocks", blocks: table, own: true, ...whence };
|
|
224
233
|
// Text of this page copied by the browser (a selection in a block): one line holding the page's
|
|
225
234
|
// chips (a formula, a link shown with its icon, one left empty) is its text again, each chip as
|
|
226
235
|
// it was (pastedLines), not what another program's HTML would make of it.
|
|
@@ -252,6 +261,14 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
252
261
|
// Inline formulas pasted as the page's own (KaTeX loaded: formula/ formulaMaker).
|
|
253
262
|
let formula = null;
|
|
254
263
|
|
|
264
|
+
// A table's cells' pictures pasted (made files of the document's folder first: table/pictures.mjs
|
|
265
|
+
// resolve), what a cell built of them shows (maker).
|
|
266
|
+
let picture = null;
|
|
267
|
+
|
|
268
|
+
// Whether what is pasted was copied in this document (`same`): the keys of tables in it are kept,
|
|
269
|
+
// given anew or taken off by that (own/chart-keys.mjs relinkCopies).
|
|
270
|
+
let here = true;
|
|
271
|
+
|
|
255
272
|
// Images and embeds pasted with an address: filled now they are on the page.
|
|
256
273
|
const fillMedia = (made) => {
|
|
257
274
|
for (const figure of made.flatMap((node) => [node, ...node.querySelectorAll(`[${PASTED_SOURCE}]`)]).filter((node) => node.hasAttribute?.(PASTED_SOURCE))) {
|
|
@@ -267,7 +284,9 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
267
284
|
// anchor.parent, after })): right after the block of `at` (unitElement: a new code block's code stands
|
|
268
285
|
// for the block), whole, where a block pasted there goes (placeFor: the first box out that takes it, a
|
|
269
286
|
// list or quote that does not splitting after the block), one undo step (`put`, handed to the
|
|
270
|
-
// component, which makes the block and fills it).
|
|
287
|
+
// component, which makes the block and fills it, the fill part of that step). An empty block of a kind
|
|
288
|
+
// that says `replacedByFile` (an empty paragraph: notion-lite's pasteFiles removes an empty text block)
|
|
289
|
+
// gives its place to the block instead of staying before it. Returns whether one did.
|
|
271
290
|
const fromFiles = (at, files) => {
|
|
272
291
|
const unit = unitElement(at);
|
|
273
292
|
if (!unit?.closest("main")) return false;
|
|
@@ -277,7 +296,12 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
277
296
|
say(t("这里放不下这种块。"));
|
|
278
297
|
return false;
|
|
279
298
|
}
|
|
280
|
-
|
|
299
|
+
const replaced = replacedByFile(unit.getAttribute("data-ge-unit-kind")) && removableEmpty(unit, unit) && !isFirstLine(unit);
|
|
300
|
+
struct([...new Set([unit.parentElement, ...place.parents])], [], () => {
|
|
301
|
+
const created = placeAfter(place, [block]);
|
|
302
|
+
if (replaced) removalTarget(unit).remove();
|
|
303
|
+
return { touched: [], focus: null, created };
|
|
304
|
+
});
|
|
281
305
|
return true;
|
|
282
306
|
};
|
|
283
307
|
return pageObjects().some((page) => {
|
|
@@ -480,8 +504,8 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
480
504
|
const [first, ...rest] = list;
|
|
481
505
|
const joins = !replace && first.type === "paragraph" && !first.color;
|
|
482
506
|
const placed = asLists(unit, joins ? rest : list);
|
|
483
|
-
const made = placed.map((block) => build(document, block, { formula, mention }));
|
|
484
|
-
relinkCopies(document, made); // a pasted card and its table linked to each other alone
|
|
507
|
+
const made = placed.map((block) => build(document, block, { formula, mention, picture }));
|
|
508
|
+
relinkCopies(document, made, { same: here }); // a pasted card or view and its table linked to each other alone
|
|
485
509
|
prefixCopies(document, made); // a copy's drawing names its own markers
|
|
486
510
|
const place = made.length ? placeAtCaret(unit, made, placed.map(kindOfBlock)) : { anchor: unit, box: unit.parentElement, parents: [unit.parentElement], splits: [] };
|
|
487
511
|
if (!place) {
|
|
@@ -531,8 +555,8 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
531
555
|
return;
|
|
532
556
|
}
|
|
533
557
|
const list = asLists(anchor, pasted);
|
|
534
|
-
const made = list.map((block) => build(document, block, { formula, mention }));
|
|
535
|
-
relinkCopies(document, made); // a pasted card and its table linked to each other alone
|
|
558
|
+
const made = list.map((block) => build(document, block, { formula, mention, picture }));
|
|
559
|
+
relinkCopies(document, made, { same: here }); // a pasted card or view and its table linked to each other alone
|
|
536
560
|
prefixCopies(document, made); // a copy's drawing names its own markers
|
|
537
561
|
const place = placeFor(anchor, list.map(kindOfBlock));
|
|
538
562
|
if (!place) {
|
|
@@ -654,12 +678,19 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
654
678
|
// Picture or other files (a screenshot): an image or a file block after the block, unless they
|
|
655
679
|
// come with the page's own blocks, or Office's or a table's HTML (Excel's picture of its cells).
|
|
656
680
|
const files = data.files;
|
|
681
|
+
const selection = getSelection();
|
|
682
|
+
const range = host && selection.rangeCount && host.contains(selection.getRangeAt(0).startContainer) ? selection.getRangeAt(0).cloneRange() : null;
|
|
657
683
|
if (files?.length > 0 && !ownData(data)) {
|
|
658
684
|
const external = externalContent(data);
|
|
685
|
+
// In a table's cell: pictures of the cell, at the caret (单元格里的图片).
|
|
686
|
+
if (!external.fromOffice && !external.isTable && range && HOSTS[host.getAttribute("data-ge-kind")]?.pictures && pictures() && [...files].some((file) => /^image\//.test(file.type))) {
|
|
687
|
+
const at = rangeOffsets(host, range);
|
|
688
|
+
const made = await pictures().fromFiles(files);
|
|
689
|
+
if (made.length > 0 && host.isConnected) insertNodes(host, rangeAt(host, at), made, { own: true, join: false });
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
659
692
|
if (!external.fromOffice && !external.isTable && fromFiles(host ?? anchor, files)) return;
|
|
660
693
|
}
|
|
661
|
-
const selection = getSelection();
|
|
662
|
-
const range = host && selection.rangeCount && host.contains(selection.getRangeAt(0).startContainer) ? selection.getRangeAt(0).cloneRange() : null;
|
|
663
694
|
if (host && !range) return;
|
|
664
695
|
// In code: the text with its lines.
|
|
665
696
|
if (host && typedAsIs(host, (data.getData("text/plain") || "").replace(/\r\n?/g, "\n"))) return;
|
|
@@ -682,6 +713,7 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
682
713
|
const formulas = content.kind === "blocks" ? holdsFormulas(content.blocks) : content.kind === "rich" && content.html.includes("doc-math-inline");
|
|
683
714
|
if (formulas && (!host || takesFormula(host)) && (await loadKatex())) formula = formulaMaker();
|
|
684
715
|
if (mentionFor) mention = (parts) => mentionFor(parts, Boolean(content.same), content.from);
|
|
716
|
+
here = content.same !== false;
|
|
685
717
|
// An address alone, which HTML that reads as no text beside it does not change.
|
|
686
718
|
const href = content.own && content.kind === "blocks" ? null : bareAddress(data) ?? (content.kind === "plain" ? addressOf(content.text) : null);
|
|
687
719
|
const words = href ? (data.getData("text/plain") || content.text || href).trim() : ""; // read now: the clipboard's data goes with its event
|
|
@@ -689,6 +721,9 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
689
721
|
// writes, by its title, so that no file holds a port. Never a web page's views.
|
|
690
722
|
const page = href && mayBePage(href) && (!host || can(host, "links")) ? await pageLink(href) : null;
|
|
691
723
|
if (page) content = { kind: "rich", html: `<a href="${escapeMarkup(page.href)}">${escapeMarkup(page.title)}</a>` };
|
|
724
|
+
// A table's cells' pictures, made files of the document's folder before the table is (one undo step with it).
|
|
725
|
+
const celled = content.kind === "blocks" ? pictureTexts(content.blocks) : [];
|
|
726
|
+
if (celled.length > 0 && pictures()) picture = pictures().maker(await pictures().resolve(celled, content.from ?? null));
|
|
692
727
|
try {
|
|
693
728
|
if (!host) {
|
|
694
729
|
// With blocks selected: blocks after them (text as paragraphs, Markdown read).
|
|
@@ -725,7 +760,43 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
725
760
|
} finally {
|
|
726
761
|
formula = null;
|
|
727
762
|
mention = null;
|
|
763
|
+
picture = null;
|
|
764
|
+
here = true;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* The clipboard as rows of cells for a paste into a table's cells (table/cells.mjs: the caret in a
|
|
771
|
+
* cell, or cells selected), each cell its inline HTML: { rows, from } (`from`: the report the
|
|
772
|
+
* page's own was copied from, whose files its pictures are), or null when it holds nothing. In
|
|
773
|
+
* Notion's order (872952): the page's cells (the table tools' copy), its text or blocks (ownCells);
|
|
774
|
+
* another program's table, HTML that is one table and no words outside it (Excel, Google Sheets,
|
|
775
|
+
* Feishu, Notion, Yuque, a web page's: import/html.mjs tableRows), its cells with their marks, links,
|
|
776
|
+
* colors as the import maps them, line breaks and pictures, a table of one column too; a Markdown
|
|
777
|
+
* table (its text alone: Yuque's Markdown, a .md file's), read as a paste's Markdown with its cells'
|
|
778
|
+
* pictures; tab-separated lines (Excel's and Google Sheets' text), two lines or more of as many cells,
|
|
779
|
+
* two or more, a cell in quotes holding tabs, line breaks and "" a quote; else its text, one cell
|
|
780
|
+
* holding its lines.
|
|
781
|
+
*/
|
|
782
|
+
function cellsOf(data) {
|
|
783
|
+
const copied = cellsData(data);
|
|
784
|
+
const cells = parseCells(copied || "null");
|
|
785
|
+
if (cells) return { rows: cells, from: reportIn(copied) };
|
|
786
|
+
const own = ownCells(data);
|
|
787
|
+
if (own) return { rows: own, from: origin(ownData(data)).from };
|
|
788
|
+
const external = externalContent(data);
|
|
789
|
+
const table = external.html ? tableRows(parseClipboardHTML(external.html), { colors: external.colors }) : null;
|
|
790
|
+
if (table?.length) return { rows: table.map((row) => row.map((cell) => richHtml(cell, { pictures: true }))), from: null };
|
|
791
|
+
const text = external.text.replace(/\n+$/, "");
|
|
792
|
+
if (/^\s*\|/m.test(text)) {
|
|
793
|
+
const made = toBlocks(fromMarkdown(text), null, HELD);
|
|
794
|
+
if (made.length === 1 && Array.isArray(made[0].rows)) return { rows: made[0].rows, from: null }; // a table alone
|
|
728
795
|
}
|
|
796
|
+
const lines = tabbed(text);
|
|
797
|
+
const html = (words) => escapeText(words).replace(/\n/g, "<br>");
|
|
798
|
+
if (lines) return { rows: lines.map((row) => row.map(html)), from: null };
|
|
799
|
+
return text.trim() ? { rows: [[html(text)]], from: null } : null;
|
|
729
800
|
}
|
|
730
801
|
|
|
731
802
|
/**
|
|
@@ -747,7 +818,54 @@ export function createClipboard({ editing, blocks, struct, recordText, say, load
|
|
|
747
818
|
return html ? [[html]] : null;
|
|
748
819
|
}
|
|
749
820
|
|
|
750
|
-
return { copy, copyAcross, copyBlocks,
|
|
821
|
+
return { copy, copyAcross, copyBlocks, cellsOf, paste, blocksAt };
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// The inline HTML among described blocks (`value`, at any depth) that holds pictures: a table's cells' (单元格里的图片).
|
|
825
|
+
function pictureTexts(value, found = []) {
|
|
826
|
+
if (typeof value === "string") {
|
|
827
|
+
if (value.includes("<img")) found.push(value);
|
|
828
|
+
} else if (Array.isArray(value)) value.forEach((each) => pictureTexts(each, found));
|
|
829
|
+
else if (value && typeof value === "object") Object.values(value).forEach((each) => pictureTexts(each, found));
|
|
830
|
+
return found;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
// The report the table tools' copy of cells says it was copied from, or null.
|
|
834
|
+
function reportIn(copied) {
|
|
835
|
+
try {
|
|
836
|
+
const from = JSON.parse(copied)?.report;
|
|
837
|
+
return typeof from === "string" ? from : null;
|
|
838
|
+
} catch {
|
|
839
|
+
return null;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Tab-separated lines as rows of cells (Excel's and Google Sheets' text, Notion's rule, 872952: two
|
|
845
|
+
* lines or more, each of as many cells, two or more), or null. A cell starting with a quote is in
|
|
846
|
+
* quotes, holding tabs and line breaks, "" a quote in it (Excel's quoting).
|
|
847
|
+
*/
|
|
848
|
+
export function tabbed(text) {
|
|
849
|
+
if (!text.includes("\t")) return null;
|
|
850
|
+
const rows = [[]];
|
|
851
|
+
let cell = "";
|
|
852
|
+
let quoted = false;
|
|
853
|
+
for (let i = 0; i < text.length; i++) {
|
|
854
|
+
const character = text[i];
|
|
855
|
+
if (quoted) {
|
|
856
|
+
if (character !== '"') cell += character;
|
|
857
|
+
else if (text[i + 1] === '"') cell += text[++i];
|
|
858
|
+
else quoted = false;
|
|
859
|
+
} else if (character === '"' && cell === "") quoted = true;
|
|
860
|
+
else if (character === "\t" || character === "\n") {
|
|
861
|
+
rows.at(-1).push(cell);
|
|
862
|
+
cell = "";
|
|
863
|
+
if (character === "\n") rows.push([]);
|
|
864
|
+
} else cell += character;
|
|
865
|
+
}
|
|
866
|
+
rows.at(-1).push(cell);
|
|
867
|
+
const width = rows[0].length;
|
|
868
|
+
return rows.length > 1 && width > 1 && rows.every((row) => row.length === width) ? rows : null;
|
|
751
869
|
}
|
|
752
870
|
|
|
753
871
|
// What a field of plain text takes of the clipboard, as one line: the text of the page's own blocks
|
|
@@ -2,9 +2,8 @@ import { escapeText } from "../../../../shared/escape.mjs";
|
|
|
2
2
|
import { heldIn, newContainer, newHost, pastedLines } from "../../core.mjs";
|
|
3
3
|
import { pageBuild } from "../../../components/builders.mjs";
|
|
4
4
|
import { BLOCK_TYPES, COPIED_AS_ITSELF, HOLDS_ONE, TEXT_TYPES, TOGGLES, UNSAID, accepts, clipboardHooks, clipboardOf, isLead, sizeValue } from "../../../components/registry.mjs";
|
|
5
|
-
import { BLOCK_COLORS } from "../../../components/colors.mjs";
|
|
6
5
|
import { MAX_CELL_HTML } from "../../../components/table/index.mjs";
|
|
7
|
-
import { copied, copyOf
|
|
6
|
+
import { BLOCK_LOOKS, copied, copyOf } from "./describe.mjs";
|
|
8
7
|
import { imageSource, kindOfBlock, webPage } from "./rules.mjs";
|
|
9
8
|
|
|
10
9
|
// Described blocks (describe.mjs and selection.mjs, and import/to-blocks.mjs for other programs' content) made (build),
|
|
@@ -42,7 +41,7 @@ export function checkBlocks(blocks) {
|
|
|
42
41
|
const { type } = block;
|
|
43
42
|
const clip = clipboardOf(type);
|
|
44
43
|
if (box && !accepts(box, kindOfBlock(block)) && clip.pastedIn !== box) return false;
|
|
45
|
-
if (block.color !== undefined && (typeof block.color !== "string" || !block.color.split(" ").every((name) =>
|
|
44
|
+
if (block.color !== undefined && (typeof block.color !== "string" || !block.color.split(" ").every((name) => BLOCK_LOOKS.includes(name)))) return false;
|
|
46
45
|
if (TEXT_TYPES.has(type)) return string(block.html);
|
|
47
46
|
if (type === "copy") return COPIES.has(block.kind) && Number.isInteger(block.unit) && [block.report, block.text, block.html].every((value) => typeof value === "string")
|
|
48
47
|
&& (block.data === undefined || (Boolean(clipboardOf(block.data?.type).data) && valid(block.data)));
|
|
@@ -113,14 +112,14 @@ export function parseText(data) {
|
|
|
113
112
|
/**
|
|
114
113
|
* Inline HTML as nodes of the format bar's marks only, its lines with <br> between them; formulas
|
|
115
114
|
* of other pages made the page's own by `formula(tex)` where given, links shown with their icon by
|
|
116
|
-
* `mention(parts)` (pastedLines).
|
|
115
|
+
* `mention(parts)`, pictures by `picture(img)` (a table cell's: pastedLines).
|
|
117
116
|
*/
|
|
118
|
-
function inline(doc, html, { formula = null, mention = null } = {}) {
|
|
119
|
-
return pastedLines(doc, html, { formula, mention }).flatMap((line, index) => (index > 0 ? [doc.createElement("br"), ...line] : line));
|
|
117
|
+
function inline(doc, html, { formula = null, mention = null, picture = null } = {}) {
|
|
118
|
+
return pastedLines(doc, html, { formula, mention, picture }).flatMap((line, index) => (index > 0 ? [doc.createElement("br"), ...line] : line));
|
|
120
119
|
}
|
|
121
120
|
|
|
122
121
|
|
|
123
|
-
// A block's colors (`color`: their classes, one of each family), those its kind takes (TOGGLES).
|
|
122
|
+
// A block's colors (`color`: their classes, one of each family, and a text block's alignment and indent), those its kind takes (TOGGLES).
|
|
124
123
|
function colored(element, block) {
|
|
125
124
|
for (const name of block.color?.split(" ") ?? []) if (TOGGLES[element.getAttribute("data-ge-unit-kind")]?.includes(name)) element.classList.add(name);
|
|
126
125
|
return element;
|
|
@@ -129,7 +128,8 @@ function colored(element, block) {
|
|
|
129
128
|
/**
|
|
130
129
|
* A new block of the page from a described one (checked). `formula(tex)`: an inline formula chip of
|
|
131
130
|
* the page (none: their TeX as text); `mention(parts)`: a link shown with its icon (none: a link of
|
|
132
|
-
* its title)
|
|
131
|
+
* its title); `picture(img)`: a table cell's picture (none: nothing; `what.inline(html, { pictures:
|
|
132
|
+
* true })` asks for it, a cell's text alone holding pictures). What each type adds is its definition's: `clipboard.build`, or the `build` of its
|
|
133
133
|
* page.mjs (builders.mjs); a container is filled with its blocks, a text type with its inline HTML.
|
|
134
134
|
*/
|
|
135
135
|
export function build(doc, block, options = {}) {
|
|
@@ -144,18 +144,17 @@ export function build(doc, block, options = {}) {
|
|
|
144
144
|
copy.setAttribute("data-ge-unit-kind", block.kind);
|
|
145
145
|
return copy;
|
|
146
146
|
}
|
|
147
|
-
// Elsewhere: a new one of its data (pasteBlocks checked it has some), the key a chart
|
|
148
|
-
// table by
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return build(doc, data, options);
|
|
147
|
+
// Elsewhere: a new one of its data (pasteBlocks checked it has some), with the key a chart or a
|
|
148
|
+
// view reads a table by, which the paste then keeps, gives anew or takes off, in another document
|
|
149
|
+
// too (chart-keys.mjs relinkCopies: a table pasted there alone loses it, one with its reader is a pair).
|
|
150
|
+
return build(doc, block.data, options);
|
|
152
151
|
}
|
|
153
152
|
const what = {
|
|
154
153
|
doc,
|
|
155
154
|
block,
|
|
156
155
|
host: (type = block.type) => newHost(doc, type),
|
|
157
156
|
box: (type = block.type) => newContainer(doc, type),
|
|
158
|
-
inline: (html) => inline(doc, html, options),
|
|
157
|
+
inline: (html, { pictures = false } = {}) => inline(doc, html, pictures ? options : { ...options, picture: null }),
|
|
159
158
|
inner: (blocks) => blocks.map((each) => build(doc, each, options)),
|
|
160
159
|
one: (each) => build(doc, each, options),
|
|
161
160
|
colored: (element) => colored(element, block),
|
|
@@ -1,53 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CHART_SOURCE, TABLE_READERS, nextChartKey } from "../../../../shared/table-chart.mjs";
|
|
2
2
|
import { COPY_KEYS } from "../../../components/figure/index.mjs";
|
|
3
3
|
|
|
4
|
-
// The keys of
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
4
|
+
// The keys of tables in what a paste made (docs/editor.md, "Copying blocks"): a chart drawn from a
|
|
5
|
+
// table and a view of one (an instance of a custom block that reads tables) name the table by a key
|
|
6
|
+
// (src/shared/table-chart.mjs: TABLE_READERS, a reader), and what a paste makes of a card, a view or a
|
|
7
|
+
// table carries its original's: a copy of it (data-ge-type="copy"), what a clipboard carried of a view
|
|
8
|
+
// (its markup), or a table made anew of its data (components/table tableData `chart`: one cut, one whose
|
|
9
|
+
// original is gone or changed since the copy, one of another document). The rules, by key:
|
|
10
|
+
// - a reader and a table pasted together are a pair of their own: both take a new key, the first of
|
|
11
|
+
// t1, t2 … the page does not hold, so that two pairs never cross (a table copied with its board
|
|
12
|
+
// is a board of its own), in its document or another;
|
|
13
|
+
// - a table pasted without its reader keeps its key while no table on the page carries it (a cut
|
|
14
|
+
// table put back, one whose original was deleted: the card draws it again); otherwise, and in
|
|
15
|
+
// another document, it is a table alone, its key taken off (a reader reads the first table of its
|
|
16
|
+
// key, which could be it; another document's readers are no readers of it);
|
|
17
|
+
// - a reader pasted alone keeps its key in its document: it reads the same table as its original,
|
|
18
|
+
// both reading it; in another document it takes it off (`same` false: the clipboard's document is
|
|
19
|
+
// not this one), as the table it read is not there and one there carrying the key is no table of
|
|
20
|
+
// its (keys are t1, t2 … in every document): a view of no table, never one reading and changing that.
|
|
15
21
|
// A copy's new keys ride on it (COPY_KEYS) to the server, which writes them into the copy's source
|
|
16
22
|
// (core.mjs nodeOf: { copy, keys }; source/text.mjs copiedSource); a table made anew is written with
|
|
17
|
-
// its own
|
|
18
|
-
// says what it changed (page/commit.mjs).
|
|
23
|
+
// its own, a view with its own or none (components/installed extras `from`). The commit makes sure of
|
|
24
|
+
// them against the file as it is then (source/chart-keys.mjs) and says what it changed (page/commit.mjs).
|
|
19
25
|
|
|
20
26
|
// What carries a key in `root` and in what its templates hold.
|
|
27
|
+
const NAMES = [CHART_SOURCE, ...TABLE_READERS];
|
|
28
|
+
const CARRIES = NAMES.map((name) => `[${name}]`).join(", ");
|
|
21
29
|
const carriers = (root) => [
|
|
22
|
-
...(root.matches?.(
|
|
23
|
-
...root.querySelectorAll(
|
|
30
|
+
...(root.matches?.(CARRIES) ? [root] : []),
|
|
31
|
+
...root.querySelectorAll(CARRIES),
|
|
24
32
|
...[...root.querySelectorAll("template")].flatMap((template) => carriers(template.content)),
|
|
25
33
|
];
|
|
26
|
-
const keysOf = (node) =>
|
|
34
|
+
const keysOf = (node) => NAMES.map((name) => node.getAttribute(name)).filter((key) => key !== null);
|
|
35
|
+
const readerKey = (node) => TABLE_READERS.map((name) => node.getAttribute(name)).find((key) => key !== null) ?? null;
|
|
27
36
|
|
|
28
|
-
/**
|
|
29
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The blocks a paste made (`made`, not on the page yet), the keys of their cards, views and tables made
|
|
39
|
+
* their own; `same`: the clipboard's document is this one (clipboard/index.mjs origin).
|
|
40
|
+
*/
|
|
41
|
+
export function relinkCopies(doc, made, { same = true } = {}) {
|
|
30
42
|
const inMade = made.flatMap(carriers);
|
|
31
|
-
const hosts = inMade.filter((node) => node
|
|
43
|
+
const hosts = inMade.filter((node) => readerKey(node) !== null);
|
|
32
44
|
const frames = inMade.filter((node) => node.hasAttribute(CHART_SOURCE));
|
|
33
|
-
if (frames.length === 0) return;
|
|
45
|
+
if (frames.length === 0 && (same || hosts.length === 0)) return;
|
|
34
46
|
const onPage = carriers(doc);
|
|
35
47
|
const taken = new Set([...onPage, ...inMade].flatMap(keysOf));
|
|
36
|
-
const renamed = new Map(); // a key -> its new value, null: taken off
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
const renamed = new Map(); // a key -> its new value, null: taken off
|
|
49
|
+
const tabled = new Set(frames.map((frame) => frame.getAttribute(CHART_SOURCE)));
|
|
50
|
+
for (const key of tabled) {
|
|
51
|
+
if (hosts.some((host) => readerKey(host) === key)) {
|
|
39
52
|
const next = nextChartKey(taken);
|
|
40
53
|
taken.add(next);
|
|
41
54
|
renamed.set(key, next);
|
|
42
|
-
} else if (onPage.some((node) => node.getAttribute(CHART_SOURCE) === key)) renamed.set(key, null);
|
|
55
|
+
} else if (!same || onPage.some((node) => node.getAttribute(CHART_SOURCE) === key)) renamed.set(key, null);
|
|
43
56
|
}
|
|
57
|
+
if (!same) for (const host of hosts) if (!tabled.has(readerKey(host))) renamed.set(readerKey(host), null);
|
|
44
58
|
const sent = new Map(); // a copy -> its keys { old: new | null }
|
|
45
|
-
for (const [name, nodes] of [[
|
|
59
|
+
for (const [name, nodes] of [...TABLE_READERS.map((reader) => [reader, hosts]), [CHART_SOURCE, frames]]) {
|
|
46
60
|
for (const node of nodes) {
|
|
47
61
|
const key = node.getAttribute(name);
|
|
48
|
-
if (!renamed.has(key)) continue;
|
|
62
|
+
if (key === null || !renamed.has(key)) continue;
|
|
49
63
|
const next = renamed.get(key);
|
|
50
|
-
if (next === null && name === CHART_DATA) continue; // a card keeps the key of a table pasted alone
|
|
51
64
|
if (next === null) node.removeAttribute(name);
|
|
52
65
|
else node.setAttribute(name, next);
|
|
53
66
|
const copy = node.closest('[data-ge-type="copy"]');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isHost, nestedBlocks, serializeInner, unitsOf } from "../../core.mjs";
|
|
2
2
|
import { BLOCK_TYPES, COPIED_AS_ITSELF, COPY_KEEPS, TEXT_TYPES, askClipboard, clipboardOf, sizeValue, unitClipboard } from "../../../components/registry.mjs";
|
|
3
|
+
import { ALIGN_TOGGLES, TEXT_BLOCKS } from "../../../components/align.mjs";
|
|
3
4
|
import { BLOCK_COLORS } from "../../../components/colors.mjs";
|
|
4
5
|
import { containerType, typeOf } from "../../convert.mjs";
|
|
5
6
|
import { pageOfType, pageOfUnit } from "../../page-objects.mjs";
|
|
@@ -72,8 +73,11 @@ export function copied(doc, block) {
|
|
|
72
73
|
return (typeof block.data?.html === "string" ? copy.outerHTML === block.html : copy.textContent === block.text) ? unit : null;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
/**
|
|
76
|
-
export const
|
|
76
|
+
/** The classes a block's copy carries as its `color`: its colors, and a paragraph's or a heading's alignment and indent. */
|
|
77
|
+
export const BLOCK_LOOKS = [...BLOCK_COLORS, ...ALIGN_TOGGLES];
|
|
78
|
+
|
|
79
|
+
/** A block's colors, and a text block's alignment and indent (their classes, space-separated), or null. */
|
|
80
|
+
export const colorOf = (node) => (node.matches?.(TEXT_BLOCKS) ? BLOCK_LOOKS : BLOCK_COLORS).filter((name) => node.classList.contains(name)).join(" ") || null;
|
|
77
81
|
|
|
78
82
|
/** The type a text block is copied as: its own, the type of the text blocks of what wraps it (a quote's paragraph), or null (code, whose text is no text block's). */
|
|
79
83
|
export function copiedType(host) {
|
|
@@ -124,7 +124,7 @@ export function describeAcross(range, { texts, wholes }) {
|
|
|
124
124
|
const html = selectedHtml(host, pieces.get(host));
|
|
125
125
|
const part = askClipboard("piece", host, html, what);
|
|
126
126
|
if (part) return part;
|
|
127
|
-
const type = host.parentElement?.hasAttribute("data-ge-box") ? copiedType(host) : null;
|
|
127
|
+
const type = host.parentElement?.hasAttribute("data-ge-box") && (host.getAttribute("data-ge-kind") ?? "flow") === "flow" ? copiedType(host) : null;
|
|
128
128
|
const color = colorOf(host);
|
|
129
129
|
return { type: type ?? "paragraph", html, ...(color ? { color } : {}) };
|
|
130
130
|
};
|