@flowsterix/react 0.1.0 → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Kevin Graf
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useTanStackRouterTourAdapter
3
- } from "./chunk-RCASLQRS.mjs";
3
+ } from "./chunk-LQFOZS4Y.mjs";
4
4
 
5
5
  // src/router/tanstackRouterSync.tsx
6
6
  import * as TanStackRouter from "@tanstack/react-router";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPathString,
3
3
  notifyRouteChange
4
- } from "./chunk-RPA2S5UP.mjs";
4
+ } from "./chunk-WTGQUDPT.mjs";
5
5
 
6
6
  // src/router/tanstackRouterAdapter.tsx
7
7
  import { useRouterState } from "@tanstack/react-router";
@@ -37,15 +37,17 @@ var getViewportRect = () => {
37
37
  var expandRect = (rect, padding) => {
38
38
  if (!isBrowser) return rect;
39
39
  const viewport = getViewportRect();
40
- const top = Math.max(0, rect.top - padding);
41
- const left = Math.max(0, rect.left - padding);
42
- const width = Math.min(viewport.width - left, rect.width + padding * 2);
43
- const height = Math.min(viewport.height - top, rect.height + padding * 2);
40
+ const spaceTop = rect.top;
41
+ const spaceBottom = viewport.height - rect.bottom;
42
+ const spaceLeft = rect.left;
43
+ const spaceRight = viewport.width - rect.right;
44
+ const verticalPadding = Math.min(padding, spaceTop, spaceBottom);
45
+ const horizontalPadding = Math.min(padding, spaceLeft, spaceRight);
44
46
  return createRect({
45
- top,
46
- left,
47
- width: Math.max(0, width),
48
- height: Math.max(0, height)
47
+ top: rect.top - verticalPadding,
48
+ left: rect.left - horizontalPadding,
49
+ width: rect.width + horizontalPadding * 2,
50
+ height: rect.height + verticalPadding * 2
49
51
  });
50
52
  };
51
53
  var getClientRect = (element) => toClientRect(element.getBoundingClientRect());
package/dist/index.cjs CHANGED
@@ -250,15 +250,17 @@ var getViewportRect = () => {
250
250
  var expandRect = (rect, padding) => {
251
251
  if (!isBrowser) return rect;
252
252
  const viewport = getViewportRect();
253
- const top = Math.max(0, rect.top - padding);
254
- const left = Math.max(0, rect.left - padding);
255
- const width = Math.min(viewport.width - left, rect.width + padding * 2);
256
- const height = Math.min(viewport.height - top, rect.height + padding * 2);
253
+ const spaceTop = rect.top;
254
+ const spaceBottom = viewport.height - rect.bottom;
255
+ const spaceLeft = rect.left;
256
+ const spaceRight = viewport.width - rect.right;
257
+ const verticalPadding = Math.min(padding, spaceTop, spaceBottom);
258
+ const horizontalPadding = Math.min(padding, spaceLeft, spaceRight);
257
259
  return createRect({
258
- top,
259
- left,
260
- width: Math.max(0, width),
261
- height: Math.max(0, height)
260
+ top: rect.top - verticalPadding,
261
+ left: rect.left - horizontalPadding,
262
+ width: rect.width + horizontalPadding * 2,
263
+ height: rect.height + verticalPadding * 2
262
264
  });
263
265
  };
264
266
  var getClientRect = (element) => toClientRect(element.getBoundingClientRect());
package/dist/index.mjs CHANGED
@@ -4,10 +4,10 @@ import {
4
4
  getTourRouter,
5
5
  setTanStackRouter,
6
6
  setTourRouter
7
- } from "./chunk-U757YVZP.mjs";
7
+ } from "./chunk-B6OJ26VH.mjs";
8
8
  import {
9
9
  useTanStackRouterTourAdapter
10
- } from "./chunk-RCASLQRS.mjs";
10
+ } from "./chunk-LQFOZS4Y.mjs";
11
11
  import {
12
12
  createPathString,
13
13
  expandRect,
@@ -20,7 +20,7 @@ import {
20
20
  portalHost,
21
21
  subscribeToRouteChanges,
22
22
  supportsMasking
23
- } from "./chunk-RPA2S5UP.mjs";
23
+ } from "./chunk-WTGQUDPT.mjs";
24
24
 
