@cloud-os/enerqi-application-sdk 20260616.0.2 → 20260616.0.3

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.
@@ -1,4 +1,5 @@
1
- declare const _default: ({ children }: {
1
+ import { ApplicationProps } from "../../index";
2
+ declare const _default: ({ children, ...appProps }: ApplicationProps & {
2
3
  children: React.ReactNode;
3
4
  }) => import("react/jsx-runtime").JSX.Element;
4
5
  export default _default;
@@ -2,10 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { StyleProvider } from "@ant-design/cssinjs";
3
3
  import { v4 as uuidv4 } from "uuid";
4
4
  import { ConfigProvider } from "antd";
5
- export default ({ children }) => {
6
- return (_jsx(StyleProvider, { children: _jsx(ConfigProvider, { theme: {
7
- cssVar: {
8
- prefix: uuidv4(),
9
- },
10
- }, children: children }) }));
5
+ import { ApplicationContext } from "../../Props/ApplicationContext";
6
+ export default ({ children, ...appProps }) => {
7
+ return (_jsx(ApplicationContext.Provider, { value: appProps, children: _jsx(StyleProvider, { children: _jsx(ConfigProvider, { theme: {
8
+ cssVar: {
9
+ prefix: uuidv4(),
10
+ },
11
+ }, children: children }) }) }));
11
12
  };
@@ -0,0 +1,3 @@
1
+ import { ApplicationProps } from "./Application";
2
+ export declare const ApplicationContext: import("react").Context<ApplicationProps<{}> | null>;
3
+ export declare function useApplication(): ApplicationProps;
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext } from "react";
2
+ export const ApplicationContext = createContext(null);
3
+ export function useApplication() {
4
+ const ctx = useContext(ApplicationContext);
5
+ if (!ctx)
6
+ throw new Error("useApplication must be used inside ApplicationContext.Provider");
7
+ return ctx;
8
+ }
@@ -1,2 +1,3 @@
1
1
  export { ApplicationProps } from "./Application/index";
2
2
  export { Debug } from "./Debug";
3
+ export { useApplication } from "./ApplicationContext";
@@ -1 +1,2 @@
1
1
  export { Debug } from "./Debug";
2
+ export { useApplication } from "./ApplicationContext";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-os/enerqi-application-sdk",
3
- "version": "20260616.0.2",
3
+ "version": "20260616.0.3",
4
4
  "description": "",
5
5
  "author": "jack8228@enerqi.tw <jack8228@enerqi.tw>",
6
6
  "main": "dist/index.js",