@plurid/plurid-ui-state-react 0.0.0-1 → 0.0.0-11

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 +154 -245
  4. package/distribution/index.es.js.map +1 -1
  5. package/distribution/index.js +157 -252
  6. package/distribution/index.js.map +1 -1
  7. package/distribution/modules/head/index.d.ts +59 -6
  8. package/distribution/modules/notifications/index.d.ts +132 -6
  9. package/distribution/modules/shortcuts/index.d.ts +35 -6
  10. package/distribution/modules/sitting/index.d.ts +64 -6
  11. package/distribution/modules/themes/index.d.ts +726 -6
  12. package/package.json +24 -20
  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 -31
  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";
1
+ import "immer";
4
2
 
5
- var index$9 = Object.freeze({
6
- __proto__: null,
7
- SET_HEAD: SET_HEAD
8
- });
3
+ import { createSlice } from "@reduxjs/toolkit";
9
4
 
10
- const setHead$1 = payload => ({
11
- type: SET_HEAD,
12
- payload: payload
13
- });
14
-
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,118 +16,96 @@ const initialState$4 = {
28
16
  scripts: []
29
17
  };
30
18
 
31
- const setHead = (state, action) => Object.assign(Object.assign({}, state), action.payload);
32
-
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);
19
+ const name$4 = "head";
41
20
 
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
45
  actions: actions$4,
46
+ factory: factory$4,
47
+ getHead: getHead,
58
48
  initialState: initialState$4,
49
+ name: name$4,
59
50
  reducer: reducer$4,
60
- metareducer: metareducer$2,
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
52
+ slice: slice$4
81
53
  });
82
54
 
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
91
- });
92
-
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
- return [ ...state, newNotification ];
104
- };
105
-
106
- const updateNotification = (state, action) => {
107
- const updatedState = state.map((notification => {
108
- if (notification.id === action.payload.id) {
109
- const newNotification = Object.assign({}, action.payload);
110
- 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
+ return [ ...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
+ const newState = state.map((notification => {
80
+ if (notification.id === newNotification.id) {
81
+ return newNotification;
82
+ }
83
+ return notification;
84
+ }));
85
+ return newState;
86
+ }
87
+ return [ ...state, newNotification ];
88
+ },
89
+ update: (state, action) => {
90
+ const newState = 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
+ return newState;
98
+ },
99
+ remove: (state, action) => {
100
+ const newState = state.filter((message => message.id !== action.payload));
101
+ return newState;
111
102
  }
112
- return Object.assign({}, notification);
113
- }));
114
- return [ ...updatedState ];
115
- };
116
-
117
- const removeNotification = (state, action) => {
118
- const updatedState = state.filter((notification => notification.id !== action.payload.id));
119
- return [ ...updatedState ];
120
- };
121
-
122
- const resolvers$3 = {
123
- addNotification: addNotification,
124
- updateNotification: updateNotification,
125
- removeNotification: removeNotification
126
- };
127
-
128
- const reducer$3 = (state = initialState$3, action) => {
129
- switch (action.type) {
130
- case ADD_NOTIFICATION:
131
- return resolvers$3.addNotification(state, action);
103
+ }
104
+ });
132
105
 
133
- case UPDATE_NOTIFICATION:
134
- return resolvers$3.updateNotification(state, action);
106
+ const slice$3 = factory$3();
135
107
 
136
- case REMOVE_NOTIFICATION:
137
- return resolvers$3.removeNotification(state, action);
138
-
139
- default:
140
- return [ ...state ];
141
- }
142
- };
108
+ const actions$3 = slice$3.actions;
143
109
 
144
110
  const getAll = state => state.notifications;
145
111
 
@@ -147,55 +113,41 @@ const selectors$3 = {
147
113
  getAll: getAll
148
114
  };
149
115
 
