@ws-ui/store 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +3 -1
  2. package/dist/hooks/index.d.ts +1 -0
  3. package/dist/hooks/store.d.ts +94 -0
  4. package/dist/index.cjs.js +157 -0
  5. package/dist/index.cjs.js.map +1 -0
  6. package/dist/index.d.ts +6 -86
  7. package/dist/index.es.js +15729 -0
  8. package/dist/index.es.js.map +1 -0
  9. package/dist/modules/catalog/index.d.ts +13 -0
  10. package/dist/modules/catalog/reducer.d.ts +20 -0
  11. package/dist/modules/catalog/thunks.d.ts +4 -0
  12. package/dist/modules/catalog/types.d.ts +1 -0
  13. package/dist/modules/debugger/index.d.ts +6 -0
  14. package/dist/modules/debugger/reducer.d.ts +121 -0
  15. package/dist/modules/debugger/thunks.d.ts +11 -0
  16. package/dist/modules/debugger/types.d.ts +226 -0
  17. package/dist/modules/debugger/utils.d.ts +3 -0
  18. package/dist/modules/explorer/index.d.ts +6 -0
  19. package/dist/modules/explorer/reducer.d.ts +38 -0
  20. package/dist/modules/explorer/thunks.d.ts +263 -0
  21. package/dist/modules/explorer/types.d.ts +56 -0
  22. package/dist/modules/explorer/utils.d.ts +4 -0
  23. package/dist/modules/index.d.ts +52 -0
  24. package/dist/modules/modals/index.d.ts +5 -0
  25. package/dist/modules/modals/reducer.d.ts +17 -0
  26. package/dist/modules/modals/thunks.d.ts +12 -0
  27. package/dist/modules/modals/types.d.ts +69 -0
  28. package/dist/modules/model/helpers.d.ts +12 -0
  29. package/dist/modules/model/index.d.ts +8 -0
  30. package/dist/modules/model/reducer.d.ts +33 -0
  31. package/dist/modules/model/selectors.d.ts +12 -0
  32. package/dist/modules/model/subjects.d.ts +6 -0
  33. package/dist/modules/model/thunks.d.ts +55 -0
  34. package/dist/modules/model/types.d.ts +97 -0
  35. package/dist/modules/roles/__tests__/adapter.test.d.ts +1 -0
  36. package/dist/modules/roles/adapter.d.ts +179 -0
  37. package/dist/modules/roles/index.d.ts +21 -0
  38. package/dist/modules/roles/reducer.d.ts +64 -0
  39. package/dist/modules/roles/thunks.d.ts +24 -0
  40. package/dist/modules/roles/types.d.ts +86 -0
  41. package/dist/modules/root/index.d.ts +5 -0
  42. package/dist/modules/root/reducer.d.ts +153 -0
  43. package/dist/modules/root/thunks.d.ts +117 -0
  44. package/dist/modules/root/types.d.ts +59 -0
  45. package/dist/modules/settings/index.d.ts +5 -0
  46. package/dist/modules/settings/reducer.d.ts +45 -0
  47. package/dist/modules/settings/thunks.d.ts +7 -0
  48. package/dist/modules/settings/types.d.ts +7 -0
  49. package/dist/modules/settings/utils.d.ts +2 -0
  50. package/dist/modules/shared-css/index.d.ts +5 -0
  51. package/dist/modules/shared-css/reducer.d.ts +21 -0
  52. package/dist/modules/shared-css/thunks.d.ts +6 -0
  53. package/dist/modules/shared-css/types.d.ts +1 -0
  54. package/dist/modules/shared-datasources/index.d.ts +5 -0
  55. package/dist/modules/shared-datasources/reducer.d.ts +18 -0
  56. package/dist/modules/shared-datasources/thunks.d.ts +32 -0
  57. package/dist/modules/shared-datasources/types.d.ts +1 -0
  58. package/dist/modules/tabs/index.d.ts +5 -0
  59. package/dist/modules/tabs/reducer.d.ts +4 -0
  60. package/dist/modules/tabs/selectors.d.ts +64 -0
  61. package/dist/modules/tabs/types.d.ts +1 -0
  62. package/dist/modules/webforms/datasources.adapter.d.ts +40 -0
  63. package/dist/modules/webforms/index.d.ts +6 -0
  64. package/dist/modules/webforms/private.d.ts +3 -0
  65. package/dist/modules/webforms/reducer.d.ts +53 -0
  66. package/dist/modules/webforms/thunks.d.ts +58 -0
  67. package/dist/modules/webforms/types.d.ts +71 -0
  68. package/dist/provider.d.ts +5 -0
  69. package/dist/selectors/catalog.d.ts +234 -0
  70. package/dist/selectors/common.d.ts +146 -0
  71. package/dist/selectors/components.d.ts +70 -0
  72. package/dist/selectors/datasources.d.ts +262 -0
  73. package/dist/selectors/debugger.d.ts +922 -0
  74. package/dist/selectors/explorer.d.ts +1352 -0
  75. package/dist/selectors/index.d.ts +12 -0
  76. package/dist/selectors/modals.d.ts +41 -0
  77. package/dist/selectors/roles.d.ts +471 -0
  78. package/dist/selectors/settings.d.ts +337 -0
  79. package/dist/selectors/styles.d.ts +234 -0
  80. package/dist/selectors/tabs.d.ts +72 -0
  81. package/dist/selectors/webforms.d.ts +450 -0
  82. package/dist/store.d.ts +10 -0
  83. package/dist/utils.d.ts +16 -0
  84. package/package.json +46 -20
  85. package/dist/index.d.ts.map +0 -1
  86. package/dist/index.js +0 -168
  87. package/dist/index.js.map +0 -1
  88. package/dist/index.module.js +0 -167
  89. package/dist/index.module.js.map +0 -1
