| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fa80355 commit 1cbb1e8
36 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,19 +2,20 @@ | |||
| 2 | 2 | ActionBar as ActionBarDefinition, | |
| 3 | 3 | ActionItems as ActionItemsDefinition, | |
| 4 | 4 | ActionItem as ActionItemDefinition, | |
| 5 | - NavigationButton, IOSActionItemSettings, AndroidActionItemSettings, AndroidActionBarSettings | ||
| 5 | + NavigationButton, IOSActionItemSettings, AndroidActionItemSettings, AndroidActionBarSettings, | ||
| 6 | 6 | } from "."; | |
| 7 | 7 | ||
| 8 | 8 | import { profile } from "../../profiling"; | |
| 9 | 9 | ||
| 10 | 10 | export * from "../core/view"; | |
| 11 | 11 | ||
| 12 | - import { View, ViewBase, Property, unsetValue, booleanConverter, horizontalAlignmentProperty, verticalAlignmentProperty } from "../core/view"; | ||
| 12 | + import { View, ViewBase, Property, unsetValue, booleanConverter, horizontalAlignmentProperty, verticalAlignmentProperty, CSSType } from "../core/view"; | ||
| 13 | 13 | ||
| 14 | 14 | export module knownCollections { | |
| 15 | 15 | export var actionItems = "actionItems"; | |
| 16 | 16 | } | |
| 17 | 17 | ||
| 18 | + @CSSType("ActionBar") | ||
| 18 | 19 | export class ActionBarBase extends View implements ActionBarDefinition { | |
| 19 | 20 | private _actionItems: ActionItems; | |
| 20 | 21 | private _navigationButton: NavigationButton; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | 1 | import { ActivityIndicator as ActivityIndicatorDefinition } from "."; | |
| 2 | - import { View, Property, booleanConverter } from "../core/view"; | ||
| 2 | + import { View, Property, booleanConverter, CSSType } from "../core/view"; | ||
| 3 | 3 | ||
| 4 | 4 | export * from "../core/view"; | |
| 5 | 5 | ||
| 6 | + @CSSType("ActivityIndicator") | ||
| 6 | 7 | export class ActivityIndicatorBase extends View implements ActivityIndicatorDefinition { | |
| 7 | 8 | public busy: boolean; | |
| 8 | 9 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,8 @@ | |||
| 1 | 1 | import { Border as BorderDefinition } from "."; | |
| 2 | - import { ContentView, View, layout } from "../content-view"; | ||
| 2 | + import { ContentView, View, layout, CSSType } from "../content-view"; | ||
| 3 | 3 | ||
| 4 | 4 | @Deprecated | |
| 5 | + @CSSType("Border") | ||
| 5 | 6 | export class Border extends ContentView implements BorderDefinition { | |
| 6 | 7 | get cornerRadius(): number { | |
| 7 | 8 | if (typeof this.borderRadius === "number") { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | 1 | import { Button as ButtonDefinition } from "."; | |
| 2 | - import { TextBase, booleanConverter } from "../text-base"; | ||
| 2 | + import { TextBase, booleanConverter, CSSType } from "../text-base"; | ||
| 3 | 3 | ||
| 4 | 4 | export * from "../text-base"; | |
| 5 | 5 | ||
| 6 | + @CSSType("Button") | ||
| 6 | 7 | export abstract class ButtonBase extends TextBase implements ButtonDefinition { | |
| 7 | 8 | public static tapEvent = "tap"; | |
| 8 | 9 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,12 @@ function ensureAnimationModule() { | |||
| 33 | 33 | } | |
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | + export function CSSType(type: string): ClassDecorator { | ||
| 37 | + return (cls) => { | ||
| 38 | + cls.prototype.cssType = type; | ||
| 39 | + }; | ||
| 40 | + } | ||
| 41 | + | ||
| 36 | 42 | export function PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator { | |
| 37 | 43 | const stateEventNames = pseudoClasses.map(s => ":" + s); | |
| 38 | 44 | const listeners = Symbol("listeners"); | |
@@ -580,6 +586,9 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { | |||
| 580 | 586 | } | |
| 581 | 587 | return this._cssType; | |
| 582 | 588 | } | |
| 589 | + set cssType(type: string) { | ||
| 590 | + this._cssType = type.toLowerCase(); | ||
| 591 | + } | ||
| 583 | 592 | ||
| 584 | 593 | get isLayoutRequired(): boolean { | |
| 585 | 594 | return true; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,22 @@ export * from "../../styling/style-properties"; | |||
| 13 | 13 | ||
| 14 | 14 | export function PseudoClassHandler(...pseudoClasses: string[]): MethodDecorator; | |
| 15 | 15 | ||
| 16 | + /** | ||
| 17 | + * Specifies the type name for the instances of this View class, | ||
| 18 | + * that is used when matching CSS type selectors. | ||
| 19 | + * | ||
| 20 | + * Usage: | ||
| 21 | + * ``` | ||
| 22 | + * @CSSType("Button") | ||
| 23 | + * class Button extends View { | ||
| 24 | + * } | ||
| 25 | + * ``` | ||
| 26 | + * | ||
| 27 | + * Internally the decorator set `Button.prototype.cssType = "Button"`. | ||
| 28 | + * @param type The type name, e. g. "Button", "Label", etc. | ||
| 29 | + */ | ||
| 30 | + export function CSSType(type: string): ClassDecorator; | ||
| 31 | + | ||
| 16 | 32 | /** | |
| 17 | 33 | * Denotes a length number that is in device independent pixel units. | |
| 18 | 34 | */ | |
@@ -339,8 +355,8 @@ export abstract class View extends ViewBase { | |||
| 339 | 355 | /** | |
| 340 | 356 | * This is called to find out how big a view should be. The parent supplies constraint information in the width and height parameters. | |
| 341 | 357 | * The actual measurement work of a view is performed in onMeasure(int, int), called by this method. Therefore, only onMeasure(int, int) can and must be overridden by subclasses. | |
| 342 | - * @param widthMeasureSpec Horizontal space requirements as imposed by the parent | ||
| 343 | - * @param heightMeasureSpec Vertical space requirements as imposed by the parent | ||
| 358 | + * @param widthMeasureSpec Horizontal space requirements as imposed by the parent | ||
| 359 | + * @param heightMeasureSpec Vertical space requirements as imposed by the parent | ||
| 344 | 360 | */ | |
| 345 | 361 | public measure(widthMeasureSpec: number, heightMeasureSpec: number): void; | |
| 346 | 362 | ||
@@ -370,8 +386,8 @@ export abstract class View extends ViewBase { | |||
| 370 | 386 | /** | |
| 371 | 387 | * Measure the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overriden by subclasses to provide accurate and efficient measurement of their contents. | |
| 372 | 388 | * When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an exception, thrown by measure(int, int). | |
| 373 | - * @param widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec. | ||
| 374 | - * @param heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec. | ||
| 389 | + * @param widthMeasureSpec horizontal space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec. | ||
| 390 | + * @param heightMeasureSpec vertical space requirements as imposed by the parent. The requirements are encoded with View.MeasureSpec. | ||
| 375 | 391 | */ | |
| 376 | 392 | public onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void; | |
| 377 | 393 | ||
@@ -380,14 +396,14 @@ export abstract class View extends ViewBase { | |||
| 380 | 396 | * @param left Left position, relative to parent | |
| 381 | 397 | * @param top Top position, relative to parent | |
| 382 | 398 | * @param right Right position, relative to parent | |
| 383 | - * @param bottom Bottom position, relative to parent | ||
| 399 | + * @param bottom Bottom position, relative to parent | ||
| 384 | 400 | */ | |
| 385 | 401 | public onLayout(left: number, top: number, right: number, bottom: number): void; | |
| 386 | 402 | ||
| 387 | 403 | /** | |
| 388 | 404 | * This method must be called by onMeasure(int, int) to store the measured width and measured height. Failing to do so will trigger an exception at measurement time. | |
| 389 | - * @param measuredWidth The measured width of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL. | ||
| 390 | - * @param measuredHeight The measured height of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL. | ||
| 405 | + * @param measuredWidth The measured width of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL. | ||
| 406 | + * @param measuredHeight The measured height of this view. May be a complex bit mask as defined by MEASURED_SIZE_MASK and MEASURED_STATE_TOO_SMALL. | ||
| 391 | 407 | */ | |
| 392 | 408 | public setMeasuredDimension(measuredWidth: number, measuredHeight: number): void; | |
| 393 | 409 | ||
@@ -397,16 +413,16 @@ export abstract class View extends ViewBase { | |||
| 397 | 413 | * @param left Left position, relative to parent | |
| 398 | 414 | * @param top Top position, relative to parent | |
| 399 | 415 | * @param right Right position, relative to parent | |
| 400 | - * @param bottom Bottom position, relative to parent | ||
| 416 | + * @param bottom Bottom position, relative to parent | ||
| 401 | 417 | */ | |
| 402 | 418 | public layoutNativeView(left: number, top: number, right: number, bottom: number): void; | |
| 403 | 419 | ||
| 404 | 420 | /** | |
| 405 | 421 | * Measure a child by taking into account its margins and a given measureSpecs. | |
| 406 | 422 | * @param parent This parameter is not used. You can pass null. | |
| 407 | 423 | * @param child The view to be measured. | |
| 408 | - * @param measuredWidth The measured width that the parent layout specifies for this view. | ||
| 409 | - * @param measuredHeight The measured height that the parent layout specifies for this view. | ||
| 424 | + * @param measuredWidth The measured width that the parent layout specifies for this view. | ||
| 425 | + * @param measuredHeight The measured height that the parent layout specifies for this view. | ||
| 410 | 426 | */ | |
| 411 | 427 | public static measureChild(parent: View, child: View, widthMeasureSpec: number, heightMeasureSpec: number): { measuredWidth: number; measuredHeight: number }; | |
| 412 | 428 | ||
@@ -416,7 +432,7 @@ export abstract class View extends ViewBase { | |||
| 416 | 432 | * @param left Left position, relative to parent | |
| 417 | 433 | * @param top Top position, relative to parent | |
| 418 | 434 | * @param right Right position, relative to parent | |
| 419 | - * @param bottom Bottom position, relative to parent | ||
| 435 | + * @param bottom Bottom position, relative to parent | ||
| 420 | 436 | */ | |
| 421 | 437 | public static layoutChild(parent: View, child: View, left: number, top: number, right: number, bottom: number): void; | |
| 422 | 438 | ||
@@ -787,4 +803,4 @@ export namespace ios { | |||
| 787 | 803 | export class UILayoutViewController { | |
| 788 | 804 | public static initWithOwner(owner: WeakRef<View>): UILayoutViewController; | |
| 789 | 805 | } | |
| 790 | - } | ||
| 806 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,12 @@ | |||
| 1 | 1 | import { DatePicker as DatePickerDefinition } from "."; | |
| 2 | - import { View, Property } from "../core/view"; | ||
| 2 | + import { View, Property, CSSType } from "../core/view"; | ||
| 3 | 3 | ||
| 4 | 4 | export * from "../core/view"; | |
| 5 | 5 | ||
| 6 | 6 | const defaultDate = new Date(); | |
| 7 | 7 | const dateComparer = (x: Date, y: Date): boolean => (x <= y && x >= y); | |
| 8 | 8 | ||
| 9 | + @CSSType("DatePicker") | ||
| 9 | 10 | export class DatePickerBase extends View implements DatePickerDefinition { | |
| 10 | 11 | public year: number; | |
| 11 | 12 | public month: number; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ import { Frame as FrameDefinition, NavigationEntry, BackstackEntry, NavigationTr | |||
| 3 | 3 | import { Page } from "../page"; | |
| 4 | 4 | ||
| 5 | 5 | // Types. | |
| 6 | - import { View, CustomLayoutView, isIOS, isAndroid, traceEnabled, traceWrite, traceCategories, EventData, Property } from "../core/view"; | ||
| 6 | + import { View, CustomLayoutView, isIOS, isAndroid, traceEnabled, traceWrite, traceCategories, EventData, Property, CSSType } from "../core/view"; | ||
| 7 | 7 | import { resolveFileName } from "../../file-system/file-name-resolver"; | |
| 8 | 8 | import { knownFolders, path } from "../../file-system"; | |
| 9 | 9 | import { parse, createViewFromEntry } from "../builder"; | |
@@ -35,6 +35,7 @@ export interface NavigationContext { | |||
| 35 | 35 | isBackNavigation: boolean; | |
| 36 | 36 | } | |
| 37 | 37 | ||
| 38 | + @CSSType("Frame") | ||
| 38 | 39 | export class FrameBase extends CustomLayoutView implements FrameDefinition { | |
| 39 | 40 | public static androidOptionSelectedEvent = "optionSelected"; | |
| 40 | 41 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,9 @@ | |||
| 1 | 1 | import { HtmlView as HtmlViewDefinition } from "."; | |
| 2 | - import { View, Property } from "../core/view"; | ||
| 2 | + import { View, Property, CSSType } from "../core/view"; | ||
| 3 | 3 | ||
| 4 | 4 | export * from "../core/view"; | |
| 5 | 5 | ||
| 6 | + @CSSType("HtmlView") | ||
| 6 | 7 | export class HtmlViewBase extends View implements HtmlViewDefinition { | |
| 7 | 8 | public html: string; | |
| 8 | 9 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,13 @@ | |||
| 1 | 1 | import { Image as ImageDefinition, Stretch } from "."; | |
| 2 | - import { View, Property, InheritedCssProperty, Length, Style, Color, isIOS, booleanConverter } from "../core/view"; | ||
| 2 | + import { View, Property, InheritedCssProperty, Length, Style, Color, isIOS, booleanConverter, CSSType } from "../core/view"; | ||
| 3 | 3 | import { ImageAsset } from "../../image-asset"; | |
| 4 | 4 | import { ImageSource, fromAsset, fromNativeSource, fromUrl } from "../../image-source"; | |
| 5 | 5 | import { isDataURI, isFileOrResourcePath, RESOURCE_PREFIX } from "../../utils/utils"; | |
| 6 | 6 | ||
| 7 | 7 | export * from "../core/view"; | |
| 8 | 8 | export { ImageSource, ImageAsset, fromAsset, fromNativeSource, fromUrl, isDataURI, isFileOrResourcePath, RESOURCE_PREFIX }; | |
| 9 | 9 | ||
| 10 | + @CSSType("Image") | ||
| 10 | 11 | export abstract class ImageBase extends View implements ImageDefinition { | |
| 11 | 12 | public imageSource: ImageSource; | |
| 12 | 13 | public src: string | ImageSource; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments