@golemui/gui-shared 0.12.2 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
+ import { ActionWidget, DisplayWidget, Form, FormWidget, FunctionWidgetParams, InputWidget, LayoutWidget, ReactiveExpression } from '@golemui/core';
1
2
  import { Validator } from '@golemui/gui-validators';
2
- import * as Core from '@golemui/core';
3
- import * as Props from './widget.props';
4
- type ExtractStates<S> = S extends Record<string, Core.ReactiveExpression> ? keyof S : never;
3
+ import { AccordionProps, AlertProps, ButtonProps, CalendarProps, CheckboxProps, CurrencyProps, DatePickerProps, DateRange, DateinputProps, DropdownProps, FlexProps, GridProps, ListProps, MarkdownProps, MarkdownTextProps, NumberinputProps, OptionValue, PasswordProps, RadiogroupProps, RangeCalendarProps, RangeDateInputProps, RangeDatePickerProps, RepeaterProps, SelectProps, TabsProps, TextareaProps, TextinputProps, ToggleProps } from './widget.props';
4
+ type ExtractStates<S> = S extends Record<string, ReactiveExpression> ? keyof S : never;
5
5
  /**
6
6
  * Make the uid propery optional on all widgets
7
7
  */
@@ -13,11 +13,11 @@ type DeepPartialUid<T> = T extends (...args: infer A) => infer R ? (...args: A)
13
13
  type DeepPartialUidArray<T extends any[]> = {
14
14
  [P in keyof T]: DeepPartialUid<T[P]>;
15
15
  };
16
- declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidget extends Core.FormWidget<any, FormType> = never> {
17
- create<States extends Record<string, Core.ReactiveExpression>>(config: {
16
+ declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidget extends FormWidget<any, FormType> = never> {
17
+ create<States extends Record<string, ReactiveExpression>>(config: {
18
18
  states?: States;
19
19
  form: DeepPartialUid<GolemWidget<FormType, ExtractStates<States>, Validator, CustomWidget>>[];
20
- }): Core.Form<ExtractStates<States>, FormType>;
20
+ }): Form<ExtractStates<States>, FormType>;
21
21
  }
22
22
  /**
23
23
  * Creates a new GolemFormBuilder instance for building type-safe forms.
@@ -91,85 +91,85 @@ declare class GolemFormBuilder<FormType extends Record<string, any>, CustomWidge
91
91
  * });
92
92
  * ```
93
93
  */
94
- export declare function golemForm<FormType extends Record<string, any>, CustomWidget extends Core.FormWidget<any, FormType> = never>(): GolemFormBuilder<FormType, CustomWidget>;
95
- type GolemWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType> = never> = GuiAccordion<FormType, States, V, CustomWidget> | GuiAlert<FormType, States> | GuiButton<FormType, States> | GuiCalendar<FormType, States, V> | GuiCheckbox<FormType, States, V> | GuiCurrency<FormType, States, V> | GuiDateinput<FormType, States, V> | GuiDatePicker<FormType, States, V> | GuiDropdown<FormType, States, V> | GuiFunctionWidget<FormType, States, V, CustomWidget> | GuiList<FormType, States, V> | GuiMarkdown<FormType, States, V> | GuiMarkdownText<FormType, States> | GuiNumberinput<FormType, States, V> | GuiPassword<FormType, States, V> | GuiRadiogroup<FormType, States, V> | GuiRangeCalendar<FormType, States, V> | GuiRangeDateInput<FormType, States, V> | GuiRangeDatePicker<FormType, States, V> | GuiRepeater<FormType, States, V, CustomWidget> | GuiSelect<FormType, States, V> | GuiFlex<FormType, States, V, CustomWidget> | GuiGrid<FormType, States, V, CustomWidget> | GuiTabs<FormType, States, V, CustomWidget> | GuiTextarea<FormType, States, V> | GuiTextInput<FormType, States, V> | GuiToggle<FormType, States, V> | CustomWidget;
96
- type GuiAccordion<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType>> = Core.LayoutWidget<States, FormType, Props.AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
94
+ export declare function golemForm<FormType extends Record<string, any>, CustomWidget extends FormWidget<any, FormType> = never>(): GolemFormBuilder<FormType, CustomWidget>;
95
+ type GolemWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType> = never> = GuiAccordion<FormType, States, V, CustomWidget> | GuiAlert<FormType, States> | GuiButton<FormType, States> | GuiCalendar<FormType, States, V> | GuiCheckbox<FormType, States, V> | GuiCurrency<FormType, States, V> | GuiDateinput<FormType, States, V> | GuiDatePicker<FormType, States, V> | GuiDropdown<FormType, States, V> | GuiFunctionWidget<FormType, States, V, CustomWidget> | GuiList<FormType, States, V> | GuiMarkdown<FormType, States, V> | GuiMarkdownText<FormType, States> | GuiNumberinput<FormType, States, V> | GuiPassword<FormType, States, V> | GuiRadiogroup<FormType, States, V> | GuiRangeCalendar<FormType, States, V> | GuiRangeDateInput<FormType, States, V> | GuiRangeDatePicker<FormType, States, V> | GuiRepeater<FormType, States, V, CustomWidget> | GuiSelect<FormType, States, V> | GuiFlex<FormType, States, V, CustomWidget> | GuiGrid<FormType, States, V, CustomWidget> | GuiTabs<FormType, States, V, CustomWidget> | GuiTextarea<FormType, States, V> | GuiTextInput<FormType, States, V> | GuiToggle<FormType, States, V> | CustomWidget;
96
+ type GuiAccordion<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
97
97
  type: 'accordion';
98
98
  };
