easy 19.0.7 → 20.0.2

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 (63) hide show
  1. package/README.md +18 -136
  2. package/example.js +535 -609
  3. package/lib/constants.js +1 -13
  4. package/lib/document.js +3 -5
  5. package/lib/element/button.js +3 -1
  6. package/lib/element/checkbox.js +6 -5
  7. package/lib/element/input.js +151 -0
  8. package/lib/element/link.js +3 -1
  9. package/lib/element/select.js +6 -41
  10. package/lib/element/textarea.js +151 -0
  11. package/lib/element.js +8 -26
  12. package/lib/example/view/div.js +184 -0
  13. package/lib/example/view.js +3 -66
  14. package/lib/index.js +5 -9
  15. package/lib/mixins/element.js +27 -4
  16. package/lib/mixins/event.js +19 -8
  17. package/lib/mixins/focus.js +45 -0
  18. package/lib/mixins/input.js +21 -13
  19. package/lib/mixins/mouse.js +1 -1
  20. package/lib/mixins/resize.js +2 -34
  21. package/lib/mixins/scroll.js +5 -5
  22. package/lib/mixins/selection.js +46 -2
  23. package/lib/mixins/textElement.js +20 -0
  24. package/lib/textElement.js +4 -5
  25. package/lib/utilities/string.js +2 -3
  26. package/lib/window.js +20 -11
  27. package/package.json +1 -1
  28. package/src/constants.js +0 -3
  29. package/src/document.js +2 -4
  30. package/src/element/button.js +3 -0
  31. package/src/element/checkbox.js +5 -5
  32. package/src/element/input.js +14 -0
  33. package/src/element/link.js +3 -0
  34. package/src/element/select.js +5 -13
  35. package/src/element/textarea.js +14 -0
  36. package/src/element.js +7 -17
  37. package/src/example/view/div.js +40 -0
  38. package/src/example/view.js +4 -66
  39. package/src/index.js +4 -8
  40. package/src/mixins/element.js +6 -6
  41. package/src/mixins/event.js +25 -10
  42. package/src/mixins/focus.js +33 -0
  43. package/src/mixins/input.js +15 -9
  44. package/src/mixins/mouse.js +1 -5
  45. package/src/mixins/resize.js +1 -58
  46. package/src/mixins/scroll.js +3 -3
  47. package/src/mixins/selection.js +35 -2
  48. package/src/mixins/textElement.js +12 -0
  49. package/src/textElement.js +3 -5
  50. package/src/utilities/string.js +1 -3
  51. package/src/window.js +19 -6
  52. package/lib/example/view/checkbox.js +0 -97
  53. package/lib/inputElement/input.js +0 -99
  54. package/lib/inputElement/textarea.js +0 -99
  55. package/lib/inputElement.js +0 -214
  56. package/lib/mixins/change.js +0 -24
  57. package/lib/mixins/window.js +0 -17
  58. package/src/example/view/checkbox.js +0 -10
  59. package/src/inputElement/input.js +0 -7
  60. package/src/inputElement/textarea.js +0 -7
  61. package/src/inputElement.js +0 -34
  62. package/src/mixins/change.js +0 -14
  63. package/src/mixins/window.js +0 -8
