@sanity/react-loader
Advanced tools
Comparing version 0.4.1-pink-lizard to 0.4.2-pink-lizard
# Changelog | ||
## [0.4.2-pink-lizard](https://github.com/sanity-io/visual-editing/compare/react-loader-v0.4.1-pink-lizard...react-loader-v0.4.2-pink-lizard) (2023-11-07) | ||
### Bug Fixes | ||
* **deps:** update dependency @sanity/client to v6.8.0-pink-lizard.3 ([#267](https://github.com/sanity-io/visual-editing/issues/267)) ([432f47b](https://github.com/sanity-io/visual-editing/commit/432f47bdd742cc863bbeb257325690b0f2063022)) | ||
* use new `ContentSourceMapParsedPathKeyedSegment` format ([20b3186](https://github.com/sanity-io/visual-editing/commit/20b31864815aeacb4c40e6cea5311d32805c6c2e)) | ||
## [0.4.1-pink-lizard](https://github.com/sanity-io/visual-editing/compare/react-loader-v0.4.0-pink-lizard...react-loader-v0.4.1-pink-lizard) (2023-11-05) | ||
@@ -4,0 +12,0 @@ |
@@ -10,2 +10,4 @@ import { Any } from '@sanity/client/csm' | ||
import { ContentSourceMapMappings } from '@sanity/client/csm' | ||
import { ContentSourceMapParsedPath } from '@sanity/client/csm' | ||
import { ContentSourceMapParsedPathKeyedSegment } from '@sanity/client/csm' | ||
import { ContentSourceMapPaths } from '@sanity/client/csm' | ||
@@ -18,3 +20,5 @@ import { ContentSourceMapRemoteDocument } from '@sanity/client/csm' | ||
import type { HTMLProps } from 'react' | ||
import { IndexTuple } from '@sanity/client/csm' | ||
import { KeyedSegment } from '@sanity/client/csm' | ||
import { Path } from '@sanity/client/csm' | ||
import { PathSegment } from '@sanity/client/csm' | ||
@@ -42,2 +46,6 @@ import { SanityDocument } from '@sanity/client/csm' | ||
export { ContentSourceMapParsedPath } | ||
export { ContentSourceMapParsedPathKeyedSegment } | ||
export { ContentSourceMapPaths } | ||
@@ -180,4 +188,8 @@ | ||
export { IndexTuple } | ||
export { KeyedSegment } | ||
export { Path } | ||
export { PathSegment } | ||
@@ -351,4 +363,4 @@ | ||
sourceMap: ContentSourceMap | undefined, | ||
resultPath?: PathSegment[], | ||
keyedResultPath?: PathSegment[], | ||
resultPath?: ContentSourceMapParsedPath, | ||
keyedResultPath?: ContentSourceMapParsedPath, | ||
): WrappedValue<T> | ||
@@ -355,0 +367,0 @@ |
import { forwardRef, createElement } from 'react'; | ||
import { simplifyPath, resolveMapping, resolvedKeyedSourcePath } from '@sanity/client/csm'; | ||
import { getPublishedId, 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,9 +392,2 @@ | ||
} | ||
const DRAFTS_PREFIX = "drafts."; | ||
function getPublishedId(id) { | ||
if (id.startsWith(DRAFTS_PREFIX)) { | ||
return id.slice(DRAFTS_PREFIX.length); | ||
} | ||
return id; | ||
} | ||
function resolveSanityNode(context, csm, resultPath, keyedResultPath) { | ||
@@ -463,4 +456,3 @@ const { | ||
} | ||
const id = _id.startsWith("drafts.") ? _id.slice(7) : _id; | ||
const parts = [["project", projectId], ["dataset", dataset], ["id", id], ["type", type], ["path", pathToUrlString(fromString(path))], ["base", encodeURIComponent(baseUrl)], ["workspace", workspace], ["tool", tool]]; | ||
const parts = [["project", projectId], ["dataset", dataset], ["id", getPublishedId(_id)], ["type", type], ["path", pathToUrlString(fromString(path))], ["base", encodeURIComponent(baseUrl)], ["workspace", workspace], ["tool", tool]]; | ||
return parts.filter(([, value]) => !!value).map(part => part.join("=")).join(";"); | ||
@@ -499,4 +491,4 @@ } | ||
return value.map((t, idx) => wrapData(context, t, sourceMap, resultPath.concat(idx), keyedResultPath.concat(isRecord(t) && "_key" in t && typeof t._key === "string" ? { | ||
key: t._key, | ||
index: idx | ||
_key: t._key, | ||
_index: idx | ||
} : idx))); | ||
@@ -503,0 +495,0 @@ } |
{ | ||
"name": "@sanity/react-loader", | ||
"version": "0.4.1-pink-lizard", | ||
"version": "0.4.2-pink-lizard", | ||
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/react-loader#readme", | ||
@@ -123,10 +123,10 @@ "bugs": { | ||
"dependencies": { | ||
"@sanity/core-loader": "0.4.1-pink-lizard" | ||
"@sanity/core-loader": "0.4.2-pink-lizard" | ||
}, | ||
"devDependencies": { | ||
"@sanity/client": "6.8.0-pink-lizard.0", | ||
"@sanity/client": "6.8.0-pink-lizard.3", | ||
"@sanity/pkg-utils": "^3.2.3", | ||
"@types/react": "^18.2.34", | ||
"@typescript-eslint/eslint-plugin": "^6.9.1", | ||
"@typescript-eslint/parser": "^6.9.1", | ||
"@types/react": "^18.2.36", | ||
"@typescript-eslint/eslint-plugin": "^6.10.0", | ||
"@typescript-eslint/parser": "^6.10.0", | ||
"eslint": "^8.53.0", | ||
@@ -142,3 +142,3 @@ "eslint-config-prettier": "^9.0.0", | ||
"peerDependencies": { | ||
"@sanity/client": "6.8.0-pink-lizard.0", | ||
"@sanity/client": "6.8.0-pink-lizard.3", | ||
"react": "^18.2.0" | ||
@@ -145,0 +145,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
383751
1630
+ Added@sanity/client@6.8.0-pink-lizard.3(transitive)
+ Added@sanity/core-loader@0.4.2-pink-lizard(transitive)
+ Added@sanity/groq-store@5.1.2-pink-lizard(transitive)
- Removed@sanity/client@6.8.0-pink-lizard.0(transitive)
- Removed@sanity/core-loader@0.4.1-pink-lizard(transitive)
- Removed@sanity/groq-store@5.1.1-pink-lizard(transitive)