@plotdb/chart 0.0.3 → 2.0.0

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 (194) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.md +3 -3
  3. package/{dist/data → data}/index.js +0 -0
  4. package/{dist/chart.css → index.css} +0 -0
  5. package/{dist/chart.js → index.js} +3 -1
  6. package/{dist/chart.min.css → index.min.css} +0 -0
  7. package/index.min.js +1 -0
  8. package/package.json +1 -89
  9. package/{dist/utils → utils}/axis.js +6 -0
  10. package/utils/axis.min.js +1 -0
  11. package/{dist/utils → utils}/config.js +0 -0
  12. package/utils/config.min.js +1 -0
  13. package/{dist/utils → utils}/data.js +0 -0
  14. package/utils/data.min.js +1 -0
  15. package/{dist/utils → utils}/format.js +0 -0
  16. package/utils/format.min.js +1 -0
  17. package/{dist/utils → utils}/legend.css +0 -0
  18. package/{dist/utils → utils}/legend.js +0 -0
  19. package/{dist/utils → utils}/legend.min.css +0 -0
  20. package/utils/legend.min.js +1 -0
  21. package/{dist/utils → utils}/tint.js +0 -0
  22. package/utils/tint.min.js +1 -0
  23. package/{dist/utils → utils}/tip.js +0 -0
  24. package/utils/tip.min.js +1 -0
  25. package/build +0 -39
  26. package/dist/chart.min.js +0 -1
  27. package/dist/utils/axis.min.js +0 -1
  28. package/dist/utils/config.min.js +0 -1
  29. package/dist/utils/data.min.js +0 -1
  30. package/dist/utils/format.min.js +0 -1
  31. package/dist/utils/legend.min.js +0 -1
  32. package/dist/utils/tint.min.js +0 -1
  33. package/dist/utils/tip.min.js +0 -1
  34. package/doc/charts.md +0 -58
  35. package/doc/config.md +0 -44
  36. package/doc/draft/chart.md +0 -146
  37. package/doc/draft/data.md +0 -8
  38. package/doc/draft/definition.md +0 -0
  39. package/doc/draft/events.md +0 -0
  40. package/doc/draft/filter.md +0 -0
  41. package/doc/draft/lifecycle.md +0 -89
  42. package/doc/spec.md +0 -89
  43. package/doc/todo.md +0 -27
  44. package/doc/utils/tip.md +0 -84
  45. package/src/chart.ls +0 -323
  46. package/src/chart.styl +0 -6
  47. package/src/data/en-US/category +0 -20
  48. package/src/data/en-US/fruit +0 -39
  49. package/src/data/en-US/movie +0 -125
  50. package/src/data/en-US/name +0 -58
  51. package/src/data/index.ls +0 -34
  52. package/src/data/zh-TW/category +0 -20
  53. package/src/data/zh-TW/fruits +0 -38
  54. package/src/data/zh-TW/movie +0 -125
  55. package/src/data/zh-TW/names +0 -105
  56. package/src/utils/axis.ls +0 -229
  57. package/src/utils/config.ls +0 -11
  58. package/src/utils/data.ls +0 -104
  59. package/src/utils/format.ls +0 -30
  60. package/src/utils/legend.ls +0 -134
  61. package/src/utils/legend.styl +0 -37
  62. package/src/utils/tint.ls +0 -66
  63. package/src/utils/tip.ls +0 -97
  64. package/web/src/pug/base.pug +0 -20
  65. package/web/src/pug/block/axis/0.0.1/index.ls +0 -38
  66. package/web/src/pug/block/axis/0.0.1/index.pug +0 -1
  67. package/web/src/pug/block/axis-bubble/0.0.1/index.ls +0 -141
  68. package/web/src/pug/block/axis-bubble/0.0.1/index.pug +0 -1
  69. package/web/src/pug/block/bar/0.0.1/index.ls +0 -274
  70. package/web/src/pug/block/bar/0.0.1/index.pug +0 -35
  71. package/web/src/pug/block/bar-list/0.0.1/index.ls +0 -85
  72. package/web/src/pug/block/bar-list/0.0.1/index.pug +0 -30
  73. package/web/src/pug/block/bar-race/0.0.1/index.ls +0 -83
  74. package/web/src/pug/block/bar-race/0.0.1/index.pug +0 -21
  75. package/web/src/pug/block/base/0.0.1/index.ls +0 -67
  76. package/web/src/pug/block/base/0.0.1/index.pug +0 -5
  77. package/web/src/pug/block/blank/0.0.1/index.ls +0 -25
  78. package/web/src/pug/block/blank/0.0.1/index.pug +0 -1
  79. package/web/src/pug/block/bubble/0.0.1/index.ls +0 -220
  80. package/web/src/pug/block/bubble/0.0.1/index.pug +0 -28
  81. package/web/src/pug/block/curve-bar/0.0.1/index.ls +0 -89
  82. package/web/src/pug/block/curve-bar/0.0.1/index.pug +0 -16
  83. package/web/src/pug/block/curve-bar/0.0.1/sample.js +0 -338
  84. package/web/src/pug/block/dumbbell/0.0.1/index.ls +0 -90
  85. package/web/src/pug/block/dumbbell/0.0.1/index.pug +0 -1
  86. package/web/src/pug/block/empty/0.0.1/index.ls +0 -27
  87. package/web/src/pug/block/empty/0.0.1/index.pug +0 -2
  88. package/web/src/pug/block/gauge/0.0.1/index.ls +0 -100
  89. package/web/src/pug/block/gauge/0.0.1/index.pug +0 -31
  90. package/web/src/pug/block/gauge/0.0.1/sample.js +0 -338
  91. package/web/src/pug/block/line/0.0.1/index.ls +0 -302
  92. package/web/src/pug/block/line/0.0.1/index.pug +0 -33
  93. package/web/src/pug/block/number/0.0.1/index.ls +0 -69
  94. package/web/src/pug/block/number/0.0.1/index.pug +0 -20
  95. package/web/src/pug/block/percent-list/0.0.1/index.ls +0 -167
  96. package/web/src/pug/block/percent-list/0.0.1/index.pug +0 -34
  97. package/web/src/pug/block/pie/0.0.1/index.ls +0 -125
  98. package/web/src/pug/block/pie/0.0.1/index.pug +0 -19
  99. package/web/src/pug/block/pie/0.0.1/sample.js +0 -338
  100. package/web/src/pug/block/pie-bubble/0.0.1/index.ls +0 -185
  101. package/web/src/pug/block/pie-bubble/0.0.1/index.pug +0 -40
  102. package/web/src/pug/block/radar/0.0.1/index.ls +0 -113
  103. package/web/src/pug/block/radar/0.0.1/index.pug +0 -1
  104. package/web/src/pug/block/radar/0.0.1/xx +0 -285
  105. package/web/src/pug/block/scatter/0.0.1/index.ls +0 -128
  106. package/web/src/pug/block/scatter/0.0.1/index.pug +0 -30
  107. package/web/src/pug/block/sheet/0.0.1/index.ls +0 -38
  108. package/web/src/pug/block/sheet/0.0.1/index.pug +0 -5
  109. package/web/src/pug/block/table/0.0.1/index.ls +0 -40
  110. package/web/src/pug/block/table/0.0.1/index.pug +0 -3
  111. package/web/src/pug/block/taiwancounty/0.0.1/index.ls +0 -74
  112. package/web/src/pug/block/taiwancounty/0.0.1/index.pug +0 -64
  113. package/web/src/pug/block/taiwantown/0.0.1/index.ls +0 -48
  114. package/web/src/pug/block/taiwantown/0.0.1/index.pug +0 -52
  115. package/web/src/pug/block/taiwanvillage/0.0.1/index.ls +0 -53
  116. package/web/src/pug/block/taiwanvillage/0.0.1/index.pug +0 -52
  117. package/web/src/pug/block/treemap/0.0.1/index.ls +0 -172
  118. package/web/src/pug/block/treemap/0.0.1/index.pug +0 -42
  119. package/web/src/pug/block/voronoi-treemap/0.0.1/index.ls +0 -174
  120. package/web/src/pug/block/voronoi-treemap/0.0.1/index.pug +0 -17
  121. package/web/src/pug/block/voronoi-treemap/0.0.1/sample.js +0 -241
  122. package/web/src/pug/block/wordcloud/0.0.1/index.ls +0 -61
  123. package/web/src/pug/block/wordcloud/0.0.1/index.pug +0 -1
  124. package/web/src/pug/block/worldmap/0.0.1/index.ls +0 -81
  125. package/web/src/pug/block/worldmap/0.0.1/index.pug +0 -12
  126. package/web/src/pug/index.ls +0 -72
  127. package/web/src/pug/index.pug +0 -51
  128. package/web/src/styl/index.styl +0 -0
  129. package/web/static/assets/block/cache.js +0 -4
  130. package/web/static/assets/custom-lib/d3/d3-array.v2.js +0 -1182
  131. package/web/static/assets/custom-lib/d3/d3-array.v2.min.js +0 -2
  132. package/web/static/assets/custom-lib/d3/d3-array.v3.js +0 -1273
  133. package/web/static/assets/custom-lib/d3/d3-array.v3.min.js +0 -1273
  134. package/web/static/assets/custom-lib/d3/d3-axis.v2.min.js +0 -2
  135. package/web/static/assets/custom-lib/d3/d3-brush.v2.min.js +0 -2
  136. package/web/static/assets/custom-lib/d3/d3-color.v2.min.js +0 -2
  137. package/web/static/assets/custom-lib/d3/d3-dispatch.v2.min.js +0 -2
  138. package/web/static/assets/custom-lib/d3/d3-drag.v2.min.js +0 -2
  139. package/web/static/assets/custom-lib/d3/d3-ease.v2.min.js +0 -2
  140. package/web/static/assets/custom-lib/d3/d3-force-boundary.v0.0.1.min.js +0 -2
  141. package/web/static/assets/custom-lib/d3/d3-force.v2.min.js +0 -2
  142. package/web/static/assets/custom-lib/d3/d3-format.v2.min.js +0 -2
  143. package/web/static/assets/custom-lib/d3/d3-geo.v2.js +0 -3127
  144. package/web/static/assets/custom-lib/d3/d3-geo.v2.min.js +0 -2
  145. package/web/static/assets/custom-lib/d3/d3-hierarchy.v2.min.js +0 -2
  146. package/web/static/assets/custom-lib/d3/d3-interpolate.v2.min.js +0 -2
  147. package/web/static/assets/custom-lib/d3/d3-path.v2.min.js +0 -2
  148. package/web/static/assets/custom-lib/d3/d3-quadtree.v2.min.js +0 -2
  149. package/web/static/assets/custom-lib/d3/d3-random.v2.min.js +0 -2
  150. package/web/static/assets/custom-lib/d3/d3-scale-chromatic.v1.min.js +0 -2
  151. package/web/static/assets/custom-lib/d3/d3-selection.v2.min.js +0 -2
  152. package/web/static/assets/custom-lib/d3/d3-shape.v2.min.js +0 -2
  153. package/web/static/assets/custom-lib/d3/d3-timer.v2.min.js +0 -2
  154. package/web/static/assets/custom-lib/d3/d3-transition.v2.min.js +0 -2
  155. package/web/static/assets/custom-lib/d3/d3.v4.js +0 -17178
  156. package/web/static/assets/custom-lib/d3/d3.v4.min.js +0 -2
  157. package/web/static/assets/custom-lib/d3/d3.v6.js +0 -19708
  158. package/web/static/assets/data/countrycode.json +0 -1
  159. package/web/static/assets/data/world-110m.json +0 -1
  160. package/web/static/assets/data/zh-to-alpha2.json +0 -1
  161. package/web/static/assets/img/fluid.svg +0 -16
  162. package/web/static/block/axis/0.0.1/index.html +0 -79
  163. package/web/static/block/axis-bubble/0.0.1/index.html +0 -222
  164. package/web/static/block/bar/0.0.1/index.html +0 -581
  165. package/web/static/block/bar-list/0.0.1/index.html +0 -231
  166. package/web/static/block/bar-race/0.0.1/index.html +0 -184
  167. package/web/static/block/base/0.0.1/index.html +0 -197
  168. package/web/static/block/blank/0.0.1/index.html +0 -42
  169. package/web/static/block/bubble/0.0.1/index.html +0 -402
  170. package/web/static/block/bubble/0.0.1/test.html +0 -0
  171. package/web/static/block/curve-bar/0.0.1/index.html +0 -148
  172. package/web/static/block/dumbbell/0.0.1/index.html +0 -178
  173. package/web/static/block/empty/0.0.1/index.html +0 -76
  174. package/web/static/block/gauge/0.0.1/index.html +0 -150
  175. package/web/static/block/line/0.0.1/index.html +0 -571
  176. package/web/static/block/number/0.0.1/index.html +0 -152
  177. package/web/static/block/percent-list/0.0.1/index.html +0 -316
  178. package/web/static/block/pie/0.0.1/index.html +0 -281
  179. package/web/static/block/pie-bubble/0.0.1/index.html +0 -358
  180. package/web/static/block/radar/0.0.1/index.html +0 -149
  181. package/web/static/block/scatter/0.0.1/index.html +0 -251
  182. package/web/static/block/sheet/0.0.1/index.html +0 -103
  183. package/web/static/block/table/0.0.1/index.html +0 -73
  184. package/web/static/block/taiwancounty/0.0.1/index.html +0 -202
  185. package/web/static/block/taiwantown/0.0.1/index.html +0 -210
  186. package/web/static/block/taiwanvillage/0.0.1/index.html +0 -220
  187. package/web/static/block/treemap/0.0.1/index.html +0 -360
  188. package/web/static/block/voronoi-treemap/0.0.1/index.html +0 -350
  189. package/web/static/block/wordcloud/0.0.1/index.html +0 -92
  190. package/web/static/block/worldmap/0.0.1/index.html +0 -207
  191. package/web/static/css/index.css +0 -0
  192. package/web/static/css/index.min.css +0 -0
  193. package/web/static/favicon.ico +0 -0
  194. package/web/static/index.html +0 -153
