@plurid/plurid-ui-state-react 0.0.0-4 → 0.0.0-7

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 (42) hide show
  1. package/distribution/data/interfaces/index.d.ts +15 -0
  2. package/distribution/index.d.ts +1 -0
  3. package/distribution/index.es.js +161 -264
  4. package/distribution/index.es.js.map +1 -1
  5. package/distribution/index.js +164 -267
  6. package/distribution/index.js.map +1 -1
  7. package/distribution/modules/head/index.d.ts +29 -6
  8. package/distribution/modules/notifications/index.d.ts +27 -6
  9. package/distribution/modules/shortcuts/index.d.ts +23 -6
  10. package/distribution/modules/sitting/index.d.ts +37 -6
  11. package/distribution/modules/themes/index.d.ts +33 -6
  12. package/package.json +9 -6
  13. package/distribution/modules/head/actions/index.d.ts +0 -5
  14. package/distribution/modules/head/initial/index.d.ts +0 -3
  15. package/distribution/modules/head/reducer/index.d.ts +0 -4
  16. package/distribution/modules/head/resolvers/index.d.ts +0 -5
  17. package/distribution/modules/head/selectors/index.d.ts +0 -6
  18. package/distribution/modules/head/types/index.d.ts +0 -21
  19. package/distribution/modules/notifications/actions/index.d.ts +0 -7
  20. package/distribution/modules/notifications/initial/index.d.ts +0 -3
  21. package/distribution/modules/notifications/reducer/index.d.ts +0 -3
  22. package/distribution/modules/notifications/resolvers/index.d.ts +0 -7
  23. package/distribution/modules/notifications/selectors/index.d.ts +0 -6
  24. package/distribution/modules/notifications/types/index.d.ts +0 -32
  25. package/distribution/modules/shortcuts/actions/index.d.ts +0 -5
  26. package/distribution/modules/shortcuts/initial/index.d.ts +0 -3
  27. package/distribution/modules/shortcuts/reducer/index.d.ts +0 -3
  28. package/distribution/modules/shortcuts/resolvers/index.d.ts +0 -7
  29. package/distribution/modules/shortcuts/selectors/index.d.ts +0 -6
  30. package/distribution/modules/shortcuts/types/index.d.ts +0 -9
  31. package/distribution/modules/sitting/actions/index.d.ts +0 -6
  32. package/distribution/modules/sitting/initial/index.d.ts +0 -3
  33. package/distribution/modules/sitting/reducer/index.d.ts +0 -4
  34. package/distribution/modules/sitting/resolvers/index.d.ts +0 -6
  35. package/distribution/modules/sitting/selectors/index.d.ts +0 -7
  36. package/distribution/modules/sitting/types/index.d.ts +0 -15
  37. package/distribution/modules/themes/actions/index.d.ts +0 -5
  38. package/distribution/modules/themes/initial/index.d.ts +0 -3
  39. package/distribution/modules/themes/reducer/index.d.ts +0 -4
  40. package/distribution/modules/themes/resolvers/index.d.ts +0 -5
  41. package/distribution/modules/themes/selectors/index.d.ts +0 -7
  42. package/distribution/modules/themes/types/index.d.ts +0 -15
@@ -1,3 +1,18 @@
1
+ import { ActionCreatorWithPayload, ActionCreatorWithoutPayload } from '@reduxjs/toolkit';
1
2
  export interface StateOfAny {
2
3
  [key: string]: any;
3
4
  }
5
+ export declare type StateWithSlice<Key extends string, State = any> = StateOfAny & Record<Key, State>;
6
+ export declare type DispatchAction<A> = A extends ActionCreatorWithPayload<infer P, infer T> ? P extends void ? () => ReturnType<ActionCreatorWithoutPayload<T>> : (payload: P) => ReturnType<ActionCreatorWithPayload<P, T>> : A extends ActionCreatorWithoutPayload<infer T> ? () => ReturnType<ActionCreatorWithoutPayload<T>> : void;
7
+ export declare type DispatchActionWithoutPayload<A> = A extends ActionCreatorWithoutPayload<infer T> ? () => ReturnType<ActionCreatorWithoutPayload<T>> : void;
8
+ export interface Notification {
9
+ id: string;
10
+ text: string;
11
+ html?: boolean;
12
+ react?: boolean;
13
+ timeout?: number;
14
+ wordBreak?: boolean;
15
+ }
16
+ export declare type AddNotificationPayload = Partial<Notification> & {
17
+ text: string;
18
+ };
@@ -1,2 +1,3 @@
1
+ import 'immer';
1
2
  export * from './data/interfaces';
2
3
  export * from './modules';
@@ -1,20 +1,8 @@
1
- import { plurid } from "@plurid/plurid-themes";
2
-
3
- const SET_HEAD = "SET_HEAD";
4
-
5
- var index$9 = Object.freeze({
6
- __proto__: null,
7
- SET_HEAD: SET_HEAD
8
- });
1
+ import "immer";
9
2
 
10
- const setHead$1 = payload => ({
11
- type: SET_HEAD,
12
- payload: payload
13
- });
3
+ import { createSlice } from "@reduxjs/toolkit";
14
4
 
15
- const actions$4 = {
16
- setHead: setHead$1
17
- };
5
+ import { plurid } from "@plurid/plurid-themes";
18
6
 
