@heycys/gallery 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +51 -1
- package/browser/editor/components/callout/index.mjs +40 -15
- package/browser/editor/components/columns/page.mjs +45 -32
- package/browser/editor/components/details/index.mjs +2 -1
- package/browser/editor/components/dialog/index.mjs +2 -1
- package/browser/editor/components/dialog/page.mjs +0 -18
- package/browser/editor/components/divider/index.mjs +1 -1
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/figure/page.mjs +10 -1
- package/browser/editor/components/file/page.mjs +2 -2
- package/browser/editor/components/flowchart/add.mjs +7 -6
- package/browser/editor/components/flowchart/page.mjs +1 -1
- package/browser/editor/components/heading/index.mjs +2 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +4 -20
- package/browser/editor/components/icons.mjs +13 -2
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/page.mjs +2 -2
- package/browser/editor/components/installed/index.mjs +82 -29
- package/browser/editor/components/installed/page.mjs +146 -34
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/kit.mjs +3 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/page.mjs +44 -14
- package/browser/editor/components/pages.mjs +2 -2
- package/browser/editor/components/registry.mjs +68 -33
- package/browser/editor/components/section/index.mjs +2 -1
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/table/index.mjs +64 -5
- package/browser/editor/components/table/page.mjs +30 -19
- package/browser/editor/page/annotate/anchors.mjs +4 -3
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/annotate/index.mjs +61 -34
- package/browser/editor/page/autosave.mjs +357 -38
- package/browser/editor/page/beside.mjs +5 -5
- package/browser/editor/page/block-menu/colors.mjs +3 -1
- package/browser/editor/page/block-menu/index.mjs +8 -6
- package/browser/editor/page/blocks.mjs +16 -7
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +145 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +970 -0
- package/browser/editor/page/board/settings.mjs +209 -0
- package/browser/editor/page/caret.mjs +5 -2
- package/browser/editor/page/changes/bar.mjs +94 -0
- package/browser/editor/page/changes/ghost.mjs +206 -0
- package/browser/editor/page/changes/gone-words.mjs +94 -0
- package/browser/editor/page/changes/index.mjs +447 -0
- package/browser/editor/page/changes/words.mjs +27 -0
- package/browser/editor/page/clipboard/import/colors.mjs +3 -3
- package/browser/editor/page/clipboard/import/html.mjs +29 -6
- package/browser/editor/page/clipboard/import/inline.mjs +32 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
- package/browser/editor/page/clipboard/import/read.mjs +6 -1
- package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
- package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
- package/browser/editor/page/clipboard/index.mjs +156 -26
- package/browser/editor/page/clipboard/own/blocks.mjs +25 -16
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +16 -7
- package/browser/editor/page/clipboard/own/export.mjs +6 -6
- package/browser/editor/page/clipboard/own/selection.mjs +3 -3
- package/browser/editor/page/clipboard/own/writers.mjs +0 -11
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +98 -25
- package/browser/editor/page/conflicts.mjs +13 -33
- package/browser/editor/page/convert.mjs +8 -7
- package/browser/editor/page/core.mjs +81 -27
- package/browser/editor/page/custom-page.mjs +106 -0
- package/browser/editor/page/drag/index.mjs +40 -24
- package/browser/editor/page/drag/preview.mjs +9 -4
- package/browser/editor/page/editor.mjs +120 -28
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +22 -13
- package/browser/editor/page/emoji-picker/grid.mjs +7 -5
- package/browser/editor/page/emoji-picker/icon-tab.mjs +4 -4
- package/browser/editor/page/emoji-picker/icons.mjs +0 -1
- package/browser/editor/page/emoji-picker/index.mjs +11 -9
- package/browser/editor/page/emoji-picker/styles.mjs +156 -2
- package/browser/editor/page/emoji-picker/support.mjs +6 -4
- package/browser/editor/page/emoji-picker/upload.mjs +14 -13
- package/browser/editor/page/fills.mjs +5 -3
- package/browser/editor/page/fold/index.mjs +348 -0
- package/browser/editor/page/fold/rule.mjs +125 -0
- package/browser/editor/page/folded.mjs +23 -0
- package/browser/editor/page/format-bar/bar.mjs +2 -1
- package/browser/editor/page/format-bar/index.mjs +1 -1
- package/browser/editor/page/geometry.mjs +8 -6
- package/browser/editor/page/handle/index.mjs +22 -14
- package/browser/editor/page/hints/index.mjs +1 -1
- package/browser/editor/page/history.mjs +24 -4
- package/browser/editor/page/insert/index.mjs +30 -17
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +69 -6
- package/browser/editor/page/margin.mjs +63 -27
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +86 -31
- package/browser/editor/page/merge.mjs +24 -0
- package/browser/editor/page/notices.mjs +3 -3
- package/browser/editor/page/offered.mjs +1 -1
- package/browser/editor/page/outline/folds.mjs +11 -10
- package/browser/editor/page/outline/index.mjs +131 -45
- package/browser/editor/page/outline/list.mjs +23 -11
- package/browser/editor/page/outline/read.mjs +1 -1
- package/browser/editor/page/outline/strip.mjs +7 -1
- package/browser/editor/page/page-objects.mjs +13 -2
- package/browser/editor/page/panel.mjs +9 -13
- package/browser/editor/page/present-links.mjs +11 -2
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/delete.mjs +8 -6
- package/browser/editor/page/selection/index.mjs +10 -3
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +101 -6
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/cell-bar.mjs +4 -1
- package/browser/editor/page/table/cells.mjs +103 -47
- package/browser/editor/page/table/icons.mjs +3 -1
- package/browser/editor/page/table/index.mjs +40 -16
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +150 -0
- package/browser/editor/page/table/widths.mjs +9 -4
- package/browser/editor/page/text-select/index.mjs +43 -14
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/tooltip.mjs +1 -1
- package/browser/editor/page/type-grid.mjs +4 -3
- package/browser/editor/page/typing/code-edges.mjs +63 -17
- package/browser/editor/page/typing/index.mjs +65 -9
- package/browser/editor/page/typing/leave.mjs +1 -1
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/annotations.mjs +8 -10
- package/browser/shared/block-packs.mjs +404 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/code-folds.mjs +5 -1
- package/browser/shared/colors.mjs +17 -14
- package/browser/shared/component-catalog.mjs +345 -54
- package/browser/shared/component-source.mjs +37 -0
- package/browser/shared/components/callout.mjs +4 -2
- package/browser/shared/components/index.mjs +72 -9
- package/browser/shared/components/installed.mjs +110 -8
- package/browser/shared/components/page.mjs +22 -3
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -1
- package/browser/shared/components/text.mjs +2 -2
- package/browser/shared/document-look.mjs +183 -0
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/README.md +4 -2
- package/browser/shared/emoji/data/categories.json +1 -1
- package/browser/shared/emoji/data/keywords-en.json +1 -1
- package/browser/shared/emoji/data/keywords-zh.json +1 -1
- package/browser/shared/emoji/data/names.json +1 -1
- package/browser/shared/emoji/data/positions.json +1 -1
- package/browser/shared/emoji/data/twemoji-index.json +1 -1
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +10 -12
- package/browser/shared/emoji/emoji.mjs +8 -7
- package/browser/shared/emoji/icon-value.mjs +4 -3
- package/browser/shared/extension-sidebar.mjs +126 -0
- package/browser/shared/extensions.mjs +79 -0
- package/browser/shared/file-table.mjs +101 -0
- package/browser/shared/html-tree.mjs +11 -5
- package/browser/shared/i18n/en.mjs +374 -35
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/long-runs.mjs +39 -0
- package/browser/shared/net-cache.mjs +133 -0
- package/browser/shared/net-keys.mjs +32 -0
- package/browser/shared/net-policy.mjs +177 -0
- package/browser/shared/new-names.mjs +5 -2
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +458 -0
- package/browser/shared/pack-manifest.mjs +77 -0
- package/browser/shared/page-address.mjs +6 -3
- package/browser/shared/page-cards.mjs +308 -0
- package/browser/shared/page-links.mjs +69 -6
- package/browser/shared/pages.mjs +388 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/preferences.mjs +10 -4
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +13 -5
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/table-chart.mjs +33 -1
- package/browser/shared/todos.mjs +83 -0
- package/browser/shared/user-directory.mjs +24 -0
- package/browser/shared/versions.mjs +14 -0
- package/browser/shared/web-links.mjs +134 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-look.mjs +91 -0
- package/browser/shared/workspace-name.mjs +154 -0
- package/browser/shared/workspace-query.mjs +125 -0
- package/browser/shared/workspace-registry.mjs +272 -0
- package/browser/shared/workspace.mjs +171 -20
- package/browser/shared/zoom.mjs +5 -5
- package/dist/chunk-2NRBY6AJ.mjs +2 -0
- package/dist/chunk-32ZUEFZ7.mjs +2 -0
- package/dist/chunk-35NQ4PLQ.mjs +2 -0
- package/dist/chunk-3KJHLHUO.mjs +2 -0
- package/dist/chunk-3NJACR4W.mjs +2 -0
- package/dist/chunk-4AV456RQ.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5XYHDBJ5.mjs +2 -0
- package/dist/chunk-5ZJA7CXT.mjs +2 -0
- package/dist/chunk-6A53MZYZ.mjs +2 -0
- package/dist/chunk-6EXH3ORZ.mjs +166 -0
- package/dist/chunk-6EZ7FNIK.mjs +3 -0
- package/dist/{chunk-UXUK4PMC.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/{chunk-6U2SLSDN.mjs → chunk-6VTU6KEO.mjs} +1 -1
- package/dist/chunk-B4P2CM2J.mjs +3 -0
- package/dist/chunk-BPL64HGA.mjs +4 -0
- package/dist/chunk-BVEFGE4B.mjs +2 -0
- package/dist/chunk-BZ5RAF7L.mjs +2 -0
- package/dist/chunk-CRJEG7MT.mjs +2 -0
- package/dist/{chunk-B3VTYBYR.mjs → chunk-D4CKRD3V.mjs} +91 -91
- package/dist/chunk-D4EURAX4.mjs +4 -0
- package/dist/chunk-DQCE7TJY.mjs +5 -0
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/{chunk-DB4WKGYF.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-FJYN7RTH.mjs +4 -0
- package/dist/chunk-FWNRPMCJ.mjs +12 -0
- package/dist/chunk-FWW4CSAZ.mjs +2 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-GY3FAUVM.mjs +2 -0
- package/dist/chunk-HLYV7RIH.mjs +2 -0
- package/dist/chunk-HMYTM3GT.mjs +15 -0
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-KTKHRC6H.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-MHW7ZKOU.mjs +2 -0
- package/dist/chunk-N76HWBA3.mjs +10 -0
- package/dist/chunk-N7AZZLGT.mjs +548 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-YXAUQPVK.mjs → chunk-NFMCP2HI.mjs} +3 -3
- package/dist/chunk-NG375ILQ.mjs +2 -0
- package/dist/chunk-NVRNLK25.mjs +6 -0
- package/dist/chunk-NWFBE2YA.mjs +2 -0
- package/dist/chunk-NWR2LT5B.mjs +2 -0
- package/dist/chunk-OJKMINIU.mjs +20 -0
- package/dist/chunk-OUUP3WKT.mjs +2 -0
- package/dist/chunk-OW5NWPOJ.mjs +10 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-POQSE4C2.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/{chunk-Z52HTUW7.mjs → chunk-PVER7LSC.mjs} +2 -2
- package/dist/chunk-PZDLJJTJ.mjs +3 -0
- package/dist/chunk-Q47PLKIJ.mjs +15 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QKXMPUXC.mjs +2 -0
- package/dist/chunk-QOUEFUCH.mjs +16 -0
- package/dist/chunk-RFDZXFJF.mjs +13 -0
- package/dist/chunk-RKPWLGZ3.mjs +4 -0
- package/dist/chunk-RMECZA2K.mjs +2 -0
- package/dist/{chunk-EUX7IC5J.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SX4LJYT6.mjs +8 -0
- package/dist/chunk-SXHBYZST.mjs +16 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TEZAWDSQ.mjs +2 -0
- package/dist/chunk-UBBRTJ2R.mjs +24 -0
- package/dist/chunk-UFNYFFKO.mjs +20 -0
- package/dist/chunk-UGWYKHBL.mjs +170 -0
- package/dist/chunk-UKSHDZZ6.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-UNOYVIYR.mjs +2 -0
- package/dist/chunk-V6RIYQZZ.mjs +4 -0
- package/dist/chunk-VJPFVNNW.mjs +15 -0
- package/dist/chunk-VS3ZMVGX.mjs +5 -0
- package/dist/chunk-VTKNEYT3.mjs +6 -0
- package/dist/chunk-VXACTLO3.mjs +3 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YQGT4AB2.mjs +6 -0
- package/dist/chunk-ZB4H7ZN4.mjs +2 -0
- package/dist/{chunk-ACOPDCNB.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZUNVAXLH.mjs +2 -0
- package/dist/chunk-ZWPMCK7P.mjs +2 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-EVJ3BX3M.mjs → update-fetch.mjs} +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +95 -0
- package/kit/board.js +250 -0
- package/kit/charts.js +5 -71
- package/kit/code.js +14 -14
- package/kit/math.js +18 -2
- package/kit/report.css +500 -151
- package/kit/runtime.js +1720 -170
- package/kit/state.js +10 -1
- package/kit/tables.js +172 -37
- package/kit/ui.js +166 -27
- package/package.json +2 -1
- package/packs/gallery/card/component.json +14 -0
- package/packs/gallery/card/example.html +10 -0
- package/packs/gallery/card/preview.svg +1 -0
- package/packs/gallery/card/style.css +6 -0
- package/packs/gallery/card/template.html +6 -0
- package/packs/gallery/card/writing.md +14 -0
- package/packs/gallery/chart-card/component.json +15 -0
- package/packs/gallery/chart-card/example.html +14 -0
- package/packs/gallery/chart-card/kit.js +130 -0
- package/packs/gallery/chart-card/preview.svg +1 -0
- package/packs/gallery/chart-card/style.css +42 -0
- package/packs/gallery/chart-card/template.html +13 -0
- package/packs/gallery/chart-card/writing.md +20 -0
- package/packs/gallery/chart-view/component.json +20 -0
- package/packs/gallery/chart-view/example.html +13 -0
- package/packs/gallery/chart-view/kit.js +355 -0
- package/packs/gallery/chart-view/preview.svg +1 -0
- package/packs/gallery/chart-view/style.css +94 -0
- package/packs/gallery/chart-view/template.html +3 -0
- package/packs/gallery/chart-view/writing.md +22 -0
- package/packs/gallery/countdown/component.json +18 -0
- package/packs/gallery/countdown/example.html +3 -0
- package/packs/gallery/countdown/kit.js +156 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +130 -0
- package/packs/gallery/countdown/template.html +3 -0
- package/packs/gallery/countdown/writing.md +22 -0
- package/packs/gallery/habit/component.json +14 -0
- package/packs/gallery/habit/example.html +3 -0
- package/packs/gallery/habit/kit.js +295 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +246 -0
- package/packs/gallery/habit/template.html +3 -0
- package/packs/gallery/habit/writing.md +21 -0
- package/packs/gallery/heatmap/component.json +18 -0
- package/packs/gallery/heatmap/example.html +3 -0
- package/packs/gallery/heatmap/kit.js +351 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +201 -0
- package/packs/gallery/heatmap/template.html +3 -0
- package/packs/gallery/heatmap/writing.md +21 -0
- package/packs/gallery/kanban/component.json +18 -0
- package/packs/gallery/kanban/example.html +12 -0
- package/packs/gallery/kanban/kit.js +540 -0
- package/packs/gallery/kanban/preview.svg +1 -0
- package/packs/gallery/kanban/style.css +212 -0
- package/packs/gallery/kanban/template.html +3 -0
- package/packs/gallery/kanban/writing.md +20 -0
- package/packs/gallery/metric/component.json +22 -0
- package/packs/gallery/metric/example.html +15 -0
- package/packs/gallery/metric/kit.js +248 -0
- package/packs/gallery/metric/preview.svg +1 -0
- package/packs/gallery/metric/style.css +92 -0
- package/packs/gallery/metric/template.html +3 -0
- package/packs/gallery/metric/writing.md +23 -0
- package/packs/gallery/note/component.json +14 -0
- package/packs/gallery/note/example.html +3 -0
- package/packs/gallery/note/kit.js +102 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +76 -0
- package/packs/gallery/note/template.html +3 -0
- package/packs/gallery/note/writing.md +18 -0
- package/packs/gallery/pack.json +8 -0
- package/packs/gallery/recent/component.json +13 -0
- package/packs/gallery/recent/example.html +1 -0
- package/packs/gallery/recent/kit.js +238 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +158 -0
- package/packs/gallery/recent/template.html +1 -0
- package/packs/gallery/recent/writing.md +15 -0
- package/packs/gallery/static/component.json +13 -0
- package/packs/gallery/static/example.html +11 -0
- package/packs/gallery/static/preview.svg +1 -0
- package/packs/gallery/static/style.css +138 -0
- package/packs/gallery/static/template.html +1 -0
- package/packs/gallery/static/writing.md +18 -0
- package/packs/gallery/stats/component.json +13 -0
- package/packs/gallery/stats/example.html +1 -0
- package/packs/gallery/stats/kit.js +166 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +151 -0
- package/packs/gallery/stats/template.html +1 -0
- package/packs/gallery/stats/writing.md +11 -0
- package/packs/gallery/today/component.json +12 -0
- package/packs/gallery/today/example.html +1 -0
- package/packs/gallery/today/kit.js +185 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +120 -0
- package/packs/gallery/today/template.html +1 -0
- package/packs/gallery/today/writing.md +14 -0
- package/packs/gallery/todos/component.json +19 -0
- package/packs/gallery/todos/example.html +3 -0
- package/packs/gallery/todos/kit.js +342 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +267 -0
- package/packs/gallery/todos/template.html +3 -0
- package/packs/gallery/todos/writing.md +30 -0
- package/packs/gallery/weather/component.json +19 -0
- package/packs/gallery/weather/example.html +3 -0
- package/packs/gallery/weather/kit.js +312 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +258 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/release.json +13 -11
- package/sdk/doc-kit.d.ts +404 -7
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +71 -26
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/example-report.html +1 -1
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +221 -0
- package/skill/references/writing-html.md +9 -7
- package/skill/sdk/doc-kit.d.ts +404 -7
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BK2e_07w.js +13 -0
- package/web/assets/index-CWFI83mF.css +1 -0
- package/web/index.html +2 -2
- package/browser/editor/components/callout/page.mjs +0 -13
- package/dist/chunk-2PBALTR3.mjs +0 -57
- package/dist/chunk-3LA3EMDE.mjs +0 -15
- package/dist/chunk-5FRMCDPY.mjs +0 -16
- package/dist/chunk-5LEK2CBS.mjs +0 -2
- package/dist/chunk-5OFN5AHC.mjs +0 -2
- package/dist/chunk-5SIYS5HN.mjs +0 -2
- package/dist/chunk-5TEK3RAD.mjs +0 -2
- package/dist/chunk-6CYG3Z4V.mjs +0 -2
- package/dist/chunk-7GHT2UCA.mjs +0 -15
- package/dist/chunk-7QQBR7PB.mjs +0 -2
- package/dist/chunk-ATCJYAR4.mjs +0 -2
- package/dist/chunk-C7HWOBIF.mjs +0 -2
- package/dist/chunk-E7VYDG2X.mjs +0 -2
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FQGQH4KM.mjs +0 -2
- package/dist/chunk-G7TOXONE.mjs +0 -6
- package/dist/chunk-GPF4YWWB.mjs +0 -9
- package/dist/chunk-GYQV7Y4J.mjs +0 -120
- package/dist/chunk-HMHK3EQ6.mjs +0 -2
- package/dist/chunk-HQQMJCQJ.mjs +0 -10
- package/dist/chunk-IERUOGC3.mjs +0 -6
- package/dist/chunk-ITNLYXXV.mjs +0 -3
- package/dist/chunk-L4DVONOG.mjs +0 -2
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LC7YNQFG.mjs +0 -2
- package/dist/chunk-LHTFLRB6.mjs +0 -4
- package/dist/chunk-NFIBI4IP.mjs +0 -26
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O52JMOCZ.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-QMQUXTU4.mjs +0 -12
- package/dist/chunk-QVWVFC5K.mjs +0 -6
- package/dist/chunk-QYKCJ7FG.mjs +0 -8
- package/dist/chunk-QZY6Q64C.mjs +0 -2
- package/dist/chunk-TDQP3DKQ.mjs +0 -10
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-UNUEWH4S.mjs +0 -2
- package/dist/chunk-V4CPWKMZ.mjs +0 -2
- package/dist/chunk-VACRB2NE.mjs +0 -3
- package/dist/chunk-W63L7367.mjs +0 -7
- package/dist/chunk-W7CXPCRV.mjs +0 -6
- package/dist/chunk-XINNG4F2.mjs +0 -4
- package/dist/chunk-YL2DPWVS.mjs +0 -4
- package/dist/chunk-YZ5Z6H4W.mjs +0 -4
- package/dist/chunk-ZBIM6ARY.mjs +0 -216
- package/skill/references/building-components.md +0 -327
- package/web/assets/index-B6Ai3wsa.js +0 -13
- package/web/assets/index-SYPC3EZy.css +0 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/* Every selector starts at the instance and goes down a step at a time (>), so that nothing here
|
|
2
|
+
reaches the rest of the page. The face fills its card on a custom page (the board draws the frame), in
|
|
3
|
+
the kit's card tokens: its head (the chip and 工作区统计, its end clear of the card's grip), then four
|
|
4
|
+
cells in the middle of the room under it, each its label small and muted (after a small picture of
|
|
5
|
+
what it counts) over its number, large (the cards' figure size), its
|
|
6
|
+
unit small and muted after it, the to-dos done with a bar under their count, as wide as the cell, the
|
|
7
|
+
share done in the accent on the track; two by two on a card 4 cells wide, the room the card has spread
|
|
8
|
+
evenly above, between and under the rows (the face's gap between them at the least), all four in a row
|
|
9
|
+
past 560px (the instance is a container), the hero size, a hairline between them and each cell's bar
|
|
10
|
+
ending short of the next one's line, and on a card too low for two rows with their air (under 160px: a
|
|
11
|
+
4 x 2 one from a window 1440px wide and narrower) in a row too, smaller; a line under them where the
|
|
12
|
+
workspace cannot be read. Light and dark. */
|
|
13
|
+
[data-doc-component="gallery/stats"] {
|
|
14
|
+
container-type: size;
|
|
15
|
+
height: 9em;
|
|
16
|
+
> .gallery-stats-face {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: var(--gallery-face-gap);
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
height: 100%;
|
|
22
|
+
min-height: 0;
|
|
23
|
+
color: var(--gallery-text);
|
|
24
|
+
}
|
|
25
|
+
> .gallery-stats-face > .gallery-stats-head {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 8px;
|
|
29
|
+
flex: none;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
padding-inline-end: var(--gallery-grip-room, 0px);
|
|
32
|
+
}
|
|
33
|
+
> .gallery-stats-face > .gallery-stats-head > .gallery-stats-chip {
|
|
34
|
+
flex: none;
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
width: var(--gallery-chip-size);
|
|
39
|
+
height: var(--gallery-chip-size);
|
|
40
|
+
border-radius: var(--gallery-chip-radius);
|
|
41
|
+
background: var(--gallery-accent-soft);
|
|
42
|
+
color: var(--gallery-accent);
|
|
43
|
+
}
|
|
44
|
+
> .gallery-stats-face > .gallery-stats-head > .gallery-stats-chip > svg { width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
|
|
45
|
+
> .gallery-stats-face > .gallery-stats-head > .gallery-stats-title {
|
|
46
|
+
min-width: 0;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
font-size: var(--gallery-title-size);
|
|
51
|
+
line-height: var(--gallery-title-line);
|
|
52
|
+
font-weight: 600;
|
|
53
|
+
color: var(--gallery-text-strong);
|
|
54
|
+
}
|
|
55
|
+
> .gallery-stats-face > .gallery-stats-grid {
|
|
56
|
+
display: grid;
|
|
57
|
+
flex: 1 1 auto;
|
|
58
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
59
|
+
align-content: space-evenly;
|
|
60
|
+
gap: var(--gallery-face-gap) 16px;
|
|
61
|
+
min-height: 0;
|
|
62
|
+
margin: 0;
|
|
63
|
+
}
|
|
64
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell { min-width: 0; }
|
|
65
|
+
/* Each label after a small picture of what it counts, in its muted color. */
|
|
66
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-label {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: 5px;
|
|
70
|
+
font-size: var(--gallery-meta-size);
|
|
71
|
+
line-height: 16px;
|
|
72
|
+
color: var(--doc-muted);
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
text-overflow: ellipsis;
|
|
76
|
+
}
|
|
77
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-label::before {
|
|
78
|
+
content: "";
|
|
79
|
+
flex: none;
|
|
80
|
+
width: 13px;
|
|
81
|
+
height: 13px;
|
|
82
|
+
background: currentColor;
|
|
83
|
+
opacity: .85;
|
|
84
|
+
-webkit-mask: var(--gallery-stats-icon) center / contain no-repeat;
|
|
85
|
+
mask: var(--gallery-stats-icon) center / contain no-repeat;
|
|
86
|
+
}
|
|
87
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell[data-stat="documents"] { --gallery-stats-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2z'/%3E%3C/svg%3E"); }
|
|
88
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell[data-stat="todos"] { --gallery-stats-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E"); }
|
|
89
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell[data-stat="words"] { --gallery-stats-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7V5h14v2'/%3E%3Cpath d='M12 5v14'/%3E%3Cpath d='M9 19h6'/%3E%3C/svg%3E"); }
|
|
90
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell[data-stat="week"] { --gallery-stats-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L18.5 9.5a2.83 2.83 0 1 0-4-4L4 16v4'/%3E%3Cpath d='M13.5 6.5l4 4'/%3E%3C/svg%3E"); }
|
|
91
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-wrap: wrap;
|
|
94
|
+
align-items: baseline;
|
|
95
|
+
margin: 3px 0 0;
|
|
96
|
+
font-size: var(--gallery-figure-size);
|
|
97
|
+
line-height: 1.1;
|
|
98
|
+
font-weight: var(--gallery-numeral-weight);
|
|
99
|
+
letter-spacing: var(--gallery-numeral-tracking);
|
|
100
|
+
color: var(--gallery-text-strong);
|
|
101
|
+
font-variant-numeric: tabular-nums;
|
|
102
|
+
white-space: nowrap;
|
|
103
|
+
}
|
|
104
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value > .gallery-stats-unit {
|
|
105
|
+
margin-inline-start: var(--gallery-unit-gap);
|
|
106
|
+
font-size: max(12px, var(--gallery-unit-size));
|
|
107
|
+
font-weight: 500;
|
|
108
|
+
letter-spacing: 0;
|
|
109
|
+
color: var(--doc-muted);
|
|
110
|
+
}
|
|
111
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value > .gallery-stats-unit:empty { display: none; }
|
|
112
|
+
/* The share of the to-dos done: a bar of the accent on the track under the count, as wide as the cell. */
|
|
113
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value > .gallery-stats-bar {
|
|
114
|
+
flex: 0 0 100%;
|
|
115
|
+
height: 4px;
|
|
116
|
+
margin-top: 6px;
|
|
117
|
+
border-radius: 2px;
|
|
118
|
+
background: var(--gallery-track);
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
}
|
|
121
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value > .gallery-stats-bar > .gallery-stats-fill {
|
|
122
|
+
display: block;
|
|
123
|
+
width: calc(var(--share, 0) * 100%);
|
|
124
|
+
height: 100%;
|
|
125
|
+
border-radius: 2px;
|
|
126
|
+
background: var(--gallery-accent);
|
|
127
|
+
}
|
|
128
|
+
> .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value > .gallery-stats-bar[hidden] { display: none; }
|
|
129
|
+
> .gallery-stats-face > .gallery-stats-line { margin: 0; font-size: var(--gallery-meta-size); line-height: 1.4; color: var(--doc-muted); }
|
|
130
|
+
> .gallery-stats-face > .gallery-stats-line[hidden] { display: none; }
|
|
131
|
+
}
|
|
132
|
+
/* Wide (8 cells and more): the four in one row, a hairline between them, each cell's bar ending short of the
|
|
133
|
+
next line, the hero size. */
|
|
134
|
+
@container (min-width: 560px) {
|
|
135
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
|
|
136
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell + .gallery-stats-cell { padding-inline-start: 20px; border-inline-start: 1px solid var(--doc-grid); }
|
|
137
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell:not(:last-child) { padding-inline-end: 16px; }
|
|
138
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value { font-size: var(--gallery-hero-size); }
|
|
139
|
+
}
|
|
140
|
+
/* Low (under 160px: a 4 x 2 card from a window 1440px wide and narrower, where two rows under the head would
|
|
141
|
+
leave the second at the card's bottom edge): the four in one row, their numbers smaller, their labels with
|
|
142
|
+
no picture. */
|
|
143
|
+
@container (max-height: 160px) and (max-width: 559px) {
|
|
144
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 10px; align-content: center; }
|
|
145
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-label::before { display: none; }
|
|
146
|
+
[data-doc-component="gallery/stats"] > .gallery-stats-face > .gallery-stats-grid > .gallery-stats-cell > .gallery-stats-value { font-size: clamp(16px, 6.4cqi, 22px); }
|
|
147
|
+
}
|
|
148
|
+
/* On a custom page the face is the card's: as high as what the card holds inside its padding. Where no card
|
|
149
|
+
is around it (a document, as gallery block check shows it) it is as high as a 4 x 2 card's face, for the
|
|
150
|
+
instance is a container of its height too and would otherwise have none. */
|
|
151
|
+
.gallery-card > [data-doc-component="gallery/stats"] { height: 100%; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-doc-component="gallery/stats"></div>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 工作区统计 (gallery/stats)
|
|
2
|
+
|
|
3
|
+
A card for a custom page (its places are `page`, its needs `workspace`): four numbers of the workspace, its documents (文档), its to-dos done of all (待办完成, 3/12), the words of all its documents (总字数) and how many documents were edited this week, since Monday (本周编辑). Use it on the home page.
|
|
4
|
+
|
|
5
|
+
## How to write it
|
|
6
|
+
|
|
7
|
+
Put it on a custom page as a card of its board, `<section class="gallery-card" data-card-id="…" data-x data-y data-w data-h>`, holding one instance, after `gallery block add stats`: the instance is empty, `<div data-doc-component="gallery/stats"></div>`, everything on it drawn by its script. It has no settings and holds no data: there is nothing to fill in and nothing it writes. Sizes: 4 × 2 (the default: two by two) and 8 × 2 (the four in a row).
|
|
8
|
+
|
|
9
|
+
## How it looks
|
|
10
|
+
|
|
11
|
+
工作区统计 beside a chart's chip on the top line, then each number large under its label, muted, after a small picture of what it counts (two by two, or four in a row on a wide card or a low one), the to-dos done with a bar under them, the share done in the accent; in the kit's card tokens (as every Gallery card: a head of a tinted chip and a title, its end clear of the card's grip), light and dark; a workspace with no document shows each 0. The numbers follow by themselves: a document written, a to-do checked, a document made or taken away shows at once. A big count of words is said short (12.3万). In an exported file, which has no workspace to read, each is a dash, with a line saying it shows when the page is opened in Gallery. The script runs with the rights of the page's own scripts, as any block's does.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/today",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"name": { "zh": "问候与日期", "en": "Greeting and date" },
|
|
6
|
+
"description": { "zh": "按时间问候,显示今天的日期和星期,到点自己更新", "en": "A greeting by the time of day, today's date and weekday, kept up to date by the clock" },
|
|
7
|
+
"words": "wenhouyuriqi wenhou riqi xingqi jintian today greeting date 问候 日期 星期 今天 时间",
|
|
8
|
+
"parts": {},
|
|
9
|
+
"runtime": { "generated": [":scope > .gallery-today-face"] },
|
|
10
|
+
"places": ["page"],
|
|
11
|
+
"card": { "sizes": [[4, 2], [2, 2]], "resize": true }
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-doc-component="gallery/today"></div>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// gallery/today (问候与日期): a greeting by the hour of the reader's clock (早上好 from 5 to 11, 下午好
|
|
2
|
+
// from 12 to 17, 晚上好 from 18 to 4), today's date and its weekday, in the page's language and in the
|
|
3
|
+
// order it writes them (11月7日 星期六, Saturday, November 7: as the countdown's foot writes a date): the
|
|
4
|
+
// UI's where Gallery says it (data-ge-language on the root), else English for a page whose lang is en,
|
|
5
|
+
// else Chinese, the kit's own rule. Drawn again by the kit's clock (`clock`): at each whole minute, which
|
|
6
|
+
// moves the greeting on as the hour turns, and as a day begins, which moves the date; one timer for
|
|
7
|
+
// every block on the page, none of its own. It holds no part and writes nothing: all it shows is drawn
|
|
8
|
+
// (the manifest's `runtime`), and a file holds the bare instance. On a custom page it is a card's whole
|
|
9
|
+
// face, laid out by the room it has (style.css, container queries): a 2 x 2 card stacks what a 4 x 2
|
|
10
|
+
// one sets on a line. Its head is the cards' chip (the kit's card tokens): the sun from 5 to 17, the moon
|
|
11
|
+
// from 18 to 4, as the greeting's part of the day, which the face says too (`data-sky`: its glow, the
|
|
12
|
+
// sun's warm color or the accent), and the number of the week (ISO 8601's, `weekNumberOf`) its quiet meta. A card wide enough also shows the week it is in, Monday
|
|
13
|
+
// to Sunday, each day's initial over its date, today's 今 (Today) over its date and marked (`weekOf`):
|
|
14
|
+
// drawn, for the eye alone (the date says it), again as a day begins. The date line's weekday is marked
|
|
15
|
+
// (gallery-today-weekday), which a narrow card leaves out, so that its head stays one line (11月9日).
|
|
16
|
+
|
|
17
|
+
const WORDS = {
|
|
18
|
+
zh: {
|
|
19
|
+
morning: "早上好",
|
|
20
|
+
afternoon: "下午好",
|
|
21
|
+
evening: "晚上好",
|
|
22
|
+
weekdays: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
|
23
|
+
initials: ["日", "一", "二", "三", "四", "五", "六"],
|
|
24
|
+
today: "今",
|
|
25
|
+
week: (/** @type {number} */ number) => `第 ${number} 周`,
|
|
26
|
+
/** The date and its weekday as the language writes them, pieces a line breaks between. @param {number} month @param {number} day @param {string} weekday */
|
|
27
|
+
line: (month, day, weekday) => [`${month}月${day}日`, weekday],
|
|
28
|
+
/** Which of the line's pieces is the weekday. */
|
|
29
|
+
weekdayAt: 1,
|
|
30
|
+
},
|
|
31
|
+
en: {
|
|
32
|
+
morning: "Good morning",
|
|
33
|
+
afternoon: "Good afternoon",
|
|
34
|
+
evening: "Good evening",
|
|
35
|
+
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
36
|
+
initials: ["S", "M", "T", "W", "T", "F", "S"],
|
|
37
|
+
today: "Today",
|
|
38
|
+
week: (/** @type {number} */ number) => `Week ${number}`,
|
|
39
|
+
/** The weekday first: Saturday, November 7. @param {number} month @param {number} day @param {string} weekday */
|
|
40
|
+
line: (month, day, weekday) => [`${weekday},`, `${["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][month - 1]} ${day}`],
|
|
41
|
+
weekdayAt: 0,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** The language the page speaks: the UI's where Gallery says it (data-ge-language), else its lang's. */
|
|
46
|
+
function languageOf(/** @type {HTMLElement} */ root) {
|
|
47
|
+
const ui = root.getAttribute("data-ge-language");
|
|
48
|
+
return (ui !== null ? ui === "en" : /^en(?:-|$)/i.test(root.lang)) ? "en" : "zh";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The part of the day an hour (0 to 23) is in, as the greeting says it: morning from 5 to 11,
|
|
53
|
+
* afternoon from 12 to 17, evening from 18 to 4.
|
|
54
|
+
* @param {number} hour
|
|
55
|
+
* @returns {"morning" | "afternoon" | "evening"}
|
|
56
|
+
*/
|
|
57
|
+
function partOfDay(hour) {
|
|
58
|
+
if (hour >= 5 && hour < 12) return "morning";
|
|
59
|
+
if (hour >= 12 && hour < 18) return "afternoon";
|
|
60
|
+
return "evening";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* What the card says at `now` (the reader's clock) in `language`: the greeting, the date line (its
|
|
65
|
+
* month and day and the weekday, in the language's order, a list of words a line breaks between and
|
|
66
|
+
* never inside), and the date as a <time> names it (YYYY-MM-DD).
|
|
67
|
+
* @param {Date} now
|
|
68
|
+
* @param {"zh" | "en"} language
|
|
69
|
+
*/
|
|
70
|
+
function faceOf(now, language) {
|
|
71
|
+
const words = WORDS[language];
|
|
72
|
+
const two = (/** @type {number} */ value) => String(value).padStart(2, "0");
|
|
73
|
+
return {
|
|
74
|
+
greeting: words[partOfDay(now.getHours())],
|
|
75
|
+
line: words.line(now.getMonth() + 1, now.getDate(), words.weekdays[now.getDay()]),
|
|
76
|
+
datetime: `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())}`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// The chip's two pictures, 24 x 24 lines in the chip's ink: the sun by day, the moon in the evening.
|
|
81
|
+
const PICTURES = {
|
|
82
|
+
sun: '<circle cx="12" cy="12" r="4" fill="currentColor" fill-opacity=".28"/><path d="M12 2.6v2.3M12 19.1v2.3M2.6 12h2.3M19.1 12h2.3M5.4 5.4l1.6 1.6M17 17l1.6 1.6M5.4 18.6l1.6-1.6M17 7l1.6-1.6"/>',
|
|
83
|
+
moon: '<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z"/>',
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The week `now` is in, Monday first, as the card's strip draws it in `language`: seven of { initial (the
|
|
88
|
+
* weekday's, today's 今 or Today), date (the day of the month), today, past (a day before today) }.
|
|
89
|
+
* @param {Date} now
|
|
90
|
+
* @param {"zh" | "en"} language
|
|
91
|
+
*/
|
|
92
|
+
function weekOf(now, language) {
|
|
93
|
+
const monday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - ((now.getDay() + 6) % 7), 12);
|
|
94
|
+
return Array.from({ length: 7 }, (_, index) => {
|
|
95
|
+
const day = new Date(monday.getFullYear(), monday.getMonth(), monday.getDate() + index, 12);
|
|
96
|
+
const today = index === (now.getDay() + 6) % 7;
|
|
97
|
+
return { initial: today ? WORDS[language].today : WORDS[language].initials[day.getDay()], date: day.getDate(), today, past: index < (now.getDay() + 6) % 7 };
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The number of the week `now` is in, as ISO 8601 counts them (the week a year's first Thursday is in its
|
|
103
|
+
* first, Monday its first day), 1 to 53.
|
|
104
|
+
* @param {Date} now
|
|
105
|
+
*/
|
|
106
|
+
function weekNumberOf(now) {
|
|
107
|
+
const thursday = new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate()));
|
|
108
|
+
thursday.setUTCDate(thursday.getUTCDate() + 3 - ((thursday.getUTCDay() + 6) % 7)); // the Thursday of its week, which says the year
|
|
109
|
+
const first = Date.UTC(thursday.getUTCFullYear(), 0, 1);
|
|
110
|
+
return Math.ceil(((thursday.getTime() - first) / 86_400_000 + 1) / 7);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* An element of the face, of `kind` (its class).
|
|
115
|
+
* @template {keyof HTMLElementTagNameMap} K
|
|
116
|
+
* @param {K} tag
|
|
117
|
+
* @param {string} kind
|
|
118
|
+
*/
|
|
119
|
+
function made(tag, kind) {
|
|
120
|
+
const node = document.createElement(tag);
|
|
121
|
+
node.className = `gallery-today-${kind}`;
|
|
122
|
+
return node;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
DocKit.component({
|
|
126
|
+
id: "gallery/today",
|
|
127
|
+
on: ["clock"],
|
|
128
|
+
mount(host) {
|
|
129
|
+
const face = made("div", "face");
|
|
130
|
+
const chip = made("span", "chip");
|
|
131
|
+
chip.setAttribute("aria-hidden", "true");
|
|
132
|
+
const greeting = made("p", "greeting");
|
|
133
|
+
const date = made("time", "date");
|
|
134
|
+
const week = made("ol", "week");
|
|
135
|
+
week.setAttribute("aria-hidden", "true");
|
|
136
|
+
face.append(chip, greeting, date, week);
|
|
137
|
+
// The head's quiet meta, at its end: the number of the week.
|
|
138
|
+
const number = made("span", "meta");
|
|
139
|
+
number.setAttribute("aria-hidden", "true");
|
|
140
|
+
face.append(number);
|
|
141
|
+
host.append(face);
|
|
142
|
+
// Each word set only when it is another, so that a minute that changes nothing writes nothing.
|
|
143
|
+
const put = (/** @type {HTMLElement} */ node, /** @type {string} */ words) => {
|
|
144
|
+
if (node.textContent !== words) node.textContent = words;
|
|
145
|
+
};
|
|
146
|
+
const draw = () => {
|
|
147
|
+
const at = new Date();
|
|
148
|
+
const language = languageOf(document.documentElement);
|
|
149
|
+
const now = faceOf(at, language);
|
|
150
|
+
const sky = partOfDay(at.getHours()) === "evening" ? "moon" : "sun";
|
|
151
|
+
if (chip.dataset.sky !== sky) {
|
|
152
|
+
chip.dataset.sky = sky;
|
|
153
|
+
face.dataset.sky = sky;
|
|
154
|
+
chip.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round">${PICTURES[sky]}</svg>`;
|
|
155
|
+
}
|
|
156
|
+
put(greeting, now.greeting);
|
|
157
|
+
// The date line's pieces, a space between them, made again only when its words are others.
|
|
158
|
+
if (date.textContent !== now.line.join(" ")) {
|
|
159
|
+
date.replaceChildren(...now.line.flatMap((words, index) => {
|
|
160
|
+
const piece = made("span", "piece");
|
|
161
|
+
piece.classList.toggle("gallery-today-weekday", index === WORDS[language].weekdayAt);
|
|
162
|
+
piece.textContent = words;
|
|
163
|
+
return index === 0 ? [piece] : [" ", piece];
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
if (date.dateTime !== now.datetime) {
|
|
167
|
+
date.dateTime = now.datetime;
|
|
168
|
+
number.textContent = WORDS[language].week(weekNumberOf(at));
|
|
169
|
+
week.replaceChildren(...weekOf(at, language).map((day) => {
|
|
170
|
+
const item = made("li", "day");
|
|
171
|
+
item.classList.toggle("gallery-today-now", day.today);
|
|
172
|
+
item.classList.toggle("gallery-today-past", day.past);
|
|
173
|
+
const initial = made("span", "initial");
|
|
174
|
+
initial.textContent = day.initial;
|
|
175
|
+
const number = made("span", "number");
|
|
176
|
+
number.textContent = String(day.date);
|
|
177
|
+
item.append(initial, number);
|
|
178
|
+
return item;
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
draw();
|
|
183
|
+
return { update: draw };
|
|
184
|
+
},
|
|
185
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 120"><rect width="240" height="120" rx="8" fill="#f3f3f1"/><rect x="16.5" y="12.5" width="207" height="95" rx="12" fill="#ffffff" stroke="#e7e6e3"/><rect x="30" y="24" width="14" height="14" rx="4.5" fill="#fbf0df"/><g transform="translate(32 26) scale(.4167)" fill="none" stroke="#d98a1c" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3.6"/><path d="M12 2.6v2.3M12 19.1v2.3M2.6 12h2.3M19.1 12h2.3M5.4 5.4l1.6 1.6M17 17l1.6 1.6M5.4 18.6l1.6-1.6M17 7l1.6-1.6"/></g><rect x="50" y="28" width="30" height="6" rx="3" fill="#3b3a37"/><rect x="84" y="28" width="22" height="6" rx="3" fill="#c4c2bd"/><rect x="30" y="50" width="74" height="17" rx="5" fill="#3b3a37"/><rect x="35.5" y="82" width="7" height="3" rx="1.5" fill="#c4c2bd"/><rect x="34" y="89" width="10" height="5" rx="2.5" fill="#e9e8e5"/><rect x="61" y="82" width="7" height="3" rx="1.5" fill="#c4c2bd"/><rect x="59.5" y="89" width="10" height="5" rx="2.5" fill="#e9e8e5"/><rect x="80" y="78" width="20" height="20" rx="5" fill="#efeeec"/><rect x="86.5" y="82" width="7" height="3" rx="1.5" fill="#2e7cd1"/><rect x="85" y="89" width="10" height="5" rx="2.5" fill="#2e7cd1"/><rect x="112" y="82" width="7" height="3" rx="1.5" fill="#c4c2bd"/><rect x="110.5" y="89" width="10" height="5" rx="2.5" fill="#c4c2bd"/><rect x="137.5" y="82" width="7" height="3" rx="1.5" fill="#c4c2bd"/><rect x="136" y="89" width="10" height="5" rx="2.5" fill="#c4c2bd"/><rect x="163" y="82" width="7" height="3" rx="1.5" fill="#c4c2bd"/><rect x="161.5" y="89" width="10" height="5" rx="2.5" fill="#c4c2bd"/><rect x="188.5" y="82" width="7" height="3" rx="1.5" fill="#c4c2bd"/><rect x="187" y="89" width="10" height="5" rx="2.5" fill="#c4c2bd"/></svg>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* Every selector starts at the instance and goes down a step at a time (>), so that nothing here
|
|
2
|
+
reaches the rest of the page. The face fills its card on a custom page (the board draws the frame), in
|
|
3
|
+
the kit's card tokens, laid out as a grid: the chip (the sun by day in its warm color, the moon in the
|
|
4
|
+
evening in the accent) and the date beside it, the date in the text's color and the weekday muted, its
|
|
5
|
+
end clear of the card's grip; the greeting large in the middle of the room under them; on a card wide
|
|
6
|
+
enough (past 260px) the week at the bottom, each day's initial over its date, muted, the days gone
|
|
7
|
+
fainter still, today's 今 over its date on a quiet gray in the accent; the number of the week its head's
|
|
8
|
+
quiet meta at the end; a glow at the card's top left, the sun's warm color by day, the accent's in the
|
|
9
|
+
evening, as the hero of a home page (the face's data-sky), fainter in dark, where a warm wash on the
|
|
10
|
+
card's gray reads as haze. The greeting grows with the card's width (the instance is a container: cqi),
|
|
11
|
+
between a least and a most, so that a 2 x 2 card and a 4 x 2 one at 1920 both read as a widget. A narrow
|
|
12
|
+
card's head is the date alone, its weekday left out, on one line. Light and dark. */
|
|
13
|
+
[data-doc-component="gallery/today"] {
|
|
14
|
+
container-type: inline-size;
|
|
15
|
+
--gallery-today-sun: light-dark(#d98a1c, #f0b44f);
|
|
16
|
+
--gallery-today-sun-soft: light-dark(rgb(217 138 28 / 11%), rgb(240 180 79 / 14%));
|
|
17
|
+
/* The glow at the card's top left: the sun's warm color by day, the accent's in the evening. */
|
|
18
|
+
--gallery-today-glow: light-dark(rgb(240 160 60 / 12%), rgb(240 180 79 / 3.5%));
|
|
19
|
+
--gallery-today-glow-evening: light-dark(rgb(46 124 209 / 8%), rgb(92 154 217 / 6%));
|
|
20
|
+
> .gallery-today-face {
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
23
|
+
grid-template-rows: auto 1fr auto;
|
|
24
|
+
grid-template-areas: "chip date meta" "greeting greeting greeting" "week week week";
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: 8px 10px;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
height: 100%;
|
|
29
|
+
min-height: 0;
|
|
30
|
+
color: var(--gallery-text);
|
|
31
|
+
}
|
|
32
|
+
> .gallery-today-face > .gallery-today-chip {
|
|
33
|
+
grid-area: chip;
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
width: var(--gallery-chip-size);
|
|
38
|
+
height: var(--gallery-chip-size);
|
|
39
|
+
border-radius: var(--gallery-chip-radius);
|
|
40
|
+
background: var(--gallery-accent-soft);
|
|
41
|
+
color: var(--gallery-accent);
|
|
42
|
+
}
|
|
43
|
+
> .gallery-today-face > .gallery-today-chip[data-sky="sun"] { background: var(--gallery-today-sun-soft); color: var(--gallery-today-sun); }
|
|
44
|
+
> .gallery-today-face > .gallery-today-chip > svg { width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
|
|
45
|
+
> .gallery-today-face > .gallery-today-date {
|
|
46
|
+
grid-area: date;
|
|
47
|
+
display: block;
|
|
48
|
+
min-width: 0;
|
|
49
|
+
font-size: var(--gallery-title-size);
|
|
50
|
+
line-height: 18px;
|
|
51
|
+
color: var(--doc-muted);
|
|
52
|
+
}
|
|
53
|
+
/* The number of the week, the head's quiet meta at its end, at the content's edge, faded while the card's grip shows. */
|
|
54
|
+
> .gallery-today-face > .gallery-today-meta {
|
|
55
|
+
grid-area: meta;
|
|
56
|
+
opacity: calc(1 - var(--gallery-grip-shown, 0));
|
|
57
|
+
transition: opacity .12s ease-out;
|
|
58
|
+
font-size: var(--gallery-meta-size);
|
|
59
|
+
line-height: 18px;
|
|
60
|
+
color: var(--doc-muted);
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
}
|
|
63
|
+
/* The date in the text's color, its weekday muted; they break between them, never inside either. */
|
|
64
|
+
> .gallery-today-face > .gallery-today-date > span { display: inline-block; }
|
|
65
|
+
> .gallery-today-face > .gallery-today-date > span:not(.gallery-today-weekday) { color: var(--gallery-text-strong); font-weight: 600; }
|
|
66
|
+
> .gallery-today-face > .gallery-today-greeting {
|
|
67
|
+
grid-area: greeting;
|
|
68
|
+
align-self: center;
|
|
69
|
+
margin: 0;
|
|
70
|
+
font-size: clamp(24px, 10.5cqi, 48px);
|
|
71
|
+
line-height: 1.15;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
letter-spacing: -.02em;
|
|
74
|
+
color: var(--gallery-text-strong);
|
|
75
|
+
overflow-wrap: anywhere;
|
|
76
|
+
}
|
|
77
|
+
> .gallery-today-face > .gallery-today-week {
|
|
78
|
+
grid-area: week;
|
|
79
|
+
display: grid;
|
|
80
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
81
|
+
gap: 2px;
|
|
82
|
+
margin: 8px 0 0;
|
|
83
|
+
padding: 0;
|
|
84
|
+
list-style: none;
|
|
85
|
+
}
|
|
86
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-day {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
align-items: center;
|
|
90
|
+
gap: 3px;
|
|
91
|
+
padding: 4px 0;
|
|
92
|
+
border-radius: 8px;
|
|
93
|
+
line-height: 1;
|
|
94
|
+
}
|
|
95
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-day > .gallery-today-initial { font-size: 11px; color: var(--doc-muted); }
|
|
96
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-day > .gallery-today-number { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--doc-muted); }
|
|
97
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-past { opacity: .55; }
|
|
98
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-now { background: var(--gallery-neutral-soft); }
|
|
99
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-now > .gallery-today-initial,
|
|
100
|
+
> .gallery-today-face > .gallery-today-week > .gallery-today-now > .gallery-today-number { color: var(--gallery-accent); font-weight: 600; }
|
|
101
|
+
}
|
|
102
|
+
/* A narrow card (2 wide): no week, no week's number; the greeting in the middle of the room under the date. */
|
|
103
|
+
@container (max-width: 260px) {
|
|
104
|
+
[data-doc-component="gallery/today"] > .gallery-today-face { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "chip date" "greeting greeting"; }
|
|
105
|
+
[data-doc-component="gallery/today"] > .gallery-today-face > .gallery-today-date { padding-inline-end: var(--gallery-grip-room, 0px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
106
|
+
[data-doc-component="gallery/today"] > .gallery-today-face > .gallery-today-date > .gallery-today-weekday { display: none; }
|
|
107
|
+
[data-doc-component="gallery/today"] > .gallery-today-face > :is(.gallery-today-week, .gallery-today-meta) { display: none; }
|
|
108
|
+
[data-doc-component="gallery/today"] > .gallery-today-face > .gallery-today-greeting { font-size: clamp(24px, 15cqi, 44px); }
|
|
109
|
+
}
|
|
110
|
+
/* On a custom page the face is the card's: as high as what the card holds inside its padding, and its
|
|
111
|
+
glow the whole card's, from its edges (the face taken out over the card's padding and given it back). */
|
|
112
|
+
.gallery-card > [data-doc-component="gallery/today"] { height: 100%; }
|
|
113
|
+
.gallery-card > [data-doc-component="gallery/today"] > .gallery-today-face {
|
|
114
|
+
height: calc(100% + 2 * var(--gallery-card-pad));
|
|
115
|
+
margin: calc(-1 * var(--gallery-card-pad));
|
|
116
|
+
padding: var(--gallery-card-pad);
|
|
117
|
+
border-radius: calc(var(--gallery-card-radius) - 1px);
|
|
118
|
+
background: linear-gradient(160deg, var(--gallery-today-glow) 0%, transparent 62%);
|
|
119
|
+
}
|
|
120
|
+
.gallery-card > [data-doc-component="gallery/today"] > .gallery-today-face[data-sky="moon"] { background: linear-gradient(160deg, var(--gallery-today-glow-evening) 0%, transparent 62%); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-doc-component="gallery/today"></div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 问候与日期 (gallery/today)
|
|
2
|
+
|
|
3
|
+
A card for a custom page (its places are `page`): a greeting by the time of day (早上好, 下午好, 晚上好), today's date and its weekday, in the language Gallery's UI speaks. Use it at the top of a home page or of any page the user opens every day.
|
|
4
|
+
|
|
5
|
+
## How to write it
|
|
6
|
+
|
|
7
|
+
Put it on a custom page as a card of its board, `<section class="gallery-card" data-card-id="…" data-x data-y data-w data-h>`, holding one instance, after `gallery block add today`: the instance is empty, `<div data-doc-component="gallery/today"></div>`, everything on it drawn by its script. It has no settings and holds no data: there is nothing to fill in and nothing it writes.
|
|
8
|
+
|
|
9
|
+
- Sizes: 4 × 2 (the default: the date at the top, the greeting in the middle, the week at the bottom) and 2 × 2 (the date and the greeting, no week). The user may switch between them.
|
|
10
|
+
- Its places hold no document: no document's menu offers it. In a document it would show the same words, framed by nothing.
|
|
11
|
+
|
|
12
|
+
## How it looks
|
|
13
|
+
|
|
14
|
+
The date beside a chip of the sun (by day) or the moon (in the evening) at the top, the number of the week (第 46 周) at its end, the greeting large in the middle, a soft glow at the card's top left (warm by day, the accent's blue in the evening), and on a card wide enough the week it is in at the bottom, Monday to Sunday, today's 今 over its date and marked (a 2 × 2 card's top line the date alone, no weekday); in the kit's card tokens (as every Gallery card: a head of a tinted chip and a title, its end clear of the card's grip), light and dark. It changes by itself: the greeting as the hour turns (it hears the kit's clock each minute), the date at midnight. The script runs with the rights of the page's own scripts, as any block's does.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/todos",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.3.0",
|
|
5
|
+
"name": { "zh": "我的待办", "en": "My to-dos" },
|
|
6
|
+
"description": { "zh": "所有文档里没完成的待办:勾选就写回那篇文档,点文字打开它", "en": "The to-dos of every document not done yet: check one in its document, or click it to open it there" },
|
|
7
|
+
"words": "wodedaiban daiban renwu todo todos tasks checklist 待办 任务 清单 我的待办 没完成",
|
|
8
|
+
"parts": {
|
|
9
|
+
"settings": { "at": ":scope > script", "edit": "data" }
|
|
10
|
+
},
|
|
11
|
+
"runtime": { "generated": [":scope > .gallery-todos-face"] },
|
|
12
|
+
"places": ["page"],
|
|
13
|
+
"card": { "sizes": [[4, 4], [4, 6], [8, 4]], "resize": true },
|
|
14
|
+
"settings": [
|
|
15
|
+
{ "key": "document", "label": { "zh": "只看这篇文档", "en": "Only this document" }, "type": "document" },
|
|
16
|
+
{ "key": "done", "label": { "zh": "也显示已完成的", "en": "Show done ones too" }, "type": "switch", "default": false }
|
|
17
|
+
],
|
|
18
|
+
"needs": ["workspace"]
|
|
19
|
+
}
|