Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/spark_css/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
- **Feat**: Added `CssTextOverflow` sealed class for `text-overflow` property with `.clip`, `.ellipsis` keywords, `.value()` for custom strings, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssAspectRatio` sealed class for `aspect-ratio` property with `.auto` keyword, `.ratio()`, `.number()`, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssPlaceItems` sealed class for `place-items` shorthand property with align and optional justify parameters, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssPlaceContent` sealed class for `place-content` shorthand property with `CssAlignContent` and optional `CssJustifyContent` parameters, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssPlaceSelf` sealed class for `place-self` shorthand property with `CssAlignSelf` and optional `CssJustifySelf` parameters, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssJustifySelf` sealed class for `justify-self` property with `.auto`, `.normal`, `.stretch`, `.start`, `.end`, `.center`, `.left`, `.right`, `.baseline`, `.firstBaseline`, `.lastBaseline`, `.selfStart`, `.selfEnd` keywords, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssIsolation` sealed class for `isolation` property with `.auto`, `.isolate` keywords, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssMixBlendMode` sealed class for `mix-blend-mode` property with `.normal`, `.multiply`, `.screen`, `.overlay`, `.darken`, `.lighten`, `.colorDodge`, `.colorBurn`, `.hardLight`, `.softLight`, `.difference`, `.exclusion`, `.hue`, `.saturation`, `.color`, `.luminosity` keywords, plus `.variable()`, `.raw()`, and `.global()` escape hatches.
- **Feat**: Added `CssBackgroundBlendMode` sealed class for `background-blend-mode` property with `.normal`, `.multiply`, `.screen`, `.overlay`, `.darken`, `.lighten`, `.colorDodge`, `.colorBurn`, `.hardLight`, `.softLight`, `.difference`, `.exclusion`, `.hue`, `.saturation`, `.color`, `.luminosity` keywords, plus `.variable()`, `.raw()`, and `.global()` escape hatches.

### Changed

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import 'css_value.dart';

/// CSS background-blend-mode property values.
sealed class CssBackgroundBlendMode implements CssValue {
const CssBackgroundBlendMode._();

static const CssBackgroundBlendMode normal = _CssBackgroundBlendModeKeyword(
'normal',
);
static const CssBackgroundBlendMode multiply = _CssBackgroundBlendModeKeyword(
'multiply',
);
static const CssBackgroundBlendMode screen = _CssBackgroundBlendModeKeyword(
'screen',
);
static const CssBackgroundBlendMode overlay = _CssBackgroundBlendModeKeyword(
'overlay',
);
static const CssBackgroundBlendMode darken = _CssBackgroundBlendModeKeyword(
'darken',
);
static const CssBackgroundBlendMode lighten = _CssBackgroundBlendModeKeyword(
'lighten',
);
static const CssBackgroundBlendMode colorDodge =
_CssBackgroundBlendModeKeyword('color-dodge');
static const CssBackgroundBlendMode colorBurn =
_CssBackgroundBlendModeKeyword('color-burn');
static const CssBackgroundBlendMode hardLight =
_CssBackgroundBlendModeKeyword('hard-light');
static const CssBackgroundBlendMode softLight =
_CssBackgroundBlendModeKeyword('soft-light');
static const CssBackgroundBlendMode difference =
_CssBackgroundBlendModeKeyword('difference');
static const CssBackgroundBlendMode exclusion =
_CssBackgroundBlendModeKeyword('exclusion');
static const CssBackgroundBlendMode hue = _CssBackgroundBlendModeKeyword(
'hue',
);
static const CssBackgroundBlendMode saturation =
_CssBackgroundBlendModeKeyword('saturation');
static const CssBackgroundBlendMode color = _CssBackgroundBlendModeKeyword(
'color',
);
static const CssBackgroundBlendMode luminosity =
_CssBackgroundBlendModeKeyword('luminosity');

/// CSS variable reference.
factory CssBackgroundBlendMode.variable(String varName) =
_CssBackgroundBlendModeVariable;

/// Raw CSS value escape hatch.
factory CssBackgroundBlendMode.raw(String value) = _CssBackgroundBlendModeRaw;

/// Global keyword (inherit, initial, unset, revert).
factory CssBackgroundBlendMode.global(CssGlobal global) =
_CssBackgroundBlendModeGlobal;
}

final class _CssBackgroundBlendModeKeyword extends CssBackgroundBlendMode {
final String keyword;
const _CssBackgroundBlendModeKeyword(this.keyword) : super._();

@override
String toCss() => keyword;
}

final class _CssBackgroundBlendModeVariable extends CssBackgroundBlendMode {
final String varName;
const _CssBackgroundBlendModeVariable(this.varName) : super._();

@override
String toCss() => 'var(--$varName)';
}

final class _CssBackgroundBlendModeRaw extends CssBackgroundBlendMode {
final String value;
const _CssBackgroundBlendModeRaw(this.value) : super._();

@override
String toCss() => value;
}

final class _CssBackgroundBlendModeGlobal extends CssBackgroundBlendMode {
final CssGlobal global;
const _CssBackgroundBlendModeGlobal(this.global) : super._();

@override
String toCss() => global.toCss();
}
50 changes: 50 additions & 0 deletions packages/spark_css/lib/src/css_types/css_isolation.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 'css_value.dart';

/// CSS isolation property values.
sealed class CssIsolation implements CssValue {
const CssIsolation._();

static const CssIsolation auto = _CssIsolationKeyword('auto');
static const CssIsolation isolate = _CssIsolationKeyword('isolate');

/// CSS variable reference.
factory CssIsolation.variable(String varName) = _CssIsolationVariable;

/// Raw CSS value escape hatch.
factory CssIsolation.raw(String value) = _CssIsolationRaw;

/// Global keyword (inherit, initial, unset, revert).
factory CssIsolation.global(CssGlobal global) = _CssIsolationGlobal;
}

final class _CssIsolationKeyword extends CssIsolation {
final String keyword;
const _CssIsolationKeyword(this.keyword) : super._();

@override
String toCss() => keyword;
}

final class _CssIsolationVariable extends CssIsolation {
final String varName;
const _CssIsolationVariable(this.varName) : super._();

@override
String toCss() => 'var(--$varName)';
}

final class _CssIsolationRaw extends CssIsolation {
final String value;
const _CssIsolationRaw(this.value) : super._();

@override
String toCss() => value;
}

final class _CssIsolationGlobal extends CssIsolation {
final CssGlobal global;
const _CssIsolationGlobal(this.global) : super._();

@override
String toCss() => global.toCss();
}
65 changes: 65 additions & 0 deletions packages/spark_css/lib/src/css_types/css_justify_self.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import 'css_value.dart';

/// CSS justify-self property values.
sealed class CssJustifySelf implements CssValue {
const CssJustifySelf._();

static const CssJustifySelf auto = _CssJustifySelfKeyword('auto');
static const CssJustifySelf normal = _CssJustifySelfKeyword('normal');
static const CssJustifySelf stretch = _CssJustifySelfKeyword('stretch');
static const CssJustifySelf start = _CssJustifySelfKeyword('start');
static const CssJustifySelf end = _CssJustifySelfKeyword('end');
static const CssJustifySelf center = _CssJustifySelfKeyword('center');
static const CssJustifySelf left = _CssJustifySelfKeyword('left');
static const CssJustifySelf right = _CssJustifySelfKeyword('right');
static const CssJustifySelf baseline = _CssJustifySelfKeyword('baseline');
static const CssJustifySelf firstBaseline = _CssJustifySelfKeyword(
'first baseline',
);
static const CssJustifySelf lastBaseline = _CssJustifySelfKeyword(
'last baseline',
);
static const CssJustifySelf selfStart = _CssJustifySelfKeyword('self-start');
static const CssJustifySelf selfEnd = _CssJustifySelfKeyword('self-end');

/// CSS variable reference.
factory CssJustifySelf.variable(String varName) = _CssJustifySelfVariable;

/// Raw CSS value escape hatch.
factory CssJustifySelf.raw(String value) = _CssJustifySelfRaw;

/// Global keyword (inherit, initial, unset, revert).
factory CssJustifySelf.global(CssGlobal global) = _CssJustifySelfGlobal;
}

final class _CssJustifySelfKeyword extends CssJustifySelf {
final String keyword;
const _CssJustifySelfKeyword(this.keyword) : super._();

@override
String toCss() => keyword;
}

final class _CssJustifySelfVariable extends CssJustifySelf {
final String varName;
const _CssJustifySelfVariable(this.varName) : super._();

@override
String toCss() => 'var(--$varName)';
}

final class _CssJustifySelfRaw extends CssJustifySelf {
final String value;
const _CssJustifySelfRaw(this.value) : super._();

@override
String toCss() => value;
}

final class _CssJustifySelfGlobal extends CssJustifySelf {
final CssGlobal global;
const _CssJustifySelfGlobal(this.global) : super._();

@override
String toCss() => global.toCss();
}
78 changes: 78 additions & 0 deletions packages/spark_css/lib/src/css_types/css_mix_blend_mode.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import 'css_value.dart';

/// CSS mix-blend-mode property values.
sealed class CssMixBlendMode implements CssValue {
const CssMixBlendMode._();

static const CssMixBlendMode normal = _CssMixBlendModeKeyword('normal');
static const CssMixBlendMode multiply = _CssMixBlendModeKeyword('multiply');
static const CssMixBlendMode screen = _CssMixBlendModeKeyword('screen');
static const CssMixBlendMode overlay = _CssMixBlendModeKeyword('overlay');
static const CssMixBlendMode darken = _CssMixBlendModeKeyword('darken');
static const CssMixBlendMode lighten = _CssMixBlendModeKeyword('lighten');
static const CssMixBlendMode colorDodge = _CssMixBlendModeKeyword(
'color-dodge',
);
static const CssMixBlendMode colorBurn = _CssMixBlendModeKeyword(
'color-burn',
);
static const CssMixBlendMode hardLight = _CssMixBlendModeKeyword(
'hard-light',
);
static const CssMixBlendMode softLight = _CssMixBlendModeKeyword(
'soft-light',
);
static const CssMixBlendMode difference = _CssMixBlendModeKeyword(
'difference',
);
static const CssMixBlendMode exclusion = _CssMixBlendModeKeyword('exclusion');
static const CssMixBlendMode hue = _CssMixBlendModeKeyword('hue');
static const CssMixBlendMode saturation = _CssMixBlendModeKeyword(
'saturation',
);
static const CssMixBlendMode color = _CssMixBlendModeKeyword('color');
static const CssMixBlendMode luminosity = _CssMixBlendModeKeyword(
'luminosity',
);

/// CSS variable reference.
factory CssMixBlendMode.variable(String varName) = _CssMixBlendModeVariable;

/// Raw CSS value escape hatch.
factory CssMixBlendMode.raw(String value) = _CssMixBlendModeRaw;

/// Global keyword (inherit, initial, unset, revert).
factory CssMixBlendMode.global(CssGlobal global) = _CssMixBlendModeGlobal;
}

final class _CssMixBlendModeKeyword extends CssMixBlendMode {
final String keyword;
const _CssMixBlendModeKeyword(this.keyword) : super._();

@override
String toCss() => keyword;
}

final class _CssMixBlendModeVariable extends CssMixBlendMode {
final String varName;
const _CssMixBlendModeVariable(this.varName) : super._();

@override
String toCss() => 'var(--$varName)';
}

final class _CssMixBlendModeRaw extends CssMixBlendMode {
final String value;
const _CssMixBlendModeRaw(this.value) : super._();

@override
String toCss() => value;
}

final class _CssMixBlendModeGlobal extends CssMixBlendMode {
final CssGlobal global;
const _CssMixBlendModeGlobal(this.global) : super._();

@override
String toCss() => global.toCss();
}
56 changes: 56 additions & 0 deletions packages/spark_css/lib/src/css_types/css_place_content.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'css_flex.dart';
import 'css_value.dart';

/// CSS place-content shorthand property values.
sealed class CssPlaceContent implements CssValue {
const CssPlaceContent._();

/// Shorthand with align and optional justify.
factory CssPlaceContent(CssAlignContent align, [CssJustifyContent? justify]) =
_CssPlaceContentShorthand;

/// CSS variable reference.
factory CssPlaceContent.variable(String varName) = _CssPlaceContentVariable;

/// Raw CSS value escape hatch.
factory CssPlaceContent.raw(String value) = _CssPlaceContentRaw;

/// Global keyword (inherit, initial, unset, revert).
factory CssPlaceContent.global(CssGlobal global) = _CssPlaceContentGlobal;
}

final class _CssPlaceContentShorthand extends CssPlaceContent {
final CssAlignContent align;
final CssJustifyContent? justify;
const _CssPlaceContentShorthand(this.align, [this.justify]) : super._();

@override
String toCss() {
if (justify == null) return align.toCss();
return '${align.toCss()} ${justify!.toCss()}';
}
}

final class _CssPlaceContentVariable extends CssPlaceContent {
final String varName;
const _CssPlaceContentVariable(this.varName) : super._();

@override
String toCss() => 'var(--$varName)';
}

final class _CssPlaceContentRaw extends CssPlaceContent {
final String value;
const _CssPlaceContentRaw(this.value) : super._();

@override
String toCss() => value;
}

final class _CssPlaceContentGlobal extends CssPlaceContent {
final CssGlobal global;
const _CssPlaceContentGlobal(this.global) : super._();

@override
String toCss() => global.toCss();
}
Loading