19
7
  const initialState$4 = {
20
8
  title: "",
@@ -28,128 +16,94 @@ const initialState$4 = {
28
16
  scripts: []
29
17
  };
30
18
 
31
- const setHead = (state, action) => Object.assign(Object.assign({}, state), action.payload);
19
+ const name$4 = "head";
32
20
 
33
- const resolvers$4 = {
34
- setHead: setHead
35
- };
36
-
37
- const reducer$4 = (state = initialState$4, action) => {
38
- switch (action.type) {
39
- case SET_HEAD:
40
- return resolvers$4.setHead(state, action);
41
-
42
- default:
43
- return Object.assign({}, state);
21
+ const factory$4 = (state = initialState$4) => createSlice({
22
+ name: name$4,
23
+ initialState: state,
24
+ reducers: {
25
+ setHead: (state, action) => {
26
+ state = Object.assign(Object.assign({}, state), action);
27
+ }
44
28
  }
45
- };
29
+ });
46
30
 
47
- const metareducer$2 = initialState => (state = initialState, action) => reducer$4(state, action);
31
+ const slice$4 = factory$4();
48
32
 
49
- const getHeadData = state => state.head;
33
+ const actions$4 = slice$4.actions;
34
+
35
+ const getHead = state => state.head;
50
36
 
51
37
  const selectors$4 = {
52
- getHeadData: getHeadData
38
+ getHead: getHead
53
39
  };
54
40
 
55
- var index$8 = Object.freeze({
41
+ const reducer$4 = slice$4.reducer;
42
+
43
+ var index$4 = Object.freeze({
56
44
  __proto__: null,
57
- actions: actions$4,
58
45
  initialState: initialState$4,
59
- reducer: reducer$4,
60
- metareducer: metareducer$2,
46
+ name: name$4,
47
+ factory: factory$4,
48
+ slice: slice$4,
49
+ actions: actions$4,
50
+ getHead: getHead,
61
51
  selectors: selectors$4,
62
- Types: index$9
63
- });
64
-
65
- const ADD_NOTIFICATION = "ADD_NOTIFICATION";
66
-
67
- const UPDATE_NOTIFICATION = "UPDATE_NOTIFICATION";
68
-
69
- const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
70
-
71
- var index$7 = Object.freeze({
72
- __proto__: null,
73
- ADD_NOTIFICATION: ADD_NOTIFICATION,
74
- UPDATE_NOTIFICATION: UPDATE_NOTIFICATION,
75
- REMOVE_NOTIFICATION: REMOVE_NOTIFICATION
76
- });
77
-
78
- const addNotification$1 = payload => ({
79
- type: ADD_NOTIFICATION,
80
- payload: payload
81
- });
82
-
83
- const updateNotification$1 = payload => ({
84
- type: UPDATE_NOTIFICATION,
85
- payload: payload
86
- });
87
-
88
- const removeNotification$1 = payload => ({
89
- type: REMOVE_NOTIFICATION,
90
- payload: payload
52
+ reducer: reducer$4
91
53
  });
92
54
 
93
- const actions$3 = {
94
- addNotification: addNotification$1,
95
- updateNotification: updateNotification$1,
96
- removeNotification: removeNotification$1
97
- };
98
-
99
55
  const initialState$3 = [];
100
56
 
101
- const addNotification = (state, action) => {
102
- const newNotification = Object.assign({}, action.payload);
103
- const existingNotification = state.find((notification => notification.id === newNotification.id));
104
- if (existingNotification) {
105
- const newState = state.map((notification => {
106
- if (notification.id === newNotification.id) {
107
- return newNotification;
57
+ const name$3 = "notifications";
58
+
59
+ const factory$3 = (state = initialState$3) => createSlice({
60
+ name: name$3,
61
+ initialState: state,
62
+ reducers: {
63
+ new: (state, action) => {
64
+ const id = Math.random() + "";
65
+ const text = action.payload;
66
+ const newNotification = {
67
+ id: id,
68
+ text: text
69
+ };
70
+ state = [ ...state, newNotification ];
71
+ },
72
+ add: (state, action) => {
73
+ const id = action.payload.id || Math.random() + "";
74
+ const newNotification = Object.assign(Object.assign({}, action.payload), {
75
+ id: id
76
+ });
77
+ const existingNotification = state.find((notification => notification.id === newNotification.id));
78
+ if (existingNotification) {
79
+ state = state.map((notification => {
80
+ if (notification.id === newNotification.id) {
81
+ return newNotification;
82
+ }
83
+ return notification;
84
+ }));
85
+ return;
108
86
  }
109
- return notification;
110
- }));
111
- return newState;
112
- }
113
- return [ ...state, newNotification ];
114
- };
115
-
116
- const updateNotification = (state, action) => {
117
- const updatedState = state.map((notification => {
118
- if (notification.id === action.payload.id) {
119
- const newNotification = Object.assign({}, action.payload);
120
- return newNotification;
87
+ state = [ ...state, newNotification ];
88
+ },
89
+ update: (state, action) => {
90
+ state = state.map((message => {
91
+ if (message.id === action.payload.id) {
92
+ const newNotification = Object.assign({}, action.payload);
93
+ return newNotification;
94
+ }
95
+ return Object.assign({}, message);
96
+ }));
97
+ },
98
+ remove: (state, action) => {
99
+ state = state.filter((message => message.id !== action.payload));
121
100
  }
122
- return Object.assign({}, notification);
123
- }));
124
- return [ ...updatedState ];
125
- };
126
-
127
- const removeNotification = (state, action) => {
128
- const updatedState = state.filter((notification => notification.id !== action.payload.id));
129
- return [ ...updatedState ];
130
- };
131
-
132
- const resolvers$3 = {
133
- addNotification: addNotification,
134
- updateNotification: updateNotification,
135
- removeNotification: removeNotification
136
- };
137
-
138
- const reducer$3 = (state = initialState$3, action) => {
139
- switch (action.type) {
140
- case ADD_NOTIFICATION:
141
- return resolvers$3.addNotification(state, action);
142
-
143
- case UPDATE_NOTIFICATION:
144
- return resolvers$3.updateNotification(state, action);
101
+ }
102
+ });
145
103
 
146
- case REMOVE_NOTIFICATION:
147
- return resolvers$3.removeNotification(state, action);
104
+ const slice$3 = factory$3();
148
105
 
149
- default:
150
- return [ ...state ];
151
- }
152
- };
106
+ const actions$3 = slice$3.actions;
153
107
 
154
108
  const getAll = state => state.notifications;
155
109
 
@@ -157,55 +111,41 @@ const selectors$3 = {
157
111
  getAll: getAll
158
112
  };
159
113
 
160
- var index$6 = Object.freeze({
114
+ const reducer$3 = slice$3.reducer;
115
+
116
+ var index$3 = Object.freeze({
161
117
  __proto__: null,
162
- actions: actions$3,
163
118
  initialState: initialState$3,
164
- reducer: reducer$3,
119
+ name: name$3,
120
+ factory: factory$3,
121
+ slice: slice$3,
122
+ actions: actions$3,
165
123
  selectors: selectors$3,
166
- Types: index$7
124
+ reducer: reducer$3
167
125
  });
168
126
 
169
- const TOGGLE_GLOBAL_SHORTCUTS = "TOGGLE_GLOBAL_SHORTCUTS";
170
-
171
- var index$5 = Object.freeze({
172
- __proto__: null,
173
- TOGGLE_GLOBAL_SHORTCUTS: TOGGLE_GLOBAL_SHORTCUTS
174
- });
175
-
176
- const toggleGlobalShortcuts$1 = payload => ({
177
- type: TOGGLE_GLOBAL_SHORTCUTS,
178
- payload: payload
179
- });
180
-
181
- const actions$2 = {
182
- toggleGlobalShortcuts: toggleGlobalShortcuts$1
183
- };
184
-
185
127
  const initialState$2 = {
186
128
  global: true
187
129
  };
188
130
 
189
- const toggleGlobalShortcuts = (state, action) => {
190
- const global = action.payload ? action.payload : !state.global;
191
- return Object.assign(Object.assign({}, state), {
192
- global: global
193
- });
194
- };
195
-
196
- const resolvers$2 = {
197
- toggleGlobalShortcuts: toggleGlobalShortcuts
198
- };
131
+ const name$2 = "shortcuts";
132
+
133
+ const factory$2 = (state = initialState$2) => createSlice({
134
+ name: name$2,
135
+ initialState: state,
136
+ reducers: {
137
+ setGlobalShortcuts: (state, action) => {
138
+ state.global = action.payload;
139
+ },
140
+ toggleGlobalShortcuts: (state, _action) => {
141
+ state.global = !state.global;
142
+ }
143
+ }
144
+ });
199
145
 
200
- const reducer$2 = (state = initialState$2, action) => {
201
- switch (action.type) {
202
- case TOGGLE_GLOBAL_SHORTCUTS:
203
- return resolvers$2.toggleGlobalShortcuts(state, action);
146
+ const slice$2 = factory$2();
204
147
 
205
- default:
206
- return Object.assign({}, state);
207
- }
208
- };
148
+ const actions$2 = slice$2.actions;
209
149
 
210
150
  const getGlobal = state => state.shortcuts.global;
211
151
 
@@ -213,81 +153,48 @@ const selectors$2 = {
213
153
  getGlobal: getGlobal
214
154
  };
215
155
 
216
- var index$4 = Object.freeze({
156
+ const reducer$2 = slice$2.reducer;
157
+
158
+ var index$2 = Object.freeze({
217
159
  __proto__: null,
218
- actions: actions$2,
219
160
  initialState: initialState$2,
220
- reducer: reducer$2,
161
+ name: name$2,
162
+ factory: factory$2,
163
+ slice: slice$2,
164
+ actions: actions$2,
221
165
  selectors: selectors$2,
222
- Types: index$5
223
- });
224
-
225
- const SET_SITTING_CURRENT_LINK = "SET_SITTING_CURRENT_LINK";
226
-
227
- const TOGGLE_SITTING_TRAY = "TOGGLE_SITTING_TRAY";
228
-
229
- var index$3 = Object.freeze({
230
- __proto__: null,
231
- SET_SITTING_CURRENT_LINK: SET_SITTING_CURRENT_LINK,
232
- TOGGLE_SITTING_TRAY: TOGGLE_SITTING_TRAY
233
- });
234
-
235
- const setSittingCurrentLink$1 = link => ({
236
- type: SET_SITTING_CURRENT_LINK,
237
- payload: link
166
+ reducer: reducer$2
238
167
  });
239
168
 
240
- const toggleSittingTray$1 = () => ({
241
- type: TOGGLE_SITTING_TRAY
242
- });
243
-
244
- const actions$1 = {
245
- setSittingCurrentLink: setSittingCurrentLink$1,
246
- toggleSittingTray: toggleSittingTray$1
247
- };
248
-
249
169
  const initialState$1 = {
250
170
  currentLink: "",
251
171
  tray: false
252
172
  };
253
173
 
254
- const setSittingCurrentLink = (state, action) => {
255
- const currentLink = action.payload;
256
- return Object.assign(Object.assign({}, state), {
257
- currentLink: currentLink
258
- });
259
- };
260
-
261
- const toggleSittingTray = (state, action) => {
262
- if (typeof action.payload === "boolean") {
263
- return Object.assign(Object.assign({}, state), {
264
- tray: action.payload
265
- });
174
+ const name$1 = "sitting";
175
+
176
+ const factory$1 = (state = initialState$1) => createSlice({
177
+ name: name$1,
178
+ initialState: state,
179
+ reducers: {
180
+ setSittingCurrentLink: (state, action) => {
181
+ const currentLink = action.payload;
182
+ return Object.assign(Object.assign({}, state), {
183
+ currentLink: currentLink
184
+ });
185
+ },
186
+ setSittingTray: (state, action) => {
187
+ state.tray = action.payload;
188
+ },
189
+ toggleSittingTray: (state, _action) => {
190
+ state.tray = !state.tray;
191
+ }
266
192
  }
267
- return Object.assign(Object.assign({}, state), {
268
- tray: !state.tray
269
- });
270
- };
271
-
272
- const resolvers$1 = {
273
- setSittingCurrentLink: setSittingCurrentLink,
274
- toggleSittingTray: toggleSittingTray
275
- };
276
-
277
- const reducer$1 = (state = initialState$1, action) => {
278
- switch (action.type) {
279
- case SET_SITTING_CURRENT_LINK:
280
- return resolvers$1.setSittingCurrentLink(state, action);
281
-
282
- case TOGGLE_SITTING_TRAY:
283
- return resolvers$1.toggleSittingTray(state, action);
193
+ });
284
194
 
285
- default:
286
- return Object.assign({}, state);
287
- }
288
- };
195
+ const slice$1 = factory$1();
289
196
 
290
- const metareducer$1 = initialState => (state = initialState, action) => reducer$1(state, action);
197
+ const actions$1 = slice$1.actions;
291
198
 
292
199
  const getCurrentLink = state => state.sitting.currentLink;
293
200
 
@@ -298,59 +205,46 @@ const selectors$1 = {
298
205
  getTray: getTray
299
206
  };
300
207
 
301
- var index$2 = Object.freeze({
302
- __proto__: null,
303
- actions: actions$1,
304
- initialState: initialState$1,
305
- reducer: reducer$1,
306
- metareducer: metareducer$1,
307
- selectors: selectors$1,
308
- Types: index$3
309
- });
310
-
311
- const SET_THEME = "SET_THEME";
208
+ const reducer$1 = slice$1.reducer;
312
209
 
313
210
  var index$1 = Object.freeze({
314
211
  __proto__: null,
315
- SET_THEME: SET_THEME
316
- });
317
-
318
- const setTheme$1 = payload => ({
319
- type: SET_THEME,
320
- payload: payload
212
+ initialState: initialState$1,
213
+ name: name$1,
214
+ factory: factory$1,
215
+ slice: slice$1,
216
+ actions: actions$1,
217
+ selectors: selectors$1,
218
+ reducer: reducer$1
321
219
  });
322
220
 
323
- const actions = {
324
- setTheme: setTheme$1
325
- };
326
-
327
221
  const initialState = {
328
222
  general: Object.assign({}, plurid),
329
223
  interaction: Object.assign({}, plurid)
330
224
  };
331
225
 
332
- const setTheme = (state, action) => {
333
- const {type: type, theme: theme} = action.payload;
334
- const newState = Object.assign({}, state);
335
- newState[type] = Object.assign({}, theme);
336
- return newState;
337
- };
338
-
339
- const resolvers = {
340
- setTheme: setTheme
341
- };
342
-
343
- const reducer = (state = initialState, action) => {
344
- switch (action.type) {
345
- case SET_THEME:
346
- return resolvers.setTheme(state, action);
347
-
348
- default:
349
- return Object.assign({}, state);
226
+ const name = "themes";
227
+
228
+ const factory = (state = initialState) => createSlice({
229
+ name: name,
230
+ initialState: state,
231
+ reducers: {
232
+ setTheme: (state, action) => {
233
+ const {type: type, theme: theme} = action.payload;
234
+ state[type] = theme;
235
+ },
236
+ setGeneralTheme: (state, action) => {
237
+ state.general = action.payload;
238
+ },
239
+ setInteractionTheme: (state, action) => {
240
+ state.interaction = action.payload;
241
+ }
350
242
  }
351
- };
243
+ });
244
+
245
+ const slice = factory();
352
246
 
353
- const metareducer = initialState => (state = initialState, action) => reducer(state, action);
247
+ const actions = slice.actions;
354
248
 
355
249
  const getGeneralTheme = state => state.themes.general;
356
250
 
@@ -361,15 +255,18 @@ const selectors = {
361
255
  getInteractionTheme: getInteractionTheme
362
256
  };
363
257
 
258
+ const reducer = slice.reducer;
259
+
364
260
  var index = Object.freeze({
365
261
  __proto__: null,
366
- actions: actions,
367
262
  initialState: initialState,
368
- reducer: reducer,
369
- metareducer: metareducer,
263
+ name: name,
264
+ factory: factory,
265
+ slice: slice,
266
+ actions: actions,
370
267
  selectors: selectors,
371
- Types: index$1
268
+ reducer: reducer
372
269
  });
373
270
 
374
- export { index$8 as head, index$6 as notifications, index$4 as shortcuts, index$2 as sitting, index as themes };
271
+ export { index$4 as head, index$3 as notifications, index$2 as shortcuts, index$1 as sitting, index as themes };
375
272
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../source/modules/head/types/index.ts","../source/modules/head/actions/index.ts","../source/modules/head/initial/index.ts","../source/modules/head/resolvers/index.ts","../source/modules/head/reducer/index.ts","../source/modules/head/selectors/index.ts","../source/modules/notifications/types/index.ts","../source/modules/notifications/actions/index.ts","../source/modules/notifications/initial/index.ts","../source/modules/notifications/resolvers/index.ts","../source/modules/notifications/reducer/index.ts","../source/modules/notifications/selectors/index.ts","../source/modules/shortcuts/types/index.ts","../source/modules/shortcuts/actions/index.ts","../source/modules/shortcuts/initial/index.ts","../source/modules/shortcuts/resolvers/index.ts","../source/modules/shortcuts/reducer/index.ts","../source/modules/shortcuts/selectors/index.ts","../source/modules/sitting/types/index.ts","../source/modules/sitting/actions/index.ts","../source/modules/sitting/initial/index.ts","../source/modules/sitting/resolvers/index.ts","../source/modules/sitting/reducer/index.ts","../source/modules/sitting/selectors/index.ts","../source/modules/themes/types/index.ts","../source/modules/themes/actions/index.ts","../source/modules/themes/initial/index.ts","../source/modules/themes/resolvers/index.ts","../source/modules/themes/reducer/index.ts","../source/modules/themes/selectors/index.ts"],"sourcesContent":["// #region module\nexport interface Head {\n title: string;\n description: string;\n canonicalURL: string;\n ogTitle: string;\n ogImage: string;\n ogURL: string;\n ogDescription: string;\n styles: string[];\n scripts: string[];\n}\n\n\nexport const SET_HEAD = 'SET_HEAD';\nexport interface SetHeadPayload extends Partial<Head> {}\nexport interface SetHeadAction {\n type: typeof SET_HEAD;\n payload: SetHeadPayload;\n}\n\n\n\nexport interface State extends Head {}\n\n\nexport type Actions =\n | SetHeadAction;\n// #endregion module\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\n/**\n * Overwrite any property currently set in the `head`,\n * including `styles` and `scripts`, if any.\n *\n * @param payload\n */\nconst setHead = (\n payload: Types.SetHeadPayload,\n): Types.SetHeadAction => {\n return {\n type: Types.SET_HEAD,\n payload,\n };\n}\n\n\n\nconst actions = {\n setHead,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default actions;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst initialState: Types.State = {\n title: '',\n description: '',\n ogTitle: '',\n ogImage: '',\n ogURL: '',\n ogDescription: '',\n canonicalURL: '',\n styles: [],\n scripts: [],\n};\n// #endregion module\n\n\n\n// #region exports\nexport default initialState;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst setHead = (\n state: Types.State,\n action: Types.SetHeadAction,\n): Types.State => {\n return {\n ...state,\n ...action.payload,\n };\n}\n\n\n\nconst resolvers = {\n setHead,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default resolvers;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n\n import initialState from '../initial';\n\n import resolvers from '../resolvers';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst reducer = (\n state: Types.State = initialState,\n action: Types.Actions,\n): Types.State => {\n switch(action.type) {\n case Types.SET_HEAD:\n return resolvers.setHead(state, action);\n default:\n return {\n ...state,\n };\n }\n}\n\n\nconst metareducer = (\n initialState: Types.State,\n) => (\n state: Types.State = initialState,\n action: Types.Actions,\n) => reducer(\n state,\n action,\n);\n// #endregion module\n\n\n\n// #region exports\nexport {\n reducer,\n metareducer,\n};\n// #endregion exports\n","// #region imports\n // #region external\n import {\n StateOfAny,\n } from '#data/interfaces';\n\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst getHeadData = (\n state: StateOfAny & Record<'head', Types.State>,\n) => state.head;\n\n\n\nconst selectors = {\n getHeadData,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default selectors;\n// #endregion exports\n","// #region module\nexport interface Notification {\n id: string;\n text: string;\n html?: boolean;\n react?: boolean;\n timeout?: number;\n wordBreak?: boolean;\n}\n\n\nexport const ADD_NOTIFICATION = 'ADD_NOTIFICATION';\nexport interface AddNotificationPayload extends Notification {}\nexport interface AddNotificationAction {\n type: typeof ADD_NOTIFICATION;\n payload: AddNotificationPayload;\n}\n\n\nexport const UPDATE_NOTIFICATION = 'UPDATE_NOTIFICATION';\nexport interface UpdateNotificationPayload extends Notification {}\nexport interface UpdateNotificationAction {\n type: typeof UPDATE_NOTIFICATION;\n payload: UpdateNotificationPayload;\n}\n\n\nexport const REMOVE_NOTIFICATION = 'REMOVE_NOTIFICATION';\nexport interface RemoveNotificationPayload {\n id: string;\n}\nexport interface RemoveNotificationAction {\n type: typeof REMOVE_NOTIFICATION;\n payload: RemoveNotificationPayload;\n}\n\n\n\nexport type State = Notification[];\n\n\nexport type Actions = AddNotificationAction\n | UpdateNotificationAction\n | RemoveNotificationAction;\n// #endregion module\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst addNotification = (\n payload: Types.AddNotificationPayload,\n): Types.AddNotificationAction => {\n return {\n type: Types.ADD_NOTIFICATION,\n payload,\n };\n}\n\n\nconst updateNotification = (\n payload: Types.UpdateNotificationPayload,\n): Types.UpdateNotificationAction => {\n return {\n type: Types.UPDATE_NOTIFICATION,\n payload,\n };\n}\n\n\nconst removeNotification = (\n payload: Types.RemoveNotificationPayload,\n): Types.RemoveNotificationAction => {\n return {\n type: Types.REMOVE_NOTIFICATION,\n payload,\n };\n}\n\n\n\nconst actions = {\n addNotification,\n updateNotification,\n removeNotification,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default actions;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst initialState: Types.State = [];\n// #endregion module\n\n\n\n// #region exports\nexport default initialState;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst addNotification = (\n state: Types.State,\n action: Types.AddNotificationAction,\n): Types.State => {\n const newNotification: Types.Notification = {\n ...action.payload,\n };\n\n const existingNotification = state.find(\n notification => notification.id === newNotification.id,\n );\n\n if (existingNotification) {\n const newState = state.map(notification => {\n if (notification.id === newNotification.id) {\n return newNotification;\n }\n\n return notification;\n });\n\n return newState;\n }\n\n return [\n ...state,\n newNotification,\n ];\n}\n\n\nconst updateNotification = (\n state: Types.State,\n action: Types.UpdateNotificationAction,\n): Types.State => {\n const updatedState = state.map(notification => {\n if (notification.id === action.payload.id) {\n const newNotification: Types.Notification = {\n ...action.payload,\n };\n return newNotification;\n }\n\n return {\n ...notification,\n };\n });\n\n return [\n ...updatedState,\n ];\n}\n\n\nconst removeNotification = (\n state: Types.State,\n action: Types.RemoveNotificationAction,\n): Types.State => {\n const updatedState = state.filter(\n notification => notification.id !== action.payload.id\n );\n\n return [\n ...updatedState,\n ];\n}\n\n\n\nconst resolvers = {\n addNotification,\n updateNotification,\n removeNotification,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default resolvers;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n\n import initialState from '../initial';\n\n import resolvers from '../resolvers';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst reducer = (\n state: Types.State = initialState,\n action: Types.Actions,\n): Types.State => {\n switch(action.type) {\n case Types.ADD_NOTIFICATION:\n return resolvers.addNotification(state, action);\n case Types.UPDATE_NOTIFICATION:\n return resolvers.updateNotification(state, action);\n case Types.REMOVE_NOTIFICATION:\n return resolvers.removeNotification(state, action);\n default:\n return [\n ...state,\n ];\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport {\n reducer,\n};\n// #endregion exports\n","// #region imports\n // #region external\n import {\n StateOfAny,\n } from '#data/interfaces';\n\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst getAll = (\n state: StateOfAny & Record<'notifications', Types.State>,\n) => state.notifications;\n\n\n\nconst selectors = {\n getAll,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default selectors;\n// #endregion exports\n","// #region module\nexport const TOGGLE_GLOBAL_SHORTCUTS = 'TOGGLE_GLOBAL_SHORTCUTS';\nexport interface ToggleGlobalShortcutsAction {\n type: typeof TOGGLE_GLOBAL_SHORTCUTS;\n payload?: boolean;\n}\n\n\n\nexport interface State {\n global: boolean;\n}\n\n\nexport type Actions =\n | ToggleGlobalShortcutsAction;\n// #endregion module\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst toggleGlobalShortcuts = (\n payload?: boolean,\n): Types.ToggleGlobalShortcutsAction => {\n return {\n type: Types.TOGGLE_GLOBAL_SHORTCUTS,\n payload,\n };\n}\n\n\n\nconst actions = {\n toggleGlobalShortcuts,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default actions;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst initialState: Types.State = {\n global: true,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default initialState;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst toggleGlobalShortcuts = (\n state: Types.State,\n action: Types.ToggleGlobalShortcutsAction,\n) => {\n const global = action.payload\n ? action.payload\n : !state.global;\n\n return {\n ...state,\n global,\n };\n}\n\n\nconst resolvers = {\n toggleGlobalShortcuts,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default resolvers;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n\n import initialState from '../initial';\n\n import resolvers from '../resolvers';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst reducer = (\n state: Types.State = initialState,\n action: Types.Actions,\n): Types.State => {\n switch(action.type) {\n case Types.TOGGLE_GLOBAL_SHORTCUTS:\n return resolvers.toggleGlobalShortcuts(state, action);\n default:\n return {\n ...state,\n };\n }\n}\n// #endregion module\n\n\n\n// #region exports\nexport {\n reducer,\n};\n// #endregion exports\n","// #region imports\n // #region external\n import {\n StateOfAny,\n } from '#data/interfaces';\n\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst getGlobal = (\n state: StateOfAny & Record<'shortcuts', Types.State>,\n) => state.shortcuts.global;\n\n\n\nconst selectors = {\n getGlobal,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default selectors;\n// #endregion exports\n","// #region module\nexport const SET_SITTING_CURRENT_LINK = 'SET_SITTING_CURRENT_LINK';\nexport interface SetSittingCurrentLinkAction {\n type: typeof SET_SITTING_CURRENT_LINK;\n payload: string;\n}\n\n\nexport const TOGGLE_SITTING_TRAY = 'TOGGLE_SITTING_TRAY';\nexport interface ToggleSittingTrayAction {\n type: typeof TOGGLE_SITTING_TRAY;\n payload?: boolean;\n}\n\n\n\nexport interface State {\n currentLink: string;\n tray: boolean;\n}\n\n\nexport type Actions =\n | SetSittingCurrentLinkAction\n | ToggleSittingTrayAction;\n// #endregion module\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst setSittingCurrentLink = (\n link: string,\n): Types.SetSittingCurrentLinkAction => {\n return {\n type: Types.SET_SITTING_CURRENT_LINK,\n payload: link,\n };\n}\n\n\nconst toggleSittingTray = (): Types.ToggleSittingTrayAction => {\n return {\n type: Types.TOGGLE_SITTING_TRAY,\n };\n}\n\n\n\nconst actions = {\n setSittingCurrentLink,\n toggleSittingTray,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default actions;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst initialState: Types.State = {\n currentLink: '',\n tray: false,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default initialState;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst setSittingCurrentLink = (\n state: Types.State,\n action: Types.SetSittingCurrentLinkAction,\n): Types.State => {\n const currentLink = action.payload;\n\n return {\n ...state,\n currentLink,\n };\n}\n\n\nconst toggleSittingTray = (\n state: Types.State,\n action: Types.ToggleSittingTrayAction,\n): Types.State => {\n if (typeof action.payload === 'boolean') {\n return {\n ...state,\n tray: action.payload,\n };\n }\n\n return {\n ...state,\n tray: !state.tray,\n };\n}\n\n\n\nconst resolvers = {\n setSittingCurrentLink,\n toggleSittingTray,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default resolvers;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n\n import initialState from '../initial';\n\n import resolvers from '../resolvers';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst reducer = (\n state: Types.State = initialState,\n action: Types.Actions,\n): Types.State => {\n switch(action.type) {\n case Types.SET_SITTING_CURRENT_LINK:\n return resolvers.setSittingCurrentLink(state, action);\n case Types.TOGGLE_SITTING_TRAY:\n return resolvers.toggleSittingTray(state, action);\n default:\n return {\n ...state,\n };\n }\n}\n\n\nconst metareducer = (\n initialState: Types.State,\n) => (\n state: Types.State = initialState,\n action: Types.Actions,\n) => reducer(\n state,\n action,\n);\n// #endregion module\n\n\n\n// #region exports\nexport {\n reducer,\n metareducer,\n};\n// #endregion exports\n","// #region imports\n // #region external\n import {\n StateOfAny,\n } from '#data/interfaces';\n\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst getCurrentLink = (\n state: StateOfAny & Record<'sitting', Types.State>,\n) => state.sitting.currentLink;\nconst getTray = (\n state: StateOfAny & Record<'sitting', Types.State>,\n) => state.sitting.tray;\n\n\n\nconst selectors = {\n getCurrentLink,\n getTray,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default selectors;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n Theme,\n } from '@plurid/plurid-themes';\n // #endregion libraries\n// #endregion imports\n\n\n\n// #region module\nexport const SET_THEME = 'SET_THEME';\nexport interface SetThemePayload {\n type: 'general' | 'interaction';\n theme: Theme;\n}\nexport interface SetThemeAction {\n type: typeof SET_THEME;\n payload: SetThemePayload;\n}\n\n\n\nexport interface State {\n general: Theme,\n interaction: Theme,\n}\n\n\nexport type Actions =\n | SetThemeAction;\n// #endregion module\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst setTheme = (\n payload: Types.SetThemePayload,\n): Types.SetThemeAction => {\n return {\n type: Types.SET_THEME,\n payload,\n };\n}\n\n\n\nconst actions = {\n setTheme,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default actions;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n plurid,\n } from '@plurid/plurid-themes';\n // #endregion libraries\n\n\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst initialState: Types.State = {\n general: {\n ...plurid,\n },\n interaction: {\n ...plurid,\n },\n};\n// #endregion module\n\n\n\n// #region exports\nexport default initialState;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst setTheme = (\n state: Types.State,\n action: Types.SetThemeAction,\n): Types.State => {\n const {\n type,\n theme,\n } = action.payload;\n\n const newState = {\n ...state,\n };\n\n newState[type] = {\n ...theme,\n };\n\n return newState;\n}\n\n\n\nconst resolvers = {\n setTheme,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default resolvers;\n// #endregion exports\n","// #region imports\n // #region external\n import * as Types from '../types';\n\n import initialState from '../initial';\n\n import resolvers from '../resolvers';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst reducer = (\n state: Types.State = initialState,\n action: Types.Actions,\n): Types.State => {\n switch(action.type) {\n case Types.SET_THEME:\n return resolvers.setTheme(state, action);\n default:\n return {\n ...state,\n };\n }\n}\n\n\nconst metareducer = (\n initialState: Types.State,\n) => (\n state: Types.State = initialState,\n action: Types.Actions,\n) => reducer(\n state,\n action,\n);\n// #endregion module\n\n\n\n// #region exports\nexport {\n reducer,\n metareducer,\n};\n// #endregion exports\n","// #region imports\n // #region external\n import {\n StateOfAny,\n } from '#data/interfaces';\n\n import * as Types from '../types';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nconst getGeneralTheme = (\n state: StateOfAny & Record<'themes', Types.State>,\n) => state.themes.general;\nconst getInteractionTheme = (\n state: StateOfAny & Record<'themes', Types.State>,\n) => state.themes.interaction;\n\n\n\nconst selectors = {\n getGeneralTheme,\n getInteractionTheme,\n};\n// #endregion module\n\n\n\n// #region exports\nexport default selectors;\n// #endregion exports\n"],"names":["SET_HEAD","setHead","payload","type","Types.SET_HEAD","actions","initialState","title","description","ogTitle","ogImage","ogURL","ogDescription","canonicalURL","styles","scripts","state","action","Object","assign","resolvers","reducer","metareducer","getHeadData","head","selectors","ADD_NOTIFICATION","UPDATE_NOTIFICATION","REMOVE_NOTIFICATION","addNotification","Types.ADD_NOTIFICATION","updateNotification","Types.UPDATE_NOTIFICATION","removeNotification","Types.REMOVE_NOTIFICATION","newNotification","existingNotification","find","notification","id","newState","map","updatedState","filter","getAll","notifications","TOGGLE_GLOBAL_SHORTCUTS","toggleGlobalShortcuts","Types.TOGGLE_GLOBAL_SHORTCUTS","global","getGlobal","shortcuts","SET_SITTING_CURRENT_LINK","TOGGLE_SITTING_TRAY","setSittingCurrentLink","link","Types.SET_SITTING_CURRENT_LINK","toggleSittingTray","Types.TOGGLE_SITTING_TRAY","currentLink","tray","getCurrentLink","sitting","getTray","SET_THEME","setTheme","Types.SET_THEME","general","plurid","interaction","theme","getGeneralTheme","themes","getInteractionTheme"],"mappings":";;AAcO,MAAMA,WAAW;;;;;;;ACCxB,MAAMC,YACFC,YAEO;IACHC,MAAMC;IACNF,SAAAA;;;AAMR,MAAMG,YAAU;aACZJ;;;AClBJ,MAAMK,iBAA4B;IAC9BC,OAAO;IACPC,aAAa;IACbC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,eAAe;IACfC,cAAc;IACdC,QAAQ;IACRC,SAAS;;;ACTb,MAAMd,UAAU,CACZe,OACAC,WAEAC,OAAAC,OAAAD,OAAAC,OAAA,IACOH,QACAC,OAAOf;;AAMlB,MAAMkB,cAAY;IACdnB,SAAAA;;;ACTJ,MAAMoB,YAAU,CACZL,QAAqBV,gBACrBW;IAEA,QAAOA,OAAOd;MACV,KAAKC;QACD,OAAOgB,YAAUnB,QAAQe,OAAOC;;MACpC;QACI,OAAAC,OAAAC,OAAA,IACOH;;;;AAMnB,MAAMM,gBACFhB,gBACC,CACDU,QAAqBV,cACrBW,WACCI,UACDL,OACA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MAAMpB,YAAY;IACd6C,UAAAA;;;ACnBJ,MAAM5C,UAAU,CACZL,QAAqBV,cACrBW;IAEA,QAAOA,OAAOd;MACV,KAAK+D;QACD,OAAO9C,UAAU6C,SAASjD,OAAOC;;MACrC;QACI,OAAAC,OAAAC,OAAA,IACOH;;;;AAMnB,MAAMM,cACFhB,gBACC,CACDU,QAAqBV,cACrBW,WACCI,QACDL,OACAC;;ACtBJ,MAAMsD,kBACFvD,SACCA,MAAMwD,OAAOL;;AAClB,MAAMM,sBACFzD,SACCA,MAAMwD,OAAOH;;AAIlB,MAAM5C,YAAY;IACd8C,iBAAAA;IACAE,qBAAAA;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.es.js","sources":["../source/modules/head/index.ts","../source/modules/notifications/index.ts","../source/modules/shortcuts/index.ts","../source/modules/sitting/index.ts","../source/modules/themes/index.ts"],"sourcesContent":["// #region imports\n // #region libraries\n import {\n createSlice,\n PayloadAction,\n } from '@reduxjs/toolkit';\n // #endregion libraries\n\n\n // #region external\n import {\n StateWithSlice,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport interface HeadState {\n title: string;\n description: string;\n canonicalURL: string;\n ogTitle: string;\n ogImage: string;\n ogURL: string;\n ogDescription: string;\n styles: string[];\n scripts: string[];\n}\n\n\nexport const initialState: HeadState = {\n title: '',\n description: '',\n ogTitle: '',\n ogImage: '',\n ogURL: '',\n ogDescription: '',\n canonicalURL: '',\n styles: [],\n scripts: [],\n};\n\nexport const name = 'head' as const;\n\n\nexport const factory = (\n state: HeadState = initialState,\n) => createSlice({\n name,\n initialState: state,\n reducers: {\n setHead: (\n state,\n action: PayloadAction<Partial<HeadState>>,\n ) => {\n state = {\n ...state,\n ...action,\n };\n },\n },\n});\n\nexport const slice = factory();\n// #endregion module\n\n\n\n// #region exports\nexport const actions = slice.actions;\n\n\nexport const getHead = (\n state: StateWithSlice<typeof name, HeadState>,\n): HeadState => state.head;\n\nexport const selectors = {\n getHead,\n};\n\n\nexport const reducer = slice.reducer;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n createSlice,\n PayloadAction,\n } from '@reduxjs/toolkit';\n // #endregion libraries\n\n\n // #region external\n import {\n Notification,\n AddNotificationPayload,\n StateWithSlice,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport type NotificationsState = Notification[];\n\n\nexport const initialState: NotificationsState = [];\n\nexport const name = 'notifications' as const;\n\n\nexport const factory = (\n state: NotificationsState = initialState,\n) => createSlice({\n name,\n initialState: state,\n reducers: {\n new: (\n state,\n action: PayloadAction<string>,\n ) => {\n const id = Math.random() + '';\n const text = action.payload;\n\n const newNotification: Notification = {\n id,\n text,\n };\n\n state = [\n ...state,\n newNotification,\n ];\n },\n add: (\n state,\n action: PayloadAction<AddNotificationPayload>,\n ) => {\n const id = action.payload.id || Math.random() + '';\n\n const newNotification: Notification = {\n ...action.payload,\n id,\n };\n\n const existingNotification = state.find(\n notification => notification.id === newNotification.id,\n );\n\n if (existingNotification) {\n state = state.map(notification => {\n if (notification.id === newNotification.id) {\n return newNotification;\n }\n\n return notification;\n });\n\n return;\n }\n\n state = [\n ...state,\n newNotification,\n ];\n },\n update: (\n state,\n action: PayloadAction<Notification>,\n ) => {\n state = state.map(message => {\n if (message.id === action.payload.id) {\n const newNotification: Notification = {\n ...action.payload,\n };\n return newNotification;\n }\n\n return {\n ...message,\n };\n });\n },\n remove: (\n state,\n action: PayloadAction<string>,\n ) => {\n state = state.filter(\n message => message.id !== action.payload,\n );\n },\n },\n});\n\nexport const slice = factory();\n// #endregion module\n\n\n\n// #region exports\nexport const actions = slice.actions;\n\n\nconst getAll = (\n state: StateWithSlice<typeof name, NotificationsState>,\n) => state.notifications;\n\nexport const selectors = {\n getAll,\n};\n\n\nexport const reducer = slice.reducer;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n createSlice,\n PayloadAction,\n } from '@reduxjs/toolkit';\n // #endregion libraries\n\n\n // #region external\n import {\n StateWithSlice,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport interface ShortcutsState {\n global: boolean;\n}\n\n\nexport const initialState: ShortcutsState = {\n global: true,\n};\n\nexport const name = 'shortcuts' as const;\n\n\nexport const factory = (\n state: ShortcutsState = initialState,\n) => createSlice({\n name,\n initialState: state,\n reducers: {\n setGlobalShortcuts: (\n state,\n action: PayloadAction<boolean>,\n ) => {\n state.global = action.payload;\n },\n toggleGlobalShortcuts: (\n state,\n _action: PayloadAction<void>,\n ) => {\n state.global = !state.global;\n },\n },\n});\n\nexport const slice = factory();\n// #endregion module\n\n\n\n// #region exports\nexport const actions = slice.actions;\n\n\nconst getGlobal = (\n state: StateWithSlice<typeof name, ShortcutsState>,\n) => state.shortcuts.global;\n\nexport const selectors = {\n getGlobal,\n};\n\n\nexport const reducer = slice.reducer;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n createSlice,\n PayloadAction,\n } from '@reduxjs/toolkit';\n // #endregion libraries\n\n\n // #region external\n import {\n StateWithSlice,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport interface SittingState {\n currentLink: string;\n tray: boolean;\n}\n\n\nexport const initialState: SittingState = {\n currentLink: '',\n tray: false,\n};\n\nexport const name = 'sitting' as const;\n\n\nexport const factory = (\n state: SittingState = initialState,\n) => createSlice({\n name,\n initialState: state,\n reducers: {\n setSittingCurrentLink: (\n state,\n action: PayloadAction<string>,\n ) => {\n const currentLink = action.payload;\n\n return {\n ...state,\n currentLink,\n };\n },\n setSittingTray: (\n state,\n action: PayloadAction<boolean>,\n ) => {\n state.tray = action.payload;\n },\n toggleSittingTray: (\n state,\n _action: PayloadAction<void>,\n ) => {\n state.tray = !state.tray;\n }\n },\n});\n\nexport const slice = factory();\n// #endregion module\n\n\n\n// #region exports\nexport const actions = slice.actions;\n\n\nconst getCurrentLink = (\n state: StateWithSlice<typeof name, SittingState>,\n) => state.sitting.currentLink;\nconst getTray = (\n state: StateWithSlice<typeof name, SittingState>,\n) => state.sitting.tray;\n\nexport const selectors = {\n getCurrentLink,\n getTray,\n};\n\n\nexport const reducer = slice.reducer;\n// #endregion exports\n","// #region imports\n // #region libraries\n import {\n createSlice,\n PayloadAction,\n } from '@reduxjs/toolkit';\n\n\n import {\n Theme,\n plurid,\n } from '@plurid/plurid-themes';\n // #endregion libraries\n\n\n // #region external\n import {\n StateWithSlice,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport interface ThemesState {\n general: Theme;\n interaction: Theme;\n}\n\n\nexport const initialState: ThemesState = {\n general: {\n ...plurid,\n },\n interaction: {\n ...plurid,\n },\n};\n\nexport const name = 'themes' as const;\n\n\nexport interface SetThemePayload {\n type: 'general' | 'interaction';\n theme: Theme;\n}\n\n\nexport const factory = (\n state: ThemesState = initialState,\n) => createSlice({\n name,\n initialState: state,\n reducers: {\n setTheme: (\n state,\n action: PayloadAction<SetThemePayload>,\n ) => {\n const {\n type,\n theme,\n } = action.payload;\n\n state[type] = theme;\n },\n setGeneralTheme: (\n state,\n action: PayloadAction<Theme>,\n ) => {\n state.general = action.payload;\n },\n setInteractionTheme: (\n state,\n action: PayloadAction<Theme>,\n ) => {\n state.interaction = action.payload;\n },\n },\n});\n\nexport const slice = factory();\n// #endregion module\n\n\n\n// #region exports\nexport const actions = slice.actions;\n\n\nconst getGeneralTheme = (\n state: StateWithSlice<typeof name, ThemesState>,\n) => state.themes.general;\nconst getInteractionTheme = (\n state: StateWithSlice<typeof name, ThemesState>,\n) => state.themes.interaction;\n\nexport const selectors = {\n getGeneralTheme,\n getInteractionTheme,\n};\n\n\nexport const reducer = slice.reducer;\n// #endregion exports\n"],"names":["initialState","title","description","ogTitle","ogImage","ogURL","ogDescription","canonicalURL","styles","scripts","name","factory","state","createSlice","reducers","setHead","action","Object","assign","slice","actions","getHead","head","selectors","reducer","new","id","Math","random","text","payload","newNotification","add","existingNotification","find","notification","map","update","message","remove","filter","getAll","notifications","global","setGlobalShortcuts","toggleGlobalShortcuts","_action","getGlobal","shortcuts","currentLink","tray","setSittingCurrentLink","setSittingTray","toggleSittingTray","getCurrentLink","sitting","getTray","general","plurid","interaction","setTheme","type","theme","setGeneralTheme","setInteractionTheme","getGeneralTheme","themes","getInteractionTheme"],"mappings":";;;;;;AAgCO,MAAMA,iBAA0B;IACnCC,OAAO;IACPC,aAAa;IACbC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,eAAe;IACfC,cAAc;IACdC,QAAQ;IACRC,SAAS;;;AAGN,MAAMC,SAAO;;AAGb,MAAMC,YAAU,CACnBC,QAAmBZ,mBAClBa,YAAY;UACbH;IACAV,cAAcY;IACdE,UAAU;QACNC,SAAS,CACLH,OACAI;YAEAJ,QACOK,OAAAC,OAAAD,OAAAC,OAAA,IAAAN,QACAI;;;;;AAMZ,MAAMG,UAAQR;;AAMd,MAAMS,YAAUD,QAAMC;;AAGtB,MAAMC,UACTT,SACYA,MAAMU;;AAEf,MAAMC,cAAY;IACrBF,SAAAA;;;AAIG,MAAMG,YAAUL,QAAMK;;;;;;;;;;;;;;AC3DtB,MAAMxB,iBAAmC;;AAEzC,MAAMU,SAAO;;AAGb,MAAMC,YAAU,CACnBC,QAA4BZ,mBAC3Ba,YAAY;UACbH;IACAV,cAAcY;IACdE,UAAU;QACNW,KAAK,CACDb,OACAI;YAEA,MAAMU,KAAKC,KAAKC,WAAW;YAC3B,MAAMC,OAAOb,OAAOc;YAEpB,MAAMC,kBAAgC;gBAClCL,IAAAA;gBACAG,MAAAA;;YAGJjB,QAAQ,KACDA,OACHmB;;QAGRC,KAAK,CACDpB,OACAI;YAEA,MAAMU,KAAKV,OAAOc,QAAQJ,MAAMC,KAAKC,WAAW;YAEhD,MAAMG,kDACCf,OAAOc,UACV;gBAAAJ,IAAAA;;YAGJ,MAAMO,uBAAuBrB,MAAMsB,MAC/BC,gBAAgBA,aAAaT,OAAOK,gBAAgBL;YAGxD,IAAIO,sBAAsB;gBACtBrB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