layouts
All repositories: gitoria
1.7 KB
# File upload (one file)A dashed drop zone with a "Choose a file" button. Drop or choose a file: its name, size and a progress bar show, then"Uploaded", and the file is listed under "Uploaded". One file at a time (a drop of several takes the first; a file droppedduring an upload is ignored). Live demo: https://components.hybriel.worldapi.org/file-upload## Use it in an appCopy the folder `components/file-upload/` (`file-upload.hl`; it carries its own `Style`, colours are semantic tokens with ablack/white/grey fallback, the one border is the drop zone's dashed one), compose it, and write the face that stores the file:```import FileUpload from './file-upload.hl'View { FileUpload { } }on server saveFile(file) {// file.name, file.type, file.size, file.bytes — store it where you wantwriteFile('storage/uploads/' + name, file.bytes)return { ok = true }}```- The component sends the file with `emit server saveFile(file)`; the framework carries it over HTTP in parts with progress(hybriel#94). Pure Hybriel: no `.js`, no own network calls.- The face decides where the file goes and how big it may be (`uploadMax` of the WebFramework). Answer anything but `null`when it is stored; `null` (or an error) shows "Failed".- Face names are global to the app (`saveFile`): one upload face per app.- `dropText`, `chooseText`, `uploadedTitle` are the texts. One component per page (composed members are the page's state).- Progress comes from `on client uploadProgress`, shown by the component itself.## Markup and states`<file-upload>` holds `<drop-zone>` (class `over` while a file is dragged over) with `<upload-status>` (name, size,`<progress>`, `<output class="state">`) and `<uploaded-list>` with `<ul class="uploaded">`. Classes on `<file-upload>`:`busy`, `done`, `failed`, `shown`.
Branches
Latest commits
- eae2be7aapp-sidebar: nest child selectors and document caller-slot gapmre
- 69c9f784Record LY7 slot nesting blocker and minimal repromre
- b1d4f379app-header: nest child and compound selectors in Stylemre
- 6385ff8eRecord LY7 style formatting proof and review statusmre
- 0100f51etracker-demo: format Style with nested rules and bare mediamre
- 5f82554enotes-demo: format Style with nested rules and bare mediamre
- 3dc27d78mail-demo: format Style with nested rules and bare mediamre
- cf9648afhome: format Style with nested rules and bare mediamre
- 846a6242user-menu: format Style with nested rules and bare mediamre
- 4d58708cthree-pane: format Style with nested rules and bare mediamre
- 0bbfc553main-menu: format Style with nested rules and bare mediamre
- 7755199dlist-first: format Style with nested rules and bare mediamre
- 35199303content-first: format Style with nested rules and bare mediamre
- 00f6e698app-sidebar: format Style with nested rules and bare mediamre
- bb2f29c9app-header: format Style with nested rules and bare mediamre
- 3aca2d7fSync components from 8176eb1 with reviewed nested stylesmre
- 87e4003dRe-vendor layouts to Hybriel set day35mre
- d8628cfflayouts: a startup error prints its message before exit 1 (hybriel#247)mre
- 180fd76elayouts: MdEditor from components 59704ce (text on the clipboard always pastes, a file manager copy still attaches; pipe rows; empty Table-button table; tickets#49, notes#5)mre
- a3eda8afRe-vendor Hybriel master 7a684920 (binary 74ab3715): plugins whole, startup fault exits 1; files-upload gate 340/0mre