pleasenobugs 0.2.0 → 0.4.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.
Files changed (44) hide show
  1. package/README.md +137 -38
  2. package/dist/chunks/client-CkFi6gmV.js +358 -0
  3. package/dist/chunks/demo-DLTn5oUs.js +232 -0
  4. package/dist/chunks/index-B1dIQO6N.js +2795 -0
  5. package/dist/client.js +7 -294
  6. package/dist/index.js +9 -10
  7. package/dist/pleasenobugs.iife.js +2 -2
  8. package/dist/types/client.d.ts +72 -4
  9. package/dist/types/client.d.ts.map +1 -1
  10. package/dist/types/demo.d.ts +39 -3
  11. package/dist/types/demo.d.ts.map +1 -1
  12. package/dist/types/element.d.ts +19 -13
  13. package/dist/types/element.d.ts.map +1 -1
  14. package/dist/types/filter.d.ts +66 -0
  15. package/dist/types/filter.d.ts.map +1 -0
  16. package/dist/types/i18n.d.ts +222 -531
  17. package/dist/types/i18n.d.ts.map +1 -1
  18. package/dist/types/index.d.ts +5 -4
  19. package/dist/types/index.d.ts.map +1 -1
  20. package/dist/types/readonly.d.ts +4 -3
  21. package/dist/types/readonly.d.ts.map +1 -1
  22. package/dist/types/signer.d.ts +7 -0
  23. package/dist/types/signer.d.ts.map +1 -1
  24. package/dist/types/ui/App.d.ts +4 -3
  25. package/dist/types/ui/App.d.ts.map +1 -1
  26. package/dist/types/ui/Compose.d.ts +12 -7
  27. package/dist/types/ui/Compose.d.ts.map +1 -1
  28. package/dist/types/ui/Face.d.ts +17 -0
  29. package/dist/types/ui/Face.d.ts.map +1 -0
  30. package/dist/types/ui/Manage.d.ts +60 -0
  31. package/dist/types/ui/Manage.d.ts.map +1 -0
  32. package/dist/types/ui/PostCard.d.ts +53 -6
  33. package/dist/types/ui/PostCard.d.ts.map +1 -1
  34. package/dist/types/ui/Sheets.d.ts +32 -28
  35. package/dist/types/ui/Sheets.d.ts.map +1 -1
  36. package/dist/types/ui/Talk.d.ts +57 -0
  37. package/dist/types/ui/Talk.d.ts.map +1 -0
  38. package/dist/types/ui/Updates.d.ts +37 -0
  39. package/dist/types/ui/Updates.d.ts.map +1 -0
  40. package/dist/types/ui/icons.d.ts +16 -0
  41. package/dist/types/ui/icons.d.ts.map +1 -1
  42. package/package.json +3 -3
  43. package/dist/chunks/demo-nnvUgJyJ.js +0 -107
  44. package/dist/chunks/index-13DToKWI.js +0 -1751
@@ -1,4 +1,4 @@
1
- import { type Answer, type AppLogin, type BoardRead, type ErrorCode, type Me, type PostContext, type PostKind, type PostStatus, type ShotType } from '@pleasenobugs/core';
1
+ import { type Answer, type AppLogin, type BoardRead, type ErrorCode, type Me, type Message, type PostContext, type PostFix, type PostKind, type PostStatus, type ShotType, type Update } from '@pleasenobugs/core';
2
2
  import { type Signer } from './signer.js';
3
3
  export { insideNimiqPay, nimiqPaySigner, SignerError, type Signer, type SignedMessage } from './signer.js';
4
4
  export { createMatcher, sortPosts } from '@pleasenobugs/core';
