sanity-plugin-latex-input 3.0.2 → 3.0.3

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/dist/index.js CHANGED
@@ -1,49 +1,32 @@
1
- import { defineType, definePlugin } from "sanity";
2
- import { jsx } from "react/jsx-runtime";
1
+ import { definePlugin, defineType } from "sanity";
3
2
  import { c } from "react/compiler-runtime";
4
3
  import { renderToString } from "katex";
5
4
  import "react";
6
5
  import "katex/dist/katex.min.css";
6
+ import { jsx } from "react/jsx-runtime";
7
7
  const LatexPreview = (props) => {
8
- const $ = c(6), latex = props?.body || "", isInline = props.layout === "inline", t0 = !isInline;
9
- let t1;
10
- $[0] !== latex || $[1] !== t0 ? (t1 = renderToString(latex, {
11
- displayMode: t0,
12
- throwOnError: !1
13
- }), $[0] = latex, $[1] = t0, $[2] = t1) : t1 = $[2];
14
- const html = t1;
15
- let t2;
16
- return $[3] !== html || $[4] !== isInline ? (t2 = isInline ? /* @__PURE__ */ jsx("span", { dangerouslySetInnerHTML: {
17
- __html: html
18
- } }) : /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: {
19
- __html: html
20
- } }), $[3] = html, $[4] = isInline, $[5] = t2) : t2 = $[5], t2;
8
+ let $ = c(6), latex = props?.body || "", isInline = props.layout === "inline", t0 = !isInline, t1;
9
+ $[0] !== latex || $[1] !== t0 ? (t1 = renderToString(latex, {
10
+ displayMode: t0,
11
+ throwOnError: !1
12
+ }), $[0] = latex, $[1] = t0, $[2] = t1) : t1 = $[2];
13
+ let html = t1, t2;
14
+ return $[3] !== html || $[4] !== isInline ? (t2 = jsx(isInline ? "span" : "div", { dangerouslySetInnerHTML: { __html: html } }), $[3] = html, $[4] = isInline, $[5] = t2) : t2 = $[5], t2;
21
15
  }, latexSchema = defineType({
22
- title: "Latex",
23
- type: "object",
24
- name: "latex",
25
- components: {
26
- preview: LatexPreview
27
- },
28
- fields: [{
29
- title: "LaTeX content",
30
- name: "body",
31
- type: "text"
32
- }],
33
- preview: {
34
- select: {
35
- body: "body"
36
- }
37
- }
16
+ title: "Latex",
17
+ type: "object",
18
+ name: "latex",
19
+ components: { preview: LatexPreview },
20
+ fields: [{
21
+ title: "LaTeX content",
22
+ name: "body",
23
+ type: "text"
24
+ }],
25
+ preview: { select: { body: "body" } }
38
26
  }), latexInput = definePlugin({
39
- name: "latex-block-plugin",
40
- schema: {
41
- types: [latexSchema]
42
- }
27
+ name: "latex-block-plugin",
28
+ schema: { types: [latexSchema] }
43
29
  });
