(v0.7.2) Added UserWrappr param to createContents

This commit is contained in:
Josh Goldberg
2017-12-29 18:15:57 -08:00
parent 79cad65f1c
commit 8086942b31
4 changed files with 18 additions and 5 deletions
+3 -1
View File
@@ -8,10 +8,12 @@ node_modules/
!./*.js
!*.json
*.html
Maps.test.ts
npm-debug.log
debug.log
# Added by shenanigans-manager for maps testing
Maps.test.ts
# Local development typically uses npm install --link
# Package lock files aren't updated by linked installs
package-lock.json
+2 -2
View File
@@ -122,5 +122,5 @@
"name": "UserWrappr"
},
"types": "./src/index.d.ts",
"version": "0.7.1"
}
"version": "0.7.2"
}
+9 -2
View File
@@ -3,6 +3,7 @@ import { IClassNames } from "./Bootstrapping/ClassNames";
import { ICreateElement } from "./Bootstrapping/CreateElement";
import { IGetAvailableContainerHeight } from "./Bootstrapping/GetAvailableContainerHeight";
import { IStyles } from "./Bootstrapping/Styles";
import { IUserWrappr } from "./IUserWrappr";
import { IMenuSchema } from "./Menus/MenuSchemas";
import { getAbsoluteSizeInContainer, IAbsoluteSizeSchema, IRelativeSizeSchema } from "./Sizing";
@@ -10,9 +11,10 @@ import { getAbsoluteSizeInContainer, IAbsoluteSizeSchema, IRelativeSizeSchema }
* Creates contents for a size.
*
* @param size Bounding size to create contents in.
* @param userWrapper Containing IUserWrappr holding this display.
* @returns Contents at the size.
*/
export type ICreateContents = (size: IAbsoluteSizeSchema) => Element;
export type ICreateContents = (size: IAbsoluteSizeSchema, userWrapper: IUserWrappr) => Element;
/**
* Menu and content elements, once creatd.
@@ -67,6 +69,11 @@ export interface IDisplayDependencies {
* Styles to use for display elements.
*/
styles: IStyles;
/**
* Containing IUserWrappr holding this display.
*/
userWrapper: IUserWrappr;
}
/**
@@ -116,7 +123,7 @@ export class Display {
const { contentSize, contentArea } = this.areasFaker.createContentArea(containerSize, menuSize);
this.dependencies.container.insertBefore(contentArea, menuArea);
contentArea.appendChild(this.dependencies.createContents(contentSize));
contentArea.appendChild(this.dependencies.createContents(contentSize, this.dependencies.userWrapper));
this.createdElements = { contentArea, menuArea };
+4
View File
@@ -116,6 +116,9 @@ export class UserWrappr implements IUserWrappr {
*/
private display: Display;
/**
* Pending view libraries loading.
*/
private viewLibrariesLoading: Promise<IInitializeMenusView>;
/**
@@ -160,6 +163,7 @@ export class UserWrappr implements IUserWrappr {
getAvailableContainerHeight: this.settings.getAvailableContainerHeight,
menus: this.settings.menus,
styles: this.settings.styles,
userWrapper: this,
});
await this.resetSize(this.settings.defaultSize);