@airalogy/aimd-recorder 1.14.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.
- package/README.md +240 -0
- package/README.zh-CN.md +224 -0
- package/dist/AimdCodeField-DC3DPvgc.js +172 -0
- package/dist/AimdDnaSequenceField-__jdnFS9.js +59466 -0
- package/dist/AimdEditor.vue_vue_type_style_index_0_lang-Bq79rKNw.js +28370 -0
- package/dist/AimdMarkdownField-98ImHGbc.js +66 -0
- package/dist/AimdMarkdownNoteField-CuUJZkgT.js +185 -0
- package/dist/_.contribution-IP0cDNhs.js +38 -0
- package/dist/_commonjsHelpers-CZXJ37nu.js +40 -0
- package/dist/abap-Bs8kvjsq.js +1398 -0
- package/dist/aimd-recorder.css +1 -0
- package/dist/apex-Dspwrl5m.js +326 -0
- package/dist/assets/css.worker-Dmf38jDD.js +79 -0
- package/dist/assets/editor.worker-CpuX8TSY.js +12 -0
- package/dist/assets/html.worker-DotaEs7v.js +456 -0
- package/dist/assets/json.worker-B4VHhH6h.js +44 -0
- package/dist/assets/ts.worker-sl17zBDo.js +51316 -0
- package/dist/azcli-k1BiOau1.js +68 -0
- package/dist/bat-BIP72KWc.js +100 -0
- package/dist/bicep-VhQeYhS3.js +102 -0
- package/dist/cameligo-DnuAXtHg.js +174 -0
- package/dist/clojure-BAuDPsal.js +761 -0
- package/dist/coffee-BV06qSnj.js +232 -0
- package/dist/components.js +3595 -0
- package/dist/composables.js +72 -0
- package/dist/cpp-Cz8Jeyrf.js +389 -0
- package/dist/csharp-F6hhlXFb.js +326 -0
- package/dist/csp-KzlEHCyI.js +53 -0
- package/dist/css-e4FKntZ3.js +187 -0
- package/dist/cssMode-uz9U6SUU.js +1571 -0
- package/dist/cypher-CpvDGKRr.js +263 -0
- package/dist/dart-DdHeFWR0.js +281 -0
- package/dist/dockerfile-aoNXDcio.js +130 -0
- package/dist/ecl-C4Q0DYuA.js +456 -0
- package/dist/editor.api-CgD9w0gG.js +77091 -0
- package/dist/editor.main-Du02abDl.js +33783 -0
- package/dist/elixir-C9X42b0T.js +569 -0
- package/dist/flow9-Bff42pfB.js +142 -0
- package/dist/freemarker2-DFLX4iQ-.js +989 -0
- package/dist/fsharp-C6vPAsHG.js +217 -0
- package/dist/go-DEr8zx9f.js +218 -0
- package/dist/graphql-BiNBBRFh.js +151 -0
- package/dist/handlebars-aiZbIuWY.js +419 -0
- package/dist/hcl-2T9lKuFg.js +183 -0
- package/dist/html-phzTMObN.js +308 -0
- package/dist/htmlMode-BF7wMi3N.js +1581 -0
- package/dist/index.js +89 -0
- package/dist/ini-CZGtssYM.js +71 -0
- package/dist/ini.contribution-DyWtiacL.js +8 -0
- package/dist/java-B260NeH3.js +232 -0
- package/dist/javascript-BKKOItMi.js +70 -0
- package/dist/jsonMode-CDYK4B5l.js +1996 -0
- package/dist/julia-kuNLM9c5.js +511 -0
- package/dist/kotlin-Bz6kAefA.js +253 -0
- package/dist/less-AZUtS89I.js +162 -0
- package/dist/lexon-BcmgnyRb.js +157 -0
- package/dist/liquid-B2eRz5SA.js +240 -0
- package/dist/lua-Dz1RbATg.js +162 -0
- package/dist/m3-CIMooLFn.js +210 -0
- package/dist/markdown-C1BsCK9P.js +229 -0
- package/dist/markdown.contribution-DYYk6zUU.js +7 -0
- package/dist/mdx-BfV1HDRG.js +165 -0
- package/dist/mips-BovsnfLQ.js +198 -0
- package/dist/monaco.contribution-C-bQhUTI.js +114 -0
- package/dist/monaco.contribution-CCVvl3Jx.js +72 -0
- package/dist/monaco.contribution-Col-f0XR.js +164 -0
- package/dist/monaco.contribution-b5xkgQ-s.js +112 -0
- package/dist/msdax-CiRB2ZB-.js +375 -0
- package/dist/mysql-BwdpPE19.js +878 -0
- package/dist/objective-c-D4nfHfso.js +183 -0
- package/dist/pascal--j5-PYtz.js +251 -0
- package/dist/pascaligo-C7TcJxNL.js +164 -0
- package/dist/perl-BzEWqUb5.js +626 -0
- package/dist/pgsql-B_KZ0mGX.js +851 -0
- package/dist/php-A19QHzQV.js +500 -0
- package/dist/pla-COeKY1hA.js +137 -0
- package/dist/postiats-BfMp7zJL.js +907 -0
- package/dist/powerquery-B0TS_5Gb.js +890 -0
- package/dist/powershell-5jSbKdYB.js +239 -0
- package/dist/protobuf-YgnOutn3.js +420 -0
- package/dist/pug-DLej6kn5.js +402 -0
- package/dist/python-CQrZx9mR.js +301 -0
- package/dist/python.contribution-CcKs2Ktm.js +8 -0
- package/dist/qsharp-AhjqtSHB.js +301 -0
- package/dist/r-D-F4P80w.js +243 -0
- package/dist/razor-DWmpHMcx.js +550 -0
- package/dist/redis-hwwIlMnV.js +302 -0
- package/dist/redshift-Bcm_kjEG.js +809 -0
- package/dist/restructuredtext-CrdzfPP-.js +174 -0
- package/dist/ruby-QC2UNm1s.js +511 -0
- package/dist/rust-5aqiQ3L5.js +343 -0
- package/dist/sb-B1g1ZfLJ.js +115 -0
- package/dist/scala-C2U4R5Gb.js +370 -0
- package/dist/scheme-DeFRbslr.js +108 -0
- package/dist/scss-RSTCiCmI.js +262 -0
- package/dist/shell-BpF-iNu8.js +221 -0
- package/dist/shell.contribution-B80NZ3iO.js +7 -0
- package/dist/solidity-C00r2mbQ.js +1367 -0
- package/dist/sophia-DVW5ZKDB.js +199 -0
- package/dist/sparql-B0nmpxeX.js +201 -0
- package/dist/sql-CJwKPERn.js +853 -0
- package/dist/sql.contribution-DQy36aE5.js +7 -0
- package/dist/st-DPlKG5DT.js +416 -0
- package/dist/swift-YZBAbVHV.js +309 -0
- package/dist/systemverilog-CDQSaH63.js +576 -0
- package/dist/tcl-Dlu8sp6Q.js +232 -0
- package/dist/tsMode-Bh-v12OL.js +887 -0
- package/dist/twig-C5TO7-kw.js +392 -0
- package/dist/typescript-c7y6IZVP.js +343 -0
- package/dist/typespec-BsmjDEu7.js +117 -0
- package/dist/useFieldRendering-BIqeE3qo.js +6083 -0
- package/dist/vb-ChHvIDrk.js +372 -0
- package/dist/wgsl-XEp1ju8c.js +439 -0
- package/dist/xml-MAEprTnF.js +95 -0
- package/dist/xml.contribution-XMOaon8i.js +27 -0
- package/dist/yaml-C1p8rXG7.js +206 -0
- package/dist/yaml.contribution-DRRVhJmJ.js +8 -0
- package/package.json +88 -0
- package/src/__tests__/client-assigner.test.ts +341 -0
- package/src/__tests__/code-types.test.ts +30 -0
- package/src/__tests__/markdown-field.test.ts +34 -0
- package/src/__tests__/markdown-note-field.test.ts +135 -0
- package/src/__tests__/quiz-recorder.test.ts +195 -0
- package/src/__tests__/recorder-editor-content-sync.test.ts +172 -0
- package/src/__tests__/recorder-editor.test.ts +143 -0
- package/src/__tests__/recorder-render.test.ts +57 -0
- package/src/__tests__/recorder-wysiwyg-field-host.test.ts +33 -0
- package/src/__tests__/step-field.test.ts +270 -0
- package/src/__tests__/type-plugins.test.ts +59 -0
- package/src/__tests__/var-field-render.test.ts +26 -0
- package/src/client-assigner.ts +269 -0
- package/src/code-types.ts +94 -0
- package/src/components/AimdCodeField.vue +228 -0
- package/src/components/AimdDnaSequenceField.vue +983 -0
- package/src/components/AimdMarkdownField.vue +168 -0
- package/src/components/AimdMarkdownNoteField.vue +457 -0
- package/src/components/AimdQuizRecorder.vue +792 -0
- package/src/components/AimdRecorder.vue +1959 -0
- package/src/components/AimdRecorderEditor.vue +2281 -0
- package/src/components/AimdRecorderWysiwygFieldHost.vue +93 -0
- package/src/components/AimdRecorderWysiwygSurface.vue +487 -0
- package/src/components/AimdSeqVizViewer.vue +122 -0
- package/src/components/AimdStepCheckField.vue +453 -0
- package/src/components/AimdVarField.vue +213 -0
- package/src/components/AimdVarTableField.vue +516 -0
- package/src/components/DnaAnnotationEditor.vue +477 -0
- package/src/components/DnaSequenceEditor.vue +44 -0
- package/src/components/DnaSequenceToolbar.vue +98 -0
- package/src/components/DnaSequenceViewer.vue +162 -0
- package/src/components/index.ts +21 -0
- package/src/components/recorderMilkdownPlugin.ts +632 -0
- package/src/composables/__tests__/useDnaSequence.test.ts +467 -0
- package/src/composables/__tests__/useFieldAdapters.test.ts +115 -0
- package/src/composables/__tests__/useFocusManagement.test.ts +66 -0
- package/src/composables/__tests__/useRecordState.test.ts +586 -0
- package/src/composables/__tests__/useStepTimers.test.ts +64 -0
- package/src/composables/__tests__/useVarHelpers.test.ts +424 -0
- package/src/composables/__tests__/workbenchFieldEditing.test.ts +97 -0
- package/src/composables/index.ts +94 -0
- package/src/composables/useClientAssignerRunner.ts +74 -0
- package/src/composables/useDnaSequence.ts +400 -0
- package/src/composables/useDnaSequenceField.ts +316 -0
- package/src/composables/useFieldAdapters.ts +61 -0
- package/src/composables/useFieldRendering.ts +269 -0
- package/src/composables/useFocusManagement.ts +144 -0
- package/src/composables/useRecordState.ts +429 -0
- package/src/composables/useStepTimers.ts +243 -0
- package/src/composables/useVarHelpers.ts +545 -0
- package/src/composables/useVarTableDragDrop.ts +236 -0
- package/src/composables/workbenchFieldEditing.ts +705 -0
- package/src/css.d.ts +9 -0
- package/src/index.ts +65 -0
- package/src/locales.ts +559 -0
- package/src/monaco-code.ts +75 -0
- package/src/styles/aimd.css +994 -0
- package/src/type-plugins.ts +132 -0
- package/src/type-utils.ts +3 -0
- package/src/types.ts +191 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { m as l } from "./editor.api-CgD9w0gG.js";
|
|
2
|
+
var i = Object.defineProperty, c = Object.getOwnPropertyDescriptor, u = Object.getOwnPropertyNames, s = Object.prototype.hasOwnProperty, d = (n, e, r, o) => {
|
|
3
|
+
if (e && typeof e == "object" || typeof e == "function")
|
|
4
|
+
for (let t of u(e))
|
|
5
|
+
!s.call(n, t) && t !== r && i(n, t, { get: () => e[t], enumerable: !(o = c(e, t)) || o.enumerable });
|
|
6
|
+
return n;
|
|
7
|
+
}, m = (n, e, r) => (d(n, e, "default"), r), a = {};
|
|
8
|
+
m(a, l);
|
|
9
|
+
var p = {
|
|
10
|
+
comments: {
|
|
11
|
+
lineComment: "#"
|
|
12
|
+
},
|
|
13
|
+
brackets: [
|
|
14
|
+
["{", "}"],
|
|
15
|
+
["[", "]"],
|
|
16
|
+
["(", ")"]
|
|
17
|
+
],
|
|
18
|
+
autoClosingPairs: [
|
|
19
|
+
{ open: "{", close: "}" },
|
|
20
|
+
{ open: "[", close: "]" },
|
|
21
|
+
{ open: "(", close: ")" },
|
|
22
|
+
{ open: '"', close: '"' },
|
|
23
|
+
{ open: "'", close: "'" }
|
|
24
|
+
],
|
|
25
|
+
surroundingPairs: [
|
|
26
|
+
{ open: "{", close: "}" },
|
|
27
|
+
{ open: "[", close: "]" },
|
|
28
|
+
{ open: "(", close: ")" },
|
|
29
|
+
{ open: '"', close: '"' },
|
|
30
|
+
{ open: "'", close: "'" }
|
|
31
|
+
],
|
|
32
|
+
folding: {
|
|
33
|
+
offSide: !0
|
|
34
|
+
},
|
|
35
|
+
onEnterRules: [
|
|
36
|
+
{
|
|
37
|
+
beforeText: /:\s*$/,
|
|
38
|
+
action: {
|
|
39
|
+
indentAction: a.languages.IndentAction.Indent
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}, f = {
|
|
44
|
+
tokenPostfix: ".yaml",
|
|
45
|
+
brackets: [
|
|
46
|
+
{ token: "delimiter.bracket", open: "{", close: "}" },
|
|
47
|
+
{ token: "delimiter.square", open: "[", close: "]" }
|
|
48
|
+
],
|
|
49
|
+
keywords: ["true", "True", "TRUE", "false", "False", "FALSE", "null", "Null", "Null", "~"],
|
|
50
|
+
numberInteger: /(?:0|[+-]?[0-9]+)/,
|
|
51
|
+
numberFloat: /(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,
|
|
52
|
+
numberOctal: /0o[0-7]+/,
|
|
53
|
+
numberHex: /0x[0-9a-fA-F]+/,
|
|
54
|
+
numberInfinity: /[+-]?\.(?:inf|Inf|INF)/,
|
|
55
|
+
numberNaN: /\.(?:nan|Nan|NAN)/,
|
|
56
|
+
numberDate: /\d{4}-\d\d-\d\d([Tt ]\d\d:\d\d:\d\d(\.\d+)?(( ?[+-]\d\d?(:\d\d)?)|Z)?)?/,
|
|
57
|
+
escapes: /\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,
|
|
58
|
+
tokenizer: {
|
|
59
|
+
root: [
|
|
60
|
+
{ include: "@whitespace" },
|
|
61
|
+
{ include: "@comment" },
|
|
62
|
+
// Directive
|
|
63
|
+
[/%[^ ]+.*$/, "meta.directive"],
|
|
64
|
+
// Document Markers
|
|
65
|
+
[/---/, "operators.directivesEnd"],
|
|
66
|
+
[/\.{3}/, "operators.documentEnd"],
|
|
67
|
+
// Block Structure Indicators
|
|
68
|
+
[/[-?:](?= )/, "operators"],
|
|
69
|
+
{ include: "@anchor" },
|
|
70
|
+
{ include: "@tagHandle" },
|
|
71
|
+
{ include: "@flowCollections" },
|
|
72
|
+
{ include: "@blockStyle" },
|
|
73
|
+
// Numbers
|
|
74
|
+
[/@numberInteger(?![ \t]*\S+)/, "number"],
|
|
75
|
+
[/@numberFloat(?![ \t]*\S+)/, "number.float"],
|
|
76
|
+
[/@numberOctal(?![ \t]*\S+)/, "number.octal"],
|
|
77
|
+
[/@numberHex(?![ \t]*\S+)/, "number.hex"],
|
|
78
|
+
[/@numberInfinity(?![ \t]*\S+)/, "number.infinity"],
|
|
79
|
+
[/@numberNaN(?![ \t]*\S+)/, "number.nan"],
|
|
80
|
+
[/@numberDate(?![ \t]*\S+)/, "number.date"],
|
|
81
|
+
// Key:Value pair
|
|
82
|
+
[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/, ["type", "white", "operators", "white"]],
|
|
83
|
+
{ include: "@flowScalars" },
|
|
84
|
+
// String nodes
|
|
85
|
+
[
|
|
86
|
+
/.+?(?=(\s+#|$))/,
|
|
87
|
+
{
|
|
88
|
+
cases: {
|
|
89
|
+
"@keywords": "keyword",
|
|
90
|
+
"@default": "string"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
],
|
|
95
|
+
// Flow Collection: Flow Mapping
|
|
96
|
+
object: [
|
|
97
|
+
{ include: "@whitespace" },
|
|
98
|
+
{ include: "@comment" },
|
|
99
|
+
// Flow Mapping termination
|
|
100
|
+
[/\}/, "@brackets", "@pop"],
|
|
101
|
+
// Flow Mapping delimiter
|
|
102
|
+
[/,/, "delimiter.comma"],
|
|
103
|
+
// Flow Mapping Key:Value delimiter
|
|
104
|
+
[/:(?= )/, "operators"],
|
|
105
|
+
// Flow Mapping Key:Value key
|
|
106
|
+
[/(?:".*?"|'.*?'|[^,\{\[]+?)(?=: )/, "type"],
|
|
107
|
+
// Start Flow Style
|
|
108
|
+
{ include: "@flowCollections" },
|
|
109
|
+
{ include: "@flowScalars" },
|
|
110
|
+
// Scalar Data types
|
|
111
|
+
{ include: "@tagHandle" },
|
|
112
|
+
{ include: "@anchor" },
|
|
113
|
+
{ include: "@flowNumber" },
|
|
114
|
+
// Other value (keyword or string)
|
|
115
|
+
[
|
|
116
|
+
/[^\},]+/,
|
|
117
|
+
{
|
|
118
|
+
cases: {
|
|
119
|
+
"@keywords": "keyword",
|
|
120
|
+
"@default": "string"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
],
|
|
125
|
+
// Flow Collection: Flow Sequence
|
|
126
|
+
array: [
|
|
127
|
+
{ include: "@whitespace" },
|
|
128
|
+
{ include: "@comment" },
|
|
129
|
+
// Flow Sequence termination
|
|
130
|
+
[/\]/, "@brackets", "@pop"],
|
|
131
|
+
// Flow Sequence delimiter
|
|
132
|
+
[/,/, "delimiter.comma"],
|
|
133
|
+
// Start Flow Style
|
|
134
|
+
{ include: "@flowCollections" },
|
|
135
|
+
{ include: "@flowScalars" },
|
|
136
|
+
// Scalar Data types
|
|
137
|
+
{ include: "@tagHandle" },
|
|
138
|
+
{ include: "@anchor" },
|
|
139
|
+
{ include: "@flowNumber" },
|
|
140
|
+
// Other value (keyword or string)
|
|
141
|
+
[
|
|
142
|
+
/[^\],]+/,
|
|
143
|
+
{
|
|
144
|
+
cases: {
|
|
145
|
+
"@keywords": "keyword",
|
|
146
|
+
"@default": "string"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
],
|
|
151
|
+
// First line of a Block Style
|
|
152
|
+
multiString: [[/^( +).+$/, "string", "@multiStringContinued.$1"]],
|
|
153
|
+
// Further lines of a Block Style
|
|
154
|
+
// Workaround for indentation detection
|
|
155
|
+
multiStringContinued: [
|
|
156
|
+
[
|
|
157
|
+
/^( *).+$/,
|
|
158
|
+
{
|
|
159
|
+
cases: {
|
|
160
|
+
"$1==$S2": "string",
|
|
161
|
+
"@default": { token: "@rematch", next: "@popall" }
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
],
|
|
166
|
+
whitespace: [[/[ \t\r\n]+/, "white"]],
|
|
167
|
+
// Only line comments
|
|
168
|
+
comment: [[/#.*$/, "comment"]],
|
|
169
|
+
// Start Flow Collections
|
|
170
|
+
flowCollections: [
|
|
171
|
+
[/\[/, "@brackets", "@array"],
|
|
172
|
+
[/\{/, "@brackets", "@object"]
|
|
173
|
+
],
|
|
174
|
+
// Start Flow Scalars (quoted strings)
|
|
175
|
+
flowScalars: [
|
|
176
|
+
[/"([^"\\]|\\.)*$/, "string.invalid"],
|
|
177
|
+
[/'([^'\\]|\\.)*$/, "string.invalid"],
|
|
178
|
+
[/'[^']*'/, "string"],
|
|
179
|
+
[/"/, "string", "@doubleQuotedString"]
|
|
180
|
+
],
|
|
181
|
+
doubleQuotedString: [
|
|
182
|
+
[/[^\\"]+/, "string"],
|
|
183
|
+
[/@escapes/, "string.escape"],
|
|
184
|
+
[/\\./, "string.escape.invalid"],
|
|
185
|
+
[/"/, "string", "@pop"]
|
|
186
|
+
],
|
|
187
|
+
// Start Block Scalar
|
|
188
|
+
blockStyle: [[/[>|][0-9]*[+-]?$/, "operators", "@multiString"]],
|
|
189
|
+
// Numbers in Flow Collections (terminate with ,]})
|
|
190
|
+
flowNumber: [
|
|
191
|
+
[/@numberInteger(?=[ \t]*[,\]\}])/, "number"],
|
|
192
|
+
[/@numberFloat(?=[ \t]*[,\]\}])/, "number.float"],
|
|
193
|
+
[/@numberOctal(?=[ \t]*[,\]\}])/, "number.octal"],
|
|
194
|
+
[/@numberHex(?=[ \t]*[,\]\}])/, "number.hex"],
|
|
195
|
+
[/@numberInfinity(?=[ \t]*[,\]\}])/, "number.infinity"],
|
|
196
|
+
[/@numberNaN(?=[ \t]*[,\]\}])/, "number.nan"],
|
|
197
|
+
[/@numberDate(?=[ \t]*[,\]\}])/, "number.date"]
|
|
198
|
+
],
|
|
199
|
+
tagHandle: [[/\![^ ]*/, "tag"]],
|
|
200
|
+
anchor: [[/[&*][^ ]+/, "namespace"]]
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
export {
|
|
204
|
+
p as conf,
|
|
205
|
+
f as language
|
|
206
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@airalogy/aimd-recorder",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.14.1",
|
|
5
|
+
"description": "AIMD editor Vue components and UI",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/airalogy/aimd.git",
|
|
10
|
+
"directory": "packages/aimd-recorder"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/airalogy/aimd/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/airalogy/aimd/tree/main/packages/aimd-recorder#readme",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"aimd",
|
|
18
|
+
"markdown",
|
|
19
|
+
"editor",
|
|
20
|
+
"vue",
|
|
21
|
+
"components"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./src/index.ts",
|
|
26
|
+
"import": "./src/index.ts"
|
|
27
|
+
},
|
|
28
|
+
"./components": {
|
|
29
|
+
"types": "./src/components/index.ts",
|
|
30
|
+
"import": "./src/components/index.ts"
|
|
31
|
+
},
|
|
32
|
+
"./composables": {
|
|
33
|
+
"types": "./src/composables/index.ts",
|
|
34
|
+
"import": "./src/composables/index.ts"
|
|
35
|
+
},
|
|
36
|
+
"./styles": {
|
|
37
|
+
"import": "./src/styles/aimd.css",
|
|
38
|
+
"default": "./src/styles/aimd.css"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"main": "./src/index.ts",
|
|
42
|
+
"types": "./src/index.ts",
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"src"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"type-check": "vue-tsc --noEmit",
|
|
52
|
+
"build": "vite build",
|
|
53
|
+
"dev": "vite build --watch",
|
|
54
|
+
"test": "vitest run --config vitest.config.ts"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@vueuse/core": "^13.5.0",
|
|
58
|
+
"naive-ui": "2.41.0",
|
|
59
|
+
"vue": "^3.5.17"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@airalogy/aimd-editor": "workspace:^",
|
|
63
|
+
"@airalogy/aimd-core": "workspace:^",
|
|
64
|
+
"@airalogy/aimd-renderer": "workspace:^",
|
|
65
|
+
"@milkdown/kit": "^7.18.0",
|
|
66
|
+
"monaco-editor": "^0.52.2",
|
|
67
|
+
"react": "^19.2.4",
|
|
68
|
+
"react-dom": "^19.2.4",
|
|
69
|
+
"seqviz": "^3.10.18"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@types/node": "^24.3.0",
|
|
73
|
+
"@types/react": "^19.2.14",
|
|
74
|
+
"@types/react-dom": "^19.2.3",
|
|
75
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
76
|
+
"@vueuse/core": "^13.5.0",
|
|
77
|
+
"naive-ui": "2.41.0",
|
|
78
|
+
"sass": "^1.90.0",
|
|
79
|
+
"typescript": "5.8.3",
|
|
80
|
+
"unocss": "^0.58.3",
|
|
81
|
+
"unplugin-auto-import": "^0.17.3",
|
|
82
|
+
"unplugin-vue-components": "^0.27.4",
|
|
83
|
+
"vite": "^7.1.3",
|
|
84
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
85
|
+
"vue": "^3.5.17",
|
|
86
|
+
"vue-tsc": "^3.0.6"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { applyClientAssigners } from '../client-assigner'
|
|
4
|
+
import type { AimdClientAssignerField } from '@airalogy/aimd-core/types'
|
|
5
|
+
|
|
6
|
+
function makeAssigner(overrides: Partial<AimdClientAssignerField> & { id: string }): AimdClientAssignerField {
|
|
7
|
+
return {
|
|
8
|
+
runtime: 'client',
|
|
9
|
+
mode: 'auto',
|
|
10
|
+
function_source: 'function assign(fields) { return {}; }',
|
|
11
|
+
dependent_fields: [],
|
|
12
|
+
assigned_fields: [],
|
|
13
|
+
...overrides,
|
|
14
|
+
} as AimdClientAssignerField
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Basic compilation & execution
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
describe('client-assigner: compilation', () => {
|
|
22
|
+
it('compiles and executes a simple assigner', () => {
|
|
23
|
+
const assigners = [makeAssigner({
|
|
24
|
+
id: 'sum',
|
|
25
|
+
function_source: 'function assign(fields) { return { total: fields.a + fields.b }; }',
|
|
26
|
+
dependent_fields: ['a', 'b'],
|
|
27
|
+
assigned_fields: ['total'],
|
|
28
|
+
})]
|
|
29
|
+
|
|
30
|
+
const values: Record<string, unknown> = { a: 10, b: 20, total: 0 }
|
|
31
|
+
const result = applyClientAssigners(assigners, values)
|
|
32
|
+
|
|
33
|
+
expect(result.changed).toBe(true)
|
|
34
|
+
expect(result.changedFields).toContain('total')
|
|
35
|
+
expect(values.total).toBe(30)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('handles local variables in function body', () => {
|
|
39
|
+
const assigners = [makeAssigner({
|
|
40
|
+
id: 'calc',
|
|
41
|
+
function_source: 'function assign(fields) { var x = fields.a * 2; return { result: x }; }',
|
|
42
|
+
dependent_fields: ['a'],
|
|
43
|
+
assigned_fields: ['result'],
|
|
44
|
+
})]
|
|
45
|
+
|
|
46
|
+
const values: Record<string, unknown> = { a: 5, result: 0 }
|
|
47
|
+
applyClientAssigners(assigners, values)
|
|
48
|
+
expect(values.result).toBe(10)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('reports no change when values are identical', () => {
|
|
52
|
+
const assigners = [makeAssigner({
|
|
53
|
+
id: 'noop',
|
|
54
|
+
function_source: 'function assign(fields) { return { x: fields.x }; }',
|
|
55
|
+
dependent_fields: ['x'],
|
|
56
|
+
assigned_fields: ['x'],
|
|
57
|
+
})]
|
|
58
|
+
|
|
59
|
+
const values: Record<string, unknown> = { x: 42 }
|
|
60
|
+
const result = applyClientAssigners(assigners, values)
|
|
61
|
+
expect(result.changed).toBe(false)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it('returns empty result for no assigners', () => {
|
|
65
|
+
const result = applyClientAssigners([], {})
|
|
66
|
+
expect(result.changed).toBe(false)
|
|
67
|
+
expect(result.changedFields).toEqual([])
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
// Execution modes
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
|
|
75
|
+
describe('client-assigner: modes', () => {
|
|
76
|
+
it('skips manual mode without explicit trigger', () => {
|
|
77
|
+
const assigners = [makeAssigner({
|
|
78
|
+
id: 'manual_calc',
|
|
79
|
+
mode: 'manual',
|
|
80
|
+
function_source: 'function assign(fields) { return { y: 999 }; }',
|
|
81
|
+
dependent_fields: ['x'],
|
|
82
|
+
assigned_fields: ['y'],
|
|
83
|
+
})]
|
|
84
|
+
|
|
85
|
+
const values: Record<string, unknown> = { x: 1, y: 0 }
|
|
86
|
+
applyClientAssigners(assigners, values)
|
|
87
|
+
expect(values.y).toBe(0)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
it('runs manual mode with explicit trigger', () => {
|
|
91
|
+
const assigners = [makeAssigner({
|
|
92
|
+
id: 'manual_calc',
|
|
93
|
+
mode: 'manual',
|
|
94
|
+
function_source: 'function assign(fields) { return { y: 999 }; }',
|
|
95
|
+
dependent_fields: ['x'],
|
|
96
|
+
assigned_fields: ['y'],
|
|
97
|
+
})]
|
|
98
|
+
|
|
99
|
+
const values: Record<string, unknown> = { x: 1, y: 0 }
|
|
100
|
+
applyClientAssigners(assigners, values, { triggerIds: ['manual_calc'] })
|
|
101
|
+
expect(values.y).toBe(999)
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('auto_first runs only when assigned fields are empty', () => {
|
|
105
|
+
const assigners = [makeAssigner({
|
|
106
|
+
id: 'init',
|
|
107
|
+
mode: 'auto_first',
|
|
108
|
+
function_source: 'function assign(fields) { return { y: fields.x * 2 }; }',
|
|
109
|
+
dependent_fields: ['x'],
|
|
110
|
+
assigned_fields: ['y'],
|
|
111
|
+
})]
|
|
112
|
+
|
|
113
|
+
// y is empty → should run
|
|
114
|
+
const values1: Record<string, unknown> = { x: 5, y: '' }
|
|
115
|
+
applyClientAssigners(assigners, values1)
|
|
116
|
+
expect(values1.y).toBe(10)
|
|
117
|
+
|
|
118
|
+
// y is already set → should NOT run
|
|
119
|
+
const values2: Record<string, unknown> = { x: 5, y: 10 }
|
|
120
|
+
applyClientAssigners(assigners, values2)
|
|
121
|
+
expect(values2.y).toBe(10)
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it('auto_force always runs', () => {
|
|
125
|
+
const assigners = [makeAssigner({
|
|
126
|
+
id: 'force',
|
|
127
|
+
mode: 'auto',
|
|
128
|
+
function_source: 'function assign(fields) { return { y: fields.x + 1 }; }',
|
|
129
|
+
dependent_fields: ['x'],
|
|
130
|
+
assigned_fields: ['y'],
|
|
131
|
+
})]
|
|
132
|
+
|
|
133
|
+
const values: Record<string, unknown> = { x: 5, y: 100 }
|
|
134
|
+
applyClientAssigners(assigners, values)
|
|
135
|
+
expect(values.y).toBe(6)
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// Dependency ordering
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
|
|
143
|
+
describe('client-assigner: dependency ordering', () => {
|
|
144
|
+
it('executes assigners in dependency order', () => {
|
|
145
|
+
const assigners = [
|
|
146
|
+
makeAssigner({
|
|
147
|
+
id: 'second',
|
|
148
|
+
function_source: 'function assign(fields) { return { c: fields.b + 1 }; }',
|
|
149
|
+
dependent_fields: ['b'],
|
|
150
|
+
assigned_fields: ['c'],
|
|
151
|
+
}),
|
|
152
|
+
makeAssigner({
|
|
153
|
+
id: 'first',
|
|
154
|
+
function_source: 'function assign(fields) { return { b: fields.a + 1 }; }',
|
|
155
|
+
dependent_fields: ['a'],
|
|
156
|
+
assigned_fields: ['b'],
|
|
157
|
+
}),
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
const values: Record<string, unknown> = { a: 1, b: 0, c: 0 }
|
|
161
|
+
applyClientAssigners(assigners, values)
|
|
162
|
+
expect(values.b).toBe(2)
|
|
163
|
+
expect(values.c).toBe(3)
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
it('skips assigners with unready dependencies', () => {
|
|
167
|
+
const assigners = [makeAssigner({
|
|
168
|
+
id: 'calc',
|
|
169
|
+
function_source: 'function assign(fields) { return { y: fields.x + 1 }; }',
|
|
170
|
+
dependent_fields: ['x'],
|
|
171
|
+
assigned_fields: ['y'],
|
|
172
|
+
})]
|
|
173
|
+
|
|
174
|
+
const values: Record<string, unknown> = { x: '', y: 0 }
|
|
175
|
+
const result = applyClientAssigners(assigners, values)
|
|
176
|
+
expect(result.changed).toBe(false)
|
|
177
|
+
expect(values.y).toBe(0)
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
// ---------------------------------------------------------------------------
|
|
182
|
+
// Error handling
|
|
183
|
+
// ---------------------------------------------------------------------------
|
|
184
|
+
|
|
185
|
+
describe('client-assigner: error handling', () => {
|
|
186
|
+
it('throws if assigner returns non-object', () => {
|
|
187
|
+
const assigners = [makeAssigner({
|
|
188
|
+
id: 'bad',
|
|
189
|
+
function_source: 'function assign(fields) { return 42; }',
|
|
190
|
+
dependent_fields: [],
|
|
191
|
+
assigned_fields: ['x'],
|
|
192
|
+
})]
|
|
193
|
+
|
|
194
|
+
const values: Record<string, unknown> = { x: 0 }
|
|
195
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow('must return an object')
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
it('throws if missing assigned fields', () => {
|
|
199
|
+
const assigners = [makeAssigner({
|
|
200
|
+
id: 'bad',
|
|
201
|
+
function_source: 'function assign(fields) { return {}; }',
|
|
202
|
+
dependent_fields: [],
|
|
203
|
+
assigned_fields: ['x'],
|
|
204
|
+
})]
|
|
205
|
+
|
|
206
|
+
const values: Record<string, unknown> = { x: 0 }
|
|
207
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow('missing assigned fields')
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it('throws if extra fields returned', () => {
|
|
211
|
+
const assigners = [makeAssigner({
|
|
212
|
+
id: 'bad',
|
|
213
|
+
function_source: 'function assign(fields) { return { x: 1, extra: 2 }; }',
|
|
214
|
+
dependent_fields: [],
|
|
215
|
+
assigned_fields: ['x'],
|
|
216
|
+
})]
|
|
217
|
+
|
|
218
|
+
const values: Record<string, unknown> = { x: 0 }
|
|
219
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow('not declared in assigned_fields')
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
// ---------------------------------------------------------------------------
|
|
224
|
+
// Sandbox & security
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
|
|
227
|
+
describe('client-assigner: sandbox escape prevention', () => {
|
|
228
|
+
it('rejects function source referencing window', () => {
|
|
229
|
+
const assigners = [makeAssigner({
|
|
230
|
+
id: 'escape_win',
|
|
231
|
+
function_source: 'function assign(fields) { return { x: typeof window }; }',
|
|
232
|
+
dependent_fields: [],
|
|
233
|
+
assigned_fields: ['x'],
|
|
234
|
+
})]
|
|
235
|
+
|
|
236
|
+
const values: Record<string, unknown> = { x: '' }
|
|
237
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow()
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
it('rejects function source referencing document', () => {
|
|
241
|
+
const assigners = [makeAssigner({
|
|
242
|
+
id: 'escape_doc',
|
|
243
|
+
function_source: 'function assign(fields) { return { x: typeof document }; }',
|
|
244
|
+
dependent_fields: [],
|
|
245
|
+
assigned_fields: ['x'],
|
|
246
|
+
})]
|
|
247
|
+
|
|
248
|
+
const values: Record<string, unknown> = { x: '' }
|
|
249
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow()
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it('rejects function source referencing globalThis', () => {
|
|
253
|
+
const assigners = [makeAssigner({
|
|
254
|
+
id: 'escape_gt',
|
|
255
|
+
function_source: 'function assign(fields) { return { x: typeof globalThis }; }',
|
|
256
|
+
dependent_fields: [],
|
|
257
|
+
assigned_fields: ['x'],
|
|
258
|
+
})]
|
|
259
|
+
|
|
260
|
+
const values: Record<string, unknown> = { x: '' }
|
|
261
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow()
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
it('rejects function source referencing fetch', () => {
|
|
265
|
+
const assigners = [makeAssigner({
|
|
266
|
+
id: 'escape_fetch',
|
|
267
|
+
function_source: 'function assign(fields) { return { x: typeof fetch }; }',
|
|
268
|
+
dependent_fields: [],
|
|
269
|
+
assigned_fields: ['x'],
|
|
270
|
+
})]
|
|
271
|
+
|
|
272
|
+
const values: Record<string, unknown> = { x: '' }
|
|
273
|
+
expect(() => applyClientAssigners(assigners, values)).toThrow()
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
it('has access to safe Math', () => {
|
|
277
|
+
const assigners = [makeAssigner({
|
|
278
|
+
id: 'math_test',
|
|
279
|
+
function_source: 'function assign(fields) { return { x: Math.round(3.7) }; }',
|
|
280
|
+
dependent_fields: [],
|
|
281
|
+
assigned_fields: ['x'],
|
|
282
|
+
})]
|
|
283
|
+
|
|
284
|
+
const values: Record<string, unknown> = { x: 0 }
|
|
285
|
+
applyClientAssigners(assigners, values)
|
|
286
|
+
expect(values.x).toBe(4)
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
it('has access to safe JSON', () => {
|
|
290
|
+
const assigners = [makeAssigner({
|
|
291
|
+
id: 'json_test',
|
|
292
|
+
function_source: 'function assign(fields) { return { x: JSON.parse(JSON.stringify({a:1})) }; }',
|
|
293
|
+
dependent_fields: [],
|
|
294
|
+
assigned_fields: ['x'],
|
|
295
|
+
})]
|
|
296
|
+
|
|
297
|
+
const values: Record<string, unknown> = { x: null }
|
|
298
|
+
applyClientAssigners(assigners, values)
|
|
299
|
+
expect(values.x).toEqual({ a: 1 })
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
it('has access to safe Object methods', () => {
|
|
303
|
+
const assigners = [makeAssigner({
|
|
304
|
+
id: 'obj_test',
|
|
305
|
+
function_source: 'function assign(fields) { return { x: Object.keys(fields).length }; }',
|
|
306
|
+
dependent_fields: ['a', 'b'],
|
|
307
|
+
assigned_fields: ['x'],
|
|
308
|
+
})]
|
|
309
|
+
|
|
310
|
+
const values: Record<string, unknown> = { a: 1, b: 2, x: 0 }
|
|
311
|
+
applyClientAssigners(assigners, values)
|
|
312
|
+
expect(values.x).toBe(2)
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
it('has access to safe Array.isArray', () => {
|
|
316
|
+
const assigners = [makeAssigner({
|
|
317
|
+
id: 'arr_test',
|
|
318
|
+
function_source: 'function assign(fields) { return { x: Array.isArray(fields.data) }; }',
|
|
319
|
+
dependent_fields: ['data'],
|
|
320
|
+
assigned_fields: ['x'],
|
|
321
|
+
})]
|
|
322
|
+
|
|
323
|
+
const values: Record<string, unknown> = { data: [1, 2], x: false }
|
|
324
|
+
applyClientAssigners(assigners, values)
|
|
325
|
+
expect(values.x).toBe(true)
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
it('clones dependent field values (no mutation leak)', () => {
|
|
329
|
+
const assigners = [makeAssigner({
|
|
330
|
+
id: 'mutate_test',
|
|
331
|
+
function_source: 'function assign(fields) { fields.data.push(99); return { x: fields.data.length }; }',
|
|
332
|
+
dependent_fields: ['data'],
|
|
333
|
+
assigned_fields: ['x'],
|
|
334
|
+
})]
|
|
335
|
+
|
|
336
|
+
const originalData = [1, 2, 3]
|
|
337
|
+
const values: Record<string, unknown> = { data: originalData, x: 0 }
|
|
338
|
+
applyClientAssigners(assigners, values)
|
|
339
|
+
expect(originalData).toEqual([1, 2, 3])
|
|
340
|
+
})
|
|
341
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { isAimdCodeEditorType, resolveAimdCodeEditorLanguage } from '../code-types'
|
|
4
|
+
|
|
5
|
+
describe('code-types', () => {
|
|
6
|
+
it('maps built-in Airalogy CodeStr types to Monaco languages', () => {
|
|
7
|
+
expect(resolveAimdCodeEditorLanguage('PyStr')).toBe('python')
|
|
8
|
+
expect(resolveAimdCodeEditorLanguage('JsStr')).toBe('javascript')
|
|
9
|
+
expect(resolveAimdCodeEditorLanguage('TsStr')).toBe('typescript')
|
|
10
|
+
expect(resolveAimdCodeEditorLanguage('JsonStr')).toBe('json')
|
|
11
|
+
expect(resolveAimdCodeEditorLanguage('YamlStr')).toBe('yaml')
|
|
12
|
+
expect(resolveAimdCodeEditorLanguage('TomlStr')).toBe('ini')
|
|
13
|
+
expect(resolveAimdCodeEditorLanguage('CodeStr')).toBe('plaintext')
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('accepts field-meta overrides for generic code editors', () => {
|
|
17
|
+
expect(resolveAimdCodeEditorLanguage('str', { codeLanguage: 'python' })).toBe('python')
|
|
18
|
+
expect(resolveAimdCodeEditorLanguage('str', { inputType: 'yaml' })).toBe('yaml')
|
|
19
|
+
expect(resolveAimdCodeEditorLanguage('str', { inputType: 'code', codeLanguage: 'sql' })).toBe('sql')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('distinguishes code-like and non-code fields', () => {
|
|
23
|
+
expect(isAimdCodeEditorType('PyStr')).toBe(true)
|
|
24
|
+
expect(isAimdCodeEditorType('CodeStr')).toBe(true)
|
|
25
|
+
expect(isAimdCodeEditorType('str', { inputType: 'code' })).toBe(true)
|
|
26
|
+
expect(isAimdCodeEditorType('str', { codeLanguage: 'python' })).toBe(true)
|
|
27
|
+
expect(isAimdCodeEditorType('str')).toBe(false)
|
|
28
|
+
expect(isAimdCodeEditorType('markdown', { inputType: 'text' })).toBe(false)
|
|
29
|
+
})
|
|
30
|
+
})
|