@@ -30,11 +30,19 @@ export interface ClientOptions {
30
30
  /** The origin written into the signed message. Defaults to this page's. */
31
31
  origin?: string;
32
32
  /**
33
- * Where the proof is remembered between visits, so somebody signs once a
34
- * month rather than once a visit. Defaults to `localStorage`; `null` keeps
35
- * it in memory only.
33
+ * Where the proof is remembered. Inside Nimiq Pay, `localStorage`: the
34
+ * phone and the wallet are the user's own, so they sign once a month.
35
+ * Anywhere else, `sessionStorage`: a browser may be shared, so signing in
36
+ * lasts until the tab closes. `null` keeps it in memory only.
36
37
  */
37
38
  storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'> | null;
39
+ /**
40
+ * Which address the wallet is on right now, without a prompt. A stored proof
41
+ * for another address is dropped, so a user who switched accounts is not
42
+ * spoken for by the old one. Defaults to Nimiq Pay's current account inside
43
+ * it, with its own signer.
44
+ */
45
+ account?: () => Promise<string | null>;
38
46
  /** For tests and unusual runtimes. */
39
47
  fetch?: typeof fetch;
40
48
  }
@@ -121,6 +129,8 @@ export declare function createClient(options: ClientOptions): {
121
129
  * `<img>` to load by itself.
122
130
  */
123
131
  shotUrl: (id: string) => string;
132
+ /** Where the server draws an identicon, by the code a post carries in `face`. */
133
+ faceUrl: (code: string) => string;
124
134
  vote: (id: string, up: boolean) => Promise<Result<{
125
135
  ok: true;
126
136
  votes: number;
@@ -133,14 +143,72 @@ export declare function createClient(options: ClientOptions): {
133
143
  ok: true;
134
144
  name?: string;
135
145
  }>>;
146
+ /**
147
+ * An owner answering a post. `fix` says where the fix is, on a bug or an
148
+ * idea set to done: `{ version?, link? }`, the link on github.com or
149
+ * gitlab.com. Moving a post away from done takes its fix away by itself.
150
+ */
136
151
  manage: (id: string, change: {
137
152
  status?: PostStatus;
138
153
  reply?: string;
139
154
  hidden?: boolean;
140
155
  shotOff?: boolean;
141
156
  approved?: boolean;
157
+ fix?: PostFix | null;
158
+ }) => Promise<Result<{
159
+ ok: true;
160
+ }>>;
161
+ /**
162
+ * Write under a post: an owner for the app, whenever they like; its
163
+ * author only right after the app, on a bug or an idea that is not done
164
+ * (`not_your_turn`, `closed` otherwise). `message.id` is yours to mint.
165
+ */
166
+ say: (id: string, message: {
167
+ id: string;
168
+ text: string;
169
+ }) => Promise<Result<{
170
+ ok: true;
171
+ message: Message;
172
+ }>>;
173
+ /**
174
+ * Change your own last message before anybody answered it (`text`), or,
175
+ * as an owner, take an author's message off the board or put it back
176
+ * (`hidden`).
177
+ */
178
+ editMessage: (id: string, messageId: string, change: {
179
+ text?: string;
180
+ hidden?: boolean;
181
+ }) => Promise<Result<{
182
+ ok: true;
183
+ message: Message;
184
+ }>>;
185
+ /** Take your own last message back, before anybody answered it. */
186
+ unsay: (id: string, messageId: string) => Promise<Result<{
187
+ ok: true;
188
+ }>>;
189
+ /** What changed in the app, newest first. Anybody's to read; never prompts. */
190
+ updates: () => Promise<Result<{
191
+ updates: Update[];
192
+ }>>;
193
+ /**
194
+ * An owner writing one. `link` is a page on github.com or gitlab.com;
195
+ * `posts` are the bugs and ideas it fixed, which go to done with its
196
+ * version and link.
197
+ */
198
+ postUpdate: (u: {
199
+ id: string;
200
+ title: string;
201
+ text?: string;
202
+ version?: string;
203
+ link: string;
204
+ posts?: string[];
142
205
  }) => Promise<Result<{
143
206
  ok: true;
207
+ update: Update;
208
+ }>>;
209
+ /** An owner taking one off the page. The posts it fixed stay done. */
210
+ removeUpdate: (id: string) => Promise<Result<{
211
+ ok: true;
144
212
  }>>;
145
213
  };
146
214
  export type Client = ReturnType<typeof createClient>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EAEd,KAAK,EAAE,EACP,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA+C,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9D,mBAAmB,oBAAoB,CAAC;AAExC,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACjE,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,EAA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OAAO,YAAY,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type MessageFrom, type PostKind, type PostStatus } from '@pleasenobugs/core';
