@stapel/search-react 0.4.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +191 -0
- package/README.md +1 -1
- package/dist/default/DegradationNotice.d.ts +7 -0
- package/dist/default/DegradationNotice.d.ts.map +1 -1
- package/dist/default/DegradationNotice.js +17 -6
- package/dist/default/DegradationNotice.js.map +1 -1
- package/dist/default/FacetGroupControl.d.ts +40 -0
- package/dist/default/FacetGroupControl.d.ts.map +1 -0
- package/dist/default/FacetGroupControl.js +176 -0
- package/dist/default/FacetGroupControl.js.map +1 -0
- package/dist/default/FacetPanelPane.d.ts +54 -3
- package/dist/default/FacetPanelPane.d.ts.map +1 -1
- package/dist/default/FacetPanelPane.js +116 -22
- package/dist/default/FacetPanelPane.js.map +1 -1
- package/dist/default/FilterChips.d.ts +28 -0
- package/dist/default/FilterChips.d.ts.map +1 -0
- package/dist/default/FilterChips.js +204 -0
- package/dist/default/FilterChips.js.map +1 -0
- package/dist/default/LanguageSelect.d.ts +9 -0
- package/dist/default/LanguageSelect.d.ts.map +1 -0
- package/dist/default/LanguageSelect.js +72 -0
- package/dist/default/LanguageSelect.js.map +1 -0
- package/dist/default/PageSizeSelect.d.ts +29 -0
- package/dist/default/PageSizeSelect.d.ts.map +1 -0
- package/dist/default/PageSizeSelect.js +25 -0
- package/dist/default/PageSizeSelect.js.map +1 -0
- package/dist/default/RangeFilterRow.d.ts +12 -0
- package/dist/default/RangeFilterRow.d.ts.map +1 -0
- package/dist/default/RangeFilterRow.js +75 -0
- package/dist/default/RangeFilterRow.js.map +1 -0
- package/dist/default/RankingDisclosurePane.d.ts +5 -0
- package/dist/default/RankingDisclosurePane.d.ts.map +1 -1
- package/dist/default/RankingDisclosurePane.js +15 -15
- package/dist/default/RankingDisclosurePane.js.map +1 -1
- package/dist/default/SearchBox.d.ts +13 -0
- package/dist/default/SearchBox.d.ts.map +1 -0
- package/dist/default/SearchBox.js +67 -0
- package/dist/default/SearchBox.js.map +1 -0
- package/dist/default/SearchPage.d.ts +94 -16
- package/dist/default/SearchPage.d.ts.map +1 -1
- package/dist/default/SearchPage.js +191 -8
- package/dist/default/SearchPage.js.map +1 -1
- package/dist/default/SearchResultCard.d.ts +19 -18
- package/dist/default/SearchResultCard.d.ts.map +1 -1
- package/dist/default/SearchResultCard.js +178 -5
- package/dist/default/SearchResultCard.js.map +1 -1
- package/dist/default/SearchResultsPane.d.ts +61 -3
- package/dist/default/SearchResultsPane.d.ts.map +1 -1
- package/dist/default/SearchResultsPane.js +51 -21
- package/dist/default/SearchResultsPane.js.map +1 -1
- package/dist/default/SortSelect.d.ts +10 -2
- package/dist/default/SortSelect.d.ts.map +1 -1
- package/dist/default/SortSelect.js +27 -24
- package/dist/default/SortSelect.js.map +1 -1
- package/dist/default/UrlIssueNotice.d.ts.map +1 -1
- package/dist/default/UrlIssueNotice.js +19 -1
- package/dist/default/UrlIssueNotice.js.map +1 -1
- package/dist/default/ViewSwitch.d.ts +66 -0
- package/dist/default/ViewSwitch.d.ts.map +1 -0
- package/dist/default/ViewSwitch.js +49 -0
- package/dist/default/ViewSwitch.js.map +1 -0
- package/dist/default/index.d.ts +38 -15
- package/dist/default/index.d.ts.map +1 -1
- package/dist/default/index.js +29 -12
- package/dist/default/index.js.map +1 -1
- package/dist/default/sortLabels.d.ts +5 -0
- package/dist/default/sortLabels.d.ts.map +1 -0
- package/dist/default/sortLabels.js +32 -0
- package/dist/default/sortLabels.js.map +1 -0
- package/dist/headless/FacetPanel.d.ts +17 -0
- package/dist/headless/FacetPanel.d.ts.map +1 -1
- package/dist/headless/FacetPanel.js +23 -2
- package/dist/headless/FacetPanel.js.map +1 -1
- package/dist/headless/useAppliedCount.d.ts +8 -0
- package/dist/headless/useAppliedCount.d.ts.map +1 -0
- package/dist/headless/useAppliedCount.js +30 -0
- package/dist/headless/useAppliedCount.js.map +1 -0
- package/dist/headless/useScorerNames.d.ts +4 -0
- package/dist/headless/useScorerNames.d.ts.map +1 -0
- package/dist/headless/useScorerNames.js +34 -0
- package/dist/headless/useScorerNames.js.map +1 -0
- package/dist/headless/useSearchBox.d.ts +44 -0
- package/dist/headless/useSearchBox.d.ts.map +1 -0
- package/dist/headless/useSearchBox.js +116 -0
- package/dist/headless/useSearchBox.js.map +1 -0
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +38 -4
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/keys.d.ts +55 -0
- package/dist/i18n/keys.d.ts.map +1 -1
- package/dist/i18n/keys.js +101 -4
- package/dist/i18n/keys.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +42 -4
- package/dist/i18n/ru.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/model/queries.d.ts +26 -2
- package/dist/model/queries.d.ts.map +1 -1
- package/dist/model/queries.js +38 -1
- package/dist/model/queries.js.map +1 -1
- package/dist/state/limits.d.ts +44 -0
- package/dist/state/limits.d.ts.map +1 -0
- package/dist/state/limits.js +44 -0
- package/dist/state/limits.js.map +1 -0
- package/dist/state/ranges.d.ts +52 -0
- package/dist/state/ranges.d.ts.map +1 -0
- package/dist/state/ranges.js +108 -0
- package/dist/state/ranges.js.map +1 -0
- package/llms.txt +16 -4
- package/manifest.json +268 -22
- package/nav-manifest.json +1 -1
- package/package.json +15 -10
- package/src/analytics/generated/events.json +1 -1
- package/src/default/DegradationNotice.tsx +34 -12
- package/src/default/FacetGroupControl.tsx +312 -0
- package/src/default/FacetPanelPane.tsx +320 -87
- package/src/default/FilterChips.tsx +415 -0
- package/src/default/LanguageSelect.tsx +93 -0
- package/src/default/PageSizeSelect.tsx +80 -0
- package/src/default/RangeFilterRow.tsx +148 -0
- package/src/default/RankingDisclosurePane.tsx +67 -35
- package/src/default/SearchBox.tsx +130 -0
- package/src/default/SearchPage.tsx +454 -44
- package/src/default/SearchResultCard.tsx +231 -24
- package/src/default/SearchResultsPane.tsx +158 -71
- package/src/default/SortSelect.tsx +50 -37
- package/src/default/UrlIssueNotice.tsx +21 -3
- package/src/default/ViewSwitch.tsx +147 -0
- package/src/default/index.ts +55 -15
- package/src/default/sortLabels.ts +34 -0
- package/src/headless/FacetPanel.tsx +30 -2
- package/src/headless/useAppliedCount.ts +41 -0
- package/src/headless/useScorerNames.ts +36 -0
- package/src/headless/useSearchBox.ts +189 -0
- package/src/i18n/es.ts +46 -4
- package/src/i18n/keys.ts +114 -4
- package/src/i18n/ru.ts +50 -4
- package/src/index.ts +22 -2
- package/src/model/queries.ts +51 -1
- package/src/state/limits.ts +50 -0
- package/src/state/ranges.ts +144 -0
- package/dist/default/ErrorAlert.d.ts +0 -9
- package/dist/default/ErrorAlert.d.ts.map +0 -1
- package/dist/default/ErrorAlert.js +0 -27
- package/dist/default/ErrorAlert.js.map +0 -1
- package/dist/default/theme.d.ts +0 -24
- package/dist/default/theme.d.ts.map +0 -1
- package/dist/default/theme.js +0 -39
- package/dist/default/theme.js.map +0 -1
- package/src/default/ErrorAlert.tsx +0 -46
- package/src/default/theme.tsx +0 -66
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The i18n key for a shipped sort, or `undefined` for a deployment's own. */
|
|
2
|
+
export declare function sortLabelKey(sort: string): string | undefined;
|
|
3
|
+
/** The sort's name for a reader, falling back to the slug. */
|
|
4
|
+
export declare function sortLabel(t: (key: string) => string, sort: string): string;
|
|
5
|
+
//# sourceMappingURL=sortLabels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortLabels.d.ts","sourceRoot":"","sources":["../../src/default/sortLabels.ts"],"names":[],"mappings":"AAwBA,8EAA8E;AAC9E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D;AAED,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sort SLUG as the skin names it, in one place.
|
|
3
|
+
*
|
|
4
|
+
* `relevance`, `price_asc`, `distance` are wire values: the URL carries them,
|
|
5
|
+
* the envelope reports them, and the ranking disclosure lists them per scorer.
|
|
6
|
+
* The sort SELECT translated them and the disclosure did not, so the same page
|
|
7
|
+
* offered "Most relevant" in the control and stamped "Applies to: relevance"
|
|
8
|
+
* under every parameter — the registry's word, in a statutory text, next to
|
|
9
|
+
* the human word for the same thing.
|
|
10
|
+
*
|
|
11
|
+
* A slug the pair does not ship is returned as it is. Deployments register
|
|
12
|
+
* their own scorers and sorts, and an unknown one is a real value that belongs
|
|
13
|
+
* on screen; only an invented label would be worse.
|
|
14
|
+
*/
|
|
15
|
+
import { SEARCH_I18N_KEYS } from "../i18n/keys.js";
|
|
16
|
+
const SORT_LABEL_KEY = {
|
|
17
|
+
relevance: SEARCH_I18N_KEYS.sortRelevance,
|
|
18
|
+
newest: SEARCH_I18N_KEYS.sortNewest,
|
|
19
|
+
price_asc: SEARCH_I18N_KEYS.sortPriceAsc,
|
|
20
|
+
price_desc: SEARCH_I18N_KEYS.sortPriceDesc,
|
|
21
|
+
distance: SEARCH_I18N_KEYS.sortDistance,
|
|
22
|
+
};
|
|
23
|
+
/** The i18n key for a shipped sort, or `undefined` for a deployment's own. */
|
|
24
|
+
export function sortLabelKey(sort) {
|
|
25
|
+
return SORT_LABEL_KEY[sort];
|
|
26
|
+
}
|
|
27
|
+
/** The sort's name for a reader, falling back to the slug. */
|
|
28
|
+
export function sortLabel(t, sort) {
|
|
29
|
+
const key = SORT_LABEL_KEY[sort];
|
|
30
|
+
return key === undefined ? sort : t(key);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=sortLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sortLabels.js","sourceRoot":"","sources":["../../src/default/sortLabels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,cAAc,GAAqC;IACvD,SAAS,EAAE,gBAAgB,CAAC,aAAa;IACzC,MAAM,EAAE,gBAAgB,CAAC,UAAU;IACnC,SAAS,EAAE,gBAAgB,CAAC,YAAY;IACxC,UAAU,EAAE,gBAAgB,CAAC,aAAa;IAC1C,QAAQ,EAAE,gBAAgB,CAAC,YAAY;CACxC,CAAC;AAEF,8EAA8E;AAC9E,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,SAAS,CAAC,CAA0B,EAAE,IAAY;IAChE,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -58,4 +58,21 @@ export declare function FacetPanel(props: {
|
|
|
58
58
|
enabled?: boolean;
|
|
59
59
|
children: (bag: FacetPanelBag) => ReactNode;
|
|
60
60
|
}): ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* The same bag, as a hook — for a caller that has to know what the panel WILL
|
|
63
|
+
* render before it renders it.
|
|
64
|
+
*
|
|
65
|
+
* The one real caller is `<SearchPage>`: a facet column is a quarter of a
|
|
66
|
+
* catalogue page, and on a deployment whose plan has no facets at all it was
|
|
67
|
+
* a quarter of every results page spent on an empty-state illustration
|
|
68
|
+
* repeating "no filters for this search". Whether to lay out that column is a
|
|
69
|
+
* LAYOUT decision, and layout is decided by the component that owns the grid
|
|
70
|
+
* — which therefore has to be able to ask. A render prop cannot answer a
|
|
71
|
+
* question asked one level up.
|
|
72
|
+
*/
|
|
73
|
+
export declare function useFacetPanel(props?: {
|
|
74
|
+
categoryFeatures?: readonly FeatureDef[];
|
|
75
|
+
locale?: string;
|
|
76
|
+
enabled?: boolean;
|
|
77
|
+
}): FacetPanelBag;
|
|
61
78
|
//# sourceMappingURL=FacetPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacetPanel.d.ts","sourceRoot":"","sources":["../../src/headless/FacetPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,oDAAoD;AACpD,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;IACjD;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,+BAA+B;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC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EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,IAAI,IAAI,CAAC;CAClB;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAChC,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,SAAS,CAAC;CAC7C,GAAG,SAAS,CAUZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE;IACnC,gBAAgB,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GAAG,aAAa,CAuCrB"}
|
|
@@ -24,6 +24,27 @@ const EMPTY_META = {
|
|
|
24
24
|
* blanks.
|
|
25
25
|
*/
|
|
26
26
|
export function FacetPanel(props) {
|
|
27
|
+
return props.children(useFacetPanel({
|
|
28
|
+
...(props.categoryFeatures !== undefined
|
|
29
|
+
? { categoryFeatures: props.categoryFeatures }
|
|
30
|
+
: {}),
|
|
31
|
+
...(props.locale !== undefined ? { locale: props.locale } : {}),
|
|
32
|
+
...(props.enabled !== undefined ? { enabled: props.enabled } : {}),
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The same bag, as a hook — for a caller that has to know what the panel WILL
|
|
37
|
+
* render before it renders it.
|
|
38
|
+
*
|
|
39
|
+
* The one real caller is `<SearchPage>`: a facet column is a quarter of a
|
|
40
|
+
* catalogue page, and on a deployment whose plan has no facets at all it was
|
|
41
|
+
* a quarter of every results page spent on an empty-state illustration
|
|
42
|
+
* repeating "no filters for this search". Whether to lay out that column is a
|
|
43
|
+
* LAYOUT decision, and layout is decided by the component that owns the grid
|
|
44
|
+
* — which therefore has to be able to ask. A render prop cannot answer a
|
|
45
|
+
* question asked one level up.
|
|
46
|
+
*/
|
|
47
|
+
export function useFacetPanel(props = {}) {
|
|
27
48
|
const { state: searchState, setFilter, setRange, clearAll, toggleFilter, activeFilters } = useSearchState();
|
|
28
49
|
const t = useT();
|
|
29
50
|
const query = useSearchQuery(searchState, props.enabled !== undefined ? { enabled: props.enabled } : undefined);
|
|
@@ -39,7 +60,7 @@ export function FacetPanel(props) {
|
|
|
39
60
|
t,
|
|
40
61
|
...(props.locale !== undefined ? { locale: props.locale } : {}),
|
|
41
62
|
}));
|
|
42
|
-
return
|
|
63
|
+
return {
|
|
43
64
|
state: groups,
|
|
44
65
|
approximate: meta.approximate,
|
|
45
66
|
skipped: meta.skipped,
|
|
@@ -52,6 +73,6 @@ export function FacetPanel(props) {
|
|
|
52
73
|
setFilter(slug, []);
|
|
53
74
|
},
|
|
54
75
|
clearAll,
|
|
55
|
-
}
|
|
76
|
+
};
|
|
56
77
|
}
|
|
57
78
|
//# sourceMappingURL=FacetPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FacetPanel.js","sourceRoot":"","sources":["../../src/headless/FacetPanel.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIjE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAoC1D,MAAM,UAAU,GAAc;IAC5B,WAAW,EAAE,KAAK;IAClB,UAAU,EAA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,0 +1,8 @@
|
|
|
1
|
+
import type { SearchCountKind } from "../state/degradations.js";
|
|
2
|
+
export interface AppliedCount {
|
|
3
|
+
/** `null` when the engine cannot say — never rendered as `0`. */
|
|
4
|
+
readonly count: number | null;
|
|
5
|
+
readonly kind: SearchCountKind;
|
|
6
|
+
}
|
|
7
|
+
export declare function useAppliedCount(): AppliedCount;
|
|
8
|
+
//# sourceMappingURL=useAppliedCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppliedCount.d.ts","sourceRoot":"","sources":["../../src/headless/useAppliedCount.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,WAAW,YAAY;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;CAChC;AAED,wBAAgB,eAAe,IAAI,YAAY,CAc9C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many results the page currently in cache holds, and whether that number
|
|
3
|
+
* may be spoken as a number.
|
|
4
|
+
*
|
|
5
|
+
* The same trick as {@link useAppliedSort}: `enabled: false` on the key
|
|
6
|
+
* `<SearchResults>` populates, so a control that wants to SAY the count
|
|
7
|
+
* subscribes to the answer already on screen instead of issuing a second
|
|
8
|
+
* search of its own. A filter sheet whose button reads "Show 25 results" is
|
|
9
|
+
* the difference between committing to a change and guessing at one, and it
|
|
10
|
+
* must not cost a request to know that.
|
|
11
|
+
*
|
|
12
|
+
* Not exported from the package entry: it is the shape `<SearchPage>` needs to
|
|
13
|
+
* label one button, and a public hook would be a second, thinner way to ask
|
|
14
|
+
* what `<SearchResults>` already answers in full.
|
|
15
|
+
*/
|
|
16
|
+
import { useSearchQuery } from "../model/queries.js";
|
|
17
|
+
import { countKind, parseDegradations } from "../state/degradations.js";
|
|
18
|
+
import { useSearchState } from "./SearchStateProvider.js";
|
|
19
|
+
export function useAppliedCount() {
|
|
20
|
+
const { state } = useSearchState();
|
|
21
|
+
const query = useSearchQuery(state, { enabled: false });
|
|
22
|
+
const data = query.data;
|
|
23
|
+
if (data === undefined)
|
|
24
|
+
return { count: null, kind: "unknown" };
|
|
25
|
+
return {
|
|
26
|
+
count: data.count,
|
|
27
|
+
kind: countKind(data.count, data.count_is_lower_bound, data.exact_total, parseDegradations(data.degraded)),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=useAppliedCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAppliedCount.js","sourceRoot":"","sources":["../../src/headless/useAppliedCount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAChE,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,SAAS,CACb,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,oBAAoB,EACzB,IAAI,CAAC,WAAW,EAChB,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CACjC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScorerNames.d.ts","sourceRoot":"","sources":["../../src/headless/useScorerNames.ts"],"names":[],"mappings":"AAqBA,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;AAEpE,wBAAgB,cAAc,IAAI,gBAAgB,CAWjD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scorer SLUGS turned into the names the disclosure already gives them.
|
|
3
|
+
*
|
|
4
|
+
* `degraded[]` reports a scorer the engine could not evaluate as
|
|
5
|
+
* `"scorer:geo_decay"` — a registry identifier, because that is the only
|
|
6
|
+
* handle the query envelope has. Printed straight into a sentence it reads
|
|
7
|
+
* "The ranking parameter “geo_decay” was not applied", which is a developer's
|
|
8
|
+
* word in a shopper's banner (class C-DEVCOPY).
|
|
9
|
+
*
|
|
10
|
+
* The name is not this pair's to invent: the backend already publishes one per
|
|
11
|
+
* scorer on `GET /ranking` (`description_key`, a translation key). So the
|
|
12
|
+
* lookup goes there — through the SAME cache entry `<RankingDisclosure>`
|
|
13
|
+
* fills, with `enabled: false`, so a result page never issues a second request
|
|
14
|
+
* for a label. When the disclosure has not been read the map is empty and the
|
|
15
|
+
* banner falls back to the slug, which is what it said before and is at least
|
|
16
|
+
* traceable.
|
|
17
|
+
*/
|
|
18
|
+
import { useT } from "@stapel/core";
|
|
19
|
+
import { useRankingDisclosure } from "../model/queries.js";
|
|
20
|
+
import { useSearchState } from "./SearchStateProvider.js";
|
|
21
|
+
export function useScorerNames() {
|
|
22
|
+
const t = useT();
|
|
23
|
+
const { state } = useSearchState();
|
|
24
|
+
const query = useRankingDisclosure(state.type, { enabled: false });
|
|
25
|
+
const scorers = query.data?.scorers;
|
|
26
|
+
return (slug) => {
|
|
27
|
+
const scorer = scorers?.find((candidate) => candidate.slug === slug);
|
|
28
|
+
if (scorer === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
const named = t(scorer.description_key);
|
|
31
|
+
return named.length > 0 && named !== scorer.description_key ? named : undefined;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=useScorerNames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScorerNames.js","sourceRoot":"","sources":["../../src/headless/useScorerNames.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK1D,MAAM,UAAU,cAAc;IAC5B,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC;IACjB,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC;IACpC,OAAO,CAAC,IAAY,EAAE,EAAE;QACtB,MAAM,MAAM,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QACrE,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;QAC3C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QACxC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,KAAK,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { LoadState } from "@stapel/core";
|
|
2
|
+
/** What a query box needs to read and move the search text. */
|
|
3
|
+
export interface SearchBoxBag {
|
|
4
|
+
/** What is in the input right now. */
|
|
5
|
+
readonly draft: string;
|
|
6
|
+
/** What the URL — and therefore the results — is about. */
|
|
7
|
+
readonly committed: string;
|
|
8
|
+
/** The draft has not reached the URL yet (a search is about to run). */
|
|
9
|
+
readonly pending: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Title prefixes for the typeahead — the READY answer only.
|
|
12
|
+
*
|
|
13
|
+
* A typeahead has no surface for "we could not fetch suggestions": the box
|
|
14
|
+
* must stay typeable and a person is mid-word. So a failed or in-flight
|
|
15
|
+
* suggest shows nothing, and the three answers stay distinguishable in
|
|
16
|
+
* {@link SearchBoxBag.suggestState} for a skin that wants to say more.
|
|
17
|
+
*/
|
|
18
|
+
readonly suggestions: readonly string[];
|
|
19
|
+
/** The suggest read as a state, unflattened. */
|
|
20
|
+
readonly suggestState: LoadState<readonly string[]>;
|
|
21
|
+
/** A suggestion request is in flight for a prefix nothing is shown for yet. */
|
|
22
|
+
readonly suggestLoading: boolean;
|
|
23
|
+
/** Characters a prefix needs before the index is asked. */
|
|
24
|
+
readonly minSuggestChars: number;
|
|
25
|
+
readonly maxLength: number;
|
|
26
|
+
/** Type. Commits after {@link SEARCH_BOX_DEBOUNCE_MS} of quiet. */
|
|
27
|
+
setDraft(next: string): void;
|
|
28
|
+
/** Commit now — Enter, the Search button, or picking a suggestion. */
|
|
29
|
+
submit(value?: string): void;
|
|
30
|
+
/** Empty the box AND the search (an empty `q` is a valid browse). */
|
|
31
|
+
clear(): void;
|
|
32
|
+
}
|
|
33
|
+
export interface UseSearchBoxOptions {
|
|
34
|
+
readonly debounceMs?: number;
|
|
35
|
+
/** Ask the index for prefixes. Default `true`. */
|
|
36
|
+
readonly suggest?: boolean;
|
|
37
|
+
/** Quiet time before the index is asked (default
|
|
38
|
+
* {@link SEARCH_BOX_SUGGEST_DEBOUNCE_MS}). */
|
|
39
|
+
readonly suggestDebounceMs?: number;
|
|
40
|
+
/** How many suggestions to ask for (backend clamps to 25). Default 8. */
|
|
41
|
+
readonly suggestLimit?: number;
|
|
42
|
+
}
|
|
43
|
+
export declare function useSearchBox(options?: UseSearchBoxOptions): SearchBoxBag;
|
|
44
|
+
//# sourceMappingURL=useSearchBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchBox.d.ts","sourceRoot":"","sources":["../../src/headless/useSearchBox.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAU9C,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,gDAAgD;IAChD,QAAQ,CAAC,YAAY,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IACpD,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,2DAA2D;IAC3D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qEAAqE;IACrE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,kDAAkD;IAClD,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;kDAC8C;IAC9C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAKD,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CAyG5E"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The query box, headless — the state machine behind `<SearchBox>`.
|
|
3
|
+
*
|
|
4
|
+
* ── The one legitimate second copy of the state ────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* This pair's rule is that the URL is the state and no component keeps a copy.
|
|
7
|
+
* A text input is the single exception the rule has to make: what a person has
|
|
8
|
+
* TYPED is not yet what they have SEARCHED for, and committing every keystroke
|
|
9
|
+
* to the URL would make the address bar (and the request, and the query cache)
|
|
10
|
+
* chase the keyboard. So the draft lives here, for as long as it takes to stop
|
|
11
|
+
* typing, and the URL is still the only place a SEARCH is recorded.
|
|
12
|
+
*
|
|
13
|
+
* Two properties keep that honest:
|
|
14
|
+
*
|
|
15
|
+
* 1. **The URL wins whenever it moves on its own.** Back, a shared link
|
|
16
|
+
* opening, a host calling `setText` elsewhere — the draft is reset to the
|
|
17
|
+
* committed `q`. The box can never show a word the results are not about.
|
|
18
|
+
* 2. **Committing REPLACES the history entry** (`setText` already does), so a
|
|
19
|
+
* ten-letter word is one entry and Back still removes the last FILTER
|
|
20
|
+
* rather than the last letter.
|
|
21
|
+
*
|
|
22
|
+
* The suggestion list is asked for the DEBOUNCED prefix, not the draft — one
|
|
23
|
+
* request per pause, not per keystroke, on an endpoint the backend throttles.
|
|
24
|
+
*/
|
|
25
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
26
|
+
import { loadStateFromQuery, mapLoad } from "@stapel/core";
|
|
27
|
+
import { useSearchState } from "./SearchStateProvider.js";
|
|
28
|
+
import { useSuggest } from "../model/queries.js";
|
|
29
|
+
import { SEARCH_BOX_DEBOUNCE_MS, SEARCH_BOX_SUGGEST_DEBOUNCE_MS, SEARCH_QUERY_MAX_CHARS, SUGGEST_MIN_CHARS, } from "../state/limits.js";
|
|
30
|
+
/** One frozen empty list, so a render with no suggestions is a stable value. */
|
|
31
|
+
const NO_SUGGESTIONS = [];
|
|
32
|
+
export function useSearchBox(options = {}) {
|
|
33
|
+
const { state, setText } = useSearchState();
|
|
34
|
+
const committed = state.q;
|
|
35
|
+
const debounceMs = options.debounceMs ?? SEARCH_BOX_DEBOUNCE_MS;
|
|
36
|
+
const [draft, setDraftState] = useState(committed);
|
|
37
|
+
// What the URL said the last time we looked. When it changes underneath us
|
|
38
|
+
// — Back, a shared link, a host control — the draft follows it; when it
|
|
39
|
+
// changes BECAUSE we committed, `draft === committed` already and the reset
|
|
40
|
+
// is a no-op.
|
|
41
|
+
const lastCommitted = useRef(committed);
|
|
42
|
+
const timer = useRef(null);
|
|
43
|
+
if (lastCommitted.current !== committed) {
|
|
44
|
+
lastCommitted.current = committed;
|
|
45
|
+
if (draft !== committed)
|
|
46
|
+
setDraftState(committed);
|
|
47
|
+
}
|
|
48
|
+
const cancel = useCallback(() => {
|
|
49
|
+
if (timer.current !== null) {
|
|
50
|
+
clearTimeout(timer.current);
|
|
51
|
+
timer.current = null;
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
// A pending commit must not fire into an unmounted tree, and a box that is
|
|
55
|
+
// unmounted mid-word has not searched for that word.
|
|
56
|
+
useEffect(() => cancel, [cancel]);
|
|
57
|
+
const commit = useCallback((value) => {
|
|
58
|
+
cancel();
|
|
59
|
+
if (value !== committed)
|
|
60
|
+
setText(value);
|
|
61
|
+
}, [cancel, committed, setText]);
|
|
62
|
+
const setDraft = useCallback((next) => {
|
|
63
|
+
const clipped = next.slice(0, SEARCH_QUERY_MAX_CHARS);
|
|
64
|
+
setDraftState(clipped);
|
|
65
|
+
cancel();
|
|
66
|
+
timer.current = setTimeout(() => {
|
|
67
|
+
timer.current = null;
|
|
68
|
+
if (clipped !== committed)
|
|
69
|
+
setText(clipped);
|
|
70
|
+
}, debounceMs);
|
|
71
|
+
}, [cancel, committed, debounceMs, setText]);
|
|
72
|
+
const submit = useCallback((value) => {
|
|
73
|
+
const next = (value ?? draft).slice(0, SEARCH_QUERY_MAX_CHARS);
|
|
74
|
+
setDraftState(next);
|
|
75
|
+
commit(next);
|
|
76
|
+
}, [commit, draft]);
|
|
77
|
+
const clear = useCallback(() => {
|
|
78
|
+
setDraftState("");
|
|
79
|
+
commit("");
|
|
80
|
+
}, [commit]);
|
|
81
|
+
// The index is asked about the SETTLED prefix, never the keystroke: one
|
|
82
|
+
// request per pause on an endpoint the backend throttles. `useSuggest` then
|
|
83
|
+
// refuses anything below `SUGGEST_MIN_CHARS` and keys the rest by prefix, so
|
|
84
|
+
// backspacing to a prefix already asked about costs nothing.
|
|
85
|
+
const suggestDebounceMs = options.suggestDebounceMs ?? SEARCH_BOX_SUGGEST_DEBOUNCE_MS;
|
|
86
|
+
const [suggestPrefix, setSuggestPrefix] = useState(committed);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
const handle = setTimeout(() => {
|
|
89
|
+
setSuggestPrefix(draft);
|
|
90
|
+
}, suggestDebounceMs);
|
|
91
|
+
return () => {
|
|
92
|
+
clearTimeout(handle);
|
|
93
|
+
};
|
|
94
|
+
}, [draft, suggestDebounceMs]);
|
|
95
|
+
const suggest = useSuggest({
|
|
96
|
+
type: state.type,
|
|
97
|
+
q: suggestPrefix,
|
|
98
|
+
...(options.suggestLimit !== undefined ? { limit: options.suggestLimit } : {}),
|
|
99
|
+
enabled: options.suggest !== false,
|
|
100
|
+
});
|
|
101
|
+
const suggestState = mapLoad(loadStateFromQuery(suggest), (data) => data.items);
|
|
102
|
+
return {
|
|
103
|
+
draft,
|
|
104
|
+
committed,
|
|
105
|
+
pending: draft !== committed,
|
|
106
|
+
suggestions: suggestState.status === "ready" ? suggestState.data : NO_SUGGESTIONS,
|
|
107
|
+
suggestState,
|
|
108
|
+
suggestLoading: suggest.isLoading && suggest.fetchStatus === "fetching",
|
|
109
|
+
minSuggestChars: SUGGEST_MIN_CHARS,
|
|
110
|
+
maxLength: SEARCH_QUERY_MAX_CHARS,
|
|
111
|
+
setDraft,
|
|
112
|
+
submit,
|
|
113
|
+
clear,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=useSearchBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchBox.js","sourceRoot":"","sources":["../../src/headless/useSearchBox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AA8C5B,gFAAgF;AAChF,MAAM,cAAc,GAAsB,EAAE,CAAC;AAE7C,MAAM,UAAU,YAAY,CAAC,UAA+B,EAAE;IAC5D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC;IAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC;IAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,sBAAsB,CAAC;IAEhE,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACnD,2EAA2E;IAC3E,wEAAwE;IACxE,4EAA4E;IAC5E,cAAc;IACd,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG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C,EAAE,CAAC;QAC9E,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,KAAK;KACnC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,OAAO,CAC1B,kBAAkB,CAAC,OAAO,CAAC,EAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAA0B,CAC1C,CAAC;IAEF,OAAO;QACL,KAAK;QACL,SAAS;QACT,OAAO,EAAE,KAAK,KAAK,SAAS;QAC5B,WAAW,EAAE,YAAY,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;QACjF,YAAY;QACZ,cAAc,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,WAAW,KAAK,UAAU;QACvE,eAAe,EAAE,iBAAiB;QAClC,SAAS,EAAE,sBAAsB;QACjC,QAAQ;QACR,MAAM;QACN,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/i18n/es.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,cA0IhC,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAE7D"}
|
package/dist/i18n/es.js
CHANGED
|
@@ -32,6 +32,12 @@ export const searchI18nBundleEs = {
|
|
|
32
32
|
"search.results.distance_km": "a {km} km",
|
|
33
33
|
"search.results.untitled": "Sin título",
|
|
34
34
|
"search.results.open": "Abrir",
|
|
35
|
+
"search.results.image_alt": "Foto de {title}",
|
|
36
|
+
"search.box.label": "Buscar",
|
|
37
|
+
"search.box.placeholder": "¿Qué estás buscando?",
|
|
38
|
+
"search.box.submit": "Buscar",
|
|
39
|
+
"search.box.clear": "Borrar la búsqueda",
|
|
40
|
+
"search.box.suggestions": "Sugerencias",
|
|
35
41
|
"search.sort.label": "Orden",
|
|
36
42
|
"search.sort.relevance": "Más relevantes",
|
|
37
43
|
"search.sort.newest": "Más recientes",
|
|
@@ -39,6 +45,9 @@ export const searchI18nBundleEs = {
|
|
|
39
45
|
"search.sort.price_desc": "Precio: de mayor a menor",
|
|
40
46
|
"search.sort.distance": "Más cercanos",
|
|
41
47
|
"search.sort.server_chose": "Ordenado por {sort}",
|
|
48
|
+
"search.view.label": "Vista",
|
|
49
|
+
"search.view.list": "Lista",
|
|
50
|
+
"search.view.grid": "Cuadrícula",
|
|
42
51
|
"search.facets.title": "Filtros",
|
|
43
52
|
"search.facets.loading": "Cargando filtros…",
|
|
44
53
|
"search.facets.load_failed": "No pudimos cargar los filtros.",
|
|
@@ -52,16 +61,41 @@ export const searchI18nBundleEs = {
|
|
|
52
61
|
"search.facets.range_from": "Desde",
|
|
53
62
|
"search.facets.range_to": "Hasta",
|
|
54
63
|
"search.facets.range_apply": "Aplicar",
|
|
64
|
+
"search.facets.range_clear": "Quitar",
|
|
65
|
+
"search.facets.range_from_aria": "{feature}, desde",
|
|
66
|
+
"search.facets.range_to_aria": "{feature}, hasta",
|
|
67
|
+
"search.facets.show_all": "Ver todos ({count})",
|
|
68
|
+
"search.facets.show_less": "Ver menos",
|
|
69
|
+
"search.facets.range_invalid": "«Desde» es mayor que «hasta», así que nada podría coincidir. Intercámbialos para aplicar el rango.",
|
|
70
|
+
"search.filters.open": "Filtros ({count})",
|
|
71
|
+
"search.filters.apply": "Ver resultados",
|
|
72
|
+
"search.filters.show_count.one": "Ver {count} resultado",
|
|
73
|
+
"search.filters.show_count.other": "Ver {count} resultados",
|
|
74
|
+
"search.filters.show_count_at_least.one": "Ver {count}+ resultado",
|
|
75
|
+
"search.filters.show_count_at_least.other": "Ver {count}+ resultados",
|
|
76
|
+
"search.filters.dismiss": "Cerrar los filtros",
|
|
77
|
+
"search.filters.chips_label": "Filtros",
|
|
78
|
+
"search.filters.all": "Todos los filtros",
|
|
79
|
+
"search.filters.chip_more": ", +{count}",
|
|
80
|
+
"search.category.title": "Categoría",
|
|
81
|
+
"search.category.clear": "Buscar en todo el catálogo",
|
|
82
|
+
"search.category.current": "Buscando dentro de {path}",
|
|
83
|
+
"search.language.label": "Idioma de la consulta",
|
|
84
|
+
"search.language.any": "Cualquier idioma",
|
|
85
|
+
"search.limit.label": "Por página",
|
|
86
|
+
"search.limit.option": "{count} por página",
|
|
87
|
+
"search.limit.from_link": "Este enlace fija su propio tamaño de página.",
|
|
55
88
|
"search.geo.title": "Ubicación",
|
|
56
89
|
"search.geo.radius_km": "A menos de {km} km",
|
|
90
|
+
"search.geo.radius_label": "Radio, km",
|
|
57
91
|
"search.geo.clear": "En cualquier lugar",
|
|
58
92
|
"search.geo.box": "Dentro del área mostrada",
|
|
59
93
|
"search.geo.center": "Cerca de {lat}, {lon}",
|
|
60
94
|
"search.url.issues_title": "Parte de este enlace no se pudo leer",
|
|
61
|
-
"search.url.issue.not_a_number": "{param} no es un número
|
|
62
|
-
"search.url.issue.geo_incomplete": "la ubicación
|
|
63
|
-
"search.url.issue.bbox_malformed": "el área
|
|
64
|
-
"search.url.issue.range_malformed": "{param}
|
|
95
|
+
"search.url.issue.not_a_number": "«{param}» en este enlace no es un número, así que se ignoró",
|
|
96
|
+
"search.url.issue.geo_incomplete": "la ubicación de este enlace está incompleta, así que se ignoró",
|
|
97
|
+
"search.url.issue.bbox_malformed": "el área del mapa de este enlace está incompleta, así que se ignoró",
|
|
98
|
+
"search.url.issue.range_malformed": "al rango «{param}» de este enlace le faltan números, así que se ignoró",
|
|
65
99
|
"search.degraded.title": "Lo que esta búsqueda no pudo hacer",
|
|
66
100
|
"search.degraded.typo_tolerance": "No se corrigieron erratas: el motor de búsqueda configurado no puede hacerlo.",
|
|
67
101
|
"search.degraded.phrase_synonyms": "No se ampliaron sinónimos: el motor de búsqueda configurado no puede hacerlo.",
|
package/dist/i18n/es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.js","sourceRoot":"","sources":["../../src/i18n/es.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,GAAG,mBAAmB;IAEtB,sBAAsB,EAAE,4BAA4B;IAEpD,sBAAsB,EAAE,YAAY;IACpC,wBAAwB,EAAE,WAAW;IACrC,4BAA4B,EAAE,oCAAoC;IAClE,sBAAsB,EAAE,6CAA6C;IACrE,sBAAsB,EAAE,YAAY;IACpC,sCAAsC,EAAE,mCAAmC;IAC3E,wCAAwC,EAAE,yBAAyB;IACnE,mCAAmC,EAAE,oBAAoB;IACzD,qCAAqC,EAAE,qBAAqB;IAC5D,gCAAgC,EAAE,mBAAmB;IACrD,kCAAkC,EAAE,oBAAoB;IACxD,wBAAwB,EAAE,SAAS;IACnC,qBAAqB,EAAE,kBAAkB;IACzC,qBAAqB,EAAE,iBAAiB;IACxC,+BAA+B,EAAE,0BAA0B;IAC3D,iCAAiC,EAAE,2BAA2B;IAC9D,gCAAgC,EAC9B,iHAAiH;IACnH,yBAAyB,EAAE,cAAc;IACzC,8BAA8B,EAC5B,yGAAyG;IAC3G,4BAA4B,EAAE,WAAW;IACzC,yBAA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,8CAA8C;IAExE,kBAAkB,EAAE,WAAW;IAC/B,sBAAsB,EAAE,oBAAoB;IAC5C,yBAAyB,EAAE,WAAW;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,gBAAgB,EAAE,0BAA0B;IAC5C,mBAAmB,EAAE,uBAAuB;IAE5C,yBAAyB,EAAE,sCAAsC;IACjE,+BAA+B,EAC7B,6DAA6D;IAC/D,iCAAiC,EAC/B,gEAAgE;IAClE,iCAAiC,EAC/B,oEAAoE;IACtE,kCAAkC,EAChC,wEAAwE;IAE1E,uBAAuB,EAAE,oCAAoC;IAC7D,gCAAgC,EAC9B,+EAA+E;IACjF,iCAAiC,EAC/B,+EAA+E;IACjF,6BAA6B,EAAE,4CAA4C;IAC3E,oCAAoC,EAAE,2CAA2C;IACjF,iCAAiC,EAC/B,0FAA0F;IAC5F,wBAAwB,EACtB,2FAA2F;IAC7F,yBAAyB,EACvB,qFAAqF;IAEvF,sBAAsB,EAAE,kCAAkC;IAC1D,sBAAsB,EACpB,2FAA2F;IAC7F,wBAAwB,EAAE,qCAAqC;IAC/D,4BAA4B,EAAE,8CAA8C;IAC5E,sBAAsB,EAAE,oDAAoD;IAC5E,0BAA0B,EAAE,WAAW;IACvC,uBAAuB,EAAE,MAAM;IAC/B,2BAA2B,EAAE,aAAa;IAC1C,yBAAyB,EAAE,uBAAuB;IAClD,sBAAsB,EAAE,OAAO;IAC/B,qBAAqB,EAAE,kCAAkC;CAC1D,CAAC;AAEF,+DAA+D;AAC/D,MAAM,UAAU,oBAAoB,CAAC,MAAkB;IACrD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/i18n/keys.d.ts
CHANGED
|
@@ -50,6 +50,14 @@ export declare const SEARCH_I18N_KEYS: {
|
|
|
50
50
|
readonly resultsDistanceKm: "search.results.distance_km";
|
|
51
51
|
readonly resultsUntitled: "search.results.untitled";
|
|
52
52
|
readonly resultsOpen: "search.results.open";
|
|
53
|
+
/** Alt text for the card photo — the card's own title, in a sentence. */
|
|
54
|
+
readonly resultsImageAlt: "search.results.image_alt";
|
|
55
|
+
readonly boxLabel: "search.box.label";
|
|
56
|
+
readonly boxPlaceholder: "search.box.placeholder";
|
|
57
|
+
readonly boxSubmit: "search.box.submit";
|
|
58
|
+
readonly boxClear: "search.box.clear";
|
|
59
|
+
/** Accessible name of the suggestion list under the box. */
|
|
60
|
+
readonly boxSuggestions: "search.box.suggestions";
|
|
53
61
|
readonly sortLabel: "search.sort.label";
|
|
54
62
|
readonly sortRelevance: "search.sort.relevance";
|
|
55
63
|
readonly sortNewest: "search.sort.newest";
|
|
@@ -57,6 +65,11 @@ export declare const SEARCH_I18N_KEYS: {
|
|
|
57
65
|
readonly sortPriceDesc: "search.sort.price_desc";
|
|
58
66
|
readonly sortDistance: "search.sort.distance";
|
|
59
67
|
readonly sortServerChose: "search.sort.server_chose";
|
|
68
|
+
/** The switch's own accessible name — a `Segmented` renders a radiogroup
|
|
69
|
+
* with no `<label for>` to name it. */
|
|
70
|
+
readonly viewLabel: "search.view.label";
|
|
71
|
+
readonly viewList: "search.view.list";
|
|
72
|
+
readonly viewGrid: "search.view.grid";
|
|
60
73
|
readonly facetsTitle: "search.facets.title";
|
|
61
74
|
readonly facetsLoading: "search.facets.loading";
|
|
62
75
|
readonly facetsLoadFailed: "search.facets.load_failed";
|
|
@@ -71,8 +84,50 @@ export declare const SEARCH_I18N_KEYS: {
|
|
|
71
84
|
readonly facetsRangeFrom: "search.facets.range_from";
|
|
72
85
|
readonly facetsRangeTo: "search.facets.range_to";
|
|
73
86
|
readonly facetsRangeApply: "search.facets.range_apply";
|
|
87
|
+
readonly facetsRangeClear: "search.facets.range_clear";
|
|
88
|
+
/** Accessible names: the visible "From"/"To" repeat on every row, so the
|
|
89
|
+
* field's own name has to carry the feature it belongs to. */
|
|
90
|
+
readonly facetsRangeFromAria: "search.facets.range_from_aria";
|
|
91
|
+
readonly facetsRangeToAria: "search.facets.range_to_aria";
|
|
92
|
+
/** The reason "Apply" is off: the range reads backwards. */
|
|
93
|
+
readonly facetsRangeInvalid: "search.facets.range_invalid";
|
|
94
|
+
/** The fold on a long facet group: "Show all (46)". The number is in
|
|
95
|
+
* brackets and not a counted noun, so this is one message and not a plural
|
|
96
|
+
* family — "(1)" never renders, because a group is only folded when the
|
|
97
|
+
* tail is longer than one row. */
|
|
98
|
+
readonly facetsShowAll: "search.facets.show_all";
|
|
99
|
+
readonly facetsShowLess: "search.facets.show_less";
|
|
100
|
+
readonly filtersOpen: "search.filters.open";
|
|
101
|
+
/** The sheet's commit button when the count is unknown. */
|
|
102
|
+
readonly filtersApply: "search.filters.apply";
|
|
103
|
+
/** "Show N results" — an EXACT count on the sheet's commit button.
|
|
104
|
+
* A PLURAL FAMILY. */
|
|
105
|
+
readonly filtersShowCount: "search.filters.show_count";
|
|
106
|
+
/** "Show N+ results" — a FLOOR on the same button. A PLURAL FAMILY. */
|
|
107
|
+
readonly filtersShowCountAtLeast: "search.filters.show_count_at_least";
|
|
108
|
+
readonly filtersDismiss: "search.filters.dismiss";
|
|
109
|
+
/** The accessible name of the phone chip ROW — a `role="group"` holding a
|
|
110
|
+
* dozen buttons is announced as nothing at all without one. */
|
|
111
|
+
readonly filtersChipsLabel: "search.filters.chips_label";
|
|
112
|
+
/** The leading, icon-only chip: the whole panel. Icon-only means the name
|
|
113
|
+
* exists ONLY here, so this key is the control's entire accessibility. */
|
|
114
|
+
readonly filtersAll: "search.filters.all";
|
|
115
|
+
/** A chip filtering on more than one value: "Bosch, +2". Not a plural
|
|
116
|
+
* family — nothing is being counted in words. */
|
|
117
|
+
readonly filtersChipMore: "search.filters.chip_more";
|
|
118
|
+
readonly categoryTitle: "search.category.title";
|
|
119
|
+
readonly categoryClear: "search.category.clear";
|
|
120
|
+
readonly categoryCurrent: "search.category.current";
|
|
121
|
+
readonly languageLabel: "search.language.label";
|
|
122
|
+
readonly languageAny: "search.language.any";
|
|
123
|
+
readonly limitLabel: "search.limit.label";
|
|
124
|
+
readonly limitOption: "search.limit.option";
|
|
125
|
+
/** Said beside the control when the URL carries a size the ladder does not
|
|
126
|
+
* offer — otherwise the story of "we kept your link's size" is invisible. */
|
|
127
|
+
readonly limitFromLink: "search.limit.from_link";
|
|
74
128
|
readonly geoTitle: "search.geo.title";
|
|
75
129
|
readonly geoRadiusKm: "search.geo.radius_km";
|
|
130
|
+
readonly geoRadiusLabel: "search.geo.radius_label";
|
|
76
131
|
readonly geoClear: "search.geo.clear";
|
|
77
132
|
readonly geoBox: "search.geo.box";
|
|
78
133
|
readonly geoCenter: "search.geo.center";
|
package/dist/i18n/keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/i18n/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;IAS3B;;;;;;;OAOG;;IAEH;kEAC8D;;IAE9D,sEAAsE;;;;;;;IAOtE,yDAAyD
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/i18n/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;IAS3B;;;;;;;OAOG;;IAEH;kEAC8D;;IAE9D,sEAAsE;;;;;;;IAOtE,yDAAyD;;;;;;;IAOzD,yEAAyE;;;;;;IAQzE,4DAA4D;;;;;;;;;IAa5D;2CACuC;;;;;;;;;;;;IAcvC,oEAAoE;;;;;;;IAOpE;kEAC8D;;;IAG9D,4DAA4D;;IAE5D;;;sCAGkC;;;;IAMlC,2DAA2D;;IAE3D;0BACsB;;IAEtB,uEAAuE;;;IAGvE;mEAC+D;;IAE/D;8EAC0E;;IAE1E;qDACiD;;;;;;;;;IAejD;iFAC6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCrE,CAAC;AAEX,MAAM,MAAM,aAAa,GACvB,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,aAAa,EAM3D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyIrD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAEzD"}
|