-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
194 additions
and
95 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
Empty file.
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
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 @@ | ||
$primary-color := red |
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
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,28 @@ | ||
import Intact from 'intact'; | ||
import template from './index.vdt'; | ||
|
||
export default class StylusEditor extends Intact { | ||
@Intact.template() | ||
static template = template; | ||
|
||
defaults() { | ||
return { | ||
collapseValue: ['$0', '$1'], | ||
variables: [{}], | ||
code: '', | ||
availableVariables: [], | ||
} | ||
} | ||
|
||
_addVariable(index) { | ||
const variables = this.get('variables').slice(0); | ||
variables.splice(index + 1, 0, {}); | ||
this.set({variables}); | ||
} | ||
|
||
_removeVariable(index) { | ||
const variables = this.get('variables').slice(0); | ||
variables.splice(index, 1); | ||
this.set({variables}); | ||
} | ||
} |
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,55 @@ | ||
import {Collapse, CollapseItem} from 'kpc/components/collapse'; | ||
import {Input} from 'kpc/components/input'; | ||
import {Form, FormItem} from 'kpc/components/form'; | ||
import {Select, Option} from 'kpc/components/select'; | ||
import Button from 'kpc/components/button'; | ||
import Icon from 'kpc/components/icon'; | ||
import Code from 'kpc/components/code'; | ||
|
||
<Collapse v-model="collapseValue" noBorder> | ||
<CollapseItem title="Stylus 变量" class="variables-panel"> | ||
<Form labelWidth="200"> | ||
<FormItem fluid v-for={{ self.get('variables') }}> | ||
<b:label> | ||
<Select filterable fluid size="small" | ||
v-model={{ `variables.${key}.name` }} | ||
allowUnmatch | ||
> | ||
<Option | ||
v-for={{ | ||
_.omit( | ||
self.get('availableVariables'), | ||
_.map(self.get('variables'), item => item.name) | ||
) | ||
}} | ||
value={{ key }} | ||
> | ||
{{ key }} | ||
</Option> | ||
</Select> | ||
</b:label> | ||
<Input placeholder={{ self.get('availableVariables')[value.name] }} | ||
fluid size="small" | ||
v-model={{ `variables.${key}.value` }} | ||
/> | ||
<b:append> | ||
<Button icon circle size="mini" | ||
ev-click={{ self._addVariable.bind(self, key) }} | ||
> | ||
<Icon class="ion-ios-plus-empty" /> | ||
</Button> | ||
<Button icon circle size="mini" | ||
ev-click={{ self._removeVariable.bind(self, key) }} | ||
disabled={{ self.get('variables').length === 1 }} | ||
> | ||
<Icon class="ion-ios-minus-empty" /> | ||
</Button> | ||
</b:append> | ||
</FormItem> | ||
</Form> | ||
</CollapseItem> | ||
<CollapseItem title="附加样式" class="code-panel"> | ||
<Code v-model="code" height="300px" language="css" /> | ||
</CollapseItem> | ||
</Collapse> | ||
|
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
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
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
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
Empty file.
Oops, something went wrong.