jsduck 5.3.4 → 6.0.0beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/bin/jsduck +3 -3
  4. data/lib/jsduck/app.rb +1 -1
  5. data/lib/jsduck/assets.rb +3 -3
  6. data/lib/jsduck/base_type.rb +2 -2
  7. data/lib/jsduck/batch_processor.rb +3 -1
  8. data/lib/jsduck/categories/file.rb +2 -2
  9. data/lib/jsduck/class_doc_expander.rb +1 -1
  10. data/lib/jsduck/css/parser.rb +59 -90
  11. data/lib/jsduck/css/type.rb +55 -0
  12. data/lib/jsduck/doc/parser.rb +1 -1
  13. data/lib/jsduck/doc/scanner.rb +2 -2
  14. data/lib/jsduck/doc/subproperties.rb +1 -1
  15. data/lib/jsduck/export_writer.rb +4 -4
  16. data/lib/jsduck/exporter/app.rb +2 -1
  17. data/lib/jsduck/exporter/full.rb +5 -3
  18. data/lib/jsduck/external_classes.rb +337 -5
  19. data/lib/jsduck/format/class.rb +3 -3
  20. data/lib/jsduck/format/doc.rb +6 -5
  21. data/lib/jsduck/format/subproperties.rb +1 -1
  22. data/lib/jsduck/guide_toc.rb +45 -27
  23. data/lib/jsduck/guide_toc_entry.rb +54 -0
  24. data/lib/jsduck/guides.rb +9 -5
  25. data/lib/jsduck/img/dir.rb +1 -1
  26. data/lib/jsduck/inline/example.rb +3 -1
  27. data/lib/jsduck/inline/img.rb +3 -3
  28. data/lib/jsduck/inline/link.rb +2 -2
  29. data/lib/jsduck/inline/link_renderer.rb +3 -2
  30. data/lib/jsduck/inline/video.rb +2 -1
  31. data/lib/jsduck/js/class.rb +6 -11
  32. data/lib/jsduck/js/ext_define.rb +46 -0
  33. data/lib/jsduck/js/ext_patterns.rb +7 -2
  34. data/lib/jsduck/js/rkelly_adapter.rb +16 -2
  35. data/lib/jsduck/logger.rb +40 -25
  36. data/lib/jsduck/member_registry.rb +41 -0
  37. data/lib/jsduck/news.rb +18 -5
  38. data/lib/jsduck/options/config.rb +35 -0
  39. data/lib/jsduck/options/helpful_parser.rb +111 -0
  40. data/lib/jsduck/options/input_files.rb +60 -0
  41. data/lib/jsduck/options/jsb.rb +25 -0
  42. data/lib/jsduck/{options.rb → options/parser.rb} +436 -484
  43. data/lib/jsduck/options/processor.rb +47 -0
  44. data/lib/jsduck/options/record.rb +51 -0
  45. data/lib/jsduck/output_dir.rb +4 -4
  46. data/lib/jsduck/parser.rb +5 -5
  47. data/lib/jsduck/process/components.rb +19 -0
  48. data/lib/jsduck/process/ext4_events.rb +4 -2
  49. data/lib/jsduck/process/importer.rb +5 -2
  50. data/lib/jsduck/process/inherit_members.rb +2 -0
  51. data/lib/jsduck/process/lint.rb +3 -3
  52. data/lib/jsduck/process/no_doc.rb +1 -1
  53. data/lib/jsduck/process/overrides.rb +4 -3
  54. data/lib/jsduck/process/versions.rb +86 -51
  55. data/lib/jsduck/render/class.rb +3 -2
  56. data/lib/jsduck/render/subproperties.rb +18 -0
  57. data/lib/jsduck/render/tags.rb +13 -1
  58. data/lib/jsduck/source/file.rb +2 -2
  59. data/lib/jsduck/tag/class.rb +6 -0
  60. data/lib/jsduck/tag/component.rb +19 -0
  61. data/lib/jsduck/tag/css_mixin.rb +10 -0
  62. data/lib/jsduck/tag/deprecated.rb +1 -1
  63. data/{template-min/resources/images/class-m.png → lib/jsduck/tag/icons/class-large.png} +0 -0
  64. data/lib/jsduck/tag/icons/class-redirect.png +0 -0
  65. data/lib/jsduck/tag/icons/class.png +0 -0
  66. data/{template-min/resources/images/component-m.png → lib/jsduck/tag/icons/component-large.png} +0 -0
  67. data/lib/jsduck/tag/icons/component-redirect.png +0 -0
  68. data/lib/jsduck/tag/icons/component.png +0 -0
  69. data/{template-min/resources/images/singleton-m.png → lib/jsduck/tag/icons/singleton-large.png} +0 -0
  70. data/lib/jsduck/tag/icons/singleton-redirect.png +0 -0
  71. data/lib/jsduck/tag/icons/singleton.png +0 -0
  72. data/lib/jsduck/tag/inheritdoc.rb +2 -2
  73. data/lib/jsduck/tag/new.rb +13 -0
  74. data/lib/jsduck/tag/since.rb +2 -2
  75. data/lib/jsduck/tag/singleton.rb +13 -0
  76. data/lib/jsduck/tag/tag.rb +19 -0
  77. data/lib/jsduck/tag_registry.rb +20 -81
  78. data/lib/jsduck/util/io.rb +5 -0
  79. data/lib/jsduck/util/json.rb +3 -3
  80. data/lib/jsduck/util/null_object.rb +14 -1
  81. data/lib/jsduck/util/parallel.rb +7 -3
  82. data/lib/jsduck/version.rb +1 -1
  83. data/lib/jsduck/warning/registry.rb +4 -2
  84. data/lib/jsduck/warning/tag.rb +57 -0
  85. data/lib/jsduck/web/class_icons.rb +76 -0
  86. data/lib/jsduck/web/css.rb +12 -1
  87. data/lib/jsduck/web/data.rb +4 -3
  88. data/lib/jsduck/web/index_html.rb +26 -10
  89. data/lib/jsduck/web/member_icons.rb +3 -3
  90. data/lib/jsduck/web/search.rb +4 -4
  91. data/lib/jsduck/web/source.rb +1 -1
  92. data/lib/jsduck/web/template.rb +6 -6
  93. data/lib/jsduck/web/tree.rb +22 -0
  94. data/lib/jsduck/web/writer.rb +11 -9
  95. data/template-min/app-0f524ddd276c4019a11a6128932a9c96.js +1 -0
  96. data/template-min/index-template.html +1 -1
  97. data/template-min/print-template.html +1 -1
  98. data/template-min/resources/css/{app-4689d2a5522dcd3c9e9923ca59c33f27.css → app-de670120f43fdad3091a0cc2c10daadb.css} +1 -1
  99. data/template-min/resources/images/icons.xcf +0 -0
  100. data/template-min/template.html +2 -2
  101. metadata +46 -13
  102. data/lib/jsduck/css/lexer.rb +0 -203
  103. data/lib/jsduck/option_parser.rb +0 -109
  104. data/lib/jsduck/web/icons.rb +0 -31
  105. data/template-min/app-0c945a27f43452df695771ddb60b3d14.js +0 -1
