uicore-ts 1.0.218 → 1.0.222

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.
@@ -65,6 +65,9 @@ export declare class UIObject {
65
65
  configuredWithObject(object: UIInitializerObject<this>): this;
66
66
  static configureWithObject<TargetObjectType extends object, ConfigurationObjectType extends UIInitializerObject<TargetObjectType>>(configurationTarget: TargetObjectType, object: ConfigurationObjectType): ConfigurationObjectType;
67
67
  static configuredWithObject<T extends object>(configurationTarget: T, object: UIInitializerObject<T>): T;
68
+ get methods(): {
69
+ [P in keyof this]: this[P] extends (...args: any) => any ? this[P] : never;
70
+ };
68
71
  performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T;
69
72
  performingFunctionWithSelf(functionToPerform: (self: this) => void): this;
70
73
  performFunctionWithDelay(delay: number, functionToCall: Function): void;
@@ -429,6 +429,19 @@ class UIObject {
429
429
  this.configureWithObject(configurationTarget, object);
430
430
  return configurationTarget;
431
431
  }
432
+ get methods() {
433
+ const thisObject = this;
434
+ const result = new Proxy({ "name": "BoundFunctionRetriever" }, {
435
+ get(target, key) {
436
+ const thisObjectElement = thisObject[key];
437
+ if (thisObjectElement instanceof Function) {
438
+ return thisObjectElement.bind(thisObject);
439
+ }
440
+ return void 0;
441
+ }
442
+ });
443
+ return result;
444
+ }
432
445
  performFunctionWithSelf(functionToPerform) {
433
446
  return functionToPerform(this);
434
447
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIObject.ts"],
4
- "sourcesContent": ["import { UICoreExtensionValueObject } from \"./UICoreExtensionValueObject\"\nimport { UITimer } from \"./UITimer\"\n\n\nfunction NilFunction() {\n return nil\n}\n\n\n// The nil object avoids unnecessary crashes by allowing you to call any function or access any variable on it, returning nil\nexport var nil: any = new Proxy(Object.assign(NilFunction, { \"class\": null, \"className\": \"Nil\" }), {\n get(target, name) {\n if (name == Symbol.toPrimitive) {\n return function (hint: string) {\n if (hint == \"number\") {\n return 0\n }\n if (hint == \"string\") {\n return \"\"\n }\n return false\n }\n }\n if (name == \"toString\") {\n return function toString() {\n return \"\"\n }\n }\n return NilFunction()\n },\n set() {\n return NilFunction()\n }\n})\n\n\nexport function wrapInNil<T>(object?: T): T {\n let result = FIRST_OR_NIL(object)\n if (object instanceof Object && !(object instanceof Function)) {\n result = new Proxy(object as Object & T, {\n get(target, name) {\n if (name == \"wrapped_nil_target\") {\n return target\n }\n const value = Reflect.get(target, name)\n if (typeof value === \"object\") {\n return wrapInNil(value)\n }\n if (IS_NOT_LIKE_NULL(value)) {\n return value\n }\n return nil\n },\n set(target: Record<string, any> & T, name: string, value: any) {\n if (IS(target)) {\n // @ts-ignore\n target[name] = value\n }\n return YES\n }\n })\n }\n return result\n}\n\n\nexport const YES = true\nexport const NO = false\n\nexport function IS<T>(object: T | undefined | null | false): object is T {\n if (object && object !== nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT(object: any): object is undefined | null | false {\n return !IS(object)\n}\n\nexport function IS_DEFINED<T>(object: T | undefined): object is T {\n if (object != undefined) {\n return YES\n }\n return NO\n}\n\nexport function IS_UNDEFINED(object: any): object is undefined {\n return !IS_DEFINED(object)\n}\n\nexport function IS_NIL(object: any): object is typeof nil {\n if (object === nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT_NIL<T>(object: T | undefined | null): object is T | undefined | null {\n return !IS_NIL(object)\n}\n\n\nexport function IS_LIKE_NULL(object: any): object is undefined | null {\n return (IS_UNDEFINED(object) || IS_NIL(object) || object == null)\n}\n\nexport function IS_NOT_LIKE_NULL<T>(object: T | null | undefined): object is T {\n return !IS_LIKE_NULL(object)\n}\n\n\nexport function IS_AN_EMAIL_ADDRESS(email: string) {\n const re = /\\S+@\\S+\\.\\S+/\n return re.test(email)\n}\n\n\nexport function FIRST_OR_NIL<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || nil\n}\n\nexport function FIRST<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || IF(IS_DEFINED(objects.lastElement))(RETURNER(objects.lastElement))()\n}\n\n\nexport function MAKE_ID(randomPartLength = 15) {\n let result = \"\"\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n for (let i = 0; i < randomPartLength; i++) {\n result = result + characters.charAt(Math.floor(Math.random() * characters.length))\n }\n result = result + Date.now()\n return result\n}\n\n\nexport function RETURNER<T>(value?: T) {\n return (..._objects: any[]) => value\n}\n\n\nexport type UIIFBlockReceiver<T> = (functionToCall: () => any) => UIIFEvaluator<T>;\nexport type UIIFEvaluatorBase<T> = () => T;\n\n\nexport interface UIIFEvaluator<T> extends UIIFEvaluatorBase<T> {\n ELSE_IF: (otherValue: any) => UIIFBlockReceiver<T>;\n ELSE: (functionToCall: () => any) => T;\n}\n\n\nexport function IF<T = any>(value: any): UIIFBlockReceiver<T> {\n \n let thenFunction = nil\n let elseFunction = nil\n \n const result: any = function (functionToCall: () => T) {\n thenFunction = functionToCall\n return result.evaluateConditions\n }\n \n result.evaluateConditions = function () {\n if (IS(value)) {\n return thenFunction()\n }\n return elseFunction()\n }\n \n result.evaluateConditions.ELSE_IF = function (otherValue: any) {\n \n const functionResult = IF(otherValue) as (UIIFBlockReceiver<T> & { evaluateConditions: UIIFEvaluator<T> })\n elseFunction = functionResult.evaluateConditions\n \n const functionResultEvaluateConditionsFunction: any = function () {\n return result.evaluateConditions()\n }\n functionResultEvaluateConditionsFunction.ELSE_IF = functionResult.evaluateConditions.ELSE_IF\n functionResultEvaluateConditionsFunction.ELSE = functionResult.evaluateConditions.ELSE\n \n functionResult.evaluateConditions = functionResultEvaluateConditionsFunction\n \n return functionResult\n \n }\n \n result.evaluateConditions.ELSE = function (functionToCall: () => T) {\n elseFunction = functionToCall\n return result.evaluateConditions()\n }\n \n return result\n}\n\n\nexport class UIFunctionCall<T extends (...args: any) => any> {\n \n isAUIFunctionCallObject = YES\n parameters: Parameters<T>[]\n \n constructor(...parameters: Parameters<T>) {\n this.parameters = parameters\n }\n \n callFunction(functionToCall: T) {\n const parameters = this.parameters\n functionToCall(...parameters)\n }\n \n}\n\n\nexport function CALL<T extends (...args: any) => any>(...objects: Parameters<T>) {\n return new UIFunctionCall<T>(...objects)\n}\n\n\nexport class UIFunctionExtender<T extends (...args: any) => any> {\n \n isAUIFunctionExtenderObject = YES\n extendingFunction: T\n \n constructor(extendingFunction: T) {\n this.extendingFunction = extendingFunction\n }\n \n extendedFunction(functionToExtend: T) {\n const extendingFunction = this.extendingFunction\n \n function extendedFunction(this: any, ...objects: any[]) {\n const boundFunctionToExtend = functionToExtend.bind(this)\n boundFunctionToExtend(...objects)\n const boundExtendingFunction = extendingFunction.bind(this)\n boundExtendingFunction(...objects)\n }\n \n extendedFunction.extendedFunction = functionToExtend\n return extendedFunction\n }\n \n}\n\n\nexport function EXTEND<T extends (...args: any) => any>(extendingFunction: T) {\n return new UIFunctionExtender(extendingFunction)\n}\n\n\nexport class UILazyPropertyValue<T> {\n \n isAUILazyPropertyValueObject = YES\n initFunction: () => T\n \n constructor(initFunction: () => T) {\n this.initFunction = initFunction\n }\n \n setLazyPropertyValue(key: string, target: object) {\n \n let isValueInitialized = NO\n \n // property value\n let _value = nil\n \n const initValue = () => {\n _value = this.initFunction()\n isValueInitialized = YES\n this.initFunction = nil\n }\n \n // @ts-ignore\n if (delete target[key]) {\n \n // Create new property with getter and setter\n Object.defineProperty(target, key, {\n get: function () {\n if (IS_NOT(isValueInitialized)) {\n initValue()\n }\n return _value\n },\n set: function (newValue) {\n _value = newValue\n },\n enumerable: true,\n configurable: true\n })\n \n }\n \n }\n \n}\n\n\nexport function LAZY_VALUE<T>(initFunction: () => T) {\n return new UILazyPropertyValue(initFunction)\n}\n\n\nexport type UIInitializerObject<T> = {\n \n [P in keyof T]?:\n //T[P] extends (infer U)[] ? UIInitializerObject<U>[] :\n T[P] extends (...args: any) => any ? UIFunctionCall<T[P]> | UIFunctionExtender<T[P]> | T[P] :\n T[P] extends object ? UIInitializerObject<T[P]> | UILazyPropertyValue<T[P]> :\n T[P];\n \n}\n\n\nexport class UIObject {\n \n constructor() {\n \n // Do something here if needed\n \n }\n \n public get class(): any {\n return Object.getPrototypeOf(this).constructor\n }\n \n public get superclass(): any {\n return Object.getPrototypeOf(Object.getPrototypeOf(this)).constructor\n }\n \n isKindOfClass(classObject: any) {\n if (this.isMemberOfClass(classObject)) {\n return YES\n }\n for (let superclassObject = this.superclass; IS(superclassObject); superclassObject = superclassObject.superclass) {\n if (superclassObject == classObject) {\n return YES\n }\n }\n return NO\n }\n \n \n isMemberOfClass(classObject: any) {\n return (this.class == classObject)\n }\n \n public static wrapObject<T>(object: T): UIObject & T {\n if (IS_NOT(object)) {\n return nil\n }\n \n if ((object as any) instanceof UIObject) {\n // @ts-ignore\n return object\n }\n \n return Object.assign(new UIObject(), object)\n }\n \n \n valueForKey(key: string) {\n // @ts-ignore\n return this[key]\n }\n \n valueForKeyPath(keyPath: string): any {\n return UIObject.valueForKeyPath(keyPath, this)\n }\n \n static valueForKeyPath(keyPath: string, object: any): any {\n \n if (IS_NOT(keyPath)) {\n return object\n }\n \n const keys = keyPath.split(\".\")\n let currentObject = object\n \n for (let i = 0; i < keys.length; i++) {\n \n const key = keys[i]\n \n if (key.substring(0, 2) == \"[]\") {\n \n // This next object will be an array and the rest of the keys need to be run for each of the elements\n currentObject = currentObject[key.substring(2)]\n \n // CurrentObject is now an array\n \n const remainingKeyPath = keys.slice(i + 1).join(\".\")\n const currentArray = currentObject as unknown as any[]\n currentObject = currentArray.map(subObject => UIObject.valueForKeyPath(remainingKeyPath, subObject))\n \n break\n \n }\n \n currentObject = currentObject[key]\n if (IS_LIKE_NULL(currentObject)) {\n currentObject = nil\n }\n \n }\n \n return currentObject\n \n }\n \n setValueForKeyPath(keyPath: string, value: any, createPath = YES) {\n return UIObject.setValueForKeyPath(keyPath, value, this, createPath)\n }\n \n static setValueForKeyPath(keyPath: string, value: any, currentObject: any, createPath: boolean) {\n \n const keys = keyPath.split(\".\")\n let didSetValue = NO\n \n keys.forEach((key, index, array) => {\n if (index == array.length - 1 && IS_NOT_LIKE_NULL(currentObject)) {\n currentObject[key] = value\n didSetValue = YES\n return\n }\n else if (IS_NOT(currentObject)) {\n return\n }\n \n const currentObjectValue = currentObject[key]\n if (IS_LIKE_NULL(currentObjectValue) && createPath) {\n currentObject[key] = {}\n }\n currentObject = currentObject[key]\n })\n \n return didSetValue\n \n }\n \n \n configureWithObject(object: UIInitializerObject<this>) {\n \n return UIObject.configureWithObject(this, object)\n \n }\n \n configuredWithObject(object: UIInitializerObject<this>): this {\n \n this.configureWithObject(object)\n return this\n \n }\n \n \n static configureWithObject<TargetObjectType extends object, ConfigurationObjectType extends UIInitializerObject<TargetObjectType>>(\n configurationTarget: TargetObjectType,\n object: ConfigurationObjectType\n ): ConfigurationObjectType {\n \n const isAnObject = (item: any) => (item && typeof item === \"object\" && !Array.isArray(item) && !(item instanceof UICoreExtensionValueObject))\n const isAPureObject = (item: any) => isAnObject(item) && Object.getPrototypeOf(item) === Object.getPrototypeOf({})\n \n function isAClass(funcOrClass: object) {\n if (IS_NOT(funcOrClass)) {\n return NO\n }\n const isFunction = (functionToCheck: object) => (functionToCheck && {}.toString.call(functionToCheck) ===\n \"[object Function]\")\n const propertyNames = Object.getOwnPropertyNames(funcOrClass)\n return (isFunction(funcOrClass) && !propertyNames.includes(\"arguments\") &&\n propertyNames.includes(\"prototype\"))\n }\n \n const result = {} as ConfigurationObjectType\n \n let keyPathsAndValues: { value: any, keyPath: string }[] = []\n \n function prepareKeyPathsAndValues(target: Record<string, any>, source: object, keyPath = \"\") {\n \n if ((isAnObject(target) || isAClass(target)) && isAnObject(source)) {\n \n source.forEach((sourceValue, key) => {\n \n const valueKeyPath = keyPath + \".\" + key\n \n function addValueAndKeyPath(sourceValue: any) {\n keyPathsAndValues.push({\n value: sourceValue,\n keyPath: valueKeyPath.replace(\".\", \"\")\n })\n }\n \n \n if (isAPureObject(sourceValue) || isAClass(sourceValue)) {\n if (!(key in target) || target[key] instanceof Function) {\n addValueAndKeyPath(sourceValue)\n }\n else {\n prepareKeyPathsAndValues(target[key], sourceValue, valueKeyPath)\n }\n }\n else if (sourceValue instanceof UICoreExtensionValueObject) {\n addValueAndKeyPath(sourceValue.value)\n }\n else {\n addValueAndKeyPath(sourceValue)\n }\n \n })\n \n }\n \n }\n \n prepareKeyPathsAndValues(configurationTarget, object)\n \n // Sort based on key path lengths\n keyPathsAndValues = keyPathsAndValues.sort((a, b) => {\n \n const firstKeyPath = (a.keyPath as string).split(\".\").length\n const secondKeyPath = (b.keyPath as string).split(\".\").length\n \n if (firstKeyPath < secondKeyPath) {\n return -1\n }\n if (firstKeyPath > secondKeyPath) {\n return 1\n }\n return 0\n \n })\n \n keyPathsAndValues.forEach((valueAndKeyPath) => {\n \n const keyPath: string = valueAndKeyPath.keyPath\n let value = valueAndKeyPath.value\n \n const getTargetFunction = (bindThis = NO) => {\n let result = (UIObject.valueForKeyPath(keyPath, configurationTarget) as Function)\n if (bindThis) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n result = result.bind(thisObject)\n }\n return result\n }\n \n if (value instanceof UILazyPropertyValue) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n const key = keyPath.substring(indexOfDot + 1)\n value.setLazyPropertyValue(key, thisObject)\n return\n }\n \n if (value instanceof UIFunctionCall) {\n value.callFunction(getTargetFunction(YES))\n return\n }\n \n if (value instanceof UIFunctionExtender) {\n value = value.extendedFunction(getTargetFunction())\n }\n \n UIObject.setValueForKeyPath(keyPath, UIObject.valueForKeyPath(keyPath, configurationTarget), result, YES)\n UIObject.setValueForKeyPath(keyPath, value, configurationTarget, YES)\n \n })\n \n \n return result\n \n }\n \n static configuredWithObject<T extends object>(configurationTarget: T, object: UIInitializerObject<T>) {\n this.configureWithObject(configurationTarget, object)\n return configurationTarget\n }\n \n \n performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T {\n return functionToPerform(this)\n }\n \n performingFunctionWithSelf(functionToPerform: (self: this) => void): this {\n functionToPerform(this)\n return this\n }\n \n performFunctionWithDelay(delay: number, functionToCall: Function) {\n \n new UITimer(delay, NO, functionToCall)\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAA2C;AAC3C,qBAAwB;AAGxB,SAAS,cAAc;AACnB,SAAO;AACX;AAIO,IAAI,MAAW,IAAI,MAAM,OAAO,OAAO,aAAa,EAAE,SAAS,MAAM,aAAa,MAAM,CAAC,GAAG;AAAA,EAC/F,IAAI,QAAQ,MAAM;AACd,QAAI,QAAQ,OAAO,aAAa;AAC5B,aAAO,SAAU,MAAc;AAC3B,YAAI,QAAQ,UAAU;AAClB,iBAAO;AAAA,QACX;AACA,YAAI,QAAQ,UAAU;AAClB,iBAAO;AAAA,QACX;AACA,eAAO;AAAA,MACX;AAAA,IACJ;AACA,QAAI,QAAQ,YAAY;AACpB,aAAO,SAAS,WAAW;AACvB,eAAO;AAAA,MACX;AAAA,IACJ;AACA,WAAO,YAAY;AAAA,EACvB;AAAA,EACA,MAAM;AACF,WAAO,YAAY;AAAA,EACvB;AACJ,CAAC;AAGM,SAAS,UAAa,QAAe;AACxC,MAAI,SAAS,aAAa,MAAM;AAChC,MAAI,kBAAkB,UAAU,EAAE,kBAAkB,WAAW;AAC3D,aAAS,IAAI,MAAM,QA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2BAA2B,mBAA+C;AACtE,sBAAkB,IAAI;AACtB,WAAO;AAAA,EACX;AAAA,EAEA,yBAAyB,OAAe,gBAA0B;AAE9D,QAAI,uBAAQ,OAAO,IAAI,cAAc;AAAA,EAEzC;AAGJ;",
4
+ "sourcesContent": ["import { UICoreExtensionValueObject } from \"./UICoreExtensionValueObject\"\nimport { UITimer } from \"./UITimer\"\n\n\nfunction NilFunction() {\n return nil\n}\n\n\n// The nil object avoids unnecessary crashes by allowing you to call any function or access any variable on it, returning nil\nexport var nil: any = new Proxy(Object.assign(NilFunction, { \"class\": null, \"className\": \"Nil\" }), {\n get(target, name) {\n if (name == Symbol.toPrimitive) {\n return function (hint: string) {\n if (hint == \"number\") {\n return 0\n }\n if (hint == \"string\") {\n return \"\"\n }\n return false\n }\n }\n if (name == \"toString\") {\n return function toString() {\n return \"\"\n }\n }\n return NilFunction()\n },\n set() {\n return NilFunction()\n }\n})\n\n\nexport function wrapInNil<T>(object?: T): T {\n let result = FIRST_OR_NIL(object)\n if (object instanceof Object && !(object instanceof Function)) {\n result = new Proxy(object as Object & T, {\n get(target, name) {\n if (name == \"wrapped_nil_target\") {\n return target\n }\n const value = Reflect.get(target, name)\n if (typeof value === \"object\") {\n return wrapInNil(value)\n }\n if (IS_NOT_LIKE_NULL(value)) {\n return value\n }\n return nil\n },\n set(target: Record<string, any> & T, name: string, value: any) {\n if (IS(target)) {\n // @ts-ignore\n target[name] = value\n }\n return YES\n }\n })\n }\n return result\n}\n\n\nexport const YES = true\nexport const NO = false\n\nexport function IS<T>(object: T | undefined | null | false): object is T {\n if (object && object !== nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT(object: any): object is undefined | null | false {\n return !IS(object)\n}\n\nexport function IS_DEFINED<T>(object: T | undefined): object is T {\n if (object != undefined) {\n return YES\n }\n return NO\n}\n\nexport function IS_UNDEFINED(object: any): object is undefined {\n return !IS_DEFINED(object)\n}\n\nexport function IS_NIL(object: any): object is typeof nil {\n if (object === nil) {\n return YES\n }\n return NO\n}\n\nexport function IS_NOT_NIL<T>(object: T | undefined | null): object is T | undefined | null {\n return !IS_NIL(object)\n}\n\n\nexport function IS_LIKE_NULL(object: any): object is undefined | null {\n return (IS_UNDEFINED(object) || IS_NIL(object) || object == null)\n}\n\nexport function IS_NOT_LIKE_NULL<T>(object: T | null | undefined): object is T {\n return !IS_LIKE_NULL(object)\n}\n\n\nexport function IS_AN_EMAIL_ADDRESS(email: string) {\n const re = /\\S+@\\S+\\.\\S+/\n return re.test(email)\n}\n\n\nexport function FIRST_OR_NIL<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || nil\n}\n\nexport function FIRST<T>(...objects: (T | undefined | null)[]): T {\n const result = objects.find(object => IS(object))\n return result || IF(IS_DEFINED(objects.lastElement))(RETURNER(objects.lastElement))()\n}\n\n\nexport function MAKE_ID(randomPartLength = 15) {\n let result = \"\"\n const characters = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"\n for (let i = 0; i < randomPartLength; i++) {\n result = result + characters.charAt(Math.floor(Math.random() * characters.length))\n }\n result = result + Date.now()\n return result\n}\n\n\nexport function RETURNER<T>(value?: T) {\n return (..._objects: any[]) => value\n}\n\n\nexport type UIIFBlockReceiver<T> = (functionToCall: () => any) => UIIFEvaluator<T>;\nexport type UIIFEvaluatorBase<T> = () => T;\n\n\nexport interface UIIFEvaluator<T> extends UIIFEvaluatorBase<T> {\n ELSE_IF: (otherValue: any) => UIIFBlockReceiver<T>;\n ELSE: (functionToCall: () => any) => T;\n}\n\n\nexport function IF<T = any>(value: any): UIIFBlockReceiver<T> {\n \n let thenFunction = nil\n let elseFunction = nil\n \n const result: any = function (functionToCall: () => T) {\n thenFunction = functionToCall\n return result.evaluateConditions\n }\n \n result.evaluateConditions = function () {\n if (IS(value)) {\n return thenFunction()\n }\n return elseFunction()\n }\n \n result.evaluateConditions.ELSE_IF = function (otherValue: any) {\n \n const functionResult = IF(otherValue) as (UIIFBlockReceiver<T> & { evaluateConditions: UIIFEvaluator<T> })\n elseFunction = functionResult.evaluateConditions\n \n const functionResultEvaluateConditionsFunction: any = function () {\n return result.evaluateConditions()\n }\n functionResultEvaluateConditionsFunction.ELSE_IF = functionResult.evaluateConditions.ELSE_IF\n functionResultEvaluateConditionsFunction.ELSE = functionResult.evaluateConditions.ELSE\n \n functionResult.evaluateConditions = functionResultEvaluateConditionsFunction\n \n return functionResult\n \n }\n \n result.evaluateConditions.ELSE = function (functionToCall: () => T) {\n elseFunction = functionToCall\n return result.evaluateConditions()\n }\n \n return result\n}\n\n\nexport class UIFunctionCall<T extends (...args: any) => any> {\n \n isAUIFunctionCallObject = YES\n parameters: Parameters<T>[]\n \n constructor(...parameters: Parameters<T>) {\n this.parameters = parameters\n }\n \n callFunction(functionToCall: T) {\n const parameters = this.parameters\n functionToCall(...parameters)\n }\n \n}\n\n\nexport function CALL<T extends (...args: any) => any>(...objects: Parameters<T>) {\n return new UIFunctionCall<T>(...objects)\n}\n\n\nexport class UIFunctionExtender<T extends (...args: any) => any> {\n \n isAUIFunctionExtenderObject = YES\n extendingFunction: T\n \n constructor(extendingFunction: T) {\n this.extendingFunction = extendingFunction\n }\n \n extendedFunction(functionToExtend: T) {\n const extendingFunction = this.extendingFunction\n \n function extendedFunction(this: any, ...objects: any[]) {\n const boundFunctionToExtend = functionToExtend.bind(this)\n boundFunctionToExtend(...objects)\n const boundExtendingFunction = extendingFunction.bind(this)\n boundExtendingFunction(...objects)\n }\n \n extendedFunction.extendedFunction = functionToExtend\n return extendedFunction\n }\n \n}\n\n\nexport function EXTEND<T extends (...args: any) => any>(extendingFunction: T) {\n return new UIFunctionExtender(extendingFunction)\n}\n\n\nexport class UILazyPropertyValue<T> {\n \n isAUILazyPropertyValueObject = YES\n initFunction: () => T\n \n constructor(initFunction: () => T) {\n this.initFunction = initFunction\n }\n \n setLazyPropertyValue(key: string, target: object) {\n \n let isValueInitialized = NO\n \n // property value\n let _value = nil\n \n const initValue = () => {\n _value = this.initFunction()\n isValueInitialized = YES\n this.initFunction = nil\n }\n \n // @ts-ignore\n if (delete target[key]) {\n \n // Create new property with getter and setter\n Object.defineProperty(target, key, {\n get: function () {\n if (IS_NOT(isValueInitialized)) {\n initValue()\n }\n return _value\n },\n set: function (newValue) {\n _value = newValue\n },\n enumerable: true,\n configurable: true\n })\n \n }\n \n }\n \n}\n\n\nexport function LAZY_VALUE<T>(initFunction: () => T) {\n return new UILazyPropertyValue(initFunction)\n}\n\n\nexport type UIInitializerObject<T> = {\n \n [P in keyof T]?:\n //T[P] extends (infer U)[] ? UIInitializerObject<U>[] :\n T[P] extends (...args: any) => any ? UIFunctionCall<T[P]> | UIFunctionExtender<T[P]> | T[P] :\n T[P] extends object ? UIInitializerObject<T[P]> | UILazyPropertyValue<T[P]> :\n T[P];\n \n}\n\n\nexport class UIObject {\n \n constructor() {\n \n // Do something here if needed\n \n }\n \n public get class(): any {\n return Object.getPrototypeOf(this).constructor\n }\n \n public get superclass(): any {\n return Object.getPrototypeOf(Object.getPrototypeOf(this)).constructor\n }\n \n isKindOfClass(classObject: any) {\n if (this.isMemberOfClass(classObject)) {\n return YES\n }\n for (let superclassObject = this.superclass; IS(superclassObject); superclassObject = superclassObject.superclass) {\n if (superclassObject == classObject) {\n return YES\n }\n }\n return NO\n }\n \n \n isMemberOfClass(classObject: any) {\n return (this.class == classObject)\n }\n \n public static wrapObject<T>(object: T): UIObject & T {\n if (IS_NOT(object)) {\n return nil\n }\n \n if ((object as any) instanceof UIObject) {\n // @ts-ignore\n return object\n }\n \n return Object.assign(new UIObject(), object)\n }\n \n \n valueForKey(key: string) {\n // @ts-ignore\n return this[key]\n }\n \n valueForKeyPath(keyPath: string): any {\n return UIObject.valueForKeyPath(keyPath, this)\n }\n \n static valueForKeyPath(keyPath: string, object: any): any {\n \n if (IS_NOT(keyPath)) {\n return object\n }\n \n const keys = keyPath.split(\".\")\n let currentObject = object\n \n for (let i = 0; i < keys.length; i++) {\n \n const key = keys[i]\n \n if (key.substring(0, 2) == \"[]\") {\n \n // This next object will be an array and the rest of the keys need to be run for each of the elements\n currentObject = currentObject[key.substring(2)]\n \n // CurrentObject is now an array\n \n const remainingKeyPath = keys.slice(i + 1).join(\".\")\n const currentArray = currentObject as unknown as any[]\n currentObject = currentArray.map(subObject => UIObject.valueForKeyPath(remainingKeyPath, subObject))\n \n break\n \n }\n \n currentObject = currentObject[key]\n if (IS_LIKE_NULL(currentObject)) {\n currentObject = nil\n }\n \n }\n \n return currentObject\n \n }\n \n setValueForKeyPath(keyPath: string, value: any, createPath = YES) {\n return UIObject.setValueForKeyPath(keyPath, value, this, createPath)\n }\n \n static setValueForKeyPath(keyPath: string, value: any, currentObject: any, createPath: boolean) {\n \n const keys = keyPath.split(\".\")\n let didSetValue = NO\n \n keys.forEach((key, index, array) => {\n if (index == array.length - 1 && IS_NOT_LIKE_NULL(currentObject)) {\n currentObject[key] = value\n didSetValue = YES\n return\n }\n else if (IS_NOT(currentObject)) {\n return\n }\n \n const currentObjectValue = currentObject[key]\n if (IS_LIKE_NULL(currentObjectValue) && createPath) {\n currentObject[key] = {}\n }\n currentObject = currentObject[key]\n })\n \n return didSetValue\n \n }\n \n \n configureWithObject(object: UIInitializerObject<this>) {\n \n return UIObject.configureWithObject(this, object)\n \n }\n \n configuredWithObject(object: UIInitializerObject<this>): this {\n \n this.configureWithObject(object)\n return this\n \n }\n \n \n static configureWithObject<TargetObjectType extends object, ConfigurationObjectType extends UIInitializerObject<TargetObjectType>>(\n configurationTarget: TargetObjectType,\n object: ConfigurationObjectType\n ): ConfigurationObjectType {\n \n const isAnObject = (item: any) => (item && typeof item === \"object\" && !Array.isArray(item) && !(item instanceof UICoreExtensionValueObject))\n const isAPureObject = (item: any) => isAnObject(item) && Object.getPrototypeOf(item) === Object.getPrototypeOf({})\n \n function isAClass(funcOrClass: object) {\n if (IS_NOT(funcOrClass)) {\n return NO\n }\n const isFunction = (functionToCheck: object) => (functionToCheck && {}.toString.call(functionToCheck) ===\n \"[object Function]\")\n const propertyNames = Object.getOwnPropertyNames(funcOrClass)\n return (isFunction(funcOrClass) && !propertyNames.includes(\"arguments\") &&\n propertyNames.includes(\"prototype\"))\n }\n \n const result = {} as ConfigurationObjectType\n \n let keyPathsAndValues: { value: any, keyPath: string }[] = []\n \n function prepareKeyPathsAndValues(target: Record<string, any>, source: object, keyPath = \"\") {\n \n if ((isAnObject(target) || isAClass(target)) && isAnObject(source)) {\n \n source.forEach((sourceValue, key) => {\n \n const valueKeyPath = keyPath + \".\" + key\n \n function addValueAndKeyPath(sourceValue: any) {\n keyPathsAndValues.push({\n value: sourceValue,\n keyPath: valueKeyPath.replace(\".\", \"\")\n })\n }\n \n \n if (isAPureObject(sourceValue) || isAClass(sourceValue)) {\n if (!(key in target) || target[key] instanceof Function) {\n addValueAndKeyPath(sourceValue)\n }\n else {\n prepareKeyPathsAndValues(target[key], sourceValue, valueKeyPath)\n }\n }\n else if (sourceValue instanceof UICoreExtensionValueObject) {\n addValueAndKeyPath(sourceValue.value)\n }\n else {\n addValueAndKeyPath(sourceValue)\n }\n \n })\n \n }\n \n }\n \n prepareKeyPathsAndValues(configurationTarget, object)\n \n // Sort based on key path lengths\n keyPathsAndValues = keyPathsAndValues.sort((a, b) => {\n \n const firstKeyPath = (a.keyPath as string).split(\".\").length\n const secondKeyPath = (b.keyPath as string).split(\".\").length\n \n if (firstKeyPath < secondKeyPath) {\n return -1\n }\n if (firstKeyPath > secondKeyPath) {\n return 1\n }\n return 0\n \n })\n \n keyPathsAndValues.forEach((valueAndKeyPath) => {\n \n const keyPath: string = valueAndKeyPath.keyPath\n let value = valueAndKeyPath.value\n \n const getTargetFunction = (bindThis = NO) => {\n let result = (UIObject.valueForKeyPath(keyPath, configurationTarget) as Function)\n if (bindThis) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n result = result.bind(thisObject)\n }\n return result\n }\n \n if (value instanceof UILazyPropertyValue) {\n const indexOfDot = keyPath.lastIndexOf(\".\")\n const thisObject = UIObject.valueForKeyPath(keyPath.substring(0, indexOfDot), configurationTarget)\n const key = keyPath.substring(indexOfDot + 1)\n value.setLazyPropertyValue(key, thisObject)\n return\n }\n \n if (value instanceof UIFunctionCall) {\n value.callFunction(getTargetFunction(YES))\n return\n }\n \n if (value instanceof UIFunctionExtender) {\n value = value.extendedFunction(getTargetFunction())\n }\n \n UIObject.setValueForKeyPath(keyPath, UIObject.valueForKeyPath(keyPath, configurationTarget), result, YES)\n UIObject.setValueForKeyPath(keyPath, value, configurationTarget, YES)\n \n })\n \n \n return result\n \n }\n \n static configuredWithObject<T extends object>(configurationTarget: T, object: UIInitializerObject<T>) {\n this.configureWithObject(configurationTarget, object)\n return configurationTarget\n }\n \n \n get methods(): {\n [P in keyof this]: this[P] extends (...args: any) => any ? this[P] : never\n } {\n \n const thisObject = this as any\n \n const result = new Proxy({ \"name\": \"BoundFunctionRetriever\" }, {\n \n get(target, key: string) {\n \n const thisObjectElement = thisObject[key]\n \n if (thisObjectElement instanceof Function) {\n \n return thisObjectElement.bind(thisObject)\n \n }\n \n return undefined\n \n }\n \n }) as any\n \n return result\n \n }\n \n \n performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T {\n return functionToPerform(this)\n }\n \n performingFunctionWithSelf(functionToPerform: (self: this) => void): this {\n functionToPerform(this)\n return this\n }\n \n performFunctionWithDelay(delay: number, functionToCall: Function) {\n \n new UITimer(delay, NO, functionToCall)\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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longHeight(views: UIView[], weights?: number | number[], paddings?: number | number[], absoluteHeights?: number | number[]): this;
52
52
  distributeViewsEquallyAlongWidth(views: UIView[], padding: number): this;
53
53
  distributeViewsEquallyAlongHeight(views: UIView[], padding: number): this;
54
- rectangleForNextRow(padding?: number, height?: number | UIView): UIRectangle;
55
- rectangleForNextColumn(padding?: number, width?: number | UIView): UIRectangle;
54
+ rectangleForNextRow(padding?: number, height?: number | ((constrainingWidth: number) => number)): UIRectangle;
55
+ rectangleForNextColumn(padding?: number, width?: number | ((constrainingHeight: number) => number)): UIRectangle;
56
56
  rectangleForPreviousRow(padding?: number): UIRectangle;
57
57
  rectangleForPreviousColumn(padding?: number): UIRectangle;
58
58
  static boundingBoxForPoints(points: string | any[]): UIRectangle;
@@ -23,7 +23,6 @@ __export(UIRectangle_exports, {
23
23
  module.exports = __toCommonJS(UIRectangle_exports);
24
24
  var import_UIObject = require("./UIObject");
25
25
  var import_UIPoint = require("./UIPoint");
26
- var import_UIView = require("./UIView");
27
26
  class UIRectangle extends import_UIObject.UIObject {
28
27
  constructor(x = 0, y = 0, height = 0, width = 0) {
29
28
  super();
@@ -406,8 +405,8 @@ class UIRectangle extends import_UIObject.UIObject {
406
405
  return this;
407
406
  }
408
407
  rectangleForNextRow(padding = 0, height = this.height) {
409
- if (height instanceof import_UIView.UIView) {
410
- height = height.intrinsicContentHeight(this.width);
408
+ if (height instanceof Function) {
409
+ height = height(this.width);
411
410
  }
412
411
  const result = this.rectangleWithY(this.max.y + padding);
413
412
  if (height != this.height) {
@@ -416,8 +415,8 @@ class UIRectangle extends import_UIObject.UIObject {
416
415
  return result;
417
416
  }
418
417
  rectangleForNextColumn(padding = 0, width = this.width) {
419
- if (width instanceof import_UIView.UIView) {
420
- width = width.intrinsicContentWidth(this.height);
418
+ if (width instanceof Function) {
419
+ width = width(this.height);
421
420
  }
422
421
  const result = this.rectangleWithX(this.max.x + padding);
423
422
  if (width != this.width) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UIRectangle.ts"],
4
- "sourcesContent": ["import { FIRST_OR_NIL, IS, IS_NIL, IS_NOT_NIL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIView } from \"./UIView\"\n\n\nexport class UIRectangle extends UIObject {\n \n _isBeingUpdated: boolean\n rectanglePointDidChange: (b: any) => void = nil\n max: UIPoint\n min: UIPoint\n \n \n constructor(x: number = 0, y: number = 0, height: number = 0, width: number = 0) {\n \n super()\n \n this.min = new UIPoint(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY)\n this.max = new UIPoint(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY)\n \n this.min.didChange = (point) => {\n this.rectanglePointDidChange(point)\n this._rectanglePointDidChange()\n }\n this.max.didChange = (point) => {\n this.rectanglePointDidChange(point)\n this._rectanglePointDidChange()\n }\n \n this._isBeingUpdated = NO\n \n this.min = new UIPoint(x, y)\n this.max = new UIPoint(x + width, y + height)\n \n if (IS_NIL(height)) {\n this.max.y = height\n }\n \n if (IS_NIL(width)) {\n this.max.x = width\n }\n \n }\n \n \n copy() {\n return new UIRectangle(this.x, this.y, this.height, this.width)\n }\n \n isEqualTo(rectangle: UIRectangle | null | undefined) {\n return (IS(rectangle) && this.min.isEqualTo(rectangle.min) && this.max.isEqualTo(rectangle.max))\n }\n \n static zero() {\n return new UIRectangle(0, 0, 0, 0)\n }\n \n containsPoint(point: UIPoint) {\n return this.min.x <= point.x && this.min.y <= point.y &&\n point.x <= this.max.x && point.y <= this.max.y\n }\n \n updateByAddingPoint(point: UIPoint) {\n \n if (!point) {\n point = new UIPoint(0, 0)\n }\n \n this.beginUpdates()\n \n const min = this.min.copy()\n if (min.x === nil) {\n min.x = this.max.x\n }\n if (min.y === nil) {\n min.y = this.max.y\n }\n \n const max = this.max.copy()\n if (max.x === nil) {\n max.x = this.min.x\n }\n if (max.y === nil) {\n max.y = this.min.y\n }\n \n this.min.x = Math.min(min.x, point.x)\n this.min.y = Math.min(min.y, point.y)\n this.max.x = Math.max(max.x, point.x)\n this.max.y = Math.max(max.y, point.y)\n \n this.finishUpdates()\n \n }\n \n scale(scale: number) {\n if (IS_NOT_NIL(this.max.y)) {\n this.height = this.height * scale\n }\n if (IS_NOT_NIL(this.max.x)) {\n this.width = this.width * scale\n }\n }\n \n get height() {\n if (this.max.y === nil) {\n return nil\n }\n return this.max.y - this.min.y\n }\n \n set height(height: number) {\n this.max.y = this.min.y + height\n }\n \n \n get width() {\n if (this.max.x === nil) {\n return nil\n }\n return this.max.x - this.min.x\n }\n \n set width(width: number) {\n this.max.x = this.min.x + width\n }\n \n \n get x() {\n return this.min.x\n }\n \n set x(x: number) {\n \n this.beginUpdates()\n \n const width = this.width\n this.min.x = x\n this.max.x = this.min.x + width\n \n this.finishUpdates()\n \n }\n \n \n get y() {\n return this.min.y\n }\n \n \n set y(y: number) {\n \n this.beginUpdates()\n \n const height = this.height\n this.min.y = y\n this.max.y = this.min.y + height\n \n this.finishUpdates()\n \n }\n \n \n get topLeft() {\n return this.min.copy()\n }\n \n get topRight() {\n return new UIPoint(this.max.x, this.y)\n }\n \n get bottomLeft() {\n return new UIPoint(this.x, this.max.y)\n }\n \n get bottomRight() {\n return this.max.copy()\n }\n \n \n get center() {\n return this.min.copy().add(this.min.to(this.max).scale(0.5))\n }\n \n set center(center: UIPoint) {\n const offset = this.center.to(center)\n this.offsetByPoint(offset)\n }\n \n offsetByPoint(offset: UIPoint) {\n this.min.add(offset)\n this.max.add(offset)\n \n return this\n }\n \n \n concatenateWithRectangle(rectangle: UIRectangle) {\n this.updateByAddingPoint(rectangle.bottomRight)\n this.updateByAddingPoint(rectangle.topLeft)\n return this\n }\n \n \n intersectionRectangleWithRectangle(rectangle: UIRectangle): UIRectangle {\n \n const result = this.copy()\n \n result.beginUpdates()\n \n const min = result.min\n if (min.x === nil) {\n min.x = rectangle.max.x - Math.min(result.width, rectangle.width)\n }\n if (min.y === nil) {\n min.y = rectangle.max.y - Math.min(result.height, rectangle.height)\n }\n \n const max = result.max\n if (max.x === nil) {\n max.x = rectangle.min.x + Math.min(result.width, rectangle.width)\n }\n if (max.y === nil) {\n max.y = rectangle.min.y + Math.min(result.height, rectangle.height)\n }\n \n result.min.x = Math.max(result.min.x, rectangle.min.x)\n result.min.y = Math.max(result.min.y, rectangle.min.y)\n result.max.x = Math.min(result.max.x, rectangle.max.x)\n result.max.y = Math.min(result.max.y, rectangle.max.y)\n \n \n if (result.height < 0) {\n \n const averageY = (this.center.y + rectangle.center.y) * 0.5\n result.min.y = averageY\n result.max.y = averageY\n \n }\n \n if (result.width < 0) {\n \n const averageX = (this.center.x + rectangle.center.x) * 0.5\n result.min.x = averageX\n result.max.x = averageX\n \n }\n \n result.finishUpdates()\n \n return result\n \n }\n \n \n get area() {\n return this.height * this.width\n }\n \n \n intersectsWithRectangle(rectangle: UIRectangle) {\n return (this.intersectionRectangleWithRectangle(rectangle).area != 0)\n }\n \n \n // add some space around the rectangle\n rectangleWithInsets(left: number, right: number, bottom: number, top: number) {\n const result = this.copy()\n result.min.x = this.min.x + left\n result.max.x = this.max.x - right\n result.min.y = this.min.y + top\n result.max.y = this.max.y - bottom\n return result\n }\n \n rectangleWithInset(inset: number) {\n return this.rectangleWithInsets(inset, inset, inset, inset)\n }\n \n rectangleWithHeight(height: number, centeredOnPosition: number = nil) {\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.copy()\n result.height = height\n \n if (centeredOnPosition != nil) {\n const change = height - this.height\n result.offsetByPoint(new UIPoint(0, change * centeredOnPosition).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithWidth(width: number, centeredOnPosition: number = nil) {\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.copy()\n result.width = width\n \n if (centeredOnPosition != nil) {\n const change = width - this.width\n result.offsetByPoint(new UIPoint(change * centeredOnPosition, 0).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithHeightRelativeToWidth(heightRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithHeight(this.width * heightRatio, centeredOnPosition)\n }\n \n rectangleWithWidthRelativeToHeight(widthRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithWidth(this.height * widthRatio, centeredOnPosition)\n }\n \n rectangleWithX(x: number, centeredOnPosition: number = 0) {\n \n const result = this.copy()\n result.x = x - result.width * centeredOnPosition\n \n return result\n \n }\n \n rectangleWithY(y: number, centeredOnPosition: number = 0) {\n \n const result = this.copy()\n result.y = y - result.height * centeredOnPosition\n \n return result\n \n }\n \n \n rectangleByAddingX(x: number) {\n \n const result = this.copy()\n result.x = this.x + x\n \n return result\n \n }\n \n rectangleByAddingY(y: number) {\n \n const result = this.copy()\n result.y = this.y + y\n \n return result\n \n }\n \n \n rectangleWithRelativeValues(\n relativeXPosition: number,\n widthMultiplier: number,\n relativeYPosition: number,\n heightMultiplier: number\n ) {\n \n const result = this.copy()\n \n const width = result.width\n const height = result.height\n \n result.width = widthMultiplier * width\n result.height = heightMultiplier * height\n \n result.center = new UIPoint(\n relativeXPosition * width,\n relativeYPosition * height\n )\n \n return result\n \n }\n \n \n rectanglesBySplittingWidth(\n weights: number[],\n paddings: number | number[] = 0,\n absoluteWidths: number | number[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as number[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n if (!(absoluteWidths instanceof Array) && IS_NOT_NIL(absoluteWidths)) {\n absoluteWidths = [absoluteWidths].arrayByRepeating(weights.length)\n }\n \n const result: UIRectangle[] = []\n const sumOfWeights = weights.reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteWidths as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue\n const sumOfAbsoluteWidths = (absoluteWidths as number[]).summedValue\n const totalRelativeWidth = this.width - sumOfPaddings - sumOfAbsoluteWidths\n let previousCellMaxX = this.x\n \n for (let i = 0; i < weights.length; i++) {\n \n let resultWidth: number\n if (IS_NOT_NIL(absoluteWidths[i])) {\n resultWidth = absoluteWidths[i] || 0\n }\n else {\n resultWidth = totalRelativeWidth * (weights[i] / sumOfWeights)\n }\n \n const rectangle = this.rectangleWithWidth(resultWidth)\n \n let padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i]\n }\n \n rectangle.x = previousCellMaxX\n previousCellMaxX = rectangle.max.x + padding\n result.push(rectangle)\n \n }\n \n return result\n \n }\n \n rectanglesBySplittingHeight(\n weights: number[],\n paddings: number | number[] = 0,\n absoluteHeights: number | number[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as number[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(weights.length)\n }\n \n const result: UIRectangle[] = []\n const sumOfWeights = weights.reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteHeights as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue\n const sumOfAbsoluteHeights = (absoluteHeights as number[]).summedValue\n const totalRelativeHeight = this.height - sumOfPaddings - sumOfAbsoluteHeights\n var previousCellMaxY = this.y\n \n for (var i = 0; i < weights.length; i++) {\n var resultHeight: number\n if (IS_NOT_NIL(absoluteHeights[i])) {\n \n resultHeight = absoluteHeights[i] || 0\n \n }\n else {\n \n resultHeight = totalRelativeHeight * (weights[i] / sumOfWeights)\n \n }\n \n const rectangle = this.rectangleWithHeight(resultHeight)\n \n var padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i]\n }\n \n rectangle.y = previousCellMaxY\n previousCellMaxY = rectangle.max.y + padding\n //rectangle = rectangle.rectangleWithInsets(0, 0, padding, 0);\n result.push(rectangle)\n }\n \n return result\n \n }\n \n \n rectanglesByEquallySplittingWidth(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultWidth = (this.width - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithWidth(resultWidth, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n rectanglesByEquallySplittingHeight(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultHeight = (this.height - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithHeight(resultHeight, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n \n distributeViewsAlongWidth(\n views: UIView[],\n weights: number | number[] = 1,\n paddings?: number | number[],\n absoluteWidths?: number | number[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingWidth(weights, paddings, absoluteWidths)\n frames.forEach((frame, index) => FIRST_OR_NIL(views[index]).frame = frame)\n return this\n }\n \n distributeViewsAlongHeight(\n views: UIView[],\n weights: number | number[] = 1,\n paddings?: number | number[],\n absoluteHeights?: number | number[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingHeight(weights, paddings, absoluteHeights)\n frames.forEach((frame, index) => FIRST_OR_NIL(views[index]).frame = frame)\n return this\n }\n \n \n distributeViewsEquallyAlongWidth(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingWidth(views.length, padding)\n frames.forEach((frame, index) => views[index].frame = frame)\n return this\n }\n \n distributeViewsEquallyAlongHeight(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingHeight(views.length, padding)\n frames.forEach((frame, index) => views[index].frame = frame)\n return this\n }\n \n \n rectangleForNextRow(padding: number = 0, height: number | UIView = this.height) {\n if (height instanceof UIView) {\n height = height.intrinsicContentHeight(this.width)\n }\n const result = this.rectangleWithY(this.max.y + padding)\n if (height != this.height) {\n result.height = height\n }\n return result\n }\n \n rectangleForNextColumn(padding: number = 0, width: number | UIView = this.width) {\n if (width instanceof UIView) {\n width = width.intrinsicContentWidth(this.height)\n }\n const result = this.rectangleWithX(this.max.x + padding)\n if (width != this.width) {\n result.width = width\n }\n return result\n }\n \n rectangleForPreviousRow(padding: number = 0) {\n return this.rectangleWithY(this.min.y - this.height - padding)\n }\n \n rectangleForPreviousColumn(padding: number = 0) {\n return this.rectangleWithX(this.min.x - this.width - padding)\n }\n \n \n // Bounding box\n static boundingBoxForPoints(points: string | any[]) {\n const result = new UIRectangle()\n for (let i = 0; i < points.length; i++) {\n result.updateByAddingPoint(points[i])\n }\n return result\n }\n \n \n beginUpdates() {\n this._isBeingUpdated = YES\n }\n \n finishUpdates() {\n this._isBeingUpdated = NO\n this.didChange()\n }\n \n \n didChange() {\n \n // Callback to be set by delegate\n \n }\n \n _rectanglePointDidChange() {\n if (!this._isBeingUpdated) {\n this.didChange()\n }\n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6E;AAC7E,qBAAwB;AACxB,oBAAuB;AAGhB,MAAM,oBAAoB,yBAAS;AAAA,EAQtC,YAAY,IAAY,GAAG,IAAY,GAAG,SAAiB,GAAG,QAAgB,GAAG;AAE7E,UAAM;AAPV,mCAA4C;AASxC,SAAK,MAAM,IAAI,uBAAQ,OAAO,mBAAmB,OAAO,iBAAiB;AACzE,SAAK,MAAM,IAAI,uBAAQ,OAAO,mBAAmB,OAAO,iBAAiB;AAEzE,SAAK,IAAI,YAAY,CA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AG,QAAyB,KAAK,OAAO;AAC7E,QAAI,iBAAiB,sBAAQ;AACzB,cAAQ,MAAM,sBAAsB,KAAK,MAAM;AAAA,IACnD;AACA,UAAM,SAAS,KAAK,eAAe,KAAK,IAAI,IAAI,OAAO;AACvD,QAAI,SAAS,KAAK,OAAO;AACrB,aAAO,QAAQ;AAAA,IACnB;AACA,WAAO;AAAA,EACX;AAAA,EAEA,wBAAwB,UAAkB,GAAG;AACzC,WAAO,KAAK,eAAe,KAAK,IAAI,IAAI,KAAK,SAAS,OAAO;AAAA,EACjE;AAAA,EAEA,2BAA2B,UAAkB,GAAG;AAC5C,WAAO,KAAK,eAAe,KAAK,IAAI,IAAI,KAAK,QAAQ,OAAO;AAAA,EAChE;AAAA,EAIA,OAAO,qBAAqB,QAAwB;AAChD,UAAM,SAAS,IAAI,YAAY;AAC/B,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACpC,aAAO,oBAAoB,OAAO,EAAE;AAAA,IACxC;AACA,WAAO;AAAA,EACX;AAAA,EAGA,eAAe;AACX,SAAK,kBAAkB;AAAA,EAC3B;AAAA,EAEA,gBAAgB;AACZ,SAAK,kBAAkB;AACvB,SAAK,UAAU;AAAA,EACnB;AAAA,EAGA,YAAY;AAAA,EAIZ;AAAA,EAEA,2BAA2B;AACvB,QAAI,CAAC,KAAK,iBAAiB;AACvB,WAAK,UAAU;AAAA,IACnB;AAAA,EACJ;AAGJ;",
4
+ "sourcesContent": ["import { FIRST_OR_NIL, IS, IS_NIL, IS_NOT_NIL, nil, NO, UIObject, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIView } from \"./UIView\"\n\n\nexport class UIRectangle extends UIObject {\n \n _isBeingUpdated: boolean\n rectanglePointDidChange: (b: any) => void = nil\n max: UIPoint\n min: UIPoint\n \n \n constructor(x: number = 0, y: number = 0, height: number = 0, width: number = 0) {\n \n super()\n \n this.min = new UIPoint(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY)\n this.max = new UIPoint(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY)\n \n this.min.didChange = (point) => {\n this.rectanglePointDidChange(point)\n this._rectanglePointDidChange()\n }\n this.max.didChange = (point) => {\n this.rectanglePointDidChange(point)\n this._rectanglePointDidChange()\n }\n \n this._isBeingUpdated = NO\n \n this.min = new UIPoint(x, y)\n this.max = new UIPoint(x + width, y + height)\n \n if (IS_NIL(height)) {\n this.max.y = height\n }\n \n if (IS_NIL(width)) {\n this.max.x = width\n }\n \n }\n \n \n copy() {\n return new UIRectangle(this.x, this.y, this.height, this.width)\n }\n \n isEqualTo(rectangle: UIRectangle | null | undefined) {\n return (IS(rectangle) && this.min.isEqualTo(rectangle.min) && this.max.isEqualTo(rectangle.max))\n }\n \n static zero() {\n return new UIRectangle(0, 0, 0, 0)\n }\n \n containsPoint(point: UIPoint) {\n return this.min.x <= point.x && this.min.y <= point.y &&\n point.x <= this.max.x && point.y <= this.max.y\n }\n \n updateByAddingPoint(point: UIPoint) {\n \n if (!point) {\n point = new UIPoint(0, 0)\n }\n \n this.beginUpdates()\n \n const min = this.min.copy()\n if (min.x === nil) {\n min.x = this.max.x\n }\n if (min.y === nil) {\n min.y = this.max.y\n }\n \n const max = this.max.copy()\n if (max.x === nil) {\n max.x = this.min.x\n }\n if (max.y === nil) {\n max.y = this.min.y\n }\n \n this.min.x = Math.min(min.x, point.x)\n this.min.y = Math.min(min.y, point.y)\n this.max.x = Math.max(max.x, point.x)\n this.max.y = Math.max(max.y, point.y)\n \n this.finishUpdates()\n \n }\n \n scale(scale: number) {\n if (IS_NOT_NIL(this.max.y)) {\n this.height = this.height * scale\n }\n if (IS_NOT_NIL(this.max.x)) {\n this.width = this.width * scale\n }\n }\n \n get height() {\n if (this.max.y === nil) {\n return nil\n }\n return this.max.y - this.min.y\n }\n \n set height(height: number) {\n this.max.y = this.min.y + height\n }\n \n \n get width() {\n if (this.max.x === nil) {\n return nil\n }\n return this.max.x - this.min.x\n }\n \n set width(width: number) {\n this.max.x = this.min.x + width\n }\n \n \n get x() {\n return this.min.x\n }\n \n set x(x: number) {\n \n this.beginUpdates()\n \n const width = this.width\n this.min.x = x\n this.max.x = this.min.x + width\n \n this.finishUpdates()\n \n }\n \n \n get y() {\n return this.min.y\n }\n \n \n set y(y: number) {\n \n this.beginUpdates()\n \n const height = this.height\n this.min.y = y\n this.max.y = this.min.y + height\n \n this.finishUpdates()\n \n }\n \n \n get topLeft() {\n return this.min.copy()\n }\n \n get topRight() {\n return new UIPoint(this.max.x, this.y)\n }\n \n get bottomLeft() {\n return new UIPoint(this.x, this.max.y)\n }\n \n get bottomRight() {\n return this.max.copy()\n }\n \n \n get center() {\n return this.min.copy().add(this.min.to(this.max).scale(0.5))\n }\n \n set center(center: UIPoint) {\n const offset = this.center.to(center)\n this.offsetByPoint(offset)\n }\n \n offsetByPoint(offset: UIPoint) {\n this.min.add(offset)\n this.max.add(offset)\n \n return this\n }\n \n \n concatenateWithRectangle(rectangle: UIRectangle) {\n this.updateByAddingPoint(rectangle.bottomRight)\n this.updateByAddingPoint(rectangle.topLeft)\n return this\n }\n \n \n intersectionRectangleWithRectangle(rectangle: UIRectangle): UIRectangle {\n \n const result = this.copy()\n \n result.beginUpdates()\n \n const min = result.min\n if (min.x === nil) {\n min.x = rectangle.max.x - Math.min(result.width, rectangle.width)\n }\n if (min.y === nil) {\n min.y = rectangle.max.y - Math.min(result.height, rectangle.height)\n }\n \n const max = result.max\n if (max.x === nil) {\n max.x = rectangle.min.x + Math.min(result.width, rectangle.width)\n }\n if (max.y === nil) {\n max.y = rectangle.min.y + Math.min(result.height, rectangle.height)\n }\n \n result.min.x = Math.max(result.min.x, rectangle.min.x)\n result.min.y = Math.max(result.min.y, rectangle.min.y)\n result.max.x = Math.min(result.max.x, rectangle.max.x)\n result.max.y = Math.min(result.max.y, rectangle.max.y)\n \n \n if (result.height < 0) {\n \n const averageY = (this.center.y + rectangle.center.y) * 0.5\n result.min.y = averageY\n result.max.y = averageY\n \n }\n \n if (result.width < 0) {\n \n const averageX = (this.center.x + rectangle.center.x) * 0.5\n result.min.x = averageX\n result.max.x = averageX\n \n }\n \n result.finishUpdates()\n \n return result\n \n }\n \n \n get area() {\n return this.height * this.width\n }\n \n \n intersectsWithRectangle(rectangle: UIRectangle) {\n return (this.intersectionRectangleWithRectangle(rectangle).area != 0)\n }\n \n \n // add some space around the rectangle\n rectangleWithInsets(left: number, right: number, bottom: number, top: number) {\n const result = this.copy()\n result.min.x = this.min.x + left\n result.max.x = this.max.x - right\n result.min.y = this.min.y + top\n result.max.y = this.max.y - bottom\n return result\n }\n \n rectangleWithInset(inset: number) {\n return this.rectangleWithInsets(inset, inset, inset, inset)\n }\n \n rectangleWithHeight(height: number, centeredOnPosition: number = nil) {\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.copy()\n result.height = height\n \n if (centeredOnPosition != nil) {\n const change = height - this.height\n result.offsetByPoint(new UIPoint(0, change * centeredOnPosition).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithWidth(width: number, centeredOnPosition: number = nil) {\n \n if (isNaN(centeredOnPosition)) {\n centeredOnPosition = nil\n }\n \n const result = this.copy()\n result.width = width\n \n if (centeredOnPosition != nil) {\n const change = width - this.width\n result.offsetByPoint(new UIPoint(change * centeredOnPosition, 0).scale(-1))\n }\n \n return result\n \n }\n \n rectangleWithHeightRelativeToWidth(heightRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithHeight(this.width * heightRatio, centeredOnPosition)\n }\n \n rectangleWithWidthRelativeToHeight(widthRatio: number = 1, centeredOnPosition: number = nil) {\n return this.rectangleWithWidth(this.height * widthRatio, centeredOnPosition)\n }\n \n rectangleWithX(x: number, centeredOnPosition: number = 0) {\n \n const result = this.copy()\n result.x = x - result.width * centeredOnPosition\n \n return result\n \n }\n \n rectangleWithY(y: number, centeredOnPosition: number = 0) {\n \n const result = this.copy()\n result.y = y - result.height * centeredOnPosition\n \n return result\n \n }\n \n \n rectangleByAddingX(x: number) {\n \n const result = this.copy()\n result.x = this.x + x\n \n return result\n \n }\n \n rectangleByAddingY(y: number) {\n \n const result = this.copy()\n result.y = this.y + y\n \n return result\n \n }\n \n \n rectangleWithRelativeValues(\n relativeXPosition: number,\n widthMultiplier: number,\n relativeYPosition: number,\n heightMultiplier: number\n ) {\n \n const result = this.copy()\n \n const width = result.width\n const height = result.height\n \n result.width = widthMultiplier * width\n result.height = heightMultiplier * height\n \n result.center = new UIPoint(\n relativeXPosition * width,\n relativeYPosition * height\n )\n \n return result\n \n }\n \n \n rectanglesBySplittingWidth(\n weights: number[],\n paddings: number | number[] = 0,\n absoluteWidths: number | number[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as number[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n if (!(absoluteWidths instanceof Array) && IS_NOT_NIL(absoluteWidths)) {\n absoluteWidths = [absoluteWidths].arrayByRepeating(weights.length)\n }\n \n const result: UIRectangle[] = []\n const sumOfWeights = weights.reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteWidths as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue\n const sumOfAbsoluteWidths = (absoluteWidths as number[]).summedValue\n const totalRelativeWidth = this.width - sumOfPaddings - sumOfAbsoluteWidths\n let previousCellMaxX = this.x\n \n for (let i = 0; i < weights.length; i++) {\n \n let resultWidth: number\n if (IS_NOT_NIL(absoluteWidths[i])) {\n resultWidth = absoluteWidths[i] || 0\n }\n else {\n resultWidth = totalRelativeWidth * (weights[i] / sumOfWeights)\n }\n \n const rectangle = this.rectangleWithWidth(resultWidth)\n \n let padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i]\n }\n \n rectangle.x = previousCellMaxX\n previousCellMaxX = rectangle.max.x + padding\n result.push(rectangle)\n \n }\n \n return result\n \n }\n \n rectanglesBySplittingHeight(\n weights: number[],\n paddings: number | number[] = 0,\n absoluteHeights: number | number[] = nil\n ) {\n \n if (IS_NIL(paddings)) {\n paddings = 1\n }\n if (!((paddings as any) instanceof Array)) {\n paddings = [paddings].arrayByRepeating(weights.length - 1)\n }\n paddings = (paddings as number[]).arrayByTrimmingToLengthIfLonger(weights.length - 1)\n if (!(absoluteHeights instanceof Array) && IS_NOT_NIL(absoluteHeights)) {\n absoluteHeights = [absoluteHeights].arrayByRepeating(weights.length)\n }\n \n const result: UIRectangle[] = []\n const sumOfWeights = weights.reduce(\n (a, b, index) => {\n if (IS_NOT_NIL((absoluteHeights as number[])[index])) {\n b = 0\n }\n return a + b\n },\n 0\n )\n const sumOfPaddings = paddings.summedValue\n const sumOfAbsoluteHeights = (absoluteHeights as number[]).summedValue\n const totalRelativeHeight = this.height - sumOfPaddings - sumOfAbsoluteHeights\n var previousCellMaxY = this.y\n \n for (var i = 0; i < weights.length; i++) {\n var resultHeight: number\n if (IS_NOT_NIL(absoluteHeights[i])) {\n \n resultHeight = absoluteHeights[i] || 0\n \n }\n else {\n \n resultHeight = totalRelativeHeight * (weights[i] / sumOfWeights)\n \n }\n \n const rectangle = this.rectangleWithHeight(resultHeight)\n \n var padding = 0\n if (paddings.length > i && paddings[i]) {\n padding = paddings[i]\n }\n \n rectangle.y = previousCellMaxY\n previousCellMaxY = rectangle.max.y + padding\n //rectangle = rectangle.rectangleWithInsets(0, 0, padding, 0);\n result.push(rectangle)\n }\n \n return result\n \n }\n \n \n rectanglesByEquallySplittingWidth(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultWidth = (this.width - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithWidth(resultWidth, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n rectanglesByEquallySplittingHeight(numberOfFrames: number, padding: number = 0) {\n const result: UIRectangle[] = []\n const totalPadding = padding * (numberOfFrames - 1)\n const resultHeight = (this.height - totalPadding) / numberOfFrames\n for (var i = 0; i < numberOfFrames; i++) {\n const rectangle = this.rectangleWithHeight(resultHeight, i / (numberOfFrames - 1))\n result.push(rectangle)\n }\n return result\n }\n \n \n distributeViewsAlongWidth(\n views: UIView[],\n weights: number | number[] = 1,\n paddings?: number | number[],\n absoluteWidths?: number | number[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingWidth(weights, paddings, absoluteWidths)\n frames.forEach((frame, index) => FIRST_OR_NIL(views[index]).frame = frame)\n return this\n }\n \n distributeViewsAlongHeight(\n views: UIView[],\n weights: number | number[] = 1,\n paddings?: number | number[],\n absoluteHeights?: number | number[]\n ) {\n if (!(weights instanceof Array)) {\n weights = [weights].arrayByRepeating(views.length)\n }\n const frames = this.rectanglesBySplittingHeight(weights, paddings, absoluteHeights)\n frames.forEach((frame, index) => FIRST_OR_NIL(views[index]).frame = frame)\n return this\n }\n \n \n distributeViewsEquallyAlongWidth(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingWidth(views.length, padding)\n frames.forEach((frame, index) => views[index].frame = frame)\n return this\n }\n \n distributeViewsEquallyAlongHeight(views: UIView[], padding: number) {\n const frames = this.rectanglesByEquallySplittingHeight(views.length, padding)\n frames.forEach((frame, index) => views[index].frame = frame)\n return this\n }\n \n \n rectangleForNextRow(padding: number = 0, height: number | ((constrainingWidth: number) => number) = this.height) {\n if (height instanceof Function) {\n height = height(this.width)\n }\n const result = this.rectangleWithY(this.max.y + padding)\n if (height != this.height) {\n result.height = height\n }\n return result\n }\n \n rectangleForNextColumn(padding: number = 0, width: number | ((constrainingHeight: number) => number) = this.width) {\n if (width instanceof Function) {\n width = width(this.height)\n }\n const result = this.rectangleWithX(this.max.x + padding)\n if (width != this.width) {\n result.width = width\n }\n return result\n }\n \n rectangleForPreviousRow(padding: number = 0) {\n return this.rectangleWithY(this.min.y - this.height - padding)\n }\n \n rectangleForPreviousColumn(padding: number = 0) {\n return this.rectangleWithX(this.min.x - this.width - padding)\n }\n \n \n // Bounding box\n static boundingBoxForPoints(points: string | any[]) {\n const result = new UIRectangle()\n for (let i = 0; i < points.length; i++) {\n result.updateByAddingPoint(points[i])\n }\n return result\n }\n \n \n beginUpdates() {\n this._isBeingUpdated = YES\n }\n \n finishUpdates() {\n this._isBeingUpdated = NO\n this.didChange()\n }\n \n \n didChange() {\n \n // Callback to be set by delegate\n \n }\n \n _rectanglePointDidChange() {\n if (!this._isBeingUpdated) {\n this.didChange()\n }\n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA6E;AAC7E,qBAAwB;AAIjB,MAAM,oBAAoB,yBAAS;AAAA,EAQtC,YAAY,IAAY,GAAG,IAAY,GAAG,SAAiB,GAAG,QAAgB,GAAG;AAE7E,UAAM;AAPV,mCAA4C;AASxC,SAAK,MAAM,IAAI,uBAAQ,OAAO,mBAAmB,OAAO,iBAAiB;AACzE,SAAK,MAAM,IAAI,uBAAQ,OAAO,mBAAmB,OAAO,iBAAiB;AAEzE,SAAK,IAAI,YAAY,CAAC,UAAU;AAC5B,WAAK,wBAAwB,KAAK;AAClC,WAAK,yBAAyB;AAAA,IAClC;AACA,SAAK,IAAI,YAAY,CAAC,UAAU;AAC5B,WAAK,wBAAwB,KAAK;AAClC,WAAK,yBAAyB;AAAA,IAClC;AAEA,SAAK,kBAAkB;AAEvB,SAAK,MAAM,IAAI,uBAAQ,GAAG,CAAC;AAC3B,SAAK,MAAM,IAAI,uBAAQ,IAAI,OAAO,IAAI,MAAM;AAE5C,YAAI,wBAAO,MAAM,GAAG;AAChB,WAAK,IAAI,IAAI;AAAA,IACjB;AAEA,YAAI,wBAAO,KAAK,GAAG;AACf,W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AAI,IAAI,KAAK,QAAQ,OAAO;AAAA,EAChE;AAAA,EAIA,OAAO,qBAAqB,QAAwB;AAChD,UAAM,SAAS,IAAI,YAAY;AAC/B,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK;AACpC,aAAO,oBAAoB,OAAO,EAAE;AAAA,IACxC;AACA,WAAO;AAAA,EACX;AAAA,EAGA,eAAe;AACX,SAAK,kBAAkB;AAAA,EAC3B;AAAA,EAEA,gBAAgB;AACZ,SAAK,kBAAkB;AACvB,SAAK,UAAU;AAAA,EACnB;AAAA,EAGA,YAAY;AAAA,EAIZ;AAAA,EAEA,2BAA2B;AACvB,QAAI,CAAC,KAAK,iBAAiB;AACvB,WAAK,UAAU;AAAA,IACnB;AAAA,EACJ;AAGJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UITableView.ts"],
4
- "sourcesContent": ["import { UIButton } from \"./UIButton\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\ninterface UITableViewRowView extends UIView {\n \n _UITableViewRowIndex: number;\n \n}\n\n\nexport interface UITableViewReusableViewsContainerObject {\n \n [key: string]: UIView[];\n \n}\n\n\nexport interface UITableViewReusableViewPositionObject {\n \n bottomY: number;\n topY: number;\n \n isValid: boolean;\n \n}\n\n\nexport class UITableView extends UINativeScrollView {\n \n \n allRowsHaveEqualHeight: boolean = NO\n _visibleRows: UITableViewRowView[] = []\n _firstLayoutVisibleRows: UITableViewRowView[] = []\n \n _rowPositions: UITableViewReusableViewPositionObject[] = []\n \n _highestValidRowPositionIndex: number = 0\n \n _reusableViews: UITableViewReusableViewsContainerObject = {}\n \n _removedReusableViews: UITableViewReusableViewsContainerObject = {}\n \n _fullHeightView: UIView\n \n _rowIDIndex: number = 0\n \n reloadsOnLanguageChange = YES\n \n sidePadding = 0\n \n _persistedData: any[] = []\n _needsDrawingOfVisibleRowsBeforeLayout = NO\n _isDrawVisibleRowsScheduled = NO\n _shouldAnimateNextLayout?: boolean\n \n override animationDuration = 0.25\n \n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this._fullHeightView = new UIView()\n this._fullHeightView.hidden = YES\n this._fullHeightView.userInteractionEnabled = NO\n this.addSubview(this._fullHeightView)\n \n this.scrollsX = NO\n \n }\n \n \n loadData() {\n \n this._persistedData = []\n \n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this.setNeedsLayout()\n \n }\n \n reloadData() {\n \n this._removeVisibleRows()\n this._removeAllReusableRows()\n \n this._rowPositions = []\n this._highestValidRowPositionIndex = 0\n \n this.loadData()\n \n }\n \n \n highlightChanges(previousData: any[], newData: any[]) {\n \n previousData = previousData.map(dataPoint => JSON.stringify(dataPoint))\n newData = newData.map(dataPoint => JSON.stringify(dataPoint))\n \n const newIndexes: number[] = []\n \n newData.forEach((value, index) => {\n \n if (!previousData.contains(value)) {\n \n newIndexes.push(index)\n \n }\n \n })\n \n newIndexes.forEach(index => {\n \n if (this.isRowWithIndexVisible(index)) {\n this.highlightRowAsNew(this.viewForRowWithIndex(index) as UIView)\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n \n if (this._rowPositions[index]) {\n this._rowPositions[index].isValid = NO\n }\n \n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n \n // if (index == 0) {\n \n // this._highestValidRowPositionIndex = 0;\n \n // this._rowPositions = [];\n \n // }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this._shouldAnimateNextLayout = animateChange\n \n }\n \n \n _calculateAllPositions() {\n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n }\n \n _calculatePositionsUntilIndex(maxIndex: number) {\n \n var validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]\n if (!IS(validPositionObject)) {\n validPositionObject = {\n bottomY: 0,\n topY: 0,\n isValid: YES\n }\n }\n \n var previousBottomY = validPositionObject.bottomY\n \n if (!this._rowPositions.length) {\n \n this._highestValidRowPositionIndex = -1\n \n }\n \n for (var i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {\n \n var height: number\n \n const rowPositionObject = this._rowPositions[i]\n \n if (IS((rowPositionObject || nil).isValid)) {\n \n height = rowPositionObject.bottomY - rowPositionObject.topY\n \n }\n else {\n \n height = this.heightForRowWithIndex(i)\n \n }\n \n \n const positionObject: UITableViewReusableViewPositionObject = {\n bottomY: previousBottomY + height,\n topY: previousBottomY,\n isValid: YES\n }\n \n if (i < this._rowPositions.length) {\n this._rowPositions[i] = positionObject\n }\n else {\n this._rowPositions.push(positionObject)\n }\n this._highestValidRowPositionIndex = i\n previousBottomY = previousBottomY + height\n \n }\n \n }\n \n \n indexesForVisibleRows(paddingRatio = 0.5): number[] {\n \n const firstVisibleY = this.contentOffset.y - this.bounds.height * paddingRatio\n const lastVisibleY = firstVisibleY + this.bounds.height * (1 + paddingRatio)\n \n const numberOfRows = this.numberOfRows()\n \n if (this.allRowsHaveEqualHeight) {\n \n const rowHeight = this.heightForRowWithIndex(0)\n \n var firstIndex = firstVisibleY / rowHeight\n var lastIndex = lastVisibleY / rowHeight\n \n firstIndex = Math.trunc(firstIndex)\n lastIndex = Math.trunc(lastIndex) + 1\n \n firstIndex = Math.max(firstIndex, 0)\n lastIndex = Math.min(lastIndex, numberOfRows - 1)\n \n var result = []\n for (var i = firstIndex; i < lastIndex + 1; i++) {\n result.push(i)\n }\n return result\n }\n \n var accumulatedHeight = 0\n var result = []\n \n this._calculateAllPositions()\n \n const rowPositions = this._rowPositions\n \n for (var i = 0; i < numberOfRows; i++) {\n \n const height = rowPositions[i].bottomY - rowPositions[i].topY // this.heightForRowWithIndex(i)\n \n accumulatedHeight = accumulatedHeight + height\n if (accumulatedHeight >= firstVisibleY) {\n result.push(i)\n }\n if (accumulatedHeight >= lastVisibleY) {\n break\n }\n \n }\n \n return result\n \n }\n \n \n _removeVisibleRows() {\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n \n })\n this._visibleRows = visibleRows\n \n }\n \n \n _removeAllReusableRows() {\n this._reusableViews.forEach((rows: UIView[]) =>\n rows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n \n this._markReusableViewAsUnused(row)\n \n })\n )\n }\n \n \n _markReusableViewAsUnused(row: UIView) {\n if (!this._removedReusableViews[row._UITableViewReusabilityIdentifier].contains(row)) {\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n }\n }\n \n _drawVisibleRows() {\n \n if (!this.isMemberOfViewTree) {\n return\n }\n \n const visibleIndexes = this.indexesForVisibleRows()\n \n const minIndex = visibleIndexes[0]\n const maxIndex = visibleIndexes[visibleIndexes.length - 1]\n \n const removedViews: UITableViewRowView[] = []\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row) => {\n if (row._UITableViewRowIndex < minIndex || row._UITableViewRowIndex > maxIndex) {\n \n //row.removeFromSuperview();\n \n this._persistedData[row._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex,\n row\n )\n \n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n removedViews.push(row)\n \n }\n else {\n visibleRows.push(row)\n }\n })\n this._visibleRows = visibleRows\n \n visibleIndexes.forEach((rowIndex: number) => {\n \n if (this.isRowWithIndexVisible(rowIndex)) {\n return\n }\n const view: UITableViewRowView = this.viewForRowWithIndex(rowIndex)\n //view._UITableViewRowIndex = rowIndex;\n this._firstLayoutVisibleRows.push(view)\n this._visibleRows.push(view)\n this.addSubview(view)\n \n })\n \n for (let i = 0; i < removedViews.length; i++) {\n \n const view = removedViews[i]\n if (this._visibleRows.indexOf(view) == -1) {\n \n //this._persistedData[view._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(view._UITableViewRowIndex, view);\n view.removeFromSuperview()\n \n //this._removedReusableViews[view._UITableViewReusabilityIdentifier].push(view);\n \n }\n \n }\n \n //this.setNeedsLayout();\n \n }\n \n \n visibleRowWithIndex(rowIndex: number | undefined): UIView {\n for (var i = 0; i < this._visibleRows.length; i++) {\n const row = this._visibleRows[i]\n if (row._UITableViewRowIndex == rowIndex) {\n return row\n }\n }\n return nil\n }\n \n \n isRowWithIndexVisible(rowIndex: number) {\n return IS(this.visibleRowWithIndex(rowIndex))\n }\n \n \n reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView {\n \n if (!this._removedReusableViews[identifier]) {\n this._removedReusableViews[identifier] = []\n }\n \n if (this._removedReusableViews[identifier] && this._removedReusableViews[identifier].length) {\n \n const view = this._removedReusableViews[identifier].pop() as UITableViewRowView\n view._UITableViewRowIndex = rowIndex\n Object.assign(view, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n return view\n \n }\n \n if (!this._reusableViews[identifier]) {\n this._reusableViews[identifier] = []\n }\n \n const newView = this.newReusableViewForIdentifier(identifier, this._rowIDIndex) as UITableViewRowView\n this._rowIDIndex = this._rowIDIndex + 1\n \n newView._UITableViewReusabilityIdentifier = identifier\n newView._UITableViewRowIndex = rowIndex\n \n Object.assign(newView, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n this._reusableViews[identifier].push(newView)\n \n return newView\n \n }\n \n \n // Functions that should be overridden to draw the correct content START\n newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView {\n \n const view = new UIButton(this.elementID + \"Row\" + rowIDIndex)\n \n view.stopsPointerEventPropagation = NO\n view.pausesPointerEvents = NO\n \n return view\n \n }\n \n heightForRowWithIndex(index: number): number {\n return 50\n }\n \n numberOfRows() {\n return 10000\n }\n \n defaultRowPersistenceDataItem(): any {\n \n \n }\n \n persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any {\n \n \n }\n \n viewForRowWithIndex(rowIndex: number): UITableViewRowView {\n const row = this.reusableViewForIdentifier(\"Row\", rowIndex);\n (row as UIButton).titleLabel.text = \"Row \" + rowIndex\n return row\n }\n \n // Functions that should be overridden to draw the correct content END\n \n \n // Functions that trigger redrawing of the content\n override didScrollToPosition(offsetPosition: UIPoint) {\n \n super.didScrollToPosition(offsetPosition)\n \n this.forEachViewInSubtree(function (view: UIView) {\n \n view._isPointerValid = NO\n \n })\n \n if (!this._isDrawVisibleRowsScheduled) {\n \n this._isDrawVisibleRowsScheduled = YES\n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this.setNeedsLayout()\n \n this._isDrawVisibleRowsScheduled = NO\n \n }.bind(this))\n \n }\n \n }\n \n override wasAddedToViewTree() {\n this.loadData()\n }\n \n override setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean) {\n \n const frame = this.frame\n super.setFrame(rectangle, zIndex, performUncheckedLayout)\n if (frame.isEqualTo(rectangle) && !performUncheckedLayout) {\n return\n }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged && this.reloadsOnLanguageChange) {\n \n this.reloadData()\n \n }\n \n \n }\n \n \n private _layoutAllRows(positions = this._rowPositions) {\n \n const bounds = this.bounds\n \n this._visibleRows.forEach(row => {\n \n const frame = bounds.copy()\n \n const positionObject = positions[row._UITableViewRowIndex]\n frame.min.y = positionObject.topY\n frame.max.y = positionObject.bottomY\n row.frame = frame\n \n row.style.width = \"\" + (bounds.width - this.sidePadding * 2).integerValue + \"px\"\n row.style.left = \"\" + this.sidePadding.integerValue + \"px\"\n \n \n })\n \n this._fullHeightView.frame = bounds.rectangleWithHeight((positions.lastElement ||\n nil).bottomY).rectangleWithWidth(bounds.width * 0.5)\n \n this._firstLayoutVisibleRows = []\n \n }\n \n private _animateLayoutAllRows() {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this._visibleRows,\n this.animationDuration,\n 0,\n undefined,\n function (this: UITableView) {\n \n this._layoutAllRows()\n \n }.bind(this),\n function (this: UITableView) {\n \n // this._calculateAllPositions()\n // this._layoutAllRows()\n \n }.bind(this)\n )\n \n }\n \n \n override layoutSubviews() {\n \n const previousPositions: UITableViewReusableViewPositionObject[] = JSON.parse(JSON.stringify(this._rowPositions))\n \n const previousVisibleRowsLength = this._visibleRows.length\n \n if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n //this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this._needsDrawingOfVisibleRowsBeforeLayout = NO\n \n }\n \n \n super.layoutSubviews()\n \n \n if (!this.numberOfRows() || !this.isMemberOfViewTree) {\n \n return\n \n }\n \n \n if (this._shouldAnimateNextLayout) {\n \n \n // Need to do layout with the previous positions\n \n this._layoutAllRows(previousPositions)\n \n \n if (previousVisibleRowsLength < this._visibleRows.length) {\n \n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._animateLayoutAllRows()\n \n }.bind(this))\n \n }\n else {\n \n this._animateLayoutAllRows()\n \n }\n \n \n this._shouldAnimateNextLayout = NO\n \n }\n else {\n \n // if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n // this._drawVisibleRows();\n \n // this._needsDrawingOfVisibleRowsBeforeLayout = NO;\n \n // }\n \n this._calculateAllPositions()\n \n this._layoutAllRows()\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n \n var result = 0\n \n this._calculateAllPositions()\n \n if (this._rowPositions.length) {\n \n result = this._rowPositions[this._rowPositions.length - 1].bottomY\n \n }\n \n return result\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAmC;AACnC,sBAAiC;AAGjC,oBAA6C;AA2BtC,MAAM,oBAAoB,6CAAmB;AAAA,EA+BhD,YAAY,WAAoB;AAE5B,UAAM,SAAS;AA9BnB,kCAAkC;AAClC,wBAAqC,CAAC;AACtC,mCAAgD,CAAC;AAEjD,yBAAyD,CAAC;AAE1D,yCAAwC;AAExC,0BAA0D,CAAC;AAE3D,iCAAiE,CAAC;AAIlE,uBAAsB;AAEtB,mCAA0B;AAE1B,uBAAc;AAEd,0BAAwB,CAAC;AACzB,kDAAyC;AACzC,uCAA8B;AAG9B,SAAS,oBAAoB;AAOzB,SAAK,kBAAkB,IAAI,qBAAO;AAClC,SAAK,gBAAgB,SAAS;AAC9B,SAAK,gBAAgB,yBAAyB;AAC9C,SAAK,WAAW,KAAK,eAAe;AAEpC,SAAK,WAAW;AAAA,EAEpB;AAAA,EAGA,WAAW;AAEP,SAAK,iBAAiB,CAAC;AAEvB,SAAK,8BAA8B,KAAK,aAAa,IAAI,CAAC;AAC1D,SAAK,yCAAyC;AAE9C,SAAK,eAAe;AAAA,EAExB;AAAA,EAEA,aAAa;AAET,SAAK,mBAAmB;AACxB,SAAK,uBAAuB;AAE5B,SAAK,gBAAgB,CAAC;AACtB,SAAK,gCAAgC;AAErC,SAAK,SAAS;AAAA,EAElB;AAAA,EAGA,iBAAiB,cAAqB,SAAgB;AAElD,mBAAe,aAAa,IAAI,eAAa,KAAK,UAAU,SAAS,CAAC;AACtE,cAAU,QAAQ,IAAI,eAAa,K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;AAAA,IAEJ;AAGA,QAAI,KAAK,0BAA0B;AAK/B,WAAK,eAAe,iBAAiB;AAGrC,UAAI,4BAA4B,KAAK,aAAa,QAAQ;AAGtD,6BAAO,2BAA2B,WAA6B;AAE3D,eAAK,sBAAsB;AAAA,QAE/B,EAAE,KAAK,IAAI,CAAC;AAAA,MAEhB,OACK;AAED,aAAK,sBAAsB;AAAA,MAE/B;AAGA,WAAK,2BAA2B;AAAA,IAEpC,OACK;AAUD,WAAK,uBAAuB;AAE5B,WAAK,eAAe;AAAA,IAGxB;AAAA,EAGJ;AAAA,EAGS,uBAAuB,oBAAoB,GAAG;AAGnD,QAAI,SAAS;AAEb,SAAK,uBAAuB;AAE5B,QAAI,KAAK,cAAc,QAAQ;AAE3B,eAAS,KAAK,cAAc,KAAK,cAAc,SAAS,GAAG;AAAA,IAE/D;AAEA,WAAO;AAAA,EAEX;AAGJ;",
4
+ "sourcesContent": ["import { UIButton } from \"./UIButton\"\nimport { UINativeScrollView } from \"./UINativeScrollView\"\nimport { IS, nil, NO, YES } from \"./UIObject\"\nimport { UIPoint } from \"./UIPoint\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\ninterface UITableViewRowView extends UIView {\n \n _UITableViewRowIndex: number;\n \n}\n\n\nexport interface UITableViewReusableViewsContainerObject {\n \n [key: string]: UIView[];\n \n}\n\n\nexport interface UITableViewReusableViewPositionObject {\n \n bottomY: number;\n topY: number;\n \n isValid: boolean;\n \n}\n\n\nexport class UITableView extends UINativeScrollView {\n \n \n allRowsHaveEqualHeight: boolean = NO\n _visibleRows: UITableViewRowView[] = []\n _firstLayoutVisibleRows: UITableViewRowView[] = []\n \n _rowPositions: UITableViewReusableViewPositionObject[] = []\n \n _highestValidRowPositionIndex: number = 0\n \n _reusableViews: UITableViewReusableViewsContainerObject = {}\n \n _removedReusableViews: UITableViewReusableViewsContainerObject = {}\n \n _fullHeightView: UIView\n \n _rowIDIndex: number = 0\n \n reloadsOnLanguageChange = YES\n \n sidePadding = 0\n \n _persistedData: any[] = []\n _needsDrawingOfVisibleRowsBeforeLayout = NO\n _isDrawVisibleRowsScheduled = NO\n _shouldAnimateNextLayout?: boolean\n \n override animationDuration = 0.25\n \n \n constructor(elementID?: string) {\n \n super(elementID)\n \n this._fullHeightView = new UIView()\n this._fullHeightView.hidden = YES\n this._fullHeightView.userInteractionEnabled = NO\n this.addSubview(this._fullHeightView)\n \n this.scrollsX = NO\n \n }\n \n \n loadData() {\n \n this._persistedData = []\n \n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this.setNeedsLayout()\n \n }\n \n reloadData() {\n \n this._removeVisibleRows()\n this._removeAllReusableRows()\n \n this._rowPositions = []\n this._highestValidRowPositionIndex = 0\n \n this.loadData()\n \n }\n \n \n highlightChanges(previousData: any[], newData: any[]) {\n \n previousData = previousData.map(dataPoint => JSON.stringify(dataPoint))\n newData = newData.map(dataPoint => JSON.stringify(dataPoint))\n \n const newIndexes: number[] = []\n \n newData.forEach((value, index) => {\n \n if (!previousData.contains(value)) {\n \n newIndexes.push(index)\n \n }\n \n })\n \n newIndexes.forEach(index => {\n \n if (this.isRowWithIndexVisible(index)) {\n this.highlightRowAsNew(this.viewForRowWithIndex(index) as UIView)\n }\n \n })\n \n }\n \n \n highlightRowAsNew(row: UIView) {\n \n \n }\n \n \n invalidateSizeOfRowWithIndex(index: number, animateChange = NO) {\n \n if (this._rowPositions[index]) {\n this._rowPositions[index].isValid = NO\n }\n \n this._highestValidRowPositionIndex = Math.min(this._highestValidRowPositionIndex, index - 1)\n \n // if (index == 0) {\n \n // this._highestValidRowPositionIndex = 0;\n \n // this._rowPositions = [];\n \n // }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n this._shouldAnimateNextLayout = animateChange\n \n }\n \n \n _calculateAllPositions() {\n this._calculatePositionsUntilIndex(this.numberOfRows() - 1)\n }\n \n _calculatePositionsUntilIndex(maxIndex: number) {\n \n var validPositionObject = this._rowPositions[this._highestValidRowPositionIndex]\n if (!IS(validPositionObject)) {\n validPositionObject = {\n bottomY: 0,\n topY: 0,\n isValid: YES\n }\n }\n \n var previousBottomY = validPositionObject.bottomY\n \n if (!this._rowPositions.length) {\n \n this._highestValidRowPositionIndex = -1\n \n }\n \n for (var i = this._highestValidRowPositionIndex + 1; i <= maxIndex; i++) {\n \n var height: number\n \n const rowPositionObject = this._rowPositions[i]\n \n if (IS((rowPositionObject || nil).isValid)) {\n \n height = rowPositionObject.bottomY - rowPositionObject.topY\n \n }\n else {\n \n height = this.heightForRowWithIndex(i)\n \n }\n \n \n const positionObject: UITableViewReusableViewPositionObject = {\n bottomY: previousBottomY + height,\n topY: previousBottomY,\n isValid: YES\n }\n \n if (i < this._rowPositions.length) {\n this._rowPositions[i] = positionObject\n }\n else {\n this._rowPositions.push(positionObject)\n }\n this._highestValidRowPositionIndex = i\n previousBottomY = previousBottomY + height\n \n }\n \n }\n \n \n indexesForVisibleRows(paddingRatio = 0.5): number[] {\n \n const firstVisibleY = this.contentOffset.y - this.bounds.height * paddingRatio\n const lastVisibleY = firstVisibleY + this.bounds.height * (1 + paddingRatio)\n \n const numberOfRows = this.numberOfRows()\n \n if (this.allRowsHaveEqualHeight) {\n \n const rowHeight = this.heightForRowWithIndex(0)\n \n var firstIndex = firstVisibleY / rowHeight\n var lastIndex = lastVisibleY / rowHeight\n \n firstIndex = Math.trunc(firstIndex)\n lastIndex = Math.trunc(lastIndex) + 1\n \n firstIndex = Math.max(firstIndex, 0)\n lastIndex = Math.min(lastIndex, numberOfRows - 1)\n \n var result = []\n for (var i = firstIndex; i < lastIndex + 1; i++) {\n result.push(i)\n }\n return result\n }\n \n var accumulatedHeight = 0\n var result = []\n \n this._calculateAllPositions()\n \n const rowPositions = this._rowPositions\n \n for (var i = 0; i < numberOfRows; i++) {\n \n const height = rowPositions[i].bottomY - rowPositions[i].topY // this.heightForRowWithIndex(i)\n \n accumulatedHeight = accumulatedHeight + height\n if (accumulatedHeight >= firstVisibleY) {\n result.push(i)\n }\n if (accumulatedHeight >= lastVisibleY) {\n break\n }\n \n }\n \n return result\n \n }\n \n \n _removeVisibleRows() {\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n \n })\n this._visibleRows = visibleRows\n \n }\n \n \n _removeAllReusableRows() {\n this._reusableViews.forEach((rows: UIView[]) =>\n rows.forEach((row: UIView) => {\n \n this._persistedData[row._UITableViewRowIndex as number] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex as number,\n row\n )\n row.removeFromSuperview()\n \n this._markReusableViewAsUnused(row)\n \n })\n )\n }\n \n \n _markReusableViewAsUnused(row: UIView) {\n if (!this._removedReusableViews[row._UITableViewReusabilityIdentifier].contains(row)) {\n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n }\n }\n \n _drawVisibleRows() {\n \n if (!this.isMemberOfViewTree) {\n return\n }\n \n const visibleIndexes = this.indexesForVisibleRows()\n \n const minIndex = visibleIndexes[0]\n const maxIndex = visibleIndexes[visibleIndexes.length - 1]\n \n const removedViews: UITableViewRowView[] = []\n \n const visibleRows: UITableViewRowView[] = []\n this._visibleRows.forEach((row) => {\n if (row._UITableViewRowIndex < minIndex || row._UITableViewRowIndex > maxIndex) {\n \n //row.removeFromSuperview();\n \n this._persistedData[row._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(\n row._UITableViewRowIndex,\n row\n )\n \n this._removedReusableViews[row._UITableViewReusabilityIdentifier].push(row)\n \n removedViews.push(row)\n \n }\n else {\n visibleRows.push(row)\n }\n })\n this._visibleRows = visibleRows\n \n visibleIndexes.forEach((rowIndex: number) => {\n \n if (this.isRowWithIndexVisible(rowIndex)) {\n return\n }\n const view: UITableViewRowView = this.viewForRowWithIndex(rowIndex)\n //view._UITableViewRowIndex = rowIndex;\n this._firstLayoutVisibleRows.push(view)\n this._visibleRows.push(view)\n this.addSubview(view)\n \n })\n \n for (let i = 0; i < removedViews.length; i++) {\n \n const view = removedViews[i]\n if (this._visibleRows.indexOf(view) == -1) {\n \n //this._persistedData[view._UITableViewRowIndex] = this.persistenceDataItemForRowWithIndex(view._UITableViewRowIndex, view);\n view.removeFromSuperview()\n \n //this._removedReusableViews[view._UITableViewReusabilityIdentifier].push(view);\n \n }\n \n }\n \n //this.setNeedsLayout();\n \n }\n \n \n visibleRowWithIndex(rowIndex: number | undefined): UIView {\n for (var i = 0; i < this._visibleRows.length; i++) {\n const row = this._visibleRows[i]\n if (row._UITableViewRowIndex == rowIndex) {\n return row\n }\n }\n return nil\n }\n \n \n isRowWithIndexVisible(rowIndex: number) {\n return IS(this.visibleRowWithIndex(rowIndex))\n }\n \n \n reusableViewForIdentifier(identifier: string, rowIndex: number): UITableViewRowView {\n \n if (!this._removedReusableViews[identifier]) {\n this._removedReusableViews[identifier] = []\n }\n \n if (this._removedReusableViews[identifier] && this._removedReusableViews[identifier].length) {\n \n const view = this._removedReusableViews[identifier].pop() as UITableViewRowView\n view._UITableViewRowIndex = rowIndex\n Object.assign(view, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n return view\n \n }\n \n if (!this._reusableViews[identifier]) {\n this._reusableViews[identifier] = []\n }\n \n const newView = this.newReusableViewForIdentifier(identifier, this._rowIDIndex) as UITableViewRowView\n this._rowIDIndex = this._rowIDIndex + 1\n \n newView._UITableViewReusabilityIdentifier = identifier\n newView._UITableViewRowIndex = rowIndex\n \n Object.assign(newView, this._persistedData[rowIndex] || this.defaultRowPersistenceDataItem())\n this._reusableViews[identifier].push(newView)\n \n return newView\n \n }\n \n \n // Functions that should be overridden to draw the correct content START\n newReusableViewForIdentifier(identifier: string, rowIDIndex: number): UIView {\n \n const view = new UIButton(this.elementID + \"Row\" + rowIDIndex)\n \n view.stopsPointerEventPropagation = NO\n view.pausesPointerEvents = NO\n \n return view\n \n }\n \n heightForRowWithIndex(index: number): number {\n return 50\n }\n \n numberOfRows() {\n return 10000\n }\n \n defaultRowPersistenceDataItem(): any {\n \n \n }\n \n persistenceDataItemForRowWithIndex(rowIndex: number, row: UIView): any {\n \n \n }\n \n viewForRowWithIndex(rowIndex: number): UITableViewRowView {\n const row = this.reusableViewForIdentifier(\"Row\", rowIndex);\n (row as unknown as UIButton).titleLabel.text = \"Row \" + rowIndex\n return row\n }\n \n // Functions that should be overridden to draw the correct content END\n \n \n // Functions that trigger redrawing of the content\n override didScrollToPosition(offsetPosition: UIPoint) {\n \n super.didScrollToPosition(offsetPosition)\n \n this.forEachViewInSubtree(function (view: UIView) {\n \n view._isPointerValid = NO\n \n })\n \n if (!this._isDrawVisibleRowsScheduled) {\n \n this._isDrawVisibleRowsScheduled = YES\n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this.setNeedsLayout()\n \n this._isDrawVisibleRowsScheduled = NO\n \n }.bind(this))\n \n }\n \n }\n \n override wasAddedToViewTree() {\n this.loadData()\n }\n \n override setFrame(rectangle: UIRectangle, zIndex?: number, performUncheckedLayout?: boolean) {\n \n const frame = this.frame\n super.setFrame(rectangle, zIndex, performUncheckedLayout)\n if (frame.isEqualTo(rectangle) && !performUncheckedLayout) {\n return\n }\n \n this._needsDrawingOfVisibleRowsBeforeLayout = YES\n \n }\n \n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n \n super.didReceiveBroadcastEvent(event)\n \n if (event.name == UIView.broadcastEventName.LanguageChanged && this.reloadsOnLanguageChange) {\n \n this.reloadData()\n \n }\n \n \n }\n \n \n private _layoutAllRows(positions = this._rowPositions) {\n \n const bounds = this.bounds\n \n this._visibleRows.forEach(row => {\n \n const frame = bounds.copy()\n \n const positionObject = positions[row._UITableViewRowIndex]\n frame.min.y = positionObject.topY\n frame.max.y = positionObject.bottomY\n row.frame = frame\n \n row.style.width = \"\" + (bounds.width - this.sidePadding * 2).integerValue + \"px\"\n row.style.left = \"\" + this.sidePadding.integerValue + \"px\"\n \n \n })\n \n this._fullHeightView.frame = bounds.rectangleWithHeight((positions.lastElement ||\n nil).bottomY).rectangleWithWidth(bounds.width * 0.5)\n \n this._firstLayoutVisibleRows = []\n \n }\n \n private _animateLayoutAllRows() {\n \n UIView.animateViewOrViewsWithDurationDelayAndFunction(\n this._visibleRows,\n this.animationDuration,\n 0,\n undefined,\n function (this: UITableView) {\n \n this._layoutAllRows()\n \n }.bind(this),\n function (this: UITableView) {\n \n // this._calculateAllPositions()\n // this._layoutAllRows()\n \n }.bind(this)\n )\n \n }\n \n \n override layoutSubviews() {\n \n const previousPositions: UITableViewReusableViewPositionObject[] = JSON.parse(JSON.stringify(this._rowPositions))\n \n const previousVisibleRowsLength = this._visibleRows.length\n \n if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n //this._calculateAllPositions()\n \n this._drawVisibleRows()\n \n this._needsDrawingOfVisibleRowsBeforeLayout = NO\n \n }\n \n \n super.layoutSubviews()\n \n \n if (!this.numberOfRows() || !this.isMemberOfViewTree) {\n \n return\n \n }\n \n \n if (this._shouldAnimateNextLayout) {\n \n \n // Need to do layout with the previous positions\n \n this._layoutAllRows(previousPositions)\n \n \n if (previousVisibleRowsLength < this._visibleRows.length) {\n \n \n UIView.runFunctionBeforeNextFrame(function (this: UITableView) {\n \n this._animateLayoutAllRows()\n \n }.bind(this))\n \n }\n else {\n \n this._animateLayoutAllRows()\n \n }\n \n \n this._shouldAnimateNextLayout = NO\n \n }\n else {\n \n // if (this._needsDrawingOfVisibleRowsBeforeLayout) {\n \n // this._drawVisibleRows();\n \n // this._needsDrawingOfVisibleRowsBeforeLayout = NO;\n \n // }\n \n this._calculateAllPositions()\n \n this._layoutAllRows()\n \n \n }\n \n \n }\n \n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n \n var result = 0\n \n this._calculateAllPositions()\n \n if (this._rowPositions.length) {\n \n result = this._rowPositions[this._rowPositions.length - 1].bottomY\n \n }\n \n return result\n \n }\n \n \n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyB;AACzB,gCAAmC;AACnC,sBAAiC;AAGjC,oBAA6C;AA2BtC,MAAM,oBAAoB,6CAAmB;AAAA,EA+BhD,YAAY,WAAoB;AAE5B,UAAM,SAAS;AA9BnB,kCAAkC;AAClC,wBAAqC,CAAC;AACtC,mCAAgD,CAAC;AAEjD,yBAAyD,CAAC;AAE1D,yCAAwC;AAExC,0BAA0D,CAAC;AAE3D,iCAAiE,CAAC;AAIlE,uBAAsB;AAEtB,mCAA0B;AAE1B,uBAAc;AAEd,0BAAwB,CAAC;AACzB,kDAAyC;AACzC,uCAA8B;AAG9B,SAAS,oBAAoB;AAOzB,SAAK,kBAAkB,IAAI,qBAAO;AAClC,SAAK,gBAAgB,SAAS;AAC9B,SAAK,gBAAgB,yBAAyB;AAC9C,SAAK,WAAW,KAAK,eAAe;AAEpC,SAAK,WAAW;AAAA,EAEpB;AAAA,EAGA,WAAW;AAEP,SAAK,iBAAiB,CAAC;AAEvB,SAAK,8BAA8B,KAAK,aAAa,IAAI,CAAC;AAC1D,SAAK,yCAAyC;AAE9C,SAAK,eAAe;AAAA,EAExB;AAAA,EAEA,aAAa;AAET,SAAK,mBAAmB;AACxB,SAAK,uBAAuB;AAE5B,SAAK,gBAAgB,CAAC;AACtB,SAAK,gCAAgC;AAErC,SAAK,SAAS;AAAA,EAElB;AAAA,EAGA,iBAAiB,cAAqB,SAAgB;AAElD,mBAAe,aAAa,IAAI,eAAa,KAAK,UAAU,SAAS,CAAC;AACtE,cAAU,QAAQ,IAAI,eAAa,KAAK,UAAU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J;AAGA,QAAI,KAAK,0BAA0B;AAK/B,WAAK,eAAe,iBAAiB;AAGrC,UAAI,4BAA4B,KAAK,aAAa,QAAQ;AAGtD,6BAAO,2BAA2B,WAA6B;AAE3D,eAAK,sBAAsB;AAAA,QAE/B,EAAE,KAAK,IAAI,CAAC;AAAA,MAEhB,OACK;AAED,aAAK,sBAAsB;AAAA,MAE/B;AAGA,WAAK,2BAA2B;AAAA,IAEpC,OACK;AAUD,WAAK,uBAAuB;AAE5B,WAAK,eAAe;AAAA,IAGxB;AAAA,EAGJ;AAAA,EAGS,uBAAuB,oBAAoB,GAAG;AAGnD,QAAI,SAAS;AAEb,SAAK,uBAAuB;AAE5B,QAAI,KAAK,cAAc,QAAQ;AAE3B,eAAS,KAAK,cAAc,KAAK,cAAc,SAAS,GAAG;AAAA,IAE/D;AAEA,WAAO;AAAA,EAEX;AAGJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uicore-ts",
3
- "version": "1.0.218",
3
+ "version": "1.0.222",
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",
@@ -229,14 +229,14 @@ export class UIFunctionExtender<T extends (...args: any) => any> {
229
229
 
230
230
  extendedFunction(functionToExtend: T) {
231
231
  const extendingFunction = this.extendingFunction
232
-
232
+
233
233
  function extendedFunction(this: any, ...objects: any[]) {
234
234
  const boundFunctionToExtend = functionToExtend.bind(this)
235
235
  boundFunctionToExtend(...objects)
236
236
  const boundExtendingFunction = extendingFunction.bind(this)
237
237
  boundExtendingFunction(...objects)
238
238
  }
239
-
239
+
240
240
  extendedFunction.extendedFunction = functionToExtend
241
241
  return extendedFunction
242
242
  }
@@ -270,7 +270,7 @@ export class UILazyPropertyValue<T> {
270
270
  isValueInitialized = YES
271
271
  this.initFunction = nil
272
272
  }
273
-
273
+
274
274
  // @ts-ignore
275
275
  if (delete target[key]) {
276
276
 
@@ -315,7 +315,7 @@ export type UIInitializerObject<T> = {
315
315
  export class UIObject {
316
316
 
317
317
  constructor() {
318
-
318
+
319
319
  // Do something here if needed
320
320
 
321
321
  }
@@ -376,7 +376,7 @@ export class UIObject {
376
376
 
377
377
  const keys = keyPath.split(".")
378
378
  let currentObject = object
379
-
379
+
380
380
  for (let i = 0; i < keys.length; i++) {
381
381
 
382
382
  const key = keys[i]
@@ -439,9 +439,9 @@ export class UIObject {
439
439
 
440
440
 
441
441
  configureWithObject(object: UIInitializerObject<this>) {
442
-
442
+
443
443
  return UIObject.configureWithObject(this, object)
444
-
444
+
445
445
  }
446
446
 
447
447
  configuredWithObject(object: UIInitializerObject<this>): this {
@@ -557,14 +557,14 @@ export class UIObject {
557
557
  value.callFunction(getTargetFunction(YES))
558
558
  return
559
559
  }
560
-
560
+
561
561
  if (value instanceof UIFunctionExtender) {
562
562
  value = value.extendedFunction(getTargetFunction())
563
563
  }
564
-
564
+
565
565
  UIObject.setValueForKeyPath(keyPath, UIObject.valueForKeyPath(keyPath, configurationTarget), result, YES)
566
566
  UIObject.setValueForKeyPath(keyPath, value, configurationTarget, YES)
567
-
567
+
568
568
  })
569
569
 
570
570
 
@@ -578,6 +578,35 @@ export class UIObject {
578
578
  }
579
579
 
580
580
 
581
+ get methods(): {
582
+ [P in keyof this]: this[P] extends (...args: any) => any ? this[P] : never
583
+ } {
584
+
585
+ const thisObject = this as any
586
+
587
+ const result = new Proxy({ "name": "BoundFunctionRetriever" }, {
588
+
589
+ get(target, key: string) {
590
+
591
+ const thisObjectElement = thisObject[key]
592
+
593
+ if (thisObjectElement instanceof Function) {
594
+
595
+ return thisObjectElement.bind(thisObject)
596
+
597
+ }
598
+
599
+ return undefined
600
+
601
+ }
602
+
603
+ }) as any
604
+
605
+ return result
606
+
607
+ }
608
+
609
+
581
610
  performFunctionWithSelf<T>(functionToPerform: (self: this) => T): T {
582
611
  return functionToPerform(this)
583
612
  }
@@ -571,9 +571,9 @@ export class UIRectangle extends UIObject {
571
571
  }
572
572
 
573
573
 
574
- rectangleForNextRow(padding: number = 0, height: number | UIView = this.height) {
575
- if (height instanceof UIView) {
576
- height = height.intrinsicContentHeight(this.width)
574
+ rectangleForNextRow(padding: number = 0, height: number | ((constrainingWidth: number) => number) = this.height) {
575
+ if (height instanceof Function) {
576
+ height = height(this.width)
577
577
  }
578
578
  const result = this.rectangleWithY(this.max.y + padding)
579
579
  if (height != this.height) {
@@ -582,9 +582,9 @@ export class UIRectangle extends UIObject {
582
582
  return result
583
583
  }
584
584
 
585
- rectangleForNextColumn(padding: number = 0, width: number | UIView = this.width) {
586
- if (width instanceof UIView) {
587
- width = width.intrinsicContentWidth(this.height)
585
+ rectangleForNextColumn(padding: number = 0, width: number | ((constrainingHeight: number) => number) = this.width) {
586
+ if (width instanceof Function) {
587
+ width = width(this.height)
588
588
  }
589
589
  const result = this.rectangleWithX(this.max.x + padding)
590
590
  if (width != this.width) {
@@ -460,7 +460,7 @@ export class UITableView extends UINativeScrollView {
460
460
 
461
461
  viewForRowWithIndex(rowIndex: number): UITableViewRowView {
462
462
  const row = this.reusableViewForIdentifier("Row", rowIndex);
463
- (row as UIButton).titleLabel.text = "Row " + rowIndex
463
+ (row as unknown as UIButton).titleLabel.text = "Row " + rowIndex
464
464
  return row
465
465
  }
466
466