@heycys/gallery 0.1.1 → 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 +1 -1
- package/browser/editor/components/columns/page.mjs +4 -4
- package/browser/editor/components/embed/index.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/icons.mjs +8 -0
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/installed/index.mjs +11 -4
- package/browser/editor/components/installed/page.mjs +27 -16
- 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/registry.mjs +13 -4
- package/browser/editor/components/table/index.mjs +59 -2
- package/browser/editor/components/table/page.mjs +1 -1
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/autosave.mjs +310 -37
- 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 +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 +124 -13
- package/browser/editor/page/clipboard/own/blocks.mjs +11 -11
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- 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 +31 -15
- package/browser/editor/page/custom-page.mjs +106 -0
- package/browser/editor/page/editor.mjs +51 -14
- 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 +24 -4
- 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 +18 -7
- package/browser/editor/page/notices.mjs +2 -2
- package/browser/editor/page/page-objects.mjs +13 -2
- package/browser/editor/page/panel.mjs +4 -9
- package/browser/editor/page/present-links.mjs +11 -2
- package/browser/editor/page/resize/index.mjs +42 -29
- 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/cells.mjs +102 -46
- package/browser/editor/page/table/icons.mjs +2 -0
- package/browser/editor/page/table/index.mjs +29 -10
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +150 -0
- 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 +53 -3
- package/browser/editor/page/ui.mjs +13 -0
- 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/colors.mjs +3 -2
- package/browser/shared/component-catalog.mjs +323 -46
- package/browser/shared/component-source.mjs +37 -0
- package/browser/shared/components/index.mjs +12 -3
- package/browser/shared/components/installed.mjs +35 -3
- package/browser/shared/components/page.mjs +18 -8
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/document-look.mjs +10 -5
- package/browser/shared/drafts.mjs +432 -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/i18n/en.mjs +307 -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 +331 -67
- 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/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +8 -1
- 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-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-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-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/{chunk-Y6RLRPG3.mjs → chunk-6VTU6KEO.mjs} +1 -1
- package/dist/chunk-B4P2CM2J.mjs +3 -0
- package/dist/{chunk-FDLXYYG4.mjs → chunk-BPL64HGA.mjs} +1 -1
- package/dist/chunk-BVEFGE4B.mjs +2 -0
- package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
- package/dist/chunk-CRJEG7MT.mjs +2 -0
- package/dist/{chunk-LCTHTZIL.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-GB5SOYQJ.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-KTKHRC6H.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/{chunk-SYGN7GLU.mjs → chunk-MHW7ZKOU.mjs} +1 -1
- package/dist/chunk-N76HWBA3.mjs +10 -0
- package/dist/chunk-N7AZZLGT.mjs +548 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-5ZKJ3H4P.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-4FS7Z7WR.mjs → chunk-OUUP3WKT.mjs} +1 -1
- package/dist/{chunk-BGGDRNYQ.mjs → chunk-OW5NWPOJ.mjs} +1 -1
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-POQSE4C2.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/{chunk-XNROSH2T.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-7DTINW6U.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-UNOYVIYR.mjs +2 -0
- package/dist/{chunk-E7LWZRXY.mjs → chunk-V6RIYQZZ.mjs} +1 -1
- 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-YI43RG4P.mjs +2 -0
- package/dist/chunk-YQGT4AB2.mjs +6 -0
- package/dist/chunk-ZB4H7ZN4.mjs +2 -0
- package/dist/{chunk-IVDLMMBD.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-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 +14 -14
- package/kit/report.css +255 -17
- package/kit/runtime.js +1600 -125
- package/kit/state.js +10 -1
- package/kit/tables.js +128 -43
- package/kit/ui.js +77 -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 +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 +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 +221 -0
- package/skill/references/writing-html.md +6 -4
- package/skill/sdk/doc-kit.d.ts +396 -5
- 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/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-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
|
@@ -0,0 +1,94 @@
|
|
|
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. A framed card of the kit's (gallery/chart-card's look): its title, the
|
|
3
|
+
settings (⚙) at the right of its head while the page edits and the strip they open under it, then
|
|
4
|
+
horizontal bars from zero, each its name at its left and its value at its end, in the kit's first
|
|
5
|
+
series color, which follows the theme; laid out in percents of the card's width, so that a width
|
|
6
|
+
draws nothing again. A muted line where there is nothing to draw or more than it draws. */
|
|
7
|
+
[data-doc-component="gallery/chart-view"] {
|
|
8
|
+
margin: var(--doc-component-gap) 0;
|
|
9
|
+
padding: 16px 20px 12px;
|
|
10
|
+
border: 1px solid var(--doc-border);
|
|
11
|
+
border-radius: 10px;
|
|
12
|
+
background: var(--doc-surface);
|
|
13
|
+
> .gallery-chart-view-face { color: var(--doc-text); }
|
|
14
|
+
> .gallery-chart-view-face > .gallery-chart-view-head {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 8px;
|
|
18
|
+
min-height: 26px;
|
|
19
|
+
margin: 0 0 10px;
|
|
20
|
+
> .gallery-chart-view-title { flex: 1 1 auto; min-width: 0; font-size: var(--doc-card-title-font-size); line-height: var(--doc-card-title-line-height); font-weight: 600; letter-spacing: -.025em; }
|
|
21
|
+
> .gallery-chart-view-gear {
|
|
22
|
+
display: none;
|
|
23
|
+
flex: none;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
width: 26px;
|
|
27
|
+
height: 26px;
|
|
28
|
+
margin: 0 -8px 0 0;
|
|
29
|
+
padding: 0;
|
|
30
|
+
border: 0;
|
|
31
|
+
border-radius: 6px;
|
|
32
|
+
background: transparent;
|
|
33
|
+
color: var(--doc-muted);
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
opacity: 0;
|
|
36
|
+
transition: opacity .12s;
|
|
37
|
+
}
|
|
38
|
+
> .gallery-chart-view-gear > svg { width: 16px; height: 16px; }
|
|
39
|
+
> .gallery-chart-view-gear:hover { background: var(--doc-hover); color: var(--doc-text); }
|
|
40
|
+
> .gallery-chart-view-gear[aria-expanded="true"] { background: var(--doc-press); color: var(--doc-text); opacity: 1; }
|
|
41
|
+
}
|
|
42
|
+
> .gallery-chart-view-face > .gallery-chart-view-head.gallery-chart-view-untitled { margin-bottom: 2px; }
|
|
43
|
+
> .gallery-chart-view-face > .gallery-chart-view-head[hidden] { display: none; }
|
|
44
|
+
> .gallery-chart-view-face[data-writes] > .gallery-chart-view-head > .gallery-chart-view-gear { display: inline-flex; }
|
|
45
|
+
> .gallery-chart-view-face[data-writes]:hover > .gallery-chart-view-head > .gallery-chart-view-gear,
|
|
46
|
+
> .gallery-chart-view-face[data-writes]:focus-within > .gallery-chart-view-head > .gallery-chart-view-gear { opacity: 1; }
|
|
47
|
+
> .gallery-chart-view-face > .gallery-chart-view-strip {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
gap: 6px 14px;
|
|
51
|
+
margin: -4px 0 12px;
|
|
52
|
+
padding: 8px 10px;
|
|
53
|
+
border-radius: 8px;
|
|
54
|
+
background: var(--doc-hover);
|
|
55
|
+
font-size: 12px;
|
|
56
|
+
> .gallery-chart-view-setting { display: inline-flex; align-items: center; gap: 6px; color: var(--doc-muted); }
|
|
57
|
+
> .gallery-chart-view-setting[hidden] { display: none; }
|
|
58
|
+
> .gallery-chart-view-setting > select,
|
|
59
|
+
> .gallery-chart-view-setting > input {
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
max-width: 180px;
|
|
62
|
+
height: 24px;
|
|
63
|
+
padding: 2px 6px;
|
|
64
|
+
border: 1px solid var(--doc-border);
|
|
65
|
+
border-radius: 6px;
|
|
66
|
+
background: var(--doc-surface);
|
|
67
|
+
color: var(--doc-text);
|
|
68
|
+
font: inherit;
|
|
69
|
+
}
|
|
70
|
+
/* A select is a button that opens the kit's menu (DocKit's choices): no line, as every button. */
|
|
71
|
+
> .gallery-chart-view-setting > select { border: 0; cursor: pointer; }
|
|
72
|
+
> .gallery-chart-view-setting > input { width: 160px; }
|
|
73
|
+
}
|
|
74
|
+
> .gallery-chart-view-face > .gallery-chart-view-strip[hidden] { display: none; }
|
|
75
|
+
> .gallery-chart-view-face > .gallery-chart-view-bars {
|
|
76
|
+
display: grid;
|
|
77
|
+
grid-template-columns: fit-content(40%) minmax(0, 1fr);
|
|
78
|
+
gap: 8px 12px;
|
|
79
|
+
align-items: center;
|
|
80
|
+
margin: 0 0 4px;
|
|
81
|
+
font-size: 13px;
|
|
82
|
+
line-height: 1.4;
|
|
83
|
+
> .gallery-chart-view-row { display: contents; }
|
|
84
|
+
> .gallery-chart-view-row > .gallery-chart-view-label { text-align: right; overflow-wrap: anywhere; color: var(--doc-text); }
|
|
85
|
+
> .gallery-chart-view-row > .gallery-chart-view-lane { position: relative; height: 18px; margin-right: 4.5em; }
|
|
86
|
+
> .gallery-chart-view-row > .gallery-chart-view-lane > .gallery-chart-view-bar { position: absolute; top: 0; bottom: 0; min-width: 1px; border-radius: 3px; background: var(--doc-series-1); }
|
|
87
|
+
> .gallery-chart-view-row > .gallery-chart-view-lane > .gallery-chart-view-bar[hidden] { display: none; }
|
|
88
|
+
> .gallery-chart-view-row > .gallery-chart-view-lane > .gallery-chart-view-value { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; line-height: 1; color: var(--doc-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
89
|
+
&.gallery-chart-view-below > .gallery-chart-view-row > .gallery-chart-view-lane { margin-left: 4.5em; background: linear-gradient(var(--doc-grid), var(--doc-grid)) var(--gallery-chart-view-zero) 0 / 1px 100% no-repeat; }
|
|
90
|
+
}
|
|
91
|
+
> .gallery-chart-view-face > .gallery-chart-view-bars[hidden] { display: none; }
|
|
92
|
+
> .gallery-chart-view-face > .gallery-chart-view-line { margin: 6px 0 2px; font-size: 13px; line-height: 1.5; color: var(--doc-muted); }
|
|
93
|
+
> .gallery-chart-view-face > .gallery-chart-view-line[hidden] { display: none; }
|
|
94
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# 图表 (gallery/chart-view)
|
|
2
|
+
|
|
3
|
+
A bar chart of a table of the document: the rows counted, summed or averaged by a column (tasks by status, sales by region), or a bar for each row's number. It is a view of the table, drawn again as the table is typed in: the table holds the data, the chart never writes it. Use it beside a 看板 or a few 指标 over the same table. For a chart of numbers written for the chart alone, use 表格图表卡片 (gallery/chart-card), whose table is its own; for any other kind of chart, a chart of the document's (references/writing-html.md, "Figures and charts").
|
|
4
|
+
|
|
5
|
+
## How to write it
|
|
6
|
+
|
|
7
|
+
Write a table, then the chart, as example.html does (`gallery block show gallery/chart-view` prints it):
|
|
8
|
+
|
|
9
|
+
- the table: an ordinary table of the document whose `<table>` carries `data-doc-chart-source="<key>"`, a key of the document's own (a letter, then letters, digits, `_` or `-`; 32 at most), its header row naming the columns, the first column naming each row. No merged cells.
|
|
10
|
+
- the chart: `<div data-doc-component="gallery/chart-view" data-doc-from="<key>">`, the same key, holding its settings, one `<script type="application/json">` on one line, each optional:
|
|
11
|
+
- `by`: the column whose values are the bars, the rows grouped by it in the order they first say them. Left out, a column named like a status (状态, 阶段, status), else one whose words repeat; with none, a bar for each row (its first cell its name; at most 50);
|
|
12
|
+
- `op`: `"count"`, `"sum"` or `"average"` of each group's rows. Left out: `"sum"` where the table has a column of numbers, else `"count"`;
|
|
13
|
+
- `value`: the column of numbers summed, averaged, or drawn a bar a row. Left out: the first column of numbers;
|
|
14
|
+
- `title`: what it shows, with its unit. Left out, one is made (各状态的行数, 各区域的金额合计).
|
|
15
|
+
|
|
16
|
+
One table may have several views (a 看板, 指标, another chart), each with the same key.
|
|
17
|
+
|
|
18
|
+
The reader adds a chart in Gallery from a table's menu, 视图 › 图表, which writes the key on both; it is not in "/", as a chart needs its table. Its ⚙ (where the page edits) changes its settings.
|
|
19
|
+
|
|
20
|
+
## How it looks
|
|
21
|
+
|
|
22
|
+
A framed card: its title, then horizontal bars from zero, each with its name and its value, in the kit's series color, which follows the theme. The bars are drawn by the block's script and are not in the file: where the block is not, and in a Markdown export, a reader has the table.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/countdown",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.3.0",
|
|
5
|
+
"name": { "zh": "倒计时", "en": "Countdown" },
|
|
6
|
+
"description": { "zh": "离某一天还有几天,到了那天说今天,过了说已经几天", "en": "How many days until a date: today on the day, and the days since after it" },
|
|
7
|
+
"words": "daojishi daoshu countdown days until 倒计时 倒数日 纪念日 日子",
|
|
8
|
+
"parts": {
|
|
9
|
+
"settings": { "at": ":scope > script", "edit": "data" }
|
|
10
|
+
},
|
|
11
|
+
"runtime": { "generated": [":scope > .gallery-countdown-face"] },
|
|
12
|
+
"places": ["page"],
|
|
13
|
+
"card": { "sizes": [[2, 2], [4, 2]], "resize": true },
|
|
14
|
+
"settings": [
|
|
15
|
+
{ "key": "title", "label": { "zh": "名称", "en": "Name" }, "type": "text", "default": "" },
|
|
16
|
+
{ "key": "date", "label": { "zh": "日期", "en": "Date" }, "type": "date", "required": true }
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// gallery/countdown (倒计时): the days between today, by the reader's clock, and the date its settings
|
|
2
|
+
// name: how many are left before it, 今天 on the day itself, how many have gone since after it. Its two
|
|
3
|
+
// settings, `title` (the name of the day) and `date` (YYYY-MM-DD), are the card's form (on a custom page
|
|
4
|
+
// the grip at the card's top right › 设置…), kept in the data part `settings`, a script of JSON, which the board writes and this block
|
|
5
|
+
// only reads: it writes nothing. Drawn from that part on every `source` (the form, an Agent's write, an
|
|
6
|
+
// undo) and again as a day begins (the kit's `clock`, "day"), so that the count moves at midnight. A
|
|
7
|
+
// date it cannot read, or none, asks for one; the words are the page's language (the UI's where Gallery
|
|
8
|
+
// says it, else the page's lang). Its head is the cards' (the kit's card tokens): the chip, an hourglass,
|
|
9
|
+
// before the day's name alone (春节, or 倒计时 where it has none), on one line; under it the count's label
|
|
10
|
+
// (还有, 已经过去) over the count, large, and its unit, the family's label over a number; its face says by
|
|
11
|
+
// `data-kind` which of left, today, since or none it shows.
|
|
12
|
+
|
|
13
|
+
const WORDS = {
|
|
14
|
+
zh: {
|
|
15
|
+
left: "还有",
|
|
16
|
+
since: "已经过去",
|
|
17
|
+
today: "就是今天",
|
|
18
|
+
days: (/** @type {number} */ count) => `${count}`,
|
|
19
|
+
unit: () => "天",
|
|
20
|
+
countdown: "倒计时",
|
|
21
|
+
pick: "选一个日期",
|
|
22
|
+
where: "右上角手柄 › 设置…",
|
|
23
|
+
weekdays: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
|
24
|
+
date: (/** @type {number} */ year, /** @type {number} */ month, /** @type {number} */ day, /** @type {string} */ weekday) => [`${year}年${month}月${day}日`, weekday],
|
|
25
|
+
},
|
|
26
|
+
en: {
|
|
27
|
+
left: "Days left",
|
|
28
|
+
since: "Days since",
|
|
29
|
+
today: "Today",
|
|
30
|
+
days: (/** @type {number} */ count) => `${count}`,
|
|
31
|
+
unit: (/** @type {number} */ count) => (count === 1 ? "day" : "days"),
|
|
32
|
+
countdown: "Countdown",
|
|
33
|
+
pick: "Pick a date",
|
|
34
|
+
where: "The grip at the top right › Settings…",
|
|
35
|
+
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
36
|
+
date: (/** @type {number} */ year, /** @type {number} */ month, /** @type {number} */ day, /** @type {string} */ weekday) => [`${weekday},`, `${["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][month - 1]} ${day}, ${year}`],
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** The language the page speaks: the UI's where Gallery says it (data-ge-language), else its lang's. */
|
|
41
|
+
function languageOf(/** @type {HTMLElement} */ root) {
|
|
42
|
+
const ui = root.getAttribute("data-ge-language");
|
|
43
|
+
return (ui !== null ? ui === "en" : /^en(?:-|$)/i.test(root.lang)) ? "en" : "zh";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A date written YYYY-MM-DD as { year, month, day }, or null for anything else (no such day too:
|
|
48
|
+
* 2027-02-30).
|
|
49
|
+
* @param {unknown} written
|
|
50
|
+
*/
|
|
51
|
+
function dateOf(written) {
|
|
52
|
+
const found = typeof written === "string" ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(written) : null;
|
|
53
|
+
if (!found) return null;
|
|
54
|
+
const [year, month, day] = found.slice(1).map(Number);
|
|
55
|
+
const date = new Date(Date.UTC(year, month - 1, day));
|
|
56
|
+
return date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day ? { year, month, day } : null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Where `now` (the reader's clock) stands to the date `written` (YYYY-MM-DD): { kind: "left", days }
|
|
61
|
+
* before it, { kind: "today", days: 0 } on it, { kind: "since", days } after it, by whole days of the
|
|
62
|
+
* calendar (counted in UTC from each day's date, so that a change of the clocks in between changes
|
|
63
|
+
* nothing); { kind: "none" } for a date it cannot read.
|
|
64
|
+
* @param {unknown} written
|
|
65
|
+
* @param {Date} now
|
|
66
|
+
* @returns {{ kind: "left" | "since" | "today", days: number } | { kind: "none" }}
|
|
67
|
+
*/
|
|
68
|
+
function countdownOf(written, now) {
|
|
69
|
+
const date = dateOf(written);
|
|
70
|
+
if (!date) return { kind: "none" };
|
|
71
|
+
const days = Math.round((Date.UTC(date.year, date.month - 1, date.day) - Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())) / 86_400_000);
|
|
72
|
+
if (days === 0) return { kind: "today", days: 0 };
|
|
73
|
+
return days > 0 ? { kind: "left", days } : { kind: "since", days: -days };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* What the card says, in `language`, of its `settings` (context.readJSON's, {} where none is set yet)
|
|
78
|
+
* at `now`: its head (the day's name, or 倒计时), the count's label (还有, 已经过去; "" with no count), its
|
|
79
|
+
* count (null on the day and with no date; `big`, the words standing there instead), the count's unit, and
|
|
80
|
+
* its foot, a list of words a line breaks between and never inside (the date, its weekday).
|
|
81
|
+
* @param {any} settings
|
|
82
|
+
* @param {Date} now
|
|
83
|
+
* @param {"zh" | "en"} language
|
|
84
|
+
*/
|
|
85
|
+
function faceOf(settings, now, language) {
|
|
86
|
+
const words = WORDS[language];
|
|
87
|
+
const date = dateOf(settings?.date);
|
|
88
|
+
const named = typeof settings?.title === "string" ? settings.title.trim() : "";
|
|
89
|
+
const count = countdownOf(settings?.date, now);
|
|
90
|
+
const head = named || words.countdown;
|
|
91
|
+
if (!date || count.kind === "none") return { head, label: "", count: null, unit: "", big: words.pick, foot: [words.where] };
|
|
92
|
+
const weekday = words.weekdays[new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay()];
|
|
93
|
+
const foot = words.date(date.year, date.month, date.day, weekday);
|
|
94
|
+
if (count.kind === "today") return { head, label: "", count: null, unit: "", big: words.today, foot };
|
|
95
|
+
return { head, label: count.kind === "left" ? words.left : words.since, count: words.days(count.days), unit: words.unit(count.days), big: "", foot };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* An element of the face, of `kind` (its class).
|
|
100
|
+
* @template {keyof HTMLElementTagNameMap} K
|
|
101
|
+
* @param {K} tag
|
|
102
|
+
* @param {string} kind
|
|
103
|
+
*/
|
|
104
|
+
function made(tag, kind) {
|
|
105
|
+
const node = document.createElement(tag);
|
|
106
|
+
node.className = `gallery-countdown-${kind}`;
|
|
107
|
+
return node;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
DocKit.component({
|
|
111
|
+
id: "gallery/countdown",
|
|
112
|
+
on: ["source", "clock"],
|
|
113
|
+
mount(host, context) {
|
|
114
|
+
const language = languageOf(document.documentElement);
|
|
115
|
+
const face = made("div", "face");
|
|
116
|
+
const head = made("p", "head");
|
|
117
|
+
const chip = made("span", "chip");
|
|
118
|
+
chip.setAttribute("aria-hidden", "true");
|
|
119
|
+
chip.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 7h11M6.5 17h11M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zM6 4v2a6 6 0 1 0 12 0V4a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z"/></svg>';
|
|
120
|
+
const named = made("span", "name");
|
|
121
|
+
head.append(chip, named);
|
|
122
|
+
const label = made("p", "label");
|
|
123
|
+
const middle = made("p", "count");
|
|
124
|
+
const foot = made("p", "foot");
|
|
125
|
+
face.append(head, label, middle, foot);
|
|
126
|
+
host.append(face);
|
|
127
|
+
const draw = (/** @type {string} */ reason = "", /** @type {unknown} */ detail = null) => {
|
|
128
|
+
if (reason === "clock" && detail !== "day") return; // a minute moves no count
|
|
129
|
+
const settings = context.readJSON("settings");
|
|
130
|
+
if (settings === undefined) return; // no JSON: the instance has failed, and Gallery shows what it holds
|
|
131
|
+
if (settings === null || typeof settings !== "object" || Array.isArray(settings)) return context.fail(new Error("its settings are no object: { \"title\": \"…\", \"date\": \"YYYY-MM-DD\" }"));
|
|
132
|
+
const at = new Date();
|
|
133
|
+
const now = faceOf(settings, at, language);
|
|
134
|
+
face.dataset.kind = countdownOf(settings.date, at).kind;
|
|
135
|
+
named.textContent = now.head;
|
|
136
|
+
named.title = now.head;
|
|
137
|
+
label.textContent = now.label;
|
|
138
|
+
if (now.count === null) {
|
|
139
|
+
middle.classList.add("gallery-countdown-words");
|
|
140
|
+
middle.textContent = now.big;
|
|
141
|
+
} else {
|
|
142
|
+
middle.classList.remove("gallery-countdown-words");
|
|
143
|
+
const unit = made("span", "unit");
|
|
144
|
+
unit.textContent = now.unit;
|
|
145
|
+
middle.replaceChildren(now.count, unit);
|
|
146
|
+
}
|
|
147
|
+
foot.replaceChildren(...now.foot.flatMap((words, index) => {
|
|
148
|
+
const piece = made("span", "piece");
|
|
149
|
+
piece.textContent = words;
|
|
150
|
+
return index === 0 ? [piece] : [" ", piece];
|
|
151
|
+
}));
|
|
152
|
+
};
|
|
153
|
+
draw();
|
|
154
|
+
return { update: draw };
|
|
155
|
+
},
|
|
156
|
+
});
|
|
@@ -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="#ebf2fa"/><g transform="translate(32 26) scale(.4167)" fill="none" stroke="#2e7cd1" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 7h11M6.5 17h11M6 20v-2a6 6 0 1 1 12 0v2a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zM6 4v2a6 6 0 1 0 12 0V4a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z"/></g><rect x="50" y="28" width="24" height="6" rx="3" fill="#3b3a37"/><rect x="30" y="49" width="16" height="5" rx="2.5" fill="#c4c2bd"/><text x="28" y="84" font-family="Segoe UI, Helvetica, Arial, sans-serif" font-size="34" font-weight="600" letter-spacing="-.5" fill="#3b3a37">89</text><rect x="72" y="74" width="11" height="9" rx="2.5" fill="#c4c2bd"/><rect x="30" y="93" width="82" height="5" rx="2.5" fill="#c4c2bd"/></svg>
|
|
@@ -0,0 +1,130 @@
|
|
|
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 at the top (the chip, then the day's name on one line, cut with an
|
|
4
|
+
ellipsis, its end clear of the card's grip), the count's label small and muted over the count, large
|
|
5
|
+
(the cards' hero size), its unit small and muted after it, the two in the middle of the room between the
|
|
6
|
+
head and the date, which is muted at the bottom. On the day itself the words stand in the accent. With
|
|
7
|
+
no date yet, the cards' empty face: a quiet picture (a calendar) in a soft disc over a muted line, where
|
|
8
|
+
to set one under it, in the middle of the room under the head. Light and dark. */
|
|
9
|
+
[data-doc-component="gallery/countdown"] {
|
|
10
|
+
container-type: inline-size;
|
|
11
|
+
> .gallery-countdown-face {
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
justify-content: flex-start;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
height: 100%;
|
|
18
|
+
min-height: 0;
|
|
19
|
+
color: var(--gallery-text);
|
|
20
|
+
}
|
|
21
|
+
> .gallery-countdown-face > p { margin: 0; }
|
|
22
|
+
> .gallery-countdown-face > .gallery-countdown-head {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 8px;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
padding-inline-end: var(--gallery-grip-room, 0px);
|
|
28
|
+
font-size: var(--gallery-title-size);
|
|
29
|
+
line-height: var(--gallery-title-line);
|
|
30
|
+
font-weight: 600;
|
|
31
|
+
color: var(--gallery-text-strong);
|
|
32
|
+
}
|
|
33
|
+
> .gallery-countdown-face > .gallery-countdown-head > .gallery-countdown-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-countdown-face > .gallery-countdown-head > .gallery-countdown-chip > svg { width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
|
|
45
|
+
> .gallery-countdown-face > .gallery-countdown-head > .gallery-countdown-name {
|
|
46
|
+
min-width: 0;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
}
|
|
51
|
+
/* The count's label over it, the two in the middle of the room between the head and the date. */
|
|
52
|
+
> .gallery-countdown-face > .gallery-countdown-label {
|
|
53
|
+
margin-top: auto;
|
|
54
|
+
font-size: var(--gallery-meta-size);
|
|
55
|
+
line-height: 16px;
|
|
56
|
+
color: var(--doc-muted);
|
|
57
|
+
}
|
|
58
|
+
> .gallery-countdown-face > .gallery-countdown-label:empty { display: none; }
|
|
59
|
+
> .gallery-countdown-face > .gallery-countdown-label:empty + .gallery-countdown-count { margin-top: auto; }
|
|
60
|
+
> .gallery-countdown-face > .gallery-countdown-count {
|
|
61
|
+
margin-top: -4px;
|
|
62
|
+
font-size: var(--gallery-hero-size);
|
|
63
|
+
line-height: 1.1;
|
|
64
|
+
font-weight: var(--gallery-numeral-weight);
|
|
65
|
+
letter-spacing: var(--gallery-numeral-tracking);
|
|
66
|
+
color: var(--gallery-text-strong);
|
|
67
|
+
font-variant-numeric: tabular-nums;
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
}
|
|
70
|
+
> .gallery-countdown-face > .gallery-countdown-count > .gallery-countdown-unit {
|
|
71
|
+
margin-inline-start: var(--gallery-unit-gap);
|
|
72
|
+
font-size: max(12px, var(--gallery-unit-size));
|
|
73
|
+
font-weight: 500;
|
|
74
|
+
letter-spacing: 0;
|
|
75
|
+
color: var(--doc-muted);
|
|
76
|
+
}
|
|
77
|
+
/* Today, or no date yet: words where the count stands, smaller; the day itself in the accent. */
|
|
78
|
+
> .gallery-countdown-face > .gallery-countdown-count.gallery-countdown-words {
|
|
79
|
+
font-size: min(var(--gallery-figure-size), 13cqi);
|
|
80
|
+
line-height: 1.2;
|
|
81
|
+
letter-spacing: -.01em;
|
|
82
|
+
white-space: normal;
|
|
83
|
+
}
|
|
84
|
+
> .gallery-countdown-face[data-kind="today"] > .gallery-countdown-count { color: var(--gallery-accent); }
|
|
85
|
+
/* No date yet: the cards' empty face (as todos' and recent's), the line and where to set it in the middle. */
|
|
86
|
+
> .gallery-countdown-face[data-kind="none"] { justify-content: flex-start; }
|
|
87
|
+
> .gallery-countdown-face[data-kind="none"] > .gallery-countdown-count {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
align-items: center;
|
|
91
|
+
gap: 8px;
|
|
92
|
+
margin-top: auto;
|
|
93
|
+
font-size: 13px;
|
|
94
|
+
line-height: 1.45;
|
|
95
|
+
font-weight: 400;
|
|
96
|
+
letter-spacing: 0;
|
|
97
|
+
color: var(--doc-muted);
|
|
98
|
+
text-align: center;
|
|
99
|
+
}
|
|
100
|
+
> .gallery-countdown-face[data-kind="none"] > .gallery-countdown-count::before {
|
|
101
|
+
content: "";
|
|
102
|
+
flex: none;
|
|
103
|
+
width: 44px;
|
|
104
|
+
height: 44px;
|
|
105
|
+
margin-bottom: 2px;
|
|
106
|
+
background: currentColor;
|
|
107
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Ccircle cx='22' cy='22' r='22' fill-opacity='.14'/%3E%3Cg transform='translate(11 11) scale(.9167)' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7z'/%3E%3Cpath d='M16 3v4M8 3v4M4 11h16'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
|
|
108
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 44'%3E%3Ccircle cx='22' cy='22' r='22' fill-opacity='.14'/%3E%3Cg transform='translate(11 11) scale(.9167)' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7z'/%3E%3Cpath d='M16 3v4M8 3v4M4 11h16'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
|
|
109
|
+
}
|
|
110
|
+
> .gallery-countdown-face[data-kind="none"] > .gallery-countdown-foot { margin-top: 0; margin-bottom: auto; text-align: center; opacity: .8; }
|
|
111
|
+
> .gallery-countdown-face > .gallery-countdown-foot {
|
|
112
|
+
margin-top: auto;
|
|
113
|
+
font-size: var(--gallery-meta-size);
|
|
114
|
+
line-height: 1.45;
|
|
115
|
+
color: var(--doc-muted);
|
|
116
|
+
}
|
|
117
|
+
/* The date and its weekday break between them, never inside either. */
|
|
118
|
+
> .gallery-countdown-face > .gallery-countdown-foot > .gallery-countdown-piece { display: inline-block; }
|
|
119
|
+
}
|
|
120
|
+
/* On a custom page the face is the card's: as high as what the card holds inside its padding, and a
|
|
121
|
+
container of that height too. A narrow card (two cells wide) shows the date alone, its weekday left
|
|
122
|
+
out, which would take a second line its two rows of cells have no room for; a low card's empty face
|
|
123
|
+
says where to set a date in its words alone, the picture over them left out. */
|
|
124
|
+
.gallery-card > [data-doc-component="gallery/countdown"] { height: 100%; container-type: size; }
|
|
125
|
+
@container (max-width: 180px) {
|
|
126
|
+
[data-doc-component="gallery/countdown"] > .gallery-countdown-face:not([data-kind="none"]) > .gallery-countdown-foot > .gallery-countdown-piece ~ .gallery-countdown-piece { display: none; }
|
|
127
|
+
}
|
|
128
|
+
@container (max-height: 150px) {
|
|
129
|
+
[data-doc-component="gallery/countdown"] > .gallery-countdown-face[data-kind="none"] > .gallery-countdown-count::before { display: none; }
|
|
130
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# 倒计时 (gallery/countdown)
|
|
2
|
+
|
|
3
|
+
A card for a custom page (its places are `page`): how many days are left until a date, 就是今天 on the day, and how many days have gone since after it. Use it for a day the user waits for or counts from (a holiday, a deadline, an anniversary).
|
|
4
|
+
|
|
5
|
+
## Settings
|
|
6
|
+
|
|
7
|
+
Its two settings are the card's form, which the user opens from the grip at the card's top right › 设置…:
|
|
8
|
+
|
|
9
|
+
| Key | Label | Type | What it is |
|
|
10
|
+
| --- | --- | --- | --- |
|
|
11
|
+
| `title` | 名称 | text | the name of the day, as 春节 or 项目上线; left empty, the card says 还有 / 已经过去 alone |
|
|
12
|
+
| `date` | 日期 | date | the day, `YYYY-MM-DD` |
|
|
13
|
+
|
|
14
|
+
They are kept in its data part `settings`, a `<script type="application/json">`, as example.html does: `{"title":"春节","date":"2027-02-06"}` (on one line and compact, as the card's 设置… writes it back). Write them there when the user tells you the day, or `gallery page add <slug> gallery/countdown --set date=2027-02-06 --set title=春节` with the add; the date is the one setting it cannot show anything without (`required` in its manifest): ask the user for it when they did not say which day. `{}` (template.html, what a menu adds) is a card with no date yet, which asks for one (右上角手柄 › 设置…), and `gallery page check` notes it. The block reads them and writes nothing.
|
|
15
|
+
|
|
16
|
+
## How to write it
|
|
17
|
+
|
|
18
|
+
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 countdown`, the instance as template.html has it, then its settings as above. Sizes: 2 × 2 (the default) and 4 × 2.
|
|
19
|
+
|
|
20
|
+
## How it looks
|
|
21
|
+
|
|
22
|
+
The day's name at the top beside an hourglass's chip, on one line (春节; 倒计时 where it has none), under it 还有 (or 已经过去) over the count of days, large, and the date with its weekday at the bottom, muted; on the day itself 就是今天 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. The count moves by itself at midnight (it hears the kit's clock). The script runs with the rights of the page's own scripts, as any block's does.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "gallery/habit",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.2.0",
|
|
5
|
+
"name": { "zh": "习惯打卡", "en": "Habit tracker" },
|
|
6
|
+
"description": { "zh": "每天打一次卡,显示连续了几天和最近一周,名字在卡片上直接改", "en": "A check-in a day, the streak and the last seven days; the habit's name is edited on the card" },
|
|
7
|
+
"words": "xiguandaka xiguan daka habit streak checkin tracker 习惯 打卡 连续 坚持",
|
|
8
|
+
"parts": {
|
|
9
|
+
"habit": { "at": ":scope > script", "edit": "data" }
|
|
10
|
+
},
|
|
11
|
+
"runtime": { "generated": [":scope > .gallery-habit-face"] },
|
|
12
|
+
"places": ["page"],
|
|
13
|
+
"card": { "sizes": [[4, 2], [2, 2]], "resize": true }
|
|
14
|
+
}
|