Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wildebeest/boxlayout

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wildebeest/boxlayout - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

tests/BoxLayout.test.ts

2

dist/block/Block.d.ts

@@ -0,3 +1,5 @@

import { AbsolutePosition } from "../position/AbsolutePosition";
export interface Block {
bind(element: HTMLElement): void;
getPositions(): Array<AbsolutePosition>;
}
import { Block } from "./Block";
import { AbsolutePosition } from "../position/AbsolutePosition";
export declare class BlockBlueprint implements Block {

@@ -6,2 +7,3 @@ protected config: Array<any>;

bind(element: HTMLElement): void;
getPositions(): Array<AbsolutePosition>;
}

@@ -14,2 +14,9 @@ "use strict";

};
BlockBlueprint.prototype.getPositions = function () {
var positions = [];
for (var i = 0; i < this.config.length; i++) {
positions.push(this.config[i].position);
}
return positions;
};
return BlockBlueprint;

@@ -16,0 +23,0 @@ }());

@@ -8,2 +8,3 @@ import { Block } from "./Block";

bind(element: HTMLElement): void;
getPositions(): Array<AbsolutePosition>;
}

@@ -22,2 +22,5 @@ "use strict";

};
HorizontalBlock.prototype.getPositions = function () {
return this.blueprint.getPositions();
};
return HorizontalBlock;

@@ -24,0 +27,0 @@ }());

@@ -8,2 +8,3 @@ import { Block } from "./Block";

bind(element: HTMLElement): void;
getPositions(): Array<AbsolutePosition>;
}

@@ -25,2 +25,5 @@ "use strict";

};
RecktangleBlock.prototype.getPositions = function () {
return this.blueprint.getPositions();
};
return RecktangleBlock;

@@ -27,0 +30,0 @@ }());

@@ -8,2 +8,3 @@ import { Block } from "./Block";

bind(element: HTMLElement): void;
getPositions(): Array<AbsolutePosition>;
}

@@ -22,2 +22,5 @@ "use strict";

};
VerticalBlock.prototype.getPositions = function () {
return this.blueprint.getPositions();
};
return VerticalBlock;

@@ -24,0 +27,0 @@ }());

@@ -6,3 +6,9 @@ import { EmitterService, Emitter, ViewportService, DomService } from "@wildebeest/common";

import { VerticalDeviderBuilder } from "./VerticalDeviderBuilder";
import { Block } from "./block/Block";
export declare class BoxLayout {
static BLOCK_TOP: string;
static BLOCK_LEFT: string;
static BLOCK_CENTER: string;
static BLOCK_RIGHT: string;
static BLOCK_BOTTOM: string;
protected positions: any;

@@ -22,4 +28,5 @@ protected blueprints: any;

setBlock(element: any, blockName: string): void;
getBlock(blockName: string): Block;
getEmitter(): Emitter;
recalc(): void;
}

@@ -50,2 +50,6 @@ "use strict";

};
this.positions.topInverse = new InverseValue_1.InverseValue(this.positions.top);
this.positions.rightInverse = new InverseValue_1.InverseValue(this.positions.right);
this.positions.bototmInverse = new InverseValue_1.InverseValue(this.positions.bottom);
this.positions.leftInverse = new InverseValue_1.InverseValue(this.positions.left);
this.blueprints = {

@@ -70,3 +74,3 @@ top: new RectangleBlock_1.RecktangleBlock(this.positions.screenTop, this.positions.screenRight, new InverseValue_1.InverseValue(this.positions.top), this.positions.screenLeft),

this.positions.left.setValue(this.config.left || 0);
if (config.deviders.dragable) {
if (config.deviders && config.deviders.dragable) {
this.createDragableDevider(this.blueprints.deviderLeft, this.builers.vertical).getEmitter().on('wbDrag', function (event) {

@@ -95,2 +99,5 @@ _this.positions.left.moveBy(event.horizontal);

};
BoxLayout.prototype.getBlock = function (blockName) {
return this.blueprints[blockName];
};
BoxLayout.prototype.getEmitter = function () {

@@ -105,2 +112,7 @@ return this.emitter;

};
BoxLayout.BLOCK_TOP = "top";
BoxLayout.BLOCK_LEFT = "left";
BoxLayout.BLOCK_CENTER = "center";
BoxLayout.BLOCK_RIGHT = "right";
BoxLayout.BLOCK_BOTTOM = "bottom";
BoxLayout = __decorate([

@@ -107,0 +119,0 @@ inversify_1.injectable(),

1

dist/position/InverseValue.d.ts

@@ -8,3 +8,2 @@ import { AbsolutePosition } from "./AbsolutePosition";

bind(binding: Binding): void;
bindInverse(binding: Binding): void;
getMax(): number;

@@ -11,0 +10,0 @@ getMin(): number;

@@ -13,3 +13,2 @@ "use strict";

};
InverseValue.prototype.bindInverse = function (binding) { };
InverseValue.prototype.getMax = function () {

@@ -21,4 +20,3 @@ return this.position.getMax();

};
InverseValue.prototype.moveBy = function (value) {
};
InverseValue.prototype.moveBy = function (value) { };
InverseValue.prototype.getValue = function () {

@@ -25,0 +23,0 @@ return this.getMax() - this.position.getValue();

@@ -5,3 +5,2 @@ import { Binding } from "../binding/Binding";

protected bindings: Array<Binding>;
protected inverseBindings: Array<Binding>;
protected value: number;

@@ -12,3 +11,2 @@ protected min: number;

bind(binding: Binding): void;
bindInverse(binding: Binding): void;
setValue(value: number): void;

@@ -15,0 +13,0 @@ moveBy(value: number): void;

@@ -6,3 +6,2 @@ "use strict";

this.bindings = [];
this.inverseBindings = [];
this.value = 0;

@@ -16,5 +15,2 @@ this.value = value;

};
PositionValue.prototype.bindInverse = function (binding) {
this.inverseBindings.push(binding);
};
PositionValue.prototype.setValue = function (value) {

@@ -38,5 +34,2 @@ value = Math.min(Math.max(value, this.min), this.max);

}
for (var i = 0; i < this.inverseBindings.length; i++) {
this.inverseBindings[i].update(this.max - this.value);
}
};

@@ -43,0 +36,0 @@ PositionValue.prototype.getMax = function () {

{
"name": "@wildebeest/boxlayout",
"version": "0.4.6",
"version": "0.4.7",
"description": "Box Layout module for creating fullscreen admin enviroments",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -0,4 +1,7 @@

import { AbsolutePosition } from "../position/AbsolutePosition";
export interface Block
{
bind(element: HTMLElement): void;
getPositions(): Array<AbsolutePosition>;
}
import { Binding } from "../binding/Binding";
import { Block } from "./Block";
import { PixelsBinding } from "../binding/PixelsBinding";
import { AbsolutePosition } from "../position/AbsolutePosition";

@@ -21,2 +22,11 @@ export class BlockBlueprint implements Block

}
getPositions(): Array<AbsolutePosition>
{
let positions: Array<AbsolutePosition> = [];
for (let i = 0; i < this.config.length; i++) {
positions.push(this.config[i].position)
}
return positions;
}
}

@@ -29,2 +29,7 @@ import { Block } from "./Block";

}
getPositions(): Array<AbsolutePosition>
{
return this.blueprint.getPositions();
}
}

@@ -32,2 +32,7 @@ import { Block } from "./Block";

}
getPositions(): Array<AbsolutePosition>
{
return this.blueprint.getPositions();
}
}

