@camstack/addon-admin-ui 0.1.1 → 0.1.2

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.
@@ -1,210 +1,28 @@
1
- /**
2
- * Configuration UI Schema — declarative form definition for any element.
3
- *
4
- * Copied from backend/src/interfaces/config-ui.ts (types only, no runtime code).
5
- */
6
-
7
- // --- Schema Definition ---
8
-
9
- export interface ConfigUISchema {
10
- sections: ConfigSection[]
11
- }
12
-
13
- export interface ConfigSection {
14
- id: string
15
- title: string
16
- description?: string
17
- style?: 'card' | 'accordion' // default: 'card'
18
- defaultCollapsed?: boolean // for accordion, default: false
19
- columns?: 1 | 2 | 3 | 4 // responsive grid columns, default: 2
20
- fields: ConfigField[]
21
- }
22
-
23
- // --- Field Types ---
24
-
25
- export type ConfigField =
26
- | ConfigTextField
27
- | ConfigNumberField
28
- | ConfigBooleanField
29
- | ConfigSelectField
30
- | ConfigMultiSelectField
31
- | ConfigColorField
32
- | ConfigPasswordField
33
- | ConfigTextAreaField
34
- | ConfigSliderField
35
- | ConfigTagsField
36
- | ConfigGroupField
37
- | ConfigSeparatorField
38
- | ConfigInfoField
39
- | ConfigModelSelectorField
40
-
41
- export interface ConfigFieldBase {
42
- key: string // maps to config path: 'mqtt.brokerUrl'
43
- label: string
44
- description?: string
45
- required?: boolean
46
- disabled?: boolean
47
- placeholder?: string
48
- span?: 1 | 2 | 3 | 4 // grid column span, default: 1
49
- showWhen?: ConfigCondition // conditional visibility
50
- }
51
-
52
- export interface ConfigCondition {
53
- field: string // another field's key
54
- equals?: unknown
55
- notEquals?: unknown
56
- in?: unknown[]
57
- notIn?: unknown[]
58
- }
59
-
60
- export interface ConfigTextField extends ConfigFieldBase {
61
- type: 'text'
62
- maxLength?: number
63
- pattern?: string // regex validation
64
- inputType?: 'text' | 'url' | 'email'
65
- }
66
-
67
- export interface ConfigNumberField extends ConfigFieldBase {
68
- type: 'number'
69
- min?: number
70
- max?: number
71
- step?: number
72
- unit?: string // display suffix: 'ms', '%', 'px', 's'
73
- }
74
-
75
- export interface ConfigBooleanField extends ConfigFieldBase {
76
- type: 'boolean'
77
- style?: 'switch' | 'checkbox' // default: switch
78
- }
79
-
80
- export interface ConfigSelectField extends ConfigFieldBase {
81
- type: 'select'
82
- options: ConfigOption[]
83
- }
84
-
85
- export interface ConfigMultiSelectField extends ConfigFieldBase {
86
- type: 'multiselect'
87
- options: ConfigOption[]
88
- maxItems?: number
89
- }
90
-
91
- export interface ConfigColorField extends ConfigFieldBase {
92
- type: 'color'
93
- presets?: string[]
94
- }
95
-
96
- export interface ConfigPasswordField extends ConfigFieldBase {
97
- type: 'password'
98
- showToggle?: boolean // show/hide toggle, default: true
99
- }
100
-
101
- export interface ConfigTextAreaField extends ConfigFieldBase {
102
- type: 'textarea'
103
- rows?: number
104
- maxLength?: number
105
- }
106
-
107
- export interface ConfigSliderField extends ConfigFieldBase {
108
- type: 'slider'
109
- min: number
110
- max: number
111
- step?: number
112
- showValue?: boolean // default: true
113
- unit?: string
114
- }
115
-
116
- export interface ConfigTagsField extends ConfigFieldBase {
117
- type: 'tags'
118
- suggestions?: string[] // autocomplete suggestions
119
- maxTags?: number
120
- }
121
-
122
- export interface ConfigGroupField extends ConfigFieldBase {
123
- type: 'group'
124
- fields: ConfigField[]
125
- style?: 'card' | 'inline' | 'accordion'
126
- defaultCollapsed?: boolean
127
- }
128
-
129
- /** Visual separator between fields */
130
- export interface ConfigSeparatorField {
131
- type: 'separator'
132
- key: string
133
- }
134
-
135
- /** Read-only informational text */
136
- export interface ConfigInfoField {
137
- type: 'info'
138
- key: string
139
- label: string
140
- content: string // markdown or plain text
141
- variant?: 'info' | 'warning' | 'success' | 'danger'
142
- }
143
-
144
- export interface ConfigOption {
145
- value: string
146
- label: string
147
- description?: string
148
- icon?: string
149
- }
150
-
151
- // --- Model Selector Field ---
152
-
153
- /** Lightweight model format entry sent inside catalog entries */
154
- export interface ModelFormatEntry {
155
- readonly url: string
156
- readonly sizeMB: number
157
- }
158
-
159
- /** Label definition sent inside catalog entries */
160
- export interface LabelDefinition {
161
- readonly id: string
162
- readonly name: string
163
- }
164
-
165
- export type ModelFormat = 'onnx' | 'coreml' | 'openvino' | 'tflite' | 'pt'
166
- export type ModelOutputFormat = 'yolo' | 'ssd' | 'embedding' | 'classification' | 'ocr'
167
-
168
- /** A single model entry from the addon's catalog */
169
- export interface ModelCatalogEntry {
170
- readonly id: string
171
- readonly name: string
172
- readonly description: string
173
- readonly formats: Partial<Readonly<Record<ModelFormat, ModelFormatEntry>>>
174
- readonly inputSize: { readonly width: number; readonly height: number }
175
- readonly labels: readonly LabelDefinition[]
176
- readonly inputLayout?: 'nchw' | 'nhwc'
177
- readonly inputNormalization?: 'zero-one' | 'imagenet' | 'none'
178
- }
179
-
180
- /**
181
- * Specialized field for selecting ML models.
182
- * Renders a catalog selector with optional custom path input.
183
- */
184
- export interface ConfigModelSelectorField extends ConfigFieldBase {
185
- type: 'model-selector'
186
- /** Filter models by type (detection, face-detection, embedding, plate-detection, ocr, audio-classification) */
187
- modelType?: string
188
- /** Allow user to enter a custom local path or URL (default: true) */
189
- allowCustomPath?: boolean
190
- /** Allow file upload via UI (default: true) */
191
- allowUpload?: boolean
192
- /** Accepted file extensions for upload (default: ['.onnx']) */
193
- acceptExtensions?: string[]
194
- /** URL to model conversion documentation/guide */
195
- conversionGuideUrl?: string
196
- /** Brief text explaining what models are compatible */
197
- compatibilityNote?: string
198
- /** Inline catalog entries from the addon */
199
- catalog?: readonly ModelCatalogEntry[]
200
- /** Whether to allow custom model import (default: false) */
201
- allowCustom?: boolean
202
- /** Whether model format conversion is available */
203
- allowConversion?: boolean
204
- /** Accepted model formats */
205
- acceptFormats?: readonly ModelFormat[]
206
- /** Required metadata keys for custom models */
207
- requiredMetadata?: readonly string[]
208
- /** Hint about the expected output format */
209
- outputFormatHint?: ModelOutputFormat
210
- }
1
+ // Re-export config UI types from @camstack/types
2
+ export type {
3
+ ConfigUISchema,
4
+ ConfigSection,
5
+ ConfigField,
6
+ ConfigFieldBase,
7
+ ConfigCondition,
8
+ ConfigTextField,
9
+ ConfigNumberField,
10
+ ConfigBooleanField,
11
+ ConfigSelectField,
12
+ ConfigMultiSelectField,
13
+ ConfigColorField,
14
+ ConfigPasswordField,
15
+ ConfigTextAreaField,
16
+ ConfigSliderField,
17
+ ConfigTagsField,
18
+ ConfigGroupField,
19
+ ConfigSeparatorField,
20
+ ConfigInfoField,
21
+ ConfigOption,
22
+ ConfigModelSelectorField,
23
+ ModelCatalogEntry,
24
+ ModelFormat,
25
+ ModelFormatEntry,
26
+ ModelOutputFormat,
27
+ LabelDefinition,
28
+ } from '@camstack/types'