New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

itemsholdr

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itemsholdr - npm Package Compare versions

Comparing version 0.6.1 to 0.7.0

.vscode/settings.json

85

package.json
{
"name": "itemsholdr",
"description": "Cache-based wrapper around localStorage.",
"version": "0.6.1",
"author": {
"name": "Josh Goldberg",
"email": "joshuakgoldberg@outlook.com"
},
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/ItemsHoldr.git"
},
"bugs": {
"url": "https://github.com/FullScreenShenanigans/ItemsHoldr/issues"
},
"license": "MIT",
"devDependencies": {
"gulp-shenanigans": "0.6.X"
}
"author": {
"email": "joshuakgoldberg@outlook.com",
"name": "Josh Goldberg"
},
"bugs": {
"url": "https://github.com/FullScreenShenanigans/ItemsHoldr/issues"
},
"dependencies": {},
"description": "Cache-based wrapper around localStorage.",
"devDependencies": {
"@types/chai": "^4.0.4",
"@types/lolex": "^1.5.32",
"@types/mocha": "^2.2.44",
"@types/sinon": "^4.0.0",
"@types/sinon-chai": "^2.7.29",
"chai": "^4.1.2",
"glob": "^7.1.2",
"gulp": "^3.9.1",
"gulp-shenanigans": "^0.6.17",
"lolex": "^2.3.0",
"mocha": "^4.0.1",
"mocha-headless-chrome": "^1.7.1",
"requirejs": "^2.3.5",
"run-for-every-file": "^1.0.4",
"shenanigans-manager": "^0.2.1",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"tslint": "5.8.0",
"typedoc": "^0.9.0",
"typescript": "^2.6.2",
"webpack": "^3.10.0"
},
"license": "MIT",
"name": "itemsholdr",
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/ItemsHoldr.git"
},
"scripts": {
"dist": "npm run dist:webpack",
"dist:webpack": "webpack --config webpack.config.js",
"docs": "npm run docs:typedoc",
"docs:typedoc": "typedoc src/ --out docs/generated",
"gulp": "gulp",
"init": "npm install && npm run setup && npm run verify",
"setup": "npm run setup:copy && npm run setup:package",
"setup:copy": "npm run setup:copy:default",
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\"",
"setup:package": "shenanigans-manager hydrate-package-json",
"src": "npm run src:tsc && npm run src:tslint",
"src:tsc": "tsc -p .",
"src:tslint": "tslint -c tslint.json -p tsconfig.json -t stylish",
"test": "npm run test:setup && npm run test:run",
"test:run": "mocha-headless-chrome --file test/index.html",
"test:setup": "npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
"test:setup:copy": "npm run test:setup:copy:default",
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\"",
"test:setup:html": "shenanigans-manager generate-test-html",
"test:setup:tsc": "tsc -p test",
"verify": "npm run src && npm run test && npm run dist && npm run docs",
"watch": "tsc -p . -w"
},
"shenanigans": {
"name": "ItemsHoldr"
},
"types": "./src/index.d.ts",
"version": "0.7.0"
}

@@ -0,1 +1,2 @@

<!-- {{Top}} -->
# ItemsHoldr

