@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
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
2
|
+
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
|
3
|
+
import { getAimdBuiltInTypeNames } from '@airalogy/aimd-core/utils'
|
|
4
|
+
import { parseVarDefinition } from '@airalogy/aimd-core/parser'
|
|
5
|
+
import AimdTypePicker from '../vue/AimdTypePicker.vue'
|
|
6
|
+
import AimdInputFieldDialog from '../vue/AimdInputFieldDialog.vue'
|
|
7
|
+
import { createAimdEditorMessages } from '../vue/locales'
|
|
8
|
+
|
|
9
|
+
const messages = createAimdEditorMessages('en-US')
|
|
10
|
+
const wrappers: VueWrapper[] = []
|
|
11
|
+
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()))
|
|
12
|
+
|
|
13
|
+
describe('advanced type picker', () => {
|
|
14
|
+
it('lists the generated registry and host extensions without maintaining another built-in list', async () => {
|
|
15
|
+
const wrapper = mount(AimdTypePicker, { props: { modelValue: 'str | None', messages, varTypePlugins: [{ key: 'lab', value: 'LabSample', label: 'Lab sample', desc: '' }] } })
|
|
16
|
+
wrappers.push(wrapper)
|
|
17
|
+
expect(wrapper.findAll('optgroup')[0].findAll('option').map(option => option.attributes('value'))).toEqual(getAimdBuiltInTypeNames())
|
|
18
|
+
await wrapper.get('select').setValue('LabSample')
|
|
19
|
+
expect(wrapper.emitted('update:modelValue')?.slice(-1)[0]).toEqual(['LabSample | None'])
|
|
20
|
+
await wrapper.get('input').setValue('list[LabSample] | None')
|
|
21
|
+
expect(wrapper.emitted('update:modelValue')?.slice(-1)[0]).toEqual(['list[LabSample] | None'])
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('keeps existing custom expressions and saves a selected built-in while retaining other metadata', async () => {
|
|
25
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: '', fieldContent: 'sample: LabSample | None, title="Sample", description="Context"', messages }, global: { stubs: { teleport: true } } })
|
|
26
|
+
wrappers.push(wrapper)
|
|
27
|
+
await wrapper.setProps({ visible: true })
|
|
28
|
+
await flushPromises()
|
|
29
|
+
expect(wrapper.get<HTMLInputElement>('input[name="type"]').element.value).toBe('LabSample | None')
|
|
30
|
+
const name = getAimdBuiltInTypeNames()[0]
|
|
31
|
+
await wrapper.get('select[name="knownType"]').setValue(name)
|
|
32
|
+
expect(wrapper.get<HTMLInputElement>('input[name="type"]').element.value).toBe(`${name} | None`)
|
|
33
|
+
await wrapper.get('form').trigger('submit')
|
|
34
|
+
expect(parseVarDefinition(wrapper.emitted('save')![0][0] as string)).toMatchObject({ id: 'sample', type: `${name} | None`, kwargs: { title: 'Sample', description: 'Context' } })
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('allows a free expression after choosing a registered type', async () => {
|
|
38
|
+
const wrapper = mount(AimdInputFieldDialog, { props: { visible: false, content: '', initialPreset: 'custom', messages }, global: { stubs: { teleport: true } } })
|
|
39
|
+
wrappers.push(wrapper)
|
|
40
|
+
await wrapper.setProps({ visible: true })
|
|
41
|
+
await flushPromises()
|
|
42
|
+
expect(wrapper.get('details').attributes('open')).toBeDefined()
|
|
43
|
+
await wrapper.get('select[name="knownType"]').setValue(getAimdBuiltInTypeNames()[0])
|
|
44
|
+
await wrapper.get('input[name="type"]').setValue('list[LabSample] | None')
|
|
45
|
+
await wrapper.get('form').trigger('submit')
|
|
46
|
+
expect(parseVarDefinition(wrapper.emitted('save')![0][0] as string).type).toBe('list[LabSample] | None')
|
|
47
|
+
})
|
|
48
|
+
})
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { parseCheckContent, parseStepContent, parseVarDefinition } from '@airalogy/aimd-core/parser'
|
|
2
|
+
import { parseAndExtract } from '@airalogy/aimd-renderer'
|
|
3
|
+
|
|
4
|
+
export const AIMD_FIELD_ID_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/
|
|
5
|
+
|
|
6
|
+
/** Include references so inserting a new field cannot accidentally resolve an unrelated reference. */
|
|
7
|
+
export function collectAimdFieldIds(markdown: string): Set<string> {
|
|
8
|
+
const ids = new Set<string>()
|
|
9
|
+
try {
|
|
10
|
+
const fields = parseAndExtract(markdown)
|
|
11
|
+
for (const value of Object.values(fields)) {
|
|
12
|
+
if (!Array.isArray(value)) continue
|
|
13
|
+
for (const field of value) {
|
|
14
|
+
if (typeof field === 'string') ids.add(field)
|
|
15
|
+
else if (field && typeof field.id === 'string') ids.add(field.id)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
} catch {
|
|
19
|
+
// Broken draft blocks must not prevent insertion; reserve all visible template IDs conservatively.
|
|
20
|
+
for (const match of markdown.matchAll(/\{\{\w+\|\s*([A-Za-z_]\w*)/g)) ids.add(match[1])
|
|
21
|
+
}
|
|
22
|
+
return ids
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function createAimdFieldId(existingIds: Iterable<string>, prefix = 'field'): string {
|
|
26
|
+
const ids = new Set(existingIds)
|
|
27
|
+
const base = AIMD_FIELD_ID_PATTERN.test(prefix) ? prefix : 'field'
|
|
28
|
+
let serial = 1
|
|
29
|
+
while (ids.has(`${base}_${serial}`)) serial += 1
|
|
30
|
+
return `${base}_${serial}`
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function serializeAimdFieldValue(value: unknown): string {
|
|
34
|
+
if (value === null) return 'None'
|
|
35
|
+
if (typeof value === 'boolean') return value ? 'True' : 'False'
|
|
36
|
+
if (Array.isArray(value)) return `[${value.map(serializeAimdFieldValue).join(', ')}]`
|
|
37
|
+
if (typeof value === 'object') {
|
|
38
|
+
return `{${Object.entries(value as Record<string, unknown>).map(([key, item]) => `${JSON.stringify(key)}: ${serializeAimdFieldValue(item)}`).join(', ')}}`
|
|
39
|
+
}
|
|
40
|
+
return JSON.stringify(value)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Edit common properties while retaining defaults and other parsed field metadata. */
|
|
44
|
+
export function updateAimdInputField(
|
|
45
|
+
original: string | undefined,
|
|
46
|
+
values: { id: string; type: string; title: string; defaultRaw: string; clearEnum?: boolean },
|
|
47
|
+
): string {
|
|
48
|
+
const definition = original ? parseVarDefinition(original) : undefined
|
|
49
|
+
if (definition?.subvars) throw new Error('Table definitions must be edited with the table editor.')
|
|
50
|
+
const kwargs = { ...definition?.kwargs }
|
|
51
|
+
if (values.clearEnum) delete kwargs.enum
|
|
52
|
+
if (values.title.trim()) kwargs.title = values.title.trim()
|
|
53
|
+
else delete kwargs.title
|
|
54
|
+
let result = values.id.trim()
|
|
55
|
+
if (values.type.trim()) result += `: ${values.type.trim()}`
|
|
56
|
+
if (values.defaultRaw.trim()) result += ` = ${values.defaultRaw.trim()}`
|
|
57
|
+
for (const [key, value] of Object.entries(kwargs)) {
|
|
58
|
+
result += `, ${key} = ${serializeAimdFieldValue(value)}`
|
|
59
|
+
}
|
|
60
|
+
return result
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Keep the step identity and unrelated options intact when editing presentation. */
|
|
64
|
+
export function updateAimdStepField(
|
|
65
|
+
original: string | undefined,
|
|
66
|
+
values: { id: string; title: string; level: number; check: boolean; duration: string; timer: string },
|
|
67
|
+
): string {
|
|
68
|
+
const parsed = original ? parseStepContent(original) : undefined
|
|
69
|
+
const kwargs = { ...parsed?.props }
|
|
70
|
+
delete kwargs.level
|
|
71
|
+
if (values.title.trim()) kwargs.title = values.title.trim()
|
|
72
|
+
else delete kwargs.title
|
|
73
|
+
if (values.check || 'check' in kwargs) kwargs.check = values.check
|
|
74
|
+
if (values.duration.trim()) kwargs.duration = values.duration.trim()
|
|
75
|
+
else delete kwargs.duration
|
|
76
|
+
if (values.timer !== 'elapsed' || 'timer' in kwargs) kwargs.timer = values.timer
|
|
77
|
+
return `${parsed?.id ?? values.id.trim()}${values.level === 1 ? '' : `, ${values.level}`}${Object.entries(kwargs).map(([key, value]) => `, ${key}=${serializeAimdFieldValue(value)}`).join('')}`
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function updateAimdCheckField(
|
|
81
|
+
original: string | undefined,
|
|
82
|
+
values: { id: string; title: string; checkedMessage: string },
|
|
83
|
+
): string {
|
|
84
|
+
const parsed = original ? parseCheckContent(original) : undefined
|
|
85
|
+
return `${parsed?.id ?? values.id.trim()}${values.title.trim() ? `, title=${JSON.stringify(values.title.trim())}` : ''}${values.checkedMessage ? `, checked_message=${JSON.stringify(values.checkedMessage)}` : ''}`
|
|
86
|
+
}
|
package/src/authoring/index.ts
CHANGED
package/src/vue/AimdEditor.vue
CHANGED
|
@@ -10,6 +10,10 @@ import '@milkdown/kit/prose/tables/style/tables.css'
|
|
|
10
10
|
|
|
11
11
|
// Internal
|
|
12
12
|
import AimdFieldDialog from './AimdFieldDialog.vue'
|
|
13
|
+
import AimdInputFieldDialog from './AimdInputFieldDialog.vue'
|
|
14
|
+
import AimdStepFieldDialog from './AimdStepFieldDialog.vue'
|
|
15
|
+
import type { AimdInputEditRequest } from './milkdown-aimd-plugin'
|
|
16
|
+
import { collectAimdFieldIds, createAimdFieldId } from '../authoring/fields'
|
|
13
17
|
import AimdEditorToolbar from './AimdEditorToolbar.vue'
|
|
14
18
|
import AimdSourceEditor from './AimdSourceEditor.vue'
|
|
15
19
|
import AimdWysiwygEditor from './AimdWysiwygEditor.vue'
|
|
@@ -27,6 +31,7 @@ const props = withDefaults(defineProps<AimdEditorProps>(), {
|
|
|
27
31
|
modelValue: '',
|
|
28
32
|
messages: () => ({}),
|
|
29
33
|
mode: 'source',
|
|
34
|
+
fieldDisplay: 'detailed',
|
|
30
35
|
theme: 'aimd-light',
|
|
31
36
|
showTopBar: true,
|
|
32
37
|
showToolbar: true,
|
|
@@ -99,6 +104,44 @@ const localizedMdToolbarItems = computed(() => createMdToolbarItems(resolvedMess
|
|
|
99
104
|
// --- AIMD Dialog ---
|
|
100
105
|
const showAimdDialog = ref(false)
|
|
101
106
|
const aimdDialogType = ref('var')
|
|
107
|
+
const showInputDialog = ref(false)
|
|
108
|
+
const inputPreset = ref('str')
|
|
109
|
+
const inputEditRequest = ref<AimdInputEditRequest>()
|
|
110
|
+
const showStepDialog = ref(false)
|
|
111
|
+
const stepDialogType = ref<'step' | 'check'>('step')
|
|
112
|
+
const stepEditRequest = ref<AimdInputEditRequest>()
|
|
113
|
+
|
|
114
|
+
function editStep(request: AimdInputEditRequest) {
|
|
115
|
+
if (props.readonly) return
|
|
116
|
+
stepDialogType.value = 'step'
|
|
117
|
+
stepEditRequest.value = request
|
|
118
|
+
showStepDialog.value = true
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function editCheck(request: AimdInputEditRequest) {
|
|
122
|
+
if (props.readonly) return
|
|
123
|
+
stepDialogType.value = 'check'
|
|
124
|
+
stepEditRequest.value = request
|
|
125
|
+
showStepDialog.value = true
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function saveStep(value: string) {
|
|
129
|
+
if (props.readonly) return
|
|
130
|
+
if (stepEditRequest.value) stepEditRequest.value.apply(value)
|
|
131
|
+
else insertTextIntoActiveEditor(`{{${stepDialogType.value}|${value}}}${stepDialogType.value === 'step' ? '\n\n' : ' '}`)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function editInput(request: AimdInputEditRequest) {
|
|
135
|
+
if (props.readonly) return
|
|
136
|
+
inputEditRequest.value = request
|
|
137
|
+
showInputDialog.value = true
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function saveInput(fieldContent: string) {
|
|
141
|
+
if (props.readonly) return
|
|
142
|
+
if (inputEditRequest.value) inputEditRequest.value.apply(fieldContent)
|
|
143
|
+
else insertTextIntoActiveEditor(`{{var|${fieldContent}}}`)
|
|
144
|
+
}
|
|
102
145
|
|
|
103
146
|
const refSuggestions = computed(() => {
|
|
104
147
|
const fields = extractedFields.value
|
|
@@ -117,11 +160,39 @@ const existingQuizIds = computed(() => {
|
|
|
117
160
|
})
|
|
118
161
|
|
|
119
162
|
function openAimdDialog(type: string) {
|
|
163
|
+
if (props.readonly) return
|
|
164
|
+
if (type === 'step' || type === 'check') {
|
|
165
|
+
stepDialogType.value = type
|
|
166
|
+
stepEditRequest.value = undefined
|
|
167
|
+
showStepDialog.value = true
|
|
168
|
+
return
|
|
169
|
+
}
|
|
170
|
+
if (type === 'var') {
|
|
171
|
+
insertInput('str')
|
|
172
|
+
return
|
|
173
|
+
}
|
|
120
174
|
aimdDialogType.value = type
|
|
121
175
|
showAimdDialog.value = true
|
|
122
176
|
}
|
|
123
177
|
|
|
178
|
+
function insertInput(preset: string) {
|
|
179
|
+
if (props.readonly) return
|
|
180
|
+
inputEditRequest.value = undefined
|
|
181
|
+
inputPreset.value = preset
|
|
182
|
+
showInputDialog.value = true
|
|
183
|
+
}
|
|
184
|
+
|
|
124
185
|
function quickInsertAimd(type: string) {
|
|
186
|
+
if (props.readonly) return
|
|
187
|
+
if (type === 'step') {
|
|
188
|
+
insertTextIntoActiveEditor(`{{step|${createAimdFieldId(collectAimdFieldIds(content.value), 'step')}, check=True}}\n\n`)
|
|
189
|
+
return
|
|
190
|
+
}
|
|
191
|
+
if (type === 'var') {
|
|
192
|
+
const id = createAimdFieldId(collectAimdFieldIds(content.value))
|
|
193
|
+
insertTextIntoActiveEditor(`{{var|${id}: str}}`)
|
|
194
|
+
return
|
|
195
|
+
}
|
|
125
196
|
insertTextIntoActiveEditor(getQuickAimdSyntax(type, resolvedMessages.value))
|
|
126
197
|
}
|
|
127
198
|
|
|
@@ -208,6 +279,7 @@ defineExpose({
|
|
|
208
279
|
@md-action="handleMdToolbarAction"
|
|
209
280
|
@open-aimd-dialog="openAimdDialog"
|
|
210
281
|
@quick-insert-aimd="quickInsertAimd"
|
|
282
|
+
@insert-input="insertInput"
|
|
211
283
|
/>
|
|
212
284
|
|
|
213
285
|
<!-- Editor area -->
|
|
@@ -238,14 +310,30 @@ defineExpose({
|
|
|
238
310
|
:active="editorMode === 'wysiwyg'"
|
|
239
311
|
:resolved-messages="resolvedMessages"
|
|
240
312
|
:localized-field-types="localizedFieldTypes"
|
|
313
|
+
:field-display="fieldDisplay"
|
|
314
|
+
:edit-input-fields="true"
|
|
315
|
+
:readonly="readonly"
|
|
241
316
|
@markdown-updated="onMilkdownMarkdownUpdated"
|
|
242
317
|
@ready="onWysiwygReady"
|
|
243
318
|
@open-aimd-dialog="openAimdDialog"
|
|
319
|
+
@edit-input="editInput"
|
|
320
|
+
@edit-step="editStep"
|
|
321
|
+
@edit-check="editCheck"
|
|
244
322
|
/>
|
|
245
323
|
</div>
|
|
246
324
|
</div>
|
|
247
325
|
|
|
248
326
|
<!-- AIMD Field Dialog -->
|
|
327
|
+
<AimdStepFieldDialog v-model:visible="showStepDialog" :field-type="stepDialogType" :content="content" :field-content="stepEditRequest?.content" :messages="resolvedMessages" @save="saveStep" />
|
|
328
|
+
<AimdInputFieldDialog
|
|
329
|
+
v-model:visible="showInputDialog"
|
|
330
|
+
:content="content"
|
|
331
|
+
:field-content="inputEditRequest?.content"
|
|
332
|
+
:initial-preset="inputPreset"
|
|
333
|
+
:var-type-plugins="varTypePlugins"
|
|
334
|
+
:messages="resolvedMessages"
|
|
335
|
+
@save="saveInput"
|
|
336
|
+
/>
|
|
249
337
|
<AimdFieldDialog
|
|
250
338
|
:visible="showAimdDialog"
|
|
251
339
|
:initial-type="aimdDialogType"
|
|
@@ -260,6 +348,30 @@ defineExpose({
|
|
|
260
348
|
</template>
|
|
261
349
|
|
|
262
350
|
<style>
|
|
351
|
+
.aimd-input-chip {
|
|
352
|
+
display: inline-flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
min-width: 100px;
|
|
355
|
+
max-width: 100%;
|
|
356
|
+
min-height: 30px;
|
|
357
|
+
padding: 2px 10px;
|
|
358
|
+
margin: 0 3px;
|
|
359
|
+
border: 1px solid #a8bfd8;
|
|
360
|
+
border-radius: 4px;
|
|
361
|
+
background: #f7fafc;
|
|
362
|
+
color: #56697c;
|
|
363
|
+
font: inherit;
|
|
364
|
+
font-size: 14px;
|
|
365
|
+
text-align: left;
|
|
366
|
+
vertical-align: baseline;
|
|
367
|
+
overflow-wrap: anywhere;
|
|
368
|
+
cursor: pointer;
|
|
369
|
+
}
|
|
370
|
+
.aimd-input-chip:hover { border-color: #1769d2; background: #eef5ff; }
|
|
371
|
+
.aimd-input-chip:focus-visible { outline: 2px solid #1769d2; outline-offset: 2px; }
|
|
372
|
+
.aimd-input-chip--detailed { font-family: monospace; font-size: 13px; color: #2563eb; }
|
|
373
|
+
:is(.aimd-step-chip, .aimd-check-chip) { gap: 6px; flex-wrap: wrap; color: #24292f; }
|
|
374
|
+
:is(.aimd-step-chip, .aimd-check-chip) > small { font: 12px/1.4 monospace; color: #667085; }
|
|
263
375
|
.aimd-editor {
|
|
264
376
|
display: flex;
|
|
265
377
|
flex-direction: column;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import type { AimdFieldType, MdToolbarItem } from './types'
|
|
3
3
|
import type { AimdEditorMessages } from './locales'
|
|
4
|
+
import AimdInputToolbar from './AimdInputToolbar.vue'
|
|
4
5
|
|
|
5
6
|
defineProps<{
|
|
6
7
|
showTopBar: boolean
|
|
@@ -17,6 +18,7 @@ const emit = defineEmits<{
|
|
|
17
18
|
(e: 'md-action', action: string, event: MouseEvent): void
|
|
18
19
|
(e: 'open-aimd-dialog', type: string): void
|
|
19
20
|
(e: 'quick-insert-aimd', type: string): void
|
|
21
|
+
(e: 'insert-input', preset: string): void
|
|
20
22
|
}>()
|
|
21
23
|
</script>
|
|
22
24
|
|
|
@@ -66,7 +68,7 @@ const emit = defineEmits<{
|
|
|
66
68
|
<!-- AIMD buttons -->
|
|
67
69
|
<template v-if="showAimdToolbar">
|
|
68
70
|
<button
|
|
69
|
-
v-for="ft in localizedFieldTypes"
|
|
71
|
+
v-for="ft in localizedFieldTypes.filter(field => field.type !== 'var')"
|
|
70
72
|
:key="ft.type"
|
|
71
73
|
type="button"
|
|
72
74
|
class="aimd-editor-fmt-btn aimd-editor-aimd-btn"
|
|
@@ -78,6 +80,7 @@ const emit = defineEmits<{
|
|
|
78
80
|
<span class="aimd-editor-aimd-btn-icon" v-html="ft.svgIcon" />
|
|
79
81
|
<span class="aimd-editor-aimd-btn-label">{{ ft.label }}</span>
|
|
80
82
|
</button>
|
|
83
|
+
<AimdInputToolbar v-if="localizedFieldTypes.some(field => field.type === 'var')" :messages="resolvedMessages" @insert="emit('insert-input', $event)" />
|
|
81
84
|
</template>
|
|
82
85
|
</div>
|
|
83
86
|
</template>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, computed, watch } from 'vue'
|
|
3
3
|
import type { AimdEditorMessages } from './locales'
|
|
4
|
+
import AimdTypePicker from './AimdTypePicker.vue'
|
|
4
5
|
import {
|
|
5
6
|
createAimdFieldTypes,
|
|
6
7
|
createAimdVarTypePresets,
|
|
@@ -535,15 +536,7 @@ function close() {
|
|
|
535
536
|
</button>
|
|
536
537
|
</div>
|
|
537
538
|
</div>
|
|
538
|
-
<
|
|
539
|
-
<span class="aimd-field-label">{{ props.messages.dialog.customType }}</span>
|
|
540
|
-
<input
|
|
541
|
-
v-model="fields.type"
|
|
542
|
-
:placeholder="props.messages.placeholders.type"
|
|
543
|
-
class="aimd-field-input"
|
|
544
|
-
/>
|
|
545
|
-
<span class="aimd-field-hint">{{ props.messages.dialog.customTypeHint }}</span>
|
|
546
|
-
</label>
|
|
539
|
+
<AimdTypePicker v-model="fields.type" :messages="messages" :var-type-plugins="varTypePlugins" />
|
|
547
540
|
<label class="aimd-field-row">
|
|
548
541
|
<span class="aimd-field-label">{{ props.messages.dialog.defaultValue }}</span>
|
|
549
542
|
<input v-model="fields.default" :placeholder="props.messages.placeholders.defaultValue" class="aimd-field-input" />
|
|
@@ -569,6 +562,10 @@ function close() {
|
|
|
569
562
|
|
|
570
563
|
<!-- step fields -->
|
|
571
564
|
<template v-if="dialogType === 'step'">
|
|
565
|
+
<label class="aimd-field-row">
|
|
566
|
+
<span class="aimd-field-label">{{ props.messages.stepField.name }}</span>
|
|
567
|
+
<input v-model="fields.title" class="aimd-field-input" />
|
|
568
|
+
</label>
|
|
572
569
|
<label class="aimd-field-row">
|
|
573
570
|
<span class="aimd-field-label">{{ props.messages.dialog.stepId }} <em>*</em></span>
|
|
574
571
|
<input v-model="fields.name" :placeholder="props.messages.placeholders.stepId" class="aimd-field-input" />
|
|
@@ -712,10 +709,18 @@ function close() {
|
|
|
712
709
|
|
|
713
710
|
<!-- check fields -->
|
|
714
711
|
<template v-if="dialogType === 'check'">
|
|
712
|
+
<label class="aimd-field-row">
|
|
713
|
+
<span class="aimd-field-label">{{ props.messages.checkField.name }}</span>
|
|
714
|
+
<input v-model="fields.title" class="aimd-field-input" />
|
|
715
|
+
</label>
|
|
715
716
|
<label class="aimd-field-row">
|
|
716
717
|
<span class="aimd-field-label">{{ props.messages.dialog.checkpointId }} <em>*</em></span>
|
|
717
718
|
<input v-model="fields.name" :placeholder="props.messages.placeholders.checkpointId" class="aimd-field-input" />
|
|
718
719
|
</label>
|
|
720
|
+
<label class="aimd-field-row">
|
|
721
|
+
<span class="aimd-field-label">{{ props.messages.checkField.checkedMessage }}</span>
|
|
722
|
+
<input v-model="fields.checkedMessage" class="aimd-field-input" />
|
|
723
|
+
</label>
|
|
719
724
|
</template>
|
|
720
725
|
|
|
721
726
|
<!-- ref_step / ref_var / ref_fig -->
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, nextTick, ref, watch } from 'vue'
|
|
3
|
+
import { parseVarDefinition, parseVarListEnumValues, validateVarDefinition } from '@airalogy/aimd-core/parser'
|
|
4
|
+
import { unwrapAimdNullableType, isAimdNullableType, getAimdBuiltInTypeNames, getAimdBuiltInTypeMetadata } from '@airalogy/aimd-core/utils'
|
|
5
|
+
import { AIMD_FIELD_ID_PATTERN, collectAimdFieldIds, createAimdFieldId, updateAimdInputField } from '../authoring/fields'
|
|
6
|
+
import type { AimdEditorMessages } from './locales'
|
|
7
|
+
import type { AimdVarTypePresetOption } from './types'
|
|
8
|
+
import AimdTypePicker from './AimdTypePicker.vue'
|
|
9
|
+
|
|
10
|
+
const props = defineProps<{
|
|
11
|
+
visible: boolean
|
|
12
|
+
content: string
|
|
13
|
+
fieldContent?: string
|
|
14
|
+
messages: AimdEditorMessages
|
|
15
|
+
varTypePlugins?: AimdVarTypePresetOption[]
|
|
16
|
+
reservedIds?: string[]
|
|
17
|
+
initialPreset?: string
|
|
18
|
+
}>()
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
(e: 'update:visible', value: boolean): void
|
|
21
|
+
(e: 'save', fieldContent: string): void
|
|
22
|
+
}>()
|
|
23
|
+
const dialog = ref<HTMLDialogElement>()
|
|
24
|
+
const nameInput = ref<HTMLInputElement>()
|
|
25
|
+
const id = ref('')
|
|
26
|
+
const title = ref('')
|
|
27
|
+
const type = ref('str')
|
|
28
|
+
const defaultRaw = ref('')
|
|
29
|
+
const optionsText = ref('')
|
|
30
|
+
const preset = ref('str')
|
|
31
|
+
const error = ref('')
|
|
32
|
+
const advanced = ref(false)
|
|
33
|
+
const fileTypes = getAimdBuiltInTypeNames().filter(name => getAimdBuiltInTypeMetadata(name)?.storage_kind === 'file-id')
|
|
34
|
+
const presets = computed(() => [
|
|
35
|
+
['str', props.messages.inputField.text],
|
|
36
|
+
['int', props.messages.inputField.integer],
|
|
37
|
+
['float', props.messages.inputField.number],
|
|
38
|
+
['choice', props.messages.inputField.choice],
|
|
39
|
+
['multiple-choice', props.messages.inputField.multipleChoice],
|
|
40
|
+
['bool | None', props.messages.inputField.boolean],
|
|
41
|
+
['bool', props.messages.inputField.checkbox],
|
|
42
|
+
['date', props.messages.inputField.date],
|
|
43
|
+
['time', props.messages.inputField.time],
|
|
44
|
+
['datetime', props.messages.inputField.datetime],
|
|
45
|
+
['file', props.messages.inputField.file],
|
|
46
|
+
['list[str]', props.messages.inputField.list],
|
|
47
|
+
...(props.varTypePlugins ?? []).map(preset => [preset.value, preset.label]),
|
|
48
|
+
['custom', props.messages.inputField.custom],
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
watch(() => props.visible, async visible => {
|
|
52
|
+
if (!visible) { dialog.value?.close(); return }
|
|
53
|
+
const definition = props.fieldContent ? parseVarDefinition(props.fieldContent) : undefined
|
|
54
|
+
id.value = definition?.id ?? createAimdFieldId([...collectAimdFieldIds(props.content), ...(props.reservedIds ?? [])])
|
|
55
|
+
title.value = typeof definition?.kwargs?.title === 'string' ? definition.kwargs.title : ''
|
|
56
|
+
type.value = definition?.type ?? (props.initialPreset === 'file' ? 'FileIdPDF' : ['choice', 'multiple-choice', 'custom'].includes(props.initialPreset ?? '') ? 'str' : props.initialPreset ?? 'str')
|
|
57
|
+
defaultRaw.value = definition?.defaultRaw ?? ''
|
|
58
|
+
preset.value = presets.value.some(([value]) => value === type.value) ? type.value : 'custom'
|
|
59
|
+
const listChoices = parseVarListEnumValues(type.value)
|
|
60
|
+
const choices = listChoices.length ? listChoices : definition?.enum
|
|
61
|
+
const editableChoices = Array.isArray(definition?.kwargs?.enum) || /^(?:(?:typing|typing_extensions)\.)?(?:(?:list|List)\s*\[\s*(?:(?:typing|typing_extensions)\.)?)?Literal\s*\[/.test(unwrapAimdNullableType(type.value))
|
|
62
|
+
const canEditChoices = editableChoices && Array.isArray(choices) && choices.every(value => typeof value === 'string' && !value.includes('\n'))
|
|
63
|
+
if (canEditChoices) preset.value = listChoices.length ? 'multiple-choice' : 'choice'
|
|
64
|
+
if (fileTypes.includes(unwrapAimdNullableType(type.value))) preset.value = 'file'
|
|
65
|
+
if (!definition && props.initialPreset) preset.value = props.initialPreset
|
|
66
|
+
optionsText.value = canEditChoices ? choices!.join('\n') : ''
|
|
67
|
+
advanced.value = preset.value === 'custom'
|
|
68
|
+
error.value = ''
|
|
69
|
+
await nextTick()
|
|
70
|
+
dialog.value?.showModal()
|
|
71
|
+
nameInput.value?.focus()
|
|
72
|
+
}, { immediate: true })
|
|
73
|
+
|
|
74
|
+
function selectPreset() {
|
|
75
|
+
if (!['custom', 'choice', 'multiple-choice', 'file'].includes(preset.value)) type.value = preset.value
|
|
76
|
+
if (preset.value === 'file' && !fileTypes.includes(unwrapAimdNullableType(type.value))) type.value = 'FileIdPDF'
|
|
77
|
+
if (preset.value === 'custom') advanced.value = true
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function selectFileType(event: Event) {
|
|
81
|
+
type.value = (event.target as HTMLSelectElement).value + (isAimdNullableType(type.value) ? ' | None' : '')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function save() {
|
|
85
|
+
const existing = new Set([...collectAimdFieldIds(props.content), ...(props.reservedIds ?? [])])
|
|
86
|
+
const original = props.fieldContent ? parseVarDefinition(props.fieldContent) : undefined
|
|
87
|
+
const originalId = original?.id
|
|
88
|
+
const nextId = id.value.trim() || createAimdFieldId(existing)
|
|
89
|
+
if (!AIMD_FIELD_ID_PATTERN.test(nextId)) { error.value = props.messages.inputField.invalidId; advanced.value = true; return }
|
|
90
|
+
if (nextId !== originalId && existing.has(nextId)) { error.value = props.messages.inputField.duplicateId; advanced.value = true; return }
|
|
91
|
+
let nextType = type.value
|
|
92
|
+
if (preset.value === 'choice' || preset.value === 'multiple-choice') {
|
|
93
|
+
const choices = optionsText.value.split(/\r?\n/).map(value => value.trim()).filter(Boolean)
|
|
94
|
+
if (!choices.length || new Set(choices).size !== choices.length) { error.value = props.messages.inputField.invalidOptions; return }
|
|
95
|
+
nextType = `Literal[${choices.map(value => JSON.stringify(value)).join(', ')}]`
|
|
96
|
+
if (preset.value === 'multiple-choice') nextType = `list[${nextType}]`
|
|
97
|
+
if (isAimdNullableType(type.value)) nextType += ' | None'
|
|
98
|
+
}
|
|
99
|
+
const result = updateAimdInputField(props.fieldContent, {
|
|
100
|
+
id: nextId, type: nextType, title: title.value, defaultRaw: defaultRaw.value,
|
|
101
|
+
clearEnum: preset.value === 'choice' || preset.value === 'multiple-choice' || nextType !== original?.type,
|
|
102
|
+
})
|
|
103
|
+
const problems = validateVarDefinition(parseVarDefinition(result))
|
|
104
|
+
if (problems.length) { error.value = problems.join(' '); advanced.value = true; return }
|
|
105
|
+
emit('save', result)
|
|
106
|
+
emit('update:visible', false)
|
|
107
|
+
}
|
|
108
|
+
</script>
|
|
109
|
+
|
|
110
|
+
<template>
|
|
111
|
+
<Teleport to="body">
|
|
112
|
+
<dialog ref="dialog" class="aimd-input-dialog" :aria-label="fieldContent ? messages.inputField.edit : messages.inputField.insert" @close="emit('update:visible', false)" @cancel="emit('update:visible', false)">
|
|
113
|
+
<form @submit.prevent="save">
|
|
114
|
+
<h2>{{ fieldContent ? messages.inputField.edit : messages.inputField.insert }}</h2>
|
|
115
|
+
<label>{{ messages.inputField.name }}<input ref="nameInput" v-model="title" name="title" autocomplete="off"></label>
|
|
116
|
+
<label>{{ messages.dialog.type }}
|
|
117
|
+
<select v-model="preset" name="preset" @change="selectPreset">
|
|
118
|
+
<option v-for="[value, label] in presets" :key="value" :value="value">{{ label }}</option>
|
|
119
|
+
</select>
|
|
120
|
+
</label>
|
|
121
|
+
<label v-if="preset === 'choice' || preset === 'multiple-choice'">{{ messages.inputField.options }}<textarea v-model="optionsText" name="options" rows="4" /></label>
|
|
122
|
+
<label v-if="preset === 'file'">{{ messages.inputField.fileFormat }}<select name="fileType" :value="unwrapAimdNullableType(type)" @change="selectFileType"><option v-for="fileType in fileTypes" :key="fileType" :value="fileType">{{ fileType.replace(/^FileId/, '') }}</option></select></label>
|
|
123
|
+
<details :open="advanced" @toggle="advanced = ($event.target as HTMLDetailsElement).open">
|
|
124
|
+
<summary>{{ messages.inputField.advanced }}</summary>
|
|
125
|
+
<label>{{ messages.inputField.id }}<input v-model="id" name="id" autocomplete="off" spellcheck="false"></label>
|
|
126
|
+
<AimdTypePicker v-model="type" :messages="messages" :var-type-plugins="varTypePlugins" @update:model-value="preset = 'custom'" />
|
|
127
|
+
<label>{{ messages.dialog.defaultValue }}<input v-model="defaultRaw" name="default"></label>
|
|
128
|
+
</details>
|
|
129
|
+
<p v-if="error" class="aimd-input-dialog__error" role="alert">{{ error }}</p>
|
|
130
|
+
<footer>
|
|
131
|
+
<button type="button" @click="emit('update:visible', false)">{{ messages.common.cancel }}</button>
|
|
132
|
+
<button type="submit" class="aimd-input-dialog__save">{{ fieldContent ? messages.inputField.save : messages.common.insert }}</button>
|
|
133
|
+
</footer>
|
|
134
|
+
</form>
|
|
135
|
+
</dialog>
|
|
136
|
+
</Teleport>
|
|
137
|
+
</template>
|
|
138
|
+
|
|
139
|
+
<style scoped>
|
|
140
|
+
.aimd-input-dialog {
|
|
141
|
+
/* Keep native dialog centering intact when the host resets element margins. */
|
|
142
|
+
position: fixed;
|
|
143
|
+
inset: 0;
|
|
144
|
+
margin: auto;
|
|
145
|
+
width: min(420px, calc(100vw - 32px));
|
|
146
|
+
max-height: calc(100dvh - 32px);
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
padding: 20px;
|
|
149
|
+
border: 1px solid #d1d5db;
|
|
150
|
+
border-radius: 8px;
|
|
151
|
+
background: white;
|
|
152
|
+
color: #24292f;
|
|
153
|
+
font: 14px/1.5 system-ui, sans-serif;
|
|
154
|
+
overflow: auto;
|
|
155
|
+
}
|
|
156
|
+
.aimd-input-dialog::backdrop { background: rgb(0 0 0 / 25%); }
|
|
157
|
+
h2 { font-size: 18px; margin: 0 0 16px; }
|
|
158
|
+
label { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
|
|
159
|
+
input, select, textarea { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; background: white; color: inherit; font: inherit; }
|
|
160
|
+
summary { cursor: pointer; padding: 8px 0; color: #57606a; }
|
|
161
|
+
footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
|
|
162
|
+
button { padding: 7px 16px; border: 1px solid #cbd5e1; border-radius: 4px; background: white; cursor: pointer; font: inherit; }
|
|
163
|
+
.aimd-input-dialog__save { background: #1769d2; border-color: #1769d2; color: white; }
|
|
164
|
+
.aimd-input-dialog__error { color: #b42318; }
|
|
165
|
+
:is(input, select, textarea, button, summary):focus-visible { outline: 2px solid #1769d2; outline-offset: 2px; }
|
|
166
|
+
</style>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
3
|
+
import { CalendarDays, SquareCheck, ChevronDown, CircleDot, Clock, Hash, ListChecks, ListOrdered, Paperclip, Settings2, TextCursorInput, ToggleLeft } from '@lucide/vue'
|
|
4
|
+
import type { AimdEditorMessages } from './locales'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{ messages: AimdEditorMessages }>()
|
|
7
|
+
const emit = defineEmits<{ (e: 'insert', preset: string): void }>()
|
|
8
|
+
const more = ref<HTMLDetailsElement>()
|
|
9
|
+
const menuLeft = ref(0)
|
|
10
|
+
const common = computed(() => [
|
|
11
|
+
{ preset: 'str', label: props.messages.inputField.text, icon: TextCursorInput },
|
|
12
|
+
{ preset: 'int', label: props.messages.inputField.integer, icon: Hash },
|
|
13
|
+
{ preset: 'float', label: props.messages.inputField.number, icon: Hash },
|
|
14
|
+
{ preset: 'choice', label: props.messages.inputField.choice, icon: CircleDot },
|
|
15
|
+
{ preset: 'multiple-choice', label: props.messages.inputField.multipleChoice, icon: SquareCheck },
|
|
16
|
+
{ preset: 'bool | None', label: props.messages.inputField.boolean, icon: ToggleLeft },
|
|
17
|
+
])
|
|
18
|
+
const secondary = computed(() => [
|
|
19
|
+
{ preset: 'date', label: props.messages.inputField.date, icon: CalendarDays },
|
|
20
|
+
{ preset: 'time', label: props.messages.inputField.time, icon: Clock },
|
|
21
|
+
{ preset: 'datetime', label: props.messages.inputField.datetime, icon: CalendarDays },
|
|
22
|
+
{ preset: 'list[str]', label: props.messages.inputField.list, icon: ListOrdered },
|
|
23
|
+
{ preset: 'file', label: props.messages.inputField.file, icon: Paperclip },
|
|
24
|
+
{ preset: 'custom', label: props.messages.inputField.custom, icon: Settings2 },
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
function closeMore(restoreFocus = false) {
|
|
28
|
+
if (!more.value?.open) return
|
|
29
|
+
more.value.open = false
|
|
30
|
+
if (restoreFocus) more.value.querySelector('summary')?.focus()
|
|
31
|
+
}
|
|
32
|
+
function insert(preset: string) {
|
|
33
|
+
closeMore()
|
|
34
|
+
emit('insert', preset)
|
|
35
|
+
}
|
|
36
|
+
function onOutside(event: MouseEvent) {
|
|
37
|
+
if (event.target instanceof Node && !more.value?.contains(event.target)) closeMore()
|
|
38
|
+
}
|
|
39
|
+
function positionMenu() {
|
|
40
|
+
if (!more.value?.open) return
|
|
41
|
+
const left = more.value.getBoundingClientRect().left
|
|
42
|
+
menuLeft.value = Math.max(8 - left, Math.min(0, window.innerWidth - left - 198))
|
|
43
|
+
}
|
|
44
|
+
onMounted(() => document.addEventListener('click', onOutside))
|
|
45
|
+
onBeforeUnmount(() => document.removeEventListener('click', onOutside))
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<div class="aimd-input-tools" role="group" :aria-label="messages.inputField.insert">
|
|
50
|
+
<button v-for="item in common" :key="item.preset" type="button" :title="messages.inputField.insertType(item.label)" :aria-label="messages.inputField.insertType(item.label)" @mousedown.prevent @click="insert(item.preset)">
|
|
51
|
+
<component :is="item.icon" :size="16" aria-hidden="true" />
|
|
52
|
+
<span>{{ item.label }}</span>
|
|
53
|
+
</button>
|
|
54
|
+
<details ref="more" class="aimd-input-tools__more" @toggle="positionMenu" @keydown.esc.stop.prevent="closeMore(true)">
|
|
55
|
+
<summary><ListChecks :size="16" aria-hidden="true" /><span>{{ messages.inputField.more }}</span><ChevronDown :size="14" aria-hidden="true" /></summary>
|
|
56
|
+
<div class="aimd-input-tools__menu" :style="{ left: `${menuLeft}px` }" role="group" :aria-label="messages.inputField.more">
|
|
57
|
+
<button v-for="item in secondary" :key="item.preset" type="button" :title="messages.inputField.insertType(item.label)" @click="insert(item.preset)">
|
|
58
|
+
<component :is="item.icon" :size="16" aria-hidden="true" /><span>{{ item.label }}</span>
|
|
59
|
+
</button>
|
|
60
|
+
</div>
|
|
61
|
+
</details>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<style scoped>
|
|
66
|
+
.aimd-input-tools { display: flex; flex: 0 0 100%; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; padding-top: 6px; border-top: 1px solid #e0e5eb; }
|
|
67
|
+
button, summary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; box-sizing: border-box; padding: 5px 9px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 13px; line-height: 20px; white-space: nowrap; cursor: pointer; }
|
|
68
|
+
button:hover, summary:hover, details[open] > summary { background: #eaf2fc; color: #1769d2; }
|
|
69
|
+
button:focus-visible, summary:focus-visible { outline: 2px solid #1769d2; outline-offset: 1px; }
|
|
70
|
+
svg { flex-shrink: 0; }
|
|
71
|
+
summary { list-style: none; }
|
|
72
|
+
summary::-webkit-details-marker { display: none; }
|
|
73
|
+
.aimd-input-tools__more { position: relative; }
|
|
74
|
+
.aimd-input-tools__menu { position: absolute; top: calc(100% + 4px); z-index: 80; display: flex; flex-direction: column; box-sizing: border-box; width: 190px; max-width: calc(100vw - 16px); padding: 4px; border: 1px solid #d0d7de; border-radius: 6px; background: white; color: #24292f; box-shadow: 0 4px 14px rgb(0 0 0 / 12%); }
|
|
75
|
+
.aimd-input-tools__menu button { justify-content: flex-start; }
|
|
76
|
+
@media (max-width: 480px) { button, summary { padding-inline: 7px; } }
|
|
77
|
+
</style>
|