MCPcopy
hub / github.com/midrender/revideo / defaultStyle

Function defaultStyle

packages/2d/src/lib/decorators/defaultStyle.ts:4–18  ·  view source on GitHub ↗
(
  styleName: string,
  parse: (value: string) => T = value => value as T,
)

Source from the content-addressed store, hash-verified

2import type {Layout} from '../components';
3
4export function defaultStyle<T>(
5 styleName: string,
6 parse: (value: string) => T = value => value as T,
7): PropertyDecorator {
8 return (target: any, key) => {
9 target[`getDefault${capitalize(<string>key)}`] = function (this: Layout) {
10 this.requestLayoutUpdate();
11 const old = (<any>this.element.style)[styleName];
12 (<any>this.element.style)[styleName] = '';
13 const ret = parse.call(this, this.styles.getPropertyValue(styleName));
14 (<any>this.element.style)[styleName] = old;
15 return ret;
16 };
17 };
18}

Callers 1

LayoutClass · 0.90

Calls 2

capitalizeFunction · 0.90
requestLayoutUpdateMethod · 0.45

Tested by

no test coverage detected