150
- var index$6 = Object.freeze({
116
+ const reducer$3 = slice$3.reducer;
117
+
118
+ var index$3 = Object.freeze({
151
119
  __proto__: null,
152
120
  actions: actions$3,
121
+ factory: factory$3,
153
122
  initialState: initialState$3,
123
+ name: name$3,
154
124
  reducer: reducer$3,
155
125
  selectors: selectors$3,
156
- Types: index$7
126
+ slice: slice$3
157
127
  });
158
128
 
159
- const TOGGLE_GLOBAL_SHORTCUTS = "TOGGLE_GLOBAL_SHORTCUTS";
160
-
161
- var index$5 = Object.freeze({
162
- __proto__: null,
163
- TOGGLE_GLOBAL_SHORTCUTS: TOGGLE_GLOBAL_SHORTCUTS
164
- });
165
-
166
- const toggleGlobalShortcuts$1 = payload => ({
167
- type: TOGGLE_GLOBAL_SHORTCUTS,
168
- payload: payload
169
- });
170
-
171
- const actions$2 = {
172
- toggleGlobalShortcuts: toggleGlobalShortcuts$1
173
- };
174
-
175
129
  const initialState$2 = {
176
130
  global: true
177
131
  };
178
132
 
179
- const toggleGlobalShortcuts = (state, action) => {
180
- const global = action.payload ? action.payload : !state.global;
181
- return Object.assign(Object.assign({}, state), {
182
- global: global
183
- });
184
- };
185
-
186
- const resolvers$2 = {
187
- toggleGlobalShortcuts: toggleGlobalShortcuts
188
- };
133
+ const name$2 = "shortcuts";
134
+
135
+ const factory$2 = (state = initialState$2) => createSlice({
136
+ name: name$2,
137
+ initialState: state,
138
+ reducers: {
139
+ setGlobalShortcuts: (state, action) => {
140
+ state.global = action.payload;
141
+ },
142
+ toggleGlobalShortcuts: (state, _action) => {
143
+ state.global = !state.global;
144
+ }
145
+ }
146
+ });
189
147
 
190
- const reducer$2 = (state = initialState$2, action) => {
191
- switch (action.type) {
192
- case TOGGLE_GLOBAL_SHORTCUTS:
193
- return resolvers$2.toggleGlobalShortcuts(state, action);
148
+ const slice$2 = factory$2();
194
149
 
195
- default:
196
- return Object.assign({}, state);
197
- }
198
- };
150
+ const actions$2 = slice$2.actions;
199
151
 
200
152
  const getGlobal = state => state.shortcuts.global;
201
153
 
@@ -203,81 +155,48 @@ const selectors$2 = {
203
155
  getGlobal: getGlobal
204
156
  };
205
157
 
206
- var index$4 = Object.freeze({
158
+ const reducer$2 = slice$2.reducer;
159
+
160
+ var index$2 = Object.freeze({
207
161
  __proto__: null,
208
162
  actions: actions$2,
163
+ factory: factory$2,
209
164
  initialState: initialState$2,
165
+ name: name$2,
210
166
  reducer: reducer$2,
211
167
  selectors: selectors$2,
212
- Types: index$5
213
- });
214
-
215
- const SET_SITTING_CURRENT_LINK = "SET_SITTING_CURRENT_LINK";
216
-
217
- const TOGGLE_SITTING_TRAY = "TOGGLE_SITTING_TRAY";
218
-
219
- var index$3 = Object.freeze({
220
- __proto__: null,
221
- SET_SITTING_CURRENT_LINK: SET_SITTING_CURRENT_LINK,
222
- TOGGLE_SITTING_TRAY: TOGGLE_SITTING_TRAY
223
- });
224
-
225
- const setSittingCurrentLink$1 = link => ({
226
- type: SET_SITTING_CURRENT_LINK,
227
- payload: link
168
+ slice: slice$2
228
169
  });
229
170
 
230
- const toggleSittingTray$1 = () => ({
231
- type: TOGGLE_SITTING_TRAY
232
- });
233
-
234
- const actions$1 = {
235
- setSittingCurrentLink: setSittingCurrentLink$1,
236
- toggleSittingTray: toggleSittingTray$1
237
- };
238
-
239
171
  const initialState$1 = {
240
172
  currentLink: "",
241
173
  tray: false
242
174
  };
243
175
 
244
- const setSittingCurrentLink = (state, action) => {
245
- const currentLink = action.payload;
246
- return Object.assign(Object.assign({}, state), {
247
- currentLink: currentLink
248
- });
249
- };
250
-
251
- const toggleSittingTray = (state, action) => {
252
- if (typeof action.payload === "boolean") {
253
- return Object.assign(Object.assign({}, state), {
254
- tray: action.payload
255
- });
176
+ const name$1 = "sitting";
177
+
178
+ const factory$1 = (state = initialState$1) => createSlice({
179
+ name: name$1,
180
+ initialState: state,
181
+ reducers: {
182
+ setSittingCurrentLink: (state, action) => {
183
+ const currentLink = action.payload;
184
+ return Object.assign(Object.assign({}, state), {
185
+ currentLink: currentLink
186
+ });
187
+ },
188
+ setSittingTray: (state, action) => {
189
+ state.tray = action.payload;
190
+ },
191
+ toggleSittingTray: (state, _action) => {
192
+ state.tray = !state.tray;
193
+ }
256
194
  }
257
- return Object.assign(Object.assign({}, state), {
258
- tray: !state.tray
259
- });
260
- };
261
-
262
- const resolvers$1 = {
263
- setSittingCurrentLink: setSittingCurrentLink,
264
- toggleSittingTray: toggleSittingTray
265
- };
266
-
267
- const reducer$1 = (state = initialState$1, action) => {
268
- switch (action.type) {
269
- case SET_SITTING_CURRENT_LINK:
270
- return resolvers$1.setSittingCurrentLink(state, action);
195
+ });
271
196
 
272
- case TOGGLE_SITTING_TRAY:
273
- return resolvers$1.toggleSittingTray(state, action);
197
+ const slice$1 = factory$1();
274
198
 
275
- default:
276
- return Object.assign({}, state);
277
- }
278
- };
279
-
280
- const metareducer$1 = initialState => (state = initialState, action) => reducer$1(state, action);
199
+ const actions$1 = slice$1.actions;
281
200
 
282
201
  const getCurrentLink = state => state.sitting.currentLink;
283
202
 
@@ -288,59 +207,46 @@ const selectors$1 = {
288
207
  getTray: getTray
289
208
  };
290
209
 
291
- var index$2 = Object.freeze({
210
+ const reducer$1 = slice$1.reducer;
211
+
212
+ var index$1 = Object.freeze({
292
213
  __proto__: null,
293
214
  actions: actions$1,
215
+ factory: factory$1,
294
216
  initialState: initialState$1,
217
+ name: name$1,
295
218
  reducer: reducer$1,
296
- metareducer: metareducer$1,
297
219
  selectors: selectors$1,
298
- Types: index$3
220
+ slice: slice$1
299
221
  });
300
222
 
301
- const SET_THEME = "SET_THEME";
302
-
303
- var index$1 = Object.freeze({
304
- __proto__: null,
305
- SET_THEME: SET_THEME
306
- });
307
-
308
- const setTheme$1 = payload => ({
309
- type: SET_THEME,
310
- payload: payload
311
- });
312
-
313
- const actions = {
314
- setTheme: setTheme$1
315
- };
316
-
317
223
  const initialState = {
318
224
  general: Object.assign({}, plurid),
319
225
  interaction: Object.assign({}, plurid)
320
226
  };
321
227
 
322
- const setTheme = (state, action) => {
323
- const {type: type, theme: theme} = action.payload;
324
- const newState = Object.assign({}, state);
325
- newState[type] = Object.assign({}, theme);
326
- return newState;
327
- };
328
-
329
- const resolvers = {
330
- setTheme: setTheme
331
- };
332
-
333
- const reducer = (state = initialState, action) => {
334
- switch (action.type) {
335
- case SET_THEME:
336
- return resolvers.setTheme(state, action);
337
-
338
- default:
339
- return Object.assign({}, state);
228
+ const name = "themes";
229
+
230
+ const factory = (state = initialState) => createSlice({
231
+ name: name,
232
+ initialState: state,
233
+ reducers: {
234
+ setTheme: (state, action) => {
235
+ const {type: type, theme: theme} = action.payload;
236
+ state[type] = theme;
237
+ },
238
+ setGeneralTheme: (state, action) => {
239
+ state.general = action.payload;
240
+ },
241
+ setInteractionTheme: (state, action) => {
242
+ state.interaction = action.payload;
243
+ }
340
244
  }
341
- };
245
+ });
246
+
247
+ const slice = factory();
342
248
 
343
- const metareducer = initialState => (state = initialState, action) => reducer(state, action);
249
+ const actions = slice.actions;
344
250
 
345
251
  const getGeneralTheme = state => state.themes.general;
346
252
 
@@ -351,15 +257,18 @@ const selectors = {
351
257
  getInteractionTheme: getInteractionTheme
352
258
  };
353
259
 
260
+ const reducer = slice.reducer;
261
+
354
262
  var index = Object.freeze({
355
263
  __proto__: null,
356
264
  actions: actions,
265
+ factory: factory,
357
266
  initialState: initialState,
267
+ name: name,
358
268
  reducer: reducer,
359
- metareducer: metareducer,
360
269
  selectors: selectors,
361
- Types: index$1
270
+ slice: slice
362
271
  });
363
272
 
364
- export { index$8 as head, index$6 as notifications, index$4 as shortcuts, index$2 as sitting, index as themes };
273
+ export { index$4 as head, index$3 as notifications, index$2 as shortcuts, index$1 as sitting, index as themes };
365
274
  //# 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}\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 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","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","updatedState","map","notification","id","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","newState","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,2CAGOD,QACAC,OAAOf;;AAMlB,MAAMgB,cAAY;IACdjB,SAAAA;;;ACTJ,MAAMkB,YAAU,CACZH,QAAqBV,gBACrBW;IAEA,QAAOA,OAAOd;MACV,KAAKC;QACD,OAAOc,YAAUjB,QAAQe,OAAOC;;MACpC;QACI,yBACOD;;;;AAMnB,MAAMI,gBACFd,gBACC,CACDU,QAAqBV,cACrBW,WACCE,UACDH,OACAC;;ACtBJ,MAAMI,cACFL,SACCA,MAAMM;;AAIX,MAAMC,cAAY;IACdF,aAAAA;;;;;;;;;;;;;ACVG,MAAMG,mBAAmB;;AAQzB,MAAMC,sBAAsB;;AAQ5B,MAAMC,sBAAsB;;;;;;;;;ACjBnC,MAAMC,oBACFzB,YAEO;IACHC,MAAMyB;IACN1B,SAAAA;;;AAKR,MAAM2B,uBACF3B,YAEO;IACHC,MAAM2B;IACN5B,SAAAA;;;AAKR,MAAM6B,uBACF7B,YAEO;IACHC,MAAM6B;IACN9B,SAAAA;;;AAMR,MAAMG,YAAU;qBACZsB;wBACAE;wBACAE;;;AClCJ,MAAMzB,iBAA4B;;ACAlC,MAAMqB,kBAAkB,CACpBX,OACAC;IAEA,MAAMgB,oCACChB,OAA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,2BACOC;IAEPC,+BACOD;;;ACZX,MAAMH,WAAW,CACb5C,OACAC;IAEA,OAAMd,MACFA,MAAI8D,OACJA,SACAhD,OAAOf;IAEX,MAAMgE,6BACClD;IAGPkD,SAAS/D,0BACF8D;IAGP,OAAOC;;;AAKX,MAAMhD,YAAY;IACd0C,UAAAA;;;ACnBJ,MAAMzC,UAAU,CACZH,QAAqBV,cACrBW;IAEA,QAAOA,OAAOd;MACV,KAAK0D;QACD,OAAO3C,UAAU0C,SAAS5C,OAAOC;;MACrC;QACI,yBACOD;;;;AAMnB,MAAMI,cACFd,gBACC,CACDU,QAAqBV,cACrBW,WACCE,QACDH,OACAC;;ACtBJ,MAAMkD,kBACFnD,SACCA,MAAMoD,OAAON;;AAClB,MAAMO,sBACFrD,SACCA,MAAMoD,OAAOJ;;AAIlB,MAAMzC,YAAY;IACd4C,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 return [\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 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 update: (\n state,\n action: PayloadAction<Notification>,\n ) => {\n const newState = 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 return newState;\n },\n remove: (\n state,\n action: PayloadAction<string>,\n ) => {\n const newState = state.filter(\n message => message.id !== action.payload,\n );\n\n return newState;\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","newState","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;AACN;;;;AAKN,MAAMG,UAAQR;;AAMd,MAAMS,YAAUD,QAAMC;;AAGtB,MAAMC,UACTT,SACYA,MAAMU;;AAEf,MAAMC,cAAY;IACrBF;;;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;gBACAG;;YAGJ,OAAO,KACAjB,OACHmB;AACH;QAELC,KAAK,CACDpB,OACAI;YAEA,MAAMU,KAAKV,OAAOc,QAAQJ,MAAMC,KAAK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