@sanity/vision 6.20.0-next.58 → 6.20.0-next.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/CodeDiff-Bj_o50Qy.js +60 -0
- package/lib/CodeDiff-Bj_o50Qy.js.map +1 -0
- package/lib/{SanityVision-CzPeT0iH.js → SanityVision-egTyQq4i.js} +1025 -379
- package/lib/SanityVision-egTyQq4i.js.map +1 -0
- package/lib/VistaGui-DdELkwzW.js +13989 -0
- package/lib/VistaGui-DdELkwzW.js.map +1 -0
- package/lib/bundle.css +724 -88
- package/lib/{i18n-t8J2mRUI.js → i18n-JS8KzGj8.js} +2 -2
- package/lib/{i18n-t8J2mRUI.js.map → i18n-JS8KzGj8.js.map} +1 -1
- package/lib/index.d.ts +754 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/resources-DFprICyb.js +878 -0
- package/lib/resources-DFprICyb.js.map +1 -0
- package/package.json +14 -4
- package/lib/SanityVision-CzPeT0iH.js.map +0 -1
- package/lib/resources-CIlR0qy4.js +0 -146
- package/lib/resources-CIlR0qy4.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useTheme_v2 } from "@sanity/ui";
|
|
4
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { FileDiff } from "@pierre/diffs";
|
|
7
|
+
/**
|
|
8
|
+
* Line diff of two texts, rendered by `@pierre/diffs` (Shiki highlighting in a shadow root).
|
|
9
|
+
* Only loaded through `lazy()` once a history entry's changes are expanded.
|
|
10
|
+
*/
|
|
11
|
+
function CodeDiff(t0) {
|
|
12
|
+
let $ = c(19), { previous, next, lang } = t0, { color, font } = useTheme_v2(), codeSize = font.code.sizes[1], wrapperRef = useRef(null), t1 = `diff.${lang}`, t2;
|
|
13
|
+
$[0] !== lang || $[1] !== previous || $[2] !== t1 ? (t2 = {
|
|
14
|
+
name: t1,
|
|
15
|
+
contents: previous,
|
|
16
|
+
lang
|
|
17
|
+
}, $[0] = lang, $[1] = previous, $[2] = t1, $[3] = t2) : t2 = $[3];
|
|
18
|
+
let oldFile = t2, t3 = `diff.${lang}`, t4;
|
|
19
|
+
$[4] !== lang || $[5] !== next || $[6] !== t3 ? (t4 = {
|
|
20
|
+
name: t3,
|
|
21
|
+
contents: next,
|
|
22
|
+
lang
|
|
23
|
+
}, $[4] = lang, $[5] = next, $[6] = t3, $[7] = t4) : t4 = $[7];
|
|
24
|
+
let newFile = t4, themeType = color._dark ? "dark" : "light", t5, t6;
|
|
25
|
+
$[8] !== newFile || $[9] !== oldFile || $[10] !== themeType ? (t5 = () => {
|
|
26
|
+
let wrapper = wrapperRef.current;
|
|
27
|
+
if (!wrapper) return;
|
|
28
|
+
let diff = new FileDiff({
|
|
29
|
+
diffStyle: "unified",
|
|
30
|
+
disableErrorHandling: !0,
|
|
31
|
+
disableFileHeader: !0,
|
|
32
|
+
lineDiffType: "word",
|
|
33
|
+
overflow: "wrap",
|
|
34
|
+
themeType
|
|
35
|
+
});
|
|
36
|
+
return diff.render({
|
|
37
|
+
containerWrapper: wrapper,
|
|
38
|
+
newFile,
|
|
39
|
+
oldFile
|
|
40
|
+
}), () => diff.cleanUp();
|
|
41
|
+
}, t6 = [
|
|
42
|
+
newFile,
|
|
43
|
+
oldFile,
|
|
44
|
+
themeType
|
|
45
|
+
], $[8] = newFile, $[9] = oldFile, $[10] = themeType, $[11] = t5, $[12] = t6) : (t5 = $[11], t6 = $[12]), useEffect(t5, t6);
|
|
46
|
+
let t7 = `${codeSize.fontSize}px`, t8 = `${codeSize.lineHeight}px`, t9;
|
|
47
|
+
$[13] !== font.code.family || $[14] !== t7 || $[15] !== t8 ? (t9 = assignInlineVars({
|
|
48
|
+
"--diffs-font-family": font.code.family,
|
|
49
|
+
"--diffs-font-size": t7,
|
|
50
|
+
"--diffs-line-height": t8
|
|
51
|
+
}), $[13] = font.code.family, $[14] = t7, $[15] = t8, $[16] = t9) : t9 = $[16];
|
|
52
|
+
let t10;
|
|
53
|
+
return $[17] === t9 ? t10 = $[18] : (t10 = /* @__PURE__ */ jsx("div", {
|
|
54
|
+
ref: wrapperRef,
|
|
55
|
+
style: t9
|
|
56
|
+
}), $[17] = t9, $[18] = t10), t10;
|
|
57
|
+
}
|
|
58
|
+
export { CodeDiff as default };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=CodeDiff-Bj_o50Qy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeDiff-Bj_o50Qy.js","names":["{previous, next, lang}: CodeDiffProps","{name: `diff.${lang}`, contents: previous, lang}","`diff.${lang}`","useMemo<FileContents>(\n () => ({name: `diff.${lang}`, contents: previous, lang}),\n [lang, previous],\n )","{name: `diff.${lang}`, contents: next, lang}","useMemo<FileContents>(\n () => ({name: `diff.${lang}`, contents: next, lang}),\n [lang, next],\n )","() => {\n const wrapper = wrapperRef.current\n if (!wrapper) return undefined\n const diff = new FileDiff({\n diffStyle: 'unified',\n // Thrown from `render` in this effect, a failure reaches the History panel's error\n // boundary and its Retry, rather than being drawn as a stack trace inside the diff\n disableErrorHandling: true,\n disableFileHeader: true,\n lineDiffType: 'word',\n overflow: 'wrap',\n themeType,\n })\n diff.render({containerWrapper: wrapper, newFile, oldFile})\n return () => diff.cleanUp()\n }","[newFile, oldFile, themeType]","assignInlineVars({\n '--diffs-font-family': font.code.family,\n '--diffs-font-size': `${codeSize.fontSize}px`,\n '--diffs-line-height': `${codeSize.lineHeight}px`,\n })","family","`${codeSize.fontSize}px`","`${codeSize.lineHeight}px`","<div\n ref={wrapperRef}\n style={assignInlineVars({\n '--diffs-font-family': font.code.family,\n '--diffs-font-size': `${codeSize.fontSize}px`,\n '--diffs-line-height': `${codeSize.lineHeight}px`,\n })}\n />","_c","useThemeV2"],"sources":["../src/vista/components/response/CodeDiff.tsx"],"sourcesContent":["import {type FileContents, FileDiff} from '@pierre/diffs'\nimport {useTheme_v2 as useThemeV2} from '@sanity/ui'\nimport {assignInlineVars} from '@vanilla-extract/dynamic'\nimport {useEffect, useMemo, useRef} from 'react'\n\nexport interface CodeDiffProps {\n previous: string\n next: string\n lang: 'json' | 'text'\n}\n\n/**\n * Line diff of two texts, rendered by `@pierre/diffs` (Shiki highlighting in a shadow root).\n * Only loaded through `lazy()` once a history entry's changes are expanded.\n */\nexport default function CodeDiff({previous, next, lang}: CodeDiffProps) {\n const {color, font} = useThemeV2()\n const codeSize = font.code.sizes[1]\n const wrapperRef = useRef<HTMLDivElement>(null)\n const oldFile = useMemo<FileContents>(\n () => ({name: `diff.${lang}`, contents: previous, lang}),\n [lang, previous],\n )\n const newFile = useMemo<FileContents>(\n () => ({name: `diff.${lang}`, contents: next, lang}),\n [lang, next],\n )\n const themeType = color._dark ? 'dark' : 'light'\n\n // The library's React components keep their container and hydrate whatever markup a previous\n // instance left in it, so after StrictMode detaches and re-attaches their ref they render\n // nothing. An instance per effect run with a container of its own (removed on clean up) has no\n // such markup to find\n useEffect(() => {\n const wrapper = wrapperRef.current\n if (!wrapper) return undefined\n const diff = new FileDiff({\n diffStyle: 'unified',\n // Thrown from `render` in this effect, a failure reaches the History panel's error\n // boundary and its Retry, rather than being drawn as a stack trace inside the diff\n disableErrorHandling: true,\n disableFileHeader: true,\n lineDiffType: 'word',\n overflow: 'wrap',\n themeType,\n })\n diff.render({containerWrapper: wrapper, newFile, oldFile})\n return () => diff.cleanUp()\n }, [newFile, oldFile, themeType])\n\n return (\n <div\n ref={wrapperRef}\n style={assignInlineVars({\n '--diffs-font-family': font.code.family,\n '--diffs-font-size': `${codeSize.fontSize}px`,\n '--diffs-line-height': `${codeSize.lineHeight}px`,\n })}\n />\n )\n}\n"],"mappings":";;;;;;;;;;AAeA,SAAwB,SAAA,IAAgD;C,eAAvC,EAAC,UAAU,MAAM,SAAjBA,IACzB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