uicore-ts 1.1.1 → 1.1.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uicore-ts",
3
- "version": "1.1.1",
3
+ "version": "1.1.6",
4
4
  "description": "UICore is a library to build native-like user interfaces using pure Typescript. No HTML is needed at all. Components are described as TS classes and all user interactions are handled explicitly. This library is strongly inspired by the UIKit framework that is used in IOS. In addition, UICore has tools to handle URL based routing, array sorting and filtering and adds a number of other utilities for convenience.",
5
5
  "main": "compiledScripts/index.js",
6
6
  "types": "compiledScripts/index.d.ts",
@@ -3,7 +3,7 @@
3
3
  if ("contains" in Array.prototype == false) {
4
4
 
5
5
  // @ts-ignore
6
- Array.prototype.contains = function (this: Array, element) {
6
+ Array.prototype.contains = function (element) {
7
7
 
8
8
  var result = (this.indexOf(element) != -1)
9
9
  return result
@@ -15,7 +15,7 @@ if ("contains" in Array.prototype == false) {
15
15
  if ("contains" in String.prototype == false) {
16
16
 
17
17
  // @ts-ignore
18
- String.prototype.contains = function (this: string, string) {
18
+ String.prototype.contains = function (string) {
19
19
 
20
20
  var result = (this.indexOf(string) != -1)
21
21
  return result
@@ -15,9 +15,7 @@ export class UILinkButton extends UILink {
15
15
  this.addSubview(this.button)
16
16
 
17
17
  this.style.position = "absolute"
18
- this.button.controlEventTargetAccumulator.EnterDown.PointerUpInside(
19
- () => window.location = this.target as any
20
- )
18
+ this.button.controlEventTargetAccumulator.EnterDown.PointerUpInside = () => window.location = this.target as any
21
19
 
22
20
  }
23
21
 
@@ -46,10 +46,10 @@ export class UITextField extends UITextView {
46
46
 
47
47
  })
48
48
 
49
- public override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<UITextField> {
50
- return super.controlEventTargetAccumulator as any
51
- }
52
49
 
50
+ override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<typeof UITextField> {
51
+ return (super.controlEventTargetAccumulator as any)
52
+ }
53
53
 
54
54
  public override get viewHTMLElement() {
55
55
  return this._viewHTMLElement
package/scripts/UIView.ts CHANGED
@@ -111,20 +111,14 @@ type Mutable<T> = {
111
111
  -readonly [P in keyof T]: T[P]
112
112
  };
113
113
 
114
- // export type UIViewAddControlEventTargetObject<T extends { controlEvent: Record<string, any> }> = Mutable<{
115
- //
116
- // [K in keyof T["controlEvent"]]: ((
117
- // sender: UIView,
118
- // event: Event
119
- // ) => void) & Partial<UIViewAddControlEventTargetObject<T>>
120
- //
121
- // }>
122
-
123
114
  export type UIViewAddControlEventTargetObject<T extends { controlEvent: Record<string, any> }> = Mutable<{
124
- [K in keyof T["controlEvent"]]: UIViewAddControlEventTargetObject<T> & (
125
- (handler: (sender: T, event: Event) => void) => void
126
- );
127
- }>;
115
+
116
+ [K in keyof T["controlEvent"]]: ((
117
+ sender: UIView,
118
+ event: Event
119
+ ) => void) & Partial<UIViewAddControlEventTargetObject<T>>
120
+
121
+ }>
128
122
 
129
123
 
130
124
  interface Constraint {
@@ -2173,8 +2167,8 @@ export class UIView extends UIObject {
2173
2167
 
2174
2168
  }
2175
2169
 
2176
- this.controlEventTargetAccumulator.PointerDrag(movementFunction)
2177
- this.controlEventTargetAccumulator.PointerUp.PointerCancel(movementStopFunction)
2170
+ this.controlEventTargetAccumulator.PointerDrag = movementFunction
2171
+ this.controlEventTargetAccumulator.PointerUp.PointerCancel = movementStopFunction
2178
2172
 
2179
2173
  //UIObject.configureWithObject(overlayElement, { remove: EXTEND(() => cleanupFunction()) })
2180
2174
 
@@ -2389,8 +2383,8 @@ export class UIView extends UIObject {
2389
2383
  shouldCallPointerHover: async () => YES,
2390
2384
  pausesPointerEvents: YES
2391
2385
  })
2392
- leftEdge.controlEventTargetAccumulator.PointerDrag(PointerXDragFunction.bind(this, 1))
2393
- leftEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2386
+ leftEdge.controlEventTargetAccumulator.PointerDrag = PointerXDragFunction.bind(this, 1)
2387
+ leftEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2394
2388
 
2395
2389
  const rightEdge = new UIView().configuredWithObject({
2396
2390
  _viewHTMLElement: {
@@ -2410,8 +2404,8 @@ export class UIView extends UIObject {
2410
2404
  shouldCallPointerHover: async () => YES,
2411
2405
  pausesPointerEvents: YES
2412
2406
  })
2413
- rightEdge.controlEventTargetAccumulator.PointerDrag(PointerXDragFunction.bind(this, 0))
2414
- rightEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2407
+ rightEdge.controlEventTargetAccumulator.PointerDrag = PointerXDragFunction.bind(this, 0)
2408
+ rightEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2415
2409
 
2416
2410
  // noinspection JSSuspiciousNameCombination
2417
2411
  const bottomEdge = new UIView().configuredWithObject({
@@ -2432,8 +2426,8 @@ export class UIView extends UIObject {
2432
2426
  shouldCallPointerHover: async () => YES,
2433
2427
  pausesPointerEvents: YES
2434
2428
  })
2435
- bottomEdge.controlEventTargetAccumulator.PointerDrag(PointerYDragFunction.bind(this, 0))
2436
- bottomEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2429
+ bottomEdge.controlEventTargetAccumulator.PointerDrag = PointerYDragFunction.bind(this, 0)
2430
+ bottomEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2437
2431
 
2438
2432
  // noinspection JSSuspiciousNameCombination
2439
2433
  const topEdge = new UIView().configuredWithObject({
@@ -2454,8 +2448,8 @@ export class UIView extends UIObject {
2454
2448
  shouldCallPointerHover: async () => YES,
2455
2449
  pausesPointerEvents: YES
2456
2450
  })
2457
- topEdge.controlEventTargetAccumulator.PointerDrag(PointerYDragFunction.bind(this, 1))
2458
- topEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2451
+ topEdge.controlEventTargetAccumulator.PointerDrag = PointerYDragFunction.bind(this, 1)
2452
+ topEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2459
2453
 
2460
2454
 
2461
2455
  const pointerDragTLFunction = (sender: UIView, event: Event) => {
@@ -2483,8 +2477,8 @@ export class UIView extends UIObject {
2483
2477
  shouldCallPointerHover: async () => YES,
2484
2478
  pausesPointerEvents: YES
2485
2479
  })
2486
- topLeftCornerTop.controlEventTargetAccumulator.PointerDrag(pointerDragTLFunction)
2487
- topLeftCornerTop.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2480
+ topLeftCornerTop.controlEventTargetAccumulator.PointerDrag = pointerDragTLFunction
2481
+ topLeftCornerTop.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2488
2482
 
2489
2483
  const topLeftCornerLeft = new UIView().configuredWithObject({
2490
2484
  _viewHTMLElement: {
@@ -2505,8 +2499,8 @@ export class UIView extends UIObject {
2505
2499
  shouldCallPointerHover: async () => YES,
2506
2500
  pausesPointerEvents: YES
2507
2501
  })
2508
- topLeftCornerLeft.controlEventTargetAccumulator.PointerDrag(pointerDragTLFunction)
2509
- topLeftCornerLeft.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2502
+ topLeftCornerLeft.controlEventTargetAccumulator.PointerDrag = pointerDragTLFunction
2503
+ topLeftCornerLeft.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2510
2504
 
2511
2505
 
2512
2506
  const pointerDragBLFunction = (sender: UIView, event: Event) => {
@@ -2533,8 +2527,8 @@ export class UIView extends UIObject {
2533
2527
  shouldCallPointerHover: async () => YES,
2534
2528
  pausesPointerEvents: YES
2535
2529
  })
2536
- bottomLeftCornerLeft.controlEventTargetAccumulator.PointerDrag(pointerDragBLFunction)
2537
- bottomLeftCornerLeft.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2530
+ bottomLeftCornerLeft.controlEventTargetAccumulator.PointerDrag = pointerDragBLFunction
2531
+ bottomLeftCornerLeft.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2538
2532
 
2539
2533
  // noinspection JSSuspiciousNameCombination
2540
2534
  const bottomLeftCornerBottom = new UIView().configuredWithObject({
@@ -2556,8 +2550,8 @@ export class UIView extends UIObject {
2556
2550
  shouldCallPointerHover: async () => YES,
2557
2551
  pausesPointerEvents: YES
2558
2552
  })
2559
- bottomLeftCornerBottom.controlEventTargetAccumulator.PointerDrag(pointerDragBLFunction)
2560
- bottomLeftCornerBottom.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2553
+ bottomLeftCornerBottom.controlEventTargetAccumulator.PointerDrag = pointerDragBLFunction
2554
+ bottomLeftCornerBottom.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2561
2555
 
2562
2556
 
2563
2557
  const pointerDragBRFunction = (sender: UIView, event: Event) => {
@@ -2585,8 +2579,8 @@ export class UIView extends UIObject {
2585
2579
  shouldCallPointerHover: async () => YES,
2586
2580
  pausesPointerEvents: YES
2587
2581
  })
2588
- bottomRightCornerBottom.controlEventTargetAccumulator.PointerDrag(pointerDragBRFunction)
2589
- bottomRightCornerBottom.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2582
+ bottomRightCornerBottom.controlEventTargetAccumulator.PointerDrag = pointerDragBRFunction
2583
+ bottomRightCornerBottom.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2590
2584
 
2591
2585
  const bottomRightCornerRight = new UIView().configuredWithObject({
2592
2586
  _viewHTMLElement: {
@@ -2607,8 +2601,8 @@ export class UIView extends UIObject {
2607
2601
  shouldCallPointerHover: async () => YES,
2608
2602
  pausesPointerEvents: YES
2609
2603
  })
2610
- bottomRightCornerRight.controlEventTargetAccumulator.PointerDrag(pointerDragBRFunction)
2611
- bottomRightCornerRight.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2604
+ bottomRightCornerRight.controlEventTargetAccumulator.PointerDrag = pointerDragBRFunction
2605
+ bottomRightCornerRight.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2612
2606
 
2613
2607
 
2614
2608
  const pointerDragTRFunction = (sender: UIView, event: Event) => {
@@ -2635,8 +2629,8 @@ export class UIView extends UIObject {
2635
2629
  shouldCallPointerHover: async () => YES,
2636
2630
  pausesPointerEvents: YES
2637
2631
  })
2638
- topRightCornerRight.controlEventTargetAccumulator.PointerDrag(pointerDragTRFunction)
2639
- topRightCornerRight.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2632
+ topRightCornerRight.controlEventTargetAccumulator.PointerDrag = pointerDragTRFunction
2633
+ topRightCornerRight.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2640
2634
 
2641
2635
  // noinspection JSSuspiciousNameCombination
2642
2636
  const topRightCornerTop = new UIView().configuredWithObject({
@@ -2658,8 +2652,8 @@ export class UIView extends UIObject {
2658
2652
  shouldCallPointerHover: async () => YES,
2659
2653
  pausesPointerEvents: YES
2660
2654
  })
2661
- topRightCornerTop.controlEventTargetAccumulator.PointerDrag(pointerDragTRFunction)
2662
- topRightCornerTop.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2655
+ topRightCornerTop.controlEventTargetAccumulator.PointerDrag = pointerDragTRFunction
2656
+ topRightCornerTop.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2663
2657
 
2664
2658
 
2665
2659
  const views = [
@@ -3203,19 +3197,6 @@ export class UIView extends UIObject {
3203
3197
 
3204
3198
  return result
3205
3199
 
3206
- },
3207
- apply: (_target, _thisArg, args) => {
3208
-
3209
- const handler = args[0];
3210
- if (typeof handler === 'function') {
3211
- this.addTargetForControlEvents(eventKeys, handler);
3212
- }
3213
- else {
3214
- throw "Handler must be a function, not " + handler
3215
- }
3216
-
3217
- return true
3218
-
3219
3200
  },
3220
3201
  set: (target, key: string, value, _receiver) => {
3221
3202