~didrocks/+junk/face-detection-15.04

« back to all changes in this revision

Viewing changes to facedetection/www/bower_components/hydrolysis/src/ast-utils/descriptors.ts

  • Committer: Didier Roche
  • Date: 2016-05-10 23:09:11 UTC
  • Revision ID: didier.roche@canonical.com-20160510230911-c7xr490zrj3yrzxd
New version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @license
 
3
 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
 
4
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 
5
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 
6
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 
7
 * Code distributed by Google as part of the polymer project is also
 
8
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 
9
 */
 
10
 
 
11
'use strict';
 
12
import * as estree from 'estree';
 
13
import * as jsdoc from './jsdoc';
 
14
import * as dom5 from 'dom5';
 
15
 
 
16
export type LiteralValue = string|number|boolean|RegExp;
 
17
 
 
18
export interface Descriptor {
 
19
  jsdoc?: jsdoc.Annotation;
 
20
  desc?: string;
 
21
}
 
22
 
 
23
export interface PropertyDescriptor extends Descriptor {
 
24
  name: string,
 
25
  type: string,
 
26
  desc: string,
 
27
  javascriptNode: estree.Node;
 
28
  params?: {name: string}[];
 
29
  published?: boolean;
 
30
  notify?: LiteralValue;
 
31
  observer?: LiteralValue;
 
32
  observerNode?: estree.Expression;
 
33
  readOnly?: LiteralValue;
 
34
  reflectToAttribute?: LiteralValue;
 
35
  default?: LiteralValue;
 
36
  private?: boolean;
 
37
  configuration?: boolean;
 
38
  getter?: boolean;
 
39
  setter?: boolean;
 
40
 
 
41
  __fromBehavior?: BehaviorOrName;
 
42
}
 
43
 
 
44
/**
 
45
 * The metadata for a single polymer element
 
46
 */
 
47
export interface ElementDescriptor extends Descriptor {
 
48
  is?: string;
 
49
  contentHref?: string;
 
50
  properties?: PropertyDescriptor[];
 
51
  observers?: {
 
52
    javascriptNode: estree.Expression | estree.SpreadElement,
 
53
    expression: LiteralValue
 
54
  }[];
 
55
  behaviors?: BehaviorOrName[];
 
56
 
 
57
  type: string; // 'element' | 'behavior'
 
58
  demos?: {
 
59
    desc: string;
 
60
    path: string;
 
61
  }[];
 
62
  events?: EventDescriptor[];
 
63
  hero?: string;
 
64
  domModule?: dom5.Node;
 
65
  scriptElement?: dom5.Node;
 
66
 
 
67
  abstract?: boolean;
 
68
}
 
69
 
 
70
/**
 
71
 * The metadata for a Polymer behavior mixin.
 
72
 */
 
73
export interface BehaviorDescriptor extends ElementDescriptor {
 
74
  symbol?: string;
 
75
}
 
76
 
 
77
export interface EventDescriptor extends Descriptor {
 
78
  name?: string;
 
79
  __fromBehavior?: BehaviorOrName;
 
80
  params?: {
 
81
    type: string,
 
82
    desc: string,
 
83
    name: string
 
84
  }[];
 
85
}
 
86
 
 
87
type BehaviorOrName = LiteralValue|BehaviorDescriptor;
 
88
 
 
89
export interface FunctionDescriptor extends PropertyDescriptor {
 
90
  function: boolean; // true
 
91
  return: {
 
92
    type: string;
 
93
    desc: string;
 
94
  };
 
95
}
 
96
 
 
97
/**
 
98
 * The metadata for a Polymer feature.
 
99
 */
 
100
export interface FeatureDescriptor extends ElementDescriptor {
 
101
 
 
102
}
 
103
 
 
104
export type BehaviorsByName = {[name: string]: BehaviorDescriptor};