diff --git a/app/useColumnView/index.ts b/app/useColumnView/index.ts
index 6c63f26..88f9c2d 100644
--- a/app/useColumnView/index.ts
+++ b/app/useColumnView/index.ts
@@ -39,6 +39,7 @@ export type ColumnViewInstanceState = {
columns: Array;
getColumnViewProps: () => ColumnViewProps;
selectedNodeId?: string;
+ selectedNodeSource?: string;
selectedPath: string[];
highlightedNodeId?: string;
highlightedPath: string[];
@@ -54,7 +55,7 @@ export type ColumnViewAPIOptions = {
export type ColumnViewAPI = {
goBack: () => void;
goForward: () => void;
- goToNodeId: (nodeId: string) => void;
+ goToNodeId: (nodeId: string, source: string) => void;
goToParent: (options?: ColumnViewAPIOptions) => void;
goToChildren: () => void;
goToNextSibling: () => void;
@@ -157,8 +158,8 @@ export function useColumnView({
goForward: () => {
dispatch(goForwardAction());
},
- goToNodeId: (nodeId: string) => {
- dispatch(goToNodeIdAction(nodeId));
+ goToNodeId: (nodeId: string, source: string) => {
+ dispatch(goToNodeIdAction(nodeId, source));
},
goToParent: (options?: ColumnViewAPIOptions) => {
dispatch(goToParentAction(options));
@@ -176,10 +177,15 @@ export function useColumnView({
dispatch(resetSelectionAction());
},
};
- }, []);
+ }, [dispatch]);
- const { selectedNodeId, highlightedNodeId, history, historyCurrentIndex } =
- state;
+ const {
+ selectedNodeId,
+ highlightedNodeId,
+ selectedNodeSource,
+ history,
+ historyCurrentIndex,
+ } = state;
const selectedPath = getPathToNode(nodeTable, selectedNodeId);
const highlightedPath = getPathToNode(nodeTable, highlightedNodeId);
@@ -202,6 +208,7 @@ export function useColumnView({
return {
state: {
selectedNodeId,
+ selectedNodeSource,
selectedPath,
selectedNodes,
highlightedNodeId,
@@ -218,6 +225,7 @@ export function useColumnView({
export type ColumnViewState = {
selectedNodeId?: string;
highlightedNodeId?: string;
+ selectedNodeSource?: string;
history: Array>;
historyCurrentIndex: number;
nodeTable: NodeTable;
@@ -227,6 +235,7 @@ export type ColumnViewState = {
export type SetSelectedNodeIdAction = {
type: "SET_SELECTED_NODE_ID";
id: string;
+ source: string;
};
export type MoveSelectedNodeAction = {
@@ -269,10 +278,14 @@ function resetSelectionAction(): ResetSelectionNodeAction {
};
}
-function goToNodeIdAction(nodeId: string): SetSelectedNodeIdAction {
+function goToNodeIdAction(
+ nodeId: string,
+ source: string
+): SetSelectedNodeIdAction {
return {
type: "SET_SELECTED_NODE_ID",
id: nodeId,
+ source,
};
}
@@ -332,6 +345,7 @@ function columnViewReducer(
...state,
selectedNodeId: action.id,
highlightedNodeId: action.id,
+ selectedNodeSource: action.source,
};
case "MOVE_DOWN": {
if (state.highlightedNodeId === state.rootNodeId) {
diff --git a/app/utilities/formatter.ts b/app/utilities/formatter.ts
index 9cd9628..ff5a940 100644
--- a/app/utilities/formatter.ts
+++ b/app/utilities/formatter.ts
@@ -31,15 +31,19 @@ export function formatValue(type: JSONValueType): string | undefined {
case "array": {
if (type.value.length == 0) {
return formatRawValue(type);
+ } else if (type.value.length === 1) {
+ return `1 item`;
} else {
- return undefined;
+ return `${type.value.length} items`;
}
}
case "object": {
if (Object.keys(type.value).length == 0) {
return formatRawValue(type);
+ } else if (Object.keys(type.value).length === 1) {
+ return `1 field`;
} else {
- return undefined;
+ return `${Object.keys(type.value).length} fields`;
}
}
case "bool": {
diff --git a/package-lock.json b/package-lock.json
index 8561bce..e359428 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -42,8 +42,6 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^2.2.2",
- "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
- "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@remix-run/dev": "^1.2.3",
"@tailwindcss/forms": "^0.4.0",
"@types/color": "^3.0.3",
@@ -925,15 +923,6 @@
"integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==",
"optional": true
},
- "node_modules/@esbuild-plugins/node-globals-polyfill": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.1.1.tgz",
- "integrity": "sha512-MR0oAA+mlnJWrt1RQVQ+4VYuRJW/P2YmRTv1AsplObyvuBMnPHiizUF95HHYiSsMGLhyGtWufaq2XQg6+iurBg==",
- "dev": true,
- "peerDependencies": {
- "esbuild": "*"
- }
- },
"node_modules/@esbuild-plugins/node-modules-polyfill": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.1.4.tgz",
@@ -14193,13 +14182,6 @@
"integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==",
"optional": true
},
- "@esbuild-plugins/node-globals-polyfill": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.1.1.tgz",
- "integrity": "sha512-MR0oAA+mlnJWrt1RQVQ+4VYuRJW/P2YmRTv1AsplObyvuBMnPHiizUF95HHYiSsMGLhyGtWufaq2XQg6+iurBg==",
- "dev": true,
- "requires": {}
- },
"@esbuild-plugins/node-modules-polyfill": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.1.4.tgz",
diff --git a/package.json b/package.json
index bedb074..f5fcc3f 100644
--- a/package.json
+++ b/package.json
@@ -59,8 +59,6 @@
},
"devDependencies": {
"@cloudflare/workers-types": "^2.2.2",
- "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
- "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@remix-run/dev": "^1.2.3",
"@tailwindcss/forms": "^0.4.0",
"@types/color": "^3.0.3",
@@ -101,4 +99,4 @@
},
"sideEffects": false,
"main": "dist/worker.js"
-}
+}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 749e4b9..35cfa5a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -13,6 +13,8 @@
"paths": {
"~/*": ["./app/*"]
},
+ "skipDefaultLibCheck": true,
+ "skipLibCheck": true,
// Remix takes care of building everything in `remix build`.
"noEmit": true