Socket
Socket
Sign inDemoInstall

@paperbits/core

Package Overview
Dependencies
Maintainers
2
Versions
620
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paperbits/core - npm Package Compare versions

Comparing version 0.1.48 to 0.1.49

22

ko/bindingHandlers/bindingHandlers.host.ts

@@ -122,2 +122,24 @@ import * as ko from "knockout";

this.viewManager["hostDocument"] = hostElement.contentDocument;
/* Intercepting push state of hosted window */
const hostedWindowHistory = hostElement.contentDocument.defaultView.window.history;
const hostedWindoworiginalPushState = hostedWindowHistory.pushState;
const routeHandler = this.routeHandler;
const onRouteChange = () => {
hostedWindowHistory.pushState({ host: true }, null, routeHandler.getCurrentUrl());
};
routeHandler.addRouteChangeListener(onRouteChange);
hostedWindowHistory.pushState(null, null, routeHandler.getCurrentUrl());
hostedWindowHistory.pushState = (data: any, title: string, url: string) => {
if (data && data.host) {
return;
}
window.history.pushState(null, null, url);
};
};

@@ -124,0 +146,0 @@

5

ko/bindingHandlers/index.ts

@@ -10,7 +10,5 @@ export * from "./bindingHandlers.align";

export * from "./bindingHandlers.container";
// export * from "./bindingHandlers.content";
export * from "./bindingHandlers.draggables";
export * from "./bindingHandlers.grid";
export * from "./bindingHandlers.gridCommand";
export * from "./bindingHandlers.height";
export * from "./bindingHandlers.highlight";

@@ -26,3 +24,2 @@ export * from "./bindingHandlers.host";

export * from "./bindingHandlers.size";
export * from "./bindingHandlers.snapTo";
export * from "./bindingHandlers.splitter";

@@ -32,2 +29,2 @@ export * from "./bindingHandlers.stickTo";

export * from "./bindingHandlers.validationMessageToggle";
export * from "./bindingHandlers.widget";
export * from "./bindingHandlers.widget";

2

ko/ko.module.ts

@@ -18,3 +18,2 @@ import * as ko from "knockout";

import "./bindingHandlers/bindingHandlers.surface";
import "./bindingHandlers/bindingHandlers.snapTo";
import "./bindingHandlers/bindingHandlers.gridCommand";

@@ -26,3 +25,2 @@ import "./bindingHandlers/bindingHandlers.align";

import "./bindingHandlers/bindingHandlers.container";
import "./bindingHandlers/bindingHandlers.height";
import "./bindingHandlers/bindingHandlers.overflow";

@@ -29,0 +27,0 @@ import "./bindingHandlers/bindingHandlers.stickTo";

