@golemui/gui-shared 1.1.0 → 1.1.1-rc.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.
Files changed (162) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/index.js +6 -5
  3. package/index.umd.cjs +1 -1
  4. package/internals.js +162 -757
  5. package/internals.umd.cjs +1 -1
  6. package/lib/dx/__tests__/helpers.d.ts +1 -1
  7. package/lib/dx/formDef.domain.d.ts +7 -33
  8. package/lib/dx/formDefs.d.ts +5 -0
  9. package/lib/dx/gui.d.ts +7 -7
  10. package/lib/dx/index.d.ts +11 -11
  11. package/lib/dx/registry.d.ts +26 -0
  12. package/lib/dx/resolveFormInput.d.ts +5 -20
  13. package/lib/dx/shortcuts/accordion/accordion.domain.d.ts +1 -3
  14. package/lib/dx/shortcuts/accordion/guiAccordion.impl.d.ts +1 -1
  15. package/lib/dx/shortcuts/accordion/register.d.ts +4 -2
  16. package/lib/dx/shortcuts/actions/actions.domain.d.ts +1 -2
  17. package/lib/dx/shortcuts/actions/guiActions.impl.d.ts +1 -1
  18. package/lib/dx/shortcuts/actions/register.d.ts +3 -1
  19. package/lib/dx/shortcuts/alert/alert.domain.d.ts +1 -2
  20. package/lib/dx/shortcuts/alert/guiAlert.impl.d.ts +1 -1
  21. package/lib/dx/shortcuts/alert/register.d.ts +4 -2
  22. package/lib/dx/shortcuts/calendar/calendar.domain.d.ts +1 -3
  23. package/lib/dx/shortcuts/calendar/guiCalendar.impl.d.ts +1 -1
  24. package/lib/dx/shortcuts/calendar/register.d.ts +4 -2
  25. package/lib/dx/shortcuts/checkbox/checkbox.domain.d.ts +1 -3
  26. package/lib/dx/shortcuts/checkbox/guiCheckbox.impl.d.ts +1 -1
  27. package/lib/dx/shortcuts/checkbox/register.d.ts +4 -2
  28. package/lib/dx/shortcuts/currency/currency.domain.d.ts +1 -3
  29. package/lib/dx/shortcuts/currency/guiCurrency.impl.d.ts +1 -1
  30. package/lib/dx/shortcuts/currency/register.d.ts +4 -2
  31. package/lib/dx/shortcuts/custom-action/customAction.domain.d.ts +1 -2
  32. package/lib/dx/shortcuts/custom-action/guiCustomAction.impl.d.ts +1 -1
  33. package/lib/dx/shortcuts/custom-action/register.d.ts +4 -2
  34. package/lib/dx/shortcuts/custom-display/customDisplay.domain.d.ts +1 -2
  35. package/lib/dx/shortcuts/custom-display/guiCustomDisplay.impl.d.ts +1 -1
  36. package/lib/dx/shortcuts/custom-display/register.d.ts +4 -2
  37. package/lib/dx/shortcuts/custom-input/customInput.domain.d.ts +1 -2
  38. package/lib/dx/shortcuts/custom-input/guiCustomInput.impl.d.ts +1 -1
  39. package/lib/dx/shortcuts/custom-input/register.d.ts +4 -2
  40. package/lib/dx/shortcuts/custom-layout/customLayout.domain.d.ts +1 -3
  41. package/lib/dx/shortcuts/custom-layout/guiCustomLayout.impl.d.ts +1 -2
  42. package/lib/dx/shortcuts/custom-layout/register.d.ts +4 -2
  43. package/lib/dx/shortcuts/date-input/dateInput.domain.d.ts +1 -3
  44. package/lib/dx/shortcuts/date-input/guiDateInput.impl.d.ts +1 -1
  45. package/lib/dx/shortcuts/date-input/register.d.ts +4 -2
  46. package/lib/dx/shortcuts/date-picker/datePicker.domain.d.ts +1 -3
  47. package/lib/dx/shortcuts/date-picker/guiDatePicker.impl.d.ts +1 -1
  48. package/lib/dx/shortcuts/date-picker/register.d.ts +4 -2
  49. package/lib/dx/shortcuts/date-time-calendar/dateTimeCalendar.domain.d.ts +1 -3
  50. package/lib/dx/shortcuts/date-time-calendar/guiDateTimeCalendar.impl.d.ts +1 -1
  51. package/lib/dx/shortcuts/date-time-calendar/register.d.ts +4 -2
  52. package/lib/dx/shortcuts/date-time-input/dateTimeInput.domain.d.ts +1 -3
  53. package/lib/dx/shortcuts/date-time-input/guiDateTimeInput.impl.d.ts +1 -1
  54. package/lib/dx/shortcuts/date-time-input/register.d.ts +4 -2
  55. package/lib/dx/shortcuts/date-time-picker/dateTimePicker.domain.d.ts +1 -3
  56. package/lib/dx/shortcuts/date-time-picker/guiDateTimePicker.impl.d.ts +1 -1
  57. package/lib/dx/shortcuts/date-time-picker/register.d.ts +4 -2
  58. package/lib/dx/shortcuts/display/display.domain.d.ts +1 -2
  59. package/lib/dx/shortcuts/display/guiDisplay.impl.d.ts +1 -1
  60. package/lib/dx/shortcuts/display/register.d.ts +4 -2
  61. package/lib/dx/shortcuts/dropdown/dropdown.domain.d.ts +1 -2
  62. package/lib/dx/shortcuts/dropdown/guiDropdown.impl.d.ts +1 -1
  63. package/lib/dx/shortcuts/dropdown/register.d.ts +4 -2
  64. package/lib/dx/shortcuts/inputs/gslInputSubtypes.d.ts +3 -3
  65. package/lib/dx/shortcuts/inputs/guiBooleanInput.impl.d.ts +1 -1
  66. package/lib/dx/shortcuts/inputs/guiNumberInput.impl.d.ts +1 -1
  67. package/lib/dx/shortcuts/inputs/guiTextInput.impl.d.ts +1 -1
  68. package/lib/dx/shortcuts/inputs/inputSensibleDefaults.service.d.ts +1 -1
  69. package/lib/dx/shortcuts/inputs/inputs.domain.d.ts +1 -3
  70. package/lib/dx/shortcuts/inputs/register.d.ts +4 -2
  71. package/lib/dx/shortcuts/layouts/guiFlex.impl.d.ts +1 -1
  72. package/lib/dx/shortcuts/layouts/layouts.domain.d.ts +1 -3
  73. package/lib/dx/shortcuts/layouts/register.d.ts +4 -2
  74. package/lib/dx/shortcuts/list/guiList.impl.d.ts +1 -1
  75. package/lib/dx/shortcuts/list/list.domain.d.ts +1 -2
  76. package/lib/dx/shortcuts/list/register.d.ts +4 -2
  77. package/lib/dx/shortcuts/markdown/guiMarkdown.impl.d.ts +1 -1
  78. package/lib/dx/shortcuts/markdown/markdown.domain.d.ts +1 -3
  79. package/lib/dx/shortcuts/markdown/register.d.ts +4 -2
  80. package/lib/dx/shortcuts/markdown-text/guiMarkdownText.impl.d.ts +1 -1
  81. package/lib/dx/shortcuts/markdown-text/markdownText.domain.d.ts +1 -2
  82. package/lib/dx/shortcuts/markdown-text/register.d.ts +4 -2
  83. package/lib/dx/shortcuts/password/guiPassword.impl.d.ts +1 -1
  84. package/lib/dx/shortcuts/password/password.domain.d.ts +1 -3
  85. package/lib/dx/shortcuts/password/register.d.ts +4 -2
  86. package/lib/dx/shortcuts/radiogroup/guiRadiogroup.impl.d.ts +1 -1
  87. package/lib/dx/shortcuts/radiogroup/radiogroup.domain.d.ts +1 -2
  88. package/lib/dx/shortcuts/radiogroup/register.d.ts +4 -2
  89. package/lib/dx/shortcuts/range-calendar/guiRangeCalendar.impl.d.ts +1 -1
  90. package/lib/dx/shortcuts/range-calendar/rangeCalendar.domain.d.ts +1 -3
  91. package/lib/dx/shortcuts/range-calendar/register.d.ts +4 -2
  92. package/lib/dx/shortcuts/range-date-input/guiRangeDateInput.impl.d.ts +1 -1
  93. package/lib/dx/shortcuts/range-date-input/rangeDateInput.domain.d.ts +1 -3
  94. package/lib/dx/shortcuts/range-date-input/register.d.ts +4 -2
  95. package/lib/dx/shortcuts/range-date-picker/guiRangeDatePicker.impl.d.ts +1 -1
  96. package/lib/dx/shortcuts/range-date-picker/rangeDatePicker.domain.d.ts +1 -3
  97. package/lib/dx/shortcuts/range-date-picker/register.d.ts +4 -2
  98. package/lib/dx/shortcuts/range-date-time-calendar/guiRangeDateTimeCalendar.impl.d.ts +1 -1
  99. package/lib/dx/shortcuts/range-date-time-calendar/rangeDateTimeCalendar.domain.d.ts +1 -3
  100. package/lib/dx/shortcuts/range-date-time-calendar/register.d.ts +4 -2
  101. package/lib/dx/shortcuts/range-date-time-input/guiRangeDateTimeInput.impl.d.ts +1 -1
  102. package/lib/dx/shortcuts/range-date-time-input/rangeDateTimeInput.domain.d.ts +1 -3
  103. package/lib/dx/shortcuts/range-date-time-input/register.d.ts +4 -2
  104. package/lib/dx/shortcuts/range-date-time-picker/guiRangeDateTimePicker.impl.d.ts +1 -1
  105. package/lib/dx/shortcuts/range-date-time-picker/rangeDateTimePicker.domain.d.ts +1 -3
  106. package/lib/dx/shortcuts/range-date-time-picker/register.d.ts +4 -2
  107. package/lib/dx/shortcuts/range-time-input/guiRangeTimeInput.impl.d.ts +1 -1
  108. package/lib/dx/shortcuts/range-time-input/rangeTimeInput.domain.d.ts +1 -3
  109. package/lib/dx/shortcuts/range-time-input/register.d.ts +4 -2
  110. package/lib/dx/shortcuts/range-time-picker/guiRangeTimePicker.impl.d.ts +1 -1
  111. package/lib/dx/shortcuts/range-time-picker/rangeTimePicker.domain.d.ts +1 -3
  112. package/lib/dx/shortcuts/range-time-picker/register.d.ts +4 -2
  113. package/lib/dx/shortcuts/repeater/guiRepeater.impl.d.ts +1 -1
  114. package/lib/dx/shortcuts/repeater/register.d.ts +5 -3
  115. package/lib/dx/shortcuts/repeater/repeater.domain.d.ts +1 -4
  116. package/lib/dx/shortcuts/scopes/gslStates.impl.d.ts +1 -1
  117. package/lib/dx/shortcuts/scopes/gslTag.impl.d.ts +1 -1
  118. package/lib/dx/shortcuts/scopes/scopeChain.d.ts +1 -1
  119. package/lib/dx/shortcuts/select/guiSelect.impl.d.ts +1 -1
  120. package/lib/dx/shortcuts/select/register.d.ts +4 -2
  121. package/lib/dx/shortcuts/select/select.domain.d.ts +1 -2
  122. package/lib/dx/shortcuts/tabs/guiTabs.impl.d.ts +1 -1
  123. package/lib/dx/shortcuts/tabs/register.d.ts +4 -2
  124. package/lib/dx/shortcuts/tabs/tabs.domain.d.ts +1 -3
  125. package/lib/dx/shortcuts/tags/guiTags.impl.d.ts +1 -1
  126. package/lib/dx/shortcuts/tags/register.d.ts +4 -2
  127. package/lib/dx/shortcuts/tags/tags.domain.d.ts +1 -3
  128. package/lib/dx/shortcuts/textarea/guiTextarea.impl.d.ts +1 -1
  129. package/lib/dx/shortcuts/textarea/register.d.ts +4 -2
  130. package/lib/dx/shortcuts/textarea/textarea.domain.d.ts +1 -3
  131. package/lib/dx/shortcuts/time-input/guiTimeInput.impl.d.ts +1 -1
  132. package/lib/dx/shortcuts/time-input/register.d.ts +4 -2
  133. package/lib/dx/shortcuts/time-input/timeInput.domain.d.ts +1 -3
  134. package/lib/dx/shortcuts/time-picker/guiTimePicker.impl.d.ts +1 -1
  135. package/lib/dx/shortcuts/time-picker/register.d.ts +4 -2
  136. package/lib/dx/shortcuts/time-picker/timePicker.domain.d.ts +1 -3
  137. package/lib/shared.d.ts +1 -13
  138. package/lib/widget.props.d.ts +55 -6
  139. package/lib/widgets.d.ts +1 -1
  140. package/package.json +7 -3
  141. package/resolveFormInput-DDKerzen.cjs +1 -0
  142. package/{register-C4dCzlrS.js → resolveFormInput-Dp0TB3LB.js} +543 -635
  143. package/lib/dx/core/defineShortcutType.d.ts +0 -38
  144. package/lib/dx/core/dx.domain.d.ts +0 -79
  145. package/lib/dx/core/dxBase.types.d.ts +0 -128
  146. package/lib/dx/core/dxPropsHelper.d.ts +0 -9
  147. package/lib/dx/core/dxUtilityTypes.d.ts +0 -40
  148. package/lib/dx/core/dxValidatorHelper.d.ts +0 -31
  149. package/lib/dx/core/eventWiring.service.d.ts +0 -34
  150. package/lib/dx/core/itemTypeRegistry.d.ts +0 -82
  151. package/lib/dx/core/itemWalker.service.d.ts +0 -31
  152. package/lib/dx/core/selectorNormalizer.service.d.ts +0 -15
  153. package/lib/dx/core/selectorResolver.service.d.ts +0 -11
  154. package/lib/dx/core/sharedSensibleDefaults.service.d.ts +0 -35
  155. package/lib/dx/core/stateExpansion.service.d.ts +0 -31
  156. package/lib/dx/core/widgetMapper.service.d.ts +0 -13
  157. package/lib/dx/core/widgetMerger.service.d.ts +0 -14
  158. package/lib/dx/core/withForm.d.ts +0 -8
  159. package/lib/dx/dx.service.d.ts +0 -36
  160. package/lib/dx/registerAll.d.ts +0 -0
  161. package/lib/utils/objectUtils.service.d.ts +0 -11
  162. package/register-KU4CGoTQ.cjs +0 -1
