elbe-ui 0.2.26 → 0.2.30

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 (64) hide show
  1. package/dist/elbe.css +621 -0
  2. package/dist/index.d.ts +1548 -17
  3. package/dist/index.js +63 -18577
  4. package/package.json +15 -13
  5. package/dist/bit/bit.d.ts +0 -34
  6. package/dist/bit/ctrl_bit.d.ts +0 -30
  7. package/dist/service/s_api.d.ts +0 -30
  8. package/dist/ui/color_theme.d.ts +0 -5
  9. package/dist/ui/components/badge.d.ts +0 -25
  10. package/dist/ui/components/box.d.ts +0 -1027
  11. package/dist/ui/components/button.d.ts +0 -23
  12. package/dist/ui/components/card.d.ts +0 -14
  13. package/dist/ui/components/dialog.d.ts +0 -8
  14. package/dist/ui/components/error_view.d.ts +0 -15
  15. package/dist/ui/components/flex.d.ts +0 -11
  16. package/dist/ui/components/icon_button.d.ts +0 -19
  17. package/dist/ui/components/input/checkbox.d.ts +0 -6
  18. package/dist/ui/components/input/input_field.d.ts +0 -22
  19. package/dist/ui/components/input/range.d.ts +0 -8
  20. package/dist/ui/components/input/select.d.ts +0 -10
  21. package/dist/ui/components/input/text_area.d.ts +0 -10
  22. package/dist/ui/components/padded.d.ts +0 -25
  23. package/dist/ui/components/scaffold.d.ts +0 -23
  24. package/dist/ui/components/spinner.d.ts +0 -3
  25. package/dist/ui/components/text.d.ts +0 -33
  26. package/dist/ui/components/toggle_button.d.ts +0 -12
  27. package/dist/ui/components/util.d.ts +0 -3
  28. package/dist/ui/util/confirm_dialog.d.ts +0 -10
  29. package/dist/ui/util/error_view.d.ts +0 -1
  30. package/dist/ui/util/toast.d.ts +0 -5
  31. package/dist/ui/util/util.d.ts +0 -19
  32. package/elbe.scss +0 -100
  33. package/src/bit/bit.tsx +0 -128
  34. package/src/bit/ctrl_bit.tsx +0 -112
  35. package/src/index.tsx +0 -29
  36. package/src/service/s_api.ts +0 -102
  37. package/src/ui/color_theme.ts +0 -24
  38. package/src/ui/components/badge.tsx +0 -78
  39. package/src/ui/components/box.tsx +0 -49
  40. package/src/ui/components/button.tsx +0 -61
  41. package/src/ui/components/card.tsx +0 -45
  42. package/src/ui/components/dialog.tsx +0 -51
  43. package/src/ui/components/error_view.tsx +0 -72
  44. package/src/ui/components/flex.tsx +0 -64
  45. package/src/ui/components/icon_button.tsx +0 -56
  46. package/src/ui/components/input/checkbox.tsx +0 -32
  47. package/src/ui/components/input/input_field.tsx +0 -57
  48. package/src/ui/components/input/range.tsx +0 -37
  49. package/src/ui/components/input/select.tsx +0 -29
  50. package/src/ui/components/input/text_area.tsx +0 -45
  51. package/src/ui/components/padded.tsx +0 -62
  52. package/src/ui/components/scaffold.tsx +0 -79
  53. package/src/ui/components/spinner.tsx +0 -11
  54. package/src/ui/components/text.tsx +0 -78
  55. package/src/ui/components/toggle_button.tsx +0 -52
  56. package/src/ui/components/util.tsx +0 -3
  57. package/src/ui/util/confirm_dialog.ts +0 -53
  58. package/src/ui/util/error_view.tsx +0 -16
  59. package/src/ui/util/toast.ts +0 -14
  60. package/src/ui/util/util.ts +0 -36
  61. package/style/color_style.scss +0 -149
  62. package/style/components.scss +0 -476
  63. package/style/root.scss +0 -50
  64. package/style/type_style.scss +0 -22
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elbe-ui",
3
3
  "type": "module",
