@prismicio/react
Advanced tools
Comparing version 2.8.0 to 2.9.0-alpha.0
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
class PrismicError extends Error { | ||
@@ -8,0 +5,0 @@ constructor(message = "An invalid API response was returned", url, response) { |
@@ -1,2 +0,3 @@ | ||
import { buildURL, buildPixelDensitySrcSet } from "../../../../imgix-url-builder/dist/index.js"; | ||
import { buildURL } from "../../../../imgix-url-builder/dist/buildURL.js"; | ||
import { buildPixelDensitySrcSet } from "../../../../imgix-url-builder/dist/buildPixelDensitySrcSet.js"; | ||
import { imageThumbnail } from "./isFilled.js"; | ||
@@ -3,0 +4,0 @@ const DEFAULT_PIXEL_DENSITIES = [1, 2, 3]; |
@@ -1,2 +0,3 @@ | ||
import { buildURL, buildWidthSrcSet } from "../../../../imgix-url-builder/dist/index.js"; | ||
import { buildURL } from "../../../../imgix-url-builder/dist/buildURL.js"; | ||
import { buildWidthSrcSet } from "../../../../imgix-url-builder/dist/buildWidthSrcSet.js"; | ||
import { imageThumbnail } from "./isFilled.js"; | ||
@@ -11,3 +12,3 @@ const DEFAULT_WIDTHS = [640, 828, 1200, 2048, 3840]; | ||
} = config; | ||
const { url, dimensions, alt: _alt, copyright: _copyright, ...responsiveViews } = field; | ||
const { url, dimensions, id: _id, alt: _alt, copyright: _copyright, edit: _edit, ...responsiveViews } = field; | ||
const responsiveViewObjects = Object.values(responsiveViews); | ||
@@ -14,0 +15,0 @@ if (widths === "thumbnails" && responsiveViewObjects.length < 1) { |
@@ -1,2 +0,2 @@ | ||
import { asText as asText$1 } from "@prismicio/richtext"; | ||
import { asText as asText$1 } from "../richtext/asText.js"; | ||
const asText = (richTextField, ...configObjectOrTuple) => { | ||
@@ -3,0 +3,0 @@ if (richTextField) { |
@@ -13,2 +13,3 @@ import { LinkType } from "../types/value/link.js"; | ||
slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0], | ||
// Slug field is not available with GraphQL | ||
// The REST API does not include a `data` property if the data | ||
@@ -15,0 +16,0 @@ // object is empty. |
@@ -1,2 +0,2 @@ | ||
const version = "2.8.0"; | ||
const version = "2.9.0-alpha.0"; | ||
export { | ||
@@ -3,0 +3,0 @@ version |
@@ -97,2 +97,10 @@ import * as React from "react"; | ||
auto?: ("true" | "enhance" | "format" | "redeye" | "compress")[] | null | undefined; | ||
bgRemoveFallback?: boolean | null | undefined; | ||
bgRemove?: boolean | null | undefined; | ||
backgroundRemove?: boolean | null | undefined; | ||
bgReplaceFallback?: boolean | null | undefined; | ||
bgReplaceNegPrompt?: string | null | undefined; | ||
backgroundReplaceNegativePrompt?: string | null | undefined; | ||
bgReplace?: string | null | undefined; | ||
backgroundReplace?: string | null | undefined; | ||
bg?: string | null | undefined; | ||
@@ -154,3 +162,3 @@ blendAlign?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
crop?: ("faces" | "top" | "bottom" | "left" | "right" | "entropy" | "edges" | "focalpoint")[] | null | undefined; | ||
cs?: "srgb" | "adobergb1998" | "tinysrgb" | "strip" | null | undefined; | ||
cs?: "origin" | "srgb" | "adobergb1998" | "tinysrgb" | "strip" | null | undefined; | ||
dl?: string | null | undefined; | ||
@@ -168,3 +176,21 @@ dpi?: number | null | undefined; | ||
fillcolor?: string | null | undefined; | ||
fill?: "blur" | "solid" | null | undefined; | ||
fillGenFallback?: boolean | null | undefined; | ||
fillGenerativeFallback?: boolean | null | undefined; | ||
fillGenNegPrompt?: string | null | undefined; | ||
fillGenerativeNegativePrompt?: string | null | undefined; | ||
fillGenPos?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
fillGenerativePosition?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
fillGenPrompt?: string | null | undefined; | ||
fillGenerativePrompt?: string | null | undefined; | ||
fillGenSeed?: number | null | undefined; | ||
fillGenerativeSeed?: number | null | undefined; | ||
fillGradientCs?: "srgb" | "linear" | "oklab" | "hsl" | "lch" | null | undefined; | ||
fillGradientLinearDirection?: ("top" | "bottom" | "left" | "right")[] | null | undefined; | ||
fillGradientLinear?: [string, string] | null | undefined; | ||
fillGradientRadialRadius?: [number, number] | null | undefined; | ||
fillGradientRadialX?: number | null | undefined; | ||
fillGradientRadialY?: number | null | undefined; | ||
fillGradientRadial?: [string, string] | null | undefined; | ||
fillGradientType?: "linear" | "radial" | null | undefined; | ||
fill?: "blur" | "solid" | "gen" | "generative" | "gradient" | null | undefined; | ||
fit?: "crop" | "fill" | "clamp" | "clip" | "scale" | "max" | "facearea" | "fillmax" | "min" | null | undefined; | ||
@@ -178,3 +204,7 @@ f?: "crop" | "fill" | "clamp" | "clip" | "scale" | "max" | "facearea" | "fillmax" | "min" | null | undefined; | ||
fpZ?: number | null | undefined; | ||
fps?: number | null | undefined; | ||
frame?: number | import("imgix-url-builder/dist/types.generated").Range | null | undefined; | ||
gam?: number | null | undefined; | ||
gifQ?: number | null | undefined; | ||
gifq?: number | null | undefined; | ||
gridColors?: [string, string] | null | undefined; | ||
@@ -187,5 +217,9 @@ gridSize?: number | null | undefined; | ||
hue?: number | null | undefined; | ||
interval?: number | null | undefined; | ||
invert?: boolean | null | undefined; | ||
inv?: boolean | null | undefined; | ||
iptc?: "allow" | "block" | null | undefined; | ||
jpgProgressive?: boolean | null | undefined; | ||
jpegProgressive?: boolean | null | undefined; | ||
loop?: number | null | undefined; | ||
lossless?: boolean | null | undefined; | ||
@@ -258,2 +292,3 @@ markAlign?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
rect?: [number | "left" | "right" | "center", number | "top" | "bottom" | "middle", number, number] | null | undefined; | ||
reverse?: boolean | null | undefined; | ||
rot?: number | null | undefined; | ||
@@ -264,2 +299,4 @@ sat?: number | null | undefined; | ||
sharp?: number | null | undefined; | ||
skip?: number | null | undefined; | ||
svgSanitize?: boolean | null | undefined; | ||
transparency?: "grid" | null | undefined; | ||
@@ -295,4 +332,2 @@ trimColor?: string | null | undefined; | ||
txtlead?: number | null | undefined; | ||
txtLig?: 0 | 1 | 2 | null | undefined; | ||
txtlig?: 0 | 1 | 2 | null | undefined; | ||
txtLineColor?: string | null | undefined; | ||
@@ -319,4 +354,10 @@ txtlinecolor?: string | null | undefined; | ||
txtwidth?: number | null | undefined; | ||
txtX?: number | null | undefined; | ||
txtx?: number | null | undefined; | ||
txtY?: number | null | undefined; | ||
txty?: number | null | undefined; | ||
txt?: string | null | undefined; | ||
t?: string | null | undefined; | ||
upscaleFallback?: boolean | null | undefined; | ||
upscale?: boolean | null | undefined; | ||
usm?: number | null | undefined; | ||
@@ -374,2 +415,10 @@ usmrad?: number | null | undefined; | ||
auto?: ("true" | "enhance" | "format" | "redeye" | "compress")[] | null | undefined; | ||
bgRemoveFallback?: boolean | null | undefined; | ||
bgRemove?: boolean | null | undefined; | ||
backgroundRemove?: boolean | null | undefined; | ||
bgReplaceFallback?: boolean | null | undefined; | ||
bgReplaceNegPrompt?: string | null | undefined; | ||
backgroundReplaceNegativePrompt?: string | null | undefined; | ||
bgReplace?: string | null | undefined; | ||
backgroundReplace?: string | null | undefined; | ||
bg?: string | null | undefined; | ||
@@ -431,3 +480,3 @@ blendAlign?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
crop?: ("faces" | "top" | "bottom" | "left" | "right" | "entropy" | "edges" | "focalpoint")[] | null | undefined; | ||
cs?: "srgb" | "adobergb1998" | "tinysrgb" | "strip" | null | undefined; | ||
cs?: "origin" | "srgb" | "adobergb1998" | "tinysrgb" | "strip" | null | undefined; | ||
dl?: string | null | undefined; | ||
@@ -445,3 +494,21 @@ dpi?: number | null | undefined; | ||
fillcolor?: string | null | undefined; | ||
fill?: "blur" | "solid" | null | undefined; | ||
fillGenFallback?: boolean | null | undefined; | ||
fillGenerativeFallback?: boolean | null | undefined; | ||
fillGenNegPrompt?: string | null | undefined; | ||
fillGenerativeNegativePrompt?: string | null | undefined; | ||
fillGenPos?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
fillGenerativePosition?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
fillGenPrompt?: string | null | undefined; | ||
fillGenerativePrompt?: string | null | undefined; | ||
fillGenSeed?: number | null | undefined; | ||
fillGenerativeSeed?: number | null | undefined; | ||
fillGradientCs?: "srgb" | "linear" | "oklab" | "hsl" | "lch" | null | undefined; | ||
fillGradientLinearDirection?: ("top" | "bottom" | "left" | "right")[] | null | undefined; | ||
fillGradientLinear?: [string, string] | null | undefined; | ||
fillGradientRadialRadius?: [number, number] | null | undefined; | ||
fillGradientRadialX?: number | null | undefined; | ||
fillGradientRadialY?: number | null | undefined; | ||
fillGradientRadial?: [string, string] | null | undefined; | ||
fillGradientType?: "linear" | "radial" | null | undefined; | ||
fill?: "blur" | "solid" | "gen" | "generative" | "gradient" | null | undefined; | ||
fit?: "crop" | "fill" | "clamp" | "clip" | "scale" | "max" | "facearea" | "fillmax" | "min" | null | undefined; | ||
@@ -455,3 +522,7 @@ f?: "crop" | "fill" | "clamp" | "clip" | "scale" | "max" | "facearea" | "fillmax" | "min" | null | undefined; | ||
fpZ?: number | null | undefined; | ||
fps?: number | null | undefined; | ||
frame?: number | import("imgix-url-builder/dist/types.generated").Range | null | undefined; | ||
gam?: number | null | undefined; | ||
gifQ?: number | null | undefined; | ||
gifq?: number | null | undefined; | ||
gridColors?: [string, string] | null | undefined; | ||
@@ -464,5 +535,9 @@ gridSize?: number | null | undefined; | ||
hue?: number | null | undefined; | ||
interval?: number | null | undefined; | ||
invert?: boolean | null | undefined; | ||
inv?: boolean | null | undefined; | ||
iptc?: "allow" | "block" | null | undefined; | ||
jpgProgressive?: boolean | null | undefined; | ||
jpegProgressive?: boolean | null | undefined; | ||
loop?: number | null | undefined; | ||
lossless?: boolean | null | undefined; | ||
@@ -535,2 +610,3 @@ markAlign?: ("top" | "bottom" | "middle" | "left" | "right" | "center")[] | null | undefined; | ||
rect?: [number | "left" | "right" | "center", number | "top" | "bottom" | "middle", number, number] | null | undefined; | ||
reverse?: boolean | null | undefined; | ||
rot?: number | null | undefined; | ||
@@ -541,2 +617,4 @@ sat?: number | null | undefined; | ||
sharp?: number | null | undefined; | ||
skip?: number | null | undefined; | ||
svgSanitize?: boolean | null | undefined; | ||
transparency?: "grid" | null | undefined; | ||
@@ -572,4 +650,2 @@ trimColor?: string | null | undefined; | ||
txtlead?: number | null | undefined; | ||
txtLig?: 0 | 1 | 2 | null | undefined; | ||
txtlig?: 0 | 1 | 2 | null | undefined; | ||
txtLineColor?: string | null | undefined; | ||
@@ -596,4 +672,10 @@ txtlinecolor?: string | null | undefined; | ||
txtwidth?: number | null | undefined; | ||
txtX?: number | null | undefined; | ||
txtx?: number | null | undefined; | ||
txtY?: number | null | undefined; | ||
txty?: number | null | undefined; | ||
txt?: string | null | undefined; | ||
t?: string | null | undefined; | ||
upscaleFallback?: boolean | null | undefined; | ||
upscale?: boolean | null | undefined; | ||
usm?: number | null | undefined; | ||
@@ -600,0 +682,0 @@ usmrad?: number | null | undefined; |
@@ -5,3 +5,2 @@ 'use client'; | ||
import { getToolbarSrc } from './_node_modules/@prismicio/client/dist/getToolbarSrc.js'; | ||
import "@prismicio/richtext"; | ||
const PrismicToolbar = ({ repositoryName }) => { | ||
@@ -8,0 +7,0 @@ const src = getToolbarSrc(repositoryName); |
@@ -30,3 +30,3 @@ import * as React from "react"; | ||
} | ||
export type PrismicLinkProps<InternalComponentProps = React.ComponentProps<typeof defaultComponent>, ExternalComponentProps = React.ComponentProps<typeof defaultComponent>> = Omit<InternalComponentProps & ExternalComponentProps, "rel" | "href"> & { | ||
export type PrismicLinkProps<InternalComponentProps = React.ComponentProps<typeof defaultComponent>, ExternalComponentProps = React.ComponentProps<typeof defaultComponent>> = Omit<InternalComponentProps & ExternalComponentProps, "rel" | "href" | "children"> & { | ||
/** | ||
@@ -58,2 +58,7 @@ * The `rel` attribute for the link. By default, `"noreferrer"` is provided if | ||
externalComponent?: React.ComponentType<ExternalComponentProps>; | ||
/** | ||
* The children to render for the link. If no children are provided, the | ||
* link's `text` property will be used. | ||
*/ | ||
children?: React.ReactNode; | ||
} & ({ | ||
@@ -60,0 +65,0 @@ document: PrismicDocument | null | undefined; |
import { jsx } from "react/jsx-runtime"; | ||
import * as React from "react"; | ||
import { asLinkAttrs } from './../_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js'; | ||
import "@prismicio/richtext"; | ||
import { devMsg } from "../lib/devMsg.js"; | ||
import { isInternalURL } from "../lib/isInternalURL.js"; | ||
const defaultComponent = "a"; | ||
const PrismicLink = React.forwardRef(function PrismicLink2({ field, document: doc, linkResolver, internalComponent, externalComponent, ...restProps }, ref) { | ||
const PrismicLink = React.forwardRef(function PrismicLink2(props, ref) { | ||
const { field, document: doc, linkResolver, internalComponent, externalComponent, children, ...restProps } = props; | ||
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") { | ||
@@ -15,3 +15,3 @@ if (field) { | ||
throw new Error(`[PrismicLink] The provided field is missing required properties to properly render a link. The link will not render. For more details, see ${devMsg("missing-link-properties")}`); | ||
} else if (Object.keys(field).length > 1 && !("url" in field || "uid" in field || "id" in field)) { | ||
} else if (("text" in field ? Object.keys(field).length > 2 : Object.keys(field).length > 1) && !("url" in field || "uid" in field || "id" in field)) { | ||
console.warn(`[PrismicLink] The provided field is missing required properties to properly render a link. The link may not render correctly. For more details, see ${devMsg("missing-link-properties")}`, field); | ||
@@ -37,3 +37,3 @@ } | ||
const Component = href && isInternalURL(href) ? InternalComponent : ExternalComponent; | ||
return /* @__PURE__ */ jsx(Component, { ref, ...attrs, ...restProps, href, rel }); | ||
return /* @__PURE__ */ jsx(Component, { ref, ...attrs, ...restProps, href, rel, children: "children" in props ? children : field == null ? void 0 : field.text }); | ||
}); | ||
@@ -40,0 +40,0 @@ export { |
{ | ||
"name": "@prismicio/react", | ||
"version": "2.8.0", | ||
"version": "2.9.0-alpha.0", | ||
"description": "React components and hooks to fetch and present Prismic content", | ||
@@ -72,4 +72,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@prismicio/client": "^7.1.0", | ||
"@prismicio/mock": "^0.3.1", | ||
"@prismicio/client": "7.9.0-alpha.3", | ||
"@prismicio/mock": "0.3.8-alpha.2", | ||
"@size-limit/preset-small-lib": "^8.2.4", | ||
@@ -115,3 +115,7 @@ "@testing-library/react": "^14.0.0", | ||
"access": "public" | ||
}, | ||
"overrides": { | ||
"@prismicio/client": "7.9.0-alpha.3", | ||
"@prismicio/mock": "0.3.8-alpha.2" | ||
} | ||
} |
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
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
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
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
507687
193
6479
2