diff --git a/packages/wonky_app/lib/src/core/preferences_controller.dart b/packages/wonky_app/lib/src/core/preferences_controller.dart index afd4ff8b..e97fd24f 100644 --- a/packages/wonky_app/lib/src/core/preferences_controller.dart +++ b/packages/wonky_app/lib/src/core/preferences_controller.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart' show ThemeMode; +import 'package:shad/shad.dart' show ShadThemeMode; import 'package:wonky_client/wonky_client.dart'; import 'package:wonky_ui/wonky_ui.dart'; @@ -35,10 +35,10 @@ class PreferencesController extends ChangeNotifier { final Map _deviceValues = {}; AppThemeMode get appTheme => _theme; - ThemeMode get themeMode => switch (_theme) { - AppThemeMode.system => ThemeMode.system, - AppThemeMode.light => ThemeMode.light, - AppThemeMode.dark => ThemeMode.dark, + ShadThemeMode get themeMode => switch (_theme) { + AppThemeMode.system => ShadThemeMode.system, + AppThemeMode.light => ShadThemeMode.light, + AppThemeMode.dark => ShadThemeMode.dark, }; UiDensity get density => _density; WonkyDensity get wonkyDensity => _density == UiDensity.compact diff --git a/packages/wonky_app/lib/src/core/toasts.dart b/packages/wonky_app/lib/src/core/toasts.dart index d71a7b83..c6842976 100644 --- a/packages/wonky_app/lib/src/core/toasts.dart +++ b/packages/wonky_app/lib/src/core/toasts.dart @@ -39,14 +39,14 @@ class Toasts { title: Text(title), description: description == null ? null : Text(description), action: action, - duration: duration, + displayDuration: duration, ) : ShadToast( id: id, title: Text(title), description: description == null ? null : Text(description), action: action, - duration: duration, + displayDuration: duration, ), ); return id; @@ -112,7 +112,7 @@ class Toasts { child: Text(cancelLabel), ), ), - duration: duration, + displayDuration: duration, ), ); return id; diff --git a/packages/wonky_app/lib/src/mcp_bridge/developer_settings.dart b/packages/wonky_app/lib/src/mcp_bridge/developer_settings.dart index 8f59b19f..7045d05b 100644 --- a/packages/wonky_app/lib/src/mcp_bridge/developer_settings.dart +++ b/packages/wonky_app/lib/src/mcp_bridge/developer_settings.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'package:intl/intl.dart' as intl; import 'package:shad/shad.dart'; import 'package:wonky_client/wonky_client.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import 'package:wonky_core/wonky_core.dart' hide ActorKind; import '../commands/shell_commands/general_commands.dart' show mcpUrl; @@ -261,7 +262,7 @@ class _McpDeveloperSettingsState extends State { Text( '${t.prefix}… · ${t.scopes.join(', ')}', style: theme.textTheme.muted.copyWith( - fontFamily: 'packages/shad/GeistMono', + fontFamily: WonkyFonts.geistMono, fontSize: 12, ), ), @@ -305,7 +306,7 @@ class _McpDeveloperSettingsState extends State { child: Text( text, style: TextStyle( - fontFamily: 'packages/shad/GeistMono', + fontFamily: WonkyFonts.geistMono, fontSize: 12, color: theme.colorScheme.foreground, ), @@ -349,7 +350,7 @@ class _McpDeveloperSettingsState extends State { child: Text( created.secret, style: TextStyle( - fontFamily: 'packages/shad/GeistMono', + fontFamily: WonkyFonts.geistMono, color: theme.colorScheme.foreground, ), ), diff --git a/packages/wonky_app/lib/src/publications/publications_section.dart b/packages/wonky_app/lib/src/publications/publications_section.dart index 7842d3bd..8c999936 100644 --- a/packages/wonky_app/lib/src/publications/publications_section.dart +++ b/packages/wonky_app/lib/src/publications/publications_section.dart @@ -3,6 +3,7 @@ import 'package:flutter/widgets.dart'; import 'package:intl/intl.dart' as intl; import 'package:shad/shad.dart'; import 'package:wonky_client/wonky_client.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import '../bootstrap/app_urls.dart'; import '../data/api.dart'; @@ -438,7 +439,7 @@ class _PublicationsSectionState extends State { child: Text( text, style: TextStyle( - fontFamily: 'packages/shad/GeistMono', + fontFamily: WonkyFonts.geistMono, fontSize: 12, color: theme.colorScheme.foreground, ), diff --git a/packages/wonky_app/lib/src/shell/wonky_shell.dart b/packages/wonky_app/lib/src/shell/wonky_shell.dart index c43e6da6..e84c34d2 100644 --- a/packages/wonky_app/lib/src/shell/wonky_shell.dart +++ b/packages/wonky_app/lib/src/shell/wonky_shell.dart @@ -6,6 +6,7 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_web_plugins/url_strategy.dart'; import 'package:provider/provider.dart'; +import 'package:shad/material.dart' show ShadMaterial; import 'package:shad/shad.dart'; import 'package:wonky_client/wonky_client.dart'; import 'package:wonky_core/wonky_core.dart' hide ActorKind; @@ -386,24 +387,29 @@ class _WonkyShellState extends State { WonkyUiLocalizations.delegate, ...config.localizationsDelegates, ], - builder: (context, child) => WonkyThemeScope( - data: WonkyThemeExtension( - density: s.prefs.wonkyDensity, - reduceMotion: s.prefs.reduceMotion, - ), - child: KeymapScope( - scope: KeyScope.global, - keymap: s.keymap, - child: config.wrap( - context, - s, - McpBridgeScope( - services: s, - appTools: config.mcpUiTools(s), - child: ShellOverlays( + // ShadMaterial: the Material theme, Material and localizations + // that super_editor, SelectableText, re_editor and the Material + // Scrollbar need (shad 1.0.1 no longer installs them). + builder: (context, child) => ShadMaterial( + child: WonkyThemeScope( + data: WonkyThemeExtension( + density: s.prefs.wonkyDensity, + reduceMotion: s.prefs.reduceMotion, + ), + child: KeymapScope( + scope: KeyScope.global, + keymap: s.keymap, + child: config.wrap( + context, + s, + McpBridgeScope( services: s, - ready: _ready, - child: child ?? const SizedBox.shrink(), + appTools: config.mcpUiTools(s), + child: ShellOverlays( + services: s, + ready: _ready, + child: child ?? const SizedBox.shrink(), + ), ), ), ), diff --git a/packages/wonky_app/pubspec.yaml b/packages/wonky_app/pubspec.yaml index 7c22f587..7b08e7b1 100644 --- a/packages/wonky_app/pubspec.yaml +++ b/packages/wonky_app/pubspec.yaml @@ -29,7 +29,7 @@ dependencies: serverpod_auth_idp_client: 4.1.0-rc.1 serverpod_auth_idp_flutter: 4.1.0-rc.1 serverpod_flutter: 4.1.0-rc.1 - shad: ^0.99.4 + shad: ^1.0.2 shared_preferences: ^2.5.6 sqlite_async: ^0.14.5 url_launcher: ^6.3.3 diff --git a/packages/wonky_charts_flutter/lib/src/render/chart_painter.dart b/packages/wonky_charts_flutter/lib/src/render/chart_painter.dart index 94cf0fc8..cf9f9d59 100644 --- a/packages/wonky_charts_flutter/lib/src/render/chart_painter.dart +++ b/packages/wonky_charts_flutter/lib/src/render/chart_painter.dart @@ -6,24 +6,22 @@ import 'dart:ui' as ui; import 'package:flutter/foundation.dart' show visibleForTesting; import 'package:flutter/rendering.dart'; import 'package:wonky_charts/wonky_charts.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import '../three_d/chart3d_gpu.dart'; /// Font used for chart text when the spec names none (or one that isn't -/// bundled): the app UI font shipped with `shad`. -const String kChartDefaultFont = 'packages/shad/Inter'; +/// bundled): Inter, shipped with `wonky_ui`. +const String kChartDefaultFont = WonkyFonts.inter; -const List _fallbackFonts = [ - 'packages/shad/Inter', - 'packages/shad/Geist', -]; +const List _fallbackFonts = [WonkyFonts.inter, WonkyFonts.geist]; /// Families the app can render (bundled fonts); others fall back to /// [kChartDefaultFont] so layout and paint use the same metrics. const Set _bundled = { - 'packages/shad/Inter', - 'packages/shad/Geist', - 'packages/shad/GeistMono', + WonkyFonts.inter, + WonkyFonts.geist, + WonkyFonts.geistMono, }; /// The bundled Flutter family chart text of family [f] is drawn with @@ -34,9 +32,9 @@ String _family(String? f) { if (f == null || f.isEmpty) return kChartDefaultFont; if (_bundled.contains(f)) return f; return switch (f.toLowerCase()) { - 'inter' => 'packages/shad/Inter', - 'geist' => 'packages/shad/Geist', - 'geist mono' || 'geistmono' => 'packages/shad/GeistMono', + 'inter' => WonkyFonts.inter, + 'geist' => WonkyFonts.geist, + 'geist mono' || 'geistmono' => WonkyFonts.geistMono, _ => kChartDefaultFont, }; } diff --git a/packages/wonky_charts_flutter/pubspec.yaml b/packages/wonky_charts_flutter/pubspec.yaml index e39a4467..102f9cd4 100644 --- a/packages/wonky_charts_flutter/pubspec.yaml +++ b/packages/wonky_charts_flutter/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: flutter_scene: ^0.24.3 # The shared chart widgets (ChartView tooltips, data table dialog, chart # type icons, ChartStyleEditor) are built with shad (02). - shad: ^0.99.4 + shad: ^1.0.2 # Color picker of the ChartStyleEditor. wonky_ui: path: ../wonky_ui diff --git a/packages/wonky_rich_editor/pubspec.yaml b/packages/wonky_rich_editor/pubspec.yaml index 7235a55b..c554ba6f 100644 --- a/packages/wonky_rich_editor/pubspec.yaml +++ b/packages/wonky_rich_editor/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: flutter_test: sdk: flutter markdown: ^7.3.1 - shad: ^0.99.4 + shad: ^1.0.2 # The vendored, patched super_editor (pubspec_overrides.yaml at the root). super_editor: ^0.3.0-dev.52 wonky_rich_text: diff --git a/packages/wonky_slides_core/lib/src/icons/lucide_glyphs.g.dart b/packages/wonky_slides_core/lib/src/icons/lucide_glyphs.g.dart index 8e4b95d8..92ac792f 100644 --- a/packages/wonky_slides_core/lib/src/icons/lucide_glyphs.g.dart +++ b/packages/wonky_slides_core/lib/src/icons/lucide_glyphs.g.dart @@ -1,10 +1,10 @@ // GENERATED by tool/generate_lucide_glyphs.dart from -// lucide_icons_flutter 3.1.25 — do not edit. +// lucide_icons_flutter 4.0.1 — do not edit. part of 'lucide_glyphs.dart'; /// The `lucide_icons_flutter` version the code points come from. -const lucideGlyphsVersion = '3.1.25'; +const lucideGlyphsVersion = '4.0.1'; /// Lucide icon name → code point (aliases included). const Map _lucideCodePoints = { @@ -152,12 +152,14 @@ const Map _lucideCodePoints = { 'audio-lines-off': 0xe737, 'audio-lines-x': 0xe72e, 'audio-waveform': 0xe55b, + 'avocado': 0xe7b2, 'award': 0xe04f, 'axe': 0xe050, 'axis-3-d': 0xe2fe, 'axis-3d': 0xe2fe, 'baby': 0xe2ce, 'backpack': 0xe2c8, + 'bacon': 0xe7b3, 'badge': 0xe474, 'badge-alert': 0xe475, 'badge-cent': 0xe50f, @@ -216,6 +218,7 @@ const Map _lucideCodePoints = { 'beef-off': 0xe6dc, 'beer': 0xe2cf, 'beer-off': 0xe5d9, + 'belarusian-ruble': 0xe7a6, 'bell': 0xe059, 'bell-check': 0xe6ef, 'bell-dot': 0xe42b, @@ -299,6 +302,7 @@ const Map _lucideCodePoints = { 'brain': 0xe3c6, 'brain-circuit': 0xe3c7, 'brain-cog': 0xe3c8, + 'brain-off': 0xe7b4, 'brick-wall': 0xe581, 'brick-wall-fire': 0xe653, 'brick-wall-shield': 0xe690, @@ -335,6 +339,7 @@ const Map _lucideCodePoints = { 'calendar-arrow-up': 0xe5ff, 'calendar-check': 0xe2b7, 'calendar-check-2': 0xe2b8, + 'calendar-chevrons-left': 0xe7a7, 'calendar-chevrons-right': 0xe76c, 'calendar-clock': 0xe304, 'calendar-cog': 0xe5ed, @@ -382,6 +387,7 @@ const Map _lucideCodePoints = { 'cat': 0xe38c, 'cctv': 0xe57d, 'cctv-off': 0xe6d8, + 'certificate': 0xe7b1, 'chart-area': 0xe4d3, 'chart-bar': 0xe2a2, 'chart-bar-big': 0xe4a7, @@ -472,6 +478,7 @@ const Map _lucideCodePoints = { 'circle-equal': 0xe400, 'circle-euro': 0xe71f, 'circle-fading-arrow-up': 0xe618, + 'circle-fading-play': 0xe7a8, 'circle-fading-plus': 0xe5bc, 'circle-gauge': 0xe4e1, 'circle-help': 0xe082, @@ -606,6 +613,7 @@ const Map _lucideCodePoints = { 'corner-up-left': 0xe0a7, 'corner-up-right': 0xe0a8, 'cpu': 0xe0a9, + 'cpu-ai': 0xe7a9, 'creative-commons': 0xe3b2, 'credit-card': 0xe0aa, 'credit-card-check': 0xe743, @@ -697,6 +705,8 @@ const Map _lucideCodePoints = { 'egg': 0xe25d, 'egg-fried': 0xe351, 'egg-off': 0xe395, + 'eighth-note': 0xe34a, + 'eighth-notes': 0xe122, 'eject': 0xe733, 'ellipse': 0xe6b2, 'ellipsis': 0xe0b6, @@ -877,6 +887,8 @@ const Map _lucideCodePoints = { 'folder-sync': 0xe4c9, 'folder-tree': 0xe33c, 'folder-up': 0xe33d, + 'folder-user': 0xe7aa, + 'folder-users': 0xe7ab, 'folder-x': 0xe33e, 'folders': 0xe33f, 'footprints': 0xe3b9, @@ -948,6 +960,8 @@ const Map _lucideCodePoints = { 'grab': 0xe1e6, 'graduation-cap': 0xe234, 'grape': 0xe352, + 'graph-hub': 0xe7b5, + 'graph-star': 0xe7ac, 'grid': 0xe0e9, 'grid-2-x-2': 0xe4ff, 'grid-2-x-2-check': 0xe5e4, @@ -966,6 +980,8 @@ const Map _lucideCodePoints = { 'groceries': 0xe799, 'group': 0xe464, 'guitar': 0xe55f, + 'guitar-electric': 0xe7ad, + 'half-note': 0xe34b, 'ham': 0xe5d7, 'hamburger': 0xe665, 'hammer': 0xe0ec, @@ -1114,6 +1130,7 @@ const Map _lucideCodePoints = { 'lens': 0xe79c, 'lens-concave': 0xe6b7, 'lens-convex': 0xe6b8, + 'letter-spacing': 0xe7b6, 'letter-text': 0xe605, 'letters': 0xe78e, 'library': 0xe100, @@ -1129,6 +1146,7 @@ const Map _lucideCodePoints = { 'line-dot-left-horizontal': 0xe78a, 'line-dot-right-horizontal': 0xe6b9, 'line-dot-top-vertical': 0xe78b, + 'line-height': 0xe7b7, 'line-squiggle': 0xe67a, 'line-style': 0xe6da, 'link': 0xe102, @@ -1235,6 +1253,7 @@ const Map _lucideCodePoints = { 'message-circle-question': 0xe568, 'message-circle-question-mark': 0xe568, 'message-circle-reply': 0xe569, + 'message-circle-text': 0xe7a4, 'message-circle-warning': 0xe56a, 'message-circle-x': 0xe56b, 'message-square': 0xe117, @@ -1436,6 +1455,7 @@ const Map _lucideCodePoints = { 'percent-circle': 0xe51a, 'percent-diamond': 0xe51b, 'percent-square': 0xe51c, + 'perfume-bottle': 0xe7ae, 'person-standing': 0xe21e, 'phi': 0xe71c, 'philippine-peso': 0xe604, @@ -1640,6 +1660,7 @@ const Map _lucideCodePoints = { 'server': 0xe153, 'server-cog': 0xe341, 'server-crash': 0xe1e9, + 'server-nas': 0xe7a5, 'server-off': 0xe1ea, 'server-plus': 0xe721, 'settings': 0xe154, @@ -1700,6 +1721,7 @@ const Map _lucideCodePoints = { 'signpost': 0xe540, 'signpost-big': 0xe541, 'siren': 0xe2ef, + 'sixteenth-notes': 0xe34c, 'skip-back': 0xe15f, 'skip-forward': 0xe160, 'skull': 0xe221, @@ -1712,6 +1734,7 @@ const Map _lucideCodePoints = { 'smartphone': 0xe163, 'smartphone-charging': 0xe22e, 'smartphone-nfc': 0xe3c4, + 'smartphone-user-round': 0xe7b8, 'smile': 0xe164, 'smile-plus': 0xe301, 'snail': 0xe4f8, @@ -1941,6 +1964,7 @@ const Map _lucideCodePoints = { 'toggle-left': 0xe18b, 'toggle-right': 0xe18c, 'toilet': 0xe635, + 'tombstone': 0xe7b9, 'tool-case': 0xe67d, 'toolbox': 0xe6b0, 'toothbrush': 0xe76a, @@ -2044,7 +2068,9 @@ const Map _lucideCodePoints = { 'user-x-2': 0xe46d, 'users': 0xe1a4, 'users-2': 0xe46e, + 'users-collaboration': 0xe7af, 'users-round': 0xe46e, + 'users-round-collaboration': 0xe7b0, 'utensils': 0xe2f6, 'utensils-crossed': 0xe2f7, 'utility-pole': 0xe3c2, diff --git a/packages/wonky_ui/fonts/GeistMono[wght].ttf b/packages/wonky_ui/fonts/GeistMono[wght].ttf new file mode 100644 index 00000000..e8d645ab Binary files /dev/null and b/packages/wonky_ui/fonts/GeistMono[wght].ttf differ diff --git a/packages/wonky_ui/fonts/Geist[wght].ttf b/packages/wonky_ui/fonts/Geist[wght].ttf new file mode 100644 index 00000000..bed807e8 Binary files /dev/null and b/packages/wonky_ui/fonts/Geist[wght].ttf differ diff --git a/packages/wonky_ui/fonts/Inter[opsz,wght].ttf b/packages/wonky_ui/fonts/Inter[opsz,wght].ttf new file mode 100644 index 00000000..047c92f6 Binary files /dev/null and b/packages/wonky_ui/fonts/Inter[opsz,wght].ttf differ diff --git a/packages/wonky_ui/fonts/OFL-Geist.txt b/packages/wonky_ui/fonts/OFL-Geist.txt new file mode 100644 index 00000000..5e96022d --- /dev/null +++ b/packages/wonky_ui/fonts/OFL-Geist.txt @@ -0,0 +1,93 @@ +Copyright (c) 2023 Vercel, in collaboration with basement.studio + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/packages/wonky_ui/fonts/OFL-Inter.txt b/packages/wonky_ui/fonts/OFL-Inter.txt new file mode 100644 index 00000000..e941fc7d --- /dev/null +++ b/packages/wonky_ui/fonts/OFL-Inter.txt @@ -0,0 +1,93 @@ +Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/packages/wonky_ui/lib/src/preview/wonky_preview_app.dart b/packages/wonky_ui/lib/src/preview/wonky_preview_app.dart index b91e24db..ad5a7f92 100644 --- a/packages/wonky_ui/lib/src/preview/wonky_preview_app.dart +++ b/packages/wonky_ui/lib/src/preview/wonky_preview_app.dart @@ -1,6 +1,6 @@ -import 'package:flutter/material.dart' show ThemeMode; import 'package:flutter/widgets.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:shad/material.dart' show ShadMaterial; import 'package:shad/shad.dart'; import '../l10n/wonky_ui_localizations.dart'; @@ -32,8 +32,8 @@ class WonkyTestApp extends StatelessWidget { theme: WonkyTheme.light(config), darkTheme: WonkyTheme.dark(config), themeMode: brightness == Brightness.dark - ? ThemeMode.dark - : ThemeMode.light, + ? ShadThemeMode.dark + : ShadThemeMode.light, locale: locale, supportedLocales: const [Locale('en')], localizationsDelegates: [ @@ -41,6 +41,7 @@ class WonkyTestApp extends StatelessWidget { ...extraDelegates, GlobalWidgetsLocalizations.delegate, ], + builder: (context, child) => ShadMaterial(child: child!), home: WonkyThemeScope( data: WonkyThemeExtension(density: config.density), child: wrap == null ? child : Builder(builder: (c) => wrap!(c, child)), diff --git a/packages/wonky_ui/lib/src/theme/wonky_fonts.dart b/packages/wonky_ui/lib/src/theme/wonky_fonts.dart new file mode 100644 index 00000000..7bfd5a26 --- /dev/null +++ b/packages/wonky_ui/lib/src/theme/wonky_fonts.dart @@ -0,0 +1,17 @@ +/// The typefaces bundled with `wonky_ui` (suite 02 §2): Geist for the UI, +/// GeistMono for code and formulas, and Inter, the default document and chart +/// font. They are declared under `fonts:` in this package, so Flutter +/// qualifies their families with `packages/wonky_ui/`. +abstract final class WonkyFonts { + /// The package that declares the fonts (for `TextStyle.package`). + static const package = 'wonky_ui'; + + /// Inter (variable: weight and optical size). + static const inter = 'packages/$package/Inter'; + + /// Geist, the UI font. + static const geist = 'packages/$package/Geist'; + + /// Geist Mono, the monospace UI font. + static const geistMono = 'packages/$package/GeistMono'; +} diff --git a/packages/wonky_ui/lib/src/theme/wonky_theme.dart b/packages/wonky_ui/lib/src/theme/wonky_theme.dart index e0301e3c..ce222f28 100644 --- a/packages/wonky_ui/lib/src/theme/wonky_theme.dart +++ b/packages/wonky_ui/lib/src/theme/wonky_theme.dart @@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart'; import 'package:shad/shad.dart'; import 'wonky_colors.dart'; +import 'wonky_fonts.dart'; /// UI density (user preference, suite 04 §4 Appearance). enum WonkyDensity { comfortable, compact } @@ -68,7 +69,7 @@ abstract final class WonkyTheme { ), () => _build(brightness, config)); /// The monospace font family (formulas, code, shortcuts). - static const monoFamily = kDefaultFontFamilyMono; + static const monoFamily = WonkyFonts.geistMono; static ShadThemeData _build(Brightness brightness, WonkyThemeConfig config) { final tokens = WonkyPalette.tokens(brightness); @@ -92,7 +93,7 @@ abstract final class WonkyTheme { colorScheme: scheme, style: ShadStyleTokens.vega, spacing: ShadSpacing(step: compact ? 3.5 : 4), - textTheme: ShadTextTheme(family: 'Geist', package: 'shad'), + textTheme: ShadTextTheme(family: WonkyFonts.geist), ); } diff --git a/packages/wonky_ui/lib/src/widgets/menu/dropdown_menu.dart b/packages/wonky_ui/lib/src/widgets/menu/dropdown_menu.dart index 5a2c1a5b..d1911ebf 100644 --- a/packages/wonky_ui/lib/src/widgets/menu/dropdown_menu.dart +++ b/packages/wonky_ui/lib/src/widgets/menu/dropdown_menu.dart @@ -48,6 +48,15 @@ class _WonkyDropdownMenuState extends State { ShadContextMenuController? _own; bool _wasOpen = false; + /// The entries the open menu shows. shad keeps a closing menu on screen + /// while it animates out, so it goes on showing them instead of an empty + /// (slim) menu. + List _entries = const []; + + /// The open menu's height limit, kept while it animates out: the trigger + /// may be leaving too (a closing drawer) and cannot be measured then. + double? _openMaxHeight; + ShadContextMenuController get _controller => widget.controller ?? (_own ??= ShadContextMenuController()); @@ -110,15 +119,6 @@ class _WonkyDropdownMenuState extends State { @override Widget build(BuildContext context) { final anchor = widget.anchor ?? _defaultAnchor; - final items = _controller.isOpen - ? buildWonkyMenuItems( - context, - widget.entries(), - onClose: _controller.hide, - requestFocus: true, - maxHeight: () => _maxHeight(anchor), - ) - : const [SizedBox.shrink()]; return ShadContextMenu( controller: _controller, // A manual anchor never moves the menu back onto the screen. @@ -126,7 +126,15 @@ class _WonkyDropdownMenuState extends State { ? WonkyMenuPlacement.onScreen(anchor) : anchor, constraints: widget.constraints ?? const BoxConstraints(minWidth: 200), - items: items, + itemsBuilder: (_) => buildWonkyMenuItems( + context, + _controller.isOpen ? _entries = widget.entries() : _entries, + onClose: _controller.hide, + requestFocus: true, + maxHeight: () => _controller.isOpen + ? _openMaxHeight = _maxHeight(anchor) + : _openMaxHeight, + ), onTapOutside: (_) => _controller.hide(), child: Builder( builder: (context) => widget.builder(context, _controller), @@ -182,6 +190,10 @@ class _LazyContextMenuRegion extends StatefulWidget { class _LazyContextMenuRegionState extends State<_LazyContextMenuRegion> { final _controller = ShadContextMenuController(); + /// The entries of the open menu, kept while it animates out (see + /// [_WonkyDropdownMenuState._entries]). + List _entries = const []; + /// Where the last pointer went down: the menu opens there (shad flips it /// above the pointer when it does not fit below and keeps it on screen /// horizontally), so it may be as tall as the larger side. @@ -224,17 +236,12 @@ class _LazyContextMenuRegionState extends State<_LazyContextMenuRegion> { return ShadContextMenuRegion( controller: _controller, constraints: const BoxConstraints(minWidth: 220), - items: [ - if (_controller.isOpen) - ...buildWonkyMenuItems( - context, - widget.entries(), - onClose: _controller.hide, - maxHeight: _maxHeight, - ) - else - const SizedBox.shrink(), - ], + itemsBuilder: (_) => buildWonkyMenuItems( + context, + _controller.isOpen ? _entries = widget.entries() : _entries, + onClose: _controller.hide, + maxHeight: _maxHeight, + ), child: Listener( // Also over empty space, where shad's detector opens the menu too. behavior: HitTestBehavior.translucent, diff --git a/packages/wonky_ui/lib/src/widgets/menu/menu_items.dart b/packages/wonky_ui/lib/src/widgets/menu/menu_items.dart index 16aa9cfa..0201c954 100644 --- a/packages/wonky_ui/lib/src/widgets/menu/menu_items.dart +++ b/packages/wonky_ui/lib/src/widgets/menu/menu_items.dart @@ -107,6 +107,20 @@ class _TypeAheadMenuBodyState extends State<_TypeAheadMenuBody> { return true; } + /// Focus follows the pointer, as in Radix menus: an item is highlighted + /// while hovered or focused, so an item focused with the keyboard stayed + /// highlighted next to the hovered one. The arrows continue from it. + void _onPointerEnter(int i) { + if (_focusItem(i)) return; + if (_wrappers.any((w) => w.hasFocus)) _root.requestFocus(); + } + + /// The pointer left item [i] (for another item, a separator or outside + /// the menu): it gives the focus back to the menu. + void _onPointerExit(int i) { + if (i < _wrappers.length && _wrappers[i].hasFocus) _root.requestFocus(); + } + KeyEventResult _move(int delta, {bool fromEdge = false}) { final count = _labels.length; if (count == 0) return KeyEventResult.ignored; @@ -198,11 +212,19 @@ class _TypeAheadMenuBodyState extends State<_TypeAheadMenuBody> { _ => '', }); children.add( - Focus( - focusNode: _wrapperAt(i), - canRequestFocus: false, - skipTraversal: true, - child: _buildEntry(context, e, leading), + MouseRegion( + // Opaque (the default) with deferToChild: a non-opaque region + // reports a miss from hit testing, which would hide taps on the + // item from the menu's TapRegion. + hitTestBehavior: HitTestBehavior.deferToChild, + onEnter: (_) => _onPointerEnter(i), + onExit: (_) => _onPointerExit(i), + child: Focus( + focusNode: _wrapperAt(i), + canRequestFocus: false, + skipTraversal: true, + child: _buildEntry(context, e, leading), + ), ), ); } diff --git a/packages/wonky_ui/lib/src/widgets/menu/popup_menu_host.dart b/packages/wonky_ui/lib/src/widgets/menu/popup_menu_host.dart index f1961a47..a97bb791 100644 --- a/packages/wonky_ui/lib/src/widgets/menu/popup_menu_host.dart +++ b/packages/wonky_ui/lib/src/widgets/menu/popup_menu_host.dart @@ -69,7 +69,8 @@ class WonkyPopupMenuHostState extends State { void _changed() { if (_wasOpen && !_controller.isOpen) { - _built = null; + // [_built] stays: shad keeps the closing menu on screen while it + // animates out, and it should not shrink to an empty menu meanwhile. final cb = _onClosed; _onClosed = null; cb?.call(); @@ -168,7 +169,7 @@ class WonkyPopupMenuHostState extends State { anchor: _at == null ? null : ShadGlobalAnchor(_at!), constraints: const BoxConstraints(minWidth: 220), onTapOutside: (_) => _controller.hide(), - items: _controller.isOpen && entries != null + items: entries != null && (_controller.isOpen || _built != null) ? [ _PlacementProbe(key: _probe, onLaidOut: _place), Opacity( diff --git a/packages/wonky_ui/lib/src/widgets/menubar/menubar.dart b/packages/wonky_ui/lib/src/widgets/menubar/menubar.dart index af0f2c84..3b38e38e 100644 --- a/packages/wonky_ui/lib/src/widgets/menubar/menubar.dart +++ b/packages/wonky_ui/lib/src/widgets/menubar/menubar.dart @@ -150,6 +150,14 @@ class WonkyMenubar extends StatefulWidget { class _WonkyMenubarState extends State { WonkyMenubarController? _own; + /// The entries each menu showed when it was last open. shad keeps a + /// closing menu on screen while it animates out (switching menus, choosing + /// an item), so it goes on showing them instead of an empty, slim menu. + final Map> _shown = {}; + + /// The height limit of the open menu, measured only while a menu is open. + double? _openMaxHeight; + WonkyMenubarController get _controller => widget.controller ?? (_own ??= WonkyMenubarController()); @@ -194,6 +202,39 @@ class _WonkyMenubarState extends State { return WonkyMenuPlacement.itemsMaxHeightBeside(context, rect, gap: 4); } + ShadThemeData? _instantCloseBase; + ShadThemeData? _instantCloseTheme; + + /// [theme] with menus that close without an exit animation (cached per + /// theme, which is itself cached by `WonkyTheme`). + ShadThemeData _instantClose(ShadThemeData theme) { + if (!identical(theme, _instantCloseBase)) { + _instantCloseBase = theme; + _instantCloseTheme = theme.copyWith( + contextMenuTheme: theme.contextMenuTheme.copyWith( + popoverReverseDuration: Duration.zero, + ), + ); + } + return _instantCloseTheme!; + } + + /// The items of menu [i]: its current entries while [open], else the ones + /// it showed last (see [_shown]). Never empty: without items + /// `ShadContextMenu` drops its popover and remounts the title. + List _items(int i, {required bool open}) { + final items = buildWonkyMenuItems( + context, + open ? _shown[i] = widget.menus[i].entries() : _shown[i] ?? const [], + onClose: _controller.close, + // Also when opened with the pointer: the menu takes the keys (Escape, + // ↑/↓, type-ahead) instead of a focused document editor behind it. + requestFocus: true, + maxHeight: () => open ? _openMaxHeight = _maxHeight() : _openMaxHeight, + ); + return items.isEmpty ? const [SizedBox.shrink()] : items; + } + @override Widget build(BuildContext context) { final controller = _controller.._menus = widget.menus; @@ -210,43 +251,38 @@ class _WonkyMenubarState extends State { // scroll the strip horizontally instead of overflowing. child: SingleChildScrollView( scrollDirection: Axis.horizontal, - child: ShadMenubar( - controller: controller._shad, - border: ShadBorder.none, - padding: EdgeInsets.zero, - backgroundColor: theme.colorScheme.background, - items: [ - for (var i = 0; i < widget.menus.length; i++) - ShadMenubarItem( - key: ValueKey('menubar.${widget.menus[i].id}'), - focusNode: controller._focusAt(i), - controller: controller._popoverAt(i), - height: widget.height - 4, - buttonPadding: const EdgeInsets.symmetric(horizontal: 8), - // shad's default anchor, kept on screen (a menu at the - // end of a narrow strip ran off the right edge). - anchor: _anchor, - constraints: const BoxConstraints(minWidth: 240), - items: selected == i - ? buildWonkyMenuItems( - context, - widget.menus[i].entries(), - onClose: controller.close, - // Also when opened with the pointer: the menu takes - // the keys (Escape, ↑/↓, type-ahead) instead of a - // focused document editor behind it. - requestFocus: true, - maxHeight: _maxHeight, - ) - : const [SizedBox.shrink()], - child: Text( - widget.menus[i].label, - style: theme.textTheme.small.copyWith( - fontWeight: FontWeight.normal, + // Menus close at once, as in 0.99 and native menubars: since shad + // 1.0 a menu animates out, and switching menus (hovering another + // title) showed the old one over the new one for 150 ms. + child: ShadTheme( + data: _instantClose(theme), + child: ShadMenubar( + controller: controller._shad, + border: ShadBorder.none, + padding: EdgeInsets.zero, + backgroundColor: theme.colorScheme.background, + items: [ + for (var i = 0; i < widget.menus.length; i++) + ShadMenubarItem( + key: ValueKey('menubar.${widget.menus[i].id}'), + focusNode: controller._focusAt(i), + controller: controller._popoverAt(i), + height: widget.height - 4, + buttonPadding: const EdgeInsets.symmetric(horizontal: 8), + // shad's default anchor, kept on screen (a menu at the + // end of a narrow strip ran off the right edge). + anchor: _anchor, + constraints: const BoxConstraints(minWidth: 240), + items: _items(i, open: selected == i), + child: Text( + widget.menus[i].label, + style: theme.textTheme.small.copyWith( + fontWeight: FontWeight.normal, + ), ), ), - ), - ], + ], + ), ), ), ), diff --git a/packages/wonky_ui/lib/src/widgets/presence/avatar.dart b/packages/wonky_ui/lib/src/widgets/presence/avatar.dart index bbe51718..f52fa7a3 100644 --- a/packages/wonky_ui/lib/src/widgets/presence/avatar.dart +++ b/packages/wonky_ui/lib/src/widgets/presence/avatar.dart @@ -80,7 +80,7 @@ class WonkyAvatar extends StatelessWidget { ); Widget avatar = imageUrl == null || imageUrl!.isEmpty ? fallback - : ShadAvatar(imageUrl, size: Size.square(inner), placeholder: fallback); + : ShadAvatar(imageUrl, size: Size.square(inner), fallback: fallback); if (ringColor != null) { avatar = Container( width: size, diff --git a/packages/wonky_ui/lib/src/widgets/sync_status/sync_status.dart b/packages/wonky_ui/lib/src/widgets/sync_status/sync_status.dart index bf11e4aa..73feb2f1 100644 --- a/packages/wonky_ui/lib/src/widgets/sync_status/sync_status.dart +++ b/packages/wonky_ui/lib/src/widgets/sync_status/sync_status.dart @@ -6,6 +6,7 @@ import 'package:shad/shad.dart'; import '../../l10n/wonky_ui_localizations.dart'; import '../../theme/wonky_colors.dart'; +import '../../theme/wonky_fonts.dart'; import '../dialog/dialog_close_button.dart'; /// The sync states shown by [SyncStatusIndicator] (suite 02 §4.14). @@ -241,7 +242,7 @@ class _SyncStatusIndicatorState extends State { Text( time.format(e.at.toLocal()), style: theme.textTheme.muted.copyWith( - fontFamily: 'packages/shad/GeistMono', + fontFamily: WonkyFonts.geistMono, fontSize: 12, ), ), diff --git a/packages/wonky_ui/lib/wonky_ui.dart b/packages/wonky_ui/lib/wonky_ui.dart index 3e456fc8..ac18fd91 100644 --- a/packages/wonky_ui/lib/wonky_ui.dart +++ b/packages/wonky_ui/lib/wonky_ui.dart @@ -8,6 +8,7 @@ export 'src/ink/one_euro_filter.dart'; export 'src/keys/key_names.dart'; export 'src/l10n/wonky_ui_localizations.dart'; export 'src/theme/wonky_colors.dart'; +export 'src/theme/wonky_fonts.dart'; export 'src/theme/wonky_theme.dart'; export 'src/widgets/brand_logos/google_logo.dart'; export 'src/widgets/color_picker/color_picker.dart'; diff --git a/packages/wonky_ui/pubspec.yaml b/packages/wonky_ui/pubspec.yaml index 52c50468..6753d46c 100644 --- a/packages/wonky_ui/pubspec.yaml +++ b/packages/wonky_ui/pubspec.yaml @@ -17,10 +17,25 @@ dependencies: flutter_test: sdk: flutter intl: ^0.20.3 - shad: ^0.99.4 + shad: ^1.0.2 dev_dependencies: wonky_lints: path: ../wonky_lints flutter: generate: true + # The UI and default document typefaces (WonkyFonts). shad bundled them + # until 1.0; these are the same variable fonts, under their OFL licenses. + fonts: + - family: Inter + fonts: + - asset: "fonts/Inter[opsz,wght].ttf" + - family: Geist + fonts: + - asset: "fonts/Geist[wght].ttf" + - family: GeistMono + fonts: + - asset: "fonts/GeistMono[wght].ttf" + assets: + - fonts/OFL-Inter.txt + - fonts/OFL-Geist.txt diff --git a/packages/wonky_ui/test/widgets/menu_test.dart b/packages/wonky_ui/test/widgets/menu_test.dart index 0ff69014..2129eaf6 100644 --- a/packages/wonky_ui/test/widgets/menu_test.dart +++ b/packages/wonky_ui/test/widgets/menu_test.dart @@ -334,4 +334,109 @@ void main() { expect(field.hasFocus, isTrue); }, ); + + testWidgets( + 'Given an open menubar menu when hovering another title then only the new menu shows, at once', + (tester) async { + await pumpWonky( + tester, + Align( + alignment: Alignment.topLeft, + child: WonkyMenubar( + menus: [ + WonkyMenubarMenu( + id: 'edit', + label: 'Edit', + entries: () => const [WonkyMenuItem(label: 'Undo')], + ), + WonkyMenubarMenu( + id: 'view', + label: 'View', + entries: () => const [WonkyMenuItem(label: 'Zoom in')], + ), + ], + ), + ), + ); + final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse); + addTearDown(mouse.removePointer); + await mouse.addPointer(location: Offset.zero); + final edit = tester.getCenter(find.byKey(const ValueKey('menubar.edit'))); + await mouse.moveTo(edit); + await mouse.down(edit); + await mouse.up(); + await tester.pumpAndSettle(); + expect(find.text('Undo'), findsOneWidget); + + await mouse.moveTo( + tester.getCenter(find.byKey(const ValueKey('menubar.view'))), + ); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 16)); + // shad 1.0 animates a closing menu out; the menubar's close at once + // instead of showing over the new one. + expect(find.text('Undo'), findsNothing); + expect(find.text('Zoom in'), findsOneWidget); + expect(find.byType(IntrinsicWidth), findsOneWidget, reason: 'one menu'); + }, + ); + + testWidgets( + 'Given an open dropdown when it closes then it keeps its items while it animates out', + (tester) async { + await pumpWonky(tester, _dropdown([]), center: true); + await tester.tap(find.byKey(const ValueKey('trigger'))); + await tester.pumpAndSettle(); + final size = tester.getSize(find.byType(IntrinsicWidth).first); + + await tester.tapAt(const Offset(5, 5)); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 30)); + // Still on screen while it animates out, and not as an empty (slim) + // menu. + expect(find.text('Open'), findsOneWidget); + expect(tester.getSize(find.byType(IntrinsicWidth).first), size); + + await tester.pumpAndSettle(); + expect(find.text('Open'), findsNothing); + }, + ); + + testWidgets( + 'Given an item focused with the keyboard when another item is hovered then the focus follows the pointer', + (tester) async { + final log = []; + await pumpWonky( + tester, + WonkyDropdownMenu( + entries: () => [ + for (final l in ['a', 'b', 'c', 'd']) + WonkyMenuItem(label: l, onSelected: () => log.add(l)), + ], + builder: (context, c) => ShadButton( + key: const ValueKey('trigger'), + onPressed: c.toggle, + child: const Text('Menu'), + ), + ), + center: true, + ); + final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse); + addTearDown(mouse.removePointer); + await mouse.addPointer(location: Offset.zero); + await tester.tap(find.byKey(const ValueKey('trigger'))); + await tester.pumpAndSettle(); + await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown); + await tester.pump(); + + await mouse.moveTo(tester.getCenter(find.text('c'))); + await tester.pumpAndSettle(); + // One highlighted item: `a` lost the keyboard focus to `c`, and the + // arrows continue from there. + await tester.sendKeyEvent(LogicalKeyboardKey.arrowDown); + await tester.sendKeyEvent(LogicalKeyboardKey.enter); + await tester.pumpAndSettle(); + expect(log, ['d']); + }, + ); } diff --git a/pubspec.lock b/pubspec.lock index e3b2c411..c324fb59 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -424,22 +424,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.2" - extended_image: - dependency: transitive - description: - name: extended_image - sha256: e81d801cd692921f152834e01f39bba8b3d6302c48ad420d499c6062a7e24737 - url: "https://pub.dev" - source: hosted - version: "10.1.0" - extended_image_library: - dependency: transitive - description: - name: extended_image_library - sha256: "1f9a24d3a00c2633891c6a7b5cab2807999eb2d5b597e5133b63f49d113811fe" - url: "https://pub.dev" - source: hosted - version: "5.0.1" fake_async: dependency: transitive description: @@ -867,14 +851,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.6.0" - http_client_helper: - dependency: transitive - description: - name: http_client_helper - sha256: "8a9127650734da86b5c73760de2b404494c968a3fd55602045ffec789dac3cb1" - url: "https://pub.dev" - source: hosted - version: "3.0.0" http_multi_server: dependency: transitive description: @@ -1052,10 +1028,10 @@ packages: dependency: transitive description: name: lucide_icons_flutter - sha256: d350446fb7a7ab3ef8550e3cb5aab72f4e9da54d54111244ab09489bb8a2a1ff + sha256: a07370b432d4a88ed8fd6c26b5bbcc4e29fb7b24b6350517fd32209a6b1a50c1 url: "https://pub.dev" source: hosted - version: "3.1.25" + version: "4.0.1" markdown: dependency: transitive description: @@ -1700,10 +1676,10 @@ packages: dependency: transitive description: name: shad - sha256: "1ca618c67415b8351366475c9859aba6ff539753a78e059fb5653af1e8df6f37" + sha256: f99604bb239b14ba5b0815161df444e1a54fac1fa6e8cf2d6c63919c30c848dc url: "https://pub.dev" source: hosted - version: "0.99.4" + version: "1.0.2" shared_preferences: dependency: transitive description: @@ -2076,14 +2052,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" - universal_image: - dependency: transitive - description: - name: universal_image - sha256: "2eae13df84a47960cc4148fec88f09031ea64cbf667b4131ff2c907dd7b7c6d1" - url: "https://pub.dev" - source: hosted - version: "1.0.12" universal_platform: dependency: transitive description: diff --git a/specs/01-architecture.md b/specs/01-architecture.md index f7cf5672..e83ed98e 100644 --- a/specs/01-architecture.md +++ b/specs/01-architecture.md @@ -387,7 +387,7 @@ controls: toasts for people, none for agents), `WonkyFindBar`, `showConflictRevi `third_party/syntax_highlight` and its `pubspec_overrides.yaml` entry are gone. `highlight` 0.7.x (highlight.js port) is a dependency of `wonky_code` only (`HighlightJsTokenizer`). - `sqlite3_web` pinned to a version compatible with `sqlite_async` (toptap pins 0.9.4). -- `shad` `^0.99.4`. +- `shad` `^1.0.2` (ships no fonts since 1.0: `wonky_ui` bundles Inter, Geist and GeistMono, 02 §2). ### 2.3 Vendored packages (local copies) diff --git a/specs/02-design-system.md b/specs/02-design-system.md index 511b0166..77c0b5b4 100644 --- a/specs/02-design-system.md +++ b/specs/02-design-system.md @@ -1,6 +1,6 @@ # 02 · Design System — `wonky_ui` -All UI is built with **`shad`** (Serverpod's high-fidelity shadcn/ui port, `shad: ^0.99.4`, +All UI is built with **`shad`** (Serverpod's high-fidelity shadcn/ui port, `shad: ^1.0.2`, docs: ; the package ships an agent skill at `skills/shad-overview/SKILL.md` — read it before building UI). Where shad lacks a component, we build a **matching widget** in `packages/wonky_ui` that uses only shad tokens @@ -9,7 +9,11 @@ we build a **matching widget** in `packages/wonky_ui` that uses only shad tokens follows light/dark automatically. Material widgets are **not** used directly in feature code (shad derives a Material `ThemeData` -for interop only; `Scaffold`-free layouts are preferred). `wonky_ui` must not depend on Serverpod, +for interop only; `Scaffold`-free layouts are preferred). Since shad 1.0.1 the core library does not +depend on Material: the shell's `ShadApp` builder wraps the app in `ShadMaterial` +(`package:shad/material.dart`), which installs that theme, a transparent `Material` and the Material +and Cupertino localizations for the third-party widgets that need them (super_editor, re_editor, +`SelectableText`, `Scrollbar`). Tests that pump their own `ShadApp` need it too. `wonky_ui` must not depend on Serverpod, the client, or any feature package — pure presentation. ## 1. App setup @@ -19,9 +23,10 @@ ShadApp.router( title: 'Wonky Write', theme: WonkyTheme.light(prefs), // ShadThemeData darkTheme: WonkyTheme.dark(prefs), - themeMode: prefs.themeMode, // system | light | dark + themeMode: prefs.themeMode, // ShadThemeMode: system | light | dark routerConfig: router, localizationsDelegates: [GlobalShadLocalizations.delegate, ...WonkyL10n.delegates], + builder: (context, child) => ShadMaterial(child: child!), ) ``` @@ -59,8 +64,9 @@ on `ShadColorScheme`), each defined for light and dark: | `success`, `warning`, `info` | Status badges, toasts | | `offline` | Offline banner | -Typography: shad bundles **Inter**, **Geist** and **GeistMono**. App chrome uses Geist (UI) and -GeistMono (formulas, code, shortcuts). Document fonts (Write themes, Sheets cell fonts) come from +Typography: `wonky_ui` bundles **Inter**, **Geist** and **GeistMono** (`fonts:` in its pubspec, +family names in `WonkyFonts`; shad shipped them until 1.0 and now ships no fonts). App chrome +uses Geist (UI) and GeistMono (formulas, code, shortcuts). Document fonts (Write themes, Sheets cell fonts) come from a curated font list (see each app spec) loaded via bundled assets (no runtime Google Fonts on web for privacy/offline; `google_fonts` is used only at build-time to fetch files into assets). diff --git a/specs/wonky_sheets/06-formatting.md b/specs/wonky_sheets/06-formatting.md index 0d057ce8..e7ba40bf 100644 --- a/specs/wonky_sheets/06-formatting.md +++ b/specs/wonky_sheets/06-formatting.md @@ -511,13 +511,13 @@ Curated **bundled** cell fonts (no runtime Google Fonts; suite 02 §2), files un | Group | Fonts | |-------|-------| -| Default / UI-like | **Inter** (default, ships with shad), Roboto, Open Sans, Lato, Source Sans 3, Noto Sans, Nunito, Montserrat, Oswald | +| Default / UI-like | **Inter** (default, ships with `wonky_ui`), Roboto, Open Sans, Lato, Source Sans 3, Noto Sans, Nunito, Montserrat, Oswald | | Serif | Merriweather, Lora, Playfair Display, Noto Serif | | Mono | JetBrains Mono, Roboto Mono, Source Code Pro (Courier Prime is not offered: JetBrains Mono is the suite's monospace face) | | Handwriting/display | Caveat, Comfortaa | | Metric-compatible (XLSX fidelity) | Arimo (≈ Arial/Helvetica), Tinos (≈ Times New Roman), Cousine (≈ Courier New), Carlito (≈ Calibri), Caladea (≈ Cambria), Gelasio (≈ Georgia) | -> **As built (phase 2).** Bundled: Inter, Geist, Geist Mono (from `shad`) and static OFL faces of +> **As built (phase 2).** Bundled: Inter, Geist, Geist Mono (from `wonky_ui`) and static OFL faces of > Open Sans, EB Garamond and JetBrains Mono (`wonky_fonts`' package assets, `packages/wonky_fonts/fonts/` — Sheets' own copy was dropped in CQ-64g —, loaded on demand by > `CellFonts`, `features/formatting/cell_fonts.dart`). Every other name — including the theme > presets' fonts — is stored unchanged and displayed by category (serif → EB Garamond, mono → diff --git a/specs/wonky_write/01-overview.md b/specs/wonky_write/01-overview.md index cfa3a67d..36d8a576 100644 --- a/specs/wonky_write/01-overview.md +++ b/specs/wonky_write/01-overview.md @@ -18,7 +18,7 @@ suite specs they build on. | Who is it for? | Writers, teams and agents who want Google-Docs-level collaboration and portable, diff-able, AI-friendly Markdown. See personas in [../00-product-overview.md](../00-product-overview.md) §2. | | How is it different from Google Docs? | Content is always valid Markdown. Appearance comes only from themes. Every action is a command that can be undone and invoked through MCP. Export to `.md` loses nothing except comments, which are kept separately. | | How is it different from a Markdown editor? | WYSIWYG (no visible syntax), real-time multi-user editing (OT), comments and suggestions, version history, pages and print layout, and themes for PDF/DOCX/EPUB export. | -| Tech | `super_editor` (**vendored** copy based on 0.3.0-dev.52 with our patches SE-1…SE-5, see [04 §2.2](04-editor.md)) for the editing surface; `dart_quill_delta` 9.x for OT; Serverpod streams for sync; `shad` 0.99.4 + `wonky_ui` for the chrome. | +| Tech | `super_editor` (**vendored** copy based on 0.3.0-dev.52 with our patches SE-1…SE-5, see [04 §2.2](04-editor.md)) for the editing surface; `dart_quill_delta` 9.x for OT; Serverpod streams for sync; `shad` 1.0.2 + `wonky_ui` for the chrome. | ## 2. Write-specific principles diff --git a/specs/wonky_write/06-themes.md b/specs/wonky_write/06-themes.md index b1dfaf22..6c0b9d4d 100644 --- a/specs/wonky_write/06-themes.md +++ b/specs/wonky_write/06-themes.md @@ -576,7 +576,7 @@ instances (the `pdf` package does not support variable fonts or CFF-flavoured OT | 20 | IBM Plex Mono | Mono | 400 R/I, 700 R | OFL 1.1 | | 21 | Source Code Pro | Mono | 400 R/I, 700 R | OFL 1.1 | | 22 | Courier Prime | Mono (typewriter) | 400 R/I, 700 R/I | OFL 1.1 | -| 23 | Geist / Geist Mono | Sans / Mono | 400, 600, 700 (already bundled by shad for UI; registered as document fonts too) | OFL 1.1 | +| 23 | Geist / Geist Mono | Sans / Mono | 400, 600, 700 (already bundled by `wonky_ui` for UI; registered as document fonts too) | OFL 1.1 | **Fallback fonts** (not user-selectable, loaded on demand when glyphs are missing): Noto Sans, Noto Serif, Noto Sans Mono, Noto Sans Symbols 2, Noto Emoji (monochrome; PDF can't embed color @@ -589,7 +589,7 @@ likewise on demand. All OFL 1.1. License texts are included in the About › Lic > registry live in the shared package `packages/wonky_fonts` (`fonts/` as package assets, > manifest `BundledFonts`); Write loads Open Sans, EB Garamond and JetBrains Mono from it > (`packages/wonky_fonts/fonts/…`; OFL-1.1, licenses in the same folder and on the About › Licenses page). Families that are not bundled are -> substituted by category (sans → Inter from `shad` on screen / Open Sans in PDFs, serif → EB +> substituted by category (sans → Inter from `wonky_ui` on screen / Open Sans in PDFs, serif → EB > Garamond, mono → JetBrains Mono) by `WriteFonts` (`features/themes/write_fonts.dart`); Open > Sans is the PDF glyph fallback (Latin Extended, Greek, Cyrillic). CJK/Arabic fallbacks and the > full curated set are a TODO. The server has the same TTFs in `wonky_server/web/fonts/` diff --git a/tool/prune_web_fonts.dart b/tool/prune_web_fonts.dart index 08b6a895..72c08d8e 100644 --- a/tool/prune_web_fonts.dart +++ b/tool/prune_web_fonts.dart @@ -8,8 +8,8 @@ // // - the Lucide stroke-weight families (`Lucide100`…`Lucide600`): only Slides // draws icons with other stroke widths (`wonky_slides_core` lucide_glyphs); -// - shad's `Inter`: the UI uses Geist; only chart text (Sheets, Slides) uses -// it (`wonky_charts_flutter` chart_painter); +// - `wonky_ui`'s `Inter`: the UI uses Geist; only chart text (Sheets, +// Slides) uses it (`wonky_charts_flutter` chart_painter); // - `golden_toolkit`'s Roboto, a test package (in case it comes back as a // regular dependency of the vendored super_editor). // @@ -23,8 +23,8 @@ import 'dart:io'; /// Families each app's build drops. const Map> unusedFamilies = { - 'drive': {..._lucideWeights, _shadInter, _testRoboto}, - 'write': {..._lucideWeights, _shadInter, _testRoboto}, + 'drive': {..._lucideWeights, _inter, _testRoboto}, + 'write': {..._lucideWeights, _inter, _testRoboto}, 'sheets': {..._lucideWeights, _testRoboto}, 'slides': {_testRoboto}, }; @@ -37,7 +37,7 @@ const _lucideWeights = { 'packages/lucide_icons_flutter/Lucide500', 'packages/lucide_icons_flutter/Lucide600', }; -const _shadInter = 'packages/shad/Inter'; +const _inter = 'packages/wonky_ui/Inter'; const _testRoboto = 'packages/golden_toolkit/Roboto'; void main(List args) { diff --git a/wonky_drive/pubspec.yaml b/wonky_drive/pubspec.yaml index 3ed9eadf..92590990 100644 --- a/wonky_drive/pubspec.yaml +++ b/wonky_drive/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: # File previews: signed-URL fetches (Drive 02 §6.1). http: ^1.6.0 intl: ^0.20.3 - shad: ^0.99.4 + shad: ^1.0.2 wonky_app: path: ../packages/wonky_app wonky_client: diff --git a/wonky_drive/test/features/preview/file_preview_screen_test.dart b/wonky_drive/test/features/preview/file_preview_screen_test.dart index 8cc127a5..aaabdfca 100644 --- a/wonky_drive/test/features/preview/file_preview_screen_test.dart +++ b/wonky_drive/test/features/preview/file_preview_screen_test.dart @@ -4,6 +4,7 @@ import 'dart:ui' as ui; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:shad/material.dart' show ShadMaterial; import 'package:shad/shad.dart' show ShadApp; import 'package:wonky_app/fonts.dart'; import 'package:wonky_app/wonky_app.dart'; @@ -670,6 +671,7 @@ void main() { ); await tester.pumpWidget( ShadApp( + builder: (context, child) => ShadMaterial(child: child!), home: TextFileViewer(controller: active(), fonts: fonts), ), ); diff --git a/wonky_drive/test/support/preview_fakes.dart b/wonky_drive/test/support/preview_fakes.dart index 62fab532..9f019a1f 100644 --- a/wonky_drive/test/support/preview_fakes.dart +++ b/wonky_drive/test/support/preview_fakes.dart @@ -2,10 +2,10 @@ import 'dart:async'; import 'dart:convert'; import 'dart:typed_data'; -import 'package:flutter/material.dart' show Material, MaterialType; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:go_router/go_router.dart'; +import 'package:shad/material.dart' show ShadMaterial; import 'package:shad/shad.dart'; import 'package:wonky_app/testing.dart'; import 'package:wonky_app/wonky_app.dart'; @@ -357,8 +357,7 @@ class PreviewTestbed { WonkyUiLocalizations.delegate, ...config.localizationsDelegates, ], - builder: (context, child) => - Material(type: MaterialType.transparency, child: child), + builder: (context, child) => ShadMaterial(child: child!), ), ); if (settle) await settleImages(tester); diff --git a/wonky_sheets/lib/features/conditional_format/cf_panel.dart b/wonky_sheets/lib/features/conditional_format/cf_panel.dart index c5f1b85d..15d27328 100644 --- a/wonky_sheets/lib/features/conditional_format/cf_panel.dart +++ b/wonky_sheets/lib/features/conditional_format/cf_panel.dart @@ -8,6 +8,7 @@ import 'package:wonky_app/wonky_app.dart'; import 'package:wonky_core/wonky_core.dart'; import 'package:wonky_sheets_core/formula.dart' show GridRect, validateFormula; import 'package:wonky_sheets_core/model.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import '../../l10n/sheets_l10n.dart'; import '../common/range_input.dart'; @@ -1162,11 +1163,7 @@ class _TextFieldState extends State<_TextField> { enabled: widget.enabled, placeholder: widget.placeholder == null ? null : Text(widget.placeholder!), style: widget.mono - ? const TextStyle( - fontFamily: 'GeistMono', - package: 'shad', - fontSize: 13, - ) + ? const TextStyle(fontFamily: WonkyFonts.geistMono, fontSize: 13) : null, onChanged: widget.onChanged, ); diff --git a/wonky_sheets/lib/features/data_validation/dv_panel.dart b/wonky_sheets/lib/features/data_validation/dv_panel.dart index 2626fdf3..21f47942 100644 --- a/wonky_sheets/lib/features/data_validation/dv_panel.dart +++ b/wonky_sheets/lib/features/data_validation/dv_panel.dart @@ -898,7 +898,7 @@ class _RuleEditorState extends State<_RuleEditor> { controller: c, placeholder: Text(d.kind == DvKind.customFormula ? '=B2>A2' : placeholder), style: d.kind == DvKind.customFormula - ? const TextStyle(fontFamily: 'packages/shad/GeistMono', fontSize: 13) + ? const TextStyle(fontFamily: WonkyFonts.geistMono, fontSize: 13) : null, onChanged: (_) { _changed(); diff --git a/wonky_sheets/lib/features/filters/filter_layers.dart b/wonky_sheets/lib/features/filters/filter_layers.dart index 6d33dada..7f2893b0 100644 --- a/wonky_sheets/lib/features/filters/filter_layers.dart +++ b/wonky_sheets/lib/features/filters/filter_layers.dart @@ -3,6 +3,7 @@ import 'dart:math' as math; import 'package:flutter/foundation.dart' show Listenable; import 'package:flutter/widgets.dart' show Brightness; import 'package:flutter/rendering.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import 'package:wonky_sheets_core/formula.dart' show GridRect; import '../../theme/sheets_tokens.dart'; @@ -292,7 +293,7 @@ class StickyRowLayer extends GridLayer { style: TextStyle( fontSize: fontSize, color: t.sheetBackground, - fontFamily: 'packages/shad/Inter', + fontFamily: WonkyFonts.inter, fontWeight: FontWeight.w600, ), ), diff --git a/wonky_sheets/lib/features/formatting/cell_fonts.dart b/wonky_sheets/lib/features/formatting/cell_fonts.dart index cd4d785d..a1a3c9a7 100644 --- a/wonky_sheets/lib/features/formatting/cell_fonts.dart +++ b/wonky_sheets/lib/features/formatting/cell_fonts.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; +import 'package:wonky_ui/wonky_ui.dart'; /// The asset folder of the bundled static faces: `wonky_fonts`' package /// assets, shared with the other apps (the server keeps a copy in @@ -207,11 +208,11 @@ abstract final class CellFonts { final shown = displayFamily(family); switch (shown) { case inter: - return 'packages/shad/Inter'; + return WonkyFonts.inter; case geist: - return 'packages/shad/Geist'; + return WonkyFonts.geist; case geistMono: - return 'packages/shad/GeistMono'; + return WonkyFonts.geistMono; } if (!_loaded.contains(shown)) unawaited(ensureLoaded(shown)); return shown; @@ -231,7 +232,7 @@ abstract final class CellFonts { } /// Fallback families for glyphs missing in the cell font. - static const fallback = ['packages/shad/Inter', 'packages/shad/Geist']; + static const fallback = [WonkyFonts.inter, WonkyFonts.geist]; static final Set _loaded = {}; static final Map> _loading = {}; diff --git a/wonky_sheets/lib/features/formatting/formula_field.dart b/wonky_sheets/lib/features/formatting/formula_field.dart index 5bcba895..916cc37a 100644 --- a/wonky_sheets/lib/features/formatting/formula_field.dart +++ b/wonky_sheets/lib/features/formatting/formula_field.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:shad/shad.dart'; import 'package:wonky_sheets_core/formula.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import '../../l10n/sheets_l10n.dart'; import '../../theme/sheets_tokens.dart'; @@ -305,8 +306,7 @@ class FormulaFieldState extends State { final parse = _parseError(); final error = parse != null ? l.formulaParseError(parse) : widget.error; final mono = theme.textTheme.small.copyWith( - fontFamily: 'GeistMono', - package: 'shad', + fontFamily: WonkyFonts.geistMono, fontSize: 13, ); return Column( @@ -326,8 +326,7 @@ class FormulaFieldState extends State { ? null : Text(widget.placeholder!), style: const TextStyle( - fontFamily: 'GeistMono', - package: 'shad', + fontFamily: WonkyFonts.geistMono, fontSize: 13, ), ), diff --git a/wonky_sheets/lib/features/number_format/custom_date_time_dialog.dart b/wonky_sheets/lib/features/number_format/custom_date_time_dialog.dart index df44ef78..c29f933e 100644 --- a/wonky_sheets/lib/features/number_format/custom_date_time_dialog.dart +++ b/wonky_sheets/lib/features/number_format/custom_date_time_dialog.dart @@ -331,8 +331,7 @@ class _CustomDateTimeDialogState extends McpDialogState { child: Text( _pattern, style: theme.textTheme.muted.copyWith( - fontFamily: 'GeistMono', - package: 'shad', + fontFamily: WonkyFonts.geistMono, fontSize: 12, ), ), diff --git a/wonky_sheets/lib/features/number_format/custom_number_format_dialog.dart b/wonky_sheets/lib/features/number_format/custom_number_format_dialog.dart index bafde3a1..cc385f9b 100644 --- a/wonky_sheets/lib/features/number_format/custom_number_format_dialog.dart +++ b/wonky_sheets/lib/features/number_format/custom_number_format_dialog.dart @@ -3,7 +3,7 @@ import 'package:flutter/widgets.dart'; import 'package:shad/shad.dart'; import 'package:wonky_app/wonky_app.dart'; import 'package:wonky_sheets_core/model.dart'; -import 'package:wonky_ui/wonky_ui.dart' show WonkyDialogCloseButton; +import 'package:wonky_ui/wonky_ui.dart' show WonkyDialogCloseButton, WonkyFonts; import '../../l10n/sheets_l10n.dart'; import 'mcp_dialog_state.dart'; @@ -174,7 +174,7 @@ class _CustomNumberFormatDialogState (l.numFmtSampleZero, const NumberValue(0)), (l.numFmtSampleText, const TextValue('Text')), ]; - const mono = TextStyle(fontFamily: 'GeistMono', package: 'shad'); + const mono = TextStyle(fontFamily: WonkyFonts.geistMono); Widget example(String p) => ShadButton.ghost( key: ValueKey('dialog.customNumberFormat.example.$p'), size: ShadButtonSize.sm, diff --git a/wonky_sheets/pubspec.yaml b/wonky_sheets/pubspec.yaml index 62c393f2..7428dcca 100644 --- a/wonky_sheets/pubspec.yaml +++ b/wonky_sheets/pubspec.yaml @@ -56,7 +56,7 @@ dependencies: path: ../packages/wonky_revlog wonky_revlog_flutter: path: ../packages/wonky_revlog_flutter - shad: ^0.99.4 + shad: ^1.0.2 go_router: ^18.0.2 clock: ^1.1.3 intl: ^0.20.3 diff --git a/wonky_sheets/test/support/grid_pump.dart b/wonky_sheets/test/support/grid_pump.dart index 36e34d91..13f82531 100644 --- a/wonky_sheets/test/support/grid_pump.dart +++ b/wonky_sheets/test/support/grid_pump.dart @@ -1,7 +1,7 @@ -import 'package:flutter/material.dart' show Material, MaterialType; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; +import 'package:shad/material.dart' show ShadMaterial; import 'package:shad/shad.dart'; import 'package:wonky_app/wonky_app.dart'; import 'package:wonky_core/wonky_core.dart' show KeyScope; @@ -34,16 +34,14 @@ Future pumpSheets( WonkyUiLocalizations.delegate, SheetsLocalizations.delegate, ], - home: Material( - type: MaterialType.transparency, - child: WonkyThemeScope( - data: const WonkyThemeExtension(), - child: KeymapScope( - scope: KeyScope.global, - keymap: s.services.keymap, - child: - child ?? GridArea(controller: s.editor, services: s.services), - ), + builder: (context, child) => ShadMaterial(child: child!), + home: WonkyThemeScope( + data: const WonkyThemeExtension(), + child: KeymapScope( + scope: KeyScope.global, + keymap: s.services.keymap, + child: + child ?? GridArea(controller: s.editor, services: s.services), ), ), ), diff --git a/wonky_slides/pubspec.yaml b/wonky_slides/pubspec.yaml index e71ff2d3..52f356df 100644 --- a/wonky_slides/pubspec.yaml +++ b/wonky_slides/pubspec.yaml @@ -21,7 +21,7 @@ dependencies: sdk: flutter go_router: ^18.0.2 intl: ^0.20.3 - shad: ^0.99.4 + shad: ^1.0.2 wonky_app: path: ../packages/wonky_app # 3D slide transitions on the GPU (features/transitions/gpu, SL-29; diff --git a/wonky_write/lib/features/themes/write_fonts.dart b/wonky_write/lib/features/themes/write_fonts.dart index e668c3ca..e8b26dde 100644 --- a/wonky_write/lib/features/themes/write_fonts.dart +++ b/wonky_write/lib/features/themes/write_fonts.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; +import 'package:wonky_ui/wonky_ui.dart'; import 'package:wonky_write_core/wonky_write_core.dart'; /// One bundled static TTF face (a `wonky_fonts` package asset, @@ -33,10 +34,10 @@ abstract final class WriteFonts { static const ebGaramond = 'EB Garamond'; static const jetBrainsMono = 'JetBrains Mono'; - /// Inter / Geist ship with `shad` (variable fonts, screen only). - static const shadInter = 'packages/shad/Inter'; - static const shadGeist = 'packages/shad/Geist'; - static const shadGeistMono = 'packages/shad/GeistMono'; + /// Inter / Geist ship with `wonky_ui` (variable fonts, screen only). + static const inter = WonkyFonts.inter; + static const geist = WonkyFonts.geist; + static const geistMono = WonkyFonts.geistMono; /// Write's bundled faces: the Open Sans, EB Garamond and JetBrains Mono /// faces of the shared `wonky_fonts` package assets. @@ -77,17 +78,17 @@ abstract final class WriteFonts { static String screenFamilyFor(String family) { switch (family) { case 'Inter': - return shadInter; + return inter; case 'Geist': - return shadGeist; + return geist; case 'Geist Mono': - return shadGeistMono; + return geistMono; } if (_bundledFamilies.contains(family)) return family; return switch (categoryOf(family)) { FontCategory.serif => ebGaramond, FontCategory.mono => jetBrainsMono, - FontCategory.sans => shadInter, + FontCategory.sans => inter, }; } diff --git a/wonky_write/pubspec.yaml b/wonky_write/pubspec.yaml index 00c60078..ffee82a4 100644 --- a/wonky_write/pubspec.yaml +++ b/wonky_write/pubspec.yaml @@ -46,7 +46,7 @@ dependencies: path: ../packages/wonky_write_core wonky_ui: path: ../packages/wonky_ui - shad: ^0.99.4 + shad: ^1.0.2 wonky_app: path: ../packages/wonky_app wonky_client: diff --git a/wonky_write/test/features/print/print_preview_screen_test.dart b/wonky_write/test/features/print/print_preview_screen_test.dart index 169f5be6..cbd72dc5 100644 --- a/wonky_write/test/features/print/print_preview_screen_test.dart +++ b/wonky_write/test/features/print/print_preview_screen_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/material.dart' show ThemeMode; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -59,8 +58,8 @@ Future _pumpPreview( theme: WonkyTheme.light(), darkTheme: WonkyTheme.dark(), themeMode: brightness == Brightness.dark - ? ThemeMode.dark - : ThemeMode.light, + ? ShadThemeMode.dark + : ShadThemeMode.light, routerConfig: h.services.router, localizationsDelegates: const [ WonkyAppLocalizations.delegate, diff --git a/wonky_write/test/features/screen/support/screen_pump.dart b/wonky_write/test/features/screen/support/screen_pump.dart index 84cde6b6..9f4ad880 100644 --- a/wonky_write/test/features/screen/support/screen_pump.dart +++ b/wonky_write/test/features/screen/support/screen_pump.dart @@ -1,4 +1,4 @@ -import 'package:flutter/material.dart' show Material, MaterialType, ThemeMode; +import 'package:flutter/material.dart' show Material, MaterialType; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; @@ -30,8 +30,8 @@ Future pumpScreen( theme: WonkyTheme.light(), darkTheme: WonkyTheme.dark(), themeMode: brightness == Brightness.dark - ? ThemeMode.dark - : ThemeMode.light, + ? ShadThemeMode.dark + : ShadThemeMode.light, localizationsDelegates: const [ WonkyAppLocalizations.delegate, WonkyUiLocalizations.delegate, diff --git a/wonky_write/test/features/screen/support/shad_fonts.dart b/wonky_write/test/features/screen/support/shad_fonts.dart index f0c5d913..2b1b47b8 100644 --- a/wonky_write/test/features/screen/support/shad_fonts.dart +++ b/wonky_write/test/features/screen/support/shad_fonts.dart @@ -1,11 +1,11 @@ import 'package:flutter/services.dart'; -/// Loads shad's bundled UI font (Geist) so widget tests lay text out with +/// Loads the UI font (Geist, bundled with `wonky_ui`) so widget tests lay text out with /// real glyph widths instead of the test font's square glyphs, which make /// labels that fit in the app overflow fixed-width dialogs and popovers. /// Call from `setUpAll`. Future loadShadFonts() async { - final geist = FontLoader('packages/shad/Geist') - ..addFont(rootBundle.load('packages/shad/fonts/Geist[wght].ttf')); + final geist = FontLoader('packages/wonky_ui/Geist') + ..addFont(rootBundle.load('packages/wonky_ui/fonts/Geist[wght].ttf')); await geist.load(); } diff --git a/wonky_write/test/features/screen/write_document_screen_a11y_test.dart b/wonky_write/test/features/screen/write_document_screen_a11y_test.dart index a1d0bd80..db7cb3ab 100644 --- a/wonky_write/test/features/screen/write_document_screen_a11y_test.dart +++ b/wonky_write/test/features/screen/write_document_screen_a11y_test.dart @@ -1,4 +1,4 @@ -import 'package:flutter/material.dart' show Material, MaterialType, ThemeMode; +import 'package:flutter/material.dart' show Material, MaterialType; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:provider/provider.dart'; @@ -50,8 +50,8 @@ void main() { theme: WonkyTheme.light(), darkTheme: WonkyTheme.dark(), themeMode: brightness == Brightness.dark - ? ThemeMode.dark - : ThemeMode.light, + ? ShadThemeMode.dark + : ShadThemeMode.light, locale: locale, supportedLocales: const [Locale('en'), pseudoLocale], localizationsDelegates: const [ diff --git a/wonky_write/test/features/theme_editor/theme_editor_screen_test.dart b/wonky_write/test/features/theme_editor/theme_editor_screen_test.dart index e6650209..426874bc 100644 --- a/wonky_write/test/features/theme_editor/theme_editor_screen_test.dart +++ b/wonky_write/test/features/theme_editor/theme_editor_screen_test.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/material.dart' show ThemeMode; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:go_router/go_router.dart'; @@ -73,8 +72,8 @@ void main() { theme: WonkyTheme.light(), darkTheme: WonkyTheme.dark(), themeMode: brightness == Brightness.dark - ? ThemeMode.dark - : ThemeMode.light, + ? ShadThemeMode.dark + : ShadThemeMode.light, routerConfig: h.services.router, localizationsDelegates: const [ WonkyAppLocalizations.delegate, diff --git a/wonky_write/test/features/themes/theme_adapter_test.dart b/wonky_write/test/features/themes/theme_adapter_test.dart index 867e5f06..db0b136c 100644 --- a/wonky_write/test/features/themes/theme_adapter_test.dart +++ b/wonky_write/test/features/themes/theme_adapter_test.dart @@ -45,7 +45,7 @@ void main() { }); test('when Inter is used then the shad-bundled face renders on screen', () { - expect(WriteFonts.screenFamilyFor('Inter'), WriteFonts.shadInter); + expect(WriteFonts.screenFamilyFor('Inter'), WriteFonts.inter); expect(WriteFonts.exportFamilyFor('Inter'), 'Open Sans'); });