1
2
  import type { Client } from './client.js';
2
3
  /**
3
4
  * A board that lives in this page's memory, for `<please-no-bugs demo>`.
@@ -7,11 +8,46 @@ import type { Client } from './client.js';
7
8
  * "Feedback sent!") and **nothing leaves the browser**. Nothing is stored
8
9
  * either, not even in `localStorage`, so a reload is a fresh board.
9
10
  *
10
- * The visitor is signed in from the start as an ordinary user, never an
11
- * owner: a demo should show what an app's users see.
11
+ * The visitor is signed in from the start as an ordinary user: a demo shows
12
+ * what an app's users see. With `owner` (`<please-no-bugs demo="owner">`)
13
+ * they are the app's owner instead, and the owner's side works too:
14
+ * answering, a status, "Fixed in", hiding, writing and deleting updates.
15
+ * Still nothing leaves the browser.
16
+ *
17
+ * The conversation under a post follows the server's turns: a visitor's own
18
+ * idea starts with a question from the app they can answer, and an owner
19
+ * finds a bug whose author answered and waits for them.
20
+ *
21
+ * With `samples`, the board starts with those posts instead of its own, and
22
+ * with no updates (its own updates are about its own posts): for a page that
23
+ * tells one short story, such as the website's home page tour.
12
24
  *
13
25
  * Typed as a {@link Client}, so a change to the real client that this one
14
26
  * does not follow is a type error rather than a demo that quietly lies.
15
27
  */
16
- export declare function createDemoClient(lang?: string): Client;
28
+ export declare function createDemoClient({ owner, samples }?: {
29
+ owner?: boolean;
30
+ samples?: DemoSample[];
31
+ }): Client;
32
+ /** A post a demo board starts with. Votes default to 1, and it was written an hour ago. */
33
+ export interface DemoSample {
34
+ kind: PostKind;
35
+ text: string;
36
+ votes?: number;
37
+ /** How long ago it was written, in milliseconds. */
38
+ ago?: number;
39
+ status?: PostStatus;
40
+ who?: string;
41
+ rating?: number;
42
+ /** The app's one answer. */
43
+ reply?: string;
44
+ /** A conversation instead: who said what, in order. */
45
+ thread?: [MessageFrom, string][];
46
+ /** The visitor's own, so they can answer the app under it. Never an owner's. */
47
+ mine?: boolean;
48
+ /** The version a done post was fixed in. */
49
+ fix?: string;
50
+ /** What the app sent along with it, shown to owners. */
51
+ context?: Record<string, string>;
52
+ }
17
53
  //# sourceMappingURL=demo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAO,GAAG,MAAM,CA6FpD"}
