@jsonforms/core 3.0.0-alpha.3 → 3.0.0-beta.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.
Files changed (193) hide show
  1. package/docs/globals.html +37 -37
  2. package/docs/interfaces/arraycontrolprops.html +21 -21
  3. package/docs/interfaces/arraylayoutprops.html +21 -21
  4. package/docs/interfaces/cellprops.html +12 -12
  5. package/docs/interfaces/combinatorrendererprops.html +13 -13
  6. package/docs/interfaces/controlprops.html +16 -16
  7. package/docs/interfaces/controlstate.html +2 -2
  8. package/docs/interfaces/controlwithdetailprops.html +17 -17
  9. package/docs/interfaces/dispatchcellprops.html +10 -10
  10. package/docs/interfaces/dispatchcellstateprops.html +10 -10
  11. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  12. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  13. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  14. package/docs/interfaces/enumcellprops.html +13 -13
  15. package/docs/interfaces/enumoption.html +2 -2
  16. package/docs/interfaces/jsonformsprops.html +9 -9
  17. package/docs/interfaces/layoutprops.html +10 -10
  18. package/docs/interfaces/ownpropsofcell.html +9 -9
  19. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  20. package/docs/interfaces/ownpropsofenum.html +1 -1
  21. package/docs/interfaces/ownpropsofenumcell.html +10 -10
  22. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  23. package/docs/interfaces/ownpropsoflayout.html +9 -9
  24. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  25. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  26. package/docs/interfaces/rendererprops.html +9 -9
  27. package/docs/interfaces/statepropsofarraycontrol.html +17 -17
  28. package/docs/interfaces/statepropsofarraylayout.html +17 -17
  29. package/docs/interfaces/statepropsofcell.html +11 -11
  30. package/docs/interfaces/statepropsofcombinator.html +12 -12
  31. package/docs/interfaces/statepropsofcontrol.html +15 -15
  32. package/docs/interfaces/statepropsofcontrolwithdetail.html +16 -16
  33. package/docs/interfaces/statepropsofenumcell.html +12 -12
  34. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
  35. package/docs/interfaces/statepropsoflayout.html +10 -10
  36. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  37. package/docs/interfaces/statepropsofrenderer.html +9 -9
  38. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  39. package/docs/interfaces/withclassname.html +1 -1
  40. package/lib/Helpers.d.ts +5 -5
  41. package/lib/actions/actions.d.ts +181 -181
  42. package/lib/actions/index.d.ts +1 -1
  43. package/lib/configDefault.d.ts +6 -6
  44. package/lib/generators/Generate.d.ts +6 -6
  45. package/lib/generators/index.d.ts +3 -3
  46. package/lib/generators/schema.d.ts +8 -8
  47. package/lib/generators/uischema.d.ts +12 -12
  48. package/lib/i18n/i18nTypes.d.ts +15 -15
  49. package/lib/i18n/i18nUtil.d.ts +18 -18
  50. package/lib/i18n/index.d.ts +2 -2
  51. package/lib/index.d.ts +11 -11
  52. package/lib/jsonforms-core.cjs.js +2445 -0
  53. package/lib/jsonforms-core.cjs.js.map +1 -0
  54. package/lib/jsonforms-core.esm.js +2164 -0
  55. package/lib/jsonforms-core.esm.js.map +1 -0
  56. package/lib/models/draft4.d.ts +198 -198
  57. package/lib/models/index.d.ts +5 -5
  58. package/lib/models/jsonSchema.d.ts +3 -3
  59. package/lib/models/jsonSchema4.d.ts +110 -110
  60. package/lib/models/jsonSchema7.d.ts +119 -119
  61. package/lib/models/uischema.d.ts +201 -201
  62. package/lib/reducers/cells.d.ts +11 -11
  63. package/lib/reducers/config.d.ts +3 -3
  64. package/lib/reducers/core.d.ts +24 -24
  65. package/lib/reducers/default-data.d.ts +10 -10
  66. package/lib/reducers/i18n.d.ts +8 -8
  67. package/lib/reducers/index.d.ts +9 -9
  68. package/lib/reducers/reducers.d.ts +29 -29
  69. package/lib/reducers/renderers.d.ts +10 -10
  70. package/lib/reducers/selectors.d.ts +15 -15
  71. package/lib/reducers/uischemas.d.ts +10 -10
  72. package/lib/store.d.ts +53 -53
  73. package/lib/testers/index.d.ts +1 -1
  74. package/lib/testers/testers.d.ts +203 -203
  75. package/lib/util/Formatted.d.ts +19 -19
  76. package/lib/util/array.d.ts +3 -3
  77. package/lib/util/cell.d.ts +79 -79
  78. package/lib/util/combinators.d.ts +10 -10
  79. package/lib/util/ids.d.ts +3 -3
  80. package/lib/util/index.d.ts +15 -15
  81. package/lib/util/label.d.ts +9 -9
  82. package/lib/util/path.d.ts +25 -25
  83. package/lib/util/renderer.d.ts +398 -397
  84. package/lib/util/resolvers.d.ts +25 -25
  85. package/lib/util/runtime.d.ts +18 -18
  86. package/lib/util/schema.d.ts +1 -1
  87. package/lib/util/type.d.ts +174 -174
  88. package/lib/util/uischema.d.ts +5 -5
  89. package/lib/util/util.d.ts +31 -31
  90. package/lib/util/validator.d.ts +3 -3
  91. package/package.json +16 -13
  92. package/rollup.config.js +44 -0
  93. package/src/reducers/reducers.ts +2 -2
  94. package/src/util/cell.ts +4 -4
  95. package/src/util/renderer.ts +9 -8
  96. package/stats.html +3279 -0
  97. package/lib/Helpers.js +0 -33
  98. package/lib/Helpers.js.map +0 -1
  99. package/lib/actions/actions.js +0 -173
  100. package/lib/actions/actions.js.map +0 -1
  101. package/lib/actions/index.js +0 -29
  102. package/lib/actions/index.js.map +0 -1
  103. package/lib/configDefault.js +0 -48
  104. package/lib/configDefault.js.map +0 -1
  105. package/lib/generators/Generate.js +0 -35
  106. package/lib/generators/Generate.js.map +0 -1
  107. package/lib/generators/index.js +0 -31
  108. package/lib/generators/index.js.map +0 -1
  109. package/lib/generators/schema.js +0 -154
  110. package/lib/generators/schema.js.map +0 -1
  111. package/lib/generators/uischema.js +0 -169
  112. package/lib/generators/uischema.js.map +0 -1
  113. package/lib/i18n/i18nTypes.js +0 -3
  114. package/lib/i18n/i18nTypes.js.map +0 -1
  115. package/lib/i18n/i18nUtil.js +0 -71
  116. package/lib/i18n/i18nUtil.js.map +0 -1
  117. package/lib/i18n/index.js +0 -6
  118. package/lib/i18n/index.js.map +0 -1
  119. package/lib/index.js +0 -40
  120. package/lib/index.js.map +0 -1
  121. package/lib/jsonforms-core.js +0 -25
  122. package/lib/jsonforms-core.js.map +0 -1
  123. package/lib/models/draft4.js +0 -174
  124. package/lib/models/draft4.js.map +0 -1
  125. package/lib/models/index.js +0 -33
  126. package/lib/models/index.js.map +0 -1
  127. package/lib/models/jsonSchema.js +0 -27
  128. package/lib/models/jsonSchema.js.map +0 -1
  129. package/lib/models/jsonSchema4.js +0 -30
  130. package/lib/models/jsonSchema4.js.map +0 -1
  131. package/lib/models/jsonSchema7.js +0 -30
  132. package/lib/models/jsonSchema7.js.map +0 -1
  133. package/lib/models/uischema.js +0 -58
  134. package/lib/models/uischema.js.map +0 -1
  135. package/lib/reducers/cells.js +0 -42
  136. package/lib/reducers/cells.js.map +0 -1
  137. package/lib/reducers/config.js +0 -46
  138. package/lib/reducers/config.js.map +0 -1
  139. package/lib/reducers/core.js +0 -294
  140. package/lib/reducers/core.js.map +0 -1
  141. package/lib/reducers/default-data.js +0 -45
  142. package/lib/reducers/default-data.js.map +0 -1
  143. package/lib/reducers/i18n.js +0 -83
  144. package/lib/reducers/i18n.js.map +0 -1
  145. package/lib/reducers/index.js +0 -37
  146. package/lib/reducers/index.js.map +0 -1
  147. package/lib/reducers/reducers.js +0 -98
  148. package/lib/reducers/reducers.js.map +0 -1
  149. package/lib/reducers/renderers.js +0 -43
  150. package/lib/reducers/renderers.js.map +0 -1
  151. package/lib/reducers/selectors.js +0 -56
  152. package/lib/reducers/selectors.js.map +0 -1
  153. package/lib/reducers/uischemas.js +0 -60
  154. package/lib/reducers/uischemas.js.map +0 -1
  155. package/lib/store.js +0 -27
  156. package/lib/store.js.map +0 -1
  157. package/lib/testers/index.js +0 -29
  158. package/lib/testers/index.js.map +0 -1
  159. package/lib/testers/testers.js +0 -421
  160. package/lib/testers/testers.js.map +0 -1
  161. package/lib/util/Formatted.js +0 -27
  162. package/lib/util/Formatted.js.map +0 -1
  163. package/lib/util/array.js +0 -44
  164. package/lib/util/array.js.map +0 -1
  165. package/lib/util/cell.js +0 -148
  166. package/lib/util/cell.js.map +0 -1
  167. package/lib/util/combinators.js +0 -59
  168. package/lib/util/combinators.js.map +0 -1
  169. package/lib/util/ids.js +0 -54
  170. package/lib/util/ids.js.map +0 -1
  171. package/lib/util/index.js +0 -43
  172. package/lib/util/index.js.map +0 -1
  173. package/lib/util/label.js +0 -73
  174. package/lib/util/label.js.map +0 -1
  175. package/lib/util/path.js +0 -90
  176. package/lib/util/path.js.map +0 -1
  177. package/lib/util/renderer.js +0 -530
  178. package/lib/util/renderer.js.map +0 -1
  179. package/lib/util/resolvers.js +0 -169
  180. package/lib/util/resolvers.js.map +0 -1
  181. package/lib/util/runtime.js +0 -167
  182. package/lib/util/runtime.js.map +0 -1
  183. package/lib/util/schema.js +0 -42
  184. package/lib/util/schema.js.map +0 -1
  185. package/lib/util/type.js +0 -27
  186. package/lib/util/type.js.map +0 -1
  187. package/lib/util/uischema.js +0 -56
  188. package/lib/util/uischema.js.map +0 -1
  189. package/lib/util/util.js +0 -112
  190. package/lib/util/util.js.map +0 -1
  191. package/lib/util/validator.js +0 -37
  192. package/lib/util/validator.js.map +0 -1
  193. package/webpack.build.js +0 -13
