@ox0/ui 3.7.0 → 3.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.
|
@@ -6,6 +6,12 @@ export interface GlobalSearchControls {
|
|
|
6
6
|
/** Opens the search, optionally starting with `query`. */
|
|
7
7
|
readonly open: (query?: string) => void;
|
|
8
8
|
readonly close: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Re-runs the current query in the background — results update in place, without a loading
|
|
11
|
+
* state. Call it when the data behind a source changes (e.g. on an interval while documents are
|
|
12
|
+
* still being indexed). Does nothing while the search is closed.
|
|
13
|
+
*/
|
|
14
|
+
readonly refresh: () => void;
|
|
9
15
|
readonly isOpen: boolean;
|
|
10
16
|
/** The shortcut as shown to this user: "⌘K" on macOS, "Ctrl K" elsewhere. */
|
|
11
17
|
readonly shortcutLabel: string;
|
|
@@ -26,8 +32,14 @@ export interface GlobalSearchProps {
|
|
|
26
32
|
readonly placeholder?: string;
|
|
27
33
|
/** Shown instead of the default message when a query has no results. */
|
|
28
34
|
readonly emptyState?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Notices about the results as a whole — "3 documents still being read", "text search
|
|
37
|
+
* unavailable". Shown in a strip above the key hints whether or not anything matched, and
|
|
38
|
+
* announced politely when it changes. Keep it to a short line or two.
|
|
39
|
+
*/
|
|
40
|
+
readonly status?: ReactNode;
|
|
29
41
|
}
|
|
30
|
-
declare function GlobalSearchRoot({ children, defaultOpen, emptyState, isOpen: isOpenProp, isShortcutDisabled, onOpenChange, placeholder, sources, }: GlobalSearchProps): ReactNode;
|
|
42
|
+
declare function GlobalSearchRoot({ children, defaultOpen, emptyState, isOpen: isOpenProp, isShortcutDisabled, onOpenChange, placeholder, sources, status, }: GlobalSearchProps): ReactNode;
|
|
31
43
|
export interface GlobalSearchTriggerProps {
|
|
32
44
|
/** Text in the box. Default "Search…". */
|
|
33
45
|
readonly placeholder?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-search.d.ts","sourceRoot":"","sources":["../../src/components/global-search.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"global-search.d.ts","sourceRoot":"","sources":["../../src/components/global-search.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EAWf,MAAM,OAAO,CAAA;AAOd,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,iBAAiB,CAAA;AAKjE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACtE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAelE,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAID,oEAAoE;AACpE,wBAAgB,eAAe,IAAI,oBAAoB,CAItD;AAID,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,CAAC,OAAO,CAAC,EAAE,CAAA;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,0CAA0C;IAC1C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IACrC,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAA;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAC5B;AAED,iBAAS,gBAAgB,CAAC,EACxB,QAAQ,EACR,WAAmB,EACnB,UAAU,EACV,MAAM,EAAE,UAAU,EAClB,kBAA0B,EAC1B,YAAY,EACZ,WAAW,EACX,OAAO,EACP,MAAM,GACP,EAAE,iBAAiB,GAAG,SAAS,CAmE/B;AAiUD,MAAM,WAAW,wBAAwB;IACvC,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,+EAA+E;AAC/E,iBAAS,mBAAmB,CAAC,EAAE,WAAW,EAAE,EAAE,wBAAwB,GAAG,SAAS,CAmBjF;AAID,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;IACzB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,kDAAkD;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAC1B;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,SAAS,CAqB7F;AAsBD,eAAO,MAAM,YAAY;;;CAGvB,CAAA"}
|
|
@@ -57,11 +57,18 @@ export declare class SearchRunner {
|
|
|
57
57
|
private readonly listeners;
|
|
58
58
|
private controller;
|
|
59
59
|
private timers;
|
|
60
|
+
private last;
|
|
60
61
|
readonly subscribe: (listener: () => void) => (() => void);
|
|
61
62
|
readonly getSnapshot: () => readonly SearchGroup[];
|
|
62
63
|
run(sources: readonly SearchSource<unknown>[], query: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Re-runs the last query in the background: groups keep their items and status until the new
|
|
66
|
+
* results land, so a periodic refresh doesn't flash "Searching…" or a spinner. Debounce is skipped.
|
|
67
|
+
*/
|
|
68
|
+
refresh(): void;
|
|
69
|
+
private execute;
|
|
63
70
|
cancel(): void;
|
|
64
|
-
private
|
|
71
|
+
private startSource;
|
|
65
72
|
private update;
|
|
66
73
|
private emit;
|
|
67
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-runner.d.ts","sourceRoot":"","sources":["../../src/components/search-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qDAAqD;IACrD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,oFAAoF;IACpF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,6FAA6F;IAC7F,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,iFAAiF;IACjF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IACnF,gCAAgC;IAChC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAA;IACvB,mEAAmE;IACnE,YAAY,CAAC,IAAI,EAAE,CAAC,GAA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ACnC;AAID;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,IAAI,CAA4E;IAExF,QAAQ,CAAC,SAAS,aAAc,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAKxD;IAED,QAAQ,CAAC,WAAW,QAAO,SAAS,WAAW,EAAE,CAAe;IAEhE,GAAG,CAAC,OAAO,EAAE,SAAS,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAElE;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,OAAO,CAAC,OAAO;IA+Bf,MAAM,IAAI,IAAI,CAKb;IAED,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,IAAI;CAGb;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC3B,CAAC,EAAE,CAmBL"}
|
package/dist/index.js
CHANGED
|
@@ -2672,7 +2672,7 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2672
2672
|
border-radius: var(--ox0-radius-lg);
|
|
2673
2673
|
box-shadow: var(--ox0-shadow-modal);
|
|
2674
2674
|
color: var(--ox0-color-foreground);
|
|
2675
|
-
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
2675
|
+
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
|
2676
2676
|
width: min(100%, 40rem);
|
|
2677
2677
|
max-height: min(76vh, 36rem);
|
|
2678
2678
|
margin: 0;
|
|
@@ -2851,6 +2851,18 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2851
2851
|
flex: none;
|
|
2852
2852
|
}
|
|
2853
2853
|
|
|
2854
|
+
.status-ZysnH5 {
|
|
2855
|
+
border-top: 1px solid var(--ox0-color-border-subtle);
|
|
2856
|
+
color: var(--ox0-color-muted);
|
|
2857
|
+
font-size: var(--ox0-font-size-xs);
|
|
2858
|
+
padding: var(--ox0-space-sm) var(--ox0-space-lg);
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
.status-ZysnH5:empty {
|
|
2862
|
+
border-top: none;
|
|
2863
|
+
padding: 0;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2854
2866
|
.footer-umLGpy {
|
|
2855
2867
|
border-top: 1px solid var(--ox0-color-border-subtle);
|
|
2856
2868
|
color: var(--ox0-color-muted);
|
|
@@ -2955,6 +2967,7 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2955
2967
|
resultTitle: "resultTitle-hu7e5s",
|
|
2956
2968
|
resultDescription: "resultDescription-UcRTCD",
|
|
2957
2969
|
resultMeta: "resultMeta-wVHGW8",
|
|
2970
|
+
status: "status-ZysnH5",
|
|
2958
2971
|
footer: "footer-umLGpy",
|
|
2959
2972
|
hint: "hint-u3aolN",
|
|
2960
2973
|
visuallyHidden: "visuallyHidden-VtiEjb"
|
|
@@ -9126,6 +9139,7 @@ class SearchRunner {
|
|
|
9126
9139
|
listeners = new Set();
|
|
9127
9140
|
controller = null;
|
|
9128
9141
|
timers = [];
|
|
9142
|
+
last = null;
|
|
9129
9143
|
subscribe = (listener)=>{
|
|
9130
9144
|
this.listeners.add(listener);
|
|
9131
9145
|
return ()=>{
|
|
@@ -9134,7 +9148,17 @@ class SearchRunner {
|
|
|
9134
9148
|
};
|
|
9135
9149
|
getSnapshot = ()=>this.groups;
|
|
9136
9150
|
run(sources, query) {
|
|
9151
|
+
this.execute(sources, query, false);
|
|
9152
|
+
}
|
|
9153
|
+
refresh() {
|
|
9154
|
+
if (this.last) this.execute(this.last.sources, this.last.query, true);
|
|
9155
|
+
}
|
|
9156
|
+
execute(sources, query, isBackground) {
|
|
9137
9157
|
this.cancel();
|
|
9158
|
+
this.last = {
|
|
9159
|
+
sources,
|
|
9160
|
+
query
|
|
9161
|
+
};
|
|
9138
9162
|
const controller = new AbortController();
|
|
9139
9163
|
this.controller = controller;
|
|
9140
9164
|
const trimmed = query.trim();
|
|
@@ -9148,16 +9172,18 @@ class SearchRunner {
|
|
|
9148
9172
|
items: [],
|
|
9149
9173
|
status: "idle"
|
|
9150
9174
|
};
|
|
9175
|
+
const prior = previous.get(source.id);
|
|
9176
|
+
if (isBackground && prior && "idle" !== prior.status) return prior;
|
|
9151
9177
|
return {
|
|
9152
9178
|
source,
|
|
9153
|
-
items:
|
|
9179
|
+
items: prior?.items ?? [],
|
|
9154
9180
|
status: "loading"
|
|
9155
9181
|
};
|
|
9156
9182
|
});
|
|
9157
9183
|
sources.forEach((source, index)=>{
|
|
9158
9184
|
if (this.groups[index]?.status === "idle") return;
|
|
9159
|
-
const start = ()=>this.
|
|
9160
|
-
const delay = source.debounceMs ?? 0;
|
|
9185
|
+
const start = ()=>this.startSource(source, index, trimmed, controller);
|
|
9186
|
+
const delay = isBackground ? 0 : source.debounceMs ?? 0;
|
|
9161
9187
|
if (delay > 0) this.timers.push(setTimeout(start, delay));
|
|
9162
9188
|
else start();
|
|
9163
9189
|
});
|
|
@@ -9169,7 +9195,7 @@ class SearchRunner {
|
|
|
9169
9195
|
this.controller?.abort();
|
|
9170
9196
|
this.controller = null;
|
|
9171
9197
|
}
|
|
9172
|
-
|
|
9198
|
+
startSource(source, index, query, controller) {
|
|
9173
9199
|
let result;
|
|
9174
9200
|
try {
|
|
9175
9201
|
result = source.search(query, {
|
|
@@ -9250,7 +9276,7 @@ function useGlobalSearch() {
|
|
|
9250
9276
|
if (!ctx) throw new Error("useGlobalSearch must be used inside <GlobalSearch>");
|
|
9251
9277
|
return ctx;
|
|
9252
9278
|
}
|
|
9253
|
-
function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: isOpenProp, isShortcutDisabled = false, onOpenChange, placeholder, sources }) {
|
|
9279
|
+
function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: isOpenProp, isShortcutDisabled = false, onOpenChange, placeholder, sources, status }) {
|
|
9254
9280
|
const os = useOS();
|
|
9255
9281
|
const [isOpen, setIsOpen] = useControllableState({
|
|
9256
9282
|
defaultValue: defaultOpen,
|
|
@@ -9270,6 +9296,8 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
|
|
|
9270
9296
|
const close = useCallback(()=>setIsOpen(false), [
|
|
9271
9297
|
setIsOpen
|
|
9272
9298
|
]);
|
|
9299
|
+
const refreshRef = useRef(null);
|
|
9300
|
+
const refresh = useCallback(()=>refreshRef.current?.(), []);
|
|
9273
9301
|
useEffect(()=>{
|
|
9274
9302
|
if (isShortcutDisabled) return;
|
|
9275
9303
|
const handler = (e)=>{
|
|
@@ -9294,11 +9322,13 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
|
|
|
9294
9322
|
close,
|
|
9295
9323
|
isOpen,
|
|
9296
9324
|
open,
|
|
9325
|
+
refresh,
|
|
9297
9326
|
shortcutLabel
|
|
9298
9327
|
}), [
|
|
9299
9328
|
close,
|
|
9300
9329
|
isOpen,
|
|
9301
9330
|
open,
|
|
9331
|
+
refresh,
|
|
9302
9332
|
shortcutLabel
|
|
9303
9333
|
]);
|
|
9304
9334
|
return /*#__PURE__*/ jsxs(GlobalSearchContext.Provider, {
|
|
@@ -9313,13 +9343,15 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
|
|
|
9313
9343
|
emptyState: emptyState,
|
|
9314
9344
|
initialQuery: initialQuery,
|
|
9315
9345
|
placeholder: placeholder,
|
|
9346
|
+
refreshRef: refreshRef,
|
|
9316
9347
|
sources: sources,
|
|
9348
|
+
status: status,
|
|
9317
9349
|
onClose: close
|
|
9318
9350
|
}), themeRoot(anchor) ?? document.body) : null
|
|
9319
9351
|
]
|
|
9320
9352
|
});
|
|
9321
9353
|
}
|
|
9322
|
-
function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }) {
|
|
9354
|
+
function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRef, sources, status }) {
|
|
9323
9355
|
const baseId = useId();
|
|
9324
9356
|
const listboxId = `${baseId}-listbox`;
|
|
9325
9357
|
const router = useRouter();
|
|
@@ -9350,6 +9382,15 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9350
9382
|
useEffect(()=>()=>runner.cancel(), [
|
|
9351
9383
|
runner
|
|
9352
9384
|
]);
|
|
9385
|
+
useEffect(()=>{
|
|
9386
|
+
refreshRef.current = ()=>runner.refresh();
|
|
9387
|
+
return ()=>{
|
|
9388
|
+
refreshRef.current = null;
|
|
9389
|
+
};
|
|
9390
|
+
}, [
|
|
9391
|
+
refreshRef,
|
|
9392
|
+
runner
|
|
9393
|
+
]);
|
|
9353
9394
|
useEffect(()=>{
|
|
9354
9395
|
const previouslyFocused = document.activeElement;
|
|
9355
9396
|
inputRef.current?.focus();
|
|
@@ -9502,8 +9543,8 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9502
9543
|
role: "listbox",
|
|
9503
9544
|
children: groups.map((group)=>{
|
|
9504
9545
|
const groupOptions = options.filter((option)=>option.source === group.source);
|
|
9505
|
-
const
|
|
9506
|
-
if (0 === groupOptions.length && null ===
|
|
9546
|
+
const groupStatus = "error" === group.status ? errorText : "loading" === group.status && 0 === groupOptions.length ? loadingText : null;
|
|
9547
|
+
if (0 === groupOptions.length && null === groupStatus) return null;
|
|
9507
9548
|
const headingId = `${baseId}-${group.source.id}-heading`;
|
|
9508
9549
|
return /*#__PURE__*/ jsxs("div", {
|
|
9509
9550
|
className: global_search_module.group,
|
|
@@ -9517,9 +9558,9 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9517
9558
|
/*#__PURE__*/ jsx("span", {
|
|
9518
9559
|
children: group.source.label
|
|
9519
9560
|
}),
|
|
9520
|
-
|
|
9561
|
+
groupStatus ? /*#__PURE__*/ jsx("span", {
|
|
9521
9562
|
className: global_search_module.groupStatus,
|
|
9522
|
-
children:
|
|
9563
|
+
children: groupStatus
|
|
9523
9564
|
}) : null
|
|
9524
9565
|
]
|
|
9525
9566
|
}),
|
|
@@ -9551,6 +9592,11 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9551
9592
|
}) : null
|
|
9552
9593
|
]
|
|
9553
9594
|
}),
|
|
9595
|
+
/*#__PURE__*/ jsx("div", {
|
|
9596
|
+
"aria-live": "polite",
|
|
9597
|
+
className: global_search_module.status,
|
|
9598
|
+
children: status
|
|
9599
|
+
}),
|
|
9554
9600
|
/*#__PURE__*/ jsxs("div", {
|
|
9555
9601
|
"aria-hidden": "true",
|
|
9556
9602
|
className: global_search_module.footer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox0/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/esturcke/ox0-platform.git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"@internationalized/date": "^3.12.4",
|
|
26
26
|
"react-aria": "^3.52.1",
|
|
27
27
|
"react-stately": "^3.50.0",
|
|
28
|
+
"@ox0/i18n": "0.4.0",
|
|
28
29
|
"@ox0/hooks": "0.2.2",
|
|
29
|
-
"@ox0/tokens": "0.7.0"
|
|
30
|
-
"@ox0/i18n": "0.4.0"
|
|
30
|
+
"@ox0/tokens": "0.7.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^19.0.0",
|