@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,336 @@
|
|
|
1
|
+
import { Z } from "../../../shared/layers.mjs";
|
|
2
|
+
import { escapeTyped } from "../../../shared/escape.mjs";
|
|
3
|
+
import { addStyle, element, fadeIn, mount } from "../ui.mjs";
|
|
4
|
+
import { recentList } from "../storage.mjs";
|
|
5
|
+
import { placeBox } from "../placement.mjs";
|
|
6
|
+
import { tooltip } from "../tooltip.mjs";
|
|
7
|
+
import { GROUPS, ROW, fillSnippet, nextPlace } from "./symbols.mjs";
|
|
8
|
+
import { renderTex } from "../tex.mjs";
|
|
9
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
10
|
+
|
|
11
|
+
// The formula editor (Notion's EquationInputPopup, both for an inline formula, index.mjs, and a
|
|
12
|
+
// display formula, components/math/page.mjs): a field of TeX, colored as it is typed (commands,
|
|
13
|
+
// numbers, braces), as wide as the editor, and below it KaTeX's reason when the TeX does not read
|
|
14
|
+
// ("无效的公式:").
|
|
15
|
+
// Above the field, the symbol bar (symbols.mjs): a row of its six groups — 常用, 希腊, 运算, 结构,
|
|
16
|
+
// 关系与箭头, 化学 — each opening a card of all its symbols drawn by KaTeX (its drawer: small
|
|
17
|
+
// section titles, nothing scrolled), a click putting one in at the caret (a template's places to
|
|
18
|
+
// fill emptied, the selection in the first, the caret in the first empty one; Tab and Shift+Tab go
|
|
19
|
+
// to the next and previous {}); the drawer is a card on the editor's far side from the formula
|
|
20
|
+
// (below the editor when it stands below the formula), so neither the field nor the formula is
|
|
21
|
+
// covered (Esc closes it first). What was put in lately comes first under 常用 (this browser's, in
|
|
22
|
+
// localStorage).
|
|
23
|
+
// Its side is chosen as it opens, by what the tallest group needs, and stays until the page
|
|
24
|
+
// scrolls or the window changes size: no group and no symbol clicked moves the field. What comes
|
|
25
|
+
// and goes around the field (a group's card, the lines it grows by, KaTeX's reason) goes on the far
|
|
26
|
+
// side, and where the window has no room for a card it is the card that gives way, scrolling inside
|
|
27
|
+
// what is left, a card at the least staying in the window: the field's height is capped for it, and the
|
|
28
|
+
// editor stands over the formula rather than leave it no room. The editor goes with the formula as the
|
|
29
|
+
// page scrolls, and as what is typed draws it taller.
|
|
30
|
+
// A symbol clicked moves nothing at all, for the next click to find what it found: with the pointer
|
|
31
|
+
// on the editor the field keeps its height, the text going on inside it, its caret's line in view, and
|
|
32
|
+
// KaTeX's reason waits, until a key is pressed or the pointer has left (land). A press on the editor
|
|
33
|
+
// leaves the keys in the field, and the gap between its card and its bar is the editor's.
|
|
34
|
+
// Enter is a new line (a formula of several lines: \\, aligned, cases), as are Shift+Enter and
|
|
35
|
+
// Alt+Enter. What is in the field is kept however the editor is left, also when it does not read,
|
|
36
|
+
// which may be a stage on the way: Ctrl+Enter, Enter with the whole field selected (as it opens on a
|
|
37
|
+
// formula, or after Ctrl+A, a formula pasted there kept at once) or with nothing in it, Esc once no
|
|
38
|
+
// group's symbols are open, a press elsewhere, Ctrl+S, the workbench taking the focus, the page left.
|
|
39
|
+
// The caller shows the formula itself as it is typed (onInput), so there is no preview here.
|
|
40
|
+
|
|
41
|
+
const GAP = 6; // between the formula, the editor and a group's card
|
|
42
|
+
const MARGIN = 8; // what stays clear of the window's edge
|
|
43
|
+
// A group's card, in px, as the rules below draw it: its padding and a section's title. With its
|
|
44
|
+
// sections' rows (symbols.mjs), its height is known before any of its symbols is drawn.
|
|
45
|
+
const PADDING = 12;
|
|
46
|
+
const TITLE = 20;
|
|
47
|
+
const LEAST = 96; // a card this high at the least, however little room the window leaves
|
|
48
|
+
// What the window keeps beside the field: its margins, a card at the least and the gap to it, the bar, the
|
|
49
|
+
// field's padding and two lines of KaTeX's reason.
|
|
50
|
+
const AROUND = 2 * MARGIN + LEAST + GAP + 39 + 16 + 52;
|
|
51
|
+
|
|
52
|
+
const STYLE = `
|
|
53
|
+
.ge-fx {
|
|
54
|
+
position: fixed; left: 0; top: 0; z-index: ${Z.card}; width: 440px; max-width: calc(100vw - 16px); color: var(--ge-tx);
|
|
55
|
+
font: 14px/1.2 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
56
|
+
}
|
|
57
|
+
/* The gap to a group's card, the editor's: a press there, or the pointer on its way across it, is on the editor. */
|
|
58
|
+
.ge-fx[data-open]::before { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: ${GAP}px; }
|
|
59
|
+
.ge-fx[data-open][data-above]::before { top: auto; bottom: 100%; }
|
|
60
|
+
.ge-fx-body { display: flex; flex-direction: column; overflow: hidden; border-radius: 10px; background: var(--ge-bg); box-shadow: var(--ge-shadow); }
|
|
61
|
+
/* The groups, the field below them as wide as the editor. */
|
|
62
|
+
.ge-fx-bar { display: flex; align-items: center; gap: 1px; padding: 6px; border-bottom: 1px solid var(--ge-line); overflow-x: auto; scrollbar-width: none; }
|
|
63
|
+
.ge-fx-group { flex: none; height: 26px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ge-tx2); font: inherit; font-size: 13px; cursor: pointer; transition: background 20ms ease-in; }
|
|
64
|
+
.ge-fx-group:hover, .ge-fx-group[aria-expanded="true"] { background: var(--ge-hover); color: var(--ge-tx); }
|
|
65
|
+
/* A group's symbols: a card of its own on the editor's far side from the formula (stand), so the
|
|
66
|
+
field stays where it is and the formula shows; all of them at once, scrolling only where the
|
|
67
|
+
window has no room for them. */
|
|
68
|
+
.ge-fx-drawer { position: absolute; top: calc(100% + ${GAP}px); left: 0; width: 440px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 5px 8px 7px; border-radius: 10px; background: var(--ge-bg); box-shadow: var(--ge-shadow); overflow-y: auto; scrollbar-width: thin; }
|
|
69
|
+
.ge-fx[data-above] .ge-fx-drawer { top: auto; bottom: calc(100% + ${GAP}px); }
|
|
70
|
+
.ge-fx-drawer[hidden] { display: none; }
|
|
71
|
+
.ge-fx-title { height: ${TITLE}px; box-sizing: border-box; padding: 3px 4px 1px; color: var(--ge-tx2); font-size: 12px; line-height: 16px; }
|
|
72
|
+
.ge-fx-grid { display: grid; grid-template-columns: repeat(var(--ge-fx-columns, 12), minmax(0, 1fr)); }
|
|
73
|
+
.ge-fx-cell { display: grid; place-items: center; min-width: 0; height: var(--ge-fx-row); padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--ge-tx); overflow: hidden; cursor: pointer; font-size: 17px; }
|
|
74
|
+
.ge-fx-grid:is([data-columns="10"], [data-columns="9"]) .ge-fx-cell, .ge-fx-cell[data-small] { font-size: 13px; }
|
|
75
|
+
.ge-fx-cell:hover { background: var(--ge-hover); }
|
|
76
|
+
.ge-fx-cell .katex { font-size: 1em; }
|
|
77
|
+
.ge-fx-row { display: flex; align-items: flex-start; padding: 8px 10px; background: var(--ge-field); }
|
|
78
|
+
.ge-fx-field { position: relative; flex: 1 1 0; min-width: 0; }
|
|
79
|
+
.ge-fx-paint, .ge-fx-input { margin: 0; padding: 0; border: 0; font: 14px/1.5 ui-monospace, "SFMono-Regular", Menlo, Consolas, "Courier New", monospace; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
|
|
80
|
+
.ge-fx-paint { position: absolute; inset: 0; pointer-events: none; color: var(--ge-tx); overflow: hidden; }
|
|
81
|
+
.ge-fx-input { position: relative; display: block; width: 100%; max-height: min(50vh, calc(100vh - ${AROUND}px)); outline: none; background: transparent; color: transparent; caret-color: var(--ge-tx); resize: none; overflow: auto; scrollbar-width: none; }
|
|
82
|
+
.ge-fx-input::placeholder { color: var(--ge-tx3); }
|
|
83
|
+
.ge-fx-input::selection { background: var(--ge-select); color: transparent; }
|
|
84
|
+
.ge-fx-paint .c { color: light-dark(#2f6fb6, #6aa7e8); }
|
|
85
|
+
.ge-fx-paint .n { color: light-dark(#b05a2b, #e0915e); }
|
|
86
|
+
.ge-fx-paint .b { color: var(--ge-tx3); }
|
|
87
|
+
.ge-fx-paint .o { color: light-dark(#9a4fb4, #c38bdb); }
|
|
88
|
+
.ge-fx-error { padding: 8px 10px; color: rgb(235 87 87 / 80%); font-size: 12px; line-height: 1.5; box-shadow: 0 -1px var(--ge-line); overflow-wrap: anywhere; }
|
|
89
|
+
.ge-fx[data-above] .ge-fx-error { order: -1; box-shadow: 0 1px var(--ge-line); }
|
|
90
|
+
.ge-fx-error b { font-weight: 600; }
|
|
91
|
+
.ge-fx-error[hidden] { display: none; }
|
|
92
|
+
`;
|
|
93
|
+
const RECENT = "gallery-edit:formula-recent";
|
|
94
|
+
const PLACEHOLDER = { block: "|x| = \\begin{cases} x, & x \\ge 0 \\\\ -x, & x < 0 \\end{cases}", inline: "E = mc^2" };
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* What the status line says of a formula, in the text and as a block alike: `kept(tex, was)` once
|
|
98
|
+
* the box is closed on it (`was`: it had TeX before), `peculiar` for one written so the page
|
|
99
|
+
* cannot edit it, `unloaded(inserting)` when KaTeX cannot be loaded (to insert a formula, or to change one).
|
|
100
|
+
*/
|
|
101
|
+
export const formulaSays = {
|
|
102
|
+
kept: (tex, was) => (!tex ? t("公式已清空 · Ctrl+Z 撤销") : was ? t("已修改公式 · Ctrl+Z 撤销") : t("已插入公式 · Ctrl+Z 撤销")),
|
|
103
|
+
peculiar: t("这个公式的写法特殊,暂不能在页面上修改,请让 AI 修改。"),
|
|
104
|
+
unloaded: (inserting) => (inserting ? t("公式功能没能加载,不能插入公式。") : t("公式功能没能加载,不能修改公式。")),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// TeX colored: commands, numbers, braces and brackets, the operators ^ _ & and \\.
|
|
108
|
+
export const paintTex = (text) => text.replace(/(\\[a-zA-Z]+|\\\\|\\.)|(\d+(?:\.\d+)?)|([{}[\]])|([\^_&])|([^\\\d{}[\]^_&]+)/g,
|
|
109
|
+
(match, command, number, brace, operator) => command ? `<span class="${command === "\\\\" ? "o" : "c"}">${escapeTyped(command)}</span>`
|
|
110
|
+
: number ? `<span class="n">${number}</span>` : brace ? `<span class="b">${brace}</span>` : operator ? `<span class="o">${escapeTyped(operator)}</span>` : escapeTyped(match));
|
|
111
|
+
|
|
112
|
+
// What was put in lately (at most twelve: a line's worth of symbols), this browser's.
|
|
113
|
+
const recentFormulas = recentList(RECENT, { max: 12, valid: (entry) => Array.isArray(entry) && typeof entry[0] === "string", same: (a, b) => a[0] === b[0] });
|
|
114
|
+
|
|
115
|
+
// What was put in lately as a line of twelve columns, from the newest as far as it goes: each as wide
|
|
116
|
+
// and as high as it is drawn in its own section, a template taking the columns that asks, the line as
|
|
117
|
+
// high as the tallest. (An entry's last item says it is drawn small, as that section's are.)
|
|
118
|
+
function recentSection() {
|
|
119
|
+
const entries = [];
|
|
120
|
+
let height = ROW;
|
|
121
|
+
let used = 0;
|
|
122
|
+
for (const [snippet, shown, name] of recentFormulas.read()) {
|
|
123
|
+
const own = (section) => section.entries.find((entry) => entry[0] === snippet);
|
|
124
|
+
const section = GROUPS.flatMap(({ sections }) => sections).find(own) ?? { columns: 12, entries: [[snippet]] };
|
|
125
|
+
const span = Math.ceil((own(section)[3] ?? 1) * 12 / section.columns);
|
|
126
|
+
if (used + span > 12) break;
|
|
127
|
+
used += span;
|
|
128
|
+
height = Math.max(height, section.height ?? ROW);
|
|
129
|
+
entries.push([snippet, shown, name, span, section.columns < 12]);
|
|
130
|
+
}
|
|
131
|
+
return { title: t("最近使用"), columns: 12, height, entries };
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// What a group's card shows: 常用 has what was put in lately first, a line of its own.
|
|
135
|
+
function sectionsOf(group) {
|
|
136
|
+
const recent = group.recent ? recentSection() : null;
|
|
137
|
+
return recent?.entries.length > 0
|
|
138
|
+
? [recent, ...group.sections.map((section, index) => (index === 0 && !section.title ? { ...section, title: group.name } : section))]
|
|
139
|
+
: group.sections;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// How high a group's card stands.
|
|
143
|
+
const cardHeight = (group) => PADDING + sectionsOf(group).reduce((sum, { title, columns, height = ROW, entries }) => {
|
|
144
|
+
const slots = entries.reduce((count, [, , , span = 1]) => count + span, 0);
|
|
145
|
+
return sum + (title ? TITLE : 0) + Math.ceil(slots / columns) * height;
|
|
146
|
+
}, 0);
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Open the editor. value: the TeX; display: a display formula (its placeholder, KaTeX's display
|
|
150
|
+
* mode); anchor(): the rectangle it goes below (above where there is no room), `center` centered
|
|
151
|
+
* under it, else its left edge with it; onInput(tex, error) as it changes, onSubmit(tex) when it is
|
|
152
|
+
* left. Returns { node, close, get value, focus }.
|
|
153
|
+
*/
|
|
154
|
+
export function openFormulaPanel({ value = "", display = false, anchor, center = false, onInput = () => {}, onSubmit = () => {} }) {
|
|
155
|
+
addStyle(STYLE);
|
|
156
|
+
const paint = element("pre", { class: "ge-fx-paint", "aria-hidden": "true" });
|
|
157
|
+
const input = element("textarea", { class: "ge-fx-input", rows: "1", spellcheck: "false", autocomplete: "off", placeholder: display ? PLACEHOLDER.block : PLACEHOLDER.inline, "aria-label": t("公式(LaTeX)") });
|
|
158
|
+
input.value = value;
|
|
159
|
+
const error = element("div", { class: "ge-fx-error", role: "alert", hidden: "" });
|
|
160
|
+
const drawer = element("div", { class: "ge-fx-drawer", hidden: "" });
|
|
161
|
+
const bar = element("div", { class: "ge-fx-bar", role: "toolbar", "aria-label": t("插入符号") });
|
|
162
|
+
const node = element("div", { class: "ge-fx", role: "dialog", "aria-label": display ? t("编辑公式块") : t("编辑公式") },
|
|
163
|
+
drawer, element("div", { class: "ge-fx-body" }, bar, element("div", { class: "ge-fx-row" }, element("div", { class: "ge-fx-field" }, paint, input)), error));
|
|
164
|
+
let closed = false;
|
|
165
|
+
let open = null; // the group whose drawer shows
|
|
166
|
+
let fails = null;
|
|
167
|
+
let held = false; // a symbol was clicked: what it makes of the editor's height waits (land)
|
|
168
|
+
|
|
169
|
+
// ---------- the symbol bar ----------
|
|
170
|
+
const buttons = GROUPS.map((group) => {
|
|
171
|
+
const button = element("button", { type: "button", class: "ge-fx-group", text: group.name, "aria-expanded": "false" });
|
|
172
|
+
button.addEventListener("click", () => showGroup(open === group ? null : group));
|
|
173
|
+
bar.append(button);
|
|
174
|
+
return button;
|
|
175
|
+
});
|
|
176
|
+
const cell = (entry) => {
|
|
177
|
+
const [snippet, shown, name, span = 1, small = false] = entry;
|
|
178
|
+
const { html } = renderTex(shown ?? snippet.replaceAll("#", "{\\square}"));
|
|
179
|
+
const button = element("button", { type: "button", class: "ge-fx-cell", "aria-label": name ?? snippet.replaceAll("#", "□"), html: html || escapeTyped(snippet) });
|
|
180
|
+
if (span > 1) button.style.gridColumn = `span ${span}`;
|
|
181
|
+
button.toggleAttribute("data-small", small);
|
|
182
|
+
tooltip(button, name ?? snippet.replaceAll("#", "□"), name ? snippet.replaceAll("#", "□") : null);
|
|
183
|
+
button.addEventListener("click", () => put(entry));
|
|
184
|
+
return button;
|
|
185
|
+
};
|
|
186
|
+
function showGroup(group) {
|
|
187
|
+
open = group;
|
|
188
|
+
GROUPS.forEach((each, index) => buttons[index].setAttribute("aria-expanded", String(each === group)));
|
|
189
|
+
drawer.hidden = !group;
|
|
190
|
+
node.toggleAttribute("data-open", Boolean(group));
|
|
191
|
+
if (!group) return;
|
|
192
|
+
drawer.setAttribute("aria-label", group.name);
|
|
193
|
+
drawer.replaceChildren(...sectionsOf(group).flatMap(({ title, columns, height = ROW, entries }) => [
|
|
194
|
+
...(title ? [element("div", { class: "ge-fx-title", text: title })] : []),
|
|
195
|
+
element("div", { class: "ge-fx-grid", "data-columns": String(columns), style: `--ge-fx-columns: ${columns}; --ge-fx-row: ${height}px` }, ...entries.map(cell)),
|
|
196
|
+
]));
|
|
197
|
+
drawer.scrollTop = 0;
|
|
198
|
+
}
|
|
199
|
+
function put(entry) {
|
|
200
|
+
const { text, caret } = fillSnippet(input.value, input.selectionStart, input.selectionEnd, entry[0]);
|
|
201
|
+
input.value = text;
|
|
202
|
+
input.focus();
|
|
203
|
+
input.setSelectionRange(caret, caret);
|
|
204
|
+
recentFormulas.use(entry.slice(0, 3));
|
|
205
|
+
held = node.matches(":hover");
|
|
206
|
+
draw();
|
|
207
|
+
fit();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// ---------- the field ----------
|
|
211
|
+
function draw() {
|
|
212
|
+
const tex = input.value;
|
|
213
|
+
paint.innerHTML = `${paintTex(tex)}\n`;
|
|
214
|
+
fails = tex.trim() ? renderTex(tex, display).error : null;
|
|
215
|
+
if (held) caretShown();
|
|
216
|
+
else size();
|
|
217
|
+
paint.scrollTop = input.scrollTop;
|
|
218
|
+
onInput(tex, fails);
|
|
219
|
+
}
|
|
220
|
+
// What the editor is as high as: the field's lines and KaTeX's reason.
|
|
221
|
+
function size() {
|
|
222
|
+
input.style.height = "auto";
|
|
223
|
+
input.style.height = `${input.scrollHeight}px`;
|
|
224
|
+
error.hidden = !fails;
|
|
225
|
+
error.replaceChildren(...(fails ? [element("b", { text: t("无效的公式:") }), fails] : []));
|
|
226
|
+
}
|
|
227
|
+
// The caret's line in view in a field keeping its height: what stands before the caret ends as low as that line.
|
|
228
|
+
function caretShown() {
|
|
229
|
+
const { value, selectionEnd: caret } = input;
|
|
230
|
+
input.value = value.slice(0, caret);
|
|
231
|
+
const end = input.scrollHeight;
|
|
232
|
+
input.value = value;
|
|
233
|
+
input.setSelectionRange(caret, caret);
|
|
234
|
+
input.scrollTop = end - input.clientHeight;
|
|
235
|
+
}
|
|
236
|
+
// What a symbol clicked left waiting, a key pressed or the pointer gone.
|
|
237
|
+
function land() {
|
|
238
|
+
if (!held) return;
|
|
239
|
+
held = false;
|
|
240
|
+
size();
|
|
241
|
+
paint.scrollTop = input.scrollTop;
|
|
242
|
+
place();
|
|
243
|
+
}
|
|
244
|
+
node.addEventListener("pointerleave", land);
|
|
245
|
+
// A press anywhere else on the editor leaves the keys in the field.
|
|
246
|
+
node.addEventListener("mousedown", (event) => { if (event.target !== input) event.preventDefault(); });
|
|
247
|
+
input.addEventListener("input", () => {
|
|
248
|
+
held = false;
|
|
249
|
+
draw();
|
|
250
|
+
place();
|
|
251
|
+
});
|
|
252
|
+
input.addEventListener("scroll", () => { paint.scrollTop = input.scrollTop; });
|
|
253
|
+
input.addEventListener("keydown", (event) => {
|
|
254
|
+
land();
|
|
255
|
+
event.stopPropagation(); // the page's shortcuts are not the field's
|
|
256
|
+
if (event.isComposing || event.keyCode === 229) return;
|
|
257
|
+
if (event.key === "Enter" && !event.shiftKey && !event.altKey && (event.ctrlKey || event.metaKey || whole())) {
|
|
258
|
+
event.preventDefault();
|
|
259
|
+
submit();
|
|
260
|
+
} else if (event.key === "Escape") {
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
if (open) showGroup(null); // a group's symbols first
|
|
263
|
+
else submit();
|
|
264
|
+
} else if (event.key === "Tab") {
|
|
265
|
+
event.preventDefault();
|
|
266
|
+
const at = nextPlace(input.value, event.shiftKey ? input.selectionStart : input.selectionEnd, event.shiftKey);
|
|
267
|
+
if (at !== null) input.setSelectionRange(at, at);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// The whole field selected (or nothing in it): Enter keeps the formula, else it is a new line.
|
|
271
|
+
const whole = () => input.selectionStart === 0 && input.selectionEnd === input.value.length;
|
|
272
|
+
|
|
273
|
+
function submit() {
|
|
274
|
+
if (closed) return;
|
|
275
|
+
close();
|
|
276
|
+
onSubmit(input.value);
|
|
277
|
+
}
|
|
278
|
+
function close() {
|
|
279
|
+
closed = true;
|
|
280
|
+
node.remove();
|
|
281
|
+
removeEventListener("scroll", follow, true);
|
|
282
|
+
removeEventListener("resize", stand);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// The side the editor stands on, below the anchor or above it, centered on it or at its left edge:
|
|
286
|
+
// the first with room for the editor and the tallest group's card, else the one with more room.
|
|
287
|
+
// Chosen as it opens and as the page (or a box it is in) scrolls or the window changes size; once
|
|
288
|
+
// the anchor has scrolled out of the window the side stays and the editor goes with it.
|
|
289
|
+
let below = true;
|
|
290
|
+
function stand() {
|
|
291
|
+
if (closed || !node.isConnected) return;
|
|
292
|
+
const rect = anchor();
|
|
293
|
+
const view = document.documentElement.clientHeight;
|
|
294
|
+
if (rect.bottom > 0 && rect.top < view) {
|
|
295
|
+
const need = node.offsetHeight + GAP + Math.max(...GROUPS.map(cardHeight));
|
|
296
|
+
const under = view - MARGIN - rect.bottom - GAP;
|
|
297
|
+
const over = rect.top - GAP - MARGIN;
|
|
298
|
+
below = need <= under || (need > over && under >= over);
|
|
299
|
+
}
|
|
300
|
+
node.toggleAttribute("data-above", !below);
|
|
301
|
+
node.style.left = `${Math.round(placeBox(rect, { width: node.offsetWidth, height: 0 }, { align: center ? "center" : "start" }).left)}px`;
|
|
302
|
+
place();
|
|
303
|
+
}
|
|
304
|
+
// By the edge nearest the anchor, so that what grows goes on the far side: its top below the anchor,
|
|
305
|
+
// its bottom above it (inside the window while the anchor shows in it, with room for a card at the least).
|
|
306
|
+
function place() {
|
|
307
|
+
if (closed || !node.isConnected) return;
|
|
308
|
+
const rect = anchor();
|
|
309
|
+
const view = document.documentElement.clientHeight;
|
|
310
|
+
const height = node.offsetHeight;
|
|
311
|
+
const shows = rect.bottom > 0 && rect.top < view;
|
|
312
|
+
const top = below ? rect.bottom + GAP : rect.top - GAP - height;
|
|
313
|
+
const card = GAP + LEAST;
|
|
314
|
+
const inside = shows ? Math.max(MARGIN + (below ? 0 : card), Math.min(top, view - MARGIN - height - (below ? card : 0))) : top;
|
|
315
|
+
node.style.top = below ? `${Math.round(inside)}px` : "auto";
|
|
316
|
+
node.style.bottom = below ? "auto" : `${Math.round(view - inside - height)}px`;
|
|
317
|
+
fit();
|
|
318
|
+
}
|
|
319
|
+
// A group's card given what the window leaves it.
|
|
320
|
+
function fit() {
|
|
321
|
+
const body = node.getBoundingClientRect();
|
|
322
|
+
const room = below ? document.documentElement.clientHeight - MARGIN - body.bottom - GAP : body.top - GAP - MARGIN;
|
|
323
|
+
drawer.style.maxHeight = `${Math.max(LEAST, Math.floor(room))}px`;
|
|
324
|
+
}
|
|
325
|
+
const follow = (event) => { if (!node.contains(event.target)) stand(); };
|
|
326
|
+
addEventListener("scroll", follow, { capture: true, passive: true });
|
|
327
|
+
addEventListener("resize", stand);
|
|
328
|
+
|
|
329
|
+
mount(node);
|
|
330
|
+
fadeIn(node, 120);
|
|
331
|
+
draw();
|
|
332
|
+
stand();
|
|
333
|
+
input.focus();
|
|
334
|
+
input.select();
|
|
335
|
+
return { node, close, focus: () => input.focus(), get value() { return input.value; }, get closed() { return closed; } };
|
|
336
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
2
|
+
// The formula editor's symbol bar (panel.mjs): six groups — 常用, 希腊, 运算, 结构, 关系与箭头, 化学 —
|
|
3
|
+
// each opening a card of all its symbols drawn by KaTeX, in sections with small titles (no
|
|
4
|
+
// scrolling); a click puts one in at the caret; what was put in lately comes first under 常用
|
|
5
|
+
// (its `recent`). A group is { name, recent?, sections: [{ title?, columns, height?, entries }] }; an entry is [what goes in, what
|
|
6
|
+
// the card draws (else what goes in), its name, the columns it takes (1 when not given)]; a "#" in what
|
|
7
|
+
// goes in is a place to fill (a template's): the selected text goes in the first, the caret into
|
|
8
|
+
// the first empty one, Tab to the next (panel.mjs). Symbols are twelve to a line, templates ten (a
|
|
9
|
+
// matrix two of them), chemistry's nine. A section's rows are `height` px, ROW when not given: as high
|
|
10
|
+
// as what they hold asks, simple symbols close together, large operators and templates with more room.
|
|
11
|
+
|
|
12
|
+
export const SLOT = "#";
|
|
13
|
+
|
|
14
|
+
/** How high a row of a section is, in px, where it does not say. */
|
|
15
|
+
export const ROW = 26;
|
|
16
|
+
|
|
17
|
+
const each = (names) => names.map((name) => [name]);
|
|
18
|
+
const greek = (names) => names.map((name) => [`\\${name}`]);
|
|
19
|
+
|
|
20
|
+
export const GROUPS = [
|
|
21
|
+
{
|
|
22
|
+
name: t("常用"), recent: true, sections: [{
|
|
23
|
+
columns: 12, entries: [
|
|
24
|
+
["\\frac{#}{#}", "\\frac{a}{b}", t("分数")], ["\\sqrt{#}", "\\sqrt{x}", t("根号")], ["#^{#}", "x^{n}", t("上标")], ["#_{#}", "x_{i}", t("下标")],
|
|
25
|
+
["\\sum_{#}^{#}", "\\sum", t("求和")], ["\\int_{#}^{#}", "\\int", t("积分")], ["\\lim_{# \\to #}", "\\lim", t("极限")], ["\\infty"], ["\\partial"], ["\\nabla"], ["\\pm"], ["\\times"],
|
|
26
|
+
["\\cdot"], ["\\div"], ["\\le"], ["\\ge"], ["\\neq"], ["\\approx"], ["\\to"], ["\\Rightarrow"], ["\\in"], ["\\forall"], ["\\exists"], ["\\degree", "x^{\\circ}", t("度")],
|
|
27
|
+
],
|
|
28
|
+
}],
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: t("希腊"), sections: [
|
|
32
|
+
{
|
|
33
|
+
title: t("小写"), columns: 12, entries: greek([
|
|
34
|
+
"alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta", "eta", "theta", "vartheta", "iota", "kappa",
|
|
35
|
+
"lambda", "mu", "nu", "xi", "pi", "varpi", "rho", "varrho", "sigma", "varsigma", "tau", "upsilon",
|
|
36
|
+
"phi", "varphi", "chi", "psi", "omega",
|
|
37
|
+
]),
|
|
38
|
+
},
|
|
39
|
+
{ title: t("大写"), columns: 12, entries: greek(["Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi", "Sigma", "Upsilon", "Phi", "Psi", "Omega"]) },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: t("运算"), sections: [
|
|
44
|
+
{
|
|
45
|
+
title: t("二元运算"), columns: 12, entries: each([
|
|
46
|
+
"+", "-", "\\pm", "\\mp", "\\times", "\\div", "\\cdot", "\\ast", "\\star", "\\circ", "\\bullet", "\\diamond",
|
|
47
|
+
"\\oplus", "\\ominus", "\\otimes", "\\oslash", "\\odot", "\\cup", "\\cap", "\\sqcup", "\\sqcap", "\\setminus", "\\wedge", "\\vee",
|
|
48
|
+
]),
|
|
49
|
+
},
|
|
50
|
+
{ title: t("大型运算"), columns: 12, height: 30, entries: each(["\\sum", "\\prod", "\\coprod", "\\bigcup", "\\bigcap", "\\bigsqcup", "\\bigvee", "\\bigwedge", "\\int", "\\iint", "\\oint", "\\bigoplus"]) },
|
|
51
|
+
{ title: t("其他"), columns: 12, height: 30, entries: each(["\\infty", "\\partial", "\\nabla", "\\emptyset", "\\prime", "\\hbar", "\\ell", "\\angle", "\\ldots", "\\cdots", "\\vdots", "\\ddots"]) },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: t("结构"), sections: [
|
|
56
|
+
{
|
|
57
|
+
columns: 10, height: 30, entries: [
|
|
58
|
+
["#^{#}", "x^{a}", t("上标")], ["#_{#}", "x_{a}", t("下标")], ["#_{#}^{#}", "x_{a}^{b}", t("上下标")], ["\\frac{#}{#}", "\\frac{a}{b}", t("分数")], ["\\dfrac{#}{#}", "\\dfrac{a}{b}", t("大分数")],
|
|
59
|
+
["\\sqrt{#}", "\\sqrt{x}", t("平方根")], ["\\sqrt[#]{#}", "\\sqrt[n]{x}", t("n 次根")], ["\\binom{#}{#}", "\\binom{n}{k}", t("组合数")], ["\\log_{#} #", "\\log_{a}x", t("对数")], ["\\lim_{# \\to #} #", "\\lim_{x\\to 0}", t("极限")],
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
columns: 10, height: 28, entries: [
|
|
64
|
+
["\\sum_{#}^{#} #", "\\sum_{i=1}^{n}", t("求和")], ["\\prod_{#}^{#} #", "\\prod_{i=1}^{n}", t("连乘")], ["\\int_{#}^{#} # \\,\\mathrm{d}#", "\\int_{a}^{b}", t("定积分")], ["\\iint_{#} #", "\\iint", t("二重积分")], ["\\oint_{#} #", "\\oint", t("环路积分")],
|
|
65
|
+
["\\left( # \\right)", "(x)", t("圆括号")], ["\\left[ # \\right]", "[x]", t("方括号")], ["\\left\\{ # \\right\\}", "\\{x\\}", t("花括号")], ["\\left| # \\right|", "|x|", t("绝对值")], ["\\left\\| # \\right\\|", "\\|x\\|", t("范数")],
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
columns: 10, entries: [
|
|
70
|
+
["\\left\\langle # \\right\\rangle", "\\langle x\\rangle", t("尖括号")], ["\\lfloor # \\rfloor", "\\lfloor x\\rfloor", t("向下取整")], ["\\lceil # \\rceil", "\\lceil x\\rceil", t("向上取整")], ["\\hat{#}", "\\hat{x}", t("帽子")], ["\\bar{#}", "\\bar{x}", t("横线")],
|
|
71
|
+
["\\tilde{#}", "\\tilde{x}", t("波浪")], ["\\vec{#}", "\\vec{x}", t("向量")], ["\\dot{#}", "\\dot{x}", t("一阶导")], ["\\ddot{#}", "\\ddot{x}", t("二阶导")], ["\\overline{#}", "\\overline{AB}", t("上划线")],
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
columns: 10, height: 32, entries: [
|
|
76
|
+
["\\overrightarrow{#}", "\\overrightarrow{AB}", t("向量箭头")], ["\\underbrace{#}_{#}", "\\underbrace{ab}_{n}", t("下括号")], ["\\cancel{#}", "\\cancel{x}", t("删去")], ["\\boxed{#}", "\\boxed{x}", t("方框")], ["\\text{#}", t("\\text{文}"), t("文字")],
|
|
77
|
+
["\\mathbb{#}", "\\mathbb{R}", t("黑板粗体")], ["\\mathcal{#}", "\\mathcal{L}", t("花体")], ["\\mathbf{#}", "\\mathbf{x}", t("粗体")], ["\\boldsymbol{#}", "\\boldsymbol{\\theta}", t("粗斜体")], ["\\mathrm{#}", "\\mathrm{d}", t("正体")],
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
// Two columns each, on a line of their own.
|
|
82
|
+
columns: 10, height: 44, entries: [
|
|
83
|
+
["\\begin{cases} # & # \\\\ # & # \\end{cases}", "\\begin{cases}a\\\\b\\end{cases}", t("分段函数"), 2], ["\\begin{pmatrix} # & # \\\\ # & # \\end{pmatrix}", "\\begin{pmatrix}a&b\\\\c&d\\end{pmatrix}", t("矩阵(圆括号)"), 2],
|
|
84
|
+
["\\begin{bmatrix} # & # \\\\ # & # \\end{bmatrix}", "\\begin{bmatrix}a&b\\\\c&d\\end{bmatrix}", t("矩阵(方括号)"), 2], ["\\begin{vmatrix} # & # \\\\ # & # \\end{vmatrix}", "\\begin{vmatrix}a&b\\\\c&d\\end{vmatrix}", t("行列式"), 2],
|
|
85
|
+
["\\begin{aligned} # &= # \\\\ &= # \\end{aligned}", "\\begin{aligned}a&=b\\\\&=c\\end{aligned}", t("多行对齐"), 2],
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: t("关系与箭头"), sections: [
|
|
92
|
+
{
|
|
93
|
+
title: t("关系"), columns: 12, entries: each([
|
|
94
|
+
"=", "\\neq", "\\approx", "\\equiv", "\\sim", "\\simeq", "\\cong", "\\propto", "<", ">", "\\le", "\\ge",
|
|
95
|
+
"\\ll", "\\gg", "\\leqslant", "\\geqslant", "\\prec", "\\succ", "\\preceq", "\\succeq", "\\mid", "\\parallel", "\\perp", "\\doteq",
|
|
96
|
+
]),
|
|
97
|
+
},
|
|
98
|
+
{ title: t("集合与逻辑"), columns: 12, entries: each(["\\in", "\\notin", "\\ni", "\\subset", "\\subseteq", "\\supseteq", "\\forall", "\\exists", "\\nexists", "\\neg", "\\therefore", "\\because"]) },
|
|
99
|
+
{
|
|
100
|
+
title: t("箭头"), columns: 12, height: 28, entries: [
|
|
101
|
+
...each([
|
|
102
|
+
"\\to", "\\leftarrow", "\\leftrightarrow", "\\Rightarrow", "\\Leftarrow", "\\Leftrightarrow", "\\longrightarrow", "\\longleftarrow", "\\longleftrightarrow", "\\Longrightarrow", "\\Longleftarrow", "\\Longleftrightarrow",
|
|
103
|
+
"\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\mapsto", "\\nearrow", "\\searrow", "\\hookrightarrow", "\\rightleftharpoons",
|
|
104
|
+
]),
|
|
105
|
+
["\\xrightarrow{#}", "\\xrightarrow{f}", t("带字箭头")], ["\\xleftarrow{#}", "\\xleftarrow{f}", t("带字左箭头")],
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: t("化学"), sections: [
|
|
112
|
+
{
|
|
113
|
+
columns: 9, entries: [
|
|
114
|
+
["\\ce{#}", "\\ce{H2O}", t("化学式")], ["\\ce{#^{#+}}", "\\ce{X^{n+}}", t("阳离子")], ["\\ce{#^{#-}}", "\\ce{Y^{n-}}", t("阴离子")], ["\\ce{^{#}_{#}#}", "\\ce{^{A}_{Z}X}", t("核素")], ["\\ce{#-#}", "\\ce{A-B}", t("单键")],
|
|
115
|
+
["\\ce{#=#}", "\\ce{A=B}", t("双键")], ["\\ce{#\\bond{3}#}", "\\ce{A\\bond{3}B}", t("三键")], ["\\ce{#.#}", "\\ce{A.B}", t("结合(·)")], ["\\pu{#}", "\\pu{1 mol}", t("物理量单位")],
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
columns: 9, height: 30, entries: [
|
|
120
|
+
["\\ce{# -> #}", "\\ce{->}", t("反应")], ["\\ce{# <- #}", "\\ce{<-}", t("逆向反应")], ["\\ce{# <-> #}", "\\ce{<->}", t("共振")], ["\\ce{# <=> #}", "\\ce{<=>}", t("可逆反应")], ["\\ce{# <=>> #}", "\\ce{<=>>}", t("正向为主")],
|
|
121
|
+
["\\ce{# <<=> #}", "\\ce{<<=>}", t("逆向为主")], ["\\ce{# ^}", "\\ce{X ^}", t("气体")], ["\\ce{# v}", "\\ce{X v}", t("沉淀")], ["\\ce{# ->[#][#] #}", t("\\ce{->[\\text{上}][\\text{下}]}"), t("条件")],
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A snippet put in place of `text`'s range [start, end): its places to fill emptied (the selected
|
|
130
|
+
* text in the first), the caret in the first empty one (or after it). Returns { text, caret }.
|
|
131
|
+
*/
|
|
132
|
+
export function fillSnippet(text, start, end, snippet) {
|
|
133
|
+
const selected = text.slice(start, end);
|
|
134
|
+
let out = "";
|
|
135
|
+
const places = [];
|
|
136
|
+
let first = true;
|
|
137
|
+
for (const char of snippet) {
|
|
138
|
+
if (char !== SLOT) {
|
|
139
|
+
out += char;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (first && selected) out += selected;
|
|
143
|
+
else places.push(start + out.length);
|
|
144
|
+
first = false;
|
|
145
|
+
}
|
|
146
|
+
// A command followed by a letter would join it (\alpha x): a space after a bare command.
|
|
147
|
+
const after = text.slice(end);
|
|
148
|
+
if (/\\[a-zA-Z]+$/.test(out) && /^[a-zA-Z]/.test(after)) out += " ";
|
|
149
|
+
return { text: text.slice(0, start) + out + after, caret: places[0] ?? start + out.length };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Where Tab goes from `at`: the next empty place to fill ({} or the inside of an empty pair), or null. */
|
|
153
|
+
export function nextPlace(text, at, back = false) {
|
|
154
|
+
const found = [...text.matchAll(/\{\}/g)].map((match) => match.index + 1);
|
|
155
|
+
return (back ? found.filter((place) => place < at).at(-1) : found.find((place) => place > at)) ?? null;
|
|
156
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { IN_LAYER } from "../../shared/layers.mjs";
|
|
2
|
+
import { innerHost } from "./caret.mjs";
|
|
3
|
+
import { frameOf } from "./core.mjs";
|
|
4
|
+
import { FOLLOW, task } from "./frames.mjs";
|
|
5
|
+
import { drawOver, fillRectOf, reachOf, shapeOf } from "./overlay-layer.mjs";
|
|
6
|
+
import { onSettle, own } from "./overlays.mjs";
|
|
7
|
+
import { addStyle, element } from "./ui.mjs";
|
|
8
|
+
import { onPreferences, preference } from "../../shared/preferences.mjs";
|
|
9
|
+
|
|
10
|
+
// The dashed frame around what is being edited (docs/editor.md, "Browser side"): the text with the
|
|
11
|
+
// focus when it is a block of its own, or the component whose text it is (core.mjs markFrames,
|
|
12
|
+
// frameOf). It is drawn in the editor's layer (overlay-layer.mjs), as a selected block's fill is (selection/), over
|
|
13
|
+
// where the block shows (geometry.mjs extentOf: a list item with its marker), so the two line up;
|
|
14
|
+
// never as an outline of the report's own elements, which could not take in a list item's marker.
|
|
15
|
+
// It follows scrolling, resizing and reflow while it shows (a task of the editor's frames,
|
|
16
|
+
// frames.mjs), cut where the block is cut, and belongs to the block it frames (overlays.mjs). Only
|
|
17
|
+
// with the reader's 显示编辑框 on (the workbench's 设置: shared/preferences.mjs editFrame, off at first):
|
|
18
|
+
// otherwise it never shows, and switched there it comes or goes at once.
|
|
19
|
+
|
|
20
|
+
const STYLE = `
|
|
21
|
+
.ge-frame { position: absolute; left: 0; top: 0; z-index: ${IN_LAYER.frame}; box-sizing: border-box; border: 1px dashed color-mix(in srgb, var(--doc-accent, #2678d8) 45%, transparent); pointer-events: none; }
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/** editing(): whether the page is being edited. */
|
|
26
|
+
export function createFrame(editing) {
|
|
27
|
+
addStyle(STYLE);
|
|
28
|
+
const node = element("div", { class: "ge-frame" });
|
|
29
|
+
let current = null; // the block framed
|
|
30
|
+
let shown = preference("editFrame");
|
|
31
|
+
|
|
32
|
+
// The focused text of the report, or the component it belongs to.
|
|
33
|
+
function framed() {
|
|
34
|
+
const focused = innerHost(document.activeElement); // a paragraph a list item holds: its own (caret.mjs)
|
|
35
|
+
if (!shown || !editing() || focused?.getAttribute("contenteditable") !== "true" || focused.closest("[data-doc-dev]")) return null;
|
|
36
|
+
return frameOf(focused) ?? focused;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// The frame follows its block's corners (rounded while editing when it has none, editor.mjs).
|
|
40
|
+
function run() {
|
|
41
|
+
const target = framed();
|
|
42
|
+
const shape = target && shapeOf(target);
|
|
43
|
+
current = shape ? target : null;
|
|
44
|
+
if (!shape) {
|
|
45
|
+
node.remove();
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const block = target;
|
|
49
|
+
own(node, "frame", { owner: block, alive: () => current === block && block.isConnected && framed() === block, expected: () => fillRectOf(block) });
|
|
50
|
+
drawOver(node, shape, reachOf(shape.radius, shape.reach, shape.room)); // where a selected block's fill is
|
|
51
|
+
return FOLLOW; // drawn again when the block may have moved (frames.mjs)
|
|
52
|
+
}
|
|
53
|
+
const frames = task("frame", {
|
|
54
|
+
run,
|
|
55
|
+
fail: () => {
|
|
56
|
+
current = null;
|
|
57
|
+
node.remove();
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
// The text framed taken off the page: the frame goes at once.
|
|
61
|
+
onSettle(() => {
|
|
62
|
+
if (current && !current.isConnected) {
|
|
63
|
+
current = null;
|
|
64
|
+
node.remove();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
document.addEventListener("focusin", () => frames.wake());
|
|
68
|
+
document.addEventListener("focusout", () => frames.wake());
|
|
69
|
+
document.addEventListener("selectionchange", () => frames.wake());
|
|
70
|
+
onPreferences(() => {
|
|
71
|
+
shown = preference("editFrame");
|
|
72
|
+
frames.wake();
|
|
73
|
+
});
|
|
74
|
+
}
|