@cocoar/vue-script-editor 1.9.0-script-editor.4
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/LICENSE +201 -0
- package/README.md +278 -0
- package/dist/CoarScriptEditor.vue.d.ts +122 -0
- package/dist/CoarScriptEditor.vue.d.ts.map +1 -0
- package/dist/composables/useConstrainedRegions.d.ts +17 -0
- package/dist/composables/useConstrainedRegions.d.ts.map +1 -0
- package/dist/composables/useExtraLibs.d.ts +20 -0
- package/dist/composables/useExtraLibs.d.ts.map +1 -0
- package/dist/composables/useFormFieldContext.d.ts +17 -0
- package/dist/composables/useFormFieldContext.d.ts.map +1 -0
- package/dist/composables/useMonacoEditor.d.ts +58 -0
- package/dist/composables/useMonacoEditor.d.ts.map +1 -0
- package/dist/constrained/ChangeGuard.d.ts +43 -0
- package/dist/constrained/ChangeGuard.d.ts.map +1 -0
- package/dist/constrained/CursorGuard.d.ts +21 -0
- package/dist/constrained/CursorGuard.d.ts.map +1 -0
- package/dist/constrained/DiagnosticsFilter.d.ts +29 -0
- package/dist/constrained/DiagnosticsFilter.d.ts.map +1 -0
- package/dist/constrained/LockedLineScanner.d.ts +110 -0
- package/dist/constrained/LockedLineScanner.d.ts.map +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +693 -0
- package/dist/theme.d.ts +35 -0
- package/dist/theme.d.ts.map +1 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# @cocoar/vue-script-editor
|
|
2
|
+
|
|
3
|
+
Monaco-based script editor for Vue 3 with Cocoar Design System theming and **locked-line protection** for templates where signatures stay fixed and users fill in bodies.
|
|
4
|
+
|
|
5
|
+
Initial scope: **TypeScript and JavaScript** only, with support for user-supplied type definitions (`extraLibs`).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @cocoar/vue-script-editor monaco-editor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`monaco-editor` is a peer dependency — consumers install and configure it themselves (this
|
|
14
|
+
keeps the library bundle small and avoids double-bundling Monaco's ~5 MB of language services).
|
|
15
|
+
|
|
16
|
+
## Worker setup
|
|
17
|
+
|
|
18
|
+
Monaco needs its language services to run in Web Workers. You register them by assigning a
|
|
19
|
+
getter to `self.MonacoEnvironment` **before any editor mounts**. Pick the pattern that
|
|
20
|
+
matches your app's shape.
|
|
21
|
+
|
|
22
|
+
### SPA (client-only, Vite)
|
|
23
|
+
|
|
24
|
+
The common case — a single-page app that runs only in the browser. Register workers once at
|
|
25
|
+
application entry:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// src/main.ts
|
|
29
|
+
import EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';
|
|
30
|
+
import TsWorker from 'monaco-editor/esm/vs/language/typescript/ts.worker?worker';
|
|
31
|
+
import JsonWorker from 'monaco-editor/esm/vs/language/json/json.worker?worker';
|
|
32
|
+
|
|
33
|
+
self.MonacoEnvironment = {
|
|
34
|
+
getWorker(_workerId, label) {
|
|
35
|
+
if (label === 'typescript' || label === 'javascript') return new TsWorker();
|
|
36
|
+
if (label === 'json') return new JsonWorker();
|
|
37
|
+
return new EditorWorker();
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Drop the `JsonWorker` entries if you don't use JSON mode.
|
|
43
|
+
|
|
44
|
+
### SSR / static-generation (VitePress, Nuxt, Astro)
|
|
45
|
+
|
|
46
|
+
Monaco touches `window`, `document`, and the DOM — it cannot run during server-side
|
|
47
|
+
rendering. Defer both the worker registration AND the editor import to `onMounted`, and
|
|
48
|
+
guard with `<ClientOnly>` in your template:
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<template>
|
|
52
|
+
<ClientOnly>
|
|
53
|
+
<component :is="Editor" v-if="Editor" v-model="code" />
|
|
54
|
+
</ClientOnly>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { onMounted, ref, shallowRef, type Component } from 'vue';
|
|
59
|
+
|
|
60
|
+
const Editor = shallowRef<Component | null>(null);
|
|
61
|
+
const code = ref('// ...');
|
|
62
|
+
|
|
63
|
+
onMounted(async () => {
|
|
64
|
+
const [mod, editorWorkerMod, tsWorkerMod, jsonWorkerMod] = await Promise.all([
|
|
65
|
+
import('@cocoar/vue-script-editor'),
|
|
66
|
+
import('monaco-editor/esm/vs/editor/editor.worker?worker'),
|
|
67
|
+
import('monaco-editor/esm/vs/language/typescript/ts.worker?worker'),
|
|
68
|
+
import('monaco-editor/esm/vs/language/json/json.worker?worker'),
|
|
69
|
+
]);
|
|
70
|
+
self.MonacoEnvironment = {
|
|
71
|
+
getWorker(_workerId, label) {
|
|
72
|
+
if (label === 'typescript' || label === 'javascript') return new tsWorkerMod.default();
|
|
73
|
+
if (label === 'json') return new jsonWorkerMod.default();
|
|
74
|
+
return new editorWorkerMod.default();
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
Editor.value = mod.CoarScriptEditor;
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`<ClientOnly>` is registered globally by VitePress and Nuxt. In a plain Vite SPA you don't
|
|
83
|
+
need it — the SPA pattern above is simpler. In Astro use `client:only="vue"` on the component.
|
|
84
|
+
|
|
85
|
+
### Other bundlers
|
|
86
|
+
|
|
87
|
+
`monaco-editor`'s [official docs](https://github.com/microsoft/monaco-editor/tree/main/docs)
|
|
88
|
+
cover Webpack, esbuild, Rollup, and plain CDN setups. The same `self.MonacoEnvironment.getWorker`
|
|
89
|
+
contract applies — only the worker import syntax changes.
|
|
90
|
+
|
|
91
|
+
## Basic usage
|
|
92
|
+
|
|
93
|
+
```vue
|
|
94
|
+
<script setup lang="ts">
|
|
95
|
+
import { ref } from 'vue';
|
|
96
|
+
import { CoarScriptEditor } from '@cocoar/vue-script-editor';
|
|
97
|
+
|
|
98
|
+
const code = ref(`function greet(name: string) {\n return \`Hello, \${name}\`;\n}\n`);
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<template>
|
|
102
|
+
<CoarScriptEditor v-model="code" language="typescript" />
|
|
103
|
+
</template>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Constrained mode — `// @locked` lines
|
|
107
|
+
|
|
108
|
+
Any line of the source that contains `// @locked` is **protected**: users cannot edit,
|
|
109
|
+
merge, or delete it. Everything else is freely editable — including the file top, so
|
|
110
|
+
TypeScript's Auto-Import quickfix works as in any normal `.ts` file.
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import { ref } from 'vue';
|
|
115
|
+
import { CoarScriptEditor, type CoarScriptEditorRejectEvent } from '@cocoar/vue-script-editor';
|
|
116
|
+
|
|
117
|
+
const code = ref(`function describeOrder(order: Order): string { // @locked
|
|
118
|
+
return \`Order \${order.id}\`;
|
|
119
|
+
} // @locked
|
|
120
|
+
`);
|
|
121
|
+
|
|
122
|
+
function onReject(event: CoarScriptEditorRejectEvent) {
|
|
123
|
+
// Reject reason is 'edit-overlaps-locked-line'. Surface a toast, shake, etc.
|
|
124
|
+
console.log('Edit rejected on line', event.range?.startLineNumber);
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<CoarScriptEditor v-model="code" language="typescript" @reject="onReject" />
|
|
130
|
+
</template>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The `v-model` string **includes** the `// @locked` markers, so it round-trips through
|
|
134
|
+
persistence unchanged — save and reload the exact same value.
|
|
135
|
+
|
|
136
|
+
### Authoring mode
|
|
137
|
+
|
|
138
|
+
Template authors need to edit the protected parts too. Pass `:authoring="true"` to suspend
|
|
139
|
+
enforcement — locked lines become editable, markers render at full size with a warm accent
|
|
140
|
+
colour, and the author can add or remove markers. Toggle back to `false` and enforcement
|
|
141
|
+
resumes with whatever markers are currently in the text.
|
|
142
|
+
|
|
143
|
+
```vue
|
|
144
|
+
<CoarScriptEditor v-model="code" :authoring="isAuthor" />
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Custom type definitions (`extraLibs`)
|
|
148
|
+
|
|
149
|
+
Inject `.d.ts` contents so user code can reference your domain types with full IntelliSense:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
import type { CoarScriptEditorExtraLib } from '@cocoar/vue-script-editor';
|
|
153
|
+
|
|
154
|
+
const extraLibs: CoarScriptEditorExtraLib[] = [
|
|
155
|
+
{
|
|
156
|
+
content: `declare interface AppContext { user: { id: string; name: string } };`,
|
|
157
|
+
// IMPORTANT: must start with `file:///` — Monaco's TypeScript service keys on path
|
|
158
|
+
// and silently ignores non-file URIs. A dev-mode console.warn flags this in dev.
|
|
159
|
+
filePath: 'file:///types/app-context.d.ts',
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Pure helpers (no editor mount required)
|
|
165
|
+
|
|
166
|
+
For server-side validation, submit-gating, or tests:
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import {
|
|
170
|
+
hasLockedMarkers,
|
|
171
|
+
getEditableSegments,
|
|
172
|
+
isEverySegmentNonEmpty,
|
|
173
|
+
validateSource,
|
|
174
|
+
countLockedLines,
|
|
175
|
+
} from '@cocoar/vue-script-editor';
|
|
176
|
+
|
|
177
|
+
if (isEverySegmentNonEmpty(code)) submit(code);
|
|
178
|
+
|
|
179
|
+
const v = validateSource(code);
|
|
180
|
+
// v.ok, v.lockedLineCount, v.segmentCount, v.warnings: string[]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
See the full docs page for the deeper helpers (`scanLockedLines`, `computeProtectedRanges`,
|
|
184
|
+
`editIsProtected`, `snapOffsetAwayFromLocked`).
|
|
185
|
+
|
|
186
|
+
## Props
|
|
187
|
+
|
|
188
|
+
| Prop | Type | Default | Description |
|
|
189
|
+
| -------------- | ----------------------------------------- | -------------- | -------------------------------------------------------------------------- |
|
|
190
|
+
| `modelValue` | `string` | `''` | Editor content (use with `v-model`). `// @locked` lines protected. |
|
|
191
|
+
| `authoring` | `boolean` | `false` | Authoring mode — suspends enforcement for template authors. |
|
|
192
|
+
| `language` | `'typescript' \| 'javascript' \| 'json'` | `'typescript'` | Language mode. |
|
|
193
|
+
| `readonly` | `boolean` | `false` | Viewer mode — selection / copy still work. |
|
|
194
|
+
| `disabled` | `boolean` | `false` | Non-interactive form state. Picked up from `CoarFormField`. |
|
|
195
|
+
| `error` | `boolean` | `false` | Error state — red border. Auto-picked up from `CoarFormField`. |
|
|
196
|
+
| `placeholder` | `string` | `''` | Placeholder shown when empty and not focused. |
|
|
197
|
+
| `required` | `boolean` | `false` | Sets `aria-required="true"`. |
|
|
198
|
+
| `autofocus` | `boolean` | `false` | Focus the editor after mount. |
|
|
199
|
+
| `id` | `string` | `''` | HTML id (auto-generated if omitted; `CoarFormField.id` wins). |
|
|
200
|
+
| `name` | `string` | `''` | Informational `data-name` (the editor is not a native form control). |
|
|
201
|
+
| `height` | `string \| number` | `undefined` | CSS string (`"160px"`, `"40vh"`) or pixels as number. |
|
|
202
|
+
| `variant` | `'editor' \| 'inline'` | `'editor'` | UI preset: full chrome vs compact form-field look. |
|
|
203
|
+
| `scriptMode` | `boolean` | `false` | Suppress TS/JS diagnostics for script-body code. **Global side-effect**. |
|
|
204
|
+
| `preamble` | `string` | `''` | Hidden + locked per-editor type context (not in `modelValue`). |
|
|
205
|
+
| `minimap` | `boolean` | `false` | Show the Monaco minimap gutter. |
|
|
206
|
+
| `theme` | `'auto' \| 'light' \| 'dark'` | `'auto'` | `auto` follows `.dark-mode` class and `prefers-color-scheme`. |
|
|
207
|
+
| `extraLibs` | `CoarScriptEditorExtraLib[]` | `[]` | TypeScript declarations for IntelliSense. |
|
|
208
|
+
|
|
209
|
+
## Events
|
|
210
|
+
|
|
211
|
+
| Event | Payload | Description |
|
|
212
|
+
| ------------------- | ------------------------------ | --------------------------------------------------------------------------------- |
|
|
213
|
+
| `update:modelValue` | `string` | Full editor text. Markers stay; preamble is stripped before emit. |
|
|
214
|
+
| `reject` | `CoarScriptEditorRejectEvent` | Emitted when an edit was rolled back by the constrained guards. |
|
|
215
|
+
| `focused` | `void` | Editor widget gained focus (including suggestion popups). |
|
|
216
|
+
| `blurred` | `void` | Editor widget lost focus — use for form-touched state. |
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
interface CoarScriptEditorRejectEvent {
|
|
220
|
+
reason: 'edit-overlaps-locked-line';
|
|
221
|
+
range?: { startLineNumber: number; endLineNumber: number };
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Exposed methods
|
|
226
|
+
|
|
227
|
+
The component exposes `focus()` as a convenience, plus `getEditor()` and `getModel()` for access
|
|
228
|
+
to the raw Monaco instance when you need APIs beyond the declarative props (markers, custom
|
|
229
|
+
commands, folding, etc.):
|
|
230
|
+
|
|
231
|
+
```vue
|
|
232
|
+
<script setup lang="ts">
|
|
233
|
+
import { ref } from 'vue';
|
|
234
|
+
import { CoarScriptEditor } from '@cocoar/vue-script-editor';
|
|
235
|
+
|
|
236
|
+
const editorRef = ref<InstanceType<typeof CoarScriptEditor> | null>(null);
|
|
237
|
+
|
|
238
|
+
function focusEditor() {
|
|
239
|
+
editorRef.value?.focus();
|
|
240
|
+
}
|
|
241
|
+
</script>
|
|
242
|
+
|
|
243
|
+
<template>
|
|
244
|
+
<CoarScriptEditor ref="editorRef" v-model="code" />
|
|
245
|
+
</template>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Forms
|
|
249
|
+
|
|
250
|
+
`CoarScriptEditor` integrates with `CoarFormField` the same way `CoarTextInput` does — label,
|
|
251
|
+
error state, `aria-describedby`, required marker, and disabled state all wire up automatically:
|
|
252
|
+
|
|
253
|
+
```vue
|
|
254
|
+
<CoarFormField label="Handler script" :error="scriptError" required>
|
|
255
|
+
<CoarScriptEditor
|
|
256
|
+
v-model="form.script"
|
|
257
|
+
variant="inline"
|
|
258
|
+
height="180px"
|
|
259
|
+
placeholder="// return query.filter(...)"
|
|
260
|
+
script-mode
|
|
261
|
+
preamble="declare const query: TodoQuery;"
|
|
262
|
+
:extra-libs="[{ filePath: 'file:///types/query.d.ts', content: queryTypes }]"
|
|
263
|
+
/>
|
|
264
|
+
</CoarFormField>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
- **`preamble`** — hidden + locked type-context lines, per-editor scope. Emitted `modelValue`
|
|
268
|
+
is the user portion only.
|
|
269
|
+
- **`script-mode`** — suppresses diagnostics for top-level `return`/`await`/`export`. Global
|
|
270
|
+
side-effect across all TS/JS editors.
|
|
271
|
+
- **`variant="inline"`** — compact form-field chrome: no line numbers, no gutter, tight padding.
|
|
272
|
+
- **`height`** — CSS string or pixels. The editor fills its parent if omitted.
|
|
273
|
+
|
|
274
|
+
## Full documentation
|
|
275
|
+
|
|
276
|
+
See the [Cocoar UI Vue docs](https://docs.cocoar.dev/cocoar-ui-vue/components/script-editor)
|
|
277
|
+
for the complete guide, including styling, `@reject` payload details, a live playground,
|
|
278
|
+
and the full list of pure helpers.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { CoarScriptEditorLanguage, CoarScriptEditorVariant } from './composables/useMonacoEditor';
|
|
2
|
+
import { CoarScriptEditorExtraLib } from './composables/useExtraLibs';
|
|
3
|
+
import { CoarScriptEditorTheme } from './theme';
|
|
4
|
+
export type CoarScriptEditorRejectReason = 'edit-overlaps-locked-line';
|
|
5
|
+
/**
|
|
6
|
+
* Payload emitted by `@reject` when the guard rolls back an illegal edit. The shape is an
|
|
7
|
+
* object (not a bare string) so additional context can be added later without a breaking
|
|
8
|
+
* change — new fields stay optional.
|
|
9
|
+
*/
|
|
10
|
+
export interface CoarScriptEditorRejectEvent {
|
|
11
|
+
reason: CoarScriptEditorRejectReason;
|
|
12
|
+
/** 1-based line range of the edit that got rejected, if available. */
|
|
13
|
+
range?: {
|
|
14
|
+
startLineNumber: number;
|
|
15
|
+
endLineNumber: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface CoarScriptEditorProps {
|
|
19
|
+
/**
|
|
20
|
+
* Editor source. Any line containing `// @locked` (anywhere in the line) is protected
|
|
21
|
+
* from edits — including against being merged with its neighbours. Everything else is
|
|
22
|
+
* freely editable. The markers stay in the text, so the emitted value round-trips.
|
|
23
|
+
*/
|
|
24
|
+
modelValue?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Authoring mode. When true, lock enforcement is suspended so template authors can
|
|
27
|
+
* modify locked lines, add new `// @locked` lines, or remove existing markers. Markers
|
|
28
|
+
* render at full size with an accent colour so it's visually obvious that enforcement
|
|
29
|
+
* is off.
|
|
30
|
+
*/
|
|
31
|
+
authoring?: boolean;
|
|
32
|
+
language?: CoarScriptEditorLanguage;
|
|
33
|
+
/** Read-only mode — user cannot edit but cursor, selection, and copy still work. */
|
|
34
|
+
readonly?: boolean;
|
|
35
|
+
/** Disabled state — non-interactive, dimmed, tab-skipped. Auto-picked up from CoarFormField. */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** Error state — red border. Auto-picked up from CoarFormField.error. */
|
|
38
|
+
error?: boolean;
|
|
39
|
+
/** Placeholder text shown when the editor is empty and not focused. */
|
|
40
|
+
placeholder?: string;
|
|
41
|
+
/** Marks the field as required (sets aria-required; no enforcement). */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/** Autofocus on mount. */
|
|
44
|
+
autofocus?: boolean;
|
|
45
|
+
/** HTML id attribute. Auto-generated if omitted; CoarFormField's id takes precedence. */
|
|
46
|
+
id?: string;
|
|
47
|
+
/** HTML name attribute (informational — editor is not a native form control). */
|
|
48
|
+
name?: string;
|
|
49
|
+
/** Explicit height. Accepts CSS string (`"160px"`, `"40%"`) or number (pixels). */
|
|
50
|
+
height?: string | number;
|
|
51
|
+
/**
|
|
52
|
+
* UI preset.
|
|
53
|
+
* - `'editor'` (default): full IDE chrome — line numbers, gutter, minimap-ready
|
|
54
|
+
* - `'inline'`: compact form-field look — no line numbers, no gutter, tight padding
|
|
55
|
+
*/
|
|
56
|
+
variant?: CoarScriptEditorVariant;
|
|
57
|
+
/**
|
|
58
|
+
* When true, suppresses diagnostic codes that flag "script body" constructs in TS/JS
|
|
59
|
+
* (top-level return/await/export, implicit any, etc). **Global side-effect** — affects
|
|
60
|
+
* all TS/JS editors on the page. No-op for JSON.
|
|
61
|
+
*/
|
|
62
|
+
scriptMode?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Hidden + locked prefix providing per-editor type context, e.g.
|
|
65
|
+
* `"declare const query: TodoQuery;"`. Rendered invisibly above the user script, so
|
|
66
|
+
* IntelliSense resolves against its declarations while the user can't see or edit it.
|
|
67
|
+
* Does not round-trip through `modelValue`.
|
|
68
|
+
*/
|
|
69
|
+
preamble?: string;
|
|
70
|
+
minimap?: boolean;
|
|
71
|
+
theme?: CoarScriptEditorTheme;
|
|
72
|
+
/** TypeScript declaration files made available for autocomplete and type checking. */
|
|
73
|
+
extraLibs?: CoarScriptEditorExtraLib[];
|
|
74
|
+
/**
|
|
75
|
+
* Override the DOM node Monaco uses for overflow widgets (IntelliSense popup, hover,
|
|
76
|
+
* parameter hints). Set this when the editor is mounted inside a custom modal or overlay
|
|
77
|
+
* and you want the widgets in that modal's stacking context.
|
|
78
|
+
*
|
|
79
|
+
* For the Cocoar dialog (`useDialog().open(...)`) this is auto-detected — pass `null` to
|
|
80
|
+
* fall back to Monaco's default body-level container.
|
|
81
|
+
*/
|
|
82
|
+
overflowWidgetsDomNode?: HTMLElement | null;
|
|
83
|
+
}
|
|
84
|
+
declare const _default: import('vue').DefineComponent<CoarScriptEditorProps, {
|
|
85
|
+
getEditor: () => import("monaco-editor").editor.IStandaloneCodeEditor | null;
|
|
86
|
+
getModel: () => import("monaco-editor").editor.ITextModel | null;
|
|
87
|
+
focus: () => void | undefined;
|
|
88
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
89
|
+
"update:modelValue": (value: string) => any;
|
|
90
|
+
reject: (event: CoarScriptEditorRejectEvent) => any;
|
|
91
|
+
focused: () => any;
|
|
92
|
+
blurred: () => any;
|
|
93
|
+
}, string, import('vue').PublicProps, Readonly<CoarScriptEditorProps> & Readonly<{
|
|
94
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
95
|
+
onReject?: ((event: CoarScriptEditorRejectEvent) => any) | undefined;
|
|
96
|
+
onFocused?: (() => any) | undefined;
|
|
97
|
+
onBlurred?: (() => any) | undefined;
|
|
98
|
+
}>, {
|
|
99
|
+
overflowWidgetsDomNode: HTMLElement | null;
|
|
100
|
+
modelValue: string;
|
|
101
|
+
authoring: boolean;
|
|
102
|
+
language: CoarScriptEditorLanguage;
|
|
103
|
+
readonly: boolean;
|
|
104
|
+
disabled: boolean;
|
|
105
|
+
error: boolean;
|
|
106
|
+
placeholder: string;
|
|
107
|
+
required: boolean;
|
|
108
|
+
autofocus: boolean;
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
height: string | number;
|
|
112
|
+
variant: CoarScriptEditorVariant;
|
|
113
|
+
scriptMode: boolean;
|
|
114
|
+
preamble: string;
|
|
115
|
+
minimap: boolean;
|
|
116
|
+
theme: CoarScriptEditorTheme;
|
|
117
|
+
extraLibs: CoarScriptEditorExtraLib[];
|
|
118
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
119
|
+
host: HTMLDivElement;
|
|
120
|
+
}, HTMLDivElement>;
|
|
121
|
+
export default _default;
|
|
122
|
+
//# sourceMappingURL=CoarScriptEditor.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoarScriptEditor.vue.d.ts","sourceRoot":"","sources":["../src/CoarScriptEditor.vue"],"names":[],"mappings":"AAuUA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAgB,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAGzF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,4BAA4B,GAAG,2BAA2B,CAAC;AAEvE;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,4BAA4B,CAAC;IACrC,sEAAsE;IACtE,KAAK,CAAC,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5D;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gGAAgG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yEAAyE;IACzE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,yFAAyF;IACzF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,sFAAsF;IACtF,SAAS,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACvC;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7C;;;;;;;;;;;;;;;;4BAD0B,WAAW,GAAG,IAAI;gBA1D9B,MAAM;eAOP,OAAO;cACR,wBAAwB;cAExB,OAAO;cAEP,OAAO;WAEV,OAAO;iBAED,MAAM;cAET,OAAO;eAEN,OAAO;QAEd,MAAM;UAEJ,MAAM;YAEJ,MAAM,GAAG,MAAM;aAMd,uBAAuB;gBAMpB,OAAO;cAOT,MAAM;aACP,OAAO;WACT,qBAAqB;eAEjB,wBAAwB,EAAE;;;;AAoNxC,wBAWG"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ChangeGuardRejectEvent } from '../constrained/ChangeGuard';
|
|
3
|
+
import type * as monaco from 'monaco-editor';
|
|
4
|
+
export interface UseConstrainedRegionsOptions {
|
|
5
|
+
editor: Readonly<Ref<monaco.editor.IStandaloneCodeEditor | null>>;
|
|
6
|
+
value: () => string;
|
|
7
|
+
/** When true, guards observe but do not reject. Markers stay visible. */
|
|
8
|
+
authoring: () => boolean;
|
|
9
|
+
onReject?: (event: ChangeGuardRejectEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Attaches change + cursor guards when the source contains locked-line markers, and draws
|
|
13
|
+
* decorations for each locked line (whole-line background tint + shrunk marker text).
|
|
14
|
+
* Tears itself down when no markers are present.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useConstrainedRegions(options: UseConstrainedRegionsOptions): void;
|
|
17
|
+
//# sourceMappingURL=useConstrainedRegions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConstrainedRegions.d.ts","sourceRoot":"","sources":["../../src/composables/useConstrainedRegions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAC7C,OAAO,EAA0B,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,4BAA4B,CAAC;AAQpC,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC,CAAC;IAClE,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,yEAAyE;IACzE,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;CACpD;AAOD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI,CA2IjF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CoarScriptEditorLanguage } from './useMonacoEditor';
|
|
2
|
+
export interface CoarScriptEditorExtraLib {
|
|
3
|
+
/** TypeScript declaration source (`.d.ts` contents). */
|
|
4
|
+
content: string;
|
|
5
|
+
/**
|
|
6
|
+
* Virtual file path the declarations live under. **Must start with `file:///`** —
|
|
7
|
+
* Monaco's TypeScript language service keys entries on the path and silently ignores
|
|
8
|
+
* non-`file://` URIs, so a bare `'types/foo.d.ts'` will compile without error but
|
|
9
|
+
* produce no IntelliSense.
|
|
10
|
+
*
|
|
11
|
+
* Examples: `'file:///types/order.d.ts'`, `'file:///node_modules/foo/index.d.ts'`.
|
|
12
|
+
*/
|
|
13
|
+
filePath: string;
|
|
14
|
+
}
|
|
15
|
+
export interface UseExtraLibsOptions {
|
|
16
|
+
language: () => CoarScriptEditorLanguage;
|
|
17
|
+
libs: () => readonly CoarScriptEditorExtraLib[];
|
|
18
|
+
}
|
|
19
|
+
export declare function useExtraLibs(options: UseExtraLibsOptions): void;
|
|
20
|
+
//# sourceMappingURL=useExtraLibs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useExtraLibs.d.ts","sourceRoot":"","sources":["../../src/composables/useExtraLibs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAElE,MAAM,WAAW,wBAAwB;IACvC,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,wBAAwB,CAAC;IACzC,IAAI,EAAE,MAAM,SAAS,wBAAwB,EAAE,CAAC;CACjD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI,CA4D/D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Contract mirror of `@cocoar/vue-ui`'s `FormFieldProvided`. Duplicated here (rather than
|
|
4
|
+
* imported) so `@cocoar/vue-script-editor` doesn't have to pull `@cocoar/vue-ui` as a
|
|
5
|
+
* package dependency. The key is shared via `Symbol.for('coar:form-field')` — see
|
|
6
|
+
* `packages/ui/src/components/form-field/constants.ts` for the source of truth.
|
|
7
|
+
*
|
|
8
|
+
* When `CoarFormField`'s public shape changes, update both places.
|
|
9
|
+
*/
|
|
10
|
+
export interface FormFieldContext {
|
|
11
|
+
inputId: ComputedRef<string>;
|
|
12
|
+
messageId: ComputedRef<string>;
|
|
13
|
+
hasError: ComputedRef<boolean>;
|
|
14
|
+
disabled: ComputedRef<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export declare function useFormFieldContext(): FormFieldContext | undefined;
|
|
17
|
+
//# sourceMappingURL=useFormFieldContext.d.ts.map
|