Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@frontmatter/extensibility

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontmatter/extensibility - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

37

dist/index.d.ts
declare global {
interface Window {
fmExternal: {
getCardFooter: (filePath: string, data: any) => Promise<string>;
getCustomFields: {
name: string;
html: (data: any, change: (value: any) => void) => Promise<{
title: string;
content: string;
} | undefined>;
}[];
getPanelView: (data: any) => Promise<PanelViewResult | undefined>;
getCardImage: (filePath: string, data: any) => Promise<string | undefined>;
getCardFooter: (filePath: string, data: any) => Promise<string | undefined>;
};
}
}
export declare const registerCardFooter: (cb: (filePath: string, data: any) => Promise<string>) => void;
export interface PanelViewResult {
title: string;
content: string;
}
/**
* Register a card image renderer
* @param cb
*/
export declare const registerCardImage: (cb: (filePath: string, metadata: any) => Promise<string>) => void;
/**
* Register a card footer renderer
* @param cb
*/
export declare const registerCardFooter: (cb: (filePath: string, metadata: any) => Promise<string>) => void;
/**
* Register a panel view renderer
* @param cb
*/
export declare const registerPanelView: (cb: (metadata: any) => Promise<PanelViewResult | undefined>) => void;
/**
* Register a custom field
* @param name
* @param cb
*/
export declare const registerCustomFields: (name: string, cb: any) => void;

@@ -0,1 +1,14 @@

// Dashboard
/**
* Register a card image renderer
* @param cb
*/
export const registerCardImage = (cb) => {
window.fmExternal = window.fmExternal || {};
window.fmExternal.getCardImage = cb;
};
/**
* Register a card footer renderer
* @param cb
*/
export const registerCardFooter = (cb) => {

@@ -5,2 +18,27 @@ window.fmExternal = window.fmExternal || {};

};
// Panel
/**
* Register a panel view renderer
* @param cb
*/
export const registerPanelView = (cb) => {
window.fmExternal = window.fmExternal || {};
window.fmExternal.getPanelView = cb;
};
/**
* Register a custom field
* @param name
* @param cb
*/
export const registerCustomFields = (name, cb) => {
window.fmExternal = window.fmExternal || {};
window.fmExternal.getCustomFields = window.fmExternal.getCustomFields || [];
const fieldRef = window.fmExternal.getCustomFields.find((x) => x.name === name);
if (fieldRef) {
fieldRef.html = cb;
}
else {
window.fmExternal.getCustomFields.push({ name, html: cb });
}
};
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@frontmatter/extensibility",
"version": "0.0.2",
"version": "0.0.3",
"description": "Front Matter CMS extensibility library",

@@ -5,0 +5,0 @@ "type": "module",

declare global {
interface Window {
fmExternal: {
getCardFooter: (filePath: string, data: any) => Promise<string>;
getCustomFields: {
name: string;
html: (
data: any,
change: (value: any) => void
) => Promise<{ title: string; content: string } | undefined>;
}[];
getPanelView: (data: any) => Promise<PanelViewResult | undefined>;
getCardImage: (
filePath: string,
data: any
) => Promise<string | undefined>;
getCardFooter: (
filePath: string,
data: any
) => Promise<string | undefined>;
};

@@ -9,4 +24,29 @@ }

// Interfaces
export interface PanelViewResult {
title: string;
content: string;
}
// Dashboard
/**
* Register a card image renderer
* @param cb
*/
export const registerCardImage = (
cb: (filePath: string, metadata: any) => Promise<string>
) => {
window.fmExternal = window.fmExternal || {};
window.fmExternal.getCardImage = cb;
};
/**
* Register a card footer renderer
* @param cb
*/
export const registerCardFooter = (
cb: (filePath: string, data: any) => Promise<string>
cb: (filePath: string, metadata: any) => Promise<string>
) => {

@@ -17,1 +57,34 @@ window.fmExternal = window.fmExternal || {};

};
// Panel
/**
* Register a panel view renderer
* @param cb
*/
export const registerPanelView = (
cb: (metadata: any) => Promise<PanelViewResult | undefined>
) => {
window.fmExternal = window.fmExternal || {};
window.fmExternal.getPanelView = cb;
};
/**
* Register a custom field
* @param name
* @param cb
*/
export const registerCustomFields = (name: string, cb: any) => {
window.fmExternal = window.fmExternal || {};
window.fmExternal.getCustomFields = window.fmExternal.getCustomFields || [];
const fieldRef = window.fmExternal.getCustomFields.find(
(x) => x.name === name
);
if (fieldRef) {
fieldRef.html = cb;
} else {
window.fmExternal.getCustomFields.push({ name, html: cb });
}
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc