@internetarchive/bookreader 5.0.0-28-remove-url-defaults → 5.0.0-30-b
Sign up to get free protection for your applications and to get access to all the features.
- package/.husky/_/husky.sh +30 -0
- package/BookReader/BookReader.css +1 -1
- package/BookReader/BookReader.js +1 -1
- package/BookReader/BookReader.js.map +1 -1
- package/BookReader/ia-bookreader-bundle.js +1458 -0
- package/BookReader/{bookreader-component-bundle.js.LICENSE.txt → ia-bookreader-bundle.js.LICENSE.txt} +12 -0
- package/BookReader/ia-bookreader-bundle.js.map +1 -0
- package/BookReader/plugins/plugin.search.js +1 -1
- package/BookReader/plugins/plugin.search.js.map +1 -1
- package/BookReaderDemo/BookReaderDemo.css +14 -1
- package/BookReaderDemo/IADemoBr.js +107 -0
- package/BookReaderDemo/demo-internetarchive.html +64 -99
- package/CHANGELOG.md +4 -0
- package/package.json +9 -6
- package/src/BookNavigator/assets/ia-logo.js +17 -0
- package/src/BookNavigator/book-navigator.js +528 -0
- package/src/BookNavigator/bookmarks/bookmark-button.js +2 -1
- package/src/BookNavigator/bookmarks/bookmarks-provider.js +20 -8
- package/src/BookNavigator/bookmarks/ia-bookmarks.js +84 -51
- package/src/BookNavigator/downloads/downloads-provider.js +5 -9
- package/src/BookNavigator/downloads/downloads.js +1 -0
- package/src/BookNavigator/search/search-provider.js +15 -8
- package/src/BookNavigator/sharing.js +27 -0
- package/src/BookNavigator/visual-adjustments/visual-adjustments-provider.js +9 -8
- package/src/BookNavigator/volumes/volumes-provider.js +3 -4
- package/src/BookReader/options.js +6 -0
- package/src/BookReader.js +20 -8
- package/src/css/_BRComponent.scss +1 -1
- package/src/ia-bookreader/ia-bookreader.js +209 -0
- package/src/plugins/search/plugin.search.js +9 -9
- package/{src → stat}/BookNavigator/BookModel.js +0 -0
- package/{src → stat}/BookNavigator/BookNavigator.js +109 -102
- package/stat/BookNavigator/assets/bookmark-colors.js +15 -0
- package/stat/BookNavigator/assets/button-base.js +61 -0
- package/stat/BookNavigator/assets/ia-logo.js +17 -0
- package/stat/BookNavigator/assets/icon_checkmark.js +6 -0
- package/stat/BookNavigator/assets/icon_close.js +3 -0
- package/stat/BookNavigator/assets/icon_sort_asc.js +5 -0
- package/stat/BookNavigator/assets/icon_sort_desc.js +5 -0
- package/stat/BookNavigator/assets/icon_sort_neutral.js +5 -0
- package/stat/BookNavigator/assets/icon_volumes.js +11 -0
- package/stat/BookNavigator/bookmarks/bookmark-button.js +64 -0
- package/stat/BookNavigator/bookmarks/bookmark-edit.js +215 -0
- package/stat/BookNavigator/bookmarks/bookmarks-list.js +285 -0
- package/stat/BookNavigator/bookmarks/bookmarks-loginCTA.js +28 -0
- package/stat/BookNavigator/bookmarks/bookmarks-provider.js +56 -0
- package/stat/BookNavigator/bookmarks/ia-bookmarks.js +523 -0
- package/{src → stat}/BookNavigator/br-fullscreen-mgr.js +1 -2
- package/stat/BookNavigator/delete-modal-actions.js +49 -0
- package/stat/BookNavigator/downloads/downloads-provider.js +72 -0
- package/stat/BookNavigator/downloads/downloads.js +139 -0
- package/stat/BookNavigator/provider-config.js +0 -0
- package/stat/BookNavigator/search/a-search-result.js +55 -0
- package/stat/BookNavigator/search/search-provider.js +180 -0
- package/stat/BookNavigator/search/search-results.js +360 -0
- package/{src/ItemNavigator/providers → stat/BookNavigator}/sharing.js +3 -5
- package/stat/BookNavigator/visual-adjustments/visual-adjustments-provider.js +94 -0
- package/stat/BookNavigator/visual-adjustments/visual-adjustments.js +280 -0
- package/stat/BookNavigator/volumes/volumes-provider.js +83 -0
- package/stat/BookNavigator/volumes/volumes.js +178 -0
- package/stat/BookReader/BookModel.js +518 -0
- package/stat/BookReader/DebugConsole.js +54 -0
- package/stat/BookReader/DragScrollable.js +233 -0
- package/stat/BookReader/ImageCache.js +116 -0
- package/stat/BookReader/Mode1Up.js +102 -0
- package/stat/BookReader/Mode1UpLit.js +434 -0
- package/stat/BookReader/Mode2Up.js +1372 -0
- package/stat/BookReader/ModeSmoothZoom.js +177 -0
- package/stat/BookReader/ModeThumb.js +344 -0
- package/stat/BookReader/Navbar/Navbar.js +310 -0
- package/stat/BookReader/PageContainer.js +120 -0
- package/stat/BookReader/ReduceSet.js +26 -0
- package/stat/BookReader/Toolbar/Toolbar.js +384 -0
- package/stat/BookReader/events.js +20 -0
- package/stat/BookReader/options.js +324 -0
- package/stat/BookReader/utils/HTMLDimensionsCacher.js +44 -0
- package/stat/BookReader/utils/classes.js +36 -0
- package/stat/BookReader/utils.js +240 -0
- package/stat/BookReader.js +2550 -0
- package/{src → stat}/BookReaderComponent/BookReaderComponent.js +15 -10
- package/stat/assets/icons/1up.svg +12 -0
- package/stat/assets/icons/2up.svg +15 -0
- package/stat/assets/icons/advance.svg +26 -0
- package/stat/assets/icons/chevron-right.svg +1 -0
- package/stat/assets/icons/close-circle-dark.svg +1 -0
- package/stat/assets/icons/close-circle.svg +1 -0
- package/stat/assets/icons/fullscreen.svg +17 -0
- package/stat/assets/icons/fullscreen_exit.svg +17 -0
- package/stat/assets/icons/hamburger.svg +15 -0
- package/stat/assets/icons/left-arrow.svg +12 -0
- package/stat/assets/icons/magnify-minus.svg +16 -0
- package/stat/assets/icons/magnify-plus.svg +17 -0
- package/stat/assets/icons/magnify.svg +15 -0
- package/stat/assets/icons/pause.svg +23 -0
- package/stat/assets/icons/play.svg +22 -0
- package/stat/assets/icons/playback-speed.svg +34 -0
- package/stat/assets/icons/read-aloud.svg +22 -0
- package/stat/assets/icons/review.svg +22 -0
- package/stat/assets/icons/thumbnails.svg +17 -0
- package/stat/assets/icons/voice.svg +1 -0
- package/stat/assets/icons/volume-full.svg +22 -0
- package/stat/assets/images/BRicons.png +0 -0
- package/stat/assets/images/BRicons.svg +94 -0
- package/stat/assets/images/BRicons_ia.png +0 -0
- package/stat/assets/images/back_pages.png +0 -0
- package/stat/assets/images/book_bottom_icon.png +0 -0
- package/stat/assets/images/book_down_icon.png +0 -0
- package/stat/assets/images/book_left_icon.png +0 -0
- package/stat/assets/images/book_leftmost_icon.png +0 -0
- package/stat/assets/images/book_right_icon.png +0 -0
- package/stat/assets/images/book_rightmost_icon.png +0 -0
- package/stat/assets/images/book_top_icon.png +0 -0
- package/stat/assets/images/book_up_icon.png +0 -0
- package/stat/assets/images/books_graphic.svg +177 -0
- package/stat/assets/images/booksplit.png +0 -0
- package/stat/assets/images/control_pause_icon.png +0 -0
- package/stat/assets/images/control_play_icon.png +0 -0
- package/stat/assets/images/embed_icon.png +0 -0
- package/stat/assets/images/icon-home-ia.png +0 -0
- package/stat/assets/images/icon_OL-logo-xs.png +0 -0
- package/stat/assets/images/icon_alert-xs.png +0 -0
- package/stat/assets/images/icon_book.svg +12 -0
- package/stat/assets/images/icon_bookmark.svg +12 -0
- package/stat/assets/images/icon_close-pop.png +0 -0
- package/stat/assets/images/icon_download.png +0 -0
- package/stat/assets/images/icon_gear.svg +14 -0
- package/stat/assets/images/icon_hamburger.svg +20 -0
- package/stat/assets/images/icon_home.png +0 -0
- package/stat/assets/images/icon_home.svg +21 -0
- package/stat/assets/images/icon_home_ia.png +0 -0
- package/stat/assets/images/icon_indicator.png +0 -0
- package/stat/assets/images/icon_info.svg +11 -0
- package/stat/assets/images/icon_one_page.svg +8 -0
- package/stat/assets/images/icon_pause.svg +1 -0
- package/stat/assets/images/icon_play.svg +1 -0
- package/stat/assets/images/icon_playback-rate.svg +15 -0
- package/stat/assets/images/icon_return.png +0 -0
- package/stat/assets/images/icon_search_button.svg +8 -0
- package/stat/assets/images/icon_share.svg +9 -0
- package/stat/assets/images/icon_skip-ahead.svg +6 -0
- package/stat/assets/images/icon_skip-back.svg +13 -0
- package/stat/assets/images/icon_speaker.svg +18 -0
- package/stat/assets/images/icon_speaker_open.svg +10 -0
- package/stat/assets/images/icon_thumbnails.svg +12 -0
- package/stat/assets/images/icon_toc.svg +5 -0
- package/stat/assets/images/icon_two_pages.svg +9 -0
- package/stat/assets/images/icon_zoomer.png +0 -0
- package/stat/assets/images/loading.gif +0 -0
- package/stat/assets/images/logo_icon.png +0 -0
- package/stat/assets/images/marker_chap-off.png +0 -0
- package/stat/assets/images/marker_chap-off.svg +11 -0
- package/stat/assets/images/marker_chap-off_ia.png +0 -0
- package/stat/assets/images/marker_chap-on.png +0 -0
- package/stat/assets/images/marker_chap-on.svg +11 -0
- package/stat/assets/images/marker_srch-on.svg +11 -0
- package/stat/assets/images/marker_srchchap-off.png +0 -0
- package/stat/assets/images/marker_srchchap-on.png +0 -0
- package/stat/assets/images/nav_control-dn.png +0 -0
- package/stat/assets/images/nav_control-dn_ia.png +0 -0
- package/stat/assets/images/nav_control-up.png +0 -0
- package/stat/assets/images/nav_control-up_ia.png +0 -0
- package/stat/assets/images/nav_control.png +0 -0
- package/stat/assets/images/one_page_mode_icon.png +0 -0
- package/stat/assets/images/paper-badge.png +0 -0
- package/stat/assets/images/print_icon.png +0 -0
- package/stat/assets/images/progressbar.gif +0 -0
- package/stat/assets/images/right_edges.png +0 -0
- package/stat/assets/images/slider.png +0 -0
- package/stat/assets/images/slider_ia.png +0 -0
- package/stat/assets/images/thumbnail_mode_icon.png +0 -0
- package/stat/assets/images/transparent.png +0 -0
- package/stat/assets/images/two_page_mode_icon.png +0 -0
- package/stat/assets/images/zoom_in_icon.png +0 -0
- package/stat/assets/images/zoom_out_icon.png +0 -0
- package/stat/css/BookReader.scss +89 -0
- package/stat/css/_BRBookmarks.scss +29 -0
- package/stat/css/_BRComponent.scss +13 -0
- package/stat/css/_BRfloat.scss +197 -0
- package/stat/css/_BRicon.scss +48 -0
- package/stat/css/_BRmain.scss +251 -0
- package/stat/css/_BRnav.scss +359 -0
- package/stat/css/_BRpages.scss +139 -0
- package/stat/css/_BRsearch.scss +226 -0
- package/stat/css/_BRtoolbar.scss +84 -0
- package/stat/css/_BRvendor.scss +5 -0
- package/stat/css/_MobileNav.scss +194 -0
- package/stat/css/_TextSelection.scss +32 -0
- package/stat/css/_colorbox.scss +52 -0
- package/stat/css/_controls.scss +253 -0
- package/stat/css/_icons.scss +121 -0
- package/stat/jquery-wrapper.js +4 -0
- package/stat/plugins/plugin.archive_analytics.js +86 -0
- package/stat/plugins/plugin.autoplay.js +129 -0
- package/stat/plugins/plugin.chapters.js +248 -0
- package/stat/plugins/plugin.iframe.js +48 -0
- package/stat/plugins/plugin.mobile_nav.js +288 -0
- package/stat/plugins/plugin.resume.js +68 -0
- package/stat/plugins/plugin.text_selection.js +291 -0
- package/stat/plugins/plugin.url.js +198 -0
- package/stat/plugins/plugin.vendor-fullscreen.js +247 -0
- package/stat/plugins/search/plugin.search.js +439 -0
- package/stat/plugins/search/view.js +439 -0
- package/stat/plugins/tts/AbstractTTSEngine.js +249 -0
- package/stat/plugins/tts/FestivalTTSEngine.js +169 -0
- package/stat/plugins/tts/PageChunk.js +107 -0
- package/stat/plugins/tts/PageChunkIterator.js +163 -0
- package/stat/plugins/tts/WebTTSEngine.js +357 -0
- package/stat/plugins/tts/plugin.tts.js +357 -0
- package/stat/plugins/tts/tooltip_dict.js +15 -0
- package/stat/plugins/tts/utils.js +91 -0
- package/stat/util/browserSniffing.js +30 -0
- package/stat/util/debouncer.js +26 -0
- package/stat/util/docCookies.js +67 -0
- package/stat/util/strings.js +34 -0
- package/tests/e2e/viewmode.test.js +30 -30
- package/tests/jest/BookReader/BookReaderPublicFunctions.test.js +64 -52
- package/tests/karma/BookNavigator/book-navigator.test.js +413 -108
- package/tests/karma/BookNavigator/bookmarks/bookmark-button.test.js +44 -0
- package/tests/karma/BookNavigator/downloads/downloads-provider.test.js +6 -3
- package/tests/karma/BookNavigator/search/search-provider.test.js +106 -6
- package/tests/karma/BookNavigator/search/search-results.test.js +0 -2
- package/tests/karma/BookNavigator/sharing/sharing-provider.test.js +29 -20
- package/tests/karma/BookNavigator/volumes/volumes-provider.test.js +41 -17
- package/webpack.config.js +1 -1
- package/.nvmrc +0 -1
- package/BookReader/bookreader-component-bundle.js +0 -1436
- package/BookReader/bookreader-component-bundle.js.map +0 -1
- package/src/BookNavigator/assets/book-loader.js +0 -27
- package/src/ItemNavigator/ItemNavigator.js +0 -377
@@ -0,0 +1,17 @@
|
|
1
|
+
import { svg } from 'lit-element';
|
2
|
+
|
3
|
+
export default svg`
|
4
|
+
<svg class="ia-logo" width="27" height="30" viewBox="0 0 27 30" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logoTitleID logoDescID">
|
5
|
+
<title id="logoTitleID">Internet Archive logo</title>
|
6
|
+
<desc id="logoDescID">A line drawing of the Internet Archive headquarters building façade.</desc>
|
7
|
+
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
8
|
+
<mask id="mask-2" fill="white">
|
9
|
+
<path d="M26.6666667,28.6046512 L26.6666667,30 L0,30 L0.000283687943,28.6046512 L26.6666667,28.6046512 Z M25.6140351,26.5116279 L25.6140351,28.255814 L1.05263158,28.255814 L1.05263158,26.5116279 L25.6140351,26.5116279 Z M3.62469203,7.6744186 L3.91746909,7.82153285 L4.0639977,10.1739544 L4.21052632,13.9963932 L4.21052632,17.6725617 L4.0639977,22.255044 L4.03962296,25.3421929 L3.62469203,25.4651163 L2.16024641,25.4651163 L1.72094074,25.3421929 L1.55031755,22.255044 L1.40350877,17.6970339 L1.40350877,14.0211467 L1.55031755,10.1739544 L1.68423854,7.80887484 L1.98962322,7.6744186 L3.62469203,7.6744186 Z M24.6774869,7.6744186 L24.9706026,7.82153285 L25.1168803,10.1739544 L25.2631579,13.9963932 L25.2631579,17.6725617 L25.1168803,22.255044 L25.0927809,25.3421929 L24.6774869,25.4651163 L23.2130291,25.4651163 L22.7736357,25.3421929 L22.602418,22.255044 L22.4561404,17.6970339 L22.4561404,14.0211467 L22.602418,10.1739544 L22.7369262,7.80887484 L23.0420916,7.6744186 L24.6774869,7.6744186 Z M9.94042303,7.6744186 L10.2332293,7.82153285 L10.3797725,10.1739544 L10.5263158,13.9963932 L10.5263158,17.6725617 L10.3797725,22.255044 L10.3556756,25.3421929 L9.94042303,25.4651163 L8.47583122,25.4651163 L8.0362015,25.3421929 L7.86556129,22.255044 L7.71929825,17.6970339 L7.71929825,14.0211467 L7.86556129,10.1739544 L8.00005604,7.80887484 L8.30491081,7.6744186 L9.94042303,7.6744186 Z M18.0105985,7.6744186 L18.3034047,7.82153285 L18.449948,10.1739544 L18.5964912,13.9963932 L18.5964912,17.6725617 L18.449948,22.255044 L18.425851,25.3421929 L18.0105985,25.4651163 L16.5460067,25.4651163 L16.1066571,25.3421929 L15.9357367,22.255044 L15.7894737,17.6970339 L15.7894737,14.0211467 L15.9357367,10.1739544 L16.0702315,7.80887484 L16.3753664,7.6744186 L18.0105985,7.6744186 Z M25.6140351,4.53488372 L25.6140351,6.97674419 L1.05263158,6.97674419 L1.05263158,4.53488372 L25.6140351,4.53488372 Z M13.0806755,0 L25.9649123,2.93331338 L25.4484139,3.8372093 L0.771925248,3.8372093 L0,3.1041615 L13.0806755,0 Z" id="path-1"></path>
|
10
|
+
</mask>
|
11
|
+
<use fill="#FFFFFF" xlink:href="#path-1"></use>
|
12
|
+
<g mask="url(#mask-2)" fill="#FFFFFF">
|
13
|
+
<path d="M0,0 L26.6666667,0 L26.6666667,30 L0,30 L0,0 Z" id="swatch"></path>
|
14
|
+
</g>
|
15
|
+
</g>
|
16
|
+
</svg>
|
17
|
+
`;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { css } from 'lit-element';
|
2
|
+
|
3
|
+
// Original SVG object for reference
|
4
|
+
// <svg height="10" viewBox="0 0 13 10" width="13" xmlns="http://www.w3.org/2000/svg"><path d="m4.33333333 10-4.33333333-4.16666667 1.73333333-1.66666666 2.6 2.5 6.93333337-6.66666667 1.7333333 1.66666667z" fill="#fff" fill-rule="evenodd"/></svg>
|
5
|
+
|
6
|
+
export default css`data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgMTMgMTAiIHdpZHRoPSIxMyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtNC4zMzMzMzMzMyAxMC00LjMzMzMzMzMzLTQuMTY2NjY2NjcgMS43MzMzMzMzMy0xLjY2NjY2NjY2IDIuNiAyLjUgNi45MzMzMzMzNy02LjY2NjY2NjY3IDEuNzMzMzMzMyAxLjY2NjY2NjY3eiIgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIi8+PC9zdmc+`;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { css } from 'lit-element';
|
2
|
+
|
3
|
+
export default css`data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNDAgNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgYXJpYS1sYWJlbGxlZGJ5PSJjbG9zZVRpdGxlSUQgY2xvc2VEZXNjSUQiPjxwYXRoIGQ9Ik0yOS4xOTIgMTAuODA4YTEuNSAxLjUgMCAwMTAgMi4xMkwyMi4xMjIgMjBsNy4wNyA3LjA3MmExLjUgMS41IDAgMDEtMi4xMiAyLjEyMWwtNy4wNzMtNy4wNy03LjA3IDcuMDdhMS41IDEuNSAwIDAxLTIuMTIxLTIuMTJsNy4wNy03LjA3My03LjA3LTcuMDdhMS41IDEuNSAwIDAxMi4xMi0yLjEyMUwyMCAxNy44NzhsNy4wNzItNy4wN2ExLjUgMS41IDAgMDEyLjEyMSAweiIgY2xhc3M9ImZpbGwtY29sb3IiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==`;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { html } from 'lit-html';
|
2
|
+
|
3
|
+
export default html`
|
4
|
+
<svg name="sort-asc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538" transform="matrix(1 0 0 -1 0 18.692308)"/></g></svg>
|
5
|
+
`;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { html } from 'lit-html';
|
2
|
+
|
3
|
+
export default html`
|
4
|
+
<svg name="sort-desc" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill="#fff" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill="#fff" fill-rule="nonzero"/><path d="m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.661538"/></g></svg>
|
5
|
+
`;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { html } from 'lit-html';
|
2
|
+
|
3
|
+
export default html`
|
4
|
+
<svg name="sort-neutral" height="18" viewBox="0 0 18 18" width="18" xmlns="http://www.w3.org/2000/svg"><g fill="#fff" fill-rule="evenodd"><path d="m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z" fill-rule="nonzero"/><path d="m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z" fill-rule="nonzero"/><circle cx="13" cy="9" r="2"/></g></svg>
|
5
|
+
`;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { html } from 'lit-html';
|
2
|
+
|
3
|
+
export default html`
|
4
|
+
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" aria-labelledby="volumesTitleID volumesDescID">
|
5
|
+
<title id="volumesTitleID">Volumes icon</title>
|
6
|
+
<desc id="volumesDescID">Three books stacked on each other</desc>
|
7
|
+
<g fill="#ffffff">
|
8
|
+
<path fill="#ffffff" d="m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z" />
|
9
|
+
</g>
|
10
|
+
</svg>
|
11
|
+
`;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { LitElement, html, css } from 'lit-element';
|
2
|
+
|
3
|
+
export default class BookmarkButton extends LitElement {
|
4
|
+
static get styles() {
|
5
|
+
return css`
|
6
|
+
button {
|
7
|
+
-webkit-appearance: none;
|
8
|
+
appearance: none;
|
9
|
+
outline: 0;
|
10
|
+
border: none;
|
11
|
+
padding: 0;
|
12
|
+
height: 4rem;
|
13
|
+
width: 4rem;
|
14
|
+
background: transparent;
|
15
|
+
cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 16 24' width='16'%3E%3Cg fill='%23333' fill-rule='evenodd'%3E%3Cpath d='m15 0c.5522847 0 1 .44771525 1 1v23l-8-5.4545455-8 5.4545455v-23c0-.55228475.44771525-1 1-1zm-2 2h-10c-.51283584 0-.93550716.38604019-.99327227.88337887l-.00672773.11662113v18l6-4.3181818 6 4.3181818v-18c0-.51283584-.3860402-.93550716-.8833789-.99327227z'/%3E%3Cpath d='m8.75 6v2.25h2.25v1.5h-2.25v2.25h-1.5v-2.25h-2.25v-1.5h2.25v-2.25z' fill-rule='nonzero'/%3E%3C/g%3E%3C/svg%3E"), pointer;
|
16
|
+
position: relative;
|
17
|
+
}
|
18
|
+
button > * {
|
19
|
+
display: block;
|
20
|
+
position: absolute;
|
21
|
+
top: 0.2rem;
|
22
|
+
}
|
23
|
+
button.left > * {
|
24
|
+
left: 0.2rem;
|
25
|
+
}
|
26
|
+
|
27
|
+
button.right > * {
|
28
|
+
right: 0.2rem;
|
29
|
+
}
|
30
|
+
`;
|
31
|
+
}
|
32
|
+
|
33
|
+
static get properties() {
|
34
|
+
return {
|
35
|
+
side: { type: String },
|
36
|
+
state: { type: String },
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
constructor() {
|
41
|
+
super();
|
42
|
+
this.state = 'hollow';
|
43
|
+
}
|
44
|
+
|
45
|
+
handleClick(e) {
|
46
|
+
e.preventDefault();
|
47
|
+
this.dispatchEvent(new CustomEvent('bookmarkButtonClicked'));
|
48
|
+
}
|
49
|
+
|
50
|
+
get title() {
|
51
|
+
return `${this.state === 'hollow' ? 'Add' : 'Remove'} bookmark`;
|
52
|
+
}
|
53
|
+
|
54
|
+
render() {
|
55
|
+
const position = this.side || 'right';
|
56
|
+
return html`
|
57
|
+
<button title=${this.title} @click=${this.handleClick} class=${position}>
|
58
|
+
<icon-bookmark state=${this.state}></icon-bookmark>
|
59
|
+
</button>
|
60
|
+
`;
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
customElements.define('bookmark-button', BookmarkButton);
|
@@ -0,0 +1,215 @@
|
|
1
|
+
import { nothing } from 'lit-html';
|
2
|
+
import { repeat } from 'lit-html/directives/repeat.js';
|
3
|
+
import { css, html, LitElement } from 'lit-element';
|
4
|
+
import bookmarkColorsCSS from '../assets/bookmark-colors.js';
|
5
|
+
import buttonCSS from '../assets/button-base.js';
|
6
|
+
|
7
|
+
export class IABookmarkEdit extends LitElement {
|
8
|
+
static get properties() {
|
9
|
+
return {
|
10
|
+
bookmark: { type: Object },
|
11
|
+
bookmarkColors: { type: Array },
|
12
|
+
renderHeader: { type: Boolean },
|
13
|
+
showBookmark: { type: Boolean },
|
14
|
+
};
|
15
|
+
}
|
16
|
+
|
17
|
+
constructor() {
|
18
|
+
super();
|
19
|
+
this.bookmark = {};
|
20
|
+
this.bookmarkColors = [];
|
21
|
+
this.renderHeader = false;
|
22
|
+
this.showBookmark = true;
|
23
|
+
}
|
24
|
+
|
25
|
+
emitSaveEvent(e) {
|
26
|
+
e.preventDefault();
|
27
|
+
this.dispatchEvent(new CustomEvent('saveBookmark', {
|
28
|
+
detail: {
|
29
|
+
bookmark: this.bookmark,
|
30
|
+
},
|
31
|
+
}));
|
32
|
+
}
|
33
|
+
|
34
|
+
emitDeleteEvent() {
|
35
|
+
this.dispatchEvent(new CustomEvent('deleteBookmark', {
|
36
|
+
detail: {
|
37
|
+
id: this.bookmark.id,
|
38
|
+
},
|
39
|
+
}));
|
40
|
+
}
|
41
|
+
|
42
|
+
emitColorChangedEvent(colorId) {
|
43
|
+
this.dispatchEvent(new CustomEvent('bookmarkColorChanged', {
|
44
|
+
detail: {
|
45
|
+
bookmarkId: this.bookmark.id,
|
46
|
+
colorId,
|
47
|
+
},
|
48
|
+
}));
|
49
|
+
}
|
50
|
+
|
51
|
+
changeColorTo(id) {
|
52
|
+
this.bookmark.color = id;
|
53
|
+
this.emitColorChangedEvent(id);
|
54
|
+
}
|
55
|
+
|
56
|
+
updateNote(e) {
|
57
|
+
this.bookmark.note = e.currentTarget.value;
|
58
|
+
}
|
59
|
+
|
60
|
+
static get headerSection() {
|
61
|
+
return html`<header>
|
62
|
+
<h3>Edit Bookmark</h3>
|
63
|
+
</header>`;
|
64
|
+
}
|
65
|
+
|
66
|
+
bookmarkColor(color) {
|
67
|
+
return html`
|
68
|
+
<li>
|
69
|
+
<input type="radio" name="color" id="color_${color.id}" .value=${color.id} @change=${() => this.changeColorTo(color.id)} ?checked=${this.bookmark.color === color.id}>
|
70
|
+
<label for="color_${color.id}">
|
71
|
+
<icon-bookmark class=${color.className}></icon-bookmark>
|
72
|
+
</label>
|
73
|
+
</li>
|
74
|
+
`;
|
75
|
+
}
|
76
|
+
|
77
|
+
get bookmarkTemplate() {
|
78
|
+
return html`
|
79
|
+
<div class="bookmark">
|
80
|
+
<img src=${this.bookmark.thumbnail} />
|
81
|
+
<h4>Page ${this.bookmark.page}</h4>
|
82
|
+
</div>
|
83
|
+
`;
|
84
|
+
}
|
85
|
+
|
86
|
+
render() {
|
87
|
+
return html`
|
88
|
+
${this.renderHeader ? IABookmarkEdit.headerSection : nothing}
|
89
|
+
${this.showBookmark ? this.bookmarkTemplate : nothing}
|
90
|
+
<form action="" method="put" @submit=${this.emitSaveEvent}>
|
91
|
+
<fieldset>
|
92
|
+
<label for="note">Note <small>(optional)</small></label>
|
93
|
+
<textarea rows="4" cols="80" name="note" id="note" @change=${this.updateNote}>${this.bookmark.note}</textarea>
|
94
|
+
<label for="color">Bookmark color</label>
|
95
|
+
<ul>
|
96
|
+
${repeat(this.bookmarkColors, color => color.id, this.bookmarkColor.bind(this))}
|
97
|
+
</ul>
|
98
|
+
<div class="actions">
|
99
|
+
<button type="button" class="ia-button cancel" @click=${this.emitDeleteEvent}>Delete</button>
|
100
|
+
<input class="ia-button" type="submit" value="Save">
|
101
|
+
</div>
|
102
|
+
</fieldset>
|
103
|
+
</form>
|
104
|
+
`;
|
105
|
+
}
|
106
|
+
|
107
|
+
static get styles() {
|
108
|
+
const bookmarkEditCSS = css`
|
109
|
+
:host {
|
110
|
+
display: block;
|
111
|
+
padding: 0 1rem 2rem 1rem;
|
112
|
+
color: var(--primaryTextColor);
|
113
|
+
}
|
114
|
+
|
115
|
+
small {
|
116
|
+
font-style: italic;
|
117
|
+
}
|
118
|
+
|
119
|
+
.bookmark {
|
120
|
+
display: grid;
|
121
|
+
grid-template-columns: 37px 1fr;
|
122
|
+
grid-gap: 0 1rem;
|
123
|
+
align-items: center;
|
124
|
+
}
|
125
|
+
|
126
|
+
h4 {
|
127
|
+
margin: 0;
|
128
|
+
font-size: 1.4rem;
|
129
|
+
}
|
130
|
+
|
131
|
+
fieldset {
|
132
|
+
padding: 2rem 0 0 0;
|
133
|
+
border: none;
|
134
|
+
}
|
135
|
+
|
136
|
+
label {
|
137
|
+
display: block;
|
138
|
+
font-weight: bold;
|
139
|
+
}
|
140
|
+
|
141
|
+
p {
|
142
|
+
padding: 0;
|
143
|
+
margin: .5rem 0;
|
144
|
+
font-size: 1.2rem;
|
145
|
+
line-height: 120%;
|
146
|
+
}
|
147
|
+
|
148
|
+
textarea {
|
149
|
+
width: 100%;
|
150
|
+
margin-bottom: 2rem;
|
151
|
+
box-sizing: border-box;
|
152
|
+
font: normal 1.4rem "Helvetica Neue", Helvetica, Arial, sans-serif;
|
153
|
+
resize: vertical;
|
154
|
+
}
|
155
|
+
|
156
|
+
ul {
|
157
|
+
display: grid;
|
158
|
+
grid-template-columns: repeat(3, auto);
|
159
|
+
grid-gap: 0 2rem;
|
160
|
+
justify-content: start;
|
161
|
+
padding: 1rem 0 0 0;
|
162
|
+
margin: 0 0 2rem 0;
|
163
|
+
list-style: none;
|
164
|
+
}
|
165
|
+
|
166
|
+
li input {
|
167
|
+
display: none;
|
168
|
+
}
|
169
|
+
|
170
|
+
li label {
|
171
|
+
display: block;
|
172
|
+
min-width: 50px;
|
173
|
+
padding-top: .4rem;
|
174
|
+
text-align: center;
|
175
|
+
border: 1px solid transparent;
|
176
|
+
border-radius: 4px;
|
177
|
+
cursor: pointer;
|
178
|
+
}
|
179
|
+
|
180
|
+
li input:checked + label {
|
181
|
+
border-color: var(--primaryTextColor);
|
182
|
+
}
|
183
|
+
|
184
|
+
input[type="submit"] {
|
185
|
+
background: var(--primaryCTAFill);
|
186
|
+
border-color: var(--primaryCTABorder);
|
187
|
+
}
|
188
|
+
|
189
|
+
button {
|
190
|
+
background: var(--primaryErrorCTAFill);
|
191
|
+
border-color: var(--primaryErrorCTABorder);
|
192
|
+
}
|
193
|
+
|
194
|
+
.button {
|
195
|
+
-webkit-appearance: none;
|
196
|
+
appearance: none;
|
197
|
+
padding: .5rem 1rem;
|
198
|
+
box-sizing: border-box;
|
199
|
+
color: var(--primaryTextColor);
|
200
|
+
border: none;
|
201
|
+
border-radius: 4px;
|
202
|
+
cursor: pointer;
|
203
|
+
}
|
204
|
+
|
205
|
+
.actions {
|
206
|
+
display: grid;
|
207
|
+
grid-template-columns: auto auto;
|
208
|
+
grid-gap: 0 1rem;
|
209
|
+
justify-items: stretch;
|
210
|
+
}
|
211
|
+
`;
|
212
|
+
return [buttonCSS, bookmarkColorsCSS, bookmarkEditCSS];
|
213
|
+
}
|
214
|
+
}
|
215
|
+
customElements.define('ia-bookmark-edit', IABookmarkEdit);
|
@@ -0,0 +1,285 @@
|
|
1
|
+
import { nothing } from 'lit-html';
|
2
|
+
import { repeat } from 'lit-html/directives/repeat.js';
|
3
|
+
import { css, html, LitElement } from 'lit-element';
|
4
|
+
import './bookmark-edit.js';
|
5
|
+
import '@internetarchive/icon-edit-pencil/icon-edit-pencil.js';
|
6
|
+
import bookmarkColorsCSS from '../assets/bookmark-colors.js';
|
7
|
+
|
8
|
+
export class IABookmarksList extends LitElement {
|
9
|
+
static get properties() {
|
10
|
+
return {
|
11
|
+
activeBookmarkID: { type: Number },
|
12
|
+
bookmarkColors: { type: Array },
|
13
|
+
defaultBookmarkColor: { type: Object },
|
14
|
+
bookmarks: { type: Object },
|
15
|
+
editedBookmark: { type: Object },
|
16
|
+
renderHeader: { type: Boolean },
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
constructor() {
|
21
|
+
super();
|
22
|
+
this.activeBookmarkID = undefined;
|
23
|
+
this.bookmarkColors = [];
|
24
|
+
this.defaultBookmarkColor = {};
|
25
|
+
this.bookmarks = {};
|
26
|
+
this.editedBookmark = {};
|
27
|
+
this.renderHeader = false;
|
28
|
+
}
|
29
|
+
|
30
|
+
emitEditEvent(e, bookmark) {
|
31
|
+
this.dispatchEvent(new CustomEvent('bookmarkEdited', {
|
32
|
+
detail: {
|
33
|
+
bookmark,
|
34
|
+
},
|
35
|
+
}));
|
36
|
+
}
|
37
|
+
|
38
|
+
emitSelectedEvent(bookmark) {
|
39
|
+
this.activeBookmarkID = bookmark.id;
|
40
|
+
this.dispatchEvent(new CustomEvent('bookmarkSelected', {
|
41
|
+
detail: {
|
42
|
+
bookmark,
|
43
|
+
},
|
44
|
+
}));
|
45
|
+
}
|
46
|
+
|
47
|
+
emitSaveBookmark(bookmark) {
|
48
|
+
this.dispatchEvent(new CustomEvent('saveBookmark', {
|
49
|
+
detail: {
|
50
|
+
bookmark,
|
51
|
+
},
|
52
|
+
}));
|
53
|
+
}
|
54
|
+
|
55
|
+
emitDeleteBookmark(id) {
|
56
|
+
this.dispatchEvent(new CustomEvent('deleteBookmark', {
|
57
|
+
detail: {
|
58
|
+
id,
|
59
|
+
},
|
60
|
+
}));
|
61
|
+
}
|
62
|
+
|
63
|
+
emitBookmarkColorChanged({ detail }) {
|
64
|
+
const { bookmarkId, colorId } = detail;
|
65
|
+
this.dispatchEvent(new CustomEvent('bookmarkColorChanged', {
|
66
|
+
detail: {
|
67
|
+
bookmarkId,
|
68
|
+
colorId,
|
69
|
+
},
|
70
|
+
}));
|
71
|
+
}
|
72
|
+
|
73
|
+
emitAddBookmark() {
|
74
|
+
this.dispatchEvent(new CustomEvent('addBookmark'));
|
75
|
+
}
|
76
|
+
|
77
|
+
editBookmark(e, bookmark) {
|
78
|
+
this.emitEditEvent(e, bookmark);
|
79
|
+
this.editedBookmark = this.editedBookmark === bookmark ? {} : bookmark;
|
80
|
+
}
|
81
|
+
|
82
|
+
saveBookmark({ detail }) {
|
83
|
+
const { bookmark } = detail;
|
84
|
+
this.editedBookmark = {};
|
85
|
+
this.emitSaveBookmark(bookmark);
|
86
|
+
}
|
87
|
+
|
88
|
+
deleteBookmark({ detail }) {
|
89
|
+
const { id } = detail;
|
90
|
+
this.editedBookmark = {};
|
91
|
+
this.emitDeleteBookmark(id);
|
92
|
+
}
|
93
|
+
|
94
|
+
bookmarkColorInfo(colorVal = 0) {
|
95
|
+
return this.bookmarkColors.find(labelInfo => labelInfo?.id === colorVal);
|
96
|
+
}
|
97
|
+
|
98
|
+
bookmarkItem(bookmark) {
|
99
|
+
const editMode = this.editedBookmark.id === bookmark.id;
|
100
|
+
const { className } = this.bookmarkColorInfo(bookmark.color);
|
101
|
+
const activeClass = bookmark.id === this.activeBookmarkID ? 'active' : '';
|
102
|
+
return html`
|
103
|
+
<li
|
104
|
+
@click=${() => this.emitSelectedEvent(bookmark)}
|
105
|
+
tabindex="0"
|
106
|
+
data-pageIndex=${bookmark.id}
|
107
|
+
>
|
108
|
+
<div class="separator"></div>
|
109
|
+
<div class="content ${activeClass}">
|
110
|
+
<button
|
111
|
+
class="edit"
|
112
|
+
@click=${e => this.editBookmark(e, bookmark)}
|
113
|
+
title="Edit this bookmark"
|
114
|
+
>
|
115
|
+
<ia-icon-edit-pencil></ia-icon-edit-pencil>
|
116
|
+
</button>
|
117
|
+
<h4>
|
118
|
+
<icon-bookmark class=${className}></icon-bookmark>
|
119
|
+
<span> Page ${bookmark.page}</span>
|
120
|
+
</h4>
|
121
|
+
${!editMode && bookmark.note ? html`<p>${bookmark.note}</p>` : nothing}
|
122
|
+
${editMode ? this.editBookmarkComponent : nothing}
|
123
|
+
</div>
|
124
|
+
</li>
|
125
|
+
`;
|
126
|
+
}
|
127
|
+
|
128
|
+
get editBookmarkComponent() {
|
129
|
+
const showBookmark = false;
|
130
|
+
return html`
|
131
|
+
<ia-bookmark-edit
|
132
|
+
.bookmark=${this.editedBookmark}
|
133
|
+
.bookmarkColors=${this.bookmarkColors}
|
134
|
+
.defaultBookmarkColor=${this.defaultBookmarkColor}
|
135
|
+
.showBookmark=${showBookmark}
|
136
|
+
@saveBookmark=${this.saveBookmark}
|
137
|
+
@deleteBookmark=${this.deleteBookmark}
|
138
|
+
@bookmarkColorChanged=${this.emitBookmarkColorChanged}
|
139
|
+
></ia-bookmark-edit>
|
140
|
+
`;
|
141
|
+
}
|
142
|
+
|
143
|
+
sortBookmarks() {
|
144
|
+
const sortedKeys = Object.keys(this.bookmarks).sort((a, b) => {
|
145
|
+
if (+a > +b) { return 1; }
|
146
|
+
if (+a < +b) { return -1; }
|
147
|
+
return 0;
|
148
|
+
});
|
149
|
+
const sortedBookmarks = sortedKeys.map(key => this.bookmarks[key]);
|
150
|
+
return sortedBookmarks;
|
151
|
+
}
|
152
|
+
|
153
|
+
get bookmarksCount() {
|
154
|
+
const count = this.bookmarks.length;
|
155
|
+
return html`<small>(${count})</small>`;
|
156
|
+
}
|
157
|
+
|
158
|
+
get headerSection() {
|
159
|
+
return html`<header>
|
160
|
+
<h3>
|
161
|
+
Bookmarks
|
162
|
+
${this.bookmarks.length ? this.bookmarksCount : nothing}
|
163
|
+
</h3>
|
164
|
+
</header>`;
|
165
|
+
}
|
166
|
+
|
167
|
+
get bookmarkslist() {
|
168
|
+
const sortedBookmarks = this.sortBookmarks();
|
169
|
+
const bookmarks = repeat(sortedBookmarks, bookmark => bookmark?.id, this.bookmarkItem.bind(this));
|
170
|
+
return html`
|
171
|
+
<ul>
|
172
|
+
${bookmarks}
|
173
|
+
<div class="separator"></div>
|
174
|
+
</ul>
|
175
|
+
`;
|
176
|
+
}
|
177
|
+
|
178
|
+
render() {
|
179
|
+
return html`
|
180
|
+
${this.renderHeader ? this.headerSection : nothing}
|
181
|
+
${Object.keys(this.bookmarks).length ? this.bookmarkslist : nothing}
|
182
|
+
`;
|
183
|
+
}
|
184
|
+
|
185
|
+
static get styles() {
|
186
|
+
const main = css`
|
187
|
+
:host {
|
188
|
+
display: block;
|
189
|
+
overflow-y: auto;
|
190
|
+
box-sizing: border-box;
|
191
|
+
color: var(--primaryTextColor);
|
192
|
+
margin-bottom: 2rem;
|
193
|
+
--activeBorderWidth: 2px;
|
194
|
+
}
|
195
|
+
|
196
|
+
icon-bookmark {
|
197
|
+
width: 16px;
|
198
|
+
height: 24px;
|
199
|
+
}
|
200
|
+
|
201
|
+
.separator {
|
202
|
+
background-color: var(--secondaryBGColor);
|
203
|
+
width: 98%;
|
204
|
+
margin: 1px auto;
|
205
|
+
height: 1px;
|
206
|
+
}
|
207
|
+
|
208
|
+
small {
|
209
|
+
font-style: italic;
|
210
|
+
}
|
211
|
+
|
212
|
+
h4 {
|
213
|
+
margin: 0;
|
214
|
+
font-size: 1.4rem;
|
215
|
+
}
|
216
|
+
h4 * {
|
217
|
+
display: inline-block;
|
218
|
+
}
|
219
|
+
h4 icon-bookmark {
|
220
|
+
vertical-align: bottom;
|
221
|
+
}
|
222
|
+
h4 span {
|
223
|
+
vertical-align: top;
|
224
|
+
padding-top: 1%;
|
225
|
+
}
|
226
|
+
|
227
|
+
p {
|
228
|
+
padding: 0;
|
229
|
+
margin: 5px 0 0 0;
|
230
|
+
width: 98%;
|
231
|
+
overflow-wrap: break-word;
|
232
|
+
}
|
233
|
+
|
234
|
+
ia-bookmark-edit {
|
235
|
+
margin: 5px 5px 3px 6px;
|
236
|
+
}
|
237
|
+
|
238
|
+
ul {
|
239
|
+
padding: 0;
|
240
|
+
list-style: none;
|
241
|
+
margin: var(--activeBorderWidth) 0.5rem 1rem 0;
|
242
|
+
}
|
243
|
+
ul > li:first-child .separator {
|
244
|
+
display: none;
|
245
|
+
}
|
246
|
+
li {
|
247
|
+
cursor: pointer;
|
248
|
+
outline: none;
|
249
|
+
position: relative;
|
250
|
+
}
|
251
|
+
li .content {
|
252
|
+
padding: 2px 0 4px 2px;
|
253
|
+
border: var(--activeBorderWidth) solid transparent;
|
254
|
+
padding: .2rem 0 .4rem .2rem;
|
255
|
+
}
|
256
|
+
li .content.active {
|
257
|
+
border: var(--activeBorderWidth) solid #538bc5;
|
258
|
+
}
|
259
|
+
li button.edit {
|
260
|
+
padding: 5px 2px 0 0;
|
261
|
+
background: transparent;
|
262
|
+
cursor: pointer;
|
263
|
+
height: 40px;
|
264
|
+
width: 40px;
|
265
|
+
position: absolute;
|
266
|
+
right: 2px;
|
267
|
+
top: 2px;
|
268
|
+
text-align: right;
|
269
|
+
-webkit-appearance: none;
|
270
|
+
appearance: none;
|
271
|
+
outline: none;
|
272
|
+
box-sizing: border-box;
|
273
|
+
border: none;
|
274
|
+
}
|
275
|
+
li button.edit > * {
|
276
|
+
display: block;
|
277
|
+
height: 100%;
|
278
|
+
width: 100%;
|
279
|
+
}
|
280
|
+
`;
|
281
|
+
|
282
|
+
return [main, bookmarkColorsCSS];
|
283
|
+
}
|
284
|
+
}
|
285
|
+
customElements.define('ia-bookmarks-list', IABookmarksList);
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { LitElement, html } from 'lit-element';
|
2
|
+
import buttonStyles from '../assets/button-base.js';
|
3
|
+
|
4
|
+
class BookmarksLogin extends LitElement {
|
5
|
+
static get properties() {
|
6
|
+
return {
|
7
|
+
url: { type: String }
|
8
|
+
};
|
9
|
+
}
|
10
|
+
|
11
|
+
static get styles() {
|
12
|
+
return buttonStyles;
|
13
|
+
}
|
14
|
+
|
15
|
+
constructor() {
|
16
|
+
super();
|
17
|
+
this.url = 'https://archive.org/account/login';
|
18
|
+
}
|
19
|
+
render() {
|
20
|
+
|
21
|
+
return html`
|
22
|
+
<p>A free account is required to save and access bookmarks.</p>
|
23
|
+
<a class="ia-button link primary" href="${this.url}">Log in</a>
|
24
|
+
`;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
customElements.define('bookmarks-login', BookmarksLogin);
|