@levo-so/studio 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.
- package/dist/blockSmith/ContentSchemaGenerator.d.ts +4 -0
- package/dist/blockSmith/DefaultContentGenerator.d.ts +2 -0
- package/dist/blockSmith/DefaultStylesGenerator.d.ts +2 -0
- package/dist/blockSmith/index.d.ts +3 -0
- package/dist/blockSmith/variablePropertMap.d.ts +2 -0
- package/dist/bridge/Highlighter.d.ts +8 -0
- package/dist/bridge/PreviewHighlighter.d.ts +2 -0
- package/dist/bridge/StudioBlockPreview.d.ts +7 -0
- package/dist/bridge/StudioPagePreview.d.ts +16 -0
- package/dist/bridge/StudioPreview.d.ts +20 -0
- package/dist/bridge/constants.d.ts +7 -0
- package/dist/bridge/index.d.ts +5 -0
- package/dist/bridge/types.d.ts +33 -0
- package/dist/bridge/utils.d.ts +7 -0
- package/dist/components/ActionWrapper.d.ts +8 -0
- package/dist/components/BackgroundVideo.d.ts +6 -0
- package/dist/components/backgroundPresets/Beams.d.ts +10 -0
- package/dist/components/backgroundPresets/Dots.d.ts +12 -0
- package/dist/components/backgroundPresets/Gradient.d.ts +10 -0
- package/dist/components/backgroundPresets/Grid.d.ts +14 -0
- package/dist/components/backgroundPresets/Waves.d.ts +12 -0
- package/dist/components/backgroundPresets/exports.d.ts +10 -0
- package/dist/components/backgroundPresets/index.d.ts +9 -0
- package/dist/components/backgroundPresets/presetSystem.d.ts +10 -0
- package/dist/components/backgroundPresets/presetUtils.d.ts +19 -0
- package/dist/components/backgroundPresets/presets.d.ts +39 -0
- package/dist/components/withBlockProps copy.d.ts +61 -0
- package/dist/components/withBlockProps.d.ts +61 -0
- package/dist/contentEngine/cache.d.ts +5 -0
- package/dist/contentEngine/config.d.ts +3 -0
- package/dist/contentEngine/content.d.ts +21 -0
- package/dist/contentEngine/getPage.d.ts +8 -0
- package/dist/contentEngine/head_code.d.ts +3 -0
- package/dist/contentEngine/index.d.ts +7 -0
- package/dist/contentEngine/sourceFetcher.d.ts +12 -0
- package/dist/contentEngine/themeUtils.d.ts +81 -0
- package/dist/contentEngine/types.d.ts +25 -0
- package/dist/contentEngine/urlBuilder.d.ts +3 -0
- package/dist/contentEngine/useContentEngine.d.ts +9 -0
- package/dist/core/BlockRegistry.d.ts +20 -0
- package/dist/core/LevoBlock.d.ts +15 -0
- package/dist/core/LevoPage.d.ts +12 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/elements/Box.d.ts +7 -0
- package/dist/elements/Button.d.ts +10 -0
- package/dist/elements/Carousel.d.ts +19 -0
- package/dist/elements/Container.d.ts +6 -0
- package/dist/elements/Form.d.ts +6 -0
- package/dist/elements/Heading.d.ts +7 -0
- package/dist/elements/Icon.d.ts +10 -0
- package/dist/elements/Iframe.d.ts +7 -0
- package/dist/elements/Image.d.ts +17 -0
- package/dist/elements/Link.d.ts +6 -0
- package/dist/elements/Media.d.ts +22 -0
- package/dist/elements/Section.d.ts +7 -0
- package/dist/elements/Typography.d.ts +8 -0
- package/dist/elements/accordion/index.d.ts +20 -0
- package/dist/elements/index.d.ts +16 -0
- package/dist/elements/popover/index.d.ts +17 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +10762 -0
- package/dist/interfaces/block.d.ts +50 -0
- package/dist/interfaces/contentSchema.d.ts +29 -0
- package/dist/interfaces/index.d.ts +7 -0
- package/dist/interfaces/levoBlock.d.ts +203 -0
- package/dist/interfaces/site.d.ts +179 -0
- package/dist/interfaces/sites.d.ts +32 -0
- package/dist/interfaces/theme.d.ts +144 -0
- package/dist/pixel/constants/borderRadius.d.ts +43 -0
- package/dist/pixel/constants/colorOptions.d.ts +73 -0
- package/dist/pixel/constants/fontSizeOptions.d.ts +58 -0
- package/dist/pixel/constants/marginOptions.d.ts +183 -0
- package/dist/pixel/constants/spaceOptions.d.ts +178 -0
- package/dist/pixel/index.d.ts +3 -0
- package/dist/pixel/optionsMap.d.ts +14 -0
- package/dist/pixel/propertyMap.d.ts +2 -0
- package/dist/providers/AuthProvider.d.ts +25 -0
- package/dist/providers/BlockContext.d.ts +16 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/theme/defaultTheme.d.ts +3 -0
- package/dist/utils/blockHelpers.d.ts +5 -0
- package/dist/utils/blocksLevoClient.d.ts +5 -0
- package/dist/utils/colorUtils.d.ts +54 -0
- package/dist/utils/getKeysWithValue.d.ts +3 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/withBlockPropsUtils.d.ts +132 -0
- package/package.json +72 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { IFieldConfig, AnimationConfig } from '../interfaces';
|
|
3
|
+
import { MotionProps } from 'motion/react';
|
|
4
|
+
type MutableDeep<T> = T extends object ? {
|
|
5
|
+
-readonly [K in keyof T]: MutableDeep<T[K]>;
|
|
6
|
+
} : T;
|
|
7
|
+
/**
|
|
8
|
+
* Animation props interface for components using Framer Motion types
|
|
9
|
+
* This is the processed version of AnimationConfig used by components
|
|
10
|
+
*/
|
|
11
|
+
export interface AnimationProps {
|
|
12
|
+
initial?: MutableDeep<MotionProps["initial"]>;
|
|
13
|
+
animate?: MutableDeep<MotionProps["animate"]>;
|
|
14
|
+
whileHover?: MutableDeep<MotionProps["whileHover"]>;
|
|
15
|
+
exit?: MutableDeep<MotionProps["exit"]>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extended props interface for useCommonProps return type
|
|
19
|
+
*/
|
|
20
|
+
export type ExtendedProps<P extends Record<string, any>> = P & {
|
|
21
|
+
elementKey: string;
|
|
22
|
+
config: any;
|
|
23
|
+
styles: any;
|
|
24
|
+
content: any;
|
|
25
|
+
generatedClassName: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* withBlockProps Utilities
|
|
29
|
+
*
|
|
30
|
+
* Consolidated utility functions extracted from withBlockProps.tsx
|
|
31
|
+
* to improve code organization and reusability.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Utility function to safely access nested object properties
|
|
35
|
+
*
|
|
36
|
+
* Handles dot-notation paths and array indices to extract values
|
|
37
|
+
* from deeply nested block data structures
|
|
38
|
+
*
|
|
39
|
+
* @param obj - The object to traverse
|
|
40
|
+
* @param path - Dot-notation path to the desired property
|
|
41
|
+
* @returns The value at the specified path or undefined if not found
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* getNestedValue({ user: { profile: { name: 'John' } } }, 'user.profile.name') // 'John'
|
|
45
|
+
* getNestedValue({ items: [{ id: 1 }, { id: 2 }] }, 'items.0.id') // 1
|
|
46
|
+
*/
|
|
47
|
+
export declare const getNestedValue: <P = unknown>(obj: Record<string, unknown>, path: string) => P | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Type guard to check if a config object has selectedVariants
|
|
50
|
+
*/
|
|
51
|
+
export declare const isConfigWithVariants: (val: unknown) => val is {
|
|
52
|
+
selectedVariants: Record<string, string>;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Sanitizes element key for use in CSS class names
|
|
56
|
+
* Replaces dots with dashes and removes invalid characters
|
|
57
|
+
*/
|
|
58
|
+
export declare const sanitizeElementKey: (elementKey: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* Hook to create a stable animation configuration that only updates when the config actually changes
|
|
61
|
+
* Uses deep equality comparison to prevent animation re-triggers when object references change
|
|
62
|
+
*
|
|
63
|
+
* @param animationConfig - The current animation configuration from field config
|
|
64
|
+
* @returns Stable animation configuration object
|
|
65
|
+
*/
|
|
66
|
+
export declare const useStableAnimationConfig: (animationConfig: AnimationConfig | null | undefined) => AnimationConfig | null;
|
|
67
|
+
/**
|
|
68
|
+
* Generates standardized animation props for Framer Motion components
|
|
69
|
+
*
|
|
70
|
+
* @param animationConfig - The animation configuration object
|
|
71
|
+
* @returns Object containing initial, animate, whileHover, and exit props
|
|
72
|
+
*/
|
|
73
|
+
export declare const generateAnimationProps: (animationConfig: AnimationConfig | null | undefined) => AnimationProps;
|
|
74
|
+
/**
|
|
75
|
+
* Determines the animate value based on visibility state
|
|
76
|
+
*
|
|
77
|
+
* @param isInView - Whether the element is in view
|
|
78
|
+
* @param animationProps - The animation props object
|
|
79
|
+
* @returns The appropriate animate value
|
|
80
|
+
*/
|
|
81
|
+
export declare const getAnimateValue: (isInView: boolean, animationProps: AnimationProps) => MutableDeep<MotionProps["animate"]> | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Generates variant CSS classes from selected variants configuration
|
|
84
|
+
*
|
|
85
|
+
* @param configValue - The field configuration containing selectedVariants
|
|
86
|
+
* @returns Array of variant class names
|
|
87
|
+
*/
|
|
88
|
+
export declare const generateVariantClasses: (configValue: IFieldConfig | undefined) => string[];
|
|
89
|
+
/**
|
|
90
|
+
* Generates the complete CSS class name for an element
|
|
91
|
+
* Combines base class with variant classes for complete CSS targeting
|
|
92
|
+
*
|
|
93
|
+
* @param elementKey - The element key identifier
|
|
94
|
+
* @param blockId - The block ID
|
|
95
|
+
* @param configValue - The field configuration
|
|
96
|
+
* @returns Complete CSS class name string
|
|
97
|
+
*/
|
|
98
|
+
export declare const generateElementClassName: (elementKey: string, blockId: string, configValue: IFieldConfig | undefined) => string;
|
|
99
|
+
/**
|
|
100
|
+
* Hook to generate and memoize CSS class names for an element
|
|
101
|
+
* Prevents unnecessary re-renders when class names haven't changed
|
|
102
|
+
*
|
|
103
|
+
* @param elementKey - The element key identifier
|
|
104
|
+
* @param blockId - The block ID
|
|
105
|
+
* @param configValue - The field configuration
|
|
106
|
+
* @returns Memoized CSS class name string
|
|
107
|
+
*/
|
|
108
|
+
export declare const useGeneratedClassName: (elementKey: string, blockId: string, configValue: IFieldConfig | undefined) => string;
|
|
109
|
+
/**
|
|
110
|
+
* Hook to create a memoized Motion component
|
|
111
|
+
* Only recreates the component when animation config changes
|
|
112
|
+
*
|
|
113
|
+
* @param WrappedComponent - The component to wrap with motion
|
|
114
|
+
* @param animationConfig - The animation configuration
|
|
115
|
+
* @returns Memoized Motion component or null if no animation
|
|
116
|
+
*/
|
|
117
|
+
export declare const useMotionComponent: <P extends Record<string, any>>(WrappedComponent: ComponentType<P>, animationConfig: AnimationConfig | null | undefined) => ComponentType<any> | null;
|
|
118
|
+
/**
|
|
119
|
+
* Hook to create memoized common props for components
|
|
120
|
+
* Excludes frequently changing props that don't affect animation
|
|
121
|
+
*
|
|
122
|
+
* @param props - The original props object
|
|
123
|
+
* @param elementKey - The element key
|
|
124
|
+
* @param configValue - The field configuration
|
|
125
|
+
* @param stylesValue - The styles value
|
|
126
|
+
* @param contentValue - The content value
|
|
127
|
+
* @param generatedClassName - The generated CSS class name
|
|
128
|
+
* @returns Memoized common props object
|
|
129
|
+
*/
|
|
130
|
+
export declare const useCommonProps: <P extends Record<string, any>>(props: P, elementKey: string, configValue: any, stylesValue: any, contentValue: any, generatedClassName: string) => ExtendedProps<P>;
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=withBlockPropsUtils.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@levo-so/studio",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"author": "Levo Engineering <devs@theinternetfolks.com>",
|
|
5
|
+
"description": "Levo Studio components and utilities for building block-based pages",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**/*",
|
|
13
|
+
"!dist/**/*.d.ts.map",
|
|
14
|
+
"package.json"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"clean": "rimraf dist node_modules .turbo",
|
|
18
|
+
"check-types": "tsc --noEmit",
|
|
19
|
+
"lint": "eslint",
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"dev": "vite build --watch"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@levo-so/core": "workspace:*",
|
|
25
|
+
"@levo-so/react": "workspace:*",
|
|
26
|
+
"@levo-so/react-collection": "workspace:*",
|
|
27
|
+
"react": ">=18",
|
|
28
|
+
"react-dom": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@radix-ui/react-accordion": "1.2.0",
|
|
32
|
+
"@radix-ui/react-popover": "1.1.1",
|
|
33
|
+
"@theinternetfolks/mate": "1.0.4",
|
|
34
|
+
"class-variance-authority": "0.7.0",
|
|
35
|
+
"culori": "4.0.1",
|
|
36
|
+
"deepmerge-ts": "7.1.5",
|
|
37
|
+
"embla-carousel-auto-scroll": "8.1.8",
|
|
38
|
+
"embla-carousel-autoplay": "8.6.0",
|
|
39
|
+
"embla-carousel-react": "8.1.8",
|
|
40
|
+
"embla-carousel-wheel-gestures": "8.0.1",
|
|
41
|
+
"fast-deep-equal": "3.1.3",
|
|
42
|
+
"html-react-parser": "5.1.12",
|
|
43
|
+
"isomorphic-dompurify": "2.14.0",
|
|
44
|
+
"lucide-react": "0.424.0",
|
|
45
|
+
"motion": "12.23.6",
|
|
46
|
+
"react-icons": "5.2.1",
|
|
47
|
+
"use-debounce": "10.0.2"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@levo/eslint-config": "workspace:*",
|
|
51
|
+
"@levo/ts-config": "workspace:*",
|
|
52
|
+
"@levo/tw-config": "workspace:*",
|
|
53
|
+
"@types/culori": "4.0.0",
|
|
54
|
+
"@types/node": "20.16.5",
|
|
55
|
+
"@types/react": "19.1.8",
|
|
56
|
+
"@types/react-dom": "19.1.6",
|
|
57
|
+
"@vitejs/plugin-react": "4.3.4",
|
|
58
|
+
"rollup-preserve-directives": "1.1.1",
|
|
59
|
+
"typescript": "5.8.2",
|
|
60
|
+
"vite": "6.0.5",
|
|
61
|
+
"vite-plugin-dts": "4.1.0"
|
|
62
|
+
},
|
|
63
|
+
"main": "./dist/index.js",
|
|
64
|
+
"module": "./dist/index.js",
|
|
65
|
+
"types": "./dist/index.d.ts",
|
|
66
|
+
"exports": {
|
|
67
|
+
".": {
|
|
68
|
+
"types": "./dist/index.d.ts",
|
|
69
|
+
"default": "./dist/index.js"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|