tsondb 0.5.19 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/dist/src/bin/tsondb.js +1 -1
  2. package/dist/src/index.d.ts +1 -1
  3. package/dist/src/node/config.d.ts +20 -0
  4. package/dist/src/node/config.js +5 -0
  5. package/dist/src/node/index.d.ts +3 -2
  6. package/dist/src/node/index.js +13 -8
  7. package/dist/src/node/renderers/jsonschema/render.d.ts +1 -1
  8. package/dist/src/node/renderers/jsonschema/render.js +12 -7
  9. package/dist/src/node/renderers/ts/render.d.ts +1 -1
  10. package/dist/src/node/renderers/ts/render.js +12 -6
  11. package/dist/src/node/schema/Node.d.ts +100 -29
  12. package/dist/src/node/schema/Node.js +268 -61
  13. package/dist/src/node/schema/Schema.js +96 -1
  14. package/dist/src/node/schema/TypeParameter.d.ts +7 -9
  15. package/dist/src/node/schema/TypeParameter.js +7 -5
  16. package/dist/src/node/schema/declarations/Declaration.d.ts +10 -28
  17. package/dist/src/node/schema/declarations/Declaration.js +8 -110
  18. package/dist/src/node/schema/declarations/EntityDecl.d.ts +48 -48
  19. package/dist/src/node/schema/declarations/EntityDecl.js +15 -12
  20. package/dist/src/node/schema/declarations/EnumDecl.d.ts +14 -17
  21. package/dist/src/node/schema/declarations/EnumDecl.js +12 -12
  22. package/dist/src/node/schema/declarations/TypeAliasDecl.d.ts +8 -14
  23. package/dist/src/node/schema/declarations/TypeAliasDecl.js +10 -11
  24. package/dist/src/node/schema/index.d.ts +0 -2
  25. package/dist/src/node/schema/index.js +0 -1
  26. package/dist/src/node/schema/types/Type.d.ts +19 -42
  27. package/dist/src/node/schema/types/Type.js +29 -167
  28. package/dist/src/node/schema/types/generic/ArrayType.d.ts +5 -14
  29. package/dist/src/node/schema/types/generic/ArrayType.js +15 -20
  30. package/dist/src/node/schema/types/generic/EnumType.d.ts +5 -17
  31. package/dist/src/node/schema/types/generic/EnumType.js +12 -20
  32. package/dist/src/node/schema/types/generic/ObjectType.d.ts +5 -19
  33. package/dist/src/node/schema/types/generic/ObjectType.js +11 -15
  34. package/dist/src/node/schema/types/primitives/BooleanType.d.ts +7 -8
  35. package/dist/src/node/schema/types/primitives/BooleanType.js +5 -4
  36. package/dist/src/node/schema/types/primitives/DateType.d.ts +6 -8
  37. package/dist/src/node/schema/types/primitives/DateType.js +5 -4
  38. package/dist/src/node/schema/types/primitives/FloatType.d.ts +9 -21
  39. package/dist/src/node/schema/types/primitives/FloatType.js +5 -4
  40. package/dist/src/node/schema/types/primitives/IntegerType.d.ts +9 -21
  41. package/dist/src/node/schema/types/primitives/IntegerType.js +5 -4
  42. package/dist/src/node/schema/types/primitives/StringType.d.ts +6 -10
  43. package/dist/src/node/schema/types/primitives/StringType.js +5 -4
  44. package/dist/src/node/schema/types/references/ChildEntitiesType.d.ts +18 -0
  45. package/dist/src/node/schema/types/references/ChildEntitiesType.js +18 -0
  46. package/dist/src/node/schema/types/references/IncludeIdentifierType.d.ts +7 -13
  47. package/dist/src/node/schema/types/references/IncludeIdentifierType.js +12 -12
  48. package/dist/src/node/schema/types/references/NestedEntityMapType.d.ts +7 -17
  49. package/dist/src/node/schema/types/references/NestedEntityMapType.js +11 -13
  50. package/dist/src/node/schema/types/references/ReferenceIdentifierType.d.ts +4 -10
  51. package/dist/src/node/schema/types/references/ReferenceIdentifierType.js +3 -5
  52. package/dist/src/node/schema/types/references/TypeArgumentType.d.ts +5 -10
  53. package/dist/src/node/schema/types/references/TypeArgumentType.js +10 -5
  54. package/dist/src/node/server/api/declarations.js +24 -6
  55. package/dist/src/node/server/api/index.js +11 -0
  56. package/dist/src/node/server/api/instances.js +9 -6
  57. package/dist/src/node/server/index.d.ts +6 -1
  58. package/dist/src/node/server/index.js +7 -3
  59. package/dist/src/node/server/init.d.ts +2 -1
  60. package/dist/src/node/server/init.js +11 -11
  61. package/dist/src/node/server/utils/childInstances.d.ts +4 -0
  62. package/dist/src/node/server/utils/childInstances.js +41 -0
  63. package/dist/src/node/server/utils/instanceOperations.d.ts +8 -0
  64. package/dist/src/node/server/utils/instanceOperations.js +107 -0
  65. package/dist/src/node/server/utils/locales.d.ts +2 -0
  66. package/dist/src/node/server/utils/locales.js +8 -0
  67. package/dist/src/node/utils/childInstances.d.ts +32 -0
  68. package/dist/src/node/utils/childInstances.js +164 -0
  69. package/dist/src/node/utils/displayName.d.ts +2 -1
  70. package/dist/src/node/utils/displayName.js +5 -4
  71. package/dist/src/node/utils/files.d.ts +5 -0
  72. package/dist/src/node/utils/files.js +9 -0
  73. package/dist/src/node/utils/instanceOperations.d.ts +14 -0
  74. package/dist/src/node/utils/instanceOperations.js +88 -0
  75. package/dist/src/node/utils/instances.d.ts +1 -1
  76. package/dist/src/node/utils/instances.js +12 -6
  77. package/dist/src/node/utils/references.d.ts +3 -1
  78. package/dist/src/node/utils/references.js +43 -18
  79. package/dist/src/node/utils/referencesWorker.d.ts +5 -0
  80. package/dist/src/node/utils/referencesWorker.js +22 -0
  81. package/dist/src/node/utils/workers.d.ts +15 -0
  82. package/dist/src/node/utils/workers.js +90 -0
  83. package/dist/src/shared/api.d.ts +14 -1
  84. package/dist/src/shared/schema/Node.d.ts +63 -0
  85. package/dist/src/shared/schema/Node.js +128 -0
  86. package/dist/src/shared/schema/TypeParameter.d.ts +9 -0
  87. package/dist/src/shared/schema/TypeParameter.js +2 -0
  88. package/dist/src/shared/schema/declarations/Declaration.d.ts +21 -0
  89. package/dist/src/shared/schema/declarations/Declaration.js +4 -0
  90. package/dist/src/shared/schema/declarations/EntityDecl.d.ts +32 -0
  91. package/dist/src/shared/schema/declarations/EntityDecl.js +8 -0
  92. package/dist/src/shared/schema/declarations/EnumDecl.d.ts +11 -0
  93. package/dist/src/shared/schema/declarations/EnumDecl.js +9 -0
  94. package/dist/src/shared/schema/declarations/TypeAliasDecl.d.ts +11 -0
  95. package/dist/src/shared/schema/declarations/TypeAliasDecl.js +7 -0
  96. package/dist/src/shared/schema/types/ArrayType.d.ts +11 -0
  97. package/dist/src/shared/schema/types/ArrayType.js +8 -0
  98. package/dist/src/shared/schema/types/BooleanType.d.ts +7 -0
  99. package/dist/src/shared/schema/types/BooleanType.js +2 -0
  100. package/dist/src/shared/schema/types/ChildEntitiesType.d.ts +8 -0
  101. package/dist/src/shared/schema/types/ChildEntitiesType.js +2 -0
  102. package/dist/src/shared/schema/types/DateType.d.ts +8 -0
  103. package/dist/src/shared/schema/types/DateType.js +2 -0
  104. package/dist/src/shared/schema/types/EnumType.d.ts +14 -0
  105. package/dist/src/shared/schema/types/EnumType.js +28 -0
  106. package/dist/src/shared/schema/types/FloatType.d.ts +11 -0
  107. package/dist/src/shared/schema/types/FloatType.js +2 -0
  108. package/dist/src/shared/schema/types/IncludeIdentifierType.d.ts +11 -0
  109. package/dist/src/shared/schema/types/IncludeIdentifierType.js +13 -0
  110. package/dist/src/shared/schema/types/IntegerType.d.ts +11 -0
  111. package/dist/src/shared/schema/types/IntegerType.js +2 -0
  112. package/dist/src/shared/schema/types/NestedEntityMapType.d.ts +17 -0
  113. package/dist/src/shared/schema/types/NestedEntityMapType.js +14 -0
  114. package/dist/src/shared/schema/types/ObjectType.d.ts +19 -0
  115. package/dist/src/shared/schema/types/ObjectType.js +14 -0
  116. package/dist/src/shared/schema/types/ReferenceIdentifierType.d.ts +8 -0
  117. package/dist/src/shared/schema/types/ReferenceIdentifierType.js +2 -0
  118. package/dist/src/shared/schema/types/StringType.d.ts +10 -0
  119. package/dist/src/shared/schema/types/StringType.js +2 -0
  120. package/dist/src/shared/schema/types/Type.d.ts +20 -0
  121. package/dist/src/shared/schema/types/TypeArgumentType.d.ts +12 -0
  122. package/dist/src/shared/schema/types/TypeArgumentType.js +7 -0
  123. package/dist/src/shared/utils/array.d.ts +4 -0
  124. package/dist/src/shared/utils/array.js +30 -0
  125. package/dist/src/shared/utils/async.d.ts +8 -0
  126. package/dist/src/shared/utils/async.js +35 -0
  127. package/dist/src/shared/utils/compare.js +3 -3
  128. package/dist/src/shared/utils/displayName.d.ts +6 -2
  129. package/dist/src/shared/utils/displayName.js +21 -8
  130. package/dist/src/shared/utils/instances.d.ts +2 -3
  131. package/dist/src/shared/utils/instances.js +3 -1
  132. package/dist/src/shared/utils/markdown.d.ts +4 -0
  133. package/dist/src/shared/utils/markdown.js +91 -4
  134. package/dist/src/shared/utils/object.d.ts +2 -0
  135. package/dist/src/shared/utils/object.js +2 -0
  136. package/dist/src/shared/utils/result.d.ts +8 -2
  137. package/dist/src/shared/utils/result.js +1 -1
  138. package/dist/src/web/api/declarations.d.ts +26 -0
  139. package/dist/src/web/api/declarations.js +51 -0
  140. package/dist/src/web/api/git.d.ts +14 -0
  141. package/dist/src/web/api/git.js +20 -0
  142. package/dist/src/web/api/index.d.ts +1 -0
  143. package/dist/src/web/api/index.js +2 -0
  144. package/dist/src/web/api/instances.d.ts +2 -0
  145. package/dist/src/web/api/instances.js +2 -0
  146. package/dist/src/web/components/Git.js +19 -16
  147. package/dist/src/web/components/InstanceRouteSkeleton.d.ts +42 -0
  148. package/dist/src/web/components/InstanceRouteSkeleton.js +114 -0
  149. package/dist/src/web/components/Layout.js +3 -2
  150. package/dist/src/web/components/ModalDialog.d.ts +2 -0
  151. package/dist/src/web/components/ModalDialog.js +16 -0
  152. package/dist/src/web/components/Select.d.ts +1 -2
  153. package/dist/src/web/components/Settings.d.ts +2 -0
  154. package/dist/src/web/components/Settings.js +47 -0
  155. package/dist/src/web/components/typeInputs/ArrayTypeInput.d.ts +3 -11
  156. package/dist/src/web/components/typeInputs/ArrayTypeInput.js +5 -4
  157. package/dist/src/web/components/typeInputs/BooleanTypeInput.d.ts +3 -6
  158. package/dist/src/web/components/typeInputs/BooleanTypeInput.js +2 -2
  159. package/dist/src/web/components/typeInputs/ChildEntitiesTypeInput.d.ts +6 -0
  160. package/dist/src/web/components/typeInputs/ChildEntitiesTypeInput.js +27 -0
  161. package/dist/src/web/components/typeInputs/DateTypeInput.d.ts +3 -6
  162. package/dist/src/web/components/typeInputs/DateTypeInput.js +2 -2
  163. package/dist/src/web/components/typeInputs/EnumTypeInput.d.ts +3 -11
  164. package/dist/src/web/components/typeInputs/EnumTypeInput.js +55 -22
  165. package/dist/src/web/components/typeInputs/FloatTypeInput.d.ts +3 -6
  166. package/dist/src/web/components/typeInputs/FloatTypeInput.js +2 -2
  167. package/dist/src/web/components/typeInputs/GenericTypeArgumentIdentifierTypeInput.d.ts +3 -4
  168. package/dist/src/web/components/typeInputs/IncludeIdentifierTypeInput.d.ts +3 -11
  169. package/dist/src/web/components/typeInputs/IncludeIdentifierTypeInput.js +3 -2
  170. package/dist/src/web/components/typeInputs/IntegerTypeInput.d.ts +3 -6
  171. package/dist/src/web/components/typeInputs/IntegerTypeInput.js +2 -2
  172. package/dist/src/web/components/typeInputs/NestedEntityMapTypeInput.d.ts +3 -11
  173. package/dist/src/web/components/typeInputs/NestedEntityMapTypeInput.js +5 -4
  174. package/dist/src/web/components/typeInputs/ObjectTypeInput.d.ts +3 -11
  175. package/dist/src/web/components/typeInputs/ObjectTypeInput.js +8 -5
  176. package/dist/src/web/components/typeInputs/ReferenceIdentifierTypeInput.d.ts +3 -8
  177. package/dist/src/web/components/typeInputs/ReferenceIdentifierTypeInput.js +2 -2
  178. package/dist/src/web/components/typeInputs/StringTypeInput.d.ts +3 -6
  179. package/dist/src/web/components/typeInputs/StringTypeInput.js +3 -3
  180. package/dist/src/web/components/typeInputs/TypeInput.d.ts +12 -4
  181. package/dist/src/web/components/typeInputs/TypeInput.js +22 -17
  182. package/dist/src/web/components/typeInputs/utils/ValidationErrors.d.ts +1 -0
  183. package/dist/src/web/components/typeInputs/utils/ValidationErrors.js +1 -3
  184. package/dist/src/web/context/config.d.ts +11 -0
  185. package/dist/src/web/context/config.js +6 -0
  186. package/dist/src/web/context/entities.d.ts +8 -5
  187. package/dist/src/web/context/entities.js +1 -1
  188. package/dist/src/web/context/settings.d.ts +8 -0
  189. package/dist/src/web/context/settings.js +10 -0
  190. package/dist/src/web/hooks/useEntityFromRoute.d.ts +1 -1
  191. package/dist/src/web/hooks/useEntityFromRoute.js +2 -2
  192. package/dist/src/web/hooks/useInstanceNamesByEntity.d.ts +1 -1
  193. package/dist/src/web/hooks/useInstanceNamesByEntity.js +4 -2
  194. package/dist/src/web/hooks/useMappedAPIResource.js +2 -4
  195. package/dist/src/web/hooks/useSecondaryDeclarations.d.ts +1 -1
  196. package/dist/src/web/hooks/useSecondaryDeclarations.js +8 -4
  197. package/dist/src/web/hooks/useSettings.d.ts +10 -0
  198. package/dist/src/web/hooks/useSettings.js +51 -0
  199. package/dist/src/web/index.js +11 -5
  200. package/dist/src/web/routes/CreateInstance.js +40 -79
  201. package/dist/src/web/routes/Entity.js +42 -19
  202. package/dist/src/web/routes/Home.js +24 -5
  203. package/dist/src/web/routes/Instance.js +34 -85
  204. package/dist/src/web/utils/InlineMarkdown.d.ts +1 -1
  205. package/dist/src/web/utils/InlineMarkdown.js +13 -1
  206. package/dist/src/web/utils/api.d.ts +25 -0
  207. package/dist/src/web/utils/api.js +34 -0
  208. package/dist/src/web/utils/typeSkeleton.d.ts +1 -1
  209. package/dist/src/web/utils/typeSkeleton.js +2 -0
  210. package/package.json +14 -13
  211. package/public/css/styles.css +171 -12
  212. package/dist/src/node/schema/types/primitives/NumericType.d.ts +0 -6
  213. package/dist/src/node/schema/types/primitives/NumericType.js +0 -2
  214. package/dist/src/node/schema/types/primitives/PrimitiveType.d.ts +0 -6
  215. package/dist/src/node/schema/validation/type.d.ts +0 -4
  216. package/dist/src/node/schema/validation/type.js +0 -1
  217. package/dist/src/node/server/api/instanceOperations.d.ts +0 -6
  218. package/dist/src/node/server/api/instanceOperations.js +0 -93
  219. package/dist/src/shared/config.d.ts +0 -11
  220. package/dist/src/shared/config.js +0 -1
  221. package/dist/src/web/api.d.ts +0 -24
  222. package/dist/src/web/api.js +0 -201
  223. /package/dist/src/{node/schema/types/primitives/PrimitiveType.js → shared/schema/types/Type.js} +0 -0