package/dist/index.js DELETED
@@ -1,168 +0,0 @@
1
- var $74iSd$reduxjstoolkit = require("@reduxjs/toolkit");
2
-
3
- function $parcel$exportWildcard(dest, source) {
4
- Object.keys(source).forEach(function(key) {
5
- if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
6
- return;
7
- }
8
-
9
- Object.defineProperty(dest, key, {
10
- enumerable: true,
11
- get: function get() {
12
- return source[key];
13
- }
14
- });
15
- });
16
-
17
- return dest;
18
- }
19
- function $parcel$export(e, n, v, s) {
20
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
21
- }
22
- function $parcel$defineInteropFlag(a) {
23
- Object.defineProperty(a, '__esModule', {value: true, configurable: true});
24
- }
25
- var $762d6bf1dc5d9eb3$exports = {};
26
-
27
- $parcel$export($762d6bf1dc5d9eb3$exports, "store", () => $762d6bf1dc5d9eb3$export$6f57813fe9f31bf9);
28
-
29
-
30
- var $eb4150e4f4196a9f$exports = {};
31
-
32
- $parcel$defineInteropFlag($eb4150e4f4196a9f$exports);
33
-
34
- $parcel$export($eb4150e4f4196a9f$exports, "default", () => $eb4150e4f4196a9f$export$2e2bcd8739ae039);
35
- var $6a84af33bc911c55$exports = {};
36
-
37
- $parcel$defineInteropFlag($6a84af33bc911c55$exports);
38
-
39
- $parcel$export($6a84af33bc911c55$exports, "tabsSlice", () => $6a84af33bc911c55$export$e778b58c904d1aed);
40
- $parcel$export($6a84af33bc911c55$exports, "default", () => $6a84af33bc911c55$export$2e2bcd8739ae039);
41
- $parcel$export($6a84af33bc911c55$exports, "setContent", () => $6a84af33bc911c55$export$431313f2afd011e2);
42
- $parcel$export($6a84af33bc911c55$exports, "addTab", () => $6a84af33bc911c55$export$e12b5b94ee768f0b);
43
- $parcel$export($6a84af33bc911c55$exports, "setActiveIndex", () => $6a84af33bc911c55$export$c7da68a4a8c33a39);
44
-
45
- var $053193bf6f06c9c5$exports = {};
46
-
47
- $parcel$export($053193bf6f06c9c5$exports, "saveContent", () => $053193bf6f06c9c5$export$5fb9a4eb43b36fa1);
48
-
49
- const $053193bf6f06c9c5$export$5fb9a4eb43b36fa1 = $74iSd$reduxjstoolkit.createAsyncThunk('tabs/saveContent', async ({ path: path , editor: editor }, { getState: getState })=>{
50
- const tab = getState().tabs.editors[path];
51
- const parsed = await editor.serialize(tab.content.parsed);
52
- return {
53
- path: path,
54
- content: parsed
55
- };
56
- });
57
-
58
-
59
- const $6a84af33bc911c55$var$initialState = {
60
- editors: {
61
- 'editor/radio1': {
62
- name: 'radio1',
63
- path: 'editor/radio1',
64
- editor: 'RadioEditor',
65
- content: {
66
- raw: 'value1',
67
- parsed: {
68
- checked: 'value1'
69
- }
70
- }
71
- },
72
- 'editor/radio2': {
73
- name: 'radio2',
74
- path: 'editor/radio2',
75
- editor: 'RadioEditor',
76
- content: {
77
- raw: 'value2',
78
- parsed: {
79
- checked: 'value1'
80
- }
81
- }
82
- },
83
- 'editor/text1': {
84
- name: 'radio1',
85
- path: 'editor/text1',
86
- editor: 'TextEditor',
87
- content: {
88
- raw: '1',
89
- parsed: {
90
- text: 'value1'
91
- }
92
- }
93
- }
94
- },
95
- selected: 0
96
- };
97
- const $6a84af33bc911c55$export$e778b58c904d1aed = $74iSd$reduxjstoolkit.createSlice({
98
- name: 'tabs',
99
- initialState: $6a84af33bc911c55$var$initialState,
100
- reducers: {
101
- setContent: (state, action)=>{
102
- const found = state.editors[action.payload.path];
103
- if (!found) return;
104
- found.content[action.payload.type || 'parsed'] = action.payload.content;
105
- },
106
- addTab: (state, action)=>{
107
- state.editors[action.payload.path] = action.payload;
108
- },
109
- setActiveIndex (state, action) {
110
- state.selected = action.payload;
111
- }
112
- },
113
- extraReducers: (builder)=>{
114
- builder.addCase($053193bf6f06c9c5$export$5fb9a4eb43b36fa1.fulfilled, (state, action)=>{
115
- state.editors[action.payload.path].content.raw = action.payload.content;
116
- });
117
- }
118
- });
119
- var $6a84af33bc911c55$export$2e2bcd8739ae039 = $6a84af33bc911c55$export$e778b58c904d1aed;
120
- const { setContent: $6a84af33bc911c55$export$431313f2afd011e2 , addTab: $6a84af33bc911c55$export$e12b5b94ee768f0b , setActiveIndex: $6a84af33bc911c55$export$c7da68a4a8c33a39 } = $6a84af33bc911c55$export$e778b58c904d1aed.actions;
121
-
122
-
123
-
124
- var $1a1c9cbe6666ff0c$exports = {};
125
-
126
- $parcel$export($1a1c9cbe6666ff0c$exports, "selectTab", () => $1a1c9cbe6666ff0c$export$67a66ee6a2b09b52);
127
- $parcel$export($1a1c9cbe6666ff0c$exports, "selectActiveIndex", () => $1a1c9cbe6666ff0c$export$95fb15d7bb7a8a94);
128
- $parcel$export($1a1c9cbe6666ff0c$exports, "selectTabsArray", () => $1a1c9cbe6666ff0c$export$7119fc11e7bfee52);
129
- $parcel$export($1a1c9cbe6666ff0c$exports, "selectTabs", () => $1a1c9cbe6666ff0c$export$1257191dd6a3cacf);
130
-
131
- const $1a1c9cbe6666ff0c$var$selectTabsState = $74iSd$reduxjstoolkit.createSelector((state)=>state
132
- , (state)=>state.tabs
133
- );
134
- const $1a1c9cbe6666ff0c$export$67a66ee6a2b09b52 = (path)=>$74iSd$reduxjstoolkit.createSelector($1a1c9cbe6666ff0c$var$selectTabsState, (state)=>state.editors[path]
135
- )
136
- ;
137
- const $1a1c9cbe6666ff0c$export$95fb15d7bb7a8a94 = $74iSd$reduxjstoolkit.createSelector($1a1c9cbe6666ff0c$var$selectTabsState, (state)=>state.selected
138
- );
139
- const $1a1c9cbe6666ff0c$export$7119fc11e7bfee52 = $74iSd$reduxjstoolkit.createSelector($1a1c9cbe6666ff0c$var$selectTabsState, (state)=>Object.values(state.editors)
140
- );
141
- const $1a1c9cbe6666ff0c$export$1257191dd6a3cacf = $74iSd$reduxjstoolkit.createSelector($1a1c9cbe6666ff0c$var$selectTabsState, (state)=>state.editors
142
- );
143
-
144
-
145
-
146
- var $eb4150e4f4196a9f$export$2e2bcd8739ae039 = $6a84af33bc911c55$export$2e2bcd8739ae039.reducer;
147
- $parcel$exportWildcard($eb4150e4f4196a9f$exports, $6a84af33bc911c55$exports);
148
- $parcel$exportWildcard($eb4150e4f4196a9f$exports, $1a1c9cbe6666ff0c$exports);
149
- $parcel$exportWildcard($eb4150e4f4196a9f$exports, $053193bf6f06c9c5$exports);
150
-
151
-
152
- const $1b5bcdccfb8e38e8$var$stateReducer = $74iSd$reduxjstoolkit.combineReducers({
153
- tabs: $6a84af33bc911c55$export$e778b58c904d1aed.reducer
154
- });
155
- var $1b5bcdccfb8e38e8$export$2e2bcd8739ae039 = $1b5bcdccfb8e38e8$var$stateReducer;
156
-
157
-
158
- const $762d6bf1dc5d9eb3$export$6f57813fe9f31bf9 = $74iSd$reduxjstoolkit.configureStore({
159
- reducer: $1b5bcdccfb8e38e8$export$2e2bcd8739ae039
160
- });
161
-
162
-
163
-
164
- $parcel$exportWildcard(module.exports, $762d6bf1dc5d9eb3$exports);
165
- $parcel$exportWildcard(module.exports, $eb4150e4f4196a9f$exports);
166
-
167
-
168
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AKIO,KAAK,CAAC,yCAAW,GAAG,sCAAgB,CAYzC,CAAkB,0BAAS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,yCAAiB,GAAG,oCAAc,CAC7C,qCAAe,GACd,KAAK,GAAK,KAAK,CAAC,QAAQ;;AAGpB,KAAK,CAAC,yCAAe,GAAG,oCAAc,CAC3C,qCAAe,GACd,KAAK,GAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO;;AAGjC,KAAK,CAAC,yCAAU,GAAG,oCAAc,CACtC,qCAAe,GACd,KAAK,GAAK,KAAK,CAAC,OAAO;;;;;IHxB1B,wCAA6B,GAAd,wCAAK,CAAC,OAAO;;;;;;ADC5B,KAAK,CAAC,kCAAY,GAAG,qCAAe,CAAC,CAAC;IACpC,IAAI,EAAE,yCAAS,CAAC,OAAO;AACzB,CAAC;IAED,wCAA4B,GAAb,kCAAY;;;ADJpB,KAAK,CAAC,yCAAK,GAAG,oCAAc,CAAC,CAAC;IACnC,OAAO,EAAE,wCAAY;AACvB,CAAC","sources":["packages/core/store/src/index.ts","packages/core/store/src/configureStore.ts","packages/core/store/src/reducers/index.ts","packages/core/store/src/reducers/tabs/index.ts","packages/core/store/src/reducers/tabs/reducer.ts","packages/core/store/src/reducers/tabs/thunks.ts","packages/core/store/src/reducers/tabs/selector.ts"],"sourcesContent":["export * from './configureStore';\nexport * from './reducers/tabs';\n\n","import { configureStore } from '@reduxjs/toolkit';\nimport stateReducer from './reducers';\n\nexport const store = configureStore({\n reducer: stateReducer,\n});\n\nexport type AppDispatch = typeof store.dispatch;\n","import { combineReducers } from '@reduxjs/toolkit';\nimport { tabsSlice, ITabsState } from './tabs';\n\nconst stateReducer = combineReducers({\n tabs: tabsSlice.reducer,\n});\n\nexport default stateReducer;\n\nexport interface AppState {\n tabs: ITabsState;\n};\n","import slice from './reducer';\n\nexport default slice.reducer;\nexport * from './reducer';\nexport * from './selector';\nexport * from './thunks';\n","import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { saveContent } from './thunks';\n\nexport interface ITab<Raw = string, Parsed = string, Extra = any> {\n path: string;\n name: string;\n editor: string;\n content: {\n raw: Raw;\n parsed: Parsed;\n };\n extra: Extra;\n}\nexport type ITabsState = {\n editors: {\n [key: string]: ITab;\n };\n selected: number;\n};\n\nconst initialState: ITabsState = {\n editors: {\n 'editor/radio1': {\n name: 'radio1',\n path: 'editor/radio1',\n editor: 'RadioEditor',\n content: {\n raw: 'value1',\n parsed: {\n checked: 'value1',\n },\n },\n } as ITab<any, any>,\n 'editor/radio2': {\n name: 'radio2',\n path: 'editor/radio2',\n editor: 'RadioEditor',\n content: {\n raw: 'value2',\n parsed: {\n checked: 'value1',\n },\n },\n } as ITab<any, any>,\n 'editor/text1': {\n name: 'radio1',\n path: 'editor/text1',\n editor: 'TextEditor',\n content: {\n raw: '1',\n parsed: {\n text: 'value1',\n },\n },\n } as ITab<any, any>,\n },\n selected: 0,\n};\n\nexport const tabsSlice = createSlice({\n name: 'tabs',\n initialState,\n reducers: {\n setContent: (\n state,\n action: PayloadAction<{\n path: string;\n content: any;\n type?: 'raw' | 'parsed';\n }>,\n ) => {\n const found = state.editors[action.payload.path];\n if (!found) return;\n found.content[action.payload.type || 'parsed'] =\n action.payload.content;\n },\n addTab: (state, action: PayloadAction<ITab<any, any>>) => {\n state.editors[action.payload.path] = action.payload;\n },\n setActiveIndex(state, action: PayloadAction<number>) {\n state.selected = action.payload;\n },\n },\n extraReducers: (builder) => {\n builder.addCase(saveContent.fulfilled, (state, action) => {\n state.editors[action.payload.path].content.raw =\n action.payload.content;\n });\n },\n});\n\nexport default tabsSlice;\nexport const { setContent, addTab, setActiveIndex } =\n tabsSlice.actions;\n","import { createAsyncThunk } from '@reduxjs/toolkit';\nimport { IEditor } from '@ws-ui/common';\nimport { AppState } from '..';\n\nexport const saveContent = createAsyncThunk<\n {\n path: string;\n content: any;\n },\n {\n path: string;\n editor: IEditor<any, any>;\n },\n {\n state: AppState;\n }\n>('tabs/saveContent', async ({ path, editor }, { getState }) => {\n const tab = getState().tabs.editors[path];\n\n const parsed = await editor.serialize(tab.content.parsed);\n return { path, content: parsed };\n});\n","import { createSelector } from '@reduxjs/toolkit';\nimport { AppState } from '..';\n\nconst selectTabsState = createSelector(\n (state: AppState) => state,\n (state: AppState) => state.tabs,\n);\n\nexport const selectTab = (path: string) =>\n createSelector(\n selectTabsState,\n (state) => state.editors[path],\n );\n\nexport const selectActiveIndex = createSelector(\n selectTabsState,\n (state) => state.selected,\n);\n\nexport const selectTabsArray = createSelector(\n selectTabsState,\n (state) => Object.values(state.editors),\n);\n\nexport const selectTabs = createSelector(\n selectTabsState,\n (state) => state.editors,\n);\n"],"names":[],"version":3,"file":"index.js.map"}
@@ -1,167 +0,0 @@
1
- import {configureStore as $5vCxb$configureStore, combineReducers as $5vCxb$combineReducers, createSlice as $5vCxb$createSlice, createAsyncThunk as $5vCxb$createAsyncThunk, createSelector as $5vCxb$createSelector} from "@reduxjs/toolkit";
2
-
3
- function $parcel$export(e, n, v, s) {
4
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
5
- }
6
- function $parcel$defineInteropFlag(a) {
7
- Object.defineProperty(a, '__esModule', {value: true, configurable: true});
8
- }
9
- function $parcel$exportWildcard(dest, source) {
10
- Object.keys(source).forEach(function(key) {
11
- if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
12
- return;
13
- }
14
-
15
- Object.defineProperty(dest, key, {
16
- enumerable: true,
17
- get: function get() {
18
- return source[key];
19
- }
20
- });
21
- });
22
-
23
- return dest;
24
- }
25
- var $607db421e4df5242$exports = {};
26
-
27
- $parcel$export($607db421e4df5242$exports, "store", () => $607db421e4df5242$export$6f57813fe9f31bf9);
28
-
29
-
30
- var $43ff650760856779$exports = {};
31
-
32
- $parcel$defineInteropFlag($43ff650760856779$exports);
33
-
34
- $parcel$export($43ff650760856779$exports, "default", () => $43ff650760856779$export$2e2bcd8739ae039);
35
- var $6e0c0412de6dd794$exports = {};
36
-
37
- $parcel$defineInteropFlag($6e0c0412de6dd794$exports);
38
-
39
- $parcel$export($6e0c0412de6dd794$exports, "tabsSlice", () => $6e0c0412de6dd794$export$e778b58c904d1aed);
40
- $parcel$export($6e0c0412de6dd794$exports, "default", () => $6e0c0412de6dd794$export$2e2bcd8739ae039);
41
- $parcel$export($6e0c0412de6dd794$exports, "setContent", () => $6e0c0412de6dd794$export$431313f2afd011e2);
42
- $parcel$export($6e0c0412de6dd794$exports, "addTab", () => $6e0c0412de6dd794$export$e12b5b94ee768f0b);
43
- $parcel$export($6e0c0412de6dd794$exports, "setActiveIndex", () => $6e0c0412de6dd794$export$c7da68a4a8c33a39);
44
-
45
- var $d7c749f6643d2657$exports = {};
46
-
47
- $parcel$export($d7c749f6643d2657$exports, "saveContent", () => $d7c749f6643d2657$export$5fb9a4eb43b36fa1);
48
-
49
- const $d7c749f6643d2657$export$5fb9a4eb43b36fa1 = $5vCxb$createAsyncThunk('tabs/saveContent', async ({ path: path , editor: editor }, { getState: getState })=>{
50
- const tab = getState().tabs.editors[path];
51
- const parsed = await editor.serialize(tab.content.parsed);
52
- return {
53
- path: path,
54
- content: parsed
55
- };
56
- });
57
-
58
-
59
- const $6e0c0412de6dd794$var$initialState = {
60
- editors: {
61
- 'editor/radio1': {
62
- name: 'radio1',
63
- path: 'editor/radio1',
64
- editor: 'RadioEditor',
65
- content: {
66
- raw: 'value1',
67
- parsed: {
68
- checked: 'value1'
69
- }
70
- }
71
- },
72
- 'editor/radio2': {
73
- name: 'radio2',
74
- path: 'editor/radio2',
75
- editor: 'RadioEditor',
76
- content: {
77
- raw: 'value2',
78
- parsed: {
79
- checked: 'value1'
80
- }
81
- }
82
- },
83
- 'editor/text1': {
84
- name: 'radio1',
85
- path: 'editor/text1',
86
- editor: 'TextEditor',
87
- content: {
88
- raw: '1',
89
- parsed: {
90
- text: 'value1'
91
- }
92
- }
93
- }
94
- },
95
- selected: 0
96
- };
97
- const $6e0c0412de6dd794$export$e778b58c904d1aed = $5vCxb$createSlice({
98
- name: 'tabs',
99
- initialState: $6e0c0412de6dd794$var$initialState,
100
- reducers: {
101
- setContent: (state, action)=>{
102
- const found = state.editors[action.payload.path];
103
- if (!found) return;
104
- found.content[action.payload.type || 'parsed'] = action.payload.content;
105
- },
106
- addTab: (state, action)=>{
107
- state.editors[action.payload.path] = action.payload;
108
- },
109
- setActiveIndex (state, action) {
110
- state.selected = action.payload;
111
- }
112
- },
113
- extraReducers: (builder)=>{
114
- builder.addCase($d7c749f6643d2657$export$5fb9a4eb43b36fa1.fulfilled, (state, action)=>{
115
- state.editors[action.payload.path].content.raw = action.payload.content;
116
- });
117
- }
118
- });
119
- var $6e0c0412de6dd794$export$2e2bcd8739ae039 = $6e0c0412de6dd794$export$e778b58c904d1aed;
120
- const { setContent: $6e0c0412de6dd794$export$431313f2afd011e2 , addTab: $6e0c0412de6dd794$export$e12b5b94ee768f0b , setActiveIndex: $6e0c0412de6dd794$export$c7da68a4a8c33a39 } = $6e0c0412de6dd794$export$e778b58c904d1aed.actions;
121
-
122
-
123
-
124
- var $753f9120f3cbae79$exports = {};
125
-
126
- $parcel$export($753f9120f3cbae79$exports, "selectTab", () => $753f9120f3cbae79$export$67a66ee6a2b09b52);
127
- $parcel$export($753f9120f3cbae79$exports, "selectActiveIndex", () => $753f9120f3cbae79$export$95fb15d7bb7a8a94);
128
- $parcel$export($753f9120f3cbae79$exports, "selectTabsArray", () => $753f9120f3cbae79$export$7119fc11e7bfee52);
129
- $parcel$export($753f9120f3cbae79$exports, "selectTabs", () => $753f9120f3cbae79$export$1257191dd6a3cacf);
130
-
131
- const $753f9120f3cbae79$var$selectTabsState = $5vCxb$createSelector((state)=>state
132
- , (state)=>state.tabs
133
- );
134
- const $753f9120f3cbae79$export$67a66ee6a2b09b52 = (path)=>$5vCxb$createSelector($753f9120f3cbae79$var$selectTabsState, (state)=>state.editors[path]
135
- )
136
- ;
137
- const $753f9120f3cbae79$export$95fb15d7bb7a8a94 = $5vCxb$createSelector($753f9120f3cbae79$var$selectTabsState, (state)=>state.selected
138
- );
139
- const $753f9120f3cbae79$export$7119fc11e7bfee52 = $5vCxb$createSelector($753f9120f3cbae79$var$selectTabsState, (state)=>Object.values(state.editors)
140
- );
141
- const $753f9120f3cbae79$export$1257191dd6a3cacf = $5vCxb$createSelector($753f9120f3cbae79$var$selectTabsState, (state)=>state.editors
142
- );
143
-
144
-
145
-
146
- var $43ff650760856779$export$2e2bcd8739ae039 = $6e0c0412de6dd794$export$2e2bcd8739ae039.reducer;
147
- $parcel$exportWildcard($43ff650760856779$exports, $6e0c0412de6dd794$exports);
148
- $parcel$exportWildcard($43ff650760856779$exports, $753f9120f3cbae79$exports);
149
- $parcel$exportWildcard($43ff650760856779$exports, $d7c749f6643d2657$exports);
150
-
151
-
152
- const $fcde70f2d5431e07$var$stateReducer = $5vCxb$combineReducers({
153
- tabs: $6e0c0412de6dd794$export$e778b58c904d1aed.reducer
154
- });
155
- var $fcde70f2d5431e07$export$2e2bcd8739ae039 = $fcde70f2d5431e07$var$stateReducer;
156
-
157
-
158
- const $607db421e4df5242$export$6f57813fe9f31bf9 = $5vCxb$configureStore({
159
- reducer: $fcde70f2d5431e07$export$2e2bcd8739ae039
160
- });
161
-
162
-
163
-
164
-
165
-
166
- export {$607db421e4df5242$export$6f57813fe9f31bf9 as store, $6e0c0412de6dd794$export$e778b58c904d1aed as tabsSlice, $6e0c0412de6dd794$export$431313f2afd011e2 as setContent, $6e0c0412de6dd794$export$e12b5b94ee768f0b as addTab, $6e0c0412de6dd794$export$c7da68a4a8c33a39 as setActiveIndex, $753f9120f3cbae79$export$67a66ee6a2b09b52 as selectTab, $753f9120f3cbae79$export$95fb15d7bb7a8a94 as selectActiveIndex, $753f9120f3cbae79$export$7119fc11e7bfee52 as selectTabsArray, $753f9120f3cbae79$export$1257191dd6a3cacf as selectTabs, $d7c749f6643d2657$export$5fb9a4eb43b36fa1 as saveContent};
167
- //# sourceMappingURL=index.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AKIO,KAAK,CAAC,yCAAW,GAA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AAC,IAAI;;;AAG1B,KAAK,CAAC,yCAAiB,GAAG,qBAAc,CAC7C,qCAAe,GACd,KAAK,GAAK,KAAK,CAAC,QAAQ;;AAGpB,KAAK,CAAC,yCAAe,GAAG,qBAAc,CAC3C,qCAAe,GACd,KAAK,GAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO;;AAGjC,KAAK,CAAC,yCAAU,GAAG,qBAAc,CACtC,qCAAe,GACd,KAAK,GAAK,KAAK,CAAC,OAAO;;;;;IHxB1B,wCAA6B,GAAd,wCAAK,CAAC,OAAO;;;;;;ADC5B,KAAK,CAAC,kCAAY,GAAG,sBAAe,CAAC,CAAC;IACpC,IAAI,EAAE,yCAAS,CAAC,OAAO;AACzB,CAAC;IAED,wCAA4B,GAAb,kCAAY;;;ADJpB,KAAK,CAAC,yCAAK,GAAG,qBAAc,CAAC,CAAC;IACnC,OAAO,EAAE,wCAAY;AACvB,CAAC","sources":["packages/core/store/src/index.ts","packages/core/store/src/configureStore.ts","packages/core/store/src/reducers/index.ts","packages/core/store/src/reducers/tabs/index.ts","packages/core/store/src/reducers/tabs/reducer.ts","packages/core/store/src/reducers/tabs/thunks.ts","packages/core/store/src/reducers/tabs/selector.ts"],"sourcesContent":["export * from './configureStore';\nexport * from './reducers/tabs';\n\n","import { configureStore } from '@reduxjs/toolkit';\nimport stateReducer from './reducers';\n\nexport const store = configureStore({\n reducer: stateReducer,\n});\n\nexport type AppDispatch = typeof store.dispatch;\n","import { combineReducers } from '@reduxjs/toolkit';\nimport { tabsSlice, ITabsState } from './tabs';\n\nconst stateReducer = combineReducers({\n tabs: tabsSlice.reducer,\n});\n\nexport default stateReducer;\n\nexport interface AppState {\n tabs: ITabsState;\n};\n","import slice from './reducer';\n\nexport default slice.reducer;\nexport * from './reducer';\nexport * from './selector';\nexport * from './thunks';\n","import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { saveContent } from './thunks';\n\nexport interface ITab<Raw = string, Parsed = string, Extra = any> {\n path: string;\n name: string;\n editor: string;\n content: {\n raw: Raw;\n parsed: Parsed;\n };\n extra: Extra;\n}\nexport type ITabsState = {\n editors: {\n [key: string]: ITab;\n };\n selected: number;\n};\n\nconst initialState: ITabsState = {\n editors: {\n 'editor/radio1': {\n name: 'radio1',\n path: 'editor/radio1',\n editor: 'RadioEditor',\n content: {\n raw: 'value1',\n parsed: {\n checked: 'value1',\n },\n },\n } as ITab<any, any>,\n 'editor/radio2': {\n name: 'radio2',\n path: 'editor/radio2',\n editor: 'RadioEditor',\n content: {\n raw: 'value2',\n parsed: {\n checked: 'value1',\n },\n },\n } as ITab<any, any>,\n 'editor/text1': {\n name: 'radio1',\n path: 'editor/text1',\n editor: 'TextEditor',\n content: {\n raw: '1',\n parsed: {\n text: 'value1',\n },\n },\n } as ITab<any, any>,\n },\n selected: 0,\n};\n\nexport const tabsSlice = createSlice({\n name: 'tabs',\n initialState,\n reducers: {\n setContent: (\n state,\n action: PayloadAction<{\n path: string;\n content: any;\n type?: 'raw' | 'parsed';\n }>,\n ) => {\n const found = state.editors[action.payload.path];\n if (!found) return;\n found.content[action.payload.type || 'parsed'] =\n action.payload.content;\n },\n addTab: (state, action: PayloadAction<ITab<any, any>>) => {\n state.editors[action.payload.path] = action.payload;\n },\n setActiveIndex(state, action: PayloadAction<number>) {\n state.selected = action.payload;\n },\n },\n extraReducers: (builder) => {\n builder.addCase(saveContent.fulfilled, (state, action) => {\n state.editors[action.payload.path].content.raw =\n action.payload.content;\n });\n },\n});\n\nexport default tabsSlice;\nexport const { setContent, addTab, setActiveIndex } =\n tabsSlice.actions;\n","import { createAsyncThunk } from '@reduxjs/toolkit';\nimport { IEditor } from '@ws-ui/common';\nimport { AppState } from '..';\n\nexport const saveContent = createAsyncThunk<\n {\n path: string;\n content: any;\n },\n {\n path: string;\n editor: IEditor<any, any>;\n },\n {\n state: AppState;\n }\n>('tabs/saveContent', async ({ path, editor }, { getState }) => {\n const tab = getState().tabs.editors[path];\n\n const parsed = await editor.serialize(tab.content.parsed);\n return { path, content: parsed };\n});\n","import { createSelector } from '@reduxjs/toolkit';\nimport { AppState } from '..';\n\nconst selectTabsState = createSelector(\n (state: AppState) => state,\n (state: AppState) => state.tabs,\n);\n\nexport const selectTab = (path: string) =>\n createSelector(\n selectTabsState,\n (state) => state.editors[path],\n );\n\nexport const selectActiveIndex = createSelector(\n selectTabsState,\n (state) => state.selected,\n);\n\nexport const selectTabsArray = createSelector(\n selectTabsState,\n (state) => Object.values(state.editors),\n);\n\nexport const selectTabs = createSelector(\n selectTabsState,\n (state) => state.editors,\n);\n"],"names":[],"version":3,"file":"index.module.js.map"}