import { html } from "lit"; import { customElement } from "./utils/decorators/custom-element"; import { AppTypeGuid } from "./types/app.types"; import type { DropFilesEventType } from "./types/files.events"; import { DropZoneController } from "./controllers/dropzone-controller"; import { localized, msg } from "@lit/localize"; //import { HistoryController } from './controllers/history-controller' import { ThemeController } from "./controllers/theme-controller"; import { WeavyAppComponent } from "./classes/weavy-app-component"; import { ComponentFeatures, Feature } from "./contexts/features-context"; import { partMap } from "./utils/directives/shadow-part-map"; import { CreateFilesController } from "./controllers/create-files-controller"; import { createRef, ref } from "lit/directives/ref.js"; import dropZoneCss from "./scss/components/dropzone.scss"; import hostPaddedCss from "./scss/host-padded.scss"; import hostFontCss from "./scss/host-font.scss"; import hostFlexCss from "./scss/host-flex.scss"; import colorModesCss from "./scss/color-modes.scss"; import "./components/wy-file-create"; import { WyFileCreate } from "./components/wy-file-create"; declare global { interface HTMLElementTagNameMap { "wy-file-new": WyFileNew; } } /** * @import { WyAppEventType } from "./types/app.events" * @import { WyActionEventType } from "./types/action.events" */ /** * Weavy file component to create files, upload files or attach cloud files to a files app. * * Supports upload of multiple large files at once, upload using drag'n'drop and pasting files to upload. The file upload progress can be monitored and aborted. * * Prompts for a filename when creating files, optionally suggesting an extension. Also supports uploading files and adding files from cloud providers such as Google Drive, Dropbox, Box and Microsoft OneDrive. * * Each file component requires an app identifier (`uid`), which automatically creates a [corresponding app](https://docs.weavy.com/concepts#app) on your Weavy environment when the component is first initialized. The app identifier must correspond to the app of where you want to save the files. It's also recommended to specify a readable `name` of the files app, to get better readable notifications from the app. * * > It's often useful to base the `uid` on something that identifies the location where the component is rendered. * > Typically you would use something like a product id, page id or path. * * **Component Layout** * * The component is displayed as a dropdown menu shown as a button. After the dropdown is a status icon button; shown when creating, uploading, attaching or modifying files in the app. The default height of the buttons is the icon size `1.5rem`/`24px` together with the set `--wy-padding` (which defaults to `0.5rem`/`8px`), which makes a total of `2.5rem`/`40px` per default. The width varies with the length of the text and whether the status is displayed or not. * * The cloud file picker appears as a modal overlay centered in the `top layer`. * * The file name selector when creating files appears as a modal input dialog centered in the `top layer`. * * The status detail dialog renders in a sheet overlay centered in the `top layer`. * * All the overlays does not occupy any visual layout space where they are placed in the DOM, they only render in the [top layer](https://developer.mozilla.org/en-US/docs/Glossary/Top_layer). * * You can add additional styling using _CSS Custom Properties_ and _CSS Shadow Parts_ and further customization using _slots_. * * **Used sub components:** * * - [``](./components/wy-file-create.ts) * * @tagname wy-file-new * @csspart wy-file-new - Main container. * @csspart wy-dragging - Modifier for the main layout when dragging over. * @slot actions - Buttons placed in the toolbar. * @fires {WyAppEventType} wy-app - Fired whenever the app property changes. * @fires {WyActionEventType} wy-action - Emitted when an action is performed on an embed. * * @example Standard create new file button * * Displays a file create button for the `test-files` files app with integrated file-creation, uploading and cloud file picker. * * Specifying the app identifier (`uid`) is required, and automatically creates a [corresponding app](https://www.weavy.com/docs/concepts#app) on your Weavy environment when the component is first initialized. * It's recommended to specify a readable `name` of the files app, to get better readable notifications from the app. * * ```html * * ``` * * @example Standard create new file button without cloud files * * Displays a create new file button without the possibility to add files from cloud providers. * * ```html * * ``` * * @example Connect create new file button to `` view * * Displays a create new file button that displays the added file in a [file view component](https://docs.weavy.com/reference/uikit/file). * * ```html * * *