@small-web/kitten-types 1.1.5 → 2.0.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 (80) hide show
  1. package/README.md +9 -2
  2. package/fragments.d.ts +13 -14
  3. package/global.d.ts +6 -1096
  4. package/index.d.ts +7 -27
  5. package/kitten/src/AppDatabase.d.ts +10 -0
  6. package/kitten/src/AppRepository.d.ts +101 -0
  7. package/kitten/src/AutomaticUpdates.d.ts +21 -0
  8. package/kitten/src/Files.d.ts +61 -0
  9. package/kitten/src/GlobalInternalDatabase.d.ts +22 -0
  10. package/kitten/src/InternalDatabase.d.ts +7 -0
  11. package/kitten/src/REPL.d.ts +5 -0
  12. package/kitten/src/Routes.d.ts +41 -0
  13. package/kitten/src/Server.d.ts +76 -0
  14. package/kitten/src/ServerError.d.ts +6 -0
  15. package/kitten/src/Sessions.d.ts +32 -0
  16. package/kitten/src/Uploads.d.ts +20 -0
  17. package/kitten/src/Utils.d.ts +79 -0
  18. package/kitten/src/cli/commands/db.d.ts +48 -0
  19. package/kitten/src/cli/commands/deploy.d.ts +16 -0
  20. package/kitten/src/cli/commands/disable.d.ts +9 -0
  21. package/kitten/src/cli/commands/enable.d.ts +9 -0
  22. package/kitten/src/cli/commands/logs.d.ts +15 -0
  23. package/kitten/src/cli/commands/restart.d.ts +11 -0
  24. package/kitten/src/cli/commands/run.d.ts +15 -0
  25. package/kitten/src/cli/commands/serve.d.ts +13 -0
  26. package/kitten/src/cli/commands/shell.d.ts +1 -0
  27. package/kitten/src/cli/commands/start.d.ts +9 -0
  28. package/kitten/src/cli/commands/status.d.ts +15 -0
  29. package/kitten/src/cli/commands/stop.d.ts +9 -0
  30. package/kitten/src/cli/commands/uninstall.d.ts +9 -0
  31. package/kitten/src/cli/commands/update.d.ts +7 -0
  32. package/kitten/src/cli/index.d.ts +55 -0
  33. package/kitten/src/cli/lib/WarningBox.d.ts +8 -0
  34. package/kitten/src/cli/lib/header.d.ts +10 -0
  35. package/kitten/src/components/SvgSpinner.component.d.ts +9 -0
  36. package/kitten/src/lib/KittenComponent.d.ts +340 -0
  37. package/kitten/src/lib/KittenMoji.d.ts +35 -0
  38. package/kitten/src/lib/KittenPackage.d.ts +56 -0
  39. package/kitten/src/lib/KittenPage.d.ts +202 -0
  40. package/kitten/src/lib/Version.d.ts +49 -0
  41. package/kitten/src/lib/ansi-highlight-html.d.ts +5 -0
  42. package/kitten/src/lib/components/stateful/CopyButton.component.d.ts +14 -0
  43. package/kitten/src/lib/components/stateless/copyButton.component.d.ts +21 -0
  44. package/kitten/src/lib/crypto.d.ts +95 -0
  45. package/kitten/src/lib/deploy.d.ts +20 -0
  46. package/kitten/src/lib/ensure.d.ts +28 -0
  47. package/kitten/src/lib/fragments.d.ts +1 -0
  48. package/kitten/src/lib/globals.d.ts +10 -0
  49. package/kitten/src/lib/html.d.ts +61 -0
  50. package/kitten/src/lib/markdown.d.ts +16 -0
  51. package/kitten/src/lib/paths.d.ts +25 -0
  52. package/kitten/src/lib/service-status.d.ts +14 -0
  53. package/kitten/src/lib/system-exit-codes.d.ts +39 -0
  54. package/kitten/src/lib/terminal-link.d.ts +24 -0
  55. package/kitten/src/middleware/authentication.d.ts +8 -0
  56. package/kitten/src/middleware/index.d.ts +5 -0
  57. package/kitten/src/middleware/request-and-response-helpers.d.ts +6 -0
  58. package/kitten/src/middleware/request-log.d.ts +10 -0
  59. package/kitten/src/middleware/sessions.d.ts +3 -0
  60. package/kitten/src/middleware/stats.d.ts +8 -0
  61. package/kitten/src/middleware/trailing-slashes.d.ts +11 -0
  62. package/kitten/src/middleware/websocket.d.ts +14 -0
  63. package/kitten/src/routes/HttpRoute.d.ts +16 -0
  64. package/kitten/src/routes/LazilyLoadedRoute.d.ts +15 -0
  65. package/kitten/src/routes/PageRoute.d.ts +54 -0
  66. package/kitten/src/routes/PageSocketRoute.d.ts +42 -0
  67. package/kitten/src/routes/PostRoute.d.ts +64 -0
  68. package/kitten/src/routes/StaticRoute.d.ts +17 -0
  69. package/kitten/src/routes/WebSocketRoute.d.ts +21 -0
  70. package/kitten/src/routes/lib/validator.d.ts +18 -0
  71. package/kitten/src/types/fragments.d.ts +14 -0
  72. package/kitten/src/types/globals.d.ts +1239 -0
  73. package/kitten/src/types/index.d.ts +12 -0
  74. package/kitten/src/types/types.d.ts +476 -0
  75. package/kitten/third-party-libraries-with-missing-type-information/index.d.ts +37 -0
  76. package/package.json +16 -5
  77. package/types.d.ts +5 -712
  78. package/polka/index.d.ts +0 -111
  79. package/slugify/index.d.ts +0 -246
  80. /package/{ws → kitten/third-party-libraries-with-missing-type-information/ws}/index.d.ts +0 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ Kitten command-line interface (CLI): serve command.
