@antelopejs/dms-automation 0.2.6 → 0.2.7

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.
@@ -23,6 +23,10 @@ const emit = defineEmits<{
23
23
  (e: 'save', payload: { enabled: boolean; config: string }): void
24
24
  }>()
25
25
 
26
+ // A type's `name` / `description` may be a `$`-prefixed DMS i18n key shipped
27
+ // in the declaring module's locales; plain text is shown as written.
28
+ const { processI18n } = useTranslation()
29
+
26
30
  const enabled = ref<boolean>(props.savedEnabled)
27
31
  const configText = ref<string>(props.savedConfig ?? '{}')
28
32
  const parseError = ref<string | null>(null)
@@ -98,10 +102,10 @@ function onSave() {
98
102
  </div>
99
103
  <div class="min-w-0 flex-1">
100
104
  <h2 class="truncate text-lg font-semibold text-highlighted">
101
- {{ type.name }}
105
+ {{ processI18n(type.name) }}
102
106
  </h2>
103
107
  <p v-if="type.description" class="text-sm text-muted">
104
- {{ type.description }}
108
+ {{ processI18n(type.description) }}
105
109
  </p>
106
110
  <p class="mt-1 font-mono text-xs text-dimmed">{{ type.id }}</p>
107
111
  </div>
@@ -33,6 +33,10 @@ const emit = defineEmits<{
33
33
  (e: 'update:modelValue', value: string): void
34
34
  }>()
35
35
 
36
+ // A type's `name` / `description` may be a `$`-prefixed DMS i18n key shipped
37
+ // in the declaring module's locales; plain text is shown as written.
38
+ const { processI18n } = useTranslation()
39
+
36
40
  function select(id: string) {
37
41
  emit('update:modelValue', id)
38
42
  }
@@ -43,7 +47,8 @@ const isSelected = (id: string) => props.modelValue === id
43
47
  const searchEnabled = computed(() => props.searchable !== false)
44
48
  const query = ref('')
45
49
 
46
- // Case-insensitive substring filter over name / description / id. Catalogs hold
50
+ // Case-insensitive substring filter over the displayed (translated) name /
51
+ // description and the id. Catalogs hold
47
52
  // at most a few hundred registered types, so a per-keystroke scan is cheap and
48
53
  // avoids pulling in a fuzzy-match dependency.
49
54
  const visibleTypes = computed<T[]>(() => {
@@ -51,8 +56,8 @@ const visibleTypes = computed<T[]>(() => {
51
56
  if (!searchEnabled.value || !q) return props.types
52
57
  return props.types.filter(
53
58
  (t) =>
54
- t.name?.toLowerCase().includes(q) ||
55
- t.description?.toLowerCase().includes(q) ||
59
+ processI18n(t.name).toLowerCase().includes(q) ||
60
+ (t.description && processI18n(t.description).toLowerCase().includes(q)) ||
56
61
  t.id?.toLowerCase().includes(q),
57
62
  )
58
63
  })
@@ -153,10 +158,10 @@ const itemClass = (id: string) =>
153
158
  class="truncate text-sm font-medium"
154
159
  :class="isSelected(t.id) ? 'text-primary' : 'text-highlighted'"
155
160
  >
156
- {{ t.name }}
161
+ {{ processI18n(t.name) }}
157
162
  </div>
158
163
  <div v-if="t.description" class="truncate text-xs text-muted">
159
- {{ t.description }}
164
+ {{ processI18n(t.description) }}
160
165
  </div>
161
166
  </div>
162
167
  </button>
@@ -184,10 +189,10 @@ const itemClass = (id: string) =>
184
189
  class="truncate text-sm font-medium"
185
190
  :class="isSelected(t.id) ? 'text-primary' : 'text-highlighted'"
186
191
  >
187
- {{ t.name }}
192
+ {{ processI18n(t.name) }}
188
193
  </div>
189
194
  <div v-if="t.description" class="truncate text-xs text-muted">
190
- {{ t.description }}
195
+ {{ processI18n(t.description) }}
191
196
  </div>
192
197
  </div>
193
198
  </button>
@@ -25,6 +25,9 @@ interface PortRow {
25
25
  defineProps<{ embedded?: boolean }>()
26
26
 
27
27
  const { $authFetch } = useAuthFetch()
28
+ // A type's `name` / `description` may be a `$`-prefixed DMS i18n key shipped
29
+ // in the declaring module's locales; plain text is shown as written.
30
+ const { processI18n } = useTranslation()
28
31
 
29
32
  const items = ref<DataNodeTypeItem[]>([])
30
33
  const loading = ref(false)
@@ -143,7 +146,7 @@ function categoryOf(t: DataNodeTypeItem): string {
143
146
  </div>
144
147
  <div class="min-w-0 flex-1">
145
148
  <h2 class="truncate text-lg font-semibold text-highlighted">
146
- {{ selectedType.name }}
149
+ {{ processI18n(selectedType.name) }}
147
150
  </h2>
148
151
  <p class="mt-1 font-mono text-xs text-dimmed">{{ selectedType.id }}</p>
149
152
  </div>
@@ -159,7 +162,7 @@ function categoryOf(t: DataNodeTypeItem): string {
159
162
 
160
163
  <div class="flex flex-col gap-6 px-5 py-4 sm:px-6">
161
164
  <p v-if="selectedType.description" class="text-sm text-toned">
162
- {{ selectedType.description }}
165
+ {{ processI18n(selectedType.description) }}
163
166
  </p>
164
167
 
165
168
  <div class="flex flex-col gap-2">
@@ -31,6 +31,11 @@ const emit = defineEmits<{
31
31
 
32
32
  const search = ref('')
33
33
 
34
+ // Registered type names may be `$`-prefixed DMS i18n keys shipped in the
35
+ // declaring module's locales; plain text is shown as written. Search matches
36
+ // the translated label.
37
+ const { processI18n } = useTranslation()
38
+
34
39
  interface PaletteItem {
35
40
  key: string
36
41
  label: string
@@ -106,16 +111,16 @@ const groups = computed<PaletteGroup[]>(() => {
106
111
  const reg = ui.typeRegistry
107
112
  if (reg === 'triggers') {
108
113
  for (const t of props.triggerTypes ?? []) {
109
- push(t.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${t.id}`, label: t.name, icon: t.icon ?? groupIcon, kind: k.kind, typeId: t.id })
114
+ push(t.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${t.id}`, label: processI18n(t.name), icon: t.icon ?? groupIcon, kind: k.kind, typeId: t.id })
110
115
  }
111
116
  } else if (reg === 'actions') {
112
117
  for (const a of props.actionTypes ?? []) {
113
- push(a.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${a.id}`, label: a.name, icon: a.icon ?? groupIcon, kind: k.kind, typeId: a.id })
118
+ push(a.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${a.id}`, label: processI18n(a.name), icon: a.icon ?? groupIcon, kind: k.kind, typeId: a.id })
114
119
  }
115
120
  } else if (reg === 'dataNodes') {
116
121
  // Flatten data-node sub-categories into the single "Data" group.
117
122
  for (const d of props.dataNodeTypes ?? []) {
118
- push(d.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${d.id}`, label: d.name, icon: d.icon ?? groupIcon, kind: k.kind, typeId: d.id })
123
+ push(d.module ?? BUILTIN_BUCKET, { key: `${k.kind}:${d.id}`, label: processI18n(d.name), icon: d.icon ?? groupIcon, kind: k.kind, typeId: d.id })
119
124
  }
120
125
  } else {
121
126
  // Plain node kinds (flow / helpers) are built into this module.
@@ -109,6 +109,7 @@ const emit = defineEmits<{
109
109
  }>()
110
110
 
111
111
  const toast = useToast()
112
+ const { processI18n } = useTranslation()
112
113
 
113
114
  const nodeTypes = markRaw({
114
115
  genericNode: GenericNode,
@@ -187,7 +188,9 @@ function dataFor(node: AppGraphNode) {
187
188
  }
188
189
  | null
189
190
  if (type) {
190
- if (spec.labelFromType) label = type.name ?? label
191
+ // Type names may be `$`-prefixed DMS i18n keys; plain text passes through.
192
+ if (spec.labelFromType && type.name !== undefined)
193
+ label = processI18n(type.name)
191
194
  if (spec.iconFromType) icon = type.icon ?? icon
192
195
  if (spec.categoryFromType) category = type.category
193
196
  if (spec.dataInsFromTypeSchema)
@@ -141,12 +141,18 @@ const fields = computed<
141
141
  }))
142
142
  })
143
143
 
144
+ // Type names may be `$`-prefixed DMS i18n keys shipped in the declaring
145
+ // module's locales; plain text is shown as written.
146
+ const { processI18n } = useTranslation()
147
+ const typeName = (type: { name: string } | null | undefined) =>
148
+ type ? processI18n(type.name) : undefined
149
+
144
150
  const nodeTypeLabel = computed<string>(() => {
145
151
  const n = props.node
146
152
  if (!n) return ''
147
- if (n.kind === 'trigger') return props.triggerType?.name ?? n.typeId ?? 'Trigger'
148
- if (n.kind === 'action') return props.actionType?.name ?? n.typeId ?? 'Action'
149
- if (n.kind === 'data') return dataNodeType.value?.name ?? n.typeId ?? 'Data'
153
+ if (n.kind === 'trigger') return typeName(props.triggerType) ?? n.typeId ?? 'Trigger'
154
+ if (n.kind === 'action') return typeName(props.actionType) ?? n.typeId ?? 'Action'
155
+ if (n.kind === 'data') return typeName(dataNodeType.value) ?? n.typeId ?? 'Data'
150
156
  return n.kind
151
157
  })
152
158
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/dms-automation",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,6 +70,7 @@
70
70
  "test:release-script": "node --test tests/release-script.test.cjs",
71
71
  "test:run-storage": "pnpm run build && node --test tests/run-storage.test.cjs",
72
72
  "test:type-origin": "pnpm run build && node --test tests/type-origin.test.cjs",
73
+ "test:type-display": "node --test tests/type-display.test.cjs",
73
74
  "dev": "ajs project run -w -p playground",
74
75
  "lint": "oxlint && oxfmt --check . && cd frontend-vue && pnpm lint && antelopejs-check-interface-ranges",
75
76
  "typecheck": "pnpm --filter @antelopejs/interface-dms-automation typecheck && tsc --noEmit",