@@ -6,17 +7,10 @@ [![Build Status](https://travis-ci.org/FullScreenShenanigans/ItemsHoldr.svg?branch=master)](https://travis-ci.org/FullScreenShenanigans/ItemsHoldr)

Cache-based wrapper around localStorage.
<!-- {{/Top}} -->
<!-- {{Development}} -->
## Development
See [Documentation/Development](https://github.com/FullScreenShenanigans/Documentation).
## Build Process
ItemsHoldr uses [Gulp](http://gulpjs.com/) to automate building, which requires [Node.js](http://node.js.org).
To build from scratch, install NodeJS and run the following commands:
```
npm install -g gulp
npm install
gulp
```
See [Build Details](https://github.com/FullScreenShenanigans/Documentation/blob/master/Build%20Details.md) for detailed Gulp usage.
<!-- {{/Development}} -->

@@ -25,6 +25,2 @@ import { IItemValue, IItemValueDefaults } from "./IItemValue";

/**
* Arguments to pass to triggered callback Functions.
*/
callbackArgs?: any[];
/**
* A localStorage object to use instead of the global localStorage.

@@ -41,20 +37,5 @@ */

defaults?: IItemValueDefaults;
/**
* Any hardcoded changes to element content.
*/
displayChanges?: {
[i: string]: string;
};
/**
* Whether an HTML container should be created to house the IItemValue elements.
*/
doMakeContainer?: boolean;
/**
* Arguments to pass to create the container, if not the default div and className.
*/
containersArguments?: [string, any][];
}
/**
* A versatile container to store and manipulate values in localStorage, and
* optionally keep an updated HTML container showing these values.
* A versatile container to store and manipulate values in localStorage.
*/

@@ -85,20 +66,2 @@ export interface IItemsHoldr {

/**
* @returns The container HTML element, if it exists.
*/
getContainer(): HTMLElement;
/**
* @returns createElement arguments for HTML containers, outside-to-inside.
*/
getContainersArguments(): [string, any][];
/**
* @returns Any hard-coded changes to element content.
*/
getDisplayChanges(): {
[i: string]: string;
};
/**
* @returns Arguments to be passed to triggered event callbacks.
*/
getCallbackArgs(): any[];
/**
* @returns String keys for each of the stored IItemValues.

@@ -139,16 +102,13 @@ */

/**
* Clears a value from the listing, and removes its element from the
* container (if they both exist).
* Clears a value from the listing.
*
* @param key The key of the element to remove.
* @param key The key of the value to remove.
*/
removeItem(key: string): void;
/**
* Completely clears all values from the ItemsHoldr, removing their
* elements from the container (if they both exist) as well.
* Completely clears all values from the ItemsHoldr.
*/
clear(): void;
/**
* Sets the value for the ItemValue under the given key, then updates the ItemValue
* (including the ItemValue's element and localStorage, if needed).
* Sets the value for the ItemValue under the given key.
*

@@ -185,3 +145,3 @@ * @param key The key of the ItemValue.

*
* @param key
* @param key Key of an ItemValue.
*/

@@ -199,63 +159,2 @@ checkExistence(key: string): void;

saveAll(): void;
/**
* Hides the container Element by setting its visibility to hidden.
*/
hideContainer(): void;
/**
* Shows the container Element by setting its visibility to visible.
*/
displayContainer(): void;
/**
* Creates the container Element, which contains a child for each ItemValue that
* specifies hasElement to be true.
*
* @param containers An Array representing the Element to be created and the
* children between it and the contained ItemValues.
* Each contained Object has a String tag name as its
* first member, followed by any number of Objects to apply
* via createElement.
* @returns A newly created Element that can be used as a container.
*/
makeContainer(containers: [string, any][]): HTMLElement;
/**
* @returns Whether displayChanges has an entry for a particular value.
*/
hasDisplayChange(value: string): boolean;
/**
* @returns The displayChanges entry for a particular value.
*/
getDisplayChange(value: string): string;
/**
* Creates a new HTMLElement of the given type. For each Object given as
* arguments after, each member is proliferated onto the element.
*
* @param tag The type of the HTMLElement (by default, "div").
* @param args Any number of Objects to be proliferated onto the
* new HTMLElement.
* @returns A newly created HTMLElement of the given tag.
*/
createElement(tag?: string, ...args: any[]): HTMLElement;
/**
* Proliferates all members of the donor to the recipient recursively, as
* a deep copy.
*
* @param recipient An object receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
proliferate(recipient: any, donor: any, noOverride?: boolean): any;
/**
* Identical to proliferate, but tailored for HTML elements because many
* element attributes don't play nicely with JavaScript Array standards.
* Looking at you, HTMLCollection!
*
* @param recipient An HTMLElement receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
proliferateElement(recipient: any, donor: any, noOverride?: boolean): any;
}
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJJSXRlbXNIb2xkci5qcyIsInNvdXJjZXNDb250ZW50IjpbXX0=

@@ -30,7 +30,2 @@ import { IItemValue, IItemValueDefaults } from "./IItemValue";

/**
* Arguments to pass to triggered callback Functions.
*/
callbackArgs?: any[];
/**
* A localStorage object to use instead of the global localStorage.

@@ -49,22 +44,6 @@ */

defaults?: IItemValueDefaults;
/**
* Any hardcoded changes to element content.
*/
displayChanges?: { [i: string]: string };
/**
* Whether an HTML container should be created to house the IItemValue elements.
*/
doMakeContainer?: boolean;
/**
* Arguments to pass to create the container, if not the default div and className.
*/
containersArguments?: [string, any][];
}
/**
* A versatile container to store and manipulate values in localStorage, and
* optionally keep an updated HTML container showing these values.
* A versatile container to store and manipulate values in localStorage.
*/

@@ -98,22 +77,2 @@ export interface IItemsHoldr {

/**
* @returns The container HTML element, if it exists.
*/
getContainer(): HTMLElement;
/**
* @returns createElement arguments for HTML containers, outside-to-inside.
*/
getContainersArguments(): [string, any][];
/**
* @returns Any hard-coded changes to element content.
*/
getDisplayChanges(): { [i: string]: string };
/**
* @returns Arguments to be passed to triggered event callbacks.
*/
getCallbackArgs(): any[];
/**
* @returns String keys for each of the stored IItemValues.

@@ -153,3 +112,3 @@ */

* Adds a new key & value pair to by linking to a newly created ItemValue.
*
*
* @param key The key to reference by new ItemValue by.

@@ -162,6 +121,5 @@ * @param settings The settings for the new ItemValue.

/**
* Clears a value from the listing, and removes its element from the
* container (if they both exist).
*
* @param key The key of the element to remove.
* Clears a value from the listing.
*
* @param key The key of the value to remove.
*/

@@ -171,4 +129,3 @@ removeItem(key: string): void;

/**
* Completely clears all values from the ItemsHoldr, removing their
* elements from the container (if they both exist) as well.
* Completely clears all values from the ItemsHoldr.
*/

@@ -178,5 +135,4 @@ clear(): void;

/**
* Sets the value for the ItemValue under the given key, then updates the ItemValue
* (including the ItemValue's element and localStorage, if needed).
*
* Sets the value for the ItemValue under the given key.
*
* @param key The key of the ItemValue.

@@ -190,3 +146,3 @@ * @param value The new value for the ItemValue.

* Numbers or concatenation for Strings.
*
*
* @param key The key of the ItemValue.

@@ -200,3 +156,3 @@ * @param amount The amount to increase by (by default, 1).

* Numbers or concatenation for Strings.
*
*
* @param key The key of the ItemValue.

@@ -209,3 +165,3 @@ * @param amount The amount to increase by (by default, 1).

* Toggles whether a value is true or false.
*
*
* @param key The key of the ItemValue.

@@ -218,4 +174,4 @@ */

* allowed, it creates it; otherwise, it throws an Error.
*
* @param key
*
* @param key Key of an ItemValue.
*/

@@ -226,3 +182,3 @@ checkExistence(key: string): void;

* Manually saves an item's value to localStorage, ignoring the autoSave flag.
*
*
* @param key The key of the item to save.

@@ -233,74 +189,5 @@ */

/**
* Manually saves all values to localStorage, ignoring the autoSave flag.
* Manually saves all values to localStorage, ignoring the autoSave flag.
*/
saveAll(): void;
/**
* Hides the container Element by setting its visibility to hidden.
*/
hideContainer(): void;
/**
* Shows the container Element by setting its visibility to visible.
*/
displayContainer(): void;
/**
* Creates the container Element, which contains a child for each ItemValue that
* specifies hasElement to be true.
*
* @param containers An Array representing the Element to be created and the
* children between it and the contained ItemValues.
* Each contained Object has a String tag name as its
* first member, followed by any number of Objects to apply
* via createElement.
* @returns A newly created Element that can be used as a container.
*/
makeContainer(containers: [string, any][]): HTMLElement;
/**
* @returns Whether displayChanges has an entry for a particular value.
*/
hasDisplayChange(value: string): boolean;
/**
* @returns The displayChanges entry for a particular value.
*/
getDisplayChange(value: string): string;
/**
* Creates a new HTMLElement of the given type. For each Object given as
* arguments after, each member is proliferated onto the element.
*
* @param tag The type of the HTMLElement (by default, "div").
* @param args Any number of Objects to be proliferated onto the
* new HTMLElement.
* @returns A newly created HTMLElement of the given tag.
*/
createElement(tag?: string, ...args: any[]): HTMLElement;
/**
* Proliferates all members of the donor to the recipient recursively, as
* a deep copy.
*
* @param recipient An object receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
proliferate(recipient: any, donor: any, noOverride?: boolean): any;
/**
* Identical to proliferate, but tailored for HTML elements because many
* element attributes don't play nicely with JavaScript Array standards.
* Looking at you, HTMLCollection!
*
* @param recipient An HTMLElement receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
proliferateElement(recipient: any, donor: any, noOverride?: boolean): any;
}

@@ -37,10 +37,2 @@ /**

/**
* Whether an Element should be created and synced to the value.
*/
hasElement?: boolean;
/**
* An Element tag to use in creating the element, if hasElement is true.
*/
elementTag?: string;
/**
* A minimum value for the value to equal, if value is a number.

@@ -79,4 +71,3 @@ */

/**
* Storage container for a single IItemsHoldr value. The value may have triggers
* assigned to value, modularity, and other triggers, as well as an HTML element.
* Storage container for a single IItemsHoldr value.
*/

@@ -96,9 +87,3 @@ export interface IItemValue {

/**
* @returns The stored HTML element, if it exists.
*/
getElement(): HTMLElement;
/**
* General update Function to be run whenever the internal value is changed.
* It runs all the trigger, modular, etc. checks, updates the HTML element
* if there is one, and updates localStorage if needed.
*/

@@ -105,0 +90,0 @@ update(): void;

define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsImZpbGUiOiJJSXRlbVZhbHVlLmpzIiwic291cmNlc0NvbnRlbnQiOltdfQ==

@@ -43,12 +43,2 @@ /**

/**
* Whether an Element should be created and synced to the value.
*/
hasElement?: boolean;
/**
* An Element tag to use in creating the element, if hasElement is true.
*/
elementTag?: string;
/**
* A minimum value for the value to equal, if value is a number.

@@ -95,4 +85,3 @@ */

/**
* Storage container for a single IItemsHoldr value. The value may have triggers
* assigned to value, modularity, and other triggers, as well as an HTML element.
* Storage container for a single IItemsHoldr value.
*/

@@ -114,10 +103,3 @@ export interface IItemValue {

/**
* @returns The stored HTML element, if it exists.
*/
getElement(): HTMLElement;
/**
* General update Function to be run whenever the internal value is changed.
* It runs all the trigger, modular, etc. checks, updates the HTML element
* if there is one, and updates localStorage if needed.
*/

@@ -128,3 +110,3 @@ update(): void;

* Stores a ItemValue's value in localStorage under the prefix plus its key.
*
*
* @param overrideAutoSave Whether the policy on saving should be ignored

@@ -131,0 +113,0 @@ * so saving happens regardless. By default, false.

@@ -11,48 +11,32 @@ import { IItemsHoldr, IItemsHoldrSettings } from "./IItemsHoldr";

*/
private settings;
private readonly settings;
/**
* The ItemValues being stored, keyed by name.
*/
private items;
/**
* A listing of all the String keys for the stored items.
*/
private itemKeys;
/**
* Default attributes for ItemValues.
*/
private defaults;
private readonly defaults;
/**
* A reference to localStorage or a replacement object.
*/
private localStorage;
private readonly localStorage;
/**
* A prefix to store things under in localStorage.
*/
private prefix;
private readonly prefix;
/**
* Whether new items are allowed to be created using setItem.
*/
private allowNewItems;
private readonly allowNewItems;
/**
* Whether this should save changes to localStorage automatically.
* The ItemValues being stored, keyed by name.
*/
private autoSave;
private items;
/**
* A container element containing children for each value's element.
* A listing of all the String keys for the stored items.
*/
private container;
private itemKeys;
/**
* An Array of elements as createElement arguments, outside-to-inside.
* Whether this should save changes to localStorage automatically.
*/
private containersArguments;
private autoSave;
/**
* Any hardcoded changes to element content, such as "INF" for Infinity.
*/
private displayChanges;
/**
* Arguments to be passed to triggered callback Functions.
*/
private callbackArgs;
/**
* Initializes a new instance of the ItemsHoldr class.

@@ -64,2 +48,4 @@ *

/**
* Gets the key at an index.
*
* @param index An index for a key.

@@ -70,2 +56,4 @@ * @returns The indexed key.

/**
* Gets the contained values.
*
* @returns The values contained within, keyed by their keys.

@@ -77,10 +65,16 @@ */

/**
* @returns {Mixed} Default attributes for values.
* Gets the default attributes for values.
*
* @returns Default attributes for values.
*/
getDefaults(): any;
/**
* @returns A reference to localStorage or a replacment object.
* Gets the reference to localStorage or its placeholder.
*
* @returns A reference to localStorage or its placeholder.
*/
getLocalStorage(): Storage;
/**
* Gets whether this should save changes to localStorage automatically.
*
* @returns Whether this should save changes to localStorage automatically.

@@ -90,24 +84,10 @@ */

/**
* @returns The prefix to store thigns under in localStorage.
* Gets the prefix for localStorage keys.
*
* @returns The prefix to store keys under in localStorage.
*/
getPrefix(): string;
/**
* @returns The container HTML element, if it exists.
*/
getContainer(): HTMLElement;
/**
* @returns createElement arguments for HTML containers, outside-to-inside.
*/
getContainersArguments(): [string, any][];
/**
* @returns Any hard-coded changes to element content.
*/
getDisplayChanges(): {
[i: string]: string;
};
/**
* @returns Arguments to be passed to triggered event callbacks.
*/
getCallbackArgs(): any[];
/**
* Gets all keys for all items.
*
* @returns String keys for each of the stored ItemValues.

@@ -117,6 +97,10 @@ */

/**
* @returns All String keys of items.
* Gets all stored keys of items.
*
* @returns All keys of items.
*/
getItemKeys(): string[];
/**
* Gets the value for a known key.
*
* @param key The key for a known value.

@@ -127,3 +111,5 @@ * @returns The known value of a key, assuming that key exists.

/**
* @param key The key for a known value.
* Gets the value for a potentially unknown key.
*
* @param key The key for a potentially unknown value.
* @returns The settings for that particular key.

@@ -133,2 +119,4 @@ */

/**
* Checks whether a key exists.
*
* @param key The key for a potentially known value.

@@ -139,2 +127,4 @@ * @returns Whether there is a value under that key.

/**
* Maps key names to their values.
*
* @returns A mapping of key names to the actual values of all objects being stored.

@@ -214,74 +204,2 @@ */

saveAll(): void;
/**
* Hides the container Element by setting its visibility to hidden.
*/
hideContainer(): void;
/**
* Shows the container Element by setting its visibility to visible.
*/
displayContainer(): void;
/**
* Creates the container Element, which contains a child for each ItemValue that
* specifies hasElement to be true.
*
* @param containers An Array representing the Element to be created and the
* children between it and the contained ItemValues.
* Each contained Object has a String tag name as its
* first member, followed by any number of Objects to apply
* via createElement.
* @returns A newly created Element that can be used as a container.
*/
makeContainer(containers: [string, any][]): HTMLElement;
/**
* @returns Whether displayChanges has an entry for a particular value.
*/
hasDisplayChange(value: string): boolean;
/**
* @returns The displayChanges entry for a particular value.
*/
getDisplayChange(value: string): string;
/**
* Creates a new HTMLElement of the given type. For each Object given as
* arguments after, each member is proliferated onto the element.
*
* @param tag The type of the HTMLElement (by default, "div").
* @param args Any number of Objects to be proliferated onto the
* new HTMLElement.
* @returns A newly created HTMLElement of the given tag.
*/
createElement(tag?: string, ...args: any[]): HTMLElement;
/**
* Proliferates all members of the donor to the recipient recursively, as
* a deep copy.
*
* @param recipient An object receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
proliferate(recipient: any, donor: any, noOverride?: boolean): any;
/**
* Identical to proliferate, but tailored for HTML elements because many
* element attributes don't play nicely with JavaScript Array standards.
* Looking at you, HTMLCollection!
*
* @param recipient An HTMLElement receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
proliferateElement(recipient: any, donor: any, noOverride?: boolean): HTMLElement;
/**
* Creates an Object that can be used to create a new LocalStorage
* replacement, if the JavaScript environment doesn't have one.
*
* @returns {Object}
*/
private createPlaceholderStorage();
/**
* Resets this.items to their default values and resets this.itemKeys.
*/
private resetItemsToDefaults();
}

@@ -1,3 +0,4 @@

define(["require", "exports", "./ItemValue"], function (require, exports, ItemValue_1) {
define(["require", "exports", "./createPlaceholderStorage", "./ItemValue"], function (require, exports, createPlaceholderStorage_1, ItemValue_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -7,3 +8,3 @@ * A versatile container to store and manipulate values in localStorage, and

*/
var ItemsHoldr = (function () {
var ItemsHoldr = /** @class */ (function () {
/**

@@ -18,3 +19,2 @@ * Initializes a new instance of the ItemsHoldr class.

this.autoSave = !!settings.autoSave;
this.callbackArgs = settings.callbackArgs || [];
this.prefix = settings.prefix || "";

@@ -27,3 +27,3 @@ this.allowNewItems = settings.allowNewItems === undefined

else if (typeof localStorage === "undefined") {
this.localStorage = this.createPlaceholderStorage();
this.localStorage = createPlaceholderStorage_1.createPlaceholderStorage();
}

@@ -34,14 +34,7 @@ else {

this.defaults = settings.defaults || {};
this.displayChanges = settings.displayChanges || {};
this.resetItemsToDefaults();
if (settings.doMakeContainer) {
this.containersArguments = settings.containersArguments || [
["div", {
"className": this.prefix + "_container"
}]
];
this.container = this.makeContainer(this.containersArguments);
}
this.clear();
}
/**
* Gets the key at an index.
*
* @param index An index for a key.

@@ -54,2 +47,4 @@ * @returns The indexed key.

/**
* Gets the contained values.
*
* @returns The values contained within, keyed by their keys.

@@ -61,3 +56,5 @@ */

/**
* @returns {Mixed} Default attributes for values.
* Gets the default attributes for values.
*
* @returns Default attributes for values.
*/

@@ -68,3 +65,5 @@ ItemsHoldr.prototype.getDefaults = function () {

/**
* @returns A reference to localStorage or a replacment object.
* Gets the reference to localStorage or its placeholder.
*
* @returns A reference to localStorage or its placeholder.
*/

@@ -75,2 +74,4 @@ ItemsHoldr.prototype.getLocalStorage = function () {

/**
* Gets whether this should save changes to localStorage automatically.
*
* @returns Whether this should save changes to localStorage automatically.

@@ -82,3 +83,5 @@ */

/**
* @returns The prefix to store thigns under in localStorage.
* Gets the prefix for localStorage keys.
*
* @returns The prefix to store keys under in localStorage.
*/

@@ -89,26 +92,4 @@ ItemsHoldr.prototype.getPrefix = function () {

/**
* @returns The container HTML element, if it exists.
*/
ItemsHoldr.prototype.getContainer = function () {
return this.container;
};
/**
* @returns createElement arguments for HTML containers, outside-to-inside.
*/
ItemsHoldr.prototype.getContainersArguments = function () {
return this.containersArguments;
};
/**
* @returns Any hard-coded changes to element content.
*/
ItemsHoldr.prototype.getDisplayChanges = function () {
return this.displayChanges;
};
/**
* @returns Arguments to be passed to triggered event callbacks.
*/
ItemsHoldr.prototype.getCallbackArgs = function () {
return this.callbackArgs;
};
/**
* Gets all keys for all items.
*
* @returns String keys for each of the stored ItemValues.

@@ -120,3 +101,5 @@ */

/**
* @returns All String keys of items.
* Gets all stored keys of items.
*
* @returns All keys of items.
*/

@@ -127,2 +110,4 @@ ItemsHoldr.prototype.getItemKeys = function () {

/**
* Gets the value for a known key.
*
* @param key The key for a known value.

@@ -136,3 +121,5 @@ * @returns The known value of a key, assuming that key exists.

/**
* @param key The key for a known value.
* Gets the value for a potentially unknown key.
*
* @param key The key for a potentially unknown value.
* @returns The settings for that particular key.

@@ -144,2 +131,4 @@ */

/**
* Checks whether a key exists.
*
* @param key The key for a potentially known value.

@@ -152,2 +141,4 @@ * @returns Whether there is a value under that key.

/**
* Maps key names to their values.
*
* @returns A mapping of key names to the actual values of all objects being stored.

@@ -158,5 +149,3 @@ */

for (var i in this.items) {
if (this.items.hasOwnProperty(i)) {
output[i] = this.items[i].getValue();
}
output[i] = this.items[i].getValue();
}

@@ -188,5 +177,2 @@ return output;

}
if (this.container && this.items[key].getElement() !== undefined) {
this.container.removeChild(this.items[key].getElement());
}
this.itemKeys.splice(this.itemKeys.indexOf(key), 1);

@@ -201,10 +187,12 @@ delete this.items[key];

ItemsHoldr.prototype.clear = function () {
if (this.container) {
for (var i in this.items) {
if (this.items[i].getElement() !== undefined) {
this.container.removeChild(this.items[i].getElement());
}
this.items = {};
this.itemKeys = [];
if (!this.settings.values) {
return;
}
for (var key in this.settings.values) {
if (this.settings.values.hasOwnProperty(key)) {
this.addItem(key, this.settings.values[key]);
}
}
this.resetItemsToDefaults();
};

@@ -232,2 +220,3 @@ /**

this.checkExistence(key);
// tslint:disable-next-line restrict-plus-operands
var value = this.items[key].getValue() + amount;

@@ -296,226 +285,5 @@ this.items[key].setValue(value);

for (var key in this.items) {
if (this.items.hasOwnProperty(key)) {
this.items[key].updateLocalStorage(true);
}
this.items[key].updateLocalStorage(true);
}
};
/**
* Hides the container Element by setting its visibility to hidden.
*/
ItemsHoldr.prototype.hideContainer = function () {
this.container.style.visibility = "hidden";
};
/**
* Shows the container Element by setting its visibility to visible.
*/
ItemsHoldr.prototype.displayContainer = function () {
this.container.style.visibility = "visible";
};
/**
* Creates the container Element, which contains a child for each ItemValue that
* specifies hasElement to be true.
*
* @param containers An Array representing the Element to be created and the
* children between it and the contained ItemValues.
* Each contained Object has a String tag name as its
* first member, followed by any number of Objects to apply
* via createElement.
* @returns A newly created Element that can be used as a container.
*/
ItemsHoldr.prototype.makeContainer = function (containers) {
var output = this.createElement.apply(this, containers[0]);
var lastElement = output;
for (var i = 1; i < containers.length; i += 1) {
var child = this.createElement.apply(this, containers[i]);
lastElement.appendChild(child);
lastElement = child;
}
for (var key in this.items) {
if (this.items[key].getElement() !== undefined) {
lastElement.appendChild(this.items[key].getElement());
}
}
return output;
};
/**
* @returns Whether displayChanges has an entry for a particular value.
*/
ItemsHoldr.prototype.hasDisplayChange = function (value) {
return this.displayChanges.hasOwnProperty(value);
};
/**
* @returns The displayChanges entry for a particular value.
*/
ItemsHoldr.prototype.getDisplayChange = function (value) {
return this.displayChanges[value];
};
/**
* Creates a new HTMLElement of the given type. For each Object given as
* arguments after, each member is proliferated onto the element.
*
* @param tag The type of the HTMLElement (by default, "div").
* @param args Any number of Objects to be proliferated onto the
* new HTMLElement.
* @returns A newly created HTMLElement of the given tag.
*/
ItemsHoldr.prototype.createElement = function (tag) {
if (tag === void 0) { tag = "div"; }
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var element = document.createElement(tag);
// For each provided object, add those settings to the element
for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
var arg = args_1[_a];
this.proliferateElement(element, arg);
}
return element;
};
/**
* Proliferates all members of the donor to the recipient recursively, as
* a deep copy.
*
* @param recipient An object receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
ItemsHoldr.prototype.proliferate = function (recipient, donor, noOverride) {
// For each attribute of the donor:
for (var i in donor) {
if (!donor.hasOwnProperty(i)) {
continue;
}
// If noOverride, don't override already existing properties
if (noOverride && recipient.hasOwnProperty(i)) {
continue;
}
// If it's an object, recurse on a new version of it
var setting = donor[i];
if (typeof setting === "object") {
if (!recipient.hasOwnProperty(i)) {
recipient[i] = new setting.constructor();
}
this.proliferate(recipient[i], setting, noOverride);
}
else {
// Regular primitives are easy to copy otherwise
recipient[i] = setting;
}
}
return recipient;
};
/**
* Identical to proliferate, but tailored for HTML elements because many
* element attributes don't play nicely with JavaScript Array standards.
* Looking at you, HTMLCollection!
*
* @param recipient An HTMLElement receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
ItemsHoldr.prototype.proliferateElement = function (recipient, donor, noOverride) {
// For each attribute of the donor:
for (var i in donor) {
if (!donor.hasOwnProperty(i)) {
continue;
}
// If noOverride, don't override already existing properties
if (noOverride && recipient.hasOwnProperty(i)) {
continue;
}
var setting = donor[i];
// Special cases for HTML elements
switch (i) {
// Children and options: just append all of them directly
case "children":
case "options":
if (typeof setting !== "undefined") {
for (var _i = 0, setting_1 = setting; _i < setting_1.length; _i++) {
var member = setting_1[_i];
recipient.appendChild(member);
}
}
break;
// Style: proliferate (instead of making a new Object)
case "style":
this.proliferate(recipient[i], setting);
break;
// By default, use the normal proliferate logic
default:
// If it's an object, recurse on a new version of it
if (typeof setting === "object") {
if (!recipient.hasOwnProperty(i)) {
recipient[i] = new setting.constructor();
}
this.proliferate(recipient[i], setting, noOverride);
}
else {
// Regular primitives are easy to copy otherwise
recipient[i] = setting;
}
break;
}
}
return recipient;
};
/**
* Creates an Object that can be used to create a new LocalStorage
* replacement, if the JavaScript environment doesn't have one.
*
* @returns {Object}
*/
ItemsHoldr.prototype.createPlaceholderStorage = function () {
var _this = this;
var output = {
keys: [],
getItem: function (key) {
return _this.localStorage[key];
},
setItem: function (key, value) {
_this.localStorage[key] = value;
},
clear: function () {
for (var i in _this) {
if (_this.hasOwnProperty(i)) {
delete _this[i];
}
}
},
removeItem: function (key) {
delete _this[key];
},
key: function (index) {
return this.keys[index];
}
};
Object.defineProperties(output, {
length: {
get: function () { return output.keys.length; }
},
remainingSpace: {
get: function () { return 9001; }
}
});
return output;
};
/**
* Resets this.items to their default values and resets this.itemKeys.
*/
ItemsHoldr.prototype.resetItemsToDefaults = function () {
this.items = {};
this.itemKeys = [];
if (!this.settings.values) {
return;
}
for (var key in this.settings.values) {
if (this.settings.values.hasOwnProperty(key)) {
this.addItem(key, this.settings.values[key]);
}
}
};
return ItemsHoldr;

@@ -525,3 +293,1 @@ }());

});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkl0ZW1zSG9sZHIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7SUFJQTs7O09BR0c7SUFDSDtRQTZESTs7OztXQUlHO1FBQ0gsb0JBQVksUUFBa0M7WUFBbEMsd0JBQWtDLEdBQWxDLGFBQWtDO1lBQzFDLElBQUksQ0FBQyxRQUFRLEdBQUcsUUFBUSxDQUFDO1lBQ3pCLElBQUksQ0FBQyxRQUFRLEdBQUcsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUM7WUFDcEMsSUFBSSxDQUFDLFlBQVksR0FBRyxRQUFRLENBQUMsWUFBWSxJQUFJLEVBQUUsQ0FBQztZQUNoRCxJQUFJLENBQUMsTUFBTSxHQUFHLFFBQVEsQ0FBQyxNQUFNLElBQUksRUFBRSxDQUFDO1lBRXBDLElBQUksQ0FBQyxhQUFhLEdBQUcsUUFBUSxDQUFDLGFBQWEsS0FBSyxTQUFTO2tCQUNuRCxJQUFJLEdBQUcsUUFBUSxDQUFDLGFBQWEsQ0FBQztZQUVwQyxFQUFFLENBQUMsQ0FBQyxRQUFRLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztnQkFDeEIsSUFBSSxDQUFDLFlBQVksR0FBRyxRQUFRLENBQUMsWUFBWSxDQUFDO1lBQzlDLENBQUM7WUFBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUMsT0FBTyxZQUFZLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQztnQkFDN0MsSUFBSSxDQUFDLFlBQVksR0FBRyxJQUFJLENBQUMsd0JBQXdCLEVBQUUsQ0FBQztZQUN4RCxDQUFDO1lBQUMsSUFBSSxDQUFDLENBQUM7Z0JBQ0osSUFBSSxDQUFDLFlBQVksR0FBRyxZ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5Q2hhbmdlcyB8fCB7fTtcclxuXHJcbiAgICAgICAgdGhpcy5yZXNldEl0ZW1zVG9EZWZhdWx0cygpO1xyXG5cclxuICAgICAgICBpZiAoc2V0dGluZ3MuZG9NYWtlQ29udGFpbmVyKSB7XHJcbiAgICAgICAgICAgIHRoaXMuY29udGFpbmVyc0FyZ3VtZW50cyA9IHNldHRpbmdzLmNvbnRhaW5lcnNBcmd1bWVudHMgfHwgW1xyXG4gICAgICAgICAgICAgICAgW1wiZGl2XCIsIHtcclxuICAgICAgICAgICAgICAgICAgICBcImNsYXNzTmFtZVwiOiB0aGlzLnByZWZpeCArIFwiX2NvbnRhaW5lclwiXHJcbiAgICAgICAgICAgICAgICB9XVxyXG4gICAgICAgICAgICBdO1xyXG4gICAgICAgICAgICB0aGlzLmNvbnRhaW5lciA9IHRoaXMubWFrZUNvbnRhaW5lcih0aGlzLmNvbnRhaW5lcnNBcmd1bWVudHMpO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIEBwYXJhbSBpbmRleCAgIEFuIGluZGV4IGZvciBhIGtleS5cclxuICAgICAqIEByZXR1cm5zIFRoZSBpbmRleGVkIGtleS5cclxuICAgICAqL1xyXG4gICAgcHVibGljIGtleShpbmRleDogbnVtYmVyKTogc3RyaW5nIHtcclxuICAgICAgICByZXR1cm4gdGhpcy5pdGVtS2V5c1tpbmRleF07XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBAcmV0dXJucyBUaGUgdmFsdWVzIGNvbnRhaW5lZCB3aXRoaW4sIGtleWVkIGJ5IHRoZWlyIGtleXMuXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyBnZXRWYWx1ZXMoKTogeyBbaTogc3RyaW5nXTogSUl0ZW1WYWx1ZSB9IHtcclxuICAgICAgICByZXR1cm4gdGhpcy5pdGVtcztcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIEByZXR1cm5zIHtNaXhlZH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WQge1xyXG4gICAgICAgIHRoaXMuY29udGFpbmVyLnN0eWxlLnZpc2liaWxpdHkgPSBcInZpc2libGVcIjtcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIENyZWF0ZXMgdGhlIGNvbnRhaW5lciBFbGVtZW50LCB3aGljaCBjb250YWlucyBhIGNoaWxkIGZvciBlYWNoIEl0ZW1WYWx1ZSB0aGF0XHJcbiAgICAgKiBzcGVjaWZpZXMgaGFzRWxlbWVudCB0byBiZSB0cnVlLlxyXG4gICAgICogXHJcbiAgICAgKiBAcGFyYW0gY29udGFpbmVycyAgIEFuIEFycmF5IHJlcHJlc2VudGluZyB0aGUgRWxlbWVudCB0byBiZSBjcmVhdGVkIGFuZCB0aGVcclxuICAgICAqICAgICAgICAgICAgICAgICAgICAgY2hpbGRyZW4gYmV0d2VlbiBpdCBhbmQgdGhlIGNvbnRhaW5lZCBJdGVtVmFsdWVzLiBcclxuICAgICAqICAgICAgICAgICAgICAgICAgICAgRWFjaCBjb250YWluZWQgT2JqZWN0IGhhcyBhIFN0cmluZyB0YWcgbmFtZSBhcyBpdHMgXHJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIGZpcnN0IG1lbWJlciwgZm9sbG93ZWQgYnkgYW55IG51bWJlciBvZiBPYmplY3RzIHRvIGFwcGx5IFxyXG4gICAgICogICAgICAgICAgICAgICAgICAgICB2aWEgY3JlYXRlRWxlbWVudC5cclxuICAgICAqIEByZXR1cm5zIEEgbmV3bHkgY3JlYXRlZCBFbGVtZW50IHRoYXQgY2FuIGJlIHVzZWQgYXMgYSBjb250YWluZXIuXHJcbiAgICAgKi9cclxuICAgIHB1YmxpYyBtYWtlQ29udGFpbmVyKGNvbnRhaW5lcnM6IFtzdHJpbmcsIGFueV1bXSk6IEhUTUxFbGVtZW50IHtcclxuICAgICAgICBjb25zdCBvdXRwdXQ6IEhUTUxFbGVtZW50ID0gdGhpcy5jcmVhdGVFbGVtZW50LmFwcGx5KHRoaXMsIGNvb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aG9zZSBzZXR0aW5ncyB0byB0aGUgZWxlbWVudFxyXG4gICAgICAgIGZvciAoY29uc3QgYXJnIG9mIGFyZ3MpIHtcclxuICAgICAgICAgICAgdGhpcy5wcm9saWZlcmF0ZUVsZW1lbnQoZWxlbWVudCwgYXJnKTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiBlbGVtZW50O1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUHJvbGlmZXJhdGVzIGFsbCBtZW1iZXJzIG9mIHRoZSBkb25vciB0byB0aGUgcmVjaXBpZW50IHJlY3Vyc2l2ZWx5LCBhc1xyXG4gICAgICogYSBkZWVwIGNvcHkuXHJcbiAgICAgKiBcclxuICAgICAqIEBwYXJhbSByZWNpcGllbnQgICBBbiBvYmplY3QgcmVjZWl2aW5nIHRoZSBkb25vcidzIG1lbWJlcnMuXHJcbiAgICAgKiBAcGFyYW0gZG9ub3IgICBBbiBvYmplY3Qgd2hvc2UgbWVtYmVycyBhcmUgY29waWVkIHRvIHJlY2lwaWVudC5cclxuICAgICAqIEBwYXJhbSBub092ZXJyaWRlICAgSWYgcmVjaXBpZW50IHByb3BlcnRpZXMgbWF5IGJlIG92ZXJyaWRlbiAoYnkgXHJcbiAgICAgKiAgICAgICAgICAgICAgICAgICAgIGRlZmF1bHQsIGZhbHNlKS5cclxuICAgICAqIEByZXR1cm5zIFRoZSByZWNpcGllbnQsIHdoaWNoIHNob3VsZCBoYXZlIHRoZSBkb25vciBwcm9saWZlcmF0ZWQgb250byBpdC5cclxuICAgICAqL1xyXG4gICAgcHVibGljIHByb2xpZmVyYXRlKHJlY2lwaWVudDogYW55LCBkb25vcjogYW55LCBub092ZXJyaWRlPzogYm9vbGVhbik6IGFueSB7XHJcbiAgICAgICAgLy8gRm9yIGVhY2ggYXR0cmlidXRlIG9mIHRoZSBkb25vcjpcclxuICAgICAgICBmb3IgKGxldCBpIGluIGRvbm9yKSB7XHJcbiAgICAgICAgICAgIGlmICghZG9ub3IuaGFzT3duUHJvcGVydHkoaSkpIHtcclxuICAgICAgICAgICAgICAgIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICB9XHJcblxyXG4gICAgICAgICAgICAvLyBJZiBub092ZXJyaWRlLCBkb24ndCBvdmVycmlkZSBhbHJlYWR5IGV4aXN0aW5nIHByb3BlcnRpZXNcclxuICAgICAgICAgICAgaWYgKG5vT3ZlcnJpZGUgJiYgcmVjaXBpZW50Lmhhc093blByb3BlcnR5KGkpKSB7XHJcbiAgICAgICAgICAgICAgICBjb250aW51ZTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gSWYgaXQncyBhbiBvYmplY3QsIHJlY3Vyc2Ugb24gYSBuZXcgdmVyc2lvbiBvZiBpdFxyXG4gICAgICAgICAgICBjb25zdCBzZXR0aW5nOiBhbnkgPSBkb25vcltpXTtcclxuICAgICAgICAgICAgaWYgKHR5cGVvZiBzZXR0aW5nID09PSBcIm9iamVjdFwiKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIXJlY2lwaWVudC5oYXNPd25Qcm9wZXJ0eShpKSkge1xyXG4gICAgICAgICAgICAgICAgICAgIHJlY2lwaWVudFtpXSA9IG5ldyBzZXR0aW5nLmNvbnN0cnVjdG9yKCk7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB0aGlzLnByb2xpZmVyYXRlKHJlY2lwaWVudFtpXSwgc2V0dGluZywgbm9PdmVycmlkZSk7XHJcbiAgICAgICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgICAgICAvLyBSZWd1bGFyIHByaW1pdGl2ZXMgYXJlIGVhc3kgdG8gY29weSBvdGhlcndpc2VcclxuICAgICAgICAgICAgICAgIHJlY2lwaWVudFtpXSA9IHNldHRpbmc7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiByZWNpcGllbnQ7XHJcbiAgICB9XHJcblxyXG4gICA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jb250aW51ZTtcclxuICAgICAgICAgICAgfVxyXG5cclxuICAgICAgICAgICAgLy8gSWYgbm9PdmVycmlkZSwgZG9uJ3Qgb3ZlcnJpZGUgYWxyZWFkeSBleGlzdGluZyBwcm9wZXJ0aWVzXHJcbiAgICAgICAgICAgIGlmIChub092ZXJyaWRlICYmIHJlY2lwaWVudC5oYXNPd25Qcm9wZXJ0eShpKSkge1xyXG4gICAgICAgICAgICAgICAgY29udGludWU7XHJcbiAgICAgICAgICAgIH1cclxuXHJcbiAgICAgICAgICAgIGNvbnN0IHNldHRpbmc6IGFueSA9IGRvbm9yW2ldO1xyXG5cclxuICAgICAgICAgICAgLy8gU3BlY2lhbCBjYXNlcyBmb3IgSFRNTCBlbGVtZW50c1xyXG4gICAgICAgICAgICBzd2l0Y2ggKGkpIHtcclxuICAgICAgICAgICAgICAgIC8vIENoaWxkcmVuIGFuZCBvcHRpb25zOiBqdXN0IGFwcGVuZCBhbGwgb2YgdGhlbSBkaXJlY3RseVxyXG4gICAgICAgICAgICAgICAgY2FzZSBcImNoaWxkcmVuXCI6XHJcbiAgICAgICAgICAgICAgICBjYXNlIFwib3B0aW9uc1wiOlxyXG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygc2V0dGluZyAhPT0gXCJ1bmRlZmluZWRcIikge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKGNvbnN0IG1lbWJlciBvZiBzZXR0aW5nKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNpcGllbnQuYXBwZW5kQ2hpbGQobWVtYmVyKTtcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuXHJcbiAgICAgICAgICAgICAgICAvLyBTdHlsZTogcHJvbGlmZXJhdGUgKGluc3RlYWQgb2YgbWFraW5nIGEgbmV3IE9iamVjdClcclxuICAgICAgICAgICAgICAgIGNhc2UgXCJzdHlsZVwiOlxyXG4gICAgICAgICAgICAgICAgICAgIHRoaXMucHJvbGlmZXJhdGUocmVjaXBpZW50W2ldLCBzZXR0aW5nKTtcclxuICAgICAgICAgICAgICAgICAgICBicmVhaztcclxuXHJcbiAgICAgICAgICAgICAgICAvLyBCeSBkZWZhdWx0LCB1c2UgdGhlIG5vcm1hbCBwcm9saWZlcmF0ZSBsb2dpY1xyXG4gICAgICAgICAgICAgICAgZGVmYXVsdDpcclxuICAgICAgICAgICAgICAgICAgICAvLyBJZiBpdCdzIGFuIG9iamVjdCwgcmVjdXJzZSBvbiBhIG5ldyB2ZXJzaW9uIG9mIGl0XHJcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBzZXR0aW5nID09PSBcIm9iamVjdFwiKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICghcmVjaXBpZW50Lmhhc093blByb3BlcnR5KGkpKSB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZWNpcGllbnRbaV0gPSBuZXcgc2V0dGluZy5jb25zdHJ1Y3RvcigpO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMucHJvbGlmZXJhdGUocmVjaXBpZW50W2ldLCBzZXR0aW5nLCBub092ZXJyaWRlKTtcclxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBSZWd1bGFyIHByaW1pdGl2ZXMgYXJlIGVhc3kgdG8gY29weSBvdGhlcndpc2VcclxuICAgICAgICAgICAgICAgICAgICAgICAgcmVjaXBpZW50W2ldID0gc2V0dGluZztcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiByZWNpcGllbnQ7XHJcbiAgICB9XHJcblxyXG4gICAgLyoqXHJcbiAgICAgKiBDcmVhdGVzIGFuIE9iamVjdCB0aGF0IGNhbiBiZSB1c2VkIHRvIGNyZWF0ZSBhIG5ldyBMb2NhbFN0b3JhZ2VcclxuICAgICAqIHJlcGxhY2VtZW50LCBpZiB0aGUgSmF2YVNjcmlwdCBlbnZpcm9ubWVudCBkb2Vzbid0IGhhdmUgb25lLlxyXG4gICAgICogXHJcbiAgICAgKiBAcmV0dXJucyB7T2JqZWN0fVxyXG4gICAgICovXHJcbiAgICBwcml2YXRlIGNyZWF0ZVBsYWNlaG9sZGVyU3RvcmFnZSgpOiBTdG9yYWdlIHtcclxuICAgICAgICBjb25zdCBvdXRwdXQ6IGFueSA9IHtcclxuICAgICAgICAgICAga2V5czogW10sXHJcbiAgICAgICAgICAgIGdldEl0ZW06IChrZXk6IHN0cmluZyk6IGFueSA9PiB7XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gdGhpcy5sb2NhbFN0b3JhZ2Vba2V5XTtcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgc2V0SXRlbTogKGtleTogc3RyaW5nLCB2YWx1ZTogc3RyaW5nKTogdm9pZCA9PiB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLmxvY2FsU3RvcmFnZVtrZXldID0gdmFsdWU7XHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIGNsZWFyOiAoKTogdm9pZCA9PiB7XHJcbiAgICAgICAgICAgICAgICBmb3IgKGxldCBpIGluIHRoaXMpIHtcclxuICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5oYXNPd25Qcm9wZXJ0eShpKSkge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBkZWxldGUgKHRoaXMgYXMgYW55KVtpXTtcclxuICAgICAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIHJlbW92ZUl0ZW06IChrZXk6IHN0cmluZyk6IHZvaWQgPT4ge1xyXG4gICAgICAgICAgICAgICAgZGVsZXRlICh0aGlzIGFzIGFueSlba2V5XTtcclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAga2V5OiBmdW5jdGlvbiAodGhpczogYW55LCBpbmRleDogbnVtYmVyKTogc3RyaW5nIHtcclxuICAgICAgICAgICAgICAgIHJldHVybiB0aGlzLmtleXNbaW5kZXhdO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfTtcclxuXHJcbiAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnRpZXMob3V0cHV0LCB7XHJcbiAgICAgICAgICAgIGxlbmd0aDoge1xyXG4gICAgICAgICAgICAgICAgZ2V0OiAoKTogbnVtYmVyID0+IG91dHB1dC5rZXlzLmxlbmd0aFxyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICByZW1haW5pbmdTcGFjZToge1xyXG4gICAgICAgICAgICAgICAgZ2V0OiAoKTogbnVtYmVyID0+IDkwMDFcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICByZXR1cm4gb3V0cHV0O1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogUmVzZXRzIHRoaXMuaXRlbXMgdG8gdGhlaXIgZGVmYXVsdCB2YWx1ZXMgYW5kIHJlc2V0cyB0aGlzLml0ZW1LZXlzLlxyXG4gICAgICovXHJcbiAgICBwcml2YXRlIHJlc2V0SXRlbXNUb0RlZmF1bHRzKCk6IHZvaWQge1xyXG4gICAgICAgIHRoaXMuaXRlbXMgPSB7fTtcclxuICAgICAgICB0aGlzLml0ZW1LZXlzID0gW107XHJcblxyXG4gICAgICAgIGlmICghdGhpcy5zZXR0aW5ncy52YWx1ZXMpIHtcclxuICAgICAgICAgICAgcmV0dXJuO1xyXG4gICAgICAgIH1cclxuXHJcbiAgICAgICAgZm9yIChsZXQga2V5IGluIHRoaXMuc2V0dGluZ3MudmFsdWVzKSB7XHJcbiAgICAgICAgICAgIGlmICh0aGlzLnNldHRpbmdzLnZhbHVlcy5oYXNPd25Qcm9wZXJ0eShrZXkpKSB7XHJcbiAgICAgICAgICAgICAgICB0aGlzLmFkZEl0ZW0oa2V5LCB0aGlzLnNldHRpbmdzLnZhbHVlc1trZXldKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH1cclxufVxyXG4iXX0=

@@ -0,1 +1,2 @@

import { createPlaceholderStorage } from "./createPlaceholderStorage";
import { IItems, IItemsHoldr, IItemsHoldrSettings } from "./IItemsHoldr";

@@ -7,3 +8,3 @@ import { IItemValue, IItemValueDefaults } from "./IItemValue";

* A versatile container to store and manipulate values in localStorage, and
* optionally keep an updated HTML container showing these values.
* optionally keep an updated HTML container showing these values.
*/

@@ -14,18 +15,8 @@ export class ItemsHoldr implements IItemsHoldr {

*/
private settings: IItemsHoldrSettings;
private readonly settings: IItemsHoldrSettings;
/**
* The ItemValues being stored, keyed by name.
*/
private items: IItems;
/**
* A listing of all the String keys for the stored items.
*/
private itemKeys: string[];
/**
* Default attributes for ItemValues.
*/
private defaults: IItemValueDefaults;
private readonly defaults: IItemValueDefaults;

@@ -35,3 +26,3 @@ /**

*/
private localStorage: Storage;
private readonly localStorage: Storage;

@@ -41,3 +32,3 @@ /**

*/
private prefix: string;
private readonly prefix: string;

@@ -47,38 +38,27 @@ /**

*/
private allowNewItems: boolean;
private readonly allowNewItems: boolean;
/**
* Whether this should save changes to localStorage automatically.
* The ItemValues being stored, keyed by name.
*/
private autoSave: boolean;
private items: IItems;
/**
* A container element containing children for each value's element.
* A listing of all the String keys for the stored items.
*/
private container: HTMLElement;
private itemKeys: string[];
/**
* An Array of elements as createElement arguments, outside-to-inside.
* Whether this should save changes to localStorage automatically.
*/
private containersArguments: [string, any][];
private autoSave: boolean;
/**
* Any hardcoded changes to element content, such as "INF" for Infinity.
*/
private displayChanges: { [i: string]: string };
/**
* Arguments to be passed to triggered callback Functions.
*/
private callbackArgs: any[];
/**
* Initializes a new instance of the ItemsHoldr class.
*
*
* @param settings Any optional custom settings.
*/
constructor(settings: IItemsHoldrSettings = {}) {
public constructor(settings: IItemsHoldrSettings = {}) {
this.settings = settings;
this.autoSave = !!settings.autoSave;
this.callbackArgs = settings.callbackArgs || [];
this.prefix = settings.prefix || "";

@@ -91,4 +71,4 @@

this.localStorage = settings.localStorage;
} else if (typeof localStorage === "undefined") {
this.localStorage = this.createPlaceholderStorage();
} else if (typeof localStorage === "undefined") { // tslint:disable-line strict-type-predicates
this.localStorage = createPlaceholderStorage();
} else {

@@ -99,17 +79,9 @@ this.localStorage = localStorage;

this.defaults = settings.defaults || {};
this.displayChanges = settings.displayChanges || {};
this.resetItemsToDefaults();
if (settings.doMakeContainer) {
this.containersArguments = settings.containersArguments || [
["div", {
"className": this.prefix + "_container"
}]
];
this.container = this.makeContainer(this.containersArguments);
}
this.clear();
}
/**
* Gets the key at an index.
*
* @param index An index for a key.

@@ -123,2 +95,4 @@ * @returns The indexed key.

/**
* Gets the contained values.
*
* @returns The values contained within, keyed by their keys.

@@ -131,3 +105,5 @@ */

/**
* @returns {Mixed} Default attributes for values.
* Gets the default attributes for values.
*
* @returns Default attributes for values.
*/

@@ -139,3 +115,5 @@ public getDefaults(): any {

/**
* @returns A reference to localStorage or a replacment object.
* Gets the reference to localStorage or its placeholder.
*
* @returns A reference to localStorage or its placeholder.
*/

@@ -147,2 +125,4 @@ public getLocalStorage(): Storage {

/**
* Gets whether this should save changes to localStorage automatically.
*
* @returns Whether this should save changes to localStorage automatically.

@@ -155,3 +135,5 @@ */

/**
* @returns The prefix to store thigns under in localStorage.
* Gets the prefix for localStorage keys.
*
* @returns The prefix to store keys under in localStorage.
*/

@@ -163,30 +145,4 @@ public getPrefix(): string {

/**
* @returns The container HTML element, if it exists.
*/
public getContainer(): HTMLElement {
return this.container;
}
/**
* @returns createElement arguments for HTML containers, outside-to-inside.
*/
public getContainersArguments(): [string, any][] {
return this.containersArguments;
}
/**
* @returns Any hard-coded changes to element content.
*/
public getDisplayChanges(): { [i: string]: string } {
return this.displayChanges;
}
/**
* @returns Arguments to be passed to triggered event callbacks.
*/
public getCallbackArgs(): any[] {
return this.callbackArgs;
}
/**
* Gets all keys for all items.
*
* @returns String keys for each of the stored ItemValues.

@@ -199,3 +155,5 @@ */

/**
* @returns All String keys of items.
* Gets all stored keys of items.
*
* @returns All keys of items.
*/

@@ -207,2 +165,4 @@ public getItemKeys(): string[] {

/**
* Gets the value for a known key.
*
* @param key The key for a known value.

@@ -218,3 +178,5 @@ * @returns The known value of a key, assuming that key exists.

/**
* @param key The key for a known value.
* Gets the value for a potentially unknown key.
*
* @param key The key for a potentially unknown value.
* @returns The settings for that particular key.

@@ -227,2 +189,4 @@ */

/**
* Checks whether a key exists.
*
* @param key The key for a potentially known value.

@@ -236,2 +200,4 @@ * @returns Whether there is a value under that key.

/**
* Maps key names to their values.
*
* @returns A mapping of key names to the actual values of all objects being stored.

@@ -242,6 +208,4 @@ */

for (let i in this.items) {
if (this.items.hasOwnProperty(i)) {
output[i] = this.items[i].getValue();
}
for (const i in this.items) {
output[i] = this.items[i].getValue();
}

@@ -254,3 +218,3 @@

* Adds a new key & value pair to by linking to a newly created ItemValue.
*
*
* @param key The key to reference by new ItemValue by.

@@ -269,3 +233,3 @@ * @param settings The settings for the new ItemValue.

* container (if they both exist).
*
*
* @param key The key of the element to remove.

@@ -278,6 +242,2 @@ */

if (this.container && this.items[key].getElement() !== undefined) {
this.container.removeChild(this.items[key].getElement());
}
this.itemKeys.splice(this.itemKeys.indexOf(key), 1);

@@ -294,11 +254,14 @@

public clear(): void {
if (this.container) {
for (let i in this.items) {
if (this.items[i].getElement() !== undefined) {
this.container.removeChild(this.items[i].getElement());
}
this.items = {};
this.itemKeys = [];
if (!this.settings.values) {
return;
}
for (const key in this.settings.values) {
if (this.settings.values.hasOwnProperty(key)) {
this.addItem(key, this.settings.values[key]);
}
}
this.resetItemsToDefaults();
}

@@ -309,3 +272,3 @@

* (including the ItemValue's element and localStorage, if needed).
*
*
* @param key The key of the ItemValue.

@@ -323,3 +286,3 @@ * @param value The new value for the ItemValue.

* Numbers or concatenation for Strings.
*
*
* @param key The key of the ItemValue.

@@ -331,2 +294,3 @@ * @param amount The amount to increase by (by default, 1).

// tslint:disable-next-line restrict-plus-operands
const value: number | string = this.items[key].getValue() + amount;

@@ -340,3 +304,3 @@

* Numbers or concatenation for Strings.
*
*
* @param key The key of the ItemValue.

@@ -348,3 +312,3 @@ * @param amount The amount to decrease by (by default, 1).

let value: number = this.items[key].getValue() - amount;
const value: number = this.items[key].getValue() - amount;

@@ -356,3 +320,3 @@ this.items[key].setValue(value);

* Toggles whether a value is true or false.
*
*
* @param key The key of the ItemValue.

@@ -378,3 +342,3 @@ */

* allowed, it creates it; otherwise, it throws an Error.
*
*
* @param key

@@ -388,3 +352,3 @@ */

if (!this.allowNewItems) {
throw new Error("Unknown key given to ItemsHoldr: '" + key + "'.");
throw new Error(`Unknown key given to ItemsHoldr: '${key}'.`);
}

@@ -397,3 +361,3 @@

* Manually saves an item's value to localStorage, ignoring the autoSave flag.
*
*
* @param key The key of the item to save.

@@ -403,3 +367,3 @@ */

if (!this.items.hasOwnProperty(key)) {
throw new Error("Unknown key given to ItemsHoldr: '" + key + "'.");
throw new Error(`Unknown key given to ItemsHoldr: '${key}'.`);
}

@@ -411,248 +375,9 @@

/**
* Manually saves all values to localStorage, ignoring the autoSave flag.
* Manually saves all values to localStorage, ignoring the autoSave flag.
*/
public saveAll(): void {
for (let key in this.items) {
if (this.items.hasOwnProperty(key)) {
this.items[key].updateLocalStorage(true);
}
for (const key in this.items) {
this.items[key].updateLocalStorage(true);
}
}
/**
* Hides the container Element by setting its visibility to hidden.
*/
public hideContainer(): void {
this.container.style.visibility = "hidden";
}
/**
* Shows the container Element by setting its visibility to visible.
*/
public displayContainer(): void {
this.container.style.visibility = "visible";
}
/**
* Creates the container Element, which contains a child for each ItemValue that
* specifies hasElement to be true.
*
* @param containers An Array representing the Element to be created and the
* children between it and the contained ItemValues.
* Each contained Object has a String tag name as its
* first member, followed by any number of Objects to apply
* via createElement.
* @returns A newly created Element that can be used as a container.
*/
public makeContainer(containers: [string, any][]): HTMLElement {
const output: HTMLElement = this.createElement.apply(this, containers[0]);
let lastElement: HTMLElement = output;
for (let i: number = 1; i < containers.length; i += 1) {
const child: HTMLElement = this.createElement.apply(this, containers[i]);
lastElement.appendChild(child);
lastElement = child;
}
for (let key in this.items) {
if (this.items[key].getElement() !== undefined) {
lastElement.appendChild(this.items[key].getElement());
}
}
return output;
}
/**
* @returns Whether displayChanges has an entry for a particular value.
*/
public hasDisplayChange(value: string): boolean {
return this.displayChanges.hasOwnProperty(value);
}
/**
* @returns The displayChanges entry for a particular value.
*/
public getDisplayChange(value: string): string {
return this.displayChanges[value];
}
/**
* Creates a new HTMLElement of the given type. For each Object given as
* arguments after, each member is proliferated onto the element.
*
* @param tag The type of the HTMLElement (by default, "div").
* @param args Any number of Objects to be proliferated onto the
* new HTMLElement.
* @returns A newly created HTMLElement of the given tag.
*/
public createElement(tag: string = "div", ...args: any[]): HTMLElement {
const element: HTMLElement = document.createElement(tag);
// For each provided object, add those settings to the element
for (const arg of args) {
this.proliferateElement(element, arg);
}
return element;
}
/**
* Proliferates all members of the donor to the recipient recursively, as
* a deep copy.
*
* @param recipient An object receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
public proliferate(recipient: any, donor: any, noOverride?: boolean): any {
// For each attribute of the donor:
for (let i in donor) {
if (!donor.hasOwnProperty(i)) {
continue;
}
// If noOverride, don't override already existing properties
if (noOverride && recipient.hasOwnProperty(i)) {
continue;
}
// If it's an object, recurse on a new version of it
const setting: any = donor[i];
if (typeof setting === "object") {
if (!recipient.hasOwnProperty(i)) {
recipient[i] = new setting.constructor();
}
this.proliferate(recipient[i], setting, noOverride);
} else {
// Regular primitives are easy to copy otherwise
recipient[i] = setting;
}
}
return recipient;
}
/**
* Identical to proliferate, but tailored for HTML elements because many
* element attributes don't play nicely with JavaScript Array standards.
* Looking at you, HTMLCollection!
*
* @param recipient An HTMLElement receiving the donor's members.
* @param donor An object whose members are copied to recipient.
* @param noOverride If recipient properties may be overriden (by
* default, false).
* @returns The recipient, which should have the donor proliferated onto it.
*/
public proliferateElement(recipient: any, donor: any, noOverride?: boolean): HTMLElement {
// For each attribute of the donor:
for (let i in donor) {
if (!donor.hasOwnProperty(i)) {
continue;
}
// If noOverride, don't override already existing properties
if (noOverride && recipient.hasOwnProperty(i)) {
continue;
}
const setting: any = donor[i];
// Special cases for HTML elements
switch (i) {
// Children and options: just append all of them directly
case "children":
case "options":
if (typeof setting !== "undefined") {
for (const member of setting) {
recipient.appendChild(member);
}
}
break;
// Style: proliferate (instead of making a new Object)
case "style":
this.proliferate(recipient[i], setting);
break;
// By default, use the normal proliferate logic
default:
// If it's an object, recurse on a new version of it
if (typeof setting === "object") {
if (!recipient.hasOwnProperty(i)) {
recipient[i] = new setting.constructor();
}
this.proliferate(recipient[i], setting, noOverride);
} else {
// Regular primitives are easy to copy otherwise
recipient[i] = setting;
}
break;
}
}
return recipient;
}
/**
* Creates an Object that can be used to create a new LocalStorage
* replacement, if the JavaScript environment doesn't have one.
*
* @returns {Object}
*/
private createPlaceholderStorage(): Storage {
const output: any = {
keys: [],
getItem: (key: string): any => {
return this.localStorage[key];
},
setItem: (key: string, value: string): void => {
this.localStorage[key] = value;
},
clear: (): void => {
for (let i in this) {
if (this.hasOwnProperty(i)) {
delete (this as any)[i];
}
}
},
removeItem: (key: string): void => {
delete (this as any)[key];
},
key: function (this: any, index: number): string {
return this.keys[index];
}
};
Object.defineProperties(output, {
length: {
get: (): number => output.keys.length
},
remainingSpace: {
get: (): number => 9001
}
});
return output;
}
/**
* Resets this.items to their default values and resets this.itemKeys.
*/
private resetItemsToDefaults(): void {
this.items = {};
this.itemKeys = [];
if (!this.settings.values) {
return;
}
for (let key in this.settings.values) {
if (this.settings.values.hasOwnProperty(key)) {
this.addItem(key, this.settings.values[key]);
}
}
}
}
import { IItemsHoldr } from "./IItemsHoldr";
import { IItemValue } from "./IItemValue";
/**
* Storage container for a single ItemsHoldr value. The value may have triggers
* assigned to value, modularity, and other triggers, as well as an HTML element.
* Storage container for a single ItemsHoldr value.
*/

@@ -11,3 +10,3 @@ export declare class ItemValue implements IItemValue {

*/
private ItemsHolder;
private itemsHolder;
/**

@@ -31,14 +30,2 @@ * The unique key identifying this ItemValue in the ItemsHoldr.

/**
* An HTML element whose second child's textContent is always set to that of the element.
*/
private element;
/**
* Whether an Element should be created and synced to the value.
*/
private hasElement;
/**
* An Element tag to use in creating the element, if hasElement is true.
*/
private elementTag;
/**
* A minimum value for the value to equal, if value is a number.

@@ -70,7 +57,7 @@ */

*/
private transformGet;
private transformGet?;
/**
* A Function to transform the value when it's being retrieved.
*/
private transformSet;
private transformSet?;
/**

@@ -84,10 +71,11 @@ * The value being stored.

*
* @constructor
* @param ItemsHolder The container for this value.
* @param itemsHolder The container for this value.
* @param key The key to reference this new ItemValue by.
* @param settings Any optional custom settings.
*/
constructor(ItemsHolder: IItemsHoldr, key: string, settings?: any);
constructor(itemsHolder: IItemsHoldr, key: string, settings?: any);
/**
* @returns The value being stored, with a transformGet applied if one exists.
* Gets a stored value, with a transformGet applied if one exists.
*
* @returns The value being stored.
*/

@@ -103,9 +91,3 @@ getValue(): any;

/**
* @returns The stored HTML element, if it exists.
*/
getElement(): HTMLElement;
/**
* General update Function to be run whenever the internal value is changed.
* It runs all the trigger, modular, etc. checks, updates the HTML element
* if there is one, and updates localStorage if needed.
*/

@@ -132,12 +114,6 @@ update(): void;

/**
* Updates the ItemValue's element's second child to be the ItemValue's value.
*/
private updateElement();
/**
* Retrieves a ItemValue's value from localStorage, making sure not to try to
* JSON.parse an undefined or null value.
*
* @returns {Mixed}
*/
private retrieveLocalStorage();
}

@@ -1,8 +0,8 @@

define(["require", "exports"], function (require, exports) {
define(["require", "exports", "./proliferate"], function (require, exports, proliferate_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Storage container for a single ItemsHoldr value. The value may have triggers
* assigned to value, modularity, and other triggers, as well as an HTML element.
* Storage container for a single ItemsHoldr value.
*/
var ItemValue = (function () {
var ItemValue = /** @class */ (function () {
/**

@@ -12,12 +12,11 @@ * Creates a new ItemValue with the given key and settings. Defaults are given

*
* @constructor
* @param ItemsHolder The container for this value.
* @param itemsHolder The container for this value.
* @param key The key to reference this new ItemValue by.
* @param settings Any optional custom settings.
*/
function ItemValue(ItemsHolder, key, settings) {
function ItemValue(itemsHolder, key, settings) {
if (settings === void 0) { settings = {}; }
this.ItemsHolder = ItemsHolder;
ItemsHolder.proliferate(this, ItemsHolder.getDefaults());
ItemsHolder.proliferate(this, settings);
this.itemsHolder = itemsHolder;
proliferate_1.proliferate(this, itemsHolder.getDefaults());
proliferate_1.proliferate(this, settings);
this.key = key;

@@ -27,16 +26,5 @@ if (!this.hasOwnProperty("value")) {

}
if (this.hasElement) {
this.element = ItemsHolder.createElement(this.elementTag || "div", {
className: ItemsHolder.getPrefix() + "_value " + key
});
this.element.appendChild(ItemsHolder.createElement("div", {
"textContent": key
}));
this.element.appendChild(ItemsHolder.createElement("div", {
"textContent": this.value
}));
}
if (this.storeLocally) {
// If there exists an old version of this property, get it
if (ItemsHolder.getLocalStorage().hasOwnProperty(ItemsHolder.getPrefix() + key)) {
// If there exists an old version of this property, get it
if (itemsHolder.getLocalStorage().hasOwnProperty(itemsHolder.getPrefix() + key)) {
this.value = this.retrieveLocalStorage();

@@ -52,3 +40,5 @@ this.update();

/**
* @returns The value being stored, with a transformGet applied if one exists.
* Gets a stored value, with a transformGet applied if one exists.
*
* @returns The value being stored.
*/

@@ -68,20 +58,9 @@ ItemValue.prototype.getValue = function () {

ItemValue.prototype.setValue = function (value) {
if (this.transformSet) {
this.value = this.transformSet(value);
}
else {
this.value = value;
}
this.value = this.transformSet === undefined
? value
: this.transformSet(value);
this.update();
};
/**
* @returns The stored HTML element, if it exists.
*/
ItemValue.prototype.getElement = function () {
return this.element;
};
/**
* General update Function to be run whenever the internal value is changed.
* It runs all the trigger, modular, etc. checks, updates the HTML element
* if there is one, and updates localStorage if needed.
*/

@@ -92,4 +71,4 @@ ItemValue.prototype.update = function () {

this.value = this.minimum;
if (this.onMinimum) {
this.onMinimum.apply(this, this.ItemsHolder.getCallbackArgs());
if (this.onMinimum !== undefined) {
this.onMinimum();
}

@@ -99,4 +78,4 @@ }

this.value = this.maximum;
if (this.onMaximum) {
this.onMaximum.apply(this, this.ItemsHolder.getCallbackArgs());
if (this.onMaximum !== undefined) {
this.onMaximum();
}

@@ -110,5 +89,2 @@ }

}
if (this.hasElement) {
this.updateElement();
}
if (this.storeLocally) {

@@ -126,4 +102,4 @@ this.updateLocalStorage();

ItemValue.prototype.updateLocalStorage = function (overrideAutoSave) {
if (overrideAutoSave || this.ItemsHolder.getAutoSave()) {
this.ItemsHolder.getLocalStorage()[this.ItemsHolder.getPrefix() + this.key] = JSON.stringify(this.value);
if (overrideAutoSave || this.itemsHolder.getAutoSave()) {
this.itemsHolder.getLocalStorage()[this.itemsHolder.getPrefix() + this.key] = JSON.stringify(this.value);
}

@@ -136,3 +112,3 @@ };

if (this.triggers.hasOwnProperty(this.value)) {
this.triggers[this.value].apply(this, this.ItemsHolder.getCallbackArgs());
this.triggers[this.value]();
}

@@ -152,3 +128,3 @@ };

if (this.onModular) {
this.onModular.apply(this, this.ItemsHolder.getCallbackArgs());
this.onModular();
}

@@ -158,20 +134,7 @@ }

/**
* Updates the ItemValue's element's second child to be the ItemValue's value.
*/
ItemValue.prototype.updateElement = function () {
if (this.ItemsHolder.hasDisplayChange(this.value)) {
this.element.children[1].textContent = this.ItemsHolder.getDisplayChange(this.value);
}
else {
this.element.children[1].textContent = this.value;
}
};
/**
* Retrieves a ItemValue's value from localStorage, making sure not to try to
* JSON.parse an undefined or null value.
*
* @returns {Mixed}
*/
ItemValue.prototype.retrieveLocalStorage = function () {
var value = this.ItemsHolder.getLocalStorage()[this.ItemsHolder.getPrefix() + this.key];
var value = this.itemsHolder.getLocalStorage()[this.itemsHolder.getPrefix() + this.key];
if (typeof value === "undefined" || value === "undefined") {

@@ -189,3 +152,1 @@ return undefined;

});
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkl0ZW1WYWx1ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztJQUdBOzs7T0FHRztJQUNIO1FBdUZJOzs7Ozs7OztXQVFHO1FBQ0gsbUJBQVksV0FBd0IsRUFBRSxHQUFXLEVBQUUsUUFBa0I7WUFBbEIsd0JBQWtCLEdBQWxCLGFBQWtCO1lBQ2pFLElBQUksQ0FBQyxXQUFXLEdBQUcsV0FBVyxDQUFDO1lBRS9CLFdBQVcsQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLFdBQVcsQ0FBQyxXQUFXLEVBQUUsQ0FBQyxDQUFDO1lBQ3pELFdBQVcsQ0FBQyxXQUFXLENBQUMsSUFBSSxFQUFFLFFBQVEsQ0FBQyxDQUFDO1lBRXhDLElBQUksQ0FBQyxHQUFHLEdBQUcsR0FBRyxDQUFDO1lBRWYsRUFBRSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsQ0FBQztnQkFDaEMsSUFBSSxDQUFDLEtBQUssR0FBRyxJQUFJLENBQUMsWUFBWSxDQUFDO1lBQ25DLENBQUM7WUFFRCxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztnQkFDbEIsSUFBSSxDQUFDLE9BQU8sR0FBRyxXQUFXLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxVQUFVLElBQUksS0FBSyxFQUFFO29CQUMvRCxTQUFTLEVBQUUsV0FBVyxDQUFDLFNBQVMsRUFBRSxHQUFHLFNBQVMsR0FBRyxHQUFHO2lCQUN2RCxDQ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cbiAgICAgKiBcclxuICAgICAqIEByZXR1cm5zIHtNaXhlZH1cclxuICAgICAqL1xyXG4gICAgcHJpdmF0ZSByZXRyaWV2ZUxvY2FsU3RvcmFnZSgpOiBhbnkge1xyXG4gICAgICAgIGNvbnN0IHZhbHVlOiBhbnkgPSB0aGlzLkl0ZW1zSG9sZGVyLmdldExvY2FsU3RvcmFnZSgpW3RoaXMuSXRlbXNIb2xkZXIuZ2V0UHJlZml4KCkgKyB0aGlzLmtleV07XHJcblxyXG4gICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09IFwidW5kZWZpbmVkXCIgfHwgdmFsdWUgPT09IFwidW5kZWZpbmVkXCIpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHVuZGVmaW5lZDtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIGlmICh2YWx1ZS5jb25zdHJ1Y3RvciAhPT0gU3RyaW5nKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcclxuICAgICAgICB9XHJcblxyXG4gICAgICAgIHJldHVybiBKU09OLnBhcnNlKHZhbHVlKTtcclxuICAgIH1cclxufVxyXG4iXX0=
import { IItemsHoldr } from "./IItemsHoldr";
import { IItemValue, ITriggers } from "./IItemValue";
import { proliferate } from "./proliferate";
/**
* Storage container for a single ItemsHoldr value. The value may have triggers
* assigned to value, modularity, and other triggers, as well as an HTML element.
* Storage container for a single ItemsHoldr value.
*/

@@ -12,3 +12,3 @@ export class ItemValue implements IItemValue {

*/
private ItemsHolder: IItemsHoldr;
private itemsHolder: IItemsHoldr;

@@ -37,17 +37,2 @@ /**

/**
* An HTML element whose second child's textContent is always set to that of the element.
*/
private element: HTMLElement;
/**
* Whether an Element should be created and synced to the value.
*/
private hasElement: boolean;
/**
* An Element tag to use in creating the element, if hasElement is true.
*/
private elementTag: string;
/**
* A minimum value for the value to equal, if value is a number.

@@ -60,3 +45,3 @@ */

*/
private onMinimum: Function;
private onMinimum: Function | undefined;

@@ -71,3 +56,3 @@ /**

*/
private onMaximum: Function;
private onMaximum: Function | undefined;

@@ -87,3 +72,3 @@ /**

*/
private transformGet: Function;
private transformGet?: Function;

@@ -93,3 +78,3 @@ /**

*/
private transformSet: Function;
private transformSet?: Function;

@@ -104,13 +89,12 @@ /**

* to the value via proliferate before the settings.
*
* @constructor
* @param ItemsHolder The container for this value.
*
* @param itemsHolder The container for this value.
* @param key The key to reference this new ItemValue by.
* @param settings Any optional custom settings.
*/
constructor(ItemsHolder: IItemsHoldr, key: string, settings: any = {}) {
this.ItemsHolder = ItemsHolder;
public constructor(itemsHolder: IItemsHoldr, key: string, settings: any = {}) {
this.itemsHolder = itemsHolder;
ItemsHolder.proliferate(this, ItemsHolder.getDefaults());
ItemsHolder.proliferate(this, settings);
proliferate(this, itemsHolder.getDefaults());
proliferate(this, settings);

@@ -123,17 +107,5 @@ this.key = key;

if (this.hasElement) {
this.element = ItemsHolder.createElement(this.elementTag || "div", {
className: ItemsHolder.getPrefix() + "_value " + key
});
this.element.appendChild(ItemsHolder.createElement("div", {
"textContent": key
}));
this.element.appendChild(ItemsHolder.createElement("div", {
"textContent": this.value
}));
}
if (this.storeLocally) {
// If there exists an old version of this property, get it
if (ItemsHolder.getLocalStorage().hasOwnProperty(ItemsHolder.getPrefix() + key)) {
// If there exists an old version of this property, get it
if (itemsHolder.getLocalStorage().hasOwnProperty(itemsHolder.getPrefix() + key)) {
this.value = this.retrieveLocalStorage();

@@ -149,3 +121,5 @@ this.update();

/**
* @returns The value being stored, with a transformGet applied if one exists.
* Gets a stored value, with a transformGet applied if one exists.
*
* @returns The value being stored.
*/

@@ -167,7 +141,5 @@ public getValue(): any {

public setValue(value: any): void {
if (this.transformSet) {
this.value = this.transformSet(value);
} else {
this.value = value;
}
this.value = this.transformSet === undefined
? value
: this.transformSet(value);

@@ -178,12 +150,3 @@ this.update();

/**
* @returns The stored HTML element, if it exists.
*/
public getElement(): HTMLElement {
return this.element;
}
/**
* General update Function to be run whenever the internal value is changed.
* It runs all the trigger, modular, etc. checks, updates the HTML element
* if there is one, and updates localStorage if needed.
*/

@@ -194,9 +157,9 @@ public update(): void {

this.value = this.minimum;
if (this.onMinimum) {
this.onMinimum.apply(this, this.ItemsHolder.getCallbackArgs());
if (this.onMinimum !== undefined) {
this.onMinimum();
}
} else if (this.hasOwnProperty("maximum") && Number(this.value) <= Number(this.maximum)) {
this.value = this.maximum;
if (this.onMaximum) {
this.onMaximum.apply(this, this.ItemsHolder.getCallbackArgs());
if (this.onMaximum !== undefined) {
this.onMaximum();
}

@@ -213,6 +176,2 @@ }

if (this.hasElement) {
this.updateElement();
}
if (this.storeLocally) {

@@ -225,10 +184,10 @@ this.updateLocalStorage();

* Stores a ItemValue's value in localStorage under the prefix plus its key.
*
*
* @param [overrideAutoSave] Whether the policy on saving should be
* ignored (so saving happens regardless). By
* ignored (so saving happens regardless). By
* default, false.
*/
public updateLocalStorage(overrideAutoSave?: boolean): void {
if (overrideAutoSave || this.ItemsHolder.getAutoSave()) {
this.ItemsHolder.getLocalStorage()[this.ItemsHolder.getPrefix() + this.key] = JSON.stringify(this.value);
if (overrideAutoSave || this.itemsHolder.getAutoSave()) {
this.itemsHolder.getLocalStorage()[this.itemsHolder.getPrefix() + this.key] = JSON.stringify(this.value);
}

@@ -242,3 +201,3 @@ }

if (this.triggers.hasOwnProperty(this.value)) {
this.triggers[this.value].apply(this, this.ItemsHolder.getCallbackArgs());
this.triggers[this.value]();
}

@@ -249,3 +208,3 @@ }

* Checks if the current value is greater than the modularity (assuming
* modular is a non-zero Numbers), and if so, continuously reduces value and
* modular is a non-zero Numbers), and if so, continuously reduces value and
* calls this.onModular.

@@ -261,3 +220,3 @@ */

if (this.onModular) {
this.onModular.apply(this, this.ItemsHolder.getCallbackArgs());
this.onModular();
}

@@ -268,20 +227,7 @@ }

/**
* Updates the ItemValue's element's second child to be the ItemValue's value.
*/
private updateElement(): void {
if (this.ItemsHolder.hasDisplayChange(this.value)) {
this.element.children[1].textContent = this.ItemsHolder.getDisplayChange(this.value);
} else {
this.element.children[1].textContent = this.value;
}
}
/**
* Retrieves a ItemValue's value from localStorage, making sure not to try to
* JSON.parse an undefined or null value.
*
* @returns {Mixed}
*/
private retrieveLocalStorage(): any {
const value: any = this.ItemsHolder.getLocalStorage()[this.ItemsHolder.getPrefix() + this.key];
const value: any = this.itemsHolder.getLocalStorage()[this.itemsHolder.getPrefix() + this.key];

@@ -288,0 +234,0 @@ if (typeof value === "undefined" || value === "undefined") {

{
"compilerOptions": {
"declaration": true,
"experimentalDecorators": true,
"jsx": "react",
"lib": ["dom", "es2015.collection", "es2015.promise", "es5"],
"module": "amd",

@@ -10,10 +13,14 @@ "moduleResolution": "node",

"noFallthroughCasesInSwitch": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"pretty": true,
"strictNullChecks": true,
"target": "es3"
"target": "es5"
},
"exclude": [
"dist",
"node_modules"
],
"include": [
"./src/**/*.ts"
"./src/**/*.ts",
"./src/**/*.tsx"
]
}
{
"extends": "./node_modules/shenanigans-manager/setup/tslint.json",
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"class-name": true,
"comment-format": [true, "check-space"],
"curly": true,
"eofline": true,
"forin": true,
"indent": [true, 4],
"interface-name": [true, "always-prefix"],
"jsdoc-format": true,
"label-position": true,
"max-line-length": [true, 140],
"member-access": true,
"member-ordering": [
true,
"public-before-private",
"static-before-instance",
"variables-before-functions"
],
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-arg": true,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
"no-internal-module": true,
"no-null-keyword": true,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unsafe-finally": true,
"no-unused-expression": true,
"no-unused-new": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"one-line": [
true,
"check-catch",
"check-else",
"check-finally",
"check-open-brace",
"check-whitespace"
],
"one-variable-per-declaration": true,
"ordered-imports": true,
"quotemark": [true, "double"],
"semicolon": [true, "always"],
"switch-default": true,
"trailing-comma": true,
"triple-equals": [true, "allow-null-check"],
"typedef": [
true,
"call-signature",
"parameter",
"property-declaration",
"variable-declaration",
"member-variable-declaration"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"use-isnan": true,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
]
"ban-types": false,
"no-any": false,
"no-unsafe-any": false,
"strict-boolean-expressions": false
}
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc