StyleValueRegistry.d.ts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { DisplayObject } from '../display-objects';
  2. import type { BaseStyleProps } from '../types';
  3. import type { CSSStyleValue } from './cssom';
  4. import type { PropertyMetadata, PropertyParseOptions, StyleValueRegistry } from './interfaces';
  5. export type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
  6. /**
  7. * Blink used them in code generation(css_properties.json5)
  8. */
  9. export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
  10. export declare const propertyMetadataCache: Record<string, PropertyMetadata>;
  11. export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
  12. /**
  13. * need recalc later
  14. */
  15. constructor();
  16. registerMetadata(metadata: PropertyMetadata): void;
  17. unregisterMetadata(name: string): void;
  18. getPropertySyntax(syntax: string): any;
  19. /**
  20. * * parse value, eg.
  21. * fill: 'red' => CSSRGB
  22. * translateX: '10px' => CSSUnitValue { unit: 'px', value: 10 }
  23. * fontSize: '2em' => { unit: 'px', value: 32 }
  24. *
  25. * * calculate used value
  26. * * post process
  27. */
  28. processProperties(object: DisplayObject, attributes: BaseStyleProps, options?: Partial<PropertyParseOptions>): void;
  29. /**
  30. * string -> parsed value
  31. */
  32. parseProperty(name: string, value: any, object: DisplayObject): CSSStyleValue;
  33. /**
  34. * computed value -> used value
  35. */
  36. computeProperty(name: string, computed: CSSStyleValue, object: DisplayObject): any;
  37. postProcessProperty(name: string, object: DisplayObject, attributes: string[]): void;
  38. /**
  39. * resolve later
  40. */
  41. addUnresolveProperty(object: DisplayObject, name: string): void;
  42. tryToResolveProperty(object: DisplayObject, name: string, options?: {
  43. inherited?: boolean;
  44. }): any;
  45. recalc(object: DisplayObject): void;
  46. /**
  47. * update geometry when relative props changed,
  48. * eg. r of Circle, width/height of Rect
  49. */
  50. private updateGeometry;
  51. private isPropertyInheritable;
  52. }
  53. //# sourceMappingURL=StyleValueRegistry.d.ts.map