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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ jobs:
run: flutter pub get
working-directory: example

- name: Generate example icon catalog
run: dart run tool/generate_example_icon_catalog.dart

- name: Check formatting
run: dart format --output=none --set-exit-if-changed .

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ jobs:
cache: true
pub-cache: true

- name: Install dependencies
- name: Install package dependencies
run: flutter pub get

- name: Install example dependencies
run: flutter pub get
working-directory: example

- name: Generate example icon catalog
run: dart run tool/generate_example_icon_catalog.dart

- name: Build web demo
run: flutter build web --release --base-href /morphnext/
working-directory: example
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ jobs:
- name: Install dependencies
run: flutter pub get

- name: Install example dependencies
run: flutter pub get
working-directory: example

- name: Generate example icon catalog
run: dart run tool/generate_example_icon_catalog.dart

- name: Check formatting
run: dart format --output=none --set-exit-if-changed .

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ migrate_working_dir/
/build/
/coverage/
/example/test/failures/
/example/lib/icon_catalog.g.dart
.superpowers/
.worktrees/
4 changes: 4 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ docs/
*.iml
.flutter-plugins-dependencies
**/.flutter-plugins-dependencies
/example/*
!/example/example.dart
/tool/
/test/tool/
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.6.1

- Update the web showcase to Lucide 3.1.17.
- Generate its searchable icon catalog in CI and deployment workflows for
reliable icon package updates.
- Keep the pub.dev package compact by shipping the focused example without the
full web showcase sources.

## 0.6.0

- Add configurable application-wide morph cache limits, public cache statistics,
Expand Down
14 changes: 9 additions & 5 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@
flutter run -t example.dart
```

`lib/main.dart` is the full marketing showcase built for GitHub Pages. Run it
`lib/main.dart` is the full web showcase built for GitHub Pages. Run it
on any Flutter target with:

```console
flutter run
```

The showcase includes an endless random hero and an interactive constructor at
`/playground`. Its checked-in icon catalog is generated for search and does not
affect applications that depend on `morphnext`.
`/playground`. Its icon catalog is generated locally for search and does not
affect applications that depend on `morphnext`. The generated file is ignored
by Git.

Run `flutter pub get` in this directory, then refresh the checked-in catalog
from the repository root after upgrading Flutter or an icon dependency:
Run `flutter pub get` in both the repository root and this directory, then
generate the catalog from the repository root before analyzing, testing, or
building the showcase:

```console
flutter pub get
flutter pub get --directory example
dart run tool/generate_example_icon_catalog.dart
```
22,606 changes: 0 additions & 22,606 deletions example/lib/icon_catalog.g.dart

This file was deleted.

6 changes: 3 additions & 3 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ packages:
dependency: "direct main"
description:
name: lucide_icons_flutter
sha256: "234155b10641b8ef7bab8a077b93ea6c92fe849c06740cf89dcd86dcf350934f"
sha256: "6e2eb4a11137851be84a57e936fc864d565709ec0ae854b786b15397d1b66276"
url: "https://pub.dev"
source: hosted
version: "3.1.15"
version: "3.1.17"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -286,7 +286,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.6.0"
version: "0.6.1"
objective_c:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
go_router: ^17.5.0
google_fonts: ^8.1.0
http: ^1.6.0
lucide_icons_flutter: ^3.1.15
lucide_icons_flutter: ^3.1.17
morphnext:
path: ..
reel_text: ^0.4.4
Expand Down
7 changes: 6 additions & 1 deletion lib/src/font/font_asset_resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ final class FontAssetResolver {
try {
final font = await _loadFont(face.asset);
if (!font.containsCodePoint(icon.codePoint)) continue;
return font.glyphForCodePoint(icon.codePoint, selection);
return font.glyphForCodePoint(icon.codePoint, (
fill: selection.fill,
weight: selection.weight,
grade: selection.grade,
opticalSize: selection.opticalSize,
));
} catch (error) {
lastFailure = FontDataException(
'Failed to read bundled font face',
Expand Down
20 changes: 17 additions & 3 deletions lib/src/font/open_type_font.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,23 @@ import 'dart:typed_data';
import '../geometry/shape.dart';
import 'binary_reader.dart';
import 'cff_outline.dart';
import 'font_selection.dart';
import 'true_type_outline.dart';

/// Variable-font axes that affect a decoded outline.
typedef FontVariationSelection = ({
double? fill,
double? weight,
double? grade,
double? opticalSize,
});

const FontVariationSelection defaultFontVariationSelection = (
fill: null,
weight: null,
grade: null,
opticalSize: null,
);

const _trueTypeScaler = 0x00010000;
const _openTypeScaler = 0x4f54544f;
const _legacyTrueScaler = 0x74727565;
Expand Down Expand Up @@ -339,7 +353,7 @@ final class OpenTypeFont {
/// Decodes the outline mapped from [codePoint].
GlyphOutline glyphForCodePoint(
int codePoint, [
MorphFontSelection selection = defaultMorphFontSelection,
FontVariationSelection selection = defaultFontVariationSelection,
]) {
final glyphId = glyphIndexForCodePoint(codePoint);
if (glyphId == null) {
Expand All @@ -357,7 +371,7 @@ final class OpenTypeFont {
};
}

Map<String, double> _variationCoordinates(MorphFontSelection selection) {
Map<String, double> _variationCoordinates(FontVariationSelection selection) {
final requested = <String, double?>{
'FILL': selection.fill,
'wght': selection.weight,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: morphnext
description: Interruptible, spring-driven vector icon morphing for Flutter without per-pair animation assets.
version: 0.6.0
version: 0.6.1
homepage: https://kicknext.github.io/morphnext/
repository: https://github.com/KickNext/morphnext
issue_tracker: https://github.com/KickNext/morphnext/issues
Expand Down
16 changes: 2 additions & 14 deletions test/src/font/true_type_outline_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ void main() {
final base = font.glyphForCodePoint(TestFontBuilder.quadraticCodePoint);
final varied = font.glyphForCodePoint(
TestFontBuilder.quadraticCodePoint,
const (
fill: null,
weight: 650,
grade: null,
opticalSize: null,
fontWeight: null,
),
const (fill: null, weight: 650, grade: null, opticalSize: null),
);

expect(font.variationAxes.keys, contains('wght'));
Expand All @@ -35,13 +29,7 @@ void main() {
final base = font.glyphForCodePoint(TestFontBuilder.compositeCodePoint);
final varied = font.glyphForCodePoint(
TestFontBuilder.compositeCodePoint,
const (
fill: null,
weight: 650.0,
grade: null,
opticalSize: null,
fontWeight: null,
),
const (fill: null, weight: 650.0, grade: null, opticalSize: null),
);

expect(cubicBounds(varied.contours).$1, cubicBounds(base.contours).$1 + 10);
Expand Down
2 changes: 1 addition & 1 deletion tool/generate_example_icon_catalog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ String renderIconCatalog(
Set<GeneratedIcon> heroUnsafeIcons = const <GeneratedIcon>{},
}) {
final output = StringBuffer()
..writeln('// GENERATED CODE - DO NOT MODIFY BY HAND.')
..writeln('// GENERATED CODE - DO NOT MODIFY BY HAND OR COMMIT.')
..writeln('// Run: dart run tool/generate_example_icon_catalog.dart')
..writeln()
..writeln("part of 'icon_catalog.dart';")
Expand Down