@@ -1,25 +1,25 @@
1
- import { JsonSchema } from '../models';
2
- /**
3
- * Map for storing refs and the respective schemas they are pointing to.
4
- */
5
- export interface ReferenceSchemaMap {
6
- [ref: string]: JsonSchema;
7
- }
8
- export declare const resolveData: (instance: any, dataPath: string) => any;
9
- /**
10
- * Finds all references inside the given schema.
11
- *
12
- * @param schema The {@link JsonSchema} to find the references in
13
- * @param result The initial result map, default: empty map (this parameter is used for recursion
14
- * inside the function)
15
- * @param resolveTuples Whether arrays of tuples should be considered; default: false
16
- */
17
- export declare const findAllRefs: (schema: JsonSchema, result?: ReferenceSchemaMap, resolveTuples?: boolean) => ReferenceSchemaMap;
18
- /**
19
- * Resolve the given schema path in order to obtain a subschema.
20
- * @param {JsonSchema} schema the root schema from which to start
21
- * @param {string} schemaPath the schema path to be resolved
22
- * @param {JsonSchema} rootSchema the actual root schema
23
- * @returns {JsonSchema} the resolved sub-schema
24
- */
25
- export declare const resolveSchema: (schema: JsonSchema, schemaPath: string, rootSchema?: JsonSchema) => JsonSchema;
1
+ import { JsonSchema } from '../models';
2
+ /**
3
+ * Map for storing refs and the respective schemas they are pointing to.
4
+ */
5
+ export interface ReferenceSchemaMap {
6
+ [ref: string]: JsonSchema;
7
+ }
8
+ export declare const resolveData: (instance: any, dataPath: string) => any;
9
+ /**
10
+ * Finds all references inside the given schema.
11
+ *
12
+ * @param schema The {@link JsonSchema} to find the references in
13
+ * @param result The initial result map, default: empty map (this parameter is used for recursion
14
+ * inside the function)
15
+ * @param resolveTuples Whether arrays of tuples should be considered; default: false
16
+ */
17
+ export declare const findAllRefs: (schema: JsonSchema, result?: ReferenceSchemaMap, resolveTuples?: boolean) => ReferenceSchemaMap;
18
+ /**
19
+ * Resolve the given schema path in order to obtain a subschema.
20
+ * @param {JsonSchema} schema the root schema from which to start
21
+ * @param {string} schemaPath the schema path to be resolved
22
+ * @param {JsonSchema} rootSchema the actual root schema
23
+ * @returns {JsonSchema} the resolved sub-schema
24
+ */
25
+ export declare const resolveSchema: (schema: JsonSchema, schemaPath: string, rootSchema?: JsonSchema) => JsonSchema;
@@ -1,18 +1,18 @@
1
- import { UISchemaElement } from '../models';
2
- import Ajv from 'ajv';
3
- import { JsonFormsState } from '../store';
4
- import { JsonSchema } from '../models/jsonSchema';
5
- export declare const evalVisibility: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
6
- export declare const evalEnablement: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
7
- export declare const hasShowRule: (uischema: UISchemaElement) => boolean;
8
- export declare const hasEnableRule: (uischema: UISchemaElement) => boolean;
9
- export declare const isVisible: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
10
- export declare const isEnabled: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
11
- /**
12
- * Indicates whether the given `uischema` element shall be enabled or disabled.
13
- * Checks the global readonly flag, uischema rule, uischema options (including the config),
14
- * the schema and the enablement indicator of the parent.
15
- */
16
- export declare const isInherentlyEnabled: (state: JsonFormsState, ownProps: any, uischema: UISchemaElement, schema: (JsonSchema & {
17
- readOnly?: boolean;
18
- }) | undefined, rootData: any, config: any) => any;
1
+ import { UISchemaElement } from '../models';
2
+ import Ajv from 'ajv';
3
+ import { JsonFormsState } from '../store';
4
+ import { JsonSchema } from '../models/jsonSchema';
5
+ export declare const evalVisibility: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
6
+ export declare const evalEnablement: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
7
+ export declare const hasShowRule: (uischema: UISchemaElement) => boolean;
8
+ export declare const hasEnableRule: (uischema: UISchemaElement) => boolean;
9
+ export declare const isVisible: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
10
+ export declare const isEnabled: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
11
+ /**
12
+ * Indicates whether the given `uischema` element shall be enabled or disabled.
13
+ * Checks the global readonly flag, uischema rule, uischema options (including the config),
14
+ * the schema and the enablement indicator of the parent.
15
+ */
16
+ export declare const isInherentlyEnabled: (state: JsonFormsState, ownProps: any, uischema: UISchemaElement, schema: (JsonSchema & {
17
+ readOnly?: boolean;
18
+ }) | undefined, rootData: any, config: any) => any;
@@ -1 +1 @@
1
- export declare const getFirstPrimitiveProp: (schema: any) => string;
1
+ export declare const getFirstPrimitiveProp: (schema: any) => string;
@@ -1,174 +1,174 @@
1
- export interface Action<T = any> {
2
- type: T;
3
- }
4
- /**
5
- * An Action type which accepts any other properties.
6
- * This is mainly for the use of the `Reducer` type.
7
- * This is not part of `Action` itself to prevent types that extend `Action` from
8
- * having an index signature.
9
- */
10
- export interface AnyAction extends Action {
11
- [extraProps: string]: any;
12
- }
13
- /**
14
- * A *dispatching function* (or simply *dispatch function*) is a function that
15
- * accepts an action or an async action; it then may or may not dispatch one
16
- * or more actions to the store.
17
- *
18
- * We must distinguish between dispatching functions in general and the base
19
- * `dispatch` function provided by the store instance without any middleware.
20
- *
21
- * The base dispatch function *always* synchronously sends an action to the
22
- * store's reducer, along with the previous state returned by the store, to
23
- * calculate a new state. It expects actions to be plain objects ready to be
24
- * consumed by the reducer.
25
- *
26
- * Middleware wraps the base dispatch function. It allows the dispatch
27
- * function to handle async actions in addition to actions. Middleware may
28
- * transform, delay, ignore, or otherwise interpret actions or async actions
29
- * before passing them to the next middleware.
30
- *
31
- * @template A The type of things (actions or otherwise) which may be
32
- * dispatched.
33
- */
34
- export declare type Dispatch<A extends Action = AnyAction> = <T extends A>(action: T) => T;
35
- /**
36
- * A store is an object that holds the application's state tree.
37
- * There should only be a single store in a Redux app, as the composition
38
- * happens on the reducer level.
39
- *
40
- * @template S The type of state held by this store.
41
- * @template A the type of actions which may be dispatched by this store.
42
- */
43
- export interface Store<S = any, A extends Action = AnyAction> {
44
- /**
45
- * Dispatches an action. It is the only way to trigger a state change.
46
- *
47
- * The `reducer` function, used to create the store, will be called with the
48
- * current state tree and the given `action`. Its return value will be
49
- * considered the **next** state of the tree, and the change listeners will
50
- * be notified.
51
- *
52
- * The base implementation only supports plain object actions. If you want
53
- * to dispatch a Promise, an Observable, a thunk, or something else, you
54
- * need to wrap your store creating function into the corresponding
55
- * middleware. For example, see the documentation for the `redux-thunk`
56
- * package. Even the middleware will eventually dispatch plain object
57
- * actions using this method.
58
- *
59
- * @param action A plain object representing “what changed”. It is a good
60
- * idea to keep actions serializable so you can record and replay user
61
- * sessions, or use the time travelling `redux-devtools`. An action must
62
- * have a `type` property which may not be `undefined`. It is a good idea
63
- * to use string constants for action types.
64
- *
65
- * @returns For convenience, the same action object you dispatched.
66
- *
67
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
68
- * return something else (for example, a Promise you can await).
69
- */
70
- dispatch: Dispatch<A>;
71
- /**
72
- * Reads the state tree managed by the store.
73
- *
74
- * @returns The current state tree of your application.
75
- */
76
- getState(): S;
77
- /**
78
- * Adds a change listener. It will be called any time an action is
79
- * dispatched, and some part of the state tree may potentially have changed.
80
- * You may then call `getState()` to read the current state tree inside the
81
- * callback.
82
- *
83
- * You may call `dispatch()` from a change listener, with the following
84
- * caveats:
85
- *
86
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
87
- * If you subscribe or unsubscribe while the listeners are being invoked,
88
- * this will not have any effect on the `dispatch()` that is currently in
89
- * progress. However, the next `dispatch()` call, whether nested or not,
90
- * will use a more recent snapshot of the subscription list.
91
- *
92
- * 2. The listener should not expect to see all states changes, as the state
93
- * might have been updated multiple times during a nested `dispatch()` before
94
- * the listener is called. It is, however, guaranteed that all subscribers
95
- * registered before the `dispatch()` started will be called with the latest
96
- * state by the time it exits.
97
- *
98
- * @param listener A callback to be invoked on every dispatch.
99
- * @returns A function to remove this change listener.
100
- */
101
- subscribe(listener: () => void): Unsubscribe;
102
- /**
103
- * Replaces the reducer currently used by the store to calculate the state.
104
- *
105
- * You might need this if your app implements code splitting and you want to
106
- * load some of the reducers dynamically. You might also need this if you
107
- * implement a hot reloading mechanism for Redux.
108
- *
109
- * @param nextReducer The reducer for the store to use instead.
110
- */
111
- replaceReducer(nextReducer: Reducer<S, A>): void;
112
- /**
113
- * Interoperability point for observable/reactive libraries.
114
- * @returns {observable} A minimal observable of state changes.
115
- * For more information, see the observable proposal:
116
- * https://github.com/tc39/proposal-observable
117
- */
118
- [Symbol.observable](): Observable<S>;
119
- }
120
- /**
121
- * A minimal observable of state changes.
122
- * For more information, see the observable proposal:
123
- * https://github.com/tc39/proposal-observable
124
- */
125
- export declare type Observable<T> = {
126
- /**
127
- * The minimal observable subscription method.
128
- * @param {Object} observer Any object that can be used as an observer.
129
- * The observer object should have a `next` method.
130
- * @returns {subscription} An object with an `unsubscribe` method that can
131
- * be used to unsubscribe the observable from the store, and prevent further
132
- * emission of values from the observable.
133
- */
134
- subscribe(observer: Observer<T>): {
135
- unsubscribe: Unsubscribe;
136
- };
137
- [Symbol.observable](): Observable<T>;
138
- };
139
- /**
140
- * An Observer is used to receive data from an Observable, and is supplied as
141
- * an argument to subscribe.
142
- */
143
- export declare type Observer<T> = {
144
- next?(value: T): void;
145
- };
146
- /**
147
- * A *reducer* (also called a *reducing function*) is a function that accepts
148
- * an accumulation and a value and returns a new accumulation. They are used
149
- * to reduce a collection of values down to a single value
150
- *
151
- * Reducers are not unique to Redux—they are a fundamental concept in
152
- * functional programming. Even most non-functional languages, like
153
- * JavaScript, have a built-in API for reducing. In JavaScript, it's
154
- * `Array.prototype.reduce()`.
155
- *
156
- * In Redux, the accumulated value is the state object, and the values being
157
- * accumulated are actions. Reducers calculate a new state given the previous
158
- * state and an action. They must be *pure functions*—functions that return
159
- * the exact same output for given inputs. They should also be free of
160
- * side-effects. This is what enables exciting features like hot reloading and
161
- * time travel.
162
- *
163
- * Reducers are the most important concept in Redux.
164
- *
165
- * *Do not put API calls into reducers.*
166
- *
167
- * @template S The type of state consumed and produced by this reducer.
168
- * @template A The type of actions the reducer can potentially respond to.
169
- */
170
- export declare type Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;
171
- /**
172
- * Function to remove listener added by `Store.subscribe()`.
173
- */
174
- export declare type Unsubscribe = () => void;
1
+ export interface Action<T = any> {
2
+ type: T;
3
+ }
4
+ /**
5
+ * An Action type which accepts any other properties.
6
+ * This is mainly for the use of the `Reducer` type.
7
+ * This is not part of `Action` itself to prevent types that extend `Action` from
8
+ * having an index signature.
9
+ */
10
+ export interface AnyAction extends Action {
11
+ [extraProps: string]: any;
12
+ }
13
+ /**
14
+ * A *dispatching function* (or simply *dispatch function*) is a function that
15
+ * accepts an action or an async action; it then may or may not dispatch one
16
+ * or more actions to the store.
17
+ *
18
+ * We must distinguish between dispatching functions in general and the base
19
+ * `dispatch` function provided by the store instance without any middleware.
20
+ *
21
+ * The base dispatch function *always* synchronously sends an action to the
22
+ * store's reducer, along with the previous state returned by the store, to
23
+ * calculate a new state. It expects actions to be plain objects ready to be
24
+ * consumed by the reducer.
25
+ *
26
+ * Middleware wraps the base dispatch function. It allows the dispatch
27
+ * function to handle async actions in addition to actions. Middleware may
28
+ * transform, delay, ignore, or otherwise interpret actions or async actions
29
+ * before passing them to the next middleware.
30
+ *
31
+ * @template A The type of things (actions or otherwise) which may be
32
+ * dispatched.
33
+ */
34
+ export declare type Dispatch<A extends Action = AnyAction> = <T extends A>(action: T) => T;
35
+ /**
36
+ * A store is an object that holds the application's state tree.
37
+ * There should only be a single store in a Redux app, as the composition
38
+ * happens on the reducer level.
39
+ *
40
+ * @template S The type of state held by this store.
41
+ * @template A the type of actions which may be dispatched by this store.
42
+ */
43
+ export interface Store<S = any, A extends Action = AnyAction> {
44
+ /**
45
+ * Dispatches an action. It is the only way to trigger a state change.
46
+ *
47
+ * The `reducer` function, used to create the store, will be called with the
48
+ * current state tree and the given `action`. Its return value will be
49
+ * considered the **next** state of the tree, and the change listeners will
50
+ * be notified.
51
+ *
52
+ * The base implementation only supports plain object actions. If you want
53
+ * to dispatch a Promise, an Observable, a thunk, or something else, you
54
+ * need to wrap your store creating function into the corresponding
55
+ * middleware. For example, see the documentation for the `redux-thunk`
56
+ * package. Even the middleware will eventually dispatch plain object
57
+ * actions using this method.
58
+ *
59
+ * @param action A plain object representing “what changed”. It is a good
60
+ * idea to keep actions serializable so you can record and replay user
61
+ * sessions, or use the time travelling `redux-devtools`. An action must
62
+ * have a `type` property which may not be `undefined`. It is a good idea
63
+ * to use string constants for action types.
64
+ *
65
+ * @returns For convenience, the same action object you dispatched.
66
+ *
67
+ * Note that, if you use a custom middleware, it may wrap `dispatch()` to
68
+ * return something else (for example, a Promise you can await).
69
+ */
70
+ dispatch: Dispatch<A>;
71
+ /**
72
+ * Reads the state tree managed by the store.
73
+ *
74
+ * @returns The current state tree of your application.
75
+ */
76
+ getState(): S;
77
+ /**
78
+ * Adds a change listener. It will be called any time an action is
79
+ * dispatched, and some part of the state tree may potentially have changed.
80
+ * You may then call `getState()` to read the current state tree inside the
81
+ * callback.
82
+ *
83
+ * You may call `dispatch()` from a change listener, with the following
84
+ * caveats:
85
+ *
86
+ * 1. The subscriptions are snapshotted just before every `dispatch()` call.
87
+ * If you subscribe or unsubscribe while the listeners are being invoked,
88
+ * this will not have any effect on the `dispatch()` that is currently in
89
+ * progress. However, the next `dispatch()` call, whether nested or not,
90
+ * will use a more recent snapshot of the subscription list.
91
+ *
92
+ * 2. The listener should not expect to see all states changes, as the state
93
+ * might have been updated multiple times during a nested `dispatch()` before
94
+ * the listener is called. It is, however, guaranteed that all subscribers
95
+ * registered before the `dispatch()` started will be called with the latest
96
+ * state by the time it exits.
97
+ *
98
+ * @param listener A callback to be invoked on every dispatch.
99
+ * @returns A function to remove this change listener.
100
+ */
101
+ subscribe(listener: () => void): Unsubscribe;
102
+ /**
103
+ * Replaces the reducer currently used by the store to calculate the state.
104
+ *
105
+ * You might need this if your app implements code splitting and you want to
106
+ * load some of the reducers dynamically. You might also need this if you
107
+ * implement a hot reloading mechanism for Redux.
108
+ *
109
+ * @param nextReducer The reducer for the store to use instead.
110
+ */
111
+ replaceReducer(nextReducer: Reducer<S, A>): void;
112
+ /**
113
+ * Interoperability point for observable/reactive libraries.
114
+ * @returns {observable} A minimal observable of state changes.
115
+ * For more information, see the observable proposal:
116
+ * https://github.com/tc39/proposal-observable
117
+ */
118
+ [Symbol.observable](): Observable<S>;
119
+ }
120
+ /**
121
+ * A minimal observable of state changes.
122
+ * For more information, see the observable proposal:
123
+ * https://github.com/tc39/proposal-observable
124
+ */
125
+ export declare type Observable<T> = {
126
+ /**
127
+ * The minimal observable subscription method.
128
+ * @param {Object} observer Any object that can be used as an observer.
129
+ * The observer object should have a `next` method.
130
+ * @returns {subscription} An object with an `unsubscribe` method that can
131
+ * be used to unsubscribe the observable from the store, and prevent further
132
+ * emission of values from the observable.
133
+ */
134
+ subscribe(observer: Observer<T>): {
135
+ unsubscribe: Unsubscribe;
136
+ };
137
+ [Symbol.observable](): Observable<T>;
138
+ };
139
+ /**
140
+ * An Observer is used to receive data from an Observable, and is supplied as
141
+ * an argument to subscribe.
142
+ */
143
+ export declare type Observer<T> = {
144
+ next?(value: T): void;
145
+ };
146
+ /**
147
+ * A *reducer* (also called a *reducing function*) is a function that accepts
148
+ * an accumulation and a value and returns a new accumulation. They are used
149
+ * to reduce a collection of values down to a single value
150
+ *
151
+ * Reducers are not unique to Redux—they are a fundamental concept in
152
+ * functional programming. Even most non-functional languages, like
153
+ * JavaScript, have a built-in API for reducing. In JavaScript, it's
154
+ * `Array.prototype.reduce()`.
155
+ *
156
+ * In Redux, the accumulated value is the state object, and the values being
157
+ * accumulated are actions. Reducers calculate a new state given the previous
158
+ * state and an action. They must be *pure functions*—functions that return
159
+ * the exact same output for given inputs. They should also be free of
160
+ * side-effects. This is what enables exciting features like hot reloading and
161
+ * time travel.
162
+ *
163
+ * Reducers are the most important concept in Redux.
164
+ *
165
+ * *Do not put API calls into reducers.*
166
+ *
167
+ * @template S The type of state consumed and produced by this reducer.
168
+ * @template A The type of actions the reducer can potentially respond to.
169
+ */
170
+ export declare type Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;
171
+ /**
172
+ * Function to remove listener added by `Store.subscribe()`.
173
+ */
174
+ export declare type Unsubscribe = () => void;
@@ -1,5 +1,5 @@
1
- import { UISchemaElement } from '../models';
2
- export declare type IterateCallback = (uischema: UISchemaElement) => void;
3
- export declare const setReadonly: (uischema: UISchemaElement) => void;
4
- export declare const unsetReadonly: (uischema: UISchemaElement) => void;
5
- export declare const iterateSchema: (uischema: UISchemaElement, toApply: IterateCallback) => void;
1
+ import { UISchemaElement } from '../models';
2
+ export declare type IterateCallback = (uischema: UISchemaElement) => void;
3
+ export declare const setReadonly: (uischema: UISchemaElement) => void;
4
+ export declare const unsetReadonly: (uischema: UISchemaElement) => void;
5
+ export declare const iterateSchema: (uischema: UISchemaElement, toApply: IterateCallback) => void;
@@ -1,31 +1,31 @@
1
- import { JsonSchema, Scopable, UISchemaElement } from '..';
2
- import Ajv from 'ajv';
3
- /**
4
- * Escape the given string such that it can be used as a class name,
5
- * i.e. hashes and slashes will be replaced.
6
- *
7
- * @param {string} s the string that should be converted to a valid class name
8
- * @returns {string} the escaped string
9
- */
10
- export declare const convertToValidClassName: (s: string) => string;
11
- export declare const formatErrorMessage: (errors: string[]) => string;
12
- export declare const hasType: (jsonSchema: JsonSchema, expected: string) => boolean;
13
- /**
14
- * Derives the type of the jsonSchema element
15
- */
16
- export declare const deriveTypes: (jsonSchema: JsonSchema) => string[];
17
- /**
18
- * Convenience wrapper around resolveData and resolveSchema.
19
- */
20
- export declare const Resolve: {
21
- schema(schema: JsonSchema, schemaPath: string, rootSchema?: JsonSchema): JsonSchema;
22
- data(data: any, path: string): any;
23
- };
24
- export declare const Paths: {
25
- compose: (path1: string, path2: string) => string;
26
- fromScopable: (scopable: Scopable) => string;
27
- };
28
- export declare const Runtime: {
29
- isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
30
- isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
31
- };
1
+ import { JsonSchema, Scopable, UISchemaElement } from '..';
2
+ import Ajv from 'ajv';
3
+ /**
4
+ * Escape the given string such that it can be used as a class name,
5
+ * i.e. hashes and slashes will be replaced.
6
+ *
7
+ * @param {string} s the string that should be converted to a valid class name
8
+ * @returns {string} the escaped string
9
+ */
10
+ export declare const convertToValidClassName: (s: string) => string;
11
+ export declare const formatErrorMessage: (errors: string[]) => string;
12
+ export declare const hasType: (jsonSchema: JsonSchema, expected: string) => boolean;
13
+ /**
14
+ * Derives the type of the jsonSchema element
15
+ */
16
+ export declare const deriveTypes: (jsonSchema: JsonSchema) => string[];
17
+ /**
18
+ * Convenience wrapper around resolveData and resolveSchema.
19
+ */
20
+ export declare const Resolve: {
21
+ schema(schema: JsonSchema, schemaPath: string, rootSchema?: JsonSchema): JsonSchema;
22
+ data(data: any, path: string): any;
23
+ };
24
+ export declare const Paths: {
25
+ compose: (path1: string, path2: string) => string;
26
+ fromScopable: (scopable: Scopable) => string;
27
+ };
28
+ export declare const Runtime: {
29
+ isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
30
+ isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
31
+ };
@@ -1,3 +1,3 @@
1
- import Ajv from 'ajv';
2
- import { Options } from 'ajv';
3
- export declare const createAjv: (options?: Options) => Ajv;
1
+ import Ajv from 'ajv';
2
+ import { Options } from 'ajv';
3
+ export declare const createAjv: (options?: Options) => Ajv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/core",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-beta.0",
4
4
  "description": "Core module of JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -29,16 +29,16 @@
