@powerhousedao/builder-tools 6.0.0-dev.55 → 6.0.0-dev.57
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.
- package/dist/editor-utils/index.d.ts +0 -1
- package/dist/editor-utils/index.d.ts.map +1 -1
- package/dist/editor-utils/index.js +0 -1
- package/dist/editor-utils/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -71
- package/dist/document-model-editor/components/button.d.ts +0 -2
- package/dist/document-model-editor/components/button.d.ts.map +0 -1
- package/dist/document-model-editor/components/button.js +0 -8
- package/dist/document-model-editor/components/button.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/constants.d.ts +0 -3
- package/dist/document-model-editor/components/code-editors/constants.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/constants.js +0 -38
- package/dist/document-model-editor/components/code-editors/constants.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/factories.d.ts +0 -4
- package/dist/document-model-editor/components/code-editors/factories.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/factories.js +0 -47
- package/dist/document-model-editor/components/code-editors/factories.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts +0 -10
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/graphql-editor.js +0 -73
- package/dist/document-model-editor/components/code-editors/graphql-editor.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/hooks.d.ts +0 -23
- package/dist/document-model-editor/components/code-editors/hooks.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/hooks.js +0 -59
- package/dist/document-model-editor/components/code-editors/hooks.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts +0 -8
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/json-editor.js +0 -47
- package/dist/document-model-editor/components/code-editors/json-editor.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/linting.d.ts +0 -6
- package/dist/document-model-editor/components/code-editors/linting.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/linting.js +0 -59
- package/dist/document-model-editor/components/code-editors/linting.js.map +0 -1
- package/dist/document-model-editor/components/divider.d.ts +0 -8
- package/dist/document-model-editor/components/divider.d.ts.map +0 -1
- package/dist/document-model-editor/components/divider.js +0 -22
- package/dist/document-model-editor/components/divider.js.map +0 -1
- package/dist/document-model-editor/components/errors.d.ts +0 -6
- package/dist/document-model-editor/components/errors.d.ts.map +0 -1
- package/dist/document-model-editor/components/errors.js +0 -5
- package/dist/document-model-editor/components/errors.js.map +0 -1
- package/dist/document-model-editor/components/form.d.ts +0 -12
- package/dist/document-model-editor/components/form.d.ts.map +0 -1
- package/dist/document-model-editor/components/form.js +0 -43
- package/dist/document-model-editor/components/form.js.map +0 -1
- package/dist/document-model-editor/components/input.d.ts +0 -6
- package/dist/document-model-editor/components/input.d.ts.map +0 -1
- package/dist/document-model-editor/components/input.js +0 -9
- package/dist/document-model-editor/components/input.js.map +0 -1
- package/dist/document-model-editor/components/label.d.ts +0 -6
- package/dist/document-model-editor/components/label.d.ts.map +0 -1
- package/dist/document-model-editor/components/label.js +0 -10
- package/dist/document-model-editor/components/label.js.map +0 -1
- package/dist/document-model-editor/components/model-metadata-form.d.ts +0 -31
- package/dist/document-model-editor/components/model-metadata-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/model-metadata-form.js +0 -70
- package/dist/document-model-editor/components/model-metadata-form.js.map +0 -1
- package/dist/document-model-editor/components/module-form.d.ts +0 -10
- package/dist/document-model-editor/components/module-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/module-form.js +0 -22
- package/dist/document-model-editor/components/module-form.js.map +0 -1
- package/dist/document-model-editor/components/module.d.ts +0 -22
- package/dist/document-model-editor/components/module.d.ts.map +0 -1
- package/dist/document-model-editor/components/module.js +0 -10
- package/dist/document-model-editor/components/module.js.map +0 -1
- package/dist/document-model-editor/components/modules.d.ts +0 -20
- package/dist/document-model-editor/components/modules.d.ts.map +0 -1
- package/dist/document-model-editor/components/modules.js +0 -17
- package/dist/document-model-editor/components/modules.js.map +0 -1
- package/dist/document-model-editor/components/operation-description-form.d.ts +0 -9
- package/dist/document-model-editor/components/operation-description-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-description-form.js +0 -13
- package/dist/document-model-editor/components/operation-description-form.js.map +0 -1
- package/dist/document-model-editor/components/operation-error-form.d.ts +0 -13
- package/dist/document-model-editor/components/operation-error-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-error-form.js +0 -40
- package/dist/document-model-editor/components/operation-error-form.js.map +0 -1
- package/dist/document-model-editor/components/operation-errors.d.ts +0 -10
- package/dist/document-model-editor/components/operation-errors.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-errors.js +0 -17
- package/dist/document-model-editor/components/operation-errors.js.map +0 -1
- package/dist/document-model-editor/components/operation-form.d.ts +0 -13
- package/dist/document-model-editor/components/operation-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-form.js +0 -37
- package/dist/document-model-editor/components/operation-form.js.map +0 -1
- package/dist/document-model-editor/components/operation.d.ts +0 -23
- package/dist/document-model-editor/components/operation.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation.js +0 -25
- package/dist/document-model-editor/components/operation.js.map +0 -1
- package/dist/document-model-editor/components/operations.d.ts +0 -18
- package/dist/document-model-editor/components/operations.d.ts.map +0 -1
- package/dist/document-model-editor/components/operations.js +0 -20
- package/dist/document-model-editor/components/operations.js.map +0 -1
- package/dist/document-model-editor/components/state-error.d.ts +0 -5
- package/dist/document-model-editor/components/state-error.d.ts.map +0 -1
- package/dist/document-model-editor/components/state-error.js +0 -21
- package/dist/document-model-editor/components/state-error.js.map +0 -1
- package/dist/document-model-editor/components/state-schemas.d.ts +0 -15
- package/dist/document-model-editor/components/state-schemas.d.ts.map +0 -1
- package/dist/document-model-editor/components/state-schemas.js +0 -81
- package/dist/document-model-editor/components/state-schemas.js.map +0 -1
- package/dist/document-model-editor/components/tabs.d.ts +0 -8
- package/dist/document-model-editor/components/tabs.d.ts.map +0 -1
- package/dist/document-model-editor/components/tabs.js +0 -13
- package/dist/document-model-editor/components/tabs.js.map +0 -1
- package/dist/document-model-editor/components/text-area.d.ts +0 -9
- package/dist/document-model-editor/components/text-area.d.ts.map +0 -1
- package/dist/document-model-editor/components/text-area.js +0 -27
- package/dist/document-model-editor/components/text-area.js.map +0 -1
- package/dist/document-model-editor/components/text-field.d.ts +0 -21
- package/dist/document-model-editor/components/text-field.d.ts.map +0 -1
- package/dist/document-model-editor/components/text-field.js +0 -80
- package/dist/document-model-editor/components/text-field.js.map +0 -1
- package/dist/document-model-editor/config.d.ts +0 -3
- package/dist/document-model-editor/config.d.ts.map +0 -1
- package/dist/document-model-editor/config.js +0 -4
- package/dist/document-model-editor/config.js.map +0 -1
- package/dist/document-model-editor/constants/documents.d.ts +0 -13
- package/dist/document-model-editor/constants/documents.d.ts.map +0 -1
- package/dist/document-model-editor/constants/documents.js +0 -18
- package/dist/document-model-editor/constants/documents.js.map +0 -1
- package/dist/document-model-editor/constants/graphql-kinds.d.ts +0 -9
- package/dist/document-model-editor/constants/graphql-kinds.d.ts.map +0 -1
- package/dist/document-model-editor/constants/graphql-kinds.js +0 -13
- package/dist/document-model-editor/constants/graphql-kinds.js.map +0 -1
- package/dist/document-model-editor/context/form-context.d.ts +0 -11
- package/dist/document-model-editor/context/form-context.d.ts.map +0 -1
- package/dist/document-model-editor/context/form-context.js +0 -4
- package/dist/document-model-editor/context/form-context.js.map +0 -1
- package/dist/document-model-editor/context/schema-context.d.ts +0 -18
- package/dist/document-model-editor/context/schema-context.d.ts.map +0 -1
- package/dist/document-model-editor/context/schema-context.js +0 -129
- package/dist/document-model-editor/context/schema-context.js.map +0 -1
- package/dist/document-model-editor/document-model-editor.stories.d.ts +0 -8
- package/dist/document-model-editor/document-model-editor.stories.d.ts.map +0 -1
- package/dist/document-model-editor/document-model-editor.stories.js +0 -267
- package/dist/document-model-editor/document-model-editor.stories.js.map +0 -1
- package/dist/document-model-editor/editor.d.ts +0 -2
- package/dist/document-model-editor/editor.d.ts.map +0 -1
- package/dist/document-model-editor/editor.js +0 -217
- package/dist/document-model-editor/editor.js.map +0 -1
- package/dist/document-model-editor/hooks/index.d.ts +0 -3
- package/dist/document-model-editor/hooks/index.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/index.js +0 -3
- package/dist/document-model-editor/hooks/index.js.map +0 -1
- package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts +0 -5
- package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/useDocumentModelDocument.js +0 -8
- package/dist/document-model-editor/hooks/useDocumentModelDocument.js.map +0 -1
- package/dist/document-model-editor/hooks/useFormField.d.ts +0 -13
- package/dist/document-model-editor/hooks/useFormField.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/useFormField.js +0 -22
- package/dist/document-model-editor/hooks/useFormField.js.map +0 -1
- package/dist/document-model-editor/index.d.ts +0 -2
- package/dist/document-model-editor/index.d.ts.map +0 -1
- package/dist/document-model-editor/index.js +0 -2
- package/dist/document-model-editor/index.js.map +0 -1
- package/dist/document-model-editor/module.d.ts +0 -3
- package/dist/document-model-editor/module.d.ts.map +0 -1
- package/dist/document-model-editor/module.js +0 -10
- package/dist/document-model-editor/module.js.map +0 -1
- package/dist/document-model-editor/schemas/inputs.d.ts +0 -31
- package/dist/document-model-editor/schemas/inputs.d.ts.map +0 -1
- package/dist/document-model-editor/schemas/inputs.js +0 -71
- package/dist/document-model-editor/schemas/inputs.js.map +0 -1
- package/dist/document-model-editor/schemas/utils.d.ts +0 -3
- package/dist/document-model-editor/schemas/utils.d.ts.map +0 -1
- package/dist/document-model-editor/schemas/utils.js +0 -3
- package/dist/document-model-editor/schemas/utils.js.map +0 -1
- package/dist/document-model-editor/types/documents.d.ts +0 -26
- package/dist/document-model-editor/types/documents.d.ts.map +0 -1
- package/dist/document-model-editor/types/documents.js +0 -2
- package/dist/document-model-editor/types/documents.js.map +0 -1
- package/dist/document-model-editor/types.d.ts +0 -2
- package/dist/document-model-editor/types.d.ts.map +0 -1
- package/dist/document-model-editor/types.js +0 -2
- package/dist/document-model-editor/types.js.map +0 -1
- package/dist/document-model-editor/utils/helpers.d.ts +0 -112
- package/dist/document-model-editor/utils/helpers.d.ts.map +0 -1
- package/dist/document-model-editor/utils/helpers.js +0 -920
- package/dist/document-model-editor/utils/helpers.js.map +0 -1
- package/dist/document-model-editor/utils/linting.d.ts +0 -7
- package/dist/document-model-editor/utils/linting.d.ts.map +0 -1
- package/dist/document-model-editor/utils/linting.js +0 -49
- package/dist/document-model-editor/utils/linting.js.map +0 -1
- package/dist/document-model-editor/utils/style.d.ts +0 -3
- package/dist/document-model-editor/utils/style.d.ts.map +0 -1
- package/dist/document-model-editor/utils/style.js +0 -6
- package/dist/document-model-editor/utils/style.js.map +0 -1
- package/dist/editor-utils/storybook.d.ts +0 -32
- package/dist/editor-utils/storybook.d.ts.map +0 -1
- package/dist/editor-utils/storybook.js +0 -104
- package/dist/editor-utils/storybook.js.map +0 -1
- package/dist/style.css +0 -890
- package/dist/test/helpers.test.d.ts +0 -2
- package/dist/test/helpers.test.d.ts.map +0 -1
- package/dist/test/helpers.test.js +0 -805
- package/dist/test/helpers.test.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -2
- package/dist/test/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/builder-tools",
|
|
3
|
-
"version": "6.0.0-dev.
|
|
3
|
+
"version": "6.0.0-dev.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,48 +18,19 @@
|
|
|
18
18
|
"import": "./dist/index.js",
|
|
19
19
|
"types": "./dist/index.d.ts"
|
|
20
20
|
},
|
|
21
|
-
"./editor": {
|
|
22
|
-
"import": "./dist/document-model-editor/module.js",
|
|
23
|
-
"types": "./dist/document-model-editor/module.d.ts"
|
|
24
|
-
},
|
|
25
|
-
"./editor-component": {
|
|
26
|
-
"import": "./dist/document-model-editor/editor.js",
|
|
27
|
-
"types": "./dist/document-model-editor/editor.d.ts"
|
|
28
|
-
},
|
|
29
|
-
"./document-model-editor/hooks": {
|
|
30
|
-
"import": "./dist/document-model-editor/hooks/index.js",
|
|
31
|
-
"types": "./dist/document-model-editor/hooks/index.d.ts"
|
|
32
|
-
},
|
|
33
21
|
"./browser": {
|
|
34
22
|
"import": "./dist/browser.js",
|
|
35
23
|
"types": "./dist/browser.d.ts"
|
|
36
|
-
}
|
|
37
|
-
"./style.css": "./dist/style.css"
|
|
24
|
+
}
|
|
38
25
|
},
|
|
39
26
|
"sideEffects": false,
|
|
40
27
|
"devDependencies": {
|
|
41
28
|
"@sentry/vite-plugin": "^4.3.0",
|
|
42
|
-
"@storybook/addon-actions": "^8.6.7",
|
|
43
|
-
"@storybook/addon-docs": "^8.6.3",
|
|
44
|
-
"@storybook/addon-essentials": "^8.6.7",
|
|
45
|
-
"@storybook/addon-interactions": "^8.6.7",
|
|
46
|
-
"@storybook/addon-links": "^8.6.7",
|
|
47
|
-
"@storybook/addon-themes": "^8.6.7",
|
|
48
|
-
"@storybook/blocks": "^8.6.7",
|
|
49
|
-
"@storybook/components": "^8.6.7",
|
|
50
|
-
"@storybook/manager-api": "^8.6.7",
|
|
51
|
-
"@storybook/preview-api": "^8.6.7",
|
|
52
|
-
"@storybook/react": "^8.6.7",
|
|
53
|
-
"@storybook/react-vite": "^8.6.7",
|
|
54
|
-
"@storybook/test": "^8.6.7",
|
|
55
|
-
"@storybook/types": "^8.5.2",
|
|
56
29
|
"@tailwindcss/vite": "4.1.18",
|
|
57
30
|
"@types/react": "19.2.14",
|
|
58
|
-
"@types/validator": "^13.12.2",
|
|
59
31
|
"@vitejs/plugin-react": "5.1.4",
|
|
60
32
|
"react": "19.2.4",
|
|
61
33
|
"react-dom": "19.2.4",
|
|
62
|
-
"storybook": "^8.6.14",
|
|
63
34
|
"tsx": "4.21.0",
|
|
64
35
|
"vite": "7.3.1",
|
|
65
36
|
"vite-plugin-html": "3.2.2",
|
|
@@ -67,39 +38,12 @@
|
|
|
67
38
|
"vite-plugin-svgr": "4.5.0"
|
|
68
39
|
},
|
|
69
40
|
"dependencies": {
|
|
70
|
-
"@codemirror/autocomplete": "6.18.6",
|
|
71
|
-
"@codemirror/commands": "6.8.1",
|
|
72
|
-
"@codemirror/lang-javascript": "6.2.3",
|
|
73
|
-
"@codemirror/lang-json": "6.0.1",
|
|
74
|
-
"@codemirror/language": "6.11.0",
|
|
75
|
-
"@codemirror/lint": "6.8.5",
|
|
76
|
-
"@codemirror/search": "6.5.10",
|
|
77
|
-
"@codemirror/state": "6.5.2",
|
|
78
|
-
"@codemirror/theme-one-dark": "6.1.2",
|
|
79
|
-
"@codemirror/view": "6.36.7",
|
|
80
|
-
"@graphql-tools/schema": "10.0.31",
|
|
81
|
-
"@graphql-tools/utils": "11.0.0",
|
|
82
|
-
"@hookform/resolvers": "^5.0.1",
|
|
83
41
|
"@powerhousedao/document-engineering": "1.40.1",
|
|
84
42
|
"@prettier/sync": "^0.5.5",
|
|
85
|
-
"@radix-ui/react-checkbox": "^1.2.3",
|
|
86
|
-
"@radix-ui/react-icons": "^1.3.2",
|
|
87
|
-
"@radix-ui/react-label": "^2.1.4",
|
|
88
|
-
"@radix-ui/react-radio-group": "^1.3.4",
|
|
89
|
-
"@radix-ui/react-select": "^2.2.2",
|
|
90
|
-
"@radix-ui/react-slot": "^1.2.0",
|
|
91
|
-
"@radix-ui/react-tabs": "^1.1.9",
|
|
92
|
-
"@storybook/preview-api": "^8.6.14",
|
|
93
|
-
"@tailwindcss/cli": "4.1.18",
|
|
94
|
-
"@tailwindcss/postcss": "^4.1.7",
|
|
95
|
-
"@tailwindcss/vite": "4.1.18",
|
|
96
43
|
"@theguild/editor": "^1.3.10",
|
|
97
44
|
"@vitejs/plugin-basic-ssl": "^2.0.0",
|
|
98
45
|
"@vitejs/plugin-react": "5.1.4",
|
|
99
46
|
"change-case": "5.4.4",
|
|
100
|
-
"class-variance-authority": "0.7.0",
|
|
101
|
-
"clsx": "^2.1.1",
|
|
102
|
-
"cm6-graphql": "^0.2.1",
|
|
103
47
|
"constrained-editor-plugin": "^1.4.0",
|
|
104
48
|
"copy-anything": "^4.0.2",
|
|
105
49
|
"date-fns": "^3.6.0",
|
|
@@ -111,22 +55,17 @@
|
|
|
111
55
|
"graphql": "16.12.0",
|
|
112
56
|
"magic-string": "^0.30.17",
|
|
113
57
|
"postcss": "^8.5.3",
|
|
114
|
-
"react-hook-form": "^7.56.1",
|
|
115
58
|
"read-pkg": "10.1.0",
|
|
116
59
|
"resolve.exports": "^2.0.3",
|
|
117
|
-
"tailwind-merge": "3.4.0",
|
|
118
|
-
"tailwindcss": "4.1.18",
|
|
119
|
-
"thememirror": "^2.0.1",
|
|
120
60
|
"usehooks-ts": "^3.1.1",
|
|
121
61
|
"uuid": "^11.1.0",
|
|
122
|
-
"validator": "^13.15.0",
|
|
123
62
|
"vite-envs": "^4.6.0",
|
|
124
63
|
"vite-plugin-node-polyfills": "0.25.0",
|
|
125
64
|
"zod": "4.3.6",
|
|
126
|
-
"@powerhousedao/config": "6.0.0-dev.
|
|
127
|
-
"@powerhousedao/design-system": "6.0.0-dev.
|
|
128
|
-
"@powerhousedao/reactor-browser": "6.0.0-dev.
|
|
129
|
-
"document-model": "6.0.0-dev.
|
|
65
|
+
"@powerhousedao/config": "6.0.0-dev.57",
|
|
66
|
+
"@powerhousedao/design-system": "6.0.0-dev.57",
|
|
67
|
+
"@powerhousedao/reactor-browser": "6.0.0-dev.57",
|
|
68
|
+
"document-model": "6.0.0-dev.57"
|
|
130
69
|
},
|
|
131
70
|
"peerDependencies": {
|
|
132
71
|
"react": ">=19.0.0",
|
|
@@ -134,9 +73,6 @@
|
|
|
134
73
|
},
|
|
135
74
|
"scripts": {
|
|
136
75
|
"tsc": "tsc",
|
|
137
|
-
"lint": "eslint"
|
|
138
|
-
"build:css": "pnpm exec tailwindcss -i ./style.css -o ./dist/style.css",
|
|
139
|
-
"storybook": "storybook dev -p 6006",
|
|
140
|
-
"test": "tsx test/index.ts"
|
|
76
|
+
"lint": "eslint"
|
|
141
77
|
}
|
|
142
78
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
2
|
-
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/button.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,MAAM,0NAYjB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { cn } from "../utils/style.js";
|
|
4
|
-
export const Button = forwardRef((props, ref) => {
|
|
5
|
-
const { className, ...rest } = props;
|
|
6
|
-
return (_jsx("button", { ref: ref, ...rest, className: cn("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", className) }));
|
|
7
|
-
});
|
|
8
|
-
//# sourceMappingURL=button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../document-model-editor/components/button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAIvC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACxE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,OAAO,CACL,iBACE,GAAG,EAAE,GAAG,KACJ,IAAI,EACR,SAAS,EAAE,EAAE,CACX,sSAAsS,EACtS,SAAS,CACV,GACD,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/constants.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,UAAU,yCAStB,CAAC;AAEF,eAAO,MAAM,oBAAoB,yCAmBhC,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { autocompletion, closeBrackets, closeBracketsKeymap, completionKeymap, } from "@codemirror/autocomplete";
|
|
2
|
-
import { defaultKeymap, history, historyKeymap, indentWithTab, } from "@codemirror/commands";
|
|
3
|
-
import { bracketMatching, defaultHighlightStyle, foldGutter, foldKeymap, indentOnInput, syntaxHighlighting, } from "@codemirror/language";
|
|
4
|
-
import { lintKeymap } from "@codemirror/lint";
|
|
5
|
-
import { highlightSelectionMatches, searchKeymap } from "@codemirror/search";
|
|
6
|
-
import { EditorState } from "@codemirror/state";
|
|
7
|
-
import { crosshairCursor, drawSelection, dropCursor, EditorView, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, lineNumbers, rectangularSelection, } from "@codemirror/view";
|
|
8
|
-
export const baseKeymap = [
|
|
9
|
-
...closeBracketsKeymap,
|
|
10
|
-
...defaultKeymap,
|
|
11
|
-
...searchKeymap,
|
|
12
|
-
...historyKeymap,
|
|
13
|
-
...foldKeymap,
|
|
14
|
-
...completionKeymap,
|
|
15
|
-
...lintKeymap,
|
|
16
|
-
indentWithTab,
|
|
17
|
-
];
|
|
18
|
-
export const baseEditorExtensions = [
|
|
19
|
-
lineNumbers(),
|
|
20
|
-
highlightActiveLineGutter(),
|
|
21
|
-
highlightSpecialChars(),
|
|
22
|
-
history(),
|
|
23
|
-
foldGutter(),
|
|
24
|
-
drawSelection(),
|
|
25
|
-
dropCursor(),
|
|
26
|
-
EditorState.allowMultipleSelections.of(true),
|
|
27
|
-
indentOnInput(),
|
|
28
|
-
syntaxHighlighting(defaultHighlightStyle, { fallback: true }),
|
|
29
|
-
bracketMatching(),
|
|
30
|
-
closeBrackets(),
|
|
31
|
-
autocompletion(),
|
|
32
|
-
rectangularSelection(),
|
|
33
|
-
crosshairCursor(),
|
|
34
|
-
highlightActiveLine(),
|
|
35
|
-
highlightSelectionMatches(),
|
|
36
|
-
EditorView.lineWrapping,
|
|
37
|
-
];
|
|
38
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,UAAU,EACV,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,WAAW,EACX,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,GAAG,mBAAmB;IACtB,GAAG,aAAa;IAChB,GAAG,YAAY;IACf,GAAG,aAAa;IAChB,GAAG,UAAU;IACb,GAAG,gBAAgB;IACnB,GAAG,UAAU;IACb,aAAa;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,WAAW,EAAE;IACb,yBAAyB,EAAE;IAC3B,qBAAqB,EAAE;IACvB,OAAO,EAAE;IACT,UAAU,EAAE;IACZ,aAAa,EAAE;IACf,UAAU,EAAE;IACZ,WAAW,CAAC,uBAAuB,CAAC,EAAE,CAAC,IAAI,CAAC;IAC5C,aAAa,EAAE;IACf,kBAAkB,CAAC,qBAAqB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7D,eAAe,EAAE;IACjB,aAAa,EAAE;IACf,cAAc,EAAE;IAChB,oBAAoB,EAAE;IACtB,eAAe,EAAE;IACjB,mBAAmB,EAAE;IACrB,yBAAyB,EAAE;IAC3B,UAAU,CAAC,YAAY;CACxB,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function makeUpdateHandler(readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel?: (newDoc: string) => void): import("@codemirror/state").Extension;
|
|
2
|
-
export declare function makeFocusHandler(readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel?: (newDoc: string) => void): import("@codemirror/state").Extension;
|
|
3
|
-
export declare function makePasteHandler(readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel?: (newDoc: string) => void): import("@codemirror/state").Extension;
|
|
4
|
-
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/factories.ts"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,yCAoBjD;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,yCAWjD;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,yCAcjD"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { forceLinting } from "@codemirror/lint";
|
|
2
|
-
import { Transaction } from "@codemirror/state";
|
|
3
|
-
import { EditorView } from "@codemirror/view";
|
|
4
|
-
import { updateTimeout } from "../../constants/documents.js";
|
|
5
|
-
export function makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel) {
|
|
6
|
-
return EditorView.updateListener.of((update) => {
|
|
7
|
-
if (!!readonly || !update.docChanged)
|
|
8
|
-
return;
|
|
9
|
-
if (update.transactions.some((tr) => tr.annotation(Transaction.userEvent) === "external"))
|
|
10
|
-
return;
|
|
11
|
-
const newDoc = update.state.doc.toString();
|
|
12
|
-
if (timeoutRef.current) {
|
|
13
|
-
clearTimeout(timeoutRef.current);
|
|
14
|
-
}
|
|
15
|
-
timeoutRef.current = setTimeout(() => {
|
|
16
|
-
updateDocumentInModel?.(newDoc);
|
|
17
|
-
}, updateTimeout);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
export function makeFocusHandler(readonly, timeoutRef, updateDocumentInModel) {
|
|
21
|
-
return EditorView.focusChangeEffect.of((state, focusing) => {
|
|
22
|
-
if (!!readonly || focusing)
|
|
23
|
-
return null;
|
|
24
|
-
if (timeoutRef.current) {
|
|
25
|
-
clearTimeout(timeoutRef.current);
|
|
26
|
-
}
|
|
27
|
-
const newDoc = state.doc.toString();
|
|
28
|
-
updateDocumentInModel?.(newDoc);
|
|
29
|
-
return null;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
export function makePasteHandler(readonly, timeoutRef, updateDocumentInModel) {
|
|
33
|
-
return EditorView.domEventHandlers({
|
|
34
|
-
paste: (event, view) => {
|
|
35
|
-
if (readonly)
|
|
36
|
-
return false;
|
|
37
|
-
const newDoc = view.state.doc.toString();
|
|
38
|
-
if (timeoutRef.current) {
|
|
39
|
-
clearTimeout(timeoutRef.current);
|
|
40
|
-
}
|
|
41
|
-
updateDocumentInModel?.(newDoc);
|
|
42
|
-
forceLinting(view);
|
|
43
|
-
return false;
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=factories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factories.js","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,UAAU,iBAAiB,CAC/B,QAA6B,EAC7B,UAAyD,EACzD,qBAAgD;IAEhD,OAAO,UAAU,CAAC,cAAc,C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,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YACrB,IAAI,QAAQ;gBAAE,OAAO,KAAK,CAAC;YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YACzC,IAAI,UAAU,CAAC,OAAO,EAAE,CAAC;gBACvB,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;YACD,qBAAqB,EAAE,CAAC,MAAM,CAAC,CAAC;YAChC,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Diagnostic } from "@codemirror/lint";
|
|
2
|
-
type Props = {
|
|
3
|
-
doc: string;
|
|
4
|
-
readonly?: boolean;
|
|
5
|
-
updateDocumentInModel?: (newDoc: string) => void;
|
|
6
|
-
customLinter?: (doc: string) => Diagnostic[];
|
|
7
|
-
};
|
|
8
|
-
declare const GraphqlEditor: import("react").NamedExoticComponent<Props>;
|
|
9
|
-
export default GraphqlEditor;
|
|
10
|
-
//# sourceMappingURL=graphql-editor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-editor.d.ts","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/graphql-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAuBnD,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAM,aAAa,6CAoFjB,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forceLinting } from "@codemirror/lint";
|
|
3
|
-
import { Compartment, EditorState } from "@codemirror/state";
|
|
4
|
-
import { EditorView, keymap } from "@codemirror/view";
|
|
5
|
-
import { graphql } from "cm6-graphql";
|
|
6
|
-
import { buildSchema } from "graphql";
|
|
7
|
-
import { memo, useEffect, useRef } from "react";
|
|
8
|
-
import { ayuLight } from "thememirror";
|
|
9
|
-
import { useSchemaContext } from "../../context/schema-context.js";
|
|
10
|
-
import { baseEditorExtensions, baseKeymap } from "./constants.js";
|
|
11
|
-
import { makeFocusHandler, makePasteHandler, makeUpdateHandler, } from "./factories.js";
|
|
12
|
-
import { useDocumentSync, useEditorCleanup, useEditorRefs, useHandlerReconfiguration, } from "./hooks.js";
|
|
13
|
-
import { makeLinter } from "./linting.js";
|
|
14
|
-
const GraphqlEditor = memo(function GraphqlEditor(props) {
|
|
15
|
-
const { doc, readonly = false, updateDocumentInModel, customLinter } = props;
|
|
16
|
-
const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef, } = useEditorRefs();
|
|
17
|
-
// GraphQL-specific refs
|
|
18
|
-
const graphqlCompartment = useRef(new Compartment());
|
|
19
|
-
const linterCompartment = useRef(new Compartment());
|
|
20
|
-
const { sharedSchema } = useSchemaContext();
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!viewRef.current) {
|
|
23
|
-
const schema = buildSchema(sharedSchema);
|
|
24
|
-
viewRef.current = new EditorView({
|
|
25
|
-
state: EditorState.create({
|
|
26
|
-
doc,
|
|
27
|
-
extensions: [
|
|
28
|
-
...baseEditorExtensions,
|
|
29
|
-
keymap.of(baseKeymap),
|
|
30
|
-
ayuLight,
|
|
31
|
-
graphqlCompartment.current.of(graphql(schema)),
|
|
32
|
-
linterCompartment.current.of(makeLinter(schema, customLinter)),
|
|
33
|
-
updateListenerCompartment.current.of(makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
34
|
-
focusHandlerCompartment.current.of(makeFocusHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
35
|
-
pasteHandlerCompartment.current.of(makePasteHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
36
|
-
EditorState.readOnly.of(readonly),
|
|
37
|
-
],
|
|
38
|
-
}),
|
|
39
|
-
parent: editorRef.current,
|
|
40
|
-
});
|
|
41
|
-
forceLinting(viewRef.current);
|
|
42
|
-
}
|
|
43
|
-
}, []);
|
|
44
|
-
useEditorCleanup(viewRef);
|
|
45
|
-
/* GraphQL-specific: Reconfigures the editor when the schema changes */
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const view = viewRef.current;
|
|
48
|
-
if (!view)
|
|
49
|
-
return;
|
|
50
|
-
try {
|
|
51
|
-
const newSchema = buildSchema(sharedSchema);
|
|
52
|
-
view.dispatch({
|
|
53
|
-
effects: [
|
|
54
|
-
graphqlCompartment.current.reconfigure(graphql(newSchema)),
|
|
55
|
-
linterCompartment.current.reconfigure(makeLinter(newSchema, customLinter)),
|
|
56
|
-
],
|
|
57
|
-
});
|
|
58
|
-
forceLinting(view);
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
console.debug("in schema update", error);
|
|
62
|
-
}
|
|
63
|
-
}, [sharedSchema, customLinter]);
|
|
64
|
-
useHandlerReconfiguration(viewRef.current, readonly, timeoutRef, updateDocumentInModel, {
|
|
65
|
-
updateListener: updateListenerCompartment.current,
|
|
66
|
-
focusHandler: focusHandlerCompartment.current,
|
|
67
|
-
pasteHandler: pasteHandlerCompartment.current,
|
|
68
|
-
});
|
|
69
|
-
useDocumentSync(viewRef.current, doc);
|
|
70
|
-
return _jsx("div", { ref: editorRef });
|
|
71
|
-
});
|
|
72
|
-
export default GraphqlEditor;
|
|
73
|
-
//# sourceMappingURL=graphql-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-editor.js","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/graphql-editor.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,aAAa,CAAC,KAAY;IAC5D,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAC7E,MAAM,EACJ,SAAS,EACT,OAAO,EACP,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,UAAU,GACX,GAAG,aAAa,EAAE,CAAC;IAEpB,wBAAwB;IACxB,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC;IACrD,MAAM,iBAAiB,GAAG,MAAM,CAAC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,GAAG,OAAO,CAAC,OAAO,CAAC;QAC7B,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;YAC5C,IAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE;oBACP,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;oBAC1D,iBAAiB,CAAC,OAAO,CAAC,WAAW,CACnC,UAAU,CAAC,SAAS,EAAE,YAAY,CAAC,CACpC;iBACF;aACF,CAAC,CAAC;YACH,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IAEjC,yBAAyB,CACvB,OAAO,CAAC,OAAO,EACf,QAAQ,EACR,UAAU,EACV,qBAAqB,EACrB;QACE,cAAc,EAAE,yBAAyB,CAAC,OAAO;QACjD,YAAY,EAAE,uBAAuB,CAAC,OAAO;QAC7C,YAAY,EAAE,uBAAuB,CAAC,OAAO;KAC9C,CACF,CAAC;IAEF,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEtC,OAAO,cAAK,GAAG,EAAE,SAAS,GAAI,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Compartment } from "@codemirror/state";
|
|
2
|
-
import type { EditorView } from "@codemirror/view";
|
|
3
|
-
export type EditorConfig = {
|
|
4
|
-
doc: string;
|
|
5
|
-
readonly?: boolean;
|
|
6
|
-
updateDocumentInModel?: (newDoc: string) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function useEditorRefs(): {
|
|
9
|
-
editorRef: import("react").RefObject<HTMLDivElement | null>;
|
|
10
|
-
viewRef: import("react").RefObject<EditorView | null>;
|
|
11
|
-
updateListenerCompartment: import("react").RefObject<Compartment>;
|
|
12
|
-
focusHandlerCompartment: import("react").RefObject<Compartment>;
|
|
13
|
-
pasteHandlerCompartment: import("react").RefObject<Compartment>;
|
|
14
|
-
timeoutRef: import("react").RefObject<NodeJS.Timeout | null>;
|
|
15
|
-
};
|
|
16
|
-
export declare function useEditorCleanup(viewRef: React.MutableRefObject<EditorView | null>): void;
|
|
17
|
-
export declare function useHandlerReconfiguration(view: EditorView | null, readonly: boolean | undefined, timeoutRef: React.MutableRefObject<NodeJS.Timeout | null>, updateDocumentInModel: ((newDoc: string) => void) | undefined, compartments: {
|
|
18
|
-
updateListener: Compartment;
|
|
19
|
-
focusHandler: Compartment;
|
|
20
|
-
pasteHandler: Compartment;
|
|
21
|
-
}): void;
|
|
22
|
-
export declare function useDocumentSync(view: EditorView | null, doc: string): void;
|
|
23
|
-
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,wBAAgB,aAAa;;;;;;;EAgB5B;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,IAAI,CAAC,QAUnD;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,UAAU,GAAG,IAAI,EACvB,QAAQ,EAAE,OAAO,GAAG,SAAS,EAC7B,UAAU,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,EACzD,qBAAqB,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC7D,YAAY,EAAE;IACZ,cAAc,EAAE,WAAW,CAAC;IAC5B,YAAY,EAAE,WAAW,CAAC;IAC1B,YAAY,EAAE,WAAW,CAAC;CAC3B,QAmBF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,QAYnE"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { forceLinting } from "@codemirror/lint";
|
|
2
|
-
import { Compartment, Transaction } from "@codemirror/state";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { makeFocusHandler, makePasteHandler, makeUpdateHandler, } from "./factories.js";
|
|
5
|
-
export function useEditorRefs() {
|
|
6
|
-
const editorRef = useRef(null);
|
|
7
|
-
const viewRef = useRef(null);
|
|
8
|
-
const updateListenerCompartment = useRef(new Compartment());
|
|
9
|
-
const focusHandlerCompartment = useRef(new Compartment());
|
|
10
|
-
const pasteHandlerCompartment = useRef(new Compartment());
|
|
11
|
-
const timeoutRef = useRef(null);
|
|
12
|
-
return {
|
|
13
|
-
editorRef,
|
|
14
|
-
viewRef,
|
|
15
|
-
updateListenerCompartment,
|
|
16
|
-
focusHandlerCompartment,
|
|
17
|
-
pasteHandlerCompartment,
|
|
18
|
-
timeoutRef,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export function useEditorCleanup(viewRef) {
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
return () => {
|
|
24
|
-
if (viewRef.current) {
|
|
25
|
-
viewRef.current.destroy();
|
|
26
|
-
viewRef.current = null;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
}
|
|
31
|
-
export function useHandlerReconfiguration(view, readonly, timeoutRef, updateDocumentInModel, compartments) {
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!view)
|
|
34
|
-
return;
|
|
35
|
-
view.dispatch({
|
|
36
|
-
effects: [
|
|
37
|
-
compartments.updateListener.reconfigure(makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
38
|
-
compartments.focusHandler.reconfigure(makeFocusHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
39
|
-
compartments.pasteHandler.reconfigure(makePasteHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
forceLinting(view);
|
|
43
|
-
}, [readonly, updateDocumentInModel]);
|
|
44
|
-
}
|
|
45
|
-
export function useDocumentSync(view, doc) {
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (!view)
|
|
48
|
-
return;
|
|
49
|
-
const currentDoc = view.state.doc.toString();
|
|
50
|
-
if (currentDoc !== doc) {
|
|
51
|
-
view.dispatch({
|
|
52
|
-
changes: { from: 0, to: currentDoc.length, insert: doc },
|
|
53
|
-
annotations: [Transaction.userEvent.of("external")],
|
|
54
|
-
});
|
|
55
|
-
forceLinting(view);
|
|
56
|
-
}
|
|
57
|
-
}, [doc]);
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=hooks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAQxB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YAAY,CAAC,YAAY,CAAC,WAAW,CACnC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAC9D;aACF;SACF,CAAC,CAAC;QACH,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAuB,EAAE,GAAW;IAClE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QAC7C,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE;gBACxD,WAAW,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;aACpD,CAAC,CAAC;YACH,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor.d.ts","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/json-editor.tsx"],"names":[],"mappings":"AAmBA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,QAAA,MAAM,UAAU,6CA0Dd,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { json, jsonLanguage, jsonParseLinter } from "@codemirror/lang-json";
|
|
3
|
-
import { forceLinting, linter } from "@codemirror/lint";
|
|
4
|
-
import { EditorState } from "@codemirror/state";
|
|
5
|
-
import { EditorView, keymap } from "@codemirror/view";
|
|
6
|
-
import { memo, useEffect } from "react";
|
|
7
|
-
import { ayuLight } from "thememirror";
|
|
8
|
-
import { baseEditorExtensions, baseKeymap } from "./constants.js";
|
|
9
|
-
import { makeFocusHandler, makePasteHandler, makeUpdateHandler, } from "./factories.js";
|
|
10
|
-
import { useDocumentSync, useEditorCleanup, useEditorRefs, useHandlerReconfiguration, } from "./hooks.js";
|
|
11
|
-
const JSONEditor = memo(function JSONEditor(props) {
|
|
12
|
-
const { doc, readonly = false, updateDocumentInModel } = props;
|
|
13
|
-
const { editorRef, viewRef, updateListenerCompartment, focusHandlerCompartment, pasteHandlerCompartment, timeoutRef, } = useEditorRefs();
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (!viewRef.current) {
|
|
16
|
-
viewRef.current = new EditorView({
|
|
17
|
-
state: EditorState.create({
|
|
18
|
-
doc,
|
|
19
|
-
extensions: [
|
|
20
|
-
...baseEditorExtensions,
|
|
21
|
-
keymap.of(baseKeymap),
|
|
22
|
-
ayuLight,
|
|
23
|
-
jsonLanguage,
|
|
24
|
-
json(),
|
|
25
|
-
linter(jsonParseLinter()),
|
|
26
|
-
updateListenerCompartment.current.of(makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
27
|
-
focusHandlerCompartment.current.of(makeFocusHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
28
|
-
pasteHandlerCompartment.current.of(makePasteHandler(readonly, timeoutRef, updateDocumentInModel)),
|
|
29
|
-
EditorState.readOnly.of(readonly),
|
|
30
|
-
],
|
|
31
|
-
}),
|
|
32
|
-
parent: editorRef.current,
|
|
33
|
-
});
|
|
34
|
-
forceLinting(viewRef.current);
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
useEditorCleanup(viewRef);
|
|
38
|
-
useHandlerReconfiguration(viewRef.current, readonly, timeoutRef, updateDocumentInModel, {
|
|
39
|
-
updateListener: updateListenerCompartment.current,
|
|
40
|
-
focusHandler: focusHandlerCompartment.current,
|
|
41
|
-
pasteHandler: pasteHandlerCompartment.current,
|
|
42
|
-
});
|
|
43
|
-
useDocumentSync(viewRef.current, doc);
|
|
44
|
-
return _jsx("div", { ref: editorRef });
|
|
45
|
-
});
|
|
46
|
-
export default JSONEditor;
|
|
47
|
-
//# sourceMappingURL=json-editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor.js","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/json-editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AASpB,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,UAAU,CAAC,KAAY;IACtD,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,KAAK,EAAE,qBAAqB,EAAE,GAAG,KAAK,CAAC;IAC/D,MA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OAAO;KAC9C,CACF,CAAC;IAEF,eAAe,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAEtC,OAAO,cAAK,GAAG,EAAE,SAAS,GAAI,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Diagnostic } from "@codemirror/lint";
|
|
2
|
-
import type { GraphQLSchema } from "graphql";
|
|
3
|
-
import { GraphQLError } from "graphql";
|
|
4
|
-
export declare function convertGraphQLErrorToDiagnostic(error: GraphQLError): Diagnostic;
|
|
5
|
-
export declare function makeLinter(schema: GraphQLSchema, customLinter?: (doc: string) => Diagnostic[]): import("@codemirror/state").Extension;
|
|
6
|
-
//# sourceMappingURL=linting.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linting.d.ts","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/linting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AAOrD,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,YAAY,GAClB,UAAU,CAOZ;AASD,wBAAgB,UAAU,CACxB,MAAM,EAAE,aAAa,EACrB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,UAAU,EAAE,yCAmD7C"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { linter } from "@codemirror/lint";
|
|
2
|
-
import { filterSchema } from "@graphql-tools/utils";
|
|
3
|
-
import { GraphQLError, locatedError } from "graphql";
|
|
4
|
-
import { validateSDL } from "graphql/validation/validate.js";
|
|
5
|
-
import { safeParseSdl } from "../../context/schema-context.js";
|
|
6
|
-
/* Converts a GraphQLError to a Diagnostic
|
|
7
|
-
GraphQLError uses a zero-indexed line and column, but the editor uses a one-indexed line and column
|
|
8
|
-
*/
|
|
9
|
-
export function convertGraphQLErrorToDiagnostic(error) {
|
|
10
|
-
return {
|
|
11
|
-
from: error.locations?.[0] ? (error.positions?.[0] ?? 0) : 0,
|
|
12
|
-
to: error.locations?.[0] ? (error.positions?.[0] ?? 0) + 1 : 1,
|
|
13
|
-
severity: "error",
|
|
14
|
-
message: error.message,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/* Creates a linter that checks the document for errors
|
|
18
|
-
This works in combination with the built-in linting provided by the graphql extension
|
|
19
|
-
We need to recreate this linter when the schema changes or if a custom linter is provided
|
|
20
|
-
It first checks the document for linting errors
|
|
21
|
-
Then it checks if the document is a valid document string
|
|
22
|
-
Then it checks if the document is valid against the schema
|
|
23
|
-
*/
|
|
24
|
-
export function makeLinter(schema, customLinter) {
|
|
25
|
-
return linter((view) => {
|
|
26
|
-
const doc = view.state.doc.toString();
|
|
27
|
-
let diagnostics = [];
|
|
28
|
-
if (customLinter) {
|
|
29
|
-
diagnostics = diagnostics.concat(customLinter(doc));
|
|
30
|
-
}
|
|
31
|
-
const newDocNode = safeParseSdl(doc);
|
|
32
|
-
if (newDocNode) {
|
|
33
|
-
try {
|
|
34
|
-
const currentTypeNames = new Set(newDocNode.definitions
|
|
35
|
-
.filter((def) => "name" in def && def.name)
|
|
36
|
-
.map((def) => def.name.value));
|
|
37
|
-
// we need to filter out the existing types in the document from the schema to prevent duplicate type errors in the validation
|
|
38
|
-
const filteredSchema = filterSchema({
|
|
39
|
-
schema,
|
|
40
|
-
typeFilter: (typeName) => !currentTypeNames.has(typeName),
|
|
41
|
-
});
|
|
42
|
-
const errors = validateSDL(newDocNode, filteredSchema)
|
|
43
|
-
.map((error) => locatedError(error, newDocNode))
|
|
44
|
-
.filter((error, index, self) => index ===
|
|
45
|
-
self.findIndex((e) => e.message === error.message &&
|
|
46
|
-
e.locations?.[0]?.line === error.locations?.[0]?.line &&
|
|
47
|
-
e.locations?.[0]?.column === error.locations?.[0]?.column));
|
|
48
|
-
diagnostics = diagnostics.concat(errors.map(convertGraphQLErrorToDiagnostic));
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
if (error instanceof GraphQLError) {
|
|
52
|
-
diagnostics.push(convertGraphQLErrorToDiagnostic(error));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return diagnostics;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=linting.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"linting.js","sourceRoot":"","sources":["../../../../document-model-editor/components/code-editors/linting.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;EAEE;AACF,MAAM,UAAU,+BAA+B,CAC7C,KAAmB;IAEnB,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,QAAQ,EAAE,OAAO;QACjB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AAED;;;;;;IAMI;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AAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI;wBACrD,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,CAC5D,CACJ,CAAC;gBAEJ,WAAW,GAAG,WAAW,CAAC,MAAM,CAC9B,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAC5C,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,YAAY,EAAE,CAAC;oBAClC,WAAW,CAAC,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,CAAC,CAAC;gBAC3D,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
className?: string;
|
|
3
|
-
size?: "sm" | "md" | "lg";
|
|
4
|
-
margin?: "sm" | "md" | "lg";
|
|
5
|
-
};
|
|
6
|
-
export declare function Divider({ className, size, margin }: Props): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=divider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"divider.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/divider.tsx"],"names":[],"mappings":"AAEA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC7B,CAAC;AACF,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,IAAW,EAAE,MAAa,EAAE,EAAE,KAAK,2CAkBvE"}
|