@@ -0,0 +1,25 @@
1
+ export declare const getResource: <R>(url: string, options: {
2
+ locales: string[];
3
+ modifyUrl?: (url: URL) => void;
4
+ getResult?: (response: Response) => Promise<R>;
5
+ }) => Promise<R>;
6
+ export declare const postResource: <R = void>(url: string, options: {
7
+ locales: string[];
8
+ body?: unknown;
9
+ headers?: HeadersInit;
10
+ modifyUrl?: (url: URL) => void;
11
+ getResult?: (response: Response) => Promise<R>;
12
+ }) => Promise<R>;
13
+ export declare const putResource: <R = void>(url: string, options: {
14
+ locales: string[];
15
+ body?: unknown;
16
+ headers?: HeadersInit;
17
+ modifyUrl?: (url: URL) => void;
18
+ getResult?: (response: Response) => Promise<R>;
19
+ }) => Promise<R>;
20
+ export declare const deleteResource: <R = void>(url: string, options: {
21
+ locales: string[];
22
+ headers?: HeadersInit;
23
+ modifyUrl?: (url: URL) => void;
24
+ getResult?: (response: Response) => Promise<R>;
25
+ }) => Promise<R>;
@@ -0,0 +1,34 @@
1
+ const request = async (method, url, options) => {
2
+ const resolvedUrl = new URL(url, window.location.origin);
3
+ for (const locale of options.locales) {
4
+ resolvedUrl.searchParams.append("locales", locale);
5
+ }
6
+ if (options.modifyUrl) {
7
+ options.modifyUrl(resolvedUrl);
8
+ }
9
+ const headers = new Headers(options.headers);
10
+ if (options.body && !headers.has("Content-Type")) {
11
+ headers.append("Content-Type", "application/json");
12
+ }
13
+ const response = await fetch(resolvedUrl, {
14
+ method: method,
15
+ body: options.body ? JSON.stringify(options.body) : undefined,
16
+ headers,
17
+ });
18
+ if (!response.ok) {
19
+ throw new Error(await response.text());
20
+ }
21
+ return (options.getResult ??
22
+ (response => {
23
+ if (response.headers.get("Content-Type")?.startsWith("application/json") === true) {
24
+ return response.json();
25
+ }
26
+ else {
27
+ return Promise.resolve();
28
+ }
29
+ }))(response);
30
+ };
31
+ export const getResource = async (url, options) => request("GET", url, options);
32
+ export const postResource = async (url, options) => request("POST", url, options);
33
+ export const putResource = async (url, options) => request("PUT", url, options);
34
+ export const deleteResource = async (url, options) => request("DELETE", url, options);
@@ -1,3 +1,3 @@
1
- import type { SerializedType } from "../../node/schema/types/Type.ts";
1
+ import type { SerializedType } from "../../shared/schema/types/Type.ts";
2
2
  import type { GetDeclFromDeclName } from "../hooks/useSecondaryDeclarations.ts";
