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