@plitzi/sdk-shared 0.36.2 → 0.37.1

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