vanilla-jsoneditor
Advanced tools
Comparing version 0.23.8 to 1.0.0
493
index.d.ts
import { SvelteComponent } from 'svelte'; | ||
import { JSONPath, JSONPatchDocument, JSONPointer } from 'immutable-json-patch'; | ||
import { JSONPath, JSONPatchDocument } from 'immutable-json-patch'; | ||
import { IconDefinition } from '@fortawesome/free-solid-svg-icons'; | ||
@@ -57,9 +57,68 @@ import { Action } from 'svelte/action'; | ||
} | ||
interface DocumentState { | ||
expandedMap: JSONPointerMap<boolean>; | ||
enforceStringMap: JSONPointerMap<boolean>; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]>; | ||
selection: JSONSelection | null; | ||
sortedColumn: SortedColumn | null; | ||
interface ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, RecursiveState | undefined>; | ||
} | ||
interface ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<RecursiveState | undefined>; | ||
} | ||
interface ValueRecursiveState { | ||
type: 'value'; | ||
} | ||
type RecursiveState = ObjectRecursiveState | ArrayRecursiveState | ValueRecursiveState; | ||
interface RecursiveStateFactory { | ||
createObjectDocumentState: () => ObjectRecursiveState; | ||
createArrayDocumentState: () => ArrayRecursiveState; | ||
createValueDocumentState: () => ValueRecursiveState; | ||
} | ||
interface ObjectDocumentState extends ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, DocumentState | undefined>; | ||
expanded: boolean; | ||
} | ||
interface ArrayDocumentState extends ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<DocumentState | undefined>; | ||
expanded: boolean; | ||
visibleSections: VisibleSection[]; | ||
} | ||
interface ValueDocumentState extends ValueRecursiveState { | ||
type: 'value'; | ||
enforceString?: boolean; | ||
} | ||
type DocumentState = ObjectDocumentState | ArrayDocumentState | ValueDocumentState; | ||
interface ObjectSearchResults extends ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, SearchResults | undefined>; | ||
searchResults?: ExtendedSearchResultItem[]; | ||
} | ||
interface ArraySearchResults extends ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<SearchResults | undefined>; | ||
searchResults?: ExtendedSearchResultItem[]; | ||
} | ||
interface ValueSearchResults extends ValueRecursiveState { | ||
type: 'value'; | ||
searchResults?: ExtendedSearchResultItem[]; | ||
} | ||
type SearchResults = ObjectSearchResults | ArraySearchResults | ValueSearchResults; | ||
type WithSearchResults = SearchResults & { | ||
searchResults: ExtendedSearchResultItem[]; | ||
}; | ||
interface ObjectValidationErrors extends ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, ValidationErrors | undefined>; | ||
validationError?: NestedValidationError; | ||
} | ||
interface ArrayValidationErrors extends ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<ValidationErrors | undefined>; | ||
validationError?: NestedValidationError; | ||
} | ||
interface ValueValidationErrors extends ValueRecursiveState { | ||
type: 'value'; | ||
validationError?: NestedValidationError; | ||
} | ||
type ValidationErrors = ObjectValidationErrors | ArrayValidationErrors | ValueValidationErrors; | ||
interface JSONPatchResult { | ||
@@ -71,5 +130,7 @@ json: unknown; | ||
} | ||
type AfterPatchCallback = (patchedJson: unknown, patchedState: DocumentState) => { | ||
type AfterPatchCallback = (patchedJson: unknown, patchedState: DocumentState | undefined, patchedSelection: JSONSelection | undefined) => { | ||
json?: unknown; | ||
state?: DocumentState; | ||
state?: DocumentState | undefined; | ||
selection?: JSONSelection | undefined; | ||
sortedColumn?: SortedColumn | undefined; | ||
} | undefined; | ||
@@ -92,10 +153,20 @@ interface MultiSelection { | ||
path: JSONPath; | ||
edit?: boolean; | ||
} | ||
interface ValueSelection { | ||
interface EditKeySelection extends KeySelection { | ||
type: SelectionType.key; | ||
path: JSONPath; | ||
edit: true; | ||
initialValue?: string; | ||
} | ||
type ValueSelection = { | ||
type: SelectionType.value; | ||
path: JSONPath; | ||
edit?: boolean; | ||
}; | ||
interface EditValueSelection extends ValueSelection { | ||
type: SelectionType.value; | ||
path: JSONPath; | ||
edit: true; | ||
initialValue?: string; | ||
} | ||
type JSONSelection = MultiSelection | AfterSelection | InsideSelection | KeySelection | ValueSelection; | ||
type JSONSelection = MultiSelection | AfterSelection | InsideSelection | KeySelection | EditKeySelection | ValueSelection | EditValueSelection; | ||
interface TextSelection { | ||
@@ -110,3 +181,2 @@ type: SelectionType.text; | ||
type JSONEditorSelection = JSONSelection | TextSelection; | ||
type JSONPointerMap<T> = Record<JSONPointer, T>; | ||
type ClipboardValues = Array<{ | ||
@@ -174,5 +244,5 @@ key: string; | ||
interface ParseError { | ||
position: number | null; | ||
line: number | null; | ||
column: number | null; | ||
position: number | undefined; | ||
line: number | undefined; | ||
column: number | undefined; | ||
message: string; | ||
@@ -189,10 +259,10 @@ } | ||
interface RichValidationError extends ValidationError { | ||
line: number | null; | ||
column: number | null; | ||
from: number | null; | ||
to: number | null; | ||
line: number | undefined; | ||
column: number | undefined; | ||
from: number | undefined; | ||
to: number | undefined; | ||
actions: Array<{ | ||
name: string; | ||
apply: () => void; | ||
}> | null; | ||
}> | undefined; | ||
} | ||
@@ -233,8 +303,8 @@ interface TextLocation { | ||
interface OnChangeStatus { | ||
contentErrors: ContentErrors | null; | ||
patchResult: JSONPatchResult | null; | ||
contentErrors: ContentErrors | undefined; | ||
patchResult: JSONPatchResult | undefined; | ||
} | ||
type OnChange = ((content: Content, previousContent: Content, status: OnChangeStatus) => void) | null; | ||
type OnChange = ((content: Content, previousContent: Content, status: OnChangeStatus) => void) | undefined; | ||
type OnJSONSelect = (selection: JSONSelection) => void; | ||
type OnSelect = (selection: JSONEditorSelection | null) => void; | ||
type OnSelect = (selection: JSONEditorSelection | undefined) => void; | ||
type OnPatch = (operations: JSONPatchDocument, afterPatch?: AfterPatchCallback) => JSONPatchResult; | ||
@@ -250,7 +320,4 @@ type OnChangeText = (updatedText: string, afterPatch?: AfterPatchCallback) => void; | ||
type OnPaste = (pastedText: string) => void; | ||
type OnPasteJson = (pastedJson: { | ||
path: JSONPath; | ||
contents: unknown; | ||
}) => void; | ||
type OnExpand = (path: JSONPath) => boolean; | ||
type OnPasteJson = (pastedJson: PastedJson) => void; | ||
type OnExpand = (relativePath: JSONPath) => boolean; | ||
type OnRenderValue = (props: RenderValueProps) => RenderValueComponentDescription[]; | ||
@@ -266,8 +333,8 @@ type OnClassName = (path: JSONPath, value: unknown) => string | undefined; | ||
type OnRenderMenu = (items: MenuItem[], context: RenderMenuContext) => MenuItem[] | undefined; | ||
type OnRenderMenuInternal = (items: MenuItem[]) => MenuItem[]; | ||
type OnRenderMenuInternal = (items: MenuItem[]) => MenuItem[] | undefined; | ||
type RenderContextMenuContext = RenderMenuContext & { | ||
selection: JSONEditorSelection | null; | ||
selection: JSONEditorSelection | undefined; | ||
}; | ||
type OnRenderContextMenu = (items: ContextMenuItem[], context: RenderContextMenuContext) => ContextMenuItem[] | false | undefined; | ||
type OnRenderContextMenuInternal = (items: ContextMenuItem[]) => ContextMenuItem[] | false; | ||
type OnRenderContextMenuInternal = (items: ContextMenuItem[]) => ContextMenuItem[] | false | undefined; | ||
type OnError = (error: Error) => void; | ||
@@ -279,6 +346,5 @@ type OnFocus = () => void; | ||
type OnJSONEditorModal = (props: JSONEditorModalCallback) => void; | ||
type FindNextInside = (path: JSONPath) => JSONSelection | null; | ||
interface SearchResult { | ||
type FindNextInside = (path: JSONPath) => JSONSelection | undefined; | ||
interface SearchResultDetails { | ||
items: ExtendedSearchResultItem[]; | ||
itemsMap: JSONPointerMap<ExtendedSearchResultItem[]>; | ||
activeItem: ExtendedSearchResultItem | undefined; | ||
@@ -312,5 +378,6 @@ activeIndex: number | -1; | ||
type PastedJson = { | ||
path: JSONPath; | ||
contents: unknown; | ||
path: JSONPath; | ||
} | undefined; | ||
onPasteAsJson: () => void; | ||
}; | ||
interface DragInsideProps { | ||
@@ -341,3 +408,5 @@ json: unknown; | ||
text: string | undefined; | ||
state: DocumentState; | ||
documentState: DocumentState | undefined; | ||
selection: JSONSelection | undefined; | ||
sortedColumn: SortedColumn | undefined; | ||
textIsRepaired: boolean; | ||
@@ -349,3 +418,5 @@ }; | ||
text: string | undefined; | ||
state: DocumentState; | ||
documentState: DocumentState | undefined; | ||
selection: JSONSelection | undefined; | ||
sortedColumn: SortedColumn | undefined; | ||
textIsRepaired: boolean; | ||
@@ -393,3 +464,3 @@ }; | ||
parser?: JSONParser; | ||
validator?: Validator | null; | ||
validator?: Validator | undefined; | ||
validationParser?: JSONParser; | ||
@@ -411,3 +482,30 @@ pathParser?: JSONPathParser; | ||
} | ||
interface JSONEditorModalProps { | ||
content: Content; | ||
path: JSONPath; | ||
onPatch: OnPatch; | ||
readOnly: boolean; | ||
indentation: number | string; | ||
tabSize: number; | ||
mainMenuBar: boolean; | ||
navigationBar: boolean; | ||
statusBar: boolean; | ||
askToFormat: boolean; | ||
escapeControlCharacters: boolean; | ||
escapeUnicodeCharacters: boolean; | ||
flattenColumns: boolean; | ||
parser: JSONParser; | ||
validator: Validator | undefined; | ||
validationParser: JSONParser; | ||
pathParser: JSONPathParser; | ||
onRenderValue: OnRenderValue; | ||
onClassName: OnClassName; | ||
onRenderMenu: OnRenderMenu; | ||
onRenderContextMenu: OnRenderContextMenu; | ||
onSortModal: (props: SortModalCallback) => void; | ||
onTransformModal: (props: TransformModalCallback) => void; | ||
onClose: () => void; | ||
} | ||
interface JSONEditorContext { | ||
mode: Mode; | ||
readOnly: boolean; | ||
@@ -417,4 +515,4 @@ parser: JSONParser; | ||
getJson: () => unknown | undefined; | ||
getDocumentState: () => DocumentState; | ||
findElement: (path: JSONPath) => Element | null; | ||
getDocumentState: () => DocumentState | undefined; | ||
findElement: (path: JSONPath) => Element | undefined; | ||
findNextInside: FindNextInside; | ||
@@ -430,4 +528,5 @@ focus: () => void; | ||
getJson: () => unknown | undefined; | ||
getDocumentState: () => DocumentState; | ||
findElement: (path: JSONPath) => Element | null; | ||
getDocumentState: () => DocumentState | undefined; | ||
getSelection: () => JSONSelection | undefined; | ||
findElement: (path: JSONPath) => Element | undefined; | ||
onInsert: (type: InsertType) => void; | ||
@@ -444,5 +543,6 @@ onExpand: (path: JSONPath, expanded: boolean, recursive?: boolean) => void; | ||
value: unknown; | ||
mode: Mode; | ||
readOnly: boolean; | ||
enforceString: boolean; | ||
selection: JSONSelection | null; | ||
selection: JSONSelection | undefined; | ||
searchResultItems: SearchResultItem[] | undefined; | ||
@@ -460,25 +560,2 @@ isEditing: boolean; | ||
type RenderValuePropsOptional = Partial<RenderValueProps>; | ||
interface JSONNodeProp { | ||
key: string; | ||
value: unknown; | ||
path: JSONPath; | ||
expandedMap: JSONPointerMap<boolean> | undefined; | ||
enforceStringMap: JSONPointerMap<boolean> | undefined; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]> | undefined; | ||
validationErrorsMap: JSONPointerMap<NestedValidationError> | undefined; | ||
keySearchResultItemsMap: ExtendedSearchResultItem[] | undefined; | ||
valueSearchResultItemsMap: JSONPointerMap<ExtendedSearchResultItem[]> | undefined; | ||
selection: JSONSelection | null; | ||
} | ||
interface JSONNodeItem { | ||
index: number; | ||
value: unknown; | ||
path: JSONPath; | ||
expandedMap: JSONPointerMap<boolean> | undefined; | ||
enforceStringMap: JSONPointerMap<boolean> | undefined; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]> | undefined; | ||
validationErrorsMap: JSONPointerMap<NestedValidationError> | undefined; | ||
searchResultItemsMap: JSONPointerMap<ExtendedSearchResultItem[]> | undefined; | ||
selection: JSONSelection | null; | ||
} | ||
interface DraggingState { | ||
@@ -515,4 +592,25 @@ initialTarget: Element; | ||
id: string; | ||
json: unknown; | ||
rootPath: JSONPath; | ||
onTransform: (operations: JSONPatchDocument) => void; | ||
onClose: () => void; | ||
} | ||
interface TransformModalProps extends TransformModalCallback { | ||
id: string; | ||
json: unknown; | ||
rootPath: JSONPath; | ||
indentation: number | string; | ||
escapeControlCharacters: boolean; | ||
escapeUnicodeCharacters: boolean; | ||
parser: JSONParser; | ||
parseMemoizeOne: JSONParser['parse']; | ||
validationParser: JSONParser; | ||
pathParser: JSONPathParser; | ||
queryLanguages: QueryLanguage[]; | ||
queryLanguageId: string; | ||
onChangeQueryLanguage: OnChangeQueryLanguage; | ||
onRenderValue: OnRenderValue; | ||
onRenderMenu: OnRenderMenuInternal; | ||
onRenderContextMenu: OnRenderContextMenuInternal; | ||
onClassName: OnClassName; | ||
onTransform: (operations: JSONPatchDocument) => void; | ||
@@ -528,2 +626,9 @@ onClose: () => void; | ||
} | ||
interface JSONRepairModalProps { | ||
text: string; | ||
onParse: (text: string) => void; | ||
onRepair: (text: string) => string; | ||
onApply: (repairedText: string) => void; | ||
onClose: () => void; | ||
} | ||
interface JSONEditorModalCallback { | ||
@@ -558,47 +663,48 @@ content: Content; | ||
props: { | ||
content?: Content | undefined; | ||
selection?: JSONEditorSelection | null | undefined; | ||
readOnly?: boolean | undefined; | ||
indentation?: string | number | undefined; | ||
tabSize?: number | undefined; | ||
mode?: Mode | undefined; | ||
mainMenuBar?: boolean | undefined; | ||
navigationBar?: boolean | undefined; | ||
statusBar?: boolean | undefined; | ||
askToFormat?: boolean | undefined; | ||
escapeControlCharacters?: boolean | undefined; | ||
escapeUnicodeCharacters?: boolean | undefined; | ||
flattenColumns?: boolean | undefined; | ||
parser?: JSONParser | undefined; | ||
validator?: Validator | null | undefined; | ||
validationParser?: JSONParser | undefined; | ||
pathParser?: JSONPathParser | undefined; | ||
queryLanguages?: QueryLanguage[] | undefined; | ||
queryLanguageId?: string | undefined; | ||
onChangeQueryLanguage?: OnChangeQueryLanguage | undefined; | ||
content?: Content; | ||
selection?: JSONEditorSelection | undefined; | ||
readOnly?: boolean; | ||
indentation?: number | string; | ||
tabSize?: number; | ||
mode?: Mode; | ||
mainMenuBar?: boolean; | ||
navigationBar?: boolean; | ||
statusBar?: boolean; | ||
askToFormat?: boolean; | ||
escapeControlCharacters?: boolean; | ||
escapeUnicodeCharacters?: boolean; | ||
flattenColumns?: boolean; | ||
parser?: JSONParser; | ||
validator?: Validator | undefined; | ||
validationParser?: JSONParser; | ||
pathParser?: JSONPathParser; | ||
queryLanguages?: QueryLanguage[]; | ||
queryLanguageId?: string; | ||
onChangeQueryLanguage?: OnChangeQueryLanguage; | ||
onChange?: OnChange | undefined; | ||
onSelect?: OnSelect | null | undefined; | ||
onRenderValue?: OnRenderValue | undefined; | ||
onClassName?: OnClassName | undefined; | ||
onRenderMenu?: OnRenderMenu | undefined; | ||
onRenderContextMenu?: OnRenderContextMenu | undefined; | ||
onChangeMode?: OnChangeMode | undefined; | ||
onError?: OnError | undefined; | ||
onFocus?: OnFocus | undefined; | ||
onBlur?: OnBlur | undefined; | ||
get?: (() => Content) | undefined; | ||
set?: ((newContent: Content) => Promise<void>) | undefined; | ||
update?: ((updatedContent: Content) => Promise<void>) | undefined; | ||
patch?: ((operations: JSONPatchDocument) => Promise<JSONPatchResult>) | undefined; | ||
select?: ((newSelection: JSONEditorSelection | null) => Promise<void>) | undefined; | ||
expand?: ((callback?: OnExpand) => Promise<void>) | undefined; | ||
transform?: ((options: TransformModalOptions) => void) | undefined; | ||
validate?: (() => ContentErrors | null) | undefined; | ||
acceptAutoRepair?: (() => Promise<Content>) | undefined; | ||
scrollTo?: ((path: JSONPath) => Promise<void>) | undefined; | ||
findElement?: ((path: JSONPath) => Element | null) | undefined; | ||
focus?: (() => Promise<void>) | undefined; | ||
refresh?: (() => Promise<void>) | undefined; | ||
updateProps?: ((props: JSONEditorPropsOptional) => Promise<void>) | undefined; | ||
destroy?: (() => Promise<void>) | undefined; | ||
onSelect?: OnSelect | undefined; | ||
onRenderValue?: OnRenderValue; | ||
onClassName?: OnClassName; | ||
onRenderMenu?: OnRenderMenu; | ||
onRenderContextMenu?: OnRenderContextMenu; | ||
onChangeMode?: OnChangeMode; | ||
onError?: OnError; | ||
onFocus?: OnFocus; | ||
onBlur?: OnBlur; | ||
get?: () => Content; | ||
set?: (newContent: Content) => Promise<void>; | ||
update?: (updatedContent: Content) => Promise<void>; | ||
patch?: (operations: JSONPatchDocument) => Promise<JSONPatchResult>; | ||
select?: (newSelection: JSONEditorSelection | undefined) => Promise<void>; | ||
expand?: (path: JSONPath, callback?: OnExpand) => Promise<void>; | ||
collapse?: (path: JSONPath, recursive?: boolean) => Promise<void>; | ||
transform?: (options: TransformModalOptions) => void; | ||
validate?: () => ContentErrors | undefined; | ||
acceptAutoRepair?: () => Promise<Content>; | ||
scrollTo?: (path: JSONPath) => Promise<void>; | ||
findElement?: (path: JSONPath) => Element | undefined; | ||
focus?: () => Promise<void>; | ||
refresh?: () => Promise<void>; | ||
updateProps?: (props: JSONEditorPropsOptional) => Promise<void>; | ||
destroy?: () => Promise<void>; | ||
}; | ||
@@ -609,2 +715,4 @@ events: { | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -619,9 +727,10 @@ type JsonEditorProps = typeof __propDef$6.props; | ||
get patch(): (operations: JSONPatchDocument) => Promise<JSONPatchResult>; | ||
get select(): (newSelection: JSONEditorSelection | null) => Promise<void>; | ||
get expand(): (callback?: OnExpand | undefined) => Promise<void>; | ||
get select(): (newSelection: JSONEditorSelection | undefined) => Promise<void>; | ||
get expand(): (path: JSONPath, callback?: OnExpand) => Promise<void>; | ||
get collapse(): (path: JSONPath, recursive?: boolean) => Promise<void>; | ||
get transform(): (options: TransformModalOptions) => void; | ||
get validate(): () => ContentErrors | null; | ||
get validate(): () => ContentErrors | undefined; | ||
get acceptAutoRepair(): () => Promise<Content>; | ||
get scrollTo(): (path: JSONPath) => Promise<void>; | ||
get findElement(): (path: JSONPath) => Element | null; | ||
get findElement(): (path: JSONPath) => Element | undefined; | ||
get focus(): () => Promise<void>; | ||
@@ -645,2 +754,4 @@ get refresh(): () => Promise<void>; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -665,2 +776,4 @@ type BooleanToggleProps = typeof __propDef$5.props; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -677,2 +790,4 @@ type ColorPickerProps = typeof __propDef$4.props; | ||
value: unknown; | ||
selection: JSONSelection | undefined; | ||
mode: Mode; | ||
parser: JSONParser; | ||
@@ -692,2 +807,4 @@ normalization: ValueNormalization; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -704,5 +821,6 @@ type EditableValueProps = typeof __propDef$3.props; | ||
value: unknown; | ||
mode: Mode; | ||
parser: JSONParser; | ||
readOnly: boolean; | ||
selection: JSONSelection | null; | ||
selection: JSONSelection | undefined; | ||
onPatch: OnPatch; | ||
@@ -718,2 +836,4 @@ options: Array<{ | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -730,2 +850,3 @@ type EnumValueProps = typeof __propDef$2.props; | ||
value: unknown; | ||
mode: Mode; | ||
readOnly: boolean; | ||
@@ -741,2 +862,4 @@ normalization: ValueNormalization; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -757,2 +880,4 @@ type ReadonlyValueProps = typeof __propDef$1.props; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -765,3 +890,3 @@ type TimestampTagProps = typeof __propDef.props; | ||
declare function renderValue({ path, value, readOnly, enforceString, searchResultItems, isEditing, parser, normalization, onPatch, onPasteJson, onSelect, onFind, findNextInside, focus }: RenderValueProps): RenderValueComponentDescription[]; | ||
declare function renderValue({ path, value, mode, readOnly, selection, enforceString, searchResultItems, isEditing, parser, normalization, onPatch, onPasteJson, onSelect, onFind, findNextInside, focus }: RenderValueProps): RenderValueComponentDescription[]; | ||
@@ -773,4 +898,32 @@ /** | ||
*/ | ||
declare function renderJSONSchemaEnum(props: RenderValueProps, schema: JSONSchema, schemaDefinitions?: JSONSchemaDefinitions): RenderValueComponentDescription[] | null; | ||
declare function renderJSONSchemaEnum(props: RenderValueProps, schema: JSONSchema, schemaDefinitions?: JSONSchemaDefinitions): RenderValueComponentDescription[] | undefined; | ||
declare function getValueClass(value: unknown, mode: Mode, parser: JSONParser): string; | ||
declare global { | ||
interface Navigator { | ||
userAgentData?: { | ||
platform: string; | ||
}; | ||
} | ||
} | ||
declare function isMac(): boolean; | ||
interface KeyComboEvent { | ||
ctrlKey: boolean; | ||
metaKey: boolean; | ||
altKey: boolean; | ||
shiftKey: boolean; | ||
key: string; | ||
} | ||
/** | ||
* Get the active key combination from a keyboard event. | ||
* For example returns "Ctrl+Shift+ArrowUp" or "Ctrl+A" | ||
* | ||
* Returns the same output on both Windows and Mac: | ||
* meta keys "Ctrl" ("Command" on Mac), and "Alt" ("Alt" or "Option" on Mac) | ||
* So pressing "Command" and "A"on Mac will return "Ctrl+A" | ||
*/ | ||
declare function keyComboFromEvent(event: KeyComboEvent, separator?: string, isMac?: typeof isMac): string; | ||
interface AjvValidatorOptions { | ||
@@ -800,2 +953,8 @@ schema: JSONSchema; | ||
declare const jsonQueryLanguage: QueryLanguage; | ||
declare const jmespathQueryLanguage: QueryLanguage; | ||
declare const jsonpathQueryLanguage: QueryLanguage; | ||
declare const lodashQueryLanguage: QueryLanguage; | ||
@@ -805,4 +964,2 @@ | ||
declare const jmespathQueryLanguage: QueryLanguage; | ||
/** | ||
@@ -851,13 +1008,35 @@ * Check whether a value is Content (TextContent or JSONContent) | ||
declare function isAfterSelection(selection: JSONEditorSelection | null): selection is AfterSelection; | ||
declare function isInsideSelection(selection: JSONEditorSelection | null): selection is InsideSelection; | ||
declare function isKeySelection(selection: JSONEditorSelection | null): selection is KeySelection; | ||
declare function isValueSelection(selection: JSONEditorSelection | null): selection is ValueSelection; | ||
declare function isMultiSelection(selection: JSONEditorSelection | null): selection is MultiSelection; | ||
declare function createKeySelection(path: JSONPath, edit: boolean): KeySelection; | ||
declare function createValueSelection(path: JSONPath, edit: boolean): ValueSelection; | ||
/** | ||
* Expand the root array or object, and in case of an array, expand the first array item | ||
*/ | ||
declare function expandMinimal(relativePath: JSONPath): boolean; | ||
/** | ||
* Expand the root array or object | ||
*/ | ||
declare function expandSelf(relativePath: JSONPath): boolean; | ||
declare function expandAll(): boolean; | ||
declare function expandNone(): boolean; | ||
declare function isAfterSelection(selection: JSONEditorSelection | undefined): selection is AfterSelection; | ||
declare function isInsideSelection(selection: JSONEditorSelection | undefined): selection is InsideSelection; | ||
declare function isKeySelection(selection: JSONEditorSelection | undefined): selection is KeySelection; | ||
declare function isValueSelection(selection: JSONEditorSelection | undefined): selection is ValueSelection; | ||
declare function isMultiSelection(selection: JSONEditorSelection | undefined): selection is MultiSelection; | ||
/** | ||
* Expand a selection start and end into an array containing all paths | ||
* between (and including) start and end | ||
*/ | ||
declare function getSelectionPaths(json: unknown, selection: JSONSelection): JSONPath[]; | ||
declare function getStartPath(json: unknown, selection: JSONSelection): JSONPath; | ||
declare function getEndPath(json: unknown, selection: JSONSelection): JSONPath; | ||
declare function createKeySelection(path: JSONPath): KeySelection; | ||
declare function createEditKeySelection(path: JSONPath, initialValue?: string): EditKeySelection; | ||
declare function createValueSelection(path: JSONPath): ValueSelection; | ||
declare function createEditValueSelection(path: JSONPath, initialValue?: string): EditValueSelection; | ||
declare function createInsideSelection(path: JSONPath): InsideSelection; | ||
declare function createAfterSelection(path: JSONPath): AfterSelection; | ||
declare function createMultiSelection(anchorPath: JSONPath, focusPath: JSONPath): MultiSelection; | ||
declare function isEditingSelection(selection: JSONSelection | null): boolean; | ||
declare function isEditingSelection(selection: JSONSelection | undefined): selection is EditKeySelection | EditValueSelection; | ||
declare function getFocusPath(selection: JSONSelection): JSONPath; | ||
declare function getAnchorPath(selection: JSONSelection): JSONPath; | ||
@@ -893,11 +1072,42 @@ /** | ||
/** | ||
* The provided callback is invoked when the user presses Escape, | ||
* but only the callback of the last registered component is invoked. | ||
* The provided callback is invoked when the user presses Escape, and then stops propagation of the event. | ||
*/ | ||
declare function onEscape(element: HTMLElement | undefined, callback: Callback): { | ||
destroy(): void; | ||
} | undefined; | ||
/** | ||
* Test whether a value is an Object (and not an Array or Class) | ||
*/ | ||
declare function isObject(value: unknown): value is Record<string, unknown>; | ||
/** | ||
* Test whether a value is an Object or an Array (and not a Class) | ||
*/ | ||
declare function isObjectOrArray(value: unknown): value is Object | Array<unknown>; | ||
/** | ||
* Test whether a value is a boolean | ||
* | ||
* This is useful for example when opening a model on top of another modal: | ||
* you only want the top modal to close on Escape, and not the second modal. | ||
* @param {*} value | ||
* @return {boolean} | ||
*/ | ||
declare function onEscape(element: Element | null, callback: Callback): { | ||
destroy: () => void; | ||
}; | ||
declare function isBoolean(value: unknown): value is boolean; | ||
/** | ||
* Test whether a value is a timestamp in milliseconds after the year 2000. | ||
*/ | ||
declare function isTimestamp(value: unknown): boolean; | ||
/** | ||
* Test if a string contains a valid color name or code. | ||
* Returns true if a valid color, false otherwise | ||
*/ | ||
declare function isColor(value: unknown): boolean; | ||
/** | ||
* Get the type of the value | ||
*/ | ||
declare function valueType(value: unknown, parser: JSONParser): string; | ||
declare function isUrl(text: unknown): boolean; | ||
/** | ||
* Convert contents of a string to the correct JSON type. This can be a string, | ||
* a number, a boolean, etc | ||
*/ | ||
declare function stringConvert(str: string, parser: JSONParser): unknown; | ||
@@ -917,3 +1127,8 @@ declare function isMenuSpace(item: unknown): item is MenuSpace; | ||
declare function isSvelteActionRenderer(value: unknown): value is SvelteActionRenderer; | ||
declare function isObjectRecursiveState(state: RecursiveState | undefined): state is ObjectRecursiveState; | ||
declare function isArrayRecursiveState(state: RecursiveState | undefined): state is ArrayRecursiveState; | ||
declare function isValueRecursiveState(state: RecursiveState | undefined): state is ValueRecursiveState; | ||
declare function isExpandableState(state: RecursiveState | undefined): state is ObjectRecursiveState | ArrayRecursiveState; | ||
declare function hasSearchResults(state: SearchResults | undefined): state is WithSearchResults; | ||
export { type AbsolutePopupContext, type AbsolutePopupOptions, type AfterPatchCallback, type AfterSelection, type AjvValidatorOptions, BooleanToggle, type CaretPosition, CaretType, type ClipboardValues, ColorPicker, type Content, type ContentErrors, type ContentParseError, type ContentValidationErrors, type ContextMenuColumn, type ContextMenuItem, type ContextMenuRow, type ConvertType, type DocumentState, type DragInsideAction, type DragInsideProps, type DraggingState, EditableValue, EnumValue, type EscapeValue, type ExtendedSearchResultItem, type FindNextInside, type HistoryItem, type InsertType, type InsideSelection, type JSONContent, JsonEditor as JSONEditor, type JSONEditorContext, type JSONEditorModalCallback, type JSONEditorPropsOptional, type JSONEditorSelection, type JSONNodeItem, type JSONNodeProp, type JSONParser, type JSONPatchResult, type JSONPathParser, type JSONPointerMap, type JSONSchema, type JSONSchemaDefinitions, type JSONSchemaEnum, type JSONSelection, type KeySelection, type MenuButton, type MenuDropDownButton, type MenuItem, type MenuLabel, type MenuSeparator, type MenuSpace, type MessageAction, Mode, type MultiSelection, type NestedValidationError, type NumberOption, type OnBlur, type OnChange, type OnChangeMode, type OnChangeQueryLanguage, type OnChangeStatus, type OnChangeText, type OnClassName, type OnContextMenu, type OnError, type OnExpand, type OnFind, type OnFocus, type OnJSONEditorModal, type OnJSONSelect, type OnPaste, type OnPasteJson, type OnPatch, type OnRenderContextMenu, type OnRenderContextMenuInternal, type OnRenderMenu, type OnRenderMenuInternal, type OnRenderValue, type OnSelect, type OnSort, type OnSortModal, type OnTransformModal, type ParseError, type PastedJson, type PathOption, type PopupEntry, type QueryLanguage, type QueryLanguageOptions, ReadonlyValue, type RenderContextMenuContext, type RenderMenuContext, type RenderValueComponentDescription, type RenderValueProps, type RenderValuePropsOptional, type RenderedItem, type RichValidationError, SearchField, type SearchOptions, type SearchResult, type SearchResultItem, type Section, SelectionType, SortDirection, type SortModalCallback, type SortedColumn, type SvelteActionRenderer, type SvelteComponentRenderer, type TableCellIndex, type TextContent, type TextLocation, type TextSelection, TimestampTag, type TransformModalCallback, type TransformModalOptions, type TreeModeContext, type UnescapeValue, UpdateSelectionAfterChange, type ValidationError, ValidationSeverity, type Validator, type ValueNormalization, type ValueSelection, type VisibleSection, createAfterSelection, createAjvValidator, createInsideSelection, createKeySelection, createMultiSelection, createValueSelection, estimateSerializedSize, isAfterSelection, isContent, isContentParseError, isContentValidationErrors, isContextMenuColumn, isContextMenuRow, isEditingSelection, isEqualParser, isInsideSelection, isJSONContent, isKeySelection, isLargeContent, isMenuButton, isMenuDropDownButton, isMenuLabel, isMenuSeparator, isMenuSpace, isMultiSelection, isNestedValidationError, isSvelteActionRenderer, isSvelteComponentRenderer, isTextContent, isValidationError, isValueSelection, javascriptQueryLanguage, jmespathQueryLanguage, lodashQueryLanguage, onEscape, parseJSONPath, renderJSONSchemaEnum, renderValue, resizeObserver, stringifyJSONPath, toJSONContent, toTextContent }; | ||
export { type AbsolutePopupContext, type AbsolutePopupOptions, type AfterPatchCallback, type AfterSelection, type AjvValidatorOptions, type ArrayDocumentState, type ArrayRecursiveState, type ArraySearchResults, type ArrayValidationErrors, BooleanToggle, type CaretPosition, CaretType, type ClipboardValues, ColorPicker, type Content, type ContentErrors, type ContentParseError, type ContentValidationErrors, type ContextMenuColumn, type ContextMenuItem, type ContextMenuRow, type ConvertType, type DocumentState, type DragInsideAction, type DragInsideProps, type DraggingState, type EditKeySelection, type EditValueSelection, EditableValue, EnumValue, type EscapeValue, type ExtendedSearchResultItem, type FindNextInside, type HistoryItem, type InsertType, type InsideSelection, type JSONContent, JsonEditor as JSONEditor, type JSONEditorContext, type JSONEditorModalCallback, type JSONEditorModalProps, type JSONEditorPropsOptional, type JSONEditorSelection, type JSONParser, type JSONPatchResult, type JSONPathParser, type JSONRepairModalProps, type JSONSchema, type JSONSchemaDefinitions, type JSONSchemaEnum, type JSONSelection, type KeySelection, type MenuButton, type MenuDropDownButton, type MenuItem, type MenuLabel, type MenuSeparator, type MenuSpace, type MessageAction, Mode, type MultiSelection, type NestedValidationError, type NumberOption, type ObjectDocumentState, type ObjectRecursiveState, type ObjectSearchResults, type ObjectValidationErrors, type OnBlur, type OnChange, type OnChangeMode, type OnChangeQueryLanguage, type OnChangeStatus, type OnChangeText, type OnClassName, type OnContextMenu, type OnError, type OnExpand, type OnFind, type OnFocus, type OnJSONEditorModal, type OnJSONSelect, type OnPaste, type OnPasteJson, type OnPatch, type OnRenderContextMenu, type OnRenderContextMenuInternal, type OnRenderMenu, type OnRenderMenuInternal, type OnRenderValue, type OnSelect, type OnSort, type OnSortModal, type OnTransformModal, type ParseError, type PastedJson, type PathOption, type PopupEntry, type QueryLanguage, type QueryLanguageOptions, ReadonlyValue, type RecursiveState, type RecursiveStateFactory, type RenderContextMenuContext, type RenderMenuContext, type RenderValueComponentDescription, type RenderValueProps, type RenderValuePropsOptional, type RenderedItem, type RichValidationError, SearchField, type SearchOptions, type SearchResultDetails, type SearchResultItem, type SearchResults, type Section, SelectionType, SortDirection, type SortModalCallback, type SortedColumn, type SvelteActionRenderer, type SvelteComponentRenderer, type TableCellIndex, type TextContent, type TextLocation, type TextSelection, TimestampTag, type TransformModalCallback, type TransformModalOptions, type TransformModalProps, type TreeModeContext, type UnescapeValue, UpdateSelectionAfterChange, type ValidationError, type ValidationErrors, ValidationSeverity, type Validator, type ValueDocumentState, type ValueNormalization, type ValueRecursiveState, type ValueSearchResults, type ValueSelection, type ValueValidationErrors, type VisibleSection, type WithSearchResults, createAfterSelection, createAjvValidator, createEditKeySelection, createEditValueSelection, createInsideSelection, createKeySelection, createMultiSelection, createValueSelection, estimateSerializedSize, expandAll, expandMinimal, expandNone, expandSelf, getAnchorPath, getEndPath, getFocusPath, getSelectionPaths, getStartPath, getValueClass, hasSearchResults, isAfterSelection, isArrayRecursiveState, isBoolean, isColor, isContent, isContentParseError, isContentValidationErrors, isContextMenuColumn, isContextMenuRow, isEditingSelection, isEqualParser, isExpandableState, isInsideSelection, isJSONContent, isKeySelection, isLargeContent, isMenuButton, isMenuDropDownButton, isMenuLabel, isMenuSeparator, isMenuSpace, isMultiSelection, isNestedValidationError, isObject, isObjectOrArray, isObjectRecursiveState, isSvelteActionRenderer, isSvelteComponentRenderer, isTextContent, isTimestamp, isUrl, isValidationError, isValueRecursiveState, isValueSelection, javascriptQueryLanguage, jmespathQueryLanguage, jsonQueryLanguage, jsonpathQueryLanguage, keyComboFromEvent, lodashQueryLanguage, onEscape, parseJSONPath, renderJSONSchemaEnum, renderValue, resizeObserver, stringConvert, stringifyJSONPath, toJSONContent, toTextContent, valueType }; |
{ | ||
"name": "vanilla-jsoneditor", | ||
"description": "A web-based tool to view, edit, format, transform, and validate JSON", | ||
"version": "0.23.8", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/josdejong/svelte-jsoneditor", | ||
@@ -36,15 +36,16 @@ "repository": { | ||
"dependencies": { | ||
"@codemirror/autocomplete": "^6.16.2", | ||
"@codemirror/commands": "^6.6.0", | ||
"@codemirror/autocomplete": "^6.18.1", | ||
"@codemirror/commands": "^6.6.2", | ||
"@codemirror/lang-json": "^6.0.1", | ||
"@codemirror/language": "^6.10.2", | ||
"@codemirror/lint": "^6.8.0", | ||
"@codemirror/language": "^6.10.3", | ||
"@codemirror/lint": "^6.8.2", | ||
"@codemirror/search": "^6.5.6", | ||
"@codemirror/state": "^6.4.1", | ||
"@codemirror/view": "^6.27.0", | ||
"@fortawesome/free-regular-svg-icons": "^6.5.2", | ||
"@fortawesome/free-solid-svg-icons": "^6.5.2", | ||
"@lezer/highlight": "^1.2.0", | ||
"@replit/codemirror-indentation-markers": "^6.5.2", | ||
"ajv": "^8.16.0", | ||
"@codemirror/view": "^6.33.0", | ||
"@fortawesome/free-regular-svg-icons": "^6.6.0", | ||
"@fortawesome/free-solid-svg-icons": "^6.6.0", | ||
"@jsonquerylang/jsonquery": "^3.0.5", | ||
"@lezer/highlight": "^1.2.1", | ||
"@replit/codemirror-indentation-markers": "^6.5.3", | ||
"ajv": "^8.17.1", | ||
"codemirror-wrapped-line-indent": "^1.0.8", | ||
@@ -55,12 +56,14 @@ "diff-sequences": "^29.6.3", | ||
"json-source-map": "^0.6.1", | ||
"jsonrepair": "^3.8.0", | ||
"jsonpath-plus": "^9.0.0", | ||
"jsonrepair": "^3.8.1", | ||
"lodash-es": "^4.17.21", | ||
"memoize-one": "^6.0.0", | ||
"natural-compare-lite": "^1.4.0", | ||
"sass": "^1.77.4", | ||
"vanilla-picker": "^2.12.3", | ||
"svelte": "^4.2.17" | ||
"sass": "1.78.0", | ||
"svelte": "^4.0.0", | ||
"vanilla-picker": "^2.12.3" | ||
}, | ||
"peerDependencies": {}, | ||
"devDependencies": {}, | ||
"browser": "./standalone.js" | ||
} |
@@ -5,3 +5,3 @@ # vanilla-jsoneditor | ||
Try it out: https://jsoneditoronline.org | ||
Try it out: <https://jsoneditoronline.org> | ||
@@ -42,3 +42,3 @@ This is the vanilla variant of `svelte-jsoneditor`, which can be used in vanilla JavaScript or frameworks like SolidJS, React, Vue, Angular. | ||
// for use in a React, Vue, or Angular project | ||
import { JSONEditor } from 'vanilla-jsoneditor' | ||
import { createJSONEditor } from 'vanilla-jsoneditor' | ||
``` | ||
@@ -50,8 +50,8 @@ | ||
// for use directly in the browser | ||
import { JSONEditor } from 'vanilla-jsoneditor/standalone.js' | ||
import { createJSONEditor } from 'vanilla-jsoneditor/standalone.js' | ||
``` | ||
The standalone bundle contains all dependencies of `vanilla-jsoneditor`, for example `lodash-es` and `Ajv`. If you use some of these dependencies in your project too, it means that they will be bundled twice in your web application, leading to a needlessly large application size. In general, it is preferable to use the default `import { JSONEditor } from 'vanilla-jsoneditor'` so dependencies can be reused. | ||
The standalone bundle contains all dependencies of `vanilla-jsoneditor`, for example `lodash-es` and `Ajv`. If you use some of these dependencies in your project too, it means that they will be bundled twice in your web application, leading to a needlessly large application size. In general, it is preferable to use the default `import { createJSONEditor } from 'vanilla-jsoneditor'` so dependencies can be reused. | ||
## Use (Browser example loading the ES module): | ||
## Use (Browser example loading the ES module) | ||
@@ -68,7 +68,7 @@ ```html | ||
<script type="module"> | ||
import { JSONEditor } from 'vanilla-jsoneditor/standalone.js' | ||
import { createJSONEditor } from 'vanilla-jsoneditor/standalone.js' | ||
// Or use it through a CDN (not recommended for use in production): | ||
// import { JSONEditor } from 'https://unpkg.com/vanilla-jsoneditor/index.js' | ||
// import { JSONEditor } from 'https://cdn.jsdelivr.net/npm/vanilla-jsoneditor/index.js' | ||
// import { createJSONEditor } from 'https://unpkg.com/vanilla-jsoneditor/index.js' | ||
// import { createJSONEditor } from 'https://cdn.jsdelivr.net/npm/vanilla-jsoneditor/index.js' | ||
@@ -82,3 +82,3 @@ let content = { | ||
const editor = new JSONEditor({ | ||
const editor = createJSONEditor({ | ||
target: document.getElementById('jsoneditor'), | ||
@@ -108,3 +108,3 @@ props: { | ||
### TypeScript: | ||
### TypeScript | ||
@@ -116,3 +116,3 @@ ```tsx | ||
import { useEffect, useRef } from 'react' | ||
import { JSONEditor, JSONEditorPropsOptional } from 'vanilla-jsoneditor' | ||
import { createJSONEditor, JSONEditorPropsOptional } from 'vanilla-jsoneditor' | ||
@@ -125,3 +125,3 @@ const JSONEditorReact: React.FC<JSONEditorPropsOptional> = (props) => { | ||
// create editor | ||
refEditor.current = new JSONEditor({ | ||
refEditor.current = createJSONEditor({ | ||
target: refContainer.current!, | ||
@@ -168,3 +168,3 @@ props: {} | ||
// create editor | ||
refEditor.current = new JSONEditor({ | ||
refEditor.current = createJSONEditor({ | ||
target: refContainer.current, | ||
@@ -171,0 +171,0 @@ props: {} |
import { SvelteComponent } from 'svelte'; | ||
import { JSONPath, JSONPatchDocument, JSONPointer } from 'immutable-json-patch'; | ||
import { JSONPath, JSONPatchDocument } from 'immutable-json-patch'; | ||
import { IconDefinition } from '@fortawesome/free-solid-svg-icons'; | ||
@@ -57,9 +57,68 @@ import { Action } from 'svelte/action'; | ||
} | ||
interface DocumentState { | ||
expandedMap: JSONPointerMap<boolean>; | ||
enforceStringMap: JSONPointerMap<boolean>; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]>; | ||
selection: JSONSelection | null; | ||
sortedColumn: SortedColumn | null; | ||
interface ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, RecursiveState | undefined>; | ||
} | ||
interface ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<RecursiveState | undefined>; | ||
} | ||
interface ValueRecursiveState { | ||
type: 'value'; | ||
} | ||
type RecursiveState = ObjectRecursiveState | ArrayRecursiveState | ValueRecursiveState; | ||
interface RecursiveStateFactory { | ||
createObjectDocumentState: () => ObjectRecursiveState; | ||
createArrayDocumentState: () => ArrayRecursiveState; | ||
createValueDocumentState: () => ValueRecursiveState; | ||
} | ||
interface ObjectDocumentState extends ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, DocumentState | undefined>; | ||
expanded: boolean; | ||
} | ||
interface ArrayDocumentState extends ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<DocumentState | undefined>; | ||
expanded: boolean; | ||
visibleSections: VisibleSection[]; | ||
} | ||
interface ValueDocumentState extends ValueRecursiveState { | ||
type: 'value'; | ||
enforceString?: boolean; | ||
} | ||
type DocumentState = ObjectDocumentState | ArrayDocumentState | ValueDocumentState; | ||
interface ObjectSearchResults extends ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, SearchResults | undefined>; | ||
searchResults?: ExtendedSearchResultItem[]; | ||
} | ||
interface ArraySearchResults extends ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<SearchResults | undefined>; | ||
searchResults?: ExtendedSearchResultItem[]; | ||
} | ||
interface ValueSearchResults extends ValueRecursiveState { | ||
type: 'value'; | ||
searchResults?: ExtendedSearchResultItem[]; | ||
} | ||
type SearchResults = ObjectSearchResults | ArraySearchResults | ValueSearchResults; | ||
type WithSearchResults = SearchResults & { | ||
searchResults: ExtendedSearchResultItem[]; | ||
}; | ||
interface ObjectValidationErrors extends ObjectRecursiveState { | ||
type: 'object'; | ||
properties: Record<string, ValidationErrors | undefined>; | ||
validationError?: NestedValidationError; | ||
} | ||
interface ArrayValidationErrors extends ArrayRecursiveState { | ||
type: 'array'; | ||
items: Array<ValidationErrors | undefined>; | ||
validationError?: NestedValidationError; | ||
} | ||
interface ValueValidationErrors extends ValueRecursiveState { | ||
type: 'value'; | ||
validationError?: NestedValidationError; | ||
} | ||
type ValidationErrors = ObjectValidationErrors | ArrayValidationErrors | ValueValidationErrors; | ||
interface JSONPatchResult { | ||
@@ -71,5 +130,7 @@ json: unknown; | ||
} | ||
type AfterPatchCallback = (patchedJson: unknown, patchedState: DocumentState) => { | ||
type AfterPatchCallback = (patchedJson: unknown, patchedState: DocumentState | undefined, patchedSelection: JSONSelection | undefined) => { | ||
json?: unknown; | ||
state?: DocumentState; | ||
state?: DocumentState | undefined; | ||
selection?: JSONSelection | undefined; | ||
sortedColumn?: SortedColumn | undefined; | ||
} | undefined; | ||
@@ -92,10 +153,20 @@ interface MultiSelection { | ||
path: JSONPath; | ||
edit?: boolean; | ||
} | ||
interface ValueSelection { | ||
interface EditKeySelection extends KeySelection { | ||
type: SelectionType.key; | ||
path: JSONPath; | ||
edit: true; | ||
initialValue?: string; | ||
} | ||
type ValueSelection = { | ||
type: SelectionType.value; | ||
path: JSONPath; | ||
edit?: boolean; | ||
}; | ||
interface EditValueSelection extends ValueSelection { | ||
type: SelectionType.value; | ||
path: JSONPath; | ||
edit: true; | ||
initialValue?: string; | ||
} | ||
type JSONSelection = MultiSelection | AfterSelection | InsideSelection | KeySelection | ValueSelection; | ||
type JSONSelection = MultiSelection | AfterSelection | InsideSelection | KeySelection | EditKeySelection | ValueSelection | EditValueSelection; | ||
interface TextSelection { | ||
@@ -110,3 +181,2 @@ type: SelectionType.text; | ||
type JSONEditorSelection = JSONSelection | TextSelection; | ||
type JSONPointerMap<T> = Record<JSONPointer, T>; | ||
type ClipboardValues = Array<{ | ||
@@ -174,5 +244,5 @@ key: string; | ||
interface ParseError { | ||
position: number | null; | ||
line: number | null; | ||
column: number | null; | ||
position: number | undefined; | ||
line: number | undefined; | ||
column: number | undefined; | ||
message: string; | ||
@@ -189,10 +259,10 @@ } | ||
interface RichValidationError extends ValidationError { | ||
line: number | null; | ||
column: number | null; | ||
from: number | null; | ||
to: number | null; | ||
line: number | undefined; | ||
column: number | undefined; | ||
from: number | undefined; | ||
to: number | undefined; | ||
actions: Array<{ | ||
name: string; | ||
apply: () => void; | ||
}> | null; | ||
}> | undefined; | ||
} | ||
@@ -233,8 +303,8 @@ interface TextLocation { | ||
interface OnChangeStatus { | ||
contentErrors: ContentErrors | null; | ||
patchResult: JSONPatchResult | null; | ||
contentErrors: ContentErrors | undefined; | ||
patchResult: JSONPatchResult | undefined; | ||
} | ||
type OnChange = ((content: Content, previousContent: Content, status: OnChangeStatus) => void) | null; | ||
type OnChange = ((content: Content, previousContent: Content, status: OnChangeStatus) => void) | undefined; | ||
type OnJSONSelect = (selection: JSONSelection) => void; | ||
type OnSelect = (selection: JSONEditorSelection | null) => void; | ||
type OnSelect = (selection: JSONEditorSelection | undefined) => void; | ||
type OnPatch = (operations: JSONPatchDocument, afterPatch?: AfterPatchCallback) => JSONPatchResult; | ||
@@ -250,7 +320,4 @@ type OnChangeText = (updatedText: string, afterPatch?: AfterPatchCallback) => void; | ||
type OnPaste = (pastedText: string) => void; | ||
type OnPasteJson = (pastedJson: { | ||
path: JSONPath; | ||
contents: unknown; | ||
}) => void; | ||
type OnExpand = (path: JSONPath) => boolean; | ||
type OnPasteJson = (pastedJson: PastedJson) => void; | ||
type OnExpand = (relativePath: JSONPath) => boolean; | ||
type OnRenderValue = (props: RenderValueProps) => RenderValueComponentDescription[]; | ||
@@ -266,8 +333,8 @@ type OnClassName = (path: JSONPath, value: unknown) => string | undefined; | ||
type OnRenderMenu = (items: MenuItem[], context: RenderMenuContext) => MenuItem[] | undefined; | ||
type OnRenderMenuInternal = (items: MenuItem[]) => MenuItem[]; | ||
type OnRenderMenuInternal = (items: MenuItem[]) => MenuItem[] | undefined; | ||
type RenderContextMenuContext = RenderMenuContext & { | ||
selection: JSONEditorSelection | null; | ||
selection: JSONEditorSelection | undefined; | ||
}; | ||
type OnRenderContextMenu = (items: ContextMenuItem[], context: RenderContextMenuContext) => ContextMenuItem[] | false | undefined; | ||
type OnRenderContextMenuInternal = (items: ContextMenuItem[]) => ContextMenuItem[] | false; | ||
type OnRenderContextMenuInternal = (items: ContextMenuItem[]) => ContextMenuItem[] | false | undefined; | ||
type OnError = (error: Error) => void; | ||
@@ -279,6 +346,5 @@ type OnFocus = () => void; | ||
type OnJSONEditorModal = (props: JSONEditorModalCallback) => void; | ||
type FindNextInside = (path: JSONPath) => JSONSelection | null; | ||
interface SearchResult { | ||
type FindNextInside = (path: JSONPath) => JSONSelection | undefined; | ||
interface SearchResultDetails { | ||
items: ExtendedSearchResultItem[]; | ||
itemsMap: JSONPointerMap<ExtendedSearchResultItem[]>; | ||
activeItem: ExtendedSearchResultItem | undefined; | ||
@@ -312,5 +378,6 @@ activeIndex: number | -1; | ||
type PastedJson = { | ||
path: JSONPath; | ||
contents: unknown; | ||
path: JSONPath; | ||
} | undefined; | ||
onPasteAsJson: () => void; | ||
}; | ||
interface DragInsideProps { | ||
@@ -341,3 +408,5 @@ json: unknown; | ||
text: string | undefined; | ||
state: DocumentState; | ||
documentState: DocumentState | undefined; | ||
selection: JSONSelection | undefined; | ||
sortedColumn: SortedColumn | undefined; | ||
textIsRepaired: boolean; | ||
@@ -349,3 +418,5 @@ }; | ||
text: string | undefined; | ||
state: DocumentState; | ||
documentState: DocumentState | undefined; | ||
selection: JSONSelection | undefined; | ||
sortedColumn: SortedColumn | undefined; | ||
textIsRepaired: boolean; | ||
@@ -393,3 +464,3 @@ }; | ||
parser?: JSONParser; | ||
validator?: Validator | null; | ||
validator?: Validator | undefined; | ||
validationParser?: JSONParser; | ||
@@ -411,3 +482,30 @@ pathParser?: JSONPathParser; | ||
} | ||
interface JSONEditorModalProps { | ||
content: Content; | ||
path: JSONPath; | ||
onPatch: OnPatch; | ||
readOnly: boolean; | ||
indentation: number | string; | ||
tabSize: number; | ||
mainMenuBar: boolean; | ||
navigationBar: boolean; | ||
statusBar: boolean; | ||
askToFormat: boolean; | ||
escapeControlCharacters: boolean; | ||
escapeUnicodeCharacters: boolean; | ||
flattenColumns: boolean; | ||
parser: JSONParser; | ||
validator: Validator | undefined; | ||
validationParser: JSONParser; | ||
pathParser: JSONPathParser; | ||
onRenderValue: OnRenderValue; | ||
onClassName: OnClassName; | ||
onRenderMenu: OnRenderMenu; | ||
onRenderContextMenu: OnRenderContextMenu; | ||
onSortModal: (props: SortModalCallback) => void; | ||
onTransformModal: (props: TransformModalCallback) => void; | ||
onClose: () => void; | ||
} | ||
interface JSONEditorContext { | ||
mode: Mode; | ||
readOnly: boolean; | ||
@@ -417,4 +515,4 @@ parser: JSONParser; | ||
getJson: () => unknown | undefined; | ||
getDocumentState: () => DocumentState; | ||
findElement: (path: JSONPath) => Element | null; | ||
getDocumentState: () => DocumentState | undefined; | ||
findElement: (path: JSONPath) => Element | undefined; | ||
findNextInside: FindNextInside; | ||
@@ -430,4 +528,5 @@ focus: () => void; | ||
getJson: () => unknown | undefined; | ||
getDocumentState: () => DocumentState; | ||
findElement: (path: JSONPath) => Element | null; | ||
getDocumentState: () => DocumentState | undefined; | ||
getSelection: () => JSONSelection | undefined; | ||
findElement: (path: JSONPath) => Element | undefined; | ||
onInsert: (type: InsertType) => void; | ||
@@ -444,5 +543,6 @@ onExpand: (path: JSONPath, expanded: boolean, recursive?: boolean) => void; | ||
value: unknown; | ||
mode: Mode; | ||
readOnly: boolean; | ||
enforceString: boolean; | ||
selection: JSONSelection | null; | ||
selection: JSONSelection | undefined; | ||
searchResultItems: SearchResultItem[] | undefined; | ||
@@ -460,25 +560,2 @@ isEditing: boolean; | ||
type RenderValuePropsOptional = Partial<RenderValueProps>; | ||
interface JSONNodeProp { | ||
key: string; | ||
value: unknown; | ||
path: JSONPath; | ||
expandedMap: JSONPointerMap<boolean> | undefined; | ||
enforceStringMap: JSONPointerMap<boolean> | undefined; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]> | undefined; | ||
validationErrorsMap: JSONPointerMap<NestedValidationError> | undefined; | ||
keySearchResultItemsMap: ExtendedSearchResultItem[] | undefined; | ||
valueSearchResultItemsMap: JSONPointerMap<ExtendedSearchResultItem[]> | undefined; | ||
selection: JSONSelection | null; | ||
} | ||
interface JSONNodeItem { | ||
index: number; | ||
value: unknown; | ||
path: JSONPath; | ||
expandedMap: JSONPointerMap<boolean> | undefined; | ||
enforceStringMap: JSONPointerMap<boolean> | undefined; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]> | undefined; | ||
validationErrorsMap: JSONPointerMap<NestedValidationError> | undefined; | ||
searchResultItemsMap: JSONPointerMap<ExtendedSearchResultItem[]> | undefined; | ||
selection: JSONSelection | null; | ||
} | ||
interface DraggingState { | ||
@@ -515,4 +592,25 @@ initialTarget: Element; | ||
id: string; | ||
json: unknown; | ||
rootPath: JSONPath; | ||
onTransform: (operations: JSONPatchDocument) => void; | ||
onClose: () => void; | ||
} | ||
interface TransformModalProps extends TransformModalCallback { | ||
id: string; | ||
json: unknown; | ||
rootPath: JSONPath; | ||
indentation: number | string; | ||
escapeControlCharacters: boolean; | ||
escapeUnicodeCharacters: boolean; | ||
parser: JSONParser; | ||
parseMemoizeOne: JSONParser['parse']; | ||
validationParser: JSONParser; | ||
pathParser: JSONPathParser; | ||
queryLanguages: QueryLanguage[]; | ||
queryLanguageId: string; | ||
onChangeQueryLanguage: OnChangeQueryLanguage; | ||
onRenderValue: OnRenderValue; | ||
onRenderMenu: OnRenderMenuInternal; | ||
onRenderContextMenu: OnRenderContextMenuInternal; | ||
onClassName: OnClassName; | ||
onTransform: (operations: JSONPatchDocument) => void; | ||
@@ -528,2 +626,9 @@ onClose: () => void; | ||
} | ||
interface JSONRepairModalProps { | ||
text: string; | ||
onParse: (text: string) => void; | ||
onRepair: (text: string) => string; | ||
onApply: (repairedText: string) => void; | ||
onClose: () => void; | ||
} | ||
interface JSONEditorModalCallback { | ||
@@ -558,47 +663,48 @@ content: Content; | ||
props: { | ||
content?: Content | undefined; | ||
selection?: JSONEditorSelection | null | undefined; | ||
readOnly?: boolean | undefined; | ||
indentation?: string | number | undefined; | ||
tabSize?: number | undefined; | ||
mode?: Mode | undefined; | ||
mainMenuBar?: boolean | undefined; | ||
navigationBar?: boolean | undefined; | ||
statusBar?: boolean | undefined; | ||
askToFormat?: boolean | undefined; | ||
escapeControlCharacters?: boolean | undefined; | ||
escapeUnicodeCharacters?: boolean | undefined; | ||
flattenColumns?: boolean | undefined; | ||
parser?: JSONParser | undefined; | ||
validator?: Validator | null | undefined; | ||
validationParser?: JSONParser | undefined; | ||
pathParser?: JSONPathParser | undefined; | ||
queryLanguages?: QueryLanguage[] | undefined; | ||
queryLanguageId?: string | undefined; | ||
onChangeQueryLanguage?: OnChangeQueryLanguage | undefined; | ||
content?: Content; | ||
selection?: JSONEditorSelection | undefined; | ||
readOnly?: boolean; | ||
indentation?: number | string; | ||
tabSize?: number; | ||
mode?: Mode; | ||
mainMenuBar?: boolean; | ||
navigationBar?: boolean; | ||
statusBar?: boolean; | ||
askToFormat?: boolean; | ||
escapeControlCharacters?: boolean; | ||
escapeUnicodeCharacters?: boolean; | ||
flattenColumns?: boolean; | ||
parser?: JSONParser; | ||
validator?: Validator | undefined; | ||
validationParser?: JSONParser; | ||
pathParser?: JSONPathParser; | ||
queryLanguages?: QueryLanguage[]; | ||
queryLanguageId?: string; | ||
onChangeQueryLanguage?: OnChangeQueryLanguage; | ||
onChange?: OnChange | undefined; | ||
onSelect?: OnSelect | null | undefined; | ||
onRenderValue?: OnRenderValue | undefined; | ||
onClassName?: OnClassName | undefined; | ||
onRenderMenu?: OnRenderMenu | undefined; | ||
onRenderContextMenu?: OnRenderContextMenu | undefined; | ||
onChangeMode?: OnChangeMode | undefined; | ||
onError?: OnError | undefined; | ||
onFocus?: OnFocus | undefined; | ||
onBlur?: OnBlur | undefined; | ||
get?: (() => Content) | undefined; | ||
set?: ((newContent: Content) => Promise<void>) | undefined; | ||
update?: ((updatedContent: Content) => Promise<void>) | undefined; | ||
patch?: ((operations: JSONPatchDocument) => Promise<JSONPatchResult>) | undefined; | ||
select?: ((newSelection: JSONEditorSelection | null) => Promise<void>) | undefined; | ||
expand?: ((callback?: OnExpand) => Promise<void>) | undefined; | ||
transform?: ((options: TransformModalOptions) => void) | undefined; | ||
validate?: (() => ContentErrors | null) | undefined; | ||
acceptAutoRepair?: (() => Promise<Content>) | undefined; | ||
scrollTo?: ((path: JSONPath) => Promise<void>) | undefined; | ||
findElement?: ((path: JSONPath) => Element | null) | undefined; | ||
focus?: (() => Promise<void>) | undefined; | ||
refresh?: (() => Promise<void>) | undefined; | ||
updateProps?: ((props: JSONEditorPropsOptional) => Promise<void>) | undefined; | ||
destroy?: (() => Promise<void>) | undefined; | ||
onSelect?: OnSelect | undefined; | ||
onRenderValue?: OnRenderValue; | ||
onClassName?: OnClassName; | ||
onRenderMenu?: OnRenderMenu; | ||
onRenderContextMenu?: OnRenderContextMenu; | ||
onChangeMode?: OnChangeMode; | ||
onError?: OnError; | ||
onFocus?: OnFocus; | ||
onBlur?: OnBlur; | ||
get?: () => Content; | ||
set?: (newContent: Content) => Promise<void>; | ||
update?: (updatedContent: Content) => Promise<void>; | ||
patch?: (operations: JSONPatchDocument) => Promise<JSONPatchResult>; | ||
select?: (newSelection: JSONEditorSelection | undefined) => Promise<void>; | ||
expand?: (path: JSONPath, callback?: OnExpand) => Promise<void>; | ||
collapse?: (path: JSONPath, recursive?: boolean) => Promise<void>; | ||
transform?: (options: TransformModalOptions) => void; | ||
validate?: () => ContentErrors | undefined; | ||
acceptAutoRepair?: () => Promise<Content>; | ||
scrollTo?: (path: JSONPath) => Promise<void>; | ||
findElement?: (path: JSONPath) => Element | undefined; | ||
focus?: () => Promise<void>; | ||
refresh?: () => Promise<void>; | ||
updateProps?: (props: JSONEditorPropsOptional) => Promise<void>; | ||
destroy?: () => Promise<void>; | ||
}; | ||
@@ -609,2 +715,4 @@ events: { | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -619,9 +727,10 @@ type JsonEditorProps = typeof __propDef$6.props; | ||
get patch(): (operations: JSONPatchDocument) => Promise<JSONPatchResult>; | ||
get select(): (newSelection: JSONEditorSelection | null) => Promise<void>; | ||
get expand(): (callback?: OnExpand | undefined) => Promise<void>; | ||
get select(): (newSelection: JSONEditorSelection | undefined) => Promise<void>; | ||
get expand(): (path: JSONPath, callback?: OnExpand) => Promise<void>; | ||
get collapse(): (path: JSONPath, recursive?: boolean) => Promise<void>; | ||
get transform(): (options: TransformModalOptions) => void; | ||
get validate(): () => ContentErrors | null; | ||
get validate(): () => ContentErrors | undefined; | ||
get acceptAutoRepair(): () => Promise<Content>; | ||
get scrollTo(): (path: JSONPath) => Promise<void>; | ||
get findElement(): (path: JSONPath) => Element | null; | ||
get findElement(): (path: JSONPath) => Element | undefined; | ||
get focus(): () => Promise<void>; | ||
@@ -645,2 +754,4 @@ get refresh(): () => Promise<void>; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -665,2 +776,4 @@ type BooleanToggleProps = typeof __propDef$5.props; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -677,2 +790,4 @@ type ColorPickerProps = typeof __propDef$4.props; | ||
value: unknown; | ||
selection: JSONSelection | undefined; | ||
mode: Mode; | ||
parser: JSONParser; | ||
@@ -692,2 +807,4 @@ normalization: ValueNormalization; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -704,5 +821,6 @@ type EditableValueProps = typeof __propDef$3.props; | ||
value: unknown; | ||
mode: Mode; | ||
parser: JSONParser; | ||
readOnly: boolean; | ||
selection: JSONSelection | null; | ||
selection: JSONSelection | undefined; | ||
onPatch: OnPatch; | ||
@@ -718,2 +836,4 @@ options: Array<{ | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -730,2 +850,3 @@ type EnumValueProps = typeof __propDef$2.props; | ||
value: unknown; | ||
mode: Mode; | ||
readOnly: boolean; | ||
@@ -741,2 +862,4 @@ normalization: ValueNormalization; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -757,2 +880,4 @@ type ReadonlyValueProps = typeof __propDef$1.props; | ||
slots: {}; | ||
exports?: {} | undefined; | ||
bindings?: string | undefined; | ||
}; | ||
@@ -765,3 +890,3 @@ type TimestampTagProps = typeof __propDef.props; | ||
declare function renderValue({ path, value, readOnly, enforceString, searchResultItems, isEditing, parser, normalization, onPatch, onPasteJson, onSelect, onFind, findNextInside, focus }: RenderValueProps): RenderValueComponentDescription[]; | ||
declare function renderValue({ path, value, mode, readOnly, selection, enforceString, searchResultItems, isEditing, parser, normalization, onPatch, onPasteJson, onSelect, onFind, findNextInside, focus }: RenderValueProps): RenderValueComponentDescription[]; | ||
@@ -773,4 +898,32 @@ /** | ||
*/ | ||
declare function renderJSONSchemaEnum(props: RenderValueProps, schema: JSONSchema, schemaDefinitions?: JSONSchemaDefinitions): RenderValueComponentDescription[] | null; | ||
declare function renderJSONSchemaEnum(props: RenderValueProps, schema: JSONSchema, schemaDefinitions?: JSONSchemaDefinitions): RenderValueComponentDescription[] | undefined; | ||
declare function getValueClass(value: unknown, mode: Mode, parser: JSONParser): string; | ||
declare global { | ||
interface Navigator { | ||
userAgentData?: { | ||
platform: string; | ||
}; | ||
} | ||
} | ||
declare function isMac(): boolean; | ||
interface KeyComboEvent { | ||
ctrlKey: boolean; | ||
metaKey: boolean; | ||
altKey: boolean; | ||
shiftKey: boolean; | ||
key: string; | ||
} | ||
/** | ||
* Get the active key combination from a keyboard event. | ||
* For example returns "Ctrl+Shift+ArrowUp" or "Ctrl+A" | ||
* | ||
* Returns the same output on both Windows and Mac: | ||
* meta keys "Ctrl" ("Command" on Mac), and "Alt" ("Alt" or "Option" on Mac) | ||
* So pressing "Command" and "A"on Mac will return "Ctrl+A" | ||
*/ | ||
declare function keyComboFromEvent(event: KeyComboEvent, separator?: string, isMac?: typeof isMac): string; | ||
interface AjvValidatorOptions { | ||
@@ -800,2 +953,8 @@ schema: JSONSchema; | ||
declare const jsonQueryLanguage: QueryLanguage; | ||
declare const jmespathQueryLanguage: QueryLanguage; | ||
declare const jsonpathQueryLanguage: QueryLanguage; | ||
declare const lodashQueryLanguage: QueryLanguage; | ||
@@ -805,4 +964,2 @@ | ||
declare const jmespathQueryLanguage: QueryLanguage; | ||
/** | ||
@@ -851,13 +1008,35 @@ * Check whether a value is Content (TextContent or JSONContent) | ||
declare function isAfterSelection(selection: JSONEditorSelection | null): selection is AfterSelection; | ||
declare function isInsideSelection(selection: JSONEditorSelection | null): selection is InsideSelection; | ||
declare function isKeySelection(selection: JSONEditorSelection | null): selection is KeySelection; | ||
declare function isValueSelection(selection: JSONEditorSelection | null): selection is ValueSelection; | ||
declare function isMultiSelection(selection: JSONEditorSelection | null): selection is MultiSelection; | ||
declare function createKeySelection(path: JSONPath, edit: boolean): KeySelection; | ||
declare function createValueSelection(path: JSONPath, edit: boolean): ValueSelection; | ||
/** | ||
* Expand the root array or object, and in case of an array, expand the first array item | ||
*/ | ||
declare function expandMinimal(relativePath: JSONPath): boolean; | ||
/** | ||
* Expand the root array or object | ||
*/ | ||
declare function expandSelf(relativePath: JSONPath): boolean; | ||
declare function expandAll(): boolean; | ||
declare function expandNone(): boolean; | ||
declare function isAfterSelection(selection: JSONEditorSelection | undefined): selection is AfterSelection; | ||
declare function isInsideSelection(selection: JSONEditorSelection | undefined): selection is InsideSelection; | ||
declare function isKeySelection(selection: JSONEditorSelection | undefined): selection is KeySelection; | ||
declare function isValueSelection(selection: JSONEditorSelection | undefined): selection is ValueSelection; | ||
declare function isMultiSelection(selection: JSONEditorSelection | undefined): selection is MultiSelection; | ||
/** | ||
* Expand a selection start and end into an array containing all paths | ||
* between (and including) start and end | ||
*/ | ||
declare function getSelectionPaths(json: unknown, selection: JSONSelection): JSONPath[]; | ||
declare function getStartPath(json: unknown, selection: JSONSelection): JSONPath; | ||
declare function getEndPath(json: unknown, selection: JSONSelection): JSONPath; | ||
declare function createKeySelection(path: JSONPath): KeySelection; | ||
declare function createEditKeySelection(path: JSONPath, initialValue?: string): EditKeySelection; | ||
declare function createValueSelection(path: JSONPath): ValueSelection; | ||
declare function createEditValueSelection(path: JSONPath, initialValue?: string): EditValueSelection; | ||
declare function createInsideSelection(path: JSONPath): InsideSelection; | ||
declare function createAfterSelection(path: JSONPath): AfterSelection; | ||
declare function createMultiSelection(anchorPath: JSONPath, focusPath: JSONPath): MultiSelection; | ||
declare function isEditingSelection(selection: JSONSelection | null): boolean; | ||
declare function isEditingSelection(selection: JSONSelection | undefined): selection is EditKeySelection | EditValueSelection; | ||
declare function getFocusPath(selection: JSONSelection): JSONPath; | ||
declare function getAnchorPath(selection: JSONSelection): JSONPath; | ||
@@ -893,11 +1072,42 @@ /** | ||
/** | ||
* The provided callback is invoked when the user presses Escape, | ||
* but only the callback of the last registered component is invoked. | ||
* The provided callback is invoked when the user presses Escape, and then stops propagation of the event. | ||
*/ | ||
declare function onEscape(element: HTMLElement | undefined, callback: Callback): { | ||
destroy(): void; | ||
} | undefined; | ||
/** | ||
* Test whether a value is an Object (and not an Array or Class) | ||
*/ | ||
declare function isObject(value: unknown): value is Record<string, unknown>; | ||
/** | ||
* Test whether a value is an Object or an Array (and not a Class) | ||
*/ | ||
declare function isObjectOrArray(value: unknown): value is Object | Array<unknown>; | ||
/** | ||
* Test whether a value is a boolean | ||
* | ||
* This is useful for example when opening a model on top of another modal: | ||
* you only want the top modal to close on Escape, and not the second modal. | ||
* @param {*} value | ||
* @return {boolean} | ||
*/ | ||
declare function onEscape(element: Element | null, callback: Callback): { | ||
destroy: () => void; | ||
}; | ||
declare function isBoolean(value: unknown): value is boolean; | ||
/** | ||
* Test whether a value is a timestamp in milliseconds after the year 2000. | ||
*/ | ||
declare function isTimestamp(value: unknown): boolean; | ||
/** | ||
* Test if a string contains a valid color name or code. | ||
* Returns true if a valid color, false otherwise | ||
*/ | ||
declare function isColor(value: unknown): boolean; | ||
/** | ||
* Get the type of the value | ||
*/ | ||
declare function valueType(value: unknown, parser: JSONParser): string; | ||
declare function isUrl(text: unknown): boolean; | ||
/** | ||
* Convert contents of a string to the correct JSON type. This can be a string, | ||
* a number, a boolean, etc | ||
*/ | ||
declare function stringConvert(str: string, parser: JSONParser): unknown; | ||
@@ -917,3 +1127,8 @@ declare function isMenuSpace(item: unknown): item is MenuSpace; | ||
declare function isSvelteActionRenderer(value: unknown): value is SvelteActionRenderer; | ||
declare function isObjectRecursiveState(state: RecursiveState | undefined): state is ObjectRecursiveState; | ||
declare function isArrayRecursiveState(state: RecursiveState | undefined): state is ArrayRecursiveState; | ||
declare function isValueRecursiveState(state: RecursiveState | undefined): state is ValueRecursiveState; | ||
declare function isExpandableState(state: RecursiveState | undefined): state is ObjectRecursiveState | ArrayRecursiveState; | ||
declare function hasSearchResults(state: SearchResults | undefined): state is WithSearchResults; | ||
export { type AbsolutePopupContext, type AbsolutePopupOptions, type AfterPatchCallback, type AfterSelection, type AjvValidatorOptions, BooleanToggle, type CaretPosition, CaretType, type ClipboardValues, ColorPicker, type Content, type ContentErrors, type ContentParseError, type ContentValidationErrors, type ContextMenuColumn, type ContextMenuItem, type ContextMenuRow, type ConvertType, type DocumentState, type DragInsideAction, type DragInsideProps, type DraggingState, EditableValue, EnumValue, type EscapeValue, type ExtendedSearchResultItem, type FindNextInside, type HistoryItem, type InsertType, type InsideSelection, type JSONContent, JsonEditor as JSONEditor, type JSONEditorContext, type JSONEditorModalCallback, type JSONEditorPropsOptional, type JSONEditorSelection, type JSONNodeItem, type JSONNodeProp, type JSONParser, type JSONPatchResult, type JSONPathParser, type JSONPointerMap, type JSONSchema, type JSONSchemaDefinitions, type JSONSchemaEnum, type JSONSelection, type KeySelection, type MenuButton, type MenuDropDownButton, type MenuItem, type MenuLabel, type MenuSeparator, type MenuSpace, type MessageAction, Mode, type MultiSelection, type NestedValidationError, type NumberOption, type OnBlur, type OnChange, type OnChangeMode, type OnChangeQueryLanguage, type OnChangeStatus, type OnChangeText, type OnClassName, type OnContextMenu, type OnError, type OnExpand, type OnFind, type OnFocus, type OnJSONEditorModal, type OnJSONSelect, type OnPaste, type OnPasteJson, type OnPatch, type OnRenderContextMenu, type OnRenderContextMenuInternal, type OnRenderMenu, type OnRenderMenuInternal, type OnRenderValue, type OnSelect, type OnSort, type OnSortModal, type OnTransformModal, type ParseError, type PastedJson, type PathOption, type PopupEntry, type QueryLanguage, type QueryLanguageOptions, ReadonlyValue, type RenderContextMenuContext, type RenderMenuContext, type RenderValueComponentDescription, type RenderValueProps, type RenderValuePropsOptional, type RenderedItem, type RichValidationError, SearchField, type SearchOptions, type SearchResult, type SearchResultItem, type Section, SelectionType, SortDirection, type SortModalCallback, type SortedColumn, type SvelteActionRenderer, type SvelteComponentRenderer, type TableCellIndex, type TextContent, type TextLocation, type TextSelection, TimestampTag, type TransformModalCallback, type TransformModalOptions, type TreeModeContext, type UnescapeValue, UpdateSelectionAfterChange, type ValidationError, ValidationSeverity, type Validator, type ValueNormalization, type ValueSelection, type VisibleSection, createAfterSelection, createAjvValidator, createInsideSelection, createKeySelection, createMultiSelection, createValueSelection, estimateSerializedSize, isAfterSelection, isContent, isContentParseError, isContentValidationErrors, isContextMenuColumn, isContextMenuRow, isEditingSelection, isEqualParser, isInsideSelection, isJSONContent, isKeySelection, isLargeContent, isMenuButton, isMenuDropDownButton, isMenuLabel, isMenuSeparator, isMenuSpace, isMultiSelection, isNestedValidationError, isSvelteActionRenderer, isSvelteComponentRenderer, isTextContent, isValidationError, isValueSelection, javascriptQueryLanguage, jmespathQueryLanguage, lodashQueryLanguage, onEscape, parseJSONPath, renderJSONSchemaEnum, renderValue, resizeObserver, stringifyJSONPath, toJSONContent, toTextContent }; | ||
export { type AbsolutePopupContext, type AbsolutePopupOptions, type AfterPatchCallback, type AfterSelection, type AjvValidatorOptions, type ArrayDocumentState, type ArrayRecursiveState, type ArraySearchResults, type ArrayValidationErrors, BooleanToggle, type CaretPosition, CaretType, type ClipboardValues, ColorPicker, type Content, type ContentErrors, type ContentParseError, type ContentValidationErrors, type ContextMenuColumn, type ContextMenuItem, type ContextMenuRow, type ConvertType, type DocumentState, type DragInsideAction, type DragInsideProps, type DraggingState, type EditKeySelection, type EditValueSelection, EditableValue, EnumValue, type EscapeValue, type ExtendedSearchResultItem, type FindNextInside, type HistoryItem, type InsertType, type InsideSelection, type JSONContent, JsonEditor as JSONEditor, type JSONEditorContext, type JSONEditorModalCallback, type JSONEditorModalProps, type JSONEditorPropsOptional, type JSONEditorSelection, type JSONParser, type JSONPatchResult, type JSONPathParser, type JSONRepairModalProps, type JSONSchema, type JSONSchemaDefinitions, type JSONSchemaEnum, type JSONSelection, type KeySelection, type MenuButton, type MenuDropDownButton, type MenuItem, type MenuLabel, type MenuSeparator, type MenuSpace, type MessageAction, Mode, type MultiSelection, type NestedValidationError, type NumberOption, type ObjectDocumentState, type ObjectRecursiveState, type ObjectSearchResults, type ObjectValidationErrors, type OnBlur, type OnChange, type OnChangeMode, type OnChangeQueryLanguage, type OnChangeStatus, type OnChangeText, type OnClassName, type OnContextMenu, type OnError, type OnExpand, type OnFind, type OnFocus, type OnJSONEditorModal, type OnJSONSelect, type OnPaste, type OnPasteJson, type OnPatch, type OnRenderContextMenu, type OnRenderContextMenuInternal, type OnRenderMenu, type OnRenderMenuInternal, type OnRenderValue, type OnSelect, type OnSort, type OnSortModal, type OnTransformModal, type ParseError, type PastedJson, type PathOption, type PopupEntry, type QueryLanguage, type QueryLanguageOptions, ReadonlyValue, type RecursiveState, type RecursiveStateFactory, type RenderContextMenuContext, type RenderMenuContext, type RenderValueComponentDescription, type RenderValueProps, type RenderValuePropsOptional, type RenderedItem, type RichValidationError, SearchField, type SearchOptions, type SearchResultDetails, type SearchResultItem, type SearchResults, type Section, SelectionType, SortDirection, type SortModalCallback, type SortedColumn, type SvelteActionRenderer, type SvelteComponentRenderer, type TableCellIndex, type TextContent, type TextLocation, type TextSelection, TimestampTag, type TransformModalCallback, type TransformModalOptions, type TransformModalProps, type TreeModeContext, type UnescapeValue, UpdateSelectionAfterChange, type ValidationError, type ValidationErrors, ValidationSeverity, type Validator, type ValueDocumentState, type ValueNormalization, type ValueRecursiveState, type ValueSearchResults, type ValueSelection, type ValueValidationErrors, type VisibleSection, type WithSearchResults, createAfterSelection, createAjvValidator, createEditKeySelection, createEditValueSelection, createInsideSelection, createKeySelection, createMultiSelection, createValueSelection, estimateSerializedSize, expandAll, expandMinimal, expandNone, expandSelf, getAnchorPath, getEndPath, getFocusPath, getSelectionPaths, getStartPath, getValueClass, hasSearchResults, isAfterSelection, isArrayRecursiveState, isBoolean, isColor, isContent, isContentParseError, isContentValidationErrors, isContextMenuColumn, isContextMenuRow, isEditingSelection, isEqualParser, isExpandableState, isInsideSelection, isJSONContent, isKeySelection, isLargeContent, isMenuButton, isMenuDropDownButton, isMenuLabel, isMenuSeparator, isMenuSpace, isMultiSelection, isNestedValidationError, isObject, isObjectOrArray, isObjectRecursiveState, isSvelteActionRenderer, isSvelteComponentRenderer, isTextContent, isTimestamp, isUrl, isValidationError, isValueRecursiveState, isValueSelection, javascriptQueryLanguage, jmespathQueryLanguage, jsonQueryLanguage, jsonpathQueryLanguage, keyComboFromEvent, lodashQueryLanguage, onEscape, parseJSONPath, renderJSONSchemaEnum, renderValue, resizeObserver, stringConvert, stringifyJSONPath, toJSONContent, toTextContent, valueType }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
9054069
27
9078
31
+ Addedjsonpath-plus@^9.0.0
+ Added@jsep-plugin/assignment@1.3.0(transitive)
+ Added@jsep-plugin/regex@1.0.4(transitive)
+ Added@jsonquerylang/jsonquery@3.1.1(transitive)
+ Addedanymatch@3.1.3(transitive)
+ Addedbinary-extensions@2.3.0(transitive)
+ Addedchokidar@3.6.0(transitive)
+ Addedfsevents@2.3.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedimmutable@4.3.7(transitive)
+ Addedis-binary-path@2.1.0(transitive)
+ Addedjsep@1.4.0(transitive)
+ Addedjsonpath-plus@9.0.0(transitive)
+ Addednormalize-path@3.0.0(transitive)
+ Addedreaddirp@3.6.0(transitive)
+ Addedsass@1.78.0(transitive)
- Removed@parcel/watcher@2.5.0(transitive)
- Removed@parcel/watcher-android-arm64@2.5.0(transitive)
- Removed@parcel/watcher-darwin-arm64@2.5.0(transitive)
- Removed@parcel/watcher-darwin-x64@2.5.0(transitive)
- Removed@parcel/watcher-freebsd-x64@2.5.0(transitive)
- Removed@parcel/watcher-linux-arm-glibc@2.5.0(transitive)
- Removed@parcel/watcher-linux-arm-musl@2.5.0(transitive)
- Removed@parcel/watcher-linux-arm64-glibc@2.5.0(transitive)
- Removed@parcel/watcher-linux-arm64-musl@2.5.0(transitive)
- Removed@parcel/watcher-linux-x64-glibc@2.5.0(transitive)
- Removed@parcel/watcher-linux-x64-musl@2.5.0(transitive)
- Removed@parcel/watcher-win32-arm64@2.5.0(transitive)
- Removed@parcel/watcher-win32-ia32@2.5.0(transitive)
- Removed@parcel/watcher-win32-x64@2.5.0(transitive)
- Removedchokidar@4.0.1(transitive)
- Removeddetect-libc@1.0.3(transitive)
- Removedimmutable@5.0.3(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removednode-addon-api@7.1.1(transitive)
- Removedreaddirp@4.0.2(transitive)
- Removedsass@1.83.0(transitive)
Updated@codemirror/commands@^6.6.2
Updated@codemirror/language@^6.10.3
Updated@codemirror/lint@^6.8.2
Updated@codemirror/view@^6.33.0
Updated@lezer/highlight@^1.2.1
Updatedajv@^8.17.1
Updatedjsonrepair@^3.8.1
Updatedsass@1.78.0
Updatedsvelte@^4.0.0