@heycys/gallery 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/THIRD-PARTY-NOTICES.md +3253 -0
- package/assets/writing-preferences.md +107 -0
- package/bin/gallery.mjs +10 -0
- package/browser/editor/components/bookmark/icons.mjs +6 -0
- package/browser/editor/components/bookmark/index.mjs +80 -0
- package/browser/editor/components/bookmark/page.mjs +147 -0
- package/browser/editor/components/builders.mjs +19 -0
- package/browser/editor/components/callout/index.mjs +39 -0
- package/browser/editor/components/callout/page.mjs +13 -0
- package/browser/editor/components/code/index.mjs +327 -0
- package/browser/editor/components/code/page.mjs +561 -0
- package/browser/editor/components/colors.mjs +50 -0
- package/browser/editor/components/columns/index.mjs +104 -0
- package/browser/editor/components/columns/page.mjs +297 -0
- package/browser/editor/components/details/index.mjs +72 -0
- package/browser/editor/components/details/page.mjs +86 -0
- package/browser/editor/components/dialog/index.mjs +83 -0
- package/browser/editor/components/dialog/page.mjs +219 -0
- package/browser/editor/components/divider/index.mjs +48 -0
- package/browser/editor/components/embed/icons.mjs +11 -0
- package/browser/editor/components/embed/index.mjs +123 -0
- package/browser/editor/components/embed/page.mjs +309 -0
- package/browser/editor/components/figure/index.mjs +87 -0
- package/browser/editor/components/figure/page.mjs +33 -0
- package/browser/editor/components/file/icons.mjs +14 -0
- package/browser/editor/components/file/index.mjs +77 -0
- package/browser/editor/components/file/page.mjs +114 -0
- package/browser/editor/components/flowchart/add.mjs +123 -0
- package/browser/editor/components/flowchart/index.mjs +246 -0
- package/browser/editor/components/flowchart/page.mjs +453 -0
- package/browser/editor/components/heading/index.mjs +51 -0
- package/browser/editor/components/highlight/index.mjs +79 -0
- package/browser/editor/components/icon/index.mjs +57 -0
- package/browser/editor/components/icon/page.mjs +286 -0
- package/browser/editor/components/icons.mjs +45 -0
- package/browser/editor/components/image/crop.mjs +189 -0
- package/browser/editor/components/image/index.mjs +104 -0
- package/browser/editor/components/image/page.mjs +385 -0
- package/browser/editor/components/image/viewer.mjs +213 -0
- package/browser/editor/components/installed/index.mjs +133 -0
- package/browser/editor/components/installed/page.mjs +422 -0
- package/browser/editor/components/installed/served.mjs +35 -0
- package/browser/editor/components/kit.mjs +64 -0
- package/browser/editor/components/list/index.mjs +194 -0
- package/browser/editor/components/list/join.mjs +68 -0
- package/browser/editor/components/list/numbers.mjs +107 -0
- package/browser/editor/components/list/page.mjs +632 -0
- package/browser/editor/components/math/index.mjs +88 -0
- package/browser/editor/components/math/page.mjs +236 -0
- package/browser/editor/components/math/tex-logo.mjs +6 -0
- package/browser/editor/components/media/icons.mjs +19 -0
- package/browser/editor/components/media/page.mjs +162 -0
- package/browser/editor/components/media/parts.mjs +60 -0
- package/browser/editor/components/media/size.mjs +20 -0
- package/browser/editor/components/media/toolbar.mjs +37 -0
- package/browser/editor/components/media/write.mjs +7 -0
- package/browser/editor/components/pages.mjs +46 -0
- package/browser/editor/components/paragraph/index.mjs +43 -0
- package/browser/editor/components/paragraph/page.mjs +52 -0
- package/browser/editor/components/placeholder-bar.mjs +17 -0
- package/browser/editor/components/placeholder.mjs +128 -0
- package/browser/editor/components/quote/index.mjs +33 -0
- package/browser/editor/components/registry.mjs +833 -0
- package/browser/editor/components/rows.mjs +16 -0
- package/browser/editor/components/section/index.mjs +41 -0
- package/browser/editor/components/section/page.mjs +141 -0
- package/browser/editor/components/sheets/index.mjs +137 -0
- package/browser/editor/components/sheets/page.mjs +227 -0
- package/browser/editor/components/sheets/pills.mjs +226 -0
- package/browser/editor/components/table/grid.mjs +73 -0
- package/browser/editor/components/table/index.mjs +306 -0
- package/browser/editor/components/table/page.mjs +672 -0
- package/browser/editor/components/table/slots.mjs +41 -0
- package/browser/editor/components/widget/index.mjs +50 -0
- package/browser/editor/page/annotate/anchors.mjs +229 -0
- package/browser/editor/page/annotate/card.mjs +102 -0
- package/browser/editor/page/annotate/index.mjs +1629 -0
- package/browser/editor/page/at-menu/index.mjs +317 -0
- package/browser/editor/page/autosave.mjs +977 -0
- package/browser/editor/page/beside.mjs +21 -0
- package/browser/editor/page/block-info.mjs +63 -0
- package/browser/editor/page/block-menu/colors.mjs +82 -0
- package/browser/editor/page/block-menu/index.mjs +215 -0
- package/browser/editor/page/blocks.mjs +246 -0
- package/browser/editor/page/caret.mjs +679 -0
- package/browser/editor/page/chip-fills.mjs +126 -0
- package/browser/editor/page/clipboard/import/colors.mjs +192 -0
- package/browser/editor/page/clipboard/import/html.mjs +792 -0
- package/browser/editor/page/clipboard/import/inline.mjs +232 -0
- package/browser/editor/page/clipboard/import/languages.mjs +42 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
- package/browser/editor/page/clipboard/import/math.mjs +100 -0
- package/browser/editor/page/clipboard/import/office.mjs +245 -0
- package/browser/editor/page/clipboard/import/read.mjs +120 -0
- package/browser/editor/page/clipboard/import/rich.mjs +29 -0
- package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
- package/browser/editor/page/clipboard/index.mjs +797 -0
- package/browser/editor/page/clipboard/own/blocks.mjs +202 -0
- package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
- package/browser/editor/page/clipboard/own/describe.mjs +115 -0
- package/browser/editor/page/clipboard/own/export.mjs +167 -0
- package/browser/editor/page/clipboard/own/ids.mjs +39 -0
- package/browser/editor/page/clipboard/own/index.mjs +13 -0
- package/browser/editor/page/clipboard/own/rules.mjs +44 -0
- package/browser/editor/page/clipboard/own/selection.mjs +159 -0
- package/browser/editor/page/clipboard/own/writers.mjs +326 -0
- package/browser/editor/page/columns/index.mjs +360 -0
- package/browser/editor/page/commit.mjs +1798 -0
- package/browser/editor/page/conflicts.mjs +269 -0
- package/browser/editor/page/convert.mjs +830 -0
- package/browser/editor/page/core.mjs +1655 -0
- package/browser/editor/page/drag/drop.mjs +307 -0
- package/browser/editor/page/drag/index.mjs +335 -0
- package/browser/editor/page/drag/preview.mjs +121 -0
- package/browser/editor/page/edge-scroll.mjs +50 -0
- package/browser/editor/page/editor.mjs +1725 -0
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +278 -0
- package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
- package/browser/editor/page/emoji-picker/grid.mjs +79 -0
- package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
- package/browser/editor/page/emoji-picker/icons.mjs +32 -0
- package/browser/editor/page/emoji-picker/index.mjs +164 -0
- package/browser/editor/page/emoji-picker/styles.mjs +2 -0
- package/browser/editor/page/emoji-picker/support.mjs +202 -0
- package/browser/editor/page/emoji-picker/upload.mjs +235 -0
- package/browser/editor/page/export-report.mjs +23 -0
- package/browser/editor/page/fills.mjs +60 -0
- package/browser/editor/page/find/index.mjs +107 -0
- package/browser/editor/page/flags.mjs +70 -0
- package/browser/editor/page/format-bar/bar.mjs +448 -0
- package/browser/editor/page/format-bar/brush.mjs +77 -0
- package/browser/editor/page/format-bar/colors.mjs +46 -0
- package/browser/editor/page/format-bar/index.mjs +404 -0
- package/browser/editor/page/formula/index.mjs +236 -0
- package/browser/editor/page/formula/panel.mjs +336 -0
- package/browser/editor/page/formula/symbols.mjs +156 -0
- package/browser/editor/page/frame.mjs +74 -0
- package/browser/editor/page/frames.mjs +196 -0
- package/browser/editor/page/geometry.mjs +400 -0
- package/browser/editor/page/gesture.mjs +45 -0
- package/browser/editor/page/handle/index.mjs +639 -0
- package/browser/editor/page/handle-sizes.mjs +14 -0
- package/browser/editor/page/hints/index.mjs +84 -0
- package/browser/editor/page/history.mjs +401 -0
- package/browser/editor/page/insert/index.mjs +243 -0
- package/browser/editor/page/kept.mjs +38 -0
- package/browser/editor/page/links/address.mjs +40 -0
- package/browser/editor/page/links/index.mjs +866 -0
- package/browser/editor/page/links/pages.mjs +131 -0
- package/browser/editor/page/links/views.mjs +369 -0
- package/browser/editor/page/look.mjs +65 -0
- package/browser/editor/page/made.mjs +24 -0
- package/browser/editor/page/margin.mjs +352 -0
- package/browser/editor/page/markdown/index.mjs +88 -0
- package/browser/editor/page/markdown/rules.mjs +33 -0
- package/browser/editor/page/marks.mjs +377 -0
- package/browser/editor/page/media-menu/index.mjs +158 -0
- package/browser/editor/page/menu.mjs +500 -0
- package/browser/editor/page/merge.mjs +100 -0
- package/browser/editor/page/notices.mjs +142 -0
- package/browser/editor/page/offered.mjs +32 -0
- package/browser/editor/page/outline/folds.mjs +52 -0
- package/browser/editor/page/outline/index.mjs +697 -0
- package/browser/editor/page/outline/list.mjs +172 -0
- package/browser/editor/page/outline/read.mjs +201 -0
- package/browser/editor/page/outline/strip.mjs +281 -0
- package/browser/editor/page/outline/tree.mjs +248 -0
- package/browser/editor/page/overlay-layer.mjs +227 -0
- package/browser/editor/page/overlays.mjs +205 -0
- package/browser/editor/page/own.mjs +28 -0
- package/browser/editor/page/pads.mjs +71 -0
- package/browser/editor/page/page-objects.mjs +105 -0
- package/browser/editor/page/panel.mjs +64 -0
- package/browser/editor/page/placement.mjs +58 -0
- package/browser/editor/page/post.mjs +41 -0
- package/browser/editor/page/present-links.mjs +50 -0
- package/browser/editor/page/quiet.mjs +48 -0
- package/browser/editor/page/resize/index.mjs +327 -0
- package/browser/editor/page/select-all/index.mjs +262 -0
- package/browser/editor/page/selection/delete.mjs +59 -0
- package/browser/editor/page/selection/index.mjs +157 -0
- package/browser/editor/page/selection/marquee.mjs +174 -0
- package/browser/editor/page/session.mjs +117 -0
- package/browser/editor/page/slash-menu/index.mjs +291 -0
- package/browser/editor/page/storage.mjs +48 -0
- package/browser/editor/page/sync-state.mjs +267 -0
- package/browser/editor/page/table/aligns.mjs +29 -0
- package/browser/editor/page/table/cell-bar.mjs +138 -0
- package/browser/editor/page/table/cells.mjs +527 -0
- package/browser/editor/page/table/icons.mjs +40 -0
- package/browser/editor/page/table/index.mjs +985 -0
- package/browser/editor/page/table/lists.mjs +187 -0
- package/browser/editor/page/table/widths.mjs +308 -0
- package/browser/editor/page/tex.mjs +32 -0
- package/browser/editor/page/text-select/index.mjs +656 -0
- package/browser/editor/page/tooltip.mjs +98 -0
- package/browser/editor/page/type-grid.mjs +82 -0
- package/browser/editor/page/typing/code-edges.mjs +228 -0
- package/browser/editor/page/typing/index.mjs +276 -0
- package/browser/editor/page/typing/leave.mjs +68 -0
- package/browser/editor/page/ui.mjs +160 -0
- package/browser/shared/annotations.mjs +571 -0
- package/browser/shared/code-folds.mjs +10 -0
- package/browser/shared/code-languages.mjs +70 -0
- package/browser/shared/code-lines.mjs +30 -0
- package/browser/shared/colors.mjs +28 -0
- package/browser/shared/component-catalog.mjs +559 -0
- package/browser/shared/components/bookmark.mjs +26 -0
- package/browser/shared/components/callout.mjs +7 -0
- package/browser/shared/components/chart.mjs +20 -0
- package/browser/shared/components/code.mjs +37 -0
- package/browser/shared/components/columns.mjs +16 -0
- package/browser/shared/components/details.mjs +15 -0
- package/browser/shared/components/dialog.mjs +28 -0
- package/browser/shared/components/diff.mjs +18 -0
- package/browser/shared/components/divider.mjs +6 -0
- package/browser/shared/components/embed.mjs +25 -0
- package/browser/shared/components/figure.mjs +14 -0
- package/browser/shared/components/file.mjs +23 -0
- package/browser/shared/components/heading.mjs +6 -0
- package/browser/shared/components/highlight.mjs +9 -0
- package/browser/shared/components/icon.mjs +18 -0
- package/browser/shared/components/image.mjs +39 -0
- package/browser/shared/components/index.mjs +342 -0
- package/browser/shared/components/installed.mjs +162 -0
- package/browser/shared/components/list.mjs +146 -0
- package/browser/shared/components/math.mjs +49 -0
- package/browser/shared/components/mention.mjs +33 -0
- package/browser/shared/components/page.mjs +37 -0
- package/browser/shared/components/paragraph.mjs +9 -0
- package/browser/shared/components/quote.mjs +6 -0
- package/browser/shared/components/section.mjs +8 -0
- package/browser/shared/components/sheets.mjs +80 -0
- package/browser/shared/components/state.mjs +20 -0
- package/browser/shared/components/table.mjs +49 -0
- package/browser/shared/components/text.mjs +14 -0
- package/browser/shared/components/widget.mjs +10 -0
- package/browser/shared/copy-ids.mjs +72 -0
- package/browser/shared/css-references.mjs +110 -0
- package/browser/shared/emoji/custom.mjs +91 -0
- package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
- package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
- package/browser/shared/emoji/data/README.md +26 -0
- package/browser/shared/emoji/data/categories.json +1 -0
- package/browser/shared/emoji/data/icons.json +1 -0
- package/browser/shared/emoji/data/keywords-en.json +1 -0
- package/browser/shared/emoji/data/keywords-zh.json +1 -0
- package/browser/shared/emoji/data/names.json +1 -0
- package/browser/shared/emoji/data/positions.json +1 -0
- package/browser/shared/emoji/data/twemoji-index.json +1 -0
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +196 -0
- package/browser/shared/emoji/emoji.mjs +37 -0
- package/browser/shared/emoji/glyphs.mjs +134 -0
- package/browser/shared/emoji/icon-value.mjs +90 -0
- package/browser/shared/escape.mjs +20 -0
- package/browser/shared/export-wrap.mjs +89 -0
- package/browser/shared/files.mjs +33 -0
- package/browser/shared/html-tree.mjs +53 -0
- package/browser/shared/http.mjs +22 -0
- package/browser/shared/i18n/en.mjs +1164 -0
- package/browser/shared/i18n/index.mjs +132 -0
- package/browser/shared/ids.mjs +24 -0
- package/browser/shared/import-types.mjs +23 -0
- package/browser/shared/inline-spacing.mjs +97 -0
- package/browser/shared/layers.mjs +42 -0
- package/browser/shared/media.mjs +162 -0
- package/browser/shared/new-names.mjs +64 -0
- package/browser/shared/number-reading.mjs +92 -0
- package/browser/shared/old-names.mjs +143 -0
- package/browser/shared/page-address.mjs +140 -0
- package/browser/shared/page-links.mjs +86 -0
- package/browser/shared/paths.mjs +73 -0
- package/browser/shared/preferences.mjs +110 -0
- package/browser/shared/preview-server.mjs +247 -0
- package/browser/shared/qa-levels.mjs +93 -0
- package/browser/shared/reading-place.mjs +91 -0
- package/browser/shared/renamed-storage.mjs +220 -0
- package/browser/shared/reports.mjs +46 -0
- package/browser/shared/search.mjs +85 -0
- package/browser/shared/session.mjs +76 -0
- package/browser/shared/table-chart.mjs +113 -0
- package/browser/shared/table-hides.mjs +120 -0
- package/browser/shared/table-slots.mjs +75 -0
- package/browser/shared/words.mjs +23 -0
- package/browser/shared/workspace.mjs +535 -0
- package/browser/shared/writing-preferences.mjs +68 -0
- package/browser/shared/zoom.mjs +57 -0
- package/dist/chunk-2B5E4CDJ.mjs +2 -0
- package/dist/chunk-2PBALTR3.mjs +57 -0
- package/dist/chunk-342HXE3Q.mjs +2 -0
- package/dist/chunk-3LA3EMDE.mjs +15 -0
- package/dist/chunk-43B75J5T.mjs +2 -0
- package/dist/chunk-4K5KC6V2.mjs +2 -0
- package/dist/chunk-5FRMCDPY.mjs +16 -0
- package/dist/chunk-5L7RYZCL.mjs +2 -0
- package/dist/chunk-5LEK2CBS.mjs +2 -0
- package/dist/chunk-5OFN5AHC.mjs +2 -0
- package/dist/chunk-5SIYS5HN.mjs +2 -0
- package/dist/chunk-5TEK3RAD.mjs +2 -0
- package/dist/chunk-6CYG3Z4V.mjs +2 -0
- package/dist/chunk-6U2SLSDN.mjs +3 -0
- package/dist/chunk-742D2WWJ.mjs +19 -0
- package/dist/chunk-7GHT2UCA.mjs +15 -0
- package/dist/chunk-7QQBR7PB.mjs +2 -0
- package/dist/chunk-A55HN5OK.mjs +2 -0
- package/dist/chunk-ACOPDCNB.mjs +2 -0
- package/dist/chunk-AGDILNWB.mjs +2 -0
- package/dist/chunk-ATCJYAR4.mjs +2 -0
- package/dist/chunk-B3VTYBYR.mjs +960 -0
- package/dist/chunk-C564NU2H.mjs +77 -0
- package/dist/chunk-C7HWOBIF.mjs +2 -0
- package/dist/chunk-DB4WKGYF.mjs +7 -0
- package/dist/chunk-E7VYDG2X.mjs +2 -0
- package/dist/chunk-EUX7IC5J.mjs +48 -0
- package/dist/chunk-EVJ3BX3M.mjs +2 -0
- package/dist/chunk-EZY3WC6Z.mjs +15 -0
- package/dist/chunk-FQGQH4KM.mjs +2 -0
- package/dist/chunk-G7TOXONE.mjs +6 -0
- package/dist/chunk-GPF4YWWB.mjs +9 -0
- package/dist/chunk-GRAXKKG4.mjs +2 -0
- package/dist/chunk-GYQV7Y4J.mjs +120 -0
- package/dist/chunk-HMHK3EQ6.mjs +2 -0
- package/dist/chunk-HQQMJCQJ.mjs +10 -0
- package/dist/chunk-HYMEEXKN.mjs +4 -0
- package/dist/chunk-IERUOGC3.mjs +6 -0
- package/dist/chunk-ITNLYXXV.mjs +3 -0
- package/dist/chunk-L4DVONOG.mjs +2 -0
- package/dist/chunk-LAE5NQ4B.mjs +2 -0
- package/dist/chunk-LC7YNQFG.mjs +2 -0
- package/dist/chunk-LHTFLRB6.mjs +4 -0
- package/dist/chunk-LKX55H76.mjs +2 -0
- package/dist/chunk-MAFIGVXY.mjs +2 -0
- package/dist/chunk-NFIBI4IP.mjs +26 -0
- package/dist/chunk-NSKUTQ5J.mjs +5 -0
- package/dist/chunk-O52JMOCZ.mjs +2 -0
- package/dist/chunk-P2CAZPDP.mjs +3 -0
- package/dist/chunk-QAIHRH3I.mjs +13 -0
- package/dist/chunk-QMQUXTU4.mjs +12 -0
- package/dist/chunk-QR6A54KJ.mjs +3 -0
- package/dist/chunk-QVWVFC5K.mjs +6 -0
- package/dist/chunk-QYKCJ7FG.mjs +8 -0
- package/dist/chunk-QZY6Q64C.mjs +2 -0
- package/dist/chunk-TDQP3DKQ.mjs +10 -0
- package/dist/chunk-TMYZB6AV.mjs +2 -0
- package/dist/chunk-TX6JH7TR.mjs +2 -0
- package/dist/chunk-U3SSPL4K.mjs +8 -0
- package/dist/chunk-UH4SIXTR.mjs +2 -0
- package/dist/chunk-UNUEWH4S.mjs +2 -0
- package/dist/chunk-UXUK4PMC.mjs +27 -0
- package/dist/chunk-V4CPWKMZ.mjs +2 -0
- package/dist/chunk-V6XZ4VIR.mjs +2 -0
- package/dist/chunk-VACRB2NE.mjs +3 -0
- package/dist/chunk-W63L7367.mjs +7 -0
- package/dist/chunk-W7CXPCRV.mjs +6 -0
- package/dist/chunk-W7XHE4CT.mjs +2 -0
- package/dist/chunk-XINNG4F2.mjs +4 -0
- package/dist/chunk-Y34NR5JL.mjs +2 -0
- package/dist/chunk-YEY3RSFQ.mjs +2 -0
- package/dist/chunk-YL2DPWVS.mjs +4 -0
- package/dist/chunk-YXAUQPVK.mjs +8 -0
- package/dist/chunk-YZ5Z6H4W.mjs +4 -0
- package/dist/chunk-Z52HTUW7.mjs +4 -0
- package/dist/chunk-ZBIM6ARY.mjs +216 -0
- package/dist/cli.mjs +2 -0
- package/dist/server.mjs +2 -0
- package/dist/worker.mjs +5 -0
- package/kit/charts.js +355 -0
- package/kit/code.js +164 -0
- package/kit/dialogs.js +157 -0
- package/kit/math.js +1988 -0
- package/kit/report.css +2821 -0
- package/kit/runtime.js +1707 -0
- package/kit/sheets.js +123 -0
- package/kit/state.js +217 -0
- package/kit/tables.js +1449 -0
- package/kit/tokens.js +29 -0
- package/kit/ui.js +561 -0
- package/package.json +41 -4
- package/release.json +25 -0
- package/sdk/column-widths.d.ts +56 -0
- package/sdk/doc-charts.d.ts +82 -0
- package/sdk/doc-code.d.ts +28 -0
- package/sdk/doc-dialogs.d.ts +4 -0
- package/sdk/doc-kit.d.ts +141 -0
- package/sdk/doc-math.d.ts +3 -0
- package/sdk/doc-sheets.d.ts +15 -0
- package/sdk/doc-state.d.ts +41 -0
- package/sdk/doc-tables.d.ts +24 -0
- package/sdk/doc-tokens.d.ts +22 -0
- package/sdk/index.d.ts +30 -0
- package/skill/SKILL.md +138 -0
- package/skill/agents/openai.yaml +5 -0
- package/skill/references/building-components.md +327 -0
- package/skill/references/example-report.html +356 -0
- package/skill/references/writing-html.md +187 -0
- package/skill/sdk/column-widths.d.ts +56 -0
- package/skill/sdk/doc-charts.d.ts +82 -0
- package/skill/sdk/doc-code.d.ts +28 -0
- package/skill/sdk/doc-dialogs.d.ts +4 -0
- package/skill/sdk/doc-kit.d.ts +141 -0
- package/skill/sdk/doc-math.d.ts +3 -0
- package/skill/sdk/doc-sheets.d.ts +15 -0
- package/skill/sdk/doc-state.d.ts +41 -0
- package/skill/sdk/doc-tables.d.ts +24 -0
- package/skill/sdk/doc-tokens.d.ts +22 -0
- package/skill/sdk/index.d.ts +30 -0
- package/starter/doc.html +21 -0
- package/starter/doc.json +5 -0
- package/vendor/d3.v7.9.0.min.js +2 -0
- package/vendor/katex/auto-render.min.js +1 -0
- package/vendor/katex/contrib/mhchem.min.js +1 -0
- package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/vendor/katex/katex.min.css +1 -0
- package/vendor/katex/katex.min.js +1 -0
- package/vendor/pdfjs/LICENSE +177 -0
- package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
- package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
- package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/vendor/types/@types/d3/LICENSE +21 -0
- package/vendor/types/@types/d3/index.d.ts +39 -0
- package/vendor/types/@types/d3/package.json +81 -0
- package/vendor/types/@types/d3-array/LICENSE +21 -0
- package/vendor/types/@types/d3-array/index.d.ts +1118 -0
- package/vendor/types/@types/d3-array/package.json +56 -0
- package/vendor/types/@types/d3-axis/LICENSE +21 -0
- package/vendor/types/@types/d3-axis/index.d.ts +293 -0
- package/vendor/types/@types/d3-axis/package.json +47 -0
- package/vendor/types/@types/d3-brush/LICENSE +21 -0
- package/vendor/types/@types/d3-brush/index.d.ts +255 -0
- package/vendor/types/@types/d3-brush/package.json +42 -0
- package/vendor/types/@types/d3-chord/LICENSE +21 -0
- package/vendor/types/@types/d3-chord/index.d.ts +471 -0
- package/vendor/types/@types/d3-chord/package.json +40 -0
- package/vendor/types/@types/d3-color/LICENSE +21 -0
- package/vendor/types/@types/d3-color/index.d.ts +669 -0
- package/vendor/types/@types/d3-color/package.json +55 -0
- package/vendor/types/@types/d3-contour/LICENSE +21 -0
- package/vendor/types/@types/d3-contour/index.d.ts +222 -0
- package/vendor/types/@types/d3-contour/package.json +38 -0
- package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
- package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
- package/vendor/types/@types/d3-delaunay/package.json +30 -0
- package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
- package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
- package/vendor/types/@types/d3-dispatch/package.json +51 -0
- package/vendor/types/@types/d3-drag/LICENSE +21 -0
- package/vendor/types/@types/d3-drag/index.d.ts +395 -0
- package/vendor/types/@types/d3-drag/package.json +42 -0
- package/vendor/types/@types/d3-dsv/LICENSE +21 -0
- package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
- package/vendor/types/@types/d3-dsv/package.json +45 -0
- package/vendor/types/@types/d3-ease/LICENSE +21 -0
- package/vendor/types/@types/d3-ease/index.d.ts +316 -0
- package/vendor/types/@types/d3-ease/package.json +40 -0
- package/vendor/types/@types/d3-fetch/LICENSE +21 -0
- package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
- package/vendor/types/@types/d3-fetch/package.json +37 -0
- package/vendor/types/@types/d3-force/LICENSE +21 -0
- package/vendor/types/@types/d3-force/index.d.ts +899 -0
- package/vendor/types/@types/d3-force/package.json +45 -0
- package/vendor/types/@types/d3-format/LICENSE +21 -0
- package/vendor/types/@types/d3-format/index.d.ts +337 -0
- package/vendor/types/@types/d3-format/package.json +45 -0
- package/vendor/types/@types/d3-geo/LICENSE +21 -0
- package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
- package/vendor/types/@types/d3-geo/package.json +48 -0
- package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
- package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
- package/vendor/types/@types/d3-hierarchy/package.json +50 -0
- package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
- package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
- package/vendor/types/@types/d3-interpolate/package.json +47 -0
- package/vendor/types/@types/d3-path/LICENSE +21 -0
- package/vendor/types/@types/d3-path/index.d.ts +108 -0
- package/vendor/types/@types/d3-path/package.json +41 -0
- package/vendor/types/@types/d3-polygon/LICENSE +21 -0
- package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
- package/vendor/types/@types/d3-polygon/package.json +40 -0
- package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
- package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
- package/vendor/types/@types/d3-quadtree/package.json +45 -0
- package/vendor/types/@types/d3-random/LICENSE +21 -0
- package/vendor/types/@types/d3-random/index.d.ts +313 -0
- package/vendor/types/@types/d3-random/package.json +41 -0
- package/vendor/types/@types/d3-scale/LICENSE +21 -0
- package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
- package/vendor/types/@types/d3-scale/package.json +53 -0
- package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
- package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
- package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
- package/vendor/types/@types/d3-selection/LICENSE +21 -0
- package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
- package/vendor/types/@types/d3-selection/package.json +56 -0
- package/vendor/types/@types/d3-shape/LICENSE +21 -0
- package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
- package/vendor/types/@types/d3-shape/package.json +53 -0
- package/vendor/types/@types/d3-time/LICENSE +21 -0
- package/vendor/types/@types/d3-time/index.d.ts +697 -0
- package/vendor/types/@types/d3-time/package.json +46 -0
- package/vendor/types/@types/d3-time-format/LICENSE +21 -0
- package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
- package/vendor/types/@types/d3-time-format/package.json +40 -0
- package/vendor/types/@types/d3-timer/LICENSE +21 -0
- package/vendor/types/@types/d3-timer/index.d.ts +68 -0
- package/vendor/types/@types/d3-timer/package.json +45 -0
- package/vendor/types/@types/d3-transition/LICENSE +21 -0
- package/vendor/types/@types/d3-transition/index.d.ts +664 -0
- package/vendor/types/@types/d3-transition/package.json +47 -0
- package/vendor/types/@types/d3-zoom/LICENSE +21 -0
- package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
- package/vendor/types/@types/d3-zoom/package.json +48 -0
- package/vendor/types/@types/geojson/LICENSE +21 -0
- package/vendor/types/@types/geojson/index.d.ts +202 -0
- package/vendor/types/@types/geojson/package.json +46 -0
- package/vendor/typescript/LICENSE.txt +55 -0
- package/vendor/typescript/lib.decorators.d.ts +384 -0
- package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
- package/vendor/typescript/lib.dom.d.ts +39429 -0
- package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
- package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
- package/vendor/typescript/lib.es2015.core.d.ts +597 -0
- package/vendor/typescript/lib.es2015.d.ts +28 -0
- package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
- package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
- package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
- package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
- package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
- package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
- package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
- package/vendor/typescript/lib.es2016.d.ts +21 -0
- package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
- package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
- package/vendor/typescript/lib.es2017.d.ts +26 -0
- package/vendor/typescript/lib.es2017.date.d.ts +31 -0
- package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
- package/vendor/typescript/lib.es2017.object.d.ts +49 -0
- package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
- package/vendor/typescript/lib.es2017.string.d.ts +45 -0
- package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
- package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
- package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
- package/vendor/typescript/lib.es2018.d.ts +24 -0
- package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
- package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
- package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
- package/vendor/typescript/lib.es2019.array.d.ts +79 -0
- package/vendor/typescript/lib.es2019.d.ts +24 -0
- package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
- package/vendor/typescript/lib.es2019.object.d.ts +33 -0
- package/vendor/typescript/lib.es2019.string.d.ts +37 -0
- package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
- package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
- package/vendor/typescript/lib.es2020.d.ts +27 -0
- package/vendor/typescript/lib.es2020.date.d.ts +42 -0
- package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
- package/vendor/typescript/lib.es2020.number.d.ts +28 -0
- package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
- package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
- package/vendor/typescript/lib.es2020.string.d.ts +44 -0
- package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/vendor/typescript/lib.es2021.d.ts +23 -0
- package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
- package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
- package/vendor/typescript/lib.es2021.string.d.ts +33 -0
- package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
- package/vendor/typescript/lib.es2022.array.d.ts +121 -0
- package/vendor/typescript/lib.es2022.d.ts +25 -0
- package/vendor/typescript/lib.es2022.error.d.ts +75 -0
- package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
- package/vendor/typescript/lib.es2022.object.d.ts +26 -0
- package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
- package/vendor/typescript/lib.es2022.string.d.ts +25 -0
- package/vendor/typescript/lib.es5.d.ts +4601 -0
- package/vendor/typescript/package.json +4 -0
- package/vendor/typescript/typescript.js +446 -0
- package/web/assets/index-B6Ai3wsa.js +13 -0
- package/web/assets/index-SYPC3EZy.css +1 -0
- package/web/index.html +14 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import { newDomNames } from "../../../../shared/old-names.mjs";
|
|
2
|
+
import { convertRenderedMath } from "./math.mjs";
|
|
3
|
+
import { languageFromFence } from "./languages.mjs";
|
|
4
|
+
import { NOTION_COLOR_NAMES, backgroundColor, textColor } from "./colors.mjs";
|
|
5
|
+
import { normalize, spec } from "./rich.mjs";
|
|
6
|
+
|
|
7
|
+
// Pasted HTML as block specs or rich text (Notion 760354 htmlHelpers, notion-lite html-import.js;
|
|
8
|
+
// read.mjs decides which, after Notion 860313).
|
|
9
|
+
// parseClipboardHTML(html) the HTML in a document of its own (no scripts run, no pictures
|
|
10
|
+
// load), formulas a page drew made formula marks (math.mjs), cleaned
|
|
11
|
+
// as Notion's DOMPurify does, in a div; a new copy each call; the kit's
|
|
12
|
+
// old names (a page or an export made before 2026-10-26) new (newDomNames)
|
|
13
|
+
// normalizeHTML(root, { inline }) 760354 J, in place: Slack's emoji pictures as their :name: text; Notion's
|
|
14
|
+
// block-color-* classes as color marks; <br> in a <p> splits it; first pass: Google Sheets'
|
|
15
|
+
// wrapper, whitespace-only text, meta / style / script / head / title go, font-size ≥ 24px (or
|
|
16
|
+
// > 2em) makes an h1, line-through / italic / bold (≥ 500) styles wrap del / em / strong, b →
|
|
17
|
+
// strong, i → em, a font-weight: normal strong (Google Docs' wrapper) → span, section / article
|
|
18
|
+
// → div, display: inline divs → span, checkboxes → "[x] " / "[ ] ", a table of one cell a row
|
|
19
|
+
// (layout) → its contents and dividers, a ul right in a ul moves into the li before it, style and
|
|
20
|
+
// dir go, plain spans unwrapped; second pass: a container of only h1s (or h2s) one heading,
|
|
21
|
+
// empty divs / spans go, p / div holding blocks unwrapped; loose text at the top in <p> (not
|
|
22
|
+
// inline).
|
|
23
|
+
// htmlToBlocks(root) 760354 U (aH): normalized, element by element as blocks (blockOf)
|
|
24
|
+
// htmlToRichText(root) 760354 Q (Hw): normalized, as one rich text (pasted in text)
|
|
25
|
+
// containsRichFormatting(root) 760354 X (HZ): any element but span / div / p (or code, columns,
|
|
26
|
+
// colors, formulas); without, the HTML is pasted as plain text
|
|
27
|
+
// Blocks (blockOf, in this order): hr → divider; h* → heading 1 / 2 / 3 / 4 (its pictures after it);
|
|
28
|
+
// pre / code / div.sourceCode → code (language from a language-x class or a language's name; a
|
|
29
|
+
// figure's figcaption its caption); data-notion-callout → callout; blockquote → quote (its first
|
|
30
|
+
// node its text, the rest its blocks); details → toggle; data-notion-tab-container → tabs; table →
|
|
31
|
+
// table (row and column spans spread into empty cells; a first row all th a header row, every row
|
|
32
|
+
// starting with th a header column); data-notion-column-list → columns (8 at most); the kit's
|
|
33
|
+
// ol.doc-flow → report_flow of report_step (besides Notion's: flowchartBlock); ul / ol → their
|
|
34
|
+
// li; li, or text starting "[x]", "[ ]", "-", "*", "•" → list item / to-do (its first node and inline
|
|
35
|
+
// nodes its text, the rest its blocks); img → image (700 wide at most, captioned by data-caption or a
|
|
36
|
+
// figcaption); empty download links, video, audio, iframe → embed; data-notion-equation →
|
|
37
|
+
// equation; any other element with text → text (its pictures and list items after it).
|
|
38
|
+
// Inline (richTextOf): heading text bold (as one rich text); strong / em / u / code·pre / del·strike·s
|
|
39
|
+
// → b / i / _ / c / s; the nearest a's href → a; Notion's colors → h; Notion's inline formulas →
|
|
40
|
+
// e; control and zero-width characters dropped (247438 tI); 100,000 characters at most. stripText
|
|
41
|
+
// (headings, items): "[ ] ", "[x] " and a leading "-", "*", "•" go, runs of spaces one.
|
|
42
|
+
// Left out as the page has no such block: page, user and date mentions, comments, link previews,
|
|
43
|
+
// tables of contents; video and audio are embeds; toggle headings are toggles.
|
|
44
|
+
// Besides Notion's: formulas a page drew (math.mjs); colors (feishu-lite, colors.mjs): with
|
|
45
|
+
// `colors` "nearest" (Word, Google Docs, Notion), colors in styles become the page's nearest, with
|
|
46
|
+
// "exact" (any page) only the page's own, with either the kit's doc-text-* / doc-highlight-*
|
|
47
|
+
// classes; without (null), as Notion.
|
|
48
|
+
|
|
49
|
+
/** Notion's own attributes in its HTML (826191 l). */
|
|
50
|
+
export const ATTR = {
|
|
51
|
+
highlight: "data-notion-highlight", backgroundHighlight: "data-notion-background-highlight", inlineEquation: "data-notion-inline-equation",
|
|
52
|
+
comment: "data-notion-block-comment-id", code: "data-notion-code-syntax", callout: "data-notion-callout", calloutIcon: "data-notion-callout-icon",
|
|
53
|
+
calloutBackground: "data-notion-callout-background", toc: "data-notion-toc", file: "data-notion-file", fileAlias: "data-notion-file-alias",
|
|
54
|
+
columnList: "data-notion-column-list", column: "data-notion-column-ratio", image: "data-notion-image", video: "data-notion-video", audio: "data-notion-audio",
|
|
55
|
+
equation: "data-notion-equation", linkPreview: "data-notion-link-preview", embed: "data-notion-embed", tabContainer: "data-notion-tab-container", tabPage: "data-notion-tab-page",
|
|
56
|
+
};
|
|
57
|
+
const INLINE = new Set(["a", "strong", "em", "code", "del", "s", "span", "time", "sup", "sub"]); // 760354 u
|
|
58
|
+
const REMOVED = new Set(["meta", "style", "script", "head", "title"]); // 760354 p
|
|
59
|
+
const HEADINGS = ["h1", "h2", "h3", "h4", "h5", "h6"];
|
|
60
|
+
const BULLETS = ["•", "◦", "▪"]; // 760354 M
|
|
61
|
+
const SOURCE_CODE = "sourceCode";
|
|
62
|
+
const BLANK_LINES = /^( |\t)*(\n)+( |\t)*$/;
|
|
63
|
+
const TODO_CHECKED = /^\[x\].*/;
|
|
64
|
+
const TODO_EMPTY = /^\[ \].*/;
|
|
65
|
+
const BULLET_TEXT = /^[-*•].*/; // 760354 q / j / H
|
|
66
|
+
// 247438 rD: characters pasted text loses (controls, line and paragraph separators, zero-width spaces, tags, lone surrogates).
|
|
67
|
+
const BAD_CHAR = /[\x00-\x08\x0b-\x1f\u2028\u2029\u200b\u{e0000}-\u{e007f}\ud800-\udfff]/gu;
|
|
68
|
+
const clean = (text) => text.replace(BAD_CHAR, "");
|
|
69
|
+
// 760354 K: the colors Notion knows (the page's nine).
|
|
70
|
+
const COLORS = new Set(["default", ...NOTION_COLOR_NAMES].flatMap((c) => [c, `${c}_background`]));
|
|
71
|
+
const color = (value) => (COLORS.has(value) ? value : undefined);
|
|
72
|
+
|
|
73
|
+
const tagOf = (node) => (node?.nodeType === 1 ? node.tagName.toLowerCase() : "");
|
|
74
|
+
const isElement = (node, ...tags) => node?.nodeType === 1 && (!tags.length || tags.includes(tagOf(node)));
|
|
75
|
+
const isInline = (node) => node.nodeType === 3 || INLINE.has(tagOf(node)); // 760354 C
|
|
76
|
+
const ancestors = (node) => {
|
|
77
|
+
const out = [];
|
|
78
|
+
for (let p = node.parentNode; p; p = p.parentNode) out.push(p);
|
|
79
|
+
return out;
|
|
80
|
+
};
|
|
81
|
+
const listDepth = (node) => ancestors(node).filter((a) => isElement(a, "ul", "ol")).length; // 760354 S
|
|
82
|
+
// The kit's flowchart (步骤流程图, ol.doc-flow) and its steps, as a reader's page or an exported
|
|
83
|
+
// report has them: copied from one, a flowchart again (flowchartBlock).
|
|
84
|
+
const FLOW = "doc-flow";
|
|
85
|
+
const isFlowchart = (node) => isElement(node, "ol") && node.classList.contains(FLOW);
|
|
86
|
+
const isStep = (node) => isElement(node, "li") && isFlowchart(node.parentNode);
|
|
87
|
+
const KIT_COLOR = /^doc-(text|highlight)-[a-z]+$/;
|
|
88
|
+
|
|
89
|
+
// ---------- 760354 J: normalizing ----------
|
|
90
|
+
|
|
91
|
+
function retag(element, tag) {
|
|
92
|
+
const next = element.ownerDocument.createElement(tag);
|
|
93
|
+
while (element.firstChild) next.appendChild(element.firstChild);
|
|
94
|
+
for (const a of [...element.attributes].reverse()) next.setAttribute(a.name, a.value);
|
|
95
|
+
element.parentNode?.replaceChild(next, element);
|
|
96
|
+
return next;
|
|
97
|
+
}
|
|
98
|
+
function wrapInside(element, tag) {
|
|
99
|
+
const inner = element.ownerDocument.createElement(tag);
|
|
100
|
+
while (element.firstChild) inner.appendChild(element.firstChild);
|
|
101
|
+
element.appendChild(inner);
|
|
102
|
+
}
|
|
103
|
+
function unwrap(element) {
|
|
104
|
+
const moved = [];
|
|
105
|
+
let after = element;
|
|
106
|
+
while (element.firstChild) {
|
|
107
|
+
const child = element.firstChild;
|
|
108
|
+
moved.push(child);
|
|
109
|
+
element.parentNode?.insertBefore(child, after.nextSibling);
|
|
110
|
+
after = child;
|
|
111
|
+
}
|
|
112
|
+
const parent = element.parentNode;
|
|
113
|
+
if (parent) {
|
|
114
|
+
parent.removeChild(element);
|
|
115
|
+
parent.normalize();
|
|
116
|
+
}
|
|
117
|
+
return moved;
|
|
118
|
+
}
|
|
119
|
+
// G: a container that may be unwrapped or merged.
|
|
120
|
+
function plainContainer(element) {
|
|
121
|
+
return isElement(element) && element.childNodes.length > 0 && !["blockquote", "details", "figure", "summary"].includes(tagOf(element))
|
|
122
|
+
&& ![ATTR.highlight, ATTR.columnList, ATTR.column, ATTR.callout, ATTR.equation, ATTR.tabContainer, ATTR.tabPage].some((a) => element.hasAttribute(a));
|
|
123
|
+
}
|
|
124
|
+
const BLOCK_CHILD = /^(p|div|img|ul|ol|table|hr|video|iframe|figure|details|pre|blockquote|h[1-6])$/;
|
|
125
|
+
|
|
126
|
+
function firstPass(node, queue) {
|
|
127
|
+
let el = node;
|
|
128
|
+
if (isElement(el, "google-sheets-html-origin") && el.parentNode) {
|
|
129
|
+
const kids = [...el.childNodes];
|
|
130
|
+
for (const kid of kids) el.parentNode.insertBefore(kid, el);
|
|
131
|
+
queue.unshift(...kids);
|
|
132
|
+
el.remove();
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (el.parentNode && ((el.nodeType === 3 && BLANK_LINES.test(el.data)) || REMOVED.has(tagOf(el)))) {
|
|
136
|
+
el.parentNode.removeChild(el);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (el.nodeType !== 1) return;
|
|
140
|
+
const style = el.style;
|
|
141
|
+
if (style) {
|
|
142
|
+
const size = style.fontSize || "";
|
|
143
|
+
const px = /px|pt/.test(size) ? parseInt(size, 10) : undefined;
|
|
144
|
+
const em = /em/.test(size) ? parseInt(size, 10) : undefined;
|
|
145
|
+
if (px && px >= 24) el = retag(el, "h1");
|
|
146
|
+
else if (em && em > 2) el = retag(el, "h1");
|
|
147
|
+
if (el.style.textDecoration === "line-through") wrapInside(el, "del");
|
|
148
|
+
if (el.style.fontStyle === "italic") wrapInside(el, "em");
|
|
149
|
+
// Not a step of the kit's flowchart: the kit draws a step's own words at the title's weight
|
|
150
|
+
// (the short form) and its blocks at their own, so its weight is no mark of what it holds (its
|
|
151
|
+
// title's <strong> comes as it is; flowchartBlock).
|
|
152
|
+
if ((el.style.fontWeight === "bold" || (el.style.fontWeight && parseInt(el.style.fontWeight, 10) >= 500)) && !isStep(el)) wrapInside(el, "strong");
|
|
153
|
+
}
|
|
154
|
+
if (tagOf(el) === "img") {
|
|
155
|
+
const m = /^([0-9]+)px$/i.exec(el.style?.width || "");
|
|
156
|
+
if (!el.getAttribute("width") && m) el.setAttribute("width", m[1]);
|
|
157
|
+
}
|
|
158
|
+
if (tagOf(el) === "b") el = retag(el, "strong");
|
|
159
|
+
else if (tagOf(el) === "i") el = retag(el, "em");
|
|
160
|
+
if (tagOf(el) === "strong" && el.style?.fontWeight === "normal") el = retag(el, "span");
|
|
161
|
+
if (tagOf(el) === "section" || tagOf(el) === "article") el = retag(el, "div");
|
|
162
|
+
if (tagOf(el) === "div" && el.style?.display === "inline") el = retag(el, "span");
|
|
163
|
+
if (tagOf(el) === "input" && el.getAttribute("type") === "checkbox") {
|
|
164
|
+
const span = el.ownerDocument.createElement("span");
|
|
165
|
+
span.textContent = `[${el.hasAttribute("checked") ? "x" : " "}] `;
|
|
166
|
+
el.parentNode?.insertBefore(span, el);
|
|
167
|
+
el.remove();
|
|
168
|
+
queue.push(span);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (tagOf(el) === "table" && !el.classList.contains("simple-table")) {
|
|
172
|
+
const rows = [...el.querySelectorAll("tr")].map((row) => row.querySelectorAll("td, th"));
|
|
173
|
+
if (rows.every((cells) => cells.length === 1)) {
|
|
174
|
+
const fragment = el.ownerDocument.createDocumentFragment();
|
|
175
|
+
for (const [cell] of rows) {
|
|
176
|
+
for (const child of [...cell.childNodes]) {
|
|
177
|
+
fragment.appendChild(child.cloneNode(true));
|
|
178
|
+
queue.push(child);
|
|
179
|
+
}
|
|
180
|
+
fragment.appendChild(el.ownerDocument.createElement("hr"));
|
|
181
|
+
}
|
|
182
|
+
el.parentNode?.replaceChild(fragment, el);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (isElement(el, "ul", "ol") && isElement(el.parentNode, "ul", "ol") && isElement(el.previousSibling, "li")) el.previousSibling.appendChild(el);
|
|
186
|
+
el.removeAttribute("style");
|
|
187
|
+
el.removeAttribute("dir");
|
|
188
|
+
if (tagOf(el) === "span") {
|
|
189
|
+
const className = el.getAttribute("class");
|
|
190
|
+
if (className === "page-comment" || className?.split(" ").includes("retain-span")) return;
|
|
191
|
+
const keep = [ATTR.highlight, ATTR.backgroundHighlight, "data-notion-block-discussion-id", ATTR.comment, ATTR.inlineEquation].some((a) => el.hasAttribute(a));
|
|
192
|
+
(keep ? [...el.children] : unwrap(el)).forEach((n) => queue.push(n));
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (tagOf(el) === "pre" || tagOf(el) === "code") return;
|
|
196
|
+
queue.push(...el.childNodes);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function secondPass(node, queue) {
|
|
200
|
+
for (const h of ["h1", "h2"]) {
|
|
201
|
+
if (!(plainContainer(node) && [...node.childNodes].every((child) => isElement(child, h)))) continue;
|
|
202
|
+
const merged = node.ownerDocument.createElement(h);
|
|
203
|
+
for (const child of [...node.childNodes]) for (const grand of [...child.childNodes]) merged.appendChild(grand.cloneNode(true));
|
|
204
|
+
const parent = node.parentNode;
|
|
205
|
+
if (parent) {
|
|
206
|
+
if (isElement(node, "td", "th")) {
|
|
207
|
+
const cell = node.ownerDocument.createElement(tagOf(node));
|
|
208
|
+
cell.appendChild(merged);
|
|
209
|
+
parent.insertBefore(cell, node);
|
|
210
|
+
} else parent.insertBefore(merged, node);
|
|
211
|
+
parent.removeChild(node);
|
|
212
|
+
}
|
|
213
|
+
queue.push(merged);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (isElement(node, "div", "span") && node.parentNode && node.childNodes.length === 0) {
|
|
217
|
+
node.parentNode.removeChild(node);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (plainContainer(node) && isElement(node, "p", "div", "figure") && [...node.childNodes].some((child) => child.nodeType === 1 && BLOCK_CHILD.test(tagOf(child)))) {
|
|
221
|
+
unwrap(node).forEach((n) => queue.push(n));
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (node?.childNodes) queue.push(...node.childNodes);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Colors (besides Notion's: colors.mjs) as Notion's color marks, before the first pass drops styles.
|
|
228
|
+
const KIT_TEXT = /^doc-text-(\w+)$/;
|
|
229
|
+
const KIT_BACKGROUND = /^doc-highlight-(\w+)$/;
|
|
230
|
+
function markColors(root, mode) {
|
|
231
|
+
for (const el of root.querySelectorAll("*")) {
|
|
232
|
+
let text;
|
|
233
|
+
let background;
|
|
234
|
+
for (const name of el.classList) {
|
|
235
|
+
text ??= color(KIT_TEXT.exec(name)?.[1]);
|
|
236
|
+
background ??= color(KIT_BACKGROUND.exec(name) ? `${KIT_BACKGROUND.exec(name)[1]}_background` : "");
|
|
237
|
+
}
|
|
238
|
+
if (mode) {
|
|
239
|
+
const near = { nearest: mode === "nearest" };
|
|
240
|
+
text ??= textColor(el.getAttribute("data-paste-color") ?? el.style?.color ?? "", near);
|
|
241
|
+
background ??= backgroundColor(el.getAttribute("data-paste-background") ?? (el.style?.backgroundColor || el.style?.background) ?? "", near);
|
|
242
|
+
}
|
|
243
|
+
el.removeAttribute("data-paste-color");
|
|
244
|
+
el.removeAttribute("data-paste-background");
|
|
245
|
+
if (text && !el.hasAttribute(ATTR.highlight)) el.setAttribute(ATTR.highlight, text);
|
|
246
|
+
if (background && !el.hasAttribute(ATTR.backgroundHighlight)) el.setAttribute(ATTR.backgroundHighlight, background);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function normalizeHTML(root, { inline = false, colors = null } = {}) {
|
|
251
|
+
const doc = root.ownerDocument;
|
|
252
|
+
// Slack's emoji pictures as their :name:.
|
|
253
|
+
for (const img of root.querySelectorAll("img[data-stringify-emoji]")) {
|
|
254
|
+
const raw = img.getAttribute("data-stringify-emoji") ?? "";
|
|
255
|
+
const m = /^:(.+):$/.exec(raw);
|
|
256
|
+
if (m && img.parentNode) img.parentNode.replaceChild(doc.createTextNode(raw), img);
|
|
257
|
+
}
|
|
258
|
+
// Notion's export's block-color-* classes as color marks.
|
|
259
|
+
for (const el of root.querySelectorAll(`[class*="block-color-"]:not([${ATTR.highlight}]):not(details):not(td):not(th):not([${ATTR.callout}]):not([${ATTR.tabContainer}]):not([${ATTR.tabPage}])`)) {
|
|
260
|
+
const name = [...el.classList].find((x) => x.startsWith("block-color-"));
|
|
261
|
+
if (name) el.setAttribute(ATTR.highlight, name.slice(12));
|
|
262
|
+
}
|
|
263
|
+
if (colors !== null) markColors(root, colors);
|
|
264
|
+
for (const el of root.querySelectorAll(`span[${ATTR.inlineEquation}]`)) {
|
|
265
|
+
if (el.textContent) continue;
|
|
266
|
+
const tex = el.getAttribute(ATTR.inlineEquation);
|
|
267
|
+
if (tex) el.replaceChildren(doc.createTextNode(tex));
|
|
268
|
+
}
|
|
269
|
+
root.normalize();
|
|
270
|
+
// <br> in a <p>: an element of nothing but br's gives them up first, then the paragraph splits at
|
|
271
|
+
// its first br, until it has none.
|
|
272
|
+
for (const p of root.querySelectorAll("p")) {
|
|
273
|
+
let n = p.firstChild;
|
|
274
|
+
for (let guard = 0; n && guard < 1e4; guard++) {
|
|
275
|
+
let moved = false;
|
|
276
|
+
if (n.nodeType === 1 && !n.textContent.trim()) {
|
|
277
|
+
for (const br of [...n.querySelectorAll("br")]) {
|
|
278
|
+
p.insertBefore(br, n);
|
|
279
|
+
moved = true;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const next = n.nextSibling;
|
|
283
|
+
if (moved) p.removeChild(n);
|
|
284
|
+
n = next;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
const paragraphs = [...root.querySelectorAll("p")];
|
|
288
|
+
for (let guard = 0; guard < 1e4; guard++) {
|
|
289
|
+
const p = paragraphs.shift();
|
|
290
|
+
if (!p || !p.parentNode) break;
|
|
291
|
+
const br = p.querySelector("br");
|
|
292
|
+
if (!br || br.parentElement !== p) continue;
|
|
293
|
+
const next = doc.createElement("p");
|
|
294
|
+
for (const a of [...p.attributes]) next.setAttribute(a.name, a.value);
|
|
295
|
+
p.parentNode.insertBefore(next, p.nextSibling);
|
|
296
|
+
for (let n = br.nextSibling; n;) {
|
|
297
|
+
const after = n.nextSibling;
|
|
298
|
+
next.appendChild(n);
|
|
299
|
+
n = after;
|
|
300
|
+
}
|
|
301
|
+
p.removeChild(br);
|
|
302
|
+
paragraphs.unshift(next);
|
|
303
|
+
}
|
|
304
|
+
const queue = [...root.childNodes];
|
|
305
|
+
while (queue.length) {
|
|
306
|
+
const n = queue.shift();
|
|
307
|
+
if (n) firstPass(n, queue);
|
|
308
|
+
}
|
|
309
|
+
queue.push(...root.childNodes);
|
|
310
|
+
while (queue.length) {
|
|
311
|
+
const n = queue.shift();
|
|
312
|
+
if (n) secondPass(n, queue);
|
|
313
|
+
}
|
|
314
|
+
root.normalize();
|
|
315
|
+
if (!inline) {
|
|
316
|
+
for (const n of [...root.childNodes]) {
|
|
317
|
+
if (n.nodeType !== 3) continue;
|
|
318
|
+
const p = doc.createElement("p");
|
|
319
|
+
root.insertBefore(p, n);
|
|
320
|
+
p.appendChild(n);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return root;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// ---------- 760354 x: rich text ----------
|
|
327
|
+
|
|
328
|
+
// 760354 B: a formula's text (Notion's attributes, KaTeX's annotation, $$…$$ / $…$).
|
|
329
|
+
function equationOf(el) {
|
|
330
|
+
const annotation = el.querySelector('annotation[encoding="application/x-tex"]')?.textContent?.trim();
|
|
331
|
+
const text = el.textContent?.trim() ?? "";
|
|
332
|
+
return el.getAttribute(ATTR.equation) || el.getAttribute(ATTR.inlineEquation) || annotation || /^\$\$([\s\S]+?)\$\$\s*$/.exec(text)?.[1].trim() || /^\$([\s\S]+?)\$$/.exec(text)?.[1].trim();
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function richTextOf(node, { stripText = false, stripSurroundingWhitespace = false, ignoreCodeBlock = false, preserveLineBreaks = false } = {}) {
|
|
336
|
+
const doc = node.ownerDocument;
|
|
337
|
+
if (!stripText) {
|
|
338
|
+
// Paragraphs, headings and items as lines with their bullets (the structure kept in one text).
|
|
339
|
+
for (const p of node.querySelectorAll("p:not(:first-child)")) p.prepend("\n");
|
|
340
|
+
for (const h of node.querySelectorAll(HEADINGS.map((tag) => `${tag}:not(:first-child)`).join(", "))) h.prepend("\n");
|
|
341
|
+
for (const li of node.querySelectorAll("ul > li")) {
|
|
342
|
+
const depth = listDepth(li) - 1;
|
|
343
|
+
li.prepend(`\n${" ".repeat(depth)}${BULLETS[depth % BULLETS.length]} `);
|
|
344
|
+
}
|
|
345
|
+
for (const ol of node.querySelectorAll("ol")) {
|
|
346
|
+
const indent = " ".repeat(listDepth(ol));
|
|
347
|
+
[...ol.children].forEach((li, i) => li.prepend(`\n${indent}${i + 1}. `));
|
|
348
|
+
}
|
|
349
|
+
for (const pre of node.querySelectorAll("pre")) pre.parentNode?.insertBefore(doc.createTextNode("\n\n"), pre);
|
|
350
|
+
}
|
|
351
|
+
const all = [];
|
|
352
|
+
(function walk(n) {
|
|
353
|
+
if (n.nodeType === 1 && (n.hasAttribute(ATTR.comment) || (ignoreCodeBlock && tagOf(n) === "pre"))) return;
|
|
354
|
+
all.push(n);
|
|
355
|
+
for (const child of n.childNodes) walk(child);
|
|
356
|
+
})(node);
|
|
357
|
+
const nodes = all.filter((n) => (n.nodeType !== 3 ? preserveLineBreaks && tagOf(n) === "br" : !(stripText && BLANK_LINES.test(n.data))));
|
|
358
|
+
const tokens = [];
|
|
359
|
+
const seenEquations = new Set();
|
|
360
|
+
nodes.forEach((n, i) => {
|
|
361
|
+
let text = n.nodeType === 3 ? n.data : "\n";
|
|
362
|
+
if (stripText) text = text.replace(/\[ \] /g, "").replace(/\[x\] /g, "").replace(/^[-*•]\s?/g, "").replace(/(\s)+/g, "$1");
|
|
363
|
+
if (i === 0 && stripSurroundingWhitespace && !node.hasAttribute?.("confluenceTabSpaces")) text = text.trimStart();
|
|
364
|
+
text = clean(text);
|
|
365
|
+
if (i === nodes.length - 1 && stripSurroundingWhitespace) text = text.trimEnd();
|
|
366
|
+
const up = ancestors(n).filter((a) => a.nodeType === 1);
|
|
367
|
+
const annotations = [];
|
|
368
|
+
if (!stripText && up.some((a) => HEADINGS.includes(tagOf(a)))) annotations.push(["b"]);
|
|
369
|
+
if (up.some((a) => tagOf(a) === "strong")) annotations.push(["b"]);
|
|
370
|
+
if (up.some((a) => tagOf(a) === "em")) annotations.push(["i"]);
|
|
371
|
+
if (up.some((a) => tagOf(a) === "u")) annotations.push(["_"]);
|
|
372
|
+
if (up.some((a) => tagOf(a) === "code" || tagOf(a) === "pre")) annotations.push(["c"]);
|
|
373
|
+
if (up.some((a) => ["del", "strike", "s"].includes(tagOf(a)))) annotations.push(["s"]);
|
|
374
|
+
const colors = new Set();
|
|
375
|
+
for (const a of up) {
|
|
376
|
+
const background = color(a.getAttribute(ATTR.backgroundHighlight) ?? "");
|
|
377
|
+
if (background && background.endsWith("_background")) colors.add(background);
|
|
378
|
+
const highlight = a.getAttribute(ATTR.highlight);
|
|
379
|
+
if (highlight && highlight !== "undefined" && color(highlight)) colors.add(highlight);
|
|
380
|
+
}
|
|
381
|
+
for (const c of colors) annotations.push(["h", c]);
|
|
382
|
+
const link = up.find((a) => tagOf(a) === "a");
|
|
383
|
+
if (link && link.href) {
|
|
384
|
+
let target = link.href;
|
|
385
|
+
try {
|
|
386
|
+
const m = /^#maybeCitation:<(.*)>$/.exec(decodeURIComponent(link.hash));
|
|
387
|
+
if (m) target = decodeURIComponent(m[1]);
|
|
388
|
+
} catch {
|
|
389
|
+
// not a valid encoding: the link as it is
|
|
390
|
+
}
|
|
391
|
+
annotations.push(["a", target]);
|
|
392
|
+
}
|
|
393
|
+
const equation = up.find((a) => a.hasAttribute(ATTR.inlineEquation) || a.classList.contains("notion-text-equation-token"));
|
|
394
|
+
if (equation) {
|
|
395
|
+
if (seenEquations.has(equation)) return;
|
|
396
|
+
seenEquations.add(equation);
|
|
397
|
+
const tex = equationOf(equation) ?? equation.textContent;
|
|
398
|
+
if (tex) tokens.push(["⁍", [["e", tex], ...annotations]]);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
if (text) tokens.push(annotations.length ? [text, annotations] : [text]);
|
|
402
|
+
});
|
|
403
|
+
// 247438 JG8: 100,000 characters at most.
|
|
404
|
+
let left = 1e5;
|
|
405
|
+
const cut = [];
|
|
406
|
+
for (const [t, a] of tokens) {
|
|
407
|
+
if (left <= 0) break;
|
|
408
|
+
const s = [...t].slice(0, left).join("");
|
|
409
|
+
left -= [...s].length;
|
|
410
|
+
cut.push(a ? [s, a] : [s]);
|
|
411
|
+
}
|
|
412
|
+
return normalize(cut);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// 760354 _: code's text (br a line break, a div ends one, spaces at line ends dropped).
|
|
416
|
+
function codeText(n) {
|
|
417
|
+
if (n.nodeName === "#text") return n.textContent ?? "";
|
|
418
|
+
return [...n.childNodes].map((child) => (tagOf(child) === "br" ? "\n" : tagOf(child) === "div" ? `${codeText(child)}\n` : codeText(child))).join("")
|
|
419
|
+
.split("\n").map((line) => line.trimEnd()).join("\n").trimEnd();
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// 760354 T: a language in classes (its name, or language-x).
|
|
423
|
+
function languageOf(classList) {
|
|
424
|
+
for (const name of classList ?? []) {
|
|
425
|
+
const direct = languageFromFence(name);
|
|
426
|
+
if (direct) return direct;
|
|
427
|
+
const m = /language-(\w+)/.exec(name);
|
|
428
|
+
if (m && languageFromFence(m[1])) return languageFromFence(m[1]);
|
|
429
|
+
}
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ---------- 760354 R: elements as blocks ----------
|
|
434
|
+
|
|
435
|
+
const text = (node, type, options) => {
|
|
436
|
+
const props = {};
|
|
437
|
+
const highlight = node.getAttribute(ATTR.highlight);
|
|
438
|
+
const c = highlight ? color(highlight) : undefined;
|
|
439
|
+
if (highlight) node.removeAttribute(ATTR.highlight);
|
|
440
|
+
if (c) props.block_color = c;
|
|
441
|
+
return spec(type, richTextOf(node, options), props);
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const MEDIA = () => ["img[src]", "a[download]", `a[${ATTR.file}]`, `audio[${ATTR.audio}]`, `video[${ATTR.video}]`, "li"];
|
|
445
|
+
// 760354 k / L: what in a block makes blocks of its own (pictures, downloads, Notion's files and media, items; pre when asked).
|
|
446
|
+
function extras(node, withPre = false) {
|
|
447
|
+
const selectors = MEDIA();
|
|
448
|
+
if (withPre) selectors.push("pre");
|
|
449
|
+
return blocksOf([...node.querySelectorAll(selectors.join(","))]);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Video, audio and other links: Notion knows them as video / audio / image / file by address (939438 WT); here embeds.
|
|
453
|
+
const mediaBlock = (url) => spec("embed", [], { source: url });
|
|
454
|
+
|
|
455
|
+
const heading = (tag) => ({ h1: "header", h2: "sub_header", h3: "sub_sub_header" })[tag] ?? "header_4";
|
|
456
|
+
|
|
457
|
+
function codeBlock(node) {
|
|
458
|
+
const code = node.querySelector("code");
|
|
459
|
+
const language = languageFromFence(node.getAttribute(ATTR.code)) || languageOf(code?.parentElement?.classList) || languageOf(code?.classList) || "Plain Text";
|
|
460
|
+
const props = { language, code_wrap: true };
|
|
461
|
+
const caption = node.closest("figure")?.querySelector("figcaption");
|
|
462
|
+
if (caption) {
|
|
463
|
+
const t = richTextOf(caption, { stripText: true, stripSurroundingWhitespace: true });
|
|
464
|
+
if (t.length) props.caption = t;
|
|
465
|
+
caption.parentNode?.removeChild(caption);
|
|
466
|
+
}
|
|
467
|
+
const body = codeText(node);
|
|
468
|
+
return spec("code", body ? [[clean(body)]] : [], props);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function calloutBlock(node) {
|
|
472
|
+
const props = {};
|
|
473
|
+
const background = color(node.getAttribute(ATTR.calloutBackground) ?? "");
|
|
474
|
+
if (background) props.block_color = background;
|
|
475
|
+
const icon = node.getAttribute(ATTR.calloutIcon);
|
|
476
|
+
if (icon && !/^(https?:|\/|data:|notion:\/\/custom_emoji)/.test(icon)) props.icon = icon; // 760354 z: an emoji only (Notion's icons are no set's here)
|
|
477
|
+
const kids = [...node.childNodes].filter((child) => (child.textContent ?? "").trim() !== "");
|
|
478
|
+
const [first, ...rest] = kids;
|
|
479
|
+
let title = [];
|
|
480
|
+
let children = [];
|
|
481
|
+
if (first && isElement(first, "p")) {
|
|
482
|
+
title = richTextOf(first, { stripSurroundingWhitespace: true });
|
|
483
|
+
children = blocksOf(rest);
|
|
484
|
+
} else if (first && !isInline(first)) children = blocksOf(kids);
|
|
485
|
+
else if (first) title = richTextOf(node, { stripSurroundingWhitespace: true });
|
|
486
|
+
// A new callout (callout_version 2) has no title: its text is its first block.
|
|
487
|
+
const body = title.length ? [spec("text", title), ...children] : children;
|
|
488
|
+
return spec("callout", [], props, body.length ? body : [spec("text")]);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
function quoteBlock(node) {
|
|
492
|
+
const [first, ...rest] = [...node.childNodes];
|
|
493
|
+
const title = isElement(first) ? richTextOf(first, { stripSurroundingWhitespace: true }) : first?.textContent?.trim() ? [[clean(first.textContent.trim())]] : [];
|
|
494
|
+
return spec("quote", title, {}, blocksOf(rest));
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function detailsBlock(node) {
|
|
498
|
+
const summary = node.querySelector("summary");
|
|
499
|
+
const head = summary?.querySelector(HEADINGS.join(", "));
|
|
500
|
+
const props = {};
|
|
501
|
+
const highlight = node.getAttribute(ATTR.highlight);
|
|
502
|
+
if (highlight) {
|
|
503
|
+
node.removeAttribute(ATTR.highlight);
|
|
504
|
+
if (color(highlight)) props.block_color = color(highlight);
|
|
505
|
+
}
|
|
506
|
+
const kids = blocksOf([...node.childNodes].filter((child) => child !== summary));
|
|
507
|
+
const title = head ? richTextOf(head, { stripSurroundingWhitespace: true }) : summary?.textContent ? richTextOf(summary, { stripSurroundingWhitespace: true }) : [];
|
|
508
|
+
return spec("toggle", title, props, kids);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
function tabsBlock(node) {
|
|
512
|
+
const pages = [...node.querySelectorAll(`[${ATTR.tabPage}]`)].filter((page) => page.parentElement === node).map((page) => {
|
|
513
|
+
const summary = page.querySelector("summary");
|
|
514
|
+
const title = summary ? richTextOf(summary, { stripSurroundingWhitespace: true }) : [];
|
|
515
|
+
const props = {};
|
|
516
|
+
const icon = page.getAttribute(ATTR.tabPage);
|
|
517
|
+
if (icon && !/^(https?:|data:|notion:\/\/custom_emoji)/.test(icon)) props.icon = icon;
|
|
518
|
+
return spec("text", title, props, blocksOf([...page.childNodes].filter((child) => child !== summary)));
|
|
519
|
+
});
|
|
520
|
+
return spec("tab", [], {}, pages);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const int = (value, fallback) => {
|
|
524
|
+
const n = value !== null ? parseInt(value, 10) : fallback;
|
|
525
|
+
return Number.isFinite(n) ? n : fallback;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// 760354 table: row and column spans spread into empty cells; a first row all th a header row, every
|
|
529
|
+
// row starting with a th a header column (both: the side with more th's).
|
|
530
|
+
function tableBlock(node) {
|
|
531
|
+
const rows = [...node.querySelectorAll("tr")].filter((row) => row.closest("table") === node);
|
|
532
|
+
let headerRow = false;
|
|
533
|
+
let headerColumn = false;
|
|
534
|
+
if (rows.length) {
|
|
535
|
+
const firstCells = rows[0].querySelectorAll("td, th");
|
|
536
|
+
const firstTh = rows[0].querySelectorAll("th");
|
|
537
|
+
headerRow = firstCells.length > 0 && firstTh.length === firstCells.length;
|
|
538
|
+
const startsWithTh = (row) => tagOf(row.querySelector("td, th")) === "th";
|
|
539
|
+
headerColumn = rows.every(startsWithTh);
|
|
540
|
+
if (headerRow && headerColumn && !(tagOf(rows[0].querySelector("td, th")) === "th")) {
|
|
541
|
+
if (firstTh.length >= rows.filter(startsWithTh).length) headerColumn = false;
|
|
542
|
+
else headerRow = false;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
const grid = rows.map(() => []);
|
|
546
|
+
const taken = rows.map(() => []);
|
|
547
|
+
rows.forEach((row, r) => {
|
|
548
|
+
let c = 0;
|
|
549
|
+
for (const cell of [...row.querySelectorAll("td, th")].filter((x) => x.closest("tr") === row)) {
|
|
550
|
+
while (taken[r][c]) c++;
|
|
551
|
+
const rowSpan = int(cell.getAttribute("rowspan"), 1);
|
|
552
|
+
const colSpan = int(cell.getAttribute("colspan"), 1);
|
|
553
|
+
grid[r][c] = richTextOf(cell, { stripSurroundingWhitespace: true, preserveLineBreaks: true });
|
|
554
|
+
taken[r][c] = true;
|
|
555
|
+
for (let dr = 0; dr < rowSpan && r + dr < rows.length; dr++) {
|
|
556
|
+
for (let dc = 0; dc < colSpan; dc++) {
|
|
557
|
+
if (dr === 0 && dc === 0) continue;
|
|
558
|
+
grid[r + dr][c + dc] = [];
|
|
559
|
+
taken[r + dr][c + dc] = true;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
c += colSpan;
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
const width = grid.reduce((max, row) => Math.max(max, row.length), 0);
|
|
566
|
+
const data = grid.filter((row) => row.length).map((row) => Array.from({ length: width }, (_, i) => row[i] ?? []));
|
|
567
|
+
if (!data.length || !width) return null; // a table only without a single cell
|
|
568
|
+
const columns = Array.from({ length: width }, (_, i) => `c${i}`);
|
|
569
|
+
const props = { table_block_column_order: columns, table_block_column_format: {}, table_block_column_header: headerRow, table_block_row_header: headerColumn };
|
|
570
|
+
return spec("table", [], props, data.map((row) => spec("table_row", [], { cells: Object.fromEntries(row.map((t, i) => [columns[i], t]).filter(([, t]) => t.length)) })));
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function columnsBlock(node) {
|
|
574
|
+
const columns = [...node.children].filter((child) => child.hasAttribute(ATTR.column)).slice(0, 8).map((column) => {
|
|
575
|
+
const ratio = parseFloat(column.getAttribute(ATTR.column));
|
|
576
|
+
return spec("column", [], !Number.isNaN(ratio) && ratio > 0 && ratio <= 1 ? { ratio } : {}, blocksOf([...column.children]));
|
|
577
|
+
});
|
|
578
|
+
return spec("column_list", [], {}, columns);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// 760354 list items: the first node (not a picture, video or audio) and inline nodes its text, the
|
|
582
|
+
// rest its blocks; pictures and the like in its text its blocks too.
|
|
583
|
+
function listItem(node) {
|
|
584
|
+
const doc = node.ownerDocument;
|
|
585
|
+
let itemColor;
|
|
586
|
+
const highlighted = node.closest(`[${ATTR.highlight}]`);
|
|
587
|
+
if (highlighted && (highlighted === node || highlighted === node.parentElement || highlighted === node.parentElement?.parentElement)) {
|
|
588
|
+
itemColor = color(highlighted.getAttribute(ATTR.highlight) ?? "");
|
|
589
|
+
if (itemColor) highlighted.removeAttribute(ATTR.highlight);
|
|
590
|
+
}
|
|
591
|
+
const title = doc.createElement("span");
|
|
592
|
+
const rest = [];
|
|
593
|
+
[...node.childNodes].forEach((child, i) => {
|
|
594
|
+
if ((isElement(child, "a") && child.hasAttribute("data-confluence-web-image")) || (i === 0 && isElement(child, "a") && child.hasAttribute(ATTR.file))) rest.push(child);
|
|
595
|
+
else if ((i === 0 && !isElement(child, "img", "video", "audio")) || isInline(child)) {
|
|
596
|
+
title.appendChild(child);
|
|
597
|
+
if (child.nodeType === 1) rest.push(...child.querySelectorAll(MEDIA().join(",")));
|
|
598
|
+
} else rest.push(child);
|
|
599
|
+
});
|
|
600
|
+
const children = blocksOf(rest);
|
|
601
|
+
const checked = TODO_CHECKED.test(title.textContent ?? "");
|
|
602
|
+
const todo = checked || TODO_EMPTY.test(title.textContent ?? "");
|
|
603
|
+
const type = todo ? "to_do" : isElement(node.parentNode, "ol") ? "numbered_list" : "bulleted_list";
|
|
604
|
+
const props = {};
|
|
605
|
+
if (todo) props.checked = checked;
|
|
606
|
+
if (itemColor) props.block_color = itemColor;
|
|
607
|
+
return spec(type, richTextOf(title, { stripText: true, stripSurroundingWhitespace: true }), props, children);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// Besides Notion's: the kit's flowchart, a report_flow of report_step specs (to-blocks.mjs makes them
|
|
611
|
+
// a flowchart of nodes), its direction and first number. A step's icon (an emoji: an icon of a set
|
|
612
|
+
// or a picture is the report's own) its icon; its own words before its first block (the short form,
|
|
613
|
+
// <li>收集数据<p>…</p></li>) its title, its blocks its content (a title written as the node form,
|
|
614
|
+
// <p><strong>…</strong></p>, among them, first); its color (the kit's classes) and direction its
|
|
615
|
+
// own. Never list items: an item's paragraphs would be lines of its text, its title and content one.
|
|
616
|
+
function flowchartBlock(node) {
|
|
617
|
+
const doc = node.ownerDocument;
|
|
618
|
+
const steps = [...node.children].filter((child) => isElement(child, "li")).map((li) => {
|
|
619
|
+
const icon = [...li.children].find((child) => child.classList.contains("doc-icon")) ?? null;
|
|
620
|
+
const emoji = icon && !icon.hasAttribute("data-icon") ? (icon.querySelector("img")?.getAttribute("alt") ?? icon.textContent ?? "").trim() : "";
|
|
621
|
+
const words = doc.createElement("span");
|
|
622
|
+
const rest = [];
|
|
623
|
+
for (const child of [...li.childNodes]) {
|
|
624
|
+
if (child === icon) continue;
|
|
625
|
+
if (rest.length === 0 && isInline(child)) words.appendChild(child);
|
|
626
|
+
else rest.push(child);
|
|
627
|
+
}
|
|
628
|
+
const colors = [...li.classList].filter((name) => KIT_COLOR.test(name));
|
|
629
|
+
// Its color is the node's, not a mark of its words (markColors read it off its class and style).
|
|
630
|
+
li.removeAttribute(ATTR.highlight);
|
|
631
|
+
li.removeAttribute(ATTR.backgroundHighlight);
|
|
632
|
+
const direction = li.getAttribute("data-direction");
|
|
633
|
+
const props = { ...(emoji ? { icon: emoji } : {}), ...(colors.length ? { colors } : {}), ...(direction ? { direction } : {}) };
|
|
634
|
+
return spec("report_step", richTextOf(words, { stripText: true, stripSurroundingWhitespace: true }), props, blocksOf(rest));
|
|
635
|
+
});
|
|
636
|
+
const direction = node.getAttribute("data-direction");
|
|
637
|
+
const start = node.getAttribute("start");
|
|
638
|
+
return spec("report_flow", [], { ...(direction ? { direction } : {}), ...(start ? { start } : {}) }, steps);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
function imageBlock(node) {
|
|
642
|
+
const props = { source: node.getAttribute("src") };
|
|
643
|
+
const width = node.width || int(node.getAttribute("width"), 0);
|
|
644
|
+
if (width) props.block_width = Math.min(width, 700);
|
|
645
|
+
const figcaption = node.closest("figure")?.querySelector("figcaption");
|
|
646
|
+
const dataCaption = node.getAttribute("data-caption");
|
|
647
|
+
if (dataCaption) props.caption = [[clean(dataCaption)]];
|
|
648
|
+
else if (figcaption) {
|
|
649
|
+
const t = richTextOf(figcaption, { stripText: true, stripSurroundingWhitespace: true });
|
|
650
|
+
if (t.length) props.caption = t;
|
|
651
|
+
figcaption.parentNode?.removeChild(figcaption);
|
|
652
|
+
}
|
|
653
|
+
return spec("image", [], props);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function fileBlock(node) {
|
|
657
|
+
const source = node.getAttribute(ATTR.file) ?? "";
|
|
658
|
+
let name = node.getAttribute(ATTR.fileAlias) ?? "";
|
|
659
|
+
if (!name && source.lastIndexOf("/") >= 0) name = source.slice(source.lastIndexOf("/") + 1);
|
|
660
|
+
return spec("file", name ? [[name]] : [], { source, ...(name ? { title: name } : {}) });
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function blockOf(node) {
|
|
664
|
+
if (!isElement(node)) return [];
|
|
665
|
+
const tag = tagOf(node);
|
|
666
|
+
if (tag === "div" && node.getAttribute("class") === "page-comments") return [];
|
|
667
|
+
if (tag === "hr") return [spec("divider")];
|
|
668
|
+
if (tag[0] === "h") return [text(node, heading(tag), { stripText: true, stripSurroundingWhitespace: true }), ...extras(node)];
|
|
669
|
+
if (tag === "pre" || tag === "code" || (tag === "div" && node.className === SOURCE_CODE) || node.hasAttribute(ATTR.code)) return [codeBlock(node), ...extras(node)];
|
|
670
|
+
if (node.hasAttribute(ATTR.callout)) return [calloutBlock(node)];
|
|
671
|
+
if (tag === "blockquote") return [quoteBlock(node)];
|
|
672
|
+
if (tag === "details") return [detailsBlock(node)];
|
|
673
|
+
if (node.hasAttribute(ATTR.tabContainer)) return [tabsBlock(node)];
|
|
674
|
+
if (tag === "table") {
|
|
675
|
+
const table = tableBlock(node);
|
|
676
|
+
return table ? [table] : [];
|
|
677
|
+
}
|
|
678
|
+
if (tag === "div" && node.hasAttribute(ATTR.columnList)) return [columnsBlock(node)];
|
|
679
|
+
if (tag === "nav" && node.hasAttribute(ATTR.toc)) return extras(node); // a table of contents: no such block
|
|
680
|
+
if (isFlowchart(node)) return [flowchartBlock(node)];
|
|
681
|
+
if (tag === "ul" || tag === "ol") return blocksOf([...node.children]);
|
|
682
|
+
if (tag === "div" && node.hasAttribute(ATTR.highlight) && node.children.length === 1 && isElement(node.children[0], "ul", "ol")) return blockOf(node.children[0]);
|
|
683
|
+
const content = node.textContent ?? "";
|
|
684
|
+
if (tag === "li" || TODO_CHECKED.test(content) || TODO_EMPTY.test(content) || BULLET_TEXT.test(content)) return [listItem(node)];
|
|
685
|
+
if (tag === "img") return node.getAttribute("src") ? [imageBlock(node)] : [];
|
|
686
|
+
if (tag === "a" && node.getAttribute(ATTR.linkPreview)) return [];
|
|
687
|
+
if (tag === "a" && node.getAttribute(ATTR.embed)) {
|
|
688
|
+
const href = node.getAttribute("href");
|
|
689
|
+
return href ? [mediaBlock(href)] : [];
|
|
690
|
+
}
|
|
691
|
+
if (tag === "a" && node.getAttribute(ATTR.file)) return [fileBlock(node)];
|
|
692
|
+
if (tag === "a" && node.childNodes.length === 0 && node.hasAttribute("download") && node.getAttribute("href")) return [mediaBlock(node.getAttribute("href"))];
|
|
693
|
+
if (tag === "video" || tag === "audio") {
|
|
694
|
+
const source = node.querySelector("source")?.getAttribute("src");
|
|
695
|
+
if (source) return [mediaBlock(source)];
|
|
696
|
+
}
|
|
697
|
+
if (tag === "iframe") {
|
|
698
|
+
const source = node.getAttribute("src");
|
|
699
|
+
if (source) {
|
|
700
|
+
const height = int(node.getAttribute("height"), 0);
|
|
701
|
+
const width = int(node.getAttribute("width"), 0);
|
|
702
|
+
return [spec("embed", [], { source, ...(width ? { block_width: width } : {}), ...(height ? { block_height: height } : {}), block_page_width: !(width || height), block_preserve_scale: true })];
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (tag === "p" && node.getAttribute("confluenceNewLine")) return [text(node, "text", { stripText: true, stripSurroundingWhitespace: true })];
|
|
706
|
+
if (node.hasAttribute(ATTR.equation)) {
|
|
707
|
+
const tex = equationOf(node) ?? codeText(node);
|
|
708
|
+
return [spec("equation", tex ? [[tex]] : [])];
|
|
709
|
+
}
|
|
710
|
+
if (tag === "figure" && node.hasAttribute(ATTR.image)) {
|
|
711
|
+
const img = node.querySelector("img");
|
|
712
|
+
if (img) return blockOf(img);
|
|
713
|
+
}
|
|
714
|
+
return [...(/^\s*$/.test(content) ? [] : [text(node, "text", { stripSurroundingWhitespace: true })]), ...extras(node)];
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
const blocksOf = (nodes) => nodes.flatMap(blockOf);
|
|
718
|
+
|
|
719
|
+
// ---------- entry points ----------
|
|
720
|
+
|
|
721
|
+
/** 760354 U: the HTML's blocks. */
|
|
722
|
+
export function htmlToBlocks(root, options = {}) {
|
|
723
|
+
normalizeHTML(root, { ...options, inline: false });
|
|
724
|
+
return blocksOf([...root.children]);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/** 760354 Q: the HTML as one rich text. */
|
|
728
|
+
export function htmlToRichText(root, { stripText = false, stripSurroundingWhitespace = false, ...options } = {}) {
|
|
729
|
+
normalizeHTML(root, { ...options, inline: true });
|
|
730
|
+
return richTextOf(root, { stripText, stripSurroundingWhitespace });
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
const PLAIN_TAGS = new Set(["span", "div", "p"]);
|
|
734
|
+
/** 760354 X: whether the HTML has any element but span / div / p, or code, columns, colors, formulas. */
|
|
735
|
+
export function containsRichFormatting(root, options = {}) {
|
|
736
|
+
normalizeHTML(root, { ...options, inline: false });
|
|
737
|
+
return (function rich(el) {
|
|
738
|
+
const tag = tagOf(el);
|
|
739
|
+
if (!PLAIN_TAGS.has(tag) || (tag === "div" && (el.className === SOURCE_CODE || el.hasAttribute(ATTR.columnList))) || el.hasAttribute(ATTR.highlight) || el.hasAttribute(ATTR.backgroundHighlight)) return true;
|
|
740
|
+
if (el.hasAttribute(ATTR.equation) || el.hasAttribute(ATTR.inlineEquation)) return true; // besides Notion's: a formula takes the HTML
|
|
741
|
+
return [...el.childNodes].some((child) => child.nodeType === 1 && rich(child));
|
|
742
|
+
})(root);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// 860313 ej: Notion cleans the HTML with DOMPurify (its defaults) before it puts it in a div. As
|
|
746
|
+
// measured: only the body's content; iframe / noscript / script and the like go with their content;
|
|
747
|
+
// embed / object / link / meta / custom elements (google-sheets-html-origin…) go, their content
|
|
748
|
+
// stays; on* attributes go; href / src that are no safe address (javascript: …) go (data: only for
|
|
749
|
+
// pictures, audio and video).
|
|
750
|
+
const DROP = "script, iframe, noscript, noembed, noframes, plaintext, xmp, frame, frameset";
|
|
751
|
+
const UNWRAP = new Set(["embed", "object", "link", "meta", "base", "param", "applet"]);
|
|
752
|
+
const SAFE_URI = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i; // DOMPurify IS_ALLOWED_URI
|
|
753
|
+
const DATA_URI_TAGS = new Set(["img", "audio", "video", "source", "track"]);
|
|
754
|
+
function sanitize(root) {
|
|
755
|
+
for (const el of root.querySelectorAll(DROP)) el.remove();
|
|
756
|
+
for (const el of [...root.querySelectorAll("*")]) {
|
|
757
|
+
const tag = tagOf(el);
|
|
758
|
+
if (UNWRAP.has(tag) || tag.includes("-")) {
|
|
759
|
+
el.replaceWith(...el.childNodes);
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
for (const a of [...el.attributes]) {
|
|
763
|
+
const name = a.name.toLowerCase();
|
|
764
|
+
if (name.startsWith("on")) el.removeAttribute(a.name);
|
|
765
|
+
else if (["href", "src", "xlink:href", "action", "formaction"].includes(name)) {
|
|
766
|
+
const value = a.value.replace(/[\x00-\x20\s]/g, "");
|
|
767
|
+
if (!SAFE_URI.test(value) && !(/^data:/i.test(value) && DATA_URI_TAGS.has(tag) && name === "src")) el.removeAttribute(a.name);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* The clipboard's HTML in a document of its own (scripts do not run, pictures do not load), cleaned,
|
|
775
|
+
* moved into a div, which is returned. Relative links resolve against `base` (the page's address, as
|
|
776
|
+
* in Notion's div on its page). A new copy each call (normalizing changes it).
|
|
777
|
+
*/
|
|
778
|
+
export function parseClipboardHTML(html, { base = globalThis.location?.href } = {}) {
|
|
779
|
+
const doc = new globalThis.DOMParser().parseFromString(html, "text/html");
|
|
780
|
+
if (base) {
|
|
781
|
+
const element = doc.createElement("base");
|
|
782
|
+
element.href = base;
|
|
783
|
+
doc.head.prepend(element);
|
|
784
|
+
}
|
|
785
|
+
newDomNames(doc.body); // a page of the kit's old names (report-*, data-report-*: shared/old-names.mjs) read as its new ones
|
|
786
|
+
convertRenderedMath(doc.body); // before cleaning: MathJax 2's TeX is in scripts
|
|
787
|
+
sanitize(doc.body);
|
|
788
|
+
const div = doc.createElement("div");
|
|
789
|
+
div.append(...doc.body.childNodes);
|
|
790
|
+
doc.body.append(div);
|
|
791
|
+
return div;
|
|
792
|
+
}
|