3
3
  export declare const createTypeSkeleton: (getDeclFromDeclName: GetDeclFromDeclName, type: SerializedType) => unknown;
@@ -42,6 +42,8 @@ export const createTypeSkeleton = (getDeclFromDeclName, type) => {
42
42
  : { [firstCase[0]]: createTypeSkeleton(getDeclFromDeclName, firstCase[1].type) }),
43
43
  };
44
44
  }
45
+ case "ChildEntitiesType":
46
+ return [];
45
47
  default:
46
48
  return assertExhaustive(type);
47
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsondb",
3
- "version": "0.5.19",
3
+ "version": "0.6.1",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Lukas Obermann",
@@ -15,6 +15,7 @@
15
15
  "main": "dist/src/index.js",
16
16
  "exports": {
17
17
  ".": "./dist/src/index.js",
18
+ "./config": "./dist/src/node/config.js",
18
19
  "./renderer/jsonschema": "./dist/src/node/renderers/jsonschema/index.js",
19
20
  "./renderer/ts": "./dist/src/node/renderers/ts/index.js",
20
21
  "./schema": "./dist/src/node/schema/Schema.js",
@@ -31,26 +32,26 @@
31
32
  "release:sign": "commit-and-tag-version --sign --signoff"
32
33
  },
33
34
  "devDependencies": {
34
- "@eslint/js": "^9.35.0",
35
+ "@eslint/js": "^9.36.0",
35
36
  "@types/debug": "^4.1.12",
36
37
  "@types/express": "^5.0.3",
37
- "@types/node": "^24.3.1",
38
+ "@types/node": "^24.6.2",
38
39
  "commit-and-tag-version": "^12.6.0",
39
- "eslint": "^9.35.0",
40
+ "eslint": "^9.36.0",
40
41
  "eslint-plugin-react": "^7.37.5",
41
- "eslint-plugin-react-hooks": "^5.2.0",
42
- "globals": "^16.3.0",
42
+ "eslint-plugin-react-hooks": "^6.1.0",
43
+ "globals": "^16.4.0",
43
44
  "prettier": "^3.6.2",
44
- "tsx": "^4.20.5",
45
- "typescript": "^5.9.2",
46
- "typescript-eslint": "^8.43.0"
45
+ "tsx": "^4.20.6",
46
+ "typescript": "^5.9.3",
47
+ "typescript-eslint": "^8.45.0"
47
48
  },
