gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit67e043c867e043c8plugins/web/README.md from hybriel cb9e480dmre67e043c8/components/modal/demo.hl

2.8 KB

  1. // demo.hl — `/modal`: four modals on one page, opened by the page's buttons, and the reason each one closed with. The page opens a
  2. // modal by its dialog's id (`showModal()`), closes one itself (`close('saved')`), and hears the modal's bubbling `close` on a wrapper element.
  3. parent '../main.hl'
  4. import Modal from './modal.hl'
  5. __title = 'Modal · Hybriel components'
  6. String lastClosed = 'nothing yet'
  7. String saved = ''
  8. Hybrid paragraphs = longText()
  9. longText() {
  10. out = []
  11. let i = 1
  12. while (i <= 20) { out.push('Paragraph ' + i + ': the page behind stays where it was while this scrolls.') i = i + 1 }
  13. return out
  14. }
  15. View {
  16. modalDemo { on close(e) { emit demoClosed(e) }
  17. h1 { "Modal" }
  18. p { class = "muted" "A window over the page: the page behind is dimmed and blocked. Esc, the × and a click on the dim background close it; the page is told how it was closed." }
  19. p { class = "modal-openers"
  20. button { type = "button" id = "open-info" "Information" on click(e) { emit demoOpen('info') } }
  21. button { type = "button" id = "open-confirm" "Confirm (OK / Cancel)" on click(e) { emit demoOpen('confirm') } }
  22. button { type = "button" id = "open-form" "A form (no background close)" on click(e) { emit demoOpen('form') } }
  23. button { type = "button" id = "open-long" "Long text" on click(e) { emit demoOpen('long') } }
  24. }
  25. p { "Last closed: " output { id = "modal-last" lastClosed } }
  26. p { "Saved name: " output { id = "modal-saved" saved } }
  27. p { a { id = "readme" href = "/modal/README.md" "README (how to use it)" } }
  28. Modal { id = "info" title = "Information"
  29. p { "A modal holds any content. Close it with the ×, Esc or a click on the dim background." }
  30. }
  31. Modal { id = "confirm" title = "Delete the draft?"
  32. p { "The draft will be gone. This cannot be undone." }
  33. footer {
  34. button { type = "button" value = "cancel" "Cancel" }
  35. button { type = "button" value = "ok" "Delete" }
  36. }
  37. }
  38. Modal { id = "form" title = "Your name" backdropClose = "false"
  39. p { "A click on the background does not close this one: only the ×, Esc, Cancel or Save." }
  40. p { label { "Name " input { id = "modal-name" type = "text" autocomplete = "off" } } }
  41. footer {
  42. button { type = "button" value = "cancel" "Cancel" }
  43. button { type = "button" id = "modal-save" "Save" on click(e) { emit demoSave(e) } }
  44. }
  45. }
  46. Modal { id = "long" title = "Long text"
  47. p { "The window keeps inside the screen; its content scrolls, the page behind does not." }
  48. for (t of paragraphs) { p { t } }
  49. }
  50. }
  51. }
  52. on demoOpen(id) { document.getElementById(id).showModal() }
  53. // "Save" is the page's own button: the page takes the name and closes the modal itself, with its own reason
  54. on demoSave(e) {
  55. saved = document.getElementById('modal-name').value
  56. document.getElementById('form').close('saved')
  57. }
  58. on demoClosed(e) { lastClosed = e.detail.id + ': ' + e.detail.reason }

Branches

Latest commits

  • 67e043c8plugins/web/README.md from hybriel cb9e480dmre
  • 519b56e9styles.hl: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • 29f63d01md-editor: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • 869f49c7files-upload: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • f60dab20month-view: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • 5b3c349aRe-vendor to Hybriel set day35 (cb9e480d): plugins core and web sources, README vendoring notemre
  • 3449b117components: a startup error prints its message before exit 1 (hybriel#247)mre
  • 59704ce1Merge branch 'n5b-pipes'mre
  • 23b9164aMdEditor: a clipboard whose text is only the names or file:// paths of its files (a file manager copy) is about the files, as before; any other text wins (tickets#49); gate casesmre
  • b0f1ec28MdEditor: a clipboard with text always pastes the text, also when a picture is on it too (a spreadsheet or office app), files on or off; a picture alone still goes to the files; real Ctrl+V gate tests/md-paste-files.mjs (tickets#49)mre
  • ad4e929bMdEditor: pipe rows without a delimiter row are a table (first row = header, short rows padded, written back without an invented | --- | line) (notes#5)mre
  • 4bd11128MdEditor: the Table button's empty table is written as a real pipe table (empty cells), so it survives the source switch, a save and a reload (notes#7)mre
  • 7437e32bMdEditor draws its surface at once when claimed from server HTML: 1 ms mount animation, the first editor mounts all editors of the pagemre
  • 5de0264cRe-vendor onto Hybriel master acaceaf3 (set-day27b): binary, lib and plugins; exit 1 on a startup fault; .gitignore binmre
  • 79c77e7dMerge sb3-standby: components deploys through its standbymre
  • c5442043components: no jobs switch needed in the standbymre
  • 8d2fb24ccomponents: a standby container (port 45016, profile standby); deploy hands over through standby-swap.sh without a gapmre
  • c2834dd3Merge mr-fixes: media player state after a queue pick, Range handling, cover-less audio, accessibility labelsmre
  • 354fe3c6Media player: audio without a cover starts and shows its time (the mount tick sits on the seek bar, which every item has); the speed button names the current speed, the seek slider says its time in words; a gate page for the first render on cover-less audio and a fourth demo queue item without a covermre
  • ee4aee1eMedia player: a new queue item shows its own speed, mute, play state and time and starts when asked, also for two videos in a row; the media route reads suffix ranges and ignores range lists and garbage instead of answering 500; stronger gate checks (the 10 percent drag, the played bar, the queue tap)mre