#Ext JS Modern Toolkit Theming Guidelines
## Dynamic Variables
All variables should be defined using the `dynamic()` function. This ensures
that the last variable declaration wins, and is valid throughout the entire
scope, allowing variables to derive from one another without concern for
ordering.
## File Naming
All Component variable and UI mixin declarations (all non-rule-generating
code) should be placed in the theme's `sass/var/` directory in a file matching
the Component's class path. Since all var files are included in the build
regardless of whether or not the corresponding class is actually required
by the app, this allows variables to freely derive from any other variable.
Including mixins in the `sass/var/` directory ensures that a derived theme can
override those mixins before they are called by any code in the `sass/src/`
directory.
All rule-generating code, including calls to UI mixins, and rules not contained
inside the body of a mixin should be placed in the theme's `sass/src/`
directory in a file matching the Component's class path. At build time,
src files are only included if the corresponding Component is required by
the app, thus ensuring that only the rules that the app actually needs are
included in the CSS output.
## Base Styles vs. Configurable Styles
Layout-specific styles, and styles related to core functionality of a
Component should always be placed in `theme-base/sass/src/` in a file
matching the Component's class path. The properties set in these rules
should NOT be configurable using variables, as changing them would likely
break the functionality or layout of the Component. Some examples of
CSS properties that should generally not be configurable are:
- `display`
- `visibility`
- `position`
- `overflow`
- `z-index`
Configurable styles not related to the core functionality or layout
of a component should always be controlled using variables. These
variables should be defined in a scss file matching the component's class
path in the `theme-neptune/sass/var` directory, and the rules that use
these variables should be contained in a UI mixin in the same file.
Examples of commonly configurable styles are:
- `background-color`
- `color`
- `padding`
- `border-radius`
- `font-size`
The neptune theme is the base for all other themes and should contain
the universe of possible theming capabilities supported by the framework
although it may not utilize them all itself. Themes derived from `theme-neptune`
should avoid defining new UI mixins and creating their own CSS rules, but
should instead simply set the values of variables defined in `theme-neptune`.
When a new feature is needed by a derived theme it should be added to
`theme-neptune` with variables to tune its behavior rather than adding
the new feature only to the derived theme.
##Variable Naming Conventions
Component variables should always begin with an xtype, and end with the CSS
property name being styled, for example:
$button-font-family: dynamic(helvetica);
$button-color: dynamic(#fff);
$button-background-color: dynamic(red);
If the component has various states such as hovered, focused, and pressed,
the name of the state should come immediately after the xtype, but before
the CSS property name:
$button-hovered-background-color: dynamic(blue);
If the component has variables that control the styling of sub-elements,
the name of the sub-element being styled should be included after the xtype,
and state if present. For example, when styling the button's "badge" element:
$button-badge-color: dynamic(#fff);
$button-hovered-badge-color: dynamic(green);
If however, the "state" refers to a sub-element's state, it should come after
that element's name. For example, if a tab has a close icon that has a
separate hover state from the tab:
$tab-close-icon-hovered-background-color: dynamic(red);
Components should have separate variables for border-width, border-color,
and border-style, and all three properties should accept either a single
value or a list of values so that 4 sides can be specified separately if
needed:
// BAD
$button-border: dynamic(1px solid green);
// GOOD
$button-border-color: dynamic(red yellow green blue);
$button-border-width: dynamic(1px 3px);
$button-border-style: dynamic(solid);
Variables should use the following names to indicate component state:
- "pressed" when the component is being pressed by the user or is in a pressed state
- "pressing" if the component has a "pressing" state that is separate from "pressed"
- "hovered" when the mouse pointer is over the element
- "focused" when the element has focus
- "disabled" when the component is disabled.
Since "focused" can sometimes be combined with other states components may
need to provide variables that indicate a combination of states,
for exmaple `$button-focused-pressed-border-color`
## Normal and Big Modes
Each theme has 2 modes of sizing - normal and big. Big mode increases
spacing and sizing to be more touch-screen friendly. Themes select whether
or not to use big mode by inspecting `Ext.platformTags` in the theme's
`overrides/init.js` and adding a CSS class name of `x-big` to the `<html>`
element on the page. For example, the triton theme only enables big mode
when loaded on a phone and uses normal mode otherwise:
Ext.theme.getDocCls = function() {
return Ext.platformTags.phone ? 'x-big' : '';
};
All variables that set properties affecting visual size of a component,
like `font-size`, `line-height`, and `padding` should have big counterparts.
Big variables always have the `-big` suffix appended to the end:
$button-padding: dynamic(1rem);
$button-padding-big: dynamic(1.2rem);
SASS rules target big mode using the `.x-big` selector:
.#{$prefix}button {
padding: $padding;
.#{$prefix}big & {
padding: $padding-big;
}
}
##Component UIs
Every component should have a UI mixin for generating multiple visual
renditions of that component. The mixin should be named `[xtype]-ui`.
For example `button-ui` or `panel-ui`.
UI mixins should have a parameter for each of the component's global variables,
and the parameter names should be the same as the global variable names with
the exception that the mixin parameters should not contain the xtype in their names.
For example, a global variable named `$button-border-radius`, would correspond
to a parameter of the `button-ui` mixin named `$border-radius`.
The parameters to the UI mixin should all default to null, and should not
produce any output if unspecified by the caller. This means that when the
mixin is invoked it should produce a set of styling that represents a delta
from the default UI. This minimizes the number of css rules required to
create new UIs since the mixin automatically eliminates any null values
from the output.
The styling for the default UI should be applied using CSS class names that
do not contain a UI name, for example `x-button`, not `x-button-default`.
This is the key to minimizing the number of rules required to create additional
UIs, since all buttons will have the `x-button` class in addition to one
or more optional `x-button-[ui]` classes. It allows the default UI to
serve as a base set of styles for all other UIs.
A typical UI mixin should look something like this:
@mixin button-ui(
$ui: null
// $xtype is the only variable that does not default to null
// since it is only used in selector names and does not affect
// the output unless other non-null values are passed. It is
// typically only passed by mixins of subclasses (see section on
// "Derived UIs" below)
$xtype: button,
$background-color: null,
$border-radius: null
) {
// returns '' if $ui is null, otherwise prefixes $ui with "-"
// To generate default UI we will not pass the $ui parameter
没有合适的资源?快使用搜索试试~ 我知道了~
ext-7.7.0无水印版
共2000个文件
js:1293个
md:550个
json:62个
需积分: 5 22 下载量 11 浏览量
2023-08-04
13:40:19
上传
评论
收藏 246.26MB ZIP 举报
温馨提示
ext-7.7.0无水印版
资源推荐
资源详情
资源评论
收起资源包目录
ext-7.7.0无水印版 (2000个子文件)
nested-loading.css 200KB
pictos_base64.css 28KB
style.css 25KB
loader.css 6KB
main.css 5KB
prettify.css 2KB
demo.css 2KB
demo.css 2KB
basic.css 2KB
style.css 1KB
loader_ie.css 1KB
dnd_with_dom.css 1KB
prettify-dark.css 1KB
pictos.css 873B
bootstrap.css 284B
restful.css 213B
ajax1.htm 395B
ajax2.htm 395B
demo.html 340KB
terms-of-use.html 23KB
demo.html 8KB
basic.html 6KB
index.html 4KB
meta-config-basic.html 3KB
dnd_with_dom.html 3KB
locking-treegrid.html 2KB
index.html 2KB
index.html 2KB
associations.html 2KB
dragdropzones.html 1KB
restful.html 1KB
custom-drop-logic.html 1KB
cell-to-cell-dd.html 1KB
filtered-buffer-rendered-treegrid.html 1KB
locking-buffer-rendered-treegrid.html 1KB
buffer-rendered-treegrid.html 1KB
fashion.html 1KB
fashion.html 1KB
fashion.html 1KB
fashion.html 1KB
gmap.html 1KB
theme.html 919B
theme.html 919B
theme.html 919B
theme.html 919B
theme.html 876B
index.html 869B
nested-loading.html 839B
index.html 588B
simple.html 587B
index.html 469B
Posts.js 461KB
VectorIconsMixin.js 235KB
feed.js 234KB
jasmine.js 118KB
jasmine.js 109KB
bootstrap.js 102KB
FileTree.js 99KB
Order.js 96KB
prettify.js 67KB
USD2EUR.js 56KB
Navigation.js 52KB
Boot.js 51KB
Company.js 50KB
Navigation.js 43KB
Microloader.js 39KB
CustomNeedleGauge.js 24KB
CustomNeedleGauge.js 23KB
Unemployment.js 20KB
Main.js 19KB
json2.js 17KB
json2.js 17KB
UnemploymentController.js 16KB
render.js 15KB
render.js 15KB
render.js 15KB
render.js 14KB
render.js 14KB
HorizontalCreateAccount.js 14KB
Checkout.js 14KB
SplitButton.js 14KB
Remote.js 14KB
HeatMap.js 13KB
HeatMap.js 13KB
Global.js 13KB
HorizontalCreateAccount.js 13KB
Exporter.js 13KB
Main.js 11KB
Exporter.js 11KB
Toolbar.js 11KB
dragdropzones.js 11KB
Dashboard.js 11KB
Grid.js 11KB
SplitButtonBottom.js 10KB
Protractor.js 10KB
Protractor.js 10KB
Component.js 10KB
BigData.js 10KB
Extra.js 9KB
CheckboxGroupForm.js 9KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
sword_happy
- 粉丝: 17
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功