mirror of
https://github.com/FullScreenShenanigans/UserWrappr.git
synced 2026-08-12 02:18:31 -07:00
(v0.7.2) Added UserWrappr param to createContents
This commit is contained in:
+3
-1
@@ -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
@@ -122,5 +122,5 @@
|
||||
"name": "UserWrappr"
|
||||
},
|
||||
"types": "./src/index.d.ts",
|
||||
"version": "0.7.1"
|
||||
}
|
||||
"version": "0.7.2"
|
||||
}
|
||||
|
||||
+9
-2
@@ -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 };
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user