@salt-ds/styles 0.2.0 → 0.2.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/dist-cjs/style-injection-provider/index.js +13 -2
- package/dist-cjs/style-injection-provider/index.js.map +1 -1
- package/dist-es/style-injection-provider/index.js +13 -2
- package/dist-es/style-injection-provider/index.js.map +1 -1
- package/dist-types/style-injection-provider/index.d.ts +9 -2
- package/package.json +1 -1
|
@@ -2,11 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
|
|
7
8
|
const StyleInjectionContext = React.createContext(true);
|
|
8
|
-
|
|
9
|
-
const
|
|
9
|
+
function useStyleInjection(enableStyleInjection) {
|
|
10
|
+
const enableStyleInjectionFromContext = React.useContext(StyleInjectionContext);
|
|
11
|
+
return enableStyleInjection != null ? enableStyleInjection : enableStyleInjectionFromContext;
|
|
12
|
+
}
|
|
13
|
+
function StyleInjectionProvider(props) {
|
|
14
|
+
const { value: enableStyleInjectionProp, children } = props;
|
|
15
|
+
const value = useStyleInjection(enableStyleInjectionProp);
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StyleInjectionContext.Provider, {
|
|
17
|
+
value,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
10
21
|
|
|
11
22
|
exports.StyleInjectionProvider = StyleInjectionProvider;
|
|
12
23
|
exports.useStyleInjection = useStyleInjection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/style-injection-provider/index.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nconst StyleInjectionContext = createContext(true);\n\nexport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/style-injection-provider/index.tsx"],"sourcesContent":["import React, { type ReactNode, createContext, useContext } from \"react\";\nexport interface StyleInjectionContextType {\n value?: boolean;\n}\n\nconst StyleInjectionContext = createContext(true);\n\nexport function useStyleInjection(enableStyleInjection?: boolean): boolean {\n const enableStyleInjectionFromContext = useContext(StyleInjectionContext);\n return enableStyleInjection ?? enableStyleInjectionFromContext;\n}\n\nexport interface StyleInjectionProviderProps extends StyleInjectionContextType {\n children: ReactNode;\n}\n\nexport function StyleInjectionProvider(props: StyleInjectionProviderProps) {\n const { value: enableStyleInjectionProp, children } = props;\n const value = useStyleInjection(enableStyleInjectionProp);\n\n return (\n <StyleInjectionContext.Provider value={value}>\n {children}\n </StyleInjectionContext.Provider>\n );\n}\n"],"names":["createContext","useContext","jsx"],"mappings":";;;;;;;AAKA,MAAM,qBAAA,GAAwBA,oBAAc,IAAI,CAAA,CAAA;AAEzC,SAAS,kBAAkB,oBAAyC,EAAA;AACzE,EAAM,MAAA,+BAAA,GAAkCC,iBAAW,qBAAqB,CAAA,CAAA;AACxE,EAAA,OAAO,oBAAwB,IAAA,IAAA,GAAA,oBAAA,GAAA,+BAAA,CAAA;AACjC,CAAA;AAMO,SAAS,uBAAuB,KAAoC,EAAA;AACzE,EAAA,MAAM,EAAE,KAAA,EAAO,wBAA0B,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACtD,EAAM,MAAA,KAAA,GAAQ,kBAAkB,wBAAwB,CAAA,CAAA;AAExD,EACE,uBAAAC,cAAA,CAAC,sBAAsB,QAAtB,EAAA;AAAA,IAA+B,KAAA;AAAA,IAC7B,QAAA;AAAA,GACH,CAAA,CAAA;AAEJ;;;;;"}
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { createContext, useContext } from 'react';
|
|
2
3
|
|
|
3
4
|
const StyleInjectionContext = createContext(true);
|
|
4
|
-
|
|
5
|
-
const
|
|
5
|
+
function useStyleInjection(enableStyleInjection) {
|
|
6
|
+
const enableStyleInjectionFromContext = useContext(StyleInjectionContext);
|
|
7
|
+
return enableStyleInjection != null ? enableStyleInjection : enableStyleInjectionFromContext;
|
|
8
|
+
}
|
|
9
|
+
function StyleInjectionProvider(props) {
|
|
10
|
+
const { value: enableStyleInjectionProp, children } = props;
|
|
11
|
+
const value = useStyleInjection(enableStyleInjectionProp);
|
|
12
|
+
return /* @__PURE__ */ jsx(StyleInjectionContext.Provider, {
|
|
13
|
+
value,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
6
17
|
|
|
7
18
|
export { StyleInjectionProvider, useStyleInjection };
|
|
8
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/style-injection-provider/index.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\n\nconst StyleInjectionContext = createContext(true);\n\nexport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/style-injection-provider/index.tsx"],"sourcesContent":["import React, { type ReactNode, createContext, useContext } from \"react\";\nexport interface StyleInjectionContextType {\n value?: boolean;\n}\n\nconst StyleInjectionContext = createContext(true);\n\nexport function useStyleInjection(enableStyleInjection?: boolean): boolean {\n const enableStyleInjectionFromContext = useContext(StyleInjectionContext);\n return enableStyleInjection ?? enableStyleInjectionFromContext;\n}\n\nexport interface StyleInjectionProviderProps extends StyleInjectionContextType {\n children: ReactNode;\n}\n\nexport function StyleInjectionProvider(props: StyleInjectionProviderProps) {\n const { value: enableStyleInjectionProp, children } = props;\n const value = useStyleInjection(enableStyleInjectionProp);\n\n return (\n <StyleInjectionContext.Provider value={value}>\n {children}\n </StyleInjectionContext.Provider>\n );\n}\n"],"names":[],"mappings":";;;AAKA,MAAM,qBAAA,GAAwB,cAAc,IAAI,CAAA,CAAA;AAEzC,SAAS,kBAAkB,oBAAyC,EAAA;AACzE,EAAM,MAAA,+BAAA,GAAkC,WAAW,qBAAqB,CAAA,CAAA;AACxE,EAAA,OAAO,oBAAwB,IAAA,IAAA,GAAA,oBAAA,GAAA,+BAAA,CAAA;AACjC,CAAA;AAMO,SAAS,uBAAuB,KAAoC,EAAA;AACzE,EAAA,MAAM,EAAE,KAAA,EAAO,wBAA0B,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACtD,EAAM,MAAA,KAAA,GAAQ,kBAAkB,wBAAwB,CAAA,CAAA;AAExD,EACE,uBAAA,GAAA,CAAC,sBAAsB,QAAtB,EAAA;AAAA,IAA+B,KAAA;AAAA,IAC7B,QAAA;AAAA,GACH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface StyleInjectionContextType {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function useStyleInjection(enableStyleInjection?: boolean): boolean;
|
|
6
|
+
export interface StyleInjectionProviderProps extends StyleInjectionContextType {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function StyleInjectionProvider(props: StyleInjectionProviderProps): JSX.Element;
|