|
2284 | 2284 | }, []);
|
2285 | 2285 | }
|
2286 | 2286 |
|
| 2287 | + // pages/history/app/global/Providers/QueryProvider.js |
| 2288 | + var QueryContext = K( |
| 2289 | + /** @type {import('@preact/signals').ReadonlySignal<QueryState>} */ |
| 2290 | + d3({ |
| 2291 | + term: ( |
| 2292 | + /** @type {string|null} */ |
| 2293 | + null |
| 2294 | + ), |
| 2295 | + range: ( |
| 2296 | + /** @type {RangeId|null} */ |
| 2297 | + null |
| 2298 | + ), |
| 2299 | + domain: ( |
| 2300 | + /** @type {string|null} */ |
| 2301 | + null |
| 2302 | + ), |
| 2303 | + source: ( |
| 2304 | + /** @type {Source} */ |
| 2305 | + "initial" |
| 2306 | + ) |
| 2307 | + }) |
| 2308 | + ); |
| 2309 | + var QueryDispatch = K( |
| 2310 | + /** @type {(a: Action) => void} */ |
| 2311 | + (_5) => { |
| 2312 | + throw new Error("missing QueryDispatch"); |
| 2313 | + } |
| 2314 | + ); |
| 2315 | + function QueryProvider({ children, query = { term: "" } }) { |
| 2316 | + const initial = { |
| 2317 | + term: "term" in query ? query.term : null, |
| 2318 | + range: "range" in query ? query.range : null, |
| 2319 | + domain: "domain" in query ? query.domain : null, |
| 2320 | + source: ( |
| 2321 | + /** @type {Source} */ |
| 2322 | + "initial" |
| 2323 | + ) |
| 2324 | + }; |
| 2325 | + const queryState = useSignal(initial); |
| 2326 | + function dispatch(action) { |
| 2327 | + queryState.value = (() => { |
| 2328 | + switch (action.kind) { |
| 2329 | + case "reset": { |
| 2330 | + return { term: "", domain: null, range: null, source: ( |
| 2331 | + /** @type {const} */ |
| 2332 | + "auto" |
| 2333 | + ) }; |
| 2334 | + } |
| 2335 | + case "search-by-domain": { |
| 2336 | + return { term: null, domain: action.value, range: null, source: ( |
| 2337 | + /** @type {const} */ |
| 2338 | + "user" |
| 2339 | + ) }; |
| 2340 | + } |
| 2341 | + case "search-by-range": { |
| 2342 | + return { |
| 2343 | + term: null, |
| 2344 | + domain: null, |
| 2345 | + range: ( |
| 2346 | + /** @type {RangeId} */ |
| 2347 | + action.value |
| 2348 | + ), |
| 2349 | + source: ( |
| 2350 | + /** @type {const} */ |
| 2351 | + "user" |
| 2352 | + ) |
| 2353 | + }; |
| 2354 | + } |
| 2355 | + case "search-by-term": { |
| 2356 | + return { term: action.value, domain: null, range: null, source: ( |
| 2357 | + /** @type {const} */ |
| 2358 | + "user" |
| 2359 | + ) }; |
| 2360 | + } |
| 2361 | + default: |
| 2362 | + return { term: "", domain: null, range: null, source: ( |
| 2363 | + /** @type {const} */ |
| 2364 | + "auto" |
| 2365 | + ) }; |
| 2366 | + } |
| 2367 | + })(); |
| 2368 | + } |
| 2369 | + const dispatcher = q2(dispatch, [queryState]); |
| 2370 | + return /* @__PURE__ */ _(QueryContext.Provider, { value: queryState }, /* @__PURE__ */ _(QueryDispatch.Provider, { value: dispatcher }, children)); |
| 2371 | + } |
| 2372 | + function useQueryContext() { |
| 2373 | + return x2(QueryContext); |
| 2374 | + } |
| 2375 | + function useQueryDispatch() { |
| 2376 | + return x2(QueryDispatch); |
| 2377 | + } |
| 2378 | + |
| 2379 | + // pages/history/app/icons/Search.js |
| 2380 | + function SearchIcon() { |
| 2381 | + return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ _( |
| 2382 | + "path", |
| 2383 | + { |
| 2384 | + d: "M14.8 13.7L10.9 9.8C11.6 8.9 12 7.7 12 6.5C12 3.5 9.5 1 6.5 1C3.5 1 1 3.5 1 6.5C1 9.5 3.5 12 6.5 12C7.7 12 8.9 11.6 9.8 10.9L13.7 14.8C13.8 14.9 14 15 14.2 15C14.4 15 14.6 14.9 14.7 14.8C15.1 14.5 15.1 14 14.8 13.7ZM2.5 6.5C2.5 4.3 4.3 2.5 6.5 2.5C8.7 2.5 10.5 4.3 10.5 6.5C10.5 8.7 8.7 10.5 6.5 10.5C4.3 10.5 2.5 8.7 2.5 6.5Z", |
| 2385 | + fill: "currentColor", |
| 2386 | + "fill-opacity": "0.6" |
| 2387 | + } |
| 2388 | + )); |
| 2389 | + } |
| 2390 | + |
2287 | 2391 | // shared/translations.js
|
2288 | 2392 | function apply(subject, replacements, textLength = 1) {
|
2289 | 2393 | if (typeof subject !== "string" || subject.length === 0) return "";
|
|
2512 | 2616 | return x2(SettingsContext).platform.name;
|
2513 | 2617 | }
|
2514 | 2618 |
|
2515 |
| - // pages/history/app/icons/Search.js |
2516 |
| - function SearchIcon() { |
2517 |
| - return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ _( |
2518 |
| - "path", |
2519 |
| - { |
2520 |
| - d: "M14.8 13.7L10.9 9.8C11.6 8.9 12 7.7 12 6.5C12 3.5 9.5 1 6.5 1C3.5 1 1 3.5 1 6.5C1 9.5 3.5 12 6.5 12C7.7 12 8.9 11.6 9.8 10.9L13.7 14.8C13.8 14.9 14 15 14.2 15C14.4 15 14.6 14.9 14.7 14.8C15.1 14.5 15.1 14 14.8 13.7ZM2.5 6.5C2.5 4.3 4.3 2.5 6.5 2.5C8.7 2.5 10.5 4.3 10.5 6.5C10.5 8.7 8.7 10.5 6.5 10.5C4.3 10.5 2.5 8.7 2.5 6.5Z", |
2521 |
| - fill: "currentColor", |
2522 |
| - "fill-opacity": "0.6" |
2523 |
| - } |
2524 |
| - )); |
2525 |
| - } |
2526 |
| - |
2527 |
| - // pages/history/app/global/Providers/QueryProvider.js |
2528 |
| - var QueryContext = K( |
2529 |
| - /** @type {import('@preact/signals').ReadonlySignal<QueryState>} */ |
2530 |
| - d3({ |
2531 |
| - term: ( |
2532 |
| - /** @type {string|null} */ |
2533 |
| - null |
2534 |
| - ), |
2535 |
| - range: ( |
2536 |
| - /** @type {RangeId|null} */ |
2537 |
| - null |
2538 |
| - ), |
2539 |
| - domain: ( |
2540 |
| - /** @type {string|null} */ |
2541 |
| - null |
2542 |
| - ), |
2543 |
| - source: ( |
2544 |
| - /** @type {Source} */ |
2545 |
| - "initial" |
2546 |
| - ) |
2547 |
| - }) |
2548 |
| - ); |
2549 |
| - var QueryDispatch = K( |
2550 |
| - /** @type {(a: Action) => void} */ |
2551 |
| - (_5) => { |
2552 |
| - throw new Error("missing QueryDispatch"); |
2553 |
| - } |
2554 |
| - ); |
2555 |
| - function QueryProvider({ children, query = { term: "" } }) { |
2556 |
| - const initial = { |
2557 |
| - term: "term" in query ? query.term : null, |
2558 |
| - range: "range" in query ? query.range : null, |
2559 |
| - domain: "domain" in query ? query.domain : null, |
2560 |
| - source: ( |
2561 |
| - /** @type {Source} */ |
2562 |
| - "initial" |
2563 |
| - ) |
2564 |
| - }; |
2565 |
| - const queryState = useSignal(initial); |
2566 |
| - function dispatch(action) { |
2567 |
| - queryState.value = (() => { |
2568 |
| - switch (action.kind) { |
2569 |
| - case "reset": { |
2570 |
| - return { term: "", domain: null, range: null, source: ( |
2571 |
| - /** @type {const} */ |
2572 |
| - "auto" |
2573 |
| - ) }; |
2574 |
| - } |
2575 |
| - case "search-by-domain": { |
2576 |
| - return { term: null, domain: action.value, range: null, source: ( |
2577 |
| - /** @type {const} */ |
2578 |
| - "user" |
2579 |
| - ) }; |
2580 |
| - } |
2581 |
| - case "search-by-range": { |
2582 |
| - return { |
2583 |
| - term: null, |
2584 |
| - domain: null, |
2585 |
| - range: ( |
2586 |
| - /** @type {RangeId} */ |
2587 |
| - action.value |
2588 |
| - ), |
2589 |
| - source: ( |
2590 |
| - /** @type {const} */ |
2591 |
| - "user" |
2592 |
| - ) |
2593 |
| - }; |
2594 |
| - } |
2595 |
| - case "search-by-term": { |
2596 |
| - return { term: action.value, domain: null, range: null, source: ( |
2597 |
| - /** @type {const} */ |
2598 |
| - "user" |
2599 |
| - ) }; |
2600 |
| - } |
2601 |
| - default: |
2602 |
| - return { term: "", domain: null, range: null, source: ( |
2603 |
| - /** @type {const} */ |
2604 |
| - "auto" |
2605 |
| - ) }; |
2606 |
| - } |
2607 |
| - })(); |
2608 |
| - } |
2609 |
| - const dispatcher = q2(dispatch, [queryState]); |
2610 |
| - return /* @__PURE__ */ _(QueryContext.Provider, { value: queryState }, /* @__PURE__ */ _(QueryDispatch.Provider, { value: dispatcher }, children)); |
2611 |
| - } |
2612 |
| - function useQueryContext() { |
2613 |
| - return x2(QueryContext); |
2614 |
| - } |
2615 |
| - function useQueryDispatch() { |
2616 |
| - return x2(QueryDispatch); |
2617 |
| - } |
2618 |
| - |
2619 | 2619 | // pages/history/app/components/SearchForm.js
|
2620 | 2620 | var INPUT_FIELD_NAME = "q";
|
2621 | 2621 | function SearchForm({ term, domain }) {
|
|
0 commit comments