{
"name": "@paperbits/core",
"version": "0.1.48",
"version": "0.1.49",
"description": "Paperbits core components.",

@@ -23,4 +23,4 @@ "author": "Paperbits",

"dependencies": {
"@paperbits/common": "0.1.48",
"@paperbits/styles": "0.1.48",
"@paperbits/common": "0.1.49",
"@paperbits/styles": "0.1.49",
"cropperjs": "^1.4.0",

@@ -27,0 +27,0 @@ "file-saver": "^2.0.0",

@@ -10,2 +10,6 @@

const styleKeySnapTop = "utils/block/snapToTop";
const styleKeySnapBottom = "utils/block/snapToBottom";
const styleKeyStretch = "utils/block/stretch";
@Component({

@@ -31,4 +35,4 @@ selector: "layout-section-editor",

this.padding = ko.observable<string>();
this.snap = ko.observable<string>();
this.stretch = ko.observable<boolean>();
this.snap = ko.observable<string>("none");
this.stretch = ko.observable<boolean>(false);
this.background = ko.observable<BackgroundContract>();

@@ -48,12 +52,30 @@ this.typography = ko.observable<TypographyContract>();

this.padding(this.model.padding);
this.snap(this.model.snap);
this.stretch(this.model.height === "stretch");
if (this.model.styles && this.model.styles["instance"]) {
const sectionStyles = await this.styleService.getStyleByKey(this.model.styles["instance"]);
if (this.model.styles) {
if (this.model.styles["instance"]) {
const sectionStyles = await this.styleService.getStyleByKey(this.model.styles["instance"]);
if (sectionStyles) {
this.background(sectionStyles.background);
this.typography(sectionStyles.typography);
if (sectionStyles) {
this.background(sectionStyles.background);
this.typography(sectionStyles.typography);
}
}
if (this.model.styles["size"]) {
this.stretch(true);
}
if (this.model.styles["snap"]) {
const snapStyleKey = this.model.styles["snap"]["xs"];
switch (snapStyleKey) {
case styleKeySnapTop:
this.snap("top");
break;
case styleKeySnapBottom:
this.snap("bottom");
break;
}
}
}

@@ -73,7 +95,26 @@

private applyChanges(): void {
this.model.styles = this.model.styles || {};
this.model.container = this.layout();
this.model.padding = this.padding();
this.model.snap = this.snap();
this.model.height = this.stretch() ? "stretch" : undefined;
if (this.stretch()) {
this.model.styles["size"] = { xs: styleKeyStretch };
}
else {
delete this.model.styles["size"];
}
switch (this.snap()) {
case "top":
this.model.styles["snap"] = { xs: styleKeySnapTop };
break;
case "bottom":
this.model.styles["snap"] = { xs: styleKeySnapBottom };
break;
default:
delete this.model.styles["snap"];
}
this.onChange(this.model);

@@ -80,0 +121,0 @@ }

@@ -13,4 +13,2 @@ import * as ko from "knockout";

public container: KnockoutObservable<string>;
public snapTo: KnockoutObservable<string>;
public height: KnockoutObservable<string>;
public styles: KnockoutObservable<Object>;

@@ -21,6 +19,4 @@

this.container = ko.observable<string>();
this.snapTo = ko.observable<string>();
this.height = ko.observable<string>();
this.styles = ko.observable<Object>();
}
}

@@ -37,4 +37,2 @@ import { SectionViewModel } from "./sectionViewModel";

viewModel.styles(model.styles);
viewModel.snapTo(model.snap);
viewModel.height(model.height);

@@ -41,0 +39,0 @@ const binding: IWidgetBinding = {

@@ -10,12 +10,2 @@ import { Contract } from "@paperbits/common";

layout?: string;
/**
* by content, screen size
*/
height?: string;
/**
* Possible values: top, bottom.
*/
snapping: string;
}
import { WidgetModel } from "@paperbits/common/widgets";
import { BackgroundModel } from "@paperbits/common/widgets/background";

@@ -8,4 +7,2 @@ export class SectionModel {

public padding: string;
public snap: string;
public height: string;
public styles: Object;

@@ -16,3 +13,2 @@

this.padding = "with-padding";
this.snap = "none";
this.styles = {};

@@ -19,0 +15,0 @@ this.widgets = [];

@@ -15,8 +15,4 @@ import { SectionContract } from "./sectionContract";

constructor(
private readonly modelBinderSelector: ModelBinderSelector) {
constructor(private readonly modelBinderSelector: ModelBinderSelector) { }
this.contractToModel = this.contractToModel.bind(this);
}
public async contractToModel(contract: SectionContract): Promise<SectionModel> {

@@ -28,4 +24,2 @@ const model = new SectionModel();

model.padding = contract.padding;
model.snap = contract.snapping;
model.height = contract.height;
model.styles = contract.styles;

@@ -50,4 +44,2 @@

padding: sectionModel.padding,
snapping: sectionModel.snap,
height: sectionModel.height,
styles: sectionModel.styles

@@ -54,0 +46,0 @@ };

@@ -53,3 +53,4 @@ import * as ko from "knockout";

this.model.starsCount = +this.starsCount();
this.model.allStarsCount = +this.allStarsCount();
const count = +this.allStarsCount();
this.model.allStarsCount = count <= 10 ? count : 10;
this.model.author = this.author();

@@ -56,0 +57,0 @@ this.model.authorTitle = this.authorTitle();

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