@tachui/primitives 0.8.0-alpha

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 (49) hide show
  1. package/LICENSE +363 -0
  2. package/README.md +458 -0
  3. package/dist/BasicInput-CWFHw9rL.js +390 -0
  4. package/dist/Divider-DWgDKavU.js +474 -0
  5. package/dist/HTML-aWcvQ0VC.js +321 -0
  6. package/dist/Picker-DrZ7ibdt.js +1675 -0
  7. package/dist/Text-DYyFBJ6i.js +165 -0
  8. package/dist/controls/Button.d.ts +250 -0
  9. package/dist/controls/Button.d.ts.map +1 -0
  10. package/dist/controls/Link.d.ts +365 -0
  11. package/dist/controls/Link.d.ts.map +1 -0
  12. package/dist/controls/Picker.d.ts +153 -0
  13. package/dist/controls/Picker.d.ts.map +1 -0
  14. package/dist/controls/Toggle.d.ts +207 -0
  15. package/dist/controls/Toggle.d.ts.map +1 -0
  16. package/dist/controls/index.d.ts +8 -0
  17. package/dist/controls/index.d.ts.map +1 -0
  18. package/dist/controls/index.js +18 -0
  19. package/dist/display/HTML.d.ts +120 -0
  20. package/dist/display/HTML.d.ts.map +1 -0
  21. package/dist/display/Image.d.ts +192 -0
  22. package/dist/display/Image.d.ts.map +1 -0
  23. package/dist/display/Text.d.ts +269 -0
  24. package/dist/display/Text.d.ts.map +1 -0
  25. package/dist/display/index.d.ts +7 -0
  26. package/dist/display/index.d.ts.map +1 -0
  27. package/dist/display/index.js +21 -0
  28. package/dist/forms/BasicForm.d.ts +141 -0
  29. package/dist/forms/BasicForm.d.ts.map +1 -0
  30. package/dist/forms/BasicInput.d.ts +116 -0
  31. package/dist/forms/BasicInput.d.ts.map +1 -0
  32. package/dist/forms/index.d.ts +6 -0
  33. package/dist/forms/index.d.ts.map +1 -0
  34. package/dist/forms/index.js +10 -0
  35. package/dist/index.d.ts +11 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +485 -0
  38. package/dist/layout/Divider.d.ts +168 -0
  39. package/dist/layout/Divider.d.ts.map +1 -0
  40. package/dist/layout/Spacer.d.ts +35 -0
  41. package/dist/layout/Spacer.d.ts.map +1 -0
  42. package/dist/layout/Stack.d.ts +74 -0
  43. package/dist/layout/Stack.d.ts.map +1 -0
  44. package/dist/layout/index.d.ts +7 -0
  45. package/dist/layout/index.d.ts.map +1 -0
  46. package/dist/layout/index.js +15 -0
  47. package/dist/validation.d.ts +91 -0
  48. package/dist/validation.d.ts.map +1 -0
  49. package/package.json +82 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Layout Stack Components
