@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,247 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
import net from "node:net";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { packageRoot } from "./paths.mjs";
|
|
7
|
+
import { layoutOf } from "./workspace.mjs";
|
|
8
|
+
|
|
9
|
+
// Where a workspace's Gallery server listens (one a gallery command started, kind "cli", or npm run
|
|
10
|
+
// dev's, kind "dev"): the one way the commands tell this workspace's server from any other. gallery
|
|
11
|
+
// export hands a document in through the server's edit service (POST /__gallery/edit/hand-in), in the
|
|
12
|
+
// queue its pages' commits run in, instead of writing the file beside them; gallery open, new and
|
|
13
|
+
// import give a document's address on it, or start one when none runs (src/cli/server-process.mjs).
|
|
14
|
+
// The server keeps a small file in its workspace while it listens, .gallery/server.json (one server
|
|
15
|
+
// a workspace), with its port, its process, the token its requests need, its kind and Gallery's
|
|
16
|
+
// version; a command finds it there, or does without it when there is none, or its process is gone.
|
|
17
|
+
// A port is never asked whose it is: 4317 may be another workspace's server, whose pages would write
|
|
18
|
+
// that workspace's files.
|
|
19
|
+
|
|
20
|
+
// A directory as one name, however it was reached: on Windows a drive letter and the folders' names
|
|
21
|
+
// may be typed in either case (`cd /d d:\…` in cmd gives d:\), and they name the same directory.
|
|
22
|
+
const canonical = (directory) => {
|
|
23
|
+
const resolved = path.resolve(directory);
|
|
24
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
25
|
+
};
|
|
26
|
+
/** Whether two paths name the same directory (a server's workspace and a command's). */
|
|
27
|
+
export const sameDirectory = (a, b) => canonical(a) === canonical(b);
|
|
28
|
+
|
|
29
|
+
const fileOf = (reportsDirectory) => layoutOf(reportsDirectory).serverFile;
|
|
30
|
+
/** Gallery's version, as its package says it (a server of another version is another Gallery's). */
|
|
31
|
+
export const galleryVersion = (() => {
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(readFileSync(path.join(packageRoot, "package.json"), "utf8")).version ?? "0.0.0";
|
|
34
|
+
} catch {
|
|
35
|
+
return "0.0.0";
|
|
36
|
+
}
|
|
37
|
+
})();
|
|
38
|
+
|
|
39
|
+
// Whether a process runs (only asked: nothing is sent to it).
|
|
40
|
+
const runs = (pid) => {
|
|
41
|
+
try {
|
|
42
|
+
process.kill(pid, 0);
|
|
43
|
+
return true;
|
|
44
|
+
} catch (error) {
|
|
45
|
+
return error.code === "EPERM";
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Keep where the server listens: { port, pid, workspace, token, nonce, kind, version, started }, for
|
|
51
|
+
* as long as it does (the owner's alone on POSIX: the token authorizes writes), so
|
|
52
|
+
* that a server that runs is one the commands find, never one a command starts a second server
|
|
53
|
+
* beside (which would take the announcement: the pages' commits in one queue, an export's hand-in in
|
|
54
|
+
* another). Every `every` ms (0: never) it is written again when its file is gone (taken away by
|
|
55
|
+
* hand, or by a server of these reports that closed as this one wrote it) or names a process that is
|
|
56
|
+
* gone (left behind). One that names another process that runs is left: a server of these reports
|
|
57
|
+
* started later (the last to start is the one the commands use), or the one Vite started again in
|
|
58
|
+
* this process. The .gallery/ folder is made again, never the workspace (a workspace deleted stays
|
|
59
|
+
* deleted). Resolves to a function that stops that and, only while the announcement is this one's
|
|
60
|
+
* (`nonce`), gives the file back to the server it was written over when that one's process runs (in
|
|
61
|
+
* another process: in this one it is Vite's earlier server), or else takes it away: for when the
|
|
62
|
+
* server closes. A server stopped without closing leaves it behind, which the commands find out (its
|
|
63
|
+
* process gone, its port answering no more).
|
|
64
|
+
*/
|
|
65
|
+
export async function announcePreviewServer({ reportsDirectory, port, token, kind = "dev", version = galleryVersion, every = 1000 }) {
|
|
66
|
+
const file = fileOf(reportsDirectory);
|
|
67
|
+
const nonce = randomBytes(8).toString("hex");
|
|
68
|
+
const text = `${JSON.stringify({ port, pid: process.pid, workspace: path.resolve(reportsDirectory), token, nonce, kind, version, started: new Date().toISOString() })}\n`;
|
|
69
|
+
const save = (content) => fs.writeFile(file, content, { mode: 0o600 });
|
|
70
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
71
|
+
const before = await fs.readFile(file, "utf8").catch(() => null);
|
|
72
|
+
await save(text);
|
|
73
|
+
let closed = false;
|
|
74
|
+
const look = async () => {
|
|
75
|
+
let there = null;
|
|
76
|
+
try {
|
|
77
|
+
there = JSON.parse(await fs.readFile(file, "utf8"));
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (error.code !== "ENOENT") return; // being written (by another server), or not an announcement: left
|
|
80
|
+
}
|
|
81
|
+
if (there && (there.nonce === nonce || !Number.isInteger(there.pid) || runs(there.pid))) return;
|
|
82
|
+
if (closed) return;
|
|
83
|
+
await fs.mkdir(path.dirname(file)).catch(() => {});
|
|
84
|
+
await save(text).catch(() => {});
|
|
85
|
+
};
|
|
86
|
+
let looking = Promise.resolve();
|
|
87
|
+
const keeping = every > 0 ? setInterval(() => (looking = looking.then(look).catch(() => {})), every) : null;
|
|
88
|
+
keeping?.unref();
|
|
89
|
+
return async () => {
|
|
90
|
+
closed = true;
|
|
91
|
+
clearInterval(keeping);
|
|
92
|
+
await looking;
|
|
93
|
+
try {
|
|
94
|
+
if (JSON.parse(await fs.readFile(file, "utf8")).nonce !== nonce) return;
|
|
95
|
+
} catch {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
let earlier = null;
|
|
99
|
+
try {
|
|
100
|
+
earlier = JSON.parse(before);
|
|
101
|
+
} catch {}
|
|
102
|
+
const back = Number.isInteger(earlier?.pid) && earlier.pid !== process.pid && runs(earlier.pid);
|
|
103
|
+
await (back ? save(before) : fs.rm(file, { force: true })).catch(() => {});
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// The announcement of this workspace's server, while its process runs: { port, pid, workspace, token, nonce, kind, version, started }.
|
|
108
|
+
export async function readAnnouncement({ reportsDirectory }) {
|
|
109
|
+
let found;
|
|
110
|
+
try {
|
|
111
|
+
found = JSON.parse(await fs.readFile(fileOf(reportsDirectory), "utf8"));
|
|
112
|
+
} catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (!Number.isInteger(found?.port) || !Number.isInteger(found.pid) || typeof found.token !== "string" || typeof found.workspace !== "string" || !sameDirectory(found.workspace, reportsDirectory)) return null;
|
|
116
|
+
return runs(found.pid) ? found : null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Whether process `pid` runs (only asked: nothing is sent to it). */
|
|
120
|
+
export const processRuns = runs;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* How the server an announcement names answers on its port, within `timeout` ms: "yes", as that
|
|
124
|
+
* server (GET /__gallery/workspace/info there names the announcement's token, its process and this
|
|
125
|
+
* workspace, docs/workbench.md; there itself, not where it sends the request on to); "no", as none (a
|
|
126
|
+
* server stopped without closing leaves its announcement behind, and by now its process's number may
|
|
127
|
+
* be another program's, its port another server's); or "busy": the port took the request and gave no
|
|
128
|
+
* answer in time.
|
|
129
|
+
*/
|
|
130
|
+
export async function answerOf(found, reportsDirectory, timeout) {
|
|
131
|
+
try {
|
|
132
|
+
const response = await fetch(`http://127.0.0.1:${found.port}/__gallery/workspace/info`, { redirect: "error", signal: AbortSignal.timeout(timeout) });
|
|
133
|
+
const info = response.ok ? await response.json() : null;
|
|
134
|
+
const same = info?.token === found.token && info.server?.pid === found.pid && typeof info.server.workspace === "string" && sameDirectory(info.server.workspace, reportsDirectory);
|
|
135
|
+
return same ? "yes" : "no";
|
|
136
|
+
} catch (error) {
|
|
137
|
+
return error?.name === "TimeoutError" ? "busy" : "no";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The running server of this workspace: { port, token, pid }, or null when none says it runs. With
|
|
143
|
+
* `answering`, only one that answers on its port as the server its announcement names, within
|
|
144
|
+
* `timeout` ms (gallery open, which gives its address to the user); gallery export asks without it,
|
|
145
|
+
* its hand-in's own request telling whether the server takes it (a server slow to answer may still
|
|
146
|
+
* write the file).
|
|
147
|
+
*/
|
|
148
|
+
export async function findPreviewServer({ reportsDirectory, answering = false, timeout = 10_000 }) {
|
|
149
|
+
const found = await readAnnouncement({ reportsDirectory });
|
|
150
|
+
if (!found || (answering && (await answerOf(found, reportsDirectory, timeout)) !== "yes")) return null;
|
|
151
|
+
return { port: found.port, token: found.token, pid: found.pid };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Whether `port` of 127.0.0.1 is free: nothing holds it (held for a moment), and nothing answers on
|
|
156
|
+
* it (a server listening on every address may leave 127.0.0.1 alone to be held).
|
|
157
|
+
*/
|
|
158
|
+
export const portIsFree = (port) => new Promise((resolve) => {
|
|
159
|
+
const holder = net.createServer();
|
|
160
|
+
holder.once("error", () => resolve(false));
|
|
161
|
+
holder.listen(port, "127.0.0.1", () => holder.close(() => {
|
|
162
|
+
const socket = net.connect(port, "127.0.0.1");
|
|
163
|
+
socket.once("connect", () => {
|
|
164
|
+
socket.destroy();
|
|
165
|
+
resolve(false);
|
|
166
|
+
});
|
|
167
|
+
socket.once("error", (error) => resolve(error.code === "ECONNREFUSED"));
|
|
168
|
+
}));
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
/** -1, 0 or 1 as version `a` is older than, the same as or newer than `b` (numbers by dots: 0.1.0 < 0.1.10 < 0.2.0). */
|
|
172
|
+
export function compareVersions(a, b) {
|
|
173
|
+
const parts = (version) => String(version ?? "0").split(/[.+-]/).slice(0, 3).map((part) => Number.parseInt(part, 10) || 0);
|
|
174
|
+
const [x, y] = [parts(a), parts(b)];
|
|
175
|
+
for (let index = 0; index < 3; index++) if ((x[index] ?? 0) !== (y[index] ?? 0)) return (x[index] ?? 0) < (y[index] ?? 0) ? -1 : 1;
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
180
|
+
// Whether process `pid` is gone within `ms` (asked every 100 ms).
|
|
181
|
+
async function goneWithin(pid, ms) {
|
|
182
|
+
for (const until = Date.now() + ms; Date.now() < until; await sleep(100)) if (!runs(pid)) return true;
|
|
183
|
+
return !runs(pid);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Stop the server announcement `found` names, which answered as that server during this call
|
|
188
|
+
* (answerOf "yes": its process is this server's, never a number used again): POST
|
|
189
|
+
* /__gallery/workspace/stop (its token; the server finishes the saves in its queue, closes and exits), then,
|
|
190
|
+
* when its process still runs after `wait` ms, that process killed. Resolves to { ok: true, killed }
|
|
191
|
+
* or { ok: false, reason: "dev" (npm run dev's: stopped where it runs) | "running" (it would not stop), message }.
|
|
192
|
+
*/
|
|
193
|
+
export async function stopServer(found, { wait = 10_000 } = {}) {
|
|
194
|
+
const host = `127.0.0.1:${found.port}`;
|
|
195
|
+
let status = 0;
|
|
196
|
+
try {
|
|
197
|
+
const response = await fetch(`http://${host}/__gallery/workspace/stop`, {
|
|
198
|
+
method: "POST",
|
|
199
|
+
headers: { "Content-Type": "application/json", Origin: `http://${host}`, "X-Gallery-Token": found.token },
|
|
200
|
+
body: "{}",
|
|
201
|
+
signal: AbortSignal.timeout(wait),
|
|
202
|
+
});
|
|
203
|
+
status = response.status;
|
|
204
|
+
await response.text().catch(() => "");
|
|
205
|
+
} catch {} // it closed as it answered, or did not answer: its process says
|
|
206
|
+
if (status === 409) return { ok: false, reason: "dev", message: `This workspace's server is npm run dev's (port ${found.port}, pid ${found.pid}): stop it where it runs.` };
|
|
207
|
+
if (await goneWithin(found.pid, wait)) return { ok: true, killed: false };
|
|
208
|
+
try {
|
|
209
|
+
process.kill(found.pid);
|
|
210
|
+
} catch {}
|
|
211
|
+
if (await goneWithin(found.pid, 3000)) return { ok: true, killed: true };
|
|
212
|
+
return { ok: false, reason: "running", message: `The server on port ${found.port} (pid ${found.pid}) did not stop: end that process yourself.` };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* This workspace's server, for a command that needs one (src/cli/server-process.mjs serverFor): the
|
|
217
|
+
* one its announcement names when it answers there within `timeout` ms (as findPreviewServer with
|
|
218
|
+
* `answering`), or else one `start(port)` starts on the first free port of `ports`. A server of
|
|
219
|
+
* Gallery's of an older `version` (a command's, kind "cli": never npm run dev's) is stopped first
|
|
220
|
+
* (`stop(found)`, stopServer) and replaced; a newer one, or npm run dev's of any version, is used.
|
|
221
|
+
* Resolves to { port, started: what `start` gave, or null for a server that ran already, running: {
|
|
222
|
+
* pid, kind, version } of that one, replaced: { pid, version } of the one stopped, or null, passed:
|
|
223
|
+
* the ports passed over, as "4317 (in use)" }; `port` is null when none of `ports` is free; when the
|
|
224
|
+
* announced server's port took the request and gave no answer in time, with `busy: { port, pid,
|
|
225
|
+
* version, newer }`: this workspace's server, busy or stuck, and none is started beside it; and when
|
|
226
|
+
* an older one would not stop, with `stuck: { port, pid, message }`.
|
|
227
|
+
*/
|
|
228
|
+
export async function previewServerFor({ reportsDirectory, ports, start, stop = stopServer, timeout = 10_000, version = galleryVersion }) {
|
|
229
|
+
const found = await readAnnouncement({ reportsDirectory });
|
|
230
|
+
const answer = found ? await answerOf(found, reportsDirectory, timeout) : "no";
|
|
231
|
+
const kind = found?.kind === "dev" ? "dev" : "cli";
|
|
232
|
+
const order = found ? compareVersions(found.version, version) : 0;
|
|
233
|
+
if (answer === "busy") return { port: null, started: null, passed: [], replaced: null, busy: { port: found.port, pid: found.pid, version: found.version ?? null, newer: kind === "cli" && order > 0 } };
|
|
234
|
+
let replaced = null;
|
|
235
|
+
if (answer === "yes") {
|
|
236
|
+
if (kind === "dev" || order >= 0) return { port: found.port, started: null, passed: [], replaced: null, running: { pid: found.pid, kind, version: found.version ?? null } };
|
|
237
|
+
const stopped = await stop(found);
|
|
238
|
+
if (!stopped.ok) return { port: null, started: null, passed: [], replaced: null, stuck: { port: found.port, pid: found.pid, message: stopped.message } };
|
|
239
|
+
replaced = { pid: found.pid, version: found.version ?? null };
|
|
240
|
+
}
|
|
241
|
+
const passed = [];
|
|
242
|
+
for (const port of ports) {
|
|
243
|
+
if (await portIsFree(port)) return { port, started: await start(port), passed, replaced };
|
|
244
|
+
passed.push(`${port} (in use)`);
|
|
245
|
+
}
|
|
246
|
+
return { port: null, started: null, passed, replaced };
|
|
247
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// The levels of what gallery qa finds (src/cli/qa.mjs, docs/render.md "Quality check"), and
|
|
2
|
+
// of the kit's layout notes (data-doc-layout), which the preview's note reads with the same
|
|
3
|
+
// function (render/preview-checks.mjs puts layoutNotesScript() in the page): a note that fails qa is
|
|
4
|
+
// among the preview's failures, the others its 排版提示. levelOf and layoutNotesOf read nothing but
|
|
5
|
+
// WIDE, KINDS and NARROW_INFO, so they can be written into a page as their text. And the windows
|
|
6
|
+
// gallery qa looks in, whose widths the preview's note names.
|
|
7
|
+
|
|
8
|
+
// Three widths in a window 900px tall, and the widest again in a laptop's window (768px tall), where
|
|
9
|
+
// a frame of the kit's height (72vh) shows fewer rows: that look says only what the first did not.
|
|
10
|
+
export const LOOKS = [
|
|
11
|
+
{ width: 1024, height: 900, label: "1024" },
|
|
12
|
+
{ width: 1024, height: 768, label: "1024×768", laptop: true },
|
|
13
|
+
{ width: 736, height: 900, label: "736" },
|
|
14
|
+
{ width: 360, height: 900, label: "360" },
|
|
15
|
+
];
|
|
16
|
+
// The widths blocks are pictured at (the laptop's window adds no pictures of blocks).
|
|
17
|
+
export const WIDTHS = LOOKS.filter((look) => !look.laptop).map((look) => look.width);
|
|
18
|
+
|
|
19
|
+
// A table's columns or rows out of sight, and a code block or a formula whose content scrolls inside
|
|
20
|
+
// its frame, are a warning only where a reader has room for them (WIDE and wider), and info below,
|
|
21
|
+
// where a frame that scrolls is what it does (NARROW_INFO).
|
|
22
|
+
export const WIDE = 736;
|
|
23
|
+
export const LEVELS = ["fail", "warn", "unverified", "info"];
|
|
24
|
+
export const KINDS = {
|
|
25
|
+
error: "fail", // the page's error, uncaught or on the console
|
|
26
|
+
request: "fail", // a request that failed
|
|
27
|
+
blocked: "fail", // what the export's policy blocked: a file not embedded
|
|
28
|
+
image: "fail", // a picture that did not load
|
|
29
|
+
"chart-empty": "fail", // a chart that drew nothing (the kit's data-missing too)
|
|
30
|
+
"chart-text-clipped": "fail", // a chart's text cut by a clip
|
|
31
|
+
"chart-text-outside": "fail", // a chart's text outside its card
|
|
32
|
+
"raw-formula": "fail", // TeX shown as written
|
|
33
|
+
"formula-error": "fail", // a formula KaTeX refused
|
|
34
|
+
overflow: "fail", // the page wider than the window
|
|
35
|
+
"overflow-in-block": "warn", // words past the side of their box in a whole block or a figure's drawing, over what is beside it
|
|
36
|
+
"cut-in-block": "warn", // words or marks of a whole block or a figure's drawing cut at the bottom of a box that clips them
|
|
37
|
+
"table-columns": "warn", // a table's columns out of sight or cut (below WIDE: info)
|
|
38
|
+
"table-rows": "warn", // a table's rows below a frame of the kit's height (below WIDE: info)
|
|
39
|
+
"code-scrolls": "warn", // a code block's code scrolling inside its frame (below WIDE: info)
|
|
40
|
+
"formula-scrolls": "warn", // a formula block scrolling inside its frame (below WIDE: info)
|
|
41
|
+
"chart-text-overlap": "warn", // two texts of a drawing over each other
|
|
42
|
+
"svg-text-small": "warn", // a drawing's text its viewBox scales below a readable size
|
|
43
|
+
ticks: "warn", // a value axis's tick labels closer than a digit's width and a hair (0.6em)
|
|
44
|
+
"layout-note": "info", // the kit's other notes on its layout
|
|
45
|
+
"table-scrolls": "info", // a table that scrolls in its frame
|
|
46
|
+
"code-title-cut": "info", // a code block's title cut to fit its header
|
|
47
|
+
unverified: "unverified", // a wait that ran out, a state not reached, a picture not taken
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// The kinds that warn at WIDE and wider and are info below.
|
|
51
|
+
export const NARROW_INFO = ["table-columns", "table-rows", "code-scrolls", "formula-scrolls"];
|
|
52
|
+
|
|
53
|
+
/** The level of a finding of `kind` at a window `width` px wide. */
|
|
54
|
+
export function levelOf(kind, width) {
|
|
55
|
+
if (NARROW_INFO.includes(kind)) return width >= WIDE ? "warn" : "info";
|
|
56
|
+
return KINDS[kind] ?? "warn";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The notes the kit wrote on an element (data-doc-layout: one a line, each "<name>: <message>",
|
|
61
|
+
* such as "data-missing: its table has merged cells: …"), each with the kind of finding it makes and
|
|
62
|
+
* its level at a window `width` px wide: data-missing fails (a chart drawn from a table with nothing
|
|
63
|
+
* to draw, its card saying why: chart-empty); columns-hidden is a table's columns out of sight and
|
|
64
|
+
* rows-hidden its rows below its frame (warnings where a reader has room for them, info below); any
|
|
65
|
+
* other note is info. [{ note, name, kind, level }]
|
|
66
|
+
*/
|
|
67
|
+
export function layoutNotesOf(value, width = Infinity) {
|
|
68
|
+
const kinds = { "columns-hidden": "table-columns", "rows-hidden": "table-rows", "data-missing": "chart-empty" };
|
|
69
|
+
return String(value ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean).map((note) => {
|
|
70
|
+
const name = note.split(":")[0].trim().toLowerCase();
|
|
71
|
+
const kind = kinds[name] ?? "layout-note";
|
|
72
|
+
return { note, name, kind, level: levelOf(kind, width) };
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A layout note of the kit's that fails (layoutNotesOf's `note`, "<name>: <message>"), in the words of
|
|
78
|
+
* the person reading the preview's note, in Chinese unless { english } (the UI's language): a chart
|
|
79
|
+
* that drew nothing (the preview says its card's own line of why when it has one), in a sentence. The
|
|
80
|
+
* note itself, in English, is gallery qa's and an Agent's, and stays as it is on the page; a note it
|
|
81
|
+
* does not know is said as it is. Written with no outside name, so the preview's page can carry it
|
|
82
|
+
* (layoutNotesScript).
|
|
83
|
+
*/
|
|
84
|
+
export function noteInWords(note, { english = false } = {}) {
|
|
85
|
+
const text = String(note ?? "").trim();
|
|
86
|
+
const colon = text.indexOf(":");
|
|
87
|
+
const name = colon < 0 ? "" : text.slice(0, colon).trim().toLowerCase();
|
|
88
|
+
if (name === "data-missing") return english ? "The chart was not drawn: its table gave it nothing to draw" : "图表没有画出来:从表格里没读到能画的数据";
|
|
89
|
+
return text;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** levelOf, layoutNotesOf and noteInWords as a script's text, for a page (the preview's note) to read notes as qa does and say them. */
|
|
93
|
+
export const layoutNotesScript = () => `const WIDE = ${WIDE}; const KINDS = ${JSON.stringify(KINDS)}; const NARROW_INFO = ${JSON.stringify(NARROW_INFO)}; ${levelOf}; ${layoutNotesOf}; ${noteInWords};`;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Where a reader is in a page, for the way back from a link to a block of it (docs/render.md, "Links
|
|
2
|
+
// to blocks"; the page editor's and the workbench's too): the scroll position and the element that
|
|
3
|
+
// stands at the top of the window, with how far down the window its top is. A jump opens what hides
|
|
4
|
+
// its block (a disclosure, a tab, a detail card), and what opens above the place moves the rest, so
|
|
5
|
+
// the way back goes by that element where it can, by the scroll position where it cannot. The element
|
|
6
|
+
// is named by where it stands in the page's main (the child indices down to it: an Agent's blocks
|
|
7
|
+
// carry no id until a commit or an export gives them one), checked by the id of the block it is in.
|
|
8
|
+
|
|
9
|
+
const rootOf = (doc) => doc.querySelector("main") ?? doc.body;
|
|
10
|
+
|
|
11
|
+
/** `value` for a quoted CSS string: the window's CSS.escape, where there is one (a DOM of a test may have none). */
|
|
12
|
+
export const cssString = (win, value) => (win?.CSS?.escape ? win.CSS.escape(value) : String(value).replace(/["\\]/g, "\\$&").replace(/\n/g, "\\a "));
|
|
13
|
+
|
|
14
|
+
const blockOf = (element) => element.closest("[data-block-id]")?.getAttribute("data-block-id") ?? null;
|
|
15
|
+
|
|
16
|
+
// The tab each Sheet area of `win`'s page shows, by the area's name (sheets.js keeps one state per name).
|
|
17
|
+
const tabsIn = (win) => {
|
|
18
|
+
const tabs = {};
|
|
19
|
+
for (const area of win.document.querySelectorAll("[data-doc-sheets]")) {
|
|
20
|
+
const key = win.DocSheets?.get(area)?.get();
|
|
21
|
+
if (typeof key === "string") tabs[area.getAttribute("data-doc-sheets")] = key;
|
|
22
|
+
}
|
|
23
|
+
return tabs;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `win`'s place: { x, y, top, tabs }, `top` { path, id, at } the first element of the page's main, in
|
|
28
|
+
* its order, whose top is in the window or below it (none in a detail card, none that sticks or is
|
|
29
|
+
* fixed, none that takes no room), or null where none is; `tabs` the tab each Sheet area shows.
|
|
30
|
+
*/
|
|
31
|
+
export function placeIn(win) {
|
|
32
|
+
const doc = win.document;
|
|
33
|
+
const root = rootOf(doc);
|
|
34
|
+
let top = null;
|
|
35
|
+
if (root) {
|
|
36
|
+
const walker = doc.createTreeWalker(root, 1, (element) => {
|
|
37
|
+
if (element.localName === "dialog") return 2; // a card's blocks stand over the page, not in it
|
|
38
|
+
const box = element.getBoundingClientRect();
|
|
39
|
+
if (box.bottom <= 0 && box.height > 0) return 2; // what ends above the window holds nothing in it
|
|
40
|
+
const { position } = win.getComputedStyle(element);
|
|
41
|
+
return position === "fixed" || position === "sticky" ? 2 : 1; // what stands still as the page scrolls (a heading that sticks, a bar of the document's own), and what is in it, names no place in it
|
|
42
|
+
});
|
|
43
|
+
for (let element = walker.nextNode(); element; element = walker.nextNode()) {
|
|
44
|
+
const box = element.getBoundingClientRect();
|
|
45
|
+
if (box.height === 0 || box.top < 0) continue;
|
|
46
|
+
const path = [];
|
|
47
|
+
for (let node = element; node !== root; node = node.parentElement) path.unshift([...node.parentElement.children].indexOf(node));
|
|
48
|
+
top = { path, id: blockOf(element), at: Math.round(box.top) };
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { x: Math.round(win.scrollX), y: Math.round(win.scrollY), top, tabs: tabsIn(win) };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// The element `top` names: at its path when that is still in the block it was in, else that block.
|
|
56
|
+
function elementOf(doc, top) {
|
|
57
|
+
const root = rootOf(doc);
|
|
58
|
+
if (!root || !top) return null;
|
|
59
|
+
let element = root;
|
|
60
|
+
for (const index of Array.isArray(top.path) ? top.path : [null]) element = Number.isInteger(index) ? element?.children[index] ?? null : null;
|
|
61
|
+
const id = typeof top.id === "string" ? top.id : null;
|
|
62
|
+
if (element && (id === null || blockOf(element) === id)) return element;
|
|
63
|
+
return id ? doc.querySelector(`[data-block-id="${cssString(doc.defaultView, id)}"]`) : null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* `win` back at `place` (placeIn's): the tabs it names shown again (a jump to a block in another tab of
|
|
68
|
+
* an area showed that one), then its top element where it stood in the window, else its scroll position.
|
|
69
|
+
*/
|
|
70
|
+
export function goBackTo(win, place) {
|
|
71
|
+
const tabs = place?.tabs && typeof place.tabs === "object" ? place.tabs : {};
|
|
72
|
+
for (const area of win.document.querySelectorAll("[data-doc-sheets]")) {
|
|
73
|
+
const key = tabs[area.getAttribute("data-doc-sheets")];
|
|
74
|
+
if (typeof key === "string" && win.DocSheets?.get(area)?.get() !== key) win.DocSheets?.get(area)?.set(key);
|
|
75
|
+
}
|
|
76
|
+
const element = elementOf(win.document, place?.top);
|
|
77
|
+
const box = element && !element.closest("dialog") ? element.getBoundingClientRect() : null;
|
|
78
|
+
const x = Number(place?.x) || 0;
|
|
79
|
+
if (box && box.height > 0 && Number.isFinite(place.top.at)) win.scrollTo(x, win.scrollY + box.top - place.top.at);
|
|
80
|
+
else win.scrollTo(x, Number(place?.y) || 0);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Whether `win` stands where goBackTo put it (`put`: [x, y] then) or where the browser puts an entry's
|
|
85
|
+
* scroll position back on the way back (`place`'s own x and y, Chrome's after popstate), so that a
|
|
86
|
+
* second goBackTo, once what lays itself out later has, is no reader's scroll taken back.
|
|
87
|
+
*/
|
|
88
|
+
export function unmoved(win, place, put) {
|
|
89
|
+
const at = (x, y) => Math.abs(win.scrollX - x) < 1 && Math.abs(win.scrollY - y) < 1;
|
|
90
|
+
return at(put[0], put[1]) || at(Number(place?.x) || 0, Number(place?.y) || 0);
|
|
91
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
// What a browser keeps of the UI (the workbench and the report pages, one origin) under the product's
|
|
2
|
+
// name, Gallery, and under its old one, HTML Report Studio (before 2026-10-26): the keys of
|
|
3
|
+
// localStorage and sessionStorage and the workbench's IndexedDB. Every module that reads or writes
|
|
4
|
+
// one of these keys takes its name from here (KEYS, DATABASES), so this module has
|
|
5
|
+
// run, and carried what the old keys hold, before any of them reads: one table, whichever page of
|
|
6
|
+
// the origin loads first (docs/workbench.md, "Kept in the browser").
|
|
7
|
+
//
|
|
8
|
+
// Carrying never removes an old key or the old database: a page or workbench of the old version
|
|
9
|
+
// still open (a tab left from before the update) goes on reading and writing them. An old key is
|
|
10
|
+
// carried to its new one
|
|
11
|
+
// - the first time it is looked at, when the new key is empty (a new key already written wins);
|
|
12
|
+
// - again whenever it changed since it was last looked at: only a page of the old version writes
|
|
13
|
+
// it, and what it wrote is the reader's latest (a favorite set, a theme picked in the old tab);
|
|
14
|
+
// removed there (the theme, the icon set or color back to their default), the new key goes too.
|
|
15
|
+
// What each old key held when it was last looked at is kept (as a short digest) under RECORD, so a
|
|
16
|
+
// carry is done once: run again, nothing changes, and a new key the new version removed (its
|
|
17
|
+
// default) stays removed. Each runs as this module loads, and again when another tab changes an old
|
|
18
|
+
// key (the storage event). A failure (full or blocked storage) leaves that key to the next time.
|
|
19
|
+
// The kit's reading state (DocState, src/render/kit/state.js, a classic script) carries its own
|
|
20
|
+
// keys, html-report-studio:<report>:<id> to gallery:<report>:<id>, the same way, as it reads them.
|
|
21
|
+
//
|
|
22
|
+
// The editor's keys, made per document and per tab (the crash buffer, what a page keeps over a
|
|
23
|
+
// reload, the lost list, the recent choices of its menus: gallery-edit:<slug>:<kind>[:<tab>],
|
|
24
|
+
// gallery-edit:<name>), were report-edit:… before 2026-10-28 (decision E). They are carried by their
|
|
25
|
+
// prefix (PREFIXES) under the same rules, every old key under it that is there or was looked at
|
|
26
|
+
// before; what they hold is carried as it is (a crash buffer then sent by the page as any, the
|
|
27
|
+
// server reading it as the page of this version sends it).
|
|
28
|
+
|
|
29
|
+
/** localStorage, new names. */
|
|
30
|
+
export const KEYS = {
|
|
31
|
+
language: "gallery:language", // shared/i18n
|
|
32
|
+
preferences: "gallery:preferences", // shared/preferences.mjs
|
|
33
|
+
outlineOpen: "gallery:outline-open", // shared/preferences.mjs
|
|
34
|
+
outlineFolds: "gallery:outline", // editor/page/outline/folds.mjs
|
|
35
|
+
emojiSkinTone: "gallery:emoji-skin-tone", // shared/emoji/data.mjs
|
|
36
|
+
emojiFrecency: "gallery:emoji-frecency",
|
|
37
|
+
iconColor: "gallery:icon-picker-color", // shared/emoji/glyphs.mjs
|
|
38
|
+
recentGlyphs: "gallery:recent-glyphs",
|
|
39
|
+
glyphSet: "gallery:glyph-set",
|
|
40
|
+
sidebar: "gallery/workbench:sidebar", // the workbench's state/
|
|
41
|
+
theme: "gallery/workbench:theme",
|
|
42
|
+
tree: "gallery/workbench:tree",
|
|
43
|
+
favorites: "gallery/workbench:favorites", // workbench/app/workspace/store.ts
|
|
44
|
+
presentZoom: "gallery/workbench:present-zoom", // features/present/
|
|
45
|
+
};
|
|
46
|
+
/** localStorage, the names before 2026-10-26, each of the key of KEYS by the same name. */
|
|
47
|
+
export const OLD_KEYS = {
|
|
48
|
+
language: "html-report-studio:language",
|
|
49
|
+
preferences: "html-report-studio:preferences",
|
|
50
|
+
outlineOpen: "html-report-studio:outline-open",
|
|
51
|
+
outlineFolds: "html-report-studio:outline",
|
|
52
|
+
emojiSkinTone: "report-studio:emoji-skin-tone",
|
|
53
|
+
emojiFrecency: "report-studio:emoji-frecency",
|
|
54
|
+
iconColor: "report-studio:icon-picker-color",
|
|
55
|
+
recentGlyphs: "report-studio:recent-glyphs",
|
|
56
|
+
glyphSet: "report-studio:glyph-set",
|
|
57
|
+
sidebar: "html-report-studio/workbench:sidebar",
|
|
58
|
+
theme: "html-report-studio/workbench:theme",
|
|
59
|
+
tree: "html-report-studio/workbench:tree",
|
|
60
|
+
favorites: "html-report-studio/workbench:favorites",
|
|
61
|
+
presentZoom: "html-report-studio/workbench:present-zoom",
|
|
62
|
+
};
|
|
63
|
+
/** IndexedDB, new and old names (the workbench's chosen export folder: workspace/exportFolder.ts). */
|
|
64
|
+
export const DATABASES = { workbench: "gallery-workbench" };
|
|
65
|
+
export const OLD_DATABASES = { workbench: "html-report-studio-workbench" };
|
|
66
|
+
|
|
67
|
+
/** Where what each old key held when last looked at is kept (in each storage, for its own keys). */
|
|
68
|
+
export const RECORD = "gallery:renamed";
|
|
69
|
+
|
|
70
|
+
/** Prefixes of keys named per document or tab, the old with its new one (the editor's, before 2026-10-28). */
|
|
71
|
+
export const PREFIXES = [["report-edit:", "gallery-edit:"]];
|
|
72
|
+
|
|
73
|
+
const pairsOf = (old, now) => Object.keys(now).map((name) => [old[name], now[name]]);
|
|
74
|
+
export const LOCAL_PAIRS = pairsOf(OLD_KEYS, KEYS);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The [old, new] pairs of the keys under `prefixes` in `area` (a Storage): each old key there now,
|
|
78
|
+
* and each looked at before (in `record`), so that one removed since takes its new key with it.
|
|
79
|
+
*/
|
|
80
|
+
export function prefixPairs(area, prefixes = PREFIXES, record = RECORD) {
|
|
81
|
+
if (!area) return [];
|
|
82
|
+
const names = new Set();
|
|
83
|
+
try {
|
|
84
|
+
for (let index = 0; index < area.length; index++) names.add(area.key(index));
|
|
85
|
+
} catch {} // blocked: none
|
|
86
|
+
try {
|
|
87
|
+
const kept = JSON.parse(area.getItem(record) ?? "{}");
|
|
88
|
+
if (kept && typeof kept === "object" && !Array.isArray(kept)) for (const name of Object.keys(kept)) names.add(name);
|
|
89
|
+
} catch {}
|
|
90
|
+
return [...names].map((name) => prefixPair(name, prefixes)).filter(Boolean);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** [name, its new name] when `name` is a key under one of the old prefixes of `prefixes`, else null. */
|
|
94
|
+
export function prefixPair(name, prefixes = PREFIXES) {
|
|
95
|
+
const pair = typeof name === "string" ? prefixes.find(([old]) => name.startsWith(old)) : null;
|
|
96
|
+
return pair ? [name, pair[1] + name.slice(pair[0].length)] : null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A short digest of a stored value (null: none), enough to tell that it changed. */
|
|
100
|
+
export function digest(value) {
|
|
101
|
+
if (value === null || value === undefined) return null;
|
|
102
|
+
let hash = 0x811c9dc5;
|
|
103
|
+
for (let index = 0; index < value.length; index++) hash = Math.imul(hash ^ value.charCodeAt(index), 0x01000193);
|
|
104
|
+
return `${value.length}:${(hash >>> 0).toString(36)}`;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Carry the old keys of `pairs` ([old, new]) to the new ones in `area` (a Storage), as said above,
|
|
109
|
+
* keeping what was looked at under `record`. Returns the new keys written or removed.
|
|
110
|
+
*/
|
|
111
|
+
export function carryKeys(area, pairs, record = RECORD) {
|
|
112
|
+
const carried = [];
|
|
113
|
+
if (!area) return carried;
|
|
114
|
+
let seen = {};
|
|
115
|
+
try {
|
|
116
|
+
const kept = JSON.parse(area.getItem(record) ?? "{}");
|
|
117
|
+
if (kept && typeof kept === "object" && !Array.isArray(kept)) seen = kept;
|
|
118
|
+
} catch {} // unreadable: as if nothing was looked at (a new key written still wins)
|
|
119
|
+
let changed = false;
|
|
120
|
+
for (const [old, now] of pairs) {
|
|
121
|
+
try {
|
|
122
|
+
const value = area.getItem(old);
|
|
123
|
+
const mark = digest(value);
|
|
124
|
+
const first = !Object.hasOwn(seen, old);
|
|
125
|
+
if (!first && seen[old] === mark) continue;
|
|
126
|
+
if (first ? value !== null && area.getItem(now) === null : true) {
|
|
127
|
+
if (value === null) area.removeItem(now);
|
|
128
|
+
else area.setItem(now, value);
|
|
129
|
+
carried.push(now);
|
|
130
|
+
}
|
|
131
|
+
seen[old] = mark;
|
|
132
|
+
changed = true;
|
|
133
|
+
} catch {} // full or blocked: this key is looked at again next time
|
|
134
|
+
}
|
|
135
|
+
if (changed) {
|
|
136
|
+
try {
|
|
137
|
+
area.setItem(record, JSON.stringify(seen));
|
|
138
|
+
} catch {}
|
|
139
|
+
}
|
|
140
|
+
return carried;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Copy what IndexedDB database `from` holds in object store `store` into the one `open()` opens (a
|
|
145
|
+
* connection of its own to the new database, made with that store as its owner makes it; closed
|
|
146
|
+
* here once done): each key the new one does not hold
|
|
147
|
+
* yet, so it runs any number of times with the same result and never takes a choice made since.
|
|
148
|
+
* The old database is never made (looked for, not opened, when it is not there), changed or
|
|
149
|
+
* deleted. Resolves to the number of entries copied; a failure rejects and leaves both as they were
|
|
150
|
+
* but for what was copied whole, to be tried again next time.
|
|
151
|
+
*/
|
|
152
|
+
export async function carryDatabase(factory, { from, store, open }) {
|
|
153
|
+
const done = (request) => new Promise((resolve, reject) => {
|
|
154
|
+
request.onsuccess = () => resolve(request.result);
|
|
155
|
+
request.onerror = () => reject(request.error);
|
|
156
|
+
});
|
|
157
|
+
if (typeof factory.databases === "function" && !(await factory.databases()).some((database) => database.name === from)) return 0;
|
|
158
|
+
const old = await new Promise((resolve, reject) => {
|
|
159
|
+
const request = factory.open(from);
|
|
160
|
+
let absent = false;
|
|
161
|
+
request.onupgradeneeded = () => { // it was not there: make nothing
|
|
162
|
+
absent = true;
|
|
163
|
+
request.transaction.abort();
|
|
164
|
+
};
|
|
165
|
+
request.onsuccess = () => resolve(request.result);
|
|
166
|
+
request.onerror = (event) => {
|
|
167
|
+
if (!absent) return reject(request.error);
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
resolve(null);
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
if (!old) return 0;
|
|
173
|
+
let entries;
|
|
174
|
+
try {
|
|
175
|
+
if (!old.objectStoreNames.contains(store)) return 0;
|
|
176
|
+
const reading = old.transaction(store, "readonly").objectStore(store);
|
|
177
|
+
const [keys, values] = await Promise.all([done(reading.getAllKeys()), done(reading.getAll())]);
|
|
178
|
+
entries = keys.map((key, index) => [key, values[index]]);
|
|
179
|
+
} finally {
|
|
180
|
+
old.close();
|
|
181
|
+
}
|
|
182
|
+
if (entries.length === 0) return 0;
|
|
183
|
+
const database = await open();
|
|
184
|
+
try {
|
|
185
|
+
const writing = database.transaction(store, "readwrite");
|
|
186
|
+
const target = writing.objectStore(store);
|
|
187
|
+
let copied = 0;
|
|
188
|
+
for (const [key, value] of entries) {
|
|
189
|
+
const held = target.get(key);
|
|
190
|
+
held.onsuccess = () => {
|
|
191
|
+
if (held.result !== undefined) return;
|
|
192
|
+
target.put(value, key);
|
|
193
|
+
copied++;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
await new Promise((resolve, reject) => {
|
|
197
|
+
writing.oncomplete = resolve;
|
|
198
|
+
writing.onerror = () => reject(writing.error);
|
|
199
|
+
writing.onabort = () => reject(writing.error ?? new Error("aborted"));
|
|
200
|
+
});
|
|
201
|
+
return copied;
|
|
202
|
+
} finally {
|
|
203
|
+
database.close();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// As this module loads, in a page (never in Node, which imports it with the modules that name a key).
|
|
208
|
+
if (typeof document !== "undefined") {
|
|
209
|
+
const local = (() => { try { return globalThis.localStorage ?? null; } catch { return null; } })();
|
|
210
|
+
const session = (() => { try { return globalThis.sessionStorage ?? null; } catch { return null; } })();
|
|
211
|
+
carryKeys(local, [...LOCAL_PAIRS, ...prefixPairs(local)]);
|
|
212
|
+
carryKeys(session, prefixPairs(session));
|
|
213
|
+
// A tab of the old version, still open, changed an old key: carried now, so that what this page
|
|
214
|
+
// writes after it (which it can only do later) stays the latest.
|
|
215
|
+
globalThis.addEventListener?.("storage", (event) => {
|
|
216
|
+
if (!local || event.storageArea !== local) return;
|
|
217
|
+
const pair = LOCAL_PAIRS.find(([old]) => old === event.key) ?? prefixPair(event.key);
|
|
218
|
+
if (pair) carryKeys(local, [pair]);
|
|
219
|
+
});
|
|
220
|
+
}
|