Skip to content

Commit

Permalink
added LabelValuePair to tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Aug 22, 2018
1 parent 636f71d commit c62aba9
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 169 deletions.
100 changes: 50 additions & 50 deletions dist/client/manifesto.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,56 @@ var Manifesto;
Manifesto.LanguageMap = LanguageMap;
})(Manifesto || (Manifesto = {}));

var Manifesto;
(function (Manifesto) {
var LabelValuePair = /** @class */ (function () {
function LabelValuePair(defaultLocale) {
this.defaultLocale = defaultLocale;
}
LabelValuePair.prototype.parse = function (resource) {
this.resource = resource;
this.label = Manifesto.LanguageMap.parse(this.resource.label, this.defaultLocale);
this.value = Manifesto.LanguageMap.parse(this.resource.value, this.defaultLocale);
};
// shortcuts to get/set values based on default locale
LabelValuePair.prototype.getLabel = function () {
if (this.label) {
return Manifesto.LanguageMap.getValue(this.label, this.defaultLocale);
}
return null;
};
LabelValuePair.prototype.setLabel = function (value) {
var _this = this;
if (this.label && this.label.length) {
var t = this.label.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
LabelValuePair.prototype.getValue = function () {
if (this.value) {
var locale = this.defaultLocale;
// if the label has a locale, prefer that to the default locale
if (this.label.length && this.label[0].locale) {
locale = this.label[0].locale;
}
return Manifesto.LanguageMap.getValue(this.value, locale);
}
return null;
};
LabelValuePair.prototype.setValue = function (value) {
var _this = this;
if (this.value && this.value.length) {
var t = this.value.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
return LabelValuePair;
}());
Manifesto.LabelValuePair = LabelValuePair;
})(Manifesto || (Manifesto = {}));

var Manifesto;
(function (Manifesto) {
var Size = /** @class */ (function () {
Expand Down Expand Up @@ -3510,56 +3560,6 @@ var Manifesto;




var Manifesto;
(function (Manifesto) {
var LabelValuePair = /** @class */ (function () {
function LabelValuePair(defaultLocale) {
this.defaultLocale = defaultLocale;
}
LabelValuePair.prototype.parse = function (resource) {
this.resource = resource;
this.label = Manifesto.LanguageMap.parse(this.resource.label, this.defaultLocale);
this.value = Manifesto.LanguageMap.parse(this.resource.value, this.defaultLocale);
};
// shortcuts to get/set values based on default locale
LabelValuePair.prototype.getLabel = function () {
if (this.label) {
return Manifesto.LanguageMap.getValue(this.label, this.defaultLocale);
}
return null;
};
LabelValuePair.prototype.setLabel = function (value) {
var _this = this;
if (this.label && this.label.length) {
var t = this.label.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
LabelValuePair.prototype.getValue = function () {
if (this.value) {
var locale = this.defaultLocale;
// if the label has a locale, prefer that to the default locale
if (this.label.length && this.label[0].locale) {
locale = this.label[0].locale;
}
return Manifesto.LanguageMap.getValue(this.value, locale);
}
return null;
};
LabelValuePair.prototype.setValue = function (value) {
var _this = this;
if (this.value && this.value.length) {
var t = this.value.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
return LabelValuePair;
}());
Manifesto.LabelValuePair = LabelValuePair;
})(Manifesto || (Manifesto = {}));

var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
Expand Down
102 changes: 51 additions & 51 deletions dist/client/manifesto.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v3.0.1 https://github.com/iiif-commons/manifesto
// manifesto v3.0.2 https://github.com/iiif-commons/manifesto
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.manifesto = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global){

Expand Down Expand Up @@ -3171,6 +3171,56 @@ var Manifesto;
Manifesto.LanguageMap = LanguageMap;
})(Manifesto || (Manifesto = {}));

var Manifesto;
(function (Manifesto) {
var LabelValuePair = /** @class */ (function () {
function LabelValuePair(defaultLocale) {
this.defaultLocale = defaultLocale;
}
LabelValuePair.prototype.parse = function (resource) {
this.resource = resource;
this.label = Manifesto.LanguageMap.parse(this.resource.label, this.defaultLocale);
this.value = Manifesto.LanguageMap.parse(this.resource.value, this.defaultLocale);
};
// shortcuts to get/set values based on default locale
LabelValuePair.prototype.getLabel = function () {
if (this.label) {
return Manifesto.LanguageMap.getValue(this.label, this.defaultLocale);
}
return null;
};
LabelValuePair.prototype.setLabel = function (value) {
var _this = this;
if (this.label && this.label.length) {
var t = this.label.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
LabelValuePair.prototype.getValue = function () {
if (this.value) {
var locale = this.defaultLocale;
// if the label has a locale, prefer that to the default locale
if (this.label.length && this.label[0].locale) {
locale = this.label[0].locale;
}
return Manifesto.LanguageMap.getValue(this.value, locale);
}
return null;
};
LabelValuePair.prototype.setValue = function (value) {
var _this = this;
if (this.value && this.value.length) {
var t = this.value.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
return LabelValuePair;
}());
Manifesto.LabelValuePair = LabelValuePair;
})(Manifesto || (Manifesto = {}));

var Manifesto;
(function (Manifesto) {
var Size = /** @class */ (function () {
Expand Down Expand Up @@ -3438,56 +3488,6 @@ var Manifesto;




var Manifesto;
(function (Manifesto) {
var LabelValuePair = /** @class */ (function () {
function LabelValuePair(defaultLocale) {
this.defaultLocale = defaultLocale;
}
LabelValuePair.prototype.parse = function (resource) {
this.resource = resource;
this.label = Manifesto.LanguageMap.parse(this.resource.label, this.defaultLocale);
this.value = Manifesto.LanguageMap.parse(this.resource.value, this.defaultLocale);
};
// shortcuts to get/set values based on default locale
LabelValuePair.prototype.getLabel = function () {
if (this.label) {
return Manifesto.LanguageMap.getValue(this.label, this.defaultLocale);
}
return null;
};
LabelValuePair.prototype.setLabel = function (value) {
var _this = this;
if (this.label && this.label.length) {
var t = this.label.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
LabelValuePair.prototype.getValue = function () {
if (this.value) {
var locale = this.defaultLocale;
// if the label has a locale, prefer that to the default locale
if (this.label.length && this.label[0].locale) {
locale = this.label[0].locale;
}
return Manifesto.LanguageMap.getValue(this.value, locale);
}
return null;
};
LabelValuePair.prototype.setValue = function (value) {
var _this = this;
if (this.value && this.value.length) {
var t = this.value.en().where(function (x) { return x.locale === _this.defaultLocale || x.locale === Manifesto.Utils.getInexactLocale(_this.defaultLocale); }).first();
if (t)
t.value = value;
}
};
return LabelValuePair;
}());
Manifesto.LabelValuePair = LabelValuePair;
})(Manifesto || (Manifesto = {}));

var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
Expand Down
32 changes: 16 additions & 16 deletions dist/manifesto.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// manifesto v3.0.1 https://github.com/iiif-commons/manifesto
// manifesto v3.0.2 https://github.com/iiif-commons/manifesto

declare namespace Manifesto {
class StringValue {
Expand Down Expand Up @@ -597,6 +597,21 @@ declare namespace Manifesto {
}
}

declare namespace Manifesto {
class LabelValuePair {
label: LanguageMap;
value: LanguageMap;
defaultLocale: string;
resource: any;
constructor(defaultLocale: string);
parse(resource: any): void;
getLabel(): string | null;
setLabel(value: string): void;
getValue(): string | null;
setValue(value: string): void;
}
}

declare namespace Manifesto {
class Size {
width: number;
Expand Down Expand Up @@ -959,21 +974,6 @@ declare namespace Manifesto {
}
}

declare namespace Manifesto {
class LabelValuePair {
label: LanguageMap;
value: LanguageMap;
defaultLocale: string;
resource: any;
constructor(defaultLocale: string);
parse(resource: any): void;
getLabel(): string | null;
setLabel(value: string): void;
getValue(): string | null;
setValue(value: string): void;
}
}

declare namespace Manifesto {
class Thumbnail extends Resource implements IThumbnail {
constructor(jsonld: any, options: IManifestoOptions);
Expand Down
102 changes: 51 additions & 51 deletions dist/server/manifesto.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "manifesto.js",
"version": "3.0.1",
"version": "3.0.2",
"description": "IIIF Presentation API utility library for client and server",
"main": "./dist/server/manifesto.js",
"types": "./dist/manifesto.d.ts",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"src/MetadataItem.ts",
"src/Language.ts",
"src/LanguageMap.ts",
"src/LabelValuePair.ts",
"src/Size.ts",
"src/Manifesto.ts"
],
Expand Down

0 comments on commit c62aba9

Please sign in to comment.