From 047826d804830a23bbb20129c8cd8f67eba86923 Mon Sep 17 00:00:00 2001 From: kguillouard Date: Tue, 12 Mar 2024 00:38:46 +0100 Subject: [PATCH 01/32] chore: pushed new JSON-Schema --- schema.json | 263 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 schema.json diff --git a/schema.json b/schema.json new file mode 100644 index 0000000..4742ed3 --- /dev/null +++ b/schema.json @@ -0,0 +1,263 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "default": { + "edges": [], + "nodes": [] + }, + "properties": { + "required": true, + "edges": { + "items": { + "$ref": "#/definitions/JSONCanvasEdge" + }, + "type": "array" + }, + "nodes": { + "items": { + "$ref": "#/definitions/JSONCanvasNode" + }, + "type": "array" + } + }, + "definitions": { + "JSONCanvasColor": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/JSONCanvasColorPreset" + } + ] + }, + "JSONCanvasColorPreset": { + "enum": [1, 2, 3, 4, 5, 6], + "type": "number" + }, + "JSONCanvasEdge": { + "additionalProperties": false, + "properties": { + "color": { + "$ref": "#/definitions/JSONCanvasColor" + }, + "fromNode": { + "type": "string" + }, + "fromSide": { + "$ref": "#/definitions/JSONCanvasEdgeSide" + }, + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "toEnd": { + "$ref": "#/definitions/JSONCanvasEdgeEnd" + }, + "toNode": { + "type": "string" + }, + "toSide": { + "$ref": "#/definitions/JSONCanvasEdgeSide" + } + }, + "required": ["id", "fromNode", "toNode"], + "type": "object" + }, + "JSONCanvasEdgeEnd": { + "enum": ["none", "arrow"], + "type": "string" + }, + "JSONCanvasEdgeSide": { + "enum": ["top", "right", "bottom", "left"], + "type": "string" + }, + "JSONCanvasFileNode": { + "additionalProperties": false, + "properties": { + "color": { + "$ref": "#/definitions/JSONCanvasColor" + }, + "file": { + "type": "string" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "subpath": { + "type": "string" + }, + "type": { + "const": "file", + "type": "string" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": ["file", "height", "id", "type", "width", "x", "y"], + "type": "object" + }, + "JSONCanvasGroupNode": { + "additionalProperties": false, + "properties": { + "background": { + "type": "string" + }, + "backgroundStyle": { + "enum": ["cover", "ratio", "repeat"], + "type": "string" + }, + "color": { + "$ref": "#/definitions/JSONCanvasColor" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "label": { + "type": "string" + }, + "type": { + "const": "group", + "type": "string" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": ["height", "id", "type", "width", "x", "y"], + "type": "object" + }, + "JSONCanvasLinkNode": { + "additionalProperties": false, + "properties": { + "color": { + "$ref": "#/definitions/JSONCanvasColor" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "type": { + "const": "link", + "type": "string" + }, + "url": { + "type": "string" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": ["height", "id", "type", "url", "width", "x", "y"], + "type": "object" + }, + "JSONCanvasNode": { + "anyOf": [ + { + "$ref": "#/definitions/JSONCanvasNodeType" + }, + { + "$ref": "#/definitions/JSONCanvasTextNode" + }, + { + "$ref": "#/definitions/JSONCanvasFileNode" + }, + { + "$ref": "#/definitions/JSONCanvasLinkNode" + }, + { + "$ref": "#/definitions/JSONCanvasGroupNode" + } + ] + }, + "JSONCanvasNodeType": { + "additionalProperties": false, + "properties": { + "color": { + "$ref": "#/definitions/JSONCanvasColor" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "type": { + "enum": ["text", "file", "link", "group"], + "type": "string" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": ["id", "type", "x", "y", "width", "height"], + "type": "object" + }, + "JSONCanvasTextNode": { + "additionalProperties": false, + "properties": { + "color": { + "$ref": "#/definitions/JSONCanvasColor" + }, + "height": { + "type": "number" + }, + "id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "type": { + "const": "text", + "type": "string" + }, + "width": { + "type": "number" + }, + "x": { + "type": "number" + }, + "y": { + "type": "number" + } + }, + "required": ["height", "id", "text", "type", "width", "x", "y"], + "type": "object" + } + } +} From c9f24a14bfa7e15c7b2b24f8711b886416bda00d Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Wed, 13 Mar 2024 22:58:25 +0000 Subject: [PATCH 02/32] begin PoC for https://github.com/obsidianmd/jsoncanvas/issues/10 From b16990a8ec616dfa0a4605518ed7ddc8907a4109 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Wed, 13 Mar 2024 23:03:55 +0000 Subject: [PATCH 03/32] initial config --- .gitignore | 1 + package-lock.json | 654 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 16 ++ tsconfig.json | 9 + 4 files changed, 680 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index cfea767..0f08182 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ _site .jekyll-metadata .obsidian vendor +node_modules/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9e024ea --- /dev/null +++ b/package-lock.json @@ -0,0 +1,654 @@ +{ + "name": "jsoncanvas", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "jsoncanvas", + "license": "ISC", + "dependencies": { + "ts-json-schema-generator": "^1.5.0" + }, + "devDependencies": { + "@types/node": "^20.11.27", + "tsx": "^4.7.1", + "typescript": "^5.4.2" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", + "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", + "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", + "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", + "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", + "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", + "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", + "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", + "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", + "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", + "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", + "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", + "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", + "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", + "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", + "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", + "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", + "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", + "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", + "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", + "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", + "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", + "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", + "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "node_modules/@types/node": { + "version": "20.11.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.27.tgz", + "integrity": "sha512-qyUZfMnCg1KEz57r7pzFtSGt49f6RPkPBis3Vo4PbS7roQEDn22hiHzl/Lo1q4i4hDEgBJmBF/NTNg2XR0HbFg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/esbuild": { + "version": "0.19.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", + "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.19.12", + "@esbuild/android-arm": "0.19.12", + "@esbuild/android-arm64": "0.19.12", + "@esbuild/android-x64": "0.19.12", + "@esbuild/darwin-arm64": "0.19.12", + "@esbuild/darwin-x64": "0.19.12", + "@esbuild/freebsd-arm64": "0.19.12", + "@esbuild/freebsd-x64": "0.19.12", + "@esbuild/linux-arm": "0.19.12", + "@esbuild/linux-arm64": "0.19.12", + "@esbuild/linux-ia32": "0.19.12", + "@esbuild/linux-loong64": "0.19.12", + "@esbuild/linux-mips64el": "0.19.12", + "@esbuild/linux-ppc64": "0.19.12", + "@esbuild/linux-riscv64": "0.19.12", + "@esbuild/linux-s390x": "0.19.12", + "@esbuild/linux-x64": "0.19.12", + "@esbuild/netbsd-x64": "0.19.12", + "@esbuild/openbsd-x64": "0.19.12", + "@esbuild/sunos-x64": "0.19.12", + "@esbuild/win32-arm64": "0.19.12", + "@esbuild/win32-ia32": "0.19.12", + "@esbuild/win32-x64": "0.19.12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz", + "integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-json-schema-generator": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-1.5.0.tgz", + "integrity": "sha512-RkiaJ6YxGc5EWVPfyHxszTmpGxX8HC2XBvcFlAl1zcvpOG4tjjh+eXioStXJQYTvr9MoK8zCOWzAUlko3K0DiA==", + "dependencies": { + "@types/json-schema": "^7.0.12", + "commander": "^11.0.0", + "glob": "^8.0.3", + "json5": "^2.2.3", + "normalize-path": "^3.0.0", + "safe-stable-stringify": "^2.4.3", + "typescript": "~5.3.2" + }, + "bin": { + "ts-json-schema-generator": "bin/ts-json-schema-generator" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ts-json-schema-generator/node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/tsx": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.1.tgz", + "integrity": "sha512-8d6VuibXHtlN5E3zFkgY8u4DX7Y3Z27zvvPKVmLon/D4AjuKzarkUBTLDBgj9iTQ0hg5xM7c/mYiRVM+HETf0g==", + "dev": true, + "dependencies": { + "esbuild": "~0.19.10", + "get-tsconfig": "^4.7.2" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fdc06e1 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "jsoncanvas", + "description": "Infinite canvas tools are a way to view and organize information spatially, like a digital whiteboard. Infinite canvases encourage freedom and exploration, and have become a popular interface pattern across many apps.", + "scripts": { + "generate": "tsx ./src/util/generate.ts" + }, + "license": "ISC", + "devDependencies": { + "@types/node": "^20.11.27", + "tsx": "^4.7.1", + "typescript": "^5.4.2" + }, + "dependencies": { + "ts-json-schema-generator": "^1.5.0" + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1c0d64e --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "resolveJsonModule": true, + "moduleResolution": "Node", + "module": "ESNext", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + } +} From dc16d55a594ff5557702d8b0eb0b411b7eb1dd10 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Thu, 14 Mar 2024 10:18:25 +0000 Subject: [PATCH 04/32] Add EditorConfig, Gitignore, VSCode settings, and package-lock.json updates. Adjusted file associations in VSCode settings. --- .editorconfig | 15 + .gitignore | 1 + .vscode/settings.json | 5 + package-lock.json | 1011 +++++++++++++++-------------------------- package.json | 29 +- sample.canvas | 60 ++- tsconfig.json | 14 +- 7 files changed, 452 insertions(+), 683 deletions(-) create mode 100644 .editorconfig create mode 100644 .vscode/settings.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e153a68 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = tab +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{yml,yaml}] +indent_style = space diff --git a/.gitignore b/.gitignore index 0f08182..3983bbc 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ _site .obsidian vendor node_modules/ +.DS_Store diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d0ef5a0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "*.canvas": "json" + } +} diff --git a/package-lock.json b/package-lock.json index 9e024ea..98f752c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,654 +1,361 @@ { - "name": "jsoncanvas", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "jsoncanvas", - "license": "ISC", - "dependencies": { - "ts-json-schema-generator": "^1.5.0" - }, - "devDependencies": { - "@types/node": "^20.11.27", - "tsx": "^4.7.1", - "typescript": "^5.4.2" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", - "integrity": "sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.12.tgz", - "integrity": "sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz", - "integrity": "sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.12.tgz", - "integrity": "sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz", - "integrity": "sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz", - "integrity": "sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz", - "integrity": "sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz", - "integrity": "sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz", - "integrity": "sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz", - "integrity": "sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz", - "integrity": "sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz", - "integrity": "sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz", - "integrity": "sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz", - "integrity": "sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz", - "integrity": "sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz", - "integrity": "sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz", - "integrity": "sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz", - "integrity": "sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz", - "integrity": "sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz", - "integrity": "sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz", - "integrity": "sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz", - "integrity": "sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz", - "integrity": "sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" - }, - "node_modules/@types/node": { - "version": "20.11.27", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.27.tgz", - "integrity": "sha512-qyUZfMnCg1KEz57r7pzFtSGt49f6RPkPBis3Vo4PbS7roQEDn22hiHzl/Lo1q4i4hDEgBJmBF/NTNg2XR0HbFg==", - "dev": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/commander": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", - "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", - "engines": { - "node": ">=16" - } - }, - "node_modules/esbuild": { - "version": "0.19.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", - "integrity": "sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.19.12", - "@esbuild/android-arm": "0.19.12", - "@esbuild/android-arm64": "0.19.12", - "@esbuild/android-x64": "0.19.12", - "@esbuild/darwin-arm64": "0.19.12", - "@esbuild/darwin-x64": "0.19.12", - "@esbuild/freebsd-arm64": "0.19.12", - "@esbuild/freebsd-x64": "0.19.12", - "@esbuild/linux-arm": "0.19.12", - "@esbuild/linux-arm64": "0.19.12", - "@esbuild/linux-ia32": "0.19.12", - "@esbuild/linux-loong64": "0.19.12", - "@esbuild/linux-mips64el": "0.19.12", - "@esbuild/linux-ppc64": "0.19.12", - "@esbuild/linux-riscv64": "0.19.12", - "@esbuild/linux-s390x": "0.19.12", - "@esbuild/linux-x64": "0.19.12", - "@esbuild/netbsd-x64": "0.19.12", - "@esbuild/openbsd-x64": "0.19.12", - "@esbuild/sunos-x64": "0.19.12", - "@esbuild/win32-arm64": "0.19.12", - "@esbuild/win32-ia32": "0.19.12", - "@esbuild/win32-x64": "0.19.12" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/get-tsconfig": { - "version": "4.7.3", - "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.3.tgz", - "integrity": "sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==", - "dev": true, - "dependencies": { - "resolve-pkg-maps": "^1.0.0" - }, - "funding": { - "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" - } - }, - "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/resolve-pkg-maps": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", - "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", - "dev": true, - "funding": { - "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" - } - }, - "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", - "engines": { - "node": ">=10" - } - }, - "node_modules/ts-json-schema-generator": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-1.5.0.tgz", - "integrity": "sha512-RkiaJ6YxGc5EWVPfyHxszTmpGxX8HC2XBvcFlAl1zcvpOG4tjjh+eXioStXJQYTvr9MoK8zCOWzAUlko3K0DiA==", - "dependencies": { - "@types/json-schema": "^7.0.12", - "commander": "^11.0.0", - "glob": "^8.0.3", - "json5": "^2.2.3", - "normalize-path": "^3.0.0", - "safe-stable-stringify": "^2.4.3", - "typescript": "~5.3.2" - }, - "bin": { - "ts-json-schema-generator": "bin/ts-json-schema-generator" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/ts-json-schema-generator/node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/tsx": { - "version": "4.7.1", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.1.tgz", - "integrity": "sha512-8d6VuibXHtlN5E3zFkgY8u4DX7Y3Z27zvvPKVmLon/D4AjuKzarkUBTLDBgj9iTQ0hg5xM7c/mYiRVM+HETf0g==", - "dev": true, - "dependencies": { - "esbuild": "~0.19.10", - "get-tsconfig": "^4.7.2" - }, - "bin": { - "tsx": "dist/cli.mjs" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - } - }, - "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - } - } + "name": "jsoncanvas", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "jsoncanvas", + "license": "ISC", + "dependencies": { + "ts-json-schema-generator": "^1.5.0" + }, + "devDependencies": { + "@types/node": "^20.11.27", + "ts-node": "^10.9.2", + "typescript": "^5.4.2" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "node_modules/@types/node": { + "version": "20.11.27", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.27.tgz", + "integrity": "sha512-qyUZfMnCg1KEz57r7pzFtSGt49f6RPkPBis3Vo4PbS7roQEDn22hiHzl/Lo1q4i4hDEgBJmBF/NTNg2XR0HbFg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", + "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "engines": { + "node": ">=16" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/safe-stable-stringify": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", + "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-json-schema-generator": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-1.5.0.tgz", + "integrity": "sha512-RkiaJ6YxGc5EWVPfyHxszTmpGxX8HC2XBvcFlAl1zcvpOG4tjjh+eXioStXJQYTvr9MoK8zCOWzAUlko3K0DiA==", + "dependencies": { + "@types/json-schema": "^7.0.12", + "commander": "^11.0.0", + "glob": "^8.0.3", + "json5": "^2.2.3", + "normalize-path": "^3.0.0", + "safe-stable-stringify": "^2.4.3", + "typescript": "~5.3.2" + }, + "bin": { + "ts-json-schema-generator": "bin/ts-json-schema-generator" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ts-json-schema-generator/node_modules/typescript": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + } } diff --git a/package.json b/package.json index fdc06e1..4c38bb7 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,17 @@ { - "name": "jsoncanvas", - "description": "Infinite canvas tools are a way to view and organize information spatially, like a digital whiteboard. Infinite canvases encourage freedom and exploration, and have become a popular interface pattern across many apps.", - "scripts": { - "generate": "tsx ./src/util/generate.ts" - }, - "license": "ISC", - "devDependencies": { - "@types/node": "^20.11.27", - "tsx": "^4.7.1", - "typescript": "^5.4.2" - }, - "dependencies": { - "ts-json-schema-generator": "^1.5.0" - } + "name": "jsoncanvas", + "description": "Infinite canvas tools are a way to view and organize information spatially, like a digital whiteboard. Infinite canvases encourage freedom and exploration, and have become a popular interface pattern across many apps.", + "scripts": { + "generate": "node --loader ts-node/esm --inspect ./src/util/generate.ts ./src/util/generate.ts JsonCanvas" + }, + "license": "ISC", + "devDependencies": { + "@types/node": "^20.11.27", + "ts-node": "^10.9.2", + "typescript": "^5.4.2" + }, + "dependencies": { + "ts-json-schema-generator": "^1.5.0" + }, + "type": "module" } diff --git a/sample.canvas b/sample.canvas index 24a5902..e6ea54f 100644 --- a/sample.canvas +++ b/sample.canvas @@ -1,11 +1,51 @@ { - "nodes":[ - {"id":"8132d4d894c80022","type":"file","file":"readme.md","x":-280,"y":-200,"width":570,"height":560,"color":"6"}, - {"id":"7efdbbe0c4742315","type":"file","file":"_site/logo.svg","x":-280,"y":-440,"width":217,"height":80}, - {"id":"59e896bc8da20699","type":"text","text":"Learn more:\n\n- [Readme](readme.md)\n- [Spec](version/1.0.md)\n- [Github](https://github.com/obsidianmd/jsoncanvas)","x":40,"y":-440,"width":250,"height":160}, - {"id":"0ba565e7f30e0652","type":"file","file":"spec/1.0.md","x":360,"y":-400,"width":400,"height":400} - ], - "edges":[ - {"id":"6fa11ab87f90b8af","fromNode":"7efdbbe0c4742315","fromSide":"right","toNode":"59e896bc8da20699","toSide":"left"} - ] -} \ No newline at end of file + "$schema": "./jsoncanvas.schema.json", + "nodes": [ + { + "id": "8132d4d894c80022", + "type": "file", + "file": "readme.md", + "x": -280, + "y": -200, + "width": 570, + "height": 560, + "color": "6" + }, + { + "id": "7efdbbe0c4742315", + "type": "file", + "file": "_site/logo.svg", + "x": -280, + "y": -440, + "width": 217, + "height": 80 + }, + { + "id": "59e896bc8da20699", + "type": "text", + "text": "Learn more:\n\n- [Readme](readme.md)\n- [Spec](version/1.0.md)\n- [Github](https://github.com/obsidianmd/jsoncanvas)", + "x": 40, + "y": -440, + "width": 250, + "height": 160 + }, + { + "id": "0ba565e7f30e0652", + "type": "file", + "file": "spec/1.0.md", + "x": 360, + "y": -400, + "width": 400, + "height": 400 + } + ], + "edges": [ + { + "id": "6fa11ab87f90b8af", + "fromNode": "7efdbbe0c4742315", + "fromSide": "right", + "toNode": "59e896bc8da20699", + "toSide": "left" + } + ] +} diff --git a/tsconfig.json b/tsconfig.json index 1c0d64e..0b7a0e2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { - "compilerOptions": { - "resolveJsonModule": true, - "moduleResolution": "Node", - "module": "ESNext", - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - } + "compilerOptions": { + "resolveJsonModule": true, + "moduleResolution": "Node", + "module": "ESNext", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + } } From ded83f79cbc590721d389a77b1533a51bf9f6a4a Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Thu, 14 Mar 2024 10:18:31 +0000 Subject: [PATCH 05/32] Add new file for generating JSON schema from TypeScript file - Added a new TypeScript file `generate.ts` to handle the generation of JSON schema from a given TypeScript file. The script validates input parameters, generates a UUID, creates the schema configuration, and writes the resulting JSON schema to an output file. --- src/util/generate.ts | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/util/generate.ts diff --git a/src/util/generate.ts b/src/util/generate.ts new file mode 100644 index 0000000..b009974 --- /dev/null +++ b/src/util/generate.ts @@ -0,0 +1,53 @@ +import fs from "fs"; +import path, { dirname } from "path"; +import { Config, createGenerator } from "ts-json-schema-generator"; +import { fileURLToPath } from "url"; + +const file = process.argv[2]; +if (!file) { + console.error("No file path provided"); + process.exit(1); +} else if (!fs.existsSync(file)) { + console.error("Provided path does not exist"); + process.exit(1); +} else if (!fs.lstatSync(file).isFile()) { + console.error("Provided path is not a file"); + process.exit(1); +} else if (!file.endsWith(".ts")) { + console.error("Provided file is not a typescript file"); + process.exit(1); +} +const rootType = process.argv[3].trim(); +if (!rootType) { + console.error("No root type provided"); + process.exit(1); +} else if (rootType.length === 0) { + console.error("Root type cannot be empty"); + process.exit(1); +} + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); +const projectRoot = path.resolve(__dirname, "../../"); +const srcRoot = path.join(projectRoot, "src"); +const tsconfig = path.join(projectRoot, "tsconfig.json"); + +function generate(file: string, rootType: string = "JsonCanvas") { + const relativePath = path.relative(__dirname, file); + const config: Config = { + path: relativePath, + tsconfig: tsconfig, + type: rootType, + topRef: true, + additionalProperties: false, + sortProps: true, + }; + + const outputPath = path.join(projectRoot, "jsoncanvas.schema.json"); + const gnerator = createGenerator(config); + const schema = gnerator.createSchema(config.type); + const schemaString = JSON.stringify(schema, null, 2); + fs.writeFileSync(outputPath, schemaString); +} + +generate(file); From 2c4df28267183c4dc44110d515d41d27adb194f6 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Thu, 14 Mar 2024 10:34:48 +0000 Subject: [PATCH 06/32] Rename schema --- schema.json => jsoncanvas.schema.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename schema.json => jsoncanvas.schema.json (100%) diff --git a/schema.json b/jsoncanvas.schema.json similarity index 100% rename from schema.json rename to jsoncanvas.schema.json From 27d5d38f4131373233fe024632e03035ecfe05e0 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Thu, 14 Mar 2024 10:35:30 +0000 Subject: [PATCH 07/32] Add JSONCanvas types and interfaces --- src/index.ts | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/index.ts diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..bfa918a --- /dev/null +++ b/src/index.ts @@ -0,0 +1,79 @@ +export type JSONCanvasColor = string | JSONCanvasColorPreset; +export type JSONCanvasColorPreset = 1 | 2 | 3 | 4 | 5 | 6; +export type JSONCanvasEdgeSide = "top" | "right" | "bottom" | "left"; +export type JSONCanvasEdgeEnd = "none" | "arrow"; +export type JSONCanvasNode = + | JSONCanvasNodeType + | JSONCanvasTextNode + | JSONCanvasFileNode + | JSONCanvasLinkNode + | JSONCanvasGroupNode; + +export interface JsonCanvas { + required?: true; + edges?: JSONCanvasEdge[]; + nodes?: JSONCanvasNode[]; + [k: string]: unknown; +} +export interface JSONCanvasEdge { + color?: JSONCanvasColor; + fromNode: string; + fromSide?: JSONCanvasEdgeSide; + id: string; + label?: string; + toEnd?: JSONCanvasEdgeEnd; + toNode: string; + toSide?: JSONCanvasEdgeSide; +} +export interface JSONCanvasNodeType { + color?: JSONCanvasColor; + height: number; + id: string; + type: "text" | "file" | "link" | "group"; + width: number; + x: number; + y: number; +} +export interface JSONCanvasTextNode { + color?: JSONCanvasColor; + height: number; + id: string; + text: string; + type: "text"; + width: number; + x: number; + y: number; +} +export interface JSONCanvasFileNode { + color?: JSONCanvasColor; + file: string; + height: number; + id: string; + subpath?: string; + type: "file"; + width: number; + x: number; + y: number; +} +export interface JSONCanvasLinkNode { + color?: JSONCanvasColor; + height: number; + id: string; + type: "link"; + url: string; + width: number; + x: number; + y: number; +} +export interface JSONCanvasGroupNode { + background?: string; + backgroundStyle?: "cover" | "ratio" | "repeat"; + color?: JSONCanvasColor; + height: number; + id: string; + label?: string; + type: "group"; + width: number; + x: number; + y: number; +} From 9262b5c10d7d559a7e299f783c7630cbeb394941 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Thu, 14 Mar 2024 10:35:38 +0000 Subject: [PATCH 08/32] add generated output based on https://github.com/obsidianmd/jsoncanvas/pull/5 --- jsoncanvas.schema.json | 278 ++++++++++++++++++++++++++--------------- 1 file changed, 174 insertions(+), 104 deletions(-) diff --git a/jsoncanvas.schema.json b/jsoncanvas.schema.json index 4742ed3..62bf77a 100644 --- a/jsoncanvas.schema.json +++ b/jsoncanvas.schema.json @@ -1,41 +1,31 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "default": { - "edges": [], - "nodes": [] - }, - "properties": { - "required": true, - "edges": { - "items": { - "$ref": "#/definitions/JSONCanvasEdge" - }, - "type": "array" - }, - "nodes": { - "items": { - "$ref": "#/definitions/JSONCanvasNode" - }, - "type": "array" - } - }, + "$ref": "#/definitions/JsonCanvas", "definitions": { - "JSONCanvasColor": { - "anyOf": [ - { - "type": "string" - }, - { - "$ref": "#/definitions/JSONCanvasColorPreset" + "JsonCanvas": { + "type": "object", + "properties": { + "required": { + "type": "boolean", + "const": true + }, + "edges": { + "type": "array", + "items": { + "$ref": "#/definitions/JSONCanvasEdge" + } + }, + "nodes": { + "type": "array", + "items": { + "$ref": "#/definitions/JSONCanvasNode" + } } - ] - }, - "JSONCanvasColorPreset": { - "enum": [1, 2, 3, 4, 5, 6], - "type": "number" + }, + "additionalProperties": {} }, "JSONCanvasEdge": { - "additionalProperties": false, + "type": "object", "properties": { "color": { "$ref": "#/definitions/JSONCanvasColor" @@ -62,38 +52,89 @@ "$ref": "#/definitions/JSONCanvasEdgeSide" } }, - "required": ["id", "fromNode", "toNode"], - "type": "object" + "required": [ + "fromNode", + "id", + "toNode" + ], + "additionalProperties": false }, - "JSONCanvasEdgeEnd": { - "enum": ["none", "arrow"], - "type": "string" + "JSONCanvasColor": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/definitions/JSONCanvasColorPreset" + } + ] + }, + "JSONCanvasColorPreset": { + "type": "number", + "enum": [ + 1, + 2, + 3, + 4, + 5, + 6 + ] }, "JSONCanvasEdgeSide": { - "enum": ["top", "right", "bottom", "left"], - "type": "string" + "type": "string", + "enum": [ + "top", + "right", + "bottom", + "left" + ] }, - "JSONCanvasFileNode": { - "additionalProperties": false, + "JSONCanvasEdgeEnd": { + "type": "string", + "enum": [ + "none", + "arrow" + ] + }, + "JSONCanvasNode": { + "anyOf": [ + { + "$ref": "#/definitions/JSONCanvasNodeType" + }, + { + "$ref": "#/definitions/JSONCanvasTextNode" + }, + { + "$ref": "#/definitions/JSONCanvasFileNode" + }, + { + "$ref": "#/definitions/JSONCanvasLinkNode" + }, + { + "$ref": "#/definitions/JSONCanvasGroupNode" + } + ] + }, + "JSONCanvasNodeType": { + "type": "object", "properties": { "color": { "$ref": "#/definitions/JSONCanvasColor" }, - "file": { - "type": "string" - }, "height": { "type": "number" }, "id": { "type": "string" }, - "subpath": { - "type": "string" - }, "type": { - "const": "file", - "type": "string" + "type": "string", + "enum": [ + "text", + "file", + "link", + "group" + ] }, "width": { "type": "number" @@ -105,19 +146,19 @@ "type": "number" } }, - "required": ["file", "height", "id", "type", "width", "x", "y"], - "type": "object" + "required": [ + "height", + "id", + "type", + "width", + "x", + "y" + ], + "additionalProperties": false }, - "JSONCanvasGroupNode": { - "additionalProperties": false, + "JSONCanvasTextNode": { + "type": "object", "properties": { - "background": { - "type": "string" - }, - "backgroundStyle": { - "enum": ["cover", "ratio", "repeat"], - "type": "string" - }, "color": { "$ref": "#/definitions/JSONCanvasColor" }, @@ -127,12 +168,12 @@ "id": { "type": "string" }, - "label": { + "text": { "type": "string" }, "type": { - "const": "group", - "type": "string" + "type": "string", + "const": "text" }, "width": { "type": "number" @@ -144,27 +185,38 @@ "type": "number" } }, - "required": ["height", "id", "type", "width", "x", "y"], - "type": "object" + "required": [ + "height", + "id", + "text", + "type", + "width", + "x", + "y" + ], + "additionalProperties": false }, - "JSONCanvasLinkNode": { - "additionalProperties": false, + "JSONCanvasFileNode": { + "type": "object", "properties": { "color": { "$ref": "#/definitions/JSONCanvasColor" }, + "file": { + "type": "string" + }, "height": { "type": "number" }, "id": { "type": "string" }, - "type": { - "const": "link", + "subpath": { "type": "string" }, - "url": { - "type": "string" + "type": { + "type": "string", + "const": "file" }, "width": { "type": "number" @@ -176,30 +228,19 @@ "type": "number" } }, - "required": ["height", "id", "type", "url", "width", "x", "y"], - "type": "object" + "required": [ + "file", + "height", + "id", + "type", + "width", + "x", + "y" + ], + "additionalProperties": false }, - "JSONCanvasNode": { - "anyOf": [ - { - "$ref": "#/definitions/JSONCanvasNodeType" - }, - { - "$ref": "#/definitions/JSONCanvasTextNode" - }, - { - "$ref": "#/definitions/JSONCanvasFileNode" - }, - { - "$ref": "#/definitions/JSONCanvasLinkNode" - }, - { - "$ref": "#/definitions/JSONCanvasGroupNode" - } - ] - }, - "JSONCanvasNodeType": { - "additionalProperties": false, + "JSONCanvasLinkNode": { + "type": "object", "properties": { "color": { "$ref": "#/definitions/JSONCanvasColor" @@ -211,7 +252,10 @@ "type": "string" }, "type": { - "enum": ["text", "file", "link", "group"], + "type": "string", + "const": "link" + }, + "url": { "type": "string" }, "width": { @@ -224,12 +268,31 @@ "type": "number" } }, - "required": ["id", "type", "x", "y", "width", "height"], - "type": "object" + "required": [ + "height", + "id", + "type", + "url", + "width", + "x", + "y" + ], + "additionalProperties": false }, - "JSONCanvasTextNode": { - "additionalProperties": false, + "JSONCanvasGroupNode": { + "type": "object", "properties": { + "background": { + "type": "string" + }, + "backgroundStyle": { + "type": "string", + "enum": [ + "cover", + "ratio", + "repeat" + ] + }, "color": { "$ref": "#/definitions/JSONCanvasColor" }, @@ -239,12 +302,12 @@ "id": { "type": "string" }, - "text": { + "label": { "type": "string" }, "type": { - "const": "text", - "type": "string" + "type": "string", + "const": "group" }, "width": { "type": "number" @@ -256,8 +319,15 @@ "type": "number" } }, - "required": ["height", "id", "text", "type", "width", "x", "y"], - "type": "object" + "required": [ + "height", + "id", + "type", + "width", + "x", + "y" + ], + "additionalProperties": false } } } From af6aae7b42b4262f5f2a17c8e20b28fdda8566aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:09:48 +0100 Subject: [PATCH 09/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 4742ed3..040c0ef 100644 --- a/schema.json +++ b/schema.json @@ -170,7 +170,7 @@ "type": "number" }, "x": { - "type": "number" + "type": "integer" }, "y": { "type": "number" From 6b0c297614a63e5c368d40387fdfb93cd8da0ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:09:54 +0100 Subject: [PATCH 10/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 040c0ef..bf7c0df 100644 --- a/schema.json +++ b/schema.json @@ -167,7 +167,7 @@ "type": "string" }, "width": { - "type": "number" + "type": "integer" }, "x": { "type": "integer" From f6dbc6a50385516b44d09fe7a616acf84a2e113f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:09:59 +0100 Subject: [PATCH 11/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index bf7c0df..f73bbc0 100644 --- a/schema.json +++ b/schema.json @@ -247,7 +247,7 @@ "type": "string" }, "width": { - "type": "number" + "type": "integer" }, "x": { "type": "number" From fd792acd4822122748db3ac5aef02e3248c00b8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:10:04 +0100 Subject: [PATCH 12/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index f73bbc0..50a3b0f 100644 --- a/schema.json +++ b/schema.json @@ -253,7 +253,7 @@ "type": "number" }, "y": { - "type": "number" + "type": "integer" } }, "required": ["height", "id", "text", "type", "width", "x", "y"], From f5c98f54e211f90952d5d8d4979920f8940a3afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:10:10 +0100 Subject: [PATCH 13/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 50a3b0f..c1758cc 100644 --- a/schema.json +++ b/schema.json @@ -1,5 +1,5 @@ { - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "https://json-schema.org/draft/2020-12/schema", "default": { "edges": [], "nodes": [] From de459f4c613aec6cc10b5decc98be724fbb0e218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:10:37 +0100 Subject: [PATCH 14/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 1 - 1 file changed, 1 deletion(-) diff --git a/schema.json b/schema.json index c1758cc..a3ee155 100644 --- a/schema.json +++ b/schema.json @@ -5,7 +5,6 @@ "nodes": [] }, "properties": { - "required": true, "edges": { "items": { "$ref": "#/definitions/JSONCanvasEdge" From 55e231473096382ce8ffdef8fe592be5cc2d55c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:10:41 +0100 Subject: [PATCH 15/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index a3ee155..388bbeb 100644 --- a/schema.json +++ b/schema.json @@ -249,7 +249,7 @@ "type": "integer" }, "x": { - "type": "number" + "type": "integer" }, "y": { "type": "integer" From f493d4ba04aa356c43a02410351b198f6c66bb83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 14:10:46 +0100 Subject: [PATCH 16/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 388bbeb..f1f9d56 100644 --- a/schema.json +++ b/schema.json @@ -233,7 +233,7 @@ "$ref": "#/definitions/JSONCanvasColor" }, "height": { - "type": "number" + "type": "integer" }, "id": { "type": "string" From b80ea589d668c7ccf302f731a5588fe24a449939 Mon Sep 17 00:00:00 2001 From: kguillouard Date: Fri, 15 Mar 2024 14:43:12 +0100 Subject: [PATCH 17/32] added description, change version --- sample.canvas | 1 + schema.json | 78 ++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 66 insertions(+), 13 deletions(-) diff --git a/sample.canvas b/sample.canvas index 24a5902..51ab7bf 100644 --- a/sample.canvas +++ b/sample.canvas @@ -1,4 +1,5 @@ { + "$schema": "./schema.json", "nodes":[ {"id":"8132d4d894c80022","type":"file","file":"readme.md","x":-280,"y":-200,"width":570,"height":560,"color":"6"}, {"id":"7efdbbe0c4742315","type":"file","file":"_site/logo.svg","x":-280,"y":-440,"width":217,"height":80}, diff --git a/schema.json b/schema.json index f1f9d56..6c5e780 100644 --- a/schema.json +++ b/schema.json @@ -6,23 +6,27 @@ }, "properties": { "edges": { + "description": "Edges are lines that connect one node to another", "items": { "$ref": "#/definitions/JSONCanvasEdge" }, "type": "array" }, "nodes": { + "description": "Nodes are objects within the canvas. Nodes may be text, files, links, or groups", "items": { "$ref": "#/definitions/JSONCanvasNode" }, "type": "array" } }, - "definitions": { + "$defs": { "JSONCanvasColor": { "anyOf": [ { - "type": "string" + "description": "A color in hex format, e.g. #ff0000", + "type": "string", + "pattern": "^#[0-9a-fA-F]{6}$" }, { "$ref": "#/definitions/JSONCanvasColorPreset" @@ -30,8 +34,10 @@ ] }, "JSONCanvasColorPreset": { - "enum": [1, 2, 3, 4, 5, 6], - "type": "number" + "title": "A preset color.", + "description": "Six preset colors exist, mapped to the following numbers:\n1 red\n2 orange\n3 yellow\n4 green\n5 cyan\n6 purple", + "enum": ["1", "2", "3", "4", "5", "6"], + "type": "string" }, "JSONCanvasEdge": { "additionalProperties": false, @@ -40,24 +46,30 @@ "$ref": "#/definitions/JSONCanvasColor" }, "fromNode": { + "description": "The ID of the node that the edge starts from", "type": "string" }, "fromSide": { + "description": "The side of the node that the edge connects from", "$ref": "#/definitions/JSONCanvasEdgeSide" }, "id": { + "description": "The ID for the edge", "type": "string" }, "label": { + "description": "The text label for the edge", "type": "string" }, "toEnd": { "$ref": "#/definitions/JSONCanvasEdgeEnd" }, "toNode": { + "description": "The ID of the node that the edge ends at", "type": "string" }, "toSide": { + "description": "The side of the node that the edge connects to", "$ref": "#/definitions/JSONCanvasEdgeSide" } }, @@ -65,10 +77,12 @@ "type": "object" }, "JSONCanvasEdgeEnd": { + "description": "The rendering style of the end of the edge line", "enum": ["none", "arrow"], "type": "string" }, "JSONCanvasEdgeSide": { + "description": "The side of the node that the edge connects to", "enum": ["top", "right", "bottom", "left"], "type": "string" }, @@ -79,28 +93,37 @@ "$ref": "#/definitions/JSONCanvasColor" }, "file": { - "type": "string" + "description": "The path to the file within the system", + "type": "string", + "minLength": 1 }, "height": { + "description": "The height of the node in pixels", "type": "number" }, "id": { + "description": "Unique ID for the node", "type": "string" }, "subpath": { + "description": "The subpath that may link to a heading or a block. Always starts with a #", "type": "string" }, "type": { + "description": "The node type", "const": "file", "type": "string" }, "width": { + "description": "The width of the node in pixels", "type": "number" }, "x": { + "description": "The x position of the node in pixels", "type": "number" }, "y": { + "description": "The y position of the node in pixels", "type": "number" } }, @@ -111,9 +134,12 @@ "additionalProperties": false, "properties": { "background": { + "description": "The path to the background image", "type": "string" }, "backgroundStyle": { + "title": "The rendering style of a background image.", + "description": "Options are:\ncover - fills the entire width and height of the node.\nratio - maintains the aspect ratio of the background image.\nrepeat - repeats the image as a pattern in both x/y directions.", "enum": ["cover", "ratio", "repeat"], "type": "string" }, @@ -121,25 +147,32 @@ "$ref": "#/definitions/JSONCanvasColor" }, "height": { + "description": "The height of the node in pixels", "type": "number" }, "id": { + "description": "Unique ID for the node", "type": "string" }, "label": { + "description": "The text label for the group", "type": "string" }, "type": { + "description": "The node type", "const": "group", "type": "string" }, "width": { + "description": "The width of the node in pixels", "type": "number" }, "x": { + "description": "The x position of the node in pixels", "type": "number" }, "y": { + "description": "The y position of the node in pixels", "type": "number" } }, @@ -153,12 +186,15 @@ "$ref": "#/definitions/JSONCanvasColor" }, "height": { + "description": "The height of the node in pixels", "type": "number" }, "id": { + "description": "Unique ID for the node", "type": "string" }, "type": { + "description": "The node type", "const": "link", "type": "string" }, @@ -166,12 +202,15 @@ "type": "string" }, "width": { - "type": "integer" + "description": "The width of the node in pixels", + "type": "number" }, "x": { - "type": "integer" + "description": "The x position of the node in pixels", + "type": "number" }, "y": { + "description": "The y position of the node in pixels", "type": "number" } }, @@ -181,7 +220,7 @@ "JSONCanvasNode": { "anyOf": [ { - "$ref": "#/definitions/JSONCanvasNodeType" + "$ref": "#/definitions/JSONCanvasNodeGeneric" }, { "$ref": "#/definitions/JSONCanvasTextNode" @@ -197,29 +236,35 @@ } ] }, - "JSONCanvasNodeType": { + "JSONCanvasNodeGeneric": { "additionalProperties": false, "properties": { "color": { "$ref": "#/definitions/JSONCanvasColor" }, "height": { + "description": "The height of the node in pixels", "type": "number" }, "id": { + "description": "Unique ID for the node", "type": "string" }, "type": { + "description": "The node type", "enum": ["text", "file", "link", "group"], "type": "string" }, "width": { + "description": "The width of the node in pixels", "type": "number" }, "x": { + "description": "The x position of the node in pixels", "type": "number" }, "y": { + "description": "The y position of the node in pixels", "type": "number" } }, @@ -233,26 +278,33 @@ "$ref": "#/definitions/JSONCanvasColor" }, "height": { - "type": "integer" + "description": "The height of the node in pixels", + "type": "number" }, "id": { + "description": "Unique ID for the node", "type": "string" }, "text": { + "description": "Plain text with Markdown syntax", "type": "string" }, "type": { + "description": "The node type", "const": "text", "type": "string" }, "width": { - "type": "integer" + "description": "The width of the node in pixels", + "type": "number" }, "x": { - "type": "integer" + "description": "The x position of the node in pixels", + "type": "number" }, "y": { - "type": "integer" + "description": "The y position of the node in pixels", + "type": "number" } }, "required": ["height", "id", "text", "type", "width", "x", "y"], From 706ed3bddbf416d985d5c29afebc684d649bc46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:20:45 +0100 Subject: [PATCH 18/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 6c5e780..aea76d1 100644 --- a/schema.json +++ b/schema.json @@ -99,7 +99,7 @@ }, "height": { "description": "The height of the node in pixels", - "type": "number" + "type": "integer" }, "id": { "description": "Unique ID for the node", From 32232e600cee594b2980f39cad80e3c71b36f4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:20:52 +0100 Subject: [PATCH 19/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index aea76d1..5e71d73 100644 --- a/schema.json +++ b/schema.json @@ -116,7 +116,7 @@ }, "width": { "description": "The width of the node in pixels", - "type": "number" + "type": "integer" }, "x": { "description": "The x position of the node in pixels", From 94474b04e6b27233d35ccdbdc7a18de509e2a7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:20:59 +0100 Subject: [PATCH 20/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 5e71d73..582b3da 100644 --- a/schema.json +++ b/schema.json @@ -124,7 +124,7 @@ }, "y": { "description": "The y position of the node in pixels", - "type": "number" + "type": "integer" } }, "required": ["file", "height", "id", "type", "width", "x", "y"], From f93ce4415c5af90faa23e03f0ae45263a36a1fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:04 +0100 Subject: [PATCH 21/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 582b3da..f854d12 100644 --- a/schema.json +++ b/schema.json @@ -120,7 +120,7 @@ }, "x": { "description": "The x position of the node in pixels", - "type": "number" + "type": "integer" }, "y": { "description": "The y position of the node in pixels", From 60f2520d40746c5c4ead4c5848a6639498de9484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:15 +0100 Subject: [PATCH 22/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index f854d12..6ecfce5 100644 --- a/schema.json +++ b/schema.json @@ -148,7 +148,7 @@ }, "height": { "description": "The height of the node in pixels", - "type": "number" + "type": "integer" }, "id": { "description": "Unique ID for the node", From 8977291629c8304dc69546779f776896bc36e0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:21 +0100 Subject: [PATCH 23/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 6ecfce5..1ce8b28 100644 --- a/schema.json +++ b/schema.json @@ -165,7 +165,7 @@ }, "width": { "description": "The width of the node in pixels", - "type": "number" + "type": "integer" }, "x": { "description": "The x position of the node in pixels", From 9fc0df4e955fcc463d35d8c680878863ed83826f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:27 +0100 Subject: [PATCH 24/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 1ce8b28..521a6f4 100644 --- a/schema.json +++ b/schema.json @@ -169,7 +169,7 @@ }, "x": { "description": "The x position of the node in pixels", - "type": "number" + "type": "integer" }, "y": { "description": "The y position of the node in pixels", From 084c303030a4e707031bb040cac5dd8b1b410720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:32 +0100 Subject: [PATCH 25/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 521a6f4..0b633ad 100644 --- a/schema.json +++ b/schema.json @@ -173,7 +173,7 @@ }, "y": { "description": "The y position of the node in pixels", - "type": "number" + "type": "integer" } }, "required": ["height", "id", "type", "width", "x", "y"], From 793c00f80e4b7ef0c07a2f4af4e9dba4dca93205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:37 +0100 Subject: [PATCH 26/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 0b633ad..1d5b47a 100644 --- a/schema.json +++ b/schema.json @@ -187,7 +187,7 @@ }, "height": { "description": "The height of the node in pixels", - "type": "number" + "type": "integer" }, "id": { "description": "Unique ID for the node", From b00b1bd3cccfd802362ca2b5c926596540f1376a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:42 +0100 Subject: [PATCH 27/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 1d5b47a..e2b4270 100644 --- a/schema.json +++ b/schema.json @@ -211,7 +211,7 @@ }, "y": { "description": "The y position of the node in pixels", - "type": "number" + "type": "integer" } }, "required": ["height", "id", "type", "url", "width", "x", "y"], From aee96d59f1f9cd9f1ca4668c264d2bdde5f83362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:48 +0100 Subject: [PATCH 28/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index e2b4270..2667152 100644 --- a/schema.json +++ b/schema.json @@ -244,7 +244,7 @@ }, "height": { "description": "The height of the node in pixels", - "type": "number" + "type": "integer" }, "id": { "description": "Unique ID for the node", From 9cfd89c50ebd8785eafbde1e7db785b2912e6902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:53 +0100 Subject: [PATCH 29/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index 2667152..c80360a 100644 --- a/schema.json +++ b/schema.json @@ -257,7 +257,7 @@ }, "width": { "description": "The width of the node in pixels", - "type": "number" + "type": "integer" }, "x": { "description": "The x position of the node in pixels", From 1c18b0228f82699af2f813abf822651d7dae298c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:21:58 +0100 Subject: [PATCH 30/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index c80360a..a1387c2 100644 --- a/schema.json +++ b/schema.json @@ -261,7 +261,7 @@ }, "x": { "description": "The x position of the node in pixels", - "type": "number" + "type": "integer" }, "y": { "description": "The y position of the node in pixels", From bbd03fb5d40cda131df254717107c574a68e3785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Guillouard?= Date: Fri, 15 Mar 2024 16:22:04 +0100 Subject: [PATCH 31/32] Update schema.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Mengué --- schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema.json b/schema.json index a1387c2..3a9f10c 100644 --- a/schema.json +++ b/schema.json @@ -265,7 +265,7 @@ }, "y": { "description": "The y position of the node in pixels", - "type": "number" + "type": "integer" } }, "required": ["id", "type", "x", "y", "width", "height"], From 3dd263203f8e967380172d72fcf0f59b8872c2d2 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Fri, 15 Mar 2024 16:25:17 +0000 Subject: [PATCH 32/32] Refactor color and node types in JSONCanvas --- jsoncanvas.schema.json | 89 +++++++++++++----------- src/index.ts | 149 ++++++++++++----------------------------- 2 files changed, 94 insertions(+), 144 deletions(-) diff --git a/jsoncanvas.schema.json b/jsoncanvas.schema.json index 42357ae..403b3f7 100644 --- a/jsoncanvas.schema.json +++ b/jsoncanvas.schema.json @@ -51,7 +51,8 @@ "description": "The text label for the edge" }, "toEnd": { - "$ref": "#/definitions/JSONCanvasEdgeEnd" + "$ref": "#/definitions/JSONCanvasEdgeEnd", + "description": "The rendering style of the end of the edge line" }, "toNode": { "type": "string", @@ -128,7 +129,8 @@ "type": "object", "properties": { "color": { - "$ref": "#/definitions/JSONCanvasColor" + "$ref": "#/definitions/JSONCanvasColor", + "description": "The color of the node" }, "height": { "type": "number", @@ -139,13 +141,7 @@ "description": "Unique ID for the node" }, "type": { - "type": "string", - "enum": [ - "text", - "file", - "link", - "group" - ], + "$ref": "#/definitions/NodeType", "description": "The node type" }, "width": { @@ -171,11 +167,21 @@ ], "additionalProperties": false }, + "NodeType": { + "type": "string", + "enum": [ + "text", + "file", + "link", + "group" + ] + }, "JSONCanvasTextNode": { "type": "object", "properties": { "color": { - "$ref": "#/definitions/JSONCanvasColor" + "$ref": "#/definitions/JSONCanvasColor", + "description": "The color of the node" }, "height": { "type": "number", @@ -185,10 +191,6 @@ "type": "string", "description": "Unique ID for the node" }, - "text": { - "type": "string", - "description": "Plain text with Markdown syntax" - }, "type": { "type": "string", "const": "text", @@ -205,6 +207,10 @@ "y": { "type": "number", "description": "The y position of the node in pixels" + }, + "text": { + "type": "string", + "description": "Plain text with Markdown syntax" } }, "required": [ @@ -222,11 +228,8 @@ "type": "object", "properties": { "color": { - "$ref": "#/definitions/JSONCanvasColor" - }, - "file": { - "type": "string", - "description": "The path to the file within the system" + "$ref": "#/definitions/JSONCanvasColor", + "description": "The color of the node" }, "height": { "type": "number", @@ -236,10 +239,6 @@ "type": "string", "description": "Unique ID for the node" }, - "subpath": { - "type": "string", - "description": "The subpath that may link to a heading or a block. Always starts with a #" - }, "type": { "type": "string", "const": "file", @@ -256,6 +255,14 @@ "y": { "type": "number", "description": "The y position of the node in pixels" + }, + "file": { + "type": "string", + "description": "The path to the file within the system" + }, + "subpath": { + "type": "string", + "description": "The subpath that may link to a heading or a block. Always starts with a #" } }, "required": [ @@ -273,7 +280,8 @@ "type": "object", "properties": { "color": { - "$ref": "#/definitions/JSONCanvasColor" + "$ref": "#/definitions/JSONCanvasColor", + "description": "The color of the node" }, "height": { "type": "number", @@ -288,9 +296,6 @@ "const": "link", "description": "The node type" }, - "url": { - "type": "string" - }, "width": { "type": "number", "description": "The width of the node in pixels" @@ -302,6 +307,10 @@ "y": { "type": "number", "description": "The y position of the node in pixels" + }, + "url": { + "type": "string", + "description": "The URL to link to" } }, "required": [ @@ -318,15 +327,9 @@ "JSONCanvasGroupNode": { "type": "object", "properties": { - "background": { - "type": "string", - "description": "The path to the background image" - }, - "backgroundStyle": { - "$ref": "#/definitions/TheRenderingStyleOfABackgroundImage" - }, "color": { - "$ref": "#/definitions/JSONCanvasColor" + "$ref": "#/definitions/JSONCanvasColor", + "description": "The color of the node" }, "height": { "type": "number", @@ -336,10 +339,6 @@ "type": "string", "description": "Unique ID for the node" }, - "label": { - "type": "string", - "description": "The text label for the group" - }, "type": { "type": "string", "const": "group", @@ -356,6 +355,18 @@ "y": { "type": "number", "description": "The y position of the node in pixels" + }, + "background": { + "type": "string", + "description": "The path to the background image" + }, + "backgroundStyle": { + "$ref": "#/definitions/TheRenderingStyleOfABackgroundImage", + "description": "The rendering style of the background image" + }, + "label": { + "type": "string", + "description": "The text label for the group" } }, "required": [ diff --git a/src/index.ts b/src/index.ts index ce8f42b..4bd96e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,17 +8,28 @@ export type JSONCanvasColor = string | APresetColor; * 5 cyan * 6 purple */ -export type APresetColor = "1" | "2" | "3" | "4" | "5" | "6"; +export const APresetColor = { + Red: "1", + Orange: "2", + Yellow: "3", + Green: "4", + Cyan: "5", + Purple: "6", +} as const; +export type APresetColor = (typeof APresetColor)[keyof typeof APresetColor]; + /** * The rendering style of the end of the edge line */ export type JSONCanvasEdgeEnd = "none" | "arrow"; + export type JSONCanvasNode = | JSONCanvasNodeGeneric | JSONCanvasTextNode | JSONCanvasFileNode | JSONCanvasLinkNode | JSONCanvasGroupNode; + /** * Options are: * cover - fills the entire width and height of the node. @@ -38,6 +49,8 @@ export interface JsonCanvas { nodes?: JSONCanvasNode[]; [k: string]: unknown; } +type Side = "top" | "right" | "bottom" | "left"; + export interface JSONCanvasEdge { color?: JSONCanvasColor; /** @@ -47,7 +60,7 @@ export interface JSONCanvasEdge { /** * The side of the node that the edge connects from */ - fromSide?: "top" | "right" | "bottom" | "left"; + fromSide?: Side; /** * The ID for the edge */ @@ -56,6 +69,9 @@ export interface JSONCanvasEdge { * The text label for the edge */ label?: string; + /** + * The rendering style of the end of the edge line + */ toEnd?: JSONCanvasEdgeEnd; /** * The ID of the node that the edge ends at @@ -64,9 +80,22 @@ export interface JSONCanvasEdge { /** * The side of the node that the edge connects to */ - toSide?: "top" | "right" | "bottom" | "left"; + toSide?: Side; } + +export const NodeType = { + Text: "text", + File: "file", + Link: "link", + Group: "group", +} as const; + +export type NodeType = (typeof NodeType)[keyof typeof NodeType]; + export interface JSONCanvasNodeGeneric { + /** + * The color of the node + */ color?: JSONCanvasColor; /** * The height of the node in pixels @@ -79,7 +108,7 @@ export interface JSONCanvasNodeGeneric { /** * The node type */ - type: "text" | "file" | "link" | "group"; + type: NodeType; /** * The width of the node in pixels */ @@ -93,133 +122,43 @@ export interface JSONCanvasNodeGeneric { */ y: number; } -export interface JSONCanvasTextNode { - color?: JSONCanvasColor; - /** - * The height of the node in pixels - */ - height: number; - /** - * Unique ID for the node - */ - id: string; +export interface JSONCanvasTextNode extends JSONCanvasNodeGeneric { + type: typeof NodeType.Text; /** * Plain text with Markdown syntax */ text: string; - /** - * The node type - */ - type: "text"; - /** - * The width of the node in pixels - */ - width: number; - /** - * The x position of the node in pixels - */ - x: number; - /** - * The y position of the node in pixels - */ - y: number; } -export interface JSONCanvasFileNode { - color?: JSONCanvasColor; +export interface JSONCanvasFileNode extends JSONCanvasNodeGeneric { + type: typeof NodeType.File; /** * The path to the file within the system */ file: string; - /** - * The height of the node in pixels - */ - height: number; - /** - * Unique ID for the node - */ - id: string; /** * The subpath that may link to a heading or a block. Always starts with a # */ subpath?: string; - /** - * The node type - */ - type: "file"; - /** - * The width of the node in pixels - */ - width: number; - /** - * The x position of the node in pixels - */ - x: number; - /** - * The y position of the node in pixels - */ - y: number; } -export interface JSONCanvasLinkNode { - color?: JSONCanvasColor; - /** - * The height of the node in pixels - */ - height: number; - /** - * Unique ID for the node - */ - id: string; +export interface JSONCanvasLinkNode extends JSONCanvasNodeGeneric { + type: typeof NodeType.Link; /** - * The node type + * The URL to link to */ - type: "link"; url: string; - /** - * The width of the node in pixels - */ - width: number; - /** - * The x position of the node in pixels - */ - x: number; - /** - * The y position of the node in pixels - */ - y: number; } -export interface JSONCanvasGroupNode { +export interface JSONCanvasGroupNode extends JSONCanvasNodeGeneric { + type: typeof NodeType.Group; /** * The path to the background image */ background?: string; - backgroundStyle?: TheRenderingStyleOfABackgroundImage; - color?: JSONCanvasColor; /** - * The height of the node in pixels + * The rendering style of the background image */ - height: number; - /** - * Unique ID for the node - */ - id: string; + backgroundStyle?: TheRenderingStyleOfABackgroundImage; /** * The text label for the group */ label?: string; - /** - * The node type - */ - type: "group"; - /** - * The width of the node in pixels - */ - width: number; - /** - * The x position of the node in pixels - */ - x: number; - /** - * The y position of the node in pixels - */ - y: number; }