@deneb-ui/core 2.0.24

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,10 @@
1
+ import type { StyleKind, StyleProperties } from './styles';
2
+ export declare const STYLE_PATCH_MESSAGE = "FIVORA_PREVIEW_STYLE_PATCH";
3
+ export declare const DENEB_STYLE_PATCH_MESSAGE = "DENEB_PREVIEW_STYLE_PATCH";
4
+ export interface StylePatchPayload {
5
+ type: typeof STYLE_PATCH_MESSAGE | typeof DENEB_STYLE_PATCH_MESSAGE;
6
+ targetPath: string;
7
+ styleType: StyleKind;
8
+ properties: Partial<StyleProperties>;
9
+ }
10
+ export declare function isStylePatchPayload(value: unknown): value is StylePatchPayload;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DENEB_STYLE_PATCH_MESSAGE = exports.STYLE_PATCH_MESSAGE = void 0;
4
+ exports.isStylePatchPayload = isStylePatchPayload;
5
+ exports.STYLE_PATCH_MESSAGE = 'FIVORA_PREVIEW_STYLE_PATCH';
6
+ exports.DENEB_STYLE_PATCH_MESSAGE = 'DENEB_PREVIEW_STYLE_PATCH';
7
+ function isStylePatchPayload(value) {
8
+ if (!value || typeof value !== 'object')
9
+ return false;
10
+ const payload = value;
11
+ const type = payload.type;
12
+ if (type !== exports.STYLE_PATCH_MESSAGE && type !== exports.DENEB_STYLE_PATCH_MESSAGE) {
13
+ return false;
14
+ }
15
+ return (typeof payload.targetPath === 'string' &&
16
+ typeof payload.styleType === 'string' &&
17
+ typeof payload.properties === 'object' &&
18
+ payload.properties !== null);
19
+ }
@@ -0,0 +1,90 @@
1
+ export interface BaseStyleProperties {
2
+ marginTop?: string | number;
3
+ marginBottom?: string | number;
4
+ marginLeft?: string | number;
5
+ marginRight?: string | number;
6
+ /** Legacy Fivora field-style alias */
7
+ spacingTop?: string | number;
8
+ spacingBottom?: string | number;
9
+ spacingLeft?: string | number;
10
+ spacingRight?: string | number;
11
+ }
12
+ export interface TextStyleProperties extends BaseStyleProperties {
13
+ fontFamily?: string;
14
+ fontSize?: string | number;
15
+ /** When true, px/rem font sizes become responsive clamp() values */
16
+ responsiveFontSize?: boolean;
17
+ fontWeight?: string | number;
18
+ lineHeight?: string | number;
19
+ letterSpacing?: string;
20
+ color?: string;
21
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
22
+ textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
23
+ }
24
+ export interface CardStyleProperties extends BaseStyleProperties {
25
+ width?: string | number;
26
+ minWidth?: string | number;
27
+ maxWidth?: string | number;
28
+ height?: string | number;
29
+ aspectRatio?: string;
30
+ paddingTop?: string | number;
31
+ paddingBottom?: string | number;
32
+ paddingLeft?: string | number;
33
+ paddingRight?: string | number;
34
+ borderRadius?: string | number;
35
+ borderWidth?: string | number;
36
+ borderStyle?: 'solid' | 'dashed' | 'dotted' | 'none';
37
+ borderColor?: string;
38
+ backgroundColor?: string;
39
+ backgroundGradient?: string;
40
+ boxShadow?: string;
41
+ backdropBlur?: string | number;
42
+ gap?: string | number;
43
+ }
44
+ export interface ButtonStyleProperties extends BaseStyleProperties {
45
+ variant?: 'solid' | 'outline' | 'ghost' | 'soft';
46
+ size?: 'sm' | 'md' | 'lg' | 'xl';
47
+ borderRadius?: string | number;
48
+ paddingX?: string | number;
49
+ paddingY?: string | number;
50
+ backgroundColor?: string;
51
+ textColor?: string;
52
+ borderColor?: string;
53
+ hoverBackgroundColor?: string;
54
+ hoverTextColor?: string;
55
+ }
56
+ export interface GridStyleProperties {
57
+ columns?: number | 'auto-fit' | 'auto-fill';
58
+ minCardWidth?: string;
59
+ gapX?: string | number;
60
+ gapY?: string | number;
61
+ equalHeight?: boolean;
62
+ }
63
+ export interface SectionStyleProperties {
64
+ paddingTop?: string | number;
65
+ paddingBottom?: string | number;
66
+ paddingX?: string | number;
67
+ maxWidth?: string;
68
+ backgroundColor?: string;
69
+ backgroundImage?: string;
70
+ backgroundOverlayColor?: string;
71
+ backgroundOverlayOpacity?: number;
72
+ }
73
+ export type StyleKind = 'text' | 'card' | 'button' | 'grid' | 'section';
74
+ export type ComponentStyle = {
75
+ kind: 'text';
76
+ style: TextStyleProperties;
77
+ } | {
78
+ kind: 'card';
79
+ style: CardStyleProperties;
80
+ } | {
81
+ kind: 'button';
82
+ style: ButtonStyleProperties;
83
+ } | {
84
+ kind: 'grid';
85
+ style: GridStyleProperties;
86
+ } | {
87
+ kind: 'section';
88
+ style: SectionStyleProperties;
89
+ };
90
+ export type StyleProperties = TextStyleProperties | CardStyleProperties | ButtonStyleProperties | GridStyleProperties | SectionStyleProperties;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import type { StyleKind } from '../types/styles';
2
+ export interface StyleValidationIssue {
3
+ path: string;
4
+ message: string;
5
+ }
6
+ export declare function isValidStyleKind(value: unknown): value is StyleKind;
7
+ export declare function validateStyleTree(styles: unknown, knownTargets?: Set<string>): StyleValidationIssue[];
8
+ export declare function collectStyleTargetsFromHtml(html: string): Set<string>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidStyleKind = isValidStyleKind;
4
+ exports.validateStyleTree = validateStyleTree;
5
+ exports.collectStyleTargetsFromHtml = collectStyleTargetsFromHtml;
6
+ const STYLE_KINDS = new Set(['text', 'card', 'button', 'grid', 'section']);
7
+ function isValidStyleKind(value) {
8
+ return typeof value === 'string' && STYLE_KINDS.has(value);
9
+ }
10
+ function validateStyleTree(styles, knownTargets) {
11
+ const issues = [];
12
+ if (styles === undefined || styles === null)
13
+ return issues;
14
+ if (typeof styles !== 'object' || Array.isArray(styles)) {
15
+ issues.push({ path: 'styles', message: 'styles must be an object' });
16
+ return issues;
17
+ }
18
+ for (const [path, value] of Object.entries(styles)) {
19
+ if (!path.trim()) {
20
+ issues.push({ path: 'styles', message: 'style path cannot be empty' });
21
+ continue;
22
+ }
23
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) {
24
+ issues.push({ path: `styles.${path}`, message: 'style entry must be an object' });
25
+ continue;
26
+ }
27
+ if (knownTargets && !knownTargets.has(path)) {
28
+ issues.push({
29
+ path: `styles.${path}`,
30
+ message: 'no matching data-preview-style-target marker in template',
31
+ });
32
+ }
33
+ }
34
+ return issues;
35
+ }
36
+ function collectStyleTargetsFromHtml(html) {
37
+ const targets = new Set();
38
+ const attrPattern = /data-preview-style-target=["']([^"']+)["']/g;
39
+ let match;
40
+ while ((match = attrPattern.exec(html)) !== null) {
41
+ targets.add(match[1]);
42
+ }
43
+ return targets;
44
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@deneb-ui/core",
3
+ "version": "2.0.24",
4
+ "description": "Headless style engine for real-time Fivora visual editing — CSS variables, DOM patcher, and preview protocol.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./install-fonts": {
13
+ "types": "./dist/fonts/installProject.d.ts",
14
+ "default": "./dist/fonts/installProject.js"
15
+ }
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/deneb-ui/core.git",
23
+ "directory": "packages/deneb-core"
24
+ },
25
+ "homepage": "https://deneb.fivora.site",
26
+ "bugs": {
27
+ "url": "https://github.com/deneb-ui/core/issues"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "test": "npm run build && node --test src/fonts/__tests__/fonts.test.cjs",
36
+ "prepublishOnly": "npm run build"
37
+ },
38
+ "keywords": [
39
+ "deneb",
40
+ "deneb-ui",
41
+ "fivora",
42
+ "visual-editing",
43
+ "css-variables",
44
+ "style-engine"
45
+ ],
46
+ "author": "Chamika Gayashan & Induranga Kawishwara",
47
+ "license": "MIT",
48
+ "devDependencies": {
49
+ "@types/node": "^22.0.0",
50
+ "typescript": "^5.0.0"
51
+ }
52
+ }