@sklinet/strapi-plugin-video-field
Version:
Add video field to your Strapi application.
205 lines (204 loc) • 6.02 kB
JavaScript
;
const jsxRuntime = require("react/jsx-runtime");
const styled = require("styled-components");
const designSystem = require("@strapi/design-system");
const icons = require("@strapi/icons");
const react = require("react");
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
const styled__default = /* @__PURE__ */ _interopDefault(styled);
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.1";
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$1 = {
"./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: exports$1,
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__default.default(designSystem.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__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Play, {}) });
};
const Initializer = ({ setPlugin }) => {
const ref = react.useRef(setPlugin);
react.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 () => Promise.resolve().then(() => require(
/* webpackChunkName: "video-field-input-component" */
"./Input-DdqF3OCq.js"
))
}
});
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": () => Promise.resolve().then(() => require("./cs-pJ7Pxvy7.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-BN8PZ6vT.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-4btYe2BM.js")) }), `./translations/${locale}.json`).then(({ default: data }) => {
return {
data: prefixPluginTranslations(data, PLUGIN_ID),
locale
};
}).catch(() => {
return {
data: {},
locale
};
});
})
);
return importedTranslations;
}
};
exports.getTranslation = getTranslation;
exports.index = index;
//# sourceMappingURL=index-Bs3xL2ll.js.map