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

[full-ci] Dedupe CSS #8041

Merged
merged 5 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ export default {
}

&-title {
@extend .oc-mb-rm;

margin-bottom: 0;
display: block;
font-size: var(--oc-font-size-large);

Expand Down
29 changes: 11 additions & 18 deletions packages/design-system/src/components/OcBreadcrumb/OcBreadcrumb.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<nav :class="`oc-breadcrumb oc-breadcrumb-${variation}`">
<ol class="oc-breadcrumb-list oc-flex">
<ol class="oc-breadcrumb-list oc-flex oc-m-rm oc-p-rm">
<li
v-for="(item, index) in items"
:key="index"
Expand Down Expand Up @@ -52,12 +52,12 @@
<label
ref="mobileDropdown"
tabindex="0"
class="oc-breadcrumb-drop-label"
class="oc-breadcrumb-drop-label oc-flex oc-flex-middle oc-flex-between"
@keydown.enter="$refs.mobileDropdown.click()"
>
<span
v-if="currentFolder"
class="oc-breadcrumb-drop-label-text"
class="oc-breadcrumb-drop-label-text oc-text-truncate"
aria-current="page"
v-text="currentFolder.text"
/>
Expand Down Expand Up @@ -177,9 +177,9 @@ export default {
overflow: hidden;

&-list {
@extend .oc-visible\@s;
@extend .oc-m-rm;
@extend .oc-p-rm;
@media (max-width: $oc-breakpoint-xsmall-max) {
display: none !important;
}

list-style: none;
align-items: baseline;
Expand Down Expand Up @@ -234,12 +234,13 @@ export default {
/* stylelint-enable */

&-drop {
@extend .oc-hidden\@s;
@media (min-width: $oc-breakpoint-small-default) {
display: none !important;
}

.oc-drop > .oc-card > ol {
@extend .oc-m-rm;
@extend .oc-p-rm;

margin: 0;
padding: 0;
list-style: none;

> li a,
Expand All @@ -261,18 +262,10 @@ export default {
}

&-label {
@extend .oc-flex;
@extend .oc-flex-middle;
@extend .oc-flex-between;

border: $global-border-width solid var(--oc-color-swatch-primary-muted);
cursor: pointer;
height: $global-control-height;
padding: var(--oc-space-small);

&-text {
@extend .oc-text-truncate;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`OcBreadcrumb displays all items 1`] = `
<nav class="oc-breadcrumb oc-breadcrumb-default">
<ol class="oc-breadcrumb-list oc-flex">
<ol class="oc-breadcrumb-list oc-flex oc-m-rm oc-p-rm">
<li class="oc-breadcrumb-list-item oc-flex oc-flex-middle">
<router-link-stub tag="a" to="[object Object]"><span>First folder</span></router-link-stub>
<oc-icon-stub name="arrow-right-s" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)" class="oc-mx-xs"></oc-icon-stub>
Expand All @@ -23,7 +23,7 @@ exports[`OcBreadcrumb displays all items 1`] = `
<!---->
</li>
</ol>
<div class="oc-breadcrumb-drop"><label tabindex="0" class="oc-breadcrumb-drop-label"><span aria-current="page" class="oc-breadcrumb-drop-label-text">Deeper ellipsize in responsive mode</span>
<div class="oc-breadcrumb-drop"><label tabindex="0" class="oc-breadcrumb-drop-label oc-flex oc-flex-middle oc-flex-between"><span aria-current="page" class="oc-breadcrumb-drop-label-text oc-text-truncate">Deeper ellipsize in responsive mode</span>
<oc-icon-stub name="arrow-down-s" filltype="fill" accessiblelabel="Expand more" type="span" size="medium" variation="passive" color="" class="oc-breadcrumb-drop-label-icon"></oc-icon-stub>
</label>
<oc-drop-stub dropid="oc-drop-2" toggle="" position="bottom-start" mode="click" paddingsize="medium">
Expand Down Expand Up @@ -51,7 +51,7 @@ exports[`OcBreadcrumb displays all items 1`] = `

exports[`OcBreadcrumb sets correct variation 1`] = `
<nav class="oc-breadcrumb oc-breadcrumb-lead">
<ol class="oc-breadcrumb-list oc-flex">
<ol class="oc-breadcrumb-list oc-flex oc-m-rm oc-p-rm">
<li class="oc-breadcrumb-list-item oc-flex oc-flex-middle">
<router-link-stub tag="a" to="[object Object]"><span>First folder</span></router-link-stub>
<oc-icon-stub name="arrow-right-s" filltype="line" accessiblelabel="" type="span" size="medium" variation="passive" color="var(--oc-color-text-default)" class="oc-mx-xs"></oc-icon-stub>
Expand All @@ -72,7 +72,7 @@ exports[`OcBreadcrumb sets correct variation 1`] = `
<!---->
</li>
</ol>
<div class="oc-breadcrumb-drop"><label tabindex="0" class="oc-breadcrumb-drop-label"><span aria-current="page" class="oc-breadcrumb-drop-label-text">Deeper ellipsize in responsive mode</span>
<div class="oc-breadcrumb-drop"><label tabindex="0" class="oc-breadcrumb-drop-label oc-flex oc-flex-middle oc-flex-between"><span aria-current="page" class="oc-breadcrumb-drop-label-text oc-text-truncate">Deeper ellipsize in responsive mode</span>
<oc-icon-stub name="arrow-down-s" filltype="fill" accessiblelabel="Expand more" type="span" size="medium" variation="passive" color="" class="oc-breadcrumb-drop-label-icon"></oc-icon-stub>
</label>
<oc-drop-stub dropid="oc-drop-1" toggle="" position="bottom-start" mode="click" paddingsize="medium">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ export default {
var(--oc-color-swatch-primary-muted)
);
&-filled {
@extend .oc-background-primary-gradient;
@include oc-background-primary-gradient;
color: var(--oc-color-swatch-inverse-default) !important;

span > svg {
Expand Down
8 changes: 3 additions & 5 deletions packages/design-system/src/components/OcLoader/OcLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ export default {
@import '../../styles/styles';

.oc-loader {
@extend .oc-position-relative;

-webkit-appearance: none;
-moz-appearance: none;
background-color: #f8f8f8;
Expand All @@ -47,20 +45,20 @@ export default {
overflow: hidden;
vertical-align: baseline;
width: 100%;
position: relative;

&-flat {
border-radius: 0 !important;
height: 5px !important;
}

&::after {
@extend .oc-position-absolute;
@extend .oc-display-block;

background: var(--oc-color-text-muted);
content: '';
height: 100%;
width: 0;
display: block;
position: absolute;

animation: {
duration: 1.4s;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="oc-progress-pie" :data-fill="_fill">
<div class="oc-progress-pie-container" />
<label v-if="showLabel" class="oc-progress-pie-label" v-text="_label" />
<label v-if="showLabel" class="oc-progress-pie-label oc-text-muted" v-text="_label" />
</div>
</template>
<script>
Expand Down Expand Up @@ -104,8 +104,6 @@ $default-size: 64px;
}

&-label {
@extend .oc-text-muted;

color: var(--oc-color-text-muted) !important;
left: 50%;
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<oc-grid
flex
:role="isFilter ? undefined : 'search'"
class="oc-search"
class="oc-search oc-flex-middle"
:class="{ 'oc-search-small': small }"
>
<div class="oc-width-expand oc-position-relative">
Expand Down Expand Up @@ -227,7 +227,7 @@ export default {
return 'medium'
},
inputClass() {
const classes = ['oc-search-input']
const classes = ['oc-search-input', 'oc-input']

this.icon && classes.push('oc-search-input-icon')
!this.buttonHidden && classes.push('oc-search-input-button')
Expand Down Expand Up @@ -287,8 +287,6 @@ export default {
@import '../../styles/styles';

.oc-search {
@extend .oc-flex-middle;

min-width: $form-width-medium;

&-button {
Expand All @@ -313,8 +311,6 @@ export default {
}

&-input {
@extend .oc-input;

border-radius: 25px;
border: 1px solid var(--oc-color-input-border);
color: var(--oc-color-input-text-muted);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
v-bind="additionalAttributes"
ref="input"
:aria-invalid="ariaInvalid"
class="oc-text-input oc-rounded"
class="oc-text-input oc-input oc-rounded"
:class="{
'oc-text-input-warning': !!warningMessage,
'oc-text-input-danger': !!errorMessage
Expand Down Expand Up @@ -276,8 +276,6 @@ export default {
@import '../../styles/styles';

.oc-text-input {
@extend .oc-input;

background-color: var(--oc-color-input-bg);
border: 1px solid var(--oc-color-input-border);
color: var(--oc-color-input-text-muted);
Expand Down Expand Up @@ -309,10 +307,9 @@ export default {
}

&-message {
@extend .oc-flex;
@extend .oc-flex-middle;
@extend .oc-mt-xs;

display: flex;
align-items: center;
margin-top: var(--oc-space-xsmall);
min-height: $oc-font-size-default * 1.5;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ export default {
}

&-message {
@extend .oc-flex;
@extend .oc-flex-middle;
@extend .oc-mt-xs;
display: flex;
align-items: center;
margin-top: var(--oc-space-xsmall);

min-height: $oc-font-size-default * 1.5;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/design-system/src/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@
@import "theme/oc-visibility";
@import "theme/oc-width";
@import "theme/tooltip";

dschmidt marked this conversation as resolved.
Show resolved Hide resolved
/* STYLES STRIP IMPORTS MARKER */
13 changes: 9 additions & 4 deletions packages/design-system/src/styles/theme/background.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@mixin oc-background-primary-gradient {
background:
linear-gradient(90deg,
var(--oc-color-swatch-primary-muted) 0%,
var(--oc-color-swatch-primary-gradient) 100%);
}

.oc-background-selected {
background-color: var(--oc-color-background-highlight) !important;
}
Expand All @@ -8,11 +15,9 @@

/* stylelint-disable */
.oc-background-primary-gradient {
background:
linear-gradient(90deg,
var(--oc-color-swatch-primary-muted) 0%,
var(--oc-color-swatch-primary-gradient) 100%);
@include oc-background-primary-gradient;
}

/* stylelint-enable */

.oc-background-secondary {
Expand Down
8 changes: 4 additions & 4 deletions packages/design-system/src/styles/theme/oc-text.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ td.oc-text-truncate {
* Wrap long words onto the next line and break them if they are too long to fit
*/
.oc-text-break {
overflow-wrap: break-word;
white-space: unset;
word-wrap: break-word;
overflow-wrap: break-word !important;
white-space: unset !important;
word-wrap: break-word !important;
}

th.oc-text-break,
td.oc-text-break {
word-break: break-all;
word-break: break-all !important;
}

/* ----------------------- */
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/styles/theme/oc-width.scss
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ $width-2xlarge-width: 750px !default;
.oc-width-2xlarge { width: $width-2xlarge-width; }

/* Auto */
.oc-width-auto { width: auto; }
.oc-width-auto { width: auto !important; }

/* Expand */
.oc-width-expand {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<textarea
id="description-input-area"
v-model="readmeContent"
class="oc-width-1-1 oc-height-1-1 oc-text-input"
class="oc-width-1-1 oc-height-1-1 oc-input oc-text-input"
rows="30"
></textarea>
</template>
Expand Down
2 changes: 2 additions & 0 deletions packages/web-runtime/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
</div>
</template>
<script lang="ts">
import '../../design-system/src/styles/styles.scss'

import { mapGetters, mapState, mapActions } from 'vuex'
import SkipTo from './components/SkipTo.vue'
import LayoutApplication from './layouts/Application.vue'
Expand Down
12 changes: 12 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ const __filename = fileURLToPath(import.meta.url)
const projectRootDir = dirname(__filename)

const plugins = [
{
transform(src, id) {
if (id.includes('rollup-plugin-vue=styles')) {
const split = src.split('/* STYLES STRIP IMPORTS MARKER */')
kulmann marked this conversation as resolved.
Show resolved Hide resolved
const newSrc = split[split.length-1]
return {
code: newSrc,
map: null
}
}
}
},
postcss({
extract: path.join('css', 'web.css'),
minimize: production,
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/pageObjects/personalPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ module.exports = {
selector: '#files-breadcrumb li:nth-of-type(2)'
},
breadcrumbMobile: {
selector: '//span[@class="oc-breadcrumb-drop-label-text" and text()=%s]',
selector: '//span[contains(@class, "oc-breadcrumb-drop-label-text") and text()=%s]',
locateStrategy: 'xpath'
},
breadcrumbMobileReferencedToOpenSidebarButton: {
selector:
'//button[@aria-label="Open sidebar to view details"]/ancestor::div//span[@class="oc-breadcrumb-drop-label-text" and text()=%s]',
'//button[@aria-label="Open sidebar to view details"]/ancestor::div//span[contains(@class, "oc-breadcrumb-drop-label-text") and text()=%s]',
locateStrategy: 'xpath'
},
resourceBreadcrumb: {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
'^.+\\.vue$': '@vue/vue2-jest'
},
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/tests/unit/stubs/empty.js',
'\\.(css|less|scss)$': '<rootDir>/tests/unit/stubs/empty.js',
'^@/(.*)$': '<rootDir>/$1',
'core-js': '<rootDir>/node_modules/core-js',

Expand Down