@plurid/plurid-ui-state-react 0.0.0-1 → 0.0.0-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distribution/data/interfaces/index.d.ts +15 -0
- package/distribution/index.d.ts +1 -0
- package/distribution/index.es.js +154 -245
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +157 -252
- package/distribution/index.js.map +1 -1
- package/distribution/modules/head/index.d.ts +29 -6
- package/distribution/modules/notifications/index.d.ts +27 -6
- package/distribution/modules/shortcuts/index.d.ts +23 -6
- package/distribution/modules/sitting/index.d.ts +37 -6
- package/distribution/modules/themes/index.d.ts +33 -6
- package/package.json +21 -17
- package/distribution/modules/head/actions/index.d.ts +0 -5
- package/distribution/modules/head/initial/index.d.ts +0 -3
- package/distribution/modules/head/reducer/index.d.ts +0 -4
- package/distribution/modules/head/resolvers/index.d.ts +0 -5
- package/distribution/modules/head/selectors/index.d.ts +0 -6
- package/distribution/modules/head/types/index.d.ts +0 -21
- package/distribution/modules/notifications/actions/index.d.ts +0 -7
- package/distribution/modules/notifications/initial/index.d.ts +0 -3
- package/distribution/modules/notifications/reducer/index.d.ts +0 -3
- package/distribution/modules/notifications/resolvers/index.d.ts +0 -7
- package/distribution/modules/notifications/selectors/index.d.ts +0 -6
- package/distribution/modules/notifications/types/index.d.ts +0 -31
- package/distribution/modules/shortcuts/actions/index.d.ts +0 -5
- package/distribution/modules/shortcuts/initial/index.d.ts +0 -3
- package/distribution/modules/shortcuts/reducer/index.d.ts +0 -3
- package/distribution/modules/shortcuts/resolvers/index.d.ts +0 -7
- package/distribution/modules/shortcuts/selectors/index.d.ts +0 -6
- package/distribution/modules/shortcuts/types/index.d.ts +0 -9
- package/distribution/modules/sitting/actions/index.d.ts +0 -6
- package/distribution/modules/sitting/initial/index.d.ts +0 -3
- package/distribution/modules/sitting/reducer/index.d.ts +0 -4
- package/distribution/modules/sitting/resolvers/index.d.ts +0 -6
- package/distribution/modules/sitting/selectors/index.d.ts +0 -7
- package/distribution/modules/sitting/types/index.d.ts +0 -15
- package/distribution/modules/themes/actions/index.d.ts +0 -5
- package/distribution/modules/themes/initial/index.d.ts +0 -3
- package/distribution/modules/themes/reducer/index.d.ts +0 -4
- package/distribution/modules/themes/resolvers/index.d.ts +0 -5
- package/distribution/modules/themes/selectors/index.d.ts +0 -7
- package/distribution/modules/themes/types/index.d.ts +0 -15
package/distribution/index.js
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var pluridThemes = require("@plurid/plurid-themes");
|
|
8
|
-
|
|
9
|
-
const SET_HEAD = "SET_HEAD";
|
|
10
|
-
|
|
11
|
-
var index$9 = Object.freeze({
|
|
12
|
-
__proto__: null,
|
|
13
|
-
SET_HEAD: SET_HEAD
|
|
14
|
-
});
|
|
3
|
+
require("immer");
|
|
15
4
|
|
|
16
|
-
|
|
17
|
-
type: SET_HEAD,
|
|
18
|
-
payload: payload
|
|
19
|
-
});
|
|
5
|
+
var toolkit = require("@reduxjs/toolkit");
|
|
20
6
|
|
|
21
|
-
|
|
22
|
-
setHead: setHead$1
|
|
23
|
-
};
|
|
7
|
+
var pluridThemes = require("@plurid/plurid-themes");
|
|
24
8
|
|
|
25
9
|
const initialState$4 = {
|
|
26
10
|
title: "",
|
|
@@ -34,118 +18,96 @@ const initialState$4 = {
|
|
|
34
18
|
scripts: []
|
|
35
19
|
};
|
|
36
20
|
|
|
37
|
-
const
|
|
21
|
+
const name$4 = "head";
|
|
38
22
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return resolvers$4.setHead(state, action);
|
|
47
|
-
|
|
48
|
-
default:
|
|
49
|
-
return Object.assign({}, state);
|
|
23
|
+
const factory$4 = (state = initialState$4) => toolkit.createSlice({
|
|
24
|
+
name: name$4,
|
|
25
|
+
initialState: state,
|
|
26
|
+
reducers: {
|
|
27
|
+
setHead: (state, action) => {
|
|
28
|
+
state = Object.assign(Object.assign({}, state), action);
|
|
29
|
+
}
|
|
50
30
|
}
|
|
51
|
-
};
|
|
31
|
+
});
|
|
52
32
|
|
|
53
|
-
const
|
|
33
|
+
const slice$4 = factory$4();
|
|
54
34
|
|
|
55
|
-
const
|
|
35
|
+
const actions$4 = slice$4.actions;
|
|
36
|
+
|
|
37
|
+
const getHead = state => state.head;
|
|
56
38
|
|
|
57
39
|
const selectors$4 = {
|
|
58
|
-
|
|
40
|
+
getHead: getHead
|
|
59
41
|
};
|
|
60
42
|
|
|
61
|
-
|
|
43
|
+
const reducer$4 = slice$4.reducer;
|
|
44
|
+
|
|
45
|
+
var index$4 = Object.freeze({
|
|
62
46
|
__proto__: null,
|
|
63
47
|
actions: actions$4,
|
|
48
|
+
factory: factory$4,
|
|
49
|
+
getHead: getHead,
|
|
64
50
|
initialState: initialState$4,
|
|
51
|
+
name: name$4,
|
|
65
52
|
reducer: reducer$4,
|
|
66
|
-
metareducer: metareducer$2,
|
|
67
53
|
selectors: selectors$4,
|
|
68
|
-
|
|
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
|
|
54
|
+
slice: slice$4
|
|
97
55
|
});
|
|
98
56
|
|
|
99
|
-
const actions$3 = {
|
|
100
|
-
addNotification: addNotification$1,
|
|
101
|
-
updateNotification: updateNotification$1,
|
|
102
|
-
removeNotification: removeNotification$1
|
|
103
|
-
};
|
|
104
|
-
|
|
105
57
|
const initialState$3 = [];
|
|
106
58
|
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
59
|
+
const name$3 = "notifications";
|
|
60
|
+
|
|
61
|
+
const factory$3 = (state = initialState$3) => toolkit.createSlice({
|
|
62
|
+
name: name$3,
|
|
63
|
+
initialState: state,
|
|
64
|
+
reducers: {
|
|
65
|
+
new: (state, action) => {
|
|
66
|
+
const id = Math.random() + "";
|
|
67
|
+
const text = action.payload;
|
|
68
|
+
const newNotification = {
|
|
69
|
+
id: id,
|
|
70
|
+
text: text
|
|
71
|
+
};
|
|
72
|
+
return [ ...state, newNotification ];
|
|
73
|
+
},
|
|
74
|
+
add: (state, action) => {
|
|
75
|
+
const id = action.payload.id || Math.random() + "";
|
|
76
|
+
const newNotification = Object.assign(Object.assign({}, action.payload), {
|
|
77
|
+
id: id
|
|
78
|
+
});
|
|
79
|
+
const existingNotification = state.find((notification => notification.id === newNotification.id));
|
|
80
|
+
if (existingNotification) {
|
|
81
|
+
const newState = state.map((notification => {
|
|
82
|
+
if (notification.id === newNotification.id) {
|
|
83
|
+
return newNotification;
|
|
84
|
+
}
|
|
85
|
+
return notification;
|
|
86
|
+
}));
|
|
87
|
+
return newState;
|
|
88
|
+
}
|
|
89
|
+
return [ ...state, newNotification ];
|
|
90
|
+
},
|
|
91
|
+
update: (state, action) => {
|
|
92
|
+
const newState = state.map((message => {
|
|
93
|
+
if (message.id === action.payload.id) {
|
|
94
|
+
const newNotification = Object.assign({}, action.payload);
|
|
95
|
+
return newNotification;
|
|
96
|
+
}
|
|
97
|
+
return Object.assign({}, message);
|
|
98
|
+
}));
|
|
99
|
+
return newState;
|
|
100
|
+
},
|
|
101
|
+
remove: (state, action) => {
|
|
102
|
+
const newState = state.filter((message => message.id !== action.payload));
|
|
103
|
+
return newState;
|
|
117
104
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return [ ...updatedState ];
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const removeNotification = (state, action) => {
|
|
124
|
-
const updatedState = state.filter((notification => notification.id !== action.payload.id));
|
|
125
|
-
return [ ...updatedState ];
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const resolvers$3 = {
|
|
129
|
-
addNotification: addNotification,
|
|
130
|
-
updateNotification: updateNotification,
|
|
131
|
-
removeNotification: removeNotification
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const reducer$3 = (state = initialState$3, action) => {
|
|
135
|
-
switch (action.type) {
|
|
136
|
-
case ADD_NOTIFICATION:
|
|
137
|
-
return resolvers$3.addNotification(state, action);
|
|
138
|
-
|
|
139
|
-
case UPDATE_NOTIFICATION:
|
|
140
|
-
return resolvers$3.updateNotification(state, action);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
141
107
|
|
|
142
|
-
|
|
143
|
-
return resolvers$3.removeNotification(state, action);
|
|
108
|
+
const slice$3 = factory$3();
|
|
144
109
|
|
|
145
|
-
|
|
146
|
-
return [ ...state ];
|
|
147
|
-
}
|
|
148
|
-
};
|
|
110
|
+
const actions$3 = slice$3.actions;
|
|
149
111
|
|
|
150
112
|
const getAll = state => state.notifications;
|
|
151
113
|
|
|
@@ -153,55 +115,41 @@ const selectors$3 = {
|
|
|
153
115
|
getAll: getAll
|
|
154
116
|
};
|
|
155
117
|
|
|
156
|
-
|
|
118
|
+
const reducer$3 = slice$3.reducer;
|
|
119
|
+
|
|
120
|
+
var index$3 = Object.freeze({
|
|
157
121
|
__proto__: null,
|
|
158
122
|
actions: actions$3,
|
|
123
|
+
factory: factory$3,
|
|
159
124
|
initialState: initialState$3,
|
|
125
|
+
name: name$3,
|
|
160
126
|
reducer: reducer$3,
|
|
161
127
|
selectors: selectors$3,
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
const TOGGLE_GLOBAL_SHORTCUTS = "TOGGLE_GLOBAL_SHORTCUTS";
|
|
166
|
-
|
|
167
|
-
var index$5 = Object.freeze({
|
|
168
|
-
__proto__: null,
|
|
169
|
-
TOGGLE_GLOBAL_SHORTCUTS: TOGGLE_GLOBAL_SHORTCUTS
|
|
128
|
+
slice: slice$3
|
|
170
129
|
});
|
|
171
130
|
|
|
172
|
-
const toggleGlobalShortcuts$1 = payload => ({
|
|
173
|
-
type: TOGGLE_GLOBAL_SHORTCUTS,
|
|
174
|
-
payload: payload
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const actions$2 = {
|
|
178
|
-
toggleGlobalShortcuts: toggleGlobalShortcuts$1
|
|
179
|
-
};
|
|
180
|
-
|
|
181
131
|
const initialState$2 = {
|
|
182
132
|
global: true
|
|
183
133
|
};
|
|
184
134
|
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
135
|
+
const name$2 = "shortcuts";
|
|
136
|
+
|
|
137
|
+
const factory$2 = (state = initialState$2) => toolkit.createSlice({
|
|
138
|
+
name: name$2,
|
|
139
|
+
initialState: state,
|
|
140
|
+
reducers: {
|
|
141
|
+
setGlobalShortcuts: (state, action) => {
|
|
142
|
+
state.global = action.payload;
|
|
143
|
+
},
|
|
144
|
+
toggleGlobalShortcuts: (state, _action) => {
|
|
145
|
+
state.global = !state.global;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
195
149
|
|
|
196
|
-
const
|
|
197
|
-
switch (action.type) {
|
|
198
|
-
case TOGGLE_GLOBAL_SHORTCUTS:
|
|
199
|
-
return resolvers$2.toggleGlobalShortcuts(state, action);
|
|
150
|
+
const slice$2 = factory$2();
|
|
200
151
|
|
|
201
|
-
|
|
202
|
-
return Object.assign({}, state);
|
|
203
|
-
}
|
|
204
|
-
};
|
|
152
|
+
const actions$2 = slice$2.actions;
|
|
205
153
|
|
|
206
154
|
const getGlobal = state => state.shortcuts.global;
|
|
207
155
|
|
|
@@ -209,81 +157,48 @@ const selectors$2 = {
|
|
|
209
157
|
getGlobal: getGlobal
|
|
210
158
|
};
|
|
211
159
|
|
|
212
|
-
|
|
160
|
+
const reducer$2 = slice$2.reducer;
|
|
161
|
+
|
|
162
|
+
var index$2 = Object.freeze({
|
|
213
163
|
__proto__: null,
|
|
214
164
|
actions: actions$2,
|
|
165
|
+
factory: factory$2,
|
|
215
166
|
initialState: initialState$2,
|
|
167
|
+
name: name$2,
|
|
216
168
|
reducer: reducer$2,
|
|
217
169
|
selectors: selectors$2,
|
|
218
|
-
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
const SET_SITTING_CURRENT_LINK = "SET_SITTING_CURRENT_LINK";
|
|
222
|
-
|
|
223
|
-
const TOGGLE_SITTING_TRAY = "TOGGLE_SITTING_TRAY";
|
|
224
|
-
|
|
225
|
-
var index$3 = Object.freeze({
|
|
226
|
-
__proto__: null,
|
|
227
|
-
SET_SITTING_CURRENT_LINK: SET_SITTING_CURRENT_LINK,
|
|
228
|
-
TOGGLE_SITTING_TRAY: TOGGLE_SITTING_TRAY
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
const setSittingCurrentLink$1 = link => ({
|
|
232
|
-
type: SET_SITTING_CURRENT_LINK,
|
|
233
|
-
payload: link
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
const toggleSittingTray$1 = () => ({
|
|
237
|
-
type: TOGGLE_SITTING_TRAY
|
|
170
|
+
slice: slice$2
|
|
238
171
|
});
|
|
239
172
|
|
|
240
|
-
const actions$1 = {
|
|
241
|
-
setSittingCurrentLink: setSittingCurrentLink$1,
|
|
242
|
-
toggleSittingTray: toggleSittingTray$1
|
|
243
|
-
};
|
|
244
|
-
|
|
245
173
|
const initialState$1 = {
|
|
246
174
|
currentLink: "",
|
|
247
175
|
tray: false
|
|
248
176
|
};
|
|
249
177
|
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
178
|
+
const name$1 = "sitting";
|
|
179
|
+
|
|
180
|
+
const factory$1 = (state = initialState$1) => toolkit.createSlice({
|
|
181
|
+
name: name$1,
|
|
182
|
+
initialState: state,
|
|
183
|
+
reducers: {
|
|
184
|
+
setSittingCurrentLink: (state, action) => {
|
|
185
|
+
const currentLink = action.payload;
|
|
186
|
+
return Object.assign(Object.assign({}, state), {
|
|
187
|
+
currentLink: currentLink
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
setSittingTray: (state, action) => {
|
|
191
|
+
state.tray = action.payload;
|
|
192
|
+
},
|
|
193
|
+
toggleSittingTray: (state, _action) => {
|
|
194
|
+
state.tray = !state.tray;
|
|
195
|
+
}
|
|
262
196
|
}
|
|
263
|
-
|
|
264
|
-
tray: !state.tray
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const resolvers$1 = {
|
|
269
|
-
setSittingCurrentLink: setSittingCurrentLink,
|
|
270
|
-
toggleSittingTray: toggleSittingTray
|
|
271
|
-
};
|
|
197
|
+
});
|
|
272
198
|
|
|
273
|
-
const
|
|
274
|
-
switch (action.type) {
|
|
275
|
-
case SET_SITTING_CURRENT_LINK:
|
|
276
|
-
return resolvers$1.setSittingCurrentLink(state, action);
|
|
199
|
+
const slice$1 = factory$1();
|
|
277
200
|
|
|
278
|
-
|
|
279
|
-
return resolvers$1.toggleSittingTray(state, action);
|
|
280
|
-
|
|
281
|
-
default:
|
|
282
|
-
return Object.assign({}, state);
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
const metareducer$1 = initialState => (state = initialState, action) => reducer$1(state, action);
|
|
201
|
+
const actions$1 = slice$1.actions;
|
|
287
202
|
|
|
288
203
|
const getCurrentLink = state => state.sitting.currentLink;
|
|
289
204
|
|
|
@@ -294,59 +209,46 @@ const selectors$1 = {
|
|
|
294
209
|
getTray: getTray
|
|
295
210
|
};
|
|
296
211
|
|
|
297
|
-
|
|
212
|
+
const reducer$1 = slice$1.reducer;
|
|
213
|
+
|
|
214
|
+
var index$1 = Object.freeze({
|
|
298
215
|
__proto__: null,
|
|
299
216
|
actions: actions$1,
|
|
217
|
+
factory: factory$1,
|
|
300
218
|
initialState: initialState$1,
|
|
219
|
+
name: name$1,
|
|
301
220
|
reducer: reducer$1,
|
|
302
|
-
metareducer: metareducer$1,
|
|
303
221
|
selectors: selectors$1,
|
|
304
|
-
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
const SET_THEME = "SET_THEME";
|
|
308
|
-
|
|
309
|
-
var index$1 = Object.freeze({
|
|
310
|
-
__proto__: null,
|
|
311
|
-
SET_THEME: SET_THEME
|
|
222
|
+
slice: slice$1
|
|
312
223
|
});
|
|
313
224
|
|
|
314
|
-
const setTheme$1 = payload => ({
|
|
315
|
-
type: SET_THEME,
|
|
316
|
-
payload: payload
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
const actions = {
|
|
320
|
-
setTheme: setTheme$1
|
|
321
|
-
};
|
|
322
|
-
|
|
323
225
|
const initialState = {
|
|
324
226
|
general: Object.assign({}, pluridThemes.plurid),
|
|
325
227
|
interaction: Object.assign({}, pluridThemes.plurid)
|
|
326
228
|
};
|
|
327
229
|
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
default:
|
|
345
|
-
return Object.assign({}, state);
|
|
230
|
+
const name = "themes";
|
|
231
|
+
|
|
232
|
+
const factory = (state = initialState) => toolkit.createSlice({
|
|
233
|
+
name: name,
|
|
234
|
+
initialState: state,
|
|
235
|
+
reducers: {
|
|
236
|
+
setTheme: (state, action) => {
|
|
237
|
+
const {type: type, theme: theme} = action.payload;
|
|
238
|
+
state[type] = theme;
|
|
239
|
+
},
|
|
240
|
+
setGeneralTheme: (state, action) => {
|
|
241
|
+
state.general = action.payload;
|
|
242
|
+
},
|
|
243
|
+
setInteractionTheme: (state, action) => {
|
|
244
|
+
state.interaction = action.payload;
|
|
245
|
+
}
|
|
346
246
|
}
|
|
347
|
-
};
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
const slice = factory();
|
|
348
250
|
|
|
349
|
-
const
|
|
251
|
+
const actions = slice.actions;
|
|
350
252
|
|
|
351
253
|
const getGeneralTheme = state => state.themes.general;
|
|
352
254
|
|
|
@@ -357,23 +259,26 @@ const selectors = {
|
|
|
357
259
|
getInteractionTheme: getInteractionTheme
|
|
358
260
|
};
|
|
359
261
|
|
|
262
|
+
const reducer = slice.reducer;
|
|
263
|
+
|
|
360
264
|
var index = Object.freeze({
|
|
361
265
|
__proto__: null,
|
|
362
266
|
actions: actions,
|
|
267
|
+
factory: factory,
|
|
363
268
|
initialState: initialState,
|
|
269
|
+
name: name,
|
|
364
270
|
reducer: reducer,
|
|
365
|
-
metareducer: metareducer,
|
|
366
271
|
selectors: selectors,
|
|
367
|
-
|
|
272
|
+
slice: slice
|
|
368
273
|
});
|
|
369
274
|
|
|
370
|
-
exports.head = index$
|
|
275
|
+
exports.head = index$4;
|
|
371
276
|
|
|
372
|
-
exports.notifications = index$
|
|
277
|
+
exports.notifications = index$3;
|
|
373
278
|
|
|
374
|
-
exports.shortcuts = index$
|
|
279
|
+
exports.shortcuts = index$2;
|
|
375
280
|
|
|
376
|
-
exports.sitting = index$
|
|
281
|
+
exports.sitting = index$1;
|
|
377
282
|
|
|
378
283
|
exports.themes = index;
|
|
379
284
|
//# 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 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,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;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.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,oBAAY;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,oBAAY;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,KAAKC,WAAW;YAEhD,MAAMG,kDACCf,OAAOc,UACV;gBAAAJ;;YAGJ,MAAMO,uBAAuBrB,MAAMsB,MAC/BC,gBAAgBA,aAAaT,OAAOK,gBAAgBL;YAGxD,IAAIO,sBAAsB;gBACtB,MAAMG,WAAWxB,MAAMyB,KAAIF;oBACvB,IAAIA,aAAaT,OAAOK,gBAAgBL,IAAI;wBACxC,OAAOK;AACV;oBAED,OAA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29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
+
export declare const initialState: HeadState;
|
|
15
|
+
export declare const name: "head";
|
|
16
|
+
export declare const factory: (state?: HeadState) => import("@reduxjs/toolkit").Slice<HeadState, {
|
|
17
|
+
setHead: (state: import("immer/dist/internal").WritableDraft<HeadState>, action: PayloadAction<Partial<HeadState>>) => void;
|
|
18
|
+
}, "head">;
|
|
19
|
+
export declare const slice: import("@reduxjs/toolkit").Slice<HeadState, {
|
|
20
|
+
setHead: (state: import("immer/dist/internal").WritableDraft<HeadState>, action: PayloadAction<Partial<HeadState>>) => void;
|
|
21
|
+
}, "head">;
|
|
22
|
+
export declare const actions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
23
|
+
setHead: (state: import("immer/dist/internal").WritableDraft<HeadState>, action: PayloadAction<Partial<HeadState>>) => void;
|
|
24
|
+
}, "head">;
|
|
25
|
+
export declare const getHead: (state: StateWithSlice<typeof name, HeadState>) => HeadState;
|
|
26
|
+
export declare const selectors: {
|
|
27
|
+
getHead: (state: StateWithSlice<typeof name, HeadState>) => HeadState;
|
|
28
|
+
};
|
|
29
|
+
export declare const reducer: import("@reduxjs/toolkit").Reducer<HeadState, import("@reduxjs/toolkit").AnyAction>;
|