29
29
  "layout",
30
30
  "customization"
31
31
  ],
32
- "main": "./lib/index.js",
32
+ "main": "lib/jsonforms-core.cjs.js",
33
+ "module": "lib/jsonforms-core.esm.js",
33
34
  "typings": "./lib/index.d.ts",
34
35
  "scripts": {
35
- "bundle": "webpack --config ./webpack.build.js --env=production --display-error-details",
36
- "build": "tsc",
36
+ "build": "rollup -c rollup.config.js",
37
37
  "clean": "rimraf -rf lib coverage dist .nyc_output 2> /dev/null",
38
38
  "lint": "tslint --project tsconfig.json --exclude src/models/jsonSchema.ts",
39
39
  "report": "nyc report --reporter=html",
40
- "test": "ava",
41
- "test-cov": "rimraf -rf .nyc_output && nyc ava",
40
+ "test": "cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\",\\\"target\\\":\\\"es5\\\"} ava",
41
+ "test-cov": "rimraf -rf .nyc_output && cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\",\\\"target\\\":\\\"es5\\\"} nyc ava",
42
42
  "doc": "typedoc --name 'JSON Forms Core' --mode file --excludeExternals --theme ../../typedoc-jsonforms --out docs src"
43
43
  },
44
44
  "ava": {
@@ -67,23 +67,26 @@
67
67
  "lodash": "^4.17.15"
68
68
  },