@@ -1,11 +1,13 @@
1
- require 'jsduck/tag_registry'
1
+ require 'jsduck/class'
2
+ require 'jsduck/member_registry'
3
+ require 'ostruct'
2
4
 
3
5
  module JsDuck
4
6
  module Exporter
5
7
 
6
8
  # Exporter for all the class docs.
7
9
  class Full
8
- def initialize(relations, opts={})
10
+ def initialize(relations, opts=OpenStruct.new)
9
11
  # parameters are just for compatibility with other exporters
10
12
  end
11
13
 
@@ -27,7 +29,7 @@ module JsDuck
27
29
  # Generates flat list of all members
28
30
  def export_members(cls)
29
31
  groups = []
30
- TagRegistry.member_type_names.each do |tagname|
32
+ MemberRegistry.names.each do |tagname|
31
33
  groups << export_members_group(cls, {:tagname => tagname, :static => false})
32
34
  groups << export_members_group(cls, {:tagname => tagname, :static => true})
33
35
  end
@@ -3,17 +3,27 @@ module JsDuck
3
3
  # Handles patterns of external classes.
4
4
  #
5
5
  # A pattern can be a simple classname or a one with a wildcard "*".
6
+ #
7
+ # Also one can use a special keyword "@browser" to include all
8
+ # common browser web API class names.
6
9
  class ExternalClasses
7
10
 
8
11
  def initialize(classnames = [])
9
12
  @class_names = {}
10
13
  @patterns = []
11
- classnames.each do |name|
12
- if name =~ /\*/
13
- @patterns << make_pattern(name)
14
- else
15
- @class_names[name] = true
14
+ classnames.each {|name| add(name) }
15
+ end
16
+
17
+ # Adds a classname or pattern to list of external classes.
18
+ def add(name)
19
+ if name =~ /\*/
20
+ @patterns << make_pattern(name)
21
+ elsif name =~ /^@browser$/i
22
+ WEB_APIS.each do |cls|
23
+ @class_names[cls] = true
16
24
  end