1
+ {"version":3,"file":"demo.d.ts","sourceRoot":"","sources":["../../src/demo.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,WAAW,EAEhB,KAAK,QAAQ,EACb,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAU,MAAM,aAAa,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAa,EAAE,OAAO,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;CAAO,GAAG,MAAM,CAyPrH;AAiBD,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,gFAAgF;IAChF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC"}
@@ -2,6 +2,7 @@ import { type AppLogin, type PostContext, type PostKind } from '@pleasenobugs/co
2
2
  import { type Strings } from './i18n.js';
3
3
  import type { Signer } from './signer.js';
4
4
  import { type View } from './ui/App.js';
5
+ import type { DemoSample } from './demo.js';
5
6
  export declare const TAG = "please-no-bugs";
6
7
  /**
7
8
  * `<please-no-bugs>`: the whole board as one tag.
@@ -14,19 +15,24 @@ export declare const TAG = "please-no-bugs";
14
15
  * whole screen. The "paste one line and done" route.
15
16
  * - `overlay`: the board over the whole screen, now. What {@link open} uses.
16
17
  *
18
+ * Each opens on the tiles that ask what to write, with the board one tap
19
+ * under them; `start="board"` opens on the board instead.
20
+ *
17
21
  * Attributes: `project` and `server` (both required, unless `demo`), `mode`,
18
- * `lang`, `theme` (`auto` | `light` | `dark` | `pleasenobugs` | `nimiq`), `accent`
19
- * (a colour), `app-name`, `name` (a display name to suggest), `kinds` (which
22
+ * `start` (`tiles` or `board`), `theme` (`nimiq`, the default, or `nimiq-dark`),
23
+ * `lang` (the language of your `strings`, for dates; English by default), `app-name`, `name` (a display name to suggest), `kinds` (which
20
24
  * of `bug,idea,review` to offer), `screenshots` (`owners` to keep them off
21
25
  * the board, for the app's owners only; `off` to leave them out), `names`
22
- * (`off` leaves out "Show my name", so every post is anonymous),
26
+ * (`off` leaves out the name and the "Post anonymously" switch, so every post
27
+ * is anonymous),
23
28
  * `readonly` (the board to scroll through and nothing else: see
24
29
  * `readonly.ts`), `demo` (sample posts in the page's memory, no server: see
25
- * `demo.ts`) and, with `demo` only, `screen` (`button`, `tiles`, `board`,
26
- * `write` or `sent`: that screen, held, for the website's configurator).
30
+ * `demo.ts`; `demo="owner"` is the owner's side of it) and, with `demo` only, `screen` (`button`, `tiles`, `board`,
31
+ * `write`, `sent` or `updates`: that screen, held, for the website's
32
+ * Make it yours).
27
33
  *
28
34
  * Properties, for things an attribute cannot carry: `signer`, `appLogin`,
29
- * `context`, `noise`, `strings`.
35
+ * `context`, `noise`, `strings` and, with `demo`, `samples`.
30
36
  *
31
37
  * Events: `pleasenobugs:posted` (`detail: { id, kind }`) and
32
38
  * `pleasenobugs:close`.
@@ -54,9 +60,15 @@ export declare class PleaseNoBugsElement extends HTMLElement {
54
60
  /** Words common in your app, so "said already?" ignores them: `['nim', 'wallet']`. */
55
61
  get noise(): string[] | undefined;
56
62
  set noise(v: string[] | undefined);
57
- /** Override any string, or supply a language: `{ 'board.title': 'Ideas box' }`. */
63
+ /** Override any string, or put the whole board in your app's language: `{ 'board.title': 'Ideas box' }`. */
58
64
  get strings(): Strings | undefined;
59
65
  set strings(v: Strings | undefined);
66
+ /**
67
+ * With `demo` only: the posts the demo board starts with, instead of its
68
+ * own, and no updates: `[{ kind: 'idea', text: 'Pin my contacts', votes: 12 }]`.
69
+ */
70
+ get samples(): DemoSample[] | undefined;
71
+ set samples(v: DemoSample[] | undefined);
60
72
  connectedCallback(): void;
61
73
  disconnectedCallback(): void;
62
74
  attributeChangedCallback(name: string): void;
@@ -82,12 +94,6 @@ export declare function readScreen(v: string | null): Screen | undefined;
82
94
  * readKinds('bug, review') // → ['bug', 'review']
83
95
  */
84
96
  export declare function readKinds(v: string | null): PostKind[] | undefined;
85
- /**
86
- * Black or white, whichever reads better on `color`. So `accent="#ffd400"`
87
- * gets dark text and `accent="#1f2348"` gets white, without the developer
88
- * having to know there was a question.
89
- */
90
- export declare function readableOn(color: string): string;
91
97
  /** Register the element once, however many times the script is loaded. */
92
98
  export declare function define(): void;
93
99
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/element.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC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,CADrC;IACD,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,EAGrC;IAED,sFAAsF;IACtF,IAAI,KAAK,IAGI,MAAM,EAAE,GAAG,SAAS,CADhC;IACD,IAAI,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,EAGhC;IAED,4GAA4G;IAC5G,IAAI,OAAO,IAGI,OAAO,GAAG,SAAS,CADjC;IACD,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,EAGjC;IAED;;;OAGG;IACH,IAAI,OAAO,IAGI,UAAU,EAAE,GAAG,SAAS,CADtC;IACD,IAAI,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,EAKtC;IAED,iBAAiB;IAYjB,oBAAoB;IAIpB,wBAAwB,CAAC,IAAI,EAAE,MAAM;IAKrC,2DAA2D;IAC3D,KAAK;CA4FN;AAID,oFAAoF;AACpF,KAAK,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;AAE9B;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAU/D;AAkOD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,EAAE,GAAG,SAAS,CAMlE;AAED,0EAA0E;AAC1E,wBAAgB,MAAM,SAIrB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,mBAAmB,CAAC;KACvC;CACF"}
@@ -0,0 +1,66 @@
1
+ import { type Message, type Post, type PostKind, type PostStatus } from '@pleasenobugs/core';
2
+ /** What only an owner can narrow the board to. */
3
+ export type OwnFilter = 'waiting' | 'hidden' | 'pending';
4
+ /**
5
+ * What the Filter panel narrows the board to. Inside a group any choice
6
+ * matches (Bugs and Ideas shows both); between groups every one has to
7
+ * (Bugs and Planned shows planned bugs). An empty group is no filter.
8
+ */
9
+ export interface BoardFilter {
10
+ kinds: PostKind[];
11
+ statuses: PostStatus[];
12
+ /** Only what you wrote yourself. */
13
+ mine: boolean;
14
+ /** Owners only. */
15
+ own: OwnFilter[];
16
+ }
17
+ export declare const NO_FILTER: BoardFilter;
18
+ /** How many filters are on, for the number on the Filter button. */
19
+ export declare function filtersOn(f: BoardFilter): number;
20
+ /**
21
+ * Whether a post passes the filter. A review has no status, so choosing a
22
+ * status leaves reviews out rather than pretending they are all open.
23
+ */
24
+ export declare function matchesFilter(p: Post, f: BoardFilter): boolean;
25
+ /** The words of a search, lower case, in the order typed. */
26
+ export declare function searchWords(query: string): string[];
27
+ /** Where a search found a post: its own text, or a message in the conversation under it. */
28
+ export type Found = {
29
+ in: 'text';
30
+ } | {
31
+ in: 'thread';
32
+ message: Message;
33
+ };
34
+ /**
35
+ * Whether a post matches a search, and where: every word has to be in it,
36
+ * anywhere in the post or its conversation, so "pixel camera" finds the bug
37
+ * about the camera whose author said "Pixel 7" when asked.
38
+ *
39
+ * Plain substrings, no ranking: a board is a list in the tens or hundreds,
40
+ * read top to bottom, and a search that hides how it decided is one people
41
+ * stop trusting.
42
+ *
43
+ * @example
44
+ * findIn({ text: 'Camera opens black', thread: [{ text: 'A Pixel 7', … }] }, 'pixel')
45
+ * // → { in: 'thread', message: { text: 'A Pixel 7', … } }
46
+ */
47
+ export declare function findIn(p: Post, query: string): Found | null;
48
+ /**
49
+ * A bit of a long text around the first word searched for, so a card can
50
+ * show why it matched without the whole message.
51
+ *
52
+ * @example
53
+ * snippet('Only on my old Samsung. My new phone is fine.', 'phone', 24) // → '…My new phone is fine.'
54
+ */
55
+ export declare function snippet(text: string, query: string, max?: number): string;
56
+ /**
57
+ * A text cut where the searched words are, so each can be marked.
58
+ *
59
+ * @example
60
+ * marks('My Pixel 6', 'pixel') // → [{ text: 'My ', hit: false }, { text: 'Pixel', hit: true }, { text: ' 6', hit: false }]
61
+ */
62
+ export declare function marks(text: string, query: string): {
63
+ text: string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