@moyarich/console-addon-search 0.0.0-stage → 0.1.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/README.md +32 -2
- package/dist/components/ConsoleSearchControls/ConsoleSearchControls.d.ts +5 -0
- package/dist/components/ConsoleSearchHighlight/ConsoleSearchHighlight.d.ts +6 -0
- package/dist/console-addon-search.css +89 -0
- package/dist/index.cjs +2104 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +2104 -0
- package/package.json +58 -4
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @moyarich/console-addon-search
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Search and highlight output. Find text matches, move between occurrences, and use optional controls and an observable controller.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @moyarich/console @moyarich/console-addon-search
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Console } from "@moyarich/console";
|
|
15
|
+
import { createConsoleSearchAddon } from "@moyarich/console-addon-search";
|
|
16
|
+
|
|
17
|
+
const addons = [createConsoleSearchAddon()];
|
|
18
|
+
|
|
19
|
+
// Pass your application's structured messages to Console.
|
|
20
|
+
<Console messages={messages} addons={addons} />;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The addon is optional and can be combined with other Console addons. The host application remains responsible for supplying and retaining messages.
|
|
24
|
+
|
|
25
|
+
## Learn more
|
|
26
|
+
|
|
27
|
+
Explore [runnable package examples](./examples) and the [Console documentation](https://moyarich.github.io/console/) for available settings and integration patterns.
|
|
28
|
+
|
|
29
|
+
Review the [changelog](./CHANGELOG.md) for changes by version and [package metadata](./package.json) for dependency requirements.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ConsoleSearchController } from "../../index";
|
|
2
|
+
import "./ConsoleSearchHighlight.css";
|
|
3
|
+
export declare function ConsoleSearchHighlight({ controller, index, }: {
|
|
4
|
+
controller: ConsoleSearchController;
|
|
5
|
+
index: number;
|
|
6
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* Public --console-search-* inputs resolve to private component-local tokens. */
|
|
2
|
+
.console-search-controls {
|
|
3
|
+
--_console-search-background-color: var(
|
|
4
|
+
--console-search-background-color,
|
|
5
|
+
var(--console-panel-background-color, transparent)
|
|
6
|
+
);
|
|
7
|
+
--_console-search-color: var(
|
|
8
|
+
--console-search-color,
|
|
9
|
+
var(--console-panel-color, inherit)
|
|
10
|
+
);
|
|
11
|
+
--_console-search-border-color: var(
|
|
12
|
+
--console-search-border-color,
|
|
13
|
+
var(--console-panel-color, currentColor)
|
|
14
|
+
);
|
|
15
|
+
--_console-search-focus-color: var(
|
|
16
|
+
--console-search-focus-color,
|
|
17
|
+
var(--console-header-icon-color, currentColor)
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-wrap: wrap;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: 0.65rem;
|
|
24
|
+
padding: 0.5rem;
|
|
25
|
+
border-bottom: 1px solid var(--_console-search-border-color);
|
|
26
|
+
background: var(--_console-search-background-color);
|
|
27
|
+
color: var(--_console-search-color);
|
|
28
|
+
font: inherit;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.console-search-controls label {
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 0.35rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.console-search-controls input[type="search"] {
|
|
38
|
+
min-width: 12rem;
|
|
39
|
+
max-width: 100%;
|
|
40
|
+
background: var(--_console-search-background-color);
|
|
41
|
+
color: var(--_console-search-color);
|
|
42
|
+
border: 1px solid var(--_console-search-border-color);
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
padding: 0.3rem 0.5rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.console-search-controls button {
|
|
48
|
+
border: 1px solid var(--_console-search-border-color);
|
|
49
|
+
background: var(--_console-search-background-color);
|
|
50
|
+
color: var(--_console-search-color);
|
|
51
|
+
padding: 0.3rem 0.5rem;
|
|
52
|
+
border-radius: 4px;
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.console-search-controls :focus-visible {
|
|
57
|
+
outline: 2px solid var(--_console-search-focus-color);
|
|
58
|
+
outline-offset: 2px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.console-search-controls button:disabled {
|
|
62
|
+
opacity: 0.5;
|
|
63
|
+
cursor: default;
|
|
64
|
+
}
|
|
65
|
+
/* Search match colors can be themed independently from the Console panel. */
|
|
66
|
+
.console-search-highlight {
|
|
67
|
+
--_console-search-highlight-background-color: var(
|
|
68
|
+
--console-search-highlight-background-color,
|
|
69
|
+
light-dark(#ffdf70, #745b16)
|
|
70
|
+
);
|
|
71
|
+
--_console-search-highlight-color: var(
|
|
72
|
+
--console-search-highlight-color,
|
|
73
|
+
light-dark(#231c00, #fff7d6)
|
|
74
|
+
);
|
|
75
|
+
--_console-search-highlight-active-color: var(
|
|
76
|
+
--console-search-highlight-active-color,
|
|
77
|
+
var(--console-header-icon-color, currentColor)
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
background: var(--_console-search-highlight-background-color);
|
|
81
|
+
color: var(--_console-search-highlight-color);
|
|
82
|
+
border-radius: 2px;
|
|
83
|
+
padding: 0 0.2em;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.console-search-highlight[data-active] {
|
|
87
|
+
outline: 2px solid var(--_console-search-highlight-active-color);
|
|
88
|
+
outline-offset: 1px;
|
|
89
|
+
}
|