25
+ else
26
+ @class_names[name] = true
17
27
  end
18
28
  end
19
29
 
@@ -22,9 +32,331 @@ module JsDuck
22
32
  @class_names[classname] || @patterns.any? {|p| classname =~ p }
23
33
  end
24
34
 
35
+ private
36
+
25
37
  def make_pattern(pattern)
26
38
  Regexp.new("^" + pattern.split(/\*/, -1).map {|s| Regexp.escape(s) }.join(".*") + "$")
27
39
  end
40
+
41
+ # List taken from: https://developer.mozilla.org/en-US/docs/Web/API
42
+ # Excluding experimental, obsolete, deprecated and non-standardized APIs.
43
+ WEB_APIS = %w(
44
+ AbstractWorker
45
+ ArrayBuffer
46
+ ArrayBufferView
47
+ Attr
48
+
49
+ BatteryManager
50
+ Blob
51
+ BluetoothAdapter
52
+ BluetoothManager
53
+
54
+ CanvasGradient
55
+ CanvasImageSource
56
+ CanvasPattern
57
+ CanvasRenderingContext2D
58
+ CharacterData
59
+ CloseEvent
60
+ Comment
61
+ CompositionEvent
62
+ ContactManager
63
+ Coordinates
64
+ CSS
65
+ CSSConditionRule
66
+ CSSGroupingRule
67
+ CSSMediaRule
68
+ CSSPageRule
69
+ CSSRule
70
+ CSSRuleList
71
+ CSSStyleDeclaration
72
+ CSSStyleRule
73
+ CSSStyleSheet
74
+ CSSSupportsRule
75
+ CustomEvent
76
+
77
+ DataTransfer
78
+ DataView
79
+ DedicatedWorkerGlobalScope
80
+ Document
81
+ DocumentFragment
82
+ DocumentTouch
83
+ DocumentType
84
+ DOMError
85
+ DOMException
86
+ DOMHighResTimeStamp
87
+ DOMImplementation
88
+ DOMImplementationRegistry
89
+ DOMString
90
+ DOMStringList
91
+ DOMStringMap
92
+ DOMTimeStamp
93
+ DOMTokenList
94
+
95
+ Element
96
+ ErrorEvent
97
+ Event
98
+ EventListener
99
+ EventSource
100
+ EventTarget
101
+ Extensions
102
+
103
+ File
104
+ FileHandle
105
+ FileList
106
+ FileReader
107
+ FileReaderSync
108
+ FileRequest
109
+ Float32Array
110
+ Float64Array
111
+ FormData
112
+
113
+ Geolocation
114
+ GlobalEventHandlers
115
+
116
+ History
117
+ HTMLAnchorElement
118
+ HTMLAreaElement
119
+ HTMLAudioElement
120
+ HTMLBaseElement
121
+ HTMLBodyElement
122
+ HTMLBRElement
123
+ HTMLButtonElement
124
+ HTMLCanvasElement
125
+ HTMLCollection
126
+ HTMLDataElement
127
+ HTMLDataListElement
128
+ HTMLDivElement
129
+ HTMLDListElement
130
+ HTMLDocument
131
+ HTMLElement
132
+ HTMLEmbedElement
133
+ HTMLFieldSetElement
134
+ HTMLFormControlsCollection
135
+ HTMLFormElement
136
+ HTMLHeadElement
137
+ HTMLHeadingElement
138
+ HTMLHRElement
139
+ HTMLHtmlElement
140
+ HTMLIFrameElement
141
+ HTMLImageElement
142
+ HTMLInputElement
143
+ HTMLKeygenElement
144
+ HTMLLabelElement
145
+ HTMLLegendElement
146
+ HTMLLIElement
147
+ HTMLLinkElement
148
+ HTMLMapElement
149
+ HTMLMediaElement
150
+ HTMLMetaElement
151
+ HTMLMeterElement
152
+ HTMLModElement
153
+ HTMLObjectElement
154
+ HTMLOListElement
155
+ HTMLOptGroupElement
156
+ HTMLOptionElement
157
+ HTMLOptionsCollection
158
+ HTMLOutputElement
159
+ HTMLParagraphElement
160
+ HTMLParamElement
161
+ HTMLPreElement
162
+ HTMLProgressElement
163
+ HTMLQuoteElement
164
+ HTMLScriptElement
165
+ HTMLSelectElement
166
+ HTMLSourceElement
167
+ HTMLSpanElement
168
+ HTMLStyleElement
169
+ HTMLTableCaptionElement
170
+ HTMLTableCellElement
171
+ HTMLTableColElement
172
+ HTMLTableDataCellElement
173
+ HTMLTableElement
174
+ HTMLTableHeaderCellElement
175
+ HTMLTableRowElement
176
+ HTMLTableSectionElement
177
+ HTMLTextAreaElement
178
+ HTMLTimeElement
179
+ HTMLTitleElement
180
+ HTMLTrackElement
181
+ HTMLUListElement
182
+ HTMLUnknownElement
183
+ HTMLVideoElement
184
+
185
+ IDBCursor
186
+ IDBCursorSync
187
+ IDBCursorWithValue
188
+ IDBDatabase
189
+ IDBDatabaseSync
190
+ IDBEnvironment
191
+ IDBEnvironmentSync
192
+ IDBFactory
193
+ IDBFactorySync
194
+ IDBIndex
195
+ IDBIndexSync
196
+ IDBKeyRange
197
+ IDBObjectStore
198
+ IDBObjectStoreSync
199
+ IDBOpenDBRequest
200
+ IDBRequest
201
+ IDBTransaction
202
+ IDBTransactionSync
203
+ IDBVersionChangeEvent
204
+ IDBVersionChangeRequest
205
+ ImageData
206
+ Int16Array
207
+ Int32Array
208
+ Int8Array
209
+
210
+ KeyboardEvent
211
+
212
+ LinkStyle
213
+ Location
214
+ LockedFile
215
+
216
+ MessageEvent
217
+ MouseEvent
218
+
219
+ Navigator
220
+ NavigatorGeolocation
221
+ NavigatorID
222
+ NavigatorLanguage
223
+ NavigatorOnLine
224
+ Node
225
+ NodeFilter
226
+ NodeIterator
227
+ NodeList
228
+ Notification
229
+ NotifyAudioAvailableEvent
230
+
231
+ Performance
232
+ PerformanceNavigation
233
+ PerformanceTiming
234
+ PermissionSettings
235
+ Plugin
236
+ Position
237
+ PositionError
238
+ PositionOptions
239
+ ProcessingInstruction
240
+ ProgressEvent
241
+
242
+ Range
243
+ RTCPeerConnection
244
+
245
+ SharedWorker
246
+ StorageEvent
247
+ StyleSheet
248
+ StyleSheetList
249
+ SVGAElement
250
+ SVGAngle
251
+ SVGAnimateColorElement
252
+ SVGAnimatedAngle
253
+ SVGAnimatedBoolean
254
+ SVGAnimatedEnumeration
255
+ SVGAnimatedInteger
256
+ SVGAnimatedLength
257
+ SVGAnimatedLengthList
258
+ SVGAnimatedNumber
259
+ SVGAnimatedNumberList
260
+ SVGAnimatedPoints
261
+ SVGAnimatedPreserveAspectRatio
262
+ SVGAnimatedRect
263
+ SVGAnimatedString
264
+ SVGAnimatedTransformList
265
+ SVGAnimateElement
266
+ SVGAnimateMotionElement
267
+ SVGAnimateTransformElement
268
+ SVGAnimationElement
269
+ SVGCircleElement
270
+ SVGClipPathElement
271
+ SVGCursorElement
272
+ SVGDefsElement
273
+ SVGDescElement
274
+ SVGElement
275
+ SVGEllipseElement
276
+ SVGFilterElement
277
+ SVGFontElement
278
+ SVGFontFaceElement
279
+ SVGFontFaceFormatElement
280
+ SVGFontFaceNameElement
281
+ SVGFontFaceSrcElement
282
+ SVGFontFaceUriElement
283
+ SVGForeignObjectElement
284
+ SVGGElement
285
+ SVGGlyphElement
286
+ SVGGradientElement
287
+ SVGHKernElement
288
+ SVGImageElement
289
+ SVGLength
290
+ SVGLengthList
291
+ SVGLinearGradientElement
292
+ SVGLineElement
293
+ SVGMaskElement
294
+ SVGMatrix
295
+ SVGMissingGlyphElement
296
+ SVGMPathElement
297
+ SVGNumber
298
+ SVGNumberList
299
+ SVGPathElement
300
+ SVGPatternElement
301
+ SVGPoint
302
+ SVGPolygonElement
303
+ SVGPolylineElement
304
+ SVGPreserveAspectRatio
305
+ SVGRadialGradientElement
306
+ SVGRect
307
+ SVGRectElement
308
+ SVGScriptElement
309
+ SVGSetElement
310
+ SVGStopElement
311
+ SVGStringList
312
+ SVGStylable
313
+ SVGStyleElement
314
+ SVGSVGElement
315
+ SVGSwitchElement
316
+ SVGSymbolElement
317
+ SVGTests
318
+ SVGTextElement
319
+ SVGTextPositioningElement
320
+ SVGTitleElement
321
+ SVGTransform
322
+ SVGTransformable
323
+ SVGTransformList
324
+ SVGTRefElement
325
+ SVGTSpanElement
326
+ SVGUseElement
327
+ SVGViewElement
328
+ SVGVKernElement
329
+
330
+ TCPServerSocket
331
+ Text
332
+ TextMetrics
333
+ TimeRanges
334
+ Touch
335
+ TouchEvent
336
+ TouchList
337
+ Transferable
338
+ TreeWalker
339
+
340
+ UIEvent
341
+ Uint16Array
342
+ Uint32Array
343
+ Uint8Array
344
+ Uint8ClampedArray
345
+
346
+ ValidityState
347
+
348
+ WebGLRenderingContext
349
+ WebSocket
350
+ WheelEvent
351
+ Window
352
+ Worker
353
+ WorkerLocation
354
+ WorkerNavigator
355
+
356
+ XMLHttpRequest
357
+ XMLHttpRequestEventTarget
358
+ )
359
+
28
360
  end
