-
-
Notifications
You must be signed in to change notification settings - Fork 508
chore: improve package.json #695
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
Changes from all commits
735cbee
09c9ceb
7e72066
a1e295d
05cf408
bff73eb
b2ecd31
8903671
7b9a7ab
249e8db
3a39b29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| import cls from "classnames"; | ||
| import s from "./Button.css"; | ||
| import * as s from "./Button.css"; | ||
| import PureComponent from "../lib/PureComponent"; | ||
|
|
||
| export default class Button extends PureComponent { | ||
| render({ active, toggle, className, children, ...props }) { | ||
| render({ active, className, children, ...props }) { | ||
| const classes = cls(className, { | ||
| [s.button]: true, | ||
| [s.active]: active, | ||
| [s.toggle]: toggle, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have |
||
| }); | ||
|
|
||
| return ( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { createRef } from "preact"; | ||
| import PureComponent from "../lib/PureComponent"; | ||
|
|
||
| import s from "./Dropdown.css"; | ||
| import * as s from "./Dropdown.css"; | ||
|
|
||
| export default class Dropdown extends PureComponent { | ||
| input = createRef(); | ||
|
|
@@ -41,7 +41,7 @@ export default class Dropdown extends PureComponent { | |
| onFocus={this.handleFocus} | ||
| /> | ||
| {this.state.showOptions ? ( | ||
| <div className={s.options}> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have |
||
| <div> | ||
| {filteredOptions.map((option) => ( | ||
| <div | ||
| key={option} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import escapeRegExp from "escape-string-regexp"; | ||
| import { escape } from "html-escaper"; | ||
| import filesize from "filesize"; | ||
| import { filesize } from "filesize"; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now we need to use named export |
||
| import cls from "classnames"; | ||
|
|
||
| import PureComponent from "../lib/PureComponent"; | ||
| import s from "./ModuleItem.css"; | ||
| import * as s from "./ModuleItem.css"; | ||
|
|
||
| export default class ModuleItem extends PureComponent { | ||
| state = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { Component } from "preact"; | ||
| import filesize from "filesize"; | ||
| import { computed } from "mobx"; | ||
| import { filesize } from "filesize"; | ||
| import { computed, makeObservable } from "mobx"; | ||
| import { observer } from "mobx-react"; | ||
|
|
||
| import { isChunkParsed } from "../utils"; | ||
|
|
@@ -13,7 +13,7 @@ import Checkbox from "./Checkbox"; | |
| import CheckboxList from "./CheckboxList"; | ||
| import ContextMenu from "./ContextMenu"; | ||
|
|
||
| import s from "./ModulesTreemap.css"; | ||
| import * as s from "./ModulesTreemap.css"; | ||
| import Search from "./Search"; | ||
| import { store } from "../store"; | ||
| import ModulesList from "./ModulesList"; | ||
|
|
@@ -37,8 +37,7 @@ function getSizeSwitchItems() { | |
| return items; | ||
| } | ||
|
|
||
| @observer | ||
| export default class ModulesTreemap extends Component { | ||
| class ModulesTreemap extends Component { | ||
| mouseCoords = { | ||
| x: 0, | ||
| y: 0, | ||
|
|
@@ -53,6 +52,18 @@ export default class ModulesTreemap extends Component { | |
| tooltipContent: null, | ||
| }; | ||
|
|
||
| constructor() { | ||
| super(); | ||
|
|
||
| makeObservable(this, { | ||
| sizeSwitchItems: computed, | ||
| activeSizeItem: computed, | ||
| chunkItems: computed, | ||
| highlightedModules: computed, | ||
| foundModulesInfo: computed, | ||
| }); | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid using decorators (they are deprecated in mobx too) |
||
|
|
||
| componentDidMount() { | ||
| document.addEventListener("mousemove", this.handleMouseMove, true); | ||
| } | ||
|
|
@@ -192,17 +203,17 @@ export default class ModulesTreemap extends Component { | |
| return [`${label} (`, <strong>{filesize(size)}</strong>, ")"]; | ||
| }; | ||
|
|
||
| @computed get sizeSwitchItems() { | ||
| get sizeSwitchItems() { | ||
| return store.hasParsedSizes | ||
| ? getSizeSwitchItems() | ||
| : getSizeSwitchItems().slice(0, 1); | ||
| } | ||
|
|
||
| @computed get activeSizeItem() { | ||
| get activeSizeItem() { | ||
| return this.sizeSwitchItems.find((item) => item.prop === store.activeSize); | ||
| } | ||
|
|
||
| @computed get chunkItems() { | ||
| get chunkItems() { | ||
| const { allChunks, activeSize } = store; | ||
| let chunkItems = [...allChunks]; | ||
|
|
||
|
|
@@ -217,11 +228,11 @@ export default class ModulesTreemap extends Component { | |
| return chunkItems; | ||
| } | ||
|
|
||
| @computed get highlightedModules() { | ||
| get highlightedModules() { | ||
| return new Set(store.foundModules); | ||
| } | ||
|
|
||
| @computed get foundModulesInfo() { | ||
| get foundModulesInfo() { | ||
| if (!store.isSearching) { | ||
| // ` ` to reserve space | ||
| return "\u00A0"; | ||
|
|
@@ -383,3 +394,5 @@ export default class ModulesTreemap extends Component { | |
| ); | ||
| } | ||
| } | ||
|
|
||
| export default observer(ModulesTreemap); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,3 +92,7 @@ | |
| top: 0; | ||
| width: 7px; | ||
| } | ||
|
|
||
| :export { | ||
| toggleTime: 200ms; | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using this in JS, so let's export this value using ICSS |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default all classnames in named export (for better tree shaking)