@aptre/flex-layout 0.1.2 → 0.1.4

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/dist/index.mjs CHANGED
@@ -48,11 +48,7 @@ var Rect = class _Rect {
48
48
  return new _Rect(this.x, this.y, this.width, this.height);
49
49
  }
50
50
  equals(rect) {
51
- if (this.x === rect.x && this.y === rect.y && this.width === rect.width && this.height === rect.height) {
52
- return true;
53
- } else {
54
- return false;
55
- }
51
+ return this.x === rect?.x && this.y === rect?.y && this.width === rect?.width && this.height === rect?.height;
56
52
  }
57
53
  getBottom() {
58
54
  return this.y + this.height;
@@ -3157,15 +3153,17 @@ var BorderButton = (props) => {
3157
3153
  });
3158
3154
  const updateRect = () => {
3159
3155
  const layoutRect = layout.getDomRect();
3160
- const r = selfRef.current.getBoundingClientRect();
3161
- node._setTabRect(
3162
- new Rect(
3163
- r.left - layoutRect.left,
3164
- r.top - layoutRect.top,
3165
- r.width,
3166
- r.height
3167
- )
3168
- );
3156
+ const r = selfRef.current?.getBoundingClientRect();
3157
+ if (r) {
3158
+ node._setTabRect(
3159
+ new Rect(
3160
+ r.left - layoutRect.left,
3161
+ r.top - layoutRect.top,
3162
+ r.width,
3163
+ r.height
3164
+ )
3165
+ );
3166
+ }
3169
3167
  };
3170
3168
  const onTextBoxMouseDown = (event) => {
3171
3169
  event.stopPropagation();
@@ -3403,13 +3401,16 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
3403
3401
  React5.useLayoutEffect(() => {
3404
3402
  updateVisibleTabs();
3405
3403
  });
3404
+ const instance = selfRef.current;
3406
3405
  React5.useEffect(() => {
3407
- const instance = selfRef.current;
3406
+ if (!instance) {
3407
+ return;
3408
+ }
3408
3409
  instance.addEventListener("wheel", onWheel, { passive: false });
3409
3410
  return () => {
3410
3411
  instance.removeEventListener("wheel", onWheel);
3411
3412
  };
3412
- }, []);
3413
+ }, [instance]);
3413
3414
  const onWheel = (event) => {
3414
3415
  event.preventDefault();
3415
3416
  };
@@ -4114,15 +4115,17 @@ var TabButton = (props) => {
4114
4115
  });
4115
4116
  const updateRect = () => {
4116
4117
  const layoutRect = layout.getDomRect();
4117
- const r = selfRef.current.getBoundingClientRect();
4118
- node._setTabRect(
4119
- new Rect(
4120
- r.left - layoutRect.left,
4121
- r.top - layoutRect.top,
4122
- r.width,
4123
- r.height
4124
- )
4125
- );
4118
+ const r = selfRef.current?.getBoundingClientRect();
4119
+ if (r) {
4120
+ node._setTabRect(
4121
+ new Rect(
4122
+ r.left - layoutRect.left,
4123
+ r.top - layoutRect.top,
4124
+ r.width,
4125
+ r.height
4126
+ )
4127
+ );
4128
+ }
4126
4129
  };
4127
4130
  const onTextBoxMouseDown = (event) => {
4128
4131
  event.stopPropagation();
@@ -5842,7 +5845,7 @@ var Layout = class extends React16.Component {
5842
5845
  /** @internal */
5843
5846
  _getScreenRect(node) {
5844
5847
  const rect = node.getRect().clone();
5845
- const bodyRect = this.selfRef.current.getBoundingClientRect();
5848
+ const bodyRect = this.selfRef.current?.getBoundingClientRect();
5846
5849
  if (!bodyRect) {
5847
5850
  return null;
5848
5851
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aptre/flex-layout",
3
3
  "author": "Caplin Systems Ltd",
4
4
  "description": "A multi-tab docking layout manager",
5
- "version": "0.1.2",
5
+ "version": "0.1.4",
6
6
  "license": "ISC",
7
7
  "repository": {
8
8
  "type": "git",
@@ -49,7 +49,7 @@
49
49
  "build:doc": "typedoc --out typedoc --exclude \"**/examples/**/*.tsx\" --excludeInternal --disableSources --excludePrivate --excludeProtected --readme none ./src",
50
50
  "build:style": "sass style/underline.scss style/underline.css && sass style/gray.scss style/gray.css && sass style/light.scss style/light.css && sass style/dark.scss style/dark.css",
51
51
  "test": "tsc --project tsconfig.json --noEmit",
52
- "format": "prettier --write './{src,style,declarations}/**/(*.ts|*.tsx|*.html|*.css|*.scss)' package.json",
52
+ "format": "prettier --write './style/*.scss' './{src,declarations}/**/(*.ts|*.tsx|*.html)' package.json",
53
53
  "lint": "eslint src/*"
54
54
  },
55
55
  "peerDependencies": {
@@ -125,7 +125,7 @@
125
125
  <h4 class="tsd-parameters-title">Parameters</h4>
126
126
  <ul class="tsd-parameter-list">
127
127
  <li>
128
- <h5><span class="tsd-kind-parameter">rect</span>: <a href="Rect.html" class="tsd-signature-type tsd-kind-class">Rect</a></h5></li></ul></div>
128
+ <h5><span class="tsd-kind-parameter">rect</span>: <span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><a href="Rect.html" class="tsd-signature-type tsd-kind-class">Rect</a></h5></li></ul></div>
129
129
  <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4></li></ul></section>
130
130
  <section class="tsd-panel tsd-member"><a id="getBottom" class="tsd-anchor"></a>
131
131
  <h3 class="tsd-anchor-link"><span>get<wbr/>Bottom</span><a href="#getBottom" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>