@heycys/gallery 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +51 -1
- package/browser/editor/components/callout/index.mjs +40 -15
- package/browser/editor/components/columns/page.mjs +45 -32
- package/browser/editor/components/details/index.mjs +2 -1
- package/browser/editor/components/dialog/index.mjs +2 -1
- package/browser/editor/components/dialog/page.mjs +0 -18
- package/browser/editor/components/divider/index.mjs +1 -1
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/figure/page.mjs +10 -1
- package/browser/editor/components/file/page.mjs +2 -2
- package/browser/editor/components/flowchart/add.mjs +7 -6
- package/browser/editor/components/flowchart/page.mjs +1 -1
- package/browser/editor/components/heading/index.mjs +2 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +4 -20
- package/browser/editor/components/icons.mjs +13 -2
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/page.mjs +2 -2
- package/browser/editor/components/installed/index.mjs +82 -29
- package/browser/editor/components/installed/page.mjs +146 -34
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/kit.mjs +3 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/page.mjs +44 -14
- package/browser/editor/components/pages.mjs +2 -2
- package/browser/editor/components/registry.mjs +68 -33
- package/browser/editor/components/section/index.mjs +2 -1
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/table/index.mjs +64 -5
- package/browser/editor/components/table/page.mjs +30 -19
- package/browser/editor/page/annotate/anchors.mjs +4 -3
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/annotate/index.mjs +61 -34
- package/browser/editor/page/autosave.mjs +357 -38
- package/browser/editor/page/beside.mjs +5 -5
- package/browser/editor/page/block-menu/colors.mjs +3 -1
- package/browser/editor/page/block-menu/index.mjs +8 -6
- package/browser/editor/page/blocks.mjs +16 -7
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +145 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +970 -0
- package/browser/editor/page/board/settings.mjs +209 -0
- package/browser/editor/page/caret.mjs +5 -2
- package/browser/editor/page/changes/bar.mjs +94 -0
- package/browser/editor/page/changes/ghost.mjs +206 -0
- package/browser/editor/page/changes/gone-words.mjs +94 -0
- package/browser/editor/page/changes/index.mjs +447 -0
- package/browser/editor/page/changes/words.mjs +27 -0
- package/browser/editor/page/clipboard/import/colors.mjs +3 -3
- package/browser/editor/page/clipboard/import/html.mjs +29 -6
- package/browser/editor/page/clipboard/import/inline.mjs +32 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
- package/browser/editor/page/clipboard/import/read.mjs +6 -1
- package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
- package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
- package/browser/editor/page/clipboard/index.mjs +156 -26
- package/browser/editor/page/clipboard/own/blocks.mjs +25 -16
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +16 -7
- package/browser/editor/page/clipboard/own/export.mjs +6 -6
- package/browser/editor/page/clipboard/own/selection.mjs +3 -3
- package/browser/editor/page/clipboard/own/writers.mjs +0 -11
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +98 -25
- package/browser/editor/page/conflicts.mjs +13 -33
- package/browser/editor/page/convert.mjs +8 -7
- package/browser/editor/page/core.mjs +81 -27
- package/browser/editor/page/custom-page.mjs +106 -0
- package/browser/editor/page/drag/index.mjs +40 -24
- package/browser/editor/page/drag/preview.mjs +9 -4
- package/browser/editor/page/editor.mjs +120 -28
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +22 -13
- package/browser/editor/page/emoji-picker/grid.mjs +7 -5
- package/browser/editor/page/emoji-picker/icon-tab.mjs +4 -4
- package/browser/editor/page/emoji-picker/icons.mjs +0 -1
- package/browser/editor/page/emoji-picker/index.mjs +11 -9
- package/browser/editor/page/emoji-picker/styles.mjs +156 -2
- package/browser/editor/page/emoji-picker/support.mjs +6 -4
- package/browser/editor/page/emoji-picker/upload.mjs +14 -13
- package/browser/editor/page/fills.mjs +5 -3
- package/browser/editor/page/fold/index.mjs +348 -0
- package/browser/editor/page/fold/rule.mjs +125 -0
- package/browser/editor/page/folded.mjs +23 -0
- package/browser/editor/page/format-bar/bar.mjs +2 -1
- package/browser/editor/page/format-bar/index.mjs +1 -1
- package/browser/editor/page/geometry.mjs +8 -6
- package/browser/editor/page/handle/index.mjs +22 -14
- package/browser/editor/page/hints/index.mjs +1 -1
- package/browser/editor/page/history.mjs +24 -4
- package/browser/editor/page/insert/index.mjs +30 -17
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +69 -6
- package/browser/editor/page/margin.mjs +63 -27
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +86 -31
- package/browser/editor/page/merge.mjs +24 -0
- package/browser/editor/page/notices.mjs +3 -3
- package/browser/editor/page/offered.mjs +1 -1
- package/browser/editor/page/outline/folds.mjs +11 -10
- package/browser/editor/page/outline/index.mjs +131 -45
- package/browser/editor/page/outline/list.mjs +23 -11
- package/browser/editor/page/outline/read.mjs +1 -1
- package/browser/editor/page/outline/strip.mjs +7 -1
- package/browser/editor/page/page-objects.mjs +13 -2
- package/browser/editor/page/panel.mjs +9 -13
- package/browser/editor/page/present-links.mjs +11 -2
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/delete.mjs +8 -6
- package/browser/editor/page/selection/index.mjs +10 -3
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +101 -6
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/cell-bar.mjs +4 -1
- package/browser/editor/page/table/cells.mjs +103 -47
- package/browser/editor/page/table/icons.mjs +3 -1
- package/browser/editor/page/table/index.mjs +40 -16
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +150 -0
- package/browser/editor/page/table/widths.mjs +9 -4
- package/browser/editor/page/text-select/index.mjs +43 -14
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/tooltip.mjs +1 -1
- package/browser/editor/page/type-grid.mjs +4 -3
- package/browser/editor/page/typing/code-edges.mjs +63 -17
- package/browser/editor/page/typing/index.mjs +65 -9
- package/browser/editor/page/typing/leave.mjs +1 -1
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/annotations.mjs +8 -10
- package/browser/shared/block-packs.mjs +404 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/code-folds.mjs +5 -1
- package/browser/shared/colors.mjs +17 -14
- package/browser/shared/component-catalog.mjs +345 -54
- package/browser/shared/component-source.mjs +37 -0
- package/browser/shared/components/callout.mjs +4 -2
- package/browser/shared/components/index.mjs +72 -9
- package/browser/shared/components/installed.mjs +110 -8
- package/browser/shared/components/page.mjs +22 -3
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -1
- package/browser/shared/components/text.mjs +2 -2
- package/browser/shared/document-look.mjs +183 -0
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/README.md +4 -2
- package/browser/shared/emoji/data/categories.json +1 -1
- package/browser/shared/emoji/data/keywords-en.json +1 -1
- package/browser/shared/emoji/data/keywords-zh.json +1 -1
- package/browser/shared/emoji/data/names.json +1 -1
- package/browser/shared/emoji/data/positions.json +1 -1
- package/browser/shared/emoji/data/twemoji-index.json +1 -1
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +10 -12
- package/browser/shared/emoji/emoji.mjs +8 -7
- package/browser/shared/emoji/icon-value.mjs +4 -3
- package/browser/shared/extension-sidebar.mjs +126 -0
- package/browser/shared/extensions.mjs +79 -0
- package/browser/shared/file-table.mjs +101 -0
- package/browser/shared/html-tree.mjs +11 -5
- package/browser/shared/i18n/en.mjs +374 -35
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/long-runs.mjs +39 -0
- package/browser/shared/net-cache.mjs +133 -0
- package/browser/shared/net-keys.mjs +32 -0
- package/browser/shared/net-policy.mjs +177 -0
- package/browser/shared/new-names.mjs +5 -2
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +458 -0
- package/browser/shared/pack-manifest.mjs +77 -0
- package/browser/shared/page-address.mjs +6 -3
- package/browser/shared/page-cards.mjs +308 -0
- package/browser/shared/page-links.mjs +69 -6
- package/browser/shared/pages.mjs +388 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/preferences.mjs +10 -4
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +13 -5
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/table-chart.mjs +33 -1
- package/browser/shared/todos.mjs +83 -0
- package/browser/shared/user-directory.mjs +24 -0
- package/browser/shared/versions.mjs +14 -0
- package/browser/shared/web-links.mjs +134 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-look.mjs +91 -0
- package/browser/shared/workspace-name.mjs +154 -0
- package/browser/shared/workspace-query.mjs +125 -0
- package/browser/shared/workspace-registry.mjs +272 -0
- package/browser/shared/workspace.mjs +171 -20
- package/browser/shared/zoom.mjs +5 -5
- package/dist/chunk-2NRBY6AJ.mjs +2 -0
- package/dist/chunk-32ZUEFZ7.mjs +2 -0
- package/dist/chunk-35NQ4PLQ.mjs +2 -0
- package/dist/chunk-3KJHLHUO.mjs +2 -0
- package/dist/chunk-3NJACR4W.mjs +2 -0
- package/dist/chunk-4AV456RQ.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5XYHDBJ5.mjs +2 -0
- package/dist/chunk-5ZJA7CXT.mjs +2 -0
- package/dist/chunk-6A53MZYZ.mjs +2 -0
- package/dist/chunk-6EXH3ORZ.mjs +166 -0
- package/dist/chunk-6EZ7FNIK.mjs +3 -0
- package/dist/{chunk-UXUK4PMC.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/{chunk-6U2SLSDN.mjs → chunk-6VTU6KEO.mjs} +1 -1
- package/dist/chunk-B4P2CM2J.mjs +3 -0
- package/dist/chunk-BPL64HGA.mjs +4 -0
- package/dist/chunk-BVEFGE4B.mjs +2 -0
- package/dist/chunk-BZ5RAF7L.mjs +2 -0
- package/dist/chunk-CRJEG7MT.mjs +2 -0
- package/dist/{chunk-B3VTYBYR.mjs → chunk-D4CKRD3V.mjs} +91 -91
- package/dist/chunk-D4EURAX4.mjs +4 -0
- package/dist/chunk-DQCE7TJY.mjs +5 -0
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/{chunk-DB4WKGYF.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-FJYN7RTH.mjs +4 -0
- package/dist/chunk-FWNRPMCJ.mjs +12 -0
- package/dist/chunk-FWW4CSAZ.mjs +2 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-GY3FAUVM.mjs +2 -0
- package/dist/chunk-HLYV7RIH.mjs +2 -0
- package/dist/chunk-HMYTM3GT.mjs +15 -0
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-KTKHRC6H.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-MHW7ZKOU.mjs +2 -0
- package/dist/chunk-N76HWBA3.mjs +10 -0
- package/dist/chunk-N7AZZLGT.mjs +548 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-YXAUQPVK.mjs → chunk-NFMCP2HI.mjs} +3 -3
- package/dist/chunk-NG375ILQ.mjs +2 -0
- package/dist/chunk-NVRNLK25.mjs +6 -0
- package/dist/chunk-NWFBE2YA.mjs +2 -0
- package/dist/chunk-NWR2LT5B.mjs +2 -0
- package/dist/chunk-OJKMINIU.mjs +20 -0
- package/dist/chunk-OUUP3WKT.mjs +2 -0
- package/dist/chunk-OW5NWPOJ.mjs +10 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-POQSE4C2.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/{chunk-Z52HTUW7.mjs → chunk-PVER7LSC.mjs} +2 -2
- package/dist/chunk-PZDLJJTJ.mjs +3 -0
- package/dist/chunk-Q47PLKIJ.mjs +15 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QKXMPUXC.mjs +2 -0
- package/dist/chunk-QOUEFUCH.mjs +16 -0
- package/dist/chunk-RFDZXFJF.mjs +13 -0
- package/dist/chunk-RKPWLGZ3.mjs +4 -0
- package/dist/chunk-RMECZA2K.mjs +2 -0
- package/dist/{chunk-EUX7IC5J.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SX4LJYT6.mjs +8 -0
- package/dist/chunk-SXHBYZST.mjs +16 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TEZAWDSQ.mjs +2 -0
- package/dist/chunk-UBBRTJ2R.mjs +24 -0
- package/dist/chunk-UFNYFFKO.mjs +20 -0
- package/dist/chunk-UGWYKHBL.mjs +170 -0
- package/dist/chunk-UKSHDZZ6.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-UNOYVIYR.mjs +2 -0
- package/dist/chunk-V6RIYQZZ.mjs +4 -0
- package/dist/chunk-VJPFVNNW.mjs +15 -0
- package/dist/chunk-VS3ZMVGX.mjs +5 -0
- package/dist/chunk-VTKNEYT3.mjs +6 -0
- package/dist/chunk-VXACTLO3.mjs +3 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YQGT4AB2.mjs +6 -0
- package/dist/chunk-ZB4H7ZN4.mjs +2 -0
- package/dist/{chunk-ACOPDCNB.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZUNVAXLH.mjs +2 -0
- package/dist/chunk-ZWPMCK7P.mjs +2 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-EVJ3BX3M.mjs → update-fetch.mjs} +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +95 -0
- package/kit/board.js +250 -0
- package/kit/charts.js +5 -71
- package/kit/code.js +14 -14
- package/kit/math.js +18 -2
- package/kit/report.css +500 -151
- package/kit/runtime.js +1720 -170
- package/kit/state.js +10 -1
- package/kit/tables.js +172 -37
- package/kit/ui.js +166 -27
- package/package.json +2 -1
- package/packs/gallery/card/component.json +14 -0
- package/packs/gallery/card/example.html +10 -0
- package/packs/gallery/card/preview.svg +1 -0
- package/packs/gallery/card/style.css +6 -0
- package/packs/gallery/card/template.html +6 -0
- package/packs/gallery/card/writing.md +14 -0
- package/packs/gallery/chart-card/component.json +15 -0
- package/packs/gallery/chart-card/example.html +14 -0
- package/packs/gallery/chart-card/kit.js +130 -0
- package/packs/gallery/chart-card/preview.svg +1 -0
- package/packs/gallery/chart-card/style.css +42 -0
- package/packs/gallery/chart-card/template.html +13 -0
- package/packs/gallery/chart-card/writing.md +20 -0
- package/packs/gallery/chart-view/component.json +20 -0
- package/packs/gallery/chart-view/example.html +13 -0
- package/packs/gallery/chart-view/kit.js +355 -0
- package/packs/gallery/chart-view/preview.svg +1 -0
- package/packs/gallery/chart-view/style.css +94 -0
- package/packs/gallery/chart-view/template.html +3 -0
- package/packs/gallery/chart-view/writing.md +22 -0
- package/packs/gallery/countdown/component.json +18 -0
- package/packs/gallery/countdown/example.html +3 -0
- package/packs/gallery/countdown/kit.js +156 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +130 -0
- package/packs/gallery/countdown/template.html +3 -0
- package/packs/gallery/countdown/writing.md +22 -0
- package/packs/gallery/habit/component.json +14 -0
- package/packs/gallery/habit/example.html +3 -0
- package/packs/gallery/habit/kit.js +295 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +246 -0
- package/packs/gallery/habit/template.html +3 -0
- package/packs/gallery/habit/writing.md +21 -0
- package/packs/gallery/heatmap/component.json +18 -0
- package/packs/gallery/heatmap/example.html +3 -0
- package/packs/gallery/heatmap/kit.js +351 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +201 -0
- package/packs/gallery/heatmap/template.html +3 -0
- package/packs/gallery/heatmap/writing.md +21 -0
- package/packs/gallery/kanban/component.json +18 -0
- package/packs/gallery/kanban/example.html +12 -0
- package/packs/gallery/kanban/kit.js +540 -0
- package/packs/gallery/kanban/preview.svg +1 -0
- package/packs/gallery/kanban/style.css +212 -0
- package/packs/gallery/kanban/template.html +3 -0
- package/packs/gallery/kanban/writing.md +20 -0
- package/packs/gallery/metric/component.json +22 -0
- package/packs/gallery/metric/example.html +15 -0
- package/packs/gallery/metric/kit.js +248 -0
- package/packs/gallery/metric/preview.svg +1 -0
- package/packs/gallery/metric/style.css +92 -0
- package/packs/gallery/metric/template.html +3 -0
- package/packs/gallery/metric/writing.md +23 -0
- package/packs/gallery/note/component.json +14 -0
- package/packs/gallery/note/example.html +3 -0
- package/packs/gallery/note/kit.js +102 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +76 -0
- package/packs/gallery/note/template.html +3 -0
- package/packs/gallery/note/writing.md +18 -0
- package/packs/gallery/pack.json +8 -0
- package/packs/gallery/recent/component.json +13 -0
- package/packs/gallery/recent/example.html +1 -0
- package/packs/gallery/recent/kit.js +238 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +158 -0
- package/packs/gallery/recent/template.html +1 -0
- package/packs/gallery/recent/writing.md +15 -0
- package/packs/gallery/static/component.json +13 -0
- package/packs/gallery/static/example.html +11 -0
- package/packs/gallery/static/preview.svg +1 -0
- package/packs/gallery/static/style.css +138 -0
- package/packs/gallery/static/template.html +1 -0
- package/packs/gallery/static/writing.md +18 -0
- package/packs/gallery/stats/component.json +13 -0
- package/packs/gallery/stats/example.html +1 -0
- package/packs/gallery/stats/kit.js +166 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +151 -0
- package/packs/gallery/stats/template.html +1 -0
- package/packs/gallery/stats/writing.md +11 -0
- package/packs/gallery/today/component.json +12 -0
- package/packs/gallery/today/example.html +1 -0
- package/packs/gallery/today/kit.js +185 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +120 -0
- package/packs/gallery/today/template.html +1 -0
- package/packs/gallery/today/writing.md +14 -0
- package/packs/gallery/todos/component.json +19 -0
- package/packs/gallery/todos/example.html +3 -0
- package/packs/gallery/todos/kit.js +342 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +267 -0
- package/packs/gallery/todos/template.html +3 -0
- package/packs/gallery/todos/writing.md +30 -0
- package/packs/gallery/weather/component.json +19 -0
- package/packs/gallery/weather/example.html +3 -0
- package/packs/gallery/weather/kit.js +312 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +258 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/release.json +13 -11
- package/sdk/doc-kit.d.ts +404 -7
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +71 -26
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/example-report.html +1 -1
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +221 -0
- package/skill/references/writing-html.md +9 -7
- package/skill/sdk/doc-kit.d.ts +404 -7
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BK2e_07w.js +13 -0
- package/web/assets/index-CWFI83mF.css +1 -0
- package/web/index.html +2 -2
- package/browser/editor/components/callout/page.mjs +0 -13
- package/dist/chunk-2PBALTR3.mjs +0 -57
- package/dist/chunk-3LA3EMDE.mjs +0 -15
- package/dist/chunk-5FRMCDPY.mjs +0 -16
- package/dist/chunk-5LEK2CBS.mjs +0 -2
- package/dist/chunk-5OFN5AHC.mjs +0 -2
- package/dist/chunk-5SIYS5HN.mjs +0 -2
- package/dist/chunk-5TEK3RAD.mjs +0 -2
- package/dist/chunk-6CYG3Z4V.mjs +0 -2
- package/dist/chunk-7GHT2UCA.mjs +0 -15
- package/dist/chunk-7QQBR7PB.mjs +0 -2
- package/dist/chunk-ATCJYAR4.mjs +0 -2
- package/dist/chunk-C7HWOBIF.mjs +0 -2
- package/dist/chunk-E7VYDG2X.mjs +0 -2
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FQGQH4KM.mjs +0 -2
- package/dist/chunk-G7TOXONE.mjs +0 -6
- package/dist/chunk-GPF4YWWB.mjs +0 -9
- package/dist/chunk-GYQV7Y4J.mjs +0 -120
- package/dist/chunk-HMHK3EQ6.mjs +0 -2
- package/dist/chunk-HQQMJCQJ.mjs +0 -10
- package/dist/chunk-IERUOGC3.mjs +0 -6
- package/dist/chunk-ITNLYXXV.mjs +0 -3
- package/dist/chunk-L4DVONOG.mjs +0 -2
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LC7YNQFG.mjs +0 -2
- package/dist/chunk-LHTFLRB6.mjs +0 -4
- package/dist/chunk-NFIBI4IP.mjs +0 -26
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O52JMOCZ.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-QMQUXTU4.mjs +0 -12
- package/dist/chunk-QVWVFC5K.mjs +0 -6
- package/dist/chunk-QYKCJ7FG.mjs +0 -8
- package/dist/chunk-QZY6Q64C.mjs +0 -2
- package/dist/chunk-TDQP3DKQ.mjs +0 -10
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-UNUEWH4S.mjs +0 -2
- package/dist/chunk-V4CPWKMZ.mjs +0 -2
- package/dist/chunk-VACRB2NE.mjs +0 -3
- package/dist/chunk-W63L7367.mjs +0 -7
- package/dist/chunk-W7CXPCRV.mjs +0 -6
- package/dist/chunk-XINNG4F2.mjs +0 -4
- package/dist/chunk-YL2DPWVS.mjs +0 -4
- package/dist/chunk-YZ5Z6H4W.mjs +0 -4
- package/dist/chunk-ZBIM6ARY.mjs +0 -216
- package/skill/references/building-components.md +0 -327
- package/web/assets/index-B6Ai3wsa.js +0 -13
- package/web/assets/index-SYPC3EZy.css +0 -1
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { escapeText } from "../../../shared/escape.mjs";
|
|
2
|
-
import { ATTRIBUTE, FALLBACK, INSTANCE, PACKAGE_ID, instanceMatch, refusedInCopy } from "../../../shared/components/installed.mjs";
|
|
2
|
+
import { ATTRIBUTE, FALLBACK, INSTANCE, PACKAGE_ID, SLOT, SLOT_PART, componentAt, heldBy, instanceMatch, refusedInCopy, slotsIn } from "../../../shared/components/installed.mjs";
|
|
3
3
|
import { wordsIn } from "../../page/clipboard/own/writers.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { BLOCK_ICON } from "../icons.mjs";
|
|
5
|
+
import { VIEW_FROM } from "../../../shared/table-chart.mjs";
|
|
5
6
|
import { t } from "../../../shared/i18n/index.mjs";
|
|
6
7
|
|
|
7
8
|
// 组件: the one kind of block every component package is to the engines, the host of a package's
|
|
8
9
|
// instances (src/shared/components/installed.mjs). It uses only what a definition offers any block:
|
|
9
10
|
// the engines know no package and no part of one. An instance is one block, moved, copied and
|
|
10
|
-
// deleted whole
|
|
11
|
-
//
|
|
12
|
-
//
|
|
11
|
+
// deleted whole; its parts edited as text are text blocks of this kind (file.mjs finds them, as its
|
|
12
|
+
// manifest says), and everything else in its own region is the component's (page.mjs). A press on
|
|
13
|
+
// its outer frame or on the handle is Gallery's, as for any block. Its slots (data-doc-slot, the parts
|
|
14
|
+
// its manifest edits as "flow") are the one way in and out: boxes of kind "slot", keyed by the part's
|
|
15
|
+
// name, whose blocks are the document's, as a column's are (notion-lite's column: a block's own area
|
|
16
|
+
// of child blocks, the frame around it none of theirs).
|
|
13
17
|
//
|
|
14
|
-
// Where the engines reach it (src/editor/page/ unless named): ../source/ (the scan stops at one
|
|
15
|
-
// natural.mjs and old names pass
|
|
18
|
+
// Where the engines reach it (src/editor/page/ unless named): ../source/ (the scan stops at one and
|
|
19
|
+
// goes on in its slots, natural.mjs and old names pass its own region by: `isInstance`,
|
|
20
|
+
// `instanceSlots`, src/shared/components/), hints/ (`readOnly`), clipboard/own/
|
|
16
21
|
// (`clipboard`, copied as itself), caret.mjs (`sealed`: `editable`, where most of the page's events
|
|
17
22
|
// start from), text-select/, editor.mjs's entries and the tools that go by a kit's class (`keepsKeys`,
|
|
18
23
|
// page.mjs), formula/, the "/" menu, the format bar and clipboard/ (`formula`). The "/" menu and 在下方新建
|
|
@@ -23,21 +28,27 @@ import { t } from "../../../shared/i18n/index.mjs";
|
|
|
23
28
|
|
|
24
29
|
// An instance as Markdown, the words of the file and none of what a component draws: as its package's
|
|
25
30
|
// manifest says (`markdown`), each part in the file's order with `parts`, a table a table, one edited
|
|
26
|
-
// as text a paragraph
|
|
27
|
-
// its words as any
|
|
31
|
+
// as text a paragraph, a slot its blocks as each is written anywhere (notion-lite's column, `flatten`)
|
|
32
|
+
// and any other its words and pictures, or with `text`, and where no package says, its words as any
|
|
33
|
+
// whole block's.
|
|
28
34
|
function instanceParts(unit, how) {
|
|
29
35
|
const found = how.packageOf(unit.getAttribute(ATTRIBUTE));
|
|
30
36
|
if (found?.markdown !== "parts") return [how.words(unit)];
|
|
31
37
|
return saidParts(unit, found.parts).flatMap(({ part, edit }) => {
|
|
38
|
+
if (edit === "flow") {
|
|
39
|
+
const lines = how.lines(how.unitsOf(part)); // as a column's, not in from the margin as a disclosure's
|
|
40
|
+
return lines.length > 0 ? [lines] : [];
|
|
41
|
+
}
|
|
32
42
|
if (part.matches("table")) return [how.writtenAs("table", part)];
|
|
33
43
|
return (edit === "text" ? [how.own(part)] : [how.wordsIn(part).join(" · "), ...how.picturesIn(part)]).map((line) => [line]);
|
|
34
44
|
}).filter(([first, ...more]) => first || more.length > 0);
|
|
35
45
|
}
|
|
36
46
|
|
|
37
|
-
// The parts of an instance that say something, each once and none inside another, in the file's order
|
|
47
|
+
// The parts of an instance that say something, each once and none inside another, in the file's order:
|
|
48
|
+
// of its own region, a slot only as a part edited as flow and no other part.
|
|
38
49
|
function saidParts(unit, parts) {
|
|
39
50
|
const said = Object.values(parts).flatMap(({ at, edit }) => [...unit.querySelectorAll(at)].map((part) => ({ part, edit })))
|
|
40
|
-
.filter(({ part }) => !part.matches(`${INSTANCE}, script, style, template`) && part.parentElement.closest(INSTANCE) === unit);
|
|
51
|
+
.filter(({ part, edit }) => !part.matches(`${INSTANCE}, script, style, template`) && part.parentElement.closest(INSTANCE) === unit && heldBy(part) === unit && (edit === "flow") === part.matches(SLOT_PART));
|
|
41
52
|
const found = [...new Map(said.map((each) => [each.part, each])).values()];
|
|
42
53
|
return found.filter(({ part }) => !found.some((other) => other.part !== part && other.part.contains(part)))
|
|
43
54
|
.sort((a, b) => (a.part.compareDocumentPosition(b.part) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1));
|
|
@@ -46,10 +57,13 @@ function saidParts(unit, parts) {
|
|
|
46
57
|
// A copy of an instance as blocks, what other programs and a field of plain text read of it: as its
|
|
47
58
|
// package says, as a page export writes it (instanceParts), but for pictures, which are no words. Its
|
|
48
59
|
// words are paragraphs, as `markdown: "parts"` has them; a text part that is a heading says so for the
|
|
49
|
-
// clipboard's HTML (`as`: the type it is written as there, the parts writer's).
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
// clipboard's HTML (`as`: the type it is written as there, the parts writer's). A slot is its blocks
|
|
61
|
+
// (`flows`, by name, as the clipboard describes them), the copy's slots being empty; its words are
|
|
62
|
+
// among the instance's (`words`, of it with what its slots hold).
|
|
63
|
+
function copiedParts(copy, found, { serializeInner, clipboardOf, copiedType }, { flows = {}, words = wordsIn(copy) } = {}) {
|
|
64
|
+
if (found?.markdown !== "parts" || !found.parts) return [{ type: "paragraph", html: escapeText(words.join(" · ")) }].filter(({ html }) => html);
|
|
52
65
|
return saidParts(copy, found.parts).flatMap(({ part, edit }) => {
|
|
66
|
+
if (edit === "flow") return flows[part.getAttribute(SLOT)] ?? [];
|
|
53
67
|
if (part.matches("table")) return [clipboardOf("table").data(part, { serializeInner })].filter(Boolean);
|
|
54
68
|
const html = edit === "text" ? serializeInner(part) : escapeText(wordsIn(part).join(" · "));
|
|
55
69
|
const own = edit === "text" ? copiedType(part) : null;
|
|
@@ -73,22 +87,23 @@ function elementOf(html, doc = globalThis.document) {
|
|
|
73
87
|
// The most a description carries of one piece of markup (blocks.mjs `string`).
|
|
74
88
|
const CARRIED = 1e6;
|
|
75
89
|
|
|
76
|
-
//
|
|
77
|
-
export const ICON =
|
|
90
|
+
// The mark of any custom block with no picture of its own: a card of text (icons.mjs).
|
|
91
|
+
export const ICON = BLOCK_ICON;
|
|
78
92
|
|
|
79
93
|
export default {
|
|
80
94
|
name: "installed",
|
|
81
|
-
// Ahead of every rule of the page's: all that stands in an instance is the component's,
|
|
82
|
-
// controls too, and one of no package, or whose component failed, says why nothing there answers.
|
|
95
|
+
// Ahead of every rule of the page's: all that stands in an instance's own region is the component's,
|
|
96
|
+
// its controls too, and one of no package, or whose component failed, says why nothing there answers.
|
|
97
|
+
// What its slots hold is the page's, each block saying what it says anywhere (componentAt).
|
|
83
98
|
readOnly: [
|
|
84
|
-
{ rank: 1, at:
|
|
85
|
-
{ rank: 2, at:
|
|
99
|
+
{ rank: 1, at: (element) => componentAt(element) && Boolean(heldBy(element)?.hasAttribute(FALLBACK)), says: t("这个组件没有运行:内容只能看,可以整块移动、复制和删除。") },
|
|
100
|
+
{ rank: 2, at: componentAt, says: null },
|
|
86
101
|
],
|
|
87
102
|
attributes: [ATTRIBUTE],
|
|
88
103
|
sealed: INSTANCE,
|
|
89
104
|
units: {
|
|
90
105
|
installed: {
|
|
91
|
-
name: t("
|
|
106
|
+
name: t("自定义块@block"),
|
|
92
107
|
icon: ICON,
|
|
93
108
|
match: [{ rank: 0, tag: ["div", "section"], attr: ATTRIBUTE }],
|
|
94
109
|
boxed: true,
|
|
@@ -96,6 +111,11 @@ export default {
|
|
|
96
111
|
copy: "itself",
|
|
97
112
|
},
|
|
98
113
|
},
|
|
114
|
+
boxes: {
|
|
115
|
+
// A slot of an instance (data-doc-slot, its manifest's part edited as flow): the document's blocks, as a
|
|
116
|
+
// column's are, a disclosure's content's rules for an empty one (holdsOne, a plain div a group).
|
|
117
|
+
slot: { role: "flow", name: t("内容区"), groups: true, holdsOne: true, selectAll: { content: true }, find: (unit, key) => slotsIn(unit).find((slot) => slot.getAttribute(SLOT) === key) ?? null },
|
|
118
|
+
},
|
|
99
119
|
hosts: {
|
|
100
120
|
// A part a manifest edits as text: words as in a paragraph, emptied but never split, joined or
|
|
101
121
|
// taken out on its own, as a media block's caption is. No formula: the kit draws none in an
|
|
@@ -108,24 +128,57 @@ export default {
|
|
|
108
128
|
// no unit to be made from (`data-ge-copy`).
|
|
109
129
|
installed: {
|
|
110
130
|
tag: "div", kind: "installed", bare: true,
|
|
111
|
-
|
|
131
|
+
// Its markup is the file's, from its template or what was carried (`data-ge-copy`, its slots
|
|
132
|
+
// empty); what its slots hold goes apart, blocks made on the page as any (`children`, each in the
|
|
133
|
+
// slot `boxKeys` names), so that the commit's answer names each, as for a block made in a column.
|
|
134
|
+
// A view of a table (a table's 视图 › made it of its template, or a paste carried one) says the key
|
|
135
|
+
// of the table it reads as the page has it (`from`, its VIEW_FROM, which a paste may have given it
|
|
136
|
+
// anew: clipboard/own/chart-keys.mjs), which the file writes on it (file.mjs source); one carried
|
|
137
|
+
// with none on it says null (a view pasted into another document, its key taken off there), so
|
|
138
|
+
// that the file has none either, whatever its markup carried.
|
|
139
|
+
extras(element, { nodes }) {
|
|
140
|
+
const held = slotsIn(element).filter((slot) => slot.hasAttribute("data-ge-box")).flatMap((slot) => (nodes?.(slot) ?? []).map((node) => [slot.getAttribute(SLOT), node]));
|
|
141
|
+
return {
|
|
142
|
+
package: element.getAttribute(ATTRIBUTE),
|
|
143
|
+
...(element.hasAttribute("data-ge-copy") ? { html: element.getAttribute("data-ge-copy") } : {}),
|
|
144
|
+
...(element.hasAttribute(VIEW_FROM) ? { from: element.getAttribute(VIEW_FROM) } : element.hasAttribute("data-ge-copy") ? { from: null } : {}),
|
|
145
|
+
...(slotsIn(element).length > 0 ? { children: held.map(([, node]) => node), boxKeys: held.map(([key]) => key) } : {}),
|
|
146
|
+
};
|
|
147
|
+
},
|
|
112
148
|
clipboard: {
|
|
113
149
|
kind: "parts", read: instanceParts,
|
|
114
|
-
// What carries it where its unit is not (cut, another document)
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
|
|
150
|
+
// What carries it where its unit is not (cut, another document), and within its document too
|
|
151
|
+
// when it has slots: its markup as the kit would start it, with the ids it names itself, its
|
|
152
|
+
// slots empty, the blocks each holds described as any (`flows`, by name: blocks made on the page
|
|
153
|
+
// where it is pasted, as a disclosure's are), and what it says to whoever reads no blocks. One
|
|
154
|
+
// whose markup no clipboard may bring anywhere (a handler, a script) has none, and stays a copy
|
|
155
|
+
// within its document; so does one with a slot that is no box (words straight in it), or with a
|
|
156
|
+
// block in one the page cannot make, which then is no copy at all (clipboard/own/describe.mjs).
|
|
157
|
+
data(node, { serializeInner, copyOf, clipboardOf, copiedType, page, holding }) {
|
|
158
|
+
const slots = slotsIn(node);
|
|
159
|
+
const flows = Object.fromEntries(slots.map((slot) => [slot.getAttribute(SLOT), slot.hasAttribute("data-ge-box") ? holding?.(slot) ?? null : null]));
|
|
160
|
+
if (Object.values(flows).some((blocks) => !blocks)) return null;
|
|
119
161
|
const copy = copyOf(node, { named: true });
|
|
162
|
+
const words = wordsIn(copy);
|
|
163
|
+
slotsIn(copy).forEach((slot) => slot.replaceChildren());
|
|
120
164
|
const html = copy.outerHTML;
|
|
121
165
|
if (html.length > CARRIED || refused(copy) || !elementOf(html, node.ownerDocument)) return null;
|
|
122
166
|
const id = node.getAttribute(ATTRIBUTE);
|
|
123
|
-
return { type: "installed", package: id, html, blocks: copiedParts(copy, page("installed")?.packageOf(id), { serializeInner, clipboardOf, copiedType }) };
|
|
167
|
+
return { type: "installed", package: id, html, ...(slots.length > 0 ? { flows } : {}), blocks: copiedParts(copy, page("installed")?.packageOf(id), { serializeInner, clipboardOf, copiedType }, { flows, words }) };
|
|
124
168
|
},
|
|
169
|
+
// What its slots hold, among a paste's blocks (blocks.mjs `holds`).
|
|
170
|
+
holds: (block) => (block.flows && typeof block.flows === "object" ? Object.values(block.flows).filter(Array.isArray).flat() : []),
|
|
171
|
+
// Its slots empty in its markup, each named once in `flows`, which holds blocks a slot takes.
|
|
125
172
|
check(block, { string, valid }) {
|
|
126
173
|
if (!string(block.package, 200) || !PACKAGE_ID.test(block.package) || !string(block.html, CARRIED) || !Array.isArray(block.blocks) || !block.blocks.every((inner) => valid(inner))) return false;
|
|
127
174
|
const root = elementOf(block.html);
|
|
128
|
-
|
|
175
|
+
if (!root?.matches(instanceMatch(block.package)) || refused(root)) return false;
|
|
176
|
+
const slots = slotsIn(root);
|
|
177
|
+
if (slots.length === 0) return block.flows === undefined;
|
|
178
|
+
const names = slots.map((slot) => slot.getAttribute(SLOT));
|
|
179
|
+
const { flows } = block;
|
|
180
|
+
return Boolean(flows) && typeof flows === "object" && !Array.isArray(flows) && new Set(names).size === names.length && names.length === Object.keys(flows).length
|
|
181
|
+
&& slots.every((slot) => !slot.firstElementChild && !slot.textContent.trim() && Array.isArray(flows[slot.getAttribute(SLOT)]) && flows[slot.getAttribute(SLOT)].every((inner) => valid(inner, "slot")));
|
|
129
182
|
},
|
|
130
183
|
},
|
|
131
184
|
},
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { ARRIVING, ATTRIBUTE, DATA_MOST, DATA_SHOWN, FALLBACK, FIELDS, INSTANCE, NO_TEXT, PACKAGE_MARK, SCHEMA, fitsDataScript, instanceMatch, isDataScript, noDataPart, refusedInData, schemaAhead } from "../../../shared/components/installed.mjs";
|
|
1
|
+
import { ARRIVING, ATTRIBUTE, DATA_MOST, DATA_SHOWN, FALLBACK, FIELDS, INSTANCE, NO_TEXT, PACKAGE_MARK, SCHEMA, SLOT, SLOT_PART, componentAt, fitsDataScript, heldBy, instanceMatch, isDataScript, noDataPart, refusedInData, schemaAhead, slotsIn } from "../../../shared/components/installed.mjs";
|
|
2
2
|
import { referencedIds } from "../../../shared/copy-ids.mjs";
|
|
3
|
-
import { language } from "../../../shared/i18n/index.mjs";
|
|
3
|
+
import { language, t } from "../../../shared/i18n/index.mjs";
|
|
4
4
|
import { caretAt, editable } from "../../page/caret.mjs";
|
|
5
|
+
import { htmlToBlocks, parseClipboardHTML } from "../../page/clipboard/import/html.mjs";
|
|
6
|
+
import { toBlocks } from "../../page/clipboard/import/to-blocks.mjs";
|
|
7
|
+
import { build as buildBlock } from "../../page/clipboard/own/blocks.mjs";
|
|
5
8
|
import { copyOf } from "../../page/clipboard/own/describe.mjs";
|
|
6
9
|
import { ownIds } from "../../page/clipboard/own/ids.mjs";
|
|
7
|
-
import { unitElement } from "../../page/core.mjs";
|
|
10
|
+
import { firstHost, newHost, unitElement } from "../../page/core.mjs";
|
|
11
|
+
import { addStyle } from "../../page/ui.mjs";
|
|
8
12
|
import { accepts, capsFor } from "../registry.mjs";
|
|
9
13
|
import { ICON } from "./index.mjs";
|
|
10
14
|
import { followCatalog, followSettings, isBehind } from "./served.mjs";
|
|
@@ -38,6 +42,18 @@ import { followCatalog, followSettings, isBehind } from "./served.mjs";
|
|
|
38
42
|
// the reader writes over someone else's change of a part (仍然调整) is a step of its own from theirs
|
|
39
43
|
// (`overwrite`), so that one undo gives the file's back.
|
|
40
44
|
// One past its manifest's `schema` is read-only, its words and all.
|
|
45
|
+
//
|
|
46
|
+
// Its slots (data-doc-slot, the parts its manifest edits as flow) are the page's: boxes of kind "slot"
|
|
47
|
+
// (index.mjs), whose blocks are edited, moved and undone as anywhere, a press or a key in one no
|
|
48
|
+
// component's (componentAt), whatever state the instance is in, one of no package too. Enter in a text
|
|
49
|
+
// part goes into the first slot after it, as in a disclosure's title. An empty one says so while the
|
|
50
|
+
// page is edited, and a click on it makes a paragraph (insert/, holdsOne), as a disclosure's content.
|
|
51
|
+
// The component reads a slot (context.part) and hears what changes in it (source), and writes nothing
|
|
52
|
+
// there: a slot it takes off its instance is put back where it stood (`keepSlots`), so that no commit
|
|
53
|
+
// takes the reader's blocks out. An instance made on the page, from "/", a clipboard or 恢复我的, has its
|
|
54
|
+
// slots as boxes made on the page, their blocks made on the page as any (`slotsMade`), which the commit
|
|
55
|
+
// carries apart from its markup (index.mjs `extras`) and the answer names, so that they edit at once; a
|
|
56
|
+
// copy carries them so too, in its document as well (`copiesAsItself`, index.mjs `data`).
|
|
41
57
|
|
|
42
58
|
let held = null; // the map, what makes a block with no editor (the transfer worker) finds none of
|
|
43
59
|
|
|
@@ -119,9 +135,10 @@ function bring({ id, stamp, definition, kit = [], tags }) {
|
|
|
119
135
|
const partsOf = (instance) => Object.entries(globalThis.DocKit?.description(instance.getAttribute(ATTRIBUTE))?.parts ?? {});
|
|
120
136
|
// Whether an instance holds its content in a shape its manifest does not reach, as the kit was told it.
|
|
121
137
|
const ahead = (instance) => schemaAhead(instance.getAttribute(SCHEMA), globalThis.DocKit?.description(instance.getAttribute(ATTRIBUTE))?.schema);
|
|
122
|
-
// The elements of a part an instance holds, none of an instance in it
|
|
123
|
-
// script of data there, which is
|
|
124
|
-
|
|
138
|
+
// The elements of a part an instance holds, of its own region (none of an instance in it, none of what
|
|
139
|
+
// its slots hold, no slot itself) and none of what the kit draws of a script of data there, which is
|
|
140
|
+
// no element of the file's.
|
|
141
|
+
const elementsOf = (instance, at) => [...instance.querySelectorAll(at)].filter((part) => !part.matches(INSTANCE) && !part.matches(SLOT_PART) && part.parentElement.closest(INSTANCE) === instance && heldBy(part) === instance && !part.closest(`.${DATA_SHOWN}`));
|
|
125
142
|
|
|
126
143
|
// The elements of an instance its component writes, [[name, element]], as the server finds them
|
|
127
144
|
// (file.mjs dataParts): of each part edited as data the first it holds, as context.part does. One in
|
|
@@ -170,7 +187,7 @@ const openness = (instance) => (instance.hasAttribute(FALLBACK) ? "false" : "tru
|
|
|
170
187
|
function followFallback(instance) {
|
|
171
188
|
const value = openness(instance);
|
|
172
189
|
for (const part of instance.querySelectorAll('[data-ge-kind="installed"]')) {
|
|
173
|
-
if (part.parentElement.closest(INSTANCE) === instance && part.getAttribute("contenteditable") !== value) part.setAttribute("contenteditable", value);
|
|
190
|
+
if (part.parentElement.closest(INSTANCE) === instance && heldBy(part) === instance && part.getAttribute("contenteditable") !== value) part.setAttribute("contenteditable", value);
|
|
174
191
|
}
|
|
175
192
|
}
|
|
176
193
|
|
|
@@ -196,12 +213,40 @@ function newInstance(doc, html) {
|
|
|
196
213
|
return instance;
|
|
197
214
|
}
|
|
198
215
|
|
|
199
|
-
/**
|
|
200
|
-
|
|
216
|
+
/**
|
|
217
|
+
* The slots of a new instance as boxes made on the page, each holding what `fill(slot)` gives (blocks
|
|
218
|
+
* made on the page), or an empty paragraph, where the reader writes: what the commit writes in them
|
|
219
|
+
* goes apart from the instance's markup (index.mjs `extras`), and the page knows each block of it by
|
|
220
|
+
* the commit's answer, as one made in a new column.
|
|
221
|
+
*/
|
|
222
|
+
function slotsMade(doc, instance, fill) {
|
|
223
|
+
for (const slot of slotsIn(instance)) {
|
|
224
|
+
const blocks = fill(slot);
|
|
225
|
+
slot.setAttribute("data-ge-box", "");
|
|
226
|
+
slot.setAttribute("data-ge-box-kind", "slot");
|
|
227
|
+
slot.replaceChildren(...(blocks.length > 0 ? blocks : [newHost(doc, "paragraph")]));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// What a template's slot holds, as blocks made on the page: read as HTML pasted from elsewhere is
|
|
232
|
+
// (clipboard/import/), each block what a paste makes of it there.
|
|
233
|
+
function blocksOfTemplate(doc, slot) {
|
|
234
|
+
if (!slot.firstElementChild && !slot.textContent.trim()) return [];
|
|
235
|
+
const specs = htmlToBlocks(parseClipboardHTML(slot.innerHTML), {});
|
|
236
|
+
return specs.length > 0 ? toBlocks(specs, "slot").map((block) => buildBlock(doc, block)) : [];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* An instance from what a clipboard carried (`data`): the file is written from that markup, which the
|
|
241
|
+
* commit sends, its slots empty; what they held comes as blocks of their own (`flows`, by name),
|
|
242
|
+
* made again here as any pasted block (`inner`).
|
|
243
|
+
*/
|
|
244
|
+
export function build({ doc, block, inner }) {
|
|
201
245
|
const entry = entryOf(block.package);
|
|
202
246
|
if (entry) bring(entry);
|
|
203
247
|
const instance = newInstance(doc, block.html);
|
|
204
248
|
instance.setAttribute("data-ge-copy", block.html);
|
|
249
|
+
slotsMade(doc, instance, (slot) => inner?.(block.flows?.[slot.getAttribute(SLOT)] ?? []) ?? []);
|
|
205
250
|
editableParts(instance);
|
|
206
251
|
return instance;
|
|
207
252
|
}
|
|
@@ -232,7 +277,7 @@ const inStep = (entry) => listed && entry !== null && !overtaken(entry);
|
|
|
232
277
|
* blocks where it came with none.
|
|
233
278
|
*/
|
|
234
279
|
function arrive(instance) {
|
|
235
|
-
if (!instance.isConnected || instance
|
|
280
|
+
if (!instance.isConnected || heldBy(instance)) return;
|
|
236
281
|
const id = instance.getAttribute(ATTRIBUTE);
|
|
237
282
|
const entry = entryOf(id);
|
|
238
283
|
if (isBehind(id) && !inStep(entry)) return void window.dispatchEvent(new CustomEvent("doc-components-changed"));
|
|
@@ -242,12 +287,34 @@ function arrive(instance) {
|
|
|
242
287
|
if (!instance.querySelector("[data-ge-block], [data-ge-part]")) editableParts(instance);
|
|
243
288
|
}
|
|
244
289
|
|
|
290
|
+
// A slot of the page's (a box) taken off an instance still on the page, by its component's script
|
|
291
|
+
// (`node`, what was taken off from `from`, before `next`; the instance itself taken off is the editor's
|
|
292
|
+
// doing, and none of this): a slot is the document's, which no component writes, so it goes back where
|
|
293
|
+
// it stood, what it holds with it, and the reader's blocks stay, on the page and in the file. Who
|
|
294
|
+
// wrote the package hears of it.
|
|
295
|
+
function keepSlots(node, from, next) {
|
|
296
|
+
if (node.nodeType !== 1 || node.matches(INSTANCE) || !from.isConnected) return;
|
|
297
|
+
const instance = from.closest(INSTANCE);
|
|
298
|
+
const slots = [node, ...node.querySelectorAll(SLOT_PART)].filter((slot) => slot.matches(`:is(${SLOT_PART})[data-ge-box]`) && !slot.parentElement?.closest(INSTANCE));
|
|
299
|
+
if (!instance || slots.length === 0) return;
|
|
300
|
+
for (const slot of slots) from.insertBefore(slot, next?.parentNode === from ? next : null);
|
|
301
|
+
console.error(`[DocKit] ${instance.getAttribute(ATTRIBUTE)}: a slot left its instance: it is put back, its blocks the document's`);
|
|
302
|
+
}
|
|
303
|
+
|
|
245
304
|
// A package's picture where a menu shows a mark.
|
|
246
305
|
const pictureOf = ({ preview }) => (preview ? `<img src="${preview}" alt="">` : null);
|
|
247
306
|
|
|
307
|
+
// A slot the file has empty (an Agent's): what a disclosure's content says (details/page.mjs), a click
|
|
308
|
+
// on it making a paragraph there (insert/ clickBlank).
|
|
309
|
+
const SLOT_EMPTY = `
|
|
310
|
+
[data-ge-editing] [data-doc-slot][data-ge-box]:not(:has(> *))::before { content: ${JSON.stringify(t("空白内容区。点击或拖动区块到这里。"))}; display: block; padding: 3px 2px; border-radius: 4px; color: var(--ge-tx3); cursor: pointer; transition: background 20ms ease-in; }
|
|
311
|
+
[data-ge-editing] [data-doc-slot][data-ge-box]:not(:has(> *)):hover::before { background: var(--ge-hover); }
|
|
312
|
+
`;
|
|
313
|
+
|
|
248
314
|
/** An instance on the page: what its events are, what Enter does in its words, and what the menus make of its package. */
|
|
249
|
-
export function create({ map, newParagraph, active, sourceStep }) {
|
|
315
|
+
export function create({ map, newParagraph, active, sourceStep, struct }) {
|
|
250
316
|
held = map;
|
|
317
|
+
addStyle(SLOT_EMPTY);
|
|
251
318
|
// Whether a key in an instance, on no field of it, is undo or redo: a button or what a component draws
|
|
252
319
|
// has no undo of its own, and a press on one that wrote leaves the focus there, from where the page's
|
|
253
320
|
// undo goes on through every step, as notion-lite's does from anywhere (onHistoryKey). A field keeps
|
|
@@ -294,12 +361,30 @@ export function create({ map, newParagraph, active, sourceStep }) {
|
|
|
294
361
|
return true;
|
|
295
362
|
}
|
|
296
363
|
return {
|
|
297
|
-
keepsKeys: (node, event) =>
|
|
298
|
-
undoHere: (node) =>
|
|
364
|
+
keepsKeys: (node, event) => componentAt(node) && !editable(node) && !pageUndo(node, event),
|
|
365
|
+
undoHere: (node) => componentAt(node) && !editable(node),
|
|
299
366
|
keys: {
|
|
300
|
-
//
|
|
301
|
-
//
|
|
367
|
+
// In a text part with a slot after it (in the file's order): the caret goes into the slot, as from
|
|
368
|
+
// a disclosure's title into its content (details/page.mjs), at the start of its first block, or in
|
|
369
|
+
// a paragraph made first in it, one step of undo. Else notion-lite's captionEnter: words of a
|
|
370
|
+
// block that are not the block's own line do not split, Enter there is a text block after the
|
|
371
|
+
// block, the caret in it.
|
|
302
372
|
enter({ host }) {
|
|
373
|
+
const instance = host.parentElement?.closest(INSTANCE);
|
|
374
|
+
const slot = instance && slotsIn(instance).find((each) => each.hasAttribute("data-ge-box") && host.compareDocumentPosition(each) & Node.DOCUMENT_POSITION_FOLLOWING && !host.contains(each));
|
|
375
|
+
if (slot) {
|
|
376
|
+
const first = firstHost(slot);
|
|
377
|
+
if (first) caretAt(first, "start");
|
|
378
|
+
else {
|
|
379
|
+
const paragraph = newHost(document, "paragraph");
|
|
380
|
+
struct([slot], [], () => {
|
|
381
|
+
slot.prepend(paragraph);
|
|
382
|
+
return { touched: [paragraph], focus: paragraph };
|
|
383
|
+
});
|
|
384
|
+
caretAt(paragraph, "start");
|
|
385
|
+
}
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
303
388
|
const unit = unitElement(host);
|
|
304
389
|
const box = unit?.parentElement;
|
|
305
390
|
if (!box || !accepts(box.getAttribute("data-ge-box-kind") ?? "flow", "paragraph")) return false;
|
|
@@ -311,30 +396,56 @@ export function create({ map, newParagraph, active, sourceStep }) {
|
|
|
311
396
|
// by block types), by its id, as notion-lite's variants: a row of the menus, found by its name in
|
|
312
397
|
// either language and its words, and what makes one (notion-lite's
|
|
313
398
|
// insertTypedBlock: the caret in its first text part; with none, in an empty paragraph after it, as
|
|
314
|
-
// for a divider).
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
399
|
+
// for a divider). Its slots are boxes made on the page at once, what the template has in each made
|
|
400
|
+
// blocks of the page's (an empty paragraph where it has none), so that the reader writes in one
|
|
401
|
+
// before the instance is saved, and Enter in a text part goes into the slot after it. One whose needs
|
|
402
|
+
// hold "tables" is a view a table's 视图 › offers too (`readsTables`: page/table/views.mjs), which
|
|
403
|
+
// binds the one it makes to the table (VIEW_FROM). Where two offered have one name (the same block
|
|
404
|
+
// of two packs: 我的待办 of Gallery 风格 and of 柔光风格), each row says its pack's name after it in grey
|
|
405
|
+
// (`of`: the menu's ge-pop-of).
|
|
406
|
+
menuVariants: () => {
|
|
407
|
+
const offered = (map.components ?? []).filter(({ template, state }) => template && state === "normal");
|
|
408
|
+
const counts = new Map();
|
|
409
|
+
for (const entry of offered) counts.set(entry.name[language], (counts.get(entry.name[language]) ?? 0) + 1);
|
|
410
|
+
return Object.fromEntries(offered.map((entry) => [entry.id, {
|
|
411
|
+
label: entry.name[language],
|
|
412
|
+
...(counts.get(entry.name[language]) > 1 ? { of: entry.pack?.name?.[language] ?? entry.id.split("/")[0] } : {}),
|
|
413
|
+
icon: pictureOf(entry) ?? ICON,
|
|
414
|
+
words: `${entry.name.zh} ${entry.name.en} ${entry.id} ${entry.words}`.toLowerCase(),
|
|
415
|
+
sample: true,
|
|
416
|
+
readsTables: entry.needs?.includes("tables") ?? false,
|
|
417
|
+
preview: { src: entry.preview, says: entry.description[language] },
|
|
418
|
+
create({ doc, put: place, paragraph }) {
|
|
419
|
+
bring(entry);
|
|
420
|
+
const instance = newInstance(doc, entry.template);
|
|
421
|
+
slotsMade(doc, instance, (slot) => blocksOfTemplate(doc, slot));
|
|
422
|
+
ownIds(doc, [instance]);
|
|
423
|
+
place(instance);
|
|
424
|
+
return editableParts(instance)[0] ?? firstHost(instance) ?? place(paragraph());
|
|
425
|
+
},
|
|
426
|
+
}]));
|
|
427
|
+
},
|
|
428
|
+
/**
|
|
429
|
+
* Whether a copy of an instance's unit stands for it: not where it has slots, whose blocks that copy
|
|
430
|
+
* would write whole, with no ids the page knows; such an instance is copied by what it carries alone
|
|
431
|
+
* (index.mjs `data`: its slots' blocks apart), in its document too.
|
|
432
|
+
*/
|
|
433
|
+
copiesAsItself: (unit) => slotsIn(unit).length === 0,
|
|
329
434
|
/** What the reader calls a block of it: its package's name, where the page knows its package. */
|
|
330
435
|
nameOf: (unit) => entryOf(unit.getAttribute(ATTRIBUTE))?.name[language] ?? null,
|
|
331
436
|
/**
|
|
332
437
|
* One the file dropped that the page still shows, a reader's to keep: it goes from now on as what a
|
|
333
|
-
* clipboard carried does, its markup as the kit would start it
|
|
334
|
-
* the
|
|
438
|
+
* clipboard carried does, its markup as the kit would start it, its slots empty: what they hold is
|
|
439
|
+
* made on the page from now on too (sync-state.mjs asMade), and goes apart (index.mjs `extras`).
|
|
440
|
+
* Its template would not hold what the reader has.
|
|
335
441
|
*/
|
|
336
442
|
renew(instance) {
|
|
337
|
-
if (!instance.hasAttribute("data-ge-copy"))
|
|
443
|
+
if (!instance.hasAttribute("data-ge-copy")) {
|
|
444
|
+
const copy = copyOf(instance, { named: true });
|
|
445
|
+
const boxes = slotsIn(instance).map((slot) => slot.hasAttribute("data-ge-box"));
|
|
446
|
+
slotsIn(copy).forEach((slot, index) => { if (boxes[index]) slot.replaceChildren(); });
|
|
447
|
+
instance.setAttribute("data-ge-copy", copy.outerHTML);
|
|
448
|
+
}
|
|
338
449
|
instance.setAttribute("data-ge-type", "installed");
|
|
339
450
|
return true;
|
|
340
451
|
},
|
|
@@ -401,12 +512,13 @@ export function create({ map, newParagraph, active, sourceStep }) {
|
|
|
401
512
|
}
|
|
402
513
|
document.addEventListener("doc-component-edit", (event) => { if (write(event.detail, event.target)) event.preventDefault(); });
|
|
403
514
|
new MutationObserver((records) => {
|
|
404
|
-
for (const { type, target, addedNodes } of records) {
|
|
515
|
+
for (const { type, target, addedNodes, removedNodes, nextSibling } of records) {
|
|
405
516
|
if (type === "attributes") followFallback(target);
|
|
406
517
|
for (const node of addedNodes) {
|
|
407
518
|
if (node.nodeType !== 1 || node.hasAttribute("data-doc-dev")) continue;
|
|
408
519
|
[...(node.matches(INSTANCE) ? [node] : []), ...node.querySelectorAll(INSTANCE)].forEach(arrive);
|
|
409
520
|
}
|
|
521
|
+
for (const node of removedNodes) keepSlots(node, target, nextSibling);
|
|
410
522
|
}
|
|
411
523
|
}).observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: [FALLBACK] });
|
|
412
524
|
window.addEventListener("doc-catalog-changed", readList);
|
|
@@ -17,13 +17,14 @@ let any = false; // the server could not say which: the page connected a moment
|
|
|
17
17
|
export const isBehind = (id) => any || behind.has(id);
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* `components`, the list a page holds, as the reader's settings now say: the state each package says
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* `components`, the list a page holds, as the reader's settings now say: the state each package says
|
|
21
|
+
* by its `places` and gallery.json's hidden, shown, disabled, unlisted and packs off (settingState, inDocumentMenus: the
|
|
22
|
+
* server's own rule), which a menu reads, at once and with nothing shown again (`doc-settings-changed`).
|
|
23
|
+
* A package that comes on is in none of that yet: it comes with the list the page reads as the catalog
|
|
24
|
+
* changes, as one added does (`doc-catalog-changed`, ./page.mjs).
|
|
24
25
|
*/
|
|
25
26
|
export function followSettings(components, settings) {
|
|
26
|
-
for (const entry of components) entry.state = settingState(entry.id, settings);
|
|
27
|
+
for (const entry of components) entry.state = settingState(entry.id, { hidden: [], shown: [], disabled: [], unlisted: [], packsOff: [], ...settings }, entry.places);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/** Hears what changed of the catalog while the page held no instance of it. */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ATTRIBUTE, INSTANCE } from "../../shared/components/installed.mjs";
|
|
2
|
+
|
|
3
|
+
// A custom page's card read for the instance it holds, by the host's own mark of an instance
|
|
4
|
+
// (shared/components/installed.mjs INSTANCE, ATTRIBUTE: a div or section naming its package): the one
|
|
5
|
+
// the server reads (shared/page-cards.mjs readPage, which refuses an article or a span carrying the
|
|
6
|
+
// attribute, and page check fails it) and the kit's page runtime reads. The board
|
|
7
|
+
// (src/editor/page/board/index.mjs) is a page engine and knows no package's marks, so what it asks of
|
|
8
|
+
// the DOM it asks here: a card with an `<article data-doc-component="…">` is a card with no instance on
|
|
9
|
+
// the page too, offered no settings and sending no part, instead of one the service then refuses.
|
|
10
|
+
|
|
11
|
+
/** The instance card `card` holds (its child that is one), or null. */
|
|
12
|
+
export const instanceOf = (card) => [...card.children].find((child) => child.matches(INSTANCE)) ?? null;
|
|
13
|
+
|
|
14
|
+
/** The package id an instance names (<scope>/<name>), or null for no instance. */
|
|
15
|
+
export const packageOf = (instance) => instance?.getAttribute(ATTRIBUTE) ?? null;
|
|
16
|
+
|
|
17
|
+
/** The nearest instance around `node` (itself counted), or null. */
|
|
18
|
+
export const instanceAround = (node) => node.closest(INSTANCE);
|
|
@@ -51,6 +51,9 @@ export const CODE = Object.freeze({
|
|
|
51
51
|
/** A highlight block, the opening summary included: the one place the editor says which elements are one. */
|
|
52
52
|
export const HIGHLIGHT = Object.freeze({ match: component("highlight").match });
|
|
53
53
|
|
|
54
|
+
/** A callout (提示块). */
|
|
55
|
+
export const CALLOUT = Object.freeze({ match: component("callout").match });
|
|
56
|
+
|
|
54
57
|
// A display formula block and an inline one (the math description's two rules).
|
|
55
58
|
const [mathInline, mathBlock] = component("math").match.split(",").map((rule) => rule.trim());
|
|
56
59
|
export const MATH = Object.freeze({ inline: mathInline, block: mathBlock });
|
|
@@ -6,7 +6,7 @@ import { begin, done, made } from "../../page/made.mjs";
|
|
|
6
6
|
import { createMenu } from "../../page/menu.mjs";
|
|
7
7
|
import { keptByComponent } from "../../page/page-objects.mjs";
|
|
8
8
|
import { hideTooltip, tooltipAt } from "../../page/tooltip.mjs";
|
|
9
|
-
import { addStyle, element } from "../../page/ui.mjs";
|
|
9
|
+
import { addStyle, element, textButton } from "../../page/ui.mjs";
|
|
10
10
|
import { CHECKED, CONTINUE, FLOW, START, TODO, heldListType, holdsSays, listType, mergeSays } from "./index.mjs";
|
|
11
11
|
import { BLOCK_TYPES, accepts } from "../registry.mjs";
|
|
12
12
|
import { FLOW_KEY, isFlowLabel } from "../../../shared/components/list.mjs";
|
|
@@ -186,8 +186,7 @@ const STYLE = `
|
|
|
186
186
|
.ge-list-value-title { padding: 10px 12px 0; color: var(--ge-tx2); font-size: 12px; font-weight: 500; line-height: 14px; }
|
|
187
187
|
.ge-list-value input { box-sizing: border-box; flex: 1; min-width: 0; height: 28px; margin: 0; padding: 0 8px; border: 0; border-radius: 6px; outline: none; background: var(--ge-hover); color: var(--ge-tx); font: inherit; box-shadow: inset 0 0 0 1px var(--ge-line); }
|
|
188
188
|
.ge-list-value input:focus { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ge-tx3) 60%, transparent); }
|
|
189
|
-
.ge-list-value
|
|
190
|
-
.ge-list-value button:hover { background: var(--ge-accent-hover); }
|
|
189
|
+
.ge-list-value .ge-btn { flex: none; }
|
|
191
190
|
`;
|
|
192
191
|
|
|
193
192
|
// ---------- keys, numbers ----------
|
|
@@ -494,9 +493,7 @@ export function create({ struct, say, convertHost, targetsOf, look, isEditing, b
|
|
|
494
493
|
} else return;
|
|
495
494
|
event.preventDefault();
|
|
496
495
|
});
|
|
497
|
-
const confirm =
|
|
498
|
-
confirm.addEventListener("mousedown", (event) => event.preventDefault());
|
|
499
|
-
confirm.addEventListener("click", apply);
|
|
496
|
+
const confirm = textButton(t("确定"), apply, { primary: true });
|
|
500
497
|
const view = element("div", {}, element("div", { class: "ge-list-value-title", text: t("新编号为") }), element("div", { class: "ge-list-value" }, field, confirm));
|
|
501
498
|
item.setAttribute("data-ge-number", "open");
|
|
502
499
|
menu.open([{ node: view, cells: [] }], rect, { label: t("修改编号值"), icons: false, width: 148, highlight: false, onClose: () => item.removeAttribute("data-ge-number") });
|