@plitzi/sdk-shared 0.36.2 → 0.37.0
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/CHANGELOG.md +55 -0
- package/dist/index.mjs +26 -25
- package/dist/network/spaceEvents.d.ts +16 -4
- package/dist/network/spaceEvents.mjs +219 -224
- package/dist/store/index.d.ts +23 -23
- package/dist/style/index.d.ts +1 -0
- package/dist/style/index.mjs +2 -1
- package/dist/style/styleConstants.d.ts +9 -2
- package/dist/style/styleConstants.mjs +16 -0
- package/dist/style/styleStates.d.ts +17 -0
- package/dist/style/styleStates.mjs +31 -0
- package/dist/types/SchemaTypes.d.ts +5 -1
- package/dist/types/StoreTypes.d.ts +2 -0
- package/dist/types/StyleTypes.d.ts +17 -2
- package/package.json +5 -1
|
@@ -1,241 +1,236 @@
|
|
|
1
1
|
import { StyleVariableCategory as e } from "../types/StyleTypes.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { STYLE_STATES as t } from "../style/styleStates.mjs";
|
|
3
|
+
import { z as n } from "zod";
|
|
3
4
|
//#region src/network/spaceEvents.ts
|
|
4
|
-
var
|
|
5
|
+
var r = (e) => typeof e == "object" && !!e && !Array.isArray(e), i = n.custom((e) => r(e) && typeof e.id == "string", { message: "expected an element with an id" }), a = n.array(i), o = n.custom((e) => r(e) && Array.isArray(e.flat), { message: "expected a schema whose `flat` is a list of elements" }), s = n.custom((e) => r(e) && typeof e.id == "string", { message: "expected a page folder with an id" }), c = n.custom((e) => r(e) && typeof e.name == "string", { message: "expected a variable with a name" }), l = n.custom(r, { message: "expected a style attributes object" }), u = n.custom((e) => r(e) && typeof e.family == "string" && typeof e.source == "string", { message: "expected a font with a family and a source" }), d = n.custom((e) => typeof e == "string" || typeof e == "number" || r(e), { message: "expected a style variable value" }), f = n.enum([
|
|
5
6
|
"desktop",
|
|
6
7
|
"tablet",
|
|
7
8
|
"mobile"
|
|
8
|
-
]),
|
|
9
|
+
]), p = n.custom((e) => typeof e == "string", { message: "expected a drop position" }), m = n.custom((e) => typeof e == "string", { message: "expected a style category" }), h = n.enum([
|
|
9
10
|
"class",
|
|
10
11
|
"element",
|
|
11
12
|
"id"
|
|
12
|
-
]),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}),
|
|
25
|
-
displayMode:
|
|
26
|
-
selector:
|
|
27
|
-
category:
|
|
28
|
-
name:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
SPACE_UPDATE_SETTINGS: t.object({
|
|
91
|
-
path: t.string(),
|
|
92
|
-
value: t.union([
|
|
93
|
-
t.string(),
|
|
94
|
-
t.number(),
|
|
95
|
-
t.boolean()
|
|
13
|
+
]), g = n.enum(t), _ = n.enum(e), v = n.object({
|
|
14
|
+
componentType: n.string().optional(),
|
|
15
|
+
styleSelector: n.string().optional(),
|
|
16
|
+
styleState: g.optional(),
|
|
17
|
+
styleVariant: n.string().optional(),
|
|
18
|
+
styleAncestor: n.string().optional()
|
|
19
|
+
}), y = v.extend({ styleSelector: n.string() }), b = { contextId: n.string() }, x = n.object({ variable: c }), S = n.object({
|
|
20
|
+
displayMode: f,
|
|
21
|
+
selector: n.string(),
|
|
22
|
+
category: _,
|
|
23
|
+
name: n.string(),
|
|
24
|
+
value: d
|
|
25
|
+
}), C = n.object({
|
|
26
|
+
displayMode: f,
|
|
27
|
+
selector: n.string(),
|
|
28
|
+
category: _,
|
|
29
|
+
name: n.string()
|
|
30
|
+
}), w = n.object({
|
|
31
|
+
category: _,
|
|
32
|
+
name: n.string(),
|
|
33
|
+
value: d
|
|
34
|
+
}), T = {
|
|
35
|
+
SPACE_UPDATED: n.object({ schema: o }),
|
|
36
|
+
STYLE_UPDATED: n.object({
|
|
37
|
+
platform: n.custom(r),
|
|
38
|
+
variables: n.custom(r),
|
|
39
|
+
cache: n.string()
|
|
40
|
+
}),
|
|
41
|
+
SPACE_ADD_PAGE: n.object({ page: i }),
|
|
42
|
+
SPACE_UPDATE_PAGE: n.object({ page: i }),
|
|
43
|
+
SPACE_SET_HOME_PAGE: n.object({ page: i }),
|
|
44
|
+
SPACE_REMOVE_PAGE: n.object({ pageId: n.string() }),
|
|
45
|
+
SPACE_ADD_PAGE_FOLDER: n.object({ pageFolder: s }),
|
|
46
|
+
SPACE_UPDATE_PAGE_FOLDER: n.object({ pageFolder: s }),
|
|
47
|
+
SPACE_REMOVE_PAGE_FOLDER: n.object({ pageFolderId: n.string() }),
|
|
48
|
+
SPACE_ADD_VARIABLE: x,
|
|
49
|
+
SPACE_UPDATE_VARIABLE: x,
|
|
50
|
+
SPACE_REMOVE_VARIABLE: n.object({ name: n.string() }),
|
|
51
|
+
SPACE_ADD_ELEMENT: n.object({
|
|
52
|
+
element: i,
|
|
53
|
+
dropPosition: p,
|
|
54
|
+
to: n.string(),
|
|
55
|
+
initialItems: a.optional(),
|
|
56
|
+
variables: n.array(c).optional()
|
|
57
|
+
}),
|
|
58
|
+
SPACE_UPDATE_ELEMENT: n.object({ element: i }),
|
|
59
|
+
SPACE_RENAME_ELEMENT: n.object({
|
|
60
|
+
elementId: n.string(),
|
|
61
|
+
id: n.string()
|
|
62
|
+
}),
|
|
63
|
+
SPACE_UPDATE_ELEMENTS: n.object({ elements: a }),
|
|
64
|
+
SPACE_REMOVE_ELEMENT: n.object({ elementId: n.string() }),
|
|
65
|
+
SPACE_MOVE_ELEMENT: n.object({
|
|
66
|
+
from: n.string(),
|
|
67
|
+
to: n.string(),
|
|
68
|
+
elementId: n.string(),
|
|
69
|
+
dropPosition: p
|
|
70
|
+
}),
|
|
71
|
+
SPACE_CLONE_ELEMENT: n.object({
|
|
72
|
+
to: n.string(),
|
|
73
|
+
element: i,
|
|
74
|
+
dropPosition: p,
|
|
75
|
+
initialItems: a
|
|
76
|
+
}),
|
|
77
|
+
SPACE_ADD_TEMPLATE: n.object({
|
|
78
|
+
element: i,
|
|
79
|
+
style: n.custom(r),
|
|
80
|
+
to: n.string(),
|
|
81
|
+
dropPosition: p,
|
|
82
|
+
initialItems: a.optional(),
|
|
83
|
+
variables: n.array(c).optional()
|
|
84
|
+
}),
|
|
85
|
+
SPACE_UPDATE_SETTINGS: n.object({
|
|
86
|
+
path: n.string(),
|
|
87
|
+
value: n.union([
|
|
88
|
+
n.string(),
|
|
89
|
+
n.number(),
|
|
90
|
+
n.boolean()
|
|
96
91
|
])
|
|
97
92
|
}),
|
|
98
|
-
STYLE_ADD_SELECTOR:
|
|
99
|
-
displayMode:
|
|
100
|
-
selector:
|
|
101
|
-
path:
|
|
102
|
-
type:
|
|
103
|
-
style:
|
|
104
|
-
params: _
|
|
105
|
-
}),
|
|
106
|
-
STYLE_UPDATE_SELECTOR: t.object({
|
|
107
|
-
displayMode: d,
|
|
108
|
-
selector: t.string(),
|
|
109
|
-
path: p.optional(),
|
|
110
|
-
style: c.optional(),
|
|
93
|
+
STYLE_ADD_SELECTOR: n.object({
|
|
94
|
+
displayMode: f,
|
|
95
|
+
selector: n.string(),
|
|
96
|
+
path: m.optional(),
|
|
97
|
+
type: h,
|
|
98
|
+
style: l.optional(),
|
|
111
99
|
params: v
|
|
112
100
|
}),
|
|
113
|
-
|
|
114
|
-
displayMode:
|
|
115
|
-
selector:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}),
|
|
172
|
-
|
|
173
|
-
...
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
to:
|
|
177
|
-
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
...
|
|
181
|
-
element:
|
|
182
|
-
|
|
183
|
-
to:
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
style: c.optional(),
|
|
101
|
+
STYLE_UPDATE_SELECTOR: n.object({
|
|
102
|
+
displayMode: f,
|
|
103
|
+
selector: n.string(),
|
|
104
|
+
path: m.optional(),
|
|
105
|
+
style: l.optional(),
|
|
106
|
+
params: y
|
|
107
|
+
}),
|
|
108
|
+
STYLE_REMOVE_SELECTOR: n.object({
|
|
109
|
+
displayMode: f,
|
|
110
|
+
selector: n.string()
|
|
111
|
+
}),
|
|
112
|
+
STYLE_REMOVE_SELECTORS: n.object({
|
|
113
|
+
displayMode: f,
|
|
114
|
+
selectors: n.array(n.string())
|
|
115
|
+
}),
|
|
116
|
+
STYLE_ADD_SELECTOR_VARIABLE: S,
|
|
117
|
+
STYLE_UPDATE_SELECTOR_VARIABLE: S,
|
|
118
|
+
STYLE_REMOVE_SELECTOR_VARIABLE: C,
|
|
119
|
+
STYLE_ADD_VARIABLE: w,
|
|
120
|
+
STYLE_UPDATE_VARIABLE: w,
|
|
121
|
+
STYLE_REMOVE_VARIABLE: n.object({
|
|
122
|
+
category: _,
|
|
123
|
+
name: n.string()
|
|
124
|
+
}),
|
|
125
|
+
STYLE_UPDATE_SETTINGS: n.object({
|
|
126
|
+
path: n.string(),
|
|
127
|
+
value: n.string()
|
|
128
|
+
}),
|
|
129
|
+
STYLE_ADD_FONT: n.object({ font: u }),
|
|
130
|
+
STYLE_UPDATE_FONT: n.object({
|
|
131
|
+
family: n.string(),
|
|
132
|
+
font: u
|
|
133
|
+
}),
|
|
134
|
+
STYLE_REMOVE_FONT: n.object({ family: n.string() }),
|
|
135
|
+
SEGMENT_ADD_ELEMENT: n.object({
|
|
136
|
+
...b,
|
|
137
|
+
element: i,
|
|
138
|
+
dropPosition: p,
|
|
139
|
+
to: n.string(),
|
|
140
|
+
initialItems: a.optional(),
|
|
141
|
+
variables: n.array(c).optional()
|
|
142
|
+
}),
|
|
143
|
+
SEGMENT_UPDATE_ELEMENT: n.object({
|
|
144
|
+
...b,
|
|
145
|
+
element: i
|
|
146
|
+
}),
|
|
147
|
+
SEGMENT_RENAME_ELEMENT: n.object({
|
|
148
|
+
...b,
|
|
149
|
+
elementId: n.string(),
|
|
150
|
+
id: n.string()
|
|
151
|
+
}),
|
|
152
|
+
SEGMENT_UPDATE_ELEMENTS: n.object({
|
|
153
|
+
...b,
|
|
154
|
+
elements: a
|
|
155
|
+
}),
|
|
156
|
+
SEGMENT_REMOVE_ELEMENT: n.object({
|
|
157
|
+
...b,
|
|
158
|
+
elementId: n.string()
|
|
159
|
+
}),
|
|
160
|
+
SEGMENT_MOVE_ELEMENT: n.object({
|
|
161
|
+
...b,
|
|
162
|
+
elementId: n.string(),
|
|
163
|
+
from: n.string(),
|
|
164
|
+
to: n.string(),
|
|
165
|
+
dropPosition: p
|
|
166
|
+
}),
|
|
167
|
+
SEGMENT_CLONE_ELEMENT: n.object({
|
|
168
|
+
...b,
|
|
169
|
+
element: i,
|
|
170
|
+
dropPosition: p,
|
|
171
|
+
to: n.string(),
|
|
172
|
+
initialItems: a.optional()
|
|
173
|
+
}),
|
|
174
|
+
SEGMENT_ADD_TEMPLATE: n.object({
|
|
175
|
+
...b,
|
|
176
|
+
element: i,
|
|
177
|
+
style: n.custom(r),
|
|
178
|
+
to: n.string(),
|
|
179
|
+
dropPosition: p,
|
|
180
|
+
initialItems: a.optional(),
|
|
181
|
+
variables: n.array(c).optional()
|
|
182
|
+
}),
|
|
183
|
+
SEGMENT_SPACE_ADD_VARIABLE: n.object({
|
|
184
|
+
...b,
|
|
185
|
+
variable: c
|
|
186
|
+
}),
|
|
187
|
+
SEGMENT_SPACE_UPDATE_VARIABLE: n.object({
|
|
188
|
+
...b,
|
|
189
|
+
variable: c
|
|
190
|
+
}),
|
|
191
|
+
SEGMENT_SPACE_REMOVE_VARIABLE: n.object({
|
|
192
|
+
...b,
|
|
193
|
+
variable: n.object({ name: n.string() })
|
|
194
|
+
}),
|
|
195
|
+
SEGMENT_STYLE_ADD_SELECTOR: n.object({
|
|
196
|
+
...b,
|
|
197
|
+
displayMode: f,
|
|
198
|
+
selector: n.string(),
|
|
199
|
+
type: h,
|
|
200
|
+
path: m.optional(),
|
|
201
|
+
style: l.optional(),
|
|
215
202
|
params: v
|
|
216
203
|
}),
|
|
217
|
-
|
|
218
|
-
...
|
|
219
|
-
displayMode:
|
|
220
|
-
selector:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
204
|
+
SEGMENT_STYLE_UPDATE_SELECTOR: n.object({
|
|
205
|
+
...b,
|
|
206
|
+
displayMode: f,
|
|
207
|
+
selector: n.string(),
|
|
208
|
+
path: m.optional(),
|
|
209
|
+
style: l.optional(),
|
|
210
|
+
params: y
|
|
211
|
+
}),
|
|
212
|
+
SEGMENT_STYLE_REMOVE_SELECTOR: n.object({
|
|
213
|
+
...b,
|
|
214
|
+
displayMode: f,
|
|
215
|
+
selector: n.string()
|
|
216
|
+
}),
|
|
217
|
+
SEGMENT_STYLE_REMOVE_SELECTORS: n.object({
|
|
218
|
+
...b,
|
|
219
|
+
displayMode: f,
|
|
220
|
+
selectors: n.array(n.string())
|
|
221
|
+
}),
|
|
222
|
+
SEGMENT_STYLE_ADD_SELECTOR_VARIABLE: S.extend(b),
|
|
223
|
+
SEGMENT_STYLE_UPDATE_SELECTOR_VARIABLE: S.extend(b),
|
|
224
|
+
SEGMENT_STYLE_REMOVE_SELECTOR_VARIABLE: C.extend(b),
|
|
225
|
+
SEGMENT_STYLE_ADD_VARIABLE: w.extend(b),
|
|
226
|
+
SEGMENT_STYLE_UPDATE_VARIABLE: w.extend(b),
|
|
227
|
+
SEGMENT_STYLE_REMOVE_VARIABLE: n.object({
|
|
228
|
+
...b,
|
|
229
|
+
category: _,
|
|
230
|
+
name: n.string()
|
|
236
231
|
})
|
|
237
|
-
},
|
|
238
|
-
let n =
|
|
232
|
+
}, E = Object.fromEntries(Object.keys(T).map((e) => [e, e])), D = (e, t) => {
|
|
233
|
+
let n = T[e];
|
|
239
234
|
if (!n) return {
|
|
240
235
|
ok: !1,
|
|
241
236
|
issues: [{
|
|
@@ -256,4 +251,4 @@ var n = (e) => typeof e == "object" && !!e && !Array.isArray(e), r = t.custom((e
|
|
|
256
251
|
};
|
|
257
252
|
};
|
|
258
253
|
//#endregion
|
|
259
|
-
export {
|
|
254
|
+
export { E as SpaceEvents, E as default, T as spaceEventSchemas, D as validateSpaceEvent };
|