48
49
  "dependencies": {
49
- "debug": "^4.4.1",
50
+ "debug": "^4.4.3",
50
51
  "express": "^5.1.0",
51
- "preact": "^10.27.1",
52
- "preact-iso": "^2.10.0",
53
- "simple-cli-args": "^0.1.2",
52
+ "preact": "^10.27.2",
53
+ "preact-iso": "^2.11.0",
54
+ "simple-cli-args": "^0.1.3",
54
55
  "simple-git": "^3.28.0",
55
56
  "uuid": "^13.0.0"
56
57
  },
@@ -37,6 +37,7 @@
37
37
  --highlight-color: #a08500;
38
38
  --highlight-background: #fdfab9;
39
39
  --disabled-color: #cdced2;
40
+ --shadow-color: rgba(53, 56, 58, 0.5);
40
41
  --git-status-untracked-color: rgb(13, 149, 101);
41
42
  --git-status-untracked-background: rgba(13, 149, 101, 0.15);
42
43
  --git-status-added-color: rgb(20, 148, 29);
@@ -52,6 +53,7 @@
52
53
  --highlight-color-italic: rgb(41, 155, 96);
53
54
  --highlight-color-list-item-marker: rgb(195, 58, 237);
54
55
  --highlight-color-table-marker: rgb(237, 58, 118);
