@lattix/patterns 0.1.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.
@@ -0,0 +1,27 @@
1
+ import { type LattixAnimation, type LattixNode, type LattixStyle } from "@lattix/core";
2
+ export interface PatternAction {
3
+ readonly label: string;
4
+ readonly onPress: string;
5
+ }
6
+ export interface CardPatternOptions {
7
+ readonly title: string;
8
+ readonly body?: string;
9
+ readonly action?: PatternAction;
10
+ readonly animation?: LattixAnimation;
11
+ readonly style?: LattixStyle;
12
+ }
13
+ export interface EmptyStatePatternOptions {
14
+ readonly title: string;
15
+ readonly description: string;
16
+ readonly action?: PatternAction;
17
+ readonly animation?: LattixAnimation;
18
+ }
19
+ export interface SectionPatternOptions {
20
+ readonly title: string;
21
+ readonly children: readonly LattixNode[];
22
+ readonly animation?: LattixAnimation;
23
+ }
24
+ export declare const card: ({ title, body, action, animation, style, }: CardPatternOptions) => LattixNode;
25
+ export declare const emptyState: ({ title, description, action, animation, }: EmptyStatePatternOptions) => LattixNode;
26
+ export declare const section: ({ title, children, animation, }: SectionPatternOptions) => LattixNode;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;CACtC;AAUD,eAAO,MAAM,IAAI,GAAI,4CAMlB,kBAAkB,KAAG,UAsBvB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,4CAKxB,wBAAwB,KAAG,UAe1B,CAAC;AAEL,eAAO,MAAM,OAAO,GAAI,iCAIrB,qBAAqB,KAAG,UAWvB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,56 @@
1
+ import { createNode, normalizeAction, } from "@lattix/core";
2
+ const actionButton = (action) => createNode("button", {
3
+ props: {
4
+ label: action.label,
5
+ onPress: normalizeAction(action.onPress),
6
+ },
7
+ });
8
+ export const card = ({ title, body, action, animation, style, }) => {
9
+ const children = [
10
+ createNode("text", { props: { content: title }, style: { fontWeight: "bold" } }),
11
+ ...(body ? [createNode("text", { props: { content: body } })] : []),
12
+ ...(action ? [actionButton(action)] : []),
13
+ ];
14
+ return createNode("box", {
15
+ animation,
16
+ style: {
17
+ padding: 16,
18
+ borderRadius: 12,
19
+ background: "surface.canvas",
20
+ ...style,
21
+ },
22
+ children: [
23
+ createNode("stack", {
24
+ style: { gap: 8 },
25
+ children,
26
+ }),
27
+ ],
28
+ });
29
+ };
30
+ export const emptyState = ({ title, description, action, animation, }) => createNode("stack", {
31
+ animation,
32
+ style: { gap: 8, alignItems: "center" },
33
+ children: [
34
+ createNode("text", {
35
+ props: { content: title },
36
+ style: { fontWeight: "bold", textAlign: "center" },
37
+ }),
38
+ createNode("text", {
39
+ props: { content: description },
40
+ style: { color: "text.muted", textAlign: "center" },
41
+ }),
42
+ ...(action ? [actionButton(action)] : []),
43
+ ],
44
+ });
45
+ export const section = ({ title, children, animation, }) => createNode("stack", {
46
+ animation,
47
+ style: { gap: 12 },
48
+ children: [
49
+ createNode("text", {
50
+ props: { content: title },
51
+ style: { fontWeight: "bold", fontSize: 20 },
52
+ }),
53
+ ...children,
54
+ ],
55
+ });
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,GAIhB,MAAM,cAAc,CAAC;AA4BtB,MAAM,YAAY,GAAG,CAAC,MAAqB,EAAc,EAAE,CACzD,UAAU,CAAC,QAAQ,EAAE;IACnB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC;KACzC;CACF,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,GACc,EAAc,EAAE;IACnC,MAAM,QAAQ,GAAG;QACf,UAAU,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAChF,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,MAAM,CAAC,CAAC,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SAAS;IACT,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;IAClB,QAAQ,EAAE;QACR,UAAU,CAAC,MAAM,EAAE;YACjB,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;YACzB,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE;SAC5C,CAAC;QACF,GAAG,QAAQ;KACZ;CACF,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@lattix/patterns",
3
+ "version": "0.1.0",
4
+ "description": "Generic reusable Lattix composite patterns",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.json",
18
+ "clean": "rm -rf dist *.tsbuildinfo",
19
+ "test": "vitest run",
20
+ "typecheck": "tsc -p tsconfig.json --noEmit"
21
+ },
22
+ "license": "MIT",
23
+ "dependencies": {
24
+ "@lattix/core": "0.1.0",
25
+ "@lattix/motion": "0.1.0"
26
+ },
27
+ "devDependencies": {
28
+ "typescript": "^5.7.3",
29
+ "vitest": "^3.0.5"
30
+ }
31
+ }