eleva 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -10
- package/dist/{eleva-plugins.cjs.js → eleva-plugins.cjs} +1002 -292
- package/dist/eleva-plugins.cjs.map +1 -0
- package/dist/eleva-plugins.d.cts +1352 -0
- package/dist/eleva-plugins.d.cts.map +1 -0
- package/dist/eleva-plugins.d.ts +1352 -0
- package/dist/eleva-plugins.d.ts.map +1 -0
- package/dist/{eleva-plugins.esm.js → eleva-plugins.js} +1002 -292
- package/dist/eleva-plugins.js.map +1 -0
- package/dist/eleva-plugins.umd.js +1001 -291
- package/dist/eleva-plugins.umd.js.map +1 -1
- package/dist/eleva-plugins.umd.min.js +1 -1
- package/dist/eleva-plugins.umd.min.js.map +1 -1
- package/dist/{eleva.cjs.js → eleva.cjs} +421 -191
- package/dist/eleva.cjs.map +1 -0
- package/dist/eleva.d.cts +1329 -0
- package/dist/eleva.d.cts.map +1 -0
- package/dist/eleva.d.ts +473 -226
- package/dist/eleva.d.ts.map +1 -0
- package/dist/{eleva.esm.js → eleva.js} +422 -192
- package/dist/eleva.js.map +1 -0
- package/dist/eleva.umd.js +420 -190
- package/dist/eleva.umd.js.map +1 -1
- package/dist/eleva.umd.min.js +1 -1
- package/dist/eleva.umd.min.js.map +1 -1
- package/dist/plugins/attr.cjs +279 -0
- package/dist/plugins/attr.cjs.map +1 -0
- package/dist/plugins/attr.d.cts +101 -0
- package/dist/plugins/attr.d.cts.map +1 -0
- package/dist/plugins/attr.d.ts +101 -0
- package/dist/plugins/attr.d.ts.map +1 -0
- package/dist/plugins/attr.js +276 -0
- package/dist/plugins/attr.js.map +1 -0
- package/dist/plugins/attr.umd.js +111 -22
- package/dist/plugins/attr.umd.js.map +1 -1
- package/dist/plugins/attr.umd.min.js +1 -1
- package/dist/plugins/attr.umd.min.js.map +1 -1
- package/dist/plugins/router.cjs +1873 -0
- package/dist/plugins/router.cjs.map +1 -0
- package/dist/plugins/router.d.cts +1296 -0
- package/dist/plugins/router.d.cts.map +1 -0
- package/dist/plugins/router.d.ts +1296 -0
- package/dist/plugins/router.d.ts.map +1 -0
- package/dist/plugins/router.js +1870 -0
- package/dist/plugins/router.js.map +1 -0
- package/dist/plugins/router.umd.js +482 -186
- package/dist/plugins/router.umd.js.map +1 -1
- package/dist/plugins/router.umd.min.js +1 -1
- package/dist/plugins/router.umd.min.js.map +1 -1
- package/dist/plugins/store.cjs +920 -0
- package/dist/plugins/store.cjs.map +1 -0
- package/dist/plugins/store.d.cts +266 -0
- package/dist/plugins/store.d.cts.map +1 -0
- package/dist/plugins/store.d.ts +266 -0
- package/dist/plugins/store.d.ts.map +1 -0
- package/dist/plugins/store.js +917 -0
- package/dist/plugins/store.js.map +1 -0
- package/dist/plugins/store.umd.js +410 -85
- package/dist/plugins/store.umd.js.map +1 -1
- package/dist/plugins/store.umd.min.js +1 -1
- package/dist/plugins/store.umd.min.js.map +1 -1
- package/package.json +112 -68
- package/src/core/Eleva.js +195 -115
- package/src/index.cjs +10 -0
- package/src/index.js +11 -0
- package/src/modules/Emitter.js +68 -20
- package/src/modules/Renderer.js +82 -20
- package/src/modules/Signal.js +43 -15
- package/src/modules/TemplateEngine.js +50 -9
- package/src/plugins/Attr.js +121 -19
- package/src/plugins/Router.js +526 -181
- package/src/plugins/Store.js +448 -69
- package/src/plugins/index.js +1 -0
- package/types/core/Eleva.d.ts +263 -169
- package/types/core/Eleva.d.ts.map +1 -1
- package/types/index.d.cts +3 -0
- package/types/index.d.cts.map +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.d.ts.map +1 -1
- package/types/modules/Emitter.d.ts +73 -30
- package/types/modules/Emitter.d.ts.map +1 -1
- package/types/modules/Renderer.d.ts +48 -18
- package/types/modules/Renderer.d.ts.map +1 -1
- package/types/modules/Signal.d.ts +44 -16
- package/types/modules/Signal.d.ts.map +1 -1
- package/types/modules/TemplateEngine.d.ts +46 -11
- package/types/modules/TemplateEngine.d.ts.map +1 -1
- package/types/plugins/Attr.d.ts +83 -16
- package/types/plugins/Attr.d.ts.map +1 -1
- package/types/plugins/Router.d.ts +498 -207
- package/types/plugins/Router.d.ts.map +1 -1
- package/types/plugins/Store.d.ts +211 -37
- package/types/plugins/Store.d.ts.map +1 -1
- package/dist/eleva-plugins.cjs.js.map +0 -1
- package/dist/eleva-plugins.esm.js.map +0 -1
- package/dist/eleva.cjs.js.map +0 -1
- package/dist/eleva.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/plugins/Router.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/plugins/Router.js"],"names":[],"mappings":";;;;;;;UAmec,MAAM;;;;;;;;aAIN,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI;;;;wBAElD,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;;;cAwkD1C,MAAM;iBAMN,MAAM;qBAMN,MAAM;IAIhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACH,wBArCW,KAAK,YACL,aAAa,GASX,MAAM,CA0GlB;IAED;;;;;;;;;;OAUG;IACH,0BANW,KAAK,GACH,OAAO,CAAC,IAAI,CAAC,CAqBzB;;;;;;oBApsEU,OAAO,OAAO,EAAE,KAAK;;;;kCACrB,OAAO,OAAO,EAAE,mBAAmB;;;;sBACnC,OAAO,OAAO,EAAE,OAAO;;;;0BACvB,OAAO,OAAO,EAAE,WAAW;;;;kCAC3B,OAAO,OAAO,EAAE,mBAAmB;;;;mBAKnC,CAAC,IACD,OAAO,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;;;;;;;yBAoGzB,MAAM,GAAG,SAAS,GAAG,OAAO;;;;0BAK5B,MAAM,CAAC,MAA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gBnB;IAED;;;;;OAKG;IACH,8BAHW,kBAAkB,GAChB,IAAI,CAehB;CACF"}
|
package/types/plugins/Store.d.ts
CHANGED
|
@@ -3,21 +3,28 @@ export namespace StorePlugin {
|
|
|
3
3
|
let version: string;
|
|
4
4
|
let description: string;
|
|
5
5
|
/**
|
|
6
|
-
* Installs the plugin into the Eleva instance
|
|
6
|
+
* Installs the plugin into the Eleva instance.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
8
|
+
* @public
|
|
9
|
+
* @param {Eleva} eleva - The Eleva instance.
|
|
10
|
+
* @param {StoreOptions} options - Plugin configuration options.
|
|
11
|
+
* @param {Record<string, unknown>} [options.state={}] - Initial state object.
|
|
12
|
+
* @param {Record<string, ActionFunction>} [options.actions={}] - Action functions for state mutations.
|
|
13
|
+
* @param {Record<string, StoreModule>} [options.namespaces={}] - Namespaced modules for organizing store.
|
|
14
|
+
* @param {StorePersistenceOptions} [options.persistence] - Persistence configuration.
|
|
15
|
+
* @param {boolean} [options.persistence.enabled=false] - Enable state persistence.
|
|
16
|
+
* @param {string} [options.persistence.key="eleva-store"] - Storage key.
|
|
17
|
+
* @param {'localStorage' | 'sessionStorage'} [options.persistence.storage="localStorage"] - Storage type.
|
|
18
|
+
* @param {string[]} [options.persistence.include] - Dot-path prefixes to persist (e.g., "auth.user")
|
|
19
|
+
* @param {string[]} [options.persistence.exclude] - Dot-path prefixes to exclude (applies when include is empty).
|
|
20
|
+
* @param {boolean} [options.devTools=false] - Enable development tools integration.
|
|
21
|
+
* @param {(error: Error, context: string) => void} [options.onError=null] - Error handler function.
|
|
22
|
+
* @returns {void}
|
|
23
|
+
* @description
|
|
24
|
+
* Installs the store and injects `store` into component setup context by wrapping
|
|
25
|
+
* `eleva.mount` and `eleva._mountComponents`. Also exposes `eleva.store` and
|
|
26
|
+
* helper methods (`eleva.dispatch`, `eleva.getState`, `eleva.subscribe`, `eleva.createAction`).
|
|
27
|
+
* Uninstall restores the originals.
|
|
21
28
|
*
|
|
22
29
|
* @example
|
|
23
30
|
* // Basic installation
|
|
@@ -37,12 +44,12 @@ export namespace StorePlugin {
|
|
|
37
44
|
* state: { user: null, token: null },
|
|
38
45
|
* actions: {
|
|
39
46
|
* login: (state, { user, token }) => {
|
|
40
|
-
* state.user.value = user;
|
|
41
|
-
* state.token.value = token;
|
|
47
|
+
* state.auth.user.value = user;
|
|
48
|
+
* state.auth.token.value = token;
|
|
42
49
|
* },
|
|
43
50
|
* logout: (state) => {
|
|
44
|
-
* state.user.value = null;
|
|
45
|
-
* state.token.value = null;
|
|
51
|
+
* state.auth.user.value = null;
|
|
52
|
+
* state.auth.token.value = null;
|
|
46
53
|
* }
|
|
47
54
|
* }
|
|
48
55
|
* }
|
|
@@ -53,35 +60,202 @@ export namespace StorePlugin {
|
|
|
53
60
|
* }
|
|
54
61
|
* });
|
|
55
62
|
*/
|
|
56
|
-
function install(eleva:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
namespaces?: Object | undefined;
|
|
60
|
-
persistence?: {
|
|
61
|
-
enabled?: boolean | undefined;
|
|
62
|
-
key?: string | undefined;
|
|
63
|
-
storage?: "localStorage" | "sessionStorage" | undefined;
|
|
64
|
-
include?: string[] | undefined;
|
|
65
|
-
exclude?: string[] | undefined;
|
|
66
|
-
} | undefined;
|
|
67
|
-
devTools?: boolean | undefined;
|
|
68
|
-
onError?: Function | undefined;
|
|
69
|
-
}): void;
|
|
70
|
-
/**
|
|
71
|
-
* Uninstalls the plugin from the Eleva instance
|
|
72
|
-
*
|
|
73
|
-
* @param {Object} eleva - The Eleva instance
|
|
63
|
+
function install(eleva: Eleva, options?: StoreOptions): void;
|
|
64
|
+
/**
|
|
65
|
+
* Uninstalls the plugin from the Eleva instance.
|
|
74
66
|
*
|
|
67
|
+
* @public
|
|
68
|
+
* @param {Eleva} eleva - The Eleva instance.
|
|
69
|
+
* @returns {void}
|
|
75
70
|
* @description
|
|
76
71
|
* Restores the original Eleva methods and removes all plugin-specific
|
|
77
72
|
* functionality. This method should be called when the plugin is no
|
|
78
73
|
* longer needed.
|
|
74
|
+
* Also removes `eleva.store` and top-level helpers (`eleva.dispatch`,
|
|
75
|
+
* `eleva.getState`, `eleva.subscribe`, `eleva.createAction`).
|
|
79
76
|
*
|
|
80
77
|
* @example
|
|
81
78
|
* // Uninstall the plugin
|
|
82
79
|
* StorePlugin.uninstall(app);
|
|
83
80
|
*/
|
|
84
|
-
function uninstall(eleva:
|
|
81
|
+
function uninstall(eleva: Eleva): void;
|
|
85
82
|
}
|
|
86
83
|
export { StorePlugin as Store };
|
|
84
|
+
/**
|
|
85
|
+
* Type imports from the Eleva core library.
|
|
86
|
+
*/
|
|
87
|
+
export type Eleva = import("eleva").Eleva;
|
|
88
|
+
/**
|
|
89
|
+
* Type imports from the Eleva core library.
|
|
90
|
+
*/
|
|
91
|
+
export type ComponentDefinition = import("eleva").ComponentDefinition;
|
|
92
|
+
/**
|
|
93
|
+
* Type imports from the Eleva core library.
|
|
94
|
+
*/
|
|
95
|
+
export type ComponentContext = import("eleva").ComponentContext;
|
|
96
|
+
/**
|
|
97
|
+
* Type imports from the Eleva core library.
|
|
98
|
+
*/
|
|
99
|
+
export type SetupResult = import("eleva").SetupResult;
|
|
100
|
+
/**
|
|
101
|
+
* Type imports from the Eleva core library.
|
|
102
|
+
*/
|
|
103
|
+
export type ComponentProps = import("eleva").ComponentProps;
|
|
104
|
+
/**
|
|
105
|
+
* Type imports from the Eleva core library.
|
|
106
|
+
*/
|
|
107
|
+
export type ChildrenMap = import("eleva").ChildrenMap;
|
|
108
|
+
/**
|
|
109
|
+
* Type imports from the Eleva core library.
|
|
110
|
+
*/
|
|
111
|
+
export type MountResult = import("eleva").MountResult;
|
|
112
|
+
/**
|
|
113
|
+
* Generic type import.
|
|
114
|
+
*/
|
|
115
|
+
export type Signal<T> = import("eleva").Signal<T>;
|
|
116
|
+
/**
|
|
117
|
+
* Mutation record emitted to subscribers.
|
|
118
|
+
*/
|
|
119
|
+
export type StoreMutation = {
|
|
120
|
+
/**
|
|
121
|
+
* The action name that was dispatched.
|
|
122
|
+
*/
|
|
123
|
+
type: string;
|
|
124
|
+
/**
|
|
125
|
+
* The payload passed to the action.
|
|
126
|
+
*/
|
|
127
|
+
payload: unknown;
|
|
128
|
+
/**
|
|
129
|
+
* Unix timestamp of when the mutation occurred.
|
|
130
|
+
*/
|
|
131
|
+
timestamp: number;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Store configuration options.
|
|
135
|
+
*/
|
|
136
|
+
export type StoreOptions = {
|
|
137
|
+
/**
|
|
138
|
+
* Initial state object.
|
|
139
|
+
*/
|
|
140
|
+
state?: Record<string, unknown> | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Action functions for state mutations.
|
|
143
|
+
*/
|
|
144
|
+
actions?: Record<string, ActionFunction> | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Namespaced modules for organizing store.
|
|
147
|
+
*/
|
|
148
|
+
namespaces?: Record<string, StoreModule> | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Persistence configuration.
|
|
151
|
+
*/
|
|
152
|
+
persistence?: StorePersistenceOptions | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Enable development tools integration.
|
|
155
|
+
*/
|
|
156
|
+
devTools?: boolean | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* Error handler function.
|
|
159
|
+
*/
|
|
160
|
+
onError?: StoreErrorHandler | undefined;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Namespaced store module definition.
|
|
164
|
+
*/
|
|
165
|
+
export type StoreModule = {
|
|
166
|
+
/**
|
|
167
|
+
* Module state.
|
|
168
|
+
*/
|
|
169
|
+
state: Record<string, unknown>;
|
|
170
|
+
/**
|
|
171
|
+
* Module actions.
|
|
172
|
+
*/
|
|
173
|
+
actions?: Record<string, ActionFunction> | undefined;
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Store persistence configuration.
|
|
177
|
+
*/
|
|
178
|
+
export type StorePersistenceOptions = {
|
|
179
|
+
/**
|
|
180
|
+
* Enable state persistence.
|
|
181
|
+
*/
|
|
182
|
+
enabled?: boolean | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Storage key (default: "eleva-store").
|
|
185
|
+
*/
|
|
186
|
+
key?: string | undefined;
|
|
187
|
+
/**
|
|
188
|
+
* Storage type.
|
|
189
|
+
*/
|
|
190
|
+
storage?: "localStorage" | "sessionStorage" | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Dot-path prefixes to persist (e.g., "auth.user").
|
|
193
|
+
*/
|
|
194
|
+
include?: string[] | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Dot-path prefixes to exclude.
|
|
197
|
+
*/
|
|
198
|
+
exclude?: string[] | undefined;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Store error handler callback.
|
|
202
|
+
*/
|
|
203
|
+
export type StoreErrorHandler = (error: Error, context: string) => void;
|
|
204
|
+
/**
|
|
205
|
+
* Reactive state tree containing signals and nested namespaces.
|
|
206
|
+
*/
|
|
207
|
+
export type StoreState = Record<string, Signal<unknown> | Record<string, unknown>>;
|
|
208
|
+
/**
|
|
209
|
+
* Action function signature for store actions.
|
|
210
|
+
*/
|
|
211
|
+
export type ActionFunction = (state: StoreState, payload?: unknown) => unknown;
|
|
212
|
+
/**
|
|
213
|
+
* Dispatch function signature for triggering actions.
|
|
214
|
+
*/
|
|
215
|
+
export type DispatchFunction = (actionName: string, payload?: unknown) => Promise<unknown>;
|
|
216
|
+
/**
|
|
217
|
+
* Subscribe callback signature for mutation listeners.
|
|
218
|
+
*/
|
|
219
|
+
export type SubscribeCallback = (mutation: StoreMutation, state: StoreState) => void;
|
|
220
|
+
/**
|
|
221
|
+
* Store API exposed to components via ctx.store.
|
|
222
|
+
*/
|
|
223
|
+
export type StoreApi = {
|
|
224
|
+
/**
|
|
225
|
+
* Reactive state signals (supports nested modules).
|
|
226
|
+
*/
|
|
227
|
+
state: StoreState;
|
|
228
|
+
/**
|
|
229
|
+
* Dispatch an action by name with optional payload.
|
|
230
|
+
*/
|
|
231
|
+
dispatch: DispatchFunction;
|
|
232
|
+
/**
|
|
233
|
+
* Subscribe to state mutations. Returns unsubscribe function.
|
|
234
|
+
*/
|
|
235
|
+
subscribe: (callback: SubscribeCallback) => () => void;
|
|
236
|
+
/**
|
|
237
|
+
* Get a snapshot of current state values.
|
|
238
|
+
*/
|
|
239
|
+
getState: () => Record<string, unknown>;
|
|
240
|
+
/**
|
|
241
|
+
* Register a namespaced module dynamically.
|
|
242
|
+
*/
|
|
243
|
+
registerModule: (namespace: string, module: StoreModule) => void;
|
|
244
|
+
/**
|
|
245
|
+
* Unregister a namespaced module.
|
|
246
|
+
*/
|
|
247
|
+
unregisterModule: (namespace: string) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Create a new state signal dynamically.
|
|
250
|
+
*/
|
|
251
|
+
createState: (key: string, initialValue: unknown) => Signal<unknown>;
|
|
252
|
+
/**
|
|
253
|
+
* Register a new action dynamically.
|
|
254
|
+
*/
|
|
255
|
+
createAction: (name: string, actionFn: ActionFunction) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Signal class constructor for manual state creation.
|
|
258
|
+
*/
|
|
259
|
+
signal: new <T>(value: T) => Signal<T>;
|
|
260
|
+
};
|
|
87
261
|
//# sourceMappingURL=Store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../src/plugins/Store.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../src/plugins/Store.js"],"names":[],"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