@airalogy/aimd-recorder 1.29.0 → 1.29.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/dist/components.js +2732 -2705
- package/package.json +3 -3
- package/src/__tests__/field-panel.test.ts +20 -0
- package/src/components/AimdRecorder.vue +40 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airalogy/aimd-recorder",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.29.
|
|
4
|
+
"version": "1.29.1",
|
|
5
5
|
"description": "AIMD (Airalogy Markdown) recorder Vue components and UI",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"react": "^19.2.4",
|
|
68
68
|
"react-dom": "^19.2.4",
|
|
69
69
|
"seqviz": "^3.10.18",
|
|
70
|
+
"@airalogy/aimd-core": "^2.18.1",
|
|
70
71
|
"@airalogy/aimd-editor": "^1.14.0",
|
|
71
|
-
"@airalogy/aimd-renderer": "^2.14.0"
|
|
72
|
-
"@airalogy/aimd-core": "^2.18.1"
|
|
72
|
+
"@airalogy/aimd-renderer": "^2.14.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "^24.3.0",
|
|
@@ -9,6 +9,26 @@ describe('standalone field panel', () => {
|
|
|
9
9
|
'{{var|photo: FileIdJPG | None = None, title="Label photo"}}',
|
|
10
10
|
'{{check|inspect, title="Inspect label"}} {{check|legacy}}',
|
|
11
11
|
].join('\n\n')
|
|
12
|
+
it('finishes a pointer activation before an adjacent required-field error changes the layout', async () => {
|
|
13
|
+
const panel = mount(AimdRecorder, { props: {
|
|
14
|
+
content: '{{var|location: str}} {{var|photo: FileIdJPG | None = None}}',
|
|
15
|
+
layout: 'field-panel', validationTriggers: ['blur'],
|
|
16
|
+
} })
|
|
17
|
+
try {
|
|
18
|
+
await flushPromises()
|
|
19
|
+
const target = panel.get('[data-panel-field="var:photo"] button')
|
|
20
|
+
const location = panel.get('[data-rec-focus-key="var:location"]')
|
|
21
|
+
await target.trigger('pointerdown', { button: 0 })
|
|
22
|
+
await location.trigger('blur')
|
|
23
|
+
await flushPromises()
|
|
24
|
+
expect(panel.find('[role=alert]').exists()).toBe(false)
|
|
25
|
+
window.dispatchEvent(new MouseEvent('click'))
|
|
26
|
+
await vi.waitFor(() => expect(panel.find('[role=alert]').exists()).toBe(true))
|
|
27
|
+
} finally {
|
|
28
|
+
panel.unmount()
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
12
32
|
it('uses unique titled fields, keeps authored hints, and navigates by stable keys', async () => {
|
|
13
33
|
const panel = mount(AimdRecorder, { props: { content, layout: 'field-panel', locale: 'en-US' } })
|
|
14
34
|
await flushPromises()
|
|
@@ -879,8 +879,45 @@ async function validateField(
|
|
|
879
879
|
return result
|
|
880
880
|
}
|
|
881
881
|
|
|
882
|
+
// A blur error can move the next control between pointerdown and click.
|
|
883
|
+
let panelGesture: AbortController | undefined
|
|
884
|
+
let panelValidationTimer: ReturnType<typeof setTimeout> | undefined
|
|
885
|
+
const pendingPanelBlurs = new Set<string>()
|
|
886
|
+
|
|
887
|
+
function endPanelGesture() {
|
|
888
|
+
panelGesture?.abort()
|
|
889
|
+
panelGesture = undefined
|
|
890
|
+
clearTimeout(panelValidationTimer)
|
|
891
|
+
for (const key of pendingPanelBlurs) void validateField(key, { trigger: "blur" })
|
|
892
|
+
pendingPanelBlurs.clear()
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
function beginPanelGesture(event: PointerEvent) {
|
|
896
|
+
if (!inPanel.value || event.button !== 0) return
|
|
897
|
+
endPanelGesture()
|
|
898
|
+
const view = (event.currentTarget as HTMLElement).ownerDocument.defaultView
|
|
899
|
+
if (!view) return
|
|
900
|
+
panelGesture = new AbortController()
|
|
901
|
+
const options = { capture: true, signal: panelGesture.signal }
|
|
902
|
+
const afterClick = () => {
|
|
903
|
+
clearTimeout(panelValidationTimer)
|
|
904
|
+
panelValidationTimer = setTimeout(endPanelGesture, 0)
|
|
905
|
+
}
|
|
906
|
+
view.addEventListener("click", afterClick, options)
|
|
907
|
+
// Some gestures finish outside the panel and never dispatch a click.
|
|
908
|
+
view.addEventListener("pointerup", () => {
|
|
909
|
+
panelValidationTimer = setTimeout(endPanelGesture, 350)
|
|
910
|
+
}, options)
|
|
911
|
+
view.addEventListener("pointercancel", endPanelGesture, options)
|
|
912
|
+
view.addEventListener("blur", endPanelGesture, { signal: panelGesture.signal })
|
|
913
|
+
}
|
|
914
|
+
|
|
882
915
|
function triggerFieldValidation(trigger: Exclude<AimdRecorderValidationTrigger, "submit">, fieldKey: string) {
|
|
883
916
|
if (!props.validationTriggers.includes(trigger)) return
|
|
917
|
+
if (trigger === "blur" && panelGesture) {
|
|
918
|
+
pendingPanelBlurs.add(fieldKey)
|
|
919
|
+
return
|
|
920
|
+
}
|
|
884
921
|
void validateField(fieldKey, { trigger })
|
|
885
922
|
}
|
|
886
923
|
|
|
@@ -2099,6 +2136,8 @@ watch(
|
|
|
2099
2136
|
)
|
|
2100
2137
|
|
|
2101
2138
|
onBeforeUnmount(() => {
|
|
2139
|
+
pendingPanelBlurs.clear()
|
|
2140
|
+
endPanelGesture()
|
|
2102
2141
|
collectorRuntime.stopAll({ resetPermissions: true })
|
|
2103
2142
|
for (const controller of serverAssignerAbortControllers.values()) {
|
|
2104
2143
|
controller.abort()
|
|
@@ -2158,7 +2197,7 @@ defineExpose({
|
|
|
2158
2197
|
</span>
|
|
2159
2198
|
</div>
|
|
2160
2199
|
|
|
2161
|
-
<div v-if="inlineNodes.length" ref="contentRoot" class="aimd-protocol-recorder__content aimd-renderer">
|
|
2200
|
+
<div v-if="inlineNodes.length" ref="contentRoot" class="aimd-protocol-recorder__content aimd-renderer" @pointerdown.capture="beginPanelGesture">
|
|
2162
2201
|
<InlineNodesOutlet :nodes="inlineNodes" />
|
|
2163
2202
|
</div>
|
|
2164
2203
|
|