@alexandregme/zljs 1.18.0 → 1.18.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.
- package/CHANGELOG.md +16 -1
- package/dist/{chunk-BYW2ZJKS.js → chunk-KPSFYQYV.js} +58 -35
- package/dist/index.js +12 -4
- package/dist/next/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,20 @@ A change that needs action in an app has a **Migration** note. When updating, re
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [1.18.1] - 2026-11-02
|
|
12
|
+
|
|
13
|
+
### Removed
|
|
14
|
+
|
|
15
|
+
- Parameters in the hash, in `splitURLasPath` and the `query` of `useRouterStore`: `/orders#id=7` now returns `{}`
|
|
16
|
+
|
|
17
|
+
#### Migration
|
|
18
|
+
|
|
19
|
+
Search the app for `splitURLasPath` and `setRoute`. A URL with its parameters after `#` now reads them from `window.location.hash`.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `splitURLasPath` and the `query` of `useRouterStore` lost the query when the URL also had a hash: `/orders?id=7#top` returned `{ top: "" }` and now returns `{ id: "7" }`
|
|
24
|
+
|
|
11
25
|
## [1.18.0] - 2026-11-02
|
|
12
26
|
|
|
13
27
|
### Added
|
|
@@ -249,7 +263,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
|
|
|
249
263
|
|
|
250
264
|
The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
|
|
251
265
|
|
|
252
|
-
[Unreleased]: https://github.com/alexandregme/zljs/compare/v1.18.
|
|
266
|
+
[Unreleased]: https://github.com/alexandregme/zljs/compare/v1.18.1...HEAD
|
|
267
|
+
[1.18.1]: https://github.com/alexandregme/zljs/compare/v1.18.0...v1.18.1
|
|
253
268
|
[1.18.0]: https://github.com/alexandregme/zljs/compare/v1.17.0...v1.18.0
|
|
254
269
|
[1.17.0]: https://github.com/alexandregme/zljs/compare/v1.16.0...v1.17.0
|
|
255
270
|
[1.16.0]: https://github.com/alexandregme/zljs/compare/v1.15.0...v1.16.0
|
|
@@ -124,14 +124,22 @@ var Heading = ({ children, level = 1, color }) => {
|
|
|
124
124
|
return /* @__PURE__ */ jsx3(Tag, { className: heading({ level, color }), children });
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
// core/state/toast/toast.store.ts
|
|
127
|
+
// core/state/zustand/toast/toast.store.ts
|
|
128
128
|
import { create } from "zustand";
|
|
129
129
|
import { devtools } from "zustand/middleware";
|
|
130
|
+
|
|
131
|
+
// core/state/zustand/toast/toast.const.ts
|
|
132
|
+
var toastInitialState = {
|
|
133
|
+
toasts: []
|
|
134
|
+
};
|
|
135
|
+
var toastDevtools = { name: "zljs", store: "toast" };
|
|
136
|
+
|
|
137
|
+
// core/state/zustand/toast/toast.store.ts
|
|
130
138
|
var toastId = 0;
|
|
131
139
|
var useToastStore = create()(
|
|
132
140
|
devtools(
|
|
133
141
|
(set, get) => ({
|
|
134
|
-
|
|
142
|
+
...toastInitialState,
|
|
135
143
|
addToast: (message, type = "error") => {
|
|
136
144
|
const id = ++toastId;
|
|
137
145
|
set(
|
|
@@ -151,7 +159,7 @@ var useToastStore = create()(
|
|
|
151
159
|
info: (message) => get().addToast(message, "info"),
|
|
152
160
|
warning: (message) => get().addToast(message, "warning")
|
|
153
161
|
}),
|
|
154
|
-
|
|
162
|
+
toastDevtools
|
|
155
163
|
)
|
|
156
164
|
);
|
|
157
165
|
|
|
@@ -187,14 +195,22 @@ var Toaster = () => {
|
|
|
187
195
|
// core/toaster/index.ts
|
|
188
196
|
import { toast as toast2 } from "sonner";
|
|
189
197
|
|
|
190
|
-
// core/state/app/app.store.ts
|
|
198
|
+
// core/state/zustand/app/app.store.ts
|
|
191
199
|
import { create as create2 } from "zustand";
|
|
192
200
|
import { devtools as devtools2 } from "zustand/middleware";
|
|
201
|
+
|
|
202
|
+
// core/state/zustand/app/app.const.ts
|
|
203
|
+
var appInitialState = {
|
|
204
|
+
fetchingCalls: 0,
|
|
205
|
+
fetching: false
|
|
206
|
+
};
|
|
207
|
+
var appDevtools = { name: "zljs", store: "app" };
|
|
208
|
+
|
|
209
|
+
// core/state/zustand/app/app.store.ts
|
|
193
210
|
var useAppStore = create2()(
|
|
194
211
|
devtools2(
|
|
195
212
|
(set) => ({
|
|
196
|
-
|
|
197
|
-
fetching: false,
|
|
213
|
+
...appInitialState,
|
|
198
214
|
startFetching: () => set(
|
|
199
215
|
(s) => {
|
|
200
216
|
const fetchingCalls = s.fetchingCalls + 1;
|
|
@@ -212,15 +228,15 @@ var useAppStore = create2()(
|
|
|
212
228
|
"finishFetching"
|
|
213
229
|
)
|
|
214
230
|
}),
|
|
215
|
-
|
|
231
|
+
appDevtools
|
|
216
232
|
)
|
|
217
233
|
);
|
|
218
234
|
|
|
219
|
-
// core/redux/redux-provider/redux-provider.tsx
|
|
235
|
+
// core/state/redux/redux-provider/redux-provider.tsx
|
|
220
236
|
import { useState } from "react";
|
|
221
237
|
import { Provider } from "react-redux";
|
|
222
238
|
|
|
223
|
-
// core/redux/store/store.ts
|
|
239
|
+
// core/state/redux/store/store.ts
|
|
224
240
|
import {
|
|
225
241
|
combineReducers,
|
|
226
242
|
configureStore
|
|
@@ -249,7 +265,7 @@ var createReduxStore = ({
|
|
|
249
265
|
return store;
|
|
250
266
|
};
|
|
251
267
|
|
|
252
|
-
// core/redux/redux-provider/redux-provider.tsx
|
|
268
|
+
// core/state/redux/redux-provider/redux-provider.tsx
|
|
253
269
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
254
270
|
var ReduxProvider = ({
|
|
255
271
|
children,
|
|
@@ -269,53 +285,60 @@ var ReduxProvider = ({
|
|
|
269
285
|
return /* @__PURE__ */ jsx5(Provider, { store, children });
|
|
270
286
|
};
|
|
271
287
|
|
|
272
|
-
// core/state/router/router.utils.ts
|
|
288
|
+
// core/state/zustand/router/router.utils.ts
|
|
273
289
|
var splitURLasPath = (urlAsPath) => {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const [, query] = urlAsPath.split("?");
|
|
277
|
-
queryWithoutPath = query ?? "";
|
|
278
|
-
}
|
|
279
|
-
if (urlAsPath?.indexOf("#") >= 0) {
|
|
280
|
-
const [, query] = urlAsPath.split("#");
|
|
281
|
-
queryWithoutPath = query ?? "";
|
|
282
|
-
}
|
|
290
|
+
const [pathAndQuery = ""] = urlAsPath?.split("#") ?? [];
|
|
291
|
+
const [, query = ""] = pathAndQuery.split("?");
|
|
283
292
|
const parametersAsObject = {};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
});
|
|
291
|
-
}
|
|
293
|
+
query.split("&").forEach((p) => {
|
|
294
|
+
const [parameter, value] = p.split("=");
|
|
295
|
+
if (parameter) {
|
|
296
|
+
parametersAsObject[parameter] = value ?? "";
|
|
297
|
+
}
|
|
298
|
+
});
|
|
292
299
|
return parametersAsObject;
|
|
293
300
|
};
|
|
294
301
|
|
|
295
|
-
// core/state/router/router.store.ts
|
|
302
|
+
// core/state/zustand/router/router.store.ts
|
|
296
303
|
import { create as create3 } from "zustand";
|
|
297
304
|
import { devtools as devtools3 } from "zustand/middleware";
|
|
305
|
+
|
|
306
|
+
// core/state/zustand/router/router.const.ts
|
|
307
|
+
var routerInitialState = {
|
|
308
|
+
urlAsPath: "/",
|
|
309
|
+
query: {}
|
|
310
|
+
};
|
|
311
|
+
var routerDevtools = { name: "zljs", store: "router" };
|
|
312
|
+
|
|
313
|
+
// core/state/zustand/router/router.store.ts
|
|
298
314
|
var useRouterStore = create3()(
|
|
299
315
|
devtools3(
|
|
300
316
|
(set) => ({
|
|
301
|
-
|
|
302
|
-
query: {},
|
|
317
|
+
...routerInitialState,
|
|
303
318
|
setRoute: (urlAsPath) => set({ urlAsPath, query: splitURLasPath(urlAsPath) }, false, "setRoute")
|
|
304
319
|
}),
|
|
305
|
-
|
|
320
|
+
routerDevtools
|
|
306
321
|
)
|
|
307
322
|
);
|
|
308
323
|
|
|
309
|
-
// core/state/page/page.store.ts
|
|
324
|
+
// core/state/zustand/page/page.store.ts
|
|
310
325
|
import { create as create4 } from "zustand";
|
|
311
326
|
import { devtools as devtools4 } from "zustand/middleware";
|
|
327
|
+
|
|
328
|
+
// core/state/zustand/page/page.const.ts
|
|
329
|
+
var pageInitialState = {
|
|
330
|
+
title: ""
|
|
331
|
+
};
|
|
332
|
+
var pageDevtools = { name: "zljs", store: "page" };
|
|
333
|
+
|
|
334
|
+
// core/state/zustand/page/page.store.ts
|
|
312
335
|
var usePageStore = create4()(
|
|
313
336
|
devtools4(
|
|
314
337
|
(set) => ({
|
|
315
|
-
|
|
338
|
+
...pageInitialState,
|
|
316
339
|
setTitle: (title) => set({ title }, false, "setTitle")
|
|
317
340
|
}),
|
|
318
|
-
|
|
341
|
+
pageDevtools
|
|
319
342
|
)
|
|
320
343
|
);
|
|
321
344
|
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
usePageStore,
|
|
13
13
|
useRouterStore,
|
|
14
14
|
useToastStore
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KPSFYQYV.js";
|
|
16
16
|
import {
|
|
17
17
|
Error,
|
|
18
18
|
FormInput,
|
|
@@ -977,13 +977,21 @@ var Sidebar = ({
|
|
|
977
977
|
// core/index.ts
|
|
978
978
|
import { toast } from "sonner";
|
|
979
979
|
|
|
980
|
-
// core/state/modal/modal.store.ts
|
|
980
|
+
// core/state/zustand/modal/modal.store.ts
|
|
981
981
|
import { create } from "zustand";
|
|
982
982
|
import { devtools } from "zustand/middleware";
|
|
983
|
+
|
|
984
|
+
// core/state/zustand/modal/modal.const.ts
|
|
985
|
+
var modalInitialState = {
|
|
986
|
+
modals: []
|
|
987
|
+
};
|
|
988
|
+
var modalDevtools = { name: "zljs", store: "modal" };
|
|
989
|
+
|
|
990
|
+
// core/state/zustand/modal/modal.store.ts
|
|
983
991
|
var useModalStore = create()(
|
|
984
992
|
devtools(
|
|
985
993
|
(set, get) => ({
|
|
986
|
-
|
|
994
|
+
...modalInitialState,
|
|
987
995
|
openModal: (name) => set((s) => ({ modals: [...s.modals, { name }] }), false, "openModal"),
|
|
988
996
|
openModalWithPayload: (name, payload) => set(
|
|
989
997
|
(s) => ({ modals: [...s.modals, { name, payload }] }),
|
|
@@ -998,7 +1006,7 @@ var useModalStore = create()(
|
|
|
998
1006
|
isOpen: (name) => get().modals.some((m) => m.name === name),
|
|
999
1007
|
getPayload: (name) => get().modals.find((m) => m.name === name)?.payload
|
|
1000
1008
|
}),
|
|
1001
|
-
|
|
1009
|
+
modalDevtools
|
|
1002
1010
|
)
|
|
1003
1011
|
);
|
|
1004
1012
|
|
package/dist/next/index.js
CHANGED