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

[UUICore]: cleaned up packages and helpers from uui-core. #2117

Merged
merged 34 commits into from
Apr 10, 2024

Conversation

Kuznietsov
Copy link
Collaborator

Summary

  • [uui-core]: helpers cleanup

    • Deprecated:
      • LazyLoadedMap and related:
        • LazyLoadedMapLoadCallback
        • UNKNOWN
        • LOADING
        • LOADED
        • PENDING
        • FAILED
        • LoadingStatus
      • browser helper:
        • Browser
        • getBrowser
      • Debouncer
      • parseIconViewbox
      • parseStringToCSSProperties
      • getScreenSize
      • urlParser
      • batch and related:
        • batch
        • BatchPromiseOptions
  • Removed unused packages.

@Kuznietsov Kuznietsov self-assigned this Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

Generated by: track-bundle-size
Generated at: Wed, 10 Apr 2024 07:12:53 GMT
Bundle size diff (in kBytes). Not gzipped. Both CSS & JS included.
Baseline: v5.6.1 (2024-03-11)
CI Status: ok

Module Baseline Size
(v5.6.1)
Size Diff Within
Threshold
Threshold
(min - max)
templateApp 1041.48 987.81 -53.67
js:-50.35
css:-3.32
🆗 937.33 - 1145.63
@epam/app 6402.7 6369.14 -33.55
js:-7.59
css:-25.96
🆗 5762.42 - 7042.96
@epam/draft-rte 53.77 53.78 +0.01
js:+0.01
css:+0
🆗 48.39 - 59.15
@epam/electric 4.46 4.49 +0.01
js:+0
css:+0.01
🆗 4.02 - 4.91
@epam/promo 55.29 55.14 -0.14
js:+0.06
css:-0.19
🆗 49.75 - 60.81
@epam/uui-extra 0.21 0.21 0
js:0
css:0
🆗 0.19 - 0.23
@epam/loveship 101.41 101.17 -0.24
js:+0
css:-0.24
🆗 91.27 - 111.55
@epam/uui-components 269.68 254.75 -14.92
js:-15
css:+0.08
🆗 242.71 - 296.64
@epam/uui-core 311.4 319.03 +7.63
js:+7.63
css:0
🆗 280.26 - 342.54
@epam/uui-db 42.31 44.68 +2.37
js:+2.37
css:0
🆗 38.08 - 46.54
@epam/uui-docs 192.53 199.79 +7.26
js:+7.17
css:+0.09
🆗 173.28 - 211.79
@epam/uui-editor 157.65 173.26 +15.61
js:+15.92
css:-0.31
🆗 141.89 - 173.42
@epam/uui-timeline 47.19 47.17 -0.03
js:-0.02
css:0
🆗 42.47 - 51.91
@epam/uui 580.2 586.35 +6.15
js:+10.27
css:-4.12
🆗 522.18 - 638.23
new sizes (raw)

To set the sizes as a new baseline, you can copy/paste next content to the uui-build/config/bundleSizeBaseLine.json and commit the file.

{
  "version": "5.7.1",
  "timestamp": "2024-04-10",
  "sizes": {
    "templateApp": {
      "css": 280548,
      "js": 730971
    },
    "@epam/app": {
      "css": 1587795,
      "js": 4934202
    },
    "@epam/draft-rte": {
      "css": 9762,
      "js": 45308
    },
    "@epam/electric": {
      "css": 2289,
      "js": 2299
    },
    "@epam/promo": {
      "css": 40368,
      "js": 16101
    },
    "@epam/uui-extra": {
      "css": 0,
      "js": 213
    },
    "@epam/loveship": {
      "css": 49451,
      "js": 54148
    },
    "@epam/uui-components": {
      "css": 22214,
      "js": 238657
    },
    "@epam/uui-core": {
      "css": 0,
      "js": 326683
    },
    "@epam/uui-db": {
      "css": 0,
      "js": 45754
    },
    "@epam/uui-docs": {
      "css": 3189,
      "js": 201400
    },
    "@epam/uui-editor": {
      "css": 12625,
      "js": 164792
    },
    "@epam/uui-timeline": {
      "css": 2251,
      "js": 46047
    },
    "@epam/uui": {
      "css": 268310,
      "js": 332113
    }
  }
}

Generated by: generate-components-api
CI Status: ok

Total amount of exported types/props without JSDoc comments

Amount
Types 266 (-2) 🆗
Props 239 (+0) 🆗

}

export const range = (start: number, end?: number, step: number = 1) =>
Array.from(rangeGen(start, end, step));
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we actually need to support cases except when start < end, and step = 1? We are not forced to have an lodash-compatible drop-in replacement. We need only to cover our cases.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. We have various places, where we are using range for reverse sequence and with one argument. Here are couple of them:

export const test100KPersons = range(101000, 999, -1).map((id) => ({ id, name: `Person ${id}`, departmentId: Math.floor(Math.random() * 10) }));

const testItems = range(200).map((id) => {

uui-core/src/helpers/range.ts Outdated Show resolved Hide resolved
});
}

const comparer = getOrderComparer([{ field: by, direction: order }]);
Copy link
Contributor

Choose a reason for hiding this comment

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

We use a simple string comparator if by is a function. However, we use Intl-based comparator (implied by use of getOrderComparer) - if we pass a field name as a string.

Why do we need an overloads here? Probably we can accept a function only, and rewrite any orderBy(arr, 'name') to orderBy(arr, i => i.name)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

getOrderComparer uses the same compareScalars function.

function compareScalars(a, b, order) {

So, we are just using shorthand, without changing the logic and I guess, its pretty useful, if we've decided to use our own implementation of orderBy/sortBy.

@Kuznietsov Kuznietsov merged commit 8fe1a8e into develop Apr 10, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants