gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commita06fc778a06fc778Reset virtual-list window when the host changes resetKeyAtlasa06fc778/project.hl

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

Branches

Latest commits

  • a06fc778Reset virtual-list window when the host changes resetKeyAtlas
  • 3aab598cRe-vendor complete Hybriel day73 set for virtual-list resetAtlas
  • 337ca075MD1 gate check measures frames in the page, not milliseconds from outside, and takes the middle load (components#30)mre
  • f5f131c5Record AP29 autoplay comparisons and passing gatesmre
  • 51c38187Gate media autoplay on first load and after client mountmre
  • a3f2223dRecord successful B44 deployment and live proofmre
  • 06c1e021Record passing B44 browser rerunmre
  • c9861533Record B44 component proof and browser gate blockermre
  • 1b7413beIgnore detached media events and space demo option outputsmre
  • ca3b4959Re-vendor complete Hybriel plugins and runtime to day44mre
  • df9e7df9Last-item checks run in the browser gate (components#26 fixed on day41); media-player loop is a plain Booleanmre
  • 895a5afcRe-vendor complete Hybriel plugins and runtime to day41mre
  • 16006bb3Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 88397fc3Re-vendor complete Hybriel plugins and runtime to day39mre
  • 9b872cedRecord IC28 deployment and live icon verificationmre
  • 46fefaa7Count the icons entry in the offline home-page checkmre
  • c7e14cabRecord IC28 rerun and unchanged-main baseline comparisonmre
  • 5e090ffdRecord IC28 review evidence and gate resultsmre
  • adfe2c4dAdd shuffle, repeat and repeatOne shared iconsmre
  • c96709c8media-player: skip = false and repeat = 'one' options (jukebox#19)mre