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

96 lines (95 loc) 3.02 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 UILink_exports = {}; __export(UILink_exports, { UILink: () => UILink }); module.exports = __toCommonJS(UILink_exports); var import_UIBaseButton = require("./UIBaseButton"); var import_UICore = require("./UICore"); var import_UIObject = require("./UIObject"); var import_UIRoute = require("./UIRoute"); class UILink extends import_UIBaseButton.UIBaseButton { constructor(elementID) { super(elementID, "a"); this.stopsPointerEventPropagation = import_UIObject.NO; this.pausesPointerEvents = import_UIObject.NO; this.viewHTMLElement.onclick = this.blur.bind(this); } get colors() { return this._colors; } set colors(value) { this._colors = value; } get viewHTMLElement() { return super.viewHTMLElement; } set text(text) { this.viewHTMLElement.textContent = text; } get text() { var _a; return (_a = this.viewHTMLElement.textContent) != null ? _a : ""; } set target(target) { this.viewHTMLElement.setAttribute("href", target); } get target() { var _a; return (_a = this.viewHTMLElement.getAttribute("href")) != null ? _a : ""; } set targetRouteForCurrentState(targetRouteForCurrentState) { this._targetRouteForCurrentState = targetRouteForCurrentState; this.updateTarget(); } get targetRouteForCurrentState() { return this._targetRouteForCurrentState; } _targetRouteForCurrentState() { return import_UIRoute.UIRoute.currentRoute.routeByRemovingComponentsOtherThanOnesNamed(["settings"]); } didReceiveBroadcastEvent(event) { super.didReceiveBroadcastEvent(event); if (event.name == import_UICore.UICore.broadcastEventName.RouteDidChange) { this.updateTarget(); } } wasAddedToViewTree() { super.wasAddedToViewTree(); this.updateTarget(); } updateTarget() { const route = this.targetRouteForCurrentState(); if (route instanceof import_UIRoute.UIRoute) { this.target = route.linkRepresentation; return; } this.target = route; } layoutSubviews() { super.layoutSubviews(); const bounds = this.bounds; } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { UILink }); //# sourceMappingURL=UILink.js.map