From 03138b1c8dfae8d66ae17c078d4d95657c6686db Mon Sep 17 00:00:00 2001 From: Dmitry Voytsekhovskiy Date: Thu, 21 Jul 2016 11:48:49 +0300 Subject: [PATCH] Release 0.2.3 --- dist/Angara.Html.css | 150 +++++++++++++++++++++++++++++++++++++++++++ dist/Angara.Show.js | 58 +++++++++++++++++ dist/Primitive.js | 20 ++++++ dist/Record.js | 21 ++++++ dist/Seq.js | 21 ++++++ 5 files changed, 270 insertions(+) create mode 100644 dist/Angara.Html.css create mode 100644 dist/Angara.Show.js create mode 100644 dist/Primitive.js create mode 100644 dist/Record.js create mode 100644 dist/Seq.js diff --git a/dist/Angara.Html.css b/dist/Angara.Html.css new file mode 100644 index 0000000..6387a25 --- /dev/null +++ b/dist/Angara.Html.css @@ -0,0 +1,150 @@ +.angara-html { + padding: 0; + margin: 0; + height: 100%; + font-family: "Segoe UI", "Helvetica", "Tahoma", "Arial"; + font-size: 15px; + line-height: 20px; +} + +/* https://msdn.microsoft.com/en-us//library/windows/apps/hh700394.aspx */ + +/* header */ +header, h1 { + font-family: "Segoe UI Light"; + font-size: 46px; + line-height: 56px; +} + +/* subheader */ +h2 { + font-family: "Segoe UI Light"; + font-size: 34px; + line-height: 40px; +} + +/* title */ +h3 { + font-family: "Segoe UI Semilight"; + font-size: 24px; + line-height: 28px; +} + +/* subtitle */ +h4 { + font-family: "Segoe UI"; + font-size: 20px; + line-height: 24px; +} + +/* caption */ +.angara-show-caption { + font-family: "Segoe UI"; + font-size: 15px; + line-height: 14px; +} + +.angara-show-caption-type { + font-family: "Segoe UI"; + font-size: 12px; + line-height: 14px; + margin-left: 20px; +} + +.flexible-container { + min-height: 100%; + height: 100%; + display: -webkit-box; + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -moz-box-orient: vertical; + -moz-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; +} + + .flexible-container > header { + background-color: rgb(0,122,204); + color: white; + padding-left: 20px; + padding-right: 20px; + } + + .flexible-container > div { + position: relative; + -webkit-box-flex: 1; + -webkit-flex: 1; + -moz-box-flex: 1; + -ms-flex: 1; + flex: 1; + display: -webkit-box; + display: -webkit-flex; + display: -moz-box; + display: -ms-flexbox; + display: flex; + -webkit-box-pack: center; + -webkit-justify-content: center; + -moz-box-pack: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + -webkit-flex-direction: column; + -moz-box-orient: vertical; + -moz-box-direction: normal; + -ms-flex-direction: column; + flex-direction: column; + } + + .flexible-container > div > div { + width: 100%; + height: 100%; + position: absolute; + top: 0px; + } + + .flexible-container > div > div > div { + width: 100%; + height: 100%; + position: relative; + } + + +.angara-show-errormessage { + color: orangered; + padding: 20px; + font-size: larger; +} + +.angara-show-content { +} + +.angara-show-primitive { + padding-top: 20px; + padding-bottom: 20px; +} + +.angara-show-string { + word-wrap: break-word; /* IE>=5.5 */ + white-space: pre; /* IE>=6 */ + white-space: -moz-pre-wrap; /* For Fx<=2 */ + white-space: pre-wrap; /* Fx>3, Opera>8, Safari>3*/ +} + +.angara-show-seq-item-header { + padding: 14px; + padding-left: 20px; + margin-bottom: 1px; + background-color: rgb(147, 198, 235); + /*background-color: rgb(109, 175, 224);*/ + color: white; +} + +.angara-show-seq-item-content { + padding-left: 20px; +} diff --git a/dist/Angara.Show.js b/dist/Angara.Show.js new file mode 100644 index 0000000..e988573 --- /dev/null +++ b/dist/Angara.Show.js @@ -0,0 +1,58 @@ +define(["require", "exports", "jquery"], function (require, exports, $) { + var endsWith = function (searchString, position) { + var subjectString = this.toString(); + if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { + position = subjectString.length; + } + position -= searchString.length; + var lastIndex = subjectString.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }; + var descr = function (module, type) { + return { module: module, type: type }; + }; + var describeContent = function (content, typeIdPropertyName) { + if (content === undefined || content === null) + return descr("Primitive", ""); + if (typeof content[typeIdPropertyName] === "string") { + var typeId = content[typeIdPropertyName]; + return descr(typeId, typeId); + } + if (Array.isArray(content)) + return descr("Seq", "array"); + var tp = typeof (content); + if (tp === "boolean" || tp === "number" || tp === "string") + return descr("Primitive", tp); + if (content instanceof Date) + return descr("Primitive", "date"); + return descr("Record", "record"); + }; + var errFailedToLoad = function (err, module) { + var errorMessage = "Failed to load a viewer module \"" + module + "\""; + if (err.requireType) + errorMessage += " (" + err.requireType + ")"; + return errorMessage; + }; + exports.Show = function (content, container) { + $(container).addClass("angara-show-content").html("Loading..."); + var dsc = describeContent(content, "__angara_typeId"); + require([dsc.module], function (viewer) { + $(container).html(""); + return viewer.Show(content, container); + }, function (err) { + var module2 = null; + if (Array.isArray(content)) + module2 = "Seq"; + else + module2 = "Record"; + require([module2], function (viewer) { + $(container).html(""); + return viewer.Show(content, container); + }, function (err) { + $(container).html(errFailedToLoad(err, dsc.module)).addClass("angara-show-errormessage"); + }); + }); + return dsc.type; + }; +}); +//# sourceMappingURL=Angara.Show.js.map \ No newline at end of file diff --git a/dist/Primitive.js b/dist/Primitive.js new file mode 100644 index 0000000..c8593a9 --- /dev/null +++ b/dist/Primitive.js @@ -0,0 +1,20 @@ +define(["require", "exports", "jquery"], function (require, exports, $) { + exports.Show = function (content, container) { + var $value = $("
").addClass("angara-show-primitive").appendTo($(container)); + if (content === undefined) + $value.text("The value is "); + else if (content === null) + $value.text("The value is "); + else if (typeof (content) === "boolean") + $value.text(content); + else if (content instanceof Date) + $value.text(content.toLocaleString()); + else if (typeof (content) === "number") + $value.text(content); + else if (typeof (content) === "string") + $value.addClass("angara-show-string").text(content); + else + $value.addClass("angara-show-errormessage").text("Unsupported data type"); + }; +}); +//# sourceMappingURL=Primitive.js.map \ No newline at end of file diff --git a/dist/Record.js b/dist/Record.js new file mode 100644 index 0000000..b571f7c --- /dev/null +++ b/dist/Record.js @@ -0,0 +1,21 @@ +define(["require", "exports", "jquery", "Angara.Show"], function (require, exports, $, Angara) { + exports.Show = function (content, container) { + var $container = $(container); + var $value = $("
").addClass("angara-show-record").appendTo($container); + for (var prop in content) { + if (prop == "__angara_typeId") + continue; + var $el = $("
").addClass("angara-show-seq-item").appendTo($value); + var $head = $("
").addClass("angara-show-seq-item-header").appendTo($el); + var $head_name = $("").addClass("angara-show-caption").appendTo($head); + $head_name.text(prop); + var $item = $("
").addClass("angara-show-seq-item-content").appendTo($el); + var itemType = Angara.Show(content[prop], $item[0]); + if (itemType) { + var $head_type = $("").addClass("angara-show-caption-type").appendTo($head); + $head_type.text(itemType); + } + } + }; +}); +//# sourceMappingURL=Record.js.map \ No newline at end of file diff --git a/dist/Seq.js b/dist/Seq.js new file mode 100644 index 0000000..4a547d0 --- /dev/null +++ b/dist/Seq.js @@ -0,0 +1,21 @@ +define(["require", "exports", "jquery", "Angara.Show"], function (require, exports, $, Angara) { + exports.Show = function (content, container) { + var buildItemHtml = function (idx, item, $container) { + var $el = $("
").addClass("angara-show-seq-item").appendTo($container); + var $head = $("
").addClass("angara-show-seq-item-header").appendTo($el); + var $head_name = $("").addClass("angara-show-caption").appendTo($head); + $head_name.text(idx.toString()); + var $item = $("
").addClass("angara-show-seq-item-content").appendTo($el); + var itemType = Angara.Show(item, $item[0]); + if (itemType) { + var $head_type = $("").addClass("angara-show-caption-type").appendTo($head); + $head_type.text(itemType); + } + }; + var $container = $(container); + for (var i = 0; i < content.length; i++) { + buildItemHtml(i, content[i], $container); + } + }; +}); +//# sourceMappingURL=Seq.js.map \ No newline at end of file