neue Homepage auf react basis

This commit is contained in:
2026-08-07 21:39:30 +02:00
parent 164bdd19ad
commit ee89442c04
52191 changed files with 1230242 additions and 58 deletions
+3
View File
@@ -0,0 +1,3 @@
export { default } from "./style.mjs";
export { default as style } from "./style.mjs";
export * from "./style.mjs";
+3
View File
@@ -0,0 +1,3 @@
export { default } from "./style.js";
export { default as style } from "./style.js";
export * from "./style.js";
+33
View File
@@ -0,0 +1,33 @@
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
style: true
};
Object.defineProperty(exports, "default", {
enumerable: true,
get: function () {
return _style.default;
}
});
Object.defineProperty(exports, "style", {
enumerable: true,
get: function () {
return _style.default;
}
});
var _style = _interopRequireWildcard(require("./style"));
Object.keys(_style).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _style[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _style[key];
}
});
});
+3
View File
@@ -0,0 +1,3 @@
export { default } from "./style.mjs";
export { default as style } from "./style.mjs";
export * from "./style.mjs";
+52
View File
@@ -0,0 +1,52 @@
import type { CSSObject } from '@mui/styled-engine';
export type StyleFunction<Props> = (props: Props) => any;
export type PropsFor<SomeStyleFunction> = SomeStyleFunction extends StyleFunction<infer Props> ? Props : never;
export type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<Partial<Record<PropKey, any>>> & {
filterProps: string[];
};
export type TransformFunction = (cssValue: unknown, userValue: unknown, transform: object | ((arg: any) => any) | undefined | null) => number | string | React.CSSProperties | CSSObject;
export interface StyleOptions<PropKey> {
cssProperty?: PropKey | keyof React.CSSProperties | false | undefined;
prop: PropKey;
/**
* dot access in `Theme`
*/
themeKey?: string | undefined;
transform?: TransformFunction | undefined;
}
/**
* TODO(v7): Keep either this one or `getStyleValue2`
*/
export declare function getStyleValue(themeMapping: object | ((arg: any) => any) | null | undefined, transform: TransformFunction | null | undefined, valueFinal: unknown, userValue?: unknown): any;
/**
* HACK: The `alternateProp` logic is there because our theme looks like this:
* {
* typography: {
* fontFamily: 'comic sans',
* fontFamilyCode: 'courrier new',
* }
* }
* And we support targetting:
* - `typography.fontFamily` with `sx={{ fontFamily: 'default' }}`
* - `typography.fontFamilyCode` with `sx={{ fontFamily: 'code' }}`
*
* TODO(v7): Refactor our theme to look like this and remove the horrendous logic:
* {
* typography: {
* fontFamily: {
* default: 'comic sans',
* code: 'courrier new',
* }
* }
* }
*/
export declare function getStyleValue2(themeMapping: object | ((arg: any) => any) | null | undefined, transform: TransformFunction | null | undefined, userValue: unknown, alternateProp: string | undefined): any;
export declare function getPath<T extends Record<string, any> | undefined | null>(obj: T, pathInput: string | undefined, checkVars?: boolean, alternateProp?: string | undefined): null | unknown;
type StyleResult<PropKey extends string | number | symbol, Theme> = StyleFunction<{ [K in PropKey]?: unknown } & {
theme?: Theme | undefined;
}> & {
filterProps: string[];
propTypes: any;
};
export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleResult<PropKey, Theme>;
export {};
+52
View File
@@ -0,0 +1,52 @@
import type { CSSObject } from '@mui/styled-engine';
export type StyleFunction<Props> = (props: Props) => any;
export type PropsFor<SomeStyleFunction> = SomeStyleFunction extends StyleFunction<infer Props> ? Props : never;
export type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<Partial<Record<PropKey, any>>> & {
filterProps: string[];
};
export type TransformFunction = (cssValue: unknown, userValue: unknown, transform: object | ((arg: any) => any) | undefined | null) => number | string | React.CSSProperties | CSSObject;
export interface StyleOptions<PropKey> {
cssProperty?: PropKey | keyof React.CSSProperties | false | undefined;
prop: PropKey;
/**
* dot access in `Theme`
*/
themeKey?: string | undefined;
transform?: TransformFunction | undefined;
}
/**
* TODO(v7): Keep either this one or `getStyleValue2`
*/
export declare function getStyleValue(themeMapping: object | ((arg: any) => any) | null | undefined, transform: TransformFunction | null | undefined, valueFinal: unknown, userValue?: unknown): any;
/**
* HACK: The `alternateProp` logic is there because our theme looks like this:
* {
* typography: {
* fontFamily: 'comic sans',
* fontFamilyCode: 'courrier new',
* }
* }
* And we support targetting:
* - `typography.fontFamily` with `sx={{ fontFamily: 'default' }}`
* - `typography.fontFamilyCode` with `sx={{ fontFamily: 'code' }}`
*
* TODO(v7): Refactor our theme to look like this and remove the horrendous logic:
* {
* typography: {
* fontFamily: {
* default: 'comic sans',
* code: 'courrier new',
* }
* }
* }
*/
export declare function getStyleValue2(themeMapping: object | ((arg: any) => any) | null | undefined, transform: TransformFunction | null | undefined, userValue: unknown, alternateProp: string | undefined): any;
export declare function getPath<T extends Record<string, any> | undefined | null>(obj: T, pathInput: string | undefined, checkVars?: boolean, alternateProp?: string | undefined): null | unknown;
type StyleResult<PropKey extends string | number | symbol, Theme> = StyleFunction<{ [K in PropKey]?: unknown } & {
theme?: Theme | undefined;
}> & {
filterProps: string[];
propTypes: any;
};
export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleResult<PropKey, Theme>;
export {};
+135
View File
@@ -0,0 +1,135 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = style;
exports.getPath = getPath;
exports.getStyleValue = getStyleValue;
exports.getStyleValue2 = getStyleValue2;
var _capitalize = _interopRequireDefault(require("@mui/utils/capitalize"));
var _responsivePropType = _interopRequireDefault(require("../responsivePropType"));
var _breakpoints = require("../breakpoints");
/**
* TODO(v7): Keep either this one or `getStyleValue2`
*/
function getStyleValue(themeMapping, transform, valueFinal, userValue = valueFinal) {
let value;
if (typeof themeMapping === 'function') {
value = themeMapping(valueFinal);
} else if (Array.isArray(themeMapping)) {
value = themeMapping[valueFinal] || userValue;
} else if (typeof valueFinal === 'string') {
value = getPath(themeMapping, valueFinal) || userValue;
} else {
value = userValue;
}
if (transform) {
value = transform(value, userValue, themeMapping);
}
return value;
}
/**
* HACK: The `alternateProp` logic is there because our theme looks like this:
* {
* typography: {
* fontFamily: 'comic sans',
* fontFamilyCode: 'courrier new',
* }
* }
* And we support targetting:
* - `typography.fontFamily` with `sx={{ fontFamily: 'default' }}`
* - `typography.fontFamilyCode` with `sx={{ fontFamily: 'code' }}`
*
* TODO(v7): Refactor our theme to look like this and remove the horrendous logic:
* {
* typography: {
* fontFamily: {
* default: 'comic sans',
* code: 'courrier new',
* }
* }
* }
*/
function getStyleValue2(themeMapping, transform, userValue, alternateProp) {
let value;
if (typeof themeMapping === 'function') {
value = themeMapping(userValue);
} else if (Array.isArray(themeMapping)) {
value = themeMapping[userValue] || userValue;
} else if (typeof userValue === 'string') {
value = getPath(themeMapping, userValue, true, alternateProp) || userValue;
} else {
value = userValue;
}
if (transform) {
value = transform(value, userValue, themeMapping);
}
return value;
}
function getPath(obj, pathInput, checkVars = true, alternateProp = undefined) {
if (!obj || !pathInput) {
return null;
}
const path = pathInput.split('.');
// Check if CSS variables are used
if (obj.vars && checkVars) {
const val = getPathImpl(obj.vars, path, alternateProp);
if (val != null) {
return val;
}
}
return getPathImpl(obj, path, alternateProp);
}
function getPathImpl(object, path, alternateProp = undefined) {
let lastResult = undefined;
let result = object;
let index = 0;
while (index < path.length) {
if (result === null || result === undefined) {
return result;
}
lastResult = result;
result = result[path[index]];
index += 1;
}
if (alternateProp && result === undefined) {
const lastKey = path[path.length - 1];
const alternateKey = `${alternateProp}${lastKey === 'default' ? '' : (0, _capitalize.default)(lastKey)}`;
return lastResult?.[alternateKey];
}
return result;
}
function style(options) {
const {
prop,
cssProperty = options.prop,
themeKey,
transform
} = options;
// eslint-disable-next-line react/function-component-definition
const fn = props => {
if (props[prop] == null) {
return null;
}
const propValue = props[prop];
const theme = props.theme;
const themeMapping = getPath(theme, themeKey) || {};
const styleFromPropValue = valueFinal => {
const value = getStyleValue2(themeMapping, transform, valueFinal, prop);
return cssProperty === false ? value : {
[cssProperty]: value
};
};
return (0, _breakpoints.handleBreakpoints)(props, propValue, styleFromPropValue);
};
fn.propTypes = process.env.NODE_ENV !== 'production' ? {
[prop]: _responsivePropType.default
} : {};
fn.filterProps = [prop];
return fn;
}
+125
View File
@@ -0,0 +1,125 @@
import capitalize from '@mui/utils/capitalize';
import responsivePropType from "../responsivePropType/index.mjs";
import { handleBreakpoints } from "../breakpoints/index.mjs";
/**
* TODO(v7): Keep either this one or `getStyleValue2`
*/
export function getStyleValue(themeMapping, transform, valueFinal, userValue = valueFinal) {
let value;
if (typeof themeMapping === 'function') {
value = themeMapping(valueFinal);
} else if (Array.isArray(themeMapping)) {
value = themeMapping[valueFinal] || userValue;
} else if (typeof valueFinal === 'string') {
value = getPath(themeMapping, valueFinal) || userValue;
} else {
value = userValue;
}
if (transform) {
value = transform(value, userValue, themeMapping);
}
return value;
}
/**
* HACK: The `alternateProp` logic is there because our theme looks like this:
* {
* typography: {
* fontFamily: 'comic sans',
* fontFamilyCode: 'courrier new',
* }
* }
* And we support targetting:
* - `typography.fontFamily` with `sx={{ fontFamily: 'default' }}`
* - `typography.fontFamilyCode` with `sx={{ fontFamily: 'code' }}`
*
* TODO(v7): Refactor our theme to look like this and remove the horrendous logic:
* {
* typography: {
* fontFamily: {
* default: 'comic sans',
* code: 'courrier new',
* }
* }
* }
*/
export function getStyleValue2(themeMapping, transform, userValue, alternateProp) {
let value;
if (typeof themeMapping === 'function') {
value = themeMapping(userValue);
} else if (Array.isArray(themeMapping)) {
value = themeMapping[userValue] || userValue;
} else if (typeof userValue === 'string') {
value = getPath(themeMapping, userValue, true, alternateProp) || userValue;
} else {
value = userValue;
}
if (transform) {
value = transform(value, userValue, themeMapping);
}
return value;
}
export function getPath(obj, pathInput, checkVars = true, alternateProp = undefined) {
if (!obj || !pathInput) {
return null;
}
const path = pathInput.split('.');
// Check if CSS variables are used
if (obj.vars && checkVars) {
const val = getPathImpl(obj.vars, path, alternateProp);
if (val != null) {
return val;
}
}
return getPathImpl(obj, path, alternateProp);
}
function getPathImpl(object, path, alternateProp = undefined) {
let lastResult = undefined;
let result = object;
let index = 0;
while (index < path.length) {
if (result === null || result === undefined) {
return result;
}
lastResult = result;
result = result[path[index]];
index += 1;
}
if (alternateProp && result === undefined) {
const lastKey = path[path.length - 1];
const alternateKey = `${alternateProp}${lastKey === 'default' ? '' : capitalize(lastKey)}`;
return lastResult?.[alternateKey];
}
return result;
}
export default function style(options) {
const {
prop,
cssProperty = options.prop,
themeKey,
transform
} = options;
// eslint-disable-next-line react/function-component-definition
const fn = props => {
if (props[prop] == null) {
return null;
}
const propValue = props[prop];
const theme = props.theme;
const themeMapping = getPath(theme, themeKey) || {};
const styleFromPropValue = valueFinal => {
const value = getStyleValue2(themeMapping, transform, valueFinal, prop);
return cssProperty === false ? value : {
[cssProperty]: value
};
};
return handleBreakpoints(props, propValue, styleFromPropValue);
};
fn.propTypes = process.env.NODE_ENV !== 'production' ? {
[prop]: responsivePropType
} : {};
fn.filterProps = [prop];
return fn;
}