sliftutils 0.61.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> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliftutils",
3
- "version": "0.61.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> = {
@@ -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() {