29
361
 
30
362
  end
@@ -1,4 +1,4 @@
1
- require 'jsduck/tag_registry'
1
+ require 'jsduck/render/tags'
2
2
 
3
3
  module JsDuck
4
4
  module Format
@@ -42,14 +42,14 @@ module JsDuck
42
42
  def format_member(m)
43
43
  @formatter.doc_context = m[:files][0]
44
44
 
45
- # Turn off type parsing for CSS vars and mixins
45
+ # Turn off type parsing for SCSS vars and mixins
46
46
  @formatter.skip_type_parsing = [:css_var, :css_mixin].include?(m[:tagname])
47
47
 
48
48
  format_tags(m)
49
49
  end
50
50
 
51
51
  def format_tags(context)
52
- TagRegistry.html_renderers.each do |tag|
52
+ Render::Tags.renderers.each do |tag|
53
53
  if context[tag.tagname]
54
54
  tag.format(context, @formatter)
55
55
  end
@@ -8,6 +8,7 @@ require 'jsduck/inline/link_renderer'
8
8
  require 'jsduck/inline/img'
9
9
  require 'jsduck/inline/video'
10
10
  require 'jsduck/inline/example'
11
+ require 'ostruct'
11
12
 
12
13
  module JsDuck
13
14
  module Format
@@ -18,7 +19,7 @@ module JsDuck
18
19
  # Creates a formatter configured with options originating from
