uicore-ts 1.1.5 → 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.5",
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",
@@ -24,7 +24,6 @@ export class UIDateTimeInput extends UIView {
24
24
  })
25
25
 
26
26
 
27
- // @ts-ignore
28
27
  override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<UIDateTimeInput> {
29
28
  return super.controlEventTargetAccumulator as any
30
29
  }
@@ -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,11 +46,10 @@ export class UITextField extends UITextView {
46
46
 
47
47
  })
48
48
 
49
- // @ts-ignore
50
- public override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<UITextField> {
51
- return super.controlEventTargetAccumulator as any
52
- }
53
49
 
50
+ override get controlEventTargetAccumulator(): UIViewAddControlEventTargetObject<typeof UITextField> {
51
+ return (super.controlEventTargetAccumulator as any)
52
+ }
54
53
 
55
54
  public override get viewHTMLElement() {
56
55
  return this._viewHTMLElement
package/scripts/UIView.ts CHANGED
@@ -5,21 +5,7 @@ import { UICore } from "./UICore"
5
5
  import "./UICoreExtensions"
6
6
  import type { UIDialogView } from "./UIDialogView"
7
7
  import { UILocalizedTextObject } from "./UIInterfaces"
8
- import {
9
- FIRST,
10
- FIRST_OR_NIL,
11
- IF,
12
- IS,
13
- IS_DEFINED,
14
- IS_NIL,
15
- IS_NOT,
16
- nil,
17
- NO,
18
- RETURNER,
19
- UIFunctionCall,
20
- UIObject,
21
- YES
22
- } from "./UIObject"
8
+ import { FIRST, FIRST_OR_NIL, IF, IS, IS_DEFINED, IS_NIL, IS_NOT, nil, NO, RETURNER, UIObject, YES } from "./UIObject"
23
9
  import { UIPoint } from "./UIPoint"
24
10
  import { UIRectangle } from "./UIRectangle"
25
11
  import { UIViewController } from "./UIViewController"
@@ -125,20 +111,14 @@ type Mutable<T> = {
125
111
  -readonly [P in keyof T]: T[P]
126
112
  };
127
113
 
128
- // export type UIViewAddControlEventTargetObject<T extends { controlEvent: Record<string, any> }> = Mutable<{
129
- //
130
- // [K in keyof T["controlEvent"]]: ((
131
- // sender: UIView,
132
- // event: Event
133
- // ) => void) & Partial<UIViewAddControlEventTargetObject<T>>
134
- //
135
- // }>
136
-
137
114
  export type UIViewAddControlEventTargetObject<T extends { controlEvent: Record<string, any> }> = Mutable<{
138
- [K in keyof T["controlEvent"]]: UIViewAddControlEventTargetObject<T> & (
139
- (handler: (sender: T, event: Event) => void) => void
140
- ) & UIFunctionCall<(handler: (sender: T, event: Event) => void) => void>
141
- }>;
115
+
116
+ [K in keyof T["controlEvent"]]: ((
117
+ sender: UIView,
118
+ event: Event
119
+ ) => void) & Partial<UIViewAddControlEventTargetObject<T>>
120
+
121
+ }>
142
122
 
143
123
 
144
124
  interface Constraint {
@@ -2187,8 +2167,8 @@ export class UIView extends UIObject {
2187
2167
 
2188
2168
  }
2189
2169
 
2190
- this.controlEventTargetAccumulator.PointerDrag(movementFunction)
2191
- this.controlEventTargetAccumulator.PointerUp.PointerCancel(movementStopFunction)
2170
+ this.controlEventTargetAccumulator.PointerDrag = movementFunction
2171
+ this.controlEventTargetAccumulator.PointerUp.PointerCancel = movementStopFunction
2192
2172
 
2193
2173
  //UIObject.configureWithObject(overlayElement, { remove: EXTEND(() => cleanupFunction()) })
2194
2174
 
@@ -2403,8 +2383,8 @@ export class UIView extends UIObject {
2403
2383
  shouldCallPointerHover: async () => YES,
2404
2384
  pausesPointerEvents: YES
2405
2385
  })