@@ -29,2 +29,7 @@ import { Block } from "./Block";

}
getPositions(): Array<AbsolutePosition>
{
return this.blueprint.getPositions();
}
}

@@ -14,2 +14,3 @@ import { injectable, inject } from "inversify";

import { PositionValue } from "./position/PositionValue";
import { Block } from "./block/Block";

@@ -19,2 +20,8 @@ @injectable()

{
public static BLOCK_TOP: string = "top";
public static BLOCK_LEFT: string = "left";
public static BLOCK_CENTER: string = "center";
public static BLOCK_RIGHT: string = "right";
public static BLOCK_BOTTOM: string = "bottom";
protected positions: any = {};

@@ -52,2 +59,7 @@ protected blueprints: any = {};

this.positions.topInverse = new InverseValue(this.positions.top);
this.positions.rightInverse = new InverseValue(this.positions.right);
this.positions.bototmInverse = new InverseValue(this.positions.bottom);
this.positions.leftInverse = new InverseValue(this.positions.left);
this.blueprints = {

@@ -75,3 +87,3 @@ top: new RecktangleBlock(this.positions.screenTop, this.positions.screenRight, new InverseValue(this.positions.top), this.positions.screenLeft),

if (config.deviders.dragable) {
if (config.deviders && config.deviders.dragable) {
this.createDragableDevider(this.blueprints.deviderLeft, this.builers.vertical).getEmitter().on('wbDrag', (event: any) => {

@@ -109,2 +121,7 @@ this.positions.left.moveBy(event.horizontal);

public getBlock(blockName: string): Block
{
return this.blueprints[blockName];
}
// public onResize(event: any): void

@@ -111,0 +128,0 @@ // {

@@ -20,3 +20,2 @@ import { AbsolutePosition } from "./AbsolutePosition";

}
bindInverse(binding: Binding): void { }

@@ -33,6 +32,3 @@ getMax(): number

moveBy(value: number): void
{
}
moveBy(value: number): void { }

@@ -39,0 +35,0 @@ getValue(): number

@@ -7,3 +7,2 @@ import { Binding } from "../binding/Binding";

protected bindings: Array<Binding> = [];
protected inverseBindings: Array<Binding> = [];
protected value: number = 0;

@@ -25,7 +24,2 @@ protected min: number;

public bindInverse(binding: Binding): void
{
this.inverseBindings.push(binding);
}
public setValue(value: number): void

@@ -56,5 +50,2 @@ {

}
for (let i = 0; i < this.inverseBindings.length; i++) {
this.inverseBindings[i].update(this.max - this.value);
}
}

@@ -61,0 +52,0 @@

@@ -13,4 +13,3 @@ import 'ts-jest';

test("screen resize", () => {
let vertical: AbsolutePosition = new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService);
test("screen horizontal resize", () => {
let horizontal: AbsolutePosition = new ScreenHorizontalPositionValue(new PositionValue(0 , 0, viewportService.getWidth()), viewportService);

@@ -23,7 +22,18 @@

vertical.setValue(1000);
horizontal.setValue(1000);
expect(horizontal.getValue()).toEqual(300);
});
test("screen vertical resize", () => {
let vertical: AbsolutePosition = new ScreenVerticalPositionValue(new PositionValue(0 , 0, viewportService.getHeight()), viewportService);
viewportService.getEmitter().emit("change", {
vertical: 200,
horizontal: 300
});
vertical.setValue(1000);
expect(vertical.getValue()).toEqual(200);
expect(horizontal.getValue()).toEqual(300);
})
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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