@@ -1,38 +0,0 @@
1
- import { NonFunctionWidget, FormWidget } from '@golemui/core';
2
- import { GslLeafSelector, MergeResult } from './dx.domain';
3
- import { GslConfigBase } from './dxUtilityTypes';
4
- import { AfterMergeContext, BuildWidgetContext } from './itemTypeRegistry';
5
- import { DxCommonFields } from './dxBase.types';
6
- type EntryShape = 'bare' | 'keyed' | 'compound';
7
- interface SensibleDefaultsSpec<TDecorator, TConfig> {
8
- base: TConfig;
9
- fields: (keyof TConfig)[];
10
- apply: (def: TDecorator, config: TConfig) => TDecorator;
11
- }
12
- interface ShortcutTypeConfig<TEntry, TDecorator, TConfig> {
13
- itemType: string;
14
- entryShape: EntryShape;
15
- mapToWidget: (def: TDecorator) => NonFunctionWidget;
16
- sensibleDefaults?: SensibleDefaultsSpec<TDecorator, TConfig>;
17
- afterMerge?: (mergeResult: MergeResult, context: AfterMergeContext) => MergeResult;
18
- buildCustomWidget?: (mergeResult: MergeResult, context: BuildWidgetContext) => FormWidget;
19
- getChildren?: (entry: TEntry) => any[] | undefined;
20
- }
21
- export interface ShortcutTypeSelectors<TDecorator, TConfig extends GslConfigBase<TDecorator>> {
22
- gsl: (config: TConfig, matcher?: (decorator: TDecorator) => boolean) => GslLeafSelector;
23
- gslByUid: (uid: string, config: TConfig) => GslLeafSelector;
24
- }
25
- /**
26
- * Convenience factory for registering a new widget type into the DX pipeline.
27
- *
28
- * Accepts a simple config object (entry shape, mapToWidget, optional hooks) and
29
- * assembles a full {@link ItemTypeHandler} from it — generating `parseEntry`,
30
- * `rollUpSensibleDefaults`, and `applySensibleDefaults` automatically.
31
- * The handler is registered in the global registry so the pipeline can look it up
32
- * by `itemType` at runtime.
33
- *
34
- * Returns GSL selector factories (`gsl`, `gslByUid`) for styling/configuring
35
- * widgets of this type.
36
- */
37
- export declare function defineShortcutType<TEntry, TDecorator extends DxCommonFields, TConfig extends GslConfigBase<TDecorator> = GslConfigBase<TDecorator>>(config: ShortcutTypeConfig<TEntry, TDecorator, TConfig>): ShortcutTypeSelectors<TDecorator, TConfig>;
38
- export {};
@@ -1,79 +0,0 @@
1
- import { ExpressionFunctions, FunctionWidgetParams, ValidateOn } from '@golemui/core';
2
- import { WidgetItemDecorator, GslItemType } from '../formDef.domain';
3
- import { Dependencies } from '../../shared';
4
- export type { GslItemType } from '../formDef.domain';
5
- export type RuntimeFunction = (params: FunctionWidgetParams<any>) => any;
6
- export type GuiItemType = string;
7
- export declare const GuiItemTypes: {
8
- readonly INPUTS: "INPUTS";
9
- readonly ACTIONS: "ACTIONS";
10
- readonly LAYOUTS: "LAYOUTS";
11
- readonly DISPLAYS: "DISPLAYS";
12
- readonly CUSTOM_DISPLAY: "CUSTOM_DISPLAY";
13
- readonly CUSTOM_INPUT: "CUSTOM_INPUT";
14
- readonly CUSTOM_ACTION: "CUSTOM_ACTION";
15
- readonly CUSTOM_LAYOUT: "CUSTOM_LAYOUT";
16
- };
17
- export interface GuiItemsShortcut {
18
- type: 'ITEMS';
19
- itemType: GuiItemType;
20
- items: unknown[];
21
- tags: string[];
22
- }
23
- export type ValidGuiShortcut = GuiItemsShortcut;
24
- export type GslMatcher = (decorator: WidgetItemDecorator) => boolean;
25
- export type GslLeafConfig = Record<string, any>;
26
- export interface GslLeafSelector {
27
- kind: 'leaf';
28
- selectorType: GslItemType;
29
- matcher: (decorator: any) => boolean;
30
- config: GslLeafConfig;
31
- /** When set by `_gslStates`, config is applied as state-suffixed overrides. */
32
- targetState?: string;
33
- }
34
- export interface FormConfig {
35
- suppressAutomaticStack?: boolean;
36
- dependencies?: Dependencies;
37
- /**
38
- * Pure functions callable from reactive expressions under the `$fn` namespace.
39
- * Functions passed in the wrapper's `config.functions` win on name collisions.
40
- */
41
- functions?: ExpressionFunctions;
42
- widgetLoaders?: Record<string, () => Promise<unknown>>;
43
- validateOn?: ValidateOn;
44
- states?: Record<string, string>;
45
- /**
46
- * Framework-specific item renderers (e.g. ReactItemRenderer / AngularItemRenderer / LitItemRenderer).
47
- * Forwarded to the unified <gui-form>; the type is intentionally framework-agnostic
48
- * here and gets narrowed at the framework wrapper boundary.
49
- */
50
- itemRenderers?: Record<string, unknown>;
51
- }
52
- /**
53
- * Public-facing form config type for `processDxFacade`'s third argument.
54
- * Generic over state keys — TypeScript enforces that every declared state name
55
- * has a corresponding expression.
56
- *
57
- * Usage: `processDxFacade<typeof states[number], FormData>(defs, selectors, formConfig)`
58
- */
59
- export type DxFormConfig<S extends string = string> = Omit<FormConfig, 'states'> & {
60
- states?: Record<S, string>;
61
- };
62
- export interface GslAggregatedSelector {
63
- kind: 'aggregated';
64
- matcher: GslMatcher;
65
- children: GslLeafSelector[];
66
- }
67
- export type GslSelector = GslAggregatedSelector | GslLeafSelector;
68
- export type GslSelectorsInput = GslSelector | GslSelector[];
69
- export interface ResolvedSelectors {
70
- leafSelectors: GslLeafSelector[];
71
- sensibleDefaults: Record<string, Record<string, any>>;
72
- }
73
- export type MergeResult = {
74
- kind: 'static';
75
- def: Record<string, any>;
76
- } | {
77
- kind: 'dynamic';
78
- fn: RuntimeFunction;
79
- };
@@ -1,128 +0,0 @@
1
- import { ActionWidget, FormEvent, Localizable, ReactiveExpression } from '@golemui/core';
2
- /**
3
- * DX-enriched FormEvent. Extends the core FormEvent with `update()` — the
4
- * recommended way for DX event handlers to push widget property changes.
5
- *
6
- * `update({ path: 'widget', options: [...] })` translates to OVERRIDE_WIDGET_PROP
7
- * dispatches under the hood. `callback` is also available for raw/backward-compat use.
8
- */
9
- export type DxFormEvent = FormEvent & {
10
- update: (arg: {
11
- path: string;
12
- [prop: string]: any;
13
- }) => void;
14
- };
15
- /**
16
- * Event handler type for DX event properties.
17
- *
18
- * Function-only, mirroring action `onClick`. Bare strings are NOT accepted — a stray
19
- * `onChange: 'something'` is a footgun (it looks like a value, not a handler), so the
20
- * type rejects it.
21
- *
22
- * - Return a string to wire a host-managed event name (e.g. `onChange: () => 'fieldChange'`
23
- * dispatches `fieldChange` to the host event bus). Only zero-arg handlers are probed for
24
- * this, so the `event` parameter is never touched at build time.
25
- * - Otherwise the handler runs on dispatch; use `event.update(...)` to push widget changes.
26
- *
27
- * @example
28
- * // Host-managed dispatch by name:
29
- * onChange: () => 'fieldChange'
30
- * @example
31
- * // Imperative handler:
32
- * onChange: (event) => event.update({ path: 'country', options: [] })
33
- */
34
- export type DxEventHandler = (event: DxFormEvent) => void | string;
35
- /**
36
- * INTERNAL decorator fields — used by the pipeline, NOT by form authors.
37
- * Contains fields that the pipeline needs but users should never set.
38
- */
39
- export interface DxInternalFields {
40
- itemType?: string;
41
- removeField?: boolean;
42
- /**
43
- * Sub-type discriminator on the decorator (e.g. `'text' | 'number' | 'boolean'`
44
- * for inputs that share the `INPUTS` itemType, `'password'`, `'dropdown'`, etc.
45
- * for top-level itemTypes). Carried into the matching phase so sub-type
46
- * matchers like `_gslTextInputs((d) => d.type === 'text')` work.
47
- */
48
- type?: string;
49
- }
50
- /**
51
- * Conditional inclusion: state-list or reactive expression form.
52
- * Mirrors core's `include` shape on `BaseWidget`.
53
- */
54
- export type DxIncludeCondition = {
55
- in: string[];
56
- } | {
57
- when: ReactiveExpression;
58
- };
59
- /**
60
- * Conditional exclusion: state-list or reactive expression form.
61
- * Mirrors core's `exclude` shape on `BaseWidget`.
62
- */
63
- export type DxExcludeCondition = {
64
- from: string[];
65
- } | {
66
- when: ReactiveExpression;
67
- };
68
- /**
69
- * User-settable common fields available on ALL decorator types.
70
- */
71
- export interface DxCommonFields {
72
- uid?: string;
73
- tags?: string[];
74
- size?: number;
75
- /**
76
- * Per-state property overrides. Keys are state names (use `:` for hierarchy).
77
- *
78
- * NOTE: the override values are an untyped escape hatch (`Record<string, any>`), so they
79
- * are NOT type-checked — e.g. `states: { editing: { onChange: 'foo' } }` compiles even
80
- * though a top-level `onChange: 'foo'` does not (events are function-only).
81
- */
82
- states?: Record<string, Record<string, any>>;
83
- /** Conditionally include the widget — by active state list or reactive expression. */
84
- include?: DxIncludeCondition;
85
- /** Conditionally exclude the widget — by active state list or reactive expression. */
86
- exclude?: DxExcludeCondition;
87
- }
88
- /**
89
- * PUBLIC base for input-like decorators.
90
- * Clean projection of InputWidget properties — no generics, no SomeSuffixable.
91
- */
92
- export interface DxInputBase {
93
- path?: string;
94
- label?: Localizable | null;
95
- disabled?: boolean | {
96
- when: ReactiveExpression;
97
- };
98
- readonly?: boolean | {
99
- when: ReactiveExpression;
100
- };
101
- defaultValue?: unknown;
102
- onLoad?: DxEventHandler;
103
- onChange?: DxEventHandler;
104
- onFilter?: DxEventHandler;
105
- onBlur?: DxEventHandler;
106
- }
107
- /**
108
- * PUBLIC base for action decorators.
109
- */
110
- export interface DxActionBase {
111
- label?: Localizable;
112
- disabled?: boolean | {
113
- when: ReactiveExpression;
114
- };
115
- actionType?: ActionWidget['actionType'];
116
- }
117
- /**
118
- * PUBLIC base for layout decorators.
119
- */
120
- export interface DxLayoutBase {
121
- onChange?: DxEventHandler;
122
- }
123
- /**
124
- * PUBLIC base for display decorators.
125
- * Displays are render-function-only — no shared properties beyond uid.
126
- */
127
- export interface DxDisplayBase {
128
- }
@@ -1,9 +0,0 @@
1
- import { DxCommonFields, DxInputBase } from './dxBase.types';
2
- type DxBaseKeys = keyof DxInputBase | keyof DxCommonFields | 'type';
3
- /**
4
- * Extract widget-specific props from a flattened decorator.
5
- * Strips DxInputBase + DxCommonFields fields, event properties,
6
- * and pipeline-internal `on` from the output.
7
- */
8
- export declare function extractWidgetProps<D extends DxInputBase & DxCommonFields>(def: D): Omit<D, DxBaseKeys>;
9
- export {};
@@ -1,40 +0,0 @@
1
- import { FunctionWidgetParams } from '@golemui/core';
2
- import { RuntimeFunction, GuiItemsShortcut, GslLeafSelector } from './dx.domain';
3
- export type DxRuntimeParams<FormData = any> = FunctionWidgetParams<FormData>;
4
- /**
5
- * Generic GSL decorator callback — same structure for every type.
6
- * Usage: replace per-type `GslCalendarDecoratorCallback`, `GslInputDecoratorCallback`, etc.
7
- */
8
- export type GslDecoratorCallback<D> = (current: D) => Partial<D> | RuntimeFunction;
9
- /**
10
- * A field definition can be a static decorator or a runtime callback.
11
- * Usage: replace per-type `CalendarDefOrCallback`, `ActionDefOrCallback`, etc.
12
- */
13
- export type DefOrCallback<D, TForm = any> = D | ((params: DxRuntimeParams<TForm>) => Partial<D>);
14
- /**
15
- * Standard GSL config shape — override + optional suppress flags.
16
- * Extend this for types that have additional GSL config fields.
17
- * Usage: replace per-type `GslCalendarConfig`, `GslInputConfig`, etc. base shape.
18
- */
19
- export interface GslConfigBase<D> {
20
- override?: Partial<D> | GslDecoratorCallback<D>;
21
- }
22
- /**
23
- * Typed GUI shortcut sub-interface.
24
- * Usage: replace per-type `GuiCalendarShortcut`, `GuiInputsShortcut`, etc.
25
- */
26
- export interface GuiShortcutOf<TItemType extends string, TEntry> extends GuiItemsShortcut {
27
- itemType: TItemType;
28
- items: TEntry[];
29
- }
30
- /**
31
- * Creates a GSL selector factory for a given shortcut type.
32
- * Eliminates the need for per-type gsl*.impl.ts files.
33
- *
34
- * @example
35
- * ```ts
36
- * export const _gslCalendars = createGslSelector<CalendarDecorator, GslCalendarConfig>('CALENDAR');
37
- * // Equivalent to the hand-written gslCalendar.impl.ts factory
38
- * ```
39
- */
40
- export declare function createGslSelector<D, TConfig extends GslConfigBase<D> = GslConfigBase<D>>(selectorType: string): (config: TConfig, matcher?: (decorator: D) => boolean) => GslLeafSelector;
@@ -1,31 +0,0 @@
1
- import { CustomValidator, Validator } from '@golemui/gui-validators';
2
- type ValidatorFn = (api: any) => Partial<Validator>;
3
- /**
4
- * Validator shape accepted by a DX widget whose value type is fixed (e.g.
5
- * a `textInput`'s value is always a string). The user may either:
6
- * - omit the `type` discriminator and write only the rules for that fixed
7
- * kind (`{ minLength: 5 }`), which `buildTypedValidator` will tag with the
8
- * correct `type` at form-def construction time, or
9
- * - opt out and supply a fully-typed `CustomValidator`
10
- * (`{ type: 'custom', <validatorName>: <config> }`), which the engine
11
- * resolves against `customValidators` at validation time.
12
- *
13
- * The two branches are discriminated by the presence of `type: 'custom'`.
14
- */
15
- export type DxValidator<T extends Validator> = Omit<T, 'type'> | CustomValidator;
16
- /**
17
- * Build a fixed-type validator from a user-supplied partial validator and a
18
- * known JSON-schema type. The DX layer uses this for widgets whose value
19
- * shape is fixed (e.g. password is always string, currency always number,
20
- * calendar always string-with-format, repeater always array).
21
- *
22
- * Runtime-function validators are passed through unchanged — the function's
23
- * return value is responsible for setting `type` itself. The function is
24
- * evaluated by the engine on every form-data change.
25
- *
26
- * When `validator` is `undefined`, returns a no-op typed validator
27
- * (`{ type }` with no rules). Callers can still gate the call with a null
28
- * check when they only want to emit `validator` if the user supplied one.
29
- */
30
- export declare function buildTypedValidator(validator: Record<string, unknown> | ValidatorFn | undefined, type: Validator['type']): Validator | ValidatorFn;
31
- export {};
@@ -1,34 +0,0 @@
1
- import { FormEvent } from '@golemui/core';
2
- import { MergeResult } from './dx.domain';
3
- import { EventIdGenerator } from './itemTypeRegistry';
4
- export type EventRegistry = Map<string, (event: FormEvent) => void>;
5
- /**
6
- * Probe a DX event handler for a host-managed event name.
7
- *
8
- * Mirrors the action `onClick` pattern: a handler that simply returns a string
9
- * (`() => 'fieldChange'`) declares a host-managed dispatch by name. Only **zero-arg**
10
- * handlers are probed — a handler that declares the `event` parameter
11
- * (`(event) => event.update(...)`) is an imperative handler and is never invoked here,
12
- * so its method-bearing `DxFormEvent` is never touched with `undefined`.
13
- *
14
- * @returns the returned event name, or `null` when the handler is not a declarative
15
- * zero-arg string-returning handler (i.e. it should be registered and run on dispatch).
16
- */
17
- export declare function probeForHostEventName(handler: (...args: any[]) => any): string | null;
18
- /**
19
- * Generalisation of ActionOnClickService.
20
- *
21
- * Two entry points:
22
- * - `extractOnClickFromMergeResult` — action-specific: handles onClick wiring.
23
- * Called from the actions afterMerge hook.
24
- * - `wireInputLayoutEvents` — universal: handles onLoad, onChange, onFilter on any widget.
25
- * Called from ItemWalker.processItem for every item.
26
- */
27
- export declare class EventWiringService {
28
- extractOnClickFromMergeResult(mergeResult: MergeResult, eventRegistry: EventRegistry, eventIdGenerator: EventIdGenerator): MergeResult;
29
- private wireOnClick;
30
- wireInputLayoutEvents(mergeResult: MergeResult, eventRegistry: EventRegistry, eventIdGenerator: EventIdGenerator): MergeResult;
31
- private wireEventProperties;
32
- }
33
- declare const eventWiringService: EventWiringService;
34
- export default eventWiringService;
@@ -1,82 +0,0 @@
1
- import { FormWidget, NonFunctionWidget, UiState, FormEvent } from '@golemui/core';
2
- import { DxRuntimeParams } from './dxUtilityTypes';
3
- import { GslLeafSelector, FormConfig, MergeResult, ValidGuiShortcut, GslItemType } from './dx.domain';
4
- import { DxCommonFields } from './dxBase.types';
5
- export interface ParsedEntry<TDecorator extends DxCommonFields = DxCommonFields> {
6
- baseDef: TDecorator | ((params: DxRuntimeParams) => Partial<TDecorator>);
7
- path?: string;
8
- children?: ValidGuiShortcut[];
9
- }
10
- export type EventRegistry = Map<string, (event: FormEvent) => void>;
11
- export interface EventIdGenerator {
12
- next(): string;
13
- }
14
- export interface AfterMergeContext {
15
- eventRegistry: EventRegistry;
16
- formConfig: FormConfig;
17
- eventIdGenerator: EventIdGenerator;
18
- }
19
- export interface BuildWidgetContext {
20
- children?: ValidGuiShortcut[];
21
- mapStaticDef: (def: Record<string, any>, itemType: GslItemType) => NonFunctionWidget;
22
- walkChildren: (children: ValidGuiShortcut[]) => FormWidget[];
23
- }
24
- /**
25
- * Strategy interface for a widget type (inputs, actions, layouts, calendars, etc.).
26
- *
27
- * The DX pipeline (`ItemWalker.processItem`) is generic — it walks the widget tree,
28
- * resolves selectors, merges definitions, and maps to framework widgets. But each
29
- * widget type has its own entry shape, its own sensible defaults, and sometimes
30
- * custom post-merge or widget-building logic. The handler provides these type-specific
31
- * behaviors at well-defined extension points in the pipeline:
32
- *
33
- * 1. `parseEntry` — parse raw entry into a normalized `ParsedEntry`
34
- * 2. `rollUpSensibleDefaults` — aggregate config from matching leaf selectors
35
- * 3. `applySensibleDefaults` — apply aggregated config to a merged decorator
36
- * 4. `mapToWidget` — map a decorator to a core `FormWidget`
37
- * 5. `afterMerge` (optional) — post-merge hook (e.g. actions use this to wire onClick)
38
- * 6. `buildCustomWidget` (optional) — custom widget building for compound types (e.g. layouts
39
- * that need to recursively walk children)
40
- *
41
- * Shortcut authors do NOT implement this interface directly. Instead, they call
42
- * {@link defineShortcutType} with a simple config object, and it assembles the full
43
- * handler and registers it in the global registry.
44
- *
45
- * Entry shape taxonomy:
46
- *
47
- * 1. Keyed entries — { key, def } — path derived from key
48
- * Used by: inputs, future select/radiogroup
49
- *
50
- * 2. Bare entries — decorator | callback directly
51
- * Used by: actions, calendar, displays
52
- *
53
- * 3. Compound entries — { def, children } — container with nested shortcuts
54
- * Used by: layouts, future tabs/accordion
55
- *
56
- * Each handler declares TEntry to match its shape.
57
- * There is no shared base type — the shapes are intentionally different.
58
- * parseEntry(entry: TEntry) is the type-safe boundary.
59
- */
60
- export interface ItemTypeHandler<TEntry = any, TDecorator extends DxCommonFields = DxCommonFields, TConfig = Record<string, any>> {
61
- rollUpSensibleDefaults(leafSelectors: GslLeafSelector[]): TConfig;
62
- applySensibleDefaults(def: TDecorator, config: TConfig): TDecorator;
63
- mapToWidget<StateKeys extends UiState = never, FormData extends Record<string, any> = any>(def: TDecorator): NonFunctionWidget<StateKeys, FormData>;
64
- parseEntry(entry: TEntry): ParsedEntry<TDecorator>;
65
- afterMerge?(mergeResult: MergeResult, context: AfterMergeContext): MergeResult;
66
- /**
67
- * Optional override for widget types that need custom construction beyond the
68
- * generic mapToWidget path. Two flavors:
69
- *
70
- * - Compound types (layouts, accordion, tabs, repeater): use `context.walkChildren`
71
- * to recursively process child widgets and attach them to the result.
72
- * - Custom rendering (displays): wrap a render function into a specialized widget
73
- * shape that the generic mapper can't produce.
74
- *
75
- * If not provided, the pipeline falls back to `mapToWidget` for simple leaf types.
76
- */
77
- buildCustomWidget?(mergeResult: MergeResult, context: BuildWidgetContext): FormWidget;
78
- getChildren?(entry: TEntry): ValidGuiShortcut[] | undefined;
79
- }
80
- export declare function registerItemType(itemType: string, handler: ItemTypeHandler<any, any, any>): void;
81
- export declare function getItemTypeHandler(itemType: string): ItemTypeHandler<any, any, any>;
82
- export declare function hasItemTypeHandler(itemType: string): boolean;
@@ -1,31 +0,0 @@
1
- import { FormWidget, UiState } from '@golemui/core';
2
- import { FormConfig, GslSelector, ValidGuiShortcut } from './dx.domain';
3
- import { SelectorResolver } from './selectorResolver.service';
4
- import { WidgetMerger } from './widgetMerger.service';
5
- import { WidgetMapper } from './widgetMapper.service';
6
- import { EventRegistry } from './itemTypeRegistry';
7
- import { EventWiringService } from './eventWiring.service';
8
- import { StateExpansionService } from './stateExpansion.service';
9
- export interface WalkResult<StateKeys extends UiState = never, FormData extends Record<string, any> = any> {
10
- widgets: FormWidget<StateKeys, FormData>[];
11
- eventRegistry: EventRegistry;
12
- }
13
- export declare class ItemWalker {
14
- private readonly resolver;
15
- private readonly merger;
16
- private readonly mapper;
17
- private readonly eventWiring;
18
- private readonly stateExpansion;
19
- constructor(resolver: SelectorResolver, merger: WidgetMerger, mapper: WidgetMapper, eventWiring: EventWiringService, stateExpansion: StateExpansionService);
20
- walkAndMap<StateKeys extends UiState = never, FormData extends Record<string, any> = any>(guiShortcuts: ValidGuiShortcut[], gslSelectors: GslSelector[], formConfig: FormConfig): WalkResult<StateKeys, FormData>;
21
- private walkItems;
22
- private processItem;
23
- private buildCustomWidgetContext;
24
- private buildCustomWidget;
25
- /**
26
- * Resolves the base definition from a parsed entry, injecting the path for keyed entries.
27
- * For runtime (function) providers, wraps them to inject the path at evaluation time.
28
- */
29
- private buildBaseDef;
30
- private buildDecoratorForMatching;
31
- }
@@ -1,15 +0,0 @@
1
- import { FormConfig, GslSelector, GslSelectorsInput } from './dx.domain';
2
- export declare class SelectorNormalizer {
3
- /**
4
- * Ensures the output is always a uniform GslSelector[] of aggregated selectors.
5
- *
6
- * Callers can pass flat leaf selectors (single styling rules) or pre-grouped
7
- * aggregated selectors. This method separates them into two buckets, then wraps
8
- * any bare leaves into a catch-all aggregated selector so downstream code only
9
- * deals with one shape.
10
- */
11
- normalizeSelectors(input: GslSelectorsInput): GslSelector[];
12
- extractFormConfig(): FormConfig;
13
- }
14
- declare const selectorNormalizer: SelectorNormalizer;
15
- export default selectorNormalizer;
@@ -1,11 +0,0 @@
1
- import { GslSelector, ResolvedSelectors } from './dx.domain';
2
- import { DxCommonFields, DxInternalFields } from './dxBase.types';
3
- type DecoratorForMatching = DxInternalFields & DxCommonFields;
4
- export declare class SelectorResolver {
5
- resolve(decorator: DecoratorForMatching, allSelectors: GslSelector[]): ResolvedSelectors;
6
- private collectFromAggregated;
7
- private collectFromLeaf;
8
- private rollUpSensibleDefaults;
9
- }
10
- declare const selectorResolver: SelectorResolver;
11
- export default selectorResolver;
@@ -1,35 +0,0 @@
1
- import { Localizable } from '@golemui/core';
2
- /**
3
- * Config interface for types that support automatic labels.
4
- */
5
- export interface LabelSensibleDefaultsConfig {
6
- suppressAutomaticLabels?: boolean;
7
- }
8
- /**
9
- * Config interface for types that support automatic placeholders.
10
- */
11
- export interface PlaceholderSensibleDefaultsConfig {
12
- suppressAutomaticPlaceholders?: boolean;
13
- }
14
- export declare function pathToLabel(path: string | undefined): string;
15
- /**
16
- * Auto-generate a label from the field path if none is explicitly set.
17
- * Reusable across inputs, calendar, and future input-like types.
18
- *
19
- * Behavior must match existing `inputSensibleDefaults.service.ts` and
20
- * `calendarSensibleDefaults.service.ts` exactly.
21
- */
22
- export declare function processAutoLabel<D extends {
23
- path?: string;
24
- label?: Localizable | null;
25
- }>(def: D, config: LabelSensibleDefaultsConfig): D;
26
- /**
27
- * Auto-generate a placeholder from the field path if none is explicitly set.
28
- * Reusable across inputs, textarea, password, and future input-like types.
29
- *
30
- * Behavior must match existing `inputSensibleDefaults.service.ts` exactly.
31
- */
32
- export declare function processAutoPlaceholder<D extends {
33
- path?: string;
34
- placeholder?: string;
35
- }>(def: D, config: PlaceholderSensibleDefaultsConfig): D;
@@ -1,31 +0,0 @@
1
- import { NonFunctionWidget } from '@golemui/core';
2
- import { GslLeafSelector, MergeResult } from './dx.domain';
3
- import { EventIdGenerator, EventRegistry } from './itemTypeRegistry';
4
- export interface StateData {
5
- stateOverrides: Record<string, Record<string, any>>;
6
- }
7
- export declare class StateExpansionService {
8
- /**
9
- * Extracts `states` from a merge result, combining with state-targeted
10
- * GSL leaf selectors from `_gslStates`.
11
- *
12
- * Returns a cleaned merge result (no states) and accumulated state data.
13
- */
14
- extractFromMergeResult(mergeResult: MergeResult, stateLeafs: GslLeafSelector[]): {
15
- cleanedResult: MergeResult;
16
- stateData: StateData;
17
- };
18
- /**
19
- * Applies state overrides to a core widget. Each override produces:
20
- * - `visible: true/false` → `include: { in }` / `exclude: { from }`
21
- * - Core suffixable props → `'prop.stateName': value` at widget root
22
- * - Event handlers → `on: { 'eventType.stateName': eventId }` with registry wiring
23
- * - Custom props → `props: { 'prop.stateName': value }`
24
- */
25
- applyToWidget(widget: NonFunctionWidget, stateData: StateData, eventRegistry: EventRegistry, eventIdGenerator: EventIdGenerator): NonFunctionWidget;
26
- hasStateData(stateData: StateData): boolean;
27
- private applyVisibility;
28
- private applyStateEvent;
29
- }
30
- declare const stateExpansionService: StateExpansionService;
31
- export default stateExpansionService;
@@ -1,13 +0,0 @@
1
- import { FormWidget, NonFunctionWidget, UiState } from '@golemui/core';
2
- import { GslItemType, MergeResult } from './dx.domain';
3
- export declare class WidgetMapper {
4
- mapToWidget<StateKeys extends UiState = never, FormData extends Record<string, any> = any>(mergeResult: MergeResult, itemType: GslItemType): FormWidget<StateKeys, FormData>;
5
- mapStaticDef<StateKeys extends UiState = never, FormData extends Record<string, any> = any>(def: Record<string, any>, itemType: GslItemType): NonFunctionWidget<StateKeys, FormData>;
6
- /**
7
- * Injects BaseWidget-level fields that all widget types share.
8
- * Centralized here so individual mappers don't need to repeat the pattern.
9
- */
10
- private applyBaseWidgetFields;
11
- }
12
- declare const widgetMapper: WidgetMapper;
13
- export default widgetMapper;
@@ -1,14 +0,0 @@
1
- import { GslItemType, MergeResult, ResolvedSelectors, RuntimeFunction } from './dx.domain';
2
- import { ObjectUtils } from '../../utils/objectUtils.service';
3
- export declare class WidgetMerger {
4
- private readonly objectUtils;
5
- constructor(objectUtils: ObjectUtils);
6
- merge(baseDef: Record<string, any> | RuntimeFunction, itemType: GslItemType, resolved: ResolvedSelectors): MergeResult;
7
- private collectDecorators;
8
- private applySensibleDefaults;
9
- private createPromotedFunction;
10
- private wrapWithSensibleDefaults;
11
- private composeRuntimeFunctions;
12
- }
13
- declare const widgetMerger: WidgetMerger;
14
- export default widgetMerger;
@@ -1,8 +0,0 @@
1
- import { FunctionWidgetParams } from '@golemui/core';
2
- /**
3
- * Runtime functions can run during the build walk / decode probe before form
4
- * data exists; the FunctionWidgetParams contract guarantees `$form` is an
5
- * object, so normalize it to at least `{}` — a callback reading
6
- * `params.$form.field` must get `undefined`, not crash.
7
- */
8
- export declare function withForm(params?: FunctionWidgetParams<any>): FunctionWidgetParams<any>;
@@ -1,36 +0,0 @@
1
- import { UiState } from '@golemui/core';
2
- import { DxDefinitions, DxResult } from './formDef.domain';
3
- import { DxFormConfig, GslSelectorsInput } from './core/dx.domain';
4
- import { SelectorNormalizer } from './core/selectorNormalizer.service';
5
- import { ItemWalker } from './core/itemWalker.service';
6
- /**
7
- * Transforms a developer-friendly form definition into a fully-fledged form definition
8
- * usable by the framework ({@link Form}<STATE_KEYS, FORM_DATA>).
9
- *
10
- * Orchestrates: prepareForm → walkAndMap → buildResult.
11
- */
12
- export declare class DxService {
13
- private readonly selectorNormalizer;
14
- private readonly walker;
15
- constructor(selectorNormalizer: SelectorNormalizer, walker: ItemWalker);
16
- processDxFacade<STATE_KEYS extends UiState = never, FORM_DATA extends Record<string, any> = any>(dxDefinitionsRaw: DxDefinitions, gslSelectorsInput?: GslSelectorsInput, formConfigInput?: DxFormConfig<STATE_KEYS>): DxResult<STATE_KEYS, FORM_DATA>;
17
- /**
18
- * Normalizes raw form definitions and applies form-level defaults.
19
- *
20
- * Steps:
21
- * 1. Normalize definitions — ensure a flat array; convert bare functions to display widgets.
22
- * 2. Normalize selectors — convert mixed leaf/aggregated selectors into a uniform
23
- * aggregated shape, and extract form-level config (see {@link FormConfig}).
24
- * 3. Auto-stack — unless suppressed, wrap all definitions in a synthetic root
25
- * flex column layout so the form renders as a single vertical container.
26
- */
27
- private prepareForm;
28
- /**
29
- * Converts DX `$`-separated state names to core's `:`-separated names.
30
- * E.g. `{ register$adult: 'expr' }` → `{ 'register:adult': 'expr' }`.
31
- */
32
- private convertStateNames;
33
- private buildResult;
34
- }
35
- declare const formDefs: DxService;
36
- export { formDefs };
File without changes