19
20
  # command line. For the actual effect of the options see
20
21
  # Inline::* classes.
21
- def initialize(relations={}, opts={})
22
+ def initialize(relations={}, opts=OpenStruct.new)
22
23
  @relations = relations
23
24
  @opts = opts
24
25
  @subproperties = Format::Subproperties.new(self)
@@ -88,9 +89,9 @@ module JsDuck
88
89
  # recognized classnames.
89
90
  #
90
91
  # Replaces {@link Class#member link text} in given string with
91
- # HTML from @link_tpl.
92
+ # HTML from --link.
92
93
  #
93
- # Replaces {@img path/to/image.jpg Alt text} with HTML from @img_tpl.
94
+ # Replaces {@img path/to/image.jpg Alt text} with HTML from --img.
94
95
  #
95
96
  # Adds 'inline-example' class to code examples beginning with @example.
96
97
  #
@@ -104,7 +105,7 @@ module JsDuck
104
105
  # Keep track of open HTML tags. We're not auto-detecting class
105
106
  # names when inside <a>. Also we want to close down the unclosed
106
107
  # tags.
107
- tags = Format::HtmlStack.new(@opts[:ignore_html] || {}, @doc_context)
108
+ tags = Format::HtmlStack.new(@opts.ignore_html || {}, @doc_context)
108
109
 
109
110
  while !s.eos? do
110
111
  if substitute = @inline_link.replace(s)
@@ -147,7 +148,7 @@ module JsDuck
147
148
 
148
149
  # Turns type parsing on or off.
149
150
  #
150
- # Used to skipping parsing of CSS var and mixin types.
151
+ # Used to skipping parsing of SCSS var and mixin types.
151
152
  def skip_type_parsing=(skip)
152
153
  @subproperties.skip_type_parsing = skip
153
154
  end