3
+ *
4
+ * SwiftUI-inspired VStack, HStack, and ZStack components with modifier support
5
+ */
6
+ import type { ComponentInstance, ComponentProps, DOMNode } from '@tachui/core';
7
+ import type { ModifiableComponent, ModifierBuilder } from '@tachui/core';
8
+ import { ComponentWithCSSClasses, type CSSClassesProps } from '@tachui/core';
9
+ import { type ElementOverrideProps } from '@tachui/core';
10
+ /**
11
+ * VStack component props
12
+ */
13
+ export interface VStackProps {
14
+ children?: ComponentInstance[];
15
+ spacing?: number;
16
+ alignment?: 'leading' | 'center' | 'trailing';
17
+ debugLabel?: string;
18
+ element?: string;
19
+ }
20
+ /**
21
+ * HStack component props
22
+ */
23
+ export interface HStackProps {
24
+ children?: ComponentInstance[];
25
+ spacing?: number;
26
+ alignment?: 'top' | 'center' | 'bottom';
27
+ debugLabel?: string;
28
+ element?: string;
29
+ }
30
+ /**
31
+ * ZStack component props
32
+ */
33
+ export interface ZStackProps {
34
+ children?: ComponentInstance[];
35
+ alignment?: 'topLeading' | 'top' | 'topTrailing' | 'leading' | 'center' | 'trailing' | 'bottomLeading' | 'bottom' | 'bottomTrailing';
36
+ element?: string;
37
+ }
38
+ /**
39
+ * Enhanced component wrapper that adds modifier support and preserves concatenation methods
40
+ */
41
+ export declare function withModifiers<P extends ComponentProps>(component: ComponentInstance<P>): ModifiableComponent<P> & {
42
+ modifier: ModifierBuilder<ModifiableComponent<P>>;
43
+ } & (ComponentInstance<P> extends any ? any : {});
44
+ /**
45
+ * Layout container component class with element override support
46
+ */
47
+ export declare class LayoutComponent extends ComponentWithCSSClasses implements ComponentInstance<ComponentProps & ElementOverrideProps & CSSClassesProps> {
48
+ props: ComponentProps & ElementOverrideProps & CSSClassesProps;
49
+ private layoutType;
50
+ children: ComponentInstance[];
51
+ private layoutProps;
52
+ readonly type: "component";
53
+ readonly id: string;
54
+ mounted: boolean;
55
+ cleanup: (() => void)[];
56
+ private effectiveTag;
57
+ constructor(props: ComponentProps & ElementOverrideProps & CSSClassesProps, layoutType: 'vstack' | 'hstack' | 'zstack', children?: ComponentInstance[], layoutProps?: any);
58
+ /**
59
+ * Find DOM elements for a specific child component within the layout container
60
+ */
61
+ private findChildDOMElements;
62
+ render(): DOMNode[];
63
+ /**
64
+ * Cleanup resources
65
+ */
66
+ dispose(): void;
67
+ }
68
+ /**
69
+ * SwiftUI-aligned direct exports for layout components
70
+ */
71
+ export declare function VStack(props?: VStackProps): any;
72
+ export declare function HStack(props?: HStackProps): any;
73
+ export declare function ZStack(props?: ZStackProps): any;
74
+ //# sourceMappingURL=Stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layout/Stack.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAExE,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC5E,OAAO,EAA0B,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAIhF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,SAAS,GA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AA;IACnB,OAAO,UAAQ;IACf,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAK;IACnC,OAAO,CAAC,YAAY,CAAQ;gBAGnB,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,eAAe,EAC7D,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,EAC3C,QAAQ,GAAE,iBAAiB,EAAO,EACjC,WAAW,GAAE,GAAQ;IA0G/B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAgD5B,MAAM,IAAI,OAAO,EAAE;IAwMnB;;OAEG;IACH,OAAO,IAAI,IAAI;CAiBhB;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,GAAE,WAAgB,OAU7C;AAED,wBAAgB,MAAM,CAAC,KAAK,GAAE,WAAgB,OAU7C;AAED,wBAAgB,MAAM,CAAC,KAAK,GAAE,WAAgB,OAM7C"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Layout Components
3
+ */
4
+ export { VStack, HStack, ZStack, withModifiers, LayoutComponent, type VStackProps, type HStackProps, type ZStackProps, } from './Stack';
5
+ export { Spacer, SpacerComponent, type SpacerProps } from './Spacer';
6
+ export { Divider, DividerComponent, DividerUtils, DividerStyles, defaultDividerTheme, type DividerProps, type DividerTheme, } from './Divider';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,aAAa,EACb,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACpE,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,GAClB,MAAM,WAAW,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { D as s, b as i, d as t, c as o, H as r, L as d, S, a as c, V as n, Z as p, e as D, w as m } from "../Divider-DWgDKavU.js";
2
+ export {
3
+ s as Divider,
4
+ i as DividerComponent,
5
+ t as DividerStyles,
6
+ o as DividerUtils,
7
+ r as HStack,
8
+ d as LayoutComponent,
9
+ S as Spacer,
10
+ c as SpacerComponent,
11
+ n as VStack,
12
+ p as ZStack,
13
+ D as defaultDividerTheme,
14
+ m as withModifiers
15
+ };
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Primitive Components Validation
3
+ *
4
+ * Component validation for primitive components (Text, Button, Image, Toggle, Layout).
5
+ * Co-located with the components they validate for better maintainability.
6
+ *
7
+ * Moved from @tachui/core for proper architectural separation.
8
+ */
9
+ /**
10
+ * Enhanced validation error class for primitives
11
+ */
12
+ export declare class TachUIValidationError extends Error {
13
+ context: {
14
+ component: string;
15
+ property?: string;
16
+ suggestion?: string;
17
+ documentation?: string;
18
+ example?: {
19
+ wrong: string;
20
+ correct: string;
21
+ };
22
+ package?: string;
23
+ };
24
+ constructor(message: string, context: {
25
+ component: string;
26
+ property?: string;
27
+ suggestion?: string;
28
+ documentation?: string;
29
+ example?: {
30
+ wrong: string;
31
+ correct: string;
32
+ };
33
+ package?: string;
34
+ });
35
+ getFormattedMessage(): string;
36
+ }
37
+ /**
38
+ * Validation configuration for primitives
39
+ */
40
+ interface ValidationConfig {
41
+ enabled: boolean;
42
+ errorLevel: 'off' | 'warn' | 'error';
43
+ }
44
+ declare function isValidationEnabled(): boolean;
45
+ /**
46
+ * Primitive component validation rules
47
+ */
48
+ export declare const PrimitiveComponentValidation: {
49
+ validateText(args: unknown[]): void;
50
+ validateButton(args: unknown[]): void;
51
+ validateImage(args: unknown[]): void;
52
+ validateToggle(args: unknown[]): void;
53
+ validatePicker(args: unknown[]): void;
54
+ validateStack(componentType: string, args: unknown[]): void;
55
+ validateLink(args: unknown[]): void;
56
+ validateBasicForm(args: unknown[]): void;
57
+ validateBasicInput(args: unknown[]): void;
58
+ };
59
+ /**
60
+ * Component validation wrapper
61
+ */
62
+ export declare function withComponentValidation<T extends (...args: any[]) => any>(component: T, _componentName: string, validator: (args: unknown[]) => void): T;
63
+ /**
64
+ * Configure validation for primitives
65
+ */
66
+ export declare function configurePrimitivesValidation(config: Partial<ValidationConfig>): void;
67
+ /**
68
+ * Get current validation configuration
69
+ */
70
+ export declare function getPrimitivesValidationConfig(): ValidationConfig;
71
+ /**
72
+ * Validation utilities for primitives
73
+ */
74
+ export declare const PrimitivesValidationUtils: {
75
+ validateText: (args: unknown[]) => void;
76
+ validateButton: (args: unknown[]) => void;
77
+ validateImage: (args: unknown[]) => void;
78
+ validateToggle: (args: unknown[]) => void;
79
+ validatePicker: (args: unknown[]) => void;
80
+ validateStack: (componentType: string, args: unknown[]) => void;
81
+ validateLink: (args: unknown[]) => void;
82
+ validateBasicForm: (args: unknown[]) => void;
83
+ validateBasicInput: (args: unknown[]) => void;
84
+ configure: typeof configurePrimitivesValidation;
85
+ getConfig: typeof getPrimitivesValidationConfig;
86
+ isValidationEnabled: typeof isValidationEnabled;
87
+ withComponentValidation: typeof withComponentValidation;
88
+ test: () => void;
89
+ };
90
+ export {};
91
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAGrC,OAAO,EAAE;QACd,SAAS,EAAE,MAAM,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,OAAO,CAAC,EAAE;YACR,KAAK,EAAE,MAAM,CAAA;YACb,OAAO,EAAE,MAAM,CAA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AC,GAChC,IAAI,CAEN;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,gBAAgB,CAEhE;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB;yBA9cjB,OAAO,EAAE,KAAG,IAAI;2BAuDd,OAAO,EAAE,KAAG,IAAI;0BA+DjB,OAAO,EAAE,KAAG,IAAI;2BA4Cf,OAAO,EAAE,KAAG,IAAI;2BA4ChB,OAAO,EAAE,KAAG,IAAI;mCAwDR,MAAM,QAAQ,OAAO,EAAE,KAAG,IAAI;yBAkDxC,OAAO,EAAE,KAAG,IAAI;8BA6CX,OAAO,EAAE,KAAG,IAAI;+BAiCf,OAAO,EAAE,KAAG,IAAI;;;;;;CA8H1C,CAAA"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@tachui/primitives",
3
+ "version": "0.8.0-alpha",
4
+ "description": "Basic UI components for tachUI framework",
5
+ "homepage": "https://tachui.dev/",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./layout": {
16
+ "types": "./dist/layout/index.d.ts",
17
+ "import": "./dist/layout/index.js"
18
+ },
19
+ "./display": {
20
+ "types": "./dist/display/index.d.ts",
21
+ "import": "./dist/display/index.js"
22
+ },
23
+ "./controls": {
24
+ "types": "./dist/controls/index.d.ts",
25
+ "import": "./dist/controls/index.js"
26
+ },
27
+ "./forms": {
28
+ "types": "./dist/forms/index.d.ts",
29
+ "import": "./dist/forms/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "dependencies": {
36
+ "@tachui/core": "0.8.0-alpha",
37
+ "@tachui/modifiers": "0.8.0-alpha"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^20.0.0",
41
+ "@types/jsdom": "^21.1.6",
42
+ "@vitest/coverage-v8": "^1.0.0",
43
+ "jsdom": "^23.2.0",
44
+ "typescript": "^5.2.0",
45
+ "vite": "^7.1.1",
46
+ "vitest": "^3.2.4"
47
+ },
48
+ "peerDependencies": {
49
+ "typescript": ">=5.0.0"
50
+ },
51
+ "peerDependenciesMeta": {
52
+ "typescript": {
53
+ "optional": true
54
+ }
55
+ },
56
+ "keywords": [
57
+ "ui",
58
+ "components",
59
+ "primitives",
60
+ "tachui",
61
+ "typescript"
62
+ ],
63
+ "author": "tachUI Team",
64
+ "license": "MPL-2.0",
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "https://github.com/tach-UI/tachUI",
68
+ "directory": "packages/primitives"
69
+ },
70
+ "scripts": {
71
+ "build": "rm -rf dist && vite build && tsc --project tsconfig.build.json",
72
+ "dev": "vite build --watch",
73
+ "valid": "clear && vitest run && pnpm type-check && pnpm lint && pnpm build",
74
+ "test": "vitest run",
75
+ "test:coverage": "vitest run --coverage",
76
+ "test:watch": "vitest",
77
+ "test:ci": "npm run test:run",
78
+ "type-check": "tsc --project tsconfig.type-check.json",
79
+ "clean": "rm -rf dist",
80
+ "lint": "oxlint src"
81
+ }
82
+ }