@heycys/gallery 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/columns/page.mjs +4 -4
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/embed/page.mjs +1 -1
- package/browser/editor/components/file/page.mjs +4 -4
- 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 +7 -6
- package/browser/editor/components/icons.mjs +11 -0
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/index.mjs +2 -0
- package/browser/editor/components/image/page.mjs +172 -90
- package/browser/editor/components/installed/index.mjs +15 -4
- package/browser/editor/components/installed/page.mjs +103 -25
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/icons.mjs +13 -8
- package/browser/editor/components/media/page.mjs +5 -3
- package/browser/editor/components/media/toolbar.mjs +12 -3
- package/browser/editor/components/paragraph/index.mjs +4 -3
- package/browser/editor/components/registry.mjs +30 -9
- package/browser/editor/components/table/index.mjs +61 -2
- package/browser/editor/components/table/page.mjs +1 -1
- package/browser/editor/page/after/index.mjs +288 -0
- package/browser/editor/page/align.mjs +91 -0
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/autosave.mjs +310 -37
- package/browser/editor/page/beside.mjs +5 -6
- package/browser/editor/page/block-menu/index.mjs +6 -3
- package/browser/editor/page/blocks.mjs +3 -1
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +182 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +1059 -0
- package/browser/editor/page/board/motion.mjs +177 -0
- package/browser/editor/page/board/settings.mjs +210 -0
- package/browser/editor/page/caret.mjs +1 -1
- package/browser/editor/page/changes/bar.mjs +6 -14
- package/browser/editor/page/changes/index.mjs +2 -2
- 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 +133 -15
- package/browser/editor/page/clipboard/own/blocks.mjs +13 -14
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +6 -2
- package/browser/editor/page/clipboard/own/selection.mjs +1 -1
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +80 -22
- package/browser/editor/page/conflicts.mjs +7 -7
- package/browser/editor/page/core.mjs +34 -16
- package/browser/editor/page/custom-page.mjs +110 -0
- package/browser/editor/page/editor.mjs +71 -17
- package/browser/editor/page/emoji-picker/styles.mjs +7 -12
- package/browser/editor/page/emoji-picker/upload.mjs +2 -2
- package/browser/editor/page/handle/index.mjs +5 -8
- package/browser/editor/page/history.mjs +41 -6
- package/browser/editor/page/insert/index.mjs +20 -22
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/look.mjs +54 -3
- package/browser/editor/page/margin.mjs +18 -3
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +33 -14
- package/browser/editor/page/notices.mjs +2 -2
- package/browser/editor/page/page-objects.mjs +9 -2
- package/browser/editor/page/panel.mjs +4 -9
- package/browser/editor/page/present-links.mjs +15 -5
- package/browser/editor/page/present-shell.mjs +63 -0
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/index.mjs +10 -2
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +48 -4
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/binding.mjs +87 -0
- package/browser/editor/page/table/cells.mjs +102 -46
- package/browser/editor/page/table/index.mjs +24 -9
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +103 -0
- package/browser/editor/page/table/widths.mjs +82 -10
- package/browser/editor/page/text-select/index.mjs +26 -12
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/typing/index.mjs +97 -15
- package/browser/editor/page/typing/leave.mjs +19 -5
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/block-packs.mjs +419 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/colors.mjs +3 -2
- package/browser/shared/component-catalog.mjs +330 -46
- package/browser/shared/component-source.mjs +39 -0
- package/browser/shared/components/heading.mjs +2 -1
- package/browser/shared/components/index.mjs +12 -3
- package/browser/shared/components/installed.mjs +35 -3
- package/browser/shared/components/page.mjs +20 -8
- package/browser/shared/components/paragraph.mjs +8 -1
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -0
- package/browser/shared/document-look.mjs +10 -5
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/line-icons.mjs +37 -0
- 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/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +330 -27
- package/browser/shared/json-layout.mjs +47 -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/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +359 -67
- package/browser/shared/pack-manifest.mjs +88 -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 +500 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/pinyin.mjs +92 -0
- package/browser/shared/present-step.mjs +17 -0
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +8 -1
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/sidebar-head.mjs +70 -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 +139 -0
- package/browser/shared/workspace-columns.mjs +120 -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/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/chunk-3MBRL2PM.mjs +16 -0
- package/dist/chunk-4OKWZY5E.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5K44HLTZ.mjs +2 -0
- package/dist/{chunk-5ZKJ3H4P.mjs → chunk-5XA2ZBAE.mjs} +3 -3
- package/dist/{chunk-4FS7Z7WR.mjs → chunk-67N2QJYT.mjs} +1 -1
- package/dist/chunk-6KBYRA2C.mjs +2 -0
- package/dist/chunk-6N3PX4XX.mjs +8 -0
- package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/chunk-7JDX4E65.mjs +13 -0
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/chunk-7OG26PGF.mjs +2 -0
- package/dist/chunk-AHN3NFKJ.mjs +3 -0
- package/dist/chunk-ALZ6ZENZ.mjs +3 -0
- package/dist/chunk-AR5D57ZD.mjs +170 -0
- package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
- package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
- package/dist/chunk-CMA72MAG.mjs +2 -0
- package/dist/{chunk-LCTHTZIL.mjs → chunk-DAZL73VK.mjs} +91 -91
- package/dist/{chunk-Y6RLRPG3.mjs → chunk-DJISHPUL.mjs} +1 -1
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-FDLXYYG4.mjs → chunk-EAIFITAV.mjs} +1 -1
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/chunk-EP25HDAJ.mjs +2 -0
- package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-F4ZA6JRZ.mjs +3 -0
- package/dist/chunk-F6HVDZR4.mjs +2 -0
- package/dist/chunk-FDMAXMQA.mjs +2 -0
- package/dist/chunk-FETSREUN.mjs +5 -0
- package/dist/chunk-GHOYKMQ3.mjs +4 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-HDWTZ763.mjs +12 -0
- package/dist/chunk-HPOI4ZX7.mjs +6 -0
- package/dist/{chunk-BGGDRNYQ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/{chunk-E7LWZRXY.mjs → chunk-ITOH5EGO.mjs} +1 -1
- package/dist/chunk-IV64FFI4.mjs +2 -0
- package/dist/chunk-J43Z6LSS.mjs +2 -0
- package/dist/chunk-J5PUIV3Y.mjs +4 -0
- package/dist/chunk-JA7G53PC.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JLTZF4LA.mjs +2 -0
- package/dist/chunk-JZT7I2OJ.mjs +2 -0
- package/dist/chunk-K5XATEOO.mjs +2 -0
- package/dist/chunk-L2SUIS5S.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-LM4XFQHZ.mjs +2 -0
- package/dist/chunk-MN7BZL4R.mjs +2 -0
- package/dist/chunk-MTYYHM2G.mjs +15 -0
- package/dist/chunk-MXUBKDRO.mjs +15 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-SYGN7GLU.mjs → chunk-OEXWRJME.mjs} +1 -1
- package/dist/chunk-OFHXGWOX.mjs +2 -0
- package/dist/chunk-ORID3AE7.mjs +166 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-PGDE24N5.mjs +2 -0
- package/dist/chunk-POTA2FV4.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QE5RG76S.mjs +549 -0
- package/dist/chunk-R2ZDLJYT.mjs +10 -0
- package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SWUTTZCN.mjs +2 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TR7TWGHB.mjs +2 -0
- package/dist/chunk-U5XL7D6A.mjs +3 -0
- package/dist/{chunk-XNROSH2T.mjs → chunk-U7NZI6N4.mjs} +2 -2
- package/dist/chunk-UGWMMEJ5.mjs +15 -0
- package/dist/chunk-UJQJKNGK.mjs +2 -0
- package/dist/chunk-UYVCQK3H.mjs +22 -0
- package/dist/chunk-VFX2KNHP.mjs +4 -0
- package/dist/chunk-VS7JIGJW.mjs +24 -0
- package/dist/chunk-W7665ZEC.mjs +6 -0
- package/dist/chunk-WQDQWCX5.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YLPSMDIS.mjs +5 -0
- package/dist/chunk-YNAWBAYN.mjs +3 -0
- package/dist/chunk-YROX2O22.mjs +2 -0
- package/dist/chunk-ZDLPUOAG.mjs +6 -0
- package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZQS6H473.mjs +16 -0
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZWWC4KLF.mjs +20 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-U6KNPJPR.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 +17 -17
- package/kit/report.css +335 -18
- package/kit/runtime.js +1638 -125
- package/kit/state.js +10 -1
- package/kit/tables.js +130 -43
- package/kit/ui.js +79 -35
- 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 +216 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +118 -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 +334 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +174 -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 +513 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +189 -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 +129 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +97 -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 +293 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +85 -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 +171 -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 +347 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +73 -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 +220 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +149 -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 +489 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +214 -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 +387 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +140 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/countdown/component.json +18 -0
- package/packs/gallery-soft/countdown/example.html +3 -0
- package/packs/gallery-soft/countdown/kit.js +206 -0
- package/packs/gallery-soft/countdown/preview.svg +1 -0
- package/packs/gallery-soft/countdown/style.css +211 -0
- package/packs/gallery-soft/countdown/template.html +3 -0
- package/packs/gallery-soft/countdown/writing.md +24 -0
- package/packs/gallery-soft/habit/component.json +14 -0
- package/packs/gallery-soft/habit/example.html +3 -0
- package/packs/gallery-soft/habit/kit.js +366 -0
- package/packs/gallery-soft/habit/preview.svg +1 -0
- package/packs/gallery-soft/habit/style.css +251 -0
- package/packs/gallery-soft/habit/template.html +3 -0
- package/packs/gallery-soft/habit/writing.md +23 -0
- package/packs/gallery-soft/heatmap/component.json +18 -0
- package/packs/gallery-soft/heatmap/example.html +3 -0
- package/packs/gallery-soft/heatmap/kit.js +498 -0
- package/packs/gallery-soft/heatmap/preview.svg +1 -0
- package/packs/gallery-soft/heatmap/style.css +181 -0
- package/packs/gallery-soft/heatmap/template.html +3 -0
- package/packs/gallery-soft/heatmap/writing.md +23 -0
- package/packs/gallery-soft/note/component.json +14 -0
- package/packs/gallery-soft/note/example.html +3 -0
- package/packs/gallery-soft/note/kit.js +162 -0
- package/packs/gallery-soft/note/preview.svg +1 -0
- package/packs/gallery-soft/note/style.css +148 -0
- package/packs/gallery-soft/note/template.html +3 -0
- package/packs/gallery-soft/note/writing.md +20 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/packs/gallery-soft/recent/component.json +13 -0
- package/packs/gallery-soft/recent/example.html +1 -0
- package/packs/gallery-soft/recent/kit.js +335 -0
- package/packs/gallery-soft/recent/preview.svg +1 -0
- package/packs/gallery-soft/recent/style.css +160 -0
- package/packs/gallery-soft/recent/template.html +1 -0
- package/packs/gallery-soft/recent/writing.md +17 -0
- package/packs/gallery-soft/static/component.json +13 -0
- package/packs/gallery-soft/static/example.html +12 -0
- package/packs/gallery-soft/static/preview.svg +1 -0
- package/packs/gallery-soft/static/style.css +186 -0
- package/packs/gallery-soft/static/template.html +1 -0
- package/packs/gallery-soft/static/writing.md +20 -0
- package/packs/gallery-soft/stats/component.json +13 -0
- package/packs/gallery-soft/stats/example.html +1 -0
- package/packs/gallery-soft/stats/kit.js +341 -0
- package/packs/gallery-soft/stats/preview.svg +1 -0
- package/packs/gallery-soft/stats/style.css +119 -0
- package/packs/gallery-soft/stats/template.html +1 -0
- package/packs/gallery-soft/stats/writing.md +13 -0
- package/packs/gallery-soft/today/component.json +12 -0
- package/packs/gallery-soft/today/example.html +1 -0
- package/packs/gallery-soft/today/kit.js +222 -0
- package/packs/gallery-soft/today/preview.svg +1 -0
- package/packs/gallery-soft/today/style.css +178 -0
- package/packs/gallery-soft/today/template.html +1 -0
- package/packs/gallery-soft/today/writing.md +16 -0
- package/packs/gallery-soft/todos/component.json +19 -0
- package/packs/gallery-soft/todos/example.html +3 -0
- package/packs/gallery-soft/todos/kit.js +527 -0
- package/packs/gallery-soft/todos/preview.svg +1 -0
- package/packs/gallery-soft/todos/style.css +212 -0
- package/packs/gallery-soft/todos/template.html +3 -0
- package/packs/gallery-soft/todos/writing.md +32 -0
- package/packs/gallery-soft/weather/component.json +19 -0
- package/packs/gallery-soft/weather/example.html +3 -0
- package/packs/gallery-soft/weather/kit.js +411 -0
- package/packs/gallery-soft/weather/preview.svg +1 -0
- package/packs/gallery-soft/weather/style.css +185 -0
- package/packs/gallery-soft/weather/template.html +3 -0
- package/packs/gallery-soft/weather/writing.md +28 -0
- package/release.json +12 -10
- package/sdk/doc-kit.d.ts +396 -5
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +56 -23
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +225 -0
- package/skill/references/writing-html.md +8 -4
- package/skill/sdk/doc-kit.d.ts +396 -5
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BM_K-Auu.css +1 -0
- package/web/assets/index-DRslOBiv.js +15 -0
- package/web/index.html +2 -2
- package/dist/chunk-3HIRPVLU.mjs +0 -2
- package/dist/chunk-5MHMDLZD.mjs +0 -4
- package/dist/chunk-64K7IPLO.mjs +0 -255
- package/dist/chunk-6QXGZM36.mjs +0 -8
- package/dist/chunk-6RGJOMJP.mjs +0 -16
- package/dist/chunk-AJ73XJF3.mjs +0 -2
- package/dist/chunk-AUZGSZJH.mjs +0 -13
- package/dist/chunk-BFE45AKL.mjs +0 -2
- package/dist/chunk-BXO2ZY5P.mjs +0 -2
- package/dist/chunk-CEH4MRCC.mjs +0 -2
- package/dist/chunk-CY2FNNAB.mjs +0 -16
- package/dist/chunk-DFUDV4LX.mjs +0 -2
- package/dist/chunk-DKXG4XDG.mjs +0 -2
- package/dist/chunk-EZQ34M3F.mjs +0 -124
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FUKQNOQS.mjs +0 -9
- package/dist/chunk-JPOSLGOC.mjs +0 -6
- package/dist/chunk-JVHHHGEA.mjs +0 -3
- package/dist/chunk-L3QKH4OK.mjs +0 -26
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LEF6DRCK.mjs +0 -59
- package/dist/chunk-NO5NJCHO.mjs +0 -2
- package/dist/chunk-NQPVAU63.mjs +0 -2
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O35FIXRB.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-PL6GHLGD.mjs +0 -15
- package/dist/chunk-QJIR2BLP.mjs +0 -6
- package/dist/chunk-QUPLVPB2.mjs +0 -7
- package/dist/chunk-R7BNENLY.mjs +0 -4
- package/dist/chunk-S6O4UHLC.mjs +0 -2
- package/dist/chunk-SGJWQKEI.mjs +0 -2
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-TYK6VNAB.mjs +0 -10
- package/dist/chunk-UALRNVSE.mjs +0 -4
- package/dist/chunk-V3HXVQEM.mjs +0 -2
- package/dist/chunk-V5VXUJKG.mjs +0 -2
- package/dist/chunk-VBXMADMP.mjs +0 -2
- package/dist/chunk-VNV55RUA.mjs +0 -2
- package/dist/chunk-VPD2PS35.mjs +0 -2
- package/dist/chunk-W4VKN3GF.mjs +0 -7
- package/dist/chunk-W5BXXPDJ.mjs +0 -3
- package/dist/chunk-XUNHRCOG.mjs +0 -6
- package/skill/references/building-components.md +0 -367
- package/web/assets/index-Bh74DfsV.css +0 -1
- package/web/assets/index-UW0RyFFt.js +0 -13
package/dist/chunk-TYK6VNAB.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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 Je,B as Qe,C as Xe,D as me,E as Ot,H as tn,I as en,a as pe,e as Ee,f as Fe,g as Oe,h as De,i as wt,j as he,k as Ne,l as Xt,m as Dt,n as Ve,o as Ge,p as vt,q as $e,r as Ye,s as Le,t as mt,u as G,v as Me,w as We,x as Ze,y as je,z as Q}from"./chunk-L3QKH4OK.mjs";import{d as qt}from"./chunk-W4VKN3GF.mjs";import{b as ue,c as de,e as Ae}from"./chunk-A55HN5OK.mjs";import{BLOCK_TYPES as ve,COPIED_AS_ITSELF as zn,IDENTITY as yn}from"../browser/editor/components/registry.mjs";import{copyKeys as Un}from"../browser/editor/components/figure/index.mjs";import{accepts as ye,attributeValue as En,BLOCK_TYPES as Vt,boxRole as be,CHAPTER as On,holdsStraight as Nn,IDENTITY as Ke,isLead as ln,SIZES as $n,sizeValue as an,TOGGLES as cn}from"../browser/editor/components/registry.mjs";import{iconMarkup as Ln,iconValueOf as Mn,validIcon as jn}from"../browser/editor/components/icon/index.mjs";Ae();import{attributeValue as xn,BLOCK_TYPES as nn,HOSTS as wn,TOGGLES as vn}from"../browser/editor/components/registry.mjs";import{texSource as sn}from"../browser/editor/components/math/index.mjs";var Te=new Set(Object.entries(nn).filter(([,s])=>!s.box&&!s.bare).map(([s])=>s)),te=(s,m,w="")=>{let g=Q[m.type]?.leaf;if(g)return g(s,m,w);let k=[s.className,...m.classes??[]].filter(Boolean).join(" ");return`<${s.tag}${k?` class="${k}"`:""}${he(m.attributes)}${w}>${m.html}</${s.tag}>`},Ce=(s,m)=>s===void 0||!!s&&typeof s=="object"&&!Array.isArray(s)&&Object.entries(s).every(([w,g])=>typeof g=="string"&&xn(m,w,g)),Be=s=>s?.empty===!0,qe=(s,m)=>s===void 0?null:w=>s.includes(m.slice(w.startOffset,w.endOffset));function ke(s,m,{empty:w=!1,file:g}={}){if(typeof m!="string"||!m.trim()&&!(w&&m===""))return!1;if(m==="")return!0;if(s.tex&&!sn(m))return!1;let k=s.inside??s.tag,O=`<${k}>${m}</${k}>`,[I,...a]=de(O,{sourceCodeLocationInfo:!0}).childNodes;return a.length===0&&I?.tagName===k&&me(I,[],s.inside!==void 0,{lists:k==="td"||k==="th",known:qe(g,O)})===null}var In=new Set(Object.values(nn).filter(s=>s.text&&s.className).map(s=>s.kind));function Pe(s,m){if(s.keep?.reason==="script")return null;if(s.kind==="list")return m.some(g=>g.unit===s.id&&g.kind==="list")?"list":null;let w=Q[s.kind];return w?.written?w.written(s)?"written":null:s.text===void 0||s.nested?null:["p","h1","h2","h3","h4","li"].includes(s.tag)||In.has(s.kind)?"text":null}function ge(s,m,w){if(!Array.isArray(m)||!m.every(k=>An(s,k,w)))return"invalid";let g=m.filter(k=>k.keep);return g.length>1?"invalid":m.length>g.length&&!s.caps.split||g.length===0&&!s.caps.remove||m.length===0&&s.nested?"fixed":g.length===1&&g[0].html.trim()===""&&!s.caps.empty?"empty":null}function on(s,m,w){let g=`<table><tbody><tr><${s}>${m}</${s}></tr></tbody></table>`,[k,...O]=de(g,{sourceCodeLocationInfo:!0}).childNodes,I=O.length===0&&k?.tagName==="table"&&k.childNodes.length===1?k.childNodes[0]:null,a=I?.childNodes.length===1?I.childNodes[0]:null,p=a?.childNodes.length===1?a.childNodes[0]:null;return p?.tagName===s&&me(p,[],!1,{lists:!0,known:qe(w,g)})===null}var rn={p:"paragraph",h1:"heading",h2:"heading",h3:"heading",h4:"heading",li:"item"},Sn=(s,m)=>s.classes===void 0||!s.keep&&Array.isArray(s.classes)&&new Set(s.classes).size===s.classes.length&&s.classes.every(w=>(vn[rn[m]]??[]).includes(w));function An(s,m,w){if(!m||typeof m.html!="string"||wn[s.kind]?.tex&&!sn(m.html))return!1;let g=m.keep?s.tag:m.tag;if(!m.keep&&Qe[s.tag]!==g||!Sn(m,g)||m.attributes!==void 0&&(m.keep||!Ce(m.attributes,rn[g])))return!1;let k=g==="td"||g==="th",O=k?`<table><tbody><tr><${g}>${m.html}</${g}></tr></tbody></table>`:`<${g}>${m.html}</${g}>`,[I,...a]=de(O,{sourceCodeLocationInfo:!0}).childNodes;if(a.length>0||!I)return!1;let p=I;if(k){let h=I.tagName==="table"&&I.childNodes.length===1?I.childNodes[0]:null,u=h?.childNodes.length===1?h.childNodes[0]:null;p=u?.childNodes.length===1?u.childNodes[0]:null}return p?.tagName===g&&me(p,[],Xe(s.kind,s.tag,s.caps),{lists:k,known:qe(w,O)})===null}import{attr as fn}from"../browser/shared/html-tree.mjs";import{pageLanguage as Tn}from"../browser/shared/components/page.mjs";import{SHEETS as Cn}from"../browser/editor/components/kit.mjs";import{BLOCK_ID as Bn}from"../browser/shared/ids.mjs";function un({current:s,edits:m,units:w=[],partial:g=!1,ids:k=!1,touch:O=[],proposals:I=null}){let a=Ot(s),p=a.blocks,h=s.includes(`\r
|
|
3
|
-
`)?`\r
|
|
4
|
-
`:`
|
|
5
|
-
`,u=[],L=[],j=[],H=new Map,z=null,X,xt=!1,tt=(t,n)=>u.push({unit:t.id,reason:n}),et=t=>{let r=Dt(t).replace(/[0-9.]/g,l=>String.fromCharCode(l.charCodeAt(0)-65248)).replace(/[\s,,]/g,"").replace(/[−–]/g,"-").match(/-?\d+(?:\.\d+)?/)?.[0];return r===void 0?null:Number(r)},ut=(t,n,r)=>{if(t.kind!=="cell")return;let l=s.slice(t.start,t.innerStart),c=/\sdata-sort-value(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/.exec(l);if(!c)return;let d=(c[1]??c[2]??c[3]??"").trim(),x=/^-?\d+(\.\d+)?(e[-+]?\d+)?$/i.test(d)?Number(d):null,[S,f]=[et(s.slice(t.innerStart,t.innerEnd)),et(n)],y="";x!==null&&f!==null?y=` data-sort-value="${Number((f*(S?x/S:1)).toPrecision(12))}"`:x!==null&&S===null&&(y=c[0]),y!==c[0]&&L.push({start:t.start+c.index,end:t.start+c.index+c[0].length,text:y,of:[{id:r}]})},Gt=t=>{t.keep&&e(t)?tt(t,"referenced"):j.push({start:t.start,end:t.end},...t.companion?[t.companion]:[])},ne=(t,n)=>{let r=t.classAttr,l=r?r.value.split(/\s+/).filter(Boolean):[],c=l;for(let[x,S]of n)c=S?c.includes(x)?c:[...c,x]:c.filter(f=>f!==x);if(c.join(" ")===l.join(" "))return;if(ct(t),!r){let x=/^<[A-Za-z][\w-]*/.exec(s.slice(t.elStart,t.elStart+40));if(!x)return tt(t,"unknown");let S=t.elStart+x[0].length;L.push({start:S,end:S,text:` class="${c.join(" ")}"`});return}if(c.length===0){L.push({...Xt(s,r.start,r.end),text:""});return}let d=/=\s*'/.test(s.slice(r.start,r.end))?"'":'"';L.push({start:r.start,end:r.end,text:`class=${d}${c.join(" ")}${d}`})},It=typeof k=="function"?k:k?tn:null,lt=new Set([...s.matchAll(en)].map(t=>t[1]??t[2])),Pt=()=>{for(;;){let t=It();if(!lt.has(t))return lt.add(t)&&t}},se=[],Kt=[],Yt=t=>t?` ${Ke}="${t}"`:"",ie=t=>typeof t=="string"&&Bn.test(t)&&!lt.has(t),at=(t,n)=>{let r=It?ie(n)?(lt.add(n),n):Pt():null;return r&&t!==void 0&&Kt.push({key:t,id:r}),Yt(r)},st=new Set,zt=t=>{st.add(t.at);let n=I?.get(t.id),r=It?ie(n)?(lt.add(n),n):Pt():null;return r&&se.push({at:t.at,id:r}),Yt(r)},ct=t=>{if(!It||!t||t.blockId||t.at===void 0||st.has(t.at))return;let n=Ne(s,t.at);L.push({start:n,end:n,text:zt(t)})},St=t=>{let{element:n,source:r}=vt(t.restore),l=n.sourceCodeLocation,c=fn(n,Ke);if(c&&!lt.has(c))return lt.add(c),t.key!==void 0&&Kt.push({key:t.key,id:c}),r;let d=r,x=l.startTag.endOffset-1;if(c){let S=l.attrs[Ke],f=Xt(d,S.startOffset,S.endOffset);d=d.slice(0,f.start)+d.slice(f.end),x-=f.end-f.start}return x=Ne(d,x),d.slice(0,x)+at(t.key,t.blockId)+d.slice(x)},kt=t=>{let n=null;for(let r of a.units)r.elStart<=t.start&&t.start<r.end&&(!n||r.elStart>n.elStart)&&(n=r);return n},_=new Set;for(let t of m){let{id:n,parts:r}=t??{},l=Number.isInteger(n)?p[n]:void 0;if(!l){u.push({id:n,reason:"unknown"});continue}if(Array.isArray(r)&&r.length===0&&l.self!==null&&a.units[l.self].keep){u.push({id:n,reason:"referenced"});continue}let c=ge(l,r,s);if(c){u.push({id:n,reason:c});continue}if(r.length===0){let N={...Me(s,l.start,l.end),of:[{id:n}]};L.push(N),H.set(n,N),l.self!==null&&_.add(l.self);continue}let d=G(s,l.start),x=d===null?"":h+d,S=N=>`<${N.tag}${N.classes?` class="${N.classes.join(" ")}"`:""}${he(N.attributes)}${at(N.key,N.blockId)}>${N.html}</${N.tag}>`,f=r.findIndex(N=>N.keep),y=kt(l),v=y&&y.at===l.innerStart-1;if((!v||l.tag==="li")&&ct(y),l.tag==="li"&&f>=0){let N=r.slice(0,f),K=r.slice(f+1),C=y?{start:y.start,end:y.end}:null;L.push({start:l.innerStart,end:l.innerEnd,text:r[f].html,of:[{id:n}]}),N.length>0&&L.push({start:l.start,end:l.start,seq:1/0,text:N.map(S).join(x)+x,edge:C,of:[{id:n}]}),K.length>0&&L.push({start:l.end,end:l.end,text:x+K.map(S).join(x),edge:C,of:[{id:n}]})}else{let N=s.slice(l.start,l.innerStart);if(v&&It&&!y.blockId&&!st.has(y.at)&&(N=`${N.slice(0,-1)}${zt(y)}>`),r.length===1&&f===0&&N===s.slice(l.start,l.innerStart)){L.push({start:l.innerStart,end:l.innerEnd,text:r[0].html,of:[{id:n}]}),ut(l,r[0].html,n),l.kind==="title"&&(z={from:Dt(s.slice(l.innerStart,l.innerEnd)),to:Dt(r[0].html)});continue}let K=r.map(C=>C.keep?N+C.html+s.slice(l.innerEnd,l.end):S(C)).join(x);L.push({start:l.start,end:l.end,text:K,of:[{id:n}]})}l.kind==="title"&&(z={from:Dt(s.slice(l.innerStart,l.innerEnd)),to:Dt(r[0].html)})}let Y=(t,n,r)=>{let l=a.units.filter(f=>f.box===t),c=[];for(let f=1;f<l.length;f++){let y=s.slice(l[f-1].end,l[f].start);y.trim()||c.push({pair:[l[f-1],l[f]],gap:y})}let d=c.find(({pair:f})=>f.includes(n))??c[0];if(d)return d.gap.replace(/\r?\n/g,h);let x=G(s,r.start),S=be(a.boxes[t]?.kind)==="root"?h:"";return x===null?"":S+h+x},Wt=t=>{if(t.kind!=="nest"||G(s,t.innerEnd)!==null)return null;let n=a.units[t.unit];return n?G(s,n.elStart):null},Zt=(t,n)=>{let r=s.slice(t.at+1,t.innerEnd).match(/\n([ \t]*)\S/);return r?r[1]:`${n??""} `},Ut=(t,n)=>n!==null&&be(t.kind)==="root",dt=[],Jt=(t,n,r,l)=>{let c=Number.isInteger(n?.into)?a.boxes[n.into]:null,d=Number.isInteger(n?.after),x=c?null:a.units[d?n.after:n?.before],S=c??(x?a.boxes[x.box]:null),f=K=>K>=t.start&&K<t.end;if(!S||!(ye(S.kind,Qt(t))||l===S.kind)||t.kind==="tab"&&S.id!==t.box||x&&(x===t||!r.has(x.id)||f(x.elStart))||c&&f(S.at))return tt(t,"position");let y=G(s,t.start);if(ct(t),c){if(c.innerEnd===null)return tt(t,"missing");let K=Wt(c);if(K!==null){dt.push({start:t.start,end:t.end,at:c.innerEnd,seq:o++,from:y,to:K+nt,wrap:U=>h+K+nt+U+h+K});return}let C=G(s,c.innerEnd),W=Zt(c,C),T=C!==null&&W.startsWith(C)?W.slice(C.length):" ",q=Ut(c,C);dt.push({start:t.start,end:t.end,at:q?c.innerEnd-C.length:c.innerEnd,seq:o++,from:y,to:W,wrap:U=>C===null?U:q?C+T+U+h:T+U+h+C});return}let v=Y(x.box,x,x),N=d?v.includes(`
|
|
6
|
-
`)?v.slice(v.lastIndexOf(`
|
|
7
|
-
`)+1):null:G(s,x.start);dt.push({start:t.start,end:t.end,at:d?x.end:x.start,seq:o++,from:y,to:N,wrap:K=>d?v+K:K+v})},gt=(t,n)=>t.classes===void 0||Array.isArray(t.classes)&&new Set(t.classes).size===t.classes.length&&t.classes.every(r=>(cn[n.kind]??[]).includes(r)),_t=(t,n)=>!Je(t)&&(Q[t.type]?.check?.(t)??!0)&>(t,n)&&Ce(t.attributes,n.kind),Ht=(t,n,r={})=>ke(t,n,{...r,file:s}),Rt=(t,n)=>{if(ot.has(t.id))return;let r=Vt[n?.type],l=Pe(t,a.boxes);if(!(l==="text"||l==="written"&&r?.kind!==t.kind)||!Te.has(n?.type)||!ke(r,n.html,{empty:Be(r),file:s}))return tt(t,"invalid");if(!ht.has(t.id)&&!bt.has(t.id)&&!ye(a.boxes[t.box].kind,r.kind))return tt(t,"position");if(!_t(n,r))return tt(t,"invalid");let c=t.blockId?Yt(t.blockId):zt(t);st.add(t.at);let d=l==="written"&&t.node?Fe(s,t.node,Q[t.kind].attribute):t.carried;L.push({start:t.elStart,end:t.end,text:te(r,n,d+c)})},oe=(t,n)=>{if(ot.has(t.id))return;let r=Q[t.kind]?.rewrite;if(!r)return tt(t,"invalid");let l=r(s,t.node,n,{validCell:(c,d)=>on(c,d,s),get packages(){return qt().packages}});if(!l)return tt(t,"invalid");ct(t),L.push(...[l].flat())},re=(t,n)=>{if(Pe(t,a.boxes)!=="list"||n!=="ul"&&n!=="ol")return tt(t,"invalid");let r=/^<(ul|ol)\b/i.exec(s.slice(t.elStart,t.elStart+3)),l=/<\/(ul|ol)\s*>$/i.exec(s.slice(t.elStart,t.end));if(!r||!l)return tt(t,"unknown");if(r[1].toLowerCase()===n)return;ct(t);let c=t.end-l[0].length+2;L.push({start:t.elStart+1,end:t.elStart+3,text:n},{start:c,end:c+2,text:n})},Nt=new Set([...s.matchAll(/\sid\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi)].map(t=>t[1]??t[2]??t[3])),$t=new Map,Lt=new Set,nt=/\n(\t|[ ]+)</.exec(s)?.[1]??" ",yt=(t,n)=>{let r=d=>ye(n,d)||t?.stood===n;if(t?.restore!==void 0){let d=vt(t.restore),x=d?.kind==="item"?Oe(d.element,n):d?.kind;if(!d||!r(x))return!1;if(t.children===void 0)return!0;if(t.boxKeys!==void 0){let f=Ee(d.element,d.kind);return Array.isArray(t.boxKeys)&&t.boxKeys.length===t.children.length&&t.children.every((y,v)=>{let N=f.find(({key:K})=>K===t.boxKeys[v]);return!!N&&yt(y,N.kind)})}let S=Vt[t.type];return Nn(S)&&S.kind===x&&t.children.every(f=>yt(f,S.box))}if(t?.unit!==void 0){let d=Number.isInteger(t.unit)?a.units[t.unit]:void 0;return!d||Lt.has(d.id)||ot.has(d.id)||ht.has(d.id)||_.has(d.id)||d.kind==="tab"||!r(Qt(d))?!1:(Lt.add(d.id),!0)}let l=Vt[t?.type];if(!l||!r(l.kind))return!1;if(t.type==="divider")return!0;if(t.type==="icon")return jn(t.icon);let c=Q[t.type];return l.bare&&c?.check?c.check(t,{validLeaf:Ht,usedIds:Nt})&>(t,l):l.box?!Array.isArray(t.children)||t.children.length===0&&!c?.empty||!gt(t,l)||c?.check&&!c.check(t,{validLeaf:Ht,usedIds:Nt})?!1:t.children.every(d=>yt(d,l.box)):!Te.has(t.type)||!ke(l,t.html,{empty:Be(l),file:s})||!_t(t,l)?!1:t.children===void 0?!0:Array.isArray(t.children)&&c?.children?.(t,yt)===!0},Z=(t,n)=>{if(t.unit!==void 0){let y=$t.get(t.unit);return mt(R(y),y.from,n)}if(t.restore!==void 0&&t.children===void 0)return mt(St(t),"",n);let r=Vt[t.type];if(t.type==="divider")return`<hr${at(t.key,t.blockId)}>`;if(t.type==="icon")return Ln(t.icon,at(t.key,t.blockId));let l=n===null?null:n+nt,c=(y,v,N,K=n,C=l)=>C===null?y+v.join("")+N:y+v.map(W=>h+C+W).join("")+h+K+N,d=y=>t.children.map(v=>Z(v,y));if(t.restore!==void 0&&t.boxKeys!==void 0){let y=St(t),{element:v,kind:N}=vt(y),K=Ee(v,N).flatMap(({element:C,key:W})=>{let T=t.children.filter((rt,Ct)=>t.boxKeys[Ct]===W);if(T.length===0)return[];let{startTag:q,endTag:U}=C.sourceCodeLocation,J=n===null?null:G(y,q.startOffset),ft=J===null?null:J+nt;return[{start:q.endOffset,end:U.startOffset,text:c("",T.map(rt=>Z(rt,ft)),"",J,ft)}]}).sort((C,W)=>W.start-C.start).reduce((C,{start:W,end:T,text:q})=>C.slice(0,W)+q+C.slice(T),y);return mt(K,"",n)}if(t.restore!==void 0){let y=St(t),{element:v}=vt(y),{startTag:N,endTag:K}=v.sourceCodeLocation,C=v.childNodes.findLastIndex(T=>T.tagName),W=v.childNodes.slice(C+1).filter(T=>T.nodeName==="#comment").map(({sourceCodeLocation:{startOffset:T,endOffset:q}})=>mt(y.slice(T,q),G(y,T),l));return c(mt(y.slice(0,N.endOffset),"",n),[...d(l),...W],K?y.slice(K.startOffset):`</${r.tag}>`)}let x={get id(){return at(t.key,t.blockId)},get language(){return Tn(s)},idOf:y=>at(y.key,y.blockId),render:(y,v)=>Z(y,v),indent:n,inner:l,step:nt,block:c,children:d,deep:y=>n===null?null:n+nt.repeat(y)},S=Q[t.type]?.write;if(r.bare&&S)return S(t,x);if(!r.box)return t.children?S(t,x):te(r,t,at(t.key,t.blockId));if(S)return S(t,x);let f=[r.className,...t.classes??[]].filter(Boolean).join(" ");return c(`<${r.tag}${f?` class="${f}"`:""}${at(t.key,t.blockId)}>`,d(l),`</${r.tag}>`)},it=[],le=t=>{let{insert:n,place:r}=t,l=T=>u.push({unit:t.id,reason:T}),c=n?.restore!==void 0?vt(n.restore):null;if(n?.type==="icon"||c?.kind==="icon"){let T=Number.isInteger(r?.into)?a.boxes[r.into]:null,q=T?null:a.units[Number.isInteger(r?.after)?r.after:r?.before],U=T??(q?a.boxes[q.box]:null);if(ln(U?.kind,"icon")){if(!yt(n,U.kind))return l("invalid");if(U.innerEnd===null)return l("missing");let rt=a.units.find(Re=>Re.box===U.id&&Re.kind!=="icon"),Ct=rt?rt.start:U.innerEnd,Bt=G(s,Ct);it.push({at:Ct,seq:o++,text:()=>Z(n,Bt)+(Bt===null?"":h+Bt)});return}if(!yt(n,"header"))return l("invalid");let J=p.find(rt=>rt.kind==="title");if(!J)return l("missing");let ft=G(s,J.start);it.push({at:J.start,seq:o++,text:()=>Z(n,ft)+(ft===null?"":h+ft)}),X=c?Mn(c.source):n.icon;return}if(n?.type==="tab"||c?.kind==="tab")return Mt(t,c,l);let d=Number.isInteger(r?.into)?a.boxes[r.into]:null,x=Number.isInteger(r?.after),S=d?null:a.units[x?r.after:r?.before],f=d??(S?a.boxes[S.box]:null),y=n?.restore!==void 0?vt(n.restore):null,v=y?f&&y.kind==="item"?Oe(y.element,f.kind):y.kind:Vt[n?.type]?.kind;if(!f||!v||!(ye(f.kind,v)||n.stood===f.kind)||S&&!Tt.has(S.id))return l("position");let N=new Set(Lt);if(!yt(n,f.kind))return l("invalid");for(let T of Lt){if(N.has(T))continue;let q=a.units[T];ct(q);let U={start:q.start,end:q.end,at:null,from:G(s,q.start)};$t.set(T,U),dt.push(U)}if(d){if(d.innerEnd===null)return l("missing");let T=Wt(d);if(T!==null){it.push({at:d.innerEnd,seq:o++,text:()=>h+T+nt+Z(n,T+nt)+h+T});return}let q=G(s,d.innerEnd),U=Zt(d,q),J=q!==null&&U.startsWith(q)?U.slice(q.length):nt,ft=a.units.filter(Bt=>Bt.box===d.id),rt=be(d.kind)==="root"&&On.has(v)&&(ft.some(Bt=>Tt.has(Bt.id))||!d.pure&&(ft.length>0||n.restore!==void 0))?h:"",Ct=Ut(d,q);it.push({at:Ct?d.innerEnd-q.length:d.innerEnd,seq:o++,text:()=>q===null?Z(n,null):Ct?rt+q+J+Z(n,U)+h:J+Z(n,U)+h+q});return}let K=x?S.end:S.start;if(be(f.kind)==="root"){let T=Y(S.box,S,S),q=x?T.includes(`
|
|
8
|
-
`)?T.slice(T.lastIndexOf(`
|
|
9
|
-
`)+1):null:G(s,S.start);it.push({at:K,seq:o++,text:()=>x?T+Z(n,q):Z(n,q)+T});return}let C=G(s,S.start),W=C===null?"":h+C;it.push({at:K,seq:o++,text:()=>x?W+Z(n,C):Z(n,C)+W})},Mt=({insert:t,place:n},r,l)=>{let c=Number.isInteger(n?.after),d=a.units[c?n.after:n?.before];if(d?.kind!=="tab"||!Tt.has(d.id))return l("position");if(!yt(t,"tabs"))return l("invalid");let x=d.companion,S=a.units[d.parent??-1];if(!x||!S)return l("missing");let f=r?fn(r.element,Cn.tabKey):t.sheet,y=s.slice(S.start,S.end);if(y.includes(`data-sheet-tab="${f}"`)||y.includes(`data-doc-sheet="${f}"`))return l("invalid");let v=G(s,d.start),N=G(s,x.start),K=(U,J)=>U===null?J:c?h+U+J:J+h+U,C=()=>r?mt(St(t),"",v):Ze({...t,sheet:f},at(t.key,t.blockId)),W=()=>{if(r)return mt(r.panel,"",N);let U=`<div data-doc-sheet="${f}">`;if(t.children.length===0)return N===null?`${U}</div>`:`${U}${h}${N}</div>`;let J=N===null?null:N+nt,ft=t.children.map(rt=>Z(rt,J));return J===null?U+ft.join("")+"</div>":U+ft.map(rt=>h+J+rt).join("")+h+N+"</div>"};it.push({at:c?d.end:d.start,seq:o++,text:()=>K(v,C())});let T=c?/^\s*/.exec(s.slice(x.end))[0]:/\s*$/.exec(s.slice(0,x.start))[0],q=N!==null&&/\n[ \t]*\r?\n/.test(T)?h:"";it.push({at:c?x.end:x.start,seq:o++,text:()=>c?q+K(N,W()):K(N,W())+q})},Ie=(t,n)=>{let r=t.node?.sourceCodeLocation;if(t.at===void 0||!r)return tt(t,"unknown");ct(t),L.push(...je(s,r.startTag,[["style",l=>Ge(l?.value??"",n)||null]]))},D=(t,n)=>{let r=t.node?.sourceCodeLocation;if(t.at===void 0||!r)return tt(t,"unknown");ct(t),L.push(...je(s,r.startTag,n))},jt=new Map,pt=new Map,At=new Map,ot=new Set(w.filter(t=>t?.remove===!0).map(t=>t.id)),ht=new Set(w.filter(t=>t?.move).map(t=>t.id)),bt=new Map,ae=(t,n)=>n?.unit!==void 0?bt.set(n.unit,t.id):Array.isArray(n?.children)&&n.children.forEach(r=>ae(t,r));w.forEach(t=>ae(t,t?.insert));let ce=new Map(w.filter(t=>Number.isInteger(t?.id)&&t.replace).map(t=>[t.id,t.replace])),Qt=t=>Vt[ce.get(t.id)?.type]?.kind??t.kind,Tt=new Set(a.units.map(t=>t.id).filter(t=>!ot.has(t)&&!ht.has(t)&&!bt.has(t)&&!_.has(t))),fe=a.units.filter(t=>ht.has(t.id)||bt.has(t.id)),Se=(t,n)=>r=>n.some(l=>l!==t&&t.start<=l.start&&l.end<=t.end&&l.start<=r&&r<l.end),e=t=>!!t.keep&&!t.keep.at.every(Se(t,fe)),i=(t,n)=>{let r=[L,j,dt,it],l=r.map(c=>c.length);n(),r.forEach((c,d)=>c.slice(l[d]).forEach(x=>x.of??=t))},o=0;for(let t of w){let{id:n,remove:r,toggle:l,on:c,move:d,size:x,value:S,attribute:f,stood:y}=t??{},v=Number.isInteger(n)?a.units[n]:void 0;i([{unit:n}],()=>{if(t?.insert&&typeof n=="string")le(t);else if(v&&t.replace){let N=u.length;Rt(v,t.replace),u.length>N&&ce.delete(v.id)}else v&&t.retag?re(v,t.retag):v&&(t.table||t.source)?oe(v,t.table??t.source):v&&r===!0?e(v)?u.push({unit:n,reason:"referenced"}):v.kind==="tab"&&a.units.every(N=>N.box!==v.box||ot.has(N.id))?u.push({unit:n,reason:"last"}):(v.kind==="icon"&&!ln(a.boxes[v.box]?.kind,"icon")&&(xt=!0),Gt(v)):v&&d&&typeof d=="object"&&!ot.has(n)?_.has(n)||Jt(v,d,Tt,y):v&&typeof c=="boolean"&&(cn[v.kind]??[]).includes(l)?(jt.get(v)??jt.set(v,new Map).get(v)).set(l,c):v&&$n[v.kind]?.[x]&&(S===null||an(v.kind,x,S)!==null)?ot.has(n)||(pt.get(v)??pt.set(v,new Map).get(v)).set(x,S===null?null:an(v.kind,x,S)):v&&typeof f=="string"&&En(v.kind,f,S)?ot.has(n)||(At.get(v)??At.set(v,new Map).get(v)).set(f,S):u.push({unit:n,reason:x===void 0&&f===void 0?"unknown":"invalid"})})}let b=new Set(u.map(t=>t.unit).filter(t=>t!==void 0)),M=t=>(ot.has(t.id)||ht.has(t.id)||bt.has(t.id))&&!b.has(bt.get(t.id)??t.id);for(let t of a.boxes){if(!["list","quote"].includes(t.kind)||!t.pure||t.unit===null)continue;let n=a.units[t.unit];if(!n||ot.has(n.id)||ht.has(n.id)||bt.has(n.id))continue;let r=a.units.filter(c=>c.box===t.id);if(r.length===0||!r.every(M))continue;let l=c=>!!c&&(c.into===t.id||[n,...r].some(d=>c.after===d.id||c.before===d.id));w.some(c=>l(c?.insert?c.place:c?.move))||Gt(n)}for(let[t,n]of jt)i([{unit:t.id}],()=>ne(t,n));for(let[t,n]of pt)i([{unit:t.id}],()=>Ie(t,n));for(let[t,n]of At)i([{unit:t.id}],()=>D(t,n));for(let t of O)ct(a.units[t]);let E=new Set([...H.keys()].map(t=>p[t].wrapper).filter(Boolean));for(let t of E){let n=t.ids.map(r=>H.get(r));n.some(r=>!r)||j.some(r=>r.start<=t.start&&t.end<=r.end)||(n.forEach(r=>r.skip=!0),L.push({...Me(s,t.start,t.end),of:t.ids.map(r=>({id:r}))}))}if(z&&z.from!==z.to){let t=Ve(s,z);z.synced=!!t,t&&L.push(t)}else z=null;let $=new Map;for(let t of j){let n=`${t.start}:${t.end}`;$.has(n)?$.get(n).of=[...$.get(n).of??[],...t.of??[]]:$.set(n,t)}j.splice(0,j.length,...$.values());let A=(t,n)=>{t.of?.length||u.push({reason:n});for(let r of t.of??[])u.push({...r,reason:n})},B=(t,n,r)=>n===r?t.start<n&&n<t.end:t.start<=n&&r<=t.end,F=(t,n,r,l=null)=>{let c=null;for(let d of dt){let x=l!==null&&d.start===l.start&&d.end===l.end;d!==r&&(x||B(d,t,n))&&(!c||d.start>=c.start)&&(c=d)}return c},V=(t,n,r,l=null)=>{let c=F(t,n,r,l);return j.some(d=>d!==r&&B(d,t,n)&&!(c&&B(d,c.start,c.end)))},P=new Set,R=t=>{if(P.has(t))return A(t,"position"),"";P.add(t);try{return Et(t)}finally{P.delete(t)}},Et=t=>{let[n,r]=t?[t.start,t.end]:[0,s.length],l=(f,y,v=null,N=null)=>F(f,y,v,N)===t&&!V(f,y,v,N),c=[];for(let f of[...j,...dt].filter(y=>y!==t&&l(y.start,y.end,y)).sort((y,v)=>y.start-v.start)){let y=c.at(-1);y&&(f.start<=y.end||!s.slice(y.end,f.start).trim())?(y.end=Math.max(y.end,f.end),y.of.push(...f.of??[])):c.push({start:f.start,end:f.end,of:[...f.of??[]]})}let d=[...L.filter(f=>!f.skip&&l(f.start,f.end,null,f.edge??null)).map(f=>({...f,seq:f.seq??-2})),...c.map(f=>({...We(s,f.start,f.end),seq:-1,of:f.of})),...[...dt.filter(f=>f.at!==null),...it].filter(f=>l(f.at,f.at,f)).map(f=>({start:f.at,end:f.at,seq:f.seq,text:f.text?f.text():f.wrap(mt(R(f),f.from,f.to)),of:f.of}))].sort((f,y)=>f.start-y.start||f.end-f.start-(y.end-y.start)||f.seq-y.seq),x=[];for(let f of d)x.length>0&&f.start<x.at(-1).end?A(f,"overlap"):x.push(f);let S=s.slice(n,r);for(let f of x.reverse())S=S.slice(0,f.start-n)+f.text+S.slice(f.end-n);return S},Ft=R(null);if(u.length>0&&!g)return{ok:!1,conflicts:u};let He=X??(xt?null:void 0);return{ok:u.length===0,text:Ft,version:pe(Ft),ids:{assigned:se,created:Kt},...z?{title:z}:{},...He!==void 0?{icon:He}:{},...g?{conflicts:u}:{}}}import{attr as bn}from"../browser/shared/html-tree.mjs";import{outsideKey as _n}from"../browser/shared/ids.mjs";Ae();import{commonPrefix as dn,commonRun as bs,commonSuffix as pn,mergeText as hn}from"../browser/editor/page/merge.mjs";var ee=new Map;function xe(s){let m=ee.get(s);if(m)return m;let w=/data-block-id/i.test(s)?De(s,[ue(s,{sourceCodeLocationInfo:!0})]):[],g="",k=0,O=0,I=[];for(let p of w)g+=s.slice(k,p.start),k=p.end,O+=p.end-p.start,I.push({at:g.length,end:p.end,removed:O});g+=s.slice(k);let a={text:g,at:p=>p-(I.findLast(h=>h.end<=p)?.removed??0),source:p=>p+(I.findLast(h=>h.at<=p)?.removed??0)};for(ee.set(s,a);ee.size>4;)ee.delete(ee.keys().next().value);return a}function ze(s,m,w,g=w.start){let[k,O]=[xe(s),xe(m)],I=k.at(w.start),a=k.text.slice(I,k.at(w.end)),p=H=>O.source(H+k.at(g)-I),h=H=>{let z=[];for(let X=H.indexOf(a);X>=0;X=H.indexOf(a,X+1))z.push(X);return z},u=h(O.text);if(u.length<=1&&h(k.text).length<=1)return u.length===1?p(u[0]):-1;let L=k.text.slice(Math.max(0,I-120),I),j=u.filter(H=>O.text.slice(Math.max(0,H-L.length),H)===L);return j.length===1?p(j[0]):u.length>1?-2:-1}function Ue(s,m,w,g){let[O,I]=[xe(s),xe(m)],[a,p]=[O.at(w.start),O.at(w.end)],h=O.text.slice(Math.max(0,a-400),a),u=O.text.slice(p,p+400),L=g.filter(z=>z.tag===w.tag).map(z=>{let[X,xt]=[I.at(z.start),I.at(z.end)];return{other:z,score:pn(h,I.text.slice(Math.max(0,X-400),X))+dn(u,I.text.slice(xt,xt+400))}}).sort((z,X)=>X.score-z.score),[j,H]=L;return j&&j.score>=40&&j.score-(H?.score??0)>=20?j.other:null}function mn(s,m){let w=p=>p.replace(/<[^>]*>/g," ").replace(/&(?:[a-z]+|#\d+);/gi," ").replace(/\s+/g," ").trim(),g=w(s),k=w(m);if(!g||!k)return!g&&!k;if(g.length<2||k.length<2)return g===k;let O=p=>{let h=new Map;for(let u=0;u<p.length-1;u++)h.set(p.slice(u,u+2),(h.get(p.slice(u,u+2))??0)+1);return h},I=O(k),a=0;for(let[p,h]of O(g))a+=Math.min(h,I.get(p)??0);return 2*a/(g.length-1+k.length-1)>=.5}Ae();import{IDENTITY as qn}from"../browser/editor/components/registry.mjs";import{escapeAttribute as Pn}from"../browser/shared/escape.mjs";import{attr as kn}from"../browser/shared/html-tree.mjs";import{CHART_DATA as _e,CHART_SOURCE as we,nextChartKey as Kn}from"../browser/shared/table-chart.mjs";function gn(s,m){if(m.size===0||!s.includes(we))return{text:s,keys:{}};let w=[],g=(a,p)=>{for(let h of a.childNodes??[]){if(!h.tagName)continue;let u=p||m.has(kn(h,qn));for(let L of[_e,we]){let j=kn(h,L);j!==void 0&&w.push({name:L,key:j,made:u,at:h.sourceCodeLocation?.attrs?.[L]??null})}g(h.tagName==="template"?h.content:h,u)}};g(ue(s,{sourceCodeLocationInfo:!0}),!1);let k=new Set(w.map(({key:a})=>a)),O={};for(let a of new Set(w.filter(p=>p.made&&p.name===we).map(p=>p.key))){let p=w.filter(u=>u.key===a&&!u.made),h=w.some(u=>u.key===a&&u.made&&u.name===_e);h&&p.length>0?(O[a]=Kn(k),k.add(O[a])):!h&&p.some(u=>u.name===we)&&(O[a]=null)}return{text:w.filter(({name:a,key:p,made:h,at:u})=>h&&u&&Object.hasOwn(O,p)&&!(O[p]===null&&a===_e)).map(({name:a,key:p,at:h})=>O[p]===null?{...Xt(s,h.startOffset,h.endOffset),put:""}:{start:h.startOffset,end:h.endOffset,put:`${a}="${Pn(O[p])}"`}).sort((a,p)=>p.start-a.start).reduce((a,{start:p,end:h,put:u})=>a.slice(0,p)+u+a.slice(h),s),keys:O}}function Hn({current:s,opening:m=null,texts:w=[],units:g=[],touch:k=[],ids:O=!0,seal:I=null,pageIds:a=null}){let p=Ot(s),h=typeof m=="string"?Ot(m):null,u=e=>s.slice(e.innerStart,e.innerEnd),L=null,j=e=>(L??=new Map(p.units.map(i=>[i.id,wt(s,i)]))).get(e.id),H=new Map,z=new Set,X=new Map,xt=new Set(Array.isArray(a)?a.filter(e=>typeof e=="string"):[]),tt=(e,i,o=!0,b=[])=>{let M=R=>!!R.blockId&&xt.has(R.blockId)&&!b.includes(R.blockId),E=xt.size>0?p.units.filter(R=>!M(R)):p.units,$=typeof i=="string"?E.filter(R=>j(R)===i):[],A=e>=0?h?.units[e]:void 0,B=A&&$.length>1?h.units.filter(R=>!M(R)&&wt(m,R)===i):[];if($.length===1)return{unit:$[0]};if(B.length===$.length&&B.includes(A))return{unit:$[B.indexOf(A)]};if(!A)return $.length>1?{reason:"ambiguous"}:{gone:!0};let F=ze(m,s,A,A.elStart),V=F>=0?E.find(R=>R.elStart===F):null;if(V)return{unit:V};if(F===-2||$.length>1)return{reason:"ambiguous"};if(!o)return{gone:!0};let P=Ue(m,s,A,E);return P&&mn(m.slice(A.start,A.end),s.slice(P.start,P.end))?{unit:P,changed:!0}:{gone:!0}},et=e=>{if(!e||typeof e.key!="number"&&typeof e.key!="string")return{reason:"invalid"};if(H.has(e.key))return H.get(e.key);let i,o=typeof e.blockId=="string"?p.units.filter(b=>b.blockId===e.blockId):[];if(o.length===1&&typeof e.id!="string")i={unit:o[0]};else if(typeof e.id=="string"){let b=p.units.filter(M=>M.blockId===e.id);i=b.length===1?{unit:b[0]}:b.length>1?{reason:"ambiguous"}:Number.isInteger(e.open)&&typeof e.openHash=="string"?tt(e.open,e.openHash,!1,[e.id]):{gone:!0}}else Number.isInteger(e.open)?i=tt(e.open,e.hash,!0,[e.blockId]):i={reason:"invalid"};return i.unit&&!i.unit.blockId&&typeof e.blockId=="string"&&X.set(i.unit.id,e.blockId),H.set(e.key,i),i.unit&&ut(e,i)&&z.add(e.key),i},ut=(e,i)=>i.changed||e.hash===null||typeof e.hash=="string"&&j(i.unit)!==e.hash,Gt=new Set(p.units.map(e=>e.blockId).filter(Boolean)),ne=[],It=e=>e?.restore!==void 0?bn(vt(e.restore?.source)?.element??{},yn)??e.blockId:e?.blockId,lt=e=>{let i=It(e);if(typeof i=="string"&&Gt.has(i))return!0;let o=ve[e?.type];return!!o?.keyed&&typeof e.id=="string"&&p.boxes.some(b=>b.kind===o.box&&b.key===e.id)},Pt=e=>{let i=It(e);e?.key!==void 0&&typeof i=="string"&&Gt.has(i)&&ne.push({key:e.key,id:i}),Array.isArray(e?.children)&&e.children.forEach(Pt)},se=(e,i)=>{let o=ve[i?.type];return!!o&&s.slice(e.elStart,e.end)===te(o,i,(e.carried??"")+(e.blockId?` ${yn}="${e.blockId}"`:""))},Kt=(e,i,o)=>Array.isArray(e)&&Array.isArray(i)&&e.length===i.length&&e[0]===i[0]&&e.slice(1).every((b,M)=>b[0]===i[M+1]?.[0]&&b[1]===i[M+1][1]&&(!o||b[2]===i[M+1][2])),Yt=e=>{if(!e||typeof e.before!="string")return{reason:"invalid"};let i=o=>({block:o,changed:u(o)!==e.before});if(e.title){let o=p.blocks.filter(b=>b.kind==="title");return o.length===1?i(o[0]):{reason:o.length?"ambiguous":"missing"}}if(e.unit){let o=et(e.unit);if(!o.unit)return{reason:o.gone?"missing":o.reason};let b=p.blocks.filter($=>$.unit===o.unit.id);if(e.self){let $=b.find(A=>A.self===o.unit.id);return $?i($):{reason:"missing"}}let M=b.find($=>Kt($.path,e.path,!1));if(M&&Kt(M.path,e.path,!0))return i(M);let E=b.filter($=>u($)===e.before);return E.length===1?i(E[0]):{reason:Q[o.unit.kind]?.textParts&&!ut(e.unit,o)?"package":"structure"}}if(Number.isInteger(e.open)||e.outside){let o=p.blocks.filter(A=>A.unit===null&&A.kind!=="title"&&u(A)===e.before);if(o.length===1)return i(o[0]);let b=Number.isInteger(e.open)?h?.blocks[e.open]:null;if(!b||o.length>1)return{reason:o.length>1?"ambiguous":"missing"};let M=ze(m,s,b),E=M>=0?p.blocks.find(A=>A.start===M):null;if(E)return i(E);let $=M===-2?null:Ue(m,s,b,p.blocks.filter(A=>A.unit===null));return $?i($):{reason:M===-2?"ambiguous":"missing"}}return{reason:"invalid"}},ie=e=>{if(e?.main)return p.boxes.find(o=>o.kind==="main")??null;if(e&&!e.unit&&typeof e.kind=="string")return p.boxes.find(o=>o.unit===null&&o.kind===e.kind&&(o.key??null)===(e.key??null))??null;let i=e?.unit?et(e.unit):null;return i?.unit?p.boxes.find(o=>o.unit===i.unit.id&&o.kind===e.kind&&(o.key??null)===(e.key??null))??null:null},at=[],st=e=>{e&&typeof e=="object"&&(typeof e.key=="number"||typeof e.key=="string")&&at.push(e)},zt=e=>{e?.unit!==void 0&&st(e.unit),e?.copy!==void 0&&st(e.copy),Array.isArray(e?.children)&&e.children.forEach(zt)},ct=e=>{st(e?.after),st(e?.before),st(e?.into?.unit)};for(let e of w)st(e?.block?.unit);for(let e of g)st(e?.unit),ct(e?.place),ct(e?.move),zt(e?.insert);k.forEach(st);let St=new Map;for(let e of at){let i=et(e);i.unit&&(St.get(i.unit)??St.set(i.unit,[]).get(i.unit)).push({key:e.key,changed:!!i.changed})}for(let e of St.values())if(!(new Set(e.map(i=>i.key)).size<2))for(let i of e)i.changed&&H.set(i.key,{gone:!0});let kt=new Map,_=new Map,Y=(e,i,o,b={})=>e.set(i,{key:i,status:"conflict",reason:o,...b}),Wt=new Map,Zt=(e,i,o,b)=>{let M=$=>{for(let A=$.unit;A!=null;A=i.units[A]?.parent)if(A===o.id)return!0;return!1};if(!b)return{hash:wt(e,o),theirs:i.blocks.filter(M).map($=>e.slice($.innerStart,$.innerEnd)).join(`
|
|
10
|
-
`)};let E=$=>Object.fromEntries(b.filter(A=>typeof $?.[A]=="string").map(A=>[A,$[A]]));return{theirs:E(Q[o.kind]?.dataOf?.(e,o.node,qt().packages)??{}),parts:E(o.parts)}},Ut=(e,i,o=null,b={})=>{Wt.set(e,{unit:i,held:o}),Y(_,e,"changed",{...Zt(s,p,i,o),...b})},dt=[],Jt=new Map;for(let e of w){let{key:i,block:o}=e??{},b=e?.parts,M=Array.isArray(b)?b.filter(A=>!A?.keep):[];M.some(lt)&&(M.forEach(Pt),b=b.filter(A=>A?.keep||!lt(A)));let E=Yt(o);if(!E.block){E.reason==="missing"&&Array.isArray(b)&&!b.some(A=>A?.keep)&&b.every(lt)?kt.set(i,{key:i,status:"applied"}):Y(kt,i,E.reason);continue}let $=Array.isArray(b)&&b.length===1&&b[0]?.keep&&typeof b[0].html=="string"?b[0].html:null;if(E.changed&&$!==null&&$===u(E.block))kt.set(i,{key:i,status:"applied"});else if(E.changed){let A=$===null?null:hn(o.before,$,u(E.block));if(A===null||ge(E.block,[{keep:!0,html:A}],s)){Y(kt,i,"changed",{theirs:u(E.block)});continue}b=[{keep:!0,html:A}],kt.set(i,{key:i,status:"merged",html:A})}else kt.set(i,{key:i,status:"applied"});Jt.set(E.block.id,i),dt.push({id:E.block.id,parts:b})}let gt=[],_t=new Map,Ht=(e,i)=>_t.set(e,[..._t.get(e)??[],i]),Rt={},oe=e=>{if(e?.into){let b=ie(e.into);return b?{into:b.id}:null}let i=!!e?.after,o=et(i?e.after:e?.before);return o?.unit?{[i?"after":"before"]:o.unit.id}:null},re=null,Nt=e=>{if(e?.unit!==void 0){let b=et(e.unit);return b.unit?{unit:b.unit.id,stood:e.stood}:null}if(e?.restore!==void 0){let{source:b,seal:M}=e.restore??{};if(!I||typeof b!="string"||M!==I(b))return null;let E=Array.isArray(e.children)?e.children.map(Nt):void 0;return E?.includes(null)?null:{restore:b,key:e.key,blockId:e.blockId,stood:e.stood,...E?{type:e.type,children:E}:{}}}if(e?.copy!==void 0){let b=et(e.copy),M=e.keys===void 0?null:Un(e.keys);return e.keys!==void 0&&!M?null:b.unit&&zn.has(b.unit.kind)?{restore:Le(s,b.unit,{keys:M,taken:re??=new Set($e(s))}),key:e.key,blockId:e.blockId}:null}if(!e||typeof e!="object")return null;let i=Q[e.type]?.source;if(i){let b=$=>Le($,{start:0,end:$.length},{taken:re??=new Set($e(s))}),M=Array.isArray(e.children)?e.children.map(Nt):void 0;if(M?.includes(null))return null;let E=i(e,{packages:qt().packages,written:b});return E?{restore:E,key:e.key,blockId:e.blockId,...M?{type:e.type,children:M,boxKeys:e.boxKeys}:{}}:null}let o=Array.isArray(e.children)?e.children.map(Nt):void 0;return o?.includes(null)?null:{...e,...o?{children:o}:{}}},$t=new Set,Lt=e=>[...$t].filter(i=>i!==e&&[e,e.companion].some(o=>o&&o.start<=i.start&&i.end<=o.end)),nt=e=>{if(e?.unit!==void 0){let i=et(e.unit);i.unit&&$t.add(i.unit)}else Array.isArray(e?.children)&&e.children.forEach(nt)};for(let e of g)e?.move?nt({unit:e.unit}):e?.insert&&nt(e.insert);let yt=(e,i)=>{let o=p.boxes.filter(E=>E.unit===e.id),b=new Map(i.map(E=>[et(E).unit,E])),M=p.units.filter(E=>o.some($=>$.id===E.box));return o.every(E=>E.pure)&&M.length>0&&M.every(E=>$t.has(E)||b.has(E)&&!ut(b.get(E),{unit:E}))},Z=new Set,it=e=>{if(e?.unit!==void 0){let i=et(e.unit);i.unit&&Z.add(i.unit)}else Array.isArray(e?.children)&&e.children.forEach(it)},le=[],Mt=new Map;for(let e of g){let i=e?.key;if(e?.insert&<(e.insert)){Pt({...e.insert,key:e.insert.key??i}),_.set(i,{key:i,status:"applied"});continue}if(e?.insert){let B=Nt({...e.insert,key:e.insert.key??i}),F=oe(e.place);if(!B||!F){Y(_,i,!B&&Q[e.insert.type]?.source?Q[e.insert.type].unwritten(e.insert,{packages:qt().packages}):"position");continue}_.set(i,{key:i,status:"applied"}),Ht(i,i),gt.push({id:i,insert:B,place:F}),it(e.insert);continue}let o=et(e?.unit);if(e?.force===!0&&o.gone&&typeof e.hash=="string"&&typeof e.unit.id!="string"){let B=Number.isInteger(e.unit.open)&&e.unit.open>=0?h?.units[e.unit.open]:void 0;o=!h||h.units.some(V=>V!==B&&wt(m,V)===e.hash)?{reason:"ambiguous"}:tt(-1,e.hash,!1,[e.unit.blockId]),o.unit&&!o.unit.blockId&&typeof e.unit.blockId=="string"&&X.set(o.unit.id,e.unit.blockId),H.set(e.unit.key,o)}if(e?.source&&o.gone&&typeof e.unit.id=="string"&&e.parts&&typeof e.parts=="object"){let B=Object.entries(e.parts).filter(([,V])=>typeof V=="string"),F=B.length>0?p.units.filter(V=>V.parts&&!xt.has(V.blockId)&&B.every(([P,R])=>V.parts[P]===R)):[];F.length===1&&(o={unit:F[0]},F[0].blockId||X.set(F[0].id,e.unit.id),H.set(e.unit.key,o),ut(e.unit,o)&&z.add(e.unit.key))}let b=typeof e?.size=="string"||typeof e?.toggle=="string"||typeof e?.attribute=="string",M=e?.remove===!0&&Array.isArray(e.items)&&e.force!==!0&&!!o.unit&&ut(e.unit,o)&&yt(o.unit,e.items);if(e?.remove===!0&&Array.isArray(e.items)&&e.force!==!0&&!M&&(o.gone||o.unit&&ut(e.unit,o))){let B=e.items.map(P=>({ref:P,found:et(P)})),F=B.find(P=>!P.found.unit&&!P.found.gone),V=B.filter(P=>P.found.unit&&!$t.has(P.found.unit));if(F)Y(_,i,F.found.reason);else if(V.some(P=>ut(P.ref,P.found)))o.unit?Ut(i,o.unit):Y(_,i,"changed");else if(V.some(P=>Mt.has(P.found.unit)))Y(_,i,"ambiguous");else{_.set(i,{key:i,status:"applied"});for(let{ref:P,found:R}of V)Mt.set(R.unit,P.key),Ht(R.unit.id,i),gt.push({id:R.unit.id,remove:!0})}continue}if(!o.unit){o.gone&&(e?.remove===!0||b)?_.set(i,{key:i,status:"applied"}):Y(_,i,o.gone?"missing":o.reason);continue}if(e.replace&&se(o.unit,e.replace)){_.set(i,{key:i,status:"applied"});continue}if(e.source){let B=Q[o.unit.kind]?.definition?.(o.unit.node,qt().packages);if(typeof B!="string"||B!==e.definition){Y(_,i,"definition");continue}}if(e.table&&Q[o.unit.kind]?.definition){Y(_,i,"invalid");continue}let E=e.source;if(e.source&&typeof e.source=="object"&&(e.force===!0||ut(e.unit,o))){let B=e.force===!0||!o.changed,F=Et=>B&&Et.every(Ft=>typeof e.parts?.[Ft]=="string"&&e.parts[Ft]===o.unit.parts?.[Ft]),V=Rn(e.source,e.together),P=V.filter(F).flat(),R=V.filter(Et=>!F(Et)).flat();if(R.length>0){if(Ut(i,o.unit,R,P.length>0?{wrote:P}:{}),P.length===0)continue;E=Object.fromEntries(P.map(Et=>[Et,e.source[Et]]))}}else if((e.remove===!0||e.replace||e.table)&&!M&&(e.force===!0?j(o.unit)!==e.hash:ut(e.unit,o))){Ut(i,o.unit);continue}let $=E!==e.source;if(Mt.has(o.unit)&&Mt.get(o.unit)!==e.unit.key){Y(_,i,"ambiguous");continue}Mt.set(o.unit,e.unit.key);let A=null;if(e.remove===!0){A={remove:!0};let{unit:B}=o,F=B.companion?Ye(s,B):mt(s.slice(B.start,B.end),G(s,B.start),"");Rt[i]={source:F,seal:I?I(F):null,...Lt(B).length>0?{around:!0}:{}}}else if(e.move){let B=oe(e.move);if(!B){Y(_,i,"position");continue}A={move:B,stood:e.stood}}else e.replace?A={replace:e.replace}:typeof e.retag=="string"?A={retag:e.retag}:e.table&&typeof e.table=="object"?A={table:e.table}:E&&typeof E=="object"?A={source:E}:typeof e.toggle=="string"?A={toggle:e.toggle,on:e.on}:typeof e.size=="string"?A={size:e.size,value:e.value}:typeof e.attribute=="string"&&(A={attribute:e.attribute,value:e.value});if(!A){Y(_,i,"unknown");continue}$||_.set(i,{key:i,status:"applied"}),Ht(o.unit.id,i),gt.push({id:o.unit.id,...A}),A.move&&Z.add(o.unit),A.remove&&le.push({key:i,unit:o.unit})}for(let{key:e,unit:i}of le)Lt(i).every(o=>Z.has(o))||(Y(_,e,"position"),delete Rt[e],gt.splice(gt.findIndex(o=>o.id===i.id&&o.remove),1));let Ie=[...new Set(k.map(et).filter(e=>e.unit).map(e=>e.unit.id))],D=un({current:s,edits:dt,units:gt,partial:!0,ids:O,touch:Ie,proposals:X}),jt=gn(D.text,new Set((D.ids?.created??[]).map(({id:e})=>e)));D.text=jt.text;for(let e of D.conflicts??[]){e.id!==void 0&&Jt.has(e.id)&&Y(kt,Jt.get(e.id),e.reason);for(let i of _t.get(e.unit)??[])Y(_,i,e.reason),delete Rt[i]}let pt=Ot(D.text),At=new Map,ot=new Map(D.ids.assigned.map(({at:e,id:i})=>[e,i]));for(let[e,i]of H){let o=i.unit?i.unit.blockId??ot.get(i.unit.at):null;o&&At.set(e,o)}for(let[e,{unit:i,held:o}]of Wt){let b=i.blockId??ot.get(i.at),M=b?pt.units.filter(E=>E.blockId===b):[];M.length===1&&_.get(e)?.reason==="changed"&&Object.assign(_.get(e),Zt(D.text,pt,M[0],o))}let ht=new Map([...ne,...D.ids.created].map(({key:e,id:i})=>[e,i])),bt=new Set([...At.values(),...ht.values()]),ae=new Set(pt.units.map(e=>e.blockId).filter(Boolean)),ce=[...bt].filter(e=>!ae.has(e)),Qt=new Map,Tt=new Map,fe=e=>{let o=(Array.isArray(e?.children)?e.children.map(fe).some(Boolean):!1)||[e?.unit,e?.copy].some(b=>b!==void 0&&z.has(b?.key));return e?.key!==void 0&&Tt.set(e.key,o),o};for(let e of g)e?.insert&&fe({...e.insert,key:e.insert.key??e.key});for(let[e,i]of[...At,...[...ht].filter(([o])=>Tt.get(o)!==!0)]){if(z.has(e))continue;let o=pt.units.filter(b=>b.blockId===i);o.length===1&&Qt.set(e,wt(D.text,o[0]))}let Se=g.filter(e=>ve[e?.insert?.type]?.keyed&&typeof e.insert.id=="string"&&_.get(e.key)?.status==="applied").map(e=>({key:e.insert.id,box:ve[e.insert.type].box}));return{text:D.text,version:pe(D.text),texts:[...kt.values()],units:[..._.values()],ids:Object.fromEntries(At),made:Object.fromEntries(ht),hashes:Object.fromEntries(Qt),removed:Rt,gone:ce,file:Vn(D.text,pt,bt,new Set(ht.values())),outside:Dn(D.text,pt),keyed:Fn(D.text,pt,Se),...Object.keys(jt.keys).length>0?{chartKeys:jt.keys}:{},...D.title?{title:D.title}:{},...D.icon!==void 0?{icon:D.icon}:{}}}function Rn(s,m){let w=[];for(let g of[...Array.isArray(m)?m:[],...Object.keys(s).map(k=>[k])]){let k=Array.isArray(g)?g.filter(I=>typeof I=="string"&&Object.hasOwn(s,I)):[],O=w.filter(I=>k.some(a=>I.includes(a)));if(k.length!==0){for(let I of O)w.splice(w.indexOf(I),1);w.push([...new Set([...O.flat(),...k])])}}return w}function Fn(s,m,w){let g={};for(let{key:k,box:O}of w){let I=m.boxes.find(a=>a.kind===O&&a.key===k);I&&(g[k]={units:m.units.filter(a=>a.box===I.id).map(a=>a.blockId??{hash:wt(s,a)})})}return g}function Dn(s,m){let w={};for(let g of m.blocks){let k=g.unit===null?_n(g.kind==="title",bn(g.node,"id")):null;k&&(w[k]=s.slice(g.innerStart,g.innerEnd))}return w}function Vn(s,m,w,g){let k=new Map;for(let a of m.units)a.blockId&&k.set(a.blockId,(k.get(a.blockId)??0)+1);let O=a=>{for(let p=a.parent;p!=null;p=m.units[p].parent)if(g.has(m.units[p].blockId))return!0;return!1},I={};for(let a of m.units){if(!a.blockId||k.get(a.blockId)!==1||!(w.has(a.blockId)||O(a)))continue;let p=a.parent===null?null:m.units[a.parent];I[a.blockId]={kind:a.kind,hash:wt(s,a),keep:a.keep??null,...a.grid?{grid:!0}:{},...a.parts?{parts:a.parts}:{},parent:p?p.blockId??"":null,boxes:m.boxes.filter(h=>h.unit===a.id).map(h=>({kind:h.kind,key:h.key,units:m.units.filter(u=>u.box===h.id).map(u=>u.blockId??{hash:wt(s,u)})})),blocks:m.blocks.filter(h=>h.unit===a.id).map(h=>({...h.self!==null?{self:!0}:{path:h.path},kind:h.kind,caps:Object.keys(h.caps),inner:s.slice(h.innerStart,h.innerEnd),...h.atoms.length>0?{atoms:h.atoms}:{}})),...Q[a.kind]?.definition&&(g.has(a.blockId)||O(a))?{markup:s.slice(a.elStart,a.end)}:{}}}return I}function Vs({current:s,units:m=[]}){let w=Ot(s),g=[];for(let k of m){if(typeof k?.id!="string"||typeof k.key!="string"&&typeof k.key!="number")continue;let O=w.units.filter(a=>a.blockId===k.id);if(O.length===0){g.push({key:k.key,gone:!0});continue}if(O.length>1||k.from===void 0||k.from===k.parent||k.from===""||k.parent==="")continue;(O[0].parent===null?null:w.units[O[0].parent].blockId??"")===k.from&&g.push({key:k.key,moved:!0})}return g}function Gs({current:s,instances:m=[],pageIds:w=null}){let g=Ot(s),k=new Set(Array.isArray(w)?w.filter(I=>typeof I=="string"):[]),O=[];for(let I of m){if(typeof I?.id!="string"||typeof I.key!="string"&&typeof I.key!="number"||!I.parts||typeof I.parts!="object")continue;let a=j=>Object.entries(I.parts).filter(([H,z])=>typeof j.parts?.[H]=="string"&&j.parts[H]!==z?.after&&Array.isArray(z?.before)&&z.before.includes(j.parts[H])),p=g.units.filter(j=>j.blockId===I.id),h=p.length===0?g.units.filter(j=>j.parts&&!k.has(j.blockId)&&a(j).length>0):[],u=p.length===1?p[0]:h.length===1?h[0]:null,L=u?a(u):[];L.length>0&&O.push({key:I.key,parts:Object.fromEntries(L.map(([j])=>[j,u.parts[j]])),markup:s.slice(u.elStart,u.end)})}return O}function Ys({current:s,opening:m=null,texts:w=[],pageIds:g=null}){let k=w.filter(u=>typeof u?.block?.before=="string"&&typeof u.original=="string").map(u=>({entry:u,was:new Set([u.original,...Array.isArray(u.earlier)?u.earlier.filter(L=>typeof L=="string"):[]].filter(L=>L!==u.block.before))})).filter(({was:u})=>u.size>0),O=u=>Hn({current:s,opening:m,ids:!1,pageIds:g,texts:u.map(({entry:{key:L,block:j}})=>({key:L,block:j,parts:[{keep:!0,html:j.before}]}))}).texts,I=O(k),a=new Set(I.filter(u=>u.reason==="overlap").map(u=>u.key)),p=[...I.filter(u=>!a.has(u.key)),...k.filter(({entry:u})=>a.has(u.key)).flatMap(u=>O([u]))],h=new Map(k.map(({entry:u,was:L})=>[u.key,L]));return p.filter(u=>u.status==="merged"&&h.get(u.key)?.has(u.html)).map(({key:u,html:L})=>({key:u,theirs:L}))}export{un as a,bs as b,mn as c,Hn as d,Vs as e,Gs as f,Ys as g};
|
package/dist/chunk-UALRNVSE.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
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 u}from"./chunk-UMHUSOPJ.mjs";import l from"node:fs/promises";import p from"node:path";import{escapeMarkup as b}from"../browser/shared/escape.mjs";import{sha256 as g}from"../browser/shared/files.mjs";import{reportsDirectory as E,starterDirectory as y}from"../browser/shared/paths.mjs";import{listReportSlugs as T,slugPattern as S}from"../browser/shared/reports.mjs";import{documentDirectory as N,documentFiles as $,layoutOf as O,slugTaken as j}from"../browser/shared/workspace.mjs";async function v(t,c){if(!S.test(t))throw new Error(`A document's folder name must be lowercase kebab-case: ${t}`);let s=N(t,c),{html:r,json:n}=$(s),[m,o]=[p.basename(r),p.basename(n)],e,f;try{[e,f]=await Promise.all([l.readFile(r),l.readFile(n,"utf8")])}catch(a){if(a.code!=="ENOENT")throw a;let h=await l.stat(s).then(()=>!0,()=>!1);throw new Error(h?`${s} needs both ${m} and ${o}.`:`${s} does not exist.`)}let i;try{i=JSON.parse(f)}catch(a){throw new Error(`${o} is not valid JSON: ${a.message}`)}for(let a of["title","description","type"])if(typeof i[a]!="string"||i[a].trim()==="")throw new Error(`${o} is missing a non-empty ${a}.`);if(i.source!==void 0&&typeof i.source!="string")throw new Error(`${o} source must be a string when given.`);return{slug:t,directory:s,htmlPath:r,metadataPath:n,html:e.toString("utf8"),fileSha256:g(e),metadata:i}}async function z(t=[],{directory:c=E,prepare:s=null}={}){let r=t.length>0?[...new Set(t)]:await T(c);if(r.length===0)throw new Error(`No documents in ${p.resolve(c)} yet: gallery new <slug> "<title>" makes one.`);let n=[],m=new Map;for(let o of r)try{let e=await v(o,c);s&&([e.written,e.html]=[u(e.html),s(e)]),n.push(e)}catch(e){m.set(o,[e.message])}return{reports:n,failures:m}}var F=/^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$/,P=/\n[ \t]*<!-- Starter content:[^\n]*-->\n[ \t]*<section\b[^>]*\sdata-doc-placeholder\b[\s\S]*?<\/section>/;async function M(t,c,s,{directory:r=E,blank:n=!1,lang:m=null,page:o=!1}={}){if(!S.test(t))throw new Error("Slug must be lowercase kebab-case.");if(j(t,r))throw Object.assign(new Error(`"${t}" is taken in ${p.resolve(r)}`),{code:"EEXIST"});let e=o?O(r).pages:p.resolve(r),f=p.join(e,t),{html:i,metadata:a}=await R(t,c,s,{blank:n,lang:m});await l.mkdir(e,{recursive:!0}),await l.mkdir(f,{recursive:!1});let h=$(f);return await Promise.all([l.writeFile(h.html,i),l.writeFile(h.json,`${JSON.stringify(a,null,2)}
|
|
3
|
-
`)]),{slug:t,directory:f,metadata:a}}async function R(t,c,s,{blank:r=!1,lang:n=null}={}){let m=w=>b(w).replaceAll("'","'"),[o,e]=await Promise.all([l.readFile(p.join(y,"doc.html"),"utf8"),l.readFile(p.join(y,"doc.json"),"utf8")]),f={...JSON.parse(e),title:c,description:s},i=r?o.replace(P,`
|
|
4
|
-
<p></p>`):o;if(r&&i===o)throw new Error("The starter's placeholder section was not found.");let a=typeof n=="string"&&F.test(n)?i.replace(/(<html\b[^>]*\slang=")[^"]*"/,(w,d)=>`${d}${n}"`):i,h={SLUG:t,TITLE:m(c)};return{html:a.replace(/__REPORT_(SLUG|TITLE)__/g,(w,d)=>h[d]),metadata:f}}export{z as a,M as b,R as c};
|
package/dist/chunk-V3HXVQEM.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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 $,b as y,c as k,d as x}from"./chunk-S6O4UHLC.mjs";import{a as F,b as h}from"./chunk-TX6JH7TR.mjs";import{b as j,f as D,h as N}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import S from"node:fs/promises";import{iconKind as I}from"../browser/shared/emoji/icon-value.mjs";import{descendantsIn as O,parentIn as P}from"../browser/shared/outline.mjs";import{fullAddress as T,namedPlace as A}from"../browser/shared/page-address.mjs";import{reportsDirectory as L}from"../browser/shared/paths.mjs";import{documentLinks as R,listReportSlugs as v,roleOf as C}from"../browser/shared/reports.mjs";import{documentDirectory as E,documentFiles as H,isSlugName as J}from"../browser/shared/workspace.mjs";import{findIn as K,rankReports as U,reportLines as Y}from"../browser/shared/search.mjs";async function q(){let i=(await v(L)).filter(J);return(await Promise.all(i.map(async e=>{let l=E(e,L),{html:c,json:a}=H(l),o=await S.stat(c).catch(()=>null);if(!o?.isFile()||await C(l)==="instructions")return null;let r=await S.readFile(a,"utf8").then(JSON.parse).catch(()=>({})),t=n=>typeof n=="string"?n.replace(/\s+/g," ").trim():"";return{slug:e,title:t(r.title)||e,description:t(r.description),edited:o.mtimeMs,file:c}}))).filter(Boolean)}var M=i=>{let s=new Date(i),e=l=>String(l).padStart(2,"0");return`${s.getFullYear()}-${e(s.getMonth()+1)}-${e(s.getDate())} ${e(s.getHours())}:${e(s.getMinutes())}`},p=i=>`${i} document${i===1?"":"s"}`;async function z(i,s,e){let l=[...new Set(e.toLowerCase().split(/\s+/).filter(Boolean))],c=new Set(s.map(({slug:o})=>o));return(await Promise.all(i.filter(({slug:o})=>!c.has(o)).map(async o=>{let r=Y(await S.readFile(o.file,"utf8").catch(()=>"")),t=l.map(n=>K(r,n,{most:1})).filter(({count:n})=>n>0);return t.length?{...o,words:t.length,count:t.reduce((n,{count:f})=>n+f,0),hit:t[0].hits[0].text}:null}))).filter(Boolean).sort((o,r)=>r.words-o.words||r.count-o.count||r.edited-o.edited)}async function G(i,s){if(i.length>1)throw new j("--tree takes one document at most (its slug, link or address).");let e=await $(),l=new Map(s.map(t=>[t.slug,t])),c=e.children[""]??[],a=null;if(i.length===1){let t=await x(i[0],"--tree",e);if(t.refused){for(let n of await h())console.log(n);console.error(t.refused),process.exit(1)}a=t.slug,c=[a]}for(let t of await h())console.log(t);let o=Object.values(e.children).flat().length;if(o===0)return void console.log('No documents yet: gallery new <slug> "<title>" makes one.');if(a===null)console.log(`${p(o)}, as the sidebar shows them (one under another indented):`);else{let t=O(e.children,a).length;console.log(k(e,a)),console.log(t?`${y(e,a)} and the ${p(t)} under it, as the sidebar shows them:`:`${y(e,a)}, with no document under it:`)}let r=(t,n)=>{let{title:f,description:u,icon:d}=e.documents.get(t),g=l.get(t)?.edited,m=[...u?[`\u8BF4\u660E\uFF1A${u}`]:[],...g?[`\u4E0A\u6B21\u7F16\u8F91\uFF1A${M(g)}`]:[]];console.log(`${" ".repeat(n)}${t} ${I(d)==="emoji"?`${d} `:""}${f}${m.length?` \uFF08${m.join("\uFF1B")}\uFF09`:""}`);for(let w of e.children[t]??[])r(w,n+1)};for(let t of c)r(t,0)}async function lt(i){let{positional:s,options:e}=D({options:["--tree"],argv:i}),l=await q();if(e.has("--tree"))return G(s,l);let c=s.join(" ").trim(),{links:a}=await R(),o=s.length===1?A(s[0],a):null,r=o&&o.slug!==s[0],t=r?l.filter(({slug:d})=>d===o.slug):U(l,c),n=[...t,...c&&!r?await z(l,t,c):[]],f=s.length===1&&n.length===0?await N(s[0]):null,u=n.length?await $():null;for(let d of await h())console.log(d);if(f)console.log(f);else if(l.length===0)console.log('No documents yet: gallery new <slug> "<title>" makes one.');else if(n.length===0)console.log(`No document's title, description, slug or text holds ${c.split(/\s+/).map(d=>`"${d}"`).join(" or ")}: gallery list lists all ${l.length}.`);else{console.log(c?`${n.length} of ${p(l.length)}, the best match first:`:`${p(l.length)}, the one edited last first:`);for(let{slug:d,title:g,description:m,edited:w,file:B,hit:b}of n)console.log(`${d} ${g}`),m&&console.log(` \u8BF4\u660E\uFF1A${m}`),b&&console.log(` \u6B63\u6587\uFF1A${b}`),P(u.children,d)&&console.log(` ${k(u,d)}`),console.log(` \u5730\u5740\uFF1A${T("",{slug:d},a)}`),console.log(` \u4E0A\u6B21\u7F16\u8F91\uFF1A${M(w)}`),console.log(` ${F(B)}`)}}export{lt as run};
|
package/dist/chunk-V5VXUJKG.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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}from"./chunk-SYGN7GLU.mjs";import"./chunk-FDLXYYG4.mjs";import"./chunk-4FS7Z7WR.mjs";import"./chunk-6RGJOMJP.mjs";import"./chunk-QJIR2BLP.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-E7LWZRXY.mjs";import"./chunk-NSKUTQ5J.mjs";import"./chunk-AUZGSZJH.mjs";import"./chunk-BGGDRNYQ.mjs";import"./chunk-6QXGZM36.mjs";import"./chunk-UALRNVSE.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TYK6VNAB.mjs";import"./chunk-CY2FNNAB.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-L3QKH4OK.mjs";import"./chunk-W4VKN3GF.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as noDocuments,b as run};
|
package/dist/chunk-VBXMADMP.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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}from"./chunk-NO5NJCHO.mjs";import"./chunk-S6O4UHLC.mjs";import"./chunk-TX6JH7TR.mjs";import"./chunk-5ZKJ3H4P.mjs";import"./chunk-NSKUTQ5J.mjs";import"./chunk-UALRNVSE.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as DEFAULT_DESCRIPTION,c as run,b as slugRefused};
|
package/dist/chunk-VNV55RUA.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q}from"./chunk-AUZGSZJH.mjs";import"./chunk-BGGDRNYQ.mjs";import"./chunk-6QXGZM36.mjs";import"./chunk-UALRNVSE.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-W4VKN3GF.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{h as buildReports,d as checkReports,f as checkSelectedReports,b as exportFailures,k as exportReports,p as failureSummary,e as handInBlockers,l as notesByKind,m as notesOf,j as offlineReports,o as printFailures,c as quickFailures,a as repeatedIdFailures,q as reportFailures,n as reportNotes,i as withExportPolicy,g as writeSharedAssets};
|
package/dist/chunk-VPD2PS35.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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-EZQ34M3F.mjs";import"./chunk-NQPVAU63.mjs";import"./chunk-DFUDV4LX.mjs";import"./chunk-Y6RLRPG3.mjs";import"./chunk-6RGJOMJP.mjs";import"./chunk-QJIR2BLP.mjs";import"./chunk-QUPLVPB2.mjs";import"./chunk-LAE5NQ4B.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-E7LWZRXY.mjs";import"./chunk-AUZGSZJH.mjs";import"./chunk-BGGDRNYQ.mjs";import"./chunk-6QXGZM36.mjs";import"./chunk-UALRNVSE.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TYK6VNAB.mjs";import"./chunk-CY2FNNAB.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-L3QKH4OK.mjs";import"./chunk-W4VKN3GF.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as startProductionServer};
|
package/dist/chunk-W4VKN3GF.mjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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 z,c as L,e as ct}from"./chunk-A55HN5OK.mjs";ct();import{isUtf8 as lt}from"node:buffer";import{createHash as dt}from"node:crypto";import{lstatSync as pt,readFileSync as $,realpathSync as P,statSync as mt}from"node:fs";import ft from"node:fs/promises";import b from"node:path";import{isInstance as ut,parseCompound as gt,parsePart as ht,parseSelector as bt,partOf as wt}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as J,NO_TEXT as yt,PACKAGE_ID as Z,PACKAGE_MARK as kt,SLOT as C,instanceMatch as Et,refusedInCopy as Ot,settingState as St}from"../browser/shared/components/installed.mjs";import{writeAtomic as $t}from"../browser/shared/files.mjs";import{attr as At,walk as vt}from"../browser/shared/html-tree.mjs";import{inLanguage as xt,refusal as H,said as o,saying as Nt,told as Tt}from"../browser/shared/i18n/index.mjs";import{DEVICE_NAMES as It,PACKAGE_MANIFEST as y,WORKSPACE_MARK as jt,findWorkspace as _t,layoutOf as Y,markerOf as Mt,packageFolders as zt}from"../browser/shared/workspace.mjs";var F=1,R=new Set(["code","state","sheets","tokens","dialogs","katex-styles","katex","katex-auto-render","math","d3","charts","tables"]),Lt=["id","apiVersion","version","name","description","words","parts","runtime","assets","markdown","schema"],Pt=["at","edit","optional","min","max"],Ct=["generated","attrs"],Ft=["text","data","flow","none"],Rt=/^[a-z][a-z0-9-]*$/,Dt=t=>`div[${C}="${t}"], section[${C}="${t}"]`,Vt=t=>Object.fromEntries(Object.entries(t).map(([e,s])=>[e,s.edit==="flow"?{...s,at:Dt(e)}:s])),Kt=["parts","text"],q=["kit.js","style.css","preview.svg"],E="template.html",Wt=[y,E,...q],A=t=>[...new Set([...Wt,...t])].sort(),Gt=/^(?:[A-Za-z0-9_-][A-Za-z0-9._-]*\/)*[A-Za-z0-9_-][A-Za-z0-9._-]*\.[A-Za-z0-9]+$/,Ut=/^(?:doc-|data-doc-|data-ge-)|^data-block-id$/i,D=256*1024,u=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),f=t=>typeof t=="string"&&t.trim()!=="",v=(t,e)=>t.id<e.id?-1:1,i=t=>{throw H(t)},g=t=>{let e=dt("sha256");return t(e),e.digest("hex").slice(0,16)};function w(t,e){let s=b.join(t,e);try{let n=pt(s,{throwIfNoEntry:!1});if(!n)return null;if(!n.isSymbolicLink()&&!e.includes("/"))return s;let r=P.native(s);return r.startsWith(P.native(t)+b.sep)?r:null}catch{return null}}function X(t,e){try{let s=w(t,e);return s&&$(s)}catch{return null}}var V=new Map,Bt=2e3;function Jt(t){let{size:e,mtimeMs:s}=mt(t),n=V.get(t);if(n?.size===e&&n.time===s)return n.digest;let r=g(c=>c.update($(t)));return Date.now()-s>Bt&&V.set(t,{size:e,time:s,digest:r}),r}var x=(t,e)=>g(s=>{for(let n of e){let r=w(t,n),c="none";try{r&&(c=Jt(r))}catch{}s.update(`${n}\0${c}
|
|
3
|
-
`)}}),Q=t=>t.toString("utf8").replace(/^\uFEFF/,""),tt=(t,e)=>{t.length>D&&i(o("{0} \u6709 {1} KB\uFF0C\u800C\u6BCF\u4E00\u9875\u90FD\u5E26\u7740\u5B83\uFF0C\u6700\u591A {2} KB",e,Math.ceil(t.length/1024),D/1024))},N=(t,e,s="")=>{for(let n of Object.keys(t))e.includes(n)||i(o("{0} \u4E0D\u662F\u7EC4\u4EF6\u5305\u80FD\u5199\u7684\u5B57\u6BB5",`${s}${n}`))},K=(t,e)=>{for(let s of e)t[s]===void 0&&i(o("\u7F3A\u5C11 {0}",s))},W=(t,e)=>{(!u(t)||!f(t.zh)||!f(t.en)||Object.keys(t).length!==2)&&i(o("{0} \u8981\u5199\u6210 { zh, en } \u4E24\u79CD\u8BED\u8A00\u7684\u6587\u5B57",e))},Zt=t=>t.split(",").map(e=>e.split(">").at(-1).trim()).filter(e=>e!=="*").map(e=>gt(e).tag);function Ht(t,e){let s=`parts.${t}`;if(u(e)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868",s)),N(e,Pt,`${s}.`),e.edit==="flow"){Rt.test(t)||i(o("{0} \u662F\u63D2\u69FD\uFF0C\u540D\u5B57\u53EA\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",s)),e.at!==void 0&&i(o('{0} \u662F\u63D2\u69FD\uFF0C\u7531 data-doc-slot="{1}" \u6807\u51FA\uFF0C\u4E0D\u5199 at',s,t)),(e.min!==void 0||e.max!==void 0)&&i(o("{0} \u662F\u63D2\u69FD\uFF0C\u4E00\u4E2A\u5B9E\u4F8B\u91CC\u53EA\u6709\u4E00\u4E2A\uFF0C\u4E0D\u5199 min\u3001max",s)),e.optional!==void 0&&typeof e.optional!="boolean"&&i(o("{0} \u8981\u5199\u6210 true \u6216 false",`${s}.optional`));return}f(e.at)||i(o("\u7F3A\u5C11 {0}",`${s}.at`));try{ht(e.at)}catch(n){i(o("{0} \u5199\u9519\u4E86\uFF1A{1}",`${s}.at`,n.message))}Ft.includes(e.edit)||i(o("{0} \u7684 edit \u53EA\u80FD\u662F text\u3001data\u3001flow \u6216 none",s)),e.optional!==void 0&&typeof e.optional!="boolean"&&i(o("{0} \u8981\u5199\u6210 true \u6216 false",`${s}.optional`));for(let n of["min","max"])e[n]!==void 0&&!(Number.isInteger(e[n])&&e[n]>=0)&&i(o("{0} \u8981\u5199\u6210\u4E0D\u5C0F\u4E8E 0 \u7684\u6574\u6570",`${s}.${n}`));if(e.min>e.max&&i(o("{0} \u7684 min \u6BD4 max \u5927\uFF0C\u6CA1\u6709\u5B9E\u4F8B\u80FD\u6EE1\u8DB3",s)),e.edit==="text")for(let n of Zt(e.at))yt.has(n)&&i(o("{0} \u4E0D\u80FD\u6309\u6587\u5B57\u7F16\u8F91\uFF1A<{1}> \u4E0D\u662F\u80FD\u6253\u5B57\u7684\u6587\u5B57",s,n))}var Yt=t=>t.split(",").some(e=>e.split(">").every(s=>[":scope","*"].includes(s.trim())));function qt(t,e){if(t===void 0)return null;u(t)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","runtime")),N(t,Ct,"runtime.");let s=`[${J}="${e}"]`,n=(l,d)=>{try{if(!f(l))throw new Error("no selector");bt(l)}catch(p){i(o("{0} \u5199\u9519\u4E86\uFF1A{1}",d,p.message))}return l.split(",").map(p=>p.trim().startsWith(":scope")?p.trim().replace(":scope",s):`${s} ${p.trim()}`).join(", ")},{generated:r=[],attrs:c={}}=t;Array.isArray(r)||i(o("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","runtime.generated")),u(c)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","runtime.attrs"));for(let l of Object.values(c)){(!Array.isArray(l)||!l.every(f))&&i(o("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","runtime.attrs"));for(let d of l)Ut.test(d)&&i(o("{0} \u662F Gallery \u81EA\u5DF1\u7684\u540D\u5B57\uFF0C\u7EC4\u4EF6\u5305\u4E0D\u80FD\u7528",d))}let a=l=>{let d=n(l,"runtime.generated");return Yt(l)&&i(o("{0} \u7684 {1} \u662F\u6574\u4E2A\u5B9E\u4F8B\uFF0C\u800C\u8FD9\u91CC\u53EA\u5199\u5B83\u751F\u6210\u7684\u8282\u70B9","runtime.generated",l)),d};return{generated:r.map(a),attrs:Object.fromEntries(Object.entries(c).map(([l,d])=>[n(l,"runtime.attrs"),d]))}}function Xt(t,e){if(t===void 0)return{kit:[],own:[]};(!Array.isArray(t)||!t.every(f))&&i(o("{0} \u8981\u5199\u6210\u4E00\u4E32\u6587\u5B57","assets"));let s=t.filter(n=>!R.has(n));for(let n of s)Gt.test(n)||i(o("assets \u91CC\u7684 {0} \u65E2\u4E0D\u662F\u5957\u4EF6\u7684\u8D44\u6E90\uFF0C\u4E5F\u4E0D\u662F\u5305\u91CC\u7684\u6587\u4EF6",n)),w(e,n)||i(o("assets \u5199\u4E86 {0}\uFF0C\u5305\u91CC\u6CA1\u6709\u8FD9\u4E2A\u6587\u4EF6",n));return{kit:t.filter(n=>R.has(n)),own:s}}function Qt(t,e,s){let n;try{n=JSON.parse(s)}catch(d){i(o("component.json \u4E0D\u662F JSON\uFF1A{0}",d.message))}u(n)||i(o("component.json \u5199\u7684\u4E0D\u662F\u4E00\u4E2A\u5BF9\u8C61")),Z.test(t)||i(o("{0} \u4E0D\u80FD\u505A\u7EC4\u4EF6\u5305\u7684 id\uFF1A\u8303\u56F4\u548C\u540D\u5B57\u90FD\u53EA\u7528\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26",t));for(let d of t.split("/"))It.has(d)&&i(o("{0} \u4E0D\u80FD\u505A\u7EC4\u4EF6\u5305\u7684 id\uFF1A{1} \u662F Windows \u7559\u7ED9\u8BBE\u5907\u7684\u540D\u5B57",t,d));if(n.id!==t&&i(o("\u6E05\u5355\u7684 id \u662F {0}\uFF0C\u548C\u5B83\u7684\u6587\u4EF6\u5939 {1} \u4E0D\u4E00\u6837",String(n.id),t)),K(n,["apiVersion"]),(!Number.isInteger(n.apiVersion)||n.apiVersion<1)&&i(o("apiVersion \u8981\u5199\u6210\u4E00\u4E2A\u6B63\u6574\u6570")),n.apiVersion!==F)throw H(o("\u8FD9\u4E2A\u7EC4\u4EF6\u5305\u8981 apiVersion {0}\uFF0C\u8FD9\u4E00\u7248 Gallery \u53EA\u652F\u6301 {1}",n.apiVersion,F),{disabled:!0,version:f(n.version)?n.version:null});N(n,Lt),K(n,["version","name","description","parts"]),f(n.version)||i(o("{0} \u8981\u5199\u6210\u6587\u5B57","version")),W(n.name,"name"),W(n.description,"description"),n.words!==void 0&&typeof n.words!="string"&&i(o("{0} \u8981\u5199\u6210\u6587\u5B57","words")),u(n.parts)||i(o("{0} \u8981\u5199\u6210\u4E00\u5F20\u8868","parts"));for(let[d,p]of Object.entries(n.parts))Ht(d,p);let r=qt(n.runtime,t),{kit:c,own:a}=Xt(n.assets,e);n.markdown!==void 0&&!Kt.includes(n.markdown)&&i(o("markdown \u53EA\u80FD\u662F parts \u6216 text")),n.schema!==void 0&&!(Number.isInteger(n.schema)&&n.schema>=1)&&i(o("schema \u8981\u5199\u6210\u4E00\u4E2A\u6B63\u6574\u6570"));let l=X(e,E);return l&&tt(l,E),{id:t,match:Et(t),parts:Vt(n.parts),...r?{runtime:r}:{},...n.schema!==void 0?{schema:n.schema}:{},apiVersion:n.apiVersion,version:n.version,name:n.name,description:n.description,words:n.words??"",assets:c,markdown:n.markdown??"parts",files:[...new Set([...q.filter(d=>w(e,d)),...a])],template:l&&Q(l),folder:e,definition:g(d=>d.update(s)),stamp:x(e,A(a))}}function te(t,e){try{let s=X(e,y);return s||i(o("\u8BFB\u4E0D\u51FA component.json")),lt(s)||i(o("{0} \u4E0D\u662F UTF-8 \u7F16\u7801\uFF1A\u8BF7\u5B58\u6210 UTF-8",y)),tt(s,y),Qt(t,e,Q(s))}catch(s){let n=Nt(s),r=g(c=>c.update(`${x(e,A([]))} ${JSON.stringify(n)}`));return{id:t.toLowerCase(),stamp:r,problem:n,disabled:s.disabled===!0,version:s.version??null}}}var T=()=>_t().root,ee=/^[a-z0-9][a-z0-9-]*(?:\/[a-z0-9][a-z0-9-]*)?$/,G=(t,e)=>[...new Set(Array.isArray(t)?t.filter(s=>typeof s=="string"&&e.test(s)):[])],I=t=>({hidden:G(t?.components?.hidden,ee),disabled:G(t?.components?.disabled,Z)}),j=o("gallery.json \u8BFB\u4E0D\u51FA\u6765\uFF1A\u6539\u597D\u8FD9\u4E2A\u6587\u4EF6\u540E\u518D\u8BD5"),ne=o("gallery.json \u4E0D\u662F Gallery \u7684\u6587\u4EF6");function O(t){if(t===null)return{value:null};let{value:e,ours:s,reads:n}=Mt(t);return s?{value:e}:{problem:n?ne:j}}function se(t){try{return O($(Y(t).marker,"utf8"))}catch(e){return e.code==="ENOENT"?O(null):{problem:j}}}var oe=["EPERM","EACCES","EBUSY","EROFS"];async function Ae(t,{id:e,hidden:s,disabled:n}){let r=Y(t).marker,c=await ft.readFile(r,"utf8").catch(m=>{if(m.code==="ENOENT")return null;i(j)}),{value:a,problem:l}=O(c);l&&i(l);let d=(m,M)=>M===void 0?m:M?[...new Set([...m,e])]:m.filter(at=>at!==e),{hidden:p,disabled:rt}=I(a),it={...u(a?.components)?a.components:{},hidden:d(p,s),disabled:d(rt,n)};await $t(r,`${JSON.stringify({...a??jt,components:it},null,2)}
|
|
4
|
-
`,{expect:c}).catch(m=>{throw oe.includes(m.code)&&i(o("gallery.json \u5199\u4E0D\u8FDB\u53BB\uFF1A\u53EF\u80FD\u662F\u53EA\u8BFB\u7684\uFF0C\u6216\u88AB\u522B\u7684\u7A0B\u5E8F\u5360\u7740")),m})||i(o("gallery.json \u521A\u521A\u88AB\u6539\u8FC7\uFF1A\u518D\u8BD5\u4E00\u6B21"))}var re=t=>({...t,off:!0,disabled:!0,problem:o("\u5728\u8BBE\u7F6E\u91CC\u505C\u7528\u4E86"),stamp:g(e=>e.update(`${t.stamp} off`))}),k=I(null),ie=({packages:t,problems:e,settings:s=k})=>g(n=>{for(let{id:r,stamp:c}of[...t.values(),...e.values()].sort(v))n.update(`${r} ${c}
|
|
5
|
-
`);n.update(`hidden ${[...s.hidden].sort().join(" ")}
|
|
6
|
-
`),n.update(`settings ${s.problem?.message??""}
|
|
7
|
-
`)});function ae(t,e){let{value:s,problem:n}=se(t);return n?{hidden:e.hidden,disabled:e.disabled,problem:n}:I(s)}function ce(t=T(),e=k,{on:s=null}={}){let n=ae(t,e),r=new Map,c=new Map;for(let{id:a,folder:l}of zt(t)){let d=te(a,l);(d.problem?c:r).set(d.id,d)}for(let a of r.keys())c.delete(a);for(let a of n.disabled)!r.has(a)||a===s||(c.set(a,re(r.get(a))),r.delete(a));return{packages:r,problems:c,settings:n,stamp:ie({packages:r,problems:c,settings:n})}}var h=new Map;function ve(t=T()){let e=b.resolve(t);return h.has(e)||h.set(e,ce(e)),h.get(e)}var xe=(t,e)=>{h.set(b.resolve(t),e)},Ne=(t=T())=>{h.delete(b.resolve(t))},U=(t,e)=>xt(t,()=>Tt(e)),_=t=>({zh:U("zh",t),en:U("en",t)}),Te=({settings:t})=>t.problem?_(t.problem):null,et=(t,e)=>t.problem?t.disabled?"disabled":"broken":St(t.id,e),nt=({id:t,match:e,parts:s,runtime:n,schema:r})=>({id:t,match:e,parts:s,...n?{runtime:n}:{},...r!==void 0?{schema:r}:{}}),Ie=({packages:t,problems:e})=>[...[...t.values()].map(nt),...[...e.values()].map(({id:s,problem:n})=>({id:s,problem:_(n)}))],le=t=>`DocKit.describe(${JSON.stringify(t)});`.replace(/</g,"\\u003c"),S=({id:t,stamp:e},s)=>`/__gallery/components/${t}/${s}?v=${e}`;function de(t){let e=`${kt}="${t.id}"`,s=n=>t.files.includes(n);return{styles:s("style.css")?[`<link rel="stylesheet" href="${S(t,"style.css")}" ${e}>`]:[],scripts:[`<script ${e}>${le({...nt(t),...s("kit.js")?{script:!0}:{}})}</script>`,...s("kit.js")?[`<script src="${S(t,"kit.js")}" ${e}></script>`]:[]]}}var je=({folder:t},e)=>w(t,e),_e=({folder:t,files:e})=>x(t,A(e));function B(t,e){let s=L(t,{sourceCodeLocationInfo:!0}).childNodes.filter(r=>r.tagName||r.nodeName==="#text"&&r.value.trim()),[n]=s;return s.length===1&&n.tagName&&ut(n)&&At(n,J)===e&&n.sourceCodeLocation.endTag?n:null}function pe(t,e){let s=B(t,e),n=s&&z(s),r=n&&B(n,e);return r?{markup:n,root:r}:null}function st({id:t,template:e,parts:s}){if(!e)return{};let n=pe(e,t);if(!n)return{problem:o("template.html \u8981\u662F\u8FD9\u4E2A\u7EC4\u4EF6\u5305\u7684\u4E00\u4E2A\u5B9E\u4F8B\uFF0C\u6709\u81EA\u5DF1\u7684\u7ED3\u675F\u6807\u7B7E\uFF0C\u6B64\u5916\u4EC0\u4E48\u90FD\u6CA1\u6709")};let r=[];if(vt({childNodes:[n.root]},a=>{Ot(a.tagName,a.attrs)&&r.push(a.tagName)}),r.length>0)return{problem:o("template.html \u91CC\u7684 <{0}> \u8FDB\u4E0D\u4E86\u65B0\u5EFA\u7684\u5757\uFF1A\u811A\u672C\u3001\u4E8B\u4EF6\u3001\u6837\u5F0F\u548C Gallery \u81EA\u5DF1\u7684\u6807\u8BB0\u90FD\u4E0D\u5199\u5728\u6A21\u677F\u91CC",r[0])};let c=Object.entries(s).find(([,a])=>{let l=wt(n.root,a.at).length;return l<(a.optional?0:a.min??1)||l>(a.edit==="flow"?1:a.max??1/0)});return c?{problem:o("template.html \u7684 {0} \u548C\u6E05\u5355\u5199\u7684\u6570\u76EE\u4E0D\u7B26",c[0])}:{markup:n.markup}}var Me=t=>st(t).problem??null,ot=t=>st(t).markup??null,ze=({packages:t,settings:e=k})=>[...t.values()].sort(v).map(s=>({id:s.id,version:s.version,name:s.name,description:s.description,words:s.words,definition:s.definition,stamp:s.stamp,template:ot(s),preview:s.files.includes("preview.svg")?S(s,"preview.svg"):null,state:et(s,e),markdown:s.markdown,assets:s.assets,tags:de(s)})),Le=({packages:t,problems:e,settings:s=k})=>[...t.values(),...e.values()].sort(v).map(n=>({id:n.id,version:n.version??null,name:n.name??null,description:n.description??null,state:et(n,s),reason:n.problem&&!n.off?_(n.problem):null,template:!!ot(n),hidden:s.hidden.includes(n.id),disabled:s.disabled.includes(n.id)})),Pe=({hidden:t,disabled:e})=>`settings ${t.join(",")} ${e.join(",")}`;export{Ae as a,ie as b,ce as c,ve as d,xe as e,Ne as f,U as g,Te as h,Ie as i,le as j,de as k,je as l,_e as m,pe as n,Me as o,ot as p,ze as q,Le as r,Pe as s};
|
package/dist/chunk-W5BXXPDJ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
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-TX6JH7TR.mjs";import"./chunk-E7LWZRXY.mjs";import{b as d,f as J,i as k}from"./chunk-NSKUTQ5J.mjs";import{c as F}from"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TYK6VNAB.mjs";import{f as D}from"./chunk-CY2FNNAB.mjs";import{a as A}from"./chunk-UMHUSOPJ.mjs";import"./chunk-L3QKH4OK.mjs";import"./chunk-W4VKN3GF.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};
|
package/dist/chunk-XUNHRCOG.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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-NO5NJCHO.mjs";import{f as H}from"./chunk-S6O4UHLC.mjs";import{a as b,b as J}from"./chunk-TX6JH7TR.mjs";import{a as X,b as _,c as B,i as G}from"./chunk-5ZKJ3H4P.mjs";import{a as Z,b as ee}from"./chunk-QUPLVPB2.mjs";import{c as V,d as Y,e as T}from"./chunk-LCTHTZIL.mjs";import"./chunk-LAE5NQ4B.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-E7LWZRXY.mjs";import{b as N,f as K,g as P}from"./chunk-NSKUTQ5J.mjs";import{k as q}from"./chunk-6QXGZM36.mjs";import{b as A}from"./chunk-UALRNVSE.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TYK6VNAB.mjs";import{b as U,h as W}from"./chunk-CY2FNNAB.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-L3QKH4OK.mjs";import"./chunk-W4VKN3GF.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 M}from"../browser/shared/paths.mjs";import{documentDirectory as oe,documentFiles as S}from"../browser/shared/workspace.mjs";var ae=Object.values(re).flat().join(" "),E=m=>{let s=m.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return/[a-z]{3}/.test(s)?s.length<=60?s:s.slice(0,61).replace(/-[^-]*$/,"")||s.slice(0,60):""},j=(m,s)=>`${m} ${s}${m===1?"":"s"}`;function ce(m,s,p){let n=(g,r=s)=>(r.match(g)??[]).length,f=n(/<ol class="doc-flow"/g,p),u=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"],[f,"flow"],[u,"footnote"]].filter(([g])=>g>0).map(([g,r])=>j(g,r)),d=(m.raws?.length??0)-f-(u?1:0);return d>0&&w.push(`${j(d,"HTML block")} kept as written`),w}async function Te(m){let{positional:s,options:p}=K({options:["--no-preview","--no-browser"],argv:m}),[n,f,u]=s;if(s.length<1||s.length>3||!n)throw new N("Name the file; then the slug and the title, if you choose them.");let w=ie(n);if(!w)throw new N(`Not a kind of file gallery import takes: ${n} (${ae}).`);f!==void 0&&P(f);let d=x.resolve(n);await v.stat(d).then(a=>a.isFile(),()=>!1)||(console.error(`No such file: ${n}`),process.exit(1));let g=f!==void 0?await Q(f):null;g&&(console.error(g),process.exit(1));let r=x.basename(d),O=await v.mkdtemp(x.join(se.tmpdir(),"gallery-import-")),L,y,R;try{let a,$=[];if(w==="markdown")a=[{...await Y(d,O),from:r,children:[]}];else try{({pages:a,skipped:$}=await V([{file:d,name:r}],O))}catch(e){console.error(`${r} could not be read: ${e.message}`),process.exit(1)}a.length===0&&(console.error(`Nothing in ${r} could be read as a page${$.length?` (not taken: ${$.join(", ")})`:""}.`),process.exit(1)),u?.trim()&&(a[0]={...a[0],title:u.replace(/\s+/g," ").trim()});let C=new Map,te=ee({edits:{},reports:{},reportsDirectory:M});y=(await Z(a,{create:async(e,t,i,{lang:l})=>{let{directory:o}=await A(e,t,i,{blank:!0,lang:l});C.set(e,await v.readFile(S(o).html,"utf8"))},slugOf:(e,t)=>t===0&&f!==void 0?f:te.freeSlug(E(e.title)||E(e.from?.replace(/\.[^.]+$/,"")??"")||E(r.replace(/\.[^.]+$/,""))||"doc"),folderOf:e=>oe(e,M),fill:e=>T(e),place:(e,t)=>H(e,{parent:t})})).made;let D=[],I=(e,t)=>{D.push({page:e,depth:t});for(let i of e.children??[])I(i,t+1)};for(let e of a)I(e,0);let h=await Promise.all(D.map(async({page:e,depth:t},i)=>{let l=y[i],o=oe(l,M),c=S(o).html,k=await v.readFile(c,"utf8"),ne=(await T({source:C.get(l),nodes:e.nodes,icon:e.icon,own:e.own})).replace(/<p>\u{E000}\d+\u{E001}<\/p>/gu,""),le=W(U(k,{finish:q}).text);return{slug:l,depth:t,page:e,directory:o,htmlFile:c,made:ce(e,ne,k),readOnly:le}}));if(L={slug:y[0]},h.length===1){let[{page:e,directory:t,htmlFile:i,made:l,readOnly:o}]=h;if(console.log(`Created ${b(i)} and ${x.basename(S(t).json)} from ${r}`),console.log(`Title: ${e.title}`),console.log(`Made: ${l.length?l.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 c of e.notes)console.log(` ${c.line?`line ${c.line}: `:""}${c.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 c of o)console.log(` ${c}`)}}else{console.log(`Created ${j(h.length,"document")} from ${r} (each nested as in the file):`);for(let{slug:i,depth:l,page:o,htmlFile:c,made:k}of h)console.log(`${" ".repeat(l+1)}${i} ${o.title} ${b(c)}`),console.log(`${" ".repeat(l+2)}Made: ${k.length?k.join(", "):"nothing but the title"}${o.files.length?` (${j(o.files.length,"file")} in its assets/)`:""}`);let e=h.flatMap(({slug:i,page:l})=>(l.notes??[]).map(o=>` ${i}: ${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=h.flatMap(({slug:i,readOnly:l})=>l.map(o=>` ${i}: ${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
|
-
`)}`)}$.length&&console.log(`Not taken from ${r} (${$.length}): ${$.join(", ")}`);for(let e of await J())console.log(e);R=`edit ${b(h[0].htmlFile)}${h.length>1?" (and the others)":""} into the document as \u5199\u4F5C\u504F\u597D asks.`}finally{await v.rm(O,{recursive:!0,force:!0})}let F=await G(L.slug,{skipped:B(p),command:`gallery import ${r}`});console.log(X(F,R)),console.log(`Hand in: gallery export ${y.join(" ")}, then gallery qa ${y.join(" ")}`);let z=await _(F,p);z&&console.log(z);for(let a of F)console.log(a)}export{Te as run};
|