@aglyn/shared-ui-theme 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +7 -0
- package/package.json +51 -0
- package/src/index.d.ts +34 -0
- package/src/index.js +50 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/host-theme-provider.d.ts +84 -0
- package/src/lib/components/host-theme-provider.js +146 -0
- package/src/lib/components/host-theme-provider.js.map +1 -0
- package/src/lib/components/theme-css-var-provider.d.ts +44 -0
- package/src/lib/components/theme-css-var-provider.js +79 -0
- package/src/lib/components/theme-css-var-provider.js.map +1 -0
- package/src/lib/console.theme.d.ts +34 -0
- package/src/lib/console.theme.js +598 -0
- package/src/lib/console.theme.js.map +1 -0
- package/src/lib/constants.d.ts +72 -0
- package/src/lib/constants.js +85 -0
- package/src/lib/constants.js.map +1 -0
- package/src/lib/hocs/create-with-emotion-client-cache.d.ts +30 -0
- package/src/lib/hocs/create-with-emotion-client-cache.js +53 -0
- package/src/lib/hocs/create-with-emotion-client-cache.js.map +1 -0
- package/src/lib/hocs/create-with-theme-provider.d.ts +86 -0
- package/src/lib/hocs/create-with-theme-provider.js +231 -0
- package/src/lib/hocs/create-with-theme-provider.js.map +1 -0
- package/src/lib/tenant.theme.d.ts +58 -0
- package/src/lib/tenant.theme.js +282 -0
- package/src/lib/tenant.theme.js.map +1 -0
- package/src/lib/theme.types.d.ts +26 -0
- package/src/lib/theme.types.js +18 -0
- package/src/lib/theme.types.js.map +1 -0
- package/src/lib/util/accent-text.d.ts +187 -0
- package/src/lib/util/accent-text.js +277 -0
- package/src/lib/util/accent-text.js.map +1 -0
- package/src/lib/util/accessible-shade.d.ts +61 -0
- package/src/lib/util/accessible-shade.js +117 -0
- package/src/lib/util/accessible-shade.js.map +1 -0
- package/src/lib/util/color-scheme-hint.d.ts +68 -0
- package/src/lib/util/color-scheme-hint.js +69 -0
- package/src/lib/util/color-scheme-hint.js.map +1 -0
- package/src/lib/util/create-responsive-theme.d.ts +71 -0
- package/src/lib/util/create-responsive-theme.js +287 -0
- package/src/lib/util/create-responsive-theme.js.map +1 -0
- package/src/lib/util/emotion-cache.d.ts +81 -0
- package/src/lib/util/emotion-cache.js +79 -0
- package/src/lib/util/emotion-cache.js.map +1 -0
- package/src/lib/util/generate-component-class-keys.d.ts +41 -0
- package/src/lib/util/generate-component-class-keys.js +53 -0
- package/src/lib/util/generate-component-class-keys.js.map +1 -0
- package/src/lib/util/host-theme.d.ts +92 -0
- package/src/lib/util/host-theme.js +340 -0
- package/src/lib/util/host-theme.js.map +1 -0
- package/src/lib/util/layered-emotion-cache.d.ts +78 -0
- package/src/lib/util/layered-emotion-cache.js +90 -0
- package/src/lib/util/layered-emotion-cache.js.map +1 -0
- package/src/lib/util/merge-sx-props.d.ts +22 -0
- package/src/lib/util/merge-sx-props.js +27 -0
- package/src/lib/util/merge-sx-props.js.map +1 -0
- package/src/lib/util/scheme-route-segment.d.ts +95 -0
- package/src/lib/util/scheme-route-segment.js +101 -0
- package/src/lib/util/scheme-route-segment.js.map +1 -0
- package/src/lib/util/theme-editor-defaults.d.ts +41 -0
- package/src/lib/util/theme-editor-defaults.js +49 -0
- package/src/lib/util/theme-editor-defaults.js.map +1 -0
- package/src/lib/util/theme-editor-fields.d.ts +315 -0
- package/src/lib/util/theme-editor-fields.js +714 -0
- package/src/lib/util/theme-editor-fields.js.map +1 -0
- package/src/lib/util/theme-mode-cookie.d.ts +48 -0
- package/src/lib/util/theme-mode-cookie.js +48 -0
- package/src/lib/util/theme-mode-cookie.js.map +1 -0
- package/src/vendor/emotion.d.ts +18 -0
- package/src/vendor/emotion.js +22 -0
- package/src/vendor/emotion.js.map +1 -0
- package/src/vendor/jss.d.ts +18 -0
- package/src/vendor/jss.js +20 -0
- package/src/vendor/jss.js.map +1 -0
- package/src/vendor/mui.d.ts +282 -0
- package/src/vendor/mui.js +20 -0
- package/src/vendor/mui.js.map +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { CssVarsProvider as MuiCssVarsProvider } from '@mui/material/styles';
|
|
18
|
+
import type { ComponentProps } from 'react';
|
|
19
|
+
import { createResponsiveCssVarTheme } from '../util/create-responsive-theme';
|
|
20
|
+
export interface ThemeCssVarProviderProps extends Omit<ComponentProps<typeof MuiCssVarsProvider>, 'theme'> {
|
|
21
|
+
theme?: {
|
|
22
|
+
light: Parameters<typeof createResponsiveCssVarTheme>[0];
|
|
23
|
+
dark: Parameters<typeof createResponsiveCssVarTheme>[1];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Next app middleware for material-ui theme provider component
|
|
28
|
+
*
|
|
29
|
+
* Theme provider middleware component, automatically
|
|
30
|
+
* removes the SSR style document node (e.g.#jss - server - side)
|
|
31
|
+
*
|
|
32
|
+
* @template T
|
|
33
|
+
* @param {Props} props
|
|
34
|
+
* @returns {IThemeCssVarProvider<T>}
|
|
35
|
+
*/
|
|
36
|
+
export declare function ThemeCssVarProvider<T>(props: ThemeCssVarProviderProps): import("react").JSX.Element;
|
|
37
|
+
export declare namespace ThemeCssVarProvider {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
var aglyn: boolean;
|
|
40
|
+
}
|
|
41
|
+
export default ThemeCssVarProvider;
|
|
42
|
+
export declare function withThemeCssVarProvider<P>(WrappedComponent: JSX.ComponentType<P>, options?: ThemeCssVarProviderProps & {
|
|
43
|
+
disableCssBaseline?: boolean;
|
|
44
|
+
}): import("react").ForwardRefExoticComponent<import("react").PropsWithoutRef<P> & import("react").RefAttributes<any>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ import { getDisplayName } from "@aglyn/shared-util-tools";
|
|
20
|
+
import { hoistNonReactStatics } from "@aglyn/shared-util-vendor";
|
|
21
|
+
import { CssBaseline } from "@mui/material";
|
|
22
|
+
import { CssVarsProvider as MuiCssVarsProvider } from "@mui/material/styles";
|
|
23
|
+
import { forwardRef, useMemo } from "react";
|
|
24
|
+
import { createResponsiveCssVarTheme } from "../util/create-responsive-theme.js";
|
|
25
|
+
/**
|
|
26
|
+
* Next app middleware for material-ui theme provider component
|
|
27
|
+
*
|
|
28
|
+
* Theme provider middleware component, automatically
|
|
29
|
+
* removes the SSR style document node (e.g.#jss - server - side)
|
|
30
|
+
*
|
|
31
|
+
* @template T
|
|
32
|
+
* @param {Props} props
|
|
33
|
+
* @returns {IThemeCssVarProvider<T>}
|
|
34
|
+
*/ export function ThemeCssVarProvider(props) {
|
|
35
|
+
const { theme, children } = props, rest = _object_without_properties_loose(props, [
|
|
36
|
+
"theme",
|
|
37
|
+
"children"
|
|
38
|
+
]);
|
|
39
|
+
const _theme = useMemo(()=>{
|
|
40
|
+
return createResponsiveCssVarTheme(theme.light, theme.dark);
|
|
41
|
+
}, [
|
|
42
|
+
theme
|
|
43
|
+
]);
|
|
44
|
+
return /*#__PURE__*/ _jsx(MuiCssVarsProvider, _extends({
|
|
45
|
+
theme: _theme,
|
|
46
|
+
defaultMode: "system"
|
|
47
|
+
}, rest, {
|
|
48
|
+
children: children
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
ThemeCssVarProvider.displayName = 'ThemeCssVarProvider';
|
|
52
|
+
ThemeCssVarProvider.aglyn = true;
|
|
53
|
+
export default ThemeCssVarProvider;
|
|
54
|
+
export function withThemeCssVarProvider(WrappedComponent, options) {
|
|
55
|
+
const _ref = options || {}, { disableCssBaseline } = _ref, opts = _object_without_properties_loose(_ref, [
|
|
56
|
+
"disableCssBaseline"
|
|
57
|
+
]);
|
|
58
|
+
const WithThemeCssVarProvider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
59
|
+
const {} = props, rest = _extends({}, props);
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
61
|
+
const WrappedAny = WrappedComponent;
|
|
62
|
+
return /*#__PURE__*/ _jsx(ThemeCssVarProvider, _extends({}, opts, {
|
|
63
|
+
children: disableCssBaseline ? /*#__PURE__*/ _jsx(WrappedAny, _extends({
|
|
64
|
+
ref: ref
|
|
65
|
+
}, rest)) : /*#__PURE__*/ _jsx(CssBaseline, {
|
|
66
|
+
enableColorScheme: true,
|
|
67
|
+
children: /*#__PURE__*/ _jsx(WrappedAny, _extends({
|
|
68
|
+
ref: ref
|
|
69
|
+
}, rest))
|
|
70
|
+
})
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
73
|
+
const displayName = getDisplayName(WrappedComponent);
|
|
74
|
+
WithThemeCssVarProvider.displayName = `WithThemeCssVarProvider(${displayName})`;
|
|
75
|
+
hoistNonReactStatics(WithThemeCssVarProvider, WrappedComponent);
|
|
76
|
+
return WithThemeCssVarProvider;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=theme-css-var-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/theme/src/lib/components/theme-css-var-provider.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getDisplayName } from '@aglyn/shared-util-tools'\nimport { hoistNonReactStatics } from '@aglyn/shared-util-vendor'\nimport { CssBaseline } from '@mui/material'\nimport { CssVarsProvider as MuiCssVarsProvider } from '@mui/material/styles'\nimport type { ComponentProps } from 'react'\nimport { type ComponentType, forwardRef, useMemo } from 'react'\nimport { createResponsiveCssVarTheme } from '../util/create-responsive-theme'\n\nexport interface ThemeCssVarProviderProps\n extends Omit<ComponentProps<typeof MuiCssVarsProvider>, 'theme'> {\n theme?: {\n light: Parameters<typeof createResponsiveCssVarTheme>[0]\n dark: Parameters<typeof createResponsiveCssVarTheme>[1]\n }\n}\n\n/**\n * Next app middleware for material-ui theme provider component\n *\n * Theme provider middleware component, automatically\n * removes the SSR style document node (e.g.#jss - server - side)\n *\n * @template T\n * @param {Props} props\n * @returns {IThemeCssVarProvider<T>}\n */\nexport function ThemeCssVarProvider<T>(props: ThemeCssVarProviderProps) {\n const { theme, children, ...rest } = props\n\n const _theme = useMemo(() => {\n return createResponsiveCssVarTheme(theme.light, theme.dark)\n }, [theme])\n\n return (\n <MuiCssVarsProvider theme={_theme} defaultMode=\"system\" {...rest}>\n {children}\n </MuiCssVarsProvider>\n )\n}\nThemeCssVarProvider.displayName = 'ThemeCssVarProvider'\nThemeCssVarProvider.aglyn = true\n\nexport default ThemeCssVarProvider\n\nexport function withThemeCssVarProvider<P>(\n WrappedComponent: JSX.ComponentType<P>,\n options?: ThemeCssVarProviderProps & { disableCssBaseline?: boolean },\n) {\n const { disableCssBaseline, ...opts } = options || {}\n\n const WithThemeCssVarProvider = forwardRef<any, P>((props, ref) => {\n const { ...rest } = props\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const WrappedAny = WrappedComponent as ComponentType<any>\n return (\n <ThemeCssVarProvider {...opts}>\n {disableCssBaseline ? (\n <WrappedAny ref={ref} {...rest} />\n ) : (\n <CssBaseline enableColorScheme>\n <WrappedAny ref={ref} {...rest} />\n </CssBaseline>\n )}\n </ThemeCssVarProvider>\n )\n })\n const displayName = getDisplayName(WrappedComponent)\n WithThemeCssVarProvider.displayName = `WithThemeCssVarProvider(${displayName})`\n hoistNonReactStatics(WithThemeCssVarProvider, WrappedComponent)\n\n return WithThemeCssVarProvider\n}\n"],"names":["getDisplayName","hoistNonReactStatics","CssBaseline","CssVarsProvider","MuiCssVarsProvider","forwardRef","useMemo","createResponsiveCssVarTheme","ThemeCssVarProvider","props","theme","children","rest","_theme","light","dark","defaultMode","displayName","aglyn","withThemeCssVarProvider","WrappedComponent","options","disableCssBaseline","opts","WithThemeCssVarProvider","ref","WrappedAny","enableColorScheme"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,oBAAoB,QAAQ,4BAA2B;AAChE,SAASC,WAAW,QA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0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { PaletteOptions, Theme, ThemeOptions } from '../vendor/mui';
|
|
18
|
+
export type ColorVariant = 'light' | 'dark';
|
|
19
|
+
export type BackgroundRecord = PaletteOptions['background'];
|
|
20
|
+
export type OrdinalIdentifier<K extends string = ''> = 'primary' | 'secondary' | 'tertiary';
|
|
21
|
+
export type OrdinalRecord<T extends OrdinalIdentifier = OrdinalIdentifier> = Pick<PaletteOptions, T>;
|
|
22
|
+
export type PrimaryRecord = OrdinalRecord<'primary'>['primary'];
|
|
23
|
+
export type SecondaryRecord = OrdinalRecord<'secondary'>['secondary'];
|
|
24
|
+
export type TertiaryRecord = OrdinalRecord<'tertiary'>['tertiary'];
|
|
25
|
+
export type ActionIdentifier = 'svgBackground' | 'svgFilled' | 'svgStroke';
|
|
26
|
+
export type ActionRecord = Pick<PaletteOptions, ActionIdentifier>;
|
|
27
|
+
export declare const consoleOptions: ThemeOptions;
|
|
28
|
+
export declare const consoleOptionsDark: ThemeOptions;
|
|
29
|
+
export declare const consoleThemeLight: Theme;
|
|
30
|
+
export declare const consoleThemeDark: Theme;
|
|
31
|
+
export declare const consoleThemeCssVar: Omit<Theme, "applyStyles"> & import("@mui/material").CssVarsTheme;
|
|
32
|
+
export declare const getConsoleTheme: (mode?: "light" | "dark") => Theme;
|
|
33
|
+
export declare const getConsoleMetaThemeColor: (mode?: "light" | "dark") => string;
|
|
34
|
+
export default consoleThemeLight;
|