@heycys/gallery 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +50 -2
- package/THIRD-PARTY-NOTICES.md +3303 -0
- package/assets/writing-preferences.md +107 -0
- package/bin/gallery.mjs +10 -0
- package/browser/editor/components/bookmark/icons.mjs +6 -0
- package/browser/editor/components/bookmark/index.mjs +80 -0
- package/browser/editor/components/bookmark/page.mjs +147 -0
- package/browser/editor/components/builders.mjs +19 -0
- package/browser/editor/components/callout/index.mjs +64 -0
- package/browser/editor/components/code/index.mjs +327 -0
- package/browser/editor/components/code/page.mjs +561 -0
- package/browser/editor/components/colors.mjs +50 -0
- package/browser/editor/components/columns/index.mjs +104 -0
- package/browser/editor/components/columns/page.mjs +310 -0
- package/browser/editor/components/details/index.mjs +73 -0
- package/browser/editor/components/details/page.mjs +86 -0
- package/browser/editor/components/dialog/index.mjs +84 -0
- package/browser/editor/components/dialog/page.mjs +201 -0
- package/browser/editor/components/divider/index.mjs +48 -0
- package/browser/editor/components/embed/icons.mjs +11 -0
- package/browser/editor/components/embed/index.mjs +123 -0
- package/browser/editor/components/embed/page.mjs +309 -0
- package/browser/editor/components/figure/index.mjs +87 -0
- package/browser/editor/components/figure/page.mjs +42 -0
- package/browser/editor/components/file/icons.mjs +14 -0
- package/browser/editor/components/file/index.mjs +77 -0
- package/browser/editor/components/file/page.mjs +114 -0
- package/browser/editor/components/flowchart/add.mjs +123 -0
- package/browser/editor/components/flowchart/index.mjs +246 -0
- package/browser/editor/components/flowchart/page.mjs +453 -0
- package/browser/editor/components/heading/index.mjs +53 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +63 -0
- package/browser/editor/components/icon/index.mjs +57 -0
- package/browser/editor/components/icon/page.mjs +286 -0
- package/browser/editor/components/icons.mjs +48 -0
- package/browser/editor/components/image/crop.mjs +189 -0
- package/browser/editor/components/image/index.mjs +104 -0
- package/browser/editor/components/image/page.mjs +385 -0
- package/browser/editor/components/image/viewer.mjs +213 -0
- package/browser/editor/components/installed/index.mjs +179 -0
- package/browser/editor/components/installed/page.mjs +523 -0
- package/browser/editor/components/installed/served.mjs +35 -0
- package/browser/editor/components/kit.mjs +67 -0
- package/browser/editor/components/list/index.mjs +194 -0
- package/browser/editor/components/list/join.mjs +68 -0
- package/browser/editor/components/list/numbers.mjs +107 -0
- package/browser/editor/components/list/page.mjs +632 -0
- package/browser/editor/components/math/index.mjs +88 -0
- package/browser/editor/components/math/page.mjs +236 -0
- package/browser/editor/components/math/tex-logo.mjs +6 -0
- package/browser/editor/components/media/icons.mjs +19 -0
- package/browser/editor/components/media/page.mjs +192 -0
- package/browser/editor/components/media/parts.mjs +60 -0
- package/browser/editor/components/media/size.mjs +20 -0
- package/browser/editor/components/media/toolbar.mjs +37 -0
- package/browser/editor/components/media/write.mjs +7 -0
- package/browser/editor/components/pages.mjs +46 -0
- package/browser/editor/components/paragraph/index.mjs +43 -0
- package/browser/editor/components/paragraph/page.mjs +52 -0
- package/browser/editor/components/placeholder-bar.mjs +17 -0
- package/browser/editor/components/placeholder.mjs +128 -0
- package/browser/editor/components/quote/index.mjs +33 -0
- package/browser/editor/components/registry.mjs +859 -0
- package/browser/editor/components/rows.mjs +16 -0
- package/browser/editor/components/section/index.mjs +42 -0
- package/browser/editor/components/section/page.mjs +141 -0
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/sheets/index.mjs +137 -0
- package/browser/editor/components/sheets/page.mjs +227 -0
- package/browser/editor/components/sheets/pills.mjs +226 -0
- package/browser/editor/components/table/grid.mjs +73 -0
- package/browser/editor/components/table/index.mjs +308 -0
- package/browser/editor/components/table/page.mjs +683 -0
- package/browser/editor/components/table/slots.mjs +41 -0
- package/browser/editor/components/widget/index.mjs +50 -0
- package/browser/editor/page/annotate/anchors.mjs +230 -0
- package/browser/editor/page/annotate/card.mjs +102 -0
- package/browser/editor/page/annotate/index.mjs +1656 -0
- package/browser/editor/page/at-menu/index.mjs +317 -0
- package/browser/editor/page/autosave.mjs +1023 -0
- package/browser/editor/page/beside.mjs +21 -0
- package/browser/editor/page/block-info.mjs +63 -0
- package/browser/editor/page/block-menu/colors.mjs +84 -0
- package/browser/editor/page/block-menu/index.mjs +217 -0
- package/browser/editor/page/blocks.mjs +255 -0
- package/browser/editor/page/caret.mjs +682 -0
- package/browser/editor/page/changes/bar.mjs +102 -0
- package/browser/editor/page/changes/ghost.mjs +206 -0
- package/browser/editor/page/changes/gone-words.mjs +94 -0
- package/browser/editor/page/changes/index.mjs +447 -0
- package/browser/editor/page/changes/words.mjs +27 -0
- package/browser/editor/page/chip-fills.mjs +126 -0
- package/browser/editor/page/clipboard/import/colors.mjs +192 -0
- package/browser/editor/page/clipboard/import/html.mjs +792 -0
- package/browser/editor/page/clipboard/import/inline.mjs +232 -0
- package/browser/editor/page/clipboard/import/languages.mjs +42 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
- package/browser/editor/page/clipboard/import/math.mjs +100 -0
- package/browser/editor/page/clipboard/import/office.mjs +245 -0
- package/browser/editor/page/clipboard/import/read.mjs +120 -0
- package/browser/editor/page/clipboard/import/rich.mjs +29 -0
- package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
- package/browser/editor/page/clipboard/index.mjs +816 -0
- package/browser/editor/page/clipboard/own/blocks.mjs +211 -0
- package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
- package/browser/editor/page/clipboard/own/describe.mjs +124 -0
- package/browser/editor/page/clipboard/own/export.mjs +167 -0
- package/browser/editor/page/clipboard/own/ids.mjs +39 -0
- package/browser/editor/page/clipboard/own/index.mjs +13 -0
- package/browser/editor/page/clipboard/own/rules.mjs +44 -0
- package/browser/editor/page/clipboard/own/selection.mjs +159 -0
- package/browser/editor/page/clipboard/own/writers.mjs +315 -0
- package/browser/editor/page/columns/index.mjs +360 -0
- package/browser/editor/page/commit.mjs +1813 -0
- package/browser/editor/page/conflicts.mjs +249 -0
- package/browser/editor/page/convert.mjs +831 -0
- package/browser/editor/page/core.mjs +1693 -0
- package/browser/editor/page/drag/drop.mjs +307 -0
- package/browser/editor/page/drag/index.mjs +351 -0
- package/browser/editor/page/drag/preview.mjs +126 -0
- package/browser/editor/page/edge-scroll.mjs +50 -0
- package/browser/editor/page/editor.mjs +1780 -0
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +287 -0
- package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
- package/browser/editor/page/emoji-picker/grid.mjs +81 -0
- package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
- package/browser/editor/page/emoji-picker/icons.mjs +31 -0
- package/browser/editor/page/emoji-picker/index.mjs +166 -0
- package/browser/editor/page/emoji-picker/styles.mjs +161 -0
- package/browser/editor/page/emoji-picker/support.mjs +204 -0
- package/browser/editor/page/emoji-picker/upload.mjs +236 -0
- package/browser/editor/page/export-report.mjs +23 -0
- package/browser/editor/page/fills.mjs +62 -0
- package/browser/editor/page/find/index.mjs +107 -0
- package/browser/editor/page/flags.mjs +70 -0
- package/browser/editor/page/fold/index.mjs +348 -0
- package/browser/editor/page/fold/rule.mjs +125 -0
- package/browser/editor/page/folded.mjs +23 -0
- package/browser/editor/page/format-bar/bar.mjs +449 -0
- package/browser/editor/page/format-bar/brush.mjs +77 -0
- package/browser/editor/page/format-bar/colors.mjs +46 -0
- package/browser/editor/page/format-bar/index.mjs +404 -0
- package/browser/editor/page/formula/index.mjs +236 -0
- package/browser/editor/page/formula/panel.mjs +336 -0
- package/browser/editor/page/formula/symbols.mjs +156 -0
- package/browser/editor/page/frame.mjs +74 -0
- package/browser/editor/page/frames.mjs +196 -0
- package/browser/editor/page/geometry.mjs +402 -0
- package/browser/editor/page/gesture.mjs +45 -0
- package/browser/editor/page/handle/index.mjs +650 -0
- package/browser/editor/page/handle-sizes.mjs +14 -0
- package/browser/editor/page/hints/index.mjs +84 -0
- package/browser/editor/page/history.mjs +401 -0
- package/browser/editor/page/insert/index.mjs +256 -0
- package/browser/editor/page/kept.mjs +38 -0
- package/browser/editor/page/links/address.mjs +40 -0
- package/browser/editor/page/links/index.mjs +866 -0
- package/browser/editor/page/links/pages.mjs +131 -0
- package/browser/editor/page/links/views.mjs +369 -0
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +77 -0
- package/browser/editor/page/made.mjs +24 -0
- package/browser/editor/page/margin.mjs +373 -0
- package/browser/editor/page/markdown/index.mjs +88 -0
- package/browser/editor/page/markdown/rules.mjs +33 -0
- package/browser/editor/page/marks.mjs +377 -0
- package/browser/editor/page/media-menu/index.mjs +158 -0
- package/browser/editor/page/menu.mjs +544 -0
- package/browser/editor/page/merge.mjs +124 -0
- package/browser/editor/page/notices.mjs +142 -0
- package/browser/editor/page/offered.mjs +32 -0
- package/browser/editor/page/outline/folds.mjs +53 -0
- package/browser/editor/page/outline/index.mjs +783 -0
- package/browser/editor/page/outline/list.mjs +184 -0
- package/browser/editor/page/outline/read.mjs +201 -0
- package/browser/editor/page/outline/strip.mjs +287 -0
- package/browser/editor/page/outline/tree.mjs +248 -0
- package/browser/editor/page/overlay-layer.mjs +227 -0
- package/browser/editor/page/overlays.mjs +205 -0
- package/browser/editor/page/own.mjs +28 -0
- package/browser/editor/page/pads.mjs +71 -0
- package/browser/editor/page/page-objects.mjs +105 -0
- package/browser/editor/page/panel.mjs +65 -0
- package/browser/editor/page/placement.mjs +58 -0
- package/browser/editor/page/post.mjs +41 -0
- package/browser/editor/page/present-links.mjs +50 -0
- package/browser/editor/page/quiet.mjs +48 -0
- package/browser/editor/page/resize/index.mjs +327 -0
- package/browser/editor/page/select-all/index.mjs +262 -0
- package/browser/editor/page/selection/delete.mjs +61 -0
- package/browser/editor/page/selection/index.mjs +164 -0
- package/browser/editor/page/selection/marquee.mjs +174 -0
- package/browser/editor/page/session.mjs +168 -0
- package/browser/editor/page/slash-menu/index.mjs +291 -0
- package/browser/editor/page/storage.mjs +48 -0
- package/browser/editor/page/sync-state.mjs +267 -0
- package/browser/editor/page/table/aligns.mjs +29 -0
- package/browser/editor/page/table/cell-bar.mjs +141 -0
- package/browser/editor/page/table/cells.mjs +527 -0
- package/browser/editor/page/table/icons.mjs +40 -0
- package/browser/editor/page/table/index.mjs +990 -0
- package/browser/editor/page/table/lists.mjs +187 -0
- package/browser/editor/page/table/widths.mjs +313 -0
- package/browser/editor/page/tex.mjs +32 -0
- package/browser/editor/page/text-select/index.mjs +671 -0
- package/browser/editor/page/tooltip.mjs +98 -0
- package/browser/editor/page/type-grid.mjs +83 -0
- package/browser/editor/page/typing/code-edges.mjs +274 -0
- package/browser/editor/page/typing/index.mjs +282 -0
- package/browser/editor/page/typing/leave.mjs +68 -0
- package/browser/editor/page/ui.mjs +160 -0
- package/browser/shared/annotations.mjs +569 -0
- package/browser/shared/code-folds.mjs +14 -0
- package/browser/shared/code-languages.mjs +70 -0
- package/browser/shared/code-lines.mjs +30 -0
- package/browser/shared/colors.mjs +30 -0
- package/browser/shared/component-catalog.mjs +573 -0
- package/browser/shared/components/bookmark.mjs +26 -0
- package/browser/shared/components/callout.mjs +9 -0
- package/browser/shared/components/chart.mjs +20 -0
- package/browser/shared/components/code.mjs +37 -0
- package/browser/shared/components/columns.mjs +16 -0
- package/browser/shared/components/details.mjs +15 -0
- package/browser/shared/components/dialog.mjs +28 -0
- package/browser/shared/components/diff.mjs +18 -0
- package/browser/shared/components/divider.mjs +6 -0
- package/browser/shared/components/embed.mjs +25 -0
- package/browser/shared/components/figure.mjs +14 -0
- package/browser/shared/components/file.mjs +23 -0
- package/browser/shared/components/heading.mjs +6 -0
- package/browser/shared/components/highlight.mjs +9 -0
- package/browser/shared/components/icon.mjs +18 -0
- package/browser/shared/components/image.mjs +39 -0
- package/browser/shared/components/index.mjs +396 -0
- package/browser/shared/components/installed.mjs +232 -0
- package/browser/shared/components/list.mjs +146 -0
- package/browser/shared/components/math.mjs +49 -0
- package/browser/shared/components/mention.mjs +33 -0
- package/browser/shared/components/page.mjs +46 -0
- package/browser/shared/components/paragraph.mjs +9 -0
- package/browser/shared/components/quote.mjs +6 -0
- package/browser/shared/components/section.mjs +8 -0
- package/browser/shared/components/sheets.mjs +80 -0
- package/browser/shared/components/state.mjs +20 -0
- package/browser/shared/components/table.mjs +49 -0
- package/browser/shared/components/text.mjs +14 -0
- package/browser/shared/components/widget.mjs +10 -0
- package/browser/shared/copy-ids.mjs +72 -0
- package/browser/shared/css-references.mjs +110 -0
- package/browser/shared/document-look.mjs +178 -0
- package/browser/shared/emoji/custom.mjs +91 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
- package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
- package/browser/shared/emoji/data/README.md +28 -0
- package/browser/shared/emoji/data/categories.json +1 -0
- package/browser/shared/emoji/data/icons.json +1 -0
- package/browser/shared/emoji/data/keywords-en.json +1 -0
- package/browser/shared/emoji/data/keywords-zh.json +1 -0
- package/browser/shared/emoji/data/names.json +1 -0
- package/browser/shared/emoji/data/positions.json +1 -0
- package/browser/shared/emoji/data/twemoji-index.json +1 -0
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +194 -0
- package/browser/shared/emoji/emoji.mjs +38 -0
- package/browser/shared/emoji/glyphs.mjs +134 -0
- package/browser/shared/emoji/icon-value.mjs +91 -0
- package/browser/shared/escape.mjs +20 -0
- package/browser/shared/export-wrap.mjs +89 -0
- package/browser/shared/files.mjs +33 -0
- package/browser/shared/html-tree.mjs +59 -0
- package/browser/shared/http.mjs +22 -0
- package/browser/shared/i18n/en.mjs +1223 -0
- package/browser/shared/i18n/index.mjs +132 -0
- package/browser/shared/ids.mjs +24 -0
- package/browser/shared/import-types.mjs +23 -0
- package/browser/shared/inline-spacing.mjs +97 -0
- package/browser/shared/layers.mjs +42 -0
- package/browser/shared/long-runs.mjs +39 -0
- package/browser/shared/media.mjs +162 -0
- package/browser/shared/new-names.mjs +67 -0
- package/browser/shared/number-reading.mjs +92 -0
- package/browser/shared/old-names.mjs +143 -0
- package/browser/shared/outline.mjs +194 -0
- package/browser/shared/page-address.mjs +140 -0
- package/browser/shared/page-links.mjs +86 -0
- package/browser/shared/paths.mjs +73 -0
- package/browser/shared/preferences.mjs +116 -0
- package/browser/shared/preview-server.mjs +247 -0
- package/browser/shared/qa-levels.mjs +93 -0
- package/browser/shared/reading-place.mjs +91 -0
- package/browser/shared/renamed-storage.mjs +220 -0
- package/browser/shared/reports.mjs +46 -0
- package/browser/shared/search.mjs +85 -0
- package/browser/shared/session.mjs +77 -0
- package/browser/shared/table-chart.mjs +113 -0
- package/browser/shared/table-hides.mjs +120 -0
- package/browser/shared/table-slots.mjs +75 -0
- package/browser/shared/words.mjs +23 -0
- package/browser/shared/workspace-look.mjs +91 -0
- package/browser/shared/workspace.mjs +535 -0
- package/browser/shared/writing-preferences.mjs +68 -0
- package/browser/shared/zoom.mjs +57 -0
- package/dist/chunk-2B5E4CDJ.mjs +2 -0
- package/dist/chunk-342HXE3Q.mjs +2 -0
- package/dist/chunk-3HIRPVLU.mjs +2 -0
- package/dist/chunk-43B75J5T.mjs +2 -0
- package/dist/chunk-4FS7Z7WR.mjs +2 -0
- package/dist/chunk-4K5KC6V2.mjs +2 -0
- package/dist/chunk-5L7RYZCL.mjs +2 -0
- package/dist/chunk-5MHMDLZD.mjs +4 -0
- package/dist/chunk-5ZKJ3H4P.mjs +8 -0
- package/dist/chunk-64K7IPLO.mjs +255 -0
- package/dist/chunk-6QXGZM36.mjs +8 -0
- package/dist/chunk-6RGJOMJP.mjs +16 -0
- package/dist/chunk-742D2WWJ.mjs +19 -0
- package/dist/chunk-7DTINW6U.mjs +48 -0
- package/dist/chunk-A55HN5OK.mjs +2 -0
- package/dist/chunk-AGDILNWB.mjs +2 -0
- package/dist/chunk-AJ73XJF3.mjs +2 -0
- package/dist/chunk-AUZGSZJH.mjs +13 -0
- package/dist/chunk-BFE45AKL.mjs +2 -0
- package/dist/chunk-BGGDRNYQ.mjs +10 -0
- package/dist/chunk-BXO2ZY5P.mjs +2 -0
- package/dist/chunk-C564NU2H.mjs +77 -0
- package/dist/chunk-CEH4MRCC.mjs +2 -0
- package/dist/chunk-CY2FNNAB.mjs +16 -0
- package/dist/chunk-DFUDV4LX.mjs +2 -0
- package/dist/chunk-DKXG4XDG.mjs +2 -0
- package/dist/chunk-E7LWZRXY.mjs +4 -0
- package/dist/chunk-EZQ34M3F.mjs +124 -0
- package/dist/chunk-EZY3WC6Z.mjs +15 -0
- package/dist/chunk-FDLXYYG4.mjs +4 -0
- package/dist/chunk-FUKQNOQS.mjs +9 -0
- package/dist/chunk-GB5SOYQJ.mjs +7 -0
- package/dist/chunk-GRAXKKG4.mjs +2 -0
- package/dist/chunk-HYMEEXKN.mjs +4 -0
- package/dist/chunk-IVDLMMBD.mjs +2 -0
- package/dist/chunk-JPOSLGOC.mjs +6 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-L3QKH4OK.mjs +26 -0
- package/dist/chunk-LAE5NQ4B.mjs +2 -0
- package/dist/chunk-LCTHTZIL.mjs +960 -0
- package/dist/chunk-LEF6DRCK.mjs +59 -0
- package/dist/chunk-LKX55H76.mjs +2 -0
- package/dist/chunk-LS4F7JUM.mjs +2 -0
- package/dist/chunk-MAFIGVXY.mjs +2 -0
- package/dist/chunk-NO5NJCHO.mjs +2 -0
- package/dist/chunk-NQPVAU63.mjs +2 -0
- package/dist/chunk-NSKUTQ5J.mjs +5 -0
- package/dist/chunk-O35FIXRB.mjs +2 -0
- package/dist/chunk-P2CAZPDP.mjs +3 -0
- package/dist/chunk-PL6GHLGD.mjs +15 -0
- package/dist/chunk-QAIHRH3I.mjs +13 -0
- package/dist/chunk-QJIR2BLP.mjs +6 -0
- package/dist/chunk-QR6A54KJ.mjs +3 -0
- package/dist/chunk-QUPLVPB2.mjs +7 -0
- package/dist/chunk-R7BNENLY.mjs +4 -0
- package/dist/chunk-S6O4UHLC.mjs +2 -0
- package/dist/chunk-SGJWQKEI.mjs +2 -0
- package/dist/chunk-SYGN7GLU.mjs +2 -0
- package/dist/chunk-TMYZB6AV.mjs +2 -0
- package/dist/chunk-TX6JH7TR.mjs +2 -0
- package/dist/chunk-TYK6VNAB.mjs +10 -0
- package/dist/chunk-U3SSPL4K.mjs +8 -0
- package/dist/chunk-U6KNPJPR.mjs +2 -0
- package/dist/chunk-UALRNVSE.mjs +4 -0
- package/dist/chunk-UH4SIXTR.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-V3HXVQEM.mjs +2 -0
- package/dist/chunk-V5JTW2LH.mjs +27 -0
- package/dist/chunk-V5VXUJKG.mjs +2 -0
- package/dist/chunk-V6XZ4VIR.mjs +2 -0
- package/dist/chunk-VBXMADMP.mjs +2 -0
- package/dist/chunk-VNV55RUA.mjs +2 -0
- package/dist/chunk-VPD2PS35.mjs +2 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-W4VKN3GF.mjs +7 -0
- package/dist/chunk-W5BXXPDJ.mjs +3 -0
- package/dist/chunk-W7XHE4CT.mjs +2 -0
- package/dist/chunk-XNROSH2T.mjs +4 -0
- package/dist/chunk-XUNHRCOG.mjs +6 -0
- package/dist/chunk-Y34NR5JL.mjs +2 -0
- package/dist/chunk-Y6RLRPG3.mjs +3 -0
- package/dist/chunk-YEY3RSFQ.mjs +2 -0
- package/dist/cli.mjs +2 -0
- package/dist/server.mjs +2 -0
- package/dist/worker.mjs +5 -0
- package/kit/charts.js +355 -0
- package/kit/code.js +164 -0
- package/kit/dialogs.js +157 -0
- package/kit/math.js +2004 -0
- package/kit/report.css +2932 -0
- package/kit/runtime.js +1782 -0
- package/kit/sheets.js +123 -0
- package/kit/state.js +217 -0
- package/kit/tables.js +1499 -0
- package/kit/tokens.js +29 -0
- package/kit/ui.js +658 -0
- package/package.json +41 -4
- package/release.json +25 -0
- package/sdk/column-widths.d.ts +56 -0
- package/sdk/doc-charts.d.ts +82 -0
- package/sdk/doc-code.d.ts +28 -0
- package/sdk/doc-dialogs.d.ts +4 -0
- package/sdk/doc-kit.d.ts +147 -0
- package/sdk/doc-math.d.ts +3 -0
- package/sdk/doc-sheets.d.ts +15 -0
- package/sdk/doc-state.d.ts +41 -0
- package/sdk/doc-tables.d.ts +24 -0
- package/sdk/doc-tokens.d.ts +22 -0
- package/sdk/index.d.ts +30 -0
- package/skill/SKILL.md +150 -0
- package/skill/agents/openai.yaml +5 -0
- package/skill/references/building-components.md +367 -0
- package/skill/references/example-report.html +356 -0
- package/skill/references/writing-html.md +187 -0
- package/skill/sdk/column-widths.d.ts +56 -0
- package/skill/sdk/doc-charts.d.ts +82 -0
- package/skill/sdk/doc-code.d.ts +28 -0
- package/skill/sdk/doc-dialogs.d.ts +4 -0
- package/skill/sdk/doc-kit.d.ts +147 -0
- package/skill/sdk/doc-math.d.ts +3 -0
- package/skill/sdk/doc-sheets.d.ts +15 -0
- package/skill/sdk/doc-state.d.ts +41 -0
- package/skill/sdk/doc-tables.d.ts +24 -0
- package/skill/sdk/doc-tokens.d.ts +22 -0
- package/skill/sdk/index.d.ts +30 -0
- package/starter/doc.html +21 -0
- package/starter/doc.json +5 -0
- package/vendor/d3.v7.9.0.min.js +2 -0
- package/vendor/katex/auto-render.min.js +1 -0
- package/vendor/katex/contrib/mhchem.min.js +1 -0
- package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/vendor/katex/katex.min.css +1 -0
- package/vendor/katex/katex.min.js +1 -0
- package/vendor/pdfjs/LICENSE +177 -0
- package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
- package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
- package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/vendor/types/@types/d3/LICENSE +21 -0
- package/vendor/types/@types/d3/index.d.ts +39 -0
- package/vendor/types/@types/d3/package.json +81 -0
- package/vendor/types/@types/d3-array/LICENSE +21 -0
- package/vendor/types/@types/d3-array/index.d.ts +1118 -0
- package/vendor/types/@types/d3-array/package.json +56 -0
- package/vendor/types/@types/d3-axis/LICENSE +21 -0
- package/vendor/types/@types/d3-axis/index.d.ts +293 -0
- package/vendor/types/@types/d3-axis/package.json +47 -0
- package/vendor/types/@types/d3-brush/LICENSE +21 -0
- package/vendor/types/@types/d3-brush/index.d.ts +255 -0
- package/vendor/types/@types/d3-brush/package.json +42 -0
- package/vendor/types/@types/d3-chord/LICENSE +21 -0
- package/vendor/types/@types/d3-chord/index.d.ts +471 -0
- package/vendor/types/@types/d3-chord/package.json +40 -0
- package/vendor/types/@types/d3-color/LICENSE +21 -0
- package/vendor/types/@types/d3-color/index.d.ts +669 -0
- package/vendor/types/@types/d3-color/package.json +55 -0
- package/vendor/types/@types/d3-contour/LICENSE +21 -0
- package/vendor/types/@types/d3-contour/index.d.ts +222 -0
- package/vendor/types/@types/d3-contour/package.json +38 -0
- package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
- package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
- package/vendor/types/@types/d3-delaunay/package.json +30 -0
- package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
- package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
- package/vendor/types/@types/d3-dispatch/package.json +51 -0
- package/vendor/types/@types/d3-drag/LICENSE +21 -0
- package/vendor/types/@types/d3-drag/index.d.ts +395 -0
- package/vendor/types/@types/d3-drag/package.json +42 -0
- package/vendor/types/@types/d3-dsv/LICENSE +21 -0
- package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
- package/vendor/types/@types/d3-dsv/package.json +45 -0
- package/vendor/types/@types/d3-ease/LICENSE +21 -0
- package/vendor/types/@types/d3-ease/index.d.ts +316 -0
- package/vendor/types/@types/d3-ease/package.json +40 -0
- package/vendor/types/@types/d3-fetch/LICENSE +21 -0
- package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
- package/vendor/types/@types/d3-fetch/package.json +37 -0
- package/vendor/types/@types/d3-force/LICENSE +21 -0
- package/vendor/types/@types/d3-force/index.d.ts +899 -0
- package/vendor/types/@types/d3-force/package.json +45 -0
- package/vendor/types/@types/d3-format/LICENSE +21 -0
- package/vendor/types/@types/d3-format/index.d.ts +337 -0
- package/vendor/types/@types/d3-format/package.json +45 -0
- package/vendor/types/@types/d3-geo/LICENSE +21 -0
- package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
- package/vendor/types/@types/d3-geo/package.json +48 -0
- package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
- package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
- package/vendor/types/@types/d3-hierarchy/package.json +50 -0
- package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
- package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
- package/vendor/types/@types/d3-interpolate/package.json +47 -0
- package/vendor/types/@types/d3-path/LICENSE +21 -0
- package/vendor/types/@types/d3-path/index.d.ts +108 -0
- package/vendor/types/@types/d3-path/package.json +41 -0
- package/vendor/types/@types/d3-polygon/LICENSE +21 -0
- package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
- package/vendor/types/@types/d3-polygon/package.json +40 -0
- package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
- package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
- package/vendor/types/@types/d3-quadtree/package.json +45 -0
- package/vendor/types/@types/d3-random/LICENSE +21 -0
- package/vendor/types/@types/d3-random/index.d.ts +313 -0
- package/vendor/types/@types/d3-random/package.json +41 -0
- package/vendor/types/@types/d3-scale/LICENSE +21 -0
- package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
- package/vendor/types/@types/d3-scale/package.json +53 -0
- package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
- package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
- package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
- package/vendor/types/@types/d3-selection/LICENSE +21 -0
- package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
- package/vendor/types/@types/d3-selection/package.json +56 -0
- package/vendor/types/@types/d3-shape/LICENSE +21 -0
- package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
- package/vendor/types/@types/d3-shape/package.json +53 -0
- package/vendor/types/@types/d3-time/LICENSE +21 -0
- package/vendor/types/@types/d3-time/index.d.ts +697 -0
- package/vendor/types/@types/d3-time/package.json +46 -0
- package/vendor/types/@types/d3-time-format/LICENSE +21 -0
- package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
- package/vendor/types/@types/d3-time-format/package.json +40 -0
- package/vendor/types/@types/d3-timer/LICENSE +21 -0
- package/vendor/types/@types/d3-timer/index.d.ts +68 -0
- package/vendor/types/@types/d3-timer/package.json +45 -0
- package/vendor/types/@types/d3-transition/LICENSE +21 -0
- package/vendor/types/@types/d3-transition/index.d.ts +664 -0
- package/vendor/types/@types/d3-transition/package.json +47 -0
- package/vendor/types/@types/d3-zoom/LICENSE +21 -0
- package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
- package/vendor/types/@types/d3-zoom/package.json +48 -0
- package/vendor/types/@types/geojson/LICENSE +21 -0
- package/vendor/types/@types/geojson/index.d.ts +202 -0
- package/vendor/types/@types/geojson/package.json +46 -0
- package/vendor/typescript/LICENSE.txt +55 -0
- package/vendor/typescript/lib.decorators.d.ts +384 -0
- package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
- package/vendor/typescript/lib.dom.d.ts +39429 -0
- package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
- package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
- package/vendor/typescript/lib.es2015.core.d.ts +597 -0
- package/vendor/typescript/lib.es2015.d.ts +28 -0
- package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
- package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
- package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
- package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
- package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
- package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
- package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
- package/vendor/typescript/lib.es2016.d.ts +21 -0
- package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
- package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
- package/vendor/typescript/lib.es2017.d.ts +26 -0
- package/vendor/typescript/lib.es2017.date.d.ts +31 -0
- package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
- package/vendor/typescript/lib.es2017.object.d.ts +49 -0
- package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
- package/vendor/typescript/lib.es2017.string.d.ts +45 -0
- package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
- package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
- package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
- package/vendor/typescript/lib.es2018.d.ts +24 -0
- package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
- package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
- package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
- package/vendor/typescript/lib.es2019.array.d.ts +79 -0
- package/vendor/typescript/lib.es2019.d.ts +24 -0
- package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
- package/vendor/typescript/lib.es2019.object.d.ts +33 -0
- package/vendor/typescript/lib.es2019.string.d.ts +37 -0
- package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
- package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
- package/vendor/typescript/lib.es2020.d.ts +27 -0
- package/vendor/typescript/lib.es2020.date.d.ts +42 -0
- package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
- package/vendor/typescript/lib.es2020.number.d.ts +28 -0
- package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
- package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
- package/vendor/typescript/lib.es2020.string.d.ts +44 -0
- package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/vendor/typescript/lib.es2021.d.ts +23 -0
- package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
- package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
- package/vendor/typescript/lib.es2021.string.d.ts +33 -0
- package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
- package/vendor/typescript/lib.es2022.array.d.ts +121 -0
- package/vendor/typescript/lib.es2022.d.ts +25 -0
- package/vendor/typescript/lib.es2022.error.d.ts +75 -0
- package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
- package/vendor/typescript/lib.es2022.object.d.ts +26 -0
- package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
- package/vendor/typescript/lib.es2022.string.d.ts +25 -0
- package/vendor/typescript/lib.es5.d.ts +4601 -0
- package/vendor/typescript/package.json +4 -0
- package/vendor/typescript/typescript.js +446 -0
- package/web/assets/index-Bh74DfsV.css +1 -0
- package/web/assets/index-UW0RyFFt.js +13 -0
- package/web/index.html +14 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// How a table's cells are read as numbers: the one reading of the kit (src/render/kit/tables/
|
|
2
|
+
// cells.js: its numeric columns, centered and sorted by number, and the values a sort compares) and
|
|
3
|
+
// the page editor (src/editor/components/table/index.mjs: 一键优化's header column is a column of
|
|
4
|
+
// names, so none of its cells is a number; page/table/index.mjs sortRows sorts by parsedValue).
|
|
5
|
+
// A column is a number column only when every cell holds one, so what counts as a number is decided here and nowhere else.
|
|
6
|
+
|
|
7
|
+
/** What a cell holds in the way of a value: its sort value when it has one, else its words. */
|
|
8
|
+
export function rawCellValue(cell) {
|
|
9
|
+
return (cell?.dataset.sortValue ?? cell?.textContent ?? "").trim();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// A cell that holds no value: it does not disqualify a column of numbers (a dash is also what a
|
|
13
|
+
// minus sign alone reads as, below).
|
|
14
|
+
const missingValues = new Set(["", "-", "—", "–", "−", "n/a", "na", "null"]);
|
|
15
|
+
|
|
16
|
+
export function isMissingValue(raw) {
|
|
17
|
+
return missingValues.has(raw.toLowerCase());
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// A number as tables write it: a qualifier before it (约, ≈, ~, <, ≥ …), a sign, a currency, digits
|
|
21
|
+
// grouped by commas (in thousands or ten-thousands) or spaces, a decimal part (a point with no digit
|
|
22
|
+
// after it too: "1." is 1, as a number being typed reads), an exponent, then a percent, a multiplier
|
|
23
|
+
// or a unit (12.5%, 3.4亿, 120 ms, 50 元/月); a range (3–5, 3~5 天) reads as its first number, an
|
|
24
|
+
// accountant's negative ((12)) as -12; 千, 万 and 亿 scale it (1.2万 is 12000). Full-width
|
|
25
|
+
// characters (12,345%) read as their ASCII, a Unicode minus or dash as a minus.
|
|
26
|
+
const QUALIFIER = String.raw`(?:约|大约|近|超过|不足|≈|~|<=?|>=?|≤|≥|±)?`;
|
|
27
|
+
const AMOUNT = String.raw`[$¥€£₩₹]?\s*((?:\d{1,3}(?:[,\s\u00a0\u2009]\d{3})+|\d{1,4}(?:,\d{4})+|\d+)(?:\.\d*)?(?:e[+-]?\d+)?|\.\d+)`;
|
|
28
|
+
const UNIT = String.raw`((?:[%‰x×]|[A-Za-zµμ\u4e00-\u9fff°℃]+(?:\/[A-Za-zµμ\u4e00-\u9fff°℃·]+)?)?)`;
|
|
29
|
+
/** What a unit's first character scales its number by (1.2万 is 12000): such a unit is its base unit (3.6亿元: 元) in that scale. */
|
|
30
|
+
export const UNIT_SCALES = { 千: 1e3, 万: 1e4, 亿: 1e8 };
|
|
31
|
+
const SCALE = UNIT_SCALES;
|
|
32
|
+
const SINGLE = new RegExp(`^${QUALIFIER}\\s*([+-]?)\\s*${AMOUNT}\\s*${UNIT}$`, "i");
|
|
33
|
+
const RANGE = new RegExp(`^([+-]?)\\s*${AMOUNT}\\s*${UNIT}\\s*(?:-|~|至|到)\\s*[+-]?\\s*${AMOUNT}\\s*${UNIT}$`, "i");
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* How a cell's words write a number (read as above): { value, written, unit }, `value` the number
|
|
37
|
+
* they hold (3.6亿 is 360000000), `written` the number before its unit scales it (3.6), `unit` what
|
|
38
|
+
* follows it as written ("亿", "%", "ms"; "" for none; a range's first), and `range: true` for a range
|
|
39
|
+
* (its first number: a sort's value, which a chart, drawing one number a cell, does not take). Null
|
|
40
|
+
* when they hold none.
|
|
41
|
+
*/
|
|
42
|
+
export function numberReading(raw) {
|
|
43
|
+
let text = raw.normalize("NFKC").trim().replace(/[−–—]/g, "-");
|
|
44
|
+
const accounting = /^\((.+)\)$/.exec(text);
|
|
45
|
+
if (accounting) text = accounting[1].trim();
|
|
46
|
+
const single = SINGLE.exec(text);
|
|
47
|
+
const match = single ?? RANGE.exec(text);
|
|
48
|
+
if (!match) return null;
|
|
49
|
+
const value = Number(`${match[1]}${match[2].replace(/[,\s\u00a0\u2009]/g, "")}`);
|
|
50
|
+
const written = accounting ? -value : value;
|
|
51
|
+
const unit = match[3] ?? "";
|
|
52
|
+
const scaled = written * (SCALE[unit[0]] ?? 1);
|
|
53
|
+
if (!Number.isFinite(scaled)) return null;
|
|
54
|
+
return single ? { value: scaled, written, unit } : { value: scaled, written, unit, range: true };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The number a cell's words hold (read as above), or null. */
|
|
58
|
+
export function numberValue(raw) {
|
|
59
|
+
return numberReading(raw)?.value ?? null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The numbers a cell holds: one (12.5%), or several told apart by a slash (3 / 4), or null when it is none. */
|
|
63
|
+
export function numericParts(cell) {
|
|
64
|
+
const raw = rawCellValue(cell);
|
|
65
|
+
if (isMissingValue(raw)) return null;
|
|
66
|
+
|
|
67
|
+
const scalar = numberValue(raw);
|
|
68
|
+
if (scalar !== null) return [scalar];
|
|
69
|
+
|
|
70
|
+
const tokens = raw.split(/\s*\/\s*/);
|
|
71
|
+
if (tokens.length < 2) return null;
|
|
72
|
+
const values = tokens.map(numberValue);
|
|
73
|
+
return values.every((value) => value !== null) ? values : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The value a sort reads from a cell: a number ("number"), a date ("date") or its words; null when it is missing (or no number, no date). */
|
|
77
|
+
export function parsedValue(cell, type) {
|
|
78
|
+
const raw = rawCellValue(cell);
|
|
79
|
+
if (isMissingValue(raw)) return null;
|
|
80
|
+
|
|
81
|
+
if (type === "number") {
|
|
82
|
+
const values = numericParts(cell);
|
|
83
|
+
return values?.length === 1 ? values[0] : null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (type === "date") {
|
|
87
|
+
const value = Date.parse(raw);
|
|
88
|
+
return Number.isFinite(value) ? value : null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return raw;
|
|
92
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// The format's old names, made new (2026-10-26). Until then the HTML a report is written in named
|
|
2
|
+
// its kit with "report": classes report-*, attributes data-report-*, custom properties --report-*,
|
|
3
|
+
// globals and SDK types Report*, events report-*-change. They are doc-*, data-doc-*, --doc-* and
|
|
4
|
+
// Doc* now (docs/render.md, "Names"). A file written before, an Agent that still writes the old
|
|
5
|
+
// names (the user's own 写作偏好 may teach them for good) and an export made before all keep
|
|
6
|
+
// working: the tools read a report's text through newNames (new-names.mjs) where they already make
|
|
7
|
+
// its natural HTML the kit's (source/natural.mjs naturalize: the preview before showing it, the
|
|
8
|
+
// first edit, gallery check, build, export and ids, gallery import) and where they read a page of
|
|
9
|
+
// Gallery's own made elsewhere (an import of an export, a paste: newDomNames below), so every reader past those reads the new names
|
|
10
|
+
// only, and a file takes them the next time a tool writes it. The kit's runtime answers to the old
|
|
11
|
+
// globals too (window.ReportCharts is DocCharts), for a script of the report's folder that no
|
|
12
|
+
// tool rewrites.
|
|
13
|
+
//
|
|
14
|
+
// The old names are a closed set: those the kit had on 2026-10-26 (the rename's table), never one
|
|
15
|
+
// added since. A class written report-<name> of none of them (a typo) is left as written, for the
|
|
16
|
+
// checks to say as the file writes it (component-checks.mjs). An id the report spelled as an old
|
|
17
|
+
// name (id="report-summary") is renamed with everything of the file that names it (its selectors and
|
|
18
|
+
// script strings, href="#…", for, aria-*), so they still meet; inside the report's own <style> and
|
|
19
|
+
// <script> a whole old name is renamed wherever it stands, their comments too. Nothing else of the
|
|
20
|
+
// file changes: its text and comments, other ids, slugs (report-2) and paths (assets/report-chart.png)
|
|
21
|
+
// stay as written; what the product is named after (gallery, html-report-studio, /__gallery/edit/) is no name
|
|
22
|
+
// of the format.
|
|
23
|
+
|
|
24
|
+
/** The kit's old class, keyframe, event and meta names: report-<name> for each, now doc-<name>. */
|
|
25
|
+
export const OLD_NAMES = new Set([
|
|
26
|
+
"accent", "align-", "align-center", "align-left", "align-right", "annotations-changed", "assets-changed", "bar", "bar-series", "bar-shares",
|
|
27
|
+
"bold", "bookmark", "bookmark-card", "bookmark-cover", "bookmark-description", "bookmark-href", "bookmark-icon", "bookmark-text",
|
|
28
|
+
"bookmark-title", "bookmark-url", "button", "callout", "card", "chart", "chart-message", "charts", "checks", "checks-layout", "checks-live",
|
|
29
|
+
"code", "code--folded", "code--nowrap", "code--wrap", "code-block", "code-card", "code-content", "code-copy", "code-fold", "code-header",
|
|
30
|
+
"code-language", "code-line", "code-line--", "code-line--added", "code-line--folded", "code-line--hidden", "code-line--removed",
|
|
31
|
+
"code-line-fold", "code-line-more", "code-lines", "code-range", "code-run", "code-separator", "code-title", "code-toolbar", "code-tools",
|
|
32
|
+
"code-wrap", "column", "columns", "details", "details-content", "details-summary-label", "dialog", "dialog-close", "dialog-content",
|
|
33
|
+
"dialog-fade", "dialog-header", "dialog-in", "dialog-open", "dialog-panel", "dialog-title", "dialog-trigger", "dialogs", "diff", "diff-",
|
|
34
|
+
"diff-added", "diff-body", "diff-removed", "diff-stats", "display", "display-button", "display-check", "display-header", "display-icon",
|
|
35
|
+
"display-item", "display-label", "display-menu", "display-section", "display-switch", "edit-map", "embed", "embed--file", "embed-frame",
|
|
36
|
+
"export-copy-done", "export-id", "export-source", "figure", "figure--compact", "figure-caption", "file", "file-link", "file-name",
|
|
37
|
+
"file-size", "filter", "filter-button", "filter-row", "flow", "flow-right", "grid", "grid-3", "header", "hero", "highlight", "highlight-",
|
|
38
|
+
"highlight-blue", "highlight-brown", "highlight-gray", "highlight-green", "highlight-orange", "highlight-pink", "highlight-purple",
|
|
39
|
+
"highlight-red", "highlight-yellow", "icon", "image", "image--center", "image--left", "image--right", "image--wide", "image-like", "kicker",
|
|
40
|
+
"kit-error", "layout-change", "lead", "lede", "legend", "link-mention", "link-mention-icon", "link-mention-title", "math", "math-",
|
|
41
|
+
"math-block", "math-break", "math-inline", "math-joiner", "math-tie", "note", "page", "panel", "pie-", "pie-center", "pie-labels",
|
|
42
|
+
"pie-slice", "pie-slices", "plot-clip", "plot-clip-", "prose", "prose-h1", "prose-h2", "prose-h3", "prose-h4", "range", "reference-legend",
|
|
43
|
+
"reveal", "scrollbar", "scrollbar--x", "scrollbar--y", "scrollbar-thumb", "scrollbars", "scrollbars-frame", "section",
|
|
44
|
+
"section--no-divider", "section-header", "sheet-dock", "sheet-shell", "sheet-shell--plain", "sheet-tab", "sheet-tabs", "sheets", "sheets-",
|
|
45
|
+
"source", "source-changed", "state", "state-actions", "state-field", "state-fields", "state-grid", "state-group", "state-list",
|
|
46
|
+
"state-status", "summary", "swatch", "tab", "table", "table--auto", "table--full", "table--sticky-first", "table-meta", "table-sort",
|
|
47
|
+
"table-sort-button", "table-wrap", "tables", "text-", "text-blue", "text-brown", "text-cyan", "text-gray", "text-green", "text-orange",
|
|
48
|
+
"text-pink", "text-purple", "text-red", "text-teal", "text-yellow", "theme-change", "theme-request", "title", "todo", "tokens", "tooltip",
|
|
49
|
+
"tooltip-row", "underline-", "underline-blue", "underline-orange", "underline-plain", "underline-purple", "underline-thick",
|
|
50
|
+
"underline-thin", "valign-", "valign-bottom", "valign-middle", "valign-top", "zoom", "zoom-", "zoom-caption", "zoom-close", "zoom-fade",
|
|
51
|
+
"zoom-grow", "zoom-gutter", "zoom-hover", "zoom-open", "zoom-picture",
|
|
52
|
+
]);
|
|
53
|
+
|
|
54
|
+
/** The kit's old globals and SDK types: Report<name> for each, now Doc<name>. */
|
|
55
|
+
export const OLD_GLOBALS = [
|
|
56
|
+
"ChartBaseOptions", "ChartDrawContext", "ChartHandle", "ChartPart", "ChartPartContext", "Charts", "ChartsApi", "ChartState", "Code",
|
|
57
|
+
"Dialogs", "DialogsApi", "DotDatum", "DrawnChartHandle", "Kit", "Math", "MathApi", "PieDatum", "SharedChartOptions", "SharedChartType",
|
|
58
|
+
"Sheets", "SheetsApi", "SheetsHandle", "SortDirection", "SortType", "State", "StateChange", "StateFactory", "StateOptions",
|
|
59
|
+
"TableChartChoices", "TableChartOptions", "TableChoices", "Tables", "TablesApi", "TableSeriesChoices", "TableSortDetail", "TableState",
|
|
60
|
+
"Tokens", "TokensApi", "TokenSnapshot", "ValueFormat",
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
// A name of the old set where it stands as a whole (a class, a selector's, a keyframe's, an event's,
|
|
64
|
+
// an id's, a string's), never inside another word (html-report-studio, x-report-studio-*, x-gallery-*) and never
|
|
65
|
+
// a file's name (assets/report-chart.png, report-chart.png: a path stays as the folder has it).
|
|
66
|
+
const FILE_TYPE = "png|jpe?g|gif|svg|webp|avif|bmp|ico|css|js|mjs|cjs|ts|json|html?|xml|pdf|csv|tsv|txt|md|woff2?|ttf|otf|mp4|webm|mov|mp3|wav|ogg|zip";
|
|
67
|
+
const NAME = new RegExp(String.raw`(?<![\w$/-])report-([a-z0-9]+(?:-{1,2}[a-z0-9]+)*-{0,2})(?![\w-])(?!\.(?:${FILE_TYPE})(?![\w-]))`, "g");
|
|
68
|
+
// The SDK's files were report-*.d.ts (sdk/report-charts.d.ts): a script's type import names them by path.
|
|
69
|
+
const SDK_FILE = /(\bsdk\/)report-(?=[a-z])/g;
|
|
70
|
+
// An id named where an attribute points to one (href="#report-summary", data-doc-dialog-open="#…",
|
|
71
|
+
// fill="url(#report-grad)"): its old name new, as the id's own is (ID_LISTS).
|
|
72
|
+
const ID_REFERENCE = /(?<=^|[\s(,'"=])#report-([a-z0-9]+(?:-{1,2}[a-z0-9]+)*)(?![\w-])/g;
|
|
73
|
+
// The attributes whose value is ids (an element's own, or those it points to).
|
|
74
|
+
const ID_LISTS = /^(?:id|for|headers|list|form|aria-(?:labelledby|describedby|controls|owns|activedescendant|details|errormessage|flowto))$/i;
|
|
75
|
+
const ATTRIBUTE = /(?<![\w-])data-report-(?=[\w$])/gi;
|
|
76
|
+
const PROPERTY = /(?<![\w-])--report-(?=[\w$])/gi;
|
|
77
|
+
const DATASET = /\b(dataset\??\.)report(?=[A-Z])/g;
|
|
78
|
+
const GLOBAL = new RegExp(`\\bReport(?=(?:${[...OLD_GLOBALS].sort((a, b) => b.length - a.length).join("|")})\\b)`, "g");
|
|
79
|
+
const FONT = /\bReport Segoe\b/g; // the kit's alias of Segoe UI (styles/tokens.css)
|
|
80
|
+
// What a text needs to hold for any of these to be in it: most files hold none, and are not parsed.
|
|
81
|
+
const ANY = /report-|Report(?:[A-Z]| Segoe)|\.report[A-Z]/;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Whether a class is in the kit's namespace: doc-*, or report-* left as written (none of the old set:
|
|
85
|
+
* a typo of an old name), which the checks say as the kit's (no class of its, did you mean …), never
|
|
86
|
+
* taking it for a class of the report's own.
|
|
87
|
+
*/
|
|
88
|
+
export const kitNamespace = (name) => /^(?:doc|report)-/.test(name);
|
|
89
|
+
|
|
90
|
+
/** A name in the kit's namespace as the kit's new names spell it (report-calout: doc-calout), to compare. */
|
|
91
|
+
export const asDocName = (name) => name.replace(/^report-/, "doc-");
|
|
92
|
+
|
|
93
|
+
/** Whether a text may hold an old name: most hold none, and need not be read again. */
|
|
94
|
+
export const mayHoldOldNames = (text) => ANY.test(text);
|
|
95
|
+
|
|
96
|
+
/** A class attribute's value (or a list of classes, a meta's name) with its old names new: those of the old set alone. */
|
|
97
|
+
export const newClassNames = (text) => text.replace(NAME, (whole, name) => (OLD_NAMES.has(name) ? `doc-${name}` : whole));
|
|
98
|
+
|
|
99
|
+
/** An attribute's name with its old prefix new (data-report-id: data-doc-id). */
|
|
100
|
+
export const newAttributeName = (name) => name.replace(ATTRIBUTE, "data-doc-");
|
|
101
|
+
|
|
102
|
+
/** A text's custom properties new (--report-ink: --doc-ink), as any attribute's value may name them (an SVG's fill). */
|
|
103
|
+
export const newProperties = (text) => text.replace(PROPERTY, "--doc-");
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* An attribute's value with the old names new, by what the attribute holds: a class list (a meta's
|
|
107
|
+
* name too), ids (id, for, aria-labelledby …: an id spelled as an old name is renamed with the
|
|
108
|
+
* selectors and script strings that name it, so they still meet), a style, or anything else (custom
|
|
109
|
+
* properties, and an id it points to: href="#report-summary"). Code (on*, javascript:) is the caller's.
|
|
110
|
+
*/
|
|
111
|
+
export const newAttributeValue = (name, value, tag) => (name === "class" || (name === "name" && tag === "meta") || ID_LISTS.test(name)
|
|
112
|
+
? newClassNames(value)
|
|
113
|
+
: name === "style" ? newStyleNames(value)
|
|
114
|
+
: newProperties(value).replace(ID_REFERENCE, (whole, old) => (OLD_NAMES.has(old) ? `#doc-${old}` : whole)));
|
|
115
|
+
|
|
116
|
+
const names = newClassNames;
|
|
117
|
+
const properties = newProperties;
|
|
118
|
+
|
|
119
|
+
/** A stylesheet's text (a <style>'s, a style attribute's) with the old names new. */
|
|
120
|
+
export const newStyleNames = (text) => properties(names(text.replace(ATTRIBUTE, "data-doc-").replace(FONT, "Doc Segoe")));
|
|
121
|
+
|
|
122
|
+
/** A script's text (a <script>'s, an on* attribute's, a javascript: address) with the old names new. */
|
|
123
|
+
export const newScriptNames = (text) => newStyleNames(text).replace(DATASET, "$1doc").replace(GLOBAL, "Doc").replace(SDK_FILE, "$1doc-");
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The old names in a DOM made new where they stand (what another program pasted: a page or an export
|
|
128
|
+
* of Gallery (HTML Report Studio then) made before 2026-10-26, its classes and attributes as its page had them): every
|
|
129
|
+
* element under `root`, its data-report-* attributes and their values (classes, ids and what points
|
|
130
|
+
* to one, style, custom properties: newAttributeValue). Text is left as it is.
|
|
131
|
+
*/
|
|
132
|
+
export function newDomNames(root) {
|
|
133
|
+
for (const element of root.querySelectorAll("*")) {
|
|
134
|
+
for (const { name, value } of [...element.attributes]) {
|
|
135
|
+
const renamed = newAttributeName(name);
|
|
136
|
+
const next = newAttributeValue(name, value, element.localName);
|
|
137
|
+
if (renamed === name && next === value) continue;
|
|
138
|
+
if (renamed !== name) element.removeAttribute(name);
|
|
139
|
+
element.setAttribute(renamed, next);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return root;
|
|
143
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { writeAtomic } from "./files.mjs";
|
|
5
|
+
import { layoutOf, listDocumentSlugs, pageSlug, slugPattern } from "./workspace.mjs";
|
|
6
|
+
|
|
7
|
+
// The workspace's outline: which document sits under which, in what order (the sidebar's tree,
|
|
8
|
+
// <workspace>/.gallery/outline.json, docs/workbench.md "Workspace commands"):
|
|
9
|
+
// { version: 1, children: { "": [top-level slugs], "<slug>": [slugs under it] } }
|
|
10
|
+
// Hierarchy and order only: a document's folder never moves with it, and no file of a document
|
|
11
|
+
// names where it is (links between documents are relative links between their files). Read, it
|
|
12
|
+
// lists every document of the workspace once but the 写作偏好 page (listed apart, in .gallery/pages/):
|
|
13
|
+
// slugs that are gone drop out, documents it does not know yet come last at the top.
|
|
14
|
+
// Written by the workspace's server (src/workbench/service.mjs: the workbench's moves, a new, copied,
|
|
15
|
+
// restored or imported document, gallery new --under and gallery move while it runs, in the queue its
|
|
16
|
+
// saves go through), and by a gallery command when no server runs (src/cli/tree.mjs), with the same
|
|
17
|
+
// functions, each change read, made and written under the outline's lock (withOutlineLock: a file
|
|
18
|
+
// that two processes cannot both make), so that two writers never lose each other's change.
|
|
19
|
+
|
|
20
|
+
/** The outline file's lock (.gallery/outline.lock): who holds it, until when it counts. */
|
|
21
|
+
const LOCK_STALE = 10_000; // a lock older than this was left by a process that ended: taken over
|
|
22
|
+
const LOCK_WAIT = 15_000;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Run `task` holding the outline's lock of workspace `root`: a file made with "wx", which one
|
|
26
|
+
* process alone can make, removed after; one older than 10 s is a crashed writer's and is taken over.
|
|
27
|
+
* Waits for it 15 s at most, then takes it all the same (a writer that holds it that long holds
|
|
28
|
+
* nothing any more).
|
|
29
|
+
*/
|
|
30
|
+
export async function withOutlineLock(root, task) {
|
|
31
|
+
const { gallery } = layoutOf(root);
|
|
32
|
+
const lock = path.join(gallery, "outline.lock");
|
|
33
|
+
const mine = `${process.pid} ${randomBytes(4).toString("hex")}`;
|
|
34
|
+
await fs.mkdir(gallery, { recursive: true });
|
|
35
|
+
for (const until = Date.now() + LOCK_WAIT; ;) {
|
|
36
|
+
try {
|
|
37
|
+
await fs.writeFile(lock, mine, { flag: "wx" });
|
|
38
|
+
break;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error.code !== "EEXIST") throw error;
|
|
41
|
+
const age = await fs.stat(lock).then(({ mtimeMs }) => Date.now() - mtimeMs, () => 0);
|
|
42
|
+
if (age > LOCK_STALE || Date.now() > until) await fs.rm(lock, { force: true });
|
|
43
|
+
else await new Promise((resolve) => setTimeout(resolve, 20));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
return await task();
|
|
48
|
+
} finally {
|
|
49
|
+
// Removed only while it is still this writer's (one taken over meanwhile is the next writer's).
|
|
50
|
+
if ((await fs.readFile(lock, "utf8").catch(() => null)) === mine) await fs.rm(lock, { force: true });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const readJson = (file) => fs.readFile(file, "utf8").then(JSON.parse).catch(() => null);
|
|
55
|
+
|
|
56
|
+
/** The outline of workspace `root` as it is read: every document but the 写作偏好 page once (above). */
|
|
57
|
+
export async function readOutline(root) {
|
|
58
|
+
return (await outlineAndFile(root)).outline;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The outline as it is read and what its file holds: { outline, stored: the file's children, or null }.
|
|
63
|
+
* A change is written when what it makes is not what the file holds (writtenAs), a document the file
|
|
64
|
+
* does not hold yet too (one made since, listed last at the top only as it is read), so that the file
|
|
65
|
+
* keeps every place a command or the workbench gave.
|
|
66
|
+
*/
|
|
67
|
+
export async function outlineAndFile(root) {
|
|
68
|
+
const instructions = await pageSlug(root);
|
|
69
|
+
const slugs = (await listDocumentSlugs(root)).filter((slug) => slug !== instructions);
|
|
70
|
+
const stored = await readJson(layoutOf(root).outline);
|
|
71
|
+
const outline = { version: 1, children: ordered(stored, slugs) };
|
|
72
|
+
return { outline, stored: stored?.children ?? null };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Whether `children` is what the outline's file holds (`stored`, outlineAndFile's): the same lists
|
|
77
|
+
* (an empty one as none), in whatever order the file has its keys. Also whether an outline a
|
|
78
|
+
* workbench changed (POST outline's `base`) is the one read now.
|
|
79
|
+
*/
|
|
80
|
+
export function writtenAs(children, stored) {
|
|
81
|
+
if (!stored || typeof stored !== "object") return false;
|
|
82
|
+
const lists = (value) => Object.keys(value).filter((key) => Array.isArray(value[key]) && value[key].length > 0);
|
|
83
|
+
const [ours, theirs] = [lists(children), lists(stored)];
|
|
84
|
+
return ours.length === theirs.length && ours.every((key) => JSON.stringify(children[key]) === JSON.stringify(stored[key]));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The outline's children of the documents `slugs`, in the order `stored` (the file's value) gives.
|
|
88
|
+
function ordered(stored, slugs) {
|
|
89
|
+
const children = { "": [] };
|
|
90
|
+
const seen = new Set();
|
|
91
|
+
const place = (parent) => {
|
|
92
|
+
for (const slug of stored?.children?.[parent] ?? []) {
|
|
93
|
+
if (!slugs.includes(slug) || seen.has(slug)) continue;
|
|
94
|
+
seen.add(slug);
|
|
95
|
+
(children[parent] ??= []).push(slug);
|
|
96
|
+
place(slug);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
place("");
|
|
100
|
+
for (const slug of slugs) if (!seen.has(slug)) children[""].push(slug);
|
|
101
|
+
return children;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Whether `value` is an outline to store: each document at most once, never under itself. */
|
|
105
|
+
export function validOutline(value) {
|
|
106
|
+
const children = value?.children;
|
|
107
|
+
if (!children || typeof children !== "object" || Array.isArray(children)) return false;
|
|
108
|
+
const listed = new Set();
|
|
109
|
+
for (const [parent, list] of Object.entries(children)) {
|
|
110
|
+
if (parent !== "" && !slugPattern.test(parent)) return false;
|
|
111
|
+
if (!Array.isArray(list)) return false;
|
|
112
|
+
for (const slug of list) {
|
|
113
|
+
if (typeof slug !== "string" || !slugPattern.test(slug) || listed.has(slug) || slug === parent) return false;
|
|
114
|
+
listed.add(slug);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Write outline `value` ({ children }) of workspace `root` (.gallery/ made when there is none yet). */
|
|
121
|
+
export async function writeOutline(root, value) {
|
|
122
|
+
const file = layoutOf(root).outline;
|
|
123
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
124
|
+
return writeAtomic(file, `${JSON.stringify({ version: 1, children: value.children }, null, 2)}\n`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The document `slug` sits under in `children` ("" at the top), or null when the outline holds it not. */
|
|
128
|
+
export function parentIn(children, slug) {
|
|
129
|
+
for (const [parent, list] of Object.entries(children)) if (list.includes(slug)) return parent;
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The documents above `slug` in `children`, from the top down (itself not among them). */
|
|
134
|
+
export function ancestorsIn(children, slug) {
|
|
135
|
+
const above = [];
|
|
136
|
+
for (let parent = parentIn(children, slug); parent; parent = parentIn(children, parent)) above.unshift(parent);
|
|
137
|
+
return above;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Every document under `slug` in `children` ("": all), depth first, in the sidebar's order. */
|
|
141
|
+
export function descendantsIn(children, slug) {
|
|
142
|
+
const found = [];
|
|
143
|
+
const walk = (parent) => (children[parent] ?? []).forEach((child) => { found.push(child); walk(child); });
|
|
144
|
+
walk(slug);
|
|
145
|
+
return found;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Document `slug` moved in `children` (an outline as read: changed in place) with the documents under
|
|
150
|
+
* it, to where `where` says: `parent` ("" the top; undefined: where it is now, or `after`'s parent),
|
|
151
|
+
* right after `after` (one of that parent's), first (`first`), else last. Resolves to { ok: true,
|
|
152
|
+
* moved: whether its place changed, parent, index, from: { parent, index } } or { ok: false, reason }:
|
|
153
|
+
* "missing" (no such document in the outline), "parent" (no such parent), "after" (no such document
|
|
154
|
+
* to go after), "level" (`after` is not under `parent`), "itself" (after itself), "inside" (under
|
|
155
|
+
* itself or one of the documents under it).
|
|
156
|
+
*/
|
|
157
|
+
export function moveIn(children, slug, { parent = undefined, after = null, first = false } = {}) {
|
|
158
|
+
const from = parentIn(children, slug);
|
|
159
|
+
if (from === null) return { ok: false, reason: "missing" };
|
|
160
|
+
let to = parent;
|
|
161
|
+
if (after !== null) {
|
|
162
|
+
if (after === slug) return { ok: false, reason: "itself" };
|
|
163
|
+
const its = parentIn(children, after);
|
|
164
|
+
if (its === null) return { ok: false, reason: "after" };
|
|
165
|
+
if (to !== undefined && to !== its) return { ok: false, reason: "level" };
|
|
166
|
+
to = its;
|
|
167
|
+
}
|
|
168
|
+
to ??= from;
|
|
169
|
+
if (to !== "" && parentIn(children, to) === null) return { ok: false, reason: "parent" };
|
|
170
|
+
if (to === slug || ancestorsIn(children, to).includes(slug)) return { ok: false, reason: "inside" };
|
|
171
|
+
const index = children[from].indexOf(slug);
|
|
172
|
+
children[from].splice(index, 1);
|
|
173
|
+
const list = (children[to] ??= []);
|
|
174
|
+
const at = after !== null ? list.indexOf(after) + 1 : first ? 0 : list.length;
|
|
175
|
+
list.splice(at, 0, slug);
|
|
176
|
+
for (const key of Object.keys(children)) if (key !== "" && children[key].length === 0) delete children[key];
|
|
177
|
+
return { ok: true, moved: to !== from || at !== index, parent: to, index: at, from: { parent: from, index } };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Move document `slug` of workspace `root` where `where` says (moveIn), under the outline's lock: the
|
|
182
|
+
* outline read, changed and written when that is not what its file holds (writtenAs: a move, or a
|
|
183
|
+
* document the file does not hold yet placed where it is read). Resolves to moveIn's answer, with
|
|
184
|
+
* `written`: whether the file was written.
|
|
185
|
+
*/
|
|
186
|
+
export function moveDocument(root, slug, where) {
|
|
187
|
+
return withOutlineLock(root, async () => {
|
|
188
|
+
const { outline, stored } = await outlineAndFile(root);
|
|
189
|
+
const result = moveIn(outline.children, slug, where);
|
|
190
|
+
const written = result.ok && !writtenAs(outline.children, stored);
|
|
191
|
+
if (written) await writeOutline(root, outline);
|
|
192
|
+
return { ...result, ...(result.ok ? { written } : {}) };
|
|
193
|
+
});
|
|
194
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { pageLink, pageOfLink } from "./page-links.mjs";
|
|
2
|
+
|
|
3
|
+
// A document's address, as a link, a paste or the address bar may write it (docs/workbench.md, "A
|
|
4
|
+
// document's addresses"), read in one place: { slug, block }, block null for the page itself. Pure: the
|
|
5
|
+
// link card, a paste, a click, the workbench's address and the checks all come here, and a click
|
|
6
|
+
// stays synchronous, for only one form asks for a list.
|
|
7
|
+
//
|
|
8
|
+
// In a file there is one form, an ordinary link between two ordinary files: ../<slug>/doc.html (an old
|
|
9
|
+
// document's ../<slug>/report.html), with #<block id> for a block; #<block id> within a page, which
|
|
10
|
+
// names no page and is no business of this module's. It holds no port and no title, and a slug in a
|
|
11
|
+
// file is no address a reader sees. On this computer's own host (127.0.0.1 or localhost) or as a path
|
|
12
|
+
// alone, a document is also /generated/<slug>.html (its page, with any query) and /<slug>/doc.html,
|
|
13
|
+
// each with #<block id>, and in a workbench's address /#<link>/<block id> and /#<link> (shared/page-links.mjs:
|
|
14
|
+
// its title's words and its page id), the one form a whole address is written in (fullAddress), the
|
|
15
|
+
// words as they are; a page id alone or a slug in its place reads as well. A workbench's address is the
|
|
16
|
+
// one form that needs `links` (pageLinks: a Map of slug to link), for only the list can say which
|
|
17
|
+
// document an id is or whether a name is a slug at all; given, `links` also turns away every slug it
|
|
18
|
+
// does not hold. Without it such an address is none here, and workbenchHash hands it to the workbench,
|
|
19
|
+
// which has the list. pageAddress reads no port, as a link outlives a server; but this computer runs
|
|
20
|
+
// other programs too, and other workspaces, whose folder of one name has one page id, so an address
|
|
21
|
+
// on another port (elsewhere) is a document's only if the list holds it, by its folder name or its
|
|
22
|
+
// link of now (addressOn).
|
|
23
|
+
|
|
24
|
+
const SLUG = "[a-z0-9]+(?:-[a-z0-9]+)*"; // shared/workspace.mjs slugPattern, which needs Node
|
|
25
|
+
const FILE = "(?:doc|report)\\.html";
|
|
26
|
+
const IN_FILE = new RegExp(`^\\.\\./(${SLUG})/${FILE}(?:#(.*))?$`);
|
|
27
|
+
const PAGE = new RegExp(`^/generated/(${SLUG})\\.html$`);
|
|
28
|
+
const OWN_FILE = new RegExp(`^/(${SLUG})/${FILE}$`);
|
|
29
|
+
const LOOPBACK = new Set(["127.0.0.1", "localhost"]);
|
|
30
|
+
const HOSTED = /^(?:https?:)?\/\//i;
|
|
31
|
+
|
|
32
|
+
/** A hash or a part of an address as words: as it is written where it is no good encoding. */
|
|
33
|
+
export const decoded = (text) => {
|
|
34
|
+
try {
|
|
35
|
+
return decodeURIComponent(text);
|
|
36
|
+
} catch {
|
|
37
|
+
return text;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// `text` as an address of this computer's own host, read as the page reads a path: a URL, or null.
|
|
42
|
+
function ownAddress(text) {
|
|
43
|
+
try {
|
|
44
|
+
const url = new URL(text, "http://127.0.0.1");
|
|
45
|
+
return /^https?:$/.test(url.protocol) && LOOPBACK.has(url.hostname) && /^(?:https?:|\/)/i.test(text) ? url : null;
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* What a workbench's hash says, decoded, of the documents of `links`: a link or a slug, with a block
|
|
53
|
+
* or without (neither ever holds "/"). Else null, as with no `links` to read it by.
|
|
54
|
+
* @param {string} hash
|
|
55
|
+
* @param {Map<string, string> | null} [links]
|
|
56
|
+
*/
|
|
57
|
+
export function hashAddress(hash, links = null) {
|
|
58
|
+
const at = hash.indexOf("/");
|
|
59
|
+
const name = at < 0 ? hash : hash.slice(0, at);
|
|
60
|
+
const block = at < 0 ? null : hash.slice(at + 1) || null;
|
|
61
|
+
const slug = links && pageOfLink(links, name);
|
|
62
|
+
return slug ? { slug, block } : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The document and block `text` is the address of ({ slug, block }), or null: a web address, another host, a slug `links` does not hold, a workbench's address with no `links`. */
|
|
66
|
+
export function pageAddress(text, links = null) {
|
|
67
|
+
const address = String(text ?? "").trim();
|
|
68
|
+
const known = (slug, block) => (!links || links.has(slug) ? { slug, block: block || null } : null);
|
|
69
|
+
const inFile = IN_FILE.exec(address);
|
|
70
|
+
if (inFile) return known(inFile[1], decoded(inFile[2] ?? ""));
|
|
71
|
+
const url = ownAddress(address);
|
|
72
|
+
if (!url) return null;
|
|
73
|
+
const path = PAGE.exec(url.pathname) ?? OWN_FILE.exec(url.pathname);
|
|
74
|
+
if (path) return known(path[1], decoded(url.hash.slice(1)));
|
|
75
|
+
return url.pathname === "/" && url.hash.length > 1 ? hashAddress(decoded(url.hash.slice(1)), links) : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** The document and block `text` names of those in `links`: an address, as pageAddress reads one, or what stands after the # of a workbench's, the # with it or not, or after the Windows path Git Bash puts in place of a word's first / (/#<link>), as a person may hand a command one. Else null. */
|
|
79
|
+
export const namedPlace = (text, links) => pageAddress(text, links) ?? hashAddress(decoded(text.replace(/^(?:[a-z]:\/(?:.*\/)?)?#/i, "")), links);
|
|
80
|
+
|
|
81
|
+
/** The hash of an address of a workbench (/#<anything>, on this computer's own host), decoded, or null: what a click hands the workbench to read. */
|
|
82
|
+
export function workbenchHash(text) {
|
|
83
|
+
const url = ownAddress(String(text ?? "").trim());
|
|
84
|
+
return url?.pathname === "/" && url.hash.length > 1 ? decoded(url.hash.slice(1)) : null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The document and block `text` names of those in `links` (a Map, or null with no list) as read on the
|
|
89
|
+
* server of `origin`, as pageAddress reads it; but a workbench's address on another port says what it
|
|
90
|
+
* is by its words, the folder name or the link the document has now, for the same id there may be
|
|
91
|
+
* another workspace's page. With no `origin`, as a file is read, every port is another.
|
|
92
|
+
* @param {string} text
|
|
93
|
+
* @param {Map<string, string> | null} links
|
|
94
|
+
* @param {string} [origin]
|
|
95
|
+
*/
|
|
96
|
+
export function addressOn(text, links, origin = "http://127.0.0.1") {
|
|
97
|
+
const place = pageAddress(text, links);
|
|
98
|
+
const name = place && elsewhere(text, origin) ? workbenchHash(text)?.split("/")[0] : undefined;
|
|
99
|
+
return name === undefined || links.has(name) || links.get(place.slug) === name ? place : null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** Whether `text` is an address of a document of this workspace, as far as can be told with no list. */
|
|
103
|
+
export const isPageAddress = (text) => pageAddress(text) !== null || workbenchHash(text) !== null;
|
|
104
|
+
|
|
105
|
+
/** Whether `text` may be one, once the list is read (a paste reads it): an address of this computer's own host. */
|
|
106
|
+
export const mayBePage = (text) => ownAddress(String(text ?? "").trim()) !== null;
|
|
107
|
+
|
|
108
|
+
/** Whether `href` is written as a file writes a link to a document or a block: all a page block's address may be. */
|
|
109
|
+
export const isFileLink = (href) => IN_FILE.test(href) || /^#[^\s"<>]+$/.test(href);
|
|
110
|
+
|
|
111
|
+
/** The link a file writes to a document or block, from document `own`: within it a block is #<block id>. */
|
|
112
|
+
export const fileLink = ({ slug, block = null }, own = null) => (slug === own && block ? `#${block}` : `../${slug}/doc.html${block ? `#${block}` : ""}`);
|
|
113
|
+
|
|
114
|
+
/** Whether `text` names a host of its own, where a path or a relative link is read on the server that shows it. */
|
|
115
|
+
export const hosted = (text) => HOSTED.test(String(text ?? "").trim());
|
|
116
|
+
|
|
117
|
+
/** Whether `text` is an address of this computer on another server than `origin`'s, which may be another program's. */
|
|
118
|
+
export function elsewhere(text, origin) {
|
|
119
|
+
const url = hosted(text) ? ownAddress(text.trim()) : null;
|
|
120
|
+
return url !== null && url.port !== new URL(origin).port;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Where `href`, a link in the file of document `own`, leads, read beside that file as the disk reads it: an address on `origin`, or null for none. */
|
|
124
|
+
export function fromFile(href, own, origin = "http://127.0.0.1") {
|
|
125
|
+
try {
|
|
126
|
+
return new URL(String(href ?? "").trim(), `${origin}/${own}/doc.html`).href;
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The full address of a document or block, which a browser opens in a workbench from anywhere
|
|
134
|
+
* (`origin`: its server's): /#<link>/<block id>, or /#<link> for a page, in the words as they are. A
|
|
135
|
+
* document `links` does not hold goes by its page id, which opens it all the same.
|
|
136
|
+
* @param {string} origin
|
|
137
|
+
* @param {{ slug: string, block?: string | null }} place
|
|
138
|
+
* @param {Map<string, string> | null} [links]
|
|
139
|
+
*/
|
|
140
|
+
export const fullAddress = (origin, { slug, block = null }, links = null) => `${origin}/#${links?.get(slug) ?? pageLink({ slug })}${block ? `/${block}` : ""}`;
|