djedi-json
Advanced tools
Comparing version 0.5.11 to 0.6.0
import { EditConfig } from '../types'; | ||
export declare const DEFAULT_EDIT_MAP: EditConfig; | ||
export default DEFAULT_EDIT_MAP; |
@@ -0,0 +0,0 @@ import { ChildrenProps } from './type'; |
@@ -0,0 +0,0 @@ import { CMSConfigSettings } from '../../types'; |
@@ -0,0 +0,0 @@ import { CustomProps, IsomorphicCustom } from './type'; |
@@ -0,0 +0,0 @@ import { CMSConfigSettings } from '../../types'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import { CMSConfigSettings } from '../../types'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ export interface CMSEditProps<T> { |
import React from 'react'; | ||
export declare type ButtonProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLButtonElement>, HTMLButtonElement>; | ||
export type ButtonProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLButtonElement>, HTMLButtonElement>; | ||
declare const Button: React.FC<ButtonProps>; | ||
export default Button; |
@@ -0,0 +0,0 @@ import React from 'react'; |
import React from 'react'; | ||
import { TreeReducerAction } from '../core/Tree/types'; | ||
import { Config, NodeTreeItem } from '../types'; | ||
export declare type CMSContextType = { | ||
export type CMSContextType = { | ||
/** Entire CMS configuration, includes all child components. */ | ||
config: Config; | ||
/** If the tree has been modified. */ | ||
dirty: boolean; | ||
/** The tree of nodes. */ | ||
tree?: NodeTreeItem; | ||
/** | ||
* Reducer dispatch, changes the tree of nodes. | ||
* When possible, prefer node-local actions from `useEdit`. | ||
*/ | ||
setTree: (r: TreeReducerAction) => void; | ||
@@ -8,0 +16,0 @@ }; |
import React, { RefObject } from 'react'; | ||
import { Path } from '../core/Tree/types'; | ||
import { NodeContentType, NodeTreeItem } from '../types'; | ||
export declare type EditContextType = { | ||
import { ComponentConfig, NodeContentType, NodeTreeItem } from '../types'; | ||
export type EditContextType = { | ||
/** Ref of the outermost element of the rendered component. */ | ||
ref: RefObject<HTMLSpanElement> | null; | ||
/** The path to this component in the entirte tree. */ | ||
path: string[]; | ||
/** The type of this component. */ | ||
config: ComponentConfig; | ||
/** The type of the parent of this component, `null` if at root. */ | ||
parentType: NodeTreeItem['type'] | null; | ||
/** The local sub-tree for this component. */ | ||
tree: NodeTreeItem; | ||
append: (t: string, o?: Record<string, any>) => void; | ||
/** Append a new component at the end of the current tree/arry of children. */ | ||
append: (type: NodeTreeItem['type'], content?: Record<string, any>) => void; | ||
/** | ||
* Insert a new component in an arbitrary `index` along its siblings. | ||
* Defaults to the `index` below the inserting component. | ||
*/ | ||
insert: (type: NodeTreeItem['type'], opts?: { | ||
index?: number; | ||
content?: Record<string, any>; | ||
}) => void; | ||
/** Remove the current component from the tree. */ | ||
remove: () => void; | ||
patch: (p: NodeContentType) => void; | ||
setEdit: (v: boolean) => void; | ||
/** Patch the current tree with new content. */ | ||
patch: (content: NodeContentType) => void; | ||
/** Set `editing`. */ | ||
setEdit: (isEditing: boolean) => void; | ||
/** | ||
* Whether the current component is being edited. | ||
* Can be repurposed if `editable: false` or `isomorphic: true` in the component config. | ||
*/ | ||
editing: boolean; | ||
/** Shift the current component up or down in the tree. */ | ||
shift: (steps: number) => void; | ||
/** Move the current component to a new location in the tree. */ | ||
move: (to: Path) => void; | ||
@@ -15,0 +40,0 @@ }; |
import React from 'react'; | ||
import { ComponentConfig } from '../../types'; | ||
declare type AppendProps = { | ||
type AppendProps = { | ||
onClick: (type: string) => void; | ||
@@ -5,0 +5,0 @@ config: ComponentConfig; |
@@ -9,7 +9,7 @@ import React, { ReactNode } from 'react'; | ||
/** | ||
* | ||
TODO | ||
* Add nice error messages for config faults | ||
* The root of the CMS and the node tree. | ||
* Provides the CMSContext to all children, accessed with `useCMS`. | ||
* There should only be one CMS component in the tree. | ||
*/ | ||
declare const CMS: React.FC<CMSProps>; | ||
export default CMS; |
@@ -0,0 +0,0 @@ /// <reference types="react" /> |
@@ -0,0 +0,0 @@ import React, { ReactNode } from 'react'; |
import React from 'react'; | ||
export declare type EditGroupProps = { | ||
export type EditGroupProps = { | ||
content: Record<string, any>; | ||
@@ -4,0 +4,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { NodeTreeItem } from "../../types"; | ||
export declare const createEmpty: (type: string, o?: Record<string, any>) => NodeTreeItem; | ||
import { NodeTreeItem } from '../../types'; | ||
export declare const createEmpty: (type: string, content?: Record<string, any>) => NodeTreeItem; |
import React, { ReactNode } from 'react'; | ||
import { NodeTreeItem } from '../../types'; | ||
/** | ||
* | ||
* Renders a tree of components. | ||
* @param config Config to use for resolving the components to be rendered | ||
@@ -6,0 +6,0 @@ * @param tree a NodeTree to be walked |
@@ -0,0 +0,0 @@ import React from 'react'; |
import React from 'react'; | ||
declare const Preview: React.FC; | ||
export default Preview; |
import reducer from './reducer'; | ||
export { reducer }; |
@@ -0,0 +0,0 @@ import { NodeTreeItem } from '../../types'; |
@@ -1,11 +0,11 @@ | ||
import { NodeTreeItem } from "../../types"; | ||
export declare type Path = string[] | string; | ||
export declare type ReplaceAction = { | ||
import { NodeTreeItem } from '../../types'; | ||
export type Path = string[] | string; | ||
export type ReplaceAction = { | ||
type: 'replace'; | ||
payload: NodeTreeItem; | ||
}; | ||
export declare type EmptyAction = { | ||
export type EmptyAction = { | ||
type: 'empty'; | ||
}; | ||
export declare type PatchAction = { | ||
export type PatchAction = { | ||
type: 'patch'; | ||
@@ -15,3 +15,3 @@ payload: NodeTreeItem; | ||
}; | ||
export declare type AddAction = { | ||
export type AddAction = { | ||
type: 'add'; | ||
@@ -21,7 +21,12 @@ payload: NodeTreeItem; | ||
}; | ||
export declare type DeleteAction = { | ||
export type InsertAction = { | ||
type: 'insert'; | ||
at: Path; | ||
payload: NodeTreeItem; | ||
}; | ||
export type DeleteAction = { | ||
type: 'delete'; | ||
path: Path; | ||
}; | ||
export declare type MoveAction = { | ||
export type MoveAction = { | ||
type: 'move'; | ||
@@ -31,2 +36,2 @@ from: Path; | ||
}; | ||
export declare type TreeReducerAction = ReplaceAction | EmptyAction | PatchAction | DeleteAction | AddAction | MoveAction; | ||
export type TreeReducerAction = ReplaceAction | EmptyAction | PatchAction | DeleteAction | AddAction | InsertAction | MoveAction; |
@@ -1,4 +0,5 @@ | ||
import { NodeTreeItem } from "../../types"; | ||
/** clean the tree from faulty nodes */ | ||
export declare const cleanTree: (t: NodeTreeItem) => NodeTreeItem; | ||
export declare function lossyDeepClone<T>(o: T): any; | ||
import { NodeTreeItem } from '../../types'; | ||
/** Clean the tree from faulty nodes. */ | ||
export declare const cleanTree: (node: NodeTreeItem) => NodeTreeItem; | ||
/** Clean the tree from faulty nodes. */ | ||
export declare const addRefsToTree: (node: NodeTreeItem) => NodeTreeItem; |
@@ -0,0 +0,0 @@ import CMSType from './CMSType'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -25,10 +25,10 @@ /// <reference types="react" /> | ||
} | ||
export declare type EditConfigEntry = { | ||
export type EditConfigEntry = { | ||
Component: any; | ||
}; | ||
export declare type EditConfig = Record<string, EditConfigEntry>; | ||
export type EditConfig = Record<string, EditConfigEntry>; | ||
export interface NodeContentType extends Record<string, any> { | ||
children?: NodeTreeItem[] | string; | ||
} | ||
export declare type NodeTreeItem = { | ||
export interface NodeTreeItem { | ||
content: NodeContentType; | ||
@@ -38,2 +38,3 @@ type: string; | ||
__uri?: string; | ||
}; | ||
__ref?: ReturnType<typeof crypto.randomUUID>; | ||
} |
{ | ||
"name": "djedi-json", | ||
"version": "0.5.11", | ||
"version": "0.6.0", | ||
"main": "build/index.js", | ||
@@ -57,4 +57,4 @@ "module": "build/index.esm.js", | ||
"homepage": "https://github.com/5monkeys/djedi-json.js#readme", | ||
"author": "", | ||
"author": "5 Monkeys", | ||
"license": "ISC" | ||
} |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
4268
0
393764
3