Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme rework #662

Merged
merged 128 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
064306a
let's begin
malgojaviro May 18, 2024
2c3f1d5
ui-size -> uc-size and other changes in common.css
malgojaviro May 18, 2024
64f2a73
common.css done
malgojaviro May 18, 2024
8d8208e
ActivityHeader done
malgojaviro May 18, 2024
24ecd08
TEMPORARY add Inter to font-family
malgojaviro May 18, 2024
1562757
FileItem done
malgojaviro May 18, 2024
11182c2
almost
malgojaviro May 18, 2024
0b713d6
modal
malgojaviro May 18, 2024
7a907da
ProgressBar
malgojaviro May 18, 2024
4e25ccc
CloudImageEditorActivity
malgojaviro May 18, 2024
5d4c1ae
ProgressBarCommon
malgojaviro May 18, 2024
41a0133
UploadList
malgojaviro May 18, 2024
078d4ab
SourceBtn
malgojaviro May 18, 2024
a5040c3
DropArea intermediate
malgojaviro May 18, 2024
1fcc5a2
DropArea
malgojaviro May 18, 2024
84aa05f
Copyright
malgojaviro May 18, 2024
d80c833
CameraSource
malgojaviro May 18, 2024
9ff54e4
Color
malgojaviro May 18, 2024
efbf819
ConfirmationDialog
malgojaviro May 18, 2024
3f7b503
EditableCanvas
malgojaviro May 18, 2024
129e4fe
ExternalSource
malgojaviro May 18, 2024
cc29348
Icon
malgojaviro May 18, 2024
7fd9441
Range
malgojaviro May 18, 2024
d67d1a4
Select
malgojaviro May 18, 2024
5e30115
SimpleBtn intermediate
malgojaviro May 18, 2024
8bcce6c
Tabs
malgojaviro May 18, 2024
9c56acc
UploadList error colors
malgojaviro May 18, 2024
df65293
UrlSource
malgojaviro May 18, 2024
22c5a24
Video
malgojaviro May 18, 2024
16401ce
cleanup
malgojaviro May 18, 2024
61857a1
increase dialog corner radius
malgojaviro May 19, 2024
4e55f5c
remove --ui-size
malgojaviro May 19, 2024
15fdcec
minimal intermediate
malgojaviro May 19, 2024
37dec5d
fix add-more icon
malgojaviro May 19, 2024
56535ef
fix copyright in inline
malgojaviro May 19, 2024
690ea08
added --uc-preview-size, minimal intermediate
malgojaviro May 19, 2024
33da281
fix transparency issues in minimal
malgojaviro May 19, 2024
4f3bcdd
minimal done
malgojaviro May 19, 2024
174cc58
minor changes
malgojaviro May 19, 2024
d2671bd
Copyright: fix more transparency issues
malgojaviro May 19, 2024
b25e056
separate variables for simplebtn
malgojaviro May 19, 2024
e6d4896
simplify SimpleBtn
malgojaviro May 19, 2024
f039504
prepare button to switch to lr-basic
malgojaviro May 19, 2024
0eba4e8
intermediate commit
malgojaviro May 20, 2024
333f621
slider recolored
malgojaviro May 20, 2024
b97bbf9
intermediate commit
malgojaviro May 20, 2024
a47d4f5
keep colors together
malgojaviro May 21, 2024
4098dc4
dark theme
malgojaviro May 23, 2024
3239e53
Merge branch 'feat/theme-rework' into feat/editor-theming
malgojaviro May 23, 2024
e6bbb2b
controls coloring done
malgojaviro May 24, 2024
e4a206a
color the crop guides
malgojaviro May 24, 2024
94edac0
minor
malgojaviro May 24, 2024
ffa738f
fix operation control active state
malgojaviro May 24, 2024
bb3dff4
filter-control icon coloring
malgojaviro May 24, 2024
23f13de
rm some hardcode
malgojaviro May 24, 2024
66eb5d3
Merge branch 'main' into feat/theme-rework
malgojaviro May 24, 2024
a48e081
Merge branch 'feat/theme-rework' into feat/editor-theming
malgojaviro May 24, 2024
4edd826
color errors
malgojaviro May 25, 2024
a60a5f0
rm old variables from theme
malgojaviro May 25, 2024
197dd02
dark mode with media query
malgojaviro May 25, 2024
95f65b1
demo background with theme media query
malgojaviro May 25, 2024
01d99fa
cleanup CloudImageEditor's common.css
malgojaviro May 25, 2024
54d7ad1
editor icons update
malgojaviro May 25, 2024
6421921
edit icon is a pencil now
malgojaviro May 25, 2024
f657410
StartFrom: hide DropArea on phones
malgojaviro May 25, 2024
ba5ad03
Merge branch 'main' into feat/theme-rework
malgojaviro May 27, 2024
0c9bb8b
make primary colors derive from one value
malgojaviro May 27, 2024
77b09dc
use system-ui as a default font-family
malgojaviro May 27, 2024
e9b126e
make chroma and hue uniform across grays
malgojaviro May 28, 2024
cdf324a
stop forcing `lr` prefix
malgojaviro May 28, 2024
232cf7a
make theme forceable with classes
malgojaviro May 28, 2024
1b87d4d
rm rules from stylelintrc.cjs
malgojaviro May 28, 2024
7d38e99
add rgb fallback
nd0ut May 30, 2024
aaed842
remove dakrmode css custom property
nd0ut May 30, 2024
4377f36
prevent link styles external override
nd0ut May 30, 2024
842a803
fix typo
nd0ut May 30, 2024
a26b2e7
remove unused css config properties
nd0ut May 30, 2024
afd8776
remove editor host selectors
nd0ut May 30, 2024
18db8ba
remove unnecessary styles from inline
nd0ut May 30, 2024
d715ed1
do not apply ltr direction style
nd0ut May 30, 2024
d355430
remove unnecessary styles
nd0ut May 30, 2024
9a39e76
fix cloud image editor solution styles
nd0ut May 30, 2024
4b67a4e
fix(cloud-image-editor): supress wheel passive handler warning
nd0ut May 30, 2024
306a113
fix editor icons size styles
nd0ut May 30, 2024
ff6626f
fix editor initial flashing
nd0ut May 30, 2024
1e2eb1b
fix editor demo page
nd0ut May 30, 2024
733e6b6
remove unused components
nd0ut May 30, 2024
bce2ebd
Merge branch 'main' into feat/theme-rework
nd0ut May 30, 2024
c4b6bed
update icons sprite
nd0ut May 30, 2024
5d9f06b
rgb fallback
nd0ut Jun 4, 2024
571e2db
Styling selectors via attrs
nd0ut Jun 5, 2024
7387d42
Rename custom property
nd0ut Jun 6, 2024
90b2775
Hide close button for inline mode
nd0ut Jun 6, 2024
e820cba
Fix not-image icon color
nd0ut Jun 6, 2024
8b54321
Refactor CloudImageEditorSolution solution
nd0ut Jun 6, 2024
d2c64b5
Add cursor pointer to the copyright link
nd0ut Jun 6, 2024
6549da6
Fix theme colors specificity
nd0ut Jun 6, 2024
578e4d1
Fix cloud image editor solution styles
nd0ut Jun 6, 2024
77d5618
Add some comments
nd0ut Jun 6, 2024
5040f26
Simplify uc-dark/light selectors
nd0ut Jun 6, 2024
9b97cbf
Move all the theme variables to the :root scope
nd0ut Jun 10, 2024
bcac311
independent vars for simple-btn, rgb fallback fix
malgojaviro Jun 10, 2024
7ee00c4
darker color for dark demos
malgojaviro Jun 10, 2024
617413a
Fix modal content width
nd0ut Jun 10, 2024
d469b7d
Move theme variables back to lr-wgt-common scope
nd0ut Jun 10, 2024
02eeb07
desaturated all grays
malgojaviro Jun 10, 2024
14573b4
brighten simple-btn
malgojaviro Jun 10, 2024
0de01d7
fix destructive-dark
malgojaviro Jun 11, 2024
d65f492
fix potential color notation problems
malgojaviro Jun 12, 2024
d807784
detach simplebtn font values
malgojaviro Jun 12, 2024
8c92927
another syntax mistake fixed
malgojaviro Jun 12, 2024
805b8b3
rm comments in fallback
malgojaviro Jun 12, 2024
99566a6
dark demo background again
malgojaviro Jun 12, 2024
79c3116
Better social sources theming
nd0ut Jun 14, 2024
6b34d86
rm uc-light from raw-regular demo
malgojaviro Jun 17, 2024
af5d3bc
social sources button title `Done`
malgojaviro Jun 17, 2024
5563e3d
remove unneeded icons
malgojaviro Jun 17, 2024
243c995
svg sprite rebuild
malgojaviro Jun 17, 2024
923b986
replaced image in readme
malgojaviro Jun 17, 2024
ed81a1b
rm theme readme
malgojaviro Jun 17, 2024
01f8af4
rm fullscreen icons
malgojaviro Jun 18, 2024
e43d4d9
fix error line height
nd0ut Jun 18, 2024
6753e18
Restore edit-file icon
nd0ut Jun 18, 2024
aa1646e
Rebuild sprites
nd0ut Jun 18, 2024
0dc4781
Add `--uc-line-height` css property
nd0ut Jun 20, 2024
8bded40
Update thumb generation observer options to fix inline mode
nd0ut Jun 21, 2024
75f82d1
Specifiy file item height, add some optimizations to rendering, speci…
nd0ut Jun 21, 2024
5dfd36f
Fix drop-area icon transition
nd0ut Jun 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .stylelintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ module.exports = {
files: ['blocks/**/*.css', 'solutions/**/*.css'],
ignoreFiles: ['**/test/**/*.css'],
plugins: ['./stylelint-force-app-name-prefix.cjs'],
rules: {
'plugin/stylelint-force-app-name-prefix': {
appName: 'lr',
},
},
},
],
};
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ and [even more](<(https://uploadcare.com/features/?ref=github-readme)>).

See Uploadcare Blocks [in action](https://codesandbox.io/p/devbox/github/uploadcare/blocks-examples/tree/main/examples/js-uploader)!

<img alt="Uploadcare Blocks examples" src="https://ucarecdn.com/8035cdc7-f0b9-4ea9-8c15-05816f315481/">
<img alt="Uploadcare Blocks examples" src="https://ucarecdn.com/2883da9f-6962-49db-9947-f91a3e25be2f/-/preview/">

## Core features

Expand Down
1 change: 0 additions & 1 deletion abstract/ActivityBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ ActivityBlock.activities = Object.freeze({
DRAW: 'draw',
UPLOAD_LIST: 'upload-list',
URL: 'url',
CONFIRMATION: 'confirmation',
CLOUD_IMG_EDIT: 'cloud-image-edit',
EXTERNAL: 'external',
DETAILS: 'details',
Expand Down
15 changes: 9 additions & 6 deletions abstract/Block.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const TAG_PREFIX = 'lr-';
export class Block extends BaseComponent {
/** @type {string | null} */
static StateConsumerScope = null;
static className = '';

/** @type {string[]} */
static styleAttrs = [];
requireCtxName = false;
allowCustomTemplate = true;
/** @type {import('./ActivityBlock.js').ActivityType} */
Expand Down Expand Up @@ -128,10 +130,10 @@ export class Block extends BaseComponent {
}

connectedCallback() {
const className = /** @type {typeof Block} */ (this.constructor).className;
if (className) {
this.classList.toggle(`${TAG_PREFIX}${className}`, true);
}
const styleAttrs = /** @type {typeof Block} */ (this.constructor).styleAttrs;
styleAttrs.forEach((attr) => {
this.setAttribute(attr, '');
});

if (this.hasAttribute('retpl')) {
// @ts-ignore TODO: fix this
Expand Down Expand Up @@ -179,7 +181,8 @@ export class Block extends BaseComponent {
}

this.sub(localeStateKey('locale-id'), (localeId) => {
this.style.direction = getLocaleDirection(localeId);
const direction = getLocaleDirection(localeId);
this.style.direction = direction === 'ltr' ? '' : direction;
});
}

Expand Down
3 changes: 2 additions & 1 deletion abstract/SolutionBlock.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { uploaderBlockCtx } from './CTX.js';
import svgIconsSprite from '../blocks/themes/lr-basic/svg-sprite.js';
import { Block } from './Block.js';
import { uploaderBlockCtx } from './CTX.js';

export class SolutionBlock extends Block {
static styleAttrs = ['lr-wgt-common'];
requireCtxName = true;
init$ = uploaderBlockCtx(this);
_template = null;
Expand Down
26 changes: 3 additions & 23 deletions blocks/ActivityHeader/activity-header.css
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
lr-activity-header {
display: flex;
gap: var(--gap-mid);
justify-content: space-between;
padding: var(--gap-mid);
color: var(--clr-txt);
gap: var(--uc-padding);
padding: var(--uc-padding);
color: var(--uc-foreground);
font-weight: 500;
font-size: 1em;
line-height: var(--ui-size);
}

lr-activity-header lr-icon {
height: var(--ui-size);
}

lr-activity-header > * {
display: flex;
align-items: center;
}

lr-activity-header button {
display: inline-flex;
align-items: center;
justify-content: center;
color: var(--clr-txt-mid);
}

lr-activity-header button:hover {
background-color: var(--clr-background);
}

lr-activity-header button:active {
background-color: var(--clr-background-dark);
}
55 changes: 28 additions & 27 deletions blocks/CameraSource/camera-source.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ lr-camera-source {
height: 100%;
max-height: 100%;
overflow: hidden;
background-color: var(--clr-background-light);
border-radius: var(--border-radius-element);
background-color: var(--uc-background);
border-radius: var(--uc-radius);
}

lr-modal lr-camera-source {
width: min(calc(var(--modal-max-w) - var(--gap-mid) * 2), calc(100vw - var(--gap-mid) * 2));
[lr-modal] lr-camera-source {
width: min(calc(var(--uc-dialog-max-width) - var(--uc-padding) * 2), calc(100vw - var(--uc-padding) * 2));
height: 100vh;
max-height: var(--modal-max-content-height);
}
Expand All @@ -22,7 +22,7 @@ lr-camera-source.initialized {

@media only screen and (max-width: 430px) {
lr-camera-source {
width: calc(100vw - var(--gap-mid) * 2);
width: calc(100vw - var(--uc-padding) * 2);
height: var(--modal-content-height-fill, 100%);
}
}
Expand All @@ -33,8 +33,8 @@ lr-camera-source video {
max-height: 100%;
object-fit: contain;
object-position: center center;
background-color: var(--clr-background-dark);
border-radius: var(--border-radius-element);
background-color: var(--uc-muted);
border-radius: var(--uc-radius);
}

lr-camera-source .toolbar {
Expand All @@ -43,47 +43,48 @@ lr-camera-source .toolbar {
display: flex;
justify-content: space-between;
width: 100%;
padding: var(--gap-mid);
background-color: var(--clr-background-light);
padding: var(--uc-padding);
background-color: var(--uc-background);
}

lr-camera-source .content {
display: flex;
flex: 1;
justify-content: center;
width: 100%;
padding: var(--gap-mid);
padding: var(--uc-padding);
padding-top: 0;
overflow: hidden;
}

lr-camera-source .message-box {
--padding: calc(var(--gap-max) * 2);

display: flex;
flex-direction: column;
grid-gap: var(--gap-max);
grid-gap: 40px;
align-items: center;
justify-content: center;
padding: var(--padding) var(--padding) 0 var(--padding);
color: var(--clr-txt);
padding: 40px 40px 0;
color: var(--uc-foreground);
}

lr-camera-source .message-box button {
color: var(--clr-btn-txt-primary);
background-color: var(--clr-btn-bgr-primary);
color: var(--uc-primary-foreground);
background-color: var(--uc-primary);
}

lr-camera-source .shot-btn {
position: absolute;
bottom: var(--gap-max);
width: calc(var(--ui-size) * 1.8);
height: calc(var(--ui-size) * 1.8);
color: var(--clr-background-light);
background-color: var(--clr-txt);
bottom: 20px;
width: 58px;
height: 58px;
color: var(--uc-background);
background-color: var(--uc-foreground);
border-radius: 50%;
opacity: 0.85;
transition: var(--transition-duration) ease;
transition:
bottom var(--uc-transition),
opacity var(--uc-transition),
transform var(--uc-transition);
}

lr-camera-source .shot-btn:hover {
Expand All @@ -92,15 +93,15 @@ lr-camera-source .shot-btn:hover {
}

lr-camera-source .shot-btn:active {
background-color: var(--clr-txt-mid);
transform: scale(1);
opacity: 1;
}

lr-camera-source .shot-btn[disabled] {
bottom: calc(var(--gap-max) * -1 - var(--gap-mid) - var(--ui-size) * 2);
bottom: -80px;
}

lr-camera-source .shot-btn lr-icon svg {
width: calc(var(--ui-size) / 1.5);
height: calc(var(--ui-size) / 1.5);
width: 20px;
height: 20px;
}
2 changes: 1 addition & 1 deletion blocks/CloudImageEditor/src/CloudImageEditorBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { TabId } from './toolbar-constants.js';

export class CloudImageEditorBlock extends Block {
ctxOwner = true;
static className = 'cloud-image-editor';
static styleAttrs = ['lr-cloud-image-editor'];

constructor() {
super();
Expand Down
6 changes: 3 additions & 3 deletions blocks/CloudImageEditor/src/CropFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export class CropFrame extends Block {
width: '100%',
height: '100%',
fill: 'none',
stroke: '#000000',
stroke: 'currentColor',
'stroke-width': GUIDE_STROKE_WIDTH,
'stroke-opacity': 0.5,
});
Expand All @@ -268,7 +268,7 @@ export class CropFrame extends Block {
y1: `0%`,
x2: `${GUIDE_THIRD * i}%`,
y2: `100%`,
stroke: '#000000',
stroke: 'currentColor',
'stroke-width': GUIDE_STROKE_WIDTH,
'stroke-opacity': 0.3,
});
Expand All @@ -281,7 +281,7 @@ export class CropFrame extends Block {
y1: `${GUIDE_THIRD * i}%`,
x2: `100%`,
y2: `${GUIDE_THIRD * i}%`,
stroke: '#000000',
stroke: 'currentColor',
'stroke-width': GUIDE_STROKE_WIDTH,
'stroke-opacity': 0.3,
});
Expand Down
28 changes: 20 additions & 8 deletions blocks/CloudImageEditor/src/EditorScroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@ export class EditorScroller extends Block {
initCallback() {
super.initCallback();

this.addEventListener('wheel', (e) => {
e.preventDefault();
let { deltaY, deltaX } = e;
if (Math.abs(deltaX) > X_THRESHOLD) {
this.scrollLeft += deltaX;
} else {
this.scrollLeft += deltaY;
}
this.addEventListener(
'wheel',
(e) => {
e.preventDefault();

let { deltaY, deltaX } = e;
if (Math.abs(deltaX) > X_THRESHOLD) {
this.scrollLeft += deltaX;
} else {
this.scrollLeft += deltaY;
}
},
{
passive: false,
},
);

// This fixes some strange bug on MacOS - wheel event doesn't fire for physical mouse wheel if no scroll event attached also
this.addEventListener('scroll', () => {}, {
passive: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😊

});
}
}
Expand Down
8 changes: 4 additions & 4 deletions blocks/CloudImageEditor/src/EditorToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function renderTabToggle(id) {
return /* HTML */ `
<lr-presence-toggle class="tab-toggle" set="visible: presence.tabToggle.${id}; styles: presence.tabToggleStyles;">
<lr-btn-ui
theme="boring"
theme="tab"
ref="tab-toggle-${id}"
data-id="${id}"
icon="${id}"
Expand Down Expand Up @@ -395,20 +395,20 @@ EditorToolbar.template = /* HTML */ `
<lr-presence-toggle class="sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles">
<div class="tab-content-row">${ALL_TABS.map(renderTabContent).join('')}</div>
<div class="controls-row">
<lr-btn-ui theme="boring" icon="closeMax" set="onclick: on.cancel"> </lr-btn-ui>
<lr-btn-ui theme="secondary-icon" icon="closeMax" set="onclick: on.cancel"> </lr-btn-ui>
<lr-presence-toggle class="tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles">
<div ref="tabs-indicator" class="tab-toggles_indicator"></div>
${ALL_TABS.map(renderTabToggle).join('')}
</lr-presence-toggle>
<lr-btn-ui theme="primary" icon="done" set="onclick: on.apply"> </lr-btn-ui>
<lr-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply"> </lr-btn-ui>
</div>
</lr-presence-toggle>
<lr-presence-toggle class="sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles">
<div class="slider">
<lr-editor-slider ref="slider-el"></lr-editor-slider>
</div>
<div class="controls-row">
<lr-btn-ui theme="boring" set="onclick: on.cancelSlider;" l10n="@text:cancel"> </lr-btn-ui>
<lr-btn-ui theme="secondary" set="onclick: on.cancelSlider;" l10n="@text:cancel"> </lr-btn-ui>
<lr-btn-ui theme="primary" set="onclick: on.applySlider;" l10n="@text:apply"> </lr-btn-ui>
</div>
</lr-presence-toggle>
Expand Down
Loading
Loading