@prose-reader/core 1.64.0 → 1.66.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.
package/dist/index.js CHANGED
@@ -2463,6 +2463,174 @@ const buildDocumentStyle = ({
2463
2463
  }
2464
2464
  `;
2465
2465
  };
2466
+ const buildStyleForViewportFrame = () => {
2467
+ return `
2468
+ ${getStyleForViewportDocument()}
2469
+ html {
2470
+ width: 100%;
2471
+ height: 100%;
2472
+ }
2473
+ body {
2474
+ width: 100%;
2475
+ height: 100%;
2476
+ margin: 0;
2477
+ }
2478
+ ${/*
2479
+ * @see https://hammerjs.github.io/touch-action/
2480
+ */
2481
+ ``}
2482
+ html, body {
2483
+ touch-action: none;
2484
+ }
2485
+ `;
2486
+ };
2487
+ const buildStyleForReflowableImageOnly = ({
2488
+ isScrollable,
2489
+ enableTouch
2490
+ }) => {
2491
+ return `
2492
+ ${/*
2493
+ * @see https://hammerjs.github.io/touch-action/
2494
+ */
2495
+ ``}
2496
+ html, body {
2497
+ width: 100%;
2498
+ margin: 0;
2499
+ padding: 0;
2500
+ ${enableTouch ? `
2501
+ touch-action: none
2502
+ ` : ``}
2503
+ }
2504
+ ${isScrollable ? `
2505
+ img {
2506
+ height: auto !important;
2507
+ margin: 0;
2508
+ padding: 0;
2509
+ box-sizing: border-box;
2510
+ ${// we make sure img spread on entire screen
2511
+ ``}
2512
+ width: 100%;
2513
+ ${/**
2514
+ * line break issue
2515
+ * @see https://stackoverflow.com/questions/37869020/image-not-taking-up-the-full-height-of-container
2516
+ */
2517
+ ``}
2518
+ display: block;
2519
+ }
2520
+ ` : ``}
2521
+ `;
2522
+ };
2523
+ const buildStyleWithMultiColumn = ({
2524
+ width,
2525
+ columnHeight,
2526
+ columnWidth
2527
+ }) => {
2528
+ return `
2529
+ parsererror {
2530
+ display: none !important;
2531
+ }
2532
+ ${/*
2533
+ might be html * but it does mess up things like figure if so.
2534
+ check accessible_epub_3
2535
+ */
2536
+ ``}
2537
+ html, body {
2538
+ margin: 0;
2539
+ padding: 0 !important;
2540
+ -max-width: ${columnWidth}px !important;
2541
+ }
2542
+ ${/*
2543
+ body {
2544
+ height: ${columnHeight}px !important;
2545
+ width: ${columnWidth}px !important;
2546
+ -margin-left: ${horizontalMargin}px !important;
2547
+ -margin-right: ${horizontalMargin}px !important;
2548
+ -margin: ${verticalMargin}px ${horizontalMargin}px !important;
2549
+ -padding-top: ${horizontalMargin}px !important;
2550
+ -padding-bottom: ${horizontalMargin}px !important;
2551
+ }
2552
+ */
2553
+ ``}
2554
+ body {
2555
+ padding: 0 !important;
2556
+ width: ${width}px !important;
2557
+ height: ${columnHeight}px !important;
2558
+ overflow-y: hidden;
2559
+ column-gap: 0px !important;
2560
+ column-width: ${columnWidth}px !important;
2561
+ column-fill: auto !important;
2562
+ word-wrap: break-word;
2563
+ box-sizing: border-box;
2564
+ }
2565
+ body {
2566
+ margin: 0;
2567
+ }
2568
+ body:focus-visible {
2569
+ ${/*
2570
+ we make sure that there are no outline when we focus something inside the iframe
2571
+ */
2572
+ ``}
2573
+ outline: none;
2574
+ }
2575
+ ${/*
2576
+ * @see https://hammerjs.github.io/touch-action/
2577
+ */
2578
+ ``}
2579
+ html, body {
2580
+ touch-action: none;
2581
+ }
2582
+ ${/*
2583
+ this messes up hard, be careful with this
2584
+ */
2585
+ ``}
2586
+ * {
2587
+ -max-width: ${columnWidth}px !important;
2588
+ }
2589
+ ${/*
2590
+ this is necessary to have a proper calculation when determining size
2591
+ of iframe content. If an img is using something like width:100% it would expand to
2592
+ the size of the original image and potentially gives back a wrong size (much larger)
2593
+ @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns/Handling_Overflow_in_Multicol
2594
+ */
2595
+ ``}
2596
+ img, video, audio, object, svg {
2597
+ max-width: 100%;
2598
+ max-width: ${columnWidth}px !important;
2599
+ max-height: ${columnHeight}px !important;
2600
+ -pointer-events: none;
2601
+ -webkit-column-break-inside: avoid;
2602
+ page-break-inside: avoid;
2603
+ break-inside: avoid;
2604
+ }
2605
+ figure {
2606
+ d-max-width: ${columnWidth}px !important;
2607
+ }
2608
+ img {
2609
+ object-fit: contain;
2610
+ break-inside: avoid;
2611
+ box-sizing: border-box;
2612
+ d-max-width: ${columnWidth}px !important;
2613
+ }
2614
+ ${/*
2615
+ img, video, audio, object, svg {
2616
+ max-height: ${columnHeight}px !important;
2617
+ box-sizing: border-box;
2618
+ object-fit: contain;
2619
+ -webkit-column-break-inside: avoid;
2620
+ page-break-inside: avoid;
2621
+ break-inside: avoid;
2622
+ }
2623
+ */
2624
+ ``}
2625
+ table {
2626
+ max-width: ${columnWidth}px !important;
2627
+ table-layout: fixed;
2628
+ }
2629
+ td {
2630
+ max-width: ${columnWidth}px;
2631
+ }
2632
+ `;
2633
+ };
2466
2634
  const createReflowableSpineItem = ({
2467
2635
  item,
2468
2636
  context,
@@ -2592,174 +2760,6 @@ const createReflowableSpineItem = ({
2592
2760
  layout
2593
2761
  };
2594
2762
  };
2595
- const buildStyleForViewportFrame = () => {
2596
- return `
2597
- ${getStyleForViewportDocument()}
2598
- html {
2599
- width: 100%;
2600
- height: 100%;
2601
- }
2602
- body {
2603
- width: 100%;
2604
- height: 100%;
2605
- margin: 0;
2606
- }
2607
- ${/*
2608
- * @see https://hammerjs.github.io/touch-action/
2609
- */
2610
- ``}
2611
- html, body {
2612
- touch-action: none;
2613
- }
2614
- `;
2615
- };
2616
- const buildStyleForReflowableImageOnly = ({
2617
- isScrollable,
2618
- enableTouch
2619
- }) => {
2620
- return `
2621
- ${/*
2622
- * @see https://hammerjs.github.io/touch-action/
2623
- */
2624
- ``}
2625
- html, body {
2626
- width: 100%;
2627
- margin: 0;
2628
- padding: 0;
2629
- ${enableTouch ? `
2630
- touch-action: none
2631
- ` : ``}
2632
- }
2633
- ${isScrollable ? `
2634
- img {
2635
- height: auto !important;
2636
- margin: 0;
2637
- padding: 0;
2638
- box-sizing: border-box;
2639
- ${// we make sure img spread on entire screen
2640
- ``}
2641
- width: 100%;
2642
- ${/**
2643
- * line break issue
2644
- * @see https://stackoverflow.com/questions/37869020/image-not-taking-up-the-full-height-of-container
2645
- */
2646
- ``}
2647
- display: block;
2648
- }
2649
- ` : ``}
2650
- `;
2651
- };
2652
- const buildStyleWithMultiColumn = ({
2653
- width,
2654
- columnHeight,
2655
- columnWidth
2656
- }) => {
2657
- return `
2658
- parsererror {
2659
- display: none !important;
2660
- }
2661
- ${/*
2662
- might be html * but it does mess up things like figure if so.
2663
- check accessible_epub_3
2664
- */
2665
- ``}
2666
- html, body {
2667
- margin: 0;
2668
- padding: 0 !important;
2669
- -max-width: ${columnWidth}px !important;
2670
- }
2671
- ${/*
2672
- body {
2673
- height: ${columnHeight}px !important;
2674
- width: ${columnWidth}px !important;
2675
- -margin-left: ${horizontalMargin}px !important;
2676
- -margin-right: ${horizontalMargin}px !important;
2677
- -margin: ${verticalMargin}px ${horizontalMargin}px !important;
2678
- -padding-top: ${horizontalMargin}px !important;
2679
- -padding-bottom: ${horizontalMargin}px !important;
2680
- }
2681
- */
2682
- ``}
2683
- body {
2684
- padding: 0 !important;
2685
- width: ${width}px !important;
2686
- height: ${columnHeight}px !important;
2687
- overflow-y: hidden;
2688
- column-gap: 0px !important;
2689
- column-width: ${columnWidth}px !important;
2690
- column-fill: auto !important;
2691
- word-wrap: break-word;
2692
- box-sizing: border-box;
2693
- }
2694
- body {
2695
- margin: 0;
2696
- }
2697
- body:focus-visible {
2698
- ${/*
2699
- we make sure that there are no outline when we focus something inside the iframe
2700
- */
2701
- ``}
2702
- outline: none;
2703
- }
2704
- ${/*
2705
- * @see https://hammerjs.github.io/touch-action/
2706
- */
2707
- ``}
2708
- html, body {
2709
- touch-action: none;
2710
- }
2711
- ${/*
2712
- this messes up hard, be careful with this
2713
- */
2714
- ``}
2715
- * {
2716
- -max-width: ${columnWidth}px !important;
2717
- }
2718
- ${/*
2719
- this is necessary to have a proper calculation when determining size
2720
- of iframe content. If an img is using something like width:100% it would expand to
2721
- the size of the original image and potentially gives back a wrong size (much larger)
2722
- @see https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns/Handling_Overflow_in_Multicol
2723
- */
2724
- ``}
2725
- img, video, audio, object, svg {
2726
- max-width: 100%;
2727
- max-width: ${columnWidth}px !important;
2728
- max-height: ${columnHeight}px !important;
2729
- -pointer-events: none;
2730
- -webkit-column-break-inside: avoid;
2731
- page-break-inside: avoid;
2732
- break-inside: avoid;
2733
- }
2734
- figure {
2735
- d-max-width: ${columnWidth}px !important;
2736
- }
2737
- img {
2738
- object-fit: contain;
2739
- break-inside: avoid;
2740
- box-sizing: border-box;
2741
- d-max-width: ${columnWidth}px !important;
2742
- }
2743
- ${/*
2744
- img, video, audio, object, svg {
2745
- max-height: ${columnHeight}px !important;
2746
- box-sizing: border-box;
2747
- object-fit: contain;
2748
- -webkit-column-break-inside: avoid;
2749
- page-break-inside: avoid;
2750
- break-inside: avoid;
2751
- }
2752
- */
2753
- ``}
2754
- table {
2755
- max-width: ${columnWidth}px !important;
2756
- table-layout: fixed;
2757
- }
2758
- td {
2759
- max-width: ${columnWidth}px;
2760
- }
2761
- `;
2762
- };
2763
2763
  const createSpineItem = ({
2764
2764
  item,
2765
2765
  context,
@@ -6122,8 +6122,8 @@ class SettingsManager3 {
6122
6122
  };
6123
6123
  this.inputSettings = settingsWithDefaults;
6124
6124
  this.outputSettingsUpdateSubject = new Subject();
6125
- this.settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(shareReplay(1));
6126
- this.settings$.subscribe();
6125
+ this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(shareReplay(1));
6126
+ this._settings$.subscribe();
6127
6127
  }
6128
6128
  _prepareUpdate(settings) {
6129
6129
  const newInputSettings = shallowMergeIfDefined(this.inputSettings, settings);
@@ -6153,6 +6153,13 @@ class SettingsManager3 {
6153
6153
  }
6154
6154
  return this.outputSettings;
6155
6155
  }
6156
+ get settings$() {
6157
+ if (!this.outputSettings) {
6158
+ const { commit } = this._prepareUpdate(this.inputSettings);
6159
+ commit();
6160
+ }
6161
+ return this._settings$;
6162
+ }
6156
6163
  destroy() {
6157
6164
  this.outputSettingsUpdateSubject.complete();
6158
6165
  }
@@ -6175,7 +6182,6 @@ class ReaderSettingsManager extends SettingsManager3 {
6175
6182
  })
6176
6183
  );
6177
6184
  merge(recomputeSettingsOnContextChange$, updateContextOnSettingsChanges$).pipe(takeUntil$1(context.destroy$)).subscribe();
6178
- this.settings$.subscribe();
6179
6185
  }
6180
6186
  getComputedSettings(settings) {
6181
6187
  const manifest = this.context.manifest;