@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,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "gallery/note",
|
|
3
3
|
"apiVersion": 1,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"name": { "zh": "便签", "en": "Note" },
|
|
6
6
|
"description": { "zh": "几行随手记,在卡片上直接写,存在页面里", "en": "A few lines jotted down, typed on the card and kept in the page" },
|
|
7
7
|
"words": "bianqian note memo sticky 便签 笔记 随手记 记事",
|
|
8
8
|
"parts": {
|
|
9
9
|
"note": { "at": ":scope > script", "edit": "data" }
|
|
10
10
|
},
|
|
11
|
-
"runtime": { "generated": [":scope > .gallery-note-head", ":scope > .gallery-note-field"] },
|
|
11
|
+
"runtime": { "generated": [":scope > .gallery-note-head", ":scope > .gallery-note-field", ":scope > .gallery-note-foot"] },
|
|
12
12
|
"places": ["page"],
|
|
13
|
-
"card": { "sizes": [[4, 2], [2, 2], [4, 4]], "resize": true }
|
|
13
|
+
"card": { "sizes": [[4, 2], [2, 2], [4, 4]], "min": { "w": 2, "h": 2 }, "max": { "w": 4, "h": 8 }, "resize": true }
|
|
14
14
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
// gallery/note (便签): a few lines of free text, kept in the instance's data part, a script of JSON,
|
|
2
|
-
// { "text": "…" }, and typed on the card itself, in a <textarea> the block draws
|
|
2
|
+
// { "text": "…" }, and typed on the card itself, in a <textarea> the block draws under its head.
|
|
3
3
|
// The field is the kit's (DocKit.input): what the reader typed goes to the file once they are done with
|
|
4
4
|
// it, as they leave the field or press Ctrl+Enter (⌘Enter on a Mac; Enter alone is a new line), never
|
|
5
5
|
// while an input method composes, and never a value it holds already; Esc puts back what the file holds.
|
|
6
6
|
// Each of those is one context.editJSON, one undo step, the JSON written back on one line as it was. It
|
|
7
7
|
// draws from the part on every `source` (an Agent's write, an undo), the words the reader is typing kept
|
|
8
8
|
// where they are. Where nothing takes its writes (an export, a page that has not come to edit yet:
|
|
9
|
-
// context.canEdit() false) the field is read-only, and shows the same words. An empty note says
|
|
10
|
-
// Above the field its head
|
|
11
|
-
//
|
|
12
|
-
//
|
|
9
|
+
// context.canEdit() false) the field is read-only, and shows the same words. An empty note says 写点什么….
|
|
10
|
+
// Above the field its head (the pack's design B: the kit's card tokens): the chip, a pencil, its name,
|
|
11
|
+
// 便签, and its quiet meta after it, how many characters the field holds (its blanks not counted, said
|
|
12
|
+
// again as the reader types; none on a card two cells wide, `data-layout` "narrow" by context.size, read
|
|
13
|
+
// again on `layout`). Its lines are ruled faintly, a hint that it takes writing (style.css); while the
|
|
14
|
+
// reader types, a line under the field says the two keys (Ctrl+Enter 保存, Esc 还原; ⌘Enter on a Mac), and
|
|
15
|
+
// the card is ringed in the accent's wash; scrolled down, the field's top fades (data-scrolled). Nothing of
|
|
16
|
+
// the head or the foot is written.
|
|
13
17
|
|
|
14
18
|
const WORDS = {
|
|
15
|
-
zh: { empty: "
|
|
16
|
-
en: { empty: "Write something", label: "Note", count: (/** @type {number} */ count) => `${count} ${count === 1 ? "character" : "characters"}
|
|
19
|
+
zh: { empty: "写点什么…", label: "便签", count: (/** @type {number} */ count) => `${count} 字`, save: "保存", undo: "还原" },
|
|
20
|
+
en: { empty: "Write something…", label: "Note", count: (/** @type {number} */ count) => `${count} ${count === 1 ? "character" : "characters"}`, save: "save", undo: "revert" },
|
|
17
21
|
};
|
|
18
22
|
|
|
19
23
|
/** The language the page speaks: the UI's where Gallery says it (data-ge-language), else its lang's. */
|
|
@@ -48,9 +52,12 @@ function writeNote(context, text) {
|
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
54
|
|
|
55
|
+
/** How many characters `text` holds, its blanks (spaces, new lines) not counted. @param {string} text */
|
|
56
|
+
const countOf = (text) => [...text.replace(/\s+/g, "")].length;
|
|
57
|
+
|
|
51
58
|
DocKit.component({
|
|
52
59
|
id: "gallery/note",
|
|
53
|
-
on: ["source", "editable"],
|
|
60
|
+
on: ["source", "editable", "layout"],
|
|
54
61
|
mount(host, context) {
|
|
55
62
|
const words = WORDS[languageOf(document.documentElement)];
|
|
56
63
|
const head = document.createElement("div");
|
|
@@ -58,11 +65,11 @@ DocKit.component({
|
|
|
58
65
|
head.setAttribute("aria-hidden", "true");
|
|
59
66
|
const chip = document.createElement("span");
|
|
60
67
|
chip.className = "gallery-note-chip";
|
|
61
|
-
chip.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="
|
|
68
|
+
chip.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 19.5h3.8L19 8.8a2.4 2.4 0 0 0-3.4-3.4L4.9 16.1z"/><path d="M14 7l3 3"/></svg>';
|
|
62
69
|
const title = document.createElement("span");
|
|
63
70
|
title.className = "gallery-note-title";
|
|
64
71
|
title.textContent = words.label;
|
|
65
|
-
// Its quiet meta
|
|
72
|
+
// Its quiet meta after the title: how many characters the field holds (its blanks not counted), as the reader types too.
|
|
66
73
|
const meta = document.createElement("span");
|
|
67
74
|
meta.className = "gallery-note-meta";
|
|
68
75
|
head.append(chip, title, meta);
|
|
@@ -71,16 +78,35 @@ DocKit.component({
|
|
|
71
78
|
field.placeholder = words.empty;
|
|
72
79
|
field.spellcheck = false;
|
|
73
80
|
field.setAttribute("aria-label", words.label);
|
|
74
|
-
|
|
81
|
+
// While the reader types: the two keys, Ctrl+Enter (⌘Enter on a Mac) and Esc.
|
|
82
|
+
const foot = document.createElement("div");
|
|
83
|
+
foot.className = "gallery-note-foot";
|
|
84
|
+
foot.setAttribute("aria-hidden", "true");
|
|
85
|
+
const key = (/** @type {string} */ name, /** @type {string} */ does) => {
|
|
86
|
+
const said = document.createElement("span");
|
|
87
|
+
const bold = document.createElement("b");
|
|
88
|
+
bold.textContent = name;
|
|
89
|
+
said.append(bold, ` ${does}`);
|
|
90
|
+
return said;
|
|
91
|
+
};
|
|
92
|
+
foot.append(key(document.documentElement.dataset.docPlatform === "mac" ? "⌘Enter" : "Ctrl+Enter", words.save), key("Esc", words.undo));
|
|
93
|
+
host.append(head, field, foot);
|
|
75
94
|
const typed = DocKit.input(field, { signal: context.signal, commit: (value) => writeNote(context, value) });
|
|
76
95
|
const recount = () => {
|
|
77
|
-
const count =
|
|
96
|
+
const count = countOf(field.value);
|
|
78
97
|
const said = count > 0 ? words.count(count) : "";
|
|
79
98
|
if (meta.textContent !== said) meta.textContent = said;
|
|
80
99
|
};
|
|
81
100
|
field.addEventListener("input", recount);
|
|
82
101
|
context.signal?.addEventListener("abort", () => field.removeEventListener("input", recount), { once: true });
|
|
83
|
-
|
|
102
|
+
// Scrolled down, its top fades (style.css), so that a line it scrolled past is never cut hard.
|
|
103
|
+
const scrolled = () => field.toggleAttribute("data-scrolled", field.scrollTop > 0);
|
|
104
|
+
field.addEventListener("scroll", scrolled, { passive: true });
|
|
105
|
+
context.signal?.addEventListener("abort", () => field.removeEventListener("scroll", scrolled), { once: true });
|
|
106
|
+
const draw = (/** @type {string} */ reason = "") => {
|
|
107
|
+
const layout = context.size && context.size.w <= 2 ? "narrow" : "wide";
|
|
108
|
+
if (head.dataset.layout !== layout) head.dataset.layout = layout;
|
|
109
|
+
if (reason === "layout") return;
|
|
84
110
|
const data = context.readJSON("note");
|
|
85
111
|
if (data === undefined) return; // no JSON: the instance has failed, and Gallery shows what it holds
|
|
86
112
|
let text;
|
|
@@ -92,6 +118,7 @@ DocKit.component({
|
|
|
92
118
|
field.readOnly = !context.canEdit();
|
|
93
119
|
typed.set(text);
|
|
94
120
|
recount();
|
|
121
|
+
scrolled();
|
|
95
122
|
};
|
|
96
123
|
draw();
|
|
97
124
|
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="16.5" y="12.5" width="207" height="95" rx="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 120"><rect width="240" height="120" rx="8" fill="#f3f3f1"/><rect x="16.5" y="12.5" width="207" height="95" rx="8" fill="#ffffff" stroke="#e6e6e3"/><rect x="28" y="22" width="10" height="10" rx="3" fill="#efefed"/><rect x="42" y="24.5" width="22" height="5" rx="2.5" fill="#37352f"/><rect x="68" y="24.5" width="18" height="5" rx="2.5" fill="#d4d3cf"/><line x1="28" x2="212" y1="57" y2="57" stroke="#ededeb"/><rect x="28" y="47" width="24" height="6" rx="3" fill="#37352f"/><line x1="28" x2="212" y1="73" y2="73" stroke="#ededeb"/><rect x="28" y="63" width="112" height="6" rx="3" fill="#37352f"/><line x1="28" x2="212" y1="89" y2="89" stroke="#ededeb"/><rect x="28" y="79" width="96" height="6" rx="3" fill="#37352f"/></svg>
|
|
@@ -1,39 +1,46 @@
|
|
|
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.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
reaches the rest of the page. The pack's design B, in the kit's card tokens: its head (the chip, a
|
|
3
|
+
pencil, and 便签, how many characters it holds its quiet meta after it, none on a narrow card), its end
|
|
4
|
+
clear of the card's grip, and under it the field the script draws, the rest of the note's face: no
|
|
5
|
+
border and no fill of its own, words half a size larger than the other cards' on wide lines (26px, a
|
|
6
|
+
faint rule under each, scrolling with them: a hint that it takes writing), its placeholder (写点什么…)
|
|
7
|
+
faint, the caret the accent's. While the reader types the card is ringed in the accent's wash and a line
|
|
8
|
+
under the field says its two keys; scrolled down, the field's top fades over 8px. On a custom page it is the card's whole face, taken out over the card's padding so that
|
|
9
|
+
its ring is the card's edge; where no card is around it (a document, as gallery block check shows it) the
|
|
10
|
+
instance frames itself, a few lines high. Light and dark. */
|
|
7
11
|
[data-doc-component="gallery/note"] {
|
|
12
|
+
--gallery-note-rule: light-dark(rgb(55 53 47 / 7.5%), rgb(255 255 255 / 6%));
|
|
8
13
|
display: flex;
|
|
9
14
|
flex-direction: column;
|
|
10
|
-
gap: var(--gallery-face-gap);
|
|
11
15
|
box-sizing: border-box;
|
|
12
|
-
padding:
|
|
13
|
-
border: 1px solid var(--doc-border);
|
|
16
|
+
padding: 16px;
|
|
14
17
|
border-radius: var(--gallery-card-radius);
|
|
18
|
+
box-shadow: var(--gallery-card-shadow);
|
|
19
|
+
font-family: var(--gallery-font);
|
|
20
|
+
font-size: 13px;
|
|
21
|
+
line-height: 1.5;
|
|
22
|
+
color: var(--gallery-text);
|
|
15
23
|
> .gallery-note-head {
|
|
16
24
|
display: flex;
|
|
17
25
|
align-items: center;
|
|
18
26
|
gap: 8px;
|
|
19
27
|
flex: none;
|
|
28
|
+
height: 20px;
|
|
20
29
|
min-width: 0;
|
|
21
30
|
padding-inline-end: var(--gallery-grip-room, 0px);
|
|
22
31
|
}
|
|
23
32
|
> .gallery-note-head > .gallery-note-chip {
|
|
24
33
|
flex: none;
|
|
25
|
-
display:
|
|
26
|
-
|
|
27
|
-
justify-content: center;
|
|
34
|
+
display: grid;
|
|
35
|
+
place-items: center;
|
|
28
36
|
width: var(--gallery-chip-size);
|
|
29
37
|
height: var(--gallery-chip-size);
|
|
30
38
|
border-radius: var(--gallery-chip-radius);
|
|
31
|
-
background: var(--gallery-
|
|
32
|
-
color: var(--gallery-
|
|
39
|
+
background: var(--gallery-fill);
|
|
40
|
+
color: var(--gallery-muted);
|
|
33
41
|
}
|
|
34
|
-
> .gallery-note-head > .gallery-note-chip > svg { width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
|
|
42
|
+
> .gallery-note-head > .gallery-note-chip > svg { display: block; width: var(--gallery-chip-icon); height: var(--gallery-chip-icon); }
|
|
35
43
|
> .gallery-note-head > .gallery-note-title {
|
|
36
|
-
flex: 1 1 auto;
|
|
37
44
|
min-width: 0;
|
|
38
45
|
overflow: hidden;
|
|
39
46
|
white-space: nowrap;
|
|
@@ -41,36 +48,50 @@
|
|
|
41
48
|
font-size: var(--gallery-title-size);
|
|
42
49
|
line-height: var(--gallery-title-line);
|
|
43
50
|
font-weight: 600;
|
|
44
|
-
color: var(--gallery-text
|
|
51
|
+
color: var(--gallery-text);
|
|
45
52
|
}
|
|
46
|
-
> .gallery-note-head > .gallery-note-meta { flex: none; font-size: var(--gallery-meta-size); color: var(--
|
|
53
|
+
> .gallery-note-head > .gallery-note-meta { flex: none; font-size: var(--gallery-meta-size); color: var(--gallery-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
54
|
+
> .gallery-note-head[data-layout="narrow"] > .gallery-note-meta { display: none; }
|
|
47
55
|
> .gallery-note-field {
|
|
48
56
|
display: block;
|
|
49
57
|
flex: 1 1 auto;
|
|
50
58
|
box-sizing: border-box;
|
|
51
59
|
width: 100%;
|
|
52
|
-
min-height:
|
|
53
|
-
margin: 0;
|
|
60
|
+
min-height: 104px;
|
|
61
|
+
margin: 8px 0 0;
|
|
54
62
|
padding: 0;
|
|
55
63
|
border: 0;
|
|
56
64
|
outline: 0;
|
|
57
65
|
resize: none;
|
|
58
|
-
background: transparent;
|
|
66
|
+
background: transparent linear-gradient(to bottom, transparent 25px, var(--gallery-note-rule) 25px, var(--gallery-note-rule) 26px, transparent 26px) 0 0 / 100% 26px local;
|
|
59
67
|
font: inherit;
|
|
60
|
-
font-size:
|
|
61
|
-
line-height:
|
|
68
|
+
font-size: 13.5px;
|
|
69
|
+
line-height: 26px;
|
|
62
70
|
color: var(--gallery-text);
|
|
71
|
+
caret-color: var(--gallery-accent);
|
|
63
72
|
overflow-wrap: break-word;
|
|
64
|
-
scrollbar-width:
|
|
73
|
+
scrollbar-width: none;
|
|
65
74
|
}
|
|
66
|
-
> .gallery-note-field
|
|
75
|
+
> .gallery-note-field[data-scrolled] { mask-image: linear-gradient(to bottom, transparent, #000 8px); }
|
|
76
|
+
> .gallery-note-head[data-layout="narrow"] ~ .gallery-note-field { font-size: 13px; }
|
|
77
|
+
> .gallery-note-field::placeholder { color: var(--gallery-faint); opacity: 1; }
|
|
67
78
|
> .gallery-note-field:read-only { cursor: default; }
|
|
79
|
+
> .gallery-note-foot { display: none; flex: none; gap: 12px; padding-top: 6px; font-size: 11.5px; line-height: 16px; color: var(--gallery-faint); white-space: nowrap; }
|
|
80
|
+
> .gallery-note-foot b { font-weight: 600; color: var(--gallery-muted); }
|
|
81
|
+
> .gallery-note-field:focus:not(:read-only) + .gallery-note-foot { display: flex; }
|
|
82
|
+
&:has(> .gallery-note-field:focus:not(:read-only)) { box-shadow: var(--gallery-card-shadow), 0 0 0 2px var(--gallery-accent-wash); }
|
|
68
83
|
}
|
|
69
|
-
/* On a custom page the board draws the frame: the note is
|
|
84
|
+
/* On a custom page the board draws the frame: the note is the card's whole face, out over its padding, its
|
|
85
|
+
ring (while the reader types) at the card's edge, inside it. */
|
|
70
86
|
.gallery-card > [data-doc-component="gallery/note"] {
|
|
71
|
-
height: 100
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
height: calc(100% + 2 * var(--gallery-card-pad));
|
|
88
|
+
margin: calc(-1 * var(--gallery-card-pad));
|
|
89
|
+
padding: var(--gallery-card-pad);
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
/* The field as high as whole lines fit under the head (20px and 8px), and over the keys' line (22px) while
|
|
92
|
+
the reader types, so that a line scrolled to is never cut at the top: on a 4 × 2 card three lines,
|
|
93
|
+
two while typing. */
|
|
94
|
+
> .gallery-note-field { flex: none; min-height: 0; height: max(26px, round(down, calc(100% - 28px), 26px)); }
|
|
95
|
+
> .gallery-note-field:focus:not(:read-only) { height: max(26px, round(down, calc(100% - 50px), 26px)); }
|
|
96
|
+
&:has(> .gallery-note-field:focus:not(:read-only)) { box-shadow: inset 0 0 0 2px var(--gallery-accent-wash); }
|
|
76
97
|
}
|
|
@@ -7,7 +7,7 @@ A card for a custom page (its places are `page`): a few lines the user types on
|
|
|
7
7
|
Put it on a custom page as a card of its board, `<section class="gallery-card" data-card-id="…" data-x data-y data-w data-h>`, holding one instance, after `gallery block add note`, the instance as template.html has it: its data part, a `<script type="application/json">` holding `{"text":"…"}` (on one line and compact, as the block writes it back), the note's words, lines apart with `\n`; `{"text":""}` for an empty one, which shows 写点什么.
|
|
8
8
|
|
|
9
9
|
- Leave the words of a note that is there alone: they are the user's. To start one with words of yours (a list the user asked for), write them in `text`, as example.html does.
|
|
10
|
-
- Sizes: 4 × 2 (the default), 2 × 2 and 4 × 4. Words that do not fit scroll inside the card.
|
|
10
|
+
- Sizes: 4 × 2 (the default), 2 × 2 (no count of characters) and 4 × 4 are the ones its menu lists; any height from 2 to 8 cells, 2 to 4 wide, is one too (the card's corner reaches each). Words that do not fit scroll inside the card.
|
|
11
11
|
|
|
12
12
|
## What the user does
|
|
13
13
|
|
|
@@ -15,4 +15,4 @@ They click the card and type. What they typed is written to the page once they l
|
|
|
15
15
|
|
|
16
16
|
## How it looks
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
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 a pencil's chip, 便签 and how many characters it holds; under it the words, half a size larger than the other cards' on wide 26px lines, each ruled faintly (a hint that it takes writing, not a yellow paper). While the reader types the card is ringed in the accent's wash and a line under the field says the two keys (Ctrl+Enter 保存, Esc 还原; ⌘Enter on a Mac). Empty, it says 写点什么… faintly.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "gallery/recent",
|
|
3
3
|
"apiVersion": 1,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"name": { "zh": "最近编辑", "en": "Recently edited" },
|
|
6
6
|
"description": { "zh": "最近改过的文档,点一篇就打开它", "en": "The documents edited last: click one to open it" },
|
|
7
7
|
"words": "zuijinbianji zuijin bianji recent recently edited documents 最近 最近编辑 文档 改过",
|
|
8
8
|
"parts": {},
|
|
9
9
|
"runtime": { "generated": [":scope > .gallery-recent-face"] },
|
|
10
10
|
"places": ["page"],
|
|
11
|
-
"card": { "sizes": [[4,
|
|
11
|
+
"card": { "sizes": [[4, 4], [4, 2], [4, 6]], "min": { "w": 4, "h": 2 }, "max": { "w": 4, "h": 8 }, "resize": true },
|
|
12
12
|
"needs": ["workspace"]
|
|
13
13
|
}
|