Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking] Align all text-style related types to better match the use-cases of workspace #383

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

srares76
Copy link
Contributor

This PR aligns all text-style related types to better match the use-cases of workspace.

Related tickets

Screenshots

@github-actions
Copy link
Contributor

Coverage Report

Coverage report can be checked at https://cdnepgrafxstudiodev.azureedge.net/sdk/coverage/383/coverage.html

Use PR sdk package

Tarball can be downloaded from https://cdnepgrafxstudiodev.azureedge.net/sdk/dev-packages/383/studio-sdk.tgz

To use in local project, change package.json to use local tarball

"dependencies": {
    "@chili-publish/studio-sdk": "https://cdnepgrafxstudiodev.azureedge.net/sdk/dev-packages/383/studio-sdk.tgz"
}

@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 2023

Unit Test Results

    1 files    30 suites   17s ⏱️
262 tests 262 ✔️ 0 💤 0
265 runs  265 ✔️ 0 💤 0

Results for commit 4217823.

♻️ This comment has been updated with latest results.

@srares76 srares76 changed the title [Fix] Align all text-style related types to better match the use-cases of workspace [Breaking] Align all text-style related types to better match the use-cases of workspace Oct 30, 2023
packages/sdk/src/types/TextStyleTypes.ts Outdated Show resolved Hide resolved
packages/sdk/src/types/CharacterStyleTypes.ts Outdated Show resolved Hide resolved
packages/sdk/src/types/CharacterStyleTypes.ts Outdated Show resolved Hide resolved
packages/sdk/src/types/CharacterStyleTypes.ts Outdated Show resolved Hide resolved
packages/sdk/src/types/TextStyleTypes.ts Outdated Show resolved Hide resolved
@srares76 srares76 requested a review from Dvergar November 2, 2023 11:03
Copy link
Contributor

@Dvergar Dvergar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One missing property & some confusion I may have spread on one interface.

Just putting those here to make it more clear:
Dart ParagraphStyleDto
Dart CharacterStyleDto
Dart SelectedTextStyleDto

We can still decide to keep properties optional by default but in engine world they are actually required for our 3 models.

export interface SelectedTextStyle {
paragraphStyleId?: string;
export type BaseTextStyle = {
alignToBaseLine?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
alignToBaseLine?: boolean;
alignToBaseLine: boolean | null;

Same for all properties below, they are actually required & nullable properties.


export type ParagraphStyle = {
export type ParagraphStyle = Required<BaseTextStyle> & {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trackingRight?: string;
textIndent?: string;
// end of unit properties
fillColorApplied?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we discussed this in a call and I realize this is there because of my limited understanding of types in typescript.

All the optional properties as of now in textStyles types on SDK are actually required and sometimes nullable types in dart.

So you may safely remove the three fillColorApplied, underline & lineThrough from this type (as inheriting them from BaseTextStyle would make it consistent).

Now all the BaseTextStyle properties types can be made required (& nullable if you chose it to be your default) to match dart.

Note: We're not entirely consistent for all the other types in the SDK either, (not a huge issue for an integrator but we should probably match more type to the ones from the engine, this is mostly a message to me and our team).

@@ -1,7 +1,7 @@
import { EditorAPI, Id } from '../types/CommonTypes';
import { getEditorResponseData } from '../utils/EditorResponseData';
import { ImageSourceTypeEnum, ImageFrameVariableSource } from '../types/FrameTypes';
import { TextType } from '../types/TextTypes';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR needs to be discussed

@brapoprod brapoprod added v2 PR that is linked to the next major version Breaking Changes labels Nov 6, 2023
@brapoprod
Copy link
Member

This PR should be merged into long-lived v2 branch, to fix the issue here we could create a non breaking union type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Changes v2 PR that is linked to the next major version
Development

Successfully merging this pull request may close these issues.

4 participants