package/README.md CHANGED
@@ -98,142 +98,24 @@ const link = new Link("#link", (event, element) => {
98
98
 
99
99
  The `Window` and `Document` classes are not exported, only singletons, hence the lowercase. Note also that if the underlying `window` and `document` global objects are not defined, for whatever reason, then these singletons will also be undefined.
100
100
 
101
- Obviously the list is incomplete. If you want to create other elements, you can extend the `Element` or `InputElement` classes.
102
-
103
- ## Standard methods
104
-
105
- Each class bar the `Window`, `Document` and `TextElement` classes has the following methods. They are taken from the `Element` class and are overridden in many cases, in which case the signatures may change:
106
-
107
- - `getDOMElement()`
108
- - `getOffset()`
109
- - `getBounds()`
110
- - `getWidth(includeBorder = true)`
111
- - `setWidth(width)`
112
- - `getHeight(includeBorder = true)`
113
- - `setHeight(height)`
114
- - `hasAttribute(name)`
115
- - `getAttribute(name)`
116
- - `setAttribute(name, value)`
117
- - `clearAttribute(name)`
118
- - `addAttribute(name, value)`
119
- - `removeAttribute(name)`
120
- - `setClass(className)`
121
- - `addClass(className)`
122
- - `removeClass(className)`
123
- - `toggleClass(className)`
124
- - `hasClass(className)`
125
- - `clearClasses()`
126
- - `appendTo(parentElement)`
127
- - `prependTo(parentElement)`
128
- - `addTo(parentElement)`
129
- - `removeFrom(parentElement)`
130
- - `insertBefore(siblingElement)`
131
- - `insertAfter(siblingElement)`
132
- - `prepend(element)`
133
- - `append(element)`
134
- - `add(element)`
135
- - `insert(element)`
136
- - `remove(element)`
137
- - `mountBefore(siblingElement)`
138
- - `mountAfter(siblingElement)`
139
- - `mount(element)`
140
- - `unmount(element)`
141
- - `show(displayStyle = 'block')`
142
- - `hide()`
143
- - `display(displayStyle)`
144
- - `enable()`
145
- - `disable()`
146
- - `isEnabled()`
147
- - `isDisabled()`
148
- - `isDisplayed()`
149
- - `isShowing()`
150
- - `isHidden()`
151
- - `style(style)`
152
- - `html(html)`
153
- - `css(css)`
154
- - `blur()`
155
- - `focus()`
156
- - `hasFocus()`
157
- - `getParentElement(selector = "*")`
158
- - `getChildElements(selector = "*")`
159
- - `getAscendantElements(selector = "*", height = Inifnity)`
160
- - `getDescendantElements(selector = "*", depth = Infinity)`
161
- - `getNextSiblingElement(selector = "*")`
162
- - `getPreviousSiblingElement(selector = "*")`
163
- - `getScrollTop()`
164
- - `getScrollLeft()`
165
- - `setScrollTop(scrollTop)`
166
- - `setScrollLeft(scrollLeft)`
167
- - `onClick(clickHandler)`
168
- - `offClick(clickHandler)`
169
- - `onKeyUp(keyUpHandler)`
170
- - `offKeyUp(keyUpHandler)`
171
- - `onKeyDown(keyDownHandler)`
172
- - `offKeyDown(keyDownHandler)`
173
- - `onMouseUp(mouseUpHandler)`
174
- - `onMouseDown(mouseDownHandler)`
175
- - `onMouseOver(mouseOverHandler)`
176
- - `onMouseOut(mouseOutHandler)`
177
- - `onMouseMove(mouseMoveHandler)`
178
- - `offMouseUp(mouseUpHandler)`
179
- - `offMouseDown(mouseDownHandler)`
180
- - `offMouseOver(mouseOverHandler)`
181
- - `offMouseOut(mouseOutHandler)`
182
- - `offMouseMove(mouseOverHandler)`
183
- - `onScroll(scrollHandler)`
184
- - `offScroll(scrollHandler)`
185
- - `onResize(resizeHandler)`
186
- - `offResize(resizeHandler)`
187
- - `onEvent(eventTypes, handler)`
188
- - `offEvent(eventTypes, handler)`
189
- - `onCustomEvent(customEventTypes, handler)`
190
- - `offCustomEvent(customEventTypes, handler)`
191
-
192
- Please note the following:
193
-
194
- * The `setWidth()` and `setHeight()` methods take number arguments and prepend `px` to them. If you want to set the widths and heights of elements using something other than pixels, use the `style()` method.
195
-
196
- * The `html()` and `css()` methods allow you to both get and set HTML and CSS, respectively. Their functionality is based on the jQuery methods of the same name. The `style()` method behaves similarly.
197
-
198
- * The `blur()` and `focus()` events are defined on all elements, however they will not have an effect if the element in question cannot have the focus.
199
-
200
- * The `onResize()` and `offResize()` methods are similarly defined on all elements, by way of a mixin. The resize functionality relies on attaching a child object to the element in question and therefore will not work for elements which cannot have child elements. In these cases, the `onResize()` and `offResize()` methods simply do nothing. Also, the aforementioned child object is given amongst others the style `position: relative` and therefore the element in question must be given either the `position: relative` or the `position: absolute` style in order for this trick to work.
201
-
202
- The `Input` and `Textarea` classes also have the following methods, taken from the `InputElement` class:
203
-
204
- - `onBlur(blurHandler)`
205
- - `offBlur(blurHandler)`
206
- - `onFocus(focusHandler)`
207
- - `offFocus(focusHandler)`
208
- - `onChange(changeHandler)`
209
- - `offChange(changeHandler)`
210
- - `getValue()`
211
- - `getSelectionStart()`
212
- - `getSelectionEnd()`
213
- - `isReadOnly()`
214
- - `setValue(value)`
215
- - `setSelectionStart(selectionStart)`
216
- - `setSelectionEnd(selectionEnd)`
217
- - `setReadOnly(readOnly)`
218
- - `select()`
219
-
220
- The `TextElement` class has the following methods only:
221
-
222
- - `getText()`
223
- - `setText(text)`
224
- - `getOffset()`
225
- - `getBounds()`
226
- - `getWidth()`
227
- - `getHeight()`
228
- - `prependTo(parentElement)`
229
- - `appendTo(parentElement)`
230
- - `addTo(parentElement)`
231
- - `removeFrom(parentElement)`
232
- - `insertBefore(siblingElement)`
233
- - `insertAfter(siblingElement)`
234
- - `remove()`
235
-
236
- Each of the supported elements has methods specific to its function, check the source for details, especially for the `window` and `document` singletons.
101
+ Obviously the list is incomplete. If you want to create other elements, you can extend the `Element` class.
102
+
103
+ ## API
104
+
105
+ Please see the source and the examples for guidance. The following files will be helpful:
106
+
107
+ - `element.js`
108
+ - `window.js`
109
+ - `document.js`
110
+ - `textElement.js`
111
+
112
+ Also the mixins files will be useful Here are some of them:
113
+
114
+ - `mixins/event.js`
115
+ - `mixins/element.js`
116
+ - `mixins/customEvent.js`
117
+
118
+ Perhaps an API reference will follow someday. The examples in the other Easy projects, given close to the top of this file, really are the best place to look.
237
119
 
238
120
  ## Building
239
121