@fluid-topics/ft-reader-context 1.4.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { customElement } from "@fluid-topics/ft-wc-utils";
2
+ import { FtReaderContext } from "./ft-reader-context";
3
+ customElement("ft-reader-context")(FtReaderContext);
@@ -6,13 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { html, nothing } from "lit";
8
8
  import { property } from "lit/decorators.js";
9
- import { Debouncer, FtLitElementRedux, redux } from "@fluid-topics/ft-wc-utils";
9
+ import { Debouncer, FtLitElementRedux, numberProperty, randomId, redux } from "@fluid-topics/ft-wc-utils";
10
10
  import { FtReaderStateManager } from "./store/FtReaderStateManager";
11
11
  import { styles } from "./ft-reader-context.styles";
12
12
  import { AuthenticationChangeEvent, ftAppInfoStore, userAssetsActions } from "@fluid-topics/ft-app-context";
13
13
  import { ForbiddenErrorEvent, LoadErrorEvent, MapLoadedEvent, NavigationDoneEvent, NotFoundErrorEvent, TopicRelativeNotFoundEvent, UnauthorizedErrorEvent, VisibleTopicsChangeEvent } from "./models";
14
14
  import { ReaderService } from "./services/ReaderService";
15
- const fromNumberAttribute = (defaultValue) => (value) => +(value !== null && value !== void 0 ? value : "NaN") > 0 ? +value : defaultValue;
16
15
  class FtReaderContext extends FtLitElementRedux {
17
16
  constructor() {
18
17
  super();
@@ -45,7 +44,7 @@ class FtReaderContext extends FtLitElementRedux {
45
44
  }
46
45
  get stateManager() {
47
46
  if (this._stateManager == null) {
48
- this._stateManager = FtReaderStateManager.build(this.id || ("" + Math.round(Math.random() * 999000)).padStart(6, "0"), this.readerServiceProvider);
47
+ this._stateManager = FtReaderStateManager.build(this.id || randomId(6), this.readerServiceProvider);
49
48
  this._stateManager.errorHandler = (e) => this.handleLoadError(e);
50
49
  this.addStore(this.stateManager.store, "reader");
51
50
  }
@@ -216,7 +215,7 @@ __decorate([
216
215
  property()
217
216
  ], FtReaderContext.prototype, "searchInDocumentQuery", void 0);
218
217
  __decorate([
219
- property({ type: Number, converter: { fromAttribute: fromNumberAttribute() } })
218
+ numberProperty({ min: 1 })
220
219
  ], FtReaderContext.prototype, "page", void 0);
221
220
  __decorate([
222
221
  redux({ store: "reader" })