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