@otl-core/cms-utils 1.1.8 → 1.1.9
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/README.md +1 -56
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,58 +1,3 @@
|
|
|
1
1
|
# @otl-core/cms-utils
|
|
2
2
|
|
|
3
|
-
Shared utility functions for OTL CMS
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @otl-core/cms-utils
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Responsive Utilities
|
|
14
|
-
|
|
15
|
-
Utility functions for working with responsive values:
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
import {
|
|
19
|
-
isResponsiveConfig,
|
|
20
|
-
getBreakpointValue,
|
|
21
|
-
getDefinedBreakpoints,
|
|
22
|
-
toResponsiveConfig,
|
|
23
|
-
fromResponsiveConfig,
|
|
24
|
-
} from "@otl-core/cms-utils";
|
|
25
|
-
import type { ResponsiveValue } from "@otl-core/cms-types";
|
|
26
|
-
|
|
27
|
-
// Check if a value is responsive
|
|
28
|
-
const value: ResponsiveValue<string> = { base: "16px", md: "20px" };
|
|
29
|
-
if (isResponsiveConfig(value)) {
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Get value for a specific breakpoint
|
|
33
|
-
const mdValue = getBreakpointValue(value, "md"); // '20px'
|
|
34
|
-
const xlValue = getBreakpointValue(value, "xl"); // '16px' (falls back to base)
|
|
35
|
-
|
|
36
|
-
// Get all defined breakpoints
|
|
37
|
-
const breakpoints = getDefinedBreakpoints(value); // ['base', 'md']
|
|
38
|
-
|
|
39
|
-
// Convert to responsive config
|
|
40
|
-
const config = toResponsiveConfig({
|
|
41
|
-
base: "1rem",
|
|
42
|
-
lg: "1.5rem",
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Convert from responsive config
|
|
46
|
-
const flat = fromResponsiveConfig(config);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Separation of Concerns
|
|
50
|
-
|
|
51
|
-
- **@otl-core/cms-types**: Type definitions only (no runtime code)
|
|
52
|
-
- **@otl-core/cms-utils**: Runtime utility functions that work with the types
|
|
53
|
-
|
|
54
|
-
This separation ensures:
|
|
55
|
-
|
|
56
|
-
- Types can be shared without bundling unnecessary code
|
|
57
|
-
- Utilities can be tree-shaken if not used
|
|
58
|
-
- Clear distinction between compile-time and runtime dependencies
|
|
3
|
+
Shared utility functions for [OTL CMS](https://otl.studio). Used by both the engine and public packages.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otl-core/cms-utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared utility functions for OTL CMS",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"url": "https://github.com/otl-core/cms-utils.git"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@otl-core/cms-types": "^1.1.
|
|
41
|
+
"@otl-core/cms-types": "^1.1.9"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@vitest/ui": "^4.0.0",
|