@jean-is/render 0.8.0-rb7dd9e653b35 → 0.8.0-rd445b9884e53
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/brand.js +2 -1
- package/caps/charts/charts.css +5 -2
- package/caps/charts/charts.js +58 -28
- package/caps/charts/option.js +28 -1
- package/caps/files/midi.js +1 -1
- package/caps/files/office.js +1 -1
- package/caps/games/page.js +1 -1
- package/caps/interactive/apps.js +13 -3
- package/caps/interactive/diagram.js +96 -22
- package/caps/interactive/interactive.css +3 -0
- package/caps/interactive/interactive.js +8 -7
- package/caps/interactive/live.js +96 -0
- package/caps/interactive/map.js +22 -2
- package/caps/interactive/mode.js +9 -6
- package/caps/interactive/page-diagram.js +6 -2
- package/caps/interactive/parts.js +20 -12
- package/caps/interactive/view-parts.js +50 -30
- package/caps/layouts/layouts.css +7 -8
- package/caps/layouts/layouts.js +25 -17
- package/caps/layouts/shapes.js +1 -1
- package/caps/made/formats.js +84 -46
- package/caps/made/paper.js +142 -0
- package/caps/math/math.js +2 -2
- package/caps/scores/scores.css +7 -7
- package/caps/scores/scores.js +42 -50
- package/caps/share/view.js +1 -1
- package/caps/skills/directory.js +1 -1
- package/caps/slides/edit.js +2 -2
- package/caps/slides/kit-page.css +8 -2
- package/caps/slides/kit-page.js +47 -38
- package/caps/slides/kit-sample.js +36 -0
- package/caps/slides/kit-slot.js +10 -0
- package/caps/slides/kit.js +3 -0
- package/caps/slides/save.js +24 -58
- package/caps/slides/slides.css +9 -9
- package/caps/slides/slides.js +23 -23
- package/caps/tables/formula.js +133 -0
- package/core/conversations.js +2 -4
- package/core/deferred.js +36 -16
- package/core/files.js +1 -1
- package/core/fs.js +4 -12
- package/core/hooks.js +2 -2
- package/core/i18n.js +1 -1
- package/core/llm.js +34 -45
- package/core/loop.js +15 -17
- package/core/oauth.js +31 -0
- package/core/search.js +1 -1
- package/core/settings.js +10 -11
- package/core/skills.js +1 -1
- package/core/vertex.js +37 -0
- package/locales/am.json +14 -5
- package/locales/approvals/am.json +2 -1
- package/locales/approvals/ar.json +2 -1
- package/locales/approvals/bg.json +2 -1
- package/locales/approvals/bn.json +2 -1
- package/locales/approvals/br.json +2 -1
- package/locales/approvals/co.json +2 -1
- package/locales/approvals/cs.json +2 -1
- package/locales/approvals/da.json +2 -1
- package/locales/approvals/de.json +2 -1
- package/locales/approvals/el.json +2 -1
- package/locales/approvals/en.json +2 -1
- package/locales/approvals/es.json +2 -1
- package/locales/approvals/fa.json +2 -1
- package/locales/approvals/fi.json +2 -1
- package/locales/approvals/fr-CA.json +2 -1
- package/locales/approvals/fr.json +2 -1
- package/locales/approvals/ha.json +2 -1
- package/locales/approvals/he.json +2 -1
- package/locales/approvals/hi.json +2 -1
- package/locales/approvals/hr.json +2 -1
- package/locales/approvals/hu.json +2 -1
- package/locales/approvals/id.json +2 -1
- package/locales/approvals/it.json +2 -1
- package/locales/approvals/ja.json +2 -1
- package/locales/approvals/ko.json +2 -1
- package/locales/approvals/mr.json +2 -1
- package/locales/approvals/ms.json +2 -1
- package/locales/approvals/nl.json +2 -1
- package/locales/approvals/pl.json +2 -1
- package/locales/approvals/pt.json +2 -1
- package/locales/approvals/ro.json +2 -1
- package/locales/approvals/ru.json +2 -1
- package/locales/approvals/sk.json +2 -1
- package/locales/approvals/sv.json +2 -1
- package/locales/approvals/sw.json +2 -1
- package/locales/approvals/ta.json +2 -1
- package/locales/approvals/te.json +2 -1
- package/locales/approvals/th.json +2 -1
- package/locales/approvals/tl.json +2 -1
- package/locales/approvals/tr.json +2 -1
- package/locales/approvals/uk.json +2 -1
- package/locales/approvals/ur.json +2 -1
- package/locales/approvals/vi.json +2 -1
- package/locales/approvals/yo.json +2 -1
- package/locales/approvals/zh-Hans.json +2 -1
- package/locales/approvals/zh-Hant.json +2 -1
- package/locales/ar.json +18 -5
- package/locales/bg.json +14 -5
- package/locales/bn.json +14 -5
- package/locales/br.json +17 -5
- package/locales/brains/am.json +6 -3
- package/locales/brains/ar.json +6 -3
- package/locales/brains/bg.json +6 -3
- package/locales/brains/bn.json +6 -3
- package/locales/brains/br.json +6 -3
- package/locales/brains/co.json +6 -3
- package/locales/brains/cs.json +6 -3
- package/locales/brains/da.json +6 -3
- package/locales/brains/de.json +6 -3
- package/locales/brains/el.json +6 -3
- package/locales/brains/en.json +6 -3
- package/locales/brains/es.json +6 -3
- package/locales/brains/fa.json +6 -3
- package/locales/brains/fi.json +6 -3
- package/locales/brains/fr-CA.json +6 -3
- package/locales/brains/fr.json +6 -3
- package/locales/brains/ha.json +6 -3
- package/locales/brains/he.json +6 -3
- package/locales/brains/hi.json +6 -3
- package/locales/brains/hr.json +6 -3
- package/locales/brains/hu.json +6 -3
- package/locales/brains/id.json +6 -3
- package/locales/brains/it.json +6 -3
- package/locales/brains/ja.json +6 -3
- package/locales/brains/ko.json +6 -3
- package/locales/brains/mr.json +6 -3
- package/locales/brains/ms.json +6 -3
- package/locales/brains/nl.json +6 -3
- package/locales/brains/pl.json +6 -3
- package/locales/brains/pt.json +6 -3
- package/locales/brains/ro.json +6 -3
- package/locales/brains/ru.json +6 -3
- package/locales/brains/sk.json +6 -3
- package/locales/brains/sv.json +6 -3
- package/locales/brains/sw.json +6 -3
- package/locales/brains/ta.json +6 -3
- package/locales/brains/te.json +6 -3
- package/locales/brains/th.json +6 -3
- package/locales/brains/tl.json +6 -3
- package/locales/brains/tr.json +6 -3
- package/locales/brains/uk.json +6 -3
- package/locales/brains/ur.json +6 -3
- package/locales/brains/vi.json +6 -3
- package/locales/brains/yo.json +6 -3
- package/locales/brains/zh-Hans.json +6 -3
- package/locales/brains/zh-Hant.json +6 -3
- package/locales/charts/am.json +2 -0
- package/locales/charts/ar.json +2 -0
- package/locales/charts/bg.json +2 -0
- package/locales/charts/bn.json +2 -0
- package/locales/charts/br.json +2 -0
- package/locales/charts/co.json +2 -0
- package/locales/charts/cs.json +2 -0
- package/locales/charts/da.json +2 -0
- package/locales/charts/de.json +2 -0
- package/locales/charts/el.json +2 -0
- package/locales/charts/en.json +2 -0
- package/locales/charts/es.json +2 -0
- package/locales/charts/fa.json +2 -0
- package/locales/charts/fi.json +2 -0
- package/locales/charts/fr-CA.json +2 -0
- package/locales/charts/fr.json +2 -0
- package/locales/charts/ha.json +2 -0
- package/locales/charts/he.json +2 -0
- package/locales/charts/hi.json +2 -0
- package/locales/charts/hr.json +2 -0
- package/locales/charts/hu.json +2 -0
- package/locales/charts/id.json +2 -0
- package/locales/charts/it.json +2 -0
- package/locales/charts/ja.json +2 -0
- package/locales/charts/ko.json +2 -0
- package/locales/charts/mr.json +2 -0
- package/locales/charts/ms.json +2 -0
- package/locales/charts/nl.json +2 -0
- package/locales/charts/pl.json +2 -0
- package/locales/charts/pt.json +2 -0
- package/locales/charts/ro.json +2 -0
- package/locales/charts/ru.json +2 -0
- package/locales/charts/sk.json +2 -0
- package/locales/charts/sv.json +2 -0
- package/locales/charts/sw.json +2 -0
- package/locales/charts/ta.json +2 -0
- package/locales/charts/te.json +2 -0
- package/locales/charts/th.json +2 -0
- package/locales/charts/tl.json +2 -0
- package/locales/charts/tr.json +2 -0
- package/locales/charts/uk.json +2 -0
- package/locales/charts/ur.json +2 -0
- package/locales/charts/vi.json +2 -0
- package/locales/charts/yo.json +2 -0
- package/locales/charts/zh-Hans.json +2 -0
- package/locales/charts/zh-Hant.json +2 -0
- package/locales/co.json +15 -5
- package/locales/cs.json +16 -5
- package/locales/da.json +14 -5
- package/locales/de.json +14 -5
- package/locales/designs/am.json +0 -13
- package/locales/designs/ar.json +0 -13
- package/locales/designs/bg.json +0 -13
- package/locales/designs/bn.json +0 -13
- package/locales/designs/br.json +0 -13
- package/locales/designs/co.json +0 -13
- package/locales/designs/cs.json +0 -13
- package/locales/designs/da.json +0 -13
- package/locales/designs/de.json +0 -13
- package/locales/designs/el.json +0 -13
- package/locales/designs/en.json +0 -13
- package/locales/designs/es.json +0 -13
- package/locales/designs/fa.json +0 -13
- package/locales/designs/fi.json +0 -13
- package/locales/designs/fr-CA.json +0 -13
- package/locales/designs/fr.json +0 -13
- package/locales/designs/ha.json +0 -13
- package/locales/designs/he.json +0 -13
- package/locales/designs/hi.json +0 -13
- package/locales/designs/hr.json +0 -13
- package/locales/designs/hu.json +0 -13
- package/locales/designs/id.json +0 -13
- package/locales/designs/it.json +0 -13
- package/locales/designs/ja.json +0 -13
- package/locales/designs/ko.json +0 -13
- package/locales/designs/mr.json +0 -13
- package/locales/designs/ms.json +0 -13
- package/locales/designs/nl.json +0 -13
- package/locales/designs/pl.json +0 -13
- package/locales/designs/pt.json +0 -13
- package/locales/designs/ro.json +0 -13
- package/locales/designs/ru.json +0 -13
- package/locales/designs/sk.json +0 -13
- package/locales/designs/sv.json +0 -13
- package/locales/designs/sw.json +0 -13
- package/locales/designs/ta.json +0 -13
- package/locales/designs/te.json +0 -13
- package/locales/designs/th.json +0 -13
- package/locales/designs/tl.json +0 -13
- package/locales/designs/tr.json +0 -13
- package/locales/designs/uk.json +0 -13
- package/locales/designs/ur.json +0 -13
- package/locales/designs/vi.json +0 -13
- package/locales/designs/yo.json +0 -13
- package/locales/designs/zh-Hans.json +0 -13
- package/locales/designs/zh-Hant.json +0 -13
- package/locales/dialogs/am.json +4 -0
- package/locales/dialogs/ar.json +4 -0
- package/locales/dialogs/bg.json +4 -0
- package/locales/dialogs/bn.json +4 -0
- package/locales/dialogs/br.json +4 -0
- package/locales/dialogs/co.json +4 -0
- package/locales/dialogs/cs.json +4 -0
- package/locales/dialogs/da.json +4 -0
- package/locales/dialogs/de.json +4 -0
- package/locales/dialogs/el.json +4 -0
- package/locales/dialogs/en.json +4 -0
- package/locales/dialogs/es.json +4 -0
- package/locales/dialogs/fa.json +4 -0
- package/locales/dialogs/fi.json +4 -0
- package/locales/dialogs/fr-CA.json +4 -0
- package/locales/dialogs/fr.json +4 -0
- package/locales/dialogs/ha.json +4 -0
- package/locales/dialogs/he.json +4 -0
- package/locales/dialogs/hi.json +4 -0
- package/locales/dialogs/hr.json +4 -0
- package/locales/dialogs/hu.json +4 -0
- package/locales/dialogs/id.json +4 -0
- package/locales/dialogs/it.json +4 -0
- package/locales/dialogs/ja.json +4 -0
- package/locales/dialogs/ko.json +4 -0
- package/locales/dialogs/mr.json +4 -0
- package/locales/dialogs/ms.json +4 -0
- package/locales/dialogs/nl.json +4 -0
- package/locales/dialogs/pl.json +4 -0
- package/locales/dialogs/pt.json +4 -0
- package/locales/dialogs/ro.json +4 -0
- package/locales/dialogs/ru.json +4 -0
- package/locales/dialogs/sk.json +4 -0
- package/locales/dialogs/sv.json +4 -0
- package/locales/dialogs/sw.json +4 -0
- package/locales/dialogs/ta.json +4 -0
- package/locales/dialogs/te.json +4 -0
- package/locales/dialogs/th.json +4 -0
- package/locales/dialogs/tl.json +4 -0
- package/locales/dialogs/tr.json +4 -0
- package/locales/dialogs/uk.json +4 -0
- package/locales/dialogs/ur.json +4 -0
- package/locales/dialogs/vi.json +4 -0
- package/locales/dialogs/yo.json +4 -0
- package/locales/dialogs/zh-Hans.json +4 -0
- package/locales/dialogs/zh-Hant.json +4 -0
- package/locales/documents/am.json +4 -0
- package/locales/documents/ar.json +4 -0
- package/locales/documents/bg.json +4 -0
- package/locales/documents/bn.json +4 -0
- package/locales/documents/br.json +4 -0
- package/locales/documents/co.json +4 -0
- package/locales/documents/cs.json +4 -0
- package/locales/documents/da.json +4 -0
- package/locales/documents/de.json +4 -0
- package/locales/documents/el.json +4 -0
- package/locales/documents/en.json +4 -0
- package/locales/documents/es.json +4 -0
- package/locales/documents/fa.json +4 -0
- package/locales/documents/fi.json +4 -0
- package/locales/documents/fr-CA.json +4 -0
- package/locales/documents/fr.json +4 -0
- package/locales/documents/ha.json +4 -0
- package/locales/documents/he.json +4 -0
- package/locales/documents/hi.json +4 -0
- package/locales/documents/hr.json +4 -0
- package/locales/documents/hu.json +4 -0
- package/locales/documents/id.json +4 -0
- package/locales/documents/it.json +4 -0
- package/locales/documents/ja.json +4 -0
- package/locales/documents/ko.json +4 -0
- package/locales/documents/mr.json +4 -0
- package/locales/documents/ms.json +4 -0
- package/locales/documents/nl.json +4 -0
- package/locales/documents/pl.json +4 -0
- package/locales/documents/pt.json +4 -0
- package/locales/documents/ro.json +4 -0
- package/locales/documents/ru.json +4 -0
- package/locales/documents/sk.json +4 -0
- package/locales/documents/sv.json +4 -0
- package/locales/documents/sw.json +4 -0
- package/locales/documents/ta.json +4 -0
- package/locales/documents/te.json +4 -0
- package/locales/documents/th.json +4 -0
- package/locales/documents/tl.json +4 -0
- package/locales/documents/tr.json +4 -0
- package/locales/documents/uk.json +4 -0
- package/locales/documents/ur.json +4 -0
- package/locales/documents/vi.json +4 -0
- package/locales/documents/yo.json +4 -0
- package/locales/documents/zh-Hans.json +4 -0
- package/locales/documents/zh-Hant.json +4 -0
- package/locales/el.json +14 -5
- package/locales/en.json +14 -5
- package/locales/enterprise/am.json +29 -1
- package/locales/enterprise/ar.json +29 -1
- package/locales/enterprise/bg.json +29 -1
- package/locales/enterprise/bn.json +29 -1
- package/locales/enterprise/br.json +29 -1
- package/locales/enterprise/co.json +29 -1
- package/locales/enterprise/cs.json +29 -1
- package/locales/enterprise/da.json +29 -1
- package/locales/enterprise/de.json +29 -1
- package/locales/enterprise/el.json +29 -1
- package/locales/enterprise/en.json +29 -1
- package/locales/enterprise/es.json +29 -1
- package/locales/enterprise/fa.json +29 -1
- package/locales/enterprise/fi.json +29 -1
- package/locales/enterprise/fr-CA.json +29 -1
- package/locales/enterprise/fr.json +29 -1
- package/locales/enterprise/ha.json +29 -1
- package/locales/enterprise/he.json +29 -1
- package/locales/enterprise/hi.json +29 -1
- package/locales/enterprise/hr.json +29 -1
- package/locales/enterprise/hu.json +29 -1
- package/locales/enterprise/id.json +29 -1
- package/locales/enterprise/it.json +29 -1
- package/locales/enterprise/ja.json +29 -1
- package/locales/enterprise/ko.json +29 -1
- package/locales/enterprise/mr.json +29 -1
- package/locales/enterprise/ms.json +29 -1
- package/locales/enterprise/nl.json +29 -1
- package/locales/enterprise/pl.json +29 -1
- package/locales/enterprise/pt.json +29 -1
- package/locales/enterprise/ro.json +29 -1
- package/locales/enterprise/ru.json +29 -1
- package/locales/enterprise/sk.json +29 -1
- package/locales/enterprise/sv.json +29 -1
- package/locales/enterprise/sw.json +29 -1
- package/locales/enterprise/ta.json +29 -1
- package/locales/enterprise/te.json +29 -1
- package/locales/enterprise/th.json +29 -1
- package/locales/enterprise/tl.json +29 -1
- package/locales/enterprise/tr.json +29 -1
- package/locales/enterprise/uk.json +29 -1
- package/locales/enterprise/ur.json +29 -1
- package/locales/enterprise/vi.json +29 -1
- package/locales/enterprise/yo.json +29 -1
- package/locales/enterprise/zh-Hans.json +29 -1
- package/locales/enterprise/zh-Hant.json +29 -1
- package/locales/es.json +15 -5
- package/locales/fa.json +14 -5
- package/locales/fi.json +14 -5
- package/locales/fr-CA.json +15 -5
- package/locales/fr.json +15 -5
- package/locales/ha.json +14 -5
- package/locales/he.json +15 -5
- package/locales/hi.json +14 -5
- package/locales/hr.json +15 -5
- package/locales/hu.json +14 -5
- package/locales/id.json +13 -5
- package/locales/interactive/am.json +8 -1
- package/locales/interactive/ar.json +8 -1
- package/locales/interactive/bg.json +8 -1
- package/locales/interactive/bn.json +8 -1
- package/locales/interactive/br.json +8 -1
- package/locales/interactive/co.json +8 -1
- package/locales/interactive/cs.json +8 -1
- package/locales/interactive/da.json +8 -1
- package/locales/interactive/de.json +8 -1
- package/locales/interactive/el.json +8 -1
- package/locales/interactive/en.json +8 -1
- package/locales/interactive/es.json +8 -1
- package/locales/interactive/fa.json +8 -1
- package/locales/interactive/fi.json +8 -1
- package/locales/interactive/fr-CA.json +8 -1
- package/locales/interactive/fr.json +8 -1
- package/locales/interactive/ha.json +8 -1
- package/locales/interactive/he.json +8 -1
- package/locales/interactive/hi.json +8 -1
- package/locales/interactive/hr.json +8 -1
- package/locales/interactive/hu.json +8 -1
- package/locales/interactive/id.json +8 -1
- package/locales/interactive/it.json +8 -1
- package/locales/interactive/ja.json +8 -1
- package/locales/interactive/ko.json +8 -1
- package/locales/interactive/mr.json +8 -1
- package/locales/interactive/ms.json +8 -1
- package/locales/interactive/nl.json +8 -1
- package/locales/interactive/pl.json +8 -1
- package/locales/interactive/pt.json +8 -1
- package/locales/interactive/ro.json +8 -1
- package/locales/interactive/ru.json +8 -1
- package/locales/interactive/sk.json +8 -1
- package/locales/interactive/sv.json +8 -1
- package/locales/interactive/sw.json +8 -1
- package/locales/interactive/ta.json +8 -1
- package/locales/interactive/te.json +8 -1
- package/locales/interactive/th.json +8 -1
- package/locales/interactive/tl.json +8 -1
- package/locales/interactive/tr.json +8 -1
- package/locales/interactive/uk.json +8 -1
- package/locales/interactive/ur.json +8 -1
- package/locales/interactive/vi.json +8 -1
- package/locales/interactive/yo.json +8 -1
- package/locales/interactive/zh-Hans.json +8 -1
- package/locales/interactive/zh-Hant.json +8 -1
- package/locales/it.json +15 -5
- package/locales/ja.json +13 -5
- package/locales/ko.json +13 -5
- package/locales/lock/am.json +6 -3
- package/locales/lock/ar.json +6 -3
- package/locales/lock/bg.json +6 -3
- package/locales/lock/bn.json +6 -3
- package/locales/lock/br.json +6 -3
- package/locales/lock/co.json +6 -3
- package/locales/lock/cs.json +6 -3
- package/locales/lock/da.json +6 -3
- package/locales/lock/de.json +6 -3
- package/locales/lock/el.json +6 -3
- package/locales/lock/en.json +6 -3
- package/locales/lock/es.json +6 -3
- package/locales/lock/fa.json +6 -3
- package/locales/lock/fi.json +6 -3
- package/locales/lock/fr-CA.json +6 -3
- package/locales/lock/fr.json +6 -3
- package/locales/lock/ha.json +6 -3
- package/locales/lock/he.json +6 -3
- package/locales/lock/hi.json +6 -3
- package/locales/lock/hr.json +6 -3
- package/locales/lock/hu.json +6 -3
- package/locales/lock/id.json +6 -3
- package/locales/lock/it.json +6 -3
- package/locales/lock/ja.json +6 -3
- package/locales/lock/ko.json +6 -3
- package/locales/lock/mr.json +6 -3
- package/locales/lock/ms.json +6 -3
- package/locales/lock/nl.json +6 -3
- package/locales/lock/pl.json +6 -3
- package/locales/lock/pt.json +6 -3
- package/locales/lock/ro.json +6 -3
- package/locales/lock/ru.json +6 -3
- package/locales/lock/sk.json +6 -3
- package/locales/lock/sv.json +6 -3
- package/locales/lock/sw.json +6 -3
- package/locales/lock/ta.json +6 -3
- package/locales/lock/te.json +6 -3
- package/locales/lock/th.json +6 -3
- package/locales/lock/tl.json +6 -3
- package/locales/lock/tr.json +6 -3
- package/locales/lock/uk.json +6 -3
- package/locales/lock/ur.json +6 -3
- package/locales/lock/vi.json +6 -3
- package/locales/lock/yo.json +6 -3
- package/locales/lock/zh-Hans.json +6 -3
- package/locales/lock/zh-Hant.json +6 -3
- package/locales/look/am.json +5 -0
- package/locales/look/ar.json +5 -0
- package/locales/look/bg.json +5 -0
- package/locales/look/bn.json +5 -0
- package/locales/look/br.json +5 -0
- package/locales/look/co.json +5 -0
- package/locales/look/cs.json +5 -0
- package/locales/look/da.json +5 -0
- package/locales/look/de.json +5 -0
- package/locales/look/el.json +5 -0
- package/locales/look/en.json +5 -0
- package/locales/look/es.json +5 -0
- package/locales/look/fa.json +5 -0
- package/locales/look/fi.json +5 -0
- package/locales/look/fr-CA.json +5 -0
- package/locales/look/fr.json +5 -0
- package/locales/look/ha.json +5 -0
- package/locales/look/he.json +5 -0
- package/locales/look/hi.json +5 -0
- package/locales/look/hr.json +5 -0
- package/locales/look/hu.json +5 -0
- package/locales/look/id.json +5 -0
- package/locales/look/it.json +5 -0
- package/locales/look/ja.json +5 -0
- package/locales/look/ko.json +5 -0
- package/locales/look/mr.json +5 -0
- package/locales/look/ms.json +5 -0
- package/locales/look/nl.json +5 -0
- package/locales/look/pl.json +5 -0
- package/locales/look/pt.json +5 -0
- package/locales/look/ro.json +5 -0
- package/locales/look/ru.json +5 -0
- package/locales/look/sk.json +5 -0
- package/locales/look/sv.json +5 -0
- package/locales/look/sw.json +5 -0
- package/locales/look/ta.json +5 -0
- package/locales/look/te.json +5 -0
- package/locales/look/th.json +5 -0
- package/locales/look/tl.json +5 -0
- package/locales/look/tr.json +5 -0
- package/locales/look/uk.json +5 -0
- package/locales/look/ur.json +5 -0
- package/locales/look/vi.json +5 -0
- package/locales/look/yo.json +5 -0
- package/locales/look/zh-Hans.json +5 -0
- package/locales/look/zh-Hant.json +5 -0
- package/locales/made/am.json +5 -1
- package/locales/made/ar.json +5 -1
- package/locales/made/bg.json +5 -1
- package/locales/made/bn.json +5 -1
- package/locales/made/br.json +5 -1
- package/locales/made/co.json +5 -1
- package/locales/made/cs.json +5 -1
- package/locales/made/da.json +5 -1
- package/locales/made/de.json +5 -1
- package/locales/made/el.json +5 -1
- package/locales/made/en.json +5 -1
- package/locales/made/es.json +5 -1
- package/locales/made/fa.json +5 -1
- package/locales/made/fi.json +5 -1
- package/locales/made/fr-CA.json +5 -1
- package/locales/made/fr.json +5 -1
- package/locales/made/ha.json +5 -1
- package/locales/made/he.json +5 -1
- package/locales/made/hi.json +5 -1
- package/locales/made/hr.json +5 -1
- package/locales/made/hu.json +5 -1
- package/locales/made/id.json +5 -1
- package/locales/made/it.json +5 -1
- package/locales/made/ja.json +5 -1
- package/locales/made/ko.json +5 -1
- package/locales/made/mr.json +5 -1
- package/locales/made/ms.json +5 -1
- package/locales/made/nl.json +5 -1
- package/locales/made/pl.json +5 -1
- package/locales/made/pt.json +5 -1
- package/locales/made/ro.json +5 -1
- package/locales/made/ru.json +5 -1
- package/locales/made/sk.json +5 -1
- package/locales/made/sv.json +5 -1
- package/locales/made/sw.json +5 -1
- package/locales/made/ta.json +5 -1
- package/locales/made/te.json +5 -1
- package/locales/made/th.json +5 -1
- package/locales/made/tl.json +5 -1
- package/locales/made/tr.json +5 -1
- package/locales/made/uk.json +5 -1
- package/locales/made/ur.json +5 -1
- package/locales/made/vi.json +5 -1
- package/locales/made/yo.json +5 -1
- package/locales/made/zh-Hans.json +5 -1
- package/locales/made/zh-Hant.json +5 -1
- package/locales/mr.json +14 -5
- package/locales/ms.json +13 -5
- package/locales/nl.json +14 -5
- package/locales/out/am.json +13 -0
- package/locales/out/ar.json +13 -0
- package/locales/out/bg.json +13 -0
- package/locales/out/bn.json +13 -0
- package/locales/out/br.json +13 -0
- package/locales/out/co.json +13 -0
- package/locales/out/cs.json +13 -0
- package/locales/out/da.json +13 -0
- package/locales/out/de.json +13 -0
- package/locales/out/el.json +13 -0
- package/locales/out/en.json +13 -0
- package/locales/out/es.json +13 -0
- package/locales/out/fa.json +13 -0
- package/locales/out/fi.json +13 -0
- package/locales/out/fr-CA.json +13 -0
- package/locales/out/fr.json +13 -0
- package/locales/out/ha.json +13 -0
- package/locales/out/he.json +13 -0
- package/locales/out/hi.json +13 -0
- package/locales/out/hr.json +13 -0
- package/locales/out/hu.json +13 -0
- package/locales/out/id.json +13 -0
- package/locales/out/it.json +13 -0
- package/locales/out/ja.json +13 -0
- package/locales/out/ko.json +13 -0
- package/locales/out/mr.json +13 -0
- package/locales/out/ms.json +13 -0
- package/locales/out/nl.json +13 -0
- package/locales/out/pl.json +13 -0
- package/locales/out/pt.json +13 -0
- package/locales/out/ro.json +13 -0
- package/locales/out/ru.json +13 -0
- package/locales/out/sk.json +13 -0
- package/locales/out/sv.json +13 -0
- package/locales/out/sw.json +13 -0
- package/locales/out/ta.json +13 -0
- package/locales/out/te.json +13 -0
- package/locales/out/th.json +13 -0
- package/locales/out/tl.json +13 -0
- package/locales/out/tr.json +13 -0
- package/locales/out/uk.json +13 -0
- package/locales/out/ur.json +13 -0
- package/locales/out/vi.json +13 -0
- package/locales/out/yo.json +13 -0
- package/locales/out/zh-Hans.json +13 -0
- package/locales/out/zh-Hant.json +13 -0
- package/locales/pl.json +16 -5
- package/locales/policy/am.json +1 -0
- package/locales/policy/ar.json +1 -0
- package/locales/policy/bg.json +1 -0
- package/locales/policy/bn.json +1 -0
- package/locales/policy/br.json +1 -0
- package/locales/policy/co.json +1 -0
- package/locales/policy/cs.json +1 -0
- package/locales/policy/da.json +1 -0
- package/locales/policy/de.json +1 -0
- package/locales/policy/el.json +1 -0
- package/locales/policy/en.json +1 -0
- package/locales/policy/es.json +1 -0
- package/locales/policy/fa.json +1 -0
- package/locales/policy/fi.json +1 -0
- package/locales/policy/fr-CA.json +1 -0
- package/locales/policy/fr.json +1 -0
- package/locales/policy/ha.json +1 -0
- package/locales/policy/he.json +1 -0
- package/locales/policy/hi.json +1 -0
- package/locales/policy/hr.json +1 -0
- package/locales/policy/hu.json +1 -0
- package/locales/policy/id.json +1 -0
- package/locales/policy/it.json +1 -0
- package/locales/policy/ja.json +1 -0
- package/locales/policy/ko.json +1 -0
- package/locales/policy/mr.json +1 -0
- package/locales/policy/ms.json +1 -0
- package/locales/policy/nl.json +1 -0
- package/locales/policy/pl.json +1 -0
- package/locales/policy/pt.json +1 -0
- package/locales/policy/ro.json +1 -0
- package/locales/policy/ru.json +1 -0
- package/locales/policy/sk.json +1 -0
- package/locales/policy/sv.json +1 -0
- package/locales/policy/sw.json +1 -0
- package/locales/policy/ta.json +1 -0
- package/locales/policy/te.json +1 -0
- package/locales/policy/th.json +1 -0
- package/locales/policy/tl.json +1 -0
- package/locales/policy/tr.json +1 -0
- package/locales/policy/uk.json +1 -0
- package/locales/policy/ur.json +1 -0
- package/locales/policy/vi.json +1 -0
- package/locales/policy/yo.json +1 -0
- package/locales/policy/zh-Hans.json +1 -0
- package/locales/policy/zh-Hant.json +1 -0
- package/locales/profiles/am.json +5 -0
- package/locales/profiles/ar.json +5 -0
- package/locales/profiles/bg.json +5 -0
- package/locales/profiles/bn.json +5 -0
- package/locales/profiles/br.json +5 -0
- package/locales/profiles/co.json +5 -0
- package/locales/profiles/cs.json +5 -0
- package/locales/profiles/da.json +5 -0
- package/locales/profiles/de.json +5 -0
- package/locales/profiles/el.json +5 -0
- package/locales/profiles/en.json +5 -0
- package/locales/profiles/es.json +5 -0
- package/locales/profiles/fa.json +5 -0
- package/locales/profiles/fi.json +5 -0
- package/locales/profiles/fr-CA.json +5 -0
- package/locales/profiles/fr.json +5 -0
- package/locales/profiles/ha.json +5 -0
- package/locales/profiles/he.json +5 -0
- package/locales/profiles/hi.json +5 -0
- package/locales/profiles/hr.json +5 -0
- package/locales/profiles/hu.json +5 -0
- package/locales/profiles/id.json +5 -0
- package/locales/profiles/it.json +5 -0
- package/locales/profiles/ja.json +5 -0
- package/locales/profiles/ko.json +5 -0
- package/locales/profiles/mr.json +5 -0
- package/locales/profiles/ms.json +5 -0
- package/locales/profiles/nl.json +5 -0
- package/locales/profiles/pl.json +5 -0
- package/locales/profiles/pt.json +5 -0
- package/locales/profiles/ro.json +5 -0
- package/locales/profiles/ru.json +5 -0
- package/locales/profiles/sk.json +5 -0
- package/locales/profiles/sv.json +5 -0
- package/locales/profiles/sw.json +5 -0
- package/locales/profiles/ta.json +5 -0
- package/locales/profiles/te.json +5 -0
- package/locales/profiles/th.json +5 -0
- package/locales/profiles/tl.json +5 -0
- package/locales/profiles/tr.json +5 -0
- package/locales/profiles/uk.json +5 -0
- package/locales/profiles/ur.json +5 -0
- package/locales/profiles/vi.json +5 -0
- package/locales/profiles/yo.json +5 -0
- package/locales/profiles/zh-Hans.json +5 -0
- package/locales/profiles/zh-Hant.json +5 -0
- package/locales/pt.json +15 -5
- package/locales/ro.json +15 -5
- package/locales/ru.json +16 -5
- package/locales/scores/am.json +3 -9
- package/locales/scores/ar.json +3 -9
- package/locales/scores/bg.json +3 -9
- package/locales/scores/bn.json +3 -9
- package/locales/scores/br.json +3 -9
- package/locales/scores/co.json +3 -9
- package/locales/scores/cs.json +3 -9
- package/locales/scores/da.json +3 -9
- package/locales/scores/de.json +3 -9
- package/locales/scores/el.json +3 -9
- package/locales/scores/en.json +3 -9
- package/locales/scores/es.json +3 -9
- package/locales/scores/fa.json +3 -9
- package/locales/scores/fi.json +3 -9
- package/locales/scores/fr-CA.json +3 -9
- package/locales/scores/fr.json +3 -9
- package/locales/scores/ha.json +3 -9
- package/locales/scores/he.json +3 -9
- package/locales/scores/hi.json +3 -9
- package/locales/scores/hr.json +3 -9
- package/locales/scores/hu.json +3 -9
- package/locales/scores/id.json +3 -9
- package/locales/scores/it.json +3 -9
- package/locales/scores/ja.json +3 -9
- package/locales/scores/ko.json +3 -9
- package/locales/scores/mr.json +3 -9
- package/locales/scores/ms.json +3 -9
- package/locales/scores/nl.json +3 -9
- package/locales/scores/pl.json +3 -9
- package/locales/scores/pt.json +3 -9
- package/locales/scores/ro.json +3 -9
- package/locales/scores/ru.json +3 -9
- package/locales/scores/sk.json +3 -9
- package/locales/scores/sv.json +3 -9
- package/locales/scores/sw.json +3 -9
- package/locales/scores/ta.json +3 -9
- package/locales/scores/te.json +3 -9
- package/locales/scores/th.json +3 -9
- package/locales/scores/tl.json +3 -9
- package/locales/scores/tr.json +3 -9
- package/locales/scores/uk.json +3 -9
- package/locales/scores/ur.json +3 -9
- package/locales/scores/vi.json +3 -9
- package/locales/scores/yo.json +3 -9
- package/locales/scores/zh-Hans.json +3 -9
- package/locales/scores/zh-Hant.json +3 -9
- package/locales/search/am.json +10 -1
- package/locales/search/ar.json +10 -1
- package/locales/search/bg.json +10 -1
- package/locales/search/bn.json +10 -1
- package/locales/search/br.json +10 -1
- package/locales/search/co.json +10 -1
- package/locales/search/cs.json +10 -1
- package/locales/search/da.json +10 -1
- package/locales/search/de.json +10 -1
- package/locales/search/el.json +10 -1
- package/locales/search/en.json +10 -1
- package/locales/search/es.json +10 -1
- package/locales/search/fa.json +10 -1
- package/locales/search/fi.json +10 -1
- package/locales/search/fr-CA.json +10 -1
- package/locales/search/fr.json +10 -1
- package/locales/search/ha.json +10 -1
- package/locales/search/he.json +10 -1
- package/locales/search/hi.json +10 -1
- package/locales/search/hr.json +10 -1
- package/locales/search/hu.json +10 -1
- package/locales/search/id.json +10 -1
- package/locales/search/it.json +10 -1
- package/locales/search/ja.json +10 -1
- package/locales/search/ko.json +10 -1
- package/locales/search/mr.json +10 -1
- package/locales/search/ms.json +10 -1
- package/locales/search/nl.json +10 -1
- package/locales/search/pl.json +10 -1
- package/locales/search/pt.json +10 -1
- package/locales/search/ro.json +10 -1
- package/locales/search/ru.json +10 -1
- package/locales/search/sk.json +10 -1
- package/locales/search/sv.json +10 -1
- package/locales/search/sw.json +10 -1
- package/locales/search/ta.json +10 -1
- package/locales/search/te.json +10 -1
- package/locales/search/th.json +10 -1
- package/locales/search/tl.json +10 -1
- package/locales/search/tr.json +10 -1
- package/locales/search/uk.json +10 -1
- package/locales/search/ur.json +10 -1
- package/locales/search/vi.json +10 -1
- package/locales/search/yo.json +10 -1
- package/locales/search/zh-Hans.json +10 -1
- package/locales/search/zh-Hant.json +10 -1
- package/locales/signin/am.json +3 -1
- package/locales/signin/ar.json +3 -1
- package/locales/signin/bg.json +3 -1
- package/locales/signin/bn.json +3 -1
- package/locales/signin/br.json +3 -1
- package/locales/signin/co.json +3 -1
- package/locales/signin/cs.json +3 -1
- package/locales/signin/da.json +3 -1
- package/locales/signin/de.json +3 -1
- package/locales/signin/el.json +3 -1
- package/locales/signin/en.json +3 -1
- package/locales/signin/es.json +3 -1
- package/locales/signin/fa.json +3 -1
- package/locales/signin/fi.json +3 -1
- package/locales/signin/fr-CA.json +3 -1
- package/locales/signin/fr.json +3 -1
- package/locales/signin/ha.json +3 -1
- package/locales/signin/he.json +3 -1
- package/locales/signin/hi.json +3 -1
- package/locales/signin/hr.json +3 -1
- package/locales/signin/hu.json +3 -1
- package/locales/signin/id.json +3 -1
- package/locales/signin/it.json +3 -1
- package/locales/signin/ja.json +3 -1
- package/locales/signin/ko.json +3 -1
- package/locales/signin/mr.json +3 -1
- package/locales/signin/ms.json +3 -1
- package/locales/signin/nl.json +3 -1
- package/locales/signin/pl.json +3 -1
- package/locales/signin/pt.json +3 -1
- package/locales/signin/ro.json +3 -1
- package/locales/signin/ru.json +3 -1
- package/locales/signin/sk.json +3 -1
- package/locales/signin/sv.json +3 -1
- package/locales/signin/sw.json +3 -1
- package/locales/signin/ta.json +3 -1
- package/locales/signin/te.json +3 -1
- package/locales/signin/th.json +3 -1
- package/locales/signin/tl.json +3 -1
- package/locales/signin/tr.json +3 -1
- package/locales/signin/uk.json +3 -1
- package/locales/signin/ur.json +3 -1
- package/locales/signin/vi.json +3 -1
- package/locales/signin/yo.json +3 -1
- package/locales/signin/zh-Hans.json +3 -1
- package/locales/signin/zh-Hant.json +3 -1
- package/locales/sk.json +16 -5
- package/locales/slides/am.json +16 -11
- package/locales/slides/ar.json +16 -11
- package/locales/slides/bg.json +16 -11
- package/locales/slides/bn.json +16 -11
- package/locales/slides/br.json +16 -11
- package/locales/slides/co.json +16 -11
- package/locales/slides/cs.json +16 -11
- package/locales/slides/da.json +16 -11
- package/locales/slides/de.json +16 -11
- package/locales/slides/el.json +16 -11
- package/locales/slides/en.json +16 -11
- package/locales/slides/es.json +16 -11
- package/locales/slides/fa.json +16 -11
- package/locales/slides/fi.json +16 -11
- package/locales/slides/fr-CA.json +16 -11
- package/locales/slides/fr.json +16 -11
- package/locales/slides/ha.json +16 -11
- package/locales/slides/he.json +16 -11
- package/locales/slides/hi.json +16 -11
- package/locales/slides/hr.json +16 -11
- package/locales/slides/hu.json +16 -11
- package/locales/slides/id.json +16 -11
- package/locales/slides/it.json +16 -11
- package/locales/slides/ja.json +16 -11
- package/locales/slides/ko.json +16 -11
- package/locales/slides/mr.json +16 -11
- package/locales/slides/ms.json +16 -11
- package/locales/slides/nl.json +16 -11
- package/locales/slides/pl.json +16 -11
- package/locales/slides/pt.json +16 -11
- package/locales/slides/ro.json +16 -11
- package/locales/slides/ru.json +16 -11
- package/locales/slides/sk.json +16 -11
- package/locales/slides/sv.json +16 -11
- package/locales/slides/sw.json +16 -11
- package/locales/slides/ta.json +16 -11
- package/locales/slides/te.json +16 -11
- package/locales/slides/th.json +16 -11
- package/locales/slides/tl.json +16 -11
- package/locales/slides/tr.json +16 -11
- package/locales/slides/uk.json +16 -11
- package/locales/slides/ur.json +16 -11
- package/locales/slides/vi.json +16 -11
- package/locales/slides/yo.json +16 -11
- package/locales/slides/zh-Hans.json +16 -11
- package/locales/slides/zh-Hant.json +16 -11
- package/locales/sv.json +14 -5
- package/locales/sw.json +14 -5
- package/locales/ta.json +14 -5
- package/locales/tables/am.json +20 -0
- package/locales/tables/ar.json +28 -0
- package/locales/tables/bg.json +20 -0
- package/locales/tables/bn.json +20 -0
- package/locales/tables/br.json +26 -0
- package/locales/tables/co.json +22 -0
- package/locales/tables/cs.json +24 -0
- package/locales/tables/da.json +20 -0
- package/locales/tables/de.json +20 -0
- package/locales/tables/el.json +20 -0
- package/locales/tables/en.json +20 -0
- package/locales/tables/es.json +22 -0
- package/locales/tables/fa.json +20 -0
- package/locales/tables/fi.json +20 -0
- package/locales/tables/fr-CA.json +22 -0
- package/locales/tables/fr.json +22 -0
- package/locales/tables/ha.json +20 -0
- package/locales/tables/he.json +22 -0
- package/locales/tables/hi.json +20 -0
- package/locales/tables/hr.json +22 -0
- package/locales/tables/hu.json +20 -0
- package/locales/tables/id.json +18 -0
- package/locales/tables/it.json +22 -0
- package/locales/tables/ja.json +18 -0
- package/locales/tables/ko.json +18 -0
- package/locales/tables/mr.json +20 -0
- package/locales/tables/ms.json +18 -0
- package/locales/tables/nl.json +20 -0
- package/locales/tables/pl.json +24 -0
- package/locales/tables/pt.json +22 -0
- package/locales/tables/ro.json +22 -0
- package/locales/tables/ru.json +24 -0
- package/locales/tables/sk.json +24 -0
- package/locales/tables/sv.json +20 -0
- package/locales/tables/sw.json +20 -0
- package/locales/tables/ta.json +20 -0
- package/locales/tables/te.json +20 -0
- package/locales/tables/th.json +18 -0
- package/locales/tables/tl.json +20 -0
- package/locales/tables/tr.json +20 -0
- package/locales/tables/uk.json +24 -0
- package/locales/tables/ur.json +20 -0
- package/locales/tables/vi.json +18 -0
- package/locales/tables/yo.json +18 -0
- package/locales/tables/zh-Hans.json +18 -0
- package/locales/tables/zh-Hant.json +18 -0
- package/locales/te.json +14 -5
- package/locales/th.json +13 -5
- package/locales/tl.json +14 -5
- package/locales/tr.json +14 -5
- package/locales/uk.json +16 -5
- package/locales/ur.json +14 -5
- package/locales/vi.json +13 -5
- package/locales/yo.json +13 -5
- package/locales/zh-Hans.json +13 -5
- package/locales/zh-Hant.json +13 -5
- package/package.json +1 -1
- package/ui/caps.js +3 -0
- package/ui/export.js +1 -1
- package/ui/icons.js +1 -1
- package/ui/kit.js +42 -11
- package/ui/language.js +172 -0
- package/ui/looks/classic.css +3 -1
- package/ui/looks/human.css +2 -3
- package/ui/looks/mail.css +1 -1
- package/ui/looks.js +3 -6
- package/ui/markdown.js +17 -6
- package/ui/reader-state.js +2 -2
- package/ui/reader.js +1 -1
- package/ui/review.js +1 -1
- package/ui/save.js +16 -0
- package/ui/seal.js +5 -4
- package/ui/sheet.js +21 -2
- package/ui/style.css +48 -32
- package/ui/touches.js +26 -1
- package/ui/view.js +6 -6
- package/vendor/deck/deck.css +2 -2
- package/vendor/deck/deck.mjs +37 -37
- package/vendor/deck/pptx.mjs +1 -1
- package/ui/acts.js +0 -12
- package/ui/looks/mondrian.css +0 -90
- package/ui/looks/paper.css +0 -51
package/caps/layouts/layouts.js
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
// offered; until then, and for the others, ui/markdown.js shows them as they are. The same Markdown copies as it was.
|
|
6
6
|
import { html, nothing } from 'lit-html'
|
|
7
7
|
import { ref } from 'lit-html/directives/ref.js'
|
|
8
|
-
import { shapes, blocks, inline, lex, cited, parser } from '../../ui/markdown.js'
|
|
8
|
+
import { shapes, blocks, inline, lex, cited, parser, namesRows } from '../../ui/markdown.js'
|
|
9
9
|
import { app, keepRecords } from '../../ui/state.js'
|
|
10
10
|
import { metaRecord } from '../../core/events.js'
|
|
11
11
|
import { styleSheet } from '../../ui/sheet.js'
|
|
12
|
-
import { t, dir, useStrings, intlLocales } from '../../core/i18n.js'
|
|
12
|
+
import { t, dir, locale, useStrings, intlLocales } from '../../core/i18n.js'
|
|
13
13
|
import { aligned, compared, marked, roomy, stepped, titled, sequenced, noted, timed, figured, ticked, columns, cjk } from './shapes.js'
|
|
14
14
|
|
|
15
15
|
await Promise.all([useStrings('layouts'), styleSheet(new URL('layouts.css', import.meta.url))])
|
|
16
16
|
|
|
17
|
-
// A table that fits lets its head stay in view while its rows scroll by (
|
|
17
|
+
// A table that fits lets its head stay in view while its rows scroll by (data-whole): one
|
|
18
18
|
// wider than the room scrolls sideways, and a box that scrolls holds a sticky head in. Each table is
|
|
19
19
|
// watched once (lit hands a shared ref every table again at each render), and both watching and telling
|
|
20
20
|
// wait for the next frame, so that neither happens while sizes are being told.
|
|
@@ -38,18 +38,19 @@ function fits(box) {
|
|
|
38
38
|
function table(token) {
|
|
39
39
|
const shape = compared(token)
|
|
40
40
|
if (!shape) {
|
|
41
|
-
const align = aligned(token).map((side) => side && `align-${side}`)
|
|
42
|
-
return html`<div class="table" tabindex="0" ${ref(fits)}><table>
|
|
43
|
-
<thead><tr>${token.header.map((/** @type {any} */ cell, /** @type {number} */ i) => html`<th class=${align[i]}>${inline(cell.tokens)}</th>`)}</tr></thead>
|
|
44
|
-
<tbody>${token.rows.map((/** @type {any[]} */ row) => html`<tr>${row.map((cell, i) => html`<td class=${align[i]}>${inline(cell.tokens)}</td>`
|
|
41
|
+
const align = aligned(token).map((side) => side && `align-${side}`), heads = namesRows(token.header[0]?.text ?? '', token.rows.map((/** @type {any[]} */ row) => row[0]?.text.trim() ?? ''))
|
|
42
|
+
return html`<div class="table" tabindex="0" ${ref(fits)}><table aria-label=${token.title ?? nothing}>
|
|
43
|
+
<thead><tr>${token.header.map((/** @type {any} */ cell, /** @type {number} */ i) => html`<th scope="col" class=${align[i]}>${inline(cell.tokens)}</th>`)}</tr></thead>
|
|
44
|
+
<tbody>${token.rows.map((/** @type {any[]} */ row) => html`<tr>${row.map((cell, i) => (i || !heads ? html`<td class=${align[i]}>${inline(cell.tokens)}</td>`
|
|
45
|
+
: html`<th scope="row" class=${align[i]}>${inline(cell.tokens)}</th>`))}</tr>`)}</tbody>
|
|
45
46
|
</table></div>`
|
|
46
47
|
}
|
|
47
48
|
// The criteria, often in bold, are no option's best.
|
|
48
49
|
/** @param {any} cell @param {number} i @param {boolean} [head] */
|
|
49
50
|
const classes = (cell, i, head) => [token.align[i] && `align-${token.align[i]}`, i === shape.pick && 'is-pick', !head && i > 0 && marked(cell)].filter(Boolean).join(' ')
|
|
50
|
-
return html`<div class="table is-compare ${roomy(token) ? 'is-roomy' : ''}" tabindex="0" ${ref(fits)}><table>
|
|
51
|
-
<thead><tr>${token.header.map((/** @type {any} */ cell, /** @type {number} */ i) => html`<th class=${classes(cell, i, true)}
|
|
52
|
-
<tbody>${token.rows.map((/** @type {any[]} */ row) => html`<tr>${row.map((cell, i) => html`<td class=${classes(cell, i)}>${inline(cell.tokens)}</td>`)}</tr>`)}</tbody>
|
|
51
|
+
return html`<div class="table is-compare ${roomy(token) ? 'is-roomy' : ''}" tabindex="0" ${ref(fits)}><table aria-label=${token.title ?? nothing}>
|
|
52
|
+
<thead><tr>${token.header.map((/** @type {any} */ cell, /** @type {number} */ i) => html`<th scope="col" class=${classes(cell, i, true)}>${i === shape.pick ? html`<span class="pick-tag" lang=${locale.value} dir=${dir()}>${t('layouts.recommended')}</span> ` : nothing}${inline(cell.tokens)}</th>`)}</tr></thead>
|
|
53
|
+
<tbody>${token.rows.map((/** @type {any[]} */ row) => html`<tr>${row.map((cell, i) => (i ? html`<td class=${classes(cell, i)}>${inline(cell.tokens)}</td>` : html`<th scope="row" class=${classes(cell, i)}>${inline(cell.tokens)}</th>`))}</tr>`)}</tbody>
|
|
53
54
|
</table></div>`
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -72,6 +73,8 @@ function told(item, draw) {
|
|
|
72
73
|
/** A list's own name, from what it holds, for the ticks kept for it. @param {any} token */
|
|
73
74
|
const named = (token) => token.items.map((/** @type {any} */ item) => item.text).join('\n')
|
|
74
75
|
|
|
76
|
+
/** Checklists drawn, which names each one's boxes apart. */
|
|
77
|
+
let checklists = 0
|
|
75
78
|
/**
|
|
76
79
|
* A checklist: each thing to do ticked, struck through, and how many are done, with a bar. What is
|
|
77
80
|
* ticked is kept in the conversation, a meta record for the list (its items' words), the latest winning.
|
|
@@ -83,7 +86,7 @@ function checklist(token) {
|
|
|
83
86
|
const doneIn = (records) => new Set(/** @type {number[]} */ (records.findLast((record) => record.meta?.ticks?.list === list)?.meta?.ticks.done
|
|
84
87
|
?? token.items.flatMap((/** @type {any} */ item, /** @type {number} */ i) => (item.checked ? [i] : []))))
|
|
85
88
|
const done = doneIn(app.current.value?.records ?? [])
|
|
86
|
-
const count = new Intl.NumberFormat(intlLocales())
|
|
89
|
+
const count = new Intl.NumberFormat(intlLocales()), at = ++checklists
|
|
87
90
|
// Shown at once, from the ticks of the moment, then kept, in the order they were made.
|
|
88
91
|
/** @param {number} i @param {boolean} on */
|
|
89
92
|
const tick = (i, on) => {
|
|
@@ -94,9 +97,9 @@ function checklist(token) {
|
|
|
94
97
|
keepRecords(conversation.path, [record]).catch((error) => console.warn("Ticks", error))
|
|
95
98
|
}
|
|
96
99
|
return html`<div class="checklist">
|
|
97
|
-
<p class="checklist-count"><span dir=${dir()}>${t('layouts.ticked', { done: count.format(done.size), total: count.format(token.items.length) })}</span><progress max=${token.items.length} .value=${done.size}></progress></p>
|
|
98
|
-
<ul>${token.items.map((/** @type {any} */ item, /** @type {number} */ i) => html`<li class=${done.has(i) ? 'is-done' : ''}><label>
|
|
99
|
-
<input type="checkbox" .checked=${done.has(i)} @change=${(/** @type {Event} */ e) => tick(i, /** @type {HTMLInputElement} */ (e.target).checked)}>
|
|
100
|
+
<p class="checklist-count"><span role="status" lang=${locale.value} dir=${dir()}>${t('layouts.ticked', { done: count.format(done.size), total: count.format(token.items.length) })}</span><progress aria-hidden="true" max=${token.items.length} .value=${done.size}></progress></p>
|
|
101
|
+
<ul>${token.items.map((/** @type {any} */ item, /** @type {number} */ i) => html`<li class=${done.has(i) ? 'is-done' : ''}><label for=${`tick-${at}-${i}`}>
|
|
102
|
+
<input id=${`tick-${at}-${i}`} type="checkbox" .checked=${done.has(i)} @change=${(/** @type {Event} */ e) => tick(i, /** @type {HTMLInputElement} */ (e.target).checked)}>
|
|
100
103
|
<span>${item.tokens.map((/** @type {any} */ part) => (part.type === 'checkbox' ? nothing : part.type === 'text' ? inline(part.tokens ?? [part]) : blocks([part])))}</span>
|
|
101
104
|
</label></li>`)}</ul>
|
|
102
105
|
</div>`
|
|
@@ -114,8 +117,8 @@ function step(item) {
|
|
|
114
117
|
function blockquote(token) {
|
|
115
118
|
const note = noted(token)
|
|
116
119
|
if (!note) return null
|
|
117
|
-
return html`<blockquote class="callout is-${note.kind}">${note.text === undefined ? blocks(token.tokens)
|
|
118
|
-
: html`<p class="callout-title">${note.title ? inline(/** @type {any} */ (lex(note.title)[0])?.tokens) : t(`layouts.${note.kind}`)}</p>${blocks(lex(note.text))}`}</blockquote>`
|
|
120
|
+
return html`<blockquote class="callout is-${note.kind}" role="note">${note.text === undefined ? blocks(token.tokens)
|
|
121
|
+
: html`<p class="callout-title" role="heading" aria-level="4" lang=${note.title ? nothing : locale.value} dir=${note.title ? nothing : dir()}>${note.title ? inline(/** @type {any} */ (lex(note.title)[0])?.tokens) : t(`layouts.${note.kind}`)}</p>${blocks(lex(note.text))}`}</blockquote>`
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
/** An address as it reads, escaped or not. @param {string} address */
|
|
@@ -145,4 +148,9 @@ function image(token) {
|
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
parser.use({ extensions: [columns] }, cjk)
|
|
148
|
-
|
|
151
|
+
/** Tokens with steps gathered, each table told its title: the heading or the line ending in a colon just above it. @param {any[]} tokens */
|
|
152
|
+
const gathered = (tokens) => sequenced(tokens).map((/** @type {any} */ token, i, all) => {
|
|
153
|
+
const above = all[i - (all[i - 1]?.type === 'space' ? 2 : 1)]
|
|
154
|
+
return token.type === 'table' && (above?.type === 'heading' || (above?.type === 'paragraph' && /[::]\s*$/.test(above.text))) ? { ...token, title: above.text.replace(/[::\s*_`]+$|[*_`]/g, '') } : token
|
|
155
|
+
})
|
|
156
|
+
shapes.value = { table, list, blockquote, image, blocks: gathered, columns: (token) => html`<div class="columns">${token.columns.map((/** @type {any} */ column) => html`<div>${blocks(column.tokens)}</div>`)}</div>` }
|
package/caps/layouts/shapes.js
CHANGED
|
@@ -193,7 +193,7 @@ const CJK = /[\p{scx=Hani}\p{scx=Hira}\p{scx=Kana}\p{scx=Hang}\p{scx=Bopo}\u3000
|
|
|
193
193
|
const STOP = /(?!\*)[\p{P}\p{S}](?=\*+([^\s\p{P}\p{S}]))|(?<=([^\s\p{P}\p{S}])\*+)(?!\*)[\p{P}\p{S}]/gu
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
|
-
* Emphasis as Chinese, Japanese and Korean are written
|
|
196
|
+
* Emphasis as Chinese, Japanese and Korean are written, for answers (./layouts.js), documents and the files Jean
|
|
197
197
|
* writes: with no space between words, a run of * that punctuation touches still opens or closes when that punctuation,
|
|
198
198
|
* or the character on the run's other side, is CJK, as markdown-cjk-friendly proposes for CommonMark, so that
|
|
199
199
|
* `**5月21日(金)**に` is bold. marked still reads every run: told that a run's punctuation came after a space, and
|
package/caps/made/formats.js
CHANGED
|
@@ -42,15 +42,16 @@ export function paperFor(locale) {
|
|
|
42
42
|
/**
|
|
43
43
|
* The file a name and its content make: the extension says which kind.
|
|
44
44
|
* @param {string} name @param {string} content Markdown for .docx, CSV or Markdown tables for .xlsx, else the text itself
|
|
45
|
-
* @param {{ paper?: 'a4' | 'letter', date?: Date, look?: Look | null }} [options] a Word file's in the
|
|
45
|
+
* @param {{ paper?: 'a4' | 'letter', date?: Date, look?: Look | null, pictures?: Map<string, Picture>, made?: boolean }} [options] a Word file's: in the look here (D601, D663), the
|
|
46
|
+
* pictures it holds by the address its Markdown gives them or the code they draw, and whether a trained model made it, as what the user wrote themself isn't (D324)
|
|
46
47
|
* @returns {Promise<{ name: string, mimeType: string, bytes: Uint8Array }>}
|
|
47
48
|
*/
|
|
48
|
-
export async function makeFile(name, content, { paper = 'a4', date, look } = {}) {
|
|
49
|
+
export async function makeFile(name, content, { paper = 'a4', date, look, pictures, made = true } = {}) {
|
|
49
50
|
const clean = fileName(name)
|
|
50
51
|
const ext = /\.([a-z0-9]{1,8})$/i.exec(clean)?.[1].toLowerCase() ?? ''
|
|
51
52
|
if (!content.trim()) throw new Error('The file has no content.')
|
|
52
|
-
if (ext === 'docx') return { name: clean, mimeType: DOCX, bytes: await docx(content, paper, date, look ?? {}) }
|
|
53
|
-
if (ext === 'xlsx') return { name: clean, mimeType: XLSX, bytes: await xlsx(sheetsIn(content, clean.slice(0, -5)), date) }
|
|
53
|
+
if (ext === 'docx') return { name: clean, mimeType: DOCX, bytes: await docx(content, paper, date, look ?? {}, pictures, made, clean.slice(0, -5)) }
|
|
54
|
+
if (ext === 'xlsx') return { name: clean, mimeType: XLSX, bytes: await xlsx(sheetsIn(content, clean.slice(0, -5)), date, look ?? {}, clean.slice(0, -5)) }
|
|
54
55
|
if (!ext) throw new Error('Name the file with its kind, e.g. "Report.docx", "Budget.xlsx" or "Notes.txt".')
|
|
55
56
|
if (BINARY.has(ext)) throw new Error(`A .${ext} file can't be made: it isn't text. Make a Word document (.docx, which Word saves as PDF too), a spreadsheet (.xlsx), a drawing (.svg) or a text file (.md, .csv, .html…).`)
|
|
56
57
|
// A byte-order mark, so Excel reads a CSV as UTF-8.
|
|
@@ -79,16 +80,18 @@ const HEAD = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n'
|
|
|
79
80
|
const PACKAGE = 'http://schemas.openxmlformats.org/package/2006'
|
|
80
81
|
const OFFICE = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships'
|
|
81
82
|
|
|
82
|
-
/** @param {[string, string][]} parts path → content type, under officedocument's */
|
|
83
|
-
const contentTypes = (parts) => `${HEAD}<Types xmlns="${PACKAGE}/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${
|
|
84
|
-
parts.map(([path, type]) => `<Override PartName="/${path}" ContentType="application/vnd.openxmlformats-officedocument.${type}+xml"/>`).join('')}</Types>`
|
|
83
|
+
/** @param {[string, string][]} parts path → content type, under officedocument's but the title's @param {string[]} [pictures] the kinds of picture it holds */
|
|
84
|
+
const contentTypes = (parts, pictures = []) => `${HEAD}<Types xmlns="${PACKAGE}/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/>${
|
|
85
|
+
pictures.map((kind) => `<Default Extension="${kind}" ContentType="image/${kind}"/>`).join('')}${parts.map(([path, type]) => `<Override PartName="/${path}" ContentType="application/vnd.openxmlformats-${type === 'core' ? 'package.core-properties' : `officedocument.${type}`}+xml"/>`).join('')}</Types>`
|
|
85
86
|
|
|
86
|
-
/** @param {[string, string, string, string?][]} links id, type (under officeDocument's), target, and External for a web address */
|
|
87
|
+
/** @param {[string, string, string, string?][]} links id, type (under officeDocument's but the title's), target, and External for a web address */
|
|
87
88
|
const relationships = (links) => `${HEAD}<Relationships xmlns="${PACKAGE}/relationships">${
|
|
88
|
-
links.map(([id, type, target, mode]) => `<Relationship Id="${id}" Type="${OFFICE}/${type}" Target="${xml(target)}"${mode ? ' TargetMode="External"' : ''}/>`).join('')}</Relationships>`
|
|
89
|
+
links.map(([id, type, target, mode]) => `<Relationship Id="${id}" Type="${type === 'core' ? `${PACKAGE}/relationships/metadata/core-properties` : `${OFFICE}/${type}`}" Target="${xml(target)}"${mode ? ' TargetMode="External"' : ''}/>`).join('')}</Relationships>`
|
|
89
90
|
|
|
90
|
-
/**
|
|
91
|
-
const
|
|
91
|
+
/** A file's title, which Word and Excel show and read out (RGAA 13.3): its name. @param {string} title */
|
|
92
|
+
const core = (title) => `${HEAD}<cp:coreProperties xmlns:cp="${PACKAGE}/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:title>${xml(title)}</dc:title></cp:coreProperties>`
|
|
93
|
+
/** @param {Record<string, string | Uint8Array>} parts path → XML, or a picture's bytes @param {Date} [date] */
|
|
94
|
+
const zip = (parts, date) => writeZip(Object.entries(parts).map(([name, part]) => ({ name, bytes: typeof part === 'string' ? encoder.encode(part) : part })), date)
|
|
92
95
|
|
|
93
96
|
/** Arabic, Hebrew, Persian, Urdu, Syriac, Thaana… */
|
|
94
97
|
const RTL = /[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/
|
|
@@ -114,28 +117,48 @@ const CUSTOM = `${HEAD}<Properties xmlns="http://schemas.openxmlformats.org/offi
|
|
|
114
117
|
const W = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'
|
|
115
118
|
const PAPER = { a4: '<w:pgSz w:w="11906" w:h="16838"/>', letter: '<w:pgSz w:w="12240" w:h="15840"/>' }
|
|
116
119
|
|
|
117
|
-
/** @typedef {{ links: string[], lists: [number, number][], colour?: string }} Parts what the other parts list as the document is written: link addresses, each numbered list's start and level; the look's colour */
|
|
118
|
-
/**
|
|
120
|
+
/** @typedef {{ links: string[], lists: [number, number][], media: Picture[], pictures?: Map<string, Picture>, colour?: string, fill?: string }} Parts what the other parts list as the document is written: link addresses, each numbered list's start and level, the pictures it holds of those it was given; the look's colour and pale fill */
|
|
121
|
+
/** A picture as Word takes it, the size it shows at in CSS pixels. @typedef {{ bytes: Uint8Array, type: 'png' | 'jpeg', width: number, height: number }} Picture */
|
|
122
|
+
/** The look here on white paper (ui/kit.js, D601, D663): its colours as `#rrggbb`, those for words reading on white, its voice or its own fonts, and for Word, its logo and the corner it sits in. @typedef {{ colour?: string, ink?: string, muted?: string, soft?: string, voice?: string, fonts?: { heading: string[], body: string[] }, logo?: Picture | string, logoAt?: string }} Look */
|
|
119
123
|
/** @typedef {{ b?: boolean, i?: boolean, s?: boolean, code?: boolean, link?: boolean }} Format */
|
|
120
124
|
|
|
121
|
-
/** @param {string} markdown @param {'a4' | 'letter'} paper @param {Date | undefined} date @param {Look} look */
|
|
122
|
-
async function docx(markdown, paper, date, look) {
|
|
125
|
+
/** @param {string} markdown @param {'a4' | 'letter'} paper @param {Date | undefined} date @param {Look} look @param {Map<string, Picture> | undefined} pictures @param {boolean} made @param {string} title */
|
|
126
|
+
async function docx(markdown, paper, date, look, pictures, made, title) {
|
|
123
127
|
/** @type {Parts} */
|
|
124
|
-
const parts = { links: [], lists: [], colour: look.colour?.slice(1) }
|
|
128
|
+
const parts = { links: [], lists: [], media: [], pictures, colour: look.colour?.slice(1), fill: look.soft?.slice(1) }
|
|
125
129
|
const body = blocks(lexed(markdown, { breaks: true }), parts) || '<w:p/>'
|
|
126
|
-
|
|
130
|
+
// The logo on every page in its corner, as on a slide: in the page's head, or its foot.
|
|
131
|
+
const { logoAt = 'top-end' } = look, logo = typeof look.logo === 'object' ? look.logo : undefined, [edge, tag] = logoAt.startsWith('bottom') ? ['footer', 'ftr'] : ['header', 'hdr']
|
|
132
|
+
const section = `<w:sectPr>${logo ? `<w:${edge}Reference w:type="default" r:id="rIdLogo"/>` : ''}${PAPER[paper]}<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="708" w:footer="708" w:gutter="0"/></w:sectPr>`
|
|
127
133
|
return zip({
|
|
128
|
-
'[Content_Types].xml': contentTypes([['word/document.xml', 'wordprocessingml.document.main'], ['word/styles.xml', 'wordprocessingml.styles'], ['word/numbering.xml', 'wordprocessingml.numbering'], ['docProps/custom.xml', 'custom-properties']]),
|
|
129
|
-
|
|
130
|
-
'docProps/custom.xml':
|
|
134
|
+
'[Content_Types].xml': contentTypes([['word/document.xml', 'wordprocessingml.document.main'], ['word/styles.xml', 'wordprocessingml.styles'], ['word/numbering.xml', 'wordprocessingml.numbering'], ['docProps/core.xml', 'core'], ...(made ? /** @type {[string, string][]} */ ([['docProps/custom.xml', 'custom-properties']]) : []),
|
|
135
|
+
...(logo ? /** @type {[string, string][]} */ ([[`word/${edge}.xml`, `wordprocessingml.${edge}`]]) : [])], [...new Set([...parts.media, ...(logo ? [logo] : [])].map(({ type }) => type))]),
|
|
136
|
+
'_rels/.rels': relationships([['rId1', 'officeDocument', 'word/document.xml'], ['rId3', 'core', 'docProps/core.xml'], ...(made ? /** @type {[string, string, string][]} */ ([['rId2', 'custom-properties', 'docProps/custom.xml']]) : [])]),
|
|
137
|
+
...(made && { 'docProps/custom.xml': CUSTOM }), 'docProps/core.xml': core(title),
|
|
131
138
|
'word/_rels/document.xml.rels': relationships([['rId1', 'styles', 'styles.xml'], ['rId2', 'numbering', 'numbering.xml'],
|
|
132
|
-
...parts.links.map((url, i) => /** @type {[string, string, string, string]} */ ([`rIdLink${i + 1}`, 'hyperlink', url, 'External']))
|
|
139
|
+
...parts.links.map((url, i) => /** @type {[string, string, string, string]} */ ([`rIdLink${i + 1}`, 'hyperlink', url, 'External'])),
|
|
140
|
+
...parts.media.map(({ type }, i) => /** @type {[string, string, string]} */ ([`rIdPicture${i + 1}`, 'image', `media/picture${i + 1}.${type}`])), ...(logo ? /** @type {[string, string, string][]} */ ([['rIdLogo', edge, `${edge}.xml`]]) : [])]),
|
|
133
141
|
'word/document.xml': `${HEAD}<w:document xmlns:w="${W}" xmlns:r="${OFFICE}"><w:body>${body}${section}</w:body></w:document>`,
|
|
134
142
|
'word/styles.xml': stylesOf(look),
|
|
135
143
|
'word/numbering.xml': numbering(parts.lists),
|
|
144
|
+
...Object.fromEntries(parts.media.map(({ bytes, type }, i) => [`word/media/picture${i + 1}.${type}`, bytes])),
|
|
145
|
+
...(logo && { [`word/media/logo.${logo.type}`]: logo.bytes, [`word/_rels/${edge}.xml.rels`]: relationships([['rId1', 'image', `media/logo.${logo.type}`]]),
|
|
146
|
+
// In a document that reads right to left, Word's left is where a line starts, as an end's right is where it ends.
|
|
147
|
+
[`word/${edge}.xml`]: `${HEAD}<w:${tag} xmlns:w="${W}" xmlns:r="${OFFICE}"><w:p><w:pPr>${rightToLeft(markdown) ? '<w:bidi/>' : ''}<w:jc w:val="${logoAt.endsWith('end') ? 'right' : 'left'}"/></w:pPr>${drawing('rId1', logo, '', 1)}</w:p></w:${tag}>` }),
|
|
136
148
|
}, date)
|
|
137
149
|
}
|
|
138
150
|
|
|
151
|
+
/** The widest and tallest a picture shows, the text's room on A4 between Word's margins, in EMU (9,525 to a CSS pixel). */
|
|
152
|
+
const ROOM = [5731200, 8229600]
|
|
153
|
+
/** A picture in a line of the text, no larger than its room. @param {string} rel its relationship @param {Picture} picture @param {string} alt @param {number} id */
|
|
154
|
+
function drawing(rel, { width, height }, alt, id) {
|
|
155
|
+
const scale = Math.min(9525, ROOM[0] / width, ROOM[1] / height), [cx, cy] = [width, height].map((side) => Math.round(side * scale))
|
|
156
|
+
return `<w:r><w:drawing><wp:inline xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${cx}" cy="${cy}"/><wp:docPr id="${id}" name="Picture ${id}" descr="${xml(alt)}"/><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="${id}" name="Picture ${id}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${rel}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${cx}" cy="${cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** One of the pictures the document was given, in its place, else what stands for it. @param {Parts} parts @param {string} at what it was given by @param {string} alt @param {string} or */
|
|
160
|
+
const given = (parts, at, alt, or, picture = parts.pictures?.get(at)) => (picture ? drawing(`rIdPicture${parts.media.push(picture)}`, picture, alt, parts.media.length + 1) : or)
|
|
161
|
+
|
|
139
162
|
/** @param {any[]} tokens @param {Parts} parts @param {string} [style] a paragraph style for all of them (a quote's) @returns {string} */
|
|
140
163
|
function blocks(tokens, parts, style = '') {
|
|
141
164
|
return tokens.map((token) => {
|
|
@@ -145,7 +168,8 @@ function blocks(tokens, parts, style = '') {
|
|
|
145
168
|
case 'list': return list(token, parts, 0)
|
|
146
169
|
case 'table': return table(token, parts)
|
|
147
170
|
case 'blockquote': return blocks(token.tokens, parts, 'Quote')
|
|
148
|
-
|
|
171
|
+
// Code an answer draws (a chart, a diagram), as the picture it was given of it.
|
|
172
|
+
case 'code': return paragraph(given(parts, token.text, '', run(token.text, { code: true })), { style: parts.pictures?.has(token.text) ? '' : 'Code' })
|
|
149
173
|
case 'hr': return '<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="auto"/></w:pBdr></w:pPr></w:p>'
|
|
150
174
|
// Raw HTML is shown as text, as in answers.
|
|
151
175
|
case 'html': return paragraph(run(token.text.trim()), { style, text: token.text })
|
|
@@ -180,7 +204,7 @@ function runs(tokens = [], parts, format = {}) {
|
|
|
180
204
|
case 'codespan': return run(token.text, { ...format, code: true })
|
|
181
205
|
case 'br': return '<w:r><w:br/></w:r>'
|
|
182
206
|
case 'checkbox': return run(token.checked ? '☑ ' : '☐ ', format)
|
|
183
|
-
case 'image': return run(`[${token.text || token.href}]`, format)
|
|
207
|
+
case 'image': return given(parts, token.href, token.text, run(`[${token.text || token.href}]`, format))
|
|
184
208
|
case 'link': {
|
|
185
209
|
const inner = runs(token.tokens, parts, { ...format, link: true })
|
|
186
210
|
if (!/^(https?:|mailto:)/i.test(token.href)) return inner
|
|
@@ -231,7 +255,7 @@ function table(token, parts) {
|
|
|
231
255
|
const width = Math.floor(9000 / token.header.length)
|
|
232
256
|
const direction = rightToLeft(token.header.map((/** @type {any} */ cell) => cell.text).join(' ')) ? '<w:bidiVisual/>' : ''
|
|
233
257
|
/** @param {any[]} cells @param {boolean} header */
|
|
234
|
-
const row = (cells, header) => `<w:tr>${header ? '<w:trPr><w:tblHeader/></w:trPr>' : ''}${cells.map((cell, i) => `<w:tc><w:tcPr><w:tcW w:w="${width}" w:type="dxa"/>${header && parts.colour ? `<w:tcBorders><w:bottom w:val="single" w:sz="12" w:space="0" w:color="${parts.colour}"/></w:tcBorders>` : ''}${header ?
|
|
258
|
+
const row = (cells, header) => `<w:tr>${header ? '<w:trPr><w:tblHeader/></w:trPr>' : ''}${cells.map((cell, i) => `<w:tc><w:tcPr><w:tcW w:w="${width}" w:type="dxa"/>${header && parts.colour ? `<w:tcBorders><w:bottom w:val="single" w:sz="12" w:space="0" w:color="${parts.colour}"/></w:tcBorders>` : ''}${header ? `<w:shd w:val="clear" w:color="auto" w:fill="${parts.fill ?? 'F2F2F2'}"/>` : ''}</w:tcPr>${
|
|
235
259
|
paragraph(runs(cell.tokens, parts, { b: header }), { text: cell.text, align: token.align[i], tight: true })}</w:tc>`).join('')}</w:tr>`
|
|
236
260
|
// A paragraph after it, as Word keeps one: two tables in a row would merge.
|
|
237
261
|
return `<w:tbl><w:tblPr>${direction}<w:tblW w:w="5000" w:type="pct"/>${BORDERS}</w:tblPr><w:tblGrid>${`<w:gridCol w:w="${width}"/>`.repeat(token.header.length)}</w:tblGrid>${
|
|
@@ -252,20 +276,28 @@ function numbering(lists) {
|
|
|
252
276
|
/** Each voice's faces in Word, Office's own, its headings' then its words', where calm keeps Word's (D601). */
|
|
253
277
|
const FACES = /** @type {Record<string, [string, string]>} */ ({ elegant: ['Georgia', 'Calibri'], bold: ['Arial Narrow', 'Calibri'], friendly: ['Trebuchet MS', 'Trebuchet MS'] })
|
|
254
278
|
/** @param {string} face */
|
|
255
|
-
const fonts = (face) => `<w:rFonts w:ascii="${face}" w:hAnsi="${face}" w:cs="Arial"/>`
|
|
279
|
+
const fonts = (face) => `<w:rFonts w:ascii="${xml(face)}" w:hAnsi="${xml(face)}" w:cs="Arial"/>`
|
|
280
|
+
/** The face of a stack Word can name: its first that is no browser's family. @param {string[] | undefined} faces */
|
|
281
|
+
const named = (faces) => faces?.find((face) => !/^(ui-.*|system-ui|serif|sans-serif|monospace|cursive|fantasy)$/.test(face))
|
|
282
|
+
/** @param {string | undefined} colour #rrggbb @param {string} [or] without one */
|
|
283
|
+
const colourOf = (colour, or) => (colour || or ? `<w:color w:val="${colour?.slice(1) ?? or}"/>` : '')
|
|
256
284
|
|
|
257
285
|
/** @param {number} level @param {number} size in half-points @param {string[]} look its face and its colour, each where the schema has it */
|
|
258
286
|
const heading = (level, size, [face, colour]) => `<w:style w:type="paragraph" w:styleId="Heading${level}"><w:name w:val="heading ${level}"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="${level < 3 ? 360 : 240}" w:after="120"/><w:outlineLvl w:val="${level - 1}"/></w:pPr><w:rPr>${face}<w:b/><w:bCs/>${colour}<w:sz w:val="${size}"/><w:szCs w:val="${size}"/></w:rPr></w:style>`
|
|
259
287
|
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
+
|
|
288
|
+
/** A look's faces in Office, its headings' then its words', its own else its voice's. @param {Look} look */
|
|
289
|
+
const faces = ({ voice, fonts: own }) => ((voiced, body) => [named(own?.heading) ?? (own ? body : voiced), body])(FACES[voice ?? '']?.[0] ?? 'Calibri', named(own?.body) ?? FACES[voice ?? '']?.[1] ?? 'Calibri')
|
|
290
|
+
|
|
291
|
+
/** The styles: words in the look's ink and faces, headings and links in its colour, a quote in its muted one, code on its pale fill. @param {Look} own */
|
|
292
|
+
function stylesOf(own) {
|
|
293
|
+
const { colour, ink, muted, soft } = own, [head, body] = faces(own), look = [head === body ? '' : fonts(head), colourOf(colour)]
|
|
294
|
+
return `${HEAD}<w:styles xmlns:w="${W}"><w:docDefaults><w:rPrDefault><w:rPr>${fonts(body)}${colourOf(ink)}<w:sz w:val="22"/><w:szCs w:val="22"/><w:lang w:val="${xml(globalThis.document?.documentElement.lang || 'en')}"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:spacing w:after="160" w:line="276" w:lineRule="auto"/></w:pPr></w:pPrDefault></w:docDefaults>`
|
|
295
|
+
// In the style too, as previews read none of the document's defaults.
|
|
296
|
+
+ `<w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/><w:rPr>${fonts(body)}${colourOf(ink)}</w:rPr></w:style>`
|
|
297
|
+
+ [36, 30, 26, 24, 22, 22].map((size, i) => heading(i + 1, size, look)).join('')
|
|
298
|
+
+ `<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:ind w:left="567"/></w:pPr><w:rPr><w:i/><w:iCs/>${colourOf(muted, '595959')}</w:rPr></w:style>`
|
|
299
|
+
+ `<w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:pPr><w:shd w:val="clear" w:color="auto" w:fill="${soft?.slice(1) ?? 'F2F2F2'}"/><w:spacing w:line="240" w:lineRule="auto"/></w:pPr><w:rPr><w:rFonts w:ascii="Consolas" w:hAnsi="Consolas" w:cs="Consolas"/><w:sz w:val="20"/><w:szCs w:val="20"/></w:rPr></w:style>`
|
|
300
|
+
+ `<w:style w:type="character" w:styleId="Hyperlink"><w:name w:val="Hyperlink"/><w:rPr>${colourOf(colour, '0563C1')}<w:u w:val="single"/></w:rPr></w:style></w:styles>`
|
|
269
301
|
}
|
|
270
302
|
|
|
271
303
|
// ─── Excel ───────────────────────────────────────────────────────────────────
|
|
@@ -406,8 +438,8 @@ const column = (index) => (index >= 26 ? column(Math.floor(index / 26) - 1) : ''
|
|
|
406
438
|
/** How wide a text shows: CJK characters take two columns. @param {string} text */
|
|
407
439
|
const width = (text) => [...text].reduce((sum, char) => sum + (/[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFF00-\uFF60]/.test(char) ? 2 : 1), 0)
|
|
408
440
|
|
|
409
|
-
/** @param {Sheet[]} sheets @param {Date} [date] */
|
|
410
|
-
async function xlsx(sheets, date) {
|
|
441
|
+
/** @param {Sheet[]} sheets @param {Date} [date] @param {Look} [look] @param {string} [title] */
|
|
442
|
+
async function xlsx(sheets, date, look = {}, title = '') {
|
|
411
443
|
/** @type {Map<string, number>} */
|
|
412
444
|
const strings = new Map()
|
|
413
445
|
/** @param {string} text */
|
|
@@ -446,22 +478,28 @@ async function xlsx(sheets, date) {
|
|
|
446
478
|
const n = sheets.length
|
|
447
479
|
return zip({
|
|
448
480
|
'[Content_Types].xml': contentTypes([['xl/workbook.xml', 'spreadsheetml.sheet.main'], ...sheets.map((_, i) => /** @type {[string, string]} */ ([`xl/worksheets/sheet${i + 1}.xml`, 'spreadsheetml.worksheet'])),
|
|
449
|
-
['xl/styles.xml', 'spreadsheetml.styles'], ['xl/sharedStrings.xml', 'spreadsheetml.sharedStrings'], ['docProps/custom.xml', 'custom-properties']]),
|
|
450
|
-
'_rels/.rels': relationships([['rId1', 'officeDocument', 'xl/workbook.xml'], ['rId2', 'custom-properties', 'docProps/custom.xml']]),
|
|
451
|
-
'docProps/custom.xml': CUSTOM,
|
|
481
|
+
['xl/styles.xml', 'spreadsheetml.styles'], ['xl/sharedStrings.xml', 'spreadsheetml.sharedStrings'], ['docProps/custom.xml', 'custom-properties'], ['docProps/core.xml', 'core']]),
|
|
482
|
+
'_rels/.rels': relationships([['rId1', 'officeDocument', 'xl/workbook.xml'], ['rId2', 'custom-properties', 'docProps/custom.xml'], ['rId3', 'core', 'docProps/core.xml']]),
|
|
483
|
+
'docProps/custom.xml': CUSTOM, 'docProps/core.xml': core(title),
|
|
452
484
|
'xl/_rels/workbook.xml.rels': relationships([...sheets.map((_, i) => /** @type {[string, string, string]} */ ([`rId${i + 1}`, 'worksheet', `worksheets/sheet${i + 1}.xml`])),
|
|
453
485
|
[`rId${n + 1}`, 'styles', 'styles.xml'], [`rId${n + 2}`, 'sharedStrings', 'sharedStrings.xml']]),
|
|
454
486
|
// Formulas have no saved results: they are worked out when the file opens.
|
|
455
487
|
'xl/workbook.xml': `${HEAD}<workbook xmlns="${SHEET}" xmlns:r="${OFFICE}"><sheets>${sheets.map(({ name }, i) => `<sheet name="${xml(name)}" sheetId="${i + 1}" r:id="rId${i + 1}"/>`).join('')}</sheets><calcPr fullCalcOnLoad="1"/></workbook>`,
|
|
456
488
|
...Object.fromEntries(worksheets.map((sheet, i) => [`xl/worksheets/sheet${i + 1}.xml`, sheet])),
|
|
457
|
-
'xl/styles.xml':
|
|
489
|
+
'xl/styles.xml': sheetStyles(look),
|
|
458
490
|
'xl/sharedStrings.xml': `${HEAD}<sst xmlns="${SHEET}" count="${strings.size}" uniqueCount="${strings.size}">${[...strings.keys()].map((text) => `<si><t xml:space="preserve">${xml(text)}</t></si>`).join('')}</sst>`,
|
|
459
491
|
}, date)
|
|
460
492
|
}
|
|
461
493
|
|
|
462
|
-
/** @param {number} format a built-in number format: 9 is 0%, 10 is 0.00%, 14 the short date of the user's settings @param {number} [font] */
|
|
463
|
-
const xf = (format, font = 0) => `<xf numFmtId="${format}" fontId="${font}" fillId="
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
494
|
+
/** @param {number} format a built-in number format: 9 is 0%, 10 is 0.00%, 14 the short date of the user's settings @param {number} [font] @param {number} [fill] @param {number} [border] */
|
|
495
|
+
const xf = (format, font = 0, fill = 0, border = 0) => `<xf numFmtId="${format}" fontId="${font}" fillId="${fill}" borderId="${border}" xfId="0"${format ? ' applyNumberFormat="1"' : ''}${font ? ' applyFont="1"' : ''}${fill ? ' applyFill="1"' : ''}${border ? ' applyBorder="1"' : ''}/>`
|
|
496
|
+
/** @param {string} colour #rrggbb */
|
|
497
|
+
const argb = (colour) => `rgb="FF${colour.slice(1).toUpperCase()}"`
|
|
498
|
+
/** The styles: words in the look's ink and face; a head row in its colour and headings' face, on its pale fill, over a line in its colour (D664). @param {Look} look */
|
|
499
|
+
function sheetStyles(look) {
|
|
500
|
+
const { colour, ink, soft } = look, [head, body] = faces(look), line = colour ? `<border><left/><right/><top/><bottom style="medium"><color ${argb(colour)}/></bottom><diagonal/></border>` : '', tint = colour ?? ink
|
|
501
|
+
return `${HEAD}<styleSheet xmlns="${SHEET}"><fonts count="2"><font><sz val="11"/>${ink ? `<color ${argb(ink)}/>` : ''}<name val="${xml(body)}"/></font><font><b/><sz val="11"/>${tint ? `<color ${argb(tint)}/>` : ''}<name val="${xml(head)}"/></font></fonts>`
|
|
502
|
+
+ `<fills count="${soft ? 3 : 2}"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill>${soft ? `<fill><patternFill patternType="solid"><fgColor ${argb(soft)}/><bgColor indexed="64"/></patternFill></fill>` : ''}</fills><borders count="${line ? 2 : 1}"><border><left/><right/><top/><bottom/><diagonal/></border>${line}</borders>`
|
|
503
|
+
+ `<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="5">${xf(0)}${xf(0, 1, soft ? 2 : 0, line ? 1 : 0)}${xf(9)}${xf(10)}${xf(14)}</cellXfs>`
|
|
504
|
+
+ '<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>'
|
|
505
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// A look on paper and on screen (D601, D663, D664): what Word files and prints wear of the design system, the organisation's kit and
|
|
2
|
+
// the project's (ui/kit.js), an answer's as a document's: words in its ink and faces, headings and links in its colour, and its logo in its
|
|
3
|
+
// corner, in place of Jean's mark on a print. On white paper always, its colours deepened to read there: a page's own colour stays in Word's
|
|
4
|
+
// window and leaves a printer's ink alone. A document's or a collection's pane shows it too, on its own paper by day and by night, as a style
|
|
5
|
+
// sheet over the room's colours. A Word file holds a document's pictures and what it draws inside; a print is alone, as it reads and without
|
|
6
|
+
// what Jean suggests. A collection inside either goes as its rows, as its view keeps them, its view being made for changing it. What takes
|
|
7
|
+
// them out is the pane's one button (ui/out.js, ./ways.js).
|
|
8
|
+
import { html, nothing, render } from 'lit-html'
|
|
9
|
+
import { effect } from '@preact/signals-core'
|
|
10
|
+
import { app, theme } from '../../ui/state.js'
|
|
11
|
+
import { save, printAlone } from '../../ui/save.js'
|
|
12
|
+
import { onPaper, onScreen, kits } from '../../ui/kit.js'
|
|
13
|
+
import { contrast, mix } from '../../ui/colour.js'
|
|
14
|
+
import { styleSheet } from '../../ui/sheet.js'
|
|
15
|
+
import { useStrings } from '../../core/i18n.js'
|
|
16
|
+
|
|
17
|
+
// The cards' style sheet and Things Jean made's own words come with them, not with the first screen (D126).
|
|
18
|
+
await Promise.all([useStrings('made'), styleSheet(new URL('made.css', import.meta.url))])
|
|
19
|
+
|
|
20
|
+
/** Each voice's faces on paper, the device's own as a deck's are, its headings' then its words', where calm keeps the room's. */
|
|
21
|
+
const FACES = /** @type {Record<string, string[]>} */ ({ elegant: ['ui-serif, "Iowan Old Style", Georgia, serif'], bold: ['"Avenir Next Condensed", "Arial Narrow", sans-serif'],
|
|
22
|
+
friendly: ['ui-rounded, "SF Pro Rounded", "Trebuchet MS", sans-serif', 'ui-rounded, "SF Pro Rounded", "Trebuchet MS", sans-serif'] })
|
|
23
|
+
/** The user's own faces, as a deck writes them, then the room's, for a device that has none of them, by value: the sheet sets that variable. @param {string[]} faces @param {string} under */
|
|
24
|
+
const stack = (faces, under) => `${faces.map((face) => (/^[\w-]+$/.test(face) ? face : `"${String(face).replace(/["\\\s]+/g, ' ')}"`)).join(', ')}, ${getComputedStyle(document.documentElement).getPropertyValue(under)}`
|
|
25
|
+
/** A look's faces, its headings' then its words'. @param {{ fonts?: { heading: string[], body: string[] }, voice?: string }} look */
|
|
26
|
+
export const facesOf = ({ fonts, voice }) => (fonts ? [stack(fonts.heading, '--display'), stack(fonts.body, '--sans')] : FACES[voice ?? ''] ?? [])
|
|
27
|
+
/** @param {{ logo?: string, logoAt?: string }} look */
|
|
28
|
+
const logoOf = ({ logo, logoAt = 'top-end' }) => Object.assign(new Image(), { src: logo, alt: '', className: `paper-logo ${logoAt}` })
|
|
29
|
+
/** Under `root`, a look's colours and faces, the room's variables among them, and `also`. @param {string} root @param {Awaited<ReturnType<typeof onPaper>> & {}} look @param {string} [also] */
|
|
30
|
+
const worn = (root, look, also = '') => ((colour, [head, body]) => `${root} { ${look.ink ? `--ink: ${look.ink}; color: ${look.ink};` : ''}${look.muted ? `--ink-soft: ${look.muted};` : ''}${colour ? `--flame: ${colour};` : ''}${body ? `--sans: ${body}; font-family: ${body};` : ''}${head ? `--display: ${head};` : ''}${also} } ${root} :is(h1, h2, h3, h4, h5, h6) { ${colour ? `color: ${colour};` : ''}${head ? `font-family: ${head};` : ''} }${colour ? ` ${root} th { border-block-end-color: ${colour}; }` : ''}`)(look.colour, facesOf(look))
|
|
31
|
+
/** A document's or a collection's pane, and what shows in it. */
|
|
32
|
+
const PANE = '.view:has(> :is(.document, app-table))'
|
|
33
|
+
|
|
34
|
+
/** On screen, what `worn` leaves: its paper, lines from its words, its pale fill, a collection's heads, a document's logo in its corner, a centimetre tall. @param {NonNullable<Awaited<ReturnType<typeof onScreen>>>} look */
|
|
35
|
+
async function inPane(look) {
|
|
36
|
+
const { paper, ink, ground, colour, soft, logo, logoAt = 'top-end', plate } = look, image = Object.assign(new Image(), { src: logo ?? '' }), foot = logoAt.startsWith('bottom')
|
|
37
|
+
if (logo) await image.decode().catch(() => {})
|
|
38
|
+
return worn(PANE, look, `${paper ? `--room: ${paper}; --room-2: ${paper}; background: ${paper}; color-scheme: ${contrast('#000000', paper) > contrast('#ffffff', paper) ? 'light' : 'dark'};` : ''}${ink ? `--ink-faint: ${look.muted}; --line: ${mix(ink, ground, 0.82)}; --line-strong: ${mix(ink, ground, 0.65)};` : ''}`)
|
|
39
|
+
+ `${soft ? ` ${PANE} .prose pre { background: ${soft}; }` : ''}${colour ? ` ${PANE} .table-grid th { color: ${colour}; }` : ''}`
|
|
40
|
+
+ (logo ? ` ${PANE} .doc-wrap::${foot ? 'after' : 'before'} { content: ''; flex: none; block-size: 1cm; inline-size: min(4cm, ${(image.naturalHeight && image.naturalWidth / image.naturalHeight) || 4}cm); margin-block: ${foot ? '1rem 0' : '0 1rem'}; ${logoAt.endsWith('end') ? 'margin-inline-start: auto;' : ''} background: url("${logo}") center / contain no-repeat; ${plate ? 'background-color: #fff; border-radius: 0.1rem; box-shadow: 0 0 0 0.25rem #fff;' : ''} }` : '')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let paper = /** @type {CSSStyleSheet | null} */ (null)
|
|
44
|
+
/** Whatever prints, by Print or the browser's own, and a document's or a collection's pane, in the look here: `.prose`, Jean's mark. */
|
|
45
|
+
export async function dress() {
|
|
46
|
+
const [look, shown] = await Promise.all([onPaper(), onScreen()])
|
|
47
|
+
if (!look && !shown && !paper) return look
|
|
48
|
+
const mark = document.querySelector('.print-mark')
|
|
49
|
+
mark?.querySelector('.paper-logo')?.remove()
|
|
50
|
+
if (look?.logo) mark?.prepend(logoOf(look))
|
|
51
|
+
if (!paper) document.adoptedStyleSheets = [...document.adoptedStyleSheets, (paper = new CSSStyleSheet())]
|
|
52
|
+
paper.replaceSync(`${look ? `@media print { ${worn('.prose', look)} }` : ''}${shown ? ` @media screen { ${await inPane(shown)} }` : ''}`)
|
|
53
|
+
return look
|
|
54
|
+
}
|
|
55
|
+
// Again for the project shown, by day or by night, and each kit kept.
|
|
56
|
+
effect(() => { void app.project.value; void theme.value; void kits.value; void dress() })
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A picture as Word takes it, a PNG or a JPEG as it is, another kind drawn as a PNG, four times as fine as it shows if it's the logo.
|
|
60
|
+
* @param {Blob | string} picture a file's, or a logo's data: address @param {(width: number, height: number) => number[]} [fit] the size it shows at
|
|
61
|
+
* @returns {Promise<import('./formats.js').Picture>}
|
|
62
|
+
*/
|
|
63
|
+
async function forWord(picture, fit = (width, height) => [width, height]) {
|
|
64
|
+
const logo = typeof picture === 'string', image = Object.assign(new Image(), { src: logo ? picture : URL.createObjectURL(picture) }), kept = !logo && /^image\/(png|jpeg)$/.exec(picture.type)?.[1]
|
|
65
|
+
await image.decode()
|
|
66
|
+
if (!logo) URL.revokeObjectURL(image.src)
|
|
67
|
+
const [width, height] = fit(image.naturalWidth || 256, image.naturalHeight || 256), fine = logo ? 4 : 1
|
|
68
|
+
if (!logo && kept) return { bytes: new Uint8Array(await picture.arrayBuffer()), type: /** @type {'png' | 'jpeg'} */ (kept), width, height }
|
|
69
|
+
const canvas = Object.assign(document.createElement('canvas'), { width: Math.ceil(width * fine), height: Math.ceil(height * fine) })
|
|
70
|
+
;/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')).drawImage(image, 0, 0, canvas.width, canvas.height)
|
|
71
|
+
const blob = /** @type {Blob} */ (await new Promise((resolve) => canvas.toBlob(/** @type {BlobCallback} */ (resolve), 'image/png')))
|
|
72
|
+
return { bytes: new Uint8Array(await blob.arrayBuffer()), type: 'png', width, height }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The look here for a Word file: its logo at most a centimetre tall and four wide. */
|
|
76
|
+
export async function wordLook() {
|
|
77
|
+
const look = await onPaper()
|
|
78
|
+
return look && { ...look, logo: look.logo ? await forWord(look.logo, (width, height) => [width, height].map((side) => side * Math.min(151 / width, 38 / height))).catch(() => undefined) : undefined }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A picture of the project's, as a document names one. */
|
|
82
|
+
const KEPT = /!\[[^\]]*\]\((\.\.\/files\/sha256-[\da-f]{64}\.(\w+))\)/g
|
|
83
|
+
/** What a Word file holds as pictures, by what its Markdown says of each: the project's it names, and what's drawn on the page, by its code. @param {string} source @param {Element} [page] */
|
|
84
|
+
const picturesIn = async (source, page) => new Map(/** @type {[string, import('./formats.js').Picture][]} */ ((await Promise.all(/** @type {Promise<any[]>[]} */ ([
|
|
85
|
+
...[...source.matchAll(KEPT)].map(async ([, at, kind]) => [at, await forWord(new Blob([/** @type {BlobPart} */ (await app.fs.readBytes(`${app.projectDir}/${at.slice(3)}`))], { type: `image/${kind.replace('jpg', 'jpeg')}` }))]),
|
|
86
|
+
// Drawn twice as fine as they show.
|
|
87
|
+
...[...page?.querySelectorAll('.drawn-form :is(app-chart, app-score, app-slides, app-latex, app-diagram)') ?? []].map(async (one) => [one.getAttribute('source'), await forWord(await /** @type {any} */ (one).picture(), (width, height) => [width / 2, height / 2])]),
|
|
88
|
+
]).map((entry) => entry.catch((error) => console.warn('Word', error) ?? [])))).filter((entry) => entry.length)))
|
|
89
|
+
|
|
90
|
+
/** A collection in a document's Markdown, each as its rows under its name, in Word's Markdown. @param {string} source */
|
|
91
|
+
export async function withRows(source) {
|
|
92
|
+
let words = source
|
|
93
|
+
for (const [block, folder] of source.matchAll(/^```table\n(collections\/[^\n]+)\n```$/gm)) {
|
|
94
|
+
const grid = await (await import('../tables/tables.js')).gridIn(folder), line = (/** @type {string[]} */ cells) => `| ${cells.map((cell) => cell.replace(/[\\`*_[\]<>|~$&]/g, '\\$&').replace(/\s*\n\s*/g, ' ')).join(' | ')} |`
|
|
95
|
+
if (grid) words = words.replace(block, () => [`### ${grid.name}`, '', line(grid.rows[0]), `| ${grid.right.map((right) => (right ? '---:' : '---')).join(' | ')} |`, ...grid.rows.slice(1).map(line)].join('\n'))
|
|
96
|
+
}
|
|
97
|
+
return words
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Markdown as a Word file, named by its title, on the paper of the user's country, a reference to a creation (D575) by its name, code left as it is.
|
|
102
|
+
* @param {string} source @param {string} title @param {{ made?: boolean, page?: Element }} [options] whether a trained model made it; the page it is drawn on
|
|
103
|
+
*/
|
|
104
|
+
export async function downloadWord(source, title, { made, page } = {}) {
|
|
105
|
+
const { makeFile, paperFor } = await import('./formats.js')
|
|
106
|
+
const words = (await withRows(source)).replace(/^(`{3,}|~{3,})[^]*?^\1|`[^`\n]*`|\[\[([^[\]|\n]+)(?:\|([^[\]\n]+))?\]\]/gm, (all, _, place, name) => (place ? name ?? place : all))
|
|
107
|
+
const { name, mimeType, bytes } = await makeFile(`${title}.docx`, words, { paper: paperFor(navigator.language), look: await wordLook(), pictures: await picturesIn(source, page), made })
|
|
108
|
+
save(new Blob([/** @type {BlobPart} */ (bytes)], { type: mimeType }), name)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** A collection as a page says it, under its name, for a print. @param {string} folder */
|
|
112
|
+
export async function rowsOf(folder) {
|
|
113
|
+
const grid = await (await import('../tables/tables.js')).gridIn(folder), box = document.createElement('div')
|
|
114
|
+
const cells = (/** @type {string[]} */ row, /** @type {(cell: string, right: boolean) => unknown} */ draw) => row.map((cell, i) => draw(cell, Boolean(grid?.right[i])))
|
|
115
|
+
if (grid) render(html`<h3 dir="auto">${grid.name}</h3><table><thead><tr>${cells(grid.rows[0], (cell, right) => html`<th dir="auto" class=${right ? 'paper-end' : nothing}>${cell}</th>`)}</tr></thead>
|
|
116
|
+
<tbody>${grid.rows.slice(1).map((row) => html`<tr>${cells(row, (cell, right) => html`<td dir="auto" class=${right ? 'paper-end' : nothing}>${cell}</td>`)}</tr>`)}</tbody></table>`, box)
|
|
117
|
+
return box
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A document printed alone, what it draws drawn again out of sight at a page's width, a few seconds at most, then gone: as it reads, what
|
|
122
|
+
* Jean suggests left out and a block being written drawn; its logo once, at its start, or at its end for a corner at the foot. Within a Word file's
|
|
123
|
+
* margins, on whichever paper the print dialog holds, the words filling its width and a chart scaled to it in proportion.
|
|
124
|
+
* @param {HTMLElement} dom its editor's
|
|
125
|
+
*/
|
|
126
|
+
export async function printPage(dom) {
|
|
127
|
+
const look = await dress(), holder = document.body.appendChild(Object.assign(document.createElement('div'), { className: 'document paper-print' })), page = /** @type {HTMLElement} */ (dom.cloneNode(true))
|
|
128
|
+
for (const one of page.querySelectorAll('.suggest')) one.remove()
|
|
129
|
+
for (const one of page.querySelectorAll('.suggest-old, .is-editing')) one.classList.remove('suggest-old', 'is-editing')
|
|
130
|
+
for (const one of page.querySelectorAll('app-table')) one.replaceWith(await rowsOf(one.getAttribute('folder') ?? ''))
|
|
131
|
+
// What draws itself does so again as it joins the page, beside its copy if that stayed.
|
|
132
|
+
for (const one of page.querySelectorAll('*')) if (one.localName.startsWith('app-')) one.replaceChildren()
|
|
133
|
+
page.removeAttribute('id'), page.removeAttribute('role'), page.setAttribute('contenteditable', 'false')
|
|
134
|
+
holder.append(page)
|
|
135
|
+
if (look?.logo) holder[look.logoAt?.startsWith('bottom') ? 'append' : 'prepend'](logoOf(look))
|
|
136
|
+
const drawing = () => [...holder.querySelectorAll('app-shared, app-chart, app-score, app-diagram, app-latex')].some((one) => !one.querySelector('img, svg, canvas, table, .latex-page')) || [...holder.querySelectorAll('img')].some((one) => !one.complete)
|
|
137
|
+
await printAlone(holder, 'is-printing-paper', { page: '@page { margin: 2.54cm }', drawing,
|
|
138
|
+
ready: () => { for (const chart of holder.querySelectorAll('.chart')) /** @type {HTMLElement} */ (chart).style.aspectRatio = `${/** @type {HTMLElement} */ (chart).offsetWidth} / ${/** @type {HTMLElement} */ (chart).offsetHeight}` } })
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** What isn't a document printed as one: `drawn`, in a page of its own. @param {unknown} drawn */
|
|
142
|
+
export const printDrawn = (drawn) => { const page = Object.assign(document.createElement('div'), { className: 'doc prose' }); render(drawn, page); return printPage(page) }
|
package/caps/math/math.js
CHANGED
|
@@ -59,9 +59,9 @@ class AppLatex extends HTMLElement {
|
|
|
59
59
|
// One line: a formula with no row breaks, or a sentence.
|
|
60
60
|
this.toggleAttribute('line', !open && !more.length && (part?.type === 'math' ? !part.text.includes('\\\\') : part?.type === 'paragraph' && !part.raw.trim().includes('\n')))
|
|
61
61
|
render(html`<div class="latex-page">${tokens.map(drawn)}</div>
|
|
62
|
-
<div class="drawn-foot">
|
|
62
|
+
<div class="drawn-foot" lang=${locale.value}>
|
|
63
63
|
<button class="icon-button subtle" aria-label=${t('action.copy')}
|
|
64
|
-
@click=${() => copyDrawing(source, this.picture()).then(() => notify(t('toast.copied')), () => notify(t('made.copyFailed')))}>${icons.copy}</button>
|
|
64
|
+
@click=${() => copyDrawing(source, this.picture()).then(() => notify(t('toast.copied')), () => notify(t('made.copyFailed'), { alert: true }))}>${icons.copy}</button>
|
|
65
65
|
</div>`, this)
|
|
66
66
|
}
|
|
67
67
|
|
package/caps/scores/scores.css
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/* Scores (D196): the score in the ink's colour, the notes sounding in the flame's, then the player; Copy at its top corner, shown on hover. */
|
|
2
|
-
app-score { position: relative; }
|
|
2
|
+
app-score { position: relative; } .score-notes { margin-block-start: 0.35rem; font-size: 0.875rem; } .score-notes summary { color: var(--ink-soft); cursor: pointer; } .score-notes pre { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
3
3
|
app-score .score-sheet { --sounding: var(--flame); color: var(--ink); }
|
|
4
|
-
/* By night on paper
|
|
4
|
+
/* By night on paper: music is read dark on light, so the sheet is a paper in the ink's hue, dimmer than the words, the notes in the room's colour and those sounding in the flame's, deep enough for 4:1; on the print sheet, the paper's own. */
|
|
5
5
|
@media screen { @supports (color: oklch(from red l c h)) { [data-theme='dark'] app-score .score-sheet { --sounding: oklch(from var(--flame) 0.5 min(c, 0.13) h); border-radius: 0.5rem; background: oklch(from var(--ink) 0.87 min(c, 0.03) h); color: var(--room); } } }
|
|
6
6
|
app-score .score-sheet:empty { display: none; }
|
|
7
7
|
app-score .score-sheet .is-sounding { color: var(--sounding); fill: var(--sounding); }
|
|
8
|
-
/* The band behind the place the music has come to
|
|
8
|
+
/* The band behind the place the music has come to, a wash of the notes' colour, firmer when more contrast is asked and the system's highlight in forced colours. */
|
|
9
9
|
app-score .score-band { fill: var(--sounding); fill-opacity: 0.18; stroke: none; } @media (prefers-contrast: more) { app-score .score-band { fill-opacity: 0.3; } } @media (forced-colors: active) { app-score .score-band { fill: Highlight; } }
|
|
10
|
-
/* Save
|
|
11
|
-
.score-
|
|
12
|
-
.score-out button > span { display: grid; } .score-out small { color: var(--ink-soft); white-space: normal; } .score-print { position: fixed; inset-inline-start: -300vw; inline-size: 17cm; }
|
|
10
|
+
/* Save: its menu at the pane's top, as Slides' is; printed alone, the score drawn again in black on white, out of sight until then. */
|
|
11
|
+
.score-print { position: fixed; inset-inline-start: -300vw; inline-size: 17cm; }
|
|
13
12
|
@media print { :root.is-printing-score body > :not(.score-print) { display: none !important; } :root.is-printing-score .score-print { inset-inline-start: 0; color: #000; background: #fff; } }
|
|
14
13
|
app-score .score-player { display: flex; align-items: center; gap: 0.6rem; margin-block: 0.4rem 0.2rem; }
|
|
15
14
|
app-score .score-player input { flex: 1; min-inline-size: 0; accent-color: var(--flame); }
|
|
@@ -17,7 +16,7 @@ app-score .score-time { color: var(--ink-soft); font-size: 0.85rem; font-variant
|
|
|
17
16
|
/* While its instruments come (D338), Pause breathes, and the time says how much of them has. */
|
|
18
17
|
app-score .score-player[aria-busy='true'] .icon-button { animation: glow 0.8s ease-in-out infinite alternate var(--loops, running); }
|
|
19
18
|
@media print { app-score .score-player { display: none; } }
|
|
20
|
-
/* Beside the task
|
|
19
|
+
/* Beside the task: the score down to the pane's foot, over the view's padding (1.25rem), its player under it, staying at that foot as the score scrolls, and no Copy over it (the pane saves it). */
|
|
21
20
|
app-score.beside { display: flex; flex: 1 0 auto; flex-direction: column; margin-block-end: -1.25rem; background: var(--room); } app-score.beside .score-player { position: sticky; z-index: 1; bottom: -1.25rem; padding-block: 0.6rem 1.65rem; background: var(--room); } app-score.beside .drawn-foot { display: none; }
|
|
22
21
|
app-score .drawn-foot { position: absolute; z-index: 1; inset-block-start: 0.4rem; inset-inline-end: 0.4rem; transition: opacity 0.2s; }
|
|
23
22
|
app-score .drawn-foot .icon-button { background: var(--glass); }
|
|
@@ -28,3 +27,4 @@ app-score .drawn-status { margin: 0 0 0.6rem; }
|
|
|
28
27
|
.is-streaming app-score .drawn-status { display: grid; place-items: center; min-block-size: 8rem; margin: 0; }
|
|
29
28
|
app-score .while, .is-streaming app-score :is(.failed, pre) { display: none; }
|
|
30
29
|
.is-streaming app-score .while { display: inline; }
|
|
30
|
+
.score-player [aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px currentColor; }
|