@airalogy/aimd-editor 1.12.0 → 1.13.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 +24 -0
- package/README.zh-CN.md +24 -0
- package/dist/AimdEditorTopBar.vue_vue_type_script_setup_true_lang-x8F65dCh.js +2277 -0
- package/dist/{AimdSourceEditor.vue_vue_type_script_setup_true_lang-CJJTlVZ7.js → AimdSourceEditor.vue_vue_type_script_setup_true_lang-m07PHAyw.js} +29 -27
- package/dist/{AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-Dme3UQEf.js → AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-8nbo78nG.js} +6118 -5822
- package/dist/aimd-editor.css +1 -1
- package/dist/authoring.js +15 -8
- package/dist/embedded.js +2 -2
- package/dist/fields-DZsN-S-N.js +51 -0
- package/dist/fig-DzERhLmG.js +219 -0
- package/dist/index.js +54 -45
- package/dist/{index-BqB8Xukp.js → lexer-Dj-IVtCT.js} +932 -1053
- package/dist/vue.js +28 -26
- package/dist/wysiwyg.js +1 -1
- package/package.json +4 -3
- package/src/__tests__/check-authoring.test.ts +46 -0
- package/src/__tests__/code-block-metadata.test.ts +40 -0
- package/src/__tests__/input-authoring.test.ts +93 -0
- package/src/__tests__/input-dialog-layout.test.ts +52 -0
- package/src/__tests__/input-toolbar.test.ts +88 -0
- package/src/__tests__/multiline-field-roundtrip.test.ts +70 -0
- package/src/__tests__/quoted-inline-roundtrip.test.ts +80 -0
- package/src/__tests__/step-authoring.test.ts +62 -0
- package/src/__tests__/type-picker.test.ts +48 -0
- package/src/authoring/fields.ts +86 -0
- package/src/authoring/index.ts +1 -0
- package/src/vue/AimdEditor.vue +112 -0
- package/src/vue/AimdEditorToolbar.vue +4 -1
- package/src/vue/AimdFieldDialog.vue +14 -9
- package/src/vue/AimdInputFieldDialog.vue +166 -0
- package/src/vue/AimdInputToolbar.vue +77 -0
- package/src/vue/AimdStepFieldDialog.vue +112 -0
- package/src/vue/AimdTypePicker.vue +42 -0
- package/src/vue/AimdWysiwygEditor.vue +24 -2
- package/src/vue/aimdInlineMarkdownNormalization.ts +37 -5
- package/src/vue/index.ts +2 -0
- package/src/vue/locales.ts +94 -7
- package/src/vue/milkdown-aimd-plugin.ts +148 -16
- package/src/vue/milkdown-code-block-metadata.ts +46 -0
- package/src/vue/types.ts +6 -4
- package/dist/AimdEditorTopBar.vue_vue_type_script_setup_true_lang-BXsn4cFX.js +0 -1171
package/README.md
CHANGED
|
@@ -36,6 +36,30 @@ source = prepared.content
|
|
|
36
36
|
|
|
37
37
|
Do not call this normalizer from automatic draft saving. `AimdSourceEditor` separately diagnoses closed figures with missing IDs and offers a generate-ID quick fix without rewriting incomplete input.
|
|
38
38
|
|
|
39
|
+
## Input Field Authoring
|
|
40
|
+
|
|
41
|
+
The toolbar provides Text, Integer, Decimal, Single choice, Multiple choice, and Yes/no shortcuts. More inputs contains dates, times, date/time, text lists, attachments, and custom types. Each shortcut opens a preselected form; choices are entered one per line without writing type syntax. A unique `field_1`, `field_2`, etc. ID is generated and written into AIMD on insertion; existing IDs never change just because fields move. Names are optional. Advanced settings expose the editable ID, custom type, and default value, with invalid or duplicate IDs rejected.
|
|
42
|
+
|
|
43
|
+
Use `mode="wysiwyg" field-display="compact"` to hide technical syntax in visual field placeholders. Click a placeholder to edit its properties. The package defaults remain source mode and detailed display. For actual data entry in the same editable document, use `AimdRecorderWysiwygSurface` from `@airalogy/aimd-recorder`; `AimdEditor` edits definitions, not Record values.
|
|
44
|
+
|
|
45
|
+
`collectAimdFieldIds`, `createAimdFieldId`, and `updateAimdInputField` are available from `@airalogy/aimd-editor/authoring`, and `AimdInputFieldDialog` is available from `@airalogy/aimd-editor/vue` for host integrations.
|
|
46
|
+
|
|
47
|
+
The input configuration dialog stays centered in the current viewport even when the host resets element margins. It keeps spacing on narrow screens and scrolls internally when its content is too tall.
|
|
48
|
+
|
|
49
|
+
Multiline `var_table` declarations remain structured fields in visual mode. Switching modes and saving preserves nested column IDs, titles, types and constraints; their `var(...)` definitions are not displayed as column labels.
|
|
50
|
+
|
|
51
|
+
## Step Authoring
|
|
52
|
+
|
|
53
|
+
The Step action opens `AimdStepFieldDialog`: names are optional, IDs are generated, and Advanced settings expose level and timer options. Existing IDs stay read-only when editing a title. The reusable `updateAimdStepField` authoring helper preserves unrelated parameters and stable identities. `{{step|mix, title="Mix sample", check=True}}` keeps its instructions in ordinary Markdown, not in the title. Recorder owns filled values and timing state.
|
|
54
|
+
|
|
55
|
+
## Checkpoint and Advanced Input Authoring
|
|
56
|
+
|
|
57
|
+
Quoted AIMD-looking text, such as `checked_message="Keep {{ref_var|wait_s}} literal"`, stays inside its parent field in visual mode and survives saving and reopening. Only references in ordinary document text become separate reference nodes.
|
|
58
|
+
|
|
59
|
+
The Checkpoint action also accepts an optional name, generates a persistent ID, and keeps existing IDs read-only. `AimdStepFieldDialog` accepts `fieldType="check"`; `updateAimdCheckField` preserves the ID while editing the title and checked message. Instructions stay in Markdown; recorded values belong to Recorder.
|
|
60
|
+
|
|
61
|
+
**Advanced / custom** offers all built-in types from the generated Python registry and host `varTypePlugins`, with a free-edit type expression below. Selecting a known type preserves nullability; expressions such as `list[MyType] | None` remain editable. Listing a custom type does not install its Python definition or a Recorder widget.
|
|
62
|
+
|
|
39
63
|
## Vue Editor i18n
|
|
40
64
|
|
|
41
65
|
```vue
|
package/README.zh-CN.md
CHANGED
|
@@ -36,6 +36,30 @@ source = prepared.content
|
|
|
36
36
|
|
|
37
37
|
不要在自动草稿保存中调用这个规范化函数。`AimdSourceEditor` 会单独诊断已闭合且缺失 ID 的图片,并提供生成 ID 的快速修复,不会改写未完成的输入。
|
|
38
38
|
|
|
39
|
+
## 输入框编辑
|
|
40
|
+
|
|
41
|
+
工具栏提供“文本、整数、小数、单选、多选、是/否”快捷入口,“更多输入框”收纳日期、时间、日期时间、文本列表、附件及其他类型。点击后直接打开对应类型的配置;单选和多选只需逐行填写选项,不必写类型语法。插入时自动生成唯一的 `field_1`、`field_2` 等 ID 并写入 AIMD;移动字段不会重新编号。名称选填,高级设置中可修改 ID、自定义类型和默认值,非法或重复的 ID 会被阻止。
|
|
42
|
+
|
|
43
|
+
设置 `mode="wysiwyg" field-display="compact"` 可隐藏可视化占位块中的技术语法,点击占位块可修改属性。组件默认仍为源码模式和详细显示。如果需要在同一文档里编辑说明文字并直接填写数据,使用 `@airalogy/aimd-recorder` 的 `AimdRecorderWysiwygSurface`;`AimdEditor` 只编辑定义,不填写 Record 值。
|
|
44
|
+
|
|
45
|
+
宿主可从 `@airalogy/aimd-editor/authoring` 复用 `collectAimdFieldIds`、`createAimdFieldId`、`updateAimdInputField`,从 `@airalogy/aimd-editor/vue` 复用 `AimdInputFieldDialog`。
|
|
46
|
+
|
|
47
|
+
输入框配置对话框始终在当前视口居中,不受宿主全局边距重置影响;窄屏下保留边距,内容过高时在对话框内部滚动。
|
|
48
|
+
|
|
49
|
+
多行 `var_table` 声明在可视化模式中保持为结构化字段,切换模式和保存时保留子列的 ID、标题、类型及约束,不会把 `var(...)` 定义文本显示为列名。
|
|
50
|
+
|
|
51
|
+
## 步骤编辑
|
|
52
|
+
|
|
53
|
+
“步骤”操作打开 `AimdStepFieldDialog`:名称选填,ID 自动生成,高级设置提供层级与计时参数。编辑名称时已有 ID 保持只读。可复用的 `updateAimdStepField` 编辑辅助函数保留其他参数和稳定身份。`{{step|mix, title="混匀样品", check=True}}` 的操作说明仍写在普通 Markdown 正文中,而非标题里。填写值和计时状态由 Recorder 管理。
|
|
54
|
+
|
|
55
|
+
## 检查点与高级输入框
|
|
56
|
+
|
|
57
|
+
引号内类似 AIMD 的文字,例如 `checked_message="保留字面文本 {{ref_var|wait_s}}"`,在可视化模式和保存后重新打开时仍属于外层字段,不会被截断。只有普通正文中的引用会成为独立引用节点。
|
|
58
|
+
|
|
59
|
+
“检查点”操作也支持选填名称、自动生成稳定 ID,并保持已有 ID 只读。`AimdStepFieldDialog` 可传入 `fieldType="check"`;`updateAimdCheckField` 在编辑标题和勾选后提示时保留 ID。检查正文仍写在 Markdown 中,已填数据由 Recorder 管理。
|
|
60
|
+
|
|
61
|
+
“高级 / 自定义”列出从 Python 注册表生成的全部内置类型及宿主 `varTypePlugins`,下方保留可自由编辑的类型表达式。选择已有类型时保留可空设置,仍可输入 `list[MyType] | None` 等表达式。列出自定义类型并不等于安装其 Python 定义或 Recorder 控件。
|
|
62
|
+
|
|
39
63
|
## Vue 编辑器 i18n
|
|
40
64
|
|
|
41
65
|
```vue
|