@gxpl/sdk 0.0.54 → 0.0.57
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/lib/sdk/schemas/article/ItemBase.schema.d.ts +180 -10
- package/lib/sdk/schemas/article/ItemBase.schema.js +26 -8
- package/lib/sdk/schemas/article/RichTextItem.schema.d.ts +76 -6
- package/lib/sdk/schemas/project/Project.schema.d.ts +46 -11
- package/lib/sdk/schemas/project/Project.schema.js +14 -3
- package/lib/sdk/transitions/transitionMachine.d.ts +104 -0
- package/lib/sdk/transitions/transitionMachine.js +19 -17
- package/lib/sdk/transitions/utils/getInstantTransitionParams.d.ts +36 -0
- package/lib/sdk/transitions/utils/getInstantTransitionParams.js +29 -0
- package/lib/sdk/transitions/utils/getScenesOnEnd.d.ts +13 -0
- package/lib/sdk/transitions/utils/getScenesOnEnd.js +22 -0
- package/lib/sdk/transitions/utils/getScenesOnInstantTransition.js +26 -3
- package/lib/sdk/transitions/utils/getScenesOnProgressUpdate.d.ts +13 -0
- package/lib/sdk/transitions/utils/getScenesOnProgressUpdate.js +7 -0
- package/lib/sdk/transitions/utils/getScenesOnStart.d.ts +1 -0
- package/lib/sdk/transitions/utils/getScenesOnStart.js +24 -4
- package/lib/sdk/transitions/utils/getTransitionFromLink.d.ts +23 -0
- package/lib/sdk/transitions/utils/getTransitionFromLink.js +31 -0
- package/lib/sdk/transitions/utils/getTransitionFromRelation.d.ts +17 -0
- package/lib/sdk/transitions/utils/getTransitionFromRelation.js +26 -0
- package/lib/sdk/transitions/utils/getTransitionParams.d.ts +20 -0
- package/lib/sdk/transitions/utils/getTransitionParams.js +29 -0
- package/lib/sdk/transitions/utils/types.d.ts +56 -14
- package/lib/sdk/types/article/Item.d.ts +16 -3
- package/lib/sdk/types/project/Relation.d.ts +19 -4
- package/lib/sdk-nextjs/components/Preview/Preview.js +4 -7
- package/lib/sdk-nextjs/components/Preview/PreviewListener.js +2 -8
- package/lib/sdk-nextjs/components/Scene.d.ts +1 -0
- package/lib/sdk-nextjs/components/Scene.js +8 -5
- package/lib/sdk-nextjs/components/items/LinkWrapper.js +3 -7
- package/lib/sdk-nextjs/provider/TransitionMachineContext.d.ts +384 -0
- package/lib/sdk-nextjs/utils/RichTextConverter/RichTextConverter.d.ts +1 -0
- package/lib/sdk-nextjs/utils/RichTextConverter/RichTextConverter.js +31 -8
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ exports.FontStyles = {
|
|
|
13
13
|
};
|
|
14
14
|
class RichTextConverter {
|
|
15
15
|
toHtml(richText, exemplary) {
|
|
16
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
17
17
|
const { text, blocks = [] } = richText.params;
|
|
18
18
|
const root = [];
|
|
19
19
|
const styleRules = [];
|
|
@@ -76,7 +76,7 @@ class RichTextConverter {
|
|
|
76
76
|
continue;
|
|
77
77
|
}
|
|
78
78
|
if (entity.value) {
|
|
79
|
-
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: { value: entity.value, animation: (_f = entity.animation) !== null && _f !== void 0 ? _f : 'fade', direction: (_g = entity.direction) !== null && _g !== void 0 ? _g : 'north', duration: 0 }, children: entityKids }, entity.start));
|
|
79
|
+
kids.push((0, jsx_runtime_1.jsx)(LinkWrapper_1.LinkWrapper, { link: Object.assign({ type: 'scene', value: entity.value, animation: (_f = entity.animation) !== null && _f !== void 0 ? _f : 'fade', direction: (_g = entity.direction) !== null && _g !== void 0 ? _g : 'north', duration: (_h = entity.duration) !== null && _h !== void 0 ? _h : 200 }, (entity.animation === 'reveal' ? { offset: (_j = entity.offset) !== null && _j !== void 0 ? _j : 0, mode: (_k = entity.mode) !== null && _k !== void 0 ? _k : 'normal' } : {})), children: entityKids }, entity.start));
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
82
|
kids.push(...entityKids);
|
|
@@ -85,7 +85,7 @@ class RichTextConverter {
|
|
|
85
85
|
kids.push(sliceSymbols(content, offset));
|
|
86
86
|
}
|
|
87
87
|
for (const styles of group) {
|
|
88
|
-
const entitiesGroups = (
|
|
88
|
+
const entitiesGroups = (_l = this.groupEntities(entities, styles)) !== null && _l !== void 0 ? _l : [];
|
|
89
89
|
for (const entitiesGroup of entitiesGroups) {
|
|
90
90
|
if (!entitiesGroup.stylesGroup)
|
|
91
91
|
continue;
|
|
@@ -151,7 +151,6 @@ class RichTextConverter {
|
|
|
151
151
|
return styleGroups;
|
|
152
152
|
}
|
|
153
153
|
groupEntities(entities, styleGroups) {
|
|
154
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
155
154
|
const entitiesGroups = [];
|
|
156
155
|
if (!entities.length && !styleGroups)
|
|
157
156
|
return;
|
|
@@ -170,8 +169,8 @@ class RichTextConverter {
|
|
|
170
169
|
const start = dividers[i];
|
|
171
170
|
const end = dividers[i + 1];
|
|
172
171
|
const entity = entities.find(e => e.start === start);
|
|
173
|
-
entitiesGroups.push(Object.assign(
|
|
174
|
-
end },
|
|
172
|
+
entitiesGroups.push(Object.assign({ stylesGroup: [], start,
|
|
173
|
+
end }, this.getLinkFromEntity(entity)));
|
|
175
174
|
}
|
|
176
175
|
return entitiesGroups;
|
|
177
176
|
}
|
|
@@ -197,11 +196,35 @@ class RichTextConverter {
|
|
|
197
196
|
const start = entityDividers[i];
|
|
198
197
|
const end = entityDividers[i + 1];
|
|
199
198
|
const entity = entities.find(e => e.start === start);
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
const link = this.getLinkFromEntity(entity);
|
|
200
|
+
entitiesGroups.push(Object.assign({ stylesGroup: styleGroups.filter(s => s.start >= start && s.end <= end), start,
|
|
201
|
+
end }, link));
|
|
202
202
|
}
|
|
203
203
|
return entitiesGroups;
|
|
204
204
|
}
|
|
205
|
+
getLinkFromEntity(entity) {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
207
|
+
if (!entity)
|
|
208
|
+
return;
|
|
209
|
+
const { data } = entity;
|
|
210
|
+
if (!data)
|
|
211
|
+
return;
|
|
212
|
+
if (data.type === 'url' || data.type === 'anchor') {
|
|
213
|
+
return { url: data.url, target: (_a = data.target) !== null && _a !== void 0 ? _a : '_self' };
|
|
214
|
+
}
|
|
215
|
+
if (data.type === 'scene') {
|
|
216
|
+
if (data.animation === 'fade') {
|
|
217
|
+
return { type: 'scene', value: data.value, animation: 'fade', duration: (_b = data.duration) !== null && _b !== void 0 ? _b : 0 };
|
|
218
|
+
}
|
|
219
|
+
if (data.animation === 'slide') {
|
|
220
|
+
return { type: 'scene', value: data.value, animation: 'slide', direction: (_c = data.direction) !== null && _c !== void 0 ? _c : 'north', duration: (_d = data.duration) !== null && _d !== void 0 ? _d : 0 };
|
|
221
|
+
}
|
|
222
|
+
if (data.animation === 'reveal') {
|
|
223
|
+
return { type: 'scene', value: data.value, animation: 'reveal', direction: (_e = data.direction) !== null && _e !== void 0 ? _e : 'north', offset: (_f = data.offset) !== null && _f !== void 0 ? _f : 0, mode: (_g = data.mode) !== null && _g !== void 0 ? _g : 'normal', duration: (_h = data.duration) !== null && _h !== void 0 ? _h : 0 };
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
205
228
|
static fromRangeStylesToInline(draftStyle, exemplary) {
|
|
206
229
|
const { value, name } = draftStyle;
|
|
207
230
|
const map = {
|