@willbooster/monaco-react 1.0.9 → 2.0.0
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/README.md +3 -0
- package/dist/DiffEditor/DiffEditor.cjs +2 -3
- package/dist/DiffEditor/DiffEditor.cjs.map +1 -1
- package/dist/DiffEditor/DiffEditor.js +2 -3
- package/dist/DiffEditor/DiffEditor.js.map +1 -1
- package/dist/DiffEditor/index.cjs +2 -2
- package/dist/DiffEditor/index.cjs.map +1 -1
- package/dist/DiffEditor/index.js +2 -2
- package/dist/DiffEditor/index.js.map +1 -1
- package/dist/DiffEditor/types.d.ts +1 -1
- package/dist/DiffEditor/types.d.ts.map +1 -1
- package/dist/Editor/Editor.cjs +2 -3
- package/dist/Editor/Editor.cjs.map +1 -1
- package/dist/Editor/Editor.js +2 -3
- package/dist/Editor/Editor.js.map +1 -1
- package/dist/Editor/index.cjs +2 -2
- package/dist/Editor/index.cjs.map +1 -1
- package/dist/Editor/index.js +2 -2
- package/dist/Editor/index.js.map +1 -1
- package/dist/Editor/types.d.ts +1 -1
- package/dist/Editor/types.d.ts.map +1 -1
- package/dist/Loading/Loading.cjs +2 -2
- package/dist/Loading/Loading.cjs.map +1 -1
- package/dist/Loading/Loading.js +2 -2
- package/dist/Loading/Loading.js.map +1 -1
- package/dist/Loading/index.cjs +2 -2
- package/dist/Loading/index.cjs.map +1 -1
- package/dist/Loading/index.js +2 -2
- package/dist/Loading/index.js.map +1 -1
- package/dist/Loading/styles.cjs +2 -2
- package/dist/Loading/styles.cjs.map +1 -1
- package/dist/Loading/styles.js +2 -2
- package/dist/Loading/styles.js.map +1 -1
- package/dist/MonacoContainer/MonacoContainer.cjs +2 -2
- package/dist/MonacoContainer/MonacoContainer.cjs.map +1 -1
- package/dist/MonacoContainer/MonacoContainer.js +2 -2
- package/dist/MonacoContainer/MonacoContainer.js.map +1 -1
- package/dist/MonacoContainer/index.cjs +2 -2
- package/dist/MonacoContainer/index.cjs.map +1 -1
- package/dist/MonacoContainer/index.js +2 -2
- package/dist/MonacoContainer/index.js.map +1 -1
- package/dist/MonacoContainer/styles.cjs +2 -2
- package/dist/MonacoContainer/styles.cjs.map +1 -1
- package/dist/MonacoContainer/styles.js +2 -2
- package/dist/MonacoContainer/styles.js.map +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/hooks/useMonaco/index.cjs +2 -2
- package/dist/hooks/useMonaco/index.cjs.map +1 -1
- package/dist/hooks/useMonaco/index.js +2 -2
- package/dist/hooks/useMonaco/index.js.map +1 -1
- package/dist/hooks/useMonaco/initMonaco.cjs +2 -2
- package/dist/hooks/useMonaco/initMonaco.cjs.map +1 -1
- package/dist/hooks/useMonaco/initMonaco.js +2 -2
- package/dist/hooks/useMonaco/initMonaco.js.map +1 -1
- package/dist/hooks/useMount/index.cjs +2 -2
- package/dist/hooks/useMount/index.cjs.map +1 -1
- package/dist/hooks/useMount/index.js +2 -2
- package/dist/hooks/useMount/index.js.map +1 -1
- package/dist/hooks/usePrevious/index.cjs +2 -2
- package/dist/hooks/usePrevious/index.cjs.map +1 -1
- package/dist/hooks/usePrevious/index.js +2 -2
- package/dist/hooks/usePrevious/index.js.map +1 -1
- package/dist/hooks/useUpdate/index.cjs +2 -2
- package/dist/hooks/useUpdate/index.cjs.map +1 -1
- package/dist/hooks/useUpdate/index.js +2 -2
- package/dist/hooks/useUpdate/index.js.map +1 -1
- package/dist/index.cjs +2 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +23 -25
- package/dist/DiffEditor/index.spec.d.ts +0 -2
- package/dist/DiffEditor/index.spec.d.ts.map +0 -1
- package/dist/Editor/index.spec.d.ts +0 -2
- package/dist/Editor/index.spec.d.ts.map +0 -1
- package/dist/Loading/index.spec.d.ts +0 -2
- package/dist/Loading/index.spec.d.ts.map +0 -1
- package/dist/MonacoContainer/index.spec.d.ts +0 -2
- package/dist/MonacoContainer/index.spec.d.ts.map +0 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.cjs +0 -2
- package/dist/_virtual/_rollupPluginBabelHelpers.cjs.map +0 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.js +0 -2
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/WillBooster/monaco-react/actions/workflows/test.yml)
|
|
4
4
|
[](https://github.com/semantic-release/semantic-release)
|
|
5
|
+
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
5
6
|
|
|
6
7
|
[](https://www.npmjs.com/package/@willbooster/monaco-react)
|
|
7
8
|
[](https://www.npmjs.com/package/@willbooster/monaco-react)
|
|
@@ -18,6 +19,8 @@ yarn add @willbooster/monaco-react
|
|
|
18
19
|
|
|
19
20
|
`react` and `react-dom` are peer dependencies. `monaco-editor` is a direct dependency for Monaco type resolution. This package supports React 19.x, Node.js 24 or newer, and is tested with Next.js 16.
|
|
20
21
|
|
|
22
|
+
TypeScript consumers need a `moduleResolution` of `bundler`, `node16`, or `nodenext`. `monaco-editor` 0.56.0 exposes its types only through its `exports` map — its legacy `typings` field points at a file that is not in the published tarball — so the legacy `node10` resolution cannot find them.
|
|
23
|
+
|
|
21
24
|
## Usage
|
|
22
25
|
|
|
23
26
|
```tsx
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=DiffEditor.cjs.map
|
|
1
|
+
"use strict";"use client";const e=require("../MonacoContainer/index.cjs"),t=require("../hooks/useMount/index.cjs"),n=require("../hooks/useUpdate/index.cjs"),r=require("../hooks/useMonaco/index.cjs"),i=require("../utils/index.cjs");let a=require("react"),o=require("react/jsx-runtime");function s(t){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:s,wrapperProps:l={}}=t;return(0,o.jsx)(a.Suspense,{fallback:(0,o.jsx)(e.default,{width:n,height:r,isEditorReady:!1,loading:i,className:s,wrapperProps:l}),children:(0,o.jsx)(c,{...t})})}function c(t){let n=r.default();if(!n){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:s={}}=t;return(0,o.jsx)(e.default,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:s})}return(0,o.jsx)(l,{...t,monaco:n})}function l({monaco:r,original:s,modified:c,language:l,originalLanguage:u,modifiedLanguage:d,originalModelPath:f,modifiedModelPath:p,keepCurrentOriginalModel:m=!1,keepCurrentModifiedModel:h=!1,theme:g=`light`,loading:_=`Loading...`,options:v={},height:y=`100%`,width:b=`100%`,className:x,wrapperProps:S={},beforeMount:C=i.noop,onMount:w=i.noop}){let[T,E]=(0,a.useState)(!1),D=(0,a.useRef)(null),O=(0,a.useRef)(r),k=(0,a.useRef)(null),A=(0,a.useRef)(w),j=(0,a.useRef)(C),M=(0,a.useRef)(!1);O.current=r,t.default(()=>()=>{D.current&&F()}),n.default(()=>{if(D.current&&O.current){let e=D.current.getOriginalEditor(),t=i.getOrCreateModel(O.current,s||``,u||l||`text`,f||``);t!==e.getModel()&&e.setModel(t)}},[f],T),n.default(()=>{if(D.current&&O.current){let e=D.current.getModifiedEditor(),t=i.getOrCreateModel(O.current,c||``,d||l||`text`,p||``);t!==e.getModel()&&e.setModel(t)}},[p],T),n.default(()=>{let e=D.current.getModifiedEditor();e.getOption(O.current.editor.EditorOption.readOnly)?e.setValue(c||``):c!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:c||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[c],T),n.default(()=>{D.current?.getModel()?.original.setValue(s||``)},[s],T),n.default(()=>{let{original:e,modified:t}=D.current.getModel();O.current.editor.setModelLanguage(e,u||l||`text`),O.current.editor.setModelLanguage(t,d||l||`text`)},[l,u,d],T),n.default(()=>{O.current?.editor.setTheme(g)},[g],T),n.default(()=>{D.current?.updateOptions(v)},[v],T);let N=(0,a.useCallback)(()=>{j.current(O.current);let e=i.getOrCreateModel(O.current,s||``,u||l||`text`,f||``),t=i.getOrCreateModel(O.current,c||``,d||l||`text`,p||``);D.current?.setModel({original:e,modified:t})},[l,c,d,s,u,f,p]),P=(0,a.useCallback)(()=>{!M.current&&k.current&&(D.current=O.current.editor.createDiffEditor(k.current,{automaticLayout:!0,...v}),N(),O.current?.editor.setTheme(g),E(!0),M.current=!0)},[v,g,N]);(0,a.useEffect)(()=>{T&&A.current(D.current,O.current)},[T]),(0,a.useEffect)(()=>{T||P()},[T,P]);function F(){let e=D.current,t=e?.getModel();e?.getOriginalEditor().setModel(null),e?.getModifiedEditor().setModel(null),e?.dispose(),!m&&t?.original&&!t.original.isDisposed()&&!t.original.isAttachedToEditor()&&t.original.dispose(),!h&&t?.modified&&!t.modified.isDisposed()&&!t.modified.isAttachedToEditor()&&t.modified.dispose(),D.current=null,M.current=!1,E(!1)}return(0,o.jsx)(e.default,{width:b,height:y,isEditorReady:T,loading:_,_ref:k,className:x,wrapperProps:S})}exports.default=s;
|
|
2
|
+
//# sourceMappingURL=DiffEditor.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiffEditor.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"DiffEditor.cjs","names":["Suspense","MonacoContainer","useMonaco","noop","getOrCreateModel"],"sources":["../../src/DiffEditor/DiffEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Suspense, useState, useRef, useCallback, useEffect } from 'react';\nimport type { ReactElement } from 'react';\n\nimport MonacoContainer from '../MonacoContainer';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport useMonaco from '../hooks/useMonaco';\nimport { noop, getOrCreateModel } from '../utils';\nimport type { DiffEditorProps, MonacoDiffEditor } from './types';\nimport type { Monaco } from '..';\n\nfunction DiffEditor(props: DiffEditorProps): ReactElement {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <Suspense\n fallback={\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n }\n >\n <DiffEditorContent {...props} />\n </Suspense>\n );\n}\n\nfunction DiffEditorContent(props: DiffEditorProps): ReactElement {\n const monaco = useMonaco();\n\n if (!monaco) {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n }\n\n return <MountedDiffEditor {...props} monaco={monaco} />;\n}\n\nfunction MountedDiffEditor({\n monaco,\n original,\n modified,\n language,\n originalLanguage,\n modifiedLanguage,\n originalModelPath,\n modifiedModelPath,\n keepCurrentOriginalModel = false,\n keepCurrentModifiedModel = false,\n theme = 'light',\n loading = 'Loading...',\n options = {},\n height = '100%',\n width = '100%',\n className,\n wrapperProps = {},\n beforeMount = noop,\n onMount = noop,\n}: DiffEditorProps & { monaco: Monaco }): ReactElement {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const editorRef = useRef<MonacoDiffEditor | null>(null);\n const monacoRef = useRef<Monaco>(monaco);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const preventCreation = useRef(false);\n\n monacoRef.current = monaco;\n\n useMount(() => {\n return () => {\n if (editorRef.current) {\n disposeEditor();\n }\n };\n });\n\n useUpdate(\n () => {\n if (editorRef.current && monacoRef.current) {\n const originalEditor = editorRef.current.getOriginalEditor();\n const model = getOrCreateModel(\n monacoRef.current,\n original || '',\n originalLanguage || language || 'text',\n originalModelPath || ''\n );\n\n if (model !== originalEditor.getModel()) {\n originalEditor.setModel(model);\n }\n }\n },\n [originalModelPath],\n isEditorReady\n );\n\n useUpdate(\n () => {\n if (editorRef.current && monacoRef.current) {\n const modifiedEditor = editorRef.current.getModifiedEditor();\n const model = getOrCreateModel(\n monacoRef.current,\n modified || '',\n modifiedLanguage || language || 'text',\n modifiedModelPath || ''\n );\n\n if (model !== modifiedEditor.getModel()) {\n modifiedEditor.setModel(model);\n }\n }\n },\n [modifiedModelPath],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const modifiedEditor = editorRef.current!.getModifiedEditor();\n if (modifiedEditor.getOption(monacoRef.current!.editor.EditorOption.readOnly)) {\n modifiedEditor.setValue(modified || '');\n } else {\n if (modified !== modifiedEditor.getValue()) {\n modifiedEditor.executeEdits('', [\n {\n range: modifiedEditor.getModel()!.getFullModelRange(),\n text: modified || '',\n forceMoveMarkers: true,\n },\n ]);\n\n modifiedEditor.pushUndoStop();\n }\n }\n },\n [modified],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.getModel()?.original.setValue(original || '');\n },\n [original],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const { original, modified } = editorRef.current!.getModel()!;\n\n monacoRef.current!.editor.setModelLanguage(original, originalLanguage || language || 'text');\n monacoRef.current!.editor.setModelLanguage(modified, modifiedLanguage || language || 'text');\n },\n [language, originalLanguage, modifiedLanguage],\n isEditorReady\n );\n\n useUpdate(\n () => {\n monacoRef.current?.editor.setTheme(theme);\n },\n [theme],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.updateOptions(options);\n },\n [options],\n isEditorReady\n );\n\n const setModels = useCallback(() => {\n beforeMountRef.current(monacoRef.current);\n const originalModel = getOrCreateModel(\n monacoRef.current,\n original || '',\n originalLanguage || language || 'text',\n originalModelPath || ''\n );\n\n const modifiedModel = getOrCreateModel(\n monacoRef.current,\n modified || '',\n modifiedLanguage || language || 'text',\n modifiedModelPath || ''\n );\n\n editorRef.current?.setModel({\n original: originalModel,\n modified: modifiedModel,\n });\n }, [language, modified, modifiedLanguage, original, originalLanguage, originalModelPath, modifiedModelPath]);\n\n const createEditor = useCallback(() => {\n if (!preventCreation.current && containerRef.current) {\n editorRef.current = monacoRef.current!.editor.createDiffEditor(containerRef.current, {\n automaticLayout: true,\n ...options,\n });\n\n setModels();\n\n monacoRef.current?.editor.setTheme(theme);\n\n setIsEditorReady(true);\n preventCreation.current = true;\n }\n }, [options, theme, setModels]);\n\n useEffect(() => {\n if (isEditorReady) {\n onMountRef.current(editorRef.current!, monacoRef.current!);\n }\n }, [isEditorReady]);\n\n useEffect(() => {\n if (!isEditorReady) {\n createEditor();\n }\n }, [isEditorReady, createEditor]);\n\n function disposeEditor(): void {\n const editor = editorRef.current;\n const models = editor?.getModel();\n\n // Detach inner editor models first so editor.dispose() never reads from a model that another owner disposed.\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor?.getOriginalEditor().setModel(null);\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor?.getModifiedEditor().setModel(null);\n editor?.dispose();\n\n if (\n !keepCurrentOriginalModel &&\n models?.original &&\n !models.original.isDisposed() &&\n !models.original.isAttachedToEditor()\n ) {\n models.original.dispose();\n }\n\n if (\n !keepCurrentModifiedModel &&\n models?.modified &&\n !models.modified.isDisposed() &&\n !models.modified.isAttachedToEditor()\n ) {\n models.modified.dispose();\n }\n\n // oxlint-disable-next-line unicorn/no-null -- React refs use null after unmount.\n editorRef.current = null;\n preventCreation.current = false;\n setIsEditorReady(false);\n }\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={isEditorReady}\n loading={loading}\n _ref={containerRef}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n}\n\nexport default DiffEditor;\n"],"mappings":"6RAaA,SAAS,EAAW,EAAsC,CACxD,GAAM,CAAE,QAAQ,OAAQ,SAAS,OAAQ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CAAC,EAAO,SAAS,WAAW,GAC5B,CAAC,EAAO,SAAS,mBAAmB,GAEpC,EAAO,SAAS,QAAQ,EAIxB,CAAC,GACD,GAAQ,UACR,CAAC,EAAO,SAAS,WAAW,GAC5B,CAAC,EAAO,SAAS,mBAAmB,GAEpC,EAAO,SAAS,QAAQ,EAI1B,EAAU,QAAU,KACpB,EAAgB,QAAU,GAC1B,EAAiB,EAAK,CACxB,CAEA,OACE,EAAA,EAAA,IAAA,CAACH,EAAAA,QAAD,CACS,QACC,SACO,gBACN,UACT,KAAM,EACK,YACG,cACf,CAAA,CAEL"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=DiffEditor.js.map
|
|
1
|
+
"use client";import e from"../MonacoContainer/index.js";import t from"../hooks/useMount/index.js";import n from"../hooks/useUpdate/index.js";import r from"../hooks/useMonaco/index.js";import{getOrCreateModel as i,noop as a}from"../utils/index.js";import{Suspense as o,useCallback as s,useEffect as c,useRef as l,useState as u}from"react";import{jsx as d}from"react/jsx-runtime";function f(t){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:s={}}=t;return d(o,{fallback:d(e,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:s}),children:d(p,{...t})})}function p(t){let n=r();if(!n){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:o={}}=t;return d(e,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:o})}return d(m,{...t,monaco:n})}function m({monaco:r,original:o,modified:f,language:p,originalLanguage:m,modifiedLanguage:h,originalModelPath:g,modifiedModelPath:_,keepCurrentOriginalModel:v=!1,keepCurrentModifiedModel:y=!1,theme:b=`light`,loading:x=`Loading...`,options:S={},height:C=`100%`,width:w=`100%`,className:T,wrapperProps:E={},beforeMount:D=a,onMount:O=a}){let[k,A]=u(!1),j=l(null),M=l(r),N=l(null),P=l(O),F=l(D),I=l(!1);M.current=r,t(()=>()=>{j.current&&z()}),n(()=>{if(j.current&&M.current){let e=j.current.getOriginalEditor(),t=i(M.current,o||``,m||p||`text`,g||``);t!==e.getModel()&&e.setModel(t)}},[g],k),n(()=>{if(j.current&&M.current){let e=j.current.getModifiedEditor(),t=i(M.current,f||``,h||p||`text`,_||``);t!==e.getModel()&&e.setModel(t)}},[_],k),n(()=>{let e=j.current.getModifiedEditor();e.getOption(M.current.editor.EditorOption.readOnly)?e.setValue(f||``):f!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:f||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[f],k),n(()=>{j.current?.getModel()?.original.setValue(o||``)},[o],k),n(()=>{let{original:e,modified:t}=j.current.getModel();M.current.editor.setModelLanguage(e,m||p||`text`),M.current.editor.setModelLanguage(t,h||p||`text`)},[p,m,h],k),n(()=>{M.current?.editor.setTheme(b)},[b],k),n(()=>{j.current?.updateOptions(S)},[S],k);let L=s(()=>{F.current(M.current);let e=i(M.current,o||``,m||p||`text`,g||``),t=i(M.current,f||``,h||p||`text`,_||``);j.current?.setModel({original:e,modified:t})},[p,f,h,o,m,g,_]),R=s(()=>{!I.current&&N.current&&(j.current=M.current.editor.createDiffEditor(N.current,{automaticLayout:!0,...S}),L(),M.current?.editor.setTheme(b),A(!0),I.current=!0)},[S,b,L]);c(()=>{k&&P.current(j.current,M.current)},[k]),c(()=>{k||R()},[k,R]);function z(){let e=j.current,t=e?.getModel();e?.getOriginalEditor().setModel(null),e?.getModifiedEditor().setModel(null),e?.dispose(),!v&&t?.original&&!t.original.isDisposed()&&!t.original.isAttachedToEditor()&&t.original.dispose(),!y&&t?.modified&&!t.modified.isDisposed()&&!t.modified.isAttachedToEditor()&&t.modified.dispose(),j.current=null,I.current=!1,A(!1)}return d(e,{width:w,height:C,isEditorReady:k,loading:x,_ref:N,className:T,wrapperProps:E})}export{f as default};
|
|
2
|
+
//# sourceMappingURL=DiffEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiffEditor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"DiffEditor.js","names":["MonacoContainer"],"sources":["../../src/DiffEditor/DiffEditor.tsx"],"sourcesContent":["'use client';\n\nimport { Suspense, useState, useRef, useCallback, useEffect } from 'react';\nimport type { ReactElement } from 'react';\n\nimport MonacoContainer from '../MonacoContainer';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport useMonaco from '../hooks/useMonaco';\nimport { noop, getOrCreateModel } from '../utils';\nimport type { DiffEditorProps, MonacoDiffEditor } from './types';\nimport type { Monaco } from '..';\n\nfunction DiffEditor(props: DiffEditorProps): ReactElement {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <Suspense\n fallback={\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n }\n >\n <DiffEditorContent {...props} />\n </Suspense>\n );\n}\n\nfunction DiffEditorContent(props: DiffEditorProps): ReactElement {\n const monaco = useMonaco();\n\n if (!monaco) {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n }\n\n return <MountedDiffEditor {...props} monaco={monaco} />;\n}\n\nfunction MountedDiffEditor({\n monaco,\n original,\n modified,\n language,\n originalLanguage,\n modifiedLanguage,\n originalModelPath,\n modifiedModelPath,\n keepCurrentOriginalModel = false,\n keepCurrentModifiedModel = false,\n theme = 'light',\n loading = 'Loading...',\n options = {},\n height = '100%',\n width = '100%',\n className,\n wrapperProps = {},\n beforeMount = noop,\n onMount = noop,\n}: DiffEditorProps & { monaco: Monaco }): ReactElement {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const editorRef = useRef<MonacoDiffEditor | null>(null);\n const monacoRef = useRef<Monaco>(monaco);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const preventCreation = useRef(false);\n\n monacoRef.current = monaco;\n\n useMount(() => {\n return () => {\n if (editorRef.current) {\n disposeEditor();\n }\n };\n });\n\n useUpdate(\n () => {\n if (editorRef.current && monacoRef.current) {\n const originalEditor = editorRef.current.getOriginalEditor();\n const model = getOrCreateModel(\n monacoRef.current,\n original || '',\n originalLanguage || language || 'text',\n originalModelPath || ''\n );\n\n if (model !== originalEditor.getModel()) {\n originalEditor.setModel(model);\n }\n }\n },\n [originalModelPath],\n isEditorReady\n );\n\n useUpdate(\n () => {\n if (editorRef.current && monacoRef.current) {\n const modifiedEditor = editorRef.current.getModifiedEditor();\n const model = getOrCreateModel(\n monacoRef.current,\n modified || '',\n modifiedLanguage || language || 'text',\n modifiedModelPath || ''\n );\n\n if (model !== modifiedEditor.getModel()) {\n modifiedEditor.setModel(model);\n }\n }\n },\n [modifiedModelPath],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const modifiedEditor = editorRef.current!.getModifiedEditor();\n if (modifiedEditor.getOption(monacoRef.current!.editor.EditorOption.readOnly)) {\n modifiedEditor.setValue(modified || '');\n } else {\n if (modified !== modifiedEditor.getValue()) {\n modifiedEditor.executeEdits('', [\n {\n range: modifiedEditor.getModel()!.getFullModelRange(),\n text: modified || '',\n forceMoveMarkers: true,\n },\n ]);\n\n modifiedEditor.pushUndoStop();\n }\n }\n },\n [modified],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.getModel()?.original.setValue(original || '');\n },\n [original],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const { original, modified } = editorRef.current!.getModel()!;\n\n monacoRef.current!.editor.setModelLanguage(original, originalLanguage || language || 'text');\n monacoRef.current!.editor.setModelLanguage(modified, modifiedLanguage || language || 'text');\n },\n [language, originalLanguage, modifiedLanguage],\n isEditorReady\n );\n\n useUpdate(\n () => {\n monacoRef.current?.editor.setTheme(theme);\n },\n [theme],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.updateOptions(options);\n },\n [options],\n isEditorReady\n );\n\n const setModels = useCallback(() => {\n beforeMountRef.current(monacoRef.current);\n const originalModel = getOrCreateModel(\n monacoRef.current,\n original || '',\n originalLanguage || language || 'text',\n originalModelPath || ''\n );\n\n const modifiedModel = getOrCreateModel(\n monacoRef.current,\n modified || '',\n modifiedLanguage || language || 'text',\n modifiedModelPath || ''\n );\n\n editorRef.current?.setModel({\n original: originalModel,\n modified: modifiedModel,\n });\n }, [language, modified, modifiedLanguage, original, originalLanguage, originalModelPath, modifiedModelPath]);\n\n const createEditor = useCallback(() => {\n if (!preventCreation.current && containerRef.current) {\n editorRef.current = monacoRef.current!.editor.createDiffEditor(containerRef.current, {\n automaticLayout: true,\n ...options,\n });\n\n setModels();\n\n monacoRef.current?.editor.setTheme(theme);\n\n setIsEditorReady(true);\n preventCreation.current = true;\n }\n }, [options, theme, setModels]);\n\n useEffect(() => {\n if (isEditorReady) {\n onMountRef.current(editorRef.current!, monacoRef.current!);\n }\n }, [isEditorReady]);\n\n useEffect(() => {\n if (!isEditorReady) {\n createEditor();\n }\n }, [isEditorReady, createEditor]);\n\n function disposeEditor(): void {\n const editor = editorRef.current;\n const models = editor?.getModel();\n\n // Detach inner editor models first so editor.dispose() never reads from a model that another owner disposed.\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor?.getOriginalEditor().setModel(null);\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor?.getModifiedEditor().setModel(null);\n editor?.dispose();\n\n if (\n !keepCurrentOriginalModel &&\n models?.original &&\n !models.original.isDisposed() &&\n !models.original.isAttachedToEditor()\n ) {\n models.original.dispose();\n }\n\n if (\n !keepCurrentModifiedModel &&\n models?.modified &&\n !models.modified.isDisposed() &&\n !models.modified.isAttachedToEditor()\n ) {\n models.modified.dispose();\n }\n\n // oxlint-disable-next-line unicorn/no-null -- React refs use null after unmount.\n editorRef.current = null;\n preventCreation.current = false;\n setIsEditorReady(false);\n }\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={isEditorReady}\n loading={loading}\n _ref={containerRef}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n}\n\nexport default DiffEditor;\n"],"mappings":"0XAaA,SAAS,EAAW,EAAsC,CACxD,GAAM,CAAE,QAAQ,OAAQ,SAAS,OAAQ,UAAU,aAAc,YAAW,eAAe,CAAC,GAAM,EAElG,OACE,EAAC,EAAD,CACE,SACE,EAACA,EAAD,CACS,QACC,SACR,cAAe,GACN,UACE,YACG,cACf,CAAA,WAGH,EAAC,EAAD,CAAmB,GAAI,CAAQ,CAAA,CACvB,CAAA,CAEd,CAEA,SAAS,EAAkB,EAAsC,CAC/D,IAAM,EAAS,EAAU,EAEzB,GAAI,CAAC,EAAQ,CACX,GAAM,CAAE,QAAQ,OAAQ,SAAS,OAAQ,UAAU,aAAc,YAAW,eAAe,CAAC,GAAM,EAElG,OACE,EAACA,EAAD,CACS,QACC,SACR,cAAe,GACN,UACE,YACG,cACf,CAAA,CAEL,CAEA,OAAO,EAAC,EAAD,CAAmB,GAAI,EAAe,QAAS,CAAA,CACxD,CAEA,SAAS,EAAkB,CACzB,SACA,WACA,WACA,WACA,mBACA,mBACA,oBACA,oBACA,2BAA2B,GAC3B,2BAA2B,GAC3B,QAAQ,QACR,UAAU,aACV,UAAU,CAAC,EACX,SAAS,OACT,QAAQ,OACR,YACA,eAAe,CAAC,EAChB,cAAc,EACd,UAAU,GAC2C,CACrD,GAAM,CAAC,EAAe,GAAoB,EAAS,EAAK,EAClD,EAAY,EAAgC,IAAI,EAChD,EAAY,EAAe,CAAM,EACjC,EAAe,EAA8B,IAAI,EACjD,EAAa,EAAO,CAAO,EAC3B,EAAiB,EAAO,CAAW,EACnC,EAAkB,EAAO,EAAK,EAEpC,EAAU,QAAU,EAEpB,UACe,CACP,EAAU,SACZ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,SAAS,WAAW,GAC5B,CAAC,EAAO,SAAS,mBAAmB,GAEpC,EAAO,SAAS,QAAQ,EAI1B,EAAU,QAAU,KACpB,EAAgB,QAAU,GAC1B,EAAiB,EAAK,CACxB,CAEA,OACE,EAACA,EAAD,CACS,QACC,SACO,gBACN,UACT,KAAM,EACK,YACG,cACf,CAAA,CAEL"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";const e=require("./DiffEditor.cjs");var t=(0,require("react").memo)(e.default);exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/DiffEditor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport DiffEditor from './DiffEditor';\n\nexport * from './types';\n\nexport default memo(DiffEditor);\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["DiffEditor"],"sources":["../../src/DiffEditor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport DiffEditor from './DiffEditor';\n\nexport * from './types';\n\nexport default memo(DiffEditor);\n"],"mappings":"iDAMA,IAAA,GAAA,iBAAA,CAAA,CAAA,KAAA,CAAoBA,EAAAA,OAAU"}
|
package/dist/DiffEditor/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import e from"./DiffEditor.js";import{memo as t}from"react";var n=t(e);export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/DiffEditor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport DiffEditor from './DiffEditor';\n\nexport * from './types';\n\nexport default memo(DiffEditor);\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/DiffEditor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport DiffEditor from './DiffEditor';\n\nexport * from './types';\n\nexport default memo(DiffEditor);\n"],"mappings":"4DAMA,IAAA,EAAe,EAAK,CAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAEjC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AAE5D,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAE7E,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,8BAA8B,CAAC;IAEhD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;IAE9B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB"}
|
package/dist/Editor/Editor.cjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=Editor.cjs.map
|
|
1
|
+
"use strict";"use client";const e=require("../MonacoContainer/index.cjs"),t=require("../hooks/useMount/index.cjs"),n=require("../hooks/useUpdate/index.cjs"),r=require("../hooks/useMonaco/index.cjs"),i=require("../utils/index.cjs"),a=require("../hooks/usePrevious/index.cjs");let o=require("react"),s=require("react/jsx-runtime");const c=new Map;function l(t){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:c={}}=t;return(0,s.jsx)(o.Suspense,{fallback:(0,s.jsx)(e.default,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:c}),children:(0,s.jsx)(u,{...t})})}function u(t){let n=r.default();if(!n){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:o={}}=t;return(0,s.jsx)(e.default,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:o})}return(0,s.jsx)(d,{...t,monaco:n})}function d({monaco:r,defaultValue:l,defaultLanguage:u,defaultPath:d,value:f,language:p,path:m,theme:h=`light`,line:g,loading:_=`Loading...`,options:v={},overrideServices:y={},saveViewState:b=!0,keepCurrentModel:x=!1,width:S=`100%`,height:C=`100%`,className:w,wrapperProps:T={},beforeMount:E=i.noop,onMount:D=i.noop,onChange:O,onValidate:k=i.noop}){let[A,j]=(0,o.useState)(!1),M=(0,o.useRef)(r),N=(0,o.useRef)(void 0),P=(0,o.useRef)(null),F=(0,o.useRef)(D),I=(0,o.useRef)(E),L=(0,o.useRef)(void 0),R=(0,o.useRef)(f),z=a.default(m),B=(0,o.useRef)(!1),V=(0,o.useRef)(!1);M.current=r,t.default(()=>()=>{N.current&&U()}),n.default(()=>{let e=i.getOrCreateModel(M.current,l||f||``,u||p||``,m||d||``);e!==N.current?.getModel()&&(b&&c.set(z,N.current?.saveViewState()),N.current?.setModel(e),b&&N.current?.restoreViewState(c.get(m)))},[m],A),n.default(()=>{N.current?.updateOptions(v)},[v],A),n.default(()=>{!N.current||f===void 0||(N.current.getOption(M.current.editor.EditorOption.readOnly)?N.current.setValue(f):f!==N.current.getValue()&&(V.current=!0,N.current.executeEdits(``,[{range:N.current.getModel().getFullModelRange(),text:f,forceMoveMarkers:!0}]),N.current.pushUndoStop(),V.current=!1))},[f],A),n.default(()=>{let e=N.current?.getModel();A&&e&&p&&M.current?.editor.setModelLanguage(e,p)},[p,A],A),n.default(()=>{g!==void 0&&N.current?.revealLine(g)},[g],A),n.default(()=>{M.current?.editor.setTheme(h)},[h],A);let H=(0,o.useCallback)(()=>{if(P.current&&!B.current){I.current(M.current);let e=m||d,t=i.getOrCreateModel(M.current,f||l||``,u||p||``,e||``),n=M.current.editor.create(P.current,{model:t,automaticLayout:!0,...v},y);N.current=n,b&&n.restoreViewState(c.get(e)),M.current.editor.setTheme(h),g!==void 0&&n.revealLine(g),j(!0),B.current=!0}},[l,u,d,f,p,m,v,y,b,h,g]);(0,o.useEffect)(()=>{A&&F.current(N.current,M.current)},[A]),(0,o.useEffect)(()=>{A||H()},[A,H]),R.current=f,(0,o.useEffect)(()=>{A&&O&&(L.current?.dispose(),L.current=N.current?.onDidChangeModelContent(e=>{V.current||O(N.current.getValue(),e)}))},[A,O]),(0,o.useEffect)(()=>{if(A){let e=M.current.editor.onDidChangeMarkers(e=>{let t=N.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=M.current.editor.getModelMarkers({resource:t});k?.(e)}});return()=>{e?.dispose()}}return()=>{}},[A,k]);function U(){L.current?.dispose();let e=N.current,t=e.getModel();x?(b&&c.set(m,e.saveViewState()),e.setModel(null)):t&&(e.setModel(null),!t.isDisposed()&&!t.isAttachedToEditor()&&t.dispose()),e.dispose(),N.current=void 0,B.current=!1,j(!1)}return(0,s.jsx)(e.default,{width:S,height:C,isEditorReady:A,loading:_,_ref:P,className:w,wrapperProps:T})}exports.default=l;
|
|
2
|
+
//# sourceMappingURL=Editor.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"Editor.cjs","names":["Suspense","MonacoContainer","useMonaco","noop","usePrevious","getOrCreateModel"],"sources":["../../src/Editor/Editor.tsx"],"sourcesContent":["'use client';\n\nimport { Suspense, useState, useEffect, useRef, useCallback } from 'react';\nimport type { ReactElement } from 'react';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport usePrevious from '../hooks/usePrevious';\nimport useMonaco from '../hooks/useMonaco';\nimport type { IDisposable, Uri, editor } from 'monaco-editor';\nimport { noop, getOrCreateModel } from '../utils';\nimport type { EditorProps } from './types';\nimport type { Monaco } from '..';\nimport MonacoContainer from '../MonacoContainer';\n\nconst viewStates = new Map();\n\nfunction Editor(props: EditorProps): ReactElement {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <Suspense\n fallback={\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n }\n >\n <EditorContent {...props} />\n </Suspense>\n );\n}\n\nfunction EditorContent(props: EditorProps): ReactElement {\n const monaco = useMonaco();\n\n if (!monaco) {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n }\n\n return <MountedEditor {...props} monaco={monaco} />;\n}\n\nfunction MountedEditor({\n monaco,\n defaultValue,\n defaultLanguage,\n defaultPath,\n value,\n language,\n path,\n /* === */\n theme = 'light',\n line,\n loading = 'Loading...',\n options = {},\n overrideServices = {},\n saveViewState = true,\n keepCurrentModel = false,\n /* === */\n width = '100%',\n height = '100%',\n className,\n wrapperProps = {},\n /* === */\n beforeMount = noop,\n onMount = noop,\n onChange,\n onValidate = noop,\n}: EditorProps & { monaco: Monaco }): ReactElement {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const monacoRef = useRef<Monaco>(monaco);\n const editorRef = useRef<editor.IStandaloneCodeEditor | undefined>(undefined);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const subscriptionRef = useRef<IDisposable | undefined>(undefined);\n const valueRef = useRef(value);\n const previousPath = usePrevious(path);\n const preventCreation = useRef(false);\n const preventTriggerChangeEvent = useRef<boolean>(false);\n\n monacoRef.current = monaco;\n\n useMount(() => {\n return () => {\n if (editorRef.current) {\n disposeEditor();\n }\n };\n });\n\n useUpdate(\n () => {\n const model = getOrCreateModel(\n monacoRef.current!,\n defaultValue || value || '',\n defaultLanguage || language || '',\n path || defaultPath || ''\n );\n\n if (model !== editorRef.current?.getModel()) {\n if (saveViewState) viewStates.set(previousPath, editorRef.current?.saveViewState());\n editorRef.current?.setModel(model);\n if (saveViewState) editorRef.current?.restoreViewState(viewStates.get(path));\n }\n },\n [path],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.updateOptions(options);\n },\n [options],\n isEditorReady\n );\n\n useUpdate(\n () => {\n if (!editorRef.current || value === undefined) return;\n if (editorRef.current.getOption(monacoRef.current!.editor.EditorOption.readOnly)) {\n editorRef.current.setValue(value);\n } else if (value !== editorRef.current.getValue()) {\n preventTriggerChangeEvent.current = true;\n editorRef.current.executeEdits('', [\n {\n range: editorRef.current.getModel()!.getFullModelRange(),\n text: value,\n forceMoveMarkers: true,\n },\n ]);\n\n editorRef.current.pushUndoStop();\n preventTriggerChangeEvent.current = false;\n }\n },\n [value],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const model = editorRef.current?.getModel();\n if (isEditorReady && model && language) {\n monacoRef.current?.editor.setModelLanguage(model, language);\n }\n },\n [language, isEditorReady],\n isEditorReady\n );\n\n useUpdate(\n () => {\n // reason for undefined check: https://github.com/suren-atoyan/monaco-react/pull/188\n if (line !== undefined) {\n editorRef.current?.revealLine(line);\n }\n },\n [line],\n isEditorReady\n );\n\n useUpdate(\n () => {\n monacoRef.current?.editor.setTheme(theme);\n },\n [theme],\n isEditorReady\n );\n\n const createEditor = useCallback(() => {\n if (!containerRef.current) return;\n if (!preventCreation.current) {\n beforeMountRef.current(monacoRef.current);\n const autoCreatedModelPath = path || defaultPath;\n\n const defaultModel = getOrCreateModel(\n monacoRef.current,\n value || defaultValue || '',\n defaultLanguage || language || '',\n autoCreatedModelPath || ''\n );\n\n const editor = monacoRef.current.editor.create(\n containerRef.current,\n {\n model: defaultModel,\n automaticLayout: true,\n ...options,\n },\n overrideServices\n );\n editorRef.current = editor;\n\n if (saveViewState) {\n editor.restoreViewState(viewStates.get(autoCreatedModelPath));\n }\n\n monacoRef.current.editor.setTheme(theme);\n\n if (line !== undefined) {\n editor.revealLine(line);\n }\n\n setIsEditorReady(true);\n preventCreation.current = true;\n }\n }, [\n defaultValue,\n defaultLanguage,\n defaultPath,\n value,\n language,\n path,\n options,\n overrideServices,\n saveViewState,\n theme,\n line,\n ]);\n\n useEffect(() => {\n if (isEditorReady) {\n onMountRef.current(editorRef.current!, monacoRef.current!);\n }\n }, [isEditorReady]);\n\n useEffect(() => {\n if (!isEditorReady) {\n createEditor();\n }\n }, [isEditorReady, createEditor]);\n\n // subscription\n // to avoid unnecessary updates (attach - dispose listener) in subscription\n valueRef.current = value;\n\n // onChange\n useEffect(() => {\n if (isEditorReady && onChange) {\n subscriptionRef.current?.dispose();\n subscriptionRef.current = editorRef.current?.onDidChangeModelContent((event) => {\n if (!preventTriggerChangeEvent.current) {\n onChange(editorRef.current!.getValue(), event);\n }\n });\n }\n }, [isEditorReady, onChange]);\n\n // onValidate\n useEffect(() => {\n if (isEditorReady) {\n const changeMarkersListener = monacoRef.current!.editor.onDidChangeMarkers((uris: readonly Uri[]) => {\n const editorUri = editorRef.current!.getModel()?.uri;\n\n if (editorUri) {\n const currentEditorHasMarkerChanges = uris.find((uri: Uri) => uri.path === editorUri.path);\n if (currentEditorHasMarkerChanges) {\n const markers = monacoRef.current!.editor.getModelMarkers({\n resource: editorUri,\n });\n onValidate?.(markers);\n }\n }\n });\n\n return () => {\n changeMarkersListener?.dispose();\n };\n }\n return () => {\n // eslint happy\n };\n }, [isEditorReady, onValidate]);\n\n function disposeEditor(): void {\n subscriptionRef.current?.dispose();\n const editor = editorRef.current!;\n const model = editor.getModel();\n\n if (keepCurrentModel) {\n if (saveViewState) {\n viewStates.set(path, editor.saveViewState());\n }\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor.setModel(null);\n } else if (model) {\n // Detach first so editor.dispose() never reads from a model that another editor already disposed.\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor.setModel(null);\n if (!model.isDisposed() && !model.isAttachedToEditor()) {\n model.dispose();\n }\n }\n\n editor.dispose();\n\n editorRef.current = undefined;\n preventCreation.current = false;\n setIsEditorReady(false);\n }\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={isEditorReady}\n loading={loading}\n _ref={containerRef}\n className={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C7B,EAAS,EAAU,QAAS,SAAS,EAAG,CAAK,CAEjD,CAAC,EAEL,EAAG,CAAC,EAAe,CAAQ,CAAC,GAG5B,EAAA,EAAA,UAAA,KAAgB,CACd,GAAI,EAAe,CACjB,IAAM,EAAwB,EAAU,QAAS,OAAO,mBAAoB,GAAyB,CACnG,IAAM,EAAY,EAAU,QAAS,SAAS,CAAC,EAAE,IAEjD,GAAI,GACoC,EAAK,KAAM,GAAa,EAAI,OAAS,EAAU,IACrD,EAAG,CACjC,IAAM,EAAU,EAAU,QAAS,OAAO,gBAAgB,CACxD,SAAU,CACZ,CAAC,EACD,IAAa,CAAO,CACtB,CAEJ,CAAC,EAED,UAAa,CACX,GAAuB,QAAQ,CACjC,CACF,CACA,UAAa,CAEb,CACF,EAAG,CAAC,EAAe,CAAU,CAAC,EAE9B,SAAS,GAAsB,CAC7B,EAAgB,SAAS,QAAQ,EACjC,IAAM,EAAS,EAAU,QACnB,EAAQ,EAAO,SAAS,EAE1B,GACE,GACF,EAAW,IAAI,EAAM,EAAO,cAAc,CAAC,EAG7C,EAAO,SAAS,IAAI,GACX,IAGT,EAAO,SAAS,IAAI,EAChB,CAAC,EAAM,WAAW,GAAK,CAAC,EAAM,mBAAmB,GACnD,EAAM,QAAQ,GAIlB,EAAO,QAAQ,EAEf,EAAU,QAAU,IAAA,GACpB,EAAgB,QAAU,GAC1B,EAAiB,EAAK,CACxB,CAEA,OACE,EAAA,EAAA,IAAA,CAACJ,EAAAA,QAAD,CACS,QACC,SACO,gBACN,UACT,KAAM,EACK,YACG,cACf,CAAA,CAEL"}
|
package/dist/Editor/Editor.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=Editor.js.map
|
|
1
|
+
"use client";import e from"../MonacoContainer/index.js";import t from"../hooks/useMount/index.js";import n from"../hooks/useUpdate/index.js";import r from"../hooks/useMonaco/index.js";import{getOrCreateModel as i,noop as a}from"../utils/index.js";import o from"../hooks/usePrevious/index.js";import{Suspense as s,useCallback as c,useEffect as l,useRef as u,useState as d}from"react";import{jsx as f}from"react/jsx-runtime";const p=new Map;function m(t){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:o={}}=t;return f(s,{fallback:f(e,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:o}),children:f(h,{...t})})}function h(t){let n=r();if(!n){let{width:n=`100%`,height:r=`100%`,loading:i=`Loading...`,className:a,wrapperProps:o={}}=t;return f(e,{width:n,height:r,isEditorReady:!1,loading:i,className:a,wrapperProps:o})}return f(g,{...t,monaco:n})}function g({monaco:r,defaultValue:s,defaultLanguage:m,defaultPath:h,value:g,language:_,path:v,theme:y=`light`,line:b,loading:x=`Loading...`,options:S={},overrideServices:C={},saveViewState:w=!0,keepCurrentModel:T=!1,width:E=`100%`,height:D=`100%`,className:O,wrapperProps:k={},beforeMount:A=a,onMount:j=a,onChange:M,onValidate:N=a}){let[P,F]=d(!1),I=u(r),L=u(void 0),R=u(null),z=u(j),B=u(A),V=u(void 0),H=u(g),U=o(v),W=u(!1),G=u(!1);I.current=r,t(()=>()=>{L.current&&q()}),n(()=>{let e=i(I.current,s||g||``,m||_||``,v||h||``);e!==L.current?.getModel()&&(w&&p.set(U,L.current?.saveViewState()),L.current?.setModel(e),w&&L.current?.restoreViewState(p.get(v)))},[v],P),n(()=>{L.current?.updateOptions(S)},[S],P),n(()=>{!L.current||g===void 0||(L.current.getOption(I.current.editor.EditorOption.readOnly)?L.current.setValue(g):g!==L.current.getValue()&&(G.current=!0,L.current.executeEdits(``,[{range:L.current.getModel().getFullModelRange(),text:g,forceMoveMarkers:!0}]),L.current.pushUndoStop(),G.current=!1))},[g],P),n(()=>{let e=L.current?.getModel();P&&e&&_&&I.current?.editor.setModelLanguage(e,_)},[_,P],P),n(()=>{b!==void 0&&L.current?.revealLine(b)},[b],P),n(()=>{I.current?.editor.setTheme(y)},[y],P);let K=c(()=>{if(R.current&&!W.current){B.current(I.current);let e=v||h,t=i(I.current,g||s||``,m||_||``,e||``),n=I.current.editor.create(R.current,{model:t,automaticLayout:!0,...S},C);L.current=n,w&&n.restoreViewState(p.get(e)),I.current.editor.setTheme(y),b!==void 0&&n.revealLine(b),F(!0),W.current=!0}},[s,m,h,g,_,v,S,C,w,y,b]);l(()=>{P&&z.current(L.current,I.current)},[P]),l(()=>{P||K()},[P,K]),H.current=g,l(()=>{P&&M&&(V.current?.dispose(),V.current=L.current?.onDidChangeModelContent(e=>{G.current||M(L.current.getValue(),e)}))},[P,M]),l(()=>{if(P){let e=I.current.editor.onDidChangeMarkers(e=>{let t=L.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=I.current.editor.getModelMarkers({resource:t});N?.(e)}});return()=>{e?.dispose()}}return()=>{}},[P,N]);function q(){V.current?.dispose();let e=L.current,t=e.getModel();T?(w&&p.set(v,e.saveViewState()),e.setModel(null)):t&&(e.setModel(null),!t.isDisposed()&&!t.isAttachedToEditor()&&t.dispose()),e.dispose(),L.current=void 0,W.current=!1,F(!1)}return f(e,{width:E,height:D,isEditorReady:P,loading:x,_ref:R,className:O,wrapperProps:k})}export{m as default};
|
|
2
|
+
//# sourceMappingURL=Editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"Editor.js","names":["MonacoContainer"],"sources":["../../src/Editor/Editor.tsx"],"sourcesContent":["'use client';\n\nimport { Suspense, useState, useEffect, useRef, useCallback } from 'react';\nimport type { ReactElement } from 'react';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport usePrevious from '../hooks/usePrevious';\nimport useMonaco from '../hooks/useMonaco';\nimport type { IDisposable, Uri, editor } from 'monaco-editor';\nimport { noop, getOrCreateModel } from '../utils';\nimport type { EditorProps } from './types';\nimport type { Monaco } from '..';\nimport MonacoContainer from '../MonacoContainer';\n\nconst viewStates = new Map();\n\nfunction Editor(props: EditorProps): ReactElement {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <Suspense\n fallback={\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n }\n >\n <EditorContent {...props} />\n </Suspense>\n );\n}\n\nfunction EditorContent(props: EditorProps): ReactElement {\n const monaco = useMonaco();\n\n if (!monaco) {\n const { width = '100%', height = '100%', loading = 'Loading...', className, wrapperProps = {} } = props;\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={false}\n loading={loading}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n }\n\n return <MountedEditor {...props} monaco={monaco} />;\n}\n\nfunction MountedEditor({\n monaco,\n defaultValue,\n defaultLanguage,\n defaultPath,\n value,\n language,\n path,\n /* === */\n theme = 'light',\n line,\n loading = 'Loading...',\n options = {},\n overrideServices = {},\n saveViewState = true,\n keepCurrentModel = false,\n /* === */\n width = '100%',\n height = '100%',\n className,\n wrapperProps = {},\n /* === */\n beforeMount = noop,\n onMount = noop,\n onChange,\n onValidate = noop,\n}: EditorProps & { monaco: Monaco }): ReactElement {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const monacoRef = useRef<Monaco>(monaco);\n const editorRef = useRef<editor.IStandaloneCodeEditor | undefined>(undefined);\n const containerRef = useRef<HTMLDivElement | null>(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const subscriptionRef = useRef<IDisposable | undefined>(undefined);\n const valueRef = useRef(value);\n const previousPath = usePrevious(path);\n const preventCreation = useRef(false);\n const preventTriggerChangeEvent = useRef<boolean>(false);\n\n monacoRef.current = monaco;\n\n useMount(() => {\n return () => {\n if (editorRef.current) {\n disposeEditor();\n }\n };\n });\n\n useUpdate(\n () => {\n const model = getOrCreateModel(\n monacoRef.current!,\n defaultValue || value || '',\n defaultLanguage || language || '',\n path || defaultPath || ''\n );\n\n if (model !== editorRef.current?.getModel()) {\n if (saveViewState) viewStates.set(previousPath, editorRef.current?.saveViewState());\n editorRef.current?.setModel(model);\n if (saveViewState) editorRef.current?.restoreViewState(viewStates.get(path));\n }\n },\n [path],\n isEditorReady\n );\n\n useUpdate(\n () => {\n editorRef.current?.updateOptions(options);\n },\n [options],\n isEditorReady\n );\n\n useUpdate(\n () => {\n if (!editorRef.current || value === undefined) return;\n if (editorRef.current.getOption(monacoRef.current!.editor.EditorOption.readOnly)) {\n editorRef.current.setValue(value);\n } else if (value !== editorRef.current.getValue()) {\n preventTriggerChangeEvent.current = true;\n editorRef.current.executeEdits('', [\n {\n range: editorRef.current.getModel()!.getFullModelRange(),\n text: value,\n forceMoveMarkers: true,\n },\n ]);\n\n editorRef.current.pushUndoStop();\n preventTriggerChangeEvent.current = false;\n }\n },\n [value],\n isEditorReady\n );\n\n useUpdate(\n () => {\n const model = editorRef.current?.getModel();\n if (isEditorReady && model && language) {\n monacoRef.current?.editor.setModelLanguage(model, language);\n }\n },\n [language, isEditorReady],\n isEditorReady\n );\n\n useUpdate(\n () => {\n // reason for undefined check: https://github.com/suren-atoyan/monaco-react/pull/188\n if (line !== undefined) {\n editorRef.current?.revealLine(line);\n }\n },\n [line],\n isEditorReady\n );\n\n useUpdate(\n () => {\n monacoRef.current?.editor.setTheme(theme);\n },\n [theme],\n isEditorReady\n );\n\n const createEditor = useCallback(() => {\n if (!containerRef.current) return;\n if (!preventCreation.current) {\n beforeMountRef.current(monacoRef.current);\n const autoCreatedModelPath = path || defaultPath;\n\n const defaultModel = getOrCreateModel(\n monacoRef.current,\n value || defaultValue || '',\n defaultLanguage || language || '',\n autoCreatedModelPath || ''\n );\n\n const editor = monacoRef.current.editor.create(\n containerRef.current,\n {\n model: defaultModel,\n automaticLayout: true,\n ...options,\n },\n overrideServices\n );\n editorRef.current = editor;\n\n if (saveViewState) {\n editor.restoreViewState(viewStates.get(autoCreatedModelPath));\n }\n\n monacoRef.current.editor.setTheme(theme);\n\n if (line !== undefined) {\n editor.revealLine(line);\n }\n\n setIsEditorReady(true);\n preventCreation.current = true;\n }\n }, [\n defaultValue,\n defaultLanguage,\n defaultPath,\n value,\n language,\n path,\n options,\n overrideServices,\n saveViewState,\n theme,\n line,\n ]);\n\n useEffect(() => {\n if (isEditorReady) {\n onMountRef.current(editorRef.current!, monacoRef.current!);\n }\n }, [isEditorReady]);\n\n useEffect(() => {\n if (!isEditorReady) {\n createEditor();\n }\n }, [isEditorReady, createEditor]);\n\n // subscription\n // to avoid unnecessary updates (attach - dispose listener) in subscription\n valueRef.current = value;\n\n // onChange\n useEffect(() => {\n if (isEditorReady && onChange) {\n subscriptionRef.current?.dispose();\n subscriptionRef.current = editorRef.current?.onDidChangeModelContent((event) => {\n if (!preventTriggerChangeEvent.current) {\n onChange(editorRef.current!.getValue(), event);\n }\n });\n }\n }, [isEditorReady, onChange]);\n\n // onValidate\n useEffect(() => {\n if (isEditorReady) {\n const changeMarkersListener = monacoRef.current!.editor.onDidChangeMarkers((uris: readonly Uri[]) => {\n const editorUri = editorRef.current!.getModel()?.uri;\n\n if (editorUri) {\n const currentEditorHasMarkerChanges = uris.find((uri: Uri) => uri.path === editorUri.path);\n if (currentEditorHasMarkerChanges) {\n const markers = monacoRef.current!.editor.getModelMarkers({\n resource: editorUri,\n });\n onValidate?.(markers);\n }\n }\n });\n\n return () => {\n changeMarkersListener?.dispose();\n };\n }\n return () => {\n // eslint happy\n };\n }, [isEditorReady, onValidate]);\n\n function disposeEditor(): void {\n subscriptionRef.current?.dispose();\n const editor = editorRef.current!;\n const model = editor.getModel();\n\n if (keepCurrentModel) {\n if (saveViewState) {\n viewStates.set(path, editor.saveViewState());\n }\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor.setModel(null);\n } else if (model) {\n // Detach first so editor.dispose() never reads from a model that another editor already disposed.\n // oxlint-disable-next-line unicorn/no-null -- Monaco detaches editor models with null.\n editor.setModel(null);\n if (!model.isDisposed() && !model.isAttachedToEditor()) {\n model.dispose();\n }\n }\n\n editor.dispose();\n\n editorRef.current = undefined;\n preventCreation.current = false;\n setIsEditorReady(false);\n }\n\n return (\n <MonacoContainer\n width={width}\n height={height}\n isEditorReady={isEditorReady}\n loading={loading}\n _ref={containerRef}\n className={className}\n wrapperProps={wrapperProps}\n />\n );\n}\n\nexport default Editor;\n"],"mappings":"uaAcA,MAAM,EAAa,IAAI,IAEvB,SAAS,EAAO,EAAkC,CAChD,GAAM,CAAE,QAAQ,OAAQ,SAAS,OAAQ,UAAU,aAAc,YAAW,eAAe,CAAC,GAAM,EAElG,OACE,EAAC,EAAD,CACE,SACE,EAACA,EAAD,CACS,QACC,SACR,cAAe,GACN,UACE,YACG,cACf,CAAA,WAGH,EAAC,EAAD,CAAe,GAAI,CAAQ,CAAA,CACnB,CAAA,CAEd,CAEA,SAAS,EAAc,EAAkC,CACvD,IAAM,EAAS,EAAU,EAEzB,GAAI,CAAC,EAAQ,CACX,GAAM,CAAE,QAAQ,OAAQ,SAAS,OAAQ,UAAU,aAAc,YAAW,eAAe,CAAC,GAAM,EAElG,OACE,EAACA,EAAD,CACS,QACC,SACR,cAAe,GACN,UACE,YACG,cACf,CAAA,CAEL,CAEA,OAAO,EAAC,EAAD,CAAe,GAAI,EAAe,QAAS,CAAA,CACpD,CAEA,SAAS,EAAc,CACrB,SACA,eACA,kBACA,cACA,QACA,WACA,OAEA,QAAQ,QACR,OACA,UAAU,aACV,UAAU,CAAC,EACX,mBAAmB,CAAC,EACpB,gBAAgB,GAChB,mBAAmB,GAEnB,QAAQ,OACR,SAAS,OACT,YACA,eAAe,CAAC,EAEhB,cAAc,EACd,UAAU,EACV,WACA,aAAa,GACoC,CACjD,GAAM,CAAC,EAAe,GAAoB,EAAS,EAAK,EAClD,EAAY,EAAe,CAAM,EACjC,EAAY,EAAiD,IAAA,EAAS,EACtE,EAAe,EAA8B,IAAI,EACjD,EAAa,EAAO,CAAO,EAC3B,EAAiB,EAAO,CAAW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,EAAG,CACjC,IAAM,EAAU,EAAU,QAAS,OAAO,gBAAgB,CACxD,SAAU,CACZ,CAAC,EACD,IAAa,CAAO,CACtB,CAEJ,CAAC,EAED,UAAa,CACX,GAAuB,QAAQ,CACjC,CACF,CACA,UAAa,CAEb,CACF,EAAG,CAAC,EAAe,CAAU,CAAC,EAE9B,SAAS,GAAsB,CAC7B,EAAgB,SAAS,QAAQ,EACjC,IAAM,EAAS,EAAU,QACnB,EAAQ,EAAO,SAAS,EAE1B,GACE,GACF,EAAW,IAAI,EAAM,EAAO,cAAc,CAAC,EAG7C,EAAO,SAAS,IAAI,GACX,IAGT,EAAO,SAAS,IAAI,EAChB,CAAC,EAAM,WAAW,GAAK,CAAC,EAAM,mBAAmB,GACnD,EAAM,QAAQ,GAIlB,EAAO,QAAQ,EAEf,EAAU,QAAU,IAAA,GACpB,EAAgB,QAAU,GAC1B,EAAiB,EAAK,CACxB,CAEA,OACE,EAACA,EAAD,CACS,QACC,SACO,gBACN,UACT,KAAM,EACK,YACG,cACf,CAAA,CAEL"}
|
package/dist/Editor/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";const e=require("./Editor.cjs");var t=(0,require("react").memo)(e.default);exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/Editor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport Editor from './Editor';\n\nexport * from './types';\n\nexport default memo(Editor);\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Editor"],"sources":["../../src/Editor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport Editor from './Editor';\n\nexport * from './types';\n\nexport default memo(Editor);\n"],"mappings":"6CAMA,IAAA,GAAA,iBAAA,CAAA,CAAA,KAAA,CAAoBA,EAAAA,OAAM"}
|
package/dist/Editor/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import e from"./Editor.js";import{memo as t}from"react";var n=t(e);export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/Editor/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/Editor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport Editor from './Editor';\n\nexport * from './types';\n\nexport default memo(Editor);\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/Editor/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport Editor from './Editor';\n\nexport * from './types';\n\nexport default memo(Editor);\n"],"mappings":"wDAMA,IAAA,EAAe,EAAK,CAAM"}
|
package/dist/Editor/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { editor } from 'monaco-editor
|
|
1
|
+
import type { editor } from 'monaco-editor';
|
|
2
2
|
import type { Monaco } from '..';
|
|
3
3
|
import type { ReactNode } from 'react';
|
|
4
4
|
export type OnMount = (editor: editor.IStandaloneCodeEditor, monaco: Monaco) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Editor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Editor/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,qBAAqB,EAAE,MAAM,EA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AAM,CAAC;IAEtB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB"}
|
package/dist/Loading/Loading.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=Loading.cjs.map
|
|
1
|
+
"use strict";const e=require("./styles.cjs");let t=require("react/jsx-runtime");function n({children:n}){return(0,t.jsx)(`div`,{style:e.default.container,children:n})}exports.default=n;
|
|
2
|
+
//# sourceMappingURL=Loading.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.cjs","sources":["../../src/Loading/Loading.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactElement } from 'react';\n\nimport styles from './styles';\n\nfunction Loading({ children }: PropsWithChildren): ReactElement {\n return <div style={styles.container}>{children}</div>;\n}\n\nexport default Loading;\n"],"
|
|
1
|
+
{"version":3,"file":"Loading.cjs","names":["styles"],"sources":["../../src/Loading/Loading.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactElement } from 'react';\n\nimport styles from './styles';\n\nfunction Loading({ children }: PropsWithChildren): ReactElement {\n return <div style={styles.container}>{children}</div>;\n}\n\nexport default Loading;\n"],"mappings":"gFAIA,SAAS,EAAQ,CAAE,YAA6C,CAC9D,OAAO,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAAOA,EAAAA,QAAO,UAAY,UAAc,CAAA,CACtD"}
|
package/dist/Loading/Loading.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=Loading.js.map
|
|
1
|
+
import e from"./styles.js";import{jsx as t}from"react/jsx-runtime";function n({children:n}){return t(`div`,{style:e.container,children:n})}export{n as default};
|
|
2
|
+
//# sourceMappingURL=Loading.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loading.js","sources":["../../src/Loading/Loading.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactElement } from 'react';\n\nimport styles from './styles';\n\nfunction Loading({ children }: PropsWithChildren): ReactElement {\n return <div style={styles.container}>{children}</div>;\n}\n\nexport default Loading;\n"],"
|
|
1
|
+
{"version":3,"file":"Loading.js","names":[],"sources":["../../src/Loading/Loading.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactElement } from 'react';\n\nimport styles from './styles';\n\nfunction Loading({ children }: PropsWithChildren): ReactElement {\n return <div style={styles.container}>{children}</div>;\n}\n\nexport default Loading;\n"],"mappings":"mEAIA,SAAS,EAAQ,CAAE,YAA6C,CAC9D,OAAO,EAAC,MAAD,CAAK,MAAO,EAAO,UAAY,UAAc,CAAA,CACtD"}
|
package/dist/Loading/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./Loading.cjs");
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var e=require("./Loading.cjs").default;exports.default=e;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Loading"],"sources":["../../src/Loading/index.ts"],"sourcesContent":["import Loading from './Loading';\n\nexport default Loading;\n"],"mappings":"aAEA,IAAA,yBAAeA,CAAAA,CAAAA"}
|
package/dist/Loading/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import e from"./Loading.js";var t=e;export{t as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/Loading/index.ts"],"sourcesContent":["import Loading from './Loading';\n\nexport default Loading;\n"],"mappings":"4BAEA,IAAA,EAAe"}
|
package/dist/Loading/styles.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=styles.cjs.map
|
|
1
|
+
"use strict";const e={container:{display:`flex`,height:`100%`,width:`100%`,justifyContent:`center`,alignItems:`center`}};exports.default=e;
|
|
2
|
+
//# sourceMappingURL=styles.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.cjs","sources":["../../src/Loading/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n container: {\n display: 'flex',\n height: '100%',\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport default styles;\n"],"
|
|
1
|
+
{"version":3,"file":"styles.cjs","names":[],"sources":["../../src/Loading/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n container: {\n display: 'flex',\n height: '100%',\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport default styles;\n"],"mappings":"aAEA,MAAM,EAAwC,CAC5C,UAAW,CACT,QAAS,OACT,OAAQ,OACR,MAAO,OACP,eAAgB,SAChB,WAAY,QACd,CACF"}
|
package/dist/Loading/styles.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
2
|
-
//# sourceMappingURL=styles.js.map
|
|
1
|
+
const e={container:{display:`flex`,height:`100%`,width:`100%`,justifyContent:`center`,alignItems:`center`}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../src/Loading/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n container: {\n display: 'flex',\n height: '100%',\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport default styles;\n"],"
|
|
1
|
+
{"version":3,"file":"styles.js","names":[],"sources":["../../src/Loading/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n container: {\n display: 'flex',\n height: '100%',\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport default styles;\n"],"mappings":"AAEA,MAAM,EAAwC,CAC5C,UAAW,CACT,QAAS,OACT,OAAQ,OACR,MAAO,OACP,eAAgB,SAChB,WAAY,QACd,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=MonacoContainer.cjs.map
|
|
1
|
+
"use strict";const e=require("./styles.cjs"),t=require("../Loading/index.cjs");let n=require("react/jsx-runtime");function r({width:r,height:i,isEditorReady:a,loading:o,_ref:s,className:c,wrapperProps:l}){return(0,n.jsxs)(`section`,{style:{...e.default.wrapper,width:r,height:i},...l,children:[!a&&(0,n.jsx)(t.default,{children:o}),(0,n.jsx)(`div`,{ref:s,style:{...e.default.fullWidth,...!a&&e.default.hide},className:c})]})}exports.default=r;
|
|
2
|
+
//# sourceMappingURL=MonacoContainer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonacoContainer.cjs","sources":["../../src/MonacoContainer/MonacoContainer.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport styles from './styles';\nimport Loading from '../Loading';\nimport type { ContainerProps } from './types';\n\n// ** forwardref render functions do not support proptypes or defaultprops **\n// one of the reasons why we use a separate prop for passing ref instead of using forwardref\n\nfunction MonacoContainer({\n width,\n height,\n isEditorReady,\n loading,\n _ref,\n className,\n wrapperProps,\n}: ContainerProps): ReactElement {\n return (\n <section style={{ ...styles.wrapper, width, height }} {...wrapperProps}>\n {!isEditorReady && <Loading>{loading}</Loading>}\n <div ref={_ref} style={{ ...styles.fullWidth, ...(!isEditorReady && styles.hide) }} className={className} />\n </section>\n );\n}\n\nexport default MonacoContainer;\n"],"
|
|
1
|
+
{"version":3,"file":"MonacoContainer.cjs","names":["styles","Loading"],"sources":["../../src/MonacoContainer/MonacoContainer.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport styles from './styles';\nimport Loading from '../Loading';\nimport type { ContainerProps } from './types';\n\n// ** forwardref render functions do not support proptypes or defaultprops **\n// one of the reasons why we use a separate prop for passing ref instead of using forwardref\n\nfunction MonacoContainer({\n width,\n height,\n isEditorReady,\n loading,\n _ref,\n className,\n wrapperProps,\n}: ContainerProps): ReactElement {\n return (\n <section style={{ ...styles.wrapper, width, height }} {...wrapperProps}>\n {!isEditorReady && <Loading>{loading}</Loading>}\n <div ref={_ref} style={{ ...styles.fullWidth, ...(!isEditorReady && styles.hide) }} className={className} />\n </section>\n );\n}\n\nexport default MonacoContainer;\n"],"mappings":"kHASA,SAAS,EAAgB,CACvB,QACA,SACA,gBACA,UACA,OACA,YACA,gBAC+B,CAC/B,OACE,EAAA,EAAA,KAAA,CAAC,UAAD,CAAS,MAAO,CAAE,GAAGA,EAAAA,QAAO,QAAS,QAAO,QAAO,EAAG,GAAI,WAA1D,CACG,CAAC,IAAiB,EAAA,EAAA,IAAA,CAACC,EAAAA,QAAD,CAAA,SAAU,CAAiB,CAAA,GAC9C,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,IAAK,EAAM,MAAO,CAAE,GAAGD,EAAAA,QAAO,UAAW,GAAI,CAAC,GAAiBA,EAAAA,QAAO,IAAM,EAAc,WAAY,CAAA,CACpG,GAEb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=MonacoContainer.js.map
|
|
1
|
+
import e from"./styles.js";import t from"../Loading/index.js";import{jsx as n,jsxs as r}from"react/jsx-runtime";function i({width:i,height:a,isEditorReady:o,loading:s,_ref:c,className:l,wrapperProps:u}){return r(`section`,{style:{...e.wrapper,width:i,height:a},...u,children:[!o&&n(t,{children:s}),n(`div`,{ref:c,style:{...e.fullWidth,...!o&&e.hide},className:l})]})}export{i as default};
|
|
2
|
+
//# sourceMappingURL=MonacoContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MonacoContainer.js","sources":["../../src/MonacoContainer/MonacoContainer.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport styles from './styles';\nimport Loading from '../Loading';\nimport type { ContainerProps } from './types';\n\n// ** forwardref render functions do not support proptypes or defaultprops **\n// one of the reasons why we use a separate prop for passing ref instead of using forwardref\n\nfunction MonacoContainer({\n width,\n height,\n isEditorReady,\n loading,\n _ref,\n className,\n wrapperProps,\n}: ContainerProps): ReactElement {\n return (\n <section style={{ ...styles.wrapper, width, height }} {...wrapperProps}>\n {!isEditorReady && <Loading>{loading}</Loading>}\n <div ref={_ref} style={{ ...styles.fullWidth, ...(!isEditorReady && styles.hide) }} className={className} />\n </section>\n );\n}\n\nexport default MonacoContainer;\n"],"
|
|
1
|
+
{"version":3,"file":"MonacoContainer.js","names":["Loading"],"sources":["../../src/MonacoContainer/MonacoContainer.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\n\nimport styles from './styles';\nimport Loading from '../Loading';\nimport type { ContainerProps } from './types';\n\n// ** forwardref render functions do not support proptypes or defaultprops **\n// one of the reasons why we use a separate prop for passing ref instead of using forwardref\n\nfunction MonacoContainer({\n width,\n height,\n isEditorReady,\n loading,\n _ref,\n className,\n wrapperProps,\n}: ContainerProps): ReactElement {\n return (\n <section style={{ ...styles.wrapper, width, height }} {...wrapperProps}>\n {!isEditorReady && <Loading>{loading}</Loading>}\n <div ref={_ref} style={{ ...styles.fullWidth, ...(!isEditorReady && styles.hide) }} className={className} />\n </section>\n );\n}\n\nexport default MonacoContainer;\n"],"mappings":"gHASA,SAAS,EAAgB,CACvB,QACA,SACA,gBACA,UACA,OACA,YACA,gBAC+B,CAC/B,OACE,EAAC,UAAD,CAAS,MAAO,CAAE,GAAG,EAAO,QAAS,QAAO,QAAO,EAAG,GAAI,WAA1D,CACG,CAAC,GAAiB,EAACA,EAAD,CAAA,SAAU,CAAiB,CAAA,EAC9C,EAAC,MAAD,CAAK,IAAK,EAAM,MAAO,CAAE,GAAG,EAAO,UAAW,GAAI,CAAC,GAAiB,EAAO,IAAM,EAAc,WAAY,CAAA,CACpG,GAEb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";const e=require("./MonacoContainer.cjs");var t=(0,require("react").memo)(e.default);exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/MonacoContainer/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport MonacoContainer from './MonacoContainer';\n\nexport default memo(MonacoContainer);\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["MonacoContainer"],"sources":["../../src/MonacoContainer/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport MonacoContainer from './MonacoContainer';\n\nexport default memo(MonacoContainer);\n"],"mappings":"sDAIA,IAAA,GAAA,iBAAA,CAAA,CAAA,KAAA,CAAoBA,EAAAA,OAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import e from"./MonacoContainer.js";import{memo as t}from"react";var n=t(e);export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/MonacoContainer/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport MonacoContainer from './MonacoContainer';\n\nexport default memo(MonacoContainer);\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/MonacoContainer/index.ts"],"sourcesContent":["import { memo } from 'react';\n\nimport MonacoContainer from './MonacoContainer';\n\nexport default memo(MonacoContainer);\n"],"mappings":"iEAIA,IAAA,EAAe,EAAK,CAAe"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=styles.cjs.map
|
|
1
|
+
"use strict";const e={wrapper:{display:`flex`,position:`relative`,textAlign:`initial`},fullWidth:{width:`100%`},hide:{display:`none`}};exports.default=e;
|
|
2
|
+
//# sourceMappingURL=styles.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.cjs","sources":["../../src/MonacoContainer/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n display: 'flex',\n position: 'relative',\n textAlign: 'initial',\n },\n fullWidth: {\n width: '100%',\n },\n hide: {\n display: 'none',\n },\n};\n\nexport default styles;\n"],"
|
|
1
|
+
{"version":3,"file":"styles.cjs","names":[],"sources":["../../src/MonacoContainer/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n display: 'flex',\n position: 'relative',\n textAlign: 'initial',\n },\n fullWidth: {\n width: '100%',\n },\n hide: {\n display: 'none',\n },\n};\n\nexport default styles;\n"],"mappings":"aAEA,MAAM,EAAwC,CAC5C,QAAS,CACP,QAAS,OACT,SAAU,WACV,UAAW,SACb,EACA,UAAW,CACT,MAAO,MACT,EACA,KAAM,CACJ,QAAS,MACX,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
2
|
-
//# sourceMappingURL=styles.js.map
|
|
1
|
+
const e={wrapper:{display:`flex`,position:`relative`,textAlign:`initial`},fullWidth:{width:`100%`},hide:{display:`none`}};export{e as default};
|
|
2
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../src/MonacoContainer/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n display: 'flex',\n position: 'relative',\n textAlign: 'initial',\n },\n fullWidth: {\n width: '100%',\n },\n hide: {\n display: 'none',\n },\n};\n\nexport default styles;\n"],"
|
|
1
|
+
{"version":3,"file":"styles.js","names":[],"sources":["../../src/MonacoContainer/styles.ts"],"sourcesContent":["import type { CSSProperties } from 'react';\n\nconst styles: Record<string, CSSProperties> = {\n wrapper: {\n display: 'flex',\n position: 'relative',\n textAlign: 'initial',\n },\n fullWidth: {\n width: '100%',\n },\n hide: {\n display: 'none',\n },\n};\n\nexport default styles;\n"],"mappings":"AAEA,MAAM,EAAwC,CAC5C,QAAS,CACP,QAAS,OACT,SAAU,WACV,UAAW,SACb,EACA,UAAW,CACT,MAAO,MACT,EACA,KAAM,CACJ,QAAS,MACX,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";const e=require("./initMonaco.cjs");let t=require("react");function n(){if((0,t.useSyncExternalStore)(r,i,a))return(0,t.use)(e.default())}function r(e){let t=setTimeout(e,0);return()=>{clearTimeout(t)}}function i(){return!0}function a(){return!1}exports.default=n;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import { use, useSyncExternalStore } from 'react';\n\nimport type { Monaco } from '../..';\nimport initMonaco from './initMonaco';\n\nfunction useMonaco(): Monaco | undefined {\n const isHydrated = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);\n\n if (!isHydrated) {\n return undefined;\n }\n\n return use(initMonaco());\n}\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const timeoutId = setTimeout(onStoreChange, 0);\n\n return () => {\n clearTimeout(timeoutId);\n };\n}\n\nfunction getClientSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport default useMonaco;\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["initMonaco"],"sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import { use, useSyncExternalStore } from 'react';\n\nimport type { Monaco } from '../..';\nimport initMonaco from './initMonaco';\n\nfunction useMonaco(): Monaco | undefined {\n const isHydrated = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);\n\n if (!isHydrated) {\n return undefined;\n }\n\n return use(initMonaco());\n}\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const timeoutId = setTimeout(onStoreChange, 0);\n\n return () => {\n clearTimeout(timeoutId);\n };\n}\n\nfunction getClientSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport default useMonaco;\n"],"mappings":"wEAKA,SAAS,GAAgC,CAGnC,IAAA,EAAA,EAAA,qBAAA,CAFoC,EAAW,EAAmB,CAExD,EAId,OAAA,EAAA,EAAA,IAAA,CAAWA,EAAAA,QAAW,CAAC,CACzB,CAEA,SAAS,EAAU,EAAuC,CACxD,IAAM,EAAY,WAAW,EAAe,CAAC,EAE7C,UAAa,CACX,aAAa,CAAS,CACxB,CACF,CAEA,SAAS,GAA6B,CACpC,MAAO,EACT,CAEA,SAAS,GAA6B,CACpC,MAAO,EACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import e from"./initMonaco.js";import{use as t,useSyncExternalStore as n}from"react";function r(){if(n(i,a,o))return t(e())}function i(e){let t=setTimeout(e,0);return()=>{clearTimeout(t)}}function a(){return!0}function o(){return!1}export{r as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import { use, useSyncExternalStore } from 'react';\n\nimport type { Monaco } from '../..';\nimport initMonaco from './initMonaco';\n\nfunction useMonaco(): Monaco | undefined {\n const isHydrated = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);\n\n if (!isHydrated) {\n return undefined;\n }\n\n return use(initMonaco());\n}\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const timeoutId = setTimeout(onStoreChange, 0);\n\n return () => {\n clearTimeout(timeoutId);\n };\n}\n\nfunction getClientSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport default useMonaco;\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useMonaco/index.ts"],"sourcesContent":["import { use, useSyncExternalStore } from 'react';\n\nimport type { Monaco } from '../..';\nimport initMonaco from './initMonaco';\n\nfunction useMonaco(): Monaco | undefined {\n const isHydrated = useSyncExternalStore(subscribe, getClientSnapshot, getServerSnapshot);\n\n if (!isHydrated) {\n return undefined;\n }\n\n return use(initMonaco());\n}\n\nfunction subscribe(onStoreChange: () => void): () => void {\n const timeoutId = setTimeout(onStoreChange, 0);\n\n return () => {\n clearTimeout(timeoutId);\n };\n}\n\nfunction getClientSnapshot(): boolean {\n return true;\n}\n\nfunction getServerSnapshot(): boolean {\n return false;\n}\n\nexport default useMonaco;\n"],"mappings":"qFAKA,SAAS,GAAgC,CACpB,KAAqB,EAAW,EAAmB,CAExD,EAId,OAAO,EAAI,EAAW,CAAC,CACzB,CAEA,SAAS,EAAU,EAAuC,CACxD,IAAM,EAAY,WAAW,EAAe,CAAC,EAE7C,UAAa,CACX,aAAa,CAAS,CACxB,CACF,CAEA,SAAS,GAA6B,CACpC,MAAO,EACT,CAEA,SAAS,GAA6B,CACpC,MAAO,EACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=initMonaco.cjs.map
|
|
1
|
+
"use strict";const e=require("../../_virtual/_rolldown/runtime.cjs");let t=require("@willbooster/monaco-loader");t=e.__toESM(t,1);let n;function r(){return n??=t.default.init(),n}exports.default=r;
|
|
2
|
+
//# sourceMappingURL=initMonaco.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMonaco.cjs","sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\n\nimport type { Monaco } from '../..';\n\nlet monacoPromise: Promise<Monaco> | undefined;\n\nfunction initMonaco(): Promise<Monaco> {\n monacoPromise ??= loader.init() as Promise<Monaco>;\n return monacoPromise;\n}\n\nexport default initMonaco;\n"],"
|
|
1
|
+
{"version":3,"file":"initMonaco.cjs","names":["loader"],"sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\n\nimport type { Monaco } from '../..';\n\nlet monacoPromise: Promise<Monaco> | undefined;\n\nfunction initMonaco(): Promise<Monaco> {\n monacoPromise ??= loader.init() as Promise<Monaco>;\n return monacoPromise;\n}\n\nexport default initMonaco;\n"],"mappings":"kIAIA,IAAI,EAEJ,SAAS,GAA8B,CAErC,MADA,KAAkBA,EAAAA,QAAO,KAAK,EACvB,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
//# sourceMappingURL=initMonaco.js.map
|
|
1
|
+
import e from"@willbooster/monaco-loader";let t;function n(){return t??=e.init(),t}export{n as default};
|
|
2
|
+
//# sourceMappingURL=initMonaco.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMonaco.js","sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\n\nimport type { Monaco } from '../..';\n\nlet monacoPromise: Promise<Monaco> | undefined;\n\nfunction initMonaco(): Promise<Monaco> {\n monacoPromise ??= loader.init() as Promise<Monaco>;\n return monacoPromise;\n}\n\nexport default initMonaco;\n"],"
|
|
1
|
+
{"version":3,"file":"initMonaco.js","names":[],"sources":["../../../src/hooks/useMonaco/initMonaco.ts"],"sourcesContent":["import loader from '@willbooster/monaco-loader';\n\nimport type { Monaco } from '../..';\n\nlet monacoPromise: Promise<Monaco> | undefined;\n\nfunction initMonaco(): Promise<Monaco> {\n monacoPromise ??= loader.init() as Promise<Monaco>;\n return monacoPromise;\n}\n\nexport default initMonaco;\n"],"mappings":"0CAIA,IAAI,EAEJ,SAAS,GAA8B,CAErC,MADA,KAAkB,EAAO,KAAK,EACvB,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";let e=require("react");function t(t){let n=(0,e.useRef)(t);(0,e.useEffect)(()=>n.current(),[])}exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useMount/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { EffectCallback } from 'react';\n\nfunction useMount(effect: EffectCallback): void {\n const effectRef = useRef(effect);\n\n useEffect(() => effectRef.current(), []);\n}\n\nexport default useMount;\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/hooks/useMount/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { EffectCallback } from 'react';\n\nfunction useMount(effect: EffectCallback): void {\n const effectRef = useRef(effect);\n\n useEffect(() => effectRef.current(), []);\n}\n\nexport default useMount;\n"],"mappings":"oCAGA,SAAS,EAAS,EAA8B,CAC9C,IAAM,GAAA,EAAA,EAAA,OAAA,CAAmB,CAAM,GAE/B,EAAA,EAAA,UAAA,KAAgB,EAAU,QAAQ,EAAG,CAAC,CAAC,CACzC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{useEffect as e,useRef as t}from"react";function n(n){let r=t(n);e(()=>r.current(),[])}export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useMount/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { EffectCallback } from 'react';\n\nfunction useMount(effect: EffectCallback): void {\n const effectRef = useRef(effect);\n\n useEffect(() => effectRef.current(), []);\n}\n\nexport default useMount;\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useMount/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { EffectCallback } from 'react';\n\nfunction useMount(effect: EffectCallback): void {\n const effectRef = useRef(effect);\n\n useEffect(() => effectRef.current(), []);\n}\n\nexport default useMount;\n"],"mappings":"8CAGA,SAAS,EAAS,EAA8B,CAC9C,IAAM,EAAY,EAAO,CAAM,EAE/B,MAAgB,EAAU,QAAQ,EAAG,CAAC,CAAC,CACzC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";let e=require("react");function t(t){let n=(0,e.useRef)(void 0);return(0,e.useEffect)(()=>{n.current=t},[t]),n.current}exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/usePrevious/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nfunction usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\nexport default usePrevious;\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/hooks/usePrevious/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nfunction usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\nexport default usePrevious;\n"],"mappings":"oCAEA,SAAS,EAAe,EAAyB,CAC/C,IAAM,GAAA,EAAA,EAAA,OAAA,CAA4B,IAAA,EAAS,EAM3C,OAJA,EAAA,EAAA,UAAA,KAAgB,CACd,EAAI,QAAU,CAChB,EAAG,CAAC,CAAK,CAAC,EAEH,EAAI,OACb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{useEffect as e,useRef as t}from"react";function n(n){let r=t(void 0);return e(()=>{r.current=n},[n]),r.current}export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/usePrevious/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nfunction usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\nexport default usePrevious;\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/usePrevious/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\nfunction usePrevious<T>(value: T): T | undefined {\n const ref = useRef<T | undefined>(undefined);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\nexport default usePrevious;\n"],"mappings":"8CAEA,SAAS,EAAe,EAAyB,CAC/C,IAAM,EAAM,EAAsB,IAAA,EAAS,EAM3C,OAJA,MAAgB,CACd,EAAI,QAAU,CAChB,EAAG,CAAC,CAAK,CAAC,EAEH,EAAI,OACb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";let e=require("react");function t(t,n,r=!0){let i=(0,e.useRef)(!0),a=(0,e.useRef)(r),o=(0,e.useRef)(t);a.current=r,o.current=t,(0,e.useEffect)(()=>{if(i.current||!a.current){i.current=!1;return}return o.current()},n)}exports.default=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useUpdate/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { DependencyList, EffectCallback } from 'react';\n\nfunction useUpdate(effect: EffectCallback, deps: DependencyList, applyChanges = true): void {\n const isInitialMount = useRef(true);\n const applyChangesRef = useRef(applyChanges);\n const effectRef = useRef(effect);\n\n applyChangesRef.current = applyChanges;\n effectRef.current = effect;\n\n useEffect(() => {\n if (isInitialMount.current || !applyChangesRef.current) {\n isInitialMount.current = false;\n return;\n }\n\n return effectRef.current();\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- useUpdate forwards caller-owned dependencies.\n }, deps);\n}\n\nexport default useUpdate;\n"],"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/hooks/useUpdate/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { DependencyList, EffectCallback } from 'react';\n\nfunction useUpdate(effect: EffectCallback, deps: DependencyList, applyChanges = true): void {\n const isInitialMount = useRef(true);\n const applyChangesRef = useRef(applyChanges);\n const effectRef = useRef(effect);\n\n applyChangesRef.current = applyChanges;\n effectRef.current = effect;\n\n useEffect(() => {\n if (isInitialMount.current || !applyChangesRef.current) {\n isInitialMount.current = false;\n return;\n }\n\n return effectRef.current();\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- useUpdate forwards caller-owned dependencies.\n }, deps);\n}\n\nexport default useUpdate;\n"],"mappings":"oCAGA,SAAS,EAAU,EAAwB,EAAsB,EAAe,GAAY,CAC1F,IAAM,GAAA,EAAA,EAAA,OAAA,CAAwB,EAAI,EAC5B,GAAA,EAAA,EAAA,OAAA,CAAyB,CAAY,EACrC,GAAA,EAAA,EAAA,OAAA,CAAmB,CAAM,EAE/B,EAAgB,QAAU,EAC1B,EAAU,QAAU,GAEpB,EAAA,EAAA,UAAA,KAAgB,CACd,GAAI,EAAe,SAAW,CAAC,EAAgB,QAAS,CACtD,EAAe,QAAU,GACzB,MACF,CAEA,OAAO,EAAU,QAAQ,CAE3B,EAAG,CAAI,CACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{useEffect as e,useRef as t}from"react";function n(n,r,i=!0){let a=t(!0),o=t(i),s=t(n);o.current=i,s.current=n,e(()=>{if(a.current||!o.current){a.current=!1;return}return s.current()},r)}export{n as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useUpdate/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { DependencyList, EffectCallback } from 'react';\n\nfunction useUpdate(effect: EffectCallback, deps: DependencyList, applyChanges = true): void {\n const isInitialMount = useRef(true);\n const applyChangesRef = useRef(applyChanges);\n const effectRef = useRef(effect);\n\n applyChangesRef.current = applyChanges;\n effectRef.current = effect;\n\n useEffect(() => {\n if (isInitialMount.current || !applyChangesRef.current) {\n isInitialMount.current = false;\n return;\n }\n\n return effectRef.current();\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- useUpdate forwards caller-owned dependencies.\n }, deps);\n}\n\nexport default useUpdate;\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/hooks/useUpdate/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { DependencyList, EffectCallback } from 'react';\n\nfunction useUpdate(effect: EffectCallback, deps: DependencyList, applyChanges = true): void {\n const isInitialMount = useRef(true);\n const applyChangesRef = useRef(applyChanges);\n const effectRef = useRef(effect);\n\n applyChangesRef.current = applyChanges;\n effectRef.current = effect;\n\n useEffect(() => {\n if (isInitialMount.current || !applyChangesRef.current) {\n isInitialMount.current = false;\n return;\n }\n\n return effectRef.current();\n // oxlint-disable-next-line react-hooks/exhaustive-deps -- useUpdate forwards caller-owned dependencies.\n }, deps);\n}\n\nexport default useUpdate;\n"],"mappings":"8CAGA,SAAS,EAAU,EAAwB,EAAsB,EAAe,GAAY,CAC1F,IAAM,EAAiB,EAAO,EAAI,EAC5B,EAAkB,EAAO,CAAY,EACrC,EAAY,EAAO,CAAM,EAE/B,EAAgB,QAAU,EAC1B,EAAU,QAAU,EAEpB,MAAgB,CACd,GAAI,EAAe,SAAW,CAAC,EAAgB,QAAS,CACtD,EAAe,QAAU,GACzB,MACF,CAEA,OAAO,EAAU,QAAQ,CAE3B,EAAG,CAAI,CACT"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./_virtual/_rolldown/runtime.cjs"),t=require("./hooks/useMonaco/index.cjs"),n=require("./DiffEditor/index.cjs"),r=require("./Editor/index.cjs");let i=require("@willbooster/monaco-loader");i=e.__toESM(i,1);var a=r.default;exports.DiffEditor=n.default,exports.Editor=r.default,exports.default=a,exports.loader=i.default,exports.useMonaco=t.default;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Editor"],"sources":["../src/index.ts"],"sourcesContent":["'use client';\n\nimport loader from '@willbooster/monaco-loader';\nexport { loader };\n\nimport DiffEditor from './DiffEditor';\nexport * from './DiffEditor/types';\nexport { DiffEditor };\n\nimport useMonaco from './hooks/useMonaco';\nexport { useMonaco };\n\nimport Editor from './Editor';\nexport * from './Editor/types';\nexport { Editor };\nexport default Editor;\n\n// Monaco\nimport type * as monaco from 'monaco-editor';\nexport type Monaco = typeof monaco;\n\n// Default themes\nexport type Theme = 'vs-dark' | 'light';\n"],"mappings":"uVAeA,IAAA,EAAeA,EAAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import Editor from './Editor';
|
|
|
9
9
|
export * from './Editor/types';
|
|
10
10
|
export { Editor };
|
|
11
11
|
export default Editor;
|
|
12
|
-
import type * as monaco from 'monaco-editor
|
|
12
|
+
import type * as monaco from 'monaco-editor';
|
|
13
13
|
export type Monaco = typeof monaco;
|
|
14
14
|
export type Theme = 'vs-dark' | 'light';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;eACH,MAAM;AAGrB,OAAO,KAAK,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;eACH,MAAM;AAGrB,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAGnC,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use client";import e from"./hooks/useMonaco/index.js";import t from"./DiffEditor/index.js";import n from"./Editor/index.js";import r from"@willbooster/monaco-loader";var i=n;export{t as DiffEditor,n as Editor,i as default,r as loader,e as useMonaco};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Editor"],"sources":["../src/index.ts"],"sourcesContent":["'use client';\n\nimport loader from '@willbooster/monaco-loader';\nexport { loader };\n\nimport DiffEditor from './DiffEditor';\nexport * from './DiffEditor/types';\nexport { DiffEditor };\n\nimport useMonaco from './hooks/useMonaco';\nexport { useMonaco };\n\nimport Editor from './Editor';\nexport * from './Editor/types';\nexport { Editor };\nexport default Editor;\n\n// Monaco\nimport type * as monaco from 'monaco-editor';\nexport type Monaco = typeof monaco;\n\n// Default themes\nexport type Theme = 'vs-dark' | 'light';\n"],"mappings":"uKAeA,IAAA,EAAeA"}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function t(t,
|
|
2
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";function e(){}function t(e,t,i,a){return n(e,a)??r(e,t,i,a)}function n(e,t){return e.editor.getModel(i(e,t))}function r(e,t,n,r){return e.editor.createModel(t,n,r?i(e,r):void 0)}function i(e,t){if(a(t))return e.Uri.parse(t);let n=t.replaceAll(`\\`,`/`);if(n.startsWith(`//`)){let[t,...r]=n.slice(2).split(`/`);return e.Uri.from({scheme:`file`,authority:t,path:`/${r.join(`/`)}`})}return e.Uri.from({scheme:`file`,path:n.startsWith(`/`)?n:`/${n}`})}function a(e){return/^[a-z][a-z0-9+.-]+:/i.test(e)}exports.getOrCreateModel=t,exports.noop=e;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n if (hasUriScheme(path)) {\n return monaco.Uri.parse(path);\n }\n\n const normalizedPath = path.replaceAll('\\\\', '/');\n if (normalizedPath.startsWith('//')) {\n const [authority, ...pathParts] = normalizedPath.slice(2).split('/');\n return monaco.Uri.from({\n scheme: 'file',\n authority,\n path: `/${pathParts.join('/')}`,\n });\n }\n\n return monaco.Uri.from({\n scheme: 'file',\n path: normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`,\n });\n}\n\nfunction hasUriScheme(path: string): boolean {\n return /^[a-z][a-z0-9+.-]+:/i.test(path);\n}\n\nexport { noop, getOrCreateModel };\n"],"mappings":"aAOA,SAAS,GAAa,CAEtB,CAYA,SAAS,EAAiB,EAAgB,EAAe,EAAkB,EAAiC,CAC1G,OAAO,EAAS,EAAQ,CAAI,GAAK,EAAY,EAAQ,EAAO,EAAU,CAAI,CAC5E,CASA,SAAS,EAAS,EAAgB,EAAwC,CACxE,OAAO,EAAO,OAAO,SAAS,EAAe,EAAQ,CAAI,CAAC,CAC5D,CAUA,SAAS,EAAY,EAAgB,EAAe,EAAmB,EAAkC,CACvG,OAAO,EAAO,OAAO,YAAY,EAAO,EAAU,EAAO,EAAe,EAAQ,CAAI,EAAI,IAAA,EAAS,CACnG,CAQA,SAAS,EAAe,EAAgB,EAAmB,CACzD,GAAI,EAAa,CAAI,EACnB,OAAO,EAAO,IAAI,MAAM,CAAI,EAG9B,IAAM,EAAiB,EAAK,WAAW,KAAM,GAAG,EAChD,GAAI,EAAe,WAAW,IAAI,EAAG,CACnC,GAAM,CAAC,EAAW,GAAG,GAAa,EAAe,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,EACnE,OAAO,EAAO,IAAI,KAAK,CACrB,OAAQ,OACR,YACA,KAAM,IAAI,EAAU,KAAK,GAAG,GAC9B,CAAC,CACH,CAEA,OAAO,EAAO,IAAI,KAAK,CACrB,OAAQ,OACR,KAAM,EAAe,WAAW,GAAG,EAAI,EAAiB,IAAI,GAC9D,CAAC,CACH,CAEA,SAAS,EAAa,EAAuB,CAC3C,MAAO,uBAAuB,KAAK,CAAI,CACzC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACjC,OAAO,KAAK,EAAO,MAAM,EAAE,MAAM,eAAe,CAAC;AAEjD;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAEpB;AAED;;;;;;;;;GASG;AACH,iBAAS,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAE1G;AAwDD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
function e(){}function t(e,t,i,a){return n(e,a)??r(e,t,i,a)}function n(e,t){return e.editor.getModel(i(e,t))}function r(e,t,n,r){return e.editor.createModel(t,n,r?i(e,r):void 0)}function i(e,t){if(a(t))return e.Uri.parse(t);let n=t.replaceAll(`\\`,`/`);if(n.startsWith(`//`)){let[t,...r]=n.slice(2).split(`/`);return e.Uri.from({scheme:`file`,authority:t,path:`/${r.join(`/`)}`})}return e.Uri.from({scheme:`file`,path:n.startsWith(`/`)?n:`/${n}`})}function a(e){return/^[a-z][a-z0-9+.-]+:/i.test(e)}export{t as getOrCreateModel,e as noop};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["import type { Monaco } from '..';\nimport type { Uri, editor } from 'monaco-editor';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop(): void {\n /** no-op */\n}\n\n/**\n * getOrCreateModel is a helper function that will return a model if it exists\n * or create a new model if it does not exist.\n * This is useful for when you want to create a model for a file that may or may not exist yet.\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was found or created\n */\nfunction getOrCreateModel(monaco: Monaco, value: string, language: string, path: string): editor.ITextModel {\n return getModel(monaco, path) ?? createModel(monaco, value, language, path);\n}\n\n/**\n * getModel is a helper function that will return a model if it exists\n * or return undefined if it does not exist.\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model that was found or undefined\n */\nfunction getModel(monaco: Monaco, path: string): editor.ITextModel | null {\n return monaco.editor.getModel(createModelUri(monaco, path));\n}\n\n/**\n * createModel is a helper function that will create a new model\n * @param monaco The monaco instance\n * @param value The value of the model\n * @param language The language of the model\n * @param path The path of the model\n * @returns The model that was created\n */\nfunction createModel(monaco: Monaco, value: string, language?: string, path?: string): editor.ITextModel {\n return monaco.editor.createModel(value, language, path ? createModelUri(monaco, path) : undefined);\n}\n\n/**\n * createModelUri is a helper function that will create a new model uri\n * @param monaco The monaco instance\n * @param path The path of the model\n * @returns The model uri that was created\n */\nfunction createModelUri(monaco: Monaco, path: string): Uri {\n if (hasUriScheme(path)) {\n return monaco.Uri.parse(path);\n }\n\n const normalizedPath = path.replaceAll('\\\\', '/');\n if (normalizedPath.startsWith('//')) {\n const [authority, ...pathParts] = normalizedPath.slice(2).split('/');\n return monaco.Uri.from({\n scheme: 'file',\n authority,\n path: `/${pathParts.join('/')}`,\n });\n }\n\n return monaco.Uri.from({\n scheme: 'file',\n path: normalizedPath.startsWith('/') ? normalizedPath : `/${normalizedPath}`,\n });\n}\n\nfunction hasUriScheme(path: string): boolean {\n return /^[a-z][a-z0-9+.-]+:/i.test(path);\n}\n\nexport { noop, getOrCreateModel };\n"],"mappings":"AAOA,SAAS,GAAa,CAEtB,CAYA,SAAS,EAAiB,EAAgB,EAAe,EAAkB,EAAiC,CAC1G,OAAO,EAAS,EAAQ,CAAI,GAAK,EAAY,EAAQ,EAAO,EAAU,CAAI,CAC5E,CASA,SAAS,EAAS,EAAgB,EAAwC,CACxE,OAAO,EAAO,OAAO,SAAS,EAAe,EAAQ,CAAI,CAAC,CAC5D,CAUA,SAAS,EAAY,EAAgB,EAAe,EAAmB,EAAkC,CACvG,OAAO,EAAO,OAAO,YAAY,EAAO,EAAU,EAAO,EAAe,EAAQ,CAAI,EAAI,IAAA,EAAS,CACnG,CAQA,SAAS,EAAe,EAAgB,EAAmB,CACzD,GAAI,EAAa,CAAI,EACnB,OAAO,EAAO,IAAI,MAAM,CAAI,EAG9B,IAAM,EAAiB,EAAK,WAAW,KAAM,GAAG,EAChD,GAAI,EAAe,WAAW,IAAI,EAAG,CACnC,GAAM,CAAC,EAAW,GAAG,GAAa,EAAe,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,EACnE,OAAO,EAAO,IAAI,KAAK,CACrB,OAAQ,OACR,YACA,KAAM,IAAI,EAAU,KAAK,GAAG,GAC9B,CAAC,CACH,CAEA,OAAO,EAAO,IAAI,KAAK,CACrB,OAAQ,OACR,KAAM,EAAe,WAAW,GAAG,EAAI,EAAiB,IAAI,GAC9D,CAAC,CACH,CAEA,SAAS,EAAa,EAAuB,CAC3C,MAAO,uBAAuB,KAAK,CAAI,CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/monaco-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Monaco Editor for React - use the monaco-editor in any React application without needing to use webpack (or rollup/parcel/etc) configuration files / plugins",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code",
|
|
@@ -35,60 +35,58 @@
|
|
|
35
35
|
"dist/"
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
|
-
"build": "
|
|
38
|
+
"build": "bun run build/core",
|
|
39
39
|
"build/core": "build-ts lib",
|
|
40
|
-
"cleanup": "
|
|
41
|
-
"common/ci-setup": "
|
|
42
|
-
"format": "
|
|
43
|
-
"
|
|
44
|
-
"lint": "
|
|
45
|
-
"lint-fix": "yarn lint --fix",
|
|
40
|
+
"cleanup": "bun wb lint --fix --format",
|
|
41
|
+
"common/ci-setup": "bun run build/core",
|
|
42
|
+
"format": "bun wb lint --format",
|
|
43
|
+
"lint": "bun wb lint",
|
|
44
|
+
"lint-fix": "bun wb lint --fix",
|
|
46
45
|
"prepare": "lefthook install || true",
|
|
47
|
-
"test": "
|
|
48
|
-
"test:e2e:next": "yarn build && next build e2e/next-app && playwright test --config e2e/next-app/playwright.config.ts",
|
|
49
|
-
"test:unit": "vitest",
|
|
46
|
+
"test": "bun wb test",
|
|
50
47
|
"test/ci-setup": "playwright install chromium",
|
|
51
|
-
"typecheck": "wb typecheck",
|
|
52
|
-
"verify": "wb verify",
|
|
53
|
-
"verify-full": "wb verify --full"
|
|
48
|
+
"typecheck": "bun wb typecheck",
|
|
49
|
+
"verify": "bun wb verify",
|
|
50
|
+
"verify-full": "bun wb verify --full"
|
|
54
51
|
},
|
|
55
52
|
"dependencies": {
|
|
56
|
-
"@willbooster/monaco-loader": "
|
|
57
|
-
"monaco-editor": "0.
|
|
53
|
+
"@willbooster/monaco-loader": "2.0.0",
|
|
54
|
+
"monaco-editor": "0.56.0"
|
|
58
55
|
},
|
|
59
56
|
"devDependencies": {
|
|
60
57
|
"@playwright/test": "1.59.1",
|
|
61
58
|
"@testing-library/dom": "10.4.1",
|
|
62
59
|
"@testing-library/jest-dom": "6.9.1",
|
|
63
60
|
"@testing-library/react": "16.3.0",
|
|
61
|
+
"@tsconfig/bun": "1.0.10",
|
|
64
62
|
"@tsconfig/node-lts": "24.0.0",
|
|
65
63
|
"@tsconfig/node-ts": "23.6.4",
|
|
64
|
+
"@types/bun": "1.3.14",
|
|
66
65
|
"@types/node": "25.6.0",
|
|
67
66
|
"@types/react": "19.2.14",
|
|
68
67
|
"@types/react-dom": "19.2.3",
|
|
69
|
-
"@typescript/native-preview": "7.0.0-dev.20260421.2",
|
|
70
68
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
71
69
|
"@willbooster/oxlint-config": "1.4.8",
|
|
72
|
-
"@willbooster/wb": "
|
|
73
|
-
"build-ts": "
|
|
70
|
+
"@willbooster/wb": "15.4.0",
|
|
71
|
+
"build-ts": "19.0.0",
|
|
74
72
|
"conventional-changelog-conventionalcommits": "9.3.1",
|
|
75
73
|
"jsdom": "29.0.2",
|
|
76
|
-
"lefthook": "2.1.
|
|
77
|
-
"next": "16.
|
|
78
|
-
"oxfmt": "0.
|
|
79
|
-
"oxlint": "1.
|
|
80
|
-
"oxlint-tsgolint": "0.
|
|
74
|
+
"lefthook": "2.1.10",
|
|
75
|
+
"next": "16.3.0-preview.6",
|
|
76
|
+
"oxfmt": "0.59.0",
|
|
77
|
+
"oxlint": "1.74.0",
|
|
78
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
81
79
|
"react": "19.2.5",
|
|
82
80
|
"react-dom": "19.2.5",
|
|
83
81
|
"semantic-release": "25.0.3",
|
|
84
82
|
"sort-package-json": "4.0.0",
|
|
83
|
+
"typescript": "7.0.2",
|
|
85
84
|
"vitest": "4.1.4"
|
|
86
85
|
},
|
|
87
86
|
"peerDependencies": {
|
|
88
87
|
"react": "^19.0.0",
|
|
89
88
|
"react-dom": "^19.0.0"
|
|
90
89
|
},
|
|
91
|
-
"packageManager": "yarn@4.17.0",
|
|
92
90
|
"engines": {
|
|
93
91
|
"node": ">=24"
|
|
94
92
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/DiffEditor/index.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/Editor/index.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/Loading/index.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/MonacoContainer/index.spec.tsx"],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";function e(e,r,t){return(r=o(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function t(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,r);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function o(e){var r=t(e,"string");return"symbol"==typeof r?r:r+""}exports.defineProperty=e,exports.objectSpread2=function(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?r(Object(n),!0).forEach(function(r){e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t},exports.toPrimitive=t,exports.toPropertyKey=o;
|
|
2
|
-
//# sourceMappingURL=_rollupPluginBabelHelpers.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e,r,t){return(r=o(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function r(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?r(Object(o),!0).forEach(function(r){e(t,r,o[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function n(e,r){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,r);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function o(e){var r=n(e,"string");return"symbol"==typeof r?r:r+""}export{e as defineProperty,t as objectSpread2,n as toPrimitive,o as toPropertyKey};
|
|
2
|
-
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|