@pindoba/core-card 0.0.0-alpha-20260320034942

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright 2025 Eduardo Lopes
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
8
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
9
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
10
+ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
11
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
12
+ DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ import { CardApi, CardBackground, CardBaseProps, CardBorder, CardClasses, CardFeedback, CardPadding, CardPassThrough, CardRadius, CardRadiusBottom, CardRadiusLeft, CardRadiusRight, CardRadiusTop, CardRootProps, CardSize, CardSlotPassThrough, ConnectCardOptions, ElementAttributes } from "./src/types.js";
2
+ import { cardDefaults, connectCard } from "./src/connect-card.js";
3
+ export { type CardApi, type CardBackground, type CardBaseProps, type CardBorder, type CardClasses, type CardFeedback, type CardPadding, type CardPassThrough, type CardRadius, type CardRadiusBottom, type CardRadiusLeft, type CardRadiusRight, type CardRadiusTop, type CardRootProps, type CardSize, type CardSlotPassThrough, type ConnectCardOptions, type ElementAttributes, cardDefaults, connectCard };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import { cardDefaults, connectCard } from "./src/connect-card.js";
2
+ export { cardDefaults, connectCard };
@@ -0,0 +1,17 @@
1
+ import { CardApi, ConnectCardOptions } from "./types.js";
2
+
3
+ //#region src/connect-card.d.ts
4
+ declare const cardDefaults: {
5
+ readonly size: "md";
6
+ readonly background: "surface";
7
+ readonly feedback: "neutral";
8
+ readonly accent: false;
9
+ readonly translucent: false;
10
+ readonly padding: "none";
11
+ readonly border: "none";
12
+ readonly interactive: false;
13
+ };
14
+ declare function connectCard(options: ConnectCardOptions): CardApi;
15
+ //#endregion
16
+ export { cardDefaults, connectCard };
17
+ //# sourceMappingURL=connect-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-card.d.ts","names":[],"sources":["../../src/connect-card.ts"],"mappings":";;;cAYa,YAAA;EAAA;;;;;;;;;iBAiBG,WAAA,CAAY,OAAA,EAAS,kBAAA,GAAqB,OAAA"}
@@ -0,0 +1,68 @@
1
+ import { css } from "@pindoba/styled-system/css";
2
+ import { panelStyles } from "@pindoba/styles-panel";
3
+ import { cardStyles } from "@pindoba/styles-card";
4
+ //#region src/connect-card.ts
5
+ const cardDefaults = {
6
+ size: "md",
7
+ background: "surface",
8
+ feedback: "neutral",
9
+ accent: false,
10
+ translucent: false,
11
+ padding: "none",
12
+ border: "none",
13
+ interactive: false
14
+ };
15
+ const sizeToRadius = {
16
+ sm: "lg",
17
+ md: "xl",
18
+ lg: "2xl"
19
+ };
20
+ function connectCard(options) {
21
+ const { size = cardDefaults.size, background = cardDefaults.background, feedback = cardDefaults.feedback, accent = cardDefaults.accent, translucent = cardDefaults.translucent, padding = cardDefaults.padding, radius: _radius, radiusTop, radiusBottom, radiusLeft, radiusRight, border = cardDefaults.border, interactive = cardDefaults.interactive, passThrough, class: className, ...restProps } = options;
22
+ const radius = _radius ?? sizeToRadius[size];
23
+ const panelClasses = panelStyles.raw({
24
+ background,
25
+ feedback,
26
+ accent,
27
+ translucent,
28
+ padding,
29
+ radius,
30
+ radiusTop,
31
+ radiusBottom,
32
+ radiusLeft,
33
+ radiusRight,
34
+ border,
35
+ interactive
36
+ });
37
+ const slotClasses = cardStyles.raw({ size });
38
+ const generatedClass = css(panelClasses.root, slotClasses.root, passThrough?.root?.style);
39
+ const userClass = className != null ? String(className) : void 0;
40
+ return {
41
+ rootProps: {
42
+ ...restProps,
43
+ ...passThrough?.root?.props,
44
+ "data-component": "card",
45
+ class: userClass ? `${generatedClass} ${userClass}` : generatedClass
46
+ },
47
+ classes: {
48
+ header: css(slotClasses.header, passThrough?.header?.style),
49
+ content: css(slotClasses.content, passThrough?.content?.style),
50
+ footer: css(slotClasses.footer, passThrough?.footer?.style),
51
+ leading: css(slotClasses.leading, passThrough?.leading?.style),
52
+ trailing: css(slotClasses.trailing, passThrough?.trailing?.style),
53
+ headingGroup: css(slotClasses.headingGroup, passThrough?.headingGroup?.style),
54
+ headingContainer: css(slotClasses.headingContainer, passThrough?.headingContainer?.style),
55
+ heading: css(slotClasses.heading, passThrough?.heading?.style),
56
+ headingLeading: css(slotClasses.headingLeading, passThrough?.headingLeading?.style),
57
+ headingTrailing: css(slotClasses.headingTrailing, passThrough?.headingTrailing?.style),
58
+ subheadingContainer: css(slotClasses.subheadingContainer, passThrough?.subheadingContainer?.style),
59
+ subheading: css(slotClasses.subheading, passThrough?.subheading?.style),
60
+ subheadingLeading: css(slotClasses.subheadingLeading, passThrough?.subheadingLeading?.style),
61
+ subheadingTrailing: css(slotClasses.subheadingTrailing, passThrough?.subheadingTrailing?.style)
62
+ }
63
+ };
64
+ }
65
+ //#endregion
66
+ export { cardDefaults, connectCard };
67
+
68
+ //# sourceMappingURL=connect-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-card.js","names":[],"sources":["../../src/connect-card.ts"],"sourcesContent":["import { css } from \"@pindoba/styled-system/css\";\nimport { panelStyles } from \"@pindoba/styles-panel\";\nimport { cardStyles } from \"@pindoba/styles-card\";\nimport type {\n ConnectCardOptions,\n CardApi,\n CardRootProps,\n CardBaseProps,\n CardSize,\n CardRadius,\n} from \"./types.js\";\n\nexport const cardDefaults = {\n size: \"md\",\n background: \"surface\",\n feedback: \"neutral\",\n accent: false,\n translucent: false,\n padding: \"none\",\n border: \"none\",\n interactive: false,\n} as const satisfies Partial<CardBaseProps>;\n\nconst sizeToRadius: Record<CardSize, CardRadius> = {\n sm: \"lg\",\n md: \"xl\",\n lg: \"2xl\",\n};\n\nexport function connectCard(options: ConnectCardOptions): CardApi {\n const {\n size = cardDefaults.size,\n background = cardDefaults.background,\n feedback = cardDefaults.feedback,\n accent = cardDefaults.accent,\n translucent = cardDefaults.translucent,\n padding = cardDefaults.padding,\n radius: _radius,\n radiusTop,\n radiusBottom,\n radiusLeft,\n radiusRight,\n border = cardDefaults.border,\n interactive = cardDefaults.interactive,\n passThrough,\n class: className,\n ...restProps\n } = options;\n\n // Default radius scales with size when not explicitly provided\n const radius = _radius ?? sizeToRadius[size];\n\n // Panel handles surface: background, color, border, borderRadius, padding, colorPalette\n const panelClasses = panelStyles.raw({\n background,\n feedback,\n accent,\n translucent,\n padding,\n radius,\n radiusTop,\n radiusBottom,\n radiusLeft,\n radiusRight,\n border,\n interactive,\n });\n\n // Card handles layout: flex column for root, padding for header/content/footer, typography\n const slotClasses = cardStyles.raw({ size });\n\n // Merge: panel surface → card layout\n const generatedClass = css(\n panelClasses.root,\n slotClasses.root,\n passThrough?.root?.style,\n );\n\n const userClass = className != null ? String(className) : undefined;\n\n const rootProps: CardRootProps = {\n ...restProps,\n ...passThrough?.root?.props,\n \"data-component\": \"card\",\n class: userClass ? `${generatedClass} ${userClass}` : generatedClass,\n };\n\n return {\n rootProps,\n classes: {\n header: css(slotClasses.header, passThrough?.header?.style),\n content: css(slotClasses.content, passThrough?.content?.style),\n footer: css(slotClasses.footer, passThrough?.footer?.style),\n leading: css(slotClasses.leading, passThrough?.leading?.style),\n trailing: css(slotClasses.trailing, passThrough?.trailing?.style),\n headingGroup: css(\n slotClasses.headingGroup,\n passThrough?.headingGroup?.style,\n ),\n headingContainer: css(\n slotClasses.headingContainer,\n passThrough?.headingContainer?.style,\n ),\n heading: css(slotClasses.heading, passThrough?.heading?.style),\n headingLeading: css(\n slotClasses.headingLeading,\n passThrough?.headingLeading?.style,\n ),\n headingTrailing: css(\n slotClasses.headingTrailing,\n passThrough?.headingTrailing?.style,\n ),\n subheadingContainer: css(\n slotClasses.subheadingContainer,\n passThrough?.subheadingContainer?.style,\n ),\n subheading: css(slotClasses.subheading, passThrough?.subheading?.style),\n subheadingLeading: css(\n slotClasses.subheadingLeading,\n passThrough?.subheadingLeading?.style,\n ),\n subheadingTrailing: css(\n slotClasses.subheadingTrailing,\n passThrough?.subheadingTrailing?.style,\n ),\n },\n };\n}\n"],"mappings":";;;;AAYA,MAAa,eAAe;CAC1B,MAAM;CACN,YAAY;CACZ,UAAU;CACV,QAAQ;CACR,aAAa;CACb,SAAS;CACT,QAAQ;CACR,aAAa;CACd;AAED,MAAM,eAA6C;CACjD,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAED,SAAgB,YAAY,SAAsC;CAChE,MAAM,EACJ,OAAO,aAAa,MACpB,aAAa,aAAa,YAC1B,WAAW,aAAa,UACxB,SAAS,aAAa,QACtB,cAAc,aAAa,aAC3B,UAAU,aAAa,SACvB,QAAQ,SACR,WACA,cACA,YACA,aACA,SAAS,aAAa,QACtB,cAAc,aAAa,aAC3B,aACA,OAAO,WACP,GAAG,cACD;CAGJ,MAAM,SAAS,WAAW,aAAa;CAGvC,MAAM,eAAe,YAAY,IAAI;EACnC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;CAGF,MAAM,cAAc,WAAW,IAAI,EAAE,MAAM,CAAC;CAG5C,MAAM,iBAAiB,IACrB,aAAa,MACb,YAAY,MACZ,aAAa,MAAM,MACpB;CAED,MAAM,YAAY,aAAa,OAAO,OAAO,UAAU,GAAG,KAAA;AAS1D,QAAO;EACL,WAR+B;GAC/B,GAAG;GACH,GAAG,aAAa,MAAM;GACtB,kBAAkB;GAClB,OAAO,YAAY,GAAG,eAAe,GAAG,cAAc;GACvD;EAIC,SAAS;GACP,QAAQ,IAAI,YAAY,QAAQ,aAAa,QAAQ,MAAM;GAC3D,SAAS,IAAI,YAAY,SAAS,aAAa,SAAS,MAAM;GAC9D,QAAQ,IAAI,YAAY,QAAQ,aAAa,QAAQ,MAAM;GAC3D,SAAS,IAAI,YAAY,SAAS,aAAa,SAAS,MAAM;GAC9D,UAAU,IAAI,YAAY,UAAU,aAAa,UAAU,MAAM;GACjE,cAAc,IACZ,YAAY,cACZ,aAAa,cAAc,MAC5B;GACD,kBAAkB,IAChB,YAAY,kBACZ,aAAa,kBAAkB,MAChC;GACD,SAAS,IAAI,YAAY,SAAS,aAAa,SAAS,MAAM;GAC9D,gBAAgB,IACd,YAAY,gBACZ,aAAa,gBAAgB,MAC9B;GACD,iBAAiB,IACf,YAAY,iBACZ,aAAa,iBAAiB,MAC/B;GACD,qBAAqB,IACnB,YAAY,qBACZ,aAAa,qBAAqB,MACnC;GACD,YAAY,IAAI,YAAY,YAAY,aAAa,YAAY,MAAM;GACvE,mBAAmB,IACjB,YAAY,mBACZ,aAAa,mBAAmB,MACjC;GACD,oBAAoB,IAClB,YAAY,oBACZ,aAAa,oBAAoB,MAClC;GACF;EACF"}
@@ -0,0 +1,92 @@
1
+ import { PanelStyleProps } from "@pindoba/styles-panel";
2
+ import { CardStyleProps } from "@pindoba/styles-card";
3
+ import { SystemStyleObject } from "@pindoba/styled-system/types";
4
+
5
+ //#region src/types.d.ts
6
+ type ElementAttributes = Partial<Record<string, unknown>>;
7
+ type CardSize = NonNullable<CardStyleProps["size"]>;
8
+ type CardBackground = NonNullable<PanelStyleProps["background"]>;
9
+ type CardFeedback = NonNullable<PanelStyleProps["feedback"]>;
10
+ type CardPadding = NonNullable<PanelStyleProps["padding"]>;
11
+ type CardRadius = NonNullable<PanelStyleProps["radius"]>;
12
+ type CardRadiusTop = NonNullable<PanelStyleProps["radiusTop"]>;
13
+ type CardRadiusBottom = NonNullable<PanelStyleProps["radiusBottom"]>;
14
+ type CardRadiusLeft = NonNullable<PanelStyleProps["radiusLeft"]>;
15
+ type CardRadiusRight = NonNullable<PanelStyleProps["radiusRight"]>;
16
+ type CardBorder = NonNullable<PanelStyleProps["border"]>;
17
+ interface CardSlotPassThrough<T = ElementAttributes> {
18
+ style?: SystemStyleObject;
19
+ props?: T;
20
+ }
21
+ interface CardPassThrough<RootElementAttributes = ElementAttributes> {
22
+ root?: CardSlotPassThrough<RootElementAttributes>;
23
+ header?: CardSlotPassThrough;
24
+ content?: CardSlotPassThrough;
25
+ footer?: CardSlotPassThrough;
26
+ leading?: CardSlotPassThrough;
27
+ trailing?: CardSlotPassThrough;
28
+ headingGroup?: CardSlotPassThrough;
29
+ headingContainer?: CardSlotPassThrough;
30
+ heading?: CardSlotPassThrough;
31
+ headingLeading?: CardSlotPassThrough;
32
+ headingTrailing?: CardSlotPassThrough;
33
+ subheadingContainer?: CardSlotPassThrough;
34
+ subheading?: CardSlotPassThrough;
35
+ subheadingLeading?: CardSlotPassThrough;
36
+ subheadingTrailing?: CardSlotPassThrough;
37
+ }
38
+ /**
39
+ * Base card props shared across all frameworks (Svelte, Astro).
40
+ * Each framework extends this with its own additions.
41
+ */
42
+ interface CardBaseProps<RootElementAttributes = ElementAttributes> {
43
+ size?: CardSize;
44
+ background?: CardBackground;
45
+ feedback?: CardFeedback;
46
+ radius?: CardRadius;
47
+ radiusTop?: CardRadiusTop;
48
+ radiusBottom?: CardRadiusBottom;
49
+ radiusLeft?: CardRadiusLeft;
50
+ radiusRight?: CardRadiusRight;
51
+ border?: CardBorder;
52
+ padding?: CardPadding;
53
+ accent?: boolean;
54
+ translucent?: boolean;
55
+ interactive?: boolean;
56
+ passThrough?: CardPassThrough<RootElementAttributes>;
57
+ }
58
+ /**
59
+ * Options for connectCard. Framework components can spread their props
60
+ * directly into this function.
61
+ */
62
+ interface ConnectCardOptions extends CardBaseProps<object> {
63
+ class?: unknown;
64
+ }
65
+ interface CardClasses {
66
+ header: string;
67
+ content: string;
68
+ footer: string;
69
+ leading: string;
70
+ trailing: string;
71
+ headingGroup: string;
72
+ headingContainer: string;
73
+ heading: string;
74
+ headingLeading: string;
75
+ headingTrailing: string;
76
+ subheadingContainer: string;
77
+ subheading: string;
78
+ subheadingLeading: string;
79
+ subheadingTrailing: string;
80
+ }
81
+ interface CardRootProps {
82
+ class: string;
83
+ "data-component": "card";
84
+ [key: string]: unknown;
85
+ }
86
+ interface CardApi {
87
+ rootProps: CardRootProps;
88
+ classes: CardClasses;
89
+ }
90
+ //#endregion
91
+ export { CardApi, CardBackground, CardBaseProps, CardBorder, CardClasses, CardFeedback, CardPadding, CardPassThrough, CardRadius, CardRadiusBottom, CardRadiusLeft, CardRadiusRight, CardRadiusTop, CardRootProps, CardSize, CardSlotPassThrough, ConnectCardOptions, ElementAttributes };
92
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/types.ts"],"mappings":";;;;;KAMY,iBAAA,GAAoB,OAAA,CAAQ,MAAA;AAAA,KAI5B,QAAA,GAAW,WAAA,CAAY,cAAA;AAAA,KAIvB,cAAA,GAAiB,WAAA,CAAY,eAAA;AAAA,KAC7B,YAAA,GAAe,WAAA,CAAY,eAAA;AAAA,KAC3B,WAAA,GAAc,WAAA,CAAY,eAAA;AAAA,KAC1B,UAAA,GAAa,WAAA,CAAY,eAAA;AAAA,KACzB,aAAA,GAAgB,WAAA,CAAY,eAAA;AAAA,KAC5B,gBAAA,GAAmB,WAAA,CAAY,eAAA;AAAA,KAC/B,cAAA,GAAiB,WAAA,CAAY,eAAA;AAAA,KAC7B,eAAA,GAAkB,WAAA,CAAY,eAAA;AAAA,KAC9B,UAAA,GAAa,WAAA,CAAY,eAAA;AAAA,UAIpB,mBA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AS,WAAA;AAAA"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@pindoba/core-card",
3
+ "version": "0.0.0-alpha-20260320034942",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./*": {
15
+ "types": "./dist/src/*.d.ts",
16
+ "import": "./dist/src/*.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "dependencies": {
23
+ "@pindoba/styled-system": "0.0.0-alpha-20260320034942",
24
+ "@pindoba/styles-panel": "0.0.0-alpha-20260320034942",
25
+ "@pindoba/styles-card": "0.0.0-alpha-20260320034942"
26
+ },
27
+ "devDependencies": {
28
+ "typescript": "^5.9.3",
29
+ "tsdown": "^0.21.2"
30
+ },
31
+ "scripts": {
32
+ "build": "tsdown",
33
+ "dev": "tsdown --watch",
34
+ "clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo"
35
+ }
36
+ }