@heycys/gallery 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/embed/page.mjs +1 -1
- package/browser/editor/components/file/page.mjs +4 -4
- package/browser/editor/components/heading/index.mjs +7 -6
- package/browser/editor/components/icon/page.mjs +6 -4
- package/browser/editor/components/icons.mjs +5 -2
- package/browser/editor/components/image/index.mjs +2 -0
- package/browser/editor/components/image/page.mjs +172 -90
- package/browser/editor/components/installed/index.mjs +6 -2
- package/browser/editor/components/installed/page.mjs +80 -13
- package/browser/editor/components/media/icons.mjs +13 -8
- package/browser/editor/components/media/page.mjs +5 -3
- package/browser/editor/components/media/toolbar.mjs +12 -3
- package/browser/editor/components/paragraph/index.mjs +4 -3
- package/browser/editor/components/registry.mjs +17 -5
- package/browser/editor/components/table/index.mjs +4 -2
- package/browser/editor/page/after/index.mjs +288 -0
- package/browser/editor/page/align.mjs +91 -0
- package/browser/editor/page/beside.mjs +5 -6
- package/browser/editor/page/block-menu/index.mjs +6 -3
- package/browser/editor/page/blocks.mjs +3 -1
- package/browser/editor/page/board/hint.mjs +64 -27
- package/browser/editor/page/board/index.mjs +160 -71
- package/browser/editor/page/board/motion.mjs +177 -0
- package/browser/editor/page/board/settings.mjs +4 -3
- package/browser/editor/page/clipboard/import/read.mjs +20 -2
- package/browser/editor/page/clipboard/index.mjs +10 -3
- package/browser/editor/page/clipboard/own/blocks.mjs +3 -4
- package/browser/editor/page/clipboard/own/describe.mjs +6 -2
- package/browser/editor/page/commit.mjs +2 -2
- package/browser/editor/page/core.mjs +3 -1
- package/browser/editor/page/custom-page.mjs +15 -11
- package/browser/editor/page/editor.mjs +31 -14
- package/browser/editor/page/history.mjs +19 -4
- package/browser/editor/page/insert/index.mjs +20 -22
- package/browser/editor/page/menu.mjs +15 -7
- package/browser/editor/page/page-objects.mjs +3 -7
- package/browser/editor/page/present-links.mjs +5 -4
- package/browser/editor/page/present-shell.mjs +63 -0
- package/browser/editor/page/selection/index.mjs +10 -2
- package/browser/editor/page/table/binding.mjs +87 -0
- package/browser/editor/page/table/icons.mjs +0 -2
- package/browser/editor/page/table/index.mjs +10 -14
- package/browser/editor/page/table/views.mjs +5 -52
- package/browser/editor/page/table/widths.mjs +82 -10
- package/browser/editor/page/typing/index.mjs +44 -12
- package/browser/editor/page/typing/leave.mjs +19 -5
- package/browser/shared/block-packs.mjs +23 -8
- package/browser/shared/component-catalog.mjs +15 -8
- package/browser/shared/component-source.mjs +3 -1
- package/browser/shared/components/heading.mjs +2 -1
- package/browser/shared/components/installed.mjs +1 -1
- package/browser/shared/components/page.mjs +2 -0
- package/browser/shared/components/paragraph.mjs +8 -1
- package/browser/shared/components/table.mjs +1 -0
- package/browser/shared/document-copy.mjs +43 -0
- package/browser/shared/drafts.mjs +10 -3
- package/browser/shared/emoji/icon-value.mjs +2 -2
- package/browser/shared/emoji/line-icons.mjs +37 -0
- package/browser/shared/extensions.mjs +83 -7
- package/browser/shared/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +50 -17
- package/browser/shared/outline-shape.mjs +6 -0
- package/browser/shared/outline.mjs +165 -12
- package/browser/shared/pack-manifest.mjs +12 -1
- package/browser/shared/pages.mjs +169 -57
- package/browser/shared/pinyin.mjs +92 -0
- package/browser/shared/present-step.mjs +17 -0
- package/browser/shared/sidebar-head.mjs +70 -0
- package/browser/shared/web-links.mjs +5 -0
- package/browser/shared/workspace-columns.mjs +11 -7
- package/dist/{chunk-N7AZZLGT.mjs → chunk-2GKGEVMR.mjs} +29 -24
- package/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/{chunk-HYMEEXKN.mjs → chunk-2RKIHJI2.mjs} +1 -1
- package/dist/{chunk-742D2WWJ.mjs → chunk-36FIRJIF.mjs} +2 -2
- package/dist/{chunk-BPL64HGA.mjs → chunk-3A5I2GJK.mjs} +1 -1
- package/dist/{chunk-RFDZXFJF.mjs → chunk-3OFXMN6N.mjs} +1 -1
- package/dist/chunk-46ACXOU5.mjs +2 -0
- package/dist/{chunk-PUOQ65NC.mjs → chunk-4AMTKWDO.mjs} +1 -1
- package/dist/{chunk-VTKNEYT3.mjs → chunk-4DNHHJSL.mjs} +1 -1
- package/dist/chunk-5DPABPBI.mjs +2 -0
- package/dist/chunk-5IIH335D.mjs +3 -0
- package/dist/chunk-5L26JUYA.mjs +2 -0
- package/dist/{chunk-3NJACR4W.mjs → chunk-5MEXZ2UF.mjs} +1 -1
- package/dist/{chunk-ZHEHPMBK.mjs → chunk-6MPKCH3P.mjs} +1 -1
- package/dist/{chunk-C564NU2H.mjs → chunk-74RPP2M2.mjs} +1 -1
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/{chunk-VXACTLO3.mjs → chunk-7M7UPWU6.mjs} +1 -1
- package/dist/{chunk-ZB4H7ZN4.mjs → chunk-7N2LPG33.mjs} +1 -1
- package/dist/{chunk-UBBRTJ2R.mjs → chunk-7XDYK3UC.mjs} +1 -1
- package/dist/chunk-AEMVZYZQ.mjs +166 -0
- package/dist/{chunk-POQSE4C2.mjs → chunk-AFGUR7SY.mjs} +1 -1
- package/dist/{chunk-QKXMPUXC.mjs → chunk-AMDGVDNV.mjs} +1 -1
- package/dist/{chunk-KTKHRC6H.mjs → chunk-ASAXY2DJ.mjs} +1 -1
- package/dist/{chunk-NVRNLK25.mjs → chunk-BYSF5UMM.mjs} +2 -2
- package/dist/{chunk-U3SSPL4K.mjs → chunk-CCSGFCLZ.mjs} +1 -1
- package/dist/{chunk-NWFBE2YA.mjs → chunk-CG3UHDKH.mjs} +1 -1
- package/dist/chunk-CPS4SRPF.mjs +5 -0
- package/dist/{chunk-B4P2CM2J.mjs → chunk-CZ5KJSGK.mjs} +1 -1
- package/dist/chunk-DAMVDXR3.mjs +2 -0
- package/dist/{chunk-NG375ILQ.mjs → chunk-DH6GMDNN.mjs} +1 -1
- package/dist/chunk-DHB7UZ7F.mjs +3 -0
- package/dist/{chunk-MHW7ZKOU.mjs → chunk-DKR7LFIY.mjs} +1 -1
- package/dist/chunk-DLFZJJEE.mjs +2 -0
- package/dist/{chunk-6EZ7FNIK.mjs → chunk-F4ZA6JRZ.mjs} +1 -1
- package/dist/{chunk-6VTU6KEO.mjs → chunk-FCK6NXON.mjs} +1 -1
- package/dist/{chunk-ZWPMCK7P.mjs → chunk-FX42XU6J.mjs} +1 -1
- package/dist/chunk-FXQBADMN.mjs +5 -0
- package/dist/{chunk-W3BGBJQW.mjs → chunk-G4YP7GVC.mjs} +1 -1
- package/dist/{chunk-V6XZ4VIR.mjs → chunk-GWOYMENX.mjs} +1 -1
- package/dist/chunk-HATA2W7X.mjs +2 -0
- package/dist/{chunk-YI43RG4P.mjs → chunk-HBAUKKQH.mjs} +1 -1
- package/dist/{chunk-MAFIGVXY.mjs → chunk-HM4E43VM.mjs} +1 -1
- package/dist/{chunk-CRJEG7MT.mjs → chunk-JI6T3A4Y.mjs} +1 -1
- package/dist/{chunk-NFMCP2HI.mjs → chunk-JJNRIFND.mjs} +2 -2
- package/dist/chunk-JL6R4FG4.mjs +4 -0
- package/dist/{chunk-UMHUSOPJ.mjs → chunk-JXLSHVJ2.mjs} +1 -1
- package/dist/{chunk-FJYN7RTH.mjs → chunk-KFZBYDIS.mjs} +1 -1
- package/dist/{chunk-ZTHICSSF.mjs → chunk-KH24LWAT.mjs} +1 -1
- package/dist/{chunk-RKPWLGZ3.mjs → chunk-KUILYI7H.mjs} +1 -1
- package/dist/{chunk-RMECZA2K.mjs → chunk-L7W624FD.mjs} +1 -1
- package/dist/chunk-LE44MD3O.mjs +4 -0
- package/dist/{chunk-4K5KC6V2.mjs → chunk-LV24RY2E.mjs} +1 -1
- package/dist/{chunk-43B75J5T.mjs → chunk-MKTX5PGV.mjs} +1 -1
- package/dist/{chunk-LKX55H76.mjs → chunk-NAGMRVW4.mjs} +1 -1
- package/dist/{chunk-D4CKRD3V.mjs → chunk-NFABH3QW.mjs} +2 -2
- package/dist/{chunk-PVER7LSC.mjs → chunk-NIW7F7LU.mjs} +2 -2
- package/dist/{chunk-PAREWQGB.mjs → chunk-NWRZXELO.mjs} +1 -1
- package/dist/{chunk-OJKMINIU.mjs → chunk-OU3S466R.mjs} +15 -15
- package/dist/{chunk-5ZJA7CXT.mjs → chunk-PAFSFVYB.mjs} +1 -1
- package/dist/chunk-QCEATQC4.mjs +2 -0
- package/dist/{chunk-Y34NR5JL.mjs → chunk-QJ3TFJLQ.mjs} +1 -1
- package/dist/{chunk-IA4PSIMD.mjs → chunk-QK3VISCA.mjs} +1 -1
- package/dist/{chunk-ZUNVAXLH.mjs → chunk-QXVNUASA.mjs} +1 -1
- package/dist/{chunk-GRAXKKG4.mjs → chunk-QZ35UAB4.mjs} +1 -1
- package/dist/{chunk-UGWYKHBL.mjs → chunk-S2Y7VI4H.mjs} +2 -2
- package/dist/{chunk-OW5NWPOJ.mjs → chunk-SAHS56QM.mjs} +1 -1
- package/dist/{chunk-QOUEFUCH.mjs → chunk-SOD23RGL.mjs} +1 -1
- package/dist/chunk-TDWJKOLN.mjs +2 -0
- package/dist/{chunk-V6RIYQZZ.mjs → chunk-TOE6DPLH.mjs} +1 -1
- package/dist/chunk-UGO5N3EI.mjs +15 -0
- package/dist/{chunk-Q47PLKIJ.mjs → chunk-UGWMMEJ5.mjs} +1 -1
- package/dist/{chunk-NWR2LT5B.mjs → chunk-V5JRSGZF.mjs} +1 -1
- package/dist/{chunk-BZ5RAF7L.mjs → chunk-VA3KAQZD.mjs} +1 -1
- package/dist/chunk-VG5JEIUQ.mjs +12 -0
- package/dist/{chunk-UNOYVIYR.mjs → chunk-VGTMLQWZ.mjs} +1 -1
- package/dist/chunk-VKSRM7EY.mjs +22 -0
- package/dist/{chunk-YQGT4AB2.mjs → chunk-VNUWREXU.mjs} +1 -1
- package/dist/{chunk-AGDILNWB.mjs → chunk-VPVOAJ7X.mjs} +1 -1
- package/dist/{chunk-HLYV7RIH.mjs → chunk-WCWYNFDF.mjs} +1 -1
- package/dist/chunk-WTEGUPFG.mjs +16 -0
- package/dist/{chunk-N76HWBA3.mjs → chunk-XKOHV4H6.mjs} +1 -1
- package/dist/{chunk-HMYTM3GT.mjs → chunk-XMKHCUI6.mjs} +1 -1
- package/dist/{chunk-OUUP3WKT.mjs → chunk-XQRUG4G3.mjs} +1 -1
- package/dist/{chunk-32ZUEFZ7.mjs → chunk-YBB5LWZK.mjs} +1 -1
- package/dist/{chunk-SX4LJYT6.mjs → chunk-YFJU3O7G.mjs} +1 -1
- package/dist/chunk-YPPJVDQI.mjs +2 -0
- package/dist/chunk-ZANMKAWS.mjs +2 -0
- package/dist/{chunk-6QBHU4DF.mjs → chunk-ZCP7BTOZ.mjs} +1 -1
- package/dist/{chunk-ERLAIBOA.mjs → chunk-ZEY2RLBT.mjs} +2 -2
- package/dist/{chunk-SQ6Y2ZMA.mjs → chunk-ZO7SFB2E.mjs} +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +5 -5
- package/kit/code.js +15 -15
- package/kit/math.js +1 -1
- package/kit/report.css +123 -44
- package/kit/runtime.js +45 -7
- package/kit/tables.js +2 -0
- package/kit/ui.js +2 -0
- package/package.json +1 -1
- package/packs/gallery/chart-view/kit.js +3 -3
- package/packs/gallery/chart-view/writing.md +1 -1
- package/packs/gallery/countdown/component.json +1 -1
- package/packs/gallery/countdown/kit.js +89 -29
- package/packs/gallery/countdown/preview.svg +1 -1
- package/packs/gallery/countdown/style.css +88 -100
- package/packs/gallery/countdown/writing.md +2 -2
- package/packs/gallery/habit/component.json +3 -3
- package/packs/gallery/habit/kit.js +114 -75
- package/packs/gallery/habit/preview.svg +1 -1
- package/packs/gallery/habit/style.css +133 -205
- package/packs/gallery/habit/writing.md +2 -2
- package/packs/gallery/heatmap/component.json +2 -2
- package/packs/gallery/heatmap/kit.js +335 -173
- package/packs/gallery/heatmap/preview.svg +1 -1
- package/packs/gallery/heatmap/style.css +158 -170
- package/packs/gallery/heatmap/writing.md +2 -2
- package/packs/gallery/kanban/kit.js +3 -3
- package/packs/gallery/kanban/writing.md +1 -1
- package/packs/gallery/metric/kit.js +3 -3
- package/packs/gallery/metric/writing.md +1 -1
- package/packs/gallery/note/component.json +3 -3
- package/packs/gallery/note/kit.js +40 -13
- package/packs/gallery/note/preview.svg +1 -1
- package/packs/gallery/note/style.css +51 -30
- package/packs/gallery/note/writing.md +2 -2
- package/packs/gallery/recent/component.json +2 -2
- package/packs/gallery/recent/kit.js +141 -86
- package/packs/gallery/recent/preview.svg +1 -1
- package/packs/gallery/recent/style.css +53 -126
- package/packs/gallery/recent/writing.md +2 -2
- package/packs/gallery/static/component.json +2 -2
- package/packs/gallery/static/preview.svg +1 -1
- package/packs/gallery/static/style.css +99 -66
- package/packs/gallery/static/writing.md +2 -2
- package/packs/gallery/stats/component.json +3 -3
- package/packs/gallery/stats/kit.js +253 -72
- package/packs/gallery/stats/preview.svg +1 -1
- package/packs/gallery/stats/style.css +64 -142
- package/packs/gallery/stats/writing.md +2 -2
- package/packs/gallery/today/component.json +2 -2
- package/packs/gallery/today/kit.js +62 -27
- package/packs/gallery/today/preview.svg +1 -1
- package/packs/gallery/today/style.css +101 -72
- package/packs/gallery/today/writing.md +2 -2
- package/packs/gallery/todos/component.json +1 -1
- package/packs/gallery/todos/kit.js +218 -71
- package/packs/gallery/todos/preview.svg +1 -1
- package/packs/gallery/todos/style.css +170 -223
- package/packs/gallery/todos/writing.md +1 -1
- package/packs/gallery/weather/component.json +2 -2
- package/packs/gallery/weather/kit.js +165 -90
- package/packs/gallery/weather/preview.svg +1 -1
- package/packs/gallery/weather/style.css +100 -218
- package/packs/gallery/weather/writing.md +1 -1
- package/packs/gallery-soft/countdown/component.json +18 -0
- package/packs/gallery-soft/countdown/example.html +3 -0
- package/packs/gallery-soft/countdown/kit.js +206 -0
- package/packs/gallery-soft/countdown/preview.svg +1 -0
- package/packs/gallery-soft/countdown/style.css +211 -0
- package/packs/gallery-soft/countdown/template.html +3 -0
- package/packs/gallery-soft/countdown/writing.md +24 -0
- package/packs/gallery-soft/habit/component.json +14 -0
- package/packs/gallery-soft/habit/example.html +3 -0
- package/packs/gallery-soft/habit/kit.js +366 -0
- package/packs/gallery-soft/habit/preview.svg +1 -0
- package/packs/gallery-soft/habit/style.css +251 -0
- package/packs/gallery-soft/habit/template.html +3 -0
- package/packs/gallery-soft/habit/writing.md +23 -0
- package/packs/gallery-soft/heatmap/component.json +18 -0
- package/packs/gallery-soft/heatmap/example.html +3 -0
- package/packs/gallery-soft/heatmap/kit.js +498 -0
- package/packs/gallery-soft/heatmap/preview.svg +1 -0
- package/packs/gallery-soft/heatmap/style.css +181 -0
- package/packs/gallery-soft/heatmap/template.html +3 -0
- package/packs/gallery-soft/heatmap/writing.md +23 -0
- package/packs/gallery-soft/note/component.json +14 -0
- package/packs/gallery-soft/note/example.html +3 -0
- package/packs/gallery-soft/note/kit.js +162 -0
- package/packs/gallery-soft/note/preview.svg +1 -0
- package/packs/gallery-soft/note/style.css +148 -0
- package/packs/gallery-soft/note/template.html +3 -0
- package/packs/gallery-soft/note/writing.md +20 -0
- package/packs/gallery-soft/recent/component.json +13 -0
- package/packs/gallery-soft/recent/example.html +1 -0
- package/packs/gallery-soft/recent/kit.js +335 -0
- package/packs/gallery-soft/recent/preview.svg +1 -0
- package/packs/gallery-soft/recent/style.css +160 -0
- package/packs/gallery-soft/recent/template.html +1 -0
- package/packs/gallery-soft/recent/writing.md +17 -0
- package/packs/gallery-soft/static/component.json +13 -0
- package/packs/gallery-soft/static/example.html +12 -0
- package/packs/gallery-soft/static/preview.svg +1 -0
- package/packs/gallery-soft/static/style.css +186 -0
- package/packs/gallery-soft/static/template.html +1 -0
- package/packs/gallery-soft/static/writing.md +20 -0
- package/packs/gallery-soft/stats/component.json +13 -0
- package/packs/gallery-soft/stats/example.html +1 -0
- package/packs/gallery-soft/stats/kit.js +341 -0
- package/packs/gallery-soft/stats/preview.svg +1 -0
- package/packs/gallery-soft/stats/style.css +119 -0
- package/packs/gallery-soft/stats/template.html +1 -0
- package/packs/gallery-soft/stats/writing.md +13 -0
- package/packs/gallery-soft/today/component.json +12 -0
- package/packs/gallery-soft/today/example.html +1 -0
- package/packs/gallery-soft/today/kit.js +222 -0
- package/packs/gallery-soft/today/preview.svg +1 -0
- package/packs/gallery-soft/today/style.css +178 -0
- package/packs/gallery-soft/today/template.html +1 -0
- package/packs/gallery-soft/today/writing.md +16 -0
- package/packs/gallery-soft/todos/component.json +19 -0
- package/packs/gallery-soft/todos/example.html +3 -0
- package/packs/gallery-soft/todos/kit.js +527 -0
- package/packs/gallery-soft/todos/preview.svg +1 -0
- package/packs/gallery-soft/todos/style.css +212 -0
- package/packs/gallery-soft/todos/template.html +3 -0
- package/packs/gallery-soft/todos/writing.md +32 -0
- package/packs/gallery-soft/weather/component.json +19 -0
- package/packs/gallery-soft/weather/example.html +3 -0
- package/packs/gallery-soft/weather/kit.js +411 -0
- package/packs/gallery-soft/weather/preview.svg +1 -0
- package/packs/gallery-soft/weather/style.css +185 -0
- package/packs/gallery-soft/weather/template.html +3 -0
- package/packs/gallery-soft/weather/writing.md +28 -0
- package/release.json +10 -10
- package/skill/SKILL.md +15 -14
- package/skill/references/building-blocks.md +4 -4
- package/skill/references/extensions.md +11 -7
- package/skill/references/pages-and-data.md +13 -9
- package/skill/references/writing-html.md +2 -0
- package/web/assets/index-BHC5ZOMh.js +15 -0
- package/web/assets/index-xP0uw3a0.css +1 -0
- package/web/index.html +2 -2
- package/dist/chunk-2NRBY6AJ.mjs +0 -2
- package/dist/chunk-35NQ4PLQ.mjs +0 -2
- package/dist/chunk-3KJHLHUO.mjs +0 -2
- package/dist/chunk-4AV456RQ.mjs +0 -2
- package/dist/chunk-5XYHDBJ5.mjs +0 -2
- package/dist/chunk-6A53MZYZ.mjs +0 -2
- package/dist/chunk-6EXH3ORZ.mjs +0 -166
- package/dist/chunk-BVEFGE4B.mjs +0 -2
- package/dist/chunk-D4EURAX4.mjs +0 -4
- package/dist/chunk-DQCE7TJY.mjs +0 -5
- package/dist/chunk-FWNRPMCJ.mjs +0 -12
- package/dist/chunk-FWW4CSAZ.mjs +0 -2
- package/dist/chunk-GY3FAUVM.mjs +0 -2
- package/dist/chunk-JVHHHGEA.mjs +0 -3
- package/dist/chunk-L7UP52JO.mjs +0 -2
- package/dist/chunk-NAMN3RAF.mjs +0 -2
- package/dist/chunk-PZDLJJTJ.mjs +0 -3
- package/dist/chunk-SXHBYZST.mjs +0 -16
- package/dist/chunk-TEZAWDSQ.mjs +0 -2
- package/dist/chunk-UFNYFFKO.mjs +0 -20
- package/dist/chunk-UKSHDZZ6.mjs +0 -2
- package/dist/chunk-VJPFVNNW.mjs +0 -15
- package/dist/chunk-VS3ZMVGX.mjs +0 -5
- package/web/assets/index-BK2e_07w.js +0 -13
- package/web/assets/index-CWFI83mF.css +0 -1
- /package/dist/{chunk-YEY3RSFQ.mjs → chunk-5MMN3N5J.mjs} +0 -0
- /package/dist/{chunk-UH4SIXTR.mjs → chunk-74UW7QSL.mjs} +0 -0
- /package/dist/{chunk-W7XHE4CT.mjs → chunk-EKGYYOSP.mjs} +0 -0
- /package/dist/{chunk-QAIHRH3I.mjs → chunk-KNZJT4ET.mjs} +0 -0
- /package/dist/{chunk-A55HN5OK.mjs → chunk-N3DSBH5S.mjs} +0 -0
- /package/dist/{chunk-QR6A54KJ.mjs → chunk-ZW2A6GBW.mjs} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/* 柔光风格's workspace numbers. Every selector starts at the instance and goes down from it, so that nothing
|
|
2
|
+
here reaches the rest of the page. The soft look's tokens first, light and dark (light-dark(): the page's
|
|
3
|
+
color scheme, which follows its theme), then the face: a faint wash of the accent from the card's top over
|
|
4
|
+
the soft card's fill, and no head: four cells, each its small chip and name over its number, large, its
|
|
5
|
+
unit muted, and under it a small thing of its own (the words a document holds on average; the words'
|
|
6
|
+
line, washed under it and its end ringed; the to-dos' bar and share; this week's bars, today's in the
|
|
7
|
+
accent, the days to come a stub). By the card's size (data-layout, from the script): a row of four on a
|
|
8
|
+
wide card, a hairline between them, each like a small card; two by two on a 4 × 4 card, hairlines between;
|
|
9
|
+
on a 4 × 2 card two by two with no feet, each its name after a small picture in the accent. Where nothing
|
|
10
|
+
could be read, a muted line at the bottom right says why. On a custom page the face is the card's whole
|
|
11
|
+
room, taken out over the card's padding, the board's line around it; where no card is (a document, as
|
|
12
|
+
gallery block check shows it) the face frames itself at an 8 × 2 card's size. */
|
|
13
|
+
[data-doc-component="gallery-soft/stats"] {
|
|
14
|
+
--soft-font: "PingFang SC", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
|
|
15
|
+
--soft-num: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
16
|
+
--soft-card: light-dark(#ffffff, #1f1f20);
|
|
17
|
+
--soft-card-line: light-dark(rgb(28 28 32 / 6.5%), rgb(255 255 255 / 7.5%));
|
|
18
|
+
--soft-card-shadow: 0 0 0 1px var(--soft-card-line), 0 1px 2px light-dark(rgb(28 28 32 / 3.5%), rgb(0 0 0 / 0%)), 0 8px 24px -14px light-dark(rgb(28 28 32 / 12%), rgb(0 0 0 / 60%));
|
|
19
|
+
--soft-wash: linear-gradient(180deg, light-dark(rgb(62 122 198 / 6%), rgb(126 173 226 / 7%)) 0%, transparent 52%);
|
|
20
|
+
--soft-text: light-dark(#37352f, #d9d9dc);
|
|
21
|
+
--soft-strong: light-dark(#1f1f1f, #f1f1f2);
|
|
22
|
+
--soft-muted: light-dark(#7a7a7f, #9d9da3);
|
|
23
|
+
--soft-accent: light-dark(#3e7ac6, #7eade2);
|
|
24
|
+
--soft-accent-ink: light-dark(#356cb3, #98bee9);
|
|
25
|
+
--soft-accent-soft: light-dark(#ecf3fb, rgb(126 173 226 / 14%));
|
|
26
|
+
--soft-accent-mid: light-dark(#afcaea, #4a6f9b);
|
|
27
|
+
--soft-track: light-dark(rgb(28 28 32 / 7%), rgb(255 255 255 / 8%));
|
|
28
|
+
--soft-good: light-dark(#23874f, #6fcf97);
|
|
29
|
+
--soft-good-soft: light-dark(#e6f4ec, rgb(111 207 151 / 14%));
|
|
30
|
+
--soft-bad: light-dark(#c9473d, #f08a80);
|
|
31
|
+
--soft-bad-soft: light-dark(#fcecea, rgb(240 138 128 / 14%));
|
|
32
|
+
> .gallery-soft-stats-face {
|
|
33
|
+
position: relative;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
min-width: 0;
|
|
38
|
+
width: 624px;
|
|
39
|
+
max-width: 100%;
|
|
40
|
+
height: 144px;
|
|
41
|
+
padding: 0;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
border-radius: 16px;
|
|
44
|
+
box-shadow: var(--soft-card-shadow);
|
|
45
|
+
background: var(--soft-wash), var(--soft-card);
|
|
46
|
+
color: var(--soft-text);
|
|
47
|
+
font: 13px/1.5 var(--soft-font);
|
|
48
|
+
-webkit-font-smoothing: antialiased;
|
|
49
|
+
}
|
|
50
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid { display: grid; flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; min-height: 0; }
|
|
51
|
+
> .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
|
|
52
|
+
> .gallery-soft-stats-face[data-layout="compact"] { padding: calc(20px - var(--soft-edge, 0px)); }
|
|
53
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 12px; align-content: center; }
|
|
54
|
+
/* A cell: its chip and name, its number, its foot. */
|
|
55
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell { position: relative; display: flex; flex-direction: column; min-width: 0; padding: calc(18px - var(--soft-edge, 0px)) calc(20px - var(--soft-edge, 0px)); }
|
|
56
|
+
> .gallery-soft-stats-face[data-layout="row"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell + .gallery-soft-stats-cell { box-shadow: -1px 0 0 var(--soft-track); }
|
|
57
|
+
> .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell { padding: calc(16px - var(--soft-edge, 0px)) calc(18px - var(--soft-edge, 0px)); }
|
|
58
|
+
> .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell:nth-child(2) { box-shadow: -1px 0 0 var(--soft-track); }
|
|
59
|
+
> .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell:nth-child(3) { box-shadow: 0 -1px 0 var(--soft-track); }
|
|
60
|
+
> .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell:nth-child(4) { box-shadow: -1px 0 0 var(--soft-track), 0 -1px 0 var(--soft-track); }
|
|
61
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell { gap: 4px; padding: 0; }
|
|
62
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-label { display: flex; align-items: center; gap: 8px; height: 22px; min-width: 0; overflow: hidden; font-size: 12.5px; color: var(--soft-muted); white-space: nowrap; }
|
|
63
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-label > .gallery-soft-stats-chip { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--soft-accent-soft); color: var(--soft-accent); }
|
|
64
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-label > .gallery-soft-stats-chip > svg { display: block; width: 13px; height: 13px; }
|
|
65
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-label { gap: 6px; height: 18px; font-size: 12px; }
|
|
66
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-label > .gallery-soft-stats-chip { width: 14px; height: 14px; border-radius: 0; background: none; }
|
|
67
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-label > .gallery-soft-stats-chip > svg { width: 14px; height: 14px; }
|
|
68
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-figure {
|
|
69
|
+
margin: 8px 0 0;
|
|
70
|
+
white-space: nowrap;
|
|
71
|
+
font: 700 30px/1 var(--soft-num);
|
|
72
|
+
letter-spacing: -.025em;
|
|
73
|
+
font-variant-numeric: tabular-nums;
|
|
74
|
+
color: var(--soft-strong);
|
|
75
|
+
}
|
|
76
|
+
> .gallery-soft-stats-face[data-layout="row"][data-w="12"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-figure { font-size: 40px; }
|
|
77
|
+
> .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-figure { margin-top: 12px; }
|
|
78
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-figure { margin: 0; font-size: 24px; letter-spacing: -.015em; }
|
|
79
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-figure > .gallery-soft-stats-unit { margin-left: 4px; font: 500 13px var(--soft-font); letter-spacing: 0; color: var(--soft-muted); }
|
|
80
|
+
> .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-figure > .gallery-soft-stats-unit { margin-left: 3px; font-size: 12px; }
|
|
81
|
+
/* Its foot: what the number has under it. */
|
|
82
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot { display: flex; align-items: center; gap: 8px; min-height: 22px; margin: auto 0 0; font-size: 11.5px; color: var(--soft-muted); white-space: nowrap; }
|
|
83
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-said > .gallery-soft-stats-average { font: 600 11.5px var(--soft-num); color: var(--soft-text); }
|
|
84
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bar { flex: 1; height: 6px; overflow: hidden; border-radius: 3px; background: var(--soft-track); }
|
|
85
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bar > .gallery-soft-stats-fill { display: block; height: 100%; border-radius: 3px; background: var(--soft-accent); }
|
|
86
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-share { font: 600 11.5px var(--soft-num); color: var(--soft-accent-ink); }
|
|
87
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bars { display: flex; align-items: flex-end; gap: 4px; height: 24px; }
|
|
88
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bars > .gallery-soft-stats-day { width: 9px; border-radius: 2.5px; background: var(--soft-accent-mid); }
|
|
89
|
+
> .gallery-soft-stats-face[data-w="12"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bars > .gallery-soft-stats-day { width: 12px; }
|
|
90
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bars > .gallery-soft-stats-today { background: var(--soft-accent); }
|
|
91
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-bars > .gallery-soft-stats-future { height: 3px; background: var(--soft-track); }
|
|
92
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > :is(.gallery-soft-stats-grew, .gallery-soft-stats-fell) { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 20px; padding: 0 7px; border-radius: 6px; font: 600 11.5px var(--soft-num); background: var(--soft-good-soft); color: var(--soft-good); }
|
|
93
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-fell { background: var(--soft-bad-soft); color: var(--soft-bad); }
|
|
94
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > :is(.gallery-soft-stats-grew, .gallery-soft-stats-fell) > svg { display: block; width: 12px; height: 12px; }
|
|
95
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-room { flex: 1; min-width: 40px; }
|
|
96
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-grid > .gallery-soft-stats-cell > .gallery-soft-stats-foot > .gallery-soft-stats-room > .gallery-soft-stats-spark > svg { display: block; overflow: visible; }
|
|
97
|
+
> .gallery-soft-stats-face .gallery-soft-stats-wash-top { stop-color: var(--soft-accent); stop-opacity: .22; }
|
|
98
|
+
> .gallery-soft-stats-face .gallery-soft-stats-wash-end { stop-color: var(--soft-accent); stop-opacity: 0; }
|
|
99
|
+
> .gallery-soft-stats-face .gallery-soft-stats-spark-line { fill: none; stroke: var(--soft-accent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
|
|
100
|
+
> .gallery-soft-stats-face .gallery-soft-stats-end { fill: var(--soft-card); stroke: var(--soft-accent); stroke-width: 1.8; }
|
|
101
|
+
/* Nothing read: the line saying why, at the bottom right. */
|
|
102
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-line { position: absolute; right: 20px; bottom: 10px; margin: 0; font-size: 11.5px; color: var(--soft-muted); }
|
|
103
|
+
> .gallery-soft-stats-face > .gallery-soft-stats-line[hidden] { display: none; }
|
|
104
|
+
}
|
|
105
|
+
/* On a custom page: the face over the card's whole room, the board's line around it. */
|
|
106
|
+
.gallery-card > [data-doc-component="gallery-soft/stats"] { height: 100%; }
|
|
107
|
+
.gallery-card > [data-doc-component="gallery-soft/stats"] > .gallery-soft-stats-face {
|
|
108
|
+
--soft-edge: 1px;
|
|
109
|
+
width: auto;
|
|
110
|
+
max-width: none;
|
|
111
|
+
height: calc(100% + 2 * var(--gallery-card-pad));
|
|
112
|
+
margin: calc(-1 * var(--gallery-card-pad));
|
|
113
|
+
border-radius: calc(var(--gallery-card-radius) - 1px);
|
|
114
|
+
box-shadow: none;
|
|
115
|
+
}
|
|
116
|
+
/* The cell at the card's top right keeps its name clear of the grip's corner. */
|
|
117
|
+
.gallery-card > [data-doc-component="gallery-soft/stats"] > .gallery-soft-stats-face[data-layout="row"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell:nth-child(4) > .gallery-soft-stats-label { padding-inline-end: 20px; }
|
|
118
|
+
.gallery-card > [data-doc-component="gallery-soft/stats"] > .gallery-soft-stats-face[data-layout="quad"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell:nth-child(2) > .gallery-soft-stats-label { padding-inline-end: 22px; }
|
|
119
|
+
.gallery-card > [data-doc-component="gallery-soft/stats"] > .gallery-soft-stats-face[data-layout="compact"] > .gallery-soft-stats-grid > .gallery-soft-stats-cell:nth-child(2) > .gallery-soft-stats-label { padding-inline-end: 20px; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-doc-component="gallery-soft/stats"></div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 工作区统计 (gallery-soft/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
|
+
It is 柔光风格's (the pack `gallery-soft`, off until the user turns it on in 设置 › 组件列表): the same card as Gallery 风格's `gallery/stats`, its settings, its data and what the user does on it the same, in the soft look of design A (a faint wash of blue from the card's top, rounded chips, big numbers). Write it only where the user asked for 柔光风格 or the page already holds its cards.
|
|
6
|
+
|
|
7
|
+
## How to write it
|
|
8
|
+
|
|
9
|
+
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 gallery-soft/stats`: the instance is empty, `<div data-doc-component="gallery-soft/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: 8 × 2 (the default: the four in a row), 12 × 2 (the same, larger, the words added this week beside their line), 4 × 2 (two by two, the numbers alone) and 4 × 4 (two by two, each with the small thing under it).
|
|
10
|
+
|
|
11
|
+
## How it looks
|
|
12
|
+
|
|
13
|
+
No head: four cells, each its small chip and name (文档, 总字数, 待办完成, 本周编辑) over its number, large, its unit muted (38 篇, 12.6 万字, 18 / 27, 11 篇), and under each a small thing of its own: the words a document holds on average; how the words grew over the last 30 days, a line washed under it (on a 12 × 2 card the words this week added in a green pill and the last 14 days); the share of the to-dos done as a bar; this week's edits day by day as small bars, today's in the accent, the days to come a stub. It reads the workspace's record of edits for the line and the bars (the plan's activity); in 柔光风格's soft look (as every card of it: a faint wash of blue from the card's top, a head of a rounded tinted chip and a title, its end clear of the card's grip), light and dark. Where the workspace cannot be read (an export) each number is a dash and a line says it shows when 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-soft/today",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"name": { "zh": "问候与日期", "en": "Greeting and date" },
|
|
6
|
+
"description": { "zh": "按时间问候,显示今天的日期和这一周,到点自己更新", "en": "A greeting by the time of day, today's date and its week, kept up to date by the clock" },
|
|
7
|
+
"words": "wenhouyuriqi wenhou riqi xingqi jintian today greeting date 问候 日期 星期 今天 时间",
|
|
8
|
+
"parts": {},
|
|
9
|
+
"runtime": { "generated": [":scope > .gallery-soft-today-face"] },
|
|
10
|
+
"places": ["page"],
|
|
11
|
+
"card": { "sizes": [[4, 2], [2, 2]], "resize": true }
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-doc-component="gallery-soft/today"></div>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// gallery-soft/today (问候与日期, 柔光风格): Gallery 风格's gallery/today in the soft look, the same logic. A
|
|
2
|
+
// greeting by the hour of the reader's clock (早上好 from 5 to 11, 下午好 from 12 to 17, 晚上好 from 18 to 4),
|
|
3
|
+
// today's date and its weekday, in the page's language and in the order it writes them (11月7日 星期六,
|
|
4
|
+
// Saturday, November 7): the UI's where Gallery says it (data-ge-language on the root), else English for a
|
|
5
|
+
// page whose lang is en, else Chinese, the kit's own rule. Drawn again by the kit's clock (`clock`): at each
|
|
6
|
+
// whole minute, which moves the greeting on as the hour turns, and as a day begins, which moves the date;
|
|
7
|
+
// one timer for every block on the page, none of its own. It holds no part and writes nothing: all it shows
|
|
8
|
+
// is drawn (the manifest's `runtime`), and a file holds the bare instance.
|
|
9
|
+
//
|
|
10
|
+
// Its face is laid out by its card's size (`context.size`, read again on `layout`; the manifest's first size
|
|
11
|
+
// where no card is): on a 4 × 2 card the greeting is the hero, large, after the sun by day (from 5 to 17)
|
|
12
|
+
// or the moon in the evening, the date under it with the number of the week (ISO 8601's, `weekNumberOf`) at
|
|
13
|
+
// its end, and the week it is in at the bottom, Monday to Sunday, each day's initial over its date, today's
|
|
14
|
+
// 今 over its date on a disc of the accent (`weekOf`); a 2 × 2 card says the month and the weekday at the
|
|
15
|
+
// top beside the sun, the day of the month large, and the greeting at the bottom. A glow at the card's top
|
|
16
|
+
// left, the sun's warm color by day, the accent's in the evening (the face's data-sky). The face says its
|
|
17
|
+
// size as data-w and data-h, and the frame's padding as data-pad (style.css).
|
|
18
|
+
|
|
19
|
+
const WORDS = {
|
|
20
|
+
zh: {
|
|
21
|
+
morning: "早上好",
|
|
22
|
+
afternoon: "下午好",
|
|
23
|
+
evening: "晚上好",
|
|
24
|
+
weekdays: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
|
|
25
|
+
initials: ["日", "一", "二", "三", "四", "五", "六"],
|
|
26
|
+
today: "今",
|
|
27
|
+
week: (/** @type {number} */ number) => `第 ${number} 周`,
|
|
28
|
+
/** The date and its weekday as the language writes them, pieces a line breaks between. @param {number} month @param {number} day @param {string} weekday */
|
|
29
|
+
line: (month, day, weekday) => [`${month}月${day}日`, weekday],
|
|
30
|
+
/** Which of the line's pieces is the weekday. */
|
|
31
|
+
weekdayAt: 1,
|
|
32
|
+
/** A small card's top line: the month and the weekday. @param {number} month @param {string} weekday */
|
|
33
|
+
month: (month, weekday) => `${month}月 · ${weekday}`,
|
|
34
|
+
},
|
|
35
|
+
en: {
|
|
36
|
+
morning: "Good morning",
|
|
37
|
+
afternoon: "Good afternoon",
|
|
38
|
+
evening: "Good evening",
|
|
39
|
+
weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
40
|
+
initials: ["S", "M", "T", "W", "T", "F", "S"],
|
|
41
|
+
today: "Today",
|
|
42
|
+
week: (/** @type {number} */ number) => `Week ${number}`,
|
|
43
|
+
/** The weekday first: Saturday, November 7. @param {number} month @param {number} day @param {string} weekday */
|
|
44
|
+
line: (month, day, weekday) => [`${weekday},`, `${["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][month - 1]} ${day}`],
|
|
45
|
+
weekdayAt: 0,
|
|
46
|
+
/** @param {number} month @param {string} weekday */
|
|
47
|
+
month: (month, weekday) => `${["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][month - 1]} · ${weekday.slice(0, 3)}`,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** The language the page speaks: the UI's where Gallery says it (data-ge-language), else its lang's. */
|
|
52
|
+
function languageOf(/** @type {HTMLElement} */ root) {
|
|
53
|
+
const ui = root.getAttribute("data-ge-language");
|
|
54
|
+
return (ui !== null ? ui === "en" : /^en(?:-|$)/i.test(root.lang)) ? "en" : "zh";
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The part of the day an hour (0 to 23) is in, as the greeting says it: morning from 5 to 11,
|
|
59
|
+
* afternoon from 12 to 17, evening from 18 to 4.
|
|
60
|
+
* @param {number} hour
|
|
61
|
+
* @returns {"morning" | "afternoon" | "evening"}
|
|
62
|
+
*/
|
|
63
|
+
function partOfDay(hour) {
|
|
64
|
+
if (hour >= 5 && hour < 12) return "morning";
|
|
65
|
+
if (hour >= 12 && hour < 18) return "afternoon";
|
|
66
|
+
return "evening";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* What the card says at `now` (the reader's clock) in `language`: the greeting, the date line (its
|
|
71
|
+
* month and day and the weekday, in the language's order, a list of words a line breaks between and
|
|
72
|
+
* never inside), and the date as a <time> names it (YYYY-MM-DD).
|
|
73
|
+
* @param {Date} now
|
|
74
|
+
* @param {"zh" | "en"} language
|
|
75
|
+
*/
|
|
76
|
+
function faceOf(now, language) {
|
|
77
|
+
const words = WORDS[language];
|
|
78
|
+
const two = (/** @type {number} */ value) => String(value).padStart(2, "0");
|
|
79
|
+
return {
|
|
80
|
+
greeting: words[partOfDay(now.getHours())],
|
|
81
|
+
line: words.line(now.getMonth() + 1, now.getDate(), words.weekdays[now.getDay()]),
|
|
82
|
+
datetime: `${now.getFullYear()}-${two(now.getMonth() + 1)}-${two(now.getDate())}`,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// The two pictures, 24 x 24 lines in the face's ink: the sun by day, the moon in the evening.
|
|
87
|
+
const PICTURES = {
|
|
88
|
+
sun: '<circle cx="12" cy="12" r="4.2"/><path d="M12 2.8v2.1M12 19.1v2.1M2.8 12h2.1M19.1 12h2.1M5.5 5.5l1.5 1.5M17 17l1.5 1.5M5.5 18.5L7 17M17 7l1.5-1.5"/>',
|
|
89
|
+
moon: '<path d="M19.5 14.6A8 8 0 0 1 9.4 4.5a8 8 0 1 0 10.1 10.1z"/>',
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The week `now` is in, Monday first, as the card's strip draws it in `language`: seven of { initial (the
|
|
94
|
+
* weekday's, today's 今 or Today), date (the day of the month), today, past (a day before today) }.
|
|
95
|
+
* @param {Date} now
|
|
96
|
+
* @param {"zh" | "en"} language
|
|
97
|
+
*/
|
|
98
|
+
function weekOf(now, language) {
|
|
99
|
+
const monday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - ((now.getDay() + 6) % 7), 12);
|
|
100
|
+
return Array.from({ length: 7 }, (_, index) => {
|
|
101
|
+
const day = new Date(monday.getFullYear(), monday.getMonth(), monday.getDate() + index, 12);
|
|
102
|
+
const today = index === (now.getDay() + 6) % 7;
|
|
103
|
+
return { initial: today ? WORDS[language].today : WORDS[language].initials[day.getDay()], date: day.getDate(), today, past: index < (now.getDay() + 6) % 7 };
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The number of the week `now` is in, as ISO 8601 counts them (the week a year's first Thursday is in its
|
|
109
|
+
* first, Monday its first day), 1 to 53.
|
|
110
|
+
* @param {Date} now
|
|
111
|
+
*/
|
|
112
|
+
function weekNumberOf(now) {
|
|
113
|
+
const thursday = new Date(Date.UTC(now.getFullYear(), now.getMonth(), now.getDate()));
|
|
114
|
+
thursday.setUTCDate(thursday.getUTCDate() + 3 - ((thursday.getUTCDay() + 6) % 7)); // the Thursday of its week, which says the year
|
|
115
|
+
const first = Date.UTC(thursday.getUTCFullYear(), 0, 1);
|
|
116
|
+
return Math.ceil(((thursday.getTime() - first) / 86_400_000 + 1) / 7);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The size the face is laid out by: its card's cells (`context.size`), or `fallback` (the manifest's first
|
|
121
|
+
* size) where no card is; and the frame's padding for it, as the soft cards pad theirs: "xs" on a card one
|
|
122
|
+
* cell high, "s" on a small one (2 × 2 and less), "l" on one 3 cells high or more, else "m".
|
|
123
|
+
* @param {DocComponentSize | null | undefined} size
|
|
124
|
+
* @param {[number, number]} fallback
|
|
125
|
+
*/
|
|
126
|
+
function sizeOf(size, fallback) {
|
|
127
|
+
const w = size?.w ?? fallback[0];
|
|
128
|
+
const h = size?.h ?? fallback[1];
|
|
129
|
+
return { w, h, pad: h === 1 ? "xs" : w <= 2 && h <= 2 ? "s" : h >= 3 ? "l" : "m" };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* An element of the face, of `kind` (its class).
|
|
134
|
+
* @template {keyof HTMLElementTagNameMap} K
|
|
135
|
+
* @param {K} tag
|
|
136
|
+
* @param {string} kind
|
|
137
|
+
*/
|
|
138
|
+
function made(tag, kind) {
|
|
139
|
+
const node = document.createElement(tag);
|
|
140
|
+
node.className = `gallery-soft-today-${kind}`;
|
|
141
|
+
return node;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
DocKit.component({
|
|
145
|
+
id: "gallery-soft/today",
|
|
146
|
+
on: ["clock", "layout"],
|
|
147
|
+
mount(host, context) {
|
|
148
|
+
const face = made("div", "face");
|
|
149
|
+
const sun = made("span", "sun");
|
|
150
|
+
sun.setAttribute("aria-hidden", "true");
|
|
151
|
+
const greeting = made("p", "greeting");
|
|
152
|
+
const date = made("time", "date");
|
|
153
|
+
// The line's end: the number of the week.
|
|
154
|
+
const number = made("span", "meta");
|
|
155
|
+
number.setAttribute("aria-hidden", "true");
|
|
156
|
+
const week = made("ol", "week");
|
|
157
|
+
week.setAttribute("aria-hidden", "true");
|
|
158
|
+
// A small card's: the month and the weekday at the top, the day of the month large.
|
|
159
|
+
const month = made("span", "month");
|
|
160
|
+
month.setAttribute("aria-hidden", "true");
|
|
161
|
+
const day = made("span", "day");
|
|
162
|
+
day.setAttribute("aria-hidden", "true");
|
|
163
|
+
face.append(sun, greeting, month, day, date, number, week);
|
|
164
|
+
host.append(face);
|
|
165
|
+
// Each word set only when it is another, so that a minute that changes nothing writes nothing.
|
|
166
|
+
const put = (/** @type {HTMLElement} */ node, /** @type {string} */ words) => {
|
|
167
|
+
if (node.textContent !== words) node.textContent = words;
|
|
168
|
+
};
|
|
169
|
+
const lay = () => {
|
|
170
|
+
const { w, h, pad } = sizeOf(context?.size, [4, 2]);
|
|
171
|
+
if (face.dataset.w !== String(w)) face.dataset.w = String(w);
|
|
172
|
+
if (face.dataset.h !== String(h)) face.dataset.h = String(h);
|
|
173
|
+
if (face.dataset.pad !== pad) face.dataset.pad = pad;
|
|
174
|
+
};
|
|
175
|
+
const draw = () => {
|
|
176
|
+
const at = new Date();
|
|
177
|
+
const language = languageOf(document.documentElement);
|
|
178
|
+
const words = WORDS[language];
|
|
179
|
+
const now = faceOf(at, language);
|
|
180
|
+
const sky = partOfDay(at.getHours()) === "evening" ? "moon" : "sun";
|
|
181
|
+
if (face.dataset.sky !== sky) {
|
|
182
|
+
face.dataset.sky = sky;
|
|
183
|
+
sun.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${PICTURES[sky]}</svg>`;
|
|
184
|
+
}
|
|
185
|
+
put(greeting, now.greeting);
|
|
186
|
+
put(month, words.month(at.getMonth() + 1, words.weekdays[at.getDay()]));
|
|
187
|
+
put(day, String(at.getDate()));
|
|
188
|
+
// The date line's pieces, a space between them, made again only when its words are others.
|
|
189
|
+
if (date.textContent !== now.line.join(" ")) {
|
|
190
|
+
date.replaceChildren(...now.line.flatMap((piece, index) => {
|
|
191
|
+
const node = made("span", "piece");
|
|
192
|
+
node.classList.toggle("gallery-soft-today-weekday", index === words.weekdayAt);
|
|
193
|
+
node.textContent = piece;
|
|
194
|
+
return index === 0 ? [node] : [" ", node];
|
|
195
|
+
}));
|
|
196
|
+
}
|
|
197
|
+
if (date.dateTime !== now.datetime) {
|
|
198
|
+
date.dateTime = now.datetime;
|
|
199
|
+
number.textContent = words.week(weekNumberOf(at));
|
|
200
|
+
week.replaceChildren(...weekOf(at, language).map((one) => {
|
|
201
|
+
const item = made("li", "date-of");
|
|
202
|
+
item.classList.toggle("gallery-soft-today-now", one.today);
|
|
203
|
+
item.classList.toggle("gallery-soft-today-past", one.past);
|
|
204
|
+
const initial = made("span", "initial");
|
|
205
|
+
initial.textContent = one.initial;
|
|
206
|
+
const figure = made("span", "number");
|
|
207
|
+
figure.textContent = String(one.date);
|
|
208
|
+
item.append(initial, figure);
|
|
209
|
+
return item;
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
lay();
|
|
214
|
+
draw();
|
|
215
|
+
return {
|
|
216
|
+
update(reason) {
|
|
217
|
+
if (reason === "layout") lay();
|
|
218
|
+
else draw();
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 120"><defs><linearGradient id="w" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#3e7ac6" stop-opacity=".07"/><stop offset=".52" stop-color="#3e7ac6" stop-opacity="0"/></linearGradient></defs><rect width="240" height="120" rx="8" fill="#f3f3f1"/><rect x="16.5" y="12.5" width="207" height="95" rx="14" fill="#ffffff" stroke="#e8e7e4"/><circle cx="36" cy="33" r="5" fill="#f6b23c"/><rect x="48" y="26" width="52" height="14" rx="7" fill="#1f1f1f"/><rect x="30" y="46" width="46" height="5" rx="2.5" fill="#c4c2bd"/><rect x="178" y="46" width="26" height="5" rx="2.5" fill="#c4c2bd"/><rect x="36" y="70" width="8" height="3" rx="1.5" fill="#c4c2bd"/><rect x="35" y="83" width="10" height="5" rx="2.5" fill="#d9d8d4"/><rect x="61.5" y="70" width="8" height="3" rx="1.5" fill="#c4c2bd"/><rect x="60.5" y="83" width="10" height="5" rx="2.5" fill="#d9d8d4"/><rect x="87" y="70" width="8" height="3" rx="1.5" fill="#c4c2bd"/><rect x="86" y="83" width="10" height="5" rx="2.5" fill="#d9d8d4"/><rect x="112.5" y="70" width="8" height="3" rx="1.5" fill="#3e7ac6"/><circle cx="116.5" cy="86" r="7.5" fill="#3e7ac6"/><rect x="138" y="70" width="8" height="3" rx="1.5" fill="#c4c2bd"/><rect x="137" y="83" width="10" height="5" rx="2.5" fill="#8d8c88"/><rect x="163.5" y="70" width="8" height="3" rx="1.5" fill="#c4c2bd"/><rect x="162.5" y="83" width="10" height="5" rx="2.5" fill="#8d8c88"/><rect x="189" y="70" width="8" height="3" rx="1.5" fill="#c4c2bd"/><rect x="188" y="83" width="10" height="5" rx="2.5" fill="#8d8c88"/></svg>
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/* 柔光风格's greeting card. Every selector starts at the instance and goes down a step at a time (>), so
|
|
2
|
+
that nothing here reaches the rest of the page. The soft look's tokens first, light and dark (light-dark():
|
|
3
|
+
the page's color scheme, which follows its theme), then the face. On a custom page the face is the
|
|
4
|
+
card's whole room: it is taken out over the card's padding and given its own (the soft frame's: 20px, 18px
|
|
5
|
+
on a 2 × 2 card, by the face's data-pad), painted with the soft card's fill under a glow at its top left,
|
|
6
|
+
the sun's warm color by day, the accent's in the evening (data-sky); the board's line and radius stay
|
|
7
|
+
around it. Where no card is (a document, as gallery block check shows it) the face frames itself, at the
|
|
8
|
+
size of a 4 × 2 card. The script says the card's size (data-w, data-h): a 4 × 2 card sets the greeting
|
|
9
|
+
large after the sun, the date and the week's number under it, the week at the bottom, today on a disc
|
|
10
|
+
of the accent; a 2 × 2 card the month and the weekday at the top, the day of the month large, the
|
|
11
|
+
greeting at the bottom. */
|
|
12
|
+
[data-doc-component="gallery-soft/today"] {
|
|
13
|
+
--soft-font: "PingFang SC", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
|
|
14
|
+
--soft-num: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
|
15
|
+
--soft-card: light-dark(#ffffff, #1f1f20);
|
|
16
|
+
--soft-card-line: light-dark(rgb(28 28 32 / 6.5%), rgb(255 255 255 / 7.5%));
|
|
17
|
+
--soft-card-shadow: 0 0 0 1px var(--soft-card-line), 0 1px 2px light-dark(rgb(28 28 32 / 3.5%), rgb(0 0 0 / 0%)), 0 8px 24px -14px light-dark(rgb(28 28 32 / 12%), rgb(0 0 0 / 60%));
|
|
18
|
+
--soft-text: light-dark(#37352f, #d9d9dc);
|
|
19
|
+
--soft-strong: light-dark(#1f1f1f, #f1f1f2);
|
|
20
|
+
--soft-muted: light-dark(#7a7a7f, #9d9da3);
|
|
21
|
+
--soft-faint: light-dark(#ababb0, #66666c);
|
|
22
|
+
--soft-accent: light-dark(#3e7ac6, #7eade2);
|
|
23
|
+
--soft-accent-ink: light-dark(#356cb3, #98bee9);
|
|
24
|
+
--soft-on-accent: light-dark(#ffffff, #152436);
|
|
25
|
+
--soft-sun: light-dark(#f6b23c, #f2b046);
|
|
26
|
+
--soft-glow-day: light-dark(rgb(255 183 77 / 22%), rgb(255 196 92 / 5.5%));
|
|
27
|
+
--soft-glow-night: light-dark(rgb(62 122 198 / 16%), rgb(126 173 226 / 12%));
|
|
28
|
+
--soft-grip-room: 0px;
|
|
29
|
+
> .gallery-soft-today-face {
|
|
30
|
+
position: relative;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
display: grid;
|
|
33
|
+
grid-template-columns: 28px minmax(0, 1fr) auto;
|
|
34
|
+
grid-template-rows: 32px auto 1fr;
|
|
35
|
+
grid-template-areas: "sun greeting greeting" "date date meta" "week week week";
|
|
36
|
+
column-gap: 10px;
|
|
37
|
+
width: 304px;
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
height: 144px;
|
|
40
|
+
--soft-pad: 20px;
|
|
41
|
+
padding: calc(var(--soft-pad) - var(--soft-edge, 0px));
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
border-radius: 16px;
|
|
44
|
+
box-shadow: var(--soft-card-shadow);
|
|
45
|
+
background: radial-gradient(120% 120% at 0% 0%, var(--soft-glow-day), transparent 58%), var(--soft-card);
|
|
46
|
+
color: var(--soft-text);
|
|
47
|
+
font: 13px/1.5 var(--soft-font);
|
|
48
|
+
-webkit-font-smoothing: antialiased;
|
|
49
|
+
}
|
|
50
|
+
> .gallery-soft-today-face[data-sky="moon"] { background: radial-gradient(120% 120% at 0% 0%, var(--soft-glow-night), transparent 58%), var(--soft-card); }
|
|
51
|
+
> .gallery-soft-today-face[data-pad="s"] { --soft-pad: 18px; }
|
|
52
|
+
> .gallery-soft-today-face[data-pad="l"] { --soft-pad: 24px; }
|
|
53
|
+
> .gallery-soft-today-face > .gallery-soft-today-sun {
|
|
54
|
+
grid-area: sun;
|
|
55
|
+
align-self: center;
|
|
56
|
+
display: block;
|
|
57
|
+
width: 28px;
|
|
58
|
+
height: 28px;
|
|
59
|
+
color: var(--soft-sun);
|
|
60
|
+
}
|
|
61
|
+
> .gallery-soft-today-face[data-sky="moon"] > .gallery-soft-today-sun { color: var(--soft-accent); }
|
|
62
|
+
> .gallery-soft-today-face > .gallery-soft-today-sun > svg { display: block; width: 100%; height: 100%; }
|
|
63
|
+
> .gallery-soft-today-face > .gallery-soft-today-greeting {
|
|
64
|
+
grid-area: greeting;
|
|
65
|
+
align-self: center;
|
|
66
|
+
margin: 0;
|
|
67
|
+
padding-inline-end: var(--soft-grip-room);
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
font-size: 26px;
|
|
72
|
+
line-height: 32px;
|
|
73
|
+
font-weight: 700;
|
|
74
|
+
letter-spacing: .02em;
|
|
75
|
+
color: var(--soft-strong);
|
|
76
|
+
}
|
|
77
|
+
> .gallery-soft-today-face > .gallery-soft-today-date {
|
|
78
|
+
grid-area: date;
|
|
79
|
+
display: block;
|
|
80
|
+
min-width: 0;
|
|
81
|
+
margin-top: 4px;
|
|
82
|
+
overflow: hidden;
|
|
83
|
+
white-space: nowrap;
|
|
84
|
+
text-overflow: ellipsis;
|
|
85
|
+
font-size: 13px;
|
|
86
|
+
color: var(--soft-muted);
|
|
87
|
+
}
|
|
88
|
+
> .gallery-soft-today-face > .gallery-soft-today-meta {
|
|
89
|
+
grid-area: meta;
|
|
90
|
+
align-self: center;
|
|
91
|
+
margin-top: 4px;
|
|
92
|
+
font-size: 12px;
|
|
93
|
+
color: var(--soft-muted);
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
}
|
|
96
|
+
> .gallery-soft-today-face > .gallery-soft-today-week {
|
|
97
|
+
grid-area: week;
|
|
98
|
+
align-self: end;
|
|
99
|
+
display: grid;
|
|
100
|
+
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
101
|
+
margin: 0;
|
|
102
|
+
padding: 0;
|
|
103
|
+
list-style: none;
|
|
104
|
+
}
|
|
105
|
+
> .gallery-soft-today-face > .gallery-soft-today-week > .gallery-soft-today-date-of {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: 2px;
|
|
110
|
+
}
|
|
111
|
+
> .gallery-soft-today-face > .gallery-soft-today-week > .gallery-soft-today-date-of > .gallery-soft-today-initial { font-size: 11px; line-height: 14px; color: var(--soft-muted); }
|
|
112
|
+
> .gallery-soft-today-face > .gallery-soft-today-week > .gallery-soft-today-date-of > .gallery-soft-today-number {
|
|
113
|
+
display: grid;
|
|
114
|
+
place-items: center;
|
|
115
|
+
width: 26px;
|
|
116
|
+
height: 26px;
|
|
117
|
+
border-radius: 50%;
|
|
118
|
+
font: 400 13px/1 var(--soft-num);
|
|
119
|
+
font-variant-numeric: tabular-nums;
|
|
120
|
+
color: var(--soft-text);
|
|
121
|
+
}
|
|
122
|
+
> .gallery-soft-today-face > .gallery-soft-today-week > .gallery-soft-today-past > .gallery-soft-today-number { color: var(--soft-faint); }
|
|
123
|
+
> .gallery-soft-today-face > .gallery-soft-today-week > .gallery-soft-today-now > .gallery-soft-today-initial { color: var(--soft-accent-ink); font-weight: 600; }
|
|
124
|
+
> .gallery-soft-today-face > .gallery-soft-today-week > .gallery-soft-today-now > .gallery-soft-today-number { background: var(--soft-accent); color: var(--soft-on-accent); font-weight: 600; }
|
|
125
|
+
> .gallery-soft-today-face > :is(.gallery-soft-today-month, .gallery-soft-today-day) { display: none; }
|
|
126
|
+
/* A 2 × 2 card: the month and the weekday beside the sun, the day of the month large, the greeting at the bottom. */
|
|
127
|
+
> .gallery-soft-today-face:is([data-w="1"], [data-w="2"]) {
|
|
128
|
+
grid-template-columns: 20px minmax(0, 1fr);
|
|
129
|
+
grid-template-rows: 24px auto 1fr;
|
|
130
|
+
grid-template-areas: "sun month" "day day" "greeting greeting";
|
|
131
|
+
column-gap: 6px;
|
|
132
|
+
}
|
|
133
|
+
> .gallery-soft-today-face:is([data-w="1"], [data-w="2"]) > :is(.gallery-soft-today-date, .gallery-soft-today-meta, .gallery-soft-today-week) { display: none; }
|
|
134
|
+
> .gallery-soft-today-face:is([data-w="1"], [data-w="2"]) > .gallery-soft-today-sun { width: 20px; height: 20px; }
|
|
135
|
+
> .gallery-soft-today-face:is([data-w="1"], [data-w="2"]) > .gallery-soft-today-month {
|
|
136
|
+
grid-area: month;
|
|
137
|
+
align-self: center;
|
|
138
|
+
display: block;
|
|
139
|
+
min-width: 0;
|
|
140
|
+
/* a quiet line: it may reach into the grip's corner, faded while the grip shows */
|
|
141
|
+
opacity: calc(1 - var(--gallery-grip-shown, 0));
|
|
142
|
+
transition: opacity .12s ease-out;
|
|
143
|
+
overflow: hidden;
|
|
144
|
+
white-space: nowrap;
|
|
145
|
+
text-overflow: ellipsis;
|
|
146
|
+
font-size: 12.5px;
|
|
147
|
+
color: var(--soft-muted);
|
|
148
|
+
}
|
|
149
|
+
> .gallery-soft-today-face:is([data-w="1"], [data-w="2"]) > .gallery-soft-today-day {
|
|
150
|
+
grid-area: day;
|
|
151
|
+
display: block;
|
|
152
|
+
margin-top: 10px;
|
|
153
|
+
font: 700 52px/1 var(--soft-num);
|
|
154
|
+
letter-spacing: -.03em;
|
|
155
|
+
font-variant-numeric: tabular-nums;
|
|
156
|
+
color: var(--soft-strong);
|
|
157
|
+
}
|
|
158
|
+
> .gallery-soft-today-face:is([data-w="1"], [data-w="2"]) > .gallery-soft-today-greeting {
|
|
159
|
+
align-self: end;
|
|
160
|
+
font-size: 13px;
|
|
161
|
+
line-height: 1.5;
|
|
162
|
+
font-weight: 600;
|
|
163
|
+
letter-spacing: 0;
|
|
164
|
+
color: var(--soft-text);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/* On a custom page: the face over the card's whole room, its padding the soft frame's, the board's line around it. */
|
|
168
|
+
.gallery-card > [data-doc-component="gallery-soft/today"] { height: 100%; }
|
|
169
|
+
.gallery-card > [data-doc-component="gallery-soft/today"] > .gallery-soft-today-face {
|
|
170
|
+
--soft-edge: 1px;
|
|
171
|
+
--soft-grip-room: max(0px, calc(40px - var(--soft-pad)));
|
|
172
|
+
width: auto;
|
|
173
|
+
max-width: none;
|
|
174
|
+
height: calc(100% + 2 * var(--gallery-card-pad));
|
|
175
|
+
margin: calc(-1 * var(--gallery-card-pad));
|
|
176
|
+
border-radius: calc(var(--gallery-card-radius) - 1px);
|
|
177
|
+
box-shadow: none;
|
|
178
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div data-doc-component="gallery-soft/today"></div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 问候与日期 (gallery-soft/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
|
+
It is 柔光风格's (the pack `gallery-soft`, off until the user turns it on in 设置 › 组件列表): the same card as Gallery 风格's `gallery/today`, its settings, its data and what the user does on it the same, in the soft look of design A (a faint wash of blue from the card's top, rounded chips, big numbers). Write it only where the user asked for 柔光风格 or the page already holds its cards.
|
|
6
|
+
|
|
7
|
+
## How to write it
|
|
8
|
+
|
|
9
|
+
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 gallery-soft/today`: the instance is empty, `<div data-doc-component="gallery-soft/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.
|
|
10
|
+
|
|
11
|
+
- Sizes: 4 × 2 (the default: the greeting large, the date and the week's number under it, the week at the bottom) and 2 × 2 (the month and the weekday at the top, the day of the month large, the greeting at the bottom). The user may switch between them.
|
|
12
|
+
- Its places hold no document: no document's menu offers it. In a document it would show the same words, framed by nothing.
|
|
13
|
+
|
|
14
|
+
## How it looks
|
|
15
|
+
|
|
16
|
+
The greeting large after the sun (by day) or the moon (in the evening), the date under it with the number of the week (第 46 周) at its end, and the week it is in at the bottom, Monday to Sunday, each day's initial over its date, the days gone faint, today's 今 over its date on a disc of the accent; a 2 × 2 card says 11月 · 星期一 at the top beside the sun, the day of the month large, the greeting under it; a glow at the card's top left, warm by day, the accent's blue in the evening; in 柔光风格's soft look (as every card of it: a faint wash of blue from the card's top, a head of a rounded 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-soft/todos",
|
|
3
|
+
"apiVersion": 1,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"name": { "zh": "我的待办", "en": "My to-dos" },
|
|
6
|
+
"description": { "zh": "所有文档里没完成的待办,按文档分组:勾选就写回那篇文档,点文字打开它", "en": "The to-dos of every document not done yet, by document: 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-soft-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
|
+
}
|