56
+ --highlight-color-attributed: rgb(48, 81, 228);
55
57
  }
56
58
 
57
59
  @media (prefers-color-scheme: dark) {
@@ -84,6 +86,8 @@
84
86
  --highlight-color-italic: rgb(130, 230, 178);
85
87
  --highlight-color-list-item-marker: rgb(220, 133, 245);
86
88
  --highlight-color-table-marker: rgb(244, 135, 171);
89
+ --highlight-color-attributed: rgb(137, 157, 244);
90
+ --shadow-color: rgba(0, 0, 0, 0);
87
91
  }
88
92
  }
89
93
 
@@ -99,8 +103,8 @@ body {
99
103
 
100
104
  #app {
101
105
  display: grid;
102
- grid-template-columns: 1fr auto;
103
- grid-template-areas: "header aside" "main main";
106
+ grid-template-columns: 1fr;
107
+ grid-template-areas: "header" "main" "aside";
104
108
  gap: 0 1rem;
105
109
  }
106
110
 
@@ -164,6 +168,16 @@ h2.h1-faded {
164
168
  color: var(--tertiary-color);
165
169
  }
166
170
 
171
+ h3 {
172
+ margin: 1.6rem 0 0.75rem;
173
+ font-size: 1.25rem;
174
+ line-height: 1.2;
175
+ }
176
+
177
+ p {
178
+ margin: 0.5rem 0;
179
+ }
180
+
167
181
  a {
168
182
  color: var(--color);
169
183
  }
@@ -228,6 +242,7 @@ button.destructive:hover {
228
242
  color: var(--button-color-destructive-hover);
229
243
  }
230
244
 
245
+ a.btn[aria-disabled="true"],
231
246
  button:disabled {
232
247
  background: var(--button-background-disabled);
233
248
  color: var(--button-color-disabled);
@@ -257,9 +272,16 @@ select,
257
272
  border-radius: 0;
258
273
  }
259
274
 
