@heycys/gallery 0.1.0 → 0.1.2
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/THIRD-PARTY-NOTICES.md +51 -1
- package/browser/editor/components/callout/index.mjs +40 -15
- package/browser/editor/components/columns/page.mjs +45 -32
- package/browser/editor/components/details/index.mjs +2 -1
- package/browser/editor/components/dialog/index.mjs +2 -1
- package/browser/editor/components/dialog/page.mjs +0 -18
- package/browser/editor/components/divider/index.mjs +1 -1
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/figure/page.mjs +10 -1
- package/browser/editor/components/file/page.mjs +2 -2
- package/browser/editor/components/flowchart/add.mjs +7 -6
- package/browser/editor/components/flowchart/page.mjs +1 -1
- package/browser/editor/components/heading/index.mjs +2 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +4 -20
- package/browser/editor/components/icons.mjs +13 -2
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/page.mjs +2 -2
- package/browser/editor/components/installed/index.mjs +82 -29
- package/browser/editor/components/installed/page.mjs +146 -34
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/kit.mjs +3 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/page.mjs +44 -14
- package/browser/editor/components/pages.mjs +2 -2
- package/browser/editor/components/registry.mjs +68 -33
- package/browser/editor/components/section/index.mjs +2 -1
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/table/index.mjs +64 -5
- package/browser/editor/components/table/page.mjs +30 -19
- package/browser/editor/page/annotate/anchors.mjs +4 -3
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/annotate/index.mjs +61 -34
- package/browser/editor/page/autosave.mjs +357 -38
- package/browser/editor/page/beside.mjs +5 -5
- package/browser/editor/page/block-menu/colors.mjs +3 -1
- package/browser/editor/page/block-menu/index.mjs +8 -6
- package/browser/editor/page/blocks.mjs +16 -7
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +145 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +970 -0
- package/browser/editor/page/board/settings.mjs +209 -0
- package/browser/editor/page/caret.mjs +5 -2
- package/browser/editor/page/changes/bar.mjs +94 -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/clipboard/import/colors.mjs +3 -3
- package/browser/editor/page/clipboard/import/html.mjs +29 -6
- package/browser/editor/page/clipboard/import/inline.mjs +32 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
- package/browser/editor/page/clipboard/import/read.mjs +6 -1
- package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
- package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
- package/browser/editor/page/clipboard/index.mjs +156 -26
- package/browser/editor/page/clipboard/own/blocks.mjs +25 -16
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +16 -7
- package/browser/editor/page/clipboard/own/export.mjs +6 -6
- package/browser/editor/page/clipboard/own/selection.mjs +3 -3
- package/browser/editor/page/clipboard/own/writers.mjs +0 -11
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +98 -25
- package/browser/editor/page/conflicts.mjs +13 -33
- package/browser/editor/page/convert.mjs +8 -7
- package/browser/editor/page/core.mjs +81 -27
- package/browser/editor/page/custom-page.mjs +106 -0
- package/browser/editor/page/drag/index.mjs +40 -24
- package/browser/editor/page/drag/preview.mjs +9 -4
- package/browser/editor/page/editor.mjs +120 -28
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +22 -13
- package/browser/editor/page/emoji-picker/grid.mjs +7 -5
- package/browser/editor/page/emoji-picker/icon-tab.mjs +4 -4
- package/browser/editor/page/emoji-picker/icons.mjs +0 -1
- package/browser/editor/page/emoji-picker/index.mjs +11 -9
- package/browser/editor/page/emoji-picker/styles.mjs +156 -2
- package/browser/editor/page/emoji-picker/support.mjs +6 -4
- package/browser/editor/page/emoji-picker/upload.mjs +14 -13
- package/browser/editor/page/fills.mjs +5 -3
- 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 +2 -1
- package/browser/editor/page/format-bar/index.mjs +1 -1
- package/browser/editor/page/geometry.mjs +8 -6
- package/browser/editor/page/handle/index.mjs +22 -14
- package/browser/editor/page/hints/index.mjs +1 -1
- package/browser/editor/page/history.mjs +24 -4
- package/browser/editor/page/insert/index.mjs +30 -17
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +69 -6
- package/browser/editor/page/margin.mjs +63 -27
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +86 -31
- package/browser/editor/page/merge.mjs +24 -0
- package/browser/editor/page/notices.mjs +3 -3
- package/browser/editor/page/offered.mjs +1 -1
- package/browser/editor/page/outline/folds.mjs +11 -10
- package/browser/editor/page/outline/index.mjs +131 -45
- package/browser/editor/page/outline/list.mjs +23 -11
- package/browser/editor/page/outline/read.mjs +1 -1
- package/browser/editor/page/outline/strip.mjs +7 -1
- package/browser/editor/page/page-objects.mjs +13 -2
- package/browser/editor/page/panel.mjs +9 -13
- package/browser/editor/page/present-links.mjs +11 -2
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/delete.mjs +8 -6
- package/browser/editor/page/selection/index.mjs +10 -3
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +101 -6
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/cell-bar.mjs +4 -1
- package/browser/editor/page/table/cells.mjs +103 -47
- package/browser/editor/page/table/icons.mjs +3 -1
- package/browser/editor/page/table/index.mjs +40 -16
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +150 -0
- package/browser/editor/page/table/widths.mjs +9 -4
- package/browser/editor/page/text-select/index.mjs +43 -14
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/tooltip.mjs +1 -1
- package/browser/editor/page/type-grid.mjs +4 -3
- package/browser/editor/page/typing/code-edges.mjs +63 -17
- package/browser/editor/page/typing/index.mjs +65 -9
- package/browser/editor/page/typing/leave.mjs +1 -1
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/annotations.mjs +8 -10
- package/browser/shared/block-packs.mjs +404 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/code-folds.mjs +5 -1
- package/browser/shared/colors.mjs +17 -14
- package/browser/shared/component-catalog.mjs +345 -54
- package/browser/shared/component-source.mjs +37 -0
- package/browser/shared/components/callout.mjs +4 -2
- package/browser/shared/components/index.mjs +72 -9
- package/browser/shared/components/installed.mjs +110 -8
- package/browser/shared/components/page.mjs +22 -3
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -1
- package/browser/shared/components/text.mjs +2 -2
- package/browser/shared/document-look.mjs +183 -0
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/README.md +4 -2
- package/browser/shared/emoji/data/categories.json +1 -1
- package/browser/shared/emoji/data/keywords-en.json +1 -1
- package/browser/shared/emoji/data/keywords-zh.json +1 -1
- package/browser/shared/emoji/data/names.json +1 -1
- package/browser/shared/emoji/data/positions.json +1 -1
- package/browser/shared/emoji/data/twemoji-index.json +1 -1
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +10 -12
- package/browser/shared/emoji/emoji.mjs +8 -7
- package/browser/shared/emoji/icon-value.mjs +4 -3
- package/browser/shared/extension-sidebar.mjs +126 -0
- package/browser/shared/extensions.mjs +79 -0
- package/browser/shared/file-table.mjs +101 -0
- package/browser/shared/html-tree.mjs +11 -5
- package/browser/shared/i18n/en.mjs +374 -35
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/long-runs.mjs +39 -0
- package/browser/shared/net-cache.mjs +133 -0
- package/browser/shared/net-keys.mjs +32 -0
- package/browser/shared/net-policy.mjs +177 -0
- package/browser/shared/new-names.mjs +5 -2
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +458 -0
- package/browser/shared/pack-manifest.mjs +77 -0
- package/browser/shared/page-address.mjs +6 -3
- package/browser/shared/page-cards.mjs +308 -0
- package/browser/shared/page-links.mjs +69 -6
- package/browser/shared/pages.mjs +388 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/preferences.mjs +10 -4
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +13 -5
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/table-chart.mjs +33 -1
- package/browser/shared/todos.mjs +83 -0
- package/browser/shared/user-directory.mjs +24 -0
- package/browser/shared/versions.mjs +14 -0
- package/browser/shared/web-links.mjs +134 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-look.mjs +91 -0
- package/browser/shared/workspace-name.mjs +154 -0
- package/browser/shared/workspace-query.mjs +125 -0
- package/browser/shared/workspace-registry.mjs +272 -0
- package/browser/shared/workspace.mjs +171 -20
- package/browser/shared/zoom.mjs +5 -5
- package/dist/chunk-2NRBY6AJ.mjs +2 -0
- package/dist/chunk-32ZUEFZ7.mjs +2 -0
- package/dist/chunk-35NQ4PLQ.mjs +2 -0
- package/dist/chunk-3KJHLHUO.mjs +2 -0
- package/dist/chunk-3NJACR4W.mjs +2 -0
- package/dist/chunk-4AV456RQ.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5XYHDBJ5.mjs +2 -0
- package/dist/chunk-5ZJA7CXT.mjs +2 -0
- package/dist/chunk-6A53MZYZ.mjs +2 -0
- package/dist/chunk-6EXH3ORZ.mjs +166 -0
- package/dist/chunk-6EZ7FNIK.mjs +3 -0
- package/dist/{chunk-UXUK4PMC.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/{chunk-6U2SLSDN.mjs → chunk-6VTU6KEO.mjs} +1 -1
- package/dist/chunk-B4P2CM2J.mjs +3 -0
- package/dist/chunk-BPL64HGA.mjs +4 -0
- package/dist/chunk-BVEFGE4B.mjs +2 -0
- package/dist/chunk-BZ5RAF7L.mjs +2 -0
- package/dist/chunk-CRJEG7MT.mjs +2 -0
- package/dist/{chunk-B3VTYBYR.mjs → chunk-D4CKRD3V.mjs} +91 -91
- package/dist/chunk-D4EURAX4.mjs +4 -0
- package/dist/chunk-DQCE7TJY.mjs +5 -0
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/{chunk-DB4WKGYF.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-FJYN7RTH.mjs +4 -0
- package/dist/chunk-FWNRPMCJ.mjs +12 -0
- package/dist/chunk-FWW4CSAZ.mjs +2 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-GY3FAUVM.mjs +2 -0
- package/dist/chunk-HLYV7RIH.mjs +2 -0
- package/dist/chunk-HMYTM3GT.mjs +15 -0
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-KTKHRC6H.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-MHW7ZKOU.mjs +2 -0
- package/dist/chunk-N76HWBA3.mjs +10 -0
- package/dist/chunk-N7AZZLGT.mjs +548 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-YXAUQPVK.mjs → chunk-NFMCP2HI.mjs} +3 -3
- package/dist/chunk-NG375ILQ.mjs +2 -0
- package/dist/chunk-NVRNLK25.mjs +6 -0
- package/dist/chunk-NWFBE2YA.mjs +2 -0
- package/dist/chunk-NWR2LT5B.mjs +2 -0
- package/dist/chunk-OJKMINIU.mjs +20 -0
- package/dist/chunk-OUUP3WKT.mjs +2 -0
- package/dist/chunk-OW5NWPOJ.mjs +10 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-POQSE4C2.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/{chunk-Z52HTUW7.mjs → chunk-PVER7LSC.mjs} +2 -2
- package/dist/chunk-PZDLJJTJ.mjs +3 -0
- package/dist/chunk-Q47PLKIJ.mjs +15 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QKXMPUXC.mjs +2 -0
- package/dist/chunk-QOUEFUCH.mjs +16 -0
- package/dist/chunk-RFDZXFJF.mjs +13 -0
- package/dist/chunk-RKPWLGZ3.mjs +4 -0
- package/dist/chunk-RMECZA2K.mjs +2 -0
- package/dist/{chunk-EUX7IC5J.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SX4LJYT6.mjs +8 -0
- package/dist/chunk-SXHBYZST.mjs +16 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TEZAWDSQ.mjs +2 -0
- package/dist/chunk-UBBRTJ2R.mjs +24 -0
- package/dist/chunk-UFNYFFKO.mjs +20 -0
- package/dist/chunk-UGWYKHBL.mjs +170 -0
- package/dist/chunk-UKSHDZZ6.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-UNOYVIYR.mjs +2 -0
- package/dist/chunk-V6RIYQZZ.mjs +4 -0
- package/dist/chunk-VJPFVNNW.mjs +15 -0
- package/dist/chunk-VS3ZMVGX.mjs +5 -0
- package/dist/chunk-VTKNEYT3.mjs +6 -0
- package/dist/chunk-VXACTLO3.mjs +3 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YQGT4AB2.mjs +6 -0
- package/dist/chunk-ZB4H7ZN4.mjs +2 -0
- package/dist/{chunk-ACOPDCNB.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZUNVAXLH.mjs +2 -0
- package/dist/chunk-ZWPMCK7P.mjs +2 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-EVJ3BX3M.mjs → update-fetch.mjs} +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +95 -0
- package/kit/board.js +250 -0
- package/kit/charts.js +5 -71
- package/kit/code.js +14 -14
- package/kit/math.js +18 -2
- package/kit/report.css +500 -151
- package/kit/runtime.js +1720 -170
- package/kit/state.js +10 -1
- package/kit/tables.js +172 -37
- package/kit/ui.js +166 -27
- package/package.json +2 -1
- package/packs/gallery/card/component.json +14 -0
- package/packs/gallery/card/example.html +10 -0
- package/packs/gallery/card/preview.svg +1 -0
- package/packs/gallery/card/style.css +6 -0
- package/packs/gallery/card/template.html +6 -0
- package/packs/gallery/card/writing.md +14 -0
- package/packs/gallery/chart-card/component.json +15 -0
- package/packs/gallery/chart-card/example.html +14 -0
- package/packs/gallery/chart-card/kit.js +130 -0
- package/packs/gallery/chart-card/preview.svg +1 -0
- package/packs/gallery/chart-card/style.css +42 -0
- package/packs/gallery/chart-card/template.html +13 -0
- package/packs/gallery/chart-card/writing.md +20 -0
- package/packs/gallery/chart-view/component.json +20 -0
- package/packs/gallery/chart-view/example.html +13 -0
- package/packs/gallery/chart-view/kit.js +355 -0
- package/packs/gallery/chart-view/preview.svg +1 -0
- package/packs/gallery/chart-view/style.css +94 -0
- package/packs/gallery/chart-view/template.html +3 -0
- package/packs/gallery/chart-view/writing.md +22 -0
- package/packs/gallery/countdown/component.json +18 -0
- package/packs/gallery/countdown/example.html +3 -0
- package/packs/gallery/countdown/kit.js +156 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +130 -0
- package/packs/gallery/countdown/template.html +3 -0
- package/packs/gallery/countdown/writing.md +22 -0
- package/packs/gallery/habit/component.json +14 -0
- package/packs/gallery/habit/example.html +3 -0
- package/packs/gallery/habit/kit.js +295 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +246 -0
- package/packs/gallery/habit/template.html +3 -0
- package/packs/gallery/habit/writing.md +21 -0
- package/packs/gallery/heatmap/component.json +18 -0
- package/packs/gallery/heatmap/example.html +3 -0
- package/packs/gallery/heatmap/kit.js +351 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +201 -0
- package/packs/gallery/heatmap/template.html +3 -0
- package/packs/gallery/heatmap/writing.md +21 -0
- package/packs/gallery/kanban/component.json +18 -0
- package/packs/gallery/kanban/example.html +12 -0
- package/packs/gallery/kanban/kit.js +540 -0
- package/packs/gallery/kanban/preview.svg +1 -0
- package/packs/gallery/kanban/style.css +212 -0
- package/packs/gallery/kanban/template.html +3 -0
- package/packs/gallery/kanban/writing.md +20 -0
- package/packs/gallery/metric/component.json +22 -0
- package/packs/gallery/metric/example.html +15 -0
- package/packs/gallery/metric/kit.js +248 -0
- package/packs/gallery/metric/preview.svg +1 -0
- package/packs/gallery/metric/style.css +92 -0
- package/packs/gallery/metric/template.html +3 -0
- package/packs/gallery/metric/writing.md +23 -0
- package/packs/gallery/note/component.json +14 -0
- package/packs/gallery/note/example.html +3 -0
- package/packs/gallery/note/kit.js +102 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +76 -0
- package/packs/gallery/note/template.html +3 -0
- package/packs/gallery/note/writing.md +18 -0
- package/packs/gallery/pack.json +8 -0
- package/packs/gallery/recent/component.json +13 -0
- package/packs/gallery/recent/example.html +1 -0
- package/packs/gallery/recent/kit.js +238 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +158 -0
- package/packs/gallery/recent/template.html +1 -0
- package/packs/gallery/recent/writing.md +15 -0
- package/packs/gallery/static/component.json +13 -0
- package/packs/gallery/static/example.html +11 -0
- package/packs/gallery/static/preview.svg +1 -0
- package/packs/gallery/static/style.css +138 -0
- package/packs/gallery/static/template.html +1 -0
- package/packs/gallery/static/writing.md +18 -0
- package/packs/gallery/stats/component.json +13 -0
- package/packs/gallery/stats/example.html +1 -0
- package/packs/gallery/stats/kit.js +166 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +151 -0
- package/packs/gallery/stats/template.html +1 -0
- package/packs/gallery/stats/writing.md +11 -0
- package/packs/gallery/today/component.json +12 -0
- package/packs/gallery/today/example.html +1 -0
- package/packs/gallery/today/kit.js +185 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +120 -0
- package/packs/gallery/today/template.html +1 -0
- package/packs/gallery/today/writing.md +14 -0
- package/packs/gallery/todos/component.json +19 -0
- package/packs/gallery/todos/example.html +3 -0
- package/packs/gallery/todos/kit.js +342 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +267 -0
- package/packs/gallery/todos/template.html +3 -0
- package/packs/gallery/todos/writing.md +30 -0
- package/packs/gallery/weather/component.json +19 -0
- package/packs/gallery/weather/example.html +3 -0
- package/packs/gallery/weather/kit.js +312 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +258 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/release.json +13 -11
- package/sdk/doc-kit.d.ts +404 -7
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +71 -26
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/example-report.html +1 -1
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +221 -0
- package/skill/references/writing-html.md +9 -7
- package/skill/sdk/doc-kit.d.ts +404 -7
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BK2e_07w.js +13 -0
- package/web/assets/index-CWFI83mF.css +1 -0
- package/web/index.html +2 -2
- package/browser/editor/components/callout/page.mjs +0 -13
- package/dist/chunk-2PBALTR3.mjs +0 -57
- package/dist/chunk-3LA3EMDE.mjs +0 -15
- package/dist/chunk-5FRMCDPY.mjs +0 -16
- package/dist/chunk-5LEK2CBS.mjs +0 -2
- package/dist/chunk-5OFN5AHC.mjs +0 -2
- package/dist/chunk-5SIYS5HN.mjs +0 -2
- package/dist/chunk-5TEK3RAD.mjs +0 -2
- package/dist/chunk-6CYG3Z4V.mjs +0 -2
- package/dist/chunk-7GHT2UCA.mjs +0 -15
- package/dist/chunk-7QQBR7PB.mjs +0 -2
- package/dist/chunk-ATCJYAR4.mjs +0 -2
- package/dist/chunk-C7HWOBIF.mjs +0 -2
- package/dist/chunk-E7VYDG2X.mjs +0 -2
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FQGQH4KM.mjs +0 -2
- package/dist/chunk-G7TOXONE.mjs +0 -6
- package/dist/chunk-GPF4YWWB.mjs +0 -9
- package/dist/chunk-GYQV7Y4J.mjs +0 -120
- package/dist/chunk-HMHK3EQ6.mjs +0 -2
- package/dist/chunk-HQQMJCQJ.mjs +0 -10
- package/dist/chunk-IERUOGC3.mjs +0 -6
- package/dist/chunk-ITNLYXXV.mjs +0 -3
- package/dist/chunk-L4DVONOG.mjs +0 -2
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LC7YNQFG.mjs +0 -2
- package/dist/chunk-LHTFLRB6.mjs +0 -4
- package/dist/chunk-NFIBI4IP.mjs +0 -26
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O52JMOCZ.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-QMQUXTU4.mjs +0 -12
- package/dist/chunk-QVWVFC5K.mjs +0 -6
- package/dist/chunk-QYKCJ7FG.mjs +0 -8
- package/dist/chunk-QZY6Q64C.mjs +0 -2
- package/dist/chunk-TDQP3DKQ.mjs +0 -10
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-UNUEWH4S.mjs +0 -2
- package/dist/chunk-V4CPWKMZ.mjs +0 -2
- package/dist/chunk-VACRB2NE.mjs +0 -3
- package/dist/chunk-W63L7367.mjs +0 -7
- package/dist/chunk-W7CXPCRV.mjs +0 -6
- package/dist/chunk-XINNG4F2.mjs +0 -4
- package/dist/chunk-YL2DPWVS.mjs +0 -4
- package/dist/chunk-YZ5Z6H4W.mjs +0 -4
- package/dist/chunk-ZBIM6ARY.mjs +0 -216
- package/skill/references/building-components.md +0 -327
- package/web/assets/index-B6Ai3wsa.js +0 -13
- package/web/assets/index-SYPC3EZy.css +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a as fe,b as At}from"./chunk-342HXE3Q.mjs";import{c as ue,d as pe}from"./chunk-BPL64HGA.mjs";import{b as ae}from"./chunk-OUUP3WKT.mjs";import{a as ie,b as re,c as le,d as ce,f as Dt,g as de,h as he}from"./chunk-PUOQ65NC.mjs";import{b as _t,c as ee,d as oe,f as ne,h as se}from"./chunk-6VTU6KEO.mjs";import{b as Wt,j as Qt}from"./chunk-4OZWXZE5.mjs";import{g as te}from"./chunk-OW5NWPOJ.mjs";import{a as Zt}from"./chunk-HYMEEXKN.mjs";import{a as Vt}from"./chunk-UMHUSOPJ.mjs";import{spawnSync as Le}from"node:child_process";import vt from"node:fs/promises";import ht from"node:path";import{pathToFileURL as Ie}from"node:url";import{MATH_IGNORED_TAGS as Fe}from"../browser/shared/components/math.mjs";import{exportPackagesOf as Pe,exportSourceOf as Ve,packagesSaid as _e}from"../browser/shared/export-wrap.mjs";import{sha256 as ge}from"../browser/shared/files.mjs";import{attr as me}from"../browser/shared/html-tree.mjs";import{projectRoot as De,qaDirectory as He,reportsDirectory as Rt}from"../browser/shared/paths.mjs";import{documentDirectory as Lt,documentFiles as It}from"../browser/shared/workspace.mjs";import{KINDS as Yo,LEVELS as Bt,LOOKS as we,WIDE as Ko,WIDTHS as $e,layoutNotesOf as ze,levelOf as Ee}from"../browser/shared/qa-levels.mjs";import{tableHidesScript as Ue}from"../browser/shared/table-hides.mjs";var Ge=new Set(["code-scrolls","formula-scrolls"]),qe=(e,n)=>e.level??Ee(e.kind,n),Ye=(e,n)=>["fail","warn"].includes(qe(e,n))||Ge.has(e.kind)&&Ee(e.kind,n)==="info",Ke=4,Ae=12,Xe=8,Je=2,xe=200,Qe=2e3,ye=600;function Ze({block:e,above:n=null,below:s=null}){let l=[e,n,s].filter(Boolean),i=Math.min(...l.map(u=>u.left)),d=Math.max(...l.map(u=>u.right)),w=n?Math.max(Math.min(n.top,e.top),e.top-xe):e.top,f=s?Math.min(Math.max(s.bottom,e.bottom),e.bottom+xe):e.bottom,x=(u,A)=>({x:Math.max(0,i),y:Math.max(0,u),width:d-i,height:A-Math.max(0,u)});return e.bottom-e.top<=Qe?[{part:"",clip:x(w,f)}]:[{part:"top",clip:x(w,e.top+ye)},{part:"bottom",clip:x(e.bottom-ye,f)}]}function be(e,n=""){if(e.startsWith("data:"))return`${e.slice(0,30)}\u2026 (${e.length} characters)`;let s=n.slice(0,n.lastIndexOf("/")+1);if(s&&e.startsWith(s)&&e.length>s.length)try{return decodeURIComponent(e.slice(s.length))}catch{return e.slice(s.length)}return e.length>60?`\u2026${e.slice(-59)}`:e}var Ft=e=>String(e??"").replace(/\s+/g," ").trim(),Mt=(e,n=40)=>{let s=Ft(e);return`"${s.length>n?`${s.slice(0,n-1)}\u2026`:s}"`},to=e=>String(e??"").replace(/\s+/g,"").slice(0,120);function eo(e,n="doc.html"){let s=new Map,l=new Map,i=new Map,d=(x,u)=>(u&&x.sourceCodeLocation.attrs?.[u]||x.sourceCodeLocation).startLine,w=new Map,f=x=>{if(x.nodeName==="#text")return x.value;if(!x.tagName&&x.nodeName!=="#document"||x.tagName==="template")return"";let u=(x.childNodes??[]).map(f).join("");if(!x.tagName||!x.sourceCodeLocation)return u;let A=me(x,"data-block-id");A!==void 0&&!s.has(A)&&s.set(A,d(x,"data-block-id"));let j=me(x,"id");j!==void 0&&!l.has(j)&&l.set(j,d(x,"id"));let K=to(u);if(K.length>=2){let m=`${x.tagName}|${K}`;w.has(m)||w.set(m,[]),w.get(m).push(x.sourceCodeLocation)}return u};f(Zt(e));for(let[x,u]of w)i.set(x,u.sort((A,j)=>A.startOffset-j.startOffset).map(A=>A.startLine));return{blocks:s,ids:l,texts:i,name:n}}function oo(e,n){if(!e)return"the page";let s=n.name??"doc.html",l=u=>{let A=u&&n.texts.get(`${u.tag}|${u.words}`);return A?.[Math.min(u.nth??0,A.length-1)]},i=e.table||e.header?.text,d=e.card?` card ${Mt(e.card.text)}`:i?` table ${Mt(i)}`:"",w=e.blocks?.find(u=>n.blocks.has(u));if(w!==void 0)return`${s}:${n.blocks.get(w)} [data-block-id="${w}"]${d}`;if(l(e.card))return`${s}:${l(e.card)} card ${Mt(e.card.text)}`;if(l(e.header))return`${s}:${l(e.header)} table ${Mt(i)}`;let f=e.texts?.find(l);if(f)return`${s}:${l(f)} ${f===e.texts[0]&&f.tag===e.tag?"":`${e.element} in `}<${f.tag}> ${Mt(f.text,32)}`;let x=e.ids?.find(u=>n.ids.has(u));return x!==void 0?`${s}:${n.ids.get(x)} #${x}${d}`:l(e.section)?`${s}:${l(e.section)} ${e.element} in the section ${Mt(e.section.text)}`:`${e.element}${d} (not found in ${s})`}function Yt(e){let n=new Date(e),s=d=>String(d).padStart(2,"0"),l=-n.getTimezoneOffset(),i=`${l<0?"-":"+"}${s(Math.floor(Math.abs(l)/60))}:${s(Math.abs(l)%60)}`;return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}T${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}${i}`}function no(e,n,s={said:"",now:""}){return e===n?s.said===s.now?{stale:!1,why:""}:{stale:!0,packaged:!0,why:`it holds ${s.said||"no custom block"}, the workspace has ${s.now||"none of them"}`}:{stale:!0,why:e?`made from a text whose sha256 is ${e.slice(0,12)}\u2026, the file's is ${n.slice(0,12)}\u2026`:"it does not say which text it was made from: made before exports said it, or before the kit's names were doc-* (2026-10-26), whose pages gallery qa no longer reads"}}async function Kt(e,{made:n=!1}={}){let s=It(Lt(e,Rt)).html,l=At(e),[i,d]=await Promise.all([vt.readFile(s).catch(()=>null),vt.stat(l).catch(()=>null)]);if(!i)return{problem:`${e}: no document (${s})`};if(!d)return{problem:`${e}: no export (${l}): run gallery export ${e} first`,missing:!0};let w=await vt.readFile(l),f=w.toString("utf8"),x=Ve(f),u={said:Pe(f),now:_e(te(i.toString("utf8")))},{stale:A,why:j,packaged:K=!1}=no(x,ge(i),u);return A&&!n?{problem:`${e}: ${l} is not of ${s} as it is now (${j}): run gallery export ${e} first`,stale:!0,why:j,edited:!!x&&!K,packaged:K}:{file:l,sha256:ge(w),time:d.mtimeMs}}function so(e,n){let s=e.map((w,f)=>({length:1,weight:n[f],previous:-1})),l=(w,f)=>w.length>f.length||w.length===f.length&&w.weight>f.weight;e.forEach((w,f)=>{for(let x=0;x<f;x++){if(e[x]>=w)continue;let u={length:s[x].length+1,weight:s[x].weight+n[f],previous:x};l(u,s[f])&&(s[f]=u)}});let i=-1;s.forEach((w,f)=>{(i<0||l(w,s[i]))&&(i=f)});let d=[];for(let w=i;w>=0;w=s[w].previous)d.unshift(w);return d}function Be(e,n){let s=n?.places??{},l=new Set((n?.moved??[]).filter(d=>e.has(d))),i=new Map;for(let[d,{parent:w,size:f=0}]of e){let x=s[d];if(x){if(x[0]!==w){l.add(d);continue}i.has(w)||i.set(w,[]),i.get(w).push({id:d,at:x[1],size:f})}}for(let d of i.values()){let w=new Set(so(d.map(({at:f})=>f),d.map(({size:f})=>f)).map(f=>d[f].id));for(let{id:f}of d)w.has(f)||l.add(f)}return l}function ao(e,n,s,{named:l=null,verified:i=!0,failed:d=!1,seen:w=null,page:f=void 0,packages:x=void 0}={}){if(!i||d||l&&!n)return null;let u=w??new Set([...s.ids,...[...s.held?.values()??[]].flat()]),A=!n,j=A||s.pageChanged?s.cards??[]:[],K=[...n?.unseen??[],...j],m={blocks:{},places:{},moved:A?[]:[...Be(e,n)].filter($=>!u.has($)),unseen:[...new Set(K)].filter($=>e.has($)&&!u.has($))};for(let[$,{hash:Y,parent:X,at:gt}]of e){let N=A||u.has($)?Y:n.blocks[$];N!==void 0&&(m.blocks[$]=N),m.places[$]=[X,gt]}let E=!A&&(l||s.tiles)?n.page:f;typeof E=="string"&&(m.page=E);let z=!A&&(l||s.tiles)?n.packages:x&&Object.fromEntries(Object.entries(x).map(([$,Y])=>[$,(s.restyled?.get($)??[]).every(X=>u.has(X))?Y:n.packages[$]]));return z&&Object.keys(z).length&&(m.packages=z),m}function Oe(e){let n=new Map;for(let s of e){let l=new Set(s.held?.covered??[]);for(let i of s.held?.missed??[])l.has(i)||n.set(i,[...n.get(i)??[],s.label??String(s.width)])}return n}function io(e,n){let s=Oe(n);return new Set([...e.ids,...[...e.held?.values()??[]].flat().filter(l=>!s.has(l))])}function Se(e){let n=e.time?` of ${Yt(e.time)}`:"";return e.from==="export"?`the export${n} (the document before these changes)`:e.from==="preview"?`gallery open${n} (the document before these changes)`:"the last look"}var ro=3;function lo(e,n,s=null,{tiles:l=!1,page:i=void 0,packages:d=void 0}={}){let w={rest:[],unknown:[],moved:new Set,around:new Map,held:new Map,groups:[],cards:[],pageChanged:!1,changed:new Set,restyled:new Map,left:null},f=[...e.keys()],x=new Map(f.map((a,M)=>[a,M])),u=n?Be(e,n):new Set,A=a=>typeof n?.packages?.[a]=="string"&&typeof d?.[a]=="string"&&n.packages[a]!==d[a],j=n?f.filter(a=>A(e.get(a).package)&&n.blocks[a]===e.get(a).hash&&!u.has(a)):[],K=new Map;for(let a of j)K.set(e.get(a).package,[...K.get(e.get(a).package)??[],a]);let m=new Set(j),E=n?f.filter(a=>n.blocks[a]!==e.get(a).hash||u.has(a)||m.has(a)):[],z=new Set((n?.unseen??[]).filter(a=>e.has(a)&&!E.includes(a))),$=(a,M)=>{let G=null;for(let et=e.get(a).parent;et!==null&&e.has(et);et=e.get(et).parent)M.has(et)&&(G=et);return G},Y=new Set(E),X=new Set(E.filter(a=>e.get(a).card||u.has(a))),gt=a=>Y.has(a)&&!u.has(a)&&$(a,X)===null,N=new Map;for(let a of f)for(let M=e.get(a).parent;M!==null&&e.has(M);M=e.get(M).parent){let G=N.get(M)??{all:0,changed:0};G.all+=1,gt(a)&&(G.changed+=1),N.set(M,G)}let Q=f.filter(a=>!e.get(a).card&&N.has(a)&&N.get(a).changed>=ro&&N.get(a).changed*2>=N.get(a).all);if(s){let a=[...new Set(s)].filter(o=>e.has(o)),M=new Set(a),G=new Map;for(let o of f){let r=M.has(o)?null:$(o,M);r!==null&&G.set(r,[...G.get(r)??[],o])}let et="the blocks named",$t=new Set([...a,...[...G.values()].flat()]),yt=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,xt=new Set([...E.filter(o=>e.get(o).card||u.has(o)),...Q]),bt=!n||yt?f.filter(o=>e.get(o).card&&!E.includes(o)):[],Pt=new Set([...xt,...bt]),Nt=[...E,...Q.filter(o=>!Y.has(o))].sort((o,r)=>x.get(o)-x.get(r)).filter(o=>!$t.has(o)&&$(o,xt)===null),Tt=Nt.filter(o=>m.has(o)),t={changed:Nt.filter(o=>!m.has(o)),...Tt.length?{restyled:Tt,packages:[...new Set(Tt.map(o=>e.get(o).package))]}:{},cards:bt.filter(o=>!$t.has(o)&&$(o,Pt)===null).sort((o,r)=>e.get(o).rank-e.get(r).rank||x.get(o)-x.get(r)),since:n?Se(n):"",first:!n};return{...w,ids:a,why:et,groups:[{kind:"named",why:et,ids:a,rest:[]}],held:G,pageChanged:yt,changed:new Set(E),restyled:K,left:t,unknown:[...new Set(s)].filter(o=>!e.has(o))}}if(e.size===0)return{...w,ids:[],why:"the document has no block ids (never handed in): the whole page in tiles instead",tiles:!0};if(l)return{...w,ids:[],why:null,tiles:!0};let h=(...a)=>(M,G)=>a.reduce((et,$t)=>et||$t(M)-$t(G),0),B=a=>e.get(a).rank,_=a=>x.get(a),tt=n?Se(n):"",C=!!n&&typeof n.page=="string"&&typeof i=="string"&&n.page!==i,v=f.filter(a=>e.get(a).card&&!E.includes(a)),L=!n||C||E.length===0?v:v.filter(a=>z.has(a)),it=new Set([...E.filter(a=>e.get(a).card||u.has(a)),...Q]),dt=new Set([...it,...L]),Z=new Map,at=(a,M)=>a.filter(G=>{let et=$(G,M);return et!==null&&Z.set(et,[...Z.get(et)??[],G]),et===null}),V=[...at(E,it),...Q.filter(a=>!Y.has(a)&&$(a,it)===null)].sort(h(a=>+!u.has(a),B,_)),pt=V.filter(a=>m.has(a)),lt=V.filter(a=>!m.has(a)),st=at(L,dt).sort(h(a=>+!z.has(a),B,_)),ct="the cards (chart cards, code blocks, whole blocks, components, flowcharts and Sheet areas, then columns and the other figures, then tables)",y=st.some(a=>z.has(a))?", those no look has pictured yet first":"",D=typeof n?.page=="string"&&typeof i=="string",F=n?C?`${ct.replace("the cards","the cards, not changed themselves")}${y}: the document's own <script> or <style> changed since ${tt}, which may draw any of them`:E.length?"the cards no look has pictured yet (not changed themselves)":`${ct}${y}: no block changed since ${tt}${D?", nor the document's own <script> or <style>":""}`:`${ct}: no earlier look to compare with`,J=[...lt.length?[{kind:"changed",why:`the blocks changed since ${tt}${u.size?" (a moved block pictured with the edges of the blocks before and after it, the moved ones first)":""}`,all:lt}]:[],...pt.length?[{kind:"changed",why:`the instances of a custom block changed since ${tt} (${[...new Set(pt.map(a=>e.get(a).package))].join(", ")})`,all:pt}]:[],...st.length||!V.length?[{kind:"cards",why:F,all:st}]:[]],R=Ae;for(let a of J)a.ids=a.all.slice(0,R),a.rest=a.all.slice(a.ids.length),R-=a.ids.length,delete a.all;let I=J.flatMap(a=>a.ids),k=a=>{let{parent:M,at:G}=e.get(a),et=$t=>f.find(yt=>e.get(yt).parent===M&&e.get(yt).at===G+$t)??null;return[et(-1),et(1)]},H=new Map(I.filter(a=>u.has(a)).map(a=>[a,k(a)])),c=new Map(I.filter(a=>Z.has(a)).map(a=>[a,Z.get(a)]));return{...w,ids:I,why:J[0].why,groups:J,rest:J.flatMap(a=>a.rest),moved:new Set(I.filter(a=>u.has(a))),around:H,held:c,cards:L,pageChanged:C,changed:new Set(E),restyled:K}}function co(e){let n=m=>!!m.closest("[data-doc-dev]"),s=[...document.querySelectorAll("details")].filter(m=>!n(m)),l=s.filter(m=>!m.open).length;s.forEach(m=>{m.open||m.setAttribute("data-qa-closed",""),m.open=!0});let i=[...document.images].filter(m=>!n(m));i.forEach(m=>{m.loading==="lazy"&&(m.loading="eager")});let d=[...document.querySelectorAll("dialog")].filter(m=>!n(m)&&!m.open);d.forEach((m,E)=>{m.dataset.qaCard=String(E)});let w=m=>m.parentElement?.closest("dialog[data-qa-card]")??null,f=[...document.querySelectorAll("[data-doc-sheets] > .doc-sheet-tabs > [data-sheet-tab]")].filter(m=>!n(m));f.forEach((m,E)=>{m.dataset.qaTab=String(E)});let x=m=>m.parentElement.parentElement,u=m=>{let E=[];for(let z=m.closest("[data-doc-sheet]");z;z=z.parentElement.closest("[data-doc-sheet]")){let $=f.find(Y=>x(Y)===z.parentElement&&Y.getAttribute("data-sheet-tab")===z.getAttribute("data-doc-sheet"));$&&E.unshift(Number($.dataset.qaTab))}return E},A=f.map((m,E)=>{let z=[...u(x(m)),E],$=[...x(m).children].find(X=>X.getAttribute("data-doc-sheet")===m.getAttribute("data-sheet-tab"));$&&($.dataset.qaPanel=String(E));let Y=w(m);return{index:E,chain:z,card:Y?Number(Y.dataset.qaCard):null,label:(m.textContent??"").replace(/\s+/g," ").trim(),shown:z.every(X=>f[X].getAttribute("aria-selected")==="true"),panel:!!$}}),j=d.map((m,E)=>{let z=`[href="#${CSS.escape(m.id)}"]`,$=[...m.querySelectorAll("h1, h2, h3, h4")].find(X=>X.textContent.trim())??document.querySelector(z),Y=[];for(let X=w(m);X;X=w(X))Y.unshift(Number(X.dataset.qaCard));return{index:E,chain:u(m),within:Y,label:($?.textContent||m.id||"").replace(/\s+/g," ").trim()}}),K=Promise.all(i.map(m=>m.decode().catch(()=>{})));return Promise.race([K.then(()=>!0),new Promise(m=>setTimeout(()=>m(!1),e))]).then(m=>({details:s.length,closed:l,images:i.length,loaded:m,sheets:A,cards:j}))}function ke(e){let n=document.querySelector(`[data-qa-card="${e}"]`);return n?(n.open||(globalThis.DocDialogs?globalThis.DocDialogs.open(n,null):typeof n.showModal=="function"?n.showModal():n.setAttribute("open","")),document.activeElement?.blur?.(),Promise.all(n.getAnimations({subtree:!0}).map(s=>s.finished.catch(()=>{}))).then(()=>n.open&&n.getClientRects().length>0)):Promise.resolve(!1)}function Ht(e){let n=document.querySelector(`[data-qa-card="${e}"]`);n?.open&&(globalThis.DocDialogs?globalThis.DocDialogs.close(n):typeof n.close=="function"?n.close():n.removeAttribute("open"))}async function ho({selector:e,up:n=0,margin:s=0,frames:l=2}){let i=document.querySelector(e);for(let v=0;v<n&&i;v++)i=i.parentElement;if(!i||i.getClientRects().length===0)return null;let d=i.getBoundingClientRect();i.scrollIntoView({block:"nearest",inline:"nearest"});let w=i.getBoundingClientRect();if(d.top!==w.top||d.left!==w.left){let v=()=>new Promise(U=>{requestAnimationFrame(()=>U()),setTimeout(U,100)});for(let U=0;U<l;U++)await v()}let f=v=>v===document.body||v===document.documentElement,x=(v,U,L)=>{let{left:it,top:dt,right:Z,bottom:at}=v;for(let V=U;V&&!f(V);V=V.parentElement){let pt=getComputedStyle(V),lt=pt.overflowX!=="visible",st=pt.overflowY!=="visible";if(lt||st){let ct=V.getBoundingClientRect();lt&&([it,Z]=[Math.max(it,ct.left),Math.min(Z,ct.right)]),st&&([dt,at]=[Math.max(dt,ct.top),Math.min(at,ct.bottom)])}if(V===L)break}return Z>it&&at>dt?{left:it,top:dt,right:Z,bottom:at}:null},u=v=>parseFloat(v)||0,A=(v,U)=>{let L=getComputedStyle(v,U);if(["none","normal"].includes(L.content)||L.display==="none"||!["absolute","fixed"].includes(L.position))return null;let it=L.position==="fixed"?null:getComputedStyle(v).position!=="static"?v:v.offsetParent,dt=it?it.getBoundingClientRect():{left:0,top:0,right:innerWidth,bottom:innerHeight},Z=it?getComputedStyle(it):null,at={left:dt.left+u(Z?.borderLeftWidth),top:dt.top+u(Z?.borderTopWidth),right:dt.right-u(Z?.borderRightWidth),bottom:dt.bottom-u(Z?.borderBottomWidth)},V=(y,D)=>L.boxSizing==="border-box"?0:u(L[`padding${y}`])+u(L[`padding${D}`])+u(L[`border${y}Width`])+u(L[`border${D}Width`]),pt=u(L.width)+V("Left","Right"),lt=u(L.height)+V("Top","Bottom"),st=L.left!=="auto"?at.left+u(L.left)+u(L.marginLeft):L.right!=="auto"?at.right-u(L.right)-u(L.marginRight)-pt:null,ct=L.top!=="auto"?at.top+u(L.top)+u(L.marginTop):L.bottom!=="auto"?at.bottom-u(L.bottom)-u(L.marginBottom)-lt:null;return st===null||ct===null||!(pt>0)||!(lt>0)?null:x({left:st,top:ct,right:st+pt,bottom:ct+lt},v,i)},j=[i.getBoundingClientRect()],K=[i];for(let v of i.querySelectorAll("*"))v instanceof SVGElement&&v.ownerSVGElement||v.matches("script, style, template")||v.getClientRects().length===0||getComputedStyle(v).visibility!=="hidden"&&(K.push(v),j.push(x(v.getBoundingClientRect(),v.parentElement,i)));for(let v of K)j.push(A(v,"::before"),A(v,"::after"));let m=document.createRange(),E=document.createTreeWalker(i,NodeFilter.SHOW_TEXT);for(let v=E.nextNode();v;v=E.nextNode())if(!(!v.nodeValue.trim()||!v.parentElement||v.parentElement.closest("svg, script, style, template"))){m.selectNodeContents(v);for(let U of m.getClientRects())j.push(x(U,v.parentElement,i))}m.detach();let z=j.filter(Boolean),$={left:Math.min(...z.map(v=>v.left)),top:Math.min(...z.map(v=>v.top)),right:Math.max(...z.map(v=>v.right)),bottom:Math.max(...z.map(v=>v.bottom))},Y=x($,i.parentElement,null)??$,X=!1;for(let v=i;v&&!X;v=v.parentElement)X=getComputedStyle(v).position==="fixed";let gt=visualViewport.pageLeft,N=visualViewport.pageTop,[Q,h]=X?[gt+innerWidth,N+innerHeight]:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],B=Math.max(X?gt:0,Y.left+gt-s),_=Math.max(X?N:0,Y.top+N-s),tt=Math.min(Q,Y.right+gt+s),C=Math.min(h,Y.bottom+N+s);return tt>B&&C>_?{clip:{x:B,y:_,width:tt-B,height:C-_},fixed:X}:null}function ve(e){for(let s of e){let l=document.querySelector(`[data-qa-tab="${s}"]`);l&&l.getAttribute("aria-selected")!=="true"&&l.click()}let n=document.querySelector(`[data-qa-panel="${e.at(-1)}"]`);return!!(n&&!n.hidden&&n.getClientRects().length>0)}function zt({scope:e,next:n,ignored:s=[],place:l,slack:i=4,whole:d=[],drawn:w=[]}){let f=e?document.querySelector(e):document.body,x=[];if(!f)return{found:x,next:n};let u=document.documentElement.clientWidth,A=Math.round,j=t=>String(t??"").replace(/\s+/g," ").trim(),K=(t,o=32)=>{let r=j(t);return`"${r.length>o?`${r.slice(0,o-1)}\u2026`:r}"`},m=t=>!!t.closest?.("[data-doc-dev]"),E=t=>{if(!t.isConnected||t.getClientRects().length===0)return!1;for(let o=t;o&&o.nodeType===1;o=o.parentElement){let r=getComputedStyle(o);if(r.visibility==="hidden"||r.display==="none"||Number(r.opacity)===0||o.matches(".katex-mathml, .sr-only, [role=tooltip], [data-doc-dev]"))return!1}return!0},z=t=>`${t.localName}${[...t.classList].filter(o=>!o.startsWith("is-")).slice(0,2).map(o=>`.${o}`).join("")}`,$=t=>(t.textContent??"").replace(/\s+/g,"").slice(0,120),Y=new Map,X=t=>{let o=$(t);if(!Y.has(t.localName)){let b=new Map;for(let O of document.getElementsByTagName(t.localName)){if(m(O))continue;let W=$(O);b.has(W)||b.set(W,[]),b.get(W).push(O)}Y.set(t.localName,b)}let r=Y.get(t.localName).get(o)?.indexOf(t)??0;return{tag:t.localName,words:o,nth:Math.max(0,r),text:j(t.textContent).slice(0,80)}},gt=t=>{let o=t.cloneNode(!0);for(let r of o.querySelectorAll(".doc-tab"))r.before(" \xB7 ");return j(o.textContent).replace(/^· /,"")},N=t=>{let o=t.matches("table")?t:t.querySelector("table"),r=t.closest(".doc-table-wrap")??t,b=r.getAttribute("data-doc-chart-source")?.trim(),W=(b?[...document.querySelectorAll("[data-doc-chart-data]")].find(S=>S.getAttribute("data-doc-chart-data").trim()===b&&!m(S)):null)?.closest("figure")?.querySelector(":scope > h2, :scope > h3, :scope > h4, :scope > figcaption"),p=r.previousElementSibling;return j(o?.caption?.textContent)||j(W?.textContent)||(p?.matches("p.doc-note")?gt(p):"")||j(o?.querySelector("th")?.textContent??o?.rows[0]?.cells[0]?.textContent)},Q=t=>{let o=t.nodeType===1?t:t.parentElement,r=[],b=[];for(let g=o;g&&g!==document.documentElement;g=g.parentElement)g.hasAttribute("data-block-id")&&r.push(g.getAttribute("data-block-id")),g.id&&!g.hasAttribute("data-qa-tab")&&!g.hasAttribute("data-qa-panel")&&b.push(g.id);let O=[];for(let g=o,T=0;g&&T<4&&!g.matches("body, main, section, [data-doc-sheet], [data-doc-sheets], .doc-columns, .doc-column");g=g.parentElement,T++){let ot=X(g);ot.words.length>=2&&O.push(ot)}let W=o.closest("figure")?.querySelector(":scope > h3, :scope > figcaption, :scope > .doc-figure-caption"),p=o.closest(".doc-table-wrap, table"),S=p?.querySelector("th"),q=o.closest("section")?.querySelector(":scope > h2, :scope > h3, :scope > h4");return{blocks:r,ids:b,texts:O,tag:o.localName,element:z(o),card:W?X(W):null,header:S?X(S):null,table:p?N(p).slice(0,80):null,section:q?X(q):null}};if(l){let t=document.querySelector(l);return{found:x,next:n,anchor:t?Q(t):null}}let h=t=>(t.dataset.qaShot||(t.dataset.qaShot=String(++n)),Number(t.dataset.qaShot)),B=(t,o,r,{picture:b=o,url:O,measured:W,scroll:p,level:S}={})=>x.push({kind:t,what:r,anchor:o?Q(o):null,shot:b?h(b):null,seen:!!(b&&E(b)),url:O,measured:W,scroll:p,...S?{level:S}:{}}),_=t=>t.closest("figure")??t.closest("[data-doc-chart]")??t,tt=t=>{let o=t.getBoundingClientRect();return o.width>0&&o.height>0},C=(t,o,{x:r=!0,y:b=!0}={})=>Math.max(r?o.left-t.left:-1/0,r?t.right-o.right:-1/0,b?o.top-t.top:-1/0,b?t.bottom-o.bottom:-1/0),v=t=>({left:Math.min(...t.map(o=>o.x)),right:Math.max(...t.map(o=>o.x)),top:Math.min(...t.map(o=>o.y)),bottom:Math.max(...t.map(o=>o.y))}),U=t=>{let o=t.getBBox(),r=t.getScreenCTM();return v([[o.x,o.y],[o.x+o.width,o.y],[o.x+o.width,o.y+o.height],[o.x,o.y+o.height]].map(([b,O])=>new DOMPoint(b,O).matrixTransform(r)))},L=t=>{let o=[];for(let r=t.parentElement;r&&r!==document.documentElement;r=r.parentElement){let b=getComputedStyle(r);r instanceof SVGSVGElement&&b.overflow!=="visible"&&o.push(["the svg's edge",r.getBoundingClientRect(),{}]);let O=/url\(\s*["']?#([^)"']+)/.exec(`${r.getAttribute?.("clip-path")??""} ${b.clipPath??""}`)?.[1],W=O?document.getElementById(O):null,p=W?.getAttribute("clipPathUnits")!=="objectBoundingBox"?W?.querySelector("rect"):null;if(p&&r.getScreenCTM){let[S,q,g,T]=["x","y","width","height"].map(ot=>p[ot].baseVal.value);o.push(["a clip-path",v([[S,q],[S+g,q+T]].map(([ot,rt])=>new DOMPoint(ot,rt).matrixTransform(r.getScreenCTM()))),{}])}if(!(r instanceof SVGElement)){let S=/hidden|clip/.test(b.overflowX),q=/hidden|clip/.test(b.overflowY);(S||q)&&o.push([z(r),r.getBoundingClientRect(),{x:S,y:q}])}}return o},it=t=>`${t.slice(0,4).join("; ")}${t.length>4?`; ${t.length-4} more`:""}`,dt=t=>!t.matches("script, [data-doc-dev]")&&(t.matches("svg, canvas")||t.querySelector("svg, canvas")||E(t)&&tt(t));for(let t of f.querySelectorAll("[data-doc-chart]"))m(t)||!E(t)||[...t.children].some(dt)||B("chart-empty",t,`the ${t.getAttribute("data-doc-chart")||"chart"} chart drew nothing`,{picture:_(t)});let Z=[...f.querySelectorAll("svg")].filter(t=>{if(t.parentElement.closest("svg")||m(t)||t.closest(".katex, .doc-icon, button")||!E(t))return!1;let o=t.getBoundingClientRect();return t.closest("[data-doc-chart], figure")||o.width>=120&&o.height>=60}),at={across:.6,down:.25},V=new Map;for(let t of Z){let o=_(t),r=o.getBoundingClientRect(),b=[],O=[],W=[...t.querySelectorAll("text")].filter(q=>!q.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(q.textContent)&&E(q));for(let q of W){let g=U(q),T=L(q).map(([ot,rt,ut])=>[ot,C(g,rt,ut)]).find(([,ot])=>ot>1.5);T?b.push(`${K(q.textContent,24)} ${A(T[1])}px past ${T[0]}`):C(g,r)>1.5&&O.push(`${K(q.textContent,24)} ${A(C(g,r))}px past the card's edge`)}b.length&&B("chart-text-clipped",t,it(b),{picture:o}),O.length&&B("chart-text-outside",t,it(O),{picture:o});let p=q=>{let g=/^(-?)[$¥€£]?(\d[\d,]*(?:\.\d+)?)\s*(?:%|‰|[kKMBG]|万|亿)?$/.exec(q.replace(/[−–]/g,"-"));return g?+`${g[1]}${g[2].replace(/,/g,"")}`:NaN},S=q=>q.every(Number.isFinite)&&q[1]!==q[0]&&q.slice(2).every((g,T)=>Math.abs(g-q[T+1]-(q[1]-q[0]))<=1e-9*Math.max(1,Math.abs(g)));for(let q of t.querySelectorAll("g")){let g=[...q.children].filter(P=>P.matches("g.tick")&&E(P)),T=g.map(P=>P.querySelector("text")).filter(P=>P&&j(P.textContent)&&E(P)),ot=T.map(P=>j(P.textContent));if(ot.length<2||ot.length!==g.length||!S(ot.map(p)))continue;let rt=T.map(P=>{let kt=P.getScreenCTM(),je=(parseFloat(getComputedStyle(P).fontSize)||0)*(kt?Math.hypot(kt.c,kt.d):1);return{label:P,box:U(P),size:je,turned:!!kt&&Math.abs(kt.b)>.001*Math.abs(kt.a)}});if(rt.some(P=>P.turned||!(P.size>0)))continue;let ut=rt.map(({box:P})=>[(P.left+P.right)/2,(P.top+P.bottom)/2]),nt=Math.max(...ut.map(([P])=>P))-Math.min(...ut.map(([P])=>P))>=Math.max(...ut.map(([,P])=>P))-Math.min(...ut.map(([,P])=>P)),mt=({box:P,size:kt})=>nt?[P.left,P.right]:[(P.top+P.bottom-kt)/2,(P.top+P.bottom+kt)/2],St=[...rt].sort((P,kt)=>mt(P)[0]-mt(kt)[0]),wt=null;for(let P=1;P<St.length;P++){let kt=mt(St[P])[0]-mt(St[P-1])[1];(!wt||kt<wt.gap)&&(wt={gap:kt,pair:[St[P-1],St[P]]})}let Ct=Math.max(...rt.map(P=>P.size));if(!wt||wt.gap>=at[nt?"across":"down"]*Ct)continue;for(let{label:P}of rt)V.set(P,q);let[Ot,qt]=wt.pair.map(({label:P})=>K(P.textContent,16)),We=wt.gap<0?`${Ot} and ${qt} overlapping by ${A(-wt.gap)}px`:`${Ot} and ${qt} ${A(wt.gap)}px apart`;B("ticks",t,`${ot.length} tick labels ${nt?"across":"down"} a ${A(nt?t.getBoundingClientRect().width:t.getBoundingClientRect().height)}px chart crowd: ${We}, under ${nt?"a digit's width and a hair":"a quarter of a line"} at their ${A(Ct)}px (${ot.slice(0,6).join(", ")}${ot.length>6?", \u2026":""})`,{picture:o})}}let pt=t=>{let o=t.getBBox(),r=t instanceof SVGTextElement&&parseFloat(getComputedStyle(t).fontSize)||o.height,b=o.y+Math.max(0,(o.height-r)/2),O=b+Math.min(o.height,r),W=t.getScreenCTM();return[[o.x,b],[o.x+o.width,b],[o.x+o.width,O],[o.x,O]].map(([p,S])=>new DOMPoint(p,S).matrixTransform(W))},lt=(t,o)=>{let r=1/0;for(let b of[t,o])for(let O=0;O<b.length;O++){let W=b[O],p=b[(O+1)%b.length],S=Math.hypot(p.x-W.x,p.y-W.y);if(S===0)continue;let q={x:-(p.y-W.y)/S,y:(p.x-W.x)/S},g=ut=>ut.map(nt=>nt.x*q.x+nt.y*q.y),[T,ot]=[g(t),g(o)],rt=Math.min(Math.max(...T),Math.max(...ot))-Math.max(Math.min(...T),Math.min(...ot));if(rt<=0)return 0;r=Math.min(r,rt)}return r===1/0?0:r},st=t=>[...t.querySelectorAll("text")].filter(o=>!o.closest("defs, clipPath, mask, pattern, marker, symbol")&&j(o.textContent)&&E(o));for(let t of Z){let o=st(t).map(b=>({label:b,outline:pt(b)})),r=[];o.forEach(({label:b,outline:O},W)=>{for(let p of o.slice(W+1))V.has(b)&&V.get(b)===V.get(p.label)||lt(O,p.outline)>1.5&&r.push(`${K(b.textContent,20)} and ${K(p.label.textContent,20)} overlap`)}),r.length&&B("chart-text-overlap",t,it(r),{picture:_(t)})}let ct=11;for(let t of Z){if(!t.hasAttribute("viewBox"))continue;let o=[];for(let O of st(t)){let W=O.getScreenCTM(),p=parseFloat(getComputedStyle(O).fontSize);if(!W||!(p>0))continue;let S=p*Math.hypot(W.c,W.d);S<ct-.05&&o.push(`${K(O.textContent,24)} at ${S.toFixed(1)}px (font-size ${+p.toFixed(2)})`)}if(!o.length)continue;let r=t.viewBox.baseVal,b=`${o.length} text${o.length>1?"s":""}`;B("svg-text-small",t,`${b} of a drawing scaled by its viewBox (${+r.width.toFixed(2)}\xD7${+r.height.toFixed(2)} drawn ${A(t.getBoundingClientRect().width)}px wide) render below ${ct}px: ${it(o)}`,{picture:_(t)})}let y=new Set;for(let t of f.querySelectorAll(".doc-table-wrap")){if(m(t)||!E(t))continue;y.add(t);let o=t.querySelector("table");if(!o)continue;let r=Math.max(t.clientWidth,o.offsetWidth),b=Math.max(t.clientHeight,o.offsetHeight),O=r>t.clientWidth+i,W=b>t.clientHeight+i,p=N(t);(O||W)&&B("table-scrolls",t,[O&&`${r}px wide in a ${t.clientWidth}px frame`,W&&`${b}px tall in a ${t.clientHeight}px frame`].filter(Boolean).join(", "),{scroll:{sideways:O,down:W,name:p}});let S=globalThis.__qaTableHides(t,o);S.said&&B("table-columns",t,`${S.said}: the table is ${r}px wide in a ${t.clientWidth}px frame`),S.shown<S.rows&&!t.style.getPropertyValue("--doc-table-height")&&B("table-rows",t,`the frame shows ${S.shown} of ${S.rows} rows: a reader scrolls inside it for the other ${S.rows-S.shown}; style="--doc-table-height: none" on its div.doc-table-wrap shows every row (or split the table where its content divides)`)}let D=t=>!!t.closest("details[data-qa-closed]"),F="in a disclosure closed in the file: a reader who opens it scrolls";for(let t of f.querySelectorAll(".doc-code, .doc-diff")){if(m(t)||!E(t))continue;let o=t.querySelector(":scope > pre, :scope > .doc-diff-body");if(o&&E(o)){let b=D(t);if(o.scrollHeight>o.clientHeight+i){let O=[t,o].map(q=>q.style.getPropertyValue("--doc-code-height").trim()).find(Boolean),W=o.getBoundingClientRect().top+o.clientTop+o.clientHeight,p=[...o.querySelectorAll(".doc-code-line")].filter(q=>q.getClientRects().length>0&&q.getBoundingClientRect().top>=W-1).length,S=b?`, ${F} inside it for the rest`:O?`, the block's own height (--doc-code-height: ${O}, the author's or the reader's): a reader scrolls inside it for the rest`:": a reader scrolls inside it for the rest";B("code-scrolls",t,`the code is ${o.scrollHeight}px tall, its frame ${o.clientHeight}px${p?` (its last ${p} line${p===1?"":"s"} below it)`:""}${S}`,{level:b||O?"info":void 0})}if(o.scrollWidth>o.clientWidth+i){let O=t.classList.contains("doc-code--nowrap"),W=b?`, ${F} sideways for the rest`:O?", its lines left unwrapped (doc-code--nowrap, the author's or the reader's choice): a reader scrolls sideways for the rest of its long lines":": a reader scrolls sideways for the rest";B("code-scrolls",t,`the code is ${o.scrollWidth}px wide, its frame ${o.clientWidth}px${W}`,{level:b||O?"info":void 0})}}let r=t.querySelector(":scope > .doc-code-title");r&&E(r)&&r.scrollWidth>r.clientWidth+1&&B("code-title-cut",t,`its title ${K(r.textContent,48)} is cut to fit its header (${r.scrollWidth}px of words in ${r.clientWidth}px)`)}for(let t of f.querySelectorAll(".doc-math-block")){if(m(t)||!E(t)||t.scrollWidth<=t.clientWidth+i)continue;let o=D(t);B("formula-scrolls",t,`the formula is ${t.scrollWidth}px wide, its frame ${t.clientWidth}px${o?`, ${F} it sideways for the rest`:": a reader scrolls it sideways for the rest"}`,{level:o?"info":void 0})}for(let t of f.querySelectorAll("[data-doc-layout]"))m(t)||!E(t)||B("layout",t,t.getAttribute("data-doc-layout"),{picture:t.closest("figure, .doc-table-wrap")??t,measured:y.has(t)});let J=document.createTreeWalker(f,NodeFilter.SHOW_TEXT),R=new Map;for(let t=J.nextNode();t;t=J.nextNode()){if(!/\\\(|\\\[|\$\$/.test(t.nodeValue))continue;let o=t.parentElement;if(!o||o.closest([...s,".katex","[data-doc-dev]"].join(", "))||!E(o))continue;let r=o.closest("p, li, h1, h2, h3, h4, td, th, figcaption, summary, blockquote, dd, dt")??o;R.has(r)||R.set(r,t.nodeValue)}for(let[t,o]of R){let r=o.search(/\\\(|\\\[|\$\$/);B("raw-formula",t,`${K(o.slice(r,r+40),40)} is shown as written: the kit's math did not render it`)}for(let t of f.querySelectorAll(".katex-error"))m(t)||!E(t)||B("formula-error",t,`${K(t.textContent,32)}: ${j(t.getAttribute("title"))||"KaTeX could not read it"}`);let I=t=>`"${globalThis.__qaUrlName?.(t,document.baseURI)??t}"`,k=t=>{try{return new URL(t,document.baseURI).href}catch{return t}},H=t=>[...["src","href","poster","data"].filter(o=>t.hasAttribute(o)&&!(o==="href"&&t.matches("a, area"))).map(o=>t.getAttribute(o)),...(t.getAttribute("srcset")??"").split(",").map(o=>o.trim().split(/\s+/)[0]),...[t.getAttribute("style"),t.localName==="style"?t.textContent:""].flatMap(o=>[...String(o??"").matchAll(/url\(\s*["']?([^"')]+)/g)].map(r=>r[1]))].filter(o=>o&&!o.trim().startsWith("#")).map(k),c=[...document.querySelectorAll("*")].filter(t=>!m(t)).flatMap(t=>H(t).map(o=>({node:t,address:o}))),a=new Set;for(let{url:t,directive:o}of globalThis.__qaViolations??[]){let r=/^[a-z][a-z\d+.-]*$/i.test(t)?`${t.toLowerCase()}:`:null,b=c.find(W=>r?!a.has(W)&&W.address.startsWith(r):W.address===t);b&&r&&a.add(b);let O=b?.node??null;e&&!(O&&f.contains(O))||B("blocked",O,`${o} blocked ${I(b?.address??t)}${O?` (${z(O)})`:""}: the export holds every file it shows`,{url:b?.address??t})}for(let t of f.querySelectorAll("img")){if(m(t)||t.complete&&t.naturalWidth>0)continue;let o=t.currentSrc||t.src?k(t.currentSrc||t.src):"";B("image",t,`${o?I(o):"a picture with no src"} did not load`,{picture:t.closest("figure")??t,url:o})}let M=new Set(d),G=new Set(w),et=document.createRange(),$t="button, select, input, textarea, [data-doc-dev]",yt=(t,o)=>t!==o&&(t.matches($t)||[...t.classList].some(r=>r.startsWith("doc-"))),xt=(t,o,r)=>{let b=[],O=!1;for(let W=t,p=!0;W&&W!==document.body&&W!==document.documentElement;W=W.parentElement,p=!1){let S=getComputedStyle(W);if((!p||r)&&(O&&(S.position!=="static"||S.transform!=="none")&&(O=!1),!O)){if(/auto|scroll/.test(S.overflowY))break;/hidden|clip/.test(S.overflowY)&&!yt(W,o)&&b.push(W)}if(S.position==="fixed")break;S.position==="absolute"&&(O=!0)}return b},bt=t=>t.getBoundingClientRect().bottom-(parseFloat(getComputedStyle(t).borderBottomWidth)||0),Pt=t=>{let o=getComputedStyle(t),r=b=>!/^(transparent|rgba\(.*,\s*0\))$/.test(b);return r(o.backgroundColor)||o.backgroundImage!=="none"||["Top","Right","Bottom","Left"].some(b=>parseFloat(o[`border${b}Width`])>0&&o[`border${b}Style`]!=="none"&&r(o[`border${b}Color`]))},Nt="rect, circle, ellipse, line, polyline, polygon, path, use",Tt=(t,o)=>{let r=new Map,b=(p,S,q,g)=>{if(!r.has(p)&&r.size>=3)return;let T=r.get(p)??{words:[],marks:[],depth:0,height:p.getBoundingClientRect().height};q&&T.words.push(q),g&&T.marks.push(g),T.depth=Math.max(T.depth,S),r.set(p,T)},O=p=>p.getBoundingClientRect().height>1.5,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||o(S))continue;let q=xt(S,t,!0).filter(O);if(q.length===0)continue;let g=getComputedStyle(S),T=parseFloat(g.lineHeight);for(let ot of p.nodeValue.matchAll(/\S+/g)){let rt=ot.index+ot[0].length;et.setStart(p,ot.index),et.setEnd(p,rt);let ut=[...et.getClientRects()];for(let nt of ut){let mt=Number.isFinite(T)?Math.max(0,(nt.height-T)/2):0,St=q.find(Ct=>nt.bottom-bt(Ct)>1.5+mt);if(!St)continue;let wt=ot.index;if(ut.length>1){let Ct=bt(St)+1.5+mt;for(let Ot=rt-1;wt<Ot;){let qt=wt+Ot>>1;et.setStart(p,qt),et.setEnd(p,qt+1),(et.getClientRects()[0]?.bottom??0)>Ct?Ot=qt:wt=qt+1}}b(St,Math.max(...ut.map(Ct=>Ct.bottom))-bt(St),p.nodeValue.slice(wt,rt),null);break}}}for(let p of t.querySelectorAll("*")){let S=p instanceof SVGElement&&p.matches(Nt)&&!p.closest("defs, clipPath, mask, pattern, marker, symbol"),q=!S&&!(p instanceof SVGElement)&&!p.matches("img, picture, video, canvas, iframe, object, embed, script, style, template")&&p.children.length===0&&!p.textContent.trim()&&Pt(p);if(!S&&!q||!E(p))continue;let g=p.getBoundingClientRect();if(g.width<=0&&g.height<=0)continue;let T=S?p.ownerSVGElement:null,ot=[...T&&getComputedStyle(T).overflowY!=="visible"?[T]:[],...xt(T??p,t,!!T)].filter(O),rt=nt=>{let mt=nt.getBoundingClientRect();return g.left>=mt.left-1.5&&g.right<=mt.right+1.5&&g.top>=mt.top-1.5},ut=ot.find(nt=>g.bottom-bt(nt)>1.5&&rt(nt));ut&&b(ut,g.bottom-bt(ut),null,S?p.localName:z(p))}return r};for(let t of f.querySelectorAll("[data-block-id]")){let o=t.getAttribute("data-block-id"),r=G.has(o);if(!r&&!M.has(o)||m(t)||!E(t))continue;let b=p=>p.closest(".doc-chart-message")||p.closest("h2, h3, h4, p, figcaption")?.parentElement===t,O=new Map,W=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let p=W.nextNode();p&&O.size<3;p=W.nextNode()){let S=p.parentElement;if(!p.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!E(S)||r&&b(S))continue;let q=S;for(;q!==t&&["inline","contents"].includes(getComputedStyle(q).display);)q=q.parentElement;let g=!1;for(let nt=S;nt&&!g;nt=nt===t?null:nt.parentElement){let mt=getComputedStyle(nt);g=mt.overflowX!=="visible"||mt.overflowY!=="visible"}if(g)continue;let T=getComputedStyle(q),ot=q.getBoundingClientRect(),rt=ot.left+parseFloat(T.borderLeftWidth)+parseFloat(T.paddingLeft),ut=ot.right-parseFloat(T.borderRightWidth)-parseFloat(T.paddingRight);for(let nt of p.nodeValue.matchAll(/\S+/g)){et.setStart(p,nt.index),et.setEnd(p,nt.index+nt[0].length);let mt=[...et.getClientRects()],St=Math.max(0,...mt.flatMap(Ct=>[Ct.right-ut,rt-Ct.left]));if(St<=1.5||mt.some(Ct=>Ct.right>u+1))continue;let wt=O.get(q)??{words:[],reach:0,width:ut-rt};wt.words.push(nt[0]),wt.reach=Math.max(wt.reach,St),O.set(q,wt)}}for(let[p,{words:S,reach:q,width:g}]of O)B("overflow-in-block",p,`the words ${K(S.join(" "),40)} run ${A(q)}px past the side of ${z(p)} (${A(g)}px wide for its words), over what is beside it`,{picture:t});for(let[p,{words:S,marks:q,depth:g,height:T}]of Tt(t,r?b:()=>!1)){let ot=[S.length&&`the words ${K(S.join(" "),40)}`,q.length&&`${q.length===1?"a mark":`${q.length} marks`} (${[...new Set(q)].slice(0,3).join(", ")})`].filter(Boolean).join(" and "),rt=S.length===0&&q.length===1;B("cut-in-block",p,`${ot} ${rt?"reaches":"reach"} ${A(g)}px past the bottom of ${z(p)} (${A(T)}px tall, its overflow ${getComputedStyle(p).overflowY}), cut off there`,{picture:t})}}if(et.detach(),document.documentElement.scrollWidth>u+1){let t=g=>{for(let T=g.parentElement;T&&T!==document.body;T=T.parentElement)if(getComputedStyle(T).overflowX!=="visible")return!1;return g.nodeType!==1||getComputedStyle(g).position!=="fixed"},o=[...f.querySelectorAll("*")].filter(g=>!(g instanceof SVGElement&&g.ownerSVGElement)&&!m(g)&&g.getBoundingClientRect().right>u+1&&E(g)&&t(g)),r=o.filter(g=>!o.includes(g.parentElement)).slice(0,3),b=`the page is ${document.documentElement.scrollWidth}px wide in a ${u}px window`,O=new Set(o),W=g=>{for(let T=g.parentElement;T;T=T.parentElement)if(O.has(T))return!0;return!1},p=new Map,S=document.createRange(),q=document.createTreeWalker(f,NodeFilter.SHOW_TEXT);for(let g=q.nextNode();g&&p.size<3;g=q.nextNode()){let T=g.parentElement;if(!T||!g.nodeValue.trim()||T.closest("svg, script, style, template")||m(T)||W(g)||!E(T)||!t(g)||(S.selectNodeContents(g),![...S.getClientRects()].some(nt=>nt.right>u+1)))continue;let ot=T.closest("[data-block-id]")??T;if(p.has(ot))continue;let rt=[],ut=0;for(let nt of g.nodeValue.matchAll(/\S+/g)){S.setStart(g,nt.index),S.setEnd(g,nt.index+nt[0].length);let mt=Math.max(...[...S.getClientRects()].map(St=>St.right),0);mt<=u+1||(rt.push(nt[0]),ut=Math.max(ut,mt))}rt.length&&p.set(ot,{node:T,words:rt.join(" "),right:ut})}S.detach(),r.length===0&&p.size===0&&!e&&B("overflow",null,b);for(let g of r)B("overflow",g,`${b}: ${z(g)} ${K(g.textContent,24)} reaches ${A(g.getBoundingClientRect().right)}px`);for(let[g,{node:T,words:ot,right:rt}]of p)B("overflow",T,`${b}: the words ${K(ot,60)} in ${z(g)} run past its edge to ${A(rt)}px (a text that cannot break)`,{picture:g})}return{found:x,next:n}}function fo(){let e=s=>!!s.closest("[data-doc-dev]"),n=s=>[...document.querySelectorAll(s)].filter(l=>!e(l)).length;return{charts:n("[data-doc-chart], [data-doc-component='gallery/chart-view']"),tables:n(".doc-table-wrap"),height:document.documentElement.scrollHeight}}var Et=2e4,Me=1800;function jt(e,n,s){let l=0,i=new Promise((d,w)=>{l=setTimeout(()=>w(new Error(`${s}: no answer in ${n/1e3}s`)),n)});return Promise.race([e,i]).finally(()=>clearTimeout(l))}var Xt=e=>`${e.kind}|${JSON.stringify(e.anchor)}|${e.what}`;async function uo(e,n,s,{out:l,tiles:i=!1,blocks:d=[],around:w=new Map,held:f=new Map,whole:x=[],drawn:u=[],known:A=null}){let{width:j,height:K=900,label:m=String(j)}=typeof s=="number"?{width:s}:s,E=m.replace("\xD7","x"),z,$;try{z=await jt(e.createBrowserContext(),Et,"a browser context opened"),$=await jt(z.newPage(),Et,"a tab opened")}catch(y){return await Dt(z?.close()),{findings:[{kind:"unverified",what:`the browser did not open a page: ${y.message}`,anchor:null,shot:null,seen:!1,state:""}],counts:null,pictures:[],held:{covered:[],missed:[]}}}$.setDefaultTimeout(Et);let Y=[],X=[],gt=new Set,N=new Map,Q=new Set,h=new Set,B=new Set,_="",tt=0,C=(y,D,F={})=>Y.push({kind:y,what:D,anchor:null,shot:null,seen:!1,state:_,...F}),v=Ie(n).href,U=y=>`"${be(y,v)}"`,L=y=>l.folders?.get(y)??l.blocks,it=y=>y.replace(/[^\w-]/g,"_");$.on("pageerror",y=>C("error",`uncaught ${Ft(y.message).slice(0,200)}`)),$.on("console",y=>{y.type()==="error"&&le(y,v)&&C("error",`console: ${Ft(y.text()).slice(0,200)}`)}),$.on("requestfailed",y=>{y.frame()===$.mainFrame()&&C("request",`${U(y.url())}: ${y.failure()?.errorText??"failed"}`,{url:y.url()})}),$.on("response",y=>{y.status()>=400&&y.request().frame()===$.mainFrame()&&C("request",`${U(y.url())}: HTTP ${y.status()}`,{url:y.url()})}),await ce($),await $.evaluateOnNewDocument(`globalThis.__qaUrlName = ${be}; globalThis.__qaTableHides = ${Ue()};`),await $.setViewport({width:j,height:K}),await $.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);let dt=async y=>{for(let D of await he($,{timeout:Et}))C("unverified",`${y}: waited for ${D}`)},Z=async(y,D,F,J)=>jt($.screenshot({path:F,clip:y,captureBeyondViewport:!D}),Et,"the picture").then(()=>!0,R=>(C("unverified",`no picture of ${J} (${R.message})`),!1)),at=async(y,D,F,J=0)=>{let R=await $.evaluate(ho,{selector:y,up:J,margin:Xe,frames:Je}).catch(I=>({error:I}));return R?.clip?await Z(R.clip,R.fixed,D,F)?R.clip:null:(C("unverified",`no picture of ${F} (${R?.error?.message??"the element is gone or shows nothing"})`),null)},V=(y,D)=>y.left<D.x+D.width&&y.right>D.x&&y.top<D.y+D.height&&y.bottom>D.y,pt=async()=>{let y=d.filter(F=>!Q.has(F)),D=await $.evaluate((F,J,R)=>{let I=new Map(F.map((M,G)=>[M,G])),k=M=>!!M&&!M.closest("[data-doc-dev], dialog:not([open])")&&M.getClientRects().length>0,H=M=>M===null?null:[...document.querySelectorAll("[data-block-id]")].find(G=>G.getAttribute("data-block-id")===M&&k(G))??null,c=M=>{if(!M)return null;let G=M.getBoundingClientRect();return{left:G.left+scrollX,right:G.right+scrollX,top:G.top+scrollY,bottom:G.bottom+scrollY}},a=[];for(let M of document.querySelectorAll("[data-block-id]")){let G=I.get(M.getAttribute("data-block-id"));if(G===void 0||!k(M))continue;I.delete(M.getAttribute("data-block-id")),M.setAttribute("data-qa-block",String(G));let[et,$t]=J[G]??[],yt=(R[G]??[]).map(xt=>[xt,[...M.querySelectorAll("[data-block-id]")].find(bt=>bt.getAttribute("data-block-id")===xt&&k(bt))]).filter(([,xt])=>xt);a.push({index:G,boxes:J[G]?{block:c(M),above:c(H(et)),below:c(H($t))}:null,held:yt.map(([xt,bt])=>({id:xt,box:c(bt)}))})}return a},y,y.map(F=>w.get(F)??null),y.map(F=>f.get(F)??[]));for(let{index:F,boxes:J,held:R}of D){let I=y[F];Q.add(I);let k=`${E}-${it(I)}`,H=[];if(!J){let c=ht.join(L(I),`${k}.png`),a=await at(`[data-qa-block="${F}"]`,c,`the block ${I}`);a&&(X.push({block:I,file:c}),H.push(a))}for(let{part:c,clip:a}of J?Ze(J):[]){let M=ht.join(L(I),`${k}${c?`-${c}`:""}.png`);await Z(a,!1,M,`the block ${I}${c?` (its ${c})`:""}`)&&(X.push({block:I,file:M}),H.push(a))}for(let{id:c,box:a}of R)H.some(M=>V(a,M))?h.add(c):h.has(c)||B.add(c);await $.evaluate(c=>document.querySelector(`[data-qa-block="${c}"]`)?.removeAttribute("data-qa-block"),F)}},lt=async(y,D,F)=>{let J=[...f].filter(([I])=>Q.has(I)).map(([I,k])=>[I,k.filter(H=>!h.has(H))]).filter(([,I])=>I.length);if(!J.length)return;let R=await $.evaluate((I,k)=>{let H=document.querySelector(I);if(!H)return[];let c=a=>[...H.querySelectorAll("[data-block-id]")].some(M=>M.getAttribute("data-block-id")===a&&M.getClientRects().length>0);return k.map(([a,M])=>[a,M.filter(c)]).filter(([,a])=>a.length)},y,J);for(let[I,k]of R){let H=ht.join(L(I),`${E}-${it(I)}-${D}.png`);if(await at(y,H,`the block ${I} (${D})`,F)){X.push({block:I,part:D,file:H});for(let c of k)h.add(c),B.delete(c)}}},st=async y=>{let D=await $.evaluate(zt,{scope:y,next:tt,ignored:Fe,slack:Ke,whole:x,drawn:u});tt=D.next;let F=D.found.flatMap(R=>R.kind!=="layout"?[R]:ze(R.what,j).filter(({kind:I})=>!(R.measured&&["table-columns","table-rows"].includes(I))).map(({kind:I,note:k})=>({...R,kind:I,what:`the kit notes ${k}`})));for(let R of F){let I=R.shot===null?null:`${R.kind}|${R.shot}|${R.what}`,k=I&&N.get(I);if(k)!k.seen&&R.seen&&Object.assign(k,R,{state:_});else{let H={...R,state:_};Y.push(H),I&&N.set(I,H)}}let J=new Set(Y.filter(R=>R.kind==="blocked").map(R=>R.url));for(let R of Y){if(R.shot===null||!R.seen||gt.has(R.shot)||!Ye(R,j)||A?.has(Xt(R))||["request","image"].includes(R.kind)&&J.has(R.url))continue;gt.add(R.shot);let I=ht.join(l.flagged,`${E}-${String(R.shot).padStart(2,"0")}-${R.kind}.png`);await at(`[data-qa-shot="${R.shot}"]`,I,R.kind)&&X.push({shot:R.shot,file:I})}d.length&&await pt()},ct=y=>{let D=new Set(Y.filter(J=>J.kind==="blocked").map(J=>J.url));return{findings:Y.filter(J=>!(["request","image"].includes(J.kind)&&D.has(J.url))&&!A?.has(Xt(J))),counts:y,pictures:X,held:{covered:[...h],missed:[...B]}}};try{try{let k=new Promise(c=>$.once("domcontentloaded",c)),H=$.goto(v,{waitUntil:"load",timeout:6e4});if(H.catch(()=>{}),await Promise.race([k,H]),$.url()!==v)throw new Error(`the browser shows ${$.url()}`)}catch(k){return C("unverified",`the page did not load: ${k.message}`),ct(null)}await dt("the page as it opens");let y=await $.evaluate(co,Et);y.loaded||C("unverified",`the pictures (${y.images}) not all loaded in ${Et/1e3}s`),y.closed&&await dt(`the page with its ${y.closed} closed disclosure${y.closed===1?"":"s"} opened`),await st(null);let D=async(k,H,c,a=null)=>{for(let M=k,G=1;M<H;M+=Me,G++){let et=ht.join(l.tiles,`${E}-${c}${String(G).padStart(2,"0")}.png`);await jt($.screenshot({path:et,clip:{x:0,y:M,width:j,height:Math.min(Me,H-M)},captureBeyondViewport:!0}),Et,"a tile").then(()=>X.push({tile:!0,sheet:a,file:et}),$t=>C("unverified",`no tile ${c}${G} (${$t.message})`))}};i&&await D(0,await $.evaluate(()=>document.documentElement.scrollHeight),"");let F=async(k,H=null)=>{if(!await $.evaluate(ve,k.chain)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:`[data-qa-tab="${k.index}"]`});return C("unverified","this Sheet could not be shown: its tab was clicked and its panel stayed hidden",{anchor:c}),!1}if(await dt("the Sheet shown"),await st(`[data-qa-panel="${k.index}"]`),await lt(`[data-qa-panel="${k.index}"]`,`sheet${k.index+1}`,1),i&&H)await J(H,`sheet${k.index+1}-`);else if(i){let c=await $.evaluate(a=>{let M=document.querySelector(`[data-qa-panel="${a}"]`)?.getBoundingClientRect();return M&&M.height>0?{top:Math.max(0,M.top+scrollY),bottom:M.bottom+scrollY}:null},k.index);c&&await D(c.top,c.bottom,`sheet${k.index+1}-`,{number:k.index+1,label:k.label})}return!0},J=async(k,H="")=>{for(let c=1;c<=20;c++){let a=await $.evaluate((G,et)=>{let $t=document.querySelector(`[data-qa-card="${G}"]`),yt=$t?.querySelector(".doc-dialog-content")??$t;if(!yt)return null;if(et)yt.scrollTop=0;else{let bt=yt.scrollTop;if(yt.scrollTop+=Math.max(40,yt.clientHeight-24),yt.scrollTop===bt)return null}let xt=$t.getBoundingClientRect();return{x:xt.left+visualViewport.pageLeft,y:xt.top+visualViewport.pageTop,width:xt.width,height:xt.height}},k.index,c===1);if(!a)break;let M=ht.join(l.tiles,`${E}-card${k.index+1}-${H}${String(c).padStart(2,"0")}.png`);await Z(a,!0,M,`the detail card ${Mt(k.label,24)}, tile ${H}${c}`)&&X.push({tile:!0,card:{number:k.index+1,label:k.label,part:H},file:M})}},R=0;for(let k of y.sheets)k.shown||!k.panel||k.card!==null||(_=`Sheet ${Mt(k.label,24)}`,await F(k)&&(R+=1));let I=0;for(let k of y.cards){_=`detail card ${Mt(k.label,24)}`;let H=`[data-qa-card="${k.index}"]`;k.chain.length&&await $.evaluate(ve,k.chain);for(let c of k.within)await $.evaluate(ke,c);if(!await $.evaluate(ke,k.index)){let{anchor:c}=await $.evaluate(zt,{next:tt,place:H});C("unverified","this detail card could not be opened",{anchor:c});for(let a of k.within.toReversed())await $.evaluate(Ht,a);continue}I+=1,await dt("the detail card opened"),await st(H),await lt(H,`card${k.index+1}`,0),i&&await J(k);for(let c of y.sheets)c.card!==k.index||c.shown||!c.panel||(_=`detail card ${Mt(k.label,24)}, Sheet ${Mt(c.label,24)}`,await F(c,k)&&(R+=1));await $.evaluate(Ht,k.index);for(let c of k.within.toReversed())await $.evaluate(Ht,c)}return _="",ct({...await $.evaluate(fo),details:y.details,closed:y.closed,sheets:R,cards:y.cards.length,cardsOpened:I})}catch(y){return C("unverified",`the look ended early: ${y.message}`),ct(null)}finally{await Dt(z.close())}}var Jt=e=>e.split(ht.sep).join("/"),ft=(e,n,s=`${n}s`)=>`${e} ${e===1?n:s}`,Ut=e=>`${e.join(", ")}px`,po=e=>e.includes("\xD7")?e:`${e}px`;function go({details:e,closed:n}){if(e===0)return"0 disclosures";let s=n===0?"open in the file":`${n===e?"":`${n} `}closed in the file, opened for the pictures`;return`${ft(e,"disclosure")} (${s})`}function Re(e,n=null){let s=new Map;for(let l of e){let i=n?ht.relative(n,l):"",d=Jt(n&&i&&!i.startsWith("..")&&!ht.isAbsolute(i)?i:l),w=/^(.*\/)?(\d+(?:x\d+)?)-([^/]+)$/.exec(d),f=w?`${w[1]??""}\0${w[3]}`:d;s.has(f)||s.set(f,w?{head:w[1]??"",tail:w[3],looks:[]}:{whole:d});let x=s.get(f);w&&!x.looks.includes(w[2])&&x.looks.push(w[2])}return[...s.values()].map(l=>l.whole??`${l.head}${l.looks.length>1?`{${l.looks.join(",")}}`:l.looks[0]}-${l.tail}`)}function mo(e){let n=e.map(({folder:l,files:i})=>({folder:l,files:[...new Set(i)]})).filter(({files:l})=>l.length);if(!n.length)return null;let s=n.reduce((l,{files:i})=>l+i.length,0);return`Not opened yet: ${ft(s,"picture")} of this run, none looked at for you; open each, and in the handoff name those you opened: ${n.flatMap(({folder:l,files:i})=>Re(i,l).map(d=>ht.isAbsolute(d)?d:`${Jt(l)}/${d}`)).join(", ")}`}var Te=(e="<slug>")=>`more pictures: gallery qa ${e} --tiles (the page, each Sheet panel and each detail card in tiles), gallery qa ${e} --blocks <id,\u2026> (the blocks you name)`,nn=Te(),Ne=fe,Ce='look at the export yourself at 1024, 736 and 360px, its disclosures and detail cards opened (SKILL.md, "Export, check and look"), and say so when you hand the document over.',wo=e=>Ft(e?.message).replace(/\s*Use a different `?userDataDir`? or stop the running browser first\.?/gi,"").slice(0,300),Gt={overflow:"a reader scrolls the whole page sideways. Words that cannot break where they stand (a long path, URL or name): wrap each in <code>, which breaks where it must and keeps it whole for the reader to copy; an element wider than the window (a picture, a drawing, a width of your own): let it fit (max-width: 100%) or put it in a frame that scrolls; never cut or rewrite a path to silence this","table-columns":"not a failure. If the reader must see the column on a desktop, write its long values compactly (a cell of numbers stays on one line, so its longest value sets the column's width: a range as a\u2013b, fewer digits), move a unit out of its header into the line above the table, shorten the header, or split the table; never delete a column to silence this","chart-text-overlap":"not a failure. If the reader must read both, shorten the labels (a unit belongs in the axis's title), move one (above its row, or a leader line) or give the drawing more room at this width; never delete a label or a category to silence this","code-scrolls":'not a failure. A reader scrolls inside the frame (40 lines) for the rest; if every line must show at once, write style="--doc-code-height: none" on its <pre>; never delete code to silence this',"formula-scrolls":"not a failure. A reader scrolls the formula sideways for the rest; if it must show whole at this width, break it into lines (\\begin{aligned} \u2026 \\end{aligned}) or into two formulas; never cut a term to silence this","overflow-in-block":"not a failure. If the words run over others in the picture, give their box room at this width (a wider column in an @media rule of your <style>, or a smaller font there), or let them break (a dash or a space where a line may end); never cut the words to silence this","cut-in-block":"not a failure. If the reader must see what is cut, let the box grow with what it holds (min-height instead of height or max-height, or none), give it room at this width in an @media rule of your <style>, or let it scroll (overflow: auto); never delete the words to silence this",ticks:"not a failure. If the numbers crowd in the picture, give that axis fewer ticks at this width with axis.tickValues([...]), at most four on a phone (the domain's ends and middle; ticks(n) is only a hint to d3 and can still draw five or more), or shorter numbers (the unit in the axis's title: 2k, 1.5\u4E07); never take the axis out to silence this","svg-text-small":"not a failure. The viewBox scales the drawing's text with it: give the text a larger font-size in the viewBox's units (a viewBox 800 wide drawn 340px wide scales by 0.43, so 26 units read as 11px), or lay the drawing out for narrow widths (a viewBox of its own under an @media rule, a chart of your own drawn from its width, or HTML that wraps); never drop the labels to silence this"},$o='not a failure. A reader scrolls sideways for the rest of its long lines; if the reader must see them whole at this width, let them wrap (take data-wrap="false" off its <pre>) or break them where the code allows; a tree or a log whose lines must stay whole may scroll; never cut a line to silence this';function xo(e){if(e.kind!=="code-scrolls")return Gt[e.kind]?[Gt[e.kind]]:[];let n=[...e.said.keys()],s=n.some(l=>/ wide, its frame /.test(l));return[...!s||n.some(l=>/ tall, its frame /.test(l))?[Gt["code-scrolls"]]:[],...s?[$o]:[]]}var yo="none is a failure: each says what to do if it matters to the reader (never delete a column or a label to silence one)",bo="a reader scrolls it: not a problem";function So(e,n,s=null,{folder:l=null,slug:i="<slug>"}={}){let d=[],w=Object.fromEntries(Bt.map(h=>[h,0])),f=new Map,x=new Set,u=new Map,A=[],j=h=>Re(h,l),K=h=>h.label??String(h.width),m=new Map(e.flatMap(h=>h.pictures.filter(B=>B.shot!==void 0).map(B=>[`${K(h)}|${B.shot}`,B.file])));for(let h of e){let{width:B,findings:_,counts:tt}=h,C=K(h),v=new Set,U=Object.fromEntries(Bt.map(V=>[V,0])),L={right:0,down:0,all:0};for(let V of _){let pt=`${V.kind}|${V.shot??""}|${V.what}`;if(v.has(pt))continue;v.add(pt);let lt=qe(V,B);U[lt]+=1;let st=oo(V.anchor,n);if(V.kind==="table-scrolls"){let{sideways:R=!1,down:I=!1,name:k=""}=V.scroll??{};Object.assign(L,{all:L.all+1,right:L.right+Number(R),down:L.down+Number(I)});let H=`${st}|${k}`;u.has(H)||u.set(H,{place:st,name:k,right:[],down:[]}),R&&!u.get(H).right.includes(C)&&u.get(H).right.push(C),I&&!u.get(H).down.includes(C)&&u.get(H).down.push(C)}if(lt==="info"&&x.add(`${V.kind}|${st}`),lt==="info"&&["table-scrolls","table-columns","table-rows"].includes(V.kind))continue;let ct=`${Bt.indexOf(lt)}|${V.kind}|${st}`;f.has(ct)||(f.set(ct,{level:lt,kind:V.kind,place:st,said:new Map}),lt!=="info"&&(w[lt]+=1));let y=f.get(ct).said,D=`${V.state?`[${V.state}] `:""}${V.what}`;y.has(D)||y.set(D,{labels:[],pictures:[]});let F=y.get(D);F.labels.includes(C)||F.labels.push(C);let J=m.get(`${C}|${V.shot}`);J&&!F.pictures.includes(J)&&F.pictures.push(J)}let it=[L.right&&`\u2192 ${L.right}`,L.down&&`\u2193 ${L.down}`].filter(Boolean).join(", "),dt=`${ft(L.all,"table scrolls","tables scroll")}${it?` (${it})`:""}`,Z=tt?.cards?`, ${ft(tt.cards,"detail card")} (${tt.cardsOpened===tt.cards?"closed in the file, opened in turn":`${tt.cardsOpened??0} of them opened`})`:"",at=h.laptop?"; only what the 1024px look did not find":tt?`; ${ft(tt.charts,"chart")}, ${ft(tt.tables,"table")}, ${go(tt)}, ${ft(tt.sheets,"Sheet")} shown besides the first${Z}, page ${tt.height}px tall`:"";A.push({label:C,fail:U.fail,warn:U.warn,line:`${h.laptop?C:`${C.padStart(4)}px`} fail ${U.fail} \xB7 warn ${U.warn} \xB7 unverified ${U.unverified} \xB7 ${dt}${at}`})}let E=[...f.values()].sort((h,B)=>Bt.indexOf(h.level)-Bt.indexOf(B.level)),z=e.flatMap(h=>h.pictures);if(l&&z.length&&d.push(`Pictures of this run in ${Jt(l)}/ (each path below is in it):`),s){let h=new Map;for(let C of z)C.block!==void 0&&h.set(C.block,[...h.get(C.block)??[],C.file]);let B=Oe(e),_=C=>`${s.tags?.get(C)?`${s.tags.get(C)} `:""}${C}`,tt=`at ${$e.slice(0,-1).join(", ")} and ${$e.at(-1)}px`;s.tiles&&s.why&&d.push(`${s.why[0].toUpperCase()}${s.why.slice(1)}.`);for(let C of s.groups??[]){if(!C.ids.length&&!C.rest.length)continue;let v=!C.ids.length&&s.groups.some(U=>U!==C&&U.ids.length)?`: none this run (the ${Ae} blocks a run pictures went to the changed blocks above)`:"";d.push(`${C.why[0].toUpperCase()}${C.why.slice(1)}${C.ids.length?`, ${tt}`:v}:`);for(let U of C.ids){let L=n.blocks.get(U),it=`${L?`${n.name??"doc.html"}:${L}`:`(not in ${n.name??"doc.html"})`} ${U}${s.tags?.get(U)?` ${s.tags.get(U)}`:""}`,dt=h.get(U)??[],Z=s.moved?.has(U)?" (moved: with the edges of the blocks before and after it)":"",at=s.held?.get(U)??[],V=at.filter(F=>s.changed?.has(F)).length,pt=C.kind==="named"?ft(at.length,"block"):[V&&ft(V,"changed block"),at.length-V&&ft(at.length-V,"card")].filter(Boolean).join(" and "),lt=z.some(F=>F.block===U&&F.part)?", pictured again with each Sheet panel or detail card that holds one":"",st=at.filter(F=>B.has(F)),ct=[...new Set(st.flatMap(F=>B.get(F)))].map(F=>F.includes("\xD7")?F:`${F}px`).join(", "),y=st.length?`; ${st.length} of them not pictured at ${ct}: gallery qa ${i} --blocks ${st.join(",")}`:"",D=at.length?` (with the ${pt} it holds${lt}${y})`:"";d.push(dt.length?` ${it}${Z}${D}: ${j(dt).join(", ")}`:` ${it}${Z}${D}: not shown at any width (hidden)`)}if(C.rest.length){let U=ft(C.rest.length,{changed:"changed block",cards:"card"}[C.kind]??"block"),L=`${C.rest.slice(0,6).map(_).join(", ")}${C.rest.length>6?", \u2026":""}`;d.push(` ${C.ids.length?"and ":""}${U}${C.ids.length?" more":""}, not pictured (${L}): gallery qa ${i} --blocks ${C.rest.join(",")}`)}}s.unknown.length&&d.push(` no block of ${n.name??"doc.html"} has the id${s.unknown.length===1?"":"s"} ${s.unknown.join(", ")}`)}let $=[];for(let h of E)for(let{pictures:B}of h.said.values())$.push(...B.filter(_=>!$.includes(_)));$.length&&d.push("The elements flagged below, look at these first:",...j($).map(h=>` ${h}`));let Y=z.filter(h=>h.tile),X=Y.filter(h=>!h.sheet&&!h.card);X.length&&d.push(`The page as it opens (each Sheet area with the panel it shows first): ${ft(X.length,"tile")} in ${j([ht.dirname(X[0].file)])[0]}/ (<width>-<n>.png)`);let gt=new Map;for(let{sheet:h}of Y)h&>.set(h.number,{...h,count:(gt.get(h.number)?.count??0)+1});gt.size&&d.push(`Each other Sheet panel, shown in turn: ${ft(Y.filter(h=>h.sheet).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.sheet).file)])[0]}/ (<width>-sheet<i>-<n>.png): ${[...gt.values()].map(({number:h,label:B,count:_})=>`sheet${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);let N=new Map;for(let{card:h}of Y)h&&N.set(h.number,{...h,count:(N.get(h.number)?.count??0)+1});N.size&&d.push(`Each detail card, opened in turn as the window shows it, its content scrolled a tile at a time: ${ft(Y.filter(h=>h.card).length,"tile")} in ${j([ht.dirname(Y.find(h=>h.card).file)])[0]}/ (<width>-card<i>-<n>.png${Y.some(h=>h.card?.part)?"; with another panel of a Sheet in it shown, <width>-card<i>-sheet<j>-<n>.png":""}): ${[...N.values()].map(({number:h,label:B,count:_})=>`card${h} ${Mt(B,24)} ${ft(_,"tile")}`).join(", ")}`);for(let{place:h,name:B,right:_,down:tt}of u.values()){let C=/^(?:doc|report)\.html:\d+/.exec(h)?.[0]??h;d.push(`${"INFO".padEnd(10)} table-scrolls: ${C}${B?` ${Mt(B,32)}`:""}: ${[_.length&&`\u2192 ${Ut(_)}`,tt.length&&`\u2193 ${Ut(tt)}`].filter(Boolean).join("; ")} (${bo})`)}for(let h of E){d.push(`${h.level.toUpperCase().padEnd(10)} ${h.kind}: ${h.place}`);for(let[B,{labels:_,pictures:tt}]of h.said)d.push(` ${Ut(_)}: ${B}${tt.length?` (${j(tt).join(", ")})`:""}`);for(let B of xo(h))d.push(` ${B}`)}d.push(...A.map(({line:h})=>h));let Q=ko(s,i);return Q&&d.push(Q),w.info=x.size,{lines:d,levels:w,looks:A.map(({label:h,fail:B,warn:_})=>({label:h,fail:B,warn:_}))}}function ko(e,n="<slug>"){let{changed:s=[],restyled:l=[],packages:i=[],cards:d=[],since:w="the last look",first:f=!1}=e?.left??{};if(!s.length&&!l.length&&!d.length)return null;let x=A=>`${A.slice(0,6).map(j=>`${e.tags?.get(j)?`${e.tags.get(j)} `:""}${j}`).join(", ")}${A.length>6?", \u2026":""}`;return`Not pictured by this run, which pictures the blocks named alone: ${[s.length&&`${ft(s.length,"block")} changed or moved since ${w} (${x(s)})`,l.length&&`${ft(l.length,"instance")} of a custom block changed since ${w}, ${i.join(", ")} (${x(l)})`,d.length&&(f?`no earlier look: ${ft(d.length,"card")} never pictured (${x(d)})`:`${ft(d.length,"card")} the change of the document's own <script> or <style> since ${w} may draw again (${x(d)})`)].filter(Boolean).join("; ")}. gallery qa ${n} pictures them.`}function vo(e,n,s=[],{unpictured:l=!1}={}){let i=n.map(({label:A,fail:j,warn:K})=>`${po(A)} fail ${j}, warn ${K}`).join("; "),d=i?` (${i})`:"",w=Te(s.length===1?s[0].slug:void 0),f={stale:"its file had changed since its export",missing:"it had none yet"},x=s.filter(({first:A})=>A).map(({slug:A,first:j})=>`${s.length>1?`${A} was`:"It was"} exported first by this run (${f[j]}).`),u=`${x.length?`. ${x.join(" ")}`:""}${s.map(({file:A})=>`
|
|
3
|
+
${Ne}${A}`).join("")}`;if(e.fail)return`failures at ${ft(e.fail,"place")}${d}: fix them in the document's doc.html (report.html in an older document), then run this again (it exports first); ${w}${u}`;if(e.unverified)return`nothing failed${d}; not verified at ${ft(e.unverified,"place")}: say so when you hand the document over; ${w}${u}`;if(e.warn)return`nothing failed${d}; warnings at ${ft(e.warn,"place")} to look at, ${yo}; ${w}${u}`;if(l){let A=s.length===1?s[0].slug:"<slug>";return`nothing found${d}, and no picture taken: a plain run pictures the cards and the blocks changed since the last look, and the document has no card (a chart or a drawing, code, a whole block, a component, a flowchart, a Sheet area, columns, a figure, a table) and no block changed; run gallery qa ${A} --tiles to picture the page, each Sheet panel and each detail card in tiles, open those pictures and look at the document once yourself; gallery qa ${A} --blocks <id,\u2026> pictures the blocks you name${u}`}return`nothing found${d}: open the pictures above and look at the document once yourself; ${w}${u}`}function Mo(e,{missing:n=!1,edited:s=!1,packaged:l=!1}={}){let i=At(e),d=ht.basename(It(Lt(e,Rt)).html);return`exporting first: ${n?`no export yet (${i})`:s?`${d} changed since the last export (${i})`:l?`a custom block it uses changed since the last export (${i})`:`the last export (${i}) does not say which text it was made from (an older Gallery's)`}, as gallery export ${e} does (--no-export: refuse instead)`}async function Co(e){for(let[i,{missing:d,edited:w,packaged:f}]of e)console.log(`${i}: ${Mo(i,{missing:d,edited:w,packaged:f})}`);let n=new Map(await Promise.all(e.map(async([i])=>[i,await vt.stat(At(i)).then(d=>d.mtimeMs,()=>null)]))),s=Le(process.execPath,[ht.join(De,"bin","gallery.mjs"),"export",...e.map(([i])=>i)],{cwd:Rt,encoding:"utf8",env:{...process.env,GALLERY_WORKSPACE:Rt},maxBuffer:256*1024*1024});s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr),s.error&&console.error(`the export did not run: ${s.error.message}`);let l=[];for(let[i]of e){let d=await vt.stat(At(i)).then(w=>w.mtimeMs,()=>null);d!==null&&d!==n.get(i)&&!(await Kt(i,{made:!0})).problem&&l.push(i)}return l}var Eo=e=>String(e??"").split(/[\s,]+/).filter(Boolean);function qo(e,n){let s=_t(e);return[...new Set(n)].filter(l=>!s.has(l))}var Ao=(e,n)=>`--blocks: no block of ${e} has the id${n.length===1?"":"s"} ${n.join(", ")}: nothing was looked at and no picture removed. Name ids as gallery qa prints them (data-block-id in the file).`;async function sn(e){let{slugs:n,options:s,values:l}=await Qt({options:["--tiles","--no-export"],values:["--blocks"],argv:e}),i=l.has("--blocks")?Eo(l.get("--blocks")):null;if(i?.length===0)throw new Wt("--blocks takes block ids: --blocks <id,\u2026>");if(i&&n.length!==1)throw new Wt("--blocks names blocks of one document: name one.");let d=new Map,w=[];for(let N of n){let Q=await Kt(N);Q.problem&&!((Q.stale||Q.missing)&&!s.has("--no-export"))&&w.push(Q.problem),d.set(N,Q)}if(w.length&&(console.error(w.join(`
|
|
4
|
+
`)),process.exit(2)),i){let N=It(Lt(n[0],Rt)).html,Q=qo(Vt(await vt.readFile(N,"utf8").catch(()=>"")),i);if(Q.length)throw new Wt(Ao(ht.resolve(N),Q))}await ae(n),await ue(n),await pe(n);let f=[...d].filter(([,N])=>N.stale||N.missing),x=new Map(f.map(([N,Q])=>[N,Q.missing?"missing":"stale"]));if(f.length){let N=await Co(f),Q=f.map(([h])=>h).filter(h=>!N.includes(h));for(let h of N)d.set(h,await Kt(h,{made:!0}));Q.length&&(console.error(`${Q.join(", ")}: the export failed (above), so nothing was looked at: fix what it says, then run this again`),process.exit(1))}let u=d,A=[...u].map(([N,{file:Q}])=>({slug:N,file:Q,first:x.get(N)??null})),j=(N,Q)=>{for(let[h,{sha256:B,time:_}]of u)console.log(`${h}: ${At(h)} sha256 ${B}, exported ${Yt(_)}`);console.log(`UNVERIFIED ${N}: nothing was looked at. ${Q}`);for(let{file:h}of A)console.log(`${Ne}${h}`);process.exit(3)},K=ie();K||j("no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one)",`Install Chrome or Edge, or ${Ce}`);let m=await de({executablePath:K,args:re()}).catch(N=>j(`the browser ${K} did not start, twice, each time with a fresh profile (${wo(N)}; GALLERY_BROWSER=<its executable> picks another)`,`Run gallery qa once more; if it says UNVERIFIED again, ${Ce}`)),{browser:E}=m,z=Object.fromEntries(Bt.map(N=>[N,0])),$=new Map,Y=!1,X=[];try{for(let[N,{file:Q,sha256:h,time:B}]of u){let _=ht.join(He,N),tt=ht.join(_,"blocks.json");console.log(`${N}: ${At(N)} sha256 ${h}, exported ${Yt(B)} (${ht.basename(K)}, headless)`);let C=It(Lt(N,Rt)).html,v=Vt(await vt.readFile(C,"utf8")),U=_t(v),L=se(U,ne(await vt.readFile(tt,"utf8").catch(()=>null))),it=ee(v),dt=oe(v),Z=lo(U,L,i,{tiles:s.has("--tiles")&&!i,page:it,packages:dt}),at=s.has("--tiles")||!!Z.tiles;(at||Z.ids.length)&&(Y=!0);let V={flagged:ht.join(_,"flagged"),blocks:ht.join(_,i?"blocks":"changed"),tiles:ht.join(_,"tiles")},pt=ht.join(_,"cards");V.folders=new Map(Z.groups.flatMap(c=>c.ids.map(a=>[a,c.kind==="cards"?pt:V.blocks])));let lt=[V.flagged,...i?[V.blocks]:Z.tiles?[]:[V.blocks,pt],...at?[V.tiles]:[]],st=(await Promise.all(lt.map(async c=>[c,(await vt.readdir(c).catch(()=>[])).filter(a=>a.endsWith(".png")).length]))).filter(([,c])=>c>0);st.length&&console.log(`The pictures of the run before in ${st.map(([c])=>`${ht.basename(c)}/`).join(", ")} (${ft(st.reduce((c,[,a])=>c+a,0),"file")}) were removed: this run's replace them.`);for(let c of lt)await vt.rm(c,{recursive:!0,force:!0});for(let c of await vt.readdir(_).catch(()=>[]))c.endsWith(".png")&&await vt.rm(ht.join(_,c),{force:!0});for(let c of lt)await vt.mkdir(c,{recursive:!0});let ct=[...U].filter(([,{whole:c}])=>c).map(([c])=>c),y=[...U].filter(([,{figure:c}])=>c).map(([c])=>c),D=[],F=null;for(let c of we){let a=await uo(E,Q,c,{out:V,tiles:at&&!c.laptop,blocks:c.laptop?[]:Z.ids,around:Z.around,held:c.laptop?new Map:Z.held,whole:ct,drawn:y,known:c.laptop?F:null});D.push({...c,...a}),a.pictures.length&&(Y=!0),X.push({folder:_,files:a.pictures.map(({file:M})=>M)}),!c.laptop&&c.width===we.find(M=>M.laptop)?.width&&(F=new Set(a.findings.map(Xt)))}let{lines:J,levels:R,looks:I}=So(D,eo(v,ht.basename(C)),{...Z,tags:new Map([...U].map(([c,{tag:a}])=>[c,a]))},{folder:_,slug:N});console.log(J.join(`
|
|
5
|
+
`));for(let c of Bt)z[c]+=R[c];for(let{label:c,fail:a,warn:M}of I){let G=$.get(c)??{label:c,fail:0,warn:0};$.set(c,{label:c,fail:G.fail+a,warn:G.warn+M})}let k=D.every(c=>c.counts&&!c.findings.some(a=>a.kind==="unverified")),H=ao(U,L,Z,{named:i,verified:k,failed:R.fail>0,seen:io(Z,D),page:it,packages:dt})??L;H&&await vt.writeFile(tt,`${JSON.stringify(H)}
|
|
6
|
+
`)}}finally{await m.close()}let gt=mo([...Map.groupBy(X,({folder:N})=>N)].map(([N,Q])=>({folder:N,files:Q.flatMap(({files:h})=>h)})));gt&&console.log(gt),console.log(vo(z,[...$.values()],A,{unpictured:!Y})),process.exitCode=z.fail?1:z.unverified?3:0}export{Yo as a,Bt as b,we as c,Ko as d,$e as e,ze as f,Ee as g,Ge as h,qe as i,Ye as j,Ke as k,Ae as l,Xe as m,Je as n,xe as o,Qe as p,ye as q,Ze as r,be as s,to as t,eo as u,oo as v,Yt as w,no as x,Kt as y,Be as z,ao as A,Oe as B,io as C,Se as D,ro as E,lo as F,ho as G,fo as H,Xt as I,uo as J,go as K,Re as L,mo as M,Te as N,nn as O,Ne as P,Ce as Q,wo as R,Gt as S,$o as T,xo as U,yo as V,bo as W,So as X,ko as Y,vo as Z,Mo as _,Eo as $,qo as aa,Ao as ba,sn as ca};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a}from"./chunk-JEUK3ZO7.mjs";import"./chunk-V6RIYQZZ.mjs";import{f as D}from"./chunk-SXHBYZST.mjs";import{b as d,f as J,i as k}from"./chunk-4OZWXZE5.mjs";import{c as F}from"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import{a as A}from"./chunk-UMHUSOPJ.mjs";import"./chunk-N76HWBA3.mjs";import"./chunk-FJYN7RTH.mjs";import"./chunk-UBBRTJ2R.mjs";import"./chunk-FWNRPMCJ.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{existsSync as E}from"node:fs";import R from"node:fs/promises";import m from"node:path";import{iconKind as q}from"../browser/shared/emoji/icon-value.mjs";import{writeAtomic as z}from"../browser/shared/files.mjs";import{reportsDirectory as C}from"../browser/shared/paths.mjs";import{roleOf as M}from"../browser/shared/reports.mjs";import{documentDirectory as P,documentFiles as T,pageSlug as U}from"../browser/shared/workspace.mjs";var K=o=>o.replace(/\s+/g," ").trim(),_=o=>o.replace(/^[a-z]:\/(?:[^/]+\/)*?(?=icons\/(?:tabler\/)?[^/]+$)/i,"/"),h=o=>o===null?"none":JSON.stringify(o);async function ie(o){let{positional:u,values:c}=J({values:["--title","--icon","--description"],argv:o});if(u.length!==1)throw new d("Name one document, then what to set: --title, --icon, --description.");if(!["--title","--icon","--description"].some(e=>c.has(e)))throw new d('Say what to set: --title "<title>", --icon <emoji|none|\u2026>, --description "<text>".');let n=c.has("--title")?K(c.get("--title")):void 0,p=c.has("--description")?K(c.get("--description")):void 0;if(n==="")throw new d("--title takes the words of the title: a document's title is never empty.");if(p==="")throw new d("--description takes words: a document's description is never empty.");let t;if(c.has("--icon")){let e=_(c.get("--icon").trim()),f=e==="none"?"none":q(e);if(!f||/["<>&]/.test(e))throw new d(`Not a page icon: ${e} (an emoji, none, an icon of the \u56FE\u6807 tab as /icons/<name>_<color>.svg, or a picture of the document's assets/).`);if(f==="glyph"&&!F(e))throw new d(`No such icon of the \u56FE\u6807 tab: ${e}.`);t=f==="none"?null:e}let{slug:w}=await k(u[0]),$=P(w,C);(w===await U(C)||await M($)==="instructions")&&(console.error(`${u[0]} is the \u5199\u4F5C\u504F\u597D page: only the user changes it.`),process.exit(1));let{html:r,json:s}=T($);E(r)||(console.error(`No document "${u[0]}": ${a(r)} does not exist (gallery list lists those there are).`),process.exit(1)),t&&q(t)==="image"&&!E(m.join($,...t.split("/")))&&(console.error(`No picture ${t} in ${a($)}: put it in its assets/ first.`),process.exit(1));let i;try{if(i=JSON.parse(await R.readFile(s,"utf8")),!i||typeof i!="object"||Array.isArray(i))throw new Error("not an object")}catch(e){console.error(`${a(s)} does not read (${e.code??e.message}): mend it first.`),process.exit(1)}let b=null,N=!1;for(let e=1;n!==void 0||t!==void 0;e++){let f=await R.readFile(r,"utf8"),v=A(f),y=D(v,{title:n,icon:t});if(y.missing&&(console.error(`${a(r)} has no title to ${n!==void 0?"set":"put the icon before"}: write it as an h1.doc-title in the page's header (writing-html.md, "The page").`),process.exit(1)),b=y.before,y.text===v)break;if(await z(r,y.text,{expect:f})){N=!0;break}e===3&&(console.error(`${a(r)} kept changing while it was being written (the page saving, or an Agent writing it?): nothing written. Run gallery set again.`),process.exit(1))}let l={...i};n!==void 0&&(l.title=n),p!==void 0&&(l.description=p),t===null?delete l.icon:t!==void 0&&(l.icon=t);let x=JSON.stringify(l)!==JSON.stringify(i);x&&await z(s,`${JSON.stringify(l,null,2)}
|
|
3
|
+
`);let S=m.basename(r),g=[];n!==void 0&&g.push(` title: ${h(b.title)} \u2192 ${h(n)} (${S}'s h1 and <title>, ${m.basename(s)})`),t!==void 0&&g.push(` icon: ${h(b.icon)} \u2192 ${h(t)} (${S}'s header, ${m.basename(s)})`),p!==void 0&&g.push(` description: ${h(typeof i.description=="string"?i.description:null)} \u2192 ${h(p)} (${m.basename(s)})`);let j=[...N?[a(r)]:[],...x?[a(s)]:[]];if(j.length===0){console.log(`Nothing to change: ${w} has ${g.length===1?"that already":"those already"}.`);return}console.log(`Set ${w}:`);for(let e of g)console.log(e);let O=j.length===1;console.log(`Re-read ${j.join(", ")} before editing ${O?"it":"them"}: gallery set wrote ${O?"it":"them"} (${[...N?[`${S}: its header`]:[],...x?[`${m.basename(s)}: ${["title","icon","description"].filter(e=>JSON.stringify(l[e])!==JSON.stringify(i[e])).join(", ")}`]:[]].join("; ")}).`)}export{ie as run};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{f as A}from"./chunk-JVHHHGEA.mjs";import{a as w,c as U}from"./chunk-HYMEEXKN.mjs";import he from"node:fs";import $e from"node:path";import{reportsDirectory as we}from"../browser/shared/paths.mjs";import{assetFile as be,assetProblem as ge,embedFile as ke}from"../browser/shared/media.mjs";import{attr as H,hasClass as xe,walk as ye}from"../browser/shared/html-tree.mjs";import _ from"node:fs";import ie from"node:path";import{attr as ae,hasClass as ce,walk as fe}from"../browser/shared/html-tree.mjs";import{MEDIA_ROUTES as le,mediaTypeOf as de,mediaUrl as ue}from"../browser/shared/media.mjs";import{documentDirectory as pe}from"../browser/shared/workspace.mjs";function k(e,n,o){let s=null;return fe(e,t=>{!s&&t.tagName===n&&ce(t,o)&&(s=t)}),s}function N(e,n){let o=ie.join(e,n);return _.statSync(o,{throwIfNoEntry:!1})?.isFile()?`data:${de(n)};base64,${_.readFileSync(o).toString("base64")}`:null}function me(e,{attribute:n,route:o,slug:s,mode:t,reportsDirectory:r}){if(!le[o](e))return null;if(t==="preview")return`${n}="${ue(o,s,e)}" data-ge-${n}="${e}"`;let a=N(pe(s,r),e);return a&&`${n}="${a}"`}function x(e,n,{attribute:o,route:s,slug:t,mode:r,reportsDirectory:a}){let i=n.map(f=>({place:f.sourceCodeLocation?.attrs?.[o],value:ae(f,o)})).filter(({place:f})=>f).sort((f,d)=>f.place.startOffset-d.place.startOffset),c=[],l=0;for(let{place:f,value:d}of i){let u=me(d,{attribute:o,route:s,slug:t,mode:r,reportsDirectory:a});u===null||f.startOffset<l||(c.push(e.slice(l,f.startOffset),u),l=f.endOffset)}return c.push(e.slice(l)),c.join("")}function D(e){let n=[];return ye(e,o=>{let s=o.tagName==="figure"&&xe(o,"doc-embed")?k(o,"iframe","doc-embed-frame"):null;s&&n.push(s)}),n}function bt(e,{slug:n,mode:o="export",reportsDirectory:s=we}){return e.includes("doc-embed")?x(e,D(w(e)),{attribute:"src",route:"embed",slug:n,mode:o,reportsDirectory:s}):e}var I=(e,n=w(e))=>D(n).map(o=>o.sourceCodeLocation.startOffset);function gt({html:e,directory:n,tree:o=w(e)}){let s=[];for(let t of D(o)){let r=`line ${t.sourceCodeLocation.startLine}`,a=H(t,"src")??"",i=H(t,"sandbox"),c=/^https:\/\/[^\s"]+$/.test(a),l=!c&&!/^[a-z][a-z0-9+.-]*:/i.test(a)&&!be(a)?ge(a):null;l?s.push(`${r}: an embed's frame (${a.slice(0,80)}): ${l} (an HTML or PDF file; or a web page, https://\u2026)`):!c&&!ke(a)?s.push(`${r}: an embed's frame (${a.slice(0,80)}) shows a web page (https://\u2026, never http) or an HTML or PDF file of the document's folder (assets/<file>)`):!c&&!he.existsSync($e.join(n,a))?s.push(`${r}: the embed's file ${a} is not in the document's folder`):(c||/\.html?$/i.test(a))&&i===void 0?s.push(`${r}: an embed's frame (${a.slice(0,80)}) is sandboxed: sandbox="allow-scripts allow-popups \u2026"`):!c&&/\.html?$/i.test(a)&&/\ballow-same-origin\b/.test(i)?s.push(`${r}: an embedded HTML file (${a}) keeps its own origin: its sandbox has no allow-same-origin`):!c&&/\.pdf$/i.test(a)&&i!==void 0&&s.push(`${r}: an embedded PDF (${a}) is sandboxed, and a sandboxed frame shows no PDF: take its sandbox attribute off`)}return[...new Set(s)]}import Oe from"node:fs";import Se from"node:path";import{reportsDirectory as ve}from"../browser/shared/paths.mjs";import{assetFile as Fe,assetProblem as Le}from"../browser/shared/media.mjs";import{attr as z,hasClass as Ee,walk as Ce}from"../browser/shared/html-tree.mjs";function F(e,n=w(e)){let o=[];return Ce(n,s=>{s.tagName==="figure"&&Ee(s,"doc-file")&&o.push({node:s,link:k(s,"a","doc-file-link")})}),o}function Et(e,{slug:n,mode:o="export",reportsDirectory:s=ve}){if(!e.includes("doc-file"))return e;let t=F(e).flatMap(({link:r})=>r?[r]:[]);return x(e,t,{attribute:"href",route:"file",slug:n,mode:o,reportsDirectory:s})}function Ct({html:e,directory:n,tree:o=w(e)}){let s=[];for(let{link:t}of F(e,o)){if(!t)continue;let r=`line ${t.sourceCodeLocation?.startLine}`,a=z(t,"href")??"";Fe(a)?Oe.existsSync(Se.join(n,a))||s.push(`${r}: the file block's file ${a} is not in the document's folder`):s.push(`${r}: a file block's file (${a.slice(0,80)}): ${Le(a)} (<a class="doc-file-link" href="assets/<file>" download="<name>">)`),z(t,"download")||s.push(`${r}: a file block's link (${a.slice(0,80)}) says the name to save it as: download="<name>"`)}return[...new Set(s)]}import Ne from"node:fs";import De from"node:path";import{reportsDirectory as Re}from"../browser/shared/paths.mjs";import{assetProblem as W,imageFile as K}from"../browser/shared/media.mjs";import{attr as R,hasClass as Me,walk as M}from"../browser/shared/html-tree.mjs";var je={"doc-image":"image","doc-bookmark":"bookmark"},Te={image:"an image's picture",bookmark:"a bookmark's icon or cover"},Pe=/doc-(?:image|bookmark|link-mention-icon)/;function G(e){let n=[];return M(e,o=>{let s=o.tagName==="figure"&&(R(o,"class")??"").split(/\s+/).map(t=>je[t]).find(Boolean);s&&n.push({node:o,kind:s})}),n}function L(e,n=w(e)){let o=new Map,s=(t,r,a)=>{let i=t.sourceCodeLocation;i&&!o.has(i.startOffset)&&o.set(i.startOffset,{at:i.startOffset,line:i.startLine,node:t,what:r,kind:a,mention:a==="mention"})};for(let{node:t,kind:r}of G(n))M(t,a=>a.tagName==="img"&&s(a,Te[r],r));return M(n,t=>t.tagName==="img"&&Me(t,"doc-link-mention-icon")&&s(t,"a link's icon","mention")),[...o.values()].sort((t,r)=>t.at-r.at)}function Ut(e,{slug:n,mode:o="export",reportsDirectory:s=Re}){return Pe.test(e)?x(e,L(e).map(({node:t})=>t),{attribute:"src",route:"asset",slug:n,mode:o,reportsDirectory:s}):e}function At({html:e,directory:n,tree:o=w(e)}){let s=[];for(let{line:t,node:r,what:a,mention:i}of L(e,o)){let c=R(r,"src");i&&!K(c)?s.push(`line ${t}: a link's icon (${(c??"").slice(0,80)}): ${W(c,{picture:!0})}; or write an empty <span class="doc-link-mention-icon"></span>`):c===void 0?s.push(`line ${t}: ${a} has no src: <img src="assets/<file>" alt="\u2026">`):K(c)?Ne.existsSync(De.join(n,c))||s.push(`line ${t}: ${a} ${c} is not in the document's folder`):s.push(`line ${t}: ${a} (${c.slice(0,80)}): ${W(c,{picture:!0})}`)}for(let{node:t,kind:r}of G(o)){let a=r==="bookmark"?k(t,"a","doc-bookmark-card"):null,i=a&&R(a,"href");a&&!/^https?:\/\/[^\s"]+$/.test(i??"")&&s.push(`line ${a.sourceCodeLocation?.startLine}: a bookmark's link (${(i??"").slice(0,80)}) is a web address: <a class="doc-bookmark-card" href="https://\u2026">`)}return[...new Set(s)]}import ee from"node:fs";import te from"node:path";import{escapeAttribute as S}from"../browser/shared/escape.mjs";import{attr as y,hasClass as Be,walk as Ue}from"../browser/shared/html-tree.mjs";import{cssReferences as q}from"../browser/shared/css-references.mjs";import{assetFile as Ae,assetProblem as _e,imageFile as He,mediaUrl as Ie,referencedFile as v}from"../browser/shared/media.mjs";import{reportsDirectory as ze}from"../browser/shared/paths.mjs";import{documentDirectory as We}from"../browser/shared/workspace.mjs";var Y=/^\s*(?:\.\/)?assets\//i,J=1e6;function Ke(e){let n=[],o=0;for(;o<e.length;){for(;o<e.length&&/[\s,]/.test(e[o]);)o++;if(o>=e.length)break;let s=o;for(;s<e.length&&!/\s/.test(e[s]);)s++;let t=e.slice(o,s),r="";if(t.endsWith(","))t=t.replace(/,+$/,""),o=s;else{let i=s;for(let c=0;i<e.length&&(e[i]!==","||c>0);i++)e[i]==="("?c++:e[i]===")"&&c--;r=e.slice(s,i).trim(),o=i+1}let a=r.split(/\s+/).find(i=>/^\d*\.?\d+[wx]$/i.test(i));n.push({url:t,descriptor:r,size:a?parseFloat(a):1,wide:/w$/i.test(a??"")})}return n}function Ge(e){let n=e.filter(o=>o.wide);return(n.length>0?n:e).reduce((o,s)=>!o||s.size>o.size?s:o,null)}var qe=new Set(["body","table","thead","tbody","tfoot","tr","td","th"]);function T(e,n,o=s=>Y.test(s)){let s=[],t=r=>{o(r.value,r.node)&&s.push({...r,value:r.value.trim(),written:r.css?.written})};return Ue(n,r=>{let a=r.sourceCodeLocation;if(a){for(let{name:i,value:c,prefix:l}of r.attrs){let f=l?`${l}:${i}`:i,d=a.attrs?.[f],u={node:r,how:i,key:f,place:d,line:d?.startLine??a.startLine};if(i==="src"||i==="href"||i==="poster"||i==="data"&&r.tagName==="object"||i==="background"&&qe.has(r.tagName))t({...u,value:c});else if(i==="srcset"){let p=Ke(c),g=Ge(p.filter(b=>Y.test(b.url)));p.forEach((b,m)=>t({...u,value:b.url,candidates:p,index:m,largest:b===g}))}else if(i==="style")for(let p of q(c))t({...u,value:p.value,css:p})}if(r.tagName==="style")for(let i of r.childNodes){if(i.nodeName!=="#text"||!i.sourceCodeLocation)continue;let{startOffset:c,endOffset:l}=i.sourceCodeLocation;for(let f of q(e.slice(c,l)))t({node:r,how:"css",value:f.value,line:U(e,c+f.index),css:{...f,offset:c}})}}}),s}function se(e,n){let o=new Map;for(let{at:s,kind:t}of L(e,n))o.set(s,{attribute:"src",owner:"block",icon:t!=="image"});for(let{link:s}of F(e,n))s&&o.set(s.sourceCodeLocation.startOffset,{attribute:"href",owner:"block"});for(let s of I(e,n))o.set(s,{attribute:"src",owner:"block"});for(let s of A(e))o.set(s,{attribute:"src",owner:"icon"});return o}var oe=(e,n)=>{let o=e.get(n.node.sourceCodeLocation.startOffset);return o?.attribute===n.how?o:null},Ye=new Set(["img","input","video","audio","source","track"]),Q="an export holds no stylesheet of the folder (the addresses in one are read from its own place): put its rules in the page's <style>",V=e=>(y(e,"rel")??"").toLowerCase().split(/\s+/),j=/\.html?$/i,Je={html:'src="assets/<file>.html" sandbox="allow-scripts"',pdf:'src="assets/<file>.pdf"'},P=e=>`<figure class="doc-embed doc-embed--file"><iframe class="doc-embed-frame" ${Je[e]}></iframe><figcaption></figcaption></figure>`,X=`its frame with no sandbox (a sandboxed one shows no PDF): ${P("pdf")}`,Z='show a picture with <img src="assets/<file>">, a file to save with a link, <a href="assets/<file>" download="<name>">';function B({node:e,how:n,css:o,value:s}){let t=e.tagName;if(n==="style"||n==="css")return o.kind==="import"?{not:Q}:{use:"shown"};if(n==="srcset"&&(t==="img"||t==="source")||n==="poster"&&t==="video"||n==="src"&&Ye.has(t)||n==="background")return{use:"shown"};if(n==="src"&&t==="iframe"){let r=v(s)??"";return j.test(r)?{use:"frame"}:/\.pdf$/i.test(r)?{not:`a PDF shows in an embed block alone (the kit hands its file to the browser's PDF viewer, in the preview and in an export): make it one, ${X}`}:{not:`a frame shows a page of the folder (an HTML file), not this file, which the preview would hand out for saving: ${Z}`}}if(n==="href"&&(t==="a"||t==="area"))return{use:"link"};if(n==="href"&&(t==="image"||t==="link"&&V(e).some(r=>r.endsWith("icon"))))return{use:"shown"};if(t==="object"||t==="embed"){let r=v(s)??"";return{not:`an export's policy loads no plugin content (<object>, <embed>): ${/\.pdf$/i.test(r)?`show a PDF in an embed block, ${X}`:j.test(r)?`show a page in an embed block, ${P("html")}`:Z}`}}return t==="script"?{not:"an export runs the page's own scripts alone: put the code in the page's <script>"}:t==="link"&&V(e).includes("stylesheet")?{not:Q}:{not:"an export holds a file of the folder as a picture, a font, a video or audio, a link or a frame, not there"}}var E=e=>e.startsWith("assets/")&&Ae(e),Qe=e=>_e(e)??`the folder is assets/, in lowercase: write it so (assets/${e.slice(7)})`,ne=(e,n,o)=>n==="link"&&j.test(o)&&y(e.node,"download")===void 0,Ve=(e,n)=>e==="frame"?"embed":e==="shown"&&He(n)?"asset":"file",Xe=(e,n)=>!!ee.statSync(te.join(e,n),{throwIfNoEntry:!1})?.isFile(),O=({node:e,how:n,value:o,written:s})=>({srcset:`<${e.tagName} srcset="\u2026 ${o} \u2026">`,style:`${s} in the style of <${e.tagName}>`,css:`${s} in <style>`})[n]??`<${e.tagName} ${n}="${o}">`,Ze=e=>{for(let n=e.parentNode;n;n=n.parentNode)if(n.tagName&&Be(n,"doc-icon"))return!0;return!1},et=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`:`${e[0]}`;function tt(e,n){let o=new Map;for(let{file:a,line:i,owned:c}of e){let l=o.get(a)??o.set(a,{lines:[],owned:!1}).get(a);c?l.owned=!0:l.lines.push(i)}let s=0,t=[];for(let[a,{lines:i,owned:c}]of o){let l=c?i.length:i.length-1;if(l<1)continue;let f=l*Math.ceil(ee.statSync(te.join(n,a)).size/3)*4;s+=f;let d=i.length===1?"once":i.length===2?"twice":`${i.length} times`;t.push({bytes:f,said:`${a} ${d}${c?" besides a media block's or the icon's":""} (line${new Set(i).size>1?"s":""} ${et([...new Set(i)])})`})}if(s<=J)return[];let r=t.sort((a,i)=>i.bytes-a.bytes).map(({said:a})=>a).join(", ");return[`files embedded more than once make an export ${s.toLocaleString("en-US")} bytes bigger, over the ${J.toLocaleString("en-US")} bytes the copies outside the media blocks may add: ${r}; show each fewer times (a picture, a link or a frame holds a copy of its own each time it is written), or, for a CSS background (url() in a <style> or a style attribute), name it once in the page's <style> (--picture: url(assets/<file>)) and write var(--picture) where it shows`]}function re({html:e,directory:n,tree:o}){let s=se(e,o),t=[],r=[],a=[];for(let i of T(e,o)){let{line:c}=i,l=oe(s,i),f=v(i.value),d=f!==null&&Xe(n,f);if(d&&!E(f)&&a.push({file:f,line:c}),l?.owner==="block"){d&&E(f)&&r.push({file:f,line:c,owned:!0,icon:!!l.icon});continue}if(d||t.push(l?`line ${c}: the icon's image ${i.value} is not in the document's folder`:`line ${c}: ${O(i)} names a file that is not in the document's folder`),l){d&&r.push({file:f,line:c,owned:!0,icon:!0});continue}let{use:u,not:p}=B(i);p&&t.push(`line ${c}: ${O(i)}: ${p}`),!(!u||!d)&&(E(f)?ne(i,u,f)?t.push(`line ${c}: ${O(i)} opens an HTML file, which an export cannot (a browser opens no page from a data: address): show it in an embed block, ${P("html")}, or give the link download="<name>" to hand it out as a file`):i.node.tagName==="img"&&i.how==="src"&&Ze(i.node)?t.push(`line ${c}: ${O(i)} is in an icon (.doc-icon) written as an icon is not read (its picker, the browser tab's icon): write it <div class="doc-icon"><img src="assets/<file>" alt=""></div>, in double quotes and with no other class`):(i.how!=="srcset"||i.largest)&&r.push({file:f,line:c}):t.push(`line ${c}: ${O(i)}: ${Qe(f)}`))}return{failures:t,embedded:r,unserved:a}}function ts({html:e,directory:n,tree:o=w(e)}){let{failures:s,embedded:t}=re({html:e,directory:n,tree:o});return[...new Set([...s,...tt(t,n)])]}function ss({html:e,directory:n,tree:o=w(e)}){let{embedded:s,unserved:t}=re({html:e,directory:n,tree:o});return{embedded:s.map(({file:r,line:a,icon:i=!1})=>({file:r,line:a,icon:i})),unserved:t}}function st(e,{slug:n,mode:o,directory:s}){let{use:t}=B(e),r=v(e.value);if(!t||!r||!E(r)||ne(e,t,r))return null;let a=/#.*$/.exec(e.value)?.[0]??"";if(o==="preview")return`${Ie(Ve(t,r),n,r)}${a}`;let i=N(s,r);return i&&`${i}${a}`}function ot(e,n,{mode:o,shown:s}){let[t]=n,{node:r,how:a,key:i}=t,c=(m,h="")=>({start:e.startOffset,end:e.endOffset,text:`${i}="${S(m)}"${h}`}),l=o==="preview"?` data-ge-${a}="${S(y(r,a)??"")}"`:"",d=(o==="preview"?[`data-ge-${a}`,`data-rs-${a}`].map(m=>r.sourceCodeLocation.attrs?.[m]).filter(Boolean):[]).map(m=>({start:m.startOffset,end:m.endOffset,text:""}));if(a==="srcset"){if(o==="export"){let h=n.find(C=>C.largest),$=h&&s(h);return $?[c(`${$} ${h.candidates[h.index].descriptor}`.trim())]:[]}let m=new Map(n.map(h=>[h.index,s(h)]));return[...m.values()].some(Boolean)?[c(t.candidates.map((h,$)=>[m.get($)??h.url,h.descriptor].filter(Boolean).join(" ")).join(", "),l),...d]:[]}if(a==="style"){let m=y(r,"style"),h=n.map($=>({...$.css,address:s($)})).filter($=>$.address).sort(($,C)=>C.start-$.start);for(let $ of h)m=`${m.slice(0,$.start)}${$.address}${m.slice($.end)}`;return h.length>0?[c(m)]:[]}let u=s(t);if(!u)return[];if(o==="preview"||B(t).use!=="link")return[c(u,l),...d];let p=v(t.value).slice(7),g=y(r,"download");if(g===void 0)return[c(u,` download="${S(p)}"`)];let b=r.sourceCodeLocation.attrs?.download;return[c(u),...g===""&&b?[{start:b.startOffset,end:b.endOffset,text:`download="${S(p)}"`}]:[]]}function nt(e,n){let o=[],s=0;for(let{start:t,end:r,text:a}of[...n].sort((i,c)=>i.start-c.start))t<s||(o.push(e.slice(s,t),a),s=r);return o.push(e.slice(s)),o.join("")}var os=(e,n,o=w(e))=>T(e,o,n);function ns(e,n){let o=[],s=new Map;for(let t of e){let r=n(t);typeof r=="string"&&(t.how==="css"?o.push({start:t.css.offset+t.css.start,end:t.css.offset+t.css.end,text:r}):t.place&&s.set(t.place,[...s.get(t.place)??[],{...t,address:r}]))}for(let[t,r]of s){let[{node:a,how:i,key:c,candidates:l}]=r,f=r[0].address;if(i==="srcset"){let d=new Map(r.map(u=>[u.index,u.address]));f=l.map((u,p)=>[d.get(p)??u.url,u.descriptor].filter(Boolean).join(" ")).join(", ")}else if(i==="style"){f=y(a,"style");for(let{css:d,address:u}of[...r].sort((p,g)=>g.css.start-p.css.start))f=`${f.slice(0,d.start)}${u}${f.slice(d.end)}`}o.push({start:t.startOffset,end:t.endOffset,text:`${c}="${S(f)}"`})}return o}function rs(e,{slug:n,mode:o="export",reportsDirectory:s=ze}){if(!/assets\//i.test(e.replace(/\sdata-ge-(?:src|href|icon)="[^"]*"/g,"")))return e;let t=w(e),r=se(e,t),a=We(n,s),i=f=>st(f,{slug:n,mode:o,directory:a}),c=[],l=new Map;for(let f of T(e,t))if(!oe(r,f))if(f.how==="css"){let d=i(f),u=f.css.offset;d&&c.push({start:u+f.css.start,end:u+f.css.end,text:d})}else f.place&&l.set(f.place,[...l.get(f.place)??[],f]);for(let[f,d]of l)c.push(...ot(f,d,{mode:o,shown:i}));return nt(e,c)}export{bt as a,gt as b,Et as c,Ct as d,Ut as e,At as f,ts as g,ss as h,nt as i,os as j,ns as k,rs as l};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{a as S,b as K,c as E,d as v,e as x,f as H}from"./chunk-NAMN3RAF.mjs";import{a as D,b as j}from"./chunk-JEUK3ZO7.mjs";import{b as M,f as R,h as T}from"./chunk-4OZWXZE5.mjs";import O from"node:fs/promises";import _ from"node:path";import{iconKind as ee}from"../browser/shared/emoji/icon-value.mjs";import{descendantsIn as J,parentIn as C}from"../browser/shared/outline.mjs";import{topOf as U}from"../browser/shared/outline-shape.mjs";import{fullAddress as z,namedPlace as te}from"../browser/shared/page-address.mjs";import{reportsDirectory as G}from"../browser/shared/paths.mjs";import{documentLinks as Q,listReportSlugs as oe,roleOf as ne}from"../browser/shared/reports.mjs";import{documentDirectory as se,documentFiles as le,isSlugName as ie}from"../browser/shared/workspace.mjs";import{isWorkspace as W,readRegistry as re,workspaceKey as Y}from"../browser/shared/workspace-registry.mjs";import{findIn as ce,rankReports as V,reportLines as ae}from"../browser/shared/search.mjs";async function X(i=G){let n=(await oe(i)).filter(ie);return(await Promise.all(n.map(async a=>{let r=se(a,i),{html:u,json:s}=le(r),g=await O.stat(u).catch(()=>null);if(!g?.isFile()||await ne(r)==="instructions")return null;let l=await O.readFile(s,"utf8").then(JSON.parse).catch(()=>({})),d=t=>typeof t=="string"?t.replace(/\s+/g," ").trim():"";return{slug:a,title:d(l.title)||a,description:d(l.description),edited:g.mtimeMs,file:u}}))).filter(Boolean)}var P=i=>{let n=new Date(i),o=a=>String(a).padStart(2,"0");return`${n.getFullYear()}-${o(n.getMonth()+1)}-${o(n.getDate())} ${o(n.getHours())}:${o(n.getMinutes())}`},k=i=>`${i} document${i===1?"":"s"}`;async function de(i,n,o){let a=[...new Set(o.toLowerCase().split(/\s+/).filter(Boolean))],r=new Set(n.map(({slug:s})=>s));return(await Promise.all(i.filter(({slug:s})=>!r.has(s)).map(async s=>{let g=ae(await O.readFile(s.file,"utf8").catch(()=>"")),l=a.map(d=>ce(g,d,{most:1})).filter(({count:d})=>d>0);return l.length?{...s,words:l.length,count:l.reduce((d,{count:t})=>d+t,0),hit:l[0].hits[0].text}:null}))).filter(Boolean).sort((s,g)=>g.words-s.words||g.count-s.count||g.edited-s.edited)}var q=i=>[...i.documents.values()].filter(n=>typeof n.url=="string"),F=i=>`${i} web link${i===1?"":"s"}`;async function ge(i,n){if(i.length>1)throw new M("--tree takes one document at most (its slug, link or address).");let o=await S(),a=new Map(n.map(e=>[e.slug,e])),r=new Map((o.extensions??[]).map(e=>[e.id,e])),u=o.columns.filter(e=>(!e.extension||r.has(e.extension))&&!e.hidden&&!e.away),s=u.length>1?u:null,g=o.children[""]??[],l=null;if(i.length===1){let e=await H(i[0],"--tree",o);if(e.refused){for(let h of await j({reading:!0}))console.log(h);console.error(e.refused),process.exit(1)}l=e.slug,g=[l]}for(let e of await j({reading:!0}))console.log(e);let d=e=>console.log(`${e.title}\u680F\uFF08\u6269\u5C55 ${e.id}\uFF1A${e.error?`\u6761\u76EE\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.error.message}`:`${e.count} \u4E2A\u6761\u76EE`}\uFF1Bgallery extension check ${e.id} \u6253\u51FA\u5B83\u4EEC\uFF09`),t=()=>{for(let e of r.values())d(e)},p=u.filter(e=>!e.extension).flatMap(e=>J(o.children,U(e.id))),f=p.filter(e=>o.documents.get(e)?.url!==void 0).length,m=p.length-f;if(m+f===0){console.log('No documents yet: gallery new <slug> "<title>" makes one.'),l===null&&t();return}let w=f?`${k(m)} and ${F(f)}`:k(m);if(l===null)console.log(`${w}, as the sidebar shows them (one under another indented)${s?", column by column":""}:`);else{let e=J(o.children,l),h=e.some($=>o.documents.get($)?.url!==void 0)?`${e.length} ${e.length===1?"entry":"entries"}`:k(e.length);console.log(x(o,l)),console.log(e.length?`${v(o,l)} and the ${h} under it, as the sidebar shows them:`:`${v(o,l)}, with no document under it:`)}let c=(e,h)=>{let{title:$,description:y,icon:b,url:B,draft:N}=o.documents.get(e),A=a.get(e)?.edited,L=E(o,e),I=B!==void 0?[`\u7F51\u9875\u94FE\u63A5\uFF1A${B}`]:N?[N.missing?"\u522B\u5904\u7684\u5E95\u7A3F\uFF0C\u627E\u4E0D\u5230\u4E86":L?`\u300C${L}\u300D\u7684\u5E95\u7A3F\uFF1A${N.path}`:`\u522B\u5904\u7684\u5E95\u7A3F\uFF1A${N.path}`]:[...L?[`\u300C${L}\u300D\u7684\u6587\u6863`]:[],...y?[`\u8BF4\u660E\uFF1A${y}`]:[],...A?[`\u4E0A\u6B21\u7F16\u8F91\uFF1A${P(A)}`]:[]];console.log(`${" ".repeat(h)}${e} ${ee(b)==="emoji"?`${b} `:""}${$}${I.length?` \uFF08${I.join("\uFF1B")}\uFF09`:""}`);for(let Z of o.children[e]??[])c(Z,h+1)};if(l!==null||!s){for(let e of g)c(e,0);l===null&&t();return}for(let e of s){if(e.extension){d(r.get(e.extension)),r.delete(e.extension);continue}let h=o.children[U(e.id)]??[];console.log(`${K(e)}\u680F${h.length?"":"\uFF08\u7A7A\uFF09"}`);for(let $ of h)c($,1)}t()}async function fe(i){let n=_.resolve(G),o=(t,p)=>Y(t)===Y(p),a=[n,...re().workspaces.map(({root:t})=>t).filter(t=>!o(t,n))],r=a.filter(W),u=a.filter(t=>!W(t)),s=(await Promise.all(r.map(async t=>(await X(t)).map(p=>({...p,root:t}))))).flat(),g=i.join(" ").trim(),l=V(s,g),d=`${r.length} workspace${r.length===1?"":"s"}`;if(console.log(`Searched ${d} of this machine (gallery workspaces lists them; the current one: ${n}).`),s.length===0)console.log(`No documents in ${r.length===1?"it":"any of them"} yet.`);else if(l.length===0)console.log(`No document's title, description or slug in the ${d} holds ${g.split(/\s+/).map(t=>`"${t}"`).join(" or ")}: gallery list --all lists all ${s.length}.`);else{console.log(g?`${l.length} of ${k(s.length)}, the best match first:`:`${k(s.length)}, the one edited last first:`);let t=new Map,p=f=>(t.has(f)||t.set(f,Promise.all([Q(f),S(f)]).then(([{links:m},w])=>({links:m,tree:w}))),t.get(f));for(let{root:f,slug:m,title:w,description:c,edited:e,file:h}of l){let{links:$,tree:y}=await p(f);console.log(`\u5DE5\u4F5C\u533A\uFF1A${f}`),console.log(`${m} ${w}`),c&&console.log(` \u8BF4\u660E\uFF1A${c}`),C(y.children,m)&&console.log(` ${x(y,m)}`),console.log(` \u5730\u5740\uFF1A${z("",{slug:m},$)}`),console.log(` \u4E0A\u6B21\u7F16\u8F91\uFF1A${P(e)}`),console.log(` ${D(h)}`)}console.log('One in another workspace is worked on there: pass its \u5DE5\u4F5C\u533A as --workspace to every command (gallery open <slug> --workspace "<\u5DE5\u4F5C\u533A>" gives its address).')}u.length&&console.log(`Not searched, no longer there (gallery workspaces --forget <path> forgets one, nothing on disk changed): ${u.join(", ")}`)}async function Me(i){let{positional:n,options:o}=R({options:["--tree","--all"],argv:i});if(o.has("--all")){if(o.has("--tree"))throw new M("--all and --tree go apart: --tree is the current workspace's tree.");return fe(n)}let a=await X();if(o.has("--tree"))return ge(n,a);let r=n.join(" ").trim(),{links:u}=await Q(),s=n.length===1?te(n[0],u):null,g=s&&s.slug!==n[0],l=g?a.filter(({slug:c})=>c===s.slug):V(a,r),d=[...l,...r&&!g?await de(a,l,r):[]],t=await S(),p=r.toLowerCase().split(/\s+/).filter(Boolean),f=g?[]:q(t).filter(({slug:c,title:e,url:h})=>!p.length||p.some($=>`${e} ${h} ${c}`.toLowerCase().includes($))),m=n.length===1&&d.length===0&&f.length===0?await T(n[0]):null;for(let c of await j({reading:!0}))console.log(c);let w=()=>{if(!f.length)return;let c=q(t).length;console.log(r?`${f.length} of ${F(c)} in the sidebar:`:`${F(c)} in the sidebar:`);for(let{slug:e,title:h,url:$}of f)console.log(`${e} ${h}`),console.log(` \u7F51\u9875\u94FE\u63A5\uFF1A${$}`),C(t.children,e)&&console.log(` ${x(t,e)}`)};if(m)console.log(m);else if(a.length===0)console.log('No documents yet: gallery new <slug> "<title>" makes one.'),w();else if(d.length===0&&f.length===0)console.log(`No document's title, description, slug or text holds ${r.split(/\s+/).map(c=>`"${c}"`).join(" or ")}: gallery list lists all ${a.length}.`);else if(d.length===0)w();else{console.log(r?`${d.length} of ${k(a.length)}, the best match first:`:`${k(a.length)}, the one edited last first:`);for(let{slug:c,title:e,description:h,edited:$,file:y,hit:b}of d)console.log(`${c} ${e}`),h&&console.log(` \u8BF4\u660E\uFF1A${h}`),b&&console.log(` \u6B63\u6587\uFF1A${b}`),C(t.children,c)&&console.log(` ${x(t,c)}`),console.log(` \u5730\u5740\uFF1A${z("",{slug:c},u)}`),console.log(` \u4E0A\u6B21\u7F16\u8F91\uFF1A${P($)}`),console.log(` ${D(y)}`);w()}}export{X as a,P as b,Me as c};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{b as Q}from"./chunk-ZB4H7ZN4.mjs";import{c as _,d as z,e as B,l as G}from"./chunk-NFMCP2HI.mjs";import"./chunk-KTKHRC6H.mjs";import"./chunk-YI43RG4P.mjs";import{i as q}from"./chunk-NAMN3RAF.mjs";import{a as b,b as J}from"./chunk-JEUK3ZO7.mjs";import{a as Z}from"./chunk-B4P2CM2J.mjs";import{a as ee}from"./chunk-VJPFVNNW.mjs";import"./chunk-PZDLJJTJ.mjs";import"./chunk-IA4PSIMD.mjs";import{c as V,d as Y,e as M}from"./chunk-D4CKRD3V.mjs";import"./chunk-UKSHDZZ6.mjs";import"./chunk-6EZ7FNIK.mjs";import"./chunk-35NQ4PLQ.mjs";import"./chunk-V6RIYQZZ.mjs";import{b as W,h as X}from"./chunk-SXHBYZST.mjs";import"./chunk-RKPWLGZ3.mjs";import"./chunk-N7AZZLGT.mjs";import{b as T,f as C,g as H}from"./chunk-4OZWXZE5.mjs";import"./chunk-ZTHICSSF.mjs";import{k as U}from"./chunk-SX4LJYT6.mjs";import{b as K}from"./chunk-PAREWQGB.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-N76HWBA3.mjs";import"./chunk-FJYN7RTH.mjs";import"./chunk-UBBRTJ2R.mjs";import"./chunk-FWNRPMCJ.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import v from"node:fs/promises";import se from"node:os";import x from"node:path";import{IMPORT_EXT as re,kindOf as ie}from"../browser/shared/import-types.mjs";import{reportsDirectory as O}from"../browser/shared/paths.mjs";import{kebab as S}from"../browser/shared/web-links.mjs";import{documentDirectory as oe,documentFiles as E,newDocSlug as ae}from"../browser/shared/workspace.mjs";var ce=Object.values(re).flat().join(" "),j=(d,g)=>`${d} ${g}${d===1?"":"s"}`;function fe(d,g,p){let n=(f,r=g)=>(r.match(f)??[]).length,c=n(/<ol class="doc-flow"/g,p),$=n(/<li id="fn-\d+"/g,p),w=[[n(/<section class="doc-section"/g),"section"],[n(/<h[2-4][\s>]/g),"heading"],[n(/<p[\s>]/g),"paragraph"],[n(/<(?:ul|ol)[\s>]/g),"list"],[n(/<table\b/g),"table"],[n(/class="doc-math-(?:inline|block)"/g,p),"formula"],[n(/<div class="doc-code"/g),"code block"],[n(/<figure class="doc-image"/g),"picture"],[c,"flow"],[$,"footnote"]].filter(([f])=>f>0).map(([f,r])=>j(f,r)),h=(d.raws?.length??0)-c-($?1:0);return h>0&&w.push(`${j(h,"HTML block")} kept as written`),w}async function Se(d){let{positional:g,options:p}=C({options:["--no-preview","--no-browser"],argv:d}),[n,c,$]=g;if(g.length<1||g.length>3||!n)throw new T("Name the file; then the slug and the title, if you choose them.");let w=ie(n);if(!w)throw new T(`Not a kind of file gallery import takes: ${n} (${ce}).`);c!==void 0&&H(c);let h=x.resolve(n);await v.stat(h).then(i=>i.isFile(),()=>!1)||(console.error(`No such file: ${n}`),process.exit(1));let f=c!==void 0?await Q(c):null;f&&(console.error(f),process.exit(1));let r=x.basename(h),F=await v.mkdtemp(x.join(se.tmpdir(),"gallery-import-")),L,y,R;try{let i,u=[];if(w==="markdown")i=[{...await Y(h,F),from:r,children:[]}];else try{({pages:i,skipped:u}=await V([{file:h,name:r}],F))}catch(e){console.error(`${r} could not be read: ${e.message}`),process.exit(1)}i.length===0&&(console.error(`Nothing in ${r} could be read as a page${u.length?` (not taken: ${u.join(", ")})`:""}.`),process.exit(1)),$?.trim()&&(i[0]={...i[0],title:$.replace(/\s+/g," ").trim()});let I=new Map,te=ee({edits:{},reports:{},reportsDirectory:O});y=(await Z(i,{create:async(e,t,l,{lang:s})=>{let{directory:o}=await K(e,t,l,{blank:!0,lang:s});I.set(e,await v.readFile(E(o).html,"utf8"))},slugOf:(e,t)=>{if(t===0&&c!==void 0)return c;let l=S(e.title)||S(e.from?.replace(/\.[^.]+$/,"")??"")||S(r.replace(/\.[^.]+$/,""));return l?te.freeSlug(l):ae(O)},folderOf:e=>oe(e,O),fill:e=>M(e),place:(e,t)=>q(e,{parent:t})})).made;let P=[],A=(e,t)=>{P.push({page:e,depth:t});for(let l of e.children??[])A(l,t+1)};for(let e of i)A(e,0);let m=await Promise.all(P.map(async({page:e,depth:t},l)=>{let s=y[l],o=oe(s,O),a=E(o).html,k=await v.readFile(a,"utf8"),ne=(await M({source:I.get(s),nodes:e.nodes,icon:e.icon,own:e.own})).replace(/<p>\u{E000}\d+\u{E001}<\/p>/gu,""),le=X(W(k,{finish:U}).text);return{slug:s,depth:t,page:e,directory:o,htmlFile:a,made:fe(e,ne,k),readOnly:le}}));if(L={slug:y[0]},m.length===1){let[{page:e,directory:t,htmlFile:l,made:s,readOnly:o}]=m;if(console.log(`Created ${b(l)} and ${x.basename(E(t).json)} from ${r}`),console.log(`Title: ${e.title}`),console.log(`Made: ${s.length?s.join(", "):"nothing but the title"}${e.files.length?` (${j(e.files.length,"file")} in ${b(x.join(t,"assets"))})`:""}`),e.notes?.length){console.log(`Not brought as the file has it (${e.notes.length}):`);for(let a of e.notes)console.log(` ${a.line?`line ${a.line}: `:""}${a.text}`)}if(o.length){console.log(`Text the preview leaves read-only (${o.length}), by doc.html's lines as gallery check gives them:`);for(let a of o)console.log(` ${a}`)}}else{console.log(`Created ${j(m.length,"document")} from ${r} (each nested as in the file):`);for(let{slug:l,depth:s,page:o,htmlFile:a,made:k}of m)console.log(`${" ".repeat(s+1)}${l} ${o.title} ${b(a)}`),console.log(`${" ".repeat(s+2)}Made: ${k.length?k.join(", "):"nothing but the title"}${o.files.length?` (${j(o.files.length,"file")} in its assets/)`:""}`);let e=m.flatMap(({slug:l,page:s})=>(s.notes??[]).map(o=>` ${l}: ${o.line?`line ${o.line}: `:""}${o.text}`));e.length&&console.log(`Not brought as the file has it (${e.length}):
|
|
3
|
+
${e.join(`
|
|
4
|
+
`)}`);let t=m.flatMap(({slug:l,readOnly:s})=>s.map(o=>` ${l}: ${o}`));t.length&&console.log(`Text the preview leaves read-only (${t.length}), by doc.html's lines as gallery check gives them:
|
|
5
|
+
${t.join(`
|
|
6
|
+
`)}`)}u.length&&console.log(`Not taken from ${r} (${u.length}): ${u.join(", ")}`);for(let e of await J())console.log(e);R=`edit ${b(m[0].htmlFile)}${m.length>1?" (and the others)":""} into the document as \u5199\u4F5C\u504F\u597D asks.`}finally{await v.rm(F,{recursive:!0,force:!0})}let N=await G(L.slug,{skipped:B(p),command:`gallery import ${r}`});console.log(_(N,R)),console.log(`Hand in: gallery export ${y.join(" ")}, then gallery qa ${y.join(" ")}`);let D=await z(N,p);D&&console.log(D);for(let i of N)console.log(i)}export{Se as run};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{c as O,d as P,e as b,l as C}from"./chunk-NFMCP2HI.mjs";import{a as q}from"./chunk-KTKHRC6H.mjs";import{a as u,f as S,g as w,i as E,j as I,k as H}from"./chunk-NAMN3RAF.mjs";import{a as h,b as R}from"./chunk-JEUK3ZO7.mjs";import{b as D,f as L,g as T}from"./chunk-4OZWXZE5.mjs";import{b as N}from"./chunk-PAREWQGB.mjs";import{existsSync as g}from"node:fs";import i from"node:path";import{reportsDirectory as c}from"../browser/shared/paths.mjs";import{idHolder as z,isDocSlug as B,keptName as G,layoutOf as A,listTrash as J}from"../browser/shared/workspace.mjs";import{parentIn as K}from"../browser/shared/outline.mjs";import{joinDefaultTree as Q,joinedLine as V}from"../browser/shared/drafts.mjs";var W="\u65B0\u6587\u6863";async function F(t,n=c){if(G(t))return`"${t}" is a name the workspace keeps for itself: choose another slug.`;if(g(i.join(A(n).preferencesPage,t)))return`"${t}" is the \u5199\u4F5C\u504F\u597D page's slug: choose another slug.`;if(g(i.join(A(n).customPages,t)))return`"${t}" is a custom page's slug (documents and custom pages share one set of names: gallery page list lists them): choose another slug.`;if(g(i.join(n,t)))return`Document already exists: ${h(i.join(n,t))}`;if((await J(n)).some(r=>r.slug===t))return`"${t}" is the slug of something in the trash: choose another slug.`;if(B(t)){let r=await z(t,n);if(r)return`"${t}" would have the page id (${t.slice(4)}) of "${r}" in this workspace, and two documents may not share an address: choose another slug.`}return null}async function fe(t){let{positional:n,options:r,values:U}=L({options:["--no-preview","--no-browser","--first"],values:["--under","--after"],argv:t}),[e,y,$=W]=n;if(n.length<2||n.length>3||!e||!y?.trim()||!$.trim())throw new D("Name the slug and the title (then a description, if you choose one), each quoted when it has spaces.");T(e);let s=H(U,r,{top:!1}),x=await F(e);x&&(console.error(x),process.exit(1));let M=s.under!==void 0||s.after!==void 0||s.first,l=null;if(M){let o=await u(),a=async(X,_)=>{let p=await S(X,_,o);return p.refused&&(console.error(`${p.refused} Nothing made.`),process.exit(1)),p.slug},f=s.under!==void 0?await a(s.under,"--under"):void 0,d=s.after!==void 0?await a(s.after,"--after"):null;d!==null&&f!==void 0&&K(o.children,d)!==f&&(console.error(`${w(o,e,"level",{parent:f,after:d})} Nothing made.`),process.exit(1)),l={parent:f,after:d,first:s.first}}try{await N(e,y,$)}catch(o){if(o.code!=="EEXIST")throw o;console.error(await F(e)??`Document already exists: ${h(i.join(c,e))}`),process.exit(1)}if(await import("./chunk-4AV456RQ.mjs").then(({noteNew:o})=>o(e)),console.log(`Created ${h(i.join(c,e,"doc.html"))} and doc.json`),l){let o=await E(e,l),a=await u();o.ok?console.log(`Placed it ${I(a,o)}.`):(console.log(`Not placed (${w(a,e,o.reason,{...l,message:o.message})}): it is at the top level, last; gallery move ${e} puts it where it goes.`),process.exitCode=1)}let v=V(await Q(c,e));v&&console.log(v);for(let o of await R())console.log(o);let j=q(c);j&&console.log(j);let m=await C(e,{skipped:b(r),command:`gallery new ${e}`});console.log(O(m,"replace the starter section with the document's skeleton (each section's heading) as soon as you can outline it, then write it a section at a time, as ordinary HTML, so that the user watches it grow (gallery check fails while the starter section remains).")),console.log(`Hand in: gallery export ${e}, then gallery qa ${e}`);let k=await P(m,r);k&&console.log(k);for(let o of m)console.log(o)}export{W as a,F as b,fe as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{
|
|
2
|
+
import{a,b,c}from"./chunk-YI43RG4P.mjs";import"./chunk-NAMN3RAF.mjs";import"./chunk-JEUK3ZO7.mjs";import"./chunk-4OZWXZE5.mjs";import"./chunk-5L7RYZCL.mjs";export{a as documentsOf,c as run,b as when};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{b as h,e as x}from"./chunk-A55HN5OK.mjs";x();import{BODY as C}from"../browser/shared/components/index.mjs";import{attr as u,elementsOf as f,walk as w}from"../browser/shared/html-tree.mjs";import{decoded as R,pageAddress as T}from"../browser/shared/page-address.mjs";import{CHART_SOURCE as A,cellWords as N,tableRows as E}from"../browser/shared/table-chart.mjs";var p=a=>a.nodeName==="#text"?a.value:(a.childNodes??[]).map(p).join(""),n=a=>f(a).filter(l=>l.tagName==="td"||l.tagName==="th"),M=a=>["rowspan","colspan"].some(l=>{let o=Number.parseInt(u(a,l)??"1",10);return Number.isFinite(o)&&o!==1});function b(a){let l=f(a),o=t=>f(t).filter(m=>m.tagName==="tr"),e=l.find(t=>t.tagName==="thead"),s=e?o(e)[0]??null:null,r=l.filter(t=>t.tagName==="tbody").flatMap(o);return!s&&r.length>0&&n(r[0]).length>0&&n(r[0]).every(t=>t.tagName==="th")&&([s,...r]=r),{groups:l,rowsOf:o,header:s,rows:r}}function S(a){let{groups:l,rowsOf:o,header:e,rows:s}=b(a),r=t=>N(p(t));return{names:e?n(e).map(r):null,types:e?n(e).map(t=>u(t,"data-sort-type")??null):null,rows:s.map(t=>n(t).map(m=>({words:r(m),sort:u(m,"data-sort-value")?.trim()??null}))),foot:l.filter(t=>t.tagName==="tfoot").flatMap(o).map(t=>n(t)[0]?r(n(t)[0]):""),merged:[e,...s].some(t=>t&&n(t).some(M))}}function W(a,l){let o=[];return w(a,e=>{if(e.tagName!=="a")return;let s=(u(e,"href")??"").trim();if(!s)return;let r=s.startsWith("#")&&s.length>1?l?{slug:l,block:R(s.slice(1))}:null:T(s);r&&o.push({slug:r.slug,title:N(p(e)),block:r.block??null})}),o}function I(a,l,o=null){let e=null;if(w(h(String(a)),i=>{e!==null||u(i,A)!==l||(e=i.tagName==="table"?i:f(i).find(c=>c.tagName==="table")??!1)},{...C,inTemplates:!1}),!e)return{error:"missing"};let s=S(e),r=E(s);if(r.error)return{error:"merged"};let{header:t,rows:m}=b(e),k=t?m:m.slice(1),O=s.names?s.rows:s.rows.slice(1),d=r.data.columns;return{columns:[...d],rows:r.data.map((i,c)=>{let g={};return d.forEach((v,y)=>{g[v]=O[c][y]?.words??""}),{values:{...i},links:W(k[c],o),words:g}})}}export{S as a,I as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{b as p,d as m}from"./chunk-UKSHDZZ6.mjs";import{p as d}from"./chunk-D4EURAX4.mjs";import c from"node:fs";import u from"node:os";import s from"node:path";import{refusal as o,said as t}from"../browser/shared/i18n/index.mjs";var f=64*1024*1024,l=2e3;function h(i){let r;try{r=m(i)}catch{throw o(t("{0} \u8BFB\u4E0D\u51FA\u6765\uFF1A\u4E0D\u662F\u5B8C\u597D\u7684 zip",s.basename(i)),{code:"kind"})}try{let e=r.entries;if(e.length>l||e.reduce((n,{size:a})=>n+a,0)>f)throw o(t("\u5757\u5305\u592A\u5927\uFF1A\u6700\u591A {0} \u4E2A\u6587\u4EF6\u3001{1} MB",l,f/1024/1024),{code:"size"});return e.map(n=>({name:n.name,data:Buffer.from(r.read(n))}))}catch(e){throw e.code?e:o(t("{0} \u8BFB\u4E0D\u51FA\u6765\uFF1A\u4E0D\u662F\u5B8C\u597D\u7684 zip",s.basename(i)),{code:"kind"})}finally{r.close()}}function g(i){let r=s.resolve(String(i??"").trim().replace(/^"(.*)"$/,"$1")),e;try{e=c.statSync(r)}catch{throw o(t("\u627E\u4E0D\u5230 {0}",r),{code:"missing"})}if(e.isDirectory())return d(r);if(!e.isFile())throw o(t("{0} \u4E0D\u662F\u6587\u4EF6\u5939\uFF0C\u4E5F\u4E0D\u662F zip",r),{code:"kind"});let n=Buffer.alloc(4),a=c.openSync(r,"r");try{c.readSync(a,n,0,4,0)}finally{c.closeSync(a)}if(!p(n))throw o(t("{0} \u4E0D\u662F\u6587\u4EF6\u5939\uFF0C\u4E5F\u4E0D\u662F zip",r),{code:"kind"});return h(r)}function B(i){if(!p(i))throw o(t("\u9009\u7684\u6587\u4EF6\u4E0D\u662F zip"),{code:"kind"});if(i.length>f)throw o(t("\u5757\u5305\u592A\u5927\uFF1A\u6700\u591A {0} \u4E2A\u6587\u4EF6\u3001{1} MB",l,f/1024/1024),{code:"size"});let r=c.mkdtempSync(s.join(u.tmpdir(),"gallery-pack-")),e=s.join(r,"pack.zip");try{return c.writeFileSync(e,i),h(e)}finally{c.rmSync(r,{recursive:!0,force:!0})}}export{g as a,B as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
+
import{c as i,d as u}from"./chunk-RKPWLGZ3.mjs";import{j as c,k as f}from"./chunk-UFNYFFKO.mjs";import{t as p}from"./chunk-D4EURAX4.mjs";import{b as d,f as h}from"./chunk-4OZWXZE5.mjs";import w from"node:fs/promises";import y from"node:path";import{reportsDirectory as b}from"../browser/shared/paths.mjs";import{sameDirectory as x}from"../browser/shared/preview-server.mjs";import{copyOldDocuments as j,ensureWorkspace as v,layoutOf as D}from"../browser/shared/workspace.mjs";import{nameProblem as G,writeWorkspaceName as N}from"../browser/shared/workspace-name.mjs";import{registerQuietly as O}from"../browser/shared/workspace-registry.mjs";var g=(o,t)=>`${o} ${t}${o===1?"":"s"}`;function C(o,t,r){let{preferences:s}=D(r);return[o.copied.length?`Copied ${g(o.copied.length,"document")} from ${t}: ${o.copied.join(", ")}`:`Copied no documents from ${t}.`,...o.skipped.length?[`Skipped (the slug is taken here, or the folder's name is no slug): ${o.skipped.join(", ")}`]:[],...o.kept.length?[`Left behind (a name a workspace keeps for itself, for its custom blocks here, which no new document takes): ${o.kept.join(", ")}`]:[],...o.preferences==="copied"?[`\u5199\u4F5C\u504F\u597D\uFF1Acopied (${s})`]:o.preferences==="kept"?[`\u5199\u4F5C\u504F\u597D\uFF1Akept the workspace's (${s}); the old one was not copied`]:[],...o.outline?[`Sidebar order: ${o.outline}`]:[],...o.page?[`\u5199\u4F5C\u504F\u597D's page: ${o.page==="copied"?"copied":"kept the workspace's"}`]:[],...o.emoji?[`Emoji library: ${o.emoji} added`]:[],...o.history?[`Recent versions: ${g(o.history,"document")}`]:[],...o.packages.length?[`Custom blocks: ${o.packages.join(", ")}`]:[]]}async function U(o){let{values:t}=h({values:["--from","--name"],argv:o}),r=b,s=t.get("--name"),l=s===void 0?null:G(s);if(l)throw new d(l);let m;try{let{made:e,ours:n,reads:k}=await v(r);n||(console.error(u(r,k)),process.exit(1)),m=e}catch(e){if(!e.code)throw e;console.error(i(r,e.code)),process.exit(1)}if(console.log(`\u5DE5\u4F5C\u533A\uFF1A${r}\uFF08${m?"\u65B0\u5EFA":"\u5DF2\u6709"}\uFF09`),s!==void 0)try{let e=await N(r,s);console.log(`\u540D\u5B57\uFF1A${e.name}${e.before&&e.before!==e.name?` (it was "${e.before}")`:""}`)}catch(e){console.error(e.code?i(r,e.code):e.message),process.exit(1)}if(await O(r),t.has("--from")){let e=y.resolve(t.get("--from"));await w.stat(e).then(n=>n.isDirectory(),()=>!1)||(console.error(`No such folder: ${e} (--from names an older Gallery's reports/ folder).`),process.exit(1)),x(e,r)&&(console.error(`${e} is this workspace: --from names another folder (an older Gallery's reports/).`),process.exit(1));for(let n of C(await j({from:e,to:r}),e,r))console.log(n)}let $=await p(r);for(let e of $.packs)e.failed?console.warn(`\u5757\u5305\uFF1AGallery's pack ${e.id} was not installed (${e.failed}); a later start tries again.`):e.first&&console.log(`\u5757\u5305\uFF1A${e.name.zh} (${e.id} ${e.version}, ${e.added.length+e.same.length+e.updated.length} blocks)${e.id==="gallery-soft"?", switched off: \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 turns it on":""}`);let a=await c(r);a.did==="made"?console.log(`\u9996\u9875\uFF1A${a.file} (the home page, its cards Gallery's today and note; the workbench opens it first)`):a.did==="failed"&&console.warn(`\u9996\u9875\uFF1A${f(a)}`),console.log('Next: gallery new <slug> "<title>" makes a document; gallery open opens the workbench.')}export{C as a,U as b};
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a,b,c,d,e}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e}from"./chunk-RKPWLGZ3.mjs";import"./chunk-N7AZZLGT.mjs";import"./chunk-5L7RYZCL.mjs";export{e as main,d as notOurs,b as readCommandLine,c as unwritable,a as versionOf};
|
package/dist/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as o}from"./chunk-
|
|
2
|
+
import{a as o}from"./chunk-6EXH3ORZ.mjs";import"./chunk-DR73Y2UJ.mjs";import"./chunk-NWFBE2YA.mjs";import"./chunk-PUOQ65NC.mjs";import"./chunk-ZUNVAXLH.mjs";import"./chunk-6VTU6KEO.mjs";import"./chunk-OJKMINIU.mjs";import"./chunk-B4P2CM2J.mjs";import"./chunk-VJPFVNNW.mjs";import"./chunk-PZDLJJTJ.mjs";import"./chunk-IA4PSIMD.mjs";import"./chunk-UKSHDZZ6.mjs";import"./chunk-6EZ7FNIK.mjs";import"./chunk-35NQ4PLQ.mjs";import"./chunk-V6RIYQZZ.mjs";import"./chunk-SXHBYZST.mjs";import"./chunk-UFNYFFKO.mjs";import"./chunk-D4EURAX4.mjs";import"./chunk-HMYTM3GT.mjs";import"./chunk-OW5NWPOJ.mjs";import"./chunk-ZTHICSSF.mjs";import"./chunk-SX4LJYT6.mjs";import"./chunk-PAREWQGB.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-N76HWBA3.mjs";import"./chunk-FJYN7RTH.mjs";import"./chunk-UBBRTJ2R.mjs";import"./chunk-FWNRPMCJ.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";var t=process.argv.indexOf("--port"),r=t===-1?Number.NaN:Number(process.argv[t+1]);(!Number.isInteger(r)||r<=0||r>=65536)&&(console.error("Usage: node dist/server.mjs --port <n> (GALLERY_WORKSPACE names the workspace). The gallery command starts it: gallery open."),process.exit(2));try{let{port:e}=await o({port:r});console.log(`[gallery] ${new Date().toISOString()} listening on http://127.0.0.1:${e}/ (pid ${process.pid})`)}catch(e){console.error(`[gallery] could not start on port ${r}: ${e.message}`),process.exit(1)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{
|
|
2
|
+
import{s as r}from"./chunk-EURLTOTZ.mjs";import"./chunk-Q4UEPUWF.mjs";import"./chunk-5L7RYZCL.mjs";var[e,s]=process.argv.slice(2);try{e&&s&&await r(e,s)}catch{}process.exit(0);
|
package/dist/worker.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as P,b as W,c as B,e as H}from"./chunk-
|
|
2
|
+
import{a as P,b as W,c as B,e as H}from"./chunk-D4CKRD3V.mjs";import"./chunk-UKSHDZZ6.mjs";import"./chunk-6EZ7FNIK.mjs";import"./chunk-35NQ4PLQ.mjs";import"./chunk-V6RIYQZZ.mjs";import"./chunk-SXHBYZST.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-N76HWBA3.mjs";import"./chunk-FJYN7RTH.mjs";import{c as F}from"./chunk-UBBRTJ2R.mjs";import{g as R,i as M}from"./chunk-FWNRPMCJ.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{parentPort as N}from"node:worker_threads";import{PAGE as U}from"../browser/editor/components/kit.mjs";import{APART as T,clipboardOf as X,tagKind as j,unitClipboard as _,writtenApart as Y}from"../browser/editor/components/registry.mjs";import{WRITERS as h,heldToWords as Z,unitOpening as tt,wordsIn as et}from"../browser/editor/page/clipboard/own/writers.mjs";import{escapeAttribute as v}from"../browser/shared/escape.mjs";import{referencedFile as rt}from"../browser/shared/media.mjs";var nt=/^\s*\\\(([\s\S]*)\\\)\s*$/,ot=" ",st=["script","style","template","noscript",T,U.header,`${U.header} > h1`].join(", ");function it(r,u){let f=globalThis.document.createElement("template");f.innerHTML=r??"";let d=g=>[...g.childNodes].map(n=>{if(n.nodeType===3)return n.data.replace(/ /g," ");if(n.nodeType!==1)return"";if(n.matches(".doc-math-inline")){let i=nt.exec(n.textContent)?.[1];return i!==void 0?i.trim()?`$${i.trim()}$`:"":n.textContent}if(n.localName==="img"){let i=n.getAttribute("src");return i?`)})`:""}if(n.matches("a.doc-link-mention")){let i=(n.querySelector(".doc-link-mention-title")??n).textContent.replace(/\s+/g," ").trim();return n.getAttribute("href")?`[${i||n.getAttribute("href")}](${n.getAttribute("href")})`:i}let l=d(n);if(n.localName==="br")return`
|
|
3
3
|
`;if(!l.trim())return l;let[c,m,p]=[l.match(/^\s*/)[0],l.trim(),l.match(/\s*$/)[0]];switch(n.localName){case"strong":case"b":return`${c}**${m}**${p}`;case"em":case"i":return`${c}*${m}*${p}`;case"s":case"del":case"strike":return`${c}~~${m}~~${p}`;case"code":return`${c}\`${m}\`${p}`;case"a":{let i=n.getAttribute("href")??"";return!i||i.startsWith("#")?l:rt(i)?`${c}[${m}](${u(i,"file",n.getAttribute("download")||D(i))})${p}`:m===i?`${c}${i}${p}`:`${c}[${m}](${i})${p}`}default:return n.classList.contains("doc-tab")?` ${l}`:l}}).join("");return Z(d(f.content).replace(/[ \t]+\n/g,`
|
|
4
4
|
`).trim())}function b(r){if(!r.querySelector(T))return r;let u=r.cloneNode(!0);for(let f of u.querySelectorAll(T))f.remove();return u}var ct=r=>(r?.textContent??"").replace(/\s+/g," ").trim(),D=r=>r.replace(/[?#].*$/,"").split("/").pop(),at=r=>r.replace(/[\\[\]]/g,"\\$&"),ut=/(\d+)/g;async function K(r,{title:u,media:f=g=>g,chart:d=()=>null}){let{UNIT:g,unitsOf:n,serializeInner:l,nestedBlocks:c,isHost:m}=await P(),p=e=>it(e,f),i=e=>{let t=b(e),o=[...t.querySelectorAll("img")];if(o.length===0)return l(t);let s=t.cloneNode(!0);return s.querySelectorAll("img").forEach((a,A)=>a.replaceWith(`\uE000${A}\uE001`)),l(s).replace(ut,(a,A)=>`<img src="${v(o[A].getAttribute("src")??"")}" alt="${v(o[A].getAttribute("alt")??"")}">`)},z=e=>p(i(e)),G=(e,{tables:t=!0}={})=>{let o=b(e);return[...o.querySelectorAll("img[src]")].filter(s=>!s.closest("a.doc-link-mention")&&(t||!o.contains(s.closest("table")))).map(s=>p(s.outerHTML))},x=e=>(j(e)&&!e.matches(g)&&e.setAttribute("data-ge-unit-kind",j(e)),e);function w(e){let t=[],o=null;for(let s of e.childNodes){let a=s.nodeType===1;(a?s.matches(st):s.nodeType!==3)||(a&&(s.matches(g)||F.has(s.localName))?(t.push(x(s)),o=null):(a||o||s.data.trim())&&(o||t.push(o=x(r.createElement("p"))),o.append(s.cloneNode(!0))))}return t}let y=e=>h[_(e).kind].list,C=e=>e.map(t=>t&&`${ot}${t}`);function k(e){let t=[],o=null;for(let s of e){let a=E(s);a.length!==0&&(o!==null&&!(y(o)&&y(s))&&t.push(""),t.push(...a),o=s)}return t}function S(e){let t=[];for(let o of e){let s=E(o);if(s.length===0)continue;let a=y(o);!a&&t.length>0&&t.at(-1)!==""&&t.push(""),!a&&t.length===0&&t.push(""),t.push(...C(s)),a||t.push("")}for(;t.at(-1)==="";)t.pop();return t}function J(e,t=null){let s=n(e).length>0?[]:h.words.exported(e,$,{without:t});return s.length>0?["",...C(s)]:S(w(e).filter(a=>a!==t))}function E(e){let t=_(e);return h[t.kind].exported(e,$,t)}function V(e,t){let o=/^en(?:-|$)/i.test(e.ownerDocument.documentElement.getAttribute("lang")??"");return t?o?"Chart":"\u56FE\u8868":o?"Figure":"\u56FE"}let $={isHost:m,nestedBlocks:c,serializeInner:l,media:f,chart:d,inline:p,own:z,withPictures:i,picturesIn:G,lines:k,held:S,heldIn:J,untitled:V,wordsIn:(e,t,o)=>et(b(e),t,o),plain:ct,unitsOf:w,words:e=>h.words.exported(e,$),packageOf:e=>R().packages.get(e),opening:(e,t)=>tt(e,t,$),writtenAs(e,t){let o=X(e);return h[o.kind].exported(t,$,o)}},I=r.querySelector(".doc-header"),O=I?k(w(I)):[],q=r.querySelector("main"),L=k(q?w(q):[]),Q=Y(r).flatMap(({element:e,clipboard:t})=>["",...h[t.kind].exported(e,$,t)]);return[`# ${u||"Untitled"}`,...O.length?["",...O]:[],...L.length?["",...L]:[],...Q].join(`
|
|
5
5
|
`)}import{saying as lt}from"../browser/shared/i18n/index.mjs";import{referencedFile as pt}from"../browser/shared/media.mjs";var ft=r=>`\0F${r}\0`,mt=r=>`\0C${r}\0`,dt={async markdown({source:r,title:u,pictures:f}){let{document:d}=await W(r),g=[],n=[...d.querySelectorAll("main figure.doc-figure")];return{text:await K(d,{title:u,media:(c,m,p)=>{let i=pt(c);return i?ft(g.push({src:i,kind:m,name:p})-1):c},chart:c=>f&&n.includes(c)?mt(n.indexOf(c)):null}),files:g,charts:n.length,charted:n.map(c=>!!c.querySelector("[data-doc-chart]"))}},import:({uploads:r,scratch:u})=>B(r,u),fill:r=>H(r)};N.on("message",async({id:r,type:u,payload:f})=>{try{M(),N.postMessage({id:r,result:await dt[u](f)})}catch(d){N.postMessage({id:r,error:{...lt(d),stack:d.stack}})}});
|
package/kit/board.css
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* A custom page and its boards (the spec custom-blocks-spec-2026-11-07.md §5, §6): the page's
|
|
2
|
+
margins, and each board a grid of square cells, like a phone's home screen, its cards placed by
|
|
3
|
+
whole cells. A cell is 64px square whatever the window, as a document's reading width is (the user's
|
|
4
|
+
word of 2026-11-09: folding the workbench's sidebar makes no card larger), twelve to a row, 944px,
|
|
5
|
+
in the middle of the page. board/index.js gives each card its place and size as --gallery-x,
|
|
6
|
+
--gallery-y, --gallery-w and --gallery-h (from its data-x, data-y, data-w and data-h), and the board
|
|
7
|
+
its cell's side in pixels as --gallery-cell and how many columns it has now as data-columns and
|
|
8
|
+
--gallery-columns: 12, or as many as a narrower board holds (4 at the least), its cards then one after
|
|
9
|
+
another in the order of their places, which the script works out and draws by the same custom
|
|
10
|
+
properties. A page's own <style> comes after this and wins over it at the same weight. */
|
|
11
|
+
|
|
12
|
+
/* A card's frame (one for every card: the block draws only what is in it) and the page's ground are the
|
|
13
|
+
kit's card tokens (styles/tokens.css, "Cards"), light and dark: white cards a step off a faint gray
|
|
14
|
+
ground in light, a card a step lighter than the ground with a faint top edge in dark; a hairline, a
|
|
15
|
+
soft shadow that lifts it, one radius and one padding for every card. */
|
|
16
|
+
|
|
17
|
+
/* The page: its ground (the window's whole, past the page's top and end too), the board's 24px on either
|
|
18
|
+
side at the least, 40px of room above the first board (a page open alone has its 添加自定义块 there);
|
|
19
|
+
--gallery-board-width, the width of twelve columns (12 x 64px and 11 gaps of 16px: shared/board-places.mjs
|
|
20
|
+
CELL and GAP, which tests/unit/pages.mjs holds it to), what a board and the page's header are at most, so
|
|
21
|
+
that the header's left edge is the cards'. A custom page shows
|
|
22
|
+
no big title of its own: its name is the sidebar's, the tab's and the top bar's, so a header's h1 (what a
|
|
23
|
+
page written before drew, and an Agent may still write) is not drawn, and a header holding nothing else
|
|
24
|
+
takes no room. */
|
|
25
|
+
html:has(> body > .gallery-page),
|
|
26
|
+
body:has(> .gallery-page),
|
|
27
|
+
.gallery-page { background: var(--gallery-page-fill); }
|
|
28
|
+
.gallery-page {
|
|
29
|
+
--gallery-board-width: 944px;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
min-height: 100vh;
|
|
32
|
+
padding: 40px 24px 48px;
|
|
33
|
+
}
|
|
34
|
+
.gallery-page-head { max-width: var(--gallery-board-width); margin: 0 auto; padding: 0 0 20px; }
|
|
35
|
+
.gallery-page-head > h1 { display: none; }
|
|
36
|
+
.gallery-page-head:not(:has(> :not(h1))) { display: none; }
|
|
37
|
+
|
|
38
|
+
/* A board: as wide as the room it stands in, up to twelve columns' width, in its middle; its columns of
|
|
39
|
+
square cells 16px apart in the middle of it, as many as the script says (--gallery-columns: 12, fewer
|
|
40
|
+
on a narrower board) and as large (--gallery-cell: 64px, smaller only where not even 4 fit); twelve of
|
|
41
|
+
64px until it has said them. */
|
|
42
|
+
.gallery-board {
|
|
43
|
+
--gallery-gap: 16px;
|
|
44
|
+
--gallery-columns: 12;
|
|
45
|
+
display: grid;
|
|
46
|
+
grid-template-columns: repeat(var(--gallery-columns), var(--gallery-cell, 64px));
|
|
47
|
+
grid-auto-rows: var(--gallery-cell, 64px);
|
|
48
|
+
justify-content: center;
|
|
49
|
+
gap: var(--gallery-gap);
|
|
50
|
+
max-width: var(--gallery-board-width, 944px);
|
|
51
|
+
margin: 0 auto 24px;
|
|
52
|
+
}
|
|
53
|
+
/* A board with no card yet: the room of a row of two cells, outlined, so that the page shows where its cards will go. */
|
|
54
|
+
.gallery-board:not(:has(> .gallery-card)) {
|
|
55
|
+
min-height: calc(2 * var(--gallery-cell, 64px) + var(--gallery-gap));
|
|
56
|
+
border: 1px dashed var(--gallery-card-line);
|
|
57
|
+
border-radius: var(--gallery-card-radius);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* A card: at its cells, the instance it holds in its frame. What does not fit scrolls inside it. Its
|
|
61
|
+
top-right corner, a 28 x 28 box 6px in from its top and right edges, is the grip's (the board's editing):
|
|
62
|
+
--gallery-grip-room is how far that box reaches into the content from its right edge, with a little air,
|
|
63
|
+
which a block keeps its head's own controls and words out of (padding-inline-end on its first row).
|
|
64
|
+
--gallery-grip-shown is 1 while the grip stands in the card (the board's editing sets it), else 0: a head's
|
|
65
|
+
quiet note at its end may reach into the corner while it is 0, so that it ends where the content under it
|
|
66
|
+
does (margin-inline-end: calc(-1 * var(--gallery-grip-room))), and fades while it is 1. */
|
|
67
|
+
.gallery-card {
|
|
68
|
+
--gallery-grip-room: max(0px, calc(40px - var(--gallery-card-pad)));
|
|
69
|
+
--gallery-grip-shown: 0;
|
|
70
|
+
position: relative;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
min-width: 0;
|
|
73
|
+
min-height: 0;
|
|
74
|
+
grid-column: calc(var(--gallery-x, 0) + 1) / span var(--gallery-w, 4);
|
|
75
|
+
grid-row: calc(var(--gallery-y, 0) + 1) / span var(--gallery-h, 2);
|
|
76
|
+
overflow: auto;
|
|
77
|
+
padding: var(--gallery-card-pad);
|
|
78
|
+
border: 1px solid var(--gallery-card-line);
|
|
79
|
+
border-radius: var(--gallery-card-radius);
|
|
80
|
+
background: var(--gallery-card-fill);
|
|
81
|
+
box-shadow: var(--gallery-card-shadow);
|
|
82
|
+
scrollbar-width: thin;
|
|
83
|
+
}
|
|
84
|
+
/* A block that asks for no frame (its manifest's card.bare: the server says data-ge-bare): its card is
|
|
85
|
+
where it is and as large, and draws nothing of its own; its content stands at the cells' edges. */
|
|
86
|
+
.gallery-card[data-ge-bare] {
|
|
87
|
+
padding: 0;
|
|
88
|
+
border-color: transparent;
|
|
89
|
+
background: transparent;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
}
|
|
92
|
+
/* The instance fills its card, its own margins and its first and last blocks' outer ones left out: the frame's padding is the room around it. */
|
|
93
|
+
.gallery-card > [data-doc-component] { margin: 0; }
|
|
94
|
+
.gallery-card > [data-doc-component] > :first-child { margin-top: 0; }
|
|
95
|
+
.gallery-card > [data-doc-component] > :last-child { margin-bottom: 0; }
|