@ember-joinery/file-upload 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +154 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +63 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/upload-actor.d.ts +46 -0
- package/declarations/-private/upload-actor.d.ts.map +1 -0
- package/declarations/components/file-upload/context.d.ts +21 -0
- package/declarations/components/file-upload/context.d.ts.map +1 -0
- package/declarations/components/file-upload/dropzone.d.ts +48 -0
- package/declarations/components/file-upload/dropzone.d.ts.map +1 -0
- package/declarations/components/file-upload/index.d.ts +137 -0
- package/declarations/components/file-upload/index.d.ts.map +1 -0
- package/declarations/components/file-upload/labels.d.ts +25 -0
- package/declarations/components/file-upload/labels.d.ts.map +1 -0
- package/declarations/components/file-upload/list.d.ts +18 -0
- package/declarations/components/file-upload/list.d.ts.map +1 -0
- package/declarations/components/file-upload/queue.d.ts +23 -0
- package/declarations/components/file-upload/queue.d.ts.map +1 -0
- package/declarations/components/file-upload/state.d.ts +156 -0
- package/declarations/components/file-upload/state.d.ts.map +1 -0
- package/declarations/components/file-upload.d.ts +3 -0
- package/declarations/index.d.ts +5 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/messages.d.ts +55 -0
- package/declarations/messages.d.ts.map +1 -0
- package/declarations/test-support/file-upload.d.ts +112 -0
- package/declarations/test-support/file-upload.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +2 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/test-support.d.ts +2 -0
- package/declarations/utils.d.ts +25 -0
- package/declarations/utils.d.ts.map +1 -0
- package/dist/components/file-upload.js +722 -0
- package/dist/components/file-upload.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.js +57 -0
- package/dist/messages.js.map +1 -0
- package/dist/test-support.js +266 -0
- package/dist/test-support.js.map +1 -0
- package/dist/utils.js +60 -0
- package/dist/utils.js.map +1 -0
- package/package.json +120 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.js","sources":["../../src/components/file-upload/dropzone.gts","../../src/components/file-upload/labels.ts","../../src/components/file-upload/list.gts","../../src/components/file-upload/queue.gts","../../src/-private/upload-actor.ts","../../src/components/file-upload/state.ts","../../src/components/file-upload/index.gts"],"sourcesContent":["import Component from '@glimmer/component'\nimport { tracked } from '@glimmer/tracking'\nimport { hash } from '@ember/helper'\nimport FileDropzone from 'ember-file-upload/components/file-dropzone'\nimport type { UploadFile } from 'ember-file-upload'\nimport { Upload as UploadIcon } from 'lucide'\nimport Icon from '@ember-joinery/ember/components/icon'\nimport type { FileUploadContext } from './context.ts'\n\n/** What a drop zone's block gets: whether files are dragged over it, and whether it can tell. */\nexport interface FileUploadDropzoneState {\n /** Whether files are dragged over the zone now. */\n isDragging: boolean\n /** Whether the browser can drag and drop files (every evergreen browser can). */\n isSupported: boolean\n}\n\nexport interface FileUploadDropzoneSignature {\n Args: {\n /** The `<FileUpload>` it belongs to; `u.Dropzone` comes with it. */\n upload: FileUploadContext\n }\n Blocks: {\n /**\n * What the zone shows, in place of its icon, prompt and hint. It names the zone's file\n * input, so say what a press on it does.\n */\n default: [zone: FileUploadDropzoneState]\n }\n /** ember-file-upload's `FileDropzone`: a `<div>`. */\n Element: HTMLElement\n}\n\n/**\n * The zone to drop files on, or to press to choose them: ember-file-upload's `FileDropzone`\n * around a visually hidden `<input type=\"file\">`, in the look of shadcn's Empty with a dashed\n * border. It turns `--primary` while files are dragged over it, shows the focus ring while its\n * input has focus, and names the files a choice or drop turned away under its prompt, in a\n * status region that is always there (empty until then), so screen readers announce it.\n */\nexport default class FileUploadDropzone extends Component<FileUploadDropzoneSignature> {\n @tracked isDragging = false\n\n get state() {\n return this.args.upload.state\n }\n\n get labels() {\n return this.args.upload.labels\n }\n\n get rejected(): string | undefined {\n const names = this.state.rejected\n return names.length ? this.labels.rejectedLabel([...names]) : undefined\n }\n\n get leftOut(): string | undefined {\n const names = this.state.leftOut\n return names.length ? this.labels.leftOutLabel([...names]) : undefined\n }\n\n /** Whether to say files can be dropped: only where they can be, and while it takes them. */\n get showsHint(): boolean {\n return !this.state.disabled\n }\n\n get description(): string | undefined {\n return this.labels.description ?? this.state.accept\n }\n\n enter = (): void => {\n if (!this.state.disabled) this.isDragging = true\n }\n\n leave = (): void => {\n this.isDragging = false\n }\n\n drop = (files: UploadFile[], transfer: { files: File[] }): void => {\n this.isDragging = false\n this.state.onDrop(files, transfer)\n }\n\n <template>\n <FileDropzone\n @queue={{this.state.queue}}\n @multiple={{this.state.multiple}}\n @filter={{this.state.filter}}\n @onDragEnter={{this.enter}}\n @onDragLeave={{this.leave}}\n @onDrop={{this.drop}}\n class=\"jn-file-upload-dropzone\"\n data-slot=\"file-upload-dropzone\"\n data-dragging={{if this.isDragging \"\"}}\n data-disabled={{if this.state.disabled \"\"}}\n data-invalid={{if @upload.invalid \"\"}}\n data-test-jn-part=\"dropzone\"\n ...attributes\n as |dropzone|\n >\n <label class=\"jn-file-upload-dropzone-label\" data-slot=\"file-upload-dropzone-label\">\n <input\n id={{@upload.inputId}}\n class=\"jn-file-upload-input\"\n type=\"file\"\n accept={{this.state.accept}}\n multiple={{this.state.multiple}}\n disabled={{this.state.disabled}}\n required={{@upload.required}}\n aria-label={{@upload.label}}\n aria-invalid={{if @upload.invalid \"true\"}}\n aria-describedby={{@upload.describedBy}}\n data-test-jn-part=\"input\"\n {{this.state.queue.selectFile\n filter=this.state.filter\n onFilesSelected=this.state.onSelect\n }}\n />\n {{#if (has-block)}}\n {{yield (hash isDragging=this.isDragging isSupported=dropzone.supported)}}\n {{else}}\n <span class=\"jn-empty-header\" data-slot=\"file-upload-dropzone-header\">\n <span class=\"jn-empty-media jn-empty-media-icon\" data-slot=\"file-upload-dropzone-media\">\n <Icon @icon={{UploadIcon}} />\n </span>\n <span class=\"jn-empty-title jn-font-heading\" data-slot=\"file-upload-dropzone-title\">\n {{if this.isDragging this.labels.dropLabel this.labels.prompt}}\n </span>\n {{#if dropzone.supported}}\n {{#if this.showsHint}}\n {{#unless this.isDragging}}\n <span class=\"jn-empty-description\" data-slot=\"file-upload-dropzone-hint\">\n {{this.labels.hint}}\n </span>\n {{/unless}}\n {{/if}}\n {{/if}}\n {{#if this.description}}\n <span class=\"jn-empty-description\" data-slot=\"file-upload-dropzone-description\">\n {{this.description}}\n </span>\n {{/if}}\n </span>\n {{/if}}\n </label>\n {{! A live region already in the page, so what is put in it is announced. }}\n <div\n class=\"jn-file-upload-status\"\n data-slot=\"file-upload-status\"\n role=\"status\"\n data-test-jn-part=\"status\"\n >\n {{#if this.rejected}}\n <p data-slot=\"file-upload-rejected\" data-test-jn-part=\"rejected\">{{this.rejected}}</p>\n {{/if}}\n {{#if this.leftOut}}\n <p data-slot=\"file-upload-left-out\" data-test-jn-part=\"left-out\">{{this.leftOut}}</p>\n {{/if}}\n </div>\n </FileDropzone>\n </template>\n}\n","import {\n File as FileIcon,\n FileArchive,\n FileAudio,\n FileImage,\n FileSpreadsheet,\n FileText,\n FileVideo,\n} from 'lucide'\nimport type { IconNode } from '@ember-joinery/ember/components/icon'\n\n/** The strings a `<FileUpload>` shows, each an argument with an English default. */\nexport interface FileUploadLabels {\n /** The drop zone's call to action. */\n prompt: string\n /** What follows it where the browser can drag and drop. */\n hint: string\n /** What the zone says while files are dragged over it. */\n dropLabel: string\n /** A line under the hint, such as which files it takes. */\n description: string | undefined\n /** Names the files a choice or drop turned away, as `@accept` doesn't take them. */\n rejectedLabel: (names: string[]) => string\n /** Names the files a drop of several left out, without `@multiple`. */\n leftOutLabel: (names: string[]) => string\n /** Names a file's remove button. */\n removeLabel: (name: string) => string\n /** Names a failed upload's retry button. */\n retryLabel: (name: string) => string\n /** Names a file's progress bar while it uploads. */\n progressLabel: (name: string) => string\n}\n\nconst ARCHIVES = new Set(['zip', 'gz', 'tgz', 'tar', 'rar', '7z', 'bz2', 'xz'])\nconst SHEETS = new Set(['csv', 'tsv', 'xls', 'xlsx', 'ods', 'numbers'])\nconst TEXTS = new Set(['pdf', 'txt', 'md', 'doc', 'docx', 'odt', 'rtf', 'pages'])\nconst IMAGES = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'avif', 'svg', 'heic', 'bmp', 'tiff'])\nconst VIDEOS = new Set(['mp4', 'mov', 'webm', 'mkv', 'avi', 'm4v'])\nconst AUDIO = new Set(['mp3', 'wav', 'ogg', 'flac', 'm4a', 'aac'])\n\n/** The lucide icon for a file, from its MIME type when it has one, else its extension. */\nexport function fileIcon(name: string, type = ''): IconNode {\n const extension = name.includes('.') ? name.split('.').pop()!.toLowerCase() : ''\n if (type.startsWith('image/') || IMAGES.has(extension)) return FileImage\n if (type.startsWith('video/') || VIDEOS.has(extension)) return FileVideo\n if (type.startsWith('audio/') || AUDIO.has(extension)) return FileAudio\n if (ARCHIVES.has(extension)) return FileArchive\n if (SHEETS.has(extension) || type === 'text/csv') return FileSpreadsheet\n if (TEXTS.has(extension) || type.startsWith('text/') || type === 'application/pdf')\n return FileText\n return FileIcon\n}\n","import type { TOC } from '@ember/component/template-only'\nimport { fn } from '@ember/helper'\nimport { on } from '@ember/modifier'\nimport { X } from 'lucide'\nimport Button from '@ember-joinery/ember/components/button'\nimport Icon from '@ember-joinery/ember/components/icon'\nimport Item, { ItemGroup } from '@ember-joinery/ember/components/item'\nimport { fileIcon } from './labels.ts'\nimport type { FileUploadContext } from './context.ts'\n\nexport interface FileUploadListSignature {\n Args: {\n /** The `<FileUpload>` it belongs to; `u.List` comes with it. */\n upload: FileUploadContext\n }\n /** An `ItemGroup` (`role=\"list\"`), rendered only while the value holds a file. */\n Element: HTMLElement\n}\n\nconst call = <A, R>(fn: (arg: A) => R, arg: A): R => fn(arg)\n\n/**\n * The files the value holds, one shadcn Item each (`role=\"listitem\"`, outlined and small, in an\n * `ItemGroup`): a preview of an image, or an icon for its kind, its name, its kind and size, and\n * a button that removes it. A disabled `<FileUpload>` shows no remove buttons.\n */\nconst FileUploadList: TOC<FileUploadListSignature> = <template>\n {{#if @upload.state.files.length}}\n <ItemGroup class=\"jn-file-upload-list\" data-test-jn-part=\"list\" ...attributes>\n {{! Keyed on the value, so a row (and the focus on its button) stays when others change. }}\n {{#each @upload.state.files key=\"value\" as |entry|}}\n <Item\n @variant=\"outline\"\n @size=\"sm\"\n @name={{entry.name}}\n role=\"listitem\"\n class=\"jn-file-upload-file\"\n data-state=\"done\"\n as |i|\n >\n <i.Media @variant=\"image\" class=\"jn-file-upload-file-media\">\n {{#if entry.preview}}\n <img src={{entry.preview}} alt=\"\" />\n {{else}}\n <Icon @icon={{fileIcon entry.name entry.value.type}} />\n {{/if}}\n </i.Media>\n <i.Content class=\"jn-file-upload-file-content\">\n <i.Title class=\"jn-file-upload-file-title\">\n <span class=\"jn-file-upload-file-name\">{{entry.name}}</span>\n </i.Title>\n <i.Description>\n {{entry.kind}}{{#if entry.size}} · {{entry.size}}{{/if}}\n </i.Description>\n </i.Content>\n {{#unless @upload.state.disabled}}\n <i.Actions>\n <Button\n @variant=\"ghost\"\n @size=\"icon-sm\"\n @name=\"remove\"\n class=\"jn-file-upload-remove\"\n aria-label={{call @upload.labels.removeLabel entry.name}}\n {{on \"click\" (fn @upload.state.remove entry.value)}}\n >\n <Icon @icon={{X}} />\n </Button>\n </i.Actions>\n {{/unless}}\n </Item>\n {{/each}}\n </ItemGroup>\n {{/if}}\n</template>\n\nexport default FileUploadList\n","import type { TOC } from '@ember/component/template-only'\nimport { fn } from '@ember/helper'\nimport { on } from '@ember/modifier'\nimport { RotateCw, X } from 'lucide'\nimport Button from '@ember-joinery/ember/components/button'\nimport Icon from '@ember-joinery/ember/components/icon'\nimport Item, { ItemGroup } from '@ember-joinery/ember/components/item'\nimport Progress from '@ember-joinery/ember/components/progress'\nimport { fileIcon } from './labels.ts'\nimport type { FileUploadContext } from './context.ts'\n\nexport interface FileUploadQueueSignature {\n Args: {\n /** The `<FileUpload>` it belongs to; `u.Queue` comes with it. */\n upload: FileUploadContext\n }\n /**\n * An `ItemGroup` (`role=\"list\"`), rendered only while a file is uploading or has failed, and\n * `aria-busy` while one uploads.\n */\n Element: HTMLElement\n}\n\nconst call = <A, R>(fn: (arg: A) => R, arg: A): R => fn(arg)\nconst isError = (state: string): boolean => state === 'error'\n\n/**\n * The files `@upload` is sending, one shadcn Item each, like the file list's: a preview or an\n * icon, the name, its kind and size, and a Progress bar across the row's foot that follows\n * ember-file-upload's `progress`. A failed upload shows its error, with buttons that retry it and\n * remove it (none while the `<FileUpload>` is disabled). A file leaves the queue for the list once\n * its upload resolves.\n */\nconst FileUploadQueue: TOC<FileUploadQueueSignature> = <template>\n {{#if @upload.state.uploads.length}}\n <ItemGroup\n class=\"jn-file-upload-queue\"\n aria-busy={{if @upload.state.isUploading \"true\"}}\n data-test-jn-part=\"queue\"\n ...attributes\n >\n {{#each @upload.state.uploads as |upload|}}\n <Item\n @variant=\"outline\"\n @size=\"sm\"\n @name={{upload.name}}\n role=\"listitem\"\n class=\"jn-file-upload-file\"\n data-state={{upload.state}}\n as |i|\n >\n <i.Media @variant=\"image\" class=\"jn-file-upload-file-media\">\n {{#let (call @upload.state.previewOf upload.file) as |preview|}}\n {{#if preview}}\n <img src={{preview}} alt=\"\" />\n {{else}}\n <Icon @icon={{fileIcon upload.name upload.file.type}} />\n {{/if}}\n {{/let}}\n </i.Media>\n <i.Content class=\"jn-file-upload-file-content\">\n <i.Title class=\"jn-file-upload-file-title\">\n <span class=\"jn-file-upload-file-name\">{{upload.name}}</span>\n </i.Title>\n <i.Description class=\"jn-file-upload-file-description\">\n {{#if (isError upload.state)}}\n {{upload.error}}\n {{else}}\n {{call @upload.state.kindOf upload.name}}\n ·\n {{call @upload.state.sizeOf upload.file}}\n {{/if}}\n </i.Description>\n </i.Content>\n {{#if (isError upload.state)}}\n {{#unless @upload.state.disabled}}\n <i.Actions>\n <Button\n @variant=\"ghost\"\n @size=\"icon-sm\"\n @name=\"retry\"\n class=\"jn-file-upload-retry\"\n aria-label={{call @upload.labels.retryLabel upload.name}}\n {{on \"click\" (fn @upload.state.retry upload)}}\n >\n <Icon @icon={{RotateCw}} />\n </Button>\n <Button\n @variant=\"ghost\"\n @size=\"icon-sm\"\n @name=\"remove\"\n class=\"jn-file-upload-remove\"\n aria-label={{call @upload.labels.removeLabel upload.name}}\n {{on \"click\" (fn @upload.state.dismiss upload)}}\n >\n <Icon @icon={{X}} />\n </Button>\n </i.Actions>\n {{/unless}}\n {{else}}\n <i.Footer>\n <Progress\n @value={{upload.progress}}\n class=\"jn-file-upload-progress\"\n aria-label={{call @upload.labels.progressLabel upload.name}}\n />\n </i.Footer>\n {{/if}}\n </Item>\n {{/each}}\n </ItemGroup>\n {{/if}}\n</template>\n\nexport default FileUploadQueue\n","// Importing @switchyard-ts/ember wires tracking and test waiters: `settled()` waits for uploads.\nimport '@switchyard-ts/ember'\nimport { invoke, Machine, onEntry, State, transition } from '@switchyard-ts/core'\nimport type { UploadFile } from 'ember-file-upload'\n\nexport class UploadState extends State {\n declare private readonly brand: never\n /** `upload(file, { signal })` is running. */\n static Uploading = UploadState.of('uploading')\n /** It rejected; `retry()` sends it again. */\n static Failed = UploadState.of('failed')\n /** It resolved, and the host has what it resolved to. */\n static Done = UploadState.of('done', { final: true })\n}\n\n/** What an upload reports to. */\nexport interface UploadHost<T> {\n isDisabled(): boolean\n upload(file: UploadFile, options: { signal: AbortSignal }): Promise<T>\n /** The upload resolved with `value`. */\n uploaded(value: T): void\n}\n\n/**\n * One file's upload, as a chart: it uploads, then is done or has failed, and a failed one can\n * be retried. Stopping it aborts the upload's signal, and what the upload settles with after\n * that is dropped.\n */\nexport class UploadActor<T> extends Machine<UploadState> {\n readonly file: UploadFile\n readonly host: UploadHost<T>\n /** What the upload resolved with, kept for `Done`'s entry. */\n result: T | undefined\n /** What the last attempt rejected with. */\n failure: unknown\n\n constructor(file: UploadFile, host: UploadHost<T>) {\n super()\n this.file = file\n this.host = host\n }\n\n get isEnabled(): boolean {\n return !this.host.isDisabled()\n }\n\n @invoke(UploadState.Uploading, { onDone: UploadState.Done, onError: UploadState.Failed })\n upload(signal: AbortSignal): PromiseLike<T> {\n // In a promise, so an upload that throws, or returns a plain value, is handled as `await` did.\n const sent = new Promise<T>(resolve => resolve(this.host.upload(this.file, { signal }))).then(\n value => (this.result = value),\n (error: unknown) => {\n this.failure = error\n throw error\n },\n )\n // Not a Promise, so Switchyard doesn't make it a test waiter: `settled()` doesn't wait for an\n // upload, which a test settles by hand.\n return { then: sent.then.bind(sent) }\n }\n\n @transition({\n from: UploadState.Failed,\n to: UploadState.Uploading,\n guard: (m: UploadActor<unknown>) => m.isEnabled,\n })\n retry() {}\n\n @onEntry(UploadState.Done)\n done() {\n this.host.uploaded(this.result as T)\n }\n}\n","import { isFunction, isNumber, isObject, isString } from '@sindresorhus/is'\nimport { cached, tracked } from '@glimmer/tracking'\nimport { registerDestructor } from '@ember/destroyable'\nimport { Queue, type UploadFile } from 'ember-file-upload'\nimport type FileQueueService from 'ember-file-upload/services/file-queue'\nimport { ControllableState } from '@ember-joinery/primitives/controllable-state'\nimport { acceptsFile, fileKind, formatFileSize } from '../../utils.ts'\nimport { UploadActor, UploadState, type UploadHost } from '../../-private/upload-actor.ts'\n\n/**\n * Uploads a file the user chose, and resolves with what the value keeps for it: an id, a URL,\n * a record. `file` is ember-file-upload's `UploadFile`: `file.upload(url)` sends it and keeps\n * `file.progress` up to date, which the upload queue shows. `signal` aborts when the file leaves\n * the queue before its upload settles (it is replaced, or the component goes): pass it to\n * `fetch` to cancel the request.\n */\nexport type UploadFn<T = unknown> = (\n file: UploadFile,\n options?: { signal: AbortSignal },\n) => Promise<T>\n\n/** Where a file is: kept in the value, uploading, or failed to upload. As upstream's Attachment. */\nexport type FileState = 'done' | 'uploading' | 'error'\n\n/** A file in the value, as the file list shows it. */\nexport interface FileEntry<T> {\n /** What the value holds for it: the `File`, or what `@upload` resolved to. */\n value: T\n /** Its name. */\n name: string\n /** Its kind, from its extension: `PDF`, `PNG`, or `@unknownKindLabel` (`FILE`) without one. */\n kind: string\n /** Its size, formatted (`184.3 kB`), or `undefined` when the value has none. */\n size: string | undefined\n /** A URL of an image of it, or `undefined` when there is none to show. */\n preview: string | undefined\n}\n\n/** A chosen file that is uploading, or whose upload failed: an entry in the upload queue. */\nexport class Upload {\n /** ember-file-upload's file. */\n readonly file: UploadFile\n readonly #actor: UploadActor<unknown>\n readonly #failedLabel: () => string\n\n constructor(file: UploadFile, host: UploadHost<unknown>, failedLabel: () => string) {\n this.file = file\n this.#failedLabel = failedLabel\n this.#actor = new UploadActor(file, host).start()\n }\n\n /** `uploading`, or `error` once its upload has failed. */\n get state(): 'uploading' | 'error' {\n return this.#actor.matches(UploadState.Failed) ? 'error' : 'uploading'\n }\n\n /** Why its upload failed. */\n get error(): string | undefined {\n if (this.state !== 'error') return undefined\n const error = this.#actor.failure\n if (error instanceof Error && error.message) return error.message\n return isString(error) && error ? error : this.#failedLabel()\n }\n\n /** Whether `retry()` would send it again: it failed, and the component isn't disabled. */\n get canRetry(): boolean {\n return Boolean(this.#actor.can.retry)\n }\n\n retry(): void {\n this.#actor.retry()\n }\n\n /** Stops it: a running upload's signal aborts, and what it settles with is dropped. */\n stop(): void {\n this.#actor.stop()\n }\n\n /** Its name. */\n get name(): string {\n return this.file.name\n }\n\n /** How much of it has uploaded, from 0 to 100: ember-file-upload's `progress`. */\n get progress(): number {\n return this.file.progress\n }\n}\n\n/** What the state reads from the component's arguments, each read live. */\nexport interface FileUploadStateOptions<T> {\n multiple: () => boolean | undefined\n accept: () => string | undefined\n disabled: () => boolean | undefined\n value: () => readonly T[] | undefined\n defaultValue: () => readonly T[] | undefined\n onValueChange: () => ((value: T[]) => void) | undefined\n upload: () => UploadFn<T> | undefined\n queue: () => Queue | undefined\n nameOf: () => ((value: T) => string) | undefined\n sizeOf: () => ((value: T) => number | undefined) | undefined\n previewOf: () => ((value: T) => string | undefined) | undefined\n uploadFailedLabel: () => string\n unknownKindLabel: () => string | undefined\n locale: () => string | undefined\n}\n\n/**\n * Where a row lost the button that had focus (it was removed, or a retry took its buttons away),\n * so focus can move to the nearest button of the same kind once that has rendered.\n */\nexport interface FocusRequest {\n /** The list it happened in. */\n list: 'list' | 'queue'\n /** The row's index: the row that took its place, or the row itself. */\n index: number\n /** The kind of button that had focus. */\n button: 'remove' | 'retry'\n}\n\nlet nextQueue = 0\n\nfunction isImage(value: unknown): value is Blob {\n return value instanceof Blob && value.type.startsWith('image/')\n}\n\n/** A value's name when the caller gives no `@nameOf`: a file's, or a record's `name` or `label`. */\nfunction defaultName(value: unknown): string {\n if (value instanceof File) return value.name\n if (isObject(value) && !isFunction(value)) {\n const { name, label } = value as { name?: unknown; label?: unknown }\n if (isString(name)) return name\n if (isString(label)) return label\n }\n return String(value)\n}\n\n/** A value's size in bytes when the caller gives no `@sizeOf`: its `size`, if it is a number. */\nfunction defaultSize(value: unknown): number | undefined {\n const size = (value as { size?: unknown } | null | undefined)?.size\n return isNumber(size) ? size : undefined\n}\n\n/**\n * The state of a `<FileUpload>`: the files its value holds, the uploads in its queue, and what\n * its last drop turned away. Its parts read it, and act through it.\n */\nexport class FileUploadState<T> {\n readonly #options: FileUploadStateOptions<T>\n /** The value: what the list shows. */\n readonly value: ControllableState<readonly T[]>\n /** The queue ember-file-upload puts the chosen files in, unless the caller gave one. */\n readonly #ownQueue: Queue\n /** Previews made for image files, each an object URL, revoked when the component goes. */\n readonly #previews = new Map<Blob, string>()\n\n /** The uploads in flight or failed, in the order the files were chosen. */\n @tracked uploads: readonly Upload[] = []\n /** The names of the files the last choice or drop turned away, as `@accept` doesn't take them. */\n @tracked rejected: readonly string[] = []\n /** The names of the files the last choice or drop left out, without `@multiple`: all but one. */\n @tracked leftOut: readonly string[] = []\n /** Where focus goes once a removal or a retry has rendered. */\n @tracked focusRequest: FocusRequest | undefined\n /** What `filter` has turned away from the choice or drop being taken, for its message. */\n #unaccepted: string[] = []\n #extra: string[] = []\n #destroyed = false\n\n constructor(owner: object, options: FileUploadStateOptions<T>) {\n this.#options = options\n this.value = new ControllableState<readonly T[]>({\n name: 'value',\n value: options.value,\n defaultValue: options.defaultValue,\n onChange: options.onValueChange as () => ((value: readonly T[]) => void) | undefined,\n fallback: [],\n })\n // The queue isn't the app's `file-queue` service's, so the component needs no service and a\n // test's files never meet another's. Pass `@queue` to use one of the service's.\n this.#ownQueue = new Queue({\n name: `joinery-file-upload-${nextQueue++}`,\n fileQueue: undefined as unknown as FileQueueService,\n })\n registerDestructor(owner, () => {\n this.#destroyed = true\n for (const url of this.#previews.values()) URL.revokeObjectURL(url)\n this.#previews.clear()\n // Its uploads stop and leave whichever queue they are in, `@queue` included.\n for (const entry of this.uploads) {\n entry.stop()\n entry.file.queue?.remove(entry.file)\n }\n for (const file of this.#ownQueue.files) this.#ownQueue.remove(file)\n })\n }\n\n /** The ember-file-upload queue the chosen files go into: `@queue`, or the component's own. */\n get queue(): Queue {\n return this.#options.queue() ?? this.#ownQueue\n }\n\n /** Whether it takes more than one file. */\n get multiple(): boolean {\n return Boolean(this.#options.multiple())\n }\n\n /** Which files it takes (`@accept`). */\n get accept(): string | undefined {\n return this.#options.accept()\n }\n\n /** Whether it takes no files and removes none. */\n get disabled(): boolean {\n return Boolean(this.#options.disabled())\n }\n\n /** Whether any upload is still running. */\n get isUploading(): boolean {\n return this.uploads.some(upload => upload.state === 'uploading')\n }\n\n /**\n * The value's files, as the list shows them. Cached, so they are the same objects until the\n * value (or how it is named, sized or previewed) changes; the list keys its rows on `value`, so\n * a row, and the focus on its button, stays put when another file comes or goes.\n */\n @cached\n get files(): FileEntry<T>[] {\n const nameOf = this.#options.nameOf() ?? defaultName\n const sizeOf = this.#options.sizeOf() ?? defaultSize\n const previewOf = this.#options.previewOf() ?? ((value: T) => this.#preview(value))\n const locale = this.#options.locale()\n return this.value.value.map(value => {\n const name = nameOf(value)\n const bytes = sizeOf(value)\n return {\n value,\n name,\n kind: this.kindOf(name),\n size: bytes === undefined ? undefined : formatFileSize(bytes, locale),\n preview: previewOf(value),\n }\n })\n }\n\n /** A file's kind, from its name: `PDF`, or `@unknownKindLabel` (`FILE`) without an extension. */\n kindOf = (name: string): string => fileKind(name, this.#options.unknownKindLabel())\n\n /** The values the list holds, as `@value` hands them over. */\n get values(): readonly T[] {\n return this.value.value\n }\n\n /** A file's size, formatted in the component's locale. */\n sizeOf = (file: UploadFile | File): string => formatFileSize(file.size, this.#options.locale())\n\n /** A preview of a file being uploaded: an object URL for an image, else `undefined`. */\n previewOf = (file: UploadFile): string | undefined => this.#preview(file.file)\n\n /** An object URL showing an image file, made once per file. */\n #preview(value: unknown): string | undefined {\n if (!isImage(value) || this.#destroyed) return undefined\n let url = this.#previews.get(value)\n if (!url) {\n url = URL.createObjectURL(value)\n this.#previews.set(value, url)\n }\n return url\n }\n\n /**\n * Revokes the previews of the files that are neither in the value nor in the queue. It runs\n * after each change, so in controlled mode a removal the caller refuses keeps its preview: the\n * value still holds the file.\n */\n #sweep(): void {\n if (!this.#previews.size) return\n const kept = new Set<unknown>(this.value.value)\n for (const entry of this.uploads) kept.add(entry.file.file)\n for (const [blob, url] of this.#previews) {\n if (kept.has(blob)) continue\n URL.revokeObjectURL(url)\n this.#previews.delete(blob)\n }\n }\n\n /**\n * What the picker and the drop zone may take: ember-file-upload's `filter`. It notes what it\n * turns away, which `onSelect` and `onDrop` then name.\n */\n filter = (file: File, _files: File[], index: number): boolean => {\n if (this.disabled) return false\n if (!this.multiple && index > 0) {\n this.#extra.push(file.name)\n return false\n }\n if (acceptsFile(file, this.accept)) return true\n this.#unaccepted.push(file.name)\n return false\n }\n\n /**\n * Files dropped on the zone: those that passed `filter`, and the whole drop. Without\n * `@multiple`, ember-file-upload's zone offers `filter` only the first file, so the rest are\n * named as left out here.\n */\n onDrop = (files: UploadFile[], transfer: { files: File[] }): void => {\n if (!this.multiple && !this.disabled) {\n this.#extra.push(...transfer.files.slice(1).map(file => file.name))\n }\n this.#report()\n this.take(files)\n }\n\n /**\n * Files chosen in the file picker. Its `accept` filters what the dialog shows, but a choice of\n * \"All files\" there lets anything through, so `filter` checks them again and they are named as\n * a drop's are.\n */\n onSelect = (files: UploadFile[]): void => {\n this.#report()\n this.take(files)\n }\n\n /** Names what `filter` turned away from the choice or drop just taken, and starts afresh. */\n #report(): void {\n this.rejected = this.#unaccepted\n this.leftOut = this.#extra\n this.#unaccepted = []\n this.#extra = []\n }\n\n /**\n * Keeps the files, or, with `@upload`, queues them and uploads each. Without `@multiple`, a new\n * file replaces the one uploading or failed: that one leaves ember-file-upload's queue, and\n * whatever its upload resolves to is dropped.\n */\n take(files: UploadFile[]): void {\n if (!files.length) return\n const upload = this.#options.upload()\n if (!upload) {\n for (const file of files) file.queue?.remove(file)\n this.#store(files.map(file => file.file as T))\n return\n }\n const fresh = files.map(file => this.#upload(file, upload))\n if (this.multiple) this.uploads = [...this.uploads, ...fresh]\n else {\n for (const old of this.uploads) {\n old.stop()\n old.file.queue?.remove(old.file)\n }\n this.uploads = fresh\n this.#sweep()\n }\n }\n\n /** An upload of `file`, which `upload` sends (a retry sends it with the current `@upload`). */\n #upload(file: UploadFile, upload: UploadFn<T>): Upload {\n const host: UploadHost<unknown> = {\n isDisabled: () => this.disabled,\n upload: (file, options) => (this.#options.upload() ?? upload)(file, options),\n // An upload settles a microtask after it starts at the soonest, so `entry` is set by then.\n uploaded: value => {\n this.uploads = this.uploads.filter(other => other !== entry)\n file.queue?.remove(file)\n this.#store([value as T])\n },\n }\n const entry = new Upload(file, host, this.#options.uploadFailedLabel)\n return entry\n }\n\n #store(values: T[]): void {\n if (this.multiple) this.value.set(current => [...current, ...values])\n else this.value.set(values.slice(-1))\n this.#sweep()\n }\n\n /** Takes a file out of the value. Focus moves to the row that takes its place. */\n remove = (value: T): void => {\n if (this.disabled) return\n const index = this.value.value.indexOf(value)\n if (index === -1) return\n this.value.set(current => current.filter(other => other !== value))\n this.#sweep()\n this.focusRequest = { list: 'list', index, button: 'remove' }\n }\n\n /** Empties the value. */\n clear = (): void => {\n if (this.disabled) return\n this.value.set([])\n this.#sweep()\n }\n\n /**\n * Uploads a failed file again. Its row loses its buttons while it uploads, so focus moves to\n * the nearest row's Retry (or remove) button, else to the file input.\n */\n retry = (entry: Upload): void => {\n const index = this.uploads.indexOf(entry)\n if (!this.#options.upload() || index === -1 || !entry.canRetry) return\n entry.retry()\n this.focusRequest = { list: 'queue', index, button: 'retry' }\n }\n\n /** Takes a file out of the upload queue, uploading or failed; its result, if any, is dropped. */\n dismiss = (entry: Upload): void => {\n if (this.disabled) return\n const index = this.uploads.indexOf(entry)\n if (index === -1) return\n this.uploads = this.uploads.filter(other => other !== entry)\n entry.stop()\n entry.file.queue?.remove(entry.file)\n this.#sweep()\n this.focusRequest = { list: 'queue', index, button: 'remove' }\n }\n}\n","import Component from '@glimmer/component'\nimport { hash } from '@ember/helper'\nimport type Owner from '@ember/owner'\nimport type { WithBoundArgs } from '@glint/template'\nimport type { Queue } from 'ember-file-upload'\nimport { modifier } from 'ember-modifier'\nimport FileUploadDropzone from './dropzone.gts'\nimport FileUploadList from './list.gts'\nimport FileUploadQueue from './queue.gts'\nimport type { FileUploadLabels } from './labels.ts'\nimport {\n FileUploadState,\n type FileEntry,\n type FileState,\n type FocusRequest,\n type Upload,\n type UploadFn,\n} from './state.ts'\nimport type { FileUploadContext } from './context.ts'\nimport { translate, translator } from '@ember-joinery/primitives/i18n'\nimport { messages } from '../../messages.ts'\n\nexport type { FileEntry, FileState, FileUploadLabels, Upload, UploadFn }\nexport type { FileUploadDropzoneSignature, FileUploadDropzoneState } from './dropzone.gts'\nexport type { FileUploadListSignature } from './list.gts'\nexport type { FileUploadQueueSignature } from './queue.gts'\n\n/** What `<FileUpload>` yields: its parts, its files and uploads, and what it can do with them. */\nexport interface FileUploadYield<T> {\n /** The zone to drop files on, or to press to choose them. */\n Dropzone: WithBoundArgs<typeof FileUploadDropzone, 'upload'>\n /** The files the value holds, one Item each, with a remove button. */\n List: WithBoundArgs<typeof FileUploadList, 'upload'>\n /** The files uploading or failed, one Item each, with a Progress bar. */\n Queue: WithBoundArgs<typeof FileUploadQueue, 'upload'>\n /** The files the value holds, as the list shows them. */\n files: FileEntry<T>[]\n /** The uploads in the queue: each has `name`, `progress`, `state` and `error`. */\n uploads: readonly Upload[]\n /** Whether any upload is running. */\n isUploading: boolean\n /** Takes a value out of the list. */\n remove: (value: T) => void\n /** Empties the list. */\n clear: () => void\n /** Uploads a failed file again. */\n retry: (upload: Upload) => void\n /** ember-file-upload's queue the chosen files go into. */\n queue: Queue\n}\n\nexport interface FileUploadSignature<T = File> {\n Args: {\n /** Whether it takes more than one file. Without it, a new choice replaces the file. */\n multiple?: boolean\n /** Which files to take, as `<input accept>` reads it: `.pdf`, `image/*`, `text/csv`… */\n accept?: string\n /** Whether it takes no files and removes none. */\n disabled?: boolean\n /** The files (or, with `@upload`, what each upload resolved to), when the caller controls them. */\n value?: readonly T[]\n /** The files it starts with, uncontrolled. */\n defaultValue?: readonly T[]\n /** Called with the new list whenever a file is added or removed. */\n onValueChange?: (value: T[]) => void\n /**\n * Uploads each chosen file as it is chosen, and resolves with what the value keeps for it.\n * Until it settles, the file is in the upload queue. Without it, the value keeps each `File`.\n */\n upload?: UploadFn<T>\n /** An ember-file-upload queue to put the files in, such as one of its `file-queue` service's. */\n queue?: Queue\n /** A value's name in the list. Default: a file's name, or a record's `name` or `label`. */\n nameOf?: (value: T) => string\n /** A value's size in bytes. Default: its `size`. */\n sizeOf?: (value: T) => number | undefined\n /** A URL of an image of a value. Default: an image file's own contents. */\n previewOf?: (value: T) => string | undefined\n /** The locale sizes are written in (`Intl`). Default: the app's translator's, or the browser's. */\n locale?: string\n /** The file input's `id`, so a `<label for>` (a FieldLabel) names it. */\n id?: string\n /** The file input's `aria-label`, in place of the zone's text. */\n label?: string\n /** Whether a file is required. */\n required?: boolean\n /** Whether the value is invalid: `aria-invalid` on the input, and a destructive border. */\n invalid?: boolean\n /** The ids of what describes the input (`aria-describedby`), such as a FieldDescription. */\n describedBy?: string\n /** The zone's call to action. Default `Choose a file`, or `Choose files` with `@multiple`. */\n prompt?: string\n /** What follows it. Default `or drag and drop here`. */\n hint?: string\n /** What the zone says while files are dragged over it. Default `Drop to add`. */\n dropLabel?: string\n /** A line under the hint, such as `PDF, up to 5 MB`. Default: `@accept`. */\n description?: string\n /**\n * Names the files a choice or drop turned away, as `@accept` doesn't take them. Default\n * `Not an accepted type: a.exe, b.exe`.\n */\n rejectedLabel?: (names: string[]) => string\n /**\n * Names the files a drop of several left out, without `@multiple`. Default\n * `One file at a time; left out: b.pdf, c.pdf`.\n */\n leftOutLabel?: (names: string[]) => string\n /** Names a file's remove button. Default `Remove cv.pdf`. */\n removeLabel?: (name: string) => string\n /** Names a failed upload's retry button. Default `Retry cv.pdf`. */\n retryLabel?: (name: string) => string\n /** Names a file's progress bar while it uploads. Default `Uploading cv.pdf`. */\n progressLabel?: (name: string) => string\n /** The error an upload shows when it fails without a message. Default `Upload failed`. */\n uploadFailedLabel?: string\n /** The kind shown for a file whose name has no extension (`README`). Default `FILE`. */\n unknownKindLabel?: string\n /** Its name, for `FileUploadHarness` (`data-test-jn-name`). */\n name?: string\n }\n Blocks: {\n /** Its parts, laid out as you like. Without a block: the zone, the list, then the queue. */\n default: [FileUploadYield<T>]\n }\n Element: HTMLDivElement\n}\n\nconst handled = new WeakSet<FocusRequest>()\n\n/**\n * Once a removal or a retry has rendered, moves focus from the button that went to the nearest\n * one left: in the row now at that index (the one that took a removed row's place, or the\n * retried row, if it still has a button), then the rows after it, then those before it,\n * preferring a button of the same kind (remove, or Retry) in each. Failing that, any remove\n * button, then the file input. It moves focus only when it was lost with the button, so it\n * never takes focus from somewhere else.\n */\nconst focusAfterChange = modifier((element: HTMLElement, [request]: [FocusRequest | undefined]) => {\n if (!request || handled.has(request)) return\n handled.add(request)\n const active = element.ownerDocument.activeElement\n if (active && active !== element.ownerDocument.body && active.isConnected) return\n const list = element.querySelector(`.jn-file-upload-${request.list}`)\n const rows = list ? [...list.querySelectorAll(':scope > .jn-file-upload-file')] : []\n const nearest = [...rows.slice(request.index), ...rows.slice(0, request.index).reverse()]\n const target =\n nearest\n .map(\n row =>\n row.querySelector<HTMLElement>(`.jn-file-upload-${request.button}`) ??\n row.querySelector<HTMLElement>('button'),\n )\n .find(Boolean) ??\n element.querySelector<HTMLElement>('.jn-file-upload-remove') ??\n element.querySelector<HTMLElement>('.jn-file-upload-input')\n target?.focus()\n})\n\n/**\n * File uploads in shadcn's look, on ember-file-upload: a drop zone around a native file input, the\n * list of chosen files (an Item each, with a preview, the name and size, and a remove button), and,\n * with `@upload`, a queue of the files uploading, each with a Progress bar.\n *\n * <FileUpload @multiple={{true}} @accept=\"image/*,.pdf\" @onValueChange={{this.setFiles}} />\n *\n * <FileUpload @upload={{this.upload}} as |u|>\n * <u.Dropzone />\n * <u.List />\n * <u.Queue />\n * </FileUpload>\n *\n * The value is always a list: of `File`s, or, with `@upload`, of what each upload resolved to.\n * Without `@multiple` it holds one at most, and a new choice replaces it.\n */\nexport default class FileUpload<T = File> extends Component<FileUploadSignature<T>> {\n readonly state: FileUploadState<T>\n\n constructor(owner: Owner, args: FileUploadSignature<T>['Args']) {\n super(owner, args)\n this.state = new FileUploadState<T>(this, {\n multiple: () => this.args.multiple,\n accept: () => this.args.accept,\n disabled: () => this.args.disabled,\n value: () => this.args.value,\n defaultValue: () => this.args.defaultValue,\n onValueChange: () => this.args.onValueChange,\n upload: () => this.args.upload,\n queue: () => this.args.queue,\n nameOf: () => this.args.nameOf,\n sizeOf: () => this.args.sizeOf,\n previewOf: () => this.args.previewOf,\n uploadFailedLabel: () =>\n this.args.uploadFailedLabel ?? translate(this, messages.uploadFailed),\n unknownKindLabel: () => this.args.unknownKindLabel ?? translate(this, messages.unknownKind),\n locale: () => this.args.locale ?? translator(this)?.locale,\n })\n }\n\n get labels(): FileUploadLabels {\n const multiple = this.state.multiple\n return {\n prompt:\n this.args.prompt ?? translate(this, multiple ? messages.promptMultiple : messages.prompt),\n hint: this.args.hint ?? translate(this, messages.hint),\n dropLabel: this.args.dropLabel ?? translate(this, messages.dropLabel),\n description: this.args.description,\n rejectedLabel:\n this.args.rejectedLabel ??\n (names => translate(this, messages.rejected, { names: names.join(', ') })),\n leftOutLabel:\n this.args.leftOutLabel ??\n (names => translate(this, messages.leftOut, { names: names.join(', ') })),\n removeLabel: this.args.removeLabel ?? (name => translate(this, messages.remove, { name })),\n retryLabel: this.args.retryLabel ?? (name => translate(this, messages.retry, { name })),\n progressLabel:\n this.args.progressLabel ?? (name => translate(this, messages.progress, { name })),\n }\n }\n\n /** What the parts read: the state, the strings, and the input's arguments. */\n get context(): FileUploadContext {\n const { state } = this\n return {\n state,\n labels: this.labels,\n inputId: this.args.id,\n label: this.args.label,\n invalid: this.args.invalid,\n describedBy: this.args.describedBy,\n required: this.args.required,\n }\n }\n\n <template>\n {{#let\n (hash\n Dropzone=(component FileUploadDropzone upload=this.context)\n List=(component FileUploadList upload=this.context)\n Queue=(component FileUploadQueue upload=this.context)\n files=this.state.files\n uploads=this.state.uploads\n isUploading=this.state.isUploading\n remove=this.state.remove\n clear=this.state.clear\n retry=this.state.retry\n queue=this.state.queue\n )\n as |u|\n }}\n <div\n class=\"jn-file-upload\"\n data-slot=\"file-upload\"\n data-multiple={{if this.state.multiple \"\"}}\n data-disabled={{if this.state.disabled \"\"}}\n data-uploading={{if this.state.isUploading \"\"}}\n data-test-jn=\"file-upload\"\n data-test-jn-name={{@name}}\n {{focusAfterChange this.state.focusRequest}}\n ...attributes\n >\n {{#if (has-block)}}\n {{yield u}}\n {{else}}\n <u.Dropzone />\n <u.List />\n <u.Queue />\n {{/if}}\n </div>\n {{/let}}\n </template>\n}\n"],"names":["FileUploadDropzone","Component","g","prototype","tracked","i","state","args","upload","labels","rejected","names","length","rejectedLabel","undefined","leftOut","leftOutLabel","showsHint","disabled","description","accept","enter","isDragging","leave","drop","files","transfer","onDrop","setComponentTemplate","precompileTemplate","strictMode","scope","FileDropzone","hash","Icon","UploadIcon","ARCHIVES","Set","SHEETS","TEXTS","IMAGES","VIDEOS","AUDIO","fileIcon","name","type","extension","includes","split","pop","toLowerCase","startsWith","has","FileImage","FileVideo","FileAudio","FileArchive","FileSpreadsheet","FileText","FileIcon","call","fn","arg","FileUploadList","ItemGroup","Item","Button","on","X","templateOnly","isError","FileUploadQueue","RotateCw","Progress","UploadState","State","Uploading","of","Failed","Done","final","UploadActor","Machine","file","host","result","failure","constructor","isEnabled","isDisabled","signal","sent","Promise","resolve","then","value","error","bind","n","invoke","onDone","onError","retry","transition","from","to","guard","m","done","uploaded","onEntry","Upload","failedLabel","start","matches","Error","message","isString","canRetry","Boolean","can","stop","progress","nextQueue","isImage","Blob","defaultName","File","isObject","isFunction","label","String","defaultSize","size","isNumber","FileUploadState","Map","owner","options","ControllableState","defaultValue","onChange","onValueChange","fallback","Queue","fileQueue","registerDestructor","url","values","URL","revokeObjectURL","clear","entry","uploads","queue","remove","multiple","isUploading","some","nameOf","sizeOf","previewOf","locale","map","bytes","kind","kindOf","formatFileSize","preview","cached","fileKind","unknownKindLabel","#preview","get","createObjectURL","set","#sweep","kept","add","blob","delete","filter","_files","index","push","acceptsFile","slice","take","onSelect","#report","fresh","old","#upload","other","uploadFailedLabel","#store","current","indexOf","focusRequest","list","button","dismiss","handled","WeakSet","focusAfterChange","modifier","element","request","active","ownerDocument","activeElement","body","isConnected","querySelector","rows","querySelectorAll","nearest","reverse","target","row","find","focus","FileUpload","translate","messages","uploadFailed","unknownKind","translator","prompt","promptMultiple","hint","dropLabel","join","removeLabel","retryLabel","progressLabel","context","inputId","id","invalid","describedBy","required"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA;;;;;;;AAOe,MAAMA,kBAAA,SAA2BC,SAAA,CAAU;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CACvDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAqB,KAAA;AAAA,IAAA,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AAA,OAAA,EAAS,IAAI,CAACtO,IAAI,CAACuO,EAAE;AACrB5G,MAAAA,KAAA,EAAO,IAAI,CAAC3H,IAAI,CAAC2H,KAAK;AACtB6G,MAAAA,OAAA,EAAS,IAAI,CAACxO,IAAI,CAACwO,OAAO;AAC1BC,MAAAA,WAAA,EAAa,IAAI,CAACzO,IAAI,CAACyO,WAAW;AAClCC,MAAAA,QAAA,EAAU,IAAI,CAAC1O,IAAI,CAAC0O;KACtB;AACF,EAAA;AAEA,EAAA;IAAArN,oBAAA,CAAAC,kBAAA,CAAA,q0BAAA,EAoCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAE,IAAA;QAAAjC,kBAAA;QAAA+D,cAAA;QAAAQ,eAAA;AAAAqI,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/messages.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every string `@ember-joinery/file-upload` shows or announces itself, in English, for a
|
|
3
|
+
* translation catalog. An argument (`@prompt`, `@removeLabel`) still beats each one.
|
|
4
|
+
*/
|
|
5
|
+
const messages = {
|
|
6
|
+
promptMultiple: {
|
|
7
|
+
id: 'joinery.file-upload.promptMultiple',
|
|
8
|
+
message: 'Choose files'
|
|
9
|
+
},
|
|
10
|
+
prompt: {
|
|
11
|
+
id: 'joinery.file-upload.prompt',
|
|
12
|
+
message: 'Choose a file'
|
|
13
|
+
},
|
|
14
|
+
hint: {
|
|
15
|
+
id: 'joinery.file-upload.hint',
|
|
16
|
+
message: 'or drag and drop here',
|
|
17
|
+
description: 'Follows the prompt, "Choose files", where the browser can drag and drop.'
|
|
18
|
+
},
|
|
19
|
+
dropLabel: {
|
|
20
|
+
id: 'joinery.file-upload.dropLabel',
|
|
21
|
+
message: 'Drop to add'
|
|
22
|
+
},
|
|
23
|
+
rejected: {
|
|
24
|
+
id: 'joinery.file-upload.rejected',
|
|
25
|
+
message: 'Not an accepted type: {names}',
|
|
26
|
+
description: '{names} is the files turned away, joined with commas.'
|
|
27
|
+
},
|
|
28
|
+
leftOut: {
|
|
29
|
+
id: 'joinery.file-upload.leftOut',
|
|
30
|
+
message: 'One file at a time; left out: {names}',
|
|
31
|
+
description: '{names} is the files left out, joined with commas.'
|
|
32
|
+
},
|
|
33
|
+
remove: {
|
|
34
|
+
id: 'joinery.file-upload.remove',
|
|
35
|
+
message: 'Remove {name}'
|
|
36
|
+
},
|
|
37
|
+
retry: {
|
|
38
|
+
id: 'joinery.file-upload.retry',
|
|
39
|
+
message: 'Retry {name}'
|
|
40
|
+
},
|
|
41
|
+
progress: {
|
|
42
|
+
id: 'joinery.file-upload.progress',
|
|
43
|
+
message: 'Uploading {name}'
|
|
44
|
+
},
|
|
45
|
+
uploadFailed: {
|
|
46
|
+
id: 'joinery.file-upload.uploadFailed',
|
|
47
|
+
message: 'Upload failed'
|
|
48
|
+
},
|
|
49
|
+
unknownKind: {
|
|
50
|
+
id: 'joinery.file-upload.unknownKind',
|
|
51
|
+
message: 'FILE',
|
|
52
|
+
description: "A file's kind when its name has no extension (otherwise PDF, PNG and so on)."
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { messages };
|
|
57
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sources":["../src/messages.ts"],"sourcesContent":["import type { Message } from '@ember-joinery/primitives/i18n'\n\n/**\n * Every string `@ember-joinery/file-upload` shows or announces itself, in English, for a\n * translation catalog. An argument (`@prompt`, `@removeLabel`) still beats each one.\n */\nexport const messages = {\n promptMultiple: { id: 'joinery.file-upload.promptMultiple', message: 'Choose files' },\n prompt: { id: 'joinery.file-upload.prompt', message: 'Choose a file' },\n hint: {\n id: 'joinery.file-upload.hint',\n message: 'or drag and drop here',\n description: 'Follows the prompt, \"Choose files\", where the browser can drag and drop.',\n },\n dropLabel: { id: 'joinery.file-upload.dropLabel', message: 'Drop to add' },\n rejected: {\n id: 'joinery.file-upload.rejected',\n message: 'Not an accepted type: {names}',\n description: '{names} is the files turned away, joined with commas.',\n },\n leftOut: {\n id: 'joinery.file-upload.leftOut',\n message: 'One file at a time; left out: {names}',\n description: '{names} is the files left out, joined with commas.',\n },\n remove: { id: 'joinery.file-upload.remove', message: 'Remove {name}' },\n retry: { id: 'joinery.file-upload.retry', message: 'Retry {name}' },\n progress: { id: 'joinery.file-upload.progress', message: 'Uploading {name}' },\n uploadFailed: { id: 'joinery.file-upload.uploadFailed', message: 'Upload failed' },\n unknownKind: {\n id: 'joinery.file-upload.unknownKind',\n message: 'FILE',\n description: \"A file's kind when its name has no extension (otherwise PDF, PNG and so on).\",\n },\n} satisfies Record<string, Message>\n"],"names":["messages","promptMultiple","id","message","prompt","hint","description","dropLabel","rejected","leftOut","remove","retry","progress","uploadFailed","unknownKind"],"mappings":"AAEA;AACA;AACA;AACA;AACO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,cAAc,EAAE;AAAEC,IAAAA,EAAE,EAAE,oCAAoC;AAAEC,IAAAA,OAAO,EAAE;GAAgB;AACrFC,EAAAA,MAAM,EAAE;AAAEF,IAAAA,EAAE,EAAE,4BAA4B;AAAEC,IAAAA,OAAO,EAAE;GAAiB;AACtEE,EAAAA,IAAI,EAAE;AACJH,IAAAA,EAAE,EAAE,0BAA0B;AAC9BC,IAAAA,OAAO,EAAE,uBAAuB;AAChCG,IAAAA,WAAW,EAAE;GACd;AACDC,EAAAA,SAAS,EAAE;AAAEL,IAAAA,EAAE,EAAE,+BAA+B;AAAEC,IAAAA,OAAO,EAAE;GAAe;AAC1EK,EAAAA,QAAQ,EAAE;AACRN,IAAAA,EAAE,EAAE,8BAA8B;AAClCC,IAAAA,OAAO,EAAE,+BAA+B;AACxCG,IAAAA,WAAW,EAAE;GACd;AACDG,EAAAA,OAAO,EAAE;AACPP,IAAAA,EAAE,EAAE,6BAA6B;AACjCC,IAAAA,OAAO,EAAE,uCAAuC;AAChDG,IAAAA,WAAW,EAAE;GACd;AACDI,EAAAA,MAAM,EAAE;AAAER,IAAAA,EAAE,EAAE,4BAA4B;AAAEC,IAAAA,OAAO,EAAE;GAAiB;AACtEQ,EAAAA,KAAK,EAAE;AAAET,IAAAA,EAAE,EAAE,2BAA2B;AAAEC,IAAAA,OAAO,EAAE;GAAgB;AACnES,EAAAA,QAAQ,EAAE;AAAEV,IAAAA,EAAE,EAAE,8BAA8B;AAAEC,IAAAA,OAAO,EAAE;GAAoB;AAC7EU,EAAAA,YAAY,EAAE;AAAEX,IAAAA,EAAE,EAAE,kCAAkC;AAAEC,IAAAA,OAAO,EAAE;GAAiB;AAClFW,EAAAA,WAAW,EAAE;AACXZ,IAAAA,EAAE,EAAE,iCAAiC;AACrCC,IAAAA,OAAO,EAAE,MAAM;AACfG,IAAAA,WAAW,EAAE;AACf;AACF;;"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { triggerEvent, settled, waitUntil } from '@ember/test-helpers';
|
|
2
|
+
import { Harness, ItemHarness, ButtonHarness, ProgressHarness } from '@ember-joinery/test-support';
|
|
3
|
+
|
|
4
|
+
const collapse = value => (value ?? '').replace(/\s+/g, ' ').trim();
|
|
5
|
+
|
|
6
|
+
/** A drag's data, as the desktop sends it: the files, typed `Files`. */
|
|
7
|
+
function transferOf(files) {
|
|
8
|
+
const transfer = new DataTransfer();
|
|
9
|
+
for (const file of files) transfer.items.add(file);
|
|
10
|
+
return transfer;
|
|
11
|
+
}
|
|
12
|
+
function dispatch(target, type, files) {
|
|
13
|
+
target.dispatchEvent(new DragEvent(type, {
|
|
14
|
+
bubbles: true,
|
|
15
|
+
cancelable: true,
|
|
16
|
+
dataTransfer: transferOf(files)
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Drives one row of a `<FileUpload>`'s file list or upload queue: a shadcn Item, so everything
|
|
22
|
+
* `ItemHarness` reads it reads too. Find one by its file's name:
|
|
23
|
+
*
|
|
24
|
+
* const cv = upload.file('cv.pdf')
|
|
25
|
+
* assert.strictEqual(cv.details, 'PDF · 184.3 kB')
|
|
26
|
+
* await cv.remove()
|
|
27
|
+
*/
|
|
28
|
+
class FileUploadItemHarness extends ItemHarness {
|
|
29
|
+
/** The file's name. */
|
|
30
|
+
get fileName() {
|
|
31
|
+
return this.title;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** `done` (in the list), `uploading` or `error` (in the queue): its `data-state`. */
|
|
35
|
+
get state() {
|
|
36
|
+
return this.element.getAttribute('data-state');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** What it says under the name: its kind and size (`PDF · 184.3 kB`), or a failed upload's error. */
|
|
40
|
+
get details() {
|
|
41
|
+
return this.description;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The preview's image URL, or `null` when it shows an icon for its kind. */
|
|
45
|
+
get preview() {
|
|
46
|
+
return this.queryPart('media')?.querySelector('img')?.getAttribute('src') ?? null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Whether it shows a preview of the image rather than an icon. */
|
|
50
|
+
get hasPreview() {
|
|
51
|
+
return this.preview !== null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Whether it has a remove button: a disabled `<FileUpload>` shows none. */
|
|
55
|
+
get canRemove() {
|
|
56
|
+
return this.find(ButtonHarness, 'remove').exists;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Its remove button. */
|
|
60
|
+
get removeButton() {
|
|
61
|
+
return this.find(ButtonHarness, 'remove');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A failed upload's retry button. */
|
|
65
|
+
get retryButton() {
|
|
66
|
+
return this.find(ButtonHarness, 'retry');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** While it uploads, its progress bar (a `ProgressHarness`). */
|
|
70
|
+
get progressBar() {
|
|
71
|
+
return this.find(ProgressHarness);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** While it uploads, how much has gone, from 0 to 100. `null` once it isn't uploading. */
|
|
75
|
+
get progress() {
|
|
76
|
+
const bar = this.progressBar;
|
|
77
|
+
return bar.exists ? bar.value : null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Presses its remove button. */
|
|
81
|
+
async remove() {
|
|
82
|
+
await this.removeButton.click();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Presses a failed upload's retry button. */
|
|
86
|
+
async retry() {
|
|
87
|
+
await this.retryButton.click();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Drives a `<FileUpload>` from `@ember-joinery/file-upload`: chooses files as the file picker
|
|
93
|
+
* does, drags and drops them on its zone, and reads and removes what its list and upload queue
|
|
94
|
+
* show.
|
|
95
|
+
*
|
|
96
|
+
* const resume = new FileUploadHarness('resume') // <FileUpload @name="resume">
|
|
97
|
+
* await resume.select(new File(['%PDF'], 'cv.pdf', { type: 'application/pdf' }))
|
|
98
|
+
* assert.deepEqual(resume.files, ['cv.pdf'])
|
|
99
|
+
* await resume.remove('cv.pdf')
|
|
100
|
+
*
|
|
101
|
+
* `select` and `drop` don't wait for `@upload`; `waitForUploads()` does.
|
|
102
|
+
*/
|
|
103
|
+
class FileUploadHarness extends Harness {
|
|
104
|
+
static component = 'file-upload';
|
|
105
|
+
|
|
106
|
+
/** The zone files are dropped on. */
|
|
107
|
+
get dropzone() {
|
|
108
|
+
return this.part('dropzone');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** The zone's visually hidden `<input type="file">`. */
|
|
112
|
+
get input() {
|
|
113
|
+
return this.part('input');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** What the zone says, which names its input unless `@label` does. */
|
|
117
|
+
get text() {
|
|
118
|
+
const label = this.dropzone.querySelector('[data-slot="file-upload-dropzone-label"]');
|
|
119
|
+
return collapse(label?.textContent);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** The input's accessible name: its `aria-label`, else the zone's text. */
|
|
123
|
+
get label() {
|
|
124
|
+
return this.input.getAttribute('aria-label') ?? this.text;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Which files it takes (`accept`), or `''` for any. */
|
|
128
|
+
get accept() {
|
|
129
|
+
return this.input.accept;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Whether it takes more than one file. */
|
|
133
|
+
get isMultiple() {
|
|
134
|
+
return this.input.multiple;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Whether it takes no files (its input is disabled). */
|
|
138
|
+
get isDisabled() {
|
|
139
|
+
return this.input.disabled;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Whether files are dragged over its zone (`data-dragging`). */
|
|
143
|
+
get isDragging() {
|
|
144
|
+
return this.dropzone.hasAttribute('data-dragging');
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Whether its input has focus, which is how a keyboard user reaches the zone. */
|
|
148
|
+
get isFocused() {
|
|
149
|
+
return this.element.ownerDocument.activeElement === this.input;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Whether an upload is running: its upload queue is `aria-busy`. */
|
|
153
|
+
get isUploading() {
|
|
154
|
+
return this.queue?.getAttribute('aria-busy') === 'true';
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The zone's status region (`role="status"`), which names the files turned away. */
|
|
158
|
+
get status() {
|
|
159
|
+
return this.part('status');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* What the zone says about the files the last choice or drop turned away, as `@accept`
|
|
164
|
+
* doesn't take them, or `undefined`.
|
|
165
|
+
*/
|
|
166
|
+
get rejected() {
|
|
167
|
+
const message = this.queryPart('rejected');
|
|
168
|
+
return message ? collapse(message.textContent) : undefined;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* What the zone says about the files the last drop left out, without `@multiple` (all but the
|
|
173
|
+
* first), or `undefined`.
|
|
174
|
+
*/
|
|
175
|
+
get leftOut() {
|
|
176
|
+
const message = this.queryPart('left-out');
|
|
177
|
+
return message ? collapse(message.textContent) : undefined;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The file list, or `null` while it holds nothing. */
|
|
181
|
+
get list() {
|
|
182
|
+
return this.queryPart('list');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** The upload queue, or `null` while nothing uploads or has failed. */
|
|
186
|
+
get queue() {
|
|
187
|
+
return this.queryPart('queue');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** Every row, the list's and the queue's, in the order they show. */
|
|
191
|
+
get items() {
|
|
192
|
+
return this.findAll(FileUploadItemHarness);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** The names in the file list: the files the value holds. */
|
|
196
|
+
get files() {
|
|
197
|
+
return this.#named('done');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** The names of the files uploading. */
|
|
201
|
+
get uploading() {
|
|
202
|
+
return this.#named('uploading');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** The names of the files whose upload failed. */
|
|
206
|
+
get failed() {
|
|
207
|
+
return this.#named('error');
|
|
208
|
+
}
|
|
209
|
+
#named(state) {
|
|
210
|
+
return this.items.filter(item => item.state === state).map(item => item.fileName);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** The row of the file with this name. */
|
|
214
|
+
file(name) {
|
|
215
|
+
return this.find(FileUploadItemHarness, name);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Chooses files in the file picker: its input's `change`. Doesn't wait for `@upload`. */
|
|
219
|
+
async select(...files) {
|
|
220
|
+
await triggerEvent(this.input, 'change', {
|
|
221
|
+
files
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Drags files from the desktop over the zone. */
|
|
226
|
+
async drag(...files) {
|
|
227
|
+
dispatch(this.dropzone, 'dragenter', files);
|
|
228
|
+
dispatch(this.dropzone, 'dragover', files);
|
|
229
|
+
await settled();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Drags them away again. */
|
|
233
|
+
async leave() {
|
|
234
|
+
dispatch(this.dropzone, 'dragleave', []);
|
|
235
|
+
await settled();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Drags files from the desktop and drops them on the zone. Doesn't wait for `@upload`. */
|
|
239
|
+
async drop(...files) {
|
|
240
|
+
dispatch(this.dropzone, 'dragenter', files);
|
|
241
|
+
dispatch(this.dropzone, 'dragover', files);
|
|
242
|
+
dispatch(this.dropzone, 'drop', files);
|
|
243
|
+
await settled();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Presses the remove button of the file with this name. */
|
|
247
|
+
async remove(name) {
|
|
248
|
+
await this.file(name).remove();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Presses Retry on the failed upload with this name. */
|
|
252
|
+
async retry(name) {
|
|
253
|
+
await this.file(name).retry();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Waits until no file is uploading: each is in the list, or has failed. */
|
|
257
|
+
async waitForUploads() {
|
|
258
|
+
await waitUntil(() => this.uploading.length === 0, {
|
|
259
|
+
timeoutMessage: `Joinery harness: the uploads in ${this} never finished`
|
|
260
|
+
});
|
|
261
|
+
await settled();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export { FileUploadHarness, FileUploadItemHarness };
|
|
266
|
+
//# sourceMappingURL=test-support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-support.js","sources":["../src/test-support/file-upload.ts"],"sourcesContent":["import { settled, triggerEvent, waitUntil } from '@ember/test-helpers'\nimport { ButtonHarness, Harness, ItemHarness, ProgressHarness } from '@ember-joinery/test-support'\n\nconst collapse = (value: string | null | undefined): string =>\n (value ?? '').replace(/\\s+/g, ' ').trim()\n\n/** A drag's data, as the desktop sends it: the files, typed `Files`. */\nfunction transferOf(files: File[]): DataTransfer {\n const transfer = new DataTransfer()\n for (const file of files) transfer.items.add(file)\n return transfer\n}\n\nfunction dispatch(target: Element, type: string, files: File[]): void {\n target.dispatchEvent(\n new DragEvent(type, { bubbles: true, cancelable: true, dataTransfer: transferOf(files) }),\n )\n}\n\n/**\n * Drives one row of a `<FileUpload>`'s file list or upload queue: a shadcn Item, so everything\n * `ItemHarness` reads it reads too. Find one by its file's name:\n *\n * const cv = upload.file('cv.pdf')\n * assert.strictEqual(cv.details, 'PDF · 184.3 kB')\n * await cv.remove()\n */\nexport class FileUploadItemHarness extends ItemHarness {\n /** The file's name. */\n get fileName(): string {\n return this.title\n }\n\n /** `done` (in the list), `uploading` or `error` (in the queue): its `data-state`. */\n get state(): string | null {\n return this.element.getAttribute('data-state')\n }\n\n /** What it says under the name: its kind and size (`PDF · 184.3 kB`), or a failed upload's error. */\n get details(): string {\n return this.description\n }\n\n /** The preview's image URL, or `null` when it shows an icon for its kind. */\n get preview(): string | null {\n return this.queryPart('media')?.querySelector('img')?.getAttribute('src') ?? null\n }\n\n /** Whether it shows a preview of the image rather than an icon. */\n get hasPreview(): boolean {\n return this.preview !== null\n }\n\n /** Whether it has a remove button: a disabled `<FileUpload>` shows none. */\n get canRemove(): boolean {\n return this.find(ButtonHarness, 'remove').exists\n }\n\n /** Its remove button. */\n get removeButton(): ButtonHarness {\n return this.find(ButtonHarness, 'remove')\n }\n\n /** A failed upload's retry button. */\n get retryButton(): ButtonHarness {\n return this.find(ButtonHarness, 'retry')\n }\n\n /** While it uploads, its progress bar (a `ProgressHarness`). */\n get progressBar(): ProgressHarness {\n return this.find(ProgressHarness)\n }\n\n /** While it uploads, how much has gone, from 0 to 100. `null` once it isn't uploading. */\n get progress(): number | null {\n const bar = this.progressBar\n return bar.exists ? bar.value : null\n }\n\n /** Presses its remove button. */\n async remove(): Promise<void> {\n await this.removeButton.click()\n }\n\n /** Presses a failed upload's retry button. */\n async retry(): Promise<void> {\n await this.retryButton.click()\n }\n}\n\n/**\n * Drives a `<FileUpload>` from `@ember-joinery/file-upload`: chooses files as the file picker\n * does, drags and drops them on its zone, and reads and removes what its list and upload queue\n * show.\n *\n * const resume = new FileUploadHarness('resume') // <FileUpload @name=\"resume\">\n * await resume.select(new File(['%PDF'], 'cv.pdf', { type: 'application/pdf' }))\n * assert.deepEqual(resume.files, ['cv.pdf'])\n * await resume.remove('cv.pdf')\n *\n * `select` and `drop` don't wait for `@upload`; `waitForUploads()` does.\n */\nexport class FileUploadHarness extends Harness {\n static override component = 'file-upload'\n\n /** The zone files are dropped on. */\n get dropzone(): HTMLElement {\n return this.part('dropzone')\n }\n\n /** The zone's visually hidden `<input type=\"file\">`. */\n get input(): HTMLInputElement {\n return this.part<HTMLInputElement>('input')\n }\n\n /** What the zone says, which names its input unless `@label` does. */\n get text(): string {\n const label = this.dropzone.querySelector('[data-slot=\"file-upload-dropzone-label\"]')\n return collapse(label?.textContent)\n }\n\n /** The input's accessible name: its `aria-label`, else the zone's text. */\n get label(): string {\n return this.input.getAttribute('aria-label') ?? this.text\n }\n\n /** Which files it takes (`accept`), or `''` for any. */\n get accept(): string {\n return this.input.accept\n }\n\n /** Whether it takes more than one file. */\n get isMultiple(): boolean {\n return this.input.multiple\n }\n\n /** Whether it takes no files (its input is disabled). */\n get isDisabled(): boolean {\n return this.input.disabled\n }\n\n /** Whether files are dragged over its zone (`data-dragging`). */\n get isDragging(): boolean {\n return this.dropzone.hasAttribute('data-dragging')\n }\n\n /** Whether its input has focus, which is how a keyboard user reaches the zone. */\n get isFocused(): boolean {\n return this.element.ownerDocument.activeElement === this.input\n }\n\n /** Whether an upload is running: its upload queue is `aria-busy`. */\n get isUploading(): boolean {\n return this.queue?.getAttribute('aria-busy') === 'true'\n }\n\n /** The zone's status region (`role=\"status\"`), which names the files turned away. */\n get status(): HTMLElement {\n return this.part('status')\n }\n\n /**\n * What the zone says about the files the last choice or drop turned away, as `@accept`\n * doesn't take them, or `undefined`.\n */\n get rejected(): string | undefined {\n const message = this.queryPart('rejected')\n return message ? collapse(message.textContent) : undefined\n }\n\n /**\n * What the zone says about the files the last drop left out, without `@multiple` (all but the\n * first), or `undefined`.\n */\n get leftOut(): string | undefined {\n const message = this.queryPart('left-out')\n return message ? collapse(message.textContent) : undefined\n }\n\n /** The file list, or `null` while it holds nothing. */\n get list(): HTMLElement | null {\n return this.queryPart('list')\n }\n\n /** The upload queue, or `null` while nothing uploads or has failed. */\n get queue(): HTMLElement | null {\n return this.queryPart('queue')\n }\n\n /** Every row, the list's and the queue's, in the order they show. */\n get items(): FileUploadItemHarness[] {\n return this.findAll(FileUploadItemHarness)\n }\n\n /** The names in the file list: the files the value holds. */\n get files(): string[] {\n return this.#named('done')\n }\n\n /** The names of the files uploading. */\n get uploading(): string[] {\n return this.#named('uploading')\n }\n\n /** The names of the files whose upload failed. */\n get failed(): string[] {\n return this.#named('error')\n }\n\n #named(state: string): string[] {\n return this.items.filter(item => item.state === state).map(item => item.fileName)\n }\n\n /** The row of the file with this name. */\n file(name: string): FileUploadItemHarness {\n return this.find(FileUploadItemHarness, name)\n }\n\n /** Chooses files in the file picker: its input's `change`. Doesn't wait for `@upload`. */\n async select(...files: File[]): Promise<void> {\n await triggerEvent(this.input, 'change', { files })\n }\n\n /** Drags files from the desktop over the zone. */\n async drag(...files: File[]): Promise<void> {\n dispatch(this.dropzone, 'dragenter', files)\n dispatch(this.dropzone, 'dragover', files)\n await settled()\n }\n\n /** Drags them away again. */\n async leave(): Promise<void> {\n dispatch(this.dropzone, 'dragleave', [])\n await settled()\n }\n\n /** Drags files from the desktop and drops them on the zone. Doesn't wait for `@upload`. */\n async drop(...files: File[]): Promise<void> {\n dispatch(this.dropzone, 'dragenter', files)\n dispatch(this.dropzone, 'dragover', files)\n dispatch(this.dropzone, 'drop', files)\n await settled()\n }\n\n /** Presses the remove button of the file with this name. */\n async remove(name: string): Promise<void> {\n await this.file(name).remove()\n }\n\n /** Presses Retry on the failed upload with this name. */\n async retry(name: string): Promise<void> {\n await this.file(name).retry()\n }\n\n /** Waits until no file is uploading: each is in the list, or has failed. */\n async waitForUploads(): Promise<void> {\n await waitUntil(() => this.uploading.length === 0, {\n timeoutMessage: `Joinery harness: the uploads in ${this} never finished`,\n })\n await settled()\n }\n}\n"],"names":["collapse","value","replace","trim","transferOf","files","transfer","DataTransfer","file","items","add","dispatch","target","type","dispatchEvent","DragEvent","bubbles","cancelable","dataTransfer","FileUploadItemHarness","ItemHarness","fileName","title","state","element","getAttribute","details","description","preview","queryPart","querySelector","hasPreview","canRemove","find","ButtonHarness","exists","removeButton","retryButton","progressBar","ProgressHarness","progress","bar","remove","click","retry","FileUploadHarness","Harness","component","dropzone","part","input","text","label","textContent","accept","isMultiple","multiple","isDisabled","disabled","isDragging","hasAttribute","isFocused","ownerDocument","activeElement","isUploading","queue","status","rejected","message","undefined","leftOut","list","findAll","uploading","failed","#named","filter","item","map","name","select","triggerEvent","drag","settled","leave","drop","waitForUploads","waitUntil","length","timeoutMessage"],"mappings":";;;AAGA,MAAMA,QAAQ,GAAIC,KAAgC,IAChD,CAACA,KAAK,IAAI,EAAE,EAAEC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAACC,IAAI,EAAE;;AAE3C;AACA,SAASC,UAAUA,CAACC,KAAa,EAAgB;AAC/C,EAAA,MAAMC,QAAQ,GAAG,IAAIC,YAAY,EAAE;AACnC,EAAA,KAAK,MAAMC,IAAI,IAAIH,KAAK,EAAEC,QAAQ,CAACG,KAAK,CAACC,GAAG,CAACF,IAAI,CAAC;AAClD,EAAA,OAAOF,QAAQ;AACjB;AAEA,SAASK,QAAQA,CAACC,MAAe,EAAEC,IAAY,EAAER,KAAa,EAAQ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E,EAAE,CAAC;IACxC,MAAMmC,OAAO,EAAE;AACjB,EAAA;;AAEA;AACA,EAAA,MAAME,IAAIA,CAAC,GAAGhF,KAAa,EAAiB;IAC1CM,QAAQ,CAAC,IAAI,CAACqC,QAAQ,EAAE,WAAW,EAAE3C,KAAK,CAAC;IAC3CM,QAAQ,CAAC,IAAI,CAACqC,QAAQ,EAAE,UAAU,EAAE3C,KAAK,CAAC;IAC1CM,QAAQ,CAAC,IAAI,CAACqC,QAAQ,EAAE,MAAM,EAAE3C,KAAK,CAAC;IACtC,MAAM8E,OAAO,EAAE;AACjB,EAAA;;AAEA;EACA,MAAMzC,MAAMA,CAACqC,IAAY,EAAiB;IACxC,MAAM,IAAI,CAACvE,IAAI,CAACuE,IAAI,CAAC,CAACrC,MAAM,EAAE;AAChC,EAAA;;AAEA;EACA,MAAME,KAAKA,CAACmC,IAAY,EAAiB;IACvC,MAAM,IAAI,CAACvE,IAAI,CAACuE,IAAI,CAAC,CAACnC,KAAK,EAAE;AAC/B,EAAA;;AAEA;EACA,MAAM0C,cAAcA,GAAkB;IACpC,MAAMC,SAAS,CAAC,MAAM,IAAI,CAACd,SAAS,CAACe,MAAM,KAAK,CAAC,EAAE;MACjDC,cAAc,EAAE,mCAAmC,IAAI,CAAA,eAAA;AACzD,KAAC,CAAC;IACF,MAAMN,OAAO,EAAE;AACjB,EAAA;AACF;;"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { format } from '@ember-joinery/primitives/i18n';
|
|
2
|
+
import { messages } from './messages.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether `file` matches an `accept` list, as a file picker filters it: extensions (`.pdf`),
|
|
6
|
+
* MIME types (`text/csv`) and wildcards (`image/*`), comma-separated. An empty list takes
|
|
7
|
+
* every file.
|
|
8
|
+
*
|
|
9
|
+
* acceptsFile(new File([], 'cv.pdf', { type: 'application/pdf' }), '.pdf,image/*') // true
|
|
10
|
+
*/
|
|
11
|
+
function acceptsFile(file, accept) {
|
|
12
|
+
if (!accept?.trim()) return true;
|
|
13
|
+
const name = file.name.toLowerCase();
|
|
14
|
+
const type = file.type.toLowerCase();
|
|
15
|
+
return accept.split(',').some(raw => {
|
|
16
|
+
const pattern = raw.trim().toLowerCase();
|
|
17
|
+
if (!pattern) return false;
|
|
18
|
+
if (pattern.startsWith('.')) return name.endsWith(pattern);
|
|
19
|
+
if (pattern.endsWith('/*')) return type.startsWith(pattern.slice(0, -1));
|
|
20
|
+
return type === pattern;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A file's kind, from its name's extension, in capitals: `PDF`, `PNG`… (at most four letters),
|
|
26
|
+
* or `unknown` (`FILE` by default) when it has none.
|
|
27
|
+
*
|
|
28
|
+
* fileKind('cv.pdf') // 'PDF'
|
|
29
|
+
* fileKind('README', 'ملف') // 'ملف'
|
|
30
|
+
*/
|
|
31
|
+
function fileKind(name, unknown = format(messages.unknownKind)) {
|
|
32
|
+
const dot = name.lastIndexOf('.');
|
|
33
|
+
return dot > 0 && dot < name.length - 1 ? name.slice(dot + 1, dot + 5).toUpperCase() : unknown;
|
|
34
|
+
}
|
|
35
|
+
const UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte'];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A size in bytes as people read it, in decimal units and the locale's words: `920 bytes`,
|
|
39
|
+
* `184.3 kB`, `1.2 MB`.
|
|
40
|
+
*
|
|
41
|
+
* formatFileSize(1_240_000) // '1.2 MB'
|
|
42
|
+
* formatFileSize(1_240_000, 'de') // '1,2 MB'
|
|
43
|
+
*/
|
|
44
|
+
function formatFileSize(bytes, locale) {
|
|
45
|
+
let size = bytes;
|
|
46
|
+
let unit = 0;
|
|
47
|
+
while (size >= 1000 && unit < UNITS.length - 1) {
|
|
48
|
+
size /= 1000;
|
|
49
|
+
unit++;
|
|
50
|
+
}
|
|
51
|
+
return new Intl.NumberFormat(locale, {
|
|
52
|
+
style: 'unit',
|
|
53
|
+
unit: UNITS[unit],
|
|
54
|
+
unitDisplay: unit ? 'short' : 'long',
|
|
55
|
+
maximumFractionDigits: unit ? 1 : 0
|
|
56
|
+
}).format(size);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { acceptsFile, fileKind, formatFileSize };
|
|
60
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import { format } from '@ember-joinery/primitives/i18n'\nimport { messages } from './messages.ts'\n/**\n * Whether `file` matches an `accept` list, as a file picker filters it: extensions (`.pdf`),\n * MIME types (`text/csv`) and wildcards (`image/*`), comma-separated. An empty list takes\n * every file.\n *\n * acceptsFile(new File([], 'cv.pdf', { type: 'application/pdf' }), '.pdf,image/*') // true\n */\nexport function acceptsFile(file: File, accept: string | undefined): boolean {\n if (!accept?.trim()) return true\n const name = file.name.toLowerCase()\n const type = file.type.toLowerCase()\n return accept.split(',').some(raw => {\n const pattern = raw.trim().toLowerCase()\n if (!pattern) return false\n if (pattern.startsWith('.')) return name.endsWith(pattern)\n if (pattern.endsWith('/*')) return type.startsWith(pattern.slice(0, -1))\n return type === pattern\n })\n}\n\n/**\n * A file's kind, from its name's extension, in capitals: `PDF`, `PNG`… (at most four letters),\n * or `unknown` (`FILE` by default) when it has none.\n *\n * fileKind('cv.pdf') // 'PDF'\n * fileKind('README', 'ملف') // 'ملف'\n */\nexport function fileKind(name: string, unknown = format(messages.unknownKind)): string {\n const dot = name.lastIndexOf('.')\n return dot > 0 && dot < name.length - 1 ? name.slice(dot + 1, dot + 5).toUpperCase() : unknown\n}\n\nconst UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte'] as const\n\n/**\n * A size in bytes as people read it, in decimal units and the locale's words: `920 bytes`,\n * `184.3 kB`, `1.2 MB`.\n *\n * formatFileSize(1_240_000) // '1.2 MB'\n * formatFileSize(1_240_000, 'de') // '1,2 MB'\n */\nexport function formatFileSize(bytes: number, locale?: string): string {\n let size = bytes\n let unit = 0\n while (size >= 1000 && unit < UNITS.length - 1) {\n size /= 1000\n unit++\n }\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit: UNITS[unit],\n unitDisplay: unit ? 'short' : 'long',\n maximumFractionDigits: unit ? 1 : 0,\n }).format(size)\n}\n"],"names":["acceptsFile","file","accept","trim","name","toLowerCase","type","split","some","raw","pattern","startsWith","endsWith","slice","fileKind","unknown","format","messages","unknownKind","dot","lastIndexOf","length","toUpperCase","UNITS","formatFileSize","bytes","locale","size","unit","Intl","NumberFormat","style","unitDisplay","maximumFractionDigits"],"mappings":";;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,WAAWA,CAACC,IAAU,EAAEC,MAA0B,EAAW;EAC3E,IAAI,CAACA,MAAM,EAAEC,IAAI,EAAE,EAAE,OAAO,IAAI;EAChC,MAAMC,IAAI,GAAGH,IAAI,CAACG,IAAI,CAACC,WAAW,EAAE;EACpC,MAAMC,IAAI,GAAGL,IAAI,CAACK,IAAI,CAACD,WAAW,EAAE;EACpC,OAAOH,MAAM,CAACK,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAACC,GAAG,IAAI;IACnC,MAAMC,OAAO,GAAGD,GAAG,CAACN,IAAI,EAAE,CAACE,WAAW,EAAE;AACxC,IAAA,IAAI,CAACK,OAAO,EAAE,OAAO,KAAK;AAC1B,IAAA,IAAIA,OAAO,CAACC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAOP,IAAI,CAACQ,QAAQ,CAACF,OAAO,CAAC;IAC1D,IAAIA,OAAO,CAACE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAON,IAAI,CAACK,UAAU,CAACD,OAAO,CAACG,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxE,OAAOP,IAAI,KAAKI,OAAO;AACzB,EAAA,CAAC,CAAC;AAC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