4
- "version": "0.2.26",
4
+ "version": "0.2.30",
5
5
  "author": "Robin Naumann",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -14,30 +14,32 @@
14
14
  "flutter"
15
15
  ],
16
16
  "files": [
17
- "elbe.scss",
18
- "style/*.scss",
19
17
  "dist/*.js",
20
- "src/**/*.ts",
21
- "src/**/*.tsx",
22
- "dist/**/*.d.ts"
18
+ "dist/*.d.ts",
19
+ "dist/*.css"
23
20
  ],
24
21
  "main": "dist/index.js",
25
22
  "types": "dist/index.d.ts",
26
23
  "scripts": {
27
- "build": "rm -r ./dist ; bun build --target=node src/index.tsx --outdir=dist && bun run build:declaration",
28
- "build:declaration": "tsc --emitDeclarationOnly --project tsconfig.types.json"
24
+ "build:ts": "tsc",
25
+ "build:dts": "tsc --declaration",
26
+ "build:css": "sass --quiet-deps style/elbe.scss dist/elbe.css",
27
+ "build": "rm -rf ./dist && bun run build:ts && bun run build:dts && bun run build:css"
29
28
  },
30
- "module": "src/index.tsx",
31
29
  "devDependencies": {
32
- "@types/bun": "latest"
30
+ "@types/bun": "latest",
31
+ "sass": "^1.80.6"
33
32
  },
34
33
  "peerDependencies": {
35
- "typescript": "^5.0.0"
34
+ "typescript": "^5.5.4"
36
35
  },
37
36
  "dependencies": {
37
+ "@preact/preset-vite": "^2.9.1",
38
38
  "@preact/signals": "^1.3.0",
39
+ "colors-convert": "^1.4.1",
39
40
  "lucide-react": "^0.438.0",
40
- "preact": "^10.23.2",
41
- "preact-router": "^4.1.2"
41
+ "preact": "^10.24.2",
42
+ "preact-router": "^4.1.2",
43
+ "vite": "^5.4.10"
42
44
  }
43
45
  }