25
25
  // src/context.tsx
26
26
  import {
@@ -4,17 +4,17 @@ import {
4
4
  getTourRouter,
5
5
  setTanStackRouter,
6
6
  setTourRouter
7
- } from "../chunk-U757YVZP.mjs";
7
+ } from "../chunk-B6OJ26VH.mjs";
8
8
  import {
9
9
  useTanStackRouterTourAdapter
10
- } from "../chunk-RCASLQRS.mjs";
10
+ } from "../chunk-LQFOZS4Y.mjs";
11
11
  import {
12
12
  createPathString,
13
13
  getCurrentRoutePath,
14
14
  notifyRouteChange,
15
15
  routeGatingChannel,
16
16
  subscribeToRouteChanges
17
- } from "../chunk-RPA2S5UP.mjs";
17
+ } from "../chunk-WTGQUDPT.mjs";
18
18
  export {
19
19
  TanStackRouterSync,
20
20
  createPathString,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPathString,
3
3
  notifyRouteChange
4
- } from "../chunk-RPA2S5UP.mjs";
4
+ } from "../chunk-WTGQUDPT.mjs";
5
5
 
6
6
  // src/router/nextAppRouterAdapter.tsx
7
7
  import * as NextNavigation from "next/navigation";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPathString,
3
3
  notifyRouteChange
4
- } from "../chunk-RPA2S5UP.mjs";
4
+ } from "../chunk-WTGQUDPT.mjs";
5
5
 
6
6
  // src/router/nextPagesRouterAdapter.tsx
7
7
  import * as NextRouter from "next/router";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPathString,
3
3
  notifyRouteChange
4
- } from "../chunk-RPA2S5UP.mjs";
4
+ } from "../chunk-WTGQUDPT.mjs";
5
5
 
6
6
  // src/router/reactRouterAdapter.tsx
7
7
  import { useEffect } from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  useTanStackRouterTourAdapter
3
- } from "../chunk-RCASLQRS.mjs";
4
- import "../chunk-RPA2S5UP.mjs";
3
+ } from "../chunk-LQFOZS4Y.mjs";
4
+ import "../chunk-WTGQUDPT.mjs";
5
5
  export {
6
6
  useTanStackRouterTourAdapter
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,SAC4C,CAAA;AAElE,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,+BAKxB,QAAQ,KAAG,cAOZ,CAAA;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,GAAG,eAAe,KAAG,cAM3D,CAAA;AAEJ,eAAO,MAAM,eAAe,QAAO,cAgBlC,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,MAAM,cAAc,EACpB,SAAS,MAAM,KACd,cAeF,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,cAAc,EAAE,eAAU,YAUhE,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,cACF,CAAA;AAe/C,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,KAAK,CAAC,OAAO,CA4BhE,CAAA;AAED,eAAO,MAAM,UAAU,0BAA2C,CAAA;AA4BlE,eAAO,MAAM,eAAe,eAM3B,CAAA"}
1
+ {"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,SAC4C,CAAA;AAElE,KAAK,QAAQ,GAAG;IACd,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,+BAKxB,QAAQ,KAAG,cAOZ,CAAA;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,OAAO,GAAG,eAAe,KAAG,cAM3D,CAAA;AAEJ,eAAO,MAAM,eAAe,QAAO,cAgBlC,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,MAAM,cAAc,EACpB,SAAS,MAAM,KACd,cAqBF,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,cAAc,EAAE,eAAU,YAUhE,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,KAAG,cACF,CAAA;AAe/C,eAAO,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,KAAK,CAAC,OAAO,CA4BhE,CAAA;AAED,eAAO,MAAM,UAAU,0BAA2C,CAAA;AA4BlE,eAAO,MAAM,eAAe,eAM3B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowsterix/react",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React bindings for Flowsterix - guided tours and onboarding flows",
5
5
  "license": "MIT",
6
6
  "repository": {