@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,449 @@
|
|
|
1
|
+
import { Z } from "../../../shared/layers.mjs";
|
|
2
|
+
import { CODE_ICON, FORMULA_ICON, NOTE_ICON } from "../../components/icons.mjs";
|
|
3
|
+
import { FROM_SELECTION, TYPE_INFO } from "../../components/registry.mjs";
|
|
4
|
+
import { HIGHLIGHTS, TEXT_COLORS, UNDERLINE_COLORS } from "../marks.mjs";
|
|
5
|
+
import { besideText } from "../placement.mjs";
|
|
6
|
+
import { hideTooltip, shortcut, tooltip } from "../tooltip.mjs";
|
|
7
|
+
import { describeEffects } from "./brush.mjs";
|
|
8
|
+
import { RINGS, colorName, recentColors } from "./colors.mjs";
|
|
9
|
+
import { typeGrid } from "../type-grid.mjs";
|
|
10
|
+
import { addStyle, button, element, fadeIn, fadeOut, mount } from "../ui.mjs";
|
|
11
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
12
|
+
|
|
13
|
+
// The bar over selected text (Notion's text action menu, its sizes, colors and buttons): a small
|
|
14
|
+
// card below and right of the selection with two rows of four buttons on top (the format brush,
|
|
15
|
+
// 应用格式, the clear-format T with a check; the color "A", bold, underline; clearing the format, inline code, a formula, and "更多" with a
|
|
16
|
+
// link, strikethrough, italic, a detail card the selected text opens and, where the selection can be
|
|
17
|
+
// annotated, 批注: annotate/) and, below a line, the block's type with what it can be turned into (the
|
|
18
|
+
// blocks' type across blocks, "多个类型" for a mix). Each button names itself in a tooltip, with its
|
|
19
|
+
// shortcut, nothing more; the brush's says what it remembers (brush.mjs), and a click puts that on
|
|
20
|
+
// the selected text. The "A" shows the selection's text color and background; a click opens the
|
|
21
|
+
// colors below it (Notion's color picker: 最近使用, 文本颜色, 背景颜色, five swatches to a line, the
|
|
22
|
+
// selection's own colors ringed). The underline button's line shows the selection's underline, its
|
|
23
|
+
// color and weight (the icon's own line when there is none); a click opens the line below it: no
|
|
24
|
+
// line or its colors on one line, its weights on the next. A second click closes either; so do
|
|
25
|
+
// Esc and a press elsewhere. "更多" opens its list below it, resting on it or with a click. Resting
|
|
26
|
+
// on the type row opens what the block can be turned into beside the bar. The bar shows the
|
|
27
|
+
// selection's state and reports commands; the editor applies them (index.mjs). Swatches use the
|
|
28
|
+
// kit's own classes, so they match the text in either theme (a background's, a span, shows the
|
|
29
|
+
// words' fill; the cell bar draws its own as a block's: table/cell-bar.mjs). The icons are drawn here after Notion's
|
|
30
|
+
// look (20px, thin lines), not taken from Notion's files. The bar
|
|
31
|
+
// fades in (no fade out); its panels fade in and out quickly and keep inside the window.
|
|
32
|
+
|
|
33
|
+
const TURN_DELAY = 100; // resting on the type row this long opens what the block can be turned into
|
|
34
|
+
const MORE_DELAY = 150; // resting on "更多" this long opens its list
|
|
35
|
+
const LINE_COLORS = { none: t("无"), default: t("红色(默认)"), orange: t("橙色"), blue: t("蓝色"), purple: t("紫色"), plain: t("文字色") };
|
|
36
|
+
const LINE_WEIGHTS = { thin: [t("细"), 1], default: [t("中(默认)"), 2], thick: [t("粗"), 3] }; // name, px, in the panel's order
|
|
37
|
+
// The underline button's line, by the selection's underline weight (in the icon's units).
|
|
38
|
+
const LINE_STROKE = { thin: 1.25, default: 2, thick: 2.75 };
|
|
39
|
+
const LEAVE = 300; // a panel opened by resting closes this long after the pointer leaves it and what opened it
|
|
40
|
+
const APPEAR = 120; // the bar fades in (as Notion's popups, quicker); it goes at once
|
|
41
|
+
const PANEL = 120; // the panels fade in and out quickly
|
|
42
|
+
const svg = (body) => `<svg viewBox="0 0 20 20" aria-hidden="true">${body}</svg>`;
|
|
43
|
+
const ICONS = {
|
|
44
|
+
// Drawn here after Notion's look (their proportions and weight, matched by eye at six times their
|
|
45
|
+
// size), not taken from Notion's files. 应用格式 is the clear-format T with a check where that
|
|
46
|
+
// one has its cross.
|
|
47
|
+
brush: svg('<path d="M3.5 4.5h9M8 4.5v11M6.75 15.5h2.5"/><path d="m12.1 12.6 2.05 2.05 3.6-4.6"/>'),
|
|
48
|
+
bold: svg('<path class="ge-heavy" d="M6.25 4.25h4.85a2.9 2.9 0 0 1 0 5.8H6.25zM6.25 10.05h5.6a3 3 0 0 1 0 6H6.25z"/>'),
|
|
49
|
+
italic: svg('<path d="M9.5 4.25h5M5.5 15.75h5M12 4.25 8 15.75"/>'),
|
|
50
|
+
underline: svg('<path d="M6 3.75v6.25a4 4 0 0 0 8 0V3.75M4.75 3.75h2.5M12.75 3.75h2.5"/><path class="ge-line-mark" d="M3.75 16.75h12.5"/>'),
|
|
51
|
+
clear: svg('<path d="M3.5 4.5h9M8 4.5v11M6.75 15.5h2.5"/><path d="m12.5 10.25 4.75 4.75M17.25 10.25 12.5 15"/>'),
|
|
52
|
+
link: svg('<g transform="rotate(45 10 10)"><path d="M7 8.5V6a3 3 0 0 1 6 0v2.5M7 11.5V14a3 3 0 0 0 6 0v-2.5M10 7.5v5"/></g>'),
|
|
53
|
+
code: CODE_ICON,
|
|
54
|
+
formula: FORMULA_ICON,
|
|
55
|
+
strike: svg('<path d="M13.5 6.25c-.5-1.25-1.8-2-3.45-2-1.95 0-3.35 1.05-3.35 2.6 0 1.1.7 1.8 1.95 2.25"/><path d="M3.75 10.25h12.5"/><path d="M6.5 13.4c.45 1.4 1.85 2.35 3.6 2.35 2.05 0 3.55-1.1 3.55-2.75 0-.65-.25-1.15-.7-1.55"/>'),
|
|
56
|
+
more: svg('<circle cx="4.75" cy="10" r="1.3" fill="currentColor" stroke="none"/><circle cx="10" cy="10" r="1.3" fill="currentColor" stroke="none"/><circle cx="15.25" cy="10" r="1.3" fill="currentColor" stroke="none"/>'),
|
|
57
|
+
chevron: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="m6.25 4 4 4-4 4"/></svg>',
|
|
58
|
+
none: '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M3.5 12.5 12.5 3.5"/></svg>',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const STYLE = `
|
|
62
|
+
.ge-format {
|
|
63
|
+
position: fixed; left: 0; top: 0; z-index: ${Z.panel}; color: var(--ge-tx); font: 14px/1.2 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; user-select: none;
|
|
64
|
+
}
|
|
65
|
+
.ge-format[hidden], .ge-format-sub[hidden], .ge-format-turn[hidden], .ge-format-sep[hidden], .ge-tool[hidden], .ge-more-item[hidden] { display: none; }
|
|
66
|
+
.ge-format-box, .ge-format-sub { border-radius: 14px; background: var(--ge-bg); box-shadow: var(--ge-shadow); }
|
|
67
|
+
.ge-format-box { display: flex; flex-direction: column; padding: 8px; overflow: hidden; }
|
|
68
|
+
.ge-format-row { display: flex; gap: 4px; height: 28px; } /* notion-lite's spacing */
|
|
69
|
+
.ge-format-row + .ge-format-row { margin-top: 4px; }
|
|
70
|
+
.ge-tool { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 28px; padding: 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ge-ico); cursor: pointer; transition: background 20ms ease-in; }
|
|
71
|
+
.ge-tool:hover:not(:disabled), .ge-tool[aria-expanded="true"] { background: var(--ge-hover); }
|
|
72
|
+
.ge-tool:active:not(:disabled) { background: var(--ge-press); }
|
|
73
|
+
.ge-tool[aria-pressed="true"] { color: var(--ge-accent); }
|
|
74
|
+
.ge-tool:disabled { opacity: .4; cursor: default; }
|
|
75
|
+
.ge-tool svg, .ge-format-turn svg { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
|
|
76
|
+
.ge-tool svg .ge-heavy { stroke-width: 1.7; }
|
|
77
|
+
.ge-ink-sample { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 6px; box-shadow: inset 0 0 0 1px var(--ge-ring, var(--ge-edge)); font-size: 12px; font-weight: 500; line-height: 1; }
|
|
78
|
+
.ge-format-sep { height: 1px; margin: 4px 8px; background: var(--ge-line); }
|
|
79
|
+
.ge-format-turn { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ge-tx); font: inherit; text-align: left; cursor: pointer; transition: background 20ms ease-in; }
|
|
80
|
+
.ge-format-turn:hover, .ge-format-turn[aria-expanded="true"] { background: var(--ge-hover); }
|
|
81
|
+
.ge-format-turn:active { background: var(--ge-press); }
|
|
82
|
+
.ge-format-turn > .ge-format-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; color: var(--ge-ico); }
|
|
83
|
+
.ge-format-turn > .ge-format-icon svg { stroke-width: 1.5; }
|
|
84
|
+
.ge-format-turn > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
85
|
+
.ge-format-turn > svg:last-child { width: 16px; height: 16px; color: var(--ge-ico2); }
|
|
86
|
+
/* A panel beside the bar: the types a block can be turned into. */
|
|
87
|
+
.ge-format-sub { position: absolute; top: 0; left: calc(100% + 4px); padding: 4px 0; }
|
|
88
|
+
.ge-format-sub[data-side="left"] { left: auto; right: calc(100% + 4px); }
|
|
89
|
+
.ge-format-sub .ge-types { --ge-types-columns: 5; padding: 4px 8px; }
|
|
90
|
+
/* The colors (Notion's color picker), below the "A". */
|
|
91
|
+
.ge-colors { position: absolute; z-index: 1; width: 190px; overflow: hidden; border-radius: 10px; background: var(--ge-bg); box-shadow: var(--ge-shadow); }
|
|
92
|
+
.ge-colors[hidden] { display: none; }
|
|
93
|
+
.ge-colors-section { padding: 4px; }
|
|
94
|
+
.ge-colors-title { margin: 6px 0 8px; padding: 0 8px; overflow: hidden; color: var(--ge-tx2); font-size: 12px; font-weight: 500; line-height: 1.2; white-space: nowrap; text-overflow: ellipsis; }
|
|
95
|
+
.ge-colors-grid { display: grid; grid-template-columns: repeat(5, 30px); gap: 4px; padding: 0 8px; }
|
|
96
|
+
.ge-colors-section:last-child .ge-colors-grid { padding-bottom: 8px; }
|
|
97
|
+
.ge-swatch { display: block; width: 30px; height: 30px; padding: 2px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
|
|
98
|
+
.ge-swatch > span { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; font-size: 16px; font-weight: 500; line-height: 1; box-shadow: inset 0 0 0 1px var(--ge-ring); }
|
|
99
|
+
.ge-swatch:hover > span { box-shadow: inset 0 0 0 2px var(--ge-ring); }
|
|
100
|
+
.ge-swatch[aria-pressed="true"] > span { box-shadow: inset 0 0 0 2px var(--ge-ring-strong); }
|
|
101
|
+
/* The underline's line: its colors, then its weights, below its button. */
|
|
102
|
+
.ge-line { width: auto; }
|
|
103
|
+
.ge-line .ge-colors-grid { grid-template-columns: repeat(6, 30px); }
|
|
104
|
+
.ge-line .ge-colors-section:last-child .ge-colors-grid { grid-template-columns: repeat(3, 30px); }
|
|
105
|
+
/* The list of "更多", below it. */
|
|
106
|
+
.ge-more { position: absolute; z-index: 1; min-width: 180px; padding: 4px; border-radius: 10px; background: var(--ge-bg); box-shadow: var(--ge-shadow); }
|
|
107
|
+
.ge-more[hidden] { display: none; }
|
|
108
|
+
.ge-more-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--ge-tx); font: inherit; text-align: left; cursor: pointer; transition: background 20ms ease-in; }
|
|
109
|
+
.ge-more-item:hover:not(:disabled) { background: var(--ge-hover); }
|
|
110
|
+
.ge-more-item:active:not(:disabled) { background: var(--ge-press); }
|
|
111
|
+
.ge-more-item:disabled { opacity: .4; cursor: default; }
|
|
112
|
+
.ge-more-item svg { display: block; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; color: var(--ge-ico); }
|
|
113
|
+
.ge-more-item[aria-pressed="true"] svg { color: var(--ge-accent); }
|
|
114
|
+
.ge-more-item > span { flex: 1; }
|
|
115
|
+
.ge-more-item > small { color: var(--ge-tx2); font-size: 12px; }
|
|
116
|
+
/* No weight of their own: the kit's color classes on the same sample win. */
|
|
117
|
+
:where(.ge-swatch > .ge-line-color) { color: inherit; text-decoration: underline 1.5px var(--doc-code-inline, #cf5148); text-underline-offset: 3px; }
|
|
118
|
+
.ge-swatch > .ge-line-weight > i { display: block; width: 16px; border-radius: 1px; background: var(--ge-ico); }
|
|
119
|
+
/* The underline button's line: the selection's underline color (--ge-line-ink, set from the kit's
|
|
120
|
+
own), the icon's own color when it has none. */
|
|
121
|
+
.ge-tool .ge-line-mark { stroke: var(--ge-line-ink, currentColor); }
|
|
122
|
+
.ge-swatch > .ge-line-none { text-decoration: none; }
|
|
123
|
+
/* Its line shows the selection's underline; it never turns blue for it. */
|
|
124
|
+
.ge-tool[data-tool="underline"][aria-pressed="true"] { color: var(--ge-ico); }
|
|
125
|
+
${Object.entries(RINGS).map(([name, [light, dark, strong, strongDark]]) => `.ge-format [data-ring="${name}"] { --ge-ring: light-dark(${light}, ${dark}); --ge-ring-strong: light-dark(${strong}, ${strongDark}); }`).join("\n ")}
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
/** The bar's look (its card, buttons, "A", colors and list), which a table's cell bar shares (table/cells.mjs). */
|
|
129
|
+
export function formatLook() {
|
|
130
|
+
addStyle(STYLE);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The bar's icons another bar of its look uses. */
|
|
134
|
+
export const FORMAT_ICONS = { bold: ICONS.bold, clear: ICONS.clear, more: ICONS.more, chevron: ICONS.chevron };
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* A swatch of the colors (Notion's color picker): `family` "text" or "highlight", `value` a color
|
|
138
|
+
* name or null (the default); a click runs pick(family, value).
|
|
139
|
+
*/
|
|
140
|
+
export function colorSwatch(family, value, pick) {
|
|
141
|
+
const name = colorName(family, value);
|
|
142
|
+
const node = button(null, () => pick(family, value), { class: "ge-swatch", "aria-label": name, "data-family": family, "data-value": value ?? "", "data-ring": value ?? "default" });
|
|
143
|
+
node.append(element("span", { class: value ? `doc-${family}-${value}` : "", text: family === "text" ? "A" : "" }));
|
|
144
|
+
tooltip(node, name);
|
|
145
|
+
return node;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** A section of the colors: its title over its swatches, five to a line. */
|
|
149
|
+
export const colorSection = (title, swatches) => element("div", { class: "ge-colors-section" },
|
|
150
|
+
element("div", { class: "ge-colors-title", text: title }), element("div", { class: "ge-colors-grid" }, ...swatches));
|
|
151
|
+
|
|
152
|
+
/** A button of a bar's row: its name in a tooltip (`label` may be a function), its shortcut below it (the cells' bar uses it too). */
|
|
153
|
+
export function tool(name, label, content, action, keys = null) {
|
|
154
|
+
const node = button(null, action, { class: "ge-tool", "data-tool": name, "aria-label": typeof label === "function" ? "" : label });
|
|
155
|
+
if (typeof content === "string") node.innerHTML = content;
|
|
156
|
+
else node.append(content);
|
|
157
|
+
tooltip(node, label, keys);
|
|
158
|
+
return node;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** A row of a list ("更多"): an icon, its name and its shortcut (the cells' bar uses it too); `name` is the tool it stands for, if any. */
|
|
162
|
+
export function listItem(name, label, icon, action, keys = null) {
|
|
163
|
+
const node = button(null, action, { class: "ge-more-item", ...(name ? { "data-tool": name } : {}), "aria-label": label });
|
|
164
|
+
node.innerHTML = icon;
|
|
165
|
+
node.append(element("span", { text: label }), ...(keys ? [element("small", { text: keys })] : []));
|
|
166
|
+
return node;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* `run(command, value)`: "bold", "italic", "strike", "code", "clear", "link", "formula" or a type
|
|
171
|
+
* that says `fromSelection`; "brush" (the format brush); "text" / "highlight" with a color name (null removes it);
|
|
172
|
+
* "underline" with false (no underline); "underlineColor" / "underlineWeight" with a value of that
|
|
173
|
+
* facet; "turn" with the type the block is turned into; "annotate" (批注).
|
|
174
|
+
*/
|
|
175
|
+
/**
|
|
176
|
+
* A panel of a bar standing below one of the bar's controls (`left`: its left edge in the bar, the
|
|
177
|
+
* control's by default), kept inside the window: moved left when it would leave it on the right, put
|
|
178
|
+
* above the control when there is no room below. The format bar's panels and the cell bar's.
|
|
179
|
+
*/
|
|
180
|
+
export function belowControl(panel, control, left = control.offsetLeft) {
|
|
181
|
+
panel.style.left = `${left}px`;
|
|
182
|
+
panel.style.top = `${control.offsetTop + control.offsetHeight + 4}px`;
|
|
183
|
+
const rect = panel.getBoundingClientRect();
|
|
184
|
+
if (rect.right > innerWidth - 8) panel.style.left = `${left - (rect.right - innerWidth + 8)}px`;
|
|
185
|
+
if (rect.bottom > innerHeight - 8) panel.style.top = `${control.offsetTop - 4 - panel.offsetHeight}px`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function createFormatBar(run) {
|
|
189
|
+
formatLook();
|
|
190
|
+
|
|
191
|
+
const sample = element("span", { class: "ge-ink-sample", text: "A" });
|
|
192
|
+
|
|
193
|
+
const tools = {
|
|
194
|
+
brush: tool("brush", t("应用格式"), ICONS.brush, () => run("brush"), () => `${describeEffects() || t("先给文字设置格式,这里会记住")}\n${shortcut("mod+shift+h")}`),
|
|
195
|
+
color: tool("color", t("文字颜色"), sample, () => (current === "color" ? closeSub() : openColors())),
|
|
196
|
+
bold: tool("bold", t("加粗"), ICONS.bold, () => run("bold"), shortcut("mod+b")),
|
|
197
|
+
underline: tool("underline", t("下划线"), ICONS.underline, () => (current === "line" ? closeSub() : openLine()), shortcut("mod+u")),
|
|
198
|
+
clear: tool("clear", t("清除格式"), ICONS.clear, () => run("clear"), shortcut("mod+alt+\\")),
|
|
199
|
+
code: tool("code", t("代码"), ICONS.code, () => run("code"), shortcut("mod+e")),
|
|
200
|
+
formula: tool("formula", t("公式"), ICONS.formula, () => run("formula"), shortcut("mod+shift+e")),
|
|
201
|
+
more: tool("more", t("更多"), ICONS.more, () => {
|
|
202
|
+
clearTimeout(timer);
|
|
203
|
+
if (current !== "more") openMore(); // resting on it may have opened it already: a click never closes it
|
|
204
|
+
}),
|
|
205
|
+
};
|
|
206
|
+
for (const name of ["more", "color", "underline"]) tools[name].setAttribute("aria-expanded", "false");
|
|
207
|
+
const turnIcon = element("span", { class: "ge-format-icon" });
|
|
208
|
+
const turnLabel = element("span");
|
|
209
|
+
const turn = element("button", { type: "button", class: "ge-format-turn", "aria-label": t("转换为"), "aria-expanded": "false" }, turnIcon, turnLabel);
|
|
210
|
+
turn.insertAdjacentHTML("beforeend", ICONS.chevron);
|
|
211
|
+
turn.addEventListener("mousedown", (event) => event.preventDefault()); // keep the selection
|
|
212
|
+
turn.addEventListener("click", () => {
|
|
213
|
+
clearTimeout(timer);
|
|
214
|
+
if (current !== "turn") openTurn(); // resting on it may have opened it already: a click never closes it
|
|
215
|
+
});
|
|
216
|
+
const separator = element("div", { class: "ge-format-sep", role: "separator" });
|
|
217
|
+
|
|
218
|
+
// ---------- the colors ----------
|
|
219
|
+
|
|
220
|
+
const colors = element("div", { class: "ge-colors", role: "dialog", "aria-label": t("文本颜色"), hidden: "" });
|
|
221
|
+
const line = element("div", { class: "ge-colors ge-line", role: "dialog", "aria-label": t("下划线"), hidden: "" });
|
|
222
|
+
let selected = { text: null, highlight: null }; // the selection's colors, ringed in the panel
|
|
223
|
+
|
|
224
|
+
const swatch = (family, value) => colorSwatch(family, value, run);
|
|
225
|
+
const section = colorSection;
|
|
226
|
+
|
|
227
|
+
function markColors() {
|
|
228
|
+
for (const node of colors.querySelectorAll(".ge-swatch[data-mark]")) {
|
|
229
|
+
node.setAttribute("aria-pressed", String((selected[node.dataset.family] ?? "") === node.dataset.value));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ---------- "更多" ----------
|
|
234
|
+
|
|
235
|
+
const items = {
|
|
236
|
+
link: listItem("link", t("链接"), ICONS.link, () => run("link"), shortcut("mod+k")),
|
|
237
|
+
strike: listItem("strike", t("删除线"), ICONS.strike, () => run("strike"), shortcut("mod+shift+x")),
|
|
238
|
+
italic: listItem("italic", t("斜体"), ICONS.italic, () => run("italic"), shortcut("mod+i")),
|
|
239
|
+
annotate: listItem("annotate", t("批注"), NOTE_ICON, () => run("annotate"), shortcut("mod+alt+m")),
|
|
240
|
+
};
|
|
241
|
+
const blocksFrom = FROM_SELECTION.map(({ type, label, icon }) => listItem(type, label, icon, () => run(type))); // the blocks selected text makes
|
|
242
|
+
const more = element("div", { class: "ge-more", role: "menu", "aria-label": t("更多"), hidden: "" }, items.link, items.strike, items.italic, ...blocksFrom, items.annotate);
|
|
243
|
+
|
|
244
|
+
const sub = element("div", { class: "ge-format-sub", hidden: "" });
|
|
245
|
+
const box = element("div", { class: "ge-format-box" },
|
|
246
|
+
element("div", { class: "ge-format-row" }, tools.brush, tools.color, tools.bold, tools.underline),
|
|
247
|
+
element("div", { class: "ge-format-row" }, tools.clear, tools.code, tools.formula, tools.more),
|
|
248
|
+
separator, turn);
|
|
249
|
+
const node = element("div", { class: "ge-format", role: "toolbar", "aria-label": t("文字格式"), hidden: "" }, box, sub, colors, line, more);
|
|
250
|
+
mount(node);
|
|
251
|
+
|
|
252
|
+
let block = null; // { current, types } of the block the selection is in, or null
|
|
253
|
+
// The panel open, one at a time: the colors below the "A", the underline's line below its button, the
|
|
254
|
+
// list of "更多" below it, what the block can be turned into beside the bar (PANELS).
|
|
255
|
+
let current = null;
|
|
256
|
+
let lineState = { color: null, weight: null }; // the selection's underline facets
|
|
257
|
+
const inks = new Map(); // a line color's own (the kit's), read once
|
|
258
|
+
let timer = 0; // a panel about to open or close
|
|
259
|
+
|
|
260
|
+
// The "A" and the underline button show the selection's colors and underline; the panels ring them.
|
|
261
|
+
function paint(state) {
|
|
262
|
+
const { text, highlight } = state;
|
|
263
|
+
sample.className = ["ge-ink-sample", text && `doc-text-${text}`, highlight && `doc-highlight-${highlight}`].filter(Boolean).join(" ");
|
|
264
|
+
sample.setAttribute("data-ring", highlight ?? "default");
|
|
265
|
+
selected = { text, highlight };
|
|
266
|
+
markColors();
|
|
267
|
+
lineState = state.underline ? { color: state.underlineColor ?? null, weight: state.underlineWeight ?? null } : { color: "none", weight: null };
|
|
268
|
+
markLine();
|
|
269
|
+
// The underline button's line: the selection's underline (a mix of them as the default), else the icon's own.
|
|
270
|
+
const mark = tools.underline.querySelector(".ge-line-mark");
|
|
271
|
+
if (state.underline) {
|
|
272
|
+
mark.style.strokeWidth = String(LINE_STROKE[state.underlineWeight ?? "default"]);
|
|
273
|
+
tools.underline.style.setProperty("--ge-line-ink", ink(state.underlineColor ?? "default"));
|
|
274
|
+
} else {
|
|
275
|
+
mark.style.strokeWidth = "";
|
|
276
|
+
tools.underline.style.removeProperty("--ge-line-ink");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// A line color as the kit draws it: read from an underline of that color, once.
|
|
281
|
+
function ink(color) {
|
|
282
|
+
if (!inks.has(color)) {
|
|
283
|
+
const probe = mount(element("u", { class: color === "default" ? "" : `doc-underline-${color}`, style: "position: fixed; visibility: hidden" }, "x"));
|
|
284
|
+
inks.set(color, getComputedStyle(probe).textDecorationColor);
|
|
285
|
+
probe.remove();
|
|
286
|
+
}
|
|
287
|
+
return inks.get(color);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ---------- the panels: the colors, the line, the list of "更多", the types beside the type row ----------
|
|
291
|
+
|
|
292
|
+
// Opens panel `name` (PANELS): the one open goes, `fill` makes what it holds, `place` puts it by its trigger.
|
|
293
|
+
function openPanel(name, fill, place) {
|
|
294
|
+
closeSub();
|
|
295
|
+
hideTooltip();
|
|
296
|
+
current = name;
|
|
297
|
+
const { node: panel, trigger } = PANELS[name];
|
|
298
|
+
fill?.();
|
|
299
|
+
fadeIn(panel, PANEL);
|
|
300
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
301
|
+
place();
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Resting on what opens a panel opens it; leaving both closes it a little later ("更多", the type row).
|
|
305
|
+
function hover(name, delay) {
|
|
306
|
+
const { node: panel, trigger: control, open } = PANELS[name];
|
|
307
|
+
control.addEventListener("pointerenter", () => {
|
|
308
|
+
clearTimeout(timer);
|
|
309
|
+
if (current !== name) timer = setTimeout(open, delay);
|
|
310
|
+
});
|
|
311
|
+
const leave = () => {
|
|
312
|
+
clearTimeout(timer);
|
|
313
|
+
if (current === name) timer = setTimeout(closeSub, LEAVE);
|
|
314
|
+
};
|
|
315
|
+
control.addEventListener("pointerleave", leave);
|
|
316
|
+
panel.addEventListener("pointerenter", () => clearTimeout(timer));
|
|
317
|
+
panel.addEventListener("pointerleave", leave);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Below the "A", its left edge with the "A"'s (above it when there is no room below).
|
|
321
|
+
function openColors() {
|
|
322
|
+
openPanel("color", () => {
|
|
323
|
+
const marked = (list) => list.map((node) => (node.setAttribute("data-mark", ""), node));
|
|
324
|
+
colors.replaceChildren(
|
|
325
|
+
section(t("最近使用"), recentColors().map(({ family, value }) => swatch(family, value))),
|
|
326
|
+
section(t("文本颜色"), marked([null, ...TEXT_COLORS].map((value) => swatch("text", value)))),
|
|
327
|
+
section(t("背景颜色"), marked([null, ...HIGHLIGHTS].map((value) => swatch("highlight", value)))),
|
|
328
|
+
);
|
|
329
|
+
markColors();
|
|
330
|
+
}, () => belowControl(colors, tools.color));
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Below the underline button: no line or the line's colors, then its weights (the selection's
|
|
334
|
+
// ringed; the weights drawn plain, in no color). A color or weight picked underlines the text so,
|
|
335
|
+
// keeping the other facet as the text has it (red and 2px where it had no underline).
|
|
336
|
+
function openLine() {
|
|
337
|
+
const cell = (family, value, name, sample) => {
|
|
338
|
+
const node = button(null, () => (value === "none" ? run("underline", false) : run(family, value)), { class: "ge-swatch", "aria-label": value === "none" ? name : t("下划线{0}", name), "data-family": family, "data-value": value, "data-ring": family !== "underlineColor" || value === "plain" || value === "none" ? "default" : value === "default" ? "red" : value });
|
|
339
|
+
node.append(sample);
|
|
340
|
+
tooltip(node, name);
|
|
341
|
+
return node;
|
|
342
|
+
};
|
|
343
|
+
const colorRow = ["none", "default", ...UNDERLINE_COLORS].map((value) => cell("underlineColor", value, value === "none" ? t("无下划线") : LINE_COLORS[value],
|
|
344
|
+
element("span", { class: ["ge-line-color", value === "none" && "ge-line-none", !["none", "default"].includes(value) && `doc-underline-${value}`].filter(Boolean).join(" "), text: "U" })));
|
|
345
|
+
const weights = Object.keys(LINE_WEIGHTS).map((value) => {
|
|
346
|
+
const [name, px] = LINE_WEIGHTS[value];
|
|
347
|
+
return cell("underlineWeight", value, name, element("span", { class: "ge-line-weight" }, element("i", { style: `height: ${px}px` })));
|
|
348
|
+
});
|
|
349
|
+
openPanel("line", () => {
|
|
350
|
+
line.replaceChildren(section(t("线的颜色"), colorRow), section(t("线的粗细"), weights));
|
|
351
|
+
markLine();
|
|
352
|
+
}, () => belowControl(line, tools.underline, Math.max(0, tools.underline.offsetLeft - 8)));
|
|
353
|
+
}
|
|
354
|
+
function markLine() {
|
|
355
|
+
const facet = { underlineColor: "color", underlineWeight: "weight" };
|
|
356
|
+
for (const node of line.querySelectorAll(".ge-swatch")) {
|
|
357
|
+
node.setAttribute("aria-pressed", String(lineState[facet[node.dataset.family]] === node.dataset.value));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Beside the bar, level with the type row; left of the bar when there is no room right of it,
|
|
362
|
+
// lifted when it would leave the window.
|
|
363
|
+
function openTurn() {
|
|
364
|
+
if (!block) return;
|
|
365
|
+
openPanel("turn", () => sub.replaceChildren(typeGrid(block.types, block.current, (type) => {
|
|
366
|
+
closeSub();
|
|
367
|
+
if (type !== block.current) run("turn", type);
|
|
368
|
+
}, { columns: 5 })), () => {
|
|
369
|
+
sub.removeAttribute("data-side");
|
|
370
|
+
sub.style.top = `${turn.offsetTop - 4}px`;
|
|
371
|
+
const rect = sub.getBoundingClientRect();
|
|
372
|
+
if (rect.right > innerWidth - 12) sub.setAttribute("data-side", "left");
|
|
373
|
+
if (rect.bottom > innerHeight - 12) sub.style.top = `${turn.offsetTop - 4 - (rect.bottom - innerHeight + 12)}px`;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Below "更多": a link, strikethrough, italic, a detail card and 批注.
|
|
378
|
+
function openMore() {
|
|
379
|
+
openPanel("more", null, () => belowControl(more, tools.more));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Each panel with what opens it and what it opens; the lists made again as they open are emptied as they go.
|
|
383
|
+
const PANELS = {
|
|
384
|
+
color: { node: colors, trigger: tools.color, open: openColors, emptied: true },
|
|
385
|
+
line: { node: line, trigger: tools.underline, open: openLine, emptied: true },
|
|
386
|
+
more: { node: more, trigger: tools.more, open: openMore },
|
|
387
|
+
turn: { node: sub, trigger: turn, open: openTurn, emptied: true },
|
|
388
|
+
};
|
|
389
|
+
hover("turn", TURN_DELAY);
|
|
390
|
+
hover("more", MORE_DELAY);
|
|
391
|
+
|
|
392
|
+
// The panel open fades out; returns whether one was open (`at once`: the bar goes too).
|
|
393
|
+
function closeSub(atOnce = false) {
|
|
394
|
+
clearTimeout(timer);
|
|
395
|
+
if (!current) return false;
|
|
396
|
+
const { node: panel, trigger, emptied } = PANELS[current];
|
|
397
|
+
current = null;
|
|
398
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
399
|
+
if (atOnce) panel.hidden = true;
|
|
400
|
+
fadeOut(panel, PANEL, emptied ? () => panel.replaceChildren() : null);
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
node,
|
|
406
|
+
get visible() { return !node.hidden; },
|
|
407
|
+
holds: (target) => node.contains(target),
|
|
408
|
+
/** Close the panel beside the bar or the colors, if one is open (Esc). */
|
|
409
|
+
closeSub,
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Show by `at`: { right, bottom } of the selection's last character (below and right of it)
|
|
413
|
+
* and the selection's `top` (above it when there is no room below). state: { bold,
|
|
414
|
+
* italic, strike, underline, code, link, text, highlight, underline facets } of the selection, what it allows
|
|
415
|
+
* ({ links, fromSelection, formula, annotates }), and `block`: { current, types, first? } (what the block, or the
|
|
416
|
+
* blocks of text across blocks, can be turned into; current null and `first` the first block's
|
|
417
|
+
* type for several of different types) or null.
|
|
418
|
+
*/
|
|
419
|
+
show(at, state) {
|
|
420
|
+
for (const name of ["bold", "underline", "code"]) tools[name].setAttribute("aria-pressed", String(state[name]));
|
|
421
|
+
for (const name of ["link", "strike", "italic"]) items[name].setAttribute("aria-pressed", String(state[name]));
|
|
422
|
+
tools.more.setAttribute("aria-pressed", String(state.link || state.strike || state.italic)); // what "更多" holds is on
|
|
423
|
+
items.link.disabled = !state.links;
|
|
424
|
+
for (const item of blocksFrom) item.hidden = !state.fromSelection || state.link; // no row to press for what it cannot do
|
|
425
|
+
items.annotate.hidden = !state.annotates;
|
|
426
|
+
tools.formula.disabled = !state.formula;
|
|
427
|
+
paint(state);
|
|
428
|
+
const same = block && state.block && block.current === state.block.current && block.types.join() === state.block.types.join();
|
|
429
|
+
block = state.block && state.block.types.length > 1 ? state.block : null;
|
|
430
|
+
if (!same && current === "turn") closeSub();
|
|
431
|
+
turn.hidden = separator.hidden = !block;
|
|
432
|
+
if (block) {
|
|
433
|
+
// Several blocks of different types: "多个类型" by the first one's icon (notion-lite's).
|
|
434
|
+
const { label, icon: markup } = TYPE_INFO[block.current ?? block.first] ?? { label: t("文本"), icon: "" };
|
|
435
|
+
turnIcon.innerHTML = markup;
|
|
436
|
+
turnLabel.textContent = block.current === null && block.first ? t("多个类型") : label;
|
|
437
|
+
}
|
|
438
|
+
if (node.hidden) fadeIn(node, APPEAR);
|
|
439
|
+
const { offsetWidth: width, offsetHeight: height } = box;
|
|
440
|
+
const { left, top } = besideText(at, { width, height });
|
|
441
|
+
node.style.transform = `translate(${Math.round(left)}px, ${Math.round(top)}px)`;
|
|
442
|
+
},
|
|
443
|
+
|
|
444
|
+
hide() {
|
|
445
|
+
closeSub(true);
|
|
446
|
+
node.hidden = true;
|
|
447
|
+
},
|
|
448
|
+
};
|
|
449
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { HIGHLIGHTS, TEXT_COLORS, UNDERLINE_COLORS, UNDERLINE_WEIGHTS } from "../marks.mjs";
|
|
2
|
+
import { keep, stored } from "../storage.mjs";
|
|
3
|
+
import { colorName, lineName } from "./colors.mjs";
|
|
4
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
5
|
+
|
|
6
|
+
// The format brush (应用格式, the bar's first button): it remembers the formats last set on a
|
|
7
|
+
// selection, and a click puts them on the selected text. What it remembers: bold, italic,
|
|
8
|
+
// strikethrough, a text color, a background and an underline with its color and weight (not inline
|
|
9
|
+
// code, formulas or links). Formats set on one selection add up (bold, then red: both); the first
|
|
10
|
+
// format set on another selection starts over with it. Taking a format off the selection the
|
|
11
|
+
// brush remembers takes it out of the brush too; taking formats off other text leaves the brush
|
|
12
|
+
// alone. Text the brush was just put on counts as the selection it remembers, so a format set on
|
|
13
|
+
// it adds to the brush. Remembered in localStorage, so it survives the reload after a save.
|
|
14
|
+
//
|
|
15
|
+
// Effects: { bold?: true, italic?: true, strike?: true, text?: color, highlight?: color,
|
|
16
|
+
// underline?: { color, weight } } (an underline's facets "default" or a value of that facet).
|
|
17
|
+
|
|
18
|
+
const KEY = "gallery-edit:format-brush";
|
|
19
|
+
const LINE_FACETS = { color: ["default", ...UNDERLINE_COLORS], weight: ["default", ...UNDERLINE_WEIGHTS] };
|
|
20
|
+
const valid = (saved) => typeof saved === "object" && saved !== null && !Array.isArray(saved) && Object.entries(saved).every(([facet, value]) => {
|
|
21
|
+
if (facet === "bold" || facet === "italic" || facet === "strike") return value === true;
|
|
22
|
+
if (facet === "text") return TEXT_COLORS.includes(value);
|
|
23
|
+
if (facet === "highlight") return HIGHLIGHTS.includes(value);
|
|
24
|
+
if (facet === "underline") return typeof value === "object" && value !== null && Object.entries(LINE_FACETS).every(([name, values]) => values.includes(value[name]));
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
let effects = stored(KEY, {}, valid);
|
|
29
|
+
let session = null; // the selection the brush remembers: { host, start, end } (character offsets)
|
|
30
|
+
|
|
31
|
+
const same = (host, at) => session !== null && session.host === host && session.start === at.start && session.end === at.end;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Formats set (or taken off) on the selected text of `host` at `at` ({ start, end }): `touched`
|
|
35
|
+
* maps each format to its value now on the text (false or null: not on it).
|
|
36
|
+
*/
|
|
37
|
+
export function noteEffects(host, at, touched) {
|
|
38
|
+
const next = same(host, at) ? { ...effects } : {};
|
|
39
|
+
for (const [facet, value] of Object.entries(touched)) {
|
|
40
|
+
if (value === false || value === null) delete next[facet];
|
|
41
|
+
else next[facet] = value;
|
|
42
|
+
}
|
|
43
|
+
if (!same(host, at) && Object.keys(next).length === 0) return; // only formats taken off other text
|
|
44
|
+
effects = next;
|
|
45
|
+
session = { host, start: at.start, end: at.end };
|
|
46
|
+
keep(KEY, effects);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The brush was put on this text: formats set on it next add to the brush. */
|
|
50
|
+
export function brushed(host, at) {
|
|
51
|
+
session = { host, start: at.start, end: at.end };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** What the brush remembers (a copy). */
|
|
55
|
+
export const currentEffects = () => JSON.parse(JSON.stringify(effects));
|
|
56
|
+
|
|
57
|
+
/** The brush as format changes ([[name, value]], marks.mjs formatRange), in a fixed order. */
|
|
58
|
+
export function effectChanges(of = effects) {
|
|
59
|
+
const changes = [];
|
|
60
|
+
for (const name of ["bold", "italic", "strike"]) if (of[name]) changes.push([name, true]);
|
|
61
|
+
if (of.text) changes.push(["text", of.text]);
|
|
62
|
+
if (of.highlight) changes.push(["highlight", of.highlight]);
|
|
63
|
+
if (of.underline) changes.push(["underlineColor", of.underline.color], ["underlineWeight", of.underline.weight]);
|
|
64
|
+
return changes;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** What the brush remembers, in words: "加粗、红色文本、蓝色粗下划线", or "" when nothing. */
|
|
68
|
+
export function describeEffects(of = effects) {
|
|
69
|
+
const words = [];
|
|
70
|
+
if (of.bold) words.push(t("加粗"));
|
|
71
|
+
if (of.italic) words.push(t("斜体"));
|
|
72
|
+
if (of.strike) words.push(t("删除线"));
|
|
73
|
+
if (of.text) words.push(colorName("text", of.text));
|
|
74
|
+
if (of.highlight) words.push(colorName("highlight", of.highlight));
|
|
75
|
+
if (of.underline) words.push(lineName(of.underline));
|
|
76
|
+
return words.join(t("、"));
|
|
77
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { COLORS } from "../../components/colors.mjs";
|
|
2
|
+
import { HIGHLIGHTS, TEXT_COLORS } from "../marks.mjs";
|
|
3
|
+
import { recentList } from "../storage.mjs";
|
|
4
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
5
|
+
|
|
6
|
+
// The format bar's colors: their names, the rings of their swatches (Notion's color picker) and the
|
|
7
|
+
// colors used recently (最近使用), remembered in localStorage so they survive the reload after a save.
|
|
8
|
+
// A color is { family: "text" | "highlight", value: a color name, or null for the default }.
|
|
9
|
+
|
|
10
|
+
const NAMES = Object.fromEntries(COLORS);
|
|
11
|
+
|
|
12
|
+
/** What the reader calls a color: "红色文本", "黄色背景", "默认文本", "默认背景". */
|
|
13
|
+
export const colorName = (family, value) => t("{0}{1}", value ? NAMES[value] : t("默认"), family === "text" ? t("文本") : t("背景")); // two words: one in Chinese, two in English
|
|
14
|
+
|
|
15
|
+
/** What the reader calls an underline: "下划线" (red, 2px), "蓝色粗下划线", "文字色细下划线". */
|
|
16
|
+
export const lineName = ({ color, weight }) => t("{0}{1}下划线", color === "default" ? "" : color === "plain" ? t("文字色") : NAMES[color], { thin: t("细"), thick: t("粗") }[weight] ?? "").replace(/\s+/g, " ").trim();
|
|
17
|
+
|
|
18
|
+
/** Each swatch's ring and, when it is the selection's, its strong ring (light, dark), Notion's. */
|
|
19
|
+
export const RINGS = {
|
|
20
|
+
default: ["rgb(28 19 1 / 11%)", "rgb(255 255 235 / 10%)", "#2c2c2b", "#5f5e59"],
|
|
21
|
+
gray: ["rgb(28 19 1 / 11%)", "rgb(255 255 235 / 10%)", "#d4d3cf", "#5f5e59"],
|
|
22
|
+
brown: ["rgb(127 51 0 / 15.7%)", "rgb(255 177 129 / 19.2%)", "#e0cdc0", "#6d5340"],
|
|
23
|
+
orange: ["rgb(196 88 0 / 20.4%)", "rgb(255 147 75 / 28%)", "#eaccb2", "#88522f"],
|
|
24
|
+
yellow: ["rgb(209 156 0 / 28.2%)", "rgb(255 205 75 / 24%)", "#e8d497", "#836426"],
|
|
25
|
+
green: ["rgb(0 96 38 / 15.7%)", "rgb(108 255 172 / 15.7%)", "#bed9c9", "#37674c"],
|
|
26
|
+
blue: ["rgb(0 118 217 / 20.4%)", "rgb(67 155 255 / 24%)", "#b6d4f3", "#355f8b"],
|
|
27
|
+
purple: ["rgb(92 0 163 / 14%)", "rgb(200 125 255 / 20%)", "#dbc8e8", "#674d7b"],
|
|
28
|
+
pink: ["rgb(183 0 78 / 15.3%)", "rgb(255 103 177 / 23%)", "#eac4d5", "#7b4760"],
|
|
29
|
+
red: ["rgb(206 24 0 / 16.5%)", "rgb(255 104 92 / 24%)", "#f0c5be", "#924943"],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const RECENT = "gallery-edit:recent-colors";
|
|
33
|
+
const known = ({ family, value } = {}) => (family === "text" || family === "highlight") && (value === null || (family === "text" ? TEXT_COLORS : HIGHLIGHTS).includes(value));
|
|
34
|
+
|
|
35
|
+
// The recent colors start with a yellow background (a highlighter, as Notion's first recent color).
|
|
36
|
+
const recent = recentList(RECENT, {
|
|
37
|
+
max: 5, valid: known, same: (a, b) => a.family === b.family && a.value === b.value, fallback: [{ family: "highlight", value: "yellow" }],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/** The colors used recently, the last first (at most five). */
|
|
41
|
+
export const recentColors = () => recent.read().map((color) => ({ ...color }));
|
|
42
|
+
|
|
43
|
+
/** A color picked: it becomes the first of the recent colors. */
|
|
44
|
+
export function useColor(family, value) {
|
|
45
|
+
recent.use({ family, value });
|
|
46
|
+
}
|