@sanity/react-loader
Advanced tools
Comparing version 0.3.5-pink-lizard to 0.4.0-pink-lizard
# Changelog | ||
## [0.4.0-pink-lizard](https://github.com/sanity-io/visual-editing/compare/react-loader-v0.3.5-pink-lizard...react-loader-v0.4.0-pink-lizard) (2023-11-04) | ||
### Features | ||
* use the new `@sanity/client/stega` features ([#252](https://github.com/sanity-io/visual-editing/issues/252)) ([fa08bb2](https://github.com/sanity-io/visual-editing/commit/fa08bb24e6413bfa49adb79df256217e06ed0844)) | ||
### Bug Fixes | ||
* handle stega nodes in a way that supports focus ([#254](https://github.com/sanity-io/visual-editing/issues/254)) ([dce801f](https://github.com/sanity-io/visual-editing/commit/dce801f3b76e6e2bb0597345b5deacc2038e6fec)) | ||
## [0.3.5-pink-lizard](https://github.com/sanity-io/visual-editing/compare/react-loader-v0.3.4-pink-lizard...react-loader-v0.3.5-pink-lizard) (2023-11-03) | ||
@@ -4,0 +16,0 @@ |
@@ -218,4 +218,4 @@ import { Any } from '@sanity/client/csm' | ||
export declare type SanityNode = { | ||
projectId: string | ||
dataset: string | ||
projectId?: string | ||
dataset?: string | ||
id: string | ||
@@ -222,0 +222,0 @@ path: string |
import { forwardRef, createElement } from 'react'; | ||
import { resolveMapping, parseJsonPath, jsonPath } from '@sanity/client/csm'; | ||
import { simplifyPath, resolveMapping, resolvedKeyedSourcePath } from '@sanity/client/csm'; | ||
const htmlElements = ["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "u", "ul", "var", "video", "wbr", "webview"]; | ||
@@ -392,26 +392,2 @@ | ||
} | ||
function resolvedKeyedSourcePath(options) { | ||
const { | ||
keyedResultPath, | ||
pathSuffix, | ||
sourceBasePath | ||
} = options; | ||
const inferredResultPath = pathSuffix === void 0 ? [] : parseJsonPath(pathSuffix); | ||
const inferredPath = keyedResultPath.slice(keyedResultPath.length - inferredResultPath.length); | ||
const inferredPathSuffix = inferredPath.length ? jsonPath(inferredPath, { | ||
keyArraySelectors: true | ||
}).slice(1) : ""; | ||
return parseJsonPath(sourceBasePath + inferredPathSuffix); | ||
} | ||
function simplifyPath(path) { | ||
return path.map((segment, index) => { | ||
if (typeof segment === "number") { | ||
return `[${segment}]`; | ||
} | ||
if (typeof segment === "string") { | ||
return index === 0 ? segment : `.${segment}`; | ||
} | ||
return `[_key=="${segment.key}"]`; | ||
}).join(""); | ||
} | ||
const DRAFTS_PREFIX = "drafts."; | ||
@@ -461,4 +437,4 @@ function getPublishedId(id) { | ||
const sanityNodeSchema = object({ | ||
projectId: lengthyStr, | ||
dataset: lengthyStr, | ||
projectId: optionalLengthyStr, | ||
dataset: optionalLengthyStr, | ||
id: lengthyStr, | ||
@@ -465,0 +441,0 @@ path: lengthyStr, |
{ | ||
"name": "@sanity/react-loader", | ||
"version": "0.3.5-pink-lizard", | ||
"version": "0.4.0-pink-lizard", | ||
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/react-loader#readme", | ||
@@ -123,6 +123,6 @@ "bugs": { | ||
"dependencies": { | ||
"@sanity/core-loader": "0.3.5-pink-lizard" | ||
"@sanity/core-loader": "0.4.0-pink-lizard" | ||
}, | ||
"devDependencies": { | ||
"@sanity/client": "6.7.1-pink-lizard.0", | ||
"@sanity/client": "6.7.1-pink-lizard.5", | ||
"@sanity/pkg-utils": "^3.2.2", | ||
@@ -132,3 +132,3 @@ "@types/react": "^18.2.34", | ||
"@typescript-eslint/parser": "^6.9.1", | ||
"eslint": "^8.52.0", | ||
"eslint": "^8.53.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
@@ -143,3 +143,3 @@ "eslint-plugin-prettier": "^5.0.1", | ||
"peerDependencies": { | ||
"@sanity/client": "6.7.1-pink-lizard.0", | ||
"@sanity/client": "6.7.1-pink-lizard.5", | ||
"react": "^18.2.0" | ||
@@ -146,0 +146,0 @@ }, |
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
383761
1638
+ Added@sanity/client@6.7.1-pink-lizard.5(transitive)
+ Added@sanity/core-loader@0.4.0-pink-lizard(transitive)
+ Added@sanity/groq-store@5.1.0-pink-lizard(transitive)
+ Added@vercel/stega@0.1.0(transitive)
- Removed@sanity/client@6.7.1-pink-lizard.0(transitive)
- Removed@sanity/core-loader@0.3.5-pink-lizard(transitive)
- Removed@sanity/groq-store@5.0.0-pink-lizard(transitive)