3
+
4
+ Copyright ⓒ 2021-present, Aral Balkan
5
+ Small Technology Foundation
6
+
7
+ License: AGPL version 3.0.
8
+ */
9
+ import type { ServerOptions } from '../index.ts';
10
+ /**
11
+ Start Kitten server instance.
12
+ */
13
+ export default function serve(pathToServe: string | undefined, options: ServerOptions): Promise<void>;
@@ -0,0 +1 @@
1
+ export default function shell(): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ Kitten command-line interface (CLI): start command.
3
+
4
+ Copyright ⓒ 2022-present, Aral Balkan
5
+ Small Technology Foundation
6
+
7
+ License: AGPL version 3.0.
8
+ */
9
+ export default function stop(_options?: object): void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ Kitten command-line interface (CLI): status command.
3
+
4
+ Display Kitten systemd service status.
5
+
6
+ Copyright ⓒ 2022-present, Aral Balkan
7
+ Small Technology Foundation
8
+
9
+ License: AGPL version 3.0.
10
+ */
11
+ /**
12
+ Display error in console and reject promise.
13
+ */
14
+ export declare function rejectWithError(message: string, reject: (reason?: any) => void): void;
15
+ export default function status(_options?: object): Promise<unknown>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ Kitten command-line interface (CLI): stop command.
3
+
4
+ Copyright ⓒ 2022-present, Aral Balkan
5
+ Small Technology Foundation
6
+
7
+ License: AGPL version 3.0.
8
+ */
9
+ export default function stop(_options?: object): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ Kitten command-line interface (CLI): uninstall command.
3
+
4
+ Copyright ⓒ 2021-present, Aral Balkan
5
+ Small Technology Foundation
6
+
7
+ License: AGPL version 3.0.
8
+ */
9
+ export default function uninstall(): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import type { ServerOptions } from '../index.ts';
2
+ /**
3
+ Update the Kitten package.
4
+ */
5
+ export default function (options: ServerOptions & {
6
+ 'api-version'?: number;
7
+ }): Promise<void>;
@@ -0,0 +1,55 @@
1
+ /**
2
+ Kitten Command Line Interface (CLI).
3
+
4
+ Copyright © 2022-present Aral Balkan, Small Technology Foundation.
5
+ Licensed under GNU AGPL version 3.0.
6
+ */
7
+ import sade from 'sade';
8
+ export declare const COMMANDS: string[];
9
+ export declare const COMMANDS_AND_ALIASES: string[];
10
+ declare const OPTION_DOMAIN = "domain";
11
+ declare const OPTION_ALIASES = "aliases";
12
+ declare const OPTION_PORT = "port";
13
+ declare const OPTION_OPEN = "open";
14
+ declare const OPTION_WORKING_DIRECTORY = "working-directory";
15
+ declare const OPTION_DOMAIN_TOKEN = "domain-token";
16
+ declare const OPTION_SMALL_WEB_HOST_DOMAIN = "small-web-host-domain";
17
+ declare const OPTION_SINCE = "since";
18
+ declare const OPTION_ALL = "all";
19
+ export type WorkingDirectoryOption = {
20
+ [OPTION_WORKING_DIRECTORY]: string;
21
+ };
22
+ export type DomainAndAliasesOptions = {
23
+ [OPTION_DOMAIN]?: string;
24
+ [OPTION_ALIASES]?: string;
25
+ };
26
+ export type DomainTokenOption = {
27
+ [OPTION_DOMAIN_TOKEN]?: string;
28
+ };
29
+ export type SmallWebHostDomainOption = {
30
+ [OPTION_SMALL_WEB_HOST_DOMAIN]?: string;
31
+ };
32
+ export type PortOption = {
33
+ [OPTION_PORT]?: number;
34
+ };
35
+ export type OpenOption = {
36
+ [OPTION_OPEN]?: boolean;
37
+ };
38
+ export type SinceOption = {
39
+ [OPTION_SINCE]: string;
40
+ };
41
+ export type AllOption = {
42
+ [OPTION_ALL]: boolean;
43
+ };
44
+ export type ServerOptions = WorkingDirectoryOption & DomainAndAliasesOptions & PortOption & OpenOption;
45
+ export type DeploymentOptions = DomainAndAliasesOptions & DomainTokenOption & SmallWebHostDomainOption;
46
+ export type TailOptions = ServerOptions & AllOption;
47
+ export default class CommandLineInterface {
48
+ commands: ReturnType<typeof sade>;
49
+ constructor();
50
+ /**
51
+ Parse process arguments.
52
+ */
53
+ parse(): Promise<void>;
54
+ }
55
+ export {};
@@ -0,0 +1,8 @@
1
+ export default class WarningBox {
2
+ lines: string[];
3
+ constructor();
4
+ line(line: string): void;
5
+ emptyLine(): void;
6
+ render(): string;
7
+ print(): void;
8
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ Kitten Command Line Interface (CLI) header.
3
+
4
+ Copyright © 2022-present Aral Balkan, Small Technology Foundation.
5
+ Licensed under GNU AGPL version 3.0.
6
+ */
7
+ /**
8
+ Display command-line interface header.
9
+ */
10
+ export default function header(): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ SVG spinner component.
3
+
4
+ Spinner SVG courtesy of https://github.com/n3r4zzurr0/svg-spinners/blob/main/svg-css/bars-rotate-fade.svg?short_path=a639ef3
5
+ */
6
+ declare const _default: ({ small }: {
7
+ small?: boolean | undefined;
8
+ }) => string | string[] | Promise<string | string[]>;
9
+ export default _default;
@@ -0,0 +1,340 @@
1
+ /**
2
+ Kitten Component.
3
+
4
+ A class that makes it easier to author hierarchies of connected components.
5
+
6
+ Handles wiring up and disposal of event listeners for you and gives you an
7
+ ergonomic, class-based way of writing maintainable applications that take
8
+ advantage of Kitten’s Streaming HTML workflow while working with well-encapsulated,
9
+ self-contained components in a clear hierarchy.
10
+
11
+ Extend and instantiate this class to create your own components (components, fragments,
12
+ layout components, and pages) and provide at least an override for the `html()` method,
13
+ which is just a function that returns `kitten.html`.
14
+
15
+ @example
16
+
17
+ // index.page.ts
18
+ //
19
+ // Updates a persisted counter via + and - buttons.
20
+ //
21
+ // Make sure you `npm install --save-dev @small-web/kitten types` to load the type information for the global `kitten` object.
22
+
23
+ // Initialise the database with a persisted counter object.
24
+ kitten.db.counter ??= { count: 0 }
25
+
26
+ export default class CounterPage extends kitten.Page {
27
+ // Counter is strongly typed via inference (see constructor).
28
+ counter
29
+
30
+ // The constructor is where we initialise state, including setting up any child components we want available at initial render.
31
+ constructor () {
32
+ super()
33
+ this.counter = this.addChild(new Counter())
34
+ }
35
+
36
+ override html () {
37
+ // While this.counter is a reference to the Counter KittenComponent, and not it’s render function, Kitten knows to use its `component` property to get a reference to its render function while rendering it. If you want to be explicit about it (e.g., to visually differentiate stateful components from stateless ones in your kitten.html), you can write `<${this.counter.component}` manually, but it’s not necessary.
38
+ return kitten.html`
39
+ <page css>
40
+ <h1>Counter</h1>
41
+ <${this.counter} />
42
+ `
43
+ }
44
+ }
45
+
46
+ class Counter extends kitten.Component {
47
+ override html () {
48
+ return kitten.html`
49
+ <div>
50
+ <div
51
+ id='count'
52
+ aria-live='assertive'
53
+ >
54
+ ${kitten.db.counter.count}
55
+ </div>
56
+ <button name='update' connect data='{value: -1}' aria-label='decrement'>-</button>
57
+ <button name='update' connect data='{value: 1}' aria-label='increment'>+</button>
58
+ <style inline>
59
+ @scope {
60
+ div {
61
+ font-size: 3em;
62
+ margin: 0.25em 0;
63
+ }
64
+ }
65
+ </style>
66
+ </div>
67
+ `
68
+ }
69
+
70
+ onUpdate (data: { value: number } ) {
71
+ kitten.db.counter.count += data.value
72
+ this.update()
73
+ }
74
+ }
75
+ */
76
+ import type KittenPage from './KittenPage.ts';
77
+ import type { KittenPageEvent } from './KittenPage.ts';
78
+ import EventEmitter from 'node:events';
79
+ /**
80
+ Type definitions. First one required due to following shenanigans:
81
+ https://github.com/Microsoft/TypeScript/issues/20007#issuecomment-2255964704
82
+ */
83
+ export type JavaScriptFunction = (...args: any[]) => any;
84
+ type Constructor<T> = new (...args: any[]) => T;
85
+ type BoundComponentRenderFunction<T extends KittenComponent> = ((...args: Parameters<T['html']>) => Promise<Awaited<ReturnType<T['html']>>>) & {
86
+ boundObject: T;
87
+ };
88
+ export declare class Listener {
89
+ target: EventEmitter<[never]>;
90
+ eventName: string;
91
+ eventHandler: JavaScriptFunction;
92
+ /**
93
+ Create EventEmitter listener.
94
+ */
95
+ constructor(target: EventEmitter, eventName: string, eventHandler: JavaScriptFunction);
96
+ remove(): void;
97
+ }
98
+ export default class KittenComponent extends EventEmitter {
99
+ #private;
100
+ id: string;
101
+ _listeners: Array<Listener>;
102
+ _children: Array<KittenComponent>;
103
+ _isAttached: boolean;
104
+ _isConnected: boolean;
105
+ /**
106
+ Override the constructor to initialise child components and save initial component state.
107
+
108
+ Remember to call super() before anything else.
109
+ */
110
+ constructor();
111
+ /**
112
+ Overridable (hook) methods.
113
+
114
+ Required:
115
+
116
+ - html() - render function; outputs kitten.html. May be synchronous or asynchronous.
117
+
118
+ Optional:
119
+
120
+ - onConnect() - called when the page this component is on (or is) connects.
121
+
122
+ - onDisconnect() - called when the page this component is on (or is) disconnects.
123
+
124
+ - onAddToParent() - called when component is added to parent (page might not be connected yet).
125
+ */
126
+ /**
127
+ Override this function with your own function that returns kitten.html.
128
+ */
129
+ html({ ...props }?: {}): string | string[] | Promise<string | string[]>;
130
+ /**
131
+ Optional hook: override this method to run custom logic when the component has been added to the component hierarchy via addChild() (attached to its parent and, thus, to the component hiearchy).
132
+
133
+ At this point it will have a reference to its parent component, the page it’s on, and to any instance data that it might have, (at `this._parent`, `this._page`, and `this.`, respectively.)
134
+
135
+ However, there is no guarantee that the page this component is attached to has connected to the client via its automatic WebSocket. For that, rely on the
136
+ `onConnect()` handler instead.
137
+
138
+ TODO: Is there any need to keep this around?
139
+ */
140
+ onAddToParent(): void;
141
+ /**
142
+ Optional hook: override this method to provide custom logic for your app to be run when the page this component is on connects to the client via its WebSocket.
143
+
144
+ This hook will get called not just for initially-rendered components when the page first connects but also for any components dynamically added to an already-connected page/component hierarchy after the fact.
145
+
146
+ (So you can be sure that this handler will be called once when a component is fully initialised on a connected page. This is a good place to add event handlers or to start streaming updates to the client.)
147
+ */
148
+ onConnect(_parameterObject?: {}): void;
149
+ /**
150
+ Optional hook: override this method to run custom logic when the page this component is on disconnects from the client via its WebSocket. (This usually means the page the about to be unloaded, either because the person is nagivating away from it or reloading it.)
151
+ */
152
+ onDisconnect(_parameterObject?: {}): void;
153
+ /**
154
+ Returns a bound version of the render function that can be used in Kitten HTML templates.
155
+
156
+ It’s always async so mixed sync/async component hierarchies in Kitten HTML are uniformly awaitable (the renderer relies on the wrapper’s AsyncFunction identity and on boundObject).
157
+ */
158
+ get component(): BoundComponentRenderFunction<this>;
159
+ /**
160
+ Reference to the page this component is attached to.
161
+
162
+ You should ideally not use this. Instead dispatch an event from your component that your page can react to.
163
+ */
164
+ get _page(): KittenPage;
165
+ set _page(page: KittenPage);
166
+ /**
167
+ Reference to the parent component this component is attached to.
168
+
169
+ You should ideally not use this. Instead dispatch an event from your component that your parent can listen for and react to.
170
+ */
171
+ get _parent(): KittenComponent;
172
+ set _parent(parent: KittenComponent);
173
+ /**
174
+
175
+ Adds child component to this one and returns a reference to it.
176
+
177
+ Canonical usage:
178
+
179
+ this.childComponent = this.addChild(new ChildComponent(some, instance, props))
180
+
181
+ Child components are entered into the event bubbling hierarchy and contain a reference to the page that they’re on.
182
+
183
+ Note: the page the component is added to might not have connected yet.
184
+ */
185
+ addChild<T extends KittenComponent>(component: T): T;
186
+ /**
187
+ Removes a child and returns a reference to it.
188
+
189
+ If child cannot be found, returns null.
190
+
191
+ Usually called by the child itself when it is being removed.
192
+ */
193
+ removeChild<T extends KittenComponent>(component: T): T | null;
194
+ /**
195
+ Gets all components of a given type (useful when you have collections of child components that you want to render, say, in a list).
196
+ */
197
+ childrenOfType<T extends KittenComponent>(type: Constructor<T>): T[];
198
+ /**
199
+ Returns the first child component encountered of type T. Use when you know there is only one child of type T and you don’t want to a reference to it in your KittenComponent subclass.
200
+
201
+ Returns undefined if a child of type T cannot be found.
202
+ */
203
+ childOfType<T extends KittenComponent>(type: Constructor<T>): T | undefined;
204
+ /**
205
+ Add an event handler. Event listening and listener clean-up
206
+ are automatically handled so the author doesn’t have to worry
207
+ about implementing this finickety aspect manually.
208
+ */
209
+ addEventHandler(target: EventEmitter, eventName: string, eventHandler: (this: this, ...args: any[]) => any): void;
210
+ /**
211
+ Helper: emits page-wide event on the page this component is on.
212
+ */
213
+ emitPageEvent(eventName: string, ...args: any): void;
214
+ /**
215
+ Helper: emits session-wide event on the session this page belongs to.
216
+ */
217
+ emitSessionEvent(eventName: string, ...args: any): void;
218
+ /**
219
+ Helper: emits global event on kitten.events.
220
+ */
221
+ emitGlobalEvent(eventName: string, ...args: any): void;
222
+ /**
223
+ A helper for adding an event handler and streaming an updated
224
+ version of the computer to the client.
225
+ */
226
+ updateOnEvent(eventName: string): void;
227
+ /**
228
+ Helper for sending an updated version of this component to the page.
229
+
230
+ Also handles removal of event listeners for itself and all its
231
+ children so we don’t have any leaks.
232
+ */
233
+ update(): Promise<void>;
234
+ /**
235
+ Helper for removing this component from the live component hierachy.
236
+
237
+ Also handles removal of event listeners for itself and all its children so we don’t have any leaks.
238
+ */
239
+ remove(): void;
240
+ /**
241
+ Routes an event to the correct component by ID by recursively visiting descendants.
242
+ */
243
+ _routeEvent(kittenPageEvent: KittenPageEvent): boolean;
244
+ _callEventHandler(kittenPageEvent: KittenPageEvent): void;
245
+ /**
246
+ The internal onConnect handler that gets called by Kitten.
247
+ We use this to connect event handlers, listen for events,
248
+ and inform connected components to do the same.
249
+ */
250
+ _onConnect(page: KittenPage): void;
251
+ /**
252
+ The internal onDisconnect handler that gets called by Kitten.
253
+ We use this to remove event listeners and and inform connected
254
+ components to do the same.
255
+ */
256
+ _onDisconnect(page: KittenPage): void;
257
+ /**
258
+ Introspection API.
259
+
260
+ These properties help authors debug their running apps using the Kitten Shell (REPL)
261
+ */
262
+ /**
263
+ Displays component hierarchy, methods, and properties of the current component.
264
+ */
265
+ $info(): void;
266
+ /**
267
+ Returns the “name” of this page: i.e., it’s class name.
268
+ */
269
+ get $name(): string;
270
+ /**
271
+ Returns all properties on this component.
272
+ */
273
+ get $properties(): string[];
274
+ /**
275
+ The names of this component’s “public” properties.
276
+
277
+ We use “public” very loosely to mean any property not starting with an underscore (to keep the display clean of internal properties).
278
+ */
279
+ get $publicProperties(): string[];
280
+ /**
281
+ The names of this component’s “internal” properties.
282
+
283
+ We use “internal” very loosely to mean any property starting with an underscore (to keep the display clean of internal properties).
284
+ */
285
+ get $internalProperties(): string[];
286
+ /**
287
+ The methods of this component.
288
+ */
289
+ get $methods(): string[];
290
+ /**
291
+ Returns the index and names of the child components of this component.
292
+ */
293
+ get $children(): string[];
294
+ /**
295
+ Returns a pretty representation of the rough size.
296
+ */
297
+ get $size(): string;
298
+ /**
299
+ Helper: returns a byte value in pretty, human-friendly terms.
300
+ */
301
+ ___prettyBytes(bytes: number, decimalPlaces?: number): string;
302
+ /**
303
+ Returns the rough size of this object in bytes.
304
+ */
305
+ get ___size(): number;
306
+ /**
307
+ Returns a recursive tree view of this component and its descendents.
308
+ */
309
+ $tree(): string;
310
+ /**
311
+ (Internal) Returns the short ID for this component.
312
+
313
+ The short ID is the first fragment of the UUID. This has 32bits of entropy which should be adequate for this use case.
314
+
315
+ (The 50% collision threshold via the birthday problem formula – https://en.wikipedia.org/wiki/Birthday_problem – is ~77,163 components and at 1,000 components there is a 0.01% chance of collisions. At 100 components, the risk is 0%. If you have 1,000+ components on your page, you have bigger issues to worry about.)
316
+ */
317
+ get ___shortId(): string;
318
+ /**
319
+ (Internal) Transform [class X extends Y] to X (Y)
320
+ */
321
+ ___prettyName({ isTitle, reverse }?: {
322
+ isTitle?: boolean | undefined;
323
+ reverse?: boolean | undefined;
324
+ }): string;
325
+ /**
326
+ Returns a reference to the component (in this component’s entire component tree) with the passed short ID, or undefined if not found.
327
+
328
+ @param shortId - The first fragment of this component’s UUID, as shown in the output of the __tree() method.
329
+ */
330
+ $componentWithId(shortId: string): KittenComponent | undefined;
331
+ /**
332
+ Returns a flattened array of all the children of the component hierarchy starting at this component (recursive).
333
+ */
334
+ ___allChildrenFlattened(): Array<KittenComponent>;
335
+ /**
336
+ (Internal) Recursive tree view.
337
+ */
338
+ ___tree(prefix?: string): string;
339
+ }
340
+ export {};
@@ -0,0 +1,35 @@
1
+ /**
2
+ KittenMoji
3
+
4
+ Emoji map and methods used to Base256 encode a person’s ed25519
5
+ private key. Emoji is chosen on purpose to make it impossible
6
+ for the person to type it in, thereby necessitating the use of
7
+ copy and paste and a password manager (and hence good security
8
+ hygiene).
9
+
10
+ The emoji chosen for the Base256 alphabet are mainly from the
11
+ animals and plants and food groups with some exceptions (to
12
+ avoid common phobias or triggers, etc., and because there are
13
+ just some that have special meaning for me or that I like.) – Aral ;)
14
+
15
+ All emoji in this list are surrogate pairs without any
16
+ special modifiers.
17
+
18
+ The KittenMoji standard is being frozen in time on Friday,
19
+ November 25th, 2022 and the string created by joining the
20
+ array has the following sha256 hash:
21
+
22
+ d9b1533de36a75c9e47f1713aada4ff332918ff0d3cada5b645ca84d73dd50d6
23
+
24
+ ⚠️ Node-native subgraph: this module is loaded natively by Node.js via
25
+ type stripping. Only use erasable TypeScript syntax here. It is also
26
+ bundled for the browser (via crypto.ts), so it must remain platform-neutral.
27
+ */
28
+ /**
29
+ Convert secret bytes to emoji string.
30
+ */
31
+ export declare function secretToEmojiString(secret: Uint8Array): string;
32
+ /**
33
+ Convert emoji string to secret bytes.
34
+ */
35
+ export declare function emojiStringToSecret(emojiString: string): Uint8Array;
@@ -0,0 +1,56 @@
1
+ /**
2
+ Kitten Package.
3
+ */
4
+ import Version from './Version.ts';
5
+ export type RemoteVersionDetails = {
6
+ versionStamp: number;
7
+ gitHash: string;
8
+ apiVersion: number;
9
+ nodeVersion: string;
10
+ exactVersion: string;
11
+ buildDate: Date;
12
+ releaseDate: Date;
13
+ _buildDate: string;
14
+ _releaseDate: string;
15
+ upload: import('../types/index.ts').Upload;
16
+ };
17
+ /**
18
+ Represents the currently-installed Kitten package.
19
+
20
+ Provides information about and manages updates of the
21
+ package by communicating with Kitten’s deployment site
22
+ (https://kittens.small-web.org).
23
+
24
+ _Note that this class does NOT manage automatic updates.
25
+ For that, please see the AutomaticUpdates class._
26
+ */
27
+ export default class KittenPackage {
28
+ static instance: KittenPackage;
29
+ currentVersion: Version;
30
+ apiVersion: number;
31
+ limitByApiVersion: boolean;
32
+ versionCheckUrl: string;
33
+ latestVersion: RemoteVersionDetails | undefined;
34
+ compatibleVersion: RemoteVersionDetails | undefined;
35
+ latestRecommendedVersion: RemoteVersionDetails | undefined;
36
+ static getInstance(): KittenPackage;
37
+ constructor();
38
+ get hasCompatibleVersion(): boolean;
39
+ get isLatestReleaseVersion(): boolean;
40
+ get isMoreRecentThanReleaseVersion(): boolean;
41
+ get canBeUpgraded(): boolean;
42
+ /**
43
+ Upgrades the Kitten package to the latest recommended version.
44
+
45
+ Note that if you’re running a development version, this will actually result
46
+ in a downgrade to the latest available published package. Make sure your
47
+ interface detects this state and prompts before downgrading.
48
+
49
+ @throws
50
+ */
51
+ upgrade(apiVersion?: number): void;
52
+ /**
53
+ Fetches the latest version information from kittens.small-web.org.
54
+ */
55
+ update(): Promise<void>;
56
+ }