UNPKG

uicore-ts

Version:

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 tha

79 lines (78 loc) 2.69 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var UILinkButton_exports = {}; __export(UILinkButton_exports, { UILinkButton: () => UILinkButton }); module.exports = __toCommonJS(UILinkButton_exports); var import_UIButton = require("./UIButton"); var import_UILink = require("./UILink"); const _UILinkButton = class extends import_UILink.UILink { constructor(elementID, elementType, titleType) { super(elementID); this.controlEvent = _UILinkButton.controlEvent; this.button = new import_UIButton.UIButton(this.elementID + "Button", elementType, titleType); this.addSubview(this.button); this.style.position = "absolute"; this.button.controlEventTargetAccumulator.PrimaryActionTriggered = (sender, event) => { window.location = this.target; this.sendControlEventForKey(import_UIButton.UIButton.controlEvent.PrimaryActionTriggered, event); }; } get controlEventTargetAccumulator() { return super.controlEventTargetAccumulator; } get titleLabel() { return this.button.titleLabel; } get imageView() { return this.button.imageView; } set colors(colors) { this.button.colors = colors; } get colors() { return this.button.colors; } get viewHTMLElement() { return super.viewHTMLElement; } set target(target) { this.viewHTMLElement.setAttribute("href", target); } get target() { var _a; return (_a = this.viewHTMLElement.getAttribute("href")) != null ? _a : ""; } layoutSubviews() { super.layoutSubviews(); const bounds = this.bounds; this.button.frame = bounds; this.button.layoutSubviews(); } }; let UILinkButton = _UILinkButton; UILinkButton.controlEvent = Object.assign({}, import_UILink.UILink.controlEvent, { "PrimaryActionTriggered": "PrimaryActionTriggered" }); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { UILinkButton }); //# sourceMappingURL=UILinkButton.js.map