vanilla-jsoneditor
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -5,2 +5,20 @@ # Changelog | ||
## [0.6.0](https://github.com/josdejong/svelte-jsoneditor/compare/v0.5.0...v0.6.0) (2022-07-28) | ||
### ⚠ BREAKING CHANGES | ||
* The signature of `onChange` is changed from `onChange(updatedContent, previousContent, patchResult)` | ||
to `onChange(updatedContent, previousContent, { contentErrors, patchResult })`. | ||
### Features | ||
* implement validate method and pass contentErrors via onChange, fixes [#56](https://github.com/josdejong/svelte-jsoneditor/issues/56) ([#119](https://github.com/josdejong/svelte-jsoneditor/issues/119)) ([9847382](https://github.com/josdejong/svelte-jsoneditor/commit/9847382396fe5f853f8ecfde4d5227175c498bf4)) | ||
* implement validate method and pass contentErrors via onChange, fixes [#56](https://github.com/josdejong/svelte-jsoneditor/issues/56) ([#119](https://github.com/josdejong/svelte-jsoneditor/issues/119)) ([705f5f2](https://github.com/josdejong/svelte-jsoneditor/commit/705f5f2ed76a24e671f35f9721ff93d165a4f7bc)) | ||
### Bug Fixes | ||
* [#118](https://github.com/josdejong/svelte-jsoneditor/issues/118) cursor position in TextMode being reset after changing `validator` ([e580e26](https://github.com/josdejong/svelte-jsoneditor/commit/e580e26e3c4d82935a9fed9804666c986d1c3b21)) | ||
## [0.5.0](https://github.com/josdejong/svelte-jsoneditor/compare/v0.4.0...v0.5.0) (2022-07-11) | ||
@@ -7,0 +25,0 @@ |
@@ -50,3 +50,3 @@ | ||
declare type Props = Record<string, any>; | ||
interface IComponentOptions<Props extends Record<string, any> = Record<string, any>> { | ||
interface ComponentConstructorOptions<Props extends Record<string, any> = Record<string, any>> { | ||
target: Element | ShadowRoot; | ||
@@ -91,3 +91,3 @@ anchor?: Element; | ||
$$slot_def: any; | ||
constructor(options: IComponentOptions); | ||
constructor(options: ComponentConstructorOptions); | ||
$capture_state(): void; | ||
@@ -155,3 +155,3 @@ $inject_state(): void; | ||
$$slot_def: Slots; | ||
constructor(options: IComponentOptions<Props>); | ||
constructor(options: ComponentConstructorOptions<Props>); | ||
} | ||
@@ -381,5 +381,13 @@ | ||
} | ||
declare enum ValidationSeverity { | ||
info = "info", | ||
warning = "warning", | ||
error = "error" | ||
} | ||
interface ValidationError { | ||
path: JSONPath; | ||
message: string; | ||
severity: ValidationSeverity; | ||
} | ||
interface NestedValidationError extends ValidationError { | ||
isChildError?: boolean; | ||
@@ -390,8 +398,2 @@ } | ||
position: number | null; | ||
row: number | null; | ||
column: number | null; | ||
message: string; | ||
} | ||
interface NormalizedParseError { | ||
position: number | null; | ||
line: number | null; | ||
@@ -401,5 +403,11 @@ column: number | null; | ||
} | ||
interface RichValidationError { | ||
path?: JSONPath; | ||
isChildError?: boolean; | ||
interface ContentParseError { | ||
parseError: ParseError; | ||
isRepairable: boolean; | ||
} | ||
interface ContentValidationErrors { | ||
validationErrors: ValidationError[]; | ||
} | ||
declare type ContentErrors = ContentParseError | ContentValidationErrors; | ||
interface RichValidationError extends ValidationError { | ||
line?: number; | ||
@@ -409,4 +417,2 @@ column?: number; | ||
to: number; | ||
message: string; | ||
severity: 'info' | 'warning' | 'error'; | ||
actions: Array<{ | ||
@@ -450,3 +456,7 @@ name: string; | ||
declare type OnChangeQueryLanguage = (queryLanguageId: string) => void; | ||
declare type OnChange = ((content: Content, previousContent: Content, patchResult: JSONPatchResult | null) => void) | null; | ||
interface OnChangeStatus { | ||
contentErrors: ContentErrors; | ||
patchResult: JSONPatchResult | null; | ||
} | ||
declare type OnChange = ((content: Content, previousContent: Content, OnChangeStatus: any) => void) | null; | ||
declare type OnSelect = (selection: JSONSelection) => void; | ||
@@ -638,3 +648,3 @@ declare type OnPatch = (operations: JSONPatchDocument, afterPatch?: AfterPatchCallback) => void; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]> | undefined; | ||
validationErrorsMap: JSONPointerMap<ValidationError> | undefined; | ||
validationErrorsMap: JSONPointerMap<NestedValidationError> | undefined; | ||
keySearchResultItemsMap: ExtendedSearchResultItem[] | undefined; | ||
@@ -652,3 +662,3 @@ valueSearchResultItemsMap: JSONPointerMap<ExtendedSearchResultItem[]> | undefined; | ||
visibleSectionsMap: JSONPointerMap<VisibleSection[]> | undefined; | ||
validationErrorsMap: JSONPointerMap<ValidationError> | undefined; | ||
validationErrorsMap: JSONPointerMap<NestedValidationError> | undefined; | ||
searchResultItemsMap: JSONPointerMap<ExtendedSearchResultItem[]> | undefined; | ||
@@ -730,2 +740,3 @@ selection: JSONSelection | undefined; | ||
transform?: (options: TransformModalOptions) => void; | ||
validate?: () => ContentErrors; | ||
acceptAutoRepair?: () => Content; | ||
@@ -754,2 +765,3 @@ scrollTo?: (path: JSONPath) => void; | ||
get transform(): (options: TransformModalOptions) => void; | ||
get validate(): () => ContentErrors; | ||
get acceptAutoRepair(): () => Content; | ||
@@ -943,3 +955,3 @@ get scrollTo(): (path: JSONPath) => void; | ||
*/ | ||
declare function createAjvValidator(schema: JSONData, schemaDefinitions?: JSONData): (json: JSONData) => ValidationError[]; | ||
declare function createAjvValidator(schema: JSONData, schemaDefinitions?: JSONData): Validator; | ||
@@ -1018,2 +1030,2 @@ declare const lodashQueryLanguage: QueryLanguage; | ||
export { AbsolutePopupOptions, AfterPatchCallback, AfterSelection, BooleanToggle, CaretPosition, CaretType, ClipboardValues, ColorPicker, Content, DocumentState, DragInsideAction, DragInsideProps, DraggingState, DropdownButtonItem, EditableValue, EnumValue, EscapeValue, ExtendedSearchResultItem, FontAwesomeIcon, HistoryItem, InsertType, InsideSelection, JSONContent, JSONData, JsonEditor as JSONEditor, JSONEditorPropsOptional, JSONNodeItem, JSONNodeProp, JSONPatchDocument, JSONPatchResult, JSONPath, JSONPointer, JSONPointerMap, JSONSelection, KeySelection, MenuButtonItem, MenuItem, MenuSeparatorItem, MenuSpaceItem, MessageAction, Mode, MultiSelection, NormalizedParseError, OnBlur, OnChange, OnChangeMode, OnChangeQueryLanguage, OnClassName, OnContextMenu, OnError, OnFind, OnFocus, OnPaste, OnPasteJson, OnPatch, OnRenderMenu, OnRenderValue, OnSelect, OnSort, ParseError, PastedJson, PopupEntry, QueryLanguage, QueryLanguageOptions, ReadonlyValue, RenderValueComponentDescription, RenderValueProps, RenderValuePropsOptional, RenderedItem, RichValidationError, SearchField, SearchResult, SearchResultItem, Section, SelectionType, SortModal, SortModalCallback, TextContent, TextLocation, TimestampTag, TransformModal, TransformModalCallback, TransformModalOptions, TreeModeContext, UnescapeValue, ValidationError, Validator, ValueNormalization, ValueSelection, VisibleSection, compileJSONPointer, compileJSONPointerProp, createAfterSelection, createAjvValidator, createInsideSelection, createKeySelection, createMultiSelection, createValueSelection, deleteIn, estimateSerializedSize, existsIn, findEnum, findSchema, getIn, getJSONSchemaOptions, immutableJSONPatch, insertAt, isAfterSelection, isEditingSelection, isInsideSelection, isKeySelection, isLargeContent, isMultiSelection, isTextContent, isValueSelection, javascriptQueryLanguage, jmespathQueryLanguage, lodashQueryLanguage, parseFrom, parseJSONPointer, parsePath, renderJSONSchemaEnum, renderValue, revertJSONPatch, setIn, updateIn }; | ||
export { AbsolutePopupOptions, AfterPatchCallback, AfterSelection, BooleanToggle, CaretPosition, CaretType, ClipboardValues, ColorPicker, Content, ContentErrors, ContentParseError, ContentValidationErrors, DocumentState, DragInsideAction, DragInsideProps, DraggingState, DropdownButtonItem, EditableValue, EnumValue, EscapeValue, ExtendedSearchResultItem, FontAwesomeIcon, HistoryItem, InsertType, InsideSelection, JSONContent, JSONData, JsonEditor as JSONEditor, JSONEditorPropsOptional, JSONNodeItem, JSONNodeProp, JSONPatchDocument, JSONPatchResult, JSONPath, JSONPointer, JSONPointerMap, JSONSelection, KeySelection, MenuButtonItem, MenuItem, MenuSeparatorItem, MenuSpaceItem, MessageAction, Mode, MultiSelection, NestedValidationError, OnBlur, OnChange, OnChangeMode, OnChangeQueryLanguage, OnChangeStatus, OnClassName, OnContextMenu, OnError, OnFind, OnFocus, OnPaste, OnPasteJson, OnPatch, OnRenderMenu, OnRenderValue, OnSelect, OnSort, ParseError, PastedJson, PopupEntry, QueryLanguage, QueryLanguageOptions, ReadonlyValue, RenderValueComponentDescription, RenderValueProps, RenderValuePropsOptional, RenderedItem, RichValidationError, SearchField, SearchResult, SearchResultItem, Section, SelectionType, SortModal, SortModalCallback, TextContent, TextLocation, TimestampTag, TransformModal, TransformModalCallback, TransformModalOptions, TreeModeContext, UnescapeValue, ValidationError, ValidationSeverity, Validator, ValueNormalization, ValueSelection, VisibleSection, compileJSONPointer, compileJSONPointerProp, createAfterSelection, createAjvValidator, createInsideSelection, createKeySelection, createMultiSelection, createValueSelection, deleteIn, estimateSerializedSize, existsIn, findEnum, findSchema, getIn, getJSONSchemaOptions, immutableJSONPatch, insertAt, isAfterSelection, isEditingSelection, isInsideSelection, isKeySelection, isLargeContent, isMultiSelection, isTextContent, isValueSelection, javascriptQueryLanguage, jmespathQueryLanguage, lodashQueryLanguage, parseFrom, parseJSONPointer, parsePath, renderJSONSchemaEnum, renderValue, revertJSONPatch, setIn, updateIn }; |
{ | ||
"name": "vanilla-jsoneditor", | ||
"description": "A web-based tool to view, edit, format, transform, and validate JSON", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "svelte": "index.js", |
@@ -5,3 +5,3 @@ # vanilla-jsoneditor | ||
This is the vanilla variant of `svelte-jsoneditor` that can be used in vanilla JavaScript or frameworks like SolidJS, React, Vue, Angular | ||
This is the vanilla variant of `svelte-jsoneditor` that can be used in vanilla JavaScript or frameworks like SolidJS, React, Vue, Angular. | ||
@@ -43,5 +43,5 @@ ## Install | ||
content, | ||
onChange: (updatedContent, previousContent, patchResult) => { | ||
onChange: (updatedContent, previousContent, { contentErrors, patchResult }) => { | ||
// content is an object { json: JSONData } | { text: string } | ||
console.log('onChange', updatedContent, previousContent, patchResult) | ||
console.log('onChange', { updatedContent, previousContent, contentErrors, patchResult }) | ||
content = updatedContent | ||
@@ -48,0 +48,0 @@ } |
Sorry, the diff of this file is too big to display
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6968735
5928
0