|
|
@@ -306,7 +306,7 @@ export default class StylesMap {
|
|
|
/**
|
|
|
* Returns style properties names as the would appear when using {@link #toString}
|
|
|
*
|
|
|
- * @returns {module:engine/view/stylesmap~PropertyEntry}
|
|
|
+ * @returns {Array.<String>}
|
|
|
*/
|
|
|
getStyleNames() {
|
|
|
if ( this.isEmpty ) {
|
|
|
@@ -329,7 +329,7 @@ export default class StylesMap {
|
|
|
* Returns normalized styles entries for further processing.
|
|
|
*
|
|
|
* @private
|
|
|
- * @returns {module:engine/view/stylesmap~PropertyEntry}
|
|
|
+ * @returns {Array.<String, String>}
|
|
|
*/
|
|
|
_getStylesEntries() {
|
|
|
const parsed = [];
|
|
|
@@ -493,6 +493,7 @@ export class StylesProcessor {
|
|
|
* @param {String} name
|
|
|
* @param {String} name Name of style property.
|
|
|
* @param {Object} styles Object holding normalized styles.
|
|
|
+ * @returns {Array.<Array.<String, String>>}
|
|
|
*/
|
|
|
getReducedForm( name, styles ) {
|
|
|
const normalizedValue = this.getNormalized( name, styles );
|
|
|
@@ -743,75 +744,3 @@ function appendStyleValue( stylesObject, nameOrPath, valueOrObject ) {
|
|
|
|
|
|
set( stylesObject, nameOrPath, valueToSet );
|
|
|
}
|
|
|
-
|
|
|
-/**
|
|
|
- * An style reducer takes normalized object of style property and outputs array of normalized property-value pairs that can
|
|
|
- * be later used to inline a style.
|
|
|
- *
|
|
|
- * Those work in opposite direction to "normalize" event and always outputs style in the same way.
|
|
|
- *
|
|
|
- * If normalized style is represented as:
|
|
|
- *
|
|
|
- * const style = {
|
|
|
- * border: {
|
|
|
- * color: {
|
|
|
- * top: '#f00',
|
|
|
- * right: '#ba7',
|
|
|
- * bottom: '#f00',
|
|
|
- * left: '#ba7'
|
|
|
- * }
|
|
|
- * }
|
|
|
- * }
|
|
|
- *
|
|
|
- * The border reducer will output:
|
|
|
- *
|
|
|
- * const reduced = [
|
|
|
- * [ 'border-color', '#f00 #ba7' ]
|
|
|
- * ];
|
|
|
- *
|
|
|
- * which can be used to return the inline style string:
|
|
|
- *
|
|
|
- * style="border-color:#f00 #ba7;"
|
|
|
- *
|
|
|
- * @event reduce
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * Holds shorthand properties normalizers.
|
|
|
- *
|
|
|
- * Shorthand properties must be normalized as they can be written in various ways.
|
|
|
- * Normalizer must return object describing given shorthand.
|
|
|
- *
|
|
|
- * Example:
|
|
|
- * The `border-color` style is a shorthand property for `border-top-color`, `border-right-color`, `border-bottom-color`
|
|
|
- * and `border-left-color`. Similarly there are shorthand for border width (`border-width`) and style (`border-style`).
|
|
|
- *
|
|
|
- * For `border-color` the given shorthand:
|
|
|
- *
|
|
|
- * border-color: #f00 #ba7;
|
|
|
- *
|
|
|
- * might be written as:
|
|
|
- *
|
|
|
- * border-color-top: #f00;
|
|
|
- * border-color-right: #ba7;
|
|
|
- * border-color-bottom: #f00;
|
|
|
- * border-color-left: #ba7;
|
|
|
- *
|
|
|
- * Normalizers produces coherent object representation for both shorthand and longhand forms:
|
|
|
- *
|
|
|
- * stylesProcessor.on( 'normalize:border-color', ( evt, data ) => {
|
|
|
- * data.path = 'border.color';
|
|
|
- * data.value = {
|
|
|
- * top: '#f00',
|
|
|
- * right: '#ba7',
|
|
|
- * bottom: '#f00',
|
|
|
- * left: '#ba7'
|
|
|
- * }
|
|
|
- * } );
|
|
|
- *
|
|
|
- * @event normalize
|
|
|
- */
|
|
|
-
|
|
|
-/**
|
|
|
- * @typedef {Array.<Array.<String>>} module:engine/view/stylesmap~PropertyEntry
|
|
|
- */
|