commit: 3cda070507b6165c008126ce359accc56837039f
parent 71622e2932bc05ba53209f9d765752d547c78520
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date: Thu, 26 Dec 2024 23:51:54 +0000
Merge branch 'develop' into 'tusooa/save-draft'
# Conflicts:
# src/boot/routes.js
# src/i18n/en.json
# src/main.js
# src/modules/config.js
# src/modules/instance.js
Diffstat:
282 files changed, 8414 insertions(+), 1881 deletions(-)
diff --git a/.browserslistrc b/.browserslistrc
@@ -0,0 +1,7 @@
+>0.2%
+not op_mini all
+Safari > 15
+Firefox >= 115
+Firefox ESR
+Android > 4
+not dead
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
@@ -45,6 +45,7 @@ test:
stage: test
tags:
- amd64
+ - himem
variables:
APT_CACHE_DIR: apt-cache
script:
@@ -58,6 +59,7 @@ build:
stage: build
tags:
- amd64
+ - himem
script:
- yarn
- npm run build
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -3,6 +3,74 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
+## 2.7.1
+Bugfix release. Added small optimizations to emoji picker that should make it a bit more responsive, however it needs rather large change to make it more performant which might come in a major release.
+
+### Fixed
+- Instance default theme not respected
+- Nested panel header having wrong sticky position if navbar height != panel header height
+- Toggled buttons having bad contrast (when using v2 theme)
+
+### Changed
+- Simplify the OAuth client_name to 'PleromaFE'
+- Small optimizations to emoji picker
+
+
+## 2.7.0
+
+### Known issues
+We got some reports related to emoji picker performance, this hopefully will be fixed in 2.7.1.
+
+### Notes
+This release overhauls how themes work, themes now need to be "compiled", which can cause some delay when loading for the first time and temporarily look "wrong" in some places (popups, menus, dialogs). Please do report any issues, especially if your theme looks wrong or breaks interface when loading. Also report issues if you're experiencing constant performance issues.
+
+To admins: remember that you can update PleromaFE to recent `master` or `develop` in admin dashboard in "Front-ends" tab, scroll down to find PleromaFE box and click "Reinstall `master`" or dropdown and then "Reinstall `develop`". Currently there is no mechanism to check if there is an update or not.
+
+### Changed
+- Overhauled the way themes work, migrating to new Pleroma Interface Style Sheets system aka "Themes 3".
+- Notifications are no longer sorted by "seen" status since interacting with them can change their read status and makes UI jumpy. Old behavior can be restored in settings.
+- Notifications are now shown through a ServiceWorker (since mobile chrome does not allow them otherwise), it's always enabled, even if previously we only enabled it for WebPush notifications only. If you don't like websites "running" while closed, check how to disable them in your browser. Old way to show notifications will be used as a fallback but might not have all the new features.
+- Reorganized Settings modal to move out visual stuff into Appearance tab
+
+### Added
+- Emoji pack management to the admin panel
+- Support `status` notification type (subscriptions/bell, fixes PleromaFE on newer PleromaBE versions)
+- Poll end notifications.
+- Added option to not mark all notifications when closing notifications drawer on mobile, this creates a new button to mark all as seen.
+- Option to always "show" notifications when using web push for better compatibility with some browsers (chrome, edge, safari)
+- Option to toggle what notification types appear in native notifications, by default less important ones (likes, repeats, etc) will no longer show up in native notifications.
+- Option to treat non-interactive notifications (likes, repeats et all) as seen for visual purposes (no read mark, ignored in counters, still can show in native notifications)
+- Ability to resize UI (and certain components) scale independent of browser/text scale
+- Ability to override certain aspects of UI style independent of theme used (UI roundness, fonts, underlay)
+- Theme selector with visual previews of the theme
+- Display loading and error indicator for conversation page
+- Option to only show scrobbles that are recent enough
+- Interacting (opening reply box etc) or simply clicking on non-interactive notifications now marks them as read. Clicking on native notifications for non-interactive ones also marks them as seen.
+- Support group actors
+- Focusing into a tab clears all current desktop notifications
+- Ability to change size of emoji
+- Ability to view APNG (Animated PNG) attachments.
+- Support showing extra notifications in the notifications column
+- Create a link to the URL of the scrobble when it's present
+- Allow hiding custom emojis in picker.
+- Ability to mute sensitive posts (ported from eintei).
+- Native notifications now also have "badge" property that matches instance's favicon (visible in Android Chromium at least)
+- Display public favorites on user profiles
+- Display quotes count on posts and add quotes list page
+- Show a dedicated registration notice page when further action is required after registering
+
+### Fixed
+- Synchronized requested notification types with backend, hopefully should fix missing notifications for polls and follow requests
+- Error that appeared on mobile Chromium (and derivatives) when native notifications are allowed
+- Being unable to set notification visibility for reports and follow requests
+- Native notifications appearing as many times as there are open tabs. Clicking on notification will focus last focused tab.
+- The expiry date indication won't be shown if the poll never expires
+- Profile mentions causing a 422 error on newer PleromaBE versions.
+- Color inputs are less ugly now
+- Unread notifications should now properly catch up between sessions (eventually) in polling mode
+- Video posters on Safari
+
+
## 2.6.1
### Fixed
- fix admin dashboard not having any feedback on frontend installation
diff --git a/changelog.d/add-apng.add b/changelog.d/add-apng.add
@@ -1 +0,0 @@
-Make Pleroma FE to also view apng (Animated PNG) attachment.
diff --git a/changelog.d/admin-emoji-packs.add b/changelog.d/admin-emoji-packs.add
@@ -1 +0,0 @@
-Added emoji pack management to the admin panel
diff --git a/changelog.d/appearance-tab.change b/changelog.d/appearance-tab.change
@@ -1 +0,0 @@
-Reorganized Settings modal to move out visual stuff into Appearance tab
diff --git a/changelog.d/public-favorites.skip b/changelog.d/backend-repo-url.skip
diff --git a/changelog.d/better-shadow-control.fix b/changelog.d/better-shadow-control.fix
@@ -0,0 +1 @@
+Updated shadow editor, hopefully fixed long-standing bugs, added ability to specify shadow's name.
diff --git a/changelog.d/bookmark-folders.add b/changelog.d/bookmark-folders.add
@@ -0,0 +1 @@
+Support bookmark folders
diff --git a/changelog.d/browsers-support.change b/changelog.d/browsers-support.change
@@ -0,0 +1,9 @@
+Updated our build system to support browsers:
+ Safari >= 15
+ Firefox >= 115
+ Android > 4
+ no Opera Mini support
+ no IE support
+ no "dead" (unmaintained) browsers support
+
+This does not guarantee that browsers will or will not work.
diff --git a/changelog.d/checkbox.fix b/changelog.d/checkbox.fix
@@ -0,0 +1 @@
+checkbox vertical alignment has been fixed
diff --git a/changelog.d/ci-runner.skip b/changelog.d/ci-runner.skip
@@ -1 +0,0 @@
-stop using that one runner for intensive tasks
-\ No newline at end of file
diff --git a/changelog.d/colorfuncs.fix b/changelog.d/colorfuncs.fix
@@ -0,0 +1 @@
+Fix some of the color manipulation functions
diff --git a/changelog.d/create-link-when-url-present.add b/changelog.d/create-link-when-url-present.add
@@ -1 +0,0 @@
-Create a link to the URL of the scrobble when it's present
diff --git a/changelog.d/custom.add b/changelog.d/custom.add
@@ -0,0 +1 @@
+Added support for fetching /{resource}.custom.ext to allow adding instance-specific themes without altering sourcetree
diff --git a/changelog.d/date-absolute.add b/changelog.d/date-absolute.add
@@ -0,0 +1 @@
+Support displaying time in absolute format
diff --git a/changelog.d/deprecate-subscribe.change b/changelog.d/deprecate-subscribe.change
@@ -0,0 +1 @@
+Use /api/v1/accounts/:id/follow for account subscriptions instead of the deprecated routes
+\ No newline at end of file
diff --git a/changelog.d/double-notifications.fix b/changelog.d/double-notifications.fix
@@ -1 +0,0 @@
-Fix native notifications appearing as many times as there are open tabs. Clicking on notification will focus last focused tab.
diff --git a/changelog.d/emoji-scale.add b/changelog.d/emoji-scale.add
@@ -1 +0,0 @@
-Ability to change size of emoji
diff --git a/changelog.d/emoji-size.fix b/changelog.d/emoji-size.fix
@@ -0,0 +1 @@
+fix emoji inconsistencies in notifications, fix some emoji not scaling with interface
diff --git a/changelog.d/extra-notifications.add b/changelog.d/extra-notifications.add
@@ -1 +0,0 @@
-Support showing extra notifications in the notifications column
diff --git a/changelog.d/firefox-redmon.fix b/changelog.d/firefox-redmon.fix
@@ -1 +0,0 @@
-Bug with firefox and redmond themes
diff --git a/changelog.d/fixes-themes.skip b/changelog.d/fixes-themes.skip
@@ -1 +0,0 @@
-fixed themes for spw and kazvmoew
diff --git a/changelog.d/fixes.skip b/changelog.d/fixes.skip
@@ -1 +0,0 @@
-fix post appearance tab bugs part I
diff --git a/changelog.d/focus-clear.add b/changelog.d/focus-clear.add
@@ -1 +0,0 @@
-Focusing into a tab clears all current desktop notifications
diff --git a/changelog.d/group-actor.add b/changelog.d/group-actor.add
@@ -1 +0,0 @@
-Support group actors
diff --git a/changelog.d/hide-custom-emojis-in-picker.add b/changelog.d/hide-custom-emojis-in-picker.add
@@ -1 +0,0 @@
-Allow hiding custom emojis in picker.
diff --git a/changelog.d/misc-markup.fix b/changelog.d/misc-markup.fix
@@ -0,0 +1 @@
+Fix small markup inconsistencies
diff --git a/changelog.d/mobile-chrome-notifs.fix b/changelog.d/mobile-chrome-notifs.fix
@@ -1 +0,0 @@
-Fixed error that appeared on mobile Chrome(ium) (and derivatives) when native notifications are allowed
diff --git a/changelog.d/mobile-drawer-notifications.change b/changelog.d/mobile-drawer-notifications.change
@@ -1 +0,0 @@
-Added option to not mark all notifications when closing notifications drawer on mobile, this creates a new button to mark all as seen.
diff --git a/changelog.d/more-notification-types-setting.fix b/changelog.d/more-notification-types-setting.fix
@@ -1 +0,0 @@
-Fixed being unable to set notification visibility for reports and follow requests
diff --git a/changelog.d/multiple-status-mute-reasons.fix b/changelog.d/multiple-status-mute-reasons.fix
@@ -0,0 +1 @@
+Fix whitespaces for multiple status mute reasons, display bot status reason
diff --git a/changelog.d/mute-nsfw.add b/changelog.d/mute-nsfw.add
@@ -1 +0,0 @@
-Added ability to mute sensitive posts (ported from eintei)
diff --git a/changelog.d/native-filtering.add b/changelog.d/native-filtering.add
@@ -1 +0,0 @@
-Added option to toggle what notification types appear in native notifications, by default less important ones (likes, repeats, etc) will no longer show up in native notifications.
diff --git a/changelog.d/native-notifications.add b/changelog.d/native-notifications.add
@@ -1 +0,0 @@
-Native notifications now also have "badge" property that matches instance's favicon (visible in Android Chromium at least)
diff --git a/changelog.d/no-preserve-selection-color.fix b/changelog.d/no-preserve-selection-color.fix
@@ -1 +0,0 @@
-Ensure selection text color has enough contrast
diff --git a/changelog.d/non-anonymous-polls.add b/changelog.d/non-anonymous-polls.add
@@ -0,0 +1 @@
+Inform users that Smithereen public polls are public
+\ No newline at end of file
diff --git a/changelog.d/non-expiring-polls-indication.fix b/changelog.d/non-expiring-polls-indication.fix
@@ -1 +0,0 @@
-The expiry date indication won't be shown if the poll never expires
diff --git a/changelog.d/noninteractive-ignore-read.add b/changelog.d/noninteractive-ignore-read.add
@@ -1 +0,0 @@
-Added option to treat non-interactive notifications (likes, repeats et all) as seen for visual purposes (no read mark, ignored in counters, still can show in native notifications)
diff --git a/changelog.d/notif-types.fix b/changelog.d/notif-types.fix
@@ -1 +0,0 @@
-Synchronized requested notification types with backend, hopefully should fix missing notifications for polls and follow requests
diff --git a/changelog.d/notification-read.add b/changelog.d/notification-read.add
@@ -1 +0,0 @@
-Interacting (opening reply box etc) or simply clicking on non-interactive notifications now marks them as read. Clicking on native notifications for non-interactive ones also marks them as seen.
diff --git a/changelog.d/notifications-sorting.change b/changelog.d/notifications-sorting.change
@@ -1 +0,0 @@
-Notifications are no longer sorted by "seen" status since interacting with them can change their read status and makes UI jumpy. Old behavior can be restored in settings.
diff --git a/changelog.d/oauth-app-name.change b/changelog.d/oauth-app-name.change
@@ -0,0 +1 @@
+Simplify the OAuth client_name to 'PleromaFE'
diff --git a/changelog.d/panel-stack.fix b/changelog.d/panel-stack.fix
@@ -0,0 +1 @@
+proper sticky header for conversations on user page
diff --git a/changelog.d/public-favorites.skip b/changelog.d/piss-fix.skip
diff --git a/changelog.d/public-favorites.skip b/changelog.d/piss-serialization.skip
diff --git a/changelog.d/poll-ended-notifications.fix b/changelog.d/poll-ended-notifications.fix
@@ -1 +0,0 @@
-Add poll end notifications to fetched types.
diff --git a/changelog.d/preview-interference.skip b/changelog.d/preview-interference.skip
@@ -1 +0,0 @@
-skip
diff --git a/changelog.d/profile-mentions.fix b/changelog.d/profile-mentions.fix
@@ -1 +0,0 @@
-Fix profile mentions causing a 422 error
diff --git a/changelog.d/public-favorites.add b/changelog.d/public-favorites.add
@@ -1 +0,0 @@
-Display public favorites on user profiles
-\ No newline at end of file
diff --git a/changelog.d/quote-buttons.fix b/changelog.d/quote-buttons.fix
@@ -0,0 +1 @@
+reply-or-quote buttons now take less space
diff --git a/changelog.d/quotes-count.add b/changelog.d/quotes-count.add
@@ -1 +0,0 @@
-Display quotes count on posts and add quotes list page
-\ No newline at end of file
diff --git a/changelog.d/registration-notice.add b/changelog.d/registration-notice.add
@@ -1 +0,0 @@
-Show a dedicated registration notice page when further action is required after registering
diff --git a/changelog.d/scrobbles-age-filter.add b/changelog.d/scrobbles-age-filter.add
@@ -1 +0,0 @@
-Option to only show scrobbles that are recent enough
diff --git a/changelog.d/serviceworkers.change b/changelog.d/serviceworkers.change
@@ -1 +0,0 @@
-Notifications are now shown through a serviceworker (since mobile chrome does not allow them otherwise), it's always enabled, even if previously we only enabled it for WebPush notifications only. If you don't like websites "running" while closed, check how to disable them in your browser. Old way to show notifications will be used as a fallback but might not have all the new features.
diff --git a/changelog.d/show-bookmarks-on-mobile.fix b/changelog.d/show-bookmarks-on-mobile.fix
@@ -0,0 +1 @@
+Bookmarks visible again on mobile
diff --git a/changelog.d/show-recent-scrobble.skip b/changelog.d/show-recent-scrobble.skip
@@ -1 +0,0 @@
-Shows the most recent scrobble under each post when available
diff --git a/changelog.d/public-favorites.skip b/changelog.d/splashfix.skip
diff --git a/changelog.d/splashscreen.add b/changelog.d/splashscreen.add
@@ -0,0 +1 @@
+Splash screen + loading indicator to make process of identifying initialization issues and load performance
diff --git a/changelog.d/status-loading-indicator.add b/changelog.d/status-loading-indicator.add
@@ -1 +0,0 @@
-Display loading and error indicator for conversation page
diff --git a/changelog.d/status-notification-type.add b/changelog.d/status-notification-type.add
@@ -1 +0,0 @@
-Support `status` notification type
-\ No newline at end of file
diff --git a/changelog.d/tabs.change b/changelog.d/tabs.change
@@ -0,0 +1 @@
+Tabs now have indentation for better visibility of which tab is currently active
diff --git a/changelog.d/theme-selector.add b/changelog.d/theme-selector.add
@@ -1 +0,0 @@
-Theme selector with visual previews of the theme
diff --git a/changelog.d/themes3-cache.add b/changelog.d/themes3-cache.add
@@ -1 +0,0 @@
-Add caching system for themes3
diff --git a/changelog.d/themes3-fixes.fix b/changelog.d/themes3-fixes.fix
@@ -1 +0,0 @@
-fix color inputs and some in-development themes3 issues
diff --git a/changelog.d/themes3.add b/changelog.d/themes3.add
@@ -0,0 +1 @@
+UI for making v3 themes and palettes, support for bundling v3 themes
diff --git a/changelog.d/themes3.change b/changelog.d/themes3.change
@@ -1 +0,0 @@
-Overhauled the way themes work, migrating to new Pleroma Interface Style Sheets system.
diff --git a/changelog.d/themesv3-on-safari.fix b/changelog.d/themesv3-on-safari.fix
@@ -1 +0,0 @@
-Fix Themes v3 on Safari not working
diff --git a/changelog.d/ui-scale.add b/changelog.d/ui-scale.add
@@ -1 +0,0 @@
-Ability to resize UI (and certain components) scale independent of browser/text scale
diff --git a/changelog.d/unreads-sync.fix b/changelog.d/unreads-sync.fix
@@ -1 +0,0 @@
-unread notifications should now properly catch up (eventually) in polling mode
diff --git a/changelog.d/user-link.add b/changelog.d/user-link.add
@@ -0,0 +1 @@
+Make UserLink wrappable
diff --git a/changelog.d/user-overrides.add b/changelog.d/user-overrides.add
@@ -1 +0,0 @@
-Ability to override certain aspects of UI style independent of theme used (UI roundness, fonts, underlay)
diff --git a/changelog.d/video-poster.fix b/changelog.d/video-poster.fix
@@ -1 +0,0 @@
-Video posters on Safari
diff --git a/changelog.d/video-poster.update.skip b/changelog.d/video-poster.update.skip
@@ -1 +0,0 @@
-nothing
diff --git a/changelog.d/web-push-always.add b/changelog.d/web-push-always.add
@@ -1 +0,0 @@
-Added option to always "show" notifications when using web push for better compatibility with some browsers (chrome, edge, safari)
diff --git a/changelog.d/weird-absolute-time-format.fix b/changelog.d/weird-absolute-time-format.fix
@@ -0,0 +1 @@
+Show only month and day instead of weird "day, hour" format. While at it, fixed typo "defualt" in a comment.
+\ No newline at end of file
diff --git a/index.html b/index.html
@@ -3,14 +3,163 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
- <link rel="icon" type="image/png" href="/favicon.png">
+ <!-- putting styles here to avoid having to wait for styles to load up -->
+ <style id="splashscreen">
+ #splash {
+ --scale: 1;
+ width: 100vw;
+ height: 100vh;
+ display: grid;
+ grid-template-rows: auto;
+ grid-template-columns: auto;
+ align-content: center;
+ align-items: center;
+ justify-content: center;
+ justify-items: center;
+ flex-direction: column;
+ background: #0f161e;
+ font-family: sans-serif;
+ color: #b9b9ba;
+ position: absolute;
+ z-index: 9999;
+ font-size: calc(1vw + 1vh + 1vmin);
+ }
+
+ #splash-credit {
+ position: absolute;
+ font-size: 14px;
+ bottom: 16px;
+ right: 16px;
+ }
+
+ #splash-container {
+ align-items: center;
+ }
+
+ #mascot-container {
+ display: flex;
+ align-items: flex-end;
+ justify-content: center;
+ perspective: 60em;
+ perspective-origin: 0 -15em;
+ transform-style: preserve-3d;
+ }
+
+ #mascot {
+ width: calc(10em * var(--scale));
+ height: calc(10em * var(--scale));
+ object-fit: contain;
+ object-position: bottom;
+ transform: translateZ(-2em);
+ }
+
+ #throbber {
+ display: grid;
+ width: calc(5em * 0.5 * var(--scale));
+ height: calc(8em * 0.5 * var(--scale));
+ margin-left: 4.1em;
+ z-index: 2;
+ grid-template-rows: repeat(8, 1fr);
+ grid-template-columns: repeat(5, 1fr);
+ grid-template-areas: "P P . L L"
+ "P P . L L"
+ "P P . L L"
+ "P P . L L"
+ "P P . . ."
+ "P P . . ."
+ "P P . E E"
+ "P P . E E";
+
+ --logoChunkSize: calc(2em * 0.5 * var(--scale))
+ }
+
+ .chunk {
+ background-color: #e2b188;
+ box-shadow: 0.01em 0.01em 0.1em 0 #e2b188;
+ }
+
+ #chunk-P {
+ grid-area: P;
+ border-top-left-radius: calc(var(--logoChunkSize) / 2);
+ }
+
+ #chunk-L {
+ grid-area: L;
+ border-bottom-right-radius: calc(var(--logoChunkSize) / 2);
+ }
+
+ #chunk-E {
+ grid-area: E;
+ border-bottom-right-radius: calc(var(--logoChunkSize) / 2);
+ }
+
+ #status {
+ margin-top: 1em;
+ line-height: 2;
+ width: 100%;
+ text-align: center;
+ }
+
+ #statusError {
+ display: none;
+ margin-top: 1em;
+ font-size: calc(1vw + 1vh + 1vmin);
+ line-height: 2;
+ width: 100%;
+ text-align: center;
+ }
+
+ #statusStack {
+ display: none;
+ margin-top: 1em;
+ font-size: calc((1vw + 1vh + 1vmin) / 2.5);
+ width: calc(100vw - 5em);
+ padding: 1em;
+ text-overflow: ellipsis;
+ overflow-x: hidden;
+ text-align: left;
+ line-height: 2;
+ }
+
+ @media (prefers-reduced-motion) {
+ #throbber {
+ animation: none !important;
+ }
+ }
+ </style>
<style id="pleroma-eager-styles" type="text/css"></style>
<style id="pleroma-lazy-styles" type="text/css"></style>
<!--server-generated-meta-->
</head>
- <body class="hidden">
+ <body style="margin: 0; padding: 0">
<noscript>To use Pleroma, please enable JavaScript.</noscript>
- <div id="app"></div>
+ <div id="splash">
+ <!-- we are hiding entire graphic so no point showing credit -->
+ <div aria-hidden="true" id="splash-credit">
+ Art by pipivovott
+ </div>
+ <div id="splash-container">
+ <div aria-hidden="true" id="mascot-container">
+ <div id="throbber">
+ <div class="chunk" id="chunk-P">
+ </div>
+ <div class="chunk" id="chunk-L">
+ </div>
+ <div class="chunk" id="chunk-E">
+ </div>
+ </div>
+ <img id="mascot" src="/static/pleromatan_apology.png">
+ </div>
+ <div id="status" class="css-ok">
+ <!-- (。>﹏<) -->
+ <!-- it's a pseudographic, don't want screenreader read out nonsense -->
+ <span aria-hidden="true" class="initial-text">(。>﹏<)</span>
+ </div>
+ <code id="statusError"></code>
+ <pre id="statusStack"></pre>
+ </div>
+ </div>
+ <div id="app" class="hidden"></div>
<div id="modal"></div>
<!-- built files will be auto injected -->
<div id="popovers" />
diff --git a/package.json b/package.json
@@ -1,6 +1,6 @@
{
"name": "pleroma_fe",
- "version": "2.6.1",
+ "version": "2.7.1",
"description": "Pleroma frontend, the default frontend of Pleroma social network server",
"author": "Pleroma contributors <https://git.pleroma.social/pleroma/pleroma-fe/-/blob/develop/CONTRIBUTORS.md>",
"private": false,
@@ -24,7 +24,7 @@
"@fortawesome/vue-fontawesome": "3.0.3",
"@kazvmoe-infra/pinch-zoom-element": "1.2.0",
"@kazvmoe-infra/unicode-emoji-json": "0.4.0",
- "@ruffle-rs/ruffle": "0.1.0-nightly.2024.3.17",
+ "@ruffle-rs/ruffle": "0.1.0-nightly.2024.8.21",
"@vuelidate/core": "2.0.3",
"@vuelidate/validators": "2.0.4",
"body-scroll-lock": "3.1.5",
@@ -35,6 +35,7 @@
"hash-sum": "^2.0.0",
"js-cookie": "3.0.5",
"localforage": "1.10.0",
+ "pako": "^2.1.0",
"parse-link-header": "2.0.0",
"phoenix": "1.7.7",
"punycode.js": "2.3.0",
@@ -58,7 +59,7 @@
"@intlify/vue-i18n-loader": "5.0.1",
"@ungap/event-target": "0.2.4",
"@vue/babel-helper-vue-jsx-merge-props": "1.4.0",
- "@vue/babel-plugin-jsx": "1.2.1",
+ "@vue/babel-plugin-jsx": "1.2.2",
"@vue/compiler-sfc": "3.2.45",
"@vue/test-utils": "2.2.8",
"autoprefixer": "10.4.19",
@@ -88,9 +89,9 @@
"http-proxy-middleware": "2.0.6",
"iso-639-1": "2.1.15",
"json-loader": "0.5.7",
- "karma": "6.4.2",
+ "karma": "6.4.4",
"karma-coverage": "2.2.0",
- "karma-firefox-launcher": "2.1.2",
+ "karma-firefox-launcher": "2.1.3",
"karma-mocha": "2.0.1",
"karma-mocha-reporter": "2.2.5",
"karma-sinon-chai": "2.0.2",
@@ -132,5 +133,6 @@
"engines": {
"node": ">= 16.0.0",
"npm": ">= 3.0.0"
- }
+ },
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
diff --git a/src/App.js b/src/App.js
@@ -44,16 +44,32 @@ export default {
data: () => ({
mobileActivePanel: 'timeline'
}),
+ watch: {
+ themeApplied (value) {
+ this.removeSplash()
+ }
+ },
created () {
// Load the locale from the storage
const val = this.$store.getters.mergedConfig.interfaceLanguage
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
window.addEventListener('resize', this.updateMobileState)
},
+ mounted () {
+ if (this.$store.state.interface.themeApplied) {
+ this.removeSplash()
+ }
+ },
unmounted () {
window.removeEventListener('resize', this.updateMobileState)
},
computed: {
+ themeApplied () {
+ return this.$store.state.interface.themeApplied
+ },
+ layoutModalClass () {
+ return '-' + this.layoutType
+ },
classes () {
return [
{
@@ -130,6 +146,15 @@ export default {
updateMobileState () {
this.$store.dispatch('setLayoutWidth', windowWidth())
this.$store.dispatch('setLayoutHeight', windowHeight())
+ },
+ removeSplash () {
+ document.querySelector('#status').textContent = this.$t('splash.fun_' + Math.ceil(Math.random() * 4))
+ const splashscreenRoot = document.querySelector('#splash')
+ splashscreenRoot.addEventListener('transitionend', () => {
+ splashscreenRoot.remove()
+ })
+ splashscreenRoot.classList.add('hidden')
+ document.querySelector('#app').classList.remove('hidden')
}
}
}
diff --git a/src/App.scss b/src/App.scss
@@ -920,3 +920,169 @@ option {
color: var(--selectionText);
background-color: var(--selectionBackground);
}
+
+#splash {
+ pointer-events: none;
+ transition: opacity 2s;
+ opacity: 1;
+
+ &.hidden {
+ opacity: 0;
+ }
+
+ #status {
+ &.css-ok {
+ &::before {
+ display: inline-block;
+ content: "CSS OK";
+ }
+ }
+
+ .initial-text {
+ display: none;
+ }
+ }
+
+ #throbber {
+ animation-duration: 3s;
+ animation-name: bounce;
+ animation-iteration-count: infinite;
+ animation-direction: normal;
+ transform-origin: bottom center;
+
+ &.dead {
+ animation-name: dead;
+ animation-duration: 2s;
+ animation-iteration-count: 1;
+ transform: rotateX(90deg) rotateY(0) rotateZ(-45deg);
+ }
+
+ @keyframes dead {
+ 0% {
+ transform: rotateX(0) rotateY(0) rotateZ(0);
+ }
+
+ 5% {
+ transform: rotateX(0) rotateY(0) rotateZ(1deg);
+ }
+
+ 10% {
+ transform: rotateX(0) rotateY(0) rotateZ(-2deg);
+ }
+
+ 15% {
+ transform: rotateX(0) rotateY(0) rotateZ(3deg);
+ }
+
+ 20% {
+ transform: rotateX(0) rotateY(0) rotateZ(0);
+ }
+
+ 25% {
+ transform: rotateX(0) rotateY(0) rotateZ(0);
+ }
+
+ 30% {
+ transform: rotateX(10deg) rotateY(0) rotateZ(0);
+ }
+
+ 35% {
+ transform: rotateX(-10deg) rotateY(0) rotateZ(0);
+ }
+
+ 40% {
+ transform: rotateX(10deg) rotateY(0) rotateZ(0);
+ }
+
+ 45% {
+ transform: rotateX(-10deg) rotateY(0) rotateZ(0);
+ }
+
+ 50% {
+ transform: rotateX(10deg) rotateY(0) rotateZ(0);
+ }
+
+ 100% {
+ transform: rotateX(90deg) rotateY(0) rotateZ(-45deg);
+ transition-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); /* easeInQuint */
+ }
+ }
+
+ @keyframes bounce {
+ 0% {
+ scale: 1 1;
+ translate: 0 0;
+ animation-timing-function: ease-out;
+ }
+
+ 10% {
+ scale: 1.2 0.8;
+ translate: 0 0;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-out;
+ }
+
+ 30% {
+ scale: 0.9 1.1;
+ translate: 0 -40%;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-in;
+ }
+
+ 40% {
+ scale: 1.1 0.9;
+ translate: 0 -50%;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-in;
+ }
+
+ 45% {
+ scale: 0.9 1.1;
+ translate: 0 -45%;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-in;
+ }
+
+ 50% {
+ scale: 1.05 0.95;
+ translate: 0 -40%;
+ animation-timing-function: ease-in;
+ }
+
+ 55% {
+ scale: 0.985 1.025;
+ translate: 0 -35%;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-in;
+ }
+
+ 60% {
+ scale: 1.0125 0.9985;
+ translate: 0 -30%;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-in;
+ }
+
+ 80% {
+ scale: 1.0063 0.9938;
+ translate: 0 -10%;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-in-ou;
+ }
+
+ 90% {
+ scale: 1.2 0.8;
+ translate: 0 0;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-out;
+ }
+
+ 100% {
+ scale: 1 1;
+ translate: 0 0;
+ transform: rotateZ(var(--defaultZ));
+ animation-timing-function: ease-out;
+ }
+ }
+ }
+}
diff --git a/src/App.vue b/src/App.vue
@@ -70,7 +70,7 @@
<PostStatusModal />
<EditStatusModal v-if="editingAvailable" />
<StatusHistoryModal v-if="editingAvailable" />
- <SettingsModal />
+ <SettingsModal :class="layoutModalClass" />
<UpdateNotification />
<GlobalNoticeList />
</div>
diff --git a/src/assets/pleromatan_apology.png b/src/assets/pleromatan_apology.png
@@ -0,0 +1 @@
+../../static/pleromatan_apology.png
+\ No newline at end of file
diff --git a/src/assets/pleromatan_apology_fox.png b/src/assets/pleromatan_apology_fox.png
@@ -0,0 +1 @@
+../../static/pleromatan_apology_fox.png
+\ No newline at end of file
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
@@ -122,6 +122,9 @@ const setSettings = async ({ apiConfig, staticConfig, store }) => {
store.dispatch('setInstanceOption', { name, value: config[name] })
}
+ copyInstanceOption('theme')
+ copyInstanceOption('style')
+ copyInstanceOption('palette')
copyInstanceOption('nsfwCensorImage')
copyInstanceOption('background')
copyInstanceOption('hidePostStats')
@@ -240,7 +243,7 @@ const resolveStaffAccounts = ({ store, accounts }) => {
const getNodeInfo = async ({ store }) => {
try {
- const res = await preloadFetch('/nodeinfo/2.0.json')
+ const res = await preloadFetch('/nodeinfo/2.1.json')
if (res.ok) {
const data = await res.json()
const metadata = data.metadata
@@ -252,6 +255,7 @@ const getNodeInfo = async ({ store }) => {
store.dispatch('setInstanceOption', { name: 'shoutAvailable', value: features.includes('chat') })
store.dispatch('setInstanceOption', { name: 'pleromaChatMessagesAvailable', value: features.includes('pleroma_chat_messages') })
store.dispatch('setInstanceOption', { name: 'pleromaCustomEmojiReactionsAvailable', value: features.includes('pleroma_custom_emoji_reactions') })
+ store.dispatch('setInstanceOption', { name: 'pleromaBookmarkFoldersAvailable', value: features.includes('pleroma:bookmark_folders') })
store.dispatch('setInstanceOption', { name: 'gopherAvailable', value: features.includes('gopher') })
store.dispatch('setInstanceOption', { name: 'pollsAvailable', value: features.includes('polls') })
store.dispatch('setInstanceOption', { name: 'editingAvailable', value: features.includes('editing') })
@@ -276,6 +280,7 @@ const getNodeInfo = async ({ store }) => {
const software = data.software
store.dispatch('setInstanceOption', { name: 'backendVersion', value: software.version })
+ store.dispatch('setInstanceOption', { name: 'backendRepository', value: software.repository })
store.dispatch('setInstanceOption', { name: 'pleromaBackend', value: software.name === 'pleroma' })
const priv = metadata.private
@@ -326,11 +331,7 @@ const setConfig = async ({ store }) => {
const checkOAuthToken = async ({ store }) => {
if (store.getters.getUserToken()) {
- try {
- await store.dispatch('loginUser', store.getters.getUserToken())
- } catch (e) {
- console.error(e)
- }
+ return store.dispatch('loginUser', store.getters.getUserToken())
}
return Promise.resolve()
}
@@ -349,9 +350,14 @@ const afterStoreSetup = async ({ store, i18n }) => {
store.dispatch('setInstanceOption', { name: 'server', value: server })
await setConfig({ store })
- await store.dispatch('setTheme')
+ try {
+ await store.dispatch('applyTheme').catch((e) => { console.error('Error setting theme', e) })
+ } catch (e) {
+ window.splashError(e)
+ return Promise.reject(e)
+ }
- applyConfig(store.state.config)
+ applyConfig(store.state.config, i18n.global)
// Now we can try getting the server settings and logging in
// Most of these are preloaded into the index.html so blocking is minimized
@@ -360,7 +366,7 @@ const afterStoreSetup = async ({ store, i18n }) => {
getInstancePanel({ store }),
getNodeInfo({ store }),
getInstanceConfig({ store })
- ])
+ ]).catch(e => Promise.reject(e))
await store.dispatch('loadDrafts')
@@ -387,6 +393,13 @@ const afterStoreSetup = async ({ store, i18n }) => {
app.use(store)
app.use(i18n)
+ // Little thing to get out of invalid theme state
+ window.resetThemes = () => {
+ store.dispatch('resetThemeV3')
+ store.dispatch('resetThemeV3Palette')
+ store.dispatch('resetThemeV2')
+ }
+
app.use(vClickOutside)
app.use(VBodyScrollLock)
app.use(VueVirtualScroller)
@@ -398,7 +411,6 @@ const afterStoreSetup = async ({ store, i18n }) => {
app.config.unwrapInjectedRef = true
app.mount('#app')
-
return app
}
diff --git a/src/boot/routes.js b/src/boot/routes.js
@@ -27,6 +27,8 @@ import NavPanel from 'src/components/nav_panel/nav_panel.vue'
import AnnouncementsPage from 'components/announcements_page/announcements_page.vue'
import QuotesTimeline from '../components/quotes_timeline/quotes_timeline.vue'
import Drafts from 'components/drafts/drafts.vue'
+import BookmarkFolders from '../components/bookmark_folders/bookmark_folders.vue'
+import BookmarkFolderEdit from '../components/bookmark_folder_edit/bookmark_folder_edit.vue'
export default (store) => {
const validateAuthenticatedRoute = (to, from, next) => {
@@ -88,7 +90,11 @@ export default (store) => {
{ name: 'lists-timeline', path: '/lists/:id', component: ListsTimeline },
{ name: 'lists-edit', path: '/lists/:id/edit', component: ListsEdit },
{ name: 'lists-new', path: '/lists/new', component: ListsEdit },
- { name: 'edit-navigation', path: '/nav-edit', component: NavPanel, props: () => ({ forceExpand: true, forceEditMode: true }), beforeEnter: validateAuthenticatedRoute }
+ { name: 'edit-navigation', path: '/nav-edit', component: NavPanel, props: () => ({ forceExpand: true, forceEditMode: true }), beforeEnter: validateAuthenticatedRoute },
+ { name: 'bookmark-folders', path: '/bookmark_folders', component: BookmarkFolders },
+ { name: 'bookmark-folder-new', path: '/bookmarks/new-folder', component: BookmarkFolderEdit },
+ { name: 'bookmark-folder', path: '/bookmarks/:id', component: BookmarkTimeline },
+ { name: 'bookmark-folder-edit', path: '/bookmarks/:id/edit', component: BookmarkFolderEdit }
]
if (store.state.instance.pleromaChatMessagesAvailable) {
diff --git a/src/components/account_actions/account_actions.vue b/src/components/account_actions/account_actions.vue
@@ -86,6 +86,7 @@
<i18n-t
keypath="user_card.block_confirm"
tag="span"
+ scope="global"
>
<template #user>
<span
@@ -107,6 +108,7 @@
<i18n-t
keypath="user_card.remove_follower_confirm"
tag="span"
+ scope="global"
>
<template #user>
<span
diff --git a/src/components/alert.style.js b/src/components/alert.style.js
@@ -14,6 +14,10 @@ export default {
warning: '.warning',
success: '.success'
},
+ editor: {
+ border: 1,
+ aspect: '3 / 1'
+ },
defaultRules: [
{
directives: {
@@ -27,7 +31,9 @@ export default {
component: 'Alert'
},
component: 'Border',
- textColor: '--parent'
+ directives: {
+ textColor: '--parent'
+ }
},
{
variant: 'error',
diff --git a/src/components/announcement_editor/announcement_editor.vue b/src/components/announcement_editor/announcement_editor.vue
@@ -34,8 +34,9 @@
id="announcement-all-day"
v-model="announcement.allDay"
:disabled="disabled"
- />
- <label for="announcement-all-day">{{ $t('announcements.all_day_prompt') }}</label>
+ >
+ {{ $t('announcements.all_day_prompt') }}
+ </Checkbox>
</span>
</div>
</template>
diff --git a/src/components/announcements_page/announcements_page.vue b/src/components/announcements_page/announcements_page.vue
@@ -1,9 +1,9 @@
<template>
<div class="panel panel-default announcements-page">
<div class="panel-heading">
- <span>
+ <h1 class="title">
{{ $t('announcements.page_header') }}
- </span>
+ </h1>
</div>
<div class="panel-body">
<section
diff --git a/src/components/attachment/attachment.style.js b/src/components/attachment/attachment.style.js
@@ -1,6 +1,7 @@
export default {
name: 'Attachment',
selector: '.Attachment',
+ notEditable: true,
validInnerComponents: [
'Border',
'ButtonUnstyled',
diff --git a/src/components/basic_user_card/basic_user_card.vue b/src/components/basic_user_card/basic_user_card.vue
@@ -48,7 +48,7 @@
flex: 1 0;
margin: 0;
- --emoji-size: 14px;
+ --emoji-size: 1em;
&-collapsed-content {
margin-left: 0.7em;
diff --git a/src/components/bookmark_folder_card/bookmark_folder_card.js b/src/components/bookmark_folder_card/bookmark_folder_card.js
@@ -0,0 +1,22 @@
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faEllipsisH
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faEllipsisH
+)
+
+const BookmarkFolderCard = {
+ props: [
+ 'folder',
+ 'allBookmarks'
+ ],
+ computed: {
+ firstLetter () {
+ return this.folder ? this.folder.name[0] : null
+ }
+ }
+}
+
+export default BookmarkFolderCard
diff --git a/src/components/bookmark_folder_card/bookmark_folder_card.vue b/src/components/bookmark_folder_card/bookmark_folder_card.vue
@@ -0,0 +1,111 @@
+<template>
+ <div
+ v-if="allBookmarks"
+ class="bookmark-folder-card"
+ >
+ <router-link
+ :to="{ name: 'bookmarks' }"
+ class="bookmark-folder-name"
+ >
+ <span class="icon">
+ <FAIcon
+ fixed-width
+ class="fa-scale-110 menu-icon"
+ icon="bookmark"
+ />
+ </span>{{ $t('nav.all_bookmarks') }}
+ </router-link>
+ </div>
+ <div
+ v-else
+ class="bookmark-folder-card"
+ >
+ <router-link
+ :to="{ name: 'bookmark-folder', params: { id: folder.id } }"
+ class="bookmark-folder-name"
+ >
+ <img
+ v-if="folder.emoji_url"
+ class="iconEmoji iconEmoji-image"
+ :src="folder.emoji_url"
+ :alt="folder.emoji"
+ :title="folder.emoji"
+ >
+ <span
+ v-else-if="folder.emoji"
+ class="iconEmoji"
+ >
+ <span>
+ {{ folder.emoji }}
+ </span>
+ </span>
+ <span
+ v-else-if="firstLetter"
+ class="icon iconLetter fa-scale-110"
+ >{{ firstLetter }}</span>{{ folder.name }}
+ </router-link>
+ <router-link
+ :to="{ name: 'bookmark-folder-edit', params: { id: folder.id } }"
+ class="button-folder-edit"
+ >
+ <FAIcon
+ class="fa-scale-110 fa-old-padding"
+ icon="ellipsis-h"
+ />
+ </router-link>
+ </div>
+</template>
+
+<script src="./bookmark_folder_card.js"></script>
+
+<style lang="scss">
+.bookmark-folder-card {
+ display: flex;
+ align-items: center;
+}
+
+a.bookmark-folder-name {
+ display: flex;
+ align-items: center;
+ flex-grow: 1;
+
+ .icon,
+ .iconLetter,
+ .iconEmoji {
+ display: inline-block;
+ height: 2.5rem;
+ width: 2.5rem;
+ margin-right: 0.5rem;
+ }
+
+ .icon,
+ .iconLetter {
+ font-size: 1.5rem;
+ line-height: 2.5rem;
+ text-align: center;
+ }
+
+ .iconEmoji {
+ text-align: center;
+ object-fit: contain;
+ vertical-align: middle;
+
+ > span {
+ font-size: 1.5rem;
+ line-height: 2.5rem;
+ }
+ }
+
+ img.iconEmoji {
+ padding: 0.25em;
+ box-sizing: border-box;
+ }
+}
+
+.bookmark-folder-name,
+.button-folder-edit {
+ margin: 0;
+ padding: 1em;
+ color: var(--link);
+}
+</style>
diff --git a/src/components/bookmark_folder_edit/bookmark_folder_edit.js b/src/components/bookmark_folder_edit/bookmark_folder_edit.js
@@ -0,0 +1,80 @@
+import EmojiPicker from '../emoji_picker/emoji_picker.vue'
+import apiService from '../../services/api/api.service'
+
+const BookmarkFolderEdit = {
+ data () {
+ return {
+ name: '',
+ nameDraft: '',
+ emoji: '',
+ emojiUrl: null,
+ emojiDraft: '',
+ emojiUrlDraft: null,
+ emojiPickerExpanded: false,
+ reallyDelete: false
+ }
+ },
+ components: {
+ EmojiPicker
+ },
+ created () {
+ if (!this.id) return
+ const credentials = this.$store.state.users.currentUser.credentials
+ apiService.fetchBookmarkFolders({ credentials })
+ .then((folders) => {
+ const folder = folders.find(folder => folder.id === this.id)
+ if (!folder) return
+
+ this.nameDraft = this.name = folder.name
+ this.emojiDraft = this.emoji = folder.emoji
+ this.emojiUrlDraft = this.emojiUrl = folder.emoji_url
+ })
+ },
+ computed: {
+ id () {
+ return this.$route.params.id
+ }
+ },
+ methods: {
+ selectEmoji (event) {
+ this.emojiDraft = event.insertion
+ this.emojiUrlDraft = event.insertionUrl
+ },
+ showEmojiPicker () {
+ if (!this.emojiPickerExpanded) {
+ this.$refs.picker.showPicker()
+ }
+ },
+ onShowPicker () {
+ this.emojiPickerExpanded = true
+ },
+ onClosePicker () {
+ this.emojiPickerExpanded = false
+ },
+ updateFolder () {
+ this.$store.dispatch('setBookmarkFolder', { folderId: this.id, name: this.nameDraft, emoji: this.emojiDraft })
+ .then(() => {
+ this.$router.push({ name: 'bookmark-folders' })
+ })
+ },
+ createFolder () {
+ this.$store.dispatch('createBookmarkFolder', { name: this.nameDraft, emoji: this.emojiDraft })
+ .then(() => {
+ this.$router.push({ name: 'bookmark-folders' })
+ })
+ .catch((e) => {
+ this.$store.dispatch('pushGlobalNotice', {
+ messageKey: 'bookmark_folders.error',
+ messageArgs: [e.message],
+ level: 'error'
+ })
+ })
+ },
+ deleteFolder () {
+ this.$store.dispatch('deleteBookmarkFolder', { folderId: this.id })
+ this.$router.push({ name: 'bookmark-folders' })
+ }
+ }
+}
+
+export default BookmarkFolderEdit
diff --git a/src/components/bookmark_folder_edit/bookmark_folder_edit.vue b/src/components/bookmark_folder_edit/bookmark_folder_edit.vue
@@ -0,0 +1,200 @@
+<template>
+ <div class="panel-default panel BookmarkFolderEdit">
+ <div
+ ref="header"
+ class="panel-heading folder-edit-heading"
+ >
+ <button
+ class="button-unstyled go-back-button"
+ @click="$router.back"
+ >
+ <FAIcon
+ size="lg"
+ icon="chevron-left"
+ />
+ </button>
+ <h1 class="title">
+ <i18n-t
+ v-if="id"
+ keypath="bookmark_folders.editing_folder"
+ scope="global"
+ >
+ <template #folderName>
+ {{ name }}
+ </template>
+ </i18n-t>
+ <i18n-t
+ v-else
+ keypath="bookmark_folders.creating_folder"
+ scope="global"
+ />
+ </h1>
+ </div>
+ <div class="panel-body">
+ <div class="input-wrap">
+ <label for="folder-edit-title">{{ $t('bookmark_folders.emoji') }}</label>
+ <button
+ class="input input-emoji"
+ :title="$t('bookmark_folder.emoji_pick')"
+ @click="showEmojiPicker"
+ >
+ <img
+ v-if="emojiUrlDraft"
+ class="iconEmoji iconEmoji-image"
+ :src="emojiUrlDraft"
+ :alt="emojiDraft"
+ :title="emojiDraft"
+ >
+ <span
+ v-else-if="emojiDraft"
+ class="iconEmoji"
+ >
+ <span>
+ {{ emojiDraft }}
+ </span>
+ </span>
+ </button>
+ <EmojiPicker
+ ref="picker"
+ class="emoji-picker-panel"
+ @emoji="selectEmoji"
+ @show="onShowPicker"
+ @close="onClosePicker"
+ />
+ </div>
+ <div class="input-wrap">
+ <label for="folder-edit-title">{{ $t('bookmark_folders.name') }}</label>
+ <input
+ id="folder-edit-title"
+ ref="name"
+ v-model="nameDraft"
+ class="input"
+ >
+ </div>
+ </div>
+ <div class="panel-footer">
+ <span class="spacer" />
+ <button
+ v-if="!id"
+ class="btn button-default footer-button"
+ @click="createFolder"
+ >
+ {{ $t('bookmark_folders.create') }}
+ </button>
+ <button
+ v-else-if="!reallyDelete"
+ class="btn button-default footer-button"
+ @click="reallyDelete = true"
+ >
+ {{ $t('bookmark_folders.delete') }}
+ </button>
+ <template v-else>
+ {{ $t('bookmark_folders.really_delete') }}
+ <button
+ class="btn button-default footer-button"
+ @click="deleteFolder"
+ >
+ {{ $t('general.yes') }}
+ </button>
+ <button
+ class="btn button-default footer-button"
+ @click="reallyDelete = false"
+ >
+ {{ $t('general.no') }}
+ </button>
+ </template>
+ <div
+ v-if="id && !reallyDelete"
+ >
+ <button
+ class="btn button-default follow-button"
+ @click="updateFolder"
+ >
+ {{ $t('bookmark_folders.update_folder') }}
+ </button>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script src="./bookmark_folder_edit.js"></script>
+
+<style lang="scss">
+.BookmarkFolderEdit {
+ --panel-body-padding: 0.5em;
+
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+
+ .folder-edit-heading {
+ grid-template-columns: auto minmax(50%, 1fr);
+ }
+
+ .panel-body {
+ display: flex;
+ gap: 0.5em;
+ }
+
+ .emoji-picker-panel {
+ position: absolute;
+ z-index: 20;
+ margin-top: 2px;
+
+ &.hide {
+ display: none;
+ }
+ }
+
+ .input-emoji {
+ height: 2.5em;
+ width: 2.5em;
+ padding: 0;
+
+ .iconEmoji {
+ display: inline-block;
+ text-align: center;
+ object-fit: contain;
+ vertical-align: middle;
+ height: 2.5em;
+ width: 2.5em;
+
+ > span {
+ font-size: 1.5rem;
+ line-height: 2.5rem;
+ }
+ }
+
+ img.iconEmoji {
+ padding: 0.25em;
+ box-sizing: border-box;
+ }
+ }
+
+ .input-wrap {
+ display: flex;
+ flex-direction: column;
+ gap: 0.5em;
+ }
+
+ .go-back-button {
+ text-align: center;
+ line-height: 1;
+ height: 100%;
+ align-self: start;
+ width: var(--__panel-heading-height-inner);
+ }
+
+ .btn {
+ margin: 0 0.5em;
+ }
+
+ .panel-footer {
+ grid-template-columns: minmax(10%, 1fr);
+
+ .footer-button {
+ min-width: 9em;
+ }
+ }
+}
+</style>
diff --git a/src/components/bookmark_folders/bookmark_folders.js b/src/components/bookmark_folders/bookmark_folders.js
@@ -0,0 +1,27 @@
+import BookmarkFolderCard from '../bookmark_folder_card/bookmark_folder_card.vue'
+
+const BookmarkFolders = {
+ data () {
+ return {
+ isNew: false
+ }
+ },
+ components: {
+ BookmarkFolderCard
+ },
+ computed: {
+ bookmarkFolders () {
+ return this.$store.state.bookmarkFolders.allFolders
+ }
+ },
+ methods: {
+ cancelNewFolder () {
+ this.isNew = false
+ },
+ newFolder () {
+ this.isNew = true
+ }
+ }
+}
+
+export default BookmarkFolders
diff --git a/src/components/bookmark_folders/bookmark_folders.vue b/src/components/bookmark_folders/bookmark_folders.vue
@@ -0,0 +1,37 @@
+<template>
+ <div class="Bookmark-folders panel panel-default">
+ <div class="panel-heading">
+ <h1 class="title">
+ {{ $t('nav.bookmark_folders') }}
+ </h1>
+ <router-link
+ :to="{ name: 'bookmark-folder-new' }"
+ class="button-default btn new-folder-button"
+ >
+ {{ $t("bookmark_folders.new") }}
+ </router-link>
+ </div>
+ <div class="panel-body">
+ <BookmarkFolderCard
+ :all-bookmarks="true"
+ class="list-item"
+ />
+ <BookmarkFolderCard
+ v-for="folder in bookmarkFolders.slice().reverse()"
+ :key="folder"
+ :folder="folder"
+ class="list-item"
+ />
+ </div>
+ </div>
+</template>
+
+<script src="./bookmark_folders.js"></script>
+
+<style lang="scss">
+.Bookmark-folders {
+ .new-folder-button {
+ padding: 0 0.5em;
+ }
+}
+</style>
diff --git a/src/components/bookmark_folders_menu/bookmark_folders_menu_content.js b/src/components/bookmark_folders_menu/bookmark_folders_menu_content.js
@@ -0,0 +1,16 @@
+import { mapState } from 'vuex'
+import NavigationEntry from 'src/components/navigation/navigation_entry.vue'
+import { getBookmarkFolderEntries } from 'src/components/navigation/filter.js'
+
+export const BookmarkFoldersMenuContent = {
+ components: {
+ NavigationEntry
+ },
+ computed: {
+ ...mapState({
+ folders: getBookmarkFolderEntries
+ })
+ }
+}
+
+export default BookmarkFoldersMenuContent
diff --git a/src/components/bookmark_folders_menu/bookmark_folders_menu_content.vue b/src/components/bookmark_folders_menu/bookmark_folders_menu_content.vue
@@ -0,0 +1,19 @@
+<template>
+ <ul>
+ <NavigationEntry
+ :item="{
+ name: 'bookmarks',
+ routeObject: { name: 'bookmarks' },
+ label: 'nav.all_bookmarks',
+ icon: 'bookmark'
+ }"
+ />
+ <NavigationEntry
+ v-for="item in folders"
+ :key="item.id"
+ :item="item"
+ />
+ </ul>
+</template>
+
+<script src="./bookmark_folders_menu_content.js"></script>
diff --git a/src/components/bookmark_timeline/bookmark_timeline.js b/src/components/bookmark_timeline/bookmark_timeline.js
@@ -1,16 +1,31 @@
import Timeline from '../timeline/timeline.vue'
const Bookmarks = {
+ created () {
+ this.$store.commit('clearTimeline', { timeline: 'bookmarks' })
+ this.$store.dispatch('startFetchingTimeline', { timeline: 'bookmarks', bookmarkFolderId: this.folderId || null })
+ },
+ components: {
+ Timeline
+ },
computed: {
+ folderId () {
+ return this.$route.params.id
+ },
timeline () {
return this.$store.state.statuses.timelines.bookmarks
}
},
- components: {
- Timeline
+ watch: {
+ folderId () {
+ this.$store.commit('clearTimeline', { timeline: 'bookmarks' })
+ this.$store.dispatch('stopFetchingTimeline', 'bookmarks')
+ this.$store.dispatch('startFetchingTimeline', { timeline: 'bookmarks', bookmarkFolderId: this.folderId || null })
+ }
},
unmounted () {
this.$store.commit('clearTimeline', { timeline: 'bookmarks' })
+ this.$store.dispatch('stopFetchingTimeline', 'bookmarks')
}
}
diff --git a/src/components/bookmark_timeline/bookmark_timeline.vue b/src/components/bookmark_timeline/bookmark_timeline.vue
@@ -3,6 +3,7 @@
:title="$t('nav.bookmarks')"
:timeline="timeline"
:timeline-name="'bookmarks'"
+ :bookmark-folder-id="folderId"
/>
</template>
diff --git a/src/components/border.style.js b/src/components/border.style.js
@@ -5,7 +5,7 @@ export default {
defaultRules: [
{
directives: {
- textColor: '$mod(--parent, 10)',
+ textColor: '$mod(--parent 10)',
textAuto: 'no-auto'
}
}
diff --git a/src/components/button.style.js b/src/components/button.style.js
@@ -9,9 +9,9 @@ export default {
// However, cascading still works, so resulting state will be result of merging of all relevant states/variants
// normal: '' // normal state is implicitly added, it is always included
toggled: '.toggled',
- pressed: ':active',
+ focused: ':focus-visible',
+ pressed: ':focus:active',
hover: ':hover:not(:disabled)',
- focused: ':focus-within',
disabled: ':disabled'
},
// Variants are mutually exclusive, each component implicitly has "normal" variant, and all other variants inherit from it.
@@ -22,6 +22,9 @@ export default {
// Overall the compuation difficulty is N*((1/6)M^3+M) where M is number of distinct states and N is number of variants.
// This (currently) is further multipled by number of places where component can exist.
},
+ editor: {
+ aspect: '2 / 1'
+ },
// This lists all other components that can possibly exist within one. Recursion is currently not supported (and probably won't be supported ever).
validInnerComponents: [
'Text',
@@ -32,10 +35,11 @@ export default {
{
component: 'Root',
directives: {
- '--defaultButtonHoverGlow': 'shadow | 0 0 4 --text',
- '--defaultButtonShadow': 'shadow | 0 0 2 #000000',
- '--defaultButtonBevel': 'shadow | $borderSide(#FFFFFF, top, 0.2) | $borderSide(#000000, bottom, 0.2)',
- '--pressedButtonBevel': 'shadow | $borderSide(#FFFFFF, bottom, 0.2)| $borderSide(#000000, top, 0.2)'
+ '--buttonDefaultHoverGlow': 'shadow | 0 0 4 --text / 0.5',
+ '--buttonDefaultFocusGlow': 'shadow | 0 0 4 4 --link / 0.5',
+ '--buttonDefaultShadow': 'shadow | 0 0 2 #000000',
+ '--buttonDefaultBevel': 'shadow | $borderSide(#FFFFFF top 0.2 2), $borderSide(#000000 bottom 0.2 2)',
+ '--buttonPressedBevel': 'shadow | $borderSide(#FFFFFF bottom 0.2 2), $borderSide(#000000 top 0.2 2)'
}
},
{
@@ -43,47 +47,60 @@ export default {
// like within it
directives: {
background: '--fg',
- shadow: ['--defaultButtonShadow', '--defaultButtonBevel'],
+ shadow: ['--buttonDefaultShadow', '--buttonDefaultBevel'],
roundness: 3
}
},
{
state: ['hover'],
directives: {
- shadow: ['--defaultButtonHoverGlow', '--defaultButtonBevel']
+ shadow: ['--buttonDefaultHoverGlow', '--buttonDefaultBevel']
+ }
+ },
+ {
+ state: ['focused'],
+ directives: {
+ shadow: ['--buttonDefaultFocusGlow', '--buttonDefaultBevel']
}
},
{
state: ['pressed'],
directives: {
- shadow: ['--defaultButtonShadow', '--pressedButtonBevel']
+ shadow: ['--buttonDefaultShadow', '--buttonPressedBevel']
}
},
{
- state: ['hover', 'pressed'],
+ state: ['pressed', 'hover'],
directives: {
- shadow: ['--defaultButtonHoverGlow', '--pressedButtonBevel']
+ shadow: ['--buttonPressedBevel', '--buttonDefaultHoverGlow']
}
},
{
state: ['toggled'],
directives: {
background: '--inheritedBackground,-14.2',
- shadow: ['--defaultButtonShadow', '--pressedButtonBevel']
+ shadow: ['--buttonDefaultShadow', '--buttonPressedBevel']
}
},
{
state: ['toggled', 'hover'],
directives: {
background: '--inheritedBackground,-14.2',
- shadow: ['--defaultButtonHoverGlow', '--pressedButtonBevel']
+ shadow: ['--buttonDefaultHoverGlow', '--buttonPressedBevel']
+ }
+ },
+ {
+ state: ['toggled', 'disabled'],
+ directives: {
+ background: '$blend(--inheritedBackground 0.25 --parent)',
+ shadow: ['--buttonPressedBevel']
}
},
{
state: ['disabled'],
directives: {
- background: '$blend(--inheritedBackground, 0.25, --parent)',
- shadow: ['--defaultButtonBevel']
+ background: '$blend(--inheritedBackground 0.25 --parent)',
+ shadow: ['--buttonDefaultBevel']
}
},
{
@@ -96,6 +113,17 @@ export default {
textOpacity: 0.25,
textOpacityMode: 'blend'
}
+ },
+ {
+ component: 'Icon',
+ parent: {
+ component: 'Button',
+ state: ['disabled']
+ },
+ directives: {
+ textOpacity: 0.25,
+ textOpacityMode: 'blend'
+ }
}
]
}
diff --git a/src/components/button_unstyled.style.js b/src/components/button_unstyled.style.js
@@ -1,6 +1,7 @@
export default {
name: 'ButtonUnstyled',
selector: '.button-unstyled',
+ notEditable: true,
states: {
toggled: '.toggled',
disabled: ':disabled',
diff --git a/src/components/chat_list/chat_list.vue b/src/components/chat_list/chat_list.vue
@@ -7,9 +7,9 @@
class="chat-list panel panel-default"
>
<div class="panel-heading -sticky">
- <span class="title">
+ <h1 class="title">
{{ $t("chats.chats") }}
- </span>
+ </h1>
<button
class="button-default"
@click="newChat"
diff --git a/src/components/chat_title/chat_title.vue b/src/components/chat_title/chat_title.vue
@@ -32,7 +32,7 @@
text-overflow: ellipsis;
white-space: nowrap;
- --emoji-size: 14px;
+ --emoji-size: 1em;
.username {
max-width: 100%;
diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue
@@ -3,6 +3,13 @@
class="checkbox"
:class="{ disabled, indeterminate, 'indeterminate-fix': indeterminateTransitionFix }"
>
+ <span
+ v-if="!!$slots.before"
+ class="label -before"
+ :class="{ faint: disabled }"
+ >
+ <slot name="before" />
+ </span>
<input
type="checkbox"
class="visible-for-screenreader-only"
@@ -14,11 +21,13 @@
<i
class="input -checkbox checkbox-indicator"
:aria-hidden="true"
+ :class="{ disabled }"
@transitionend.capture="onTransitionEnd"
/>
<span
v-if="!!$slots.default"
- class="label"
+ class="label -after"
+ :class="{ faint: disabled }"
>
<slot />
</span>
@@ -61,21 +70,26 @@ export default {
display: inline-block;
min-height: 1.2em;
+ &-indicator,
+ & .label {
+ vertical-align: middle;
+ }
+
& > &-indicator {
/* Reset .input stuff */
padding: 0;
margin: 0;
position: relative;
line-height: inherit;
- display: inline;
- padding-left: 1.2em;
+ display: inline-block;
+ width: 1.2em;
+ height: 1.2em;
box-shadow: none;
}
&-indicator::before {
position: absolute;
- right: 0;
- top: 0;
+ inset: 0;
display: block;
content: "✓";
transition: color 200ms;
@@ -93,14 +107,9 @@ export default {
box-sizing: border-box;
}
- &.disabled {
- .checkbox-indicator::before,
- .label {
- opacity: 0.5;
- }
-
- .label {
- color: var(--text);
+ .disabled {
+ .checkbox-indicator::before {
+ background-color: var(--background);
}
}
@@ -121,8 +130,14 @@ export default {
}
}
- & > span {
- margin-left: 0.5em;
+ & > .label {
+ &.-after {
+ margin-left: 0.5em;
+ }
+
+ &.-before {
+ margin-right: 0.5em;
+ }
}
}
</style>
diff --git a/src/components/color_input/color_input.scss b/src/components/color_input/color_input.scss
@@ -1,12 +1,19 @@
.color-input {
display: inline-flex;
+ .label {
+ flex: 1 1 auto;
+ }
+
+ .opt {
+ margin-right: 0.5em;
+ }
+
&-field.input {
display: inline-flex;
flex: 0 0 0;
max-width: 9em;
align-items: stretch;
- padding: 0.2em 8px;
input {
color: var(--text);
@@ -25,6 +32,7 @@
.nativeColor {
cursor: pointer;
flex: 0 0 auto;
+ padding: 0;
input {
appearance: none;
@@ -41,10 +49,10 @@
.invalidIndicator,
.transparentIndicator {
flex: 0 0 2em;
- margin: 0 0.5em;
+ margin: 0.2em 0.5em;
min-width: 2em;
align-self: stretch;
- min-height: 1.5em;
+ min-height: 1.1em;
border-radius: var(--roundness);
}
@@ -81,9 +89,17 @@
border-bottom-right-radius: var(--roundness);
}
}
- }
- .label {
- flex: 1 1 auto;
+ &.disabled,
+ &:disabled {
+ .nativeColor input,
+ .computedIndicator,
+ .validIndicator,
+ .invalidIndicator,
+ .transparentIndicator {
+ /* stylelint-disable-next-line declaration-no-important */
+ opacity: 0.25 !important;
+ }
+ }
}
}
diff --git a/src/components/color_input/color_input.vue b/src/components/color_input/color_input.vue
@@ -6,24 +6,29 @@
<label
:for="name"
class="label"
+ :class="{ faint: !present || disabled }"
>
{{ label }}
</label>
<Checkbox
- v-if="typeof fallback !== 'undefined' && showOptionalTickbox"
+ v-if="typeof fallback !== 'undefined' && showOptionalCheckbox && !hideOptionalCheckbox"
:model-value="present"
:disabled="disabled"
class="opt"
- @update:modelValue="$emit('update:modelValue', typeof modelValue === 'undefined' ? fallback : undefined)"
+ @update:modelValue="updateValue(typeof modelValue === 'undefined' ? fallback : undefined)"
/>
- <div class="input color-input-field">
+ <div
+ class="input color-input-field"
+ :class="{ disabled: !present || disabled }"
+ >
<input
:id="name + '-t'"
class="textColor unstyled"
+ :class="{ disabled: !present || disabled }"
type="text"
:value="modelValue || fallback"
:disabled="!present || disabled"
- @input="$emit('update:modelValue', $event.target.value)"
+ @input="updateValue($event.target.value)"
>
<div
v-if="validColor"
@@ -51,7 +56,8 @@
type="color"
:value="modelValue || fallback"
:disabled="!present || disabled"
- @input="$emit('update:modelValue', $event.target.value)"
+ :class="{ disabled: !present || disabled }"
+ @input="updateValue($event.target.value)"
>
</label>
</div>
@@ -60,6 +66,7 @@
<script>
import Checkbox from '../checkbox/checkbox.vue'
import { hex2rgb } from '../../services/color_convert/color_convert.js'
+import { throttle } from 'lodash'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
@@ -105,10 +112,16 @@ export default {
default: false
},
// Show "optional" tickbox, for when value might become mandatory
- showOptionalTickbox: {
+ showOptionalCheckbox: {
required: false,
type: Boolean,
default: true
+ },
+ // Force "optional" tickbox to hide
+ hideOptionalCheckbox: {
+ required: false,
+ type: Boolean,
+ default: false
}
},
emits: ['update:modelValue'],
@@ -123,8 +136,13 @@ export default {
return this.modelValue === 'transparent'
},
computedColor () {
- return this.modelValue && this.modelValue.startsWith('--')
+ return this.modelValue && (this.modelValue.startsWith('--') || this.modelValue.startsWith('$'))
}
+ },
+ methods: {
+ updateValue: throttle(function (value) {
+ this.$emit('update:modelValue', value)
+ }, 100)
}
}
</script>
diff --git a/src/components/component_preview/component_preview.vue b/src/components/component_preview/component_preview.vue
@@ -0,0 +1,323 @@
+<template>
+ <div
+ class="ComponentPreview"
+ :class="{ '-shadow-controls': shadowControl }"
+ >
+ <!-- eslint-disable vue/no-v-html vue/no-v-text-v-html-on-component -->
+ <component
+ :is="'style'"
+ v-html="previewCss"
+ />
+ <!-- eslint-enable vue/no-v-html vue/no-v-text-v-html-on-component -->
+ <label
+ v-show="shadowControl"
+ role="heading"
+ class="header"
+ :class="{ faint: disabled }"
+ >
+ {{ $t('settings.style.shadows.offset') }}
+ </label>
+ <label
+ v-show="shadowControl && !hideControls"
+ class="x-shift-number"
+ >
+ {{ $t('settings.style.shadows.offset-x') }}
+ <input
+ :value="shadow?.x"
+ :disabled="disabled"
+ :class="{ disabled }"
+ class="input input-number"
+ type="number"
+ @input="e => updateProperty('x', e.target.value)"
+ >
+ </label>
+ <label
+ v-show="shadowControl && !hideControls"
+ class="y-shift-number"
+ >
+ {{ $t('settings.style.shadows.offset-y') }}
+ <input
+ :value="shadow?.y"
+ :disabled="disabled"
+ :class="{ disabled }"
+ class="input input-number"
+ type="number"
+ @input="e => updateProperty('y', e.target.value)"
+ >
+ </label>
+ <input
+ v-show="shadowControl && !hideControls"
+ :value="shadow?.x"
+ :disabled="disabled"
+ :class="{ disabled }"
+ class="input input-range x-shift-slider"
+ type="range"
+ max="20"
+ min="-20"
+ @input="e => updateProperty('x', e.target.value)"
+ >
+ <input
+ v-show="shadowControl && !hideControls"
+ :value="shadow?.y"
+ :disabled="disabled"
+ :class="{ disabled }"
+ class="input input-range y-shift-slider"
+ type="range"
+ max="20"
+ min="-20"
+ @input="e => updateProperty('y', e.target.value)"
+ >
+ <div
+ class="preview-window"
+ :class="{ '-light-grid': lightGrid }"
+ >
+ <div
+ class="preview-block"
+ :class="previewClass"
+ :style="style"
+ >
+ {{ $t('settings.style.themes3.editor.test_string') }}
+ </div>
+ <div
+ v-if="invalid"
+ class="invalid-container"
+ >
+ <div class="alert error invalid-label">
+ {{ $t('settings.style.themes3.editor.invalid') }}
+ </div>
+ </div>
+ </div>
+ <div class="assists">
+ <Checkbox
+ v-model="lightGrid"
+ name="lightGrid"
+ class="input-light-grid"
+ >
+ {{ $t('settings.style.shadows.light_grid') }}
+ </Checkbox>
+ <div class="style-control">
+ <label class="label">
+ {{ $t('settings.style.shadows.zoom') }}
+ </label>
+ <input
+ v-model="zoom"
+ class="input input-number y-shift-number"
+ type="number"
+ >
+ </div>
+ <ColorInput
+ v-if="!noColorControl"
+ v-model="colorOverride"
+ class="input-color-input"
+ fallback="#606060"
+ :label="$t('settings.style.shadows.color_override')"
+ />
+ </div>
+ </div>
+</template>
+
+<script>
+import Checkbox from 'src/components/checkbox/checkbox.vue'
+import ColorInput from 'src/components/color_input/color_input.vue'
+
+export default {
+ components: {
+ Checkbox,
+ ColorInput
+ },
+ props: [
+ 'shadow',
+ 'shadowControl',
+ 'previewClass',
+ 'previewStyle',
+ 'previewCss',
+ 'disabled',
+ 'invalid',
+ 'noColorControl'
+ ],
+ emits: ['update:shadow'],
+ data () {
+ return {
+ colorOverride: undefined,
+ lightGrid: false,
+ zoom: 100
+ }
+ },
+ computed: {
+ style () {
+ const result = [
+ this.previewStyle,
+ `zoom: ${this.zoom / 100}`
+ ]
+ if (this.colorOverride) result.push(`--background: ${this.colorOverride}`)
+ return result
+ },
+ hideControls () {
+ return typeof this.shadow === 'string'
+ }
+ },
+ methods: {
+ updateProperty (axis, value) {
+ this.$emit('update:shadow', { axis, value: Number(value) })
+ }
+ }
+}
+</script>
+<style lang="scss">
+.ComponentPreview {
+ display: grid;
+ grid-template-columns: 1em 1fr 1fr 1em;
+ grid-template-rows: 2em 1fr 1fr 1fr 1em 2em max-content;
+ grid-template-areas:
+ "header header header header "
+ "preview preview preview y-slide"
+ "preview preview preview y-slide"
+ "preview preview preview y-slide"
+ "x-slide x-slide x-slide . "
+ "x-num x-num y-num y-num "
+ "assists assists assists assists";
+ grid-gap: 0.5em;
+
+ &:not(.-shadow-controls) {
+ grid-template-areas:
+ "header header header header "
+ "preview preview preview y-slide"
+ "preview preview preview y-slide"
+ "preview preview preview y-slide"
+ "assists assists assists assists";
+ grid-template-rows: 2em 1fr 1fr 1fr max-content;
+ }
+
+ .header {
+ grid-area: header;
+ justify-self: center;
+ align-self: baseline;
+ line-height: 2;
+ }
+
+ .invalid-container {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: grid;
+ align-items: center;
+ justify-items: center;
+ background-color: rgba(100 0 0 / 50%);
+
+ .alert {
+ padding: 0.5em 1em;
+ }
+ }
+
+ .assists {
+ grid-area: assists;
+ display: grid;
+ grid-auto-flow: rows;
+ grid-auto-rows: 2em;
+ grid-gap: 0.5em;
+ }
+
+ .input-light-grid {
+ justify-self: center;
+ }
+
+ .input-number {
+ min-width: 2em;
+ }
+
+ .x-shift-number {
+ grid-area: x-num;
+ justify-self: right;
+ }
+
+ .y-shift-number {
+ grid-area: y-num;
+ justify-self: left;
+ }
+
+ .x-shift-number,
+ .y-shift-number {
+ input {
+ max-width: 4em;
+ }
+ }
+
+ .x-shift-slider {
+ grid-area: x-slide;
+ height: auto;
+ align-self: start;
+ min-width: 10em;
+ }
+
+ .y-shift-slider {
+ grid-area: y-slide;
+ writing-mode: vertical-lr;
+ justify-self: left;
+ min-height: 10em;
+ }
+
+ .x-shift-slider,
+ .y-shift-slider {
+ padding: 0;
+ }
+
+ .preview-window {
+ --__grid-color1: rgb(102 102 102);
+ --__grid-color2: rgb(153 153 153);
+ --__grid-color1-disabled: rgba(102 102 102 / 20%);
+ --__grid-color2-disabled: rgba(153 153 153 / 20%);
+
+ &.-light-grid {
+ --__grid-color1: rgb(205 205 205);
+ --__grid-color2: rgb(255 255 255);
+ --__grid-color1-disabled: rgba(205 205 205 / 20%);
+ --__grid-color2-disabled: rgba(255 255 255 / 20%);
+ }
+
+ position: relative;
+ grid-area: preview;
+ aspect-ratio: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ min-width: 10em;
+ min-height: 10em;
+ background-color: var(--__grid-color2);
+ background-image:
+ linear-gradient(45deg, var(--__grid-color1) 25%, transparent 25%),
+ linear-gradient(-45deg, var(--__grid-color1) 25%, transparent 25%),
+ linear-gradient(45deg, transparent 75%, var(--__grid-color1) 75%),
+ linear-gradient(-45deg, transparent 75%, var(--__grid-color1) 75%);
+ background-size: 20px 20px;
+ background-position: 0 0, 0 10px, 10px -10px, -10px 0;
+ border-radius: var(--roundness);
+
+ &.disabled {
+ background-color: var(--__grid-color2-disabled);
+ background-image:
+ linear-gradient(45deg, var(--__grid-color1-disabled) 25%, transparent 25%),
+ linear-gradient(-45deg, var(--__grid-color1-disabled) 25%, transparent 25%),
+ linear-gradient(45deg, transparent 75%, var(--__grid-color1-disabled) 75%),
+ linear-gradient(-45deg, transparent 75%, var(--__grid-color1-disabled) 75%);
+ }
+
+ .preview-block {
+ background: var(--background, var(--bg));
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-width: 33%;
+ min-height: 33%;
+ max-width: 80%;
+ max-height: 80%;
+ border-width: 0;
+ border-style: solid;
+ border-color: var(--border);
+ border-radius: var(--roundness);
+ box-shadow: var(--shadow);
+ }
+ }
+}
+</style>
diff --git a/src/components/contrast_ratio/contrast_ratio.vue b/src/components/contrast_ratio/contrast_ratio.vue
@@ -3,39 +3,62 @@
v-if="contrast"
class="contrast-ratio"
>
- <span
- :title="hint"
+ <span v-if="showRatio">
+ {{ contrast.text }}
+ </span>
+ <Tooltip
+ :text="hint"
class="rating"
>
<span v-if="contrast.aaa">
- <FAIcon icon="thumbs-up" />
+ <FAIcon
+ icon="thumbs-up"
+ :size="showRatio ? 'lg' : ''"
+ />
</span>
<span v-if="!contrast.aaa && contrast.aa">
- <FAIcon icon="adjust" />
+ <FAIcon
+ icon="adjust"
+ :size="showRatio ? 'lg' : ''"
+ />
</span>
<span v-if="!contrast.aaa && !contrast.aa">
- <FAIcon icon="exclamation-triangle" />
+ <FAIcon
+ icon="exclamation-triangle"
+ :size="showRatio ? 'lg' : ''"
+ />
</span>
- </span>
- <span
+ </Tooltip>
+ <Tooltip
v-if="contrast && large"
+ :text="hint_18pt"
class="rating"
- :title="hint_18pt"
>
<span v-if="contrast.laaa">
- <FAIcon icon="thumbs-up" />
+ <FAIcon
+ icon="thumbs-up"
+ :size="showRatio ? 'large' : ''"
+ />
</span>
<span v-if="!contrast.laaa && contrast.laa">
- <FAIcon icon="adjust" />
+ <FAIcon
+ icon="adjust"
+ :size="showRatio ? 'lg' : ''"
+ />
</span>
<span v-if="!contrast.laaa && !contrast.laa">
- <FAIcon icon="exclamation-triangle" />
+ <FAIcon
+ icon="exclamation-triangle"
+ :size="showRatio ? 'lg' : ''"
+ />
</span>
- </span>
+ </Tooltip>
</span>
</template>
<script>
+import Tooltip from 'src/components/tooltip/tooltip.vue'
+
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faAdjust,
@@ -50,6 +73,9 @@ library.add(
)
export default {
+ components: {
+ Tooltip
+ },
props: {
large: {
required: false,
@@ -62,6 +88,11 @@ export default {
required: false,
type: Object,
default: () => ({})
+ },
+ showRatio: {
+ required: false,
+ type: Boolean,
+ default: false
}
},
computed: {
@@ -87,8 +118,7 @@ export default {
.contrast-ratio {
display: flex;
justify-content: flex-end;
- margin-top: -4px;
- margin-bottom: 5px;
+ align-items: baseline;
.label {
margin-right: 1em;
@@ -96,7 +126,6 @@ export default {
.rating {
display: inline-block;
- text-align: center;
margin-left: 0.5em;
}
}
diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue
@@ -9,7 +9,9 @@
v-if="isExpanded"
class="panel-heading conversation-heading -sticky"
>
- <span class="title"> {{ $t('timeline.conversation') }} </span>
+ <h1 class="title">
+ {{ $t('timeline.conversation') }}
+ </h1>
<button
v-if="collapsable"
class="button-unstyled -link"
diff --git a/src/components/dialog_modal/dialog_modal.vue b/src/components/dialog_modal/dialog_modal.vue
@@ -8,9 +8,9 @@
@click.stop=""
>
<div class="panel-heading dialog-modal-heading">
- <div class="title">
+ <h1 class="title">
<slot name="header" />
- </div>
+ </h1>
</div>
<div class="panel-body dialog-modal-content">
<slot name="default" />
diff --git a/src/components/edit_status_modal/edit_status_modal.vue b/src/components/edit_status_modal/edit_status_modal.vue
@@ -6,7 +6,9 @@
>
<div class="edit-form-modal-panel panel">
<div class="panel-heading">
- {{ $t('post_status.edit_status') }}
+ <h1 class="title">
+ {{ $t('post_status.edit_status') }}
+ </h1>
</div>
<EditStatusForm
ref="editStatusForm"
diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js
@@ -97,7 +97,7 @@ const EmojiPicker = {
enableStickerPicker: {
required: false,
type: Boolean,
- default: false
+ default: true
},
hideCustomEmoji: {
required: false,
@@ -105,7 +105,11 @@ const EmojiPicker = {
default: false
}
},
- inject: ['popoversZLayer'],
+ inject: {
+ popoversZLayer: {
+ default: ''
+ }
+ },
data () {
return {
keyword: '',
@@ -150,7 +154,9 @@ const EmojiPicker = {
},
showPicker () {
this.$refs.popover.showPopover()
- this.onShowing()
+ this.$nextTick(() => {
+ this.onShowing()
+ })
},
hidePicker () {
this.$refs.popover.hidePopover()
@@ -178,7 +184,7 @@ const EmojiPicker = {
if (!this.keepOpen) {
this.$refs.popover.hidePopover()
}
- this.$emit('emoji', { insertion: value, keepOpen: this.keepOpen })
+ this.$emit('emoji', { insertion: value, insertionUrl: emoji.imageUrl, keepOpen: this.keepOpen })
},
onScroll (startIndex, endIndex, visibleStartIndex, visibleEndIndex) {
const target = this.$refs['emoji-groups'].$el
diff --git a/src/components/emoji_picker/emoji_picker.vue b/src/components/emoji_picker/emoji_picker.vue
@@ -89,6 +89,7 @@
class="emoji-groups"
:class="groupsScrolledClass"
:min-item-size="minItemSize"
+ :buffer="minItemSize"
:items="emojiItems"
:emit-update="true"
@update="onScroll"
diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
@@ -1,6 +1,7 @@
import Popover from '../popover/popover.vue'
import genRandomSeed from '../../services/random_seed/random_seed.service.js'
import ConfirmModal from '../confirm_modal/confirm_modal.vue'
+import StatusBookmarkFolderMenu from '../status_bookmark_folder_menu/status_bookmark_folder_menu.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
faEllipsisH,
@@ -36,7 +37,8 @@ const ExtraButtons = {
props: ['status'],
components: {
Popover,
- ConfirmModal
+ ConfirmModal,
+ StatusBookmarkFolderMenu
},
data () {
return {
@@ -145,6 +147,9 @@ const ExtraButtons = {
canBookmark () {
return !!this.currentUser
},
+ bookmarkFolders () {
+ return this.$store.state.instance.pleromaBookmarkFoldersAvailable
+ },
statusLink () {
return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}`
},
diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue
@@ -87,6 +87,10 @@
icon="bookmark"
/><span>{{ $t("status.unbookmark") }}</span>
</button>
+ <StatusBookmarkFolderMenu
+ v-if="status.bookmarked && bookmarkFolders"
+ :status="status"
+ />
</template>
<button
v-if="ownStatus && editingAvailable"
diff --git a/src/components/extra_notifications/extra_notifications.vue b/src/components/extra_notifications/extra_notifications.vue
@@ -56,6 +56,7 @@
tag="span"
class="notification tip extra-notification"
keypath="notifications.configuration_tip"
+ scope="global"
>
<template #theSettings>
<button
diff --git a/src/components/features_panel/features_panel.vue b/src/components/features_panel/features_panel.vue
@@ -2,9 +2,9 @@
<div class="features-panel">
<div class="panel panel-default base01-background">
<div class="panel-heading timeline-heading base02-background base04">
- <div class="title">
+ <h1 class="title">
{{ $t('features_panel.title') }}
- </div>
+ </h1>
</div>
<div class="panel-body features-panel">
<ul>
diff --git a/src/components/follow_button/follow_button.vue b/src/components/follow_button/follow_button.vue
@@ -17,6 +17,7 @@
@cancelled="hideConfirmUnfollow"
>
<i18n-t
+ scope="global"
keypath="user_card.unfollow_confirm"
tag="span"
>
diff --git a/src/components/follow_requests/follow_requests.vue b/src/components/follow_requests/follow_requests.vue
@@ -1,9 +1,9 @@
<template>
<div class="settings panel panel-default">
<div class="panel-heading">
- <div class="title">
+ <h1 class="title">
{{ $t('nav.friend_requests') }}
- </div>
+ </h1>
</div>
<div class="panel-body">
<FollowRequestCard
diff --git a/src/components/font_control/font_control.vue b/src/components/font_control/font_control.vue
@@ -1,11 +1,8 @@
<template>
- <div
- class="font-control"
- :class="{ custom: isCustom }"
- >
+ <div class="font-control">
<label
:id="name + '-label'"
- :for="preset === 'custom' ? name : name + '-font-switcher'"
+ :for="manualEntry ? name : name + '-font-switcher'"
class="label"
>
{{ label }}
@@ -14,7 +11,7 @@
<Checkbox
v-if="typeof fallback !== 'undefined'"
:id="name + '-o'"
- :modelValue="present"
+ :model-value="present"
@change="$emit('update:modelValue', typeof modelValue === 'undefined' ? fallback : undefined)"
>
{{ $t('settings.style.themes3.define') }}
@@ -23,12 +20,13 @@
<label
v-if="manualEntry"
:id="name + '-label'"
- :for="preset === 'custom' ? name : name + '-font-switcher'"
+ :for="manualEntry ? name : name + '-font-switcher'"
class="label"
>
<i18n-t
keypath="settings.style.themes3.font.entry"
tag="span"
+ scope="global"
>
<template #fontFamily>
<code>font-family</code>
@@ -38,7 +36,7 @@
<label
v-else
:id="name + '-label'"
- :for="preset === 'custom' ? name : name + '-font-switcher'"
+ :for="manualEntry ? name : name + '-font-switcher'"
class="label"
>
{{ $t('settings.style.themes3.font.select') }}
@@ -50,8 +48,8 @@
>
<button
class="btn button-default"
- @click="toggleManualEntry"
:title="$t('settings.style.themes3.font.lookup_local_fonts')"
+ @click="toggleManualEntry"
>
<FAIcon
fixed-width
@@ -72,8 +70,8 @@
>
<button
class="btn button-default"
- @click="toggleManualEntry"
:title="$t('settings.style.themes3.font.enter_manually')"
+ @click="toggleManualEntry"
>
<FAIcon
fixed-width
diff --git a/src/components/icon.style.js b/src/components/icon.style.js
@@ -6,7 +6,7 @@ export default {
{
component: 'Icon',
directives: {
- textColor: '$blend(--stack, 0.5, --parent--text)',
+ textColor: '$blend(--stack 0.5 --parent--text)',
textAuto: 'no-auto'
}
}
diff --git a/src/components/input.style.js b/src/components/input.style.js
@@ -1,32 +1,26 @@
-const hoverGlow = {
- x: 0,
- y: 0,
- blur: 4,
- spread: 0,
- color: '--text',
- alpha: 1
-}
-
export default {
name: 'Input',
selector: '.input',
- variant: {
+ states: {
+ hover: ':hover:not(.disabled)',
+ focused: ':focus-within',
+ disabled: '.disabled'
+ },
+ variants: {
checkbox: '.-checkbox',
radio: '.-radio'
},
- states: {
- disabled: ':disabled',
- hover: ':hover:not(:disabled)',
- focused: ':focus-within'
- },
validInnerComponents: [
- 'Text'
+ 'Text',
+ 'Icon'
],
defaultRules: [
{
component: 'Root',
directives: {
- '--defaultInputBevel': 'shadow | $borderSide(#FFFFFF, bottom, 0.2)| $borderSide(#000000, top, 0.2)'
+ '--defaultInputBevel': 'shadow | $borderSide(#FFFFFF bottom 0.2), $borderSide(#000000 top 0.2)',
+ '--defaultInputHoverGlow': 'shadow | 0 0 4 --text / 0.5',
+ '--defaultInputFocusGlow': 'shadow | 0 0 4 4 --link / 0.5'
}
},
{
@@ -53,7 +47,47 @@ export default {
{
state: ['hover'],
directives: {
- shadow: [hoverGlow, '--defaultInputBevel']
+ shadow: ['--defaultInputHoverGlow', '--defaultInputBevel']
+ }
+ },
+ {
+ state: ['focused'],
+ directives: {
+ shadow: ['--defaultInputFocusGlow', '--defaultInputBevel']
+ }
+ },
+ {
+ state: ['focused', 'hover'],
+ directives: {
+ shadow: ['--defaultInputFocusGlow', '--defaultInputHoverGlow', '--defaultInputBevel']
+ }
+ },
+ {
+ state: ['disabled'],
+ directives: {
+ background: '--parent'
+ }
+ },
+ {
+ component: 'Text',
+ parent: {
+ component: 'Input',
+ state: ['disabled']
+ },
+ directives: {
+ textOpacity: 0.25,
+ textOpacityMode: 'blend'
+ }
+ },
+ {
+ component: 'Icon',
+ parent: {
+ component: 'Input',
+ state: ['disabled']
+ },
+ directives: {
+ textOpacity: 0.25,
+ textOpacityMode: 'blend'
}
}
]
diff --git a/src/components/interactions/interactions.vue b/src/components/interactions/interactions.vue
@@ -1,9 +1,9 @@
<template>
<div class="panel panel-default">
<div class="panel-heading">
- <div class="title">
+ <h1 class="title">
{{ $t("nav.interactions") }}
- </div>
+ </h1>
</div>
<tab-switcher
ref="tabSwitcher"
diff --git a/src/components/lists/lists.vue b/src/components/lists/lists.vue
@@ -2,7 +2,9 @@
<div class="Lists panel panel-default">
<div class="panel-heading">
<div class="title">
- {{ $t('lists.lists') }}
+ <h1 class="title">
+ {{ $t('lists.lists') }}
+ </h1>
</div>
<router-link
:to="{ name: 'lists-new' }"
diff --git a/src/components/lists_edit/lists_edit.vue b/src/components/lists_edit/lists_edit.vue
@@ -17,6 +17,7 @@
<i18n-t
v-if="id"
keypath="lists.editing_list"
+ scope="global"
>
<template #listTitle>
{{ title }}
@@ -25,6 +26,7 @@
<i18n-t
v-else
keypath="lists.creating_list"
+ scope="global"
/>
</div>
</div>
diff --git a/src/components/login_form/login_form.vue b/src/components/login_form/login_form.vue
@@ -3,7 +3,9 @@
<!-- Default panel contents -->
<div class="panel-heading">
- {{ $t('login.login') }}
+ <h1 class="title">
+ {{ $t('login.login') }}
+ </h1>
</div>
<div class="panel-body">
diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js
@@ -53,7 +53,9 @@ const MentionLink = {
this.$router.push(link)
},
handleSelection () {
- this.hasSelection = document.getSelection().containsNode(this.$refs.full, true)
+ if (this.$refs.full) {
+ this.hasSelection = document.getSelection().containsNode(this.$refs.full, true)
+ }
}
},
mounted () {
diff --git a/src/components/menu_item.style.js b/src/components/menu_item.style.js
@@ -24,21 +24,21 @@ export default {
{
state: ['hover'],
directives: {
- background: '$mod(--bg, 5)',
+ background: '$mod(--bg 5)',
opacity: 1
}
},
{
state: ['active'],
directives: {
- background: '$mod(--bg, 10)',
+ background: '$mod(--bg 10)',
opacity: 1
}
},
{
state: ['active', 'hover'],
directives: {
- background: '$mod(--bg, 15)',
+ background: '$mod(--bg 15)',
opacity: 1
}
},
diff --git a/src/components/mfa_form/recovery_form.vue b/src/components/mfa_form/recovery_form.vue
@@ -3,7 +3,9 @@
<!-- Default panel contents -->
<div class="panel-heading">
- {{ $t('login.heading.recovery') }}
+ <h1 class="title">
+ {{ $t('login.heading.recovery') }}
+ </h1>
</div>
<div class="panel-body">
diff --git a/src/components/mfa_form/totp_form.vue b/src/components/mfa_form/totp_form.vue
@@ -3,7 +3,9 @@
<!-- Default panel contents -->
<div class="panel-heading">
- {{ $t('login.heading.totp') }}
+ <h1 class="title">
+ {{ $t('login.heading.totp') }}
+ </h1>
</div>
<div class="panel-body">
diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue
@@ -50,13 +50,13 @@
@touchmove.stop="notificationsTouchMove"
>
<div class="panel-heading mobile-notifications-header">
- <span class="title">
+ <h1 class="title">
{{ $t('notifications.notifications') }}
<span
v-if="unseenCountBadgeText"
class="badge -notification unseen-count"
>{{ unseenCountBadgeText }}</span>
- </span>
+ </h1>
<span class="spacer" />
<button
v-if="notificationsAtTop"
diff --git a/src/components/modal/modals.style.js b/src/components/modal/modals.style.js
@@ -1,7 +1,8 @@
export default {
name: 'Modals',
- selector: '.modal-view',
+ selector: ['.modal-view', '#modal', '.shout-panel'],
lazy: true,
+ notEditable: true,
validInnerComponents: [
'Panel'
],
diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js
@@ -1,3 +1,4 @@
+import BookmarkFoldersMenuContent from 'src/components/bookmark_folders_menu/bookmark_folders_menu_content.vue'
import ListsMenuContent from 'src/components/lists_menu/lists_menu_content.vue'
import { mapState, mapGetters } from 'vuex'
import { TIMELINES, ROOT_ITEMS } from 'src/components/navigation/navigation.js'
@@ -43,6 +44,7 @@ const NavPanel = {
created () {
},
components: {
+ BookmarkFoldersMenuContent,
ListsMenuContent,
NavigationEntry,
NavigationPins,
@@ -53,6 +55,7 @@ const NavPanel = {
editMode: false,
showTimelines: false,
showLists: false,
+ showBookmarkFolders: false,
timelinesList: Object.entries(TIMELINES).map(([k, v]) => ({ ...v, name: k })),
rootList: Object.entries(ROOT_ITEMS).map(([k, v]) => ({ ...v, name: k }))
}
@@ -64,6 +67,9 @@ const NavPanel = {
toggleLists () {
this.showLists = !this.showLists
},
+ toggleBookmarkFolders () {
+ this.showBookmarkFolders = !this.showBookmarkFolders
+ },
toggleEditMode () {
this.editMode = !this.editMode
},
@@ -92,7 +98,8 @@ const NavPanel = {
pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable,
supportsAnnouncements: state => state.announcements.supportsAnnouncements,
pinnedItems: state => new Set(state.serverSideStorage.prefsStorage.collections.pinnedNavItems),
- collapsed: state => state.serverSideStorage.prefsStorage.simple.collapseNav
+ collapsed: state => state.serverSideStorage.prefsStorage.simple.collapseNav,
+ bookmarkFolders: state => state.instance.pleromaBookmarkFoldersAvailable
}),
timelinesItems () {
return filterNavigation(
@@ -104,7 +111,8 @@ const NavPanel = {
hasAnnouncements: this.supportsAnnouncements,
isFederating: this.federating,
isPrivate: this.privateMode,
- currentUser: this.currentUser
+ currentUser: this.currentUser,
+ supportsBookmarkFolders: this.bookmarkFolders
}
)
},
@@ -118,7 +126,8 @@ const NavPanel = {
hasAnnouncements: this.supportsAnnouncements,
isFederating: this.federating,
isPrivate: this.privateMode,
- currentUser: this.currentUser
+ currentUser: this.currentUser,
+ supportsBookmarkFolders: this.bookmarkFolders
}
)
},
diff --git a/src/components/nav_panel/nav_panel.vue b/src/components/nav_panel/nav_panel.vue
@@ -84,6 +84,39 @@
/>
</div>
<NavigationEntry
+ v-if="currentUser && bookmarkFolders"
+ :show-pin="false"
+ :item="{ icon: 'bookmark', label: 'nav.bookmarks' }"
+ :aria-expanded="showBookmarkFolders ? 'true' : 'false'"
+ @click="toggleBookmarkFolders"
+ >
+ <router-link
+ :title="$t('bookmarks.manage_bookmark_folders')"
+ class="button-unstyled extra-button"
+ :to="{ name: 'bookmark-folders' }"
+ @click.stop
+ >
+ <FAIcon
+ fixed-width
+ icon="wrench"
+ />
+ </router-link>
+ <FAIcon
+ class="timelines-chevron"
+ fixed-width
+ :icon="showBookmarkFolders ? 'chevron-up' : 'chevron-down'"
+ />
+ </NavigationEntry>
+ <div
+ v-show="showBookmarkFolders"
+ class="timelines-background menu-item-collapsible"
+ :class="{ '-expanded': showBookmarkFolders }"
+ >
+ <BookmarkFoldersMenuContent
+ class="timelines"
+ />
+ </div>
+ <NavigationEntry
v-for="item in rootItems"
:key="item.name"
:show-pin="editMode || forceEditMode"
@@ -92,7 +125,7 @@
<NavigationEntry
v-if="!forceEditMode && currentUser"
:show-pin="false"
- :item="{ label: editMode ? $t('nav.edit_finish') : $t('nav.edit_pinned'), icon: editMode ? 'check' : 'wrench' }"
+ :item="{ labelRaw: editMode ? $t('nav.edit_finish') : $t('nav.edit_pinned'), icon: editMode ? 'check' : 'wrench' }"
@click="toggleEditMode"
/>
</ul>
diff --git a/src/components/navigation/filter.js b/src/components/navigation/filter.js
@@ -1,4 +1,4 @@
-export const filterNavigation = (list = [], { hasChats, hasAnnouncements, isFederating, isPrivate, currentUser }) => {
+export const filterNavigation = (list = [], { hasChats, hasAnnouncements, isFederating, isPrivate, currentUser, supportsBookmarkFolders }) => {
return list.filter(({ criteria, anon, anonRoute }) => {
const set = new Set(criteria || [])
if (!isFederating && set.has('federating')) return false
@@ -7,6 +7,7 @@ export const filterNavigation = (list = [], { hasChats, hasAnnouncements, isFede
if ((!currentUser || !currentUser.locked) && set.has('lockedUser')) return false
if (!hasChats && set.has('chats')) return false
if (!hasAnnouncements && set.has('announcements')) return false
+ if (supportsBookmarkFolders && set.has('!supportsBookmarkFolders')) return false
return true
})
}
@@ -17,3 +18,12 @@ export const getListEntries = state => state.lists.allLists.map(list => ({
labelRaw: list.title,
iconLetter: list.title[0]
}))
+
+export const getBookmarkFolderEntries = state => state.bookmarkFolders.allFolders.map(folder => ({
+ name: 'bookmark-folder-' + folder.id,
+ routeObject: { name: 'bookmark-folder', params: { id: folder.id } },
+ labelRaw: folder.name,
+ iconEmoji: folder.emoji,
+ iconEmojiUrl: folder.emoji_url,
+ iconLetter: folder.name[0]
+}))
diff --git a/src/components/navigation/navigation.js b/src/components/navigation/navigation.js
@@ -1,11 +1,16 @@
+// routes that take :username property
export const USERNAME_ROUTES = new Set([
- 'bookmarks',
'dms',
'interactions',
'notifications',
'chat',
- 'chats',
- 'user-profile'
+ 'chats'
+])
+
+// routes that take :name property
+export const NAME_ROUTES = new Set([
+ 'user-profile',
+ 'legacy-user-profile'
])
export const TIMELINES = {
@@ -32,7 +37,8 @@ export const TIMELINES = {
bookmarks: {
route: 'bookmarks',
icon: 'bookmark',
- label: 'nav.bookmarks'
+ label: 'nav.bookmarks',
+ criteria: ['!supportsBookmarkFolders']
},
favorites: {
routeObject: { name: 'user-profile', query: { tab: 'favorites' } },
@@ -103,7 +109,9 @@ export function routeTo (item, currentUser) {
}
if (USERNAME_ROUTES.has(route.name)) {
- route.params = { username: currentUser.screen_name, name: currentUser.screen_name }
+ route.params = { username: currentUser.screen_name }
+ } else if (NAME_ROUTES.has(route.name)) {
+ route.params = { name: currentUser.screen_name }
}
return route
diff --git a/src/components/navigation/navigation_entry.vue b/src/components/navigation/navigation_entry.vue
@@ -22,11 +22,25 @@
:icon="item.icon"
/>
</span>
+ <img
+ v-if="item.iconEmojiUrl"
+ class="menu-icon iconEmoji iconEmoji-image"
+ :src="item.iconEmojiUrl"
+ :alt="item.iconEmoji"
+ :title="item.iconEmoji"
+ >
<span
- v-if="item.iconLetter"
- class="icon iconLetter fa-scale-110 menu-icon"
- >{{ item.iconLetter }}
+ v-else-if="item.iconEmoji"
+ class="menu-icon iconEmoji"
+ >
+ <span>
+ {{ item.iconEmoji }}
+ </span>
</span>
+ <span
+ v-else-if="item.iconLetter"
+ class="icon iconLetter fa-scale-110 menu-icon"
+ >{{ item.iconLetter }}</span>
<span class="label">
{{ item.labelRaw || $t(item.label) }}
</span>
@@ -111,5 +125,23 @@
.badge {
margin: 0 var(--__horizontal-gap);
}
+
+ .iconEmoji {
+ display: inline-block;
+ text-align: center;
+ object-fit: contain;
+ vertical-align: middle;
+ height: var(--__line-height);
+ width: var(--__line-height);
+
+ > span {
+ font-size: 1.5rem;
+ }
+ }
+
+ img.iconEmoji {
+ padding: 0.25rem;
+ box-sizing: border-box;
+ }
}
</style>
diff --git a/src/components/notification/notification.scss b/src/components/notification/notification.scss
@@ -10,7 +10,7 @@
background-color: transparent !important;
}
- --emoji-size: 14px;
+ --emoji-size: 1em;
&:hover {
--_still-image-img-visibility: visible;
@@ -26,6 +26,7 @@
overflow: hidden;
display: flex;
flex-wrap: nowrap;
+ gap: 1ex;
& .status-username,
& .mute-thread,
diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue
@@ -47,7 +47,6 @@
>
<UserAvatar
class="post-avatar"
- :bot="botIndicator"
:compact="true"
:better-shadow="betterShadow"
:user="notification.from_profile"
diff --git a/src/components/notifications/notifications.vue b/src/components/notifications/notifications.vue
@@ -14,13 +14,13 @@
v-if="!noHeading"
class="notifications-heading panel-heading -sticky"
>
- <div class="title">
+ <h1 class="title">
{{ $t('notifications.notifications') }}
<span
v-if="unseenCountBadgeText"
class="badge -notification unseen-count"
>{{ unseenCountBadgeText }}</span>
- </div>
+ </h1>
<div
v-if="showScrollTop"
class="rightside-button"
diff --git a/src/components/opacity_input/opacity_input.vue b/src/components/opacity_input/opacity_input.vue
@@ -6,8 +6,9 @@
<label
:for="name"
class="label"
+ :class="{ faint: !present || disabled }"
>
- {{ $t('settings.style.common.opacity') }}
+ {{ label }}
</label>
<Checkbox
v-if="typeof fallback !== 'undefined'"
@@ -22,6 +23,7 @@
type="number"
:value="modelValue || fallback"
:disabled="!present || disabled"
+ :class="{ disabled: !present || disabled }"
max="1"
min="0"
step=".05"
@@ -37,7 +39,7 @@ export default {
Checkbox
},
props: [
- 'name', 'modelValue', 'fallback', 'disabled'
+ 'name', 'label', 'modelValue', 'fallback', 'disabled'
],
emits: ['update:modelValue'],
computed: {
diff --git a/src/components/palette_editor/palette_editor.vue b/src/components/palette_editor/palette_editor.vue
@@ -0,0 +1,193 @@
+<template>
+ <div
+ class="PaletteEditor"
+ :class="{ '-compact': compact, '-apply': apply }"
+ >
+ <ColorInput
+ v-for="key in paletteKeys"
+ :key="key"
+ :name="key"
+ :model-value="props.modelValue[key]"
+ :fallback="fallback(key)"
+ :label="$t('settings.style.themes3.palette.' + key)"
+ @update:modelValue="value => updatePalette(key, value)"
+ />
+ <button
+ class="btn button-default palette-import-button"
+ @click="importPalette"
+ >
+ <FAIcon icon="file-import" />
+ {{ $t('settings.style.themes3.palette.import') }}
+ </button>
+ <button
+ class="btn button-default palette-export-button"
+ @click="exportPalette"
+ >
+ <FAIcon icon="file-export" />
+ {{ $t('settings.style.themes3.palette.export') }}
+ </button>
+ <button
+ v-if="apply"
+ class="btn button-default palette-apply-button"
+ @click="applyPalette"
+ >
+ {{ $t('settings.style.themes3.palette.apply') }}
+ </button>
+ </div>
+</template>
+
+<script setup>
+import ColorInput from 'src/components/color_input/color_input.vue'
+import {
+ newImporter,
+ newExporter
+} from 'src/services/export_import/export_import.js'
+
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faFileImport,
+ faFileExport
+} from '@fortawesome/free-solid-svg-icons'
+
+library.add(
+ faFileImport,
+ faFileExport
+)
+
+const paletteKeys = [
+ 'bg',
+ 'fg',
+ 'text',
+ 'link',
+ 'accent',
+ 'cRed',
+ 'cBlue',
+ 'cGreen',
+ 'cOrange',
+ 'wallpaper'
+]
+
+const props = defineProps(['modelValue', 'compact', 'apply'])
+const emit = defineEmits(['update:modelValue', 'applyPalette'])
+const getExportedObject = () => paletteKeys.reduce((acc, key) => {
+ const value = props.modelValue[key]
+ if (value == null) {
+ return acc
+ } else {
+ return { ...acc, [key]: props.modelValue[key] }
+ }
+}, {})
+
+const paletteExporter = newExporter({
+ filename: 'pleroma_palette',
+ extension: 'json',
+ getExportedObject
+})
+const paletteImporter = newImporter({
+ accept: '.json',
+ onImport (parsed, filename) {
+ emit('update:modelValue', parsed)
+ }
+})
+
+const exportPalette = () => {
+ paletteExporter.exportData()
+}
+
+const importPalette = () => {
+ paletteImporter.importData()
+}
+
+const applyPalette = (data) => {
+ emit('applyPalette', getExportedObject())
+}
+
+const fallback = (key) => {
+ if (key === 'accent') {
+ return props.modelValue.link
+ }
+ if (key === 'link') {
+ return props.modelValue.accent
+ }
+ if (key.startsWith('extra')) {
+ return '#FF00FF'
+ }
+ if (key.startsWith('wallpaper')) {
+ return '#008080'
+ }
+}
+
+const updatePalette = (paletteKey, value) => {
+ emit('update:modelValue', {
+ ...props.modelValue,
+ [paletteKey]: value
+ })
+}
+</script>
+
+<style lang="scss">
+.PaletteEditor {
+ display: grid;
+ justify-content: space-around;
+ grid-template-columns: repeat(4, 1fr);
+ grid-template-rows: repeat(5, 1fr) auto;
+ grid-gap: 0.5em;
+ align-items: baseline;
+
+ .palette-import-button {
+ grid-column: 1 / span 2;
+ }
+
+ .palette-export-button {
+ grid-column: 3 / span 2;
+ }
+
+ .palette-apply-button {
+ grid-column: 1 / span 2;
+ }
+
+ .color-input.style-control {
+ margin: 0;
+ }
+
+ &.-compact {
+ grid-template-columns: repeat(2, 1fr);
+ grid-template-rows: repeat(5, 1fr) auto;
+
+ .palette-import-button {
+ grid-column: 1;
+ }
+
+ .palette-export-button {
+ grid-column: 2;
+ }
+
+ &.-apply {
+ grid-template-rows: repeat(5, 1fr) auto auto;
+
+ .palette-apply-button {
+ grid-column: 1 / span 2;
+ }
+ }
+
+ .-mobile & {
+ grid-template-columns: 1fr;
+ grid-template-rows: repeat(10, 1fr) auto;
+
+ .palette-import-button {
+ grid-column: 1;
+ }
+
+ .palette-export-button {
+ grid-column: 1;
+ }
+
+ &.-apply {
+ .palette-apply-button {
+ grid-column: 1;
+ }
+ }
+ }
+ }
+}
+</style>
diff --git a/src/components/password_reset/password_reset.vue b/src/components/password_reset/password_reset.vue
@@ -1,7 +1,9 @@
<template>
<div class="settings panel panel-default">
<div class="panel-heading">
- {{ $t('password_reset.password_reset') }}
+ <h1 class="title">
+ {{ $t('password_reset.password_reset') }}
+ </h1>
</div>
<div class="panel-body">
<form
diff --git a/src/components/poll/poll.vue b/src/components/poll/poll.vue
@@ -76,6 +76,13 @@
>
{{ $t('polls.vote') }}
</button>
+ <span
+ v-if="poll.pleroma?.non_anonymous"
+ :title="$t('polls.non_anonymous_title')"
+ >
+ {{ $t('polls.non_anonymous') }}
+ ·
+ </span>
<div class="total">
<template v-if="typeof poll.voters_count === 'number'">
{{ $tc("polls.people_voted_count", poll.voters_count, { count: poll.voters_count }) }}
diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js
@@ -53,7 +53,11 @@ const Popover = {
default: {}
}
},
- inject: ['popoversZLayer'], // override popover z layer
+ inject: { // override popover z layer
+ popoversZLayer: {
+ default: ''
+ }
+ },
data () {
return {
// lockReEntry is a flag that is set when mouse cursor is leaving the popover's content
diff --git a/src/components/post_status_form/post_status_form.vue b/src/components/post_status_form/post_status_form.vue
@@ -103,6 +103,36 @@
icon="circle-notch"
/>
</div>
+ <div
+ v-if="quotable"
+ role="radiogroup"
+ class="btn-group reply-or-quote-selector"
+ >
+ <button
+ :id="`reply-or-quote-option-${randomSeed}-reply`"
+ class="btn button-default reply-or-quote-option"
+ :class="{ toggled: !newStatus.quoting }"
+ tabindex="0"
+ role="radio"
+ :aria-labelledby="`reply-or-quote-option-${randomSeed}-reply`"
+ :aria-checked="!newStatus.quoting"
+ @click="newStatus.quoting = false"
+ >
+ {{ $t('post_status.reply_option') }}
+ </button>
+ <button
+ :id="`reply-or-quote-option-${randomSeed}-quote`"
+ class="btn button-default reply-or-quote-option"
+ :class="{ toggled: newStatus.quoting }"
+ tabindex="0"
+ role="radio"
+ :aria-labelledby="`reply-or-quote-option-${randomSeed}-quote`"
+ :aria-checked="newStatus.quoting"
+ @click="newStatus.quoting = true"
+ >
+ {{ $t('post_status.quote_option') }}
+ </button>
+ </div>
</div>
<div
v-if="showPreview"
@@ -126,36 +156,6 @@
class="preview-status"
/>
</div>
- <div
- v-if="quotable"
- role="radiogroup"
- class="btn-group reply-or-quote-selector"
- >
- <button
- :id="`reply-or-quote-option-${randomSeed}-reply`"
- class="btn button-default reply-or-quote-option"
- :class="{ toggled: !newStatus.quoting }"
- tabindex="0"
- role="radio"
- :aria-labelledby="`reply-or-quote-option-${randomSeed}-reply`"
- :aria-checked="!newStatus.quoting"
- @click="newStatus.quoting = false"
- >
- {{ $t('post_status.reply_option') }}
- </button>
- <button
- :id="`reply-or-quote-option-${randomSeed}-quote`"
- class="btn button-default reply-or-quote-option"
- :class="{ toggled: newStatus.quoting }"
- tabindex="0"
- role="radio"
- :aria-labelledby="`reply-or-quote-option-${randomSeed}-quote`"
- :aria-checked="newStatus.quoting"
- @click="newStatus.quoting = true"
- >
- {{ $t('post_status.quote_option') }}
- </button>
- </div>
<EmojiInput
v-if="!disableSubject && (newStatus.spoilerText || alwaysShowSubject)"
v-model="newStatus.spoilerText"
@@ -181,10 +181,10 @@
:suggest="emojiUserSuggestor"
:placement="emojiPickerPlacement"
class="input form-control main-input"
+ enable-sticker-picker
enable-emoji-picker
hide-emoji-button
:newline-on-ctrl-enter="submitOnEnter"
- enable-sticker-picker
@input="onEmojiInputInput"
@sticker-uploaded="addMediaFile"
@sticker-upload-failed="uploadFailed"
@@ -235,7 +235,6 @@
class="text-format"
>
<Select
- id="post-content-type"
v-model="newStatus.contentType"
class="input form-control"
:attrs="{ 'aria-label': $t('post_status.content_type_selection') }"
@@ -427,13 +426,14 @@
.preview-heading {
display: flex;
- padding-left: 0.5em;
+ flex-wrap: wrap;
}
.preview-toggle {
- flex: 1;
+ flex: 10 0 auto;
cursor: pointer;
user-select: none;
+ padding-left: 0.5em;
&:hover {
text-decoration: underline;
@@ -464,7 +464,10 @@
}
.reply-or-quote-selector {
+ flex: 1 0 auto;
margin-bottom: 0.5em;
+ display: grid;
+ grid-template-columns: 1fr 1fr;
}
.text-format {
diff --git a/src/components/post_status_modal/post_status_modal.vue b/src/components/post_status_modal/post_status_modal.vue
@@ -7,7 +7,9 @@
>
<div class="post-form-modal-panel panel">
<div class="panel-heading">
- {{ $t('post_status.new_status') }}
+ <h1 class="title">
+ {{ $t('post_status.new_status') }}
+ </h1>
</div>
<PostStatusForm
class="panel-body"
diff --git a/src/components/react_button/react_button.vue b/src/components/react_button/react_button.vue
@@ -2,7 +2,7 @@
<span class="ReactButton">
<EmojiPicker
ref="picker"
- :enable-sticker-picker="enableStickerPicker"
+ :enable-sticker-picker="false"
:hide-custom-emoji="hideCustomEmoji"
class="emoji-picker-panel"
@emoji="addReaction"
diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue
@@ -1,7 +1,9 @@
<template>
<div class="settings panel panel-default">
<div class="panel-heading">
- {{ $t('registration.registration') }}
+ <h1 class="title">
+ {{ $t('registration.registration') }}
+ </h1>
</div>
<div
v-if="!hasSignUpNotice"
diff --git a/src/components/remote_user_resolver/remote_user_resolver.vue b/src/components/remote_user_resolver/remote_user_resolver.vue
@@ -1,7 +1,9 @@
<template>
<div class="panel panel-default">
<div class="panel-heading">
- {{ $t('remote_user_resolver.remote_user_resolver') }}
+ <h1 class="title">
+ {{ $t('remote_user_resolver.remote_user_resolver') }}
+ </h1>
</div>
<div class="panel-body">
<p>
diff --git a/src/components/remove_follower_button/remove_follower_button.vue b/src/components/remove_follower_button/remove_follower_button.vue
@@ -17,6 +17,7 @@
@cancelled="hideConfirmRemoveUserFromFollowers"
>
<i18n-t
+ scope="global"
keypath="user_card.remove_follower_confirm"
tag="span"
>
diff --git a/src/components/rich_content/rich_content.style.js b/src/components/rich_content/rich_content.style.js
@@ -1,6 +1,7 @@
export default {
name: 'RichContent',
selector: '.RichContent',
+ notEditable: true,
validInnerComponents: [
'Text',
'FunText',
diff --git a/src/components/root.style.js b/src/components/root.style.js
@@ -1,6 +1,7 @@
export default {
name: 'Root',
selector: ':root',
+ notEditable: true,
validInnerComponents: [
'Underlay',
'Modals',
@@ -42,7 +43,7 @@ export default {
// Selection colors
'--selectionBackground': 'color | --accent',
- '--selectionText': 'color | $textColor(--accent, --text, no-preserve)'
+ '--selectionText': 'color | $textColor(--accent --text no-preserve)'
}
}
]
diff --git a/src/components/roundness_input/roundness_input.vue b/src/components/roundness_input/roundness_input.vue
@@ -0,0 +1,51 @@
+<template>
+ <div
+ class="roundness-control style-control"
+ :class="{ disabled: !present || disabled }"
+ >
+ <label
+ :for="name"
+ class="label"
+ :class="{ faint: !present || disabled }"
+ >
+ {{ label }}
+ </label>
+ <Checkbox
+ v-if="typeof fallback !== 'undefined'"
+ :model-value="present"
+ :disabled="disabled"
+ class="opt"
+ @update:modelValue="$emit('update:modelValue', !present ? fallback : undefined)"
+ />
+ <input
+ :id="name"
+ class="input input-number"
+ type="number"
+ :value="modelValue || fallback"
+ :disabled="!present || disabled"
+ :class="{ disabled: !present || disabled }"
+ max="999"
+ min="0"
+ step="1"
+ @input="$emit('update:modelValue', $event.target.value)"
+ >
+ </div>
+</template>
+
+<script>
+import Checkbox from '../checkbox/checkbox.vue'
+export default {
+ components: {
+ Checkbox
+ },
+ props: [
+ 'name', 'label', 'modelValue', 'fallback', 'disabled'
+ ],
+ emits: ['update:modelValue'],
+ computed: {
+ present () {
+ return typeof this.modelValue !== 'undefined'
+ }
+ }
+}
+</script>
diff --git a/src/components/scrollbar.style.js b/src/components/scrollbar.style.js
@@ -1,6 +1,7 @@
export default {
name: 'Scrollbar',
- selector: '::-webkit-scrollbar',
+ selector: ['::-webkit-scrollbar-button', '::-webkit-scrollbar-thumb', '::-webkit-resizer'],
+ notEditable: true, // for now
defaultRules: [
{
directives: {
diff --git a/src/components/scrollbar_element.style.js b/src/components/scrollbar_element.style.js
@@ -31,6 +31,7 @@ const hoverGlow = {
export default {
name: 'ScrollbarElement',
selector: '::-webkit-scrollbar-button',
+ notEditable: true, // for now
states: {
pressed: ':active',
hover: ':hover:not(:disabled)',
@@ -82,7 +83,7 @@ export default {
{
state: ['disabled'],
directives: {
- background: '$blend(--inheritedBackground, 0.25, --parent)',
+ background: '$blend(--inheritedBackground 0.25 --parent)',
shadow: [...buttonInsetFakeBorders]
}
},
diff --git a/src/components/search/search.vue b/src/components/search/search.vue
@@ -1,9 +1,9 @@
<template>
<div class="Search panel panel-default">
<div class="panel-heading">
- <div class="title">
+ <h1 class="title">
{{ $t('nav.search') }}
- </div>
+ </h1>
</div>
<div class="panel-body search-input-container">
<input
diff --git a/src/components/select/select.vue b/src/components/select/select.vue
@@ -6,13 +6,14 @@
<select
:disabled="disabled"
:value="modelValue"
- v-bind="attrs"
+ v-bind="$attrs"
@change="$emit('update:modelValue', $event.target.value)"
>
<slot />
</select>
{{ ' ' }}
<FAIcon
+ v-if="!$attrs.size && !$attrs.multiple"
class="select-down-icon"
icon="chevron-down"
/>
@@ -39,6 +40,39 @@ label.Select {
z-index: 1;
height: 2em;
line-height: 16px;
+
+ &[multiple],
+ &[size] {
+ height: 100%;
+ padding: 0.2em;
+
+ option {
+ background-color: transparent;
+
+ &:checked,
+ &.-active {
+ color: var(--selectionText);
+ background-color: var(--selectionBackground);
+ }
+ }
+ }
+ }
+
+ &.disabled,
+ &:disabled {
+ background-color: var(--background);
+ opacity: 1; /* override browser */
+ color: var(--faint);
+
+ select {
+ &[multiple],
+ &[size] {
+ option.-active {
+ color: var(--faint);
+ background: transparent;
+ }
+ }
+ }
}
.select-down-icon {
@@ -50,7 +84,7 @@ label.Select {
width: 0.875em;
font-family: var(--font);
line-height: 2;
- z-index: 0;
+ z-index: 1;
pointer-events: none;
}
}
diff --git a/src/components/select/select_motion.vue b/src/components/select/select_motion.vue
@@ -0,0 +1,136 @@
+<template>
+ <div
+ class="SelectMotion btn-group"
+ >
+ <button
+ class="btn button-default"
+ :disabled="disabled"
+ @click="add"
+ >
+ <FAIcon
+ fixed-width
+ icon="plus"
+ />
+ </button>
+ <button
+ class="btn button-default"
+ :disabled="disabled || !moveUpValid"
+ :class="{ disabled: disabled || !moveUpValid }"
+ @click="moveUp"
+ >
+ <FAIcon
+ fixed-width
+ icon="chevron-up"
+ />
+ </button>
+ <button
+ class="btn button-default"
+ :disabled="disabled || !moveDnValid"
+ :class="{ disabled: disabled || !moveDnValid }"
+ @click="moveDn"
+ >
+ <FAIcon
+ fixed-width
+ icon="chevron-down"
+ />
+ </button>
+ <button
+ class="btn button-default"
+ :disabled="disabled || !present"
+ :class="{ disabled: disabled || !present }"
+ @click="del"
+ >
+ <FAIcon
+ fixed-width
+ icon="times"
+ />
+ </button>
+ </div>
+</template>
+
+<script setup>
+import { computed, defineEmits, defineProps, nextTick } from 'vue'
+
+const props = defineProps({
+ modelValue: {
+ type: Array,
+ required: true
+ },
+ selectedId: {
+ type: Number,
+ required: true
+ },
+ disabled: {
+ type: Boolean,
+ default: false
+ },
+ getAddValue: {
+ type: Function,
+ required: true
+ }
+})
+
+const emit = defineEmits(['update:modelValue', 'update:selectedId'])
+
+const moveUpValid = computed(() => {
+ return props.selectedId > 0
+})
+
+const present = computed(() => props.modelValue[props.selectedId] != null)
+
+const moveUp = async () => {
+ const newModel = [...props.modelValue]
+ const movable = newModel.splice(props.selectedId, 1)[0]
+ newModel.splice(props.selectedId - 1, 0, movable)
+
+ emit('update:modelValue', newModel)
+ await nextTick()
+ emit('update:selectedId', props.selectedId - 1)
+}
+
+const moveDnValid = computed(() => {
+ return props.selectedId < props.modelValue.length - 1
+})
+
+const moveDn = async () => {
+ const newModel = [...props.modelValue]
+ const movable = newModel.splice(props.selectedId.value, 1)[0]
+ newModel.splice(props.selectedId + 1, 0, movable)
+
+ emit('update:modelValue', newModel)
+ await nextTick()
+ emit('update:selectedId', props.selectedId + 1)
+}
+
+const add = async () => {
+ const newModel = [...props.modelValue, props.getAddValue()]
+
+ emit('update:modelValue', newModel)
+ await nextTick()
+ emit('update:selectedId', Math.max(newModel.length - 1, 0))
+}
+
+const del = async () => {
+ const newModel = [...props.modelValue]
+ newModel.splice(props.selectedId, 1)
+
+ emit('update:modelValue', newModel)
+ await nextTick()
+ emit('update:selectedId', newModel.length === 0 ? undefined : Math.max(props.selectedId - 1, 0))
+}
+</script>
+
+<style lang="scss">
+.SelectMotion {
+ flex: 0 0 auto;
+ display: grid;
+ grid-auto-columns: 1fr;
+ grid-auto-flow: column;
+ margin-top: 0.25em;
+
+ .button-default {
+ margin: 0;
+ padding: 0;
+ }
+}
+</style>
diff --git a/src/components/settings_modal/admin_tabs/frontends_tab.vue b/src/components/settings_modal/admin_tabs/frontends_tab.vue
@@ -49,11 +49,13 @@
<span v-if="adminDraft && adminDraft[':pleroma'][':frontends'][':primary']?.name === frontend.name">
<i18n-t
v-if="adminDraft && adminDraft[':pleroma'][':frontends'][':primary']?.ref === frontend.refs[0]"
+ scope="global"
keypath="admin_dash.frontend.is_default"
/>
<i18n-t
v-else
keypath="admin_dash.frontend.is_default_custom"
+ scope="global"
>
<template #version>
<code>{{ adminDraft && adminDraft[':pleroma'][':frontends'][':primary'].ref }}</code>
@@ -120,7 +122,10 @@
@click.prevent="update(frontend, ref)"
@click="close"
>
- <i18n-t keypath="admin_dash.frontend.install_version">
+ <i18n-t
+ keypath="admin_dash.frontend.install_version"
+ scope="global"
+ >
<template #version>
<code>{{ ref }}</code>
</template>
@@ -177,7 +182,10 @@
@click.prevent="setDefault(frontend, ref)"
@click="close"
>
- <i18n-t keypath="admin_dash.frontend.set_default_version">
+ <i18n-t
+ keypath="admin_dash.frontend.set_default_version"
+ scope="global"
+ >
<template #version>
<code>{{ ref }}</code>
</template>
diff --git a/src/components/settings_modal/admin_tabs/limits_tab.js b/src/components/settings_modal/admin_tabs/limits_tab.js
@@ -14,7 +14,6 @@ library.add(
)
const LimitsTab = {
- data () {},
components: {
BooleanSetting,
ChoiceSetting,
diff --git a/src/components/settings_modal/helpers/attachment_setting.vue b/src/components/settings_modal/helpers/attachment_setting.vue
@@ -48,18 +48,14 @@
:attachment="attachment"
size="small"
hide-description
- @setMedia="onMedia"
- @naturalSizeLoad="onNaturalSizeLoad"
/>
<div class="controls control-upload">
<MediaUpload
ref="mediaUpload"
class="media-upload-icon"
- :drop-files="dropFiles"
normal-button
:accept-types="acceptTypes"
@uploaded="setMediaFile"
- @upload-failed="uploadFailed"
/>
</div>
</div>
diff --git a/src/components/settings_modal/helpers/emoji_editing_popover.vue b/src/components/settings_modal/helpers/emoji_editing_popover.vue
@@ -112,7 +112,10 @@ export default {
components: { Popover, ConfirmModal, StillImage },
inject: ['emojiAddr'],
props: {
- placement: String,
+ placement: {
+ type: String,
+ required: true
+ },
disabled: {
type: Boolean,
default: false
@@ -120,8 +123,14 @@ export default {
newUpload: Boolean,
- title: String,
- packName: String,
+ title: {
+ type: String,
+ required: true
+ },
+ packName: {
+ type: String,
+ required: true
+ },
shortcode: {
type: String,
// Only exists when this is not a new upload
diff --git a/src/components/settings_modal/helpers/integer_setting.vue b/src/components/settings_modal/helpers/integer_setting.vue
@@ -1,7 +1,7 @@
<template>
<NumberSetting
v-bind="$attrs"
- truncate="1"
+ :truncate="1"
>
<slot />
</NumberSetting>
diff --git a/src/components/settings_modal/helpers/number_setting.js b/src/components/settings_modal/helpers/number_setting.js
@@ -4,6 +4,21 @@ export default {
...Setting,
props: {
...Setting.props,
+ min: {
+ type: Number,
+ required: false,
+ default: 1
+ },
+ max: {
+ type: Number,
+ required: false,
+ default: 1
+ },
+ step: {
+ type: Number,
+ required: false,
+ default: 1
+ },
truncate: {
type: Number,
required: false,
diff --git a/src/components/settings_modal/helpers/setting.js b/src/components/settings_modal/helpers/setting.js
@@ -10,9 +10,13 @@ export default {
ProfileSettingIndicator
},
props: {
+ modelValue: {
+ type: String,
+ default: null
+ },
path: {
type: [String, Array],
- required: true
+ required: false
},
disabled: {
type: Boolean,
@@ -68,7 +72,7 @@ export default {
}
},
created () {
- if (this.realDraftMode && this.realSource !== 'admin') {
+ if (this.realDraftMode && (this.realSource !== 'admin' || this.path == null)) {
this.draft = this.state
}
},
@@ -76,14 +80,14 @@ export default {
draft: {
// TODO allow passing shared draft object?
get () {
- if (this.realSource === 'admin') {
+ if (this.realSource === 'admin' || this.path == null) {
return get(this.$store.state.adminSettings.draft, this.canonPath)
} else {
return this.localDraft
}
},
set (value) {
- if (this.realSource === 'admin') {
+ if (this.realSource === 'admin' || this.path == null) {
this.$store.commit('updateAdminDraft', { path: this.canonPath, value })
} else {
this.localDraft = value
@@ -91,6 +95,9 @@ export default {
}
},
state () {
+ if (this.path == null) {
+ return this.modelValue
+ }
const value = get(this.configSource, this.canonPath)
if (value === undefined) {
return this.defaultState
@@ -145,6 +152,9 @@ export default {
return this.backendDescription?.suggestions
},
shouldBeDisabled () {
+ if (this.path == null) {
+ return this.disabled
+ }
const parentValue = this.parentPath !== undefined ? get(this.configSource, this.parentPath) : null
return this.disabled || (parentValue !== null ? (this.parentInvert ? parentValue : !parentValue) : false)
},
@@ -159,6 +169,9 @@ export default {
}
},
configSink () {
+ if (this.path == null) {
+ return (k, v) => this.$emit('update:modelValue', v)
+ }
switch (this.realSource) {
case 'profile':
return (k, v) => this.$store.dispatch('setProfileOption', { name: k, value: v })
@@ -184,6 +197,7 @@ export default {
return this.realSource === 'profile'
},
isChanged () {
+ if (this.path == null) return false
switch (this.realSource) {
case 'profile':
case 'admin':
@@ -193,9 +207,11 @@ export default {
}
},
canonPath () {
+ if (this.path == null) return null
return Array.isArray(this.path) ? this.path : this.path.split('.')
},
isDirty () {
+ if (this.path == null) return false
if (this.realSource === 'admin' && this.canonPath.length > 3) {
return false // should not show draft buttons for "grouped" values
} else {
diff --git a/src/components/settings_modal/helpers/string_setting.vue b/src/components/settings_modal/helpers/string_setting.vue
@@ -5,6 +5,7 @@
>
<label
:for="path"
+ class="setting-label"
:class="{ 'faint': shouldBeDisabled }"
>
<template v-if="backendDescriptionLabel">
@@ -15,6 +16,7 @@
</template>
<slot v-else />
</label>
+ {{ ' ' }}
<input
:id="path"
class="input string-input"
diff --git a/src/components/settings_modal/helpers/unit_setting.vue b/src/components/settings_modal/helpers/unit_setting.vue
@@ -10,31 +10,33 @@
<slot />
</label>
{{ ' ' }}
- <input
- :id="path"
- class="input number-input"
- type="number"
- :step="step"
- :disabled="disabled"
- :min="min || 0"
- :value="stateValue"
- @change="updateValue"
- >
- <Select
- :id="path"
- :model-value="stateUnit"
- :disabled="disabled"
- class="unit-input unstyled"
- @change="updateUnit"
- >
- <option
- v-for="option in units"
- :key="option"
- :value="option"
+ <span class="no-break">
+ <input
+ :id="path"
+ class="input number-input"
+ type="number"
+ :step="step"
+ :disabled="disabled"
+ :min="min || 0"
+ :value="stateValue"
+ @change="updateValue"
+ >
+ <Select
+ :id="path"
+ :model-value="stateUnit"
+ :disabled="disabled"
+ class="unit-input unstyled"
+ @change="updateUnit"
>
- {{ getUnitString(option) }}
- </option>
- </Select>
+ <option
+ v-for="option in units"
+ :key="option"
+ :value="option"
+ >
+ {{ getUnitString(option) }}
+ </option>
+ </Select>
+ </span>
{{ ' ' }}
<ModifiedIndicator
:changed="isChanged"
@@ -47,6 +49,10 @@
<style lang="scss">
.UnitSetting {
+ .no-break {
+ display: inline-block;
+ }
+
.number-input {
max-width: 6.5em;
text-align: right;
diff --git a/src/components/settings_modal/settings_modal.js b/src/components/settings_modal/settings_modal.js
@@ -167,7 +167,6 @@ const SettingsModal = {
},
computed: {
currentSaveStateNotice () {
- console.log(this.$store.state.interface.settings.currentSaveStateNotice)
return this.$store.state.interface.settings.currentSaveStateNotice
},
modalActivated () {
diff --git a/src/components/settings_modal/settings_modal.scss b/src/components/settings_modal/settings_modal.scss
@@ -10,6 +10,10 @@
list-style-type: none;
padding-left: 2em;
+ .btn:not(.dropdown-button) {
+ padding: 0 2em;
+ }
+
li {
margin-bottom: 0.5em;
}
@@ -54,10 +58,6 @@
.btn {
min-height: 2em;
}
-
- .btn:not(.dropdown-button) {
- padding: 0 2em;
- }
}
}
@@ -76,6 +76,23 @@
}
}
+ &.-mobile {
+ .setting-list,
+ .option-list {
+ padding-left: 0.25em;
+
+ > li {
+ margin: 1em 0;
+ line-height: 1.5em;
+ vertical-align: center;
+ }
+
+ &.two-column {
+ column-count: 1;
+ }
+ }
+ }
+
&.peek {
.settings-modal-panel {
/* Explanation:
diff --git a/src/components/settings_modal/settings_modal.vue b/src/components/settings_modal/settings_modal.vue
@@ -7,9 +7,9 @@
>
<div class="settings-modal-panel panel">
<div class="panel-heading">
- <span class="title">
+ <h1 class="title">
{{ modalMode === 'user' ? $t('settings.settings') : $t('admin_dash.window_title') }}
- </span>
+ </h1>
<transition name="fade">
<div
v-if="currentSaveStateNotice"
@@ -110,7 +110,10 @@
{{ $t("settings.expert_mode") }}
</Checkbox>
<span v-if="modalMode === 'admin'">
- <i18n-t keypath="admin_dash.wip_notice">
+ <i18n-t
+ scope="global"
+ keypath="admin_dash.wip_notice"
+ >
<template #adminFeLink>
<a
href="/pleroma/admin/#/login-pleroma"
diff --git a/src/components/settings_modal/settings_modal_admin_content.scss b/src/components/settings_modal/settings_modal_admin_content.scss
@@ -17,10 +17,13 @@
}
.select-multiple {
+ margin-top: 0.5em;
display: flex;
+ flex-direction: column;
.option-list {
margin: 0;
+ margin-top: 0.5em;
padding-left: 0.5em;
}
}
diff --git a/src/components/settings_modal/settings_modal_admin_content.vue b/src/components/settings_modal/settings_modal_admin_content.vue
@@ -17,7 +17,10 @@
<div :label="$t('admin_dash.tabs.nodb')">
<div class="setting-item">
<h2>{{ $t('admin_dash.nodb.heading') }}</h2>
- <i18n-t keypath="admin_dash.nodb.text">
+ <i18n-t
+ scope="global"
+ keypath="admin_dash.nodb.text"
+ >
<template #documentation>
<a
href="https://docs-develop.pleroma.social/backend/configuration/howto_database_config/"
diff --git a/src/components/settings_modal/settings_modal_user_content.js b/src/components/settings_modal/settings_modal_user_content.js
@@ -10,6 +10,7 @@ import GeneralTab from './tabs/general_tab.vue'
import AppearanceTab from './tabs/appearance_tab.vue'
import VersionTab from './tabs/version_tab.vue'
import ThemeTab from './tabs/theme_tab/theme_tab.vue'
+import StyleTab from './tabs/style_tab/style_tab.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import {
@@ -17,6 +18,7 @@ import {
faUser,
faFilter,
faPaintBrush,
+ faPalette,
faBell,
faDownload,
faEyeSlash,
@@ -29,6 +31,7 @@ library.add(
faUser,
faFilter,
faPaintBrush,
+ faPalette,
faBell,
faDownload,
faEyeSlash,
@@ -48,6 +51,7 @@ const SettingsModalContent = {
ProfileTab,
GeneralTab,
AppearanceTab,
+ StyleTab,
VersionTab,
ThemeTab
},
@@ -60,6 +64,12 @@ const SettingsModalContent = {
},
bodyLock () {
return this.$store.state.interface.settingsModalState === 'visible'
+ },
+ expertLevel () {
+ return this.$store.state.config.expertLevel
+ },
+ isMobileLayout () {
+ return this.$store.state.interface.layoutType === 'mobile'
}
},
methods: {
diff --git a/src/components/settings_modal/settings_modal_user_content.scss b/src/components/settings_modal/settings_modal_user_content.scss
@@ -1,6 +1,21 @@
.settings_tab-switcher {
height: 100%;
+ h1 {
+ margin-bottom: 0.5em;
+ margin-top: 0.5em;
+ }
+
+ h4 {
+ margin-bottom: 0;
+ margin-top: 0.25em;
+ }
+
+ h5 {
+ margin-bottom: 0;
+ margin-top: 0.25em;
+ }
+
.setting-item {
border-bottom: 2px solid var(--border);
margin: 1em 1em 1.4em;
@@ -8,7 +23,6 @@
> div,
> label {
- display: block;
margin-bottom: 0.5em;
&:last-child {
@@ -17,10 +31,13 @@
}
.select-multiple {
+ margin-top: 1em;
display: flex;
+ flex-direction: column;
.option-list {
margin: 0;
+ margin-top: 0.5em;
padding-left: 0.5em;
}
}
diff --git a/src/components/settings_modal/settings_modal_user_content.vue b/src/components/settings_modal/settings_modal_user_content.vue
@@ -17,13 +17,25 @@
:label="$t('settings.appearance')"
icon="window-restore"
data-tab-name="appearance"
+ :delay-render="true"
>
<AppearanceTab />
</div>
<div
- :label="$t('settings.theme')"
+ v-if="expertLevel > 0 && !isMobileLayout"
+ :label="$t('settings.style.themes3.editor.title')"
+ icon="palette"
+ data-tab-name="style"
+ :delay-render="true"
+ >
+ <StyleTab />
+ </div>
+ <div
+ v-if="expertLevel > 0 && !isMobileLayout"
+ :label="$t('settings.theme_old')"
icon="paint-brush"
data-tab-name="theme"
+ :delay-render="true"
>
<ThemeTab />
</div>
diff --git a/src/components/settings_modal/tabs/appearance_tab.js b/src/components/settings_modal/tabs/appearance_tab.js
@@ -3,20 +3,20 @@ import ChoiceSetting from '../helpers/choice_setting.vue'
import IntegerSetting from '../helpers/integer_setting.vue'
import FloatSetting from '../helpers/float_setting.vue'
import UnitSetting, { defaultHorizontalUnits } from '../helpers/unit_setting.vue'
+import PaletteEditor from 'src/components/palette_editor/palette_editor.vue'
import FontControl from 'src/components/font_control/font_control.vue'
import { normalizeThemeData } from 'src/modules/interface'
-import {
- getThemes
-} from 'src/services/style_setter/style_setter.js'
+import { newImporter } from 'src/services/export_import/export_import.js'
import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js'
import { init } from 'src/services/theme_data/theme_data_3.service.js'
import {
getCssRules,
getScopedVersion
} from 'src/services/theme_data/css_utils.js'
+import { deserialize } from 'src/services/theme_data/iss_deserializer.js'
import SharedComputedObject from '../helpers/shared_computed_object.js'
import ProfileSettingIndicator from '../helpers/profile_setting_indicator.vue'
@@ -27,6 +27,10 @@ import {
import Preview from './theme_tab/theme_preview.vue'
+// helper for debugging
+// eslint-disable-next-line no-unused-vars
+const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x))
+
library.add(
faGlobe
)
@@ -34,7 +38,28 @@ library.add(
const AppearanceTab = {
data () {
return {
- availableStyles: [],
+ availableThemesV3: [],
+ availableThemesV2: [],
+ bundledPalettes: [],
+ compilationCache: {},
+ fileImporter: newImporter({
+ accept: '.json, .piss',
+ validator: this.importValidator,
+ onImport: this.onImport,
+ parser: this.importParser,
+ onImportFailure: this.onImportFailure
+ }),
+ palettesKeys: [
+ 'bg',
+ 'fg',
+ 'link',
+ 'text',
+ 'cRed',
+ 'cGreen',
+ 'cBlue',
+ 'cOrange'
+ ],
+ userPalette: {},
intersectionObserver: null,
thirdColumnModeOptions: ['none', 'notifications', 'postform'].map(mode => ({
key: mode,
@@ -61,33 +86,77 @@ const AppearanceTab = {
UnitSetting,
ProfileSettingIndicator,
FontControl,
- Preview
+ Preview,
+ PaletteEditor
},
mounted () {
- getThemes()
- .then((promises) => {
- return Promise.all(
- Object.entries(promises)
- .map(([k, v]) => v.then(res => [k, res]))
- )
+ this.$store.dispatch('getThemeData')
+
+ const updateIndex = (resource) => {
+ const capitalizedResource = resource[0].toUpperCase() + resource.slice(1)
+ const currentIndex = this.$store.state.instance[`${resource}sIndex`]
+
+ let promise
+ if (currentIndex) {
+ promise = Promise.resolve(currentIndex)
+ } else {
+ promise = this.$store.dispatch(`fetch${capitalizedResource}sIndex`)
+ }
+
+ return promise.then(index => {
+ return Object
+ .entries(index)
+ .map(([k, func]) => [k, func()])
})
- .then(themes => themes.reduce((acc, [k, v]) => {
- if (v) {
- return [
- ...acc,
- {
- name: v.name || v[0],
- key: k,
- data: v
- }
- ]
+ }
+
+ updateIndex('style').then(styles => {
+ styles.forEach(([key, stylePromise]) => stylePromise.then(data => {
+ const meta = data.find(x => x.component === '@meta')
+ this.availableThemesV3.push({ key, data, name: meta.directives.name, version: 'v3' })
+ }))
+ })
+
+ updateIndex('theme').then(themes => {
+ themes.forEach(([key, themePromise]) => themePromise.then(data => {
+ if (!data) {
+ console.warn(`Theme with key ${key} is empty or malformed`)
+ } else if (Array.isArray(data)) {
+ console.warn(`Theme with key ${key} is a v1 theme and should be moved to static/palettes/index.json`)
+ } else if (!data.source && !data.theme) {
+ console.warn(`Theme with key ${key} is malformed`)
} else {
- return acc
+ this.availableThemesV2.push({ key, data, name: data.name, version: 'v2' })
}
- }, []))
- .then((themesComplete) => {
- this.availableStyles = themesComplete
- })
+ }))
+ })
+
+ this.userPalette = this.$store.state.interface.paletteDataUsed || {}
+
+ updateIndex('palette').then(bundledPalettes => {
+ bundledPalettes.forEach(([key, palettePromise]) => palettePromise.then(v => {
+ let palette
+ if (Array.isArray(v)) {
+ const [
+ name,
+ bg,
+ fg,
+ text,
+ link,
+ cRed = '#FF0000',
+ cGreen = '#00FF00',
+ cBlue = '#0000FF',
+ cOrange = '#E3FF00'
+ ] = v
+ palette = { key, name, bg, fg, text, link, cRed, cBlue, cGreen, cOrange }
+ } else {
+ palette = { key, ...v }
+ }
+ if (!palette.key.startsWith('style.')) {
+ this.bundledPalettes.push(palette)
+ }
+ }))
+ })
if (window.IntersectionObserver) {
this.intersectionObserver = new IntersectionObserver((entries, observer) => {
@@ -111,7 +180,65 @@ const AppearanceTab = {
})
})
},
+ watch: {
+ paletteDataUsed () {
+ this.userPalette = this.paletteDataUsed || {}
+ }
+ },
computed: {
+ paletteDataUsed () {
+ return this.$store.state.interface.paletteDataUsed
+ },
+ availableStyles () {
+ return [
+ ...this.availableThemesV3,
+ ...this.availableThemesV2
+ ]
+ },
+ availablePalettes () {
+ return [
+ ...this.bundledPalettes,
+ ...this.stylePalettes
+ ]
+ },
+ stylePalettes () {
+ const ruleset = this.$store.state.interface.styleDataUsed || []
+ if (!ruleset && ruleset.length === 0) return
+ const meta = ruleset.find(x => x.component === '@meta')
+ const result = ruleset.filter(x => x.component.startsWith('@palette'))
+ .map(x => {
+ const { variant, directives } = x
+ const {
+ bg,
+ fg,
+ text,
+ link,
+ accent,
+ cRed,
+ cBlue,
+ cGreen,
+ cOrange,
+ wallpaper
+ } = directives
+
+ const result = {
+ name: `${meta.directives.name || this.$t('settings.style.themes3.palette.imported')}: ${variant}`,
+ key: `style.${variant.toLowerCase().replace(/ /g, '_')}`,
+ bg,
+ fg,
+ text,
+ link,
+ accent,
+ cRed,
+ cBlue,
+ cGreen,
+ cOrange,
+ wallpaper
+ }
+ return Object.fromEntries(Object.entries(result).filter(([k, v]) => v))
+ })
+ return result
+ },
noIntersectionObserver () {
return !window.IntersectionObserver
},
@@ -132,27 +259,32 @@ const AppearanceTab = {
return ['sidebar', 'content', ...notif]
}
},
- instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
instanceWallpaperUsed () {
return this.$store.state.instance.background &&
!this.$store.state.users.currentUser.background_image
},
- instanceShoutboxPresent () { return this.$store.state.instance.shoutAvailable },
language: {
get: function () { return this.$store.getters.mergedConfig.interfaceLanguage },
set: function (val) {
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
}
},
+ customThemeVersion () {
+ const { themeVersion } = this.$store.state.interface
+ return themeVersion
+ },
isCustomThemeUsed () {
- const { theme } = this.mergedConfig
- return theme === 'custom' || theme === null
+ const { customTheme, customThemeSource } = this.mergedConfig
+ return customTheme != null || customThemeSource != null
+ },
+ isCustomStyleUsed (name) {
+ const { styleCustomData } = this.mergedConfig
+ return styleCustomData != null
},
...SharedComputedObject()
},
methods: {
updateFont (key, value) {
- console.log(key, value)
this.$store.dispatch('setOption', {
name: 'theme3hacks',
value: {
@@ -164,25 +296,120 @@ const AppearanceTab = {
}
})
},
+ importFile () {
+ this.fileImporter.importData()
+ },
+ importParser (file, filename) {
+ if (filename.endsWith('.json')) {
+ return JSON.parse(file)
+ } else if (filename.endsWith('.piss')) {
+ return deserialize(file)
+ }
+ },
+ onImport (parsed, filename) {
+ if (filename.endsWith('.json')) {
+ this.$store.dispatch('setThemeCustom', parsed.source || parsed.theme)
+ } else if (filename.endsWith('.piss')) {
+ this.$store.dispatch('setStyleCustom', parsed)
+ }
+ },
+ onImportFailure (result) {
+ console.error('Failure importing theme:', result)
+ this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_theme_imported', level: 'error' })
+ },
+ importValidator (parsed, filename) {
+ if (filename.endsWith('.json')) {
+ const version = parsed._pleroma_theme_version
+ return version >= 1 || version <= 2
+ } else if (filename.endsWith('.piss')) {
+ if (!Array.isArray(parsed)) return false
+ if (parsed.length < 1) return false
+ if (parsed.find(x => x.component === '@meta') == null) return false
+ return true
+ }
+ },
isThemeActive (key) {
- const { theme } = this.mergedConfig
- return key === theme
+ return key === (this.mergedConfig.theme || this.$store.state.instance.theme)
+ },
+ isStyleActive (key) {
+ return key === (this.mergedConfig.style || this.$store.state.instance.style)
+ },
+ isPaletteActive (key) {
+ return key === (this.mergedConfig.palette || this.$store.state.instance.palette)
+ },
+ setStyle (name) {
+ this.$store.dispatch('setStyle', name)
},
setTheme (name) {
- this.$store.dispatch('setTheme', { themeName: name, saveData: true, recompile: true })
- },
- previewTheme (key, input) {
- const style = normalizeThemeData(input)
- const x = 2
- if (x === 1) return
- const theme2 = convertTheme2To3(style)
- const theme3 = init({
- inputRuleset: theme2,
- ultimateBackgroundColor: '#000000',
- liteMode: true,
- debug: true,
- onlyNormalState: true
- })
+ this.$store.dispatch('setTheme', name)
+ },
+ setPalette (name, data) {
+ this.$store.dispatch('setPalette', name)
+ this.userPalette = data
+ },
+ setPaletteCustom (data) {
+ this.$store.dispatch('setPaletteCustom', data)
+ this.userPalette = data
+ },
+ resetTheming (name) {
+ this.$store.dispatch('setStyle', 'stock')
+ },
+ previewTheme (key, version, input) {
+ let theme3
+ if (this.compilationCache[key]) {
+ theme3 = this.compilationCache[key]
+ } else if (input) {
+ if (version === 'v2') {
+ const style = normalizeThemeData(input)
+ const theme2 = convertTheme2To3(style)
+ theme3 = init({
+ inputRuleset: theme2,
+ ultimateBackgroundColor: '#000000',
+ liteMode: true,
+ debug: true,
+ onlyNormalState: true
+ })
+ } else if (version === 'v3') {
+ const palette = input.find(x => x.component === '@palette')
+ let paletteRule
+ if (palette) {
+ const { directives } = palette
+ directives.link = directives.link || directives.accent
+ directives.accent = directives.accent || directives.link
+ paletteRule = {
+ component: 'Root',
+ directives: Object.fromEntries(
+ Object
+ .entries(directives)
+ .filter(([k, v]) => k && k !== 'name')
+ .map(([k, v]) => ['--' + k, 'color | ' + v])
+ )
+ }
+ } else {
+ paletteRule = null
+ }
+
+ theme3 = init({
+ inputRuleset: [...input, paletteRule].filter(x => x),
+ ultimateBackgroundColor: '#000000',
+ liteMode: true,
+ debug: true,
+ onlyNormalState: true
+ })
+ }
+ } else {
+ theme3 = init({
+ inputRuleset: [],
+ ultimateBackgroundColor: '#000000',
+ liteMode: true,
+ debug: true,
+ onlyNormalState: true
+ })
+ }
+
+ if (!this.compilationCache[key]) {
+ this.compilationCache[key] = theme3
+ }
return getScopedVersion(
getCssRules(theme3.eager),
diff --git a/src/components/settings_modal/tabs/appearance_tab.scss b/src/components/settings_modal/tabs/appearance_tab.scss
@@ -0,0 +1,120 @@
+.appearance-tab {
+ .palette,
+ .theme-notice {
+ padding: 0.5em;
+ margin: 1em;
+ }
+
+ .setting-item {
+ padding-bottom: 0;
+
+ &.heading {
+ display: grid;
+ align-items: baseline;
+ grid-template-columns: 1fr auto auto auto;
+ grid-gap: 0.5em;
+
+ h2 {
+ flex: 1 0 auto;
+ }
+ }
+ }
+
+ .palettes {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ grid-gap: 0.5em;
+
+ h4,
+ .unsupported-theme-v2,
+ .userPalette {
+ grid-column: 1 / span 2;
+ }
+ }
+
+ .palette-entry {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 0 0.5em;
+
+ .palette-label label {
+ text-align: center;
+ }
+
+ .palette-square {
+ flex: 0 0 auto;
+ display: inline-block;
+ min-width: 1em;
+ min-height: 1em;
+ }
+ }
+
+ .column-settings {
+ display: flex;
+ justify-content: space-evenly;
+ flex-wrap: wrap;
+ }
+
+ .column-settings .size-label {
+ display: block;
+ margin-bottom: 0.5em;
+ margin-top: 0.5em;
+ }
+
+ .modal-view.-mobile & {
+ .palette-entry {
+ flex-wrap: wrap;
+ justify-content: center;
+ }
+
+ .palette-label {
+ line-height: 1.5em;
+ margin-top: 0.5em;
+ width: 100%;
+ }
+
+ .palette-preview {
+ display: grid;
+ grid-template-columns: 1fr 1fr 1fr 1fr;
+ grid-template-rows: 1em 1em;
+ margin-bottom: 0.5em;
+ }
+ }
+
+ .theme-list {
+ list-style: none;
+ display: flex;
+ flex-wrap: wrap;
+ margin: -0.5em 0;
+ height: 25em;
+ overflow-x: hidden;
+ overflow-y: auto;
+ scrollbar-gutter: stable;
+ border-radius: var(--roundness);
+ border: 1px solid var(--border);
+ padding: 0;
+ margin-bottom: 1em;
+
+ .theme-preview {
+ font-size: 1rem; // fix for firefox
+ width: 19rem;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ margin: 0.5em;
+
+ &.placeholder {
+ opacity: 0.2;
+ }
+
+ .theme-preview-container {
+ pointer-events: none;
+ zoom: 0.5;
+ border: none;
+ border-radius: var(--roundness);
+ text-align: left;
+ }
+ }
+ }
+}
diff --git a/src/components/settings_modal/tabs/appearance_tab.vue b/src/components/settings_modal/tabs/appearance_tab.vue
@@ -1,49 +1,170 @@
<template>
- <div class="appearance-tab" :label="$t('settings.general')">
+ <div
+ class="appearance-tab"
+ :label="$t('settings.general')"
+ >
<div class="setting-item">
<h2>{{ $t('settings.theme') }}</h2>
<ul
- class="theme-list"
ref="themeList"
+ class="theme-list"
>
<button
+ class="button-default theme-preview"
+ data-theme-key="stock"
+ :class="{ toggled: isStyleActive('stock') }"
+ @click="resetTheming"
+ >
+ <!-- eslint-disable vue/no-v-text-v-html-on-component -->
+ <!-- eslint-disable vue/no-v-html -->
+ <component
+ :is="'style'"
+ v-html="previewTheme('stock', 'v3')"
+ />
+ <!-- eslint-enable vue/no-v-html -->
+ <!-- eslint-enable vue/no-v-text-v-html-on-component -->
+ <preview id="theme-preview-stock" />
+ <h4 class="theme-name">
+ {{ $t('settings.style.stock_theme_used') }}
+ <span class="alert neutral version">v3</span>
+ </h4>
+ </button>
+ <button
v-if="isCustomThemeUsed"
disabled
- class="button-default theme-preview"
+ class="button-default theme-preview toggled"
>
<preview />
- <h4 class="theme-name">{{ $t('settings.style.custom_theme_used') }}</h4>
+ <h4 class="theme-name">
+ {{ $t('settings.style.custom_theme_used') }}
+ <span class="alert neutral version">v2</span>
+ </h4>
+ </button>
+ <button
+ v-if="isCustomStyleUsed"
+ disabled
+ class="button-default theme-preview toggled"
+ >
+ <preview />
+ <h4 class="theme-name">
+ {{ $t('settings.style.custom_style_used') }}
+ <span class="alert neutral version">v3</span>
+ </h4>
</button>
<button
v-for="style in availableStyles"
- :data-theme-key="style.key"
:key="style.key"
+ :data-theme-key="style.key"
class="button-default theme-preview"
- :class="{ toggled: isThemeActive(style.key) }"
- @click="setTheme(style.key)"
+ :class="{ toggled: isStyleActive(style.key) }"
+ @click="style.version === 'v2' ? setTheme(style.key) : setStyle(style.key)"
>
<!-- eslint-disable vue/no-v-text-v-html-on-component -->
- <component
- :is="'style'"
- v-if="style.ready || noIntersectionObserver"
- v-html="previewTheme(style.key, style.data)"
- />
+ <!-- eslint-disable vue/no-v-html -->
+ <div v-if="style.ready || noIntersectionObserver">
+ <component
+ :is="'style'"
+ v-html="previewTheme(style.key, style.version, style.data)"
+ />
+ </div>
+ <!-- eslint-enable vue/no-v-html -->
<!-- eslint-enable vue/no-v-text-v-html-on-component -->
- <preview :class="{ placeholder: ready }" :id="'theme-preview-' + style.key"/>
- <h4 class="theme-name">{{ style.name }}</h4>
+ <preview :id="'theme-preview-' + style.key" />
+ <h4 class="theme-name">
+ {{ style.name }}
+ <span class="alert neutral version">{{ style.version }}</span>
+ </h4>
</button>
</ul>
- </div>
- <div class="alert neutral theme-notice">
- {{ $t("settings.style.appearance_tab_note") }}
+ <div class="import-file-container">
+ <button
+ class="btn button-default"
+ @click="importFile"
+ >
+ <FAIcon icon="folder-open" />
+ {{ $t('settings.style.themes3.editor.load_style') }}
+ </button>
+ </div>
+ <div class="setting-item">
+ <h2>{{ $t('settings.style.themes3.palette.label') }}</h2>
+ <div class="palettes">
+ <template v-if="customThemeVersion === 'v3'">
+ <h4>{{ $t('settings.style.themes3.palette.bundled') }}</h4>
+ <button
+ v-for="p in bundledPalettes"
+ :key="p.name"
+ class="btn button-default palette-entry"
+ :class="{ toggled: isPaletteActive(p.key) }"
+ @click="() => setPalette(p.key, p)"
+ >
+ <div class="palette-label">
+ <label>
+ {{ p.name }}
+ </label>
+ </div>
+ <div class="palette-preview">
+ <span
+ v-for="c in palettesKeys"
+ :key="c"
+ class="palette-square"
+ :style="{ backgroundColor: p[c], border: '1px solid ' + (p[c] ?? 'var(--text)') }"
+ />
+ </div>
+ </button>
+ <h4 v-if="stylePalettes?.length > 0">
+ {{ $t('settings.style.themes3.palette.style') }}
+ </h4>
+ <button
+ v-for="p in stylePalettes || []"
+ :key="p.name"
+ class="btn button-default palette-entry"
+ :class="{ toggled: isPaletteActive(p.key) }"
+ @click="() => setPalette(p.key, p)"
+ >
+ <div class="palette-label">
+ <label>
+ {{ p.name ?? $t('settings.style.themes3.palette.user') }}
+ </label>
+ </div>
+ <div class="palette-preview">
+ <span
+ v-for="c in palettesKeys"
+ :key="c"
+ class="palette-square"
+ :style="{ backgroundColor: p[c], border: '1px solid ' + (p[c] ?? 'var(--text)') }"
+ />
+ </div>
+ </button>
+ <h4 v-if="expertLevel > 0">
+ {{ $t('settings.style.themes3.palette.user') }}
+ </h4>
+ <PaletteEditor
+ v-if="expertLevel > 0"
+ v-model="userPalette"
+ class="userPalette"
+ :compact="true"
+ :apply="true"
+ @applyPalette="data => setPaletteCustom(data)"
+ />
+ </template>
+ <template v-else-if="customThemeVersion === 'v2'">
+ <div class="alert neutral theme-notice unsupported-theme-v2">
+ {{ $t('settings.style.themes3.palette.v2_unsupported') }}
+ </div>
+ </template>
+ </div>
+ </div>
</div>
<div class="setting-item">
<h2>{{ $t('settings.scale_and_layout') }}</h2>
+ <div class="alert neutral theme-notice">
+ {{ $t("settings.style.appearance_tab_note") }}
+ </div>
<ul class="setting-list">
<li>
<UnitSetting
path="textSize"
- step="0.1"
+ :step="0.1"
:units="['px', 'rem']"
:reset-default="{ 'px': 14, 'rem': 1 }"
timed-apply-mode
@@ -60,7 +181,7 @@
<code>px</code>
<code>rem</code>
</i18n-t>
- <br/>
+ <br>
<i18n-t
scope="global"
keypath="settings.text_size_tip2"
@@ -119,7 +240,7 @@
<li>
<UnitSetting
path="emojiSize"
- step="0.1"
+ :step="0.1"
:units="['px', 'rem']"
:reset-default="{ 'px': 32, 'rem': 2.2 }"
>
@@ -142,7 +263,7 @@
<li>
<UnitSetting
path="navbarSize"
- step="0.1"
+ :step="0.1"
:units="['px', 'rem']"
:reset-default="{ 'px': 55, 'rem': 3.5 }"
>
@@ -153,7 +274,7 @@
<li>
<UnitSetting
path="panelHeaderSize"
- step="0.1"
+ :step="0.1"
:units="['px', 'rem']"
:reset-default="{ 'px': 52, 'rem': 3.2 }"
timed-apply-mode
@@ -256,58 +377,4 @@
<script src="./appearance_tab.js"></script>
-<style lang="scss">
-.appearance-tab {
- .theme-notice {
- padding: 0.5em;
- margin: 1em;
- }
-
- .column-settings {
- display: flex;
- justify-content: space-evenly;
- flex-wrap: wrap;
- }
-
- .column-settings .size-label {
- display: block;
- margin-bottom: 0.5em;
- margin-top: 0.5em;
- }
-
- .theme-list {
- list-style: none;
- display: flex;
- flex-wrap: wrap;
- margin: -0.5em 0;
- height: 25em;
- overflow-x: hidden;
- overflow-y: auto;
- scrollbar-gutter: stable;
- border-radius: var(--roundness);
- border: 1px solid var(--border);
- padding: 0;
-
- .theme-preview {
- font-size: 1rem; // fix for firefox
- width: 19rem;
- display: flex;
- flex-direction: column;
- align-items: center;
- margin: 0.5em;
-
- &.placeholder {
- opacity: 0.2;
- }
-
- .theme-preview-container {
- pointer-events: none;
- zoom: 0.5;
- border: none;
- border-radius: var(--roundness);
- text-align: left;
- }
- }
- }
-}
-</style>
+<style lang="scss" src="./appearance_tab.scss"></style>
diff --git a/src/components/settings_modal/tabs/filtering_tab.vue b/src/components/settings_modal/tabs/filtering_tab.vue
@@ -106,7 +106,7 @@
key="hideScrobblesAfter"
path="hideScrobblesAfter"
:units="['m', 'h', 'd']"
- unitSet="time"
+ unit-set="time"
expert="1"
>
{{ $t('settings.hide_scrobbles_after') }}
diff --git a/src/components/settings_modal/tabs/general_tab.js b/src/components/settings_modal/tabs/general_tab.js
@@ -86,6 +86,8 @@ const GeneralTab = {
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
}
},
+ instanceShoutboxPresent () { return this.$store.state.instance.shoutAvailable },
+ instanceSpecificPanelPresent () { return this.$store.state.instance.showInstanceSpecificPanel },
...SharedComputedObject()
},
methods: {
diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue
@@ -217,6 +217,29 @@
{{ $t('settings.no_rich_text_description') }}
</BooleanSetting>
</li>
+ <li>
+ <BooleanSetting
+ path="useAbsoluteTimeFormat"
+ expert="1"
+ >
+ {{ $t('settings.absolute_time_format') }}
+ </BooleanSetting>
+ </li>
+ <ul
+ v-if="mergedConfig.useAbsoluteTimeFormat"
+ class="setting-list suboptions"
+ >
+ <li>
+ <UnitSetting
+ path="absoluteTimeFormatMinAge"
+ unit-set="time"
+ :units="['s', 'm', 'h', 'd']"
+ :min="0"
+ >
+ {{ $t('settings.absolute_time_format_min_age') }}
+ </UnitSetting>
+ </li>
+ </ul>
<h3>{{ $t('settings.attachments') }}</h3>
<li>
<BooleanSetting
diff --git a/src/components/settings_modal/tabs/security_tab/security_tab.vue b/src/components/settings_modal/tabs/security_tab/security_tab.vue
@@ -149,6 +149,7 @@
</div>
<div>
<i18n-t
+ scope="global"
keypath="settings.new_alias_target"
tag="p"
>
@@ -184,6 +185,7 @@
<i18n-t
keypath="settings.move_account_target"
tag="p"
+ scope="global"
>
<template #example>
<code>
diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js
@@ -0,0 +1,835 @@
+import { ref, reactive, computed, watch, watchEffect, provide, getCurrentInstance } from 'vue'
+import { useStore } from 'vuex'
+import { get, set, unset, throttle } from 'lodash'
+
+import Select from 'src/components/select/select.vue'
+import SelectMotion from 'src/components/select/select_motion.vue'
+import Checkbox from 'src/components/checkbox/checkbox.vue'
+import ComponentPreview from 'src/components/component_preview/component_preview.vue'
+import StringSetting from '../../helpers/string_setting.vue'
+import ShadowControl from 'src/components/shadow_control/shadow_control.vue'
+import ColorInput from 'src/components/color_input/color_input.vue'
+import PaletteEditor from 'src/components/palette_editor/palette_editor.vue'
+import OpacityInput from 'src/components/opacity_input/opacity_input.vue'
+import RoundnessInput from 'src/components/roundness_input/roundness_input.vue'
+import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx'
+import Tooltip from 'src/components/tooltip/tooltip.vue'
+import ContrastRatio from 'src/components/contrast_ratio/contrast_ratio.vue'
+import Preview from '../theme_tab/theme_preview.vue'
+
+import VirtualDirectivesTab from './virtual_directives_tab.vue'
+
+import { init, findColor } from 'src/services/theme_data/theme_data_3.service.js'
+import {
+ getCssRules,
+ getScopedVersion
+} from 'src/services/theme_data/css_utils.js'
+import { serialize } from 'src/services/theme_data/iss_serializer.js'
+import { deserializeShadow, deserialize } from 'src/services/theme_data/iss_deserializer.js'
+import {
+ rgb2hex,
+ hex2rgb,
+ getContrastRatio
+} from 'src/services/color_convert/color_convert.js'
+import {
+ newImporter,
+ newExporter
+} from 'src/services/export_import/export_import.js'
+
+import { library } from '@fortawesome/fontawesome-svg-core'
+import {
+ faFloppyDisk,
+ faFolderOpen,
+ faFile,
+ faArrowsRotate,
+ faCheck
+} from '@fortawesome/free-solid-svg-icons'
+
+// helper for debugging
+// eslint-disable-next-line no-unused-vars
+const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x))
+
+// helper to make states comparable
+const normalizeStates = (states) => ['normal', ...(states?.filter(x => x !== 'normal') || [])].join(':')
+
+library.add(
+ faFile,
+ faFloppyDisk,
+ faFolderOpen,
+ faArrowsRotate,
+ faCheck
+)
+
+export default {
+ components: {
+ Select,
+ SelectMotion,
+ Checkbox,
+ Tooltip,
+ StringSetting,
+ ComponentPreview,
+ TabSwitcher,
+ ShadowControl,
+ ColorInput,
+ PaletteEditor,
+ OpacityInput,
+ RoundnessInput,
+ ContrastRatio,
+ Preview,
+ VirtualDirectivesTab
+ },
+ setup (props, context) {
+ const exports = {}
+ const store = useStore()
+ // All rules that are made by editor
+ const allEditedRules = ref(store.state.interface.styleDataUsed || {})
+ const styleDataUsed = computed(() => store.state.interface.styleDataUsed)
+
+ watch([styleDataUsed], (value) => {
+ onImport(store.state.interface.styleDataUsed)
+ }, { once: true })
+
+ exports.isActive = computed(() => {
+ const tabSwitcher = getCurrentInstance().parent.ctx
+ return tabSwitcher ? tabSwitcher.isActive('style') : false
+ })
+
+ // ## Meta stuff
+ exports.name = ref('')
+ exports.author = ref('')
+ exports.license = ref('')
+ exports.website = ref('')
+
+ const metaOut = computed(() => {
+ return [
+ '@meta {',
+ ` name: ${exports.name.value};`,
+ ` author: ${exports.author.value};`,
+ ` license: ${exports.license.value};`,
+ ` website: ${exports.website.value};`,
+ '}'
+ ].join('\n')
+ })
+
+ const metaRule = computed(() => ({
+ component: '@meta',
+ directives: {
+ name: exports.name.value,
+ author: exports.author.value,
+ license: exports.license.value,
+ website: exports.website.value
+ }
+ }))
+
+ // ## Palette stuff
+ const palettes = reactive([
+ {
+ name: 'default',
+ bg: '#121a24',
+ fg: '#182230',
+ text: '#b9b9ba',
+ link: '#d8a070',
+ accent: '#d8a070',
+ cRed: '#FF0000',
+ cBlue: '#0095ff',
+ cGreen: '#0fa00f',
+ cOrange: '#ffa500'
+ },
+ {
+ name: 'light',
+ bg: '#f2f6f9',
+ fg: '#d6dfed',
+ text: '#304055',
+ underlay: '#5d6086',
+ accent: '#f55b1b',
+ cBlue: '#0095ff',
+ cRed: '#d31014',
+ cGreen: '#0fa00f',
+ cOrange: '#ffa500',
+ border: '#d8e6f9'
+ }
+ ])
+ exports.palettes = palettes
+
+ // This is kinda dumb but you cannot "replace" reactive() object
+ // and so v-model simply fails when you try to chage (increase only?)
+ // length of the array. Since linter complains about mutating modelValue
+ // inside SelectMotion, the next best thing is to just wipe existing array
+ // and replace it with new one.
+
+ const onPalettesUpdate = (e) => {
+ palettes.splice(0, palettes.length)
+ palettes.push(...e)
+ }
+ exports.onPalettesUpdate = onPalettesUpdate
+
+ const selectedPaletteId = ref(0)
+ const selectedPalette = computed({
+ get () {
+ return palettes[selectedPaletteId.value]
+ },
+ set (newPalette) {
+ palettes[selectedPaletteId.value] = newPalette
+ }
+ })
+ exports.selectedPaletteId = selectedPaletteId
+ exports.selectedPalette = selectedPalette
+ provide('selectedPalette', selectedPalette)
+
+ watch([selectedPalette], () => updateOverallPreview())
+
+ exports.getNewPalette = () => ({
+ name: 'new palette',
+ bg: '#121a24',
+ fg: '#182230',
+ text: '#b9b9ba',
+ link: '#d8a070',
+ accent: '#d8a070',
+ cRed: '#FF0000',
+ cBlue: '#0095ff',
+ cGreen: '#0fa00f',
+ cOrange: '#ffa500'
+ })
+
+ // Raw format
+ const palettesRule = computed(() => {
+ return palettes.map(palette => {
+ const { name, ...rest } = palette
+ return {
+ component: '@palette',
+ variant: name,
+ directives: Object
+ .entries(rest)
+ .filter(([k, v]) => v && k)
+ .reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {})
+ }
+ })
+ })
+
+ // Text format
+ const palettesOut = computed(() => {
+ return palettes.map(({ name, ...palette }) => {
+ const entries = Object
+ .entries(palette)
+ .filter(([k, v]) => v && k)
+ .map(([slot, data]) => ` ${slot}: ${data};`)
+ .join('\n')
+
+ return `@palette.${name} {\n${entries}\n}`
+ }).join('\n\n')
+ })
+
+ // ## Components stuff
+ // Getting existing components
+ const componentsContext = require.context('src', true, /\.style.js(on)?$/)
+ const componentKeysAll = componentsContext.keys()
+ const componentsMap = new Map(
+ componentKeysAll
+ .map(
+ key => [key, componentsContext(key).default]
+ ).filter(([key, component]) => !component.virtual && !component.notEditable)
+ )
+ exports.componentsMap = componentsMap
+ const componentKeys = [...componentsMap.keys()]
+ exports.componentKeys = componentKeys
+
+ // Component list and selection
+ const selectedComponentKey = ref(componentsMap.keys().next().value)
+ exports.selectedComponentKey = selectedComponentKey
+
+ const selectedComponent = computed(() => componentsMap.get(selectedComponentKey.value))
+ const selectedComponentName = computed(() => selectedComponent.value.name)
+
+ // Selection basis
+ exports.selectedComponentVariants = computed(() => {
+ return Object.keys({ normal: null, ...(selectedComponent.value.variants || {}) })
+ })
+ exports.selectedComponentStates = computed(() => {
+ const all = Object.keys({ normal: null, ...(selectedComponent.value.states || {}) })
+ return all.filter(x => x !== 'normal')
+ })
+
+ // selection
+ const selectedVariant = ref('normal')
+ exports.selectedVariant = selectedVariant
+ const selectedState = reactive(new Set())
+ exports.selectedState = selectedState
+ exports.updateSelectedStates = (state, v) => {
+ if (v) {
+ selectedState.add(state)
+ } else {
+ selectedState.delete(state)
+ }
+ }
+
+ // Reset variant and state on component change
+ const updateSelectedComponent = () => {
+ selectedVariant.value = 'normal'
+ selectedState.clear()
+ }
+
+ watch(
+ selectedComponentName,
+ updateSelectedComponent
+ )
+
+ // ### Rules stuff aka meat and potatoes
+ // The native structure of separate rules and the child -> parent
+ // relation isn't very convenient for editor, we replace the array
+ // and child -> parent structure with map and parent -> child structure
+ const rulesToEditorFriendly = (rules, root = {}) => rules.reduce((acc, rule) => {
+ const { parent: rParent, component: rComponent } = rule
+ const parent = rParent ?? rule
+ const hasChildren = !!rParent
+ const child = hasChildren ? rule : null
+
+ const {
+ component: pComponent,
+ variant: pVariant = 'normal',
+ state: pState = [] // no relation to Intel CPUs whatsoever
+ } = parent
+
+ const pPath = `${hasChildren ? pComponent : rComponent}.${pVariant}.${normalizeStates(pState)}`
+
+ let output = get(acc, pPath)
+ if (!output) {
+ set(acc, pPath, {})
+ output = get(acc, pPath)
+ }
+
+ if (hasChildren) {
+ output._children = output._children ?? {}
+ const {
+ component: cComponent,
+ variant: cVariant = 'normal',
+ state: cState = [],
+ directives
+ } = child
+
+ const cPath = `${cComponent}.${cVariant}.${normalizeStates(cState)}`
+ set(output._children, cPath, { directives })
+ } else {
+ output.directives = parent.directives
+ }
+ return acc
+ }, root)
+
+ const editorFriendlyFallbackStructure = computed(() => {
+ const root = {}
+
+ componentKeys.forEach((componentKey) => {
+ const componentValue = componentsMap.get(componentKey)
+ const { defaultRules, name } = componentValue
+ rulesToEditorFriendly(
+ defaultRules.map((rule) => ({ ...rule, component: name })),
+ root
+ )
+ })
+
+ return root
+ })
+
+ // Checking whether component can support some "directives" which
+ // are actually virtual subcomponents, i.e. Text, Link etc
+ exports.componentHas = (subComponent) => {
+ return !!selectedComponent.value.validInnerComponents?.find(x => x === subComponent)
+ }
+
+ // Path for lodash's get and set
+ const getPath = (component, directive) => {
+ const pathSuffix = component ? `._children.${component}.normal.normal` : ''
+ const path = `${selectedComponentName.value}.${selectedVariant.value}.${normalizeStates([...selectedState])}${pathSuffix}.directives.${directive}`
+ return path
+ }
+
+ // Templates for directives
+ const isElementPresent = (component, directive, defaultValue = '') => computed({
+ get () {
+ return get(allEditedRules.value, getPath(component, directive)) != null
+ },
+ set (value) {
+ if (value) {
+ const fallback = get(
+ editorFriendlyFallbackStructure.value,
+ getPath(component, directive)
+ )
+ set(allEditedRules.value, getPath(component, directive), fallback ?? defaultValue)
+ } else {
+ unset(allEditedRules.value, getPath(component, directive))
+ }
+ exports.updateOverallPreview()
+ }
+ })
+
+ const getEditedElement = (component, directive, postProcess = x => x) => computed({
+ get () {
+ let usedRule
+ const fallback = editorFriendlyFallbackStructure.value
+ const real = allEditedRules.value
+ const path = getPath(component, directive)
+
+ usedRule = get(real, path) // get real
+ if (!usedRule) {
+ usedRule = get(fallback, path)
+ }
+
+ return postProcess(usedRule)
+ },
+ set (value) {
+ if (value) {
+ set(allEditedRules.value, getPath(component, directive), value)
+ } else {
+ unset(allEditedRules.value, getPath(component, directive))
+ }
+ exports.updateOverallPreview()
+ }
+ })
+
+ // All the editable stuff for the component
+ exports.editedBackgroundColor = getEditedElement(null, 'background')
+ exports.isBackgroundColorPresent = isElementPresent(null, 'background', '#FFFFFF')
+ exports.editedOpacity = getEditedElement(null, 'opacity')
+ exports.isOpacityPresent = isElementPresent(null, 'opacity', 1)
+ exports.editedRoundness = getEditedElement(null, 'roundness')
+ exports.isRoundnessPresent = isElementPresent(null, 'roundness', '0')
+ exports.editedTextColor = getEditedElement('Text', 'textColor')
+ exports.isTextColorPresent = isElementPresent('Text', 'textColor', '#000000')
+ exports.editedTextAuto = getEditedElement('Text', 'textAuto')
+ exports.isTextAutoPresent = isElementPresent('Text', 'textAuto', '#000000')
+ exports.editedLinkColor = getEditedElement('Link', 'textColor')
+ exports.isLinkColorPresent = isElementPresent('Link', 'textColor', '#000080')
+ exports.editedIconColor = getEditedElement('Icon', 'textColor')
+ exports.isIconColorPresent = isElementPresent('Icon', 'textColor', '#909090')
+ exports.editedBorderColor = getEditedElement('Border', 'textColor')
+ exports.isBorderColorPresent = isElementPresent('Border', 'textColor', '#909090')
+
+ const getContrast = (bg, text) => {
+ try {
+ const bgRgb = hex2rgb(bg)
+ const textRgb = hex2rgb(text)
+
+ const ratio = getContrastRatio(bgRgb, textRgb)
+ return {
+ // TODO this ideally should be part of <ContractRatio />
+ ratio,
+ text: ratio.toPrecision(3) + ':1',
+ // AA level, AAA level
+ aa: ratio >= 4.5,
+ aaa: ratio >= 7,
+ // same but for 18pt+ texts
+ laa: ratio >= 3,
+ laaa: ratio >= 4.5
+ }
+ } catch (e) {
+ console.warn('Failure computing contrast', e)
+ return { error: e }
+ }
+ }
+
+ const normalizeShadows = (shadows) => {
+ return shadows?.map(shadow => {
+ if (typeof shadow === 'object') {
+ return shadow
+ }
+ if (typeof shadow === 'string') {
+ try {
+ return deserializeShadow(shadow)
+ } catch (e) {
+ console.warn(e)
+ return shadow
+ }
+ }
+ return null
+ })
+ }
+ provide('normalizeShadows', normalizeShadows)
+
+ // Shadow is partially edited outside the ShadowControl
+ // for better space utilization
+ const editedShadow = getEditedElement(null, 'shadow', normalizeShadows)
+ exports.editedShadow = editedShadow
+ const editedSubShadowId = ref(null)
+ exports.editedSubShadowId = editedSubShadowId
+ const editedSubShadow = computed(() => {
+ if (editedShadow.value == null || editedSubShadowId.value == null) return null
+ return editedShadow.value[editedSubShadowId.value]
+ })
+ exports.editedSubShadow = editedSubShadow
+ exports.isShadowPresent = isElementPresent(null, 'shadow', [])
+ exports.onSubShadow = (id) => {
+ if (id != null) {
+ editedSubShadowId.value = id
+ } else {
+ editedSubShadow.value = null
+ }
+ }
+ exports.updateSubShadow = (axis, value) => {
+ if (!editedSubShadow.value || editedSubShadowId.value == null) return
+ const newEditedShadow = [...editedShadow.value]
+
+ newEditedShadow[editedSubShadowId.value] = {
+ ...newEditedShadow[editedSubShadowId.value],
+ [axis]: value
+ }
+
+ editedShadow.value = newEditedShadow
+ }
+ exports.isShadowTabOpen = ref(false)
+ exports.onTabSwitch = (tab) => {
+ exports.isShadowTabOpen.value = tab === 'shadow'
+ }
+
+ // component preview
+ exports.editorHintStyle = computed(() => {
+ const editorHint = selectedComponent.value.editor
+ const styles = []
+ if (editorHint && Object.keys(editorHint).length > 0) {
+ if (editorHint.aspect != null) {
+ styles.push(`aspect-ratio: ${editorHint.aspect} !important;`)
+ }
+ if (editorHint.border != null) {
+ styles.push(`border-width: ${editorHint.border}px !important;`)
+ }
+ }
+ return styles.join('; ')
+ })
+
+ const editorFriendlyToOriginal = computed(() => {
+ const resultRules = []
+
+ const convert = (component, data = {}, parent) => {
+ const variants = Object.entries(data || {})
+
+ variants.forEach(([variant, variantData]) => {
+ const states = Object.entries(variantData)
+
+ states.forEach(([jointState, stateData]) => {
+ const state = jointState.split(/:/g)
+ const result = {
+ component,
+ variant,
+ state,
+ directives: stateData.directives || {}
+ }
+
+ if (parent) {
+ result.parent = {
+ component: parent
+ }
+ }
+
+ resultRules.push(result)
+
+ // Currently we only support single depth for simplicity's sake
+ if (!parent) {
+ Object.entries(stateData._children || {}).forEach(([cName, child]) => convert(cName, child, component))
+ }
+ })
+ })
+ }
+
+ [...componentsMap.values()].forEach(({ name }) => {
+ convert(name, allEditedRules.value[name])
+ })
+
+ return resultRules
+ })
+
+ const allCustomVirtualDirectives = [...componentsMap.values()]
+ .map(c => {
+ return c
+ .defaultRules
+ .filter(c => c.component === 'Root')
+ .map(x => Object.entries(x.directives))
+ .flat()
+ })
+ .filter(x => x)
+ .flat()
+ .map(([name, value]) => {
+ const [valType, valVal] = value.split('|')
+ return {
+ name: name.substring(2),
+ valType: valType?.trim(),
+ value: valVal?.trim()
+ }
+ })
+
+ const virtualDirectives = ref(allCustomVirtualDirectives)
+ exports.virtualDirectives = virtualDirectives
+ exports.updateVirtualDirectives = (value) => {
+ virtualDirectives.value = value
+ }
+
+ // Raw format
+ const virtualDirectivesRule = computed(() => ({
+ component: 'Root',
+ directives: Object.fromEntries(
+ virtualDirectives.value.map(vd => [`--${vd.name}`, `${vd.valType} | ${vd.value}`])
+ )
+ }))
+
+ // Text format
+ const virtualDirectivesOut = computed(() => {
+ return [
+ 'Root {',
+ ...virtualDirectives.value
+ .filter(vd => vd.name && vd.valType && vd.value)
+ .map(vd => ` --${vd.name}: ${vd.valType} | ${vd.value};`),
+ '}'
+ ].join('\n')
+ })
+
+ exports.computeColor = (color) => {
+ let computedColor
+ try {
+ computedColor = findColor(color, { dynamicVars: dynamicVars.value, staticVars: staticVars.value })
+ if (computedColor) {
+ return rgb2hex(computedColor)
+ }
+ } catch (e) {
+ console.warn(e)
+ }
+ return null
+ }
+ provide('computeColor', exports.computeColor)
+
+ exports.contrast = computed(() => {
+ return getContrast(
+ exports.computeColor(previewColors.value.background),
+ exports.computeColor(previewColors.value.text)
+ )
+ })
+
+ // ## Export and Import
+ const styleExporter = newExporter({
+ filename: () => exports.name.value ?? 'pleroma_theme',
+ mime: 'text/plain',
+ extension: 'piss',
+ getExportedObject: () => exportStyleData.value
+ })
+
+ const onImport = parsed => {
+ const editorComponents = parsed.filter(x => x.component.startsWith('@'))
+ const rootComponent = parsed.find(x => x.component === 'Root')
+ const rules = parsed.filter(x => !x.component.startsWith('@') && x.component !== 'Root')
+ const metaIn = editorComponents.find(x => x.component === '@meta').directives
+ const palettesIn = editorComponents.filter(x => x.component === '@palette')
+
+ exports.name.value = metaIn.name
+ exports.license.value = metaIn.license
+ exports.author.value = metaIn.author
+ exports.website.value = metaIn.website
+
+ const newVirtualDirectives = Object
+ .entries(rootComponent.directives)
+ .map(([name, value]) => {
+ const [valType, valVal] = value.split('|').map(x => x.trim())
+ return { name: name.substring(2), valType, value: valVal }
+ })
+ virtualDirectives.value = newVirtualDirectives
+
+ onPalettesUpdate(palettesIn.map(x => ({ name: x.variant, ...x.directives })))
+
+ allEditedRules.value = rulesToEditorFriendly(rules)
+
+ exports.updateOverallPreview()
+ }
+
+ const styleImporter = newImporter({
+ accept: '.piss',
+ parser (string) { return deserialize(string) },
+ onImportFailure (result) {
+ console.error('Failure importing style:', result)
+ this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_theme_imported', level: 'error' })
+ },
+ onImport
+ })
+
+ // Raw format
+ const exportRules = computed(() => [
+ metaRule.value,
+ ...palettesRule.value,
+ virtualDirectivesRule.value,
+ ...editorFriendlyToOriginal.value
+ ])
+
+ // Text format
+ const exportStyleData = computed(() => {
+ return [
+ metaOut.value,
+ palettesOut.value,
+ virtualDirectivesOut.value,
+ serialize(editorFriendlyToOriginal.value)
+ ].join('\n\n')
+ })
+
+ exports.clearStyle = () => {
+ onImport(store.state.interface.styleDataUsed)
+ }
+
+ exports.exportStyle = () => {
+ styleExporter.exportData()
+ }
+
+ exports.importStyle = () => {
+ styleImporter.importData()
+ }
+
+ exports.applyStyle = () => {
+ store.dispatch('setStyleCustom', exportRules.value)
+ }
+
+ const overallPreviewRules = ref([])
+ exports.overallPreviewRules = overallPreviewRules
+
+ const overallPreviewCssRules = ref([])
+ watchEffect(throttle(() => {
+ try {
+ overallPreviewCssRules.value = getScopedVersion(
+ getCssRules(overallPreviewRules.value),
+ '#edited-style-preview'
+ ).join('\n')
+ } catch (e) {
+ console.error(e)
+ }
+ }, 500))
+
+ exports.overallPreviewCssRules = overallPreviewCssRules
+
+ const updateOverallPreview = throttle(() => {
+ try {
+ overallPreviewRules.value = init({
+ inputRuleset: [
+ ...exportRules.value,
+ {
+ component: 'Root',
+ directives: Object.fromEntries(
+ Object
+ .entries(selectedPalette.value)
+ .filter(([k, v]) => k && v && k !== 'name')
+ .map(([k, v]) => [`--${k}`, `color | ${v}`])
+ )
+ }
+ ],
+ ultimateBackgroundColor: '#000000',
+ debug: true
+ }).eager
+ } catch (e) {
+ console.error('Could not compile preview theme', e)
+ return null
+ }
+ }, 5000)
+ //
+ // Apart from "hover" we can't really show how component looks like in
+ // certain states, so we have to fake them.
+ const simulatePseudoSelectors = (css, prefix) => css
+ .replace(prefix, '.component-preview .preview-block')
+ .replace(':active', '.preview-active')
+ .replace(':hover', '.preview-hover')
+ .replace(':active', '.preview-active')
+ .replace(':focus', '.preview-focus')
+ .replace(':focus-within', '.preview-focus-within')
+ .replace(':disabled', '.preview-disabled')
+
+ const previewRules = computed(() => {
+ const filtered = overallPreviewRules.value.filter(r => {
+ const componentMatch = r.component === selectedComponentName.value
+ const parentComponentMatch = r.parent?.component === selectedComponentName.value
+ if (!componentMatch && !parentComponentMatch) return false
+ const rule = parentComponentMatch ? r.parent : r
+ if (rule.component !== selectedComponentName.value) return false
+ if (rule.variant !== selectedVariant.value) return false
+ const ruleState = new Set(rule.state.filter(x => x !== 'normal'))
+ const differenceA = [...ruleState].filter(x => !selectedState.has(x))
+ const differenceB = [...selectedState].filter(x => !ruleState.has(x))
+ return (differenceA.length + differenceB.length) === 0
+ })
+ const sorted = [...filtered]
+ .filter(x => x.component === selectedComponentName.value)
+ .sort((a, b) => {
+ const aSelectorLength = a.selector.split(/ /g).length
+ const bSelectorLength = b.selector.split(/ /g).length
+ return aSelectorLength - bSelectorLength
+ })
+
+ const prefix = sorted[0].selector
+
+ return filtered.filter(x => x.selector.startsWith(prefix))
+ })
+
+ exports.previewClass = computed(() => {
+ const selectors = []
+ if (!!selectedComponent.value.variants?.normal || selectedVariant.value !== 'normal') {
+ selectors.push(selectedComponent.value.variants[selectedVariant.value])
+ }
+ if (selectedState.size > 0) {
+ selectedState.forEach(state => {
+ const original = selectedComponent.value.states[state]
+ selectors.push(simulatePseudoSelectors(original))
+ })
+ }
+ return selectors.map(x => x.substring(1)).join('')
+ })
+
+ exports.previewCss = computed(() => {
+ try {
+ const prefix = previewRules.value[0].selector
+ const scoped = getCssRules(previewRules.value).map(x => simulatePseudoSelectors(x, prefix))
+ return scoped.join('\n')
+ } catch (e) {
+ console.error('Invalid ruleset', e)
+ return null
+ }
+ })
+
+ const dynamicVars = computed(() => {
+ return previewRules.value[0].dynamicVars
+ })
+
+ const staticVars = computed(() => {
+ const rootComponent = overallPreviewRules.value.find(r => {
+ return r.component === 'Root'
+ })
+ const rootDirectivesEntries = Object.entries(rootComponent.directives)
+ const directives = {}
+ rootDirectivesEntries
+ .filter(([k, v]) => k.startsWith('--') && v.startsWith('color | '))
+ .map(([k, v]) => [k.substring(2), v.substring('color | '.length)])
+ .forEach(([k, v]) => {
+ directives[k] = findColor(v, { dynamicVars: {}, staticVars: directives })
+ })
+ return directives
+ })
+ provide('staticVars', staticVars)
+ exports.staticVars = staticVars
+
+ const previewColors = computed(() => {
+ const stacked = dynamicVars.value.stacked
+ const background = typeof stacked === 'string' ? stacked : rgb2hex(stacked)
+ return {
+ text: previewRules.value.find(r => r.component === 'Text')?.virtualDirectives['--text'],
+ link: previewRules.value.find(r => r.component === 'Link')?.virtualDirectives['--link'],
+ border: previewRules.value.find(r => r.component === 'Border')?.virtualDirectives['--border'],
+ icon: previewRules.value.find(r => r.component === 'Icon')?.virtualDirectives['--icon'],
+ background
+ }
+ })
+ exports.previewColors = previewColors
+ exports.updateOverallPreview = updateOverallPreview
+
+ updateOverallPreview()
+
+ watch(
+ [
+ allEditedRules.value,
+ palettes,
+ selectedPalette,
+ selectedState,
+ selectedVariant
+ ],
+ updateOverallPreview
+ )
+
+ return exports
+ }
+}
diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.scss b/src/components/settings_modal/tabs/style_tab/style_tab.scss
@@ -0,0 +1,264 @@
+.StyleTab {
+ .style-control {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: baseline;
+ margin-bottom: 0.5em;
+
+ .label {
+ margin-right: 0.5em;
+ flex: 1 1 0;
+ line-height: 2;
+ min-height: 2em;
+ }
+
+ &.suboption {
+ margin-left: 1em;
+ }
+
+ .color-input {
+ flex: 0 0 0;
+ }
+
+ input,
+ select {
+ min-width: 3em;
+ margin: 0;
+ flex: 0;
+
+ &[type="number"] {
+ min-width: 9em;
+
+ &.-small {
+ min-width: 5em;
+ }
+ }
+
+ &[type="range"] {
+ flex: 1;
+ min-width: 9em;
+ align-self: center;
+ margin: 0 0.25em;
+ }
+
+ &[type="checkbox"] + i {
+ height: 1.1em;
+ align-self: center;
+ }
+ }
+ }
+
+ .meta-preview {
+ display: grid;
+ grid-template:
+ "meta meta preview preview"
+ "meta meta preview preview"
+ "meta meta preview preview"
+ "meta meta preview preview";
+ grid-gap: 0.5em;
+ grid-template-columns: min-content min-content 6fr max-content;
+
+ ul.setting-list {
+ padding: 0;
+ margin: 0;
+ display: grid;
+ grid-template-rows: subgrid;
+ grid-area: meta;
+
+ > li {
+ margin: 0;
+ }
+
+ .meta-field {
+ margin: 0;
+
+ .setting-label {
+ display: inline-block;
+ margin-bottom: 0.5em;
+ }
+ }
+ }
+
+ #edited-style-preview {
+ grid-area: preview;
+ }
+ }
+
+ .setting-item {
+ padding-bottom: 0;
+
+ .btn {
+ padding: 0 0.5em;
+ }
+
+ &:not(:first-child) {
+ margin-top: 0.5em;
+ }
+
+ &:not(:last-child) {
+ margin-bottom: 0.5em;
+ }
+ }
+
+ .list-editor {
+ display: grid;
+ grid-template-areas:
+ "label editor"
+ "selector editor"
+ "movement editor";
+ grid-template-columns: 10em 1fr;
+ grid-template-rows: auto 1fr auto;
+ grid-gap: 0.5em;
+
+ .list-edit-area {
+ grid-area: editor;
+ }
+
+ .list-select {
+ grid-area: selector;
+ margin: 0;
+
+ &-label {
+ font-weight: bold;
+ grid-area: label;
+ margin: 0;
+ align-self: baseline;
+ }
+
+ &-movement {
+ grid-area: movement;
+ margin: 0;
+ }
+ }
+ }
+
+ .palette-editor {
+ width: min-content;
+
+ .list-edit-area {
+ display: grid;
+ align-self: baseline;
+ grid-template-rows: subgrid;
+ grid-template-columns: 1fr;
+ }
+
+ .palette-editor-single {
+ grid-row: 2 / span 2;
+ }
+ }
+
+ .variables-editor {
+ .variable-selector {
+ display: grid;
+ grid-template-columns: auto 1fr auto 10em;
+ grid-template-rows: subgrid;
+ align-items: baseline;
+ grid-gap: 0 0.5em;
+ }
+
+ .list-edit-area {
+ display: grid;
+ grid-template-rows: subgrid;
+ }
+
+ .shadow-control {
+ grid-row: 2 / span 2;
+ }
+ }
+
+ .component-editor {
+ display: grid;
+ grid-template-columns: 6fr 3fr 4fr;
+ grid-template-rows: auto auto 1fr;
+ grid-gap: 0.5em;
+ grid-template-areas:
+ "component component variant"
+ "state state state"
+ "preview settings settings";
+
+ .component-selector {
+ grid-area: component;
+ align-self: center;
+ }
+
+ .component-selector,
+ .state-selector,
+ .variant-selector {
+ display: grid;
+ grid-template-columns: 1fr minmax(1fr, 10em);
+ grid-template-rows: auto;
+ grid-auto-flow: column;
+ grid-gap: 0.5em;
+ align-items: baseline;
+
+ > label:not(.Select) {
+ font-weight: bold;
+ justify-self: right;
+ }
+ }
+
+ .state-selector {
+ grid-area: state;
+ grid-template-columns: minmax(min-content, 7em) 1fr;
+ }
+
+ .variant-selector {
+ grid-area: variant;
+ }
+
+ .state-selector-list {
+ display: grid;
+ list-style: none;
+ grid-auto-flow: dense;
+ grid-template-columns: repeat(5, minmax(min-content, 1fr));
+ grid-auto-rows: 1fr;
+ grid-gap: 0.5em;
+ padding: 0;
+ margin: 0;
+ }
+
+ .preview-container {
+ --border: none;
+ --shadow: none;
+ --roundness: none;
+
+ grid-area: preview;
+ }
+
+ .component-settings {
+ grid-area: settings;
+ }
+
+ .editor-tab {
+ display: grid;
+ grid-template-columns: 1fr 2em;
+ grid-column-gap: 0.5em;
+ align-items: center;
+ grid-auto-rows: min-content;
+ grid-auto-flow: dense;
+ border-left: 1px solid var(--border);
+ border-right: 1px solid var(--border);
+ border-bottom: 1px solid var(--border);
+ padding: 0.5em;
+ }
+
+ .shadow-tab {
+ grid-template-columns: 1fr;
+ justify-items: center;
+ }
+ }
+}
+
+.extra-content {
+ .style-actions-container {
+ width: 100%;
+ display: flex;
+ justify-content: end;
+
+ .style-actions {
+ display: grid;
+ grid-template-columns: repeat(4, minmax(7em, 1fr));
+ grid-gap: 0.25em;
+ }
+ }
+}
diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.vue b/src/components/settings_modal/tabs/style_tab/style_tab.vue
@@ -0,0 +1,402 @@
+<script src="./style_tab.js">
+</script>
+
+<template>
+ <div class="StyleTab">
+ <div class="setting-item heading">
+ <h2> {{ $t('settings.style.themes3.editor.title') }} </h2>
+ <div class="meta-preview">
+ <!-- eslint-disable vue/no-v-text-v-html-on-component -->
+ <!-- eslint-disable vue/no-v-html -->
+ <component
+ :is="'style'"
+ v-html="overallPreviewCssRules"
+ />
+ <!-- eslint-enable vue/no-v-html -->
+ <!-- eslint-enable vue/no-v-text-v-html-on-component -->
+ <Preview id="edited-style-preview" />
+ <teleport
+ v-if="isActive"
+ to="#unscrolled-content"
+ >
+ <div class="style-actions-container">
+ <div class="style-actions">
+ <button
+ class="btn button-default button-new"
+ @click="clearStyle"
+ >
+ <FAIcon icon="arrows-rotate" />
+ {{ $t('settings.style.themes3.editor.reset_style') }}
+ </button>
+ <button
+ class="btn button-default button-load"
+ @click="importStyle"
+ >
+ <FAIcon icon="folder-open" />
+ {{ $t('settings.style.themes3.editor.load_style') }}
+ </button>
+ <button
+ class="btn button-default button-save"
+ @click="exportStyle"
+ >
+ <FAIcon icon="floppy-disk" />
+ {{ $t('settings.style.themes3.editor.save_style') }}
+ </button>
+ <button
+ class="btn button-default button-apply"
+ @click="applyStyle"
+ >
+ <FAIcon icon="check" />
+ {{ $t('settings.style.themes3.editor.apply_preview') }}
+ </button>
+ </div>
+ </div>
+ </teleport>
+ <ul class="setting-list style-metadata">
+ <li>
+ <StringSetting
+ v-model="name"
+ class="meta-field"
+ >
+ {{ $t('settings.style.themes3.editor.style_name') }}
+ </StringSetting>
+ </li>
+ <li>
+ <StringSetting
+ v-model="author"
+ class="meta-field"
+ >
+ {{ $t('settings.style.themes3.editor.style_author') }}
+ </StringSetting>
+ </li>
+ <li>
+ <StringSetting
+ v-model="license"
+ class="meta-field"
+ >
+ {{ $t('settings.style.themes3.editor.style_license') }}
+ </StringSetting>
+ </li>
+ <li>
+ <StringSetting
+ v-model="website"
+ class="meta-field"
+ >
+ {{ $t('settings.style.themes3.editor.style_website') }}
+ </StringSetting>
+ </li>
+ </ul>
+ </div>
+ </div>
+ <tab-switcher>
+ <div
+ key="component"
+ class="setting-item component-editor"
+ :label="$t('settings.style.themes3.editor.component_tab')"
+ >
+ <div class="component-selector">
+ <label for="component-selector">
+ {{ $t('settings.style.themes3.editor.component_selector') }}
+ {{ ' ' }}
+ </label>
+ <Select
+ id="component-selector"
+ v-model="selectedComponentKey"
+ >
+ <option
+ v-for="key in componentKeys"
+ :key="'component-' + key"
+ :value="key"
+ >
+ {{ componentsMap.get(key).name }}
+ </option>
+ </Select>
+ </div>
+ <div
+ v-if="selectedComponentVariants.length > 1"
+ class="variant-selector"
+ >
+ <label for="variant-selector">
+ {{ $t('settings.style.themes3.editor.variant_selector') }}
+ </label>
+ <Select
+ v-model="selectedVariant"
+ >
+ <option
+ v-for="variant in selectedComponentVariants"
+ :key="'component-variant-' + variant"
+ :value="variant"
+ >
+ {{ variant }}
+ </option>
+ </Select>
+ </div>
+ <div
+ v-if="selectedComponentStates.length > 0"
+ class="state-selector"
+ >
+ <label>
+ {{ $t('settings.style.themes3.editor.states_selector') }}
+ </label>
+ <ul
+ class="state-selector-list"
+ >
+ <li
+ v-for="state in selectedComponentStates"
+ :key="'component-state-' + state"
+ >
+ <Checkbox
+ :value="selectedState.has(state)"
+ @update:modelValue="(v) => updateSelectedStates(state, v)"
+ >
+ {{ state }}
+ </Checkbox>
+ </li>
+ </ul>
+ </div>
+ <div class="preview-container">
+ <!-- eslint-disable vue/no-v-html vue/no-v-text-v-html-on-component -->
+ <component
+ :is="'style'"
+ v-html="previewCss"
+ />
+ <!-- eslint-enable vue/no-v-html vue/no-v-text-v-html-on-component -->
+ <ComponentPreview
+ class="component-preview"
+ :show-text="componentHas('Text')"
+ :shadow-control="isShadowTabOpen"
+ :preview-class="previewClass"
+ :preview-style="editorHintStyle"
+ :preview-css="previewCss"
+ :disabled="!editedSubShadow && typeof editedShadow !== 'string'"
+ :shadow="editedSubShadow"
+ :no-color-control="true"
+ @update:shadow="({ axis, value }) => updateSubShadow(axis, value)"
+ />
+ </div>
+ <tab-switcher
+ ref="tabSwitcher"
+ class="component-settings"
+ :on-switch="onTabSwitch"
+ >
+ <div
+ key="main"
+ class="editor-tab"
+ :label="$t('settings.style.themes3.editor.main_tab')"
+ >
+ <ColorInput
+ v-model="editedBackgroundColor"
+ name="component-background-color"
+ :fallback="computeColor(editedBackgroundColor) ?? previewColors.background"
+ :disabled="!isBackgroundColorPresent"
+ :label="$t('settings.style.themes3.editor.background')"
+ :hide-optional-checkbox="true"
+ />
+ <Tooltip :text="$t('settings.style.themes3.editor.include_in_rule')">
+ <Checkbox v-model="isBackgroundColorPresent" />
+ </Tooltip>
+ <ColorInput
+ v-if="componentHas('Text')"
+ v-model="editedTextColor"
+ name="component-text-color"
+ :fallback="computeColor(editedTextColor) ?? previewColors.text"
+ :label="$t('settings.style.themes3.editor.text_color')"
+ :disabled="!isTextColorPresent"
+ :hide-optional-checkbox="true"
+ />
+ <Tooltip
+ v-if="componentHas('Text')"
+ :text="$t('settings.style.themes3.editor.include_in_rule')"
+ >
+ <Checkbox v-model="isTextColorPresent" />
+ </Tooltip>
+ <div
+ v-if="componentHas('Text')"
+ class="style-control suboption"
+ >
+ <label
+ for="textAuto"
+ class="label"
+ :class="{ faint: !isTextAutoPresent }"
+ >
+ {{ $t('settings.style.themes3.editor.text_auto.label') }}
+ </label>
+ <Select
+ id="textAuto"
+ v-model="editedTextAuto"
+ :disabled="!isTextAutoPresent"
+ >
+ <option value="no-preserve">
+ {{ $t('settings.style.themes3.editor.text_auto.no-preserve') }}
+ </option>
+ <option value="no-auto">
+ {{ $t('settings.style.themes3.editor.text_auto.no-auto') }}
+ </option>
+ <option value="preserve">
+ {{ $t('settings.style.themes3.editor.text_auto.preserve') }}
+ </option>
+ </Select>
+ </div>
+ <Tooltip
+ v-if="componentHas('Text')"
+ :text="$t('settings.style.themes3.editor.include_in_rule')"
+ >
+ <Checkbox v-model="isTextAutoPresent" />
+ </Tooltip>
+ <div
+ v-if="componentHas('Text')"
+ class="style-control suboption"
+ >
+ <label class="label">
+ {{ $t('settings.style.themes3.editor.contrast') }}
+ </label>
+ <ContrastRatio
+ :show-ratio="true"
+ :contrast="contrast"
+ />
+ </div>
+ <div v-if="componentHas('Text')" />
+ <ColorInput
+ v-if="componentHas('Link')"
+ v-model="editedLinkColor"
+ name="component-link-color"
+ :fallback="computeColor(editedLinkColor) ?? previewColors.link"
+ :label="$t('settings.style.themes3.editor.link_color')"
+ :disabled="!isLinkColorPresent"
+ :hide-optional-checkbox="true"
+ />
+ <Tooltip
+ v-if="componentHas('Link')"
+ :text="$t('settings.style.themes3.editor.include_in_rule')"
+ >
+ <Checkbox v-model="isLinkColorPresent" />
+ </Tooltip>
+ <ColorInput
+ v-if="componentHas('Icon')"
+ v-model="editedIconColor"
+ name="component-icon-color"
+ :fallback="computeColor(editedIconColor) ?? previewColors.icon"
+ :label="$t('settings.style.themes3.editor.icon_color')"
+ :disabled="!isIconColorPresent"
+ :hide-optional-checkbox="true"
+ />
+ <Tooltip
+ v-if="componentHas('Icon')"
+ :text="$t('settings.style.themes3.editor.include_in_rule')"
+ >
+ <Checkbox v-model="isIconColorPresent" />
+ </Tooltip>
+ <ColorInput
+ v-if="componentHas('Border')"
+ v-model="editedBorderColor"
+ name="component-border-color"
+ :fallback="computeColor(editedBorderColor) ?? previewColors.border"
+ :label="$t('settings.style.themes3.editor.border_color')"
+ :disabled="!isBorderColorPresent"
+ :hide-optional-checkbox="true"
+ />
+ <Tooltip
+ v-if="componentHas('Border')"
+ :text="$t('settings.style.themes3.editor.include_in_rule')"
+ >
+ <Checkbox v-model="isBorderColorPresent" />
+ </Tooltip>
+ <OpacityInput
+ v-model="editedOpacity"
+ name="component-opacity"
+ :disabled="!isOpacityPresent"
+ :label="$t('settings.style.themes3.editor.opacity')"
+ />
+ <Tooltip :text="$t('settings.style.themes3.editor.include_in_rule')">
+ <Checkbox v-model="isOpacityPresent" />
+ </Tooltip>
+ <RoundnessInput
+ v-model="editedRoundness"
+ name="component-roundness"
+ :disabled="!isRoundnessPresent"
+ :label="$t('settings.style.themes3.editor.roundness')"
+ />
+ <Tooltip :text="$t('settings.style.themes3.editor.include_in_rule')">
+ <Checkbox v-model="isRoundnessPresent" />
+ </Tooltip>
+ </div>
+ <div
+ key="shadow"
+ class="editor-tab shadow-tab"
+ :label="$t('settings.style.themes3.editor.shadows_tab')"
+ >
+ <Checkbox
+ v-model="isShadowPresent"
+ class="style-control"
+ >
+ {{ $t('settings.style.themes3.editor.include_in_rule') }}
+ </checkbox>
+ <ShadowControl
+ v-model="editedShadow"
+ :disabled="!isShadowPresent"
+ :no-preview="true"
+ :compact="true"
+ :static-vars="staticVars"
+ @subShadowSelected="onSubShadow"
+ />
+ </div>
+ </tab-switcher>
+ </div>
+ <div
+ key="palette"
+ :label="$t('settings.style.themes3.editor.palette_tab')"
+ class="setting-item list-editor palette-editor"
+ >
+ <label
+ class="list-select-label"
+ for="palette-selector"
+ >
+ {{ $t('settings.style.themes3.palette.label') }}
+ {{ ' ' }}
+ </label>
+ <Select
+ id="palette-selector"
+ v-model="selectedPaletteId"
+ class="list-select"
+ size="4"
+ >
+ <option
+ v-for="(p, index) in palettes"
+ :key="p.name"
+ :value="index"
+ >
+ {{ p.name }}
+ </option>
+ </Select>
+ <SelectMotion
+ class="list-select-movement"
+ :model-value="palettes"
+ :selected-id="selectedPaletteId"
+ :get-add-value="getNewPalette"
+ @update:modelValue="onPalettesUpdate"
+ @update:selectedId="e => selectedPaletteId = e"
+ />
+ <div class="list-edit-area">
+ <StringSetting
+ v-model="selectedPalette.name"
+ class="palette-name-input"
+ >
+ {{ $t('settings.style.themes3.palette.name_label') }}
+ </StringSetting>
+ <PaletteEditor
+ v-model="selectedPalette"
+ class="palette-editor-single"
+ />
+ </div>
+ </div>
+ <VirtualDirectivesTab
+ key="variables"
+ :label="$t('settings.style.themes3.editor.variables_tab')"
+ :model-value="virtualDirectives"
+ @update:modelValue="updateVirtualDirectives"
+ />
+ </tab-switcher>
+ </div>
+</template>
+
+<style src="./style_tab.scss" lang="scss"></style>
diff --git a/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.js b/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.js
@@ -0,0 +1,132 @@
+import { ref, computed, watch, inject } from 'vue'
+
+import Select from 'src/components/select/select.vue'
+import SelectMotion from 'src/components/select/select_motion.vue'
+import ShadowControl from 'src/components/shadow_control/shadow_control.vue'
+import ColorInput from 'src/components/color_input/color_input.vue'
+
+import { serializeShadow } from 'src/services/theme_data/iss_serializer.js'
+
+// helper for debugging
+// eslint-disable-next-line no-unused-vars
+const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x))
+
+export default {
+ components: {
+ Select,
+ SelectMotion,
+ ShadowControl,
+ ColorInput
+ },
+ props: ['modelValue'],
+ emits: ['update:modelValue'],
+ setup (props, context) {
+ const exports = {}
+ const emit = context.emit
+
+ exports.emit = emit
+ exports.computeColor = inject('computeColor')
+ exports.staticVars = inject('staticVars')
+
+ const selectedVirtualDirectiveId = ref(0)
+ exports.selectedVirtualDirectiveId = selectedVirtualDirectiveId
+
+ const selectedVirtualDirective = computed({
+ get () {
+ return props.modelValue[selectedVirtualDirectiveId.value]
+ },
+ set (value) {
+ const newVD = [...props.modelValue]
+ newVD[selectedVirtualDirectiveId.value] = value
+
+ emit('update:modelValue', newVD)
+ }
+ })
+ exports.selectedVirtualDirective = selectedVirtualDirective
+
+ exports.selectedVirtualDirectiveValType = computed({
+ get () {
+ return props.modelValue[selectedVirtualDirectiveId.value].valType
+ },
+ set (value) {
+ const newValType = value
+ let newValue
+ switch (value) {
+ case 'shadow':
+ newValue = '0 0 0 #000000 / 1'
+ break
+ case 'color':
+ newValue = '#000000'
+ break
+ default:
+ newValue = 'none'
+ }
+ const newName = props.modelValue[selectedVirtualDirectiveId.value].name
+ props.modelValue[selectedVirtualDirectiveId.value] = {
+ name: newName,
+ value: newValue,
+ valType: newValType
+ }
+ }
+ })
+
+ const draftVirtualDirectiveValid = ref(true)
+ const draftVirtualDirective = ref({})
+ exports.draftVirtualDirective = draftVirtualDirective
+ const normalizeShadows = inject('normalizeShadows')
+
+ watch(
+ selectedVirtualDirective,
+ (directive) => {
+ switch (directive.valType) {
+ case 'shadow': {
+ if (Array.isArray(directive.value)) {
+ draftVirtualDirective.value = normalizeShadows(directive.value)
+ } else {
+ const splitShadow = directive.value.split(/,/g).map(x => x.trim())
+ draftVirtualDirective.value = normalizeShadows(splitShadow)
+ }
+ break
+ }
+ case 'color':
+ draftVirtualDirective.value = directive.value
+ break
+ default:
+ draftVirtualDirective.value = directive.value
+ break
+ }
+ },
+ { immediate: true }
+ )
+
+ watch(
+ draftVirtualDirective,
+ (directive) => {
+ try {
+ switch (selectedVirtualDirective.value.valType) {
+ case 'shadow': {
+ props.modelValue[selectedVirtualDirectiveId.value].value =
+ directive.map(x => serializeShadow(x)).join(', ')
+ break
+ }
+ default:
+ props.modelValue[selectedVirtualDirectiveId.value].value = directive
+ }
+ draftVirtualDirectiveValid.value = true
+ } catch (e) {
+ console.error('Invalid virtual directive value', e)
+ draftVirtualDirectiveValid.value = false
+ }
+ },
+ { immediate: true }
+ )
+
+ exports.getNewVirtualDirective = () => ({
+ name: 'newDirective',
+ valType: 'generic',
+ value: 'foobar'
+ })
+
+ return exports
+ }
+}
diff --git a/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.vue b/src/components/settings_modal/tabs/style_tab/virtual_directives_tab.vue
@@ -0,0 +1,84 @@
+<script src="./virtual_directives_tab.js"></script>
+
+<template>
+ <div class="setting-item list-editor variables-editor">
+ <label
+ class="list-select-label"
+ for="variables-selector"
+ >
+ {{ $t('settings.style.themes3.editor.variables.label') }}
+ {{ ' ' }}
+ </label>
+ <Select
+ id="variables-selector"
+ v-model="selectedVirtualDirectiveId"
+ class="list-select"
+ size="20"
+ >
+ <option
+ v-for="(p, index) in modelValue"
+ :key="p.name"
+ :value="index"
+ >
+ {{ p.name }}
+ </option>
+ </Select>
+ <SelectMotion
+ class="list-select-movement"
+ :model-value="modelValue"
+ :selected-id="selectedVirtualDirectiveId"
+ :get-add-value="getNewVirtualDirective"
+ @update:modelValue="e => emit('update:modelValue', e)"
+ @update:selectedId="e => selectedVirtualDirectiveId = e"
+ />
+ <div class="list-edit-area">
+ <div class="variable-selector">
+ <label
+ class="variable-name-label"
+ for="variables-selector"
+ >
+ {{ $t('settings.style.themes3.editor.variables.name_label') }}
+ {{ ' ' }}
+ </label>
+ <input
+ v-model="selectedVirtualDirective.name"
+ class="input"
+ >
+ <label
+ class="variable-type-label"
+ for="variables-selector"
+ >
+ {{ $t('settings.style.themes3.editor.variables.type_label') }}
+ {{ ' ' }}
+ </label>
+ <Select
+ v-model="selectedVirtualDirectiveValType"
+ >
+ <option value="shadow">
+ {{ $t('settings.style.themes3.editor.variables.type_shadow') }}
+ </option>
+ <option value="color">
+ {{ $t('settings.style.themes3.editor.variables.type_color') }}
+ </option>
+ <option value="generic">
+ {{ $t('settings.style.themes3.editor.variables.type_generic') }}
+ </option>
+ </Select>
+ </div>
+ <ShadowControl
+ v-if="selectedVirtualDirectiveValType === 'shadow'"
+ v-model="draftVirtualDirective"
+ :static-vars="staticVars"
+ :compact="true"
+ />
+ <ColorInput
+ name="virtual-directive-color"
+ v-if="selectedVirtualDirectiveValType === 'color'"
+ v-model="draftVirtualDirective"
+ :fallback="computeColor(draftVirtualDirective)"
+ :label="$t('settings.style.themes3.editor.variables.virtual_color')"
+ :hide-optional-checkbox="true"
+ />
+ </div>
+ </div>
+</template>
diff --git a/src/components/settings_modal/tabs/theme_tab/theme_preview.vue b/src/components/settings_modal/tabs/theme_tab/theme_preview.vue
@@ -3,12 +3,12 @@
<div class="underlay underlay-preview" />
<div class="panel dummy">
<div class="panel-heading">
- <div class="title">
+ <h1 class="title">
{{ $t('settings.style.preview.header') }}
<span class="badge -notification">
99
</span>
- </div>
+ </h1>
<span class="faint">
{{ $t('settings.style.preview.header_faint') }}
</span>
diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.js b/src/components/settings_modal/tabs/theme_tab/theme_tab.js
@@ -5,9 +5,6 @@ import {
relativeLuminance
} from 'src/services/color_convert/color_convert.js'
import {
- getThemes
-} from 'src/services/style_setter/style_setter.js'
-import {
newImporter,
newExporter
} from 'src/services/export_import/export_import.js'
@@ -123,31 +120,24 @@ export default {
}
},
created () {
- const self = this
+ const currentIndex = this.$store.state.instance.themesIndex
- getThemes()
- .then((promises) => {
- return Promise.all(
- Object.entries(promises)
- .map(([k, v]) => v.then(res => [k, res]))
- )
- })
- .then(themes => themes.reduce((acc, [k, v]) => {
- if (v) {
- return {
- ...acc,
- [k]: v
- }
- } else {
- return acc
- }
- }, {}))
- .then((themesComplete) => {
- self.availableStyles = themesComplete
- })
+ let promise
+ if (currentIndex) {
+ promise = Promise.resolve(currentIndex)
+ } else {
+ promise = this.$store.dispatch('fetchThemesIndex')
+ }
+
+ promise.then(themesIndex => {
+ Object
+ .values(themesIndex)
+ .forEach(themeFunc => {
+ themeFunc().then(themeData => themeData && this.availableStyles.push(themeData))
+ })
+ })
},
mounted () {
- this.loadThemeFromLocalStorage()
if (typeof this.shadowSelected === 'undefined') {
this.shadowSelected = this.shadowsAvailable[0]
}
@@ -305,6 +295,9 @@ export default {
return {}
}
},
+ themeDataUsed () {
+ return this.$store.state.interface.themeDataUsed
+ },
shadowsAvailable () {
return Object.keys(DEFAULT_SHADOWS).sort()
},
@@ -314,7 +307,18 @@ export default {
},
set (val) {
if (val) {
- this.shadowsLocal[this.shadowSelected] = this.currentShadowFallback.map(_ => Object.assign({}, _))
+ this.shadowsLocal[this.shadowSelected] = (this.currentShadowFallback || [])
+ .map(s => ({
+ name: null,
+ x: 0,
+ y: 0,
+ blur: 0,
+ spread: 0,
+ inset: false,
+ color: '#000000',
+ alpha: 1,
+ ...s
+ }))
} else {
delete this.shadowsLocal[this.shadowSelected]
}
@@ -401,9 +405,6 @@ export default {
forceUseSource = false
) {
this.dismissWarning()
- if (!source && !theme) {
- throw new Error('Can\'t load theme: empty')
- }
const version = (origin === 'localStorage' && !theme.colors)
? 'l1'
: fileVersion
@@ -479,22 +480,11 @@ export default {
this.dismissWarning()
},
loadThemeFromLocalStorage (confirmLoadSource = false, forceSnapshot = false) {
- const {
- customTheme: theme,
- customThemeSource: source
- } = this.$store.getters.mergedConfig
- if (!theme && !source) {
- // Anon user or never touched themes
- this.loadTheme(
- this.$store.state.instance.themeData,
- 'defaults',
- confirmLoadSource
- )
- } else {
+ const theme = this.themeDataUsed?.source
+ if (theme) {
this.loadTheme(
{
- theme,
- source: forceSnapshot ? theme : source
+ theme
},
'localStorage',
confirmLoadSource
@@ -713,6 +703,9 @@ export default {
}
},
watch: {
+ themeDataUsed () {
+ this.loadThemeFromLocalStorage()
+ },
currentRadii () {
try {
this.previewTheme.radii = generateRadii({ radii: this.currentRadii }).theme.radii
diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.scss b/src/components/settings_modal/tabs/theme_tab/theme_tab.scss
@@ -25,7 +25,9 @@
margin-bottom: 5px;
.label {
+ margin-right: 1em;
flex: 1;
+ line-height: 2;
}
.opt {
@@ -43,20 +45,23 @@
flex: 0;
&[type="number"] {
- min-width: 5em;
+ min-width: 9em;
+
+ &.-small {
+ min-width: 5em;
+ }
}
&[type="range"] {
flex: 1;
- min-width: 3em;
- align-self: flex-start;
+ min-width: 9em;
+ align-self: center;
+ margin: 0 0.5em;
}
- }
- &.disabled {
- input,
- select {
- opacity: 0.5;
+ &[type="checkbox"] + i {
+ height: 1.1em;
+ align-self: center;
}
}
}
diff --git a/src/components/settings_modal/tabs/theme_tab/theme_tab.vue b/src/components/settings_modal/tabs/theme_tab/theme_tab.vue
@@ -123,10 +123,13 @@
</div>
</div>
- <!-- eslint-disable vue/no-v-text-v-html-on-component -->
- <component :is="'style'" v-html="themeV3Preview"/>
- <!-- eslint-enable vue/no-v-text-v-html-on-component -->
- <preview id="theme-preview"/>
+ <!-- eslint-disable vue/no-v-html vue/no-v-text-v-html-on-component -->
+ <component
+ :is="'style'"
+ v-html="themeV3Preview"
+ />
+ <!-- eslint-enable vue/no-v-html vue/no-v-text-v-html-on-component -->
+ <preview id="theme-preview" />
<div>
<button
@@ -184,14 +187,14 @@
name="accentColor"
:fallback="previewTheme.colors?.link"
:label="$t('settings.accent')"
- :show-optional-tickbox="typeof linkColorLocal !== 'undefined'"
+ :show-optional-checkbox="typeof linkColorLocal !== 'undefined'"
/>
<ColorInput
v-model="linkColorLocal"
name="linkColor"
:fallback="previewTheme.colors?.accent"
:label="$t('settings.links')"
- :show-optional-tickbox="typeof accentColorLocal !== 'undefined'"
+ :show-optional-checkbox="typeof accentColorLocal !== 'undefined'"
/>
<ContrastRatio :contrast="previewContrast.bgLink" />
</div>
@@ -934,24 +937,14 @@
</Select>
</div>
<div class="override">
- <label
- for="override"
- class="label"
- >
- {{ $t('settings.style.shadows.override') }}
- </label>
- {{ ' ' }}
- <input
+ <Checkbox
id="override"
v-model="currentShadowOverriden"
name="override"
class="input-override"
- type="checkbox"
>
- <label
- class="checkbox-label"
- for="override"
- />
+ {{ $t('settings.style.shadows.override') }}
+ </Checkbox>
</div>
<button
class="btn button-default"
@@ -962,38 +955,12 @@
</div>
<ShadowControl
v-model="currentShadow"
- :ready="!!currentShadowFallback"
+ :separate-inset="shadowSelected === 'avatar' || shadowSelected === 'avatarStatus'"
:fallback="currentShadowFallback"
+ :static-vars="previewTheme.colors"
+ :compact="true"
/>
- <div v-if="shadowSelected === 'avatar' || shadowSelected === 'avatarStatus'">
- <i18n-t
- scope="global"
- keypath="settings.style.shadows.filter_hint.always_drop_shadow"
- tag="p"
- >
- <code>filter: drop-shadow()</code>
- </i18n-t>
- <p>{{ $t('settings.style.shadows.filter_hint.avatar_inset') }}</p>
- <i18n-t
- scope="global"
- keypath="settings.style.shadows.filter_hint.drop_shadow_syntax"
- tag="p"
- >
- <code>drop-shadow</code>
- <code>spread-radius</code>
- <code>inset</code>
- </i18n-t>
- <i18n-t
- scope="global"
- keypath="settings.style.shadows.filter_hint.inset_classic"
- tag="p"
- >
- <code>box-shadow</code>
- </i18n-t>
- <p>{{ $t('settings.style.shadows.filter_hint.spread_zero') }}</p>
- </div>
</div>
-
<div
:label="$t('settings.style.fonts._tab_label')"
class="fonts-container"
diff --git a/src/components/settings_modal/tabs/version_tab.js b/src/components/settings_modal/tabs/version_tab.js
@@ -1,22 +1,17 @@
-import { extractCommit } from 'src/services/version/version.service'
-
const pleromaFeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma-fe/commit/'
-const pleromaBeCommitUrl = 'https://git.pleroma.social/pleroma/pleroma/commit/'
const VersionTab = {
data () {
const instance = this.$store.state.instance
return {
backendVersion: instance.backendVersion,
+ backendRepository: instance.backendRepository,
frontendVersion: instance.frontendVersion
}
},
computed: {
frontendVersionLink () {
return pleromaFeCommitUrl + this.frontendVersion
- },
- backendVersionLink () {
- return pleromaBeCommitUrl + extractCommit(this.backendVersion)
}
}
}
diff --git a/src/components/settings_modal/tabs/version_tab.vue b/src/components/settings_modal/tabs/version_tab.vue
@@ -7,7 +7,7 @@
<ul class="option-list">
<li>
<a
- :href="backendVersionLink"
+ :href="backendRepository"
target="_blank"
>{{ backendVersion }}</a>
</li>
diff --git a/src/components/shadow_control/shadow_control.js b/src/components/shadow_control/shadow_control.js
@@ -1,9 +1,17 @@
-import ColorInput from '../color_input/color_input.vue'
-import OpacityInput from '../opacity_input/opacity_input.vue'
-import Select from '../select/select.vue'
-import { getCssShadow } from '../../services/theme_data/theme_data.service.js'
-import { hex2rgb } from '../../services/color_convert/color_convert.js'
+import ColorInput from 'src/components/color_input/color_input.vue'
+import OpacityInput from 'src/components/opacity_input/opacity_input.vue'
+import Select from 'src/components/select/select.vue'
+import SelectMotion from 'src/components/select/select_motion.vue'
+import Checkbox from 'src/components/checkbox/checkbox.vue'
+import Popover from 'src/components/popover/popover.vue'
+import ComponentPreview from 'src/components/component_preview/component_preview.vue'
+import { rgb2hex } from 'src/services/color_convert/color_convert.js'
+import { serializeShadow } from 'src/services/theme_data/iss_serializer.js'
+import { deserializeShadow } from 'src/services/theme_data/iss_deserializer.js'
+import { getCssShadow, getCssShadowFilter } from 'src/services/theme_data/css_utils.js'
+import { findShadow, findColor } from 'src/services/theme_data/theme_data_3.service.js'
import { library } from '@fortawesome/fontawesome-svg-core'
+import { throttle, flattenDeep } from 'lodash'
import {
faTimes,
faChevronDown,
@@ -18,105 +26,155 @@ library.add(
faPlus
)
-const toModel = (object = {}) => ({
- x: 0,
- y: 0,
- blur: 0,
- spread: 0,
- inset: false,
- color: '#000000',
- alpha: 1,
- ...object
-})
+const toModel = (input) => {
+ if (typeof input === 'object') {
+ return {
+ x: 0,
+ y: 0,
+ blur: 0,
+ spread: 0,
+ inset: false,
+ color: '#000000',
+ alpha: 1,
+ ...input
+ }
+ } else if (typeof input === 'string') {
+ return input
+ }
+}
export default {
- // 'modelValue' and 'Fallback' can be undefined, but if they are
- // initially vue won't detect it when they become something else
- // therefore i'm using "ready" which should be passed as true when
- // data becomes available
props: [
- 'modelValue', 'fallback', 'ready'
+ 'modelValue',
+ 'fallback',
+ 'separateInset',
+ 'noPreview',
+ 'disabled',
+ 'staticVars',
+ 'compact'
],
- emits: ['update:modelValue'],
+ emits: ['update:modelValue', 'subShadowSelected'],
data () {
return {
selectedId: 0,
- // TODO there are some bugs regarding display of array (it's not getting updated when deleting for some reason)
- cValue: (this.modelValue || this.fallback || []).map(toModel)
+ invalid: false
}
},
components: {
ColorInput,
OpacityInput,
- Select
- },
- methods: {
- add () {
- this.cValue.push(toModel(this.selected))
- this.selectedId = this.cValue.length - 1
- },
- del () {
- this.cValue.splice(this.selectedId, 1)
- this.selectedId = this.cValue.length === 0 ? undefined : Math.max(this.selectedId - 1, 0)
- },
- moveUp () {
- const movable = this.cValue.splice(this.selectedId, 1)[0]
- this.cValue.splice(this.selectedId - 1, 0, movable)
- this.selectedId -= 1
- },
- moveDn () {
- const movable = this.cValue.splice(this.selectedId, 1)[0]
- this.cValue.splice(this.selectedId + 1, 0, movable)
- this.selectedId += 1
- }
- },
- beforeUpdate () {
- this.cValue = this.modelValue || this.fallback
+ Select,
+ SelectMotion,
+ Checkbox,
+ Popover,
+ ComponentPreview
},
computed: {
- anyShadows () {
- return this.cValue.length > 0
- },
- anyShadowsFallback () {
- return this.fallback.length > 0
- },
- selected () {
- if (this.ready && this.anyShadows) {
- return this.cValue[this.selectedId]
- } else {
- return toModel({})
+ cValue: {
+ get () {
+ return (this.modelValue ?? this.fallback ?? []).map(toModel)
+ },
+ set (newVal) {
+ this.$emit('update:modelValue', newVal)
}
},
- currentFallback () {
- if (this.ready && this.anyShadowsFallback) {
- return this.fallback[this.selectedId]
- } else {
- return toModel({})
+ selectedType: {
+ get () {
+ return typeof this.selected
+ },
+ set (newType) {
+ this.selected = toModel(newType === 'object' ? {} : '')
}
},
- moveUpValid () {
- return this.ready && this.selectedId > 0
- },
- moveDnValid () {
- return this.ready && this.selectedId < this.cValue.length - 1
+ selected: {
+ get () {
+ const selected = this.cValue[this.selectedId]
+ if (selected && typeof selected === 'object') {
+ return { ...selected }
+ } else if (typeof selected === 'string') {
+ return selected
+ }
+ return null
+ },
+ set (value) {
+ this.cValue[this.selectedId] = toModel(value)
+ this.$emit('update:modelValue', this.cValue)
+ }
},
present () {
- return this.ready &&
- typeof this.cValue[this.selectedId] !== 'undefined' &&
- !this.usingFallback
+ return this.selected != null && this.modelValue != null
+ },
+ shadowsAreNull () {
+ return this.modelValue == null
},
- usingFallback () {
- return typeof this.modelValue === 'undefined'
+ currentFallback () {
+ return this.fallback?.[this.selectedId]
},
- rgb () {
- return hex2rgb(this.selected.color)
+ getColorFallback () {
+ if (this.staticVars && this.selected?.color) {
+ try {
+ const computedColor = findColor(this.selected.color, { dynamicVars: {}, staticVars: this.staticVars }, true)
+ if (computedColor) return rgb2hex(computedColor)
+ return null
+ } catch (e) {
+ console.warn(e)
+ return null
+ }
+ } else {
+ return this.currentFallback?.color
+ }
},
style () {
- return this.ready
- ? {
- boxShadow: getCssShadow(this.fallback)
+ try {
+ let result
+ const serialized = this.cValue.map(x => serializeShadow(x)).join(',')
+ serialized.split(/,/).map(deserializeShadow) // validate
+ const expandedShadow = flattenDeep(findShadow(this.cValue, { dynamicVars: {}, staticVars: this.staticVars }))
+ const fixedShadows = expandedShadow.map(x => ({ ...x, color: console.log(x) || rgb2hex(x.color) }))
+
+ if (this.separateInset) {
+ result = {
+ filter: getCssShadowFilter(fixedShadows),
+ boxShadow: getCssShadow(fixedShadows, true)
+ }
+ } else {
+ result = {
+ boxShadow: getCssShadow(fixedShadows)
}
- : {}
+ }
+ this.invalid = false
+ return result
+ } catch (e) {
+ console.error('Invalid shadow', e)
+ this.invalid = true
+ }
}
+ },
+ watch: {
+ selected (value) {
+ this.$emit('subShadowSelected', this.selectedId)
+ }
+ },
+ methods: {
+ getNewSubshadow () {
+ return toModel(this.selected)
+ },
+ onSelectChange (id) {
+ this.selectedId = id
+ },
+ getSubshadowLabel (shadow, index) {
+ if (typeof shadow === 'object') {
+ return shadow?.name ?? this.$t('settings.style.shadows.shadow_id', { value: index })
+ } else if (typeof shadow === 'string') {
+ return shadow || this.$t('settings.style.shadows.empty_expression')
+ }
+ },
+ updateProperty: throttle(function (prop, value) {
+ this.cValue[this.selectedId][prop] = value
+ if (prop === 'inset' && value === false && this.separateInset) {
+ this.cValue[this.selectedId].spread = 0
+ }
+ this.$emit('update:modelValue', this.cValue)
+ }, 100)
}
}
diff --git a/src/components/shadow_control/shadow_control.scss b/src/components/shadow_control/shadow_control.scss
@@ -0,0 +1,122 @@
+.ShadowControl {
+ display: grid;
+ grid-template-columns: 10em 1fr 1fr;
+ grid-template-rows: 1fr;
+ grid-template-areas: "selector preview tweak";
+ grid-gap: 0.5em;
+ justify-content: stretch;
+
+ &.-compact {
+ grid-template-columns: 10em 1fr;
+ grid-template-rows: auto auto;
+ grid-template-areas:
+ "selector preview"
+ "tweak tweak";
+
+ &.-no-preview {
+ grid-template-columns: 1fr;
+ grid-template-rows: 10em 1fr;
+ grid-template-areas:
+ "selector"
+ "tweak";
+ }
+ }
+
+ .shadow-switcher {
+ grid-area: selector;
+ order: 1;
+ flex: 1 0 6em;
+ min-width: 6em;
+ margin-right: 0.125em;
+ display: flex;
+ flex-direction: column;
+
+ .shadow-list {
+ flex: 1 0 auto;
+ }
+ }
+
+ .shadow-tweak {
+ grid-area: tweak;
+ order: 3;
+ flex: 2 0 10em;
+ min-width: 10em;
+ margin-left: 0.125em;
+ margin-right: 0.125em;
+ display: grid;
+ grid-template-rows: auto 1fr;
+ grid-gap: 0.25em;
+
+ /* hack */
+ .input-boolean {
+ flex: 1;
+ display: flex;
+
+ .label {
+ flex: 1;
+ }
+ }
+
+ .input-string {
+ flex: 1 0 5em;
+ }
+
+ .shadow-expression {
+ width: 100%;
+ height: 100%;
+ }
+
+ .id-control {
+ align-items: stretch;
+
+ .shadow-switcher,
+ .btn {
+ min-width: 1px;
+ margin-right: 5px;
+ }
+
+ .btn {
+ padding: 0 0.4em;
+ margin: 0 0.1em;
+ }
+ }
+ }
+
+ &.-no-preview {
+ grid-template-columns: 10em 1fr;
+ grid-template-rows: 1fr;
+ grid-template-areas: "selector tweak";
+
+ .shadow-tweak {
+ order: 0;
+ flex: 2 0 8em;
+ max-width: 100%;
+ }
+
+ .input-range {
+ min-width: 5em;
+ }
+ }
+
+ .inset-alert {
+ padding: 0.25em 0.5em;
+ }
+
+ &.disabled {
+ .inset-alert {
+ opacity: 0.2;
+ }
+ }
+
+ .shadow-preview {
+ grid-area: preview;
+ min-width: 25em;
+ margin-left: 0.125em;
+ align-self: start;
+ justify-self: center;
+ }
+}
+
+.inset-tooltip {
+ max-width: 30em;
+}
diff --git a/src/components/shadow_control/shadow_control.vue b/src/components/shadow_control/shadow_control.vue
@@ -1,326 +1,238 @@
<template>
<div
- class="shadow-control"
- :class="{ disabled: !present }"
+ class="ShadowControl label shadow-control"
+ :class="{ disabled: disabled || !present, '-no-preview': noPreview, '-compact': compact }"
>
- <div class="shadow-preview-container">
- <div
- :disabled="!present"
- class="y-shift-control"
+ <ComponentPreview
+ v-if="!noPreview"
+ :invalid="invalid"
+ class="shadow-preview"
+ :shadow-control="true"
+ :shadow="selected"
+ :preview-style="style"
+ :disabled="disabled || !present"
+ @update:shadow="({ axis, value }) => updateProperty(axis, value)"
+ />
+ <div class="shadow-switcher">
+ <Select
+ id="shadow-list"
+ v-model="selectedId"
+ class="shadow-list"
+ size="4"
+ :disabled="disabled || shadowsAreNull"
>
- <input
- v-model="selected.y"
- :disabled="!present"
- class="input input-number"
- type="number"
+ <option
+ v-for="(shadow, index) in cValue"
+ :key="index"
+ :value="index"
+ :class="{ '-active': index === Number(selectedId) }"
>
- <div class="wrap">
+ {{ getSubshadowLabel(shadow, index) }}
+ </option>
+ </Select>
+ <SelectMotion
+ v-model="cValue"
+ :selected-id="selectedId"
+ :get-add-value="getNewSubshadow"
+ :disabled="disabled"
+ @update:selectedId="onSelectChange"
+ />
+ </div>
+ <div class="shadow-tweak">
+ <Select
+ v-model="selectedType"
+ :disabled="disabled || !present"
+ >
+ <option value="object">
+ {{ $t('settings.style.shadows.raw') }}
+ </option>
+ <option value="string">
+ {{ $t('settings.style.shadows.expression') }}
+ </option>
+ </Select>
+ <template v-if="selectedType === 'string'">
+ <textarea
+ v-model="selected"
+ class="input shadow-expression"
+ :disabled="disabled || shadowsAreNull"
+ :class="{disabled: disabled || shadowsAreNull}"
+ />
+ </template>
+ <template v-else-if="selectedType === 'object'">
+ <div
+ :class="{ disabled: disabled || !present }"
+ class="name-control style-control"
+ >
+ <label
+ for="name"
+ class="label"
+ :class="{ faint: disabled || !present }"
+ >
+ {{ $t('settings.style.shadows.name') }}
+ </label>
<input
- v-model="selected.y"
- :disabled="!present"
+ id="name"
+ :value="selected?.name"
+ :disabled="disabled || !present"
+ :class="{ disabled: disabled || !present }"
+ name="name"
+ class="input input-string"
+ @input="e => updateProperty('name', e.target.value)"
+ >
+ </div>
+ <div
+ :disabled="disabled || !present"
+ class="inset-control style-control"
+ >
+ <Checkbox
+ id="inset"
+ :value="selected?.inset"
+ :disabled="disabled || !present"
+ name="inset"
+ class="input-inset input-boolean"
+ @input="e => updateProperty('inset', e.target.checked)"
+ >
+ <template #before>
+ {{ $t('settings.style.shadows.inset') }}
+ </template>
+ </Checkbox>
+ </div>
+ <div
+ :disabled="disabled || !present"
+ :class="{ disabled: disabled || !present }"
+ class="blur-control style-control"
+ >
+ <label
+ for="blur"
+ class="label"
+ :class="{ faint: disabled || !present }"
+ >
+ {{ $t('settings.style.shadows.blur') }}
+ </label>
+ <input
+ id="blur"
+ :value="selected?.blur"
+ :disabled="disabled || !present"
+ :class="{ disabled: disabled || !present }"
+ name="blur"
class="input input-range"
type="range"
max="20"
- min="-20"
+ min="0"
+ @input="e => updateProperty('blur', e.target.value)"
+ >
+ <input
+ :value="selected?.blur"
+ class="input input-number -small"
+ :disabled="disabled || !present"
+ :class="{ disabled: disabled || !present }"
+ type="number"
+ min="0"
+ @input="e => updateProperty('blur', e.target.value)"
>
</div>
- </div>
- <div class="preview-window">
<div
- class="preview-block"
- :style="style"
- />
- </div>
- <div
- :disabled="!present"
- class="x-shift-control"
- >
- <input
- v-model="selected.x"
- :disabled="!present"
- class="input input-number"
- type="number"
+ class="spread-control style-control"
+ :class="{ disabled: disabled || !present || (separateInset && !selected?.inset) }"
>
- <div class="wrap">
+ <label
+ for="spread"
+ class="label"
+ :class="{ faint: disabled || !present || (separateInset && !selected?.inset) }"
+ >
+ {{ $t('settings.style.shadows.spread') }}
+ </label>
<input
- v-model="selected.x"
- :disabled="!present"
+ id="spread"
+ :value="selected?.spread"
+ :class="{ disabled: disabled || !present || (separateInset && !selected?.inset) }"
+ :disabled="disabled || !present || (separateInset && !selected?.inset)"
+ name="spread"
class="input input-range"
type="range"
max="20"
min="-20"
+ @input="e => updateProperty('spread', e.target.value)"
>
- </div>
- </div>
- </div>
-
- <div class="shadow-tweak">
- <div
- :disabled="usingFallback"
- class="id-control style-control"
- >
- <Select
- id="shadow-switcher"
- v-model="selectedId"
- class="shadow-switcher"
- :disabled="!ready || usingFallback"
- >
- <option
- v-for="(shadow, index) in cValue"
- :key="index"
- :value="index"
+ <input
+ :value="selected?.spread"
+ class="input input-number -small"
+ :class="{ disabled: disabled || !present || (separateInset && !selected?.inset) }"
+ :disabled="disabled || !present || (separateInset && !selected?.inset)"
+ type="number"
+ @input="e => updateProperty('spread', e.target.value)"
>
- {{ $t('settings.style.shadows.shadow_id', { value: index }) }}
- </option>
- </Select>
- <button
- class="btn button-default"
- :disabled="!ready || !present"
- @click="del"
- >
- <FAIcon
- fixed-width
- icon="times"
- />
- </button>
- <button
- class="btn button-default"
- :disabled="!moveUpValid"
- @click="moveUp"
- >
- <FAIcon
- fixed-width
- icon="chevron-up"
- />
- </button>
- <button
- class="btn button-default"
- :disabled="!moveDnValid"
- @click="moveDn"
- >
- <FAIcon
- fixed-width
- icon="chevron-down"
- />
- </button>
- <button
- class="btn button-default"
- :disabled="usingFallback"
- @click="add"
- >
- <FAIcon
- fixed-width
- icon="plus"
- />
- </button>
- </div>
- <div
- :disabled="!present"
- class="inset-control style-control"
- >
- <label
- for="inset"
- class="label"
- >
- {{ $t('settings.style.shadows.inset') }}
- </label>
- <input
- id="inset"
- v-model="selected.inset"
- :disabled="!present"
- name="inset"
- class="input -checkbox input-inset visible-for-screenreader-only"
- type="checkbox"
- >
- <label
- class="checkbox-label"
- for="inset"
- :aria-hidden="true"
+ </div>
+ <ColorInput
+ :model-value="selected?.color"
+ :disabled="disabled || !present"
+ :label="$t('settings.style.common.color')"
+ :fallback="getColorFallback"
+ :show-optional-checkbox="false"
+ name="shadow"
+ @update:modelValue="e => updateProperty('color', e)"
/>
- </div>
- <div
- :disabled="!present"
- class="blur-control style-control"
- >
- <label
- for="spread"
- class="label"
- >
- {{ $t('settings.style.shadows.blur') }}
- </label>
- <input
- id="blur"
- v-model="selected.blur"
- :disabled="!present"
- name="blur"
- class="input input-range"
- type="range"
- max="20"
- min="0"
- >
- <input
- v-model="selected.blur"
- :disabled="!present"
- class="input input-number"
- type="number"
- min="0"
- >
- </div>
- <div
- :disabled="!present"
- class="spread-control style-control"
- >
- <label
- for="spread"
- class="label"
- >
- {{ $t('settings.style.shadows.spread') }}
- </label>
- <input
- id="spread"
- v-model="selected.spread"
- :disabled="!present"
- name="spread"
- class="input input-range"
- type="range"
- max="20"
- min="-20"
+ <OpacityInput
+ :model-value="selected?.alpha"
+ :disabled="disabled || !present"
+ @update:modelValue="e => updateProperty('alpha', e)"
+ />
+ <i18n-t
+ scope="global"
+ keypath="settings.style.shadows.hintV3"
+ :class="{ faint: disabled || !present }"
+ tag="p"
>
- <input
- v-model="selected.spread"
- :disabled="!present"
- class="input input-number"
- type="number"
+ <code>--variable,mod</code>
+ </i18n-t>
+ <Popover
+ v-if="separateInset"
+ trigger="hover"
>
- </div>
- <ColorInput
- v-model="selected.color"
- :disabled="!present"
- :label="$t('settings.style.common.color')"
- :fallback="currentFallback.color"
- :show-optional-tickbox="false"
- name="shadow"
- />
- <OpacityInput
- v-model="selected.alpha"
- :disabled="!present"
- />
- <i18n-t
- scope="global"
- keypath="settings.style.shadows.hintV3"
- tag="p"
- >
- <code>--variable,mod</code>
- </i18n-t>
+ <template #trigger>
+ <div
+ class="inset-alert alert warning"
+ >
+ <FAIcon icon="exclamation-triangle" />
+
+ {{ $t('settings.style.shadows.filter_hint.avatar_inset_short') }}
+ </div>
+ </template>
+ <template #content>
+ <div class="inset-tooltip tooltip">
+ <i18n-t
+ scope="global"
+ keypath="settings.style.shadows.filter_hint.always_drop_shadow"
+ tag="p"
+ >
+ <code>filter: drop-shadow()</code>
+ </i18n-t>
+ <p>{{ $t('settings.style.shadows.filter_hint.avatar_inset') }}</p>
+ <i18n-t
+ scope="global"
+ keypath="settings.style.shadows.filter_hint.drop_shadow_syntax"
+ tag="p"
+ >
+ <code>drop-shadow</code>
+ <code>spread-radius</code>
+ <code>inset</code>
+ </i18n-t>
+ <i18n-t
+ scope="global"
+ keypath="settings.style.shadows.filter_hint.inset_classic"
+ tag="p"
+ >
+ <code>box-shadow</code>
+ </i18n-t>
+ <p>{{ $t('settings.style.shadows.filter_hint.spread_zero') }}</p>
+ </div>
+ </template>
+ </Popover>
+ </template>
</div>
</div>
</template>
<script src="./shadow_control.js"></script>
-<style lang="scss">
-.shadow-control {
- display: flex;
- flex-wrap: wrap;
- justify-content: center;
- margin-bottom: 1em;
-
- .shadow-preview-container,
- .shadow-tweak {
- margin: 5px 6px 0 0;
- }
-
- .shadow-preview-container {
- flex: 0;
- display: flex;
- flex-wrap: wrap;
-
- input[type="number"] {
- width: 5em;
- min-width: 2em;
- }
-
- .x-shift-control,
- .y-shift-control {
- display: flex;
- flex: 0;
-
- &[disabled="disabled"] * {
- opacity: 0.5;
- }
- }
-
- .x-shift-control {
- align-items: flex-start;
- }
-
- .x-shift-control .wrap,
- input[type="range"] {
- margin: 0;
- width: 15em;
- height: 2em;
- }
-
- .y-shift-control {
- flex-direction: column;
- align-items: flex-end;
-
- .wrap {
- width: 2em;
- height: 15em;
- }
-
- input[type="range"] {
- transform-origin: 1em 1em;
- transform: rotate(90deg);
- }
- }
-
- .preview-window {
- flex: 1;
- background-color: #999;
- display: flex;
- align-items: center;
- justify-content: center;
- background-image:
- linear-gradient(45deg, #666 25%, transparent 25%),
- linear-gradient(-45deg, #666 25%, transparent 25%),
- linear-gradient(45deg, transparent 75%, #666 75%),
- linear-gradient(-45deg, transparent 75%, #666 75%);
- background-size: 20px 20px;
- background-position: 0 0, 0 10px, 10px -10px, -10px 0;
- border-radius: var(--roundness);
-
- .preview-block {
- width: 33%;
- height: 33%;
- border-radius: var(--roundness);
- }
- }
- }
-
- .shadow-tweak {
- flex: 1;
- min-width: 280px;
-
- .id-control {
- align-items: stretch;
-
- .shadow-switcher {
- flex: 1;
- }
-
- .shadow-switcher,
- .btn {
- min-width: 1px;
- margin-right: 5px;
- }
-
- .btn {
- padding: 0 0.4em;
- margin: 0 0.1em;
- }
- }
- }
-}
-</style>
+<style src="./shadow_control.scss" lang="scss"></style>
diff --git a/src/components/shout_panel/shout_panel.vue b/src/components/shout_panel/shout_panel.vue
@@ -9,14 +9,14 @@
:class="{ 'shout-heading': floating }"
@click.stop.prevent="togglePanel"
>
- <div class="title">
+ <h1 class="title">
{{ $t('shoutbox.title') }}
<FAIcon
v-if="floating"
icon="times"
class="close-icon"
/>
- </div>
+ </h1>
</div>
<div class="panel-body shout-window">
<div
diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue
@@ -77,6 +77,21 @@
</router-link>
</li>
<li
+ v-if="currentUser"
+ @click="toggleDrawer"
+ >
+ <router-link
+ :to="{ name: 'bookmarks' }"
+ class="menu-item"
+ >
+ <FAIcon
+ fixed-width
+ class="fa-scale-110 fa-old-padding"
+ icon="bookmark"
+ /> {{ $t("nav.bookmarks") }}
+ </router-link>
+ </li>
+ <li
v-if="currentUser && pleromaChatMessagesAvailable"
@click="toggleDrawer"
>
diff --git a/src/components/status/status.scss b/src/components/status/status.scss
@@ -72,7 +72,7 @@
text-overflow: ellipsis;
--_still_image-label-scale: 0.25;
- --emoji-size: 14px;
+ --emoji-size: 1em;
}
.status-favicon {
@@ -281,6 +281,7 @@
overflow: hidden;
display: flex;
flex-wrap: nowrap;
+ gap: 1ex;
& .status-username,
& .mute-thread,
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
@@ -37,16 +37,23 @@
{{ $t('status.sensitive_muted') }}
</small>
<small
- v-if="showReasonMutedThread"
+ v-if="muteBotStatuses && botStatus"
class="mute-thread"
>
- {{ $t('status.thread_muted') }}
+ {{ $t('status.bot_muted') }}
</small>
<small
- v-if="showReasonMutedThread && muteWordHits.length > 0"
+ v-if="showReasonMutedThread"
class="mute-thread"
>
- {{ $t('status.thread_muted_and_words') }}
+ <span>
+ {{ $t('status.thread_muted') }}
+ </span>
+ <span
+ v-if="muteWordHits.length > 0"
+ >
+ {{ $t('status.thread_muted_and_words') }}
+ </span>
</small>
<small
class="mute-words"
@@ -304,44 +311,57 @@
v-if="isReply"
class="glued-label reply-glued-label"
>
- <StatusPopover
- v-if="!isPreview"
- :status-id="status.parent_visible && status.in_reply_to_status_id"
- class="reply-to-popover"
- style="min-width: 0;"
- :class="{ '-strikethrough': !status.parent_visible }"
+ <i18n-t
+ keypath="status.reply_to_with_arg"
>
- <button
- class="button-unstyled reply-to"
- :aria-label="$t('tool_tip.reply')"
- @click.prevent="gotoOriginal(status.in_reply_to_status_id)"
- >
- <FAIcon
- class="fa-scale-110 fa-old-padding"
- icon="reply"
- flip="horizontal"
- />
- {{ ' ' }}
+ <template #replyToWithIcon>
+ <StatusPopover
+ v-if="!isPreview"
+ :status-id="status.parent_visible && status.in_reply_to_status_id"
+ class="reply-to-popover"
+ style="min-width: 0"
+ :class="{ '-strikethrough': !status.parent_visible }"
+ >
+ <button
+ class="button-unstyled reply-to"
+ :aria-label="$t('tool_tip.reply')"
+ @click.prevent="gotoOriginal(status.in_reply_to_status_id)"
+ >
+ <i18n-t keypath="status.reply_to_with_icon">
+ <template #icon>
+ <FAIcon
+ class="fa-scale-110 fa-old-padding"
+ icon="reply"
+ flip="horizontal"
+ />
+ </template>
+ <template #replyTo>
+ <span
+ class="reply-to-text"
+ >
+ {{ $t('status.reply_to') }}
+ </span>
+ </template>
+ </i18n-t>
+ </button>
+ </StatusPopover>
+
<span
- class="reply-to-text"
+ v-else
+ class="reply-to-no-popover"
>
- {{ $t('status.reply_to') }}
+ <span class="reply-to-text">{{ $t('status.reply_to') }}</span>
</span>
- </button>
- </StatusPopover>
-
- <span
- v-else
- class="reply-to-no-popover"
- >
- <span class="reply-to-text">{{ $t('status.reply_to') }}</span>
- </span>
- <MentionLink
- :content="replyToName"
- :url="replyProfileLink"
- :user-id="status.in_reply_to_user_id"
- :user-screen-name="status.in_reply_to_screen_name"
- />
+ </template>
+ <template #user>
+ <MentionLink
+ :content="replyToName"
+ :url="replyProfileLink"
+ :user-id="status.in_reply_to_user_id"
+ :user-screen-name="status.in_reply_to_screen_name"
+ />
+ </template>
+ </i18n-t>
</span>
<!-- This little wrapper is made for sole purpose of "gluing" -->
@@ -379,6 +399,7 @@
class="heading-edited-row"
>
<i18n-t
+ scope="global"
keypath="status.edited_at"
tag="span"
>
@@ -436,7 +457,10 @@
v-else-if="hasInvisibleQuote"
class="quoted-status -unavailable-prompt"
>
- <i18n-t keypath="status.invisible_quote">
+ <i18n-t
+ scope="global"
+ keypath="status.invisible_quote"
+ >
<template #link>
<bdi>
<a
diff --git a/src/components/status_body/status_body.scss b/src/components/status_body/status_body.scss
@@ -113,7 +113,7 @@
align-items: top;
flex-direction: row;
- --emoji-size: 16px;
+ --emoji-size: calc(var(--emojiSize, 32px) / 2);
& .body,
& .attachments {
diff --git a/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.js b/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.js
@@ -0,0 +1,38 @@
+import { library } from '@fortawesome/fontawesome-svg-core'
+import { faChevronRight, faFolder } from '@fortawesome/free-solid-svg-icons'
+import { mapState } from 'vuex'
+
+import Popover from '../popover/popover.vue'
+
+library.add(faChevronRight, faFolder)
+
+const StatusBookmarkFolderMenu = {
+ props: [
+ 'status'
+ ],
+ data () {
+ return {}
+ },
+ components: {
+ Popover
+ },
+ computed: {
+ ...mapState({
+ folders: state => state.bookmarkFolders.allFolders
+ }),
+ folderId () {
+ return this.status.bookmark_folder_id
+ }
+ },
+ methods: {
+ toggleFolder (id) {
+ const value = id === this.folderId ? null : id
+
+ this.$store.dispatch('bookmark', { id: this.status.id, bookmark_folder_id: value })
+ .then(() => this.$emit('onSuccess'))
+ .catch(err => this.$emit('onError', err.error.error))
+ }
+ }
+}
+
+export default StatusBookmarkFolderMenu
diff --git a/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue b/src/components/status_bookmark_folder_menu/status_bookmark_folder_menu.vue
@@ -0,0 +1,40 @@
+<template>
+ <div class="StatusBookmarkFolderMenu">
+ <Popover
+ trigger="hover"
+ placement="left"
+ remove-padding
+ >
+ <template #content>
+ <div class="dropdown-menu">
+ <button
+ v-for="folder in folders"
+ :key="folder.id"
+ class="menu-item dropdown-item"
+ @click="toggleFolder(folder.id)"
+ >
+ <span
+ class="input menu-checkbox -radio"
+ :class="{ 'menu-checkbox-checked': status.bookmark_folder_id == folder.id }"
+ />
+ {{ folder.name }}
+ </button>
+ </div>
+ </template>
+ <template #trigger>
+ <button class="menu-item dropdown-item dropdown-item-icon -has-submenu">
+ <FAIcon
+ fixed-width
+ icon="folder"
+ />{{ $t('bookmark_folders.select_folder') }}<FAIcon
+ class="chevron-icon"
+ size="lg"
+ icon="chevron-right"
+ />
+ </button>
+ </template>
+ </Popover>
+ </div>
+</template>
+
+<script src="./status_bookmark_folder_menu.js"></script>
diff --git a/src/components/status_content/status_content.js b/src/components/status_content/status_content.js
@@ -90,6 +90,9 @@ const StatusContent = {
}
return true
},
+ localCollapseSubjectDefault () {
+ return this.mergedConfig.collapseMessageWithSubject
+ },
attachmentSize () {
if (this.compact) {
return 'small'
diff --git a/src/components/status_history_modal/status_history_modal.vue b/src/components/status_history_modal/status_history_modal.vue
@@ -6,7 +6,9 @@
>
<div class="status-history-modal-panel panel">
<div class="panel-heading">
- {{ $t('status.status_history') }} ({{ historyCount }})
+ <h1 class="title">
+ {{ $t('status.status_history') }} ({{ historyCount }})
+ </h1>
</div>
<div class="panel-body">
<div
diff --git a/src/components/tab_switcher/tab.style.js b/src/components/tab_switcher/tab.style.js
@@ -14,14 +14,14 @@ export default {
{
directives: {
background: '--fg',
- shadow: ['--defaultButtonShadow', '--defaultButtonBevel'],
+ shadow: ['--buttonDefaultShadow', '--buttonDefaultBevel'],
roundness: 3
}
},
{
state: ['hover'],
directives: {
- shadow: ['--defaultButtonHoverGlow', '--defaultButtonBevel']
+ shadow: ['--buttonDefaultHoverGlow', '--buttonDefaultBevel']
}
},
{
@@ -33,14 +33,14 @@ export default {
{
state: ['hover', 'active'],
directives: {
- shadow: ['--defaultButtonShadow', '--defaultButtonBevel']
+ shadow: ['--buttonDefaultShadow', '--buttonDefaultBevel']
}
},
{
state: ['disabled'],
directives: {
- background: '$blend(--inheritedBackground, 0.25, --parent)',
- shadow: ['--defaultButtonBevel']
+ background: '$blend(--inheritedBackground 0.25 --parent)',
+ shadow: ['--buttonDefaultBevel']
}
},
{
diff --git a/src/components/tab_switcher/tab_switcher.jsx b/src/components/tab_switcher/tab_switcher.jsx
@@ -145,7 +145,12 @@ export default {
if (props.fullHeight) {
classes.push('full-height')
}
- const renderSlot = (!this.renderOnlyFocused || active)
+ let delayRender = slot.props['delay-render']
+ if (delayRender && active) {
+ slot.props['delay-render'] = false
+ delayRender = false
+ }
+ const renderSlot = (!delayRender && (!this.renderOnlyFocused || active))
? slot
: ''
diff --git a/src/components/tab_switcher/tab_switcher.scss b/src/components/tab_switcher/tab_switcher.scss
@@ -119,7 +119,7 @@
.tab {
flex: 1;
box-sizing: content-box;
- min-width: 10em;
+ max-width: 9em;
min-width: 1px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
@@ -128,12 +128,22 @@
margin-right: -200px;
margin-left: 1em;
+ &:not(.active) {
+ margin-top: 0;
+ margin-left: 1.5em;
+ }
+
@media all and (max-width: 800px) {
padding-left: 0.25em;
padding-right: calc(0.25em + 200px);
margin-right: calc(0.25em - 200px);
margin-left: 0.25em;
+ &:not(.active) {
+ margin-top: 0;
+ margin-left: 0.5em;
+ }
+
.text {
display: none;
}
@@ -181,6 +191,7 @@
&:not(.active) {
z-index: 4;
+ margin-top: 0.25em;
&:hover {
z-index: 6;
diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue
@@ -3,7 +3,7 @@
:datetime="time"
:title="localeDateString"
>
- {{ relativeTimeString }}
+ {{ relativeOrAbsoluteTimeString }}
</time>
</template>
@@ -16,16 +16,28 @@ export default {
props: ['time', 'autoUpdate', 'longFormat', 'nowThreshold', 'templateKey'],
data () {
return {
+ relativeTimeMs: 0,
relativeTime: { key: 'time.now', num: 0 },
interval: null
}
},
computed: {
- localeDateString () {
- const browserLocale = localeService.internalToBrowserLocale(this.$i18n.locale)
+ shouldUseAbsoluteTimeFormat () {
+ if (!this.$store.getters.mergedConfig.useAbsoluteTimeFormat) {
+ return false
+ }
+ return DateUtils.durationStrToMs(this.$store.getters.mergedConfig.absoluteTimeFormatMinAge) <= this.relativeTimeMs
+ },
+ browserLocale () {
+ return localeService.internalToBrowserLocale(this.$i18n.locale)
+ },
+ timeAsDate () {
return typeof this.time === 'string'
- ? new Date(Date.parse(this.time)).toLocaleString(browserLocale)
- : this.time.toLocaleString(browserLocale)
+ ? new Date(Date.parse(this.time))
+ : this.time
+ },
+ localeDateString () {
+ return this.timeAsDate.toLocaleString(this.browserLocale)
},
relativeTimeString () {
const timeString = this.$i18n.tc(this.relativeTime.key, this.relativeTime.num, [this.relativeTime.num])
@@ -35,6 +47,40 @@ export default {
}
return timeString
+ },
+ absoluteTimeString () {
+ if (this.longFormat) {
+ return this.localeDateString
+ }
+ const now = new Date()
+ const formatter = (() => {
+ if (DateUtils.isSameDay(this.timeAsDate, now)) {
+ return new Intl.DateTimeFormat(this.browserLocale, {
+ minute: 'numeric',
+ hour: 'numeric'
+ })
+ } else if (DateUtils.isSameMonth(this.timeAsDate, now)) {
+ return new Intl.DateTimeFormat(this.browserLocale, {
+ month: 'short',
+ day: 'numeric'
+ })
+ } else if (DateUtils.isSameYear(this.timeAsDate, now)) {
+ return new Intl.DateTimeFormat(this.browserLocale, {
+ month: 'short',
+ day: 'numeric'
+ })
+ } else {
+ return new Intl.DateTimeFormat(this.browserLocale, {
+ year: 'numeric',
+ month: 'short'
+ })
+ }
+ })()
+
+ return formatter.format(this.timeAsDate)
+ },
+ relativeOrAbsoluteTimeString () {
+ return this.shouldUseAbsoluteTimeFormat ? this.absoluteTimeString : this.relativeTimeString
}
},
watch: {
@@ -54,6 +100,7 @@ export default {
methods: {
refreshRelativeTimeObject () {
const nowThreshold = typeof this.nowThreshold === 'number' ? this.nowThreshold : 1
+ this.relativeTimeMs = DateUtils.relativeTimeMs(this.time)
this.relativeTime = this.longFormat
? DateUtils.relativeTime(this.time, nowThreshold)
: DateUtils.relativeTimeShort(this.time, nowThreshold)
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
@@ -26,6 +26,7 @@ const Timeline = {
'userId',
'listId',
'statusId',
+ 'bookmarkFolderId',
'tag',
'embedded',
'count',
@@ -123,6 +124,7 @@ const Timeline = {
userId: this.userId,
listId: this.listId,
statusId: this.statusId,
+ bookmarkFolderId: this.bookmarkFolderId,
tag: this.tag
})
},
@@ -186,6 +188,7 @@ const Timeline = {
userId: this.userId,
listId: this.listId,
statusId: this.statusId,
+ bookmarkFolderId: this.bookmarkFolderId,
tag: this.tag
}).then(({ statuses }) => {
if (statuses && statuses.length === 0) {
diff --git a/src/components/timeline/timeline.scss b/src/components/timeline/timeline.scss
@@ -26,7 +26,7 @@
}
.conversation-heading {
- top: calc(var(--__panel-heading-height) * var(--currentPanelStack, 2));
+ top: calc(var(--__panel-heading-height) * var(--currentPanelStack, 1) + var(--navbar-height));
z-index: 2;
}
diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
@@ -1,12 +1,15 @@
<template>
<div :class="['Timeline', classes.root]">
- <div :class="classes.header">
+ <div
+ v-if="!embedded"
+ :class="classes.header"
+ >
<TimelineMenu
v-if="!embedded"
:timeline-name="timelineName"
/>
<div
- v-if="showScrollTop && !embedded"
+ v-if="showScrollTop"
class="rightside-button"
>
<button
@@ -24,7 +27,7 @@
</FALayers>
</button>
</div>
- <template v-if="mobileLayout && !embedded">
+ <template v-if="mobileLayout">
<div
v-if="showLoadButton"
class="rightside-button"
@@ -44,7 +47,7 @@
</button>
</div>
<div
- v-else-if="!embedded"
+ v-else
class="loadmore-text faint veryfaint rightside-icon"
:title="$t('timeline.up_to_date')"
:aria-disabled="true"
@@ -65,7 +68,7 @@
{{ loadButtonString }}
</button>
<div
- v-else-if="!embedded"
+ v-else
class="loadmore-text faint"
@click.prevent
>
@@ -73,11 +76,9 @@
</div>
</template>
<QuickFilterSettings
- v-if="!embedded"
class="rightside-button"
/>
<QuickViewSettings
- v-if="!embedded"
class="rightside-button"
/>
</div>
@@ -148,6 +149,8 @@
/>
</div>
</teleport>
+ <!-- spacer to avoid having empty shrug -->
+ <span v-if="embedded && footerSlipgate" />
</div>
</div>
</template>
diff --git a/src/components/timeline_menu/timeline_menu.js b/src/components/timeline_menu/timeline_menu.js
@@ -2,6 +2,7 @@ import Popover from '../popover/popover.vue'
import NavigationEntry from 'src/components/navigation/navigation_entry.vue'
import { mapState } from 'vuex'
import { ListsMenuContent } from '../lists_menu/lists_menu_content.vue'
+import { BookmarkFoldersMenuContent } from '../bookmark_folders_menu/bookmark_folders_menu_content.vue'
import { library } from '@fortawesome/fontawesome-svg-core'
import { TIMELINES } from 'src/components/navigation/navigation.js'
import { filterNavigation } from 'src/components/navigation/filter.js'
@@ -13,10 +14,10 @@ library.add(faChevronDown)
// Route -> i18n key mapping, exported and not in the computed
// because nav panel benefits from the same information.
-export const timelineNames = () => {
+export const timelineNames = (supportsBookmarkFolders) => {
return {
friends: 'nav.home_timeline',
- bookmarks: 'nav.bookmarks',
+ bookmarks: supportsBookmarkFolders ? 'nav.all_bookmarks' : 'nav.bookmarks',
dms: 'nav.dms',
'public-timeline': 'nav.public_tl',
'public-external-timeline': 'nav.twkn',
@@ -28,7 +29,8 @@ const TimelineMenu = {
components: {
Popover,
NavigationEntry,
- ListsMenuContent
+ ListsMenuContent,
+ BookmarkFoldersMenuContent
},
data () {
return {
@@ -36,7 +38,7 @@ const TimelineMenu = {
}
},
created () {
- if (timelineNames()[this.$route.name]) {
+ if (timelineNames(this.bookmarkFolders)[this.$route.name]) {
this.$store.dispatch('setLastTimeline', this.$route.name)
}
},
@@ -45,10 +47,15 @@ const TimelineMenu = {
const route = this.$route.name
return route === 'lists-timeline'
},
+ useBookmarkFoldersMenu () {
+ const route = this.$route.name
+ return this.bookmarkFolders && (route === 'bookmark-folder' || route === 'bookmarks')
+ },
...mapState({
currentUser: state => state.users.currentUser,
privateMode: state => state.instance.private,
- federating: state => state.instance.federating
+ federating: state => state.instance.federating,
+ bookmarkFolders: state => state.instance.pleromaBookmarkFoldersAvailable
}),
timelinesList () {
return filterNavigation(
@@ -57,7 +64,8 @@ const TimelineMenu = {
hasChats: this.pleromaChatMessagesAvailable,
isFederating: this.federating,
isPrivate: this.privateMode,
- currentUser: this.currentUser
+ currentUser: this.currentUser,
+ supportsBookmarkFolders: this.bookmarkFolders
}
)
}
@@ -89,7 +97,10 @@ const TimelineMenu = {
if (route === 'lists-timeline') {
return this.$store.getters.findListTitle(this.$route.params.id)
}
- const i18nkey = timelineNames()[this.$route.name]
+ if (route === 'bookmark-folder') {
+ return this.$store.getters.findBookmarkFolderName(this.$route.params.id)
+ }
+ const i18nkey = timelineNames(this.bookmarkFolders)[this.$route.name]
return i18nkey ? this.$t(i18nkey) : route
}
}
diff --git a/src/components/timeline_menu/timeline_menu.vue b/src/components/timeline_menu/timeline_menu.vue
@@ -15,6 +15,10 @@
:show-pin="false"
class="timelines"
/>
+ <BookmarkFoldersMenuContent
+ v-else-if="useBookmarkFoldersMenu"
+ class="timelines"
+ />
<ul v-else>
<NavigationEntry
v-for="item in timelinesList"
@@ -25,8 +29,8 @@
</ul>
</template>
<template #trigger>
- <span class="button-unstyled title timeline-menu-title">
- <span class="timeline-title">{{ timelineName() }}</span>
+ <span class="button-unstyled timeline-menu-title">
+ <h1 class="title timeline-title">{{ timelineName() }}</h1>
<span>
<FAIcon
size="sm"
diff --git a/src/components/tooltip/tooltip.vue b/src/components/tooltip/tooltip.vue
@@ -0,0 +1,24 @@
+<template>
+ <Popover trigger="hover">
+ <template #trigger>
+ <slot />
+ </template>
+ <template #content>
+ <div class="tooltip">
+ {{ props.text }}
+ </div>
+ </template>
+ </Popover>
+</template>
+
+<script setup>
+import Popover from 'src/components/popover/popover.vue'
+
+const props = defineProps(['text'])
+</script>
+
+<style lang="scss">
+.tooltip {
+ margin: 0.5em 1em;
+}
+</style>
diff --git a/src/components/update_notification/update_notification.vue b/src/components/update_notification/update_notification.vue
@@ -9,9 +9,9 @@
:class="{ '-peek': !showingMore }"
>
<div class="panel-heading">
- <span class="title">
+ <h1 class="title">
{{ $t('update.big_update_title') }}
- </span>
+ </h1>
</div>
<div class="panel-body">
<div
@@ -34,6 +34,7 @@
class="extra-info-group"
>
<i18n-t
+ scope="global"
keypath="update.update_bugs"
tag="p"
>
@@ -45,6 +46,7 @@
</template>
</i18n-t>
<i18n-t
+ scope="global"
keypath="update.update_changelog"
tag="p"
>
@@ -57,6 +59,7 @@
</i18n-t>
<p class="art-credit">
<i18n-t
+ scope="global"
keypath="update.art_by"
tag="small"
>
diff --git a/src/components/user_card/user_card.style.js b/src/components/user_card/user_card.style.js
@@ -1,6 +1,7 @@
export default {
name: 'UserCard',
selector: '.user-card',
+ notEditable: true,
validInnerComponents: [
'Text',
'Link',
@@ -25,7 +26,7 @@ export default {
color: '#000000',
alpha: 0.6
}],
- '--profileTint': 'color | $alpha(--background, 0.5)'
+ '--profileTint': 'color | $alpha(--background 0.5)'
}
},
{
diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue
@@ -8,7 +8,7 @@
:style="style"
class="background-image"
/>
- <div :class="onClose ? '' : panel-heading -flexible-height">
+ <div :class="onClose ? '' : 'panel-heading -flexible-height'">
<div class="user-info">
<div class="container">
<a
@@ -208,7 +208,7 @@
/>
<template v-if="relationship.following">
<ProgressButton
- v-if="!relationship.subscribing"
+ v-if="!relationship.notifying"
class="btn button-default"
:click="subscribeUser"
:title="$t('user_card.subscribe')"
diff --git a/src/components/user_link/user_link.vue b/src/components/user_link/user_link.vue
@@ -1,12 +1,16 @@
<template>
- <router-link
- :title="user.screen_name_ui"
- :to="userProfileLink(user)"
- >
- {{ at ? '@' : '' }}{{ user.screen_name_ui }}<UnicodeDomainIndicator
- :user="user"
- />
- </router-link>
+ <div class="user-profile-link">
+ <router-link
+ :title="user.screen_name_ui"
+ :to="userProfileLink(user)"
+ >
+ <slot>
+ {{ at ? '@' : '' }}{{ user.screen_name_ui }}<UnicodeDomainIndicator
+ :user="user"
+ />
+ </slot>
+ </router-link>
+ </div>
</template>
<script>
diff --git a/src/components/user_list_popover/user_list_popover.vue b/src/components/user_list_popover/user_list_popover.vue
@@ -51,7 +51,7 @@
.user-list-popover {
padding: 0.5em;
- --emoji-size: 16px;
+ --emoji-size: calc(var(--emojiSize, 32px) / 2);
.user-list-row {
padding: 0.25em;
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
@@ -142,9 +142,9 @@
class="panel user-profile-placeholder"
>
<div class="panel-heading">
- <div class="title">
+ <h1 class="title">
{{ $t('settings.profile_tab') }}
- </div>
+ </h1>
</div>
<div>
<span v-if="error">{{ error }}</span>
@@ -166,7 +166,7 @@
flex-basis: 500px;
// No sticky header on user profile
- --currentPanelStack: 1;
+ --currentPanelStack: 0;
.user-birthday {
margin: 0 0.75em 0.5em;
diff --git a/src/components/user_reporting_modal/user_reporting_modal.vue b/src/components/user_reporting_modal/user_reporting_modal.vue
@@ -6,7 +6,7 @@
<div class="user-reporting-panel panel">
<div class="panel-heading">
<i18n-t
- tag="div"
+ tag="h1"
keypath="user_reporting.title"
class="title"
>
diff --git a/src/components/who_to_follow/who_to_follow.vue b/src/components/who_to_follow/who_to_follow.vue
@@ -1,7 +1,9 @@
<template>
<div class="panel panel-default">
<div class="panel-heading">
- {{ $t('who_to_follow.who_to_follow') }}
+ <h1 class="title">
+ {{ $t('who_to_follow.who_to_follow') }}
+ </h1>
</div>
<div class="panel-body">
<FollowCard
diff --git a/src/components/who_to_follow_panel/who_to_follow_panel.vue b/src/components/who_to_follow_panel/who_to_follow_panel.vue
@@ -2,9 +2,9 @@
<div class="who-to-follow-panel">
<div class="panel panel-default base01-background">
<div class="panel-heading timeline-heading base02-background base04">
- <div class="title">
+ <h1 class="title">
{{ $t('who_to_follow.who_to_follow') }}
- </div>
+ </h1>
</div>
<div class="who-to-follow">
<p
diff --git a/src/i18n/en.json b/src/i18n/en.json
@@ -174,6 +174,8 @@
"home_timeline": "Home timeline",
"twkn": "Known Network",
"bookmarks": "Bookmarks",
+ "all_bookmarks": "All bookmarks",
+ "bookmark_folders": "Bookmark folders",
"user_search": "User Search",
"search": "Search",
"search_close": "Close search bar",
@@ -230,7 +232,9 @@
"expiry": "Poll age",
"expires_in": "Poll ends in {0}",
"expired": "Poll ended {0} ago",
- "not_enough_options": "Too few unique options in poll"
+ "not_enough_options": "Too few unique options in poll",
+ "non_anonymous": "Public poll",
+ "non_anonymous_title": "Other instances may display the options you voted for"
},
"emoji": {
"stickers": "Stickers",
@@ -521,6 +525,8 @@
"auto_save_draft": "Save drafts as you compose",
"emoji_reactions_on_timeline": "Show emoji reactions on timeline",
"emoji_reactions_scale": "Reactions scale factor",
+ "absolute_time_format": "Use absolute time format",
+ "absolute_time_format_min_age": "Only use for time older than this amount of time",
"export_theme": "Save preset",
"filtering": "Filtering",
"wordfilter": "Wordfilter",
@@ -710,6 +716,7 @@
"use_websockets": "Use websockets (Realtime updates)",
"text": "Text",
"theme": "Theme",
+ "theme_old": "Theme editor (old)",
"theme_help": "Use hex color codes (#rrggbb) to customize your color theme.",
"theme_help_v2_1": "You can also override certain component's colors and opacity by toggling the checkbox, use \"Clear all\" button to clear all overrides.",
"theme_help_v2_2": "Icons underneath some entries are background/text contrast indicators, hover over for detailed info. Please keep in mind that when using transparency contrast indicators show the worst possible case.",
@@ -759,11 +766,81 @@
"more_settings": "More settings",
"style": {
"custom_theme_used": "(Custom theme)",
+ "custom_style_used": "(Custom style)",
+ "stock_theme_used": "(Stock theme)",
"themes2_outdated": "Editor for Themes V2 is being phased out and will eventually be replaced with a new one that takes advantage of new Themes V3 engine. It should still work but experience might be degraded and inconsistent.",
"appearance_tab_note": "Changes on this tab do not affect the theme used, so exported theme will be different from what seen in the UI",
"update_preview": "Update preview",
"themes3": {
"define": "Override",
+ "palette": {
+ "label": "Color schemes",
+ "name_label": "Color scheme name",
+ "import": "Import palette",
+ "export": "Export palette",
+ "apply": "Apply palette",
+ "bg": "Panel background",
+ "fg": "Buttons etc.",
+ "text": "Text",
+ "link": "Links",
+ "accent": "Accent color",
+ "cRed": "Red color",
+ "cBlue": "Blue color",
+ "cGreen": "Green color",
+ "cOrange": "Orange color",
+ "wallpaper": "Wallpaper",
+ "v2_unsupported": "Older v2 themes don't support palettes. Switch to v3 theme to make use of palettes",
+ "bundled": "Bundled palettes",
+ "style": "Palettes provided by selected style",
+ "user": "Custom palette",
+ "imported": "Imported"
+ },
+ "editor": {
+ "title": "Style editor",
+ "reset_style": "Reset",
+ "load_style": "Open from file",
+ "save_style": "Save",
+ "style_name": "Stylesheet name",
+ "style_author": "Made by",
+ "style_license": "License",
+ "style_website": "Website",
+ "component_selector": "Component",
+ "variant_selector": "Variant",
+ "states_selector": "States",
+ "main_tab": "Main",
+ "shadows_tab": "Shadows",
+ "background": "Background color",
+ "text_color": "Text color",
+ "icon_color": "Icon color",
+ "link_color": "Link color",
+ "contrast": "Text contrast",
+ "roundness": "Roundness",
+ "opacity": "Opacity",
+ "border_color": "Border color",
+ "include_in_rule": "Add to rule",
+ "test_string": "TEST",
+ "invalid": "Invalid",
+ "refresh_preview": "Refresh preview",
+ "apply_preview": "Apply",
+ "text_auto": {
+ "label": "Auto-contrast",
+ "no-preserve": "Black or White",
+ "preserve": "Keep color",
+ "no-auto": "Disabled"
+ },
+ "component_tab": "Components style",
+ "palette_tab": "Color schemes",
+ "variables_tab": "Variables (Advanced)",
+ "variables": {
+ "label": "Variables",
+ "name_label": "Name:",
+ "type_label": "Type:",
+ "type_shadow": "Shadow",
+ "type_color": "Color",
+ "type_generic": "Generic",
+ "virtual_color": "Variable color value"
+ }
+ },
"hacks": {
"underlay_overrides": "Change underlay",
"underlay_override_mode_none": "Theme default",
@@ -885,13 +962,24 @@
"component": "Component",
"override": "Override",
"shadow_id": "Shadow #{value}",
+ "offset": "Shadow offset",
+ "zoom": "Zoom",
+ "offset-x": "x:",
+ "offset-y": "y:",
+ "light_grid": "Use light checkerboard",
+ "color_override": "Use different color",
+ "name": "Name",
"blur": "Blur",
"spread": "Spread",
"inset": "Inset",
+ "raw": "Plain shadow",
+ "expression": "Expression (advanced)",
+ "empty_expression": "Empty expression",
"hintV3": "For shadows you can also use the {0} notation to use other color slot.",
"filter_hint": {
"always_drop_shadow": "Warning, this shadow always uses {0} when browser supports it.",
"drop_shadow_syntax": "{0} does not support {1} parameter and {2} keyword.",
+ "avatar_inset_short": "Separate inset shadow",
"avatar_inset": "Please note that combining both inset and non-inset shadows on avatars might give unexpected results with transparent avatars.",
"spread_zero": "Shadows with spread > 0 will appear as if it was set to zero",
"inset_classic": "Inset shadows will be using {0}"
@@ -1145,6 +1233,8 @@
"delete_confirm_accept_button": "Delete",
"delete_confirm_cancel_button": "Keep",
"reply_to": "Reply to",
+ "reply_to_with_icon": "{icon} {replyTo}",
+ "reply_to_with_arg": "{replyToWithIcon} {user}",
"mentions": "Mentions",
"replies_list": "Replies:",
"replies_list_with_others": "Replies (+{numReplies} other): | Replies (+{numReplies} others):",
@@ -1156,6 +1246,7 @@
"thread_muted": "Thread muted",
"thread_muted_and_words": ", has words:",
"sensitive_muted": "Muting sensitive content",
+ "bot_muted": "Muting bot content",
"show_full_subject": "Show full subject",
"hide_full_subject": "Hide full subject",
"show_content": "Show content",
@@ -1375,6 +1466,9 @@
"error_sending_message": "Something went wrong when sending the message.",
"empty_chat_list_placeholder": "You don't have any chats yet. Start a new chat!"
},
+ "bookmarks": {
+ "manage_bookmark_folders": "Manage bookmark folders"
+ },
"lists": {
"lists": "Lists",
"new": "New List",
@@ -1428,5 +1522,27 @@
"replying": "Replying to {statusLink}",
"editing": "Editing {statusLink}",
"unavailable": "(unavailable)"
+ },
+ "splash": {
+ "loading": "Loading...",
+ "theme": "Applying theme, please wait warmly...",
+ "fun_1": "Drink more water",
+ "fun_2": "Take it easy!",
+ "fun_3": "Suya...",
+ "fun_4": "My Pleroma machine is full power!",
+ "error": "Something went wrong"
+ },
+ "bookmark_folders": {
+ "select_folder": "Select bookmark folder",
+ "creating_folder": "Creating bookmark folder",
+ "editing_folder": "Editing folder {folderName}",
+ "emoji": "Emoji",
+ "name": "Folder name",
+ "new": "New Folder",
+ "create": "Create folder",
+ "delete": "Delete folder",
+ "update_folder": "Save changes",
+ "really_delete": "Do you really want to delete the folder?",
+ "error": "Error manipulating bookmark folders: {0}"
}
}
diff --git a/src/i18n/eo.json b/src/i18n/eo.json
@@ -475,7 +475,8 @@
"interface": "Fasado",
"input": "Enigaj kampoj",
"post": "Teksto de afiŝo",
- "postCode": "Egallarĝa teksto en afiŝo (riĉteksto)"
+ "postCode": "Egallarĝa teksto en afiŝo (riĉteksto)",
+ "monospace": "Egallarĝa teksto"
},
"family": "Nomo de tiparo",
"size": "Grando (en bilderoj)",
@@ -495,6 +496,27 @@
"header_faint": "Tio estas en ordo",
"checkbox": "Mi legetis la kondiĉojn de uzado",
"link": "bela eta ligil’"
+ },
+ "custom_theme_used": "(Propra haŭto)",
+ "themes3": {
+ "hacks": {
+ "underlay_override_mode_transparent": "Tute forigi (povus rompi iujn haŭtojn)",
+ "forced_roundness_mode_disabled": "Uzi implicitajn valorojn de haŭto",
+ "forced_roundness_mode_sharp": "Devigi akrajn randojn",
+ "forced_roundness_mode_nonsharp": "Devigi ne tiom akrajn randojn (rondigo je 1 bildero)",
+ "forced_roundness_mode_round": "Devigi rondajn randojn"
+ },
+ "font": {
+ "builtin": {
+ "serif": "Kalkana",
+ "sans-serif": "Senkalkana",
+ "monospace": "Egallarĝa",
+ "inherit": "Senŝanĝe"
+ },
+ "group-local": "Loke instalitaj signoformoj",
+ "local-unavailable1": "Listo de loke instalitaj signoformoj ne estas disponebla",
+ "font_list_unavailable": "Ne povis akiri loke instalitajn signoformojn: {error}"
+ }
}
},
"discoverable": "Permesi trovon de ĉi tiu konto en serĉrezultoj kaj aliaj servoj",
@@ -744,7 +766,15 @@
"notification_visibility_reports": "Raportoj",
"notification_setting_ignore_inactionable_seen": "Malatenti legitecon de nereageblaj sciigoj (ŝatoj, ripetoj, ktp.)",
"notification_setting_ignore_inactionable_seen_tip": "Ĉi tio ne markos la sciigojn legitaj, kaj vi ankoraŭ ricevos labortablajn sciigojn pri ili, se vi elektis ricevi tiujn",
- "notification_setting_unseen_at_top": "Montri nelegitajn sciigojn super aliaj"
+ "notification_setting_unseen_at_top": "Montri nelegitajn sciigojn super aliaj",
+ "appearance": "Aspekto",
+ "confirm_new_setting": "Ĉu konfirmi novan agordon?",
+ "confirm_new_question": "Ĉu tio ĉi aspektas ĝuste? La ŝanĝo malfariĝos post 10 sekundoj.",
+ "revert": "Malfari",
+ "confirm": "Konfirmi",
+ "text_size": "Grandeco de teksto kaj fasado",
+ "emoji_size": "Grandeco de bildosignoj",
+ "navbar_size": "Grandeco de supra breto"
},
"timeline": {
"collapse": "Maletendi",
@@ -999,7 +1029,8 @@
"follows": "Novaj abonoj",
"favs_repeats": "Ripetoj kaj ŝatoj",
"emoji_reactions": "Bildosignaj reagoj",
- "reports": "Raportoj"
+ "reports": "Raportoj",
+ "statuses": "Abonoj"
},
"errors": {
"storage_unavailable": "Pleroma ne povis aliri deponejon de la foliumilo. Via saluto kaj viaj lokaj agordoj ne estos konservitaj, kaj vi eble renkontos neatenditajn problemojn. Provu permesi kuketojn."
@@ -1065,7 +1096,13 @@
"repeat_confirm_title": "Konfirmo de ripeto",
"repeat_confirm_accept_button": "Ripeti",
"repeat_confirm_cancel_button": "Ne ripeti",
- "delete_confirm_cancel_button": "Ne forigi"
+ "delete_confirm_cancel_button": "Ne forigi",
+ "delete_error": "Eraris forigo de afiŝo: {0}",
+ "hide_quote": "Kaŝi la cititan afiŝon",
+ "display_quote": "Montri la cititan afiŝon",
+ "reaction_count_label": "{num} persono reagis | {num} personoj reagis",
+ "invisible_quote": "Citita afiŝo ne disponeblas: {link}",
+ "quotes": "Citaĵoj"
},
"time": {
"years_short": "{0}j",
@@ -1267,7 +1304,9 @@
"save_meta": "Konservi pridatumojn",
"description": "Priskribo",
"homepage": "Hejmpaĝo",
- "save": "Konservi"
+ "save": "Konservi",
+ "revert": "Malfari",
+ "share": "Kunhavigi"
},
"tabs": {
"emoji": "Bildosignoj",
@@ -1283,7 +1322,8 @@
"header": "Limigi aliron por sennomaj vizitantoj",
"timelines": "Aliro al historioj"
},
- "access": "Aliro al nodo"
+ "access": "Aliro al nodo",
+ "kocaptcha": "Agordo de KoCaptcha"
},
"limits": {
"users": "Limoj de profiloj de uzantoj",
@@ -1304,10 +1344,21 @@
":instance": {
":public": {
"label": "Nodo estas publika"
+ },
+ ":background_image": {
+ "label": "Fonbildo",
+ "description": "Fonbildo (uzota ĉefe de PleromaFE)"
+ },
+ ":description_limit": {
+ "description": "Limo de signoj por priskriboj de kunsendaĵoj",
+ "label": "Limo"
}
}
}
},
- "commit_all": "Konservi ĉion"
+ "commit_all": "Konservi ĉion",
+ "captcha": {
+ "kocaptcha": "KoCaptcha"
+ }
}
}
diff --git a/src/i18n/fr.json b/src/i18n/fr.json
@@ -131,7 +131,8 @@
"mobile_notifications_close": "Fermer les notifications",
"search_close": "Fermer la barre de recherche",
"announcements": "Annonces",
- "mobile_notifications_mark_as_seen": "Marquer tout comme vu"
+ "mobile_notifications_mark_as_seen": "Marquer tout comme vu",
+ "quotes": "Citations"
},
"notifications": {
"broken_favorite": "Message inconnu, recherche en cours…",
diff --git a/src/i18n/ja_pedantic.json b/src/i18n/ja_pedantic.json
@@ -565,7 +565,8 @@
"interface": "インターフェース",
"input": "入力欄",
"post": "投稿",
- "postCode": "等幅 (投稿がリッチテキストであるとき)"
+ "postCode": "等幅 (投稿がリッチテキストであるとき)",
+ "monospace": "等幅テキスト"
},
"family": "フォント名",
"size": "大きさ (px)",
@@ -585,7 +586,43 @@
"header_faint": "エラーではありません",
"checkbox": "利用規約を読みました",
"link": "ハイパーリンク"
- }
+ },
+ "themes2_outdated": "V2テーマのエディタは徐々に廃止され、最終的には新しいV3テーマのものに置き換えられる予定です。現状はまだ動作するはずですが、正しく動作する保証はありません。",
+ "themes3": {
+ "font": {
+ "group-local": "端末上にインストールされたフォント",
+ "local-unavailable2": "フォント名を直接指定してください",
+ "lookup_local_fonts": "端末上のフォントの一覧から選ぶ",
+ "group-builtin": "ブラウザのデフォルトフォント",
+ "builtin": {
+ "serif": "明朝体 (Serif)",
+ "sans-serif": "ゴシック体 (Sans-serif)",
+ "monospace": "等幅 (Monospace)",
+ "inherit": "変更しない"
+ },
+ "local-unavailable1": "端末上のフォントの一覧が取得できません",
+ "font_list_unavailable": "端末上のフォントの一覧が取得できません: {error}",
+ "enter_manually": "フォント名を直接入力する",
+ "entry": "{fontFamily}を入力",
+ "select": "フォントを選択"
+ },
+ "hacks": {
+ "underlay_overrides": "背景表示",
+ "underlay_override_mode_none": "テーマのデフォルトを使用する",
+ "underlay_override_mode_opaque": "単色に置き換える",
+ "underlay_override_mode_transparent": "非表示にする (テーマによっては表示が壊れる可能性があります)",
+ "force_interface_roundness": "インターフェースの角丸設定",
+ "forced_roundness_mode_disabled": "テーマのデフォルトを使用する",
+ "forced_roundness_mode_sharp": "角ばったデザインを強制する",
+ "forced_roundness_mode_nonsharp": "若干の角丸(1px分丸める)デザインを強制する",
+ "forced_roundness_mode_round": "角丸デザインを強制する"
+ },
+ "define": "上書き"
+ },
+ "custom_theme_used": "(カスタムテーマ)",
+ "appearance_tab_note": "以下の設定はテーマには反映されないため、エクスポートしたテーマの見た目は今見えているものと異なる可能性があります",
+ "update_preview": "プレビューを更新",
+ "interface_font_user_override": "フォント設定の上書き"
},
"version": {
"title": "バージョン",
@@ -802,7 +839,19 @@
}
},
"hide_scrobbles_after": "これより古いScrobbleを表示しない:",
- "force_theme_recompilation_debug": "テーマのキャッシュを無効化し、起動の度にコンパイルし直す (デバッグ用)"
+ "force_theme_recompilation_debug": "テーマのキャッシュを無効化し、起動の度にコンパイルし直す (デバッグ用)",
+ "scale_and_layout": "インターフェースの表示サイズとレイアウト",
+ "appearance": "見た目",
+ "confirm_new_setting": "設定を適用しますか?",
+ "confirm_new_question": "これで問題ありませんか?10秒間操作がない場合、元の設定に戻ります。",
+ "revert": "元に戻す",
+ "confirm": "適用",
+ "text_size": "フォントサイズ",
+ "text_size_tip2": "{0}以外に設定すると見た目が壊れてしまう場合があります",
+ "emoji_size": "絵文字のサイズ",
+ "navbar_size": "トップバーのサイズ",
+ "panel_header_size": "パネルヘッダーのサイズ",
+ "notification_visibility_statuses": "購読"
},
"time": {
"day": "{0}日",
@@ -941,7 +990,9 @@
"open_gallery": "メディアビューアで開く",
"status_history": "編集履歴",
"sensitive_muted": "閲覧注意な投稿のためミュートされています",
- "load_error": "投稿の読み込みに失敗しました: {error}"
+ "load_error": "投稿の読み込みに失敗しました: {error}",
+ "loading": "読み込み中…",
+ "quotes": "引用"
},
"user_card": {
"approve": "承認",
diff --git a/src/i18n/languages.js b/src/i18n/languages.js
@@ -22,6 +22,7 @@ const languages = [
'nl',
'oc',
'pl',
+ 'pdc',
'pt',
'ro',
'ru',
diff --git a/src/i18n/nan-TW.json b/src/i18n/nan-TW.json
@@ -190,7 +190,8 @@
"mobile_notifications_close": "關掉通知",
"announcements": "公告",
"search": "Tshuē",
- "mobile_notifications_mark_as_seen": "Lóng 標做有讀"
+ "mobile_notifications_mark_as_seen": "Lóng 標做有讀",
+ "quotes": "引用"
},
"notifications": {
"broken_favorite": "狀態毋知影,leh tshiau-tshuē……",
@@ -212,7 +213,8 @@
"unread_follow_requests": "{num}ê新ê跟tuè請求",
"configuration_tip": "用{theSettings},lí通自訂siánn物佇tsia顯示。{dismiss}",
"configuration_tip_settings": "設定",
- "configuration_tip_dismiss": "Mài koh顯示"
+ "configuration_tip_dismiss": "Mài koh顯示",
+ "subscribed_status": "有發送ê"
},
"polls": {
"add_poll": "開投票",
@@ -252,7 +254,8 @@
},
"load_all_hint": "載入頭前 {saneAmount} ê 繪文字,規个攏載入效能可能 ē khah 食力。",
"load_all": "Kā {emojiAmount} ê 繪文字攏載入",
- "regional_indicator": "地區指引 {letter}"
+ "regional_indicator": "地區指引 {letter}",
+ "hide_custom_emoji": "Khàm掉自訂ê繪文字"
},
"errors": {
"storage_unavailable": "Pleroma buē-tàng the̍h 著瀏覽器儲存 ê。Lí ê 登入狀態抑是局部設定 buē 儲存,mā 凡勢 tú 著意料外 ê 問題。拍開 cookie 看māi。"
@@ -263,7 +266,8 @@
"emoji_reactions": "繪文字 ê 反應",
"reports": "檢舉",
"moves": "用者 ê 移民",
- "load_older": "載入 koh khah 早 ê 互動"
+ "load_older": "載入 koh khah 早 ê 互動",
+ "statuses": "訂ê"
},
"post_status": {
"edit_status": "編輯狀態",
@@ -935,7 +939,34 @@
"notification_extra_chats": "顯示bô讀ê開講",
"notification_extra_announcements": "顯示bô讀ê公告",
"notification_extra_follow_requests": "顯示新ê跟tuè請求",
- "notification_extra_tip": "顯示自訂其他通知ê撇步"
+ "notification_extra_tip": "顯示自訂其他通知ê撇步",
+ "confirm_new_setting": "Lí敢確認新ê設定?",
+ "text_size_tip": "用 {0} 做絕對值,{1} ē根據瀏覽器ê標準文字sài-suh放大縮小。",
+ "theme_debug": "佇處理透明ê時,顯示背景主題ia̋n-jín 所假使ê(DEBUG)",
+ "units": {
+ "time": {
+ "s": "秒鐘",
+ "m": "分鐘",
+ "h": "點鐘",
+ "d": "工"
+ }
+ },
+ "actor_type": "Tsit ê口座是:",
+ "actor_type_Person": "一般ê用者",
+ "actor_type_description": "標記lí ê口座做群組,ē hōo自動轉送提起伊ê狀態。",
+ "actor_type_Group": "群組",
+ "actor_type_Service": "機器lâng",
+ "appearance": "外觀",
+ "confirm_new_question": "Tse看起來kám好?設定ē佇10秒鐘後改轉去。",
+ "revert": "改轉去",
+ "confirm": "確認",
+ "text_size": "文字kap界面ê sài-suh",
+ "text_size_tip2": "毋是 {0} ê值可能ē破壞一寡物件kap主題",
+ "emoji_size": "繪文字ê sài-suh",
+ "navbar_size": "頂 liâu-á êsài-suh",
+ "panel_header_size": "面pang標題ê sài-suh",
+ "visual_tweaks": "細細ê外觀調整",
+ "scale_and_layout": "界面ê sài-suh kap排列"
},
"status": {
"favorites": "收藏",
@@ -1001,7 +1032,7 @@
"show_only_conversation_under_this": "Kan-ta顯示tsit ê狀態ê回應",
"status_history": "狀態ê歷史",
"reaction_count_label": "{num}ê lâng用表情反應",
- "hide_quote": "Khàm條引用ê狀態",
+ "hide_quote": "Khàm掉引用ê狀態",
"display_quote": "顯示引用ê狀態",
"invisible_quote": "引用ê狀態bē當用:{link}",
"more_actions": "佇tsit ê狀態ê其他動作"
diff --git a/src/i18n/pdc.json b/src/i18n/pdc.json
@@ -0,0 +1 @@
+{}
diff --git a/src/i18n/pl.json b/src/i18n/pl.json
@@ -24,7 +24,10 @@
"media_removal": "Usuwanie multimediów",
"media_removal_desc": "Ta instancja usuwa multimedia z postów od wymienionych instancji:",
"media_nsfw": "Multimedia ustawione jako wrażliwe",
- "media_nsfw_desc": "Ta instancja wymusza, by multimedia z wymienionych instancji były ustawione jako wrażliwe:"
+ "media_nsfw_desc": "Ta instancja wymusza, by multimedia z wymienionych instancji były ustawione jako wrażliwe:",
+ "instance": "Instancja",
+ "reason": "Powód",
+ "not_applicable": "Nie dotyczy"
}
},
"staff": "Administracja"
@@ -861,5 +864,13 @@
},
"errors": {
"storage_unavailable": "Pleroma nie mogła uzyskać dostępu do pamięci masowej przeglądarki. Twój login lub lokalne ustawienia nie zostaną zapisane i możesz napotkać problemy. Spróbuj włączyć ciasteczka."
+ },
+ "announcements": {
+ "page_header": "Ogłoszenia",
+ "title": "Ogłoszenie",
+ "mark_as_read_action": "Oznacz jako przeczytane",
+ "post_placeholder": "Wprowadź treść ogłoszenia…",
+ "close_error": "Zamknij",
+ "delete_action": "Usuń"
}
}
diff --git a/src/i18n/service_worker_messages.js b/src/i18n/service_worker_messages.js
@@ -25,6 +25,7 @@ const messages = {
oc: require('../lib/notification-i18n-loader.js!./oc.json'),
pl: require('../lib/notification-i18n-loader.js!./pl.json'),
pt: require('../lib/notification-i18n-loader.js!./pt.json'),
+ pdc: require('../lib/notification-i18n-loader.js!./pdc.json'),
ro: require('../lib/notification-i18n-loader.js!./ro.json'),
ru: require('../lib/notification-i18n-loader.js!./ru.json'),
sk: require('../lib/notification-i18n-loader.js!./sk.json'),
diff --git a/src/i18n/zh.json b/src/i18n/zh.json
@@ -130,20 +130,22 @@
"edit_nav_mobile": "自定义导航栏",
"edit_pinned": "编辑固定的项目",
"mobile_sidebar": "切换移动设备侧栏",
- "search_close": "关闭搜索栏"
+ "search_close": "关闭搜索栏",
+ "mobile_notifications_mark_as_seen": "全部已阅",
+ "quotes": "引用"
},
"notifications": {
"broken_favorite": "未知的状态,正在搜索中…",
- "favorited_you": "喜欢了你的状态",
- "followed_you": "关注了你",
+ "favorited_you": "喜欢了您的状态",
+ "followed_you": "关注了您",
"load_older": "加载更早的通知",
"notifications": "通知",
"read": "已阅!",
- "repeated_you": "转发了你的状态",
+ "repeated_you": "转发了您的状态",
"no_more_notifications": "没有更多的通知",
- "reacted_with": "作出了 {0} 的反应",
+ "reacted_with": "作出了 {0} 的回应",
"migrated_to": "迁移到了",
- "follow_request": "想要关注你",
+ "follow_request": "想要关注您",
"error": "取得通知时发生错误:{0}",
"poll_ended": "投票结束了",
"submitted_report": "提交举报",
@@ -152,7 +154,8 @@
"unread_follow_requests": "{num} 个新关注请求",
"configuration_tip": "可以在 {theSettings} 里定制什么会显示在这里。{dismiss}",
"configuration_tip_settings": "设置",
- "configuration_tip_dismiss": "不再显示"
+ "configuration_tip_dismiss": "不再显示",
+ "subscribed_status": "已发送"
},
"polls": {
"add_poll": "增加投票",
@@ -179,11 +182,12 @@
"load_older": "加载更早的互动",
"moves": "用户迁移",
"reports": "举报",
- "emoji_reactions": "表情回应"
+ "emoji_reactions": "表情回应",
+ "statuses": "订阅"
},
"post_status": {
"new_status": "发布新状态",
- "account_not_locked_warning": "你的帐号没有 {0}。任何人都可以关注你并浏览你的上锁内容。",
+ "account_not_locked_warning": "您的帐号没有 {0}。任何人都可以关注您并浏览您的上锁内容。",
"account_not_locked_warning_link": "上锁",
"attachments_sensitive": "标记附件为敏感内容",
"content_type": {
@@ -199,12 +203,12 @@
"posting": "发送中",
"scope_notice": {
"public": "本条内容可以被所有人看到",
- "private": "关注你的人才能看到本条内容",
+ "private": "关注您的人才能看到本条内容",
"unlisted": "本条内容既不在公共时间线,也不会在所有已知网络上可见"
},
"scope": {
"direct": "私信 - 只发送给被提及的用户",
- "private": "仅关注者 - 只有关注了你的人能看到",
+ "private": "仅关注者 - 只有关注了您的人能看到",
"public": "公共 - 发送到公共时间轴",
"unlisted": "不公开 - 不会发送到公共时间轴"
},
@@ -212,7 +216,7 @@
"preview": "预览",
"media_description": "媒体描述",
"media_description_error": "更新媒体失败,请重试",
- "empty_status_error": "不能发布没有内容、没有附件的发文",
+ "empty_status_error": "不能发布没有内容、没有附件的帖子",
"post": "发送",
"edit_remote_warning": "其它远程实例可能不支持编辑并且无法接收您的帖子的最新版本。",
"edit_unsupported_warning": "Pleroma 不支持对提及或投票进行编辑。",
@@ -233,7 +237,7 @@
"new_captcha": "点击图片获取新的验证码",
"username_placeholder": "例如:lain",
"fullname_placeholder": "例如:岩仓玲音",
- "bio_placeholder": "例如:\n你好,我是玲音。\n我是一个住在日本郊区的动画少女。你可能在 Wired 见过我。",
+ "bio_placeholder": "例如:\n你好,我是玲音。\n我是一个住在日本郊区的动画少女。您可能在 Wired 见过我。",
"validations": {
"username_required": "不能留空",
"fullname_required": "不能留空",
@@ -247,7 +251,7 @@
"reason_placeholder": "此实例的注册需要手动批准。\n请让管理员知道您为什么想要注册。",
"reason": "注册理由",
"register": "注册",
- "email_language": "你想从服务器收到什么语言的邮件?",
+ "email_language": "您想从服务器收到什么语言的邮件?",
"bio_optional": "介绍(可选)",
"email_optional": "电子邮件(可选)",
"birthday": "生日:",
@@ -289,7 +293,7 @@
"background": "背景",
"bio": "简介",
"block_export": "屏蔽名单导出",
- "block_export_button": "导出你的屏蔽名单到一个 csv 文件",
+ "block_export_button": "导出您的屏蔽名单到一个 csv 文件",
"block_import": "屏蔽名单导入",
"block_import_error": "导入屏蔽名单出错",
"blocks_imported": "屏蔽名单导入成功!需要一点时间来处理。",
@@ -310,10 +314,10 @@
"current_profile_banner": "您当前的横幅图片",
"data_import_export_tab": "数据导入/导出",
"default_vis": "默认可见范围",
- "delete_account": "删除账户",
- "delete_account_description": "永久删除你的帐号和所有数据。",
- "delete_account_error": "删除账户时发生错误,如果一直删除不了,请联系实例管理员。",
- "delete_account_instructions": "在下面输入您的密码来确认删除账户。",
+ "delete_account": "删除账号",
+ "delete_account_description": "永久删除您的帐号和所有数据。",
+ "delete_account_error": "删除账号时发生错误。如果一直删除不了,请联系实例管理员。",
+ "delete_account_instructions": "在下面输入您的密码来确认删除账号。",
"avatar_size_instruction": "推荐的头像图片最小尺寸为 150x150 像素。",
"export_theme": "导出预置主题",
"filtering": "过滤器",
@@ -388,11 +392,11 @@
"autohide_floating_post_button": "自动隐藏新帖子的按钮(移动设备)",
"saving_err": "保存设置时发生错误",
"saving_ok": "设置已保存",
- "search_user_to_block": "搜索你想屏蔽的用户",
- "search_user_to_mute": "搜索你想要隐藏的用户",
+ "search_user_to_block": "搜索您想屏蔽的用户",
+ "search_user_to_mute": "搜索您想要隐藏的用户",
"security_tab": "安全",
"scope_copy": "回复时复制可见范围(私信中永远会复制)",
- "minimal_scopes_mode": "使发文可见范围的选项最少化",
+ "minimal_scopes_mode": "使帖子可见范围的选项最小化",
"set_new_avatar": "设置新头像",
"set_new_profile_background": "设置新的个人资料背景",
"set_new_profile_banner": "设置新的横幅图片",
@@ -402,7 +406,7 @@
"subject_line_email": "类似电子邮件: \"re: 主题\"",
"subject_line_mastodon": "类似 mastodon: 与原主题相同",
"subject_line_noop": "不要复制",
- "post_status_content_type": "发文状态内容类型",
+ "post_status_content_type": "帖子状态内容类型",
"stop_gifs": "鼠标悬停时播放GIF",
"streaming": "滚动到顶部时自动推送新内容",
"text": "文本",
@@ -546,7 +550,8 @@
"interface": "界面",
"input": "输入框",
"post": "发帖文字",
- "postCode": "帖子中使用等间距文字(富文本)"
+ "postCode": "帖子中使用等间距文字(富文本)",
+ "monospace": "等宽文本"
},
"family": "字体名称",
"size": "大小 (in px)",
@@ -566,7 +571,43 @@
"header_faint": "这很正常",
"checkbox": "我已经浏览了条款及细则",
"link": "一个棒棒的小小链接"
- }
+ },
+ "custom_theme_used": "(自定义主题)",
+ "themes2_outdated": "V2 主题的编辑器正在被淘汰并且最终会被新的利用 V3 主题引擎的编辑器取代。但是体验有可能会被降级并且不稳定。",
+ "appearance_tab_note": "在这个标签页的更改不会影响使用的主题,所以导出的主题会和界面显示的主题不同",
+ "update_preview": "更新预览",
+ "themes3": {
+ "define": "覆盖",
+ "hacks": {
+ "underlay_overrides": "更改底色",
+ "underlay_override_mode_none": "主题默认",
+ "underlay_override_mode_opaque": "使用单色更改",
+ "underlay_override_mode_transparent": "完全移除(有可能破外一些主题)",
+ "force_interface_roundness": "覆盖界面圆角/锐度",
+ "forced_roundness_mode_disabled": "使用主题默认",
+ "forced_roundness_mode_sharp": "强制使用锐利边角",
+ "forced_roundness_mode_nonsharp": "强制使用不太锋利(1px 圆角)的边角",
+ "forced_roundness_mode_round": "强制使用圆角"
+ },
+ "font": {
+ "group-builtin": "浏览器默认字体",
+ "builtin": {
+ "serif": "衬线字体",
+ "sans-serif": "无衬线字体",
+ "monospace": "等宽字体",
+ "inherit": "未更改"
+ },
+ "group-local": "本地字体",
+ "local-unavailable1": "不可用的本地字体列表",
+ "local-unavailable2": "使用手动输入来指定自定义字体",
+ "font_list_unavailable": "无法找到本地字体:{error}",
+ "lookup_local_fonts": "加载这台电脑的本地字体列表",
+ "enter_manually": "手动输入字体名称",
+ "entry": "输入 {fontFamily}",
+ "select": "选择字体"
+ }
+ },
+ "interface_font_user_override": "覆盖使用的主题/浏览器字体"
},
"version": {
"title": "版本",
@@ -582,12 +623,12 @@
"notification_setting_privacy_option": "在通知推送中隐藏发送者和内容",
"notification_setting_privacy": "隐私",
"hide_follows_count_description": "不显示关注数",
- "notification_visibility_emoji_reactions": "互动",
+ "notification_visibility_emoji_reactions": "回应",
"notification_visibility_moves": "用户迁移",
"new_email": "新邮箱",
- "emoji_reactions_on_timeline": "在时间线上显示表情符号互动",
+ "emoji_reactions_on_timeline": "在时间线上显示表情符号回应",
"notification_setting_hide_notification_contents": "隐藏推送通知中的发送者与内容信息",
- "notification_setting_block_from_strangers": "屏蔽来自你没有关注的用户的通知",
+ "notification_setting_block_from_strangers": "屏蔽来自您没有关注的用户的通知",
"type_domains_to_mute": "搜索需要隐藏的域名",
"useStreamingApi": "实时接收帖子和通知",
"user_mutes": "用户",
@@ -618,15 +659,15 @@
"mutes_imported": "隐藏名单导入成功!处理它们将需要一段时间。",
"mute_import_error": "导入隐藏名单出错",
"mute_import": "隐藏名单导入",
- "mute_export_button": "导出你的隐藏名单到一个 csv 文件",
+ "mute_export_button": "导出您的隐藏名单到一个 csv 文件",
"mute_export": "隐藏名单导出",
"hide_wallpaper": "隐藏实例壁纸",
"setting_changed": "与默认设置不同",
"more_settings": "更多设置",
- "sensitive_by_default": "默认标记发文为敏感内容",
+ "sensitive_by_default": "默认标记帖子为敏感内容",
"reply_visibility_self_short": "只显示对我本人的回复",
"reply_visibility_following_short": "显示对我关注的人的回复",
- "hide_all_muted_posts": "不显示已隐藏的发文",
+ "hide_all_muted_posts": "不显示已隐藏的帖子",
"hide_media_previews": "隐藏媒体预览",
"word_filter": "词语过滤",
"save": "保存更改",
@@ -664,14 +705,14 @@
"move_account_target": "目标账号(例如 {example})",
"moved_account": "账号移动好了。",
"move_account_error": "移动账号时出错:{error}",
- "setting_server_side": "这个设置是捆绑到你的个人资料的,能影响所有会话和客户端",
+ "setting_server_side": "这个设置是捆绑到您的个人资料的,能影响所有会话和客户端",
"post_look_feel": "文章的样子跟感受",
"email_language": "从服务器收邮件的语言",
- "account_backup_description": "这个允许你下载一份账号信息和文章的存档,但是现在还不能导入到 Pleroma 账号里。",
+ "account_backup_description": "这个允许您下载一份账号信息和文章的存档,但是现在还不能导入到 Pleroma 账号里。",
"backup_not_ready": "备份还没准备好。",
"add_backup_error": "添加新备份时出错:{error}",
"add_alias_error": "添加别名时出错:{error}",
- "move_account_notes": "如果你想把账号移动到别的地方,你必须去目标账号,然后加一个指向这里的别名。",
+ "move_account_notes": "如果您想把账号移动到别的地方,您必须去目标账号,然后加一个指向这里的别名。",
"wordfilter": "词语过滤器",
"user_profiles": "用户资料",
"third_column_mode_notifications": "通知栏",
@@ -685,7 +726,7 @@
},
"hide_favorites_description": "不显示我的喜欢列表(人们仍然会收到通知)",
"third_column_mode": "当有足够的空间时,显示第三栏包含",
- "third_column_mode_postform": "主要的发文形式和导航",
+ "third_column_mode_postform": "主要的帖子形式和导航",
"columns": "分栏",
"user_popover_avatar_overlay": "在用户头像上显示用户弹出窗口",
"navbar_column_stretch": "延伸导航栏至分栏宽度",
@@ -705,12 +746,12 @@
"max_depth_in_thread": "默认显示同主题帖子中的最大层数",
"hide_wordfiltered_statuses": "隐藏经过词语过滤的状态",
"hide_muted_threads": "不显示已隐藏的同主题帖子",
- "notification_visibility_polls": "你所投的投票的结束于",
+ "notification_visibility_polls": "您所投的投票的结束于",
"tree_advanced": "允许在树状视图中进行更灵活的导航",
"tree_fade_ancestors": "以模糊的文字显示当前状态的上级",
"conversation_display_linear": "线性样式",
"mention_link_fade_domain": "淡化域名(例如:{'@'}example.org 中的 {'@'}foo{'@'}example.org)",
- "mention_link_bolden_you": "当你被提及时突出显示提及你",
+ "mention_link_bolden_you": "当您被提及时突出显示提及您",
"user_popover_avatar_action": "弹出式头像点击动作",
"user_popover_avatar_action_zoom": "缩放头像",
"user_popover_avatar_action_close": "关闭弹出窗口",
@@ -750,7 +791,7 @@
"url": "URL",
"preview": "预览",
"commit_value": "保存",
- "commit_value_tooltip": "当前值未保存,请按此按钮以提交你的修改",
+ "commit_value_tooltip": "当前值未保存,请按此按钮以提交您的修改",
"reset_value": "重置",
"reset_value_tooltip": "重置草稿",
"hard_reset_value": "硬重置",
@@ -760,7 +801,52 @@
"notification_extra_chats": "显示未读聊天",
"notification_extra_announcements": "显示未读公告",
"notification_extra_follow_requests": "显示新的关注请求",
- "notification_extra_tip": "显示额外通知的定制提示"
+ "notification_extra_tip": "显示额外通知的定制提示",
+ "notification_visibility_follow_requests": "关注请求",
+ "notification_visibility_reports": "举报",
+ "mute_sensitive_posts": "隐藏敏感帖子",
+ "notification_visibility_in_column": "在侧栏/菜单显示通知菜单",
+ "notification_visibility_native_notifications": "显示本地通知",
+ "units": {
+ "time": {
+ "m": "分钟",
+ "s": "秒",
+ "h": "小时",
+ "d": "天"
+ }
+ },
+ "hide_scrobbles_after": "隐藏比这个时间更早的 scrobble",
+ "notification_setting_ignore_inactionable_seen": "忽略无法回复通知(喜欢,转发等)的已阅状态",
+ "notification_setting_unseen_at_top": "将未读通知置顶",
+ "notification_setting_ignore_inactionable_seen_tip": "如果您继续,这将不会标记这些通知为已读,并且您仍会接收到桌面推送通知",
+ "actor_type": "账号:",
+ "actor_type_description": "将您的账号标记为组会使其转发所有提及它的状态。",
+ "actor_type_Person": "正常用户",
+ "actor_type_Service": "机器人",
+ "actor_type_Group": "组",
+ "hide_actor_type_indication": "隐藏帖子中账号类型(机器人,组等)的表示",
+ "notification_setting_annoyance": "烦扰",
+ "notification_setting_drawer_marks_as_seen": "关闭菜单(移动端)来标记全部通知为已阅",
+ "enable_web_push_always_show_tip": "一些浏览器(Chromium,Chrome)需要推送信息才能显示通知,否则会显示“网页在背景发生了更改”的通知,勾选这个选项可以防止这种通知显示,因为 Chrome 在标签页激活时会隐藏网页推送通知。可能会在其他浏览器中显示双重通知。",
+ "enable_web_push_always_show": "总是显示网页推送通知",
+ "force_theme_recompilation_debug": "禁用主题缓存,强制在每次启动时重新编译(调试)",
+ "notification_setting_filters_chrome_push": "在一些浏览器中(Chrome),有可能无法完全按照类型过滤通过推送传递的通知",
+ "hide_scrobbles": "隐藏 scrobble",
+ "appearance": "外观",
+ "confirm_new_setting": "确认新的设置?",
+ "confirm_new_question": "是否保留这些设置?设置将在 10 秒后还原。",
+ "revert": "恢复",
+ "confirm": "确定",
+ "text_size": "文字与界面大小",
+ "text_size_tip": "用 {0} 作为绝对值,{1} 会根据浏览器默认文字大小进行缩放。",
+ "text_size_tip2": "{0} 之外的值可能会破坏一些功能和主题",
+ "emoji_size": "表情符号大小",
+ "navbar_size": "顶栏大小",
+ "panel_header_size": "面板标题大小",
+ "visual_tweaks": "细微外观调整",
+ "theme_debug": "显示当遇到透明背景时背景主题引擎的假设(调试)",
+ "scale_and_layout": "界面大小与布局",
+ "notification_visibility_statuses": "订阅"
},
"time": {
"day": "{0} 天",
@@ -856,7 +942,7 @@
"nsfw": "NSFW",
"external_source": "外部来源",
"expand": "展开",
- "you": "(你)",
+ "you": "(您)",
"plus_more": "还有 {number} 个",
"many_attachments": "文章有 {number} 个附件",
"collapse_attachments": "折起附件",
@@ -896,7 +982,12 @@
"reaction_count_label": "{num} 人作出了表情回应",
"invisible_quote": "引用的状态不可用:{link}",
"hide_quote": "隐藏引用的状态",
- "display_quote": "显示引用的状态"
+ "display_quote": "显示引用的状态",
+ "quotes": "引用",
+ "sensitive_muted": "正在隐藏敏感内容",
+ "loading": "加载中...",
+ "load_error": "无法加载动态:{error}",
+ "more_actions": "状态的更多动作"
},
"user_card": {
"approve": "核准",
@@ -911,14 +1002,14 @@
"followees": "正在关注",
"followers": "关注者",
"following": "正在关注!",
- "follows_you": "关注了你!",
- "its_you": "就是你!",
+ "follows_you": "关注了您!",
+ "its_you": "就是您!",
"media": "媒体",
"mute": "隐藏",
"muted": "已隐藏",
"per_day": "每天",
"remote_follow": "跨站关注",
- "report": "报告",
+ "report": "举报",
"statuses": "状态",
"subscribe": "订阅",
"unsubscribe": "退订",
@@ -945,7 +1036,7 @@
"disable_any_subscription": "完全禁止关注用户",
"quarantine": "不许帖子传入别站",
"delete_user": "删除用户",
- "delete_user_data_and_deactivate_confirmation": "这将永久删除该账户的数据并停用该账户。你完全确定吗?"
+ "delete_user_data_and_deactivate_confirmation": "这将永久删除该账号的数据并停用该账号。您完全确定吗?"
},
"hidden": "已隐藏",
"show_repeats": "显示转发",
@@ -993,7 +1084,8 @@
"note_blank": "(空)",
"edit_note": "编辑备注",
"edit_note_apply": "应用",
- "edit_note_cancel": "取消"
+ "edit_note_cancel": "取消",
+ "group": "组"
},
"user_profile": {
"timeline_title": "用户时间线",
@@ -1001,10 +1093,10 @@
"profile_loading_error": "抱歉,载入个人资料时出错。"
},
"user_reporting": {
- "title": "报告 {0}",
- "add_comment_description": "此报告会发送给您的实例监察员。您可以在下面提供更多详细信息解释报告的缘由:",
+ "title": "举报 {0}",
+ "add_comment_description": "此举报会发送给您的实例监察员。您可以在下面提供更多详细信息解释举报的缘由:",
"additional_comments": "其它信息",
- "forward_description": "这个账号来自另一个服务器。是否同时发送一份报告副本到那里?",
+ "forward_description": "这个账号来自另一个服务器。是否同时发送一份举报副本到那里?",
"forward_to": "转发 {0}",
"submit": "提交",
"generic_error": "当处理您的请求时,发生了一个错误。"
@@ -1020,7 +1112,7 @@
"favorite": "喜欢",
"user_settings": "用户设置",
"reject_follow_request": "拒绝关注请求",
- "add_reaction": "添加互动",
+ "add_reaction": "添加回应",
"bookmark": "书签",
"accept_follow_request": "接受关注请求",
"toggle_expand": "展开或折叠通知以显示帖子全文",
@@ -1090,7 +1182,8 @@
"smileys-and-emotion": "表情与情感"
},
"regional_indicator": "地区指示符 {letter}",
- "unpacked": "未分组的表情符号"
+ "unpacked": "未分组的表情符号",
+ "hide_custom_emoji": "隐藏自定义表情符号"
},
"about": {
"mrf": {
@@ -1157,7 +1250,7 @@
"chats": "聊天",
"delete": "删除",
"message_user": "发消息给 {nickname}",
- "you": "你:"
+ "you": "您:"
},
"announcements": {
"page_header": "公告",
@@ -1198,8 +1291,8 @@
"update_changelog": "关于变化的更多细节,请参见 {theFullChangelog} 。",
"update_changelog_here": "完整的更新日志",
"big_update_title": "请忍耐一下",
- "big_update_content": "我们已经有一段时间没有发布发行版,所以事情的外观和感觉可能与你习惯的不一样。",
- "update_bugs": "请在 {pleromaGitlab} 上报告任何问题和bug,因为我们已经改变了很多,虽然我们进行了彻底的测试,并且自己使用了开发版本,但我们可能错过了一些东西。我们欢迎你对你可能遇到的问题或如何改进Pleroma和Pleroma-FE提出反馈和建议。",
+ "big_update_content": "我们已经有一段时间没有发布发行版,所以事情的外观和感觉可能与您习惯的不一样。",
+ "update_bugs": "请在 {pleromaGitlab} 上报告任何问题和 bug,因为我们改变了软件中的很多东西,虽然我们进行了彻底的测试,并且我们自己使用开发版本,但我们可能错过了一些东西。我们欢迎您对您可能遇到的问题或如何改进 Pleroma 和 Pleroma-FE 提出反馈和建议。",
"art_by": "{linkToArtist} 的作品"
},
"lists": {
@@ -1232,13 +1325,14 @@
"nodb": "无数据库配置",
"instance": "实例",
"limits": "限制",
- "frontends": "前端"
+ "frontends": "前端",
+ "emoji": "表情符号"
},
"nodb": {
"heading": "数据库配置已禁用",
"documentation": "文档",
"text2": "大多数配置选项将不可用。",
- "text": "你需要修改后端配置文件,以便将 {property} 设置为 {value},更多内容请参见 {documentation}。"
+ "text": "您需要修改后端配置文件,以便将 {property} 设置为 {value},更多内容请参见 {documentation}。"
},
"captcha": {
"native": "本地",
@@ -1281,8 +1375,11 @@
"set_default_version": "将版本 {version} 设为默认",
"wip_notice": "请注意,此部分是一个WIP,缺乏某些功能,因为前端管理的后台实现并不完整。",
"default_frontend": "默认前端",
- "default_frontend_tip": "默认的前端将显示给所有用户。目前还没有办法让用户选择个人的前端。如果你不使用 PleromaFE,你很可能不得不使用旧的和有问题的 AdminFE 来进行实例配置,直到我们替换它。",
- "available_frontends": "可供安装"
+ "default_frontend_tip": "默认的前端将显示给所有用户。目前还没有办法让用户选择自己的前端。如果您不使用 PleromaFE,您很可能不得不使用旧的和有问题的 AdminFE 来进行实例配置,直到我们替换它。",
+ "available_frontends": "可供安装",
+ "failure_installing_frontend": "无法安装前端 {version}:{reason}",
+ "success_installing_frontend": "前端 {version} 成功安装",
+ "default_frontend_unavail": "默认前端设置不可以,因为这需要数据库中的配置"
},
"temp_overrides": {
":pleroma": {
@@ -1306,6 +1403,50 @@
}
}
},
- "wip_notice": "此管理仪表板是实验性和 WIP 的,{adminFeLink}。"
+ "wip_notice": "此管理仪表板是实验性和 WIP 的,{adminFeLink}。",
+ "emoji": {
+ "remote_pack_instance": "远程表情包实例",
+ "fallback_src": "回退源",
+ "fallback_sha256": "回退 SHA256",
+ "delete_confirm": "您确定要删除 {0} 吗?",
+ "download_pack": "下载表情包",
+ "files": "文件",
+ "downloading_pack": "正在下载 {0}",
+ "download": "下载",
+ "download_as_name": "新名称",
+ "download_as_name_full": "新名称,留空来使用旧的名称",
+ "emoji_changed": "未保存的表情符号文件更改,检查突出显示的的表情符号",
+ "replace_warning": "这将替换本地同名的表情包",
+ "reload": "重新加载表情符号",
+ "create_pack": "创建表情包",
+ "emoji_pack": "表情包",
+ "save_meta": "保存元数据",
+ "delete": "删除",
+ "revert": "恢复",
+ "add_file": "添加文件",
+ "adding_new": "添加新的表情符号",
+ "shortcode": "简码",
+ "filename": "文件名",
+ "new_shortcode": "简码,留空来自动推断",
+ "emoji_packs": "表情包",
+ "remote_packs": "远程表情包",
+ "do_list": "列表",
+ "edit_pack": "编辑表情包",
+ "description": "描述",
+ "global_actions": "全局动作",
+ "importFS": "从文件系统导入表情符号",
+ "error": "错误:{0}",
+ "delete_pack": "删除表情包",
+ "new_pack_name": "新的表情包名称",
+ "create": "创建",
+ "homepage": "主页",
+ "share": "分享",
+ "save": "保存",
+ "revert_meta": "回复元数据",
+ "new_filename": "文件名,留空来自动推断",
+ "editing": "正在编辑 {0}",
+ "delete_title": "确定删除?",
+ "metadata_changed": "元数据和保存的不同"
+ }
}
}
diff --git a/src/main.js b/src/main.js
@@ -25,9 +25,9 @@ import postStatusModule from './modules/postStatus.js'
import editStatusModule from './modules/editStatus.js'
import statusHistoryModule from './modules/statusHistory.js'
import draftsModule from './modules/drafts.js'
-
import chatsModule from './modules/chats.js'
import announcementsModule from './modules/announcements.js'
+import bookmarkFoldersModule from './modules/bookmark_folders.js'
import { createI18n } from 'vue-i18n'
@@ -59,56 +59,89 @@ const persistedStateOptions = {
};
(async () => {
- let storageError = false
- const plugins = [pushNotifications]
- try {
- const persistedState = await createPersistedState(persistedStateOptions)
- plugins.push(persistedState)
- } catch (e) {
- console.error(e)
- storageError = true
+ const isFox = Math.floor(Math.random() * 2) > 0 ? '_fox' : ''
+
+ const splashError = (i18n, e) => {
+ const throbber = document.querySelector('#throbber')
+ throbber.addEventListener('animationend', () => {
+ document.querySelector('#mascot').src = `/static/pleromatan_orz${isFox}.png`
+ })
+ throbber.classList.add('dead')
+ document.querySelector('#status').textContent = i18n.global.t('splash.error')
+ console.error('PleromaFE failed to initialize: ', e)
+ document.querySelector('#statusError').textContent = e
+ document.querySelector('#statusStack').textContent = e.stack
+ document.querySelector('#statusError').style = 'display: block'
+ document.querySelector('#statusStack').style = 'display: block'
+ }
+
+ window.splashError = e => splashError(i18n, e)
+ window.splashUpdate = key => {
+ if (document.querySelector('#status')) {
+ document.querySelector('#status').textContent = i18n.global.t(key)
+ }
}
- const store = createStore({
- modules: {
- i18n: {
- getters: {
- i18n: () => i18n.global
- }
+
+ try {
+ let storageError
+ const plugins = [pushNotifications]
+ try {
+ const persistedState = await createPersistedState(persistedStateOptions)
+ plugins.push(persistedState)
+ } catch (e) {
+ console.error('Storage error', e)
+ storageError = e
+ }
+ document.querySelector('#mascot').src = `/static/pleromatan_apology${isFox}.png`
+ document.querySelector('#status').removeAttribute('class')
+ document.querySelector('#status').textContent = i18n.global.t('splash.loading')
+ document.querySelector('#splash-credit').textContent = i18n.global.t('update.art_by', { linkToArtist: 'pipivovott' })
+ const store = createStore({
+ modules: {
+ i18n: {
+ getters: {
+ i18n: () => i18n.global
+ }
+ },
+ interface: interfaceModule,
+ instance: instanceModule,
+ // TODO refactor users/statuses modules, they depend on each other
+ users: usersModule,
+ statuses: statusesModule,
+ notifications: notificationsModule,
+ lists: listsModule,
+ api: apiModule,
+ config: configModule,
+ profileConfig: profileConfigModule,
+ serverSideStorage: serverSideStorageModule,
+ adminSettings: adminSettingsModule,
+ shout: shoutModule,
+ oauth: oauthModule,
+ authFlow: authFlowModule,
+ mediaViewer: mediaViewerModule,
+ oauthTokens: oauthTokensModule,
+ reports: reportsModule,
+ polls: pollsModule,
+ postStatus: postStatusModule,
+ editStatus: editStatusModule,
+ statusHistory: statusHistoryModule,
+ drafts: draftsModule,
+ chats: chatsModule,
+ announcements: announcementsModule,
+ bookmarkFolders: bookmarkFoldersModule
},
- interface: interfaceModule,
- instance: instanceModule,
- // TODO refactor users/statuses modules, they depend on each other
- users: usersModule,
- statuses: statusesModule,
- notifications: notificationsModule,
- lists: listsModule,
- api: apiModule,
- config: configModule,
- profileConfig: profileConfigModule,
- serverSideStorage: serverSideStorageModule,
- adminSettings: adminSettingsModule,
- shout: shoutModule,
- oauth: oauthModule,
- authFlow: authFlowModule,
- mediaViewer: mediaViewerModule,
- oauthTokens: oauthTokensModule,
- reports: reportsModule,
- polls: pollsModule,
- postStatus: postStatusModule,
- editStatus: editStatusModule,
- statusHistory: statusHistoryModule,
- drafts: draftsModule,
- chats: chatsModule,
- announcements: announcementsModule
- },
- plugins,
- strict: false // Socket modifies itself, let's ignore this for now.
- // strict: process.env.NODE_ENV !== 'production'
- })
- if (storageError) {
- store.dispatch('pushGlobalNotice', { messageKey: 'errors.storage_unavailable', level: 'error' })
+ plugins,
+ strict: false // Socket modifies itself, let's ignore this for now.
+ // strict: process.env.NODE_ENV !== 'production'
+ })
+ if (storageError) {
+ store.dispatch('pushGlobalNotice', { messageKey: 'errors.storage_unavailable', level: 'error' })
+ }
+ return await afterStoreSetup({ store, i18n })
+ } catch (e) {
+ splashError(i18n, e)
+
}
- afterStoreSetup({ store, i18n })
})()
// These are inlined by webpack's DefinePlugin
diff --git a/src/modules/api.js b/src/modules/api.js
@@ -203,12 +203,13 @@ const api = {
tag = false,
userId = false,
listId = false,
- statusId = false
+ statusId = false,
+ bookmarkFolderId = false
}) {
if (store.state.fetchers[timeline]) return
const fetcher = store.state.backendInteractor.startFetchingTimeline({
- timeline, store, userId, listId, statusId, tag
+ timeline, store, userId, listId, statusId, bookmarkFolderId, tag
})
store.commit('addFetcher', { fetcherName: timeline, fetcher })
},
@@ -272,6 +273,18 @@ const api = {
store.commit('removeFetcher', { fetcherName: 'lists', fetcher })
},
+ // Bookmark folders
+ startFetchingBookmarkFolders (store) {
+ if (store.state.fetchers.bookmarkFolders) return
+ const fetcher = store.state.backendInteractor.startFetchingBookmarkFolders({ store })
+ store.commit('addFetcher', { fetcherName: 'bookmarkFolders', fetcher })
+ },
+ stopFetchingBookmarkFolders (store) {
+ const fetcher = store.state.fetchers.bookmarkFolders
+ if (!fetcher) return
+ store.commit('removeFetcher', { fetcherName: 'bookmarkFolders', fetcher })
+ },
+
// Pleroma websocket
setWsToken (store, token) {
store.commit('setWsToken', token)
diff --git a/src/modules/bookmark_folders.js b/src/modules/bookmark_folders.js
@@ -0,0 +1,66 @@
+import { remove, find } from 'lodash'
+
+export const defaultState = {
+ allFolders: []
+}
+
+export const mutations = {
+ setBookmarkFolders (state, value) {
+ state.allFolders = value
+ },
+ setBookmarkFolder (state, { id, name, emoji, emoji_url: emojiUrl }) {
+ const entry = find(state.allFolders, { id })
+ if (!entry) {
+ state.allFolders.push({ id, name, emoji, emoji_url: emojiUrl })
+ } else {
+ entry.name = name
+ entry.emoji = emoji
+ entry.emoji_url = emojiUrl
+ }
+ },
+ deleteBookmarkFolder (state, { folderId }) {
+ remove(state.allFolders, folder => folder.id === folderId)
+ }
+}
+
+const actions = {
+ setBookmarkFolders ({ commit }, value) {
+ commit('setBookmarkFolders', value)
+ },
+ createBookmarkFolder ({ rootState, commit }, { name, emoji }) {
+ return rootState.api.backendInteractor.createBookmarkFolder({ name, emoji })
+ .then((folder) => {
+ commit('setBookmarkFolder', folder)
+ return folder
+ })
+ },
+ setBookmarkFolder ({ rootState, commit }, { folderId, name, emoji }) {
+ return rootState.api.backendInteractor.updateBookmarkFolder({ folderId, name, emoji })
+ .then((folder) => {
+ commit('setBookmarkFolder', folder)
+ return folder
+ })
+ },
+ deleteBookmarkFolder ({ rootState, commit }, { folderId }) {
+ rootState.api.backendInteractor.deleteBookmarkFolder({ folderId })
+ commit('deleteBookmarkFolder', { folderId })
+ }
+}
+
+export const getters = {
+ findBookmarkFolderName: state => id => {
+ const folder = state.allFolders.find(folder => folder.id === id)
+
+ if (!folder) return
+ return folder.name
+ }
+}
+
+const bookmarkFolders = {
+ state: defaultState,
+ mutations,
+ actions,
+ getters
+}
+
+export default bookmarkFolders
diff --git a/src/modules/config.js b/src/modules/config.js
@@ -48,6 +48,10 @@ export const defaultState = {
customThemeSource: undefined, // "source", stores original theme data
// V3
+ style: null,
+ styleCustomData: null,
+ palette: null,
+ paletteCustomData: null,
themeDebug: false, // debug mode that uses computed backgrounds instead of real ones to debug contrast functions
forceThemeRecompilation: false, // flag that forces recompilation on boot even if cache exists
theme3hacks: { // Hacks, user overrides that are independent of theme used
@@ -184,6 +188,8 @@ export const defaultState = {
ignoreInactionableSeen: undefined, // instance default
unsavedPostAction: undefined, // instance default
autoSaveDraft: undefined // instance default
+ useAbsoluteTimeFormat: undefined, // instance default
+ absoluteTimeFormatMinAge: undefined // instance default
}
// caching the instance default properties
@@ -304,7 +310,7 @@ const config = {
applyConfig(state)
}
if (name.startsWith('theme3hacks')) {
- dispatch('setTheme', { recompile: true })
+ dispatch('applyTheme', { recompile: true })
}
switch (name) {
case 'theme':
diff --git a/src/modules/instance.js b/src/modules/instance.js
@@ -42,6 +42,9 @@ const defaultState = {
registrationOpen: true,
server: 'http://localhost:4040/',
textlimit: 5000,
+ themesIndex: undefined,
+ stylesIndex: undefined,
+ palettesIndex: undefined,
themeData: undefined, // used for theme editor v2
vapidPublicKey: undefined,
@@ -96,6 +99,8 @@ const defaultState = {
sidebarRight: false,
subjectLineBehavior: 'email',
theme: 'pleroma-dark',
+ palette: null,
+ style: null,
emojiReactionsScale: 0.5,
textSize: '14px',
emojiSize: '2.2rem',
@@ -121,6 +126,8 @@ const defaultState = {
ignoreInactionableSeen: false,
unsavedPostAction: 'confirm',
autoSaveDraft: false,
+ useAbsoluteTimeFormat: false,
+ absoluteTimeFormatMinAge: '0d',
// Nasty stuff
customEmoji: [],
@@ -140,6 +147,7 @@ const defaultState = {
shoutAvailable: false,
pleromaChatMessagesAvailable: false,
pleromaCustomEmojiReactionsAvailable: false,
+ pleromaBookmarkFoldersAvailable: false,
gopherAvailable: false,
mediaProxyAvailable: false,
suggestionsEnabled: false,
@@ -153,6 +161,7 @@ const defaultState = {
// Version Information
backendVersion: '',
+ backendRepository: '',
frontendVersion: '',
pollsAvailable: false,
diff --git a/src/modules/interface.js b/src/modules/interface.js
@@ -1,10 +1,23 @@
-import { getPreset, applyTheme, tryLoadCache } from '../services/style_setter/style_setter.js'
+import { getResourcesIndex, applyTheme, tryLoadCache } from '../services/style_setter/style_setter.js'
import { CURRENT_VERSION, generatePreset } from 'src/services/theme_data/theme_data.service.js'
import { convertTheme2To3 } from 'src/services/theme_data/theme2_to_theme3.js'
+import { deserialize } from '../services/theme_data/iss_deserializer.js'
+
+// helper for debugging
+// eslint-disable-next-line no-unused-vars
+const toValue = (x) => JSON.parse(JSON.stringify(x === undefined ? 'null' : x))
const defaultState = {
localFonts: null,
themeApplied: false,
+ themeVersion: 'v3',
+ styleNameUsed: null,
+ styleDataUsed: null,
+ useStylePalette: false, // hack for applying styles from appearance tab
+ paletteNameUsed: null,
+ paletteDataUsed: null,
+ themeNameUsed: null,
+ themeDataUsed: null,
temporaryChangesTimeoutId: null, // used for temporary options that revert after a timeout
temporaryChangesConfirm: () => {}, // used for applying temporary options
temporaryChangesRevert: () => {}, // used for reverting temporary options
@@ -212,142 +225,456 @@ const interfaceMod = {
setLastTimeline ({ commit }, value) {
commit('setLastTimeline', value)
},
- setTheme ({ commit, rootState }, { themeName, themeData, recompile, saveData } = {}) {
+ async fetchPalettesIndex ({ commit, state }) {
+ try {
+ const value = await getResourcesIndex('/static/palettes/index.json')
+ commit('setInstanceOption', { name: 'palettesIndex', value })
+ return value
+ } catch (e) {
+ console.error('Could not fetch palettes index', e)
+ commit('setInstanceOption', { name: 'palettesIndex', value: { _error: e } })
+ return Promise.resolve({})
+ }
+ },
+ setPalette ({ dispatch, commit }, value) {
+ dispatch('resetThemeV3Palette')
+ dispatch('resetThemeV2')
+
+ commit('setOption', { name: 'palette', value })
+
+ dispatch('applyTheme', { recompile: true })
+ },
+ setPaletteCustom ({ dispatch, commit }, value) {
+ dispatch('resetThemeV3Palette')
+ dispatch('resetThemeV2')
+
+ commit('setOption', { name: 'paletteCustomData', value })
+
+ dispatch('applyTheme', { recompile: true })
+ },
+ async fetchStylesIndex ({ commit, state }) {
+ try {
+ const value = await getResourcesIndex(
+ '/static/styles/index.json',
+ deserialize
+ )
+ commit('setInstanceOption', { name: 'stylesIndex', value })
+ return value
+ } catch (e) {
+ console.error('Could not fetch styles index', e)
+ commit('setInstanceOption', { name: 'stylesIndex', value: { _error: e } })
+ return Promise.resolve({})
+ }
+ },
+ setStyle ({ dispatch, commit, state }, value) {
+ dispatch('resetThemeV3')
+ dispatch('resetThemeV2')
+ dispatch('resetThemeV3Palette')
+
+ commit('setOption', { name: 'style', value })
+ state.useStylePalette = true
+
+ dispatch('applyTheme', { recompile: true }).then(() => {
+ state.useStylePalette = false
+ })
+ },
+ setStyleCustom ({ dispatch, commit, state }, value) {
+ dispatch('resetThemeV3')
+ dispatch('resetThemeV2')
+ dispatch('resetThemeV3Palette')
+
+ commit('setOption', { name: 'styleCustomData', value })
+
+ state.useStylePalette = true
+ dispatch('applyTheme', { recompile: true }).then(() => {
+ state.useStylePalette = false
+ })
+ },
+ async fetchThemesIndex ({ commit, state }) {
+ try {
+ const value = await getResourcesIndex('/static/styles.json')
+ commit('setInstanceOption', { name: 'themesIndex', value })
+ return value
+ } catch (e) {
+ console.error('Could not fetch themes index', e)
+ commit('setInstanceOption', { name: 'themesIndex', value: { _error: e } })
+ return Promise.resolve({})
+ }
+ },
+ setTheme ({ dispatch, commit }, value) {
+ dispatch('resetThemeV3')
+ dispatch('resetThemeV3Palette')
+ dispatch('resetThemeV2')
+
+ commit('setOption', { name: 'theme', value })
+
+ dispatch('applyTheme', { recompile: true })
+ },
+ setThemeCustom ({ dispatch, commit }, value) {
+ dispatch('resetThemeV3')
+ dispatch('resetThemeV3Palette')
+ dispatch('resetThemeV2')
+
+ commit('setOption', { name: 'customTheme', value })
+ commit('setOption', { name: 'customThemeSource', value })
+
+ dispatch('applyTheme', { recompile: true })
+ },
+ resetThemeV3 ({ dispatch, commit }) {
+ commit('setOption', { name: 'style', value: null })
+ commit('setOption', { name: 'styleCustomData', value: null })
+ },
+ resetThemeV3Palette ({ dispatch, commit }) {
+ commit('setOption', { name: 'palette', value: null })
+ commit('setOption', { name: 'paletteCustomData', value: null })
+ },
+ resetThemeV2 ({ dispatch, commit }) {
+ commit('setOption', { name: 'theme', value: null })
+ commit('setOption', { name: 'customTheme', value: null })
+ commit('setOption', { name: 'customThemeSource', value: null })
+ },
+ async getThemeData ({ dispatch, commit, rootState, state }) {
+ const getData = async (resource, index, customData, name) => {
+ const capitalizedResource = resource[0].toUpperCase() + resource.slice(1)
+ const result = {}
+
+ if (customData) {
+ result.nameUsed = 'custom' // custom data overrides name
+ result.dataUsed = customData
+ } else {
+ result.nameUsed = name
+
+ if (result.nameUsed == null) {
+ result.dataUsed = null
+ return result
+ }
+
+ let fetchFunc = index[result.nameUsed]
+ // Fallbacks
+ if (!fetchFunc) {
+ if (resource === 'style' || resource === 'palette') {
+ return result
+ }
+ const newName = Object.keys(index)[0]
+ fetchFunc = index[newName]
+ console.warn(`${capitalizedResource} with id '${state.styleNameUsed}' not found, trying back to '${newName}'`)
+ if (!fetchFunc) {
+ console.warn(`${capitalizedResource} doesn't have a fallback, defaulting to stock.`)
+ fetchFunc = () => Promise.resolve(null)
+ }
+ }
+ result.dataUsed = await fetchFunc()
+ }
+ return result
+ }
+
const {
- theme: instanceThemeName
+ style: instanceStyleName,
+ palette: instancePaletteName
+ } = rootState.instance
+
+ let {
+ theme: instanceThemeV2Name,
+ themesIndex,
+ stylesIndex,
+ palettesIndex
} = rootState.instance
const {
- theme: userThemeName,
- customTheme: userThemeSnapshot,
- customThemeSource: userThemeSource,
- forceThemeRecompilation,
- themeDebug,
- theme3hacks
+ style: userStyleName,
+ styleCustomData: userStyleCustomData,
+ palette: userPaletteName,
+ paletteCustomData: userPaletteCustomData
} = rootState.config
- const actualThemeName = userThemeName || instanceThemeName
+ let {
+ theme: userThemeV2Name,
+ customTheme: userThemeV2Snapshot,
+ customThemeSource: userThemeV2Source
+ } = rootState.config
- const forceRecompile = forceThemeRecompilation || recompile
+ let majorVersionUsed
- let promise = null
-
- if (themeData) {
- promise = Promise.resolve(normalizeThemeData(themeData))
- } else if (themeName) {
- promise = getPreset(themeName).then(themeData => normalizeThemeData(themeData))
- } else if (userThemeSource || userThemeSnapshot) {
- promise = Promise.resolve(normalizeThemeData({
- _pleroma_theme_version: 2,
- theme: userThemeSnapshot,
- source: userThemeSource
- }))
- } else if (actualThemeName && actualThemeName !== 'custom') {
- promise = getPreset(actualThemeName).then(themeData => {
- const realThemeData = normalizeThemeData(themeData)
- if (actualThemeName === instanceThemeName) {
- // This sole line is the reason why this whole block is above the recompilation check
- commit('setInstanceOption', { name: 'themeData', value: { theme: realThemeData } })
- }
- return realThemeData
- })
+ console.debug(
+ `User V3 palette: ${userPaletteName}, style: ${userStyleName} , custom: ${!!userStyleCustomData}`
+ )
+ console.debug(
+ `User V2 name: ${userThemeV2Name}, source: ${!!userThemeV2Source}, snapshot: ${!!userThemeV2Snapshot}`
+ )
+
+ console.debug(`Instance V3 palette: ${instancePaletteName}, style: ${instanceStyleName}`)
+ console.debug('Instance V2 theme: ' + instanceThemeV2Name)
+
+ if (userPaletteName || userPaletteCustomData ||
+ userStyleName || userStyleCustomData ||
+ (
+ // User V2 overrides instance V3
+ (instancePaletteName ||
+ instanceStyleName) &&
+ instanceThemeV2Name == null &&
+ userThemeV2Name == null
+ )
+ ) {
+ // Palette and/or style overrides V2 themes
+ instanceThemeV2Name = null
+ userThemeV2Name = null
+ userThemeV2Source = null
+ userThemeV2Snapshot = null
+
+ majorVersionUsed = 'v3'
+ } else if (
+ (userThemeV2Name ||
+ userThemeV2Snapshot ||
+ userThemeV2Source ||
+ instanceThemeV2Name)
+ ) {
+ majorVersionUsed = 'v2'
} else {
- throw new Error('Cannot load any theme!')
+ // if all fails fallback to v3
+ majorVersionUsed = 'v3'
}
+ if (majorVersionUsed === 'v3') {
+ const result = await Promise.all([
+ dispatch('fetchPalettesIndex'),
+ dispatch('fetchStylesIndex')
+ ])
+
+ palettesIndex = result[0]
+ stylesIndex = result[1]
+ } else {
+ // Promise.all just to be uniform with v3
+ const result = await Promise.all([
+ dispatch('fetchThemesIndex')
+ ])
+
+ themesIndex = result[0]
+ }
+
+ state.themeVersion = majorVersionUsed
+
+ console.debug('Version used', majorVersionUsed)
+
+ if (majorVersionUsed === 'v3') {
+ state.themeDataUsed = null
+ state.themeNameUsed = null
+
+ const style = await getData(
+ 'style',
+ stylesIndex,
+ userStyleCustomData,
+ userStyleName || instanceStyleName
+ )
+ state.styleNameUsed = style.nameUsed
+ state.styleDataUsed = style.dataUsed
+
+ let firstStylePaletteName = null
+ style
+ .dataUsed
+ ?.filter(x => x.component === '@palette')
+ .map(x => {
+ const cleanDirectives = Object.fromEntries(
+ Object
+ .entries(x.directives)
+ .filter(([k, v]) => k)
+ )
+
+ return { name: x.variant, ...cleanDirectives }
+ })
+ .forEach(palette => {
+ const key = 'style.' + palette.name.toLowerCase().replace(/ /g, '_')
+ if (!firstStylePaletteName) firstStylePaletteName = key
+ palettesIndex[key] = () => Promise.resolve(palette)
+ })
+
+ const palette = await getData(
+ 'palette',
+ palettesIndex,
+ userPaletteCustomData,
+ state.useStylePalette ? firstStylePaletteName : (userPaletteName || instancePaletteName)
+ )
+
+ if (state.useStylePalette) {
+ commit('setOption', { name: 'palette', value: firstStylePaletteName })
+ }
+
+ state.paletteNameUsed = palette.nameUsed
+ state.paletteDataUsed = palette.dataUsed
+
+ if (state.paletteDataUsed) {
+ state.paletteDataUsed.link = state.paletteDataUsed.link || state.paletteDataUsed.accent
+ state.paletteDataUsed.accent = state.paletteDataUsed.accent || state.paletteDataUsed.link
+ }
+ if (Array.isArray(state.paletteDataUsed)) {
+ const [
+ name,
+ bg,
+ fg,
+ text,
+ link,
+ cRed = '#FF0000',
+ cGreen = '#00FF00',
+ cBlue = '#0000FF',
+ cOrange = '#E3FF00'
+ ] = palette.dataUsed
+ state.paletteDataUsed = {
+ name,
+ bg,
+ fg,
+ text,
+ link,
+ accent: link,
+ cRed,
+ cBlue,
+ cGreen,
+ cOrange
+ }
+ }
+ console.debug('Palette data used', palette.dataUsed)
+ } else {
+ state.styleNameUsed = null
+ state.styleDataUsed = null
+ state.paletteNameUsed = null
+ state.paletteDataUsed = null
+
+ const theme = await getData(
+ 'theme',
+ themesIndex,
+ userThemeV2Source || userThemeV2Snapshot,
+ userThemeV2Name || instanceThemeV2Name
+ )
+ state.themeNameUsed = theme.nameUsed
+ state.themeDataUsed = theme.dataUsed
+ }
+ },
+ async applyTheme (
+ { dispatch, commit, rootState, state },
+ { recompile = false } = {}
+ ) {
+ const {
+ forceThemeRecompilation,
+ themeDebug,
+ theme3hacks
+ } = rootState.config
// If we're not not forced to recompile try using
// cache (tryLoadCache return true if load successful)
- if (!forceRecompile && !themeDebug && tryLoadCache()) {
- commit('setThemeApplied')
- return
- }
- promise
- .then(realThemeData => {
- const theme2ruleset = convertTheme2To3(realThemeData)
+ const forceRecompile = forceThemeRecompilation || recompile
+ if (!forceRecompile && !themeDebug && await tryLoadCache()) {
+ return commit('setThemeApplied')
+ }
+ window.splashUpdate('splash.theme')
+ await dispatch('getThemeData')
- if (saveData) {
- commit('setOption', { name: 'theme', value: themeName || actualThemeName })
- commit('setOption', { name: 'customTheme', value: realThemeData })
- commit('setOption', { name: 'customThemeSource', value: realThemeData })
+ try {
+ const paletteIss = (() => {
+ if (!state.paletteDataUsed) return null
+ const result = {
+ component: 'Root',
+ directives: {}
}
- const hacks = []
-
- Object.entries(theme3hacks).forEach(([key, value]) => {
- switch (key) {
- case 'fonts': {
- Object.entries(theme3hacks.fonts).forEach(([fontKey, font]) => {
- if (!font?.family) return
- switch (fontKey) {
- case 'interface':
- hacks.push({
- component: 'Root',
- directives: {
- '--font': 'generic | ' + font.family
- }
- })
- break
- case 'input':
- hacks.push({
- component: 'Input',
- directives: {
- '--font': 'generic | ' + font.family
- }
- })
- break
- case 'post':
- hacks.push({
- component: 'RichContent',
- directives: {
- '--font': 'generic | ' + font.family
- }
- })
- break
- case 'monospace':
- hacks.push({
- component: 'Root',
- directives: {
- '--monoFont': 'generic | ' + font.family
- }
- })
- break
- }
- })
- break
+
+ Object
+ .entries(state.paletteDataUsed)
+ .filter(([k]) => k !== 'name')
+ .forEach(([k, v]) => {
+ let issRootDirectiveName
+ switch (k) {
+ case 'background':
+ issRootDirectiveName = 'bg'
+ break
+ case 'foreground':
+ issRootDirectiveName = 'fg'
+ break
+ default:
+ issRootDirectiveName = k
}
- case 'underlay': {
- if (value !== 'none') {
- const newRule = {
- component: 'Underlay',
- directives: {}
- }
- if (value === 'opaque') {
- newRule.directives.opacity = 1
- newRule.directives.background = '--wallpaper'
- }
- if (value === 'transparent') {
- newRule.directives.opacity = 0
- }
- hacks.push(newRule)
+ result.directives['--' + issRootDirectiveName] = 'color | ' + v
+ })
+ return result
+ })()
+
+ const theme2ruleset = state.themeDataUsed && convertTheme2To3(normalizeThemeData(state.themeDataUsed))
+ const hacks = []
+
+ Object.entries(theme3hacks).forEach(([key, value]) => {
+ switch (key) {
+ case 'fonts': {
+ Object.entries(theme3hacks.fonts).forEach(([fontKey, font]) => {
+ if (!font?.family) return
+ switch (fontKey) {
+ case 'interface':
+ hacks.push({
+ component: 'Root',
+ directives: {
+ '--font': 'generic | ' + font.family
+ }
+ })
+ break
+ case 'input':
+ hacks.push({
+ component: 'Input',
+ directives: {
+ '--font': 'generic | ' + font.family
+ }
+ })
+ break
+ case 'post':
+ hacks.push({
+ component: 'RichContent',
+ directives: {
+ '--font': 'generic | ' + font.family
+ }
+ })
+ break
+ case 'monospace':
+ hacks.push({
+ component: 'Root',
+ directives: {
+ '--monoFont': 'generic | ' + font.family
+ }
+ })
+ break
+ }
+ })
+ break
+ }
+ case 'underlay': {
+ if (value !== 'none') {
+ const newRule = {
+ component: 'Underlay',
+ directives: {}
+ }
+ if (value === 'opaque') {
+ newRule.directives.opacity = 1
+ newRule.directives.background = '--wallpaper'
}
- break
+ if (value === 'transparent') {
+ newRule.directives.opacity = 0
+ }
+ hacks.push(newRule)
}
+ break
}
- })
-
- const ruleset = [
- ...theme2ruleset,
- ...hacks
- ]
-
- applyTheme(
- ruleset,
- () => commit('setThemeApplied'),
- themeDebug
- )
+ }
})
- return promise
+ const rulesetArray = [
+ theme2ruleset,
+ state.styleDataUsed,
+ paletteIss,
+ hacks
+ ].filter(x => x)
+
+ return applyTheme(
+ rulesetArray.flat(),
+ () => commit('setThemeApplied'),
+ () => {},
+ themeDebug
+ )
+ } catch (e) {
+ window.splashError(e)
+ }
}
}
}
@@ -355,19 +682,6 @@ const interfaceMod = {
export default interfaceMod
export const normalizeThemeData = (input) => {
- if (Array.isArray(input)) {
- const themeData = { colors: {} }
- themeData.colors.bg = input[1]
- themeData.colors.fg = input[2]
- themeData.colors.text = input[3]
- themeData.colors.link = input[4]
- themeData.colors.cRed = input[5]
- themeData.colors.cGreen = input[6]
- themeData.colors.cBlue = input[7]
- themeData.colors.cOrange = input[8]
- return generatePreset(themeData).theme
- }
-
let themeData, themeSource
if (input.themeFileVerison === 1) {
@@ -381,7 +695,10 @@ export const normalizeThemeData = (input) => {
// We got passed a full theme file
themeData = input.theme
themeSource = input.source
- } else if (Object.prototype.hasOwnProperty.call(input, 'themeEngineVersion')) {
+ } else if (
+ Object.prototype.hasOwnProperty.call(input, 'themeEngineVersion') ||
+ Object.prototype.hasOwnProperty.call(input, 'colors')
+ ) {
// We got passed a source/snapshot
themeData = input
themeSource = input
diff --git a/src/modules/statuses.js b/src/modules/statuses.js
@@ -385,10 +385,12 @@ export const mutations = {
setBookmarked (state, { status, value }) {
const newStatus = state.allStatusesObject[status.id]
newStatus.bookmarked = value
+ newStatus.bookmark_folder_id = status.bookmark_folder_id
},
setBookmarkedConfirm (state, { status }) {
const newStatus = state.allStatusesObject[status.id]
newStatus.bookmarked = status.bookmarked
+ if (status.pleroma) newStatus.bookmark_folder_id = status.pleroma.bookmark_folder
},
setDeleted (state, { status }) {
const newStatus = state.allStatusesObject[status.id]
@@ -569,7 +571,7 @@ const statuses = {
},
bookmark ({ rootState, commit }, status) {
commit('setBookmarked', { status, value: true })
- rootState.api.backendInteractor.bookmarkStatus({ id: status.id })
+ rootState.api.backendInteractor.bookmarkStatus({ id: status.id, folder_id: status.bookmark_folder_id })
.then(status => {
commit('setBookmarkedConfirm', { status })
})
diff --git a/src/modules/users.js b/src/modules/users.js
@@ -452,11 +452,11 @@ const users = {
commit('clearFollowers', userId)
},
subscribeUser ({ rootState, commit }, id) {
- return rootState.api.backendInteractor.subscribeUser({ id })
+ return rootState.api.backendInteractor.followUser({ id, notify: true })
.then((relationship) => commit('updateUserRelationship', [relationship]))
},
unsubscribeUser ({ rootState, commit }, id) {
- return rootState.api.backendInteractor.unsubscribeUser({ id })
+ return rootState.api.backendInteractor.followUser({ id, notify: false })
.then((relationship) => commit('updateUserRelationship', [relationship]))
},
toggleActivationStatus ({ rootState, commit }, { user }) {
@@ -579,6 +579,7 @@ const users = {
store.commit('setBackendInteractor', backendInteractorService(store.getters.getToken()))
store.dispatch('stopFetchingNotifications')
store.dispatch('stopFetchingLists')
+ store.dispatch('stopFetchingBookmarkFolders')
store.dispatch('stopFetchingFollowRequests')
store.commit('clearNotifications')
store.commit('resetStatuses')
@@ -635,6 +636,7 @@ const users = {
}
dispatch('startFetchingLists')
+ dispatch('startFetchingBookmarkFolders')
if (user.locked) {
dispatch('startFetchingFollowRequests')
diff --git a/src/panel.scss b/src/panel.scss
@@ -115,6 +115,8 @@
.title {
font-size: 1.3em;
+ margin: 0;
+ font-weight: normal;
}
.alert {
diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js
@@ -68,8 +68,6 @@ const MASTODON_UNBLOCK_USER_URL = id => `/api/v1/accounts/${id}/unblock`
const MASTODON_MUTE_USER_URL = id => `/api/v1/accounts/${id}/mute`
const MASTODON_UNMUTE_USER_URL = id => `/api/v1/accounts/${id}/unmute`
const MASTODON_REMOVE_USER_FROM_FOLLOWERS = id => `/api/v1/accounts/${id}/remove_from_followers`
-const MASTODON_SUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/subscribe`
-const MASTODON_UNSUBSCRIBE_USER = id => `/api/v1/pleroma/accounts/${id}/unsubscribe`
const MASTODON_USER_NOTE_URL = id => `/api/v1/accounts/${id}/note`
const MASTODON_BOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/bookmark`
const MASTODON_UNBOOKMARK_STATUS_URL = id => `/api/v1/statuses/${id}/unbookmark`
@@ -110,6 +108,8 @@ const PLEROMA_DELETE_ANNOUNCEMENT_URL = id => `/api/v1/pleroma/admin/announcemen
const PLEROMA_SCROBBLES_URL = id => `/api/v1/pleroma/accounts/${id}/scrobbles`
const PLEROMA_STATUS_QUOTES_URL = id => `/api/v1/pleroma/statuses/${id}/quotes`
const PLEROMA_USER_FAVORITES_TIMELINE_URL = id => `/api/v1/pleroma/accounts/${id}/favourites`
+const PLEROMA_BOOKMARK_FOLDERS_URL = '/api/v1/pleroma/bookmark_folders'
+const PLEROMA_BOOKMARK_FOLDER_URL = id => `/api/v1/pleroma/bookmark_folders/${id}`
const PLEROMA_ADMIN_CONFIG_URL = '/api/pleroma/admin/config'
const PLEROMA_ADMIN_DESCRIPTIONS_URL = '/api/pleroma/admin/config/descriptions'
@@ -273,6 +273,7 @@ const followUser = ({ id, credentials, ...options }) => {
const url = MASTODON_FOLLOW_URL(id)
const form = {}
if (options.reblogs !== undefined) { form.reblogs = options.reblogs }
+ if (options.notify !== undefined) { form.notify = options.notify }
return fetch(url, {
body: JSON.stringify(form),
headers: {
@@ -690,7 +691,8 @@ const fetchTimeline = ({
tag = false,
withMuted = false,
replyVisibility = 'all',
- includeTypes = []
+ includeTypes = [],
+ bookmarkFolderId = false
}) => {
const timelineUrls = {
public: MASTODON_PUBLIC_TIMELINE,
@@ -760,6 +762,9 @@ const fetchTimeline = ({
params.push(['include_types[]', type])
})
}
+ if (timeline === 'bookmarks' && bookmarkFolderId) {
+ params.push(['folder_id', bookmarkFolderId])
+ }
params.push(['limit', 20])
@@ -829,11 +834,14 @@ const unretweet = ({ id, credentials }) => {
.then((data) => parseStatus(data))
}
-const bookmarkStatus = ({ id, credentials }) => {
+const bookmarkStatus = ({ id, credentials, ...options }) => {
return promisedRequest({
url: MASTODON_BOOKMARK_STATUS_URL(id),
headers: authHeaders(credentials),
- method: 'POST'
+ method: 'POST',
+ payload: {
+ folder_id: options.folder_id
+ }
})
}
@@ -1171,14 +1179,6 @@ const unmuteUser = ({ id, credentials }) => {
return promisedRequest({ url: MASTODON_UNMUTE_USER_URL(id), credentials, method: 'POST' })
}
-const subscribeUser = ({ id, credentials }) => {
- return promisedRequest({ url: MASTODON_SUBSCRIBE_USER(id), credentials, method: 'POST' })
-}
-
-const unsubscribeUser = ({ id, credentials }) => {
- return promisedRequest({ url: MASTODON_UNSUBSCRIBE_USER(id), credentials, method: 'POST' })
-}
-
const fetchBlocks = ({ maxId, credentials }) => {
const query = new URLSearchParams({ with_relationships: true })
if (maxId) {
@@ -1893,6 +1893,44 @@ const deleteEmojiFile = ({ packName, shortcode }) => {
return fetch(`${PLEROMA_EMOJI_UPDATE_FILE_URL(packName)}&shortcode=${shortcode}`, { method: 'DELETE' })
}
+const fetchBookmarkFolders = ({ credentials }) => {
+ const url = PLEROMA_BOOKMARK_FOLDERS_URL
+ return fetch(url, { headers: authHeaders(credentials) })
+ .then((data) => data.json())
+}
+
+const createBookmarkFolder = ({ name, emoji, credentials }) => {
+ const url = PLEROMA_BOOKMARK_FOLDERS_URL
+ const headers = authHeaders(credentials)
+ headers['Content-Type'] = 'application/json'
+
+ return fetch(url, {
+ headers,
+ method: 'POST',
+ body: JSON.stringify({ name, emoji })
+ }).then((data) => data.json())
+}
+
+const updateBookmarkFolder = ({ folderId, name, emoji, credentials }) => {
+ const url = PLEROMA_BOOKMARK_FOLDER_URL(folderId)
+ const headers = authHeaders(credentials)
+ headers['Content-Type'] = 'application/json'
+
+ return fetch(url, {
+ headers,
+ method: 'PATCH',
+ body: JSON.stringify({ name, emoji })
+ }).then((data) => data.json())
+}
+
+const deleteBookmarkFolder = ({ folderId, credentials }) => {
+ const url = PLEROMA_BOOKMARK_FOLDER_URL(folderId)
+ return fetch(url, {
+ method: 'DELETE',
+ headers: authHeaders(credentials)
+ })
+}
+
const apiService = {
verifyCredentials,
fetchTimeline,
@@ -1931,8 +1969,6 @@ const apiService = {
fetchMutes,
muteUser,
unmuteUser,
- subscribeUser,
- unsubscribeUser,
fetchBlocks,
fetchOAuthTokens,
revokeOAuthToken,
@@ -2023,7 +2059,11 @@ const apiService = {
updateEmojiFile,
deleteEmojiFile,
listRemoteEmojiPacks,
- downloadRemoteEmojiPack
+ downloadRemoteEmojiPack,
+ fetchBookmarkFolders,
+ createBookmarkFolder,
+ updateBookmarkFolder,
+ deleteBookmarkFolder
}
export default apiService
diff --git a/src/services/backend_interactor_service/backend_interactor_service.js b/src/services/backend_interactor_service/backend_interactor_service.js
@@ -3,10 +3,11 @@ import timelineFetcher from '../timeline_fetcher/timeline_fetcher.service.js'
import notificationsFetcher from '../notifications_fetcher/notifications_fetcher.service.js'
import followRequestFetcher from '../../services/follow_request_fetcher/follow_request_fetcher.service'
import listsFetcher from '../../services/lists_fetcher/lists_fetcher.service.js'
+import bookmarkFoldersFetcher from '../../services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js'
const backendInteractorService = credentials => ({
- startFetchingTimeline ({ timeline, store, userId = false, listId = false, statusId = false, tag }) {
- return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, statusId, tag })
+ startFetchingTimeline ({ timeline, store, userId = false, listId = false, statusId = false, bookmarkFolderId = false, tag }) {
+ return timelineFetcher.startFetching({ timeline, store, credentials, userId, listId, statusId, bookmarkFolderId, tag })
},
fetchTimeline (args) {
@@ -29,6 +30,10 @@ const backendInteractorService = credentials => ({
return listsFetcher.startFetching({ store, credentials })
},
+ startFetchingBookmarkFolders ({ store }) {
+ return bookmarkFoldersFetcher.startFetching({ store, credentials })
+ },
+
startUserSocket ({ store }) {
const serv = store.rootState.instance.server.replace('http', 'ws')
const url = serv + getMastodonSocketURI({ credentials, stream: 'user' })
diff --git a/src/services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js b/src/services/bookmark_folders_fetcher/bookmark_folders_fetcher.service.js
@@ -0,0 +1,22 @@
+import apiService from '../api/api.service.js'
+import { promiseInterval } from '../promise_interval/promise_interval.js'
+
+const fetchAndUpdate = ({ store, credentials }) => {
+ return apiService.fetchBookmarkFolders({ credentials })
+ .then(bookmarkFolders => {
+ store.commit('setBookmarkFolders', bookmarkFolders)
+ }, () => {})
+ .catch(() => {})
+}
+
+const startFetching = ({ credentials, store }) => {
+ const boundFetchAndUpdate = () => fetchAndUpdate({ credentials, store })
+ boundFetchAndUpdate()
+ return promiseInterval(boundFetchAndUpdate, 240000)
+}
+
+const bookmarkFoldersFetcher = {
+ startFetching
+}
+
+export default bookmarkFoldersFetcher
diff --git a/src/services/color_convert/color_convert.js b/src/services/color_convert/color_convert.js
@@ -53,15 +53,6 @@ const c2linear = (bit) => {
}
/**
- * Converts sRGB into linear RGB
- * @param {Object} srgb - sRGB color
- * @returns {Object} linear rgb color
- */
-const srgbToLinear = (srgb) => {
- return 'rgb'.split('').reduce((acc, c) => { acc[c] = c2linear(srgb[c]); return acc }, {})
-}
-
-/**
* Calculates relative luminance for given color
* https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
* https://www.w3.org/TR/2008/REC-WCAG20-20081211/relative-luminance.xml
@@ -70,7 +61,10 @@ const srgbToLinear = (srgb) => {
* @returns {Number} relative luminance
*/
export const relativeLuminance = (srgb) => {
- const { r, g, b } = srgbToLinear(srgb)
+ const r = c2linear(srgb.r)
+ const g = c2linear(srgb.g)
+ const b = c2linear(srgb.b)
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b
}
@@ -110,13 +104,17 @@ export const getContrastRatioLayers = (text, layers, bedrock) => {
* @returns {Object} sRGB of resulting color
*/
export const alphaBlend = (fg, fga, bg) => {
- if (fga === 1 || typeof fga === 'undefined') return fg
- return 'rgb'.split('').reduce((acc, c) => {
- // Simplified https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
- // for opaque bg and transparent fg
- acc[c] = (fg[c] * fga + bg[c] * (1 - fga))
- return acc
- }, {})
+ if (fga === 1 || typeof fga === 'undefined') {
+ return fg
+ }
+
+ // Simplified https://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending
+ // for opaque bg and transparent fg
+ return {
+ r: (fg.r * fga + bg.r * (1 - fga)),
+ g: (fg.g * fga + bg.g * (1 - fga)),
+ b: (fg.b * fga + bg.b * (1 - fga))
+ }
}
/**
@@ -130,10 +128,11 @@ export const alphaBlendLayers = (bedrock, layers) => layers.reduce((acc, [color,
}, bedrock)
export const invert = (rgb) => {
- return 'rgb'.split('').reduce((acc, c) => {
- acc[c] = 255 - rgb[c]
- return acc
- }, {})
+ return {
+ r: 255 - rgb.r,
+ g: 255 - rgb.g,
+ b: 255 - rgb.b
+ }
}
/**
@@ -144,6 +143,7 @@ export const invert = (rgb) => {
*/
export const hex2rgb = (hex) => {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
+
return result
? {
r: parseInt(result[1], 16),
@@ -161,11 +161,13 @@ export const hex2rgb = (hex) => {
* @returns {Object} result
*/
export const mixrgb = (a, b) => {
- return 'rgb'.split('').reduce((acc, k) => {
- acc[k] = (a[k] + b[k]) / 2
- return acc
- }, {})
+ return {
+ r: (a.r + b.r) / 2,
+ g: (a.g + b.g) / 2,
+ b: (a.b + b.b) / 2
+ }
}
+
/**
* Converts rgb object into a CSS rgba() color
*
@@ -173,7 +175,33 @@ export const mixrgb = (a, b) => {
* @returns {String} CSS rgba() color
*/
export const rgba2css = function (rgba) {
- return `rgba(${Math.floor(rgba.r)}, ${Math.floor(rgba.g)}, ${Math.floor(rgba.b)}, ${rgba.a ?? 1})`
+ const base = {
+ r: 0,
+ g: 0,
+ b: 0,
+ a: 1
+ }
+
+ if (rgba !== null) {
+ if (rgba.r !== undefined && !isNaN(rgba.r)) {
+ base.r = rgba.r
+ }
+ if (rgba.g !== undefined && !isNaN(rgba.g)) {
+ base.g = rgba.g
+ }
+ if (rgba.b !== undefined && !isNaN(rgba.b)) {
+ base.b = rgba.b
+ }
+ if (rgba.a !== undefined && !isNaN(rgba.a)) {
+ base.a = rgba.a
+ }
+ } else {
+ base.r = 255
+ base.g = 255
+ base.b = 255
+ }
+
+ return `rgba(${Math.floor(base.r)}, ${Math.floor(base.g)}, ${Math.floor(base.b)}, ${base.a})`
}
/**
diff --git a/src/services/date_utils/date_utils.js b/src/services/date_utils/date_utils.js
@@ -6,10 +6,13 @@ export const WEEK = 7 * DAY
export const MONTH = 30 * DAY
export const YEAR = 365.25 * DAY
-export const relativeTime = (date, nowThreshold = 1) => {
+export const relativeTimeMs = (date) => {
if (typeof date === 'string') date = Date.parse(date)
+ return Math.abs(Date.now() - date)
+}
+export const relativeTime = (date, nowThreshold = 1) => {
const round = Date.now() > date ? Math.floor : Math.ceil
- const d = Math.abs(Date.now() - date)
+ const d = relativeTimeMs(date)
const r = { num: round(d / YEAR), key: 'time.unit.years' }
if (d < nowThreshold * SECOND) {
r.num = 0
@@ -57,3 +60,39 @@ export const secondsToUnit = (unit, amount) => {
case 'days': return (1000 * amount) / DAY
}
}
+
+export const isSameYear = (a, b) => {
+ return a.getFullYear() === b.getFullYear()
+}
+
+export const isSameMonth = (a, b) => {
+ return a.getFullYear() === b.getFullYear() &&
+ a.getMonth() === b.getMonth()
+}
+
+export const isSameDay = (a, b) => {
+ return a.getFullYear() === b.getFullYear() &&
+ a.getMonth() === b.getMonth() &&
+ a.getDate() === b.getDate()
+}
+
+export const durationStrToMs = (str) => {
+ if (typeof str !== 'string') {
+ return 0
+ }
+
+ const unit = str.replace(/[0-9,.]+/, '')
+ const value = str.replace(/[^0-9,.]+/, '')
+ switch (unit) {
+ case 'd':
+ return value * DAY
+ case 'h':
+ return value * HOUR
+ case 'm':
+ return value * MINUTE
+ case 's':
+ return value * SECOND
+ default:
+ return 0
+ }
+}
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -332,6 +332,7 @@ export const parseStatus = (data) => {
output.quote_url = pleroma.quote_url
output.quote_visible = pleroma.quote_visible
output.quotes_count = pleroma.quotes_count
+ output.bookmark_folder_id = pleroma.bookmark_folder
} else {
output.text = data.content
output.summary = data.spoiler_text
@@ -441,7 +442,9 @@ export const parseNotification = (data) => {
if (masto) {
output.type = mastoDict[data.type] || data.type
output.seen = data.pleroma.is_seen
- output.status = isStatusNotification(output.type) ? parseStatus(data.status) : null
+ // TODO: null check should be a temporary fix, I guess.
+ // Investigate why backend does this.
+ output.status = isStatusNotification(output.type) && data.status !== null ? parseStatus(data.status) : null
output.target = output.type !== 'move'
? null
: parseUser(data.target)
diff --git a/src/services/export_import/export_import.js b/src/services/export_import/export_import.js
@@ -2,15 +2,23 @@ import utf8 from 'utf8'
export const newExporter = ({
filename = 'data',
+ mime = 'application/json',
+ extension = '.json',
getExportedObject
}) => ({
exportData () {
- const stringified = utf8.encode(JSON.stringify(getExportedObject(), null, 2)) // Pretty-print and indent with 2 spaces
+ let stringified
+ if (mime === 'application/json') {
+ stringified = utf8.encode(JSON.stringify(getExportedObject(), null, 2)) // Pretty-print and indent with 2 spaces
+ } else {
+ stringified = utf8.encode(getExportedObject()) // Pretty-print and indent with 2 spaces
+ }
// Create an invisible link with a data url and simulate a click
const e = document.createElement('a')
- e.setAttribute('download', `${filename}.json`)
- e.setAttribute('href', 'data:application/json;base64,' + window.btoa(stringified))
+ const realFilename = typeof filename === 'function' ? filename() : filename
+ e.setAttribute('download', `${realFilename}.${extension}`)
+ e.setAttribute('href', `data:${mime};base64, ${window.btoa(stringified)}`)
e.style.display = 'none'
document.body.appendChild(e)
@@ -20,6 +28,8 @@ export const newExporter = ({
})
export const newImporter = ({
+ accept = '.json',
+ parser = (string) => JSON.parse(string),
onImport,
onImportFailure,
validator = () => true
@@ -27,18 +37,19 @@ export const newImporter = ({
importData () {
const filePicker = document.createElement('input')
filePicker.setAttribute('type', 'file')
- filePicker.setAttribute('accept', '.json')
+ filePicker.setAttribute('accept', accept)
filePicker.addEventListener('change', event => {
if (event.target.files[0]) {
+ const filename = event.target.files[0].name
// eslint-disable-next-line no-undef
const reader = new FileReader()
reader.onload = ({ target }) => {
try {
- const parsed = JSON.parse(target.result)
- const validationResult = validator(parsed)
+ const parsed = parser(target.result, filename)
+ const validationResult = validator(parsed, filename)
if (validationResult === true) {
- onImport(parsed)
+ onImport(parsed, filename)
} else {
onImportFailure({ validationResult })
}
diff --git a/src/services/locale/locale.service.js b/src/services/locale/locale.service.js
@@ -3,6 +3,7 @@ import ISO6391 from 'iso-639-1'
import _ from 'lodash'
const specialLanguageCodes = {
+ pdc: 'en',
ja_easy: 'ja',
zh_Hant: 'zh-HANT',
zh: 'zh-Hans'
@@ -18,6 +19,7 @@ const internalToBackendLocaleMulti = codes => {
const getLanguageName = (code) => {
const specialLanguageNames = {
+ pdc: 'Pennsilfaanisch-Deitsch',
ja_easy: 'やさしいにほんご',
'nan-TW': '臺語(閩南語)',
zh: '简体中文',
diff --git a/src/services/new_api/oauth.js b/src/services/new_api/oauth.js
@@ -10,7 +10,8 @@ export const getOrCreateApp = ({ clientId, clientSecret, instance, commit }) =>
const url = `${instance}/api/v1/apps`
const form = new window.FormData()
- form.append('client_name', `PleromaFE_${window.___pleromafe_commit_hash}_${(new Date()).toISOString()}`)
+ form.append('client_name', 'PleromaFE')
+ form.append('website', 'https://pleroma.social')
form.append('redirect_uris', REDIRECT_URI)
form.append('scopes', 'read write follow push admin')
diff --git a/src/services/style_setter/style_setter.js b/src/services/style_setter/style_setter.js
@@ -1,8 +1,9 @@
-import { hex2rgb } from '../color_convert/color_convert.js'
import { init, getEngineChecksum } from '../theme_data/theme_data_3.service.js'
import { getCssRules } from '../theme_data/css_utils.js'
import { defaultState } from '../../modules/config.js'
import { chunk } from 'lodash'
+import pako from 'pako'
+import localforage from 'localforage'
// On platforms where this is not supported, it will return undefined
// Otherwise it will return an array
@@ -43,38 +44,21 @@ const adoptStyleSheets = (styles) => {
// is nothing to do here.
}
-export const generateTheme = async (inputRuleset, callbacks, debug) => {
+export const generateTheme = (inputRuleset, callbacks, debug) => {
const {
onNewRule = (rule, isLazy) => {},
onLazyFinished = () => {},
onEagerFinished = () => {}
} = callbacks
- // Assuming that "worst case scenario background" is panel background since it's the most likely one
const themes3 = init({
inputRuleset,
- ultimateBackgroundColor: inputRuleset[0].directives['--bg'].split('|')[1].trim(),
debug
})
getCssRules(themes3.eager, debug).forEach(rule => {
// Hacks to support multiple selectors on same component
- if (rule.match(/::-webkit-scrollbar-button/)) {
- const parts = rule.split(/[{}]/g)
- const newRule = [
- parts[0],
- ', ',
- parts[0].replace(/button/, 'thumb'),
- ', ',
- parts[0].replace(/scrollbar-button/, 'resizer'),
- ' {',
- parts[1],
- '}'
- ].join('')
- onNewRule(newRule, false)
- } else {
- onNewRule(rule, false)
- }
+ onNewRule(rule, false)
})
onEagerFinished()
@@ -88,22 +72,7 @@ export const generateTheme = async (inputRuleset, callbacks, debug) => {
const chunk = chunks[counter]
Promise.all(chunk.map(x => x())).then(result => {
getCssRules(result.filter(x => x), debug).forEach(rule => {
- if (rule.match(/\.modal-view/)) {
- const parts = rule.split(/[{}]/g)
- const newRule = [
- parts[0],
- ', ',
- parts[0].replace(/\.modal-view/, '#modal'),
- ', ',
- parts[0].replace(/\.modal-view/, '.shout-panel'),
- ' {',
- parts[1],
- '}'
- ].join('')
- onNewRule(newRule, true)
- } else {
- onNewRule(rule, true)
- }
+ onNewRule(rule, true)
})
// const t1 = performance.now()
// console.debug('Chunk ' + counter + ' took ' + (t1 - t0) + 'ms')
@@ -120,12 +89,15 @@ export const generateTheme = async (inputRuleset, callbacks, debug) => {
return { lazyProcessFunc: processChunk }
}
-export const tryLoadCache = () => {
- const json = localStorage.getItem('pleroma-fe-theme-cache')
- if (!json) return null
+export const tryLoadCache = async () => {
+ console.info('Trying to load compiled theme data from cache')
+ const data = await localforage.getItem('pleromafe-theme-cache')
+ if (!data) return null
let cache
try {
- cache = JSON.parse(json)
+ const decoded = new TextDecoder().decode(pako.inflate(data))
+ cache = JSON.parse(decoded)
+ console.info(`Loaded theme from cache, size=${cache}`)
} catch (e) {
console.error('Failed to decode theme cache:', e)
return false
@@ -146,38 +118,57 @@ export const tryLoadCache = () => {
}
}
-export const applyTheme = async (input, onFinish = (data) => {}, debug) => {
+export const applyTheme = (
+ input,
+ onEagerFinish = data => {},
+ onFinish = data => {},
+ debug
+) => {
const eagerStyles = createStyleSheet(EAGER_STYLE_ID)
const lazyStyles = createStyleSheet(LAZY_STYLE_ID)
- const { lazyProcessFunc } = await generateTheme(
+ const insertRule = (styles, rule) => {
+ if (rule.indexOf('webkit') >= 0) {
+ try {
+ styles.sheet.insertRule(rule, 'index-max')
+ styles.rules.push(rule)
+ } catch (e) {
+ console.warn('Can\'t insert rule due to lack of support', e)
+ }
+ } else {
+ styles.sheet.insertRule(rule, 'index-max')
+ styles.rules.push(rule)
+ }
+ }
+
+ const { lazyProcessFunc } = generateTheme(
input,
{
onNewRule (rule, isLazy) {
if (isLazy) {
- lazyStyles.sheet.insertRule(rule, 'index-max')
- lazyStyles.rules.push(rule)
+ insertRule(lazyStyles, rule)
} else {
- eagerStyles.sheet.insertRule(rule, 'index-max')
- eagerStyles.rules.push(rule)
+ insertRule(eagerStyles, rule)
}
},
onEagerFinished () {
adoptStyleSheets([eagerStyles])
+ onEagerFinish()
},
onLazyFinished () {
adoptStyleSheets([eagerStyles, lazyStyles])
const cache = { engineChecksum: getEngineChecksum(), data: [eagerStyles.rules, lazyStyles.rules] }
onFinish(cache)
- localStorage.setItem('pleroma-fe-theme-cache', JSON.stringify(cache))
+ const compress = (js) => {
+ return pako.deflate(JSON.stringify(js))
+ }
+ localforage.setItem('pleromafe-theme-cache', compress(cache))
}
},
debug
)
setTimeout(lazyProcessFunc, 0)
-
- return Promise.resolve()
}
const extractStyleConfig = ({
@@ -222,7 +213,7 @@ const extractStyleConfig = ({
const defaultStyleConfig = extractStyleConfig(defaultState)
-export const applyConfig = (input) => {
+export const applyConfig = (input, i18n) => {
const config = extractStyleConfig(input)
if (config === defaultStyleConfig) {
@@ -230,8 +221,6 @@ export const applyConfig = (input) => {
}
const head = document.head
- const body = document.body
- body.classList.add('hidden')
const rules = Object
.entries(config)
@@ -247,66 +236,66 @@ export const applyConfig = (input) => {
styleSheet.toString()
styleSheet.insertRule(`:root { ${rules} }`, 'index-max')
+ // TODO find a way to make this not apply to theme previews
if (Object.prototype.hasOwnProperty.call(config, 'forcedRoundness')) {
- styleSheet.insertRule(` * {
+ styleSheet.insertRule(` *:not(.preview-block) {
--roundness: var(--forcedRoundness) !important;
}`, 'index-max')
}
-
- body.classList.remove('hidden')
}
-export const getThemes = () => {
+export const getResourcesIndex = async (url, parser = JSON.parse) => {
const cache = 'no-store'
-
- return window.fetch('/static/styles.json', { cache })
- .then((data) => data.json())
- .then((themes) => {
- return Object.entries(themes).map(([k, v]) => {
- let promise = null
+ const customUrl = url.replace(/\.(\w+)$/, '.custom.$1')
+ let builtin
+ let custom
+
+ const resourceTransform = (resources) => {
+ return Object
+ .entries(resources)
+ .map(([k, v]) => {
if (typeof v === 'object') {
- promise = Promise.resolve(v)
+ return [k, () => Promise.resolve(v)]
} else if (typeof v === 'string') {
- promise = window.fetch(v, { cache })
- .then((data) => data.json())
- .catch((e) => {
- console.error(e)
- return null
- })
+ return [
+ k,
+ () => window
+ .fetch(v, { cache })
+ .then(data => data.text())
+ .then(text => parser(text))
+ .catch(e => {
+ console.error(e)
+ return null
+ })
+ ]
+ } else {
+ console.error(`Unknown resource format - ${k} is a ${typeof v}`)
+ return [k, null]
}
- return [k, promise]
})
- })
- .then((promises) => {
- return promises
- .reduce((acc, [k, v]) => {
- acc[k] = v
- return acc
- }, {})
- })
-}
+ }
-export const getPreset = (val) => {
- return getThemes()
- .then((themes) => themes[val] ? themes[val] : themes['pleroma-dark'])
- .then((theme) => {
- const isV1 = Array.isArray(theme)
- const data = isV1 ? {} : theme.theme
-
- if (isV1) {
- const bg = hex2rgb(theme[1])
- const fg = hex2rgb(theme[2])
- const text = hex2rgb(theme[3])
- const link = hex2rgb(theme[4])
-
- const cRed = hex2rgb(theme[5] || '#FF0000')
- const cGreen = hex2rgb(theme[6] || '#00FF00')
- const cBlue = hex2rgb(theme[7] || '#0000FF')
- const cOrange = hex2rgb(theme[8] || '#E3FF00')
-
- data.colors = { bg, fg, text, link, cRed, cBlue, cGreen, cOrange }
- }
+ try {
+ const builtinData = await window.fetch(url, { cache })
+ const builtinResources = await builtinData.json()
+ builtin = resourceTransform(builtinResources)
+ } catch (e) {
+ builtin = []
+ console.warn(`Builtin resources at ${url} unavailable`)
+ }
- return { theme: data, source: theme.source }
- })
+ try {
+ const customData = await window.fetch(customUrl, { cache })
+ const customResources = await customData.json()
+ custom = resourceTransform(customResources)
+ } catch (e) {
+ custom = []
+ console.warn(`Custom resources at ${customUrl} unavailable`)
+ }
+
+ const total = [...custom, ...builtin]
+ if (total.length === 0) {
+ return Promise.reject(new Error(`Resource at ${url} and ${customUrl} completely unavailable. Panicking`))
+ }
+ return Promise.resolve(Object.fromEntries(total))
}
diff --git a/src/services/theme_data/css_utils.js b/src/services/theme_data/css_utils.js
@@ -2,25 +2,6 @@ import { convert } from 'chromatism'
import { hex2rgb, rgba2css } from '../color_convert/color_convert.js'
-export const parseCssShadow = (text) => {
- const dimensions = /(\d[a-z]*\s?){2,4}/.exec(text)?.[0]
- const inset = /inset/.exec(text)?.[0]
- const color = text.replace(dimensions, '').replace(inset, '')
-
- const [x, y, blur = 0, spread = 0] = dimensions.split(/ /).filter(x => x).map(x => x.trim())
- const isInset = inset?.trim() === 'inset'
- const colorString = color.split(/ /).filter(x => x).map(x => x.trim())[0]
-
- return {
- x,
- y,
- blur,
- spread,
- inset: isInset,
- color: colorString
- }
-}
-
export const getCssColorString = (color, alpha = 1) => rgba2css({ ...convert(color).rgb, a: alpha })
export const getCssShadow = (input, usesDropShadow) => {
@@ -84,6 +65,9 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
].join(';\n ')
}
case 'shadow': {
+ if (!rule.dynamicVars.shadow) {
+ return ''
+ }
return ' ' + [
'--shadow: ' + getCssShadow(rule.dynamicVars.shadow),
'--shadowFilter: ' + getCssShadowFilter(rule.dynamicVars.shadow),
@@ -98,7 +82,7 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
`
}
if (v === 'transparent') {
- if (rule.component === 'Root') return []
+ if (rule.component === 'Root') return null
return [
rule.directives.backgroundNoCssColor !== 'yes' ? ('background-color: ' + v) : '',
' --background: ' + v
@@ -130,7 +114,7 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
}
default:
if (k.startsWith('--')) {
- const [type, value] = v.split('|').map(x => x.trim()) // woah, Extreme!
+ const [type, value] = v.split('|').map(x => x.trim())
switch (type) {
case 'color': {
const color = rule.dynamicVars[k]
@@ -143,21 +127,20 @@ export const getCssRules = (rules, debug) => rules.map(rule => {
case 'generic':
return k + ': ' + value
default:
- return ''
+ return null
}
}
- return ''
+ return null
}
- }).filter(x => x).map(x => ' ' + x).join(';\n')
+ }).filter(x => x).map(x => ' ' + x + ';').join('\n')
return [
header,
- directives + ';',
+ directives,
(rule.component === 'Text' && rule.state.indexOf('faint') < 0 && rule.directives.textNoCssColor !== 'yes') ? ' color: var(--text);' : '',
- '',
virtualDirectives,
footer
- ].join('\n')
+ ].filter(x => x).join('\n')
}).filter(x => x)
export const getScopedVersion = (rules, newScope) => {
diff --git a/src/services/theme_data/iss_deserializer.js b/src/services/theme_data/iss_deserializer.js
@@ -0,0 +1,170 @@
+import { flattenDeep } from 'lodash'
+
+export const deserializeShadow = string => {
+ const modes = ['_full', 'inset', 'x', 'y', 'blur', 'spread', 'color', 'alpha', 'name']
+ const regexPrep = [
+ // inset keyword (optional)
+ '^',
+ '(?:(inset)\\s+)?',
+ // x
+ '(?:(-?[0-9]+(?:\\.[0-9]+)?)\\s+)',
+ // y
+ '(?:(-?[0-9]+(?:\\.[0-9]+)?)\\s+)',
+ // blur (optional)
+ '(?:(-?[0-9]+(?:\\.[0-9]+)?)\\s+)?',
+ // spread (optional)
+ '(?:(-?[0-9]+(?:\\.[0-9]+)?)\\s+)?',
+ // either hex, variable or function
+ '(#[0-9a-f]{6}|--[a-z0-9\\-_]+|\\$[a-z0-9\\-()_ ]+)',
+ // opacity (optional)
+ '(?:\\s+\\/\\s+([0-9]+(?:\\.[0-9]+)?)\\s*)?',
+ // name
+ '(?:\\s+#(\\w+)\\s*)?',
+ '$'
+ ].join('')
+ const regex = new RegExp(regexPrep, 'gis') // global, (stable) indices, single-string
+ const result = regex.exec(string)
+ if (result == null) {
+ if (string.startsWith('$') || string.startsWith('--')) {
+ return string
+ } else {
+ throw new Error(`Invalid shadow definition: '${string}'`)
+ }
+ } else {
+ const numeric = new Set(['x', 'y', 'blur', 'spread', 'alpha'])
+ const { x, y, blur, spread, alpha, inset, color, name } = Object.fromEntries(modes.map((mode, i) => {
+ if (numeric.has(mode)) {
+ const number = Number(result[i])
+ if (Number.isNaN(number)) {
+ if (mode === 'alpha') return [mode, 1]
+ return [mode, 0]
+ }
+ return [mode, number]
+ } else if (mode === 'inset') {
+ return [mode, !!result[i]]
+ } else {
+ return [mode, result[i]]
+ }
+ }).filter(([k, v]) => v !== false).slice(1))
+
+ return { x, y, blur, spread, color, alpha, inset, name }
+ }
+}
+// this works nearly the same as HTML tree converter
+const parseIss = (input) => {
+ const buffer = [{ selector: null, content: [] }]
+ let textBuffer = ''
+
+ const getCurrentBuffer = () => {
+ let current = buffer[buffer.length - 1]
+ if (current == null) {
+ current = { selector: null, content: [] }
+ }
+ return current
+ }
+
+ // Processes current line buffer, adds it to output buffer and clears line buffer
+ const flushText = (kind) => {
+ if (textBuffer === '') return
+ if (kind === 'content') {
+ getCurrentBuffer().content.push(textBuffer.trim())
+ } else {
+ getCurrentBuffer().selector = textBuffer.trim()
+ }
+ textBuffer = ''
+ }
+
+ for (let i = 0; i < input.length; i++) {
+ const char = input[i]
+
+ if (char === ';') {
+ flushText('content')
+ } else if (char === '{') {
+ flushText('header')
+ } else if (char === '}') {
+ flushText('content')
+ buffer.push({ selector: null, content: [] })
+ textBuffer = ''
+ } else {
+ textBuffer += char
+ }
+ }
+
+ return buffer
+}
+export const deserialize = (input) => {
+ const ast = parseIss(input)
+ const finalResult = ast.filter(i => i.selector != null).map(item => {
+ const { selector, content } = item
+ let stateCount = 0
+ const selectors = selector.split(/,/g)
+ const result = selectors.map(selector => {
+ const output = { component: '' }
+ let currentDepth = null
+
+ selector.split(/ /g).reverse().forEach((fragment, index, arr) => {
+ const fragmentObject = { component: '' }
+
+ let mode = 'component'
+ for (let i = 0; i < fragment.length; i++) {
+ const char = fragment[i]
+ switch (char) {
+ case '.': {
+ mode = 'variant'
+ fragmentObject.variant = ''
+ break
+ }
+ case ':': {
+ mode = 'state'
+ fragmentObject.state = fragmentObject.state || []
+ stateCount++
+ break
+ }
+ default: {
+ if (mode === 'state') {
+ const currentState = fragmentObject.state[stateCount - 1]
+ if (currentState == null) {
+ fragmentObject.state.push('')
+ }
+ fragmentObject.state[stateCount - 1] += char
+ } else {
+ fragmentObject[mode] += char
+ }
+ }
+ }
+ }
+ if (currentDepth !== null) {
+ currentDepth.parent = { ...fragmentObject }
+ currentDepth = currentDepth.parent
+ } else {
+ Object.keys(fragmentObject).forEach(key => {
+ output[key] = fragmentObject[key]
+ })
+ if (index !== (arr.length - 1)) {
+ output.parent = { component: '' }
+ }
+ currentDepth = output
+ }
+ })
+
+ output.directives = Object.fromEntries(content.map(d => {
+ const [property, value] = d.split(':')
+ let realValue = (value || '').trim()
+ if (property === 'shadow') {
+ if (realValue === 'none') {
+ realValue = []
+ } else {
+ realValue = value.split(',').map(v => deserializeShadow(v.trim()))
+ }
+ } if (!Number.isNaN(Number(value))) {
+ realValue = Number(value)
+ }
+ return [property, realValue]
+ }))
+
+ return output
+ })
+ return result
+ })
+ return flattenDeep(finalResult)
+}
diff --git a/src/services/theme_data/iss_serializer.js b/src/services/theme_data/iss_serializer.js
@@ -0,0 +1,53 @@
+import { unroll } from './iss_utils.js'
+import { deserializeShadow } from './iss_deserializer.js'
+
+export const serializeShadow = (s, throwOnInvalid) => {
+ if (typeof s === 'object') {
+ const inset = s.inset ? 'inset ' : ''
+ const name = s.name ? ` #${s.name} ` : ''
+ const result = `${inset}${s.x} ${s.y} ${s.blur} ${s.spread} ${s.color} / ${s.alpha}${name}`
+ deserializeShadow(result) // Verify that output is valid and parseable
+ return result
+ } else {
+ return s
+ }
+}
+
+export const serialize = (ruleset) => {
+ return ruleset.map((rule) => {
+ if (Object.keys(rule.directives || {}).length === 0) return false
+
+ const header = unroll(rule).reverse().map(rule => {
+ const { component } = rule
+ const newVariant = (rule.variant == null || rule.variant === 'normal') ? '' : ('.' + rule.variant)
+ const newState = (rule.state || []).filter(st => st !== 'normal')
+
+ return `${component}${newVariant}${newState.map(st => ':' + st).join('')}`
+ }).join(' ')
+
+ const content = Object.entries(rule.directives).map(([directive, value]) => {
+ if (directive.startsWith('--')) {
+ const [valType, newValue] = value.split('|') // only first one! intentional!
+ switch (valType) {
+ case 'shadow':
+ return ` ${directive}: ${valType.trim()} | ${newValue.map(serializeShadow).map(s => s.trim()).join(', ')}`
+ default:
+ return ` ${directive}: ${valType.trim()} | ${newValue.trim()}`
+ }
+ } else {
+ switch (directive) {
+ case 'shadow':
+ if (value.length > 0) {
+ return ` ${directive}: ${value.map(serializeShadow).join(', ')}`
+ } else {
+ return ` ${directive}: none`
+ }
+ default:
+ return ` ${directive}: ${value}`
+ }
+ }
+ })
+
+ return `${header} {\n${content.join(';\n')}\n}`
+ }).filter(x => x).join('\n\n')
+}
diff --git a/src/services/theme_data/iss_utils.js b/src/services/theme_data/iss_utils.js
@@ -56,43 +56,74 @@ export const getAllPossibleCombinations = (array) => {
*
* @returns {String} CSS selector (or path)
*/
-export const genericRuleToSelector = components => (rule, ignoreOutOfTreeSelector, isParent) => {
+export const genericRuleToSelector = components => (rule, ignoreOutOfTreeSelector, liteMode, children) => {
+ const isParent = !!children
if (!rule && !isParent) return null
const component = components[rule.component]
- const { states = {}, variants = {}, selector, outOfTreeSelector } = component
+ const { states = {}, variants = {}, outOfTreeSelector } = component
+
+ const expand = (array = [], subArray = []) => {
+ if (array.length === 0) return subArray.map(x => [x])
+ if (subArray.length === 0) return array.map(x => [x])
+ return array.map(a => {
+ return subArray.map(b => [a, b])
+ }).flat()
+ }
- const applicableStates = ((rule.state || []).filter(x => x !== 'normal')).map(state => states[state])
+ let componentSelectors = Array.isArray(component.selector) ? component.selector : [component.selector]
+ if (ignoreOutOfTreeSelector || liteMode) componentSelectors = [componentSelectors[0]]
+ componentSelectors = componentSelectors.map(selector => {
+ if (selector === ':root') {
+ return ''
+ } else if (isParent) {
+ return selector
+ } else {
+ if (outOfTreeSelector && !ignoreOutOfTreeSelector) return outOfTreeSelector
+ return selector
+ }
+ })
const applicableVariantName = (rule.variant || 'normal')
- let applicableVariant = ''
+ let variantSelectors = null
if (applicableVariantName !== 'normal') {
- applicableVariant = variants[applicableVariantName]
- } else {
- applicableVariant = variants?.normal ?? ''
- }
-
- let realSelector
- if (selector === ':root') {
- realSelector = ''
- } else if (isParent) {
- realSelector = selector
+ variantSelectors = variants[applicableVariantName]
} else {
- if (outOfTreeSelector && !ignoreOutOfTreeSelector) realSelector = outOfTreeSelector
- else realSelector = selector
+ variantSelectors = variants?.normal ?? ''
}
-
- const selectors = [realSelector, applicableVariant, ...applicableStates]
- .sort((a, b) => {
- if (a.startsWith(':')) return 1
- if (/^[a-z]/.exec(a)) return -1
- else return 0
- })
- .join('')
+ variantSelectors = Array.isArray(variantSelectors) ? variantSelectors : [variantSelectors]
+ if (ignoreOutOfTreeSelector || liteMode) variantSelectors = [variantSelectors[0]]
+
+ const applicableStates = (rule.state || []).filter(x => x !== 'normal')
+ // const applicableStates = (rule.state || [])
+ const statesSelectors = applicableStates.map(state => {
+ const selector = states[state] || ''
+ let arraySelector = Array.isArray(selector) ? selector : [selector]
+ if (ignoreOutOfTreeSelector || liteMode) arraySelector = [arraySelector[0]]
+ arraySelector
+ .sort((a, b) => {
+ if (a.startsWith(':')) return 1
+ if (/^[a-z]/.exec(a)) return -1
+ else return 0
+ })
+ .join('')
+ return arraySelector
+ })
+
+ const statesSelectorsFlat = statesSelectors.reduce((acc, s) => {
+ return expand(acc, s).map(st => st.join(''))
+ }, [])
+
+ const componentVariant = expand(componentSelectors, variantSelectors).map(cv => cv.join(''))
+ const componentVariantStates = expand(componentVariant, statesSelectorsFlat).map(cvs => cvs.join(''))
+ const selectors = expand(componentVariantStates, children).map(cvsc => cvsc.join(' '))
+ /*
+ */
if (rule.parent) {
- return (genericRuleToSelector(components)(rule.parent, ignoreOutOfTreeSelector, true) + ' ' + selectors).trim()
+ return genericRuleToSelector(components)(rule.parent, ignoreOutOfTreeSelector, liteMode, selectors)
}
- return selectors.trim()
+
+ return selectors.join(', ').trim()
}
/**
diff --git a/src/services/theme_data/theme2_to_theme3.js b/src/services/theme_data/theme2_to_theme3.js
@@ -354,10 +354,6 @@ export const convertTheme2To3 = (data) => {
newRules.push({ ...rule, state: ['toggled'] })
newRules.push({ ...rule, state: ['toggled', 'focus'] })
newRules.push({ ...rule, state: ['pressed', 'focus'] })
- }
- if (key === 'buttonHover') {
- newRules.push({ ...rule, state: ['toggled', 'hover'] })
- newRules.push({ ...rule, state: ['pressed', 'hover'] })
newRules.push({ ...rule, state: ['toggled', 'focus', 'hover'] })
newRules.push({ ...rule, state: ['pressed', 'focus', 'hover'] })
}
@@ -418,7 +414,6 @@ export const convertTheme2To3 = (data) => {
case 'Border':
newRule.parent = rule
newRule.directives.textColor = data.colors[key]
- newRule.directives.textAuto = 'no-auto'
variantArray = parts.slice(0, -1)
break
default:
diff --git a/src/services/theme_data/theme3_slot_functions.js b/src/services/theme_data/theme3_slot_functions.js
@@ -3,7 +3,7 @@ import { alphaBlend, getTextColor, relativeLuminance } from '../color_convert/co
export const process = (text, functions, { findColor, findShadow }, { dynamicVars, staticVars }) => {
const { funcName, argsString } = /\$(?<funcName>\w+)\((?<argsString>[#a-zA-Z0-9-,.'"\s]*)\)/.exec(text).groups
- const args = argsString.split(/,/g).map(a => a.trim())
+ const args = argsString.split(/ /g).map(a => a.trim())
const func = functions[funcName]
if (args.length < func.argsNeeded) {
@@ -15,6 +15,11 @@ export const process = (text, functions, { findColor, findShadow }, { dynamicVar
export const colorFunctions = {
alpha: {
argsNeeded: 2,
+ documentation: 'Changes alpha value of the color only to be used for CSS variables',
+ args: [
+ 'color: source color used',
+ 'amount: alpha value'
+ ],
exec: (args, { findColor }, { dynamicVars, staticVars }) => {
const [color, amountArg] = args
@@ -23,8 +28,32 @@ export const colorFunctions = {
return { ...colorArg, a: amount }
}
},
+ brightness: {
+ argsNeeded: 2,
+ document: 'Changes brightness/lightness of color in HSL colorspace',
+ args: [
+ 'color: source color used',
+ 'amount: lightness value'
+ ],
+ exec: (args, { findColor }, { dynamicVars, staticVars }) => {
+ const [color, amountArg] = args
+
+ const colorArg = convert(findColor(color, { dynamicVars, staticVars })).hsl
+ colorArg.l += Number(amountArg)
+ return { ...convert(colorArg).rgb }
+ }
+ },
textColor: {
argsNeeded: 2,
+ documentation: 'Get text color with adequate contrast for given background and intended text color. Same function is used internally',
+ args: [
+ 'background: color of backdrop where text will be shown',
+ 'foreground: intended text color',
+ `[preserve]: (optional) intended color preservation:
+'preserve' - try to preserve the color
+'no-preserve' - if can't get adequate color - fall back to black or white
+'no-auto' - don't do anything (useless as a color function)`
+ ],
exec: (args, { findColor }, { dynamicVars, staticVars }) => {
const [backgroundArg, foregroundArg, preserve = 'preserve'] = args
@@ -36,6 +65,12 @@ export const colorFunctions = {
},
blend: {
argsNeeded: 3,
+ documentation: 'Alpha blending between two colors',
+ args: [
+ 'background: bottom layer color',
+ 'amount: opacity of top layer',
+ 'foreground: upper layer color'
+ ],
exec: (args, { findColor }, { dynamicVars, staticVars }) => {
const [backgroundArg, amountArg, foregroundArg] = args
@@ -48,6 +83,11 @@ export const colorFunctions = {
},
mod: {
argsNeeded: 2,
+ documentation: 'Old function that increases or decreases brightness depending if color is dark or light. Advised against using it as it might give unexpected results.',
+ args: [
+ 'color: source color',
+ 'amount: how much darken/brighten the color'
+ ],
exec: (args, { findColor }, { dynamicVars, staticVars }) => {
const [colorArg, amountArg] = args
@@ -65,6 +105,13 @@ export const colorFunctions = {
export const shadowFunctions = {
borderSide: {
argsNeeded: 3,
+ documentation: 'Simulate a border on a side with a shadow, best works on inset border',
+ args: [
+ 'color: border color',
+ 'side: string indicating on which side border should be, takes either one word or two words joined by dash (i.e. "left" or "bottom-right")',
+ '[alpha]: (Optional) border opacity, defaults to 1 (fully opaque)',
+ '[inset]: (Optional) whether border should be on the inside or outside, defaults to inside'
+ ],
exec: (args, { findColor }) => {
const [color, side, alpha = '1', widthArg = '1', inset = 'inset'] = args
diff --git a/src/services/theme_data/theme_data.service.js b/src/services/theme_data/theme_data.service.js
@@ -452,7 +452,7 @@ export const getCssShadow = (input, usesDropShadow) => {
]).join(' ')).join(', ')
}
-const getCssShadowFilter = (input) => {
+export const getCssShadowFilter = (input) => {
if (input.length === 0) {
return 'none'
}
diff --git a/src/services/theme_data/theme_data_3.service.js b/src/services/theme_data/theme_data_3.service.js
@@ -22,7 +22,7 @@ import {
normalizeCombination,
findRules
} from './iss_utils.js'
-import { parseCssShadow } from './css_utils.js'
+import { deserializeShadow } from './iss_deserializer.js'
// Ensuring the order of components
const components = {
@@ -37,18 +37,18 @@ const components = {
ChatMessage: null
}
-const findShadow = (shadows, { dynamicVars, staticVars }) => {
+export const findShadow = (shadows, { dynamicVars, staticVars }) => {
return (shadows || []).map(shadow => {
let targetShadow
if (typeof shadow === 'string') {
if (shadow.startsWith('$')) {
targetShadow = process(shadow, shadowFunctions, { findColor, findShadow }, { dynamicVars, staticVars })
} else if (shadow.startsWith('--')) {
- const [variable] = shadow.split(/,/g).map(str => str.trim()) // discarding modifier since it's not supported
- const variableSlot = variable.substring(2)
+ // modifiers are completely unsupported here
+ const variableSlot = shadow.substring(2)
return findShadow(staticVars[variableSlot], { dynamicVars, staticVars })
} else {
- targetShadow = parseCssShadow(shadow)
+ targetShadow = deserializeShadow(shadow)
}
} else {
targetShadow = shadow
@@ -62,54 +62,63 @@ const findShadow = (shadows, { dynamicVars, staticVars }) => {
})
}
-const findColor = (color, { dynamicVars, staticVars }) => {
- if (typeof color !== 'string' || (!color.startsWith('--') && !color.startsWith('$'))) return color
- let targetColor = null
- if (color.startsWith('--')) {
- const [variable, modifier] = color.split(/,/g).map(str => str.trim())
- const variableSlot = variable.substring(2)
- if (variableSlot === 'stack') {
- const { r, g, b } = dynamicVars.stacked
- targetColor = { r, g, b }
- } else if (variableSlot.startsWith('parent')) {
- if (variableSlot === 'parent') {
- const { r, g, b } = dynamicVars.lowerLevelBackground
+export const findColor = (color, { dynamicVars, staticVars }) => {
+ try {
+ if (typeof color !== 'string' || (!color.startsWith('--') && !color.startsWith('$'))) return color
+ let targetColor = null
+ if (color.startsWith('--')) {
+ // Modifier support is pretty much for v2 themes only
+ const [variable, modifier] = color.split(/,/g).map(str => str.trim())
+ const variableSlot = variable.substring(2)
+ if (variableSlot === 'stack') {
+ const { r, g, b } = dynamicVars.stacked
targetColor = { r, g, b }
+ } else if (variableSlot.startsWith('parent')) {
+ if (variableSlot === 'parent') {
+ const { r, g, b } = dynamicVars.lowerLevelBackground
+ targetColor = { r, g, b }
+ } else {
+ const virtualSlot = variableSlot.replace(/^parent/, '')
+ targetColor = convert(dynamicVars.lowerLevelVirtualDirectivesRaw[virtualSlot]).rgb
+ }
} else {
- const virtualSlot = variableSlot.replace(/^parent/, '')
- targetColor = convert(dynamicVars.lowerLevelVirtualDirectivesRaw[virtualSlot]).rgb
- }
- } else {
- switch (variableSlot) {
- case 'inheritedBackground':
- targetColor = convert(dynamicVars.inheritedBackground).rgb
- break
- case 'background':
- targetColor = convert(dynamicVars.background).rgb
- break
- default:
- targetColor = convert(staticVars[variableSlot]).rgb
+ switch (variableSlot) {
+ case 'inheritedBackground':
+ targetColor = convert(dynamicVars.inheritedBackground).rgb
+ break
+ case 'background':
+ targetColor = convert(dynamicVars.background).rgb
+ break
+ default:
+ targetColor = convert(staticVars[variableSlot]).rgb
+ }
}
- }
- if (modifier) {
- const effectiveBackground = dynamicVars.lowerLevelBackground ?? targetColor
- const isLightOnDark = relativeLuminance(convert(effectiveBackground).rgb) < 0.5
- const mod = isLightOnDark ? 1 : -1
- targetColor = brightness(Number.parseFloat(modifier) * mod, targetColor).rgb
+ if (modifier) {
+ const effectiveBackground = dynamicVars.lowerLevelBackground ?? targetColor
+ const isLightOnDark = relativeLuminance(convert(effectiveBackground).rgb) < 0.5
+ const mod = isLightOnDark ? 1 : -1
+ targetColor = brightness(Number.parseFloat(modifier) * mod, targetColor).rgb
+ }
}
- }
- if (color.startsWith('$')) {
- try {
- targetColor = process(color, colorFunctions, { findColor }, { dynamicVars, staticVars })
- } catch (e) {
- console.error('Failure executing color function', e)
- targetColor = '#FF00FF'
+ if (color.startsWith('$')) {
+ try {
+ targetColor = process(color, colorFunctions, { findColor }, { dynamicVars, staticVars })
+ } catch (e) {
+ console.error('Failure executing color function', e)
+ targetColor = '#FF00FF'
+ }
}
+ // Color references other color
+ return targetColor
+ } catch (e) {
+ throw new Error(`Couldn't find color "${color}", variables are:
+Static:
+${JSON.stringify(staticVars, null, 2)}
+Dynamic:
+${JSON.stringify(dynamicVars, null, 2)}`)
}
- // Color references other color
- return targetColor
}
const getTextColorAlpha = (directives, intendedTextColor, dynamicVars, staticVars) => {
@@ -164,25 +173,25 @@ export const getEngineChecksum = () => engineChecksum
* @param {boolean} onlyNormalState - only use components 'normal' states, meant for generating theme
* previews since states are the biggest factor for compilation time and are completely unnecessary
* when previewing multiple themes at same time
- * @param {string} rootComponentName - [UNTESTED] which component to start from, meant for previewing a
- * part of the theme (i.e. just the button) for themes 3 editor.
*/
export const init = ({
inputRuleset,
ultimateBackgroundColor,
debug = false,
liteMode = false,
+ editMode = false,
onlyNormalState = false,
- rootComponentName = 'Root'
+ initialStaticVars = {}
}) => {
+ const rootComponentName = 'Root'
if (!inputRuleset) throw new Error('Ruleset is null or undefined!')
- const staticVars = {}
+ const staticVars = { ...initialStaticVars }
const stacked = {}
const computed = {}
const rulesetUnsorted = [
...Object.values(components)
- .map(c => (c.defaultRules || []).map(r => ({ component: c.name, ...r, source: 'Built-in' })))
+ .map(c => (c.defaultRules || []).map(r => ({ source: 'Built-in', component: c.name, ...r })))
.reduce((acc, arr) => [...acc, ...arr], []),
...inputRuleset
].map(rule => {
@@ -198,223 +207,257 @@ export const init = ({
const ruleset = rulesetUnsorted
.map((data, index) => ({ data, index }))
- .sort(({ data: a, index: ai }, { data: b, index: bi }) => {
+ .toSorted(({ data: a, index: ai }, { data: b, index: bi }) => {
const parentsA = unroll(a).length
const parentsB = unroll(b).length
- if (parentsA === parentsB) {
- if (a.component === 'Text') return -1
- if (b.component === 'Text') return 1
+ let aScore = 0
+ let bScore = 0
+
+ aScore += parentsA * 1000
+ bScore += parentsB * 1000
+
+ aScore += a.variant !== 'normal' ? 100 : 0
+ bScore += b.variant !== 'normal' ? 100 : 0
+
+ aScore += a.state.filter(x => x !== 'normal').length * 1000
+ bScore += b.state.filter(x => x !== 'normal').length * 1000
+
+ aScore += a.component === 'Text' ? 1 : 0
+ bScore += b.component === 'Text' ? 1 : 0
+
+ // Debug
+ a._specificityScore = aScore
+ b._specificityScore = bScore
+
+ if (aScore === bScore) {
return ai - bi
}
- if (parentsA === 0 && parentsB !== 0) return -1
- if (parentsB === 0 && parentsA !== 0) return 1
- return parentsA - parentsB
+ return aScore - bScore
})
.map(({ data }) => data)
+ if (!ultimateBackgroundColor) {
+ console.warn('No ultimate background color provided, falling back to panel color')
+ const rootRule = ruleset.findLast((x) => (x.component === 'Root' && x.directives?.['--bg']))
+ ultimateBackgroundColor = rootRule.directives['--bg'].split('|')[1].trim()
+ }
+
const virtualComponents = new Set(Object.values(components).filter(c => c.virtual).map(c => c.name))
+ const nonEditableComponents = new Set(Object.values(components).filter(c => c.notEditable).map(c => c.name))
const processCombination = (combination) => {
- const selector = ruleToSelector(combination, true)
- const cssSelector = ruleToSelector(combination)
-
- const parentSelector = selector.split(/ /g).slice(0, -1).join(' ')
- const soloSelector = selector.split(/ /g).slice(-1)[0]
-
- const lowerLevelSelector = parentSelector
- const lowerLevelBackground = computed[lowerLevelSelector]?.background
- const lowerLevelVirtualDirectives = computed[lowerLevelSelector]?.virtualDirectives
- const lowerLevelVirtualDirectivesRaw = computed[lowerLevelSelector]?.virtualDirectivesRaw
-
- const dynamicVars = computed[selector] || {
- lowerLevelBackground,
- lowerLevelVirtualDirectives,
- lowerLevelVirtualDirectivesRaw
- }
+ try {
+ const selector = ruleToSelector(combination, true)
+ const cssSelector = ruleToSelector(combination)
- // Inheriting all of the applicable rules
- const existingRules = ruleset.filter(findRules(combination))
- const computedDirectives = existingRules.map(r => r.directives).reduce((acc, directives) => ({ ...acc, ...directives }), {})
- const computedRule = {
- ...combination,
- directives: computedDirectives
- }
+ const parentSelector = selector.split(/ /g).slice(0, -1).join(' ')
+ const soloSelector = selector.split(/ /g).slice(-1)[0]
- computed[selector] = computed[selector] || {}
- computed[selector].computedRule = computedRule
- computed[selector].dynamicVars = dynamicVars
-
- if (virtualComponents.has(combination.component)) {
- const virtualName = [
- '--',
- combination.component.toLowerCase(),
- combination.variant === 'normal'
- ? ''
- : combination.variant[0].toUpperCase() + combination.variant.slice(1).toLowerCase(),
- ...sortBy(combination.state.filter(x => x !== 'normal')).map(state => state[0].toUpperCase() + state.slice(1).toLowerCase())
- ].join('')
-
- let inheritedTextColor = computedDirectives.textColor
- let inheritedTextAuto = computedDirectives.textAuto
- let inheritedTextOpacity = computedDirectives.textOpacity
- let inheritedTextOpacityMode = computedDirectives.textOpacityMode
- const lowerLevelTextSelector = [...selector.split(/ /g).slice(0, -1), soloSelector].join(' ')
- const lowerLevelTextRule = computed[lowerLevelTextSelector]
-
- if (inheritedTextColor == null || inheritedTextOpacity == null || inheritedTextOpacityMode == null) {
- inheritedTextColor = computedDirectives.textColor ?? lowerLevelTextRule.textColor
- inheritedTextAuto = computedDirectives.textAuto ?? lowerLevelTextRule.textAuto
- inheritedTextOpacity = computedDirectives.textOpacity ?? lowerLevelTextRule.textOpacity
- inheritedTextOpacityMode = computedDirectives.textOpacityMode ?? lowerLevelTextRule.textOpacityMode
+ const lowerLevelSelector = parentSelector
+ let lowerLevelBackground = computed[lowerLevelSelector]?.background
+ if (editMode && !lowerLevelBackground) {
+ // FIXME hack for editor until it supports handling component backgrounds
+ lowerLevelBackground = '#00FFFF'
}
+ const lowerLevelVirtualDirectives = computed[lowerLevelSelector]?.virtualDirectives
+ const lowerLevelVirtualDirectivesRaw = computed[lowerLevelSelector]?.virtualDirectivesRaw
- const newTextRule = {
- ...computedRule,
- directives: {
- ...computedRule.directives,
- textColor: inheritedTextColor,
- textAuto: inheritedTextAuto ?? 'preserve',
- textOpacity: inheritedTextOpacity,
- textOpacityMode: inheritedTextOpacityMode
- }
+ const dynamicVars = computed[selector] || {
+ lowerLevelBackground,
+ lowerLevelVirtualDirectives,
+ lowerLevelVirtualDirectivesRaw
}
- dynamicVars.inheritedBackground = lowerLevelBackground
- dynamicVars.stacked = convert(stacked[lowerLevelSelector]).rgb
-
- const intendedTextColor = convert(findColor(inheritedTextColor, { dynamicVars, staticVars })).rgb
- const textColor = newTextRule.directives.textAuto === 'no-auto'
- ? intendedTextColor
- : getTextColor(
- convert(stacked[lowerLevelSelector]).rgb,
- intendedTextColor,
- newTextRule.directives.textAuto === 'preserve'
- )
- const virtualDirectives = computed[lowerLevelSelector].virtualDirectives || {}
- const virtualDirectivesRaw = computed[lowerLevelSelector].virtualDirectivesRaw || {}
-
- // Storing color data in lower layer to use as custom css properties
- virtualDirectives[virtualName] = getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
- virtualDirectivesRaw[virtualName] = textColor
-
- computed[lowerLevelSelector].virtualDirectives = virtualDirectives
- computed[lowerLevelSelector].virtualDirectivesRaw = virtualDirectivesRaw
-
- return {
- dynamicVars,
- selector: cssSelector.split(/ /g).slice(0, -1).join(' '),
+ // Inheriting all of the applicable rules
+ const existingRules = ruleset.filter(findRules(combination))
+ const computedDirectives =
+ existingRules
+ .map(r => r.directives)
+ .reduce((acc, directives) => ({ ...acc, ...directives }), {})
+ const computedRule = {
...combination,
- directives: {},
- virtualDirectives: {
- [virtualName]: getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
- },
- virtualDirectivesRaw: {
- [virtualName]: textColor
- }
+ directives: computedDirectives
}
- } else {
+
computed[selector] = computed[selector] || {}
+ computed[selector].computedRule = computedRule
+ computed[selector].dynamicVars = dynamicVars
+
+ if (virtualComponents.has(combination.component)) {
+ const virtualName = [
+ '--',
+ combination.component.toLowerCase(),
+ combination.variant === 'normal'
+ ? ''
+ : combination.variant[0].toUpperCase() + combination.variant.slice(1).toLowerCase(),
+ ...sortBy(combination.state.filter(x => x !== 'normal')).map(state => state[0].toUpperCase() + state.slice(1).toLowerCase())
+ ].join('')
+
+ let inheritedTextColor = computedDirectives.textColor
+ let inheritedTextAuto = computedDirectives.textAuto
+ let inheritedTextOpacity = computedDirectives.textOpacity
+ let inheritedTextOpacityMode = computedDirectives.textOpacityMode
+ const lowerLevelTextSelector = [...selector.split(/ /g).slice(0, -1), soloSelector].join(' ')
+ const lowerLevelTextRule = computed[lowerLevelTextSelector]
+
+ if (inheritedTextColor == null || inheritedTextOpacity == null || inheritedTextOpacityMode == null) {
+ inheritedTextColor = computedDirectives.textColor ?? lowerLevelTextRule.textColor
+ inheritedTextAuto = computedDirectives.textAuto ?? lowerLevelTextRule.textAuto
+ inheritedTextOpacity = computedDirectives.textOpacity ?? lowerLevelTextRule.textOpacity
+ inheritedTextOpacityMode = computedDirectives.textOpacityMode ?? lowerLevelTextRule.textOpacityMode
+ }
- // TODO: DEFAULT TEXT COLOR
- const lowerLevelStackedBackground = stacked[lowerLevelSelector] || convert(ultimateBackgroundColor).rgb
-
- if (computedDirectives.background) {
- let inheritRule = null
- const variantRules = ruleset.filter(
- findRules({
- component: combination.component,
- variant: combination.variant,
- parent: combination.parent
- })
- )
- const lastVariantRule = variantRules[variantRules.length - 1]
- if (lastVariantRule) {
- inheritRule = lastVariantRule
- } else {
- const normalRules = ruleset.filter(findRules({
- component: combination.component,
- parent: combination.parent
- }))
- const lastNormalRule = normalRules[normalRules.length - 1]
- inheritRule = lastNormalRule
+ const newTextRule = {
+ ...computedRule,
+ directives: {
+ ...computedRule.directives,
+ textColor: inheritedTextColor,
+ textAuto: inheritedTextAuto ?? 'preserve',
+ textOpacity: inheritedTextOpacity,
+ textOpacityMode: inheritedTextOpacityMode
+ }
+ }
+
+ dynamicVars.inheritedBackground = lowerLevelBackground
+ dynamicVars.stacked = convert(stacked[lowerLevelSelector]).rgb
+
+ const intendedTextColor = convert(findColor(inheritedTextColor, { dynamicVars, staticVars })).rgb
+ const textColor = newTextRule.directives.textAuto === 'no-auto'
+ ? intendedTextColor
+ : getTextColor(
+ convert(stacked[lowerLevelSelector]).rgb,
+ intendedTextColor,
+ newTextRule.directives.textAuto === 'preserve'
+ )
+ const virtualDirectives = computed[lowerLevelSelector].virtualDirectives || {}
+ const virtualDirectivesRaw = computed[lowerLevelSelector].virtualDirectivesRaw || {}
+
+ // Storing color data in lower layer to use as custom css properties
+ virtualDirectives[virtualName] = getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
+ virtualDirectivesRaw[virtualName] = textColor
+
+ computed[lowerLevelSelector].virtualDirectives = virtualDirectives
+ computed[lowerLevelSelector].virtualDirectivesRaw = virtualDirectivesRaw
+
+ return {
+ dynamicVars,
+ selector: cssSelector.split(/ /g).slice(0, -1).join(' '),
+ ...combination,
+ directives: {},
+ virtualDirectives: {
+ [virtualName]: getTextColorAlpha(newTextRule.directives, textColor, dynamicVars)
+ },
+ virtualDirectivesRaw: {
+ [virtualName]: textColor
+ }
}
+ } else {
+ computed[selector] = computed[selector] || {}
+
+ // TODO: DEFAULT TEXT COLOR
+ const lowerLevelStackedBackground = stacked[lowerLevelSelector] || convert(ultimateBackgroundColor).rgb
+
+ if (computedDirectives.background) {
+ let inheritRule = null
+ const variantRules = ruleset.filter(
+ findRules({
+ component: combination.component,
+ variant: combination.variant,
+ parent: combination.parent
+ })
+ )
+ const lastVariantRule = variantRules[variantRules.length - 1]
+ if (lastVariantRule) {
+ inheritRule = lastVariantRule
+ } else {
+ const normalRules = ruleset.filter(findRules({
+ component: combination.component,
+ parent: combination.parent
+ }))
+ const lastNormalRule = normalRules[normalRules.length - 1]
+ inheritRule = lastNormalRule
+ }
- const inheritSelector = ruleToSelector({ ...inheritRule, parent: combination.parent }, true)
- const inheritedBackground = computed[inheritSelector].background
+ const inheritSelector = ruleToSelector({ ...inheritRule, parent: combination.parent }, true)
+ const inheritedBackground = computed[inheritSelector].background
- dynamicVars.inheritedBackground = inheritedBackground
+ dynamicVars.inheritedBackground = inheritedBackground
- const rgb = convert(findColor(computedDirectives.background, { dynamicVars, staticVars })).rgb
+ const rgb = convert(findColor(computedDirectives.background, { dynamicVars, staticVars })).rgb
- if (!stacked[selector]) {
- let blend
- const alpha = computedDirectives.opacity ?? 1
- if (alpha >= 1) {
- blend = rgb
- } else if (alpha <= 0) {
- blend = lowerLevelStackedBackground
- } else {
- blend = alphaBlend(rgb, computedDirectives.opacity, lowerLevelStackedBackground)
+ if (!stacked[selector]) {
+ let blend
+ const alpha = computedDirectives.opacity ?? 1
+ if (alpha >= 1) {
+ blend = rgb
+ } else if (alpha <= 0) {
+ blend = lowerLevelStackedBackground
+ } else {
+ blend = alphaBlend(rgb, computedDirectives.opacity, lowerLevelStackedBackground)
+ }
+ stacked[selector] = blend
+ computed[selector].background = { ...rgb, a: computedDirectives.opacity ?? 1 }
}
- stacked[selector] = blend
- computed[selector].background = { ...rgb, a: computedDirectives.opacity ?? 1 }
}
- }
- if (computedDirectives.shadow) {
- dynamicVars.shadow = flattenDeep(findShadow(flattenDeep(computedDirectives.shadow), { dynamicVars, staticVars }))
- }
+ if (computedDirectives.shadow) {
+ dynamicVars.shadow = flattenDeep(findShadow(flattenDeep(computedDirectives.shadow), { dynamicVars, staticVars }))
+ }
- if (!stacked[selector]) {
- computedDirectives.background = 'transparent'
- computedDirectives.opacity = 0
- stacked[selector] = lowerLevelStackedBackground
- computed[selector].background = { ...lowerLevelStackedBackground, a: 0 }
- }
+ if (!stacked[selector]) {
+ computedDirectives.background = 'transparent'
+ computedDirectives.opacity = 0
+ stacked[selector] = lowerLevelStackedBackground
+ computed[selector].background = { ...lowerLevelStackedBackground, a: 0 }
+ }
- dynamicVars.stacked = stacked[selector]
- dynamicVars.background = computed[selector].background
+ dynamicVars.stacked = stacked[selector]
+ dynamicVars.background = computed[selector].background
- const dynamicSlots = Object.entries(computedDirectives).filter(([k, v]) => k.startsWith('--'))
+ const dynamicSlots = Object.entries(computedDirectives).filter(([k, v]) => k.startsWith('--'))
- dynamicSlots.forEach(([k, v]) => {
- const [type, ...value] = v.split('|').map(x => x.trim()) // woah, Extreme!
- switch (type) {
- case 'color': {
- const color = findColor(value[0], { dynamicVars, staticVars })
- dynamicVars[k] = color
- if (combination.component === 'Root') {
- staticVars[k.substring(2)] = color
+ dynamicSlots.forEach(([k, v]) => {
+ const [type, value] = v.split('|').map(x => x.trim()) // woah, Extreme!
+ switch (type) {
+ case 'color': {
+ const color = findColor(value, { dynamicVars, staticVars })
+ dynamicVars[k] = color
+ if (combination.component === rootComponentName) {
+ staticVars[k.substring(2)] = color
+ }
+ break
}
- break
- }
- case 'shadow': {
- const shadow = value
- dynamicVars[k] = shadow
- if (combination.component === 'Root') {
- staticVars[k.substring(2)] = shadow
+ case 'shadow': {
+ const shadow = value.split(/,/g).map(s => s.trim()).filter(x => x)
+ dynamicVars[k] = shadow
+ if (combination.component === rootComponentName) {
+ staticVars[k.substring(2)] = shadow
+ }
+ break
}
- break
- }
- case 'generic': {
- dynamicVars[k] = value
- if (combination.component === 'Root') {
- staticVars[k.substring(2)] = value
+ case 'generic': {
+ dynamicVars[k] = value
+ if (combination.component === rootComponentName) {
+ staticVars[k.substring(2)] = value
+ }
+ break
}
- break
}
+ })
+
+ const rule = {
+ dynamicVars,
+ selector: cssSelector,
+ ...combination,
+ directives: computedDirectives
}
- })
- const rule = {
- dynamicVars,
- selector: cssSelector,
- ...combination,
- directives: computedDirectives
+ return rule
}
-
- return rule
+ } catch (e) {
+ const { component, variant, state } = combination
+ throw new Error(`Error processing combination ${component}.${variant}:${state.join(':')}: ${e}`)
}
}
@@ -425,11 +468,15 @@ export const init = ({
variants: originalVariants = {}
} = component
- const validInnerComponents = (
- liteMode
- ? (component.validInnerComponentsLite || component.validInnerComponents)
- : component.validInnerComponents
- ) || []
+ let validInnerComponents
+ if (editMode) {
+ const temp = (component.validInnerComponentsLite || component.validInnerComponents || [])
+ validInnerComponents = temp.filter(c => virtualComponents.has(c) && !nonEditableComponents.has(c))
+ } else if (liteMode) {
+ validInnerComponents = (component.validInnerComponentsLite || component.validInnerComponents || [])
+ } else {
+ validInnerComponents = component.validInnerComponents || []
+ }
// Normalizing states and variants to always include "normal"
const states = { normal: '', ...originalStates }
@@ -471,7 +518,7 @@ export const init = ({
combination.component = component.name
combination.lazy = component.lazy || parent?.lazy
combination.parent = parent
- if (combination.state.indexOf('hover') >= 0) {
+ if (!liteMode && combination.state.indexOf('hover') >= 0) {
combination.lazy = true
}
@@ -504,10 +551,23 @@ export const init = ({
console.debug('Eager processing took ' + (t2 - t1) + ' ms')
}
+ // optimization to traverse big-ass array only once instead of twice
+ const eager = []
+ const lazy = []
+
+ result.forEach(x => {
+ if (typeof x === 'function') {
+ lazy.push(x)
+ } else {
+ eager.push(x)
+ }
+ })
+
return {
- lazy: result.filter(x => typeof x === 'function'),
- eager: result.filter(x => typeof x !== 'function'),
+ lazy,
+ eager,
staticVars,
- engineChecksum
+ engineChecksum,
+ themeChecksum: sum([lazy, eager])
}
}
diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js
@@ -25,6 +25,7 @@ const fetchAndUpdate = ({
userId = false,
listId = false,
statusId = false,
+ bookmarkFolderId = false,
tag = false,
until,
since
@@ -49,6 +50,7 @@ const fetchAndUpdate = ({
args.userId = userId
args.listId = listId
args.statusId = statusId
+ args.bookmarkFolderId = bookmarkFolderId
args.tag = tag
args.withMuted = !hideMutedPosts
if (loggedIn && ['friends', 'public', 'publicAndExternal'].includes(timeline)) {
@@ -80,15 +82,16 @@ const fetchAndUpdate = ({
})
}
-const startFetching = ({ timeline = 'friends', credentials, store, userId = false, listId = false, statusId = false, tag = false }) => {
+const startFetching = ({ timeline = 'friends', credentials, store, userId = false, listId = false, statusId = false, bookmarkFolderId = false, tag = false }) => {
const rootState = store.rootState || store.state
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
const showImmediately = timelineData.visibleStatuses.length === 0
timelineData.userId = userId
timelineData.listId = listId
- fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, statusId, tag })
+ timelineData.bookmarkFolderId = bookmarkFolderId
+ fetchAndUpdate({ timeline, credentials, store, showImmediately, userId, listId, statusId, bookmarkFolderId, tag })
const boundFetchAndUpdate = () =>
- fetchAndUpdate({ timeline, credentials, store, userId, listId, statusId, tag })
+ fetchAndUpdate({ timeline, credentials, store, userId, listId, statusId, bookmarkFolderId, tag })
return promiseInterval(boundFetchAndUpdate, 10000)
}
const timelineFetcher = {
diff --git a/src/services/version/version.service.js b/src/services/version/version.service.js
@@ -1,6 +0,0 @@
-
-export const extractCommit = versionString => {
- const regex = /-g(\w+)/i
- const matches = versionString.match(regex)
- return matches ? matches[1] : ''
-}
diff --git a/static/.gitignore b/static/.gitignore
@@ -0,0 +1 @@
+*.custom.*
diff --git a/static/config.json b/static/config.json
@@ -24,6 +24,8 @@
"showInstanceSpecificPanel": false,
"sidebarRight": false,
"subjectLineBehavior": "email",
- "theme": "pleroma-dark",
+ "theme": null,
+ "style": null,
+ "palette": null,
"webPushNotifications": false
}
diff --git a/static/palettes/index.json b/static/palettes/index.json
@@ -0,0 +1,32 @@
+{
+ "pleroma-dark": [ "Pleroma Dark", "#121a24", "#182230", "#b9b9ba", "#d8a070", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
+ "pleroma-light": [ "Pleroma Light", "#f2f4f6", "#dbe0e8", "#304055", "#f86f0f", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
+ "classic-dark": {
+ "name": "Classic Dark",
+ "bg": "#161c20",
+ "fg": "#282e32",
+ "text": "#b9b9b9",
+ "link": "#baaa9c",
+ "cRed": "#d31014",
+ "cGreen": "#0fa00f",
+ "cBlue": "#0095ff",
+ "cOrange": "#ffa500"
+ },
+ "bird": [ "Bird", "#f8fafd", "#e6ecf0", "#14171a", "#0084b8", "#e0245e", "#17bf63", "#1b95e0", "#fab81e"],
+ "pleroma-amoled": [ "Pleroma Dark AMOLED", "#000000", "#111111", "#b0b0b1", "#d8a070", "#aa0000", "#0fa00f", "#0095ff", "#d59500"],
+ "tomorrow-night": {
+ "name": "Tomorrow Night",
+ "bg": "#1d1f21",
+ "fg": "#373b41",
+ "link": "#81a2be",
+ "text": "#c5c8c6",
+ "cRed": "#cc6666",
+ "cBlue": "#8abeb7",
+ "cGreen": "#b5bd68",
+ "cOrange": "#de935f",
+ "_cYellow": "#f0c674",
+ "_cPurple": "#b294bb"
+ },
+ "ir-black": [ "Ir Black", "#000000", "#242422", "#b5b3aa", "#ff6c60", "#FF6C60", "#A8FF60", "#96CBFE", "#FFFFB6" ],
+ "monokai": [ "Monokai", "#272822", "#383830", "#f8f8f2", "#f92672", "#F92672", "#a6e22e", "#66d9ef", "#f4bf75" ]
+}
diff --git a/src/assets/pleromatan_apology.png b/static/pleromatan_apology.png
Binary files differ.
diff --git a/src/assets/pleromatan_apology_fox.png b/static/pleromatan_apology_fox.png
Binary files differ.
diff --git a/static/pleromatan_orz.png b/static/pleromatan_orz.png
Binary files differ.
diff --git a/static/pleromatan_orz_fox.png b/static/pleromatan_orz_fox.png
Binary files differ.
diff --git a/static/styles.json b/static/styles.json
@@ -1,12 +1,6 @@
{
"pleroma-dark": "/static/themes/pleroma-dark.json",
"pleroma-light": "/static/themes/pleroma-light.json",
- "pleroma-amoled": [ "Pleroma Dark AMOLED", "#000000", "#111111", "#b0b0b1", "#d8a070", "#aa0000", "#0fa00f", "#0095ff", "#d59500"],
- "classic-dark": [ "Classic Dark", "#161c20", "#282e32", "#b9b9b9", "#baaa9c", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
- "bird": [ "Bird", "#f8fafd", "#e6ecf0", "#14171a", "#0084b8", "#e0245e", "#17bf63", "#1b95e0", "#fab81e"],
- "ir-black": [ "Ir Black", "#000000", "#242422", "#b5b3aa", "#ff6c60", "#FF6C60", "#A8FF60", "#96CBFE", "#FFFFB6" ],
- "monokai": [ "Monokai", "#272822", "#383830", "#f8f8f2", "#f92672", "#F92672", "#a6e22e", "#66d9ef", "#f4bf75" ],
-
"redmond-xx": "/static/themes/redmond-xx.json",
"redmond-xx-se": "/static/themes/redmond-xx-se.json",
"redmond-xxi": "/static/themes/redmond-xxi.json",
diff --git a/static/styles/Breezy DX.piss b/static/styles/Breezy DX.piss
@@ -0,0 +1,80 @@
+@meta {
+ name: Breezy DX;
+ author: HJ;
+ license: WTFPL;
+ website: ebin.club;
+}
+
+@palette.Dark {
+ bg: #292C32;
+ fg: #292C32;
+ text: #ffffff;
+ link: #1CA4F3;
+ accent: #1CA4F3;
+ cRed: #f41a51;
+ cBlue: #1CA4F3;
+ cGreen: #1af46e;
+ cOrange: #f4af1a;
+}
+
+@palette.Light {
+ bg: #EFF0F2;
+ fg: #EFF0F2;
+ text: #1B1F22;
+ underlay: #5d6086;
+ accent: #1CA4F3;
+ cBlue: #1CA4F3;
+ cRed: #f41a51;
+ cGreen: #1af46e;
+ cOrange: #f4af1a;
+ border: #d8e6f9;
+ link: #1CA4F3;
+}
+
+Root {
+ --badgeNotification: color | --cRed;
+ --buttonDefaultHoverGlow: shadow | inset 0 0 0 1 --accent / 1;
+ --buttonDefaultFocusGlow: shadow | inset 0 0 0 1 --accent / 1;
+ --buttonDefaultShadow: shadow | inset 0 0 0 1 --text / 0.35, 0 5 5 -5 #000000 / 0.35;
+ --buttonDefaultBevel: shadow | inset 0 14 14 -14 #FFFFFF / 0.1;
+ --buttonPressedBevel: shadow | inset 0 -20 20 -20 #000000 / 0.05;
+ --defaultInputBevel: shadow | inset 0 0 0 1 --text / 0.35;
+ --defaultInputHoverGlow: shadow | 0 0 0 1 --accent / 1;
+ --defaultInputFocusGlow: shadow | 0 0 0 1 --link / 1;
+}
+
+Button:disabled {
+ shadow: --buttonDefaultBevel, --buttonDefaultShadow
+}
+
+Button:hover {
+ shadow: --buttonDefaultHoverGlow, --buttonDefaultBevel, --buttonDefaultShadow
+}
+
+Button:toggled {
+ background: $blend(--bg 0.3 --accent)
+}
+
+Button:pressed {
+ background: $blend(--bg 0.8 --accent)
+}
+
+Button:pressed:toggled {
+ background: $blend(--bg 0.2 --accent)
+}
+
+Button:toggled:hover {
+ background: $blend(--bg 0.3 --accent)
+}
+
+Input {
+ shadow: --defaultInputBevel
+}
+
+PanelHeader {
+ shadow: inset 0 30 30 -30 #ffffff / 0.25
+}
+
+Tab:hover {
+ shadow: --buttonDefaultHoverGlow, --buttonDefaultBevel, --buttonDefaultShadow
+}
diff --git a/static/styles/Redmond DX.piss b/static/styles/Redmond DX.piss
@@ -0,0 +1,169 @@
+@meta {
+ name: Redmond DX;
+ author: HJ;
+ license: WTFPL;
+ website: ebin.club;
+}
+
+@palette.Modern {
+ bg: #D3CFC7;
+ fg: #092369;
+ text: #000000;
+ link: #0000FF;
+ accent: #A5C9F0;
+ cRed: #FF3000;
+ cBlue: #009EFF;
+ cGreen: #309E00;
+ cOrange: #FFCE00;
+}
+
+@palette.Classic {
+ bg: #BFBFBF;
+ fg: #000180;
+ text: #000000;
+ link: #0000FF;
+ accent: #A5C9F0;
+ cRed: #FF0000;
+ cBlue: #2E2ECE;
+ cGreen: #007E00;
+ cOrange: #CE8F5F;
+}
+
+@palette.Vapor {
+ bg: #F0ADCD;
+ fg: #bca4ee;
+ text: #602040;
+ link: #064745;
+ accent: #9DF7C8;
+ cRed: #86004a;
+ cBlue: #0e5663;
+ cGreen: #0a8b51;
+ cOrange: #787424;
+}
+
+Root {
+ --gradientColor: color | --accent;
+ --inputColor: color | #FFFFFF;
+ --bevelLight: color | $brightness(--bg 50);
+ --bevelDark: color | $brightness(--bg -20);
+ --bevelExtraDark: color | #404040;
+ --buttonDefaultBevel: shadow | $borderSide(--bevelExtraDark bottom-right 1 1), $borderSide(--bevelLight top-left 1 1), $borderSide(--bevelDark bottom-right 1 2);
+ --buttonPressedFocusedBevel: shadow | inset 0 0 0 1 #000000 / 1 #Outer , inset 0 0 0 2 --bevelExtraDark / 1 #inner;
+ --buttonPressedBevel: shadow | $borderSide(--bevelDark top-left 1 1), $borderSide(--bevelLight bottom-right 1 1), $borderSide(--bevelExtraDark top-left 1 2);
+ --defaultInputBevel: shadow | $borderSide(--bevelDark top-left 1 1), $borderSide(--bevelLight bottom-right 1 1), $borderSide(--bevelExtraDark top-left 1 2), $borderSide(--bg bottom-right 1 2);
+}
+
+Button:toggled {
+ background: --bg;
+ shadow: --buttonPressedBevel
+}
+
+Button:focused {
+ shadow: --buttonDefaultBevel, 0 0 0 1 #000000 / 1
+}
+
+Button:pressed {
+ shadow: --buttonPressedBevel
+}
+
+Button:hover {
+ shadow: --buttonDefaultBevel;
+ background: --bg
+}
+
+Button {
+ shadow: --buttonDefaultBevel;
+ background: --bg;
+ roundness: 0
+}
+
+Button:pressed:hover {
+ shadow: --buttonPressedBevel
+}
+
+Button:hover:pressed:focused {
+ shadow: --buttonPressedFocusedBevel
+}
+
+Button:pressed:focused {
+ shadow: --buttonPressedFocusedBevel
+}
+
+Button:toggled:pressed {
+ shadow: --buttonPressedFocusedBevel
+}
+
+Input {
+ background: $mod(--bg -80);
+ shadow: --defaultInputBevel;
+ roundness: 0
+}
+
+Input:focused {
+ shadow: inset 0 0 0 1 #000000 / 1, --defaultInputBevel
+}
+
+Input:focused:hover {
+ shadow: --defaultInputBevel
+}
+
+Input:focused:hover:disabled {
+ shadow: --defaultInputBevel
+}
+
+Input:hover {
+ shadow: --defaultInputBevel
+}
+
+Input:disabled {
+ shadow: --defaultInputBevel
+}
+
+Panel {
+ shadow: --buttonDefaultBevel;
+ roundness: 0
+}
+
+PanelHeader {
+ shadow: inset -1100 0 1000 -1000 --gradientColor / 1 #Gradient ;
+ background: --fg
+}
+
+Tab:hover {
+ background: --bg;
+ shadow: --buttonDefaultBevel
+}
+
+Tab:active {
+ background: --bg
+}
+
+Tab:active:hover {
+ background: --bg;
+ shadow: --defaultButtonBevel
+}
+
+Tab:active:hover:disabled {
+ background: --bg
+}
+
+Tab:hover:disabled {
+ background: --bg
+}
+
+Tab:disabled {
+ background: --bg
+}
+
+Tab {
+ background: --bg;
+ shadow: --buttonDefaultBevel
+}
+
+Tab:hover:active {
+ shadow: --buttonDefaultBevel
+}
+
+TopBar Link {
+ textColor: #ffffff
+}
diff --git a/static/styles/index.json b/static/styles/index.json
@@ -0,0 +1,4 @@
+{
+ "RedmondDX": "/static/styles/Redmond DX.piss",
+ "BreezyDX": "/static/styles/Breezy DX.piss"
+}
diff --git a/test/unit/specs/components/gallery.spec.js b/test/unit/specs/components/gallery.spec.js
@@ -0,0 +1,276 @@
+import Gallery from 'src/components/gallery/gallery.vue'
+
+describe('Gallery', () => {
+ let local
+
+ it('attachments is falsey', () => {
+ local = { attachments: false }
+ expect(Gallery.computed.rows.call(local)).to.eql([])
+
+ local = { attachments: null }
+ expect(Gallery.computed.rows.call(local)).to.eql([])
+
+ local = { attachments: undefined }
+ expect(Gallery.computed.rows.call(local)).to.eql([])
+ })
+
+ it('no attachments', () => {
+ local = { attachments: [] }
+ expect(Gallery.computed.rows.call(local)).to.eql([])
+ })
+
+ it('one audio attachment', () => {
+ local = {
+ attachments: [
+ { mimetype: 'audio/mpeg' }
+ ]
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] }
+ ])
+ })
+
+ it('one image attachment', () => {
+ local = {
+ attachments: [
+ { mimetype: 'image/png' }
+ ]
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { items: [{ mimetype: 'image/png' }] }
+ ])
+ })
+
+ it('one audio attachment and one image attachment', () => {
+ local = {
+ attachments: [
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/png' }
+ ]
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/png' }] }
+ ])
+ })
+
+ it('has "size" key set to "hide"', () => {
+ let local
+ local = {
+ attachments: [
+ { mimetype: 'audio/mpeg' }
+ ],
+ size: 'hide'
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { minimal: true, items: [{ mimetype: 'audio/mpeg' }] }
+ ])
+
+ local = {
+ attachments: [
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' }
+ ],
+ size: 'hide'
+ }
+
+ // When defining `size: hide`, the `items` aren't
+ // grouped and `audio` isn't set
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { minimal: true, items: [{ mimetype: 'image/jpg' }] },
+ { minimal: true, items: [{ mimetype: 'image/png' }] },
+ { minimal: true, items: [{ mimetype: 'image/jpg' }] },
+ { minimal: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { minimal: true, items: [{ mimetype: 'image/png' }] },
+ { minimal: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { minimal: true, items: [{ mimetype: 'image/jpg' }] },
+ { minimal: true, items: [{ mimetype: 'image/png' }] },
+ { minimal: true, items: [{ mimetype: 'image/jpg' }] }
+ ])
+ })
+
+ // types other than image or audio should be `minimal`
+ it('non-image/audio', () => {
+ let local
+ local = {
+ attachments: [
+ { mimetype: 'plain/text' }
+ ]
+ }
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { minimal: true, items: [{ mimetype: 'plain/text' }] }
+ ])
+
+ // No grouping of non-image/audio items
+ local = {
+ attachments: [
+ { mimetype: 'plain/text' },
+ { mimetype: 'plain/text' },
+ { mimetype: 'plain/text' }
+ ]
+ }
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { minimal: true, items: [{ mimetype: 'plain/text' }] },
+ { minimal: true, items: [{ mimetype: 'plain/text' }] },
+ { minimal: true, items: [{ mimetype: 'plain/text' }] }
+ ])
+
+ local = {
+ attachments: [
+ { mimetype: 'image/png' },
+ { mimetype: 'plain/text' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'audio/mpeg' }
+ ]
+ }
+ // NOTE / TODO: When defining `size: hide`, the `items` aren't
+ // grouped and `audio` isn't set
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { items: [{ mimetype: 'image/png' }] },
+ { minimal: true, items: [{ mimetype: 'plain/text' }] },
+ { items: [{ mimetype: 'image/jpg' }] },
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] }
+ ])
+ })
+
+ it('mixed attachments', () => {
+ local = {
+ attachments: [
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/jpg' }
+ ]
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/png' }] },
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }, { mimetype: 'image/jpg' }] }
+ ])
+
+ local = {
+ attachments: [
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'audio/mpeg' }
+ ]
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
+ { items: [{ mimetype: 'image/jpg' }] },
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/png' }] },
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] }
+ ])
+
+ local = {
+ attachments: [
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' }
+ ]
+ }
+
+ // Group by three-per-row, unless there's one dangling, then stick it on the end of the last row
+ // https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1785#note_98514
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] }
+ ])
+
+ local = {
+ attachments: [
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' }
+ ]
+ }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }, { mimetype: 'image/png' }] },
+ { items: [{ mimetype: 'image/jpg' }, { mimetype: 'image/png' }] }
+ ])
+ })
+
+ it('does not do grouping when grid is set', () => {
+ const attachments = [
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'image/jpg' }
+ ]
+
+ local = { grid: true, attachments }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { grid: true, items: attachments }
+ ])
+ })
+
+ it('limit is set', () => {
+ const attachments = [
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/png' },
+ { mimetype: 'image/jpg' },
+ { mimetype: 'audio/mpeg' },
+ { mimetype: 'image/jpg' }
+ ]
+
+ let local
+ local = { attachments, limit: 2 }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/png' }] }
+ ])
+
+ local = { attachments, limit: 3 }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/png' }, { mimetype: 'image/jpg' }] }
+ ])
+
+ local = { attachments, limit: 4 }
+
+ expect(Gallery.computed.rows.call(local)).to.eql([
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] },
+ { items: [{ mimetype: 'image/png' }, { mimetype: 'image/jpg' }] },
+ { audio: true, items: [{ mimetype: 'audio/mpeg' }] }
+ ])
+ })
+})
diff --git a/test/unit/specs/services/theme_data/iss_deserializer.spec.js b/test/unit/specs/services/theme_data/iss_deserializer.spec.js
@@ -0,0 +1,40 @@
+import { deserialize } from 'src/services/theme_data/iss_deserializer.js'
+import { serialize } from 'src/services/theme_data/iss_serializer.js'
+const componentsContext = require.context('src', true, /\.style.js(on)?$/)
+
+describe('ISS (de)serialization', () => {
+ componentsContext.keys().forEach(key => {
+ const component = componentsContext(key).default
+
+ it(`(De)serialization of component ${component.name} works`, () => {
+ const normalized = component.defaultRules.map(x => ({ component: component.name, ...x }))
+ const serialized = serialize(normalized)
+ const deserialized = deserialize(serialized)
+
+ // for some reason comparing objects directly fails the assert
+ expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2))
+ })
+ })
+
+ /*
+ // Debug snippet
+ const onlyComponent = componentsContext('./components/panel_header.style.js').default
+ it.only(`(De)serialization of component ${onlyComponent.name} works`, () => {
+ const normalized = onlyComponent.defaultRules.map(x => ({ component: onlyComponent.name, ...x }))
+ console.log('BEGIN INPUT ================')
+ console.log(normalized)
+ console.log('END INPUT ==================')
+ const serialized = serialize(normalized)
+ console.log('BEGIN SERIAL ===============')
+ console.log(serialized)
+ console.log('END SERIAL =================')
+ const deserialized = deserialize(serialized)
+ console.log('BEGIN DESERIALIZED =========')
+ console.log(serialized)
+ console.log('END DESERIALIZED ===========')
+
+ // for some reason comparing objects directly fails the assert
+ expect(JSON.stringify(deserialized, null, 2)).to.equal(JSON.stringify(normalized, null, 2))
+ })
+ /* */
+})
diff --git a/test/unit/specs/services/version/version.service.spec.js b/test/unit/specs/services/version/version.service.spec.js
@@ -1,11 +0,0 @@
-import { extractCommit } from 'src/services/version/version.service.js'
-
-describe('extractCommit', () => {
- it('return short commit hash following "-g" characters', () => {
- expect(extractCommit('1.0.0-45-g5e7aeebc')).to.eql('5e7aeebc')
- })
-
- it('return short commit hash without branch name', () => {
- expect(extractCommit('1.0.0-45-g5e7aeebc-branch')).to.eql('5e7aeebc')
- })
-})
diff --git a/yarn.lock b/yarn.lock
@@ -46,6 +46,14 @@
"@babel/highlight" "^7.23.4"
chalk "^2.4.2"
+"@babel/code-frame@^7.24.1":
+ version "7.24.2"
+ resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae"
+ integrity sha512-y5+tLQyV8pg3fsiln67BVLD1P13Eg4lh5RW9mF0zUuvLrv9uIQ4MCL+CRT+FTsBlBjcIan6PGsLcBN0m3ClUyQ==
+ dependencies:
+ "@babel/highlight" "^7.24.2"
+ picocolors "^1.0.0"
+
"@babel/compat-data@^7.17.7":
version "7.17.7"
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.7.tgz#078d8b833fbbcc95286613be8c716cef2b519fa2"
@@ -173,14 +181,14 @@
"@jridgewell/trace-mapping" "^0.3.17"
jsesc "^2.5.1"
-"@babel/generator@^7.23.6":
- version "7.23.6"
- resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e"
- integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==
+"@babel/generator@^7.24.1":
+ version "7.24.1"
+ resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.1.tgz#e67e06f68568a4ebf194d1c6014235344f0476d0"
+ integrity sha512-DfCRfZsBcrPEHUfuBMgbJ1Ut01Y/itOs+hY2nFLgqsqXd52/iSiVq5TITtUasIUgm+IIKdY2/1I7auiQOEeC9A==
dependencies:
- "@babel/types" "^7.23.6"
- "@jridgewell/gen-mapping" "^0.3.2"
- "@jridgewell/trace-mapping" "^0.3.17"
+ "@babel/types" "^7.24.0"
+ "@jridgewell/gen-mapping" "^0.3.5"
+ "@jridgewell/trace-mapping" "^0.3.25"
jsesc "^2.5.1"
"@babel/helper-annotate-as-pure@^7.16.7":
@@ -422,7 +430,7 @@
dependencies:
"@babel/types" "^7.21.4"
-"@babel/helper-module-imports@^7.22.15":
+"@babel/helper-module-imports@~7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0"
integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==
@@ -711,6 +719,16 @@
chalk "^2.4.2"
js-tokens "^4.0.0"
+"@babel/highlight@^7.24.2":
+ version "7.24.2"
+ resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.2.tgz#3f539503efc83d3c59080a10e6634306e0370d26"
+ integrity sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==
+ dependencies:
+ "@babel/helper-validator-identifier" "^7.22.20"
+ chalk "^2.4.2"
+ js-tokens "^4.0.0"
+ picocolors "^1.0.0"
+
"@babel/parser@^7.14.7":
version "7.18.11"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.11.tgz#68bb07ab3d380affa9a3f96728df07969645d2d9"
@@ -756,6 +774,11 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b"
integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==
+"@babel/parser@^7.23.9", "@babel/parser@^7.24.0", "@babel/parser@^7.24.1":
+ version "7.24.1"
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.1.tgz#1e416d3627393fab1cb5b0f2f1796a100ae9133a"
+ integrity sha512-Zo9c7N3xdOIQrNip7Lc9wvRPzlRtovHVE4lkz8WEDr7uYh/GMQhSiIgFxGIArRHYdJE5kxtZjAf8rT0xhdLCzg==
+
"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6":
version "7.18.6"
resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2"
@@ -1465,6 +1488,15 @@
"@babel/parser" "^7.22.15"
"@babel/types" "^7.22.15"
+"@babel/template@^7.23.9":
+ version "7.24.0"
+ resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.24.0.tgz#c6a524aa93a4a05d66aaf31654258fae69d87d50"
+ integrity sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==
+ dependencies:
+ "@babel/code-frame" "^7.23.5"
+ "@babel/parser" "^7.24.0"
+ "@babel/types" "^7.24.0"
+
"@babel/traverse@^7.18.10":
version "7.18.10"
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.10.tgz#37ad97d1cb00efa869b91dd5d1950f8a6cf0cb08"
@@ -1561,19 +1593,19 @@
debug "^4.1.0"
globals "^11.1.0"
-"@babel/traverse@^7.23.7":
- version "7.23.7"
- resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.7.tgz#9a7bf285c928cb99b5ead19c3b1ce5b310c9c305"
- integrity sha512-tY3mM8rH9jM0YHFGyfC0/xf+SB5eKUu7HPj7/k3fpi9dAlsMc5YbQvDi0Sh2QTPXqMhyaAtzAr807TIyfQrmyg==
+"@babel/traverse@^7.23.9":
+ version "7.24.1"
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.1.tgz#d65c36ac9dd17282175d1e4a3c49d5b7988f530c"
+ integrity sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ==
dependencies:
- "@babel/code-frame" "^7.23.5"
- "@babel/generator" "^7.23.6"
+ "@babel/code-frame" "^7.24.1"
+ "@babel/generator" "^7.24.1"
"@babel/helper-environment-visitor" "^7.22.20"
"@babel/helper-function-name" "^7.23.0"
"@babel/helper-hoist-variables" "^7.22.5"
"@babel/helper-split-export-declaration" "^7.22.6"
- "@babel/parser" "^7.23.6"
- "@babel/types" "^7.23.6"
+ "@babel/parser" "^7.24.1"
+ "@babel/types" "^7.24.0"
debug "^4.3.1"
globals "^11.1.0"
@@ -1663,7 +1695,7 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
-"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.6":
+"@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0":
version "7.23.6"
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.6.tgz#be33fdb151e1f5a56877d704492c240fc71c7ccd"
integrity sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==
@@ -1672,6 +1704,15 @@
"@babel/helper-validator-identifier" "^7.22.20"
to-fast-properties "^2.0.0"
+"@babel/types@^7.23.9", "@babel/types@^7.24.0":
+ version "7.24.0"
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.24.0.tgz#3b951f435a92e7333eba05b7566fd297960ea1bf"
+ integrity sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==
+ dependencies:
+ "@babel/helper-string-parser" "^7.23.4"
+ "@babel/helper-validator-identifier" "^7.22.20"
+ to-fast-properties "^2.0.0"
+
"@chenfengyuan/vue-qrcode@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@chenfengyuan/vue-qrcode/-/vue-qrcode-2.0.0.tgz#8cd01f6fc528d471680ebe812ec47c830aea7e63"
@@ -1866,6 +1907,15 @@
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jridgewell/trace-mapping" "^0.3.9"
+"@jridgewell/gen-mapping@^0.3.5":
+ version "0.3.5"
+ resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36"
+ integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==
+ dependencies:
+ "@jridgewell/set-array" "^1.2.1"
+ "@jridgewell/sourcemap-codec" "^1.4.10"
+ "@jridgewell/trace-mapping" "^0.3.24"
+
"@jridgewell/resolve-uri@3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
@@ -1876,11 +1926,21 @@
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz#68eb521368db76d040a6315cdb24bf2483037b9c"
integrity sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew==
+"@jridgewell/resolve-uri@^3.1.0":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6"
+ integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==
+
"@jridgewell/set-array@^1.0.0", "@jridgewell/set-array@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==
+"@jridgewell/set-array@^1.2.1":
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280"
+ integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==
+
"@jridgewell/source-map@^0.3.2":
version "0.3.2"
resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb"
@@ -1899,7 +1959,7 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz#771a1d8d744eeb71b6adb35808e1a6c7b9b8c8ec"
integrity sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==
-"@jridgewell/sourcemap-codec@^1.4.15":
+"@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
@@ -1928,6 +1988,14 @@
"@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14"
+"@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25":
+ version "0.3.25"
+ resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0"
+ integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==
+ dependencies:
+ "@jridgewell/resolve-uri" "^3.1.0"
+ "@jridgewell/sourcemap-codec" "^1.4.14"
+
"@jridgewell/trace-mapping@^0.3.9":
version "0.3.14"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed"
@@ -2014,10 +2082,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"
-"@ruffle-rs/ruffle@0.1.0-nightly.2024.3.17":
- version "0.1.0-nightly.2024.3.17"
- resolved "https://registry.yarnpkg.com/@ruffle-rs/ruffle/-/ruffle-0.1.0-nightly.2024.3.17.tgz#df3626f7277ed85742a602508c191d3186b0cabc"
- integrity sha512-Wl/7CDZSmomOcfBeOYOO6xUUrN7upnGRDJEm3fpCtN3j5kU8dGF8xzaziAttjkD8byLYS09InE7PlUTyyAwCiQ==
+"@ruffle-rs/ruffle@0.1.0-nightly.2024.8.21":
+ version "0.1.0-nightly.2024.8.21"
+ resolved "https://registry.yarnpkg.com/@ruffle-rs/ruffle/-/ruffle-0.1.0-nightly.2024.8.21.tgz#e4bdb6386b487dc12471681c7265f565d813e1cf"
+ integrity sha512-nfTPJEPJPo4MrUACuLoW19wNKgF1rrbxCO5if1MZfsWcUxZ6+pwlQWq1JxXalxEjYg8VwJtWzWEchWJQkMckwA==
"@sinclair/typebox@^0.24.1":
version "0.24.51"
@@ -2059,10 +2127,10 @@
resolved "https://registry.yarnpkg.com/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz#5981a8db18b56ba38ef0efb7d995b12aa7b51918"
integrity sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==
-"@socket.io/base64-arraybuffer@~1.0.2":
- version "1.0.2"
- resolved "https://registry.yarnpkg.com/@socket.io/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#568d9beae00b0d835f4f8c53fd55714986492e61"
- integrity sha512-dOlCBKnDw4iShaIsH/bxujKTM18+2TOAsYz+KSc11Am38H4q5Xw8Bbz97ZYdrVNM+um3p7w86Bvvmcn9q+5+eQ==
+"@socket.io/component-emitter@~3.1.0":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz#821f8442f4175d8f0467b9daf26e3a18e2d02af2"
+ integrity sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==
"@testim/chrome-version@^1.1.3":
version "1.1.3"
@@ -2084,11 +2152,6 @@
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
-"@types/component-emitter@^1.2.10":
- version "1.2.11"
- resolved "https://registry.yarnpkg.com/@types/component-emitter/-/component-emitter-1.2.11.tgz#50d47d42b347253817a39709fef03ce66a108506"
- integrity sha512-SRXjM+tfsSlA9VuG8hGO2nft2p8zjXCK1VcC6N4NXbBbYbSia9kzCChYQajIjzIqOOOuh5Ock6MmV2oux4jDZQ==
-
"@types/cookie@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.1.tgz#bfd02c1f2224567676c1545199f87c3a861d878d"
@@ -2225,37 +2288,37 @@
resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.4.0.tgz#8d53a1e21347db8edbe54d339902583176de09f2"
integrity sha512-JkqXfCkUDp4PIlFdDQ0TdXoIejMtTHP67/pvxlgeY+u5k3LEdKuWZ3LK6xkxo52uDoABIVyRwqVkfLQJhk7VBA==
-"@vue/babel-helper-vue-transform-on@1.2.1":
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.2.1.tgz#3a48da809025b9a0eb4f4b3030e0d316c40fac0a"
- integrity sha512-jtEXim+pfyHWwvheYwUwSXm43KwQo8nhOBDyjrUITV6X2tB7lJm6n/+4sqR8137UVZZul5hBzWHdZ2uStYpyRQ==
+"@vue/babel-helper-vue-transform-on@1.2.2":
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-transform-on/-/babel-helper-vue-transform-on-1.2.2.tgz#7f1f817a4f00ad531651a8d1d22e22d9e42807ef"
+ integrity sha512-nOttamHUR3YzdEqdM/XXDyCSdxMA9VizUKoroLX6yTyRtggzQMHXcmwh8a7ZErcJttIBIc9s68a1B8GZ+Dmvsw==
-"@vue/babel-plugin-jsx@1.2.1":
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/@vue/babel-plugin-jsx/-/babel-plugin-jsx-1.2.1.tgz#786c5395605a1d2463d6b10d8a7f3abdc01d25ce"
- integrity sha512-Yy9qGktktXhB39QE99So/BO2Uwm/ZG+gpL9vMg51ijRRbINvgbuhyJEi4WYmGRMx/MSTfK0xjgZ3/MyY+iLCEg==
+"@vue/babel-plugin-jsx@1.2.2":
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/@vue/babel-plugin-jsx/-/babel-plugin-jsx-1.2.2.tgz#eb426fb4660aa510bb8d188ff0ec140405a97d8a"
+ integrity sha512-nYTkZUVTu4nhP199UoORePsql0l+wj7v/oyQjtThUVhJl1U+6qHuoVhIvR3bf7eVKjbCK+Cs2AWd7mi9Mpz9rA==
dependencies:
- "@babel/helper-module-imports" "^7.22.15"
+ "@babel/helper-module-imports" "~7.22.15"
"@babel/helper-plugin-utils" "^7.22.5"
"@babel/plugin-syntax-jsx" "^7.23.3"
- "@babel/template" "^7.22.15"
- "@babel/traverse" "^7.23.7"
- "@babel/types" "^7.23.6"
- "@vue/babel-helper-vue-transform-on" "1.2.1"
- "@vue/babel-plugin-resolve-type" "1.2.1"
+ "@babel/template" "^7.23.9"
+ "@babel/traverse" "^7.23.9"
+ "@babel/types" "^7.23.9"
+ "@vue/babel-helper-vue-transform-on" "1.2.2"
+ "@vue/babel-plugin-resolve-type" "1.2.2"
camelcase "^6.3.0"
html-tags "^3.3.1"
svg-tags "^1.0.0"
-"@vue/babel-plugin-resolve-type@1.2.1":
- version "1.2.1"
- resolved "https://registry.yarnpkg.com/@vue/babel-plugin-resolve-type/-/babel-plugin-resolve-type-1.2.1.tgz#874fb3e02d033b3dd2e0fc883a3d1ceef0bdf39b"
- integrity sha512-IOtnI7pHunUzHS/y+EG/yPABIAp0VN8QhQ0UCS09jeMVxgAnI9qdOzO85RXdQGxq+aWCdv8/+k3W0aYO6j/8fQ==
+"@vue/babel-plugin-resolve-type@1.2.2":
+ version "1.2.2"
+ resolved "https://registry.yarnpkg.com/@vue/babel-plugin-resolve-type/-/babel-plugin-resolve-type-1.2.2.tgz#66844898561da6449e0f4a261b0c875118e0707b"
+ integrity sha512-EntyroPwNg5IPVdUJupqs0CFzuf6lUrVvCspmv2J1FITLeGnUCuoGNNk78dgCusxEiYj6RMkTJflGSxk5aIC4A==
dependencies:
"@babel/code-frame" "^7.23.5"
- "@babel/helper-module-imports" "^7.22.15"
+ "@babel/helper-module-imports" "~7.22.15"
"@babel/helper-plugin-utils" "^7.22.5"
- "@babel/parser" "^7.23.6"
+ "@babel/parser" "^7.23.9"
"@vue/compiler-sfc" "^3.4.15"
"@vue/compiler-core@3.2.45":
@@ -3144,30 +3207,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
-caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001370:
- version "1.0.30001376"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001376.tgz#af2450833e5a06873fbb030a9556ca9461a2736d"
- integrity sha512-I27WhtOQ3X3v3it9gNs/oTpoE5KpwmqKR5oKPA8M0G7uMXh9Ty81Q904HpKUrM30ei7zfcL5jE7AXefgbOfMig==
-
-caniuse-lite@^1.0.30001359:
- version "1.0.30001366"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001366.tgz#c73352c83830a9eaf2dea0ff71fb4b9a4bbaa89c"
- integrity sha512-yy7XLWCubDobokgzudpkKux8e0UOOnLHE6mlNJBzT3lZJz6s5atSEzjoL+fsCPkI0G8MP5uVdDx1ur/fXEWkZA==
-
-caniuse-lite@^1.0.30001400:
- version "1.0.30001418"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001418.tgz#5f459215192a024c99e3e3a53aac310fc7cf24e6"
- integrity sha512-oIs7+JL3K9JRQ3jPZjlH6qyYDp+nBTCais7hjh0s+fuBwufc7uZ7hPYMXrDOJhV360KGMTcczMRObk0/iMqZRg==
-
-caniuse-lite@^1.0.30001587:
- version "1.0.30001591"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz#16745e50263edc9f395895a7cd468b9f3767cf33"
- integrity sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==
-
-caniuse-lite@^1.0.30001599:
- version "1.0.30001599"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001599.tgz#571cf4f3f1506df9bf41fcbb6d10d5d017817bce"
- integrity sha512-LRAQHZ4yT1+f9LemSMeqdMpMxZcc4RMWdj4tiFe3G8tNkWK+E58g+/tzotb5cU6TbcVJLr4fySiAW7XmxQvZQA==
+caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001359, caniuse-lite@^1.0.30001370, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001587, caniuse-lite@^1.0.30001599:
+ version "1.0.30001662"
+ resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz"
+ integrity sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA==
chai-nightwatch@0.5.3:
version "0.5.3"
@@ -3424,11 +3467,6 @@ compare-versions@^5.0.1:
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-5.0.3.tgz#a9b34fea217472650ef4a2651d905f42c28ebfd7"
integrity sha512-4UZlZP8Z99MGEY+Ovg/uJxJuvoXuN4M6B3hKaiackiHrgzQFEe3diJi1mf1PNHbFujM7FvLrK2bpgIaImbtZ1A==
-component-emitter@~1.3.0:
- version "1.3.0"
- resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
- integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==
-
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -3778,6 +3816,13 @@ debug@^4.1.0, debug@^4.1.1:
dependencies:
ms "^2.1.1"
+debug@~4.3.4:
+ version "4.3.6"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b"
+ integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==
+ dependencies:
+ ms "2.1.2"
+
decamelize-keys@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/decamelize-keys/-/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
@@ -4074,17 +4119,15 @@ end-of-stream@^1.1.0:
dependencies:
once "^1.4.0"
-engine.io-parser@~5.0.3:
- version "5.0.3"
- resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.0.3.tgz#ca1f0d7b11e290b4bfda251803baea765ed89c09"
- integrity sha512-BtQxwF27XUNnSafQLvDi0dQ8s3i6VgzSoQMJacpIcGNrlUdfHSKbgm3jmjCVvQluGzqwujQMPAoMai3oYSTurg==
- dependencies:
- "@socket.io/base64-arraybuffer" "~1.0.2"
+engine.io-parser@~5.2.1:
+ version "5.2.3"
+ resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.2.3.tgz#00dc5b97b1f233a23c9398d0209504cf5f94d92f"
+ integrity sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==
-engine.io@~6.2.0:
- version "6.2.0"
- resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.2.0.tgz#003bec48f6815926f2b1b17873e576acd54f41d0"
- integrity sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==
+engine.io@~6.5.2:
+ version "6.5.5"
+ resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-6.5.5.tgz#430b80d8840caab91a50e9e23cb551455195fc93"
+ integrity sha512-C5Pn8Wk+1vKBoHghJODM63yk8MvrO9EWZUfkAt5HAqIgPE4/8FF0PEGHXtEd40l223+cE5ABWuPzm38PHFXfMA==
dependencies:
"@types/cookie" "^0.4.1"
"@types/cors" "^2.8.12"
@@ -4094,8 +4137,8 @@ engine.io@~6.2.0:
cookie "~0.4.1"
cors "~2.8.5"
debug "~4.3.1"
- engine.io-parser "~5.0.3"
- ws "~8.2.3"
+ engine.io-parser "~5.2.1"
+ ws "~8.17.1"
enhanced-resolve@^5.10.0:
version "5.10.0"
@@ -5966,13 +6009,13 @@ karma-coverage@2.2.0:
istanbul-reports "^3.0.5"
minimatch "^3.0.4"
-karma-firefox-launcher@2.1.2:
- version "2.1.2"
- resolved "https://registry.yarnpkg.com/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz#9a38cc783c579a50f3ed2a82b7386186385cfc2d"
- integrity sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==
+karma-firefox-launcher@2.1.3:
+ version "2.1.3"
+ resolved "https://registry.yarnpkg.com/karma-firefox-launcher/-/karma-firefox-launcher-2.1.3.tgz#b278a4cbffa92ab81394b1a398813847b0624a85"
+ integrity sha512-LMM2bseebLbYjODBOVt7TCPP9OI2vZIXCavIXhkO9m+10Uj5l7u/SKoeRmYx8FYHTVGZSpk6peX+3BMHC1WwNw==
dependencies:
is-wsl "^2.2.0"
- which "^2.0.1"
+ which "^3.0.0"
karma-mocha-reporter@2.2.5:
version "2.2.5"
@@ -6018,10 +6061,10 @@ karma-webpack@5.0.0:
minimatch "^3.0.4"
webpack-merge "^4.1.5"
-karma@6.4.2:
- version "6.4.2"
- resolved "https://registry.yarnpkg.com/karma/-/karma-6.4.2.tgz#a983f874cee6f35990c4b2dcc3d274653714de8e"
- integrity sha512-C6SU/53LB31BEgRg+omznBEMY4SjHU3ricV6zBcAe1EeILKkeScr+fZXtaI5WyDbkVowJxxAI6h73NcFPmXolQ==
+karma@6.4.4:
+ version "6.4.4"
+ resolved "https://registry.yarnpkg.com/karma/-/karma-6.4.4.tgz#dfa5a426cf5a8b53b43cd54ef0d0d09742351492"
+ integrity sha512-LrtUxbdvt1gOpo3gxG+VAJlJAEMhbWlM4YrFQgql98FwF7+K8K12LYO4hnDdUkNjeztYrOXEMqgTajSWgmtI/w==
dependencies:
"@colors/colors" "1.5.0"
body-parser "^1.19.0"
@@ -6042,7 +6085,7 @@ karma@6.4.2:
qjobs "^1.2.0"
range-parser "^1.2.1"
rimraf "^3.0.2"
- socket.io "^4.4.1"
+ socket.io "^4.7.2"
source-map "^0.6.1"
tmp "^0.2.1"
ua-parser-js "^0.7.30"
@@ -7158,6 +7201,11 @@ p-try@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1"
+pako@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"
+ integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==
+
pako@~1.0.2:
version "1.0.11"
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
@@ -8381,31 +8429,34 @@ slice-ansi@^4.0.0:
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"
-socket.io-adapter@~2.4.0:
- version "2.4.0"
- resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz#b50a4a9ecdd00c34d4c8c808224daa1a786152a6"
- integrity sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==
+socket.io-adapter@~2.5.2:
+ version "2.5.5"
+ resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz#c7a1f9c703d7756844751b6ff9abfc1780664082"
+ integrity sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==
+ dependencies:
+ debug "~4.3.4"
+ ws "~8.17.1"
-socket.io-parser@~4.0.4:
- version "4.0.4"
- resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.0.4.tgz#9ea21b0d61508d18196ef04a2c6b9ab630f4c2b0"
- integrity sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==
+socket.io-parser@~4.2.4:
+ version "4.2.4"
+ resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.4.tgz#c806966cf7270601e47469ddeec30fbdfda44c83"
+ integrity sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==
dependencies:
- "@types/component-emitter" "^1.2.10"
- component-emitter "~1.3.0"
+ "@socket.io/component-emitter" "~3.1.0"
debug "~4.3.1"
-socket.io@^4.4.1:
- version "4.5.1"
- resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.5.1.tgz#aa7e73f8a6ce20ee3c54b2446d321bbb6b1a9029"
- integrity sha512-0y9pnIso5a9i+lJmsCdtmTTgJFFSvNQKDnPQRz28mGNnxbmqYg2QPtJTLFxhymFZhAIn50eHAKzJeiNaKr+yUQ==
+socket.io@^4.7.2:
+ version "4.7.5"
+ resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-4.7.5.tgz#56eb2d976aef9d1445f373a62d781a41c7add8f8"
+ integrity sha512-DmeAkF6cwM9jSfmp6Dr/5/mfMwb5Z5qRrSXLpo3Fq5SqyU8CMF15jIN4ZhfSwu35ksM1qmHZDQ/DK5XTccSTvA==
dependencies:
accepts "~1.3.4"
base64id "~2.0.0"
+ cors "~2.8.5"
debug "~4.3.2"
- engine.io "~6.2.0"
- socket.io-adapter "~2.4.0"
- socket.io-parser "~4.0.4"
+ engine.io "~6.5.2"
+ socket.io-adapter "~2.5.2"
+ socket.io-parser "~4.2.4"
"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.2:
version "1.0.2"
@@ -9417,6 +9468,13 @@ which@^1.3.1:
dependencies:
isexe "^2.0.0"
+which@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/which/-/which-3.0.1.tgz#89f1cd0c23f629a8105ffe69b8172791c87b4be1"
+ integrity sha512-XA1b62dzQzLfaEOSQFTCOd5KFf/1VSzZo7/7TUjnya6u0vGGKzU96UQBZTAThCb2j4/xjBAyii1OhRLJEivHvg==
+ dependencies:
+ isexe "^2.0.0"
+
widest-line@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca"
@@ -9479,10 +9537,10 @@ ws@^8.2.3:
resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==
-ws@~8.2.3:
- version "8.2.3"
- resolved "https://registry.yarnpkg.com/ws/-/ws-8.2.3.tgz#63a56456db1b04367d0b721a0b80cae6d8becbba"
- integrity sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==
+ws@~8.17.1:
+ version "8.17.1"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
+ integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==
xml-name-validator@^4.0.0:
version "4.0.0"