@linzjs/windows 9.4.0 → 9.5.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.
@@ -8,8 +8,6 @@ import React, {
8
8
  useState,
9
9
  } from 'react';
10
10
  import { createPortal } from 'react-dom';
11
- import { useInterval } from 'usehooks-ts';
12
- import { v4 } from 'uuid';
13
11
 
14
12
  import { debugLog } from '../common/debug';
15
13
  import {
@@ -20,6 +18,8 @@ import {
20
18
  ShowModalProps,
21
19
  } from './LuiModalAsyncContext';
22
20
  import { LuiModalAsyncInstanceContext } from './LuiModalAsyncInstanceContext';
21
+ import { v4 } from 'uuid';
22
+ import { useInterval } from '../common/useInterval';
23
23
 
24
24
  export interface LuiModalAsyncInstance {
25
25
  uuid: string;
@@ -0,0 +1,44 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { useIsomorphicLayoutEffect } from 'usehooks-ts';
3
+
4
+ /**
5
+ * Copied from usehooks-ts
6
+ *
7
+ * Custom hook that creates an interval that invokes a callback function at a specified delay using the [`setInterval API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval).
8
+ * @param {() => void} callback - The function to be invoked at each interval.
9
+ * @param {number | null} delay - The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval.
10
+ * @public
11
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-interval)
12
+ * @example
13
+ * ```tsx
14
+ * const handleInterval = () => {
15
+ * // Code to be executed at each interval
16
+ * };
17
+ * useInterval(handleInterval, 1000);
18
+ * ```
19
+ */
20
+ export function useInterval(callback: () => void, delay: number | null) {
21
+ const savedCallback = useRef(callback);
22
+
23
+ // Remember the latest callback if it changes.
24
+ useIsomorphicLayoutEffect(() => {
25
+ savedCallback.current = callback;
26
+ }, [callback]);
27
+
28
+ // Set up the interval.
29
+ useEffect(() => {
30
+ // Don't schedule if no delay is specified.
31
+ // Note: 0 is a valid value for delay.
32
+ if (delay === null) {
33
+ return;
34
+ }
35
+
36
+ const id = setInterval(() => {
37
+ savedCallback.current();
38
+ }, delay);
39
+
40
+ return () => {
41
+ clearInterval(id);
42
+ };
43
+ }, [delay]);
44
+ }
@@ -0,0 +1,18 @@
1
+ import { useEffect, useLayoutEffect } from 'react';
2
+
3
+ /**
4
+ * Copied from usehooks-ts
5
+ *
6
+ * Custom hook that uses either `useLayoutEffect` or `useEffect` based on the environment (client-side or server-side).
7
+ * @param {Function} effect - The effect function to be executed.
8
+ * @param {Array<any>} [dependencies] - An array of dependencies for the effect (optional).
9
+ * @public
10
+ * @see [Documentation](https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect)
11
+ * @example
12
+ * ```tsx
13
+ * useIsomorphicLayoutEffect(() => {
14
+ * // Code to be executed during the layout phase on the client side
15
+ * }, [dependency1, dependency2]);
16
+ * ```
17
+ */
18
+ export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
@@ -0,0 +1,4 @@
1
+ let counter = 0;
2
+
3
+ // We don't need a uuid a simple number would suffice
4
+ export const v4 = () => `__windowsId__${counter}`;
@@ -15,7 +15,6 @@ import {
15
15
  useState,
16
16
  } from 'react';
17
17
  import { createPortal } from 'react-dom';
18
- import { useInterval } from 'usehooks-ts';
19
18
 
20
19
  import { PanelInstanceContext } from './PanelInstanceContext';
21
20
  import { PanelsContext } from './PanelsContext';
@@ -25,6 +24,7 @@ import { PanelPosition } from './types/PanelPosition';
25
24
  import { PanelProps } from './types/PanelProps';
26
25
  import { PanelSize } from './types/PanelSize';
27
26
  import { useRestoreStateFrom } from './usePanelStateHandler';
27
+ import { useInterval } from '../common/useInterval';
28
28
 
29
29
  const defaultInitialSize = { width: 320, height: 200 };
30
30
 
@@ -1,8 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { v4 } from 'uuid';
3
2
 
4
3
  import { PanelContext } from './PanelContext';
5
4
  import { PanelInstanceContext } from './PanelInstanceContext';
5
+ import { v4 } from '../common/uuid';
6
6
 
7
7
  export interface PanelInlineProps {
8
8
  title: string;
@@ -1,12 +1,12 @@
1
1
  import { castArray, isEmpty, maxBy, partition, sortBy } from 'lodash-es';
2
2
  import React, { Fragment, PropsWithChildren, ReactElement, useCallback, useMemo, useRef, useState } from 'react';
3
- import { useInterval } from 'usehooks-ts';
4
- import { v4 } from 'uuid';
5
3
 
6
4
  import { PanelInstanceContextProvider } from './PanelInstanceContextProvider';
7
5
  import { OpenPanelOptions, PanelInstance, PanelsContext } from './PanelsContext';
8
6
  import { PanelPosition } from './types';
9
7
  import { PanelStateOptions } from './types/PanelStateOptions';
8
+ import { v4 } from '../common/uuid';
9
+ import { useInterval } from '../common/useInterval';
10
10
 
11
11
  export interface PanelsContextProviderProps {
12
12
  baseZIndex?: number;
@@ -2,10 +2,10 @@ import './Ribbon.scss';
2
2
 
3
3
  import clsx from 'clsx';
4
4
  import { PropsWithChildren, ReactElement, useState } from 'react';
5
- import { v4 } from 'uuid';
6
5
 
7
6
  import { RibbonButton, RibbonButtonProps } from './RibbonButton';
8
7
  import { RibbonButtonSliderContext, RibbonSliderAlignment, ribbonSliderAlignments } from './RibbonButtonSliderContext';
8
+ import { v4 } from '../common/uuid';
9
9
 
10
10
  export interface RibbonSliderProps extends RibbonButtonProps {
11
11
  autoClose?: boolean;
package/package.json CHANGED
@@ -13,10 +13,9 @@
13
13
  "popout"
14
14
  ],
15
15
  "main": "./dist/index.ts",
16
- "version": "9.4.0",
16
+ "version": "9.5.1",
17
17
  "peerDependencies": {
18
18
  "@linzjs/lui": ">=23",
19
- "lodash-es": ">=4",
20
19
  "react": ">=18",
21
20
  "react-dom": ">=18"
22
21
  },
@@ -31,9 +30,9 @@
31
30
  "node": ">=22"
32
31
  },
33
32
  "scripts": {
34
- "build": "run-s clean lintall bundle",
33
+ "build": "mkdirp ./dist && run-s clean lintall bundle",
35
34
  "yalc": "run-s clean bundle && yalc push",
36
- "clean": "rimraf dist && mkdirp ./dist",
35
+ "clean": "node -e \"fs.rmSync('dist', { recursive: true, force: true })\"",
37
36
  "bundle": "tsc --noEmit && rollup -c",
38
37
  "test": "vitest run",
39
38
  "test:watch": "vitest --watch",
@@ -49,25 +48,19 @@
49
48
  "dependencies": {
50
49
  "@emotion/cache": "^11.14.0",
51
50
  "@emotion/react": "^11.14.0",
52
- "@emotion/styled": "11.14.1",
53
- "@types/uuid": "^11.0.0",
54
- "lodash-es": ">=4",
55
- "react-loading-skeleton": "^3.5.0",
56
- "react-rnd": "^10.5.3",
57
- "usehooks-ts": "^3.1.1",
58
- "uuid": "^13.0.0"
51
+ "lodash-es": "4.18.1",
52
+ "react-loading-skeleton": "3.5.0",
53
+ "react-rnd": "10.5.3"
59
54
  },
60
55
  "devDependencies": {
61
56
  "@chromatic-com/storybook": "^4.1.3",
62
57
  "@linzjs/lui": "^24.11.0",
63
58
  "@linzjs/step-ag-grid": "^29.14.1",
64
- "@linzjs/style": "^5.4.0",
65
59
  "@rollup/plugin-commonjs": "^28.0.9",
66
- "@rollup/plugin-json": "^6.1.0",
67
60
  "@rollup/plugin-node-resolve": "^16.0.3",
68
- "@storybook/addon-docs": "^9.1.20",
69
- "@storybook/addon-links": "^9.1.20",
70
- "@storybook/react-vite": "^9.1.20",
61
+ "@storybook/addon-docs": "9.1.20",
62
+ "@storybook/addon-links": "9.1.20",
63
+ "@storybook/react-vite": "9.1.20",
71
64
  "@testing-library/dom": "^10.4.1",
72
65
  "@testing-library/react": "^16.3.2",
73
66
  "@testing-library/user-event": "^14.6.1",
@@ -76,23 +69,20 @@
76
69
  "@types/react": "^18.3.28",
77
70
  "@types/react-dom": "^18.3.7",
78
71
  "@vitejs/plugin-react-swc": "^4.3.0",
79
- "@vitest/ui": "^4.1.0",
72
+ "@vitest/ui": "^4.1.2",
80
73
  "ag-grid-community": "34.2.0",
81
74
  "ag-grid-react": "34.2.0",
82
75
  "jsdom": "^27.3.0",
83
76
  "mkdirp": "^3.0.1",
84
77
  "npm-run-all": "^4.1.5",
85
- "oxlint": "^1.56.0",
86
- "oxfmt": "^0.41.0",
78
+ "oxfmt": "^0.43.0",
79
+ "oxlint": "^1.58.0",
87
80
  "react": "^18.3.1",
88
- "react-app-polyfill": "^3.0.0",
89
81
  "react-dom": "18.3.1",
90
- "rollup": "^4.60.0",
82
+ "rollup": "^4.60.1",
91
83
  "rollup-plugin-copy": "^3.5.0",
92
84
  "sass": "^1.98.0",
93
- "sass-loader": "^16.0.7",
94
- "storybook": "^9.1.19",
95
- "style-loader": "^4.0.0",
85
+ "storybook": "9.1.20",
96
86
  "stylelint": "^16.26.1",
97
87
  "stylelint-config-recommended": "^17.0.0",
98
88
  "stylelint-config-recommended-scss": "^16.0.2",
@@ -101,14 +91,9 @@
101
91
  "stylelint-scss": "6.14.0",
102
92
  "typescript": "^5.9.3",
103
93
  "vite": "^7.3.1",
104
- "vite-plugin-html": "^3.2.2",
105
94
  "vite-tsconfig-paths": "^5.1.4",
106
95
  "vitest": "^4.1.0"
107
96
  },
108
- "optionalDependencies": {
109
- "@rollup/rollup-linux-x64-gnu": "^4.60.0",
110
- "@swc/core-linux-x64-gnu": "^1.15.21"
111
- },
112
97
  "browserslist": {
113
98
  "production": [
114
99
  ">0.2%",