@paperbits/core
Advanced tools
Comparing version 0.1.64 to 0.1.65
@@ -0,1 +1,2 @@ | ||
import { Hinter } from "@paperbits/common/tutorials/hinter"; | ||
import { Confirmation } from "./workshops/confirmation/ko/confirmation"; | ||
@@ -43,3 +44,2 @@ import { LightboxBindingHandler } from "./ko/bindingHandlers/bindingHandlers.lightbox"; | ||
import { DragManager } from "@paperbits/common/ui/draggables"; | ||
import { SavingHandler } from "@paperbits/common/persistence/savingHandler"; | ||
import { UnhandledErrorHandler } from "@paperbits/common/errors"; | ||
@@ -135,3 +135,4 @@ import { PlaceholderViewModel } from "./placeholder/ko/placeholderViewModel"; | ||
injector.bindToCollection("autostart", LightboxBindingHandler); | ||
injector.bindToCollection("autostart", Hinter); | ||
} | ||
} |
import * as ko from "knockout"; | ||
import * as Utils from "@paperbits/common/utils"; | ||
import { GlobalEventHandler } from "@paperbits/common/events"; | ||
import { IEventManager, GlobalEventHandler } from "@paperbits/common/events"; | ||
import { IViewManager, ViewManagerMode } from "@paperbits/common/ui"; | ||
@@ -11,2 +11,3 @@ import { IRouteHandler } from "@paperbits/common/routing"; | ||
constructor( | ||
private readonly eventManager: IEventManager, | ||
private readonly globalEventHandler: GlobalEventHandler, | ||
@@ -113,2 +114,5 @@ private readonly viewManager: IViewManager, | ||
} | ||
else { | ||
this.eventManager.dispatchEvent("DesignTimeNavigationHint"); | ||
} | ||
}; | ||
@@ -115,0 +119,0 @@ |
import * as ko from "knockout"; | ||
ko.components.register("spinner", { | ||
template: `<div class="text-center">Working...</div>`, | ||
template: `<div class="spinner"><div class="dot"></div><div class="dot"></div><div class="dot"></div></div>`, | ||
viewModel: () => null | ||
}); |
@@ -1,3 +0,3 @@ | ||
export * from "./progressIndicator"; | ||
export * from "./toast"; | ||
export * from "./tooltip"; | ||
export * from "./viewManager"; |
@@ -12,3 +12,3 @@ import * as _ from "lodash"; | ||
import { IComponent, IView, IViewManager, ViewManagerMode, IHighlightConfig, IContextCommandSet, ISplitterConfig } from "@paperbits/common/ui"; | ||
import { ProgressIndicator } from "../ui"; | ||
import { Toast } from "../ui"; | ||
import { IRouteHandler } from "@paperbits/common/routing"; | ||
@@ -34,3 +34,3 @@ import { ISiteService, SettingsContract } from "@paperbits/common/sites"; | ||
public itemSelectorName: ko.Observable<string>; | ||
public progressIndicators: ko.ObservableArray<ProgressIndicator>; | ||
public toasts: ko.ObservableArray<Toast>; | ||
public balloons: ko.ObservableArray<IComponent>; | ||
@@ -67,21 +67,5 @@ public primaryToolboxVisible: ko.Observable<boolean>; | ||
// rebinding... | ||
this.addProgressIndicator = this.addProgressIndicator.bind(this); | ||
this.addPromiseProgressIndicator = this.addPromiseProgressIndicator.bind(this); | ||
this.openViewAsWorkshop = this.openViewAsWorkshop.bind(this); | ||
this.openViewAsPopup = this.openViewAsPopup.bind(this); | ||
this.scheduleIndicatorRemoval = this.scheduleIndicatorRemoval.bind(this); | ||
this.updateJourneyComponent = this.updateJourneyComponent.bind(this); | ||
this.clearJourney = this.clearJourney.bind(this); | ||
this.foldEverything = this.foldEverything.bind(this); | ||
this.unfoldEverything = this.unfoldEverything.bind(this); | ||
this.closeWidgetEditor = this.closeWidgetEditor.bind(this); | ||
this.closeEditors = this.closeEditors.bind(this); | ||
this.onDragEnd = this.onDragEnd.bind(this); | ||
this.onHoverCommandActivate = this.onHoverCommandActivate.bind(this); | ||
this.onHoverCommandDeactivate = this.onHoverCommandDeactivate.bind(this); | ||
// setting up... | ||
this.mode = ViewManagerMode.selecting; | ||
this.progressIndicators = ko.observableArray<ProgressIndicator>(); | ||
this.toasts = ko.observableArray<Toast>(); | ||
this.balloons = ko.observableArray<IComponent>(); | ||
@@ -103,7 +87,4 @@ this.journey = ko.observableArray<IView>(); | ||
this.selectedElementContextualEditor = ko.observable<IContextCommandSet>(); | ||
this.viewport = ko.observable<string>("xl"); | ||
this.host = ko.observable<IComponent>({ name: "content-host" }); | ||
@@ -116,13 +97,12 @@ | ||
this.globalEventHandler.addDragEnterListener(this.foldEverything); | ||
this.globalEventHandler.addDragDropListener(this.onDragEnd); | ||
this.globalEventHandler.addDragEndListener(this.onDragEnd); | ||
this.globalEventHandler.addDragLeaveScreenListener(this.unfoldEverything); | ||
this.globalEventHandler.addDragEnterListener(this.foldEverything.bind(this)); | ||
this.globalEventHandler.addDragDropListener(this.onDragEnd.bind(this)); | ||
this.globalEventHandler.addDragEndListener(this.onDragEnd.bind(this)); | ||
this.globalEventHandler.addDragLeaveScreenListener(this.unfoldEverything.bind(this)); | ||
this.eventManager.addEventListener("virtualDragEnd", this.onDragEnd.bind(this)); | ||
this.eventManager.addEventListener("virtualDragEnd", this.onDragEnd); | ||
this.routeHandler.addRouteChangeListener(this.onRouteChange.bind(this)); | ||
globalEventHandler.appendDocument(document); | ||
eventManager.addEventListener("onEscape", this.closeEditors); | ||
eventManager.addEventListener("onEscape", this.closeEditors.bind(this)); | ||
@@ -145,3 +125,3 @@ this.loadFavIcon(); | ||
this.clearContextualEditors(); | ||
this.closeWidgetEditor(); | ||
this.closeView(); | ||
} | ||
@@ -165,30 +145,42 @@ | ||
public addProgressIndicator(title: string, content: string): ProgressIndicator { | ||
const indicator = new ProgressIndicator(title, content); | ||
this.progressIndicators.push(indicator); | ||
public addToast(title: string, content: string): Toast { | ||
const toast = new Toast(title, content); | ||
this.toasts.push(toast); | ||
return indicator; | ||
return toast; | ||
} | ||
public notifySuccess(title: string, content: string): void { | ||
const indicator = new ProgressIndicator(title, content, 100); | ||
this.progressIndicators.push(indicator); | ||
this.scheduleIndicatorRemoval(indicator); | ||
const toast = new Toast(title, content, "success"); | ||
this.toasts.push(toast); | ||
this.scheduleToastRemoval(toast); | ||
} | ||
public addPromiseProgressIndicator<T>(promise: Promise<T>, title: string, content: string): void { | ||
const indicator = new ProgressIndicator(title, content); | ||
public notifyInfo(title: string, content: string): void { | ||
const toast = new Toast(title, content, "info"); | ||
this.toasts.push(toast); | ||
this.scheduleToastRemoval(toast); | ||
} | ||
this.progressIndicators.push(indicator); | ||
public notifyError(title: string, content: string): void { | ||
const toast = new Toast(title, content, "error"); | ||
this.toasts.push(toast); | ||
this.scheduleToastRemoval(toast); | ||
} | ||
public notifyProgress(promise: Promise<any>, title: string, content: string): void { | ||
const toast = new Toast(title, content); | ||
this.toasts.push(toast); | ||
if (promise["progress"]) { | ||
promise["progress"](indicator.progress); | ||
promise["progress"](toast.progress); | ||
} | ||
promise.then(() => { | ||
indicator.complete(true); | ||
toast.complete(true); | ||
}); | ||
promise.then(() => { | ||
this.scheduleIndicatorRemoval(indicator); | ||
this.scheduleToastRemoval(toast); | ||
}); | ||
@@ -276,8 +268,8 @@ } | ||
public scheduleIndicatorRemoval(indicator: ProgressIndicator): void { | ||
indicator.progress(100); | ||
public scheduleToastRemoval(toast: Toast): void { | ||
toast.progress(100); | ||
setTimeout(() => { | ||
this.progressIndicators(_.without(this.progressIndicators(), indicator)); | ||
}, 4000); | ||
this.toasts(_.without(this.toasts(), toast)); | ||
}, 8000); | ||
} | ||
@@ -302,6 +294,6 @@ | ||
view.component.params.onClose = () => this.closeWidgetEditor(); | ||
view.component.params.onClose = () => this.closeView(); | ||
this.clearContextualEditors(); | ||
this.closeWidgetEditor(); | ||
this.closeView(); | ||
this.widgetEditor(view); | ||
@@ -316,3 +308,3 @@ this.mode = ViewManagerMode.configure; | ||
public closeEditors(): void { | ||
this.closeWidgetEditor(); | ||
this.closeView(); | ||
this.clearJourney(); | ||
@@ -342,3 +334,3 @@ } | ||
public closeWidgetEditor(): void { | ||
public closeView(): void { | ||
this.widgetEditor(null); | ||
@@ -398,3 +390,3 @@ this.eventManager.dispatchEvent("onWidgetEditorClose"); | ||
this.clearContextualEditors(); | ||
this.closeWidgetEditor(); | ||
this.closeView(); | ||
this.selectedElement(null); | ||
@@ -444,3 +436,3 @@ this.selectedElement(config); | ||
this.clearContextualEditors(); | ||
this.closeWidgetEditor(); | ||
this.closeView(); | ||
this.dragSession(session); | ||
@@ -447,0 +439,0 @@ this.foldEverything(); |
{ | ||
"name": "@paperbits/core", | ||
"version": "0.1.64", | ||
"version": "0.1.65", | ||
"description": "Paperbits core components.", | ||
@@ -23,4 +23,4 @@ "author": "Paperbits", | ||
"dependencies": { | ||
"@paperbits/common": "0.1.64", | ||
"@paperbits/styles": "0.1.64", | ||
"@paperbits/common": "0.1.65", | ||
"@paperbits/styles": "0.1.65", | ||
"cropperjs": "^1.4.0", | ||
@@ -27,0 +27,0 @@ "file-saver": "^2.0.0", |
@@ -141,3 +141,3 @@ import * as ko from "knockout"; | ||
}); | ||
await this.viewManager.addPromiseProgressIndicator(uploadPromise, "Media library", `Updating ${this.mediaItem.fileName()}...`); | ||
await this.viewManager.notifyProgress(uploadPromise, "Media library", `Updating ${this.mediaItem.fileName()}...`); | ||
} | ||
@@ -144,0 +144,0 @@ |
@@ -241,3 +241,3 @@ import template from "./dropbucket.html"; | ||
this.viewManager.addPromiseProgressIndicator(uploadPromise, "Media library", `Uploading ${uploadable}...`); | ||
this.viewManager.notifyProgress(uploadPromise, "Media library", `Uploading ${uploadable}...`); | ||
} | ||
@@ -248,3 +248,3 @@ else { | ||
uploadPromise = this.mediaService.createMedia(uploadable.name, content, uploadable.type); | ||
this.viewManager.addPromiseProgressIndicator(uploadPromise, "Media library", `Uploading ${uploadable.name}...`); | ||
this.viewManager.notifyProgress(uploadPromise, "Media library", `Uploading ${uploadable.name}...`); | ||
} | ||
@@ -251,0 +251,0 @@ |
@@ -121,3 +121,3 @@ import * as ko from "knockout"; | ||
this.viewManager.addPromiseProgressIndicator(uploadPromise, "Media library", `Uploading ${file.name}...`); | ||
this.viewManager.notifyProgress(uploadPromise, "Media library", `Uploading ${file.name}...`); | ||
uploadPromises.push(uploadPromise); | ||
@@ -124,0 +124,0 @@ } |
@@ -96,3 +96,3 @@ import * as ko from "knockout"; | ||
this.viewManager.addPromiseProgressIndicator(uploadPromise, "Media library", `Uploading ${file.name}...`); | ||
this.viewManager.notifyProgress(uploadPromise, "Media library", `Uploading ${file.name}...`); | ||
uploadPromises.push(uploadPromise); | ||
@@ -99,0 +99,0 @@ } |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11934
639709
+ Added@paperbits/common@0.1.65(transitive)
+ Added@paperbits/styles@0.1.65(transitive)
- Removed@paperbits/common@0.1.64(transitive)
- Removed@paperbits/styles@0.1.64(transitive)
Updated@paperbits/common@0.1.65
Updated@paperbits/styles@0.1.65