@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,286 @@
|
|
|
1
|
+
import { Z } from "../../../shared/layers.mjs";
|
|
2
|
+
import { emojiSvgDataUrl, loadEmojiData, randomEmoji } from "../../../shared/emoji/data.mjs";
|
|
3
|
+
import { FACE_ICON } from "../icons.mjs";
|
|
4
|
+
import { glyphSVGOf, loadGlyphs } from "../../../shared/emoji/glyphs.mjs";
|
|
5
|
+
import { keptByComponent } from "../../page/page-objects.mjs";
|
|
6
|
+
import { addStyle, element, mount } from "../../page/ui.mjs";
|
|
7
|
+
import { HIGHLIGHT } from "../kit.mjs";
|
|
8
|
+
import { ICON, iconElement, iconKind, iconValueOf } from "./index.mjs";
|
|
9
|
+
import { isStep } from "../flowchart/index.mjs";
|
|
10
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
11
|
+
|
|
12
|
+
// Icons on the page (index.mjs): the page's, and a highlight block's (Notion's callout icon), as
|
|
13
|
+
// Notion's. The page's:
|
|
14
|
+
// - with the pointer in the header and no icon, 添加图标 shows above the title, left-aligned with
|
|
15
|
+
// its text (28 high, 8 each side, 6 round, 14px, the third text color, a filled face 6 before
|
|
16
|
+
// it; fading in): a click puts a random emoji there (an activity, an object or a place);
|
|
17
|
+
// - a click on the icon opens the icon picker below it (notion-lite's, page/emoji-picker/): an
|
|
18
|
+
// emoji, an icon of the 图标 tab (MingCute's or Tabler's) in a color, or an image (上传, kept in the report's folder by the server;
|
|
19
|
+
// a custom emoji of the library copied there first) takes its place, 移除 takes it away, 随机
|
|
20
|
+
// shows another and leaves the picker open; a second click closes it. Each is one undo step
|
|
21
|
+
// (struct), and the server writes it into the file and report.json (its commit).
|
|
22
|
+
// A highlight block's: first in it, left of its blocks (the kit's highlight.css); a click on it opens
|
|
23
|
+
// the same picker (移除 takes it away), and the block menu adds or changes it (rowBeside). A new
|
|
24
|
+
// highlight block comes with 💡 (convert.mjs, iconElement). A flowchart node's, exactly so: first in
|
|
25
|
+
// it, drawn in its number's place (the kit's flowchart.css); a click on it, or on the number of a
|
|
26
|
+
// node that has none, opens the picker below it (移除 brings the number back), and the node's block
|
|
27
|
+
// menu adds or changes it. An icon of Tabler's numbers is an icon like any other: its number fixed,
|
|
28
|
+
// counted by nothing.
|
|
29
|
+
// Shown as a picture of its kind, as the server serves it (render/emoji.mjs): an emoji's Twemoji
|
|
30
|
+
// image, an icon's SVG (the kit colors it), the image where the server serves it. Its value
|
|
31
|
+
// stays the element's own (data-ge-icon), which a commit writes.
|
|
32
|
+
|
|
33
|
+
// A flowchart's node (its icon first in it, in its number's place).
|
|
34
|
+
const STEP = "ol.doc-flow > li";
|
|
35
|
+
|
|
36
|
+
const STYLE = `
|
|
37
|
+
[data-ge-editing] main :is(.doc-header, ${HIGHLIGHT.match}, ${STEP}) > .${ICON} { border-radius: 6px; cursor: pointer; transition: background .1s ease-in; }
|
|
38
|
+
[data-ge-editing] main :is(.doc-header, ${HIGHLIGHT.match}, ${STEP}) > .${ICON}:hover { background: light-dark(rgb(55 53 47 / 8%), rgb(255 255 255 / 8%)); }
|
|
39
|
+
[data-ge-editing] main ${STEP}:not(:has(> .${ICON}))::before { cursor: pointer; }
|
|
40
|
+
/* The node itself while the pointer is on its number (numberAt: the tint below), as the icon's: what
|
|
41
|
+
finds the element under the pointer finds the node, not its ::before, and reads its cursor. */
|
|
42
|
+
[data-ge-editing] main ${STEP}[data-ge-number-hover]:not(:has(> .${ICON})) { cursor: pointer; }
|
|
43
|
+
[data-ge-editing] main ${STEP}[data-ge-number-hover]:not(:has(> .${ICON}))::before { box-shadow: inset 0 0 0 20px light-dark(rgb(55 53 47 / 8%), rgb(255 255 255 / 8%)); }
|
|
44
|
+
.ge-add-icon { position: fixed; left: 0; top: 0; z-index: ${Z.affordance}; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border-radius: 6px;
|
|
45
|
+
color: var(--ge-tx3); font: 14px/1 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
46
|
+
white-space: nowrap; cursor: pointer; user-select: none; opacity: 0; transition: opacity .1s ease-in, background .1s ease-in; }
|
|
47
|
+
.ge-add-icon svg { display: block; flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
|
|
48
|
+
.ge-add-icon[data-shown] { opacity: 1; }
|
|
49
|
+
.ge-add-icon:hover { background: light-dark(rgb(55 53 47 / 6%), rgb(255 255 255 / 6%)); }
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
// What holds an icon: the page's header, a highlight block (the opening summary is one), a flowchart's node.
|
|
53
|
+
const HOLDERS = `main :is(.doc-header, ${HIGHLIGHT.match}, ${STEP})`;
|
|
54
|
+
const SELECTOR = `${HOLDERS} > .${ICON}`;
|
|
55
|
+
// A block an icon leads (first in it): a highlight block, a flowchart's node; not the header (the page's icon).
|
|
56
|
+
const isPanel = (holder) => holder.matches(HIGHLIGHT.match) || isStep(holder);
|
|
57
|
+
|
|
58
|
+
// A node's number (no icon of its own), where the kit draws it (the step's ::before, in its card's
|
|
59
|
+
// padding on its first line: flowchart.css), as a rect of the window, or null.
|
|
60
|
+
function numberRect(step) {
|
|
61
|
+
if (!isStep(step) || iconIn(step) || !step.parentElement?.hasAttribute("data-ge-box")) return null;
|
|
62
|
+
const before = getComputedStyle(step, "::before");
|
|
63
|
+
if (before.content === "none" || before.position !== "absolute") return null;
|
|
64
|
+
const box = step.getBoundingClientRect();
|
|
65
|
+
const style = getComputedStyle(step);
|
|
66
|
+
const inner = box.left + parseFloat(style.borderLeftWidth);
|
|
67
|
+
const width = parseFloat(before.width) || 20;
|
|
68
|
+
const right = box.right - parseFloat(style.borderRightWidth) - parseFloat(before.right);
|
|
69
|
+
const top = box.top + parseFloat(style.borderTopWidth) + parseFloat(before.top);
|
|
70
|
+
const height = parseFloat(before.height) || 20;
|
|
71
|
+
return right > inner ? { left: right - width, right, top, bottom: top + height, width, height } : null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// The node whose number is under a point (2px to spare), or null.
|
|
75
|
+
function numberAt(target, x, y) {
|
|
76
|
+
const step = keptByComponent(target) ? null : target?.closest?.(`main ${STEP}`);
|
|
77
|
+
const rect = step && numberRect(step);
|
|
78
|
+
return rect && x >= rect.left - 2 && x <= rect.right + 2 && y >= rect.top - 2 && y <= rect.bottom + 2 ? { step, rect } : null;
|
|
79
|
+
}
|
|
80
|
+
const iconIn = (holder) => holder?.querySelector(`:scope > .${ICON}`) ?? null;
|
|
81
|
+
const iconOf = () => document.querySelector(`main .doc-header > .${ICON}`); // the page's
|
|
82
|
+
const titleOf = () => document.querySelector("main .doc-header > h1");
|
|
83
|
+
|
|
84
|
+
/** The value an icon element stands for. */
|
|
85
|
+
const valueOf = (node) => node.getAttribute("data-ge-icon") ?? iconValueOf(node.outerHTML);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The picture of an icon's value, ready to show: an image decoded already (assetUrl: where the
|
|
89
|
+
* server serves a report's image), so it never shows empty for a moment. Null when there is none
|
|
90
|
+
* (an emoji the pack lacks stays its text).
|
|
91
|
+
*/
|
|
92
|
+
async function picture(value, assetUrl) {
|
|
93
|
+
const kind = iconKind(value);
|
|
94
|
+
let shown = null;
|
|
95
|
+
if (kind === "emoji") {
|
|
96
|
+
await loadEmojiData();
|
|
97
|
+
const url = await emojiSvgDataUrl(value).catch(() => null);
|
|
98
|
+
if (url) shown = element("img", { alt: value, src: url, draggable: "false" });
|
|
99
|
+
} else if (kind === "glyph") {
|
|
100
|
+
await loadGlyphs().catch(() => null);
|
|
101
|
+
const svg = glyphSVGOf(value);
|
|
102
|
+
if (svg) {
|
|
103
|
+
const holder = document.createElement("template");
|
|
104
|
+
holder.innerHTML = svg.replace("<svg ", '<svg aria-hidden="true" ');
|
|
105
|
+
shown = holder.content.firstElementChild;
|
|
106
|
+
}
|
|
107
|
+
} else if (kind === "image") shown = element("img", { src: assetUrl(value), alt: "", draggable: "false" });
|
|
108
|
+
if (shown instanceof HTMLImageElement) await shown.decode().catch(() => {});
|
|
109
|
+
return shown;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Show an icon element as the picture of its value. Its value is kept first (data-ge-icon): the picture says it no more. */
|
|
113
|
+
async function show(node, assetUrl) {
|
|
114
|
+
const value = valueOf(node);
|
|
115
|
+
if (!iconKind(value)) return;
|
|
116
|
+
node.setAttribute("data-ge-icon", value);
|
|
117
|
+
const shown = await picture(value, assetUrl);
|
|
118
|
+
if (shown && node.isConnected && valueOf(node) === value) node.replaceChildren(shown);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* struct(parents, touched, mutate): the editor's undoable structural change. say: the status line.
|
|
123
|
+
* isEditing(): whether the page edits. openMediaPicker({ origin, value, onPick }) (emoji-picker/).
|
|
124
|
+
* assetUrl(path): where the server serves an image of the report's folder (assets/<file>).
|
|
125
|
+
* importEmoji(id): a custom emoji of the library copied into the report's folder: its path there.
|
|
126
|
+
*/
|
|
127
|
+
export function create({ struct, say, isEditing, openMediaPicker, assetUrl, importEmoji }) {
|
|
128
|
+
addStyle(STYLE);
|
|
129
|
+
// The page's icons as they come in without their picture (an Agent's write taken in, undo).
|
|
130
|
+
const showAll = () => document.querySelectorAll(SELECTOR).forEach((node) => {
|
|
131
|
+
if (!node.querySelector("img, svg")) show(node, assetUrl);
|
|
132
|
+
});
|
|
133
|
+
showAll();
|
|
134
|
+
new MutationObserver(showAll).observe(document.querySelector("main") ?? document.body, { childList: true, subtree: true });
|
|
135
|
+
|
|
136
|
+
// The icon made on the page, its picture in it already (the server writes it before the title
|
|
137
|
+
// wherever the page puts it).
|
|
138
|
+
const made = async (value) => {
|
|
139
|
+
const node = iconElement(document, value);
|
|
140
|
+
node.replaceChildren((await picture(value, assetUrl)) ?? value);
|
|
141
|
+
return node;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// One undo step: the header or a highlight block (`holder`, the header by default) with the icon
|
|
145
|
+
// `value` (null: none), the page's right before the title, a highlight block's first in it. The
|
|
146
|
+
// old icon stays until the new one's picture is ready, and they change places at once: nothing
|
|
147
|
+
// below moves meanwhile. The last of several picks in a row wins (随机 clicked again).
|
|
148
|
+
let latest = 0;
|
|
149
|
+
async function setIcon(value, verb, holder = document.querySelector("main .doc-header")) {
|
|
150
|
+
const ticket = ++latest;
|
|
151
|
+
const now = iconIn(holder);
|
|
152
|
+
if (now && value && valueOf(now) === value) return false;
|
|
153
|
+
const node = value ? await made(value) : null;
|
|
154
|
+
const title = isPanel(holder) ? null : titleOf();
|
|
155
|
+
if (ticket !== latest || !holder?.isConnected || (!isPanel(holder) && !title)) return false;
|
|
156
|
+
const old = iconIn(holder);
|
|
157
|
+
if (old && value && valueOf(old) === value) return false;
|
|
158
|
+
const result = struct([holder], [], () => {
|
|
159
|
+
old?.remove();
|
|
160
|
+
if (node) title ? title.before(node) : holder.prepend(node);
|
|
161
|
+
return { touched: [], focus: null };
|
|
162
|
+
});
|
|
163
|
+
if (result) say(t("{0} · Ctrl+Z 撤销", verb));
|
|
164
|
+
hideAdd();
|
|
165
|
+
return Boolean(result);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// What the picker gives, as a page's icon: a custom emoji copied into the report's folder first;
|
|
169
|
+
// an image anywhere else (a link the server could not download) is none.
|
|
170
|
+
async function pick(value, holder) {
|
|
171
|
+
const what = isPanel(holder) ? t("图标") : t("页面图标");
|
|
172
|
+
if (value === null) return setIcon(null, t("已移除{0}", what), holder);
|
|
173
|
+
const custom = /^notion:\/\/custom_emoji\/[^/]+\/([^/]+)$/.exec(value)?.[1];
|
|
174
|
+
if (custom) {
|
|
175
|
+
try {
|
|
176
|
+
value = await importEmoji(custom);
|
|
177
|
+
} catch (error) {
|
|
178
|
+
return say(error.message || t("无法使用这个自定义表情"));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (!iconKind(value)) return say(t("这张图片没能存进文档"));
|
|
182
|
+
return setIcon(value, t("已更换{0}", what), holder);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ---------- 添加图标 ----------
|
|
186
|
+
|
|
187
|
+
const add = element("div", { class: "ge-add-icon", role: "button", tabindex: "0", html: t("{0}添加图标", FACE_ICON) });
|
|
188
|
+
add.addEventListener("mousedown", (event) => event.preventDefault());
|
|
189
|
+
add.addEventListener("click", async () => {
|
|
190
|
+
await loadEmojiData();
|
|
191
|
+
setIcon(randomEmoji(), t("已添加页面图标"));
|
|
192
|
+
});
|
|
193
|
+
let shown = false;
|
|
194
|
+
function showAdd() {
|
|
195
|
+
const title = titleOf();
|
|
196
|
+
const header = title?.parentElement;
|
|
197
|
+
if (!title || !header) return hideAdd();
|
|
198
|
+
if (!add.isConnected) mount(add);
|
|
199
|
+
const first = header.firstElementChild.getBoundingClientRect();
|
|
200
|
+
const range = document.createRange();
|
|
201
|
+
range.selectNodeContents(title);
|
|
202
|
+
const text = range.getClientRects()[0] ?? title.getBoundingClientRect();
|
|
203
|
+
add.style.transform = `translate(${Math.round(text.left - 8)}px, ${Math.round(first.top - 28 - 6)}px)`;
|
|
204
|
+
if (!shown) requestAnimationFrame(() => add.setAttribute("data-shown", ""));
|
|
205
|
+
shown = true;
|
|
206
|
+
}
|
|
207
|
+
function hideAdd() {
|
|
208
|
+
shown = false;
|
|
209
|
+
add.removeAttribute("data-shown");
|
|
210
|
+
}
|
|
211
|
+
// With the pointer in the header (or on the control itself), editing, and no icon yet.
|
|
212
|
+
document.addEventListener("mousemove", (event) => {
|
|
213
|
+
const header = titleOf()?.parentElement;
|
|
214
|
+
if (!isEditing() || !header || iconOf() || event.buttons) return hideAdd();
|
|
215
|
+
if (add.contains(event.target)) return;
|
|
216
|
+
const box = header.getBoundingClientRect();
|
|
217
|
+
const near = event.clientY >= box.top - 40 && event.clientY <= box.bottom && event.clientX >= box.left - 40 && event.clientX <= box.right;
|
|
218
|
+
if (near) showAdd();
|
|
219
|
+
else hideAdd();
|
|
220
|
+
}, { passive: true, capture: true });
|
|
221
|
+
addEventListener("scroll", () => { if (shown) showAdd(); }, { passive: true, capture: true });
|
|
222
|
+
|
|
223
|
+
// ---------- the picker ----------
|
|
224
|
+
|
|
225
|
+
let picker = null; // its popup
|
|
226
|
+
let wasOpen = false; // when the press began: a click on the icon then closes it (the press did)
|
|
227
|
+
addEventListener("mousedown", (event) => {
|
|
228
|
+
wasOpen = Boolean(picker && !picker.closed && (event.target.closest?.(SELECTOR) || numberAt(event.target, event.clientX, event.clientY)));
|
|
229
|
+
}, true);
|
|
230
|
+
// A press on a node's number moves no caret and starts no box selection: its click opens the picker.
|
|
231
|
+
document.addEventListener("pointerdown", (event) => {
|
|
232
|
+
if (!isEditing() || event.button !== 0 || !numberAt(event.target, event.clientX, event.clientY)) return;
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
event.stopImmediatePropagation();
|
|
235
|
+
}, true);
|
|
236
|
+
let hovered = null; // the node whose number the pointer is on (its tint)
|
|
237
|
+
document.addEventListener("mousemove", (event) => {
|
|
238
|
+
const step = isEditing() && !event.buttons ? numberAt(event.target, event.clientX, event.clientY)?.step ?? null : null;
|
|
239
|
+
if (step === hovered) return;
|
|
240
|
+
hovered?.removeAttribute("data-ge-number-hover");
|
|
241
|
+
hovered = step;
|
|
242
|
+
step?.setAttribute("data-ge-number-hover", "");
|
|
243
|
+
}, { passive: true, capture: true });
|
|
244
|
+
document.addEventListener("click", (event) => {
|
|
245
|
+
if (!isEditing() || keptByComponent(event.target)) return;
|
|
246
|
+
const node = event.target.closest?.(SELECTOR);
|
|
247
|
+
const number = node ? null : numberAt(event.target, event.clientX, event.clientY);
|
|
248
|
+
if (!node && !number) return;
|
|
249
|
+
event.preventDefault();
|
|
250
|
+
if (wasOpen || (picker && !picker.closed)) {
|
|
251
|
+
picker?.close();
|
|
252
|
+
picker = null;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (node) open(node.parentElement, node.getBoundingClientRect());
|
|
256
|
+
else open(number.step, number.rect);
|
|
257
|
+
}, true);
|
|
258
|
+
|
|
259
|
+
// The picker for a holder's icon, below `origin`.
|
|
260
|
+
function open(holder, origin) {
|
|
261
|
+
const own = iconIn(holder);
|
|
262
|
+
picker = openMediaPicker({ origin, value: own ? valueOf(own) : null, isCallout: isPanel(holder), onPick: (value) => { pick(value, holder); } });
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
/** The editor's UI nodes to keep in the top layer. */
|
|
267
|
+
get nodes() { return [add]; },
|
|
268
|
+
/** The page's icon as the page shows it, its value (the tab's, the workbench's), or null. */
|
|
269
|
+
pageIcon() {
|
|
270
|
+
const icon = document.querySelector(`main .doc-header > .${ICON}`);
|
|
271
|
+
return icon ? icon.getAttribute("data-ge-icon") ?? iconValueOf(icon.outerHTML) : null;
|
|
272
|
+
},
|
|
273
|
+
/** The block menu's row for a highlight block's or a flowchart node's icon (添加图标 or 更换图标), or null for another block. */
|
|
274
|
+
rowBeside(target) {
|
|
275
|
+
if (!target?.matches?.(HIGHLIGHT.match) && !(isStep(target) && target.parentElement?.hasAttribute("data-ge-box"))) return null;
|
|
276
|
+
const own = iconIn(target);
|
|
277
|
+
return {
|
|
278
|
+
label: own ? t("更换图标") : t("添加图标"), icon: FACE_ICON,
|
|
279
|
+
run: () => {
|
|
280
|
+
const box = (own ?? target).getBoundingClientRect();
|
|
281
|
+
open(target, own ? box : numberRect(target) ?? { left: box.left + 12, right: box.left + 36, top: box.top + 12, bottom: box.top + 36, width: 24, height: 24 });
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The editor's icons as markup: 20×20 line drawings (the menus' CSS draws them, menu.mjs and
|
|
2
|
+
// type-grid.mjs), the block types' drawn after Notion's (thin lines, a serif T, a light H with its
|
|
3
|
+
// level small beside it), not taken from it. Pure strings, so components can name their icons in
|
|
4
|
+
// their descriptions, which the server loads too.
|
|
5
|
+
|
|
6
|
+
/** A line drawing in a box of `box` units. */
|
|
7
|
+
export const svg = (body, box = 20) => `<svg viewBox="0 0 ${box} ${box}" aria-hidden="true">${body}</svg>`;
|
|
8
|
+
|
|
9
|
+
// The level beside a heading's H, small and on its baseline.
|
|
10
|
+
const LEVELS = {
|
|
11
|
+
1: '<path d="M13.25 10.6 15.1 9.25v6"/>',
|
|
12
|
+
2: '<path d="M12.85 10.7a1.85 1.85 0 0 1 3.6.5c0 1.1-.85 1.8-3.65 4.05h3.85"/>',
|
|
13
|
+
3: '<path d="M12.9 9.75h3.35l-1.85 2.1a1.7 1.7 0 1 1-1.55 2.55"/>',
|
|
14
|
+
4: '<path d="M15.6 15.25V9.6l-3.1 4.15h4.2"/>',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** A formula (√x): the format bar's button and the "/" menu's 公式, one drawing. */
|
|
18
|
+
export const FORMULA_ICON = svg('<path d="M1.6 11.6 5.5 16.25 9.5 3.75h8.75"/><path d="m10.6 7.9 6.6 8.35M17.2 7.9l-6.6 8.35"/>');
|
|
19
|
+
|
|
20
|
+
/** A link (two rings of a chain): the "/" menu's 链接, 链接视图, an empty link's chip, one drawing. */
|
|
21
|
+
/** A page (the workbench's tree draws the same): the "/" menu's 页面, a page block left empty, a page with no icon in a search's rows. */
|
|
22
|
+
export const PAGE_ICON = svg('<path d="M5.75 2.75h5.5l3.5 3.5v9.5a1.5 1.5 0 0 1-1.5 1.5h-7.5a1.5 1.5 0 0 1-1.5-1.5V4.25a1.5 1.5 0 0 1 1.5-1.5z"/><path d="M11 2.75v3c0 .41.34.75.75.75h3"/><path d="M7.25 10h5.5M7.25 13h3.5"/>');
|
|
23
|
+
|
|
24
|
+
/** A detail card (详情卡片): a card with two lines of text. */
|
|
25
|
+
export const DIALOG_ICON = svg('<rect x="3.25" y="3.75" width="13.5" height="12.5" rx="2.5"/><path d="M6.5 8h7M6.5 11.5h4.5"/>');
|
|
26
|
+
export const LINK_ICON = svg('<g transform="rotate(45 10 10)"><path d="M7 8.5V6a3 3 0 0 1 6 0v2.5M7 11.5V14a3 3 0 0 0 6 0v-2.5M10 7.5v5"/></g>'); // two U's and the line between them, turned 45°
|
|
27
|
+
|
|
28
|
+
// A speech bubble, round with its lower left a corner, a little rounded (as Feishu's comment bubble).
|
|
29
|
+
const BUBBLE = '<path d="M10 16.75A6.75 6.75 0 1 0 3.25 10v5.25a1.5 1.5 0 0 0 1.5 1.5z"/>';
|
|
30
|
+
/** 批注: the bubble with two lines of text, the upper longer (a row of the format bar's "更多", the block menu's row). */
|
|
31
|
+
export const NOTE_ICON = svg(`${BUBBLE}<path d="M7.5 9h5.5M7.5 12h3.5"/>`);
|
|
32
|
+
/** A new 批注: the bubble with a plus (the button beside a block). */
|
|
33
|
+
export const NOTE_ADD_ICON = svg(`${BUBBLE}<path d="M10 7v6M7 10h6"/>`);
|
|
34
|
+
|
|
35
|
+
/** Code (</>): the format bar's inline code and the 代码块 type, one drawing, as wide as the others. */
|
|
36
|
+
export const CODE_ICON = svg('<path d="M6.5 5.5 2.25 10l4.25 4.5M13.5 5.5l4.25 4.5-4.25 4.5M11.6 3.75 8.4 16.25"/>');
|
|
37
|
+
|
|
38
|
+
/** "H" with a heading level beside it. */
|
|
39
|
+
export const headingIcon = (level) => svg(`<path d="M3.25 4.75v10.5M10.25 4.75v10.5M3.25 10h7"/>${LEVELS[level]}`);
|
|
40
|
+
|
|
41
|
+
/** A picture (a frame, a sun, a hill): the 图片 type and its placeholder, the icon picker's upload. */
|
|
42
|
+
export const PHOTO_ICON = svg('<rect x="3.25" y="4.25" width="13.5" height="11.5" rx="2"/><circle cx="7.5" cy="8.25" r="1.25"/><path d="m3.75 14.25 3.6-3.4a1 1 0 0 1 1.36 0l1.79 1.65 2.1-2.05a1 1 0 0 1 1.4 0l2.75 2.75"/>');
|
|
43
|
+
|
|
44
|
+
/** A smiling face: the block menu's 更换图标 and 添加图标, the 添加图标 control, the icon picker's people. */
|
|
45
|
+
export const FACE_ICON = svg('<circle cx="10" cy="10" r="6.75"/><path d="M7.5 11.5a3 3 0 0 0 5 0"/><circle cx="7.9" cy="8.5" r=".9" fill="currentColor" stroke="none"/><circle cx="12.1" cy="8.5" r=".9" fill="currentColor" stroke="none"/>');
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Z } from "../../../shared/layers.mjs";
|
|
2
|
+
import { addStyle, element, mount } from "../../page/ui.mjs";
|
|
3
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
4
|
+
|
|
5
|
+
// 裁剪图片 (notion-lite's blocks/image/edit/crop.js, Notion's 31868): a dialog over the page, the
|
|
6
|
+
// picture in it at most 70vw × 75vh, a box over it marking what is kept (the rest dimmed): dragged
|
|
7
|
+
// to move it, by a corner to size it, at least 32px and never past the picture; 自由 or a shape
|
|
8
|
+
// (1:1, 4:3, 3:2, 16:9: the box keeps it). It may start from the picture a cropped one was cropped
|
|
9
|
+
// from, with the box kept then (`from`: { src, crop }, notion-lite's original and crop), so what was
|
|
10
|
+
// cut away can be brought back. 保存 draws what is kept onto a canvas, at most 2000px wide, as a PNG
|
|
11
|
+
// for `save(blob, kept)` (kept: "x y width height" in % of the picture; null, the blob too, when the
|
|
12
|
+
// whole picture is kept: page.mjs puts the original back); 取消, Esc or a click beside the dialog
|
|
13
|
+
// closes it, nothing saved.
|
|
14
|
+
|
|
15
|
+
const STYLE = `
|
|
16
|
+
.ge-crop { position: fixed; inset: 0; z-index: ${Z.viewer}; display: flex; align-items: center; justify-content: center; background: rgb(15 15 15 / 60%); user-select: none;
|
|
17
|
+
font: 14px/1.2 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
|
|
18
|
+
.ge-crop-dialog { display: flex; flex-direction: column; max-width: calc(100vw - 48px); border-radius: 12px; overflow: hidden; background: var(--ge-bg); color: var(--ge-tx);
|
|
19
|
+
box-shadow: 0 0 0 1px var(--ge-outline), 0 20px 40px rgb(0 0 0 / 30%); }
|
|
20
|
+
.ge-crop-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--ge-line); }
|
|
21
|
+
.ge-crop-title { flex: 1; text-align: center; font-weight: 500; white-space: nowrap; }
|
|
22
|
+
.ge-crop-shape, .ge-crop-cancel, .ge-crop-save { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
|
|
23
|
+
.ge-crop-shape { color: var(--ge-tx2); }
|
|
24
|
+
.ge-crop-shape[aria-pressed="true"] { background: var(--ge-fill); color: var(--ge-accent-text); }
|
|
25
|
+
.ge-crop-shape:hover, .ge-crop-cancel:hover { background: var(--ge-hover); }
|
|
26
|
+
.ge-crop-cancel { color: var(--ge-tx2); }
|
|
27
|
+
.ge-crop-save { background: var(--ge-accent); color: #fff; font-weight: 500; }
|
|
28
|
+
.ge-crop-save:hover { background: var(--ge-accent-hover); }
|
|
29
|
+
.ge-crop-body { display: flex; justify-content: center; padding: 30px; background: light-dark(#f7f6f3, #1f1f1f); }
|
|
30
|
+
.ge-crop-stage { position: relative; overflow: hidden; }
|
|
31
|
+
.ge-crop-stage > img { display: block; max-width: 70vw; max-height: 75vh; pointer-events: none; }
|
|
32
|
+
.ge-crop-box { position: absolute; cursor: move; box-shadow: 0 0 0 9999px rgb(255 255 255 / 50%), inset 0 0 0 1px rgb(0 0 0 / 10%), 0 0 0 1px rgb(255 255 255 / 50%); }
|
|
33
|
+
.ge-crop-corner { position: absolute; width: 20px; height: 20px; }
|
|
34
|
+
.ge-crop-corner::after { content: ""; position: absolute; inset: 0; border: 0 solid rgb(255 255 255 / 90%); filter: drop-shadow(0 0 1px rgb(0 0 0 / 60%)); }
|
|
35
|
+
.ge-crop-corner[data-at="nw"] { left: -2px; top: -2px; cursor: nwse-resize; } .ge-crop-corner[data-at="nw"]::after { border-width: 3px 0 0 3px; }
|
|
36
|
+
.ge-crop-corner[data-at="ne"] { right: -2px; top: -2px; cursor: nesw-resize; } .ge-crop-corner[data-at="ne"]::after { border-width: 3px 3px 0 0; }
|
|
37
|
+
.ge-crop-corner[data-at="sw"] { left: -2px; bottom: -2px; cursor: nesw-resize; } .ge-crop-corner[data-at="sw"]::after { border-width: 0 0 3px 3px; }
|
|
38
|
+
.ge-crop-corner[data-at="se"] { right: -2px; bottom: -2px; cursor: nwse-resize; } .ge-crop-corner[data-at="se"]::after { border-width: 0 3px 3px 0; }
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const SHAPES = [[t("自由"), null], ["1:1", 1], ["4:3", 4 / 3], ["3:2", 3 / 2], ["16:9", 16 / 9]];
|
|
42
|
+
const MIN = 32;
|
|
43
|
+
const MAX_EXPORT = 2000;
|
|
44
|
+
|
|
45
|
+
let open = null; // { node, keys }
|
|
46
|
+
|
|
47
|
+
/** Crop `img` (an image block's picture), from `from` when given; `save(blob, kept)` gets the PNG of what is kept. */
|
|
48
|
+
export function openCrop(img, save, from = {}) {
|
|
49
|
+
addStyle(STYLE);
|
|
50
|
+
closeCrop();
|
|
51
|
+
const picture = element("img", { src: from.src ?? img.src, alt: "", draggable: "false" });
|
|
52
|
+
const box = element("div", { class: "ge-crop-box" }, ...["nw", "ne", "sw", "se"].map((at) => element("div", { class: "ge-crop-corner", "data-at": at })));
|
|
53
|
+
const stage = element("div", { class: "ge-crop-stage" }, picture, box);
|
|
54
|
+
const shapes = SHAPES.map(([label, ratio]) => {
|
|
55
|
+
const button = element("button", { type: "button", class: "ge-crop-shape", "aria-pressed": String(ratio === null), text: label });
|
|
56
|
+
button.addEventListener("click", () => shape(ratio, button));
|
|
57
|
+
return button;
|
|
58
|
+
});
|
|
59
|
+
const cancel = element("button", { type: "button", class: "ge-crop-cancel", text: t("取消") });
|
|
60
|
+
const done = element("button", { type: "button", class: "ge-crop-save", text: t("保存") });
|
|
61
|
+
const dialog = element("div", { class: "ge-crop-dialog", role: "dialog", "aria-label": t("裁剪图片") },
|
|
62
|
+
element("div", { class: "ge-crop-bar" }, ...shapes, element("div", { class: "ge-crop-title", text: t("裁剪图片") }), cancel, done),
|
|
63
|
+
element("div", { class: "ge-crop-body" }, stage));
|
|
64
|
+
const node = mount(element("div", { class: "ge-crop" }, dialog));
|
|
65
|
+
let rect = null; // the box, in the picture's shown pixels: { x, y, w, h }
|
|
66
|
+
let ratio = null;
|
|
67
|
+
const size = () => ({ w: picture.clientWidth, h: picture.clientHeight });
|
|
68
|
+
const paint = () => Object.assign(box.style, { left: `${rect.x}px`, top: `${rect.y}px`, width: `${rect.w}px`, height: `${rect.h}px` });
|
|
69
|
+
// The box kept last time, or the whole picture.
|
|
70
|
+
const start = () => {
|
|
71
|
+
const { w, h } = size();
|
|
72
|
+
const kept = from.crop;
|
|
73
|
+
rect = kept ? { x: (kept.x / 100) * w, y: (kept.y / 100) * h, w: (kept.width / 100) * w, h: (kept.height / 100) * h } : { x: 0, y: 0, w, h };
|
|
74
|
+
paint();
|
|
75
|
+
};
|
|
76
|
+
if (picture.complete && picture.naturalWidth) start();
|
|
77
|
+
else picture.addEventListener("load", start, { once: true });
|
|
78
|
+
|
|
79
|
+
// A shape: the box keeps its left, top and width, its height following, made smaller to fit.
|
|
80
|
+
function shape(value, button) {
|
|
81
|
+
ratio = value;
|
|
82
|
+
shapes.forEach((each) => each.setAttribute("aria-pressed", String(each === button)));
|
|
83
|
+
if (!ratio || !rect) return;
|
|
84
|
+
const { w, h } = size();
|
|
85
|
+
let width = rect.w;
|
|
86
|
+
let height = width / ratio;
|
|
87
|
+
if (rect.y + height > h) {
|
|
88
|
+
height = h - rect.y;
|
|
89
|
+
width = height * ratio;
|
|
90
|
+
}
|
|
91
|
+
if (rect.x + width > w) {
|
|
92
|
+
width = w - rect.x;
|
|
93
|
+
height = width / ratio;
|
|
94
|
+
}
|
|
95
|
+
rect = { ...rect, w: width, h: height };
|
|
96
|
+
paint();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Dragging the box moves it; dragging a corner sizes it from the opposite one.
|
|
100
|
+
box.addEventListener("pointerdown", (event) => {
|
|
101
|
+
if (event.button !== 0 || !rect) return;
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
const at = event.target.closest(".ge-crop-corner")?.getAttribute("data-at") ?? null;
|
|
104
|
+
const from = { x: event.clientX, y: event.clientY, rect: { ...rect } };
|
|
105
|
+
const { w, h } = size();
|
|
106
|
+
box.setPointerCapture?.(event.pointerId);
|
|
107
|
+
const move = (moving) => {
|
|
108
|
+
const dx = moving.clientX - from.x;
|
|
109
|
+
const dy = moving.clientY - from.y;
|
|
110
|
+
const was = from.rect;
|
|
111
|
+
if (!at) {
|
|
112
|
+
rect = { ...was, x: Math.max(0, Math.min(w - was.w, was.x + dx)), y: Math.max(0, Math.min(h - was.h, was.y + dy)) };
|
|
113
|
+
} else {
|
|
114
|
+
// The corner opposite stays; the one dragged follows, inside the picture.
|
|
115
|
+
const left = at.includes("w");
|
|
116
|
+
const top = at.includes("n");
|
|
117
|
+
const fixedX = left ? was.x + was.w : was.x;
|
|
118
|
+
const fixedY = top ? was.y + was.h : was.y;
|
|
119
|
+
let x = Math.max(0, Math.min(w, (left ? was.x : was.x + was.w) + dx));
|
|
120
|
+
let y = Math.max(0, Math.min(h, (top ? was.y : was.y + was.h) + dy));
|
|
121
|
+
let width = Math.max(MIN, Math.abs(x - fixedX));
|
|
122
|
+
let height = Math.max(MIN, Math.abs(y - fixedY));
|
|
123
|
+
if (ratio) {
|
|
124
|
+
height = width / ratio;
|
|
125
|
+
const room = top ? fixedY : h - fixedY;
|
|
126
|
+
if (height > room) {
|
|
127
|
+
height = room;
|
|
128
|
+
width = height * ratio;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
width = Math.min(width, left ? fixedX : w - fixedX);
|
|
132
|
+
height = Math.min(height, top ? fixedY : h - fixedY);
|
|
133
|
+
rect = { x: left ? fixedX - width : fixedX, y: top ? fixedY - height : fixedY, w: width, h: height };
|
|
134
|
+
}
|
|
135
|
+
paint();
|
|
136
|
+
};
|
|
137
|
+
const up = () => {
|
|
138
|
+
box.removeEventListener("pointermove", move);
|
|
139
|
+
box.removeEventListener("pointerup", up);
|
|
140
|
+
box.removeEventListener("pointercancel", up);
|
|
141
|
+
};
|
|
142
|
+
box.addEventListener("pointermove", move);
|
|
143
|
+
box.addEventListener("pointerup", up);
|
|
144
|
+
box.addEventListener("pointercancel", up);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// 保存: what is kept, drawn from the picture's own pixels (2000px wide at most), as a PNG, and where
|
|
148
|
+
// it is in the picture; the whole picture kept is none.
|
|
149
|
+
done.addEventListener("click", () => {
|
|
150
|
+
if (!rect) return;
|
|
151
|
+
const { w, h } = size();
|
|
152
|
+
if (rect.x < 1 && rect.y < 1 && rect.w > w - 1 && rect.h > h - 1) {
|
|
153
|
+
closeCrop();
|
|
154
|
+
return save(null, null);
|
|
155
|
+
}
|
|
156
|
+
const share = (value, of) => Math.round((value / of) * 100000) / 1000;
|
|
157
|
+
const kept = [share(rect.x, w), share(rect.y, h), share(rect.w, w), share(rect.h, h)].map((value) => String(Math.min(100, value))).join(" ");
|
|
158
|
+
const scale = picture.naturalWidth / picture.clientWidth;
|
|
159
|
+
const source = { x: rect.x * scale, y: rect.y * scale, w: rect.w * scale, h: rect.h * scale };
|
|
160
|
+
const out = Math.min(1, MAX_EXPORT / source.w);
|
|
161
|
+
const canvas = document.createElement("canvas");
|
|
162
|
+
canvas.width = Math.max(1, Math.round(source.w * out));
|
|
163
|
+
canvas.height = Math.max(1, Math.round(source.h * out));
|
|
164
|
+
canvas.getContext("2d").drawImage(picture, source.x, source.y, source.w, source.h, 0, 0, canvas.width, canvas.height);
|
|
165
|
+
canvas.toBlob((blob) => {
|
|
166
|
+
closeCrop();
|
|
167
|
+
if (blob) save(blob, kept);
|
|
168
|
+
}, "image/png");
|
|
169
|
+
});
|
|
170
|
+
cancel.addEventListener("click", closeCrop);
|
|
171
|
+
node.addEventListener("pointerdown", (event) => { if (event.target === node) closeCrop(); });
|
|
172
|
+
const keys = (event) => {
|
|
173
|
+
if (event.key === "Escape") {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
event.stopPropagation();
|
|
176
|
+
closeCrop();
|
|
177
|
+
} else if (!event.target.closest?.(".ge-crop")) event.stopPropagation();
|
|
178
|
+
};
|
|
179
|
+
document.addEventListener("keydown", keys, true);
|
|
180
|
+
open = { node, keys };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** The crop dialog gone, nothing saved. */
|
|
184
|
+
function closeCrop() {
|
|
185
|
+
if (!open) return;
|
|
186
|
+
document.removeEventListener("keydown", open.keys, true);
|
|
187
|
+
open.node.remove();
|
|
188
|
+
open = null;
|
|
189
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { SPAN, SPAN_SIZE } from "../../../shared/media.mjs";
|
|
2
|
+
import { PHOTO_ICON } from "../icons.mjs";
|
|
3
|
+
import { captionWords, fileOf, mediaReadOnly, newMediaFigure, writtenCaption } from "../media/parts.mjs";
|
|
4
|
+
import { barMarkup } from "../placeholder-bar.mjs";
|
|
5
|
+
import { t } from "../../../shared/i18n/index.mjs";
|
|
6
|
+
|
|
7
|
+
// 图片 (Notion's image block): the kit's figure.doc-image, a picture of the report's folder
|
|
8
|
+
// (assets/<file>) and its caption, a <figcaption> always written (empty while there is none). A
|
|
9
|
+
// card: one block, its caption a text block of its own kind (mediaCaption: plain inline text, may be
|
|
10
|
+
// empty), its width a size (--doc-span), its side a class (left or right; centered without).
|
|
11
|
+
// Made from an empty block (the "/" menu: 图片): a placeholder until a picture is chosen (上传, or a
|
|
12
|
+
// link the server downloads into the report's folder: editor/media-store.mjs), written once it has
|
|
13
|
+
// one. page.mjs: the picker, the toolbar, resizing, the viewer (what the four media blocks share:
|
|
14
|
+
// ../media/); file.mjs: a new one in report.html.
|
|
15
|
+
//
|
|
16
|
+
// Where the engines reach it (src/editor/page/ unless named): convert.mjs (made from an empty
|
|
17
|
+
// block: `create`), editor.mjs (the picker opens on a new one: page.mjs `onCreated`), clipboard/ (an
|
|
18
|
+
// image pasted: `clipboard`), src/transfer/markdown.mjs (`read`), page.mjs (its block menu rows: 对齐, 标题, 替换, 原始大小), ../source/ (its caption:
|
|
19
|
+
// blocks.mjs).
|
|
20
|
+
// Its look: the kit's styles/image.css (src/render/kit/); its picture where the preview serves it
|
|
21
|
+
// and embedded in an export: src/render/images.mjs.
|
|
22
|
+
export const ALIGN = ["doc-image--left", "doc-image--right"]; // centered with neither
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A picture's placeholder bar, as markup: in a new one, and in one the file keeps empty from the first paint (the server
|
|
26
|
+
* puts it there: components/placeholder.mjs showEmpty).
|
|
27
|
+
*/
|
|
28
|
+
const placeholder = () => barMarkup("doc-image", PHOTO_ICON, t("添加图片")); // its words in the language t() says them in now (placeholder.mjs showEmpty)
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
name: "image",
|
|
32
|
+
listed: () => t("图片"),
|
|
33
|
+
readOnly: [mediaReadOnly("image")],
|
|
34
|
+
units: {
|
|
35
|
+
image: {
|
|
36
|
+
name: t("图片"),
|
|
37
|
+
match: [{ rank: 45, tag: "figure", class: "doc-image" }],
|
|
38
|
+
boxed: true,
|
|
39
|
+
toggles: ALIGN,
|
|
40
|
+
sizes: { [SPAN]: SPAN_SIZE },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
types: {
|
|
44
|
+
image: {
|
|
45
|
+
menu: ["advanced", 16], fresh: 2,
|
|
46
|
+
tag: "figure", className: "doc-image", kind: "image", bare: true,
|
|
47
|
+
create: ({ doc, put }) => put(newImage(doc)), // its placeholder stands for the empty block; what it holds is chosen next
|
|
48
|
+
// Copied as itself, a card. It comes as this from another program: its address, filled once on the page.
|
|
49
|
+
clipboard: {
|
|
50
|
+
kind: "image",
|
|
51
|
+
read(unit, { plain }) {
|
|
52
|
+
const image = unit.querySelector(":scope > img");
|
|
53
|
+
const src = image?.getAttribute("src");
|
|
54
|
+
if (!src) return null;
|
|
55
|
+
const name = src.split("/").pop();
|
|
56
|
+
return { label: plain(unit.querySelector(":scope > figcaption")) || image.getAttribute("alt") || name, src, name, caption: writtenCaption(unit) };
|
|
57
|
+
},
|
|
58
|
+
check: (block, { imageSource, string }) => imageSource(block.src) && (block.caption === undefined || string(block.caption, 2000)),
|
|
59
|
+
build: ({ doc, block, pending }) => pending(newImage(doc), block.src),
|
|
60
|
+
text: () => [],
|
|
61
|
+
},
|
|
62
|
+
// What a new one is written with (core.mjs nodeOf): its picture, caption, side and width; an
|
|
63
|
+
// empty figure while it has no picture (its placeholder, kept: file.mjs).
|
|
64
|
+
extras: (element) => imageNode(element),
|
|
65
|
+
part: ".doc-image",
|
|
66
|
+
bar: placeholder,
|
|
67
|
+
label: t("图片"), icon: PHOTO_ICON,
|
|
68
|
+
words: "图片 图像 照片 截图 tupian tp image picture photo img screenshot",
|
|
69
|
+
glance: { row: 10, name: "图片", write: "`<figure><img src=\"assets/…\"><figcaption>`, or a lone `<img>`", after: "`figure.doc-image`", rule: "Pictures" },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** An image block's picture element, once it has one. */
|
|
75
|
+
export const imageOf = (figure) => figure.querySelector(":scope > img[data-ge-src]");
|
|
76
|
+
|
|
77
|
+
/** A crop as written (data-crop: "x y width height", in % of the original), or null. */
|
|
78
|
+
export function cropOf(value) {
|
|
79
|
+
const numbers = String(value ?? "").trim().split(/\s+/).map(Number);
|
|
80
|
+
if (numbers.length !== 4 || numbers.some((number) => !Number.isFinite(number))) return null;
|
|
81
|
+
const [x, y, width, height] = numbers;
|
|
82
|
+
return x >= 0 && y >= 0 && width > 0 && height > 0 && x + width <= 100.01 && y + height <= 100.01 ? { x, y, width, height } : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// What a new image is written with: its picture (the file, not where the preview serves it), its
|
|
86
|
+
// caption's text, its side and its width; cropped, the picture it was cropped from and what of it
|
|
87
|
+
// is kept (裁剪图片 starts from them again).
|
|
88
|
+
function imageNode(figure) {
|
|
89
|
+
const span = figure.style.getPropertyValue(SPAN).trim();
|
|
90
|
+
const side = ALIGN.filter((name) => figure.classList.contains(name));
|
|
91
|
+
const img = imageOf(figure);
|
|
92
|
+
const original = img?.getAttribute("data-original");
|
|
93
|
+
const crop = img?.getAttribute("data-crop");
|
|
94
|
+
return {
|
|
95
|
+
...(original && cropOf(crop) ? { original, crop } : {}),
|
|
96
|
+
src: fileOf(imageOf(figure), "src") ?? "",
|
|
97
|
+
caption: captionWords(figure),
|
|
98
|
+
...(side.length > 0 ? { classes: side } : {}),
|
|
99
|
+
...(span ? { span: Number(span) } : {}),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** A new image (the "/" menu's 图片): its placeholder (添加图片), until a picture is chosen (page.mjs). */
|
|
104
|
+
export const newImage = (doc) => newMediaFigure(doc, "image", placeholder());
|