Skip to content

Commit 5de6faf

Browse files
authored
Advanced search checkbox for is:wasm-ready (#7709)
1 parent 3052932 commit 5de6faf

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

app/lib/frontend/templates/views/pkg/index.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ d.Node _searchFormContainer({
166166
searchForm: searchForm,
167167
title: 'Show only Flutter plugins.',
168168
),
169+
_tagBasedCheckbox(
170+
tagPrefix: 'is',
171+
tagValue: 'wasm-ready',
172+
label: 'WASM ready',
173+
searchForm: searchForm,
174+
title: 'Show only WASM ready packages.',
175+
),
169176
],
170177
),
171178
],

app/test/frontend/golden/pkg_index_page.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,23 @@ <h3 class="search-form-section-header foldable-button">
400400
</label>
401401
</div>
402402
</div>
403+
<div class="search-form-linked-checkbox" title="Show only WASM ready packages.">
404+
<div class="mdc-form-field">
405+
<div class="mdc-checkbox">
406+
<input id="search-form-checkbox-is-wasm-ready" class="mdc-checkbox__native-control" type="checkbox"/>
407+
<div class="mdc-checkbox__background">
408+
<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
409+
<path class="mdc-checkbox__checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
410+
</svg>
411+
<div class="mdc-checkbox__mixedmark"></div>
412+
</div>
413+
<div class="mdc-checkbox__ripple"></div>
414+
</div>
415+
<label for="search-form-checkbox-is-wasm-ready">
416+
<a href="/packages?q=sdk%3Adart+is%3Awasm-ready" rel="nofollow" data-action="filter-is-wasm-ready" data-tag="is:wasm-ready">WASM ready</a>
417+
</label>
418+
</div>
419+
</div>
403420
</div>
404421
</div>
405422
</div>

app/test/frontend/golden/search_page.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,23 @@ <h3 class="search-form-section-header foldable-button">
401401
</label>
402402
</div>
403403
</div>
404+
<div class="search-form-linked-checkbox" title="Show only WASM ready packages.">
405+
<div class="mdc-form-field">
406+
<div class="mdc-checkbox">
407+
<input id="search-form-checkbox-is-wasm-ready" class="mdc-checkbox__native-control" type="checkbox"/>
408+
<div class="mdc-checkbox__background">
409+
<svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24">
410+
<path class="mdc-checkbox__checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"/>
411+
</svg>
412+
<div class="mdc-checkbox__mixedmark"></div>
413+
</div>
414+
<div class="mdc-checkbox__ripple"></div>
415+
</div>
416+
<label for="search-form-checkbox-is-wasm-ready">
417+
<a href="/packages?q=is%3Awasm-ready+foobar&amp;sort=top" rel="nofollow" data-action="filter-is-wasm-ready" data-tag="is:wasm-ready">WASM ready</a>
418+
</label>
419+
</div>
420+
</div>
404421
</div>
405422
</div>
406423
</div>

pkg/_pub_shared/lib/search/search_form.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ class SearchForm {
398398
parsedQuery.tagsPredicate.hasTag(PackageVersionTags.isNullSafe) ||
399399
parsedQuery.tagsPredicate.hasTag(PackageVersionTags.hasScreenshot) ||
400400
parsedQuery.tagsPredicate.hasTag(PackageVersionTags.isDart3Compatible) ||
401-
parsedQuery.tagsPredicate.hasTag(PackageVersionTags.isPlugin);
401+
parsedQuery.tagsPredicate.hasTag(PackageVersionTags.isPlugin) ||
402+
parsedQuery.tagsPredicate.hasTag(PackageVersionTags.isWasmReady);
402403

403404
/// Whether any of the non-query settings are non-default
404405
/// (e.g. clicking on any platforms, SDKs, or advanced filters).

pkg/_pub_shared/lib/search/tags.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ abstract class PackageVersionTags {
8484
/// Package version is NOT compatible with Dart 3.
8585
static const String isDart3Incompatible = 'is:dart3-incompatible';
8686

87+
/// Package version may be used in WASM compilation.
88+
static const String isWasmReady = 'is:wasm-ready';
89+
8790
/// Version tags that provide a positive, forward-looking property
8891
/// of a prerelease or preview version.
8992
///

0 commit comments

Comments
 (0)