@heycys/gallery 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/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/icons.mjs +3 -0
- 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/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/emoji/line-icons.mjs +37 -0
- package/browser/shared/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +40 -17
- package/browser/shared/outline.mjs +30 -2
- 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/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/{chunk-QOUEFUCH.mjs → chunk-3MBRL2PM.mjs} +1 -1
- package/dist/{chunk-NWR2LT5B.mjs → chunk-4OKWZY5E.mjs} +1 -1
- package/dist/{chunk-RMECZA2K.mjs → chunk-5K44HLTZ.mjs} +1 -1
- package/dist/{chunk-NFMCP2HI.mjs → chunk-5XA2ZBAE.mjs} +2 -2
- package/dist/{chunk-OUUP3WKT.mjs → chunk-67N2QJYT.mjs} +1 -1
- package/dist/chunk-6KBYRA2C.mjs +2 -0
- package/dist/{chunk-SX4LJYT6.mjs → chunk-6N3PX4XX.mjs} +1 -1
- package/dist/{chunk-RFDZXFJF.mjs → chunk-7JDX4E65.mjs} +1 -1
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/{chunk-ZUNVAXLH.mjs → chunk-7OG26PGF.mjs} +1 -1
- package/dist/{chunk-B4P2CM2J.mjs → chunk-AHN3NFKJ.mjs} +1 -1
- package/dist/chunk-ALZ6ZENZ.mjs +3 -0
- package/dist/{chunk-UGWYKHBL.mjs → chunk-AR5D57ZD.mjs} +2 -2
- package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
- package/dist/{chunk-HLYV7RIH.mjs → chunk-CMA72MAG.mjs} +1 -1
- package/dist/{chunk-D4CKRD3V.mjs → chunk-DAZL73VK.mjs} +2 -2
- package/dist/{chunk-6VTU6KEO.mjs → chunk-DJISHPUL.mjs} +1 -1
- package/dist/{chunk-BPL64HGA.mjs → chunk-EAIFITAV.mjs} +1 -1
- package/dist/chunk-EP25HDAJ.mjs +2 -0
- package/dist/{chunk-6EZ7FNIK.mjs → chunk-F4ZA6JRZ.mjs} +1 -1
- package/dist/{chunk-3KJHLHUO.mjs → chunk-F6HVDZR4.mjs} +1 -1
- package/dist/{chunk-3NJACR4W.mjs → chunk-FDMAXMQA.mjs} +1 -1
- package/dist/chunk-FETSREUN.mjs +5 -0
- package/dist/{chunk-RKPWLGZ3.mjs → chunk-GHOYKMQ3.mjs} +1 -1
- package/dist/chunk-HDWTZ763.mjs +12 -0
- package/dist/{chunk-VTKNEYT3.mjs → chunk-HPOI4ZX7.mjs} +1 -1
- package/dist/{chunk-OW5NWPOJ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
- package/dist/{chunk-V6RIYQZZ.mjs → chunk-ITOH5EGO.mjs} +1 -1
- package/dist/{chunk-ZWPMCK7P.mjs → chunk-IV64FFI4.mjs} +1 -1
- package/dist/chunk-J43Z6LSS.mjs +2 -0
- package/dist/chunk-J5PUIV3Y.mjs +4 -0
- package/dist/{chunk-KTKHRC6H.mjs → chunk-JA7G53PC.mjs} +1 -1
- package/dist/{chunk-NWFBE2YA.mjs → chunk-JLTZF4LA.mjs} +1 -1
- package/dist/{chunk-GY3FAUVM.mjs → chunk-JZT7I2OJ.mjs} +1 -1
- package/dist/{chunk-QKXMPUXC.mjs → chunk-K5XATEOO.mjs} +1 -1
- package/dist/chunk-L2SUIS5S.mjs +2 -0
- package/dist/{chunk-TEZAWDSQ.mjs → chunk-LM4XFQHZ.mjs} +1 -1
- package/dist/{chunk-5ZJA7CXT.mjs → chunk-MN7BZL4R.mjs} +1 -1
- package/dist/chunk-MTYYHM2G.mjs +15 -0
- package/dist/{chunk-HMYTM3GT.mjs → chunk-MXUBKDRO.mjs} +1 -1
- package/dist/{chunk-MHW7ZKOU.mjs → chunk-OEXWRJME.mjs} +1 -1
- package/dist/{chunk-CRJEG7MT.mjs → chunk-OFHXGWOX.mjs} +1 -1
- package/dist/chunk-ORID3AE7.mjs +166 -0
- package/dist/{chunk-32ZUEFZ7.mjs → chunk-PGDE24N5.mjs} +1 -1
- package/dist/{chunk-UNOYVIYR.mjs → chunk-POTA2FV4.mjs} +1 -1
- package/dist/{chunk-N7AZZLGT.mjs → chunk-QE5RG76S.mjs} +18 -17
- package/dist/{chunk-N76HWBA3.mjs → chunk-R2ZDLJYT.mjs} +1 -1
- package/dist/chunk-SWUTTZCN.mjs +2 -0
- package/dist/{chunk-POQSE4C2.mjs → chunk-TR7TWGHB.mjs} +1 -1
- package/dist/chunk-U5XL7D6A.mjs +3 -0
- package/dist/{chunk-PVER7LSC.mjs → chunk-U7NZI6N4.mjs} +2 -2
- package/dist/{chunk-Q47PLKIJ.mjs → chunk-UGWMMEJ5.mjs} +1 -1
- package/dist/chunk-UJQJKNGK.mjs +2 -0
- package/dist/chunk-UYVCQK3H.mjs +22 -0
- package/dist/{chunk-FJYN7RTH.mjs → chunk-VFX2KNHP.mjs} +1 -1
- package/dist/{chunk-UBBRTJ2R.mjs → chunk-VS7JIGJW.mjs} +1 -1
- package/dist/{chunk-NVRNLK25.mjs → chunk-W7665ZEC.mjs} +2 -2
- package/dist/{chunk-NG375ILQ.mjs → chunk-WQDQWCX5.mjs} +1 -1
- package/dist/chunk-YLPSMDIS.mjs +5 -0
- package/dist/{chunk-VXACTLO3.mjs → chunk-YNAWBAYN.mjs} +1 -1
- package/dist/{chunk-ZB4H7ZN4.mjs → chunk-YROX2O22.mjs} +1 -1
- package/dist/{chunk-YQGT4AB2.mjs → chunk-ZDLPUOAG.mjs} +1 -1
- package/dist/chunk-ZQS6H473.mjs +16 -0
- package/dist/{chunk-OJKMINIU.mjs → chunk-ZWWC4KLF.mjs} +15 -15
- 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/report.css +120 -41
- 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 +9 -9
- package/skill/SKILL.md +12 -12
- package/skill/references/building-blocks.md +4 -4
- package/skill/references/pages-and-data.md +13 -9
- package/skill/references/writing-html.md +2 -0
- package/web/assets/index-BM_K-Auu.css +1 -0
- package/web/assets/index-DRslOBiv.js +15 -0
- package/web/index.html +2 -2
- package/dist/chunk-2NRBY6AJ.mjs +0 -2
- package/dist/chunk-35NQ4PLQ.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-JVHHHGEA.mjs +0 -3
- package/dist/chunk-PZDLJJTJ.mjs +0 -3
- package/dist/chunk-SXHBYZST.mjs +0 -16
- 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
|
@@ -1,14 +1,18 @@
|
|
|
1
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,
|
|
2
|
+
// name: how many are left before it, 就是今天 on the day itself, how many have gone since after it. Its two
|
|
3
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
|
|
5
|
-
// only reads: it writes nothing. Drawn from that part on every `source` (the
|
|
6
|
-
// undo) and again as a day begins (the kit's `clock`, "day"), so that the count
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// (还有, 已经过去) over the count,
|
|
11
|
-
//
|
|
4
|
+
// the grip at the card's top right › 设置…), kept in the data part `settings`, a script of JSON, which the
|
|
5
|
+
// board writes and this block only reads: it writes nothing. Drawn from that part on every `source` (the
|
|
6
|
+
// form, an Agent's write, an undo) and again as a day begins (the kit's `clock`, "day"), so that the count
|
|
7
|
+
// moves at midnight. The words are the page's language (the UI's where Gallery says it, else the page's
|
|
8
|
+
// lang). Its face (the pack's design B, in the kit's card tokens): a head of the chip, an hourglass, and
|
|
9
|
+
// the day's name alone (春节, or 倒计时 where it has none), on one line; at the bottom the count's label
|
|
10
|
+
// (还有, 已经过去) over the count, the hero, and its unit, and the date under them, faint (2027年2月6日 周六);
|
|
11
|
+
// on the day, 就是今天 in the accent where the count stands. A card four cells wide (`data-layout` "wide",
|
|
12
|
+
// by context.size, read again on `layout`) sets the month of the date beside it, a small calendar, Monday
|
|
13
|
+
// first, the day itself the one solid square of the accent (`monthOf`). A date it cannot read, or none,
|
|
14
|
+
// is the cards' empty face under the head: 选一个日子, and where to set one. Its face says by `data-kind`
|
|
15
|
+
// which of left, today, since or none it shows.
|
|
12
16
|
|
|
13
17
|
const WORDS = {
|
|
14
18
|
zh: {
|
|
@@ -18,9 +22,11 @@ const WORDS = {
|
|
|
18
22
|
days: (/** @type {number} */ count) => `${count}`,
|
|
19
23
|
unit: () => "天",
|
|
20
24
|
countdown: "倒计时",
|
|
21
|
-
pick: "
|
|
22
|
-
where: "
|
|
23
|
-
|
|
25
|
+
pick: "选一个日子",
|
|
26
|
+
where: "在卡片右上角的 设置… 里填日期",
|
|
27
|
+
whereShort: "在 设置… 里填日期",
|
|
28
|
+
weekdays: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
|
|
29
|
+
initials: ["一", "二", "三", "四", "五", "六", "日"],
|
|
24
30
|
date: (/** @type {number} */ year, /** @type {number} */ month, /** @type {number} */ day, /** @type {string} */ weekday) => [`${year}年${month}月${day}日`, weekday],
|
|
25
31
|
},
|
|
26
32
|
en: {
|
|
@@ -30,10 +36,12 @@ const WORDS = {
|
|
|
30
36
|
days: (/** @type {number} */ count) => `${count}`,
|
|
31
37
|
unit: (/** @type {number} */ count) => (count === 1 ? "day" : "days"),
|
|
32
38
|
countdown: "Countdown",
|
|
33
|
-
pick: "Pick a
|
|
34
|
-
where: "
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
pick: "Pick a day",
|
|
40
|
+
where: "Set its date in Settings… at the card's top right",
|
|
41
|
+
whereShort: "Set its date in Settings…",
|
|
42
|
+
weekdays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
43
|
+
initials: ["M", "T", "W", "T", "F", "S", "S"],
|
|
44
|
+
date: (/** @type {number} */ year, /** @type {number} */ month, /** @type {number} */ day, /** @type {string} */ weekday) => [`${weekday},`, `${["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][month - 1]} ${day}, ${year}`],
|
|
37
45
|
},
|
|
38
46
|
};
|
|
39
47
|
|
|
@@ -76,8 +84,10 @@ function countdownOf(written, now) {
|
|
|
76
84
|
/**
|
|
77
85
|
* What the card says, in `language`, of its `settings` (context.readJSON's, {} where none is set yet)
|
|
78
86
|
* 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
|
|
80
|
-
* its foot, a list of words a line breaks between and never inside (the date, its weekday)
|
|
87
|
+
* count (null on the day and with no date; `big`, the words standing there instead: 就是今天), the count's
|
|
88
|
+
* unit, its foot, a list of words a line breaks between and never inside (the date, its weekday), and,
|
|
89
|
+
* with no date it can read, `empty`: what the empty face says (选一个日子, where to set one on a wide card
|
|
90
|
+
* and on a narrow one).
|
|
81
91
|
* @param {any} settings
|
|
82
92
|
* @param {Date} now
|
|
83
93
|
* @param {"zh" | "en"} language
|
|
@@ -88,11 +98,24 @@ function faceOf(settings, now, language) {
|
|
|
88
98
|
const named = typeof settings?.title === "string" ? settings.title.trim() : "";
|
|
89
99
|
const count = countdownOf(settings?.date, now);
|
|
90
100
|
const head = named || words.countdown;
|
|
91
|
-
if (!date || count.kind === "none") return { head, label: "", count: null, unit: "", big: words.pick,
|
|
101
|
+
if (!date || count.kind === "none") return { head, label: "", count: null, unit: "", big: "", foot: [], empty: { title: words.pick, where: words.where, whereShort: words.whereShort } };
|
|
92
102
|
const weekday = words.weekdays[new Date(Date.UTC(date.year, date.month - 1, date.day)).getUTCDay()];
|
|
93
103
|
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 };
|
|
104
|
+
if (count.kind === "today") return { head, label: "", count: null, unit: "", big: words.today, foot, empty: null };
|
|
105
|
+
return { head, label: count.kind === "left" ? words.left : words.since, count: words.days(count.days), unit: words.unit(count.days), big: "", foot, empty: null };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The month of `date` ({ year, month, day }) as the small calendar draws it, Monday first: its weeks, each
|
|
110
|
+
* seven days of the month (a number) or none before its first and after its last (null).
|
|
111
|
+
* @param {{ year: number, month: number }} date
|
|
112
|
+
*/
|
|
113
|
+
function monthOf(date) {
|
|
114
|
+
const first = (new Date(Date.UTC(date.year, date.month - 1, 1)).getUTCDay() + 6) % 7;
|
|
115
|
+
const length = new Date(Date.UTC(date.year, date.month, 0)).getUTCDate();
|
|
116
|
+
const cells = [...Array(first).fill(null), ...Array.from({ length }, (_, index) => index + 1)];
|
|
117
|
+
while (cells.length % 7) cells.push(null);
|
|
118
|
+
return Array.from({ length: cells.length / 7 }, (_, week) => cells.slice(week * 7, week * 7 + 7));
|
|
96
119
|
}
|
|
97
120
|
|
|
98
121
|
/**
|
|
@@ -109,20 +132,33 @@ function made(tag, kind) {
|
|
|
109
132
|
|
|
110
133
|
DocKit.component({
|
|
111
134
|
id: "gallery/countdown",
|
|
112
|
-
on: ["source", "clock"],
|
|
135
|
+
on: ["source", "clock", "layout"],
|
|
113
136
|
mount(host, context) {
|
|
114
137
|
const language = languageOf(document.documentElement);
|
|
138
|
+
const words = WORDS[language];
|
|
115
139
|
const face = made("div", "face");
|
|
140
|
+
const main = made("div", "main");
|
|
116
141
|
const head = made("p", "head");
|
|
117
142
|
const chip = made("span", "chip");
|
|
118
143
|
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
|
|
144
|
+
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 3.5h11M6.5 20.5h11M7.5 3.5v2.2c0 2 1.3 3.6 3.2 4.4l1.3.6 1.3-.6c1.9-.8 3.2-2.4 3.2-4.4V3.5M7.5 20.5v-2.2c0-2 1.3-3.6 3.2-4.4l1.3-.6 1.3.6c1.9.8 3.2 2.4 3.2 4.4v2.2"/></svg>';
|
|
120
145
|
const named = made("span", "name");
|
|
121
146
|
head.append(chip, named);
|
|
147
|
+
const core = made("div", "core");
|
|
122
148
|
const label = made("p", "label");
|
|
123
149
|
const middle = made("p", "count");
|
|
124
150
|
const foot = made("p", "foot");
|
|
125
|
-
|
|
151
|
+
core.append(label, middle, foot);
|
|
152
|
+
// No date: the cards' empty face, what to do and where.
|
|
153
|
+
const empty = made("div", "empty");
|
|
154
|
+
const emptyTitle = made("p", "empty-title");
|
|
155
|
+
const emptyWhere = made("p", "empty-where");
|
|
156
|
+
empty.append(emptyTitle, emptyWhere);
|
|
157
|
+
main.append(head, core, empty);
|
|
158
|
+
// A wide card's month, beside the count: the calendar of the date, the day itself marked.
|
|
159
|
+
const month = made("div", "month");
|
|
160
|
+
month.setAttribute("aria-hidden", "true");
|
|
161
|
+
face.append(main, month);
|
|
126
162
|
host.append(face);
|
|
127
163
|
const draw = (/** @type {string} */ reason = "", /** @type {unknown} */ detail = null) => {
|
|
128
164
|
if (reason === "clock" && detail !== "day") return; // a minute moves no count
|
|
@@ -131,6 +167,8 @@ DocKit.component({
|
|
|
131
167
|
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
168
|
const at = new Date();
|
|
133
169
|
const now = faceOf(settings, at, language);
|
|
170
|
+
const layout = context.size && context.size.w >= 4 ? "wide" : "narrow";
|
|
171
|
+
face.dataset.layout = layout;
|
|
134
172
|
face.dataset.kind = countdownOf(settings.date, at).kind;
|
|
135
173
|
named.textContent = now.head;
|
|
136
174
|
named.title = now.head;
|
|
@@ -140,15 +178,37 @@ DocKit.component({
|
|
|
140
178
|
middle.textContent = now.big;
|
|
141
179
|
} else {
|
|
142
180
|
middle.classList.remove("gallery-countdown-words");
|
|
181
|
+
const number = made("span", "number");
|
|
182
|
+
number.textContent = now.count;
|
|
143
183
|
const unit = made("span", "unit");
|
|
144
184
|
unit.textContent = now.unit;
|
|
145
|
-
middle.replaceChildren(
|
|
185
|
+
middle.replaceChildren(number, unit);
|
|
146
186
|
}
|
|
147
|
-
foot.replaceChildren(...now.foot.flatMap((
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
return index === 0 ? [
|
|
187
|
+
foot.replaceChildren(...now.foot.flatMap((piece, index) => {
|
|
188
|
+
const node = made("span", "piece");
|
|
189
|
+
node.textContent = piece;
|
|
190
|
+
return index === 0 ? [node] : [" ", node];
|
|
151
191
|
}));
|
|
192
|
+
emptyTitle.textContent = now.empty?.title ?? "";
|
|
193
|
+
emptyWhere.textContent = now.empty ? (layout === "wide" ? now.empty.where : now.empty.whereShort) : "";
|
|
194
|
+
const date = dateOf(settings.date);
|
|
195
|
+
if (!date) return void month.replaceChildren();
|
|
196
|
+
const head = words.initials.map((initial, index) => {
|
|
197
|
+
const cell = made("span", "initial");
|
|
198
|
+
cell.classList.toggle("gallery-countdown-weekend", index >= 5);
|
|
199
|
+
cell.textContent = initial;
|
|
200
|
+
return cell;
|
|
201
|
+
});
|
|
202
|
+
const weeks = monthOf(date);
|
|
203
|
+
month.dataset.weeks = String(weeks.length);
|
|
204
|
+
month.replaceChildren(...head, ...weeks.flatMap((week) => week.map((day, index) => {
|
|
205
|
+
const cell = made("span", "day");
|
|
206
|
+
if (day === null) return cell;
|
|
207
|
+
cell.textContent = String(day);
|
|
208
|
+
cell.classList.toggle("gallery-countdown-weekend", index >= 5);
|
|
209
|
+
cell.classList.toggle("gallery-countdown-on", day === date.day);
|
|
210
|
+
return cell;
|
|
211
|
+
})));
|
|
152
212
|
};
|
|
153
213
|
draw();
|
|
154
214
|
return { update: draw };
|
|
@@ -1 +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="
|
|
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="72.5" y="12.5" width="95" height="95" rx="8" fill="#ffffff" stroke="#e6e6e3"/><rect x="82" y="22" width="10" height="10" rx="3" fill="#efefed"/><rect x="96" y="24.5" width="22" height="5" rx="2.5" fill="#37352f"/><rect x="82" y="44" width="14" height="4" rx="2" fill="#a6a5a1"/><rect x="82" y="54" width="30" height="24" rx="3" fill="#1d1d1b"/><rect x="115" y="72" width="7" height="6" rx="3" fill="#a6a5a1"/><rect x="82" y="88" width="52" height="4" rx="2" fill="#d4d3cf"/></svg>
|
|
@@ -1,130 +1,118 @@
|
|
|
1
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
|
|
3
|
-
the
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
reaches the rest of the page. The pack's design B, in the kit's card tokens: the head (the chip, an
|
|
3
|
+
hourglass, and the day's name, one line cut with an ellipsis, its end clear of the card's grip); at the
|
|
4
|
+
bottom the count's label (还有, 已经过去) over the count, the card's hero (44px, 48px on a wide card) and
|
|
5
|
+
its unit, and the date under them, faint; on the day, 就是今天 in the accent's ink where the count stands.
|
|
6
|
+
A wide card (data-layout "wide", four cells) sets the month of the date at its right, 126px, seven
|
|
7
|
+
columns Monday first, the weekend fainter, the day itself the one solid square of the accent (a month of
|
|
8
|
+
six weeks a little closer, so that it fits the card). No date: the cards' empty face under the head.
|
|
9
|
+
Light and dark. */
|
|
9
10
|
[data-doc-component="gallery/countdown"] {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 {
|
|
11
|
+
font-family: var(--gallery-font);
|
|
12
|
+
font-size: 13px;
|
|
13
|
+
line-height: 1.5;
|
|
14
|
+
color: var(--gallery-text);
|
|
15
|
+
> .gallery-countdown-face { display: flex; gap: 16px; box-sizing: border-box; min-height: 0; }
|
|
16
|
+
> .gallery-countdown-face > .gallery-countdown-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
|
|
17
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head {
|
|
23
18
|
display: flex;
|
|
24
19
|
align-items: center;
|
|
25
20
|
gap: 8px;
|
|
21
|
+
height: 20px;
|
|
26
22
|
min-width: 0;
|
|
23
|
+
margin: 0;
|
|
27
24
|
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
25
|
}
|
|
33
|
-
> .gallery-countdown-face > .gallery-countdown-head > .gallery-countdown-chip {
|
|
26
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head > .gallery-countdown-chip {
|
|
34
27
|
flex: none;
|
|
35
|
-
display:
|
|
36
|
-
|
|
37
|
-
justify-content: center;
|
|
28
|
+
display: grid;
|
|
29
|
+
place-items: center;
|
|
38
30
|
width: var(--gallery-chip-size);
|
|
39
31
|
height: var(--gallery-chip-size);
|
|
40
32
|
border-radius: var(--gallery-chip-radius);
|
|
41
|
-
background: var(--gallery-
|
|
42
|
-
color: var(--gallery-
|
|
33
|
+
background: var(--gallery-fill);
|
|
34
|
+
color: var(--gallery-muted);
|
|
43
35
|
}
|
|
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 {
|
|
36
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head > .gallery-countdown-chip > svg { display: block; width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
|
|
37
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-head > .gallery-countdown-name {
|
|
46
38
|
min-width: 0;
|
|
47
39
|
overflow: hidden;
|
|
48
40
|
white-space: nowrap;
|
|
49
41
|
text-overflow: ellipsis;
|
|
42
|
+
font-size: var(--gallery-title-size);
|
|
43
|
+
line-height: var(--gallery-title-line);
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
color: var(--gallery-text);
|
|
50
46
|
}
|
|
51
|
-
|
|
52
|
-
> .gallery-countdown-face > .gallery-countdown-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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;
|
|
47
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core { margin-top: auto; }
|
|
48
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > p { margin: 0; }
|
|
49
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-label { font-size: 12px; line-height: 16px; color: var(--gallery-muted); }
|
|
50
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-label:empty { display: none; }
|
|
51
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count { display: flex; align-items: baseline; margin: 3px 0 7px; }
|
|
52
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count > .gallery-countdown-number {
|
|
53
|
+
font-size: 44px;
|
|
54
|
+
line-height: 1;
|
|
64
55
|
font-weight: var(--gallery-numeral-weight);
|
|
65
56
|
letter-spacing: var(--gallery-numeral-tracking);
|
|
57
|
+
font-variant-numeric: lining-nums;
|
|
66
58
|
color: var(--gallery-text-strong);
|
|
67
|
-
font-variant-numeric: tabular-nums;
|
|
68
|
-
white-space: nowrap;
|
|
69
59
|
}
|
|
70
|
-
> .gallery-countdown-face > .gallery-countdown-count > .gallery-countdown-unit {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
font-size: min(var(--gallery-figure-size), 13cqi);
|
|
80
|
-
line-height: 1.2;
|
|
81
|
-
letter-spacing: -.01em;
|
|
82
|
-
white-space: normal;
|
|
60
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count > .gallery-countdown-unit { margin-left: 3px; font-size: var(--gallery-unit); font-weight: 500; color: var(--gallery-muted); }
|
|
61
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-words {
|
|
62
|
+
display: block;
|
|
63
|
+
margin: 2px 0 6px;
|
|
64
|
+
font-size: 24px;
|
|
65
|
+
line-height: 30px;
|
|
66
|
+
font-weight: 600;
|
|
67
|
+
letter-spacing: .02em;
|
|
68
|
+
color: var(--gallery-accent-ink);
|
|
83
69
|
}
|
|
84
|
-
> .gallery-countdown-face
|
|
85
|
-
|
|
86
|
-
> .gallery-countdown-face[data-
|
|
87
|
-
|
|
70
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-foot { font-size: 11.5px; line-height: 16px; color: var(--gallery-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
71
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty { display: none; }
|
|
72
|
+
> .gallery-countdown-face[data-layout="wide"] > .gallery-countdown-main > .gallery-countdown-core > .gallery-countdown-count > .gallery-countdown-number { font-size: 48px; }
|
|
73
|
+
|
|
74
|
+
/* No date: the cards' empty face, under the head. */
|
|
75
|
+
> .gallery-countdown-face[data-kind="none"] > .gallery-countdown-main > .gallery-countdown-core,
|
|
76
|
+
> .gallery-countdown-face[data-kind="none"] > .gallery-countdown-month,
|
|
77
|
+
> .gallery-countdown-face[data-layout="wide"][data-kind="none"] > .gallery-countdown-month { display: none; }
|
|
78
|
+
> .gallery-countdown-face[data-kind="none"] > .gallery-countdown-main > .gallery-countdown-empty {
|
|
79
|
+
flex: 1;
|
|
88
80
|
display: flex;
|
|
89
81
|
flex-direction: column;
|
|
90
|
-
|
|
91
|
-
gap:
|
|
92
|
-
|
|
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;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
gap: 4px;
|
|
84
|
+
min-height: 0;
|
|
99
85
|
}
|
|
100
|
-
> .gallery-countdown-face
|
|
101
|
-
|
|
86
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty > p { margin: 0; }
|
|
87
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty > .gallery-countdown-empty-title { font-size: 13.5px; line-height: 20px; font-weight: 600; color: var(--gallery-text); }
|
|
88
|
+
> .gallery-countdown-face > .gallery-countdown-main > .gallery-countdown-empty > .gallery-countdown-empty-where { font-size: 12px; line-height: 18px; color: var(--gallery-faint); }
|
|
89
|
+
|
|
90
|
+
/* The month, at a wide card's right. */
|
|
91
|
+
> .gallery-countdown-face > .gallery-countdown-month { display: none; }
|
|
92
|
+
> .gallery-countdown-face[data-layout="wide"] > .gallery-countdown-month {
|
|
93
|
+
display: grid;
|
|
102
94
|
flex: none;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
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;
|
|
95
|
+
align-self: flex-end;
|
|
96
|
+
grid-template-columns: repeat(7, 18px);
|
|
97
|
+
row-gap: 2px;
|
|
98
|
+
width: 126px;
|
|
99
|
+
font-variant-numeric: tabular-nums;
|
|
109
100
|
}
|
|
110
|
-
> .gallery-countdown-face
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
> .gallery-countdown-face > .gallery-countdown-month > span {
|
|
102
|
+
display: grid;
|
|
103
|
+
place-items: center;
|
|
104
|
+
height: 16px;
|
|
105
|
+
border-radius: 5px;
|
|
106
|
+
font-size: 10.5px;
|
|
107
|
+
line-height: 1;
|
|
108
|
+
color: var(--gallery-muted);
|
|
116
109
|
}
|
|
117
|
-
|
|
118
|
-
> .gallery-countdown-face > .gallery-countdown-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
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; }
|
|
110
|
+
> .gallery-countdown-face > .gallery-countdown-month > .gallery-countdown-initial { font-size: 10px; color: var(--gallery-faint); }
|
|
111
|
+
> .gallery-countdown-face > .gallery-countdown-month > .gallery-countdown-weekend { color: var(--gallery-faint); }
|
|
112
|
+
> .gallery-countdown-face > .gallery-countdown-month > .gallery-countdown-on { background: var(--gallery-accent); color: #fff; font-weight: 600; }
|
|
113
|
+
> .gallery-countdown-face > .gallery-countdown-month[data-weeks="6"] { row-gap: 1px; }
|
|
114
|
+
> .gallery-countdown-face > .gallery-countdown-month[data-weeks="6"] > span { height: 14px; }
|
|
130
115
|
}
|
|
116
|
+
/* On a custom page the face fills the card the board frames. */
|
|
117
|
+
.gallery-card > [data-doc-component="gallery/countdown"] { height: 100%; }
|
|
118
|
+
.gallery-card > [data-doc-component="gallery/countdown"] > .gallery-countdown-face { height: 100%; }
|
|
@@ -15,8 +15,8 @@ They are kept in its data part `settings`, a `<script type="application/json">`,
|
|
|
15
15
|
|
|
16
16
|
## How to write it
|
|
17
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.
|
|
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 (the month of the date beside the count, the day marked).
|
|
19
19
|
|
|
20
20
|
## How it looks
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
In Gallery 风格's look (the kit's card tokens, light and dark): a head of a small gray chip and a title, its end clear of the card's grip; one hero; the rest small and gray; the accent on the data and on today alone. Its head is an hourglass's chip and the day's name; at the bottom 还有 (or 已经过去) over the count of days, 44px, and the date faint under them (2027年2月6日 周六). On the day itself 就是今天 in the accent stands where the count was. A 4 × 2 card sets the month of the date at its right, Monday first, the day the one solid square of the accent. With no date it says 选一个日子 and where to set one.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "gallery/habit",
|
|
3
3
|
"apiVersion": 1,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"name": { "zh": "习惯打卡", "en": "Habit tracker" },
|
|
6
|
-
"description": { "zh": "
|
|
6
|
+
"description": { "zh": "每天打一次卡,显示连续了几天和这一周,名字在卡片上直接改", "en": "A check-in a day, the streak and this week; the habit's name is edited on the card" },
|
|
7
7
|
"words": "xiguandaka xiguan daka habit streak checkin tracker 习惯 打卡 连续 坚持",
|
|
8
8
|
"parts": {
|
|
9
9
|
"habit": { "at": ":scope > script", "edit": "data" }
|
|
10
10
|
},
|
|
11
11
|
"runtime": { "generated": [":scope > .gallery-habit-face"] },
|
|
12
12
|
"places": ["page"],
|
|
13
|
-
"card": { "sizes": [[4, 2], [2, 2]], "resize": true }
|
|
13
|
+
"card": { "sizes": [[4, 2], [2, 2], [4, 4]], "resize": true }
|
|
14
14
|
}
|