{"version":3,"sources":["../src/index.ts","../src/DiffEditor/index.ts","../src/DiffEditor/DiffEditor.tsx","../src/MonacoContainer/index.ts","../src/MonacoContainer/MonacoContainer.tsx","../src/MonacoContainer/styles.ts","../src/Loading/Loading.tsx","../src/Loading/styles.ts","../src/Loading/index.ts","../src/hooks/useMount/index.ts","../src/hooks/useUpdate/index.ts","../src/utils/index.ts","../src/hooks/useMonaco/index.ts","../src/Editor/index.ts","../src/Editor/Editor.tsx","../src/hooks/usePrevious/index.ts"],"sourcesContent":["import loader from '@monaco-editor/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/esm/vs/editor/editor.api';\nexport type Monaco = typeof monaco;\n\n// Default themes\nexport type Theme = 'vs-dark' | 'light';\n","import { memo } from 'react';\n\nimport DiffEditor from './DiffEditor';\n\nexport * from './types';\n\nexport default memo(DiffEditor);\n","'use client';\n\nimport React, { useState, useRef, useCallback, useEffect } from 'react';\nimport loader from '@monaco-editor/loader';\n\nimport MonacoContainer from '../MonacoContainer';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport { noop, getOrCreateModel } from '../utils';\nimport { type DiffEditorProps, type MonacoDiffEditor } from './types';\nimport { type Monaco } from '..';\n\nfunction DiffEditor({\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) {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const [isMonacoMounting, setIsMonacoMounting] = useState(true);\n const editorRef = useRef(null);\n const monacoRef = useRef(null);\n const containerRef = useRef(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const preventCreation = useRef(false);\n\n useMount(() => {\n const cancelable = loader.init();\n\n cancelable\n .then((monaco) => (monacoRef.current = monaco) && setIsMonacoMounting(false))\n .catch(\n (error) =>\n error?.type !== 'cancelation' && console.error('Monaco initialization: error:', error),\n );\n\n return () => (editorRef.current ? disposeEditor() : cancelable.cancel());\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 if (!monacoRef.current) return;\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 }, [\n language,\n modified,\n modifiedLanguage,\n original,\n originalLanguage,\n originalModelPath,\n modifiedModelPath,\n ]);\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 !isMonacoMounting && !isEditorReady && createEditor();\n }, [isMonacoMounting, isEditorReady, createEditor]);\n\n function disposeEditor() {\n const models = editorRef.current?.getModel();\n\n if (!keepCurrentOriginalModel) {\n models?.original?.dispose();\n }\n\n if (!keepCurrentModifiedModel) {\n models?.modified?.dispose();\n }\n\n editorRef.current?.dispose();\n }\n\n return (\n \n );\n}\n\nexport default DiffEditor;\n","import { memo } from 'react';\n\nimport MonacoContainer from './MonacoContainer';\n\nexport default memo(MonacoContainer);\n","import React 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) {\n return (\n
\n {!isEditorReady && {loading}}\n \n
\n );\n}\n\nexport default MonacoContainer;\n","import { type CSSProperties } from 'react';\n\nconst styles: Record = {\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","import React, { type PropsWithChildren } from 'react';\n\nimport styles from './styles';\n\nfunction Loading({ children }: PropsWithChildren) {\n return
{children}
;\n}\n\nexport default Loading;\n","import { type CSSProperties } from 'react';\n\nconst styles: Record = {\n container: {\n display: 'flex',\n height: '100%',\n width: '100%',\n justifyContent: 'center',\n alignItems: 'center',\n },\n};\n\nexport default styles;\n","import Loading from './Loading';\n\nexport default Loading;\n","import { useEffect, type EffectCallback } from 'react';\n\nfunction useMount(effect: EffectCallback) {\n useEffect(effect, []);\n}\n\nexport default useMount;\n","import { useEffect, useRef, type DependencyList, type EffectCallback } from 'react';\n\nfunction useUpdate(effect: EffectCallback, deps: DependencyList, applyChanges = true) {\n const isInitialMount = useRef(true);\n\n useEffect(\n isInitialMount.current || !applyChanges\n ? () => {\n isInitialMount.current = false;\n }\n : effect,\n deps,\n );\n}\n\nexport default useUpdate;\n","import { type Monaco } from '..';\n\n/**\n * noop is a helper function that does nothing\n * @returns undefined\n */\nfunction noop() {\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) {\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) {\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) {\n return monaco.editor.createModel(\n value,\n language,\n path ? createModelUri(monaco, path) : undefined,\n );\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) {\n return monaco.Uri.parse(path);\n}\n\nexport { noop, getOrCreateModel };\n","import { useState } from 'react';\nimport loader from '@monaco-editor/loader';\n\nimport useMount from '../useMount';\n\nfunction useMonaco() {\n const [monaco, setMonaco] = useState(loader.__getMonacoInstance());\n\n useMount(() => {\n let cancelable: ReturnType;\n\n if (!monaco) {\n cancelable = loader.init();\n\n cancelable.then((monaco) => {\n setMonaco(monaco);\n });\n }\n\n return () => cancelable?.cancel();\n });\n\n return monaco;\n}\n\nexport default useMonaco;\n","import { memo } from 'react';\n\nimport Editor from './Editor';\n\nexport * from './types';\n\nexport default memo(Editor);\n","'use client';\n\nimport React, { useState, useEffect, useRef, useCallback } from 'react';\nimport loader from '@monaco-editor/loader';\nimport useMount from '../hooks/useMount';\nimport useUpdate from '../hooks/useUpdate';\nimport usePrevious from '../hooks/usePrevious';\nimport { type IDisposable, type 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({\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) {\n const [isEditorReady, setIsEditorReady] = useState(false);\n const [isMonacoMounting, setIsMonacoMounting] = useState(true);\n const monacoRef = useRef(null);\n const editorRef = useRef(null);\n const containerRef = useRef(null);\n const onMountRef = useRef(onMount);\n const beforeMountRef = useRef(beforeMount);\n const subscriptionRef = useRef();\n const valueRef = useRef(value);\n const previousPath = usePrevious(path);\n const preventCreation = useRef(false);\n const preventTriggerChangeEvent = useRef(false);\n\n useMount(() => {\n const cancelable = loader.init();\n\n cancelable\n .then((monaco) => (monacoRef.current = monaco) && setIsMonacoMounting(false))\n .catch(\n (error) =>\n error?.type !== 'cancelation' && console.error('Monaco initialization: error:', error),\n );\n\n return () => (editorRef.current ? disposeEditor() : cancelable.cancel());\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 (model && language) monacoRef.current?.editor.setModelLanguage(model, language);\n },\n [language],\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 || !monacoRef.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 editorRef.current = monacoRef.current?.editor.create(\n containerRef.current,\n {\n model: defaultModel,\n automaticLayout: true,\n ...options,\n },\n overrideServices,\n );\n\n saveViewState && editorRef.current.restoreViewState(viewStates.get(autoCreatedModelPath));\n\n monacoRef.current.editor.setTheme(theme);\n\n if (line !== undefined) {\n editorRef.current.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 !isMonacoMounting && !isEditorReady && createEditor();\n }, [isMonacoMounting, 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) => {\n const editorUri = editorRef.current!.getModel()?.uri;\n\n if (editorUri) {\n const currentEditorHasMarkerChanges = uris.find((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() {\n subscriptionRef.current?.dispose();\n\n if (keepCurrentModel) {\n saveViewState && viewStates.set(path, editorRef.current!.saveViewState());\n } else {\n editorRef.current!.getModel()?.dispose();\n }\n\n editorRef.current!.dispose();\n }\n\n return (\n \n );\n}\n\nexport default Editor;\n","import { useEffect, useRef } from 'react';\n\nfunction usePrevious(value: T) {\n const ref = useRef();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\nexport default usePrevious;\n"],"mappings":"AAAA,OAAOA,OAAY,wBCAnB,OAAS,QAAAC,OAAY,QCErB,OAAOC,IAAS,YAAAC,GAAU,UAAAC,EAAQ,eAAAC,GAAa,aAAAC,OAAiB,QAChE,OAAOC,OAAY,wBCHnB,OAAS,QAAAC,OAAY,QCArB,OAAOC,MAAW,QCElB,IAAMC,GAAwC,CAC5C,QAAS,CACP,QAAS,OACT,SAAU,WACV,UAAW,SACb,EACA,UAAW,CACT,MAAO,MACT,EACA,KAAM,CACJ,QAAS,MACX,CACF,EAEOC,EAAQD,GChBf,OAAOE,OAAuC,QCE9C,IAAMC,GAAwC,CAC5C,UAAW,CACT,QAAS,OACT,OAAQ,OACR,MAAO,OACP,eAAgB,SAChB,WAAY,QACd,CACF,EAEOC,EAAQD,GDRf,SAASE,GAAQ,CAAE,SAAAC,CAAS,EAAsB,CAChD,OAAOC,GAAA,cAAC,OAAI,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AQ9D,GDxQf,IAAO+D,GAAQC,GAAKD,EAAM,EbO1B,IAAOE,GAAQC","names":["loader","memo","React","useState","useRef","useCallback","useEffect","loader","memo","React","styles","styles_default","React","styles","styles_default","Loading","children","React","styles_default","Loading_default","Loading_default","MonacoContainer","width","height","isEditorReady","loading","_ref","className","wrapperProps","React","styles_default","Loading_default","MonacoContainer_default","MonacoContainer_default","memo","useEffect","useMount","effect","useMount_default","useEffect","useRef","useUpdate","effect","deps","applyChanges","isInitialMount","useUpdate_default","noop","getOrCreateModel","monaco","value","language","path","getModel","createModel","createModelUri","DiffEditor","original","modified","language","originalLanguage","modifiedLanguage","originalModelPath","modifiedModelPath","keepCurrentOriginalModel","keepCurrentModifiedModel","theme","loading","options","height","width","className","wrapperProps","beforeMount","noop","onMount","isEditorReady","setIsEditorReady","useState","isMonacoMounting","setIsMonacoMounting","editorRef","useRef","monacoRef","containerRef","onMountRef","beforeMountRef","preventCreation","useMount_default","cancelable","loader","monaco","error","disposeEditor","useUpdate_default","originalEditor","model","getOrCreateModel","modifiedEditor","setModels","useCallback","originalModel","modifiedModel","createEditor","useEffect","models","React","MonacoContainer_default","DiffEditor_default","DiffEditor_default","memo","useState","loader","useMonaco","monaco","setMonaco","useState","loader","useMount_default","cancelable","useMonaco_default","memo","React","useState","useEffect","useRef","useCallback","loader","useEffect","useRef","usePrevious","value","ref","usePrevious_default","viewStates","Editor","defaultValue","defaultLanguage","defaultPath","value","language","path","theme","line","loading","options","overrideServices","saveViewState","keepCurrentModel","width","height","className","wrapperProps","beforeMount","noop","onMount","onChange","onValidate","isEditorReady","setIsEditorReady","useState","isMonacoMounting","setIsMonacoMounting","monacoRef","useRef","editorRef","containerRef","onMountRef","beforeMountRef","subscriptionRef","valueRef","previousPath","usePrevious_default","preventCreation","preventTriggerChangeEvent","useMount_default","cancelable","loader","monaco","error","disposeEditor","useUpdate_default","model","getOrCreateModel","createEditor","useCallback","autoCreatedModelPath","defaultModel","useEffect","event","changeMarkersListener","uris","editorUri","uri","markers","React","MonacoContainer_default","Editor_default","Editor_default","memo","src_default","Editor_default"]}