Skip to content

Commit

Permalink
refactor: rename all synthetic-theme to merged-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Oct 7, 2020
1 parent 3c87b76 commit 9bc9351
Show file tree
Hide file tree
Showing 162 changed files with 334 additions and 334 deletions.
4 changes: 2 additions & 2 deletions scripts/create-cssr-scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ fs.writeFileSync(path.resolve(cssrPath, 'index.js'), `import themedBaseStyle fro
export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: themedBaseStyle
}
Expand Down
2 changes: 1 addition & 1 deletion src/_deprecated/NimbusServiceLayout/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default {
return h(NLayout, {
class: {
'n-nbs': true,
[`n-${this.syntheticTheme}-theme`]: this.syntheticTheme
[`n-${this.mergedTheme}-theme`]: this.mergedTheme
},
position: 'absolute'
}, {
Expand Down
2 changes: 1 addition & 1 deletion src/_mixins/hollowoutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function isTranslucentColor (color) {

export default {
watch: {
syntheticTheme (value) {
mergedTheme (value) {
if (this.avoidHollowOut) return
cache()
this.$nextTick(() => {
Expand Down
18 changes: 9 additions & 9 deletions src/_mixins/themeable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
}
},
computed: {
syntheticTheme () {
mergedTheme () {
const theme = this.theme
if (theme !== null) {
return theme
Expand All @@ -29,21 +29,21 @@ export default {
return NThemedComponent.theme
}
const NConfigProvider = this.NConfigProvider
return (NConfigProvider && NConfigProvider.syntheticTheme) || null
return (NConfigProvider && NConfigProvider.mergedTheme) || null
},
syntheticStyle () {
const themedStyle = this.themedStyle
const syntheticTheme = this.syntheticTheme
if (themedStyle && syntheticTheme && themedStyle[syntheticTheme]) {
return themedStyle[syntheticTheme]
const mergedTheme = this.mergedTheme
if (themedStyle && mergedTheme && themedStyle[mergedTheme]) {
return themedStyle[mergedTheme]
}
return null
},
syntheticThemeEnvironment () {
mergedThemeEnvironment () {
const NConfigProvider = this.NConfigProvider
const syntheticTheme = this.syntheticTheme
if (syntheticTheme && NConfigProvider && NConfigProvider.inheritedThemeEnvironments) {
return NConfigProvider.inheritedThemeEnvironments[syntheticTheme] || null
const mergedTheme = this.mergedTheme
if (mergedTheme && NConfigProvider && NConfigProvider.inheritedThemeEnvironments) {
return NConfigProvider.inheritedThemeEnvironments[mergedTheme] || null
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/_mixins/usecssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function createMutableStyleId (
dependencyValue
) {
if (
dependencyKey === 'syntheticTheme' ||
dependencyKey === 'mergedTheme' ||
dependencyKey === 'theme'
) {
return componentCssrId + '-' + renderedTheme
Expand Down Expand Up @@ -53,7 +53,7 @@ function setupMutableStyle (
const id = options.cssrId || name
const renderedTheme = theme || fallbackTheme
const dependencyValue = (
dependencyKey === 'syntheticTheme' ||
dependencyKey === 'mergedTheme' ||
dependencyKey === 'theme'
) ? renderedTheme : instance[dependencyKey]
if (
Expand Down Expand Up @@ -152,13 +152,13 @@ export default function (styles, cssrPropsOption) {
style.watch.forEach(watchKey => {
if (!watchers[watchKey]) watchers[watchKey] = []
watchers[watchKey].push(
function (instance, syntheticTheme) {
function (instance, mergedTheme) {
if (process.env.NODE_ENV !== 'production') {
window.naive.styleRenderingDuration -= performance.now()
}
setupMutableStyle(
instance,
syntheticTheme || null,
mergedTheme || null,
style.key,
style.CNode
)
Expand All @@ -177,9 +177,9 @@ export default function (styles, cssrPropsOption) {
watchKey => {
watch[watchKey] = function () {
// TODO use `themeKey`
const syntheticTheme = this.syntheticTheme || this.theme
const mergedTheme = this.mergedTheme || this.theme
watchers[watchKey].forEach(watcher => {
watcher(this, syntheticTheme)
watcher(this, mergedTheme)
})
}
}
Expand All @@ -203,7 +203,7 @@ export default function (styles, cssrPropsOption) {
setupMutableStyle(
this,
// TODO use `themeKey`
this.syntheticTheme || this.theme || null,
this.mergedTheme || this.theme || null,
style.key,
style.CNode
)
Expand Down
2 changes: 1 addition & 1 deletion src/alert/src/Alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:class="{
[`n-alert--${type}-type`]: true,
'n-alert--no-icon': showIcon === false,
[`n-${syntheticTheme}-theme`]: syntheticTheme
[`n-${mergedTheme}-theme`]: mergedTheme
}"
:style="{
...syntheticStyle
Expand Down
6 changes: 3 additions & 3 deletions src/alert/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import themedTypeStyle from './themed-type.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: themedBaseStyle
},
{
key: 'type',
watch: [
'type',
'syntheticTheme'
'mergedTheme'
],
CNode: themedTypeStyle
}
Expand Down
2 changes: 1 addition & 1 deletion src/anchor/src/BaseAnchor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
class="n-anchor"
:class="{
[`n-${syntheticTheme}-theme`]: syntheticTheme
[`n-${mergedTheme}-theme`]: mergedTheme
}"
:style="syntheticStyle"
>
Expand Down
4 changes: 2 additions & 2 deletions src/anchor/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import themedBaseStyle from './themed-base.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: themedBaseStyle
}
Expand Down
6 changes: 3 additions & 3 deletions src/auto-complete/src/AutoComplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
:handleFocus="handleFocus"
:handleBlur="handleBlur"
:value="value"
:theme="syntheticTheme"
:theme="mergedTheme"
>
<n-input
:theme="syntheticTheme"
:theme="mergedTheme"
:value="value"
:placeholder="placeholder"
:size="mergedSize"
Expand Down Expand Up @@ -55,7 +55,7 @@
v-clickoutside="handleClickOutsideMenu"
auto-pending-first-option
class="n-auto-complete-menu"
:theme="syntheticTheme"
:theme="mergedTheme"
:pattern="value"
:options="selectOptions"
:multiple="false"
Expand Down
4 changes: 2 additions & 2 deletions src/auto-complete/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import themedBaseStyle from './themed-base.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: themedBaseStyle
}
Expand Down
2 changes: 1 addition & 1 deletion src/avatar/src/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
:class="{
[`n-avatar--${size}-size`]: typeof size !== 'number',
[`n-avatar--circle-shaped`]: circle || round,
[`n-${syntheticTheme}-theme`]: syntheticTheme
[`n-${mergedTheme}-theme`]: mergedTheme
}"
:style="{
width: styleWidth,
Expand Down
6 changes: 3 additions & 3 deletions src/avatar/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import themedSizeStyle from './themed-size.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: themedBaseStyle
},
{
key: 'cssrSize',
watch: [
'syntheticTheme',
'mergedTheme',
'cssrSize'
],
CNode: themedSizeStyle
Expand Down
2 changes: 1 addition & 1 deletion src/back-top/src/BackTop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div
v-if="mergedShow"
:class="{
[`n-${syntheticTheme}-theme`]: syntheticTheme,
[`n-${mergedTheme}-theme`]: mergedTheme,
'n-back-top--transition-disabled': transitionDisabled
}"
:style="{
Expand Down
4 changes: 2 additions & 2 deletions src/back-top/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import themedBaseStyle from './themed-base.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: themedBaseStyle
}
Expand Down
2 changes: 1 addition & 1 deletion src/badge/src/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'n-badge--dot': dot,
[`n-badge--${type}-type`]: true,
[`n-badge--${color || type}-colored`]: true,
[`n-${syntheticTheme}-theme`]: syntheticTheme,
[`n-${mergedTheme}-theme`]: mergedTheme,
[`n-badge--as-is`]: !$slots.default
}"
>
Expand Down
6 changes: 3 additions & 3 deletions src/badge/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import colorStyle from './themed-color.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
CNode: baseStyle,
watch: [
'syntheticTheme'
'mergedTheme'
]
},
{
key: 'type',
CNode: colorStyle,
watch: [
'type',
'syntheticTheme'
'mergedTheme'
]
}
]
2 changes: 1 addition & 1 deletion src/breadcrumb/src/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
class="n-breadcrumb"
:class="{
[`n-${syntheticTheme}-theme`]: syntheticTheme
[`n-${mergedTheme}-theme`]: mergedTheme
}"
>
<slot />
Expand Down
4 changes: 2 additions & 2 deletions src/breadcrumb/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import baseStyle from './themed-base.cssr.js'

export default [
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: baseStyle
}
Expand Down
4 changes: 2 additions & 2 deletions src/button/src/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[`n-button--${type}-type`]: true,
[`n-button--${colorDigest || type}-colored`]: true,
[`n-button--${mergedSize}-size`]: true,
[`n-${syntheticTheme}-theme`]: syntheticTheme,
[`n-${mergedTheme}-theme`]: mergedTheme,
}"
:tabindex="mergedFocusable ? 0 : -1"
:type="attrType"
Expand All @@ -41,7 +41,7 @@
v-if="loading"
key="loading"
class="n-icon-slot"
:theme="syntheticTheme"
:theme="mergedTheme"
:stroke-width="24"
/>
<n-icon
Expand Down
8 changes: 4 additions & 4 deletions src/button/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ export default [
key: 'type',
watch: [
'type',
'syntheticTheme'
'mergedTheme'
],
CNode: colorStyle
},
{
key: 'mergedSize',
watch: [
'mergedSize',
'syntheticTheme'
'mergedTheme'
],
CNode: sizeStyle
},
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: baseStyle
}
Expand Down
2 changes: 1 addition & 1 deletion src/card/src/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[`n-card--action-segmented`]: segmented === true || (segmented && segmented.action),
[`n-card--${size}-size`]: true,
'n-card--bordered': bordered,
[`n-${syntheticTheme}-theme`]: syntheticTheme
[`n-${mergedTheme}-theme`]: mergedTheme
}"
:style="syntheticStyle"
>
Expand Down
6 changes: 3 additions & 3 deletions src/card/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export default [
key: 'size',
watch: [
'size',
'syntheticTheme'
'mergedTheme'
],
CNode: sizeStyle
},
{
key: 'syntheticTheme',
key: 'mergedTheme',
watch: [
'syntheticTheme'
'mergedTheme'
],
CNode: baseStyle
}
Expand Down
Loading

0 comments on commit 9bc9351

Please sign in to comment.