99
- type GuiAlert<FormType extends Record<string, any>, States extends string> = Core.DisplayWidget<States, FormType, Props.AlertProps> & {
99
+ type GuiAlert<FormType extends Record<string, any>, States extends string> = DisplayWidget<States, FormType, AlertProps> & {
100
100
  type: 'alert';
101
101
  };
102
- type GuiButton<FormType extends Record<string, any>, States extends string> = Core.ActionWidget<States, FormType, Props.ButtonProps> & {
102
+ type GuiButton<FormType extends Record<string, any>, States extends string> = ActionWidget<States, FormType, ButtonProps> & {
103
103
  type: 'button';
104
104
  };
105
- type GuiCalendar<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.CalendarProps, V> & {
105
+ type GuiCalendar<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, CalendarProps, V> & {
106
106
  type: 'calendar';
107
107
  };
108
- type GuiCheckbox<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<boolean, States, FormType, Props.CheckboxProps, V> & {
108
+ type GuiCheckbox<FormType extends Record<string, any>, States extends string, V> = InputWidget<boolean, States, FormType, CheckboxProps, V> & {
109
109
  type: 'checkbox';
110
110
  };
111
- type GuiCurrency<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<number, States, FormType, Props.CurrencyProps, V> & {
111
+ type GuiCurrency<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, CurrencyProps, V> & {
112
112
  type: 'currency';
113
113
  };
114
- type GuiDateinput<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.DateinputProps, V> & {
114
+ type GuiDateinput<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, DateinputProps, V> & {
115
115
  type: 'dateInput';
116
116
  };
117
- type GuiDatePicker<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.DatePickerProps, V> & {
117
+ type GuiDatePicker<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, DatePickerProps, V> & {
118
118
  type: 'datePicker';
119
119
  };
120
- type GuiDropdown<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<Props.OptionValue, States, FormType, Props.DropdownProps<unknown>, V> & {
120
+ type GuiDropdown<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, DropdownProps<unknown>, V> & {
121
121
  type: 'dropdown';
122
122
  };
123
- type GuiFunctionWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType>> = (api?: Core.FunctionWidgetParams<FormType>) => Exclude<GolemWidget<FormType, States, V, CustomWidget>, () => any>;
124
- type GuiList<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<Props.OptionValue, States, FormType, Props.ListProps<unknown>, V> & {
123
+ type GuiFunctionWidget<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = (api?: FunctionWidgetParams<FormType>) => Exclude<GolemWidget<FormType, States, V, CustomWidget>, () => any>;
124
+ type GuiList<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, ListProps<unknown>, V> & {
125
125
  type: 'list';
126
126
  };
127
- type GuiMarkdown<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<number, States, FormType, Props.MarkdownProps, V> & {
127
+ type GuiMarkdown<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, MarkdownProps, V> & {
128
128
  type: 'markdown';
129
129
  };
130
- type GuiMarkdownText<FormType extends Record<string, any>, States extends string> = Core.DisplayWidget<States, FormType, Props.MarkdownTextProps> & {
130
+ type GuiMarkdownText<FormType extends Record<string, any>, States extends string> = DisplayWidget<States, FormType, MarkdownTextProps> & {
131
131
  type: 'markdownText';
132
132
  };
133
- type GuiNumberinput<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<number, States, FormType, Props.NumberinputProps, V> & {
133
+ type GuiNumberinput<FormType extends Record<string, any>, States extends string, V> = InputWidget<number, States, FormType, NumberinputProps, V> & {
134
134
  type: 'number';
135
135
  };
136
- type GuiRadiogroup<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<Props.OptionValue, States, FormType, Props.RadiogroupProps, V> & {
136
+ type GuiRadiogroup<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, RadiogroupProps, V> & {
137
137
  type: 'radiogroup';
138
138
  };
139
- type GuiRangeCalendar<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.RangeCalendarProps, V> & {
139
+ type GuiRangeCalendar<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, RangeCalendarProps, V> & {
140
140
  type: 'rangeCalendar';
141
141
  };
142
- type GuiRangeDateInput<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<Props.DateRange[], States, FormType, Props.RangeDateInputProps, V> & {
142
+ type GuiRangeDateInput<FormType extends Record<string, any>, States extends string, V> = InputWidget<DateRange[], States, FormType, RangeDateInputProps, V> & {
143
143
  type: 'rangeDateInput';
144
144
  };
145
- type GuiRangeDatePicker<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<Props.DateRange[], States, FormType, Props.RangeDatePickerProps, V> & {
145
+ type GuiRangeDatePicker<FormType extends Record<string, any>, States extends string, V> = InputWidget<DateRange[], States, FormType, RangeDatePickerProps, V> & {
146
146
  type: 'rangeDatePicker';
147
147
  };
148
- type GuiRepeater<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType>> = Core.InputWidget<Record<string, unknown>[], States, FormType, Props.RepeaterProps<Core.LayoutWidget<States, FormType, Props.AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]>>, V> & {
148
+ type GuiRepeater<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = InputWidget<Record<string, unknown>[], States, FormType, RepeaterProps<LayoutWidget<States, FormType, AccordionProps, GolemWidget<FormType, States, V, CustomWidget>[]>>, V> & {
149
149
  type: 'repeater';
150
150
  };
151
- type GuiSelect<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<Props.OptionValue, States, FormType, Props.SelectProps, V> & {
151
+ type GuiSelect<FormType extends Record<string, any>, States extends string, V> = InputWidget<OptionValue, States, FormType, SelectProps, V> & {
152
152
  type: 'select';
153
153
  };
154
- type GuiFlex<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType>> = Core.LayoutWidget<States, FormType, Props.FlexProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
154
+ type GuiFlex<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, FlexProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
155
155
  type: 'flex';
156
156
  };
157
- type GuiGrid<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType>> = Core.LayoutWidget<States, FormType, Props.GridProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
157
+ type GuiGrid<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, GridProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
158
158
  type: 'grid';
159
159
  };
160
- type GuiTabs<FormType extends Record<string, any>, States extends string, V, CustomWidget extends Core.FormWidget<any, FormType>> = Core.LayoutWidget<States, FormType, Props.TabsProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
160
+ type GuiTabs<FormType extends Record<string, any>, States extends string, V, CustomWidget extends FormWidget<any, FormType>> = LayoutWidget<States, FormType, TabsProps, GolemWidget<FormType, States, V, CustomWidget>[]> & {
161
161
  type: 'tabs';
162
162
  };
163
- type GuiTextarea<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.TextareaProps, V> & {
163
+ type GuiTextarea<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, TextareaProps, V> & {
164
164
  type: 'textarea';
165
165
  };
166
- type GuiTextInput<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.TextinputProps, V> & {
166
+ type GuiTextInput<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, TextinputProps, V> & {
167
167
  type: 'textinput';
168
168
  };
169
- type GuiPassword<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<string, States, FormType, Props.PasswordProps, V> & {
169
+ type GuiPassword<FormType extends Record<string, any>, States extends string, V> = InputWidget<string, States, FormType, PasswordProps, V> & {
170
170
  type: 'password';
171
171
  };
172
- type GuiToggle<FormType extends Record<string, any>, States extends string, V> = Core.InputWidget<boolean, States, FormType, Props.ToggleProps, V> & {
172
+ type GuiToggle<FormType extends Record<string, any>, States extends string, V> = InputWidget<boolean, States, FormType, ToggleProps, V> & {
173
173
  type: 'toggle';
174
174
  };
175
175
  export {};
@@ -1,4 +1,6 @@
1
1
  /**
2
+ * @internal Used by framework Repeater components, not part of the end-user public API.
3
+ *
2
4
  * Returns a stable unique key for a repeater data item.
3
5
  * Assigns a non-enumerable `__rid` property on first access so the ID
4
6
  * survives array operations (splice, filter, spread) without polluting
@@ -1,41 +1,41 @@
1
- import * as Core from '@golemui/core';
2
- import * as Props from './widget.props';
3
- type InputWidgetConfig<T> = Omit<Core.InputWidget<T>, 'kind' | 'type' | 'uid' | 'props' | 'validator'>;
4
- type LayoutWidgetConfig = Omit<Core.LayoutWidget, 'kind' | 'type' | 'uid' | 'props'>;
5
- type DisplayWidgetConfig = Omit<Core.BaseWidget, 'kind' | 'type' | 'uid' | 'props'>;
1
+ import { BaseWidget, DisplayWidget, InputWidget, LayoutWidget, UiState } from '@golemui/core';
2
+ import { AlertProps, CheckboxProps, FlexProps, GridProps, MarkdownTextProps, NumberinputProps, PasswordProps, SelectProps, TabsProps, TextinputProps } from './widget.props';
3
+ type InputWidgetConfig<T> = Omit<InputWidget<T>, 'kind' | 'type' | 'uid' | 'props' | 'validator'>;
4
+ type LayoutWidgetConfig = Omit<LayoutWidget, 'kind' | 'type' | 'uid' | 'props'>;
5
+ type DisplayWidgetConfig = Omit<BaseWidget, 'kind' | 'type' | 'uid' | 'props'>;
6
6
  /**
7
7
  * Golem widget factory
8
8
  */
9
9
  export declare const GolemWidgets: {
10
- textinput: <StateKeys extends Core.UiState = string, V = any>({ config, props, validator, }: {
10
+ textinput: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
11
11
  config: InputWidgetConfig<string>;
12
- props?: Props.TextinputProps;
12
+ props?: TextinputProps;
13
13
  validator?: V;
14
- }) => Core.InputWidget<string, StateKeys>;
15
- password: <StateKeys extends Core.UiState = string, V = any>({ config, props, validator, }: {
14
+ }) => InputWidget<string, StateKeys>;
15
+ password: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
16
16
  config: InputWidgetConfig<string>;
17
- props?: Props.PasswordProps;
17
+ props?: PasswordProps;
18
18
  validator?: V;
19
- }) => Core.InputWidget<string, StateKeys>;
20
- numberinput: <StateKeys extends Core.UiState = string, V = any>({ config, props, validator, }: {
19
+ }) => InputWidget<string, StateKeys>;
20
+ numberinput: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
21
21
  config: InputWidgetConfig<number>;
22
- props?: Props.NumberinputProps;
22
+ props?: NumberinputProps;
23
23
  validator?: V;
24
- }) => Core.InputWidget<number, StateKeys>;
25
- checkbox: <StateKeys extends Core.UiState = string, V = any>({ config, props, validator, }: {
24
+ }) => InputWidget<number, StateKeys>;
25
+ checkbox: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
26
26
  config: InputWidgetConfig<boolean>;
27
- props?: Props.CheckboxProps;
27
+ props?: CheckboxProps;
28
28
  validator?: V;
29
- }) => Core.InputWidget<boolean, StateKeys>;
30
- select: <StateKeys extends Core.UiState = string, V = any>({ config, props, validator, }: {
29
+ }) => InputWidget<boolean, StateKeys>;
30
+ select: <StateKeys extends UiState = string, V = any>({ config, props, validator, }: {
31
31
  config: InputWidgetConfig<string>;
32
- props?: Props.SelectProps;
32
+ props?: SelectProps;
33
33
  validator?: V;
34
- }) => Core.InputWidget<string, StateKeys>;
35
- flex: <StateKeys extends Core.UiState = string>(config: LayoutWidgetConfig, props?: Props.FlexProps) => Core.LayoutWidget<StateKeys>;
36
- grid: <StateKeys extends Core.UiState = string>(config: LayoutWidgetConfig, props?: Props.GridProps) => Core.LayoutWidget<StateKeys>;
37
- tabs: <StateKeys extends Core.UiState = string>(config: LayoutWidgetConfig, props?: Props.TabsProps) => Core.LayoutWidget<StateKeys>;
38
- alert: <StateKeys extends Core.UiState = string>(config: DisplayWidgetConfig, props?: Props.AlertProps) => Core.DisplayWidget<StateKeys>;
39
- markdownText: <StateKeys extends Core.UiState = string>(config: DisplayWidgetConfig, props?: Props.MarkdownTextProps) => Core.DisplayWidget<StateKeys>;
34
+ }) => InputWidget<string, StateKeys>;
35
+ flex: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: FlexProps) => LayoutWidget<StateKeys>;
36
+ grid: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: GridProps) => LayoutWidget<StateKeys>;
37
+ tabs: <StateKeys extends UiState = string>(config: LayoutWidgetConfig, props?: TabsProps) => LayoutWidget<StateKeys>;
38
+ alert: <StateKeys extends UiState = string>(config: DisplayWidgetConfig, props?: AlertProps) => DisplayWidget<StateKeys>;
39
+ markdownText: <StateKeys extends UiState = string>(config: DisplayWidgetConfig, props?: MarkdownTextProps) => DisplayWidget<StateKeys>;
40
40
  };
41
41
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemui/gui-shared",
3
- "version": "0.12.2",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "main": "./index.umd.cjs",
6
6
  "module": "./index.js",
@@ -10,6 +10,11 @@
10
10
  "types": "./index.d.ts",
11
11
  "import": "./index.js",
12
12
  "require": "./index.umd.cjs"
13
+ },
14
+ "./internals": {
15
+ "types": "./internals.d.ts",
16
+ "import": "./internals.js",
17
+ "require": "./internals.umd.cjs"
13
18
  }
14
19
  },
15
20
  "files": [
@@ -17,11 +22,14 @@
17
22
  "index.d.ts",
18
23
  "index.js",
19
24
  "index.umd.cjs",
25
+ "internals.d.ts",
26
+ "internals.js",
27
+ "internals.umd.cjs",
20
28
  "*.md"
21
29
  ],
22
30
  "dependencies": {
23
- "@golemui/core": "0.12.2",
24
- "@golemui/gui-validators": "0.12.2"
31
+ "@golemui/core": "0.13.1",
32
+ "@golemui/gui-validators": "0.13.1"
25
33
  },
26
34
  "repository": {
27
35
  "type": "git",