69
69
  "devDependencies": {
70
- "@istanbuljs/nyc-config-typescript": "0.1.3",
70
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
71
71
  "@types/redux-mock-store": "^1.0.1",
72
72
  "ava": "~2.4.0",
73
+ "cross-env": "^7.0.2",
73
74
  "document-register-element": "^1.14.3",
74
75
  "jsdom": "^15.2.1",
75
76
  "jsdom-global": "^3.0.2",
76
- "nyc": "^14.1.1",
77
+ "nyc": "^15.1.0",
77
78
  "redux": "^4.0.4",
78
79
  "redux-mock-store": "1.5.3",
79
80
  "rimraf": "^3.0.2",
81
+ "rollup": "^2.7.3",
82
+ "rollup-plugin-cleanup": "^3.2.1",
83
+ "rollup-plugin-typescript2": "^0.31.1",
84
+ "rollup-plugin-visualizer": "^5.4.1",
80
85
  "source-map-support": "0.5.16",
81
- "ts-node": "^8.5.3",
86
+ "ts-node": "^10.4.0",
82
87
  "tslint": "^5.20.1",
83
88
  "typedoc": "^0.19.2",
84
- "typescript": "4.2.3",
85
- "webpack": "^4.41.2",
86
- "webpack-cli": "^3.2.1"
89
+ "typescript": "4.2.3"
87
90
  },
