@plurid/plurid-ui-state-react 0.0.0-3 → 0.0.0-6

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 +12 -0
  2. package/distribution/index.d.ts +1 -0
  3. package/distribution/index.es.js +137 -262
  4. package/distribution/index.es.js.map +1 -1
  5. package/distribution/index.js +141 -266
  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 +24 -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 +16 -13
  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
@@ -4,23 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var pluridThemes = require("@plurid/plurid-themes");
8
-
9
- const SET_HEAD = "SET_HEAD";
7
+ require("immer");
10
8
 
11
- var index$9 = Object.freeze({
12
- __proto__: null,
13
- SET_HEAD: SET_HEAD
14
- });
9
+ var toolkit = require("@reduxjs/toolkit");
15
10
 
16
- const setHead$1 = payload => ({
17
- type: SET_HEAD,
18
- payload: payload
19
- });
20
-
21
- const actions$4 = {
22
- setHead: setHead$1
23
- };
11
+ var pluridThemes = require("@plurid/plurid-themes");
24
12
 
25
13
  const initialState$4 = {
26
14
  title: "",
@@ -34,128 +22,80 @@ const initialState$4 = {
34
22
  scripts: []
35
23
  };
36
24
 
37
- const setHead = (state, action) => Object.assign(Object.assign({}, state), action.payload);
38
-
39
- const resolvers$4 = {
40
- setHead: setHead
41
- };
42
-
43
- const reducer$4 = (state = initialState$4, action) => {
44
- switch (action.type) {
45
- case SET_HEAD:
46
- return resolvers$4.setHead(state, action);
25
+ const name$4 = "head";
47
26
 
48
- default:
49
- return Object.assign({}, state);
27
+ const factory$4 = (state = initialState$4) => toolkit.createSlice({
28
+ name: name$4,
29
+ initialState: state,
30
+ reducers: {
31
+ setHead: (state, action) => {
32
+ state = Object.assign(Object.assign({}, state), action);
33
+ }
50
34
  }
51
- };
35
+ });
52
36
 
53
- const metareducer$2 = initialState => (state = initialState, action) => reducer$4(state, action);
37
+ const slice$4 = factory$4();
54
38
 
55
- const getHeadData = state => state.head;
39
+ const actions$4 = slice$4.actions;
40
+
41
+ const getHead = state => state.head;
56
42
 
57
43
  const selectors$4 = {
58
- getHeadData: getHeadData
44
+ getHead: getHead
59
45
  };
60
46
 
61
- var index$8 = Object.freeze({
47
+ const reducer$4 = slice$4.reducer;
48
+
49
+ var index$4 = Object.freeze({
62
50
  __proto__: null,
51
+ factory: factory$4,
52
+ slice: slice$4,
63
53
  actions: actions$4,
64
- initialState: initialState$4,
65
- reducer: reducer$4,
66
- metareducer: metareducer$2,
54
+ getHead: getHead,
67
55
  selectors: selectors$4,
68
- Types: index$9
69
- });
70
-
71
- const ADD_NOTIFICATION = "ADD_NOTIFICATION";
72
-
73
- const UPDATE_NOTIFICATION = "UPDATE_NOTIFICATION";
74
-
75
- const REMOVE_NOTIFICATION = "REMOVE_NOTIFICATION";
76
-
77
- var index$7 = Object.freeze({
78
- __proto__: null,
79
- ADD_NOTIFICATION: ADD_NOTIFICATION,
80
- UPDATE_NOTIFICATION: UPDATE_NOTIFICATION,
81
- REMOVE_NOTIFICATION: REMOVE_NOTIFICATION
82
- });
83
-
84
- const addNotification$1 = payload => ({
85
- type: ADD_NOTIFICATION,
86
- payload: payload
87
- });
88
-
89
- const updateNotification$1 = payload => ({
90
- type: UPDATE_NOTIFICATION,
91
- payload: payload
92
- });
93
-
94
- const removeNotification$1 = payload => ({
95
- type: REMOVE_NOTIFICATION,
96
- payload: payload
56
+ reducer: reducer$4
97
57
  });
98
58
 
99
- const actions$3 = {
100
- addNotification: addNotification$1,
101
- updateNotification: updateNotification$1,
102
- removeNotification: removeNotification$1
103
- };
104
-
105
59
  const initialState$3 = [];
106
60
 
107
- const addNotification = (state, action) => {
108
- const newNotification = Object.assign({}, action.payload);
109
- const existingNotification = state.find((notification => notification.id === newNotification.id));
110
- if (existingNotification) {
111
- const newState = state.map((notification => {
112
- if (notification.id === newNotification.id) {
113
- return newNotification;
114
- }
115
- return notification;
116
- }));
117
- return newState;
118
- }
119
- return [ ...state, newNotification ];
120
- };
61
+ const name$3 = "notifications";
121
62
 
122
- const updateNotification = (state, action) => {
123
- const updatedState = state.map((notification => {
124
- if (notification.id === action.payload.id) {
63
+ const factory$3 = (state = initialState$3) => toolkit.createSlice({
64
+ name: name$3,
65
+ initialState: state,
66
+ reducers: {
67
+ addNotification: (state, action) => {
125
68
  const newNotification = Object.assign({}, action.payload);
126
- return newNotification;
69
+ const existingNotification = state.find((notification => notification.id === newNotification.id));
70
+ if (existingNotification) {
71
+ state = state.map((notification => {
72
+ if (notification.id === newNotification.id) {
73
+ return newNotification;
74
+ }
75
+ return notification;
76
+ }));
77
+ return;
78
+ }
79
+ state = [ ...state, newNotification ];
80
+ },
81
+ updateNotification: (state, action) => {
82
+ state = state.map((message => {
83
+ if (message.id === action.payload.id) {
84
+ const newNotification = Object.assign({}, action.payload);
85
+ return newNotification;
86
+ }
87
+ return Object.assign({}, message);
88
+ }));
89
+ },
90
+ removeNotification: (state, action) => {
91
+ state = state.filter((message => message.id !== action.payload));
127
92
  }
128
- return Object.assign({}, notification);
129
- }));
130
- return [ ...updatedState ];
131
- };
132
-
133
- const removeNotification = (state, action) => {
134
- const updatedState = state.filter((notification => notification.id !== action.payload.id));
135
- return [ ...updatedState ];
136
- };
137
-
138
- const resolvers$3 = {
139
- addNotification: addNotification,
140
- updateNotification: updateNotification,
141
- removeNotification: removeNotification
142
- };
143
-
144
- const reducer$3 = (state = initialState$3, action) => {
145
- switch (action.type) {
146
- case ADD_NOTIFICATION:
147
- return resolvers$3.addNotification(state, action);
148
-
149
- case UPDATE_NOTIFICATION:
150
- return resolvers$3.updateNotification(state, action);
93
+ }
94
+ });
151
95
 
152
- case REMOVE_NOTIFICATION:
153
- return resolvers$3.removeNotification(state, action);
96
+ const slice$3 = factory$3();
154
97
 
155
- default:
156
- return [ ...state ];
157
- }
158
- };
98
+ const actions$3 = slice$3.actions;
159
99
 
160
100
  const getAll = state => state.notifications;
161
101
 
@@ -163,55 +103,39 @@ const selectors$3 = {
163
103
  getAll: getAll
164
104
  };
165
105
 
166
- var index$6 = Object.freeze({
106
+ const reducer$3 = slice$3.reducer;
107
+
108
+ var index$3 = Object.freeze({
167
109
  __proto__: null,
110
+ factory: factory$3,
111
+ slice: slice$3,
168
112
  actions: actions$3,
169
- initialState: initialState$3,
170
- reducer: reducer$3,
171
113
  selectors: selectors$3,
172
- Types: index$7
173
- });
174
-
175
- const TOGGLE_GLOBAL_SHORTCUTS = "TOGGLE_GLOBAL_SHORTCUTS";
176
-
177
- var index$5 = Object.freeze({
178
- __proto__: null,
179
- TOGGLE_GLOBAL_SHORTCUTS: TOGGLE_GLOBAL_SHORTCUTS
114
+ reducer: reducer$3
180
115
  });
181
116
 
182
- const toggleGlobalShortcuts$1 = payload => ({
183
- type: TOGGLE_GLOBAL_SHORTCUTS,
184
- payload: payload
185
- });
186
-
187
- const actions$2 = {
188
- toggleGlobalShortcuts: toggleGlobalShortcuts$1
189
- };
190
-
191
117
  const initialState$2 = {
192
118
  global: true
193
119
  };
194
120
 
195
- const toggleGlobalShortcuts = (state, action) => {
196
- const global = action.payload ? action.payload : !state.global;
197
- return Object.assign(Object.assign({}, state), {
198
- global: global
199
- });
200
- };
201
-
202
- const resolvers$2 = {
203
- toggleGlobalShortcuts: toggleGlobalShortcuts
204
- };
121
+ const name$2 = "shortcuts";
122
+
123
+ const factory$2 = (state = initialState$2) => toolkit.createSlice({
124
+ name: name$2,
125
+ initialState: state,
126
+ reducers: {
127
+ setGlobalShortcuts: (state, action) => {
128
+ state.global = action.payload;
129
+ },
130
+ toggleGlobalShortcuts: (state, _action) => {
131
+ state.global = !state.global;
132
+ }
133
+ }
134
+ });
205
135
 
206
- const reducer$2 = (state = initialState$2, action) => {
207
- switch (action.type) {
208
- case TOGGLE_GLOBAL_SHORTCUTS:
209
- return resolvers$2.toggleGlobalShortcuts(state, action);
136
+ const slice$2 = factory$2();
210
137
 
211
- default:
212
- return Object.assign({}, state);
213
- }
214
- };
138
+ const actions$2 = slice$2.actions;
215
139
 
216
140
  const getGlobal = state => state.shortcuts.global;
217
141
 
@@ -219,81 +143,46 @@ const selectors$2 = {
219
143
  getGlobal: getGlobal
220
144
  };
221
145
 
222
- var index$4 = Object.freeze({
146
+ const reducer$2 = slice$2.reducer;
147
+
148
+ var index$2 = Object.freeze({
223
149
  __proto__: null,
150
+ factory: factory$2,
151
+ slice: slice$2,
224
152
  actions: actions$2,
225
- initialState: initialState$2,
226
- reducer: reducer$2,
227
153
  selectors: selectors$2,
228
- Types: index$5
229
- });
230
-
231
- const SET_SITTING_CURRENT_LINK = "SET_SITTING_CURRENT_LINK";
232
-
233
- const TOGGLE_SITTING_TRAY = "TOGGLE_SITTING_TRAY";
234
-
235
- var index$3 = Object.freeze({
236
- __proto__: null,
237
- SET_SITTING_CURRENT_LINK: SET_SITTING_CURRENT_LINK,
238
- TOGGLE_SITTING_TRAY: TOGGLE_SITTING_TRAY
239
- });
240
-
241
- const setSittingCurrentLink$1 = link => ({
242
- type: SET_SITTING_CURRENT_LINK,
243
- payload: link
244
- });
245
-
246
- const toggleSittingTray$1 = () => ({
247
- type: TOGGLE_SITTING_TRAY
154
+ reducer: reducer$2
248
155
  });
249
156
 
250
- const actions$1 = {
251
- setSittingCurrentLink: setSittingCurrentLink$1,
252
- toggleSittingTray: toggleSittingTray$1
253
- };
254
-
255
157
  const initialState$1 = {
256
158
  currentLink: "",
257
159
  tray: false
258
160
  };
259
161
 
260
- const setSittingCurrentLink = (state, action) => {
261
- const currentLink = action.payload;
262
- return Object.assign(Object.assign({}, state), {
263
- currentLink: currentLink
264
- });
265
- };
266
-
267
- const toggleSittingTray = (state, action) => {
268
- if (typeof action.payload === "boolean") {
269
- return Object.assign(Object.assign({}, state), {
270
- tray: action.payload
271
- });
162
+ const name$1 = "sitting";
163
+
164
+ const factory$1 = (state = initialState$1) => toolkit.createSlice({
165
+ name: name$1,
166
+ initialState: state,
167
+ reducers: {
168
+ setSittingCurrentLink: (state, action) => {
169
+ const currentLink = action.payload;
170
+ return Object.assign(Object.assign({}, state), {
171
+ currentLink: currentLink
172
+ });
173
+ },
174
+ setSittingTray: (state, action) => {
175
+ state.tray = action.payload;
176
+ },
177
+ toggleSittingTray: (state, _action) => {
178
+ state.tray = !state.tray;
179
+ }
272
180
  }
273
- return Object.assign(Object.assign({}, state), {
274
- tray: !state.tray
275
- });
276
- };
277
-
278
- const resolvers$1 = {
279
- setSittingCurrentLink: setSittingCurrentLink,
280
- toggleSittingTray: toggleSittingTray
281
- };
181
+ });
282
182
 
283
- const reducer$1 = (state = initialState$1, action) => {
284
- switch (action.type) {
285
- case SET_SITTING_CURRENT_LINK:
286
- return resolvers$1.setSittingCurrentLink(state, action);
183
+ const slice$1 = factory$1();
287
184
 
288
- case TOGGLE_SITTING_TRAY:
289
- return resolvers$1.toggleSittingTray(state, action);
290
-
291
- default:
292
- return Object.assign({}, state);
293
- }
294
- };
295
-
296
- const metareducer$1 = initialState => (state = initialState, action) => reducer$1(state, action);
185
+ const actions$1 = slice$1.actions;
297
186
 
298
187
  const getCurrentLink = state => state.sitting.currentLink;
299
188
 
@@ -304,59 +193,44 @@ const selectors$1 = {
304
193
  getTray: getTray
305
194
  };
306
195
 
307
- var index$2 = Object.freeze({
308
- __proto__: null,
309
- actions: actions$1,
310
- initialState: initialState$1,
311
- reducer: reducer$1,
312
- metareducer: metareducer$1,
313
- selectors: selectors$1,
314
- Types: index$3
315
- });
316
-
317
- const SET_THEME = "SET_THEME";
196
+ const reducer$1 = slice$1.reducer;
318
197
 
319
198
  var index$1 = Object.freeze({
320
199
  __proto__: null,
321
- SET_THEME: SET_THEME
322
- });
323
-
324
- const setTheme$1 = payload => ({
325
- type: SET_THEME,
326
- payload: payload
200
+ factory: factory$1,
201
+ slice: slice$1,
202
+ actions: actions$1,
203
+ selectors: selectors$1,
204
+ reducer: reducer$1
327
205
  });
328
206
 
329
- const actions = {
330
- setTheme: setTheme$1
331
- };
332
-
333
207
  const initialState = {
334
208
  general: Object.assign({}, pluridThemes.plurid),
335
209
  interaction: Object.assign({}, pluridThemes.plurid)
336
210
  };
337
211
 
338
- const setTheme = (state, action) => {
339
- const {type: type, theme: theme} = action.payload;
340
- const newState = Object.assign({}, state);
341
- newState[type] = Object.assign({}, theme);
342
- return newState;
343
- };
344
-
345
- const resolvers = {
346
- setTheme: setTheme
347
- };
348
-
349
- const reducer = (state = initialState, action) => {
350
- switch (action.type) {
351
- case SET_THEME:
352
- return resolvers.setTheme(state, action);
353
-
354
- default:
355
- return Object.assign({}, state);
212
+ const name = "themes";
213
+
214
+ const factory = (state = initialState) => toolkit.createSlice({
215
+ name: name,
216
+ initialState: state,
217
+ reducers: {
218
+ setTheme: (state, action) => {
219
+ const {type: type, theme: theme} = action.payload;
220
+ state[type] = theme;
221
+ },
222
+ setGeneralTheme: (state, action) => {
223
+ state.general = action.payload;
224
+ },
225
+ setInteractionTheme: (state, action) => {
226
+ state.interaction = action.payload;
227
+ }
356
228
  }
357
- };
229
+ });
230
+
231
+ const slice = factory();
358
232
 
359
- const metareducer = initialState => (state = initialState, action) => reducer(state, action);
233
+ const actions = slice.actions;
360
234
 
361
235
  const getGeneralTheme = state => state.themes.general;
362
236
 
@@ -367,23 +241,24 @@ const selectors = {
367
241
  getInteractionTheme: getInteractionTheme
368
242
  };
369
243
 
244
+ const reducer = slice.reducer;
245
+
370
246
  var index = Object.freeze({
371
247
  __proto__: null,
248
+ factory: factory,
249
+ slice: slice,
372
250
  actions: actions,
373
- initialState: initialState,
374
- reducer: reducer,
375
- metareducer: metareducer,
376
251
  selectors: selectors,
377
- Types: index$1
252
+ reducer: reducer
378
253
  });
379
254
 
380
- exports.head = index$8;
255
+ exports.head = index$4;
381
256
 
382
- exports.notifications = index$6;
257
+ exports.notifications = index$3;
383
258
 
384
- exports.shortcuts = index$4;
259
+ exports.shortcuts = index$2;
385
260
 
386
- exports.sitting = index$2;
261
+ exports.sitting = index$1;
387
262
 
388
263
  exports.themes = index;
389
264
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.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 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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;ACFzB,MAAMC,aACF/D,YAEO;IACHC,MAAM+D;IACNhE,SAAAA;;;AAMR,MAAMG,UAAU;cACZ4D;;;ACLJ,MAAM3D,eAA4B;IAC9B6D,SAAOjD,OAAAC,OAAA,IACAiD,aAAAA;IAEPC,aAAWnD,OAAAC,OAAA,IACJiD,aAAAA;;;ACZX,MAAMH,WAAW,CACbjD,OACAC;IAEA,OAAMd,MACFA,MAAImE,OACJA,SACArD,OAAOf;IAEX,MAAMsC,WAAQtB,OAAAC,OAAA,IACPH;IAGPwB,SAASrC,QACFe,OAAAC,OAAA,IAAAmD;IAGP,OAAO9B;;;AAKX,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.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\nconst initialState: HeadState = {\n title: '',\n description: '',\n ogTitle: '',\n ogImage: '',\n ogURL: '',\n ogDescription: '',\n canonicalURL: '',\n styles: [],\n scripts: [],\n};\n\nconst 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 StateWithSlice,\n } from '~data/interfaces';\n // #endregion external\n// #endregion imports\n\n\n\n// #region module\nexport type NotificationsState = Notification[];\n\n\nconst initialState: NotificationsState = [];\n\nconst name = 'notifications' as const;\n\n\nexport const factory = (\n state: NotificationsState = initialState,\n) => createSlice({\n name,\n initialState: state,\n reducers: {\n addNotification: (\n state,\n action: PayloadAction<Notification>,\n ) => {\n const newNotification: Notification = {\n ...action.payload,\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 updateNotification: (\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 removeNotification: (\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\nconst initialState: ShortcutsState = {\n global: true,\n};\n\nconst 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\nconst initialState: SittingState = {\n currentLink: '',\n tray: false,\n};\n\nconst 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\nconst initialState: ThemesState = {\n general: {\n ...plurid,\n },\n interaction: {\n ...plurid,\n },\n};\n\nconst 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","addNotification","newNotification","payload","existingNotification","find","notification","id","map","updateNotification","message","removeNotification","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":";;;;;;;;;;;;AAgCA,MAAMA,iBAA0B;IAC5BC,OAAO;IACPC,aAAa;IACbC,SAAS;IACTC,SAAS;IACTC,OAAO;IACPC,eAAe;IACfC,cAAc;IACdC,QAAQ;IACRC,SAAS;;;AAGb,MAAMC,SAAO;;AAGN,MAAMC,YAAU,CACnBC,QAAmBZ,mBAClBa,oBAAY;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;;;;;;;;;;;;AC5D7B,MAAMxB,iBAAmC;;AAEzC,MAAMU,SAAO;;AAGN,MAAMC,YAAU,CACnBC,QAA4BZ,mBAC3Ba,oBAAY;UACbH;IACAV,cAAcY;IACdE,UAAU;QACNW,iBAAiB,CACbb,OACAI;YAEA,MAAMU,kBACCT,OAAAC,OAAA,IAAAF,OAAOW;YAGd,MAAMC,uBAAuBhB,MAAMiB,MAC/BC,gBAAgBA,aAAaC,OAAOL,gBAAgBK;YAGxD,IAAIH,sBAAsB;gBACtBhB,QA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from './actions';
2
- import initialState from './initial';
3
- import { reducer, metareducer } from './reducer';
4
- import selectors from './selectors';
5
- import * as Types from './types';
6
- export { actions, initialState, reducer, metareducer, selectors, Types, };
1
+ import { PayloadAction } from '@reduxjs/toolkit';
2
+ import { StateWithSlice } from "../../data/interfaces";
3
+ export interface HeadState {
4
+ title: string;
5
+ description: string;
6
+ canonicalURL: string;
7
+ ogTitle: string;
8
+ ogImage: string;
9
+ ogURL: string;
10
+ ogDescription: string;
11
+ styles: string[];
12
+ scripts: string[];
13
+ }
14
+ declare const name: "head";
15
+ export declare const factory: (state?: HeadState) => import("@reduxjs/toolkit").Slice<HeadState, {
16
+ setHead: (state: import("immer/dist/internal").WritableDraft<HeadState>, action: PayloadAction<Partial<HeadState>>) => void;
17
+ }, "head">;
18
+ export declare const slice: import("@reduxjs/toolkit").Slice<HeadState, {
19
+ setHead: (state: import("immer/dist/internal").WritableDraft<HeadState>, action: PayloadAction<Partial<HeadState>>) => void;
20
+ }, "head">;
21
+ export declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
22
+ setHead: (state: import("immer/dist/internal").WritableDraft<HeadState>, action: PayloadAction<Partial<HeadState>>) => void;
23
+ }>;
24
+ export declare const getHead: (state: StateWithSlice<typeof name, HeadState>) => HeadState;
25
+ export declare const selectors: {
26
+ getHead: (state: StateWithSlice<typeof name, HeadState>) => HeadState;
27
+ };
28
+ export declare const reducer: import("@reduxjs/toolkit").Reducer<HeadState, import("@reduxjs/toolkit").AnyAction>;
29
+ export {};