UNPKG

@sklinet/strapi-plugin-video-field

Version:
204 lines (203 loc) 5.63 kB
import { jsx } from "react/jsx-runtime"; import styled from "styled-components"; import { Flex } from "@strapi/design-system"; import { Play } from "@strapi/icons"; import { useRef, useEffect } from "react"; const __variableDynamicImportRuntimeHelper = (glob, path) => { const v = glob[path]; if (v) { return typeof v === "function" ? v() : Promise.resolve(v); } return new Promise((_, reject) => { (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(reject.bind(null, new Error("Unknown variable dynamic import: " + path))); }); }; const name = "@sklinet/strapi-plugin-video-field"; const version = "1.1.3"; const description = "Add video field to your Strapi application."; const keywords = [ "strapi", "video", "field", "video-field", "custom-field" ]; const license = "MIT"; const author = { name: "SKLINET s.r.o.", url: "https://github.com/SKLINET" }; const type = "commonjs"; const exports = { "./package.json": "./package.json", "./strapi-admin": { types: "./dist/admin/src/index.d.ts", source: "./admin/src/index.ts", "import": "./dist/admin/index.mjs", require: "./dist/admin/index.js", "default": "./dist/admin/index.js" }, "./strapi-server": { types: "./dist/server/src/index.d.ts", source: "./server/src/index.ts", "import": "./dist/server/index.mjs", require: "./dist/server/index.js", "default": "./dist/server/index.js" } }; const files = [ "dist" ]; const scripts = { build: "strapi-plugin build", "test:ts:back": "run -T tsc -p server/tsconfig.json", "test:ts:front": "run -T tsc -p admin/tsconfig.json", verify: "strapi-plugin verify", watch: "strapi-plugin watch", "watch:link": "strapi-plugin watch:link" }; const dependencies = { "@strapi/design-system": "^2.0.0-rc.11", "@strapi/icons": "^2.0.0-rc.11", "react-intl": "^6.7.0" }; const devDependencies = { "@strapi/sdk-plugin": "^5.2.7", "@strapi/strapi": "^5.1.1", "@strapi/typescript-utils": "^5.1.1", "@types/react": "^18.3.10", "@types/react-dom": "^18.3.0", prettier: "^3.3.3", react: "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.26.2", "styled-components": "^6.1.13", typescript: "^5.6.2" }; const peerDependencies = { "@strapi/sdk-plugin": "^5.2.7", "@strapi/strapi": "^5.1.1", react: "^18.3.1", "react-dom": "^18.3.1", "react-router-dom": "^6.27.0", "styled-components": "^6.1.13" }; const strapi = { name: "video-field", description: "Add video field to your Strapi application.", kind: "plugin", displayName: "Video Field" }; const maintainers = [ { name: "SKLINET s.r.o.", url: "https://github.com/SKLINET" } ]; const repository = { type: "git", url: "https://github.com/SKLINET/strapi-plugin-video-field.git" }; const pluginPkg = { name, version, description, "private": false, keywords, license, author, type, exports, files, scripts, dependencies, devDependencies, peerDependencies, strapi, maintainers, repository }; const PLUGIN_ID = pluginPkg.name.replace(/^(@sklinet\/strapi-)plugin-/i, ""); const getTranslation = (id) => `${PLUGIN_ID}.${id}`; const IconBox = styled(Flex)` /* Hard code color values */ /* to stay consistent between themes */ background-color: #f0f0ff; /* primary100 */ border: 1px solid #d9d8ff; /* primary200 */ svg > path { fill: #4945ff; /* primary600 */ } `; const FieldIcon = () => { return /* @__PURE__ */ jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsx(Play, {}) }); }; const Initializer = ({ setPlugin }) => { const ref = useRef(setPlugin); useEffect(() => { ref.current(PLUGIN_ID); }, []); return null; }; const prefixPluginTranslations = (trad, pluginId) => { if (!pluginId) { throw new TypeError("pluginId can't be empty"); } return Object.keys(trad).reduce((acc, current) => { acc[`${pluginId}.${current}`] = trad[current]; return acc; }, {}); }; const index = { register(app) { app.customFields.register({ name: "video", pluginId: PLUGIN_ID, type: "json", icon: FieldIcon, intlLabel: { id: getTranslation("video-field.label"), defaultMessage: "Video" }, intlDescription: { id: getTranslation("video-field.description"), defaultMessage: "Video field for YouTube or Vimeo." }, components: { Input: async () => import( /* webpackChunkName: "video-field-input-component" */ "./Input-CfAljZUS.mjs" ) } }); app.registerPlugin({ id: PLUGIN_ID, initializer: Initializer, isReady: false, name: PLUGIN_ID }); }, async registerTrads(app) { const { locales } = app; const importedTranslations = await Promise.all( locales.map((locale) => { return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/cs.json": () => import("./cs-wpd82YqC.mjs"), "./translations/en.json": () => import("./en-DqI4OZOl.mjs"), "./translations/sk.json": () => import("./sk-CPCV0DyM.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => { return { data: prefixPluginTranslations(data, PLUGIN_ID), locale }; }).catch(() => { return { data: {}, locale }; }); }) ); return importedTranslations; } }; export { getTranslation as g, index as i }; //# sourceMappingURL=index-ClL4pNXi.mjs.map