@jsonui/core 0.3.0 → 0.4.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.
@@ -4,10 +4,10 @@ import * as constants from './utils/constants';
4
4
  import * as util from './utils/util';
5
5
  import I18n from './utils/I18n';
6
6
  import { StockContext, PathModifierContext } from './utils/contextHandler';
7
- import { genAllStateProps } from './store/root/selectors';
7
+ import { compSelectorHook } from './store/root/selectors';
8
8
  import stockFunctions from './stock/functions';
9
9
  import persistConfig from './store/persistConfig';
10
10
  import storeReducers from './store/reducers';
11
11
  import appRootFunctions from './stock/appRootFunctions';
12
12
  export * from './utils/types';
13
- export { Stock, I18n, wrapperUtil, util, constants, StockContext, PathModifierContext, appRootFunctions, genAllStateProps, stockFunctions, persistConfig, storeReducers, };
13
+ export { Stock, I18n, wrapperUtil, util, constants, StockContext, PathModifierContext, appRootFunctions, compSelectorHook, stockFunctions, persistConfig, storeReducers, };
@@ -14,10 +14,10 @@ declare type CallFunctionType = (name: string, attr?: any, props?: any, callerAr
14
14
  declare type GetComponentType = (componentName: string) => ReactNode;
15
15
  export default class Stock {
16
16
  stock: NewStockType;
17
- Wrapper: ReactNode;
17
+ Wrapper: React.ElementType;
18
18
  reduxStore: any;
19
19
  validations: any;
20
- constructor(newStock: NewStockType, Wrapper: ReactNode, reduxStore: any);
20
+ constructor(newStock: NewStockType, Wrapper: React.ElementType, reduxStore: any);
21
21
  init: InitType;
22
22
  registerComponent: RegisterComponentType;
23
23
  registerFunction: RegisterFunctionType;
@@ -1,11 +1,7 @@
1
- import { PathModifiersType, PropsType } from '../../utils/types';
1
+ import { PathModifiersType, PropsType, ReduxPathType } from '../../utils/types';
2
2
  import { RootStateType } from './reducer';
3
3
  export declare const getState: (state: any) => RootStateType;
4
4
  export declare const getValue: (state: any, store: string, path: string) => any;
5
- export interface ReduxPathType {
6
- store: string;
7
- path: string;
8
- isError?: boolean;
9
- }
10
5
  export declare const getStateValue: (globalState: any, { store, path, isError }: ReduxPathType, currentPaths: PathModifiersType) => any;
11
6
  export declare const genAllStateProps: (globalState: any, props: PropsType) => PropsType;
7
+ export declare const compSelectorHook: (currentPaths: PathModifiersType, subscriberPaths: ReduxPathType[]) => (state: any) => any[] | undefined;
@@ -10,6 +10,8 @@ export declare const REF_LOCALES = "$locales";
10
10
  export declare const REF_VALIDATES = "$validations";
11
11
  export declare const STYLE_WEB_NAME = "styleWeb";
12
12
  export declare const STYLE_RN_NAME = "styleRN";
13
+ export declare const REDUX_GET_FUNCTION = "get";
14
+ export declare const REDUX_SET_FUNCTION = "set";
13
15
  export declare const REDUX_FUNCTIONS: string[];
14
16
  export declare const PATHNAME = "path";
15
17
  export declare const SIMPLE_DATA_TYPES: string[];
@@ -21,3 +23,9 @@ export declare const LIST_PAGE = "$page";
21
23
  export declare const LIST_ITEM_PER_PAGE = "$itemPerPage";
22
24
  export declare const LIST_LENGTH = "$listLength";
23
25
  export declare const LIST_ITEM_PER_PAGE_DEFAULT = 10;
26
+ export declare const REDUX_PATHS = "$$reduxPaths";
27
+ export declare const V_CHILDREN_PREFIX = "$child";
28
+ export declare const PARENT_PROP_NAME = "__parentprop";
29
+ export declare const CURRENT_PATH_NAME = "__currentPaths";
30
+ export declare const PRIMITIVE_COMP_NAME = "_PrimitiveProp";
31
+ export declare const FRAGMENT_COMP_NAME = "Fragment";
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import Stock from 'stock/Stock';
3
- export declare const StockContext: import("react").Context<typeof Stock | null>;
3
+ export declare const StockContext: import("react").Context<Stock | null>;
4
4
  export declare const PathModifierContext: import("react").Context<{}>;
@@ -25,3 +25,8 @@ export interface ValidationType {
25
25
  path: string;
26
26
  schema: any;
27
27
  }
28
+ export interface ReduxPathType {
29
+ store?: string;
30
+ path?: string;
31
+ isError?: boolean;
32
+ }
@@ -1,15 +1,31 @@
1
1
  /// <reference types="react" />
2
+ import * as c from '../utils/constants';
2
3
  import Stock from '../stock/Stock';
3
- import { PathModifiersType, PropsType, WrapperType } from '../utils/types';
4
+ import { PathModifiersType, PropsType, ReduxPathType, WrapperType } from '../utils/types';
5
+ interface OwnTraverse {
6
+ key: string;
7
+ value: PropsType;
8
+ path: string[];
9
+ parent: PropsType;
10
+ level: number;
11
+ }
12
+ export declare const getFilteredPath: ({ [c.PARENT_PROP_NAME]: parentComp, ...propsNew }: PropsType, func: (filterProps: OwnTraverse) => boolean) => OwnTraverse[];
4
13
  export declare const actionBuilder: (props: PropsType, stock: InstanceType<typeof Stock>) => void;
5
- export declare const modifierBuilder: (props: PropsType, stock: InstanceType<typeof Stock>) => void;
6
- export declare const pathModifierBuilder: (props: PropsType, pathModifier: PathModifiersType) => {
7
- currentPaths: PathModifiersType;
8
- } | undefined;
9
- export declare const getWrapperProps: (props: PropsType, parentComp?: any) => any;
14
+ export declare const calculatePropsFromModifier: (props: PropsType, stock: InstanceType<typeof Stock>) => ReduxPathType[];
15
+ export declare const getCurrentPaths: (props: PropsType, pathModifier: PathModifiersType) => PathModifiersType;
16
+ export declare const normalisePrimitives: (props: PropsType, parentComp?: any) => any;
10
17
  export declare const getRootWrapperProps: (props: PropsType, stock: InstanceType<typeof Stock>) => {
11
18
  [x: string]: import("../utils/types").PropValue;
12
19
  $pathModifiers?: PathModifiersType | undefined;
13
20
  };
21
+ export declare const isChildrenProps: (propName?: string | undefined) => boolean;
22
+ export declare const getParentProps: (props: PropsType) => PropsType;
23
+ export declare const getPropsChildrenFilter: ({ props, filter }: {
24
+ props: PropsType;
25
+ filter: 'onlyChildren' | 'withoutChildren';
26
+ }) => PropsType;
14
27
  export declare const getChildrensForRoot: (props: PropsType, children: any, Wrapper: WrapperType) => JSX.Element | JSX.Element[] | undefined;
15
28
  export declare const generateChildren: (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) => import("../utils/types").PropValue | JSX.Element;
29
+ export declare const generateNewChildren: (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) => JSX.Element | JSX.Element[] | undefined;
30
+ export declare const removeTechnicalProps: (changeableProps: any) => any;
31
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -28,10 +28,10 @@ declare type CallFunctionType = (name: string, attr?: any, props?: any, callerAr
28
28
  declare type GetComponentType = (componentName: string) => ReactNode;
29
29
  declare class Stock {
30
30
  stock: NewStockType;
31
- Wrapper: ReactNode;
31
+ Wrapper: React.ElementType;
32
32
  reduxStore: any;
33
33
  validations: any;
34
- constructor(newStock: NewStockType, Wrapper: ReactNode, reduxStore: any);
34
+ constructor(newStock: NewStockType, Wrapper: React.ElementType, reduxStore: any);
35
35
  init: InitType;
36
36
  registerComponent: RegisterComponentType;
37
37
  registerFunction: RegisterFunctionType;
@@ -64,37 +64,10 @@ interface ValidationType {
64
64
  path: string;
65
65
  schema: any;
66
66
  }
67
-
68
- declare const actionBuilder: (props: PropsType, stock: InstanceType<typeof Stock>) => void;
69
- declare const modifierBuilder: (props: PropsType, stock: InstanceType<typeof Stock>) => void;
70
- declare const pathModifierBuilder: (props: PropsType, pathModifier: PathModifiersType) => {
71
- currentPaths: PathModifiersType;
72
- } | undefined;
73
- declare const getWrapperProps: (props: PropsType, parentComp?: any) => any;
74
- declare const getRootWrapperProps: (props: PropsType, stock: InstanceType<typeof Stock>) => {
75
- [x: string]: PropValue;
76
- $pathModifiers?: PathModifiersType | undefined;
77
- };
78
- declare const getChildrensForRoot: (props: PropsType, children: any, Wrapper: WrapperType) => JSX.Element | JSX.Element[] | undefined;
79
- declare const generateChildren: (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) => PropValue | JSX.Element;
80
-
81
- declare const wrapperUtil_d_actionBuilder: typeof actionBuilder;
82
- declare const wrapperUtil_d_modifierBuilder: typeof modifierBuilder;
83
- declare const wrapperUtil_d_pathModifierBuilder: typeof pathModifierBuilder;
84
- declare const wrapperUtil_d_getWrapperProps: typeof getWrapperProps;
85
- declare const wrapperUtil_d_getRootWrapperProps: typeof getRootWrapperProps;
86
- declare const wrapperUtil_d_getChildrensForRoot: typeof getChildrensForRoot;
87
- declare const wrapperUtil_d_generateChildren: typeof generateChildren;
88
- declare namespace wrapperUtil_d {
89
- export {
90
- wrapperUtil_d_actionBuilder as actionBuilder,
91
- wrapperUtil_d_modifierBuilder as modifierBuilder,
92
- wrapperUtil_d_pathModifierBuilder as pathModifierBuilder,
93
- wrapperUtil_d_getWrapperProps as getWrapperProps,
94
- wrapperUtil_d_getRootWrapperProps as getRootWrapperProps,
95
- wrapperUtil_d_getChildrensForRoot as getChildrensForRoot,
96
- wrapperUtil_d_generateChildren as generateChildren,
97
- };
67
+ interface ReduxPathType {
68
+ store?: string;
69
+ path?: string;
70
+ isError?: boolean;
98
71
  }
99
72
 
100
73
  declare const SEPARATOR = "/";
@@ -109,6 +82,8 @@ declare const REF_LOCALES = "$locales";
109
82
  declare const REF_VALIDATES = "$validations";
110
83
  declare const STYLE_WEB_NAME = "styleWeb";
111
84
  declare const STYLE_RN_NAME = "styleRN";
85
+ declare const REDUX_GET_FUNCTION = "get";
86
+ declare const REDUX_SET_FUNCTION = "set";
112
87
  declare const REDUX_FUNCTIONS: string[];
113
88
  declare const PATHNAME = "path";
114
89
  declare const SIMPLE_DATA_TYPES: string[];
@@ -120,6 +95,12 @@ declare const LIST_PAGE = "$page";
120
95
  declare const LIST_ITEM_PER_PAGE = "$itemPerPage";
121
96
  declare const LIST_LENGTH = "$listLength";
122
97
  declare const LIST_ITEM_PER_PAGE_DEFAULT = 10;
98
+ declare const REDUX_PATHS = "$$reduxPaths";
99
+ declare const V_CHILDREN_PREFIX = "$child";
100
+ declare const PARENT_PROP_NAME = "__parentprop";
101
+ declare const CURRENT_PATH_NAME = "__currentPaths";
102
+ declare const PRIMITIVE_COMP_NAME = "_PrimitiveProp";
103
+ declare const FRAGMENT_COMP_NAME = "Fragment";
123
104
 
124
105
  declare const constants_d_SEPARATOR: typeof SEPARATOR;
125
106
  declare const constants_d_STORE_ERROR_POSTFIX: typeof STORE_ERROR_POSTFIX;
@@ -133,6 +114,8 @@ declare const constants_d_REF_LOCALES: typeof REF_LOCALES;
133
114
  declare const constants_d_REF_VALIDATES: typeof REF_VALIDATES;
134
115
  declare const constants_d_STYLE_WEB_NAME: typeof STYLE_WEB_NAME;
135
116
  declare const constants_d_STYLE_RN_NAME: typeof STYLE_RN_NAME;
117
+ declare const constants_d_REDUX_GET_FUNCTION: typeof REDUX_GET_FUNCTION;
118
+ declare const constants_d_REDUX_SET_FUNCTION: typeof REDUX_SET_FUNCTION;
136
119
  declare const constants_d_REDUX_FUNCTIONS: typeof REDUX_FUNCTIONS;
137
120
  declare const constants_d_PATHNAME: typeof PATHNAME;
138
121
  declare const constants_d_SIMPLE_DATA_TYPES: typeof SIMPLE_DATA_TYPES;
@@ -144,6 +127,12 @@ declare const constants_d_LIST_PAGE: typeof LIST_PAGE;
144
127
  declare const constants_d_LIST_ITEM_PER_PAGE: typeof LIST_ITEM_PER_PAGE;
145
128
  declare const constants_d_LIST_LENGTH: typeof LIST_LENGTH;
146
129
  declare const constants_d_LIST_ITEM_PER_PAGE_DEFAULT: typeof LIST_ITEM_PER_PAGE_DEFAULT;
130
+ declare const constants_d_REDUX_PATHS: typeof REDUX_PATHS;
131
+ declare const constants_d_V_CHILDREN_PREFIX: typeof V_CHILDREN_PREFIX;
132
+ declare const constants_d_PARENT_PROP_NAME: typeof PARENT_PROP_NAME;
133
+ declare const constants_d_CURRENT_PATH_NAME: typeof CURRENT_PATH_NAME;
134
+ declare const constants_d_PRIMITIVE_COMP_NAME: typeof PRIMITIVE_COMP_NAME;
135
+ declare const constants_d_FRAGMENT_COMP_NAME: typeof FRAGMENT_COMP_NAME;
147
136
  declare namespace constants_d {
148
137
  export {
149
138
  constants_d_SEPARATOR as SEPARATOR,
@@ -158,6 +147,8 @@ declare namespace constants_d {
158
147
  constants_d_REF_VALIDATES as REF_VALIDATES,
159
148
  constants_d_STYLE_WEB_NAME as STYLE_WEB_NAME,
160
149
  constants_d_STYLE_RN_NAME as STYLE_RN_NAME,
150
+ constants_d_REDUX_GET_FUNCTION as REDUX_GET_FUNCTION,
151
+ constants_d_REDUX_SET_FUNCTION as REDUX_SET_FUNCTION,
161
152
  constants_d_REDUX_FUNCTIONS as REDUX_FUNCTIONS,
162
153
  constants_d_PATHNAME as PATHNAME,
163
154
  constants_d_SIMPLE_DATA_TYPES as SIMPLE_DATA_TYPES,
@@ -169,6 +160,70 @@ declare namespace constants_d {
169
160
  constants_d_LIST_ITEM_PER_PAGE as LIST_ITEM_PER_PAGE,
170
161
  constants_d_LIST_LENGTH as LIST_LENGTH,
171
162
  constants_d_LIST_ITEM_PER_PAGE_DEFAULT as LIST_ITEM_PER_PAGE_DEFAULT,
163
+ constants_d_REDUX_PATHS as REDUX_PATHS,
164
+ constants_d_V_CHILDREN_PREFIX as V_CHILDREN_PREFIX,
165
+ constants_d_PARENT_PROP_NAME as PARENT_PROP_NAME,
166
+ constants_d_CURRENT_PATH_NAME as CURRENT_PATH_NAME,
167
+ constants_d_PRIMITIVE_COMP_NAME as PRIMITIVE_COMP_NAME,
168
+ constants_d_FRAGMENT_COMP_NAME as FRAGMENT_COMP_NAME,
169
+ };
170
+ }
171
+
172
+ interface OwnTraverse {
173
+ key: string;
174
+ value: PropsType;
175
+ path: string[];
176
+ parent: PropsType;
177
+ level: number;
178
+ }
179
+ declare const getFilteredPath: ({ [c.PARENT_PROP_NAME]: parentComp, ...propsNew }: PropsType, func: (filterProps: OwnTraverse) => boolean) => OwnTraverse[];
180
+ declare const actionBuilder: (props: PropsType, stock: InstanceType<typeof Stock>) => void;
181
+ declare const calculatePropsFromModifier: (props: PropsType, stock: InstanceType<typeof Stock>) => ReduxPathType[];
182
+ declare const getCurrentPaths: (props: PropsType, pathModifier: PathModifiersType) => PathModifiersType;
183
+ declare const normalisePrimitives: (props: PropsType, parentComp?: any) => any;
184
+ declare const getRootWrapperProps: (props: PropsType, stock: InstanceType<typeof Stock>) => {
185
+ [x: string]: PropValue;
186
+ $pathModifiers?: PathModifiersType | undefined;
187
+ };
188
+ declare const isChildrenProps: (propName?: string | undefined) => boolean;
189
+ declare const getParentProps: (props: PropsType) => PropsType;
190
+ declare const getPropsChildrenFilter: ({ props, filter }: {
191
+ props: PropsType;
192
+ filter: 'onlyChildren' | 'withoutChildren';
193
+ }) => PropsType;
194
+ declare const getChildrensForRoot: (props: PropsType, children: any, Wrapper: WrapperType) => JSX.Element | JSX.Element[] | undefined;
195
+ declare const generateChildren: (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) => PropValue | JSX.Element;
196
+ declare const generateNewChildren: (props: PropsType, { Wrapper }: InstanceType<typeof Stock>) => JSX.Element | JSX.Element[] | undefined;
197
+ declare const removeTechnicalProps: (changeableProps: any) => any;
198
+
199
+ declare const wrapperUtil_d_getFilteredPath: typeof getFilteredPath;
200
+ declare const wrapperUtil_d_actionBuilder: typeof actionBuilder;
201
+ declare const wrapperUtil_d_calculatePropsFromModifier: typeof calculatePropsFromModifier;
202
+ declare const wrapperUtil_d_getCurrentPaths: typeof getCurrentPaths;
203
+ declare const wrapperUtil_d_normalisePrimitives: typeof normalisePrimitives;
204
+ declare const wrapperUtil_d_getRootWrapperProps: typeof getRootWrapperProps;
205
+ declare const wrapperUtil_d_isChildrenProps: typeof isChildrenProps;
206
+ declare const wrapperUtil_d_getParentProps: typeof getParentProps;
207
+ declare const wrapperUtil_d_getPropsChildrenFilter: typeof getPropsChildrenFilter;
208
+ declare const wrapperUtil_d_getChildrensForRoot: typeof getChildrensForRoot;
209
+ declare const wrapperUtil_d_generateChildren: typeof generateChildren;
210
+ declare const wrapperUtil_d_generateNewChildren: typeof generateNewChildren;
211
+ declare const wrapperUtil_d_removeTechnicalProps: typeof removeTechnicalProps;
212
+ declare namespace wrapperUtil_d {
213
+ export {
214
+ wrapperUtil_d_getFilteredPath as getFilteredPath,
215
+ wrapperUtil_d_actionBuilder as actionBuilder,
216
+ wrapperUtil_d_calculatePropsFromModifier as calculatePropsFromModifier,
217
+ wrapperUtil_d_getCurrentPaths as getCurrentPaths,
218
+ wrapperUtil_d_normalisePrimitives as normalisePrimitives,
219
+ wrapperUtil_d_getRootWrapperProps as getRootWrapperProps,
220
+ wrapperUtil_d_isChildrenProps as isChildrenProps,
221
+ wrapperUtil_d_getParentProps as getParentProps,
222
+ wrapperUtil_d_getPropsChildrenFilter as getPropsChildrenFilter,
223
+ wrapperUtil_d_getChildrensForRoot as getChildrensForRoot,
224
+ wrapperUtil_d_generateChildren as generateChildren,
225
+ wrapperUtil_d_generateNewChildren as generateNewChildren,
226
+ wrapperUtil_d_removeTechnicalProps as removeTechnicalProps,
172
227
  };
173
228
  }
174
229
 
@@ -252,10 +307,10 @@ declare class I18n {
252
307
  t: (key: any, options?: any, language?: string | null | undefined) => any;
253
308
  }
254
309
 
255
- declare const StockContext: react.Context<typeof Stock$1 | null>;
310
+ declare const StockContext: react.Context<Stock$1 | null>;
256
311
  declare const PathModifierContext: react.Context<{}>;
257
312
 
258
- declare const genAllStateProps: (globalState: any, props: PropsType) => PropsType;
313
+ declare const compSelectorHook: (currentPaths: PathModifiersType, subscriberPaths: ReduxPathType[]) => (state: any) => any[] | undefined;
259
314
 
260
315
  declare const _default$1: {
261
316
  getStateValue: JsonUIFunctionType;
@@ -273,4 +328,4 @@ declare const rootReducer: redux.Reducer<redux.CombinedState<{
273
328
  root: any;
274
329
  }>, redux.AnyAction>;
275
330
 
276
- export { ArraysType, I18n, Path, PathModifierContext, PathModifierType, PathModifiersType, PathType, PathsType, PropValue, PropsType, Stock, StockContext, UIDefinition, ValidationType, WrapperType, appRootFunctions, constants_d as constants, genAllStateProps, _default as persistConfig, _default$1 as stockFunctions, rootReducer as storeReducers, util_d as util, wrapperUtil_d as wrapperUtil };
331
+ export { ArraysType, I18n, Path, PathModifierContext, PathModifierType, PathModifiersType, PathType, PathsType, PropValue, PropsType, ReduxPathType, Stock, StockContext, UIDefinition, ValidationType, WrapperType, appRootFunctions, compSelectorHook, constants_d as constants, _default as persistConfig, _default$1 as stockFunctions, rootReducer as storeReducers, util_d as util, wrapperUtil_d as wrapperUtil };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonui/core",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/cjs/index.js",
@@ -56,5 +56,5 @@
56
56
  "rollup-plugin-visualizer": "^5.5.4",
57
57
  "ts-jest": "^27.1.3"
58
58
  },
59
- "gitHead": "f0735aa16e801f97232fa951c479ab59f4d10758"
59
+ "gitHead": "553460e0f24310eedf10b7e8860abb4d5c31e73f"
60
60
  }
@@ -1,2 +0,0 @@
1
- export declare const collectJsonKeys: (refConst: string, json: any) => {};
2
- export declare const getRefs: (refConst: string, json: any, projectPath?: string) => any[];
@@ -1,2 +0,0 @@
1
- export declare const collectJsonKeys: (refConst: string, json: any) => {};
2
- export declare const getRefs: (refConst: string, json: any, projectPath?: string) => any[];