@eduboxpro/studio 0.1.2 → 0.1.4
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 +47 -0
- package/fesm2022/eduboxpro-studio.mjs +425 -91
- package/fesm2022/eduboxpro-studio.mjs.map +1 -1
- package/index.d.ts +191 -35
- package/package.json +3 -2
- package/src/styles/_tokens.scss +4 -0
package/README.md
CHANGED
|
@@ -61,6 +61,53 @@ import { ButtonComponent } from '@eduboxpro/studio/primitives';
|
|
|
61
61
|
- **Tree-shakeable** - Optimized bundle size
|
|
62
62
|
- **Zero Dependencies** - Only Angular core
|
|
63
63
|
|
|
64
|
+
## Utilities
|
|
65
|
+
|
|
66
|
+
The library includes helper utilities for common tasks:
|
|
67
|
+
|
|
68
|
+
### URL Validation
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { isSafeUrl, sanitizeUrl } from '@eduboxpro/studio/utils';
|
|
72
|
+
|
|
73
|
+
// Check if URL is safe
|
|
74
|
+
isSafeUrl('https://example.com'); // true
|
|
75
|
+
isSafeUrl('javascript:alert(1)'); // false
|
|
76
|
+
|
|
77
|
+
// Sanitize URL (blocks unsafe schemes)
|
|
78
|
+
sanitizeUrl('https://example.com'); // 'https://example.com'
|
|
79
|
+
sanitizeUrl('javascript:alert(1)'); // '#' (blocked with console warning)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Class Names Helper
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { classNames } from '@eduboxpro/studio/utils';
|
|
86
|
+
|
|
87
|
+
// Combine CSS classes, filtering out falsy values
|
|
88
|
+
classNames('btn', 'btn-primary'); // 'btn btn-primary'
|
|
89
|
+
classNames('btn', isActive && 'active'); // 'btn active' or 'btn'
|
|
90
|
+
classNames('btn', undefined, null, false); // 'btn'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Config Helpers
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { withConfigDefault } from '@eduboxpro/studio/utils';
|
|
97
|
+
|
|
98
|
+
// Create configurable component inputs with fallback chain
|
|
99
|
+
export class MyComponent {
|
|
100
|
+
private defaults = computed(() => this.config().components?.myComponent);
|
|
101
|
+
|
|
102
|
+
variantInput = input<Variant>(undefined, { alias: 'variant' });
|
|
103
|
+
variant = withConfigDefault(
|
|
104
|
+
this.variantInput,
|
|
105
|
+
computed(() => this.defaults()?.variant),
|
|
106
|
+
'solid' // fallback value
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
64
111
|
## Documentation
|
|
65
112
|
|
|
66
113
|
Full documentation: https://github.com/eduboxpro/studio
|