@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,132 @@
|
|
|
1
|
+
import EN from "./en.mjs";
|
|
2
|
+
import { KEYS, OLD_KEYS } from "../renamed-storage.mjs";
|
|
3
|
+
|
|
4
|
+
// The language of Gallery's own UI (the workbench, the page editor's menus, cards and notices),
|
|
5
|
+
// chosen in the workbench's 设置 › 语言: Chinese (the source's own words) or English. A report's
|
|
6
|
+
// content is never translated. Each string is written in Chinese where it is used and goes through
|
|
7
|
+
// t(): its English is looked up in en.mjs by that Chinese text (tests/unit/i18n.mjs holds every
|
|
8
|
+
// one to having an entry), so the code reads as before and nothing is named twice. A string with
|
|
9
|
+
// parts filled in writes them as {0}, {1}… (t("已导入 {0} 个页面", count)).
|
|
10
|
+
// The choice is kept in localStorage, which the workbench and every preview page share (one
|
|
11
|
+
// origin); changing it reloads the workbench, so every string, those made once as a module loads
|
|
12
|
+
// too, is made again in the language chosen. Without a choice: the browser's language (Chinese for
|
|
13
|
+
// zh-*, else English).
|
|
14
|
+
|
|
15
|
+
/** The languages, by code, each named in itself. */
|
|
16
|
+
export const LANGUAGES = { zh: "中文", en: "English" };
|
|
17
|
+
const KEY = KEYS.language;
|
|
18
|
+
|
|
19
|
+
function stored() {
|
|
20
|
+
try {
|
|
21
|
+
const value = globalThis.localStorage?.getItem(KEY);
|
|
22
|
+
return Object.hasOwn(LANGUAGES, value ?? "") ? value : null;
|
|
23
|
+
} catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// The language in use, of the one kept (a code of LANGUAGES, or null) and the browser's: one rule for
|
|
29
|
+
// the UI's modules (language) and a report page's first script (languageScript), which runs it as text.
|
|
30
|
+
function inUse(kept, browser) {
|
|
31
|
+
return kept ?? (/^zh\b/i.test(browser ?? "zh") ? "zh" : "en");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** The language in use: "zh" or "en". */
|
|
35
|
+
export const language = inUse(stored(), globalThis.navigator?.language);
|
|
36
|
+
// The language t() says things in: the one in use, but while inLanguage runs.
|
|
37
|
+
let speaking = language;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* What a report page Gallery shows (the page edited, presented, the 写作偏好 dialog's) runs first, in
|
|
41
|
+
* its head (src/server/routes.mjs): the UI's language on its root as data-ge-language, which the kit's
|
|
42
|
+
* own words follow (src/render/kit/words.js: its chrome, an empty code block's title), read as
|
|
43
|
+
* `language` reads it, before the kit draws anything. An export of the view takes every data-ge-*
|
|
44
|
+
* attribute off (the kit's ui.js), so an exported file speaks its own lang.
|
|
45
|
+
*/
|
|
46
|
+
export const languageScript = () => {
|
|
47
|
+
const run = (keys, codes, browser) => {
|
|
48
|
+
let kept = null;
|
|
49
|
+
try {
|
|
50
|
+
kept = keys.map((key) => localStorage.getItem(key)).find((value) => codes.includes(value)) ?? null;
|
|
51
|
+
} catch {}
|
|
52
|
+
document.documentElement.setAttribute("data-ge-language", inUse(kept, browser));
|
|
53
|
+
};
|
|
54
|
+
// KEYS' own, else the old name's (src/shared/renamed-storage.mjs carries it over as the UI's modules load).
|
|
55
|
+
return `document.currentScript.remove(); (() => { const inUse = ${inUse}; (${run})(${JSON.stringify([KEY, OLD_KEYS.language])}, ${JSON.stringify(Object.keys(LANGUAGES))}, navigator.language); })();`;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Keep `code` as the language (the workbench reloads after, so everything is made in it). */
|
|
59
|
+
export function chooseLanguage(code) {
|
|
60
|
+
if (!Object.hasOwn(LANGUAGES, code)) return;
|
|
61
|
+
try {
|
|
62
|
+
globalThis.localStorage?.setItem(KEY, code);
|
|
63
|
+
} catch {}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `text` (Chinese, as written in the source) in the language in use, its {0}, {1}… filled with
|
|
68
|
+
* `values`. One Chinese word with two meanings in English says which it is after an @ ("标题@caption":
|
|
69
|
+
* 标题 in Chinese, its own entry in English).
|
|
70
|
+
*/
|
|
71
|
+
export function t(text, ...values) {
|
|
72
|
+
const own = /^([\s\S]*)@[a-z]+$/.exec(text)?.[1] ?? text;
|
|
73
|
+
return fill(speaking === "en" ? EN[text] ?? own : own, values);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// `text`'s {0}, {1}… filled with `values` (t's and said's one rule).
|
|
77
|
+
const fill = (text, values) => (values.length === 0 ? text : text.replace(/\{(\d+)\}/g, (whole, index) => (index < values.length ? String(values[index]) : whole)));
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* A message the server sends the UI with parts filled in (a size, a name, an exit code, an Agent's
|
|
81
|
+
* check lines), which no whole string of en.mjs could match: `text` the Chinese as t() takes it, a
|
|
82
|
+
* literal with {0}, {1}… (tests/unit/i18n.mjs holds each one to its entry), `values` its parts, never
|
|
83
|
+
* translated (a part that is itself a UI word is a template of its own: 图片太大 and 文件太大).
|
|
84
|
+
* { message: the Chinese filled in, what the log, the CLI and an older page read, text, values }: an
|
|
85
|
+
* answer spreads it ({ ok: false, reason, ...said(…) }), an error carries it (Object.assign(new
|
|
86
|
+
* Error(), said(…))). Filled here, never through t(): the server speaks Chinese whatever its machine's
|
|
87
|
+
* language.
|
|
88
|
+
*/
|
|
89
|
+
export function said(text, ...values) {
|
|
90
|
+
return { message: fill(text, values), text, values };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* What a failure's answer carries of `message`: a string as { message }; an error or said()'s object as
|
|
95
|
+
* { message } with its text and values when it has them; nothing for none.
|
|
96
|
+
*/
|
|
97
|
+
export function saying(message) {
|
|
98
|
+
if (message === undefined || message === null) return {};
|
|
99
|
+
if (typeof message === "string") return { message };
|
|
100
|
+
return { message: message.message, ...(typeof message.text === "string" && Array.isArray(message.values) ? { text: message.text, values: message.values } : {}) };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** An error that says `message` (a string, or said()'s), with `fields` (its reason): saying() carries it into an answer. */
|
|
104
|
+
export const refusal = (message, fields = {}) => Object.assign(new Error(typeof message === "string" ? message : message.message), saying(message), fields);
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* What a server's answer (or an error made of one: saying()) says, in the UI's language: t(text,
|
|
108
|
+
* ...values) when it carries said()'s template, else t(message) (a whole message: its entry, else as
|
|
109
|
+
* it is); null when it says nothing. The UI's funnels read a failure through it (post.mjs failure,
|
|
110
|
+
* the workbench's api.ts and transfer.ts).
|
|
111
|
+
*/
|
|
112
|
+
export function told(answer) {
|
|
113
|
+
if (typeof answer?.text === "string" && Array.isArray(answer.values)) return t(answer.text, ...answer.values);
|
|
114
|
+
return typeof answer?.message === "string" && answer.message ? t(answer.message) : null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* What `run` returns, its t() said in `code` ("zh" or "en") whatever the language in use: for what
|
|
119
|
+
* the server writes into a page it serves, which is not in the server's language but the page's
|
|
120
|
+
* (src/editor/components/placeholder.mjs: what is empty, in Chinese, said again in English as the
|
|
121
|
+
* page starts when its UI is). Synchronous only.
|
|
122
|
+
*/
|
|
123
|
+
export function inLanguage(code, run) {
|
|
124
|
+
if (!Object.hasOwn(LANGUAGES, code)) throw new Error(`No UI language "${code}".`);
|
|
125
|
+
const before = speaking;
|
|
126
|
+
speaking = code;
|
|
127
|
+
try {
|
|
128
|
+
return run();
|
|
129
|
+
} finally {
|
|
130
|
+
speaking = before;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The random ids the page and the server both make and check, in one place: a block's id (the one
|
|
2
|
+
// a block made on the page proposes, as the server makes them) and the id a commit is sent with
|
|
3
|
+
// (the server keeps its answer by it). Web Crypto is in the browser and in Node alike.
|
|
4
|
+
|
|
5
|
+
const CHARS = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
6
|
+
|
|
7
|
+
/** A random string of `length` lowercase letters and digits, a letter first when `letterFirst`. */
|
|
8
|
+
export const randomId = (length, { letterFirst = false } = {}) => [...crypto.getRandomValues(new Uint8Array(length))]
|
|
9
|
+
.map((byte, index) => CHARS[byte % (letterFirst && index === 0 ? 26 : 36)]).join("");
|
|
10
|
+
|
|
11
|
+
/** A block's id (data-block-id): eight letters and digits, a letter first. */
|
|
12
|
+
export const BLOCK_ID = /^[a-z][a-z0-9]{7}$/;
|
|
13
|
+
export const randomBlockId = () => randomId(8, { letterFirst: true });
|
|
14
|
+
|
|
15
|
+
/** A commit's id: the page makes sixteen letters and digits of it; the server takes eight to forty. */
|
|
16
|
+
export const REQUEST_ID = /^[a-z0-9]{8,40}$/;
|
|
17
|
+
export const randomRequestId = () => randomId(16);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The key of a text block outside any unit in a commit's answer (`outside`, by key: what the file
|
|
21
|
+
* says of its text): "title" for the report's title, "id:<id>" for any other, by the id of its own
|
|
22
|
+
* element, so that no element's id can be taken for the title; null for a block with neither.
|
|
23
|
+
*/
|
|
24
|
+
export const outsideKey = (title, id) => (title ? "title" : id ? `id:${id}` : null);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// What the workbench's 导入 takes (notion-lite's src/editor/transfer/import-types.js, Notion's
|
|
2
|
+
// 基于文件导入): by extension, each kind a converter of src/transfer/import.mjs. The import dialog's
|
|
3
|
+
// file picker offers them (accept), the server converts by them.
|
|
4
|
+
|
|
5
|
+
/** { kind: [extensions] } */
|
|
6
|
+
export const IMPORT_EXT = {
|
|
7
|
+
markdown: [".md", ".markdown", ".mdx", ".txt", ".text"],
|
|
8
|
+
html: [".html", ".htm", ".xhtml"],
|
|
9
|
+
csv: [".csv", ".tsv"],
|
|
10
|
+
docx: [".docx"],
|
|
11
|
+
pdf: [".pdf"],
|
|
12
|
+
epub: [".epub"],
|
|
13
|
+
zip: [".zip"],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** The lower-cased extension of a file's name, with its dot ("" for none). */
|
|
17
|
+
export const extOf = (name) => /\.[^./\\]+$/.exec(String(name).toLowerCase())?.[0] ?? "";
|
|
18
|
+
|
|
19
|
+
/** The kind of file `name` is ("markdown", "html", "csv", "docx", "pdf", "epub", "zip"), or null for one the import does not take. */
|
|
20
|
+
export const kindOf = (name) => Object.keys(IMPORT_EXT).find((kind) => IMPORT_EXT[kind].includes(extOf(name))) ?? null;
|
|
21
|
+
|
|
22
|
+
/** The biggest file the import takes (Notion's: "最大支持 5GB 的 ZIP 文件"). */
|
|
23
|
+
export const IMPORT_LIMIT = 5 * 1024 ** 3;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// The one rule for the space beside inline code and formulas, read by the kit's runtime/spacing.js
|
|
2
|
+
// (the reading view, for the report's own text) and by the page editor (marks.mjs, typing/, core.mjs
|
|
3
|
+
// prepareBlock, the paste): inline code and a formula stand an ordinary space apart from a letter,
|
|
4
|
+
// a digit or a Chinese character right beside them, and from one another; none beside a space,
|
|
5
|
+
// punctuation or the line's edge. What is beside an element is looked for as the reader sees it:
|
|
6
|
+
// out of the wrappers it stands in (strong, a link, a span...) and into those beside it, up to the
|
|
7
|
+
// edge of its line (a paragraph, a list item, a cell, a break, a list...) or of the editing host.
|
|
8
|
+
// A formula left empty (\(\), which shows nothing) and a link left empty are not there to either
|
|
9
|
+
// side. The editor's zero-width pads (pads.mjs) hold no text. DOM only: no globals.
|
|
10
|
+
|
|
11
|
+
// The magnitudes and measure words a number goes with, written with no space before them (3.6亿, 5个,
|
|
12
|
+
// 2024年, 30天), and 第 before a number (第3名): the page editor's typing keeps them together (typing/ autoSpace).
|
|
13
|
+
const UNITS = new Set([..."个万亿千百十元角分厘毛倍年月日号时点秒天周岁人位名次家条项种台只件篇页张套份组批期届代级层轮步米克斤吨度里公毫微寸尺两升户所座栋辆架艘本部章节场局首句字行列遍回番成"]);
|
|
14
|
+
const DIGIT = /[0-9]/;
|
|
15
|
+
/** Whether characters `a` and `b` (`before` the one ahead of `a`) stay together: a number and its unit (3万5千 too). */
|
|
16
|
+
export const numberWithUnit = (a, b, before = "") => (DIGIT.test(a) && UNITS.has(b)) || (a === "第" && DIGIT.test(b)) || (UNITS.has(a) && DIGIT.test(b) && DIGIT.test(before));
|
|
17
|
+
|
|
18
|
+
/** The editor's pads (pads.mjs) hold nothing but this. */
|
|
19
|
+
export const ZWSP = String.fromCharCode(0x200b);
|
|
20
|
+
/** What a space is put beside: a letter or a digit (a Chinese character is a letter). */
|
|
21
|
+
export const WORD = /[\p{L}\p{N}]/u;
|
|
22
|
+
|
|
23
|
+
const ITEM = "code, .doc-math-inline, .katex";
|
|
24
|
+
// What ends a line of text: nothing beyond it is a neighbour.
|
|
25
|
+
const LINE = /^(P|LI|H[1-6]|TD|TH|DT|DD|DIV|SECTION|ARTICLE|ASIDE|HEADER|FOOTER|MAIN|NAV|FIGURE|FIGCAPTION|CAPTION|SUMMARY|DETAILS|BLOCKQUOTE|UL|OL|TABLE|THEAD|TBODY|TR|PRE|BR|HR|DIALOG|BODY|BUTTON|svg)$/;
|
|
26
|
+
|
|
27
|
+
/** Whether `node` is a text node holding nothing but pads (or nothing). */
|
|
28
|
+
export const blank = (node) => node?.nodeType === 3 && node.data.replaceAll(ZWSP, "") === "";
|
|
29
|
+
|
|
30
|
+
// A formula left empty: \(\) as written, KaTeX's drawing of nothing, or the page editor's chip for
|
|
31
|
+
// it (data-ge-empty, as the editor's server serves the page; one that does not read has TeX in it).
|
|
32
|
+
const emptyFormula = (element) => element.matches(".doc-math-inline") && (element.getAttribute("data-ge-empty") === "formula" || !element.textContent.replace(/\\[()]/g, "").trim());
|
|
33
|
+
|
|
34
|
+
/** Whether `node` is inline code or a formula with something in it: what the rule spaces. */
|
|
35
|
+
export const isInlineItem = (node) => node?.nodeType === 1 && node.matches(ITEM) && !emptyFormula(node);
|
|
36
|
+
|
|
37
|
+
/** The inline code and formulas under `root` (itself too) that stand in the text, not in another formula or code. */
|
|
38
|
+
export function inlineItems(root) {
|
|
39
|
+
const items = root.nodeType === 1 && root.matches(ITEM) ? [root, ...root.querySelectorAll(ITEM)] : [...root.querySelectorAll(ITEM)];
|
|
40
|
+
return items.filter((item) => isInlineItem(item) && !item.parentElement?.closest(".doc-math-inline, .katex, .katex-display, code"));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// The text at one end of a node: its first (or last) character, true for inline code or a formula,
|
|
44
|
+
// null at a line's edge, undefined when it holds no text.
|
|
45
|
+
function endOf(node, after) {
|
|
46
|
+
if (node.nodeType === 3) {
|
|
47
|
+
const characters = [...node.data.replaceAll(ZWSP, "")];
|
|
48
|
+
return characters.length === 0 ? undefined : after ? characters[0] : characters.at(-1);
|
|
49
|
+
}
|
|
50
|
+
if (node.nodeType !== 1) return undefined;
|
|
51
|
+
if (LINE.test(node.tagName)) return null;
|
|
52
|
+
if (node.matches(ITEM)) return emptyFormula(node) ? undefined : true;
|
|
53
|
+
if (node.hasAttribute("data-ge-empty")) return undefined;
|
|
54
|
+
const children = [...node.childNodes];
|
|
55
|
+
for (const child of after ? children : children.reverse()) {
|
|
56
|
+
const found = endOf(child, after);
|
|
57
|
+
if (found !== undefined) return found;
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* What is beside `node` in its line, before it or `after` it: the character next to it, true where
|
|
64
|
+
* inline code or a formula is, null where there is nothing on the line.
|
|
65
|
+
*/
|
|
66
|
+
export function sideOf(node, after) {
|
|
67
|
+
for (let at = node; at;) {
|
|
68
|
+
const next = after ? at.nextSibling : at.previousSibling;
|
|
69
|
+
if (!next) {
|
|
70
|
+
at = at.parentElement;
|
|
71
|
+
if (!at || LINE.test(at.tagName) || at.hasAttribute("contenteditable")) return null;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const found = endOf(next, after);
|
|
75
|
+
if (found !== undefined) return found;
|
|
76
|
+
at = next;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* A space on each side of the inline code or formula `element` where a word or another one is
|
|
83
|
+
* beside it, as an ordinary text node (inside the wrapper the element stands in, where it stands
|
|
84
|
+
* at the wrapper's edge). Returns the spaces put in: { before, after }, text nodes or null.
|
|
85
|
+
*/
|
|
86
|
+
export function spaceAround(element) {
|
|
87
|
+
const put = { before: null, after: null };
|
|
88
|
+
for (const after of [false, true]) {
|
|
89
|
+
const side = sideOf(element, after);
|
|
90
|
+
if (side !== true && !(typeof side === "string" && WORD.test(side))) continue;
|
|
91
|
+
const space = element.ownerDocument.createTextNode(" ");
|
|
92
|
+
if (after) element.after(space);
|
|
93
|
+
else element.before(space);
|
|
94
|
+
put[after ? "after" : "before"] = space;
|
|
95
|
+
}
|
|
96
|
+
return put;
|
|
97
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// The z-order of everything the editor and the preview draw over a report, written once, lowest
|
|
2
|
+
// first. Each name is one level; a level's number is a step below TOP, near the largest z-index a
|
|
3
|
+
// page can have, so no report's own content covers them. Add a level where it belongs in the list;
|
|
4
|
+
// nothing else in src/ writes a number that big (tests/unit/editor-look.mjs holds it to that).
|
|
5
|
+
//
|
|
6
|
+
// Levels that used to share a number now stand one above the other: the resize guide was level with
|
|
7
|
+
// the panels (format bar, conflicts) and the size label with the toast and the hint; they follow the
|
|
8
|
+
// order below (the format bar is hidden while a picture is resized, so nothing shows the difference).
|
|
9
|
+
//
|
|
10
|
+
// checks the preview's note of failing checks (render/preview-checks.mjs)
|
|
11
|
+
// outline the outline at the page's right (page/outline/: its list or its strip; the strip's card is a menu)
|
|
12
|
+
// layer the overlay layers (page/overlay-layer.mjs): fills, frames, the handle, drop lines
|
|
13
|
+
// marquee the box a box selection draws
|
|
14
|
+
// affordance a button that appears by the text it adds to (添加图标)
|
|
15
|
+
// note 批注 in the margin: the markers, the cards, a block anchor's bar (editor/page/annotate/)
|
|
16
|
+
// preview the copies of the blocks being dragged
|
|
17
|
+
// mark the text a link card is about, marked
|
|
18
|
+
// spin a link's spinner
|
|
19
|
+
// guide the line a resize drags
|
|
20
|
+
// label its size label
|
|
21
|
+
// panel the format bar, the conflicts, the lost texts
|
|
22
|
+
// toast the page's own notice
|
|
23
|
+
// hint the bubble that says why a block cannot be edited
|
|
24
|
+
// menu the menus (block types, commands, the icon picker)
|
|
25
|
+
// card a card over the text it belongs to (a formula, a link)
|
|
26
|
+
// viewer a window over the whole page (a picture viewed, an embed full screen, the crop)
|
|
27
|
+
// tooltip the tooltip, over everything
|
|
28
|
+
const LEVELS = ["checks", "outline", "layer", "marquee", "affordance", "note", "preview", "mark", "spin", "guide", "label", "panel", "toast", "hint", "menu", "card", "viewer", "tooltip"];
|
|
29
|
+
const TOP = 2147483010;
|
|
30
|
+
|
|
31
|
+
/** name -> z-index. */
|
|
32
|
+
export const Z = Object.freeze(Object.fromEntries(LEVELS.map((name, index) => [name, TOP - (LEVELS.length - 1 - index)])));
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* What stands inside one overlay layer (a stacking context of its own), lowest first: a drop's tint,
|
|
36
|
+
* a selected block's fill, the frames, the handle and a section's bar, a button standing on a block's
|
|
37
|
+
* edge (a flowchart node's "+", centred on its right border: over the bar of the section it is in,
|
|
38
|
+
* whose right side it may reach) or beside it (the 批注 button, over that bar too), a drop's line.
|
|
39
|
+
*/
|
|
40
|
+
export const IN_LAYER = Object.freeze({ tint: 1, halo: 2, frame: 3, handle: 4, button: 5, drop: 6 });
|
|
41
|
+
|
|
42
|
+
export const LEVEL_NAMES = LEVELS;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Where a line may break inside a word: one rule for the kit's runtime (runtime/spacing.js: the
|
|
2
|
+
// reading page holds each long run in a span that breaks anywhere), its flowcharts' line model
|
|
3
|
+
// (runtime/flowchart.js piecesOf) and the page editor (page/long-runs.mjs: a text block holding one
|
|
4
|
+
// breaks anywhere as a whole). Ordinary words stay whole at a line's end, in a Chinese page as in an
|
|
5
|
+
// English one; a run of more than LONG_RUN characters with no place to break inside it (a path, a
|
|
6
|
+
// URL, a long identifier) breaks where its line ends, never carried whole to the next line leaving
|
|
7
|
+
// the line before it short (the user's words of 2026-11-07, and of 2026-11-06 before them).
|
|
8
|
+
//
|
|
9
|
+
// A run is what stands between spaces, Chinese, Japanese or Korean characters, full-width forms and
|
|
10
|
+
// the general punctuation (dashes, curly quotes, an ellipsis, a zero-width space: where a line breaks
|
|
11
|
+
// already, or what a path or an identifier does not hold): letters, digits and the marks of paths and
|
|
12
|
+
// URLs (. : / \ _ = & % # @ …). Inside one Chrome breaks a line after a hyphen and after a question
|
|
13
|
+
// mark, and at no other mark of ASCII (Chrome 156: not at a slash, a dot, a colon, a backslash or an
|
|
14
|
+
// underscore), so a run is counted by its pieces there: state-of-the-art is three short pieces, never
|
|
15
|
+
// long; D:\code\FinHarness\FinHarness-Demo.html is long by its first piece (30 characters).
|
|
16
|
+
// DOM-free.
|
|
17
|
+
|
|
18
|
+
/** A run longer than this many characters (by its longest piece) breaks anywhere. */
|
|
19
|
+
export const LONG_RUN = 20;
|
|
20
|
+
|
|
21
|
+
const RUNS = /[^\s\u2000-\u206f\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\ufe30-\ufe4f\uff00-\uffef]+/gu;
|
|
22
|
+
const PIECES = /(?<=[-?])/u;
|
|
23
|
+
|
|
24
|
+
const long = (run) => run.length > LONG_RUN && run.split(PIECES).some((piece) => [...piece].length > LONG_RUN);
|
|
25
|
+
|
|
26
|
+
/** The long runs of `text`, in order: { index, length } each (code units). */
|
|
27
|
+
export function longRuns(text) {
|
|
28
|
+
const found = [];
|
|
29
|
+
if (text.length <= LONG_RUN) return found;
|
|
30
|
+
for (const match of text.matchAll(RUNS)) if (long(match[0])) found.push({ index: match.index, length: match[0].length });
|
|
31
|
+
return found;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Whether `text` holds a long run. */
|
|
35
|
+
export function holdsLongRun(text) {
|
|
36
|
+
if (text.length <= LONG_RUN) return false;
|
|
37
|
+
for (const match of text.matchAll(RUNS)) if (long(match[0])) return true;
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// The media of a report, one place for what every system asks about it: the files its media
|
|
2
|
+
// blocks, its page icon and any other reference of its markup keep in the report's folder
|
|
3
|
+
// (assets/<file>), where the preview serves them, and what the editor may upload. Shared by the
|
|
4
|
+
// render (the preview's and an export's pictures, files and frames: src/render/media-ref.mjs, and
|
|
5
|
+
// every other reference: asset-references.mjs), the server (its routes: src/server/media-route.mjs,
|
|
6
|
+
// the upload: src/editor/media-store.mjs), the editor's page and the shared component descriptions.
|
|
7
|
+
// A new media kind is a row in these tables. Which blocks are media blocks is the descriptions' `media`
|
|
8
|
+
// (components/index.mjs MEDIA_BLOCKS).
|
|
9
|
+
|
|
10
|
+
// ---------- the files of a report's folder ----------
|
|
11
|
+
|
|
12
|
+
// assets/<file>: the file's name of letters, digits, dots, dashes and underscores (the page editor's
|
|
13
|
+
// uploads name each <kind>-<hash>.<extension>: editor/media-store.mjs). Flat and ASCII on purpose
|
|
14
|
+
// (a name any shell, URL and zip writes as it is); what breaks it is said by assetProblem.
|
|
15
|
+
const ASSET = /^assets\/[a-z0-9][a-z0-9._-]{0,80}$/i;
|
|
16
|
+
|
|
17
|
+
/** Each extension's media type: what a build and an export embed a file with, what the server serves it as. */
|
|
18
|
+
export const MEDIA_TYPES = {
|
|
19
|
+
png: "image/png", jpg: "image/jpeg", jpeg: "image/jpeg", gif: "image/gif", webp: "image/webp", avif: "image/avif", svg: "image/svg+xml", ico: "image/x-icon",
|
|
20
|
+
pdf: "application/pdf", csv: "text/csv", tsv: "text/tab-separated-values", txt: "text/plain", md: "text/markdown", json: "application/json",
|
|
21
|
+
xml: "application/xml", html: "text/html", htm: "text/html", zip: "application/zip", gz: "application/gzip", tar: "application/x-tar", "7z": "application/x-7z-compressed",
|
|
22
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", xls: "application/vnd.ms-excel",
|
|
23
|
+
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", doc: "application/msword",
|
|
24
|
+
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation", ppt: "application/vnd.ms-powerpoint",
|
|
25
|
+
mp3: "audio/mpeg", wav: "audio/wav", mp4: "video/mp4", webm: "video/webm", mov: "video/quicktime", vtt: "text/vtt",
|
|
26
|
+
woff: "font/woff", woff2: "font/woff2", ttf: "font/ttf", otf: "font/otf",
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** A name's extension, lowercase ("" when it has none). */
|
|
30
|
+
export const extensionOf = (value) => /\.([a-z0-9]{1,10})$/i.exec(value)?.[1]?.toLowerCase() ?? "";
|
|
31
|
+
|
|
32
|
+
/** The media type of a file by its extension (any file: application/octet-stream when the table lacks it). */
|
|
33
|
+
export const mediaTypeOf = (value) => MEDIA_TYPES[extensionOf(value)] ?? "application/octet-stream";
|
|
34
|
+
|
|
35
|
+
/** The extension an image's media type is kept under (png for image/png, jpg for image/jpeg). */
|
|
36
|
+
export const imageExtension = (type) => (type.startsWith("image/") ? Object.keys(MEDIA_TYPES).find((extension) => MEDIA_TYPES[extension] === type) ?? null : null);
|
|
37
|
+
|
|
38
|
+
/** Whether a value names a file of the report's folder (assets/<file>). */
|
|
39
|
+
export const assetFile = (value) => typeof value === "string" && ASSET.test(value) && !value.includes("..");
|
|
40
|
+
|
|
41
|
+
/** Whether a value names a picture of the report's folder (a file of an image type). */
|
|
42
|
+
export const imageFile = (value) => assetFile(value) && mediaTypeOf(value).startsWith("image/");
|
|
43
|
+
|
|
44
|
+
// The picture formats a page shows, as a failure names them.
|
|
45
|
+
const PICTURE_FORMATS = "png, jpg, gif, webp, avif, svg or ico";
|
|
46
|
+
// The rule of a file's name in assets/ (ASSET), as a failure says it.
|
|
47
|
+
const NAME_RULE = "a name is 1 to 81 characters, each a letter a-z or A-Z, a digit, a dot, a dash or an underscore, the first a letter or a digit";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A name of a file in assets/ that ASSET takes, made of one that it does not (an example a failure
|
|
51
|
+
* gives): its runs of ASCII letters and digits in lowercase, a dash between them, its extension kept
|
|
52
|
+
* (B263_古文孝経__NDL1288405.png → b263-ndl1288405.png); `fallback` when no letter or digit is left
|
|
53
|
+
* (古文孝経.png → picture.png).
|
|
54
|
+
*/
|
|
55
|
+
export function assetName(name, fallback = "file") {
|
|
56
|
+
const dot = name.lastIndexOf(".");
|
|
57
|
+
const extension = dot > 0 ? name.slice(dot + 1).toLowerCase().replace(/[^a-z0-9]/g, "").slice(0, 10) : "";
|
|
58
|
+
const stem = (dot > 0 ? name.slice(0, dot) : name).match(/[a-z0-9]+/gi)?.join("-").toLowerCase() || fallback;
|
|
59
|
+
return extension ? `${stem.slice(0, 80 - extension.length)}.${extension}` : stem.slice(0, 81);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Why a value names no file of the report's folder as the preview serves one (assetFile, and with
|
|
64
|
+
* `picture` imageFile), as a failure says it after the value and a colon, or null when it names one:
|
|
65
|
+
* each reason apart, with what to write instead: not in assets/ (a web address, another folder,
|
|
66
|
+
* ./assets/, ASSETS/ in capitals, one leaving it by ".."), in a folder of assets/, a name of
|
|
67
|
+
* characters ASSET does not take (each named, an example of a name it takes: assets/b263-kobun.png),
|
|
68
|
+
* too long or starting with neither a letter nor a digit; with `picture`, a file of no picture format
|
|
69
|
+
* too. The rule stays ASSET's: an Agent copies a file in under such a name (the uploads name theirs so).
|
|
70
|
+
*/
|
|
71
|
+
export function assetProblem(value, { picture = false } = {}) {
|
|
72
|
+
if (typeof value !== "string" || !value.trim()) return `it names no file: write assets/<file>, a file of the document's assets/ folder`;
|
|
73
|
+
const written = value.trim();
|
|
74
|
+
const format = (name) => (picture && !mediaTypeOf(name).startsWith("image/") ? `${extensionOf(name) ? `.${extensionOf(name)}` : "a file with no extension"} is no picture format a page shows (${PICTURE_FORMATS}): convert it to one` : "");
|
|
75
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(written)) return `it is no file of the document's folder (an export holds the document's own files alone): save it into the document's assets/ folder and write assets/<file>`;
|
|
76
|
+
const relative = /^\.\/(?=assets\/)/i.test(written) ? written.slice(2) : written;
|
|
77
|
+
if (!/^assets\//i.test(relative)) return `it is not in the document's assets/ folder: copy the file into it and write assets/<file>`;
|
|
78
|
+
const name = relative.slice("assets/".length);
|
|
79
|
+
if (!relative.startsWith("assets/")) return `the folder is assets/, in lowercase: write it so (assets/${name})`;
|
|
80
|
+
if (relative !== written) return `write it without "./" (${relative})`;
|
|
81
|
+
if (name.split(/[\\/]/).includes("..")) return `it leaves assets/ by "..": the files are right in assets/`;
|
|
82
|
+
const base = name.split(/[\\/]/).at(-1);
|
|
83
|
+
const proper = /^[a-z0-9][a-z0-9._-]{0,80}$/i.test(base) && !base.includes("..") ? base : assetName(base, picture ? "picture" : "file");
|
|
84
|
+
const converted = format(base);
|
|
85
|
+
if (/[\\/]/.test(name)) return `the preview serves the files right in assets/, none in a folder of it (${relative.slice(0, relative.length - base.length)}): move the file into assets/, as assets/${proper}${converted ? `; and ${converted}` : ""}`;
|
|
86
|
+
if (!base) return `it names no file: write assets/<file>, a file of the document's assets/ folder`;
|
|
87
|
+
const foreign = [...new Set(base.match(/[^a-z0-9._-]/gi) ?? [])];
|
|
88
|
+
const why = foreign.length ? `its name holds ${foreign.slice(0, 6).map((char) => (/\s/.test(char) ? "a space" : char)).join(", ")}${foreign.length > 6 ? "…" : ""}`
|
|
89
|
+
: base.length > 81 ? `its name is ${base.length} characters`
|
|
90
|
+
: !/^[a-z0-9]/i.test(base) ? `its name starts with "${base[0]}"`
|
|
91
|
+
: base.includes("..") ? `its name holds ".."`
|
|
92
|
+
: "";
|
|
93
|
+
if (why) return `${why}, which the preview serves no file by (${NAME_RULE}): copy the file in under such a name, as assets/${proper}${converted ? `; and ${converted}` : ""}`;
|
|
94
|
+
return converted || null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Whether a value names an embed block's file of the report's folder (an HTML or PDF file). */
|
|
98
|
+
export const embedFile = (value) => assetFile(value) && /\.(html?|pdf)$/i.test(value);
|
|
99
|
+
|
|
100
|
+
/** Whether a value names a picture a page's icon may be (an image of the report's folder, but no .ico). */
|
|
101
|
+
export const iconImageFile = (value) => imageFile(value) && extensionOf(value) !== "ico";
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The file of the report's folder a reference names, wherever it stands (render/asset-references.mjs):
|
|
105
|
+
* the value written assets/… or ./assets/… (in any case), without its query and fragment, its
|
|
106
|
+
* %-escapes read; or null when it names none (another address, or one leaving the folder by "..").
|
|
107
|
+
* Whether the preview can serve that file is assetFile's to say, as for any file of the folder.
|
|
108
|
+
*/
|
|
109
|
+
export function referencedFile(value) {
|
|
110
|
+
if (typeof value !== "string" || !/^\s*(?:\.\/)?assets\//i.test(value)) return null;
|
|
111
|
+
let file = value.trim().replace(/^\.\//, "").replace(/[?#].*$/, "");
|
|
112
|
+
try {
|
|
113
|
+
file = decodeURIComponent(file);
|
|
114
|
+
} catch {
|
|
115
|
+
// written with a stray "%": the name as it is
|
|
116
|
+
}
|
|
117
|
+
return file.split(/[\\/]/).includes("..") ? null : file;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ---------- where the preview serves them ----------
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* What each route of the preview server serves of a report's folder (/__gallery/edit/<route>/<slug>/assets/<file>):
|
|
124
|
+
* `asset` its pictures (the editor works with them as they are), `file` any file, handed out for saving
|
|
125
|
+
* only, `embed` an embed block's HTML or PDF file, shown in its frame. Each says what it takes.
|
|
126
|
+
*/
|
|
127
|
+
export const MEDIA_ROUTES = { asset: imageFile, file: assetFile, embed: embedFile };
|
|
128
|
+
|
|
129
|
+
/** The address the preview serves a file of a report's folder at (`value`: assets/<file>). */
|
|
130
|
+
export const mediaUrl = (route, slug, value) => `/__gallery/edit/${route}/${slug}/${value}`;
|
|
131
|
+
|
|
132
|
+
// ---------- what may be uploaded ----------
|
|
133
|
+
|
|
134
|
+
const MB = 1024 * 1024;
|
|
135
|
+
/** The most bytes of each upload kind: an icon's picture, an image block's, a file block's, an embed block's file. */
|
|
136
|
+
export const UPLOAD_LIMITS = { icon: 2 * MB, image: 10 * MB, file: 20 * MB, embed: 20 * MB };
|
|
137
|
+
/** The limit of an upload kind as the page says it ("10 MB"). */
|
|
138
|
+
export const sizeLimit = (kind) => `${UPLOAD_LIMITS[kind] / 1024 / 1024} MB`;
|
|
139
|
+
|
|
140
|
+
/** A size as Notion writes one: 1024 a step, one decimal at most (12.1 KiB). */
|
|
141
|
+
export function formatSize(bytes) {
|
|
142
|
+
const units = ["B", "KiB", "MiB", "GiB"];
|
|
143
|
+
let value = bytes;
|
|
144
|
+
let at = 0;
|
|
145
|
+
while (value >= 1024 && at < units.length - 1) {
|
|
146
|
+
value /= 1024;
|
|
147
|
+
at++;
|
|
148
|
+
}
|
|
149
|
+
return `${parseFloat(value.toFixed(at ? 1 : 0))} ${units[at]}`;
|
|
150
|
+
}
|
|
151
|
+
/** The most the upload request holds: the biggest file as base64, and a megabyte for the rest of it. */
|
|
152
|
+
export const UPLOAD_REQUEST_LIMIT = Math.ceil((Math.max(...Object.values(UPLOAD_LIMITS)) * 4) / 3 / MB + 1) * MB;
|
|
153
|
+
|
|
154
|
+
// ---------- the width a sized media block takes ----------
|
|
155
|
+
|
|
156
|
+
/** The property of a media block's width, as a share of the width it stands in (a picture's: of the reading width, at most where it stands), and the shares it may take. */
|
|
157
|
+
export const SPAN = "--doc-span";
|
|
158
|
+
export const SPAN_SIZE = { min: 0.1, max: 1 };
|
|
159
|
+
/** The reading width, px (the kit's --doc-content-max-width, styles/tokens.css): what a picture's width in pixels is a share of. */
|
|
160
|
+
export const READING_WIDTH = 712;
|
|
161
|
+
/** The gap between the columns of a row, px (the kit's --doc-column-gap, styles/tokens.css): what a column's width is less. */
|
|
162
|
+
export const COLUMN_GAP = 20;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { parse } from "parse5";
|
|
2
|
+
import { instanceSlots, isInstance } from "./components/index.mjs";
|
|
3
|
+
import { mayHoldOldNames, newAttributeName, newAttributeValue, newScriptNames, newStyleNames } from "./old-names.mjs";
|
|
4
|
+
|
|
5
|
+
// A file's text with the format's old names new (old-names.mjs says which, and where the tools read
|
|
6
|
+
// a text through this). Apart from old-names.mjs, which the page's code imports too: this one
|
|
7
|
+
// parses the text (parse5), as only the tools on the server do.
|
|
8
|
+
|
|
9
|
+
// The kit's tags (data-report-kit, data-report-vendor) and an export's inline copies of them: the
|
|
10
|
+
// kit's own text, of its own time, whose attributes alone are the page's.
|
|
11
|
+
const KIT_TAG = /^data-(?:report|doc)-(?:kit|vendor)$/;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* An HTML document's (or fragment's) text with the format's old names new: its attributes' names
|
|
15
|
+
* (data-report-* → data-doc-*), its classes, a meta's name, an id spelled as an old name and what
|
|
16
|
+
* points to it (for, aria-*, href="#…"), custom properties in any attribute (a style, an SVG's
|
|
17
|
+
* fill), the code of on* attributes and javascript: addresses, and the text of its
|
|
18
|
+
* own <style> and <script> elements (a JSON script is data: left as written, as is every text a
|
|
19
|
+
* reader reads, a comment and a code sample). An instance of a component package is passed by whole:
|
|
20
|
+
* no name in it is the format's. Lines stay where they are (a name changes in its line);
|
|
21
|
+
* a text holding none is given back as it is, and the new names are none of the old ones, so a
|
|
22
|
+
* second pass changes nothing.
|
|
23
|
+
*/
|
|
24
|
+
export function newNames(html) {
|
|
25
|
+
if (typeof html !== "string" || !mayHoldOldNames(html)) return html;
|
|
26
|
+
const document = parse(html, { sourceCodeLocationInfo: true });
|
|
27
|
+
const edits = []; // { start, end, text }
|
|
28
|
+
const put = (start, end, next) => {
|
|
29
|
+
if (html.slice(start, end) !== next) edits.push({ start, end, text: next });
|
|
30
|
+
};
|
|
31
|
+
function element(node) {
|
|
32
|
+
const places = node.sourceCodeLocation?.attrs ?? {};
|
|
33
|
+
for (const { name, value } of node.attrs) {
|
|
34
|
+
const place = places[name];
|
|
35
|
+
if (!place) continue;
|
|
36
|
+
const written = html.slice(place.startOffset, place.endOffset);
|
|
37
|
+
const equals = written.indexOf("=");
|
|
38
|
+
const head = equals < 0 ? written : written.slice(0, equals);
|
|
39
|
+
const tail = equals < 0 ? "" : written.slice(equals);
|
|
40
|
+
const newValue = /^on/i.test(name) || /^\s*javascript:/i.test(value) ? newScriptNames(tail) : newAttributeValue(name, tail, node.tagName);
|
|
41
|
+
put(place.startOffset, place.endOffset, newAttributeName(head) + newValue);
|
|
42
|
+
}
|
|
43
|
+
if (node.attrs.some(({ name }) => KIT_TAG.test(name)) || !["style", "script"].includes(node.tagName)) return;
|
|
44
|
+
const at = node.childNodes?.[0]?.sourceCodeLocation;
|
|
45
|
+
if (!at) return;
|
|
46
|
+
const type = (node.attrs.find(({ name }) => name === "type")?.value ?? "").trim().toLowerCase();
|
|
47
|
+
if (node.tagName === "script" && /json/.test(type)) return; // data: a chart's, a diff's lines
|
|
48
|
+
const source = html.slice(at.startOffset, at.endOffset);
|
|
49
|
+
put(at.startOffset, at.endOffset, node.tagName === "style" ? newStyleNames(source) : newScriptNames(source));
|
|
50
|
+
}
|
|
51
|
+
const visit = (node) => {
|
|
52
|
+
for (const child of node.childNodes ?? []) {
|
|
53
|
+
if (isInstance(child)) {
|
|
54
|
+
instanceSlots(child).forEach(visit); // what its slots hold is the document's, its own region the component's
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (child.tagName) element(child);
|
|
58
|
+
visit(child.tagName === "template" && child.content ? child.content : child);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
visit(document);
|
|
62
|
+
if (!edits.length) return html;
|
|
63
|
+
edits.sort((a, b) => b.start - a.start);
|
|
64
|
+
let result = html;
|
|
65
|
+
for (const { start, end, text } of edits) result = result.slice(0, start) + text + result.slice(end);
|
|
66
|
+
return result;
|
|
67
|
+
}
|