@synerise/ds-core 1.11.4 → 1.12.0
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/CHANGELOG.md +6 -0
- package/dist/js/DSProvider/DSProvider.js +2 -0
- package/dist/js/index.d.ts +1 -0
- package/dist/js/index.js +2 -0
- package/dist/js/portal/PortalRenderer.d.ts +2 -0
- package/dist/js/portal/PortalRenderer.js +29 -0
- package/dist/js/portal/portalStore.d.ts +12 -0
- package/dist/js/portal/portalStore.js +44 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.12.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-core@1.11.4...@synerise/ds-core@1.12.0) (2026-05-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **modal:** migration from antd ([3588b65](https://github.com/synerise/synerise-design/commit/3588b65fbe67838fed4ee5125090ad47d334e04b))
|
|
11
|
+
|
|
6
12
|
## [1.11.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-core@1.11.3...@synerise/ds-core@1.11.4) (2026-05-04)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -9,6 +9,7 @@ import "../data-format/constants/dataFormatConfig.constants.js";
|
|
|
9
9
|
import "../data-format/utils/timeZone.utils.js";
|
|
10
10
|
import "../data-format/utils/dataFormat.utils.js";
|
|
11
11
|
import "react-intl";
|
|
12
|
+
import PortalRenderer from "../portal/PortalRenderer.js";
|
|
12
13
|
import { Toaster } from "../toaster/Toaster.js";
|
|
13
14
|
import { TOASTER_DEFAULTS } from "../toaster/constants.js";
|
|
14
15
|
import "../toaster/contexts/ToasterContext.js";
|
|
@@ -29,6 +30,7 @@ const DSProvider = ({
|
|
|
29
30
|
}) => {
|
|
30
31
|
return /* @__PURE__ */ jsx(LocaleProvider, { locale, messages, timeZone, defaultLocale, onErrorIntl, children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children: /* @__PURE__ */ jsx(DataFormatConfigProvider, { dataFormatConfig, children: /* @__PURE__ */ jsxs(ToasterProvider, { toasterProps: toasterProps || TOASTER_DEFAULTS, children: [
|
|
31
32
|
children,
|
|
33
|
+
/* @__PURE__ */ jsx(PortalRenderer, {}),
|
|
32
34
|
toasterProps !== false && /* @__PURE__ */ jsx(Toaster, {})
|
|
33
35
|
] }) }) }) });
|
|
34
36
|
};
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as DSProvider, type DSProviderProps } from './DSProvider';
|
|
2
2
|
export { default as mediaQuery } from './mediaQuery/mediaQuery';
|
|
3
|
+
export { setPortalContent } from './portal/portalStore';
|
|
3
4
|
export { theme, useTheme, defaultColorsOrder, themeVariables, type ThemePropsVars, type ThemeProps, type WithTheme, type DefaultColor, } from './DSProvider/ThemeProvider/theme';
|
|
4
5
|
export * from './data-format';
|
|
5
6
|
export * from './testing';
|
package/dist/js/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as default2 } from "./DSProvider/DSProvider.js";
|
|
2
2
|
import { default as default3 } from "./mediaQuery/mediaQuery.js";
|
|
3
|
+
import { setPortalContent } from "./portal/portalStore.js";
|
|
3
4
|
import { defaultColorsOrder, default as default4, themeVariables, useTheme } from "./DSProvider/ThemeProvider/theme.js";
|
|
4
5
|
import { DataFormatConfigProvider } from "./data-format/providers/DataFormatConfigProvider.js";
|
|
5
6
|
import { FormattedDate } from "./data-format/components/FormattedDate.js";
|
|
@@ -98,6 +99,7 @@ export {
|
|
|
98
99
|
getDefaultDataTimeOptions,
|
|
99
100
|
default3 as mediaQuery,
|
|
100
101
|
default5 as renderWithProvider,
|
|
102
|
+
setPortalContent,
|
|
101
103
|
sleep,
|
|
102
104
|
default4 as theme,
|
|
103
105
|
themeVariables,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useMemo, useSyncExternalStore, useEffect } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
import { subscribePortal, getPortalSnapshot, setPortalOwner, clearPortalOwner } from "./portalStore.js";
|
|
4
|
+
const PortalRenderer = () => {
|
|
5
|
+
const id = useMemo(() => /* @__PURE__ */ Symbol("portal-owner"), []);
|
|
6
|
+
const snapshot = useSyncExternalStore(subscribePortal, getPortalSnapshot);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
setPortalOwner(id);
|
|
9
|
+
return () => clearPortalOwner(id);
|
|
10
|
+
}, [id]);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (snapshot.owner === null) {
|
|
13
|
+
setPortalOwner(id);
|
|
14
|
+
}
|
|
15
|
+
}, [id, snapshot.owner]);
|
|
16
|
+
if (snapshot.owner !== id) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (!snapshot.content) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (typeof document === "undefined") {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return createPortal(snapshot.content, document.body);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
PortalRenderer as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type Listener = () => void;
|
|
3
|
+
type Snapshot = {
|
|
4
|
+
content: ReactNode | null;
|
|
5
|
+
owner: symbol | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const setPortalContent: (next: ReactNode | null) => void;
|
|
8
|
+
export declare const setPortalOwner: (next: symbol) => void;
|
|
9
|
+
export declare const clearPortalOwner: (id: symbol) => void;
|
|
10
|
+
export declare const getPortalSnapshot: () => Snapshot;
|
|
11
|
+
export declare const subscribePortal: (listener: Listener) => (() => void);
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
let content = null;
|
|
2
|
+
let owner = null;
|
|
3
|
+
let snapshot = {
|
|
4
|
+
content,
|
|
5
|
+
owner
|
|
6
|
+
};
|
|
7
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
8
|
+
const emitIfChanged = () => {
|
|
9
|
+
const next = {
|
|
10
|
+
content,
|
|
11
|
+
owner
|
|
12
|
+
};
|
|
13
|
+
if (next.content === snapshot.content && next.owner === snapshot.owner) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
snapshot = next;
|
|
17
|
+
listeners.forEach((listener) => listener());
|
|
18
|
+
};
|
|
19
|
+
const setPortalContent = (next) => {
|
|
20
|
+
content = next;
|
|
21
|
+
emitIfChanged();
|
|
22
|
+
};
|
|
23
|
+
const setPortalOwner = (next) => {
|
|
24
|
+
owner = next;
|
|
25
|
+
emitIfChanged();
|
|
26
|
+
};
|
|
27
|
+
const clearPortalOwner = (id) => {
|
|
28
|
+
if (owner === id) {
|
|
29
|
+
owner = null;
|
|
30
|
+
emitIfChanged();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getPortalSnapshot = () => snapshot;
|
|
34
|
+
const subscribePortal = (listener) => {
|
|
35
|
+
listeners.add(listener);
|
|
36
|
+
return () => listeners.delete(listener);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
clearPortalOwner,
|
|
40
|
+
getPortalSnapshot,
|
|
41
|
+
setPortalContent,
|
|
42
|
+
setPortalOwner,
|
|
43
|
+
subscribePortal
|
|
44
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Core Components for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"hex-rgb": "^5.0.0",
|
|
65
65
|
"less-vars-to-js": "^1.3.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "f257f56d8991010593efd5ea9915335e813671a6"
|
|
68
68
|
}
|