gitoria

notes

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit4dd46dad4dd46dadsync-components: copy icons/icons.hl + README (F4); testsmre4dd46dad/lib/notes-helpers.hl

1.1 KB

  1. // lib/notes-helpers.hl — what lib/notes.hl looks up (notes mission 002, code order): the size limit, the tombstone
  2. // check, the version stamp and the copy mark of a conflict.
  3. import { now } from 'hl:time'
  4. static maxText = 200000
  5. static textError = (text) => {
  6. if (text == null || hlTypeName(text) != 'String') { return 'the note must be text' }
  7. if (text.length > maxText) { return 'the note is too long (at most ' + maxText + ' characters)' }
  8. return null
  9. }
  10. // alive = not deleted (gone == 0; the row of a deleted note stays as a tombstone)
  11. static isAlive = (n) => { return n != null && (n.gone == null || n.gone == 0) }
  12. // the version stamp of an edit made at `at` (the browser's clock): never in the future, always after `prev` —
  13. // so the sidebar order is the order the edits were really made in, and a version stamp is never reused
  14. static stampOf = (at, prev) => {
  15. t = now()
  16. cand = at > 0 && at < t ? at : t
  17. return cand > prev ? cand : prev + 1
  18. }
  19. // the line at the end of the version that lost a conflict (kept as a note of its own)
  20. static copyMark = '
  21. *(kept as a copy: this note was changed on two devices at once)*'

Branches

Latest commits

  • 4dd46dadsync-components: copy icons/icons.hl + README (F4); testsmre
  • c92e4a0ftests/e2e-outside.mjs: real-Chrome E2E, a note pushed from another device while open, then typingmre
  • 0516b4ccmd-editor.hl: verbatim copy of components f3-mdvalue (an older text handed back is kept)mre
  • 38cc11ecmd-editor.hl: verbatim copy of components f3-mdvalue (an outside value change is shown by the editor)mre
  • 3e7e79f5reports/H1-hydrate.mdmre
  • d98775e8tests/browser.mjs: wait for hydration before the clicks after a goto('/') (tables new note, phone sidebar)mre
  • 1f3198b6tests/cdp.mjs: HL_CPU_THROTTLE=<rate> optional CPU throttling for gate runsmre
  • 39cf9fdfre-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • db07aa84tests: short-id-switch ports from env (NOTES_SWITCH_IDENT_PORT/_PORT), defaults unchangedmre
  • ef9f9feere-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • 5485467cdocker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
  • 86ea4a85deploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • edeab20fnotes mission 015: mission, report, LOG, STATUSmre
  • 542a0383notes mission 015: e2e-chrome E2E_HOST (own cookie jar in the shared Chrome)mre
  • 8b30f510notes mission 015: main-menu from layouts 0bcc629, current = true kept (route marks only /), server-HTML marker checksmre
  • 84b574c4notes mission 015: re-vendor plugins from hybriel f9614007 (incl. web, #117)mre
  • 447da53dnotes mission 014: report — remaining gates and lisbeth E2E proofmre
  • fd9f92c3notes mission 014: report (partial), LOG, STATUSmre
  • b2501360notes mission 014: open() sets asking=false before flush(0) (hybriel#196)mre
  • 9414ce59notes mission 014: merge theme 76f99f6, components 3794c59, strict single-press openAsk (fails on old open())mre