New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-datocms

Package Overview
Dependencies
Maintainers
0
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-datocms - npm Package Compare versions

Comparing version 7.1.0 to 7.2.0

15

dist/cjs/StructuredText/index.js

@@ -46,3 +46,3 @@ "use strict";

exports.appendKeyToValidElement = appendKeyToValidElement;
function StructuredText({ data, renderInlineRecord, renderLinkToRecord, renderBlock, renderText, renderNode, renderFragment, customMarkRules, customRules, customNodeRules, metaTransformer, }) {
function StructuredText({ data, renderInlineRecord, renderLinkToRecord, renderBlock, renderInlineBlock, renderText, renderNode, renderFragment, customMarkRules, customRules, customNodeRules, metaTransformer, }) {
const result = (0, datocms_structured_text_generic_html_renderer_1.render)(data, {

@@ -105,2 +105,15 @@ adapter: {

}),
(0, datocms_structured_text_generic_html_renderer_1.renderNodeRule)(datocms_structured_text_utils_1.isInlineBlock, ({ node, key }) => {
if (!renderInlineBlock) {
throw new datocms_structured_text_utils_1.RenderError(`The Structured Text document contains an 'inlineBlock' node, but no 'renderInlineBlock' prop is specified!`, node);
}
if (!((0, datocms_structured_text_utils_1.isStructuredText)(data) && data.blocks)) {
throw new datocms_structured_text_utils_1.RenderError(`The document contains an 'inlineBlock' node, but the passed data prop is not a Structured Text GraphQL response, or data.blocks is not present!`, node);
}
const item = data.blocks.find((item) => item.id === node.item);
if (!item) {
throw new datocms_structured_text_utils_1.RenderError(`The Structured Text document contains an 'inlineBlock' node, but cannot find a record with ID ${node.item} inside data.blocks!`, node);
}
return appendKeyToValidElement(renderInlineBlock({ record: item }), key);
}),
...(customNodeRules || customRules || []),

@@ -107,0 +120,0 @@ ],

import { defaultMetaTransformer, render, renderMarkRule, renderNodeRule, } from 'datocms-structured-text-generic-html-renderer';
import { RenderError, isBlock, isInlineItem, isItemLink, isStructuredText, } from 'datocms-structured-text-utils';
import { RenderError, isBlock, isInlineBlock, isInlineItem, isItemLink, isStructuredText, } from 'datocms-structured-text-utils';
import React, { cloneElement, isValidElement } from 'react';

@@ -18,3 +18,3 @@ export { renderNodeRule, renderMarkRule, RenderError };

}
export function StructuredText({ data, renderInlineRecord, renderLinkToRecord, renderBlock, renderText, renderNode, renderFragment, customMarkRules, customRules, customNodeRules, metaTransformer, }) {
export function StructuredText({ data, renderInlineRecord, renderLinkToRecord, renderBlock, renderInlineBlock, renderText, renderNode, renderFragment, customMarkRules, customRules, customNodeRules, metaTransformer, }) {
const result = render(data, {

@@ -77,2 +77,15 @@ adapter: {

}),
renderNodeRule(isInlineBlock, ({ node, key }) => {
if (!renderInlineBlock) {
throw new RenderError(`The Structured Text document contains an 'inlineBlock' node, but no 'renderInlineBlock' prop is specified!`, node);
}
if (!(isStructuredText(data) && data.blocks)) {
throw new RenderError(`The document contains an 'inlineBlock' node, but the passed data prop is not a Structured Text GraphQL response, or data.blocks is not present!`, node);
}
const item = data.blocks.find((item) => item.id === node.item);
if (!item) {
throw new RenderError(`The Structured Text document contains an 'inlineBlock' node, but cannot find a record with ID ${node.item} inside data.blocks!`, node);
}
return appendKeyToValidElement(renderInlineBlock({ record: item }), key);
}),
...(customNodeRules || customRules || []),

@@ -79,0 +92,0 @@ ],

4

dist/types/StructuredText/index.d.ts

@@ -41,2 +41,4 @@ import { type RenderMarkRule, type TransformMetaFn, type TransformedMeta, renderMarkRule, renderNodeRule } from 'datocms-structured-text-generic-html-renderer';

renderBlock?: (context: RenderBlockContext<R1>) => ReactElement | null;
/** Fuction that converts an 'inlineBlock' node into React **/
renderInlineBlock?: (context: RenderBlockContext<R1>) => ReactElement | null;
/** Function that converts 'link' and 'itemLink' `meta` into HTML props */

@@ -53,2 +55,2 @@ metaTransformer?: TransformMetaFn;

};
export declare function StructuredText<R1 extends StructuredTextGraphQlResponseRecord, R2 extends StructuredTextGraphQlResponseRecord = R1>({ data, renderInlineRecord, renderLinkToRecord, renderBlock, renderText, renderNode, renderFragment, customMarkRules, customRules, customNodeRules, metaTransformer, }: StructuredTextPropTypes<R1, R2>): ReactElement | null;
export declare function StructuredText<R1 extends StructuredTextGraphQlResponseRecord, R2 extends StructuredTextGraphQlResponseRecord = R1>({ data, renderInlineRecord, renderLinkToRecord, renderBlock, renderInlineBlock, renderText, renderNode, renderFragment, customMarkRules, customRules, customNodeRules, metaTransformer, }: StructuredTextPropTypes<R1, R2>): ReactElement | null;
{
"name": "react-datocms",
"version": "7.1.0",
"version": "7.2.0",
"engines": {

@@ -138,4 +138,4 @@ "node": ">=8.0.0"

"datocms-listen": "^0.1.9",
"datocms-structured-text-generic-html-renderer": "^4.0.1",
"datocms-structured-text-utils": "^4.0.1",
"datocms-structured-text-generic-html-renderer": "^4.1.2",
"datocms-structured-text-utils": "^4.1.2",
"react-intersection-observer": "^9.4.3",

@@ -142,0 +142,0 @@ "react-string-replace": "^1.1.0",

@@ -55,24 +55,43 @@ <!--datocms-autoinclude-header start-->

# What is DatoCMS?
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60"></a>
<a href="https://www.datocms.com/"><img src="https://www.datocms.com/images/full_logo.svg" height="60" alt="DatoCMS - The Headless CMS for the Modern Web"></a>
[DatoCMS](https://www.datocms.com/) is the REST & GraphQL Headless CMS for the modern web.
Trusted by over 25,000 enterprise businesses, agency partners, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ❤️ our [developers](https://www.datocms.com/team/best-cms-for-developers), [content editors](https://www.datocms.com/team/content-creators) and [marketers](https://www.datocms.com/team/cms-digital-marketing)!
Trusted by over 25,000 enterprise businesses, agencies, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ❤️ our [developers](https://www.datocms.com/team/best-cms-for-developers), [content editors](https://www.datocms.com/team/content-creators) and [marketers](https://www.datocms.com/team/cms-digital-marketing)!
**Quick links:**
**Why DatoCMS?**
- ⚡️ Get started with a [free DatoCMS account](https://dashboard.datocms.com/signup)
- 🔖 Go through the [docs](https://www.datocms.com/docs)
- ⚙️ Get [support from us and the community](https://community.datocms.com/)
- 🆕 Stay up to date on new features and fixes on the [changelog](https://www.datocms.com/product-updates)
- **API-First Architecture**: Built for both REST and GraphQL, enabling flexible content delivery
- **Just Enough Features**: We believe in keeping things simple, and giving you [the right feature-set tools](https://www.datocms.com/features) to get the job done
- **Developer Experience**: First-class TypeScript support with powerful developer tools
**Our featured repos:**
- [datocms/react-datocms](https://github.com/datocms/react-datocms): React helper components for images, Structured Text rendering, and more
- [datocms/js-rest-api-clients](https://github.com/datocms/js-rest-api-clients): Node and browser JavaScript clients for updating and administering your content. For frontend fetches, we recommend using our [GraphQL Content Delivery API](https://www.datocms.com/docs/content-delivery-api) instead.
- [datocms/cli](https://github.com/datocms/cli): Command-line interface that includes our [Contentful importer](https://github.com/datocms/cli/tree/main/packages/cli-plugin-contentful) and [Wordpress importer](https://github.com/datocms/cli/tree/main/packages/cli-plugin-wordpress)
- [datocms/plugins](https://github.com/datocms/plugins): Example plugins we've made that extend the editor/admin dashboard
- [DatoCMS Starters](https://www.datocms.com/marketplace/starters) has examples for various Javascript frontend frameworks
**Getting Started:**
Or see [all our public repos](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
- ⚡️ [Create Free Account](https://dashboard.datocms.com/signup) - Get started with DatoCMS in minutes
- 🔖 [Documentation](https://www.datocms.com/docs) - Comprehensive guides and API references
- ⚙️ [Community Support](https://community.datocms.com/) - Get help from our team and community
- 🆕 [Changelog](https://www.datocms.com/product-updates) - Latest features and improvements
**Official Libraries:**
- [**Content Delivery Client**](https://github.com/datocms/cda-client) - TypeScript GraphQL client for content fetching
- [**REST API Clients**](https://github.com/datocms/js-rest-api-clients) - Node.js/Browser clients for content management
- [**CLI Tools**](https://github.com/datocms/cli) - Command-line utilities for schema migrations (includes [Contentful](https://github.com/datocms/cli/tree/main/packages/cli-plugin-contentful) and [WordPress](https://github.com/datocms/cli/tree/main/packages/cli-plugin-wordpress) importers)
**Official Framework Integrations**
Helpers to manage SEO, images, video and Structured Text coming from your DatoCMS projects:
- [**React Components**](https://github.com/datocms/react-datocms)
- [**Vue Components**](https://github.com/datocms/vue-datocms)
- [**Svelte Components**](https://github.com/datocms/datocms-svelte)
- [**Astro Components**](https://github.com/datocms/astro-datocms)
**Additional Resources:**
- [**Plugin Examples**](https://github.com/datocms/plugins) - Example plugins we've made that extend the editor/admin dashboard
- [**Starter Projects**](https://www.datocms.com/marketplace/starters) - Example website implementations for popular frameworks
- [**All Public Repositories**](https://github.com/orgs/datocms/repositories?q=&type=public&language=&sort=stargazers)
<!--datocms-autoinclude-footer end-->

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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