@heycys/gallery 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +50 -2
- package/THIRD-PARTY-NOTICES.md +3303 -0
- package/assets/writing-preferences.md +107 -0
- package/bin/gallery.mjs +10 -0
- package/browser/editor/components/bookmark/icons.mjs +6 -0
- package/browser/editor/components/bookmark/index.mjs +80 -0
- package/browser/editor/components/bookmark/page.mjs +147 -0
- package/browser/editor/components/builders.mjs +19 -0
- package/browser/editor/components/callout/index.mjs +64 -0
- package/browser/editor/components/code/index.mjs +327 -0
- package/browser/editor/components/code/page.mjs +561 -0
- package/browser/editor/components/colors.mjs +50 -0
- package/browser/editor/components/columns/index.mjs +104 -0
- package/browser/editor/components/columns/page.mjs +310 -0
- package/browser/editor/components/details/index.mjs +73 -0
- package/browser/editor/components/details/page.mjs +86 -0
- package/browser/editor/components/dialog/index.mjs +84 -0
- package/browser/editor/components/dialog/page.mjs +201 -0
- package/browser/editor/components/divider/index.mjs +48 -0
- package/browser/editor/components/embed/icons.mjs +11 -0
- package/browser/editor/components/embed/index.mjs +123 -0
- package/browser/editor/components/embed/page.mjs +309 -0
- package/browser/editor/components/figure/index.mjs +87 -0
- package/browser/editor/components/figure/page.mjs +42 -0
- package/browser/editor/components/file/icons.mjs +14 -0
- package/browser/editor/components/file/index.mjs +77 -0
- package/browser/editor/components/file/page.mjs +114 -0
- package/browser/editor/components/flowchart/add.mjs +123 -0
- package/browser/editor/components/flowchart/index.mjs +246 -0
- package/browser/editor/components/flowchart/page.mjs +453 -0
- package/browser/editor/components/heading/index.mjs +53 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +63 -0
- package/browser/editor/components/icon/index.mjs +57 -0
- package/browser/editor/components/icon/page.mjs +286 -0
- package/browser/editor/components/icons.mjs +48 -0
- package/browser/editor/components/image/crop.mjs +189 -0
- package/browser/editor/components/image/index.mjs +104 -0
- package/browser/editor/components/image/page.mjs +385 -0
- package/browser/editor/components/image/viewer.mjs +213 -0
- package/browser/editor/components/installed/index.mjs +179 -0
- package/browser/editor/components/installed/page.mjs +523 -0
- package/browser/editor/components/installed/served.mjs +35 -0
- package/browser/editor/components/kit.mjs +67 -0
- package/browser/editor/components/list/index.mjs +194 -0
- package/browser/editor/components/list/join.mjs +68 -0
- package/browser/editor/components/list/numbers.mjs +107 -0
- package/browser/editor/components/list/page.mjs +632 -0
- package/browser/editor/components/math/index.mjs +88 -0
- package/browser/editor/components/math/page.mjs +236 -0
- package/browser/editor/components/math/tex-logo.mjs +6 -0
- package/browser/editor/components/media/icons.mjs +19 -0
- package/browser/editor/components/media/page.mjs +192 -0
- package/browser/editor/components/media/parts.mjs +60 -0
- package/browser/editor/components/media/size.mjs +20 -0
- package/browser/editor/components/media/toolbar.mjs +37 -0
- package/browser/editor/components/media/write.mjs +7 -0
- package/browser/editor/components/pages.mjs +46 -0
- package/browser/editor/components/paragraph/index.mjs +43 -0
- package/browser/editor/components/paragraph/page.mjs +52 -0
- package/browser/editor/components/placeholder-bar.mjs +17 -0
- package/browser/editor/components/placeholder.mjs +128 -0
- package/browser/editor/components/quote/index.mjs +33 -0
- package/browser/editor/components/registry.mjs +859 -0
- package/browser/editor/components/rows.mjs +16 -0
- package/browser/editor/components/section/index.mjs +42 -0
- package/browser/editor/components/section/page.mjs +141 -0
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/sheets/index.mjs +137 -0
- package/browser/editor/components/sheets/page.mjs +227 -0
- package/browser/editor/components/sheets/pills.mjs +226 -0
- package/browser/editor/components/table/grid.mjs +73 -0
- package/browser/editor/components/table/index.mjs +308 -0
- package/browser/editor/components/table/page.mjs +683 -0
- package/browser/editor/components/table/slots.mjs +41 -0
- package/browser/editor/components/widget/index.mjs +50 -0
- package/browser/editor/page/annotate/anchors.mjs +230 -0
- package/browser/editor/page/annotate/card.mjs +102 -0
- package/browser/editor/page/annotate/index.mjs +1656 -0
- package/browser/editor/page/at-menu/index.mjs +317 -0
- package/browser/editor/page/autosave.mjs +1023 -0
- package/browser/editor/page/beside.mjs +21 -0
- package/browser/editor/page/block-info.mjs +63 -0
- package/browser/editor/page/block-menu/colors.mjs +84 -0
- package/browser/editor/page/block-menu/index.mjs +217 -0
- package/browser/editor/page/blocks.mjs +255 -0
- package/browser/editor/page/caret.mjs +682 -0
- package/browser/editor/page/changes/bar.mjs +102 -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/chip-fills.mjs +126 -0
- package/browser/editor/page/clipboard/import/colors.mjs +192 -0
- package/browser/editor/page/clipboard/import/html.mjs +792 -0
- package/browser/editor/page/clipboard/import/inline.mjs +232 -0
- package/browser/editor/page/clipboard/import/languages.mjs +42 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
- package/browser/editor/page/clipboard/import/math.mjs +100 -0
- package/browser/editor/page/clipboard/import/office.mjs +245 -0
- package/browser/editor/page/clipboard/import/read.mjs +120 -0
- package/browser/editor/page/clipboard/import/rich.mjs +29 -0
- package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
- package/browser/editor/page/clipboard/index.mjs +816 -0
- package/browser/editor/page/clipboard/own/blocks.mjs +211 -0
- package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
- package/browser/editor/page/clipboard/own/describe.mjs +124 -0
- package/browser/editor/page/clipboard/own/export.mjs +167 -0
- package/browser/editor/page/clipboard/own/ids.mjs +39 -0
- package/browser/editor/page/clipboard/own/index.mjs +13 -0
- package/browser/editor/page/clipboard/own/rules.mjs +44 -0
- package/browser/editor/page/clipboard/own/selection.mjs +159 -0
- package/browser/editor/page/clipboard/own/writers.mjs +315 -0
- package/browser/editor/page/columns/index.mjs +360 -0
- package/browser/editor/page/commit.mjs +1813 -0
- package/browser/editor/page/conflicts.mjs +249 -0
- package/browser/editor/page/convert.mjs +831 -0
- package/browser/editor/page/core.mjs +1693 -0
- package/browser/editor/page/drag/drop.mjs +307 -0
- package/browser/editor/page/drag/index.mjs +351 -0
- package/browser/editor/page/drag/preview.mjs +126 -0
- package/browser/editor/page/edge-scroll.mjs +50 -0
- package/browser/editor/page/editor.mjs +1780 -0
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +287 -0
- package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
- package/browser/editor/page/emoji-picker/grid.mjs +81 -0
- package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
- package/browser/editor/page/emoji-picker/icons.mjs +31 -0
- package/browser/editor/page/emoji-picker/index.mjs +166 -0
- package/browser/editor/page/emoji-picker/styles.mjs +161 -0
- package/browser/editor/page/emoji-picker/support.mjs +204 -0
- package/browser/editor/page/emoji-picker/upload.mjs +236 -0
- package/browser/editor/page/export-report.mjs +23 -0
- package/browser/editor/page/fills.mjs +62 -0
- package/browser/editor/page/find/index.mjs +107 -0
- package/browser/editor/page/flags.mjs +70 -0
- 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 +449 -0
- package/browser/editor/page/format-bar/brush.mjs +77 -0
- package/browser/editor/page/format-bar/colors.mjs +46 -0
- package/browser/editor/page/format-bar/index.mjs +404 -0
- package/browser/editor/page/formula/index.mjs +236 -0
- package/browser/editor/page/formula/panel.mjs +336 -0
- package/browser/editor/page/formula/symbols.mjs +156 -0
- package/browser/editor/page/frame.mjs +74 -0
- package/browser/editor/page/frames.mjs +196 -0
- package/browser/editor/page/geometry.mjs +402 -0
- package/browser/editor/page/gesture.mjs +45 -0
- package/browser/editor/page/handle/index.mjs +650 -0
- package/browser/editor/page/handle-sizes.mjs +14 -0
- package/browser/editor/page/hints/index.mjs +84 -0
- package/browser/editor/page/history.mjs +401 -0
- package/browser/editor/page/insert/index.mjs +256 -0
- package/browser/editor/page/kept.mjs +38 -0
- package/browser/editor/page/links/address.mjs +40 -0
- package/browser/editor/page/links/index.mjs +866 -0
- package/browser/editor/page/links/pages.mjs +131 -0
- package/browser/editor/page/links/views.mjs +369 -0
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +77 -0
- package/browser/editor/page/made.mjs +24 -0
- package/browser/editor/page/margin.mjs +373 -0
- package/browser/editor/page/markdown/index.mjs +88 -0
- package/browser/editor/page/markdown/rules.mjs +33 -0
- package/browser/editor/page/marks.mjs +377 -0
- package/browser/editor/page/media-menu/index.mjs +158 -0
- package/browser/editor/page/menu.mjs +544 -0
- package/browser/editor/page/merge.mjs +124 -0
- package/browser/editor/page/notices.mjs +142 -0
- package/browser/editor/page/offered.mjs +32 -0
- package/browser/editor/page/outline/folds.mjs +53 -0
- package/browser/editor/page/outline/index.mjs +783 -0
- package/browser/editor/page/outline/list.mjs +184 -0
- package/browser/editor/page/outline/read.mjs +201 -0
- package/browser/editor/page/outline/strip.mjs +287 -0
- package/browser/editor/page/outline/tree.mjs +248 -0
- package/browser/editor/page/overlay-layer.mjs +227 -0
- package/browser/editor/page/overlays.mjs +205 -0
- package/browser/editor/page/own.mjs +28 -0
- package/browser/editor/page/pads.mjs +71 -0
- package/browser/editor/page/page-objects.mjs +105 -0
- package/browser/editor/page/panel.mjs +65 -0
- package/browser/editor/page/placement.mjs +58 -0
- package/browser/editor/page/post.mjs +41 -0
- package/browser/editor/page/present-links.mjs +50 -0
- package/browser/editor/page/quiet.mjs +48 -0
- package/browser/editor/page/resize/index.mjs +327 -0
- package/browser/editor/page/select-all/index.mjs +262 -0
- package/browser/editor/page/selection/delete.mjs +61 -0
- package/browser/editor/page/selection/index.mjs +164 -0
- package/browser/editor/page/selection/marquee.mjs +174 -0
- package/browser/editor/page/session.mjs +168 -0
- package/browser/editor/page/slash-menu/index.mjs +291 -0
- package/browser/editor/page/storage.mjs +48 -0
- package/browser/editor/page/sync-state.mjs +267 -0
- package/browser/editor/page/table/aligns.mjs +29 -0
- package/browser/editor/page/table/cell-bar.mjs +141 -0
- package/browser/editor/page/table/cells.mjs +527 -0
- package/browser/editor/page/table/icons.mjs +40 -0
- package/browser/editor/page/table/index.mjs +990 -0
- package/browser/editor/page/table/lists.mjs +187 -0
- package/browser/editor/page/table/widths.mjs +313 -0
- package/browser/editor/page/tex.mjs +32 -0
- package/browser/editor/page/text-select/index.mjs +671 -0
- package/browser/editor/page/tooltip.mjs +98 -0
- package/browser/editor/page/type-grid.mjs +83 -0
- package/browser/editor/page/typing/code-edges.mjs +274 -0
- package/browser/editor/page/typing/index.mjs +282 -0
- package/browser/editor/page/typing/leave.mjs +68 -0
- package/browser/editor/page/ui.mjs +160 -0
- package/browser/shared/annotations.mjs +569 -0
- package/browser/shared/code-folds.mjs +14 -0
- package/browser/shared/code-languages.mjs +70 -0
- package/browser/shared/code-lines.mjs +30 -0
- package/browser/shared/colors.mjs +30 -0
- package/browser/shared/component-catalog.mjs +573 -0
- package/browser/shared/components/bookmark.mjs +26 -0
- package/browser/shared/components/callout.mjs +9 -0
- package/browser/shared/components/chart.mjs +20 -0
- package/browser/shared/components/code.mjs +37 -0
- package/browser/shared/components/columns.mjs +16 -0
- package/browser/shared/components/details.mjs +15 -0
- package/browser/shared/components/dialog.mjs +28 -0
- package/browser/shared/components/diff.mjs +18 -0
- package/browser/shared/components/divider.mjs +6 -0
- package/browser/shared/components/embed.mjs +25 -0
- package/browser/shared/components/figure.mjs +14 -0
- package/browser/shared/components/file.mjs +23 -0
- package/browser/shared/components/heading.mjs +6 -0
- package/browser/shared/components/highlight.mjs +9 -0
- package/browser/shared/components/icon.mjs +18 -0
- package/browser/shared/components/image.mjs +39 -0
- package/browser/shared/components/index.mjs +396 -0
- package/browser/shared/components/installed.mjs +232 -0
- package/browser/shared/components/list.mjs +146 -0
- package/browser/shared/components/math.mjs +49 -0
- package/browser/shared/components/mention.mjs +33 -0
- package/browser/shared/components/page.mjs +46 -0
- package/browser/shared/components/paragraph.mjs +9 -0
- package/browser/shared/components/quote.mjs +6 -0
- package/browser/shared/components/section.mjs +8 -0
- package/browser/shared/components/sheets.mjs +80 -0
- package/browser/shared/components/state.mjs +20 -0
- package/browser/shared/components/table.mjs +49 -0
- package/browser/shared/components/text.mjs +14 -0
- package/browser/shared/components/widget.mjs +10 -0
- package/browser/shared/copy-ids.mjs +72 -0
- package/browser/shared/css-references.mjs +110 -0
- package/browser/shared/document-look.mjs +178 -0
- package/browser/shared/emoji/custom.mjs +91 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
- package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
- package/browser/shared/emoji/data/README.md +28 -0
- package/browser/shared/emoji/data/categories.json +1 -0
- package/browser/shared/emoji/data/icons.json +1 -0
- package/browser/shared/emoji/data/keywords-en.json +1 -0
- package/browser/shared/emoji/data/keywords-zh.json +1 -0
- package/browser/shared/emoji/data/names.json +1 -0
- package/browser/shared/emoji/data/positions.json +1 -0
- package/browser/shared/emoji/data/twemoji-index.json +1 -0
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +194 -0
- package/browser/shared/emoji/emoji.mjs +38 -0
- package/browser/shared/emoji/glyphs.mjs +134 -0
- package/browser/shared/emoji/icon-value.mjs +91 -0
- package/browser/shared/escape.mjs +20 -0
- package/browser/shared/export-wrap.mjs +89 -0
- package/browser/shared/files.mjs +33 -0
- package/browser/shared/html-tree.mjs +59 -0
- package/browser/shared/http.mjs +22 -0
- package/browser/shared/i18n/en.mjs +1223 -0
- package/browser/shared/i18n/index.mjs +132 -0
- package/browser/shared/ids.mjs +24 -0
- package/browser/shared/import-types.mjs +23 -0
- package/browser/shared/inline-spacing.mjs +97 -0
- package/browser/shared/layers.mjs +42 -0
- package/browser/shared/long-runs.mjs +39 -0
- package/browser/shared/media.mjs +162 -0
- package/browser/shared/new-names.mjs +67 -0
- package/browser/shared/number-reading.mjs +92 -0
- package/browser/shared/old-names.mjs +143 -0
- package/browser/shared/outline.mjs +194 -0
- package/browser/shared/page-address.mjs +140 -0
- package/browser/shared/page-links.mjs +86 -0
- package/browser/shared/paths.mjs +73 -0
- package/browser/shared/preferences.mjs +116 -0
- package/browser/shared/preview-server.mjs +247 -0
- package/browser/shared/qa-levels.mjs +93 -0
- package/browser/shared/reading-place.mjs +91 -0
- package/browser/shared/renamed-storage.mjs +220 -0
- package/browser/shared/reports.mjs +46 -0
- package/browser/shared/search.mjs +85 -0
- package/browser/shared/session.mjs +77 -0
- package/browser/shared/table-chart.mjs +113 -0
- package/browser/shared/table-hides.mjs +120 -0
- package/browser/shared/table-slots.mjs +75 -0
- package/browser/shared/words.mjs +23 -0
- package/browser/shared/workspace-look.mjs +91 -0
- package/browser/shared/workspace.mjs +535 -0
- package/browser/shared/writing-preferences.mjs +68 -0
- package/browser/shared/zoom.mjs +57 -0
- package/dist/chunk-2B5E4CDJ.mjs +2 -0
- package/dist/chunk-342HXE3Q.mjs +2 -0
- package/dist/chunk-3HIRPVLU.mjs +2 -0
- package/dist/chunk-43B75J5T.mjs +2 -0
- package/dist/chunk-4FS7Z7WR.mjs +2 -0
- package/dist/chunk-4K5KC6V2.mjs +2 -0
- package/dist/chunk-5L7RYZCL.mjs +2 -0
- package/dist/chunk-5MHMDLZD.mjs +4 -0
- package/dist/chunk-5ZKJ3H4P.mjs +8 -0
- package/dist/chunk-64K7IPLO.mjs +255 -0
- package/dist/chunk-6QXGZM36.mjs +8 -0
- package/dist/chunk-6RGJOMJP.mjs +16 -0
- package/dist/chunk-742D2WWJ.mjs +19 -0
- package/dist/chunk-7DTINW6U.mjs +48 -0
- package/dist/chunk-A55HN5OK.mjs +2 -0
- package/dist/chunk-AGDILNWB.mjs +2 -0
- package/dist/chunk-AJ73XJF3.mjs +2 -0
- package/dist/chunk-AUZGSZJH.mjs +13 -0
- package/dist/chunk-BFE45AKL.mjs +2 -0
- package/dist/chunk-BGGDRNYQ.mjs +10 -0
- package/dist/chunk-BXO2ZY5P.mjs +2 -0
- package/dist/chunk-C564NU2H.mjs +77 -0
- package/dist/chunk-CEH4MRCC.mjs +2 -0
- package/dist/chunk-CY2FNNAB.mjs +16 -0
- package/dist/chunk-DFUDV4LX.mjs +2 -0
- package/dist/chunk-DKXG4XDG.mjs +2 -0
- package/dist/chunk-E7LWZRXY.mjs +4 -0
- package/dist/chunk-EZQ34M3F.mjs +124 -0
- package/dist/chunk-EZY3WC6Z.mjs +15 -0
- package/dist/chunk-FDLXYYG4.mjs +4 -0
- package/dist/chunk-FUKQNOQS.mjs +9 -0
- package/dist/chunk-GB5SOYQJ.mjs +7 -0
- package/dist/chunk-GRAXKKG4.mjs +2 -0
- package/dist/chunk-HYMEEXKN.mjs +4 -0
- package/dist/chunk-IVDLMMBD.mjs +2 -0
- package/dist/chunk-JPOSLGOC.mjs +6 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-L3QKH4OK.mjs +26 -0
- package/dist/chunk-LAE5NQ4B.mjs +2 -0
- package/dist/chunk-LCTHTZIL.mjs +960 -0
- package/dist/chunk-LEF6DRCK.mjs +59 -0
- package/dist/chunk-LKX55H76.mjs +2 -0
- package/dist/chunk-LS4F7JUM.mjs +2 -0
- package/dist/chunk-MAFIGVXY.mjs +2 -0
- package/dist/chunk-NO5NJCHO.mjs +2 -0
- package/dist/chunk-NQPVAU63.mjs +2 -0
- package/dist/chunk-NSKUTQ5J.mjs +5 -0
- package/dist/chunk-O35FIXRB.mjs +2 -0
- package/dist/chunk-P2CAZPDP.mjs +3 -0
- package/dist/chunk-PL6GHLGD.mjs +15 -0
- package/dist/chunk-QAIHRH3I.mjs +13 -0
- package/dist/chunk-QJIR2BLP.mjs +6 -0
- package/dist/chunk-QR6A54KJ.mjs +3 -0
- package/dist/chunk-QUPLVPB2.mjs +7 -0
- package/dist/chunk-R7BNENLY.mjs +4 -0
- package/dist/chunk-S6O4UHLC.mjs +2 -0
- package/dist/chunk-SGJWQKEI.mjs +2 -0
- package/dist/chunk-SYGN7GLU.mjs +2 -0
- package/dist/chunk-TMYZB6AV.mjs +2 -0
- package/dist/chunk-TX6JH7TR.mjs +2 -0
- package/dist/chunk-TYK6VNAB.mjs +10 -0
- package/dist/chunk-U3SSPL4K.mjs +8 -0
- package/dist/chunk-U6KNPJPR.mjs +2 -0
- package/dist/chunk-UALRNVSE.mjs +4 -0
- package/dist/chunk-UH4SIXTR.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-V3HXVQEM.mjs +2 -0
- package/dist/chunk-V5JTW2LH.mjs +27 -0
- package/dist/chunk-V5VXUJKG.mjs +2 -0
- package/dist/chunk-V6XZ4VIR.mjs +2 -0
- package/dist/chunk-VBXMADMP.mjs +2 -0
- package/dist/chunk-VNV55RUA.mjs +2 -0
- package/dist/chunk-VPD2PS35.mjs +2 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-W4VKN3GF.mjs +7 -0
- package/dist/chunk-W5BXXPDJ.mjs +3 -0
- package/dist/chunk-W7XHE4CT.mjs +2 -0
- package/dist/chunk-XNROSH2T.mjs +4 -0
- package/dist/chunk-XUNHRCOG.mjs +6 -0
- package/dist/chunk-Y34NR5JL.mjs +2 -0
- package/dist/chunk-Y6RLRPG3.mjs +3 -0
- package/dist/chunk-YEY3RSFQ.mjs +2 -0
- package/dist/cli.mjs +2 -0
- package/dist/server.mjs +2 -0
- package/dist/worker.mjs +5 -0
- package/kit/charts.js +355 -0
- package/kit/code.js +164 -0
- package/kit/dialogs.js +157 -0
- package/kit/math.js +2004 -0
- package/kit/report.css +2932 -0
- package/kit/runtime.js +1782 -0
- package/kit/sheets.js +123 -0
- package/kit/state.js +217 -0
- package/kit/tables.js +1499 -0
- package/kit/tokens.js +29 -0
- package/kit/ui.js +658 -0
- package/package.json +41 -4
- package/release.json +25 -0
- package/sdk/column-widths.d.ts +56 -0
- package/sdk/doc-charts.d.ts +82 -0
- package/sdk/doc-code.d.ts +28 -0
- package/sdk/doc-dialogs.d.ts +4 -0
- package/sdk/doc-kit.d.ts +147 -0
- package/sdk/doc-math.d.ts +3 -0
- package/sdk/doc-sheets.d.ts +15 -0
- package/sdk/doc-state.d.ts +41 -0
- package/sdk/doc-tables.d.ts +24 -0
- package/sdk/doc-tokens.d.ts +22 -0
- package/sdk/index.d.ts +30 -0
- package/skill/SKILL.md +150 -0
- package/skill/agents/openai.yaml +5 -0
- package/skill/references/building-components.md +367 -0
- package/skill/references/example-report.html +356 -0
- package/skill/references/writing-html.md +187 -0
- package/skill/sdk/column-widths.d.ts +56 -0
- package/skill/sdk/doc-charts.d.ts +82 -0
- package/skill/sdk/doc-code.d.ts +28 -0
- package/skill/sdk/doc-dialogs.d.ts +4 -0
- package/skill/sdk/doc-kit.d.ts +147 -0
- package/skill/sdk/doc-math.d.ts +3 -0
- package/skill/sdk/doc-sheets.d.ts +15 -0
- package/skill/sdk/doc-state.d.ts +41 -0
- package/skill/sdk/doc-tables.d.ts +24 -0
- package/skill/sdk/doc-tokens.d.ts +22 -0
- package/skill/sdk/index.d.ts +30 -0
- package/starter/doc.html +21 -0
- package/starter/doc.json +5 -0
- package/vendor/d3.v7.9.0.min.js +2 -0
- package/vendor/katex/auto-render.min.js +1 -0
- package/vendor/katex/contrib/mhchem.min.js +1 -0
- package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/vendor/katex/katex.min.css +1 -0
- package/vendor/katex/katex.min.js +1 -0
- package/vendor/pdfjs/LICENSE +177 -0
- package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
- package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
- package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/vendor/types/@types/d3/LICENSE +21 -0
- package/vendor/types/@types/d3/index.d.ts +39 -0
- package/vendor/types/@types/d3/package.json +81 -0
- package/vendor/types/@types/d3-array/LICENSE +21 -0
- package/vendor/types/@types/d3-array/index.d.ts +1118 -0
- package/vendor/types/@types/d3-array/package.json +56 -0
- package/vendor/types/@types/d3-axis/LICENSE +21 -0
- package/vendor/types/@types/d3-axis/index.d.ts +293 -0
- package/vendor/types/@types/d3-axis/package.json +47 -0
- package/vendor/types/@types/d3-brush/LICENSE +21 -0
- package/vendor/types/@types/d3-brush/index.d.ts +255 -0
- package/vendor/types/@types/d3-brush/package.json +42 -0
- package/vendor/types/@types/d3-chord/LICENSE +21 -0
- package/vendor/types/@types/d3-chord/index.d.ts +471 -0
- package/vendor/types/@types/d3-chord/package.json +40 -0
- package/vendor/types/@types/d3-color/LICENSE +21 -0
- package/vendor/types/@types/d3-color/index.d.ts +669 -0
- package/vendor/types/@types/d3-color/package.json +55 -0
- package/vendor/types/@types/d3-contour/LICENSE +21 -0
- package/vendor/types/@types/d3-contour/index.d.ts +222 -0
- package/vendor/types/@types/d3-contour/package.json +38 -0
- package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
- package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
- package/vendor/types/@types/d3-delaunay/package.json +30 -0
- package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
- package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
- package/vendor/types/@types/d3-dispatch/package.json +51 -0
- package/vendor/types/@types/d3-drag/LICENSE +21 -0
- package/vendor/types/@types/d3-drag/index.d.ts +395 -0
- package/vendor/types/@types/d3-drag/package.json +42 -0
- package/vendor/types/@types/d3-dsv/LICENSE +21 -0
- package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
- package/vendor/types/@types/d3-dsv/package.json +45 -0
- package/vendor/types/@types/d3-ease/LICENSE +21 -0
- package/vendor/types/@types/d3-ease/index.d.ts +316 -0
- package/vendor/types/@types/d3-ease/package.json +40 -0
- package/vendor/types/@types/d3-fetch/LICENSE +21 -0
- package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
- package/vendor/types/@types/d3-fetch/package.json +37 -0
- package/vendor/types/@types/d3-force/LICENSE +21 -0
- package/vendor/types/@types/d3-force/index.d.ts +899 -0
- package/vendor/types/@types/d3-force/package.json +45 -0
- package/vendor/types/@types/d3-format/LICENSE +21 -0
- package/vendor/types/@types/d3-format/index.d.ts +337 -0
- package/vendor/types/@types/d3-format/package.json +45 -0
- package/vendor/types/@types/d3-geo/LICENSE +21 -0
- package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
- package/vendor/types/@types/d3-geo/package.json +48 -0
- package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
- package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
- package/vendor/types/@types/d3-hierarchy/package.json +50 -0
- package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
- package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
- package/vendor/types/@types/d3-interpolate/package.json +47 -0
- package/vendor/types/@types/d3-path/LICENSE +21 -0
- package/vendor/types/@types/d3-path/index.d.ts +108 -0
- package/vendor/types/@types/d3-path/package.json +41 -0
- package/vendor/types/@types/d3-polygon/LICENSE +21 -0
- package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
- package/vendor/types/@types/d3-polygon/package.json +40 -0
- package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
- package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
- package/vendor/types/@types/d3-quadtree/package.json +45 -0
- package/vendor/types/@types/d3-random/LICENSE +21 -0
- package/vendor/types/@types/d3-random/index.d.ts +313 -0
- package/vendor/types/@types/d3-random/package.json +41 -0
- package/vendor/types/@types/d3-scale/LICENSE +21 -0
- package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
- package/vendor/types/@types/d3-scale/package.json +53 -0
- package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
- package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
- package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
- package/vendor/types/@types/d3-selection/LICENSE +21 -0
- package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
- package/vendor/types/@types/d3-selection/package.json +56 -0
- package/vendor/types/@types/d3-shape/LICENSE +21 -0
- package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
- package/vendor/types/@types/d3-shape/package.json +53 -0
- package/vendor/types/@types/d3-time/LICENSE +21 -0
- package/vendor/types/@types/d3-time/index.d.ts +697 -0
- package/vendor/types/@types/d3-time/package.json +46 -0
- package/vendor/types/@types/d3-time-format/LICENSE +21 -0
- package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
- package/vendor/types/@types/d3-time-format/package.json +40 -0
- package/vendor/types/@types/d3-timer/LICENSE +21 -0
- package/vendor/types/@types/d3-timer/index.d.ts +68 -0
- package/vendor/types/@types/d3-timer/package.json +45 -0
- package/vendor/types/@types/d3-transition/LICENSE +21 -0
- package/vendor/types/@types/d3-transition/index.d.ts +664 -0
- package/vendor/types/@types/d3-transition/package.json +47 -0
- package/vendor/types/@types/d3-zoom/LICENSE +21 -0
- package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
- package/vendor/types/@types/d3-zoom/package.json +48 -0
- package/vendor/types/@types/geojson/LICENSE +21 -0
- package/vendor/types/@types/geojson/index.d.ts +202 -0
- package/vendor/types/@types/geojson/package.json +46 -0
- package/vendor/typescript/LICENSE.txt +55 -0
- package/vendor/typescript/lib.decorators.d.ts +384 -0
- package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
- package/vendor/typescript/lib.dom.d.ts +39429 -0
- package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
- package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
- package/vendor/typescript/lib.es2015.core.d.ts +597 -0
- package/vendor/typescript/lib.es2015.d.ts +28 -0
- package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
- package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
- package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
- package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
- package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
- package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
- package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
- package/vendor/typescript/lib.es2016.d.ts +21 -0
- package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
- package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
- package/vendor/typescript/lib.es2017.d.ts +26 -0
- package/vendor/typescript/lib.es2017.date.d.ts +31 -0
- package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
- package/vendor/typescript/lib.es2017.object.d.ts +49 -0
- package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
- package/vendor/typescript/lib.es2017.string.d.ts +45 -0
- package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
- package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
- package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
- package/vendor/typescript/lib.es2018.d.ts +24 -0
- package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
- package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
- package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
- package/vendor/typescript/lib.es2019.array.d.ts +79 -0
- package/vendor/typescript/lib.es2019.d.ts +24 -0
- package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
- package/vendor/typescript/lib.es2019.object.d.ts +33 -0
- package/vendor/typescript/lib.es2019.string.d.ts +37 -0
- package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
- package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
- package/vendor/typescript/lib.es2020.d.ts +27 -0
- package/vendor/typescript/lib.es2020.date.d.ts +42 -0
- package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
- package/vendor/typescript/lib.es2020.number.d.ts +28 -0
- package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
- package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
- package/vendor/typescript/lib.es2020.string.d.ts +44 -0
- package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/vendor/typescript/lib.es2021.d.ts +23 -0
- package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
- package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
- package/vendor/typescript/lib.es2021.string.d.ts +33 -0
- package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
- package/vendor/typescript/lib.es2022.array.d.ts +121 -0
- package/vendor/typescript/lib.es2022.d.ts +25 -0
- package/vendor/typescript/lib.es2022.error.d.ts +75 -0
- package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
- package/vendor/typescript/lib.es2022.object.d.ts +26 -0
- package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
- package/vendor/typescript/lib.es2022.string.d.ts +25 -0
- package/vendor/typescript/lib.es5.d.ts +4601 -0
- package/vendor/typescript/package.json +4 -0
- package/vendor/typescript/typescript.js +446 -0
- package/web/assets/index-Bh74DfsV.css +1 -0
- package/web/assets/index-UW0RyFFt.js +13 -0
- package/web/index.html +14 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { BOXED, BOX_NAMES, KIND_NAMES, isLead, selectAllOf } from "../../components/registry.mjs";
|
|
2
|
+
import { UNIT, boxKind, textEnd, unitElement, unitsOf } from "../core.mjs";
|
|
3
|
+
import { editable, select } from "../caret.mjs";
|
|
4
|
+
import { ZWSP } from "../../../shared/inline-spacing.mjs";
|
|
5
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
6
|
+
import { shortcut } from "../tooltip.mjs";
|
|
7
|
+
|
|
8
|
+
// Ctrl+A (⌘A) widening step by step (docs/editor.md, "Selecting all"). notion-lite's rule (its
|
|
9
|
+
// editor/input/keys/text-keys.js and block-keys.js): the first press in a text block selects that
|
|
10
|
+
// block's text, a press when it is all selected (or empty) selects the page's blocks, and with
|
|
11
|
+
// blocks selected a press selects the page's. The user's (2026-10-23) puts the containers between,
|
|
12
|
+
// one level a press:
|
|
13
|
+
//
|
|
14
|
+
// 1. the text block's own text (a list item's words, not the blocks it holds; a code block's code;
|
|
15
|
+
// a cell's text; the title's), the browser's selection, so the format bar shows for it;
|
|
16
|
+
// 2. everything in the container block it stands in, as blocks are selected (a box selection's
|
|
17
|
+
// fills): a highlight block's blocks (not its icon, the box's lead, which notion-lite's callout
|
|
18
|
+
// has no block for), a disclosure's content (not its title, the disclosure's own text, as
|
|
19
|
+
// notion-lite selects a toggle's children without it), a quote's paragraphs, a column's blocks,
|
|
20
|
+
// the blocks of the tab shown, a detail card's content, the blocks a list item holds under its
|
|
21
|
+
// text (notion-lite's children of a list item, its own words not among them);
|
|
22
|
+
// 3. the next container up, the one just selected whole among its blocks, and so on; a row of
|
|
23
|
+
// columns, a Sheet area and a table are a step of their own, the block whole (all of its
|
|
24
|
+
// columns, all of its tabs, all of its cells), above a column, a tab's panel and a cell;
|
|
25
|
+
// 4. the page: every block of it (the header's lines and the page's blocks; not its title or its
|
|
26
|
+
// icon, the page's own and no blocks, as in Notion). In an open detail card its content is the
|
|
27
|
+
// top: the page behind it is not the card's (of two open, the one the press is in: openCard).
|
|
28
|
+
//
|
|
29
|
+
// Not containers: sections (the user's: 分区的不用管; a section's blocks are the page's), lists (an
|
|
30
|
+
// item is a block of the flow it stands in, as Notion has no list block), the plain divs that group
|
|
31
|
+
// blocks, the header and a Sheet's tab row. A press that would select what is selected already goes
|
|
32
|
+
// on to the next step, so each press selects more (the top never, after a text block's text: the
|
|
33
|
+
// block selected is more than its text, a page of one paragraph too); at the top it does nothing. A selection of blocks
|
|
34
|
+
// (a box selection, a handle's) goes on from its blocks, a selection across blocks (text-select/)
|
|
35
|
+
// from the blocks it touches (to the first container holding them all, its text being only a part),
|
|
36
|
+
// selected cells (table/) from their table. A field of the page's own UI (the link card, the formula
|
|
37
|
+
// editor, a menu's search, a tab being renamed) keeps the browser's Ctrl+A.
|
|
38
|
+
|
|
39
|
+
const TEXT = "[data-ge-block], [data-ge-new][contenteditable='true']";
|
|
40
|
+
|
|
41
|
+
const kindOf = (node) => node.getAttribute("data-ge-unit-kind");
|
|
42
|
+
// A block of blocks with a box of its own around them (a highlight block; not a group, a plain div).
|
|
43
|
+
const drawsBox = (node) => node.hasAttribute("data-ge-box") && BOXED.has(kindOf(node)) && boxKind(node) !== "plain";
|
|
44
|
+
|
|
45
|
+
// On a Mac ⌘A (Ctrl+A is the line's start there, as in every text field), elsewhere Ctrl+A: notion-lite's isSelectAllKey.
|
|
46
|
+
const MAC = /Mac|iPhone|iPad/.test(globalThis.navigator?.platform ?? "");
|
|
47
|
+
|
|
48
|
+
/** Ctrl+A (⌘A on a Mac), no Shift or Alt. */
|
|
49
|
+
export const isSelectAllKey = (event) => (MAC ? event.metaKey : event.ctrlKey) && !event.shiftKey && !event.altKey && event.key?.toLowerCase() === "a";
|
|
50
|
+
|
|
51
|
+
/** The blocks a box holds as its own: its units without its lead (a highlight block's icon). */
|
|
52
|
+
export const heldUnits = (box) => unitsOf(box).filter((unit) => !isLead(boxKind(box), kindOf(unit)));
|
|
53
|
+
|
|
54
|
+
// What each step selects, in the reader's words: those of the box (`selectAll`), else its name's.
|
|
55
|
+
function contentLabel(kind) {
|
|
56
|
+
const own = selectAllOf(kind).content;
|
|
57
|
+
return own === true ? t("{0}里的全部内容", BOX_NAMES[kind]) : own;
|
|
58
|
+
}
|
|
59
|
+
const wholeLabel = (unit) => t("整个{0}", KIND_NAMES[kindOf(unit)] ?? t("整体块"));
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* What a selection of `units` reaches, to tell whether a step selects more: its text blocks, the
|
|
63
|
+
* blocks in it that hold none (a picture, a divider, a highlight block's icon), and a block of
|
|
64
|
+
* blocks drawing a box of its own (a highlight block: selected whole it is more than its blocks). A
|
|
65
|
+
* list and its items, a quote and its paragraphs reach the same; a list item whole reaches its own
|
|
66
|
+
* text besides the blocks it holds.
|
|
67
|
+
*/
|
|
68
|
+
export function coverage(units) {
|
|
69
|
+
const reached = new Set();
|
|
70
|
+
for (const unit of units) {
|
|
71
|
+
for (const node of [unit, ...unit.querySelectorAll(`${TEXT}, ${UNIT}`)]) {
|
|
72
|
+
if (node.matches(TEXT) || !node.querySelector(TEXT) || drawsBox(node)) reached.add(node);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return reached;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The innermost element around all of `nodes` (none being another's): the parent of one. */
|
|
79
|
+
export function around(nodes) {
|
|
80
|
+
let at = nodes[0]?.parentElement ?? null;
|
|
81
|
+
while (at && !nodes.every((node) => node !== at && at.contains(node))) at = at.parentElement;
|
|
82
|
+
return at;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The open detail card a press is in: the one `from` stands in (the block or text block it goes on
|
|
87
|
+
* from; outside them all, none: the page), else the one holding the focus, else the one drawn over
|
|
88
|
+
* the others at its middle (a card opened from another's covers it; with no layout, the last). null: none.
|
|
89
|
+
*/
|
|
90
|
+
export function openCard(doc, from = null) {
|
|
91
|
+
if (from) return from.closest?.("dialog[open]") ?? null;
|
|
92
|
+
const focused = doc.activeElement?.closest?.("dialog[open]");
|
|
93
|
+
if (focused) return focused;
|
|
94
|
+
const open = [...doc.querySelectorAll("dialog[open]")];
|
|
95
|
+
const drawn = open.filter((dialog) => {
|
|
96
|
+
const box = dialog.getBoundingClientRect();
|
|
97
|
+
const hit = box.width > 0 ? doc.elementFromPoint?.(box.left + box.width / 2, box.top + box.height / 2) : null;
|
|
98
|
+
return Boolean(hit && dialog.contains(hit));
|
|
99
|
+
});
|
|
100
|
+
return drawn.at(-1) ?? open.at(-1) ?? null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The top: the content of the detail card open where the press is (openCard: `from`, the node it
|
|
105
|
+
* goes on from, else the focus), else the page (the header's lines and the page's blocks). { units, label, top }.
|
|
106
|
+
*/
|
|
107
|
+
export function topStep(doc, from = null) {
|
|
108
|
+
const card = openCard(doc, from)?.querySelector('[data-ge-box-kind="dialog"]');
|
|
109
|
+
if (card) return { units: heldUnits(card), label: contentLabel("dialog"), top: true };
|
|
110
|
+
const main = doc.querySelector('main[data-ge-box-kind="main"]') ?? doc.querySelector("main");
|
|
111
|
+
if (!main) return { units: [], label: t("整个页面"), top: true };
|
|
112
|
+
const header = [...main.children].find((child) => boxKind(child) === "header");
|
|
113
|
+
const lines = header ? unitsOf(header).filter((unit) => kindOf(unit) !== "icon") : [];
|
|
114
|
+
return { units: [...lines, ...heldUnits(main)], label: t("整个页面"), top: true };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The steps above `start` (an element: the box or block the selection stands in), innermost
|
|
119
|
+
* first, the top last: [{ units, label, top? }]. A detail card's content is the last.
|
|
120
|
+
*/
|
|
121
|
+
export function stepsAbove(start) {
|
|
122
|
+
const steps = [];
|
|
123
|
+
for (let at = start; at; at = at.parentElement) {
|
|
124
|
+
const kind = at.hasAttribute?.("data-ge-box") ? boxKind(at) : null;
|
|
125
|
+
if (!kind) continue;
|
|
126
|
+
if (kind === "main") break;
|
|
127
|
+
const { content, whole, top = false } = selectAllOf(kind) ?? {};
|
|
128
|
+
if (content) {
|
|
129
|
+
const units = heldUnits(at);
|
|
130
|
+
if (units.length > 0) steps.push({ units, label: contentLabel(kind), top });
|
|
131
|
+
if (top) return steps;
|
|
132
|
+
}
|
|
133
|
+
if (whole) {
|
|
134
|
+
const owner = at.matches(UNIT) ? at : at.parentElement?.closest(UNIT);
|
|
135
|
+
if (owner && !steps.some((step) => step.units.length === 1 && step.units[0] === owner)) steps.push({ units: [owner], label: wholeLabel(owner) });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
steps.push(topStep(start?.ownerDocument ?? document, start));
|
|
139
|
+
return steps;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** The steps from text block `host` once its text is all selected: a table's cell the table whole first. */
|
|
143
|
+
export function stepsFromText(host) {
|
|
144
|
+
const unit = unitElement(host);
|
|
145
|
+
if (!unit) return [topStep(host.ownerDocument, host)]; // the title, one beside a detail card's content: no block of their own
|
|
146
|
+
const whole = unit !== host && kindOf(unit) === "table" ? [{ units: [unit], label: wholeLabel(unit) }] : [];
|
|
147
|
+
return [...whole, ...stepsAbove(unit.parentElement)];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The first of `steps` that selects more than `reached` (coverage: what is selected now), holding
|
|
152
|
+
* it all; `strict` false: one holding it is enough (a selection across blocks, whose text may be a
|
|
153
|
+
* part of theirs). The top takes what it can (the title is no block of the page), and after a text
|
|
154
|
+
* block's text (`text`) even when it holds that block alone: the block selected is more than its
|
|
155
|
+
* text (notion-lite's press with the text all selected; a page or a detail card of one paragraph).
|
|
156
|
+
* null: none (the top is selected already).
|
|
157
|
+
*/
|
|
158
|
+
export function nextStep(steps, reached, { strict = true, text = false } = {}) {
|
|
159
|
+
for (const step of steps) {
|
|
160
|
+
const area = coverage(step.units);
|
|
161
|
+
const holds = [...reached].every((node) => area.has(node));
|
|
162
|
+
if (holds && (!strict || area.size > reached.size)) return step;
|
|
163
|
+
if (step.top && area.size > 0 && (!holds || text)) return step;
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// The selection's part in a text block's own text, against all of it: whether it holds all of it
|
|
169
|
+
// (an empty block's is all selected: notion-lite's). Counted in characters and formulas, the
|
|
170
|
+
// zero-width pads (pads.mjs) none.
|
|
171
|
+
function wholeText(host) {
|
|
172
|
+
const own = document.createRange();
|
|
173
|
+
own.setStart(host, 0);
|
|
174
|
+
own.setEnd(host, textEnd(host));
|
|
175
|
+
const letters = (range) => range.toString().replaceAll(ZWSP, "");
|
|
176
|
+
const atoms = (range) => range.cloneContents().querySelectorAll("[data-ge-atom]").length;
|
|
177
|
+
const all = letters(own);
|
|
178
|
+
if (all === "" && atoms(own) === 0) return { own, all: true };
|
|
179
|
+
const selection = getSelection();
|
|
180
|
+
if (!selection.rangeCount) return { own, all: false };
|
|
181
|
+
const range = selection.getRangeAt(0);
|
|
182
|
+
if (range.compareBoundaryPoints(Range.END_TO_START, own) > 0 || range.compareBoundaryPoints(Range.START_TO_END, own) < 0) return { own, all: false };
|
|
183
|
+
const part = own.cloneRange();
|
|
184
|
+
if (range.compareBoundaryPoints(Range.START_TO_START, own) > 0) part.setStart(range.startContainer, range.startOffset);
|
|
185
|
+
if (range.compareBoundaryPoints(Range.END_TO_END, own) < 0) part.setEnd(range.endContainer, range.endOffset);
|
|
186
|
+
return { own, all: letters(part) === all && atoms(part) === atoms(own) };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* blocks: the block tools (blocks.mjs: picked, select(units, { quiet })). say: the status line.
|
|
191
|
+
* cells: the table tools' selection (table/): table() the table whose cells are selected (no
|
|
192
|
+
* caret in one), or null; clear() lets it go.
|
|
193
|
+
*/
|
|
194
|
+
export function createSelectAll({ blocks, say, cells = { table: () => null, clear() {} } }) {
|
|
195
|
+
const KEY = shortcut("mod+a"); // the key as the tooltips name it: Ctrl+A, ⌘A on a Mac
|
|
196
|
+
const more = (steps, step) => {
|
|
197
|
+
const next = nextStep(steps.slice(steps.indexOf(step) + 1), coverage(step.units));
|
|
198
|
+
return next ? t(" · 再按 {0} 选中{1}", KEY, next.label) : "";
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// A step taken: its blocks selected (the cells' selection let go), said with the step after it.
|
|
202
|
+
function take(steps, step) {
|
|
203
|
+
if (!step) return; // the top is selected already: nothing more
|
|
204
|
+
cells.clear();
|
|
205
|
+
blocks.select(step.units, { quiet: true });
|
|
206
|
+
say(t("已选中{0} · Delete 删除 · Esc 取消{1}", step.label, more(steps, step)));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function fromText(host) {
|
|
210
|
+
const { own, all } = wholeText(host);
|
|
211
|
+
const steps = stepsFromText(host);
|
|
212
|
+
const next = nextStep(steps, new Set([host]), { text: true });
|
|
213
|
+
if (!all) {
|
|
214
|
+
select(own);
|
|
215
|
+
say(next ? t("已选中这一块的文字 · 再按 {0} 选中{1}", KEY, next.label) : t("已选中这一块的文字"));
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
take(steps, next);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
/**
|
|
223
|
+
* The editor's key chain (editor.mjs): Ctrl+A with the caret in text block `host` (null: none,
|
|
224
|
+
* blocks or cells selected, or nothing). True when it was the key and handled.
|
|
225
|
+
*/
|
|
226
|
+
key(event, host) {
|
|
227
|
+
if (!isSelectAllKey(event) || event.isComposing || event.keyCode === 229) return false;
|
|
228
|
+
const target = event.target;
|
|
229
|
+
// A field of the page's own UI, or the report's own editable element, keeps the browser's.
|
|
230
|
+
if (target?.closest?.("input, textarea, select") || (target?.isContentEditable && !editable(target))) return false;
|
|
231
|
+
event.preventDefault();
|
|
232
|
+
if (host) return fromText(host), true;
|
|
233
|
+
const table = cells.table();
|
|
234
|
+
if (table?.isConnected) {
|
|
235
|
+
const steps = [{ units: [table], label: wholeLabel(table) }, ...stepsAbove(table.parentElement)];
|
|
236
|
+
take(steps, steps[0]);
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
const picked = blocks.picked;
|
|
240
|
+
if (picked.length > 0) {
|
|
241
|
+
const steps = stepsAbove(around(picked));
|
|
242
|
+
take(steps, nextStep(steps, coverage(picked)));
|
|
243
|
+
} else {
|
|
244
|
+
const steps = [topStep(document)];
|
|
245
|
+
take(steps, nextStep(steps, new Set()));
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* A key over a selection across blocks (text-select/): Ctrl+A selects the first container
|
|
251
|
+
* holding all it touches, `touched()` letting it go and giving its blocks. True when it was the key.
|
|
252
|
+
*/
|
|
253
|
+
across(event, touched) {
|
|
254
|
+
if (!isSelectAllKey(event)) return false;
|
|
255
|
+
event.preventDefault();
|
|
256
|
+
const units = touched();
|
|
257
|
+
const steps = units.length > 0 ? stepsAbove(around(units)) : [topStep(document)];
|
|
258
|
+
take(steps, nextStep(steps, coverage(units), { strict: false }));
|
|
259
|
+
return true;
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { keptAnyway, partsOf, removalTarget, withLeads } from "../core.mjs";
|
|
2
|
+
import { alive, ordered, otherTabs } from "../block-info.mjs";
|
|
3
|
+
import { caretAt } from "../caret.mjs";
|
|
4
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
5
|
+
|
|
6
|
+
// Deleting whole blocks (docs/editor.md, "Deleting blocks"): the selected ones with Delete or
|
|
7
|
+
// Backspace, the block menu's 删除, or Ctrl+X. Selected blocks go together, or none does (one of
|
|
8
|
+
// them is referred to, data-ge-keep, or they are a row's last tabs), with the reason. A container
|
|
9
|
+
// they leave empty goes too (core.mjs removalTarget); when a Sheet tab's Sheet was shown, the next
|
|
10
|
+
// tab is clicked (undo clicks it back). One undo step, which selects the blocks again. A box that
|
|
11
|
+
// always holds a block gets an empty paragraph once they are gone (core.mjs tidyEmptied), the caret
|
|
12
|
+
// in it. That one empty paragraph stays (keptAnyway: it would be put back as it is), so deleting
|
|
13
|
+
// only it does nothing and says nothing. A folded heading goes with what it hides, or as the section
|
|
14
|
+
// it covers whole (fold/ takenWith).
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* info: block-info.mjs. selection: selection/index.mjs. struct(parents, touched, mutate): the
|
|
18
|
+
* editor's undoable structural change (history.mjs). say: the status line. closeMenu(): the block
|
|
19
|
+
* menu closes. forget(): the handle forgets the block it stood beside. folds: the headings' folds (fold/).
|
|
20
|
+
*/
|
|
21
|
+
export function createDelete({ info, selection, struct, say, closeMenu, forget, folds = null }) {
|
|
22
|
+
const { kindOf, nameOf, keepText, named } = info;
|
|
23
|
+
|
|
24
|
+
return function remove(targets = selection.picked) {
|
|
25
|
+
closeMenu();
|
|
26
|
+
const picked = ordered([targets].flat().filter(alive));
|
|
27
|
+
const list = (folds ? folds.takenWith(picked) : picked).filter((target) => !keptAnyway(target));
|
|
28
|
+
if (list.length === 0) return;
|
|
29
|
+
const refused = list.map((target) => [target, keepText(target, list)]).find(([, reason]) => reason);
|
|
30
|
+
if (refused) {
|
|
31
|
+
selection.select(list, { quiet: true });
|
|
32
|
+
say(list.length > 1 ? t("其中的{0}不能删除:{1}", nameOf(refused[0]), refused[1]) : refused[1], "note", 6000);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
selection.clear();
|
|
36
|
+
forget();
|
|
37
|
+
// What goes: each block, or its container once nothing else is left in it.
|
|
38
|
+
const gone = new Set(list.flatMap(withLeads));
|
|
39
|
+
const nodes = [...new Set(list.map((target) => removalTarget(target, gone)))];
|
|
40
|
+
const parts = nodes.flatMap(partsOf);
|
|
41
|
+
// The Sheet shown moves to a tab still there.
|
|
42
|
+
const tabs = nodes.filter((node) => kindOf(node) === "tab");
|
|
43
|
+
const shownTab = tabs.find((tab) => tab.getAttribute("aria-selected") === "true");
|
|
44
|
+
// The one right of it shows instead, or left of it when it was the last (Notion's).
|
|
45
|
+
const row = shownTab ? [...shownTab.parentElement.children] : [];
|
|
46
|
+
const at = row.indexOf(shownTab);
|
|
47
|
+
const neighbour = shownTab && [...row.slice(at + 1), ...row.slice(0, at).reverse()].find((tab) => otherTabs(shownTab).includes(tab) && !tabs.includes(tab));
|
|
48
|
+
// After the area started again with its tabs as they are now (components/sheets/pills.mjs, on the
|
|
49
|
+
// same change: its observer's turn comes first).
|
|
50
|
+
const settle = shownTab ? (backwards) => queueMicrotask(() => (backwards ? shownTab : neighbour)?.click()) : null;
|
|
51
|
+
const done = struct([...new Set(parts.map((part) => part.parentNode))], [], () => {
|
|
52
|
+
parts.forEach((part) => part.remove());
|
|
53
|
+
settle?.(false);
|
|
54
|
+
return { touched: [], focus: null, select: list, settle };
|
|
55
|
+
});
|
|
56
|
+
if (done?.caret) caretAt(done.caret, "start");
|
|
57
|
+
const emptied = nodes.some((node) => !list.includes(node));
|
|
58
|
+
const name = list.length === 1 ? nameOf(nodes[0]) : folds ? folds.namedWith(picked, list, named) : t("{0} 块", list.length);
|
|
59
|
+
say(t("已删除{0}{1}{2} · Ctrl+Z 撤销", name, emptied ? t("(外层已空,一并删除)") : "", tabs.length > 0 ? t(",连同其中的内容") : ""));
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { unitElement, unitsOf, withLeads } from "../core.mjs";
|
|
2
|
+
import { alive, ordered } from "../block-info.mjs";
|
|
3
|
+
import { entersAfter } from "../beside.mjs";
|
|
4
|
+
import { createFills } from "../fills.mjs";
|
|
5
|
+
import { FOLDED } from "../folded.mjs";
|
|
6
|
+
import { describe, note, report } from "../overlays.mjs";
|
|
7
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
8
|
+
|
|
9
|
+
// Selected blocks (docs/editor.md, "Selecting blocks"): a set of blocks, none inside another, in
|
|
10
|
+
// document order. A box selection drawn from empty space gives blocks of one container
|
|
11
|
+
// (marquee.mjs), Shift can add others; Shift+↑/↓ widens or narrows a selection among the neighbours
|
|
12
|
+
// of the block it started from. Each selected block is filled (fills.mjs: in the editor's own layer,
|
|
13
|
+
// the page's, so a fill scrolls with its block natively, never inside the block, as the frame of what
|
|
14
|
+
// is being edited is, frame.mjs); the fills hide while the blocks are dragged (drag/). Deleting
|
|
15
|
+
// selected blocks is delete.mjs; what the keys do with a selection, blocks.mjs.
|
|
16
|
+
//
|
|
17
|
+
// A selection of text across blocks (text-select/) marks the blocks it takes whole (a code block, a
|
|
18
|
+
// table, a file…): they are filled as selected ones are, without being selected (mark).
|
|
19
|
+
//
|
|
20
|
+
// The fills belong to their blocks (docs/editor.md, "Overlays"): one per selected block on the
|
|
21
|
+
// page, made to match the selection the moment it changes (render), never on a later frame, so no
|
|
22
|
+
// fill outlives its block's selection, and none is drawn while the block tools are off. The frames
|
|
23
|
+
// only keep them where their blocks are (paint); a fill that cannot be drawn goes.
|
|
24
|
+
//
|
|
25
|
+
// What a folded heading hides (fold/) is never selected: select() leaves it out, Shift+↑/↓ and ↑/↓
|
|
26
|
+
// pass over it; what takes a folded heading away whole takes it along when it acts (fold/ takenWith).
|
|
27
|
+
|
|
28
|
+
// Whether a block is hidden by a folded heading (data-ge-folded on it or a block around it).
|
|
29
|
+
const folded = (node) => node.closest(`[${FOLDED}]`) !== null;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* info: block-info.mjs. active(): whether block tools may show. say(text, kind, hold): the status
|
|
33
|
+
* line. closeMenu(): the block menu closes. schedule(): the block tools' next frame (blocks.mjs),
|
|
34
|
+
* which keeps the fills where their blocks are.
|
|
35
|
+
*/
|
|
36
|
+
export function createSelection({ info, active, say, closeMenu, schedule }) {
|
|
37
|
+
const { nameOf } = info;
|
|
38
|
+
let picked = []; // the selected blocks, in document order, none inside another
|
|
39
|
+
let marked = []; // the blocks a text selection takes whole (text-select/): filled, not selected
|
|
40
|
+
let anchor = null; // the block Shift+↑/↓ widens the selection from
|
|
41
|
+
let hidden = false; // the fills hide while the blocks are dragged
|
|
42
|
+
const halos = createFills({ kind: "halo", className: "ge-halo", stands: (node) => (picked.includes(node) || marked.includes(node)) && active() });
|
|
43
|
+
|
|
44
|
+
/** Select a block, or several (none is clearing); `quiet`: without saying so. */
|
|
45
|
+
function select(targets, { quiet = false } = {}) {
|
|
46
|
+
closeMenu();
|
|
47
|
+
const next = ordered([targets].flat().filter(alive)).filter((node) => !folded(node));
|
|
48
|
+
if (next.length === 0) return clear();
|
|
49
|
+
if (next.length !== picked.length || next.some((node, index) => node !== picked[index])) {
|
|
50
|
+
picked = next;
|
|
51
|
+
note("select", picked.map(describe).join(", "));
|
|
52
|
+
}
|
|
53
|
+
if (!picked.includes(anchor)) anchor = picked[0];
|
|
54
|
+
const focused = document.activeElement;
|
|
55
|
+
if (focused && focused !== document.body && focused.closest("main")) focused.blur();
|
|
56
|
+
getSelection()?.removeAllRanges();
|
|
57
|
+
if (!quiet) {
|
|
58
|
+
const [first] = picked;
|
|
59
|
+
say(picked.length > 1
|
|
60
|
+
? t("已选中 {0} 块 · Delete 删除 · 拖动手柄一起移动 · Esc 取消", picked.length)
|
|
61
|
+
: t("已选中{0} · Delete 删除{1} · Esc 取消", nameOf(first), entersAfter(first) ? t(" · Enter 在下方新建文本") : t(" · Enter 编辑")));
|
|
62
|
+
}
|
|
63
|
+
render();
|
|
64
|
+
schedule();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function clear() {
|
|
68
|
+
if (picked.length > 0) note("clear", picked.map(describe).join(", "));
|
|
69
|
+
picked = [];
|
|
70
|
+
anchor = null;
|
|
71
|
+
render();
|
|
72
|
+
schedule();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Blocks taken off the page (undo, a commit, the page's own script) leave the selection, and
|
|
76
|
+
// their fills go with them.
|
|
77
|
+
function prune() {
|
|
78
|
+
const gone = picked.filter((node) => !alive(node));
|
|
79
|
+
if (gone.length === 0) return;
|
|
80
|
+
note("prune", gone.map(describe).join(", "));
|
|
81
|
+
picked = picked.filter(alive);
|
|
82
|
+
if (!picked.includes(anchor)) anchor = picked[0] ?? null;
|
|
83
|
+
render();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Shift+↑/↓: the selection widens (or narrows) by one block among the anchor's neighbours.
|
|
87
|
+
function extend(delta) {
|
|
88
|
+
const container = anchor?.parentElement;
|
|
89
|
+
const list = container ? unitsOf(container).filter((unit) => !folded(unit)) : [];
|
|
90
|
+
const at = list.indexOf(anchor);
|
|
91
|
+
if (at < 0) return;
|
|
92
|
+
const inside = picked.map((node) => list.indexOf(node)).filter((index) => index >= 0);
|
|
93
|
+
const low = Math.min(...inside);
|
|
94
|
+
const high = Math.max(...inside);
|
|
95
|
+
const end = Math.max(0, Math.min(list.length - 1, (high > at ? high : low < at ? low : at) + delta));
|
|
96
|
+
select(list.slice(Math.min(at, end), Math.max(at, end) + 1), { quiet: true });
|
|
97
|
+
list[end].scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// The next or previous block in the same container.
|
|
101
|
+
function sibling(node, forward) {
|
|
102
|
+
for (let next = forward ? node.nextElementSibling : withLeads(node)[0].previousElementSibling; next; next = forward ? next.nextElementSibling : next.previousElementSibling) {
|
|
103
|
+
const unit = unitElement(next);
|
|
104
|
+
if (unit && unit.parentElement === node.parentElement && unit !== node && !folded(unit)) return unit;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// The fills made to match the selection now: those of blocks no longer selected (or no longer on
|
|
110
|
+
// the page) go at once; each selected block shown gets its fill where it is, reaching past it as
|
|
111
|
+
// reachOf says, never into a neighbour's (roomOf). One that cannot be drawn takes all the fills
|
|
112
|
+
// down (said once): better none than one in the wrong place.
|
|
113
|
+
function render() {
|
|
114
|
+
try {
|
|
115
|
+
halos.paint(hidden || !active() ? [] : [...picked, ...marked].filter(alive));
|
|
116
|
+
} catch (error) {
|
|
117
|
+
unpaint();
|
|
118
|
+
report("selection fills", error);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Every fill taken down (the selection stays).
|
|
123
|
+
const unpaint = () => halos.clear();
|
|
124
|
+
|
|
125
|
+
// For the tests and DevTools: the selected blocks (the page carries no mark of the selection).
|
|
126
|
+
globalThis.__gallerySelected = () => [...picked];
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
/** The selected blocks, in document order (the selection's own list: read it, never change it). */
|
|
130
|
+
get picked() { return picked; },
|
|
131
|
+
/**
|
|
132
|
+
* With several blocks selected, the one that is `target` or holds it (an item of a selected
|
|
133
|
+
* list: its handle's menu is the group's, as notion-lite's handle of a selected block), else null.
|
|
134
|
+
*/
|
|
135
|
+
holderOf: (target) => (picked.length > 1 ? picked.find((node) => node === target || node.contains(target)) ?? null : null),
|
|
136
|
+
select,
|
|
137
|
+
clear,
|
|
138
|
+
/** Fill `targets` as selected ones without selecting them (a text selection's whole blocks; none: no more). */
|
|
139
|
+
mark(targets) {
|
|
140
|
+
const next = ordered([targets].flat().filter(alive));
|
|
141
|
+
if (next.length === marked.length && next.every((node, index) => node === marked[index])) return;
|
|
142
|
+
marked = next;
|
|
143
|
+
render();
|
|
144
|
+
schedule();
|
|
145
|
+
},
|
|
146
|
+
extend,
|
|
147
|
+
sibling,
|
|
148
|
+
prune,
|
|
149
|
+
/** A frame: the fills where their blocks are now; none while the blocks are dragged (`dragging`). */
|
|
150
|
+
paint(dragging) {
|
|
151
|
+
hidden = dragging;
|
|
152
|
+
render();
|
|
153
|
+
},
|
|
154
|
+
unpaint,
|
|
155
|
+
/** The editing stops: nothing selected, no fills. */
|
|
156
|
+
hide() {
|
|
157
|
+
marked = [];
|
|
158
|
+
clear();
|
|
159
|
+
unpaint();
|
|
160
|
+
},
|
|
161
|
+
/** The selection for the overlays' snapshot. */
|
|
162
|
+
state: () => ({ picked: picked.map(describe), offPage: picked.filter((node) => !node.isConnected).length, fills: halos.count, hidden }),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { Z } from "../../../shared/layers.mjs";
|
|
2
|
+
import { blankTarget, measure, pick } from "../geometry.mjs";
|
|
3
|
+
import { DIALOG } from "../../components/kit.mjs";
|
|
4
|
+
import { edgeFollower } from "../edge-scroll.mjs";
|
|
5
|
+
import { cancelOnEscape, endsGesture, gestureLock } from "../gesture.mjs";
|
|
6
|
+
import { note, own } from "../overlays.mjs";
|
|
7
|
+
import { addStyle, element, mount } from "../ui.mjs";
|
|
8
|
+
|
|
9
|
+
// A press on empty space (geometry.mjs blankTarget: the page around the report, a box between its
|
|
10
|
+
// blocks): moved more than a few pixels, it draws a box selection (docs/editor.md, "Selecting
|
|
11
|
+
// blocks"); released where it was, it is a click on empty space. The rectangle's start stays on
|
|
12
|
+
// the content while the page scrolls (the wheel, or the pointer near the window's top or bottom
|
|
13
|
+
// edge); the blocks it takes are geometry.mjs pick()'s. With Shift held (at any moment), what it
|
|
14
|
+
// takes is added to or taken out of what was selected when it started. While a detail card is open,
|
|
15
|
+
// one is drawn in the card's content alone, its own top as for Ctrl+A (select-all/): the press on
|
|
16
|
+
// its empty space, the blocks it takes of that content, the rectangle's start staying on the content
|
|
17
|
+
// as the content scrolls. Only a mouse draws one, and not where the pointer is on an edge that resizes (resize/) or in a
|
|
18
|
+
// gap that does (between two columns, or two nodes of a flowchart's row: columns/, which takes that
|
|
19
|
+
// press; its listener comes after this one, so it cannot keep the press from here).
|
|
20
|
+
// Anything that ends the press another way (the capture lost, the window losing the focus, the
|
|
21
|
+
// page hidden, Esc) cancels it: what it took is let go. The rectangle belongs to the press
|
|
22
|
+
// (overlays.mjs); scrolling near the edges is a task of the editor's frames (edge-scroll.mjs), and the
|
|
23
|
+
// ways a press gives up are gesture.mjs's.
|
|
24
|
+
|
|
25
|
+
const STYLE = `
|
|
26
|
+
.ge-marquee { position: fixed; left: 0; top: 0; z-index: ${Z.marquee}; box-sizing: border-box; border: 1px solid transparent; background: var(--ge-halo); pointer-events: none; }
|
|
27
|
+
${gestureLock("data-ge-marquee", { cursor: "default", select: true })}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
const START = 4; // how far the pointer moves before the press draws a box selection
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* active(): whether block tools may show. selection: { get() -> blocks, set(blocks, { quiet }),
|
|
34
|
+
* clear() }. click(x, y, target): a click on empty space.
|
|
35
|
+
*/
|
|
36
|
+
export function createMarquee({ active, selection, click }) {
|
|
37
|
+
addStyle(STYLE);
|
|
38
|
+
let held = null; // { x, y, pageX, pageY, start, shift, target, tree, drawn, pointer }
|
|
39
|
+
const shape = own(element("div", { class: "ge-marquee" }), "box selection", { alive: () => Boolean(held?.drawn) });
|
|
40
|
+
// Near the top or bottom edge of what it is drawn in (the window, or the card's content) that
|
|
41
|
+
// scrolls, and the rectangle follows (a frame; again on the next one while the rectangle is drawn).
|
|
42
|
+
const scrolling = edgeFollower("box selection", { pointer: () => (held?.drawn ? held : null), scroller: () => held.scroller, scrolled: () => update(), fail: () => cancel() });
|
|
43
|
+
|
|
44
|
+
// Where a press may draw one: the page, or, while a detail card is open, the content of the card
|
|
45
|
+
// the press is in (its own top, as Ctrl+A's: select-all/), never the page behind it. null: nowhere.
|
|
46
|
+
function topOf(target) {
|
|
47
|
+
if (!document.querySelector(DIALOG.open)) return document.querySelector("main");
|
|
48
|
+
const content = target.closest(DIALOG.open)?.querySelector(DIALOG.openContent);
|
|
49
|
+
return content?.contains(target) ? content : null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// What scrolls under the rectangle: a card's content scrolls by itself, the page with the window.
|
|
53
|
+
const scrolled = () => (held.scroller ? { x: held.scroller.scrollLeft, y: held.scroller.scrollTop } : { x: scrollX, y: scrollY });
|
|
54
|
+
|
|
55
|
+
/** A press on the page: takes it (true) when it is on empty space. */
|
|
56
|
+
function begin(event) {
|
|
57
|
+
if (held || event.button !== 0 || event.pointerType !== "mouse" || !active() || !blankTarget(event.target)) return false;
|
|
58
|
+
if (document.documentElement.hasAttribute("data-ge-resize") || document.documentElement.hasAttribute("data-ge-gap")) return false;
|
|
59
|
+
const root = topOf(event.target);
|
|
60
|
+
if (!root) return false;
|
|
61
|
+
// Not cancelled: the page still takes the focus, as a click on empty space always gave it (in a
|
|
62
|
+
// workbench, its keys then reach the page); text selection is off while the press lasts.
|
|
63
|
+
document.documentElement.setAttribute("data-ge-marquee", "");
|
|
64
|
+
const focused = document.activeElement;
|
|
65
|
+
if (focused?.isContentEditable && focused.closest("main")) focused.blur();
|
|
66
|
+
getSelection()?.removeAllRanges();
|
|
67
|
+
held = {
|
|
68
|
+
x: event.clientX, y: event.clientY, root, scroller: root.localName === "main" ? null : root, card: root.closest("dialog"),
|
|
69
|
+
start: selection.get(), shift: event.shiftKey, target: event.target, tree: null, drawn: false, pointer: event.pointerId,
|
|
70
|
+
};
|
|
71
|
+
// Its start, on the content: where it is as what scrolls under it moves (the tree's frame: from()).
|
|
72
|
+
const at = scrolled();
|
|
73
|
+
held.startX = event.clientX + at.x;
|
|
74
|
+
held.startY = event.clientY + at.y;
|
|
75
|
+
note("box selection", "press");
|
|
76
|
+
try {
|
|
77
|
+
document.documentElement.setPointerCapture(event.pointerId);
|
|
78
|
+
} catch {}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function draw() {
|
|
83
|
+
held.drawn = true;
|
|
84
|
+
held.tree = measure(held.root); // page coordinates, as what scrolls under it was then (held.at)
|
|
85
|
+
held.at = scrolled();
|
|
86
|
+
held.page = { x: scrollX, y: scrollY };
|
|
87
|
+
if (!held.shift) selection.clear();
|
|
88
|
+
// In the card's own top layer, over its content (the card on top when one was opened from another).
|
|
89
|
+
if (held.card) {
|
|
90
|
+
shape.dataset.docDev = "";
|
|
91
|
+
held.card.append(shape);
|
|
92
|
+
} else mount(shape);
|
|
93
|
+
scrolling.wake();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// The rectangle from where the press started (on the content) to the pointer, and what it takes:
|
|
97
|
+
// the window's rectangle in the tree's frame, moved by what has scrolled since it was measured.
|
|
98
|
+
function update() {
|
|
99
|
+
const now = scrolled();
|
|
100
|
+
const startX = held.startX - now.x;
|
|
101
|
+
const startY = held.startY - now.y;
|
|
102
|
+
const left = Math.min(startX, held.x);
|
|
103
|
+
const top = Math.min(startY, held.y);
|
|
104
|
+
const width = Math.abs(held.x - startX);
|
|
105
|
+
const height = Math.abs(held.y - startY);
|
|
106
|
+
Object.assign(shape.style, { transform: `translate(${Math.round(left)}px, ${Math.round(top)}px)`, width: `${Math.round(width)}px`, height: `${Math.round(height)}px` });
|
|
107
|
+
const dx = now.x - held.at.x + held.page.x;
|
|
108
|
+
const dy = now.y - held.at.y + held.page.y;
|
|
109
|
+
let taken = pick(held.tree, { left: left + dx, top: top + dy, right: left + width + dx, bottom: top + height + dy });
|
|
110
|
+
if (held.shift) taken = [...held.start.filter((node) => !taken.includes(node)), ...taken.filter((node) => !held.start.includes(node))];
|
|
111
|
+
selection.set(taken, { quiet: true });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function stop() {
|
|
115
|
+
if (!held) return;
|
|
116
|
+
const { pointer } = held;
|
|
117
|
+
held = null;
|
|
118
|
+
shape.remove();
|
|
119
|
+
document.documentElement.removeAttribute("data-ge-marquee");
|
|
120
|
+
try {
|
|
121
|
+
document.documentElement.releasePointerCapture(pointer);
|
|
122
|
+
} catch {}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** Give up the press (Esc, the window losing focus): a box selection being drawn takes nothing. */
|
|
126
|
+
function cancel() {
|
|
127
|
+
if (!held) return;
|
|
128
|
+
note("box selection", "cancelled");
|
|
129
|
+
if (held.drawn) selection.clear();
|
|
130
|
+
stop();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
addEventListener("pointermove", (event) => {
|
|
134
|
+
if (!held || event.pointerId !== held.pointer) return;
|
|
135
|
+
held.x = event.clientX;
|
|
136
|
+
held.y = event.clientY;
|
|
137
|
+
held.shift = event.shiftKey;
|
|
138
|
+
const at = scrolled();
|
|
139
|
+
if (!held.drawn && Math.hypot(event.clientX + at.x - held.startX, event.clientY + at.y - held.startY) > START) draw();
|
|
140
|
+
if (held.drawn) update();
|
|
141
|
+
}, true);
|
|
142
|
+
addEventListener("pointerup", (event) => {
|
|
143
|
+
if (!held || event.pointerId !== held.pointer) return;
|
|
144
|
+
const { drawn, target } = held;
|
|
145
|
+
stop();
|
|
146
|
+
if (!drawn) {
|
|
147
|
+
selection.clear();
|
|
148
|
+
click(event.clientX, event.clientY, target);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const taken = selection.get();
|
|
152
|
+
if (taken.length > 0) selection.set(taken); // says what was taken
|
|
153
|
+
}, true);
|
|
154
|
+
// After pointerup the press is over already (stop() let the capture go); it ends any other way too.
|
|
155
|
+
endsGesture({ active: () => Boolean(held), cancel, owns: (event) => event.pointerId === held.pointer });
|
|
156
|
+
cancelOnEscape({ active: () => Boolean(held), cancel });
|
|
157
|
+
addEventListener("scroll", () => { if (held?.drawn) update(); }, { passive: true, capture: true });
|
|
158
|
+
const shiftKey = (event) => {
|
|
159
|
+
if (!held?.drawn || event.key !== "Shift") return;
|
|
160
|
+
held.shift = event.type === "keydown";
|
|
161
|
+
update();
|
|
162
|
+
};
|
|
163
|
+
addEventListener("keyup", shiftKey, true);
|
|
164
|
+
addEventListener("keydown", shiftKey, true);
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
begin,
|
|
168
|
+
cancel,
|
|
169
|
+
/** A box selection is being drawn (the handle steps aside). */
|
|
170
|
+
get drawing() { return Boolean(held?.drawn); },
|
|
171
|
+
/** The editor's UI nodes to keep in the top layer when a modal dialog opens. */
|
|
172
|
+
get nodes() { return shape.isConnected ? [shape] : []; },
|
|
173
|
+
};
|
|
174
|
+
}
|