88
- "gitHead": "81f1f19dac49b1864e712e9abbc5c5c6355a2b91"
91
+ "gitHead": "8540d2f63abe25ee079192bc7d45e7ba4be00eac"
89
92
  }
@@ -0,0 +1,44 @@
1
+ import typescript from 'rollup-plugin-typescript2';
2
+ import cleanup from 'rollup-plugin-cleanup';
3
+ import { visualizer } from 'rollup-plugin-visualizer';
4
+
5
+ const packageJson = require('./package.json');
6
+
7
+ const baseConfig = {
8
+ input: 'src/index.ts',
9
+ external: [...Object.keys(packageJson.dependencies), /^lodash\/.*/]
10
+ };
11
+
12
+ export default [
13
+ {
14
+ ...baseConfig,
15
+ output: {
16
+ file: packageJson.module,
17
+ format: 'esm',
18
+ sourcemap: true
19
+ },
20
+ plugins: [
21
+ typescript(),
22
+ cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx'] }),
23
+ visualizer({ open: false })
24
+ ]
25
+ },
26
+ {
27
+ ...baseConfig,
28
+ output: {
29
+ file: packageJson.main,
30
+ format: 'cjs',
31
+ sourcemap: true
32
+ },
33
+ plugins: [
34
+ typescript({
35
+ tsconfigOverride: {
36
+ compilerOptions: {
37
+ target: 'ES5'
38
+ }
39
+ }
40
+ }),
41
+ cleanup({ extensions: ['js', 'ts', 'jsx', 'tsx'] })
42
+ ]
43
+ }
44
+ ];