@aleph-alpha/settings-kit 0.1.0 → 1.0.0
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 +465 -15
- package/dist/SkLayout.vue_vue_type_script_setup_true_lang-ZjV2AMdR.js +51 -0
- package/dist/SkLayoutPage-DGbCpQFm.js +2545 -0
- package/dist/UseFileConvertor-DN6cCXNi.js +50 -0
- package/dist/components/SkField/SkField.vue.d.ts +28 -0
- package/dist/components/SkField/SkField.vue.d.ts.map +1 -0
- package/dist/components/SkField/index.d.ts +2 -0
- package/dist/components/SkField/index.d.ts.map +1 -0
- package/dist/components/SkGroup/SkGroup.vue.d.ts +29 -0
- package/dist/components/SkGroup/SkGroup.vue.d.ts.map +1 -0
- package/dist/components/SkGroup/index.d.ts +2 -0
- package/dist/components/SkGroup/index.d.ts.map +1 -0
- package/dist/components/SkItem/SkItem.vue.d.ts +22 -0
- package/dist/components/SkItem/SkItem.vue.d.ts.map +1 -0
- package/dist/components/SkItem/index.d.ts +2 -0
- package/dist/components/SkItem/index.d.ts.map +1 -0
- package/dist/components/SkLayout/SkLayout.vue.d.ts +53 -0
- package/dist/components/SkLayout/SkLayout.vue.d.ts.map +1 -0
- package/dist/components/SkLayout/SkLayoutPage.d.ts +23 -0
- package/dist/components/SkLayout/SkLayoutPage.d.ts.map +1 -0
- package/dist/components/SkLayout/context.d.ts +61 -0
- package/dist/components/SkLayout/context.d.ts.map +1 -0
- package/dist/components/SkLayout/index.d.ts +5 -0
- package/dist/components/SkLayout/index.d.ts.map +1 -0
- package/dist/components/SkPage/SkPage.vue.d.ts +35 -0
- package/dist/components/SkPage/SkPage.vue.d.ts.map +1 -0
- package/dist/components/SkPage/index.d.ts +2 -0
- package/dist/components/SkPage/index.d.ts.map +1 -0
- package/dist/components/SkSection/SkSection.vue.d.ts +29 -0
- package/dist/components/SkSection/SkSection.vue.d.ts.map +1 -0
- package/dist/components/SkSection/index.d.ts +2 -0
- package/dist/components/SkSection/index.d.ts.map +1 -0
- package/dist/components/controls/SkActionsControl/SkActionsControl.vue.d.ts +37 -0
- package/dist/components/controls/SkActionsControl/SkActionsControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkActionsControl/index.d.ts +2 -0
- package/dist/components/controls/SkActionsControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkCheckboxControl/SkCheckboxControl.vue.d.ts +35 -0
- package/dist/components/controls/SkCheckboxControl/SkCheckboxControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkCheckboxControl/index.d.ts +2 -0
- package/dist/components/controls/SkCheckboxControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkColorControl/SkColorControl.vue.d.ts +35 -0
- package/dist/components/controls/SkColorControl/SkColorControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkColorControl/index.d.ts +2 -0
- package/dist/components/controls/SkColorControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkFileUpload/SkFilePlaceholder.vue.d.ts +11 -0
- package/dist/components/controls/SkFileUpload/SkFilePlaceholder.vue.d.ts.map +1 -0
- package/dist/components/controls/SkFileUpload/SkFileUpload.vue.d.ts +46 -0
- package/dist/components/controls/SkFileUpload/SkFileUpload.vue.d.ts.map +1 -0
- package/dist/components/controls/SkFileUpload/index.d.ts +2 -0
- package/dist/components/controls/SkFileUpload/index.d.ts.map +1 -0
- package/dist/components/controls/SkPeriodControl/SkPeriodControl.vue.d.ts +35 -0
- package/dist/components/controls/SkPeriodControl/SkPeriodControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkPeriodControl/index.d.ts +2 -0
- package/dist/components/controls/SkPeriodControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkSelectControl/SkSelectControl.vue.d.ts +40 -0
- package/dist/components/controls/SkSelectControl/SkSelectControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkSelectControl/index.d.ts +2 -0
- package/dist/components/controls/SkSelectControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkTelControl/SKTelPrefixControl.vue.d.ts +16 -0
- package/dist/components/controls/SkTelControl/SKTelPrefixControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkTelControl/SkTelControl.vue.d.ts +35 -0
- package/dist/components/controls/SkTelControl/SkTelControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkTelControl/index.d.ts +4 -0
- package/dist/components/controls/SkTelControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkTelControl/prefixes.d.ts +26 -0
- package/dist/components/controls/SkTelControl/prefixes.d.ts.map +1 -0
- package/dist/components/controls/SkTextControl/SkTextControl.vue.d.ts +45 -0
- package/dist/components/controls/SkTextControl/SkTextControl.vue.d.ts.map +1 -0
- package/dist/components/controls/SkTextControl/index.d.ts +2 -0
- package/dist/components/controls/SkTextControl/index.d.ts.map +1 -0
- package/dist/components/controls/SkUnsupportedControl/SkUnsupportedControl.vue.d.ts +8 -0
- package/dist/components/controls/SkUnsupportedControl/SkUnsupportedControl.vue.d.ts.map +1 -0
- package/dist/components/controls/storyEventLog.d.ts +33 -0
- package/dist/components/controls/storyEventLog.d.ts.map +1 -0
- package/dist/components/index.d.ts +7 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +12 -2
- package/dist/composables/UseFileConvertor/UseFileConvertor.d.ts +7 -0
- package/dist/composables/UseFileConvertor/UseFileConvertor.d.ts.map +1 -0
- package/dist/composables/index.d.ts +14 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/useFieldInheritance/useFieldInheritance.d.ts +24 -0
- package/dist/composables/useFieldInheritance/useFieldInheritance.d.ts.map +1 -0
- package/dist/composables/useFieldValidator/useFieldValidator.d.ts +50 -0
- package/dist/composables/useFieldValidator/useFieldValidator.d.ts.map +1 -0
- package/dist/composables/useSettingField/useSettingField.d.ts +24 -0
- package/dist/composables/useSettingField/useSettingField.d.ts.map +1 -0
- package/dist/composables/useSettingsForm/useSettingsForm.d.ts +12 -0
- package/dist/composables/useSettingsForm/useSettingsForm.d.ts.map +1 -0
- package/dist/composables/useSettingsLayout/useSettingsLayout.d.ts +71 -0
- package/dist/composables/useSettingsLayout/useSettingsLayout.d.ts.map +1 -0
- package/dist/composables/useSettingsLocale/useSettingsLocale.d.ts +38 -0
- package/dist/composables/useSettingsLocale/useSettingsLocale.d.ts.map +1 -0
- package/dist/composables/useStateManager/useStateManager.d.ts +10 -0
- package/dist/composables/useStateManager/useStateManager.d.ts.map +1 -0
- package/dist/core/controls/controlDefinitions.d.ts +33 -0
- package/dist/core/controls/controlDefinitions.d.ts.map +1 -0
- package/dist/core/controls/index.d.ts +26 -0
- package/dist/core/controls/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +18 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/layout/index.d.ts +8 -0
- package/dist/core/layout/index.d.ts.map +1 -0
- package/dist/core/layout/navigation.d.ts +33 -0
- package/dist/core/layout/navigation.d.ts.map +1 -0
- package/dist/core/layout/resolve.d.ts +41 -0
- package/dist/core/layout/resolve.d.ts.map +1 -0
- package/dist/core/layout/types.d.ts +160 -0
- package/dist/core/layout/types.d.ts.map +1 -0
- package/dist/core/layout/validate.d.ts +26 -0
- package/dist/core/layout/validate.d.ts.map +1 -0
- package/dist/core/types.d.ts +541 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/useControlModel.d.ts +13 -0
- package/dist/core/useControlModel.d.ts.map +1 -0
- package/dist/core/utils/a11y.d.ts +25 -0
- package/dist/core/utils/a11y.d.ts.map +1 -0
- package/dist/core/utils/cast.d.ts +8 -0
- package/dist/core/utils/cast.d.ts.map +1 -0
- package/dist/core/utils/consts.d.ts +978 -0
- package/dist/core/utils/consts.d.ts.map +1 -0
- package/dist/core/utils/kitMessages.d.ts +165 -0
- package/dist/core/utils/kitMessages.d.ts.map +1 -0
- package/dist/core/utils/localizedText.d.ts +10 -0
- package/dist/core/utils/localizedText.d.ts.map +1 -0
- package/dist/core/utils/useName.d.ts +7 -0
- package/dist/core/utils/useName.d.ts.map +1 -0
- package/dist/core/validate/constraints.d.ts +20 -0
- package/dist/core/validate/constraints.d.ts.map +1 -0
- package/dist/core/validate/rules.d.ts +29 -0
- package/dist/core/validate/rules.d.ts.map +1 -0
- package/dist/index-BQ6z6MK4.js +214 -0
- package/dist/index-BXs-0JdT.js +168 -0
- package/dist/index-BynIH0EE.js +92 -0
- package/dist/index-C-WLhRod.js +100 -0
- package/dist/index-CFMv8jSO.js +4 -0
- package/dist/index-CGYERet5.js +373 -0
- package/dist/index-KAbhkO1J.js +81 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +48 -3
- package/dist/service/index.d.ts +2 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/shell/SkShell.vue.d.ts +80 -0
- package/dist/shell/SkShell.vue.d.ts.map +1 -0
- package/dist/shell/SkShellFrame.vue.d.ts +46 -0
- package/dist/shell/SkShellFrame.vue.d.ts.map +1 -0
- package/dist/shell/SkShellNav.vue.d.ts +19 -0
- package/dist/shell/SkShellNav.vue.d.ts.map +1 -0
- package/dist/shell/history.d.ts +9 -0
- package/dist/shell/history.d.ts.map +1 -0
- package/dist/shell/index.d.ts +12 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +848 -0
- package/dist/shell/labels.d.ts +25 -0
- package/dist/shell/labels.d.ts.map +1 -0
- package/dist/shell/location.d.ts +18 -0
- package/dist/shell/location.d.ts.map +1 -0
- package/dist/shell/routes.d.ts +19 -0
- package/dist/shell/routes.d.ts.map +1 -0
- package/dist/shell/useMediaQuery.d.ts +4 -0
- package/dist/shell/useMediaQuery.d.ts.map +1 -0
- package/dist/shell/useShellLocation.d.ts +37 -0
- package/dist/shell/useShellLocation.d.ts.map +1 -0
- package/package.json +42 -23
- package/dist/SettingToggleUnit.vue_vue_type_script_setup_true_lang-BM7-6aXj.js +0 -61
- package/dist/components/SettingToggleUnit/SettingToggleUnit.vue.d.ts +0 -16
- package/dist/components/SettingToggleUnit/SettingToggleUnit.vue.d.ts.map +0 -1
- package/dist/components/SettingToggleUnit/index.d.ts +0 -3
- package/dist/components/SettingToggleUnit/index.d.ts.map +0 -1
- package/dist/components/SettingToggleUnit/types.d.ts +0 -11
- package/dist/components/SettingToggleUnit/types.d.ts.map +0 -1
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import type { Component, ComputedRef, MaybeRefOrGetter, WritableComputedRef } from 'vue';
|
|
2
|
+
import type { ControlDefinition } from './controls';
|
|
3
|
+
/** Text translated per locale, e.g. `{ en: 'Phone number' }`. */
|
|
4
|
+
export type LocalizedText = Record<string, string>;
|
|
5
|
+
/** The value each field type stores. */
|
|
6
|
+
export interface SettingValueByType {
|
|
7
|
+
string: string;
|
|
8
|
+
number: number;
|
|
9
|
+
boolean: boolean;
|
|
10
|
+
/** Reference to an uploaded asset (`asset://…`); `null` clears it or, on a field with `fallback`, means inherit. */
|
|
11
|
+
asset: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Page actions. The field stores no value; its presence in the schema
|
|
14
|
+
* renders the action bar at the end of the page.
|
|
15
|
+
*/
|
|
16
|
+
actions: null;
|
|
17
|
+
}
|
|
18
|
+
/** Value types a setting field can declare. */
|
|
19
|
+
export type SettingFieldType = keyof SettingValueByType;
|
|
20
|
+
/** The stored value for a given field type; the full union by default. */
|
|
21
|
+
export type SettingFieldValue<K extends SettingFieldType = SettingFieldType> = SettingValueByType[K];
|
|
22
|
+
/**
|
|
23
|
+
* Controls the factory can render, declared in `presentation.control`.
|
|
24
|
+
* Fields without a declared control fall back to a default per value type.
|
|
25
|
+
*/
|
|
26
|
+
export type BuiltinSettingFieldControl = 'text' | 'select' | 'checkbox' | 'color' | 'phone' | 'period' | 'image-upload' | 'actions';
|
|
27
|
+
/**
|
|
28
|
+
* A built-in control name, or any name registered with `provideControls`.
|
|
29
|
+
* An unknown name renders the unsupported placeholder.
|
|
30
|
+
*/
|
|
31
|
+
export type SettingFieldControl = BuiltinSettingFieldControl | (string & {});
|
|
32
|
+
/** Validation constraints declared by a setting field. */
|
|
33
|
+
export interface SettingFieldConstraints {
|
|
34
|
+
/** Semantic format of the value, e.g. `'hex'`, `'phone'`, `'email'`. */
|
|
35
|
+
format?: string;
|
|
36
|
+
/** Whether a value must be provided. */
|
|
37
|
+
required?: boolean;
|
|
38
|
+
/** Maximum string length. */
|
|
39
|
+
maxLength?: number;
|
|
40
|
+
/** Regular expression the value must match. */
|
|
41
|
+
pattern?: string;
|
|
42
|
+
/** Allowed values. */
|
|
43
|
+
enum?: string[];
|
|
44
|
+
/** Allowed MIME types for `asset` fields. */
|
|
45
|
+
mimeTypes?: string[];
|
|
46
|
+
}
|
|
47
|
+
/** Where a field issue was produced. */
|
|
48
|
+
export type SettingFieldIssueSource = 'client' | 'server';
|
|
49
|
+
/** One validation problem, normalized to the field it belongs to. */
|
|
50
|
+
export interface SettingFieldIssue {
|
|
51
|
+
/** Key of the setting the issue belongs to. */
|
|
52
|
+
key: string;
|
|
53
|
+
/** Violated constraint name (e.g. `'maxLength'`), when known. */
|
|
54
|
+
constraint?: string;
|
|
55
|
+
/** Message resolved for the active locale. */
|
|
56
|
+
message: string;
|
|
57
|
+
/** Whether we caught it while editing or the application reported it. */
|
|
58
|
+
source: SettingFieldIssueSource;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Problem reported by the owning application after saving. It lands on the
|
|
62
|
+
* same field, rendered the same way, as one caught while editing.
|
|
63
|
+
*/
|
|
64
|
+
export interface ReportedFieldIssue {
|
|
65
|
+
key: string;
|
|
66
|
+
constraint?: string;
|
|
67
|
+
/** Already-localized message; preferred over any generic wording. */
|
|
68
|
+
message?: string;
|
|
69
|
+
}
|
|
70
|
+
/** Issue shape of the Standard Schema interface. */
|
|
71
|
+
export interface StandardSchemaIssue {
|
|
72
|
+
readonly message: string;
|
|
73
|
+
readonly path?: ReadonlyArray<PropertyKey | {
|
|
74
|
+
readonly key: PropertyKey;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
/** Validation result of the Standard Schema interface. */
|
|
78
|
+
export type StandardSchemaResult = {
|
|
79
|
+
readonly value: unknown;
|
|
80
|
+
readonly issues?: undefined;
|
|
81
|
+
} | {
|
|
82
|
+
readonly issues: ReadonlyArray<StandardSchemaIssue>;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Minimal Standard Schema v1 surface (standardschema.dev), implemented by
|
|
86
|
+
* zod >= 3.24, valibot, arktype, and our built-in constraint validator.
|
|
87
|
+
* Any of them can be plugged into `useFieldValidator` per field.
|
|
88
|
+
*/
|
|
89
|
+
export interface StandardSchemaV1 {
|
|
90
|
+
readonly '~standard': {
|
|
91
|
+
readonly version: 1;
|
|
92
|
+
readonly vendor: string;
|
|
93
|
+
readonly validate: (value: unknown) => StandardSchemaResult | Promise<StandardSchemaResult>;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** One selectable choice for `select` controls. */
|
|
97
|
+
export interface SettingFieldOption {
|
|
98
|
+
/** Stable value stored when the option is chosen. */
|
|
99
|
+
value: string;
|
|
100
|
+
/** Localized label shown in the option list. */
|
|
101
|
+
label: LocalizedText;
|
|
102
|
+
/** Whether the option can currently be chosen. */
|
|
103
|
+
disabled?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Which control renders the field, plus that control's input attributes.
|
|
107
|
+
* An open record: each control reads the entries it knows about.
|
|
108
|
+
*/
|
|
109
|
+
export interface SettingFieldPresentation extends Record<string, unknown> {
|
|
110
|
+
/** Control rendered for the field; defaults per value type. */
|
|
111
|
+
control?: SettingFieldControl;
|
|
112
|
+
/** Placeholder shown while the control has no value. */
|
|
113
|
+
placeholder?: string | LocalizedText;
|
|
114
|
+
/** Show a character counter next to `constraints.maxLength`. */
|
|
115
|
+
charCounter?: boolean;
|
|
116
|
+
/** Choices for `select` controls, always delivered statically. */
|
|
117
|
+
options?: SettingFieldOption[];
|
|
118
|
+
/** Label of the fallback toggle, e.g. `Same as logo`. */
|
|
119
|
+
inheritLabel?: LocalizedText;
|
|
120
|
+
/** Hint shown while the field inherits another setting's value. */
|
|
121
|
+
inheritHint?: LocalizedText;
|
|
122
|
+
}
|
|
123
|
+
/** Another setting this field falls back to while its toggle is on. */
|
|
124
|
+
export interface SettingFieldFallback {
|
|
125
|
+
/** Key of the setting whose value is copied. */
|
|
126
|
+
key: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Reactive state of a field's fallback, ready to render. `active` reads and
|
|
130
|
+
* writes the state manager's toggle for the field, so it survives unmount.
|
|
131
|
+
*/
|
|
132
|
+
export interface SettingFieldFallbackState {
|
|
133
|
+
/** Key of the setting whose value is copied. */
|
|
134
|
+
key: string;
|
|
135
|
+
/** Element id of the fallback toggle. */
|
|
136
|
+
id: string;
|
|
137
|
+
/** Toggle label resolved for the active locale, e.g. `Same as logo`. */
|
|
138
|
+
label: string;
|
|
139
|
+
/** Hint shown while the toggle is on, when `inheritHint` is declared. */
|
|
140
|
+
hint?: string;
|
|
141
|
+
/** Whether the fallback currently applies (v-model). */
|
|
142
|
+
active: boolean;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* What a rule does while its condition holds. `SHOW`/`ENABLE` mean the
|
|
146
|
+
* field is hidden/disabled *until* the condition holds; `HIDE`/`DISABLE`
|
|
147
|
+
* mean shown/enabled until it holds.
|
|
148
|
+
*/
|
|
149
|
+
export type SettingFieldRuleEffect = 'SHOW' | 'HIDE' | 'ENABLE' | 'DISABLE';
|
|
150
|
+
/**
|
|
151
|
+
* Compares one setting's current value. Pure data — no code is evaluated.
|
|
152
|
+
* Operators are combined with AND when several appear on one leaf.
|
|
153
|
+
*/
|
|
154
|
+
export interface SettingFieldConditionLeaf {
|
|
155
|
+
/** Key of the controlling setting; must resolve to a real setting. */
|
|
156
|
+
key: string;
|
|
157
|
+
equals?: unknown;
|
|
158
|
+
notEquals?: unknown;
|
|
159
|
+
in?: unknown[];
|
|
160
|
+
notIn?: unknown[];
|
|
161
|
+
gt?: number;
|
|
162
|
+
gte?: number;
|
|
163
|
+
lt?: number;
|
|
164
|
+
lte?: number;
|
|
165
|
+
/** Holds when the value is `undefined`, `null`, `''`, or an empty array. */
|
|
166
|
+
isEmpty?: boolean;
|
|
167
|
+
/** Holds when the value is not empty (see `isEmpty`). */
|
|
168
|
+
notEmpty?: boolean;
|
|
169
|
+
}
|
|
170
|
+
/** A condition leaf, or a combination via `allOf` / `anyOf` / `not`. */
|
|
171
|
+
export type SettingFieldCondition = SettingFieldConditionLeaf | {
|
|
172
|
+
allOf: SettingFieldCondition[];
|
|
173
|
+
} | {
|
|
174
|
+
anyOf: SettingFieldCondition[];
|
|
175
|
+
} | {
|
|
176
|
+
not: SettingFieldCondition;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Dependency between settings. Lives on the setting it governs and names
|
|
180
|
+
* the controlling setting(s) by key inside `when`. Multiple rules all
|
|
181
|
+
* apply; any HIDE wins over SHOW, any DISABLE wins over ENABLE.
|
|
182
|
+
*/
|
|
183
|
+
export interface SettingFieldRule {
|
|
184
|
+
effect: SettingFieldRuleEffect;
|
|
185
|
+
when: SettingFieldCondition;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Full description of a single org setting: identity, copy, value type,
|
|
189
|
+
* current value, and editing metadata. This is the payload `SkField`
|
|
190
|
+
* consumes to render a complete labelled input.
|
|
191
|
+
* An `actions` field may omit `label`: each button is a
|
|
192
|
+
* `presentation.options` entry, and that option's `value` is the method name
|
|
193
|
+
* emitted on click. Every other type requires one, so its input has an
|
|
194
|
+
* accessible name.
|
|
195
|
+
*/
|
|
196
|
+
export type SettingField<K extends SettingFieldType = SettingFieldType> = K extends SettingFieldType ? SettingFieldBase<K> & SettingFieldLabel<K> : never;
|
|
197
|
+
/** `label` is required, except on `actions` fields, whose buttons carry their own labels. */
|
|
198
|
+
export type SettingFieldLabel<K extends SettingFieldType> = K extends 'actions' ? {
|
|
199
|
+
/** Localized label; optional, since each button carries its own. */
|
|
200
|
+
label?: LocalizedText;
|
|
201
|
+
} : {
|
|
202
|
+
/** Localized label shown next to the control. */
|
|
203
|
+
label: LocalizedText;
|
|
204
|
+
};
|
|
205
|
+
/** Everything on a `SettingField` except `label`. */
|
|
206
|
+
export interface SettingFieldBase<K extends SettingFieldType = SettingFieldType> {
|
|
207
|
+
/** Namespaced identity of the setting, stable forever (e.g. `branding.appName`). */
|
|
208
|
+
key: string;
|
|
209
|
+
/** Optional localized supporting copy, shown as a label tooltip. */
|
|
210
|
+
description?: LocalizedText;
|
|
211
|
+
/** Value type of the setting; the value's type derives from it. */
|
|
212
|
+
type: K;
|
|
213
|
+
/** Validation constraints for the value. */
|
|
214
|
+
constraints?: SettingFieldConstraints;
|
|
215
|
+
/** Declared default value. */
|
|
216
|
+
default?: SettingValueByType[K];
|
|
217
|
+
/** Current stored value. */
|
|
218
|
+
value?: SettingValueByType[K];
|
|
219
|
+
/** Whether the current caller may change the value. */
|
|
220
|
+
editable?: boolean;
|
|
221
|
+
/** Setting this field falls back to, offered as a toggle on the control. */
|
|
222
|
+
fallback?: SettingFieldFallback;
|
|
223
|
+
/** Control choice and its input attributes. */
|
|
224
|
+
presentation?: SettingFieldPresentation;
|
|
225
|
+
/** Wording to use per violated constraint; a catalog, not a display trigger. */
|
|
226
|
+
errors?: Record<string, LocalizedText>;
|
|
227
|
+
/** Dependencies on other settings; evaluated against current values. */
|
|
228
|
+
rules?: SettingFieldRule[];
|
|
229
|
+
}
|
|
230
|
+
/** One shape per field type — the union API payloads deliver. */
|
|
231
|
+
export type AnySettingField = {
|
|
232
|
+
[K in SettingFieldType]: SettingField<K>;
|
|
233
|
+
}[SettingFieldType];
|
|
234
|
+
/** Shared root of `SkFieldProps` and `SettingFieldModel`: the setting being rendered. */
|
|
235
|
+
export interface SettingFieldRoot<K extends SettingFieldType = SettingFieldType> {
|
|
236
|
+
/** The setting field descriptor to render. */
|
|
237
|
+
field: SettingField<K>;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Lifecycle state of one field. `saving`, `conflicted` and `unavailable`
|
|
241
|
+
* come from the state manager; `invalid` from the validation composable.
|
|
242
|
+
*/
|
|
243
|
+
export type SettingFieldState = 'clean' | 'dirty' | 'invalid' | 'saving' | 'conflicted' | 'unavailable';
|
|
244
|
+
/** Field states only the state manager can impose. */
|
|
245
|
+
export type SettingFieldSessionState = Extract<SettingFieldState, 'saving' | 'conflicted' | 'unavailable'>;
|
|
246
|
+
/** States the state manager derives itself; `invalid` is layered on top by the field. */
|
|
247
|
+
export type SettingFieldStoreState = Exclude<SettingFieldState, 'invalid'>;
|
|
248
|
+
/** Outcome of a batch save, reported by the caller's `onSave`. */
|
|
249
|
+
export interface SettingsSaveResult {
|
|
250
|
+
/**
|
|
251
|
+
* Keys whose stored value changed server-side under the pending edit.
|
|
252
|
+
* A record carries the value now stored per key, so the admin can see
|
|
253
|
+
* both; a plain list marks the conflict without it.
|
|
254
|
+
*/
|
|
255
|
+
conflicts?: string[] | Record<string, unknown>;
|
|
256
|
+
/**
|
|
257
|
+
* Keys the application refused to store, e.g. failed validation. Their
|
|
258
|
+
* edits stay pending and `dirty` so the admin can correct them; report the
|
|
259
|
+
* reasons through `useFieldValidator.applyServerIssues`.
|
|
260
|
+
*/
|
|
261
|
+
rejected?: string[];
|
|
262
|
+
}
|
|
263
|
+
/** Load status of one settings area. */
|
|
264
|
+
export type SettingsAreaStatus = 'loading' | 'ready' | 'unavailable';
|
|
265
|
+
/**
|
|
266
|
+
* A group of settings delivered together, e.g. one backend endpoint. Each
|
|
267
|
+
* area loads on its own; one that fails leaves the others editable.
|
|
268
|
+
*/
|
|
269
|
+
export interface SettingsAreaOptions {
|
|
270
|
+
/** Stable identifier, e.g. `branding`. */
|
|
271
|
+
id: string;
|
|
272
|
+
/** Fields delivered up front; the area starts `ready`. */
|
|
273
|
+
fields?: SettingField[];
|
|
274
|
+
/** Loads the fields; the area is `loading` until it settles and `unavailable` if it rejects. */
|
|
275
|
+
load?: () => Promise<SettingField[]>;
|
|
276
|
+
/**
|
|
277
|
+
* Keys the area owns, known before its fields arrive. Lets a field report
|
|
278
|
+
* `unavailable` while its area is still loading or failed.
|
|
279
|
+
*/
|
|
280
|
+
keys?: string[];
|
|
281
|
+
}
|
|
282
|
+
/** Live state of one settings area. */
|
|
283
|
+
export interface SettingsArea {
|
|
284
|
+
/** Stable identifier, e.g. `branding`. */
|
|
285
|
+
id: string;
|
|
286
|
+
/** Load status. Fields of a non-`ready` area are `unavailable`. */
|
|
287
|
+
status: ComputedRef<SettingsAreaStatus>;
|
|
288
|
+
/** Fields the area currently holds; empty until `ready`. */
|
|
289
|
+
fields: ComputedRef<SettingField[]>;
|
|
290
|
+
/** Rejection reason of the last load, while `unavailable`. */
|
|
291
|
+
error: ComputedRef<unknown>;
|
|
292
|
+
/** Runs `load` again. No-op for an area delivered up front. */
|
|
293
|
+
reload: () => Promise<void>;
|
|
294
|
+
}
|
|
295
|
+
/** Configuration for a state manager (and so for `useSettingsForm`). */
|
|
296
|
+
export interface StateManagerOptions {
|
|
297
|
+
/**
|
|
298
|
+
* Persists the batched edits and refreshes the stored values.
|
|
299
|
+
* Keys someone else saved first are reported as `conflicts`, keys the
|
|
300
|
+
* application refused as `rejected`; a throw is a failed write that keeps
|
|
301
|
+
* every edit. Omitted, `save` resolves without a write (a field used on
|
|
302
|
+
* its own).
|
|
303
|
+
*/
|
|
304
|
+
onSave?: (changes: Record<string, unknown>) => Promise<SettingsSaveResult | void> | SettingsSaveResult | void;
|
|
305
|
+
/** Fields available right away, outside any area. Reactive sources are followed. */
|
|
306
|
+
fields?: MaybeRefOrGetter<SettingField[]>;
|
|
307
|
+
/** Fields grouped by area, each with its own load status. */
|
|
308
|
+
areas?: SettingsAreaOptions[];
|
|
309
|
+
}
|
|
310
|
+
/** @deprecated Use `StateManagerOptions`. */
|
|
311
|
+
export type SettingsFormSessionOptions = StateManagerOptions;
|
|
312
|
+
/**
|
|
313
|
+
* Per-key handle into the state manager. Stable for the lifetime of the
|
|
314
|
+
* manager: the same object is returned for the same key whether or not a
|
|
315
|
+
* component currently renders the field.
|
|
316
|
+
*/
|
|
317
|
+
export interface SettingFieldHandle {
|
|
318
|
+
/** Setting key the handle represents. */
|
|
319
|
+
key: string;
|
|
320
|
+
/** The schema field, once its area is ready. */
|
|
321
|
+
field: ComputedRef<SettingField | undefined>;
|
|
322
|
+
/** Stored value, else the declared default. The value a save compares against. */
|
|
323
|
+
base: ComputedRef<unknown>;
|
|
324
|
+
/** The admin's own unsaved edit; `undefined` while none is staged. */
|
|
325
|
+
pending: ComputedRef<unknown>;
|
|
326
|
+
/**
|
|
327
|
+
* Effective value: an active inheritance wins, then the pending edit,
|
|
328
|
+
* then `base`. Writing stages a pending edit.
|
|
329
|
+
*/
|
|
330
|
+
value: WritableComputedRef<unknown>;
|
|
331
|
+
/** Value stored by someone else, reported with a conflict; else `undefined`. */
|
|
332
|
+
remote: ComputedRef<unknown>;
|
|
333
|
+
/** Whether the fallback toggle is on. Writing stores an explicit choice. */
|
|
334
|
+
fallbackActive: WritableComputedRef<boolean>;
|
|
335
|
+
/** Schema default for the toggle: on until the field has an own value. */
|
|
336
|
+
fallbackActiveDefault: ComputedRef<boolean>;
|
|
337
|
+
/** Key of the setting the active fallback currently copies. */
|
|
338
|
+
inheritedFrom: ComputedRef<string | undefined>;
|
|
339
|
+
/** Whether another setting's value is currently copied in. */
|
|
340
|
+
inheriting: ComputedRef<boolean>;
|
|
341
|
+
/**
|
|
342
|
+
* Whether a save would change what is stored: the effective value differs
|
|
343
|
+
* from `base`, or, while the fallback is on, the stored value is not
|
|
344
|
+
* already empty (`null` means "inherit").
|
|
345
|
+
*/
|
|
346
|
+
isDirty: ComputedRef<boolean>;
|
|
347
|
+
/** Lifecycle state without validation: unavailable > saving > conflicted > dirty > clean. */
|
|
348
|
+
status: ComputedRef<SettingFieldStoreState>;
|
|
349
|
+
/** Stages `value` as the pending edit; `undefined` clears it. */
|
|
350
|
+
set: (value: unknown) => void;
|
|
351
|
+
/** Drops the pending edit and the explicit fallback choice. */
|
|
352
|
+
discard: () => void;
|
|
353
|
+
/** Stages the declared default as the pending edit. */
|
|
354
|
+
resetToDefault: () => void;
|
|
355
|
+
/**
|
|
356
|
+
* Resolves a conflict by keeping the sent value for the next save: the
|
|
357
|
+
* edit, the own value a rule reads, or the fallback choice is pinned and
|
|
358
|
+
* the reported stored value becomes the comparison baseline. Does nothing
|
|
359
|
+
* on a key that is not conflicted.
|
|
360
|
+
*/
|
|
361
|
+
keepMine: () => void;
|
|
362
|
+
/**
|
|
363
|
+
* Resolves a conflict by adopting the stored value and dropping the edit
|
|
364
|
+
* and fallback choice. A list-shaped conflict reports no value, so the
|
|
365
|
+
* field shows the old stored value, clean, until `fields` refreshes.
|
|
366
|
+
* Does nothing on a key that is not conflicted.
|
|
367
|
+
*/
|
|
368
|
+
takeTheirs: () => void;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Headless state manager: owns every field's pending edit, fallback choice
|
|
372
|
+
* and save/conflict status, resolves inheritance, and batches saves.
|
|
373
|
+
* Works with no component mounted.
|
|
374
|
+
*/
|
|
375
|
+
export interface StateManager {
|
|
376
|
+
/** Stable per-key handle; created on first access. */
|
|
377
|
+
field: (key: string) => SettingFieldHandle;
|
|
378
|
+
/** The schema field for a key: registered < `fields` < areas. */
|
|
379
|
+
fieldByKey: (key: string) => SettingField | undefined;
|
|
380
|
+
/**
|
|
381
|
+
* Registers a bound field's schema; every binding calls it on mount.
|
|
382
|
+
* Declared fields win; a key owned by an area that is not ready stays
|
|
383
|
+
* unavailable.
|
|
384
|
+
*/
|
|
385
|
+
register: (field: MaybeRefOrGetter<SettingField>) => void;
|
|
386
|
+
/** Effective value of a key (see `SettingFieldHandle.value`). */
|
|
387
|
+
valueOf: (key: string) => unknown;
|
|
388
|
+
/** All areas, in declaration order. */
|
|
389
|
+
areas: SettingsArea[];
|
|
390
|
+
/** The area owning a key, if any. */
|
|
391
|
+
areaOf: (key: string) => SettingsArea | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* Every known, available field. With `values`, the validator's input:
|
|
394
|
+
* `useFieldValidator(manager.fields, manager.values)`. Fields of an area
|
|
395
|
+
* that is loading or failed are left out, so they cannot block the form.
|
|
396
|
+
*/
|
|
397
|
+
fields: ComputedRef<SettingField[]>;
|
|
398
|
+
/** Effective value of every known, available field, keyed by setting key. */
|
|
399
|
+
values: ComputedRef<Record<string, unknown>>;
|
|
400
|
+
/**
|
|
401
|
+
* What a save would store for every dirty, available field, keyed by
|
|
402
|
+
* setting key: the effective value, or `null` while the fallback is on.
|
|
403
|
+
* Conflicted keys stay listed but are held back by `save` until resolved.
|
|
404
|
+
*/
|
|
405
|
+
changes: ComputedRef<Record<string, unknown>>;
|
|
406
|
+
/** Whether `save()` has something to send. Drives a Save button. */
|
|
407
|
+
canSave: ComputedRef<boolean>;
|
|
408
|
+
/**
|
|
409
|
+
* Whether any field is dirty, including fields of areas that are not ready
|
|
410
|
+
* and unresolved conflicts. Drives a "leave page?" guard and Discard.
|
|
411
|
+
*/
|
|
412
|
+
isDirty: ComputedRef<boolean>;
|
|
413
|
+
/** Whether a batch save is in flight. */
|
|
414
|
+
isSaving: ComputedRef<boolean>;
|
|
415
|
+
/** Keys whose last save was rejected as a conflict and not yet resolved. */
|
|
416
|
+
conflicts: ComputedRef<string[]>;
|
|
417
|
+
/**
|
|
418
|
+
* Saves `changes` via `onSave`, except conflicted keys; saved fields
|
|
419
|
+
* become clean, conflicts stay pending until `keepMine` or `takeTheirs`.
|
|
420
|
+
*/
|
|
421
|
+
save: () => Promise<void>;
|
|
422
|
+
/** Drops every pending edit, fallback choice and conflict. */
|
|
423
|
+
discard: () => void;
|
|
424
|
+
/** Stages one field's declared default without touching the others. */
|
|
425
|
+
resetToDefault: (key: string) => void;
|
|
426
|
+
}
|
|
427
|
+
/** @deprecated Use `StateManager`. */
|
|
428
|
+
export type SettingsFormSession = StateManager;
|
|
429
|
+
/** Props for the `SkField` component; the value type derives from `field.type`. */
|
|
430
|
+
export interface SkFieldProps<K extends SettingFieldType = SettingFieldType> extends SettingFieldRoot<K> {
|
|
431
|
+
/**
|
|
432
|
+
* Disables the control, typically supplied by the rules middleware
|
|
433
|
+
* (`evaluateRuleStates`). Merged with the field's own `editable` flag.
|
|
434
|
+
*/
|
|
435
|
+
disabled?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* Active validation messages shown under the control, typically supplied
|
|
438
|
+
* by the validation composable (`useFieldValidator`).
|
|
439
|
+
*/
|
|
440
|
+
errors?: string[];
|
|
441
|
+
}
|
|
442
|
+
/** Reactive field model `useSettingField` hands back; the value type derives from `field.type`. */
|
|
443
|
+
export interface SettingFieldModel<K extends SettingFieldType = SettingFieldType> extends SettingFieldRoot<K> {
|
|
444
|
+
/** Label resolved for the active locale. */
|
|
445
|
+
label: ComputedRef<string>;
|
|
446
|
+
/** Description resolved for the active locale, if declared. */
|
|
447
|
+
description: ComputedRef<string | undefined>;
|
|
448
|
+
/** Control definition: component, label placement, prop mapping. */
|
|
449
|
+
definition: ComputedRef<ControlDefinition>;
|
|
450
|
+
/** The component that renders the control. */
|
|
451
|
+
inputComponent: ComputedRef<Component>;
|
|
452
|
+
/** Control-specific props mapped from the field and locale context. */
|
|
453
|
+
controlProps: ComputedRef<Record<string, unknown>>;
|
|
454
|
+
/** Effective value: the edit, else the stored value, else the default. */
|
|
455
|
+
value: WritableComputedRef<SettingValueByType[K] | undefined>;
|
|
456
|
+
/** The field's own `editable` flag merged with the imposed state. */
|
|
457
|
+
disabled: ComputedRef<boolean>;
|
|
458
|
+
/** Active validation messages, as supplied by the validation composable. */
|
|
459
|
+
errors: ComputedRef<string[]>;
|
|
460
|
+
/** The admin's own unsaved edit; `undefined` while none is staged. */
|
|
461
|
+
pending: ComputedRef<SettingValueByType[K] | undefined>;
|
|
462
|
+
/** Value stored by someone else, reported with a conflict; else `undefined`. */
|
|
463
|
+
remote: ComputedRef<SettingValueByType[K] | undefined>;
|
|
464
|
+
/** Whether a save would change what is stored (see `SettingFieldHandle.isDirty`). */
|
|
465
|
+
isDirty: ComputedRef<boolean>;
|
|
466
|
+
/** Whether the active fallback currently copies another setting's value. */
|
|
467
|
+
inheriting: ComputedRef<boolean>;
|
|
468
|
+
/** Key of the setting currently copied in, while inheriting. */
|
|
469
|
+
inheritedFrom: ComputedRef<string | undefined>;
|
|
470
|
+
/** State of the field's fallback, ready to render; absent when none is declared. */
|
|
471
|
+
fallback?: SettingFieldFallbackState;
|
|
472
|
+
/** Canonical field state; manager states win, then invalid > dirty > clean. */
|
|
473
|
+
state: ComputedRef<SettingFieldState>;
|
|
474
|
+
/** The state manager the field is bound to (provided, passed, or private). */
|
|
475
|
+
session: StateManager;
|
|
476
|
+
/** Drops the field's pending edit and fallback choice. */
|
|
477
|
+
discard: () => void;
|
|
478
|
+
/** Stages the declared default as the pending edit. */
|
|
479
|
+
resetToDefault: () => void;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Base contract every SkField control extends, generic over the value the
|
|
483
|
+
* control edits. It gives all controls one shape — a typed v-model plus the
|
|
484
|
+
* shared attrs below — so `SkField` can bind any factory-produced control
|
|
485
|
+
* uniformly.
|
|
486
|
+
*/
|
|
487
|
+
export interface SkBaseControlProps<TValue = unknown> {
|
|
488
|
+
/** Current value of the control (v-model). */
|
|
489
|
+
modelValue?: TValue;
|
|
490
|
+
/** Element id, targeted by the field label's `for`. */
|
|
491
|
+
id?: string;
|
|
492
|
+
/** Form submission name of the control. */
|
|
493
|
+
name?: string;
|
|
494
|
+
/** Placeholder shown while the control has no value. */
|
|
495
|
+
placeholder?: string;
|
|
496
|
+
/** Whether the control is disabled. */
|
|
497
|
+
disabled?: boolean;
|
|
498
|
+
/** Whether another setting's value is currently copied into the control. */
|
|
499
|
+
inheriting?: boolean;
|
|
500
|
+
/** Whether a value must be provided. */
|
|
501
|
+
required?: boolean;
|
|
502
|
+
/** Field label; each control renders and positions it itself. */
|
|
503
|
+
label?: string;
|
|
504
|
+
/** Field description, shown as a tooltip on the label. */
|
|
505
|
+
tooltip?: string;
|
|
506
|
+
/** Localized error messages; each control renders and positions them itself. */
|
|
507
|
+
errors?: string[];
|
|
508
|
+
}
|
|
509
|
+
/** Value emits every input control implements. */
|
|
510
|
+
export type SkBaseControlEmits<TValue = unknown> = {
|
|
511
|
+
/** Emitted on every edit (v-model). */
|
|
512
|
+
'update:modelValue': [value: TValue | undefined];
|
|
513
|
+
/**
|
|
514
|
+
* Emitted when the user commits a value: a text input loses focus or is
|
|
515
|
+
* submitted, an option is picked, a toggle flips, a file lands.
|
|
516
|
+
*/
|
|
517
|
+
change: [value: TValue | undefined];
|
|
518
|
+
};
|
|
519
|
+
/** Emits of a button control: the pressed option's method name. */
|
|
520
|
+
export type SkActionControlEmits = {
|
|
521
|
+
action: [method: string];
|
|
522
|
+
};
|
|
523
|
+
/**
|
|
524
|
+
* Events `SkField` re-emits from its control. Which ones fire follows the
|
|
525
|
+
* control's kind: input controls report `update`/`change`, button controls
|
|
526
|
+
* report `action`.
|
|
527
|
+
*/
|
|
528
|
+
export type SkFieldEmits<K extends SettingFieldType = SettingFieldType> = {
|
|
529
|
+
/** Input control: every edit of the value. */
|
|
530
|
+
update: [value: SettingValueByType[K] | undefined];
|
|
531
|
+
/** Input control: the value was committed. */
|
|
532
|
+
change: [value: SettingValueByType[K] | undefined];
|
|
533
|
+
/** Button control: method name of the pressed option, e.g. `discard`. */
|
|
534
|
+
action: SkActionControlEmits['action'];
|
|
535
|
+
/**
|
|
536
|
+
* Output only: the effective value (inheritance applied, else the edit,
|
|
537
|
+
* else stored, else default), on mount and on every change.
|
|
538
|
+
*/
|
|
539
|
+
'update:effective': [value: SettingValueByType[K] | undefined];
|
|
540
|
+
};
|
|
541
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT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MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAAI;IACxE,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACnD,8CAA8C;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACnD,yEAAyE;IACzE,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACvC;;;OAGG;IACH,kBAAkB,EAAE,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;CAChE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WritableComputedRef } from 'vue';
|
|
2
|
+
import type { SkBaseControlEmits, SkBaseControlProps } from './types';
|
|
3
|
+
/** The slice of the base control props the model bridge reads. */
|
|
4
|
+
type ModelProps<TValue> = Pick<SkBaseControlProps<TValue>, 'modelValue'>;
|
|
5
|
+
/** Emit function shape produced by `defineEmits<SkBaseControlEmits<TValue>>()`. */
|
|
6
|
+
type ModelEmit<TValue> = (event: 'update:modelValue', ...args: SkBaseControlEmits<TValue>['update:modelValue']) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Bridges the base `modelValue` prop to a writable computed for `v-model`.
|
|
9
|
+
* @param emptyValue Substitute for an unset model on read.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useControlModel<TValue>(props: ModelProps<TValue>, emit: ModelEmit<TValue>, emptyValue?: TValue): WritableComputedRef<TValue | undefined>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useControlModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControlModel.d.ts","sourceRoot":"","sources":["../../src/core/useControlModel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,KAAK,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEtE,kEAAkE;AAClE,KAAK,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC;AAEzE,mFAAmF;AACnF,KAAK,SAAS,CAAC,MAAM,IAAI,CACvB,KAAK,EAAE,mBAAmB,EAC1B,GAAG,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,KACrD,IAAI,CAAC;AAEV;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EACpC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,EACzB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,EACvB,UAAU,CAAC,EAAE,MAAM,GAClB,mBAAmB,CAAC,MAAM,GAAG,SAAS,CAAC,CAKzC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ComputedRef, HTMLAttributes } from 'vue';
|
|
2
|
+
/** A11y attributes a control can forward. */
|
|
3
|
+
export type A11yAttrName = keyof Pick<HTMLAttributes, 'role' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-details' | 'aria-invalid' | 'aria-required' | 'aria-errormessage' | 'aria-live'>;
|
|
4
|
+
/** Resolved a11y attributes to bind on a control's focusable element. */
|
|
5
|
+
export type A11yAttrs = Partial<Pick<HTMLAttributes, A11yAttrName>>;
|
|
6
|
+
/** DOM id of a control's rendered error list, derived from its input id. */
|
|
7
|
+
export declare function skErrorId(id: string): string;
|
|
8
|
+
/** DOM id of a control's visible description, derived from its input id. */
|
|
9
|
+
export declare function skDescriptionId(id: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Aria attributes for a field's validity and requirement state.
|
|
12
|
+
* Spread into a control's props; `useA11yAttrs` forwards them to the input.
|
|
13
|
+
*/
|
|
14
|
+
export declare function skA11yAttrs(options: {
|
|
15
|
+
id: string;
|
|
16
|
+
invalid: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
}): A11yAttrs;
|
|
19
|
+
/**
|
|
20
|
+
* Picks a control's supported a11y attributes from its fallthrough attrs.
|
|
21
|
+
* Use with `inheritAttrs: false` and bind the result on the focusable element.
|
|
22
|
+
* @param required A11y attributes the control supports.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useA11yAttrs(required: A11yAttrName[]): ComputedRef<A11yAttrs>;
|
|
25
|
+
//# sourceMappingURL=a11y.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["../../../src/core/utils/a11y.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAGvD,6CAA6C;AAC7C,MAAM,MAAM,YAAY,GAAG,MAAM,IAAI,CACnC,cAAc,EACZ,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,kBAAkB,GAClB,cAAc,GACd,cAAc,GACd,eAAe,GACf,mBAAmB,GACnB,WAAW,CACd,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;AAEpE,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,SAAS,CAMZ;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC,SAAS,CAAC,CAY7E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** v-model modifiers that opt into a value cast; without one the value passes through as-is (string by default). */
|
|
2
|
+
export interface SkModelCastModifiers {
|
|
3
|
+
number?: boolean;
|
|
4
|
+
boolean?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Casts an incoming v-model value per modifier; unparsable values pass through unchanged. */
|
|
7
|
+
export declare function skCastModelValue(value: unknown, modifiers: SkModelCastModifiers): unknown;
|
|
8
|
+
//# sourceMappingURL=cast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cast.d.ts","sourceRoot":"","sources":["../../../src/core/utils/cast.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,oBAAoB,GAC9B,OAAO,CAkBT"}
|