@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
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { IN_LAYER } from "../../../shared/layers.mjs";
|
|
2
|
+
import { UNIT, can, isEmpty, isHost, newHost, removalTarget, takeOut, withLeads } from "../core.mjs";
|
|
3
|
+
import { atEdge, caretAt, hosts } from "../caret.mjs";
|
|
4
|
+
import { caretBeside } from "../beside.mjs";
|
|
5
|
+
import { contentOf, extentOf } from "../geometry.mjs";
|
|
6
|
+
import { FOLLOW, task } from "../frames.mjs";
|
|
7
|
+
import { layerOf } from "../overlay-layer.mjs";
|
|
8
|
+
import { onSettle, own } from "../overlays.mjs";
|
|
9
|
+
import { addStyle, element } from "../ui.mjs";
|
|
10
|
+
import { alignClass, shownAlign } from "../align.mjs";
|
|
11
|
+
import { accepts, texOnly } from "../../components/registry.mjs";
|
|
12
|
+
|
|
13
|
+
// The caret after a block (docs/editor.md, "The caret after a block"; the user's, 2026-11-09): a click
|
|
14
|
+
// right of a block that is no text of its own (a picture, a table, a code block, a callout, a divider, a
|
|
15
|
+
// card, an instance of a custom block, a row of columns…: insert/ boxedBeside, beside.mjs) puts a caret
|
|
16
|
+
// at its bottom right, a blinking one, as the browser draws in text. Neither notion-lite nor
|
|
17
|
+
// feishu-lite has one (Gallery's click there selected the block before); this is the plainest rule.
|
|
18
|
+
// The text right below such a block comes back to it (the user's, 2026-11-09: Backspace there went
|
|
19
|
+
// into the block, a table's last cell, a callout's box, or past it, a picture passed over): Backspace
|
|
20
|
+
// at the start of the text block right after it (typing/, after the block's own keys and its
|
|
21
|
+
// alignment), and ← or ↑ there, put this caret after it, an empty block left going as it does
|
|
22
|
+
// (one undo step), one with words staying (no step); a second Backspace is this caret's.
|
|
23
|
+
//
|
|
24
|
+
// Backspace, Delete the block becomes an empty paragraph in its place, whatever follows it (the
|
|
25
|
+
// user's, 2026-11-09; the box it stands in taking one), aligned as the block was
|
|
26
|
+
// shown (a picture centred: centred, align.mjs shownAlign), the caret in it; one
|
|
27
|
+
// more Backspace takes that alignment off (typing/: align.mjs unalign) before
|
|
28
|
+
// anything else
|
|
29
|
+
// Enter an empty paragraph right after it, the caret in it
|
|
30
|
+
// a key typed a paragraph right after it holding what was typed, the caret at its end (an
|
|
31
|
+
// input method composes in the caret, its words going there once it ends)
|
|
32
|
+
// ↑ ←, ↓ → the text before it (its own last text: a table's last cell, a picture's caption),
|
|
33
|
+
// or after it, at its end or start; none there, the caret stays
|
|
34
|
+
// Esc the block selected
|
|
35
|
+
// Ctrl+V a paste goes into a new paragraph after it
|
|
36
|
+
//
|
|
37
|
+
// Each change is one undo step, the words typed going with the paragraph they made (history.mjs
|
|
38
|
+
// typedInto), and undo puts this caret back after the block. The caret is an element of the editor's
|
|
39
|
+
// layer (overlay-layer.mjs: the page's, a dialog's), never the report's: an empty field that takes the
|
|
40
|
+
// focus, in the body text's font, at the block's right edge with its bottom on the block's, kept there
|
|
41
|
+
// as the page moves (a task of frames.mjs); it goes with the focus, its block, or a press elsewhere.
|
|
42
|
+
|
|
43
|
+
const STYLE = `
|
|
44
|
+
.ge-after { z-index: ${IN_LAYER.frame}; display: inline-block; min-width: 2px; margin: 0; padding: 0; border: 0; outline: none; white-space: pre; background: transparent; color: var(--doc-text, currentColor); caret-color: var(--doc-text, currentColor); pointer-events: none; }
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* struct(parents, touched, mutate, options): the editor's undoable structural change (history.mjs).
|
|
49
|
+
* blocks(): the block tools (blocks.mjs). keepText(unit): why a block may not go. removeBlocks(units):
|
|
50
|
+
* the blocks deleted as the selected ones are (where no paragraph can take its place). say: the status
|
|
51
|
+
* line. undo(), redo(): the editor's.
|
|
52
|
+
*/
|
|
53
|
+
export function createAfter({ struct, blocks, keepText, removeBlocks, say, undo, redo }) {
|
|
54
|
+
addStyle(STYLE);
|
|
55
|
+
const node = element("span", { class: "ge-after", contenteditable: "true", spellcheck: "false", "data-doc-dev": "" });
|
|
56
|
+
let at = null; // the block the caret stands after
|
|
57
|
+
|
|
58
|
+
const follow = task("after", {
|
|
59
|
+
run() {
|
|
60
|
+
if (!at) return false;
|
|
61
|
+
if (!at.isConnected || at.getClientRects().length === 0) {
|
|
62
|
+
hide();
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
draw();
|
|
66
|
+
return FOLLOW;
|
|
67
|
+
},
|
|
68
|
+
fail: () => hide(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// At the block's right edge, its bottom on the block's: as tall as a line of the body text of the box it stands in.
|
|
72
|
+
function draw() {
|
|
73
|
+
const rect = extentOf(at);
|
|
74
|
+
if (!rect) return;
|
|
75
|
+
const layer = layerOf(at);
|
|
76
|
+
if (node.parentNode !== layer) layer.append(node);
|
|
77
|
+
const origin = layer.getBoundingClientRect();
|
|
78
|
+
const height = node.offsetHeight || 24;
|
|
79
|
+
node.style.transform = `translate(${Math.round(rect.right + 1 - origin.left)}px, ${Math.round(rect.bottom - height - origin.top)}px)`;
|
|
80
|
+
own(node, "after", { owner: at, alive: () => Boolean(at) && at.isConnected });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The caret after block `unit`, focused. */
|
|
84
|
+
function place(unit) {
|
|
85
|
+
if (!unit?.isConnected) return;
|
|
86
|
+
blocks().clear();
|
|
87
|
+
at = unit;
|
|
88
|
+
// The body text's font of the box it stands in (what a paragraph there is typed in).
|
|
89
|
+
const style = getComputedStyle(unit.parentElement ?? document.body);
|
|
90
|
+
const size = parseFloat(style.fontSize) || 16;
|
|
91
|
+
const line = parseFloat(style.lineHeight) || size * 1.5;
|
|
92
|
+
Object.assign(node.style, { fontFamily: style.fontFamily, fontSize: `${size}px`, lineHeight: `${line}px`, height: `${line}px` });
|
|
93
|
+
node.textContent = "";
|
|
94
|
+
draw();
|
|
95
|
+
node.focus({ preventScroll: true });
|
|
96
|
+
const range = document.createRange();
|
|
97
|
+
range.setStart(node, 0);
|
|
98
|
+
getSelection().removeAllRanges();
|
|
99
|
+
getSelection().addRange(range);
|
|
100
|
+
follow.wake();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function hide() {
|
|
104
|
+
at = null;
|
|
105
|
+
node.textContent = "";
|
|
106
|
+
node.remove();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// What the caret stands after, the caret taken away (the focus going where the change puts it).
|
|
110
|
+
function take() {
|
|
111
|
+
const unit = at;
|
|
112
|
+
at = null;
|
|
113
|
+
node.textContent = "";
|
|
114
|
+
if (document.activeElement === node) node.blur();
|
|
115
|
+
node.remove();
|
|
116
|
+
return unit;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const takesParagraph = (box) => Boolean(box) && accepts(box.getAttribute("data-ge-box-kind") ?? "flow", "paragraph");
|
|
120
|
+
|
|
121
|
+
// A paragraph right after the block (`text` in it: what was typed), the caret at its end; one undo
|
|
122
|
+
// step, the words typed on into it with it (typedInto), undo putting this caret back after the block.
|
|
123
|
+
function paragraphAfter(text = "") {
|
|
124
|
+
const unit = at;
|
|
125
|
+
const box = unit?.parentElement;
|
|
126
|
+
if (!takesParagraph(box)) return null;
|
|
127
|
+
take();
|
|
128
|
+
const paragraph = newHost(document, "paragraph");
|
|
129
|
+
if (text) paragraph.textContent = text;
|
|
130
|
+
struct([box], [], () => {
|
|
131
|
+
unit.after(paragraph);
|
|
132
|
+
return { touched: [paragraph], focus: paragraph, settle: (backwards) => backwards && queueMicrotask(() => place(unit)) };
|
|
133
|
+
}, { typedInto: text ? paragraph : null });
|
|
134
|
+
caretAt(paragraph, "end");
|
|
135
|
+
return paragraph;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Backspace, Delete: the block becomes an empty paragraph in its place, aligned as it was shown, the
|
|
139
|
+
// caret in it, whatever follows it (the user's, 2026-11-09: it was the text after it that took the
|
|
140
|
+
// caret, no paragraph made); where its box takes none, it is deleted as a selected block is. One undo
|
|
141
|
+
// step, which puts this caret back after the block.
|
|
142
|
+
function remove() {
|
|
143
|
+
const unit = at;
|
|
144
|
+
const reason = keepText(unit);
|
|
145
|
+
if (reason) {
|
|
146
|
+
say(reason, "note", 6000);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const box = unit.parentElement;
|
|
150
|
+
if (!takesParagraph(box)) {
|
|
151
|
+
take();
|
|
152
|
+
removeBlocks([unit]);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const parts = withLeads(unit);
|
|
156
|
+
const area = contentOf(box.getBoundingClientRect(), getComputedStyle(box));
|
|
157
|
+
const aligned = alignClass(shownAlign(unit.getBoundingClientRect(), area));
|
|
158
|
+
take();
|
|
159
|
+
const paragraph = newHost(document, "paragraph");
|
|
160
|
+
if (aligned) paragraph.classList.add(aligned);
|
|
161
|
+
struct([box], [], () => {
|
|
162
|
+
parts[0].before(paragraph);
|
|
163
|
+
parts.forEach((part) => part.remove());
|
|
164
|
+
return { touched: [paragraph], focus: paragraph, settle: (backwards) => backwards && queueMicrotask(() => place(unit)) };
|
|
165
|
+
});
|
|
166
|
+
caretAt(paragraph, "start");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// The block of no text right above text block `host` (one a click right of puts this caret after:
|
|
170
|
+
// beside.mjs caretBeside), shown: the block before it in its box, before a list's first item the one
|
|
171
|
+
// before the list; or null. `host` is the first text of its block (a paragraph, a heading, a list's
|
|
172
|
+
// first item), never a table's cell or a code block's text.
|
|
173
|
+
function above(host) {
|
|
174
|
+
if (!isHost(host) || texOnly(host) || !host.matches(UNIT)) return null;
|
|
175
|
+
let node = host;
|
|
176
|
+
while (!withLeads(node)[0].previousElementSibling && /^(UL|OL)$/.test(node.parentElement?.tagName ?? "") && node.parentElement.matches(UNIT)) node = node.parentElement;
|
|
177
|
+
const block = withLeads(node)[0].previousElementSibling;
|
|
178
|
+
return caretBeside(block) && block.parentElement?.hasAttribute("data-ge-box") && block.getClientRects().length > 0 && block.checkVisibility?.() !== false ? block : null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Backspace at the start of text block `host` (typing/, after its own keys): the caret after the
|
|
183
|
+
* block of no text right above it, `host` going when it is empty (one undo step, undo putting the
|
|
184
|
+
* caret back in it, redo this caret after the block), staying when it holds words. Whether it did.
|
|
185
|
+
*/
|
|
186
|
+
function back(host) {
|
|
187
|
+
const unit = above(host);
|
|
188
|
+
if (!unit) return false;
|
|
189
|
+
const node = isEmpty(host) && can(host, "remove") ? removalTarget(host) : null;
|
|
190
|
+
if (node && !keepText(node)) {
|
|
191
|
+
struct([node.parentNode], [host], () => {
|
|
192
|
+
takeOut(node);
|
|
193
|
+
return { touched: [], focus: null, settle: (backwards) => !backwards && queueMicrotask(() => place(unit)) };
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
place(unit);
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** ← or ↑ with the caret at the start of text block `host` (editor.mjs): the caret after the block above it, as back(). Whether it did. */
|
|
201
|
+
function up(host, key) {
|
|
202
|
+
if (key !== "ArrowLeft" && key !== "ArrowUp") return false;
|
|
203
|
+
const selection = getSelection();
|
|
204
|
+
if (!selection.rangeCount || !selection.isCollapsed || !atEdge(host, false)) return false;
|
|
205
|
+
const unit = above(host);
|
|
206
|
+
if (!unit) return false;
|
|
207
|
+
place(unit);
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ↑ ←: the text before the caret (the block's own last, or the one before it), at its end; ↓ →: the
|
|
212
|
+
// first after it, at its start. Formula blocks are passed over (no text to type in).
|
|
213
|
+
function leave(back) {
|
|
214
|
+
const unit = at;
|
|
215
|
+
const list = hosts().filter((host) => !texOnly(host));
|
|
216
|
+
const before = (host) => unit.contains(host) || Boolean(host.compareDocumentPosition(unit) & Node.DOCUMENT_POSITION_FOLLOWING);
|
|
217
|
+
const target = back ? list.filter(before).at(-1) : list.find((host) => !before(host));
|
|
218
|
+
if (!target) return;
|
|
219
|
+
take();
|
|
220
|
+
caretAt(target, back ? "end" : "start");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** A key with the caret after a block (editor.mjs onKeydown, first): whether it was this caret's. */
|
|
224
|
+
function key(event) {
|
|
225
|
+
if (!at || event.target !== node) return false;
|
|
226
|
+
if (event.isComposing || event.keyCode === 229) return true; // an input method's: composed here, put in at its end
|
|
227
|
+
const mod = event.ctrlKey || event.metaKey;
|
|
228
|
+
const name = event.key.toLowerCase();
|
|
229
|
+
if (mod && !event.altKey && (name === "z" || name === "y")) {
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
take();
|
|
232
|
+
name === "y" || event.shiftKey ? redo() : undo();
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
if (mod && !event.altKey && !event.shiftKey && name === "v") {
|
|
236
|
+
paragraphAfter(); // the paste that follows goes into it
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
if (mod && name === "s") return false; // saving, the editor's
|
|
240
|
+
if (event.key === "Backspace" || event.key === "Delete") remove();
|
|
241
|
+
else if (event.key === "Enter") paragraphAfter();
|
|
242
|
+
else if (event.key === "Escape") {
|
|
243
|
+
const unit = take();
|
|
244
|
+
blocks().select(unit);
|
|
245
|
+
} else if (event.key.startsWith("Arrow") && !mod && !event.altKey) leave(event.key === "ArrowUp" || event.key === "ArrowLeft");
|
|
246
|
+
else if (!mod && event.key.length === 1) return true; // a character: typed here, put in a paragraph (input)
|
|
247
|
+
else if (mod || event.key === "Tab") event.preventDefault(); // nothing to format or move: the keys do nothing here
|
|
248
|
+
else return true;
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// What was typed (a key's character, an input method's words once it ends): a paragraph after the
|
|
254
|
+
// block holding it.
|
|
255
|
+
node.addEventListener("input", (event) => {
|
|
256
|
+
if (event.isComposing || !at) return;
|
|
257
|
+
const text = node.textContent;
|
|
258
|
+
node.textContent = ""; // nothing stays in the field, wherever the words go (a box that takes no paragraph: nowhere)
|
|
259
|
+
if (text) paragraphAfter(text);
|
|
260
|
+
});
|
|
261
|
+
node.addEventListener("compositionend", (event) => {
|
|
262
|
+
if (!at) return;
|
|
263
|
+
const text = event.data || node.textContent;
|
|
264
|
+
node.textContent = "";
|
|
265
|
+
if (text) paragraphAfter(text);
|
|
266
|
+
});
|
|
267
|
+
// The focus gone elsewhere on the page (a press, a key that moved it): the caret goes. The window
|
|
268
|
+
// losing it keeps it, as the browser's own caret is kept.
|
|
269
|
+
node.addEventListener("blur", () => {
|
|
270
|
+
if (at && document.hasFocus()) hide();
|
|
271
|
+
});
|
|
272
|
+
// Its block taken off the page (an Agent's write, undo): it goes at once.
|
|
273
|
+
onSettle(() => {
|
|
274
|
+
if (at && !at.isConnected) hide();
|
|
275
|
+
});
|
|
276
|
+
globalThis.__galleryAfter = () => (at && document.activeElement === node ? at : null); // the block the caret stands after (the browser tests)
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
place,
|
|
280
|
+
key,
|
|
281
|
+
back,
|
|
282
|
+
up,
|
|
283
|
+
/** The block the caret stands after, or null. */
|
|
284
|
+
get block() { return at; },
|
|
285
|
+
/** The editor's UI nodes to keep in the top layer when a modal dialog opens. */
|
|
286
|
+
get nodes() { return node.isConnected ? [node] : []; },
|
|
287
|
+
};
|
|
288
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ALIGNS, ALIGN_TOGGLES, INDENT_MOST, alignLook, alignOf, aligns, indentLook, indentOf, indents } from "../components/align.mjs";
|
|
2
|
+
import { TOGGLES } from "../components/registry.mjs";
|
|
3
|
+
import { svg } from "../components/icons.mjs";
|
|
4
|
+
import { TABLE_ICONS } from "./table/icons.mjs";
|
|
5
|
+
import { t } from "../../shared/i18n/index.mjs";
|
|
6
|
+
|
|
7
|
+
// 对齐与缩进 (docs/editor.md, "Alignment and indent"; Feishu's 缩进和对齐 ›, its block menu's), shared by
|
|
8
|
+
// the tools that use it (block-menu/, typing/, after/): a
|
|
9
|
+
// paragraph's or a heading's alignment and indent, class switches its component takes (components/
|
|
10
|
+
// align.mjs) that the file keeps and the kit draws; a table's frame takes the alignment alone (it is
|
|
11
|
+
// placed on the page left, centred or right, as a text block's words are), by the same row, named 对齐.
|
|
12
|
+
// The block menu's row (block-menu/), for one block or
|
|
13
|
+
// for several selected that all take them, one undo step; Enter carrying them to the block it makes
|
|
14
|
+
// (core.mjs newBlock: components/align.mjs carry), and Backspace at a block's start taking them off before anything else
|
|
15
|
+
// (typing/: unalign), one at a time: a centred or right-aligned block to the left, then its indent a
|
|
16
|
+
// level less (Feishu's text block: 退对齐, then 反缩进, then 合并到上一块), each one undo step, the caret
|
|
17
|
+
// staying at the start. The same for a paragraph left in a block's place by Backspace after it
|
|
18
|
+
// (after/): it takes the alignment the block showed.
|
|
19
|
+
|
|
20
|
+
// Its icons, in the menus' lines (20 units, the table's alignments beside them): text lines the middle
|
|
21
|
+
// two moved in (the row), and the same with an arrow in (增加缩进) or out (减少缩进) at their left.
|
|
22
|
+
const LINES = '<path d="M3.75 4.75h12.5M9.25 8.5h7M9.25 11.75h7M3.75 15.25h12.5"/>';
|
|
23
|
+
export const ALIGN_ICONS = {
|
|
24
|
+
row: svg('<path d="M3.75 4.75h12.5M7.25 8.5h9M7.25 11.75h9M3.75 15.25h12.5"/>'),
|
|
25
|
+
left: TABLE_ICONS["doc-align-left"],
|
|
26
|
+
center: TABLE_ICONS["doc-align-center"],
|
|
27
|
+
right: TABLE_ICONS["doc-align-right"],
|
|
28
|
+
indent: svg(`${LINES}<path d="m3.75 7.9 2.25 2.25-2.25 2.25"/>`),
|
|
29
|
+
outdent: svg(`${LINES}<path d="M6 7.9 3.75 10.15 6 12.4"/>`),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const LABELS = { left: t("左对齐"), center: t("居中对齐"), right: t("右对齐") };
|
|
33
|
+
|
|
34
|
+
/** Whether a block takes an alignment: its kind's class switches hold it (`kind`: its unit kind). */
|
|
35
|
+
export const alignable = (kind) => aligns(TOGGLES[kind]);
|
|
36
|
+
|
|
37
|
+
/** Whether a block takes an indent too, as a text block does (`kind`: its unit kind). */
|
|
38
|
+
export const indentable = (kind) => indents(TOGGLES[kind]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The block menu's 对齐与缩进 › for `units` (one block, or several selected), when they all take one
|
|
42
|
+
* (kindOf(unit): its unit kind), or none: the three alignments (the one they share checked), then 增加缩进
|
|
43
|
+
* and 减少缩进 (each a level for every one of them, disabled where none can go further), one undo step
|
|
44
|
+
* each (look: the editor's change of classes). Where they do not all take an indent (a table's frame
|
|
45
|
+
* has none) the row is 对齐 › with the three alignments alone.
|
|
46
|
+
*/
|
|
47
|
+
export function alignRows(units, { kindOf, look }) {
|
|
48
|
+
if (units.length === 0 || !units.every((unit) => alignable(kindOf(unit)))) return [];
|
|
49
|
+
const shared = units.every((unit) => alignOf(unit) === alignOf(units[0])) ? alignOf(units[0]) : null;
|
|
50
|
+
const withIndent = units.every((unit) => indentable(kindOf(unit)));
|
|
51
|
+
const levels = units.map(indentOf);
|
|
52
|
+
const indent = (step) => look(units, units.map((unit) => indentLook(Math.max(0, Math.min(INDENT_MOST, indentOf(unit) + step)))), units);
|
|
53
|
+
return [{
|
|
54
|
+
label: withIndent ? t("对齐与缩进") : t("对齐"), icon: ALIGN_ICONS.row,
|
|
55
|
+
submenu: () => [
|
|
56
|
+
...["left", "center", "right"].map((name) => ({ label: LABELS[name], icon: ALIGN_ICONS[name], current: shared === name, run: () => look(units, alignLook(name), units) })),
|
|
57
|
+
...(withIndent ? [
|
|
58
|
+
{ separator: true },
|
|
59
|
+
{ label: t("增加缩进"), icon: ALIGN_ICONS.indent, disabled: levels.every((level) => level >= INDENT_MOST), run: () => indent(1) },
|
|
60
|
+
{ label: t("减少缩进"), icon: ALIGN_ICONS.outdent, disabled: levels.every((level) => level === 0), run: () => indent(-1) },
|
|
61
|
+
] : []),
|
|
62
|
+
],
|
|
63
|
+
}];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Backspace at the start of text block `host` (typing/): its alignment taken off (to the left), else its
|
|
68
|
+
* indent a level less, one undo step (look), the caret where it is. Returns whether it did either.
|
|
69
|
+
*/
|
|
70
|
+
export function unalign(host, look) {
|
|
71
|
+
if (!indentable(host.getAttribute?.("data-ge-unit-kind")) || !ALIGN_TOGGLES.some((name) => host.classList.contains(name))) return false;
|
|
72
|
+
if (alignOf(host) !== "left") return look(host, alignLook("left"));
|
|
73
|
+
return look(host, indentLook(indentOf(host) - 1));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The alignment a block shows in the text area of the box it stands in (`area`: that area's rect,
|
|
78
|
+
* window coordinates): "center" or "right" when it is narrower and stands there, else "left" (a
|
|
79
|
+
* block as wide as the area has none). How a picture, a card or a table set narrower is placed,
|
|
80
|
+
* whatever says so (its class, its margins): what the reader sees.
|
|
81
|
+
*/
|
|
82
|
+
export function shownAlign(rect, area) {
|
|
83
|
+
const left = rect.left - area.left;
|
|
84
|
+
const right = area.right - rect.right;
|
|
85
|
+
if (left <= 2 && right <= 2) return "left";
|
|
86
|
+
if (Math.abs(left - right) <= 2) return "center";
|
|
87
|
+
return right <= 2 ? "right" : "left";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The class that gives a new paragraph the alignment `name`, or null for the left. */
|
|
91
|
+
export const alignClass = (name) => ALIGNS[name] ?? null;
|
|
@@ -32,8 +32,7 @@ export const STYLE = `
|
|
|
32
32
|
.ge-note-marker { width: ${RAIL.marker}px; height: ${RAIL.marker}px; box-sizing: border-box; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; display: grid; place-items: center; color: var(--ge-ico2); cursor: pointer; pointer-events: auto; }
|
|
33
33
|
.ge-note-marker svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
|
|
34
34
|
.ge-note-marker[hidden], .ge-note-card[hidden] { display: none; }
|
|
35
|
-
.ge-note-marker
|
|
36
|
-
.ge-note-marker:active { background: var(--ge-press); }
|
|
35
|
+
.ge-note-marker[data-hot] { background: var(--ge-hover); color: var(--ge-ico); }
|
|
37
36
|
.ge-note-marker:focus-visible { outline: 2px solid var(--ge-focus); outline-offset: -2px; }
|
|
38
37
|
/* The card, where the format bar would stand: a popover as the bar is, as wide as ${RAIL.card}px or the column. Its face is what shows; the card itself stands still, so a face going left under the pointer keeps it. */
|
|
39
38
|
.ge-note-card { z-index: 1; width: ${RAIL.card}px; box-sizing: border-box; color: var(--ge-tx); pointer-events: auto; cursor: text; }
|
|
@@ -60,8 +59,6 @@ export const STYLE = `
|
|
|
60
59
|
.ge-note-card[data-long][data-top] textarea { --top: 28px; }
|
|
61
60
|
/* Its delete button, on the field's first line, in the room the field leaves it. */
|
|
62
61
|
.ge-note-delete { position: absolute; top: 7px; right: 7px; width: 24px; height: 24px; box-sizing: border-box; margin: 0; padding: 0; border: 0; border-radius: 6px; background: transparent; display: grid; place-items: center; color: var(--ge-ico3); cursor: pointer; }
|
|
63
|
-
.ge-note-delete:hover { background: var(--ge-hover); }
|
|
64
|
-
.ge-note-delete:active { background: var(--ge-press); }
|
|
65
62
|
.ge-note-delete svg { width: 18px; height: 18px; pointer-events: none; }
|
|
66
63
|
.ge-note-bar { width: 2px; border-radius: 1px; background: var(--ge-note-line); }
|
|
67
64
|
.ge-note-bar[data-hot] { background: var(--ge-note-hot-line); }
|
|
@@ -74,13 +71,13 @@ export const STYLE = `
|
|
|
74
71
|
export const layerNode = () => element("div", { class: "ge-note-layer", "data-doc-dev": "" });
|
|
75
72
|
|
|
76
73
|
export function markerNode(id) {
|
|
77
|
-
return element("button", { type: "button", class: "ge-note-marker", "data-note": id, "aria-label": t("批注"), tabindex: "-1", html: MARKER_ICON });
|
|
74
|
+
return element("button", { type: "button", class: "ge-note-marker ge-icon-btn", "data-note": id, "aria-label": t("批注"), tabindex: "-1", html: MARKER_ICON });
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
/** A card: a plain-text field, and the button that deletes what it holds, on its face. */
|
|
81
78
|
export function cardNode() {
|
|
82
79
|
const field = element("textarea", { rows: "1", spellcheck: "false", maxlength: TEXT_MOST, placeholder: t("写下建议…"), "aria-label": t("批注") });
|
|
83
|
-
const erase = element("button", { type: "button", class: "ge-note-delete", "aria-label": t("删除批注"), tabindex: "-1", html: ICONS.trash });
|
|
80
|
+
const erase = element("button", { type: "button", class: "ge-note-delete ge-icon-btn", "aria-label": t("删除批注"), tabindex: "-1", html: ICONS.trash });
|
|
84
81
|
tooltip(erase, t("删除批注"));
|
|
85
82
|
return { node: element("div", { class: "ge-note-card", role: "group" }, element("div", { class: "ge-note-face" }, field, erase)), field, erase };
|
|
86
83
|
}
|