260
- input[aria-invalid="true"],
261
- textarea[aria-invalid="true"],
262
- select[aria-invalid="true"] {
275
+ input:disabled,
276
+ textarea:disabled,
277
+ select:disabled {
278
+ border-color: var(--disabled-color);
279
+ color: var(--disabled-color);
280
+ }
281
+
282
+ input[aria-invalid="true"]:not(:disabled),
283
+ textarea[aria-invalid="true"]:not(:disabled),
284
+ select[aria-invalid="true"]:not(:disabled) {
263
285
  border-color: var(--error-color);
264
286
  color: var(--error-color);
265
287
  }
@@ -285,7 +307,7 @@ select[aria-invalid="true"] {
285
307
  grid-area: 1 / 1 / 2 / 2;
286
308
  }
287
309
 
288
- input[type="checkbox"] {
310
+ :is(input[type="checkbox"], input[type="radio"]) {
289
311
  height: 1rem;
290
312
  width: 1rem;
291
313
  margin: 0.25rem 0.5rem 0 0;
@@ -296,13 +318,28 @@ input[type="checkbox"] {
296
318
  appearance: none;
297
319
  }
298
320
 
299
- input[type="checkbox"]:checked {
321
+ :is(input[type="checkbox"], input[type="radio"]):disabled {
322
+ border-color: var(--disabled-color);
323
+ }
324
+
325
+ input[type="radio"] {
326
+ border-radius: 50%;
327
+ }
328
+
329
+ :is(input[type="checkbox"], input[type="radio"]):checked {
300
330
  background: var(--color);
301
331
  }
302
332
 
303
- input[type="checkbox"]:checked::before {
333
+ :is(input[type="checkbox"], input[type="radio"]):checked:disabled {
334
+ background: var(--disabled-color);
335
+ }
336
+
337
+ :is(input[type="checkbox"], input[type="radio"]):checked::before {
304
338
  content: "";
305
339
  display: block;
340
+ }
341
+
342
+ input[type="checkbox"]:checked::before {
306
343
  border-width: 0 0 0.125rem 0.125rem;
307
344
  border-style: solid;
308
345
  width: 0.8rem;
@@ -312,6 +349,35 @@ input[type="checkbox"]:checked::before {
312
349
  margin: calc(-0.325rem) 0 0 calc(-0.4rem);
313
350
  }
314
351
 
352
+ input[type="radio"]:checked::before {
353
+ width: 0.5rem;
354
+ height: 0.5rem;
355
+ background-color: var(--background);
356
+ border-radius: 50%;
357
+ margin: -0.25rem;
358
+ }
359
+
360
+ :is(input[type="checkbox"], input[type="radio"]) + * {
361
+ margin-top: 0.1rem;
362
+ }
363
+
364
+ :is(input[type="checkbox"], input[type="radio"]):disabled + label,
365
+ :is(input[type="checkbox"], input[type="radio"]):disabled + * label {
366
+ color: var(--disabled-color);
367
+ }
368
+
369
+ .field--option {
370
+ display: flex;
371
+ }
372
+
373
+ .field--option > :not(input) {
374
+ flex: 1 1 0;
375
+ }
376
+
377
+ .field--option + .field--option {
378
+ margin-top: 0.5rem;
379
+ }
380
+
315
381
  .select-wrapper {
316
382
  position: relative;
317
383
  }
@@ -373,6 +439,25 @@ select {
373
439
  align-items: center;
374
440
  }
375
441
 
442
+ .entry-groups {
443
+ list-style-type: " ";
444
+ padding: 0;
445
+ margin: 1.5rem 0 0;
446
+ }
447
+
448
+ .entry-groups-item {
449
+ padding: 0;
450
+ margin: 2rem 0 0;
451
+ }
452
+
453
+ .entry-groups-item__title {
454
+ margin: 0;
455
+ }
456
+
457
+ .entry-groups-item .entries {
458
+ margin: 1rem 0 0;
459
+ }
460
+
376
461
  .entries {
377
462
  list-style-type: " ";
378
463
  padding: 0;
@@ -514,6 +599,14 @@ select {
514
599
  padding: 0.5rem 0.5rem 0.5rem 1rem;
515
600
  }
516
601
 
602
+ .field--container.field--disabled {
603
+ color: var(--disabled-color);
604
+ }
605
+
606
+ .field--container.field--disabled .comment {
607
+ color: var(--disabled-color);
608
+ }
609
+
517
610
  form > .field--container {
518
611
  padding: 0;
519
612
  border: none;
@@ -528,8 +621,7 @@ form > .field--container {
528
621
 
529
622
  .field--container > ul > li,
530
623
  .field--container > ol > li {
531
- padding-top: 0.5rem;
532
- padding-bottom: 0.75rem;
624
+ padding-block: 0.5rem;
533
625
  border-top: 1px solid var(--separator-color);
534
626
  display: block;
535
627
  }
@@ -590,12 +682,35 @@ form > .field--container {
590
682
  color: var(--highlight-color-table-marker);
591
683
  }
592
684
 
685
+ .preview .attributed {
686
+ text-decoration-line: underline;
687
+ text-decoration-style: dashed;
688
+ text-decoration-color: var(--highlight-color-attributed);
689
+ }
690
+
691
+ .editor-highlighting .attributed {
692
+ color: var(--highlight-color-attributed);
693
+ }
694
+
695
+ .editor-highlighting .attributed__name {
696
+ font-weight: 700;
697
+ }
698
+
699
+ .editor-highlighting .attributed__value {
700
+ font-style: italic;
701
+ }
702
+
593
703
  .help {
594
704
  font-size: 0.8rem;
595
705
  color: var(--secondary-color);
596
706
  margin: 0.25rem 0 0;
597
707
  }
598
708
 
709
+ :disabled + .help,
710
+ :disabled + .help a {
711
+ color: var(--disabled-color);
712
+ }
713
+
599
714
  .field--string .preview {
600
715
  padding: 1rem;
601
716
  background: var(--markdown-background);
@@ -684,7 +799,10 @@ button[type="submit"] {
684
799
 
685
800
  .description {
686
801
  color: var(--secondary-color);
687
- margin: 0 0 3rem;
802
+ }
803
+
804
+ :is(.header-with-btns, h1) + .description {
805
+ margin-bottom: 3rem;
688
806
  }
689
807
 
690
808
  .comment {
@@ -756,7 +874,6 @@ main:has(.form-footer) {
756
874
  }
757
875
 
758
876
  aside.git {
759
- max-width: 30rem;
760
877
  grid-area: aside;
761
878
  }
762
879
 
@@ -766,6 +883,7 @@ aside.git h2 {
766
883
 
767
884
  @media (min-width: 80rem) {
768
885
  aside.git {
886
+ width: 30rem;
769
887
  border-left: 1px solid var(--separator-color);
770
888
  padding-left: 1rem;
771
889
  }
@@ -877,3 +995,44 @@ aside.git .branch .select-wrapper {
877
995
  .git-overlay.git-overlay--open {
878
996
  display: block;
879
997
  }
998
+
999
+ dialog {
1000
+ background: var(--background);
1001
+ color: var(--color);
1002
+ border: none;
1003
+ box-shadow: 0 0.5rem 2rem var(--shadow-color);
1004
+ padding: 1.6rem 1.5rem;
1005
+ max-height: calc(100% - 2rem);
1006
+ max-width: calc(100% - 2rem);
1007
+ }
1008
+
1009
+ dialog::backdrop {
1010
+ background: rgba(0, 0, 0, 0.5);
1011
+ }
1012
+
1013
+ dialog header :is(h1, h2, h3, h4, h5, h6) {
1014
+ margin: 0;
1015
+ }
1016
+
1017
+ dialog.settings {
1018
+ max-width: min(calc(100% - 2rem), 36rem);
1019
+ }
1020
+
1021
+ dialog.settings section.locale-settings ol {
1022
+ padding: 0 0 0 1.5rem;
1023
+ margin: 1rem 0;
1024
+ }
1025
+
1026
+ dialog.settings section.locale-settings ol li:not(:first-child) {
1027
+ margin-top: 0.5rem;
1028
+ }
1029
+
1030
+ .locale-content {
1031
+ display: flex;
1032
+ gap: 0.25rem;
1033
+ align-items: center;
1034
+ }
1035
+
1036
+ .locale-content span {
1037
+ flex: 1 1 0;
1038
+ }
@@ -1,6 +0,0 @@
1
- import type { FloatType, SerializedFloatType } from "./FloatType.ts";
2
- import type { IntegerType, SerializedIntegerType } from "./IntegerType.ts";
3
- export type NumericType = FloatType | IntegerType;
4
- export type SerializedNumericType = SerializedFloatType | SerializedIntegerType;
5
- export * from "./FloatType.ts";
6
- export * from "./IntegerType.ts";
@@ -1,2 +0,0 @@
1
- export * from "./FloatType.js";
2
- export * from "./IntegerType.js";
@@ -1,6 +0,0 @@
1
- import type { BooleanType, SerializedBooleanType } from "./BooleanType.ts";
2
- import type { DateType, SerializedDateType } from "./DateType.ts";
3
- import type { NumericType, SerializedNumericType } from "./NumericType.ts";
4
- import type { SerializedStringType, StringType } from "./StringType.ts";
5
- export type PrimitiveType = BooleanType | DateType | NumericType | StringType;
6
- export type SerializedPrimitiveType = SerializedBooleanType | SerializedDateType | SerializedNumericType | SerializedStringType;
@@ -1,4 +0,0 @@
1
- import type { Validators } from "../Node.ts";
2
- import type { Type } from "../types/Type.ts";
3
- export type ValidatorHelpers = Validators;
4
- export type Validator<T extends Type, Args extends unknown[] = []> = (helpers: ValidatorHelpers, type: T, value: unknown, ...args: Args) => Error[];
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import type { InstanceContainer } from "../../../shared/utils/instances.ts";
2
- import type { Result } from "../../../shared/utils/result.ts";
3
- import type { TSONDBRequestLocals } from "../index.ts";
4
- export declare const createInstance: (locals: TSONDBRequestLocals, entityName: string, instance: unknown, idQueryParam: unknown) => Promise<Result<InstanceContainer, [code: number, message: string]>>;
5
- export declare const updateInstance: (locals: TSONDBRequestLocals, entityName: string, instanceId: string, instance: unknown) => Promise<Result<InstanceContainer, [code: number, message: string]>>;
6
- export declare const deleteInstance: (locals: TSONDBRequestLocals, entityName: string, instanceId: string) => Promise<Result<InstanceContainer, [code: number, message: string]>>;
@@ -1,93 +0,0 @@
1
- import { rm, writeFile } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { v4 as uuidv4 } from "uuid";
4
- import { removeAt } from "../../../shared/utils/array.js";
5
- import { error, ok } from "../../../shared/utils/result.js";
6
- import { validateEntityDecl } from "../../schema/declarations/EntityDecl.js";
7
- import { createValidators } from "../../schema/Node.js";
8
- import { getErrorMessageForDisplay } from "../../utils/error.js";
9
- import { getGitFileStatusFromStatusResult } from "../../utils/git.js";
10
- import { formatInstance } from "../../utils/instances.js";
11
- import { updateReferencesToInstances } from "../../utils/references.js";
12
- export const createInstance = async (locals, entityName, instance, idQueryParam) => {
13
- const entity = locals.entitiesByName[entityName];
14
- if (entity === undefined) {
15
- return error([400, "Entity not found"]);
16
- }
17
- const validationErrors = validateEntityDecl(createValidators(locals.instancesByEntityName, false), entity, instance);
18
- if (validationErrors.length > 0) {
19
- return error([400, validationErrors.map(getErrorMessageForDisplay).join("\n\n")]);
20
- }
21
- if (locals.localeEntity === entity && typeof idQueryParam !== "string") {
22
- return error([400, "Missing id for locale entity"]);
23
- }
24
- const id = locals.localeEntity === entity ? idQueryParam : uuidv4();
25
- if (locals.localeEntity === entity &&
26
- locals.instancesByEntityName[entity.name]?.some(instance => instance.id === id)) {
27
- return error([400, `Duplicate id "${id}" for locale entity`]);
28
- }
29
- const fileName = `${id}.json`;
30
- await writeFile(join(locals.dataRoot, entity.name, fileName), formatInstance(entity, instance), {
31
- encoding: "utf-8",
32
- });
33
- const instanceContainer = {
34
- fileName,
35
- id,
36
- content: instance,
37
- gitStatus: locals.gitRoot === undefined
38
- ? undefined
39
- : getGitFileStatusFromStatusResult(await locals.git.status(), locals.gitRoot, locals.dataRoot, entity.name, fileName),
40
- };
41
- locals.instancesByEntityName[entity.name] = [
42
- ...(locals.instancesByEntityName[entity.name] ?? []),
43
- instanceContainer,
44
- ];
45
- Object.assign(locals.referencesToInstances, updateReferencesToInstances(locals.entitiesByName, locals.referencesToInstances, entity.name, id, undefined, instance));
46
- return ok(instanceContainer);
47
- };
48
- export const updateInstance = async (locals, entityName, instanceId, instance) => {
49
- const instanceContainer = locals.instancesByEntityName[entityName]?.find(instance => instance.id === instanceId);
50
- if (instanceContainer === undefined) {
51
- return error([404, "Instance not found"]);
52
- }
53
- const entity = locals.entitiesByName[entityName];
54
- if (entity === undefined) {
55
- return error([400, "Entity not found"]);
56
- }
57
- const validationErrors = validateEntityDecl(createValidators(locals.instancesByEntityName, false), entity, instance);
58
- if (validationErrors.length > 0) {
59
- return error([400, validationErrors.map(getErrorMessageForDisplay).join("\n\n")]);
60
- }
61
- await writeFile(join(locals.dataRoot, entity.name, instanceContainer.fileName), formatInstance(entity, instance), { encoding: "utf-8" });
62
- const oldInstance = instanceContainer.content;
63
- instanceContainer.content = instance;
64
- instanceContainer.gitStatus =
65
- locals.gitRoot === undefined
66
- ? undefined
67
- : getGitFileStatusFromStatusResult(await locals.git.status(), locals.gitRoot, locals.dataRoot, entity.name, instanceContainer.fileName);
68
- Object.assign(locals.referencesToInstances, updateReferencesToInstances(locals.entitiesByName, locals.referencesToInstances, entity.name, instanceId, oldInstance, instance));
69
- return ok(instanceContainer);
70
- };
71
- export const deleteInstance = async (locals, entityName, instanceId) => {
72
- const instances = locals.instancesByEntityName[entityName] ?? [];
73
- const instanceContainerIndex = instances.findIndex(instance => instance.id === instanceId);
74
- const instanceContainer = instances[instanceContainerIndex];
75
- if (instanceContainer === undefined) {
76
- return error([404, "Instance not found"]);
77
- }
78
- if (locals.referencesToInstances[instanceId]?.some(ref => ref !== instanceId)) {
79
- return error([400, "Cannot delete instance that is referenced by other instances"]);
80
- }
81
- try {
82
- await rm(join(locals.dataRoot, entityName, instanceContainer.fileName));
83
- locals.instancesByEntityName[entityName] = removeAt(instances, instanceContainerIndex);
84
- Object.assign(locals.referencesToInstances, updateReferencesToInstances(locals.entitiesByName, locals.referencesToInstances, entityName, instanceId, instanceContainer.content, undefined));
85
- return ok(instanceContainer);
86
- }
87
- catch (err) {
88
- return error([
89
- 500,
90
- `Failed to delete instance: ${err instanceof Error ? err.toString() : String(err)}`,
91
- ]);
92
- }
93
- };
@@ -1,11 +0,0 @@
1
- import type { Schema } from "../node/schema/Schema.ts";
2
- import type { Output } from "./output.ts";
3
- export type Config = {
4
- serverOptions?: ServerOptions;
5
- schema: Schema;
6
- outputs: Output[];
7
- dataRootPath: string;
8
- };
9
- export type ServerOptions = {
10
- port: number;
11
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import type { SerializedEntityDecl } from "../node/schema/declarations/EntityDecl.ts";
2
- import type { CreateInstanceOfEntityResponseBody, DeleteInstanceOfEntityResponseBody, GetAllDeclarationsResponseBody, GetAllGitBranchesResponseBody, GetAllInstancesOfEntityResponseBody, GetAllInstancesResponseBody, GetDeclarationResponseBody, GetInstanceOfEntityResponseBody, GitStatusResponseBody, UpdateInstanceOfEntityResponseBody } from "../shared/api.ts";
3
- export declare const getAllDeclarations: (kind?: "Entity" | "Enum" | "TypeAlias") => Promise<GetAllDeclarationsResponseBody>;
4
- export declare const getAllEntities: () => Promise<GetAllDeclarationsResponseBody<SerializedEntityDecl>>;
5
- export declare const getEntityByName: (name: string) => Promise<GetDeclarationResponseBody<SerializedEntityDecl>>;
6
- export declare const getInstancesByEntityName: (name: string) => Promise<GetAllInstancesOfEntityResponseBody>;
7
- export declare const createInstanceByEntityNameAndId: (name: string, content: unknown, id?: string) => Promise<CreateInstanceOfEntityResponseBody>;
8
- export declare const getInstanceByEntityNameAndId: (name: string, id: string) => Promise<GetInstanceOfEntityResponseBody>;
9
- export declare const updateInstanceByEntityNameAndId: (name: string, id: string, content: unknown) => Promise<UpdateInstanceOfEntityResponseBody>;
10
- export declare const deleteInstanceByEntityNameAndId: (name: string, id: string) => Promise<DeleteInstanceOfEntityResponseBody>;
11
- export declare const getAllInstances: (locales: string[]) => Promise<GetAllInstancesResponseBody>;
12
- export declare const getGitStatus: () => Promise<GitStatusResponseBody>;
13
- export declare const stageAllFiles: () => Promise<void>;
14
- export declare const stageAllFilesOfEntity: (entityName: string) => Promise<void>;
15
- export declare const stageFileOfEntity: (entityName: string, id: string) => Promise<void>;
16
- export declare const unstageAllFiles: () => Promise<void>;
17
- export declare const unstageAllFilesOfEntity: (entityName: string) => Promise<void>;
18
- export declare const unstageFileOfEntity: (entityName: string, id: string) => Promise<void>;
19
- export declare const commitStagedFiles: (message: string) => Promise<DeleteInstanceOfEntityResponseBody>;
20
- export declare const pushCommits: () => Promise<DeleteInstanceOfEntityResponseBody>;
21
- export declare const pullCommits: () => Promise<DeleteInstanceOfEntityResponseBody>;
22
- export declare const getBranches: () => Promise<GetAllGitBranchesResponseBody>;
23
- export declare const createBranch: (branchName: string) => Promise<void>;
24
- export declare const switchBranch: (branchName: string) => Promise<void>;