2406
- leftEdge.controlEventTargetAccumulator.PointerDrag(PointerXDragFunction.bind(this, 1))
2407
- leftEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2386
+ leftEdge.controlEventTargetAccumulator.PointerDrag = PointerXDragFunction.bind(this, 1)
2387
+ leftEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2408
2388
 
2409
2389
  const rightEdge = new UIView().configuredWithObject({
2410
2390
  _viewHTMLElement: {
@@ -2424,8 +2404,8 @@ export class UIView extends UIObject {
2424
2404
  shouldCallPointerHover: async () => YES,
2425
2405
  pausesPointerEvents: YES
2426
2406
  })
2427
- rightEdge.controlEventTargetAccumulator.PointerDrag(PointerXDragFunction.bind(this, 0))
2428
- rightEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2407
+ rightEdge.controlEventTargetAccumulator.PointerDrag = PointerXDragFunction.bind(this, 0)
2408
+ rightEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2429
2409
 
2430
2410
  // noinspection JSSuspiciousNameCombination
2431
2411
  const bottomEdge = new UIView().configuredWithObject({
@@ -2446,8 +2426,8 @@ export class UIView extends UIObject {
2446
2426
  shouldCallPointerHover: async () => YES,
2447
2427
  pausesPointerEvents: YES
2448
2428
  })
2449
- bottomEdge.controlEventTargetAccumulator.PointerDrag(PointerYDragFunction.bind(this, 0))
2450
- bottomEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2429
+ bottomEdge.controlEventTargetAccumulator.PointerDrag = PointerYDragFunction.bind(this, 0)
2430
+ bottomEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2451
2431
 
2452
2432
  // noinspection JSSuspiciousNameCombination
2453
2433
  const topEdge = new UIView().configuredWithObject({
@@ -2468,8 +2448,8 @@ export class UIView extends UIObject {
2468
2448
  shouldCallPointerHover: async () => YES,
2469
2449
  pausesPointerEvents: YES
2470
2450
  })
2471
- topEdge.controlEventTargetAccumulator.PointerDrag(PointerYDragFunction.bind(this, 1))
2472
- topEdge.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2451
+ topEdge.controlEventTargetAccumulator.PointerDrag = PointerYDragFunction.bind(this, 1)
2452
+ topEdge.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2473
2453
 
2474
2454
 
2475
2455
  const pointerDragTLFunction = (sender: UIView, event: Event) => {
@@ -2497,8 +2477,8 @@ export class UIView extends UIObject {
2497
2477
  shouldCallPointerHover: async () => YES,
2498
2478
  pausesPointerEvents: YES
2499
2479
  })
2500
- topLeftCornerTop.controlEventTargetAccumulator.PointerDrag(pointerDragTLFunction)
2501
- topLeftCornerTop.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2480
+ topLeftCornerTop.controlEventTargetAccumulator.PointerDrag = pointerDragTLFunction
2481
+ topLeftCornerTop.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2502
2482
 
2503
2483
  const topLeftCornerLeft = new UIView().configuredWithObject({
2504
2484
  _viewHTMLElement: {
@@ -2519,8 +2499,8 @@ export class UIView extends UIObject {
2519
2499
  shouldCallPointerHover: async () => YES,
2520
2500
  pausesPointerEvents: YES
2521
2501
  })
2522
- topLeftCornerLeft.controlEventTargetAccumulator.PointerDrag(pointerDragTLFunction)
2523
- topLeftCornerLeft.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2502
+ topLeftCornerLeft.controlEventTargetAccumulator.PointerDrag = pointerDragTLFunction
2503
+ topLeftCornerLeft.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2524
2504
 
2525
2505
 
2526
2506
  const pointerDragBLFunction = (sender: UIView, event: Event) => {
@@ -2547,8 +2527,8 @@ export class UIView extends UIObject {
2547
2527
  shouldCallPointerHover: async () => YES,
2548
2528
  pausesPointerEvents: YES
2549
2529
  })
2550
- bottomLeftCornerLeft.controlEventTargetAccumulator.PointerDrag(pointerDragBLFunction)
2551
- bottomLeftCornerLeft.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2530
+ bottomLeftCornerLeft.controlEventTargetAccumulator.PointerDrag = pointerDragBLFunction
2531
+ bottomLeftCornerLeft.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2552
2532
 
2553
2533
  // noinspection JSSuspiciousNameCombination
2554
2534
  const bottomLeftCornerBottom = new UIView().configuredWithObject({
@@ -2570,8 +2550,8 @@ export class UIView extends UIObject {
2570
2550
  shouldCallPointerHover: async () => YES,
2571
2551
  pausesPointerEvents: YES
2572
2552
  })
2573
- bottomLeftCornerBottom.controlEventTargetAccumulator.PointerDrag(pointerDragBLFunction)
2574
- bottomLeftCornerBottom.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2553
+ bottomLeftCornerBottom.controlEventTargetAccumulator.PointerDrag = pointerDragBLFunction
2554
+ bottomLeftCornerBottom.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2575
2555
 
2576
2556
 
2577
2557
  const pointerDragBRFunction = (sender: UIView, event: Event) => {
@@ -2599,8 +2579,8 @@ export class UIView extends UIObject {
2599
2579
  shouldCallPointerHover: async () => YES,
2600
2580
  pausesPointerEvents: YES
2601
2581
  })
2602
- bottomRightCornerBottom.controlEventTargetAccumulator.PointerDrag(pointerDragBRFunction)
2603
- bottomRightCornerBottom.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2582
+ bottomRightCornerBottom.controlEventTargetAccumulator.PointerDrag = pointerDragBRFunction
2583
+ bottomRightCornerBottom.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2604
2584
 
2605
2585
  const bottomRightCornerRight = new UIView().configuredWithObject({
2606
2586
  _viewHTMLElement: {
@@ -2621,8 +2601,8 @@ export class UIView extends UIObject {
2621
2601
  shouldCallPointerHover: async () => YES,
2622
2602
  pausesPointerEvents: YES
2623
2603
  })
2624
- bottomRightCornerRight.controlEventTargetAccumulator.PointerDrag(pointerDragBRFunction)
2625
- bottomRightCornerRight.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2604
+ bottomRightCornerRight.controlEventTargetAccumulator.PointerDrag = pointerDragBRFunction
2605
+ bottomRightCornerRight.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2626
2606
 
2627
2607
 
2628
2608
  const pointerDragTRFunction = (sender: UIView, event: Event) => {
@@ -2649,8 +2629,8 @@ export class UIView extends UIObject {
2649
2629
  shouldCallPointerHover: async () => YES,
2650
2630
  pausesPointerEvents: YES
2651
2631
  })
2652
- topRightCornerRight.controlEventTargetAccumulator.PointerDrag(pointerDragTRFunction)
2653
- topRightCornerRight.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2632
+ topRightCornerRight.controlEventTargetAccumulator.PointerDrag = pointerDragTRFunction
2633
+ topRightCornerRight.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2654
2634
 
2655
2635
  // noinspection JSSuspiciousNameCombination
2656
2636
  const topRightCornerTop = new UIView().configuredWithObject({
@@ -2672,8 +2652,8 @@ export class UIView extends UIObject {
2672
2652
  shouldCallPointerHover: async () => YES,
2673
2653
  pausesPointerEvents: YES
2674
2654
  })
2675
- topRightCornerTop.controlEventTargetAccumulator.PointerDrag(pointerDragTRFunction)
2676
- topRightCornerTop.controlEventTargetAccumulator.PointerUp(pointerUpFunction)
2655
+ topRightCornerTop.controlEventTargetAccumulator.PointerDrag = pointerDragTRFunction
2656
+ topRightCornerTop.controlEventTargetAccumulator.PointerUp = pointerUpFunction
2677
2657
 
2678
2658
 
2679
2659
  const views = [
@@ -3217,19 +3197,6 @@ export class UIView extends UIObject {
3217
3197
 
3218
3198
  return result
3219
3199
 
3220
- },
3221
- apply: (_target, _thisArg, args) => {
3222
-
3223
- const handler = args[0];
3224
- if (typeof handler === 'function') {
3225
- this.addTargetForControlEvents(eventKeys, handler);
3226
- }
3227
- else {
3228
- throw "Handler must be a function, not " + handler
3229
- }
3230
-
3231
- return true
3232
-
3233
3200
  },
3234
3201
  set: (target, key: string, value, _receiver) => {
3235
3202