package/src/chart.ls DELETED
@@ -1,323 +0,0 @@
1
- svgns = "http://www.w3.org/2000/svg"
2
-
3
- parent = (n, s, e) ->
4
- m = n
5
- while n and n != e => n = n.parentNode # must under e
6
- if n != e => return null
7
- # if no selector - we are testing if s is under e.
8
- if !s => return n
9
- # must match s selector
10
- n = m
11
- while n and n != e and (!n.matches or (n.matches and !n.matches(s))) => n = n.parentNode
12
- if n == e and (!e.matches or !e.matches(s)) => return null
13
- return n
14
-
15
- aniloop = ->
16
- @running = false
17
- @time = { now: 0, last: 0 }
18
- @fps 60
19
- @evt-handler = {}
20
- @
21
-
22
- aniloop.prototype = Object.create(Object.prototype) <<< do
23
- on: (n, cb) -> (if Array.isArray(n) => n else [n]).map (n) ~> @evt-handler.[][n].push cb
24
- fire: (n, ...v) -> for cb in (@evt-handler[n] or []) => cb.apply @, v
25
- reset: -> @time = {now: 0}
26
- set-time: (t) -> @time.now = t
27
- get-time: -> @time.now
28
- is-running: -> @running
29
- toggle: ->
30
- if it? => @running = !it
31
- if @running => @pause! else @run!
32
- pause: -> @running = false
33
- render: -> @fire \tick, @time.now
34
- run: (fps) ->
35
- if fps? => @fps fps
36
- if @running => return
37
- @running = true
38
- requestAnimationFrame (t) ~> @handler(@time.last = t, true)
39
- throttle: (v = true) -> @is-throttled = v
40
- fps: ->
41
- if !(it?) => return @_fps_val
42
- @_fps_val = it >? 0.01
43
- @_fps_delay = 1000 / @_fps_val
44
- handler: (t, force = false) ->
45
- if !@running => return
46
- @time.now = t
47
- delay = if @is-throttled => (@_fps_delay >? 1000) else @_fps_delay
48
- if force or (@time.now - @time.last) >= delay =>
49
- @time.last = t
50
- @render!
51
- requestAnimationFrame (t) ~> @handler t, false
52
-
53
- visibilityObserver = do
54
- list: []
55
- init: ->
56
- @inited = true
57
- [h,vc] = if document.hidden? => <[hidden visibilitychange]>
58
- else if document.msHidden? => <[hidden visibilitychange]>
59
- else if document.webkiHidden? => <[webkitHidden webkitvisibilitychange]>
60
- else <[hidden visibilitychange]>
61
- document.addEventListener vc, debounce 150, (~>
62
- th = !!document[h]
63
- #console.log "visibility changed, #{if th => 'enable' else 'disable'} chart aniloop throttling."
64
- @list.map -> it.throttle th
65
- ), false
66
- add: (aniloop) ->
67
- if !@inited => @init!
68
- @list.push aniloop
69
-
70
-
71
- resizeObserver = do
72
- wm: new WeakMap!
73
- ro: new ResizeObserver (list) ->
74
- list.map (n) ->
75
- ret = resizeObserver.wm.get(n.target)
76
- ret._resize!
77
- add: (node, obj) ->
78
- @wm.set node, obj
79
- @ro.observe node
80
- # observer won't fire the init event if node is not visible.
81
- # - nonfixed - offsetParent will be null if it's hidden via the display style property.
82
- # - fixed - check display property.
83
- # - reference:
84
- # - https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
85
- # - https://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
86
- # thus, if we want to always fire right after node added, we then need:
87
- # if !node.offsetParent or window.getComputedStyle(node).display == \none => obj._resize!
88
-
89
- delete: ->
90
- @ro.unobserve it
91
- @wm.delete it
92
-
93
- with-default = (cfg = {}, defcfg = {}) ->
94
- defcfg = JSON.parse JSON.stringify defcfg
95
- _ = (cfg, defcfg) ->
96
- for k,v of defcfg =>
97
- if !(cfg[k]?) => cfg[k] = v
98
- else if typeof(cfg[k]) == \object and typeof(v) == \object => with-default(cfg[k], defcfg[k])
99
- return cfg
100
- return _ cfg, defcfg
101
-
102
- # use this for now since we don't want to strictly depends on konfig. ( TBD )
103
- default-config = (cfg) ->
104
- _ = (meta, ret = {}) ->
105
- ctrls = if meta.child => that else meta
106
- for id,v of meta =>
107
- if !v.type => _(v, ret{}[id])
108
- else if v.default => ret[id] = v.default
109
- return ret
110
- return _ cfg
111
-
112
-
113
- chart = (opt={}) ->
114
- @root = if typeof(opt.root) == \string => document.querySelector(opt.root) else opt.root
115
- @use-sample = if opt.use-sample? => opt.use-sample else true
116
- @auto-select = if opt.auto-select? => opt.auto-select else true
117
- @force-init = if opt.force-init => opt.force-init else false
118
- @prepare-svg = if opt.prepare-svg? => opt.prepare-svg else true
119
- @layout-opt = if opt.layout? => opt.layout else true
120
- @delay-render = opt.delay-render or false
121
- @data-accessor = if opt.data-accessor? => opt.data-accessor else (->if it => it.data._raw else null)
122
- @raw = opt.raw or null
123
- @mod = opt.mod or {}
124
- @cfg = opt.config or {}
125
- @seed = opt.seed or Math.random!
126
- @binding = opt.binding or {}
127
- @evt-handler = {}
128
- @init = proxise.once ~> @_init!
129
- # _resize is for and (should only be) used by `ResizeObserver`
130
- @_resize = null
131
-
132
- if @auto-select =>
133
- @root.addEventListener \click, @_select = (e) ~>
134
- if !(p = parent e.target, '.data', @root) => return
135
- @fire \select, [{data: @data-accessor(p), node: p}]
136
- @root.addEventListener \mouseover, @_hover = (e) ~>
137
- if !(p = ld$.parent e.target, '.data', @root) => return
138
- @fire \hover, [{data: @data-accessor(p), node: p}]
139
-
140
- @
141
-
142
- chart.prototype = Object.create(Object.prototype) <<< do
143
- # we use `init` to ensure called once, and put the actual code in _init.
144
- _init: ->
145
- if window.getComputedStyle(@root).position == \static => @root.style.position = \relative
146
- layout-root = if @layout-opt =>
147
- if typeof(@layout-opt) != \object => @root.querySelector(\.pdl-layout)
148
- else if typeof(@layout-opt.root) == \string => @root.querySelector(@layout-opt.root)
149
- else if @layout-opt.root => @layout-opt.root
150
- else null
151
- else null
152
- if @prepare-svg and !(@svg = @root.querySelector \svg) =>
153
- @svg = document.createElementNS(svgns, "svg")
154
- @svg.style <<< width: "100%", height: "100%"
155
- if @layout-opt =>
156
- if !layout-root =>
157
- console.error "[@plotdb/chart] layout enabled yet layout root isn't configured properly. "
158
- r = layout-root.querySelector('[data-type=render]')
159
- if !r => console.warn """
160
- [@plotdb/chart] prepareSvg and layout is configured at the same time,
161
- yet render container for layout is not found. svg is thus appended in the root.
162
- """
163
- (r or @root).appendChild @svg
164
-
165
- # this can be implemented with singleton pattern
166
- @_aniloop = new aniloop!
167
- visibilityObserver.add @_aniloop
168
- @_aniloop.on \tick, ~> @tick!
169
- p = Promise.resolve!
170
- .then ~>
171
- defcfg = default-config(@mod.config or {})
172
- with-default @cfg, defcfg
173
- if @raw and Array.isArray(@raw) => return
174
- if !@use-sample or !@mod.sample => return
175
- ret = @mod.sample.apply @
176
- return if ret.then => ret.then! else Promise.resolve ret
177
- .then ~> @ <<<(it or {}){raw, binding}
178
- .then ~>
179
- if !@raw => @raw = []
180
- if @layout-opt =>
181
- if !(layout?) => console.warn "[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found."
182
- else
183
- if !layout-root =>
184
- console.error "[@plotdb/chart] cannot determine root node for @plotdb/layout."
185
- console.error "[@plotdb/chart] config layout properly or disable layout by setting layout to false"
186
- @layout = new layout(
187
- if typeof(@layout-opt) == \object => ({} <<< @layout-opt <<< {watch-resize: false})
188
- else {root: layout-root, watch-resize: false}
189
- )
190
-
191
- # we don't know when resizeObserver will call _resize but we need it to be called.
192
- # thus, we lock execution here until resizeObserver calls _resize
193
- _resize-lock = proxise ~> resizeObserver.add(@root, @); return null
194
- # however, if somewhat resizeObserver won't be called soon ( due to invisibility of node )
195
- # we then may want to get around it.
196
- # see also: `resizeObserver.add` above.
197
- if @force-init and !@root.offsetParent or window.getComputedStyle(@root).display == \none => return
198
- # - unlocker
199
- @_resize = -> _resize-lock.resolve!
200
- # - locker
201
- _resize-lock!
202
- .then ~>
203
- # once resizeObserver called _resize, we temporarily disable it until init is finished.
204
- @_resize = ~>
205
- .then ~>
206
- # if no layout used, we init directly. otherwise we will call mod.init in layout.init
207
- # we have to do this because:
208
- # - layout prepare necessary dom which may be used by init
209
- # - but init may generate necessary dom for layout.update
210
- init = ~> if @mod.init => @mod.init.apply(@)
211
- if !@layout => return init!
212
- layout-lock = proxise ~> Promise.resolve(@layout.init init); return null
213
- @_layout = ~> layout-lock.resolve!
214
- @layout.on \render, ~> @_layout!
215
- layout-lock!
216
- .then ~>
217
- # once layout prepared, we temporarily disable layout update event until init is finished.
218
- @_layout = ~>
219
- Promise.resolve!
220
- .then ~>
221
- # if for any reason user doesn't want to render right after init
222
- # then we just lock it until set-raw.
223
- if !@delay-render => return
224
- @render-lock = proxise ~>
225
- @render-lock!
226
- .then ~>
227
- # init is finished and we are prepared to render.
228
- @_resize = ~> @resize!; @render!
229
- @_layout = ~> @parse!; @bind!; @resize!; @render!
230
- @parse!
231
- @bind!
232
- @resize!
233
- @render!
234
- # explicit return non-promise so init is declared as finished
235
- # and won't block following codes.
236
- return
237
-
238
- parse: ->
239
- @data = @raw.map (r,i) ~>
240
- ret = {}
241
- [{k,v} for k,v of @binding].map ({k,v}) ~>
242
- if !v => return
243
- ret[k] = if @mod.{}dimension{}[k].multiple => v.map -> r[it.key]
244
- else r[v.key]
245
- t = @mod.{}dimension{}[k].type
246
- # TODO Since 'RC' is also possible, we should add and check the matched type instead of supported type.
247
- if /[RIT]/.exec(t) and !/[CN]/.exec(t) =>
248
- ret[k] = if Array.isArray(ret[k]) => ret[k].map(->parseFloat(it)) else parseFloat(ret[k])
249
- ret._raw = r
250
- ret._idx = i
251
- ret
252
- if @mod.parse => @mod.parse.apply @
253
- bind: -> if @mod.bind => @mod.bind.apply @
254
- start: ->
255
- @_aniloop.run!
256
- if @mod.start => @mod.start.apply @
257
- stop: ->
258
- @_aniloop.pause!
259
- if @mod.stop => @mod.stop.apply @
260
- resize: ->
261
- # layout resize is disabled to prevent unnecessary rendering.
262
- # however, we still need layout to be update ( without firing render event )
263
- if @layout => @layout.update false
264
- @box = @root.getBoundingClientRect!
265
- if @mod.resize => @mod.resize.apply @
266
- tick: -> if @mod.tick => @mod.tick.apply @
267
- render: -> if @mod.render => @mod.render.apply @
268
- destroy: ->
269
- Promise.resolve!then ~>
270
- if @_select => @root.removeEventListener \click, @_select
271
- if @_hover => @root.removeEventListener \mouseover, @_hover
272
- resizeObserver.delete @root
273
- if @layout => @layout.destroy!
274
- @stop!
275
- if @mod.destroy => return @mod.destroy.apply @
276
-
277
- config: (opt) ->
278
- if !(opt? and opt) => return @cfg
279
- @cfg <<< opt
280
-
281
- set-bind: (n,b) ->
282
- @binding[n] = b
283
- @parse!
284
- @bind!
285
- @resize!
286
- @render!
287
-
288
- set-raw: (raw, binding, reinit = false) ->
289
- if !Array.isArray(raw) => {raw,binding,reinit} = raw
290
- if raw? => @raw = raw
291
- if binding? => @binding = binding
292
- # if there is render-lock, then we are still in initing process and no need to reinit.
293
- # reinit is only needed if there is no render-lock
294
- if @render-lock =>
295
- @render-lock.resolve!
296
- @render-lock = null
297
- else
298
- if reinit and @mod.init => @mod.init.apply(@)
299
- @parse!
300
- @bind!
301
- @resize!
302
- @render!
303
- on: (n, cb) -> (if Array.isArray(n) => n else [n]).map (n) ~> @evt-handler.[][n].push cb
304
- fire: (n, ...v) -> for cb in (@evt-handler[n] or []) => cb.apply @, v
305
- filter: (filters = {}, internal = false) ->
306
- bs = []
307
- for k,v of @binding =>
308
- u = if Array.isArray(v) => v else [v]
309
- u = u.map (v) -> {k,v}
310
- bs ++= u
311
- for k,v of filters =>
312
- bs
313
- .filter(-> it.k == k)
314
- .map -> it.v.filter = v
315
- if internal => @fire \filter, filters
316
- if @mod.filter => @mod.filter.apply @, [filters, internal]
317
- @parse!
318
- @bind!
319
- @resize!
320
- @render!
321
-
322
- if module? => module.exports = chart
323
- else if window? => window.chart = chart
package/src/chart.styl DELETED
@@ -1,6 +0,0 @@
1
- div[plug=layout]
2
- width: 100%
3
- height: 100%
4
- .pdl-layout
5
- width: 100%
6
- height: 100%
@@ -1,20 +0,0 @@
1
- books
2
- business
3
- education
4
- entertainment
5
- finance
6
- food & drink
7
- games
8
- health & fitness
9
- lifestyle
10
- medical
11
- music
12
- navigation
13
- news
14
- photography
15
- productivity
16
- social network
17
- sports
18
- travel
19
- utilities
20
- weather
@@ -1,39 +0,0 @@
1
- apricot
2
- pomegranate
3
- kiwi
4
- mango
5
- pear
6
- watermelon
7
- strawberry
8
- nectarine
9
- blackberry
10
- raspberry
11
- boysenberry
12
- dragonfruit
13
- lemon
14
- cherry
15
- satsuma
16
- guava
17
- orange
18
- apple
19
- kumquat
20
- cantaloupe
21
- grape
22
- clementine
23
- grapefruit
24
- lime
25
- tangerine
26
- fig
27
- peach
28
- coconut
29
- pineapple
30
- plum
31
- honeydew
32
- papaya
33
- starfruit
34
- jujube
35
- blueberry
36
- banana
37
- passon fruit
38
- avocado
39
- huckleberry
@@ -1,125 +0,0 @@
1
- The Perfect Storm
2
- Philadelphia Story
3
- Planet of the Apes
4
- Patton
5
- Pocahontas
6
- Pinoccio
7
- Quills
8
- Raiders of the Lost Ark
9
- Romeo and Juliet
10
- Snow White
11
- Shine
12
- Some Like It Hot
13
- Stardust
14
- Startrek
15
- The Seven Year Itch
16
- The Sound of Music
17
- Sabrina
18
- Sixth Sense
19
- The Silence of the Lambs
20
- Stargate
21
- Sunset Boulevard
22
- Superman
23
- Somewhere in Time
24
- Shawshank Redemption
25
- Shakespeare in Love
26
- Treasure Planet
27
- Transformers
28
- Toy Story
29
- Toy Story 2
30
- Taxi Driver
31
- Jaws
32
- Family Business
33
- The Italian Job
34
- Ice Age
35
- I Am Sam
36
- Iron Man
37
- How the West Was Won
38
- Mulan
39
- Fantasia
40
- Hulk
41
- Hollywood Ending
42
- Hannibal
43
- The Legend of
44
- The Best Years of Our Lives
45
- Rear Window
46
- Rear Window
47
- Butch Cassidy and the Sundance Kid
48
- The Grapes of Wrath
49
- The Graduate
50
- The Godfather
51
- The Bridge on the River Kwai
52
- Stagecoach
53
- The Princess Diaries
54
- High Fidelity
55
- Gettysburg
56
- Glory
57
- The Running Man
58
- The Fog
59
- Godzilla
60
- The Hills Have Eyes
61
- Bride of Chucky
62
- The Glenn Miller Story
63
- The Fifth Element
64
- Forrest Gump
65
- Finding Nemo
66
- The Fly
67
- First Blood
68
- You Can't Take It with You
69
- Man of the Year
70
- From Hell
71
- The Easy Rider
72
- The English Patient
73
- The Extra-Terrestial
74
- Edward Scissorhands
75
- Empire of the Sun
76
- Encounters of the Third Kind
77
- Elizabeth: The Golden Age
78
- North by Northwest
79
- David and Lisa
80
- A River Runs Through It
81
- East/West
82
- Heads will Roll
83
- The Day After Tomorrow
84
- Blow
85
- Cruel And Unusual
86
- Charlie's Angels
87
- The Crying Game
88
- A Bug's Life
89
- City Lights
90
- Captain Corelli's Mandolin
91
- Jackass
92
- The Man Who Knew Too Much
93
- Rio Bravo
94
- Chinatown
95
- Citizen Kane
96
- Cold Mountain
97
- A Clockwork Orange
98
- Baby Doll
99
- Seabiscuit
100
- Black Hawk Down
101
- The Birth of a Nation
102
- A Beautiful Mind
103
- Bicentennial Man
104
- Soldier
105
- The Mask
106
- Ice Spiders
107
- North by Northwes
108
- Blue Velvet
109
- Bonnie and Clyde
110
- Born on the Fourth of July
111
- Breakfast at Tiffany's
112
- A Walk to Remember
113
- The Avengers
114
- Anna and the King
115
- Annie Hall
116
- Avatar
117
- American Graffiti
118
- All Quiet on the Western Front
119
- American Sweethearts
120
- The Apartment
121
- Amadeus
122
- Alien
123
- All About Eve
124
- A.I. Artificial Intelligence
125
- The Alamo
@@ -1,58 +0,0 @@
1
- Johnnie Mclellan
2
- Kaydan Rollins
3
- Heather Storey
4
- Lillie-Mae Pham
5
- Lily Griffith
6
- Anais Walton
7
- Essa Senior
8
- Tayyib Valdez
9
- Clodagh Hopper
10
- Madina Mccormick
11
- Josef Penn
12
- Denzel Rojas
13
- Russell Woods
14
- Ozan Pacheco
15
- Muhammad Benson
16
- Karishma Ewing
17
- Muhamed Thomas
18
- Ziva Barclay
19
- Mischa Savage
20
- Daniella Wade
21
- Mamie Shepherd
22
- Leighton Bradshaw
23
- Ryley Mansell
24
- Shuaib Bennett
25
- Thelma Mohammed
26
- Arley Larsen
27
- Tessa Rasmussen
28
- Tyler Bowen
29
- Reya Wong
30
- Mae Sandoval
31
- Margaret Person
32
- Danyal Zamora
33
- Layan Reed
34
- Samantha Amin
35
- Olly Guevara
36
- Lia Barajas
37
- Kim Barker
38
- Rayyan Redfern
39
- Ramone Skinner
40
- Bob Chung
41
- Kaleem Rhodes
42
- Braden Adamson
43
- Evie-Rose Colon
44
- Calista Arias
45
- Fox Hurst
46
- Tonisha Bean
47
- Lacey Bowes
48
- Deon Bates
49
- Emrys Sykes
50
- Robbie Moyer
51
- Janine Hussain
52
- Jayden-James William
53
- Jasmin Estrada
54
- Harleigh Sullivan
55
- Elaina East
56
- Dana Brennan
57
- Becky Walters
58
- Iylah Wiggins
package/src/data/index.ls DELETED
@@ -1,34 +0,0 @@
1
- rand-fname = -> return "..."
2
- generate = (count, binding) ->
3
- gen = do
4
- raw: []
5
- binding: {}
6
- fields = {}
7
- idx = 0
8
- for k,v of binding
9
- u = if Array.isArray(v) => v else [v]
10
- keys = u.map ->
11
- fields[idx] = {key: rand-fname!, hint: it}
12
- idx++
13
- if Array.isArray(v) => gen.binding[k] = keys.map -> fields[it]{key}
14
- else gen.binding[k] = fields[keys.0]{key}
15
-
16
- for i from 0 til count =>
17
- for k,v of fields =>
18
- ret = {}
19
- hint = v.hint
20
- name = v.key
21
- value = "..."
22
- switch hint.type
23
- | \R
24
- range = hint.range or [0,1]
25
- value = Math.round(Math.random! * (range.1 - range.0) + range.0)
26
- | \N
27
- value = <[A B C D E]>[Math.floor(Math.random! * 5)]
28
- ret[v.key] = value
29
- gen.raw.push ret
30
- return gen
31
-
32
- generate 10, do
33
- height: [0 to 3].map -> {type: \R, range: [0, 10]}
34
- name: {type: \N}
@@ -1,20 +0,0 @@
1
- 書籍
2
- 商業
3
- 教育
4
- 娛樂
5
- 財務
6
- 飲食
7
- 遊戲
8
- 健康與健身
9
- 生活風格
10
- 醫療
11
- 音樂
12
- 導航
13
- 新聞
14
- 攝影
15
- 生產力工具
16
- 社交網路
17
- 運動
18
- 旅遊
19
- 實用工具
20
- 氣象
@@ -1,38 +0,0 @@
1
- 杏組
2
- 石榴
3
- 奇異果
4
- 芒果
5
- 梨子
6
- 西瓜
7
- 草莓
8
- 李子
9
- 黑莓
10
- 波森莓
11
- 火龍果
12
- 檸檬
13
- 櫻桃
14
- 蜜柑
15
- 芭樂
16
- 橘子
17
- 蘋果
18
- 金橘
19
- 哈蜜瓜
20
- 葡萄
21
- 柳丁
22
- 葡萄柚
23
- 萊姆
24
- 桶柑
25
- 無花果
26
- 桃子
27
- 椰子
28
- 鳳梨
29
- 梅子
30
- 香瓜
31
- 木瓜
32
- 楊桃
33
- 藍莓
34
- 棗子
35
- 香蕉
36
- 百香果
37
- 酪梨
38
- 越橘