-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixed ClassAdder components to allow SSR
Fixes #29.
- Loading branch information
Showing
32 changed files
with
207 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function ActionButtons(...args) { | ||
internals.class = 'mdc-card__action-buttons'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
ActionButtons.prototype = ClassAdder; | ||
|
||
export default ActionButtons; | ||
export default classAdderBuilder({ | ||
class: 'mdc-card__action-buttons', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function ActionIcons(...args) { | ||
internals.class = 'mdc-card__action-icons'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
ActionIcons.prototype = ClassAdder; | ||
|
||
export default ActionIcons; | ||
export default classAdderBuilder({ | ||
class: 'mdc-card__action-icons', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function Content(...args) { | ||
internals.class = 'smui-card__content'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Content.prototype = ClassAdder; | ||
|
||
export default Content; | ||
export default classAdderBuilder({ | ||
class: 'smui-card__content', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function MediaContent(...args) { | ||
internals.class = 'mdc-card__media-content'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
MediaContent.prototype = ClassAdder; | ||
|
||
export default MediaContent; | ||
export default classAdderBuilder({ | ||
class: 'mdc-card__media-content', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import ClassAdder, {internals} from './ClassAdder.svelte'; | ||
|
||
export function classAdderBuilder(props) { | ||
function Component(...args) { | ||
Object.assign(internals, props); | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Component.prototype = ClassAdder; | ||
|
||
// SSR support | ||
if (ClassAdder.$$render) { | ||
Component.$$render = (...args) => Object.assign(internals, props) && ClassAdder.$$render(...args); | ||
} | ||
if (ClassAdder.render) { | ||
Component.render = (...args) => Object.assign(internals, props) && ClassAdder.render(...args); | ||
} | ||
|
||
return Component; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Footer from '@smui/common/Footer.svelte'; | ||
|
||
function Actions(...args) { | ||
internals.class = 'mdc-dialog__actions'; | ||
internals.component = Footer; | ||
internals.contexts = { | ||
export default classAdderBuilder({ | ||
class: 'mdc-dialog__actions', | ||
component: Footer, | ||
contexts: { | ||
'SMUI:button:context': 'dialog:action' | ||
}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Actions.prototype = ClassAdder; | ||
|
||
export default Actions; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function Content(...args) { | ||
internals.class = 'mdc-dialog__content'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Content.prototype = ClassAdder; | ||
|
||
export default Content; | ||
export default classAdderBuilder({ | ||
class: 'mdc-dialog__content', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import H2 from '@smui/common/H2.svelte'; | ||
|
||
function Title(...args) { | ||
internals.class = 'mdc-dialog__title'; | ||
internals.component = H2; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Title.prototype = ClassAdder; | ||
|
||
export default Title; | ||
export default classAdderBuilder({ | ||
class: 'mdc-dialog__title', | ||
component: H2, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function AppContent(...args) { | ||
internals.class = 'mdc-drawer-app-content'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
AppContent.prototype = ClassAdder; | ||
|
||
export default AppContent; | ||
export default classAdderBuilder({ | ||
class: 'mdc-drawer-app-content', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function Content(...args) { | ||
internals.class = 'mdc-drawer__content'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Content.prototype = ClassAdder; | ||
|
||
export default Content; | ||
export default classAdderBuilder({ | ||
class: 'mdc-drawer__content', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function Header(...args) { | ||
internals.class = 'mdc-drawer__header'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Header.prototype = ClassAdder; | ||
|
||
export default Header; | ||
export default classAdderBuilder({ | ||
class: 'mdc-drawer__header', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function Scrim(...args) { | ||
internals.class = 'mdc-drawer-scrim'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Scrim.prototype = ClassAdder; | ||
|
||
export default Scrim; | ||
export default classAdderBuilder({ | ||
class: 'mdc-drawer-scrim', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import H2 from '@smui/common/H2.svelte'; | ||
|
||
function Subtitle(...args) { | ||
internals.class = 'mdc-drawer__subtitle'; | ||
internals.component = H2; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Subtitle.prototype = ClassAdder; | ||
|
||
export default Subtitle; | ||
export default classAdderBuilder({ | ||
class: 'mdc-drawer__subtitle', | ||
component: H2, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import H1 from '@smui/common/H1.svelte'; | ||
|
||
function Title(...args) { | ||
internals.class = 'mdc-drawer__title'; | ||
internals.component = H1; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Title.prototype = ClassAdder; | ||
|
||
export default Title; | ||
export default classAdderBuilder({ | ||
class: 'mdc-drawer__title', | ||
component: H1, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Img from '@smui/common/Img.svelte'; | ||
|
||
function Image(...args) { | ||
internals.class = 'mdc-image-list__image'; | ||
internals.component = Img; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Image.prototype = ClassAdder; | ||
|
||
export default Image; | ||
export default classAdderBuilder({ | ||
class: 'mdc-image-list__image', | ||
component: Img, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function ImageAspectContainer(...args) { | ||
internals.class = 'mdc-image-list__image-aspect-container'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
ImageAspectContainer.prototype = ClassAdder; | ||
|
||
export default ImageAspectContainer; | ||
export default classAdderBuilder({ | ||
class: 'mdc-image-list__image-aspect-container', | ||
component: Div, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Li from '@smui/common/Li.svelte'; | ||
|
||
function Item(...args) { | ||
internals.class = 'mdc-image-list__item'; | ||
internals.component = Li; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Item.prototype = ClassAdder; | ||
|
||
export default Item; | ||
export default classAdderBuilder({ | ||
class: 'mdc-image-list__item', | ||
component: Li, | ||
contexts: {} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import ClassAdder, {internals} from '@smui/common/ClassAdder.svelte'; | ||
import {classAdderBuilder} from '@smui/common/classAdderBuilder.js'; | ||
import Div from '@smui/common/Div.svelte'; | ||
|
||
function Supporting(...args) { | ||
internals.class = 'mdc-image-list__supporting'; | ||
internals.component = Div; | ||
internals.contexts = {}; | ||
return new ClassAdder(...args); | ||
} | ||
|
||
Supporting.prototype = ClassAdder; | ||
|
||
export default Supporting; | ||
export default classAdderBuilder({ | ||
class: 'mdc-image-list__supporting', | ||
component: Div, | ||
contexts: {} | ||
}); |
Oops, something went wrong.