@griffel/react 1.7.2 → 1.7.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.
- package/.storybook/main.js +20 -0
- package/.storybook/preview.js +1 -0
- package/CHANGELOG.json +1281 -0
- package/CHANGELOG.md +501 -0
- package/bundle-size/__css.fixture.js +7 -0
- package/bundle-size/__styles.fixture.js +7 -0
- package/bundle-size/makeResetStyles.fixture.js +7 -0
- package/bundle-size/makeStaticStyles.fixture.js +7 -0
- package/bundle-size/makeStyles.fixture.js +7 -0
- package/eslint.config.mjs +31 -0
- package/package.json +3 -3
- package/project.json +96 -0
- package/src/RendererContext.tsx +52 -0
- package/src/TextDirectionContext.tsx +34 -0
- package/src/__css.ts +21 -0
- package/src/__resetCSS.ts +19 -0
- package/src/__resetStyles.ts +28 -0
- package/src/{__staticCSS.js → __staticCSS.ts} +7 -6
- package/src/__staticStyles.ts +22 -0
- package/src/__styles.ts +27 -0
- package/src/createDOMRenderer.test.tsx +133 -0
- package/src/{index.d.ts → index.ts} +6 -0
- package/src/insertionFactory-node.test.ts +31 -0
- package/src/insertionFactory.test.ts +29 -0
- package/src/insertionFactory.ts +27 -0
- package/src/makeResetStyles.test.tsx +27 -0
- package/src/makeResetStyles.ts +31 -0
- package/src/makeStaticStyles.ts +23 -0
- package/src/makeStyles.test.tsx +27 -0
- package/src/makeStyles.ts +31 -0
- package/src/renderToStyleElements-node.test.tsx +418 -0
- package/src/renderToStyleElements.test.tsx +103 -0
- package/src/renderToStyleElements.ts +61 -0
- package/src/stories/ComponentStyles.stories.tsx +55 -0
- package/src/stories/DOMRendererFilter.stories.tsx +76 -0
- package/src/stories/FallbackValues.stories.tsx +50 -0
- package/src/stories/makeStyles.stories.tsx +17 -0
- package/src/useInsertionEffect.ts +11 -0
- package/src/utils/canUseDOM-node.test.ts +14 -0
- package/src/utils/canUseDOM.test.tsx +8 -0
- package/src/utils/canUseDOM.ts +8 -0
- package/src/utils/isInsideComponent.ts +41 -0
- package/tsconfig.json +20 -0
- package/tsconfig.lib.json +28 -0
- package/tsconfig.spec.json +21 -0
- package/tsconfig.storybook.json +12 -0
- package/vitest.config.ts +21 -0
- package/LICENSE.md +0 -21
- package/lib/RendererContext.cjs +0 -45
- package/lib/TextDirectionContext.cjs +0 -33
- package/lib/__css.cjs +0 -22
- package/lib/__resetCSS.cjs +0 -22
- package/lib/__resetStyles.cjs +0 -26
- package/lib/__staticCSS.cjs +0 -18
- package/lib/__staticStyles.cjs +0 -23
- package/lib/__styles.cjs +0 -26
- package/lib/index.cjs +0 -78
- package/lib/insertionFactory.cjs +0 -33
- package/lib/makeResetStyles.cjs +0 -35
- package/lib/makeStaticStyles.cjs +0 -28
- package/lib/makeStyles.cjs +0 -35
- package/lib/renderToStyleElements.cjs +0 -50
- package/lib/useInsertionEffect.cjs +0 -20
- package/lib/utils/canUseDOM.cjs +0 -17
- package/lib/utils/isInsideComponent.cjs +0 -46
- package/src/RendererContext.d.ts +0 -24
- package/src/RendererContext.js +0 -31
- package/src/RendererContext.js.map +0 -1
- package/src/TextDirectionContext.d.ts +0 -19
- package/src/TextDirectionContext.js +0 -22
- package/src/TextDirectionContext.js.map +0 -1
- package/src/__css.d.ts +0 -7
- package/src/__css.js +0 -17
- package/src/__css.js.map +0 -1
- package/src/__resetCSS.d.ts +0 -6
- package/src/__resetCSS.js +0 -17
- package/src/__resetCSS.js.map +0 -1
- package/src/__resetStyles.d.ts +0 -7
- package/src/__resetStyles.js +0 -20
- package/src/__resetStyles.js.map +0 -1
- package/src/__staticCSS.d.ts +0 -6
- package/src/__staticCSS.js.map +0 -1
- package/src/__staticStyles.d.ts +0 -7
- package/src/__staticStyles.js +0 -18
- package/src/__staticStyles.js.map +0 -1
- package/src/__styles.d.ts +0 -7
- package/src/__styles.js +0 -20
- package/src/__styles.js.map +0 -1
- package/src/index.js +0 -16
- package/src/index.js.map +0 -1
- package/src/insertionFactory.d.ts +0 -2
- package/src/insertionFactory.js +0 -21
- package/src/insertionFactory.js.map +0 -1
- package/src/makeResetStyles.d.ts +0 -2
- package/src/makeResetStyles.js +0 -23
- package/src/makeResetStyles.js.map +0 -1
- package/src/makeStaticStyles.d.ts +0 -2
- package/src/makeStaticStyles.js +0 -17
- package/src/makeStaticStyles.js.map +0 -1
- package/src/makeStyles.d.ts +0 -2
- package/src/makeStyles.js +0 -23
- package/src/makeStyles.js.map +0 -1
- package/src/renderToStyleElements.d.ts +0 -8
- package/src/renderToStyleElements.js +0 -51
- package/src/renderToStyleElements.js.map +0 -1
- package/src/useInsertionEffect.d.ts +0 -1
- package/src/useInsertionEffect.js +0 -10
- package/src/useInsertionEffect.js.map +0 -1
- package/src/utils/canUseDOM.d.ts +0 -1
- package/src/utils/canUseDOM.js +0 -9
- package/src/utils/canUseDOM.js.map +0 -1
- package/src/utils/isInsideComponent.d.ts +0 -1
- package/src/utils/isInsideComponent.js +0 -39
- package/src/utils/isInsideComponent.js.map +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { StoryFn } from '@storybook/react-vite';
|
|
2
|
+
|
|
3
|
+
import { makeStyles, shorthands, TextDirectionProvider } from '../';
|
|
4
|
+
|
|
5
|
+
const useStyles = makeStyles({
|
|
6
|
+
shouldFallbackToRed: {
|
|
7
|
+
color: ['red', 'invalid'],
|
|
8
|
+
...shorthands.border(['1px'], 'solid', ['red', 'invalid']),
|
|
9
|
+
...shorthands.borderRight('40px', 'solid', ['green', 'invalid']),
|
|
10
|
+
borderTopStyle: ['hidden', 'dashed'],
|
|
11
|
+
},
|
|
12
|
+
shouldBeBlue: {
|
|
13
|
+
color: ['red', 'blue'],
|
|
14
|
+
...shorthands.border('1px', 'solid', ['red', 'blue']),
|
|
15
|
+
...shorthands.borderRight('40px', 'solid', ['green', 'grey']),
|
|
16
|
+
borderRightWidth: '100px',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const FallbackTest = ({ isRtl = false }: { isRtl?: boolean }) => {
|
|
21
|
+
const classes = useStyles();
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<p className={classes.shouldBeBlue}>
|
|
25
|
+
Colour and border should be blue, {isRtl ? 'left' : 'right'} wide border grey.
|
|
26
|
+
</p>
|
|
27
|
+
<p className={classes.shouldFallbackToRed}>
|
|
28
|
+
Colour and border should fallback to red, {isRtl ? 'left' : 'right'} wide border to green.
|
|
29
|
+
</p>
|
|
30
|
+
</>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const FallbackValues: StoryFn = () => {
|
|
35
|
+
return (
|
|
36
|
+
<div>
|
|
37
|
+
<FallbackTest />
|
|
38
|
+
<TextDirectionProvider dir="rtl">
|
|
39
|
+
<div dir="rtl">
|
|
40
|
+
<h2>RTL</h2>
|
|
41
|
+
<FallbackTest isRtl />
|
|
42
|
+
</div>
|
|
43
|
+
</TextDirectionProvider>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
title: 'Fallback values',
|
|
50
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { makeStyles } from '../../src/index.js';
|
|
2
|
+
|
|
3
|
+
const useStyles = makeStyles({
|
|
4
|
+
root: {
|
|
5
|
+
color: 'deeppink',
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const MakeStyles = () => {
|
|
10
|
+
const classes = useStyles();
|
|
11
|
+
|
|
12
|
+
return <div className={classes.root}>no stories yet</div>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
title: 'MakeStyles',
|
|
17
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const useInsertionEffect: typeof React.useInsertionEffect | undefined =
|
|
9
|
+
// @ts-expect-error Hack to make sure that `useInsertionEffect` will not cause bundling issues in older React versions
|
|
10
|
+
// eslint-disable-next-line no-useless-concat
|
|
11
|
+
React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @vitest-environment node
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// 👆 this is intentionally to test in SSR like environment
|
|
6
|
+
|
|
7
|
+
import { describe, it, expect } from 'vitest';
|
|
8
|
+
import { canUseDOM } from './canUseDOM.js';
|
|
9
|
+
|
|
10
|
+
describe('canUseDOM (node)', () => {
|
|
11
|
+
it('returns "false"', () => {
|
|
12
|
+
expect(canUseDOM()).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
function getDispatcher() {
|
|
6
|
+
try {
|
|
7
|
+
return (React as any)[''.concat('__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE')].H;
|
|
8
|
+
} catch {
|
|
9
|
+
// React 19+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
return (React as any)[''.concat('__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED')].ReactCurrentDispatcher
|
|
14
|
+
.current;
|
|
15
|
+
} catch {
|
|
16
|
+
// React 18 and below
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export function isInsideComponent() {
|
|
24
|
+
// React 18 always logs errors if a dispatcher is not present:
|
|
25
|
+
// https://github.com/facebook/react/blob/42f15b324f50d0fd98322c21646ac3013e30344a/packages/react/src/ReactHooks.js#L26-L36
|
|
26
|
+
try {
|
|
27
|
+
const dispatcher = getDispatcher();
|
|
28
|
+
|
|
29
|
+
// Before any React component was rendered "dispatcher" will be "null"
|
|
30
|
+
if (dispatcher === null || dispatcher === undefined) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// A check with hooks call (i.e. call "React.useContext()" outside a component) will always produce errors, but
|
|
35
|
+
// a call on the dispatcher wont
|
|
36
|
+
dispatcher.useContext({});
|
|
37
|
+
return true;
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"allowJs": true
|
|
6
|
+
},
|
|
7
|
+
"files": [],
|
|
8
|
+
"include": [],
|
|
9
|
+
"references": [
|
|
10
|
+
{
|
|
11
|
+
"path": "./tsconfig.lib.json"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"path": "./tsconfig.spec.json"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"path": "./tsconfig.storybook.json"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"outDir": "../../dist/out-tsc",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"stripInternal": true,
|
|
9
|
+
"types": ["node", "environment"]
|
|
10
|
+
},
|
|
11
|
+
"exclude": [
|
|
12
|
+
"**/*.spec.ts",
|
|
13
|
+
"**/*.test.ts",
|
|
14
|
+
"**/*.spec.tsx",
|
|
15
|
+
"**/*.test.tsx",
|
|
16
|
+
"**/*.spec.js",
|
|
17
|
+
"**/*.test.js",
|
|
18
|
+
"**/*.spec.jsx",
|
|
19
|
+
"**/*.test.jsx",
|
|
20
|
+
"**/*.stories.ts",
|
|
21
|
+
"**/*.stories.js",
|
|
22
|
+
"**/*.stories.jsx",
|
|
23
|
+
"**/*.stories.tsx",
|
|
24
|
+
"jest.config.ts",
|
|
25
|
+
"vitest.config.ts"
|
|
26
|
+
],
|
|
27
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"allowSyntheticDefaultImports": true,
|
|
6
|
+
"typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"],
|
|
7
|
+
"types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"]
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"vitest.config.ts",
|
|
11
|
+
"**/*.test.ts",
|
|
12
|
+
"**/*.spec.ts",
|
|
13
|
+
"**/*.test.tsx",
|
|
14
|
+
"**/*.spec.tsx",
|
|
15
|
+
"**/*.test.js",
|
|
16
|
+
"**/*.spec.js",
|
|
17
|
+
"**/*.test.jsx",
|
|
18
|
+
"**/*.spec.jsx",
|
|
19
|
+
"**/*.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"emitDecoratorMetadata": true,
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"allowSyntheticDefaultImports": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"outDir": ""
|
|
9
|
+
},
|
|
10
|
+
"exclude": ["src/**/*.spec.ts", "src/**/*.spec.js", "src/**/*.spec.tsx", "src/**/*.spec.jsx", "jest.config.ts"],
|
|
11
|
+
"include": ["src/**/*", ".storybook/*.js"]
|
|
12
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
root: __dirname,
|
|
6
|
+
cacheDir: '../../node_modules/.vite/packages/react',
|
|
7
|
+
plugins: [nxViteTsPaths()],
|
|
8
|
+
define: {
|
|
9
|
+
IS_REACT_ACT_ENVIRONMENT: true,
|
|
10
|
+
},
|
|
11
|
+
test: {
|
|
12
|
+
watch: false,
|
|
13
|
+
environment: 'jsdom',
|
|
14
|
+
include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
15
|
+
reporters: ['default'],
|
|
16
|
+
coverage: {
|
|
17
|
+
reportsDirectory: '../../coverage/packages/react',
|
|
18
|
+
provider: 'v8',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
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
|
package/lib/RendererContext.cjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
function _export(target, all) {
|
|
7
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
get RendererProvider () {
|
|
14
|
-
return RendererProvider;
|
|
15
|
-
},
|
|
16
|
-
get useRenderer () {
|
|
17
|
-
return useRenderer;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
21
|
-
const _core = require("@griffel/core");
|
|
22
|
-
const _react = require("react");
|
|
23
|
-
const _canUseDOM = require("./utils/canUseDOM.cjs");
|
|
24
|
-
/**
|
|
25
|
-
* @private
|
|
26
|
-
*/ const RendererContext = /*#__PURE__*/ (0, _react.createContext)(/*#__PURE__*/ (0, _core.createDOMRenderer)());
|
|
27
|
-
const RendererProvider = ({ children, renderer, targetDocument })=>{
|
|
28
|
-
(0, _react.useMemo)(()=>{
|
|
29
|
-
if ((0, _canUseDOM.canUseDOM)()) {
|
|
30
|
-
// "rehydrateCache()" can't be called in effects as it needs to be called before any component will be rendered to
|
|
31
|
-
// avoid double insertion of classes
|
|
32
|
-
(0, _core.rehydrateRendererCache)(renderer, targetDocument);
|
|
33
|
-
}
|
|
34
|
-
}, [
|
|
35
|
-
renderer,
|
|
36
|
-
targetDocument
|
|
37
|
-
]);
|
|
38
|
-
return (0, _jsxruntime.jsx)(RendererContext.Provider, {
|
|
39
|
-
value: renderer,
|
|
40
|
-
children: children
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
function useRenderer() {
|
|
44
|
-
return (0, _react.useContext)(RendererContext);
|
|
45
|
-
} //# sourceMappingURL=RendererContext.js.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
function _export(target, all) {
|
|
7
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
get TextDirectionProvider () {
|
|
14
|
-
return TextDirectionProvider;
|
|
15
|
-
},
|
|
16
|
-
get useTextDirection () {
|
|
17
|
-
return useTextDirection;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
const _jsxruntime = require("react/jsx-runtime");
|
|
21
|
-
const _react = require("react");
|
|
22
|
-
/**
|
|
23
|
-
* @private
|
|
24
|
-
*/ const TextDirectionContext = /*#__PURE__*/ (0, _react.createContext)('ltr');
|
|
25
|
-
const TextDirectionProvider = ({ children, dir })=>{
|
|
26
|
-
return (0, _jsxruntime.jsx)(TextDirectionContext.Provider, {
|
|
27
|
-
value: dir,
|
|
28
|
-
children: children
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
function useTextDirection() {
|
|
32
|
-
return (0, _react.useContext)(TextDirectionContext);
|
|
33
|
-
} //# sourceMappingURL=TextDirectionContext.js.map
|
package/lib/__css.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "__css", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return __css;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
const _TextDirectionContext = require("./TextDirectionContext.cjs");
|
|
14
|
-
function __css(classesMapBySlot) {
|
|
15
|
-
const getStyles = (0, _core.__css)(classesMapBySlot);
|
|
16
|
-
return function useClasses() {
|
|
17
|
-
const dir = (0, _TextDirectionContext.useTextDirection)();
|
|
18
|
-
return getStyles({
|
|
19
|
-
dir
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
} //# sourceMappingURL=__css.js.map
|
package/lib/__resetCSS.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "__resetCSS", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return __resetCSS;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
const _TextDirectionContext = require("./TextDirectionContext.cjs");
|
|
14
|
-
function __resetCSS(ltrClassName, rtlClassName) {
|
|
15
|
-
const getStyles = (0, _core.__resetCSS)(ltrClassName, rtlClassName);
|
|
16
|
-
return function useClasses() {
|
|
17
|
-
const dir = (0, _TextDirectionContext.useTextDirection)();
|
|
18
|
-
return getStyles({
|
|
19
|
-
dir
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
} //# sourceMappingURL=__resetCSS.js.map
|
package/lib/__resetStyles.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "__resetStyles", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return __resetStyles;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
const _insertionFactory = require("./insertionFactory.cjs");
|
|
14
|
-
const _RendererContext = require("./RendererContext.cjs");
|
|
15
|
-
const _TextDirectionContext = require("./TextDirectionContext.cjs");
|
|
16
|
-
function __resetStyles(ltrClassName, rtlClassName, cssRules) {
|
|
17
|
-
const getStyles = (0, _core.__resetStyles)(ltrClassName, rtlClassName, cssRules, _insertionFactory.insertionFactory);
|
|
18
|
-
return function useClasses() {
|
|
19
|
-
const dir = (0, _TextDirectionContext.useTextDirection)();
|
|
20
|
-
const renderer = (0, _RendererContext.useRenderer)();
|
|
21
|
-
return getStyles({
|
|
22
|
-
dir,
|
|
23
|
-
renderer
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
} //# sourceMappingURL=__resetStyles.js.map
|
package/lib/__staticCSS.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "__staticCSS", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return __staticCSS;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
function __staticCSS() {
|
|
14
|
-
const getStyles = (0, _core.__staticCSS)();
|
|
15
|
-
return function useStaticStyles() {
|
|
16
|
-
return getStyles();
|
|
17
|
-
};
|
|
18
|
-
} //# sourceMappingURL=__staticCSS.js.map
|
package/lib/__staticStyles.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "__staticStyles", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return __staticStyles;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
const _insertionFactory = require("./insertionFactory.cjs");
|
|
14
|
-
const _RendererContext = require("./RendererContext.cjs");
|
|
15
|
-
function __staticStyles(cssRules) {
|
|
16
|
-
const getStyles = (0, _core.__staticStyles)(cssRules, _insertionFactory.insertionFactory);
|
|
17
|
-
return function useStaticStyles() {
|
|
18
|
-
const renderer = (0, _RendererContext.useRenderer)();
|
|
19
|
-
return getStyles({
|
|
20
|
-
renderer
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
} //# sourceMappingURL=__staticStyles.js.map
|
package/lib/__styles.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "__styles", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return __styles;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
const _insertionFactory = require("./insertionFactory.cjs");
|
|
14
|
-
const _RendererContext = require("./RendererContext.cjs");
|
|
15
|
-
const _TextDirectionContext = require("./TextDirectionContext.cjs");
|
|
16
|
-
function __styles(classesMapBySlot, cssRules) {
|
|
17
|
-
const getStyles = (0, _core.__styles)(classesMapBySlot, cssRules, _insertionFactory.insertionFactory);
|
|
18
|
-
return function useClasses() {
|
|
19
|
-
const dir = (0, _TextDirectionContext.useTextDirection)();
|
|
20
|
-
const renderer = (0, _RendererContext.useRenderer)();
|
|
21
|
-
return getStyles({
|
|
22
|
-
dir,
|
|
23
|
-
renderer
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
} //# sourceMappingURL=__styles.js.map
|
package/lib/index.cjs
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
function _export(target, all) {
|
|
7
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
_export(exports, {
|
|
13
|
-
get RESET () {
|
|
14
|
-
return _core.RESET;
|
|
15
|
-
},
|
|
16
|
-
get RendererProvider () {
|
|
17
|
-
return _RendererContext.RendererProvider;
|
|
18
|
-
},
|
|
19
|
-
get TextDirectionProvider () {
|
|
20
|
-
return _TextDirectionContext.TextDirectionProvider;
|
|
21
|
-
},
|
|
22
|
-
get __css () {
|
|
23
|
-
return __css.__css;
|
|
24
|
-
},
|
|
25
|
-
get __resetCSS () {
|
|
26
|
-
return __resetCSS.__resetCSS;
|
|
27
|
-
},
|
|
28
|
-
get __resetStyles () {
|
|
29
|
-
return __resetStyles.__resetStyles;
|
|
30
|
-
},
|
|
31
|
-
get __staticCSS () {
|
|
32
|
-
return __staticCSS.__staticCSS;
|
|
33
|
-
},
|
|
34
|
-
get __staticStyles () {
|
|
35
|
-
return __staticStyles.__staticStyles;
|
|
36
|
-
},
|
|
37
|
-
get __styles () {
|
|
38
|
-
return __styles.__styles;
|
|
39
|
-
},
|
|
40
|
-
get createDOMRenderer () {
|
|
41
|
-
return _core.createDOMRenderer;
|
|
42
|
-
},
|
|
43
|
-
get makeResetStyles () {
|
|
44
|
-
return _makeResetStyles.makeResetStyles;
|
|
45
|
-
},
|
|
46
|
-
get makeStaticStyles () {
|
|
47
|
-
return _makeStaticStyles.makeStaticStyles;
|
|
48
|
-
},
|
|
49
|
-
get makeStyles () {
|
|
50
|
-
return _makeStyles.makeStyles;
|
|
51
|
-
},
|
|
52
|
-
get mergeClasses () {
|
|
53
|
-
return _core.mergeClasses;
|
|
54
|
-
},
|
|
55
|
-
get renderToStyleElements () {
|
|
56
|
-
return _renderToStyleElements.renderToStyleElements;
|
|
57
|
-
},
|
|
58
|
-
get shorthands () {
|
|
59
|
-
return _core.shorthands;
|
|
60
|
-
},
|
|
61
|
-
get useRenderer_unstable () {
|
|
62
|
-
return _RendererContext.useRenderer;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
const _core = require("@griffel/core");
|
|
66
|
-
const _makeStyles = require("./makeStyles.cjs");
|
|
67
|
-
const _makeResetStyles = require("./makeResetStyles.cjs");
|
|
68
|
-
const _makeStaticStyles = require("./makeStaticStyles.cjs");
|
|
69
|
-
const _renderToStyleElements = require("./renderToStyleElements.cjs");
|
|
70
|
-
const _RendererContext = require("./RendererContext.cjs");
|
|
71
|
-
const _TextDirectionContext = require("./TextDirectionContext.cjs");
|
|
72
|
-
const __css = require("./__css.cjs");
|
|
73
|
-
const __styles = require("./__styles.cjs");
|
|
74
|
-
const __resetCSS = require("./__resetCSS.cjs");
|
|
75
|
-
const __resetStyles = require("./__resetStyles.cjs");
|
|
76
|
-
const __staticCSS = require("./__staticCSS.cjs");
|
|
77
|
-
const __staticStyles = require("./__staticStyles.cjs");
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
package/lib/insertionFactory.cjs
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "insertionFactory", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return insertionFactory;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _canUseDOM = require("./utils/canUseDOM.cjs");
|
|
13
|
-
const _useInsertionEffect = require("./useInsertionEffect.cjs");
|
|
14
|
-
const insertionFactory = ()=>{
|
|
15
|
-
const insertionCache = {};
|
|
16
|
-
return function insert(renderer, cssRules) {
|
|
17
|
-
// Even if `useInsertionEffect` is available, we can use it on a client only as it will not be executed in SSR
|
|
18
|
-
if (_useInsertionEffect.useInsertionEffect && (0, _canUseDOM.canUseDOM)()) {
|
|
19
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
20
|
-
(0, _useInsertionEffect.useInsertionEffect)(()=>{
|
|
21
|
-
renderer.insertCSSRules(cssRules);
|
|
22
|
-
}, [
|
|
23
|
-
renderer,
|
|
24
|
-
cssRules
|
|
25
|
-
]);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (insertionCache[renderer.id] === undefined) {
|
|
29
|
-
renderer.insertCSSRules(cssRules);
|
|
30
|
-
insertionCache[renderer.id] = true;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
}; //# sourceMappingURL=insertionFactory.js.map
|
package/lib/makeResetStyles.cjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "makeResetStyles", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function() {
|
|
9
|
-
return makeResetStyles;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const _core = require("@griffel/core");
|
|
13
|
-
const _insertionFactory = require("./insertionFactory.cjs");
|
|
14
|
-
const _RendererContext = require("./RendererContext.cjs");
|
|
15
|
-
const _TextDirectionContext = require("./TextDirectionContext.cjs");
|
|
16
|
-
const _isInsideComponent = require("./utils/isInsideComponent.cjs");
|
|
17
|
-
function makeResetStyles(styles) {
|
|
18
|
-
const getStyles = (0, _core.makeResetStyles)(styles, _insertionFactory.insertionFactory);
|
|
19
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
20
|
-
if ((0, _isInsideComponent.isInsideComponent)()) {
|
|
21
|
-
throw new Error([
|
|
22
|
-
"makeResetStyles(): this function cannot be called in component's scope.",
|
|
23
|
-
'All makeResetStyles() calls should be top level i.e. in a root scope of a file.'
|
|
24
|
-
].join(' '));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return function useClassName() {
|
|
28
|
-
const dir = (0, _TextDirectionContext.useTextDirection)();
|
|
29
|
-
const renderer = (0, _RendererContext.useRenderer)();
|
|
30
|
-
return getStyles({
|
|
31
|
-
dir,
|
|
32
|
-
renderer
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
} //# sourceMappingURL=makeResetStyles.js.map
|