package/dist/bit/bit.d.ts DELETED
@@ -1,34 +0,0 @@
1
- import { Signal } from "@preact/signals";
2
- import { type PreactContext } from "preact";
3
- export interface BitUseInterface<C, T> {
4
- signal: Signal<BitState<T>>;
5
- ctrl: C;
6
- map: <D>(m: TriMap<T, D>) => D | preact.JSX.Element;
7
- onData: (f: (d: T) => any) => any;
8
- }
9
- interface BitData<C, T> {
10
- ctrl: C;
11
- state: Signal<BitState<T>>;
12
- }
13
- export interface BitState<T> {
14
- loading?: boolean;
15
- error?: any;
16
- data?: T;
17
- }
18
- export type BitContext<T, C> = PreactContext<BitData<T, C> | null>;
19
- export interface TriMap<T, D> {
20
- onLoading?: () => D;
21
- onError?: (e: string) => D;
22
- onData?: (value: T) => D;
23
- }
24
- export interface TWParams<T> {
25
- emit: (t: T) => void;
26
- emitLoading: () => void;
27
- emitError: (e: any) => void;
28
- map: <D>(m: TriMap<T, D>) => D;
29
- signal: Signal<BitState<T>>;
30
- }
31
- export declare function makeBit<C, T>(name: string): BitContext<C, T>;
32
- export declare function ProvideBit<I, C, T>(context: BitContext<C, T>, parameters: I, worker: (p: I, d: TWParams<T>, ctrl: C) => void, ctrl: (p: I, d: TWParams<T>) => C, children: any): import("preact").JSX.Element;
33
- export declare function useBit<C, T>(context: BitContext<C, T>): BitUseInterface<C, T>;
34
- export {};
@@ -1,30 +0,0 @@
1
- import type { JSX } from "preact/jsx-runtime";
2
- import type { BitUseInterface, TWParams } from "./bit";
3
- declare abstract class BitControl<I, DT> {
4
- p: I;
5
- bit: TWParams<DT>;
6
- constructor(p: I, bit: TWParams<DT>);
7
- act(fn: (b: DT) => Promise<void>): void;
8
- /**
9
- * Clean up resources. This is called once
10
- * the element is removed from the DOM.
11
- */
12
- dispose(): void;
13
- }
14
- export declare abstract class WorkerControl<I, DT> extends BitControl<I, DT> {
15
- reload: (() => Promise<void>) | null;
16
- abstract worker(): Promise<DT>;
17
- }
18
- export declare abstract class StreamControl<I, DT, Stream> extends BitControl<I, DT> {
19
- protected stream: Stream | null;
20
- abstract listen(): Stream;
21
- dispose(): void;
22
- abstract disposeStream(stream: Stream): void;
23
- }
24
- export declare function CtrlBit<I, DT, C extends BitControl<I, DT>>(ctrl: (p: I, d: TWParams<DT>) => C, name?: string): {
25
- Provide: (props: I & {
26
- children: React.ReactNode;
27
- }) => JSX.Element;
28
- use: () => BitUseInterface<C, DT>;
29
- };
30
- export {};
@@ -1,30 +0,0 @@
1
- export interface PostArgs {
2
- path?: {
3
- [key: string]: string | number | boolean | undefined;
4
- };
5
- query?: {
6
- [key: string]: string | number | boolean | undefined;
7
- };
8
- body?: any;
9
- }
10
- /**
11
- * ApiService is a simple wrapper around fetch that handles JSON serialization and error handling.
12
- * to use it, you must first call `ApiService.init(apiURL)` with the base URL of your API.
13
- */
14
- export declare class ApiService {
15
- private apiURL;
16
- private static _i;
17
- static get i(): ApiService;
18
- private constructor();
19
- static init(apiURL: string): void;
20
- private _fetch;
21
- get(path: string, args?: PostArgs): Promise<any>;
22
- post(path: string, args: PostArgs): Promise<any>;
23
- delete(path: string, args: PostArgs): Promise<any>;
24
- }
25
- export interface ApiError {
26
- code: number;
27
- message: string;
28
- data?: any;
29
- }
30
- export declare function ifApiError(e: any): ApiError | null;
@@ -1,5 +0,0 @@
1
- export type ElbeColorStyles = "accent" | "error" | "warning" | "success" | "info";
2
- export type ElbeColorManners = "major" | "minor" | "action" | "integrated";
3
- export type ElbeColorThemes = "primary" | "secondary" | "inverse";
4
- export type ElbeColorModes = "light" | "dark";
5
- export type ElbeTypeStyles = "header-1" | "header-2" | "header-3" | "header-4" | "header-5" | "header-6" | "text-s" | "text-m" | "text-l" | "code";
@@ -1,25 +0,0 @@
1
- import React from "preact/compat";
2
- import type { ElbeColorStyles } from "../color_theme";
3
- import type { ElbeChild, ElbeChildren } from "../util/util";
4
- import type { ElbeProps } from "./box";
5
- export type BadgeProps = {
6
- count?: number;
7
- message?: string;
8
- child?: ElbeChild;
9
- hidden?: boolean;
10
- children?: ElbeChildren;
11
- } & ElbeProps;
12
- export declare function TestBadge(p: BadgeProps): Badge;
13
- export declare class Badge extends React.Component<BadgeProps & {
14
- colorStyle: ElbeColorStyles;
15
- }> {
16
- constructor(props: BadgeProps & {
17
- colorStyle: ElbeColorStyles;
18
- });
19
- static accent(p: BadgeProps): React.JSX.Element;
20
- static error(p: BadgeProps): React.JSX.Element;
21
- static warning(p: BadgeProps): React.JSX.Element;
22
- static success(p: BadgeProps): React.JSX.Element;
23
- static info(p: BadgeProps): React.JSX.Element;
24
- render(): React.JSX.Element;
25
- }