44
- export {
45
- LatexPreview,
46
- latexInput,
47
- latexSchema
48
- };
49
- //# sourceMappingURL=index.js.map
30
+ export { LatexPreview, latexInput, latexSchema };
31
+
32
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import {renderToString} from 'katex'\nimport {useMemo} from 'react'\n\nimport 'katex/dist/katex.min.css'\n\nexport interface LatexPreviewProps {\n body?: string\n layout?: string\n}\n\n// KaTeX's renderToString sanitizes its output and does not execute scripts,\n// making it safe to use with dangerouslySetInnerHTML for trusted LaTeX source content.\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || ''\n const isInline = props.layout === 'inline'\n\n const html = useMemo(\n () =>\n renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n }),\n [latex, isInline],\n )\n\n return isInline ? (\n <span dangerouslySetInnerHTML={{__html: html}} />\n ) : (\n <div dangerouslySetInnerHTML={{__html: html}} />\n )\n}\n","import {defineType, type ObjectDefinition} from 'sanity'\n\nimport {LatexPreview} from './components/LatexPreview'\n\nconst latexTypeName = 'latex' as const\n\n/**\n * @public\n */\nexport interface LatexDefinition extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName\n}\n\ndeclare module 'sanity' {\n // makes type: 'latex' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n latex: LatexDefinition\n }\n}\n\nexport const latexSchema = defineType({\n title: 'Latex',\n type: 'object',\n name: 'latex',\n components: {preview: LatexPreview},\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n },\n})\n","import {definePlugin} from 'sanity'\n\nimport {latexSchema} from './schema'\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n})\n"],"names":["LatexPreview","props","$","_c","latex","body","isInline","layout","t0","t1","renderToString","displayMode","throwOnError","html","t2","__html","latexSchema","defineType","title","type","name","components","preview","fields","select","latexInput","definePlugin","schema","types"],"mappings":";;;;;;AAYO,MAAMA,eAAeC,CAAAA,UAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAC1BC,QAAcH,OAAKI,QAAL,IACdC,WAAiBL,MAAKM,WAAY,UAKfC,MAACF;AAAQ,MAAAG;AAAAP,IAAA,CAAA,MAAAE,SAAAF,SAAAM,MADxBC,KAAAC,eAAeN,OAAO;AAAA,IAAAO,aACPH;AAAAA,IAASI,cACR;AAAA,EAAA,CACf,GAACV,OAAAE,OAAAF,OAAAM,IAAAN,OAAAO,MAAAA,KAAAP,EAAA,CAAA;AALN,QAAAW,OAEIJ;AAKH,MAAAK;AAAA,SAAAZ,EAAA,CAAA,MAAAW,QAAAX,SAAAI,YAEMQ,KAAAR,WACL,oBAAA,QAAA,EAA+B,yBAAA;AAAA,IAAAS,QAASF;AAAAA,EAAAA,EAAI,CAAC,IAE7C,oBAAA,OAAA,EAA8B,yBAAA;AAAA,IAAAE,QAASF;AAAAA,EAAAA,GAAK,GAC7CX,OAAAW,MAAAX,OAAAI,UAAAJ,OAAAY,MAAAA,KAAAZ,EAAA,CAAA,GAJMY;AAIN,GCTUE,cAAcC,WAAW;AAAA,EACpCC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,MAAM;AAAA,EACNC,YAAY;AAAA,IAACC,SAAStB;AAAAA,EAAAA;AAAAA,EACtBuB,QAAQ,CACN;AAAA,IACEL,OAAO;AAAA,IACPE,MAAM;AAAA,IACND,MAAM;AAAA,EAAA,CACP;AAAA,EAEHG,SAAS;AAAA,IACPE,QAAQ;AAAA,MACNnB,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ,CAAC,GCjCYoB,aAAaC,aAAa;AAAA,EACrCN,MAAM;AAAA,EACNO,QAAQ;AAAA,IACNC,OAAO,CAACZ,WAAW;AAAA,EAAA;AAEvB,CAAC;"}
1
+ {"version":3,"file":"index.js","names":["renderToString","useMemo","LatexPreviewProps","body","layout","LatexPreview","props","$","_c","latex","isInline","t0","t1","displayMode","throwOnError","html","t2","__html","defineType","ObjectDefinition","LatexPreview","latexTypeName","const","LatexDefinition","Omit","type","IntrinsicDefinitions","latex","latexSchema","title","name","components","preview","fields","select","body","definePlugin","latexSchema","latexInput","name","schema","types"],"sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import {renderToString} from 'katex'\nimport {useMemo} from 'react'\n\nimport 'katex/dist/katex.min.css'\n\nexport interface LatexPreviewProps {\n body?: string\n layout?: string\n}\n\n// KaTeX's renderToString sanitizes its output and does not execute scripts,\n// making it safe to use with dangerouslySetInnerHTML for trusted LaTeX source content.\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || ''\n const isInline = props.layout === 'inline'\n\n const html = useMemo(\n () =>\n renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n }),\n [latex, isInline],\n )\n\n return isInline ? (\n <span dangerouslySetInnerHTML={{__html: html}} />\n ) : (\n <div dangerouslySetInnerHTML={{__html: html}} />\n )\n}\n","import {defineType, type ObjectDefinition} from 'sanity'\n\nimport {LatexPreview} from './components/LatexPreview'\n\nconst latexTypeName = 'latex' as const\n\n/**\n * @public\n */\nexport interface LatexDefinition extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName\n}\n\ndeclare module 'sanity' {\n // makes type: 'latex' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n latex: LatexDefinition\n }\n}\n\nexport const latexSchema = defineType({\n title: 'Latex',\n type: 'object',\n name: 'latex',\n components: {preview: LatexPreview},\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n },\n})\n","import {definePlugin} from 'sanity'\n\nimport {latexSchema} from './schema'\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n})\n"],"mappings":";;;;;;AAYA,MAAaK,gBAAeC,UAAA;CAAA,IAAAC,IAAAC,EAAA,CAAA,GAC1BC,QAAcH,OAAKH,QAAL,IACdO,WAAiBJ,MAAKF,WAAY,UAKfO,KAAA,CAACD,UAAQE;CAAA,AAAAL,EAAA,OAAAE,SAAAF,EAAA,OAAAI,MADxBC,KAAAZ,eAAeS,OAAO;EAAAI,aACPF;EAASG,cACR;CAChB,CAAC,GAACP,EAAA,KAAAE,OAAAF,EAAA,KAAAI,IAAAJ,EAAA,KAAAK,MAAAA,KAAAL,EAAA;CALN,IAAAQ,OAEIH,IAKHI;CAMA,OANAT,EAAA,OAAAQ,QAAAR,EAAA,OAAAG,YAEMM,KACL,IADKN,WACL,SAEA,OAFA,EAA+B,yBAAA,EAAAO,QAASF,KAAI,EAAC,CAED,GAC7CR,EAAA,KAAAQ,MAAAR,EAAA,KAAAG,UAAAH,EAAA,KAAAS,MAAAA,KAAAT,EAAA,IAJMS;AAIN,GCTUY,cAAcV,WAAW;CACpCW,OAAO;CACPJ,MAAM;CACNK,MAAM;CACNC,YAAY,EAACC,SAASZ,aAAY;CAClCa,QAAQ,CACN;EACEJ,OAAO;EACPC,MAAM;EACNL,MAAM;CACR,CAAC;CAEHO,SAAS,EACPE,QAAQ,EACNC,MAAM,OACR,EACF;AACF,CAAC,GCjCYG,aAAaF,aAAa;CACrCG,MAAM;CACNC,QAAQ,EACNC,OAAO,CAACJ,WAAW,EACrB;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-latex-input",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "LaTeX input for Portable Text Editor in Sanity Studio.",
5
5
  "keywords": [
6
6
  "latex",
@@ -31,15 +31,15 @@
31
31
  "katex": "^0.17.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@sanity/pkg-utils": "^10.9.0",
35
- "@sanity/tsconfig": "^2.1.0",
34
+ "@sanity/tsconfig": "^2.2.0",
35
+ "@sanity/tsdown-config": "^0.11.0",
36
36
  "@types/react": "^19.2.17",
37
37
  "@types/react-dom": "^19.2.3",
38
38
  "babel-plugin-react-compiler": "^1.0.0",
39
39
  "react": "^19.2.7",
40
40
  "react-dom": "^19.2.7",
41
41
  "sanity": "^6.3.0",
42
- "@repo/package.config": "0.0.0"
42
+ "tsdown": "^0.22.3"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "react": "^19.2",
@@ -50,6 +50,6 @@
50
50
  "node": ">=20.19 <22 || >=22.12"
51
51
  },
52
52
  "scripts": {
53
- "build": "pkg build --strict --check --clean"
53
+ "build": "tsdown"
54
54
  }
55
55
  }