@heycys/gallery 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/THIRD-PARTY-NOTICES.md +3253 -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 +39 -0
- package/browser/editor/components/callout/page.mjs +13 -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 +297 -0
- package/browser/editor/components/details/index.mjs +72 -0
- package/browser/editor/components/details/page.mjs +86 -0
- package/browser/editor/components/dialog/index.mjs +83 -0
- package/browser/editor/components/dialog/page.mjs +219 -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 +33 -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 +51 -0
- package/browser/editor/components/highlight/index.mjs +79 -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 +45 -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 +133 -0
- package/browser/editor/components/installed/page.mjs +422 -0
- package/browser/editor/components/installed/served.mjs +35 -0
- package/browser/editor/components/kit.mjs +64 -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 +162 -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 +833 -0
- package/browser/editor/components/rows.mjs +16 -0
- package/browser/editor/components/section/index.mjs +41 -0
- package/browser/editor/components/section/page.mjs +141 -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 +306 -0
- package/browser/editor/components/table/page.mjs +672 -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 +229 -0
- package/browser/editor/page/annotate/card.mjs +102 -0
- package/browser/editor/page/annotate/index.mjs +1629 -0
- package/browser/editor/page/at-menu/index.mjs +317 -0
- package/browser/editor/page/autosave.mjs +977 -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 +82 -0
- package/browser/editor/page/block-menu/index.mjs +215 -0
- package/browser/editor/page/blocks.mjs +246 -0
- package/browser/editor/page/caret.mjs +679 -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 +797 -0
- package/browser/editor/page/clipboard/own/blocks.mjs +202 -0
- package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
- package/browser/editor/page/clipboard/own/describe.mjs +115 -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 +326 -0
- package/browser/editor/page/columns/index.mjs +360 -0
- package/browser/editor/page/commit.mjs +1798 -0
- package/browser/editor/page/conflicts.mjs +269 -0
- package/browser/editor/page/convert.mjs +830 -0
- package/browser/editor/page/core.mjs +1655 -0
- package/browser/editor/page/drag/drop.mjs +307 -0
- package/browser/editor/page/drag/index.mjs +335 -0
- package/browser/editor/page/drag/preview.mjs +121 -0
- package/browser/editor/page/edge-scroll.mjs +50 -0
- package/browser/editor/page/editor.mjs +1725 -0
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +278 -0
- package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
- package/browser/editor/page/emoji-picker/grid.mjs +79 -0
- package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
- package/browser/editor/page/emoji-picker/icons.mjs +32 -0
- package/browser/editor/page/emoji-picker/index.mjs +164 -0
- package/browser/editor/page/emoji-picker/styles.mjs +2 -0
- package/browser/editor/page/emoji-picker/support.mjs +202 -0
- package/browser/editor/page/emoji-picker/upload.mjs +235 -0
- package/browser/editor/page/export-report.mjs +23 -0
- package/browser/editor/page/fills.mjs +60 -0
- package/browser/editor/page/find/index.mjs +107 -0
- package/browser/editor/page/flags.mjs +70 -0
- package/browser/editor/page/format-bar/bar.mjs +448 -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 +400 -0
- package/browser/editor/page/gesture.mjs +45 -0
- package/browser/editor/page/handle/index.mjs +639 -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 +243 -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/look.mjs +65 -0
- package/browser/editor/page/made.mjs +24 -0
- package/browser/editor/page/margin.mjs +352 -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 +500 -0
- package/browser/editor/page/merge.mjs +100 -0
- package/browser/editor/page/notices.mjs +142 -0
- package/browser/editor/page/offered.mjs +32 -0
- package/browser/editor/page/outline/folds.mjs +52 -0
- package/browser/editor/page/outline/index.mjs +697 -0
- package/browser/editor/page/outline/list.mjs +172 -0
- package/browser/editor/page/outline/read.mjs +201 -0
- package/browser/editor/page/outline/strip.mjs +281 -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 +64 -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 +59 -0
- package/browser/editor/page/selection/index.mjs +157 -0
- package/browser/editor/page/selection/marquee.mjs +174 -0
- package/browser/editor/page/session.mjs +117 -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 +138 -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 +985 -0
- package/browser/editor/page/table/lists.mjs +187 -0
- package/browser/editor/page/table/widths.mjs +308 -0
- package/browser/editor/page/tex.mjs +32 -0
- package/browser/editor/page/text-select/index.mjs +656 -0
- package/browser/editor/page/tooltip.mjs +98 -0
- package/browser/editor/page/type-grid.mjs +82 -0
- package/browser/editor/page/typing/code-edges.mjs +228 -0
- package/browser/editor/page/typing/index.mjs +276 -0
- package/browser/editor/page/typing/leave.mjs +68 -0
- package/browser/editor/page/ui.mjs +160 -0
- package/browser/shared/annotations.mjs +571 -0
- package/browser/shared/code-folds.mjs +10 -0
- package/browser/shared/code-languages.mjs +70 -0
- package/browser/shared/code-lines.mjs +30 -0
- package/browser/shared/colors.mjs +28 -0
- package/browser/shared/component-catalog.mjs +559 -0
- package/browser/shared/components/bookmark.mjs +26 -0
- package/browser/shared/components/callout.mjs +7 -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 +342 -0
- package/browser/shared/components/installed.mjs +162 -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 +37 -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/emoji/custom.mjs +91 -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 +26 -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 +196 -0
- package/browser/shared/emoji/emoji.mjs +37 -0
- package/browser/shared/emoji/glyphs.mjs +134 -0
- package/browser/shared/emoji/icon-value.mjs +90 -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 +53 -0
- package/browser/shared/http.mjs +22 -0
- package/browser/shared/i18n/en.mjs +1164 -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/media.mjs +162 -0
- package/browser/shared/new-names.mjs +64 -0
- package/browser/shared/number-reading.mjs +92 -0
- package/browser/shared/old-names.mjs +143 -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 +110 -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 +76 -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.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-2PBALTR3.mjs +57 -0
- package/dist/chunk-342HXE3Q.mjs +2 -0
- package/dist/chunk-3LA3EMDE.mjs +15 -0
- package/dist/chunk-43B75J5T.mjs +2 -0
- package/dist/chunk-4K5KC6V2.mjs +2 -0
- package/dist/chunk-5FRMCDPY.mjs +16 -0
- package/dist/chunk-5L7RYZCL.mjs +2 -0
- package/dist/chunk-5LEK2CBS.mjs +2 -0
- package/dist/chunk-5OFN5AHC.mjs +2 -0
- package/dist/chunk-5SIYS5HN.mjs +2 -0
- package/dist/chunk-5TEK3RAD.mjs +2 -0
- package/dist/chunk-6CYG3Z4V.mjs +2 -0
- package/dist/chunk-6U2SLSDN.mjs +3 -0
- package/dist/chunk-742D2WWJ.mjs +19 -0
- package/dist/chunk-7GHT2UCA.mjs +15 -0
- package/dist/chunk-7QQBR7PB.mjs +2 -0
- package/dist/chunk-A55HN5OK.mjs +2 -0
- package/dist/chunk-ACOPDCNB.mjs +2 -0
- package/dist/chunk-AGDILNWB.mjs +2 -0
- package/dist/chunk-ATCJYAR4.mjs +2 -0
- package/dist/chunk-B3VTYBYR.mjs +960 -0
- package/dist/chunk-C564NU2H.mjs +77 -0
- package/dist/chunk-C7HWOBIF.mjs +2 -0
- package/dist/chunk-DB4WKGYF.mjs +7 -0
- package/dist/chunk-E7VYDG2X.mjs +2 -0
- package/dist/chunk-EUX7IC5J.mjs +48 -0
- package/dist/chunk-EVJ3BX3M.mjs +2 -0
- package/dist/chunk-EZY3WC6Z.mjs +15 -0
- package/dist/chunk-FQGQH4KM.mjs +2 -0
- package/dist/chunk-G7TOXONE.mjs +6 -0
- package/dist/chunk-GPF4YWWB.mjs +9 -0
- package/dist/chunk-GRAXKKG4.mjs +2 -0
- package/dist/chunk-GYQV7Y4J.mjs +120 -0
- package/dist/chunk-HMHK3EQ6.mjs +2 -0
- package/dist/chunk-HQQMJCQJ.mjs +10 -0
- package/dist/chunk-HYMEEXKN.mjs +4 -0
- package/dist/chunk-IERUOGC3.mjs +6 -0
- package/dist/chunk-ITNLYXXV.mjs +3 -0
- package/dist/chunk-L4DVONOG.mjs +2 -0
- package/dist/chunk-LAE5NQ4B.mjs +2 -0
- package/dist/chunk-LC7YNQFG.mjs +2 -0
- package/dist/chunk-LHTFLRB6.mjs +4 -0
- package/dist/chunk-LKX55H76.mjs +2 -0
- package/dist/chunk-MAFIGVXY.mjs +2 -0
- package/dist/chunk-NFIBI4IP.mjs +26 -0
- package/dist/chunk-NSKUTQ5J.mjs +5 -0
- package/dist/chunk-O52JMOCZ.mjs +2 -0
- package/dist/chunk-P2CAZPDP.mjs +3 -0
- package/dist/chunk-QAIHRH3I.mjs +13 -0
- package/dist/chunk-QMQUXTU4.mjs +12 -0
- package/dist/chunk-QR6A54KJ.mjs +3 -0
- package/dist/chunk-QVWVFC5K.mjs +6 -0
- package/dist/chunk-QYKCJ7FG.mjs +8 -0
- package/dist/chunk-QZY6Q64C.mjs +2 -0
- package/dist/chunk-TDQP3DKQ.mjs +10 -0
- package/dist/chunk-TMYZB6AV.mjs +2 -0
- package/dist/chunk-TX6JH7TR.mjs +2 -0
- package/dist/chunk-U3SSPL4K.mjs +8 -0
- package/dist/chunk-UH4SIXTR.mjs +2 -0
- package/dist/chunk-UNUEWH4S.mjs +2 -0
- package/dist/chunk-UXUK4PMC.mjs +27 -0
- package/dist/chunk-V4CPWKMZ.mjs +2 -0
- package/dist/chunk-V6XZ4VIR.mjs +2 -0
- package/dist/chunk-VACRB2NE.mjs +3 -0
- package/dist/chunk-W63L7367.mjs +7 -0
- package/dist/chunk-W7CXPCRV.mjs +6 -0
- package/dist/chunk-W7XHE4CT.mjs +2 -0
- package/dist/chunk-XINNG4F2.mjs +4 -0
- package/dist/chunk-Y34NR5JL.mjs +2 -0
- package/dist/chunk-YEY3RSFQ.mjs +2 -0
- package/dist/chunk-YL2DPWVS.mjs +4 -0
- package/dist/chunk-YXAUQPVK.mjs +8 -0
- package/dist/chunk-YZ5Z6H4W.mjs +4 -0
- package/dist/chunk-Z52HTUW7.mjs +4 -0
- package/dist/chunk-ZBIM6ARY.mjs +216 -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 +1988 -0
- package/kit/report.css +2821 -0
- package/kit/runtime.js +1707 -0
- package/kit/sheets.js +123 -0
- package/kit/state.js +217 -0
- package/kit/tables.js +1449 -0
- package/kit/tokens.js +29 -0
- package/kit/ui.js +561 -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 +141 -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 +138 -0
- package/skill/agents/openai.yaml +5 -0
- package/skill/references/building-components.md +327 -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 +141 -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-B6Ai3wsa.js +13 -0
- package/web/assets/index-SYPC3EZy.css +1 -0
- package/web/index.html +14 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { belowControl, colorSection, colorSwatch, FORMAT_ICONS, formatLook, listItem, tool } from "../format-bar/bar.mjs";
|
|
2
|
+
import { HIGHLIGHTS, TEXT_COLORS } from "../marks.mjs";
|
|
3
|
+
import { placeBox } from "../placement.mjs";
|
|
4
|
+
import { hideTooltip, shortcut } from "../tooltip.mjs";
|
|
5
|
+
import { element, fadeIn, fadeOut, mount } from "../ui.mjs";
|
|
6
|
+
import { alignItems } from "./aligns.mjs";
|
|
7
|
+
import { TABLE_ICONS } from "./icons.mjs";
|
|
8
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
9
|
+
|
|
10
|
+
// The bar over selected cells of a table (cells.mjs), in the format bar's look (format-bar/bar.mjs:
|
|
11
|
+
// its card, buttons, "A" and color picker, its list): one row of the "A" (the cells' color, one of
|
|
12
|
+
// Notion's text colors or fills as a block's; a click opens the colors below it: 文本颜色, 背景颜色,
|
|
13
|
+
// the cells' own ringed), bold, the alignment (its three below it, then the three vertical ones), 合并单元格 (several cells) or
|
|
14
|
+
// 拆分单元格 (one merged cell), then 清除内容 and "更多" (a row or column put in beside the cells,
|
|
15
|
+
// the cells' rows or columns taken out). It stands above the
|
|
16
|
+
// cells, below them when there is no room. It shows the cells' state and reports commands;
|
|
17
|
+
// cells.mjs applies them.
|
|
18
|
+
|
|
19
|
+
const APPEAR = 120;
|
|
20
|
+
const PANEL = 120;
|
|
21
|
+
const GAP = 8; // between the cells and the bar
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* run(command, value): "color" with { kind: "text" | "background", color } (null: none), "bold", "align" with an
|
|
25
|
+
* alignment class (CELL_ALIGNS, CELL_VALIGNS), "clear", "insert" with "above" | "below" | "left" | "right",
|
|
26
|
+
* "remove" with "rows" | "columns", "merge", "split".
|
|
27
|
+
*/
|
|
28
|
+
export function createCellBar(run) {
|
|
29
|
+
formatLook();
|
|
30
|
+
const sample = element("span", { class: "ge-ink-sample", text: "A" });
|
|
31
|
+
const tools = {
|
|
32
|
+
color: tool("color", t("颜色"), sample, () => toggle("colors")),
|
|
33
|
+
bold: tool("bold", t("加粗"), FORMAT_ICONS.bold, () => run("bold"), shortcut("mod+b")),
|
|
34
|
+
align: tool("align", t("对齐"), TABLE_ICONS["doc-align-left"], () => toggle("aligns")),
|
|
35
|
+
merge: tool("merge", () => (state.merge === "split" ? t("拆分单元格") : t("合并单元格")), TABLE_ICONS.merge, () => run(state.merge ?? "merge")),
|
|
36
|
+
clear: tool("clear", t("清除内容"), TABLE_ICONS.clear, () => run("clear"), "Del"),
|
|
37
|
+
more: tool("more", t("更多"), FORMAT_ICONS.more, () => toggle("more")),
|
|
38
|
+
};
|
|
39
|
+
for (const name of ["color", "align", "more"]) tools[name].setAttribute("aria-expanded", "false");
|
|
40
|
+
|
|
41
|
+
// A row of a list (the format bar's "更多" list) that closes the panels as it acts.
|
|
42
|
+
const item = (label, icon, action) => listItem(null, label, icon, () => { closePanels(); action(); });
|
|
43
|
+
const colors = element("div", { class: "ge-colors", role: "dialog", "aria-label": t("颜色"), hidden: "" });
|
|
44
|
+
// The alignments (aligns.mjs): the three, a separator, the three vertical ones.
|
|
45
|
+
const aligns = element("div", { class: "ge-more", role: "menu", "aria-label": t("对齐"), hidden: "" });
|
|
46
|
+
aligns.append(...alignItems([], (name) => run("align", name)).flatMap((align, index, all) => {
|
|
47
|
+
const node = item(align.label, align.icon, align.run);
|
|
48
|
+
node.dataset.align = align.name;
|
|
49
|
+
return index > 0 && align.vertical !== all[index - 1].vertical ? [element("div", { class: "ge-format-sep", role: "separator" }), node] : [node];
|
|
50
|
+
}));
|
|
51
|
+
const more = element("div", { class: "ge-more", role: "menu", "aria-label": t("更多"), hidden: "" },
|
|
52
|
+
item(t("在上方插入行"), TABLE_ICONS.above, () => run("insert", "above")),
|
|
53
|
+
item(t("在下方插入行"), TABLE_ICONS.below, () => run("insert", "below")),
|
|
54
|
+
item(t("在左侧插入列"), TABLE_ICONS.left, () => run("insert", "left")),
|
|
55
|
+
item(t("在右侧插入列"), TABLE_ICONS.right, () => run("insert", "right")),
|
|
56
|
+
item(t("删除所在行"), TABLE_ICONS.removeRow, () => run("remove", "rows")),
|
|
57
|
+
item(t("删除所在列"), TABLE_ICONS.removeColumn, () => run("remove", "columns")));
|
|
58
|
+
const panels = { colors, aligns, more };
|
|
59
|
+
const opener = { colors: tools.color, aligns: tools.align, more: tools.more };
|
|
60
|
+
let openPanel = null;
|
|
61
|
+
let state = { color: null, bold: false, aligns: alignItems([]), merge: null };
|
|
62
|
+
|
|
63
|
+
const box = element("div", { class: "ge-format-box" },
|
|
64
|
+
element("div", { class: "ge-format-row" }, tools.color, tools.bold, tools.align, tools.merge, tools.clear, tools.more));
|
|
65
|
+
const node = element("div", { class: "ge-format ge-cell-bar", role: "toolbar", "aria-label": t("单元格"), hidden: "" }, box, colors, aligns, more);
|
|
66
|
+
mount(node);
|
|
67
|
+
|
|
68
|
+
function toggle(name) {
|
|
69
|
+
const was = openPanel;
|
|
70
|
+
closePanels();
|
|
71
|
+
if (was !== name) openPanelNamed(name);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function openPanelNamed(name) {
|
|
75
|
+
hideTooltip();
|
|
76
|
+
const panel = panels[name];
|
|
77
|
+
if (name === "colors") {
|
|
78
|
+
// One color (默认 takes it away): the cells' own ringed, 默认文本 when they have none.
|
|
79
|
+
const kind = { text: "text", highlight: "background" };
|
|
80
|
+
const ringed = (family, value) => (value === null ? family === "text" && state.color === null : state.color?.kind === kind[family] && state.color.color === value);
|
|
81
|
+
const marked = (family, list) => list.map((value) => {
|
|
82
|
+
const swatch = colorSwatch(family, value, () => { closePanels(); run("color", value === null ? null : { kind: kind[family], color: value }); });
|
|
83
|
+
swatch.setAttribute("aria-pressed", String(ringed(family, value)));
|
|
84
|
+
return swatch;
|
|
85
|
+
});
|
|
86
|
+
colors.replaceChildren(colorSection(t("文本颜色"), marked("text", [null, ...TEXT_COLORS])), colorSection(t("背景颜色"), marked("highlight", [null, ...HIGHLIGHTS])));
|
|
87
|
+
}
|
|
88
|
+
if (name === "aligns") {
|
|
89
|
+
for (const row of aligns.querySelectorAll("[data-align]")) row.setAttribute("aria-pressed", String(state.aligns.some((align) => align.current && align.name === row.dataset.align)));
|
|
90
|
+
}
|
|
91
|
+
openPanel = name;
|
|
92
|
+
opener[name].setAttribute("aria-expanded", "true");
|
|
93
|
+
fadeIn(panel, PANEL);
|
|
94
|
+
belowControl(panel, opener[name]); // below its button, inside the window
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function closePanels(atOnce = false) {
|
|
98
|
+
if (!openPanel) return false;
|
|
99
|
+
const panel = panels[openPanel];
|
|
100
|
+
opener[openPanel].setAttribute("aria-expanded", "false");
|
|
101
|
+
openPanel = null;
|
|
102
|
+
if (atOnce) panel.hidden = true;
|
|
103
|
+
fadeOut(panel, PANEL);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
node,
|
|
109
|
+
get visible() { return !node.hidden; },
|
|
110
|
+
holds: (target) => node.contains(target),
|
|
111
|
+
/** Close the colors or a list, if one is open (Esc); returns whether one was. */
|
|
112
|
+
closePanels,
|
|
113
|
+
/**
|
|
114
|
+
* Show over `rect` (the selected cells, window coordinates), centered above them. now: the
|
|
115
|
+
* cells' { color: { kind, color } | null (undefined: not the same in all), bold, aligns (aligns.mjs alignItems), merge }.
|
|
116
|
+
*/
|
|
117
|
+
show(rect, now) {
|
|
118
|
+
state = now;
|
|
119
|
+
const { kind, color } = now.color ?? {};
|
|
120
|
+
sample.className = ["ge-ink-sample", color && (kind === "text" ? `doc-text-${color}` : `doc-highlight-${color}`)].filter(Boolean).join(" ");
|
|
121
|
+
sample.setAttribute("data-ring", kind === "background" ? color : "default");
|
|
122
|
+
tools.bold.setAttribute("aria-pressed", String(now.bold));
|
|
123
|
+
tools.align.innerHTML = (now.aligns.find((align) => align.current && !align.vertical) ?? now.aligns[0]).icon;
|
|
124
|
+
// 合并单元格 or 拆分单元格, or none (one plain cell).
|
|
125
|
+
tools.merge.hidden = !now.merge;
|
|
126
|
+
tools.merge.innerHTML = TABLE_ICONS[now.merge ?? "merge"];
|
|
127
|
+
tools.merge.setAttribute("aria-label", now.merge === "split" ? t("拆分单元格") : t("合并单元格"));
|
|
128
|
+
if (node.hidden) fadeIn(node, APPEAR);
|
|
129
|
+
const { offsetWidth: width, offsetHeight: height } = box;
|
|
130
|
+
const { left, top } = placeBox(rect, { width, height }, { placement: "top", align: "center", gap: GAP, margin: 12 });
|
|
131
|
+
node.style.transform = `translate(${Math.round(left)}px, ${Math.round(top)}px)`;
|
|
132
|
+
},
|
|
133
|
+
hide() {
|
|
134
|
+
closePanels(true);
|
|
135
|
+
node.hidden = true;
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
import { escapeText } from "../../../shared/escape.mjs";
|
|
2
|
+
import { BLOCK_COLORS, cellColorOf, colorLook } from "../../components/colors.mjs";
|
|
3
|
+
import { CELLS_MIME as MIME, CELL_BOLD, OLD_CELLS_MIME, cellsData } from "../../components/table/index.mjs";
|
|
4
|
+
import { alignItems, alignLook } from "./aligns.mjs";
|
|
5
|
+
import { insertColumn, insertRow, tableParts, tableSlots, tableState } from "../../components/table/page.mjs";
|
|
6
|
+
import { atEdge, editable } from "../caret.mjs";
|
|
7
|
+
import { pastedLines, serializeInner } from "../core.mjs";
|
|
8
|
+
import { formulaMaker, loadKatex } from "../formula/index.mjs";
|
|
9
|
+
import { FORMAT_KEYS } from "../format-bar/index.mjs";
|
|
10
|
+
import { formatRange, markValue } from "../marks.mjs";
|
|
11
|
+
import { gestureLock } from "../gesture.mjs";
|
|
12
|
+
import { addStyle } from "../ui.mjs";
|
|
13
|
+
import { createCellBar } from "./cell-bar.mjs";
|
|
14
|
+
import { createCellLists } from "./lists.mjs";
|
|
15
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
16
|
+
|
|
17
|
+
// Selected cells of a table and the keys in a table (notion-lite's, src/blocks/table/edit/; the
|
|
18
|
+
// rules in table-math-plan-2026-10-18.md), with the cells' bar (cell-bar.mjs) over them.
|
|
19
|
+
//
|
|
20
|
+
// - Selecting: a press in a cell dragged into another selects the cells between (the text selection
|
|
21
|
+
// goes; back in the first, that one cell, no caret); Shift+click from the selection's anchor (or
|
|
22
|
+
// the caret's cell), and on with a drag. The caret in a cell makes that cell the selection (index.mjs
|
|
23
|
+
// draws its frame). Until a press in a cell is let go, the table's tools take no pointer (STYLE).
|
|
24
|
+
// - The caret in a cell: Tab / Shift+Tab to the next / previous cell, Enter to the one below, Esc
|
|
25
|
+
// selects the cell; Backspace at its start and Delete at its end do nothing. In a list of the
|
|
26
|
+
// cell's (lists.mjs), Enter and Backspace at an item's start are the list's.
|
|
27
|
+
// - Cells selected: the arrows move a one-cell selection (a row's up and down, a column's left and
|
|
28
|
+
// right), with Shift its far edge; Tab as →, Shift+Tab as Shift+←; Enter edits the focus cell
|
|
29
|
+
// (Shift+Enter in the last row puts a row below); Esc selects the cell's row, else the table;
|
|
30
|
+
// Backspace / Delete take out selected rows or columns, else empty the cells and take their color;
|
|
31
|
+
// a typed character goes at the end of the last cell, editing it; Ctrl+D fills down (copies rows or
|
|
32
|
+
// columns), Ctrl+R right; Ctrl+B / I / U / E and Ctrl+Shift+S format whole cells.
|
|
33
|
+
// - Copied, cells are the page's own (their inline HTML), an HTML table and lines of tab-separated
|
|
34
|
+
// text; pasted onto selected cells, the page's own, another program's table (its words) or lines
|
|
35
|
+
// of tab-separated text fill them from the top left (repeated over a selection a whole number of
|
|
36
|
+
// times larger), rows and columns put in where they overflow; one undo step.
|
|
37
|
+
// A cell's color (one, as a block's: components/colors.mjs) and alignment are its classes (its look:
|
|
38
|
+
// components/table/index.mjs); its text changes are the editor's (struct, history.mjs). Where cells
|
|
39
|
+
// are merged (shared/table-slots.mjs), Tab goes from cell to cell, the arrows and Enter step
|
|
40
|
+
// past a merged cell, and copies and pastes go by its top left slot.
|
|
41
|
+
|
|
42
|
+
const STYLE = `
|
|
43
|
+
${gestureLock("data-ge-tcells", { select: true })}
|
|
44
|
+
/* The button held after a press in a cell (cells or text being selected): the tools standing by the table (the lines' strips, widths.mjs; the grips, + points and corner, index.mjs) take no pointer, so none lights, shows its cursor or draws its line as the pointer goes over them. */
|
|
45
|
+
html[data-ge-tpress] :is(.ge-tcol, .ge-trows, .ge-tgrip, .ge-tplus, .ge-tgrow) { pointer-events: none; }
|
|
46
|
+
/* A cell has square corners and no fill under the pointer, hovered or edited (selected cells have the table tools' frame). */
|
|
47
|
+
[data-ge-editing] [data-ge-kind="cell"][contenteditable="true"] { --ge-text-radius: 0px; --ge-text-tint: none; }
|
|
48
|
+
`;
|
|
49
|
+
const MAX_PASTE = 5000; // cells a paste may fill (a table's limit: components/table/file.mjs)
|
|
50
|
+
const same = (a, b) => a?.[0] === b?.[0] && a?.[1] === b?.[1];
|
|
51
|
+
const clamp = (value, low, high) => Math.max(low, Math.min(high, value));
|
|
52
|
+
const isCell = (node) => /^(TD|TH)$/.test(node?.tagName ?? "");
|
|
53
|
+
const writable = (cell) => cell.getAttribute("contenteditable") === "true";
|
|
54
|
+
const contents = (cell) => {
|
|
55
|
+
const range = document.createRange();
|
|
56
|
+
range.selectNodeContents(cell);
|
|
57
|
+
return range;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** Cells emptied, their color and their bold taken too (notion-lite's 清除内容), one undo step. */
|
|
61
|
+
export function clearCells(tools, list) {
|
|
62
|
+
const targets = list.filter((cell) => writable(cell) && (cell.hasChildNodes() || cellColorOf(cell) || cell.classList.contains(CELL_BOLD)));
|
|
63
|
+
if (targets.length === 0) return;
|
|
64
|
+
tools.struct([...new Set(targets.map((cell) => cell.parentElement))], targets, () => {
|
|
65
|
+
for (const cell of targets) {
|
|
66
|
+
cell.replaceChildren();
|
|
67
|
+
cell.classList.remove(...BLOCK_COLORS, CELL_BOLD);
|
|
68
|
+
}
|
|
69
|
+
return { touched: targets, focus: null };
|
|
70
|
+
});
|
|
71
|
+
tools.say(t("已清除内容 · Ctrl+Z 撤销"));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** t: the table tools' selection and changes (index.mjs). */
|
|
75
|
+
export function createCells(tools) {
|
|
76
|
+
addStyle(STYLE);
|
|
77
|
+
const bar = createCellBar(run);
|
|
78
|
+
const lists = createCellLists(tools);
|
|
79
|
+
let press = null; // the main button down in a cell: { unit, start: [row, column], crossed }
|
|
80
|
+
let swallow = false; // a Shift+click selected: the mousedown after it does nothing
|
|
81
|
+
|
|
82
|
+
// ---------- the pointer ----------
|
|
83
|
+
|
|
84
|
+
document.addEventListener("pointerdown", (event) => {
|
|
85
|
+
// (A header's sort arrow is the kit's control: index.mjs sorts by it.)
|
|
86
|
+
if (!tools.active() || event.button !== 0 || event.target?.closest?.("[data-doc-dev], .ge-pop, .doc-table-sort-button")) return;
|
|
87
|
+
const cell = event.target?.closest?.("td, th");
|
|
88
|
+
const unit = tools.tableAt(cell);
|
|
89
|
+
const sel = tools.sel;
|
|
90
|
+
if (!unit) {
|
|
91
|
+
// A press outside the table lets its selection go.
|
|
92
|
+
if (sel && !sel.unit.contains(event.target)) tools.clear();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const at = tools.placeOf(tableSlots(unit), cell);
|
|
96
|
+
// Until it is let go, the tools by the table wait (notion-lite's hover waits for its drag): STYLE.
|
|
97
|
+
document.documentElement.setAttribute("data-ge-tpress", "");
|
|
98
|
+
if (event.shiftKey) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
event.stopImmediatePropagation();
|
|
101
|
+
swallow = true;
|
|
102
|
+
const anchor = sel?.unit === unit ? sel.anchor : at;
|
|
103
|
+
tools.selectCells(unit, anchor, at);
|
|
104
|
+
press = { unit, start: anchor, crossed: true };
|
|
105
|
+
document.documentElement.setAttribute("data-ge-tcells", "");
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (sel && !sel.editing) tools.clear(); // the caret goes in where it was pressed
|
|
109
|
+
press = { unit, start: at, crossed: false };
|
|
110
|
+
}, true);
|
|
111
|
+
document.addEventListener("mousedown", (event) => {
|
|
112
|
+
if (!swallow) return;
|
|
113
|
+
swallow = false;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
event.stopImmediatePropagation();
|
|
116
|
+
}, true);
|
|
117
|
+
|
|
118
|
+
document.addEventListener("pointermove", (event) => {
|
|
119
|
+
if (!press || !(event.buttons & 1)) return;
|
|
120
|
+
const at = tools.cellAt(press.unit, event.clientX, event.clientY);
|
|
121
|
+
if (!at || (!press.crossed && same(at, press.start))) return; // in the cell it began in: the browser's selection
|
|
122
|
+
press.crossed = true;
|
|
123
|
+
document.documentElement.setAttribute("data-ge-tcells", "");
|
|
124
|
+
const sel = tools.sel;
|
|
125
|
+
if (sel && !sel.editing && sel.type === "cell" && same(sel.anchor, press.start) && same(sel.focus, at)) return;
|
|
126
|
+
tools.selectCells(press.unit, press.start, at);
|
|
127
|
+
}, true);
|
|
128
|
+
const release = () => {
|
|
129
|
+
press = null;
|
|
130
|
+
document.documentElement.removeAttribute("data-ge-tcells");
|
|
131
|
+
document.documentElement.removeAttribute("data-ge-tpress");
|
|
132
|
+
};
|
|
133
|
+
document.addEventListener("pointerup", release, true);
|
|
134
|
+
document.addEventListener("pointercancel", release, true);
|
|
135
|
+
addEventListener("blur", release);
|
|
136
|
+
|
|
137
|
+
// The caret in a cell is that cell's selection; in text outside the table, the selection goes.
|
|
138
|
+
document.addEventListener("selectionchange", () => {
|
|
139
|
+
if (!tools.active()) return;
|
|
140
|
+
const selection = getSelection();
|
|
141
|
+
if (press?.crossed) {
|
|
142
|
+
if (selection.rangeCount) selection.removeAllRanges();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (!selection.rangeCount) return;
|
|
146
|
+
const host = editable(selection.anchorNode);
|
|
147
|
+
const unit = isCell(host) ? tools.tableAt(host) : null;
|
|
148
|
+
const sel = tools.sel;
|
|
149
|
+
if (unit) {
|
|
150
|
+
const at = tools.placeOf(tableSlots(unit), host);
|
|
151
|
+
if (!(sel?.editing && sel.unit === unit && same(sel.anchor, at))) tools.editing(unit, at);
|
|
152
|
+
} else if (sel && host) tools.clear();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// ---------- the keys ----------
|
|
156
|
+
|
|
157
|
+
document.addEventListener("keydown", (event) => {
|
|
158
|
+
const sel = tools.sel;
|
|
159
|
+
if (!sel || !tools.active() || event.defaultPrevented || event.isComposing || event.keyCode === 229) return;
|
|
160
|
+
if (tools.typedKey(event)) return void event.stopImmediatePropagation();
|
|
161
|
+
if (!sel.unit.isConnected || tools.menuOpen() || tools.dragging() || event.target?.closest?.("input, textarea, .ge-pop, .notion-popup-layer")) return;
|
|
162
|
+
if (sel.editing ? caretKey(event, sel) : cellKey(event, sel)) {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
event.stopImmediatePropagation();
|
|
165
|
+
}
|
|
166
|
+
}, true);
|
|
167
|
+
|
|
168
|
+
// The caret in a cell: whether the key was the table's.
|
|
169
|
+
function caretKey(event, sel) {
|
|
170
|
+
const host = editable(event.target);
|
|
171
|
+
if (!isCell(host) || tools.tableAt(host) !== sel.unit || event.ctrlKey || event.metaKey || event.altKey) return false;
|
|
172
|
+
const { unit } = sel;
|
|
173
|
+
const { rows, slots } = tableState(unit);
|
|
174
|
+
const at = tools.placeOf(slots, host);
|
|
175
|
+
if (!at || !slots) return false;
|
|
176
|
+
if (lists.key(event, host)) return true;
|
|
177
|
+
const selection = getSelection();
|
|
178
|
+
switch (event.key) {
|
|
179
|
+
case "Tab": {
|
|
180
|
+
// The next (previous) cell in reading order, a merged one once.
|
|
181
|
+
const places = [...slots.places.values()];
|
|
182
|
+
const index = places.findIndex((place) => place.r === at[0] && place.c === at[1]) + (event.shiftKey ? -1 : 1);
|
|
183
|
+
if (index >= 0 && index < places.length) tools.editCell(unit, [places[index].r, places[index].c]);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
case "Enter": {
|
|
187
|
+
if (event.shiftKey) return false; // a line break in the cell
|
|
188
|
+
const below = at[0] + slots.places.get(host).rows;
|
|
189
|
+
if (below < rows.length) tools.editCell(unit, [below, at[1]]);
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
case "Backspace":
|
|
193
|
+
return !event.shiftKey && selection.isCollapsed && atEdge(host, false);
|
|
194
|
+
case "Delete":
|
|
195
|
+
return !event.shiftKey && selection.isCollapsed && atEdge(host, true);
|
|
196
|
+
case "Escape":
|
|
197
|
+
tools.selectCells(unit, at);
|
|
198
|
+
return true;
|
|
199
|
+
default:
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const ARROWS = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] };
|
|
205
|
+
|
|
206
|
+
// Cells (rows, columns) selected: whether the key was the table's.
|
|
207
|
+
function cellKey(event, sel) {
|
|
208
|
+
const { unit } = sel;
|
|
209
|
+
const mod = event.ctrlKey || event.metaKey;
|
|
210
|
+
const key = event.key;
|
|
211
|
+
const { rows, columns, body } = tableState(unit);
|
|
212
|
+
const b = tools.bounds(sel);
|
|
213
|
+
const single = b.r0 === b.r1 && b.c0 === b.c1;
|
|
214
|
+
if (mod && !event.altKey) {
|
|
215
|
+
const letter = key.toLowerCase();
|
|
216
|
+
if (letter === "d" && !event.shiftKey) {
|
|
217
|
+
if (sel.type === "row" || sel.type === "column") tools.duplicate(unit, sel.type, sel.type === "row" ? b.r0 : b.c0, sel.type === "row" ? b.r1 : b.c1);
|
|
218
|
+
else if (b.r1 > b.r0) fill(sel, "down");
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
if (letter === "r" && !event.shiftKey) {
|
|
222
|
+
if (b.c1 > b.c0) fill(sel, "right");
|
|
223
|
+
return true; // never the browser's reload
|
|
224
|
+
}
|
|
225
|
+
if (!event.shiftKey && FORMAT_KEYS[letter] === "bold") return bold(tools.selectedCells(sel)), true;
|
|
226
|
+
if (!event.shiftKey && FORMAT_KEYS[letter]) return format(tools.selectedCells(sel), [[FORMAT_KEYS[letter]]]), true;
|
|
227
|
+
if (event.shiftKey && (letter === "s" || letter === "x")) return format(tools.selectedCells(sel), [["strike"]]), true;
|
|
228
|
+
return false; // copy, cut and paste come as their events
|
|
229
|
+
}
|
|
230
|
+
if (mod && event.altKey && key === "\\") {
|
|
231
|
+
format(tools.selectedCells(sel), [["bold", false], ["italic", false], ["underline", false], ["strike", false], ["code", false], ["text", null], ["highlight", null]], { [CELL_BOLD]: false });
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
if (event.altKey) return false;
|
|
235
|
+
const arrow = key in ARROWS ? key : key === "Tab" ? (event.shiftKey ? "ArrowLeft" : "ArrowRight") : null;
|
|
236
|
+
if (arrow) {
|
|
237
|
+
tools.keys(true);
|
|
238
|
+
const [dr, dc] = ARROWS[arrow];
|
|
239
|
+
if (event.shiftKey) {
|
|
240
|
+
// The edge furthest from the anchor moves.
|
|
241
|
+
const anchor = [sel.type === "column" ? b.r0 : sel.anchor[0], sel.type === "row" ? b.c0 : sel.anchor[1]];
|
|
242
|
+
const far = [anchor[0] === b.r0 ? b.r1 : b.r0, anchor[1] === b.c0 ? b.c1 : b.c0];
|
|
243
|
+
tools.selectCells(unit, anchor, [clamp(far[0] + dr, 0, rows.length - 1), clamp(far[1] + dc, 0, columns - 1)]);
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
if (sel.type === "row" && dc === 0) return tools.selectRows(unit, clamp(b.r0 + dr, 0, rows.length - 1)), true;
|
|
247
|
+
if (sel.type === "column" && dr === 0) return tools.selectColumns(unit, clamp(b.c0 + dc, 0, columns - 1)), true;
|
|
248
|
+
// From the focus's row and the first column (←/→), the first row and the focus's column (↑/↓);
|
|
249
|
+
// ←/→ go on to the row before or after. One merged cell selected: from its edges, past it.
|
|
250
|
+
const merged = tools.selectedCells(sel).length === 1 && (b.r1 > b.r0 || b.c1 > b.c0);
|
|
251
|
+
let [r, c] = dc !== 0 ? [sel.focus[0], b.c0] : [b.r0, sel.focus[1]];
|
|
252
|
+
if (merged && dc > 0) c = b.c1;
|
|
253
|
+
if (merged && dr > 0) r = b.r1;
|
|
254
|
+
if (dc !== 0) {
|
|
255
|
+
c += dc;
|
|
256
|
+
if (c < 0) [r, c] = r > 0 ? [r - 1, columns - 1] : [r, 0];
|
|
257
|
+
else if (c >= columns) [r, c] = r < rows.length - 1 ? [r + 1, 0] : [r, columns - 1];
|
|
258
|
+
} else r = clamp(r + dr, 0, rows.length - 1);
|
|
259
|
+
tools.selectCells(unit, [r, c]);
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
switch (key) {
|
|
263
|
+
case "Enter":
|
|
264
|
+
if (sel.type !== "cell") return false;
|
|
265
|
+
if (!event.shiftKey) return tools.editCell(unit, sel.focus), true;
|
|
266
|
+
// Shift+Enter on one cell of the last row: a row below, that cell's column edited.
|
|
267
|
+
if (single && b.r0 === rows.length - 1 && tools.change(unit, () => insertRow(unit, rows.length), t("已插入一行"))) tools.editCell(unit, [b.r0 + 1, b.c0]);
|
|
268
|
+
return true;
|
|
269
|
+
case "Escape":
|
|
270
|
+
if (sel.type === "cell" && single) tools.selectRows(unit, b.r0);
|
|
271
|
+
else tools.selectBlock(unit);
|
|
272
|
+
return true;
|
|
273
|
+
case "Backspace":
|
|
274
|
+
case "Delete": {
|
|
275
|
+
// Rows or columns, not all of them, go (the one after them selected); else the cells empty.
|
|
276
|
+
const heads = rows.length - body.rows.length;
|
|
277
|
+
const allRows = b.r0 <= heads && b.r1 >= rows.length - 1;
|
|
278
|
+
const allColumns = b.c0 === 0 && b.c1 >= columns - 1;
|
|
279
|
+
if ((sel.type === "row" && !allRows) || (sel.type === "column" && !allColumns)) {
|
|
280
|
+
const axis = sel.type;
|
|
281
|
+
if (tools.removeRange(unit, axis, axis === "row" ? b.r0 : b.c0, axis === "row" ? b.r1 : b.c1)) {
|
|
282
|
+
const now = tableState(unit);
|
|
283
|
+
if (axis === "row") tools.selectRows(unit, Math.min(b.r0, now.rows.length - 1));
|
|
284
|
+
else tools.selectColumns(unit, Math.min(b.c0, now.columns - 1));
|
|
285
|
+
}
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
clearCells(tools, tools.selectedCells(sel));
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
default:
|
|
292
|
+
// A character: at the end of the last cell, which is edited (the key goes on to it).
|
|
293
|
+
if (key.length === 1 && !mod) tools.editCell(unit, [b.r1, b.c1]);
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Formats on whole cells (the format bar's, marks.mjs) and `classes` of their looks ({ name: on }),
|
|
299
|
+
// one undo step. changes: [[name, value]], value undefined toggles (off when every cell with text
|
|
300
|
+
// has it all over, else on).
|
|
301
|
+
function format(list, changes, classes = null) {
|
|
302
|
+
const cells = list.filter(writable);
|
|
303
|
+
const written = cells.filter((cell) => cell.textContent.trim() !== "");
|
|
304
|
+
const looked = classes ? cells.filter((cell) => Object.entries(classes).some(([name, on]) => cell.classList.contains(name) !== on)) : [];
|
|
305
|
+
if (written.length === 0 && looked.length === 0) return false;
|
|
306
|
+
const resolved = changes.map(([name, value]) => [name, value === undefined ? !written.every((cell) => markValue(cell, contents(cell), name) === true) : value]);
|
|
307
|
+
const touched = [...new Set([...written, ...looked])]; // their text and classes recorded
|
|
308
|
+
tools.struct([], touched, () => {
|
|
309
|
+
for (const cell of written) for (const [name, value] of resolved) formatRange(cell, contents(cell), name, value);
|
|
310
|
+
for (const cell of looked) for (const [name, on] of Object.entries(classes)) cell.classList.toggle(name, on);
|
|
311
|
+
return { touched, focus: null };
|
|
312
|
+
});
|
|
313
|
+
update();
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Bold on whole cells is theirs (CELL_BOLD, a look: the words typed in them later bold too, as a
|
|
318
|
+
// header's are); off, the look and their words' bold both.
|
|
319
|
+
const isBold = (cell) => cell.classList.contains(CELL_BOLD) || (cell.textContent.trim() !== "" && markValue(cell, contents(cell), "bold") === true);
|
|
320
|
+
function bold(list) {
|
|
321
|
+
const cells = list.filter(writable);
|
|
322
|
+
const on = !cells.every(isBold);
|
|
323
|
+
return format(cells, on ? [] : [["bold", false]], { [CELL_BOLD]: on });
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Ctrl+D / Ctrl+R: the first row (column) of the cells copied into the others (their text).
|
|
327
|
+
function fill(sel, direction) {
|
|
328
|
+
const { r0, r1, c0, c1 } = tools.bounds(sel);
|
|
329
|
+
const slots = tableSlots(sel.unit);
|
|
330
|
+
const pairs = [];
|
|
331
|
+
for (let r = r0; r <= r1; r++) {
|
|
332
|
+
for (let c = c0; c <= c1; c++) {
|
|
333
|
+
if (direction === "down" ? r === r0 : c === c0) continue;
|
|
334
|
+
const from = tools.cellOf(slots, direction === "down" ? [r0, c] : [r, c0]);
|
|
335
|
+
const to = tools.cellOf(slots, [r, c]);
|
|
336
|
+
// A cell once, never from itself (a merged cell across the first row or column).
|
|
337
|
+
if (from && to && to !== from && writable(to) && !pairs.some(([, other]) => other === to)) pairs.push([from, to]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
const targets = pairs.map(([, to]) => to);
|
|
341
|
+
if (targets.length === 0) return;
|
|
342
|
+
tools.struct([...new Set(targets.map((cell) => cell.parentElement))], targets, () => {
|
|
343
|
+
for (const [from, to] of pairs) {
|
|
344
|
+
if (writable(from)) to.innerHTML = from.innerHTML;
|
|
345
|
+
else to.textContent = from.textContent;
|
|
346
|
+
}
|
|
347
|
+
return { touched: targets, focus: null };
|
|
348
|
+
});
|
|
349
|
+
tools.say(direction === "down" ? t("已向下填充 · Ctrl+Z 撤销") : t("已向右填充 · Ctrl+Z 撤销"));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ---------- the bar ----------
|
|
353
|
+
|
|
354
|
+
function run(command, value) {
|
|
355
|
+
const sel = tools.sel;
|
|
356
|
+
if (!sel) return;
|
|
357
|
+
const list = tools.selectedCells(sel);
|
|
358
|
+
const b = tools.bounds(sel);
|
|
359
|
+
if (command === "color") {
|
|
360
|
+
if (tools.look(list, colorLook(value ?? { kind: "text", color: null }, { only: true }))) tools.say(t("已设置颜色 · Ctrl+Z 撤销"));
|
|
361
|
+
} else if (command === "align") {
|
|
362
|
+
tools.look(list, alignLook(value));
|
|
363
|
+
} else if (command === "bold") {
|
|
364
|
+
bold(list);
|
|
365
|
+
} else if (command === "clear") {
|
|
366
|
+
clearCells(tools, list);
|
|
367
|
+
} else if (command === "insert") {
|
|
368
|
+
const [axis, at] = { above: ["row", b.r0], below: ["row", b.r1 + 1], left: ["column", b.c0], right: ["column", b.c1 + 1] }[value];
|
|
369
|
+
tools.insert(sel.unit, axis, at);
|
|
370
|
+
return;
|
|
371
|
+
} else if (command === "remove") {
|
|
372
|
+
const axis = value === "rows" ? "row" : "column";
|
|
373
|
+
if (tools.removeRange(sel.unit, axis, axis === "row" ? b.r0 : b.c0, axis === "row" ? b.r1 : b.c1)) tools.clear();
|
|
374
|
+
return;
|
|
375
|
+
} else if (command === "merge") {
|
|
376
|
+
tools.merge();
|
|
377
|
+
} else if (command === "split") {
|
|
378
|
+
tools.split();
|
|
379
|
+
}
|
|
380
|
+
update();
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// The bar over selected cells (not rows or columns, which have their menus; not the caret's cell).
|
|
384
|
+
function update() {
|
|
385
|
+
const sel = tools.sel;
|
|
386
|
+
if (!sel || sel.editing || sel.type !== "cell" || !tools.active() || !sel.unit.isConnected) return bar.hide();
|
|
387
|
+
const list = tools.selectedCells(sel);
|
|
388
|
+
if (list.length === 0) return bar.hide();
|
|
389
|
+
const rects = list.map((cell) => cell.getBoundingClientRect());
|
|
390
|
+
const rect = { left: Math.min(...rects.map((r) => r.left)), top: Math.min(...rects.map((r) => r.top)), right: Math.max(...rects.map((r) => r.right)), bottom: Math.max(...rects.map((r) => r.bottom)) };
|
|
391
|
+
bar.show({ ...rect, width: rect.right - rect.left, height: rect.bottom - rect.top }, stateOf(list));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// What the cells share: a color, bold, their alignments (aligns.mjs; none current when they differ).
|
|
395
|
+
function stateOf(list) {
|
|
396
|
+
const colorOf = (cell) => cellColorOf(cell);
|
|
397
|
+
const first = colorOf(list[0]);
|
|
398
|
+
const color = list.every((cell) => JSON.stringify(colorOf(cell)) === JSON.stringify(first)) ? first : undefined;
|
|
399
|
+
const own = list.filter(writable);
|
|
400
|
+
const bolded = own.length > 0 && own.every(isBold);
|
|
401
|
+
// Several cells may be made one; one merged cell, separate cells again.
|
|
402
|
+
const merge = list.length > 1 ? "merge" : list[0] && (list[0].rowSpan > 1 || list[0].colSpan > 1) ? "split" : null;
|
|
403
|
+
return { color, bold: bolded, aligns: alignItems(list), merge };
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// ---------- the clipboard ----------
|
|
407
|
+
|
|
408
|
+
// A cell's inline HTML as copied (a locked cell's words alone: what a script drew is not its text).
|
|
409
|
+
const htmlOf = (cell) => (writable(cell) ? serializeInner(cell) : escapeText(cell.textContent));
|
|
410
|
+
|
|
411
|
+
function copy(event) {
|
|
412
|
+
const sel = tools.sel;
|
|
413
|
+
if (!sel || sel.editing || !tools.active() || !sel.unit.isConnected) return;
|
|
414
|
+
event.preventDefault();
|
|
415
|
+
event.stopImmediatePropagation();
|
|
416
|
+
const { r0, r1, c0, c1 } = tools.bounds(sel);
|
|
417
|
+
const { slots } = tableState(sel.unit);
|
|
418
|
+
// By slots: a merged cell in its top left one, the others it covers empty.
|
|
419
|
+
const grid = [];
|
|
420
|
+
for (let r = r0; r <= r1; r++) {
|
|
421
|
+
grid.push([]);
|
|
422
|
+
for (let c = c0; c <= c1; c++) {
|
|
423
|
+
const cell = slots.matrix[r][c];
|
|
424
|
+
const place = slots.places.get(cell);
|
|
425
|
+
grid.at(-1).push(place.r === r && place.c === c ? cell : null);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const html = grid.map((row) => row.map((cell) => (cell ? htmlOf(cell) : "")));
|
|
429
|
+
const payload = JSON.stringify({ v: 1, cells: html });
|
|
430
|
+
event.clipboardData.setData(MIME, payload);
|
|
431
|
+
event.clipboardData.setData(OLD_CELLS_MIME, payload); // a page of the old version (before 2026-10-26) reads this one
|
|
432
|
+
event.clipboardData.setData("text/html", `<table>${html.map((row) => `<tr>${row.map((cell) => `<td>${cell}</td>`).join("")}</tr>`).join("")}</table>`);
|
|
433
|
+
event.clipboardData.setData("text/plain", grid.map((row) => row.map((cell) => (cell?.textContent ?? "").replace(/[\t\n]+/g, " ")).join("\t")).join("\n"));
|
|
434
|
+
if (event.type === "cut") clearCells(tools, grid.flat().filter(Boolean));
|
|
435
|
+
else tools.say(t("已复制 {0} 格", grid.length * grid[0].length));
|
|
436
|
+
}
|
|
437
|
+
document.addEventListener("copy", copy, true);
|
|
438
|
+
document.addEventListener("cut", copy, true);
|
|
439
|
+
|
|
440
|
+
// What is pasted, as rows of cells ({ html } the page's own, { text } another program's), or null:
|
|
441
|
+
// the page's cells, its text, table or blocks with their marks (blocks one cell of their words, no
|
|
442
|
+
// list's marker or Markdown: tools.ownCells), another program's table, tab-separated lines or text.
|
|
443
|
+
function gridOf(data) {
|
|
444
|
+
try {
|
|
445
|
+
const own = JSON.parse(cellsData(data) || "null");
|
|
446
|
+
if (Array.isArray(own?.cells) && own.cells.length > 0 && own.cells.every((row) => Array.isArray(row) && row.length > 0 && row.every((html) => typeof html === "string"))) {
|
|
447
|
+
return own.cells.map((row) => row.map((html) => ({ html })));
|
|
448
|
+
}
|
|
449
|
+
} catch {
|
|
450
|
+
// not the page's own
|
|
451
|
+
}
|
|
452
|
+
const rows = tools.ownCells(data);
|
|
453
|
+
if (rows) return rows.map((row) => row.map((html) => ({ html })));
|
|
454
|
+
const html = data.getData("text/html");
|
|
455
|
+
const table = html ? new DOMParser().parseFromString(html, "text/html").querySelector("table") : null;
|
|
456
|
+
if (table?.rows.length) return [...table.rows].map((row) => [...row.cells].map((cell) => ({ text: cell.textContent.replace(/\s+/g, " ").trim() })));
|
|
457
|
+
const text = (data.getData("text/plain") || "").replace(/\r\n?/g, "\n").replace(/\n$/, "");
|
|
458
|
+
const lines = text.split("\n");
|
|
459
|
+
if (lines.length > 1) {
|
|
460
|
+
const width = lines[0].split("\t").length;
|
|
461
|
+
if (width > 1 && lines.every((line) => line.split("\t").length === width)) return lines.map((line) => line.split("\t").map((part) => ({ text: part })));
|
|
462
|
+
}
|
|
463
|
+
return text ? [[{ text: text.replace(/\s*\n\s*/g, " ") }]] : null;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
function paste(event) {
|
|
467
|
+
const sel = tools.sel;
|
|
468
|
+
if (!sel || sel.editing || !tools.active() || !sel.unit.isConnected) return;
|
|
469
|
+
event.preventDefault();
|
|
470
|
+
event.stopImmediatePropagation();
|
|
471
|
+
const grid = gridOf(event.clipboardData);
|
|
472
|
+
if (!grid) return;
|
|
473
|
+
// Formulas in what is pasted are drawn at once, KaTeX loaded first where the page has none yet.
|
|
474
|
+
if (grid.some((row) => row.some((cell) => cell.html?.includes("doc-math-inline")))) loadKatex().then(() => pasteGrid(sel, grid, formulaMaker()));
|
|
475
|
+
else pasteGrid(sel, grid, null);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function pasteGrid(sel, pasted, formula) {
|
|
479
|
+
if (!sel.unit.isConnected) return;
|
|
480
|
+
let grid = pasted;
|
|
481
|
+
// Its empty last rows and columns go.
|
|
482
|
+
const empty = (cell) => !(cell.html ?? cell.text).replace(/<[^>]*>/g, "").trim();
|
|
483
|
+
while (grid.length > 1 && grid.at(-1).every(empty)) grid = grid.slice(0, -1);
|
|
484
|
+
const width = Math.max(...grid.map((row) => row.length));
|
|
485
|
+
grid = grid.map((row) => [...row, ...Array.from({ length: width - row.length }, () => ({ text: "" }))]);
|
|
486
|
+
while (grid[0].length > 1 && grid.every((row) => empty(row.at(-1)))) grid = grid.map((row) => row.slice(0, -1));
|
|
487
|
+
const { unit } = sel;
|
|
488
|
+
const { r0, r1, c0, c1 } = tools.bounds(sel);
|
|
489
|
+
const times = [Math.max(1, Math.floor((r1 - r0 + 1) / grid.length)), Math.max(1, Math.floor((c1 - c0 + 1) / grid[0].length))];
|
|
490
|
+
const size = [grid.length * times[0], grid[0].length * times[1]];
|
|
491
|
+
if (size[0] * size[1] > MAX_PASTE) return void tools.say(t("一次粘贴的格子太多了。"));
|
|
492
|
+
const { rows, columns, slots } = tableState(unit);
|
|
493
|
+
// The cells there now, whose text the paste changes (undo puts it back).
|
|
494
|
+
const existing = new Set();
|
|
495
|
+
for (let r = r0; r < Math.min(rows.length, r0 + size[0]); r++) for (let c = c0; c < Math.min(columns, c0 + size[1]); c++) existing.add(tools.cellOf(slots, [r, c]));
|
|
496
|
+
const made = tools.change(unit, () => {
|
|
497
|
+
for (let now = tableState(unit); now.columns < c0 + size[1]; now = tableState(unit)) insertColumn(unit, now.columns);
|
|
498
|
+
for (let now = tableParts(unit); now.rows.length < r0 + size[0]; now = tableParts(unit)) insertRow(unit, now.rows.length);
|
|
499
|
+
// The slots after the rows and columns put in, read once for every cell below.
|
|
500
|
+
const slotsNow = tableSlots(unit);
|
|
501
|
+
for (let r = 0; r < size[0]; r++) {
|
|
502
|
+
for (let c = 0; c < size[1]; c++) {
|
|
503
|
+
const cell = tools.cellOf(slotsNow, [r0 + r, c0 + c]);
|
|
504
|
+
// A merged cell takes what goes in its top left slot.
|
|
505
|
+
const place = tools.placeOf(slotsNow, cell);
|
|
506
|
+
if (!cell || !writable(cell) || place[0] !== r0 + r || place[1] !== c0 + c) continue;
|
|
507
|
+
const from = grid[r % grid.length][c % grid[0].length];
|
|
508
|
+
if (from.html !== undefined) cell.replaceChildren(...pastedLines(document, from.html, { links: true, formula }).flatMap((line, index) => (index > 0 ? [document.createTextNode(" "), ...line] : line)));
|
|
509
|
+
else cell.textContent = from.text;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return true;
|
|
513
|
+
}, null, [...existing].filter(writable));
|
|
514
|
+
if (made === null) return;
|
|
515
|
+
tools.selectCells(unit, [r0, c0], [r0 + size[0] - 1, c0 + size[1] - 1]);
|
|
516
|
+
tools.say(t("已粘贴 · Ctrl+Z 撤销"));
|
|
517
|
+
}
|
|
518
|
+
document.addEventListener("paste", paste, true);
|
|
519
|
+
|
|
520
|
+
return {
|
|
521
|
+
/** The bar shown or hidden as the selection is now (index.mjs draw). */
|
|
522
|
+
update,
|
|
523
|
+
/** A space typed into a cell: its line a list's item when it starts with "- " or "1. " (lists.mjs). */
|
|
524
|
+
typed: lists.typed,
|
|
525
|
+
get nodes() { return [bar.node]; },
|
|
526
|
+
};
|
|
527
|
+
}
|