gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitbd4aa808bd4aa808Record VL24 deployment and live verificationmrebd4aa808/project.hl

8.9 KB

  1. // project.hl — components.hybriel.worldapi.org: THE SITE. Hybriel components developed standalone: the home
  2. // lists them, each has a demo page (`/<component>`) and its README (`/<component>/README.md`). No login, no data.
  3. // Apps vendor a component by copying its folder (README of the component says which files).
  4. // THE MAP — which file handles what:
  5. // components/main.hl the shell: header, offline note, the slot every page renders into
  6. // components/index.hl `/`: the list of components (a new component adds one entry there)
  7. // components/styles.hl the site's own CSS (/__hl/app.css); every component carries its own Style
  8. // components/<name>/<name>.hl a component (the public file apps copy; layouts.worldapi.org themes it)
  9. // components/<name>/demo.hl its demo page `/<name>`; README.md is served at `/<name>/README.md`
  10. // components/files-upload/demo-pick.hl `/files-upload/pick`: the several-files upload in pick mode (a chat input, ticket #18)
  11. // components/media-player/ the media player (audio + video, phone first) and its demo `/<name>`; the demo's media files in storage/media
  12. // components/virtual-list/ the virtual list (a very long list, only the rows near the viewport exist) and its demo `/virtual-list`
  13. // lib/comments.hl the comments demo's mock thread and what the page does with a post / edit / delete / like
  14. // lib/uploads.hl where the demos keep uploaded files (file upload, several files, Markdown editor), one day
  15. // lib/media.hl the media player demo's own files: storage/media served with ranges (a media element seeks)
  16. // shared/base.hl THE BASE LOOK: black, white, four greys (#15) — the site's colours and every component's fallbacks
  17. // shared/tokens.hl the WorldAPI colour tokens (verbatim copy; not used by the site since #15 — the theme's business)
  18. import WebFramework from 'hl:web'
  19. import { env, exit } from 'hl:proc'
  20. import { serve as serveMedia } from './lib/media.hl'
  21. import { black, white } from './shared/base.hl'
  22. import Styles from './components/styles.hl'
  23. import Index from './components/index.hl'
  24. import MonthViewDemo from './components/month-view/demo.hl'
  25. import DatePickerDemo from './components/date-picker/demo.hl'
  26. import RangePickerDemo from './components/range-picker/demo.hl'
  27. import PaginationDemo from './components/pagination/demo.hl'
  28. import MdEditorDemo from './components/md-editor/demo.hl'
  29. import CodeEditorDemo from './components/code-editor/demo.hl'
  30. import FileUploadDemo from './components/file-upload/demo.hl'
  31. import FilesUploadDemo from './components/files-upload/demo.hl'
  32. import FilesPickDemo from './components/files-upload/demo-pick.hl'
  33. import ModalDemo from './components/modal/demo.hl'
  34. import CommentsDemo from './components/comments/demo.hl'
  35. import MediaPlayerDemo from './components/media-player/demo.hl'
  36. import MediaPlayerAudioDemo from './components/media-player/demo-audio.hl'
  37. import VirtualListDemo from './components/virtual-list/demo.hl'
  38. static siteName = "Hybriel components"
  39. appTitle = siteName
  40. // ---- THE INSTALLABLE APP (mission 046), the same way calendar.worldapi.org / tracker.worldapi.org do it: hl:web's own
  41. // web app manifest (/__hl/manifest.webmanifest, linked from every head with the apple-touch-icon and theme-color) and
  42. // service worker (/__hl/sw.js) from these settings — no JavaScript of ours. Icons in icons/ (icon.svg is the source,
  43. // the PNGs are rendered from it with rsvg-convert, README "PWA"). The theme colour is the header's background
  44. // (black), the splash background the page's (white) — both off shared/base.hl, not written out again.
  45. appShortName = 'Components' // the name under the home-screen icon (the full one is too long there)
  46. appThemeColor = black.value
  47. appBackgroundColor = white.value
  48. appIcons = [
  49. { src = '/icons/icon-192.png' sizes = '192x192' purpose = 'any' }
  50. { src = '/icons/icon-512.png' sizes = '512x512' purpose = 'any' }
  51. { src = '/icons/icon-192.png' sizes = '192x192' purpose = 'maskable' }
  52. { src = '/icons/icon-512.png' sizes = '512x512' purpose = 'maskable' }
  53. ]
  54. appTouchIcon = '/icons/apple-touch-icon.png'
  55. appFavicon = '/icons/favicon.svg'
  56. // OFFLINE: only the shell — the header and the home list `/` (components/main.hl says "You are offline" while the
  57. // browser has no network). The demo pages are not kept: without a network they get hl:web's "Unavailable offline" page.
  58. offline = [ Index ]
  59. styles = Styles
  60. // the component's README is plain Markdown, served as it is
  61. routes = [
  62. { pattern = "/favicon.ico" file = "./icons/favicon.ico" headers = { 'Cache-Control' = 'no-cache' } }
  63. // the installable app (mission 046): the icons (manifest and service worker are hl:web's own, from appIcons / offline)
  64. { pattern = "/icons/icon-192.png" file = "./icons/icon-192.png" headers = { 'Cache-Control' = 'no-cache' } }
  65. { pattern = "/icons/icon-512.png" file = "./icons/icon-512.png" headers = { 'Cache-Control' = 'no-cache' } }
  66. { pattern = "/icons/apple-touch-icon.png" file = "./icons/apple-touch-icon.png" headers = { 'Cache-Control' = 'no-cache' } }
  67. { pattern = "/icons/favicon.svg" file = "./icons/favicon.svg" headers = { 'Cache-Control' = 'no-cache' } }
  68. { pattern = "/" component = Index }
  69. { pattern = "/month-view" component = MonthViewDemo }
  70. { pattern = "/month-view/README.md" file = "./components/month-view/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  71. { pattern = "/date-picker" component = DatePickerDemo }
  72. { pattern = "/date-picker/README.md" file = "./components/date-picker/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  73. { pattern = "/range-picker" component = RangePickerDemo }
  74. { pattern = "/range-picker/README.md" file = "./components/range-picker/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  75. { pattern = "/md-editor" component = MdEditorDemo }
  76. { pattern = "/md-editor/README.md" file = "./components/md-editor/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  77. { pattern = "/md-editor/files/*" directory = "./storage/md-files" headers = { 'X-Content-Type-Options' = 'nosniff' 'Content-Security-Policy' = "sandbox" } }
  78. { pattern = "/code-editor" component = CodeEditorDemo }
  79. { pattern = "/code-editor/README.md" file = "./components/code-editor/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  80. { pattern = "/file-upload" component = FileUploadDemo }
  81. { pattern = "/file-upload/README.md" file = "./components/file-upload/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  82. { pattern = "/files-upload" component = FilesUploadDemo }
  83. { pattern = "/files-upload/pick" component = FilesPickDemo }
  84. { pattern = "/files-upload/README.md" file = "./components/files-upload/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  85. { pattern = "/modal" component = ModalDemo }
  86. { pattern = "/modal/README.md" file = "./components/modal/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  87. { pattern = "/comments" component = CommentsDemo }
  88. { pattern = "/comments/README.md" file = "./components/comments/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  89. { pattern = "/media-player" component = MediaPlayerDemo }
  90. { pattern = "/media-player/audio" component = MediaPlayerAudioDemo }
  91. { pattern = "/media-player/README.md" file = "./components/media-player/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  92. { pattern = "/media/*" function = (route, req) => { return serveMedia(req) } }
  93. { pattern = "/virtual-list" component = VirtualListDemo }
  94. { pattern = "/virtual-list/README.md" file = "./components/virtual-list/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  95. { pattern = "/pagination" component = PaginationDemo }
  96. { pattern = "/pagination/README.md" file = "./components/pagination/README.md" headers = { 'Content-Type' = 'text/markdown; charset=utf-8' 'Cache-Control' = 'no-cache' } }
  97. ]
  98. sessionDir = env('COMPONENTS_SESSIONS') != null ? env('COMPONENTS_SESSIONS') : null
  99. port = env('COMPONENTS_PORT') != null ? toNumber(env('COMPONENTS_PORT')) : 8380
  100. // HL_HOST = the interface hl:web binds: 127.0.0.1 on Byrodin behind nginx; unset = 0.0.0.0 (dev on Loreana).
  101. // COMPONENTS_WATCH=0 = no dev watcher.
  102. watching = env('COMPONENTS_WATCH') != '0'
  103. sessionCookie = 'componentssid'
  104. server = new WebFramework(routes = routes, styles = styles, minify = true, port = port, watchMode = watching, sessionCookie = sessionCookie, uploadMax = 5242880, sessionMaxAge = 3122064000)
  105. on Error(e) {
  106. if (e.phase == 'startup') { console.log('components: startup error: ' + e.message) exit(1) }
  107. console.log('error absorbed: ' + e.message)
  108. }

Branches

Latest commits

  • bd4aa808Record VL24 deployment and live verificationmre
  • e5b98ecfRun virtual-list gate before deploymentmre
  • 2e9b4a8evirtual-list: into main, with centerId and scrollTop/onScroll (jukebox#20)mre
  • 69954249Align all plugin sources with Hybriel day38bmre
  • f740f666Re-vendor components to Hybriel set day38bmre
  • 8176eb14Record CS23b deployment and live verificationmre
  • 84e3ddaaRemove blank line before pagination Style closing bracemre
  • a92298ddRecord exact CSS and same-date proof after specificity reviewmre
  • c71a0abePreserve consumer theme specificity with nested tag rulesmre
  • 64a2bc27Document CS23b style formatting proof and review statusmre
  • a72b57cficons: nest Style rules in the language's formmre
  • 927616e2pagination: nest Style rules in the language's formmre
  • aab8ad29code-editor: nest Style rules in the language's formmre
  • ba30727afile-upload: nest Style rules in the language's formmre
  • 42fefa4emodal: nest Style rules in the language's formmre
  • 6fd953e3range-picker: nest Style rules in the language's formmre
  • f661951ddate-picker: nest Style rules in the language's formmre
  • 363577e6media-player: nest Style rules in the language's formmre
  • 0b3fd8c9comments: nest Style rules in the language's formmre
  • 67e043c8plugins/web/README.md from hybriel cb9e480dmre