🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

@templatical/media-library

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@templatical/media-library

Media library management for Templatical email editor

latest
Source
npmnpm
Version
0.10.4
Version published
Maintainers
1
Created
Source

@templatical/media-library

Media library for Templatical — composable, Vue components, and a standalone visual SDK.

npm version License

Browse, upload, organize, crop, and replace media assets. Used by @templatical/editor's Cloud build, and available as a standalone SDK for any app that needs a media manager.

Install

npm install @templatical/media-library

Peer deps: vue@^3.5, tailwindcss@^4.

Authentication. The media library connects to Templatical Cloud and authenticates against your backend. Your server exposes a token endpoint (returning a short-lived JWT for the current user/project), and you pass that endpoint URL as auth.url. See the authentication guide for the full setup.

Usage

Standalone visual SDK (mount anywhere)

import { init } from '@templatical/media-library';
import '@templatical/media-library/style.css';

const media = await init({
  container: '#media',
  auth: {
    url: 'https://your-app.com/api/templatical/token',
  },
  onSelect(item) {
    console.log('Picked:', item.url);
  },
});

// Later
media.unmount();

Vue component

Use MediaLibraryModal inside a Vue 3 app. See docs for the full prop reference.

import { MediaLibraryModal } from '@templatical/media-library';
import '@templatical/media-library/style.css';

Composable (build your own UI)

import { AuthManager } from '@templatical/core/cloud';
import { useMediaLibrary } from '@templatical/media-library';

const authManager = new AuthManager({
  url: 'https://your-app.com/api/templatical/token',
});
await authManager.initialize();

const lib = useMediaLibrary({
  projectId: authManager.projectId,
  authManager,
});

API client (low-level)

import { AuthManager } from '@templatical/core/cloud';
import { MediaApiClient } from '@templatical/media-library';

const api = new MediaApiClient(authManager);
const response = await api.browseMedia({ folder_id: null });

Exports

  • Standalone SDKinit(), unmount()
  • Vue componentsMediaLibraryModal + 12 sub-components (grid, upload zone, folder tree, preview panel, edit/replace/import modals)
  • ComposablesuseMediaLibrary, useMediaCategories, useMediaPicker, useI18n
  • API clientMediaApiClient
  • TypesMediaItem, MediaFolder, MediaCategory, MediaConversion, MediaBrowseParams/Response, MediaUsageInfo/Response, MediaConfig, etc.

Inside the editor's Shadow DOM

When the editor mounts in its default shadow-DOM mode (shadowDom: true), the media library invocation teleports into the editor's shadow-aware popover root rather than document.body. The MediaLibraryModal accepts an optional popoverTarget?: HTMLElement | null prop and provides it to its three nested sub-modals (replace, edit, import-url) so the entire media UI lives inside the editor's shadow root. Standalone-SDK consumers (init({ container })) keep the previous body-level mount.

If you embed MediaLibraryModal manually inside another shadow-DOM-mounted UI, pass popoverTarget to keep its sub-modals scoped to your shadow root.

Documentation

Full reference at docs.templatical.com.

License

FSL-1.1-MIT — free for any non-competing commercial use, automatically converts to MIT after 2 years per release.

Keywords

asset-manager

FAQs

Package last updated on 15 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts