sliftutils 0.60.0 → 0.62.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/index.d.ts CHANGED
@@ -200,6 +200,25 @@ declare module "sliftutils/render-utils/FullscreenModal" {
200
200
 
201
201
  }
202
202
 
203
+ declare module "sliftutils/render-utils/GenericFormat" {
204
+ import preact from "preact";
205
+ export declare const errorMessage: string;
206
+ export declare const warnMessage: string;
207
+ export type RowType = {
208
+ [columnName: string]: unknown;
209
+ };
210
+ export type FormatContext<RowT extends RowType = RowType> = {
211
+ row?: RowT;
212
+ columnName?: RowT extends undefined ? string : keyof RowT;
213
+ };
214
+ export type JSXFormatter<T = unknown, RowT extends RowType = RowType> = (StringFormatters | `varray:${StringFormatters}` | `link:${string}` | ((value: T, context?: FormatContext<RowT>) => preact.ComponentChild));
215
+ type StringFormatters = ("guess" | "string" | "number" | "timeSpan" | "date" | "error" | "link" | "toSpaceCase");
216
+ export declare function toSpaceCase(text: string): string;
217
+ export declare function formatValue(value: unknown, formatter?: JSXFormatter, context?: FormatContext): preact.ComponentChild;
218
+ export {};
219
+
220
+ }
221
+
203
222
  declare module "sliftutils/render-utils/Input" {
204
223
  import preact from "preact";
205
224
  export type InputProps = (preact.JSX.HTMLAttributes<HTMLInputElement> & {
@@ -483,6 +502,16 @@ declare module "sliftutils/render-utils/asyncObservable" {
483
502
 
484
503
  }
485
504
 
505
+ declare module "sliftutils/render-utils/colors" {
506
+ export declare const redButton: string;
507
+ export declare const yellowButton: string;
508
+ export declare const greenButton: string;
509
+ export declare const errorMessage: string;
510
+ export declare const warnMessage: string;
511
+ export declare const AnchorClass: string;
512
+
513
+ }
514
+
486
515
  declare module "sliftutils/render-utils/mobxTyped" {
487
516
  export declare function configureMobxNextFrameScheduler(): void;
488
517
 
@@ -1,4 +1,4 @@
1
- import { parseYAML } from "sliftutils/misc/yaml";
1
+ import { parseYAML } from "./yaml";
2
2
  import { retryFunctional } from "socket-function/src/batching";
3
3
  import { formatNumber } from "socket-function/src/formatting/format";
4
4
  import { getAPIKey } from "./apiKeys";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.60.0",
3
+ "version": "0.62.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -0,0 +1,15 @@
1
+ import preact from "preact";
2
+ export declare const errorMessage: string;
3
+ export declare const warnMessage: string;
4
+ export type RowType = {
5
+ [columnName: string]: unknown;
6
+ };
7
+ export type FormatContext<RowT extends RowType = RowType> = {
8
+ row?: RowT;
9
+ columnName?: RowT extends undefined ? string : keyof RowT;
10
+ };
11
+ export type JSXFormatter<T = unknown, RowT extends RowType = RowType> = (StringFormatters | `varray:${StringFormatters}` | `link:${string}` | ((value: T, context?: FormatContext<RowT>) => preact.ComponentChild));
12
+ type StringFormatters = ("guess" | "string" | "number" | "timeSpan" | "date" | "error" | "link" | "toSpaceCase");
13
+ export declare function toSpaceCase(text: string): string;
14
+ export declare function formatValue(value: unknown, formatter?: JSXFormatter, context?: FormatContext): preact.ComponentChild;
15
+ export {};
@@ -5,12 +5,10 @@ import { css } from "typesafecss";
5
5
 
6
6
  export const errorMessage = css.hsl(0, 75, 50).color("white", "important", "soft")
7
7
  .padding("4px 6px", "soft")
8
- .whiteSpace("pre-wrap").display("inline-block", "soft")
9
- ;
8
+ .whiteSpace("pre-wrap").display("inline-block", "soft") as string;
10
9
  export const warnMessage = css.hsl(50, 75, 50).color("hsl(0, 0%, 7%)", "important", "soft")
11
10
  .padding("4px 6px", "soft")
12
- .whiteSpace("pre-wrap").display("inline-block", "soft")
13
- ;
11
+ .whiteSpace("pre-wrap").display("inline-block", "soft") as string;
14
12
 
15
13
  export type RowType = { [columnName: string]: unknown };
16
14
  export type FormatContext<RowT extends RowType = RowType> = {
@@ -0,0 +1,6 @@
1
+ export declare const redButton: string;
2
+ export declare const yellowButton: string;
3
+ export declare const greenButton: string;
4
+ export declare const errorMessage: string;
5
+ export declare const warnMessage: string;
6
+ export declare const AnchorClass: string;
@@ -1,19 +1,17 @@
1
1
  import { css } from "typesafecss";
2
2
 
3
- export const redButton = css.hsl(0, 75, 50).bord(1, "hsl(0, 75%, 75%)").background("hsl(0, 75%, 75%)", "hover");
4
- export const yellowButton = css.hsl(50, 90, 50).bord(1, "hsl(40, 75%, 75%)").color("hsl(0, 0%, 16%)!important").background("hsl(40, 75%, 75%)", "hover");
5
- export const greenButton = css.hsl(110, 65, 45).bord(1, { h: 110, s: 65, l: 75 }).background("hsl(110, 65%, 90%)", "hover");
3
+ export const redButton = css.hsl(0, 75, 50).bord(1, "hsl(0, 75%, 75%)").background("hsl(0, 75%, 75%)", "hover") as string;
4
+ export const yellowButton = css.hsl(50, 90, 50).bord(1, "hsl(40, 75%, 75%)").color("hsl(0, 0%, 16%)!important").background("hsl(40, 75%, 75%)", "hover") as string;
5
+ export const greenButton = css.hsl(110, 65, 45).bord(1, { h: 110, s: 65, l: 75 }).background("hsl(110, 65%, 90%)", "hover") as string;
6
6
 
7
7
  export const errorMessage = css.hsl(0, 75, 50).color("white")
8
8
  .padding("4px 6px", "soft")
9
- .whiteSpace("pre-wrap").display("inline-block", "soft")
10
- ;
9
+ .whiteSpace("pre-wrap").display("inline-block", "soft") as string;
11
10
  export const warnMessage = css.hsl(50, 75, 50).color("hsl(0, 0%, 7%)", "important", "soft")
12
11
  .padding("4px 6px", "soft")
13
- .whiteSpace("pre-wrap").display("inline-block", "soft")
14
- ;
12
+ .whiteSpace("pre-wrap").display("inline-block", "soft") as string;
15
13
 
16
14
 
17
15
  export const AnchorClass = (
18
- css.textDecoration("none").color("hsl(210, 75%, 65%)").opacity(0.8, "hover")
16
+ css.textDecoration("none").color("hsl(210, 75%, 65%)").opacity(0.8, "hover") as string
19
17
  );
@@ -95,7 +95,7 @@ export class TransactionStorage implements IStorage<Buffer> {
95
95
  ) {
96
96
  TransactionStorage.allStorage.push(this);
97
97
  // VERY useful for debugging.
98
- (globalThis as any)[`transactionStorage-${this.debugName}`] = this;
98
+ (globalThis as any)[`transactionStorage_${this.debugName}`] = this;
99
99
  }
100
100
  // Helps get rid of parse errors which constantly log. Also, uses less space
101
101
  public static async compressAll() {